@things-factory/ai-assistant 10.1.88 → 10.1.90

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.
Files changed (64) hide show
  1. package/client/components/assistant-chat.ts +19 -5
  2. package/client/components/assistant-dock.ts +21 -1
  3. package/client/components/entry-review.ts +246 -0
  4. package/client/utils/assistant-proposals.ts +11 -1
  5. package/client/utils/entry-proposal.ts +103 -0
  6. package/dist-client/components/assistant-chat.d.ts +1 -0
  7. package/dist-client/components/assistant-chat.js +19 -5
  8. package/dist-client/components/assistant-chat.js.map +1 -1
  9. package/dist-client/components/assistant-dock.js +16 -1
  10. package/dist-client/components/assistant-dock.js.map +1 -1
  11. package/dist-client/components/entry-review.d.ts +9 -0
  12. package/dist-client/components/entry-review.js +247 -0
  13. package/dist-client/components/entry-review.js.map +1 -0
  14. package/dist-client/tsconfig.tsbuildinfo +1 -1
  15. package/dist-client/utils/assistant-proposals.d.ts +1 -0
  16. package/dist-client/utils/assistant-proposals.js +9 -1
  17. package/dist-client/utils/assistant-proposals.js.map +1 -1
  18. package/dist-client/utils/entry-proposal.d.ts +55 -0
  19. package/dist-client/utils/entry-proposal.js +52 -0
  20. package/dist-client/utils/entry-proposal.js.map +1 -0
  21. package/dist-server/service/assistant-mode/registry.js +13 -0
  22. package/dist-server/service/assistant-mode/registry.js.map +1 -1
  23. package/dist-server/service/assistant-mode/resolve.d.ts +11 -0
  24. package/dist-server/service/assistant-mode/resolve.js +13 -3
  25. package/dist-server/service/assistant-mode/resolve.js.map +1 -1
  26. package/dist-server/service/assistant-mode/types.d.ts +7 -1
  27. package/dist-server/service/assistant-mode/types.js.map +1 -1
  28. package/dist-server/service/data-entry/entry-apply.d.ts +46 -0
  29. package/dist-server/service/data-entry/entry-apply.js +102 -0
  30. package/dist-server/service/data-entry/entry-apply.js.map +1 -0
  31. package/dist-server/service/data-entry/entry-resolver.d.ts +4 -0
  32. package/dist-server/service/data-entry/entry-resolver.js +80 -0
  33. package/dist-server/service/data-entry/entry-resolver.js.map +1 -0
  34. package/dist-server/service/data-entry/entry-sources.d.ts +1 -0
  35. package/dist-server/service/data-entry/entry-sources.js +41 -0
  36. package/dist-server/service/data-entry/entry-sources.js.map +1 -0
  37. package/dist-server/service/data-entry/entry-target.d.ts +157 -0
  38. package/dist-server/service/data-entry/entry-target.js +343 -0
  39. package/dist-server/service/data-entry/entry-target.js.map +1 -0
  40. package/dist-server/service/data-entry/entry-tools.d.ts +43 -0
  41. package/dist-server/service/data-entry/entry-tools.js +185 -0
  42. package/dist-server/service/data-entry/entry-tools.js.map +1 -0
  43. package/dist-server/service/index.d.ts +4 -1
  44. package/dist-server/service/index.js +10 -2
  45. package/dist-server/service/index.js.map +1 -1
  46. package/dist-server/tsconfig.tsbuildinfo +1 -1
  47. package/package.json +2 -2
  48. package/server/service/assistant-mode/registry.ts +13 -0
  49. package/server/service/assistant-mode/resolve.ts +13 -3
  50. package/server/service/assistant-mode/types.ts +7 -1
  51. package/server/service/data-entry/data-entry.test.ts +311 -0
  52. package/server/service/data-entry/entry-apply.ts +134 -0
  53. package/server/service/data-entry/entry-resolver.ts +74 -0
  54. package/server/service/data-entry/entry-sources.ts +35 -0
  55. package/server/service/data-entry/entry-target.ts +442 -0
  56. package/server/service/data-entry/entry-tools.ts +174 -0
  57. package/server/service/index.ts +7 -1
  58. package/test/entry-proposal.test.ts +67 -0
  59. package/test/open-doors.test.ts +2 -1
  60. package/translations/en.json +36 -1
  61. package/translations/ja.json +36 -1
  62. package/translations/ko.json +36 -1
  63. package/translations/ms.json +36 -1
  64. package/translations/zh.json +36 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"entry-target.js","sourceRoot":"","sources":["../../../server/service/data-entry/entry-target.ts"],"names":[],"mappings":";;;AA6HA,kCAOC;AAGD,4CAOC;AASD,gDAiBC;AAED,sCAEC;AAED,oCAEC;AAGD,8CAEC;AAGD,sCAOC;AAED,8CAEC;AAuCD,gDAqEC;AAGD,8CAGC;AA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CAAC,QAAQ,CAAC,KAAK,IAAI,KAAK,CAAC,IAAI,CAAC,KAAK,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,SAAS,CAAA;QAC9G,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;YACxB,KAAK,CAAC,QAAQ,GAAG,KAAK,CAAA;YACtB,KAAK,CAAC,UAAU,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,KAAK,GAAG,KAAK,CAAC,GAAG,CAAC,GAAG,GAAG,CAAC,GAAG,GAAG,CAAA;YAC9D,MAAM,IAAI,GAAG,QAAS,CAAC,YAAY,CAAC,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,QAAS,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,SAAS,CAAA;YACnF,IAAI,IAAI,KAAK,SAAS;gBAAE,KAAK,CAAC,aAAa,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,OAAO,CAAC,IAAI,EAAE,YAAY,CAAC,KAAK,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC,CAAC,CAAA;QAChI,CAAC;QACD,OAAO,KAAK,CAAA;IACd,CAAC,CAAC,CAAA;AACN,CAAC","sourcesContent":["/*\n * Data entry from material - what an application declares so the assistant can enter its records\n * (operato-application/design/ai/data-entry.md).\n *\n * A person hands the conversation what the records are made of - a bank export, a photo of a receipt,\n * lines pasted from a mail - and the assistant turns it into rows of one of the application's records.\n * Nothing is written by the model. It proposes the rows; the card shows them with what was wrong in\n * each and where each came from; a correction is said in the conversation and the model proposes again;\n * the person presses the button; the server enters each row **through the application's own GraphQL\n * mutation**, run with the person's request state - the same door, directives and checks as entering by hand.\n * There is no second way into the record.\n *\n * This file is pure - no framework, no database - so the rules a row passes are tested without a server.\n */\nimport { parse } from 'graphql'\n\nexport type EntryFieldType = 'string' | 'text' | 'number' | 'integer' | 'date' | 'boolean' | 'enum'\n\nexport interface EntryField {\n name: string\n type: EntryFieldType\n required?: boolean\n /** The allowed values of an `enum` field. */\n values?: string[]\n /** What the model reads about the field - English, like every tool description. */\n description?: string\n /** i18n key of the column heading on the card. Absent: the field name. */\n labelKey?: string\n /** A number field the card sums - and compares with the total the material prints (§ totals). */\n total?: boolean\n}\n\n/** Where a row came from - which file, and where in it. Shown on the card beside the row. */\nexport interface EntrySource {\n attachmentId?: string\n /** \"row 3\", \"the receipt photo\", \"the person's message\" - the model's words. */\n where?: string\n}\n\nexport interface EntryIssue {\n /** The field it is about. Absent: the row as a whole. */\n field?: string\n /** A code the screen translates: `ai-assistant.entry.issue.<code>`, or the target's own `messageKey`. */\n code: string\n messageKey?: string\n params?: Record<string, unknown>\n /** A blocking issue keeps the row out when the person presses the button. */\n blocking: boolean\n}\n\nexport interface EntryRowInput {\n values?: Record<string, unknown>\n sources?: EntrySource[]\n}\n\nexport interface EntryRow {\n index: number\n values: Record<string, unknown>\n sources: EntrySource[]\n issues: EntryIssue[]\n /** The line of a text source where this row's numbers and dates were all found - the server's check, not the model's word. */\n evidence?: { attachmentId: string; line: number }\n}\n\nexport interface EntryContext {\n /** The request state - domain, user, and when writing, `tx` and `afterCommit`. */\n state: any\n}\n\nexport interface EntryApplied {\n /** The created record's id, when there is one. */\n id?: string\n /** A short name for the conversation line - \"2026-09-12 · 택시 · ₩12,400\". */\n label?: string\n}\n\n/** What happened, for an application that writes down every assistant call (office's AI audit). */\nexport interface EntryEvent {\n phase: 'propose' | 'apply'\n tool: string\n rows: number\n ok: boolean\n applied?: number\n missed?: number\n error?: string\n /** propose: the rows as the model gave them; apply: the proposal key and each row's result. */\n detail?: unknown\n}\n\nexport interface EntryTarget {\n /** `<app>.<record>` - `office.expense-line`. */\n key: string\n /** i18n key of the record's name on the card. */\n labelKey: string\n /** What one row is, for the model. */\n description: string\n fields: EntryField[]\n /**\n * The application's own mutation that enters one record, as a GraphQL document with one root field -\n * `mutation ($line: NewExpenseLine!) { addExpenseLine(line: $line) { id } }`. Its root field is the door:\n * the propose tool is offered only to someone who passes it, and each row is entered by running it with\n * the person's request state, so `@privilege`, `@transaction` and the door's own checks apply as they do\n * to a person typing it in.\n */\n mutation: string\n /** The mutation's variables for one row. */\n variables(row: EntryRow): Record<string, unknown>\n /** What the conversation says of an entered row - its id and a short name. */\n appliedOf?(data: any, row: EntryRow): EntryApplied | undefined\n /** At most this many rows in one proposal. Default 200. */\n maxRows?: number\n /**\n * Read-only checks the application owns - a duplicate of what is already entered, a code that does not\n * exist. Asked when the rows are proposed and again when they are entered: the records may have moved.\n * Returns one list per row, in order.\n */\n check?(rows: EntryRow[], context: EntryContext): EntryIssue[][] | Promise<EntryIssue[][]>\n /** Told of every proposal and every entering - an application that audits its assistant writes it down. A throw is ignored. */\n record?(event: EntryEvent, context: EntryContext): void | Promise<void>\n}\n\n/**\n * `Mutation.<root field>` of the target's mutation - the one declaration both the tool's gate and the\n * entering read. A document that is not one mutation with one root field is refused at boot.\n */\nexport function entryDoorOf(mutation: string): string {\n const doc = parse(mutation)\n const operations = doc.definitions.filter((one: any) => one.kind === 'OperationDefinition') as any[]\n if (operations.length !== 1 || operations[0].operation !== 'mutation') throw new Error('is not one mutation')\n const fields = operations[0].selectionSet.selections.filter((one: any) => one.kind === 'Field')\n if (fields.length !== 1) throw new Error('must have exactly one root field')\n return `Mutation.${fields[0].name.value}`\n}\n\n/** Tells the target, and never lets its record keeping stop the work. */\nexport async function recordEntryEvent(target: EntryTarget, event: EntryEvent, context: EntryContext): Promise<void> {\n if (!target.record) return\n try {\n await target.record(event, context)\n } catch {\n /* an audit that failed to write is the application's to report */\n }\n}\n\nexport const DEFAULT_MAX_ROWS = 200\n\nconst targets = new Map<string, EntryTarget>()\n\nconst KEY = /^[a-z][a-z0-9-]*\\.[a-z][a-z0-9-]*$/\n\n/** Validates and keeps a target - `registerEntryTarget` (entry-tools.ts) also opens its tool. A malformed declaration is refused at boot, not in a conversation. */\nexport function declareEntryTarget(target: EntryTarget): void {\n if (!KEY.test(target?.key ?? '')) throw new Error(`[ai-assistant] entry target key '${target?.key}' is not '<app>.<record>'.`)\n try {\n entryDoorOf(target.mutation ?? '')\n } catch (error: any) {\n throw new Error(`[ai-assistant] entry target '${target.key}': its mutation ${error?.message ?? 'does not parse'}.`)\n }\n if (typeof target.variables !== 'function') throw new Error(`[ai-assistant] entry target '${target.key}' has no variables.`)\n if (!target.fields?.length) throw new Error(`[ai-assistant] entry target '${target.key}' declares no fields.`)\n const names = new Set<string>()\n for (const field of target.fields) {\n if (names.has(field.name)) throw new Error(`[ai-assistant] entry target '${target.key}' declares '${field.name}' twice.`)\n names.add(field.name)\n if (field.type === 'enum' && !field.values?.length)\n throw new Error(`[ai-assistant] entry target '${target.key}': enum field '${field.name}' lists no values.`)\n }\n targets.set(target.key, target)\n}\n\nexport function entryTargetOf(key: string | undefined): EntryTarget | undefined {\n return key ? targets.get(key) : undefined\n}\n\nexport function entryTargets(): EntryTarget[] {\n return [...targets.values()]\n}\n\n/** For tests. */\nexport function clearEntryTargets(): void {\n targets.clear()\n}\n\n/** `office.expense-line` → `proposeOfficeExpenseLineEntries` - one tool per target, so each has its own door. */\nexport function entryToolName(key: string): string {\n const pascal = key\n .split(/[.-]/)\n .filter(Boolean)\n .map(part => part[0].toUpperCase() + part.slice(1))\n .join('')\n return `propose${pascal}Entries`\n}\n\nexport function entryCategoryName(key: string): string {\n return `data-entry:${key}`\n}\n\nconst empty = (value: unknown) => value === undefined || value === null || (typeof value === 'string' && !value.trim())\n\n/** \"12,400\" · \"₩12,400\" · \"12 400\" → 12400. Only the separators people write; anything else is not a number. */\nfunction toNumber(value: unknown): number | undefined {\n if (typeof value === 'number') return Number.isFinite(value) ? value : undefined\n if (typeof value !== 'string') return undefined\n const cleaned = value.trim().replace(/^[₩$€¥£]\\s*/, '').replace(/[,\\s]/g, '').replace(/원$/, '')\n if (!/^-?\\d+(\\.\\d+)?$/.test(cleaned)) return undefined\n return Number(cleaned)\n}\n\n/** A calendar date as `YYYY-MM-DD` - \"2026.9.12\", \"2026/09/12\" too. A day that does not exist is not a date. */\nfunction toDate(value: unknown): string | undefined {\n if (typeof value !== 'string') return undefined\n const match = value.trim().match(/^(\\d{4})[-./](\\d{1,2})[-./](\\d{1,2})\\.?$/)\n if (!match) return undefined\n const [year, month, day] = [Number(match[1]), Number(match[2]), Number(match[3])]\n const date = new Date(Date.UTC(year, month - 1, day))\n if (date.getUTCFullYear() !== year || date.getUTCMonth() !== month - 1 || date.getUTCDate() !== day) return undefined\n return `${match[1]}-${String(month).padStart(2, '0')}-${String(day).padStart(2, '0')}`\n}\n\nfunction toBoolean(value: unknown): boolean | undefined {\n if (typeof value === 'boolean') return value\n if (typeof value !== 'string') return undefined\n const text = value.trim().toLowerCase()\n if (['true', 'yes', 'y', '1'].includes(text)) return true\n if (['false', 'no', 'n', '0'].includes(text)) return false\n return undefined\n}\n\n/**\n * The rows as the target reads them - each value in its field's type, and what was wrong said as an issue.\n *\n * A value that does not fit is **kept as it was written and marked**, never dropped or guessed: the card\n * shows what the material said, and the person corrects it in the conversation.\n */\nexport function normalizeEntryRows(target: EntryTarget, input: unknown): { rows: EntryRow[]; cut: number } {\n const list = Array.isArray(input) ? input : []\n const max = target.maxRows ?? DEFAULT_MAX_ROWS\n const fields = new Map(target.fields.map(field => [field.name, field]))\n\n const rows = list.slice(0, max).map((raw: any, index): EntryRow => {\n const given = raw && typeof raw.values === 'object' && raw.values ? raw.values : {}\n const values: Record<string, unknown> = {}\n const issues: EntryIssue[] = []\n\n for (const name of Object.keys(given)) {\n if (!fields.has(name)) issues.push({ field: name, code: 'unknown-field', blocking: false })\n }\n\n for (const field of target.fields) {\n const value = given[field.name]\n if (empty(value)) {\n if (field.required) issues.push({ field: field.name, code: 'required', blocking: true })\n continue\n }\n let read: unknown\n let code = ''\n switch (field.type) {\n case 'number':\n read = toNumber(value)\n code = 'not-a-number'\n break\n case 'integer':\n read = toNumber(value)\n if (read !== undefined && !Number.isInteger(read)) read = undefined\n code = 'not-an-integer'\n break\n case 'date':\n read = toDate(value)\n code = 'not-a-date'\n break\n case 'boolean':\n read = toBoolean(value)\n code = 'not-a-boolean'\n break\n case 'enum':\n read = field.values!.includes(String(value).trim()) ? String(value).trim() : undefined\n code = 'not-in-list'\n break\n default:\n read = String(value).trim()\n }\n if (read === undefined) {\n values[field.name] = value\n issues.push({ field: field.name, code, params: code === 'not-in-list' ? { values: field.values } : undefined, blocking: true })\n } else {\n values[field.name] = read\n }\n }\n\n const sources: EntrySource[] = Array.isArray(raw?.sources)\n ? raw.sources\n .filter((one: any) => one && (one.attachmentId || one.where))\n .map((one: any) => ({\n ...(typeof one.attachmentId === 'string' ? { attachmentId: one.attachmentId } : {}),\n ...(typeof one.where === 'string' ? { where: one.where.slice(0, 120) } : {})\n }))\n : []\n if (!sources.length) issues.push({ code: 'no-source', blocking: false })\n\n return { index, values, sources, issues }\n })\n\n return { rows, cut: Math.max(0, list.length - max) }\n}\n\n/** Adds the target's own findings to each row. A check that throws marks nothing and is reported by the caller. */\nexport function withCheckedIssues(rows: EntryRow[], found: EntryIssue[][] | undefined): EntryRow[] {\n if (!found) return rows\n return rows.map((row, i) => (found[i]?.length ? { ...row, issues: [...row.issues, ...found[i]] } : row))\n}\n\nexport function isBlocked(row: EntryRow): boolean {\n return row.issues.some(issue => issue.blocking)\n}\n\n/* ── Checking the rows against the material (design/ai/data-entry.md §4-1) ─────────────────────────────\n *\n * A row cites where it came from; the model's word is not proof. For a text source the server looks: the\n * row's numbers and dates must stand together on one line of the cited file. Found - the row carries that\n * line as evidence. A value the file does not have is marked, unless the row also cites the person's\n * message (a correction said in the conversation). A photo cannot be read here - the row says so.\n * Names and descriptions are not looked for: the model tidies them, and a tidied name is not a wrong one.\n */\n\nconst PERSON = /person|message|user|사용자|말/i\n\n/** The ways a number or a date is written in a file. */\nexport function writtenForms(type: EntryFieldType, value: unknown): string[] {\n if (type === 'number' || type === 'integer') {\n if (typeof value !== 'number' || !Number.isFinite(value)) return []\n const negative = value < 0\n const abs = Math.abs(value)\n const fixed = Number.isInteger(abs) ? String(abs) : abs.toFixed(2).replace(/0+$/, '').replace(/\\.$/, '')\n const [int, frac] = fixed.split('.')\n const grouped = int.replace(/\\B(?=(\\d{3})+(?!\\d))/g, ',')\n const forms = new Set<string>()\n for (const whole of [int, grouped]) {\n forms.add(frac ? `${whole}.${frac}` : whole)\n if (!frac) forms.add(`${whole}.00`)\n }\n return [...forms].map(form => (negative ? `-${form}` : form))\n }\n if (type === 'date') {\n const match = typeof value === 'string' ? value.match(/^(\\d{4})-(\\d{2})-(\\d{2})$/) : null\n if (!match) return []\n const [, y, m, d] = match\n const mm = String(Number(m))\n const dd = String(Number(d))\n return [`${y}-${m}-${d}`, `${y}.${m}.${d}`, `${y}/${m}/${d}`, `${y}${m}${d}`, `${y}.${mm}.${dd}`, `${y}/${mm}/${dd}`, `${y}-${mm}-${dd}`, `${y.slice(2)}.${m}.${d}`, `${y.slice(2)}/${m}/${d}`]\n }\n return []\n}\n\n/**\n * A form found as a whole number - \"12,400\" is not found in \"112,400\", \"12,4001\", \"12,400.50\" or \"12,400,000\";\n * \"2026-09-12\" not in \"2026-09-120\". A CSV's own commas are not part of the number.\n */\nexport function lineHas(line: string, forms: string[]): boolean {\n const digit = (c: string | undefined) => !!c && c >= '0' && c <= '9'\n return forms.some(form => {\n for (let at = line.indexOf(form); at >= 0; at = line.indexOf(form, at + 1)) {\n const before = line[at - 1]\n const after = line[at + form.length]\n /* A comma is also the column separator of a CSV: only a comma and three digits more continue the number. */\n if (digit(before) || (before === '.' && digit(line[at - 2]))) continue\n if (digit(after) || (after === '.' && digit(line[at + form.length + 1]))) continue\n if (after === ',' && /^,\\d{3}(?!\\d)/.test(line.slice(at + form.length))) continue\n return true\n }\n return false\n })\n}\n\n/**\n * Checks each row against the text of the files it cites. `texts` holds what could be read, by attachment id;\n * an id that is not there was an image, or could not be opened.\n */\nexport function verifyRowsAgainstSources(rows: EntryRow[], fields: EntryField[], texts: Map<string, string>): EntryRow[] {\n const checked = fields.filter(field => ['number', 'integer', 'date'].includes(field.type))\n return rows.map(row => {\n const files = row.sources.map(source => source.attachmentId).filter((id): id is string => !!id)\n if (!files.length || !checked.length) return row\n const readable = files.filter(id => texts.has(id))\n if (!readable.length) return { ...row, issues: [...row.issues, { code: 'source-not-checked', blocking: false }] }\n\n const forms = checked\n .map(field => ({ field, forms: writtenForms(field.type, row.values[field.name]) }))\n .filter(one => one.forms.length)\n if (!forms.length) return row\n\n for (const id of readable) {\n const lines = texts.get(id)!.split(/\\r?\\n/)\n const at = lines.findIndex(line => forms.every(one => lineHas(line, one.forms)))\n if (at >= 0) return { ...row, evidence: { attachmentId: id, line: at + 1 } }\n }\n\n const saidByPerson = row.sources.some(source => !source.attachmentId && PERSON.test(source.where ?? ''))\n const issues = [...row.issues]\n for (const one of forms) {\n const anywhere = readable.some(id => texts.get(id)!.split(/\\r?\\n/).some(line => lineHas(line, one.forms)))\n if (!anywhere && !saidByPerson) issues.push({ field: one.field.name, code: 'not-in-source', blocking: false })\n }\n if (issues.length === row.issues.length) issues.push({ code: 'source-scattered', blocking: false })\n return { ...row, issues }\n })\n}\n\nexport interface EntryTotal {\n field: string\n /** The sum over every row, and over the rows that will be entered. */\n all: number\n ready: number\n /** The total the material prints, as the model read it - and whether the server found it in the file. */\n declared?: number\n declaredFound?: boolean\n /** declared - all. */\n difference?: number\n}\n\n/** The sums of the fields declared `total`, and how they stand against the total the material prints. */\nexport function entryTotals(\n rows: EntryRow[],\n fields: EntryField[],\n declared: { field?: string; value?: unknown; attachmentId?: string } | undefined,\n texts: Map<string, string>\n): EntryTotal[] {\n return fields\n .filter(field => field.total && (field.type === 'number' || field.type === 'integer'))\n .map(field => {\n const sum = (list: EntryRow[]) => Math.round(list.reduce((acc, row) => acc + (typeof row.values[field.name] === 'number' ? (row.values[field.name] as number) : 0), 0) * 100) / 100\n const total: EntryTotal = { field: field.name, all: sum(rows), ready: sum(rows.filter(row => !isBlocked(row))) }\n const value = declared && (declared.field ?? field.name) === field.name ? toNumber(declared.value) : undefined\n if (value !== undefined) {\n total.declared = value\n total.difference = Math.round((value - total.all) * 100) / 100\n const text = declared!.attachmentId ? texts.get(declared!.attachmentId) : undefined\n if (text !== undefined) total.declaredFound = text.split(/\\r?\\n/).some(line => lineHas(line, writtenForms(field.type, value)))\n }\n return total\n })\n}\n\n"]}
