@beyondwork/xlsx-substrate-bindings 0.1.0 → 0.3.1
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.
- package/README.md +189 -0
- package/assets/blank-workbook.xlsx +0 -0
- package/dist/ai/agent-metadata.d.ts +387 -0
- package/dist/ai/agent-metadata.js +227 -0
- package/dist/ai/index.d.ts +5 -1
- package/dist/ai/index.js +6 -0
- package/dist/ai/mutation-bridge.d.ts +82 -0
- package/dist/ai/mutation-bridge.js +179 -0
- package/dist/ai/types.d.ts +468 -3
- package/dist/blank-workbook/index.d.ts +24 -0
- package/dist/blank-workbook/index.js +77 -0
- package/dist/index.d.ts +8 -3
- package/dist/index.js +20 -2
- package/dist/runtime/index.d.ts +1 -1
- package/dist/runtime/types.d.ts +108 -18
- package/dist/wasm/ai-session-bridge.d.ts +97 -0
- package/dist/wasm/ai-session-bridge.js +154 -0
- package/dist/wasm/bridge-contract.d.ts +108 -6
- package/dist/wasm/bridge-contract.js +146 -7
- package/dist/wasm/index.d.ts +43 -2
- package/dist/wasm/index.js +253 -23
- package/dist/wasm/memory-budget.d.ts +77 -0
- package/dist/wasm/memory-budget.js +532 -0
- package/dist/wasm/runtime-guard.d.ts +141 -0
- package/dist/wasm/runtime-guard.js +373 -0
- package/dist/wasm/session-router.d.ts +1 -1
- package/dist/wasm/session-router.js +4 -1
- package/dist/wasm/web.d.ts +18 -3
- package/dist/wasm/web.js +99 -9
- package/generated/wasm-web/xlsx_substrate_wasm.d.ts +66 -0
- package/generated/wasm-web/xlsx_substrate_wasm.js +2488 -2104
- package/generated/wasm-web/xlsx_substrate_wasm_bg.wasm +0 -0
- package/generated/wasm-web/xlsx_substrate_wasm_bg.wasm.d.ts +15 -0
- package/package.json +24 -4
- package/dist/wasm/chart-test-fixture.d.ts +0 -19
- package/dist/wasm/chart-test-fixture.js +0 -42
- package/dist/wasm/media-test-fixture.d.ts +0 -44
- package/dist/wasm/media-test-fixture.js +0 -160
- package/dist/wasm/volatile-test-fixture.d.ts +0 -7
- package/dist/wasm/volatile-test-fixture.js +0 -35
- package/generated/wasm/package.json +0 -3
- package/generated/wasm/sheet-window-binary.mjs +0 -482
- package/generated/wasm/snippets/ironcalc_base-89b4f49381e1e289/inline0.js +0 -45
- package/generated/wasm/xlsx_substrate_wasm.d.ts +0 -336
- package/generated/wasm/xlsx_substrate_wasm.js +0 -2108
- package/generated/wasm/xlsx_substrate_wasm_bg.wasm +0 -0
- package/generated/wasm/xlsx_substrate_wasm_bg.wasm.d.ts +0 -105
|
@@ -1,13 +1,17 @@
|
|
|
1
|
+
import { type RawXlsxAiSessionModule, type XlsxAiSessionBridgeMethods } from "./ai-session-bridge.ts";
|
|
1
2
|
import type { XlsxAiCompressedContextRequest, XlsxAiCompressedContextResult, XlsxAiCompressedDrilldownRequest, XlsxAiCompressedDrilldownResult, XlsxAiFormulaExplanationResult, XlsxAiReferenceQuery, XlsxAiReferenceResolution, XlsxAiScopeListRequest, XlsxAiScopeListResult, XlsxAiWorkbookInspection } from "../ai/index.ts";
|
|
2
|
-
import type { XlsxFormulaCommitRequest, XlsxFormulaCommitResult, XlsxFormulaRecalculateRequest, XlsxFormulaRecalculateResult, XlsxLayoutMetricResizeRequest, XlsxLayoutMetricResizeResult, XlsxLayoutMetricVisibilityRequest, XlsxLayoutMetricVisibilityResult, XlsxFrozenPaneRequest, XlsxFrozenPaneResult, XlsxMergeCellsRequest, XlsxMergeCellsResult, XlsxOutlineGroupVisibilityResult, XlsxOutlineLevelRequest, XlsxOutlineLevelResult, XlsxSheetStructureMutationRequest, XlsxSheetStructureMutationResult, XlsxSheetTabMutationRequest, XlsxSheetTabMutationResult, XlsxShiftCellsCommitRequest, XlsxShiftCellsCommitResult, XlsxRangeFilterApplyRequest, XlsxRangeFilterClearRequest, XlsxRangeFilterResult, XlsxRangeSortRequest, XlsxRangeSortResult, XlsxTableAppendRowRequest, XlsxTableAppendRowResult, XlsxKernelActionRequest, XlsxKernelActionValidation, XlsxKernelCreateRequest, XlsxKernelMutationResult, XlsxKernelPanelReadback, XlsxRangeClearCommitRequest, XlsxRangeClearCommitResult, XlsxRangeFormatCommitRequest, XlsxRangeDataValidationCommitRequest, XlsxRangeDataValidationCommitResult, XlsxReviewCommentCommitRequest, XlsxReviewCommentCommitResult, XlsxFindRequest, XlsxFindResult, XlsxGoToRequest, XlsxGoToResult, XlsxDataRegionRequest, XlsxDataRegionResult, XlsxRangeHyperlinkCommitRequest, XlsxRangeHyperlinkCommitResult, XlsxRangeFormatCommitResult, XlsxRangeFillCommitRequest, XlsxRangeFillCommitResult, XlsxRangePasteCommitRequest, XlsxRangePasteCommitResult, XlsxRangeTransferCommitRequest, XlsxRangeTransferCommitResult, XlsxRuntimeSessionDelimitedExportRequest, XlsxRuntimeSessionDelimitedExportResult, XlsxRuntimeSessionExportRequest, XlsxRuntimeSessionExportResult, XlsxSelectionSetClearCommitRequest, XlsxSelectionSetFormatCommitRequest, XlsxSelectionSetPasteCommitRequest, XlsxSessionRecalculateRequest, XlsxWorkflowContextInput } from "../runtime/index.ts";
|
|
3
|
+
import type { XlsxFormulaCommitRequest, XlsxFormulaCommitResult, XlsxFormulaRecalculateRequest, XlsxFormulaRecalculateResult, XlsxLayoutMetricResizeRequest, XlsxLayoutMetricResizeResult, XlsxLayoutMetricVisibilityRequest, XlsxLayoutMetricVisibilityResult, XlsxFrozenPaneRequest, XlsxFrozenPaneResult, XlsxMergeCellsRequest, XlsxMergeCellsResult, XlsxOutlineGroupVisibilityResult, XlsxOutlineLevelRequest, XlsxOutlineLevelResult, XlsxSheetStructureMutationRequest, XlsxSheetStructureMutationResult, XlsxSheetTabMutationRequest, XlsxSheetTabMutationResult, XlsxDefinedNameMutationRequest, XlsxDefinedNameMutationResult, XlsxShiftCellsCommitRequest, XlsxShiftCellsCommitResult, XlsxRangeFilterApplyRequest, XlsxRangeFilterClearRequest, XlsxRangeFilterResult, XlsxRangeSortRequest, XlsxRangeSortResult, XlsxTableAppendRowRequest, XlsxTableAppendRowResult, XlsxKernelActionRequest, XlsxKernelActionValidation, XlsxKernelCreateRequest, XlsxKernelMutationResult, XlsxKernelPanelReadback, XlsxRangeClearCommitRequest, XlsxRangeClearCommitResult, XlsxRangeFormatCommitRequest, XlsxRangeDataValidationCommitRequest, XlsxRangeDataValidationCommitResult, XlsxReviewCommentCommitRequest, XlsxReviewCommentCommitResult, XlsxFindRequest, XlsxFindResult, XlsxGoToRequest, XlsxGoToResult, XlsxDataRegionRequest, XlsxDataRegionResult, XlsxRangeHyperlinkCommitRequest, XlsxRangeHyperlinkCommitResult, XlsxRangeFormatCommitResult, XlsxRangeFillCommitRequest, XlsxRangeFillCommitResult, XlsxRangePasteCommitRequest, XlsxRangePasteCommitResult, XlsxRangeTransferCommitRequest, XlsxRangeTransferCommitResult, XlsxRuntimeSessionDelimitedExportRequest, XlsxRuntimeSessionDelimitedExportResult, XlsxRuntimeSessionExportRequest, XlsxRuntimeSessionExportResult, XlsxSelectionSetClearCommitRequest, XlsxSelectionSetFormatCommitRequest, XlsxSelectionSetPasteCommitRequest, XlsxSessionRecalculateRequest, XlsxWorkflowContextInput } from "../runtime/index.ts";
|
|
3
4
|
import type { XlsxScopeHandle } from "../shared.ts";
|
|
5
|
+
import { type XlsxWasmMemoryReadback, type XlsxWasmRuntime } from "./runtime-guard.ts";
|
|
4
6
|
import { type XlsxSheetWindowBinaryEnvelope } from "./sheet-window-binary.ts";
|
|
5
7
|
import type { XlsxUiAccessibilitySummary, XlsxUiOverlayLanesReadback, XlsxUiOverlayLanesRequest, XlsxUiSelectionCursor, XlsxUiSelectionReadback, XlsxUiSelectionSetReadback, XlsxUiSheetWindowReadback, XlsxUiSessionBinding, XlsxUiStateClass, XlsxUiStateNamespace, XlsxUiViewportHint, XlsxUiViewportReadback } from "../ui/index.ts";
|
|
8
|
+
export { createXlsxWasmRuntime, deserializeXlsxWasmBridgeError, isXlsxWasmBridgeError, serializeXlsxWasmBridgeError, XlsxWasmBridgeError, type SerializedXlsxWasmBridgeError, type XlsxWasmAdmissionOptions, type XlsxWasmBridgeErrorCode, type XlsxWasmBridgeErrorDetails, type XlsxWasmInstanceSource, type XlsxWasmMemoryReadback, type XlsxWasmReinstantiate, type XlsxWasmRuntime, type XlsxWasmRuntimeOptions } from "./runtime-guard.ts";
|
|
9
|
+
export { estimateXlsxPackageMemory, readWasmMemoryLimits, XLSX_WASM_LINEAR_MEMORY_MAXIMUM_BYTES, type XlsxPackageMemoryEstimate, type XlsxWasmMemoryLimits } from "./memory-budget.ts";
|
|
6
10
|
export interface XlsxWasmBridgeStatus {
|
|
7
11
|
readonly packageName: "@beyondwork/xlsx-substrate-bindings";
|
|
8
12
|
readonly role: "wasm-ai-ui-runtime-binding";
|
|
9
|
-
readonly bridgeVersion: "xlsx-wasm-bridge-
|
|
10
|
-
readonly capabilities: readonly ("workflow-context-v1" | "workflow-context-v2" | "workflow-overlay-lanes-v1" | "sheet-window-paint-geometry-v1" | "sheet-window-coordinate-posture-v1" | "formula-diagnostics-v2" | "formula-address-commit-v1" | "formula-recalculate-commit-v1" | "formula-recalculate-volatile-inputs-v1" | "formula-translation-interaction-v1" | "kernel-ui-v1" | "runtime-session-handles-v1" | "runtime-session-mutations-v1" | "staged-open-v1" | "sheet-window-cache-v1" | "readback-envelope-v1" | "preserve-only-entities-v1" | "selection-set-v1" | "multi-area-mutation-v1" | "range-fill-commit-v1" | "range-paste-commit-v1" | "range-clear-commit-v1" | "range-format-commit-v1" | "range-transfer-v1" | "layout-metric-resize-v1" | "layout-metric-visibility-v1" | "outline-group-visibility-v1" | "sheet-structure-v1" | "sheet-tabs-v1" | "table-mutation-v1" | "filter-sort-v1" | "sort-commit-v1" | "operation-pattern-hints-v1" | "ai-compressed-bundles-v1" | "ui-capability-records-v1" | "drawing-media-v1" | "drawing-chart-v1" | "sheet-window-binary-v1" | "frozen-pane-v1" | "sheet-window-extent-v1" | "selection-cursor-v1" | "merge-cells-v1" | "shift-cells-v1" | "selection-set-capabilities-v1" | "find-v1" | "go-to-v1" | "data-region-v1")[];
|
|
13
|
+
readonly bridgeVersion: "xlsx-wasm-bridge-v49";
|
|
14
|
+
readonly capabilities: readonly ("workflow-context-v1" | "workflow-context-v2" | "workflow-overlay-lanes-v1" | "sheet-window-paint-geometry-v1" | "sheet-window-coordinate-posture-v1" | "formula-diagnostics-v2" | "formula-address-commit-v1" | "formula-recalculate-commit-v1" | "formula-recalculate-volatile-inputs-v1" | "formula-translation-interaction-v1" | "kernel-ui-v1" | "runtime-session-handles-v1" | "runtime-session-mutations-v1" | "staged-open-v1" | "sheet-window-cache-v1" | "readback-envelope-v1" | "preserve-only-entities-v1" | "selection-set-v1" | "multi-area-mutation-v1" | "range-fill-commit-v1" | "range-paste-commit-v1" | "range-clear-commit-v1" | "range-format-commit-v1" | "range-transfer-v1" | "layout-metric-resize-v1" | "layout-metric-visibility-v1" | "outline-group-visibility-v1" | "sheet-structure-v1" | "sheet-tabs-v1" | "table-mutation-v1" | "filter-sort-v1" | "sort-commit-v1" | "operation-pattern-hints-v1" | "ai-compressed-bundles-v1" | "ui-capability-records-v1" | "drawing-media-v1" | "drawing-chart-v1" | "sheet-window-binary-v1" | "frozen-pane-v1" | "sheet-window-extent-v1" | "selection-cursor-v1" | "merge-cells-v1" | "shift-cells-v1" | "selection-set-capabilities-v1" | "find-v1" | "go-to-v1" | "data-region-v1" | "ai-session-agent-v1" | "defined-names-v1")[];
|
|
11
15
|
readonly wasmBinding: "mounted";
|
|
12
16
|
readonly nativeBinding: "not-mounted";
|
|
13
17
|
readonly readOnly: false;
|
|
@@ -47,8 +51,20 @@ export interface XlsxSelectionSetRequest {
|
|
|
47
51
|
readonly activeScopeId?: string;
|
|
48
52
|
readonly anchorScopeId?: string;
|
|
49
53
|
}
|
|
50
|
-
export interface XlsxWasmBridge {
|
|
54
|
+
export interface XlsxWasmBridge extends XlsxAiSessionBridgeMethods {
|
|
51
55
|
readonly status: XlsxWasmBridgeStatus;
|
|
56
|
+
/**
|
|
57
|
+
* R4: the live instance's linear memory in bytes (`memory.buffer.byteLength`,
|
|
58
|
+
* read on the JS side; no wasm call). Undefined when the loader could not
|
|
59
|
+
* see the instance's memory.
|
|
60
|
+
*/
|
|
61
|
+
wasmMemoryBytes(): number | undefined;
|
|
62
|
+
/**
|
|
63
|
+
* R4: set the high-water mark (with `bytes`) and read the memory posture.
|
|
64
|
+
* Linear memory never shrinks, so `aboveHighWater` stays true until the
|
|
65
|
+
* instance is replaced: the host's cue to recycle its worker.
|
|
66
|
+
*/
|
|
67
|
+
highWater(bytes?: number): XlsxWasmMemoryReadback;
|
|
52
68
|
openWorkbookRuntimeSession(bytes: Uint8Array, request?: XlsxRuntimeSessionOpenRequest): XlsxRuntimeSessionHandle;
|
|
53
69
|
disposeWorkbookRuntimeSession(handleId: string): XlsxRuntimeSessionDisposeResult;
|
|
54
70
|
inspectWorkbookRuntimeSession(handleId: string): XlsxAiWorkbookInspection;
|
|
@@ -190,6 +206,40 @@ export interface XlsxWasmBridge {
|
|
|
190
206
|
mutateSheetTabsInSession?(handleId: string, request: XlsxSheetTabMutationRequest): XlsxSheetTabMutationResult;
|
|
191
207
|
commitTableAppendRowInSession?(handleId: string, request: XlsxTableAppendRowRequest): XlsxTableAppendRowResult;
|
|
192
208
|
commitShiftCellsInSession?(handleId: string, request: XlsxShiftCellsCommitRequest): XlsxShiftCellsCommitResult;
|
|
209
|
+
/**
|
|
210
|
+
* UX-P-102 phase P2a (bridge v42): the six families that had only a bytes
|
|
211
|
+
* export now commit on the resident session too — selection-set paste /
|
|
212
|
+
* clear / format, hyperlink, data validation and review comment. Same
|
|
213
|
+
* request DTOs as their bytes exports; same results minus `exportedBytes`
|
|
214
|
+
* plus the `session` receipt.
|
|
215
|
+
*/
|
|
216
|
+
commitSelectionSetPasteInSession?(handleId: string, request: XlsxSelectionSetPasteCommitRequest): XlsxRangePasteCommitResult;
|
|
217
|
+
commitSelectionSetClearInSession?(handleId: string, request: XlsxSelectionSetClearCommitRequest): XlsxRangeClearCommitResult;
|
|
218
|
+
commitSelectionSetFormatInSession?(handleId: string, request: XlsxSelectionSetFormatCommitRequest): XlsxRangeFormatCommitResult;
|
|
219
|
+
commitRangeHyperlinkInSession?(handleId: string, request: XlsxRangeHyperlinkCommitRequest): XlsxRangeHyperlinkCommitResult;
|
|
220
|
+
commitRangeDataValidationInSession?(handleId: string, request: XlsxRangeDataValidationCommitRequest): XlsxRangeDataValidationCommitResult;
|
|
221
|
+
commitReviewCommentInSession?(handleId: string, request: XlsxReviewCommentCommitRequest): XlsxReviewCommentCommitResult;
|
|
222
|
+
/**
|
|
223
|
+
* UX-P-102 phase P2b (bridge v43): the last six bytes-only families commit
|
|
224
|
+
* on the resident session too — filter apply / clear, sort, row / column
|
|
225
|
+
* outline-group visibility and outline level. Same request DTOs as their
|
|
226
|
+
* bytes exports; same results minus `exportedBytes` plus the `session`
|
|
227
|
+
* receipt.
|
|
228
|
+
*/
|
|
229
|
+
commitApplyFilterInSession?(handleId: string, request: XlsxRangeFilterApplyRequest): XlsxRangeFilterResult;
|
|
230
|
+
commitClearFilterInSession?(handleId: string, request: XlsxRangeFilterClearRequest): XlsxRangeFilterResult;
|
|
231
|
+
commitApplySortInSession?(handleId: string, request: XlsxRangeSortRequest): XlsxRangeSortResult;
|
|
232
|
+
setRowOutlineGroupHiddenInSession?(handleId: string, request: XlsxLayoutMetricVisibilityRequest): XlsxOutlineGroupVisibilityResult;
|
|
233
|
+
setColumnOutlineGroupHiddenInSession?(handleId: string, request: XlsxLayoutMetricVisibilityRequest): XlsxOutlineGroupVisibilityResult;
|
|
234
|
+
setSheetOutlineLevelInSession?(handleId: string, request: XlsxOutlineLevelRequest): XlsxOutlineLevelResult;
|
|
235
|
+
/**
|
|
236
|
+
* X5-U-023 (bridge v44): Name Manager authoring on the resident session —
|
|
237
|
+
* create, edit or delete one workbook- or sheet-scoped defined name. Same
|
|
238
|
+
* request DTO as `defineName`; same result minus `exportedBytes` plus the
|
|
239
|
+
* `session` receipt. The commit drops the keep-alive graph, so the drain
|
|
240
|
+
* recalculates every reader in full.
|
|
241
|
+
*/
|
|
242
|
+
defineNameInSession?(handleId: string, request: XlsxDefinedNameMutationRequest): XlsxDefinedNameMutationResult;
|
|
193
243
|
commitRangeFill(bytes: Uint8Array, request: XlsxRangeFillCommitRequest): XlsxRangeFillCommitResult;
|
|
194
244
|
commitRangePaste(bytes: Uint8Array, request: XlsxRangePasteCommitRequest): XlsxRangePasteCommitResult;
|
|
195
245
|
commitRangeTransfer(bytes: Uint8Array, request: XlsxRangeTransferCommitRequest): XlsxRangeTransferCommitResult;
|
|
@@ -227,6 +277,8 @@ export interface XlsxWasmBridge {
|
|
|
227
277
|
commitClearFilter(bytes: Uint8Array, request: XlsxRangeFilterClearRequest): XlsxRangeFilterResult;
|
|
228
278
|
commitApplySort(bytes: Uint8Array, request: XlsxRangeSortRequest): XlsxRangeSortResult;
|
|
229
279
|
mutateSheetTabs(bytes: Uint8Array, request: XlsxSheetTabMutationRequest): XlsxSheetTabMutationResult;
|
|
280
|
+
/** X5-U-023 (bridge v44): create, edit or delete one defined name, then export (defined-names-v1). */
|
|
281
|
+
defineName(bytes: Uint8Array, request: XlsxDefinedNameMutationRequest): XlsxDefinedNameMutationResult;
|
|
230
282
|
/** X5-U-006 insert/delete cells with shift (shift-cells-v1). */
|
|
231
283
|
commitShiftCells(bytes: Uint8Array, request: XlsxShiftCellsCommitRequest): XlsxShiftCellsCommitResult;
|
|
232
284
|
}
|
|
@@ -258,6 +310,19 @@ export interface XlsxRuntimeSessionMutationBridge extends XlsxWasmBridge {
|
|
|
258
310
|
mutateSheetTabsInSession(handleId: string, request: XlsxSheetTabMutationRequest): XlsxSheetTabMutationResult;
|
|
259
311
|
commitTableAppendRowInSession(handleId: string, request: XlsxTableAppendRowRequest): XlsxTableAppendRowResult;
|
|
260
312
|
commitShiftCellsInSession(handleId: string, request: XlsxShiftCellsCommitRequest): XlsxShiftCellsCommitResult;
|
|
313
|
+
commitSelectionSetPasteInSession(handleId: string, request: XlsxSelectionSetPasteCommitRequest): XlsxRangePasteCommitResult;
|
|
314
|
+
commitSelectionSetClearInSession(handleId: string, request: XlsxSelectionSetClearCommitRequest): XlsxRangeClearCommitResult;
|
|
315
|
+
commitSelectionSetFormatInSession(handleId: string, request: XlsxSelectionSetFormatCommitRequest): XlsxRangeFormatCommitResult;
|
|
316
|
+
commitRangeHyperlinkInSession(handleId: string, request: XlsxRangeHyperlinkCommitRequest): XlsxRangeHyperlinkCommitResult;
|
|
317
|
+
commitRangeDataValidationInSession(handleId: string, request: XlsxRangeDataValidationCommitRequest): XlsxRangeDataValidationCommitResult;
|
|
318
|
+
commitReviewCommentInSession(handleId: string, request: XlsxReviewCommentCommitRequest): XlsxReviewCommentCommitResult;
|
|
319
|
+
commitApplyFilterInSession(handleId: string, request: XlsxRangeFilterApplyRequest): XlsxRangeFilterResult;
|
|
320
|
+
commitClearFilterInSession(handleId: string, request: XlsxRangeFilterClearRequest): XlsxRangeFilterResult;
|
|
321
|
+
commitApplySortInSession(handleId: string, request: XlsxRangeSortRequest): XlsxRangeSortResult;
|
|
322
|
+
setRowOutlineGroupHiddenInSession(handleId: string, request: XlsxLayoutMetricVisibilityRequest): XlsxOutlineGroupVisibilityResult;
|
|
323
|
+
setColumnOutlineGroupHiddenInSession(handleId: string, request: XlsxLayoutMetricVisibilityRequest): XlsxOutlineGroupVisibilityResult;
|
|
324
|
+
setSheetOutlineLevelInSession(handleId: string, request: XlsxOutlineLevelRequest): XlsxOutlineLevelResult;
|
|
325
|
+
defineNameInSession(handleId: string, request: XlsxDefinedNameMutationRequest): XlsxDefinedNameMutationResult;
|
|
261
326
|
}
|
|
262
327
|
/**
|
|
263
328
|
* T1 feature detection: true when the mounted wasm build advertises
|
|
@@ -273,7 +338,7 @@ export interface XlsxRuntimeSessionMutationBridge extends XlsxWasmBridge {
|
|
|
273
338
|
*/
|
|
274
339
|
export declare function missingXlsxWasmCapabilities(bridge: XlsxWasmBridge, required: readonly string[]): string[];
|
|
275
340
|
export declare function supportsRuntimeSessionMutations(bridge: XlsxWasmBridge): bridge is XlsxRuntimeSessionMutationBridge;
|
|
276
|
-
export interface RawXlsxWasmModule {
|
|
341
|
+
export interface RawXlsxWasmModule extends RawXlsxAiSessionModule {
|
|
277
342
|
getWasmStatus(): XlsxWasmBridgeStatus;
|
|
278
343
|
openWorkbookRuntimeSession(bytes: Uint8Array, request?: XlsxRuntimeSessionOpenRequest): XlsxRuntimeSessionHandle;
|
|
279
344
|
disposeWorkbookRuntimeSession(handleId: string): XlsxRuntimeSessionDisposeResult;
|
|
@@ -365,6 +430,19 @@ export interface RawXlsxWasmModule {
|
|
|
365
430
|
mutateSheetTabsInSession?(handleId: string, request: XlsxSheetTabMutationRequest): RawXlsxSheetTabMutationResult;
|
|
366
431
|
commitTableAppendRowInSession?(handleId: string, request: XlsxTableAppendRowRequest): RawXlsxTableAppendRowResult;
|
|
367
432
|
commitShiftCellsInSession?(handleId: string, request: XlsxShiftCellsCommitRequest): RawXlsxShiftCellsCommitResult;
|
|
433
|
+
commitSelectionSetPasteInSession?(handleId: string, request: XlsxSelectionSetPasteCommitRequest): RawXlsxRangePasteCommitResult;
|
|
434
|
+
commitSelectionSetClearInSession?(handleId: string, request: XlsxSelectionSetClearCommitRequest): RawXlsxRangeClearCommitResult;
|
|
435
|
+
commitSelectionSetFormatInSession?(handleId: string, request: XlsxSelectionSetFormatCommitRequest): RawXlsxRangeFormatCommitResult;
|
|
436
|
+
commitRangeHyperlinkInSession?(handleId: string, request: XlsxRangeHyperlinkCommitRequest): RawXlsxRangeHyperlinkCommitResult;
|
|
437
|
+
commitRangeDataValidationInSession?(handleId: string, request: XlsxRangeDataValidationCommitRequest): RawXlsxRangeDataValidationCommitResult;
|
|
438
|
+
commitReviewCommentInSession?(handleId: string, request: XlsxReviewCommentCommitRequest): RawXlsxReviewCommentCommitResult;
|
|
439
|
+
commitApplyFilterInSession?(handleId: string, request: XlsxRangeFilterApplyRequest): RawXlsxRangeFilterResult;
|
|
440
|
+
commitClearFilterInSession?(handleId: string, request: XlsxRangeFilterClearRequest): RawXlsxRangeFilterResult;
|
|
441
|
+
commitApplySortInSession?(handleId: string, request: XlsxRangeSortRequest): RawXlsxRangeSortResult;
|
|
442
|
+
setRowOutlineGroupHiddenInSession?(handleId: string, request: XlsxLayoutMetricVisibilityRequest): RawXlsxOutlineGroupVisibilityResult;
|
|
443
|
+
setColumnOutlineGroupHiddenInSession?(handleId: string, request: XlsxLayoutMetricVisibilityRequest): RawXlsxOutlineGroupVisibilityResult;
|
|
444
|
+
setSheetOutlineLevelInSession?(handleId: string, request: XlsxOutlineLevelRequest): RawXlsxOutlineLevelResult;
|
|
445
|
+
defineNameInSession?(handleId: string, request: XlsxDefinedNameMutationRequest): RawXlsxDefinedNameMutationResult;
|
|
368
446
|
commitRangeFill(bytes: Uint8Array, request: XlsxRangeFillCommitRequest): RawXlsxRangeFillCommitResult;
|
|
369
447
|
commitRangePaste(bytes: Uint8Array, request: XlsxRangePasteCommitRequest): RawXlsxRangePasteCommitResult;
|
|
370
448
|
commitRangeTransfer(bytes: Uint8Array, request: XlsxRangeTransferCommitRequest): RawXlsxRangeTransferCommitResult;
|
|
@@ -391,6 +469,7 @@ export interface RawXlsxWasmModule {
|
|
|
391
469
|
commitClearFilter(bytes: Uint8Array, request: XlsxRangeFilterClearRequest): RawXlsxRangeFilterResult;
|
|
392
470
|
commitApplySort(bytes: Uint8Array, request: XlsxRangeSortRequest): RawXlsxRangeSortResult;
|
|
393
471
|
mutateSheetTabs(bytes: Uint8Array, request: XlsxSheetTabMutationRequest): RawXlsxSheetTabMutationResult;
|
|
472
|
+
defineName(bytes: Uint8Array, request: XlsxDefinedNameMutationRequest): RawXlsxDefinedNameMutationResult;
|
|
394
473
|
commitShiftCells(bytes: Uint8Array, request: XlsxShiftCellsCommitRequest): RawXlsxShiftCellsCommitResult;
|
|
395
474
|
}
|
|
396
475
|
type RawXlsxFormulaCommitResult = Omit<XlsxFormulaCommitResult, "exportedBytes"> & {
|
|
@@ -456,6 +535,9 @@ type RawXlsxRangeSortResult = Omit<XlsxRangeSortResult, "exportedBytes"> & {
|
|
|
456
535
|
type RawXlsxSheetTabMutationResult = Omit<XlsxSheetTabMutationResult, "exportedBytes"> & {
|
|
457
536
|
readonly exportedBytes?: Uint8Array | readonly number[];
|
|
458
537
|
};
|
|
538
|
+
type RawXlsxDefinedNameMutationResult = Omit<XlsxDefinedNameMutationResult, "exportedBytes"> & {
|
|
539
|
+
readonly exportedBytes?: Uint8Array | readonly number[];
|
|
540
|
+
};
|
|
459
541
|
type RawXlsxShiftCellsCommitResult = Omit<XlsxShiftCellsCommitResult, "exportedBytes"> & {
|
|
460
542
|
readonly exportedBytes?: Uint8Array | readonly number[];
|
|
461
543
|
};
|
|
@@ -515,6 +597,19 @@ export interface XlsxPreserveOnlyEntitiesReadback {
|
|
|
515
597
|
readonly entityCount: number;
|
|
516
598
|
readonly entities: readonly XlsxPreserveOnlyEntityReadback[];
|
|
517
599
|
}
|
|
600
|
+
/**
|
|
601
|
+
* R5: the bridge version this package mounts. A host reports it with
|
|
602
|
+
* `generatedWasmModuleSha256()`; the package version policy (README, the
|
|
603
|
+
* package.json `conductor` field) moves the MINOR version whenever the
|
|
604
|
+
* published value of this constant changes.
|
|
605
|
+
*/
|
|
606
|
+
export declare const BRIDGE_VERSION: XlsxWasmBridgeStatus["bridgeVersion"];
|
|
607
|
+
/**
|
|
608
|
+
* R5: the capabilities every mounted bridge advertises (the mount gate's
|
|
609
|
+
* list). Hosts gate on the capabilities they call; see
|
|
610
|
+
* `missingXlsxWasmCapabilities`.
|
|
611
|
+
*/
|
|
612
|
+
export declare const BRIDGE_CAPABILITIES: readonly string[];
|
|
518
613
|
/**
|
|
519
614
|
* Result of validating a raw wasm module object against the bridge
|
|
520
615
|
* contract. `reason` is the soft not-mounted loader reason;
|
|
@@ -538,4 +633,11 @@ export type XlsxRawWasmModuleValidation = {
|
|
|
538
633
|
* never mount divergent contracts.
|
|
539
634
|
*/
|
|
540
635
|
export declare function validateRawXlsxWasmModule(raw: RawXlsxWasmModule): XlsxRawWasmModuleValidation;
|
|
541
|
-
|
|
636
|
+
/**
|
|
637
|
+
* Wrap a raw wasm module object in the typed bridge. Every call goes through
|
|
638
|
+
* `runtime` (R4): pre-admission against the memory budget before open and
|
|
639
|
+
* recalculate, and trap containment at the call boundary. Without a runtime
|
|
640
|
+
* the bridge builds one over `source` that can contain a trap but has no
|
|
641
|
+
* Module to re-instantiate from (the loaders always pass one that can).
|
|
642
|
+
*/
|
|
643
|
+
export declare function createXlsxWasmBridge(source: RawXlsxWasmModule, status?: XlsxWasmBridgeStatus, runtime?: XlsxWasmRuntime): XlsxWasmBridge;
|
|
@@ -6,7 +6,12 @@
|
|
|
6
6
|
// on artifact-less checkouts. Loader shells own artifact resolution and
|
|
7
7
|
// instantiation; everything after a raw module object exists (validation,
|
|
8
8
|
// wrapping, normalization) lives here.
|
|
9
|
+
import { AI_SESSION_AGENT_CAPABILITY, AI_SESSION_RAW_METHODS, attachAiSessionMethods } from "./ai-session-bridge.js";
|
|
10
|
+
import { createXlsxWasmRuntime } from "./runtime-guard.js";
|
|
9
11
|
import { createSheetWindowDecodedReader } from "./sheet-window-binary.js";
|
|
12
|
+
// R4 (runtime 0.2.0): the memory contract and the typed bridge errors.
|
|
13
|
+
export { createXlsxWasmRuntime, deserializeXlsxWasmBridgeError, isXlsxWasmBridgeError, serializeXlsxWasmBridgeError, XlsxWasmBridgeError } from "./runtime-guard.js";
|
|
14
|
+
export { estimateXlsxPackageMemory, readWasmMemoryLimits, XLSX_WASM_LINEAR_MEMORY_MAXIMUM_BYTES } from "./memory-budget.js";
|
|
10
15
|
/** Every runtime-session-mutations-v1 method name, used by feature detection. */
|
|
11
16
|
const RUNTIME_SESSION_MUTATION_METHODS = [
|
|
12
17
|
"commitCellFormulaInSession",
|
|
@@ -26,7 +31,23 @@ const RUNTIME_SESSION_MUTATION_METHODS = [
|
|
|
26
31
|
"mutateSheetStructureInSession",
|
|
27
32
|
"mutateSheetTabsInSession",
|
|
28
33
|
"commitTableAppendRowInSession",
|
|
29
|
-
"commitShiftCellsInSession"
|
|
34
|
+
"commitShiftCellsInSession",
|
|
35
|
+
// UX-P-102 P2a (v42).
|
|
36
|
+
"commitSelectionSetPasteInSession",
|
|
37
|
+
"commitSelectionSetClearInSession",
|
|
38
|
+
"commitSelectionSetFormatInSession",
|
|
39
|
+
"commitRangeHyperlinkInSession",
|
|
40
|
+
"commitRangeDataValidationInSession",
|
|
41
|
+
"commitReviewCommentInSession",
|
|
42
|
+
// UX-P-102 P2b (v43).
|
|
43
|
+
"commitApplyFilterInSession",
|
|
44
|
+
"commitClearFilterInSession",
|
|
45
|
+
"commitApplySortInSession",
|
|
46
|
+
"setRowOutlineGroupHiddenInSession",
|
|
47
|
+
"setColumnOutlineGroupHiddenInSession",
|
|
48
|
+
"setSheetOutlineLevelInSession",
|
|
49
|
+
// X5-U-023 (v44).
|
|
50
|
+
"defineNameInSession"
|
|
30
51
|
];
|
|
31
52
|
/**
|
|
32
53
|
* T1 feature detection: true when the mounted wasm build advertises
|
|
@@ -49,7 +70,7 @@ export function supportsRuntimeSessionMutations(bridge) {
|
|
|
49
70
|
RUNTIME_SESSION_MUTATION_METHODS.every((method) => typeof bridge[method] === "function"));
|
|
50
71
|
}
|
|
51
72
|
export { createSheetWindowDecodedReader, decodeSheetWindowBinary, SHEET_WINDOW_BINARY_SCHEMA_ID } from "./sheet-window-binary.js";
|
|
52
|
-
const requiredBridgeVersion = "xlsx-wasm-bridge-
|
|
73
|
+
const requiredBridgeVersion = "xlsx-wasm-bridge-v49"; // v49: X5-U-023 (go-to answers carry a multi-area target's further areas; v48 was X5-U-089)
|
|
53
74
|
const requiredCapabilities = [
|
|
54
75
|
"workflow-context-v2",
|
|
55
76
|
"workflow-overlay-lanes-v1",
|
|
@@ -117,8 +138,25 @@ const requiredCapabilities = [
|
|
|
117
138
|
// X3-R-012 (bridge v40): `dataRegionInRuntimeSession`. A bridge without it
|
|
118
139
|
// would answer Ctrl+Down with `not a function`, so it fails the mount gate
|
|
119
140
|
// instead.
|
|
120
|
-
"data-region-v1"
|
|
141
|
+
"data-region-v1",
|
|
142
|
+
// XB5: the AI session lane is all-or-nothing per build (Q8). A bridge
|
|
143
|
+
// without it would answer every fenced AI call with `not a function`, so
|
|
144
|
+
// it fails the mount gate instead.
|
|
145
|
+
AI_SESSION_AGENT_CAPABILITY
|
|
121
146
|
];
|
|
147
|
+
/**
|
|
148
|
+
* R5: the bridge version this package mounts. A host reports it with
|
|
149
|
+
* `generatedWasmModuleSha256()`; the package version policy (README, the
|
|
150
|
+
* package.json `conductor` field) moves the MINOR version whenever the
|
|
151
|
+
* published value of this constant changes.
|
|
152
|
+
*/
|
|
153
|
+
export const BRIDGE_VERSION = requiredBridgeVersion;
|
|
154
|
+
/**
|
|
155
|
+
* R5: the capabilities every mounted bridge advertises (the mount gate's
|
|
156
|
+
* list). Hosts gate on the capabilities they call; see
|
|
157
|
+
* `missingXlsxWasmCapabilities`.
|
|
158
|
+
*/
|
|
159
|
+
export const BRIDGE_CAPABILITIES = Object.freeze([...requiredCapabilities]);
|
|
122
160
|
const requiredRawMethods = [
|
|
123
161
|
"getWasmStatus",
|
|
124
162
|
"openWorkbookRuntimeSession",
|
|
@@ -193,7 +231,13 @@ const requiredRawMethods = [
|
|
|
193
231
|
"commitClearFilter",
|
|
194
232
|
"commitApplySort",
|
|
195
233
|
"mutateSheetTabs",
|
|
196
|
-
"commitShiftCells"
|
|
234
|
+
"commitShiftCells",
|
|
235
|
+
// X5-U-023 (bridge v44): defined-name authoring over bytes.
|
|
236
|
+
"defineName",
|
|
237
|
+
// XB5 (§5.5 under Q8's fold): the AI lane's ONE raw export, declared once
|
|
238
|
+
// in ai-session-bridge.ts and spread here so the mount gate and the pool
|
|
239
|
+
// allowlists read one declaration (the nine verbs are its `op` values).
|
|
240
|
+
...AI_SESSION_RAW_METHODS
|
|
197
241
|
];
|
|
198
242
|
/**
|
|
199
243
|
* Target-independent mount gate: role, bridge version, required
|
|
@@ -230,7 +274,16 @@ export function validateRawXlsxWasmModule(raw) {
|
|
|
230
274
|
}
|
|
231
275
|
return { ok: true, status };
|
|
232
276
|
}
|
|
233
|
-
|
|
277
|
+
/**
|
|
278
|
+
* Wrap a raw wasm module object in the typed bridge. Every call goes through
|
|
279
|
+
* `runtime` (R4): pre-admission against the memory budget before open and
|
|
280
|
+
* recalculate, and trap containment at the call boundary. Without a runtime
|
|
281
|
+
* the bridge builds one over `source` that can contain a trap but has no
|
|
282
|
+
* Module to re-instantiate from (the loaders always pass one that can).
|
|
283
|
+
*/
|
|
284
|
+
export function createXlsxWasmBridge(source, status, runtime = createXlsxWasmRuntime({ instance: { raw: source } })) {
|
|
285
|
+
const raw = runtime.raw;
|
|
286
|
+
const bridgeStatus = status ?? raw.getWasmStatus();
|
|
234
287
|
// T1 feature detection: session-mutation exports are optional on the raw
|
|
235
288
|
// wasm module object so older generated builds keep mounting with the
|
|
236
289
|
// byte-based surface only. Capture the raw functions once so the closures
|
|
@@ -253,6 +306,26 @@ export function createXlsxWasmBridge(raw, status = raw.getWasmStatus()) {
|
|
|
253
306
|
const rawMutateSheetTabsInSession = typeof raw.mutateSheetTabsInSession === "function" ? raw.mutateSheetTabsInSession.bind(raw) : undefined;
|
|
254
307
|
const rawCommitTableAppendRowInSession = typeof raw.commitTableAppendRowInSession === "function" ? raw.commitTableAppendRowInSession.bind(raw) : undefined;
|
|
255
308
|
const rawCommitShiftCellsInSession = typeof raw.commitShiftCellsInSession === "function" ? raw.commitShiftCellsInSession.bind(raw) : undefined;
|
|
309
|
+
// UX-P-102 P2a (v42): the six families that had only a bytes export.
|
|
310
|
+
const rawCommitSelectionSetPasteInSession = typeof raw.commitSelectionSetPasteInSession === "function" ? raw.commitSelectionSetPasteInSession.bind(raw) : undefined;
|
|
311
|
+
const rawCommitSelectionSetClearInSession = typeof raw.commitSelectionSetClearInSession === "function" ? raw.commitSelectionSetClearInSession.bind(raw) : undefined;
|
|
312
|
+
const rawCommitSelectionSetFormatInSession = typeof raw.commitSelectionSetFormatInSession === "function" ? raw.commitSelectionSetFormatInSession.bind(raw) : undefined;
|
|
313
|
+
const rawCommitRangeHyperlinkInSession = typeof raw.commitRangeHyperlinkInSession === "function" ? raw.commitRangeHyperlinkInSession.bind(raw) : undefined;
|
|
314
|
+
const rawCommitRangeDataValidationInSession = typeof raw.commitRangeDataValidationInSession === "function"
|
|
315
|
+
? raw.commitRangeDataValidationInSession.bind(raw)
|
|
316
|
+
: undefined;
|
|
317
|
+
const rawCommitReviewCommentInSession = typeof raw.commitReviewCommentInSession === "function" ? raw.commitReviewCommentInSession.bind(raw) : undefined;
|
|
318
|
+
// UX-P-102 P2b (v43): the last six bytes-only families.
|
|
319
|
+
const rawCommitApplyFilterInSession = typeof raw.commitApplyFilterInSession === "function" ? raw.commitApplyFilterInSession.bind(raw) : undefined;
|
|
320
|
+
const rawCommitClearFilterInSession = typeof raw.commitClearFilterInSession === "function" ? raw.commitClearFilterInSession.bind(raw) : undefined;
|
|
321
|
+
const rawCommitApplySortInSession = typeof raw.commitApplySortInSession === "function" ? raw.commitApplySortInSession.bind(raw) : undefined;
|
|
322
|
+
const rawSetRowOutlineGroupHiddenInSession = typeof raw.setRowOutlineGroupHiddenInSession === "function" ? raw.setRowOutlineGroupHiddenInSession.bind(raw) : undefined;
|
|
323
|
+
const rawSetColumnOutlineGroupHiddenInSession = typeof raw.setColumnOutlineGroupHiddenInSession === "function"
|
|
324
|
+
? raw.setColumnOutlineGroupHiddenInSession.bind(raw)
|
|
325
|
+
: undefined;
|
|
326
|
+
const rawSetSheetOutlineLevelInSession = typeof raw.setSheetOutlineLevelInSession === "function" ? raw.setSheetOutlineLevelInSession.bind(raw) : undefined;
|
|
327
|
+
// X5-U-023 (v44): defined-name authoring.
|
|
328
|
+
const rawDefineNameInSession = typeof raw.defineNameInSession === "function" ? raw.defineNameInSession.bind(raw) : undefined;
|
|
256
329
|
// X5-U-012 feature detection: the delimited-text export is optional and
|
|
257
330
|
// independent of the mutation family, so it is attached on its own.
|
|
258
331
|
const rawExportRuntimeSessionDelimitedText = typeof raw.exportRuntimeSessionDelimitedText === "function"
|
|
@@ -280,7 +353,11 @@ export function createXlsxWasmBridge(raw, status = raw.getWasmStatus()) {
|
|
|
280
353
|
rawResizeRowHeightInSession && rawSetColumnHiddenInSession && rawSetRowHiddenInSession &&
|
|
281
354
|
rawSetFrozenPaneInSession && rawMergeCellsInSession &&
|
|
282
355
|
rawMutateSheetStructureInSession && rawMutateSheetTabsInSession && rawCommitTableAppendRowInSession &&
|
|
283
|
-
rawCommitShiftCellsInSession
|
|
356
|
+
rawCommitShiftCellsInSession && rawCommitSelectionSetPasteInSession && rawCommitSelectionSetClearInSession &&
|
|
357
|
+
rawCommitSelectionSetFormatInSession && rawCommitRangeHyperlinkInSession &&
|
|
358
|
+
rawCommitRangeDataValidationInSession && rawCommitReviewCommentInSession && rawCommitApplyFilterInSession &&
|
|
359
|
+
rawCommitClearFilterInSession && rawCommitApplySortInSession && rawSetRowOutlineGroupHiddenInSession &&
|
|
360
|
+
rawSetColumnOutlineGroupHiddenInSession && rawSetSheetOutlineLevelInSession && rawDefineNameInSession
|
|
284
361
|
? {
|
|
285
362
|
commitCellFormulaInSession(handleId, request) {
|
|
286
363
|
return normalizeFormulaCommitResult(rawCommitCellFormulaInSession(handleId, request));
|
|
@@ -335,12 +412,60 @@ export function createXlsxWasmBridge(raw, status = raw.getWasmStatus()) {
|
|
|
335
412
|
},
|
|
336
413
|
commitShiftCellsInSession(handleId, request) {
|
|
337
414
|
return normalizeShiftCellsCommitResult(rawCommitShiftCellsInSession(handleId, request));
|
|
415
|
+
},
|
|
416
|
+
commitSelectionSetPasteInSession(handleId, request) {
|
|
417
|
+
return normalizeRangePasteCommitResult(rawCommitSelectionSetPasteInSession(handleId, request));
|
|
418
|
+
},
|
|
419
|
+
commitSelectionSetClearInSession(handleId, request) {
|
|
420
|
+
return normalizeRangeClearCommitResult(rawCommitSelectionSetClearInSession(handleId, request));
|
|
421
|
+
},
|
|
422
|
+
commitSelectionSetFormatInSession(handleId, request) {
|
|
423
|
+
return normalizeRangeFormatCommitResult(rawCommitSelectionSetFormatInSession(handleId, request));
|
|
424
|
+
},
|
|
425
|
+
commitRangeHyperlinkInSession(handleId, request) {
|
|
426
|
+
return normalizeRangeHyperlinkCommitResult(rawCommitRangeHyperlinkInSession(handleId, request));
|
|
427
|
+
},
|
|
428
|
+
commitRangeDataValidationInSession(handleId, request) {
|
|
429
|
+
return normalizeRangeDataValidationCommitResult(rawCommitRangeDataValidationInSession(handleId, request));
|
|
430
|
+
},
|
|
431
|
+
commitReviewCommentInSession(handleId, request) {
|
|
432
|
+
return normalizeReviewCommentCommitResult(rawCommitReviewCommentInSession(handleId, request));
|
|
433
|
+
},
|
|
434
|
+
commitApplyFilterInSession(handleId, request) {
|
|
435
|
+
return normalizeRangeFilterResult(rawCommitApplyFilterInSession(handleId, request));
|
|
436
|
+
},
|
|
437
|
+
commitClearFilterInSession(handleId, request) {
|
|
438
|
+
return normalizeRangeFilterResult(rawCommitClearFilterInSession(handleId, request));
|
|
439
|
+
},
|
|
440
|
+
commitApplySortInSession(handleId, request) {
|
|
441
|
+
return normalizeRangeSortResult(rawCommitApplySortInSession(handleId, request));
|
|
442
|
+
},
|
|
443
|
+
setRowOutlineGroupHiddenInSession(handleId, request) {
|
|
444
|
+
return normalizeOutlineGroupVisibilityResult(rawSetRowOutlineGroupHiddenInSession(handleId, request));
|
|
445
|
+
},
|
|
446
|
+
setColumnOutlineGroupHiddenInSession(handleId, request) {
|
|
447
|
+
return normalizeOutlineGroupVisibilityResult(rawSetColumnOutlineGroupHiddenInSession(handleId, request));
|
|
448
|
+
},
|
|
449
|
+
setSheetOutlineLevelInSession(handleId, request) {
|
|
450
|
+
return normalizeOutlineLevelResult(rawSetSheetOutlineLevelInSession(handleId, request));
|
|
451
|
+
},
|
|
452
|
+
defineNameInSession(handleId, request) {
|
|
453
|
+
return normalizeDefinedNameMutationResult(rawDefineNameInSession(handleId, request));
|
|
338
454
|
}
|
|
339
455
|
}
|
|
340
456
|
: undefined;
|
|
341
457
|
return {
|
|
342
|
-
status,
|
|
458
|
+
status: bridgeStatus,
|
|
459
|
+
wasmMemoryBytes() {
|
|
460
|
+
return runtime.wasmMemoryBytes();
|
|
461
|
+
},
|
|
462
|
+
highWater(bytes) {
|
|
463
|
+
return runtime.highWater(bytes);
|
|
464
|
+
},
|
|
343
465
|
...(sessionMutationMethods ?? {}),
|
|
466
|
+
// XB5: the eight typed AI methods, each dispatching to the one required
|
|
467
|
+
// raw export `aiSessionCall` with its verb.
|
|
468
|
+
...attachAiSessionMethods(raw),
|
|
344
469
|
openWorkbookRuntimeSession(bytes, request = {}) {
|
|
345
470
|
return raw.openWorkbookRuntimeSession(bytes, request);
|
|
346
471
|
},
|
|
@@ -579,6 +704,9 @@ export function createXlsxWasmBridge(raw, status = raw.getWasmStatus()) {
|
|
|
579
704
|
mutateSheetTabs(bytes, request) {
|
|
580
705
|
return normalizeSheetTabMutationResult(raw.mutateSheetTabs(bytes, request));
|
|
581
706
|
},
|
|
707
|
+
defineName(bytes, request) {
|
|
708
|
+
return normalizeDefinedNameMutationResult(raw.defineName(bytes, request));
|
|
709
|
+
},
|
|
582
710
|
commitShiftCells(bytes, request) {
|
|
583
711
|
return normalizeShiftCellsCommitResult(raw.commitShiftCells(bytes, request));
|
|
584
712
|
}
|
|
@@ -815,6 +943,17 @@ function normalizeRangeSortResult(result) {
|
|
|
815
943
|
exportedBytes
|
|
816
944
|
};
|
|
817
945
|
}
|
|
946
|
+
function normalizeDefinedNameMutationResult(result) {
|
|
947
|
+
const exportedBytes = result.exportedBytes
|
|
948
|
+
? result.exportedBytes instanceof Uint8Array
|
|
949
|
+
? result.exportedBytes
|
|
950
|
+
: Uint8Array.from(result.exportedBytes)
|
|
951
|
+
: undefined;
|
|
952
|
+
return {
|
|
953
|
+
...result,
|
|
954
|
+
exportedBytes
|
|
955
|
+
};
|
|
956
|
+
}
|
|
818
957
|
function normalizeSheetTabMutationResult(result) {
|
|
819
958
|
const exportedBytes = result.exportedBytes
|
|
820
959
|
? result.exportedBytes instanceof Uint8Array
|
package/dist/wasm/index.d.ts
CHANGED
|
@@ -1,6 +1,47 @@
|
|
|
1
|
-
import { type XlsxWasmBridgeLoadResult } from "./bridge-contract.ts";
|
|
1
|
+
import { type XlsxWasmAdmissionOptions, type XlsxWasmBridgeLoadResult } from "./bridge-contract.ts";
|
|
2
2
|
export * from "./bridge-contract.ts";
|
|
3
|
-
export
|
|
3
|
+
export { AI_SESSION_AGENT_CAPABILITY, AI_SESSION_METHODS, AI_SESSION_OPS, AI_SESSION_POOL_METHODS, AI_SESSION_RAW_METHOD, AI_SESSION_RAW_METHODS, aiSessionOpClass, attachAiSessionMethods, isXlsxAiUnknownOpRefusal, XlsxAiUnknownOpRefusalError, type RawXlsxAiSessionModule, type XlsxAiSessionBridgeMethods, type AiSessionCallOp, type AiSessionCommitMethod, type AiSessionMethod, type AiSessionOp } from "./ai-session-bridge.ts";
|
|
4
|
+
/**
|
|
5
|
+
* R3: compile the package's wasm binary once, asynchronously, into a
|
|
6
|
+
* `WebAssembly.Module` a host can share: pass it to `loadXlsxWasmBridge`
|
|
7
|
+
* here, or post it to worker_threads, each of which instantiates its own
|
|
8
|
+
* instance from it without compiling again. The Module is compiled from the
|
|
9
|
+
* exact bytes `generatedWasmModuleSha256()` hashes.
|
|
10
|
+
*/
|
|
11
|
+
export declare function compileXlsxWasmModule(): Promise<WebAssembly.Module>;
|
|
12
|
+
/**
|
|
13
|
+
* The SHA-256 this realm recorded for the bytes it compiled `module` from
|
|
14
|
+
* (`compileXlsxWasmModule`, or the default instance's Module). It is a
|
|
15
|
+
* lookup, not a hash of the Module: a `WebAssembly.Module` exposes no bytes.
|
|
16
|
+
* A Module received from another thread is a clone and answers undefined.
|
|
17
|
+
*/
|
|
18
|
+
export declare function xlsxWasmModuleSha256(module: WebAssembly.Module): string | undefined;
|
|
19
|
+
export interface XlsxWasmBridgeLoadOptions extends XlsxWasmAdmissionOptions {
|
|
20
|
+
/**
|
|
21
|
+
* A Module from `compileXlsxWasmModule()` (possibly in another thread).
|
|
22
|
+
* Given: the bridge runs on a NEW instance of its own. Absent: the bridge
|
|
23
|
+
* runs on the process's shared default instance, as every
|
|
24
|
+
* `loadGeneratedXlsxWasmBridge()` bridge does.
|
|
25
|
+
*
|
|
26
|
+
* `memoryBudgetBytes` and `admission` apply to the returned bridge only.
|
|
27
|
+
* On the shared default instance each bridge keeps its own setting, and
|
|
28
|
+
* every bridge's live sessions count against the one maximum.
|
|
29
|
+
*/
|
|
30
|
+
readonly module?: WebAssembly.Module;
|
|
31
|
+
/** Throw instead of returning not-mounted. Defaults to XLSX_WASM_REQUIRED=1. */
|
|
32
|
+
readonly required?: boolean;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* R3: mount the bridge on a wasm instance. Synchronous: with a Module the
|
|
36
|
+
* instantiation is cheap; without one the default instance is created (and
|
|
37
|
+
* the binary compiled) once per process.
|
|
38
|
+
*/
|
|
39
|
+
export declare function loadXlsxWasmBridge(options?: XlsxWasmBridgeLoadOptions): XlsxWasmBridgeLoadResult;
|
|
40
|
+
/**
|
|
41
|
+
* The process's shared default bridge (unchanged entry point). `options`
|
|
42
|
+
* sets this bridge's own admission (see `XlsxWasmBridgeLoadOptions`).
|
|
43
|
+
*/
|
|
44
|
+
export declare function loadGeneratedXlsxWasmBridge(options?: XlsxWasmAdmissionOptions): XlsxWasmBridgeLoadResult;
|
|
4
45
|
/**
|
|
5
46
|
* SHA-256 of the WebAssembly binary this loader instantiates. Hosts report it
|
|
6
47
|
* with the bridge version so a deployed runtime is identifiable without
|