@floless/app 0.138.1 → 0.139.0

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 (109) hide show
  1. package/autostart.mjs +6 -2
  2. package/desktop-access-production-manifest.mjs +7 -0
  3. package/dist/floless-server.cjs +157133 -70500
  4. package/dist/schemas/model.continuation.v1.schema.json +19 -0
  5. package/dist/schemas/model.continuation.v2.schema.json +19 -0
  6. package/dist/schemas/model.query-response.v1.schema.json +95 -0
  7. package/dist/schemas/model.query-response.v2.schema.json +80 -0
  8. package/dist/schemas/model.query.v1.schema.json +87 -0
  9. package/dist/schemas/model.query.v2.schema.json +87 -0
  10. package/dist/schemas/model.snap-candidate.v1.schema.json +48 -0
  11. package/dist/schemas/model.snap-constraint.v1.schema.json +18 -0
  12. package/dist/schemas/model.snap-query.v1.schema.json +24 -0
  13. package/dist/schemas/model.snap-result.v1.schema.json +33 -0
  14. package/dist/schemas/model.snapshot.v1.schema.json +136 -0
  15. package/dist/schemas/revit.model.v1.schema.json +24 -0
  16. package/dist/schemas/steel.model.v2.schema.json +45 -6
  17. package/dist/skills/floless-app-approval/SKILL.md +19 -5
  18. package/dist/skills/floless-app-bridge/SKILL.md +19 -6
  19. package/dist/skills/floless-app-knowledge/SKILL.md +22 -1
  20. package/dist/skills/floless-app-new-workflow/SKILL.md +31 -27
  21. package/dist/skills/floless-app-new-workflow/references/build-and-verify.md +13 -12
  22. package/dist/skills/floless-app-onboarding/SKILL.md +3 -3
  23. package/dist/skills/floless-app-onboarding/references/floless-app-tour.md +16 -9
  24. package/dist/skills/floless-app-steel-model/SKILL.md +11 -2
  25. package/dist/skills/floless-app-steel-model/references/detail-from-a-screenshot.md +95 -0
  26. package/dist/skills/floless-app-steel-takeoff/SKILL.md +146 -21
  27. package/dist/skills/floless-app-steel-takeoff/references/elevation-registration.md +19 -0
  28. package/dist/skills/floless-app-tweak-contract/SKILL.md +42 -8
  29. package/dist/skills/floless-app-vectorize/SKILL.md +19 -6
  30. package/dist/skills/floless-app-workflows/SKILL.md +30 -3
  31. package/dist/skills/floless-app-workflows/references/workspace-data.md +77 -4
  32. package/dist/templates/floless-workspace-model-report.flo +77 -0
  33. package/dist/templates/revit-model.flo +111 -0
  34. package/dist/web/app.css +415 -177
  35. package/dist/web/app.js +302 -51
  36. package/dist/web/aware.js +1430 -1040
  37. package/dist/web/chat.css +692 -0
  38. package/dist/web/chat.js +2651 -0
  39. package/dist/web/commands-revit.js +42 -0
  40. package/dist/web/commands-shell.js +536 -70
  41. package/dist/web/commands-steel.js +344 -146
  42. package/dist/web/commands.js +1 -1
  43. package/dist/web/index.html +283 -77
  44. package/dist/web/instructor.js +217 -36
  45. package/dist/web/left-pane.js +636 -0
  46. package/dist/web/model-artifact-loader.js +75 -0
  47. package/dist/web/model-authoring-gestures.js +141 -0
  48. package/dist/web/model-cad-tools.js +20 -0
  49. package/dist/web/model-clip-gesture.js +148 -0
  50. package/dist/web/model-clip-list.js +156 -0
  51. package/dist/web/model-clip-session.js +274 -0
  52. package/dist/web/model-clip-three-overlay.js +295 -0
  53. package/dist/web/model-clip-three-preview.js +59 -0
  54. package/dist/web/model-editor-contract.js +519 -0
  55. package/dist/web/model-editor-revit-adapter.js +139 -0
  56. package/dist/web/model-editor-shell.js +271 -0
  57. package/dist/web/model-editor-state-recovery.js +44 -0
  58. package/dist/web/model-editor-steel-adapter.js +410 -0
  59. package/dist/web/model-editor.css +268 -0
  60. package/dist/web/model-frame.js +192 -0
  61. package/dist/web/model-inspector.js +128 -0
  62. package/dist/web/model-measure.js +390 -0
  63. package/dist/web/model-navigation-controls.js +246 -0
  64. package/dist/web/model-orientation-overlay.js +217 -0
  65. package/dist/web/model-panel-bridge.js +230 -0
  66. package/dist/web/model-pointer-dock.js +164 -0
  67. package/dist/web/model-revit-module.js +83 -0
  68. package/dist/web/model-selection-coordinator.js +151 -0
  69. package/dist/web/model-selection-tools.js +290 -0
  70. package/dist/web/model-snap-contract.js +267 -0
  71. package/dist/web/model-snapping.js +497 -0
  72. package/dist/web/model-spatial-panel.js +294 -0
  73. package/dist/web/model-spatial-tools.js +249 -0
  74. package/dist/web/model-tree.js +47 -0
  75. package/dist/web/model-viewport-lighting.js +166 -0
  76. package/dist/web/model-viewport-revit-adapter.js +1224 -0
  77. package/dist/web/model-viewport-state.js +505 -0
  78. package/dist/web/model-viewport-steel-adapter.js +150 -0
  79. package/dist/web/model-viewport-toolbar.js +516 -0
  80. package/dist/web/model-viewport.js +717 -0
  81. package/dist/web/panels.js +8 -15
  82. package/dist/web/renderers.js +3 -0
  83. package/dist/web/revit-editor.css +35 -0
  84. package/dist/web/revit-editor.html +74 -0
  85. package/dist/web/revit-editor.js +845 -0
  86. package/dist/web/steel-3d-core.js +16 -44
  87. package/dist/web/steel-3d-view.js +1384 -633
  88. package/dist/web/steel-canvas-guidance.js +3 -1
  89. package/dist/web/steel-editor.html +2121 -1253
  90. package/dist/web/steel-filter.html +5 -1
  91. package/dist/web/steel-model-v2-commands.js +72 -1
  92. package/dist/web/steel-split-view.js +5 -39
  93. package/dist/web/steel-view-generation.js +107 -17
  94. package/dist/web/vector-3d.html +12 -0
  95. package/dist/web/workspaces.js +2190 -277
  96. package/distribution-profile-active.mjs +2 -0
  97. package/distribution-profile-production.mjs +47 -0
  98. package/distribution-profile-shared.mjs +8 -0
  99. package/distribution-profile.mjs +18 -0
  100. package/distribution-resource-inventory.mjs +81 -0
  101. package/launch.mjs +18 -10
  102. package/log.mjs +2 -1
  103. package/managed-runtime-policy.mjs +104 -0
  104. package/model-reader-policy-active.mjs +7 -0
  105. package/network-policy-active.mjs +6 -0
  106. package/package.json +17 -2
  107. package/post-update-marker.mjs +3 -1
  108. package/rvt-production-uat-authority.mjs +60 -0
  109. package/teardown.mjs +4 -3
