@things-factory/figure-service 10.1.206 → 10.1.208

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 (38) hide show
  1. package/dist-server/service/figure/figure-context.js +0 -2
  2. package/dist-server/service/figure/figure-context.js.map +1 -1
  3. package/dist-server/service/figure/figure-format.d.ts +2 -2
  4. package/dist-server/service/figure/figure-format.js +11 -66
  5. package/dist-server/service/figure/figure-format.js.map +1 -1
  6. package/dist-server/service/figure/figure-propose-steps.d.ts +1 -1
  7. package/dist-server/service/figure/figure-propose-steps.js +3 -5
  8. package/dist-server/service/figure/figure-propose-steps.js.map +1 -1
  9. package/dist-server/service/figure/figure-type.js +1 -1
  10. package/dist-server/service/figure/figure-type.js.map +1 -1
  11. package/dist-server/service/figure/figure.js.map +1 -1
  12. package/dist-server/tsconfig.tsbuildinfo +1 -1
  13. package/package.json +8 -8
  14. package/scripts/templates.test.mts +2 -3
  15. package/server/service/figure/figure-category-db.test.ts +2 -2
  16. package/server/service/figure/figure-context.test.ts +1 -1
  17. package/server/service/figure/figure-context.ts +0 -2
  18. package/server/service/figure/figure-deprecation-db.test.ts +2 -2
  19. package/server/service/figure/figure-format.test.ts +25 -105
  20. package/server/service/figure/figure-format.ts +14 -69
  21. package/server/service/figure/figure-inspect-db.test.ts +6 -5
  22. package/server/service/figure/figure-llm-smoke.test.ts +1 -1
  23. package/server/service/figure/figure-namespace-db.test.ts +2 -2
  24. package/server/service/figure/figure-propose-steps.test.ts +15 -20
  25. package/server/service/figure/figure-propose-steps.ts +3 -5
  26. package/server/service/figure/figure-public-db.test.ts +2 -2
  27. package/server/service/figure/figure-release-check.test.ts +2 -2
  28. package/server/service/figure/figure-release-record-db.test.ts +7 -6
  29. package/server/service/figure/figure-release-size-db.test.ts +2 -2
  30. package/server/service/figure/figure-tools.test.ts +3 -3
  31. package/server/service/figure/figure-type.ts +1 -1
  32. package/server/service/figure/figure.ts +1 -1
  33. package/translations/en.json +4 -16
  34. package/translations/es.json +4 -16
  35. package/translations/ja.json +4 -16
  36. package/translations/ko.json +10 -22
  37. package/translations/ms.json +4 -16
  38. package/translations/zh.json +4 -16
