@elytracms/studio 0.0.104 → 0.0.106

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (59) hide show
  1. package/dist/components/app-views/module.d.ts +4 -0
  2. package/dist/components/app-views/module.js.map +1 -1
  3. package/dist/components/builder/builder-store.d.ts +19 -3
  4. package/dist/components/builder/builder-store.js +24 -13
  5. package/dist/components/builder/builder-store.js.map +1 -1
  6. package/dist/components/builder/clipboard-actions.js +6 -5
  7. package/dist/components/builder/clipboard-actions.js.map +1 -1
  8. package/dist/components/builder/composition-field-editor.js +4 -2
  9. package/dist/components/builder/composition-field-editor.js.map +1 -1
  10. package/dist/components/cms/document-diff-view.js +43 -7
  11. package/dist/components/cms/document-diff-view.js.map +1 -1
  12. package/dist/components/cms/duplicate-document.js +5 -5
  13. package/dist/components/cms/duplicate-document.js.map +1 -1
  14. package/dist/components/cms/rich-text/editor.d.ts +7 -1
  15. package/dist/components/cms/rich-text/editor.js +9 -4
  16. package/dist/components/cms/rich-text/editor.js.map +1 -1
  17. package/dist/components/cms/rich-text/embed-identity.d.ts +36 -0
  18. package/dist/components/cms/rich-text/embed-identity.js +114 -0
  19. package/dist/components/cms/rich-text/embed-identity.js.map +1 -0
  20. package/dist/components/cms/rich-text/extensions.d.ts +7 -1
  21. package/dist/components/cms/rich-text/extensions.js +7 -1
  22. package/dist/components/cms/rich-text/extensions.js.map +1 -1
  23. package/dist/components/cms/rich-text/insert.d.ts +10 -5
  24. package/dist/components/cms/rich-text/insert.js +10 -12
  25. package/dist/components/cms/rich-text/insert.js.map +1 -1
  26. package/dist/components/components/component-preview.d.ts +0 -2
  27. package/dist/components/components/component-preview.js +0 -4
  28. package/dist/components/components/component-preview.js.map +1 -1
  29. package/dist/components/components/transfer-dialog.js +3 -1
  30. package/dist/components/components/transfer-dialog.js.map +1 -1
  31. package/dist/components/components/transfer.d.ts +12 -8
  32. package/dist/components/components/transfer.js +16 -15
  33. package/dist/components/components/transfer.js.map +1 -1
  34. package/dist/components/redirects/redirects-schema.d.ts +31 -0
  35. package/dist/components/redirects/redirects-schema.js +12 -6
  36. package/dist/components/redirects/redirects-schema.js.map +1 -1
  37. package/dist/lib/ai/translate-document.d.ts +4 -1
  38. package/dist/lib/ai/translate-document.js +87 -47
  39. package/dist/lib/ai/translate-document.js.map +1 -1
  40. package/dist/lib/ai/writer-form.d.ts +48 -5
  41. package/dist/lib/ai/writer-form.js +119 -64
  42. package/dist/lib/ai/writer-form.js.map +1 -1
  43. package/dist/lib/engine-version.d.ts +1 -1
  44. package/dist/lib/engine-version.js +1 -1
  45. package/dist/lib/engine-version.js.map +1 -1
  46. package/dist/lib/i18n/messages.de.js +20 -1
  47. package/dist/lib/i18n/messages.de.js.map +1 -1
  48. package/dist/lib/i18n/messages.en.d.ts +20 -1
  49. package/dist/lib/i18n/messages.en.js +21 -2
  50. package/dist/lib/i18n/messages.en.js.map +1 -1
  51. package/dist/lib/persona/labels.js +2 -0
  52. package/dist/lib/persona/labels.js.map +1 -1
  53. package/dist/lib/registry/preview.d.ts +2 -1
  54. package/dist/lib/registry/preview.js +8 -3
  55. package/dist/lib/registry/preview.js.map +1 -1
  56. package/dist/lib/workspace/index.d.ts +9 -1
  57. package/dist/lib/workspace/index.js +13 -2
  58. package/dist/lib/workspace/index.js.map +1 -1
  59. package/package.json +3 -3
