@beyondwork/xlsx-substrate-bindings 0.0.0-stage → 0.1.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 (50) hide show
  1. package/LICENSE.md +31 -0
  2. package/dist/ai/index.d.ts +2 -0
  3. package/dist/ai/index.js +1 -0
  4. package/dist/ai/types.d.ts +320 -0
  5. package/dist/ai/types.js +23 -0
  6. package/dist/index.d.ts +46 -0
  7. package/dist/index.js +72 -0
  8. package/dist/runtime/index.d.ts +2 -0
  9. package/dist/runtime/index.js +1 -0
  10. package/dist/runtime/types.d.ts +1379 -0
  11. package/dist/runtime/types.js +15 -0
  12. package/dist/shared.d.ts +69 -0
  13. package/dist/shared.js +1 -0
  14. package/dist/ui/index.d.ts +2 -0
  15. package/dist/ui/index.js +1 -0
  16. package/dist/ui/types.d.ts +765 -0
  17. package/dist/ui/types.js +12 -0
  18. package/dist/wasm/bridge-contract.d.ts +541 -0
  19. package/dist/wasm/bridge-contract.js +862 -0
  20. package/dist/wasm/chart-test-fixture.d.ts +19 -0
  21. package/dist/wasm/chart-test-fixture.js +42 -0
  22. package/dist/wasm/index.d.ts +9 -0
  23. package/dist/wasm/index.js +67 -0
  24. package/dist/wasm/media-test-fixture.d.ts +44 -0
  25. package/dist/wasm/media-test-fixture.js +160 -0
  26. package/dist/wasm/session-router.d.ts +98 -0
  27. package/dist/wasm/session-router.js +184 -0
  28. package/dist/wasm/sheet-window-binary-reference.d.ts +9 -0
  29. package/dist/wasm/sheet-window-binary-reference.js +308 -0
  30. package/dist/wasm/sheet-window-binary.d.ts +279 -0
  31. package/dist/wasm/sheet-window-binary.js +636 -0
  32. package/dist/wasm/volatile-test-fixture.d.ts +7 -0
  33. package/dist/wasm/volatile-test-fixture.js +35 -0
  34. package/dist/wasm/web.d.ts +59 -0
  35. package/dist/wasm/web.js +60 -0
  36. package/generated/wasm/package.json +3 -0
  37. package/generated/wasm/sheet-window-binary.mjs +482 -0
  38. package/generated/wasm/snippets/ironcalc_base-89b4f49381e1e289/inline0.js +45 -0
  39. package/generated/wasm/xlsx_substrate_wasm.d.ts +336 -0
  40. package/generated/wasm/xlsx_substrate_wasm.js +2108 -0
  41. package/generated/wasm/xlsx_substrate_wasm_bg.wasm +0 -0
  42. package/generated/wasm/xlsx_substrate_wasm_bg.wasm.d.ts +105 -0
  43. package/generated/wasm-web/package.json +3 -0
  44. package/generated/wasm-web/snippets/ironcalc_base-89b4f49381e1e289/inline0.js +42 -0
  45. package/generated/wasm-web/xlsx_substrate_wasm.d.ts +466 -0
  46. package/generated/wasm-web/xlsx_substrate_wasm.js +2109 -0
  47. package/generated/wasm-web/xlsx_substrate_wasm_bg.wasm +0 -0
  48. package/generated/wasm-web/xlsx_substrate_wasm_bg.wasm.d.ts +105 -0
  49. package/package.json +41 -3
  50. package/README.md +0 -3
