@opengeni/contracts 3.1.0-canary.2 → 3.1.2
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 +9 -9
- package/dist/agent-config.d.ts +971 -0
- package/dist/agent-instruction-changes.d.ts +0 -2
- 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 +188 -0
- package/dist/artifacts.d.ts +86 -0
- 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 +1 -0
- package/dist/atlassian.js +34 -19
- 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 +24 -1
- package/dist/canonical-human-identities.js +2 -1
- package/dist/chunk-2ZIHHL72.js +153 -0
- package/dist/chunk-2ZIHHL72.js.map +1 -0
- package/dist/{chunk-5LYFSZ7O.js → chunk-352X6ENP.js} +31 -31
- package/dist/chunk-4JGHSSB7.js +11 -0
- package/dist/chunk-4JGHSSB7.js.map +1 -0
- package/dist/chunk-4QO6GJUX.js +85 -0
- package/dist/chunk-4QO6GJUX.js.map +1 -0
- package/dist/chunk-4VDMHLLL.js +49 -0
- package/dist/chunk-4VDMHLLL.js.map +1 -0
- package/dist/chunk-56SNIMDO.js +9 -0
- package/dist/chunk-56SNIMDO.js.map +1 -0
- package/dist/chunk-6C2HKFTU.js +207 -0
- package/dist/chunk-6C2HKFTU.js.map +1 -0
- package/dist/chunk-6IXO76Z6.js +72 -0
- package/dist/chunk-6IXO76Z6.js.map +1 -0
- package/dist/chunk-7272KVWZ.js +60 -0
- package/dist/chunk-7272KVWZ.js.map +1 -0
- package/dist/{chunk-7ABONTXE.js → chunk-E3GGUBHS.js} +49 -5
- package/dist/chunk-E3GGUBHS.js.map +1 -0
- package/dist/chunk-EFZYKUE2.js +767 -0
- package/dist/chunk-EFZYKUE2.js.map +1 -0
- package/dist/chunk-EKWNTOG3.js +154 -0
- package/dist/chunk-EKWNTOG3.js.map +1 -0
- package/dist/chunk-HABQ7ADB.js +234 -0
- package/dist/chunk-HABQ7ADB.js.map +1 -0
- package/dist/chunk-HRRU4QPI.js +91 -0
- package/dist/chunk-HRRU4QPI.js.map +1 -0
- package/dist/{chunk-3SIZGL3O.js → chunk-IK36LXKC.js} +18 -2
- package/dist/chunk-IK36LXKC.js.map +1 -0
- package/dist/{chunk-TXTQIYCV.js → chunk-ILJ72KPO.js} +56 -3
- package/dist/chunk-ILJ72KPO.js.map +1 -0
- package/dist/chunk-J4HQ3UKY.js +93 -0
- package/dist/chunk-J4HQ3UKY.js.map +1 -0
- package/dist/chunk-KHHZTBP7.js +11 -0
- package/dist/chunk-KHHZTBP7.js.map +1 -0
- package/dist/{chunk-WYBDERIY.js → chunk-LZ2LAHIX.js} +47 -41
- package/dist/chunk-LZ2LAHIX.js.map +1 -0
- package/dist/chunk-NDZHPTCL.js +400 -0
- package/dist/chunk-NDZHPTCL.js.map +1 -0
- package/dist/chunk-OF6OKOBF.js +54793 -0
- package/dist/chunk-OF6OKOBF.js.map +1 -0
- package/dist/chunk-OL23ARTF.js +94 -0
- package/dist/chunk-OL23ARTF.js.map +1 -0
- package/dist/chunk-PUIUXIOL.js +189 -0
- package/dist/chunk-PUIUXIOL.js.map +1 -0
- package/dist/{chunk-Y3KNXVTD.js → chunk-RMWXDZEO.js} +128 -21
- package/dist/chunk-RMWXDZEO.js.map +1 -0
- package/dist/{chunk-MRWYRAS5.js → chunk-SHO4YO4B.js} +27 -35
- package/dist/chunk-SHO4YO4B.js.map +1 -0
- package/dist/chunk-SWRN2DJ3.js +153 -0
- package/dist/chunk-SWRN2DJ3.js.map +1 -0
- package/dist/chunk-TCXCRBPF.js +267 -0
- package/dist/chunk-TCXCRBPF.js.map +1 -0
- package/dist/chunk-TLU3UEMD.js +324 -0
- package/dist/chunk-TLU3UEMD.js.map +1 -0
- package/dist/chunk-TSWWZMUS.js +186 -0
- package/dist/chunk-TSWWZMUS.js.map +1 -0
- package/dist/{chunk-PX3VCKAU.js → chunk-WVCFSOUZ.js} +1 -1
- package/dist/{chunk-PX3VCKAU.js.map → chunk-WVCFSOUZ.js.map} +1 -1
- package/dist/chunk-XDLAGX66.js +127 -0
- package/dist/chunk-XDLAGX66.js.map +1 -0
- package/dist/chunk-YKZ4WU4P.js +33 -0
- package/dist/chunk-YKZ4WU4P.js.map +1 -0
- package/dist/{chunk-O5LEQHDM.js → chunk-Z7WEVGCL.js} +3 -3
- package/dist/{chunk-YBW5JSA3.js → chunk-ZDCRWCGZ.js} +119 -101
- package/dist/chunk-ZDCRWCGZ.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 +158 -0
- package/dist/client-error-report.js +164 -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/codex-provider-account-authority.js +20 -12
- package/dist/codex-provider-account-authority.js.map +1 -1
- package/dist/company-profile.d.ts +144 -6
- package/dist/connect.d.ts +37 -0
- package/dist/connect.js +216 -159
- package/dist/connect.js.map +1 -1
- 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 +9 -317
- package/dist/connection-authority.js +37 -42
- package/dist/connector-attachments.js +2 -1
- package/dist/connector-destinations.js +2 -1
- package/dist/connector-tool-permissions.d.ts +137 -0
- package/dist/cua-desktop-tools.d.ts +17 -0
- package/dist/define-schema.d.ts +8 -0
- package/dist/direct-model-provider.d.ts +36 -0
- package/dist/editable-artifact-codec-registry.js +5 -5
- package/dist/editable-artifact-committed-transaction.js +3 -2
- package/dist/editable-artifact-live.js +5 -5
- package/dist/editable-artifact-serialized-commit.js +6 -6
- package/dist/editable-artifact-versions.d.ts +7 -1
- package/dist/editable-artifact-versions.js +1 -1
- package/dist/editable-artifacts.js +62 -56
- package/dist/event-preview.d.ts +22 -0
- package/dist/external-identities.d.ts +138 -0
- package/dist/external-identities.js +9 -4
- package/dist/first-party-tool-authorization.d.ts +815 -0
- package/dist/github-repository-contracts.js +60 -43
- package/dist/github-repository-contracts.js.map +1 -1
- package/dist/google-drive.d.ts +2 -1
- package/dist/google-drive.js +305 -238
- package/dist/google-drive.js.map +1 -1
- package/dist/host-mcp-bindings.d.ts +5 -0
- package/dist/host-mcp-bindings.js +233 -170
- package/dist/host-mcp-bindings.js.map +1 -1
- package/dist/image-generation.d.ts +1 -0
- package/dist/index.d.ts +16761 -5946
- package/dist/index.js +1973 -260
- package/dist/insights-usage.d.ts +877 -0
- package/dist/insights-usage.js +559 -0
- package/dist/insights-usage.js.map +1 -0
- package/dist/interaction.d.ts +1176 -829
- package/dist/knowledge-entries.d.ts +81 -2
- package/dist/knowledge-preparation.d.ts +239 -0
- package/dist/managed-auth-session-sets.d.ts +7 -0
- package/dist/managed-auth-session-sets.js +198 -132
- package/dist/managed-auth-session-sets.js.map +1 -1
- package/dist/managed-sign-in-methods.d.ts +56 -0
- package/dist/managed-sign-in-methods.js +64 -0
- package/dist/managed-sign-in-methods.js.map +1 -0
- package/dist/mcp-catalog-limits.d.ts +2 -0
- package/dist/mcp-oauth.d.ts +2 -2
- package/dist/mcp-structured-content.d.ts +25 -0
- package/dist/modal-native-proof-v2.d.ts +587 -0
- package/dist/modal-native-proof-v2.js +38 -0
- package/dist/modal-native-proof-v2.js.map +1 -0
- package/dist/model-account-choice.d.ts +235 -0
- package/dist/model-account-settings.d.ts +422 -0
- package/dist/model-availability.d.ts +15 -0
- package/dist/model-connection-access.d.ts +13 -0
- package/dist/model-context-inspector.d.ts +98 -0
- package/dist/model-display.d.ts +43 -0
- package/dist/model-display.js +17 -0
- package/dist/model-display.js.map +1 -0
- package/dist/model-picker-order.d.ts +3 -1
- package/dist/model-picker-order.js +3 -0
- package/dist/model-picker-order.js.map +1 -1
- package/dist/organization-access.d.ts +412 -0
- package/dist/organization-access.js +39 -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 +38 -0
- package/dist/organization-model-usage.d.ts +146 -0
- package/dist/organization-model-usage.js +78 -0
- package/dist/organization-model-usage.js.map +1 -0
- package/dist/organization-recovery.js +2 -1
- package/dist/organization-usage.d.ts +138 -0
- package/dist/permissions.d.ts +18 -0
- package/dist/personal-github.d.ts +1 -0
- package/dist/personal-github.js +199 -144
- package/dist/personal-github.js.map +1 -1
- package/dist/prepared-mcp-setup.d.ts +54 -0
- package/dist/prepared-mcp-setup.js +12 -0
- package/dist/prepared-mcp-setup.js.map +1 -0
- package/dist/product-analytics.d.ts +116 -0
- package/dist/product-lifecycle-facts.d.ts +73 -0
- package/dist/remember.d.ts +98 -6
- package/dist/retained-output.d.ts +8 -0
- package/dist/sandbox-file-artifacts.d.ts +1 -0
- package/dist/sandbox-provider-command.d.ts +91 -1
- package/dist/sandbox-recovery.d.ts +146 -0
- package/dist/secret-generator.d.ts +44 -0
- package/dist/secret-references.d.ts +90 -0
- package/dist/secret-resolution.d.ts +111 -0
- package/dist/secret-totp.d.ts +41 -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 +1272 -0
- package/dist/session-list-entries.d.ts +4 -0
- package/dist/session-list-entries.js +56 -0
- package/dist/session-list-entries.js.map +1 -0
- package/dist/session-mcp-projections.d.ts +6 -0
- package/dist/session-mcp-tool-permissions.d.ts +62 -0
- package/dist/session-message-search.d.ts +68 -0
- package/dist/session-target.d.ts +18 -0
- package/dist/session-titles.d.ts +8 -0
- package/dist/session-titles.js +5 -1
- package/dist/session-usage-limit-refusal.d.ts +34 -0
- package/dist/session-usage-limit-refusal.js +15 -0
- package/dist/session-usage-limit-refusal.js.map +1 -0
- package/dist/session-usage-limits.d.ts +127 -0
- package/dist/session-usage-limits.js +41 -0
- package/dist/session-usage-limits.js.map +1 -0
- package/dist/signup-attribution.d.ts +39 -0
- package/dist/site-data.d.ts +286 -0
- package/dist/site-operations.d.ts +39 -0
- package/dist/site-publishing.d.ts +778 -0
- package/dist/site-session-http.d.ts +89 -4
- package/dist/site-session-http.js +25 -1
- package/dist/site-sql.d.ts +421 -0
- package/dist/skill-catalog-context.d.ts +7 -0
- package/dist/skill-files.d.ts +1 -1
- package/dist/skill-use.d.ts +61 -0
- package/dist/skills.d.ts +15 -0
- package/dist/slack-bot-scopes.d.ts +17 -12
- package/dist/slack-bot-scopes.js +10 -3
- package/dist/slack-rest-mcp.d.ts +36 -0
- package/dist/slack-rest-mcp.js +25 -0
- package/dist/slack-rest-mcp.js.map +1 -0
- package/dist/spreadsheet-artifact-commands.d.ts +14 -1
- package/dist/spreadsheet-artifact-commands.js +8 -2
- package/dist/spreadsheet-artifact-query.d.ts +13 -6
- package/dist/spreadsheet-artifact-query.js +3 -3
- package/dist/subscription-account-actions.d.ts +64 -0
- package/dist/subscription-account-pools.d.ts +292 -0
- package/dist/subscription-personal-authority-v2.d.ts +28 -0
- package/dist/subscription-personal-authority-v2.js +12 -0
- package/dist/subscription-personal-authority-v2.js.map +1 -0
- package/dist/tool-action-review.d.ts +132 -0
- package/dist/tool-catalog.d.ts +408 -0
- package/dist/tool-policy.d.ts +5 -0
- package/dist/tool-review-presentation.d.ts +12 -0
- package/dist/tool-review-presentation.js +17 -0
- package/dist/tool-review-presentation.js.map +1 -0
- package/dist/transcription-recordings.d.ts +21 -0
- package/dist/turn-serving-policy.d.ts +221 -0
- package/dist/usage-allowances.d.ts +314 -0
- package/dist/usage-allowances.js +52 -0
- package/dist/usage-allowances.js.map +1 -0
- package/dist/vaults.d.ts +1286 -0
- package/dist/video-generation.d.ts +3 -0
- package/dist/video-generation.js +2 -1
- 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 +1028 -0
- package/dist/xai-provider-account-authority.js +2 -1
- package/package.json +93 -5
- package/src/agent-authored-durable-text.ts +14 -11
- package/src/agent-config.ts +1698 -0
- package/src/agent-instruction-changes.ts +91 -74
- package/src/agent-learning.ts +94 -67
- package/src/agent-topology.ts +57 -52
- package/src/allowance-refusal.ts +81 -0
- package/src/analytics-consent-report.ts +20 -0
- package/src/api-key-presets.ts +28 -0
- package/src/artifact-catalog.ts +82 -0
- package/src/artifacts.ts +299 -227
- package/src/atlassian-native-retirement.ts +33 -0
- package/src/atlassian.ts +135 -108
- package/src/browser-storage.ts +10 -0
- package/src/bundled-skills.ts +60 -17
- package/src/canonical-human-identities.ts +60 -58
- package/src/claude-provider-account-authority.ts +12 -0
- package/src/claude-subscription-oauth.ts +73 -0
- package/src/claude-subscription-usage.ts +68 -0
- package/src/client-error-report.ts +343 -0
- package/src/code-search.ts +105 -0
- package/src/codex-provider-account-authority.ts +21 -16
- package/src/company-brain-governed-writes.ts +255 -233
- package/src/company-brain.ts +164 -153
- package/src/company-profile.ts +365 -292
- package/src/connect.ts +212 -173
- package/src/connection-account-label.ts +46 -0
- package/src/connection-authority.ts +183 -364
- package/src/connector-attachments.ts +137 -122
- package/src/connector-destinations.ts +46 -42
- package/src/connector-tool-permissions.ts +117 -0
- package/src/cua-desktop-tools.gen.json +6512 -0
- package/src/cua-desktop-tools.linux.gen.json +6600 -0
- package/src/cua-desktop-tools.ts +36 -0
- package/src/cua-desktop-tools.windows.gen.json +6353 -0
- package/src/define-schema.ts +10 -0
- package/src/direct-model-provider.ts +108 -0
- package/src/editable-artifact-committed-transaction.ts +17 -0
- package/src/editable-artifact-versions.ts +7 -1
- package/src/event-preview.ts +53 -3
- package/src/external-identities.ts +249 -176
- package/src/feedback.ts +43 -30
- package/src/first-party-tool-authorization.ts +356 -0
- package/src/github-repository-contracts.ts +78 -64
- package/src/google-drive.ts +285 -234
- package/src/governed-learning-activation.ts +152 -131
- package/src/governed-learning-evaluator.ts +140 -133
- package/src/host-mcp-bindings.ts +252 -198
- package/src/image-generation.ts +104 -95
- package/src/index.ts +13235 -8687
- package/src/insights-usage.ts +727 -0
- package/src/interaction.ts +3070 -2326
- package/src/knowledge-entries.ts +361 -276
- package/src/knowledge-preparation.ts +57 -0
- package/src/knowledge.ts +246 -213
- package/src/managed-auth-session-sets.ts +220 -144
- package/src/managed-sign-in-methods.ts +52 -0
- package/src/mcp-catalog-limits.ts +2 -0
- package/src/mcp-oauth.ts +43 -34
- package/src/mcp-receipts.ts +192 -192
- package/src/mcp-structured-content.ts +81 -0
- package/src/memory-slack-delivery.ts +171 -142
- package/src/modal-native-proof-v2.ts +429 -0
- package/src/model-account-choice.ts +177 -0
- package/src/model-account-settings.ts +210 -0
- package/src/model-availability.ts +22 -0
- package/src/model-connection-access.ts +61 -14
- package/src/model-context-inspector.ts +133 -99
- package/src/model-display.ts +221 -0
- package/src/model-picker-order.ts +12 -1
- package/src/organization-access.ts +217 -0
- package/src/organization-integration-policy.ts +63 -0
- package/src/organization-membership-lifecycle.ts +528 -382
- package/src/organization-model-usage.ts +81 -0
- package/src/organization-recovery.ts +147 -135
- package/src/organization-usage.ts +94 -0
- package/src/permissions.ts +88 -52
- package/src/personal-github.ts +210 -171
- package/src/preference-registry.ts +314 -258
- package/src/prepared-mcp-setup.ts +189 -0
- package/src/product-analytics.ts +261 -0
- package/src/product-lifecycle-facts.ts +122 -0
- package/src/remember.ts +181 -167
- package/src/retained-output.ts +194 -165
- package/src/sandbox-file-artifacts.ts +60 -47
- package/src/sandbox-provider-command.ts +88 -20
- package/src/sandbox-recovery.ts +129 -0
- package/src/scoped-knowledge.ts +61 -43
- package/src/secret-generator.ts +155 -0
- package/src/secret-references.ts +414 -0
- package/src/secret-resolution.ts +274 -0
- package/src/secret-totp.ts +188 -0
- package/src/session-final-reply.ts +16 -0
- package/src/session-goal-reports.ts +64 -0
- package/src/session-history-import.ts +177 -0
- package/src/session-list-entries.ts +96 -0
- package/src/session-mcp-projections.ts +11 -0
- package/src/session-mcp-tool-permissions.ts +108 -0
- package/src/session-message-search.ts +61 -0
- package/src/session-target.ts +57 -0
- package/src/session-titles.ts +80 -10
- package/src/session-topology-primitives.ts +19 -12
- package/src/session-usage-limit-refusal.ts +101 -0
- package/src/session-usage-limits.ts +171 -0
- package/src/signup-attribution.ts +86 -0
- package/src/site-data.ts +339 -0
- package/src/site-operations.ts +154 -0
- package/src/site-publishing.ts +876 -0
- package/src/site-session-http.ts +294 -16
- package/src/site-sql.ts +1123 -0
- package/src/skill-catalog-context.ts +50 -0
- package/src/skill-files.ts +3 -3
- package/src/skill-use.ts +80 -0
- package/src/skills.ts +82 -54
- package/src/slack-bot-scopes.ts +31 -39
- package/src/slack-rest-mcp.ts +222 -0
- package/src/slack-task-policy.ts +96 -73
- package/src/spreadsheet-artifact-commands.ts +73 -2
- package/src/spreadsheet-artifact-query.ts +187 -39
- package/src/subscription-account-actions.ts +84 -0
- package/src/subscription-account-pools.ts +53 -0
- package/src/subscription-personal-authority-v2.ts +66 -0
- package/src/task-notes.ts +55 -51
- package/src/tool-action-review.ts +258 -0
- package/src/tool-catalog.ts +609 -372
- package/src/tool-policy.ts +82 -0
- package/src/tool-result-spill.ts +12 -9
- package/src/tool-review-presentation.ts +385 -0
- package/src/transcription-recordings.ts +145 -131
- package/src/turn-serving-policy.ts +166 -0
- package/src/usage-allowances.ts +248 -0
- package/src/vaults.ts +850 -0
- package/src/video-generation.ts +385 -360
- package/src/work-claims.ts +173 -149
- package/src/workspace-instruction-policies.ts +349 -276
- package/src/workspace-integration-wire.ts +101 -0
- package/src/workspace-integrations.ts +724 -0
- package/src/workspace-learning-administration.ts +57 -44
- package/src/workspace-learning-policy.ts +127 -96
- package/src/workspace-state.ts +250 -220
- package/src/xai-provider-account-authority.ts +22 -17
- package/dist/chunk-2AC63F4S.js +0 -171
- package/dist/chunk-2AC63F4S.js.map +0 -1
- package/dist/chunk-3SIZGL3O.js.map +0 -1
- package/dist/chunk-7ABONTXE.js.map +0 -1
- package/dist/chunk-BCS7WHCK.js +0 -139
- package/dist/chunk-BCS7WHCK.js.map +0 -1
- package/dist/chunk-GRG7PHWQ.js +0 -25
- package/dist/chunk-GRG7PHWQ.js.map +0 -1
- package/dist/chunk-JUFK3T4Q.js +0 -80
- package/dist/chunk-JUFK3T4Q.js.map +0 -1
- package/dist/chunk-M5ZGRVIQ.js +0 -719
- package/dist/chunk-M5ZGRVIQ.js.map +0 -1
- package/dist/chunk-MRWYRAS5.js.map +0 -1
- package/dist/chunk-OVFORMPW.js +0 -348
- package/dist/chunk-OVFORMPW.js.map +0 -1
- package/dist/chunk-P3HLDT77.js +0 -59
- package/dist/chunk-P3HLDT77.js.map +0 -1
- package/dist/chunk-QQUJ6NPW.js +0 -23093
- package/dist/chunk-QQUJ6NPW.js.map +0 -1
- package/dist/chunk-TXTQIYCV.js.map +0 -1
- package/dist/chunk-WYBDERIY.js.map +0 -1
- package/dist/chunk-Y3KNXVTD.js.map +0 -1
- package/dist/chunk-YBW5JSA3.js.map +0 -1
- package/dist/chunk-YRXAWWCU.js +0 -45
- package/dist/chunk-YRXAWWCU.js.map +0 -1
- package/dist/host-mcp-resolvers.d.ts +0 -32
- package/dist/host-mcp-resolvers.js +0 -34
- package/dist/host-mcp-resolvers.js.map +0 -1
- package/src/host-mcp-resolvers.ts +0 -50
- /package/dist/{chunk-5LYFSZ7O.js.map → chunk-352X6ENP.js.map} +0 -0
- /package/dist/{chunk-O5LEQHDM.js.map → chunk-Z7WEVGCL.js.map} +0 -0
|
@@ -3,6 +3,11 @@ import {
|
|
|
3
3
|
canonicalSpreadsheetDateFromMilliseconds,
|
|
4
4
|
canonicalSpreadsheetDateMilliseconds,
|
|
5
5
|
} from "./spreadsheet-artifact-date";
|
|
6
|
+
import {
|
|
7
|
+
SPREADSHEET_DEFAULT_ROW_HEIGHT,
|
|
8
|
+
SPREADSHEET_DEFAULT_COLUMN_WIDTH,
|
|
9
|
+
SPREADSHEET_MAX_DIMENSION_PIXELS,
|
|
10
|
+
} from "./spreadsheet-artifact-commands";
|
|
6
11
|
|
|
7
12
|
/** Canonical private kernel query/projection ABI shared by browser and native bindings. */
|
|
8
13
|
export const SPREADSHEET_ARTIFACT_QUERY_VERSION = 1 as const;
|
|
@@ -24,6 +29,21 @@ const VIEWPORT_QUERY_PAYLOAD_BYTES = 32;
|
|
|
24
29
|
const VIEWPORT_PROJECTION_PREFIX_BYTES = 48;
|
|
25
30
|
const METADATA_PROJECTION_PREFIX_BYTES = 4;
|
|
26
31
|
const GENERATIONS_FLAG = 1;
|
|
32
|
+
const DIMENSIONS_FLAG = 2;
|
|
33
|
+
const DIMENSION_KEYS = [
|
|
34
|
+
"defaultRowHeight",
|
|
35
|
+
"defaultColumnWidth",
|
|
36
|
+
"rowHeights",
|
|
37
|
+
"columnWidths",
|
|
38
|
+
] as const;
|
|
39
|
+
|
|
40
|
+
/** Sparse absolute zero-based indices; omitted only in pre-dimension private projections. */
|
|
41
|
+
export type SpreadsheetArtifactDimensions = Readonly<{
|
|
42
|
+
defaultRowHeight?: number;
|
|
43
|
+
defaultColumnWidth?: number;
|
|
44
|
+
rowHeights?: readonly (readonly [number, number])[];
|
|
45
|
+
columnWidths?: readonly (readonly [number, number])[];
|
|
46
|
+
}>;
|
|
27
47
|
const UINT32_MAX = 0xffff_ffff;
|
|
28
48
|
const UINT64_MAX = 0xffff_ffff_ffff_ffffn;
|
|
29
49
|
const FNV_OFFSET = 0xcbf29ce484222325n;
|
|
@@ -85,16 +105,17 @@ export type SpreadsheetArtifactProjectedCell = Readonly<{
|
|
|
85
105
|
}>;
|
|
86
106
|
|
|
87
107
|
/** Complete and non-truncated. A limit breach is an error, never a partial response. */
|
|
88
|
-
export type SpreadsheetArtifactViewportProjection =
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
108
|
+
export type SpreadsheetArtifactViewportProjection = SpreadsheetArtifactDimensions &
|
|
109
|
+
Readonly<{
|
|
110
|
+
revision: bigint;
|
|
111
|
+
sheetId: EditableArtifactStableId;
|
|
112
|
+
generationId: EditableArtifactStableId | null;
|
|
113
|
+
startRow: number;
|
|
114
|
+
startColumn: number;
|
|
115
|
+
rowCount: number;
|
|
116
|
+
columnCount: number;
|
|
117
|
+
cells: readonly SpreadsheetArtifactProjectedCell[];
|
|
118
|
+
}>;
|
|
98
119
|
|
|
99
120
|
export type SpreadsheetArtifactUsedBounds = Readonly<{
|
|
100
121
|
startRow: number;
|
|
@@ -103,20 +124,21 @@ export type SpreadsheetArtifactUsedBounds = Readonly<{
|
|
|
103
124
|
endColumn: number;
|
|
104
125
|
}>;
|
|
105
126
|
|
|
106
|
-
export type SpreadsheetArtifactSheetMetadata =
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
127
|
+
export type SpreadsheetArtifactSheetMetadata = SpreadsheetArtifactDimensions &
|
|
128
|
+
Readonly<{
|
|
129
|
+
sheetId: EditableArtifactStableId;
|
|
130
|
+
generationId: EditableArtifactStableId | null;
|
|
131
|
+
name: string;
|
|
132
|
+
usedBounds: SpreadsheetArtifactUsedBounds | null;
|
|
133
|
+
}>;
|
|
112
134
|
|
|
113
135
|
/**
|
|
114
|
-
*
|
|
115
|
-
* merges
|
|
116
|
-
*
|
|
136
|
+
* Dimensions are carried under the explicit dimensions flag. Hidden state,
|
|
137
|
+
* merges and styles remain unsupported. Pre-dimension private projections
|
|
138
|
+
* carry dimensions=false and round-trip without inventing geometry.
|
|
117
139
|
*/
|
|
118
140
|
export type SpreadsheetArtifactModeledFeatures = Readonly<{
|
|
119
|
-
dimensions:
|
|
141
|
+
dimensions: boolean;
|
|
120
142
|
hidden: false;
|
|
121
143
|
merges: false;
|
|
122
144
|
}>;
|
|
@@ -232,6 +254,8 @@ export function encodeSpreadsheetViewportKernelProjection(
|
|
|
232
254
|
payload.u32(projection.startColumn);
|
|
233
255
|
payload.u32(projection.rowCount);
|
|
234
256
|
payload.u32(projection.columnCount);
|
|
257
|
+
const hasDimensions = projection.defaultRowHeight !== undefined;
|
|
258
|
+
if (hasDimensions) writeDimensions(payload, projection);
|
|
235
259
|
for (const cell of projection.cells) {
|
|
236
260
|
payload.u32(cell.row - projection.startRow);
|
|
237
261
|
payload.u32(cell.column - projection.startColumn);
|
|
@@ -240,7 +264,8 @@ export function encodeSpreadsheetViewportKernelProjection(
|
|
|
240
264
|
return encodeProjectionFrame(
|
|
241
265
|
0,
|
|
242
266
|
projection.revision,
|
|
243
|
-
projection.generationId === null ? 0 : GENERATIONS_FLAG
|
|
267
|
+
(projection.generationId === null ? 0 : GENERATIONS_FLAG) |
|
|
268
|
+
(hasDimensions ? DIMENSIONS_FLAG : 0),
|
|
244
269
|
projection.cells.length,
|
|
245
270
|
payload.finish(),
|
|
246
271
|
maximum,
|
|
@@ -257,7 +282,7 @@ export function encodeSpreadsheetMetadataKernelProjection(
|
|
|
257
282
|
SPREADSHEET_ARTIFACT_METADATA_MIN_RESPONSE_BYTES,
|
|
258
283
|
);
|
|
259
284
|
const payload = new DynamicWriter(maximum - PROJECTION_HEADER_BYTES - CHECKSUM_BYTES);
|
|
260
|
-
payload.u32(0);
|
|
285
|
+
payload.u32(projection.modeledFeatures.dimensions ? 1 : 0);
|
|
261
286
|
for (const sheet of projection.sheets) {
|
|
262
287
|
payload.stableId(sheet.sheetId);
|
|
263
288
|
payload.optionalStableId(sheet.generationId);
|
|
@@ -271,12 +296,14 @@ export function encodeSpreadsheetMetadataKernelProjection(
|
|
|
271
296
|
payload.u32(sheet.usedBounds.endRow);
|
|
272
297
|
payload.u32(sheet.usedBounds.endColumn);
|
|
273
298
|
}
|
|
299
|
+
if (projection.modeledFeatures.dimensions) writeDimensions(payload, sheet);
|
|
274
300
|
}
|
|
275
301
|
const generations = projection.sheets.length > 0 && projection.sheets[0]!.generationId !== null;
|
|
276
302
|
return encodeProjectionFrame(
|
|
277
303
|
1,
|
|
278
304
|
projection.revision,
|
|
279
|
-
generations ? GENERATIONS_FLAG : 0
|
|
305
|
+
(generations ? GENERATIONS_FLAG : 0) |
|
|
306
|
+
(projection.modeledFeatures.dimensions ? DIMENSIONS_FLAG : 0),
|
|
280
307
|
projection.sheets.length,
|
|
281
308
|
payload.finish(),
|
|
282
309
|
maximum,
|
|
@@ -498,7 +525,7 @@ function decodeProjectionFrame(bytes: Uint8Array): ProjectionFrame {
|
|
|
498
525
|
throw projectionError(`unsupported spreadsheet projection version: ${version}`);
|
|
499
526
|
}
|
|
500
527
|
const flags = reader.u16();
|
|
501
|
-
if ((flags & ~GENERATIONS_FLAG) !== 0) {
|
|
528
|
+
if ((flags & ~(GENERATIONS_FLAG | DIMENSIONS_FLAG)) !== 0) {
|
|
502
529
|
throw projectionError("spreadsheet projection flags are noncanonical");
|
|
503
530
|
}
|
|
504
531
|
const kindTag = reader.u8();
|
|
@@ -549,6 +576,8 @@ function decodeViewportPayload(frame: ProjectionFrame): SpreadsheetArtifactViewp
|
|
|
549
576
|
const rowCount = reader.u32();
|
|
550
577
|
const columnCount = reader.u32();
|
|
551
578
|
validateViewportGeometry(startRow, startColumn, rowCount, columnCount);
|
|
579
|
+
const dimensions = (frame.flags & DIMENSIONS_FLAG) !== 0 ? readDimensions(reader) : {};
|
|
580
|
+
validateDimensionExtent(dimensions, startRow, rowCount, startColumn, columnCount);
|
|
552
581
|
const cells: SpreadsheetArtifactProjectedCell[] = [];
|
|
553
582
|
let previousOrdinal = -1;
|
|
554
583
|
for (let index = 0; index < frame.itemCount; index += 1) {
|
|
@@ -579,6 +608,7 @@ function decodeViewportPayload(frame: ProjectionFrame): SpreadsheetArtifactViewp
|
|
|
579
608
|
reader.done("viewport projection payload contains trailing bytes");
|
|
580
609
|
return Object.freeze({
|
|
581
610
|
revision: frame.revision,
|
|
611
|
+
...dimensions,
|
|
582
612
|
sheetId,
|
|
583
613
|
generationId,
|
|
584
614
|
startRow,
|
|
@@ -597,7 +627,8 @@ function decodeMetadataPayload(frame: ProjectionFrame): SpreadsheetArtifactMetad
|
|
|
597
627
|
throw projectionError("metadata projection payload is truncated");
|
|
598
628
|
}
|
|
599
629
|
const reader = new Reader(frame.payload);
|
|
600
|
-
|
|
630
|
+
const features = reader.u32();
|
|
631
|
+
if ((features & ~1) !== 0 || (features === 1) !== ((frame.flags & DIMENSIONS_FLAG) !== 0)) {
|
|
601
632
|
throw projectionError("metadata projection contains unknown modeled feature bits");
|
|
602
633
|
}
|
|
603
634
|
const hasGenerations = (frame.flags & GENERATIONS_FLAG) !== 0;
|
|
@@ -631,12 +662,13 @@ function decodeMetadataPayload(frame: ProjectionFrame): SpreadsheetArtifactMetad
|
|
|
631
662
|
}
|
|
632
663
|
usedBounds = Object.freeze({ startRow, startColumn, endRow, endColumn });
|
|
633
664
|
}
|
|
634
|
-
|
|
665
|
+
const dimensions = (frame.flags & DIMENSIONS_FLAG) !== 0 ? readDimensions(reader) : {};
|
|
666
|
+
sheets.push(Object.freeze({ sheetId, generationId, name, usedBounds, ...dimensions }));
|
|
635
667
|
}
|
|
636
668
|
reader.done("metadata projection payload contains trailing bytes");
|
|
637
669
|
return Object.freeze({
|
|
638
670
|
revision: frame.revision,
|
|
639
|
-
modeledFeatures:
|
|
671
|
+
modeledFeatures: Object.freeze({ dimensions: features === 1, hidden: false, merges: false }),
|
|
640
672
|
sheets: Object.freeze(sheets),
|
|
641
673
|
});
|
|
642
674
|
}
|
|
@@ -694,7 +726,8 @@ function normalizeViewportProjection(input: unknown): SpreadsheetArtifactViewpor
|
|
|
694
726
|
"sheetId",
|
|
695
727
|
"startColumn",
|
|
696
728
|
"startRow",
|
|
697
|
-
|
|
729
|
+
...(projection.defaultRowHeight === undefined ? [] : DIMENSION_KEYS),
|
|
730
|
+
].sort(),
|
|
698
731
|
"spreadsheet viewport projection",
|
|
699
732
|
);
|
|
700
733
|
const revision = uint64(projection.revision, "viewport revision");
|
|
@@ -705,6 +738,9 @@ function normalizeViewportProjection(input: unknown): SpreadsheetArtifactViewpor
|
|
|
705
738
|
const rowCount = positiveUint32(projection.rowCount, "viewport rowCount");
|
|
706
739
|
const columnCount = positiveUint32(projection.columnCount, "viewport columnCount");
|
|
707
740
|
validateViewportGeometry(startRow, startColumn, rowCount, columnCount);
|
|
741
|
+
const dimensions =
|
|
742
|
+
projection.defaultRowHeight === undefined ? {} : normalizeDimensions(projection);
|
|
743
|
+
validateDimensionExtent(dimensions, startRow, rowCount, startColumn, columnCount);
|
|
708
744
|
if (!Array.isArray(projection.cells)) throw projectionError("viewport cells must be an array");
|
|
709
745
|
if (projection.cells.length > SPREADSHEET_ARTIFACT_VIEWPORT_MAX_CELLS) {
|
|
710
746
|
throw projectionError("viewport projection exceeds its hard cell limit");
|
|
@@ -733,6 +769,7 @@ function normalizeViewportProjection(input: unknown): SpreadsheetArtifactViewpor
|
|
|
733
769
|
}
|
|
734
770
|
return Object.freeze({
|
|
735
771
|
revision,
|
|
772
|
+
...dimensions,
|
|
736
773
|
sheetId,
|
|
737
774
|
generationId,
|
|
738
775
|
startRow,
|
|
@@ -753,8 +790,12 @@ function normalizeMetadataProjection(input: unknown): SpreadsheetArtifactMetadat
|
|
|
753
790
|
const revision = uint64(projection.revision, "metadata revision");
|
|
754
791
|
const features = exactRecord(projection.modeledFeatures, "metadata modeledFeatures");
|
|
755
792
|
exactKeys(features, ["dimensions", "hidden", "merges"], "metadata modeledFeatures");
|
|
756
|
-
if (
|
|
757
|
-
|
|
793
|
+
if (
|
|
794
|
+
typeof features.dimensions !== "boolean" ||
|
|
795
|
+
features.hidden !== false ||
|
|
796
|
+
features.merges !== false
|
|
797
|
+
) {
|
|
798
|
+
throw projectionError("metadata modeled features are invalid");
|
|
758
799
|
}
|
|
759
800
|
if (!Array.isArray(projection.sheets)) throw projectionError("metadata sheets must be an array");
|
|
760
801
|
if (projection.sheets.length > SPREADSHEET_ARTIFACT_METADATA_MAX_SHEETS) {
|
|
@@ -769,7 +810,17 @@ function normalizeMetadataProjection(input: unknown): SpreadsheetArtifactMetadat
|
|
|
769
810
|
ownArrayElement(projection.sheets, index, "metadata sheets"),
|
|
770
811
|
"metadata sheet",
|
|
771
812
|
);
|
|
772
|
-
exactKeys(
|
|
813
|
+
exactKeys(
|
|
814
|
+
value,
|
|
815
|
+
[
|
|
816
|
+
"generationId",
|
|
817
|
+
"name",
|
|
818
|
+
"sheetId",
|
|
819
|
+
"usedBounds",
|
|
820
|
+
...(features.dimensions ? DIMENSION_KEYS : []),
|
|
821
|
+
].sort(),
|
|
822
|
+
"metadata sheet",
|
|
823
|
+
);
|
|
773
824
|
const sheetId = spreadsheetSheetId(requireString(value.sheetId, "metadata sheetId"));
|
|
774
825
|
if (ids.has(sheetId)) throw projectionError("metadata projection contains duplicate sheet ids");
|
|
775
826
|
ids.add(sheetId);
|
|
@@ -789,15 +840,118 @@ function normalizeMetadataProjection(input: unknown): SpreadsheetArtifactMetadat
|
|
|
789
840
|
}
|
|
790
841
|
names.add(foldedName);
|
|
791
842
|
const usedBounds = value.usedBounds === null ? null : normalizeUsedBounds(value.usedBounds);
|
|
792
|
-
sheets.push(
|
|
843
|
+
sheets.push(
|
|
844
|
+
Object.freeze({
|
|
845
|
+
sheetId,
|
|
846
|
+
generationId,
|
|
847
|
+
name,
|
|
848
|
+
usedBounds,
|
|
849
|
+
...(features.dimensions ? normalizeDimensions(value) : {}),
|
|
850
|
+
}),
|
|
851
|
+
);
|
|
793
852
|
}
|
|
794
853
|
return Object.freeze({
|
|
795
854
|
revision,
|
|
796
|
-
modeledFeatures:
|
|
855
|
+
modeledFeatures: Object.freeze({
|
|
856
|
+
dimensions: features.dimensions,
|
|
857
|
+
hidden: false,
|
|
858
|
+
merges: false,
|
|
859
|
+
}),
|
|
797
860
|
sheets: Object.freeze(sheets),
|
|
798
861
|
});
|
|
799
862
|
}
|
|
800
863
|
|
|
864
|
+
function normalizeDimensions(input: Record<string, unknown>): SpreadsheetArtifactDimensions {
|
|
865
|
+
if (
|
|
866
|
+
input.defaultRowHeight !== SPREADSHEET_DEFAULT_ROW_HEIGHT ||
|
|
867
|
+
input.defaultColumnWidth !== SPREADSHEET_DEFAULT_COLUMN_WIDTH
|
|
868
|
+
) {
|
|
869
|
+
throw projectionError("dimension defaults are invalid");
|
|
870
|
+
}
|
|
871
|
+
const normalizeEntries = (
|
|
872
|
+
value: unknown,
|
|
873
|
+
defaultPixels: number,
|
|
874
|
+
): readonly (readonly [number, number])[] => {
|
|
875
|
+
if (!Array.isArray(value) || value.length > SPREADSHEET_ARTIFACT_PROJECTION_MAX_BYTES / 8)
|
|
876
|
+
throw projectionError("dimension entries exceed limits");
|
|
877
|
+
let previous = -1;
|
|
878
|
+
const entries: (readonly [number, number])[] = [];
|
|
879
|
+
for (let offset = 0; offset < value.length; offset += 1) {
|
|
880
|
+
const entry = ownArrayElement(value, offset, "dimension entries");
|
|
881
|
+
if (!Array.isArray(entry) || entry.length !== 2)
|
|
882
|
+
throw projectionError("dimension entry must be an index/pixels pair");
|
|
883
|
+
const index = uint32(ownArrayElement(entry, 0, "dimension index"), `dimension ${offset}`);
|
|
884
|
+
const pixels = positiveUint32(
|
|
885
|
+
ownArrayElement(entry, 1, "dimension pixels"),
|
|
886
|
+
"dimension pixels",
|
|
887
|
+
);
|
|
888
|
+
if (
|
|
889
|
+
index <= previous ||
|
|
890
|
+
pixels > SPREADSHEET_MAX_DIMENSION_PIXELS ||
|
|
891
|
+
pixels === defaultPixels
|
|
892
|
+
)
|
|
893
|
+
throw projectionError("dimensions must be sorted unique non-default entries within bounds");
|
|
894
|
+
previous = index;
|
|
895
|
+
entries.push(Object.freeze([index, pixels] as const));
|
|
896
|
+
}
|
|
897
|
+
return Object.freeze(entries);
|
|
898
|
+
};
|
|
899
|
+
return Object.freeze({
|
|
900
|
+
defaultRowHeight: SPREADSHEET_DEFAULT_ROW_HEIGHT,
|
|
901
|
+
defaultColumnWidth: SPREADSHEET_DEFAULT_COLUMN_WIDTH,
|
|
902
|
+
rowHeights: normalizeEntries(input.rowHeights, SPREADSHEET_DEFAULT_ROW_HEIGHT),
|
|
903
|
+
columnWidths: normalizeEntries(input.columnWidths, SPREADSHEET_DEFAULT_COLUMN_WIDTH),
|
|
904
|
+
});
|
|
905
|
+
}
|
|
906
|
+
|
|
907
|
+
function writeDimensions(writer: DynamicWriter, dimensions: SpreadsheetArtifactDimensions): void {
|
|
908
|
+
writer.u32(dimensions.defaultRowHeight!);
|
|
909
|
+
writer.u32(dimensions.defaultColumnWidth!);
|
|
910
|
+
for (const entries of [dimensions.rowHeights!, dimensions.columnWidths!]) {
|
|
911
|
+
writer.u32(entries.length);
|
|
912
|
+
for (const [index, pixels] of entries) {
|
|
913
|
+
writer.u32(index);
|
|
914
|
+
writer.u32(pixels);
|
|
915
|
+
}
|
|
916
|
+
}
|
|
917
|
+
}
|
|
918
|
+
|
|
919
|
+
function readDimensions(reader: Reader): SpreadsheetArtifactDimensions {
|
|
920
|
+
const defaultRowHeight = reader.u32();
|
|
921
|
+
const defaultColumnWidth = reader.u32();
|
|
922
|
+
const axes: (readonly [number, number])[][] = [];
|
|
923
|
+
for (let axis = 0; axis < 2; axis += 1) {
|
|
924
|
+
const count = reader.u32();
|
|
925
|
+
if (count > SPREADSHEET_ARTIFACT_PROJECTION_MAX_BYTES / 8)
|
|
926
|
+
throw projectionError("dimension entries exceed limits");
|
|
927
|
+
const entries: (readonly [number, number])[] = [];
|
|
928
|
+
for (let index = 0; index < count; index += 1) entries.push([reader.u32(), reader.u32()]);
|
|
929
|
+
axes.push(entries);
|
|
930
|
+
}
|
|
931
|
+
return normalizeDimensions({
|
|
932
|
+
defaultRowHeight,
|
|
933
|
+
defaultColumnWidth,
|
|
934
|
+
rowHeights: axes[0],
|
|
935
|
+
columnWidths: axes[1],
|
|
936
|
+
});
|
|
937
|
+
}
|
|
938
|
+
|
|
939
|
+
function validateDimensionExtent(
|
|
940
|
+
dimensions: SpreadsheetArtifactDimensions,
|
|
941
|
+
startRow: number,
|
|
942
|
+
rowCount: number,
|
|
943
|
+
startColumn: number,
|
|
944
|
+
columnCount: number,
|
|
945
|
+
): void {
|
|
946
|
+
if (
|
|
947
|
+
dimensions.rowHeights?.some(([index]) => index < startRow || index - startRow >= rowCount) ||
|
|
948
|
+
dimensions.columnWidths?.some(
|
|
949
|
+
([index]) => index < startColumn || index - startColumn >= columnCount,
|
|
950
|
+
)
|
|
951
|
+
)
|
|
952
|
+
throw projectionError("dimensions lie outside viewport");
|
|
953
|
+
}
|
|
954
|
+
|
|
801
955
|
function normalizeProjectedCell(input: unknown): SpreadsheetArtifactProjectedCell {
|
|
802
956
|
const cell = exactRecord(input, "projected cell");
|
|
803
957
|
exactKeys(cell, ["column", "formula", "row", "value"], "projected cell");
|
|
@@ -1053,12 +1207,6 @@ function projectionError(message: string): TypeError {
|
|
|
1053
1207
|
return new TypeError(message);
|
|
1054
1208
|
}
|
|
1055
1209
|
|
|
1056
|
-
const MODELED_FEATURES_NONE: SpreadsheetArtifactModeledFeatures = Object.freeze({
|
|
1057
|
-
dimensions: false,
|
|
1058
|
-
hidden: false,
|
|
1059
|
-
merges: false,
|
|
1060
|
-
});
|
|
1061
|
-
|
|
1062
1210
|
const EMPTY_VALUE: SpreadsheetArtifactProjectedCellValue = Object.freeze({
|
|
1063
1211
|
kind: "empty",
|
|
1064
1212
|
});
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { defineSchema } from "./define-schema";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Request bodies for subscription account actions (Codex, Claude, SuperGrok):
|
|
6
|
+
* renaming, pausing, rotation, extra credits and device sign-in. The routes
|
|
7
|
+
* validate with these, and the agent action catalog shows them as the input.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
/** Rename an account. An empty or null label goes back to the account's email. */
|
|
11
|
+
export const SubscriptionAccountRenameRequest = /* @__PURE__ */ defineSchema(() =>
|
|
12
|
+
z.object({
|
|
13
|
+
label: z.string().trim().max(200).nullable(),
|
|
14
|
+
}),
|
|
15
|
+
);
|
|
16
|
+
export type SubscriptionAccountRenameRequest = z.infer<typeof SubscriptionAccountRenameRequest>;
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Turn one account setting on or off: "used for new work" (allocator) or extra
|
|
20
|
+
* credits. expectedVersion is the account's current allocatorVersion or
|
|
21
|
+
* extraCreditsVersion; a stale version is refused so concurrent edits don't clash.
|
|
22
|
+
*/
|
|
23
|
+
export const SubscriptionAccountToggleRequest = /* @__PURE__ */ defineSchema(() =>
|
|
24
|
+
z.object({
|
|
25
|
+
enabled: z.boolean(),
|
|
26
|
+
expectedVersion: z.number().int().positive(),
|
|
27
|
+
}),
|
|
28
|
+
);
|
|
29
|
+
export type SubscriptionAccountToggleRequest = z.infer<typeof SubscriptionAccountToggleRequest>;
|
|
30
|
+
|
|
31
|
+
/** Account picking: true spreads work across every usable account, false uses the primary one only. */
|
|
32
|
+
export const SubscriptionRotationSettingsRequest = /* @__PURE__ */ defineSchema(() =>
|
|
33
|
+
z.object({
|
|
34
|
+
rotationEnabled: z.boolean(),
|
|
35
|
+
}),
|
|
36
|
+
);
|
|
37
|
+
export type SubscriptionRotationSettingsRequest = z.infer<
|
|
38
|
+
typeof SubscriptionRotationSettingsRequest
|
|
39
|
+
>;
|
|
40
|
+
|
|
41
|
+
/** Check a device sign-in with the state returned by its connect/start call. */
|
|
42
|
+
export const SubscriptionConnectPollRequest = /* @__PURE__ */ defineSchema(() =>
|
|
43
|
+
z.object({
|
|
44
|
+
state: z.string().min(1).max(16_384),
|
|
45
|
+
}),
|
|
46
|
+
);
|
|
47
|
+
export type SubscriptionConnectPollRequest = z.infer<typeof SubscriptionConnectPollRequest>;
|
|
48
|
+
|
|
49
|
+
/** Where a workspace SuperGrok sign-in lands: the shared workspace pool or only the person. */
|
|
50
|
+
export const SupergrokConnectStartRequest = /* @__PURE__ */ defineSchema(() =>
|
|
51
|
+
z.object({
|
|
52
|
+
scope: z.enum(["workspace", "user"]).default("workspace"),
|
|
53
|
+
}),
|
|
54
|
+
);
|
|
55
|
+
export type SupergrokConnectStartRequest = z.infer<typeof SupergrokConnectStartRequest>;
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* Which Codex accounts a workspace uses: automatic (Opengeni picks from the
|
|
59
|
+
* workspace's and the organization's accounts), only the workspace's own, only
|
|
60
|
+
* the organization's, or none (Codex off for the workspace).
|
|
61
|
+
*/
|
|
62
|
+
export const CodexSourceRequest = /* @__PURE__ */ defineSchema(() =>
|
|
63
|
+
z.object({
|
|
64
|
+
mode: z.enum(["automatic", "workspace", "organization", "disabled"]),
|
|
65
|
+
}),
|
|
66
|
+
);
|
|
67
|
+
export type CodexSourceRequest = z.infer<typeof CodexSourceRequest>;
|
|
68
|
+
|
|
69
|
+
/** Choose the Codex account that serves Codex Apps; expectedVersion is the current designation version. */
|
|
70
|
+
export const CodexAppsDesignationRequest = /* @__PURE__ */ defineSchema(() =>
|
|
71
|
+
z.object({
|
|
72
|
+
accountId: z.string().uuid(),
|
|
73
|
+
expectedVersion: z.number().int().nonnegative(),
|
|
74
|
+
}),
|
|
75
|
+
);
|
|
76
|
+
export type CodexAppsDesignationRequest = z.infer<typeof CodexAppsDesignationRequest>;
|
|
77
|
+
|
|
78
|
+
/** Pin one chat to a Codex account by id, or "auto" to let Opengeni pick again. */
|
|
79
|
+
export const SessionCodexAccountPinRequest = /* @__PURE__ */ defineSchema(() =>
|
|
80
|
+
z.object({
|
|
81
|
+
target: z.string().min(1).describe('"auto" or a Codex account id'),
|
|
82
|
+
}),
|
|
83
|
+
);
|
|
84
|
+
export type SessionCodexAccountPinRequest = z.infer<typeof SessionCodexAccountPinRequest>;
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { defineSchema } from "./define-schema";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
import { ClaudeSubscriptionUsage } from "./claude-subscription-usage";
|
|
4
|
+
|
|
5
|
+
/** Shared, secret-free account list contract for native subscription pools. */
|
|
6
|
+
export const SubscriptionAccountSummary = /* @__PURE__ */ defineSchema(() =>
|
|
7
|
+
z.object({
|
|
8
|
+
id: z.string().uuid(),
|
|
9
|
+
scope: z.enum(["organization", "workspace", "user"]),
|
|
10
|
+
subject: z.string().min(1),
|
|
11
|
+
email: z.string().email().nullable(),
|
|
12
|
+
label: z.string().nullable(),
|
|
13
|
+
plan: z.string().nullable(),
|
|
14
|
+
status: z.enum(["active", "needs_relogin", "error", "disabled"]),
|
|
15
|
+
active: z.boolean(),
|
|
16
|
+
expiresAt: z.string().datetime().nullable(),
|
|
17
|
+
lastRefreshAt: z.string().datetime().nullable(),
|
|
18
|
+
lastError: z.string().nullable(),
|
|
19
|
+
allocatorEnabled: z.boolean(),
|
|
20
|
+
allocatorVersion: z.number().int().positive(),
|
|
21
|
+
allocatorUpdatedAt: z.string().datetime().nullable(),
|
|
22
|
+
}),
|
|
23
|
+
);
|
|
24
|
+
export type SubscriptionAccountSummary = z.infer<typeof SubscriptionAccountSummary>;
|
|
25
|
+
export const SubscriptionPoolSettings = /* @__PURE__ */ defineSchema(() =>
|
|
26
|
+
z
|
|
27
|
+
.object({
|
|
28
|
+
rotationEnabled: z.boolean(),
|
|
29
|
+
rotationStrategy: z.literal("sharded"),
|
|
30
|
+
activeCredentialId: z.string().uuid().nullable(),
|
|
31
|
+
})
|
|
32
|
+
.strict(),
|
|
33
|
+
);
|
|
34
|
+
export type SubscriptionPoolSettings = z.infer<typeof SubscriptionPoolSettings>;
|
|
35
|
+
export const ClaudeSubscriptionAccount = /* @__PURE__ */ defineSchema(() =>
|
|
36
|
+
SubscriptionAccountSummary.extend({
|
|
37
|
+
version: z.number().int().positive(),
|
|
38
|
+
usage: ClaudeSubscriptionUsage.optional(),
|
|
39
|
+
}).strict(),
|
|
40
|
+
);
|
|
41
|
+
export type ClaudeSubscriptionAccount = z.infer<typeof ClaudeSubscriptionAccount>;
|
|
42
|
+
export const ClaudeSubscriptionAccountsResponse = /* @__PURE__ */ defineSchema(() =>
|
|
43
|
+
z
|
|
44
|
+
.object({
|
|
45
|
+
accounts: z.array(ClaudeSubscriptionAccount),
|
|
46
|
+
activeAccountId: z.string().uuid().nullable(),
|
|
47
|
+
source: z.enum(["organization", "workspace", "user"]),
|
|
48
|
+
organizationId: z.string().uuid(),
|
|
49
|
+
settings: SubscriptionPoolSettings,
|
|
50
|
+
})
|
|
51
|
+
.strict(),
|
|
52
|
+
);
|
|
53
|
+
export type ClaudeSubscriptionAccountsResponse = z.infer<typeof ClaudeSubscriptionAccountsResponse>;
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { defineSchema } from "./define-schema";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
|
|
4
|
+
const PositiveSafeInteger = /* @__PURE__ */ defineSchema(() =>
|
|
5
|
+
z.number().int().positive().max(Number.MAX_SAFE_INTEGER),
|
|
6
|
+
);
|
|
7
|
+
/**
|
|
8
|
+
* Canonical lowercase UUID, matching PostgreSQL uuid::text and the
|
|
9
|
+
* session_turns CHECK, so an accepted snapshot can never silently mismatch.
|
|
10
|
+
*/
|
|
11
|
+
const CanonicalUuid = /* @__PURE__ */ defineSchema(() =>
|
|
12
|
+
z.string().regex(/^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/),
|
|
13
|
+
);
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Immutable personal authority for accepted subscription work. Shared pool
|
|
17
|
+
* eligibility is live and deliberately absent from this snapshot.
|
|
18
|
+
*/
|
|
19
|
+
export const SubscriptionPersonalAuthorityV2 = /* @__PURE__ */ defineSchema(() =>
|
|
20
|
+
z
|
|
21
|
+
.object({
|
|
22
|
+
version: z.literal(2),
|
|
23
|
+
personal: z
|
|
24
|
+
.array(
|
|
25
|
+
z
|
|
26
|
+
.object({
|
|
27
|
+
provider: z.enum(["codex", "claude", "xai"]),
|
|
28
|
+
ownerMembershipId: CanonicalUuid,
|
|
29
|
+
authorityGeneration: PositiveSafeInteger,
|
|
30
|
+
/**
|
|
31
|
+
* Explicit personal consent accepted in a shared chat. Unlike the
|
|
32
|
+
* historical private-work pool, this authorizes only this connection
|
|
33
|
+
* in this session. Copies retain the restriction verbatim.
|
|
34
|
+
*/
|
|
35
|
+
sharedSessionChoice: z
|
|
36
|
+
.object({ sessionId: CanonicalUuid, connectionId: CanonicalUuid })
|
|
37
|
+
.strict()
|
|
38
|
+
.optional(),
|
|
39
|
+
})
|
|
40
|
+
.strict(),
|
|
41
|
+
)
|
|
42
|
+
.max(3),
|
|
43
|
+
})
|
|
44
|
+
.strict()
|
|
45
|
+
.superRefine((snapshot, ctx) => {
|
|
46
|
+
const providers = snapshot.personal.map((authority) => authority.provider);
|
|
47
|
+
if (new Set(providers).size !== providers.length) {
|
|
48
|
+
ctx.addIssue({ code: "custom", message: "Duplicate provider personal authority" });
|
|
49
|
+
}
|
|
50
|
+
}),
|
|
51
|
+
);
|
|
52
|
+
|
|
53
|
+
export type SubscriptionPersonalAuthorityV2 = z.infer<typeof SubscriptionPersonalAuthorityV2>;
|
|
54
|
+
|
|
55
|
+
/** Return one provider's immutable personal authority from a parsed snapshot. */
|
|
56
|
+
export function subscriptionPersonalAuthorityForProviderV2(
|
|
57
|
+
snapshot: SubscriptionPersonalAuthorityV2,
|
|
58
|
+
provider: SubscriptionPersonalAuthorityV2["personal"][number]["provider"],
|
|
59
|
+
): SubscriptionPersonalAuthorityV2["personal"][number] | null {
|
|
60
|
+
return snapshot.personal.find((authority) => authority.provider === provider) ?? null;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
export const EMPTY_SUBSCRIPTION_PERSONAL_AUTHORITY_V2 = {
|
|
64
|
+
version: 2,
|
|
65
|
+
personal: [],
|
|
66
|
+
} as const satisfies SubscriptionPersonalAuthorityV2;
|