@@ -0,0 +1,271 @@
1
+ /*
2
+ * model-editor-shell.js — the mandatory shell contract for every 3D editor, plus the docked side
3
+ * panel's width, collapse, and gestures.
4
+ *
5
+ * IT ADOPTS ELEMENTS, IT DOES NOT RENDER DOMAIN CONTENT. Steel and Revit have different inspector and
6
+ * explorer bodies, but they now register the same viewport, toolbar, orientation, axes, explorer,
7
+ * pointer dock and inspector roles here. This module owns their common identity and placement classes;
8
+ * a provider that omits or duplicates one fails at mount time instead of quietly becoming a third UI.
9
+ *
10
+ * NOTHING HERE KNOWS AN EDITOR. No element ids, no storage keys, no split view: those arrive as
11
+ * arguments, and `server/model-editor-facade.test.ts` fails the build if a page global appears.
12
+ */
13
+
14
+ /*
15
+ * RE-EXPORTED, NOT SEPARATELY IMPORTED. `boot()` destructures a fixed list of module bindings, and
16
+ * `server/steel-editor-harness.ts` pattern-matches that exact list in three coupled places - so a
17
+ * fifteenth binding costs five coordinated edits and takes ~113 harness tests with it if any one is
18
+ * missed. Re-exporting through a binding the page already has costs none of that, and the files stay
19
+ * small, which is what splitting them was for.
20
+ */
21
+ export { windowRows } from './model-tree.js';
22
+
23
+ export const MODEL_EDITOR_SHELL_SCHEMA = 'floless.model-editor-shell/v1';
24
+ export const MODEL_EDITOR_SHELL_ROLES = Object.freeze([
25
+ 'viewport', 'surface', 'toolbar', 'orientation', 'axes', 'explorer', 'pointerDock', 'inspector',
26
+ ]);
27
+
28
+ /**
29
+ * Adopt the provider's domain-owned contents into the one common 3D shell.
30
+ * The returned role map is the authoritative set other shared mounts should consume.
31
+ * @param {{root?:any,statusHud?:any,viewport?:any,surface?:any,toolbar?:any,orientation?:any,axes?:any,
32
+ * explorer?:any,pointerDock?:any,inspector?:any,[key:string]:any}} options
33
+ */
34
+ export function mountModelEditorShell({ root, statusHud = null, ...roles } = {}) {
35
+ if (!root) throw new Error('mountModelEditorShell: no root element.');
36
+ const unknown = Object.keys(roles).filter((name) => !MODEL_EDITOR_SHELL_ROLES.includes(name));
37
+ if (unknown.length) throw new Error(`mountModelEditorShell: unknown role ${unknown.join(', ')}.`);
38
+ const missing = MODEL_EDITOR_SHELL_ROLES.filter((name) => !roles[name]);
39
+ if (missing.length) throw new Error(`mountModelEditorShell: missing ${missing.join(', ')}.`);
40
+ const values = MODEL_EDITOR_SHELL_ROLES.map((name) => roles[name]);
41
+ if (new Set(values).size !== values.length) throw new Error('mountModelEditorShell: every shell role needs its own element.');
42
+ for (const [name, element] of Object.entries({ ...roles, ...(statusHud ? { statusHud } : {}) })) {
43
+ if (typeof root.contains === 'function' && !root.contains(element) && element !== root) {
44
+ throw new Error(`mountModelEditorShell: ${name} must live inside the shell root.`);
45
+ }
46
+ }
47
+ const previousRootSchema = root.getAttribute?.('data-model-editor-shell');
48
+ root.setAttribute?.('data-model-editor-shell', MODEL_EDITOR_SHELL_SCHEMA);
49
+ root.classList?.add('model-editor-shell');
50
+ const previous = new Map();
51
+ for (const [name, element] of Object.entries({ ...roles, ...(statusHud ? { statusHud } : {}) })) {
52
+ previous.set(element, element.getAttribute?.('data-model-shell-role'));
53
+ element.setAttribute?.('data-model-shell-role', name.replace(/[A-Z]/g, (letter) => `-${letter.toLowerCase()}`));
54
+ element.classList?.add(`model-shell-${name.replace(/[A-Z]/g, (letter) => `-${letter.toLowerCase()}`)}`);
55
+ }
56
+ let destroyed = false;
57
+ return Object.freeze({
58
+ schema: MODEL_EDITOR_SHELL_SCHEMA,
59
+ role(name) { if (!MODEL_EDITOR_SHELL_ROLES.includes(name) && name !== 'statusHud') return null; return roles[name] ?? (name === 'statusHud' ? statusHud : null); },
60
+ roles: Object.freeze(Object.fromEntries(Object.entries(roles))),
61
+ destroy() {
62
+ if (destroyed) return; destroyed = true;
63
+ if (previousRootSchema === null || previousRootSchema === undefined) root.removeAttribute?.('data-model-editor-shell');
64
+ else root.setAttribute?.('data-model-editor-shell', previousRootSchema);
65
+ root.classList?.remove('model-editor-shell');
66
+ for (const [name, element] of Object.entries({ ...roles, ...(statusHud ? { statusHud } : {}) })) {
67
+ const value = previous.get(element);
68
+ if (value === null || value === undefined) element.removeAttribute?.('data-model-shell-role'); else element.setAttribute?.('data-model-shell-role', value);
69
+ element.classList?.remove(`model-shell-${name.replace(/[A-Z]/g, (letter) => `-${letter.toLowerCase()}`)}`);
70
+ }
71
+ },
72
+ });
73
+ }
74
+
75
+ /**
76
+ * Storage that cannot throw, ON THE WINDOW THE HOST SUPPLIED.
77
+ *
78
+ * A locked-down profile must not take the panel down with it — hence the catches, which are load-bearing
79
+ * and have a test that proves it.
80
+ *
81
+ * The `win` argument is the point, not ceremony. This module already takes `doc`/`win` as arguments
82
+ * precisely so it never picks its own page, and then reached for a global here anyway — which is why it
83
+ * was the one Task 2 module the shared-module guard could not cover. Guarded now, in
84
+ * `server/model-editor-facade.test.ts`, by a check that rejects the global reach rather than the word,
85
+ * so this correct form passes and a bare one does not.
86
+ */
87
+ const makeStore = (win) => ({
88
+ get(key) { try { return win.localStorage.getItem(key); } catch { return null; } },
89
+ set(key, value) { try { win.localStorage.setItem(key, value); } catch { /* private mode; the panel still works, it just forgets */ } },
90
+ remove(key) { try { win.localStorage.removeItem(key); } catch { /* as above */ } },
91
+ });
92
+
93
+ /**
94
+ * Clamp a width into the panel's allowed range.
95
+ *
96
+ * Exported because it is the part worth testing without a browser.
97
+ *
98
+ * The original also floored the CEILING at `min`. Mutation-testing this showed that guard is dead:
99
+ * the final `Math.max(min, …)` already covers the case it was written for — a window too narrow for
100
+ * the minimum still yields the minimum. Carried forward as a comment rather than as a line that
101
+ * looks load-bearing and never fires.
102
+ */
103
+ export function clampPanelWidth(width, { min, maxPx, maxRatio, viewportWidth }) {
104
+ const ceiling = Math.min(maxPx, Math.round(viewportWidth * maxRatio));
105
+ return Math.round(Math.max(min, Math.min(ceiling, width)));
106
+ }
107
+
108
+ /**
109
+ * The keyboard nudge for a resize separator.
110
+ *
111
+ * THE SIGN IS THE INTERESTING PART. The handle is on the panel's LEFT edge, so moving it left makes
112
+ * the panel WIDER — ArrowLeft grows, ArrowRight shrinks. Written down because it reads backwards and
113
+ * is exactly the sort of thing an extraction silently inverts.
114
+ */
115
+ export function nudgeStep(key, shiftKey, { step = 12, coarseStep = 40 } = {}) {
116
+ const size = shiftKey ? coarseStep : step;
117
+ if (key === 'ArrowLeft') return size;
118
+ if (key === 'ArrowRight') return -size;
119
+ return 0;
120
+ }
121
+
122
+ /**
123
+ * Mount the docked side panel over elements the host already has.
124
+ *
125
+ * @param {{
126
+ * panel: Element, resizer: Element, toggle: Element,
127
+ * doc: Document, win: Window, root?: HTMLElement,
128
+ * widthKey: string, collapsedKey: string,
129
+ * min?: number, maxPx?: number, maxRatio?: number, cssVar?: string,
130
+ * collapsedClass?: string, label?: (collapsed: boolean) => string,
131
+ * onSettle?: () => void,
132
+ * }} options
133
+ * @returns {{ expand(): boolean, destroy(): void }}
134
+ */
135
+ export function mountSidePanel({
136
+ panel, resizer, toggle, root, doc, win,
137
+ widthKey, collapsedKey,
138
+ min = 240, maxPx = 680, maxRatio = 0.6,
139
+ cssVar = '--panelw', collapsedClass = 'panel-collapsed',
140
+ label = (collapsed) => (collapsed ? 'Expand Inspector' : 'Collapse Inspector'),
141
+ onSettle,
142
+ } = {}) {
143
+ for (const [name, el] of Object.entries({ panel, resizer, toggle })) {
144
+ if (!el) throw new Error(`mountSidePanel: no ${name} element — this mounts over markup the host owns, `
145
+ + 'so every element it drives must be passed in.');
146
+ }
147
+ if (!widthKey || !collapsedKey) throw new Error('mountSidePanel: both storage keys are required — a shared '
148
+ + 'panel that invented its own would silently reset every user of the editor that already had one.');
149
+
150
+ /*
151
+ * THE HOST SUPPLIES ITS ENVIRONMENT. `doc`/`win` are arguments rather than `panel.ownerDocument` and
152
+ * `document`, and that is not ceremony: the page's own headless harness manufactures elements that
153
+ * carry neither, so deriving them would have made this module untestable in the place the page is
154
+ * actually tested - and reaching for a global is the exact thing that stops a module being shared.
155
+ */
156
+ if (!doc || !win) throw new Error('mountSidePanel: pass the document and window this panel lives in — '
157
+ + 'a shared module must not reach for a global one.');
158
+ const store = makeStore(win); // …and storage comes off that same window
159
+ const styleRoot = root ?? doc.documentElement;
160
+ const off = []; // teardown, in reverse
161
+ const on = (target, type, fn, opts) => { target.addEventListener(type, fn, opts); off.push(() => target.removeEventListener(type, fn, opts)); };
162
+
163
+ /* ── width ─────────────────────────────────────────────────────────────────────────────────── */
164
+
165
+ // The CSS VAR is the source of truth, not the element's box: the var is what the rule sets, and it
166
+ // is a border-box value, while getComputedStyle(panel).width is the CONTENT box and drifts by the
167
+ // padding every time it is read back.
168
+ const currentWidth = () => {
169
+ const v = parseFloat(win.getComputedStyle(styleRoot).getPropertyValue(cssVar));
170
+ return Number.isFinite(v) ? v : panel.getBoundingClientRect().width;
171
+ };
172
+ const applyWidth = (width, save) => {
173
+ const w = clampPanelWidth(width, { min, maxPx, maxRatio, viewportWidth: win.innerWidth });
174
+ styleRoot.style.setProperty(cssVar, w + 'px');
175
+ if (save) store.set(widthKey, String(w));
176
+ return w;
177
+ };
178
+
179
+ const saved = parseFloat(store.get(widthKey));
180
+ if (Number.isFinite(saved)) applyWidth(saved, false);
181
+
182
+ let startX = 0, startW = 0;
183
+ const onMove = (e) => applyWidth(startW + (startX - e.clientX), false);
184
+ let dragPointer = null;
185
+ const finishDrag = (save = true) => {
186
+ if (dragPointer !== null && typeof resizer.releasePointerCapture === 'function') {
187
+ try { resizer.releasePointerCapture(dragPointer); } catch { /* capture may already be lost */ }
188
+ }
189
+ dragPointer = null;
190
+ resizer.classList.remove('drag');
191
+ doc.body.style.userSelect = '';
192
+ win.removeEventListener('pointermove', onMove);
193
+ win.removeEventListener('pointerup', onUp);
194
+ win.removeEventListener('pointercancel', onCancel);
195
+ if (save) store.set(widthKey, String(Math.round(currentWidth())));
196
+ };
197
+ const onUp = () => finishDrag(true);
198
+ const onCancel = () => finishDrag(false);
199
+
200
+ on(resizer, 'pointerdown', (e) => {
201
+ e.preventDefault();
202
+ // EXPLICIT, and not redundant: preventDefault above kills the browser's click-to-focus, which left
203
+ // the arrow-key nudge below unreachable by mouse. Dropping this line loses a keyboard affordance
204
+ // that nothing else would report as broken.
205
+ resizer.focus({ preventScroll: true });
206
+ startX = e.clientX;
207
+ startW = currentWidth();
208
+ dragPointer = Number.isFinite(e.pointerId) ? e.pointerId : null;
209
+ if (dragPointer !== null && typeof resizer.setPointerCapture === 'function') {
210
+ try { resizer.setPointerCapture(dragPointer); } catch { /* window listeners remain the fallback */ }
211
+ }
212
+ resizer.classList.add('drag');
213
+ doc.body.style.userSelect = 'none';
214
+ win.addEventListener('pointermove', onMove);
215
+ win.addEventListener('pointerup', onUp);
216
+ win.addEventListener('pointercancel', onCancel);
217
+ });
218
+ on(resizer, 'lostpointercapture', onCancel);
219
+ off.push(() => { finishDrag(false); });
220
+
221
+ on(resizer, 'dblclick', () => { styleRoot.style.removeProperty(cssVar); store.remove(widthKey); });
222
+
223
+ on(resizer, 'keydown', (e) => {
224
+ const delta = nudgeStep(e.key, e.shiftKey);
225
+ if (!delta) return;
226
+ e.preventDefault();
227
+ // stopPropagation is load-bearing: a host may bind arrow keys on the window for its viewport, and
228
+ // a focusable div sails past the usual INPUT/SELECT/TEXTAREA skip. Without it the panel resizes
229
+ // AND the camera pans, which was measured once already.
230
+ e.stopPropagation();
231
+ applyWidth(currentWidth() + delta, true);
232
+ });
233
+
234
+ // Re-clamp only when a width was explicitly chosen — an untouched panel is on its CSS default and
235
+ // pinning it here would freeze it at whatever the window happened to be.
236
+ on(win, 'resize', () => { if (styleRoot.style.getPropertyValue(cssVar)) applyWidth(currentWidth(), false); });
237
+
238
+ /* ── collapse ──────────────────────────────────────────────────────────────────────────────── */
239
+
240
+ let collapsed = store.get(collapsedKey) === '1';
241
+ const reflect = () => {
242
+ doc.body.classList.toggle(collapsedClass, collapsed);
243
+ toggle.setAttribute('aria-expanded', String(!collapsed));
244
+ const text = label(collapsed);
245
+ toggle.setAttribute('aria-label', text);
246
+ // data-tip, never title: a native tooltip renders the light OS bubble against a dark theme.
247
+ toggle.dataset.tip = text;
248
+ };
249
+ const setCollapsed = (next, focus = false) => {
250
+ const value = Boolean(next);
251
+ if (value === collapsed) return false;
252
+ collapsed = value;
253
+ store.set(collapsedKey, collapsed ? '1' : '0');
254
+ reflect();
255
+ // The host's business, not the panel's: a shared side panel that knew about a split view would
256
+ // not be shared. It is called AFTER reflection so the host measures the new layout.
257
+ if (onSettle) onSettle();
258
+ if (focus) toggle.focus();
259
+ return true;
260
+ };
261
+ const onToggle = () => setCollapsed(!collapsed, true);
262
+ on(toggle, 'click', onToggle);
263
+ reflect();
264
+
265
+ return {
266
+ expand() { return setCollapsed(false); },
267
+ destroy() {
268
+ while (off.length) off.pop()();
269
+ },
270
+ };
271
+ }
@@ -0,0 +1,44 @@
1
+ /* Binding-scoped local recovery for model-editor state that has not reached the server yet. */
2
+
3
+ const sameBinding = (left, right) => !!left && !!right
4
+ && left.projectUuid === right.projectUuid
5
+ && left.modelId === right.modelId
6
+ && left.baseRevisionId === right.baseRevisionId
7
+ && left.sourceDigest === right.sourceDigest;
8
+
9
+ /** @param {{storage:Storage|{getItem:(key:string)=>string|null,setItem:(key:string,value:string)=>void,removeItem:(key:string)=>void},key?:string,schema?:string,maxBytes?:number,encode?:(value:string)=>{byteLength:number}}} options */
10
+ export function createModelEditorStateRecoveryStore({
11
+ storage,
12
+ key = 'floless:model-editor-dirty:v1',
13
+ schema = 'floless.model-editor-dirty/v1',
14
+ maxBytes = 512 * 1024,
15
+ encode = (value) => new TextEncoder().encode(value),
16
+ } = {}) {
17
+ if (!storage?.getItem || !storage?.setItem || !storage?.removeItem) throw new TypeError('Model editor recovery needs web storage.');
18
+ const clear = (binding) => {
19
+ try {
20
+ const value = JSON.parse(storage.getItem(key) || 'null');
21
+ if (sameBinding(value?.binding, binding)) storage.removeItem(key);
22
+ } catch (_) { storage.removeItem(key); }
23
+ };
24
+ return Object.freeze({
25
+ read(binding, baseEtag) {
26
+ try {
27
+ const value = JSON.parse(storage.getItem(key) || 'null');
28
+ if (value?.schema !== schema || !sameBinding(value.binding, binding) || value.baseEtag !== baseEtag) return null;
29
+ const owned = value.owned;
30
+ if (!owned || !Array.isArray(owned.namedViews) || !Array.isArray(owned.coordinateFrames)
31
+ || !Array.isArray(owned.sections?.clips) || !Object.hasOwn(owned.sections, 'workArea')) return null;
32
+ return owned;
33
+ } catch (_) { return null; }
34
+ },
35
+ retain(binding, baseEtag, owned) {
36
+ try {
37
+ const encoded = JSON.stringify({ schema, binding, baseEtag, owned });
38
+ if (encode(encoded).byteLength > maxBytes) { clear(binding); return false; }
39
+ storage.setItem(key, encoded); return true;
40
+ } catch (_) { return false; }
41
+ },
42
+ clear,
43
+ });
44
+ }