@elytracms/studio 0.0.102 → 0.0.103

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.
@@ -1 +1 @@
1
- {"version":3,"file":"writer-form.js","sourceRoot":"","sources":["../../../src/lib/ai/writer-form.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuDG;AACH,OAAO,EACL,oBAAoB,EACpB,cAAc,EACd,SAAS,EACT,WAAW,EACX,kBAAkB,EAClB,eAAe,EACf,WAAW,EACX,mBAAmB,EACnB,aAAa,EACb,oBAAoB,EACpB,cAAc,EACd,sBAAsB,EACtB,cAAc,EACd,kBAAkB,EAClB,YAAY,GACb,MAAM,0BAA0B,CAAA;AAcjC,OAAO,EAAE,kBAAkB,EAAE,4BAA4B,EAAE,MAAM,2BAA2B,CAAA;AAC5F,OAAO,EAAE,2BAA2B,EAAE,MAAM,mBAAmB,CAAA;AAY/D,MAAM,CAAC,MAAM,kBAAkB,GAAmB,EAAE,SAAS,EAAE,IAAI,GAAG,EAAE,EAAE,MAAM,EAAE,IAAI,GAAG,EAAE,EAAE,CAAA;AAE7F;;;;GAIG;AACH,MAAM,UAAU,gBAAgB,CAAC,QAAiC;IAChE,IAAI,CAAC,QAAQ;QAAE,OAAO,kBAAkB,CAAA;IACxC,MAAM,SAAS,GAAG,IAAI,GAAG,EAAuB,CAAA;IAChD,MAAM,MAAM,GAAG,IAAI,GAAG,EAAU,CAAA;IAChC,cAAc,CAAC,QAAQ,EAAE,CAAC,GAAG,EAAE,EAAE;QAC/B,IAAI,GAAG,CAAC,MAAM,CAAC,IAAI,KAAK,OAAO;YAAE,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC,CAAA;aACrD,IAAI,GAAG,CAAC,MAAM,CAAC,IAAI,KAAK,UAAU,EAAE,CAAC;YACxC,MAAM,GAAG,GAAG,SAAS,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AAG,QAAQ,CAAC,SAAS;QAClC,CAAC,CAAC,MAAM,CAAC,WAAW,CAChB,MAAM,CAAC,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE,EAAE,CAAC;YAC3D,MAAM;YACN,cAAc,CAAC,UAAU,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,CAAgB;SAC/D,CAAC,CACH;QACH,CAAC,CAAC,SAAS,CAAA;IACb,OAAO,EAAE,GAAG,QAAQ,EAAE,MAAM,EAAE,GAAG,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,SAAS,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAA;AACrE,CAAC;AAED;;;;;;;;;GASG;AACH,MAAM,UAAU,gBAAgB,CAC9B,UAAyB,EACzB,MAAyC,EACzC,UAAkB,EAClB,MAAiD,EAAE;IAEnD,OAAO,oBAAoB,CAAC,UAAU,EAAE,cAAc,CAAC,UAAU,EAAE,MAAM,EAAE,GAAG,CAAC,EAAE,UAAU,CAAC,CAAA;AAC9F,CAAC","sourcesContent":["/**\n * **THE AI writer-form converter pair** (EC-593, owner-ratified 2026-10-24 — EC-565\n * Round 4, 4c / 4e / 2c; closes EC-571, EC-562 and EC-570 #3).\n *\n * What a model WRITES is not what is stored: rich text is a markdown string, an asset a\n * bare library id (or its envelope when the position declares placement sub-fields), a\n * relation `{ collection, id }`. Every AI writer — create (`applyContentWithShape`), edit\n * (`buildUpdateProposal`), translate (`translateDocument`) — and the one AI reader\n * (`getDocument`'s output) cross that line here, and only here:\n *\n * - {@link fromWriterForm} — writer form → stored form at a position and EVERY position\n * below it;\n * - {@link toWriterForm} — stored form → the form the model reads (rich text as markdown\n * wherever it is faithfully expressible), at every position.\n *\n * Both are folds over core's ONE value-position traversal (`childPositions` /\n * `rebuildFromChildren`, EC-582): an object's sub-fields, each repeater item, an asset\n * placement's sub-fields, and every DECLARED prop of every component node inside a\n * `blocks` / `richText` value (top level, typography, slots — and below a prop). So a\n * nested position is converted by the same rule as a top-level one; there is no second\n * walk to forget a depth (the bug class EC-571 measured: create converted at every depth,\n * edit at the top level only, the read form and translate at the top level only).\n *\n * At every position the converter applies:\n * - **the id leash** (EC-381) — a relation or asset id must come from what the model\n * searched ({@link WriterLeash}, asked per position: a relation by its target, an asset\n * by its declaration's `accept`) or be one the document already references. Anything\n * else is REMOVED from the value and reported as a `leash` problem (create drops it,\n * edit refuses — the callers' ratified policies);\n * - **the placement carry** (EC-558, ratified 2c) — an asset swap keeps the placement's\n * per-use sub-fields through core's one rule (`carryAssetPlacements`), read from the\n * `current` value the caller passes: the DISPLAYED value of the bucket being written\n * (a new locale bucket carries from its fallback, as the pickers do);\n * - **the composition leash** (ratified 4c) — the AI writes content at every depth and\n * never composition STRUCTURE: a `blocks` value is never written whole\n * (`FIELD_TYPES.blocks.writer === 'composition'`), and a rich-text value must keep the\n * component nodes it holds (same ids, same components, same places). A component's\n * PROP is content — {@link fromWriterFormAtNode} changes one, by its node, at any depth\n * the traversal reaches;\n * - **the writer lock** (EC-716, owner ruling \"Yes, honour readOnly\") — a position core's\n * `writerLockOf` locks (`ai.exclude` or `form.readOnly`, and everything below it) keeps\n * its CURRENT value. Leaving it out of the written value, or echoing it back unchanged,\n * is no write; any other value is reported as a `locked` problem (create drops it, edit\n * refuses — the same two policies as the id leash);\n * - **the locked-content judge** (EC-738) — a write to a WRITABLE position must not erase\n * the locked content below it, which its own walk never visits: a holder omitted below\n * the write's root keeps its current value whole (omission is no write — and the model\n * may not know the holder holds anything, EC-741); an explicit removal (a root `null` /\n * omitted value, a nested `null`, a shorter list, a removed asset entry) of a holder whose\n * current value holds a defined locked value is a `locked` problem, located at the holder,\n * and the holder keeps its current value. A repeater whose items hold one cannot be\n * shortened at all (items are matched by index). Translate reuses the judge\n * ({@link withLockedFrom}, {@link lockedChanges}).\n *\n * Pure and deterministic; no provider, no I/O.\n */\nimport {\n carryAssetPlacements,\n childPositions,\n fieldPath,\n fieldTypeOf,\n fieldValuePosition,\n isSequenceValue,\n readAssetId,\n rebuildFromChildren,\n referenceNode,\n resolveDocumentTitle,\n seedObjectItem,\n sequenceComponentNodes,\n walkReferences,\n walkValuePositions,\n writerLockOf,\n} from '@elytracms/core/cms-core'\nimport type {\n AssetFieldDef,\n CmsDocument,\n CollectionDef,\n FieldDef,\n FieldValues,\n PositionContext,\n PropFieldLookup,\n RelationFieldDef,\n ValuePath,\n ValuePosition,\n WriterLock,\n} from '@elytracms/core/cms-core'\nimport { parseRichTextValue, richTextValueToMarkdownProse } from '@elytracms/core/rich-text'\nimport { richTextValueFromModelInput } from './rich-text-input'\nimport type { WriterLeash } from './types'\n\n// --- The context ---------------------------------------------------------------------\n\n/** The ids a document already references — reusable anywhere in it without a search. */\nexport interface HeldReferences {\n /** Referenced document ids, by collection. */\n readonly documents: ReadonlyMap<string, ReadonlySet<string>>\n readonly assets: ReadonlySet<string>\n}\n\nexport const NO_HELD_REFERENCES: HeldReferences = { documents: new Map(), assets: new Set() }\n\n/**\n * Every document and asset id a document references, read off THE reference walk\n * (EC-589) — at any depth. An id the document already holds is real (the leash exists\n * so a model cannot INVENT one), so it stays usable at any position without a search.\n */\nexport function heldReferencesOf(document: CmsDocument | undefined): HeldReferences {\n if (!document) return NO_HELD_REFERENCES\n const documents = new Map<string, Set<string>>()\n const assets = new Set<string>()\n walkReferences(document, (hit) => {\n if (hit.target.type === 'asset') assets.add(hit.target.id)\n else if (hit.target.type === 'document') {\n const ids = documents.get(hit.target.ref.collection) ?? new Set<string>()\n ids.add(hit.target.ref.id)\n documents.set(hit.target.ref.collection, ids)\n }\n })\n return { documents, assets }\n}\n\nexport interface WriterFormContext {\n /**\n * Component id → prop field-defs — the validator's own lookup\n * (`validateOptions.lookupManifest`, the canonical bag's), so the converter reaches\n * exactly the props the validator judges. Without it a composition has no prop\n * positions (and {@link fromWriterFormAtNode} refuses, loudly).\n */\n readonly lookupManifest?: PropFieldLookup\n /** What the model searched (absent → no searched ids). */\n readonly leash?: WriterLeash\n /** What the document already references ({@link heldReferencesOf}). */\n readonly held?: HeldReferences\n}\n\n/** One problem the conversion found, located at its position below the field value. */\nexport interface WriterFormProblem {\n /** Index-bearing location below the field value (`ValuePosition.at`). */\n readonly at: readonly (string | number)[]\n readonly code: 'invalid-field-value' | 'unknown-asset' | 'unknown-relation-target'\n readonly message: string\n /** An id outside the leash: it was REMOVED from the converted value. */\n readonly leash?: true\n /** A write to a writer-locked position (EC-716): the position KEPT its current value. */\n readonly locked?: true\n}\n\n/**\n * What a writer is told about a write to a locked position (EC-716) — one wording for the\n * create's dropped-value warning, the edit's refusal and a component prop's refusal.\n */\nexport function lockedWriteMessage(subjectText: string, lock: WriterLock): string {\n return lock === 'excluded'\n ? `${subjectText} must not be edited by the assistant.`\n : `${subjectText} is read-only — no one changes it in the studio, the assistant included.`\n}\n\nexport interface FromWriterFormResult {\n /** The stored form (`undefined` — clear the position). */\n readonly value: unknown\n readonly problems: readonly WriterFormProblem[]\n}\n\n// --- Writer form → stored form -------------------------------------------------------\n\n/**\n * Convert a value a model authored at `position` (its `value` is the WRITER form) into\n * the stored form, at that position and every position below it. `current` is the value\n * the write replaces — the DISPLAYED value of the bucket being written (ratified 2c) —\n * which the placement carry and the composition leash read. `null` / `undefined` clears.\n */\nexport function fromWriterForm(\n position: ValuePosition,\n current: unknown,\n ctx: WriterFormContext,\n): FromWriterFormResult {\n return convertRoot(position, current, ctx, position.field.name)\n}\n\n/** One write, rooted at `position`; `root` names the top-level field in messages. */\nfunction convertRoot(position: ValuePosition, current: unknown, ctx: WriterFormContext, root: string): FromWriterFormResult {\n const problems: WriterFormProblem[] = []\n const value = convert(position, current, ctx, problems, root, true)\n return { value, problems }\n}\n\n/** {@link fromWriterForm} for a top-level field's value. */\nexport function fromWriterFieldValue(\n field: FieldDef,\n raw: unknown,\n current: unknown,\n ctx: WriterFormContext,\n locale?: string,\n): FromWriterFormResult {\n return fromWriterForm(fieldValuePosition(field, raw, locale !== undefined ? { locale } : {}), current, ctx)\n}\n\nfunction isPlainRecord(value: unknown): value is Record<string, unknown> {\n return typeof value === 'object' && value !== null && !Array.isArray(value)\n}\n\n/** `title`, `card.image`, `menu[2].label`, `body.content[0].props.headline` — for messages. */\nfunction label(root: string, at: readonly (string | number)[]): string {\n return at.reduce<string>((out, key) => (typeof key === 'number' ? `${out}[${key}]` : `${out}.${key}`), root)\n}\n\n/** The model-facing name of a position: the field's own name, located when nested. */\nfunction subject(pos: ValuePosition, root: string): string {\n return pos.at.length === 0 ? `\"${pos.field.name}\"` : `\"${pos.field.name}\" (at ${label(root, pos.at)})`\n}\n\n/**\n * The structural fingerprint of a composition: which component nodes there are, nested\n * where (their component-ancestor chain), in order relative to each other. Prose between\n * them is content (a new paragraph before an embed shifts its index, not its place among\n * the components); adding, removing, re-nesting or reordering a component is structure.\n */\nfunction compositionOf(value: unknown): string {\n return sequenceComponentNodes(value)\n .map(({ node, chain }) => `${[...chain, node.id].join('/')}=${node.componentId}`)\n .join('|')\n}\n\n/** Key-order-insensitive JSON — \"is this the same value\" for a composition the writer may not change. */\nfunction canonicalJson(value: unknown): string {\n if (value === null || typeof value !== 'object') return JSON.stringify(value) ?? 'undefined'\n if (Array.isArray(value)) return `[${value.map(canonicalJson).join(',')}]`\n return `{${Object.entries(value as Record<string, unknown>)\n .filter(([, v]) => v !== undefined)\n .sort(([a], [b]) => (a < b ? -1 : a > b ? 1 : 0))\n .map(([k, v]) => `${JSON.stringify(k)}:${canonicalJson(v)}`)\n .join(',')}}`\n}\n\n/** The stable key matching a child position of the written value to the current value's. */\nfunction childKey(parent: ValuePosition, child: ValuePosition): string {\n // A prop by its node (ids are stable across a prose edit that shifts indices);\n // everything else by its location relative to the parent.\n return child.kind === 'prop' && child.component\n ? `node:${child.component.nodeId}:${child.field.name}`\n : `at:${JSON.stringify(child.at.slice(parent.at.length))}`\n}\n\n/** Convert every child position of `pos` (its value already in a readable shape). */\nfunction convertChildren(\n pos: ValuePosition,\n current: unknown,\n ctx: WriterFormContext,\n problems: WriterFormProblem[],\n root: string,\n): unknown {\n const positionCtx = ctx.lookupManifest ? { lookupManifest: ctx.lookupManifest } : {}\n const currentChildren = new Map<string, unknown>()\n if (current !== undefined) {\n for (const child of childPositions({ ...pos, value: current }, positionCtx)) {\n currentChildren.set(childKey(pos, child), child.value)\n }\n }\n return rebuildFromChildren(pos, positionCtx, (child) =>\n convert(child, currentChildren.get(childKey(pos, child)), ctx, problems, root, false),\n )\n}\n\n/**\n * `isRoot` — whether `pos` is the write's root (the field, or the prop a node change\n * names): there an omitted value CLEARS (`update-fields`: \"`null` / omitted clears\");\n * below it an omitted holder of locked content is kept whole (EC-738).\n */\nfunction convert(\n pos: ValuePosition,\n current: unknown,\n ctx: WriterFormContext,\n problems: WriterFormProblem[],\n root: string,\n isRoot: boolean,\n): unknown {\n // EC-716: a locked position keeps its current value — and so, by not being visited,\n // does everything below it (the lock cascades as the form's `readOnly` does).\n const lock = writerLockOf(pos.field)\n if (lock === undefined) return convertWritable(pos, current, ctx, problems, root, isRoot)\n if (pos.value === undefined || isEcho(pos, current, ctx, root)) return current\n problems.push({\n at: pos.at,\n code: 'invalid-field-value',\n message: lockedWriteMessage(`Field ${subject(pos, root)}`, lock),\n locked: true,\n })\n return current\n}\n\n/**\n * {@link convert} for a WRITABLE position, judged for the locked content below it (EC-738).\n * The conversion never visits a locked position its written value no longer holds (a\n * cleared object, a shortened list, a removed asset entry), so the judge compares the locked\n * values under the CURRENT value with those under the converted one.\n */\nfunction convertWritable(\n pos: ValuePosition,\n current: unknown,\n ctx: WriterFormContext,\n problems: WriterFormProblem[],\n root: string,\n isRoot: boolean,\n): unknown {\n if (!isPresent(current)) return convertValue(pos, current, ctx, problems, root)\n const positionCtx = ctx.lookupManifest ? { lookupManifest: ctx.lookupManifest } : {}\n const before = lockedPositionsUnder({ ...pos, value: current }, positionCtx)\n const held = [...before.values()].filter((entry) => isPresent(entry.value))\n if (held.length === 0) return convertValue(pos, current, ctx, problems, root)\n // An omission below the write's root is no write (EC-716's rule for a locked position,\n // applied to the holder of one): the holder keeps its current value, whole.\n if (!isRoot && pos.value === undefined) return current\n const next = convertValue(pos, current, ctx, problems, root)\n const lost = lockedLosses(before, lockedPositionsUnder({ ...pos, value: next }, positionCtx))\n // A repeater's items are matched by INDEX: removing one shifts every later item's\n // writable content onto the locked values of the item before it — invisible to a per-key\n // comparison, so any shortening of a repeater that holds locked content is refused.\n const shortened =\n pos.field.type === 'object' &&\n pos.field.multiple === true &&\n Array.isArray(current) &&\n (Array.isArray(next) ? next.length : 0) < current.length\n if (lost.length === 0 && !shortened) return next\n problems.push({\n at: pos.at,\n code: 'invalid-field-value',\n message: lockedRemovalMessage(subject(pos, root), root, lost.length > 0 ? lost : held, shortened),\n locked: true,\n })\n return current\n}\n\n// --- The locked-content judge (EC-738) -----------------------------------------------\n\n/** A value that is there (`undefined` / `null` — nothing to lose; the converter's own rule). */\nfunction isPresent(value: unknown): boolean {\n return value !== undefined && value !== null\n}\n\n/**\n * One writer-locked position under a value — the TOPMOST locked one on its branch (it stands\n * for everything below it, which is locked too) — with its value (possibly absent: the\n * position exists because its holder does), its lock and its location below the field.\n */\nexport interface LockedPosition {\n readonly value: unknown\n readonly lock: WriterLock\n readonly at: readonly (string | number)[]\n}\n\n/**\n * The key matching a child position across two values of one position: a component prop by\n * its NODE (ids are unique in a document and survive a prose edit that shifts indices), an\n * entry of an asset LIST by its asset id and occurrence (the carry's own matching,\n * `carryAssetPlacements` — a reordered gallery keeps each placement), anything else by its\n * location below the parent (a repeater item by index, a sub-field by name).\n */\nfunction lockedChildKey(parent: ValuePosition, parentKey: string, child: ValuePosition): string {\n if (child.kind === 'prop' && child.component) return `node:${child.component.nodeId}:${child.field.name}`\n const below = child.at.slice(parent.at.length)\n if (parent.field.type === 'asset' && parent.field.multiple !== false && Array.isArray(parent.value)) {\n const index = below[0] as number\n const entries = parent.value as unknown[]\n const id = readAssetId(entries[index])\n const occurrence = entries.slice(0, index).filter((entry) => readAssetId(entry) === id).length\n return `${parentKey}/asset:${JSON.stringify(id)}#${occurrence}/${JSON.stringify(below.slice(1))}`\n }\n return `${parentKey}/${JSON.stringify(below)}`\n}\n\n/** Every topmost writer-locked position at or below `position`, by {@link lockedChildKey}. */\nfunction lockedPositionsUnder(position: ValuePosition, positionCtx: PositionContext): Map<string, LockedPosition> {\n const out = new Map<string, LockedPosition>()\n const visit = (pos: ValuePosition, key: string): void => {\n const lock = writerLockOf(pos.field)\n if (lock !== undefined) {\n out.set(key, { value: pos.value, lock, at: pos.at })\n return\n }\n for (const child of childPositions(pos, positionCtx)) visit(child, lockedChildKey(pos, key, child))\n }\n visit(position, '')\n return out\n}\n\n/** The defined locked values of `before` that `after` does not hold, unchanged, at their key. */\nfunction lockedLosses(\n before: ReadonlyMap<string, LockedPosition>,\n after: ReadonlyMap<string, LockedPosition>,\n): LockedPosition[] {\n return [...before].flatMap(([key, entry]) => {\n if (!isPresent(entry.value)) return []\n const now = after.get(key)\n return now && isPresent(now.value) && canonicalJson(now.value) === canonicalJson(entry.value) ? [] : [entry]\n })\n}\n\n/**\n * What a writer is told about a write that would remove locked content (EC-738), located at\n * the HOLDER the model wrote. Read-only content is named (the model reads it); excluded\n * content never is (EC-741: the model never sees it, so naming its path would disclose it).\n */\nexport function lockedRemovalMessage(\n holder: string,\n root: string,\n locked: readonly LockedPosition[],\n shortened: boolean,\n): string {\n const excluded = locked.some((entry) => entry.lock === 'excluded')\n const what = excluded\n ? 'content the assistant must not change'\n : `read-only content (${locked.map((entry) => label(root, entry.at)).join(', ')}) — no one changes it in the studio, the assistant included`\n return shortened\n ? `Field ${holder} holds ${what}; the assistant cannot remove items from it (items are matched by position, so removing one would delete that content or move it onto another item). Keep every item and change only their other values.`\n : `Field ${holder} holds ${what}; the assistant cannot clear or remove it. Change only its other values.`\n}\n\n/**\n * The value at `position` with every writer-locked position taken from `current` by key\n * (EC-738, translate): where `current` holds that position — its value, an absent one\n * included — the current one wins; a position `current` does not hold at all (a new item, a\n * node it lacks) keeps `position`'s own. {@link lockedChanges} then says whether that kept\n * the locked content as it is.\n */\nexport function withLockedFrom(\n position: ValuePosition,\n current: unknown,\n ctx: Pick<WriterFormContext, 'lookupManifest'>,\n): unknown {\n const positionCtx = ctx.lookupManifest ? { lookupManifest: ctx.lookupManifest } : {}\n const held = lockedPositionsUnder({ ...position, value: current }, positionCtx)\n const rebuild = (pos: ValuePosition, key: string): unknown => {\n if (writerLockOf(pos.field) !== undefined) return held.has(key) ? held.get(key)!.value : pos.value\n return rebuildFromChildren(pos, positionCtx, (child) => rebuild(child, lockedChildKey(pos, key, child)))\n }\n return rebuild(position, '')\n}\n\n/**\n * The locked values a write from `position.value` (the CURRENT value) to `next` would lose or\n * create, judged both ways (EC-738, translate): `lost` — a defined locked value `next` does\n * not hold unchanged; `created` — a defined locked value `next` holds where the current value\n * holds none.\n */\nexport function lockedChanges(\n position: ValuePosition,\n next: unknown,\n ctx: Pick<WriterFormContext, 'lookupManifest'>,\n): { readonly lost: readonly LockedPosition[]; readonly created: readonly LockedPosition[] } {\n const positionCtx = ctx.lookupManifest ? { lookupManifest: ctx.lookupManifest } : {}\n const before = lockedPositionsUnder(position, positionCtx)\n const after = lockedPositionsUnder({ ...position, value: next }, positionCtx)\n return {\n lost: lockedLosses(before, after),\n created: [...after].flatMap(([key, entry]) =>\n isPresent(entry.value) && !isPresent(before.get(key)?.value) ? [entry] : [],\n ),\n }\n}\n\n/**\n * Whether a value written to a locked position leaves it as it is: a clear of an empty\n * position, or the current value echoed back — as stored, in the form the model READ it\n * in ({@link toWriterForm}: rich text as markdown), or in any writer form that converts to\n * exactly the stored value.\n */\nfunction isEcho(pos: ValuePosition, current: unknown, ctx: WriterFormContext, root: string): boolean {\n const written = pos.value\n if (written === null) return current === undefined || current === null\n if (current === undefined || current === null) return false\n const json = canonicalJson(written)\n if (json === canonicalJson(current)) return true\n if (json === canonicalJson(toWriterForm({ ...pos, value: current }, ctx))) return true\n const scratch: WriterFormProblem[] = []\n const stored = convertValue(pos, current, ctx, scratch, root)\n return scratch.length === 0 && canonicalJson(stored) === canonicalJson(current)\n}\n\n/**\n * A repeater's current value with every item the written list adds seeded the way a\n * manual \"add item\" seeds it (core's `seedObjectItem`), so a locked sub-field of a NEW item\n * keeps its default rather than staying empty (EC-716, sol-C 22 at item level). Items are\n * matched by index — the matching the converter uses for every repeater.\n */\nfunction withSeededItems(current: unknown, length: number, fields: readonly FieldDef[]): unknown {\n const items = Array.isArray(current) ? current : []\n if (items.length >= length) return current\n return [...items, ...Array.from({ length: length - items.length }, () => seedObjectItem(fields))]\n}\n\n/** {@link convert} for a position no lock holds: the writer form → the stored form. */\nfunction convertValue(\n pos: ValuePosition,\n current: unknown,\n ctx: WriterFormContext,\n problems: WriterFormProblem[],\n root: string,\n): unknown {\n const { field } = pos\n const raw = pos.value === null ? undefined : pos.value\n const report = (code: WriterFormProblem['code'], message: string, leash?: true): undefined => {\n problems.push({ at: pos.at, code, message, ...(leash ? { leash } : {}) })\n return undefined\n }\n\n switch (fieldTypeOf(field).writer) {\n case 'composition': {\n // 4c: a composition is never written whole — the value stays exactly what it is\n // (re-sending it unchanged is no change); its props change one at a time. EC-741:\n // \"unchanged\" includes the value as the model READ it ({@link toWriterForm}: excluded\n // props absent, rich-text props as markdown) — the rule `isEcho` reads.\n const json = canonicalJson(raw)\n if (json === canonicalJson(current)) return current\n if (current !== undefined && json === canonicalJson(toWriterForm({ ...pos, value: current }, ctx))) return current\n return report(\n 'invalid-field-value',\n `Field ${subject(pos, root)} is a page-builder composition: adding, reordering or removing its components is done on the canvas, not by the assistant. Change one component's prop with blockId + prop (the component's id from getDocument).`,\n )\n }\n\n case 'markdown': {\n let next: unknown = undefined\n if (raw !== undefined) {\n const parsed = richTextValueFromModelInput(raw)\n if (!parsed.ok) return report('invalid-field-value', `Field ${subject(pos, root)}: ${parsed.problems.join(' ')}`)\n // An echoed stored value may carry components: their props are positions too.\n next = convertChildren({ ...pos, value: parsed.value }, current, ctx, problems, root)\n }\n // 4c: prose is content, the components embedded in it are structure.\n if (compositionOf(next) !== compositionOf(current)) {\n return report(\n 'invalid-field-value',\n `Field ${subject(pos, root)} holds embedded components; the assistant cannot add, remove or move them (that is done in the editor). Send the value back as the stored { version: 2, content } object with every component node kept in place, or change a component's prop with blockId + prop.`,\n )\n }\n return next\n }\n\n case 'placement': {\n if (raw === undefined) return undefined\n const asset = field as AssetFieldDef\n const items = Array.isArray(raw) ? raw : [raw]\n const entries: { id: string; rest: Record<string, unknown> }[] = []\n for (const item of items) {\n if (typeof item === 'string' && item.length > 0) entries.push({ id: item, rest: {} })\n else if (\n isPlainRecord(item) &&\n typeof item.id === 'string' &&\n item.id.length > 0 &&\n (item.type === undefined || item.type === 'asset')\n ) {\n const { type: _type, id, ...rest } = item\n entries.push({ id: id as string, rest })\n } else {\n return report(\n 'invalid-field-value',\n `Asset field ${subject(pos, root)} takes asset id string(s) from listAssets results.`,\n )\n }\n }\n if (asset.multiple !== true && entries.length > 1) {\n return report('invalid-field-value', `Field ${subject(pos, root)} holds a single asset — pass one id.`)\n }\n // EC-381: the asset id leash — searched (fitting this position's `accept`) or\n // already on the document; the assistant never invents or uploads an asset.\n const allowed = new Set([\n ...(ctx.leash?.assetCandidates(asset) ?? []).map((candidate) => candidate.id),\n ...(ctx.held?.assets ?? []),\n ])\n const unknown = entries.filter((entry) => !allowed.has(entry.id))\n if (unknown.length > 0) {\n report(\n 'unknown-asset',\n `Asset field ${subject(pos, root)} may only use ids from listAssets results — search the media library first (got: ${unknown.map((e) => e.id).join(', ')}).`,\n true,\n )\n }\n const kept = entries.filter((entry) => allowed.has(entry.id))\n if (kept.length === 0) return undefined\n // EC-558 / 2c: the ONE carry rule — a held placement keeps its per-use sub-fields,\n // a swap carries them to the new image, a new id is an envelope.\n const carried = carryAssetPlacements(\n current,\n asset.multiple === true ? { multiple: true, ids: kept.map((e) => e.id) } : { multiple: false, id: kept[0]!.id },\n )\n // The writer's own sub-field values win over the carried ones.\n const withWriter = (entry: unknown, index: number): unknown => {\n const rest = kept[index]?.rest ?? {}\n if (Object.keys(rest).length === 0) return entry\n const base = isPlainRecord(entry) ? entry : { type: 'asset', id: kept[index]!.id }\n return { ...base, ...rest }\n }\n const merged = Array.isArray(carried) ? carried.map(withWriter) : withWriter(carried, 0)\n return convertChildren({ ...pos, value: merged }, carried, ctx, problems, root)\n }\n\n case 'reference': {\n if (raw === undefined) return undefined\n const relation = field as RelationFieldDef\n const items = Array.isArray(raw) ? raw : [raw]\n const ids: string[] = []\n for (const item of items) {\n const id = typeof item === 'string' ? item : isPlainRecord(item) && typeof item.id === 'string' ? item.id : undefined\n const collection = isPlainRecord(item) ? item.collection : undefined\n if (!id || (collection !== undefined && collection !== relation.target)) {\n return report(\n 'invalid-field-value',\n `Relation ${subject(pos, root)} takes document id string(s) from searchDocuments results.`,\n )\n }\n ids.push(id)\n }\n if (relation.multiple !== true && ids.length > 1) {\n return report('invalid-field-value', `Field ${subject(pos, root)} holds a single reference — pass one id.`)\n }\n // EC-378/EC-381: the relation id leash — searched in the target collection, or\n // already referenced by the document.\n const allowed = new Set([\n ...(ctx.leash?.relationCandidates(relation.target) ?? []).map((candidate) => candidate.id),\n ...(ctx.held?.documents.get(relation.target) ?? []),\n ])\n const unknown = ids.filter((id) => !allowed.has(id))\n if (unknown.length > 0) {\n report(\n 'unknown-relation-target',\n `Relation ${subject(pos, root)} may only use ids from searchDocuments results — search \"${relation.target}\" first (got: ${unknown.join(', ')}).`,\n true,\n )\n }\n const refs = ids.filter((id) => allowed.has(id)).map((id) => referenceNode({ collection: relation.target, id }))\n if (refs.length === 0) return undefined\n return relation.multiple === true ? refs : refs[0]\n }\n\n case 'object': {\n // A value of the wrong shape has no children; the validator names it.\n if (raw === undefined) return undefined\n const base =\n field.type === 'object' && field.multiple && Array.isArray(raw)\n ? withSeededItems(current, raw.length, field.fields)\n : current\n return convertChildren({ ...pos, value: raw }, base, ctx, problems, root)\n }\n\n case 'value':\n return raw\n }\n}\n\n// --- A component prop, by its node ---------------------------------------------------\n\nexport type FromWriterFormAtNodeResult =\n | {\n readonly ok: true\n /** The field's next value (the displayed value with the one prop converted). */\n readonly value: unknown\n /**\n * The position the change wrote, in the value-position grammar: the prop by its\n * node path where the grammar reaches it, else the coarsest addressable ancestor\n * — the field (bucket) itself (EC-595: a writer may always emit a coarser path).\n */\n readonly path: ValuePath\n /** The converted prop value when {@link path} is the prop itself (`undefined` — unset). */\n readonly propValue: unknown\n readonly exact: boolean\n readonly problems: readonly WriterFormProblem[]\n }\n | { readonly ok: false; readonly message: string }\n\n/**\n * Change ONE component prop, addressed by its node id and prop name, inside a field's\n * value — at ANY depth the traversal reaches: a top-level block, a child in a section's\n * slot, a component embedded in rich text, a component inside an object's rich text or\n * inside another component's prop. The prop's writer form goes through\n * {@link fromWriterForm} with the prop's current value (carry + leash at that position),\n * and the field value is rebuilt by the traversal's writing fold. Nothing else in the\n * value changes — no other prop, no node, no prose.\n */\nexport function fromWriterFormAtNode(\n field: FieldDef,\n displayed: unknown,\n nodeId: string,\n prop: string,\n raw: unknown,\n ctx: WriterFormContext,\n locale?: string,\n): FromWriterFormAtNodeResult {\n if (!ctx.lookupManifest) {\n return {\n ok: false,\n message: `Component props cannot be changed here: the project's components are not available to judge \"${prop}\".`,\n }\n }\n const positionCtx = { lookupManifest: ctx.lookupManifest }\n const root = fieldValuePosition(field, displayed, locale !== undefined ? { locale } : {})\n const isTarget = (position: ValuePosition) =>\n position.kind === 'prop' && position.component?.nodeId === nodeId && position.field.name === prop\n let target: ValuePosition | undefined\n // EC-716: the lock the target sits under — its own, or the nearest locked ancestor's\n // (a component embedded in a read-only rich-text prop, a prop of a locked object…).\n let targetLock: WriterLock | undefined\n const declared: string[] = []\n let componentId: string | undefined\n const visit = (position: ValuePosition, inherited: WriterLock | undefined): void => {\n const lock = writerLockOf(position.field) ?? inherited\n if (position.kind === 'prop' && position.component?.nodeId === nodeId) {\n componentId = position.component.componentId\n declared.push(position.field.name)\n if (target === undefined && position.field.name === prop) {\n target = position\n targetLock = lock\n }\n }\n for (const child of childPositions(position, positionCtx)) visit(child, lock)\n }\n visit(root, undefined)\n if (target && targetLock !== undefined) {\n return {\n ok: false,\n message: lockedWriteMessage(`Prop \"${prop}\" of component \"${nodeId}\" (${componentId})`, targetLock),\n }\n }\n if (!target) {\n if (componentId === undefined) {\n return {\n ok: false,\n message: `Component \"${nodeId}\" was not found in \"${field.name}\" (or its component declares no props) — read the document first; component ids come from getDocument.`,\n }\n }\n return {\n ok: false,\n message: `Component \"${nodeId}\" (${componentId}) has no prop \"${prop}\" — its props are: ${declared.join(', ')}.`,\n }\n }\n const found = target\n // The prop is the write's ROOT (an omitted value clears it); messages locate positions\n // from the top-level field (`body.content[0].props.group.locked`).\n const { value: converted, problems } = convertRoot({ ...found, value: raw }, found.value, ctx, field.name)\n const rebuild = (position: ValuePosition): unknown =>\n rebuildFromChildren(position, positionCtx, (child) => (isTarget(child) ? converted : rebuild(child)))\n const value = rebuild(root)\n return found.exact\n ? { ok: true, value, path: found.path, propValue: converted, exact: true, problems }\n : { ok: true, value, path: fieldPath(field.name, locale), propValue: undefined, exact: false, problems }\n}\n\n// --- The text positions (translate) --------------------------------------------------\n\n/** Whether a field-def holds TEXT a translation turns into units: plain text, or a sequence. */\nexport function isTextPosition(position: ValuePosition): boolean {\n const { type } = position.field\n return type === 'text' || type === 'richText' || type === 'blocks'\n}\n\n/** EC-716: a writer-locked position — no unit, no write, nothing below it either. */\nfunction isLocked(position: ValuePosition): boolean {\n return writerLockOf(position.field) !== undefined\n}\n\n/**\n * Every TEXT position at or below `position` (EC-593, ratified 4e — \"translate uses the\n * same traversal\"): a `text` value, and a `richText` / `blocks` sequence (its prose —\n * the sequence's own text — is the caller's to split) together with every text position\n * below it: component text props in a composition and in rich-text embeds, object\n * sub-fields, repeater items, asset placement sub-fields. A writer-locked position\n * (EC-716: `ai.exclude` or `form.readOnly`) and everything below it is not text a writer\n * may touch — not a unit, and so never a skip either. Depth-first, document order.\n */\nexport function textPositionsOf(\n position: ValuePosition,\n ctx: Pick<WriterFormContext, 'lookupManifest'>,\n): ValuePosition[] {\n const positionCtx = ctx.lookupManifest ? { lookupManifest: ctx.lookupManifest } : {}\n const out: ValuePosition[] = []\n const visit = (current: ValuePosition): void => {\n if (isLocked(current)) return\n if (isTextPosition(current)) out.push(current)\n if (current.field.type === 'text') return\n for (const child of childPositions(current, positionCtx)) visit(child)\n }\n visit(position)\n return out\n}\n\n/**\n * The writing fold over {@link textPositionsOf}: the value at `position` with each text\n * position's value replaced by `replace(textPosition)` — for a sequence, its own value\n * first (its prose), then the text positions below it, read off the REPLACED value (a\n * component keeps its node id, so its props are found again). Every other value — an\n * image, a select, a component's structure — comes back as it was (identity-preserving).\n */\nexport function rebuildTextPositions(\n position: ValuePosition,\n ctx: Pick<WriterFormContext, 'lookupManifest'>,\n replace: (textPosition: ValuePosition) => unknown,\n): unknown {\n const positionCtx = ctx.lookupManifest ? { lookupManifest: ctx.lookupManifest } : {}\n const rebuild = (current: ValuePosition): unknown => {\n if (isLocked(current)) return current.value\n if (current.field.type === 'text') return replace(current)\n const value = isTextPosition(current) ? replace(current) : current.value\n return rebuildFromChildren({ ...current, value }, positionCtx, rebuild)\n }\n return rebuild(position)\n}\n\n// --- Stored form → the read (writer) form --------------------------------------------\n\n/**\n * The form a model READS a stored value in — the mirror of {@link fromWriterForm}, so\n * what `getDocument` shows is what `updateFields` takes back: rich text as a markdown\n * string wherever the engine's loss-guarded inverse can express it faithfully (no\n * embedded components, subset-only marks — else the stored `{ version: 2, content }`\n * stays, so nothing echoed back can silently lose structure), at EVERY position: a\n * top-level field, an object sub-field, a repeater item, a component's rich-text prop.\n * Everything else reads as stored (envelopes are writer forms too).\n *\n * **THE model-read projection** (EC-741): a position core's `writerLockOf` marks\n * `excluded` (`ai: { exclude: true }` — \"the model never sees or writes the field\") reads\n * as ABSENT, and so does everything below it, at every depth: a sub-field, a repeater\n * item's sub-field, a placement sub-field, a component prop in a composition, a slot or\n * typography content. A `read-only` position stays readable. Every model read crosses this\n * one fold — `getDocument`'s output, the titles the model is shown\n * ({@link modelFacingTitle}) and the echo checks (a value the model read and sent back is\n * no change) — so what the model can see and what it can echo are one declaration. The raw\n * stored document stays local: proposals are always built and validated against it.\n */\nexport function toWriterForm(\n position: ValuePosition,\n ctx: Pick<WriterFormContext, 'lookupManifest'>,\n): unknown {\n if (writerLockOf(position.field) === 'excluded') return undefined\n const { value } = position\n if (value === undefined || value === null) return value\n const positionCtx = ctx.lookupManifest ? { lookupManifest: ctx.lookupManifest } : {}\n if (fieldTypeOf(position.field).writer === 'markdown' && isSequenceValue(value)) {\n const parsed = parseRichTextValue(value)\n const markdown = parsed.ok ? richTextValueToMarkdownProse(parsed.value) : undefined\n if (markdown !== undefined) return markdown\n }\n return rebuildFromChildren(position, positionCtx, (child) => toWriterForm(child, ctx))\n}\n\n/**\n * The components a document holds whose props a writer may change — every component\n * the traversal reaches a DECLARED prop of, in every field of every bucket, at any depth\n * — in first-seen order. What the `getDocument` output's prop catalog lists.\n */\nexport function componentIdsOf(\n collection: CollectionDef,\n document: CmsDocument,\n lookupManifest: PropFieldLookup,\n): string[] {\n const ids = new Set<string>()\n const byName = new Map(collection.fields.map((field) => [field.name, field]))\n const visitBucket = (bucket: FieldValues) => {\n for (const [name, value] of Object.entries(bucket)) {\n const field = byName.get(name)\n if (!field) continue\n walkValuePositions(fieldValuePosition(field, value), { lookupManifest }, (position) => {\n if (position.kind === 'prop' && position.component) ids.add(position.component.componentId)\n })\n }\n }\n visitBucket(document.values)\n for (const bucket of Object.values(document.localized ?? {})) visitBucket(bucket)\n return [...ids]\n}\n\n/**\n * {@link toWriterForm} over one values bag: each declared field in its read form, an\n * excluded one (and an excluded position inside any field) left out. A key the collection\n * does not declare reads as stored (AD-14: the schema is a lens).\n */\nexport function toWriterValues(\n collection: CollectionDef,\n bag: Readonly<Record<string, unknown>>,\n ctx: Pick<WriterFormContext, 'lookupManifest'>,\n locale?: string,\n): Record<string, unknown> {\n let next: Record<string, unknown> | undefined\n for (const field of collection.fields) {\n if (!Object.hasOwn(bag, field.name)) continue\n const value = bag[field.name]\n const read = toWriterForm(fieldValuePosition(field, value, locale !== undefined ? { locale } : {}), ctx)\n if (read === value) continue\n next ??= { ...bag }\n if (read === undefined) delete next[field.name]\n else next[field.name] = read\n }\n return next ?? (bag as Record<string, unknown>)\n}\n\n/** {@link toWriterForm} over every field of every bucket of a document. */\nexport function toWriterDocument(\n collection: CollectionDef,\n document: CmsDocument,\n ctx: Pick<WriterFormContext, 'lookupManifest'>,\n): CmsDocument {\n const values = toWriterValues(collection, document.values, ctx) as FieldValues\n const localized = document.localized\n ? Object.fromEntries(\n Object.entries(document.localized).map(([locale, bucket]) => [\n locale,\n toWriterValues(collection, bucket, ctx, locale) as FieldValues,\n ]),\n )\n : undefined\n return { ...document, values, ...(localized ? { localized } : {}) }\n}\n\n/**\n * The title a MODEL is shown for a document (EC-741) — core's `resolveDocumentTitle` over\n * the projected values ({@link toWriterValues}), so an excluded field never reaches the\n * model as a title: neither as the named or first-field fallback, nor through a function\n * `titleField` that reads it (the function sees the field absent). Every title the model\n * reads goes through here: the `updateFields` / `createDocument` outputs, the\n * `searchDocuments` results (their query is matched against this title too, so an\n * excluded value cannot be probed by search) and the system prompt's \"currently open\"\n * line. `values` is the bag the caller resolves titles from (a locale's merged values).\n */\nexport function modelFacingTitle(\n collection: CollectionDef,\n values: Readonly<Record<string, unknown>>,\n fallbackId: string,\n ctx: Pick<WriterFormContext, 'lookupManifest'> = {},\n): string {\n return resolveDocumentTitle(collection, toWriterValues(collection, values, ctx), fallbackId)\n}\n"]}
1
+ {"version":3,"file":"writer-form.js","sourceRoot":"","sources":["../../../src/lib/ai/writer-form.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+DG;AACH,OAAO,EACL,oBAAoB,EACpB,cAAc,EACd,kBAAkB,EA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;IACD,OAAO,IAAI,IAAK,GAA+B,CAAA;AACjD,CAAC;AAED,2EAA2E;AAC3E,MAAM,UAAU,gBAAgB,CAC9B,UAAyB,EACzB,QAAqB,EACrB,GAA8C;IAE9C,MAAM,MAAM,GAAG,cAAc,CAAC,UAAU,EAAE,QAAQ,CAAC,MAAM,EAAE,GAAG,CAAgB,CAAA;IAC9E,MAAM,SAAS,GAAG,QAAQ,CAAC,SAAS;QAClC,CAAC,CAAC,MAAM,CAAC,WAAW,CAChB,MAAM,CAAC,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE,EAAE,CAAC;YAC3D,MAAM;YACN,cAAc,CAAC,UAAU,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,CAAgB;SAC/D,CAAC,CACH;QACH,CAAC,CAAC,SAAS,CAAA;IACb,OAAO,EAAE,GAAG,QAAQ,EAAE,MAAM,EAAE,GAAG,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,SAAS,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAA;AACrE,CAAC;AAED;;;;;;;;;GASG;AACH,MAAM,UAAU,gBAAgB,CAC9B,UAAyB,EACzB,MAAyC,EACzC,UAAkB,EAClB,MAAiD,EAAE;IAEnD,OAAO,oBAAoB,CAAC,UAAU,EAAE,cAAc,CAAC,UAAU,EAAE,MAAM,EAAE,GAAG,CAAC,EAAE,UAAU,CAAC,CAAA;AAC9F,CAAC","sourcesContent":["/**\n * **THE AI writer-form converter pair** (EC-593, owner-ratified 2026-10-24 — EC-565\n * Round 4, 4c / 4e / 2c; closes EC-571, EC-562 and EC-570 #3).\n *\n * What a model WRITES is not what is stored: rich text is a markdown string, an asset a\n * bare library id (or its envelope when the position declares placement sub-fields), a\n * relation `{ collection, id }`. Every AI writer — create (`applyContentWithShape`), edit\n * (`buildUpdateProposal`), translate (`translateDocument`) — and the one AI reader\n * (`getDocument`'s output) cross that line here, and only here:\n *\n * - {@link fromWriterForm} — writer form → stored form at a position and EVERY position\n * below it;\n * - {@link toWriterForm} — stored form → the form the model reads (rich text as markdown\n * wherever it is faithfully expressible), at every position.\n *\n * Both are folds over core's ONE value-position traversal (`childPositions` /\n * `rebuildFromChildren`, EC-582): an object's sub-fields, each repeater item, an asset\n * placement's sub-fields, and every DECLARED prop of every component node inside a\n * `blocks` / `richText` value (top level, typography, slots — and below a prop). So a\n * nested position is converted by the same rule as a top-level one; there is no second\n * walk to forget a depth (the bug class EC-571 measured: create converted at every depth,\n * edit at the top level only, the read form and translate at the top level only).\n *\n * At every position the converter applies:\n * - **the id leash** (EC-381) — a relation or asset id must come from what the model\n * searched ({@link WriterLeash}, asked per position: a relation by its target, an asset\n * by its declaration's `accept`) or be one the document already references. Anything\n * else is REMOVED from the value and reported as a `leash` problem (create drops it,\n * edit refuses — the callers' ratified policies);\n * - **the placement carry** (EC-558, ratified 2c) — an asset swap keeps the placement's\n * per-use sub-fields through core's one rule (`carryAssetPlacements`), read from the\n * `current` value the caller passes: the DISPLAYED value of the bucket being written\n * (a new locale bucket carries from its fallback, as the pickers do);\n * - **the composition leash** (ratified 4c) — the AI writes content at every depth and\n * never composition STRUCTURE: a `blocks` value is never written whole\n * (`FIELD_TYPES.blocks.writer === 'composition'`), and a rich-text value must keep the\n * component nodes it holds (same ids, same components, same places). A component's\n * PROP is content — {@link fromWriterFormAtNode} changes one, by its node, at any depth\n * the traversal reaches;\n * - **the writer lock** (EC-716, owner ruling \"Yes, honour readOnly\") — a position core's\n * `writerLockOf` locks (`ai.exclude` or `form.readOnly`, and everything below it) keeps\n * its CURRENT value. Leaving it out of the written value, or echoing it back unchanged,\n * is no write; any other value is reported as a `locked` problem (create drops it, edit\n * refuses — the same two policies as the id leash);\n * - **the locked-content judge** (EC-738) — a write to a WRITABLE position must not erase\n * the locked content below it, which its own walk never visits: a holder omitted below\n * the write's root keeps its current value whole (omission is no write — and the model\n * may not know the holder holds anything, EC-741); an explicit removal (a root `null` /\n * omitted value, a nested `null`, a shorter list, a removed asset entry) of a holder whose\n * current value holds a defined locked value is a `locked` problem, located at the holder,\n * and the holder keeps its current value. A repeater whose items hold one cannot be\n * shortened at all (items are matched by index). Translate reuses the judge\n * ({@link withLockedFrom}, {@link lockedChanges});\n * - **the unreadable value** (EC-748, Codex r9 F44) — a stored value the traversal cannot\n * read (a holder of the other cardinality after a schema edit, a repeater item that is no\n * object, a body that is no v2 sequence, a body read without the prop lookup, …) is\n * judged by its DECLARATION (`declarationMayHold`, failing closed on bodies), never read\n * as empty: the model read WITHHOLDS it when it may hold an excluded value, and a write\n * that would change or clear it is REFUSED when it may hold a locked one — until a non-AI\n * save stores it in its canonical form. A value the MODEL writes in a shape its\n * declaration does not read is refused too (nothing below it could be leashed or judged).\n *\n * Pure and deterministic; no provider, no I/O.\n */\nimport {\n carryAssetPlacements,\n childPositions,\n declarationMayHold,\n fieldPath,\n fieldTypeOf,\n fieldValuePosition,\n isOpaquePosition,\n isSequenceValue,\n readAssetId,\n rebuildFromChildren,\n referenceNode,\n resolveDocumentTitle,\n seedObjectItem,\n selfTypeFieldValue,\n sequenceComponentNodes,\n walkReferences,\n walkValuePositions,\n writerLockOf,\n} from '@elytracms/core/cms-core'\nimport type {\n AssetFieldDef,\n CmsDocument,\n CollectionDef,\n FieldDef,\n FieldValues,\n OpaquePosition,\n OpaqueReason,\n PositionContext,\n PropFieldLookup,\n RelationFieldDef,\n ValuePath,\n ValuePosition,\n WriterLock,\n} from '@elytracms/core/cms-core'\nimport { parseRichTextValue, richTextValueToMarkdownProse } from '@elytracms/core/rich-text'\nimport { richTextValueFromModelInput } from './rich-text-input'\nimport type { WriterLeash } from './types'\n\n// --- The context ---------------------------------------------------------------------\n\n/** The ids a document already references — reusable anywhere in it without a search. */\nexport interface HeldReferences {\n /** Referenced document ids, by collection. */\n readonly documents: ReadonlyMap<string, ReadonlySet<string>>\n readonly assets: ReadonlySet<string>\n}\n\nexport const NO_HELD_REFERENCES: HeldReferences = { documents: new Map(), assets: new Set() }\n\n/**\n * Every document and asset id a document references, read off THE reference walk\n * (EC-589) — at any depth. An id the document already holds is real (the leash exists\n * so a model cannot INVENT one), so it stays usable at any position without a search.\n */\nexport function heldReferencesOf(document: CmsDocument | undefined): HeldReferences {\n if (!document) return NO_HELD_REFERENCES\n const documents = new Map<string, Set<string>>()\n const assets = new Set<string>()\n walkReferences(document, (hit) => {\n if (hit.target.type === 'asset') assets.add(hit.target.id)\n else if (hit.target.type === 'document') {\n const ids = documents.get(hit.target.ref.collection) ?? new Set<string>()\n ids.add(hit.target.ref.id)\n documents.set(hit.target.ref.collection, ids)\n }\n })\n return { documents, assets }\n}\n\nexport interface WriterFormContext {\n /**\n * Component id → prop field-defs — the validator's own lookup\n * (`validateOptions.lookupManifest`, the canonical bag's), so the converter reaches\n * exactly the props the validator judges. Without it a composition has no prop\n * positions (and {@link fromWriterFormAtNode} refuses, loudly).\n */\n readonly lookupManifest?: PropFieldLookup\n /** What the model searched (absent → no searched ids). */\n readonly leash?: WriterLeash\n /** What the document already references ({@link heldReferencesOf}). */\n readonly held?: HeldReferences\n}\n\n/** One problem the conversion found, located at its position below the field value. */\nexport interface WriterFormProblem {\n /** Index-bearing location below the field value (`ValuePosition.at`). */\n readonly at: readonly (string | number)[]\n readonly code: 'invalid-field-value' | 'unknown-asset' | 'unknown-relation-target'\n readonly message: string\n /** An id outside the leash: it was REMOVED from the converted value. */\n readonly leash?: true\n /** A write to a writer-locked position (EC-716): the position KEPT its current value. */\n readonly locked?: true\n}\n\n/**\n * What a writer is told about a write to a locked position (EC-716) — one wording for the\n * create's dropped-value warning, the edit's refusal and a component prop's refusal.\n */\nexport function lockedWriteMessage(subjectText: string, lock: WriterLock): string {\n return lock === 'excluded'\n ? `${subjectText} must not be edited by the assistant.`\n : `${subjectText} is read-only — no one changes it in the studio, the assistant included.`\n}\n\nexport interface FromWriterFormResult {\n /** The stored form (`undefined` — clear the position). */\n readonly value: unknown\n readonly problems: readonly WriterFormProblem[]\n}\n\n// --- Writer form → stored form -------------------------------------------------------\n\n/**\n * Convert a value a model authored at `position` (its `value` is the WRITER form) into\n * the stored form, at that position and every position below it. `current` is the value\n * the write replaces — the DISPLAYED value of the bucket being written (ratified 2c) —\n * which the placement carry and the composition leash read. `null` / `undefined` clears.\n */\nexport function fromWriterForm(\n position: ValuePosition,\n current: unknown,\n ctx: WriterFormContext,\n): FromWriterFormResult {\n return convertRoot(position, current, ctx, position.field.name)\n}\n\n/** One write, rooted at `position`; `root` names the top-level field in messages. */\nfunction convertRoot(position: ValuePosition, current: unknown, ctx: WriterFormContext, root: string): FromWriterFormResult {\n const problems: WriterFormProblem[] = []\n const value = convert(position, current, ctx, problems, root, true)\n return { value, problems }\n}\n\n/** {@link fromWriterForm} for a top-level field's value. */\nexport function fromWriterFieldValue(\n field: FieldDef,\n raw: unknown,\n current: unknown,\n ctx: WriterFormContext,\n locale?: string,\n): FromWriterFormResult {\n return fromWriterForm(fieldValuePosition(field, raw, locale !== undefined ? { locale } : {}), current, ctx)\n}\n\nfunction isPlainRecord(value: unknown): value is Record<string, unknown> {\n return typeof value === 'object' && value !== null && !Array.isArray(value)\n}\n\n/** `title`, `card.image`, `menu[2].label`, `body.content[0].props.headline` — for messages. */\nfunction label(root: string, at: readonly (string | number)[]): string {\n return at.reduce<string>((out, key) => (typeof key === 'number' ? `${out}[${key}]` : `${out}.${key}`), root)\n}\n\n/** The model-facing name of a position: the field's own name, located when nested. */\nfunction subject(pos: ValuePosition, root: string): string {\n return pos.at.length === 0 ? `\"${pos.field.name}\"` : `\"${pos.field.name}\" (at ${label(root, pos.at)})`\n}\n\n/**\n * The structural fingerprint of a composition: which component nodes there are, nested\n * where (their component-ancestor chain), in order relative to each other. Prose between\n * them is content (a new paragraph before an embed shifts its index, not its place among\n * the components); adding, removing, re-nesting or reordering a component is structure.\n */\nfunction compositionOf(value: unknown): string {\n return sequenceComponentNodes(value)\n .map(({ node, chain }) => `${[...chain, node.id].join('/')}=${node.componentId}`)\n .join('|')\n}\n\n/** Key-order-insensitive JSON — \"is this the same value\" for a composition the writer may not change. */\nfunction canonicalJson(value: unknown): string {\n if (value === null || typeof value !== 'object') return JSON.stringify(value) ?? 'undefined'\n if (Array.isArray(value)) return `[${value.map(canonicalJson).join(',')}]`\n return `{${Object.entries(value as Record<string, unknown>)\n .filter(([, v]) => v !== undefined)\n .sort(([a], [b]) => (a < b ? -1 : a > b ? 1 : 0))\n .map(([k, v]) => `${JSON.stringify(k)}:${canonicalJson(v)}`)\n .join(',')}}`\n}\n\n/** The stable key matching a child position of the written value to the current value's. */\nfunction childKey(parent: ValuePosition, child: ValuePosition): string {\n // A prop by its node (ids are stable across a prose edit that shifts indices);\n // everything else by its location relative to the parent.\n return child.kind === 'prop' && child.component\n ? `node:${child.component.nodeId}:${child.field.name}`\n : `at:${JSON.stringify(child.at.slice(parent.at.length))}`\n}\n\n/** {@link childKey} for a value the traversal cannot read, in its own key space (EC-748). */\nfunction opaqueChildKey(parent: ValuePosition, child: OpaquePosition): string {\n return child.opaque === 'not-a-static-prop' && child.component\n ? `opaque:node:${child.component.nodeId}:${child.declaration.name}`\n : `opaque:at:${JSON.stringify(child.at.slice(parent.at.length))}`\n}\n\n/** The model-facing name of an unreadable value: its declaration's name, located when nested. */\nfunction opaqueSubject(position: OpaquePosition, root: string): string {\n const name = `\"${position.declaration.name}\"`\n return position.at.length === 0 ? name : `${name} (at ${label(root, position.at)})`\n}\n\n/**\n * What a writer is told about a value it wrote in a shape the declaration does not read\n * (EC-748): nothing below it could be converted, leashed or judged for locks, so it is not\n * written — said in the shape the field does take.\n */\nfunction unreadableWriteMessage(position: OpaquePosition, root: string): string {\n const what = `Field ${opaqueSubject(position, root)}`\n switch (position.opaque) {\n case 'cardinality':\n return Array.isArray(position.value)\n ? `${what} holds one value, not a list — send the value itself.`\n : `${what} holds a list — send a list.`\n case 'not-an-object':\n return `${what} takes an object of its declared sub-fields.`\n case 'not-an-asset':\n return `${what} takes asset id string(s) from listAssets results.`\n case 'not-a-sequence':\n return `${what} takes rich text as markdown, or the stored { version: 2, content } object.`\n case 'not-a-static-prop':\n return `${what} is a component prop stored as no { value } member; the assistant cannot write it.`\n case 'no-prop-declarations':\n return `${what} holds components whose props cannot be judged here: the project's components are not available.`\n }\n}\n\n/** Convert every child position of `pos` (its value already in a readable shape). */\nfunction convertChildren(\n pos: ValuePosition,\n current: unknown,\n ctx: WriterFormContext,\n problems: WriterFormProblem[],\n root: string,\n): unknown {\n const positionCtx = ctx.lookupManifest ? { lookupManifest: ctx.lookupManifest } : {}\n const currentChildren = new Map<string, unknown>()\n if (current !== undefined) {\n for (const child of childPositions({ ...pos, value: current }, positionCtx)) {\n if (isOpaquePosition(child)) currentChildren.set(opaqueChildKey(pos, child), child.value)\n else currentChildren.set(childKey(pos, child), child.value)\n }\n }\n return rebuildFromChildren(\n pos,\n positionCtx,\n (child) => convert(child, currentChildren.get(childKey(pos, child)), ctx, problems, root, false),\n // EC-748: a value the model wrote in a shape its declaration does not read — nothing\n // below it can be converted, leashed or judged for locks (a list written for a single\n // object would reach a locked sub-field through the canonicaliser's unwrap). The stored\n // value echoed back, unchanged, is no write; anything else is a problem, and not written.\n (unreadable) => {\n const stored = currentChildren.get(opaqueChildKey(pos, unreadable))\n if (stored !== undefined && canonicalJson(stored) === canonicalJson(unreadable.value)) return unreadable.value\n problems.push({ at: unreadable.at, code: 'invalid-field-value', message: unreadableWriteMessage(unreadable, root) })\n return undefined\n },\n )\n}\n\n/**\n * `isRoot` — whether `pos` is the write's root (the field, or the prop a node change\n * names): there an omitted value CLEARS (`update-fields`: \"`null` / omitted clears\");\n * below it an omitted holder of locked content is kept whole (EC-738).\n */\nfunction convert(\n pos: ValuePosition,\n current: unknown,\n ctx: WriterFormContext,\n problems: WriterFormProblem[],\n root: string,\n isRoot: boolean,\n): unknown {\n // EC-716: a locked position keeps its current value — and so, by not being visited,\n // does everything below it (the lock cascades as the form's `readOnly` does).\n const lock = writerLockOf(pos.field)\n if (lock === undefined) {\n const written = convertWritable(pos, current, ctx, problems, root, isRoot)\n // EC-748: a component prop is judged against its canonical form (THE drift issue, at prop\n // depth), and a proposal's write does not re-canonicalise props (update-fields: it would\n // rewrite every untouched node's wrappers) — so a prop the converter WRITES is stored in\n // its canonical form here, by the write lens itself (`writeField` does it for a field): a\n // multi-select's lone option becomes a list, an emptied list or sequence absent. A value\n // kept as it is (`current`) is never rewritten.\n if (pos.kind !== 'prop' || written === current || written === undefined) return written\n return selfTypeFieldValue(pos.field, written, ctx.lookupManifest ? { lookupManifest: ctx.lookupManifest } : {})\n }\n if (pos.value === undefined || isEcho(pos, current, ctx, root)) return current\n problems.push({\n at: pos.at,\n code: 'invalid-field-value',\n message: lockedWriteMessage(`Field ${subject(pos, root)}`, lock),\n locked: true,\n })\n return current\n}\n\n/**\n * {@link convert} for a WRITABLE position, judged for the locked content below it (EC-738).\n * The conversion never visits a locked position its written value no longer holds (a\n * cleared object, a shortened list, a removed asset entry), so the judge compares the locked\n * values under the CURRENT value with those under the converted one.\n */\nfunction convertWritable(\n pos: ValuePosition,\n current: unknown,\n ctx: WriterFormContext,\n problems: WriterFormProblem[],\n root: string,\n isRoot: boolean,\n): unknown {\n if (!isPresent(current)) return convertValue(pos, current, ctx, problems, root)\n const positionCtx = ctx.lookupManifest ? { lookupManifest: ctx.lookupManifest } : {}\n const before = lockedPositionsUnder({ ...pos, value: current }, positionCtx)\n const held = [...before.values()].filter((entry) => isPresent(entry.value))\n if (held.length === 0) return convertValue(pos, current, ctx, problems, root)\n // An omission below the write's root is no write (EC-716's rule for a locked position,\n // applied to the holder of one): the holder keeps its current value, whole.\n if (!isRoot && pos.value === undefined) return current\n const next = convertValue(pos, current, ctx, problems, root)\n const lost = lockedLosses(before, lockedPositionsUnder({ ...pos, value: next }, positionCtx))\n // A repeater's items are matched by INDEX: removing one shifts every later item's\n // writable content onto the locked values of the item before it — invisible to a per-key\n // comparison, so any shortening of a repeater that holds locked content is refused.\n const shortened =\n pos.field.type === 'object' &&\n pos.field.multiple === true &&\n Array.isArray(current) &&\n (Array.isArray(next) ? next.length : 0) < current.length\n if (lost.length === 0 && !shortened) return next\n const judged = lost.length > 0 ? lost : held\n problems.push({\n at: pos.at,\n code: 'invalid-field-value',\n message: judged.some((entry) => entry.opaque !== undefined)\n ? unreadableLockedMessage(subject(pos, root), root, judged)\n : lockedRemovalMessage(subject(pos, root), root, judged, shortened),\n locked: true,\n })\n return current\n}\n\n// --- The locked-content judge (EC-738) -----------------------------------------------\n\n/** A value that is there (`undefined` / `null` — nothing to lose; the converter's own rule). */\nfunction isPresent(value: unknown): boolean {\n return value !== undefined && value !== null\n}\n\n/**\n * One writer-locked position under a value — the TOPMOST locked one on its branch (it stands\n * for everything below it, which is locked too) — with its value (possibly absent: the\n * position exists because its holder does), its lock and its location below the field.\n *\n * EC-748: or a value the traversal cannot read whose DECLARATION may hold a locked one\n * (`opaque` says why it cannot be read; `lock` is what it may hold — `excluded` first, failing\n * closed on bodies). Its locked content cannot be compared, so it counts as kept only where\n * the other side holds the same value, unchanged, at the same place.\n */\nexport interface LockedPosition {\n readonly value: unknown\n readonly lock: WriterLock\n readonly at: readonly (string | number)[]\n /** EC-748: the value is unreadable — it MAY hold locked content (its declaration says so). */\n readonly opaque?: OpaqueReason\n}\n\n/**\n * The writer lock an unreadable value's declaration may hold (EC-748): `excluded` when it may\n * hold an `ai.exclude` position, else `read-only` when it may hold a `form.readOnly` one, else\n * none — over the declaration alone (`declarationMayHold`: a body may hold any component, so\n * it may hold either; `excluded` wins, the stricter lock).\n */\nexport function declaredWriterLock(declaration: FieldDef): WriterLock | undefined {\n if (declarationMayHold(declaration, (field) => writerLockOf(field) === 'excluded')) return 'excluded'\n if (declarationMayHold(declaration, (field) => writerLockOf(field) === 'read-only')) return 'read-only'\n return undefined\n}\n\n/** {@link lockedChildKey} for a value the traversal cannot read — its own key space (EC-748). */\nfunction lockedOpaqueKey(parent: ValuePosition, parentKey: string, child: OpaquePosition): string {\n if (child.opaque === 'not-a-static-prop' && child.component) {\n return `opaque:node:${child.component.nodeId}:${child.declaration.name}`\n }\n return `${parentKey}/opaque:${JSON.stringify(child.at.slice(parent.at.length))}`\n}\n\n/**\n * The key matching a child position across two values of one position: a component prop by\n * its NODE (ids are unique in a document and survive a prose edit that shifts indices), an\n * entry of an asset LIST by its asset id and occurrence (the carry's own matching,\n * `carryAssetPlacements` — a reordered gallery keeps each placement), anything else by its\n * location below the parent (a repeater item by index, a sub-field by name).\n */\nfunction lockedChildKey(parent: ValuePosition, parentKey: string, child: ValuePosition): string {\n if (child.kind === 'prop' && child.component) return `node:${child.component.nodeId}:${child.field.name}`\n const below = child.at.slice(parent.at.length)\n if (parent.field.type === 'asset' && parent.field.multiple !== false && Array.isArray(parent.value)) {\n const index = below[0] as number\n const entries = parent.value as unknown[]\n const id = readAssetId(entries[index])\n const occurrence = entries.slice(0, index).filter((entry) => readAssetId(entry) === id).length\n return `${parentKey}/asset:${JSON.stringify(id)}#${occurrence}/${JSON.stringify(below.slice(1))}`\n }\n return `${parentKey}/${JSON.stringify(below)}`\n}\n\n/** Every topmost writer-locked position at or below `position`, by {@link lockedChildKey}. */\nfunction lockedPositionsUnder(position: ValuePosition, positionCtx: PositionContext): Map<string, LockedPosition> {\n const out = new Map<string, LockedPosition>()\n const visit = (pos: ValuePosition, key: string): void => {\n const lock = writerLockOf(pos.field)\n if (lock !== undefined) {\n out.set(key, { value: pos.value, lock, at: pos.at })\n return\n }\n for (const child of childPositions(pos, positionCtx)) {\n if (!isOpaquePosition(child)) {\n visit(child, lockedChildKey(pos, key, child))\n continue\n }\n // EC-748: what cannot be read is judged by its declaration — never \"nothing locked here\".\n const lock = declaredWriterLock(child.declaration)\n if (lock !== undefined) out.set(lockedOpaqueKey(pos, key, child), { value: child.value, lock, at: child.at, opaque: child.opaque })\n }\n }\n visit(position, '')\n return out\n}\n\n/** Whether `entry` sits in `other` unchanged at `key` (a defined value, the same JSON). */\nfunction keptAt(other: ReadonlyMap<string, LockedPosition>, key: string, entry: LockedPosition): boolean {\n const now = other.get(key)\n return now !== undefined && isPresent(now.value) && canonicalJson(now.value) === canonicalJson(entry.value)\n}\n\n/**\n * The defined locked values of `before` that `after` does not hold, unchanged, at their key —\n * and (EC-748) every unreadable value that may hold one on EITHER side and is not on the other\n * unchanged: what it holds cannot be compared, so a change to it (or one written where none\n * was) is counted lost — fail closed.\n */\nfunction lockedLosses(\n before: ReadonlyMap<string, LockedPosition>,\n after: ReadonlyMap<string, LockedPosition>,\n): LockedPosition[] {\n const lost = [...before].flatMap(([key, entry]) => (isPresent(entry.value) && !keptAt(after, key, entry) ? [entry] : []))\n const written = [...after].flatMap(([key, entry]) =>\n entry.opaque !== undefined && isPresent(entry.value) && !keptAt(before, key, entry) ? [entry] : [],\n )\n return [...lost, ...written]\n}\n\n/**\n * What a writer is told about a write that would change or clear a value stored in a shape\n * its declaration cannot read, which may hold locked content (EC-748), located at the holder\n * the model wrote. Its content is never named (it cannot be read — and excluded content may\n * not be disclosed, EC-741); the repair is a save outside the assistant.\n */\nexport function unreadableLockedMessage(holder: string, root: string, locked: readonly LockedPosition[]): string {\n const excluded = locked.some((entry) => entry.lock === 'excluded')\n const where = locked.filter((entry) => entry.opaque !== undefined && entry.at.length > 0).map((entry) => label(root, entry.at))\n const at = !excluded && where.length > 0 ? ` (${where.join(', ')})` : ''\n const what = excluded ? 'content the assistant must not change' : 'read-only content'\n return `Field ${holder} holds a value stored in a shape its declaration cannot read${at} — it was saved under an earlier schema or written past the editor — and it may hold ${what}; the assistant cannot change, replace or clear it. Repair it outside the assistant: save the field again in the editor, in the shape its declaration reads; then the assistant can change its other values.`\n}\n\n/**\n * What a writer is told about a write that would remove locked content (EC-738), located at\n * the HOLDER the model wrote. Read-only content is named (the model reads it); excluded\n * content never is (EC-741: the model never sees it, so naming its path would disclose it).\n */\nexport function lockedRemovalMessage(\n holder: string,\n root: string,\n locked: readonly LockedPosition[],\n shortened: boolean,\n): string {\n const excluded = locked.some((entry) => entry.lock === 'excluded')\n const what = excluded\n ? 'content the assistant must not change'\n : `read-only content (${locked.map((entry) => label(root, entry.at)).join(', ')}) — no one changes it in the studio, the assistant included`\n return shortened\n ? `Field ${holder} holds ${what}; the assistant cannot remove items from it (items are matched by position, so removing one would delete that content or move it onto another item). Keep every item and change only their other values.`\n : `Field ${holder} holds ${what}; the assistant cannot clear or remove it. Change only its other values.`\n}\n\n/**\n * The value at `position` with every writer-locked position taken from `current` by key\n * (EC-738, translate): where `current` holds that position — its value, an absent one\n * included — the current one wins; a position `current` does not hold at all (a new item, a\n * node it lacks) keeps `position`'s own. {@link lockedChanges} then says whether that kept\n * the locked content as it is.\n */\nexport function withLockedFrom(\n position: ValuePosition,\n current: unknown,\n ctx: Pick<WriterFormContext, 'lookupManifest'>,\n): unknown {\n const positionCtx = ctx.lookupManifest ? { lookupManifest: ctx.lookupManifest } : {}\n const held = lockedPositionsUnder({ ...position, value: current }, positionCtx)\n const rebuild = (pos: ValuePosition, key: string): unknown => {\n if (writerLockOf(pos.field) !== undefined) return held.has(key) ? held.get(key)!.value : pos.value\n // EC-748: a value `position` holds unreadably is kept as it is — nothing below it can be\n // matched by key — and {@link lockedChanges} counts it lost unless `current` holds it too.\n return rebuildFromChildren(\n pos,\n positionCtx,\n (child) => rebuild(child, lockedChildKey(pos, key, child)),\n (unreadable) => unreadable.value,\n )\n }\n return rebuild(position, '')\n}\n\n/**\n * The locked values a write from `position.value` (the CURRENT value) to `next` would lose or\n * create, judged both ways (EC-738, translate): `lost` — a defined locked value `next` does\n * not hold unchanged; `created` — a defined locked value `next` holds where the current value\n * holds none. EC-748: a value stored in a shape its declaration cannot read, which may hold a\n * locked value, on EITHER side and not on the other unchanged, is `lost` (fail closed) — so a\n * drifted target keeps its value whole, and a drifted source never copies its locked values\n * across.\n */\nexport function lockedChanges(\n position: ValuePosition,\n next: unknown,\n ctx: Pick<WriterFormContext, 'lookupManifest'>,\n): { readonly lost: readonly LockedPosition[]; readonly created: readonly LockedPosition[] } {\n const positionCtx = ctx.lookupManifest ? { lookupManifest: ctx.lookupManifest } : {}\n const before = lockedPositionsUnder(position, positionCtx)\n const after = lockedPositionsUnder({ ...position, value: next }, positionCtx)\n return {\n lost: lockedLosses(before, after),\n created: [...after].flatMap(([key, entry]) =>\n entry.opaque === undefined && isPresent(entry.value) && !isPresent(before.get(key)?.value) ? [entry] : [],\n ),\n }\n}\n\n/**\n * Whether a value written to a locked position leaves it as it is: a clear of an empty\n * position, or the current value echoed back — as stored, in the form the model READ it\n * in ({@link toWriterForm}: rich text as markdown), or in any writer form that converts to\n * exactly the stored value.\n */\nfunction isEcho(pos: ValuePosition, current: unknown, ctx: WriterFormContext, root: string): boolean {\n const written = pos.value\n if (written === null) return current === undefined || current === null\n if (current === undefined || current === null) return false\n const json = canonicalJson(written)\n if (json === canonicalJson(current)) return true\n if (json === canonicalJson(toWriterForm({ ...pos, value: current }, ctx))) return true\n const scratch: WriterFormProblem[] = []\n const stored = convertValue(pos, current, ctx, scratch, root)\n return scratch.length === 0 && canonicalJson(stored) === canonicalJson(current)\n}\n\n/**\n * A repeater's current value with every item the written list adds seeded the way a\n * manual \"add item\" seeds it (core's `seedObjectItem`), so a locked sub-field of a NEW item\n * keeps its default rather than staying empty (EC-716, sol-C 22 at item level). Items are\n * matched by index — the matching the converter uses for every repeater.\n */\nfunction withSeededItems(current: unknown, length: number, fields: readonly FieldDef[]): unknown {\n const items = Array.isArray(current) ? current : []\n if (items.length >= length) return current\n return [...items, ...Array.from({ length: length - items.length }, () => seedObjectItem(fields))]\n}\n\n/** {@link convert} for a position no lock holds: the writer form → the stored form. */\nfunction convertValue(\n pos: ValuePosition,\n current: unknown,\n ctx: WriterFormContext,\n problems: WriterFormProblem[],\n root: string,\n): unknown {\n const { field } = pos\n const raw = pos.value === null ? undefined : pos.value\n const report = (code: WriterFormProblem['code'], message: string, leash?: true): undefined => {\n problems.push({ at: pos.at, code, message, ...(leash ? { leash } : {}) })\n return undefined\n }\n\n switch (fieldTypeOf(field).writer) {\n case 'composition': {\n // 4c: a composition is never written whole — the value stays exactly what it is\n // (re-sending it unchanged is no change); its props change one at a time. EC-741:\n // \"unchanged\" includes the value as the model READ it ({@link toWriterForm}: excluded\n // props absent, rich-text props as markdown) — the rule `isEcho` reads.\n const json = canonicalJson(raw)\n if (json === canonicalJson(current)) return current\n if (current !== undefined && json === canonicalJson(toWriterForm({ ...pos, value: current }, ctx))) return current\n return report(\n 'invalid-field-value',\n `Field ${subject(pos, root)} is a page-builder composition: adding, reordering or removing its components is done on the canvas, not by the assistant. Change one component's prop with blockId + prop (the component's id from getDocument).`,\n )\n }\n\n case 'markdown': {\n let next: unknown = undefined\n if (raw !== undefined) {\n const parsed = richTextValueFromModelInput(raw)\n if (!parsed.ok) return report('invalid-field-value', `Field ${subject(pos, root)}: ${parsed.problems.join(' ')}`)\n // An echoed stored value may carry components: their props are positions too.\n next = convertChildren({ ...pos, value: parsed.value }, current, ctx, problems, root)\n }\n // 4c: prose is content, the components embedded in it are structure.\n if (compositionOf(next) !== compositionOf(current)) {\n return report(\n 'invalid-field-value',\n `Field ${subject(pos, root)} holds embedded components; the assistant cannot add, remove or move them (that is done in the editor). Send the value back as the stored { version: 2, content } object with every component node kept in place, or change a component's prop with blockId + prop.`,\n )\n }\n return next\n }\n\n case 'placement': {\n if (raw === undefined) return undefined\n const asset = field as AssetFieldDef\n const items = Array.isArray(raw) ? raw : [raw]\n const entries: { id: string; rest: Record<string, unknown> }[] = []\n for (const item of items) {\n if (typeof item === 'string' && item.length > 0) entries.push({ id: item, rest: {} })\n else if (\n isPlainRecord(item) &&\n typeof item.id === 'string' &&\n item.id.length > 0 &&\n (item.type === undefined || item.type === 'asset')\n ) {\n const { type: _type, id, ...rest } = item\n entries.push({ id: id as string, rest })\n } else {\n return report(\n 'invalid-field-value',\n `Asset field ${subject(pos, root)} takes asset id string(s) from listAssets results.`,\n )\n }\n }\n if (asset.multiple !== true && entries.length > 1) {\n return report('invalid-field-value', `Field ${subject(pos, root)} holds a single asset — pass one id.`)\n }\n // EC-381: the asset id leash — searched (fitting this position's `accept`) or\n // already on the document; the assistant never invents or uploads an asset.\n const allowed = new Set([\n ...(ctx.leash?.assetCandidates(asset) ?? []).map((candidate) => candidate.id),\n ...(ctx.held?.assets ?? []),\n ])\n const unknown = entries.filter((entry) => !allowed.has(entry.id))\n if (unknown.length > 0) {\n report(\n 'unknown-asset',\n `Asset field ${subject(pos, root)} may only use ids from listAssets results — search the media library first (got: ${unknown.map((e) => e.id).join(', ')}).`,\n true,\n )\n }\n const kept = entries.filter((entry) => allowed.has(entry.id))\n if (kept.length === 0) return undefined\n // EC-558 / 2c: the ONE carry rule — a held placement keeps its per-use sub-fields,\n // a swap carries them to the new image, a new id is an envelope.\n const carriedAsStored = carryAssetPlacements(\n current,\n asset.multiple === true ? { multiple: true, ids: kept.map((e) => e.id) } : { multiple: false, id: kept[0]!.id },\n )\n // EC-748: the carry hands back a single field's stored one-item list as it is (same id);\n // the WRITTEN value takes the declared cardinality — the model wrote one value. (Whether\n // replacing that unreadable stored list is allowed is the lock judge's question.)\n const carried = asset.multiple !== true && Array.isArray(carriedAsStored) ? carriedAsStored[0] : carriedAsStored\n // The writer's own sub-field values win over the carried ones.\n const withWriter = (entry: unknown, index: number): unknown => {\n const rest = kept[index]?.rest ?? {}\n if (Object.keys(rest).length === 0) return entry\n const base = isPlainRecord(entry) ? entry : { type: 'asset', id: kept[index]!.id }\n return { ...base, ...rest }\n }\n const merged = Array.isArray(carried) ? carried.map(withWriter) : withWriter(carried, 0)\n return convertChildren({ ...pos, value: merged }, carried, ctx, problems, root)\n }\n\n case 'reference': {\n if (raw === undefined) return undefined\n const relation = field as RelationFieldDef\n const items = Array.isArray(raw) ? raw : [raw]\n const ids: string[] = []\n for (const item of items) {\n const id = typeof item === 'string' ? item : isPlainRecord(item) && typeof item.id === 'string' ? item.id : undefined\n const collection = isPlainRecord(item) ? item.collection : undefined\n if (!id || (collection !== undefined && collection !== relation.target)) {\n return report(\n 'invalid-field-value',\n `Relation ${subject(pos, root)} takes document id string(s) from searchDocuments results.`,\n )\n }\n ids.push(id)\n }\n if (relation.multiple !== true && ids.length > 1) {\n return report('invalid-field-value', `Field ${subject(pos, root)} holds a single reference — pass one id.`)\n }\n // EC-378/EC-381: the relation id leash — searched in the target collection, or\n // already referenced by the document.\n const allowed = new Set([\n ...(ctx.leash?.relationCandidates(relation.target) ?? []).map((candidate) => candidate.id),\n ...(ctx.held?.documents.get(relation.target) ?? []),\n ])\n const unknown = ids.filter((id) => !allowed.has(id))\n if (unknown.length > 0) {\n report(\n 'unknown-relation-target',\n `Relation ${subject(pos, root)} may only use ids from searchDocuments results — search \"${relation.target}\" first (got: ${unknown.join(', ')}).`,\n true,\n )\n }\n const refs = ids.filter((id) => allowed.has(id)).map((id) => referenceNode({ collection: relation.target, id }))\n if (refs.length === 0) return undefined\n return relation.multiple === true ? refs : refs[0]\n }\n\n case 'object': {\n // A value of the wrong shape has no children; the validator names it.\n if (raw === undefined) return undefined\n const base =\n field.type === 'object' && field.multiple && Array.isArray(raw)\n ? withSeededItems(current, raw.length, field.fields)\n : current\n return convertChildren({ ...pos, value: raw }, base, ctx, problems, root)\n }\n\n case 'value':\n return raw\n }\n}\n\n// --- A component prop, by its node ---------------------------------------------------\n\nexport type FromWriterFormAtNodeResult =\n | {\n readonly ok: true\n /** The field's next value (the displayed value with the one prop converted). */\n readonly value: unknown\n /**\n * The position the change wrote, in the value-position grammar: the prop by its\n * node path where the grammar reaches it, else the coarsest addressable ancestor\n * — the field (bucket) itself (EC-595: a writer may always emit a coarser path).\n */\n readonly path: ValuePath\n /** The converted prop value when {@link path} is the prop itself (`undefined` — unset). */\n readonly propValue: unknown\n readonly exact: boolean\n readonly problems: readonly WriterFormProblem[]\n }\n | { readonly ok: false; readonly message: string }\n\n/**\n * Change ONE component prop, addressed by its node id and prop name, inside a field's\n * value — at ANY depth the traversal reaches: a top-level block, a child in a section's\n * slot, a component embedded in rich text, a component inside an object's rich text or\n * inside another component's prop. The prop's writer form goes through\n * {@link fromWriterForm} with the prop's current value (carry + leash at that position),\n * and the field value is rebuilt by the traversal's writing fold. Nothing else in the\n * value changes — no other prop, no node, no prose.\n */\nexport function fromWriterFormAtNode(\n field: FieldDef,\n displayed: unknown,\n nodeId: string,\n prop: string,\n raw: unknown,\n ctx: WriterFormContext,\n locale?: string,\n): FromWriterFormAtNodeResult {\n if (!ctx.lookupManifest) {\n return {\n ok: false,\n message: `Component props cannot be changed here: the project's components are not available to judge \"${prop}\".`,\n }\n }\n const positionCtx = { lookupManifest: ctx.lookupManifest }\n const root = fieldValuePosition(field, displayed, locale !== undefined ? { locale } : {})\n const isTarget = (position: ValuePosition) =>\n position.kind === 'prop' && position.component?.nodeId === nodeId && position.field.name === prop\n let target: ValuePosition | undefined\n // EC-716: the lock the target sits under — its own, or the nearest locked ancestor's\n // (a component embedded in a read-only rich-text prop, a prop of a locked object…).\n let targetLock: WriterLock | undefined\n const declared: string[] = []\n let componentId: string | undefined\n // EC-748: the target prop stored as no static member — declared, but unreadable.\n let unreadableTarget = false\n const visit = (position: ValuePosition, inherited: WriterLock | undefined): void => {\n const lock = writerLockOf(position.field) ?? inherited\n if (position.kind === 'prop' && position.component?.nodeId === nodeId) {\n componentId = position.component.componentId\n declared.push(position.field.name)\n if (target === undefined && position.field.name === prop) {\n target = position\n targetLock = lock\n }\n }\n for (const child of childPositions(position, positionCtx)) {\n if (!isOpaquePosition(child)) {\n visit(child, lock)\n continue\n }\n // EC-748: a node inside a value the traversal cannot read is not addressable — it is not\n // found (the write never reaches into an unreadable holder); a prop of the node stored as\n // no static member is declared but cannot be written.\n if (child.opaque === 'not-a-static-prop' && child.component?.nodeId === nodeId) {\n componentId = child.component.componentId\n declared.push(child.declaration.name)\n if (child.declaration.name === prop) unreadableTarget = true\n }\n }\n }\n visit(root, undefined)\n if (!target && unreadableTarget) {\n return {\n ok: false,\n message: `Prop \"${prop}\" of component \"${nodeId}\" (${componentId}) is stored as no { value } member (a retired shape); the assistant cannot change it. Repair it outside the assistant: set the prop again in the editor.`,\n }\n }\n if (target && targetLock !== undefined) {\n return {\n ok: false,\n message: lockedWriteMessage(`Prop \"${prop}\" of component \"${nodeId}\" (${componentId})`, targetLock),\n }\n }\n if (!target) {\n if (componentId === undefined) {\n return {\n ok: false,\n message: `Component \"${nodeId}\" was not found in \"${field.name}\" (or its component declares no props) — read the document first; component ids come from getDocument.`,\n }\n }\n return {\n ok: false,\n message: `Component \"${nodeId}\" (${componentId}) has no prop \"${prop}\" — its props are: ${declared.join(', ')}.`,\n }\n }\n const found = target\n // The prop is the write's ROOT (an omitted value clears it); messages locate positions\n // from the top-level field (`body.content[0].props.group.locked`).\n const { value: converted, problems } = convertRoot({ ...found, value: raw }, found.value, ctx, field.name)\n const rebuild = (position: ValuePosition): unknown =>\n rebuildFromChildren(\n position,\n positionCtx,\n (child) => (isTarget(child) ? converted : rebuild(child)),\n (unreadable) => unreadable.value, // nothing else in the value changes\n )\n const value = rebuild(root)\n return found.exact\n ? { ok: true, value, path: found.path, propValue: converted, exact: true, problems }\n : { ok: true, value, path: fieldPath(field.name, locale), propValue: undefined, exact: false, problems }\n}\n\n// --- The text positions (translate) --------------------------------------------------\n\n/** Whether a field-def holds TEXT a translation turns into units: plain text, or a sequence. */\nexport function isTextPosition(position: ValuePosition): boolean {\n const { type } = position.field\n return type === 'text' || type === 'richText' || type === 'blocks'\n}\n\n/** EC-716: a writer-locked position — no unit, no write, nothing below it either. */\nfunction isLocked(position: ValuePosition): boolean {\n return writerLockOf(position.field) !== undefined\n}\n\n/**\n * Every TEXT position at or below `position` (EC-593, ratified 4e — \"translate uses the\n * same traversal\"): a `text` value, and a `richText` / `blocks` sequence (its prose —\n * the sequence's own text — is the caller's to split) together with every text position\n * below it: component text props in a composition and in rich-text embeds, object\n * sub-fields, repeater items, asset placement sub-fields. A writer-locked position\n * (EC-716: `ai.exclude` or `form.readOnly`) and everything below it is not text a writer\n * may touch — not a unit, and so never a skip either. Depth-first, document order.\n */\nexport function textPositionsOf(\n position: ValuePosition,\n ctx: Pick<WriterFormContext, 'lookupManifest'>,\n): ValuePosition[] {\n const positionCtx = ctx.lookupManifest ? { lookupManifest: ctx.lookupManifest } : {}\n const out: ValuePosition[] = []\n const visit = (current: ValuePosition): void => {\n if (isLocked(current)) return\n if (isTextPosition(current)) out.push(current)\n if (current.field.type === 'text') return\n // EC-748: a value the traversal cannot read yields no unit — its text cannot be found\n // (and translate skips a bucket where one may hold locked content: `lockedChanges`).\n for (const child of childPositions(current, positionCtx)) if (!isOpaquePosition(child)) visit(child)\n }\n visit(position)\n return out\n}\n\n/**\n * The writing fold over {@link textPositionsOf}: the value at `position` with each text\n * position's value replaced by `replace(textPosition)` — for a sequence, its own value\n * first (its prose), then the text positions below it, read off the REPLACED value (a\n * component keeps its node id, so its props are found again). Every other value — an\n * image, a select, a component's structure — comes back as it was (identity-preserving).\n */\nexport function rebuildTextPositions(\n position: ValuePosition,\n ctx: Pick<WriterFormContext, 'lookupManifest'>,\n replace: (textPosition: ValuePosition) => unknown,\n): unknown {\n const positionCtx = ctx.lookupManifest ? { lookupManifest: ctx.lookupManifest } : {}\n const rebuild = (current: ValuePosition): unknown => {\n if (isLocked(current)) return current.value\n if (current.field.type === 'text') return replace(current)\n const value = isTextPosition(current) ? replace(current) : current.value\n // EC-748: an unreadable value comes back as it was (it held no unit).\n return rebuildFromChildren({ ...current, value }, positionCtx, rebuild, (unreadable) => unreadable.value)\n }\n return rebuild(position)\n}\n\n// --- Stored form → the read (writer) form --------------------------------------------\n\n/**\n * The form a model READS a stored value in — the mirror of {@link fromWriterForm}, so\n * what `getDocument` shows is what `updateFields` takes back: rich text as a markdown\n * string wherever the engine's loss-guarded inverse can express it faithfully (no\n * embedded components, subset-only marks — else the stored `{ version: 2, content }`\n * stays, so nothing echoed back can silently lose structure), at EVERY position: a\n * top-level field, an object sub-field, a repeater item, a component's rich-text prop.\n * Everything else reads as stored (envelopes are writer forms too).\n *\n * **THE model-read projection** (EC-741): a position core's `writerLockOf` marks\n * `excluded` (`ai: { exclude: true }` — \"the model never sees or writes the field\") reads\n * as ABSENT, and so does everything below it, at every depth: a sub-field, a repeater\n * item's sub-field, a placement sub-field, a component prop in a composition, a slot or\n * typography content. A `read-only` position stays readable. Every model read crosses this\n * one fold — `getDocument`'s output, the titles the model is shown\n * ({@link modelFacingTitle}) and the echo checks (a value the model read and sent back is\n * no change) — so what the model can see and what it can echo are one declaration. The raw\n * stored document stays local: proposals are always built and validated against it.\n *\n * EC-748 (Codex r9 F44): a stored value the traversal cannot read (a holder of the other\n * cardinality after a schema edit, a repeater item that is no object, a body that is no v2\n * sequence or is read without the prop lookup, …) is WITHHELD — absent where it sits: the\n * field, the list entry, the prop — whenever its declaration may hold an excluded position\n * (`declaredWriterLock`, failing closed on bodies). What cannot be read cannot be projected,\n * so it is never sent whole. One that may hold none reads as stored.\n */\nexport function toWriterForm(\n position: ValuePosition,\n ctx: Pick<WriterFormContext, 'lookupManifest'>,\n): unknown {\n if (writerLockOf(position.field) === 'excluded') return undefined\n const { value } = position\n if (value === undefined || value === null) return value\n const positionCtx = ctx.lookupManifest ? { lookupManifest: ctx.lookupManifest } : {}\n if (fieldTypeOf(position.field).writer === 'markdown' && isSequenceValue(value)) {\n const parsed = parseRichTextValue(value)\n const markdown = parsed.ok ? richTextValueToMarkdownProse(parsed.value) : undefined\n if (markdown !== undefined) return markdown\n }\n return rebuildFromChildren(\n position,\n positionCtx,\n (child) => toWriterForm(child, ctx),\n (unreadable) => (declaredWriterLock(unreadable.declaration) === 'excluded' ? undefined : unreadable.value),\n )\n}\n\n/**\n * The components a document holds whose props a writer may change — every component\n * the traversal reaches a DECLARED prop of, in every field of every bucket, at any depth\n * — in first-seen order. What the `getDocument` output's prop catalog lists.\n */\nexport function componentIdsOf(\n collection: CollectionDef,\n document: CmsDocument,\n lookupManifest: PropFieldLookup,\n): string[] {\n const ids = new Set<string>()\n const byName = new Map(collection.fields.map((field) => [field.name, field]))\n const visitBucket = (bucket: FieldValues) => {\n for (const [name, value] of Object.entries(bucket)) {\n const field = byName.get(name)\n if (!field) continue\n walkValuePositions(\n fieldValuePosition(field, value),\n { lookupManifest },\n (position) => {\n if (position.kind === 'prop' && position.component) ids.add(position.component.componentId)\n },\n // EC-748: a component inside a value the traversal cannot read has no prop a writer can change.\n () => {},\n )\n }\n }\n visitBucket(document.values)\n for (const bucket of Object.values(document.localized ?? {})) visitBucket(bucket)\n return [...ids]\n}\n\n/**\n * {@link toWriterForm} over one values bag: each declared field in its read form, an\n * excluded one (and an excluded position inside any field) left out. A key the collection\n * does not declare reads as stored (AD-14: the schema is a lens).\n */\nexport function toWriterValues(\n collection: CollectionDef,\n bag: Readonly<Record<string, unknown>>,\n ctx: Pick<WriterFormContext, 'lookupManifest'>,\n locale?: string,\n): Record<string, unknown> {\n let next: Record<string, unknown> | undefined\n for (const field of collection.fields) {\n if (!Object.hasOwn(bag, field.name)) continue\n const value = bag[field.name]\n const read = toWriterForm(fieldValuePosition(field, value, locale !== undefined ? { locale } : {}), ctx)\n if (read === value) continue\n next ??= { ...bag }\n if (read === undefined) delete next[field.name]\n else next[field.name] = read\n }\n return next ?? (bag as Record<string, unknown>)\n}\n\n/** {@link toWriterForm} over every field of every bucket of a document. */\nexport function toWriterDocument(\n collection: CollectionDef,\n document: CmsDocument,\n ctx: Pick<WriterFormContext, 'lookupManifest'>,\n): CmsDocument {\n const values = toWriterValues(collection, document.values, ctx) as FieldValues\n const localized = document.localized\n ? Object.fromEntries(\n Object.entries(document.localized).map(([locale, bucket]) => [\n locale,\n toWriterValues(collection, bucket, ctx, locale) as FieldValues,\n ]),\n )\n : undefined\n return { ...document, values, ...(localized ? { localized } : {}) }\n}\n\n/**\n * The title a MODEL is shown for a document (EC-741) — core's `resolveDocumentTitle` over\n * the projected values ({@link toWriterValues}), so an excluded field never reaches the\n * model as a title: neither as the named or first-field fallback, nor through a function\n * `titleField` that reads it (the function sees the field absent). Every title the model\n * reads goes through here: the `updateFields` / `createDocument` outputs, the\n * `searchDocuments` results (their query is matched against this title too, so an\n * excluded value cannot be probed by search) and the system prompt's \"currently open\"\n * line. `values` is the bag the caller resolves titles from (a locale's merged values).\n */\nexport function modelFacingTitle(\n collection: CollectionDef,\n values: Readonly<Record<string, unknown>>,\n fallbackId: string,\n ctx: Pick<WriterFormContext, 'lookupManifest'> = {},\n): string {\n return resolveDocumentTitle(collection, toWriterValues(collection, values, ctx), fallbackId)\n}\n"]}
@@ -13,4 +13,4 @@
13
13
  * (The convex-side stamp does NOT read this mirror — `convex/delivery.ts` imports the
14
14
  * package.json declaration directly; its bundler allows what tsc's rootDir forbids.)
15
15
  */
16
- export declare const ENGINE_VERSION = "0.0.102";
16
+ export declare const ENGINE_VERSION = "0.0.103";
@@ -13,5 +13,5 @@
13
13
  * (The convex-side stamp does NOT read this mirror — `convex/delivery.ts` imports the
14
14
  * package.json declaration directly; its bundler allows what tsc's rootDir forbids.)
15
15
  */
16
- export const ENGINE_VERSION = '0.0.102';
16
+ export const ENGINE_VERSION = '0.0.103';
17
17
  //# sourceMappingURL=engine-version.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"engine-version.js","sourceRoot":"","sources":["../../src/lib/engine-version.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,SAAS,CAAA","sourcesContent":["/**\n * The engine version this studio build was compiled from (EC-552) — the client-side\n * half of the deployed-functions version handshake: the boot gate compares it against\n * what `delivery:engineVersion` answers from the deployment.\n *\n * A MIRROR of `package.json`'s `version`, not the declaration itself: client source\n * cannot import `../../package.json` (outside the tsc build's `rootDir`; moving the\n * root would reshape `dist` and every export path). The parity test beside this file\n * fs-reads the real declaration and fails `pnpm verify` the moment the two diverge,\n * so a release cannot ship with a stale mirror. `pnpm release:bump` writes this\n * alongside the five `package.json` versions (EC-608).\n *\n * (The convex-side stamp does NOT read this mirror — `convex/delivery.ts` imports the\n * package.json declaration directly; its bundler allows what tsc's rootDir forbids.)\n */\nexport const ENGINE_VERSION = '0.0.102'\n"]}
1
+ {"version":3,"file":"engine-version.js","sourceRoot":"","sources":["../../src/lib/engine-version.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,SAAS,CAAA","sourcesContent":["/**\n * The engine version this studio build was compiled from (EC-552) — the client-side\n * half of the deployed-functions version handshake: the boot gate compares it against\n * what `delivery:engineVersion` answers from the deployment.\n *\n * A MIRROR of `package.json`'s `version`, not the declaration itself: client source\n * cannot import `../../package.json` (outside the tsc build's `rootDir`; moving the\n * root would reshape `dist` and every export path). The parity test beside this file\n * fs-reads the real declaration and fails `pnpm verify` the moment the two diverge,\n * so a release cannot ship with a stale mirror. `pnpm release:bump` writes this\n * alongside the five `package.json` versions (EC-608).\n *\n * (The convex-side stamp does NOT read this mirror — `convex/delivery.ts` imports the\n * package.json declaration directly; its bundler allows what tsc's rootDir forbids.)\n */\nexport const ENGINE_VERSION = '0.0.103'\n"]}
@@ -267,6 +267,8 @@ export const deMessages = {
267
267
  'operations.error.strictReferencesBlockDeleteOne': '„{target}“ kann nicht gelöscht werden: {count} Dokument verweist über strikte Beziehungsfelder darauf — {named}. Entfernen Sie zuerst diese Verweise.',
268
268
  'operations.error.referencesBlockDelete': '„{target}“ kann nicht gelöscht werden: {count} Dokumente verweisen darauf — {named}{more}. Dieses Löschen erfolgt nur, solange nichts darauf verweist.',
269
269
  'operations.error.referencesBlockDeleteOne': '„{target}“ kann nicht gelöscht werden: {count} Dokument verweist darauf — {named}. Dieses Löschen erfolgt nur, solange nichts darauf verweist.',
270
+ // EC-745 Punkt 2 — der Speicher lehnte ein Schreiben wegen einer Verweis-Vorbedingung ab, und die erneute Prüfung fand nichts mehr.
271
+ 'operations.error.referenceChangedBack': '„{target}“ wurde nicht geschrieben: Ein Verweis, von dem es abhängt, hat sich geändert, während der Schreibvorgang unterwegs war, und ist seitdem wieder zurückgeändert worden — versuchen Sie es erneut.',
270
272
  'operations.error.strictReferencesBlockUnpublish': 'Die Veröffentlichung von „{target}“ kann nicht zurückgenommen werden: {count} Dokumente verweisen über strikte Beziehungsfelder darauf — {named}{more}. Entfernen Sie zuerst diese Verweise.',
271
273
  'operations.error.strictReferencesBlockUnpublishOne': 'Die Veröffentlichung von „{target}“ kann nicht zurückgenommen werden: {count} Dokument verweist über strikte Beziehungsfelder darauf — {named}. Entfernen Sie zuerst diese Verweise.',
272
274
  // EC-589 — die Gegenrichtung von `strict: true`: Veröffentlichen verweigert, solange ein striktes Ziel fehlt oder unveröffentlicht ist.
@@ -277,7 +279,19 @@ export const deMessages = {
277
279
  // EC-648 — Änderungssätze: Anwenden durch ein Problem blockiert, und der Schritt, den ein Änderungssatz ablehnt, weil ihn kein Rückgängigmachen umkehren kann.
278
280
  'operations.error.changesetBlocked': 'Der Änderungssatz „{changeset}“ hat blockierende Prüfprobleme und kann nicht angewendet werden.',
279
281
  'operations.error.changesetDeleteNotReversible': 'Schritt {step}: „{target}“ kann nicht innerhalb eines Änderungssatzes gelöscht werden — das Löschen entfernt seinen Versionsverlauf und seine Veröffentlichung, die kein Rückgängigmachen wiederherstellen kann. Löschen Sie es einzeln.',
282
+ // EC-745 — das Zurücknehmen eines Änderungssatzes, ganz abgelehnt, bevor etwas geschrieben wurde („deleteReferenced: true“ ist eine Code-Option und bleibt unübersetzt).
283
+ 'operations.error.revertReferencedDeleteOne': 'Das Zurücknehmen des Änderungssatzes „{changeset}“ wurde abgelehnt: Es würde „{target}“ löschen, und {count} Dokument verweist darauf — {named}. Nichts wurde zurückgenommen. Mit deleteReferenced: true wird es trotzdem gelöscht; der Verweis läuft dann ins Leere.',
284
+ 'operations.error.revertReferencedDelete': 'Das Zurücknehmen des Änderungssatzes „{changeset}“ wurde abgelehnt: Es würde „{target}“ löschen, und {count} Dokumente verweisen darauf — {named}{more}. Nichts wurde zurückgenommen. Mit deleteReferenced: true wird es trotzdem gelöscht; die Verweise laufen dann ins Leere.',
285
+ 'operations.error.revertStrictReferencedDeleteOne': 'Das Zurücknehmen des Änderungssatzes „{changeset}“ wurde abgelehnt: Es würde „{target}“ löschen, und {count} Dokument verweist über strikte Beziehungsfelder darauf — {named}. Nichts wurde zurückgenommen. Entfernen Sie zuerst diese Verweise.',
286
+ 'operations.error.revertStrictReferencedDelete': 'Das Zurücknehmen des Änderungssatzes „{changeset}“ wurde abgelehnt: Es würde „{target}“ löschen, und {count} Dokumente verweisen über strikte Beziehungsfelder darauf — {named}{more}. Nichts wurde zurückgenommen. Entfernen Sie zuerst diese Verweise.',
287
+ 'operations.error.revertUnrecorded': 'Das Zurücknehmen des Änderungssatzes „{changeset}“ wurde abgelehnt: Schritt {step} („{operation}“, {target}): {reason} — nichts wurde zurückgenommen.',
288
+ 'operations.error.revertChangedSince': 'Das Zurücknehmen des Änderungssatzes „{changeset}“ wurde abgelehnt: „{target}“ wurde geändert, seit der Änderungssatz angewendet wurde (jetzt Revision {revision}, der Änderungssatz hinterließ Revision {left}) — nichts wurde zurückgenommen.',
289
+ 'operations.error.revertGone': 'Das Zurücknehmen des Änderungssatzes „{changeset}“ wurde abgelehnt: „{target}“ existiert nicht mehr — nichts wurde zurückgenommen.',
280
290
  'operations.errorDetail.andMore': ' und {count} weitere',
291
+ // EC-745 — die Gründe, aus denen ein Schritt kein Rückgängigmachen festhält (eingesetzt in {reason} von revertUnrecorded).
292
+ 'operations.errorDetail.changesetStepRaced': 'zwischen dem Lesen des Dokuments durch den Änderungssatz und dem eigenen Schreiben dieses Schritts wurde anderweitig geschrieben, daher wurde nie festgehalten, was der Schritt ersetzt hat',
293
+ 'operations.errorDetail.changesetPatchNotInvertible': 'zwischen dem Lesen durch den Änderungssatz und dem eigenen Schreiben dieses Patches wurde anderweitig geschrieben, und der Patch hat die Struktur geändert (oder sein Eintrag im Patch-Protokoll fehlt), was sich nicht Position für Position rückgängig machen lässt',
294
+ 'operations.errorDetail.changesetNoInverse': 'es wurde kein Rückgängigmachen festgehalten',
281
295
  // EC-494 — Fehler von Inhaltsabfragen (Filterleiste + Listing-Hinweis im Canvas).
282
296
  // „filterable“, „asc“, „desc“, „in“, „empty“ sind Schlüsselwörter aus der Konfiguration
283
297
  // und bleiben wörtlich stehen.
@@ -1327,21 +1341,42 @@ export const deMessages = {
1327
1341
  'ai.error.stepCap': 'Der Assistent hat nach {max} Werkzeugschritten angehalten. Senden Sie eine weitere Nachricht, um fortzufahren.',
1328
1342
  // EC-332 — full-document translation (header action + chat tool)
1329
1343
  'ai.translate.action': 'Dokument übersetzen',
1330
- 'ai.translate.tooltip': 'Leere Übersetzungen mit KI ausfüllen',
1344
+ 'ai.translate.tooltip': 'Dieses Dokument mit KI in seine anderen Sprachen übersetzen',
1331
1345
  'ai.translate.dialogTitle': 'Dokument übersetzen',
1332
- 'ai.translate.dialogDescription': 'Leere Sprachwerte aus {base} mit KI ausfüllen. Vorhandene Übersetzungen werden nie überschrieben.',
1346
+ 'ai.translate.dialogDescription': 'Dieses Dokument mit KI aus {base} übersetzen.',
1333
1347
  'ai.translate.targetsLabel': 'Zielsprachen',
1334
1348
  'ai.translate.scopeLabel': 'Zu übersetzender Umfang',
1335
1349
  'ai.translate.fillMissing': 'Nur fehlende Übersetzungen ausfüllen',
1350
+ 'ai.translate.fillMissingHint': 'Füllt nur die Werte aus, die noch {base} folgen. Ein Wert mit eigener Übersetzung wird nie überschrieben.',
1336
1351
  'ai.translate.retranslateAll': 'Alles neu übersetzen',
1337
- 'ai.translate.retranslateSoon': 'Demnächst',
1352
+ // EC-752 — alles neu übersetzen: die Bestätigung listet, was ersetzt wird (aus dem Plan des Laufs selbst).
1353
+ 'ai.translate.retranslateHint': 'Übersetzt jeden Wert neu aus {base} — Werte, die schon eine eigene Übersetzung haben, werden ersetzt.',
1354
+ 'ai.translate.planReplaceTitle': 'Durch eine neue Übersetzung aus {base} ersetzt (bis zu {count})',
1355
+ 'ai.translate.planReplaceNone': 'Noch kein Wert hat eine eigene Übersetzung — es wird nichts ersetzt.',
1356
+ 'ai.translate.planFillTitle': 'Aus {base} ausgefüllt (bis zu {count})',
1357
+ 'ai.translate.planWhole': 'Ein Wert wird nur ersetzt, wenn er vollständig übersetzt wurde; sonst bleibt er, wie er war.',
1358
+ 'ai.translate.planSlugsKept': 'Ein Slug, den eine Sprache schon hat, bleibt erhalten — ihn zu ändern, würde die Adresse der Seite verschieben.',
1359
+ 'ai.translate.planRestorePoint': 'Vorher wird eine Version des Dokuments gespeichert, sodass Sie jeden ersetzten Wert unter Versionen wiederherstellen können.',
1360
+ 'ai.translate.planKeptTitle': 'Bleiben, wie sie sind ({count})',
1338
1361
  'ai.translate.confirm': 'Übersetzen',
1362
+ 'ai.translate.confirmReplace': 'Neu übersetzen und ersetzen',
1339
1363
  'ai.translate.preparing': 'Übersetzung wird vorbereitet…',
1340
1364
  'ai.translate.progress': '{completed} von {total} werden übersetzt…',
1341
1365
  'ai.translate.applying': 'Übersetzungen werden gespeichert…',
1366
+ 'ai.translate.snapshotLabel': 'Vor der Neuübersetzung',
1367
+ 'ai.translate.snapshotFailed': 'Vor der Neuübersetzung konnte keine Version gespeichert werden — es wurde nichts geändert. Bitte versuchen Sie es erneut.',
1342
1368
  'ai.translate.nothing': 'Alles ist bereits übersetzt — es gibt nichts auszufüllen.',
1369
+ 'ai.translate.retranslateNothing': 'Es gibt nichts neu zu übersetzen — kein Feld enthält Text in {base}.',
1343
1370
  'ai.translate.applied': '{count} Übersetzungen in {locales} Sprachen wurden ausgefüllt.',
1371
+ 'ai.translate.retranslateDone': 'Neuübersetzung abgeschlossen.',
1372
+ 'ai.translate.replacedTitle': 'Ersetzt ({count})',
1373
+ 'ai.translate.filledTitle': 'Ausgefüllt ({count})',
1374
+ 'ai.translate.slugsTitle': 'Slugs aus der Übersetzung gesetzt ({count})',
1375
+ 'ai.translate.keptTitle': 'Blieben, wie sie waren ({count})',
1376
+ 'ai.translate.refusedTitle': 'Inzwischen von jemand anderem geändert ({count}) — im Editor entscheiden',
1377
+ 'ai.translate.restorePoint': 'Die vorherigen Werte sind als Version v{version} gespeichert — Sie können jeden davon unter Versionen wiederherstellen.',
1344
1378
  'ai.translate.cancelled': 'Übersetzung abgebrochen — Teilergebnisse bleiben im Entwurf erhalten.',
1379
+ 'ai.translate.retranslateCancelled': 'Neuübersetzung abgebrochen — vollständig übersetzte Werte wurden ersetzt, die übrigen blieben, wie sie waren.',
1345
1380
  'ai.translate.failed': 'Übersetzung fehlgeschlagen. Bitte versuchen Sie es erneut.',
1346
1381
  'ai.translate.close': 'Schließen',
1347
1382
  'ai.translate.proposalTitle': 'Übersetzung von {collection}',
@@ -1352,8 +1387,13 @@ export const deMessages = {
1352
1387
  'ai.translate.skipped.unreadable': 'der gespeicherte Wert konnte nicht gelesen werden',
1353
1388
  'ai.translate.skipped.notReturned': 'der Assistent hat dafür keinen Text geliefert',
1354
1389
  'ai.translate.skipped.structureChanged': 'die Übersetzung hat Formatierungen, Links oder eingebettete Elemente verloren — das Original wurde beibehalten',
1355
- // EC-738 — ein Bereich, dessen schreibgeschützter (oder für die KI ausgeschlossener) Inhalt anders aufgebaut ist als die Quelle.
1356
- 'ai.translate.skipped.locked': 'enthält Inhalte, die hier nicht geändert werden können, anders angeordnet als in der Quelle — unverändert gelassen',
1390
+ // EC-752 — bei einer Neuübersetzung wird ein Wert ganz oder gar nicht geschrieben.
1391
+ 'ai.translate.skipped.retranslate.unreadable': 'der gespeicherte Wert konnte nicht gelesen werden — der ganze Wert blieb, wie er war',
1392
+ 'ai.translate.skipped.retranslate.notReturned': 'der Assistent hat dafür keinen Text geliefert — der ganze Wert blieb, wie er war',
1393
+ 'ai.translate.skipped.retranslate.structureChanged': 'die Übersetzung hat Formatierungen, Links oder eingebettete Elemente verloren — der ganze Wert blieb, wie er war',
1394
+ // EC-738 — ein Bereich, dessen schreibgeschützter (oder für die KI ausgeschlossener) Inhalt anders aufgebaut ist als die Quelle;
1395
+ // EC-748/752 — oder in einer Form gespeichert, die die Konfiguration nicht mehr liest.
1396
+ 'ai.translate.skipped.locked': 'enthält Inhalte, die hier nicht geändert werden können, anders angeordnet als in der Quelle oder in einer Form gespeichert, die die Konfiguration nicht mehr liest (zuerst im Editor speichern) — unverändert gelassen',
1357
1397
  // EC-378 — the update (edit-existing) proposal
1358
1398
  'ai.update.proposalTitle': 'Änderungen an {collection}',
1359
1399
  'ai.update.diffBefore': 'Aktuell',
@@ -1372,7 +1412,8 @@ export const deMessages = {
1372
1412
  'cms.issueMessage.nonCanonicalValue': 'Das Feld „{field}“ ist in einer nicht kanonischen Form für ein Feld vom Typ „{type}“ gespeichert — es wurde am Schreibweg vorbei geschrieben, der je Feldtyp genau eine Form speichert. Speichern Sie das Feld erneut im Editor oder über eine Operation, um die kanonische Form abzulegen.',
1373
1413
  'cms.issueMessage.propsNotJudged': 'Die Komponenten-Eigenschaften im Feld „{field}“ wurden nicht geprüft: Die Seite wurde ohne Komponenten-Registry aufgelöst, daher werden sie wie gespeichert ausgeliefert und ihre Probleme nicht gemeldet.',
1374
1414
  'cms.issueMessage.assetHoldsUrl': 'Das Asset-Feld „{field}“ enthält eine URL — ein Asset-Wert ist ein Asset aus der Mediathek, nie eine URL. Laden Sie das Bild in die Mediathek hoch und wählen Sie es aus, oder tragen Sie die Adresse eines externen Bildes in das URL-Feld der Komponente ein (beim Bild: „Image URL“).',
1375
- 'cms.issueMessage.slugNotSegment': 'Das Slug-Feld „{field}“ enthält „{value}“, was kein URL-Segment ist — die Slug-Regel schreibt dafür „{slug}“. Die Live-URL wird aus dem gespeicherten Slug so gebildet, wie er steht; speichern Sie den Slug, den die Regel schreibt.',
1415
+ 'cms.issueMessage.slugNotSegment': 'Das Slug-Feld „{field}“ enthält „{value}“, was nach der Slug-Regel des Felds kein Slug ist — die Regel schreibt dafür „{slug}“. Speichern Sie den Slug, den die Regel schreibt.',
1416
+ 'cms.issueMessage.slugNotAddressable': 'Das Slug-Feld „{field}“ enthält „{value}“, was kein einzelnes URL-Segment sein kann: Ein Browser entfernt ein Segment „.“ oder „..“ vor der Anfrage, und ein „/“ liest sich als verschachtelter Pfad. Daraus wird keine URL gebildet — ändern Sie den Slug.',
1376
1417
  // EC-584 — die AllowList-Prüfung (Konfiguration / Registrierung).
1377
1418
  'cms.issueMessage.emptyAllow': 'Das Feld „{field}“ deklariert ein leeres „allow“ — eine Liste erlaubt genau die genannten IDs, eine leere also nichts. Lassen Sie „allow“ weg für die Standard-Auswahl des Feldtyps, oder nennen Sie die Komponenten-IDs.',
1378
1419
  'cms.issueMessage.unknownAllowComponent': 'Das Feld „{field}“ erlaubt „{component}“, das keine Komponente dieses Projekts ist — prüfen Sie die ID oder entfernen Sie sie aus „allow“.',
@@ -1380,6 +1421,7 @@ export const deMessages = {
1380
1421
  'cms.issueMessage.placementKeyReserved': 'Das Asset-Feld „{asset}“ deklariert das platzierungsbezogene Unterfeld „{field}“, einen Namen, der dem Asset selbst gehört — es käme nie bei einer Komponente an (das „{field}“ des Assets gewinnt). Benennen Sie es um; Alternativtext, Bildnachweis oder KI-Kennzeichnung eines Bildes gehören in die Asset-Sammlung.',
1381
1422
  'cms.issueMessage.placementNotScalar': 'Das Asset-Feld „{asset}“ deklariert das platzierungsbezogene Unterfeld „{field}“ vom Typ „{type}“ — eine Platzierung enthält Angaben zu dieser Verwendung des Bildes (eine Bildunterschrift, ein Layout), niemals eine Referenz oder Rich Text.',
1382
1423
  'cms.issueMessage.sourceNotOnAssetCollection': 'Das Feld „{field}“ deklariert die Quelle „{source}“ — eine Quelle für eingebettete Metadaten füllt nur ein Feld der obersten Ebene der Asset-Sammlung.',
1424
+ 'cms.issueMessage.blocksOnAssetCollection': 'Das Feld „{field}“ ist ein „blocks“-Feld der Asset-Sammlung „{collection}“ — ein Asset enthält Angaben zu seiner Datei (Alternativtext, Bildnachweis, Bildunterschrift), nie eine Arbeitsfläche. Entfernen Sie das Feld; eine Seitenkomposition gehört in eine Dokument-Sammlung.',
1383
1425
  'cms.issueMessage.sourceTypeMismatch': 'Das Feld „{field}“ deklariert die Quelle „{source}“, die kein Feld vom Typ „{type}“ füllen kann (jede Quelle füllt Text; iptc:digitalSourceType auch einen Wahrheitswert).',
1384
1426
  'cms.issueMessage.uniqueNotTopLevel': 'Das Unterfeld „{field}“ deklariert „unique“ — Eindeutigkeit wird über die Dokumente einer Sammlung hinweg beurteilt und gilt daher nur für Felder auf oberster Ebene.',
1385
1427
  'cms.issueMessage.localizedOnProp': 'Die Komponenten-Eigenschaft „{field}“ deklariert „localized“ — ein sprachabhängiger Wert wird je Sprache im Dokument gespeichert, daher kann nur ein Dokumentfeld auf oberster Ebene sprachabhängig sein (machen Sie das Feld sprachabhängig, das die Komposition enthält).',