@opengeni/contracts 0.50.0 → 1.0.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/dist/agent-authored-durable-text.d.ts +70 -0
- package/dist/agent-config.d.ts +869 -0
- package/dist/agent-instruction-changes.d.ts +110 -0
- package/dist/agent-learning.d.ts +243 -0
- package/dist/agent-topology.d.ts +292 -0
- package/dist/allowance-refusal.d.ts +9 -0
- package/dist/allowance-refusal.js +50 -0
- package/dist/allowance-refusal.js.map +1 -0
- package/dist/analytics-consent-report.d.ts +19 -0
- package/dist/analytics-consent-report.js +10 -0
- package/dist/analytics-consent-report.js.map +1 -0
- package/dist/api-key-presets.d.ts +19 -0
- package/dist/artifact-catalog.d.ts +161 -0
- package/dist/artifacts.d.ts +135 -11
- package/dist/atlassian-native-retirement.d.ts +16 -0
- package/dist/atlassian-native-retirement.js +30 -0
- package/dist/atlassian-native-retirement.js.map +1 -0
- package/dist/atlassian.d.ts +2 -0
- package/dist/atlassian.js +26 -12
- package/dist/browser-storage.d.ts +5 -0
- package/dist/browser-storage.js +9 -0
- package/dist/browser-storage.js.map +1 -0
- package/dist/bundled-skills.d.ts +40 -0
- package/dist/chunk-2ACYHZFB.js +292 -0
- package/dist/chunk-2ACYHZFB.js.map +1 -0
- package/dist/chunk-2VORLN2R.js +353 -0
- package/dist/chunk-2VORLN2R.js.map +1 -0
- package/dist/{chunk-Y3MLSLB4.js → chunk-3SIZGL3O.js} +42 -30
- package/dist/chunk-3SIZGL3O.js.map +1 -0
- package/dist/chunk-46KLD2UH.js +186 -0
- package/dist/chunk-46KLD2UH.js.map +1 -0
- package/dist/chunk-4JGHSSB7.js +11 -0
- package/dist/chunk-4JGHSSB7.js.map +1 -0
- package/dist/{chunk-M5ZGRVIQ.js → chunk-5IXYF6XN.js} +14 -5
- package/dist/chunk-5IXYF6XN.js.map +1 -0
- package/dist/chunk-BCS7WHCK.js +139 -0
- package/dist/chunk-BCS7WHCK.js.map +1 -0
- package/dist/chunk-EK7NDGFR.js +128 -0
- package/dist/chunk-EK7NDGFR.js.map +1 -0
- package/dist/{chunk-5UDNP7AO.js → chunk-FZ6BXQHL.js} +78 -38
- package/dist/chunk-FZ6BXQHL.js.map +1 -0
- package/dist/{chunk-CM6BMECR.js → chunk-GRG7PHWQ.js} +2 -1
- package/dist/chunk-GRG7PHWQ.js.map +1 -0
- package/dist/chunk-KHHZTBP7.js +11 -0
- package/dist/chunk-KHHZTBP7.js.map +1 -0
- package/dist/chunk-KR2V42UZ.js +187 -0
- package/dist/chunk-KR2V42UZ.js.map +1 -0
- package/dist/chunk-MZLBPKFE.js +168 -0
- package/dist/chunk-MZLBPKFE.js.map +1 -0
- package/dist/{chunk-LW7OH6CS.js → chunk-NRMCVHAU.js} +6 -5
- package/dist/chunk-NRMCVHAU.js.map +1 -0
- package/dist/{chunk-TZ6YEYN4.js → chunk-NVJMJWLL.js} +3 -1
- package/dist/chunk-NVJMJWLL.js.map +1 -0
- package/dist/chunk-O77VSFYZ.js +70 -0
- package/dist/chunk-O77VSFYZ.js.map +1 -0
- package/dist/chunk-PX3VCKAU.js +29 -0
- package/dist/chunk-PX3VCKAU.js.map +1 -0
- package/dist/chunk-QR5D2IQC.js +61 -0
- package/dist/chunk-QR5D2IQC.js.map +1 -0
- package/dist/chunk-RJ76DRPO.js +117 -0
- package/dist/chunk-RJ76DRPO.js.map +1 -0
- package/dist/chunk-RKX3NQYS.js +28 -0
- package/dist/chunk-RKX3NQYS.js.map +1 -0
- package/dist/{chunk-JBCIY7QD.js → chunk-SIOU2K4U.js} +45 -22
- package/dist/chunk-SIOU2K4U.js.map +1 -0
- package/dist/chunk-TSCDAGET.js +75 -0
- package/dist/chunk-TSCDAGET.js.map +1 -0
- package/dist/{chunk-LSB7GRLG.js → chunk-TXTQIYCV.js} +15 -11
- package/dist/chunk-TXTQIYCV.js.map +1 -0
- package/dist/chunk-X7ETVO4P.js +26544 -0
- package/dist/chunk-X7ETVO4P.js.map +1 -0
- package/dist/{chunk-CADSX6UN.js → chunk-Y3KNXVTD.js} +2 -2
- package/dist/chunk-YBW5JSA3.js +251 -0
- package/dist/chunk-YBW5JSA3.js.map +1 -0
- package/dist/chunk-YRXAWWCU.js +45 -0
- package/dist/chunk-YRXAWWCU.js.map +1 -0
- package/dist/claude-provider-account-authority.d.ts +18 -0
- package/dist/claude-subscription-oauth.d.ts +42 -0
- package/dist/claude-subscription-usage.d.ts +159 -0
- package/dist/client-error-report.d.ts +109 -0
- package/dist/client-error-report.js +87 -0
- package/dist/client-error-report.js.map +1 -0
- package/dist/code-search.d.ts +52 -0
- package/dist/code-search.js +40 -0
- package/dist/code-search.js.map +1 -0
- package/dist/company-brain-governed-writes.d.ts +475 -0
- package/dist/company-brain.d.ts +336 -0
- package/dist/company-profile.d.ts +566 -0
- package/dist/connect.d.ts +325 -0
- package/dist/connect.js +191 -0
- package/dist/connect.js.map +1 -0
- package/dist/connection-account-label.d.ts +2 -0
- package/dist/connection-account-label.js +35 -0
- package/dist/connection-account-label.js.map +1 -0
- package/dist/connection-authority.d.ts +193 -0
- package/dist/connection-authority.js +50 -0
- package/dist/connection-authority.js.map +1 -0
- package/dist/connector-attachments.d.ts +95 -0
- package/dist/connector-attachments.js +51 -0
- package/dist/connector-attachments.js.map +1 -0
- package/dist/connector-tool-permissions.d.ts +73 -0
- package/dist/direct-model-provider.d.ts +36 -0
- package/dist/editable-artifact-codec-registry.d.ts +16 -7
- package/dist/editable-artifact-codec-registry.js +18 -8
- package/dist/editable-artifact-committed-transaction.d.ts +2 -2
- package/dist/editable-artifact-committed-transaction.js +2 -2
- package/dist/editable-artifact-live.d.ts +11 -12
- package/dist/editable-artifact-live.js +110 -45
- package/dist/editable-artifact-live.js.map +1 -1
- package/dist/editable-artifact-serialized-commit.d.ts +2 -1
- package/dist/editable-artifact-serialized-commit.js +8 -7
- package/dist/editable-artifact-versions.d.ts +20 -5
- package/dist/editable-artifact-versions.js +23 -5
- package/dist/editable-artifacts.d.ts +2 -0
- package/dist/editable-artifacts.js +47 -35
- package/dist/external-identities.d.ts +784 -0
- package/dist/external-identities.js +44 -0
- package/dist/external-identities.js.map +1 -0
- package/dist/feedback.d.ts +51 -0
- package/dist/github-repository-contracts.d.ts +36 -0
- package/dist/github-repository-contracts.js +59 -0
- package/dist/github-repository-contracts.js.map +1 -0
- package/dist/github-repository.d.ts +14 -0
- package/dist/github-repository.js +36 -0
- package/dist/github-repository.js.map +1 -0
- package/dist/google-drive.d.ts +90 -1
- package/dist/google-drive.js +90 -16
- package/dist/google-drive.js.map +1 -1
- package/dist/governed-learning-activation.d.ts +154 -0
- package/dist/governed-learning-evaluator.d.ts +152 -0
- package/dist/host-mcp-bindings.d.ts +326 -0
- package/dist/host-mcp-bindings.js +252 -0
- package/dist/host-mcp-bindings.js.map +1 -0
- package/dist/image-generation.d.ts +1 -0
- package/dist/index.d.ts +32396 -11386
- package/dist/index.js +2198 -164
- package/dist/insights-usage.d.ts +877 -0
- package/dist/insights-usage.js +509 -0
- package/dist/insights-usage.js.map +1 -0
- package/dist/interaction.d.ts +344 -0
- package/dist/knowledge-entries.d.ts +982 -0
- package/dist/knowledge-preparation.d.ts +237 -0
- package/dist/knowledge.d.ts +197 -0
- package/dist/managed-auth-session-sets.d.ts +241 -0
- package/dist/managed-auth-session-sets.js +191 -0
- package/dist/managed-auth-session-sets.js.map +1 -0
- package/dist/managed-sign-in-methods.d.ts +56 -0
- package/dist/managed-sign-in-methods.js +46 -0
- package/dist/managed-sign-in-methods.js.map +1 -0
- package/dist/mcp-catalog-limits.d.ts +2 -0
- package/dist/mcp-endpoint.d.ts +7 -0
- package/dist/mcp-endpoint.js +9 -0
- package/dist/mcp-endpoint.js.map +1 -0
- package/dist/mcp-oauth.d.ts +71 -0
- package/dist/modal-native-proof-v2.d.ts +587 -0
- package/dist/modal-native-proof-v2.js +37 -0
- package/dist/modal-native-proof-v2.js.map +1 -0
- package/dist/model-availability.d.ts +15 -0
- package/dist/model-connection-access.d.ts +24 -0
- package/dist/model-context-inspector.d.ts +329 -0
- package/dist/model-display.d.ts +38 -0
- package/dist/model-display.js +134 -0
- package/dist/model-display.js.map +1 -0
- package/dist/model-picker-order.d.ts +25 -0
- package/dist/model-picker-order.js +42 -0
- package/dist/model-picker-order.js.map +1 -0
- package/dist/organization-access.d.ts +231 -0
- package/dist/organization-access.js +34 -0
- package/dist/organization-access.js.map +1 -0
- package/dist/organization-integration-policy.d.ts +27 -0
- package/dist/organization-membership-lifecycle.d.ts +1022 -0
- package/dist/organization-model-usage.d.ts +146 -0
- package/dist/organization-model-usage.js +67 -0
- package/dist/organization-model-usage.js.map +1 -0
- package/dist/organization-recovery.d.ts +337 -0
- package/dist/organization-recovery.js +37 -0
- package/dist/organization-recovery.js.map +1 -0
- package/dist/organization-usage.d.ts +138 -0
- package/dist/permissions.d.ts +54 -0
- package/dist/personal-github.d.ts +320 -0
- package/dist/personal-github.js +222 -0
- package/dist/personal-github.js.map +1 -0
- package/dist/plugin-discovery.d.ts +35 -0
- package/dist/plugin-discovery.js +7 -0
- package/dist/plugin-discovery.js.map +1 -0
- package/dist/preference-registry.d.ts +44 -1
- package/dist/product-analytics.d.ts +113 -0
- package/dist/product-lifecycle-facts.d.ts +73 -0
- package/dist/remember.d.ts +350 -0
- package/dist/retained-output.d.ts +8 -0
- package/dist/sandbox-file-artifacts.d.ts +57 -0
- package/dist/sandbox-provider-command.d.ts +113 -0
- package/dist/sandbox-recovery.d.ts +146 -0
- package/dist/sandbox-snapshots.d.ts +39 -0
- package/dist/session-final-reply.d.ts +6 -0
- package/dist/session-final-reply.js +9 -0
- package/dist/session-final-reply.js.map +1 -0
- package/dist/session-goal-reports.d.ts +21 -0
- package/dist/session-history-import.d.ts +947 -0
- package/dist/session-list-entries.d.ts +4 -0
- package/dist/session-list-entries.js +51 -0
- package/dist/session-list-entries.js.map +1 -0
- package/dist/session-mcp-projections.d.ts +215 -0
- package/dist/session-message-search.d.ts +68 -0
- package/dist/session-titles.d.ts +68 -0
- package/dist/session-titles.js +25 -0
- package/dist/session-titles.js.map +1 -0
- package/dist/session-topology-primitives.d.ts +22 -0
- package/dist/signup-attribution.d.ts +39 -0
- package/dist/site-request-headers.test.d.ts +1 -0
- package/dist/site-session-http.d.ts +11 -0
- package/dist/site-session-http.js +11 -0
- package/dist/site-session-http.js.map +1 -0
- package/dist/skill-catalog-context.d.ts +7 -0
- package/dist/skill-files.d.ts +12 -0
- package/dist/skill-metadata.d.ts +9 -0
- package/dist/skill-use.d.ts +61 -0
- package/dist/skills.d.ts +185 -0
- package/dist/slack-bot-scopes.d.ts +46 -21
- package/dist/slack-bot-scopes.js +14 -3
- package/dist/slack-rest-mcp.d.ts +31 -0
- package/dist/slack-rest-mcp.js +19 -0
- package/dist/slack-rest-mcp.js.map +1 -0
- package/dist/spreadsheet-artifact-commands.d.ts +2 -3
- package/dist/spreadsheet-artifact-commands.js +4 -2
- package/dist/spreadsheet-artifact-query.js +3 -2
- package/dist/subscription-account-pools.d.ts +292 -0
- package/dist/task-notes.d.ts +42 -1
- package/dist/tool-catalog.d.ts +286 -0
- package/dist/tool-result-spill.d.ts +16 -0
- package/dist/usage-allowances.d.ts +285 -0
- package/dist/usage-allowances.js +49 -0
- package/dist/usage-allowances.js.map +1 -0
- package/dist/video-generation.d.ts +3 -0
- package/dist/video-generation.js +1 -1
- package/dist/work-claims.d.ts +411 -0
- package/dist/workspace-instruction-policies.d.ts +94 -0
- package/dist/workspace-integration-wire.d.ts +36 -0
- package/dist/workspace-integration-wire.js +23 -0
- package/dist/workspace-integration-wire.js.map +1 -0
- package/dist/workspace-integrations.d.ts +948 -0
- package/dist/workspace-learning-administration.d.ts +289 -0
- package/dist/workspace-learning-policy.d.ts +1 -1
- package/dist/workspace-state.d.ts +85 -416
- package/dist/xai-provider-account-authority.d.ts +3 -0
- package/dist/xai-provider-account-authority.js +1 -1
- package/package.json +134 -1
- package/src/agent-authored-durable-text.ts +116 -0
- package/src/agent-config.ts +1527 -0
- package/src/agent-instruction-changes.ts +98 -0
- package/src/agent-learning.ts +161 -0
- package/src/agent-topology.ts +69 -0
- package/src/allowance-refusal.ts +81 -0
- package/src/analytics-consent-report.ts +20 -0
- package/src/api-key-presets.ts +25 -0
- package/src/artifact-catalog.ts +60 -0
- package/src/artifacts.ts +146 -18
- package/src/atlassian-native-retirement.ts +33 -0
- package/src/browser-storage.ts +10 -0
- package/src/bundled-skills.ts +73 -0
- package/src/claude-provider-account-authority.ts +12 -0
- package/src/claude-subscription-oauth.ts +62 -0
- package/src/claude-subscription-usage.ts +59 -0
- package/src/client-error-report.ts +184 -0
- package/src/code-search.ts +105 -0
- package/src/company-brain-governed-writes.ts +356 -0
- package/src/company-brain.ts +201 -0
- package/src/company-profile.ts +167 -1
- package/src/connect.ts +202 -0
- package/src/connection-account-label.ts +46 -0
- package/src/connection-authority.ts +213 -0
- package/src/connector-attachments.ts +327 -0
- package/src/connector-tool-permissions.ts +60 -0
- package/src/direct-model-provider.ts +98 -0
- package/src/editable-artifact-codec-registry.ts +55 -17
- package/src/editable-artifact-committed-transaction.ts +44 -31
- package/src/editable-artifact-live.ts +123 -57
- package/src/editable-artifact-serialized-commit.ts +2 -1
- package/src/editable-artifact-versions.ts +26 -5
- package/src/editable-artifacts.ts +2 -0
- package/src/external-identities.ts +285 -0
- package/src/feedback.ts +39 -0
- package/src/github-repository-contracts.ts +85 -0
- package/src/github-repository.ts +59 -0
- package/src/google-drive.ts +76 -4
- package/src/governed-learning-activation.ts +191 -0
- package/src/governed-learning-evaluator.ts +176 -0
- package/src/host-mcp-bindings.ts +298 -0
- package/src/image-generation.ts +8 -2
- package/src/index.ts +7093 -1466
- package/src/insights-usage.ts +679 -0
- package/src/interaction.ts +220 -5
- package/src/knowledge-entries.ts +375 -0
- package/src/knowledge-preparation.ts +50 -0
- package/src/knowledge.ts +134 -6
- package/src/managed-auth-session-sets.ts +253 -0
- package/src/managed-sign-in-methods.ts +37 -0
- package/src/mcp-catalog-limits.ts +2 -0
- package/src/mcp-endpoint.ts +30 -0
- package/src/mcp-oauth.ts +66 -0
- package/src/modal-native-proof-v2.ts +398 -0
- package/src/model-availability.ts +22 -0
- package/src/model-connection-access.ts +17 -0
- package/src/model-context-inspector.ts +139 -0
- package/src/model-display.ts +195 -0
- package/src/model-picker-order.ts +97 -0
- package/src/organization-access.ts +176 -0
- package/src/organization-integration-policy.ts +54 -0
- package/src/organization-membership-lifecycle.ts +559 -0
- package/src/organization-model-usage.ts +72 -0
- package/src/organization-recovery.ts +186 -0
- package/src/organization-usage.ts +79 -0
- package/src/permissions.ts +58 -0
- package/src/personal-github.ts +267 -0
- package/src/plugin-discovery.ts +33 -0
- package/src/preference-registry.ts +20 -1
- package/src/product-analytics.ts +253 -0
- package/src/product-lifecycle-facts.ts +121 -0
- package/src/remember.ts +243 -0
- package/src/retained-output.ts +20 -3
- package/src/sandbox-file-artifacts.ts +73 -0
- package/src/sandbox-provider-command.ts +82 -0
- package/src/sandbox-recovery.ts +116 -0
- package/src/sandbox-snapshots.ts +142 -0
- package/src/session-final-reply.ts +16 -0
- package/src/session-goal-reports.ts +55 -0
- package/src/session-history-import.ts +159 -0
- package/src/session-list-entries.ts +91 -0
- package/src/session-mcp-projections.ts +273 -0
- package/src/session-message-search.ts +54 -0
- package/src/session-titles.ts +467 -0
- package/src/session-topology-primitives.ts +21 -0
- package/src/signup-attribution.ts +81 -0
- package/src/site-request-headers.test.ts +28 -0
- package/src/site-session-http.ts +63 -0
- package/src/skill-catalog-context.ts +50 -0
- package/src/skill-files.ts +52 -0
- package/src/skill-metadata.ts +40 -0
- package/src/skill-use.ts +77 -0
- package/src/skills.ts +136 -0
- package/src/slack-bot-scopes.ts +106 -42
- package/src/slack-rest-mcp.ts +194 -0
- package/src/spreadsheet-artifact-commands.ts +12 -13
- package/src/subscription-account-pools.ts +44 -0
- package/src/task-notes.ts +14 -1
- package/src/tool-catalog.ts +155 -0
- package/src/tool-result-spill.ts +35 -0
- package/src/usage-allowances.ts +187 -0
- package/src/work-claims.ts +266 -0
- package/src/workspace-instruction-policies.ts +31 -0
- package/src/workspace-integration-wire.ts +99 -0
- package/src/workspace-integrations.ts +640 -0
- package/src/workspace-learning-administration.ts +88 -0
- package/src/workspace-learning-policy.ts +4 -3
- package/src/workspace-state.ts +16 -126
- package/src/xai-provider-account-authority.ts +1 -0
- package/dist/chunk-5UDNP7AO.js.map +0 -1
- package/dist/chunk-BVGIYW7D.js +0 -11
- package/dist/chunk-BVGIYW7D.js.map +0 -1
- package/dist/chunk-CM6BMECR.js.map +0 -1
- package/dist/chunk-JBCIY7QD.js.map +0 -1
- package/dist/chunk-LSB7GRLG.js.map +0 -1
- package/dist/chunk-LW7OH6CS.js.map +0 -1
- package/dist/chunk-M5ZGRVIQ.js.map +0 -1
- package/dist/chunk-Q6A7XT2N.js +0 -16734
- package/dist/chunk-Q6A7XT2N.js.map +0 -1
- package/dist/chunk-TZ6YEYN4.js.map +0 -1
- package/dist/chunk-Y3MLSLB4.js.map +0 -1
- /package/dist/{chunk-CADSX6UN.js.map → chunk-Y3KNXVTD.js.map} +0 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Strict, allocation-bounded inspection of canonical
|
|
2
|
+
* Strict, allocation-bounded inspection of canonical OGACO002 transactions.
|
|
3
3
|
*
|
|
4
4
|
* The Rust kernel remains the authority for applying operations. This decoder
|
|
5
5
|
* validates the complete envelope and every typed operation so metadata after
|
|
@@ -15,7 +15,7 @@ export const MAX_COMMITTED_TRANSACTION_OPERATIONS = 4_096;
|
|
|
15
15
|
export const MAX_COMMITTED_TRANSACTION_CAUSAL_REPLICAS = 100_000;
|
|
16
16
|
export const MAX_COMMITTED_TRANSACTION_CELLS = 1_000_000;
|
|
17
17
|
|
|
18
|
-
const MAGIC = new Uint8Array([0x4f, 0x47, 0x41, 0x43, 0x4f, 0x30, 0x30,
|
|
18
|
+
const MAGIC = new Uint8Array([0x4f, 0x47, 0x41, 0x43, 0x4f, 0x30, 0x30, 0x32]); // OGACO002
|
|
19
19
|
const HEADER_BYTES = 24;
|
|
20
20
|
const CHECKSUM_BYTES = 8;
|
|
21
21
|
const HASH_BYTES = 32;
|
|
@@ -24,6 +24,7 @@ const MAX_OPERATION_STRING_BYTES = 4 * 1024 * 1024;
|
|
|
24
24
|
const MAX_SAFE_U64_HIGH = 0x1f_ffff;
|
|
25
25
|
const U32_SIZE = 0x1_0000_0000;
|
|
26
26
|
const U32_MAX = 0xffff_ffff;
|
|
27
|
+
const MAX_DATE_MILLISECONDS = 8_640_000_000_000_000n;
|
|
27
28
|
const FNV_OFFSET_LOW = 0x8422_2325;
|
|
28
29
|
const FNV_OFFSET_HIGH = 0xcbf2_9ce4;
|
|
29
30
|
const FNV_PRIME_LOW = 0x01b3;
|
|
@@ -47,7 +48,7 @@ export type CommittedTransactionSummary = Readonly<{
|
|
|
47
48
|
}>;
|
|
48
49
|
|
|
49
50
|
/**
|
|
50
|
-
* Decodes only the metadata of one exact canonical
|
|
51
|
+
* Decodes only the metadata of one exact canonical OGACO002 byte envelope.
|
|
51
52
|
*
|
|
52
53
|
* This function is synchronous and never mutates or retains `bytes`. The
|
|
53
54
|
* caller remains the owner of the exact canonical envelope.
|
|
@@ -55,38 +56,38 @@ export type CommittedTransactionSummary = Readonly<{
|
|
|
55
56
|
export function decodeCommittedTransactionSummary(bytes: Uint8Array): CommittedTransactionSummary {
|
|
56
57
|
assertInput(bytes);
|
|
57
58
|
if (bytes.byteLength > MAX_COMMITTED_TRANSACTION_BYTES) {
|
|
58
|
-
throw new RangeError("
|
|
59
|
+
throw new RangeError("OGACO002 envelope exceeds its byte limit");
|
|
59
60
|
}
|
|
60
61
|
if (bytes.byteLength < HEADER_BYTES + CHECKSUM_BYTES) {
|
|
61
|
-
throw new TypeError("truncated
|
|
62
|
+
throw new TypeError("truncated OGACO002 envelope");
|
|
62
63
|
}
|
|
63
64
|
|
|
64
65
|
const view = new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength);
|
|
65
66
|
for (let index = 0; index < MAGIC.byteLength; index += 1) {
|
|
66
|
-
if (bytes[index] !== MAGIC[index]) throw new TypeError("invalid
|
|
67
|
+
if (bytes[index] !== MAGIC[index]) throw new TypeError("invalid OGACO002 magic");
|
|
67
68
|
}
|
|
68
69
|
|
|
69
70
|
const version = view.getUint16(8, true);
|
|
70
71
|
if (version !== COMMITTED_TRANSACTION_PROTOCOL_VERSION) {
|
|
71
|
-
throw new TypeError(`unsupported
|
|
72
|
+
throw new TypeError(`unsupported OGACO002 version: ${version}`);
|
|
72
73
|
}
|
|
73
74
|
if (view.getUint16(10, true) !== 0) {
|
|
74
|
-
throw new TypeError("reserved
|
|
75
|
+
throw new TypeError("reserved OGACO002 header bits are set");
|
|
75
76
|
}
|
|
76
77
|
|
|
77
78
|
const operationCount = view.getUint32(12, true);
|
|
78
79
|
if (operationCount === 0 || operationCount > MAX_COMMITTED_TRANSACTION_OPERATIONS) {
|
|
79
|
-
throw new RangeError("
|
|
80
|
+
throw new RangeError("OGACO002 operation count is outside its canonical bounds");
|
|
80
81
|
}
|
|
81
82
|
|
|
82
|
-
const payloadLength = safeU64At(view, 16, "
|
|
83
|
-
const payloadEnd = checkedAdd(HEADER_BYTES, payloadLength, "
|
|
84
|
-
const expectedLength = checkedAdd(payloadEnd, CHECKSUM_BYTES, "
|
|
83
|
+
const payloadLength = safeU64At(view, 16, "OGACO002 payload length", false);
|
|
84
|
+
const payloadEnd = checkedAdd(HEADER_BYTES, payloadLength, "OGACO002 payload length");
|
|
85
|
+
const expectedLength = checkedAdd(payloadEnd, CHECKSUM_BYTES, "OGACO002 envelope length");
|
|
85
86
|
if (bytes.byteLength !== expectedLength) {
|
|
86
87
|
throw new TypeError(
|
|
87
88
|
bytes.byteLength < expectedLength
|
|
88
|
-
? "truncated
|
|
89
|
-
: "trailing bytes after
|
|
89
|
+
? "truncated OGACO002 payload"
|
|
90
|
+
: "trailing bytes after OGACO002 envelope",
|
|
90
91
|
);
|
|
91
92
|
}
|
|
92
93
|
|
|
@@ -95,7 +96,7 @@ export function decodeCommittedTransactionSummary(bytes: Uint8Array): CommittedT
|
|
|
95
96
|
view.getUint32(payloadEnd, true) !== checksumLow ||
|
|
96
97
|
view.getUint32(payloadEnd + 4, true) !== checksumHigh
|
|
97
98
|
) {
|
|
98
|
-
throw new TypeError("
|
|
99
|
+
throw new TypeError("OGACO002 checksum mismatch");
|
|
99
100
|
}
|
|
100
101
|
|
|
101
102
|
const reader = new Reader(bytes, HEADER_BYTES, payloadEnd);
|
|
@@ -113,7 +114,7 @@ export function decodeCommittedTransactionSummary(bytes: Uint8Array): CommittedT
|
|
|
113
114
|
for (let index = 0; index < operationCount; index += 1) {
|
|
114
115
|
const operationId = reader.stableId(`operation ${index} id`);
|
|
115
116
|
if (seenOperationIds.has(operationId)) {
|
|
116
|
-
throw new TypeError("
|
|
117
|
+
throw new TypeError("OGACO002 operation ids must be unique");
|
|
117
118
|
}
|
|
118
119
|
seenOperationIds.add(operationId);
|
|
119
120
|
operationIds.push(operationId);
|
|
@@ -273,7 +274,7 @@ class Reader {
|
|
|
273
274
|
const endRow = this.u32("clear range end row");
|
|
274
275
|
const endColumn = this.u32("clear range end column");
|
|
275
276
|
if (startRow > endRow || startColumn > endColumn) {
|
|
276
|
-
throw new TypeError("
|
|
277
|
+
throw new TypeError("OGACO002 clear range is not normalized");
|
|
277
278
|
}
|
|
278
279
|
return totalCells;
|
|
279
280
|
}
|
|
@@ -281,7 +282,7 @@ class Reader {
|
|
|
281
282
|
this.stableId("selective undo target");
|
|
282
283
|
return totalCells;
|
|
283
284
|
default:
|
|
284
|
-
throw new TypeError(`invalid
|
|
285
|
+
throw new TypeError(`invalid OGACO002 collaboration command tag: ${tag}`);
|
|
285
286
|
}
|
|
286
287
|
}
|
|
287
288
|
|
|
@@ -292,18 +293,18 @@ class Reader {
|
|
|
292
293
|
const rows = this.u32("cell block rows");
|
|
293
294
|
const columns = this.u32("cell block columns");
|
|
294
295
|
if (rows === 0 || columns === 0) {
|
|
295
|
-
throw new TypeError("
|
|
296
|
+
throw new TypeError("OGACO002 cell block dimensions must be nonzero");
|
|
296
297
|
}
|
|
297
298
|
if (anchorRow > U32_MAX - (rows - 1) || anchorColumn > U32_MAX - (columns - 1)) {
|
|
298
|
-
throw new RangeError("
|
|
299
|
+
throw new RangeError("OGACO002 cell block coordinates overflow u32");
|
|
299
300
|
}
|
|
300
301
|
if (rows > Math.floor(MAX_COMMITTED_TRANSACTION_CELLS / columns)) {
|
|
301
|
-
throw new RangeError("
|
|
302
|
+
throw new RangeError("OGACO002 cell block exceeds its cell limit");
|
|
302
303
|
}
|
|
303
304
|
const cellCount = rows * columns;
|
|
304
305
|
const nextTotal = totalCells + cellCount;
|
|
305
306
|
if (nextTotal > MAX_COMMITTED_TRANSACTION_CELLS) {
|
|
306
|
-
throw new RangeError("
|
|
307
|
+
throw new RangeError("OGACO002 transaction exceeds its cell limit");
|
|
307
308
|
}
|
|
308
309
|
for (let index = 0; index < cellCount; index += 1) this.skipCell();
|
|
309
310
|
return nextTotal;
|
|
@@ -313,10 +314,11 @@ class Reader {
|
|
|
313
314
|
const formulaTag = this.u8("cell formula tag");
|
|
314
315
|
if (formulaTag === 1) {
|
|
315
316
|
if (this.skipString("cell formula") === 0) {
|
|
316
|
-
throw new TypeError("
|
|
317
|
+
throw new TypeError("OGACO002 formula must not be empty");
|
|
317
318
|
}
|
|
319
|
+
return;
|
|
318
320
|
} else if (formulaTag !== 0) {
|
|
319
|
-
throw new TypeError(`invalid
|
|
321
|
+
throw new TypeError(`invalid OGACO002 cell formula tag: ${formulaTag}`);
|
|
320
322
|
}
|
|
321
323
|
|
|
322
324
|
const valueTag = this.u8("cell value tag");
|
|
@@ -334,8 +336,11 @@ class Reader {
|
|
|
334
336
|
case 5:
|
|
335
337
|
this.skipFormulaError();
|
|
336
338
|
return;
|
|
339
|
+
case 6:
|
|
340
|
+
this.skipDate();
|
|
341
|
+
return;
|
|
337
342
|
default:
|
|
338
|
-
throw new TypeError(`invalid
|
|
343
|
+
throw new TypeError(`invalid OGACO002 cell value tag: ${valueTag}`);
|
|
339
344
|
}
|
|
340
345
|
}
|
|
341
346
|
|
|
@@ -344,10 +349,18 @@ class Reader {
|
|
|
344
349
|
const low = this.#view.getUint32(offset, true);
|
|
345
350
|
const high = this.#view.getUint32(offset + 4, true);
|
|
346
351
|
if (low === 0 && high === 0x8000_0000) {
|
|
347
|
-
throw new TypeError("
|
|
352
|
+
throw new TypeError("OGACO002 cell number uses negative zero");
|
|
348
353
|
}
|
|
349
354
|
if ((high & 0x7ff0_0000) === 0x7ff0_0000) {
|
|
350
|
-
throw new TypeError("
|
|
355
|
+
throw new TypeError("OGACO002 cell numbers must be finite");
|
|
356
|
+
}
|
|
357
|
+
}
|
|
358
|
+
|
|
359
|
+
skipDate(): void {
|
|
360
|
+
const offset = this.reserve(8, "cell date");
|
|
361
|
+
const milliseconds = this.#view.getBigInt64(offset, true);
|
|
362
|
+
if (milliseconds < -MAX_DATE_MILLISECONDS || milliseconds > MAX_DATE_MILLISECONDS) {
|
|
363
|
+
throw new TypeError("OGACO002 cell date is outside the ECMAScript range");
|
|
351
364
|
}
|
|
352
365
|
}
|
|
353
366
|
|
|
@@ -358,7 +371,7 @@ class Reader {
|
|
|
358
371
|
this.skipString("custom formula error");
|
|
359
372
|
return;
|
|
360
373
|
}
|
|
361
|
-
throw new TypeError(`invalid
|
|
374
|
+
throw new TypeError(`invalid OGACO002 formula error tag: ${tag}`);
|
|
362
375
|
}
|
|
363
376
|
|
|
364
377
|
skipGeneration(label: string): void {
|
|
@@ -377,16 +390,16 @@ class Reader {
|
|
|
377
390
|
}
|
|
378
391
|
|
|
379
392
|
done(): void {
|
|
380
|
-
if (this.#offset !== this.#end) throw new TypeError("trailing bytes in
|
|
393
|
+
if (this.#offset !== this.#end) throw new TypeError("trailing bytes in OGACO002 payload");
|
|
381
394
|
}
|
|
382
395
|
}
|
|
383
396
|
|
|
384
397
|
function assertInput(bytes: Uint8Array): void {
|
|
385
398
|
if (!(bytes instanceof Uint8Array)) {
|
|
386
|
-
throw new TypeError("
|
|
399
|
+
throw new TypeError("OGACO002 bytes must be a Uint8Array");
|
|
387
400
|
}
|
|
388
401
|
if (typeof SharedArrayBuffer !== "undefined" && bytes.buffer instanceof SharedArrayBuffer) {
|
|
389
|
-
throw new TypeError("
|
|
402
|
+
throw new TypeError("OGACO002 bytes must not use shared mutable memory");
|
|
390
403
|
}
|
|
391
404
|
}
|
|
392
405
|
|
|
@@ -3,8 +3,9 @@ import {
|
|
|
3
3
|
hashEditableArtifactMutationIntentBytes,
|
|
4
4
|
type EditableArtifactCausalEntry,
|
|
5
5
|
} from "./editable-artifacts";
|
|
6
|
+
import { EDITABLE_ARTIFACT_LIVE_WIRE_VERSION } from "./editable-artifact-versions";
|
|
6
7
|
|
|
7
|
-
const MAGIC = new TextEncoder().encode("
|
|
8
|
+
const MAGIC = new TextEncoder().encode("OGALV002");
|
|
8
9
|
const HEADER_BYTES = 20;
|
|
9
10
|
const MAX_METADATA_BYTES = 64 * 1024;
|
|
10
11
|
const MAX_TOKEN_BYTES = 4_096;
|
|
@@ -42,7 +43,7 @@ const MUTATION_REJECTION_CODES = new Set([
|
|
|
42
43
|
"unavailable",
|
|
43
44
|
]);
|
|
44
45
|
|
|
45
|
-
export
|
|
46
|
+
export { EDITABLE_ARTIFACT_LIVE_WIRE_VERSION } from "./editable-artifact-versions";
|
|
46
47
|
|
|
47
48
|
export type EditableArtifactId = string;
|
|
48
49
|
export type EditableArtifactRequestHash = string;
|
|
@@ -101,8 +102,7 @@ type EditableArtifactLiveResumeCommon = Readonly<{
|
|
|
101
102
|
export type EditableArtifactLiveResume =
|
|
102
103
|
| (EditableArtifactLiveResumeCommon &
|
|
103
104
|
Readonly<{
|
|
104
|
-
|
|
105
|
-
modality?: "spreadsheet";
|
|
105
|
+
modality: "spreadsheet";
|
|
106
106
|
localCausalFrontier: EditableArtifactCausalFrontier;
|
|
107
107
|
}>)
|
|
108
108
|
| (EditableArtifactLiveResumeCommon &
|
|
@@ -133,9 +133,10 @@ type EditableArtifactLiveSnapshotCommon = Readonly<{
|
|
|
133
133
|
export type EditableArtifactLiveSnapshot =
|
|
134
134
|
| (EditableArtifactLiveSnapshotCommon &
|
|
135
135
|
Readonly<{
|
|
136
|
-
modality
|
|
136
|
+
modality: "spreadsheet";
|
|
137
137
|
causalFrontier: EditableArtifactCausalFrontier;
|
|
138
|
-
|
|
138
|
+
operationProtocolVersion: number;
|
|
139
|
+
snapshotVersion: number;
|
|
139
140
|
}>)
|
|
140
141
|
| (EditableArtifactLiveSnapshotCommon &
|
|
141
142
|
Readonly<{
|
|
@@ -157,9 +158,9 @@ type EditableArtifactLiveCommittedTransactionCommon = Readonly<{
|
|
|
157
158
|
export type EditableArtifactLiveCommittedTransaction =
|
|
158
159
|
| (EditableArtifactLiveCommittedTransactionCommon &
|
|
159
160
|
Readonly<{
|
|
160
|
-
modality
|
|
161
|
+
modality: "spreadsheet";
|
|
161
162
|
causalFrontier: EditableArtifactCausalFrontier;
|
|
162
|
-
|
|
163
|
+
operationProtocolVersion: number;
|
|
163
164
|
/** Exact canonical whole OGACO transaction envelope. */
|
|
164
165
|
committedTransactionBytes: Uint8Array;
|
|
165
166
|
}>)
|
|
@@ -252,8 +253,7 @@ export type EditableArtifactLiveServerFrame =
|
|
|
252
253
|
protocolVersion: number;
|
|
253
254
|
artifactId: EditableArtifactId;
|
|
254
255
|
streamEpoch: string;
|
|
255
|
-
|
|
256
|
-
modality?: EditableArtifactLiveModality;
|
|
256
|
+
modality: EditableArtifactLiveModality;
|
|
257
257
|
writable: boolean;
|
|
258
258
|
headSequence: number;
|
|
259
259
|
minimumReplaySequence: number;
|
|
@@ -282,9 +282,10 @@ export type EditableArtifactLiveServerFrame =
|
|
|
282
282
|
}> &
|
|
283
283
|
(
|
|
284
284
|
| Readonly<{
|
|
285
|
-
|
|
286
|
-
modality?: "spreadsheet";
|
|
285
|
+
modality: "spreadsheet";
|
|
287
286
|
causalFrontier: EditableArtifactCausalFrontier;
|
|
287
|
+
operationProtocolVersion: number;
|
|
288
|
+
snapshotVersion: number;
|
|
288
289
|
}>
|
|
289
290
|
| Readonly<{
|
|
290
291
|
modality: "document" | "presentation";
|
|
@@ -439,6 +440,7 @@ export function encodeEditableArtifactLiveOpenWireFrame(
|
|
|
439
440
|
protocolVersion,
|
|
440
441
|
artifactId,
|
|
441
442
|
token,
|
|
443
|
+
modality: resume.modality,
|
|
442
444
|
localCursor: resume.localCursor,
|
|
443
445
|
localStateHash: resume.localStateHash,
|
|
444
446
|
localCausalFrontier: resume.localCausalFrontier,
|
|
@@ -491,28 +493,22 @@ export function encodeEditableArtifactLiveServerWireFrame(
|
|
|
491
493
|
): Uint8Array {
|
|
492
494
|
switch (frame.type) {
|
|
493
495
|
case "open": {
|
|
494
|
-
const { modality, ...metadata } = frame;
|
|
495
496
|
return encodeEnvelope(
|
|
496
497
|
SERVER_OPEN,
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
maxSnapshotBytes: metadata.maxSnapshotBytes,
|
|
512
|
-
maxInFlightTransactions: metadata.maxInFlightTransactions,
|
|
513
|
-
maxInFlightBytes: metadata.maxInFlightBytes,
|
|
514
|
-
}
|
|
515
|
-
: metadata,
|
|
498
|
+
{
|
|
499
|
+
...serverFrameIdentity(frame),
|
|
500
|
+
modality: frame.modality,
|
|
501
|
+
writable: frame.writable,
|
|
502
|
+
headSequence: frame.headSequence,
|
|
503
|
+
minimumReplaySequence: frame.minimumReplaySequence,
|
|
504
|
+
maxClientFrameBytes: frame.maxClientFrameBytes,
|
|
505
|
+
maxCommandBytes: frame.maxCommandBytes,
|
|
506
|
+
maxIntentBytes: frame.maxIntentBytes,
|
|
507
|
+
maxCommittedTransactionBytes: frame.maxCommittedTransactionBytes,
|
|
508
|
+
maxSnapshotBytes: frame.maxSnapshotBytes,
|
|
509
|
+
maxInFlightTransactions: frame.maxInFlightTransactions,
|
|
510
|
+
maxInFlightBytes: frame.maxInFlightBytes,
|
|
511
|
+
},
|
|
516
512
|
EMPTY_BYTES,
|
|
517
513
|
);
|
|
518
514
|
}
|
|
@@ -555,10 +551,14 @@ export function encodeEditableArtifactLiveServerWireFrame(
|
|
|
555
551
|
protocolVersion: metadata.protocolVersion,
|
|
556
552
|
artifactId: metadata.artifactId,
|
|
557
553
|
streamEpoch: metadata.streamEpoch,
|
|
554
|
+
modality,
|
|
558
555
|
sequence: metadata.sequence,
|
|
559
556
|
stateHash: metadata.stateHash,
|
|
560
557
|
causalFrontier: (metadata as { causalFrontier: EditableArtifactCausalFrontier })
|
|
561
558
|
.causalFrontier,
|
|
559
|
+
operationProtocolVersion: (metadata as { operationProtocolVersion: number })
|
|
560
|
+
.operationProtocolVersion,
|
|
561
|
+
snapshotVersion: (metadata as { snapshotVersion: number }).snapshotVersion,
|
|
562
562
|
digest: metadata.digest,
|
|
563
563
|
kernelVersion: metadata.kernelVersion,
|
|
564
564
|
modelSchemaVersion: metadata.modelSchemaVersion,
|
|
@@ -576,9 +576,10 @@ export function encodeEditableArtifactLiveServerWireFrame(
|
|
|
576
576
|
{ modality: "document" | "presentation" }
|
|
577
577
|
>;
|
|
578
578
|
const transactionMetadata =
|
|
579
|
-
transaction.modality ===
|
|
579
|
+
transaction.modality === "spreadsheet"
|
|
580
580
|
? {
|
|
581
581
|
artifactId: transaction.artifactId,
|
|
582
|
+
modality: transaction.modality,
|
|
582
583
|
transactionId: transaction.transactionId,
|
|
583
584
|
requestHash: transaction.requestHash,
|
|
584
585
|
startSequence: transaction.startSequence,
|
|
@@ -586,7 +587,7 @@ export function encodeEditableArtifactLiveServerWireFrame(
|
|
|
586
587
|
priorStateHash: transaction.priorStateHash,
|
|
587
588
|
stateHash: transaction.stateHash,
|
|
588
589
|
causalFrontier: transaction.causalFrontier,
|
|
589
|
-
|
|
590
|
+
operationProtocolVersion: transaction.operationProtocolVersion,
|
|
590
591
|
}
|
|
591
592
|
: {
|
|
592
593
|
artifactId: serializedTransaction.artifactId,
|
|
@@ -603,27 +604,82 @@ export function encodeEditableArtifactLiveServerWireFrame(
|
|
|
603
604
|
};
|
|
604
605
|
return encodeEnvelope(
|
|
605
606
|
SERVER_TRANSACTION,
|
|
606
|
-
{ ...frame, transaction: transactionMetadata },
|
|
607
|
+
{ ...serverFrameIdentity(frame), transaction: transactionMetadata },
|
|
607
608
|
committedTransactionBytes,
|
|
608
609
|
);
|
|
609
610
|
}
|
|
610
611
|
case "barrier":
|
|
611
|
-
return encodeEnvelope(
|
|
612
|
+
return encodeEnvelope(
|
|
613
|
+
SERVER_BARRIER,
|
|
614
|
+
{ ...serverFrameIdentity(frame), sequence: frame.sequence, stateHash: frame.stateHash },
|
|
615
|
+
EMPTY_BYTES,
|
|
616
|
+
);
|
|
612
617
|
case "watermark":
|
|
613
|
-
return encodeEnvelope(
|
|
618
|
+
return encodeEnvelope(
|
|
619
|
+
SERVER_WATERMARK,
|
|
620
|
+
{ ...serverFrameIdentity(frame), headSequence: frame.headSequence },
|
|
621
|
+
EMPTY_BYTES,
|
|
622
|
+
);
|
|
614
623
|
case "resyncRequired":
|
|
615
|
-
return encodeEnvelope(
|
|
624
|
+
return encodeEnvelope(
|
|
625
|
+
SERVER_RESYNC_REQUIRED,
|
|
626
|
+
{ ...serverFrameIdentity(frame), reason: frame.reason, headSequence: frame.headSequence },
|
|
627
|
+
EMPTY_BYTES,
|
|
628
|
+
);
|
|
616
629
|
case "applied":
|
|
617
|
-
return encodeEnvelope(
|
|
630
|
+
return encodeEnvelope(
|
|
631
|
+
SERVER_APPLIED,
|
|
632
|
+
{ ...serverFrameIdentity(frame), sequence: frame.sequence, stateHash: frame.stateHash },
|
|
633
|
+
EMPTY_BYTES,
|
|
634
|
+
);
|
|
618
635
|
case "authorizationChanged":
|
|
619
|
-
return encodeEnvelope(
|
|
636
|
+
return encodeEnvelope(
|
|
637
|
+
SERVER_AUTHORIZATION_CHANGED,
|
|
638
|
+
{ ...serverFrameIdentity(frame), writable: frame.writable },
|
|
639
|
+
EMPTY_BYTES,
|
|
640
|
+
);
|
|
620
641
|
case "mutationAccepted":
|
|
621
|
-
return encodeEnvelope(
|
|
642
|
+
return encodeEnvelope(
|
|
643
|
+
SERVER_MUTATION_ACCEPTED,
|
|
644
|
+
{
|
|
645
|
+
...serverFrameIdentity(frame),
|
|
646
|
+
requestHash: frame.requestHash,
|
|
647
|
+
clientTransactionId: frame.clientTransactionId,
|
|
648
|
+
transactionId: frame.transactionId,
|
|
649
|
+
startSequence: frame.startSequence,
|
|
650
|
+
endSequence: frame.endSequence,
|
|
651
|
+
stateHash: frame.stateHash,
|
|
652
|
+
},
|
|
653
|
+
EMPTY_BYTES,
|
|
654
|
+
);
|
|
622
655
|
case "mutationRejected":
|
|
623
|
-
return encodeEnvelope(
|
|
656
|
+
return encodeEnvelope(
|
|
657
|
+
SERVER_MUTATION_REJECTED,
|
|
658
|
+
{
|
|
659
|
+
...serverFrameIdentity(frame),
|
|
660
|
+
requestHash: frame.requestHash,
|
|
661
|
+
code: frame.code,
|
|
662
|
+
retryable: frame.retryable,
|
|
663
|
+
},
|
|
664
|
+
EMPTY_BYTES,
|
|
665
|
+
);
|
|
624
666
|
}
|
|
625
667
|
}
|
|
626
668
|
|
|
669
|
+
function serverFrameIdentity(frame: EditableArtifactLiveServerFrame): Readonly<{
|
|
670
|
+
type: EditableArtifactLiveServerFrame["type"];
|
|
671
|
+
protocolVersion: number;
|
|
672
|
+
artifactId: EditableArtifactId;
|
|
673
|
+
streamEpoch: string;
|
|
674
|
+
}> {
|
|
675
|
+
return {
|
|
676
|
+
type: frame.type,
|
|
677
|
+
protocolVersion: frame.protocolVersion,
|
|
678
|
+
artifactId: frame.artifactId,
|
|
679
|
+
streamEpoch: frame.streamEpoch,
|
|
680
|
+
};
|
|
681
|
+
}
|
|
682
|
+
|
|
627
683
|
/** Strict inverse used by browser/desktop SDK transports. */
|
|
628
684
|
export function decodeEditableArtifactLiveServerWireFrame(
|
|
629
685
|
bytes: Uint8Array,
|
|
@@ -635,7 +691,7 @@ export function decodeEditableArtifactLiveServerWireFrame(
|
|
|
635
691
|
requireNoPayload(decoded.payload);
|
|
636
692
|
const modality = serverModality(metadata);
|
|
637
693
|
requireServerKeys(metadata, "open", [
|
|
638
|
-
|
|
694
|
+
"modality",
|
|
639
695
|
"writable",
|
|
640
696
|
"headSequence",
|
|
641
697
|
"minimumReplaySequence",
|
|
@@ -669,15 +725,18 @@ export function decodeEditableArtifactLiveServerWireFrame(
|
|
|
669
725
|
),
|
|
670
726
|
maxInFlightBytes: positiveInteger(metadata.maxInFlightBytes, "maxInFlightBytes"),
|
|
671
727
|
} as const;
|
|
672
|
-
return Object.freeze(
|
|
728
|
+
return Object.freeze({ ...common, modality });
|
|
673
729
|
}
|
|
674
730
|
case SERVER_SNAPSHOT: {
|
|
675
731
|
const modality = serverModality(metadata);
|
|
676
732
|
requireServerKeys(metadata, "snapshot", [
|
|
677
|
-
|
|
733
|
+
"modality",
|
|
678
734
|
"sequence",
|
|
679
735
|
"stateHash",
|
|
680
736
|
modality === "spreadsheet" ? "causalFrontier" : "nativeRevision",
|
|
737
|
+
...(modality === "spreadsheet"
|
|
738
|
+
? (["operationProtocolVersion", "snapshotVersion"] as const)
|
|
739
|
+
: []),
|
|
681
740
|
"digest",
|
|
682
741
|
"kernelVersion",
|
|
683
742
|
"modelSchemaVersion",
|
|
@@ -714,7 +773,13 @@ export function decodeEditableArtifactLiveServerWireFrame(
|
|
|
714
773
|
modality === "spreadsheet"
|
|
715
774
|
? {
|
|
716
775
|
...common,
|
|
776
|
+
modality,
|
|
717
777
|
causalFrontier: requiredFrontier(metadata.causalFrontier),
|
|
778
|
+
operationProtocolVersion: positiveInteger(
|
|
779
|
+
metadata.operationProtocolVersion,
|
|
780
|
+
"operationProtocolVersion",
|
|
781
|
+
),
|
|
782
|
+
snapshotVersion: positiveInteger(metadata.snapshotVersion, "snapshotVersion"),
|
|
718
783
|
}
|
|
719
784
|
: {
|
|
720
785
|
...common,
|
|
@@ -732,6 +797,7 @@ export function decodeEditableArtifactLiveServerWireFrame(
|
|
|
732
797
|
modality === "spreadsheet"
|
|
733
798
|
? [
|
|
734
799
|
"artifactId",
|
|
800
|
+
"modality",
|
|
735
801
|
"transactionId",
|
|
736
802
|
"requestHash",
|
|
737
803
|
"startSequence",
|
|
@@ -739,7 +805,7 @@ export function decodeEditableArtifactLiveServerWireFrame(
|
|
|
739
805
|
"priorStateHash",
|
|
740
806
|
"stateHash",
|
|
741
807
|
"causalFrontier",
|
|
742
|
-
"
|
|
808
|
+
"operationProtocolVersion",
|
|
743
809
|
]
|
|
744
810
|
: [
|
|
745
811
|
"artifactId",
|
|
@@ -787,8 +853,12 @@ export function decodeEditableArtifactLiveServerWireFrame(
|
|
|
787
853
|
modality === "spreadsheet"
|
|
788
854
|
? {
|
|
789
855
|
...common.transaction,
|
|
856
|
+
modality,
|
|
790
857
|
causalFrontier: requiredFrontier(transaction.causalFrontier),
|
|
791
|
-
|
|
858
|
+
operationProtocolVersion: positiveInteger(
|
|
859
|
+
transaction.operationProtocolVersion,
|
|
860
|
+
"operationProtocolVersion",
|
|
861
|
+
),
|
|
792
862
|
}
|
|
793
863
|
: {
|
|
794
864
|
...common.transaction,
|
|
@@ -923,6 +993,7 @@ function decodeOpen(
|
|
|
923
993
|
"protocolVersion",
|
|
924
994
|
"artifactId",
|
|
925
995
|
"token",
|
|
996
|
+
"modality",
|
|
926
997
|
"localCursor",
|
|
927
998
|
"localStateHash",
|
|
928
999
|
"localCausalFrontier",
|
|
@@ -1125,12 +1196,13 @@ function normalizeResume(resume: EditableArtifactLiveResume): EditableArtifactLi
|
|
|
1125
1196
|
if ((localCursor === null) !== (localStateHash === null)) {
|
|
1126
1197
|
throw invalidFrame("resume cursor and state hash must both be null or both be present");
|
|
1127
1198
|
}
|
|
1128
|
-
const modality = resume.modality
|
|
1199
|
+
const modality = editableArtifactLiveModality(resume.modality);
|
|
1129
1200
|
if (modality === "spreadsheet") {
|
|
1130
1201
|
if (!("localCausalFrontier" in resume)) {
|
|
1131
1202
|
throw invalidFrame("spreadsheet resume requires a causal frontier");
|
|
1132
1203
|
}
|
|
1133
1204
|
return Object.freeze({
|
|
1205
|
+
modality,
|
|
1134
1206
|
localCursor,
|
|
1135
1207
|
localStateHash,
|
|
1136
1208
|
localCausalFrontier: requiredFrontier(resume.localCausalFrontier),
|
|
@@ -1176,23 +1248,17 @@ function editableArtifactLiveModality(value: unknown): EditableArtifactLiveModal
|
|
|
1176
1248
|
function clientOpenModality(
|
|
1177
1249
|
metadata: Readonly<Record<string, unknown>>,
|
|
1178
1250
|
): EditableArtifactLiveModality {
|
|
1179
|
-
return metadata.modality
|
|
1180
|
-
? "spreadsheet"
|
|
1181
|
-
: editableArtifactLiveModality(metadata.modality);
|
|
1251
|
+
return editableArtifactLiveModality(metadata.modality);
|
|
1182
1252
|
}
|
|
1183
1253
|
|
|
1184
1254
|
function serverModality(metadata: Readonly<Record<string, unknown>>): EditableArtifactLiveModality {
|
|
1185
|
-
return metadata.modality
|
|
1186
|
-
? "spreadsheet"
|
|
1187
|
-
: editableArtifactLiveModality(metadata.modality);
|
|
1255
|
+
return editableArtifactLiveModality(metadata.modality);
|
|
1188
1256
|
}
|
|
1189
1257
|
|
|
1190
1258
|
function transactionModality(
|
|
1191
1259
|
transaction: Readonly<Record<string, unknown>>,
|
|
1192
1260
|
): EditableArtifactLiveModality {
|
|
1193
|
-
return transaction.modality
|
|
1194
|
-
? "spreadsheet"
|
|
1195
|
-
: editableArtifactLiveModality(transaction.modality);
|
|
1261
|
+
return editableArtifactLiveModality(transaction.modality);
|
|
1196
1262
|
}
|
|
1197
1263
|
|
|
1198
1264
|
function requireExactKeys(
|
|
@@ -22,8 +22,9 @@ import {
|
|
|
22
22
|
type EditableArtifactMutationIntent,
|
|
23
23
|
} from "./editable-artifacts";
|
|
24
24
|
import { editableArtifactCodecFor } from "./editable-artifact-codec-registry";
|
|
25
|
+
import { EDITABLE_ARTIFACT_SERIALIZED_COMMIT_VERSION } from "./editable-artifact-versions";
|
|
25
26
|
|
|
26
|
-
export
|
|
27
|
+
export { EDITABLE_ARTIFACT_SERIALIZED_COMMIT_VERSION } from "./editable-artifact-versions";
|
|
27
28
|
export const EDITABLE_ARTIFACT_SERIALIZED_COMMIT_MAX_BYTES = 8 * 1024 * 1024;
|
|
28
29
|
export const EDITABLE_ARTIFACT_NATIVE_RECEIPT_MAX_BYTES = 512 * 1024;
|
|
29
30
|
|
|
@@ -1,8 +1,29 @@
|
|
|
1
|
-
/**
|
|
2
|
-
export const
|
|
1
|
+
/** Modality-specific durable semantic/schema versions. */
|
|
2
|
+
export const SPREADSHEET_ARTIFACT_MODEL_SCHEMA_VERSION = 2 as const;
|
|
3
|
+
export const DOCUMENT_ARTIFACT_MODEL_SCHEMA_VERSION = 1 as const;
|
|
4
|
+
export const PRESENTATION_ARTIFACT_MODEL_SCHEMA_VERSION = 1 as const;
|
|
3
5
|
|
|
4
|
-
/**
|
|
5
|
-
export const
|
|
6
|
+
/** Direct kernel workbook snapshot version (OGARTK02), never the durable CRDT snapshot. */
|
|
7
|
+
export const SPREADSHEET_KERNEL_SNAPSHOT_VERSION = 2 as const;
|
|
8
|
+
|
|
9
|
+
/** Modality-specific canonical snapshot versions. */
|
|
10
|
+
export const DOCUMENT_ARTIFACT_SNAPSHOT_VERSION = 1 as const;
|
|
11
|
+
export const PRESENTATION_ARTIFACT_SNAPSHOT_VERSION = 1 as const;
|
|
12
|
+
|
|
13
|
+
/** Canonical internal spreadsheet kernel command-envelope version. */
|
|
14
|
+
export const SPREADSHEET_KERNEL_COMMAND_VERSION = 2 as const;
|
|
15
|
+
|
|
16
|
+
/** Canonical public, identity-free spreadsheet command-envelope version. */
|
|
17
|
+
export const SPREADSHEET_ARTIFACT_COMMAND_VERSION = 2 as const;
|
|
18
|
+
|
|
19
|
+
/** Canonical durable spreadsheet collaboration-snapshot version. */
|
|
20
|
+
export const SPREADSHEET_COLLABORATION_SNAPSHOT_VERSION = 2 as const;
|
|
6
21
|
|
|
7
22
|
/** Canonical committed spreadsheet transaction protocol version. */
|
|
8
|
-
export const COMMITTED_TRANSACTION_PROTOCOL_VERSION =
|
|
23
|
+
export const COMMITTED_TRANSACTION_PROTOCOL_VERSION = 2 as const;
|
|
24
|
+
|
|
25
|
+
/** Canonical document/presentation serialized-commit protocol version. */
|
|
26
|
+
export const EDITABLE_ARTIFACT_SERIALIZED_COMMIT_VERSION = 1 as const;
|
|
27
|
+
|
|
28
|
+
/** Canonical editable-artifact live transport protocol version. */
|
|
29
|
+
export const EDITABLE_ARTIFACT_LIVE_WIRE_VERSION = 2 as const;
|
|
@@ -9,6 +9,8 @@ export * from "./presentation-artifact-commands";
|
|
|
9
9
|
export * from "./editable-artifact-codec-registry";
|
|
10
10
|
|
|
11
11
|
export const EDITABLE_ARTIFACT_INTENT_VERSION = 1 as const;
|
|
12
|
+
/** Semantic protocol carried inside the unchanged OGATX001 envelope. */
|
|
13
|
+
export const EDITABLE_ARTIFACT_INTENT_PROTOCOL_VERSION = 1 as const;
|
|
12
14
|
export const EDITABLE_ARTIFACT_INTENT_MAX_BYTES = 5 * 1024 * 1024;
|
|
13
15
|
export const EDITABLE_ARTIFACT_COMMAND_MAX_BYTES = 4 * 1024 * 1024;
|
|
14
16
|
export const EDITABLE_ARTIFACT_KERNEL_VERSION_MAX_BYTES = 512;
|