@opengeni/sdk 0.48.0 → 0.57.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 (122) hide show
  1. package/README.md +147 -1
  2. package/dist/artifact-client.d.ts +20 -2
  3. package/dist/artifacts.d.ts +4 -0
  4. package/dist/artifacts.js +11 -0
  5. package/dist/artifacts.js.map +1 -0
  6. package/dist/{chunk-V5F253OG.js → chunk-GU6JF75T.js} +6 -3
  7. package/dist/chunk-GU6JF75T.js.map +1 -0
  8. package/dist/chunk-HJ3HHUT5.js +222 -0
  9. package/dist/chunk-HJ3HHUT5.js.map +1 -0
  10. package/dist/{chunk-KIHGPM7H.js → chunk-JDLDDRNE.js} +20 -14
  11. package/dist/chunk-JDLDDRNE.js.map +1 -0
  12. package/dist/chunk-JRPFWI6T.js +128 -0
  13. package/dist/chunk-JRPFWI6T.js.map +1 -0
  14. package/dist/{chunk-MBGBLVUV.js → chunk-PKQ377ED.js} +1725 -555
  15. package/dist/chunk-PKQ377ED.js.map +1 -0
  16. package/dist/chunk-ST5DDKJP.js +987 -0
  17. package/dist/chunk-ST5DDKJP.js.map +1 -0
  18. package/dist/chunk-VWE2QIVO.js +1162 -0
  19. package/dist/chunk-VWE2QIVO.js.map +1 -0
  20. package/dist/chunk-VYCTL62C.js +230 -0
  21. package/dist/chunk-VYCTL62C.js.map +1 -0
  22. package/dist/{chunk-DXDL7EEW.js → chunk-YKZME56C.js} +197 -113
  23. package/dist/chunk-YKZME56C.js.map +1 -0
  24. package/dist/client.d.ts +240 -16
  25. package/dist/codex-realtime-controller.d.ts +9 -6
  26. package/dist/codex-realtime-controller.js +2 -2
  27. package/dist/codex-realtime-lifecycle.d.ts +1 -1
  28. package/dist/codex-realtime-v3.d.ts +3 -3
  29. package/dist/codex-realtime.d.ts +1 -1
  30. package/dist/company-profile.d.ts +100 -0
  31. package/dist/core.d.ts +5 -5
  32. package/dist/core.js +10 -5
  33. package/dist/desktop.d.ts +9 -1
  34. package/dist/editable-artifact-resources.d.ts +96 -0
  35. package/dist/editable-artifacts/browser-session.d.ts +35 -0
  36. package/dist/editable-artifacts/controller.d.ts +60 -0
  37. package/dist/editable-artifacts/errors.d.ts +23 -0
  38. package/dist/editable-artifacts/http-live-transport.d.ts +46 -0
  39. package/dist/editable-artifacts/index.d.ts +19 -0
  40. package/dist/editable-artifacts/pool.d.ts +15 -0
  41. package/dist/editable-artifacts/session.d.ts +96 -0
  42. package/dist/editable-artifacts/storage.d.ts +72 -0
  43. package/dist/editable-artifacts/types.d.ts +416 -0
  44. package/dist/editable-artifacts/worker/browser-client.d.ts +80 -0
  45. package/dist/editable-artifacts/worker/browser-entry.d.ts +6 -0
  46. package/dist/editable-artifacts/worker/kernel-adapter.d.ts +45 -0
  47. package/dist/editable-artifacts/worker/rpc-protocol.d.ts +92 -0
  48. package/dist/editable-artifacts/worker/runtime.d.ts +66 -0
  49. package/dist/editable-artifacts/worker/wire-codec.d.ts +52 -0
  50. package/dist/editable-artifacts-worker.d.ts +8 -0
  51. package/dist/editable-artifacts-worker.js +1708 -0
  52. package/dist/editable-artifacts-worker.js.map +1 -0
  53. package/dist/editable-artifacts.d.ts +6 -0
  54. package/dist/editable-artifacts.js +5954 -0
  55. package/dist/editable-artifacts.js.map +1 -0
  56. package/dist/gateway-realtime-transport.d.ts +2 -1
  57. package/dist/gateway-realtime-transport.js +5 -3
  58. package/dist/index.d.ts +45 -35
  59. package/dist/index.js +134 -64
  60. package/dist/index.js.map +1 -1
  61. package/dist/interaction-revision-stream.d.ts +11 -0
  62. package/dist/interaction.d.ts +1484 -0
  63. package/dist/interaction.js +81 -0
  64. package/dist/interaction.js.map +1 -0
  65. package/dist/memory-slack-client.d.ts +13 -0
  66. package/dist/memory-slack-delivery.d.ts +99 -0
  67. package/dist/memory-slack.d.ts +4 -0
  68. package/dist/memory-slack.js +44 -0
  69. package/dist/memory-slack.js.map +1 -0
  70. package/dist/proxy.d.ts +3 -3
  71. package/dist/realtime.d.ts +14 -14
  72. package/dist/realtime.js +11 -7
  73. package/dist/realtime.js.map +1 -1
  74. package/dist/retained-artifacts.d.ts +12 -0
  75. package/dist/stream.d.ts +1 -1
  76. package/dist/terminal.d.ts +1 -1
  77. package/dist/types.d.ts +1347 -34
  78. package/dist/workspace-control-stream.d.ts +2 -2
  79. package/dist/workspace-live-stream.d.ts +14 -0
  80. package/dist/workspace-state.d.ts +1 -1
  81. package/package.json +29 -3
  82. package/src/artifact-client.ts +129 -0
  83. package/src/artifacts.ts +17 -0
  84. package/src/client.ts +3022 -910
  85. package/src/codex-realtime-controller.ts +25 -7
  86. package/src/codex-realtime-lifecycle.ts +1 -0
  87. package/src/company-profile.ts +92 -0
  88. package/src/desktop.ts +11 -1
  89. package/src/editable-artifact-resources.ts +119 -0
  90. package/src/editable-artifacts/browser-session.ts +176 -0
  91. package/src/editable-artifacts/controller.ts +2632 -0
  92. package/src/editable-artifacts/errors.ts +52 -0
  93. package/src/editable-artifacts/http-live-transport.ts +1449 -0
  94. package/src/editable-artifacts/index.ts +175 -0
  95. package/src/editable-artifacts/pool.ts +81 -0
  96. package/src/editable-artifacts/session.ts +778 -0
  97. package/src/editable-artifacts/storage.ts +1718 -0
  98. package/src/editable-artifacts/types.ts +499 -0
  99. package/src/editable-artifacts/worker/browser-client.ts +1167 -0
  100. package/src/editable-artifacts/worker/browser-entry.ts +57 -0
  101. package/src/editable-artifacts/worker/kernel-adapter.ts +1039 -0
  102. package/src/editable-artifacts/worker/rpc-protocol.ts +622 -0
  103. package/src/editable-artifacts/worker/runtime.ts +1204 -0
  104. package/src/editable-artifacts/worker/wire-codec.ts +852 -0
  105. package/src/editable-artifacts-worker.ts +8 -0
  106. package/src/editable-artifacts.ts +6 -0
  107. package/src/errors.ts +16 -2
  108. package/src/gateway-realtime-transport.ts +252 -109
  109. package/src/index.ts +215 -1
  110. package/src/interaction-revision-stream.ts +117 -0
  111. package/src/interaction.ts +2874 -0
  112. package/src/memory-slack-client.ts +71 -0
  113. package/src/memory-slack-delivery.ts +128 -0
  114. package/src/memory-slack.ts +19 -0
  115. package/src/realtime.ts +14 -4
  116. package/src/retained-artifacts.ts +326 -0
  117. package/src/types.ts +1636 -52
  118. package/src/workspace-live-stream.ts +137 -0
  119. package/dist/chunk-DXDL7EEW.js.map +0 -1
  120. package/dist/chunk-KIHGPM7H.js.map +0 -1
  121. package/dist/chunk-MBGBLVUV.js.map +0 -1
  122. package/dist/chunk-V5F253OG.js.map +0 -1
