@things-factory/ai-assistant 10.1.277 → 10.1.278
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/utils/addressed-draft.test.ts +2 -2
- package/dist-client/tsconfig.tsbuildinfo +1 -1
- package/dist-client/utils/addressed-draft.test.js +2 -2
- package/dist-client/utils/addressed-draft.test.js.map +1 -1
- package/dist-server/service/assistant-mode/mode-categories.js +2 -2
- package/dist-server/service/assistant-mode/mode-categories.js.map +1 -1
- package/dist-server/service/chat-message/message-doors.d.ts +6 -10
- package/dist-server/service/chat-message/message-doors.js +5 -12
- package/dist-server/service/chat-message/message-doors.js.map +1 -1
- package/dist-server/service/data-read/read-target.d.ts +3 -4
- package/dist-server/service/data-read/read-target.js.map +1 -1
- package/dist-server/service/people/person-subject.d.ts +9 -5
- package/dist-server/service/people/person-subject.js +14 -19
- package/dist-server/service/people/person-subject.js.map +1 -1
- package/dist-server/tsconfig.tsbuildinfo +1 -1
- package/package.json +9 -9
- package/server/service/assistant-mode/mode-categories.ts +2 -2
- package/server/service/assistant-mode/mode-front.test.ts +5 -3
- package/server/service/chat-message/message-doors.test.ts +3 -3
- package/server/service/chat-message/message-doors.ts +8 -13
- package/server/service/chat-session-participant/invite-notification.test.ts +1 -1
- package/server/service/data-read/read-target.ts +3 -4
- package/server/service/people/person-subject.test.ts +15 -17
- package/server/service/people/person-subject.ts +14 -19
|
@@ -6,7 +6,7 @@ import { readFileSync } from 'fs';
|
|
|
6
6
|
import { join } from 'path';
|
|
7
7
|
import { addressedDraft } from './assistant-request-context';
|
|
8
8
|
describe('a draft said to someone', () => {
|
|
9
|
-
it('
|
|
9
|
+
it('carries their name as a mention, so sending it goes to the people of the conversation', () => {
|
|
10
10
|
expect(addressedDraft('금요일까지 가능합니다', { id: 'u-1', name: 'Admin' })).toEqual({ input: '@Admin 금요일까지 가능합니다 ', mention: ['Admin', 'u-1'] });
|
|
11
11
|
});
|
|
12
12
|
it('an empty draft still names them; a draft already naming them is left as it is', () => {
|
|
@@ -16,7 +16,7 @@ describe('a draft said to someone', () => {
|
|
|
16
16
|
it('said to nobody, it is the draft as it was - for the assistant', () => {
|
|
17
17
|
expect(addressedDraft('정리해 줘')).toEqual({ input: '정리해 줘' });
|
|
18
18
|
});
|
|
19
|
-
it('
|
|
19
|
+
it('the chat keeps the mention it puts in, and the dock hands the addressee on with the conversation', () => {
|
|
20
20
|
const chat = readFileSync(join(__dirname, '..', 'components', 'assistant-chat.ts'), 'utf8');
|
|
21
21
|
expect(chat).toMatch(/if \(addressed\.mention\) this\.pickedUserMentions\.set\(\.\.\.addressed\.mention\)/);
|
|
22
22
|
const dock = readFileSync(join(__dirname, '..', 'components', 'assistant-dock.ts'), 'utf8');
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"addressed-draft.test.js","sourceRoot":"","sources":["../../client/utils/addressed-draft.test.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAE,YAAY,EAAE,MAAM,IAAI,CAAA;AACjC,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAA;AAE3B,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAA;AAE5D,QAAQ,CAAC,yBAAyB,EAAE,GAAG,EAAE;IACvC,EAAE,CAAC,
|
|
1
|
+
{"version":3,"file":"addressed-draft.test.js","sourceRoot":"","sources":["../../client/utils/addressed-draft.test.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAE,YAAY,EAAE,MAAM,IAAI,CAAA;AACjC,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAA;AAE3B,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAA;AAE5D,QAAQ,CAAC,yBAAyB,EAAE,GAAG,EAAE;IACvC,EAAE,CAAC,uFAAuF,EAAE,GAAG,EAAE;QAC/F,MAAM,CAAC,cAAc,CAAC,aAAa,EAAE,EAAE,EAAE,EAAE,KAAK,EAAE,IAAI,EAA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AAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA","sourcesContent":["/*\n * A draft said to a person (ADR-0200 decision 3) - the answer to a question handed on goes to the one who asked, through\n * the room. Sent to the assistant it reached nobody and the to-do stayed open (2026-11-12, :4730).\n */\nimport { readFileSync } from 'fs'\nimport { join } from 'path'\n\nimport { addressedDraft } from './assistant-request-context'\n\ndescribe('a draft said to someone', () => {\n it('carries their name as a mention, so sending it goes to the people of the conversation', () => {\n expect(addressedDraft('금요일까지 가능합니다', { id: 'u-1', name: 'Admin' })).toEqual({ input: '@Admin 금요일까지 가능합니다 ', mention: ['Admin', 'u-1'] })\n })\n\n it('an empty draft still names them; a draft already naming them is left as it is', () => {\n expect(addressedDraft('', { id: 'u-1', name: 'Admin' }).input).toBe('@Admin ')\n expect(addressedDraft('@Admin 네', { id: 'u-1', name: 'Admin' }).input).toBe('@Admin 네')\n })\n\n it('said to nobody, it is the draft as it was - for the assistant', () => {\n expect(addressedDraft('정리해 줘')).toEqual({ input: '정리해 줘' })\n })\n\n it('the chat keeps the mention it puts in, and the dock hands the addressee on with the conversation', () => {\n const chat = readFileSync(join(__dirname, '..', 'components', 'assistant-chat.ts'), 'utf8')\n expect(chat).toMatch(/if \\(addressed\\.mention\\) this\\.pickedUserMentions\\.set\\(\\.\\.\\.addressed\\.mention\\)/)\n const dock = readFileSync(join(__dirname, '..', 'components', 'assistant-dock.ts'), 'utf8')\n expect(dock).toMatch(/draft: ask\\.draft, to: ask\\.to, requestId/)\n expect(dock).toMatch(/\\.draftTo=\\$\\{this\\.asking\\?\\.to\\}/)\n })\n})\n"]}
|
|
@@ -95,8 +95,8 @@ function screenTargetKeys(mode, screen, routeOf = key => (0, read_target_js_1.re
|
|
|
95
95
|
(!!screen.selectionAxes?.length && axesOfKey(mode, key).some(axis => screen.selectionAxes.includes(axis))));
|
|
96
96
|
}
|
|
97
97
|
/**
|
|
98
|
-
*
|
|
99
|
-
*
|
|
98
|
+
* Pages that prioritize this tool or card. Include a card's editing page so assistant draft requests can
|
|
99
|
+
* use it directly.
|
|
100
100
|
*/
|
|
101
101
|
function pagesOfKey(mode, key, routeOf) {
|
|
102
102
|
const card = (mode.entryTargets ?? []).includes(key) ? (0, entry_target_js_1.entryTargetOf)(key)?.screen : undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mode-categories.js","sourceRoot":"","sources":["../../../server/service/assistant-mode/mode-categories.ts"],"names":[],"mappings":";;;AA4BA,oEAEC;AAED,4DAEC;AAED,kEAEC;AAGD,4CAGC;AAMD,gDAcC;AAQD,4DAEC;AAsBD,0CAWC;AAUD,4CAQC;AAuBD,kDAqBC;AAGD,kCAKC;AAjLD,0GAA0G;AAC1G,mEAA6D;AAC7D,gEAAwE;AACxE,iEAA8D;AAC9D,6DAA4D;AAsB5D,MAAM,sBAAsB,GAAG,IAAI,GAAG,EAAgC,CAAA;AAEtE,SAAgB,4BAA4B,CAAC,QAA8B;IACzE,sBAAsB,CAAC,GAAG,CAAC,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAA;AACrD,CAAC;AAED,SAAgB,wBAAwB;IACtC,OAAO,CAAC,GAAG,sBAAsB,CAAC,MAAM,EAAE,CAAC,CAAA;AAC7C,CAAC;AAED,SAAgB,2BAA2B;IACzC,sBAAsB,CAAC,KAAK,EAAE,CAAA;AAChC,CAAC;AAED,sHAAsH;AACtH,SAAgB,gBAAgB,CAAC,UAAkB,EAAE,SAAkD,EAAE;IACvG,MAAM,SAAS,GAAG,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,wBAAwB,EAAE,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,QAAQ,IAAI,CAAC,GAAG,CAAC,UAAU,IAAI,EAAE,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC,IAAK,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,QAAS,CAAC,CAAC,CAAC,CAAC,EAAE,CA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,EAAE,OAAO,CAAC,CAAC,EAAE,GAAG,wBAAwB,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,UAAU,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC,CAAA;IACxJ,MAAM,IAAI,GAAG,CAAC,GAAG,IAAI,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,SAAS,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC,CAAC,CAAC,CAAA;IACpE,OAAO,CAAC,EAAE,EAAE,GAAG,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,EAAE,GAAG,IAAI,CAAC,GAAG,CAAC,WAAW,CAAC,EAAE,CAAC,CAAC,EAAE,WAAW,EAAE,CAAC,CAAC,CAAC,CAAA;AAC9F,CAAC","sourcesContent":["/* Read by the resolver and by the boot report, so the report and the conversation open the same tools. */\nimport { entryTargetOf } from '../data-entry/entry-target.js'\nimport { detailReadOf, readTargetOf } from '../data-read/read-target.js'\nimport { HELP_CATEGORY } from '../help-documents/help-keys.js'\nimport { PEOPLE_CATEGORIES } from '../people/people-keys.js'\n/**\n * A category another package opens in every conversation - a dashboard card (ADR-0160 decision 9). It is in reach of\n * every conversation; it is put in front only on the pages it names, and found with `openTools` elsewhere (ADR-0061\n * decision 9). Never in an unattended run: its tools are proposals, and nobody is there to press the card.\n */\nexport interface ConversationCategory {\n name: string\n /** The application routes whose conversations put it in front (`my-dashboard`). */\n frontPages?: string[]\n /**\n * The axes of the records whose selection or anchor puts it in front (`dashboard-card`) - a card picked to change is\n * changed by this category's tools, wherever the dock is open.\n */\n frontAxes?: string[]\n /**\n * What a turn asked from one of its front pages must end in - said in that turn's system prompt only. On 나의 대시보드\n * a request to see a figure is a card; asked 「이번 달 지출 합계」 there, the model answered 「0원」 in words (2026-10-25).\n */\n pageRule?: string\n}\n\nconst conversationCategories = new Map<string, ConversationCategory>()\n\nexport function registerConversationCategory(category: ConversationCategory): void {\n conversationCategories.set(category.name, category)\n}\n\nexport function conversationCategoriesOf(): ConversationCategory[] {\n return [...conversationCategories.values()]\n}\n\nexport function clearConversationCategories(): void {\n conversationCategories.clear()\n}\n\n/** The system prompt of one turn - the mode's, the open record's line, and the rules of the page it is asked from. */\nexport function turnSystemPrompt(modePrompt: string, screen: { page?: string; subjectLine?: string } = {}): string {\n const pageRules = screen.page ? conversationCategoriesOf().filter(one => one.pageRule && (one.frontPages ?? []).includes(screen.page!)).map(one => one.pageRule!) : []\n return [modePrompt, screen.subjectLine, ...pageRules].filter(Boolean).join('\\n\\n')\n}\n\n/**\n * The categories a mode opens: its own, the AI 작업 패널 (design/ai/workspace.md), the attachment reader when it\n * takes files (design/ai/shared-dock.md §9-4), and one propose tool per record it may enter (design/ai/data-entry.md).\n */\nexport function modeToolCategories(mode: { toolCategories?: string[]; attachments?: { kinds?: string[] }; entryTargets?: string[]; readTargets?: string[] }): string[] | undefined {\n const extra = [\n /* Every conversation may put a large result on the AI 작업 패널 (design/ai/workspace.md). */\n 'assistant-workspace',\n /* Every conversation may read who works here and offer to bring one of them in (people/, ADR-0073 decision 3). */\n ...PEOPLE_CATEGORIES,\n /* Every conversation may read the application's help (ADR-0181). */\n HELP_CATEGORY,\n ...(mode.attachments?.kinds?.length ? ['chat-attachments'] : []),\n ...(mode.entryTargets ?? []).map(key => `data-entry:${key}`),\n ...(mode.readTargets ?? []).map(key => `data-read:${key}`),\n ...conversationCategoriesOf().map(one => one.name)\n ]\n return [...new Set([...(mode.toolCategories ?? []), ...extra])]\n}\n\n/**\n * The categories an unattended run of a mode opens: its own and the lists it reads (design/ai/unattended-run.md §3).\n *\n * Not the 입력안 tools - nobody is there to press the card - nor the AI 작업 패널 or the attachment reader: there is no\n * conversation for a card or a file to belong to.\n */\nexport function unattendedToolCategories(mode: { toolCategories?: string[]; readTargets?: string[] }): string[] {\n return [...new Set([...(mode.toolCategories ?? []), ...(mode.readTargets ?? []).map(key => `data-read:${key}`)])]\n}\n\n/** The screen a turn is asked from - the page the dock is on, and the record its conversation is anchored to. */\nexport interface TurnScreen {\n /** The application's route of the open page (`cash-transaction-list`), as the dock sends it. */\n page?: string\n /** The axis of the record the conversation is anchored to (`contract` of `subject` · `contract:<id>`), from the stored anchor. */\n subjectAxis?: string\n /** The axes of the records the latest selection named (`contract` of `[keys] contracts contract:<id>`) - `selectionAxesOf`. */\n selectionAxes?: string[]\n}\n\n/** The line of a selection note the model reads - the client's `SELECTION_KEYS_PREFIX` (assistant-selection.ts). */\nexport const SELECTION_KEYS_LINE = '[keys]'\n\n/**\n * The axes of the records the latest selection note names (「AI와 작업」, shared-dock §2-11-1): a list hands its rows as\n * `<axis>:<uuid>`, so the rows' list is read with the tool of that axis. Put in front like an anchored record's - picked\n * on 미수금, the contracts' read was not in front, and the model looked for them among attachments and a dashboard's cards\n * before it opened the right tool (2026-10-25). A note is the server's (`appendSessionNote`, system); a person's words\n * are never read for it.\n */\nexport function selectionAxesOf(rows: { role?: string; content?: string | null }[]): string[] {\n for (let i = rows.length - 1; i >= 0; i--) {\n if (rows[i].role !== 'system') continue\n const line = String(rows[i].content ?? '')\n .split('\\n')\n .find(one => one.startsWith(SELECTION_KEYS_LINE))\n if (!line) continue\n const keys = line.slice(SELECTION_KEYS_LINE.length).trim().split(/\\s+/)\n return [...new Set(keys.map(one => one.match(/^([a-z0-9-]+):/)?.[1]).filter((one): one is string => !!one))]\n }\n return []\n}\n\ntype FrontMode = { toolCategories?: string[]; attachments?: { kinds?: string[] }; entryTargets?: string[]; readTargets?: string[] }\n\n/**\n * The records the open screen is about, among those the mode reads and enters (ADR-0061 decision 9). A key's page is\n * the screen that lists its records (ReadTarget.screen.route), the screen a card's records are seen on\n * (EntryTarget.screen) and the pages a read of one record names (DetailRead.frontPages); a key's last part is the axis\n * of its record (`office.contract` is the record of the axis `contract`) - reading and entering one record share its key.\n */\nexport function screenTargetKeys(mode: FrontMode, screen: TurnScreen, routeOf: (key: string) => string | undefined = key => readTargetOf(key)?.screen?.route): string[] {\n const keys = [...new Set([...(mode.readTargets ?? []), ...(mode.entryTargets ?? [])])]\n return keys.filter(\n key =>\n (!!screen.page && pagesOfKey(mode, key, routeOf).includes(screen.page)) ||\n (!!screen.subjectAxis && axesOfKey(mode, key).includes(screen.subjectAxis)) ||\n (!!screen.selectionAxes?.length && axesOfKey(mode, key).some(axis => screen.selectionAxes!.includes(axis)))\n )\n}\n\n/**\n * The pages a key is in front on. A card's own screen counts as its page: on 내 주간업무보고 the report line card was\n * not in front, the model opened it with `openTools`, and the answer that followed was hidden (2026-11-12).\n */\nfunction pagesOfKey(mode: FrontMode, key: string, routeOf: (key: string) => string | undefined): string[] {\n const card = (mode.entryTargets ?? []).includes(key) ? entryTargetOf(key)?.screen : undefined\n const answer = (mode.readTargets ?? []).includes(key) ? detailReadOf(key)?.frontPages ?? [] : []\n return [routeOf(key), card, ...answer].filter((page): page is string => !!page)\n}\n\n/** The records a key is about: its last part, and the axes a card joins or a whole answer covers (EntryTarget.axes · DetailRead.axes). */\nfunction axesOfKey(mode: FrontMode, key: string): string[] {\n const card = (mode.entryTargets ?? []).includes(key) ? entryTargetOf(key)?.axes ?? [] : []\n const answer = (mode.readTargets ?? []).includes(key) ? detailReadOf(key)?.axes ?? [] : []\n return [key.split('.').pop()!, ...card, ...answer]\n}\n\n/**\n * The categories a turn puts in front when the mode's tools do not fit in one call: the mode's own, the AI 작업 패널, the\n * people list and the invite card, the attachment reader, and the open screen's records. The rest the model opens with `openTools`.\n */\nexport function modeFrontCategories(mode: FrontMode, screen: TurnScreen = {}): string[] {\n const keys = screenTargetKeys(mode, screen)\n return [\n ...new Set([\n ...(mode.toolCategories ?? []),\n 'assistant-workspace',\n /*\n * Two tools, always in front: 「정연희 초대해 줘」 asked in a conversation whose tools did not fit got the answer that\n * there was no tool to look people up (2026-10-24).\n */\n ...PEOPLE_CATEGORIES,\n /* Two tools, always in front: 「지출결의는 어디서 올려?」 is asked on any screen (ADR-0181). */\n HELP_CATEGORY,\n ...(mode.attachments?.kinds?.length ? ['chat-attachments'] : []),\n ...keys.filter(key => (mode.readTargets ?? []).includes(key)).map(key => `data-read:${key}`),\n ...keys.filter(key => (mode.entryTargets ?? []).includes(key)).map(key => `data-entry:${key}`),\n ...conversationCategoriesOf()\n .filter(one => (!!screen.page && (one.frontPages ?? []).includes(screen.page)) || (one.frontAxes ?? []).some(axis => axis === screen.subjectAxis || !!screen.selectionAxes?.includes(axis)))\n .map(one => one.name)\n ])\n ]\n}\n\n/** Each screen the mode could be asked from - a page that lists one of its records, a record's axis - for the boot report. */\nexport function modeScreens(mode: FrontMode, routeOf: (key: string) => string | undefined = key => readTargetOf(key)?.screen?.route): TurnScreen[] {\n const keys = [...new Set([...(mode.readTargets ?? []), ...(mode.entryTargets ?? [])])]\n const pages = [...new Set([...keys.flatMap(key => pagesOfKey(mode, key, routeOf)), ...conversationCategoriesOf().flatMap(one => one.frontPages ?? [])])]\n const axes = [...new Set(keys.flatMap(key => axesOfKey(mode, key)))]\n return [{}, ...pages.map(page => ({ page })), ...axes.map(subjectAxis => ({ subjectAxis }))]\n}\n"]}
|
|
1
|
+
{"version":3,"file":"mode-categories.js","sourceRoot":"","sources":["../../../server/service/assistant-mode/mode-categories.ts"],"names":[],"mappings":";;;AA4BA,oEAEC;AAED,4DAEC;AAED,kEAEC;AAGD,4CAGC;AAMD,gDAcC;AAQD,4DAEC;AAsBD,0CAWC;AAUD,4CAQC;AAuBD,kDAqBC;AAGD,kCAKC;AAjLD,0GAA0G;AAC1G,mEAA6D;AAC7D,gEAAwE;AACxE,iEAA8D;AAC9D,6DAA4D;AAsB5D,MAAM,sBAAsB,GAAG,IAAI,GAAG,EAAgC,CAAA;AAEtE,SAAgB,4BAA4B,CAAC,QAA8B;IACzE,sBAAsB,CAAC,GAAG,CAAC,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAA;AACrD,CAAC;AAED,SAAgB,wBAAwB;IACtC,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E,CAAC,GAAG,CAAC,IAAI,CAAC;SACxB,CAAC;KACH,CAAA;AACH,CAAC;AAED,8HAA8H;AAC9H,SAAgB,WAAW,CAAC,IAAe,EAAE,UAA+C,GAAG,CAAC,EAAE,CAAC,IAAA,6BAAY,EAAC,GAAG,CAAC,EAAE,MAAM,EAAE,KAAK;IACjI,MAAM,IAAI,GAAG,CAAC,GAAG,IAAI,GAAG,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,WAAW,IAAI,EAAE,CAAC,EAAE,GAAG,CAAC,IAAI,CAAC,YAAY,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC,CAAA;IACtF,MAAM,KAAK,GAAG,CAAC,GAAG,IAAI,GAAG,CAAC,CAAC,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,UAAU,CAAC,IAAI,EAAE,GAAG,EAAE,OAAO,CAAC,CAAC,EAAE,GAAG,wBAAwB,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,UAAU,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC,CAAA;IACxJ,MAAM,IAAI,GAAG,CAAC,GAAG,IAAI,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,SAAS,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC,CAAC,CAAC,CAAA;IACpE,OAAO,CAAC,EAAE,EAAE,GAAG,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,EAAE,GAAG,IAAI,CAAC,GAAG,CAAC,WAAW,CAAC,EAAE,CAAC,CAAC,EAAE,WAAW,EAAE,CAAC,CAAC,CAAC,CAAA;AAC9F,CAAC","sourcesContent":["/* Read by the resolver and by the boot report, so the report and the conversation open the same tools. */\nimport { entryTargetOf } from '../data-entry/entry-target.js'\nimport { detailReadOf, readTargetOf } from '../data-read/read-target.js'\nimport { HELP_CATEGORY } from '../help-documents/help-keys.js'\nimport { PEOPLE_CATEGORIES } from '../people/people-keys.js'\n/**\n * A category another package opens in every conversation - a dashboard card (ADR-0160 decision 9). It is in reach of\n * every conversation; it is put in front only on the pages it names, and found with `openTools` elsewhere (ADR-0061\n * decision 9). Never in an unattended run: its tools are proposals, and nobody is there to press the card.\n */\nexport interface ConversationCategory {\n name: string\n /** The application routes whose conversations put it in front (`my-dashboard`). */\n frontPages?: string[]\n /**\n * The axes of the records whose selection or anchor puts it in front (`dashboard-card`) - a card picked to change is\n * changed by this category's tools, wherever the dock is open.\n */\n frontAxes?: string[]\n /**\n * What a turn asked from one of its front pages must end in - said in that turn's system prompt only. On 나의 대시보드\n * a request to see a figure is a card; asked 「이번 달 지출 합계」 there, the model answered 「0원」 in words (2026-10-25).\n */\n pageRule?: string\n}\n\nconst conversationCategories = new Map<string, ConversationCategory>()\n\nexport function registerConversationCategory(category: ConversationCategory): void {\n conversationCategories.set(category.name, category)\n}\n\nexport function conversationCategoriesOf(): ConversationCategory[] {\n return [...conversationCategories.values()]\n}\n\nexport function clearConversationCategories(): void {\n conversationCategories.clear()\n}\n\n/** The system prompt of one turn - the mode's, the open record's line, and the rules of the page it is asked from. */\nexport function turnSystemPrompt(modePrompt: string, screen: { page?: string; subjectLine?: string } = {}): string {\n const pageRules = screen.page ? conversationCategoriesOf().filter(one => one.pageRule && (one.frontPages ?? []).includes(screen.page!)).map(one => one.pageRule!) : []\n return [modePrompt, screen.subjectLine, ...pageRules].filter(Boolean).join('\\n\\n')\n}\n\n/**\n * The categories a mode opens: its own, the AI 작업 패널 (design/ai/workspace.md), the attachment reader when it\n * takes files (design/ai/shared-dock.md §9-4), and one propose tool per record it may enter (design/ai/data-entry.md).\n */\nexport function modeToolCategories(mode: { toolCategories?: string[]; attachments?: { kinds?: string[] }; entryTargets?: string[]; readTargets?: string[] }): string[] | undefined {\n const extra = [\n /* Every conversation may put a large result on the AI 작업 패널 (design/ai/workspace.md). */\n 'assistant-workspace',\n /* Every conversation may read who works here and offer to bring one of them in (people/, ADR-0073 decision 3). */\n ...PEOPLE_CATEGORIES,\n /* Every conversation may read the application's help (ADR-0181). */\n HELP_CATEGORY,\n ...(mode.attachments?.kinds?.length ? ['chat-attachments'] : []),\n ...(mode.entryTargets ?? []).map(key => `data-entry:${key}`),\n ...(mode.readTargets ?? []).map(key => `data-read:${key}`),\n ...conversationCategoriesOf().map(one => one.name)\n ]\n return [...new Set([...(mode.toolCategories ?? []), ...extra])]\n}\n\n/**\n * The categories an unattended run of a mode opens: its own and the lists it reads (design/ai/unattended-run.md §3).\n *\n * Not the 입력안 tools - nobody is there to press the card - nor the AI 작업 패널 or the attachment reader: there is no\n * conversation for a card or a file to belong to.\n */\nexport function unattendedToolCategories(mode: { toolCategories?: string[]; readTargets?: string[] }): string[] {\n return [...new Set([...(mode.toolCategories ?? []), ...(mode.readTargets ?? []).map(key => `data-read:${key}`)])]\n}\n\n/** The screen a turn is asked from - the page the dock is on, and the record its conversation is anchored to. */\nexport interface TurnScreen {\n /** The application's route of the open page (`cash-transaction-list`), as the dock sends it. */\n page?: string\n /** The axis of the record the conversation is anchored to (`contract` of `subject` · `contract:<id>`), from the stored anchor. */\n subjectAxis?: string\n /** The axes of the records the latest selection named (`contract` of `[keys] contracts contract:<id>`) - `selectionAxesOf`. */\n selectionAxes?: string[]\n}\n\n/** The line of a selection note the model reads - the client's `SELECTION_KEYS_PREFIX` (assistant-selection.ts). */\nexport const SELECTION_KEYS_LINE = '[keys]'\n\n/**\n * The axes of the records the latest selection note names (「AI와 작업」, shared-dock §2-11-1): a list hands its rows as\n * `<axis>:<uuid>`, so the rows' list is read with the tool of that axis. Put in front like an anchored record's - picked\n * on 미수금, the contracts' read was not in front, and the model looked for them among attachments and a dashboard's cards\n * before it opened the right tool (2026-10-25). A note is the server's (`appendSessionNote`, system); a person's words\n * are never read for it.\n */\nexport function selectionAxesOf(rows: { role?: string; content?: string | null }[]): string[] {\n for (let i = rows.length - 1; i >= 0; i--) {\n if (rows[i].role !== 'system') continue\n const line = String(rows[i].content ?? '')\n .split('\\n')\n .find(one => one.startsWith(SELECTION_KEYS_LINE))\n if (!line) continue\n const keys = line.slice(SELECTION_KEYS_LINE.length).trim().split(/\\s+/)\n return [...new Set(keys.map(one => one.match(/^([a-z0-9-]+):/)?.[1]).filter((one): one is string => !!one))]\n }\n return []\n}\n\ntype FrontMode = { toolCategories?: string[]; attachments?: { kinds?: string[] }; entryTargets?: string[]; readTargets?: string[] }\n\n/**\n * The records the open screen is about, among those the mode reads and enters (ADR-0061 decision 9). A key's page is\n * the screen that lists its records (ReadTarget.screen.route), the screen a card's records are seen on\n * (EntryTarget.screen) and the pages a read of one record names (DetailRead.frontPages); a key's last part is the axis\n * of its record (`office.contract` is the record of the axis `contract`) - reading and entering one record share its key.\n */\nexport function screenTargetKeys(mode: FrontMode, screen: TurnScreen, routeOf: (key: string) => string | undefined = key => readTargetOf(key)?.screen?.route): string[] {\n const keys = [...new Set([...(mode.readTargets ?? []), ...(mode.entryTargets ?? [])])]\n return keys.filter(\n key =>\n (!!screen.page && pagesOfKey(mode, key, routeOf).includes(screen.page)) ||\n (!!screen.subjectAxis && axesOfKey(mode, key).includes(screen.subjectAxis)) ||\n (!!screen.selectionAxes?.length && axesOfKey(mode, key).some(axis => screen.selectionAxes!.includes(axis)))\n )\n}\n\n/**\n * Pages that prioritize this tool or card. Include a card's editing page so assistant draft requests can\n * use it directly.\n */\nfunction pagesOfKey(mode: FrontMode, key: string, routeOf: (key: string) => string | undefined): string[] {\n const card = (mode.entryTargets ?? []).includes(key) ? entryTargetOf(key)?.screen : undefined\n const answer = (mode.readTargets ?? []).includes(key) ? detailReadOf(key)?.frontPages ?? [] : []\n return [routeOf(key), card, ...answer].filter((page): page is string => !!page)\n}\n\n/** The records a key is about: its last part, and the axes a card joins or a whole answer covers (EntryTarget.axes · DetailRead.axes). */\nfunction axesOfKey(mode: FrontMode, key: string): string[] {\n const card = (mode.entryTargets ?? []).includes(key) ? entryTargetOf(key)?.axes ?? [] : []\n const answer = (mode.readTargets ?? []).includes(key) ? detailReadOf(key)?.axes ?? [] : []\n return [key.split('.').pop()!, ...card, ...answer]\n}\n\n/**\n * The categories a turn puts in front when the mode's tools do not fit in one call: the mode's own, the AI 작업 패널, the\n * people list and the invite card, the attachment reader, and the open screen's records. The rest the model opens with `openTools`.\n */\nexport function modeFrontCategories(mode: FrontMode, screen: TurnScreen = {}): string[] {\n const keys = screenTargetKeys(mode, screen)\n return [\n ...new Set([\n ...(mode.toolCategories ?? []),\n 'assistant-workspace',\n /*\n * Two tools, always in front: 「정연희 초대해 줘」 asked in a conversation whose tools did not fit got the answer that\n * there was no tool to look people up (2026-10-24).\n */\n ...PEOPLE_CATEGORIES,\n /* Two tools, always in front: 「지출결의는 어디서 올려?」 is asked on any screen (ADR-0181). */\n HELP_CATEGORY,\n ...(mode.attachments?.kinds?.length ? ['chat-attachments'] : []),\n ...keys.filter(key => (mode.readTargets ?? []).includes(key)).map(key => `data-read:${key}`),\n ...keys.filter(key => (mode.entryTargets ?? []).includes(key)).map(key => `data-entry:${key}`),\n ...conversationCategoriesOf()\n .filter(one => (!!screen.page && (one.frontPages ?? []).includes(screen.page)) || (one.frontAxes ?? []).some(axis => axis === screen.subjectAxis || !!screen.selectionAxes?.includes(axis)))\n .map(one => one.name)\n ])\n ]\n}\n\n/** Each screen the mode could be asked from - a page that lists one of its records, a record's axis - for the boot report. */\nexport function modeScreens(mode: FrontMode, routeOf: (key: string) => string | undefined = key => readTargetOf(key)?.screen?.route): TurnScreen[] {\n const keys = [...new Set([...(mode.readTargets ?? []), ...(mode.entryTargets ?? [])])]\n const pages = [...new Set([...keys.flatMap(key => pagesOfKey(mode, key, routeOf)), ...conversationCategoriesOf().flatMap(one => one.frontPages ?? [])])]\n const axes = [...new Set(keys.flatMap(key => axesOfKey(mode, key)))]\n return [{}, ...pages.map(page => ({ page })), ...axes.map(subjectAxis => ({ subjectAxis }))]\n}\n"]}
|
|
@@ -1,18 +1,14 @@
|
|
|
1
|
-
/**
|
|
1
|
+
/**
|
|
2
|
+
* Tool name and completion status recorded by the agent loop for one answer.
|
|
3
|
+
*/
|
|
2
4
|
export interface AnswerToolUse {
|
|
3
5
|
name: string;
|
|
4
6
|
outcome?: string;
|
|
5
7
|
}
|
|
6
8
|
/**
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
* 아래 규칙대로 두면 아무도 못 지나는 자리가 되어, 꺼내기를 쓴 답은 묻는 사람 본인까지 누구도 못
|
|
11
|
-
* 읽었다(2026-11-12 운영: 가려진 답 22건 중 19건).
|
|
12
|
-
*
|
|
13
|
-
* 등록기에 없는 도구가 값을 읽고 답에 끼면 그 도구가 무엇을 읽었는지 알 길이 없다. 그때 `[]`(누구나
|
|
14
|
-
* 읽는 답)로 적으면 모르는 값이 공개된다. 아무도 못 지나는 이름을 적어 **가려지는 쪽**으로 넘어뜨리고,
|
|
15
|
-
* 이름에 원인을 실어 둔다.
|
|
9
|
+
* Collect unique, sorted privileges from successful data-reading tools. openTools only exposes tool
|
|
10
|
+
* definitions and adds no data privilege. Unknown tools that returned data produce an ungrantable
|
|
11
|
+
* requirement so their output is hidden by default.
|
|
16
12
|
*/
|
|
17
13
|
export declare function doorsForAnswer(usages: readonly AnswerToolUse[], doorsOf: (name: string) => string[] | undefined): string[];
|
|
18
14
|
/**
|
|
@@ -32,21 +32,14 @@ const ai_client_base_1 = require("@things-factory/ai-client-base");
|
|
|
32
32
|
/** 문 이름으로 보이지 않는 값 — 등록되지 않은 도구가 답에 끼었을 때. */
|
|
33
33
|
const UNRESOLVED = 'unresolved:';
|
|
34
34
|
/**
|
|
35
|
-
*
|
|
36
|
-
*
|
|
37
|
-
* 운영: 직원 목록 조회가 거절된 답이 묻는 사람에게 가려짐).
|
|
35
|
+
* Rejected and failed calls contain no retrieved data. Exclude their privileges so the requesting user can
|
|
36
|
+
* still read the refusal or error.
|
|
38
37
|
*/
|
|
39
38
|
const READ_NOTHING = new Set(['rejected', 'error']);
|
|
40
39
|
/**
|
|
41
|
-
*
|
|
42
|
-
*
|
|
43
|
-
*
|
|
44
|
-
* 아래 규칙대로 두면 아무도 못 지나는 자리가 되어, 꺼내기를 쓴 답은 묻는 사람 본인까지 누구도 못
|
|
45
|
-
* 읽었다(2026-11-12 운영: 가려진 답 22건 중 19건).
|
|
46
|
-
*
|
|
47
|
-
* 등록기에 없는 도구가 값을 읽고 답에 끼면 그 도구가 무엇을 읽었는지 알 길이 없다. 그때 `[]`(누구나
|
|
48
|
-
* 읽는 답)로 적으면 모르는 값이 공개된다. 아무도 못 지나는 이름을 적어 **가려지는 쪽**으로 넘어뜨리고,
|
|
49
|
-
* 이름에 원인을 실어 둔다.
|
|
40
|
+
* Collect unique, sorted privileges from successful data-reading tools. openTools only exposes tool
|
|
41
|
+
* definitions and adds no data privilege. Unknown tools that returned data produce an ungrantable
|
|
42
|
+
* requirement so their output is hidden by default.
|
|
50
43
|
*/
|
|
51
44
|
function doorsForAnswer(usages, doorsOf) {
|
|
52
45
|
const doors = new Set();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"message-doors.js","sourceRoot":"","sources":["../../../server/service/chat-message/message-doors.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;;
|
|
1
|
+
{"version":3,"file":"message-doors.js","sourceRoot":"","sources":["../../../server/service/chat-message/message-doors.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;;AA0BH,wCAWC;AASD,4BAcC;AAGD,8BAKC;AAgBD,sCAwBC;AA1GD,mEAA2D;AAE3D,8CAA8C;AAC9C,MAAM,UAAU,GAAG,aAAa,CAAA;AAUhC;;;GAGG;AACH,MAAM,YAAY,GAAG,IAAI,GAAG,CAAC,CAAC,UAAU,EAAE,OAAO,CAAC,CAAC,CAAA;AAEnD;;;;GAIG;AACH,SAAgB,cAAc,CAAC,MAAgC,EAAE,OAA+C;IAC9G,MAAM,KAA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I,CAAC,CAAC,MAAM,IAAI,CAAC,IAAI,CAAC,CAAC;YAAE,OAAO,KAAK,CAAA;IACvC,CAAC;IACD,OAAO,IAAI,CAAA;AACb,CAAC;AAQD,kDAAkD;AAClD,MAAM,cAAc,GAAG,CAAC,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,cAAc,EAAE,iBAAiB,CAAU,CAAA;AAEtG;;;;GAIG;AACI,KAAK,UAAU,aAAa,CACjC,IAAkB,EAClB,IAAwC,EACxC,MAAmC;IAEnC,MAAM,GAAG,GAAQ,EAAE,CAAA;IAEnB,KAAK,MAAM,GAAG,IAAI,IAAI,EAAE,CAAC;QACvB,MAAM,KAAK,GAAG,GAAG,CAAC,KAAK,IAAI,EAAE,CAAA;QAC7B,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,IAAI,CAAC,MAAM,SAAS,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC,EAAE,CAAC;YACzD,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;YACb,SAAQ;QACV,CAAC;QAED,MAAM,MAAM,GAAQ,EAAE,GAAG,GAAG,EAAE,OAAO,EAAE,MAAM,CAAC,KAAK,CAAC,EAAE,CAAA;QACtD,KAAK,MAAM,KAAK,IAAI,cAAc,EAAE,CAAC;YACnC,IAAI,KAAK,IAAI,MAAM;gBAAE,MAAM,CAAC,KAAK,CAAC,GAAG,IAAI,CAAA;QAC3C,CAAC;QACD,6CAA6C;QAC7C,MAAM,CAAC,QAAQ,GAAG,IAAI,CAAA;QACtB,GAAG,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;IAClB,CAAC;IAED,OAAO,GAAG,CAAA;AACZ,CAAC","sourcesContent":["/*\n * 답에 실린 문 — ADR-0073 판정 1.\n *\n * ── 무엇을 막는가 ─────────────────────────────────────────────────────────\n * 대화방은 도메인 안에서 공개다(ADR-0073 판정 2). 그런데 대화 안에는 어시스턴트가 도구 결과로 근거를\n * 대고 쓴 답이 들어 있고, 그 근거는 **부른 사람의 문**을 지나 얻은 값이다. 도구는 문을 지켰는데\n * 어시스턴트의 문장이 그 값을 이미 평문으로 적어 놓았다. 나중에 읽는 사람은 자기가 못 여는 문 너머의\n * 값을 어시스턴트의 말로 읽는다 — 도구 권한을 다 지켜도 **글로 새는 길**이다.\n *\n * 그래서 답 행에 그 답을 만든 도구들이 지난 문 목록을 적어 두고(사람의 말은 `[]`), 읽는 사람이 그 문을\n * 전부 지나는지 볼 때마다 확인한다. 못 지나면 본문 대신 한 줄이 나간다 — **행이 있다는 사실은 보이고\n * 값만 안 보인다.** 방에 무슨 일이 있었는지는 알 수 있고, 값은 자기 권한만큼만 읽는다.\n *\n * ── 시점은 뜻이 없다 ──────────────────────────────────────────────────────\n * 언제 들어왔는지로 가르지 않는다. 오전에 있었든 방금 들어왔든, 볼 수 있는 것은 본다. 권한이 나중에\n * 붙으면 그때부터 보이고, 떨어지면 그때부터 안 보인다. 저장된 행은 그대로 있고 **보는 일만** 달라진다.\n *\n * ── 모델이 읽는 이력도 같다 ───────────────────────────────────────────────\n * 부른 사람이 못 여는 문의 답은 모델에게도 가리고 보낸다. 가리지 않으면 모델이 그 값을 다음 답에 옮겨\n * 적어서, 문을 한 번도 안 지난 사람이 값을 갖게 된다. 가린 자리를 지우지 않고 한 줄로 남기는 이유도\n * 같다 — 모델이 \"그런 말 한 적 없다\"고 답하면 그것은 거짓말이다.\n *\n * 이 파일은 저장소·엔티티를 모르는 순수 판정이다.\n */\n\nimport { OPEN_TOOLS } from '@things-factory/ai-client-base'\n\n/** 문 이름으로 보이지 않는 값 — 등록되지 않은 도구가 답에 끼었을 때. */\nconst UNRESOLVED = 'unresolved:'\n\n/**\n * Tool name and completion status recorded by the agent loop for one answer.\n */\nexport interface AnswerToolUse {\n name: string\n outcome?: string\n}\n\n/**\n * Rejected and failed calls contain no retrieved data. Exclude their privileges so the requesting user can\n * still read the refusal or error.\n */\nconst READ_NOTHING = new Set(['rejected', 'error'])\n\n/**\n * Collect unique, sorted privileges from successful data-reading tools. openTools only exposes tool\n * definitions and adds no data privilege. Unknown tools that returned data produce an ungrantable\n * requirement so their output is hidden by default.\n */\nexport function doorsForAnswer(usages: readonly AnswerToolUse[], doorsOf: (name: string) => string[] | undefined): string[] {\n const doors = new Set<string>()\n\n for (const { name, outcome } of usages) {\n if (!name || name === OPEN_TOOLS || (outcome && READ_NOTHING.has(outcome))) continue\n const declared = doorsOf(name)\n if (declared === undefined) doors.add(`${UNRESOLVED}${name}`)\n else for (const door of declared) doors.add(door)\n }\n\n return [...doors].sort()\n}\n\n/**\n * 한 요청 안에서 (사람, 문) 별로 한 번만 묻는 관문.\n *\n * 한 화면이 백 줄을 읽고 그 줄들이 같은 문 서넛을 가리킨다. 줄마다 물으면 권한 조회가 백 번 간다.\n * 같은 요청 안에서 답이 바뀔 일은 없으므로 문 하나에 한 번 묻고 그 답을 쓴다. 관문은 요청마다 새로\n * 만든다 — 프로세스가 들고 있으면 권한이 바뀌어도 낡은 답을 준다.\n */\nexport function doorGate(check: (door: string) => Promise<boolean>): (door: string) => Promise<boolean> {\n const asked = new Map<string, Promise<boolean>>()\n\n return (door: string) => {\n /* 등록되지 않은 도구의 자리는 물을 것도 없다 — 지나는 사람이 없다. */\n if (door.startsWith(UNRESOLVED)) return Promise.resolve(false)\n\n let answer = asked.get(door)\n if (!answer) {\n answer = check(door)\n asked.set(door, answer)\n }\n return answer\n }\n}\n\n/** 이 사람이 이 행을 열 수 있나 — 적힌 문을 **전부** 지나야 한다(AND). */\nexport async function passesRow(doors: readonly string[] | null | undefined, gate: (door: string) => Promise<boolean>): Promise<boolean> {\n for (const door of doors ?? []) {\n if (!(await gate(door))) return false\n }\n return true\n}\n\n/** 문 판정에 필요한 만큼만 — 엔티티를 이 자리로 끌고 오지 않는다. */\nexport interface DoorReadableRow {\n doors?: string[] | null\n content?: string | null\n}\n\n/** 가린 행에서 값이 실려 있는 칸들 — 본문만 지우고 두면 그리로 새어 나간다. */\nconst VALUE_CARRYING = ['extra', 'proposals', 'grounding', 'patchEntryId', 'importSessionId'] as const\n\n/**\n * 못 지나는 행의 값을 가린다 — 행은 남기고 본문을 한 줄로 바꾼다.\n *\n * `notice` 는 부르는 쪽이 번역해 넘긴다(서버 번역, 화면 말은 서버가 만든다 — ADR-0061 결정 7).\n */\nexport async function redactByDoors<T extends DoorReadableRow>(\n rows: readonly T[],\n gate: (door: string) => Promise<boolean>,\n notice: (doors: string[]) => string\n): Promise<T[]> {\n const out: T[] = []\n\n for (const row of rows) {\n const doors = row.doors ?? []\n if (doors.length === 0 || (await passesRow(doors, gate))) {\n out.push(row)\n continue\n }\n\n const hidden: any = { ...row, content: notice(doors) }\n for (const field of VALUE_CARRYING) {\n if (field in hidden) hidden[field] = null\n }\n /* 가려졌다는 것 자체는 사실이다. 화면이 자물쇠를 그릴 수 있게 남긴다. */\n hidden.redacted = true\n out.push(hidden)\n }\n\n return out\n}\n"]}
|
|
@@ -139,10 +139,9 @@ export interface DetailRead {
|
|
|
139
139
|
*/
|
|
140
140
|
axes?: string[];
|
|
141
141
|
/**
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
*/
|
|
142
|
+
* Application routes that prioritize this tool through ConversationCategory.frontPages. Single-record
|
|
143
|
+
* readers may have no list page of their own.
|
|
144
|
+
*/
|
|
146
145
|
frontPages?: string[];
|
|
147
146
|
/**
|
|
148
147
|
* The lists the answer holds, each a table of typed columns - what a dashboard card may draw from a one-answer read
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"read-target.js","sourceRoot":"","sources":["../../../server/service/data-read/read-target.ts"],"names":[],"mappings":";;;AAyIA,8CAgBC;AAED,oCAEC;AAGD,wCAEC;AAGD,wCAEC;AAED,4CAGC;AA6ED,8CAuBC;AAED,oCAEC;AAYD,oCA0BC;AAED,8BAOC;AAWD,sCAcC;AAMD,wBAGC;AAGD,4BAWC;AAMD,sBAgBC;AAMD,4BAwBC;AAiBD,wBAeC;AAGD,oCAIC;AAGD,4BAsBC;AA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1D,UAAU,EAAE,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;KAC/D,CAAA;AACH,CAAC","sourcesContent":["/*\n * AI 조회 - an application's list, read through its own query as the person (operato-application/design/ai/read-targets.md).\n *\n * The application declares what it lets the assistant read: its list query, the conditions the model may set and\n * how each becomes one of the query's filters, the columns to show, and the screen that lists the same records.\n * The framework reads the rows through that query with the person's request state - the same @privilege and\n * domain as the screen - counts and sums them itself, and puts a long result on the AI 작업 패널 as the query returned\n * it. The model is told the count, the sums and a few rows; it never copies a table.\n *\n * Pure but for the GraphQL runner, which comes in as an argument - the rules are tested without a server.\n */\nimport { readFieldValue, recordIdOfKey, rootFieldOf, type EntryField } from '../data-entry/entry-target.js'\nimport { encodeListQuery } from '@operato/utils/list-query.js'\nimport type { GraphqlRunner } from '../data-entry/entry-update.js'\nimport { parse } from 'graphql'\n\nexport interface ReadFilter {\n name: string\n operator: string\n value: unknown\n}\n\n/** A condition the model may set - read with the entry fields' rules, turned into the query's filters by the application. */\nexport interface ReadCriterion extends Omit<EntryField, 'required' | 'reference' | 'total'> {\n filter: (value: any) => ReadFilter | ReadFilter[]\n /** A string condition holding a month as YYYY-MM - a value of another shape is refused (`not-a-month`). */\n format?: 'month'\n /**\n * The condition takes several values at once - its filter is given the list. Asked for the expenditure requests not\n * approved, rejected or withdrawn, the model read the list once per status and stopped (2026-10-25).\n */\n many?: boolean\n}\n\nexport interface ReadColumn {\n /** The key in the workspace table. */\n name: string\n /** Where the value is in a row - a dotted path into the query's item (`account.name`). Defaults to `name`. */\n path?: string\n type: 'string' | 'number' | 'date'\n labelKey?: string\n /** A number column the server sums. */\n total?: boolean\n /**\n * The column that holds this amount's currency (ISO 4217, `KRW`). Its sums are kept per currency - amounts of two\n * currencies are never added into one number.\n */\n currency?: string\n /**\n * The i18n prefix that names this column's codes - `<words><code>` (`announcement.category.` reads `HR` as\n * `announcement.category.HR`). The rows keep the code, so a filter or a card's match means the same in every\n * language; the model is given the words (`legendOf`) and a table or chart shows them (`wordOf`).\n */\n words?: string\n}\n\nexport interface ReadScreen {\n /** A URL-bound grid accepts the same predicates used by readRows, including conditions outside its form. */\n queryState?: boolean\n /** The application's route of the list screen (`cash-transaction-list`). */\n route: string\n /** The conditions the screen takes, as its address's query arguments. A condition left out is said on the card. */\n params: (criteria: Record<string, any>) => Record<string, string | number | undefined>\n /** The conditions `params` carries - the card names the others as not applied on the screen. */\n takes: string[]\n labelKey?: string\n}\n\nexport interface ReadTarget {\n /** `<app>.<record>` - the tools are named after it. */\n key: string\n /** i18n key naming the records (「은행 입출금」). */\n labelKey?: string\n /** What the records are, for the model. */\n description: string\n /**\n * The list query - takes `$filters: [Filter!]`, `$pagination: Pagination` and `$sortings: [Sorting!]`, and\n * `$search: String` when `search` is declared.\n */\n query: string\n /**\n * The list takes ListParam's free-text term, matched by the resolver across its own searchable fields - the\n * condition `text`. Say what it finds in, for the model.\n */\n search?: { description: string }\n criteria: ReadCriterion[]\n /**\n * Filters every read of this list applies - the records it is of (a book's confirmed lines, not its forecasts). Not\n * a condition: the model neither sees nor sets them, so a read can narrow the list but never widen it.\n */\n fixedFilters?: ReadFilter[]\n columns: ReadColumn[]\n rowsOf: (data: any) => { rows: any[]; total: number }\n /** Orders the rows; the query's own order when left out. */\n sortings?: { name: string; desc?: boolean }[]\n screen?: ReadScreen\n /**\n * The rows are the person's own, whoever reads them (내 지출결의) - the query answers for the one asking. A dashboard\n * card of it shows each viewer their own rows and takes no filter on a person (ADR-0160).\n */\n mine?: boolean\n}\n\n/** At most this many rows are read - the AI 작업 패널 table's own limit (workspace-blocks MAX_TABLE_ROWS). */\nexport const MAX_READ_ROWS = 1000\n/** Rows the model is shown; the rest stay on the card. */\nexport const ROWS_FOR_MODEL = 20\n/** A page of the list query. */\nexport const READ_PAGE = 200\n\nconst registry = new Map<string, ReadTarget>()\n\nconst pascalOf = (key: string) =>\n key\n .split(/[^a-zA-Z0-9]+/)\n .filter(Boolean)\n .map(part => part[0].toUpperCase() + part.slice(1))\n .join('')\n\nexport const queryToolName = (key: string) => `query${pascalOf(key)}`\nexport const screenToolName = (key: string) => `open${pascalOf(key)}Screen`\nexport const readCategoryName = (key: string) => `data-read:${key}`\n\n/** The columns of a list - shown, each named once, a currency only on a summed number and taken from a string column. */\nfunction checkColumns(of: string, columns: ReadColumn[]): void {\n if (!columns.length) throw new Error(`read target '${of}' shows no column`)\n const names = new Set<string>()\n for (const column of columns) {\n if (names.has(column.name)) throw new Error(`read target '${of}' names the column '${column.name}' twice`)\n names.add(column.name)\n }\n for (const column of columns.filter(one => one.currency)) {\n if (!column.total || column.type !== 'number') throw new Error(`column '${column.name}' of '${of}' names a currency but is not a summed number`)\n if (columns.find(one => one.name === column.currency)?.type !== 'string') throw new Error(`column '${column.name}' of '${of}' takes its currency from '${column.currency}', which is no string column`)\n }\n}\n\nexport function declareReadTarget(target: ReadTarget): void {\n if (!/^[a-z0-9-]+\\.[a-z0-9-]+$/.test(target.key)) throw new Error(`read target key '${target.key}' is not <app>.<record>`)\n if (registry.has(target.key) || details.has(target.key)) throw new Error(`read target '${target.key}' is declared twice`)\n rootFieldOf(target.query, 'query')\n checkColumns(target.key, target.columns)\n const names = new Set<string>(['id'])\n for (const criterion of target.criteria) {\n if (criterion.name === 'id') throw new Error(`read target '${target.key}' declares 'id' - every target takes it`)\n if (criterion.name === 'text' && target.search) throw new Error(`read target '${target.key}' declares 'text' and search - search is the text condition`)\n if (names.has(criterion.name)) throw new Error(`read target '${target.key}' names the condition '${criterion.name}' twice`)\n names.add(criterion.name)\n if (criterion.type === 'enum' && !criterion.values?.length) throw new Error(`condition '${criterion.name}' of '${target.key}' lists no values`)\n }\n if (target.search) names.add('text')\n for (const taken of target.screen?.takes ?? []) if (!names.has(taken)) throw new Error(`the screen of '${target.key}' takes '${taken}', which is no condition`)\n registry.set(target.key, target)\n}\n\nexport function readTargetOf(key: string | undefined): ReadTarget | undefined {\n return key ? registry.get(key) : undefined\n}\n\n/** Every list read target declared - what else reads the declarations (a dashboard card, ADR-0160) lists them by key. */\nexport function readTargetKeys(): string[] {\n return [...registry.keys()]\n}\n\n/** Every detail read declared. */\nexport function detailReadKeys(): string[] {\n return [...details.keys()]\n}\n\nexport function clearReadTargets(): void {\n registry.clear()\n details.clear()\n}\n\n/* ── One answer of a query ──────────────────────────────────────────────────────────────────────────────────── */\n\n/** An argument of a detail read - one variable of its query, read with the entry fields' rules. */\nexport interface DetailArg {\n name: string\n type: 'string' | 'integer' | 'number' | 'boolean' | 'date' | 'enum'\n values?: string[]\n description?: string\n required?: boolean\n /** A record's id: the axis (or axes) of the record, whose key `<axis>:<id>` the model may have been shown (EntryField.axis). */\n axis?: string | readonly string[]\n /** A string argument holding a month as YYYY-MM. */\n format?: 'month'\n}\n\n/**\n * A query whose answer is one thing, not a list - a 360's summary, the receivables, a statement (design/ai/read-targets.md\n * §9). The application declares the query with the fields its screen reads; the framework runs it as the person, with\n * the arguments the model set, and hands the answer over as the query returned it. Nothing is summed or cut here: the\n * selection is the projection, and an answer too long to hand over is refused, never cut.\n */\nexport interface DetailRead {\n /** `<app>.<thing>` - the tool is named after it. */\n key: string\n labelKey?: string\n /** What it answers, for the model. */\n description: string\n /** One query with one root field. Its variables are the arguments - each declared in `args`. */\n query: string\n args?: DetailArg[]\n /**\n * The records the answer is about, whose screens put it in front (EntryTarget.axes) - the management check answers\n * for any ledger record; asked on a deposit's 360 why it was in the check, the model never opened it (2026-10-24).\n */\n axes?: string[]\n /**\n * The application routes whose conversations put it in front (ConversationCategory.frontPages) - a read of one record\n * has no list screen to name its page. Asked 「AI로 초안 작성」 on 내 주간업무보고, the week's read was not in front, and the\n * model looked for it in the help first (2026-11-12).\n */\n frontPages?: string[]\n /**\n * The lists the answer holds, each a table of typed columns - what a dashboard card may draw from a one-answer read\n * (ADR-0160 decision 2). The card keeps only `key`; where the rows are and what their columns are is read here.\n */\n lists?: DetailList[]\n /** The answer is the person's own, whoever asks (나의 전략 업무, 내 급여) - ReadTarget.mine. */\n mine?: boolean\n}\n\n/** A list inside a detail read's answer. */\nexport interface DetailList {\n /** A name stable within the read (`by-contract`) - what a card keeps. */\n key: string\n /** A dotted path inside the value of the query's root field (`rows`); '' when the root field is the list. */\n at: string\n labelKey?: string\n /** What the rows are, for the model. */\n description?: string\n columns: ReadColumn[]\n}\n\n/** Characters of an answer handed to the model - a longer one is refused, and the model narrows it. */\nexport const MAX_DETAIL_CHARS = 60_000\n\nconst details = new Map<string, DetailRead>()\n\nexport const detailToolName = (key: string) => `read${pascalOf(key)}`\n\n/** The variables a query declares, and whether each is required (`!`). */\nfunction variablesOf(document: string): { name: string; required: boolean }[] {\n const operation: any = parse(document).definitions.find((one: any) => one.kind === 'OperationDefinition')\n return (operation?.variableDefinitions ?? []).map((one: any) => ({ name: one.variable.name.value, required: one.type.kind === 'NonNullType' && !one.defaultValue }))\n}\n\nexport function declareDetailRead(target: DetailRead): void {\n if (!/^[a-z0-9-]+\\.[a-z0-9-]+$/.test(target.key)) throw new Error(`detail read key '${target.key}' is not <app>.<thing>`)\n if (details.has(target.key) || registry.has(target.key)) throw new Error(`read target '${target.key}' is declared twice`)\n rootFieldOf(target.query, 'query')\n const args = target.args ?? []\n for (const variable of variablesOf(target.query)) {\n const arg = args.find(one => one.name === variable.name)\n if (!arg) throw new Error(`detail read '${target.key}' takes $${variable.name}, which is no argument`)\n if (variable.required && !arg.required) throw new Error(`detail read '${target.key}': $${variable.name} is required by the query - declare it required`)\n }\n for (const arg of args) {\n if (!variablesOf(target.query).some(one => one.name === arg.name)) throw new Error(`detail read '${target.key}' declares '${arg.name}', which its query does not take`)\n if (arg.type === 'enum' && !arg.values?.length) throw new Error(`argument '${arg.name}' of '${target.key}' lists no values`)\n }\n const lists = new Set<string>()\n for (const list of target.lists ?? []) {\n if (!/^[a-z0-9-]+$/.test(list.key)) throw new Error(`list '${list.key}' of '${target.key}' is not a lowercase key`)\n if (lists.has(list.key)) throw new Error(`detail read '${target.key}' names the list '${list.key}' twice`)\n lists.add(list.key)\n if (!/^([A-Za-z0-9_]+(\\.[A-Za-z0-9_]+)*)?$/.test(list.at)) throw new Error(`list '${list.key}' of '${target.key}' is at '${list.at}', which is no dotted path`)\n checkColumns(`${target.key}/${list.key}`, list.columns)\n }\n details.set(target.key, target)\n}\n\nexport function detailReadOf(key: string | undefined): DetailRead | undefined {\n return key ? details.get(key) : undefined\n}\n\n/** A month as a `month` condition holds it. */\nconst MONTH = /^\\d{4}-(0[1-9]|1[0-2])$/\n\n/*\n * The id a key `<axis>:<id>` names - a uuid, or a row's own composite id (a training standing is `<kind>:<year>:<employee>`,\n * 2026-11-08). Another axis's key is not this record's: it stays as written and finds nothing.\n */\nconst idOfKey = (axis: string, text: string): string => recordIdOfKey(axis, text) ?? (text.startsWith(`${axis}:`) ? text.slice(axis.length + 1) : text)\n\n/** The conditions the model set, read by their declared types; a value that does not fit is said, never guessed at. */\nexport function readCriteria(target: ReadTarget, args: any): { criteria: Record<string, unknown>; refused: { name: string; code: string }[] } {\n const criteria: Record<string, unknown> = {}\n const refused: { name: string; code: string }[] = []\n /* One record by its id - every target takes it (the id a list answer or a find tool gave, or the key `<axis>:<id>` an open record is shown by, the axis being the key's last part). */\n if (typeof args?.id === 'string' && args.id.trim()) criteria.id = idOfKey(target.key.split('.').pop()!, args.id.trim())\n if (target.search && typeof args?.text === 'string' && args.text.trim()) criteria.text = args.text.trim()\n for (const criterion of target.criteria) {\n const value = args?.[criterion.name]\n if (value === undefined || value === null || value === '' || (Array.isArray(value) && !value.length)) continue\n if (criterion.many && Array.isArray(value)) {\n const each = value.map(one => readFieldValue(criterion as EntryField, one))\n const wrong = each.find(one => one.read === undefined)\n if (wrong) refused.push({ name: criterion.name, code: wrong.code ?? 'unreadable' })\n else criteria[criterion.name] = [...new Set(each.map(one => one.read))]\n continue\n }\n if (Array.isArray(value)) {\n refused.push({ name: criterion.name, code: 'one-value' })\n continue\n }\n const { read, code } = readFieldValue(criterion as EntryField, value)\n if (read === undefined) refused.push({ name: criterion.name, code: code ?? 'unreadable' })\n else if (criterion.format === 'month' && !MONTH.test(String(read))) refused.push({ name: criterion.name, code: 'not-a-month' })\n else criteria[criterion.name] = read\n }\n return { criteria, refused }\n}\n\nexport function filtersOf(target: ReadTarget, criteria: Record<string, unknown>): ReadFilter[] {\n return [\n ...(typeof criteria.id === 'string' ? [{ name: 'id', operator: 'eq', value: criteria.id }] : []),\n ...target.criteria.flatMap(criterion =>\n criterion.name in criteria ? [criterion.filter(criteria[criterion.name])].flat() : []\n )\n ]\n}\n\n/** A dotted path's value - through a list, each one's (an invention's inventors' names). */\nexport const valueAt = (row: any, path: string) =>\n path.split('.').reduce((at, part) => (at === null || at === undefined ? undefined : Array.isArray(at) ? at.map(one => one?.[part]) : at[part]), row)\n\n/**\n * A date column's moment as people read it - `YYYY-MM-DD HH:mm` in the domain's time zone. A day (`YYYY-MM-DD`) or\n * month stays as it is; anything that is not a moment is left alone. Still ordered as text, so a card's comparison\n * with a day keeps working.\n */\nexport function localDateTime(value: string, timeZone?: string): string {\n if (!/^\\d{4}-\\d{2}-\\d{2}T/.test(value)) return value\n const moment = new Date(value)\n if (Number.isNaN(moment.getTime())) return value\n try {\n const parts = Object.fromEntries(\n new Intl.DateTimeFormat('en-CA', { timeZone: timeZone || undefined, year: 'numeric', month: '2-digit', day: '2-digit', hour: '2-digit', minute: '2-digit', hourCycle: 'h23' })\n .formatToParts(moment)\n .map(part => [part.type, part.value])\n )\n return `${parts.year}-${parts.month}-${parts.day} ${parts.hour}:${parts.minute}`\n } catch {\n return value\n }\n}\n\n/** How the reader's words are asked - `(key, fallback)`, the fallback when the key has no word. */\nexport type SayWord = (key: string | undefined, fallback: string) => string\n\n/** The word a coded value is read as, in the reader's language - the value itself when its column has no words. */\nexport function wordOf(column: Pick<ReadColumn, 'words'> | undefined, value: unknown, say: SayWord): unknown {\n if (!column?.words || value === null || value === undefined || value === '') return value\n return say(`${column.words}${value}`, String(value))\n}\n\n/** The words of the coded values the rows hold, column by column - what the model reads the codes by. */\nexport function legendOf(columns: readonly Pick<ReadColumn, 'name' | 'words'>[], rows: Record<string, any>[], say: SayWord): Record<string, Record<string, string>> {\n const legend: Record<string, Record<string, string>> = {}\n for (const column of columns) {\n if (!column.words) continue\n for (const row of rows) {\n const code = row[column.name]\n if (code === null || code === undefined || code === '') continue\n ;(legend[column.name] ??= {})[String(code)] = String(wordOf(column, code, say))\n }\n }\n return legend\n}\n\n/** What shapes a row besides its columns - the domain's time zone, for a moment. */\nexport type RowOptions = { timeZone?: string }\n\n/** One row as the columns say - a number column as a number, a moment in the domain's time zone, a missing value as null. */\nexport function rowOf(target: Pick<ReadTarget, 'columns'>, item: any, options: RowOptions = {}): Record<string, string | number | null> {\n return Object.fromEntries([\n /* The id names the record to the model - for one record's detail, a change, or its screen. */\n ...(item?.id ? [['id', String(item.id)] as [string, string]] : []),\n ...target.columns.map(column => {\n const found = valueAt(item, column.path ?? column.name)\n /* A list of values reads as one, comma-separated. */\n const raw = Array.isArray(found) ? found.filter(one => one !== undefined && one !== null && one !== '').join(', ') : found\n if (raw === undefined || raw === null || raw === '') return [column.name, null]\n if (column.type === 'number') {\n const number = Number(raw)\n return [column.name, Number.isFinite(number) ? number : null]\n }\n return [column.name, column.type === 'date' ? localDateTime(String(raw), options.timeZone) : String(raw)]\n })\n ])\n}\n\n/**\n * Reads the rows through the application's query, page by page, up to MAX_READ_ROWS. `complete` is false when the\n * list holds more - a sum of the rows read is then not the sum of the list, and is never said as one.\n */\nexport async function readRows(\n target: ReadTarget,\n filters: ReadFilter[],\n run: GraphqlRunner,\n search?: string,\n options: RowOptions = {}\n): Promise<{ rows: Record<string, any>[]; total: number; complete: boolean }> {\n const rows: Record<string, any>[] = []\n let total = 0\n for (let page = 1; rows.length < MAX_READ_ROWS; page++) {\n const answer = await run(target.query, {\n filters: [...filters, ...(target.fixedFilters ?? [])],\n ...(search ? { search } : {}),\n pagination: { page, limit: READ_PAGE },\n ...(target.sortings ? { sortings: target.sortings } : {})\n })\n if (answer.errors?.length) throw new Error(answer.errors.map(one => one.message).join('; '))\n const read = target.rowsOf(answer.data)\n total = Number(read?.total) || 0\n const items = read?.rows ?? []\n rows.push(...items.slice(0, MAX_READ_ROWS - rows.length).map(item => rowOf(target, item, options)))\n if (items.length < READ_PAGE || rows.length >= total) break\n }\n return { rows, total, complete: rows.length >= total }\n}\n\n/** A column's sum - one number, or one per currency when the column names its currency (`{ KRW: 1000, USD: 100 }`). */\nexport type ReadSum = number | Record<string, number>\n\nexport interface ReadGroup {\n key: string\n count: number\n sums: Record<string, ReadSum>\n}\n\n/** The currency a row without one is summed under - said as it is, never taken for the domain's own. */\nexport const UNKNOWN_CURRENCY = 'unknown'\n\nconst sumOf = (rows: Record<string, any>[], name: string) => Math.round(rows.reduce((sum, row) => sum + (typeof row[name] === 'number' ? row[name] : 0), 0) * 100) / 100\n\n/** The sums of the number columns marked total - the server's, never the model's; a column with a currency per currency. */\nexport function sumsOf(target: Pick<ReadTarget, 'columns'>, rows: Record<string, any>[]): Record<string, ReadSum> {\n const sums: Record<string, ReadSum> = {}\n for (const column of target.columns.filter(one => one.total && one.type === 'number')) {\n if (!column.currency) {\n sums[column.name] = sumOf(rows, column.name)\n continue\n }\n const byCurrency = new Map<string, Record<string, any>[]>()\n for (const row of rows) {\n const code = typeof row[column.currency] === 'string' && row[column.currency] ? row[column.currency] : UNKNOWN_CURRENCY\n byCurrency.set(code, [...(byCurrency.get(code) ?? []), row])\n }\n sums[column.name] = Object.fromEntries([...byCurrency].sort(([a], [b]) => a.localeCompare(b)).map(([code, members]) => [code, sumOf(members, column.name)]))\n }\n return sums\n}\n\n/** The currencies a set of sums holds for one column - none for a column summed as one number. */\nexport function currenciesOf(sums: Record<string, ReadSum>[], column: string): string[] {\n const codes = new Set<string>()\n for (const one of sums) if (one[column] && typeof one[column] === 'object') for (const code of Object.keys(one[column] as object)) codes.add(code)\n return [...codes].sort()\n}\n\n/** The rows grouped by one column - a date column by its month - each with its count and sums, largest first. */\nexport function groupsOf(target: Pick<ReadTarget, 'columns'>, rows: Record<string, any>[], by: string): ReadGroup[] | undefined {\n const column = target.columns.find(one => one.name === by)\n if (!column) return undefined\n const groups = new Map<string, Record<string, any>[]>()\n for (const row of rows) {\n const value = row[by]\n const key = value === null || value === undefined ? '' : column.type === 'date' ? String(value).slice(0, 7) : String(value)\n groups.set(key, [...(groups.get(key) ?? []), row])\n }\n const list = [...groups].map(([key, members]) => ({ key, count: members.length, sums: sumsOf(target, members) }))\n if (column.type === 'date') return list.sort((a, b) => a.key.localeCompare(b.key))\n /* Largest first by the first sum - in its one currency; groups in two currencies have no common size, so by count. */\n const first = target.columns.find(one => one.total)?.name\n const codes = first ? currenciesOf(list.map(group => group.sums), first) : []\n const size = (group: ReadGroup) => {\n const sum = first ? group.sums[first] : undefined\n return typeof sum === 'number' ? Math.abs(sum) : codes.length === 1 && sum ? Math.abs(sum[codes[0]] ?? 0) : undefined\n }\n return list.sort((a, b) => {\n const [x, y] = [size(a), size(b)]\n return x !== undefined && y !== undefined && codes.length <= 1 ? y - x : b.count - a.count\n })\n}\n\n/** The address of the target's list screen with the conditions it takes, and the conditions it does not. */\nexport function screenAddress(target: ReadTarget, criteria: Record<string, unknown>): { href: string; applied: string[]; notApplied: string[] } | undefined {\n const screen = target.screen\n if (!screen) return undefined\n const params = new URLSearchParams()\n for (const [name, value] of Object.entries(screen.params(criteria))) if (value !== undefined && value !== null && value !== '') params.set(name, String(value))\n const given = Object.keys(criteria)\n const applicable = Object.fromEntries(Object.entries(criteria).filter(([name]) => screen.takes.includes(name)))\n const query = screen.queryState\n ? encodeListQuery({\n filters: filtersOf(target, applicable),\n search: typeof applicable.text === 'string' ? applicable.text : undefined,\n sorters: target.sortings\n })\n : params.toString()\n return {\n href: query ? `${screen.route}?${query}` : screen.route,\n applied: given.filter(name => screen.takes.includes(name)),\n notApplied: given.filter(name => !screen.takes.includes(name))\n }\n}\n"]}
|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;SACzB,CAAC;QACJ,CAAC,CAAC,MAAM,CAAC,QAAQ,EAAE,CAAA;IACrB,OAAO;QACL,IAAI,EAAE,KAAK,CAAC,CAAC,CAAC,GAAG,MAAM,CAAC,KAAK,IAAI,KAAK,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK;QACvD,OAAO,EAAE,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;QAC1D,UAAU,EAAE,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;KAC/D,CAAA;AACH,CAAC","sourcesContent":["/*\n * AI 조회 - an application's list, read through its own query as the person (operato-application/design/ai/read-targets.md).\n *\n * The application declares what it lets the assistant read: its list query, the conditions the model may set and\n * how each becomes one of the query's filters, the columns to show, and the screen that lists the same records.\n * The framework reads the rows through that query with the person's request state - the same @privilege and\n * domain as the screen - counts and sums them itself, and puts a long result on the AI 작업 패널 as the query returned\n * it. The model is told the count, the sums and a few rows; it never copies a table.\n *\n * Pure but for the GraphQL runner, which comes in as an argument - the rules are tested without a server.\n */\nimport { readFieldValue, recordIdOfKey, rootFieldOf, type EntryField } from '../data-entry/entry-target.js'\nimport { encodeListQuery } from '@operato/utils/list-query.js'\nimport type { GraphqlRunner } from '../data-entry/entry-update.js'\nimport { parse } from 'graphql'\n\nexport interface ReadFilter {\n name: string\n operator: string\n value: unknown\n}\n\n/** A condition the model may set - read with the entry fields' rules, turned into the query's filters by the application. */\nexport interface ReadCriterion extends Omit<EntryField, 'required' | 'reference' | 'total'> {\n filter: (value: any) => ReadFilter | ReadFilter[]\n /** A string condition holding a month as YYYY-MM - a value of another shape is refused (`not-a-month`). */\n format?: 'month'\n /**\n * The condition takes several values at once - its filter is given the list. Asked for the expenditure requests not\n * approved, rejected or withdrawn, the model read the list once per status and stopped (2026-10-25).\n */\n many?: boolean\n}\n\nexport interface ReadColumn {\n /** The key in the workspace table. */\n name: string\n /** Where the value is in a row - a dotted path into the query's item (`account.name`). Defaults to `name`. */\n path?: string\n type: 'string' | 'number' | 'date'\n labelKey?: string\n /** A number column the server sums. */\n total?: boolean\n /**\n * The column that holds this amount's currency (ISO 4217, `KRW`). Its sums are kept per currency - amounts of two\n * currencies are never added into one number.\n */\n currency?: string\n /**\n * The i18n prefix that names this column's codes - `<words><code>` (`announcement.category.` reads `HR` as\n * `announcement.category.HR`). The rows keep the code, so a filter or a card's match means the same in every\n * language; the model is given the words (`legendOf`) and a table or chart shows them (`wordOf`).\n */\n words?: string\n}\n\nexport interface ReadScreen {\n /** A URL-bound grid accepts the same predicates used by readRows, including conditions outside its form. */\n queryState?: boolean\n /** The application's route of the list screen (`cash-transaction-list`). */\n route: string\n /** The conditions the screen takes, as its address's query arguments. A condition left out is said on the card. */\n params: (criteria: Record<string, any>) => Record<string, string | number | undefined>\n /** The conditions `params` carries - the card names the others as not applied on the screen. */\n takes: string[]\n labelKey?: string\n}\n\nexport interface ReadTarget {\n /** `<app>.<record>` - the tools are named after it. */\n key: string\n /** i18n key naming the records (「은행 입출금」). */\n labelKey?: string\n /** What the records are, for the model. */\n description: string\n /**\n * The list query - takes `$filters: [Filter!]`, `$pagination: Pagination` and `$sortings: [Sorting!]`, and\n * `$search: String` when `search` is declared.\n */\n query: string\n /**\n * The list takes ListParam's free-text term, matched by the resolver across its own searchable fields - the\n * condition `text`. Say what it finds in, for the model.\n */\n search?: { description: string }\n criteria: ReadCriterion[]\n /**\n * Filters every read of this list applies - the records it is of (a book's confirmed lines, not its forecasts). Not\n * a condition: the model neither sees nor sets them, so a read can narrow the list but never widen it.\n */\n fixedFilters?: ReadFilter[]\n columns: ReadColumn[]\n rowsOf: (data: any) => { rows: any[]; total: number }\n /** Orders the rows; the query's own order when left out. */\n sortings?: { name: string; desc?: boolean }[]\n screen?: ReadScreen\n /**\n * The rows are the person's own, whoever reads them (내 지출결의) - the query answers for the one asking. A dashboard\n * card of it shows each viewer their own rows and takes no filter on a person (ADR-0160).\n */\n mine?: boolean\n}\n\n/** At most this many rows are read - the AI 작업 패널 table's own limit (workspace-blocks MAX_TABLE_ROWS). */\nexport const MAX_READ_ROWS = 1000\n/** Rows the model is shown; the rest stay on the card. */\nexport const ROWS_FOR_MODEL = 20\n/** A page of the list query. */\nexport const READ_PAGE = 200\n\nconst registry = new Map<string, ReadTarget>()\n\nconst pascalOf = (key: string) =>\n key\n .split(/[^a-zA-Z0-9]+/)\n .filter(Boolean)\n .map(part => part[0].toUpperCase() + part.slice(1))\n .join('')\n\nexport const queryToolName = (key: string) => `query${pascalOf(key)}`\nexport const screenToolName = (key: string) => `open${pascalOf(key)}Screen`\nexport const readCategoryName = (key: string) => `data-read:${key}`\n\n/** The columns of a list - shown, each named once, a currency only on a summed number and taken from a string column. */\nfunction checkColumns(of: string, columns: ReadColumn[]): void {\n if (!columns.length) throw new Error(`read target '${of}' shows no column`)\n const names = new Set<string>()\n for (const column of columns) {\n if (names.has(column.name)) throw new Error(`read target '${of}' names the column '${column.name}' twice`)\n names.add(column.name)\n }\n for (const column of columns.filter(one => one.currency)) {\n if (!column.total || column.type !== 'number') throw new Error(`column '${column.name}' of '${of}' names a currency but is not a summed number`)\n if (columns.find(one => one.name === column.currency)?.type !== 'string') throw new Error(`column '${column.name}' of '${of}' takes its currency from '${column.currency}', which is no string column`)\n }\n}\n\nexport function declareReadTarget(target: ReadTarget): void {\n if (!/^[a-z0-9-]+\\.[a-z0-9-]+$/.test(target.key)) throw new Error(`read target key '${target.key}' is not <app>.<record>`)\n if (registry.has(target.key) || details.has(target.key)) throw new Error(`read target '${target.key}' is declared twice`)\n rootFieldOf(target.query, 'query')\n checkColumns(target.key, target.columns)\n const names = new Set<string>(['id'])\n for (const criterion of target.criteria) {\n if (criterion.name === 'id') throw new Error(`read target '${target.key}' declares 'id' - every target takes it`)\n if (criterion.name === 'text' && target.search) throw new Error(`read target '${target.key}' declares 'text' and search - search is the text condition`)\n if (names.has(criterion.name)) throw new Error(`read target '${target.key}' names the condition '${criterion.name}' twice`)\n names.add(criterion.name)\n if (criterion.type === 'enum' && !criterion.values?.length) throw new Error(`condition '${criterion.name}' of '${target.key}' lists no values`)\n }\n if (target.search) names.add('text')\n for (const taken of target.screen?.takes ?? []) if (!names.has(taken)) throw new Error(`the screen of '${target.key}' takes '${taken}', which is no condition`)\n registry.set(target.key, target)\n}\n\nexport function readTargetOf(key: string | undefined): ReadTarget | undefined {\n return key ? registry.get(key) : undefined\n}\n\n/** Every list read target declared - what else reads the declarations (a dashboard card, ADR-0160) lists them by key. */\nexport function readTargetKeys(): string[] {\n return [...registry.keys()]\n}\n\n/** Every detail read declared. */\nexport function detailReadKeys(): string[] {\n return [...details.keys()]\n}\n\nexport function clearReadTargets(): void {\n registry.clear()\n details.clear()\n}\n\n/* ── One answer of a query ──────────────────────────────────────────────────────────────────────────────────── */\n\n/** An argument of a detail read - one variable of its query, read with the entry fields' rules. */\nexport interface DetailArg {\n name: string\n type: 'string' | 'integer' | 'number' | 'boolean' | 'date' | 'enum'\n values?: string[]\n description?: string\n required?: boolean\n /** A record's id: the axis (or axes) of the record, whose key `<axis>:<id>` the model may have been shown (EntryField.axis). */\n axis?: string | readonly string[]\n /** A string argument holding a month as YYYY-MM. */\n format?: 'month'\n}\n\n/**\n * A query whose answer is one thing, not a list - a 360's summary, the receivables, a statement (design/ai/read-targets.md\n * §9). The application declares the query with the fields its screen reads; the framework runs it as the person, with\n * the arguments the model set, and hands the answer over as the query returned it. Nothing is summed or cut here: the\n * selection is the projection, and an answer too long to hand over is refused, never cut.\n */\nexport interface DetailRead {\n /** `<app>.<thing>` - the tool is named after it. */\n key: string\n labelKey?: string\n /** What it answers, for the model. */\n description: string\n /** One query with one root field. Its variables are the arguments - each declared in `args`. */\n query: string\n args?: DetailArg[]\n /**\n * The records the answer is about, whose screens put it in front (EntryTarget.axes) - the management check answers\n * for any ledger record; asked on a deposit's 360 why it was in the check, the model never opened it (2026-10-24).\n */\n axes?: string[]\n /**\n * Application routes that prioritize this tool through ConversationCategory.frontPages. Single-record\n * readers may have no list page of their own.\n */\n frontPages?: string[]\n /**\n * The lists the answer holds, each a table of typed columns - what a dashboard card may draw from a one-answer read\n * (ADR-0160 decision 2). The card keeps only `key`; where the rows are and what their columns are is read here.\n */\n lists?: DetailList[]\n /** The answer is the person's own, whoever asks (나의 전략 업무, 내 급여) - ReadTarget.mine. */\n mine?: boolean\n}\n\n/** A list inside a detail read's answer. */\nexport interface DetailList {\n /** A name stable within the read (`by-contract`) - what a card keeps. */\n key: string\n /** A dotted path inside the value of the query's root field (`rows`); '' when the root field is the list. */\n at: string\n labelKey?: string\n /** What the rows are, for the model. */\n description?: string\n columns: ReadColumn[]\n}\n\n/** Characters of an answer handed to the model - a longer one is refused, and the model narrows it. */\nexport const MAX_DETAIL_CHARS = 60_000\n\nconst details = new Map<string, DetailRead>()\n\nexport const detailToolName = (key: string) => `read${pascalOf(key)}`\n\n/** The variables a query declares, and whether each is required (`!`). */\nfunction variablesOf(document: string): { name: string; required: boolean }[] {\n const operation: any = parse(document).definitions.find((one: any) => one.kind === 'OperationDefinition')\n return (operation?.variableDefinitions ?? []).map((one: any) => ({ name: one.variable.name.value, required: one.type.kind === 'NonNullType' && !one.defaultValue }))\n}\n\nexport function declareDetailRead(target: DetailRead): void {\n if (!/^[a-z0-9-]+\\.[a-z0-9-]+$/.test(target.key)) throw new Error(`detail read key '${target.key}' is not <app>.<thing>`)\n if (details.has(target.key) || registry.has(target.key)) throw new Error(`read target '${target.key}' is declared twice`)\n rootFieldOf(target.query, 'query')\n const args = target.args ?? []\n for (const variable of variablesOf(target.query)) {\n const arg = args.find(one => one.name === variable.name)\n if (!arg) throw new Error(`detail read '${target.key}' takes $${variable.name}, which is no argument`)\n if (variable.required && !arg.required) throw new Error(`detail read '${target.key}': $${variable.name} is required by the query - declare it required`)\n }\n for (const arg of args) {\n if (!variablesOf(target.query).some(one => one.name === arg.name)) throw new Error(`detail read '${target.key}' declares '${arg.name}', which its query does not take`)\n if (arg.type === 'enum' && !arg.values?.length) throw new Error(`argument '${arg.name}' of '${target.key}' lists no values`)\n }\n const lists = new Set<string>()\n for (const list of target.lists ?? []) {\n if (!/^[a-z0-9-]+$/.test(list.key)) throw new Error(`list '${list.key}' of '${target.key}' is not a lowercase key`)\n if (lists.has(list.key)) throw new Error(`detail read '${target.key}' names the list '${list.key}' twice`)\n lists.add(list.key)\n if (!/^([A-Za-z0-9_]+(\\.[A-Za-z0-9_]+)*)?$/.test(list.at)) throw new Error(`list '${list.key}' of '${target.key}' is at '${list.at}', which is no dotted path`)\n checkColumns(`${target.key}/${list.key}`, list.columns)\n }\n details.set(target.key, target)\n}\n\nexport function detailReadOf(key: string | undefined): DetailRead | undefined {\n return key ? details.get(key) : undefined\n}\n\n/** A month as a `month` condition holds it. */\nconst MONTH = /^\\d{4}-(0[1-9]|1[0-2])$/\n\n/*\n * The id a key `<axis>:<id>` names - a uuid, or a row's own composite id (a training standing is `<kind>:<year>:<employee>`,\n * 2026-11-08). Another axis's key is not this record's: it stays as written and finds nothing.\n */\nconst idOfKey = (axis: string, text: string): string => recordIdOfKey(axis, text) ?? (text.startsWith(`${axis}:`) ? text.slice(axis.length + 1) : text)\n\n/** The conditions the model set, read by their declared types; a value that does not fit is said, never guessed at. */\nexport function readCriteria(target: ReadTarget, args: any): { criteria: Record<string, unknown>; refused: { name: string; code: string }[] } {\n const criteria: Record<string, unknown> = {}\n const refused: { name: string; code: string }[] = []\n /* One record by its id - every target takes it (the id a list answer or a find tool gave, or the key `<axis>:<id>` an open record is shown by, the axis being the key's last part). */\n if (typeof args?.id === 'string' && args.id.trim()) criteria.id = idOfKey(target.key.split('.').pop()!, args.id.trim())\n if (target.search && typeof args?.text === 'string' && args.text.trim()) criteria.text = args.text.trim()\n for (const criterion of target.criteria) {\n const value = args?.[criterion.name]\n if (value === undefined || value === null || value === '' || (Array.isArray(value) && !value.length)) continue\n if (criterion.many && Array.isArray(value)) {\n const each = value.map(one => readFieldValue(criterion as EntryField, one))\n const wrong = each.find(one => one.read === undefined)\n if (wrong) refused.push({ name: criterion.name, code: wrong.code ?? 'unreadable' })\n else criteria[criterion.name] = [...new Set(each.map(one => one.read))]\n continue\n }\n if (Array.isArray(value)) {\n refused.push({ name: criterion.name, code: 'one-value' })\n continue\n }\n const { read, code } = readFieldValue(criterion as EntryField, value)\n if (read === undefined) refused.push({ name: criterion.name, code: code ?? 'unreadable' })\n else if (criterion.format === 'month' && !MONTH.test(String(read))) refused.push({ name: criterion.name, code: 'not-a-month' })\n else criteria[criterion.name] = read\n }\n return { criteria, refused }\n}\n\nexport function filtersOf(target: ReadTarget, criteria: Record<string, unknown>): ReadFilter[] {\n return [\n ...(typeof criteria.id === 'string' ? [{ name: 'id', operator: 'eq', value: criteria.id }] : []),\n ...target.criteria.flatMap(criterion =>\n criterion.name in criteria ? [criterion.filter(criteria[criterion.name])].flat() : []\n )\n ]\n}\n\n/** A dotted path's value - through a list, each one's (an invention's inventors' names). */\nexport const valueAt = (row: any, path: string) =>\n path.split('.').reduce((at, part) => (at === null || at === undefined ? undefined : Array.isArray(at) ? at.map(one => one?.[part]) : at[part]), row)\n\n/**\n * A date column's moment as people read it - `YYYY-MM-DD HH:mm` in the domain's time zone. A day (`YYYY-MM-DD`) or\n * month stays as it is; anything that is not a moment is left alone. Still ordered as text, so a card's comparison\n * with a day keeps working.\n */\nexport function localDateTime(value: string, timeZone?: string): string {\n if (!/^\\d{4}-\\d{2}-\\d{2}T/.test(value)) return value\n const moment = new Date(value)\n if (Number.isNaN(moment.getTime())) return value\n try {\n const parts = Object.fromEntries(\n new Intl.DateTimeFormat('en-CA', { timeZone: timeZone || undefined, year: 'numeric', month: '2-digit', day: '2-digit', hour: '2-digit', minute: '2-digit', hourCycle: 'h23' })\n .formatToParts(moment)\n .map(part => [part.type, part.value])\n )\n return `${parts.year}-${parts.month}-${parts.day} ${parts.hour}:${parts.minute}`\n } catch {\n return value\n }\n}\n\n/** How the reader's words are asked - `(key, fallback)`, the fallback when the key has no word. */\nexport type SayWord = (key: string | undefined, fallback: string) => string\n\n/** The word a coded value is read as, in the reader's language - the value itself when its column has no words. */\nexport function wordOf(column: Pick<ReadColumn, 'words'> | undefined, value: unknown, say: SayWord): unknown {\n if (!column?.words || value === null || value === undefined || value === '') return value\n return say(`${column.words}${value}`, String(value))\n}\n\n/** The words of the coded values the rows hold, column by column - what the model reads the codes by. */\nexport function legendOf(columns: readonly Pick<ReadColumn, 'name' | 'words'>[], rows: Record<string, any>[], say: SayWord): Record<string, Record<string, string>> {\n const legend: Record<string, Record<string, string>> = {}\n for (const column of columns) {\n if (!column.words) continue\n for (const row of rows) {\n const code = row[column.name]\n if (code === null || code === undefined || code === '') continue\n ;(legend[column.name] ??= {})[String(code)] = String(wordOf(column, code, say))\n }\n }\n return legend\n}\n\n/** What shapes a row besides its columns - the domain's time zone, for a moment. */\nexport type RowOptions = { timeZone?: string }\n\n/** One row as the columns say - a number column as a number, a moment in the domain's time zone, a missing value as null. */\nexport function rowOf(target: Pick<ReadTarget, 'columns'>, item: any, options: RowOptions = {}): Record<string, string | number | null> {\n return Object.fromEntries([\n /* The id names the record to the model - for one record's detail, a change, or its screen. */\n ...(item?.id ? [['id', String(item.id)] as [string, string]] : []),\n ...target.columns.map(column => {\n const found = valueAt(item, column.path ?? column.name)\n /* A list of values reads as one, comma-separated. */\n const raw = Array.isArray(found) ? found.filter(one => one !== undefined && one !== null && one !== '').join(', ') : found\n if (raw === undefined || raw === null || raw === '') return [column.name, null]\n if (column.type === 'number') {\n const number = Number(raw)\n return [column.name, Number.isFinite(number) ? number : null]\n }\n return [column.name, column.type === 'date' ? localDateTime(String(raw), options.timeZone) : String(raw)]\n })\n ])\n}\n\n/**\n * Reads the rows through the application's query, page by page, up to MAX_READ_ROWS. `complete` is false when the\n * list holds more - a sum of the rows read is then not the sum of the list, and is never said as one.\n */\nexport async function readRows(\n target: ReadTarget,\n filters: ReadFilter[],\n run: GraphqlRunner,\n search?: string,\n options: RowOptions = {}\n): Promise<{ rows: Record<string, any>[]; total: number; complete: boolean }> {\n const rows: Record<string, any>[] = []\n let total = 0\n for (let page = 1; rows.length < MAX_READ_ROWS; page++) {\n const answer = await run(target.query, {\n filters: [...filters, ...(target.fixedFilters ?? [])],\n ...(search ? { search } : {}),\n pagination: { page, limit: READ_PAGE },\n ...(target.sortings ? { sortings: target.sortings } : {})\n })\n if (answer.errors?.length) throw new Error(answer.errors.map(one => one.message).join('; '))\n const read = target.rowsOf(answer.data)\n total = Number(read?.total) || 0\n const items = read?.rows ?? []\n rows.push(...items.slice(0, MAX_READ_ROWS - rows.length).map(item => rowOf(target, item, options)))\n if (items.length < READ_PAGE || rows.length >= total) break\n }\n return { rows, total, complete: rows.length >= total }\n}\n\n/** A column's sum - one number, or one per currency when the column names its currency (`{ KRW: 1000, USD: 100 }`). */\nexport type ReadSum = number | Record<string, number>\n\nexport interface ReadGroup {\n key: string\n count: number\n sums: Record<string, ReadSum>\n}\n\n/** The currency a row without one is summed under - said as it is, never taken for the domain's own. */\nexport const UNKNOWN_CURRENCY = 'unknown'\n\nconst sumOf = (rows: Record<string, any>[], name: string) => Math.round(rows.reduce((sum, row) => sum + (typeof row[name] === 'number' ? row[name] : 0), 0) * 100) / 100\n\n/** The sums of the number columns marked total - the server's, never the model's; a column with a currency per currency. */\nexport function sumsOf(target: Pick<ReadTarget, 'columns'>, rows: Record<string, any>[]): Record<string, ReadSum> {\n const sums: Record<string, ReadSum> = {}\n for (const column of target.columns.filter(one => one.total && one.type === 'number')) {\n if (!column.currency) {\n sums[column.name] = sumOf(rows, column.name)\n continue\n }\n const byCurrency = new Map<string, Record<string, any>[]>()\n for (const row of rows) {\n const code = typeof row[column.currency] === 'string' && row[column.currency] ? row[column.currency] : UNKNOWN_CURRENCY\n byCurrency.set(code, [...(byCurrency.get(code) ?? []), row])\n }\n sums[column.name] = Object.fromEntries([...byCurrency].sort(([a], [b]) => a.localeCompare(b)).map(([code, members]) => [code, sumOf(members, column.name)]))\n }\n return sums\n}\n\n/** The currencies a set of sums holds for one column - none for a column summed as one number. */\nexport function currenciesOf(sums: Record<string, ReadSum>[], column: string): string[] {\n const codes = new Set<string>()\n for (const one of sums) if (one[column] && typeof one[column] === 'object') for (const code of Object.keys(one[column] as object)) codes.add(code)\n return [...codes].sort()\n}\n\n/** The rows grouped by one column - a date column by its month - each with its count and sums, largest first. */\nexport function groupsOf(target: Pick<ReadTarget, 'columns'>, rows: Record<string, any>[], by: string): ReadGroup[] | undefined {\n const column = target.columns.find(one => one.name === by)\n if (!column) return undefined\n const groups = new Map<string, Record<string, any>[]>()\n for (const row of rows) {\n const value = row[by]\n const key = value === null || value === undefined ? '' : column.type === 'date' ? String(value).slice(0, 7) : String(value)\n groups.set(key, [...(groups.get(key) ?? []), row])\n }\n const list = [...groups].map(([key, members]) => ({ key, count: members.length, sums: sumsOf(target, members) }))\n if (column.type === 'date') return list.sort((a, b) => a.key.localeCompare(b.key))\n /* Largest first by the first sum - in its one currency; groups in two currencies have no common size, so by count. */\n const first = target.columns.find(one => one.total)?.name\n const codes = first ? currenciesOf(list.map(group => group.sums), first) : []\n const size = (group: ReadGroup) => {\n const sum = first ? group.sums[first] : undefined\n return typeof sum === 'number' ? Math.abs(sum) : codes.length === 1 && sum ? Math.abs(sum[codes[0]] ?? 0) : undefined\n }\n return list.sort((a, b) => {\n const [x, y] = [size(a), size(b)]\n return x !== undefined && y !== undefined && codes.length <= 1 ? y - x : b.count - a.count\n })\n}\n\n/** The address of the target's list screen with the conditions it takes, and the conditions it does not. */\nexport function screenAddress(target: ReadTarget, criteria: Record<string, unknown>): { href: string; applied: string[]; notApplied: string[] } | undefined {\n const screen = target.screen\n if (!screen) return undefined\n const params = new URLSearchParams()\n for (const [name, value] of Object.entries(screen.params(criteria))) if (value !== undefined && value !== null && value !== '') params.set(name, String(value))\n const given = Object.keys(criteria)\n const applicable = Object.fromEntries(Object.entries(criteria).filter(([name]) => screen.takes.includes(name)))\n const query = screen.queryState\n ? encodeListQuery({\n filters: filtersOf(target, applicable),\n search: typeof applicable.text === 'string' ? applicable.text : undefined,\n sorters: target.sortings\n })\n : params.toString()\n return {\n href: query ? `${screen.route}?${query}` : screen.route,\n applied: given.filter(name => screen.takes.includes(name)),\n notApplied: given.filter(name => !screen.takes.includes(name))\n }\n}\n"]}
|
|
@@ -2,13 +2,15 @@ import { entersDomainAsAssignee } from '@things-factory/auth-base/dist-server/ut
|
|
|
2
2
|
import { type AssistantSubjectDescriber } from '@things-factory/ai-client-base';
|
|
3
3
|
/** The 360 kind of a person - auth-ui's `person`. */
|
|
4
4
|
export declare const PERSON_AXIS = "person";
|
|
5
|
-
/**
|
|
5
|
+
/**
|
|
6
|
+
* Response-request card registered by worklist to create an assigned task (ADR-0200).
|
|
7
|
+
*/
|
|
6
8
|
export declare const PERSON_QUESTION_KEY = "worklist.person-question";
|
|
7
9
|
/** The person a conversation is about, by its anchor - `undefined` when it is about no one. */
|
|
8
10
|
export declare function personOfAnchor(anchorType: string | null | undefined, anchorId: string | null | undefined): string | undefined;
|
|
9
11
|
/**
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
+
* Add the subject user to a new group conversation unless the creator is the subject. Private sessions have
|
|
13
|
+
* no additional participants; public sessions are domain-readable.
|
|
12
14
|
*/
|
|
13
15
|
export declare function personSeatOf(anchorType: string | null | undefined, anchorId: string | null | undefined, starter: {
|
|
14
16
|
id?: string;
|
|
@@ -16,7 +18,9 @@ export declare function personSeatOf(anchorType: string | null | undefined, anch
|
|
|
16
18
|
userId: string;
|
|
17
19
|
visibility: 'group';
|
|
18
20
|
} | undefined;
|
|
19
|
-
/**
|
|
21
|
+
/**
|
|
22
|
+
* Return the reason a person-conversation update is invalid, or no reason when allowed.
|
|
23
|
+
*/
|
|
20
24
|
export declare function personRoomRefusal(session: {
|
|
21
25
|
anchorType?: string | null;
|
|
22
26
|
anchorId?: string | null;
|
|
@@ -28,7 +32,7 @@ export declare function personRoomRefusal(session: {
|
|
|
28
32
|
/** The words of a refusal above. */
|
|
29
33
|
export declare const PERSON_ROOM_REFUSALS: Record<string, string>;
|
|
30
34
|
/**
|
|
31
|
-
*
|
|
35
|
+
* Model guidance appended after the subject name on each conversation turn.
|
|
32
36
|
*/
|
|
33
37
|
export declare const PERSON_GUIDANCE: string;
|
|
34
38
|
export declare function personSubjectDescriber(entersDomain?: typeof entersDomainAsAssignee): AssistantSubjectDescriber;
|
|
@@ -6,20 +6,11 @@ exports.personSeatOf = personSeatOf;
|
|
|
6
6
|
exports.personRoomRefusal = personRoomRefusal;
|
|
7
7
|
exports.personSubjectDescriber = personSubjectDescriber;
|
|
8
8
|
/*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
* when each was written; their character, intent, mood and ability are never guessed; nobody speaks as them; what
|
|
15
|
-
* binds them goes to them as a to-do (`guidance`).
|
|
16
|
-
* · the person sits in it. A conversation about someone is a group the person always reads - nothing is asked of
|
|
17
|
-
* their records out of their sight (`personSeatOf`, the doors that open a conversation).
|
|
18
|
-
* · it stays a group with them in it - neither open to the whole domain nor private, and they are not sent out
|
|
19
|
-
* (`personRoomRefusal`).
|
|
20
|
-
*
|
|
21
|
-
* Asking about oneself is an ordinary conversation: nobody else is seated and the rules about speaking for someone do
|
|
22
|
-
* not apply.
|
|
9
|
+
* Centralize rules for sessions anchored to subject / person:<user id> (ADR-0200). Identify the person in
|
|
10
|
+
* model context and require record sources and timestamps; do not infer personality, intent, mood or
|
|
11
|
+
* ability, or speak on their behalf. Add the subject as a participant and preserve group visibility and
|
|
12
|
+
* membership. Requests requiring their decision become assigned tasks. Self-anchored sessions use ordinary
|
|
13
|
+
* conversation rules.
|
|
23
14
|
*/
|
|
24
15
|
const auth_base_1 = require("@things-factory/auth-base");
|
|
25
16
|
const get_domain_users_js_1 = require("@things-factory/auth-base/dist-server/utils/get-domain-users.js");
|
|
@@ -28,7 +19,9 @@ const shell_1 = require("@things-factory/shell");
|
|
|
28
19
|
const entry_target_js_1 = require("../data-entry/entry-target.js");
|
|
29
20
|
/** The 360 kind of a person - auth-ui's `person`. */
|
|
30
21
|
exports.PERSON_AXIS = 'person';
|
|
31
|
-
/**
|
|
22
|
+
/**
|
|
23
|
+
* Response-request card registered by worklist to create an assigned task (ADR-0200).
|
|
24
|
+
*/
|
|
32
25
|
exports.PERSON_QUESTION_KEY = 'worklist.person-question';
|
|
33
26
|
/** The person a conversation is about, by its anchor - `undefined` when it is about no one. */
|
|
34
27
|
function personOfAnchor(anchorType, anchorId) {
|
|
@@ -37,14 +30,16 @@ function personOfAnchor(anchorType, anchorId) {
|
|
|
37
30
|
return anchorId.slice(exports.PERSON_AXIS.length + 1) || undefined;
|
|
38
31
|
}
|
|
39
32
|
/**
|
|
40
|
-
*
|
|
41
|
-
*
|
|
33
|
+
* Add the subject user to a new group conversation unless the creator is the subject. Private sessions have
|
|
34
|
+
* no additional participants; public sessions are domain-readable.
|
|
42
35
|
*/
|
|
43
36
|
function personSeatOf(anchorType, anchorId, starter) {
|
|
44
37
|
const userId = personOfAnchor(anchorType, anchorId);
|
|
45
38
|
return userId && userId !== starter?.id ? { userId, visibility: 'group' } : undefined;
|
|
46
39
|
}
|
|
47
|
-
/**
|
|
40
|
+
/**
|
|
41
|
+
* Return the reason a person-conversation update is invalid, or no reason when allowed.
|
|
42
|
+
*/
|
|
48
43
|
function personRoomRefusal(session, change) {
|
|
49
44
|
const userId = personOfAnchor(session.anchorType, session.anchorId);
|
|
50
45
|
if (!userId || userId === session.creatorId)
|
|
@@ -61,7 +56,7 @@ exports.PERSON_ROOM_REFUSALS = {
|
|
|
61
56
|
'person-room-keeps-person': 'the person this conversation is about always reads it - they cannot be sent out. they can hide it from their own list.'
|
|
62
57
|
};
|
|
63
58
|
/**
|
|
64
|
-
*
|
|
59
|
+
* Model guidance appended after the subject name on each conversation turn.
|
|
65
60
|
*/
|
|
66
61
|
exports.PERSON_GUIDANCE = [
|
|
67
62
|
'This conversation is about that person, and they read it. Rules:',
|