@things-factory/ai-assistant 10.1.165 → 10.1.167
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/client/components/panel-aria.test.ts +1 -1
- package/dist-client/components/panel-aria.test.js +1 -1
- package/dist-client/components/panel-aria.test.js.map +1 -1
- package/dist-client/tsconfig.tsbuildinfo +1 -1
- package/dist-server/service/assistant-mode/registry.js +1 -1
- package/dist-server/service/assistant-mode/registry.js.map +1 -1
- package/dist-server/tsconfig.tsbuildinfo +1 -1
- package/package.json +6 -6
- package/server/service/assistant-mode/registry.ts +1 -1
- package/translations/ko.json +4 -4
|
@@ -53,7 +53,7 @@ function getAssistantModeWarnings() {
|
|
|
53
53
|
const out = [];
|
|
54
54
|
/*
|
|
55
55
|
* 한 화면에 대화 하나 — design/ai/screen-pattern.md §3. 같은 subject 를 두 대화가 적으면 화면은 어느 쪽을
|
|
56
|
-
* 열지 모르고,
|
|
56
|
+
* 열지 모르고, 선택기로 사람에게 넘기면 원칙 3 을 어긴다. 성격이 다른 물음은 그 대화가 도구를 더 연다.
|
|
57
57
|
*/
|
|
58
58
|
const owners = new Map();
|
|
59
59
|
for (const mode of modes.values()) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"registry.js","sourceRoot":"","sources":["../../../server/service/assistant-mode/registry.ts"],"names":[],"mappings":";;AAsBA,sDAuBC;AAED,4CAEC;AAED,gDAEC;AAOD,4DAgDC;AAGD,0DAEC;AAGD,kDAEC;AAtHD;;;;;;;;;;;;GAYG;AACH,mEAA6D;AAC7D,mEAAgE;AAIhE,MAAM,KAAK,GAAG,IAAI,GAAG,EAA6B,CAAA;AAElD,MAAM,IAAI,GAAG,oCAAoC,CAAA;AAEjD,SAAgB,qBAAqB,CAAC,IAAuB;IAC3D,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE,IAAI,IAAI,EAAE,CAAC,CAAC,EAAE,CAAC;QACz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,IAAI,CAAC;oBAAE,SAAQ;gBAC/B,GAAG,CAAC,IAAI,CAAC;oBACP,IAAI,EAAE,oCAAoC;oBAC1C,MAAM,EAAE,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,KAAK,EAAE,KAAK,CAAC,IAAI,EAAE,IAAI,EAAE;oBACpD,OAAO,EACL,SAAS,IAAI,CAAC,IAAI,cAAc,KAAK,CAAC,IAAI,mBAAmB,IAAI,iCAAiC;wBAClG,IAAI,CAAC,IAAI,CAAC,cAAc,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,kEAAkE;iBAC/G,CAAC,CAAA;YACJ,CAAC;QACH,CAAC;IACH,CAAC;IACD,OAAO,GAAG,CAAA;AACZ,CAAC;AAED,uHAAuH;AACvH,SAAgB,uBAAuB,CAAC,OAAe;IACrD,OAAO,CAAC,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,QAAQ,IAAI,EAAE,CAAC,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAA;AAClF,CAAC;AAED,iBAAiB;AACjB,SAAgB,mBAAmB;IACjC,KAAK,CAAC,KAAK,EAAE,CAAA;AACf,CAAC","sourcesContent":["/**\n * The mode registry — one place that knows what each conversation is.\n *\n * Registration refuses what cannot be true later: a kind that is not `<app>.<surface>` (the door\n * looks a mode up by that name), an empty persona (the field this whole change exists to take off\n * the wire), and a second declaration of a kind that is already declared — two declarations of one\n * conversation disagree, and the one that wins would be whichever module booted last.\n *\n * What it does not refuse is a `/` sentence naming a tool the mode does not expose. That check\n * reads the tool registry, which fills up as modules boot, so it runs when asked rather than at\n * registration: `getAssistantModeWarnings()` is the answer as of now, and the boot report reads it\n * after every module is in.\n */\nimport { entryTargetOf } from '../data-entry/entry-target.js'\nimport { getToolSpecsFor } from '@things-factory/ai-client-base'\n\nimport type { AssistantModeSpec, AssistantModeWarning } from './types'\n\nconst modes = new Map<string, AssistantModeSpec>()\n\nconst KIND = /^[a-z][a-z0-9-]*\\.[a-z][a-z0-9-]*$/\n\nexport function registerAssistantMode(spec: AssistantModeSpec): void {\n if (!KIND.test(String(spec?.kind ?? ''))) {\n throw new Error(\n `[ai-assistant/assistant-mode] '${spec?.kind}' is not a mode kind. Use <app>.<surface> in lowercase — ` +\n \"'twin.space', 'plant.station', 'figure.modeller'. The client names the conversation by this.\"\n )\n }\n\n if (!String(spec.systemPrompt ?? '').trim()) {\n throw new Error(\n `[ai-assistant/assistant-mode] mode '${spec.kind}' has no systemPrompt. Who the assistant is on a ` +\n 'surface belongs to the server that owns the surface (ADR-0061 decision 7).'\n )\n }\n\n if (modes.has(spec.kind)) {\n throw new Error(\n `[ai-assistant/assistant-mode] mode '${spec.kind}' is already registered. Two declarations of one ` +\n 'conversation disagree, and which one wins would depend on boot order. Give the second one its own kind.'\n )\n }\n\n modes.set(spec.kind, spec)\n}\n\nexport function getAssistantMode(kind: string): AssistantModeSpec | undefined {\n return modes.get(kind)\n}\n\nexport function listAssistantModes(): ReadonlyArray<AssistantModeSpec> {\n return Array.from(modes.values())\n}\n\n/**\n * The promises a mode makes that its tools cannot keep, as of now.\n *\n * Read after boot: a mode may register before the category its slash sentences use.\n */\nexport function getAssistantModeWarnings(): ReadonlyArray<AssistantModeWarning> {\n const out: AssistantModeWarning[] = []\n\n /*\n * 한 화면에 대화 하나 — design/ai/screen-pattern.md §3. 같은 subject 를 두 대화가 적으면 화면은 어느 쪽을\n * 열지 모르고,
|
|
1
|
+
{"version":3,"file":"registry.js","sourceRoot":"","sources":["../../../server/service/assistant-mode/registry.ts"],"names":[],"mappings":";;AAsBA,sDAuBC;AAED,4CAEC;AAED,gDAEC;AAOD,4DAgDC;AAGD,0DAEC;AAGD,kDAEC;AAtHD;;;;;;;;;;;;GAYG;AACH,mEAA6D;AAC7D,mEAAgE;AAIhE,MAAM,KAAK,GAAG,IAAI,GAAG,EAA6B,CAAA;AAElD,MAAM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,KAAK,MAAM,KAAK,IAAI,IAAI,CAAC,cAAc,IAAI,EAAE,EAAE,CAAC;YAC9C,KAAK,MAAM,IAAI,IAAI,KAAK,CAAC,KAAK,IAAI,EAAE,EAAE,CAAC;gBACrC,IAAI,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC;oBAAE,SAAQ;gBAC/B,GAAG,CAAC,IAAI,CAAC;oBACP,IAAI,EAAE,oCAAoC;oBAC1C,MAAM,EAAE,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,KAAK,EAAE,KAAK,CAAC,IAAI,EAAE,IAAI,EAAE;oBACpD,OAAO,EACL,SAAS,IAAI,CAAC,IAAI,cAAc,KAAK,CAAC,IAAI,mBAAmB,IAAI,iCAAiC;wBAClG,IAAI,CAAC,IAAI,CAAC,cAAc,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,kEAAkE;iBAC/G,CAAC,CAAA;YACJ,CAAC;QACH,CAAC;IACH,CAAC;IACD,OAAO,GAAG,CAAA;AACZ,CAAC;AAED,uHAAuH;AACvH,SAAgB,uBAAuB,CAAC,OAAe;IACrD,OAAO,CAAC,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,QAAQ,IAAI,EAAE,CAAC,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAA;AAClF,CAAC;AAED,iBAAiB;AACjB,SAAgB,mBAAmB;IACjC,KAAK,CAAC,KAAK,EAAE,CAAA;AACf,CAAC","sourcesContent":["/**\n * The mode registry — one place that knows what each conversation is.\n *\n * Registration refuses what cannot be true later: a kind that is not `<app>.<surface>` (the door\n * looks a mode up by that name), an empty persona (the field this whole change exists to take off\n * the wire), and a second declaration of a kind that is already declared — two declarations of one\n * conversation disagree, and the one that wins would be whichever module booted last.\n *\n * What it does not refuse is a `/` sentence naming a tool the mode does not expose. That check\n * reads the tool registry, which fills up as modules boot, so it runs when asked rather than at\n * registration: `getAssistantModeWarnings()` is the answer as of now, and the boot report reads it\n * after every module is in.\n */\nimport { entryTargetOf } from '../data-entry/entry-target.js'\nimport { getToolSpecsFor } from '@things-factory/ai-client-base'\n\nimport type { AssistantModeSpec, AssistantModeWarning } from './types'\n\nconst modes = new Map<string, AssistantModeSpec>()\n\nconst KIND = /^[a-z][a-z0-9-]*\\.[a-z][a-z0-9-]*$/\n\nexport function registerAssistantMode(spec: AssistantModeSpec): void {\n if (!KIND.test(String(spec?.kind ?? ''))) {\n throw new Error(\n `[ai-assistant/assistant-mode] '${spec?.kind}' is not a mode kind. Use <app>.<surface> in lowercase — ` +\n \"'twin.space', 'plant.station', 'figure.modeller'. The client names the conversation by this.\"\n )\n }\n\n if (!String(spec.systemPrompt ?? '').trim()) {\n throw new Error(\n `[ai-assistant/assistant-mode] mode '${spec.kind}' has no systemPrompt. Who the assistant is on a ` +\n 'surface belongs to the server that owns the surface (ADR-0061 decision 7).'\n )\n }\n\n if (modes.has(spec.kind)) {\n throw new Error(\n `[ai-assistant/assistant-mode] mode '${spec.kind}' is already registered. Two declarations of one ` +\n 'conversation disagree, and which one wins would depend on boot order. Give the second one its own kind.'\n )\n }\n\n modes.set(spec.kind, spec)\n}\n\nexport function getAssistantMode(kind: string): AssistantModeSpec | undefined {\n return modes.get(kind)\n}\n\nexport function listAssistantModes(): ReadonlyArray<AssistantModeSpec> {\n return Array.from(modes.values())\n}\n\n/**\n * The promises a mode makes that its tools cannot keep, as of now.\n *\n * Read after boot: a mode may register before the category its slash sentences use.\n */\nexport function getAssistantModeWarnings(): ReadonlyArray<AssistantModeWarning> {\n const out: AssistantModeWarning[] = []\n\n /*\n * 한 화면에 대화 하나 — design/ai/screen-pattern.md §3. 같은 subject 를 두 대화가 적으면 화면은 어느 쪽을\n * 열지 모르고, 선택기로 사람에게 넘기면 원칙 3 을 어긴다. 성격이 다른 물음은 그 대화가 도구를 더 연다.\n */\n const owners = new Map<string, string[]>()\n for (const mode of modes.values()) {\n for (const subject of mode.subjects ?? []) owners.set(subject, [...(owners.get(subject) ?? []), mode.kind])\n }\n for (const [subject, kinds] of owners) {\n if (kinds.length < 2) continue\n out.push({\n code: 'assistant-mode-subject-claimed-twice',\n params: { kind: kinds[0], subject, kinds },\n message: `subject '${subject}' has more than one conversation (${kinds.join(', ')}) — a screen has one conversation; open more tools in one of them`\n })\n }\n\n for (const mode of modes.values()) {\n /* A record the mode says it enters, which no app registered - the tool never appears and the person is told nothing. */\n for (const key of mode.entryTargets ?? []) {\n if (entryTargetOf(key)) continue\n out.push({\n code: 'assistant-mode-entry-target-unknown',\n params: { kind: mode.kind, target: key },\n message: `mode '${mode.kind}' enters '${key}', which no application registered with registerEntryTarget`\n })\n }\n }\n\n for (const mode of modes.values()) {\n const exposed = new Set(getToolSpecsFor(mode.toolCategories ?? []).map(spec => spec.name))\n for (const slash of mode.slashTemplates ?? []) {\n for (const tool of slash.tools ?? []) {\n if (exposed.has(tool)) continue\n out.push({\n code: 'assistant-mode-slash-outside-tools',\n params: { kind: mode.kind, slash: slash.name, tool },\n message:\n `mode '${mode.kind}' offers '/${slash.name}', which needs '${tool}' — not in its tool categories ` +\n `[${(mode.toolCategories ?? []).join(', ')}]. The person presses it and the model answers without doing it.`\n })\n }\n }\n }\n return out\n}\n\n/** The conversation a screen showing this kind of subject opens — one per subject (design/ai/screen-pattern.md §3). */\nexport function assistantModeForSubject(subject: string): AssistantModeSpec | undefined {\n return [...modes.values()].find(mode => (mode.subjects ?? []).includes(subject))\n}\n\n/** Test only. */\nexport function clearAssistantModes(): void {\n modes.clear()\n}\n"]}
|