shieldx/ai-act-kompass/src/engine/templatesCompany.ts
Claude 08968a85a1
feat(ai-act-kompass): FR/IT/ES locales, EN fallback architecture, PWA install support
- Full UI dictionaries for French, Italian and Spanish (all views,
  wizard, legal gate, templates); browser-language auto-detection
  extended to all five locales
- Fallback architecture: LText now carries optional fr/it/es entries;
  regulatory legal texts (content pack, classify reasons, document
  strings) fall back to English until legal translations land —
  clearly stated in the language setting
- Locale-aware date formatting (DE dots, FR/IT/ES slashes, EN ISO)
- PWA: web app manifest, network-first service worker with offline
  cache fallback, generated icons (512/192/apple-touch) — installable
  on phone home screen and macOS dock
- 2 new tests incl. dictionary-completeness check for FR/IT/ES
  (58 total)

Claude-Session: https://claude.ai/code/session_017YjohVNx1ZGNM4MX7tHpfv
2026-07-04 10:05:28 +00:00

177 lines
12 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import type { Locale } from '../i18n/types';
import { docStrings, formatDocDate } from './docStrings';
import type { AISystem, CompanyProfile, ContentPack } from './types';
/** Gemeinsamer Kopf für unternehmensweite Vordrucke. */
function head(
title: string,
pack: ContentPack,
today: string,
locale: Locale,
profile?: CompanyProfile,
): string {
const s = docStrings(locale);
const company = profile && profile.name.trim() !== '' ? profile.name : '_______________';
return [
`# ${title}`,
'',
`**${s.meta.company}:** ${company} · **${s.meta.createdAt}:** ${formatDocDate(today, locale)} · Content-Pack v${pack.version}`,
'',
s.disclaimer,
'',
].join('\n');
}
/** Vordruck: Interne KI-Richtlinie (AI Policy) — Rahmenentwurf. */
export function aiPolicy(
pack: ContentPack,
today: string,
profile?: CompanyProfile,
locale: Locale = 'de',
): string {
const s = docStrings(locale);
const T = locale !== 'de'
? {
title: 'Internal AI policy (draft framework)',
sections: [
['Scope', 'This policy applies to all employees and governs the use of AI systems and AI-generated content in the company.'],
['Approved AI systems', 'Only AI systems listed in the company AI inventory may be used for business purposes. New tools require prior approval by [responsible unit].'],
['Prohibited uses', 'Entering trade secrets, personal data or customer data into non-approved AI services is prohibited. Practices prohibited under Art. 5 EU AI Act must not be implemented or commissioned.'],
['Human oversight', 'AI output supporting decisions affecting persons must be reviewed by a competent human before taking effect.'],
['Transparency', 'AI interaction with customers and AI-generated content is disclosed and marked in accordance with Art. 50 EU AI Act.'],
['Data protection', 'GDPR requirements (legal basis, information duties, DPIA where required) are checked before any deployment.'],
['Training', 'All employees using AI receive training appropriate to their role (Art. 4 EU AI Act); participation is documented.'],
['Incidents', 'Malfunctions and suspected serious incidents must be reported immediately to [contact]; the Art. 73 reporting process applies.'],
['Responsibilities', 'AI officer: [name]. Data protection officer: [name]. Works council involvement per BetrVG/works agreement.'],
['Entry into force and review', 'This policy enters into force on [date] and is reviewed at least annually.'],
],
}
: {
title: 'Interne KI-Richtlinie (Rahmenentwurf)',
sections: [
['Geltungsbereich', 'Diese Richtlinie gilt für alle Beschäftigten und regelt die Nutzung von KI-Systemen und KI-generierten Inhalten im Unternehmen.'],
['Freigegebene KI-Systeme', 'Für dienstliche Zwecke dürfen nur KI-Systeme genutzt werden, die im KI-Inventar des Unternehmens gelistet sind. Neue Tools bedürfen der vorherigen Freigabe durch [zuständige Stelle].'],
['Verbotene Nutzungen', 'Die Eingabe von Geschäftsgeheimnissen, personenbezogenen Daten oder Kundendaten in nicht freigegebene KI-Dienste ist untersagt. Nach Art. 5 EU-KI-VO verbotene Praktiken dürfen weder umgesetzt noch beauftragt werden.'],
['Menschliche Aufsicht', 'KI-Ausgaben, die personenwirksame Entscheidungen unterstützen, werden vor Wirksamwerden durch eine fachkundige Person geprüft.'],
['Transparenz', 'KI-Interaktion mit Kunden und KI-generierte Inhalte werden gemäß Art. 50 EU-KI-VO offengelegt bzw. gekennzeichnet.'],
['Datenschutz', 'DSGVO-Anforderungen (Rechtsgrundlage, Informationspflichten, ggf. DSFA) werden vor jedem Einsatz geprüft.'],
['Schulung', 'Alle Beschäftigten, die KI nutzen, erhalten rollengerechte Schulungen (Art. 4 EU-KI-VO); die Teilnahme wird dokumentiert.'],
['Vorfälle', 'Fehlfunktionen und mutmaßlich schwerwiegende Vorfälle sind unverzüglich an [Kontakt] zu melden; es gilt der Meldeprozess nach Art. 73.'],
['Verantwortlichkeiten', 'KI-Beauftragte/r: [Name]. Datenschutzbeauftragte/r: [Name]. Einbindung des Betriebsrats gemäß BetrVG/Betriebsvereinbarung.'],
['Inkrafttreten und Überprüfung', 'Diese Richtlinie tritt am [Datum] in Kraft und wird mindestens jährlich überprüft.'],
],
};
const lines = [head(T.title, pack, today, locale, profile)];
T.sections.forEach(([sec, body], i) => {
lines.push(`## ${i + 1}. ${sec}`, '', body ?? s.todo, '');
});
return lines.join('\n');
}
/** Vordruck: Schulungsplan & Nachweis KI-Kompetenz (Art. 4). */
export function trainingPlan(
systems: readonly AISystem[],
pack: ContentPack,
today: string,
profile?: CompanyProfile,
locale: Locale = 'de',
): string {
const T = locale !== 'de'
? {
title: 'AI literacy training plan & record (Art. 4)',
intro: 'Art. 4 EU AI Act requires a sufficient level of AI literacy for staff dealing with AI systems — in force since 2 February 2025. This document plans the measures and serves as evidence.',
matrix: 'Training matrix',
cols: '| Target group | Content | Format | Interval | Evidence |',
colsSep: '|---|---|---|---|---|',
rows: [
'| All employees | AI basics, opportunities/risks, internal AI policy | e-learning | annually | participation list |',
'| Users of the systems listed below | system-specific operation, limits, human oversight | workshop | before first use + on changes | certificate |',
'| Management / AI officer | AI Act obligations, incident process, liability | seminar | annually | certificate |',
],
record: 'Training record (to be completed)',
recordCols: '| Date | Employee | Training | Trainer | Signature |',
recordSep: '|---|---|---|---|---|',
systemsTitle: 'Systems in scope',
}
: {
title: 'Schulungsplan & Nachweis KI-Kompetenz (Art. 4)',
intro: 'Art. 4 EU-KI-VO verlangt ein ausreichendes Maß an KI-Kompetenz für Personal, das mit KI-Systemen umgeht — in Kraft seit 2. Februar 2025. Dieses Dokument plant die Maßnahmen und dient als Nachweis.',
matrix: 'Schulungsmatrix',
cols: '| Zielgruppe | Inhalte | Format | Turnus | Nachweis |',
colsSep: '|---|---|---|---|---|',
rows: [
'| Alle Beschäftigten | KI-Grundlagen, Chancen/Risiken, interne KI-Richtlinie | E-Learning | jährlich | Teilnahmeliste |',
'| Nutzer der unten gelisteten Systeme | systemspezifische Bedienung, Grenzen, menschliche Aufsicht | Workshop | vor Erstnutzung + bei Änderungen | Zertifikat |',
'| Führungskräfte / KI-Beauftragte | AI-Act-Pflichten, Vorfallprozess, Haftung | Seminar | jährlich | Zertifikat |',
],
record: 'Schulungsnachweis (fortlaufend zu führen)',
recordCols: '| Datum | Beschäftigte/r | Schulung | Trainer | Unterschrift |',
recordSep: '|---|---|---|---|---|',
systemsTitle: 'Betroffene Systeme',
};
const lines = [head(T.title, pack, today, locale, profile)];
lines.push(T.intro, '', `## ${T.matrix}`, '', T.cols, T.colsSep, ...T.rows, '');
lines.push(`## ${T.systemsTitle}`, '');
if (systems.length === 0) {
lines.push('—', '');
} else {
for (const sys of systems) {
lines.push(`- ${sys.name}${sys.purpose ? `${sys.purpose}` : ''}`);
}
lines.push('');
}
lines.push(`## ${T.record}`, '', T.recordCols, T.recordSep, '| | | | | |', '| | | | | |', '| | | | | |');
return lines.join('\n');
}
/** Vordruck: Betriebsvereinbarung KI (Rahmenentwurf, Deutschland). */
export function worksAgreement(
pack: ContentPack,
today: string,
profile?: CompanyProfile,
locale: Locale = 'de',
): string {
const s = docStrings(locale);
const T = locale !== 'de'
? {
title: 'Works agreement on the use of AI systems (draft framework, Germany)',
parties: 'Between the employer [company] and the works council of [site], the following works agreement is concluded pursuant to Sec. 87 (1) No. 6, Sec. 90 BetrVG:',
sections: [
['§ 1 Scope', 'This agreement applies to all employees of the site and to the AI systems listed in Annex 1 (AI inventory).'],
['§ 2 Purpose limitation', 'The systems are used exclusively for the purposes described in Annex 1. Performance and behaviour monitoring beyond that is not permitted.'],
['§ 3 No fully automated personnel decisions', 'Decisions with legal effect for employees (e.g. hiring, promotion, termination) are always taken by humans; AI output is decision support only.'],
['§ 4 Data protection', 'Employee data is processed only per Annex 2 (data catalogue). Evaluations for individual performance review require the works councils consent.'],
['§ 5 Information and training', 'Affected employees are informed before commissioning (Art. 26(7) AI Act) and trained per Art. 4 AI Act.'],
['§ 6 Introduction of new systems / changes', 'New AI systems or substantial changes require timely information of the works council (Sec. 90 BetrVG) and an addendum to Annex 1.'],
['§ 7 Rights of the works council', 'The works council may inspect logging data relevant to employees and consult external expertise where required (Sec. 80 (3) BetrVG).'],
['§ 8 Term and termination', 'This agreement enters into force upon signature and may be terminated with [3] months notice; its after-effect applies.'],
],
signature: 'Place, date: _______________\n\nEmployer: _______________ Works council: _______________',
}
: {
title: 'Betriebsvereinbarung über den Einsatz von KI-Systemen (Rahmenentwurf)',
parties: 'Zwischen dem Arbeitgeber [Firma] und dem Betriebsrat des Betriebs [Standort] wird gemäß § 87 Abs. 1 Nr. 6, § 90 BetrVG folgende Betriebsvereinbarung geschlossen:',
sections: [
['§ 1 Geltungsbereich', 'Diese Vereinbarung gilt für alle Beschäftigten des Betriebs und für die in Anlage 1 (KI-Inventar) aufgeführten KI-Systeme.'],
['§ 2 Zweckbindung', 'Die Systeme werden ausschließlich zu den in Anlage 1 beschriebenen Zwecken eingesetzt. Eine darüber hinausgehende Leistungs- und Verhaltenskontrolle findet nicht statt.'],
['§ 3 Keine vollautomatisierten Personalentscheidungen', 'Entscheidungen mit Rechtswirkung für Beschäftigte (z. B. Einstellung, Beförderung, Kündigung) trifft stets ein Mensch; KI-Ausgaben sind nur Entscheidungsunterstützung.'],
['§ 4 Datenschutz', 'Beschäftigtendaten werden nur gemäß Anlage 2 (Datenkatalog) verarbeitet. Auswertungen zur individuellen Leistungsbeurteilung bedürfen der Zustimmung des Betriebsrats.'],
['§ 5 Information und Schulung', 'Betroffene Beschäftigte werden vor Inbetriebnahme informiert (Art. 26 Abs. 7 KI-VO) und nach Art. 4 KI-VO geschult.'],
['§ 6 Einführung neuer Systeme / Änderungen', 'Neue KI-Systeme oder wesentliche Änderungen erfordern die rechtzeitige Unterrichtung des Betriebsrats (§ 90 BetrVG) und eine Ergänzung der Anlage 1.'],
['§ 7 Rechte des Betriebsrats', 'Der Betriebsrat kann beschäftigtenrelevante Protokolldaten einsehen und bei Bedarf externen Sachverstand hinzuziehen (§ 80 Abs. 3 BetrVG).'],
['§ 8 Laufzeit und Kündigung', 'Diese Vereinbarung tritt mit Unterzeichnung in Kraft und kann mit einer Frist von [3] Monaten gekündigt werden; sie wirkt nach.'],
],
signature: 'Ort, Datum: _______________\n\nArbeitgeber: _______________ Betriebsrat: _______________',
};
const lines = [head(T.title, pack, today, locale, profile)];
lines.push(T.parties, '');
for (const [sec, body] of T.sections) {
lines.push(`## ${sec}`, '', body ?? s.todo, '');
}
lines.push(T.signature);
return lines.join('\n');
}