@things-factory/figure-ui 10.1.269 → 10.1.271

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 (69) hide show
  1. package/client/graphql/index.ts +2 -0
  2. package/client/modeller/data-interface.ts +14 -0
  3. package/client/modeller/editor-styles.ts +11 -0
  4. package/client/modeller/editor.ts +39 -11
  5. package/client/modeller/fasten-form.ts +6 -1
  6. package/client/modeller/fasten-geometry.ts +11 -1
  7. package/client/modeller/figure-fasten-drawing.ts +2 -3
  8. package/client/modeller/figure-preview.ts +9 -1
  9. package/client/modeller/palette.ts +27 -0
  10. package/client/modeller/product-session.ts +5 -1
  11. package/client/types.ts +2 -0
  12. package/dist-client/graphql/index.js +2 -0
  13. package/dist-client/graphql/index.js.map +1 -1
  14. package/dist-client/modeller/clips.d.ts +2 -2
  15. package/dist-client/modeller/data-interface.d.ts +5 -0
  16. package/dist-client/modeller/data-interface.js +15 -0
  17. package/dist-client/modeller/data-interface.js.map +1 -1
  18. package/dist-client/modeller/editor-styles.js +11 -0
  19. package/dist-client/modeller/editor-styles.js.map +1 -1
  20. package/dist-client/modeller/editor.d.ts +6 -0
  21. package/dist-client/modeller/editor.js +35 -11
  22. package/dist-client/modeller/editor.js.map +1 -1
  23. package/dist-client/modeller/fasten-form.js +6 -2
  24. package/dist-client/modeller/fasten-form.js.map +1 -1
  25. package/dist-client/modeller/fasten-geometry.d.ts +6 -0
  26. package/dist-client/modeller/fasten-geometry.js +10 -1
  27. package/dist-client/modeller/fasten-geometry.js.map +1 -1
  28. package/dist-client/modeller/figure-capability-panel.d.ts +1 -1
  29. package/dist-client/modeller/figure-cavity-drawing.d.ts +1 -1
  30. package/dist-client/modeller/figure-clips.d.ts +1 -1
  31. package/dist-client/modeller/figure-controls.d.ts +1 -1
  32. package/dist-client/modeller/figure-data-panel.d.ts +1 -1
  33. package/dist-client/modeller/figure-face-mapping.d.ts +1 -1
  34. package/dist-client/modeller/figure-fasten-dialog.d.ts +1 -1
  35. package/dist-client/modeller/figure-fasten-drawing.d.ts +1 -1
  36. package/dist-client/modeller/figure-fasten-drawing.js +2 -3
  37. package/dist-client/modeller/figure-fasten-drawing.js.map +1 -1
  38. package/dist-client/modeller/figure-links.d.ts +1 -1
  39. package/dist-client/modeller/figure-material-panel.d.ts +1 -1
  40. package/dist-client/modeller/figure-pipe-panel.d.ts +1 -1
  41. package/dist-client/modeller/figure-preview.js +9 -1
  42. package/dist-client/modeller/figure-preview.js.map +1 -1
  43. package/dist-client/modeller/figure-section-editor.d.ts +1 -1
  44. package/dist-client/modeller/figure-section-panel.d.ts +1 -1
  45. package/dist-client/modeller/figure-size-editor.d.ts +1 -1
  46. package/dist-client/modeller/figure-slot-layout-panel.d.ts +1 -1
  47. package/dist-client/modeller/group-menu.d.ts +1 -1
  48. package/dist-client/modeller/help.d.ts +1 -1
  49. package/dist-client/modeller/palette.d.ts +14 -0
  50. package/dist-client/modeller/palette.js +23 -0
  51. package/dist-client/modeller/palette.js.map +1 -1
  52. package/dist-client/modeller/product-session.js +6 -2
  53. package/dist-client/modeller/product-session.js.map +1 -1
  54. package/dist-client/route.d.ts +1 -1
  55. package/dist-client/tsconfig.tsbuildinfo +1 -1
  56. package/dist-client/types.d.ts +2 -0
  57. package/dist-client/types.js.map +1 -1
  58. package/package.json +5 -5
  59. package/test/data-motion.test.ts +8 -0
  60. package/test/fasten-form.test.ts +13 -0
  61. package/test/fasten-geometry.test.ts +25 -1
  62. package/test/first-part-on-plane.test.ts +52 -0
  63. package/test/save-landed.test.ts +20 -1
  64. package/translations/en.json +1 -0
  65. package/translations/es.json +1 -0
  66. package/translations/ja.json +1 -0
  67. package/translations/ko.json +1 -0
  68. package/translations/ms.json +1 -0
  69. package/translations/zh.json +1 -0