@@ -0,0 +1,862 @@
1
+ // Target-independent XLSX wasm bridge contract — shared verbatim by the
2
+ // Node.js loader (`index.ts`, `--target nodejs` CJS artifact) and the
3
+ // browser loader (`web.ts`, `--target web` ESM artifact). This module must
4
+ // stay free of `node:` imports and of static references to the gitignored
5
+ // `generated/` artifacts so it bundles cleanly for browser hosts and lints
6
+ // on artifact-less checkouts. Loader shells own artifact resolution and
7
+ // instantiation; everything after a raw module object exists (validation,
8
+ // wrapping, normalization) lives here.
9
+ import { createSheetWindowDecodedReader } from "./sheet-window-binary.js";
10
+ /** Every runtime-session-mutations-v1 method name, used by feature detection. */
11
+ const RUNTIME_SESSION_MUTATION_METHODS = [
12
+ "commitCellFormulaInSession",
13
+ "commitRangeClearInSession",
14
+ "recalculateInSession",
15
+ "exportRuntimeSessionBytes",
16
+ "commitRangeFillInSession",
17
+ "commitRangePasteInSession",
18
+ "commitRangeTransferInSession",
19
+ "commitRangeFormatInSession",
20
+ "resizeColumnWidthInSession",
21
+ "resizeRowHeightInSession",
22
+ "setColumnHiddenInSession",
23
+ "setRowHiddenInSession",
24
+ "setFrozenPaneInSession",
25
+ "mergeCellsInSession",
26
+ "mutateSheetStructureInSession",
27
+ "mutateSheetTabsInSession",
28
+ "commitTableAppendRowInSession",
29
+ "commitShiftCellsInSession"
30
+ ];
31
+ /**
32
+ * T1 feature detection: true when the mounted wasm build advertises
33
+ * `runtime-session-mutations-v1` AND the session-mutation methods were
34
+ * attached from the raw module object. Older wasm builds fail this check and
35
+ * callers must stay on the byte-based mutation surface (see
36
+ * `createXlsxWorkbookMutationRouter` for the routing/fallback seam).
37
+ */
38
+ /**
39
+ * The capabilities in `required` that `bridge` does not advertise. Hosts gate
40
+ * on the capabilities they call instead of pinning a bridge version, which
41
+ * changes whenever the native contract grows.
42
+ */
43
+ export function missingXlsxWasmCapabilities(bridge, required) {
44
+ const available = bridge.status.capabilities;
45
+ return required.filter((capability) => !available.includes(capability));
46
+ }
47
+ export function supportsRuntimeSessionMutations(bridge) {
48
+ return (bridge.status.capabilities.includes("runtime-session-mutations-v1") &&
49
+ RUNTIME_SESSION_MUTATION_METHODS.every((method) => typeof bridge[method] === "function"));
50
+ }
51
+ export { createSheetWindowDecodedReader, decodeSheetWindowBinary, SHEET_WINDOW_BINARY_SCHEMA_ID } from "./sheet-window-binary.js";
52
+ const requiredBridgeVersion = "xlsx-wasm-bridge-v40"; // v40: X3-R-012 (`dataRegionInRuntimeSession`: Excel's Ctrl+Arrow / Ctrl+Shift+Arrow / Ctrl+A targets over the canonical cells, with the data-region-v1 capability; v39 was X5-C-056)
53
+ const requiredCapabilities = [
54
+ "workflow-context-v2",
55
+ "workflow-overlay-lanes-v1",
56
+ "sheet-window-paint-geometry-v1",
57
+ "sheet-window-coordinate-posture-v1",
58
+ "formula-diagnostics-v2",
59
+ "formula-address-commit-v1",
60
+ "formula-recalculate-commit-v1",
61
+ "formula-recalculate-volatile-inputs-v1",
62
+ "formula-translation-interaction-v1",
63
+ "kernel-ui-v1",
64
+ "runtime-session-handles-v1",
65
+ "staged-open-v1",
66
+ "sheet-window-cache-v1",
67
+ "readback-envelope-v1",
68
+ "preserve-only-entities-v1",
69
+ "selection-set-v1",
70
+ "range-fill-commit-v1",
71
+ "range-paste-commit-v1",
72
+ "range-clear-commit-v1",
73
+ "range-format-commit-v1",
74
+ "range-transfer-v1",
75
+ "layout-metric-resize-v1",
76
+ "layout-metric-visibility-v1",
77
+ "outline-group-visibility-v1",
78
+ "sheet-structure-v1",
79
+ "sheet-tabs-v1",
80
+ "table-mutation-v1",
81
+ "operation-pattern-hints-v1",
82
+ "ai-compressed-bundles-v1",
83
+ "ui-capability-records-v1",
84
+ "drawing-media-v1",
85
+ "drawing-chart-v1",
86
+ "frozen-pane-v1",
87
+ // X5-U-037 merge/unmerge cells authoring.
88
+ "merge-cells-v1",
89
+ // UX-P-104: the mounted grid sizes its scroll surface from `sheetExtent`,
90
+ // so a bridge that cannot supply it fails the mount gate rather than
91
+ // silently falling back to the estimate.
92
+ "sheet-window-extent-v1",
93
+ // X5-U-028: the selection readback carries anchor/head and the read echoes
94
+ // a validated `selectionCursor`. A bridge without it would accept the extra
95
+ // argument, drop it, and hand the host a readback whose missing anchor
96
+ // sends every Shift+Arrow from the wrong corner — so it fails the mount
97
+ // gate instead.
98
+ "selection-cursor-v1",
99
+ // X5-U-006 insert/delete cells with shift (bridge v26).
100
+ "shift-cells-v1",
101
+ // X5-U-025: the selection-set readback carries the set's capability record
102
+ // set (`capabilities`) and typed set-level blockers, and row/column/sheet
103
+ // handles are range write targets. A bridge without it answers a multi-area
104
+ // read with no records, so the host index would fail closed on every verb
105
+ // for every Ctrl+click selection — it fails the mount gate instead
106
+ // (bridge v27).
107
+ "selection-set-capabilities-v1",
108
+ // X5-U-038 (bridge v34): `findInRuntimeSession` and the `edit.find` /
109
+ // `edit.replace` records. A bridge without it would answer Ctrl+F with
110
+ // `not a function` and grey the Find unit as record-missing, so it fails
111
+ // the mount gate instead.
112
+ "find-v1",
113
+ // X5-U-023 (bridge v35): `goToInRuntimeSession`. A bridge without it would
114
+ // answer Enter in the name box with `not a function`, so it fails the
115
+ // mount gate instead.
116
+ "go-to-v1",
117
+ // X3-R-012 (bridge v40): `dataRegionInRuntimeSession`. A bridge without it
118
+ // would answer Ctrl+Down with `not a function`, so it fails the mount gate
119
+ // instead.
120
+ "data-region-v1"
121
+ ];
122
+ const requiredRawMethods = [
123
+ "getWasmStatus",
124
+ "openWorkbookRuntimeSession",
125
+ "disposeWorkbookRuntimeSession",
126
+ "inspectWorkbookRuntimeSession",
127
+ "listRuntimeSessionScopes",
128
+ "readRuntimeSessionCompressedContext",
129
+ "readRuntimeSessionCompressedDrilldown",
130
+ "explainRuntimeSessionFormula",
131
+ "bindUiRuntimeSession",
132
+ "readRuntimeSessionSelection",
133
+ "readRuntimeSessionSelectionSet",
134
+ "summarizeRuntimeSessionAccessibility",
135
+ "findInRuntimeSession",
136
+ "goToInRuntimeSession",
137
+ "dataRegionInRuntimeSession",
138
+ "readRuntimeSessionSheetWindow",
139
+ "readRuntimeSessionOverlayLanes",
140
+ "readRuntimeSessionKernelPanel",
141
+ "readRuntimeSessionMediaBytes",
142
+ "readRuntimeSessionChartBytes",
143
+ "inspectWorkbook",
144
+ "readPreserveOnlyEntities",
145
+ "readRuntimeSessionPreserveOnlyEntities",
146
+ "listScopes",
147
+ "readCompressedContext",
148
+ "readCompressedDrilldown",
149
+ "resolveReference",
150
+ "explainFormula",
151
+ "bindUiSession",
152
+ "classifyUiState",
153
+ "projectViewportHint",
154
+ "readSelection",
155
+ "readSelectionSet",
156
+ "summarizeAccessibility",
157
+ "readSheetWindow",
158
+ "readWorkflowOverlayLanes",
159
+ "readKernelPanel",
160
+ "validateKernelAction",
161
+ "createKernelBinding",
162
+ "updateKernelSource",
163
+ "startKernelRun",
164
+ "completeKernelRun",
165
+ "cancelKernelRun",
166
+ "detachKernelOutput",
167
+ "deleteKernelBinding",
168
+ "commitCellFormula",
169
+ "recalculateFormulas",
170
+ "commitRangeFill",
171
+ "commitRangePaste",
172
+ "commitRangeTransfer",
173
+ "commitRangeClear",
174
+ "commitRangeFormat",
175
+ "commitRangeHyperlink",
176
+ "commitRangeDataValidation",
177
+ "commitReviewComment",
178
+ "commitSelectionSetPaste",
179
+ "commitSelectionSetClear",
180
+ "commitSelectionSetFormat",
181
+ "resizeColumnWidth",
182
+ "resizeRowHeight",
183
+ "setColumnHidden",
184
+ "setRowHidden",
185
+ "setFrozenPane",
186
+ "mergeCells",
187
+ "setColumnOutlineGroupHidden",
188
+ "setRowOutlineGroupHidden",
189
+ "setSheetOutlineLevel",
190
+ "mutateSheetStructure",
191
+ "commitTableAppendRow",
192
+ "commitApplyFilter",
193
+ "commitClearFilter",
194
+ "commitApplySort",
195
+ "mutateSheetTabs",
196
+ "commitShiftCells"
197
+ ];
198
+ /**
199
+ * Target-independent mount gate: role, bridge version, required
200
+ * capabilities, and required raw methods. Both the Node.js loader
201
+ * (`loadGeneratedXlsxWasmBridge`) and the browser loader
202
+ * (`loadXlsxWasmBridgeWeb`) run this exact check so the two artifacts can
203
+ * never mount divergent contracts.
204
+ */
205
+ export function validateRawXlsxWasmModule(raw) {
206
+ const status = raw.getWasmStatus();
207
+ if (status.role !== "wasm-ai-ui-runtime-binding") {
208
+ return {
209
+ ok: false,
210
+ reason: `generated WASM role ${status.role} is stale; run build:wasm`,
211
+ requiredModeMessage: `generated WASM role ${status.role} does not match current bridge`
212
+ };
213
+ }
214
+ if (status.bridgeVersion !== requiredBridgeVersion) {
215
+ return {
216
+ ok: false,
217
+ reason: `generated WASM bridge version ${String(status.bridgeVersion)} is stale; run build:wasm`,
218
+ requiredModeMessage: `generated WASM bridge version ${String(status.bridgeVersion)} does not match ${requiredBridgeVersion}`
219
+ };
220
+ }
221
+ const missingCapability = requiredCapabilities.find((capability) => !status.capabilities?.includes(capability));
222
+ if (missingCapability) {
223
+ const message = `generated WASM capability ${missingCapability} is absent; run build:wasm`;
224
+ return { ok: false, reason: message, requiredModeMessage: message };
225
+ }
226
+ const missingMethod = requiredRawMethods.find((method) => typeof raw[method] !== "function");
227
+ if (missingMethod) {
228
+ const message = `generated WASM method ${missingMethod} is absent; run build:wasm`;
229
+ return { ok: false, reason: message, requiredModeMessage: message };
230
+ }
231
+ return { ok: true, status };
232
+ }
233
+ export function createXlsxWasmBridge(raw, status = raw.getWasmStatus()) {
234
+ // T1 feature detection: session-mutation exports are optional on the raw
235
+ // wasm module object so older generated builds keep mounting with the
236
+ // byte-based surface only. Capture the raw functions once so the closures
237
+ // below stay narrowed.
238
+ const rawCommitCellFormulaInSession = typeof raw.commitCellFormulaInSession === "function" ? raw.commitCellFormulaInSession.bind(raw) : undefined;
239
+ const rawCommitRangeClearInSession = typeof raw.commitRangeClearInSession === "function" ? raw.commitRangeClearInSession.bind(raw) : undefined;
240
+ const rawRecalculateInSession = typeof raw.recalculateInSession === "function" ? raw.recalculateInSession.bind(raw) : undefined;
241
+ const rawExportRuntimeSessionBytes = typeof raw.exportRuntimeSessionBytes === "function" ? raw.exportRuntimeSessionBytes.bind(raw) : undefined;
242
+ const rawCommitRangeFillInSession = typeof raw.commitRangeFillInSession === "function" ? raw.commitRangeFillInSession.bind(raw) : undefined;
243
+ const rawCommitRangePasteInSession = typeof raw.commitRangePasteInSession === "function" ? raw.commitRangePasteInSession.bind(raw) : undefined;
244
+ const rawCommitRangeTransferInSession = typeof raw.commitRangeTransferInSession === "function" ? raw.commitRangeTransferInSession.bind(raw) : undefined;
245
+ const rawCommitRangeFormatInSession = typeof raw.commitRangeFormatInSession === "function" ? raw.commitRangeFormatInSession.bind(raw) : undefined;
246
+ const rawResizeColumnWidthInSession = typeof raw.resizeColumnWidthInSession === "function" ? raw.resizeColumnWidthInSession.bind(raw) : undefined;
247
+ const rawResizeRowHeightInSession = typeof raw.resizeRowHeightInSession === "function" ? raw.resizeRowHeightInSession.bind(raw) : undefined;
248
+ const rawSetColumnHiddenInSession = typeof raw.setColumnHiddenInSession === "function" ? raw.setColumnHiddenInSession.bind(raw) : undefined;
249
+ const rawSetRowHiddenInSession = typeof raw.setRowHiddenInSession === "function" ? raw.setRowHiddenInSession.bind(raw) : undefined;
250
+ const rawSetFrozenPaneInSession = typeof raw.setFrozenPaneInSession === "function" ? raw.setFrozenPaneInSession.bind(raw) : undefined;
251
+ const rawMergeCellsInSession = typeof raw.mergeCellsInSession === "function" ? raw.mergeCellsInSession.bind(raw) : undefined;
252
+ const rawMutateSheetStructureInSession = typeof raw.mutateSheetStructureInSession === "function" ? raw.mutateSheetStructureInSession.bind(raw) : undefined;
253
+ const rawMutateSheetTabsInSession = typeof raw.mutateSheetTabsInSession === "function" ? raw.mutateSheetTabsInSession.bind(raw) : undefined;
254
+ const rawCommitTableAppendRowInSession = typeof raw.commitTableAppendRowInSession === "function" ? raw.commitTableAppendRowInSession.bind(raw) : undefined;
255
+ const rawCommitShiftCellsInSession = typeof raw.commitShiftCellsInSession === "function" ? raw.commitShiftCellsInSession.bind(raw) : undefined;
256
+ // X5-U-012 feature detection: the delimited-text export is optional and
257
+ // independent of the mutation family, so it is attached on its own.
258
+ const rawExportRuntimeSessionDelimitedText = typeof raw.exportRuntimeSessionDelimitedText === "function"
259
+ ? raw.exportRuntimeSessionDelimitedText.bind(raw)
260
+ : undefined;
261
+ // T5 feature detection: the binary sheet-window export is optional on the
262
+ // raw wasm module object (older builds lack it); `readSheetWindowDecoded`
263
+ // routes through it when present and stays on JSON otherwise.
264
+ const rawReadSheetWindowBinary = typeof raw.readRuntimeSessionSheetWindowBinary === "function"
265
+ ? raw.readRuntimeSessionSheetWindowBinary.bind(raw)
266
+ : undefined;
267
+ // T5 decoded seam with the permanent-JSON-fallback latch. The factory
268
+ // covers BOTH eager decode throws and lazy section-getter failures at
269
+ // consumer access time (routed back via onSectionDecodeError) — see
270
+ // createSheetWindowDecodedReader in sheet-window-binary.ts.
271
+ const readSheetWindowDecodedImpl = createSheetWindowDecodedReader({
272
+ readBinary: rawReadSheetWindowBinary
273
+ ? (handleId, viewportHint, activeHandle, workflowContext) => normalizeSheetWindowBinaryEnvelope(rawReadSheetWindowBinary(handleId, viewportHint, activeHandle, workflowContext))
274
+ : undefined,
275
+ readJson: (handleId, viewportHint, activeHandle, workflowContext) => raw.readRuntimeSessionSheetWindow(handleId, viewportHint, activeHandle, workflowContext)
276
+ });
277
+ const sessionMutationMethods = rawCommitCellFormulaInSession && rawCommitRangeClearInSession && rawRecalculateInSession &&
278
+ rawExportRuntimeSessionBytes && rawCommitRangeFillInSession && rawCommitRangePasteInSession &&
279
+ rawCommitRangeTransferInSession && rawCommitRangeFormatInSession && rawResizeColumnWidthInSession &&
280
+ rawResizeRowHeightInSession && rawSetColumnHiddenInSession && rawSetRowHiddenInSession &&
281
+ rawSetFrozenPaneInSession && rawMergeCellsInSession &&
282
+ rawMutateSheetStructureInSession && rawMutateSheetTabsInSession && rawCommitTableAppendRowInSession &&
283
+ rawCommitShiftCellsInSession
284
+ ? {
285
+ commitCellFormulaInSession(handleId, request) {
286
+ return normalizeFormulaCommitResult(rawCommitCellFormulaInSession(handleId, request));
287
+ },
288
+ commitRangeClearInSession(handleId, request) {
289
+ return normalizeRangeClearCommitResult(rawCommitRangeClearInSession(handleId, request));
290
+ },
291
+ recalculateInSession(handleId, request = {}) {
292
+ return normalizeFormulaRecalculateResult(rawRecalculateInSession(handleId, request));
293
+ },
294
+ exportRuntimeSessionBytes(handleId, request = {}) {
295
+ return normalizeRuntimeSessionExportResult(rawExportRuntimeSessionBytes(handleId, request));
296
+ },
297
+ commitRangeFillInSession(handleId, request) {
298
+ return normalizeRangeFillCommitResult(rawCommitRangeFillInSession(handleId, request));
299
+ },
300
+ commitRangePasteInSession(handleId, request) {
301
+ return normalizeRangePasteCommitResult(rawCommitRangePasteInSession(handleId, request));
302
+ },
303
+ commitRangeTransferInSession(handleId, request) {
304
+ return normalizeRangeTransferCommitResult(rawCommitRangeTransferInSession(handleId, request));
305
+ },
306
+ commitRangeFormatInSession(handleId, request) {
307
+ return normalizeRangeFormatCommitResult(rawCommitRangeFormatInSession(handleId, request));
308
+ },
309
+ resizeColumnWidthInSession(handleId, request) {
310
+ return normalizeLayoutMetricResizeResult(rawResizeColumnWidthInSession(handleId, request));
311
+ },
312
+ resizeRowHeightInSession(handleId, request) {
313
+ return normalizeLayoutMetricResizeResult(rawResizeRowHeightInSession(handleId, request));
314
+ },
315
+ setColumnHiddenInSession(handleId, request) {
316
+ return normalizeLayoutMetricVisibilityResult(rawSetColumnHiddenInSession(handleId, request));
317
+ },
318
+ setRowHiddenInSession(handleId, request) {
319
+ return normalizeLayoutMetricVisibilityResult(rawSetRowHiddenInSession(handleId, request));
320
+ },
321
+ setFrozenPaneInSession(handleId, request) {
322
+ return normalizeFrozenPaneResult(rawSetFrozenPaneInSession(handleId, request));
323
+ },
324
+ mergeCellsInSession(handleId, request) {
325
+ return normalizeMergeCellsResult(rawMergeCellsInSession(handleId, request));
326
+ },
327
+ mutateSheetStructureInSession(handleId, request) {
328
+ return normalizeSheetStructureMutationResult(rawMutateSheetStructureInSession(handleId, request));
329
+ },
330
+ mutateSheetTabsInSession(handleId, request) {
331
+ return normalizeSheetTabMutationResult(rawMutateSheetTabsInSession(handleId, request));
332
+ },
333
+ commitTableAppendRowInSession(handleId, request) {
334
+ return normalizeTableAppendRowResult(rawCommitTableAppendRowInSession(handleId, request));
335
+ },
336
+ commitShiftCellsInSession(handleId, request) {
337
+ return normalizeShiftCellsCommitResult(rawCommitShiftCellsInSession(handleId, request));
338
+ }
339
+ }
340
+ : undefined;
341
+ return {
342
+ status,
343
+ ...(sessionMutationMethods ?? {}),
344
+ openWorkbookRuntimeSession(bytes, request = {}) {
345
+ return raw.openWorkbookRuntimeSession(bytes, request);
346
+ },
347
+ disposeWorkbookRuntimeSession(handleId) {
348
+ return raw.disposeWorkbookRuntimeSession(handleId);
349
+ },
350
+ inspectWorkbookRuntimeSession(handleId) {
351
+ return raw.inspectWorkbookRuntimeSession(handleId);
352
+ },
353
+ listRuntimeSessionScopes(handleId, request = {}) {
354
+ return raw.listRuntimeSessionScopes(handleId, request);
355
+ },
356
+ readRuntimeSessionCompressedContext(handleId, request = {}) {
357
+ return raw.readRuntimeSessionCompressedContext(handleId, request);
358
+ },
359
+ readRuntimeSessionCompressedDrilldown(handleId, request) {
360
+ return raw.readRuntimeSessionCompressedDrilldown(handleId, request);
361
+ },
362
+ explainRuntimeSessionFormula(handleId, target) {
363
+ return raw.explainRuntimeSessionFormula(handleId, target);
364
+ },
365
+ bindUiRuntimeSession(handleId, requestedActiveSheetId) {
366
+ return raw.bindUiRuntimeSession(handleId, requestedActiveSheetId);
367
+ },
368
+ readRuntimeSessionSelection(handleId, handle, viewportHint, workflowContext, selectionCursor) {
369
+ return raw.readRuntimeSessionSelection(handleId, handle, viewportHint, workflowContext, selectionCursor);
370
+ },
371
+ readRuntimeSessionSelectionSet(handleId, request) {
372
+ return raw.readRuntimeSessionSelectionSet(handleId, request);
373
+ },
374
+ summarizeRuntimeSessionAccessibility(handleId, handle, viewportHint, workflowContext) {
375
+ return raw.summarizeRuntimeSessionAccessibility(handleId, handle, viewportHint, workflowContext);
376
+ },
377
+ findInRuntimeSession(handleId, request) {
378
+ return raw.findInRuntimeSession(handleId, request);
379
+ },
380
+ goToInRuntimeSession(handleId, request) {
381
+ return raw.goToInRuntimeSession(handleId, request);
382
+ },
383
+ dataRegionInRuntimeSession(handleId, request) {
384
+ return raw.dataRegionInRuntimeSession(handleId, request);
385
+ },
386
+ readRuntimeSessionSheetWindow(handleId, viewportHint, activeHandle, workflowContext) {
387
+ return raw.readRuntimeSessionSheetWindow(handleId, viewportHint, activeHandle, workflowContext);
388
+ },
389
+ ...(rawReadSheetWindowBinary
390
+ ? {
391
+ readRuntimeSessionSheetWindowBinary(handleId, viewportHint, activeHandle, workflowContext) {
392
+ return normalizeSheetWindowBinaryEnvelope(rawReadSheetWindowBinary(handleId, viewportHint, activeHandle, workflowContext));
393
+ }
394
+ }
395
+ : {}),
396
+ ...(rawExportRuntimeSessionDelimitedText
397
+ ? {
398
+ exportRuntimeSessionDelimitedText(handleId, request = {}) {
399
+ return rawExportRuntimeSessionDelimitedText(handleId, request);
400
+ }
401
+ }
402
+ : {}),
403
+ readSheetWindowDecoded(handleId, viewportHint, activeHandle, workflowContext) {
404
+ // T5 feature detection: binary export + decode when the wasm build
405
+ // carries it; the JSON export otherwise. Any decode failure — eager
406
+ // header validation OR lazy section decode at consumer access — logs
407
+ // once and permanently falls back to JSON for this bridge instance;
408
+ // defensive only (the differential parity test guards the layout).
409
+ return readSheetWindowDecodedImpl(handleId, viewportHint, activeHandle, workflowContext);
410
+ },
411
+ readRuntimeSessionOverlayLanes(handleId, request = {}) {
412
+ return raw.readRuntimeSessionOverlayLanes(handleId, request);
413
+ },
414
+ readRuntimeSessionKernelPanel(handleId, workflowContext) {
415
+ return raw.readRuntimeSessionKernelPanel(handleId, workflowContext);
416
+ },
417
+ readRuntimeSessionMediaBytes(handleId, mediaId) {
418
+ return normalizeMediaBytesReadback(raw.readRuntimeSessionMediaBytes(handleId, mediaId));
419
+ },
420
+ readRuntimeSessionChartBytes(handleId, chartId) {
421
+ return raw.readRuntimeSessionChartBytes(handleId, chartId);
422
+ },
423
+ inspectWorkbook(bytes, sourceLabel) {
424
+ return raw.inspectWorkbook(bytes, sourceLabel);
425
+ },
426
+ readPreserveOnlyEntities(bytes, sourceLabel) {
427
+ return raw.readPreserveOnlyEntities(bytes, sourceLabel);
428
+ },
429
+ readRuntimeSessionPreserveOnlyEntities(handleId) {
430
+ return raw.readRuntimeSessionPreserveOnlyEntities(handleId);
431
+ },
432
+ listScopes(bytes, request = {}) {
433
+ return raw.listScopes(bytes, request);
434
+ },
435
+ readCompressedContext(bytes, request = {}) {
436
+ return raw.readCompressedContext(bytes, request);
437
+ },
438
+ readCompressedDrilldown(bytes, request) {
439
+ return raw.readCompressedDrilldown(bytes, request);
440
+ },
441
+ resolveReference(bytes, query) {
442
+ return raw.resolveReference(bytes, query);
443
+ },
444
+ explainFormula(bytes, target) {
445
+ return raw.explainFormula(bytes, target);
446
+ },
447
+ bindUiSession(bytes, requestedActiveSheetId) {
448
+ return raw.bindUiSession(bytes, requestedActiveSheetId);
449
+ },
450
+ classifyUiState(namespace) {
451
+ return raw.classifyUiState(namespace);
452
+ },
453
+ projectViewportHint(bytes, hint) {
454
+ return raw.projectViewportHint(bytes, hint);
455
+ },
456
+ readSelection(bytes, handle, viewportHint, workflowContext, selectionCursor) {
457
+ return raw.readSelection(bytes, handle, viewportHint, workflowContext, selectionCursor);
458
+ },
459
+ readSelectionSet(bytes, request) {
460
+ return raw.readSelectionSet(bytes, request);
461
+ },
462
+ summarizeAccessibility(bytes, handle, viewportHint, workflowContext) {
463
+ return raw.summarizeAccessibility(bytes, handle, viewportHint, workflowContext);
464
+ },
465
+ readSheetWindow(bytes, viewportHint, activeHandle, workflowContext) {
466
+ return raw.readSheetWindow(bytes, viewportHint, activeHandle, workflowContext);
467
+ },
468
+ readWorkflowOverlayLanes(bytes, request = {}) {
469
+ return raw.readWorkflowOverlayLanes(bytes, request);
470
+ },
471
+ readKernelPanel(bytes, workflowContext) {
472
+ return raw.readKernelPanel(bytes, workflowContext);
473
+ },
474
+ validateKernelAction(bytes, request) {
475
+ return raw.validateKernelAction(bytes, request);
476
+ },
477
+ createKernelBinding(bytes, request) {
478
+ return normalizeKernelMutationResult(raw.createKernelBinding(bytes, request));
479
+ },
480
+ updateKernelSource(bytes, request) {
481
+ return normalizeKernelMutationResult(raw.updateKernelSource(bytes, request));
482
+ },
483
+ startKernelRun(bytes, request) {
484
+ return normalizeKernelMutationResult(raw.startKernelRun(bytes, request));
485
+ },
486
+ completeKernelRun(bytes, request) {
487
+ return normalizeKernelMutationResult(raw.completeKernelRun(bytes, request));
488
+ },
489
+ cancelKernelRun(bytes, request) {
490
+ return normalizeKernelMutationResult(raw.cancelKernelRun(bytes, request));
491
+ },
492
+ detachKernelOutput(bytes, request) {
493
+ return normalizeKernelMutationResult(raw.detachKernelOutput(bytes, request));
494
+ },
495
+ deleteKernelBinding(bytes, request) {
496
+ return normalizeKernelMutationResult(raw.deleteKernelBinding(bytes, request));
497
+ },
498
+ commitCellFormula(bytes, request) {
499
+ return normalizeFormulaCommitResult(raw.commitCellFormula(bytes, request));
500
+ },
501
+ recalculateFormulas(bytes, request = {}) {
502
+ return normalizeFormulaRecalculateResult(raw.recalculateFormulas(bytes, request));
503
+ },
504
+ commitRangeFill(bytes, request) {
505
+ return normalizeRangeFillCommitResult(raw.commitRangeFill(bytes, request));
506
+ },
507
+ commitRangePaste(bytes, request) {
508
+ return normalizeRangePasteCommitResult(raw.commitRangePaste(bytes, request));
509
+ },
510
+ commitRangeTransfer(bytes, request) {
511
+ return normalizeRangeTransferCommitResult(raw.commitRangeTransfer(bytes, request));
512
+ },
513
+ commitRangeClear(bytes, request) {
514
+ return normalizeRangeClearCommitResult(raw.commitRangeClear(bytes, request));
515
+ },
516
+ commitRangeFormat(bytes, request) {
517
+ return normalizeRangeFormatCommitResult(raw.commitRangeFormat(bytes, request));
518
+ },
519
+ commitRangeHyperlink(bytes, request) {
520
+ return normalizeRangeHyperlinkCommitResult(raw.commitRangeHyperlink(bytes, request));
521
+ },
522
+ commitRangeDataValidation(bytes, request) {
523
+ return normalizeRangeDataValidationCommitResult(raw.commitRangeDataValidation(bytes, request));
524
+ },
525
+ commitReviewComment(bytes, request) {
526
+ return normalizeReviewCommentCommitResult(raw.commitReviewComment(bytes, request));
527
+ },
528
+ commitSelectionSetPaste(bytes, request) {
529
+ return normalizeRangePasteCommitResult(raw.commitSelectionSetPaste(bytes, request));
530
+ },
531
+ commitSelectionSetClear(bytes, request) {
532
+ return normalizeRangeClearCommitResult(raw.commitSelectionSetClear(bytes, request));
533
+ },
534
+ commitSelectionSetFormat(bytes, request) {
535
+ return normalizeRangeFormatCommitResult(raw.commitSelectionSetFormat(bytes, request));
536
+ },
537
+ resizeColumnWidth(bytes, request) {
538
+ return normalizeLayoutMetricResizeResult(raw.resizeColumnWidth(bytes, request));
539
+ },
540
+ resizeRowHeight(bytes, request) {
541
+ return normalizeLayoutMetricResizeResult(raw.resizeRowHeight(bytes, request));
542
+ },
543
+ setColumnHidden(bytes, request) {
544
+ return normalizeLayoutMetricVisibilityResult(raw.setColumnHidden(bytes, request));
545
+ },
546
+ setRowHidden(bytes, request) {
547
+ return normalizeLayoutMetricVisibilityResult(raw.setRowHidden(bytes, request));
548
+ },
549
+ setFrozenPane(bytes, request) {
550
+ return normalizeFrozenPaneResult(raw.setFrozenPane(bytes, request));
551
+ },
552
+ mergeCells(bytes, request) {
553
+ return normalizeMergeCellsResult(raw.mergeCells(bytes, request));
554
+ },
555
+ setColumnOutlineGroupHidden(bytes, request) {
556
+ return normalizeOutlineGroupVisibilityResult(raw.setColumnOutlineGroupHidden(bytes, request));
557
+ },
558
+ setRowOutlineGroupHidden(bytes, request) {
559
+ return normalizeOutlineGroupVisibilityResult(raw.setRowOutlineGroupHidden(bytes, request));
560
+ },
561
+ setSheetOutlineLevel(bytes, request) {
562
+ return normalizeOutlineLevelResult(raw.setSheetOutlineLevel(bytes, request));
563
+ },
564
+ mutateSheetStructure(bytes, request) {
565
+ return normalizeSheetStructureMutationResult(raw.mutateSheetStructure(bytes, request));
566
+ },
567
+ commitTableAppendRow(bytes, request) {
568
+ return normalizeTableAppendRowResult(raw.commitTableAppendRow(bytes, request));
569
+ },
570
+ commitApplyFilter(bytes, request) {
571
+ return normalizeRangeFilterResult(raw.commitApplyFilter(bytes, request));
572
+ },
573
+ commitClearFilter(bytes, request) {
574
+ return normalizeRangeFilterResult(raw.commitClearFilter(bytes, request));
575
+ },
576
+ commitApplySort(bytes, request) {
577
+ return normalizeRangeSortResult(raw.commitApplySort(bytes, request));
578
+ },
579
+ mutateSheetTabs(bytes, request) {
580
+ return normalizeSheetTabMutationResult(raw.mutateSheetTabs(bytes, request));
581
+ },
582
+ commitShiftCells(bytes, request) {
583
+ return normalizeShiftCellsCommitResult(raw.commitShiftCells(bytes, request));
584
+ }
585
+ };
586
+ }
587
+ function normalizeFormulaCommitResult(result) {
588
+ const exportedBytes = result.exportedBytes
589
+ ? result.exportedBytes instanceof Uint8Array
590
+ ? result.exportedBytes
591
+ : Uint8Array.from(result.exportedBytes)
592
+ : undefined;
593
+ return {
594
+ ...result,
595
+ exportedBytes
596
+ };
597
+ }
598
+ function normalizeRuntimeSessionExportResult(result) {
599
+ const exportedBytes = result.exportedBytes
600
+ ? result.exportedBytes instanceof Uint8Array
601
+ ? result.exportedBytes
602
+ : Uint8Array.from(result.exportedBytes)
603
+ : undefined;
604
+ return {
605
+ ...result,
606
+ exportedBytes
607
+ };
608
+ }
609
+ function normalizeFormulaRecalculateResult(result) {
610
+ const exportedBytes = result.exportedBytes
611
+ ? result.exportedBytes instanceof Uint8Array
612
+ ? result.exportedBytes
613
+ : Uint8Array.from(result.exportedBytes)
614
+ : undefined;
615
+ return {
616
+ ...result,
617
+ exportedBytes
618
+ };
619
+ }
620
+ function normalizeRangeFillCommitResult(result) {
621
+ const exportedBytes = result.exportedBytes
622
+ ? result.exportedBytes instanceof Uint8Array
623
+ ? result.exportedBytes
624
+ : Uint8Array.from(result.exportedBytes)
625
+ : undefined;
626
+ return {
627
+ ...result,
628
+ exportedBytes
629
+ };
630
+ }
631
+ function normalizeRangePasteCommitResult(result) {
632
+ const exportedBytes = result.exportedBytes
633
+ ? result.exportedBytes instanceof Uint8Array
634
+ ? result.exportedBytes
635
+ : Uint8Array.from(result.exportedBytes)
636
+ : undefined;
637
+ return {
638
+ ...result,
639
+ exportedBytes
640
+ };
641
+ }
642
+ function normalizeRangeTransferCommitResult(result) {
643
+ const exportedBytes = result.exportedBytes
644
+ ? result.exportedBytes instanceof Uint8Array
645
+ ? result.exportedBytes
646
+ : Uint8Array.from(result.exportedBytes)
647
+ : undefined;
648
+ return {
649
+ ...result,
650
+ exportedBytes
651
+ };
652
+ }
653
+ function normalizeRangeClearCommitResult(result) {
654
+ const exportedBytes = result.exportedBytes
655
+ ? result.exportedBytes instanceof Uint8Array
656
+ ? result.exportedBytes
657
+ : Uint8Array.from(result.exportedBytes)
658
+ : undefined;
659
+ return {
660
+ ...result,
661
+ exportedBytes
662
+ };
663
+ }
664
+ function normalizeRangeFormatCommitResult(result) {
665
+ const exportedBytes = result.exportedBytes
666
+ ? result.exportedBytes instanceof Uint8Array
667
+ ? result.exportedBytes
668
+ : Uint8Array.from(result.exportedBytes)
669
+ : undefined;
670
+ return {
671
+ ...result,
672
+ exportedBytes
673
+ };
674
+ }
675
+ function normalizeReviewCommentCommitResult(result) {
676
+ const exportedBytes = result.exportedBytes
677
+ ? result.exportedBytes instanceof Uint8Array
678
+ ? result.exportedBytes
679
+ : Uint8Array.from(result.exportedBytes)
680
+ : undefined;
681
+ return {
682
+ ...result,
683
+ exportedBytes
684
+ };
685
+ }
686
+ function normalizeRangeDataValidationCommitResult(result) {
687
+ const exportedBytes = result.exportedBytes
688
+ ? result.exportedBytes instanceof Uint8Array
689
+ ? result.exportedBytes
690
+ : Uint8Array.from(result.exportedBytes)
691
+ : undefined;
692
+ return {
693
+ ...result,
694
+ exportedBytes
695
+ };
696
+ }
697
+ function normalizeRangeHyperlinkCommitResult(result) {
698
+ const exportedBytes = result.exportedBytes
699
+ ? result.exportedBytes instanceof Uint8Array
700
+ ? result.exportedBytes
701
+ : Uint8Array.from(result.exportedBytes)
702
+ : undefined;
703
+ return {
704
+ ...result,
705
+ exportedBytes
706
+ };
707
+ }
708
+ function normalizeLayoutMetricResizeResult(result) {
709
+ const exportedBytes = result.exportedBytes
710
+ ? result.exportedBytes instanceof Uint8Array
711
+ ? result.exportedBytes
712
+ : Uint8Array.from(result.exportedBytes)
713
+ : undefined;
714
+ return {
715
+ ...result,
716
+ exportedBytes
717
+ };
718
+ }
719
+ function normalizeLayoutMetricVisibilityResult(result) {
720
+ const exportedBytes = result.exportedBytes
721
+ ? result.exportedBytes instanceof Uint8Array
722
+ ? result.exportedBytes
723
+ : Uint8Array.from(result.exportedBytes)
724
+ : undefined;
725
+ return {
726
+ ...result,
727
+ exportedBytes
728
+ };
729
+ }
730
+ function normalizeFrozenPaneResult(result) {
731
+ const exportedBytes = result.exportedBytes
732
+ ? result.exportedBytes instanceof Uint8Array
733
+ ? result.exportedBytes
734
+ : Uint8Array.from(result.exportedBytes)
735
+ : undefined;
736
+ return {
737
+ ...result,
738
+ exportedBytes
739
+ };
740
+ }
741
+ function normalizeMergeCellsResult(result) {
742
+ const exportedBytes = result.exportedBytes
743
+ ? result.exportedBytes instanceof Uint8Array
744
+ ? result.exportedBytes
745
+ : Uint8Array.from(result.exportedBytes)
746
+ : undefined;
747
+ return {
748
+ ...result,
749
+ exportedBytes
750
+ };
751
+ }
752
+ function normalizeOutlineGroupVisibilityResult(result) {
753
+ const exportedBytes = result.exportedBytes
754
+ ? result.exportedBytes instanceof Uint8Array
755
+ ? result.exportedBytes
756
+ : Uint8Array.from(result.exportedBytes)
757
+ : undefined;
758
+ return {
759
+ ...result,
760
+ exportedBytes
761
+ };
762
+ }
763
+ function normalizeOutlineLevelResult(result) {
764
+ const exportedBytes = result.exportedBytes
765
+ ? result.exportedBytes instanceof Uint8Array
766
+ ? result.exportedBytes
767
+ : Uint8Array.from(result.exportedBytes)
768
+ : undefined;
769
+ return {
770
+ ...result,
771
+ exportedBytes
772
+ };
773
+ }
774
+ function normalizeSheetStructureMutationResult(result) {
775
+ const exportedBytes = result.exportedBytes
776
+ ? result.exportedBytes instanceof Uint8Array
777
+ ? result.exportedBytes
778
+ : Uint8Array.from(result.exportedBytes)
779
+ : undefined;
780
+ return {
781
+ ...result,
782
+ exportedBytes
783
+ };
784
+ }
785
+ function normalizeTableAppendRowResult(result) {
786
+ const exportedBytes = result.exportedBytes
787
+ ? result.exportedBytes instanceof Uint8Array
788
+ ? result.exportedBytes
789
+ : Uint8Array.from(result.exportedBytes)
790
+ : undefined;
791
+ return {
792
+ ...result,
793
+ exportedBytes
794
+ };
795
+ }
796
+ function normalizeRangeFilterResult(result) {
797
+ const exportedBytes = result.exportedBytes
798
+ ? result.exportedBytes instanceof Uint8Array
799
+ ? result.exportedBytes
800
+ : Uint8Array.from(result.exportedBytes)
801
+ : undefined;
802
+ return {
803
+ ...result,
804
+ exportedBytes
805
+ };
806
+ }
807
+ function normalizeRangeSortResult(result) {
808
+ const exportedBytes = result.exportedBytes
809
+ ? result.exportedBytes instanceof Uint8Array
810
+ ? result.exportedBytes
811
+ : Uint8Array.from(result.exportedBytes)
812
+ : undefined;
813
+ return {
814
+ ...result,
815
+ exportedBytes
816
+ };
817
+ }
818
+ function normalizeSheetTabMutationResult(result) {
819
+ const exportedBytes = result.exportedBytes
820
+ ? result.exportedBytes instanceof Uint8Array
821
+ ? result.exportedBytes
822
+ : Uint8Array.from(result.exportedBytes)
823
+ : undefined;
824
+ return {
825
+ ...result,
826
+ exportedBytes
827
+ };
828
+ }
829
+ function normalizeShiftCellsCommitResult(result) {
830
+ const exportedBytes = result.exportedBytes
831
+ ? result.exportedBytes instanceof Uint8Array
832
+ ? result.exportedBytes
833
+ : Uint8Array.from(result.exportedBytes)
834
+ : undefined;
835
+ return {
836
+ ...result,
837
+ exportedBytes
838
+ };
839
+ }
840
+ function normalizeMediaBytesReadback(result) {
841
+ return {
842
+ ...result,
843
+ bytes: result.bytes instanceof Uint8Array ? result.bytes : Uint8Array.from(result.bytes)
844
+ };
845
+ }
846
+ function normalizeSheetWindowBinaryEnvelope(result) {
847
+ return {
848
+ ...result,
849
+ bytes: result.bytes instanceof Uint8Array ? result.bytes : Uint8Array.from(result.bytes)
850
+ };
851
+ }
852
+ function normalizeKernelMutationResult(result) {
853
+ const exportedBytes = result.exportedBytes
854
+ ? result.exportedBytes instanceof Uint8Array
855
+ ? result.exportedBytes
856
+ : Uint8Array.from(result.exportedBytes)
857
+ : undefined;
858
+ return {
859
+ ...result,
860
+ exportedBytes
861
+ };
862
+ }