@beyondwork/xlsx-substrate-bindings 0.0.0-stage → 0.2.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.
- package/LICENSE.md +31 -0
- package/README.md +135 -2
- package/dist/ai/agent-metadata.d.ts +363 -0
- package/dist/ai/agent-metadata.js +227 -0
- package/dist/ai/index.d.ts +6 -0
- package/dist/ai/index.js +7 -0
- package/dist/ai/mutation-bridge.d.ts +82 -0
- package/dist/ai/mutation-bridge.js +179 -0
- package/dist/ai/types.d.ts +765 -0
- package/dist/ai/types.js +23 -0
- package/dist/index.d.ts +50 -0
- package/dist/index.js +90 -0
- package/dist/runtime/index.d.ts +2 -0
- package/dist/runtime/index.js +1 -0
- package/dist/runtime/types.d.ts +1435 -0
- package/dist/runtime/types.js +15 -0
- package/dist/shared.d.ts +69 -0
- package/dist/shared.js +1 -0
- package/dist/ui/index.d.ts +2 -0
- package/dist/ui/index.js +1 -0
- package/dist/ui/types.d.ts +765 -0
- package/dist/ui/types.js +12 -0
- 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 +643 -0
- package/dist/wasm/bridge-contract.js +1001 -0
- package/dist/wasm/index.d.ts +50 -0
- package/dist/wasm/index.js +297 -0
- 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 +98 -0
- package/dist/wasm/session-router.js +184 -0
- package/dist/wasm/sheet-window-binary-reference.d.ts +9 -0
- package/dist/wasm/sheet-window-binary-reference.js +308 -0
- package/dist/wasm/sheet-window-binary.d.ts +279 -0
- package/dist/wasm/sheet-window-binary.js +636 -0
- package/dist/wasm/web.d.ts +72 -0
- package/dist/wasm/web.js +142 -0
- package/generated/wasm-web/package.json +3 -0
- package/generated/wasm-web/snippets/ironcalc_base-89b4f49381e1e289/inline0.js +42 -0
- package/generated/wasm-web/xlsx_substrate_wasm.d.ts +532 -0
- package/generated/wasm-web/xlsx_substrate_wasm.js +2493 -0
- package/generated/wasm-web/xlsx_substrate_wasm_bg.wasm +0 -0
- package/generated/wasm-web/xlsx_substrate_wasm_bg.wasm.d.ts +120 -0
- package/package.json +55 -3
|
@@ -0,0 +1,765 @@
|
|
|
1
|
+
import type { XlsxBlocker, XlsxCellAddress, XlsxCellRange, XlsxReadbackEnvelope, XlsxRuntimeActor, XlsxScopeHandle, XlsxVerdict } from "../shared.ts";
|
|
2
|
+
import type { XlsxRuntimeAuditEnvelope, XlsxRuntimeCellReadback, XlsxRuntimeUndoBoundary, XlsxRuntimeWarning, XlsxSessionVolatileInputs, XlsxWorkflowContextInput } from "../runtime/types.ts";
|
|
3
|
+
export type XlsxAiBlockerCode = "unsupported-action" | "unsupported-reference" | "ambiguous-reference" | "invalid-target" | "scope-validation-failed" | "runtime-refused" | "runtime-blocked" | "kernel-stale" | "kernel-running" | "kernel-adapter-unavailable" | "kernel-output-too-large" | "kernel-action-requires-host";
|
|
4
|
+
export interface XlsxAiBlocker extends XlsxBlocker {
|
|
5
|
+
readonly code: XlsxAiBlockerCode;
|
|
6
|
+
}
|
|
7
|
+
export interface XlsxAiWorkbookInspection {
|
|
8
|
+
readonly envelope: XlsxReadbackEnvelope;
|
|
9
|
+
readonly verdict: Extract<XlsxVerdict, "available">;
|
|
10
|
+
readonly workbookId: string;
|
|
11
|
+
/**
|
|
12
|
+
* Session identity at emission — opaque; equality/advancement only (see
|
|
13
|
+
* `XlsxRuntimeSessionMutationReceipt.canonicalHash`).
|
|
14
|
+
*/
|
|
15
|
+
readonly canonicalHash: string;
|
|
16
|
+
readonly sheetCount: number;
|
|
17
|
+
readonly populatedCellCount: number;
|
|
18
|
+
readonly scopeCount: number;
|
|
19
|
+
readonly diagnosticCount: number;
|
|
20
|
+
readonly workflowFactCount: number;
|
|
21
|
+
readonly workflowLaneCount: number;
|
|
22
|
+
}
|
|
23
|
+
export interface XlsxAiScopeListRequest {
|
|
24
|
+
readonly limit?: number;
|
|
25
|
+
readonly cursor?: XlsxScopePageCursor;
|
|
26
|
+
}
|
|
27
|
+
export interface XlsxScopePageCursor {
|
|
28
|
+
/**
|
|
29
|
+
* Session identity captured at list time — opaque; the cursor is stale
|
|
30
|
+
* once the identity has advanced past this value (equality check only).
|
|
31
|
+
*/
|
|
32
|
+
readonly canonicalHash: string;
|
|
33
|
+
readonly afterScopeId: string;
|
|
34
|
+
}
|
|
35
|
+
export interface XlsxAiScopeListResult {
|
|
36
|
+
readonly envelope: XlsxReadbackEnvelope;
|
|
37
|
+
readonly verdict: Extract<XlsxVerdict, "available" | "refused">;
|
|
38
|
+
readonly handles: readonly XlsxScopeHandle[];
|
|
39
|
+
readonly nextCursor?: XlsxScopePageCursor;
|
|
40
|
+
readonly totalAvailable: number;
|
|
41
|
+
readonly blockers: readonly XlsxAiBlocker[];
|
|
42
|
+
}
|
|
43
|
+
export interface XlsxAiCompressedContextRequest {
|
|
44
|
+
readonly sheetId?: string;
|
|
45
|
+
readonly maxRegions?: number;
|
|
46
|
+
readonly maxAxisBands?: number;
|
|
47
|
+
readonly includeAnchors?: boolean;
|
|
48
|
+
}
|
|
49
|
+
export interface XlsxAiCompressedContextResult {
|
|
50
|
+
readonly envelope: XlsxReadbackEnvelope;
|
|
51
|
+
readonly verdict: Extract<XlsxVerdict, "available" | "refused">;
|
|
52
|
+
readonly context?: XlsxAiCompressedWorkbookContext;
|
|
53
|
+
readonly blockers: readonly XlsxAiBlocker[];
|
|
54
|
+
}
|
|
55
|
+
export interface XlsxAiCompressedWorkbookContext {
|
|
56
|
+
readonly workbookId: string;
|
|
57
|
+
/**
|
|
58
|
+
* Session identity at emission — opaque; equality/advancement only (see
|
|
59
|
+
* `XlsxRuntimeSessionMutationReceipt.canonicalHash`).
|
|
60
|
+
*/
|
|
61
|
+
readonly canonicalHash: string;
|
|
62
|
+
readonly totals: XlsxAiCompressedWorkbookTotals;
|
|
63
|
+
readonly sheets: readonly XlsxAiCompressedSheetContext[];
|
|
64
|
+
}
|
|
65
|
+
export interface XlsxAiCompressedWorkbookTotals {
|
|
66
|
+
readonly sheetCount: number;
|
|
67
|
+
readonly populatedCellCount: number;
|
|
68
|
+
readonly formulaCellCount: number;
|
|
69
|
+
readonly styledCellCount: number;
|
|
70
|
+
readonly outputRegionCount: number;
|
|
71
|
+
readonly kernelBindingCount: number;
|
|
72
|
+
readonly tableCount: number;
|
|
73
|
+
readonly validationRegionCount: number;
|
|
74
|
+
readonly commentAnchorCount: number;
|
|
75
|
+
readonly protectedSheetCount: number;
|
|
76
|
+
readonly preserveOnlyEntityCount: number;
|
|
77
|
+
}
|
|
78
|
+
export interface XlsxAiCompressedSheetContext {
|
|
79
|
+
readonly sheetId: string;
|
|
80
|
+
readonly name: string;
|
|
81
|
+
readonly usedRange?: XlsxCellRange;
|
|
82
|
+
readonly valueCounts: XlsxAiCompressedValueCounts;
|
|
83
|
+
readonly formulaCellCount: number;
|
|
84
|
+
readonly styledCellCount: number;
|
|
85
|
+
readonly projectedBlankCount: number;
|
|
86
|
+
readonly outputRegionCount: number;
|
|
87
|
+
readonly kernelBindingCount: number;
|
|
88
|
+
readonly tableCount: number;
|
|
89
|
+
readonly validationRegionCount: number;
|
|
90
|
+
readonly commentAnchorCount: number;
|
|
91
|
+
readonly protected: boolean;
|
|
92
|
+
readonly formatPosture: "number-format-subset" | "style-ref-only" | "unavailable";
|
|
93
|
+
readonly formatPostureCounts: XlsxAiCompressedFormatPostureCounts;
|
|
94
|
+
readonly styleRefCount: number;
|
|
95
|
+
readonly rowBands: readonly XlsxAiCompressedAxisBand[];
|
|
96
|
+
readonly columnBands: readonly XlsxAiCompressedAxisBand[];
|
|
97
|
+
readonly regions: readonly XlsxAiCompressedRegion[];
|
|
98
|
+
readonly anchors: readonly XlsxAiCompressedAnchor[];
|
|
99
|
+
readonly inverseIndexes: readonly XlsxAiCompressedInverseIndex[];
|
|
100
|
+
}
|
|
101
|
+
export interface XlsxAiCompressedFormatPostureCounts {
|
|
102
|
+
readonly general: number;
|
|
103
|
+
readonly builtinSupported: number;
|
|
104
|
+
readonly customSupported: number;
|
|
105
|
+
readonly dateTimeSupportedSubset: number;
|
|
106
|
+
readonly dateTimeUnsupported: number;
|
|
107
|
+
readonly currencySupportedSubset: number;
|
|
108
|
+
readonly currencyUnsupported: number;
|
|
109
|
+
readonly localeUnsupported: number;
|
|
110
|
+
readonly complexUnsupported: number;
|
|
111
|
+
readonly unsupported: number;
|
|
112
|
+
readonly missing: number;
|
|
113
|
+
}
|
|
114
|
+
export interface XlsxAiCompressedValueCounts {
|
|
115
|
+
readonly empty: number;
|
|
116
|
+
readonly number: number;
|
|
117
|
+
readonly text: number;
|
|
118
|
+
readonly boolean: number;
|
|
119
|
+
readonly error: number;
|
|
120
|
+
readonly formula: number;
|
|
121
|
+
}
|
|
122
|
+
export interface XlsxAiCompressedAxisBand {
|
|
123
|
+
readonly axis: "row" | "column";
|
|
124
|
+
readonly start: number;
|
|
125
|
+
readonly end: number;
|
|
126
|
+
readonly populatedCellCount: number;
|
|
127
|
+
readonly formulaCellCount: number;
|
|
128
|
+
readonly styledCellCount: number;
|
|
129
|
+
readonly errorCellCount: number;
|
|
130
|
+
}
|
|
131
|
+
export interface XlsxAiCompressedRegion {
|
|
132
|
+
readonly regionId: string;
|
|
133
|
+
readonly kind: string;
|
|
134
|
+
readonly sheetId: string;
|
|
135
|
+
readonly range: XlsxCellRange;
|
|
136
|
+
readonly populatedCellCount: number;
|
|
137
|
+
readonly formulaCellCount: number;
|
|
138
|
+
readonly styledCellCount: number;
|
|
139
|
+
readonly valueCounts: XlsxAiCompressedValueCounts;
|
|
140
|
+
readonly exactDrilldownAvailable: boolean;
|
|
141
|
+
}
|
|
142
|
+
export interface XlsxAiCompressedAnchor {
|
|
143
|
+
readonly kind: string;
|
|
144
|
+
readonly id: string;
|
|
145
|
+
readonly sheetId: string;
|
|
146
|
+
readonly range?: XlsxCellRange;
|
|
147
|
+
readonly cell?: XlsxCellAddress;
|
|
148
|
+
}
|
|
149
|
+
export interface XlsxAiCompressedInverseIndex {
|
|
150
|
+
readonly kind: string;
|
|
151
|
+
readonly itemCount: number;
|
|
152
|
+
readonly distinctKeyCount: number;
|
|
153
|
+
}
|
|
154
|
+
export interface XlsxAiCompressedDrilldownRequest {
|
|
155
|
+
readonly regionId: string;
|
|
156
|
+
readonly limit?: number;
|
|
157
|
+
readonly cursor?: XlsxScopePageCursor;
|
|
158
|
+
}
|
|
159
|
+
export interface XlsxAiCompressedDrilldownResult {
|
|
160
|
+
readonly envelope: XlsxReadbackEnvelope;
|
|
161
|
+
readonly verdict: Extract<XlsxVerdict, "available" | "refused">;
|
|
162
|
+
readonly regionId: string;
|
|
163
|
+
readonly handles: readonly XlsxScopeHandle[];
|
|
164
|
+
readonly nextCursor?: XlsxScopePageCursor;
|
|
165
|
+
readonly totalAvailable: number;
|
|
166
|
+
readonly blockers: readonly XlsxAiBlocker[];
|
|
167
|
+
}
|
|
168
|
+
export interface XlsxAiScopeBundleResult {
|
|
169
|
+
readonly verdict: Extract<XlsxVerdict, "available" | "refused">;
|
|
170
|
+
readonly bundle?: XlsxScopeBundle;
|
|
171
|
+
readonly blockers: readonly XlsxAiBlocker[];
|
|
172
|
+
}
|
|
173
|
+
export interface XlsxScopeBundle {
|
|
174
|
+
readonly handle: XlsxScopeHandle;
|
|
175
|
+
readonly classifications: readonly string[];
|
|
176
|
+
readonly capability: {
|
|
177
|
+
readonly mutate: "supported" | "warn-and-proceed" | "hard-refusal";
|
|
178
|
+
readonly blockers: readonly XlsxBlocker[];
|
|
179
|
+
};
|
|
180
|
+
readonly geometry?: {
|
|
181
|
+
readonly status: "unavailable" | "not-projected" | "projected";
|
|
182
|
+
readonly projection?: "complete" | "clipped" | "outside-window";
|
|
183
|
+
};
|
|
184
|
+
readonly kernel?: XlsxKernelScopeEvidence;
|
|
185
|
+
}
|
|
186
|
+
export interface XlsxKernelScopeEvidence {
|
|
187
|
+
readonly bindingId: string;
|
|
188
|
+
readonly language: "python" | "sql" | "javascript" | "ai-prompt";
|
|
189
|
+
readonly cachePosture: "empty" | "stale" | "fresh" | "failed" | "running";
|
|
190
|
+
readonly anchorLabel: string;
|
|
191
|
+
readonly sourceSummary: string;
|
|
192
|
+
readonly declaredInputCount: number;
|
|
193
|
+
readonly outputRegionId?: string;
|
|
194
|
+
readonly outputRange?: XlsxCellRange;
|
|
195
|
+
readonly activeRunId?: string;
|
|
196
|
+
readonly adapterIdentity?: string;
|
|
197
|
+
readonly logsSummary?: string;
|
|
198
|
+
readonly lastRunId?: string;
|
|
199
|
+
}
|
|
200
|
+
export type XlsxRangeWriteCell = {
|
|
201
|
+
readonly type: "value";
|
|
202
|
+
readonly value: string | number | boolean | null;
|
|
203
|
+
} | {
|
|
204
|
+
readonly type: "formula";
|
|
205
|
+
readonly formula: string;
|
|
206
|
+
};
|
|
207
|
+
export interface XlsxAiReplacementProposal {
|
|
208
|
+
readonly scopeId: string;
|
|
209
|
+
readonly operationSummary: "range-write";
|
|
210
|
+
readonly operation: {
|
|
211
|
+
readonly type: "range-write";
|
|
212
|
+
readonly cells: readonly XlsxRangeWriteCell[];
|
|
213
|
+
};
|
|
214
|
+
/**
|
|
215
|
+
* Optimistic concurrency on the bytes and scope path: compared with the
|
|
216
|
+
* workbook's STATE SHA (`crates/sheets-scope/src/replacement.rs`,
|
|
217
|
+
* `validate_scope_replacement`), never with a session identity. The
|
|
218
|
+
* session AI lane (`XlsxAiSessionProposal`) carries `expectedSessionFence`
|
|
219
|
+
* instead (design record Q1). Opaque — never synthesized by callers.
|
|
220
|
+
*/
|
|
221
|
+
readonly expectedCanonicalHash?: string;
|
|
222
|
+
readonly reason?: string;
|
|
223
|
+
}
|
|
224
|
+
export interface XlsxAiReplacementValidation {
|
|
225
|
+
readonly verdict: Extract<XlsxVerdict, "validated" | "refused">;
|
|
226
|
+
readonly targetScopeId: string;
|
|
227
|
+
readonly safe: boolean;
|
|
228
|
+
readonly blockers: readonly XlsxAiBlocker[];
|
|
229
|
+
}
|
|
230
|
+
export interface XlsxAiReplacementApplyResult {
|
|
231
|
+
readonly verdict: Extract<XlsxVerdict, "applied" | "refused">;
|
|
232
|
+
readonly actor: XlsxRuntimeActor;
|
|
233
|
+
readonly targetScopeId: string;
|
|
234
|
+
readonly blockers: readonly XlsxAiBlocker[];
|
|
235
|
+
}
|
|
236
|
+
export type XlsxAiKernelActionKind = "update-source" | "run" | "cancel" | "detach" | "delete";
|
|
237
|
+
export interface XlsxAiKernelActionProposal {
|
|
238
|
+
readonly scopeId: string;
|
|
239
|
+
readonly action: XlsxAiKernelActionKind;
|
|
240
|
+
/**
|
|
241
|
+
* Optimistic concurrency: must be an identity previously handed out by a
|
|
242
|
+
* receipt or readback; refused when it no longer matches the current
|
|
243
|
+
* session identity. Opaque — never synthesized by callers.
|
|
244
|
+
*/
|
|
245
|
+
readonly expectedCanonicalHash?: string;
|
|
246
|
+
readonly source?: string;
|
|
247
|
+
readonly reason?: string;
|
|
248
|
+
}
|
|
249
|
+
export interface XlsxAiKernelActionValidation {
|
|
250
|
+
readonly verdict: Extract<XlsxVerdict, "validated" | "refused">;
|
|
251
|
+
readonly targetScopeId: string;
|
|
252
|
+
readonly action: XlsxAiKernelActionKind;
|
|
253
|
+
readonly safe: boolean;
|
|
254
|
+
readonly hostActionRequired: true;
|
|
255
|
+
readonly blockers: readonly XlsxAiBlocker[];
|
|
256
|
+
}
|
|
257
|
+
export declare function aiKernelActionRequiresHost(proposal: XlsxAiKernelActionProposal): XlsxAiKernelActionValidation;
|
|
258
|
+
export interface XlsxAiReferenceQuery {
|
|
259
|
+
readonly text: string;
|
|
260
|
+
readonly activeSheetId?: string;
|
|
261
|
+
}
|
|
262
|
+
export interface XlsxAiReferenceResolution {
|
|
263
|
+
readonly verdict: Extract<XlsxVerdict, "available" | "refused">;
|
|
264
|
+
readonly query: string;
|
|
265
|
+
readonly matches: readonly XlsxAiReferenceMatch[];
|
|
266
|
+
readonly blockers: readonly XlsxAiBlocker[];
|
|
267
|
+
}
|
|
268
|
+
export interface XlsxAiReferenceMatch {
|
|
269
|
+
readonly handle: XlsxScopeHandle;
|
|
270
|
+
readonly source: "scope-id" | "a1" | "defined-name" | "table-name";
|
|
271
|
+
readonly label: string;
|
|
272
|
+
readonly readback: XlsxAiReferenceReadback;
|
|
273
|
+
}
|
|
274
|
+
export interface XlsxAiReferenceReadback {
|
|
275
|
+
readonly label: string;
|
|
276
|
+
readonly sheetId?: string;
|
|
277
|
+
readonly address?: XlsxCellAddress;
|
|
278
|
+
readonly range?: XlsxCellRange;
|
|
279
|
+
readonly valueKind?: "number" | "text" | "boolean" | "error";
|
|
280
|
+
readonly formulaText?: string;
|
|
281
|
+
}
|
|
282
|
+
export interface XlsxAiFormulaExplanationResult {
|
|
283
|
+
readonly verdict: Extract<XlsxVerdict, "available" | "refused">;
|
|
284
|
+
readonly explanation?: XlsxAiFormulaExplanation;
|
|
285
|
+
readonly blockers: readonly XlsxAiBlocker[];
|
|
286
|
+
}
|
|
287
|
+
export interface XlsxAiFormulaExplanation {
|
|
288
|
+
readonly target: XlsxScopeHandle;
|
|
289
|
+
readonly formulaText: string;
|
|
290
|
+
readonly normalizedFormula: string;
|
|
291
|
+
readonly family: string;
|
|
292
|
+
readonly supported: boolean;
|
|
293
|
+
readonly cachedValueKind?: "number" | "text" | "boolean" | "error";
|
|
294
|
+
readonly evaluatedValueKind?: "number" | "text" | "boolean" | "error";
|
|
295
|
+
readonly diagnostics: readonly XlsxAiFormulaDiagnostic[];
|
|
296
|
+
readonly precedents: readonly XlsxAiFormulaPrecedent[];
|
|
297
|
+
readonly graphPrecedentCount: number;
|
|
298
|
+
readonly graphEdgeCount: number;
|
|
299
|
+
}
|
|
300
|
+
/**
|
|
301
|
+
* One parse diagnostic of an explained formula. `code` mirrors
|
|
302
|
+
* `FormulaParseDiagnosticCode` (crates/sheets-engine/src/parser.rs) label for
|
|
303
|
+
* label as sheets-ai spells it (`parse_diagnostic_label`); the union and the
|
|
304
|
+
* Rust label set are pinned equal by test/xlsx/x5-c-056-reference-return-code-retired.test.ts.
|
|
305
|
+
* X5-C-056 (bridge v39) retired `reference-return-unsupported` (no parser
|
|
306
|
+
* producer since X5-C-049) and added the two labels the union had never
|
|
307
|
+
* carried (`three-d-reference-unsupported`, `reference-operator-unsupported`).
|
|
308
|
+
*/
|
|
309
|
+
export interface XlsxAiFormulaDiagnostic {
|
|
310
|
+
readonly code: "empty-formula" | "external-reference" | "three-d-reference-unsupported" | "kernel-bound-formula" | "dynamic-spill-unsupported" | "shape-changing-function-unsupported" | "volatile-function-unsupported" | "reference-operator-unsupported" | "unsupported-function" | "unsupported-syntax" | "invalid-reference" | "sheet-qualified-reference-unsupported" | "named-reference-unsupported" | "structured-reference-unsupported";
|
|
311
|
+
readonly message: string;
|
|
312
|
+
}
|
|
313
|
+
export interface XlsxAiFormulaPrecedent {
|
|
314
|
+
readonly reference: string;
|
|
315
|
+
readonly handle: XlsxScopeHandle;
|
|
316
|
+
}
|
|
317
|
+
export interface XlsxAiUnsupportedActionResult {
|
|
318
|
+
readonly verdict: Extract<XlsxVerdict, "refused">;
|
|
319
|
+
readonly action: XlsxAiUnsupportedAction;
|
|
320
|
+
readonly blockers: readonly XlsxAiBlocker[];
|
|
321
|
+
}
|
|
322
|
+
export type XlsxAiUnsupportedAction = "ai.actions.solveGoalSeek" | "ai.actions.refreshPivot" | "ai.actions.updateChartSource" | "ai.exportReviewedWorkbook";
|
|
323
|
+
export declare function aiUnsupportedAction(action: XlsxAiUnsupportedAction): XlsxAiUnsupportedActionResult;
|
|
324
|
+
/**
|
|
325
|
+
* The session fence (Q1): `xsf1:e:<epoch32hex>:<identity64hex>` at revision
|
|
326
|
+
* >= 1, `xsf1:r:<identity64hex>` at revision 0. Never composed by callers;
|
|
327
|
+
* echoed from the last AI result. A bare state SHA is refused
|
|
328
|
+
* `input:fence-format`.
|
|
329
|
+
*/
|
|
330
|
+
export type XlsxSessionFence = `xsf1:e:${string}:${string}` | `xsf1:r:${string}`;
|
|
331
|
+
export interface XlsxAiSessionStamp {
|
|
332
|
+
readonly sessionFence: XlsxSessionFence;
|
|
333
|
+
readonly sessionEpoch: string;
|
|
334
|
+
/** Advisory, never compared. */
|
|
335
|
+
readonly revision: number;
|
|
336
|
+
}
|
|
337
|
+
/**
|
|
338
|
+
* The post-drain fence minted inside a commit call (Q1 item 5): the wire shape
|
|
339
|
+
* is `{epoch, revision, identity, sessionFence}`; the session epoch travels as
|
|
340
|
+
* `epoch` here and as `sessionEpoch` on the receipt's top-level stamp.
|
|
341
|
+
*/
|
|
342
|
+
export interface XlsxAiSettledFence {
|
|
343
|
+
readonly epoch: string;
|
|
344
|
+
/** Advisory, never compared. */
|
|
345
|
+
readonly revision: number;
|
|
346
|
+
readonly identity: string;
|
|
347
|
+
readonly sessionFence: XlsxSessionFence;
|
|
348
|
+
}
|
|
349
|
+
export type XlsxAiReplacementOperation = "cell-set-value" | "cell-set-formula" | "cell-clear" | "range-write";
|
|
350
|
+
/** A typed cell value, the shape the kernel DTOs already use. */
|
|
351
|
+
export type XlsxAiCellValue = {
|
|
352
|
+
readonly kind: "number";
|
|
353
|
+
readonly value: string;
|
|
354
|
+
} | {
|
|
355
|
+
readonly kind: "text";
|
|
356
|
+
readonly value: string;
|
|
357
|
+
} | {
|
|
358
|
+
readonly kind: "boolean";
|
|
359
|
+
readonly value: boolean;
|
|
360
|
+
} | {
|
|
361
|
+
readonly kind: "error";
|
|
362
|
+
readonly value: string;
|
|
363
|
+
};
|
|
364
|
+
export type XlsxAiRangeWriteCell = {
|
|
365
|
+
readonly kind: "value";
|
|
366
|
+
readonly value: XlsxAiCellValue;
|
|
367
|
+
} | {
|
|
368
|
+
readonly kind: "formula";
|
|
369
|
+
readonly formula: string;
|
|
370
|
+
readonly cachedValue?: XlsxAiCellValue;
|
|
371
|
+
} | {
|
|
372
|
+
readonly kind: "clear";
|
|
373
|
+
};
|
|
374
|
+
/**
|
|
375
|
+
* One replacement proposal on the agent lane. The payload rides the field
|
|
376
|
+
* its operation names: `value` (cell-set-value), `formula` + `cachedValue`
|
|
377
|
+
* (cell-set-formula), `cells` (range-write); cell-clear carries none.
|
|
378
|
+
*/
|
|
379
|
+
export interface XlsxAiSessionProposal {
|
|
380
|
+
readonly scopeId?: string;
|
|
381
|
+
readonly handle: XlsxScopeHandle;
|
|
382
|
+
readonly operation: XlsxAiReplacementOperation;
|
|
383
|
+
readonly value?: XlsxAiCellValue;
|
|
384
|
+
readonly formula?: string;
|
|
385
|
+
readonly cachedValue?: XlsxAiCellValue;
|
|
386
|
+
readonly cells?: readonly XlsxAiRangeWriteCell[];
|
|
387
|
+
/** Required on the agent lane's single-proposal verbs. */
|
|
388
|
+
readonly expectedSessionFence: XlsxSessionFence;
|
|
389
|
+
readonly reason?: string;
|
|
390
|
+
}
|
|
391
|
+
/**
|
|
392
|
+
* D8: the AI lane's one refusal shape. Structurally `Omit<EnsembleRefusal,
|
|
393
|
+
* "recommendedRoute"> & { target?: XlsxScopeHandle }`; the parity with the
|
|
394
|
+
* root `EnsembleRefusal` is asserted by a root-level test only (the bindings
|
|
395
|
+
* never import the repository's `src/`).
|
|
396
|
+
*/
|
|
397
|
+
export interface XlsxAiRefusal {
|
|
398
|
+
readonly code: string;
|
|
399
|
+
readonly category: "input" | "unresolved-target" | "ambiguous-target" | "unsupported" | "warning" | "blocked";
|
|
400
|
+
readonly message: string;
|
|
401
|
+
readonly nextStep: string;
|
|
402
|
+
readonly ownerRoute?: string;
|
|
403
|
+
readonly requirement?: {
|
|
404
|
+
readonly kind: "input" | "context" | "binding" | "capability" | "authority" | "evidence" | "validation";
|
|
405
|
+
readonly detail: string;
|
|
406
|
+
};
|
|
407
|
+
readonly retry?: "correct-input" | "refresh-context" | "resolve-scope" | "obtain-authority" | "supply-evidence" | "after-implementation" | "after-repair";
|
|
408
|
+
readonly target?: XlsxScopeHandle;
|
|
409
|
+
}
|
|
410
|
+
/**
|
|
411
|
+
* §5.5 under Q8's fold (R-XB5-6): the one export's answer to an unknown
|
|
412
|
+
* `op` (the Rust `AiUnknownOpExportDto`): a `verdict: "refused"` DTO naming
|
|
413
|
+
* the op it could not dispatch, carrying an `input:malformed-body` refusal,
|
|
414
|
+
* and with NO stamp (nothing was borrowed: there is no operation to fence).
|
|
415
|
+
* The typed methods never send an unknown op, so the bindings' normalizer
|
|
416
|
+
* surfaces this answer as the thrown `XlsxAiUnknownOpRefusalError`.
|
|
417
|
+
*/
|
|
418
|
+
export interface XlsxAiUnknownOpRefusal {
|
|
419
|
+
readonly verdict: Extract<XlsxVerdict, "refused">;
|
|
420
|
+
readonly op: string;
|
|
421
|
+
readonly refusal: XlsxAiRefusal;
|
|
422
|
+
}
|
|
423
|
+
export interface XlsxAiCellReadback {
|
|
424
|
+
readonly sheetId: string;
|
|
425
|
+
readonly address: XlsxCellAddress;
|
|
426
|
+
readonly valueKind?: "number" | "text" | "boolean" | "error";
|
|
427
|
+
readonly value?: string;
|
|
428
|
+
readonly formulaText?: string;
|
|
429
|
+
readonly blank: boolean;
|
|
430
|
+
}
|
|
431
|
+
export interface XlsxAiScopeBundleReadRequest {
|
|
432
|
+
readonly handle: XlsxScopeHandle;
|
|
433
|
+
readonly expectedSessionFence: XlsxSessionFence;
|
|
434
|
+
readonly workflowContext?: XlsxWorkflowContextInput;
|
|
435
|
+
}
|
|
436
|
+
export interface XlsxAiSessionScopeBundle {
|
|
437
|
+
readonly handle: XlsxScopeHandle;
|
|
438
|
+
readonly classifications: readonly string[];
|
|
439
|
+
readonly capability: {
|
|
440
|
+
readonly mutate: "supported" | "warn-and-proceed" | "hard-refusal";
|
|
441
|
+
readonly inspect: "supported" | "warn-and-proceed" | "hard-refusal";
|
|
442
|
+
readonly blockers: readonly XlsxBlocker[];
|
|
443
|
+
};
|
|
444
|
+
readonly readback: {
|
|
445
|
+
readonly label: string;
|
|
446
|
+
readonly sheetId?: string;
|
|
447
|
+
readonly address?: XlsxCellAddress;
|
|
448
|
+
readonly range?: XlsxCellRange;
|
|
449
|
+
readonly valueKindSummary?: string;
|
|
450
|
+
readonly formulaText?: string;
|
|
451
|
+
};
|
|
452
|
+
readonly geometry: {
|
|
453
|
+
readonly status: "unavailable" | "not-projected" | "projected";
|
|
454
|
+
readonly projection?: "complete" | "clipped";
|
|
455
|
+
};
|
|
456
|
+
readonly hasBlockingWorkflowFact: boolean;
|
|
457
|
+
}
|
|
458
|
+
export interface XlsxAiSessionScopeBundleResult extends XlsxAiSessionStamp {
|
|
459
|
+
readonly verdict: Extract<XlsxVerdict, "available" | "refused">;
|
|
460
|
+
readonly bundle?: XlsxAiSessionScopeBundle;
|
|
461
|
+
readonly refusal?: XlsxAiRefusal;
|
|
462
|
+
}
|
|
463
|
+
export interface XlsxAiSessionReferenceRequest extends XlsxAiReferenceQuery {
|
|
464
|
+
readonly expectedSessionFence: XlsxSessionFence;
|
|
465
|
+
}
|
|
466
|
+
export interface XlsxAiSessionReferenceResult extends XlsxAiSessionStamp {
|
|
467
|
+
readonly verdict: Extract<XlsxVerdict, "available" | "refused">;
|
|
468
|
+
readonly query: string;
|
|
469
|
+
readonly matches: readonly XlsxAiReferenceMatch[];
|
|
470
|
+
readonly blockers: readonly XlsxAiBlocker[];
|
|
471
|
+
readonly refusal?: XlsxAiRefusal;
|
|
472
|
+
}
|
|
473
|
+
export interface XlsxAiScopeReadResult extends XlsxAiSessionStamp {
|
|
474
|
+
readonly verdict: Extract<XlsxVerdict, "available" | "refused">;
|
|
475
|
+
readonly handle?: XlsxScopeHandle;
|
|
476
|
+
readonly cells: readonly XlsxAiCellReadback[];
|
|
477
|
+
readonly refusal?: XlsxAiRefusal;
|
|
478
|
+
}
|
|
479
|
+
export interface XlsxAiScopeNeighborhoodRequest {
|
|
480
|
+
readonly handle: XlsxScopeHandle;
|
|
481
|
+
readonly direction?: "precedents" | "dependents" | "both";
|
|
482
|
+
/** 1..=2 */
|
|
483
|
+
readonly depth: number;
|
|
484
|
+
readonly limit?: number;
|
|
485
|
+
readonly expectedSessionFence: XlsxSessionFence;
|
|
486
|
+
}
|
|
487
|
+
export interface XlsxAiNeighborhoodNode {
|
|
488
|
+
readonly kind: string;
|
|
489
|
+
readonly key: string;
|
|
490
|
+
readonly depth: number;
|
|
491
|
+
readonly sheetId?: string;
|
|
492
|
+
readonly address?: XlsxCellAddress;
|
|
493
|
+
readonly formula?: string;
|
|
494
|
+
}
|
|
495
|
+
export interface XlsxAiScopeNeighborhoodResult extends XlsxAiSessionStamp {
|
|
496
|
+
readonly verdict: Extract<XlsxVerdict, "available" | "refused">;
|
|
497
|
+
readonly status: "measured" | "unmeasured" | "refused";
|
|
498
|
+
readonly reason?: "not-mounted" | "not-synced" | "needs-full-recalc" | "seeds-unresolved";
|
|
499
|
+
readonly refusal?: XlsxAiRefusal;
|
|
500
|
+
readonly seeds: readonly XlsxAiNeighborhoodNode[];
|
|
501
|
+
readonly precedents: readonly XlsxAiNeighborhoodNode[];
|
|
502
|
+
readonly dependents: readonly XlsxAiNeighborhoodNode[];
|
|
503
|
+
readonly truncated: boolean;
|
|
504
|
+
}
|
|
505
|
+
/**
|
|
506
|
+
* T-O (WP-DOC P4-prep-2, R-WPD-1): the calc-graph adjacency export's request —
|
|
507
|
+
* the fence (checked first, like the eight) and a `limit` on the sorted edge
|
|
508
|
+
* list (the bridge's default when absent). The projector's read only.
|
|
509
|
+
*/
|
|
510
|
+
export interface XlsxAiCalcGraphEdgesRequest {
|
|
511
|
+
readonly limit?: number;
|
|
512
|
+
readonly expectedSessionFence: XlsxSessionFence;
|
|
513
|
+
}
|
|
514
|
+
/** One `(dependent, precedent)` pair of the forward adjacency; `key`s are the neighborhood's `key`, kinds `GraphNode::kind()`. */
|
|
515
|
+
export interface XlsxAiCalcGraphEdge {
|
|
516
|
+
readonly dependent: string;
|
|
517
|
+
readonly precedent: string;
|
|
518
|
+
readonly dependentKind: "cell" | "range" | "output-region" | "defined-name" | "table" | string;
|
|
519
|
+
readonly precedentKind: "cell" | "range" | "output-region" | "defined-name" | "table" | string;
|
|
520
|
+
}
|
|
521
|
+
/** One composite endpoint of the returned edges (§0.27): a defined name's name / raw text / sheet scope, a table's display name, the covering sheet + range. */
|
|
522
|
+
export interface XlsxAiCalcGraphDescriptor {
|
|
523
|
+
readonly key: string;
|
|
524
|
+
readonly kind: "range" | "output-region" | "defined-name" | "table" | string;
|
|
525
|
+
readonly name?: string;
|
|
526
|
+
readonly rawText?: string;
|
|
527
|
+
readonly sheetScope?: string;
|
|
528
|
+
readonly sheetId?: string;
|
|
529
|
+
readonly range?: XlsxCellRange;
|
|
530
|
+
}
|
|
531
|
+
/**
|
|
532
|
+
* The adjacency export's answer: `edges` SORTED by `(dependent.stable_key,
|
|
533
|
+
* precedent.stable_key)` (the sort is the contract), `descriptors` one per
|
|
534
|
+
* composite endpoint of the returned edges, `edgeCount` the total before
|
|
535
|
+
* `limit`, `truncated` when the list is a prefix. `unmeasured` carries the
|
|
536
|
+
* graph-currency reason and no edges — never an empty list read as measured.
|
|
537
|
+
*/
|
|
538
|
+
export interface XlsxAiCalcGraphEdgesResult extends XlsxAiSessionStamp {
|
|
539
|
+
readonly verdict: Extract<XlsxVerdict, "available" | "refused">;
|
|
540
|
+
readonly status: "measured" | "unmeasured" | "refused";
|
|
541
|
+
readonly reason?: "not-mounted" | "not-synced" | "needs-full-recalc" | "seeds-unresolved";
|
|
542
|
+
readonly refusal?: XlsxAiRefusal;
|
|
543
|
+
readonly edges: readonly XlsxAiCalcGraphEdge[];
|
|
544
|
+
readonly descriptors: readonly XlsxAiCalcGraphDescriptor[];
|
|
545
|
+
readonly edgeCount: number;
|
|
546
|
+
readonly limit: number;
|
|
547
|
+
readonly truncated: boolean;
|
|
548
|
+
}
|
|
549
|
+
export interface XlsxAiPreviewRequest {
|
|
550
|
+
readonly proposal: XlsxAiSessionProposal;
|
|
551
|
+
readonly actor?: XlsxRuntimeActor;
|
|
552
|
+
readonly fidelity?: "guards-only" | "simulated";
|
|
553
|
+
readonly workflowContext?: XlsxWorkflowContextInput;
|
|
554
|
+
}
|
|
555
|
+
export type XlsxAiImpact = {
|
|
556
|
+
readonly status: "measured";
|
|
557
|
+
readonly dirtyFormulaCells: number;
|
|
558
|
+
readonly sample: readonly XlsxScopeHandle[];
|
|
559
|
+
} | {
|
|
560
|
+
readonly status: "unmeasured";
|
|
561
|
+
readonly reason: string;
|
|
562
|
+
};
|
|
563
|
+
/**
|
|
564
|
+
* XBC-2 (design record Q2 item 7): the simulated arm's size gate, answered
|
|
565
|
+
* whenever `fidelity: "simulated"` was requested AND the preview reached
|
|
566
|
+
* the gate (admitted or not): a preview refused BEFORE it — a malformed or
|
|
567
|
+
* stale fence, a proposal that does not resolve — answers `guards-only`
|
|
568
|
+
* with neither the gate nor the arm (R-XBC2-2 item 5). Both facts are
|
|
569
|
+
* deterministic session facts: populated cells over every sheet, and the
|
|
570
|
+
* loaded package's part bytes.
|
|
571
|
+
*/
|
|
572
|
+
export interface XlsxAiSimulatedGate {
|
|
573
|
+
readonly admitted: boolean;
|
|
574
|
+
readonly populatedCells: number;
|
|
575
|
+
readonly packageBytes: number;
|
|
576
|
+
/** 10 000 */
|
|
577
|
+
readonly maxPopulatedCells: number;
|
|
578
|
+
/** 5 MiB */
|
|
579
|
+
readonly maxPackageBytes: number;
|
|
580
|
+
}
|
|
581
|
+
/**
|
|
582
|
+
* XBC-2 R1 (R-XBC2-1 item 2): the post-apply CONTENT facts of a workbook —
|
|
583
|
+
* its state SHA (`readRuntimeSessionIntegrity`'s `canonicalHash`, the digest
|
|
584
|
+
* of the whole content) and the changed-cells digest over the replacement's
|
|
585
|
+
* footprint (one producer in sheets-ai: sheet, row, column, the formula's
|
|
586
|
+
* display spelling, the value by kind). The preview's
|
|
587
|
+
* `simulated.predictedAfterState` is the clone's; the apply's `afterState`
|
|
588
|
+
* is the resident's after its commit step and before the drain. The service
|
|
589
|
+
* compares the two pairs; the eval's `cloneEqualsApplyOverMatrix` compares
|
|
590
|
+
* exactly these (never identities, which are op-chain tokens equal by
|
|
591
|
+
* construction once the fence passes).
|
|
592
|
+
*/
|
|
593
|
+
export interface XlsxAiAfterState {
|
|
594
|
+
readonly stateSha: string;
|
|
595
|
+
readonly changedCellsDigest: string;
|
|
596
|
+
}
|
|
597
|
+
/**
|
|
598
|
+
* XBC-2: what the simulated (clone) arm answered; present whenever it ran
|
|
599
|
+
* (`fidelity: "simulated"`: agreed, or diverged and the preview refused).
|
|
600
|
+
* The arm runs sheets-scope's bytes-path twin on a clone of the resident
|
|
601
|
+
* (R-XBC2-1 item 3), so `verdict` is an independent oracle's. On an agreed
|
|
602
|
+
* apply `predictedAfterState` is the clone's post-apply content; the service
|
|
603
|
+
* pins it on the staged subject (`/ai/propose` with `fidelity: "simulated"`)
|
|
604
|
+
* and compares it at `/ai/apply` with the receipt's `afterState` (a mismatch
|
|
605
|
+
* is the `ai.preview-arm-divergence` line and the
|
|
606
|
+
* `internal:preview-arm-divergence` warning on the executed outcome).
|
|
607
|
+
*/
|
|
608
|
+
export interface XlsxAiSimulatedPreview {
|
|
609
|
+
/**
|
|
610
|
+
* The clone arm's own verdict. On a validated preview it equals the guards-only verdict on the APPLY-PHASE warning set
|
|
611
|
+
* (a disagreement there is the fail-closed refusal); it reads `applied-with-warnings` where the guards-only arm read
|
|
612
|
+
* `applied` exactly when a commit-phase-only warning rides it (R-XBC2-2 item 2), which `validation` then carries.
|
|
613
|
+
*/
|
|
614
|
+
readonly verdict: "applied" | "applied-with-warnings" | "refused";
|
|
615
|
+
readonly changedCells: number;
|
|
616
|
+
/** The clone's post-apply content; absent when the clone wrote nothing (a refusal both arms agree on, a divergence). */
|
|
617
|
+
readonly predictedAfterState?: XlsxAiAfterState;
|
|
618
|
+
/** On a divergence where the clone arm refused: the clone arm's own roster row (its blocker code and evidence). */
|
|
619
|
+
readonly cloneRefusal?: XlsxAiRefusal;
|
|
620
|
+
}
|
|
621
|
+
export interface XlsxAiPreviewResult extends XlsxAiSessionStamp {
|
|
622
|
+
readonly verdict: Extract<XlsxVerdict, "validated" | "refused">;
|
|
623
|
+
/**
|
|
624
|
+
* The guards-only arm's verdict and warnings; when `fidelity` is
|
|
625
|
+
* `simulated`, the clone arm's (R-XBC2-2 item 2): the same apply-phase
|
|
626
|
+
* warning set by construction, plus the commit-phase-only warnings the
|
|
627
|
+
* apply will report (`package-diagnostics-present` on a session whose
|
|
628
|
+
* package carries a warning/error-severity diagnostic,
|
|
629
|
+
* `calculation-diagnostics-present`), which the agreement rule excludes
|
|
630
|
+
* on both arms and surfaces here — so `verdict` reads
|
|
631
|
+
* `applied-with-warnings` exactly when the apply will.
|
|
632
|
+
*/
|
|
633
|
+
readonly validation: {
|
|
634
|
+
readonly verdict?: Extract<XlsxVerdict, "applied" | "applied-with-warnings">;
|
|
635
|
+
readonly warnings: readonly XlsxRuntimeWarning[];
|
|
636
|
+
readonly refusal?: XlsxAiRefusal;
|
|
637
|
+
};
|
|
638
|
+
/**
|
|
639
|
+
* `simulated` when the clone arm ran and agreed (under the gate, on
|
|
640
|
+
* request); `guards-only` otherwise — including above the gate, where the
|
|
641
|
+
* `preview:simulated-unavailable` warning rides `warnings`.
|
|
642
|
+
*/
|
|
643
|
+
readonly fidelity: "guards-only" | "simulated";
|
|
644
|
+
readonly before: readonly XlsxAiCellReadback[];
|
|
645
|
+
/** The clone's post-apply cells over the footprint when `fidelity` is `simulated`; the projected cells otherwise. */
|
|
646
|
+
readonly proposed: readonly XlsxAiCellReadback[];
|
|
647
|
+
/**
|
|
648
|
+
* When `fidelity` is `simulated`: measured on a graph built on the clone's post-apply workbook (Q2 item 6 on the
|
|
649
|
+
* clone) when every written address resolves on that graph; when one does not (a cleared target is blank after the
|
|
650
|
+
* apply), the pre-edit address-seeded impact the guards-only arm measured, unmarked (R-XBC2-2 item 5 states the
|
|
651
|
+
* condition; the DTO carries no marker of which graph a `measured` impact came from).
|
|
652
|
+
*/
|
|
653
|
+
readonly impact: XlsxAiImpact;
|
|
654
|
+
/** `preview:simulated-unavailable` when the simulated arm was asked for and the gate excluded it. */
|
|
655
|
+
readonly warnings: readonly XlsxAiRefusal[];
|
|
656
|
+
/** XBC-2, optional/additive: present whenever `fidelity: "simulated"` was requested. */
|
|
657
|
+
readonly simulatedGate?: XlsxAiSimulatedGate;
|
|
658
|
+
/**
|
|
659
|
+
* XBC-2, optional/additive: present whenever the clone arm RAN (`fidelity: "simulated"` admitted by the gate) —
|
|
660
|
+
* agreed or diverged. On a divergence the refused preview carries it with the clone arm's own `verdict` and, when
|
|
661
|
+
* the clone refused, its `cloneRefusal`; absent when the gate excluded the arm (`simulatedGate` then says why).
|
|
662
|
+
*/
|
|
663
|
+
readonly simulated?: XlsxAiSimulatedPreview;
|
|
664
|
+
}
|
|
665
|
+
export interface XlsxAiValidateRequest {
|
|
666
|
+
readonly proposal: XlsxAiSessionProposal;
|
|
667
|
+
readonly actor?: XlsxRuntimeActor;
|
|
668
|
+
readonly workflowContext?: XlsxWorkflowContextInput;
|
|
669
|
+
}
|
|
670
|
+
export interface XlsxAiValidateResult extends XlsxAiSessionStamp {
|
|
671
|
+
readonly verdict: Extract<XlsxVerdict, "validated" | "refused">;
|
|
672
|
+
readonly warnings: readonly XlsxRuntimeWarning[];
|
|
673
|
+
readonly refusal?: XlsxAiRefusal;
|
|
674
|
+
}
|
|
675
|
+
export interface XlsxAiApplyProposalRequest {
|
|
676
|
+
readonly proposal: XlsxAiSessionProposal;
|
|
677
|
+
readonly actor?: XlsxRuntimeActor;
|
|
678
|
+
/** The drain's clock and seed (D12). */
|
|
679
|
+
readonly volatileInputs?: XlsxSessionVolatileInputs;
|
|
680
|
+
readonly workflowContext?: XlsxWorkflowContextInput;
|
|
681
|
+
/**
|
|
682
|
+
* XBC-2 R1, optional/additive: answer `afterState` on the receipt (the resident's post-commit state SHA and
|
|
683
|
+
* changed-cells digest). The service sets it exactly when the staged subject carries a clone-arm prediction.
|
|
684
|
+
*/
|
|
685
|
+
readonly attestAfterState?: boolean;
|
|
686
|
+
}
|
|
687
|
+
export interface XlsxAiFenceTriple {
|
|
688
|
+
readonly epoch: string;
|
|
689
|
+
readonly revision: number;
|
|
690
|
+
readonly identity: string;
|
|
691
|
+
}
|
|
692
|
+
export interface XlsxAiDrain {
|
|
693
|
+
readonly status: "applied" | "noop" | "refused" | "failed";
|
|
694
|
+
readonly recalc: "dirty" | "full" | "none";
|
|
695
|
+
readonly evaluatedCellCount?: number;
|
|
696
|
+
readonly blocker?: XlsxAiRefusal;
|
|
697
|
+
readonly error?: string;
|
|
698
|
+
}
|
|
699
|
+
/**
|
|
700
|
+
* `XlsxAiApplyReceipt` (§5.6). `sessionFence` is the settled fence, absent
|
|
701
|
+
* when the drain failed or the session was disposed in the call.
|
|
702
|
+
*/
|
|
703
|
+
export interface XlsxAiApplyReceipt {
|
|
704
|
+
readonly verdict: Extract<XlsxVerdict, "applied" | "applied-with-warnings" | "refused">;
|
|
705
|
+
readonly dispatch: XlsxAiFenceTriple;
|
|
706
|
+
/** The apply step's own bookkeeping; the Q4 predicate reads it. */
|
|
707
|
+
readonly receipt?: XlsxAiFenceTriple;
|
|
708
|
+
readonly drain?: XlsxAiDrain;
|
|
709
|
+
/** Post-drain; absent when `drain.status` is `failed`. */
|
|
710
|
+
readonly settled?: XlsxAiSettledFence;
|
|
711
|
+
readonly undoBoundary?: XlsxRuntimeUndoBoundary;
|
|
712
|
+
readonly audit?: XlsxRuntimeAuditEnvelope;
|
|
713
|
+
readonly cells: readonly XlsxRuntimeCellReadback[];
|
|
714
|
+
readonly warnings: readonly XlsxRuntimeWarning[];
|
|
715
|
+
readonly refusal?: XlsxAiRefusal;
|
|
716
|
+
/** XBC-2 R1, optional/additive: the resident's post-commit content facts (before the drain), present exactly when `attestAfterState` was asked and the apply step passed. */
|
|
717
|
+
readonly afterState?: XlsxAiAfterState;
|
|
718
|
+
readonly defectAfterCheck: boolean;
|
|
719
|
+
readonly sessionDisposed: boolean;
|
|
720
|
+
readonly sessionFence?: XlsxSessionFence;
|
|
721
|
+
readonly sessionEpoch: string;
|
|
722
|
+
readonly revision: number;
|
|
723
|
+
}
|
|
724
|
+
export interface XlsxAiPlan {
|
|
725
|
+
/** At most 50 pairwise disjoint replacement steps. */
|
|
726
|
+
readonly steps: readonly Omit<XlsxAiSessionProposal, "expectedSessionFence">[];
|
|
727
|
+
readonly expectedSessionFence: XlsxSessionFence;
|
|
728
|
+
}
|
|
729
|
+
export interface XlsxAiApplyPlanRequest {
|
|
730
|
+
readonly plan: XlsxAiPlan;
|
|
731
|
+
readonly actor?: XlsxRuntimeActor;
|
|
732
|
+
/** Applies and reverts every step; never bookkeeps or drains. */
|
|
733
|
+
readonly dryRun?: boolean;
|
|
734
|
+
readonly volatileInputs?: XlsxSessionVolatileInputs;
|
|
735
|
+
readonly workflowContext?: XlsxWorkflowContextInput;
|
|
736
|
+
}
|
|
737
|
+
export interface XlsxAiPlanStepReceipt {
|
|
738
|
+
readonly step: number;
|
|
739
|
+
readonly scopeId: string;
|
|
740
|
+
readonly verdict: Extract<XlsxVerdict, "applied" | "applied-with-warnings">;
|
|
741
|
+
readonly warnings: readonly XlsxRuntimeWarning[];
|
|
742
|
+
}
|
|
743
|
+
export interface XlsxAiPlanReceipt {
|
|
744
|
+
readonly verdict: Extract<XlsxVerdict, "applied" | "validated" | "refused">;
|
|
745
|
+
readonly dryRun: boolean;
|
|
746
|
+
/**
|
|
747
|
+
* 64 hex once the plan was read; the boundary id embeds its first 16
|
|
748
|
+
* characters. Empty on the two pre-digest refusal arms (malformed plan body,
|
|
749
|
+
* malformed or stale plan fence), where no plan was parsed.
|
|
750
|
+
*/
|
|
751
|
+
readonly planDigest: string;
|
|
752
|
+
readonly dispatch: XlsxAiFenceTriple;
|
|
753
|
+
readonly receipt?: XlsxAiFenceTriple;
|
|
754
|
+
readonly drain?: XlsxAiDrain;
|
|
755
|
+
readonly settled?: XlsxAiSettledFence;
|
|
756
|
+
readonly undoBoundary?: XlsxRuntimeUndoBoundary;
|
|
757
|
+
readonly audit?: XlsxRuntimeAuditEnvelope;
|
|
758
|
+
readonly steps: readonly XlsxAiPlanStepReceipt[];
|
|
759
|
+
readonly failedStep?: number;
|
|
760
|
+
readonly refusal?: XlsxAiRefusal;
|
|
761
|
+
readonly sessionDisposed: boolean;
|
|
762
|
+
readonly sessionFence?: XlsxSessionFence;
|
|
763
|
+
readonly sessionEpoch: string;
|
|
764
|
+
readonly revision: number;
|
|
765
|
+
}
|