@@ -1 +1 @@
1
- {"version":3,"file":"product-session.js","sourceRoot":"","sources":["../../client/modeller/product-session.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAA;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KAAK,CAAA;oBACb,CAAC;gBACH,CAAC;gBACD,IAAI,YAAY,KAAK,KAAK;oBAAE,OAAO,IAAI,EAAE,CAAA;gBACzC,IAAI,CAAC,MAAM,CAAC,EAAE,IAAI,CAAC,EAAE,KAAK,SAAS,IAAI,MAAM,CAAC,EAAE,KAAK,EAAE,CAAC;oBAAE,MAAM,KAAK,CAAC,yBAAyB,CAAC,CAAA;gBAChG,IAAI,oBAAoB,CAAC,gBAAgB,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,KAAK,QAAQ,CAAC,IAAI;oBACzE,MAAM,KAAK,CAAC,wCAAwC,CAAC,CAAA;gBACvD,yFAAyF;gBACzF,EAAE,GAAG,MAAM,CAAC,EAAE,CAAA;gBACd,QAAQ,GAAG,MAAM,CAAC,MAAM,CAAA;gBACxB,WAAW,CAAC,KAAK,EAAE,CAAA;gBACnB,QAAQ,GAAG,SAAS,CAAA;gBACpB;;;kBAGE;gBACF,IAAI,SAAS,CAAC,IAAI,EAAE,CAAC,QAAQ,KAAK,QAAQ,CAAC,QAAQ;oBAAE,SAAS,CAAC,gBAAgB,CAAC,QAAQ,CAAC,CAAA;YAC3F,CAAC;QACH,CAAC;KACF,CAAA;AACH,CAAC","sourcesContent":["import { thumbnailHashOf } from './thumbnail-hash.js'\nimport { revisionFromView, type FigureRevision } from './revision.js'\nimport {\n createFigureAsset,\n createFigureEditorWorkspace,\n serializeFigureAsset,\n parseFigureAsset,\n figureSizeRangeFitsOf,\n type FigureSizeRangeFit,\n type FigureInputChange,\n type FigurePrimitiveCreation,\n type FigurePartEdit,\n type FigureAuthoringAction,\n type FigureProposalStep,\n type FigureClipConsent\n} from '@hatiolab/figure-model'\n\n/** Consent to let clips go, and the figure and version it was given on. */\n\n/**\n * A request the session refuses, with its code: a screen says it from the code (`sessionRefusalOf`), never from the\n * message, which stays for logs (ADR-0054; figure audit 2026-10-16 N6 -- an AI card put the message in its note).\n */\nfunction refusal(code: string, message: string): Error & { code: string } {\n return Object.assign(Error(message), { code })\n}\n\nexport interface FigureClipConsentFor extends FigureClipConsent {\n context: string\n revision: number\n}\n\nexport interface FigureProductRecord {\n id: string\n source: string\n}\n\n/**\n * The row's catalogue fields -- the type (before release), the category, the tags. Kept on the row, not in the asset,\n * and saved with it by 「저장」: written at once on change, they stayed after 「저장하지 않고 떠나기」 and the save\n * button never lit for them (2026-11-01 audit item 5).\n */\nexport interface FigureCatalogPatch {\n type?: string\n category?: string\n tags?: string[]\n}\n\n/** A catalogue field as the editor saw it before changing it; null when it was empty. */\nexport type FigureCatalogSeen = { [K in keyof FigureCatalogPatch]?: FigureCatalogPatch[K] | null }\n\n/** Another editor changed a catalogue field first: which, and what the row holds now. */\nexport interface FigureCatalogConflict {\n field: keyof FigureCatalogPatch\n now: string | string[] | null\n}\n\n/** Persistence is injected; neither the model engine nor the renderer owns the product ID. */\nexport interface FigureProductStore {\n load(id: string): Promise<FigureProductRecord>\n /** Every field a save writes, as the server holds it now: to tell whether a save whose answer was lost landed. */\n readBack?(id: string): Promise<FigureProductRecord & { thumbnailHash?: string; type?: string }>\n save(request: {\n id?: string\n source: string\n expectedSource?: string\n creationId?: string\n /** The card's picture. Absent when the browser could not draw one; the source is saved either way. */\n thumbnail?: string\n /** The type name a new figure is created under (the first save asks for it). Not sent for an existing one. */\n type?: string\n /** The namespace a new figure is created under, when the first save chose one. Not sent for an existing one. */\n namespace?: string\n /** Keys of the AI proposals whose steps the source holds: the server records them with the save. */\n proposalKeys?: string[]\n }): Promise<FigureProductRecord>\n /**\n * Writes the row's catalogue fields of a saved figure, only while the row still holds them as `seen` says -- else it\n * is refused with FIGURE_CATALOG_CONFLICT and the fields the row holds now.\n */\n updateCatalog(id: string, patch: FigureCatalogPatch, seen: FigureCatalogSeen): Promise<unknown>\n}\n\nconst sameValue = (a: unknown, b: unknown) => JSON.stringify(a ?? null) === JSON.stringify(b ?? null)\n\n/**\n * A catalogue value as the server compares it (figure-service catalogConflictsOf): an empty category or type, or an\n * empty tag list, is no value -- null; tags keep their order, which is part of the value.\n */\nconst catalogValue = (value: unknown) => (value === '' || (Array.isArray(value) && !value.length) ? null : (value ?? null))\nconst sameCatalogValue = (a: unknown, b: unknown) => sameValue(catalogValue(a), catalogValue(b))\n\n/** Product lifecycle boundary. A late response can never change another editor's asset or ID. */\nexport function createFigureProductSession(store: FigureProductStore) {\n const workspace = createFigureEditorWorkspace()\n let epoch = 0,\n id: string | undefined,\n baseline: string | undefined\n let loading = false,\n saving = false,\n error: string | undefined\n let creationId: string | undefined\n /*\n The history as steps, each tagged with the AI proposal it came from (or nothing): mirrored here, since the\n workspace's history does not say where a step came from. A proposal is in the model while its step is on `done` --\n undone, it is not; undone and written past, it never comes back. What a save sends as `proposalKeys`.\n */\n let done: Array<string | undefined> = [],\n undone: Array<string | undefined> = []\n /*\n A save refused because the server holds another source than the one opened (FIGURE_SOURCE_CONFLICT, not one of\n this session's own sends): the edits stay, and the server's latest is kept here to compare with and, if the person\n says so, to write over (2026-11-01 audit item 6). Undefined source: the latest could not be read.\n */\n let conflict: { source?: string } | undefined\n /* The catalogue fields changed and not saved yet; none of the history -- undo is the figure's steps. */\n let catalog: FigureCatalogPatch = {}\n /* The catalogue fields a save is writing now: what the row will hold, not what it held, until it is done. */\n let catalogSending: FigureCatalogPatch | undefined\n /*\n The catalogue fields the last save wrote, known to be on the row from the moment it answered: a screen compares\n with them before it has read the row again (2026-11-01 third re-check). Empty from the start of each save.\n */\n let catalogWritten: FigureCatalogPatch = {}\n /*\n What the row held for each field held in `catalog`, as the editor saw it when it first changed it: sent with the\n save, which goes on only while the row still holds it (outside review 2026-11-09: a later tab wrote over another's\n category without a word). After a conflict it is what the row holds then, so saving again writes over it knowingly.\n */\n let catalogSeen: FigureCatalogSeen = {}\n const catalogHeld = () => Object.keys(catalog).length > 0\n /* The author's size ends the last step moved without being asked (ADR-0087 decision 6), told once. */\n let fitted: FigureSizeRangeFit[] = []\n function tracked<T>(kind: 'do' | 'undo' | 'redo', run: () => T, tag?: string, setsRange = false): T {\n const was = workspace.read()\n const result = run()\n const now = workspace.read()\n if (now.revision === was.revision) return result\n fitted = kind === 'do' && !setsRange && was.asset && now.asset ? figureSizeRangeFitsOf(was.asset, now.asset) : []\n if (kind === 'do') {\n done.push(tag)\n undone = []\n } else if (kind === 'undo') undone.push(done.pop())\n else done.push(undone.pop())\n return result\n }\n const inEffect = () => [...new Set(done.filter((tag): tag is string => !!tag))]\n /*\n The creation id is read with the rest: a figure not saved yet is named by it (ADR-0061 decision 3) -- its AI\n conversation is anchored on it, and its first save inserts the row under it, so the name holds across that save.\n */\n function read() {\n const view = workspace.read()\n return { ...view, dirty: view.dirty || catalogHeld(), catalog: { ...catalog }, catalogWritten: { ...catalogWritten }, conflict: conflict ? { latest: conflict.source } : undefined, id, creationId, loading, saving, error }\n }\n /*\n The version on screen, one object for as long as it is the version: the workspace hands out one asset per version\n (and another once a save is acknowledged, or the figure moves on), so that object says whether the last one holds.\n */\n let shown: FigureRevision | undefined\n function revisionNow(): FigureRevision | undefined {\n const view = workspace.read()\n if (!view.context || view.revision === null) return (shown = undefined)\n const context = view.context\n if (shown?.asset !== view.asset) shown = revisionFromView(view, () => workspace.export({ context }).text)\n return shown\n }\n /* Texts sent whose save was never answered: found on the server, the server is confirmed to hold what was sent. */\n const unconfirmed = new Map<string, { thumbnail?: string }>()\n /*\n Consent to let clips go: given for one edit, on the figure and the version it was asked on. The first edit made under\n it takes it; an edit on another figure or another version is refused rather than let clips go that were never named\n for it (designer 2026-09-27).\n */\n let consent: FigureClipConsentFor | undefined\n const consented = () => {\n if (!consent) return {}\n const given = consent\n consent = undefined\n const view = workspace.read()\n if (view.context !== given.context || view.revision !== given.revision) {\n const stale = Object.assign(Error('확인한 뒤 모델이 바뀌어 적용하지 않았습니다. 다시 해 주세요.'), { code: 'CONSENT_STALE' })\n throw stale\n }\n return { dropClips: given.dropClips }\n }\n /* A model open to read: the draft is read during a save too -- the dock reads it when the person sends (audit N5). */\n function readable() {\n const view = workspace.read()\n if (loading || error || !view.context || view.revision === null) throw refusal('SESSION_NOT_OPEN', '먼저 모델을 정상적으로 열어 주세요.')\n return { context: view.context, expectedRevision: view.revision, origin: 'ui' as const }\n }\n function writable() {\n const open = readable()\n // Serializing writes also makes create retries safe: no second create while the first is pending.\n if (saving) throw refusal('SESSION_SAVING', '저장이 끝난 뒤 편집해 주세요.')\n return open\n }\n function clear() {\n workspace.close({ discardDesignChanges: true })\n id = undefined\n baseline = undefined\n error = undefined\n saving = false\n creationId = undefined\n catalog = {}\n catalogWritten = {}\n catalogSeen = {}\n conflict = undefined\n done = []\n undone = []\n }\n function canLeave(discard: boolean) {\n if (saving) throw Error('저장이 끝난 뒤 모델을 전환해 주세요.')\n if ((workspace.read().dirty || catalogHeld()) && !discard) throw Error('저장하지 않은 변경이 있습니다.')\n }\n return {\n read,\n /** The figure on screen at its version, for every panel and helper to read; none while nothing is open. Readable while saving. */\n revisionNow,\n /**\n * The source the server is confirmed to hold: loaded, or answered by a save. What a revert sends as `expectedSource`\n * -- the server writes over it only while it still holds this. Nothing for a figure not saved yet.\n */\n confirmedSource: () => (id ? baseline : undefined),\n /**\n * A catalogue field changed, held for the next save; one changed back to what the row holds (`saved`) is no\n * change. Only a saved figure has a row to write: a new figure's type goes with its first save. Taken while a save\n * is on its way too: the field shows it, so it is held for the save after (2026-11-01 re-check). A field that save\n * is writing is held whatever it is changed to -- back to the old value too, which the save is about to replace;\n * the save done lets go only of a value it wrote (2026-11-01 second re-check).\n */\n editCatalog(patch: FigureCatalogPatch, saved: FigureCatalogPatch) {\n if (!id) throw refusal('SESSION_NOT_SAVED', '먼저 저장해 주세요.')\n const next = { ...catalog }\n const seen = { ...catalogSeen }\n for (const key of Object.keys(patch) as (keyof FigureCatalogPatch)[]) {\n if (!(catalogSending && key in catalogSending) && sameCatalogValue(patch[key], saved[key])) {\n delete next[key]\n delete seen[key]\n } else {\n (next as Record<string, unknown>)[key] = patch[key]\n if (!(key in seen)) (seen as Record<string, unknown>)[key] = catalogValue(saved[key])\n }\n }\n catalog = next\n catalogSeen = seen\n return read()\n },\n /**\n * After a conflict, the edits written over the server's latest: the next save expects that latest, so it goes\n * through only while the server still holds it -- a third change meanwhile is a conflict again.\n */\n overwriteConflict() {\n if (saving) throw refusal('SESSION_SAVING', '저장이 끝난 뒤 편집해 주세요.')\n if (!conflict?.source) throw refusal('SESSION_NO_CONFLICT', '덮어쓸 최신본을 읽지 못했습니다.')\n baseline = conflict.source\n conflict = undefined\n unconfirmed.clear()\n return read()\n },\n /**\n * After a conflict, the edits kept as a figure of their own: from here they are a new figure, under a new creation\n * id, saved by the first save's question; the figure they came from is left as the server holds it.\n */\n detachAsCopy() {\n if (saving) throw refusal('SESSION_SAVING', '저장이 끝난 뒤 편집해 주세요.')\n if (!conflict) throw refusal('SESSION_NO_CONFLICT', '충돌한 저장이 없습니다.')\n id = undefined\n baseline = undefined\n creationId = crypto.randomUUID()\n conflict = undefined\n /* The category and tags changed go with the copy, written once its first save gives it a row; its type is asked anew. */\n const { type: _type, ...kept } = catalog\n catalog = kept\n /* A copy has no row yet: nothing it could have been changed on. */\n catalogSeen = {}\n unconfirmed.clear()\n return read()\n },\n /** A new figure, named in the screen's language by the page: the session has no words of its own. */\n startNew({ discard = false, name }: { discard?: boolean; name: string }) {\n canLeave(discard)\n ++epoch\n clear()\n loading = false\n workspace.open(serializeFigureAsset(createFigureAsset(name)))\n creationId = crypto.randomUUID()\n return read()\n },\n async open(nextId: string, { discard = false } = {}) {\n canLeave(discard)\n const requestEpoch = ++epoch\n clear()\n loading = true\n try {\n const record = await store.load(nextId)\n if (requestEpoch !== epoch) return read()\n if (record.id !== nextId) throw Error('요청한 Figure와 응답의 대상이 다릅니다.')\n workspace.open(record.source)\n id = nextId\n baseline = record.source\n } catch (cause) {\n if (requestEpoch === epoch) error = cause instanceof Error ? cause.message : String(cause)\n } finally {\n if (requestEpoch === epoch) loading = false\n }\n return read()\n },\n close({ discard = false } = {}) {\n canLeave(discard)\n ++epoch\n clear()\n loading = false\n return read()\n },\n apply(changes: FigureInputChange[], origin: 'ui' | 'ai' = 'ui', expectedRevision?: number, context?: string) {\n const control = writable()\n // AI must supply the context AND revision captured when it started. Never substitute current values.\n if (origin === 'ai' && (context === undefined || expectedRevision === undefined))\n throw refusal('SESSION_VERSION_MISSING', 'AI 편집에는 요청 당시의 모델 문맥과 리비전이 필요합니다.')\n return tracked('do', () =>\n workspace.apply({\n ...control,\n origin,\n context: context ?? control.context,\n expectedRevision: expectedRevision ?? control.expectedRevision,\n changes\n })\n )\n },\n /**\n * An AI proposal (ADR-0094): the modeller's commands, as one step of the history, on the version the model saw.\n * Never on the current one instead -- a person's edit in between makes the proposal stale, and it is refused.\n */\n applyProposal(steps: readonly FigureProposalStep[], expectedRevision: number, context: string, key?: string) {\n writable()\n /* Never with consent: only the person may let a clip go, and an AI proposal is not the person (designer 2026-09-27). */\n return tracked('do', () => workspace.applyProposal({ origin: 'ai', context, expectedRevision, steps }), key)\n },\n /**\n * A new figure opened for an AI proposal from another screen is created under the proposal's key (ADR-0097 §5.6\n * item 5). Only before the modeller names the figure to the AI dock: once a conversation is anchored on the creation\n * id it stays (ADR-0061 decision 3), and the save's record of the proposal keeps one proposal one figure. Only on a\n * new figure not yet touched -- one being made is the person's, and keeps its own.\n */\n createUnder(key: string) {\n if (id || workspace.read().dirty) throw refusal('SESSION_NEW_FIGURE_TOUCHED', '손대지 않은 새 모델에만 쓸 수 있습니다.')\n if (!/^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i.test(key)) throw refusal('SESSION_PROPOSAL_KEY', '제안 식별자가 올바르지 않습니다.')\n creationId = key\n },\n /** The AI proposals whose steps are in the model now, each once. */\n proposalsInEffect: inEffect,\n /**\n * A recipe put in by the person (ADR-0095): its resolved commands, as one step of the history, on the version open\n * now. The same path as a proposal; the person is its origin.\n */\n applyRecipe(steps: readonly FigureProposalStep[]) {\n const at = writable()\n return tracked('do', () => workspace.applyProposal({ origin: 'ui', context: at.context, expectedRevision: at.expectedRevision, steps, ...consented() }))\n },\n add(part: FigurePrimitiveCreation) {\n return tracked('do', () => workspace.addPrimitive({ ...writable(), part }))\n },\n edit(edit: FigurePartEdit) {\n return tracked('do', () => workspace.editPart({ ...writable(), edit, ...consented() }))\n },\n /** What a command would do, on a copy (ADR-0097 §5.5): nothing is written, and the answer names its version. */\n previewCommand(action: FigureAuthoringAction) {\n const view = workspace.read()\n if (loading || error || !view.context || view.revision === null) throw refusal('SESSION_NOT_OPEN', '먼저 모델을 정상적으로 열어 주세요.')\n return workspace.previewCommand({ context: view.context, action })\n },\n /** One authoring command — what a person means, not a graph edit — as one step of the same history. */\n command(action: FigureAuthoringAction) {\n return tracked('do', () => workspace.command({ ...writable(), action, ...consented() }), undefined, action.kind === 'declare-instance-size')\n },\n /** The ends of the size on a drawing the last step moved in to what the parts allow, once: then nothing until the next. */\n takeSizeRangeFits(): FigureSizeRangeFit[] {\n const out = fitted\n fitted = []\n return out\n },\n /**\n * The first edit made inside `run` may let go of exactly these clips -- the ones a CLIPS_DROPPED refusal named and\n * the person agreed to -- on the figure and version they were named on (designer 2026-09-27). Any other edit that\n * would stop a clip is refused and asked about.\n */\n withConsent<T>(given: FigureClipConsentFor, run: () => T): T {\n consent = given\n try {\n return run()\n } finally {\n consent = undefined\n }\n },\n undo() {\n return tracked('undo', () => workspace.undo(writable()))\n },\n redo() {\n return tracked('redo', () => workspace.redo(writable()))\n },\n source() {\n const { context } = readable()\n return workspace.export({ context }).text\n },\n /**\n * Saves the model, and the card's picture when the caller managed to take one.\n *\n * The picture is the caller's because taking it needs a canvas, and this session is the place that knows\n * nothing about drawing. A save with no picture is a save: a tab in the background cannot draw, and the\n * source matters more than the card (see `thumbnail.ts`).\n */\n async save({ thumbnail, type, namespace }: { thumbnail?: string; type?: string; namespace?: string } = {}) {\n const control = writable(),\n requestEpoch = epoch\n const exported = workspace.export(control)\n /* Read with the text it goes with: an edit while saving is not what this save holds. */\n const proposalKeys = inEffect()\n const sentCatalog = { ...catalog }\n saving = true\n catalogSending = sentCatalog\n catalogWritten = {}\n try {\n /* Only the catalogue changed: the source is not written again -- a released figure would be made a draft for nothing. */\n if (id === undefined || workspace.read().dirty) await saveSource()\n if (requestEpoch !== epoch) return read()\n if (id !== undefined && Object.keys(sentCatalog).length) {\n const seen = Object.fromEntries(Object.keys(sentCatalog).map(key => [key, catalogSeen[key as keyof FigureCatalogPatch] ?? null])) as FigureCatalogSeen\n try {\n await store.updateCatalog(id, sentCatalog, seen)\n } catch (failure) {\n /* The fields stay held, as typed; what the row holds now is what the next save expects -- it writes over it. */\n const fields = (failure as { extensions?: { fields?: FigureCatalogConflict[] } })?.extensions?.fields\n if ((failure as { code?: string })?.code === 'FIGURE_CATALOG_CONFLICT' && requestEpoch === epoch && fields)\n for (const { field, now } of fields) if (field in catalog) (catalogSeen as Record<string, unknown>)[field] = now\n throw failure\n }\n if (requestEpoch !== epoch) return read()\n catalogWritten = sentCatalog\n /* The row holds what was sent: a field changed again on the way is next compared with that. */\n for (const key of Object.keys(sentCatalog) as (keyof FigureCatalogPatch)[])\n if (sameValue(catalog[key], sentCatalog[key])) delete catalogSeen[key]\n else (catalogSeen as Record<string, unknown>)[key] = catalogValue(sentCatalog[key])\n /* What was sent is saved; a field changed again while it was on its way stays held. */\n const next = { ...catalog }\n for (const key of Object.keys(sentCatalog) as (keyof FigureCatalogPatch)[]) if (sameValue(next[key], sentCatalog[key])) delete next[key]\n catalog = next\n }\n } finally {\n if (requestEpoch === epoch) saving = false\n catalogSending = undefined\n }\n return read()\n\n async function saveSource() {\n let record: FigureProductRecord\n try {\n record = await store.save({ id, source: exported.text, expectedSource: baseline, creationId, thumbnail, proposalKeys, ...(id || !type ? {} : { type }), ...(id || !namespace ? {} : { namespace }) })\n } catch (error) {\n /*\n A save that failed may still have landed: the answer lost on the way back (SAVE_UNREACHABLE), or a second\n try refused because the first did land -- its expected source is the old one (FIGURE_SOURCE_CONFLICT). Only\n those are read back; a refusal on grounds -- permission, validation -- stays a failure whatever the row\n holds. Read back, every field the save writes must be what was sent: the source, the picture, the type\n (designer 2026-09-27: a network failure alone does not say nothing was saved; nor does a matching source\n alone say it was).\n */\n const code = (error as { code?: string })?.code\n const unknown = code === 'SAVE_UNREACHABLE' || code === 'FIGURE_SOURCE_CONFLICT'\n const landed = unknown && id !== undefined && requestEpoch === epoch && store.readBack ? await store.readBack(id).catch(() => undefined) : undefined\n const held = landed ? serializeFigureAsset(parseFigureAsset(landed.source)) : undefined\n /* The picture is compared by the name the server keeps it under: the hash of its bytes (ADR-0104). */\n const holds = async (sent?: string) => sent === undefined || (!!landed && landed.thumbnailHash !== undefined && landed.thumbnailHash === (await thumbnailHashOf(sent)))\n const same = !!landed && held === exported.text && (await holds(thumbnail)) && (type === undefined || landed.type === type)\n if (same) record = landed!\n else if (\n code === 'FIGURE_SOURCE_CONFLICT' &&\n landed &&\n held !== undefined &&\n unconfirmed.has(held) &&\n /* Every field that earlier save wrote, not the source alone: nothing not compared is written over. */\n (await holds(unconfirmed.get(held)!.thumbnail))\n ) {\n /*\n The row holds a text this session sent and never heard back about -- edited further since, the new text\n is not it. The server is known to hold what was sent: this save is sent again, once, conditional on that\n server text as the expected source (designer 2026-09-27: \"the sent content is confirmed on the server\").\n */\n baseline = landed.source\n unconfirmed.clear()\n record = await store.save({ id, source: exported.text, expectedSource: baseline, creationId, thumbnail, proposalKeys, ...(id || !type ? {} : { type }), ...(id || !namespace ? {} : { namespace }) })\n } else {\n if (code === 'SAVE_UNREACHABLE') unconfirmed.set(exported.text, { thumbnail })\n if (code === 'FIGURE_SOURCE_CONFLICT' && requestEpoch === epoch) conflict = { source: landed?.source }\n throw error\n }\n }\n if (requestEpoch !== epoch) return read()\n if (!record.id || (id !== undefined && record.id !== id)) throw Error('저장 응답의 Figure 대상이 다릅니다.')\n if (serializeFigureAsset(parseFigureAsset(record.source)) !== exported.text)\n throw Error('저장 응답이 보낸 모델과 다릅니다. 저장 상태를 다시 확인해 주세요.')\n /* The server has it: the next save expects it, whatever happened on screen meanwhile. */\n id = record.id\n baseline = record.source\n unconfirmed.clear()\n conflict = undefined\n /*\n Edited while it was saving: what was sent is saved, the edits since are not -- they stay, and the model stays\n unsaved (the workspace refuses a stale acknowledgement). Never marked saved, never wiped.\n */\n if (workspace.read().revision === exported.revision) workspace.acknowledgeSaved(exported)\n }\n }\n }\n}\nexport type FigureProductSession = ReturnType<typeof createFigureProductSession>\n"]}
1
+ {"version":3,"file":"product-session.js","sourceRoot":"","sources":["../../client/modeller/product-session.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAA;AACrD,OAAO,EAAE,gBAAgB,EAAuB,MAAM,eAAe,CAAA;AACrE,OAAO,EACL,iBAAiB,EACjB,2BAA2B,EAC3B,oBAAoB,EACpB,gBAAgB,EAChB,qBAAqB,EAQtB,MAAM,wBAAwB,CAAA;AAE/B,2EAA2E;AAE3E;;;GAGG;AACH,SAAS,OAAO,CAAC,IAAY,EAAE,OAAe;IAC5C,OAAO,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,EAAE,EAAE,IAAI,EAAE,CAAC,CAAA;AAChD,CAAC;AA0DD,MAAM,SAAS,GAAG,CAAC,CAAU,EAAE,CAAU,EAAE,EAAE,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,IAAI,IAAI,CAAC,KAAK,IAAI,CAAC,SAAS,CAAC,CAAC,IAAI,IAAI,CAAC,CAAA;AAErG;;;GAGG;AACH,MAAM,YAAY,GAAG,CAAC,KAAc,EAAE,EAAE,CAAC,CAAC,KAAK,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,KAAK,IAAI,IAAI,CAAC,CAAC,CAAA;AAC3H,MAAM,gBAAgB,GAAG,CAAC,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Of } from './thumbnail-hash.js'\nimport { revisionFromView, type FigureRevision } from './revision.js'\nimport {\n createFigureAsset,\n createFigureEditorWorkspace,\n serializeFigureAsset,\n parseFigureAsset,\n figureSizeRangeFitsOf,\n type FigureSizeRangeFit,\n type FigureInputChange,\n type FigurePrimitiveCreation,\n type FigurePartEdit,\n type FigureAuthoringAction,\n type FigureProposalStep,\n type FigureClipConsent\n} from '@hatiolab/figure-model'\n\n/** Consent to let clips go, and the figure and version it was given on. */\n\n/**\n * A request the session refuses, with its code: a screen says it from the code (`sessionRefusalOf`), never from the\n * message, which stays for logs (ADR-0054; figure audit 2026-10-16 N6 -- an AI card put the message in its note).\n */\nfunction refusal(code: string, message: string): Error & { code: string } {\n return Object.assign(Error(message), { code })\n}\n\nexport interface FigureClipConsentFor extends FigureClipConsent {\n context: string\n revision: number\n}\n\nexport interface FigureProductRecord {\n id: string\n source: string\n}\n\n/**\n * The row's catalogue fields -- the type (before release), the category, the tags. Kept on the row, not in the asset,\n * and saved with it by 「저장」: written at once on change, they stayed after 「저장하지 않고 떠나기」 and the save\n * button never lit for them (2026-11-01 audit item 5).\n */\nexport interface FigureCatalogPatch {\n type?: string\n category?: string\n tags?: string[]\n}\n\n/** A catalogue field as the editor saw it before changing it; null when it was empty. */\nexport type FigureCatalogSeen = { [K in keyof FigureCatalogPatch]?: FigureCatalogPatch[K] | null }\n\n/** Another editor changed a catalogue field first: which, and what the row holds now. */\nexport interface FigureCatalogConflict {\n field: keyof FigureCatalogPatch\n now: string | string[] | null\n}\n\n/** Persistence is injected; neither the model engine nor the renderer owns the product ID. */\nexport interface FigureProductStore {\n load(id: string): Promise<FigureProductRecord>\n /** Every field a save writes, as the server holds it now: to tell whether a save whose answer was lost landed. */\n readBack?(id: string): Promise<FigureProductRecord & { thumbnailHash?: string; type?: string }>\n save(request: {\n id?: string\n source: string\n expectedSource?: string\n creationId?: string\n /** The card's picture. Absent when the browser could not draw one; the source is saved either way. */\n thumbnail?: string\n /** The type name a new figure is created under (the first save asks for it). Not sent for an existing one. */\n type?: string\n /** The namespace a new figure is created under, when the first save chose one. Not sent for an existing one. */\n namespace?: string\n /** Keys of the AI proposals whose steps the source holds: the server records them with the save. */\n proposalKeys?: string[]\n }): Promise<FigureProductRecord>\n /**\n * Writes the row's catalogue fields of a saved figure, only while the row still holds them as `seen` says -- else it\n * is refused with FIGURE_CATALOG_CONFLICT and the fields the row holds now.\n */\n updateCatalog(id: string, patch: FigureCatalogPatch, seen: FigureCatalogSeen): Promise<unknown>\n}\n\nconst sameValue = (a: unknown, b: unknown) => JSON.stringify(a ?? null) === JSON.stringify(b ?? null)\n\n/**\n * A catalogue value as the server compares it (figure-service catalogConflictsOf): an empty category or type, or an\n * empty tag list, is no value -- null; tags keep their order, which is part of the value.\n */\nconst catalogValue = (value: unknown) => (value === '' || (Array.isArray(value) && !value.length) ? null : (value ?? null))\nconst sameCatalogValue = (a: unknown, b: unknown) => sameValue(catalogValue(a), catalogValue(b))\n\n/** Product lifecycle boundary. A late response can never change another editor's asset or ID. */\nexport function createFigureProductSession(store: FigureProductStore) {\n const workspace = createFigureEditorWorkspace()\n let epoch = 0,\n id: string | undefined,\n baseline: string | undefined\n let loading = false,\n saving = false,\n error: string | undefined\n let creationId: string | undefined\n /*\n The history as steps, each tagged with the AI proposal it came from (or nothing): mirrored here, since the\n workspace's history does not say where a step came from. A proposal is in the model while its step is on `done` --\n undone, it is not; undone and written past, it never comes back. What a save sends as `proposalKeys`.\n */\n let done: Array<string | undefined> = [],\n undone: Array<string | undefined> = []\n /*\n A save refused because the server holds another source than the one opened (FIGURE_SOURCE_CONFLICT, not one of\n this session's own sends): the edits stay, and the server's latest is kept here to compare with and, if the person\n says so, to write over (2026-11-01 audit item 6). Undefined source: the latest could not be read.\n */\n let conflict: { source?: string } | undefined\n /* The catalogue fields changed and not saved yet; none of the history -- undo is the figure's steps. */\n let catalog: FigureCatalogPatch = {}\n /* The catalogue fields a save is writing now: what the row will hold, not what it held, until it is done. */\n let catalogSending: FigureCatalogPatch | undefined\n /*\n The catalogue fields the last save wrote, known to be on the row from the moment it answered: a screen compares\n with them before it has read the row again (2026-11-01 third re-check). Empty from the start of each save.\n */\n let catalogWritten: FigureCatalogPatch = {}\n /*\n What the row held for each field held in `catalog`, as the editor saw it when it first changed it: sent with the\n save, which goes on only while the row still holds it (outside review 2026-11-09: a later tab wrote over another's\n category without a word). After a conflict it is what the row holds then, so saving again writes over it knowingly.\n */\n let catalogSeen: FigureCatalogSeen = {}\n const catalogHeld = () => Object.keys(catalog).length > 0\n /* The author's size ends the last step moved without being asked (ADR-0087 decision 6), told once. */\n let fitted: FigureSizeRangeFit[] = []\n function tracked<T>(kind: 'do' | 'undo' | 'redo', run: () => T, tag?: string, setsRange = false): T {\n const was = workspace.read()\n const result = run()\n const now = workspace.read()\n if (now.revision === was.revision) return result\n fitted = kind === 'do' && !setsRange && was.asset && now.asset ? figureSizeRangeFitsOf(was.asset, now.asset) : []\n if (kind === 'do') {\n done.push(tag)\n undone = []\n } else if (kind === 'undo') undone.push(done.pop())\n else done.push(undone.pop())\n return result\n }\n const inEffect = () => [...new Set(done.filter((tag): tag is string => !!tag))]\n /*\n The creation id is read with the rest: a figure not saved yet is named by it (ADR-0061 decision 3) -- its AI\n conversation is anchored on it, and its first save inserts the row under it, so the name holds across that save.\n */\n function read() {\n const view = workspace.read()\n return { ...view, dirty: view.dirty || catalogHeld(), catalog: { ...catalog }, catalogWritten: { ...catalogWritten }, conflict: conflict ? { latest: conflict.source } : undefined, id, creationId, loading, saving, error }\n }\n /*\n The version on screen, one object for as long as it is the version: the workspace hands out one asset per version\n (and another once a save is acknowledged, or the figure moves on), so that object says whether the last one holds.\n */\n let shown: FigureRevision | undefined\n function revisionNow(): FigureRevision | undefined {\n const view = workspace.read()\n if (!view.context || view.revision === null) return (shown = undefined)\n const context = view.context\n if (shown?.asset !== view.asset) shown = revisionFromView(view, () => workspace.export({ context }).text)\n return shown\n }\n /* Texts sent whose save was never answered: found on the server, the server is confirmed to hold what was sent. */\n const unconfirmed = new Map<string, { thumbnail?: string }>()\n /*\n Consent to let clips go: given for one edit, on the figure and the version it was asked on. The first edit made under\n it takes it; an edit on another figure or another version is refused rather than let clips go that were never named\n for it (designer 2026-09-27).\n */\n let consent: FigureClipConsentFor | undefined\n const consented = () => {\n if (!consent) return {}\n const given = consent\n consent = undefined\n const view = workspace.read()\n if (view.context !== given.context || view.revision !== given.revision) {\n const stale = Object.assign(Error('확인한 뒤 모델이 바뀌어 적용하지 않았습니다. 다시 해 주세요.'), { code: 'CONSENT_STALE' })\n throw stale\n }\n return { dropClips: given.dropClips }\n }\n /* A model open to read: the draft is read during a save too -- the dock reads it when the person sends (audit N5). */\n function readable() {\n const view = workspace.read()\n if (loading || error || !view.context || view.revision === null) throw refusal('SESSION_NOT_OPEN', '먼저 모델을 정상적으로 열어 주세요.')\n return { context: view.context, expectedRevision: view.revision, origin: 'ui' as const }\n }\n function writable() {\n const open = readable()\n // Serializing writes also makes create retries safe: no second create while the first is pending.\n if (saving) throw refusal('SESSION_SAVING', '저장이 끝난 뒤 편집해 주세요.')\n return open\n }\n function clear() {\n workspace.close({ discardDesignChanges: true })\n id = undefined\n baseline = undefined\n error = undefined\n saving = false\n creationId = undefined\n catalog = {}\n catalogWritten = {}\n catalogSeen = {}\n conflict = undefined\n done = []\n undone = []\n }\n function canLeave(discard: boolean) {\n if (saving) throw Error('저장이 끝난 뒤 모델을 전환해 주세요.')\n if ((workspace.read().dirty || catalogHeld()) && !discard) throw Error('저장하지 않은 변경이 있습니다.')\n }\n return {\n read,\n /** The figure on screen at its version, for every panel and helper to read; none while nothing is open. Readable while saving. */\n revisionNow,\n /**\n * The source the server is confirmed to hold: loaded, or answered by a save. What a revert sends as `expectedSource`\n * -- the server writes over it only while it still holds this. Nothing for a figure not saved yet.\n */\n confirmedSource: () => (id ? baseline : undefined),\n /**\n * A catalogue field changed, held for the next save; one changed back to what the row holds (`saved`) is no\n * change. Only a saved figure has a row to write: a new figure's type goes with its first save. Taken while a save\n * is on its way too: the field shows it, so it is held for the save after (2026-11-01 re-check). A field that save\n * is writing is held whatever it is changed to -- back to the old value too, which the save is about to replace;\n * the save done lets go only of a value it wrote (2026-11-01 second re-check).\n */\n editCatalog(patch: FigureCatalogPatch, saved: FigureCatalogPatch) {\n if (!id) throw refusal('SESSION_NOT_SAVED', '먼저 저장해 주세요.')\n const next = { ...catalog }\n const seen = { ...catalogSeen }\n for (const key of Object.keys(patch) as (keyof FigureCatalogPatch)[]) {\n if (!(catalogSending && key in catalogSending) && sameCatalogValue(patch[key], saved[key])) {\n delete next[key]\n delete seen[key]\n } else {\n (next as Record<string, unknown>)[key] = patch[key]\n if (!(key in seen)) (seen as Record<string, unknown>)[key] = catalogValue(saved[key])\n }\n }\n catalog = next\n catalogSeen = seen\n return read()\n },\n /**\n * After a conflict, the edits written over the server's latest: the next save expects that latest, so it goes\n * through only while the server still holds it -- a third change meanwhile is a conflict again.\n */\n overwriteConflict() {\n if (saving) throw refusal('SESSION_SAVING', '저장이 끝난 뒤 편집해 주세요.')\n if (!conflict?.source) throw refusal('SESSION_NO_CONFLICT', '덮어쓸 최신본을 읽지 못했습니다.')\n baseline = conflict.source\n conflict = undefined\n unconfirmed.clear()\n return read()\n },\n /**\n * After a conflict, the edits kept as a figure of their own: from here they are a new figure, under a new creation\n * id, saved by the first save's question; the figure they came from is left as the server holds it.\n */\n detachAsCopy() {\n if (saving) throw refusal('SESSION_SAVING', '저장이 끝난 뒤 편집해 주세요.')\n /*\n After a conflict, or to release edits that break the released contract as a new figure type (the release gate's\n way out, tutorial 2026-11-11): either way the figure it came from stays as the server has it.\n */\n if (!conflict && !id) throw refusal('SESSION_NOT_SAVED', '저장된 피규어가 아닙니다.')\n id = undefined\n baseline = undefined\n creationId = crypto.randomUUID()\n conflict = undefined\n /* The category and tags changed go with the copy, written once its first save gives it a row; its type is asked anew. */\n const { type: _type, ...kept } = catalog\n catalog = kept\n /* A copy has no row yet: nothing it could have been changed on. */\n catalogSeen = {}\n unconfirmed.clear()\n return read()\n },\n /** A new figure, named in the screen's language by the page: the session has no words of its own. */\n startNew({ discard = false, name }: { discard?: boolean; name: string }) {\n canLeave(discard)\n ++epoch\n clear()\n loading = false\n workspace.open(serializeFigureAsset(createFigureAsset(name)))\n creationId = crypto.randomUUID()\n return read()\n },\n async open(nextId: string, { discard = false } = {}) {\n canLeave(discard)\n const requestEpoch = ++epoch\n clear()\n loading = true\n try {\n const record = await store.load(nextId)\n if (requestEpoch !== epoch) return read()\n if (record.id !== nextId) throw Error('요청한 Figure와 응답의 대상이 다릅니다.')\n workspace.open(record.source)\n id = nextId\n baseline = record.source\n } catch (cause) {\n if (requestEpoch === epoch) error = cause instanceof Error ? cause.message : String(cause)\n } finally {\n if (requestEpoch === epoch) loading = false\n }\n return read()\n },\n close({ discard = false } = {}) {\n canLeave(discard)\n ++epoch\n clear()\n loading = false\n return read()\n },\n apply(changes: FigureInputChange[], origin: 'ui' | 'ai' = 'ui', expectedRevision?: number, context?: string) {\n const control = writable()\n // AI must supply the context AND revision captured when it started. Never substitute current values.\n if (origin === 'ai' && (context === undefined || expectedRevision === undefined))\n throw refusal('SESSION_VERSION_MISSING', 'AI 편집에는 요청 당시의 모델 문맥과 리비전이 필요합니다.')\n return tracked('do', () =>\n workspace.apply({\n ...control,\n origin,\n context: context ?? control.context,\n expectedRevision: expectedRevision ?? control.expectedRevision,\n changes\n })\n )\n },\n /**\n * An AI proposal (ADR-0094): the modeller's commands, as one step of the history, on the version the model saw.\n * Never on the current one instead -- a person's edit in between makes the proposal stale, and it is refused.\n */\n applyProposal(steps: readonly FigureProposalStep[], expectedRevision: number, context: string, key?: string) {\n writable()\n /* Never with consent: only the person may let a clip go, and an AI proposal is not the person (designer 2026-09-27). */\n return tracked('do', () => workspace.applyProposal({ origin: 'ai', context, expectedRevision, steps }), key)\n },\n /**\n * A new figure opened for an AI proposal from another screen is created under the proposal's key (ADR-0097 §5.6\n * item 5). Only before the modeller names the figure to the AI dock: once a conversation is anchored on the creation\n * id it stays (ADR-0061 decision 3), and the save's record of the proposal keeps one proposal one figure. Only on a\n * new figure not yet touched -- one being made is the person's, and keeps its own.\n */\n createUnder(key: string) {\n if (id || workspace.read().dirty) throw refusal('SESSION_NEW_FIGURE_TOUCHED', '손대지 않은 새 모델에만 쓸 수 있습니다.')\n if (!/^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i.test(key)) throw refusal('SESSION_PROPOSAL_KEY', '제안 식별자가 올바르지 않습니다.')\n creationId = key\n },\n /** The AI proposals whose steps are in the model now, each once. */\n proposalsInEffect: inEffect,\n /**\n * A recipe put in by the person (ADR-0095): its resolved commands, as one step of the history, on the version open\n * now. The same path as a proposal; the person is its origin.\n */\n applyRecipe(steps: readonly FigureProposalStep[]) {\n const at = writable()\n return tracked('do', () => workspace.applyProposal({ origin: 'ui', context: at.context, expectedRevision: at.expectedRevision, steps, ...consented() }))\n },\n add(part: FigurePrimitiveCreation) {\n return tracked('do', () => workspace.addPrimitive({ ...writable(), part }))\n },\n edit(edit: FigurePartEdit) {\n return tracked('do', () => workspace.editPart({ ...writable(), edit, ...consented() }))\n },\n /** What a command would do, on a copy (ADR-0097 §5.5): nothing is written, and the answer names its version. */\n previewCommand(action: FigureAuthoringAction) {\n const view = workspace.read()\n if (loading || error || !view.context || view.revision === null) throw refusal('SESSION_NOT_OPEN', '먼저 모델을 정상적으로 열어 주세요.')\n return workspace.previewCommand({ context: view.context, action })\n },\n /** One authoring command — what a person means, not a graph edit — as one step of the same history. */\n command(action: FigureAuthoringAction) {\n return tracked('do', () => workspace.command({ ...writable(), action, ...consented() }), undefined, action.kind === 'declare-instance-size')\n },\n /** The ends of the size on a drawing the last step moved in to what the parts allow, once: then nothing until the next. */\n takeSizeRangeFits(): FigureSizeRangeFit[] {\n const out = fitted\n fitted = []\n return out\n },\n /**\n * The first edit made inside `run` may let go of exactly these clips -- the ones a CLIPS_DROPPED refusal named and\n * the person agreed to -- on the figure and version they were named on (designer 2026-09-27). Any other edit that\n * would stop a clip is refused and asked about.\n */\n withConsent<T>(given: FigureClipConsentFor, run: () => T): T {\n consent = given\n try {\n return run()\n } finally {\n consent = undefined\n }\n },\n undo() {\n return tracked('undo', () => workspace.undo(writable()))\n },\n redo() {\n return tracked('redo', () => workspace.redo(writable()))\n },\n source() {\n const { context } = readable()\n return workspace.export({ context }).text\n },\n /**\n * Saves the model, and the card's picture when the caller managed to take one.\n *\n * The picture is the caller's because taking it needs a canvas, and this session is the place that knows\n * nothing about drawing. A save with no picture is a save: a tab in the background cannot draw, and the\n * source matters more than the card (see `thumbnail.ts`).\n */\n async save({ thumbnail, type, namespace }: { thumbnail?: string; type?: string; namespace?: string } = {}) {\n const control = writable(),\n requestEpoch = epoch\n const exported = workspace.export(control)\n /* Read with the text it goes with: an edit while saving is not what this save holds. */\n const proposalKeys = inEffect()\n const sentCatalog = { ...catalog }\n saving = true\n catalogSending = sentCatalog\n catalogWritten = {}\n try {\n /* Only the catalogue changed: the source is not written again -- a released figure would be made a draft for nothing. */\n if (id === undefined || workspace.read().dirty) await saveSource()\n if (requestEpoch !== epoch) return read()\n if (id !== undefined && Object.keys(sentCatalog).length) {\n const seen = Object.fromEntries(Object.keys(sentCatalog).map(key => [key, catalogSeen[key as keyof FigureCatalogPatch] ?? null])) as FigureCatalogSeen\n try {\n await store.updateCatalog(id, sentCatalog, seen)\n } catch (failure) {\n /* The fields stay held, as typed; what the row holds now is what the next save expects -- it writes over it. */\n const fields = (failure as { extensions?: { fields?: FigureCatalogConflict[] } })?.extensions?.fields\n if ((failure as { code?: string })?.code === 'FIGURE_CATALOG_CONFLICT' && requestEpoch === epoch && fields)\n for (const { field, now } of fields) if (field in catalog) (catalogSeen as Record<string, unknown>)[field] = now\n throw failure\n }\n if (requestEpoch !== epoch) return read()\n catalogWritten = sentCatalog\n /* The row holds what was sent: a field changed again on the way is next compared with that. */\n for (const key of Object.keys(sentCatalog) as (keyof FigureCatalogPatch)[])\n if (sameValue(catalog[key], sentCatalog[key])) delete catalogSeen[key]\n else (catalogSeen as Record<string, unknown>)[key] = catalogValue(sentCatalog[key])\n /* What was sent is saved; a field changed again while it was on its way stays held. */\n const next = { ...catalog }\n for (const key of Object.keys(sentCatalog) as (keyof FigureCatalogPatch)[]) if (sameValue(next[key], sentCatalog[key])) delete next[key]\n catalog = next\n }\n } finally {\n if (requestEpoch === epoch) saving = false\n catalogSending = undefined\n }\n return read()\n\n async function saveSource() {\n let record: FigureProductRecord\n try {\n record = await store.save({ id, source: exported.text, expectedSource: baseline, creationId, thumbnail, proposalKeys, ...(id || !type ? {} : { type }), ...(id || !namespace ? {} : { namespace }) })\n } catch (error) {\n /*\n A save that failed may still have landed: the answer lost on the way back (SAVE_UNREACHABLE), or a second\n try refused because the first did land -- its expected source is the old one (FIGURE_SOURCE_CONFLICT). Only\n those are read back; a refusal on grounds -- permission, validation -- stays a failure whatever the row\n holds. Read back, every field the save writes must be what was sent: the source, the picture, the type\n (designer 2026-09-27: a network failure alone does not say nothing was saved; nor does a matching source\n alone say it was).\n */\n const code = (error as { code?: string })?.code\n const unknown = code === 'SAVE_UNREACHABLE' || code === 'FIGURE_SOURCE_CONFLICT'\n const landed = unknown && id !== undefined && requestEpoch === epoch && store.readBack ? await store.readBack(id).catch(() => undefined) : undefined\n const held = landed ? serializeFigureAsset(parseFigureAsset(landed.source)) : undefined\n /* The picture is compared by the name the server keeps it under: the hash of its bytes (ADR-0104). */\n const holds = async (sent?: string) => sent === undefined || (!!landed && landed.thumbnailHash !== undefined && landed.thumbnailHash === (await thumbnailHashOf(sent)))\n const same = !!landed && held === exported.text && (await holds(thumbnail)) && (type === undefined || landed.type === type)\n if (same) record = landed!\n else if (\n code === 'FIGURE_SOURCE_CONFLICT' &&\n landed &&\n held !== undefined &&\n unconfirmed.has(held) &&\n /* Every field that earlier save wrote, not the source alone: nothing not compared is written over. */\n (await holds(unconfirmed.get(held)!.thumbnail))\n ) {\n /*\n The row holds a text this session sent and never heard back about -- edited further since, the new text\n is not it. The server is known to hold what was sent: this save is sent again, once, conditional on that\n server text as the expected source (designer 2026-09-27: \"the sent content is confirmed on the server\").\n */\n baseline = landed.source\n unconfirmed.clear()\n record = await store.save({ id, source: exported.text, expectedSource: baseline, creationId, thumbnail, proposalKeys, ...(id || !type ? {} : { type }), ...(id || !namespace ? {} : { namespace }) })\n } else {\n if (code === 'SAVE_UNREACHABLE') unconfirmed.set(exported.text, { thumbnail })\n if (code === 'FIGURE_SOURCE_CONFLICT' && requestEpoch === epoch) conflict = { source: landed?.source }\n throw error\n }\n }\n if (requestEpoch !== epoch) return read()\n if (!record.id || (id !== undefined && record.id !== id)) throw Error('저장 응답의 Figure 대상이 다릅니다.')\n if (serializeFigureAsset(parseFigureAsset(record.source)) !== exported.text)\n throw Error('저장 응답이 보낸 모델과 다릅니다. 저장 상태를 다시 확인해 주세요.')\n /* The server has it: the next save expects it, whatever happened on screen meanwhile. */\n id = record.id\n baseline = record.source\n unconfirmed.clear()\n conflict = undefined\n /*\n Edited while it was saving: what was sent is saved, the edits since are not -- they stay, and the model stays\n unsaved (the workspace refuses a stale acknowledgement). Never marked saved, never wiped.\n */\n if (workspace.read().revision === exported.revision) workspace.acknowledgeSaved(exported)\n }\n }\n }\n}\nexport type FigureProductSession = ReturnType<typeof createFigureProductSession>\n"]}
@@ -1 +1 @@
1
- export default function route(page: string): "figure-modeller" | "figure-list" | "figure-public-list" | undefined;
1
+ export default function route(page: string): "figure-list" | "figure-modeller" | "figure-public-list" | undefined;