@@ -0,0 +1,43 @@
1
+ import { type ToolCategory } from '@things-factory/ai-client-base';
2
+ import { type EntryRow, type EntryTarget } from './entry-target.js';
3
+ export type SourceTextLoader = (attachmentIds: string[], context: any) => Promise<Map<string, string>>;
4
+ export declare function proposeEntries(target: EntryTarget, args: any, context: any, loadTexts?: SourceTextLoader): Promise<{
5
+ rejected: boolean;
6
+ error: string;
7
+ message: string;
8
+ } | {
9
+ message: string;
10
+ checkFailed?: string;
11
+ reason?: any;
12
+ totals?: import("./entry-target.js").EntryTotal[];
13
+ proposed: boolean;
14
+ kind: string;
15
+ target: string;
16
+ labelKey: string;
17
+ label: string;
18
+ icon: string;
19
+ columns: {
20
+ labelKey?: string;
21
+ name: string;
22
+ type: import("./entry-target.js").EntryFieldType;
23
+ required: boolean;
24
+ }[];
25
+ rows: EntryRow[];
26
+ counts: {
27
+ rows: number;
28
+ ready: number;
29
+ blocked: number;
30
+ cut: number;
31
+ verified: number;
32
+ unmatched: number;
33
+ };
34
+ rejected?: undefined;
35
+ error?: undefined;
36
+ }>;
37
+ export declare function entryCategoryOf(target: EntryTarget): ToolCategory;
38
+ /**
39
+ * What an application calls at boot to let the assistant enter one of its records.
40
+ *
41
+ * A mode opens it by naming the key in `entryTargets` (the tool is not in every conversation of the app).
42
+ */
43
+ export declare function registerEntryTarget(target: EntryTarget): void;
@@ -0,0 +1,185 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.proposeEntries = proposeEntries;
37
+ exports.entryCategoryOf = entryCategoryOf;
38
+ exports.registerEntryTarget = registerEntryTarget;
39
+ /*
40
+ * The propose tool of each entry target (operato-application/design/ai/data-entry.md §3).
41
+ *
42
+ * One tool per target, so each carries its own door: the tool is offered only to a person who could enter
43
+ * those records by hand, and its card cannot be made for someone who could not press it.
44
+ *
45
+ * The tool writes nothing. It reads the rows the model made from the material, puts each value in its
46
+ * field's type, asks the target's own checks, and hands back a proposal - the card.
47
+ */
48
+ const ai_client_base_1 = require("@things-factory/ai-client-base");
49
+ const entry_target_js_1 = require("./entry-target.js");
50
+ function fieldSchema(field) {
51
+ const type = field.type === 'number' || field.type === 'integer' ? ['number', 'string'] : field.type === 'boolean' ? ['boolean', 'string'] : 'string';
52
+ const said = [
53
+ field.description,
54
+ field.required ? 'required' : 'optional',
55
+ field.type === 'date' ? 'YYYY-MM-DD' : undefined,
56
+ field.type === 'enum' ? `one of: ${field.values.join(', ')}` : undefined
57
+ ]
58
+ .filter(Boolean)
59
+ .join('. ');
60
+ return { type, description: said };
61
+ }
62
+ /** What the card needs besides the rows - the columns, in the target's order. */
63
+ function columnsOf(target) {
64
+ return target.fields.map(field => ({ name: field.name, type: field.type, required: !!field.required, ...(field.labelKey ? { labelKey: field.labelKey } : {}) }));
65
+ }
66
+ const readSources = async (ids, context) => (await Promise.resolve().then(() => __importStar(require('./entry-sources.js')))).loadSourceTexts(ids, context);
67
+ async function proposeEntries(target, args, context, loadTexts = readSources) {
68
+ const tool = (0, entry_target_js_1.entryToolName)(target.key);
69
+ const told = (event) => (0, entry_target_js_1.recordEntryEvent)(target, { phase: 'propose', tool, ...event }, { state: context?.state });
70
+ const { rows: normalized, cut } = (0, entry_target_js_1.normalizeEntryRows)(target, args?.rows);
71
+ if (!normalized.length) {
72
+ await told({ rows: 0, ok: false, error: 'no-rows', detail: args });
73
+ return { rejected: true, error: 'no-rows', message: 'no rows were given. Read the material and pass every record as a row.' };
74
+ }
75
+ /* The server looks in the cited files itself - the model's citation is not proof (design/ai/data-entry.md §4-1). */
76
+ const declared = args?.declaredTotal && typeof args.declaredTotal === 'object' ? args.declaredTotal : undefined;
77
+ const cited = [...normalized.flatMap(row => row.sources.map(source => source.attachmentId)), declared?.attachmentId].filter((id) => typeof id === 'string' && !!id);
78
+ const texts = cited.length ? await loadTexts(cited, context).catch(() => new Map()) : new Map();
79
+ const read = (0, entry_target_js_1.verifyRowsAgainstSources)(normalized, target.fields, texts);
80
+ let rows = read;
81
+ let checkFailed;
82
+ if (target.check) {
83
+ try {
84
+ rows = (0, entry_target_js_1.withCheckedIssues)(read, await target.check(read, { state: context?.state }));
85
+ }
86
+ catch (error) {
87
+ checkFailed = error?.message || 'check-failed';
88
+ }
89
+ }
90
+ const blocked = rows.filter(entry_target_js_1.isBlocked).length;
91
+ const totals = (0, entry_target_js_1.entryTotals)(rows, target.fields, declared, texts);
92
+ const verified = rows.filter(row => row.evidence).length;
93
+ const unmatched = rows.filter(row => row.issues.some(issue => issue.code === 'not-in-source')).length;
94
+ await told({ rows: rows.length, ok: true, detail: args });
95
+ return {
96
+ proposed: true,
97
+ kind: 'entry',
98
+ target: target.key,
99
+ labelKey: target.labelKey,
100
+ label: `${rows.length} ${target.key} rows`,
101
+ icon: 'playlist_add',
102
+ columns: columnsOf(target),
103
+ rows,
104
+ counts: { rows: rows.length, ready: rows.length - blocked, blocked, cut, verified, unmatched },
105
+ ...(totals.length ? { totals } : {}),
106
+ ...(typeof args?.note === 'string' && args.note.trim() ? { reason: args.note.trim().slice(0, 300) } : {}),
107
+ ...(checkFailed ? { checkFailed } : {}),
108
+ /* For the model - the card is the answer; it says what the person must still decide. */
109
+ message: `proposed ${rows.length} rows (${rows.length - blocked} ready, ${blocked} blocked${cut ? `, ${cut} cut over the limit` : ''}; ` +
110
+ `${verified} found line by line in their files, ${unmatched} with a value the file does not have). ` +
111
+ totals.filter(total => total.difference).map(total => `${total.field}: the material's total differs from the rows by ${total.difference}. `).join('') +
112
+ 'nothing is written until the person presses the button on the card. Tell them which rows are blocked or do not match their file, and why, and ask for what is missing.'
113
+ };
114
+ }
115
+ function entryCategoryOf(target) {
116
+ const name = (0, entry_target_js_1.entryToolName)(target.key);
117
+ const spec = {
118
+ kind: 'read',
119
+ name,
120
+ /* The person must be able to enter these records themselves - the tool is not a second way in. */
121
+ doors: [(0, entry_target_js_1.entryDoorOf)(target.mutation)],
122
+ description: `Propose records to enter: ${target.description} ` +
123
+ 'Pass every record found in the material as one row. The rows are shown to the person as a card; nothing is written until they press it.',
124
+ schema: {
125
+ type: 'object',
126
+ properties: {
127
+ rows: {
128
+ type: 'array',
129
+ description: `At most ${target.maxRows ?? 200} rows.`,
130
+ items: {
131
+ type: 'object',
132
+ properties: {
133
+ values: {
134
+ type: 'object',
135
+ properties: Object.fromEntries(target.fields.map(field => [field.name, fieldSchema(field)]))
136
+ },
137
+ sources: {
138
+ type: 'array',
139
+ description: 'Where this row came from: the attachment id and where in it ("row 3", "the receipt photo"), or where: "the person\'s message".',
140
+ items: { type: 'object', properties: { attachmentId: { type: 'string' }, where: { type: 'string' } } }
141
+ }
142
+ },
143
+ required: ['values', 'sources']
144
+ }
145
+ },
146
+ note: { type: 'string', description: 'One line for the card - what this set is ("September card statement").' },
147
+ declaredTotal: {
148
+ type: 'object',
149
+ description: 'The total the material itself prints, when it prints one - the card compares it with the sum of the rows. Never compute it yourself.',
150
+ properties: {
151
+ field: { type: 'string', description: `Which field it totals${target.fields.filter(field => field.total).length ? ` (${target.fields.filter(field => field.total).map(field => field.name).join(', ')})` : ''}.` },
152
+ value: { type: ['number', 'string'] },
153
+ attachmentId: { type: 'string' },
154
+ where: { type: 'string' }
155
+ }
156
+ }
157
+ },
158
+ required: ['rows']
159
+ },
160
+ builder: (args, context) => proposeEntries(target, args, context)
161
+ };
162
+ return {
163
+ name: (0, entry_target_js_1.entryCategoryName)(target.key),
164
+ description: `data entry: ${target.key}`,
165
+ guidance: [
166
+ `- When the person gives material to enter as records (files, photos, pasted text), read all of it first - call readChatAttachment for a file sent in an earlier turn - then call ${name} once with every record as a row.`,
167
+ '- Never invent a value. Leave a field out when the material does not say it; the card marks it, and you ask the person for it.',
168
+ '- Give each row its sources: which attachment and where in it. A value the person gave or corrected in the conversation adds the source where: "the person\'s message". The server looks for each row\'s numbers and dates in the cited file and marks what it does not find.',
169
+ '- When the material prints a total, pass it as declaredTotal exactly as printed - do not add it up yourself.',
170
+ `- ${name} only proposes. Nothing is entered until the person presses the button on the card - never say the records were entered.`,
171
+ `- When the person corrects or drops rows, call ${name} again with the whole corrected set. The newest card replaces the earlier ones; an earlier card can no longer be entered.`
172
+ ].join('\n'),
173
+ specs: [spec]
174
+ };
175
+ }
176
+ /**
177
+ * What an application calls at boot to let the assistant enter one of its records.
178
+ *
179
+ * A mode opens it by naming the key in `entryTargets` (the tool is not in every conversation of the app).
180
+ */
181
+ function registerEntryTarget(target) {
182
+ (0, entry_target_js_1.declareEntryTarget)(target);
183
+ (0, ai_client_base_1.registerToolCategory)(entryCategoryOf(target));
184
+ }
185
+ //# sourceMappingURL=entry-tools.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"entry-tools.js","sourceRoot":"","sources":["../../../server/service/data-entry/entry-tools.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiDA,wCAkDC;AAED,0CA8DC;AAOD,kDAGC;AA7KD;;;;;;;;GAQG;AACH,mEAAuG;AAEvG,uDAc0B;AAE1B,SAAS,WAAW,CAAC,KAAiB;IACpC,MAAM,IAAI,GAAG,KAAK,CAAC,IAAI,KAAK,QAAQ,IAAI,KAAK,CAAC,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAA;IACrJ,MAAM,IAAI,GAAG;QACX,KAAK,CAAC,WAAW;QACjB,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,UAAU;QACxC,KAAK,CAAC,IAAI,KAAK,MAAM,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,SAAS;QAChD,KAAK,CAAC,IAAI,KAAK,MAAM,CAAC,CAAC,CAAC,WAAW,KAAK,CAAC,MAAO,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC,SAAS;KAC1E;SACE,MAAM,CAAC,OAAO,CAAC;SACf,IAAI,CAAC,IAAI,CAAC,CAAA;IACb,OAAO,EAAE,IAAI,EAAE,WAAW,EAAE,IAAI,EAAE,CAAA;AACpC,CAAC;AAED,iFAAiF;AACjF,SAAS,S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GAAG,EAAE;wBAClN,KAAK,EAAE,EAAE,IAAI,EAAE,CAAC,QAAQ,EAAE,QAAQ,CAAC,EAAE;wBACrC,YAAY,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;wBAChC,KAAK,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;qBAC1B;iBACF;aACF;YACD,QAAQ,EAAE,CAAC,MAAM,CAAC;SACnB;QACD,OAAO,EAAE,CAAC,IAAS,EAAE,OAAY,EAAE,EAAE,CAAC,cAAc,CAAC,MAAM,EAAE,IAAI,EAAE,OAAO,CAAC;KAChE,CAAA;IAEb,OAAO;QACL,IAAI,EAAE,IAAA,mCAAiB,EAAC,MAAM,CAAC,GAAG,CAAC;QACnC,WAAW,EAAE,eAAe,MAAM,CAAC,GAAG,EAAE;QACxC,QAAQ,EAAE;YACR,oLAAoL,IAAI,mCAAmC;YAC3N,gIAAgI;YAChI,+QAA+Q;YAC/Q,8GAA8G;YAC9G,KAAK,IAAI,0HAA0H;YACnI,kDAAkD,IAAI,2HAA2H;SAClL,CAAC,IAAI,CAAC,IAAI,CAAC;QACZ,KAAK,EAAE,CAAC,IAAI,CAAC;KACd,CAAA;AACH,CAAC;AAED;;;;GAIG;AACH,SAAgB,mBAAmB,CAAC,MAAmB;IACrD,IAAA,oCAAkB,EAAC,MAAM,CAAC,CAAA;IAC1B,IAAA,qCAAoB,EAAC,eAAe,CAAC,MAAM,CAAC,CAAC,CAAA;AAC/C,CAAC","sourcesContent":["/*\n * The propose tool of each entry target (operato-application/design/ai/data-entry.md §3).\n *\n * One tool per target, so each carries its own door: the tool is offered only to a person who could enter\n * those records by hand, and its card cannot be made for someone who could not press it.\n *\n * The tool writes nothing. It reads the rows the model made from the material, puts each value in its\n * field's type, asks the target's own checks, and hands back a proposal - the card.\n */\nimport { registerToolCategory, type ToolCategory, type ToolSpec } from '@things-factory/ai-client-base'\n\nimport {\n declareEntryTarget,\n entryTotals,\n verifyRowsAgainstSources,\n entryCategoryName,\n entryDoorOf,\n entryToolName,\n isBlocked,\n normalizeEntryRows,\n recordEntryEvent,\n withCheckedIssues,\n type EntryField,\n type EntryRow,\n type EntryTarget\n} from './entry-target.js'\n\nfunction fieldSchema(field: EntryField): any {\n const type = field.type === 'number' || field.type === 'integer' ? ['number', 'string'] : field.type === 'boolean' ? ['boolean', 'string'] : 'string'\n const said = [\n field.description,\n field.required ? 'required' : 'optional',\n field.type === 'date' ? 'YYYY-MM-DD' : undefined,\n field.type === 'enum' ? `one of: ${field.values!.join(', ')}` : undefined\n ]\n .filter(Boolean)\n .join('. ')\n return { type, description: said }\n}\n\n/** What the card needs besides the rows - the columns, in the target's order. */\nfunction columnsOf(target: EntryTarget) {\n return target.fields.map(field => ({ name: field.name, type: field.type, required: !!field.required, ...(field.labelKey ? { labelKey: field.labelKey } : {}) }))\n}\n\nexport type SourceTextLoader = (attachmentIds: string[], context: any) => Promise<Map<string, string>>\n\nconst readSources: SourceTextLoader = async (ids, context) => (await import('./entry-sources.js')).loadSourceTexts(ids, context)\n\nexport async function proposeEntries(target: EntryTarget, args: any, context: any, loadTexts: SourceTextLoader = readSources) {\n const tool = entryToolName(target.key)\n const told = (event: Omit<Parameters<typeof recordEntryEvent>[1], 'phase' | 'tool'>) => recordEntryEvent(target, { phase: 'propose', tool, ...event }, { state: context?.state })\n const { rows: normalized, cut } = normalizeEntryRows(target, args?.rows)\n if (!normalized.length) {\n await told({ rows: 0, ok: false, error: 'no-rows', detail: args })\n return { rejected: true, error: 'no-rows', message: 'no rows were given. Read the material and pass every record as a row.' }\n }\n\n /* The server looks in the cited files itself - the model's citation is not proof (design/ai/data-entry.md §4-1). */\n const declared = args?.declaredTotal && typeof args.declaredTotal === 'object' ? args.declaredTotal : undefined\n const cited = [...normalized.flatMap(row => row.sources.map(source => source.attachmentId)), declared?.attachmentId].filter((id): id is string => typeof id === 'string' && !!id)\n const texts = cited.length ? await loadTexts(cited, context).catch(() => new Map<string, string>()) : new Map<string, string>()\n const read = verifyRowsAgainstSources(normalized, target.fields, texts)\n\n let rows: EntryRow[] = read\n let checkFailed: string | undefined\n if (target.check) {\n try {\n rows = withCheckedIssues(read, await target.check(read, { state: context?.state }))\n } catch (error: any) {\n checkFailed = error?.message || 'check-failed'\n }\n }\n\n const blocked = rows.filter(isBlocked).length\n const totals = entryTotals(rows, target.fields, declared, texts)\n const verified = rows.filter(row => row.evidence).length\n const unmatched = rows.filter(row => row.issues.some(issue => issue.code === 'not-in-source')).length\n await told({ rows: rows.length, ok: true, detail: args })\n return {\n proposed: true,\n kind: 'entry',\n target: target.key,\n labelKey: target.labelKey,\n label: `${rows.length} ${target.key} rows`,\n icon: 'playlist_add',\n columns: columnsOf(target),\n rows,\n counts: { rows: rows.length, ready: rows.length - blocked, blocked, cut, verified, unmatched },\n ...(totals.length ? { totals } : {}),\n ...(typeof args?.note === 'string' && args.note.trim() ? { reason: args.note.trim().slice(0, 300) } : {}),\n ...(checkFailed ? { checkFailed } : {}),\n /* For the model - the card is the answer; it says what the person must still decide. */\n message:\n `proposed ${rows.length} rows (${rows.length - blocked} ready, ${blocked} blocked${cut ? `, ${cut} cut over the limit` : ''}; ` +\n `${verified} found line by line in their files, ${unmatched} with a value the file does not have). ` +\n totals.filter(total => total.difference).map(total => `${total.field}: the material's total differs from the rows by ${total.difference}. `).join('') +\n 'nothing is written until the person presses the button on the card. Tell them which rows are blocked or do not match their file, and why, and ask for what is missing.'\n }\n}\n\nexport function entryCategoryOf(target: EntryTarget): ToolCategory {\n const name = entryToolName(target.key)\n const spec = {\n kind: 'read',\n name,\n /* The person must be able to enter these records themselves - the tool is not a second way in. */\n doors: [entryDoorOf(target.mutation)],\n description:\n `Propose records to enter: ${target.description} ` +\n 'Pass every record found in the material as one row. The rows are shown to the person as a card; nothing is written until they press it.',\n schema: {\n type: 'object',\n properties: {\n rows: {\n type: 'array',\n description: `At most ${target.maxRows ?? 200} rows.`,\n items: {\n type: 'object',\n properties: {\n values: {\n type: 'object',\n properties: Object.fromEntries(target.fields.map(field => [field.name, fieldSchema(field)]))\n },\n sources: {\n type: 'array',\n description: 'Where this row came from: the attachment id and where in it (\"row 3\", \"the receipt photo\"), or where: \"the person\\'s message\".',\n items: { type: 'object', properties: { attachmentId: { type: 'string' }, where: { type: 'string' } } }\n }\n },\n required: ['values', 'sources']\n }\n },\n note: { type: 'string', description: 'One line for the card - what this set is (\"September card statement\").' },\n declaredTotal: {\n type: 'object',\n description: 'The total the material itself prints, when it prints one - the card compares it with the sum of the rows. Never compute it yourself.',\n properties: {\n field: { type: 'string', description: `Which field it totals${target.fields.filter(field => field.total).length ? ` (${target.fields.filter(field => field.total).map(field => field.name).join(', ')})` : ''}.` },\n value: { type: ['number', 'string'] },\n attachmentId: { type: 'string' },\n where: { type: 'string' }\n }\n }\n },\n required: ['rows']\n },\n builder: (args: any, context: any) => proposeEntries(target, args, context)\n } as ToolSpec\n\n return {\n name: entryCategoryName(target.key),\n description: `data entry: ${target.key}`,\n guidance: [\n `- When the person gives material to enter as records (files, photos, pasted text), read all of it first - call readChatAttachment for a file sent in an earlier turn - then call ${name} once with every record as a row.`,\n '- Never invent a value. Leave a field out when the material does not say it; the card marks it, and you ask the person for it.',\n '- Give each row its sources: which attachment and where in it. A value the person gave or corrected in the conversation adds the source where: \"the person\\'s message\". The server looks for each row\\'s numbers and dates in the cited file and marks what it does not find.',\n '- When the material prints a total, pass it as declaredTotal exactly as printed - do not add it up yourself.',\n `- ${name} only proposes. Nothing is entered until the person presses the button on the card - never say the records were entered.`,\n `- When the person corrects or drops rows, call ${name} again with the whole corrected set. The newest card replaces the earlier ones; an earlier card can no longer be entered.`\n ].join('\\n'),\n specs: [spec]\n }\n}\n\n/**\n * What an application calls at boot to let the assistant enter one of its records.\n *\n * A mode opens it by naming the key in `entryTargets` (the tool is not in every conversation of the app).\n */\nexport function registerEntryTarget(target: EntryTarget): void {\n declareEntryTarget(target)\n registerToolCategory(entryCategoryOf(target))\n}\n"]}
@@ -7,6 +7,7 @@ import { ChatMessageSubscription } from './chat-message/chat-message-subscriptio
7
7
  import './chat-session/attachment-tools.js';