@@ -0,0 +1,499 @@
1
+ /** Opaque artifact identity. Workspace authority is carried by the ticket. */
2
+ export type EditableArtifactId = string;
3
+
4
+ export type EditableArtifactModality = "document" | "spreadsheet" | "presentation";
5
+ export type EditableArtifactSerializedModality = Exclude<EditableArtifactModality, "spreadsheet">;
6
+
7
+ export type EditableArtifactCausalEntry = Readonly<{
8
+ replicaId: string;
9
+ counter: number;
10
+ }>;
11
+
12
+ /** Sorted by replicaId, duplicate-free. */
13
+ export type EditableArtifactCausalFrontier = readonly EditableArtifactCausalEntry[];
14
+
15
+ /**
16
+ * Short-lived, artifact-scoped credential minted over authenticated HTTP.
17
+ * Implementations must never put a durable bearer token in a socket URL.
18
+ */
19
+ export type EditableArtifactSyncTicket = {
20
+ artifactId: EditableArtifactId;
21
+ modality: EditableArtifactModality;
22
+ replicaId: string;
23
+ token: string;
24
+ expiresAt: string;
25
+ protocolVersion: number;
26
+ };
27
+
28
+ /** Immutable, server-verified canonical state. */
29
+ type EditableArtifactSnapshotCommon = {
30
+ artifactId: EditableArtifactId;
31
+ sequence: number;
32
+ stateHash: string;
33
+ digest: string;
34
+ kernelVersion: string;
35
+ modelSchemaVersion: number;
36
+ bytes: Uint8Array;
37
+ };
38
+
39
+ export type EditableArtifactSpreadsheetSnapshot = EditableArtifactSnapshotCommon & {
40
+ modality: "spreadsheet";
41
+ causalFrontier: EditableArtifactCausalFrontier;
42
+ protocolVersion: number;
43
+ };
44
+
45
+ export type EditableArtifactSerializedSnapshot = EditableArtifactSnapshotCommon & {
46
+ modality: EditableArtifactSerializedModality;
47
+ nativeRevision: number;
48
+ };
49
+
50
+ export type EditableArtifactSnapshot =
51
+ | EditableArtifactSpreadsheetSnapshot
52
+ | EditableArtifactSerializedSnapshot;
53
+
54
+ /** One authoritative, atomically committed artifact transaction. */
55
+ type EditableArtifactCommittedTransactionCommon = {
56
+ artifactId: EditableArtifactId;
57
+ transactionId: string;
58
+ requestHash: string;
59
+ startSequence: number;
60
+ endSequence: number;
61
+ priorStateHash: string;
62
+ stateHash: string;
63
+ committedTransactionBytes: Uint8Array;
64
+ };
65
+
66
+ export type EditableArtifactSpreadsheetCommittedTransaction =
67
+ EditableArtifactCommittedTransactionCommon & {
68
+ modality: "spreadsheet";
69
+ causalFrontier: EditableArtifactCausalFrontier;
70
+ protocolVersion: number;
71
+ /** Exact whole canonical OGACO committed-transaction envelope. */
72
+ committedTransactionBytes: Uint8Array;
73
+ };
74
+
75
+ export type EditableArtifactSerializedCommittedTransaction =
76
+ EditableArtifactCommittedTransactionCommon & {
77
+ modality: EditableArtifactSerializedModality;
78
+ priorNativeRevision: number;
79
+ nativeRevision: number;
80
+ commitProtocolVersion: number;
81
+ /** Exact whole canonical OGAST committed-transaction envelope. */
82
+ committedTransactionBytes: Uint8Array;
83
+ };
84
+
85
+ export type EditableArtifactCommittedTransaction =
86
+ | EditableArtifactSpreadsheetCommittedTransaction
87
+ | EditableArtifactSerializedCommittedTransaction;
88
+
89
+ /** A locally durable command batch. Retried with exactly the same identity. */
90
+ type EditableArtifactPendingTransactionCommon = {
91
+ artifactId: EditableArtifactId;
92
+ /** Caller-authored portable OGATX client transaction identity. */
93
+ clientTransactionId: string;
94
+ requestHash: string;
95
+ protocolVersion: number;
96
+ modelSchemaVersion: number;
97
+ commandVersion: number;
98
+ replicaId: string;
99
+ /** Monotonic within one persisted replica epoch; never changed on retry. */
100
+ replicaCounter: number;
101
+ /** Symbolic predecessor resolved by the server to that transaction's causal stamp. */
102
+ previousLocalTransactionId: string | null;
103
+ observedHeadSequence: number;
104
+ commandBytes: Uint8Array;
105
+ /** Exact OGATX001 bytes persisted and retried byte-identically. */
106
+ intentBytes: Uint8Array;
107
+ createdAt: number;
108
+ };
109
+
110
+ export type EditableArtifactSpreadsheetPendingTransaction =
111
+ EditableArtifactPendingTransactionCommon & {
112
+ modality: "spreadsheet";
113
+ causalBase: EditableArtifactCausalFrontier;
114
+ selectiveUndoTargets: readonly string[];
115
+ };
116
+
117
+ export type EditableArtifactSerializedPendingTransaction =
118
+ EditableArtifactPendingTransactionCommon & {
119
+ modality: EditableArtifactSerializedModality;
120
+ /** Local proof that the strictly serialized command was authored over this native revision. */
121
+ observedNativeRevision: number;
122
+ };
123
+
124
+ export type EditableArtifactPendingTransaction =
125
+ | EditableArtifactSpreadsheetPendingTransaction
126
+ | EditableArtifactSerializedPendingTransaction;
127
+
128
+ export type EditableArtifactBlockedPending = Readonly<{
129
+ clientTransactionId: string;
130
+ code: string;
131
+ }>;
132
+
133
+ /** A bounded, sparse spreadsheet viewport requested from the Worker-owned kernel. */
134
+ export type EditableSpreadsheetViewportQuery = Readonly<{
135
+ sheetId: string;
136
+ startRow: number;
137
+ startColumn: number;
138
+ rowCount: number;
139
+ columnCount: number;
140
+ /** Hard-clamped by the Worker/kernel; never permits a partial response. */
141
+ maxCells?: number;
142
+ /** Hard-clamped by the Worker/kernel; never permits a partial response. */
143
+ maxBytes?: number;
144
+ }>;
145
+
146
+ export type EditableSpreadsheetFormulaError =
147
+ | "null"
148
+ | "divide_by_zero"
149
+ | "value"
150
+ | "reference"
151
+ | "name"
152
+ | "number"
153
+ | "not_available"
154
+ | "spill"
155
+ | "calculation"
156
+ | Readonly<{ custom: string }>;
157
+
158
+ export type EditableSpreadsheetCellValue =
159
+ | Readonly<{ kind: "empty" }>
160
+ | Readonly<{ kind: "boolean"; value: boolean }>
161
+ | Readonly<{ kind: "number"; value: number }>
162
+ /** Canonical `Date.prototype.toISOString()` output; never a numeric serial. */
163
+ | Readonly<{ kind: "date"; value: string }>
164
+ | Readonly<{ kind: "text"; value: string }>
165
+ | Readonly<{ kind: "error"; value: EditableSpreadsheetFormulaError }>;
166
+
167
+ export type EditableSpreadsheetProjectedCell = Readonly<{
168
+ row: number;
169
+ column: number;
170
+ formula: string | null;
171
+ value: EditableSpreadsheetCellValue;
172
+ }>;
173
+
174
+ /**
175
+ * Immutable projection of one exact speculative kernel revision. Cells are
176
+ * sparse, strictly row-major, unique, and all inside the requested rectangle.
177
+ */
178
+ export type EditableSpreadsheetViewportProjection = Readonly<{
179
+ revision: bigint;
180
+ sheetId: string;
181
+ /** Creation operation that pins the live CRDT generation, if collaborative. */
182
+ generationId: string | null;
183
+ startRow: number;
184
+ startColumn: number;
185
+ rowCount: number;
186
+ columnCount: number;
187
+ cells: readonly EditableSpreadsheetProjectedCell[];
188
+ }>;
189
+
190
+ export type EditableSpreadsheetUsedBounds = Readonly<{
191
+ startRow: number;
192
+ startColumn: number;
193
+ /** Inclusive maximum occupied row. */
194
+ endRow: number;
195
+ /** Inclusive maximum occupied column. */
196
+ endColumn: number;
197
+ }>;
198
+
199
+ export type EditableSpreadsheetSheetMetadata = Readonly<{
200
+ sheetId: string;
201
+ generationId: string | null;
202
+ name: string;
203
+ usedBounds: EditableSpreadsheetUsedBounds | null;
204
+ }>;
205
+
206
+ /**
207
+ * Bounded workbook catalog from the Worker-owned kernel. False feature flags
208
+ * mean the kernel does not model that feature; the SDK never invents authority.
209
+ */
210
+ export type EditableSpreadsheetMetadataProjection = Readonly<{
211
+ revision: bigint;
212
+ modeledFeatures: Readonly<{
213
+ dimensions: boolean;
214
+ hidden: boolean;
215
+ merges: boolean;
216
+ }>;
217
+ sheets: readonly EditableSpreadsheetSheetMetadata[];
218
+ }>;
219
+
220
+ export type EditableSpreadsheetMetadataQuery = Readonly<{
221
+ maxSheets?: number;
222
+ maxBytes?: number;
223
+ }>;
224
+
225
+ export type EditableArtifactStoredReplica = {
226
+ artifactId: EditableArtifactId;
227
+ modality: EditableArtifactModality;
228
+ /** Last immutable server snapshot loaded and verified by the kernel. */
229
+ snapshot: EditableArtifactSnapshot;
230
+ /** Contiguous committed tail needed to reconstruct `cursor` after reload. */
231
+ tail: EditableArtifactCommittedTransaction[];
232
+ cursor: number;
233
+ stateHash: string;
234
+ updatedAt: number;
235
+ };
236
+
237
+ type EditableArtifactBootstrapCommon = {
238
+ artifactId: EditableArtifactId;
239
+ protocolVersion: number;
240
+ headSequence: number;
241
+ headStateHash: string;
242
+ kernelVersion: string;
243
+ modelSchemaVersion: number;
244
+ writable: boolean;
245
+ /** Earliest sequence still available through replay, inclusive. */
246
+ minimumReplaySequence: number;
247
+ /** Supplied for first load, requested resync, or a newer compact snapshot. */
248
+ snapshot: EditableArtifactSnapshot | null;
249
+ /** Server has expired this replica's history and requires a fresh snapshot. */
250
+ resyncRequired: boolean;
251
+ };
252
+
253
+ export type EditableArtifactBootstrap = EditableArtifactBootstrapCommon &
254
+ (
255
+ | {
256
+ modality: "spreadsheet";
257
+ headCausalFrontier: EditableArtifactCausalFrontier;
258
+ }
259
+ | {
260
+ modality: EditableArtifactSerializedModality;
261
+ headNativeRevision: number;
262
+ }
263
+ );
264
+
265
+ export type EditableArtifactReplayPage = {
266
+ artifactId: EditableArtifactId;
267
+ transactions: EditableArtifactCommittedTransaction[];
268
+ headSequence: number;
269
+ };
270
+
271
+ export type EditableArtifactSubmitReceipt = {
272
+ artifactId: EditableArtifactId;
273
+ /** Exact OGATX client identity acknowledged by the authority. */
274
+ clientTransactionId: string;
275
+ /** Authoritative OGACO (spreadsheet) or OGAST (document/presentation) transaction identity. */
276
+ transactionId: string;
277
+ requestHash: string;
278
+ committed: EditableArtifactCommittedTransaction;
279
+ };
280
+
281
+ export type EditableArtifactLiveMessage =
282
+ | {
283
+ type: "transaction.committed";
284
+ transaction: EditableArtifactCommittedTransaction;
285
+ }
286
+ | {
287
+ type: "head";
288
+ artifactId: EditableArtifactId;
289
+ headSequence: number;
290
+ }
291
+ | {
292
+ type: "authorization";
293
+ artifactId: EditableArtifactId;
294
+ writable: boolean;
295
+ }
296
+ | {
297
+ type: "resync_required";
298
+ artifactId: EditableArtifactId;
299
+ reason: string;
300
+ };
301
+
302
+ export type EditableArtifactLiveClose = {
303
+ reason: "closed" | "ticket_expired" | "transport_error" | "permission_changed";
304
+ error?: unknown;
305
+ };
306
+
307
+ /** Exact limits advertised by the authenticated OGALV stream epoch. */
308
+ export type EditableArtifactLiveLimits = Readonly<{
309
+ maxClientFrameBytes: number;
310
+ maxCommandBytes: number;
311
+ maxIntentBytes: number;
312
+ maxCommittedTransactionBytes: number;
313
+ maxSnapshotBytes: number;
314
+ maxInFlightTransactions: number;
315
+ maxInFlightBytes: number;
316
+ }>;
317
+
318
+ export type EditableArtifactLiveConnection = {
319
+ /** Opaque server session binding subscription, retention lease, and bootstrap. */
320
+ streamEpoch: string;
321
+ limits: EditableArtifactLiveLimits;
322
+ readBootstrap: (input: {
323
+ localCursor: number | null;
324
+ localStateHash: string | null;
325
+ resume:
326
+ | {
327
+ modality: "spreadsheet";
328
+ localCausalFrontier: EditableArtifactCausalFrontier;
329
+ }
330
+ | {
331
+ modality: EditableArtifactSerializedModality;
332
+ localNativeRevision: number | null;
333
+ };
334
+ requireSnapshot: boolean;
335
+ signal: AbortSignal;
336
+ }) => Promise<EditableArtifactBootstrap>;
337
+ replay: (input: {
338
+ after: number;
339
+ through: number;
340
+ limit: number;
341
+ signal: AbortSignal;
342
+ }) => Promise<EditableArtifactReplayPage>;
343
+ submit: (input: {
344
+ transaction: EditableArtifactPendingTransaction;
345
+ signal: AbortSignal;
346
+ }) => Promise<EditableArtifactSubmitReceipt>;
347
+ acknowledge: (input: {
348
+ sequence: number;
349
+ stateHash: string;
350
+ signal: AbortSignal;
351
+ }) => Promise<void>;
352
+ /** Resolves once for every local or remote close. */
353
+ closed: Promise<EditableArtifactLiveClose>;
354
+ close: (reason?: string) => void;
355
+ };
356
+
357
+ /** HTTP/WebSocket details live behind this boundary. */
358
+ export type EditableArtifactSyncTransport = {
359
+ mintTicket: (input: {
360
+ artifactId: EditableArtifactId;
361
+ replicaId: string;
362
+ signal: AbortSignal;
363
+ }) => Promise<EditableArtifactSyncTicket>;
364
+ /** Must subscribe before returning; bootstrap is read only after this call. */
365
+ openLive: (input: {
366
+ ticket: EditableArtifactSyncTicket;
367
+ after: number;
368
+ stateHash: string | null;
369
+ resume:
370
+ | {
371
+ modality: "spreadsheet";
372
+ causalFrontier: EditableArtifactCausalFrontier;
373
+ }
374
+ | {
375
+ modality: EditableArtifactSerializedModality;
376
+ nativeRevision: number | null;
377
+ };
378
+ requireSnapshot: boolean;
379
+ signal: AbortSignal;
380
+ onMessage: (message: EditableArtifactLiveMessage) => void;
381
+ }) => Promise<EditableArtifactLiveConnection>;
382
+ };
383
+
384
+ /**
385
+ * Implemented by a dedicated browser Worker around the WASM kernel. The
386
+ * controller never mutates artifact state on the UI thread.
387
+ */
388
+ export type EditableArtifactWorkerKernel = {
389
+ reset: () => Promise<void>;
390
+ /** Computes the digest over owned bytes inside the Worker. */
391
+ loadSnapshot: (
392
+ snapshot: EditableArtifactSnapshot,
393
+ ) => Promise<{ stateHash: string; digest: string }>;
394
+ /** Rebuild-only path used before bootstrap exposes a visible revision. */
395
+ applyRecovered: (
396
+ transaction: EditableArtifactCommittedTransaction,
397
+ ) => Promise<{ stateHash: string }>;
398
+ /** Atomically commits confirmed state and publishes the rebased speculative layer. */
399
+ reconcileCommitted: (
400
+ transaction: EditableArtifactCommittedTransaction,
401
+ remainingPending: readonly EditableArtifactPendingTransaction[],
402
+ ) => Promise<{ stateHash: string; blockedPending: readonly EditableArtifactBlockedPending[] }>;
403
+ /** Rebuilds the speculative layer without changing confirmed authority. */
404
+ replacePending: (
405
+ transactions: readonly EditableArtifactPendingTransaction[],
406
+ ) => Promise<{ blockedPending: readonly EditableArtifactBlockedPending[] }>;
407
+ /** Canonical encoding + request hashing occurs off the UI thread. */
408
+ authorPending: (input: {
409
+ modality: EditableArtifactModality;
410
+ protocolVersion: number;
411
+ kernelVersion: string;
412
+ modelSchemaVersion: number;
413
+ commandVersion: number;
414
+ artifactId: EditableArtifactId;
415
+ clientTransactionId: string;
416
+ replicaId: string;
417
+ replicaCounter: number;
418
+ previousLocalTransactionId: string | null;
419
+ observedHeadSequence: number;
420
+ causalBase?: EditableArtifactCausalFrontier;
421
+ selectiveUndoTargets?: readonly string[];
422
+ commandBytes: Uint8Array;
423
+ createdAt: number;
424
+ }) => Promise<EditableArtifactPendingTransaction>;
425
+ /** Runs against the speculative fork; canonical state remains Worker-only. */
426
+ querySpreadsheetViewport: (
427
+ query: EditableSpreadsheetViewportQuery,
428
+ ) => Promise<EditableSpreadsheetViewportProjection>;
429
+ querySpreadsheetMetadata: (
430
+ query?: EditableSpreadsheetMetadataQuery,
431
+ ) => Promise<EditableSpreadsheetMetadataProjection>;
432
+ /** Canonical, bounded document projection produced by the real Worker WASM session. */
433
+ queryDocument: (query: DocumentArtifactQuery) => Promise<DocumentArtifactProjection>;
434
+ /** Canonical, bounded presentation projection produced by the real Worker WASM session. */
435
+ queryPresentation: (
436
+ query: PresentationArtifactQuery,
437
+ ) => Promise<PresentationArtifactQueryResponse>;
438
+ };
439
+
440
+ export type EditableDocumentQuery = DocumentArtifactQuery;
441
+ export type EditableDocumentProjection = DocumentArtifactProjection;
442
+ export type EditablePresentationQuery = PresentationArtifactQuery;
443
+ export type EditablePresentationProjection = PresentationArtifactQueryResponse;
444
+ export type EditablePresentationSlideCatalogQuery = Extract<
445
+ PresentationArtifactQuery,
446
+ { kind: "slide-catalog" }
447
+ >;
448
+ export type EditablePresentationEditorSlideQuery = Extract<
449
+ PresentationArtifactQuery,
450
+ { kind: "editor-slide" }
451
+ >;
452
+ export type EditablePresentationSlideCatalogProjection = Extract<
453
+ PresentationArtifactQueryResponse,
454
+ { kind: "slide-catalog" }
455
+ >;
456
+ export type EditablePresentationEditorSlideProjection = Extract<
457
+ PresentationArtifactQueryResponse,
458
+ { kind: "editor-slide" }
459
+ >;
460
+
461
+ export type EditableArtifactSyncState =
462
+ | "idle"
463
+ | "connecting"
464
+ | "syncing"
465
+ | "live"
466
+ | "reconnecting"
467
+ | "resyncing"
468
+ | "unsupported"
469
+ | "failed"
470
+ | "closed";
471
+
472
+ export type EditableArtifactSyncView = {
473
+ artifactId: EditableArtifactId;
474
+ modality: EditableArtifactModality;
475
+ state: EditableArtifactSyncState;
476
+ cursor: number;
477
+ headSequence: number;
478
+ writable: boolean;
479
+ pendingTransactions: number;
480
+ blockedPending: readonly EditableArtifactBlockedPending[];
481
+ queuedMessages: number;
482
+ reconnectAttempt: number;
483
+ lastError: Error | null;
484
+ };
485
+
486
+ export type EditableArtifactSyncListener = (view: EditableArtifactSyncView) => void;
487
+
488
+ export type EditableArtifactSyncScheduler = {
489
+ now: () => number;
490
+ sleep: (delayMs: number, signal: AbortSignal) => Promise<void>;
491
+ };
492
+ import type {
493
+ DocumentArtifactProjection,
494
+ DocumentArtifactQuery,
495
+ } from "@opengeni/contracts/document-artifact-query";
496
+ import type {
497
+ PresentationArtifactQuery,
498
+ PresentationArtifactQueryResponse,
499
+ } from "@opengeni/contracts/presentation-artifact-query";