@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
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The one TOTP implementation (RFC 6238 over RFC 4226 HOTP). Codes are
|
|
3
|
+
* computed at dispatch from a stored seed and never stored (invariant I4).
|
|
4
|
+
*
|
|
5
|
+
* HMAC uses `@noble/hashes`, which is synchronous and works in Bun, Node,
|
|
6
|
+
* browsers and React Native (no WebCrypto requirement).
|
|
7
|
+
*/
|
|
8
|
+
import { hmac } from "@noble/hashes/hmac";
|
|
9
|
+
import { sha1 } from "@noble/hashes/sha1";
|
|
10
|
+
import { sha256, sha512 } from "@noble/hashes/sha2";
|
|
11
|
+
|
|
12
|
+
export interface TotpParams {
|
|
13
|
+
secretBase32: string;
|
|
14
|
+
algorithm: "SHA1" | "SHA256" | "SHA512";
|
|
15
|
+
digits: 6 | 7 | 8;
|
|
16
|
+
periodSeconds: number;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export type SecretClock = { now(): number; sleep(ms: number): Promise<void> };
|
|
20
|
+
|
|
21
|
+
export const systemSecretClock: SecretClock = {
|
|
22
|
+
now: () => Date.now(),
|
|
23
|
+
sleep: (ms) => new Promise((resolve) => setTimeout(resolve, ms)),
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
/** Wait for the next window when fewer than this many ms remain (Q-33). */
|
|
27
|
+
export const TOTP_MIN_REMAINING_MS = 3_000;
|
|
28
|
+
|
|
29
|
+
export class TotpInputError extends Error {
|
|
30
|
+
constructor(message: string) {
|
|
31
|
+
super(message);
|
|
32
|
+
this.name = "TotpInputError";
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
const BASE32_ALPHABET = "ABCDEFGHIJKLMNOPQRSTUVWXYZ234567";
|
|
37
|
+
|
|
38
|
+
/** Uppercase, strip spaces, dashes and padding. */
|
|
39
|
+
export function normalizeBase32Secret(input: string): string {
|
|
40
|
+
return input.replace(/[\s-]/g, "").replace(/=+$/, "").toUpperCase();
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export function decodeBase32(input: string): Uint8Array {
|
|
44
|
+
const normalized = normalizeBase32Secret(input);
|
|
45
|
+
if (normalized.length === 0) throw new TotpInputError("TOTP secret is empty");
|
|
46
|
+
let bits = 0;
|
|
47
|
+
let value = 0;
|
|
48
|
+
const out: number[] = [];
|
|
49
|
+
for (const character of normalized) {
|
|
50
|
+
const index = BASE32_ALPHABET.indexOf(character);
|
|
51
|
+
if (index < 0) throw new TotpInputError("TOTP secret is not valid Base32");
|
|
52
|
+
value = ((value << 5) | index) & 0xffff;
|
|
53
|
+
bits += 5;
|
|
54
|
+
if (bits >= 8) {
|
|
55
|
+
out.push((value >>> (bits - 8)) & 0xff);
|
|
56
|
+
bits -= 8;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
if (out.length === 0) throw new TotpInputError("TOTP secret is empty");
|
|
60
|
+
return Uint8Array.from(out);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
function parseAlgorithm(value: string | null): TotpParams["algorithm"] {
|
|
64
|
+
if (value === null) return "SHA1";
|
|
65
|
+
const normalized = value.toUpperCase().replace("-", "");
|
|
66
|
+
if (normalized === "SHA1" || normalized === "SHA256" || normalized === "SHA512") {
|
|
67
|
+
return normalized;
|
|
68
|
+
}
|
|
69
|
+
throw new TotpInputError("TOTP algorithm must be SHA1, SHA256 or SHA512");
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
function parseDigits(value: string | null): TotpParams["digits"] {
|
|
73
|
+
if (value === null) return 6;
|
|
74
|
+
if (value === "6" || value === "7" || value === "8") return Number(value) as 6 | 7 | 8;
|
|
75
|
+
throw new TotpInputError("TOTP digits must be 6, 7 or 8");
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
function parsePeriod(value: string | null): number {
|
|
79
|
+
if (value === null) return 30;
|
|
80
|
+
if (!/^\d+$/.test(value)) throw new TotpInputError("TOTP period is invalid");
|
|
81
|
+
const period = Number(value);
|
|
82
|
+
if (period < 1 || period > 300) throw new TotpInputError("TOTP period must be 1 to 300 seconds");
|
|
83
|
+
return period;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* Accepts an `otpauth://totp/...` URI or a bare Base32 seed (spaces, dashes,
|
|
88
|
+
* padding and lowercase tolerated). Throws `TotpInputError`.
|
|
89
|
+
*/
|
|
90
|
+
export function parseTotpInput(input: string): TotpParams {
|
|
91
|
+
const trimmed = input.trim();
|
|
92
|
+
if (/^otpauth:/i.test(trimmed)) {
|
|
93
|
+
let url: URL;
|
|
94
|
+
try {
|
|
95
|
+
url = new URL(trimmed);
|
|
96
|
+
} catch {
|
|
97
|
+
throw new TotpInputError("TOTP otpauth URI is invalid");
|
|
98
|
+
}
|
|
99
|
+
// Engines differ on whether the type lands in host or pathname for
|
|
100
|
+
// non-special schemes; accept both.
|
|
101
|
+
const kind = (
|
|
102
|
+
url.hostname ||
|
|
103
|
+
url.pathname.replace(/^\/+/, "").split("/")[0] ||
|
|
104
|
+
""
|
|
105
|
+
).toLowerCase();
|
|
106
|
+
if (kind !== "totp") throw new TotpInputError("only otpauth://totp URIs are supported");
|
|
107
|
+
const secret = url.searchParams.get("secret");
|
|
108
|
+
if (!secret) throw new TotpInputError("TOTP otpauth URI has no secret");
|
|
109
|
+
const secretBase32 = normalizeBase32Secret(secret);
|
|
110
|
+
decodeBase32(secretBase32);
|
|
111
|
+
return {
|
|
112
|
+
secretBase32,
|
|
113
|
+
algorithm: parseAlgorithm(url.searchParams.get("algorithm")),
|
|
114
|
+
digits: parseDigits(url.searchParams.get("digits")),
|
|
115
|
+
periodSeconds: parsePeriod(url.searchParams.get("period")),
|
|
116
|
+
};
|
|
117
|
+
}
|
|
118
|
+
const secretBase32 = normalizeBase32Secret(trimmed);
|
|
119
|
+
decodeBase32(secretBase32);
|
|
120
|
+
return { secretBase32, algorithm: "SHA1", digits: 6, periodSeconds: 30 };
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
/** True when `input` parses as a TOTP seed or otpauth URI. */
|
|
124
|
+
export function isValidTotpInput(input: string): boolean {
|
|
125
|
+
try {
|
|
126
|
+
parseTotpInput(input);
|
|
127
|
+
return true;
|
|
128
|
+
} catch {
|
|
129
|
+
return false;
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
function hotp(key: Uint8Array, counter: number, params: TotpParams): string {
|
|
134
|
+
const message = new Uint8Array(8);
|
|
135
|
+
let remaining = counter;
|
|
136
|
+
for (let index = 7; index >= 0; index -= 1) {
|
|
137
|
+
message[index] = remaining % 256;
|
|
138
|
+
remaining = Math.floor(remaining / 256);
|
|
139
|
+
}
|
|
140
|
+
const hash = params.algorithm === "SHA1" ? sha1 : params.algorithm === "SHA256" ? sha256 : sha512;
|
|
141
|
+
const digest = hmac(hash, key, message);
|
|
142
|
+
const offset = digest[digest.length - 1]! & 0x0f;
|
|
143
|
+
const binary =
|
|
144
|
+
((digest[offset]! & 0x7f) << 24) |
|
|
145
|
+
((digest[offset + 1]! & 0xff) << 16) |
|
|
146
|
+
((digest[offset + 2]! & 0xff) << 8) |
|
|
147
|
+
(digest[offset + 3]! & 0xff);
|
|
148
|
+
return String(binary % 10 ** params.digits).padStart(params.digits, "0");
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
/** Synchronous form of `totpCode` for UI rendering loops. */
|
|
152
|
+
export function totpCodeSync(params: TotpParams, atMs: number): string {
|
|
153
|
+
if (!Number.isFinite(atMs) || atMs < 0) throw new TotpInputError("TOTP time is invalid");
|
|
154
|
+
if (!Number.isInteger(params.periodSeconds) || params.periodSeconds < 1) {
|
|
155
|
+
throw new TotpInputError("TOTP period is invalid");
|
|
156
|
+
}
|
|
157
|
+
const counter = Math.floor(atMs / 1000 / params.periodSeconds);
|
|
158
|
+
return hotp(decodeBase32(params.secretBase32), counter, params);
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
/** The code valid at `atMs` (Unix milliseconds). */
|
|
162
|
+
export async function totpCode(params: TotpParams, atMs: number): Promise<string> {
|
|
163
|
+
return totpCodeSync(params, atMs);
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
/** Milliseconds left in the window containing `atMs`. */
|
|
167
|
+
export function totpRemainingMs(params: TotpParams, atMs: number): number {
|
|
168
|
+
const periodMs = params.periodSeconds * 1000;
|
|
169
|
+
return periodMs - (atMs % periodMs);
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
/**
|
|
173
|
+
* The code to type or send right now. When fewer than 3 s remain in the
|
|
174
|
+
* current window, waits for the next window so the code is not stale on
|
|
175
|
+
* arrival (Q-33).
|
|
176
|
+
*/
|
|
177
|
+
export async function totpCodeAtDispatch(
|
|
178
|
+
params: TotpParams,
|
|
179
|
+
clock: SecretClock = systemSecretClock,
|
|
180
|
+
): Promise<{ code: string; expiresAtMs: number }> {
|
|
181
|
+
let now = clock.now();
|
|
182
|
+
const remaining = totpRemainingMs(params, now);
|
|
183
|
+
if (remaining < TOTP_MIN_REMAINING_MS) {
|
|
184
|
+
await clock.sleep(remaining);
|
|
185
|
+
now = clock.now();
|
|
186
|
+
}
|
|
187
|
+
return { code: totpCodeSync(params, now), expiresAtMs: now + totpRemainingMs(params, now) };
|
|
188
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/** A response-quality notice, not a failed turn or a completed deliverable. */
|
|
2
|
+
export const EMPTY_FINAL_REPLY_NOTICE =
|
|
3
|
+
"The model returned no final reply after a reply reminder. Completed work is preserved; the goal and later updates are unaffected.";
|
|
4
|
+
|
|
5
|
+
export type EmptyFinalReplyCompletion = {
|
|
6
|
+
emptyFinalReply: true;
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
export function turnCompletedWithEmptyFinalReply(payload: unknown): boolean {
|
|
10
|
+
return (
|
|
11
|
+
payload !== null &&
|
|
12
|
+
typeof payload === "object" &&
|
|
13
|
+
!Array.isArray(payload) &&
|
|
14
|
+
(payload as { emptyFinalReply?: unknown }).emptyFinalReply === true
|
|
15
|
+
);
|
|
16
|
+
}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { defineSchema } from "./define-schema";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
|
|
4
|
+
export const SessionGoalReportRequirement = /* @__PURE__ */ defineSchema(() =>
|
|
5
|
+
z
|
|
6
|
+
.object({
|
|
7
|
+
id: z
|
|
8
|
+
.string()
|
|
9
|
+
.max(64)
|
|
10
|
+
.describe(
|
|
11
|
+
"Stable report requirement identifier, at most 64 ASCII characters; not a title or status.",
|
|
12
|
+
)
|
|
13
|
+
.regex(/^[A-Za-z0-9][A-Za-z0-9_-]{0,63}$/),
|
|
14
|
+
title: z
|
|
15
|
+
.string()
|
|
16
|
+
.trim()
|
|
17
|
+
.min(1)
|
|
18
|
+
.max(512)
|
|
19
|
+
.describe(
|
|
20
|
+
"Short human-readable report title, at most 512 UTF-8 bytes. Keep normal spaces; do not put the report or a progress transcript here.",
|
|
21
|
+
)
|
|
22
|
+
.refine(
|
|
23
|
+
(value) => new TextEncoder().encode(value).byteLength <= 512,
|
|
24
|
+
"Report title exceeds 512 UTF-8 bytes",
|
|
25
|
+
),
|
|
26
|
+
})
|
|
27
|
+
.strict(),
|
|
28
|
+
);
|
|
29
|
+
export type SessionGoalReportRequirement = z.infer<typeof SessionGoalReportRequirement>;
|
|
30
|
+
|
|
31
|
+
export const SessionGoalReportRequirements = /* @__PURE__ */ defineSchema(() =>
|
|
32
|
+
z
|
|
33
|
+
.array(SessionGoalReportRequirement)
|
|
34
|
+
.max(16)
|
|
35
|
+
.superRefine((requirements, context) => {
|
|
36
|
+
if (new Set(requirements.map((item) => item.id)).size !== requirements.length) {
|
|
37
|
+
context.addIssue({ code: "custom", message: "Duplicate report requirement IDs" });
|
|
38
|
+
}
|
|
39
|
+
}),
|
|
40
|
+
);
|
|
41
|
+
|
|
42
|
+
export const SessionGoalReportDelivery = /* @__PURE__ */ defineSchema(() =>
|
|
43
|
+
z
|
|
44
|
+
.object({
|
|
45
|
+
requirementId: SessionGoalReportRequirement.shape.id,
|
|
46
|
+
artifactId: z
|
|
47
|
+
.string()
|
|
48
|
+
.regex(/^[0-9a-f]{32}$/)
|
|
49
|
+
.refine((value) => !/^0+$/.test(value)),
|
|
50
|
+
inspectionReceiptId: z.string().uuid(),
|
|
51
|
+
})
|
|
52
|
+
.strict(),
|
|
53
|
+
);
|
|
54
|
+
export type SessionGoalReportDelivery = z.infer<typeof SessionGoalReportDelivery>;
|
|
55
|
+
export const SessionGoalReportDeliveries = /* @__PURE__ */ defineSchema(() =>
|
|
56
|
+
z
|
|
57
|
+
.array(SessionGoalReportDelivery)
|
|
58
|
+
.max(16)
|
|
59
|
+
.superRefine((deliveries, context) => {
|
|
60
|
+
if (new Set(deliveries.map((item) => item.requirementId)).size !== deliveries.length) {
|
|
61
|
+
context.addIssue({ code: "custom", message: "Duplicate report delivery requirement IDs" });
|
|
62
|
+
}
|
|
63
|
+
}),
|
|
64
|
+
);
|
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
import { defineSchema } from "./define-schema";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
import { Session } from "./index";
|
|
4
|
+
import type { SessionEventType } from "./index";
|
|
5
|
+
|
|
6
|
+
/** Import is a server-side migration boundary, not an execution/history API. */
|
|
7
|
+
export const SESSION_HISTORY_IMPORT_MAX_EVENTS = 100;
|
|
8
|
+
export const SESSION_HISTORY_IMPORT_MAX_BODY_BYTES = 1_048_576;
|
|
9
|
+
export const SESSION_HISTORY_IMPORT_MAX_EVENT_BYTES = 262_144;
|
|
10
|
+
|
|
11
|
+
/** Historical facts only: no approval, credential, control or execution inputs. */
|
|
12
|
+
export const ARCHIVED_SESSION_IMPORT_EVENT_TYPES = [
|
|
13
|
+
"user.message",
|
|
14
|
+
"agent.message.delta",
|
|
15
|
+
"agent.message.completed",
|
|
16
|
+
"agent.reasoning.delta",
|
|
17
|
+
"agent.toolCall.created",
|
|
18
|
+
"agent.toolCall.output",
|
|
19
|
+
"artifact.created",
|
|
20
|
+
"turn.started",
|
|
21
|
+
"turn.completed",
|
|
22
|
+
"turn.failed",
|
|
23
|
+
"turn.cancelled",
|
|
24
|
+
"turn.superseded",
|
|
25
|
+
"goal.set",
|
|
26
|
+
"goal.updated",
|
|
27
|
+
"goal.progress",
|
|
28
|
+
"goal.completed",
|
|
29
|
+
"goal.paused",
|
|
30
|
+
"goal.resumed",
|
|
31
|
+
"goal.cleared",
|
|
32
|
+
] as const satisfies readonly SessionEventType[];
|
|
33
|
+
|
|
34
|
+
export const SessionImportedArchive = /* @__PURE__ */ /* @__PURE__ */ defineSchema(() =>
|
|
35
|
+
z
|
|
36
|
+
.object({
|
|
37
|
+
importId: z.string().min(1).max(200),
|
|
38
|
+
importedAt: z.iso.datetime({ offset: true }),
|
|
39
|
+
readOnly: z.literal(true),
|
|
40
|
+
})
|
|
41
|
+
.strict(),
|
|
42
|
+
);
|
|
43
|
+
export type SessionImportedArchive = z.infer<typeof SessionImportedArchive>;
|
|
44
|
+
|
|
45
|
+
/** JS/SQL session seams preserve millisecond precision; never silently truncate. */
|
|
46
|
+
const sourceTimestamp = /* @__PURE__ */ /* @__PURE__ */ defineSchema(() =>
|
|
47
|
+
z.iso
|
|
48
|
+
.datetime({ offset: true })
|
|
49
|
+
.refine((value) => !/\.\d{4}/u.test(value), "Source timestamp supports at most milliseconds"),
|
|
50
|
+
);
|
|
51
|
+
|
|
52
|
+
/** Validate JSON without coercing dates, dropping undefined, or rewriting text. */
|
|
53
|
+
function isImportJson(value: unknown): boolean {
|
|
54
|
+
const pending: Array<{ value: unknown; depth: number }> = [{ value, depth: 0 }];
|
|
55
|
+
const seen = new Set<object>();
|
|
56
|
+
let nodes = 0;
|
|
57
|
+
while (pending.length > 0) {
|
|
58
|
+
const entry = pending.pop()!;
|
|
59
|
+
if (++nodes > 100_000 || entry.depth > 64) return false;
|
|
60
|
+
const current = entry.value;
|
|
61
|
+
if (current === null || typeof current === "string" || typeof current === "boolean") continue;
|
|
62
|
+
if (typeof current === "number") {
|
|
63
|
+
if (!Number.isFinite(current) || Object.is(current, -0)) return false;
|
|
64
|
+
continue;
|
|
65
|
+
}
|
|
66
|
+
if (typeof current !== "object" || seen.has(current)) return false;
|
|
67
|
+
seen.add(current);
|
|
68
|
+
if (Array.isArray(current)) {
|
|
69
|
+
for (let index = 0; index < current.length; index++) {
|
|
70
|
+
if (!Object.hasOwn(current, index)) return false;
|
|
71
|
+
pending.push({ value: current[index], depth: entry.depth + 1 });
|
|
72
|
+
}
|
|
73
|
+
} else {
|
|
74
|
+
const prototype = Object.getPrototypeOf(current);
|
|
75
|
+
if (prototype !== Object.prototype && prototype !== null) return false;
|
|
76
|
+
for (const descriptor of Object.values(Object.getOwnPropertyDescriptors(current))) {
|
|
77
|
+
if (!descriptor.enumerable || !Object.hasOwn(descriptor, "value")) return false;
|
|
78
|
+
pending.push({ value: descriptor.value, depth: entry.depth + 1 });
|
|
79
|
+
}
|
|
80
|
+
if (Object.getOwnPropertySymbols(current).length > 0) return false;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
return true;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
function jsonBytes(value: unknown): number {
|
|
87
|
+
try {
|
|
88
|
+
return new TextEncoder().encode(JSON.stringify(value)).byteLength;
|
|
89
|
+
} catch {
|
|
90
|
+
return Number.POSITIVE_INFINITY;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
export const ArchivedSessionImportEvent = /* @__PURE__ */ /* @__PURE__ */ defineSchema(() =>
|
|
95
|
+
z
|
|
96
|
+
.object({
|
|
97
|
+
type: z.enum(ARCHIVED_SESSION_IMPORT_EVENT_TYPES),
|
|
98
|
+
createdAt: sourceTimestamp,
|
|
99
|
+
/** Source turn identity is presentation correlation; no execution row is created. */
|
|
100
|
+
turnId: z.string().uuid().nullable().optional(),
|
|
101
|
+
payload: z
|
|
102
|
+
.record(z.string(), z.unknown())
|
|
103
|
+
.refine(isImportJson, "Payload must be bounded JSON"),
|
|
104
|
+
})
|
|
105
|
+
.strict()
|
|
106
|
+
.refine(
|
|
107
|
+
(event) => isImportJson(event) && jsonBytes(event) <= SESSION_HISTORY_IMPORT_MAX_EVENT_BYTES,
|
|
108
|
+
"Imported event exceeds its JSON or byte limit",
|
|
109
|
+
),
|
|
110
|
+
);
|
|
111
|
+
export type ArchivedSessionImportEvent = z.infer<typeof ArchivedSessionImportEvent>;
|
|
112
|
+
|
|
113
|
+
const importEvents = /* @__PURE__ */ /* @__PURE__ */ defineSchema(() =>
|
|
114
|
+
z.array(ArchivedSessionImportEvent).max(SESSION_HISTORY_IMPORT_MAX_EVENTS),
|
|
115
|
+
);
|
|
116
|
+
|
|
117
|
+
export const ImportArchivedSessionRequest = /* @__PURE__ */ /* @__PURE__ */ defineSchema(() =>
|
|
118
|
+
z
|
|
119
|
+
.object({
|
|
120
|
+
importId: z.string().min(1).max(200),
|
|
121
|
+
title: z.string().min(1).max(200),
|
|
122
|
+
createdAt: sourceTimestamp,
|
|
123
|
+
/** The authenticated asUser actor supplies creator/owner, never a display label. */
|
|
124
|
+
visibility: z.enum(["workspace_shared", "user_private"]).optional(),
|
|
125
|
+
events: importEvents.default([]),
|
|
126
|
+
})
|
|
127
|
+
.strict()
|
|
128
|
+
.refine(
|
|
129
|
+
(request) => jsonBytes(request) <= SESSION_HISTORY_IMPORT_MAX_BODY_BYTES,
|
|
130
|
+
"Import request exceeds its byte limit",
|
|
131
|
+
),
|
|
132
|
+
);
|
|
133
|
+
export type ImportArchivedSessionRequest = z.input<typeof ImportArchivedSessionRequest>;
|
|
134
|
+
|
|
135
|
+
export const AppendArchivedSessionEventsRequest = /* @__PURE__ */ /* @__PURE__ */ defineSchema(() =>
|
|
136
|
+
z
|
|
137
|
+
.object({
|
|
138
|
+
batchId: z.string().min(1).max(200),
|
|
139
|
+
offset: z
|
|
140
|
+
.number()
|
|
141
|
+
.int()
|
|
142
|
+
.nonnegative()
|
|
143
|
+
.max(Number.MAX_SAFE_INTEGER)
|
|
144
|
+
.refine((value) => !Object.is(value, -0)),
|
|
145
|
+
events: importEvents.min(1),
|
|
146
|
+
})
|
|
147
|
+
.strict()
|
|
148
|
+
.refine(
|
|
149
|
+
(request) => jsonBytes(request) <= SESSION_HISTORY_IMPORT_MAX_BODY_BYTES,
|
|
150
|
+
"Import batch exceeds its byte limit",
|
|
151
|
+
),
|
|
152
|
+
);
|
|
153
|
+
export type AppendArchivedSessionEventsRequest = z.infer<typeof AppendArchivedSessionEventsRequest>;
|
|
154
|
+
|
|
155
|
+
// Lazy to preserve the root contracts initialization order; SDK uses types only.
|
|
156
|
+
export const ImportArchivedSessionResponse = /* @__PURE__ */ /* @__PURE__ */ defineSchema(() =>
|
|
157
|
+
z.object({
|
|
158
|
+
session: /* @__PURE__ */ z.lazy(() => Session),
|
|
159
|
+
importId: z.string(),
|
|
160
|
+
created: z.boolean(),
|
|
161
|
+
nextOffset: z.number().int().nonnegative(),
|
|
162
|
+
}),
|
|
163
|
+
);
|
|
164
|
+
export type ImportArchivedSessionResponse = z.infer<typeof ImportArchivedSessionResponse>;
|
|
165
|
+
|
|
166
|
+
export const AppendArchivedSessionEventsResponse = /* @__PURE__ */ /* @__PURE__ */ defineSchema(
|
|
167
|
+
() =>
|
|
168
|
+
z.object({
|
|
169
|
+
sessionId: z.string().uuid(),
|
|
170
|
+
importId: z.string(),
|
|
171
|
+
nextOffset: z.number().int().nonnegative(),
|
|
172
|
+
replayed: z.boolean(),
|
|
173
|
+
}),
|
|
174
|
+
);
|
|
175
|
+
export type AppendArchivedSessionEventsResponse = z.infer<
|
|
176
|
+
typeof AppendArchivedSessionEventsResponse
|
|
177
|
+
>;
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import type { Session, SessionListEntry } from "./index";
|
|
2
|
+
import {
|
|
3
|
+
deriveAutomaticSessionTitlePreview,
|
|
4
|
+
deriveSessionDisplayTitle,
|
|
5
|
+
sessionTitleIsPending,
|
|
6
|
+
} from "./session-titles";
|
|
7
|
+
|
|
8
|
+
/** Explicit list projection. Detail/configuration remains available from getSession. */
|
|
9
|
+
export type SessionListEntryInput = Omit<
|
|
10
|
+
SessionListEntry,
|
|
11
|
+
| "displayTitle"
|
|
12
|
+
| "renameSeed"
|
|
13
|
+
| "scheduledTaskId"
|
|
14
|
+
| "siteOrigin"
|
|
15
|
+
| "pinned"
|
|
16
|
+
| "pinnedAt"
|
|
17
|
+
| "pinVersion"
|
|
18
|
+
| "unread"
|
|
19
|
+
| "activelyWorking"
|
|
20
|
+
| "attentionVersion"
|
|
21
|
+
| "archived"
|
|
22
|
+
| "archivedAt"
|
|
23
|
+
| "archiveVersion"
|
|
24
|
+
> &
|
|
25
|
+
Partial<
|
|
26
|
+
Pick<
|
|
27
|
+
Session,
|
|
28
|
+
| "pinned"
|
|
29
|
+
| "pinnedAt"
|
|
30
|
+
| "pinVersion"
|
|
31
|
+
| "unread"
|
|
32
|
+
| "activelyWorking"
|
|
33
|
+
| "attentionVersion"
|
|
34
|
+
| "archived"
|
|
35
|
+
| "archivedAt"
|
|
36
|
+
| "archiveVersion"
|
|
37
|
+
>
|
|
38
|
+
> &
|
|
39
|
+
Pick<Session, "metadata" | "initialMessage">;
|
|
40
|
+
|
|
41
|
+
export function sessionListEntry(session: SessionListEntryInput): SessionListEntry {
|
|
42
|
+
const origin = session.metadata._opengeniSiteOrigin as
|
|
43
|
+
| { siteId?: unknown; title?: unknown }
|
|
44
|
+
| undefined;
|
|
45
|
+
const siteOrigin =
|
|
46
|
+
origin &&
|
|
47
|
+
typeof origin.siteId === "string" &&
|
|
48
|
+
/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/i.test(origin.siteId) &&
|
|
49
|
+
typeof origin.title === "string"
|
|
50
|
+
? { siteId: origin.siteId, title: origin.title }
|
|
51
|
+
: null;
|
|
52
|
+
const scheduledTaskId = session.metadata.scheduledTaskId;
|
|
53
|
+
return {
|
|
54
|
+
id: session.id,
|
|
55
|
+
workspaceId: session.workspaceId,
|
|
56
|
+
accountId: session.accountId,
|
|
57
|
+
status: session.status,
|
|
58
|
+
backgroundCommandActivity: session.backgroundCommandActivity,
|
|
59
|
+
hasSchedules: session.hasSchedules,
|
|
60
|
+
title: session.title,
|
|
61
|
+
titleSource: session.titleSource,
|
|
62
|
+
displayTitle: deriveSessionDisplayTitle(session),
|
|
63
|
+
renameSeed: sessionTitleIsPending(session)
|
|
64
|
+
? (deriveAutomaticSessionTitlePreview(session.initialMessage) ?? "")
|
|
65
|
+
: (session.title?.trim() ?? ""),
|
|
66
|
+
scheduledTaskId:
|
|
67
|
+
typeof scheduledTaskId === "string" && scheduledTaskId.length > 0 ? scheduledTaskId : null,
|
|
68
|
+
siteOrigin,
|
|
69
|
+
...(session.model ? { model: session.model } : {}),
|
|
70
|
+
...(session.reasoningEffort ? { reasoningEffort: session.reasoningEffort } : {}),
|
|
71
|
+
createdBy: session.createdBy,
|
|
72
|
+
channelId: session.channelId,
|
|
73
|
+
parentSessionId: session.parentSessionId,
|
|
74
|
+
rootSessionId: session.rootSessionId,
|
|
75
|
+
effectiveControl: session.effectiveControl,
|
|
76
|
+
inputWait: session.inputWait,
|
|
77
|
+
lastSequence: session.lastSequence,
|
|
78
|
+
pinned: session.pinned ?? false,
|
|
79
|
+
pinnedAt: session.pinnedAt ?? null,
|
|
80
|
+
pinVersion: session.pinVersion ?? 0,
|
|
81
|
+
unread: session.unread ?? false,
|
|
82
|
+
activelyWorking: session.activelyWorking ?? false,
|
|
83
|
+
attentionVersion: session.attentionVersion ?? 0,
|
|
84
|
+
archived: session.archived ?? false,
|
|
85
|
+
archivedAt: session.archivedAt ?? null,
|
|
86
|
+
importedArchive: session.importedArchive,
|
|
87
|
+
...(session.retention ? { retention: session.retention } : {}),
|
|
88
|
+
archiveVersion: session.archiveVersion ?? 0,
|
|
89
|
+
treeStats: session.treeStats,
|
|
90
|
+
requiresActionSince: session.requiresActionSince,
|
|
91
|
+
// Lets lists tell a runtime-held session apart from one waiting on a person.
|
|
92
|
+
...(session.admissionBlock !== undefined ? { admissionBlock: session.admissionBlock } : {}),
|
|
93
|
+
createdAt: session.createdAt,
|
|
94
|
+
updatedAt: session.updatedAt,
|
|
95
|
+
};
|
|
96
|
+
}
|
|
@@ -209,6 +209,17 @@ export function compactSessionMcpDetail(
|
|
|
209
209
|
...(session.parentSessionId ? { parentSessionId: session.parentSessionId } : {}),
|
|
210
210
|
...(session.activeTurnId ? { activeTurnId: session.activeTurnId } : {}),
|
|
211
211
|
lastSequence: session.lastSequence,
|
|
212
|
+
// Archived sessions keep a readable timeline but accept no new work.
|
|
213
|
+
...(session.retention?.archive
|
|
214
|
+
? {
|
|
215
|
+
archive: {
|
|
216
|
+
state: session.retention.archive.state,
|
|
217
|
+
archivedAt: session.retention.archive.archivedAt,
|
|
218
|
+
readOnly: true,
|
|
219
|
+
},
|
|
220
|
+
}
|
|
221
|
+
: {}),
|
|
222
|
+
...(session.retention?.keepLive ? { keepLive: true } : {}),
|
|
212
223
|
...(goal
|
|
213
224
|
? {
|
|
214
225
|
goal: {
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import { defineSchema } from "./define-schema";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
import { ConnectorToolPermission } from "./connector-tool-permissions";
|
|
4
|
+
import { MCP_MAX_CATALOG_TOOL_ENTRIES } from "./mcp-catalog-limits";
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Tool `_meta` key an MCP server sets in `tools/list` to recommend a default
|
|
8
|
+
* permission for that tool: `"ask"` or `"allow"`. Like `requireApproval`, it
|
|
9
|
+
* applies only when the workspace has no saved choice for the tool and no
|
|
10
|
+
* server default. The tool asks when either this or `requireApproval` says so.
|
|
11
|
+
*/
|
|
12
|
+
export const MCP_TOOL_RECOMMENDED_PERMISSION_META_KEY = "opengeni/recommendedPermission" as const;
|
|
13
|
+
|
|
14
|
+
/** True when a listed MCP tool recommends Ask through its `_meta`. */
|
|
15
|
+
export function mcpToolRecommendsApproval(tool: object): boolean {
|
|
16
|
+
const meta = (tool as { _meta?: unknown })._meta;
|
|
17
|
+
return (
|
|
18
|
+
typeof meta === "object" &&
|
|
19
|
+
meta !== null &&
|
|
20
|
+
(meta as Record<string, unknown>)[MCP_TOOL_RECOMMENDED_PERMISSION_META_KEY] === "ask"
|
|
21
|
+
);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
// Host-attached session MCP servers have no catalog capability. Their tool
|
|
25
|
+
// permissions are keyed by the same secret-free identity the runtime derives:
|
|
26
|
+
// `session-mcp:<serverId>:<sha256(exact url)>`. The host names the server and
|
|
27
|
+
// the exact URL it attaches to sessions; Opengeni stores and enforces the rules.
|
|
28
|
+
const sessionMcpServerId = /* @__PURE__ */ defineSchema(() =>
|
|
29
|
+
z
|
|
30
|
+
.string()
|
|
31
|
+
.min(1)
|
|
32
|
+
.max(200)
|
|
33
|
+
.regex(/^[A-Za-z0-9_-]+$/),
|
|
34
|
+
);
|
|
35
|
+
const sessionMcpServerUrl = /* @__PURE__ */ defineSchema(() =>
|
|
36
|
+
z
|
|
37
|
+
.string()
|
|
38
|
+
.min(1)
|
|
39
|
+
.max(2048)
|
|
40
|
+
.refine(
|
|
41
|
+
(value) => {
|
|
42
|
+
try {
|
|
43
|
+
const url = new URL(value);
|
|
44
|
+
return url.protocol === "https:" || url.protocol === "http:";
|
|
45
|
+
} catch {
|
|
46
|
+
return false;
|
|
47
|
+
}
|
|
48
|
+
},
|
|
49
|
+
{ message: "url must be the exact http(s) URL attached to sessions" },
|
|
50
|
+
),
|
|
51
|
+
);
|
|
52
|
+
const exactToolName = /* @__PURE__ */ defineSchema(() =>
|
|
53
|
+
z
|
|
54
|
+
.string()
|
|
55
|
+
.min(1)
|
|
56
|
+
.max(512)
|
|
57
|
+
.refine((name) => name !== "*" && name === name.trim(), {
|
|
58
|
+
message: "Tool names must be exact and cannot use the server-default wildcard.",
|
|
59
|
+
}),
|
|
60
|
+
);
|
|
61
|
+
|
|
62
|
+
export const SessionMcpToolPermissionsQuery = /* @__PURE__ */ defineSchema(() =>
|
|
63
|
+
z.object({ serverId: sessionMcpServerId, url: sessionMcpServerUrl }).strict(),
|
|
64
|
+
);
|
|
65
|
+
export type SessionMcpToolPermissionsQuery = z.infer<typeof SessionMcpToolPermissionsQuery>;
|
|
66
|
+
|
|
67
|
+
/** Saved choices only. Tools without a rule follow `defaultPermission`, then
|
|
68
|
+
* the server's recommendation (the tool's `opengeni/recommendedPermission`
|
|
69
|
+
* `_meta`, or the attaching session's `requireApproval`), then Allow. */
|
|
70
|
+
export const SessionMcpToolPermissionsResponse = /* @__PURE__ */ defineSchema(() =>
|
|
71
|
+
z.object({
|
|
72
|
+
connectionId: z.string(),
|
|
73
|
+
serverId: z.string(),
|
|
74
|
+
defaultPermission: ConnectorToolPermission.nullable(),
|
|
75
|
+
tools: z.array(z.object({ toolName: z.string(), permission: ConnectorToolPermission })),
|
|
76
|
+
revision: z.string(),
|
|
77
|
+
canManage: z.boolean(),
|
|
78
|
+
appliesTo: z.literal("next_attempt"),
|
|
79
|
+
}),
|
|
80
|
+
);
|
|
81
|
+
export type SessionMcpToolPermissionsResponse = z.infer<typeof SessionMcpToolPermissionsResponse>;
|
|
82
|
+
|
|
83
|
+
export const UpdateSessionMcpToolPermissionsRequest = /* @__PURE__ */ defineSchema(() =>
|
|
84
|
+
z.discriminatedUnion("target", [
|
|
85
|
+
z
|
|
86
|
+
.object({
|
|
87
|
+
serverId: sessionMcpServerId,
|
|
88
|
+
url: sessionMcpServerUrl,
|
|
89
|
+
target: z.literal("default"),
|
|
90
|
+
permission: ConnectorToolPermission.nullable(),
|
|
91
|
+
expectedRevision: z.string().optional(),
|
|
92
|
+
})
|
|
93
|
+
.strict(),
|
|
94
|
+
z
|
|
95
|
+
.object({
|
|
96
|
+
serverId: sessionMcpServerId,
|
|
97
|
+
url: sessionMcpServerUrl,
|
|
98
|
+
target: z.literal("tools"),
|
|
99
|
+
toolNames: z.array(exactToolName).min(1).max(MCP_MAX_CATALOG_TOOL_ENTRIES),
|
|
100
|
+
permission: ConnectorToolPermission.nullable(),
|
|
101
|
+
expectedRevision: z.string().optional(),
|
|
102
|
+
})
|
|
103
|
+
.strict(),
|
|
104
|
+
]),
|
|
105
|
+
);
|
|
106
|
+
export type UpdateSessionMcpToolPermissionsRequest = z.infer<
|
|
107
|
+
typeof UpdateSessionMcpToolPermissionsRequest
|
|
108
|
+
>;
|