8
8
  import './chat-session/session-purge.js';
9
9
  import './chat-session/attachment-route.js';
10
+ import { EntryProposalResolver } from './data-entry/entry-resolver.js';
10
11
  export * from './types.js';
11
12
  export * from './chat-session-resolver.js';
12
13
  export * from './assistant-chat-resolver.js';
@@ -14,6 +15,8 @@ export * from './assistant-mode/index.js';
14
15
  export { requestTranslator } from './request-translator.js';
15
16
  export * from './assistant-capability-resolver.js';
16
17
  export * from './tool-access.js';
18
+ export * from './data-entry/entry-target.js';
19
+ export { registerEntryTarget, entryCategoryOf } from './data-entry/entry-tools.js';
17
20
  export * from './grounding-sources.js';
18
21
  export * from './chat-session/session-anchor.js';
19
22
  export * from './chat-session/session-visibility.js';
@@ -36,5 +39,5 @@ export * from './chat-message/index.js';
36
39
  export * from './chat-session-participant/index.js';
37
40
  export declare const entities: (typeof import("./chat-message/chat-message.js").ChatMessage | typeof import("./chat-session/chat-session.js").ChatSession | typeof import("./chat-session-participant/chat-session-participant.js").ChatSessionParticipant)[];
38
41
  export declare const schema: {
39
- resolverClasses: (typeof ChatSessionResolver | typeof AssistantChatResolver | typeof AssistantModeResolver | typeof AssistantCapabilityResolver | typeof MySessionActivitySubscription | typeof ChatMessageSubscription)[];
42
+ resolverClasses: (typeof ChatSessionResolver | typeof AssistantChatResolver | typeof AssistantModeResolver | typeof AssistantCapabilityResolver | typeof MySessionActivitySubscription | typeof ChatMessageSubscription | typeof EntryProposalResolver)[];
40
43
  };
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.schema = exports.entities = exports.requestTranslator = void 0;
3
+ exports.schema = exports.entities = exports.entryCategoryOf = exports.registerEntryTarget = exports.requestTranslator = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  const chat_session_resolver_js_1 = require("./chat-session-resolver.js");
6
6
  const assistant_chat_resolver_js_1 = require("./assistant-chat-resolver.js");