@@ -1 +1 @@
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,EAClB,SAAS,EACT,WAAW,EACX,kBAAkB,EAClB,gBAAgB,EAChB,eAAe,EACf,WAAW,EACX,mBAAmB,EACnB,aAAa,EACb,oBAAoB,EACpB,cAAc,EACd,kBAAkB,EAClB,sBAAsB,EACtB,c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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"]}
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,EAClB,SAAS,EACT,WAAW,EACX,kBAAkB,EAClB,gBAAgB,EAChB,eAAe,EACf,WAAW,EACX,mBAAmB,EACnB,aAAa,EACb,oBAAoB,EACpB,cAAc,EACd,kBAAkB,EAClB,sBAAsB,EACtB,cAAc,EACd,kBAAkB,EAClB,YAAY,GACb,MAAM,0BAA0B,CAAA;AAiBjC,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,K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AAO,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 ChildPosition,\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 position key (EC-774) -------------------------------------------------------\n\n/**\n * One step of a {@link PositionKey}, typed so that no step can be spelled as another: a\n * sub-field or prop NAME (a string), a repeater INDEX (a number), a component NODE\n * (`['node', id]`), an entry of an asset LIST by its asset id and occurrence\n * (`['asset', id, n]` — the carry's own matching, `carryAssetPlacements`: a reordered gallery\n * keeps each placement), and the mark of a value the traversal cannot read (`['opaque']`,\n * EC-748 — its own key space: an unreadable value never matches a readable one at its place).\n */\ntype KeySegment =\n | string\n | number\n | readonly ['node', string]\n | readonly ['asset', string | null, number]\n | readonly ['opaque']\n\n/** The steps from the walk's root (a field value, for every caller) down to one position. */\ntype KeyPath = readonly KeySegment[]\n\n/**\n * **THE position key** (EC-774, Codex r11 F56) — what names ONE position inside one field\n * value (one `(field, locale)` bucket), so that two positions never share a name: the JSON of\n * its typed {@link KeySegment}s, built parent → child over core's ONE traversal\n * (`childPositions`).\n *\n * - A component PROP: its enclosing SEQUENCE's key + `['node', id]` + the prop name. Anchored\n * by the node — an inline embed a translation moves keeps its key — and scoped to the\n * sequence that holds it: one node id in two rich-text values of an object, or in two\n * repeater items, is two keys.\n * - Any other child: its parent's key + its location below the parent (a sub-field by name,\n * a repeater item by index, an asset-list entry by asset id and occurrence).\n *\n * Injective: a node step cannot alias a name or an index, and no character inside a name can\n * split it. (The translator used to join locations with `/` and `|` and find a prop by\n * `lastIndexOf('props')`; a sub-field named `a/b` or a holder named `props` then shared a\n * name with another position, and both got the second one's translation.)\n *\n * Every fold that matches positions across two walks or two values reads it: the translator's\n * plan and rebuild ({@link textPositionsOf}, {@link rebuildTextPositions}), the locked carry\n * ({@link withLockedFrom}, {@link lockedChanges}) and a write's own child matching.\n *\n * A position under a component node whose id its sequence holds MORE THAN ONCE has no key\n * (`undefined`): core's writing fold addresses a prop by its node id within one sequence\n * (`rebuildFromChildren`), so it can never be written apart from its twin's. The translator\n * refuses it (`unreadable`); the locked carry leaves it as it is.\n */\nexport type PositionKey = string\n\nfunction keyString(path: KeyPath): PositionKey {\n return JSON.stringify(path)\n}\n\n/** The node a child is a prop of — a readable prop or one stored as no static member. */\nfunction propNodeOf(child: ChildPosition): string | undefined {\n if (isOpaquePosition(child)) return child.opaque === 'not-a-static-prop' ? child.component?.nodeId : undefined\n return child.kind === 'prop' ? child.component?.nodeId : undefined\n}\n\n/** A child's steps below its parent — the relative part of its {@link PositionKey}. */\nfunction childSegments(parent: ValuePosition, child: ChildPosition): KeyPath {\n const node = propNodeOf(child)\n if (isOpaquePosition(child)) {\n return node !== undefined\n ? [['opaque'], ['node', node], child.declaration.name]\n : [['opaque'], ...child.at.slice(parent.at.length)]\n }\n if (node !== undefined) return [['node', node], 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 [['asset', id ?? null, occurrence], ...below.slice(1)]\n }\n return below\n}\n\n/** The node ids a `blocks` / `richText` value holds more than once (none for any other value). */\nfunction twinNodeIds(position: ValuePosition): ReadonlySet<string> {\n const twins = new Set<string>()\n if (position.field.type !== 'blocks' && position.field.type !== 'richText') return twins\n const seen = new Set<string>()\n for (const { node } of sequenceComponentNodes(position.value)) (seen.has(node.id) ? twins : seen).add(node.id)\n return twins\n}\n\n/**\n * The key of each child of `parent`, whose own key is `parentKey`: `undefined` below a keyless\n * parent, and for a prop of a node its sequence holds twice (see {@link PositionKey}).\n */\nfunction childKeysUnder(parent: ValuePosition, parentKey: KeyPath | undefined): (child: ChildPosition) => KeyPath | undefined {\n if (parentKey === undefined) return () => undefined\n const twins = twinNodeIds(parent)\n return (child) => {\n const node = propNodeOf(child)\n return node !== undefined && twins.has(node) ? undefined : [...parentKey, ...childSegments(parent, child)]\n }\n}\n\n/**\n * The key matching a child position of the written value to the current value's, one level\n * down — the child's {@link PositionKey} steps below its parent.\n */\nfunction childKey(parent: ValuePosition, child: ChildPosition): string {\n return keyString(childSegments(parent, child))\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 const held = { ...pos, value: current }\n for (const child of childPositions(held, positionCtx)) currentChildren.set(childKey(held, child), child.value)\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(childKey(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/**\n * The locked judge's name for a position: its {@link PositionKey} — a component prop by its\n * NODE within its sequence (ids survive a prose edit that shifts indices), an asset-list\n * entry by its asset id and occurrence, anything else by its location below the parent.\n * EC-774: a position with no key (under a node its sequence holds twice) is named by its\n * LOCATION, in its own key space: {@link withLockedFrom} never takes it from the other value\n * (core's write fold would write it into its twin too), and it counts as kept only where the\n * other value holds the same locked value at the same location — fail closed.\n */\nfunction lockedKey(key: KeyPath | undefined, at: readonly (string | number)[]): string {\n return key !== undefined ? keyString(key) : JSON.stringify([['twin'], ...at])\n}\n\n/** Every topmost writer-locked position at or below `position`, by {@link lockedKey}. */\nfunction lockedPositionsUnder(position: ValuePosition, positionCtx: PositionContext): Map<string, LockedPosition> {\n const out = new Map<string, LockedPosition>()\n const visit = (pos: ValuePosition, key: KeyPath | undefined): void => {\n const lock = writerLockOf(pos.field)\n if (lock !== undefined) {\n out.set(lockedKey(key, pos.at), { value: pos.value, lock, at: pos.at })\n return\n }\n const keyOf = childKeysUnder(pos, key)\n for (const child of childPositions(pos, positionCtx)) {\n if (!isOpaquePosition(child)) {\n visit(child, keyOf(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(lockedKey(keyOf(child), child.at), { 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: KeyPath | undefined): unknown => {\n if (writerLockOf(pos.field) !== undefined) {\n // EC-774: a position with no key (under a node its sequence holds twice) keeps its own\n // value — taken from `current`, core's write fold would write it into its twin too.\n if (key === undefined) return pos.value\n const name = keyString(key)\n return held.has(name) ? held.get(name)!.value : pos.value\n }\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 const keyOf = childKeysUnder(pos, key)\n return rebuildFromChildren(pos, positionCtx, (child) => rebuild(child, keyOf(child)), (unreadable) => unreadable.value)\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 // Codex r12 F58: every position the address names. A node id is unique within the document\n // (EC-776: `duplicate-node-id` refuses the publish), but STORED drift may still repeat one, and the\n // rebuild below replaces EVERY match — so an address naming two positions is refused, never\n // written: the defence for stored drift.\n let targets = 0\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 (position.field.name === prop) targets++\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 (targets > 1) {\n return {\n ok: false,\n message: `Component \"${nodeId}\" (${componentId}) occurs in ${targets} positions of \"${field.name}\" (a duplicate id), so this address does not name one of them; the assistant cannot change prop \"${prop}\" here. Change it in the editor.`,\n }\n }\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 * A text position with its {@link PositionKey} below the walk's root (EC-774) — `undefined`\n * when it has none: it sits under a component node whose id its sequence holds twice, and so\n * can never be written apart from its twin's.\n */\nexport interface TextPosition extends ValuePosition {\n readonly key: PositionKey | undefined\n}\n\n/** A {@link TextPosition} that has a key — the only kind the writing fold hands back. */\nexport interface KeyedTextPosition extends TextPosition {\n readonly key: PositionKey\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. Each\n * carries its {@link PositionKey} (EC-774) — the one name the plan and the rebuild share.\n */\nexport function textPositionsOf(\n position: ValuePosition,\n ctx: Pick<WriterFormContext, 'lookupManifest'>,\n): TextPosition[] {\n const positionCtx = ctx.lookupManifest ? { lookupManifest: ctx.lookupManifest } : {}\n const out: TextPosition[] = []\n const visit = (current: ValuePosition, key: KeyPath | undefined): void => {\n if (isLocked(current)) return\n if (isTextPosition(current)) out.push({ ...current, key: key && keyString(key) })\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 const keyOf = childKeysUnder(current, key)\n for (const child of childPositions(current, positionCtx)) if (!isOpaquePosition(child)) visit(child, keyOf(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, under the same key). Every\n * other value — an image, a select, a component's structure — comes back as it was\n * (identity-preserving), and so does a text position with no key (EC-774: `replace` never\n * sees one — it cannot be written apart from its twin).\n */\nexport function rebuildTextPositions(\n position: ValuePosition,\n ctx: Pick<WriterFormContext, 'lookupManifest'>,\n replace: (textPosition: KeyedTextPosition) => unknown,\n): unknown {\n const positionCtx = ctx.lookupManifest ? { lookupManifest: ctx.lookupManifest } : {}\n const rebuild = (current: ValuePosition, key: KeyPath | undefined): unknown => {\n if (isLocked(current)) return current.value\n const keyed = key && { ...current, key: keyString(key) }\n if (current.field.type === 'text') return keyed ? replace(keyed) : current.value\n const value = keyed && isTextPosition(current) ? replace(keyed) : current.value\n const replaced = { ...current, value }\n const keyOf = childKeysUnder(replaced, key)\n // EC-748: an unreadable value comes back as it was (it held no unit).\n return rebuildFromChildren(replaced, positionCtx, (child) => rebuild(child, keyOf(child)), (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.104";
16
+ export declare const ENGINE_VERSION = "0.0.106";
@@ -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.104';
16
+ export const ENGINE_VERSION = '0.0.106';
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.104'\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.106'\n"]}
@@ -528,11 +528,13 @@ export const deMessages = {
528
528
  'cms.issue.asset-without-url': 'Mediendatei ohne Datei',
529
529
  'cms.issue.asset-meta-drift': 'Ungenutzte Übersetzung einer Mediendatei',
530
530
  'cms.issue.duplicate-document': 'Doppelter Eintrag',
531
+ 'cms.issue.duplicate-node-id': 'Doppelte Komponenten-ID',
531
532
  'cms.issue.unknown-locale': 'Unbekannte Sprache',
532
533
  'cms.issue.missing-localized-value': 'Fehlende Übersetzung',
533
534
  'cms.issue.route-conflict': 'URL-Konflikt',
534
535
  'cms.issue.redirect-loop': 'Weiterleitungsschleife',
535
536
  'cms.issue.invalid-redirect': 'Ungültige Weiterleitung',
537
+ 'cms.issue.invalid-route': 'Ungültige Route',
536
538
  'cms.issue.unknown-route-target': 'Fehlende Seite',
537
539
  'cms.issue.hierarchy-cycle': 'Schleife in der Seitenhierarchie',
538
540
  'cms.issue.document-nesting-depth': 'Inhalt zu tief verschachtelt',
@@ -573,6 +575,7 @@ export const deMessages = {
573
575
  // `cms.issueDetail.*` are FRAGMENTS spliced into the sentences above.
574
576
  // ─────────────────────────────────────────────────────────────────────────
575
577
  'cms.issueMessage.duplicateDocument': 'Doppeltes Dokument „{id}“ in der Sammlung „{collection}“.',
578
+ 'cms.issueMessage.duplicateNodeId': 'Feld „{field}“: Die Komponenten-ID „{id}“ verwendet bereits eine andere Komponente in diesem Dokument – jede Komponente braucht ihre eigene ID (diese wurde ohne neue kopiert). Entfernen Sie sie und fügen Sie sie neu ein, um zu veröffentlichen; der Entwurf behält sie.',
576
579
  'cms.issueMessage.fieldDetail': 'Das Feld „{field}“ {detail}.',
577
580
  'cms.issueMessage.fieldReason': 'Feld „{field}“: {reason}',
578
581
  'cms.issueMessage.fieldHiddenPredicateThrew': 'Die Sichtbarkeitsregel des Feldes „{field}“ hat einen Fehler ausgelöst („{reason}“), daher wird das Feld angezeigt und geprüft. Korrigieren Sie die Regel in der Projektkonfiguration.',
@@ -649,16 +652,26 @@ export const deMessages = {
649
652
  'cms.issueMessage.redirectLoop': 'Die Weiterleitungskette ab „{from}“ bildet eine Schleife (…{chain}).',
650
653
  'cms.issueMessage.duplicateRedirect': 'Die Weiterleitung von „{redirectFrom}“ doppelt die Weiterleitung von „{keptFrom}“ — ohne abschließende Schrägstriche und mit decodierter Prozentkodierung sind beide „{from}“. Die Weiterleitung von „{keptFrom}“ gilt; lösche oder ändere diese.',
651
654
  'cms.issueMessage.redirectFromMalformed': 'Die Weiterleitung von „{from}“ enthält ein „%“, das keine Prozentkodierung ist; sie kann deshalb keine Anfrage treffen und wird nicht ausgeliefert. Schreibe das Zeichen selbst, oder „%25“ für ein Prozentzeichen.',
655
+ 'cms.issueMessage.redirectToRefused': 'Die Weiterleitung von „{from}“ wird nicht ausgeliefert: Ihr Ziel {reason}. Ein Ziel ist ein Pfad auf dieser Website, der mit „/“ beginnt (z. B. „/new-page“), oder eine vollständige http://- oder https://-URL.',
656
+ 'cms.issueDetail.redirectToRelative': 'ist weder ein Pfad, der mit „/“ beginnt, noch eine vollständige http://- oder https://-URL',
657
+ 'cms.issueDetail.redirectToOtherHost': 'beginnt mit „//“ oder „/\\“, was ein Browser als anderen Host liest',
658
+ 'cms.issueDetail.redirectToScheme': 'verwendet das Schema „{scheme}“, und nur http:// und https:// werden ausgeliefert',
659
+ 'cms.issueDetail.redirectToNotUrl': 'ist keine gültige http://- oder https://-URL',
660
+ 'cms.issueDetail.redirectToMalformedPercent': 'enthält ein „%“, das keine Prozentkodierung ist (schreiben Sie das Zeichen selbst, oder „%25“ für ein Prozentzeichen)',
661
+ 'cms.issueDetail.redirectToBrokenCharacter': 'enthält die Hälfte eines Zeichens (ein einzelnes UTF-16-Surrogat), die keine URL tragen kann',
662
+ 'cms.issueDetail.redirectToDotSegment': 'enthält ein Segment „.“ oder „..“, das ein Browser vor der Anfrage entfernt',
652
663
  'cms.issueMessage.redirectUnreadable': 'Die gespeicherte Weiterleitung {redirect} konnte nicht gelesen werden und wird nicht ausgeliefert ({reason}).',
653
664
  'cms.issueMessage.redirectReportUnreadable': 'Das Deployment meldete das Weiterleitungsproblem #{index}, das diese Website nicht lesen kann — eine Weiterleitung wird nicht ausgeliefert; betreibe die Website mit der Engine-Version des Deployments.',
654
665
  'cms.issueMessage.allDynamicShadowsMount': 'Die Route „{route}“ („{pattern}“) besteht nur aus dynamischen Segmenten und trifft damit auf JEDE URL mit {depth} Segmenten zu — die Hierarchie-Einhängung „{mountRoute}“ („{mountPattern}“) wird auf dieser Ebene nur dort herangezogen, wo die Route kein Dokument auflöst. Nichts ist dadurch grundsätzlich unerreichbar, aber der Vorrang entscheidet sich dort am INHALT statt an den Routen: {shadowed} werden stillschweigend verdeckt, sobald ein zusammengesetzter Pfad mit {claimed} kollidiert — und keine Seite erfährt davon. Geben Sie der Route ein statisches Präfix („/blog/:slug“), damit sie einen Namensraum beansprucht statt einer ganzen Ebene.',
655
666
  'cms.issueMessage.mountCannotServe': 'Die Hierarchie-Einhängung „{route}“ („{pattern}“) kann niemals ein Dokument ausliefern: {why}. Der Resolver überspringt eine solche Einhängung stillschweigend, deshalb liefert jede URL unter „{space}“ einen 404, ohne dass ein Hinweis erscheint.',
656
667
  'cms.issueMessage.routeSegmentNotText': 'Die Route „{route}“ („{pattern}“) wird nicht ausgeliefert: Ein Segment des Musters ist kein URL-Text ({segments}). Ein Muster wird als Text geschrieben — "/über-uns", nicht "/%C3%BCber-uns" — und seine Links werden kodiert; deshalb wird ein „%“ abgelehnt, ebenso ein Segment „.“ oder „..“ (ein Browser entfernt es vor der Anfrage) und die Hälfte eines Zeichens (keine URL kann sie tragen). Schreiben Sie das Segment um.',
657
668
  'cms.issueMessage.routePatternDelimiter': 'Die Route „{route}“ („{pattern}“) wird nicht ausgeliefert: Das Muster enthält {delimiters}; eine URL liest das als Beginn ihrer Abfrage oder ihres Fragments, die Route würde also dort enden. Ein Muster ist ein Pfad — entfernen Sie das Zeichen.',
669
+ 'cms.issueMessage.routeParameterReserved': 'Die Route „{route}“ („{pattern}“) wird nicht ausgeliefert: Ein Parametername ist reserviert ({names}) — jedes JavaScript-Objekt kennt ihn bereits (als Mitglied von Object.prototype), daher findet ein Zugriff über diesen Namen das geerbte Mitglied, wo nichts erfasst ist. Benennen Sie den Parameter um.',
670
+ 'cms.issueMessage.routeParameterNotIdentity': 'Die Route „{route}“ („{pattern}“) wird nicht ausgeliefert: Ihr Dokument wird allein über den Parameter „:{identity}“ gefunden, daher muss das Muster genau diesen einen Parameter enthalten. Jeder andere Parameter wird nie mit dem Dokument verglichen — jeder seiner Werte würde dieselbe Seite adressieren. Machen Sie „:{identity}“ zum einzigen Parameter des Musters, oder binden Sie kein Dokument.',
671
+ 'cms.issueMessage.routeLiteralWithParameter': 'Die Route „{route}“ („{pattern}“) wird nicht ausgeliefert: Sie ist an das eine Dokument „{id}“ gebunden, daher darf ihr Muster keinen Parameter enthalten — jeder Wert eines Parameters würde dieselbe Seite adressieren. Entfernen Sie den Parameter, oder binden Sie das Dokument über ihn (eine Dokument-ID „:name“).',
658
672
  'cms.issueMessage.deadCatchAll': 'Die Route „{route}“ („{pattern}“) liefert in beide Richtungen nichts: Sie endet in einem Catch-all, deshalb verwirft sie jeder Router — ihr Präfix enthält aber ein dynamisches Segment ({dynamic}), deshalb wird auch keine Hierarchie-Einhängung daraus gebaut. Das Präfix einer Einhängung muss statisch sein — deklarieren Sie eine Einhängung pro Sprache (`{ pattern: \'/de/:path*\', locale: \'de\' }`) oder entfernen Sie die Route.',
659
673
  'cms.issueMessage.mountConflict': '{opening} — ein exakter Gleichstand, nur durch die Deklarationsreihenfolge getrennt; deshalb beansprucht „{earlier}“ (Sammlung „{earlierCollection}“) dort jede URL, die der eigene Baum auflöst, und Dokumente aus „{laterCollection}“ sind an diesen URLs unerreichbar.',
660
674
  'cms.issueMessage.routeBoundDocumentNotFound': 'Das an die Route gebundene Dokument „{collection}:{id}“ wurde nicht gefunden.',
661
- 'cms.issueMessage.routeParamNotCaptured': 'Die Route „{route}“ bindet ihr Dokument an den URL-Parameter „:{param}“, den das Muster „{pattern}“ nicht erfasst.',
662
675
  'cms.issueMessage.collectionNotDefined': 'Die Sammlung „{collection}“ ist nicht definiert.',
663
676
  'cms.issueMessage.storedDocumentUnreadable': 'Das gespeicherte Dokument {document} konnte nicht gelesen werden und wird nicht ausgeliefert ({reason}).',
664
677
  'cms.issueMessage.unaddressableLocaleCollision': 'Keine URL erreicht „{id}“ in der Sprache „{locale}“: die Adresse wäre „{url}“, aber das erste Segment „{segment}“ ist ein deklarierter Sprachcode — die Website liest diese URL daher als Sprache „{segment}“, Pfad „{readPath}“. Benennen Sie dieses Segment um — an diesem Dokument oder an der übergeordneten Seite, zu der es gehört — damit es nicht mit einem Sprachcode kollidiert.',
@@ -998,6 +1011,10 @@ export const deMessages = {
998
1011
  'redirects.field.to.label': 'Ziel',
999
1012
  'redirects.field.permanent.label': 'Dauerhaft (301)',
1000
1013
  'redirects.field.enabled.label': 'Aktiv',
1014
+ 'redirects.field.from.description': 'Der Pfad, der weitergeleitet wird, genau wie Besucher ihn aufrufen (z. B. /alte-seite). Ein Sprachpräfix gehört zum Pfad: Jede Sprachfassung braucht eine eigene Weiterleitung.',
1015
+ 'redirects.field.to.description': 'Ein Pfad auf dieser Website, der mit / beginnt (z. B. /neue-seite), oder eine vollständige https://-URL.',
1016
+ 'redirects.field.permanent.description': 'An: 301 dauerhaft. Aus: 302 vorübergehend.',
1017
+ 'redirects.field.enabled.description': 'Nur aktive Weiterleitungen werden auf der Live-Website ausgeliefert.',
1001
1018
  // ─────────────────────────────────────────────────────────────────────────
1002
1019
  // References panel
1003
1020
  // ─────────────────────────────────────────────────────────────────────────
@@ -1418,6 +1435,7 @@ export const deMessages = {
1418
1435
  '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.',
1419
1436
  '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.',
1420
1437
  'cms.issueMessage.slugNotEncodable': 'Das Slug-Feld „{field}“ enthält ein kaputtes Zeichen — die Hälfte eines zusammengesetzten Zeichens wie eines Emojis (ein einzelnes UTF-16-Surrogat), das keine URL tragen kann. Daraus wird keine URL gebildet — ändern Sie den Slug.',
1438
+ 'cms.issueMessage.documentIdNotSegment': 'Eine Dokument-ID muss als ein einzelnes URL-Segment verwendbar sein — nicht „.“ oder „..“, kein „/“ und keine Hälfte eines Zeichens (ein einzelnes UTF-16-Surrogat). Eine Route greift auf die ID zurück, wo ein Dokument keinen Slug hat, und keine URL kann diese tragen. Wählen Sie eine andere ID.',
1421
1439
  // EC-584 — die AllowList-Prüfung (Konfiguration / Registrierung).
1422
1440
  '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.',
1423
1441
  '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“.',
@@ -1436,6 +1454,7 @@ export const deMessages = {
1436
1454
  'cms.issueMessage.boundNotANumber': 'Das Feld „{field}“ deklariert {rule} {declared} als String — die Grenzen eines Felds vom Typ „{type}“ sind Zahlen (nur ein Datumsfeld nimmt ein ISO-Datum als Grenze).',
1437
1455
  'cms.issueMessage.invalidPattern': 'Das Feld „{field}“ deklariert das Muster „{pattern}“, das kein gültiger regulärer Ausdruck ist.',
1438
1456
  'cms.issueMessage.defaultNotOfType': 'Das Feld „{field}“ deklariert den Standardwert {value}, der kein Wert vom Typ „{type}“ ist.',
1457
+ 'cms.issueMessage.defaultHoldsComponents': 'Das Feld „{field}“ deklariert einen Standardwert mit Komponenten – jede Kopie des Standardwerts würde deren IDs wiederholen, und eine Komponenten-ID ist innerhalb eines Dokuments eindeutig. Beschränken Sie den Standardwert auf Text und fügen Sie Komponenten im Editor (oder in einem Seed) ein.',
1439
1458
  'cms.issueDetail.fewerPlainTextCharacters': 'hat weniger als {min} Zeichen Klartext',
1440
1459
  'cms.issueDetail.morePlainTextCharacters': 'hat mehr als {max} Zeichen Klartext',
1441
1460
  'content.queryError.operatorNotForType': 'Der Operator „{operator}“ gilt nicht für „{field}“, ein Feld vom Typ „{type}“.',