@@ -240,7 +240,6 @@ function figureViewOf(asset, request = {}) {
240
240
  */
241
241
  const SUBJECT = {
242
242
  'add-part': () => undefined,
243
- 'fit-room': () => undefined,
244
243
  'set-section-corner': step => step.part,
245
244
  'set-cavity': step => step.part,
246
245
  'set-section': step => step.part,
@@ -267,7 +266,6 @@ const SUBJECT = {
267
266
  'duplicate-part': step => step.target,
268
267
  'move-part': step => step.target,
269
268
  'set-placement': () => undefined,
270
- 'declare-occupancy': () => undefined,
271
269
  'declare-instance-size': () => undefined,
272
270
  'clear-mounting-face': () => undefined,
273
271
  'scale-uniformly': () => undefined,
@@ -1 +1 @@
1
- {"version":3,"file":"figure-context.js","sourceRoot":"","sources":["../../../server/service/figure/figure-context.ts"],"names":[],"mappings":";;;AAyHA,4CAWC;AAwED,0CAuCC;AAQD,oCA2DC;AA8ED,0CAiBC;AAoBD,gDA4BC;AAtbD,oHAAoH;AACvG,QAAA,qBAAqB,GAAG,OAAO,CAAA;AAE5C,kHAAkH;AAClH,MAAM,aAAa,GAAG,6BAAqB,GAAG,CAAC,CAAA;AAE/C,qGAAqG;AACrG,MAAM,aAAa,GAAG,EAAE,CAAA;AAiExB,MAAM,MAAM,GAAG,CAAC,KAAc,EAAE,EAAE,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,EAAE,MAAM,IAAI,CAAC,CAAA;AACrE,MAAM,KAAK,GAAG,CAAC,IAAY,EAAE,EAAE,CAAC,CAAC,EAAW,EAAE,EAAE,CAAC,EAAE,KAAK,IAAI,IAAI,CAAC,OAAO,EAAE,KAAK,QAAQ,IAAI,EAAE,CAAC,UAAU,CAAC,GAAG,IAAI,GAAG,CAAC,CAAC,CAAA;AAErH,4FAA4F;AAE5F,MAAM,WAAW,GAAG,CAAC,KAAa,EAAE,EAAE,CAAC,KAAK,CAAC,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AAE,OAAO,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC,KAAK,EAAE,OAAO,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC,KAAK,CAAC,CAAA;IACnF,CAAC;IACD,OAAO,OAAO,CAAA;AAChB,CAAC","sourcesContent":["/**\n * What of a figure the model is shown (ADR-0061 2026-10-16 decision 4).\n *\n * The kernel keeps a figure up to 1 MiB (`FIGURE_JSON_MAX_BYTES`); that is whether the figure is valid. How much of it the\n * model reads at once is another question with its own number. A figure that fits is shown whole. One that does not is\n * shown as an outline -- its sections, and every part by name, shape and what it is fastened to -- and in full only the\n * parts and sections asked for, while they fit. A section too large for the outline is left out, named by its JSON\n * Pointer with the entries inside it, and read by pointer. The full source stays on the server: a proposal is applied\n * and judged on it, on the version the request was made on.\n *\n * A proposal on a figure shown in part changes only what it was shown: no part not read in full, and nothing inside a\n * section left out and not read. Read is what the server put before the writer, never what a model says it read.\n */\nimport type { FigureAsset, FigureProposalStep } from '@hatiolab/figure-model'\n\n/** The most of a figure, serialized, the model is shown in one read. Not a validity limit: that is the kernel's. */\nexport const FIGURE_CONTEXT_BUDGET = 100_000\n\n/** Of the budget, what the outline's sections may take; the rest is for the parts and sections read beside it. */\nconst OUTLINE_SHARE = FIGURE_CONTEXT_BUDGET / 2\n\n/** How many entries of a section left out, or pointers in a reason, are named: the largest first. */\nconst ENTRIES_NAMED = 20\n\ntype Dynamic = any\n\nexport interface FigureOutlinePart {\n id: string\n /** The operation that makes its shape (`box@1`, `extrude@1`, ...). */\n shape?: string\n /** What it is fastened to: `<part>.<face>`, `mounting-plane`, or nothing when unfastened. */\n on?: string\n joint?: { id: string; type: string }\n material?: string\n /** How long its part read is: what reading it costs. */\n chars: number\n}\n\nexport interface FigureOmittedSection {\n /** The JSON Pointer of the section left out. */\n section: string\n chars: number\n /** Its largest entries, by pointer: what to read when the whole does not fit. */\n entries?: { section: string; chars: number }[]\n}\n\nexport interface FigureOutline {\n /** The whole source's length, and the budget it does not fit. */\n chars: number\n budget: number\n parts: FigureOutlinePart[]\n /** Parts the outline had no room to list, past the ones listed. */\n partsNotListed?: number\n /** Sections left out because they would crowd the outline. */\n omitted?: FigureOmittedSection[]\n [section: string]: unknown\n}\n\nexport interface FigurePartRead {\n appearance: Dynamic\n /** The fastenings that name it: its own (body1) and its children's (body0). */\n joints: Dynamic[]\n /** The graph nodes and constants under its name: `<part>` and `<part>.*` (a part id has no dot). */\n nodes: Dynamic[]\n constants: Dynamic[]\n}\n\nexport interface FigureReadRequest {\n parts?: readonly string[]\n /** JSON Pointers (RFC 6901) into the source, such as `/document/capabilities/bindings/0`. */\n sections?: readonly string[]\n}\n\nexport interface FigureView {\n whole: boolean\n /** Whole: the source as it is. */\n source?: FigureAsset\n outline?: FigureOutline\n /** The parts shown in full, by id, in the order asked. */\n parts?: Record<string, FigurePartRead>\n shown?: string[]\n /** The sections read, by pointer. */\n sections?: Record<string, unknown>\n /** What was asked for and not shown, with why and what to read instead. */\n notRead?: ({ part: string; reason: string } | { section: string; reason: string })[]\n}\n\nconst length = (value: unknown) => JSON.stringify(value)?.length ?? 0\nconst under = (part: string) => (id: unknown) => id === part || (typeof id === 'string' && id.startsWith(`${part}.`))\n\n/* ── JSON Pointer (RFC 6901) ─────────────────────────────────────────────────────────── */\n\nconst escapeToken = (token: string) => token.replace(/~/g, '~0').replace(/\\//g, '~1')\nconst pointerOf = (tokens: readonly (string | number)[]) => tokens.map(t => `/${escapeToken(String(t))}`).join('')\nfunction tokensOf(pointer: string): string[] | undefined {\n if (typeof pointer !== 'string' || !pointer.startsWith('/')) return undefined\n return pointer.slice(1).split('/').map(t => t.replace(/~1/g, '/').replace(/~0/g, '~'))\n}\nfunction valueAt(root: unknown, tokens: readonly string[]): { found: boolean; value?: unknown } {\n let at: Dynamic = root\n for (const token of tokens) {\n if (at === null || typeof at !== 'object' || !Object.prototype.hasOwnProperty.call(at, token)) return { found: false }\n at = at[token]\n }\n return { found: true, value: at }\n}\n/** `inner` is `outer` or inside it. */\nconst within = (inner: string, outer: string) => inner === outer || inner.startsWith(`${outer}/`)\n\n/** A value's entries by pointer, largest first, the first ENTRIES_NAMED of them. */\nfunction entriesOf(pointer: string, value: unknown): { section: string; chars: number }[] {\n if (value === null || typeof value !== 'object') return []\n const tokens = tokensOf(pointer)!\n return Object.entries(value as object)\n .map(([key, entry]) => ({ section: pointerOf([...tokens, key]), chars: length(entry) }))\n .sort((a, b) => b.chars - a.chars)\n .slice(0, ENTRIES_NAMED)\n}\n\n/* ── Parts ───────────────────────────────────────────────────────────────────────────── */\n\nexport function figurePartReadOf(asset: FigureAsset, part: string): FigurePartRead | undefined {\n const appearance = asset.appearance.find(a => a.target === part)\n if (!appearance) return undefined\n const model = asset.document.model as Dynamic\n const own = under(part)\n return {\n appearance,\n joints: ((asset as Dynamic).joints ?? []).filter((j: Dynamic) => j?.body1?.part === part || j?.body0?.part === part),\n nodes: model.nodes.filter((n: Dynamic) => own(n.id)),\n constants: model.constants.filter((c: Dynamic) => own(c.id))\n }\n}\n\n/** Where a part's records are, by pointer: for a part too large to read as one. */\nfunction partPointers(asset: FigureAsset, part: string): string[] {\n const model = asset.document.model as Dynamic\n const own = under(part)\n return [\n ...asset.appearance.flatMap((a, i) => (a.target === part ? [pointerOf(['appearance', i])] : [])),\n ...((asset as Dynamic).joints ?? []).flatMap((j: Dynamic, i: number) => (j?.body1?.part === part || j?.body0?.part === part ? [pointerOf(['joints', i])] : [])),\n ...model.nodes.flatMap((n: Dynamic, i: number) => (own(n.id) ? [pointerOf(['document', 'model', 'nodes', i])] : [])),\n ...model.constants.flatMap((c: Dynamic, i: number) => (own(c.id) ? [pointerOf(['document', 'model', 'constants', i])] : []))\n ]\n}\n\n/* ── The outline ─────────────────────────────────────────────────────────────────────── */\n\n/*\n The sections of an outline: every top-level field but the parts' records, the document's fields but its model, and the\n model's fields but its graph. Each may be left out by its pointer.\n*/\nconst PART_RECORDS = ['/document', '/appearance', '/joints', '/document/model', '/document/model/nodes', '/document/model/constants']\nfunction sectionsOf(asset: FigureAsset): string[] {\n const out: string[] = []\n const walk = (tokens: string[]) => {\n const { value } = valueAt(asset, tokens)\n for (const key of Object.keys(value as object)) {\n const pointer = pointerOf([...tokens, key])\n if (pointer === '/document' || pointer === '/document/model') walk([...tokens, key])\n else if (!PART_RECORDS.includes(pointer)) out.push(pointer)\n }\n }\n walk([])\n return out\n}\n\nfunction outlinePartsOf(asset: FigureAsset): FigureOutlinePart[] {\n const nodes = (asset.document.model as Dynamic).nodes\n const joints = (asset as Dynamic).joints ?? []\n return asset.appearance.map((look: Dynamic) => {\n const id = look.target\n const joint = joints.find((j: Dynamic) => j?.body1?.part === id)\n const body0 = joint?.body0\n const on = !joint ? undefined : body0?.part ? `${body0.part}.${body0.face}` : (body0?.plane ?? 'mounting-plane')\n const shape = nodes.find((n: Dynamic) => n.id === `${id}.shape`)?.op\n return {\n id,\n ...(shape ? { shape } : {}),\n ...(on ? { on } : {}),\n ...(joint ? { joint: { id: joint.id, type: joint.type } } : {}),\n ...(look.material?.token ? { material: look.material.token } : {}),\n chars: length(figurePartReadOf(asset, id))\n }\n })\n}\n\n/** Writes a section into the outline at its pointer, making the objects on the way. */\nfunction place(outline: Dynamic, tokens: readonly string[], value: unknown) {\n let at = outline\n tokens.slice(0, -1).forEach(token => (at = at[token] ??= {}))\n at[tokens[tokens.length - 1]!] = value\n}\n\n/**\n * What the view wraps the outline in, read or not: an outline that took the whole budget left the view over it by these\n * (53 characters, a figure of 3000 long-named parts, 2026-10-19).\n */\nconst VIEW_ENVELOPE = () => length({ whole: false, outline: {}, parts: {}, shown: [], sections: {}, notRead: [] }) - length({})\n\n/**\n * The outline: within OUTLINE_SHARE for its sections, the largest left out first; and, every field counted, within the\n * budget less what the view wraps it in -- a figure of very many parts lists them by id only, then as many as fit.\n */\nexport function figureOutlineOf(asset: FigureAsset, chars = length(asset)): FigureOutline {\n const limit = FIGURE_CONTEXT_BUDGET - VIEW_ENVELOPE()\n const model = asset.document.model as Dynamic\n const sections = sectionsOf(asset).map(pointer => ({ pointer, value: valueAt(asset, tokensOf(pointer)!).value }))\n const sized = sections.map(s => ({ ...s, chars: length(s.value) })).sort((a, b) => b.chars - a.chars)\n\n let total = sized.reduce((sum, s) => sum + s.chars, 0)\n const omitted: FigureOmittedSection[] = []\n const kept = new Set(sized.map(s => s.pointer))\n for (const s of sized) {\n if (total <= OUTLINE_SHARE) break\n kept.delete(s.pointer)\n total -= s.chars\n const entries = entriesOf(s.pointer, s.value)\n omitted.push({ section: s.pointer, chars: s.chars, ...(entries.length ? { entries } : {}) })\n }\n\n const outline: Dynamic = { chars, budget: FIGURE_CONTEXT_BUDGET }\n place(outline, ['document', 'model', 'nodes'], model.nodes.length)\n place(outline, ['document', 'model', 'constants'], model.constants.length)\n for (const s of sections) if (kept.has(s.pointer)) place(outline, tokensOf(s.pointer)!, s.value)\n if (omitted.length) outline.omitted = omitted\n\n let parts: Dynamic[] = outlinePartsOf(asset)\n outline.parts = parts\n if (length(outline) > limit) outline.parts = parts = parts.map(p => ({ id: p.id }))\n if (length(outline) > limit) {\n /* As many as fit, in part order, with how many more there are. */\n let room = limit - length({ ...outline, parts: [], partsNotListed: parts.length })\n const listed: Dynamic[] = []\n for (const p of parts) {\n room -= length(p) + 1\n if (room < 0) break\n listed.push(p)\n }\n outline.parts = listed\n outline.partsNotListed = parts.length - listed.length\n }\n return outline as FigureOutline\n}\n\n/* ── The view ────────────────────────────────────────────────────────────────────────── */\n\n/**\n * The view of a figure the model is shown: whole when it fits, else the outline and what was asked for -- parts, then\n * sections, each in the order asked -- while it fits beside it. Every field counted, the view is within the budget.\n */\nexport function figureViewOf(asset: FigureAsset, request: FigureReadRequest = {}): FigureView {\n const chars = length(asset)\n if (chars <= FIGURE_CONTEXT_BUDGET) return { whole: true, source: asset }\n\n const outline = figureOutlineOf(asset, chars)\n const view: FigureView = { whole: false, outline, parts: {}, shown: [], sections: {}, notRead: [] }\n const room = () => FIGURE_CONTEXT_BUDGET - length(view)\n const refuse = (one: { part: string; reason: string } | { section: string; reason: string }) => {\n if (length(one) + 1 <= room()) view.notRead!.push(one)\n }\n\n for (const part of [...new Set(request.parts ?? [])]) {\n const one = figurePartReadOf(asset, part)\n if (!one) {\n refuse({ part, reason: `${part} is not a part of this figure; the outline lists its parts` })\n continue\n }\n const cost = length(one) + length(part) + length(part) + 3\n view.parts![part] = one\n view.shown!.push(part)\n if (room() >= 0) continue\n delete view.parts![part]\n view.shown!.pop()\n if (cost <= FIGURE_CONTEXT_BUDGET - length(outline)) {\n refuse({ part, reason: `${part} (${cost} characters) does not fit beside what is already read; read it in another call with fewer parts or sections` })\n } else {\n const pointers = partPointers(asset, part)\n refuse({\n part,\n reason:\n `${part} (${cost} characters) is too large to show beside the outline; read its records as sections: ` +\n `${pointers.slice(0, ENTRIES_NAMED).join(', ')}${pointers.length > ENTRIES_NAMED ? ` and ${pointers.length - ENTRIES_NAMED} more` : ''}. ` +\n 'Parts read as sections are not counted as read in full: they cannot be changed'\n })\n }\n }\n\n for (const section of [...new Set(request.sections ?? [])]) {\n const tokens = tokensOf(section)\n const at = tokens && tokens.length ? valueAt(asset, tokens) : { found: false }\n if (!at.found) {\n refuse({ section, reason: `there is no section ${section}; a section is a JSON Pointer such as /document/capabilities/bindings/0` })\n continue\n }\n const cost = length(at.value) + length(section) + 2\n view.sections![section] = at.value\n if (room() >= 0) continue\n delete view.sections![section]\n const entries = entriesOf(section, at.value)\n refuse({\n section,\n reason: entries.length\n ? `${section} (${cost} characters) is too large to show at once here; read its entries: ${entries.map(e => `${e.section} (${e.chars})`).join(', ')}`\n : `${section} is one value of ${length(at.value)} characters, larger than can be shown here; it cannot be read or changed by a proposal`\n })\n }\n\n if (!view.notRead!.length) delete view.notRead\n return view\n}\n\n/* ── What a proposal may change ──────────────────────────────────────────────────────── */\n\ntype StepOf<K extends FigureProposalStep['kind']> = Extract<FigureProposalStep, { kind: K }>\ntype Subject = string | undefined\n\n/**\n * The part each kind of step changes, read from the field the kernel reads for that kind (audit D4-R1: a `part` beside a\n * `set-material`'s `target` is not read by the kernel, so it may not stand in for it). Every kind of the kernel's step\n * type is here, or this does not compile. A step that changes no one part says so with undefined: what it does to the\n * figure's sections is held by `unreadSectionEdits`.\n */\nconst SUBJECT: { [K in FigureProposalStep['kind']]: (step: StepOf<K>, base: FigureAsset) => Subject } = {\n 'add-part': () => undefined,\n 'fit-room': () => undefined,\n 'set-section-corner': step => step.part,\n 'set-cavity': step => step.part,\n 'set-section': step => step.part,\n attach: step => step.part,\n 'link-dimension': step => step.part,\n 'follow-size': step => step.part,\n 'unlink-dimension': step => step.part,\n 'scale-position': step => step.part,\n 'fix-position': step => step.part,\n 'nudge-part': step => step.part,\n detach: step => step.part,\n 'make-repeat': step => step.part,\n 'set-repeat': step => step.part,\n 'remove-repeat': step => step.part,\n 'set-mounting-face': step => step.part,\n 'add-binding': step => step.part,\n 'set-joint': step => step.joint?.body1?.part,\n 'remove-joint': (step, base) => ((base as Dynamic).joints ?? []).find((j: Dynamic) => j?.id === step.id)?.body1?.part,\n 'set-material': step => step.target,\n 'set-segments': step => step.target,\n 'rename-part': step => step.target,\n 'set-visibility': step => step.target,\n 'remove-part': step => step.target,\n 'duplicate-part': step => step.target,\n 'move-part': step => step.target,\n 'set-placement': () => undefined,\n 'declare-occupancy': () => undefined,\n 'declare-instance-size': () => undefined,\n 'clear-mounting-face': () => undefined,\n 'scale-uniformly': () => undefined,\n 'follow-size-in-proportion': () => undefined,\n 'set-detail-level': () => undefined,\n 'add-design-input': () => undefined,\n 'set-input-range': () => undefined,\n 'publish-input': () => undefined,\n 'unpublish-input': () => undefined,\n 'remove-binding': () => undefined,\n 'set-slot-layout': () => undefined,\n 'remove-slot-layout': () => undefined,\n 'set-extension': () => undefined,\n rename: () => undefined,\n 'set-capabilities': () => undefined,\n 'set-state-input': () => undefined,\n 'set-state-defaults': () => undefined,\n 'set-driver': () => undefined,\n 'remove-driver': () => undefined,\n 'set-clip': () => undefined,\n 'set-motion-group': () => undefined,\n 'remove-motion-group': () => undefined,\n 'set-data-schema': () => undefined,\n 'rename-data-field': () => undefined,\n 'set-data-binding': () => undefined,\n 'remove-data-binding': () => undefined,\n 'set-status-port': () => undefined,\n 'remove-status-port': () => undefined\n}\n\n/**\n * The steps that change a part of the base not shown in full, as reasons said back to the writer. A part may still be\n * named to fasten to or to follow -- the kernel works from it, nothing about it is guessed -- and a new part is the\n * steps' own. A kind this table does not know is refused: it is not let through unjudged.\n */\nexport function unreadPartEdits(base: FigureAsset, steps: readonly FigureProposalStep[], view: FigureView): string[] {\n const existing = new Set(base.appearance.map(a => a.target))\n const shown = new Set(view.shown ?? [])\n const allowed = [...shown].join(', ') || 'none'\n return steps.flatMap((step, i) => {\n const kind = (step as Dynamic)?.kind\n if (typeof kind !== 'string') return []\n const judge = (SUBJECT as Record<string, (step: Dynamic, base: FigureAsset) => Subject>)[kind]\n if (!Object.prototype.hasOwnProperty.call(SUBJECT, kind) || !judge)\n return [`UNKNOWN_STEP: steps[${i}] has the kind \"${kind}\", which is not one of the commands; use only the commands taught.`]\n const part = judge(step, base)\n if (typeof part !== 'string' || !existing.has(part) || shown.has(part)) return []\n return [\n `UNREAD_PART: steps[${i}] (${kind}) changes \"${part}\", which was not shown in full, so its source is not known here. ` +\n `Change only the parts shown in full (${allowed}) or parts the steps add. To change ${part}, read it with getFigureSource parts and pass it in parts to proposeFigureCandidate.`\n ]\n })\n}\n\n/** Entries of a value, keyed by `id` when every entry of a list has a distinct one, else by place. */\nfunction keyedEntries(value: unknown): Map<string, { token: string; value: unknown }> {\n const out = new Map<string, { token: string; value: unknown }>()\n if (Array.isArray(value)) {\n const ids = value.map(v => (v && typeof v === 'object' && typeof (v as Dynamic).id === 'string' ? (v as Dynamic).id : undefined))\n const byId = ids.every(Boolean) && new Set(ids).size === ids.length\n value.forEach((v, i) => out.set(byId ? `id:${ids[i]}` : `at:${i}`, { token: String(i), value: v }))\n } else if (value && typeof value === 'object') {\n for (const [key, v] of Object.entries(value)) out.set(`key:${key}`, { token: key, value: v })\n }\n return out\n}\n\n/**\n * What of the sections left out of the outline and not read the steps changed, as reasons said back to the writer. Judged\n * on what the steps made, not on what they say: nothing that was there may be changed or taken away. A new entry -- a\n * record in a list, a key in a map -- is the steps' own.\n */\nexport function unreadSectionEdits(base: FigureAsset, after: FigureAsset, view: FigureView): string[] {\n const read = Object.keys(view.sections ?? {})\n const reasons: string[] = []\n const say = (pointer: string, what: string) =>\n reasons.push(\n `UNREAD_SECTION: the steps ${what} ${pointer}, which was left out of the outline and not read, so it is not known here. ` +\n `Leave it as it is; to change it, read it with getFigureSource sections and pass it in sections to proposeFigureCandidate.`\n )\n const check = (pointer: string, before: unknown, now: unknown) => {\n if (reasons.length >= ENTRIES_NAMED || read.some(r => within(pointer, r))) return\n const records = (v: unknown) => v !== null && typeof v === 'object'\n if (!records(before) || !records(now) || Array.isArray(before) !== Array.isArray(now)) {\n if (JSON.stringify(before) !== JSON.stringify(now)) say(pointer, 'change')\n return\n }\n const later = keyedEntries(now)\n for (const [key, entry] of keyedEntries(before)) {\n const child = `${pointer}/${escapeToken(entry.token)}`\n const kept = later.get(key)\n if (kept) check(child, entry.value, kept.value)\n else if (!read.some(r => within(child, r))) say(child, 'remove')\n }\n }\n for (const omitted of view.outline?.omitted ?? []) {\n const tokens = tokensOf(omitted.section)!\n check(omitted.section, valueAt(base, tokens).value, valueAt(after, tokens).value)\n }\n return reasons\n}\n"]}
1
+ {"version":3,"file":"figure-context.js","sourceRoot":"","sources":["../../../server/service/figure/figure-context.ts"],"names":[],"mappings":";;;AAyHA,4CAWC;AAwED,0CAuCC;AAQD,oCA2DC;AA4ED,0CAiBC;AAoBD,gDA4BC;AApbD,oHAAoH;AACvG,QAAA,qBAAqB,GAAG,OAAO,CAAA;AAE5C,kHAAkH;AAClH,MAAM,aAAa,GAAG,6BAAqB,GAAG,CAAC,CAAA;AAE/C,qGAAqG;AACrG,MAAM,aAAa,GAAG,EAAE,CAAA;AAiExB,MAAM,MAAM,GAAG,CAAC,KAAc,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AAC,CAAC,CAAC;gBAAE,GAAG,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAA;QAClE,CAAC;IACH,CAAC,CAAA;IACD,KAAK,MAAM,OAAO,IAAI,IAAI,CAAC,OAAO,EAAE,OAAO,IAAI,EAAE,EAAE,CAAC;QAClD,MAAM,MAAM,GAAG,QAAQ,CAAC,OAAO,CAAC,OAAO,CAAE,CAAA;QACzC,KAAK,CAAC,OAAO,CAAC,OAAO,EAAE,OAAO,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC,KAAK,EAAE,OAAO,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC,KAAK,CAAC,CAAA;IACnF,CAAC;IACD,OAAO,OAAO,CAAA;AAChB,CAAC","sourcesContent":["/**\n * What of a figure the model is shown (ADR-0061 2026-10-16 decision 4).\n *\n * The kernel keeps a figure up to 1 MiB (`FIGURE_JSON_MAX_BYTES`); that is whether the figure is valid. How much of it the\n * model reads at once is another question with its own number. A figure that fits is shown whole. One that does not is\n * shown as an outline -- its sections, and every part by name, shape and what it is fastened to -- and in full only the\n * parts and sections asked for, while they fit. A section too large for the outline is left out, named by its JSON\n * Pointer with the entries inside it, and read by pointer. The full source stays on the server: a proposal is applied\n * and judged on it, on the version the request was made on.\n *\n * A proposal on a figure shown in part changes only what it was shown: no part not read in full, and nothing inside a\n * section left out and not read. Read is what the server put before the writer, never what a model says it read.\n */\nimport type { FigureAsset, FigureProposalStep } from '@hatiolab/figure-model'\n\n/** The most of a figure, serialized, the model is shown in one read. Not a validity limit: that is the kernel's. */\nexport const FIGURE_CONTEXT_BUDGET = 100_000\n\n/** Of the budget, what the outline's sections may take; the rest is for the parts and sections read beside it. */\nconst OUTLINE_SHARE = FIGURE_CONTEXT_BUDGET / 2\n\n/** How many entries of a section left out, or pointers in a reason, are named: the largest first. */\nconst ENTRIES_NAMED = 20\n\ntype Dynamic = any\n\nexport interface FigureOutlinePart {\n id: string\n /** The operation that makes its shape (`box@1`, `extrude@1`, ...). */\n shape?: string\n /** What it is fastened to: `<part>.<face>`, `mounting-plane`, or nothing when unfastened. */\n on?: string\n joint?: { id: string; type: string }\n material?: string\n /** How long its part read is: what reading it costs. */\n chars: number\n}\n\nexport interface FigureOmittedSection {\n /** The JSON Pointer of the section left out. */\n section: string\n chars: number\n /** Its largest entries, by pointer: what to read when the whole does not fit. */\n entries?: { section: string; chars: number }[]\n}\n\nexport interface FigureOutline {\n /** The whole source's length, and the budget it does not fit. */\n chars: number\n budget: number\n parts: FigureOutlinePart[]\n /** Parts the outline had no room to list, past the ones listed. */\n partsNotListed?: number\n /** Sections left out because they would crowd the outline. */\n omitted?: FigureOmittedSection[]\n [section: string]: unknown\n}\n\nexport interface FigurePartRead {\n appearance: Dynamic\n /** The fastenings that name it: its own (body1) and its children's (body0). */\n joints: Dynamic[]\n /** The graph nodes and constants under its name: `<part>` and `<part>.*` (a part id has no dot). */\n nodes: Dynamic[]\n constants: Dynamic[]\n}\n\nexport interface FigureReadRequest {\n parts?: readonly string[]\n /** JSON Pointers (RFC 6901) into the source, such as `/document/capabilities/bindings/0`. */\n sections?: readonly string[]\n}\n\nexport interface FigureView {\n whole: boolean\n /** Whole: the source as it is. */\n source?: FigureAsset\n outline?: FigureOutline\n /** The parts shown in full, by id, in the order asked. */\n parts?: Record<string, FigurePartRead>\n shown?: string[]\n /** The sections read, by pointer. */\n sections?: Record<string, unknown>\n /** What was asked for and not shown, with why and what to read instead. */\n notRead?: ({ part: string; reason: string } | { section: string; reason: string })[]\n}\n\nconst length = (value: unknown) => JSON.stringify(value)?.length ?? 0\nconst under = (part: string) => (id: unknown) => id === part || (typeof id === 'string' && id.startsWith(`${part}.`))\n\n/* ── JSON Pointer (RFC 6901) ─────────────────────────────────────────────────────────── */\n\nconst escapeToken = (token: string) => token.replace(/~/g, '~0').replace(/\\//g, '~1')\nconst pointerOf = (tokens: readonly (string | number)[]) => tokens.map(t => `/${escapeToken(String(t))}`).join('')\nfunction tokensOf(pointer: string): string[] | undefined {\n if (typeof pointer !== 'string' || !pointer.startsWith('/')) return undefined\n return pointer.slice(1).split('/').map(t => t.replace(/~1/g, '/').replace(/~0/g, '~'))\n}\nfunction valueAt(root: unknown, tokens: readonly string[]): { found: boolean; value?: unknown } {\n let at: Dynamic = root\n for (const token of tokens) {\n if (at === null || typeof at !== 'object' || !Object.prototype.hasOwnProperty.call(at, token)) return { found: false }\n at = at[token]\n }\n return { found: true, value: at }\n}\n/** `inner` is `outer` or inside it. */\nconst within = (inner: string, outer: string) => inner === outer || inner.startsWith(`${outer}/`)\n\n/** A value's entries by pointer, largest first, the first ENTRIES_NAMED of them. */\nfunction entriesOf(pointer: string, value: unknown): { section: string; chars: number }[] {\n if (value === null || typeof value !== 'object') return []\n const tokens = tokensOf(pointer)!\n return Object.entries(value as object)\n .map(([key, entry]) => ({ section: pointerOf([...tokens, key]), chars: length(entry) }))\n .sort((a, b) => b.chars - a.chars)\n .slice(0, ENTRIES_NAMED)\n}\n\n/* ── Parts ───────────────────────────────────────────────────────────────────────────── */\n\nexport function figurePartReadOf(asset: FigureAsset, part: string): FigurePartRead | undefined {\n const appearance = asset.appearance.find(a => a.target === part)\n if (!appearance) return undefined\n const model = asset.document.model as Dynamic\n const own = under(part)\n return {\n appearance,\n joints: ((asset as Dynamic).joints ?? []).filter((j: Dynamic) => j?.body1?.part === part || j?.body0?.part === part),\n nodes: model.nodes.filter((n: Dynamic) => own(n.id)),\n constants: model.constants.filter((c: Dynamic) => own(c.id))\n }\n}\n\n/** Where a part's records are, by pointer: for a part too large to read as one. */\nfunction partPointers(asset: FigureAsset, part: string): string[] {\n const model = asset.document.model as Dynamic\n const own = under(part)\n return [\n ...asset.appearance.flatMap((a, i) => (a.target === part ? [pointerOf(['appearance', i])] : [])),\n ...((asset as Dynamic).joints ?? []).flatMap((j: Dynamic, i: number) => (j?.body1?.part === part || j?.body0?.part === part ? [pointerOf(['joints', i])] : [])),\n ...model.nodes.flatMap((n: Dynamic, i: number) => (own(n.id) ? [pointerOf(['document', 'model', 'nodes', i])] : [])),\n ...model.constants.flatMap((c: Dynamic, i: number) => (own(c.id) ? [pointerOf(['document', 'model', 'constants', i])] : []))\n ]\n}\n\n/* ── The outline ─────────────────────────────────────────────────────────────────────── */\n\n/*\n The sections of an outline: every top-level field but the parts' records, the document's fields but its model, and the\n model's fields but its graph. Each may be left out by its pointer.\n*/\nconst PART_RECORDS = ['/document', '/appearance', '/joints', '/document/model', '/document/model/nodes', '/document/model/constants']\nfunction sectionsOf(asset: FigureAsset): string[] {\n const out: string[] = []\n const walk = (tokens: string[]) => {\n const { value } = valueAt(asset, tokens)\n for (const key of Object.keys(value as object)) {\n const pointer = pointerOf([...tokens, key])\n if (pointer === '/document' || pointer === '/document/model') walk([...tokens, key])\n else if (!PART_RECORDS.includes(pointer)) out.push(pointer)\n }\n }\n walk([])\n return out\n}\n\nfunction outlinePartsOf(asset: FigureAsset): FigureOutlinePart[] {\n const nodes = (asset.document.model as Dynamic).nodes\n const joints = (asset as Dynamic).joints ?? []\n return asset.appearance.map((look: Dynamic) => {\n const id = look.target\n const joint = joints.find((j: Dynamic) => j?.body1?.part === id)\n const body0 = joint?.body0\n const on = !joint ? undefined : body0?.part ? `${body0.part}.${body0.face}` : (body0?.plane ?? 'mounting-plane')\n const shape = nodes.find((n: Dynamic) => n.id === `${id}.shape`)?.op\n return {\n id,\n ...(shape ? { shape } : {}),\n ...(on ? { on } : {}),\n ...(joint ? { joint: { id: joint.id, type: joint.type } } : {}),\n ...(look.material?.token ? { material: look.material.token } : {}),\n chars: length(figurePartReadOf(asset, id))\n }\n })\n}\n\n/** Writes a section into the outline at its pointer, making the objects on the way. */\nfunction place(outline: Dynamic, tokens: readonly string[], value: unknown) {\n let at = outline\n tokens.slice(0, -1).forEach(token => (at = at[token] ??= {}))\n at[tokens[tokens.length - 1]!] = value\n}\n\n/**\n * What the view wraps the outline in, read or not: an outline that took the whole budget left the view over it by these\n * (53 characters, a figure of 3000 long-named parts, 2026-10-19).\n */\nconst VIEW_ENVELOPE = () => length({ whole: false, outline: {}, parts: {}, shown: [], sections: {}, notRead: [] }) - length({})\n\n/**\n * The outline: within OUTLINE_SHARE for its sections, the largest left out first; and, every field counted, within the\n * budget less what the view wraps it in -- a figure of very many parts lists them by id only, then as many as fit.\n */\nexport function figureOutlineOf(asset: FigureAsset, chars = length(asset)): FigureOutline {\n const limit = FIGURE_CONTEXT_BUDGET - VIEW_ENVELOPE()\n const model = asset.document.model as Dynamic\n const sections = sectionsOf(asset).map(pointer => ({ pointer, value: valueAt(asset, tokensOf(pointer)!).value }))\n const sized = sections.map(s => ({ ...s, chars: length(s.value) })).sort((a, b) => b.chars - a.chars)\n\n let total = sized.reduce((sum, s) => sum + s.chars, 0)\n const omitted: FigureOmittedSection[] = []\n const kept = new Set(sized.map(s => s.pointer))\n for (const s of sized) {\n if (total <= OUTLINE_SHARE) break\n kept.delete(s.pointer)\n total -= s.chars\n const entries = entriesOf(s.pointer, s.value)\n omitted.push({ section: s.pointer, chars: s.chars, ...(entries.length ? { entries } : {}) })\n }\n\n const outline: Dynamic = { chars, budget: FIGURE_CONTEXT_BUDGET }\n place(outline, ['document', 'model', 'nodes'], model.nodes.length)\n place(outline, ['document', 'model', 'constants'], model.constants.length)\n for (const s of sections) if (kept.has(s.pointer)) place(outline, tokensOf(s.pointer)!, s.value)\n if (omitted.length) outline.omitted = omitted\n\n let parts: Dynamic[] = outlinePartsOf(asset)\n outline.parts = parts\n if (length(outline) > limit) outline.parts = parts = parts.map(p => ({ id: p.id }))\n if (length(outline) > limit) {\n /* As many as fit, in part order, with how many more there are. */\n let room = limit - length({ ...outline, parts: [], partsNotListed: parts.length })\n const listed: Dynamic[] = []\n for (const p of parts) {\n room -= length(p) + 1\n if (room < 0) break\n listed.push(p)\n }\n outline.parts = listed\n outline.partsNotListed = parts.length - listed.length\n }\n return outline as FigureOutline\n}\n\n/* ── The view ────────────────────────────────────────────────────────────────────────── */\n\n/**\n * The view of a figure the model is shown: whole when it fits, else the outline and what was asked for -- parts, then\n * sections, each in the order asked -- while it fits beside it. Every field counted, the view is within the budget.\n */\nexport function figureViewOf(asset: FigureAsset, request: FigureReadRequest = {}): FigureView {\n const chars = length(asset)\n if (chars <= FIGURE_CONTEXT_BUDGET) return { whole: true, source: asset }\n\n const outline = figureOutlineOf(asset, chars)\n const view: FigureView = { whole: false, outline, parts: {}, shown: [], sections: {}, notRead: [] }\n const room = () => FIGURE_CONTEXT_BUDGET - length(view)\n const refuse = (one: { part: string; reason: string } | { section: string; reason: string }) => {\n if (length(one) + 1 <= room()) view.notRead!.push(one)\n }\n\n for (const part of [...new Set(request.parts ?? [])]) {\n const one = figurePartReadOf(asset, part)\n if (!one) {\n refuse({ part, reason: `${part} is not a part of this figure; the outline lists its parts` })\n continue\n }\n const cost = length(one) + length(part) + length(part) + 3\n view.parts![part] = one\n view.shown!.push(part)\n if (room() >= 0) continue\n delete view.parts![part]\n view.shown!.pop()\n if (cost <= FIGURE_CONTEXT_BUDGET - length(outline)) {\n refuse({ part, reason: `${part} (${cost} characters) does not fit beside what is already read; read it in another call with fewer parts or sections` })\n } else {\n const pointers = partPointers(asset, part)\n refuse({\n part,\n reason:\n `${part} (${cost} characters) is too large to show beside the outline; read its records as sections: ` +\n `${pointers.slice(0, ENTRIES_NAMED).join(', ')}${pointers.length > ENTRIES_NAMED ? ` and ${pointers.length - ENTRIES_NAMED} more` : ''}. ` +\n 'Parts read as sections are not counted as read in full: they cannot be changed'\n })\n }\n }\n\n for (const section of [...new Set(request.sections ?? [])]) {\n const tokens = tokensOf(section)\n const at = tokens && tokens.length ? valueAt(asset, tokens) : { found: false }\n if (!at.found) {\n refuse({ section, reason: `there is no section ${section}; a section is a JSON Pointer such as /document/capabilities/bindings/0` })\n continue\n }\n const cost = length(at.value) + length(section) + 2\n view.sections![section] = at.value\n if (room() >= 0) continue\n delete view.sections![section]\n const entries = entriesOf(section, at.value)\n refuse({\n section,\n reason: entries.length\n ? `${section} (${cost} characters) is too large to show at once here; read its entries: ${entries.map(e => `${e.section} (${e.chars})`).join(', ')}`\n : `${section} is one value of ${length(at.value)} characters, larger than can be shown here; it cannot be read or changed by a proposal`\n })\n }\n\n if (!view.notRead!.length) delete view.notRead\n return view\n}\n\n/* ── What a proposal may change ──────────────────────────────────────────────────────── */\n\ntype StepOf<K extends FigureProposalStep['kind']> = Extract<FigureProposalStep, { kind: K }>\ntype Subject = string | undefined\n\n/**\n * The part each kind of step changes, read from the field the kernel reads for that kind (audit D4-R1: a `part` beside a\n * `set-material`'s `target` is not read by the kernel, so it may not stand in for it). Every kind of the kernel's step\n * type is here, or this does not compile. A step that changes no one part says so with undefined: what it does to the\n * figure's sections is held by `unreadSectionEdits`.\n */\nconst SUBJECT: { [K in FigureProposalStep['kind']]: (step: StepOf<K>, base: FigureAsset) => Subject } = {\n 'add-part': () => undefined,\n 'set-section-corner': step => step.part,\n 'set-cavity': step => step.part,\n 'set-section': step => step.part,\n attach: step => step.part,\n 'link-dimension': step => step.part,\n 'follow-size': step => step.part,\n 'unlink-dimension': step => step.part,\n 'scale-position': step => step.part,\n 'fix-position': step => step.part,\n 'nudge-part': step => step.part,\n detach: step => step.part,\n 'make-repeat': step => step.part,\n 'set-repeat': step => step.part,\n 'remove-repeat': step => step.part,\n 'set-mounting-face': step => step.part,\n 'add-binding': step => step.part,\n 'set-joint': step => step.joint?.body1?.part,\n 'remove-joint': (step, base) => ((base as Dynamic).joints ?? []).find((j: Dynamic) => j?.id === step.id)?.body1?.part,\n 'set-material': step => step.target,\n 'set-segments': step => step.target,\n 'rename-part': step => step.target,\n 'set-visibility': step => step.target,\n 'remove-part': step => step.target,\n 'duplicate-part': step => step.target,\n 'move-part': step => step.target,\n 'set-placement': () => undefined,\n 'declare-instance-size': () => undefined,\n 'clear-mounting-face': () => undefined,\n 'scale-uniformly': () => undefined,\n 'follow-size-in-proportion': () => undefined,\n 'set-detail-level': () => undefined,\n 'add-design-input': () => undefined,\n 'set-input-range': () => undefined,\n 'publish-input': () => undefined,\n 'unpublish-input': () => undefined,\n 'remove-binding': () => undefined,\n 'set-slot-layout': () => undefined,\n 'remove-slot-layout': () => undefined,\n 'set-extension': () => undefined,\n rename: () => undefined,\n 'set-capabilities': () => undefined,\n 'set-state-input': () => undefined,\n 'set-state-defaults': () => undefined,\n 'set-driver': () => undefined,\n 'remove-driver': () => undefined,\n 'set-clip': () => undefined,\n 'set-motion-group': () => undefined,\n 'remove-motion-group': () => undefined,\n 'set-data-schema': () => undefined,\n 'rename-data-field': () => undefined,\n 'set-data-binding': () => undefined,\n 'remove-data-binding': () => undefined,\n 'set-status-port': () => undefined,\n 'remove-status-port': () => undefined\n}\n\n/**\n * The steps that change a part of the base not shown in full, as reasons said back to the writer. A part may still be\n * named to fasten to or to follow -- the kernel works from it, nothing about it is guessed -- and a new part is the\n * steps' own. A kind this table does not know is refused: it is not let through unjudged.\n */\nexport function unreadPartEdits(base: FigureAsset, steps: readonly FigureProposalStep[], view: FigureView): string[] {\n const existing = new Set(base.appearance.map(a => a.target))\n const shown = new Set(view.shown ?? [])\n const allowed = [...shown].join(', ') || 'none'\n return steps.flatMap((step, i) => {\n const kind = (step as Dynamic)?.kind\n if (typeof kind !== 'string') return []\n const judge = (SUBJECT as Record<string, (step: Dynamic, base: FigureAsset) => Subject>)[kind]\n if (!Object.prototype.hasOwnProperty.call(SUBJECT, kind) || !judge)\n return [`UNKNOWN_STEP: steps[${i}] has the kind \"${kind}\", which is not one of the commands; use only the commands taught.`]\n const part = judge(step, base)\n if (typeof part !== 'string' || !existing.has(part) || shown.has(part)) return []\n return [\n `UNREAD_PART: steps[${i}] (${kind}) changes \"${part}\", which was not shown in full, so its source is not known here. ` +\n `Change only the parts shown in full (${allowed}) or parts the steps add. To change ${part}, read it with getFigureSource parts and pass it in parts to proposeFigureCandidate.`\n ]\n })\n}\n\n/** Entries of a value, keyed by `id` when every entry of a list has a distinct one, else by place. */\nfunction keyedEntries(value: unknown): Map<string, { token: string; value: unknown }> {\n const out = new Map<string, { token: string; value: unknown }>()\n if (Array.isArray(value)) {\n const ids = value.map(v => (v && typeof v === 'object' && typeof (v as Dynamic).id === 'string' ? (v as Dynamic).id : undefined))\n const byId = ids.every(Boolean) && new Set(ids).size === ids.length\n value.forEach((v, i) => out.set(byId ? `id:${ids[i]}` : `at:${i}`, { token: String(i), value: v }))\n } else if (value && typeof value === 'object') {\n for (const [key, v] of Object.entries(value)) out.set(`key:${key}`, { token: key, value: v })\n }\n return out\n}\n\n/**\n * What of the sections left out of the outline and not read the steps changed, as reasons said back to the writer. Judged\n * on what the steps made, not on what they say: nothing that was there may be changed or taken away. A new entry -- a\n * record in a list, a key in a map -- is the steps' own.\n */\nexport function unreadSectionEdits(base: FigureAsset, after: FigureAsset, view: FigureView): string[] {\n const read = Object.keys(view.sections ?? {})\n const reasons: string[] = []\n const say = (pointer: string, what: string) =>\n reasons.push(\n `UNREAD_SECTION: the steps ${what} ${pointer}, which was left out of the outline and not read, so it is not known here. ` +\n `Leave it as it is; to change it, read it with getFigureSource sections and pass it in sections to proposeFigureCandidate.`\n )\n const check = (pointer: string, before: unknown, now: unknown) => {\n if (reasons.length >= ENTRIES_NAMED || read.some(r => within(pointer, r))) return\n const records = (v: unknown) => v !== null && typeof v === 'object'\n if (!records(before) || !records(now) || Array.isArray(before) !== Array.isArray(now)) {\n if (JSON.stringify(before) !== JSON.stringify(now)) say(pointer, 'change')\n return\n }\n const later = keyedEntries(now)\n for (const [key, entry] of keyedEntries(before)) {\n const child = `${pointer}/${escapeToken(entry.token)}`\n const kept = later.get(key)\n if (kept) check(child, entry.value, kept.value)\n else if (!read.some(r => within(child, r))) say(child, 'remove')\n }\n }\n for (const omitted of view.outline?.omitted ?? []) {\n const tokens = tokensOf(omitted.section)!\n check(omitted.section, valueAt(base, tokens).value, valueAt(after, tokens).value)\n }\n return reasons\n}\n"]}
@@ -46,8 +46,8 @@ export interface FigureReleaseCheckInput {
46
46
  }
47
47
  /**
48
48
  * A check an app adds to releasing (LV figure-server design G10): findings in the gate's own shape, blocking or said.
49
- * The LV figure-server refuses an origin off the middle of the room, which operato-figure only says (ADR-0104
50
- * decision 4: refusing is the receiving side's), and says its carrier and budget advice.
49
+ * The LV figure-server refuses an origin off the middle of the floor, a receiving side's check (ADR-0104 decision 4),
50
+ * and says its carrier and budget advice.
51
51
  */
52
52
  export type FigureReleaseCheck = (input: FigureReleaseCheckInput) => GateFinding[];
53
53
  /** Adds a check to every release verdict (`inspectFigure`, `releaseFigure`). Returns the way to take it off again. */
@@ -108,38 +108,13 @@ function parseSource(sourceJson) {
108
108
  * The words are the modeller's (ADR-0097 §9 Q2 A): 「차지하는 공간」 for the volume a figure takes up, 「부품에 맞추기」 for
109
109
  * setting it from the parts, and 「장착면」 for the face it stands on (`figure.text.mounting-face-explained`). A fact, then the way out.
110
110
  */
111
- function figureWording(violation, say, hasParts) {
111
+ function figureWording(violation, say) {
112
112
  const part = violation.part ?? '';
113
113
  const axis = (violation.axis ?? '').toUpperCase();
114
114
  const mm = violation.mm ?? 0;
115
115
  const degrees = violation.degrees ?? 0;
116
116
  const key = (field) => `figure.gate.${violation.code.toLowerCase().replace(/_/g, '-')}.${field}`;
117
117
  switch (violation.code) {
118
- case 'PART_OUTSIDE_OCCUPANCY':
119
- return {
120
- message: say(key('message'), { part, axis, mm }, `'${part}' goes ${mm} mm past the space the figure takes on ${axis}.`),
121
- why: say(key('why'), {}, 'The space the figure takes sets the scale it is placed at. What lies past it is left out of that scale, so on a board this part lands outside the place given to the figure.'),
122
- how: say(key('how'), { part, axis, mm }, `Use "fit to parts" to fit the space the figure takes to the parts again, or move '${part}' ${mm} mm inward on ${axis}.`)
123
- };
124
- case 'OCCUPANCY_UNDECLARED':
125
- return violation.axis
126
- ? {
127
- message: say(`figure.gate.occupancy-empty-axis.message`, { axis }, `The space the figure takes is empty on ${axis}.`),
128
- why: say(key('why'), {}, 'The space a figure takes sets the scale it is placed at on a board.'),
129
- how: say(key('how'), {}, 'Use "fit to parts" to set the space the figure takes from the parts as they are now.')
130
- }
131
- : {
132
- message: say(key('message'), {}, 'The space this figure takes is not set yet.'),
133
- why: say(key('why'), {}, 'The space a figure takes sets the scale it is placed at on a board.'),
134
- /*
135
- A new figure is refused this way before it has a part, and 「fit to parts」 has nothing to measure then —
136
- the screen does not offer it. Telling the author to press it sent them looking for a button that was not
137
- there (:3300, 2026-09-24).
138
- */
139
- how: hasParts
140
- ? say(key('how'), {}, 'Use "fit to parts" to set the space the figure takes from the parts as they are now.')
141
- : say(key('how-no-parts'), {}, 'Add a shape first, then use "fit to parts" to set the space the figure takes from it.')
142
- };
143
118
  case 'PARTS_OFF_PLACEMENT_FACE':
144
119
  return {
145
120
  message: say(key('message'), { part, mm }, `The mounting face of '${part}' is ${mm} mm off the plane the figure stands on.`),
@@ -206,12 +181,9 @@ rowCategory) {
206
181
  }
207
182
  let inspection;
208
183
  let asset;
209
- let hasParts = true;
210
184
  try {
211
185
  asset = (0, figure_model_1.parseFigureAsset)(sourceJson);
212
186
  inspection = (0, figure_model_1.inspectFigureAsset)(asset);
213
- const cost = (0, figure_model_1.figureCostOf)(asset);
214
- hasParts = cost.groups + cost.hidden > 0;
215
187
  }
216
188
  catch (e) {
217
189
  const error = e;
@@ -223,7 +195,7 @@ rowCategory) {
223
195
  const say = sayerOf(t);
224
196
  const findings = inspection.violations.map(violation => ({
225
197
  code: violation.code.toLowerCase().replace(/_/g, '-'),
226
- ...figureWording(violation, say, hasParts),
198
+ ...figureWording(violation, say),
227
199
  at: violation.part,
228
200
  blocking: true
229
201
  }));
@@ -241,38 +213,6 @@ rowCategory) {
241
213
  blocking: true
242
214
  });
243
215
  }
244
- if (inspection.coverage.method === 'sampled') {
245
- const states = inspection.coverage.states;
246
- findings.push({
247
- code: 'state-range-sampled',
248
- /* Sizes as well as motion: the instance size range is swept for every figure (figure-model, designer 2026-09-27). */
249
- message: say('figure.gate.state-range-sampled.message', { states }, `The whole range of sizes and motion could not be proven, so ${states} combinations of size and pose were checked.`),
250
- why: say('figure.gate.state-range-sampled.why', {}, 'Between the combinations that were checked, a part may still go past the space the figure takes.'),
251
- how: say('figure.gate.state-range-sampled.how', {}, 'To cover the whole range, re-author what could not be proven.'),
252
- /*
253
- Which motions stopped the proof, by the name a person gave them: the kernel reports each operation it could
254
- not prove (`j2-shoulder.chain: compose@1 turns …`), and the screen showed that English list as it was. The
255
- name before the first dot is the joint or part; the operations stay in the logs.
256
- */
257
- at: [...new Set((inspection.coverage.unprovable ?? []).map(entry => entry.split(':')[0].split('.')[0].trim()).filter(Boolean))].join(' · ') || undefined,
258
- blocking: false
259
- });
260
- }
261
- /*
262
- Said, never refused (ADR-0104 decision 4): the origin is where the figure is fastened, and a door fastened at its
263
- hinge is a right model. A drawing that places figures by the middle of their room reads this before it pins one.
264
- */
265
- const origin = (0, figure_model_1.figureOriginCentredOf)(asset);
266
- if (origin && !origin.centred) {
267
- const off = origin.off.map(o => `${o.axis.toUpperCase()} ${o.mm} mm`).join(', ');
268
- findings.push({
269
- code: 'origin-off-centre',
270
- message: say('figure.gate.origin-off-centre.message', { off }, `The origin is off the middle of the declared room: ${off}.`),
271
- why: say('figure.gate.origin-off-centre.why', {}, 'A drawing that places figures by the middle of their room puts this one that far from where it is drawn.'),
272
- how: say('figure.gate.origin-off-centre.how', {}, 'Keep it when the figure is fastened there, as a door at its hinge. Move the origin to the middle to place it by its room.'),
273
- blocking: false
274
- });
275
- }
276
216
  findings.push(...planeGapFindings(asset, say));
277
217
  if (releasedJson)
278
218
  findings.push(...figureContractFindings(asset, releasedJson, say));
@@ -303,7 +243,7 @@ const PLANE_ENGLISH = {
303
243
  }
304
244
  };
305
245
  function planeGapFindings(asset, say) {
306
- if (asset.occupancy?.contact)
246
+ if (asset.mountingFace)
307
247
  return [];
308
248
  const gap = (0, figure_model_1.figurePlaneGapOf)(asset);
309
249
  if (!gap || gap.touches)
@@ -479,10 +419,15 @@ function figureContractWording(change, say) {
479
419
  why: say(key('why'), {}, 'It adds what the figure can do. Placed instances stand as they are.')
480
420
  };
481
421
  /* Said, never refused (ADR-0104): a consumer that pins a release reads these before it moves to this one. */
482
- case 'occupancy-changed':
422
+ case 'size-changed':
423
+ return {
424
+ message: say(key('message'), v, `The figure's size changed from ${v.before || 'none'} to ${v.after || 'none'}.`),
425
+ why: say(key('why'), {}, 'A board gives the figure a box of this size. One that moves to this release sees its box change.')
426
+ };
427
+ case 'motion-range-changed':
483
428
  return {
484
- message: say(key('message'), v, `The room the figure takes changed from ${v.before || 'none'} to ${v.after || 'none'}.`),
485
- why: say(key('why'), {}, 'A consumer places the figure by this room. One that moves to this release sees it take the new room.')
429
+ message: say(key('message'), v, `The room the figure sweeps as it moves changed from ${v.before || 'none'} to ${v.after || 'none'}.`),
430
+ why: say(key('why'), {}, 'It is what the figure reaches when it moves. One that moves to this release sees it reach differently.')
486
431
  };
487
432
  case 'contact-face-changed':
488
433
  return {