@@ -14,6 +14,7 @@ const index_js_3 = require("./chat-session-participant/index.js");
14
14
  require("./chat-session/attachment-tools.js");
15
15
  require("./chat-session/session-purge.js");
16
16
  require("./chat-session/attachment-route.js");
17
+ const entry_resolver_js_1 = require("./data-entry/entry-resolver.js");
17
18
  tslib_1.__exportStar(require("./types.js"), exports);
18
19
  tslib_1.__exportStar(require("./chat-session-resolver.js"), exports);
19
20
  tslib_1.__exportStar(require("./assistant-chat-resolver.js"), exports);
@@ -27,6 +28,11 @@ tslib_1.__exportStar(require("./assistant-capability-resolver.js"), exports);
27
28
  * 실린다. 시험은 경로로 가져온다: `…/service/testing/conversation-script.js`.
28
29
  */
29
30
  tslib_1.__exportStar(require("./tool-access.js"), exports);
31
+ /* Data entry from material - an app registers what it can enter; a mode names it (design/ai/data-entry.md). */
32
+ tslib_1.__exportStar(require("./data-entry/entry-target.js"), exports);
33
+ var entry_tools_js_1 = require("./data-entry/entry-tools.js");
34
+ Object.defineProperty(exports, "registerEntryTarget", { enumerable: true, get: function () { return entry_tools_js_1.registerEntryTarget; } });
35
+ Object.defineProperty(exports, "entryCategoryOf", { enumerable: true, get: function () { return entry_tools_js_1.entryCategoryOf; } });
30
36
  /* 무엇이 근거인가 — 도구 결과 밖의 셋(프롬프트 · 대화 · 화면 스냅숏). */
31
37
  tslib_1.__exportStar(require("./grounding-sources.js"), exports);
32
38
  /* 앵커 순수 로직 — 호스트가 앵커 종류를 참조한다(리졸버는 데코레이터 때문에 무겁다). */
@@ -65,7 +71,9 @@ exports.schema = {
65
71
  assistant_capability_resolver_js_1.AssistantCapabilityResolver,
66
72
  chat_message_subscription_js_1.ChatMessageSubscription,
67
73
  /* 내가 참여한 모든 세션의 활동 — 창을 닫아 둔 표면이 배지·목록을 갱신할 수 있게. */
68
- session_activity_subscription_js_1.MySessionActivitySubscription
74
+ session_activity_subscription_js_1.MySessionActivitySubscription,
75
+ /* 사람이 누른 입력 제안을 쓰는 자리 — 행마다 앱의 코드로, 그 사람의 권한으로. */
76
+ entry_resolver_js_1.EntryProposalResolver
69
77
  ]
70
78
  };
71
79
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../server/service/index.ts"],"names":[],"mappings":";;;;AAAA,yEAAgE;AAChE,6EAAoE;AACpE,4FAAmF;AACnF,yFAAgF;AAChF,sGAA+F;AAC/F,8FAAqF;AACrF,sDAAyE;AACzE,sDAAyE;AACzE,kEAAgG;AAChG,8CAA2C;AAC3C,2CAAwC;AACxC,8CAA2C;AAE3C,qDAA0B;AAC1B,qEAA0C;AAC1C,uEAA4C;AAC5C,oGAAoG;AACpG,oEAAyC;AACzC,iEAA2D;AAAlD,0HAAA,iBAAiB,OAAA;AAC1B,6EAAkD;AAClD;;;GAGG;AACH,2DAAgC;AAChC,gDAAgD;AAChD,iEAAsC;AACtC,sDAAsD;AACtD,2EAAgD;AAChD,gHAAgH;AAChH,+EAAoD;AACpD,kEAAuC;AACvC,8DAA8D;AAC9D,0EAA+C;AAC/C,8EAAmD;AACnD,0EAA+C;AAC/C,qFAA0D;AAC1D,uFAA4D;AAC5D,wEAA6C;AAC7C,4EAAiD;AACjD,yEAA8C;AAC9C,wDAAwD;AACxD,iFAAsD;AACtD,iFAAsD;AACtD,mFAAwD;AACxD,4FAAiE;AACjE,2DAA2D;AAC3D,uFAA4D;AAC5D,iFAAsD;AACtD,kEAAuC;AACvC,8EAAmD;AAEtC,QAAA,QAAQ,GAAG,CAAC,GAAG,mBAAmB,EAAE,GAAG,mBAAmB,EAAE,GAAG,mBAA8B,CAAC,CAAA;AAE9F,QAAA,MAAM,GAAG;IACpB,eAAe,EAAE;QACf,8CAAmB;QACnB,sDAAsD;QACtD,kDAAqB;QACrB,uDAAuD;QACvD,kDAAqB;QACrB,wDAAwD;QACxD,8DAA2B;QAC3B,sDAAuB;QACvB,qDAAqD;QACrD,gEAA6B;KAC9B;CACF,CAAA","sourcesContent":["import { ChatSessionResolver } from './chat-session-resolver.js'\nimport { AssistantChatResolver } from './assistant-chat-resolver.js'\nimport { AssistantModeResolver } from './assistant-mode/assistant-mode-resolver.js'\nimport { AssistantCapabilityResolver } from './assistant-capability-resolver.js'\nimport { MySessionActivitySubscription } from './chat-session/session-activity-subscription.js'\nimport { ChatMessageSubscription } from './chat-message/chat-message-subscription.js'\nimport { entities as ChatSessionEntities } from './chat-session/index.js'\nimport { entities as ChatMessageEntities } from './chat-message/index.js'\nimport { entities as ChatSessionParticipantEntities } from './chat-session-participant/index.js'\nimport './chat-session/attachment-tools.js'\nimport './chat-session/session-purge.js'\nimport './chat-session/attachment-route.js'\n\nexport * from './types.js'\nexport * from './chat-session-resolver.js'\nexport * from './assistant-chat-resolver.js'\n/* The mode registry — each app server declares what its conversations are (ADR-0061 decision 7). */\nexport * from './assistant-mode/index.js'\nexport { requestTranslator } from './request-translator.js'\nexport * from './assistant-capability-resolver.js'\n/*\n * 대화 각본 하네스는 **런타임 export 에서 뺀다**(ADR-0070 A15 결정 ④) — 시험 도구가 서버 번들에\n * 실린다. 시험은 경로로 가져온다: `…/service/testing/conversation-script.js`.\n */\nexport * from './tool-access.js'\n/* 무엇이 근거인가 — 도구 결과 밖의 셋(프롬프트 · 대화 · 화면 스냅숏). */\nexport * from './grounding-sources.js'\n/* 앵커 순수 로직 — 호스트가 앵커 종류를 참조한다(리졸버는 데코레이터 때문에 무겁다). */\nexport * from './chat-session/session-anchor.js'\n/* Who may read a conversation — one rule, also asked by doors outside this package (board-ai's revertPatch). */\nexport * from './chat-session/session-visibility.js'\nexport * from './chat-session/index.js'\n/* 순수 로직들 — 호스트(board-ai 등)가 같은 규칙을 쓰라고 공개한다. 베끼면 한쪽만 고쳐진다. */\nexport * from './chat-session/session-inbox.js'\nexport * from './chat-session/attachment-policy.js'\nexport * from './chat-session/session-purge.js'\nexport * from './chat-session/session-activity-publish.js'\nexport * from './chat-session/session-activity-broadcast.js'\nexport * from './chat-message/llm-history.js'\nexport * from './chat-message/history-summary.js'\nexport * from './chat-message/fold-history.js'\n/* 상한 밖으로 밀려난 앞부분을 요약으로 접는 orchestration — 중립 문이 부른다. */\nexport * from './chat-message/fold-session-history.js'\nexport * from './chat-message/chat-message-publish.js'\nexport * from './chat-message/chat-message-broadcast.js'\nexport * from './chat-session-participant/invite-notification.js'\n/* 멘션이 사람을 불러들이는 자리 — 사람의 말을 저장하는 문만 부른다(ADR-0071 결정 1). */\nexport * from './chat-session-participant/mention-invite.js'\nexport * from './chat-session-participant/presence.js'\nexport * from './chat-message/index.js'\nexport * from './chat-session-participant/index.js'\n\nexport const entities = [...ChatSessionEntities, ...ChatMessageEntities, ...ChatSessionParticipantEntities]\n\nexport const schema = {\n resolverClasses: [\n ChatSessionResolver,\n /* 문서를 갖지 않은 표면의 대화 — board 를 안 싣는 제품이 물어볼 수 있는 자리. */\n AssistantChatResolver,\n /* 화면이 자기 대화가 무엇을 주는지 묻는 자리 — 문구는 서버가 요청 로케일로 옮겨 낸다. */\n AssistantModeResolver,\n /* 「이 배포에 AI 가 있나 · 무엇이 선언 없이 등록됐나」 — 창구 하나(표준 A7-a). */\n AssistantCapabilityResolver,\n ChatMessageSubscription,\n /* 내가 참여한 모든 세션의 활동 — 창을 닫아 둔 표면이 배지·목록을 갱신할 수 있게. */\n MySessionActivitySubscription\n ]\n}\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../server/service/index.ts"],"names":[],"mappings":";;;;AAAA,yEAAgE;AAChE,6EAAoE;AACpE,4FAAmF;AACnF,yFAAgF;AAChF,sGAA+F;AAC/F,8FAAqF;AACrF,sDAAyE;AACzE,sDAAyE;AACzE,kEAAgG;AAChG,8CAA2C;AAC3C,2CAAwC;AACxC,8CAA2C;AAC3C,sEAAsE;AAEtE,qDAA0B;AAC1B,qEAA0C;AAC1C,uEAA4C;AAC5C,oGAAoG;AACpG,oEAAyC;AACzC,iEAA2D;AAAlD,0HAAA,iBAAiB,OAAA;AAC1B,6EAAkD;AAClD;;;GAGG;AACH,2DAAgC;AAChC,+GAA+G;AAC/G,uEAA4C;AAC5C,8DAAkF;AAAzE,qHAAA,mBAAmB,OAAA;AAAE,iHAAA,eAAe,OAAA;AAC7C,gDAAgD;AAChD,iEAAsC;AACtC,sDAAsD;AACtD,2EAAgD;AAChD,gHAAgH;AAChH,+EAAoD;AACpD,kEAAuC;AACvC,8DAA8D;AAC9D,0EAA+C;AAC/C,8EAAmD;AACnD,0EAA+C;AAC/C,qFAA0D;AAC1D,uFAA4D;AAC5D,wEAA6C;AAC7C,4EAAiD;AACjD,yEAA8C;AAC9C,wDAAwD;AACxD,iFAAsD;AACtD,iFAAsD;AACtD,mFAAwD;AACxD,4FAAiE;AACjE,2DAA2D;AAC3D,uFAA4D;AAC5D,iFAAsD;AACtD,kEAAuC;AACvC,8EAAmD;AAEtC,QAAA,QAAQ,GAAG,CAAC,GAAG,mBAAmB,EAAE,GAAG,mBAAmB,EAAE,GAAG,mBAA8B,CAAC,CAAA;AAE9F,QAAA,MAAM,GAAG;IACpB,eAAe,EAAE;QACf,8CAAmB;QACnB,sDAAsD;QACtD,kDAAqB;QACrB,uDAAuD;QACvD,kDAAqB;QACrB,wDAAwD;QACxD,8DAA2B;QAC3B,sDAAuB;QACvB,qDAAqD;QACrD,gEAA6B;QAC7B,mDAAmD;QACnD,yCAAqB;KACtB;CACF,CAAA","sourcesContent":["import { ChatSessionResolver } from './chat-session-resolver.js'\nimport { AssistantChatResolver } from './assistant-chat-resolver.js'\nimport { AssistantModeResolver } from './assistant-mode/assistant-mode-resolver.js'\nimport { AssistantCapabilityResolver } from './assistant-capability-resolver.js'\nimport { MySessionActivitySubscription } from './chat-session/session-activity-subscription.js'\nimport { ChatMessageSubscription } from './chat-message/chat-message-subscription.js'\nimport { entities as ChatSessionEntities } from './chat-session/index.js'\nimport { entities as ChatMessageEntities } from './chat-message/index.js'\nimport { entities as ChatSessionParticipantEntities } from './chat-session-participant/index.js'\nimport './chat-session/attachment-tools.js'\nimport './chat-session/session-purge.js'\nimport './chat-session/attachment-route.js'\nimport { EntryProposalResolver } from './data-entry/entry-resolver.js'\n\nexport * from './types.js'\nexport * from './chat-session-resolver.js'\nexport * from './assistant-chat-resolver.js'\n/* The mode registry — each app server declares what its conversations are (ADR-0061 decision 7). */\nexport * from './assistant-mode/index.js'\nexport { requestTranslator } from './request-translator.js'\nexport * from './assistant-capability-resolver.js'\n/*\n * 대화 각본 하네스는 **런타임 export 에서 뺀다**(ADR-0070 A15 결정 ④) — 시험 도구가 서버 번들에\n * 실린다. 시험은 경로로 가져온다: `…/service/testing/conversation-script.js`.\n */\nexport * from './tool-access.js'\n/* Data entry from material - an app registers what it can enter; a mode names it (design/ai/data-entry.md). */\nexport * from './data-entry/entry-target.js'\nexport { registerEntryTarget, entryCategoryOf } from './data-entry/entry-tools.js'\n/* 무엇이 근거인가 — 도구 결과 밖의 셋(프롬프트 · 대화 · 화면 스냅숏). */\nexport * from './grounding-sources.js'\n/* 앵커 순수 로직 — 호스트가 앵커 종류를 참조한다(리졸버는 데코레이터 때문에 무겁다). */\nexport * from './chat-session/session-anchor.js'\n/* Who may read a conversation — one rule, also asked by doors outside this package (board-ai's revertPatch). */\nexport * from './chat-session/session-visibility.js'\nexport * from './chat-session/index.js'\n/* 순수 로직들 — 호스트(board-ai 등)가 같은 규칙을 쓰라고 공개한다. 베끼면 한쪽만 고쳐진다. */\nexport * from './chat-session/session-inbox.js'\nexport * from './chat-session/attachment-policy.js'\nexport * from './chat-session/session-purge.js'\nexport * from './chat-session/session-activity-publish.js'\nexport * from './chat-session/session-activity-broadcast.js'\nexport * from './chat-message/llm-history.js'\nexport * from './chat-message/history-summary.js'\nexport * from './chat-message/fold-history.js'\n/* 상한 밖으로 밀려난 앞부분을 요약으로 접는 orchestration — 중립 문이 부른다. */\nexport * from './chat-message/fold-session-history.js'\nexport * from './chat-message/chat-message-publish.js'\nexport * from './chat-message/chat-message-broadcast.js'\nexport * from './chat-session-participant/invite-notification.js'\n/* 멘션이 사람을 불러들이는 자리 — 사람의 말을 저장하는 문만 부른다(ADR-0071 결정 1). */\nexport * from './chat-session-participant/mention-invite.js'\nexport * from './chat-session-participant/presence.js'\nexport * from './chat-message/index.js'\nexport * from './chat-session-participant/index.js'\n\nexport const entities = [...ChatSessionEntities, ...ChatMessageEntities, ...ChatSessionParticipantEntities]\n\nexport const schema = {\n resolverClasses: [\n ChatSessionResolver,\n /* 문서를 갖지 않은 표면의 대화 — board 를 안 싣는 제품이 물어볼 수 있는 자리. */\n AssistantChatResolver,\n /* 화면이 자기 대화가 무엇을 주는지 묻는 자리 — 문구는 서버가 요청 로케일로 옮겨 낸다. */\n AssistantModeResolver,\n /* 「이 배포에 AI 가 있나 · 무엇이 선언 없이 등록됐나」 — 창구 하나(표준 A7-a). */\n AssistantCapabilityResolver,\n ChatMessageSubscription,\n /* 내가 참여한 모든 세션의 활동 — 창을 닫아 둔 표면이 배지·목록을 갱신할 수 있게. */\n MySessionActivitySubscription,\n /* 사람이 누른 입력 제안을 쓰는 자리 — 행마다 앱의 코드로, 그 사람의 권한으로. */\n EntryProposalResolver\n ]\n}\n"]}