@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,221 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* One display identity for a model everywhere outside the Models settings page.
|
|
3
|
+
*
|
|
4
|
+
* Catalog ids carry routing facts (`codex/`, `organization-claude-subscription/`,
|
|
5
|
+
* `workspace-openrouter/anthropic/...`) and custom models may have no curated
|
|
6
|
+
* label. People should only ever see the model itself: `GPT-6.1 Sol`,
|
|
7
|
+
* `Opus 5.5`. The same upstream model therefore renders identically
|
|
8
|
+
* whether an organization or a workspace connection serves it.
|
|
9
|
+
*
|
|
10
|
+
* Pure and dependency-free so the API, SDK, React package and web app share it.
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
export type ModelVendor =
|
|
14
|
+
| "openai"
|
|
15
|
+
| "anthropic"
|
|
16
|
+
| "xai"
|
|
17
|
+
| "google"
|
|
18
|
+
| "meta"
|
|
19
|
+
| "mistral"
|
|
20
|
+
| "deepseek"
|
|
21
|
+
| "moonshot"
|
|
22
|
+
| "qwen"
|
|
23
|
+
| "zhipu"
|
|
24
|
+
| "nvidia";
|
|
25
|
+
|
|
26
|
+
export type ModelDisplayInput =
|
|
27
|
+
| string
|
|
28
|
+
| {
|
|
29
|
+
id: string;
|
|
30
|
+
label?: string | null | undefined;
|
|
31
|
+
logoUrl?: string | null | undefined;
|
|
32
|
+
upstreamModelId?: string | null | undefined;
|
|
33
|
+
deployment?: { upstreamModelId?: string | null | undefined } | null | undefined;
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
/** Catalog maker logo; remote images must use HTTPS without embedded credentials. */
|
|
37
|
+
export function modelLogoUrl(input: ModelDisplayInput): string | null {
|
|
38
|
+
const value = typeof input === "string" ? undefined : input.logoUrl;
|
|
39
|
+
if (!value || value.length > 2048 || value !== value.trim()) return null;
|
|
40
|
+
try {
|
|
41
|
+
const url = new URL(value);
|
|
42
|
+
return url.protocol === "https:" && !url.username && !url.password ? value : null;
|
|
43
|
+
} catch {
|
|
44
|
+
return null;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
const WORDS: Readonly<Record<string, string>> = {
|
|
49
|
+
gpt: "GPT",
|
|
50
|
+
chatgpt: "ChatGPT",
|
|
51
|
+
claude: "Claude",
|
|
52
|
+
grok: "Grok",
|
|
53
|
+
gemini: "Gemini",
|
|
54
|
+
gemma: "Gemma",
|
|
55
|
+
llama: "Llama",
|
|
56
|
+
deepseek: "DeepSeek",
|
|
57
|
+
qwen: "Qwen",
|
|
58
|
+
glm: "GLM",
|
|
59
|
+
kimi: "Kimi",
|
|
60
|
+
mistral: "Mistral",
|
|
61
|
+
codestral: "Codestral",
|
|
62
|
+
devstral: "Devstral",
|
|
63
|
+
magistral: "Magistral",
|
|
64
|
+
nemotron: "Nemotron",
|
|
65
|
+
oss: "OSS",
|
|
66
|
+
// Region-pinned gateway routes (Opper `aws/claude-sonnet-4-6-eu`).
|
|
67
|
+
eu: "EU",
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
/** The upstream model slug without routing prefixes or `:variant` suffixes. */
|
|
71
|
+
export function modelSlug(value: string): string {
|
|
72
|
+
const last = value.split("/").filter(Boolean).at(-1) ?? value;
|
|
73
|
+
return last.replace(/:[^:]*$/, "") || last;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
function upstreamOf(input: Exclude<ModelDisplayInput, string>): string | null {
|
|
77
|
+
return input.upstreamModelId?.trim() || input.deployment?.upstreamModelId?.trim() || null;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
function titleToken(token: string, index: number): string {
|
|
81
|
+
const lower = token.toLowerCase();
|
|
82
|
+
const word = WORDS[lower];
|
|
83
|
+
if (word) return word;
|
|
84
|
+
// OpenAI reasoning series stay lowercase: o3, o4 Mini.
|
|
85
|
+
if (index === 0 && /^o\d+$/.test(lower)) return lower;
|
|
86
|
+
// Sizes and lettered versions read as identifiers: 120B, V4, K3, A12B.
|
|
87
|
+
if (/^\d+(?:\.\d+)?[bkmt]$/.test(lower) || /^[a-z]\d+[a-z\d]*$/.test(lower)) {
|
|
88
|
+
return lower.toUpperCase();
|
|
89
|
+
}
|
|
90
|
+
if (/^\d/.test(token)) return lower;
|
|
91
|
+
return lower.charAt(0).toUpperCase() + lower.slice(1);
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
/** `claude-opus-5-5` → `Claude Opus 5.5`, `codex/gpt-6.1-sol` → `GPT-6.1 Sol`. */
|
|
95
|
+
export function humanizeModelSlug(value: string): string {
|
|
96
|
+
const slug = modelSlug(value.trim())
|
|
97
|
+
// Snapshot dates are release detail, not a different model name.
|
|
98
|
+
.replace(/[-_](?:\d{8}|\d{4}-\d{2}-\d{2})$/, "")
|
|
99
|
+
.replace(/[-_]latest$/i, "");
|
|
100
|
+
const raw = slug.split(/[-_\s]+/).filter(Boolean);
|
|
101
|
+
if (raw.length === 0) return value.trim() || value;
|
|
102
|
+
// Consecutive short numbers are one version: 5-5 → 5.5, 3-5 → 3.5. Longer
|
|
103
|
+
// numbers are snapshots (gpt-4-1106-preview), never a minor version.
|
|
104
|
+
const tokens: string[] = [];
|
|
105
|
+
for (const token of raw) {
|
|
106
|
+
const previous = tokens.at(-1);
|
|
107
|
+
if (previous !== undefined && /^\d{1,2}$/.test(token) && /^\d{1,2}$/.test(previous)) {
|
|
108
|
+
tokens[tokens.length - 1] = `${previous}.${token}`;
|
|
109
|
+
continue;
|
|
110
|
+
}
|
|
111
|
+
tokens.push(token);
|
|
112
|
+
}
|
|
113
|
+
const words = tokens.map(titleToken);
|
|
114
|
+
// OpenAI's own spelling joins family and version: GPT-6.1, GPT-4o.
|
|
115
|
+
if (words[0] === "GPT" && words.length > 1 && /^\d/.test(words[1]!)) {
|
|
116
|
+
return [`GPT-${words[1]}`, ...words.slice(2)].join(" ");
|
|
117
|
+
}
|
|
118
|
+
return words.join(" ");
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
/**
|
|
122
|
+
* True when a catalog label is only the model's identifier: empty, or exactly
|
|
123
|
+
* its id, upstream id, or any trailing path of them (`claude-opus-4-8`,
|
|
124
|
+
* `anthropic/claude-sonnet-4.6`). Any other label is a curated name and wins.
|
|
125
|
+
*/
|
|
126
|
+
export function isRawModelLabel(
|
|
127
|
+
label: string,
|
|
128
|
+
ids: readonly (string | null | undefined)[] = [],
|
|
129
|
+
): boolean {
|
|
130
|
+
const text = label.trim();
|
|
131
|
+
if (!text) return true;
|
|
132
|
+
return ids.some((id) => {
|
|
133
|
+
if (!id) return false;
|
|
134
|
+
const segments = id.trim().split("/").filter(Boolean);
|
|
135
|
+
return segments.some((_, index) => {
|
|
136
|
+
const tail = segments.slice(index).join("/");
|
|
137
|
+
return tail === text || modelSlug(tail) === text;
|
|
138
|
+
});
|
|
139
|
+
});
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
/**
|
|
143
|
+
* The clean name to show for a model: its curated catalog label when it has
|
|
144
|
+
* one, otherwise a readable form of the upstream model id. Never a routing
|
|
145
|
+
* prefix, connection id or connection scope. Anthropic's Opus, Sonnet and
|
|
146
|
+
* Haiku families drop the redundant `Claude` word (the maker mark already says
|
|
147
|
+
* it): `Opus 5.5`, `Sonnet 4.6 EU`.
|
|
148
|
+
*/
|
|
149
|
+
export function modelDisplayName(input: ModelDisplayInput): string {
|
|
150
|
+
if (typeof input === "string") {
|
|
151
|
+
// A bare id is humanized; text with spaces is already a name ("Workspace default").
|
|
152
|
+
return input.trim() && !/\s/.test(input.trim())
|
|
153
|
+
? withoutClaudeFamilyPrefix(humanizeModelSlug(input))
|
|
154
|
+
: input;
|
|
155
|
+
}
|
|
156
|
+
const upstream = upstreamOf(input);
|
|
157
|
+
const label = input.label?.trim();
|
|
158
|
+
if (label && !isRawModelLabel(label, [input.id, upstream])) {
|
|
159
|
+
return withoutClaudeFamilyPrefix(label);
|
|
160
|
+
}
|
|
161
|
+
return withoutClaudeFamilyPrefix(humanizeModelSlug(upstream ?? label ?? input.id));
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
/** `Claude Opus 5.5` → `Opus 5.5`; other names (`Claude 3.5 Sonnet`) unchanged. */
|
|
165
|
+
function withoutClaudeFamilyPrefix(name: string): string {
|
|
166
|
+
return name.replace(/^Claude\s+(?=(?:Opus|Sonnet|Haiku)\b)/, "");
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
const VENDOR_PATTERNS: ReadonlyArray<readonly [ModelVendor, RegExp]> = [
|
|
170
|
+
["anthropic", /^claude\b/],
|
|
171
|
+
["openai", /^(?:gpt|chatgpt|o\d+|codex|dall-e|sora|text-embedding|whisper)\b/],
|
|
172
|
+
["xai", /^grok\b/],
|
|
173
|
+
["google", /^(?:gemini|gemma)\b/],
|
|
174
|
+
["meta", /^llama\b/],
|
|
175
|
+
["mistral", /^(?:mistral|codestral|devstral|magistral|ministral|pixtral)\b/],
|
|
176
|
+
["deepseek", /^deepseek\b/],
|
|
177
|
+
["moonshot", /^(?:kimi|moonshot)\b/],
|
|
178
|
+
["qwen", /^(?:qwen|qwq)\b/],
|
|
179
|
+
["zhipu", /^glm\b/],
|
|
180
|
+
["nvidia", /^nemotron\b/],
|
|
181
|
+
];
|
|
182
|
+
|
|
183
|
+
/** OpenRouter / Gateway vendor path segments (`anthropic/claude-…`). */
|
|
184
|
+
const VENDOR_SEGMENTS: Readonly<Record<string, ModelVendor>> = {
|
|
185
|
+
anthropic: "anthropic",
|
|
186
|
+
openai: "openai",
|
|
187
|
+
"x-ai": "xai",
|
|
188
|
+
xai: "xai",
|
|
189
|
+
google: "google",
|
|
190
|
+
"meta-llama": "meta",
|
|
191
|
+
mistralai: "mistral",
|
|
192
|
+
deepseek: "deepseek",
|
|
193
|
+
moonshotai: "moonshot",
|
|
194
|
+
qwen: "qwen",
|
|
195
|
+
"z-ai": "zhipu",
|
|
196
|
+
nvidia: "nvidia",
|
|
197
|
+
};
|
|
198
|
+
|
|
199
|
+
function vendorFromSlug(slug: string): ModelVendor | null {
|
|
200
|
+
for (const [vendor, pattern] of VENDOR_PATTERNS) if (pattern.test(slug)) return vendor;
|
|
201
|
+
return null;
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
/** Who makes the model, for its logo. Null when it cannot be told. */
|
|
205
|
+
export function modelVendor(input: ModelDisplayInput): ModelVendor | null {
|
|
206
|
+
const ids = typeof input === "string" ? [input] : [upstreamOf(input), input.id];
|
|
207
|
+
for (const id of ids) {
|
|
208
|
+
if (!id) continue;
|
|
209
|
+
const lower = id.trim().toLowerCase();
|
|
210
|
+
if (lower.startsWith("codex/")) return "openai";
|
|
211
|
+
if (lower.startsWith("supergrok/")) return "xai";
|
|
212
|
+
const vendor = vendorFromSlug(modelSlug(lower));
|
|
213
|
+
if (vendor) return vendor;
|
|
214
|
+
const segment = lower.split("/").filter(Boolean).at(-2);
|
|
215
|
+
if (segment && Object.hasOwn(VENDOR_SEGMENTS, segment)) return VENDOR_SEGMENTS[segment]!;
|
|
216
|
+
}
|
|
217
|
+
if (typeof input !== "string" && input.label) {
|
|
218
|
+
return vendorFromSlug(input.label.trim().toLowerCase().replace(/\s+/g, "-"));
|
|
219
|
+
}
|
|
220
|
+
return null;
|
|
221
|
+
}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
export type ModelPickerBillingClass =
|
|
2
|
-
// Legacy public identifier for the
|
|
2
|
+
// Legacy public identifier for the Opengeni presentation group, including
|
|
3
3
|
// free deployment models. Never use this UI grouping to decide settlement.
|
|
4
4
|
| "opengeni_credits"
|
|
5
5
|
| "external"
|
|
6
6
|
| "codex_subscription"
|
|
7
7
|
| "supergrok_subscription"
|
|
8
|
+
| "claude_subscription"
|
|
8
9
|
| "byok"
|
|
9
10
|
| "organization_byok";
|
|
10
11
|
|
|
@@ -15,11 +16,14 @@ const MODEL_PICKER_BILLING_CLASS_ORDER: readonly ModelPickerBillingClass[] = [
|
|
|
15
16
|
"external",
|
|
16
17
|
"codex_subscription",
|
|
17
18
|
"supergrok_subscription",
|
|
19
|
+
"claude_subscription",
|
|
18
20
|
"byok",
|
|
19
21
|
"organization_byok",
|
|
20
22
|
];
|
|
21
23
|
|
|
22
24
|
export type ModelPickerBillingCandidate = {
|
|
25
|
+
provider?: string | undefined;
|
|
26
|
+
providerId?: string | undefined;
|
|
23
27
|
source?: string | undefined;
|
|
24
28
|
cost?: "free" | "credits" | "subscription" | "workspace" | "organization" | undefined;
|
|
25
29
|
billing?:
|
|
@@ -39,6 +43,13 @@ export type ModelPickerBillingCandidate = {
|
|
|
39
43
|
export function modelPickerBillingClassFor(
|
|
40
44
|
model: ModelPickerBillingCandidate,
|
|
41
45
|
): ModelPickerBillingClass {
|
|
46
|
+
if (
|
|
47
|
+
model.provider === "workspace-claude-subscription" ||
|
|
48
|
+
model.providerId === "workspace-claude-subscription" ||
|
|
49
|
+
model.provider === "organization-claude-subscription" ||
|
|
50
|
+
model.providerId === "organization-claude-subscription"
|
|
51
|
+
)
|
|
52
|
+
return "claude_subscription";
|
|
42
53
|
if (model.cost === "credits" || model.cost === "free") return "opengeni_credits";
|
|
43
54
|
if (model.cost === "workspace") return "byok";
|
|
44
55
|
if (model.cost === "organization") return "organization_byok";
|
|
@@ -0,0 +1,217 @@
|
|
|
1
|
+
import { defineSchema } from "./define-schema";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
import { Permission } from "./permissions";
|
|
4
|
+
|
|
5
|
+
export const OrganizationAccessPreset = /* @__PURE__ */ defineSchema(() =>
|
|
6
|
+
z.enum(["read_only", "full", "custom"]),
|
|
7
|
+
);
|
|
8
|
+
export type OrganizationAccessPreset = z.infer<typeof OrganizationAccessPreset>;
|
|
9
|
+
|
|
10
|
+
export const OrganizationWorkspaceScope = /* @__PURE__ */ defineSchema(() =>
|
|
11
|
+
z.discriminatedUnion("kind", [
|
|
12
|
+
z.object({ kind: z.literal("all") }).strict(),
|
|
13
|
+
z
|
|
14
|
+
.object({
|
|
15
|
+
kind: z.literal("selected"),
|
|
16
|
+
workspaceIds: z
|
|
17
|
+
.array(
|
|
18
|
+
z
|
|
19
|
+
.string()
|
|
20
|
+
.uuid()
|
|
21
|
+
.transform((id) => id.toLowerCase()),
|
|
22
|
+
)
|
|
23
|
+
.max(500)
|
|
24
|
+
.refine((ids) => new Set(ids).size === ids.length, "Workspace IDs must be unique"),
|
|
25
|
+
})
|
|
26
|
+
.strict(),
|
|
27
|
+
]),
|
|
28
|
+
);
|
|
29
|
+
export type OrganizationWorkspaceScope = z.infer<typeof OrganizationWorkspaceScope>;
|
|
30
|
+
|
|
31
|
+
export const OrganizationActor = /* @__PURE__ */ defineSchema(() =>
|
|
32
|
+
z.enum(["user", "organization"]),
|
|
33
|
+
);
|
|
34
|
+
export type OrganizationActor = z.infer<typeof OrganizationActor>;
|
|
35
|
+
|
|
36
|
+
const aliases: Partial<Record<Permission, Permission>> = {
|
|
37
|
+
"environments:manage": "variable-sets:manage",
|
|
38
|
+
"environments:use": "variable-sets:use",
|
|
39
|
+
};
|
|
40
|
+
// Computed on first use, never at module load: the web build can place
|
|
41
|
+
// `Permission` in a chunk that finishes initializing after this one, and a
|
|
42
|
+
// top-level read of `Permission.options` then crashes the whole app.
|
|
43
|
+
let permissionSets:
|
|
44
|
+
| { canonical: Permission[]; observational: Permission[]; readOnly: Permission[] }
|
|
45
|
+
| undefined;
|
|
46
|
+
function sets() {
|
|
47
|
+
if (permissionSets) return permissionSets;
|
|
48
|
+
const canonical = Permission.options.filter((permission) => !aliases[permission]);
|
|
49
|
+
/** Everything that only observes. Reading secret values observes too. */
|
|
50
|
+
const observational = canonical.filter((permission) =>
|
|
51
|
+
/:(read|list|view|search)$/.test(permission),
|
|
52
|
+
);
|
|
53
|
+
/** Secret values are opt-in: Read only leaves them out, Custom can add them. */
|
|
54
|
+
const secretValue = new Set<Permission>(["secrets:read", "variable-sets:read"]);
|
|
55
|
+
const readOnly = observational.filter((permission) => !secretValue.has(permission));
|
|
56
|
+
permissionSets = { canonical, observational, readOnly };
|
|
57
|
+
return permissionSets;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/** Custom has no implicit permissions. Presets are expanded only by this helper. */
|
|
61
|
+
export function organizationAccessPresetPermissions(
|
|
62
|
+
preset: OrganizationAccessPreset,
|
|
63
|
+
): Permission[] {
|
|
64
|
+
return preset === "full"
|
|
65
|
+
? [...sets().canonical]
|
|
66
|
+
: preset === "read_only"
|
|
67
|
+
? [...sets().readOnly]
|
|
68
|
+
: [];
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
/** True when nothing can be changed, including an empty set and secret-value reads. */
|
|
72
|
+
export function isReadOnlyPermissionSet(permissions: readonly Permission[]): boolean {
|
|
73
|
+
return permissions.every((permission) =>
|
|
74
|
+
sets().observational.includes(aliases[permission] ?? permission),
|
|
75
|
+
);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
const OrganizationAccessPolicyInput = /* @__PURE__ */ defineSchema(() =>
|
|
79
|
+
z
|
|
80
|
+
.object({
|
|
81
|
+
preset: OrganizationAccessPreset,
|
|
82
|
+
// Lazy for the same module-order reason as `sets()` above.
|
|
83
|
+
permissions: z.array(z.lazy(() => Permission)),
|
|
84
|
+
workspaceScope: OrganizationWorkspaceScope,
|
|
85
|
+
})
|
|
86
|
+
.strict(),
|
|
87
|
+
);
|
|
88
|
+
|
|
89
|
+
export type OrganizationAccessPolicy = z.infer<typeof OrganizationAccessPolicyInput>;
|
|
90
|
+
|
|
91
|
+
/** Canonical ordering, alias mapping and labels; never adds an unrequested grant. */
|
|
92
|
+
export function normalizeOrganizationAccessPolicy(
|
|
93
|
+
policy: OrganizationAccessPolicy,
|
|
94
|
+
): OrganizationAccessPolicy {
|
|
95
|
+
const parsed = OrganizationAccessPolicyInput.parse(policy);
|
|
96
|
+
const requested = new Set(
|
|
97
|
+
parsed.permissions.map((permission) => aliases[permission] ?? permission),
|
|
98
|
+
);
|
|
99
|
+
const { canonical, readOnly } = sets();
|
|
100
|
+
const permissions = canonical.filter((permission) => requested.has(permission));
|
|
101
|
+
const same = (candidate: readonly Permission[]) =>
|
|
102
|
+
candidate.length === permissions.length &&
|
|
103
|
+
candidate.every((permission) => requested.has(permission));
|
|
104
|
+
return {
|
|
105
|
+
preset: same(canonical) ? "full" : same(readOnly) ? "read_only" : "custom",
|
|
106
|
+
permissions,
|
|
107
|
+
workspaceScope:
|
|
108
|
+
parsed.workspaceScope.kind === "selected"
|
|
109
|
+
? { kind: "selected", workspaceIds: [...parsed.workspaceScope.workspaceIds].sort() }
|
|
110
|
+
: { kind: "all" },
|
|
111
|
+
};
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
export const OrganizationAccessPolicy = /* @__PURE__ */ defineSchema(() =>
|
|
115
|
+
OrganizationAccessPolicyInput.transform(normalizeOrganizationAccessPolicy),
|
|
116
|
+
);
|
|
117
|
+
|
|
118
|
+
/** Change what a connected agent can do. Only the person who connected it can. */
|
|
119
|
+
export const UpdateOrganizationMcpConnectionRequest = /* @__PURE__ */ defineSchema(() =>
|
|
120
|
+
z.object({ access: OrganizationAccessPolicy }).strict(),
|
|
121
|
+
);
|
|
122
|
+
|
|
123
|
+
/**
|
|
124
|
+
* The answer to a pending agent sign-in: deny it, or approve it for one
|
|
125
|
+
* organization with the access the agent gets there.
|
|
126
|
+
*/
|
|
127
|
+
export const McpConnectionDecision = /* @__PURE__ */ defineSchema(() =>
|
|
128
|
+
z.discriminatedUnion("decision", [
|
|
129
|
+
z.object({ decision: z.literal("deny") }).strict(),
|
|
130
|
+
z
|
|
131
|
+
.object({
|
|
132
|
+
decision: z.literal("approve"),
|
|
133
|
+
organizationId: z.string().uuid(),
|
|
134
|
+
access: OrganizationAccessPolicy,
|
|
135
|
+
})
|
|
136
|
+
.strict(),
|
|
137
|
+
]),
|
|
138
|
+
);
|
|
139
|
+
|
|
140
|
+
/* ----------------------------------------------------------------------------
|
|
141
|
+
Service accounts: an organization identity with no person behind it. It
|
|
142
|
+
holds organization API keys; its role caps what those keys can be given.
|
|
143
|
+
Up to admin, never owner.
|
|
144
|
+
-------------------------------------------------------------------------- */
|
|
145
|
+
|
|
146
|
+
export const OrganizationServiceAccountRole = /* @__PURE__ */ defineSchema(() =>
|
|
147
|
+
z.enum(["admin", "member"]),
|
|
148
|
+
);
|
|
149
|
+
export type OrganizationServiceAccountRole = z.infer<typeof OrganizationServiceAccountRole>;
|
|
150
|
+
|
|
151
|
+
/** What only an organization administrator can do; a member service account's keys never hold it. */
|
|
152
|
+
export const ORGANIZATION_ADMIN_ONLY_PERMISSIONS: readonly Permission[] = [
|
|
153
|
+
"account:admin",
|
|
154
|
+
"members:manage",
|
|
155
|
+
"billing:manage",
|
|
156
|
+
"api_keys:manage",
|
|
157
|
+
"usage_allowances:manage",
|
|
158
|
+
];
|
|
159
|
+
|
|
160
|
+
/** The permissions a service account's keys may hold, given its role. */
|
|
161
|
+
export function serviceAccountAllowsPermission(
|
|
162
|
+
role: OrganizationServiceAccountRole,
|
|
163
|
+
permission: Permission,
|
|
164
|
+
): boolean {
|
|
165
|
+
return role === "admin" || !ORGANIZATION_ADMIN_ONLY_PERMISSIONS.includes(permission);
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
export const OrganizationServiceAccount = /* @__PURE__ */ defineSchema(() =>
|
|
169
|
+
z.object({
|
|
170
|
+
id: z.string().uuid(),
|
|
171
|
+
organizationId: z.string().uuid(),
|
|
172
|
+
name: z.string().min(1).max(200),
|
|
173
|
+
description: z.string().nullable(),
|
|
174
|
+
role: OrganizationServiceAccountRole,
|
|
175
|
+
/** Keys that are not revoked, including expired ones. */
|
|
176
|
+
activeKeyCount: z.number().int().nonnegative(),
|
|
177
|
+
createdAt: z.string(),
|
|
178
|
+
updatedAt: z.string(),
|
|
179
|
+
}),
|
|
180
|
+
);
|
|
181
|
+
export type OrganizationServiceAccount = z.infer<typeof OrganizationServiceAccount>;
|
|
182
|
+
|
|
183
|
+
export const ListOrganizationServiceAccountsResponse = /* @__PURE__ */ defineSchema(() =>
|
|
184
|
+
z.object({
|
|
185
|
+
serviceAccounts: z.array(OrganizationServiceAccount),
|
|
186
|
+
}),
|
|
187
|
+
);
|
|
188
|
+
export type ListOrganizationServiceAccountsResponse = z.infer<
|
|
189
|
+
typeof ListOrganizationServiceAccountsResponse
|
|
190
|
+
>;
|
|
191
|
+
|
|
192
|
+
export const CreateOrganizationServiceAccountRequest = /* @__PURE__ */ defineSchema(() =>
|
|
193
|
+
z
|
|
194
|
+
.object({
|
|
195
|
+
name: z.string().trim().min(1).max(200),
|
|
196
|
+
description: z.string().trim().min(1).max(500).optional(),
|
|
197
|
+
role: OrganizationServiceAccountRole.default("member"),
|
|
198
|
+
})
|
|
199
|
+
.strict(),
|
|
200
|
+
);
|
|
201
|
+
export type CreateOrganizationServiceAccountRequest = z.infer<
|
|
202
|
+
typeof CreateOrganizationServiceAccountRequest
|
|
203
|
+
>;
|
|
204
|
+
|
|
205
|
+
export const UpdateOrganizationServiceAccountRequest = /* @__PURE__ */ defineSchema(() =>
|
|
206
|
+
z
|
|
207
|
+
.object({
|
|
208
|
+
name: z.string().trim().min(1).max(200).optional(),
|
|
209
|
+
description: z.string().trim().min(1).max(500).nullable().optional(),
|
|
210
|
+
role: OrganizationServiceAccountRole.optional(),
|
|
211
|
+
})
|
|
212
|
+
.strict()
|
|
213
|
+
.refine((request) => Object.keys(request).length > 0, "At least one change is required"),
|
|
214
|
+
);
|
|
215
|
+
export type UpdateOrganizationServiceAccountRequest = z.infer<
|
|
216
|
+
typeof UpdateOrganizationServiceAccountRequest
|
|
217
|
+
>;
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { defineSchema } from "./define-schema";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
|
|
4
|
+
/** Catalog identities, never endpoint/domain matching. Custom transports are explicit categories. */
|
|
5
|
+
export const OrganizationIntegrationKey = /* @__PURE__ */ defineSchema(() =>
|
|
6
|
+
z
|
|
7
|
+
.string()
|
|
8
|
+
.min(1)
|
|
9
|
+
.max(200)
|
|
10
|
+
.regex(/^[a-z0-9][a-z0-9._:-]*$/),
|
|
11
|
+
);
|
|
12
|
+
const keys = /* @__PURE__ */ defineSchema(() =>
|
|
13
|
+
z
|
|
14
|
+
.array(OrganizationIntegrationKey)
|
|
15
|
+
.max(10000)
|
|
16
|
+
.refine((values) => new Set(values).size === values.length, "Duplicate integration identities"),
|
|
17
|
+
);
|
|
18
|
+
export const OrganizationIntegrationPolicy = /* @__PURE__ */ defineSchema(() =>
|
|
19
|
+
z
|
|
20
|
+
.object({
|
|
21
|
+
mode: z.enum(["unrestricted", "restricted"]).default("unrestricted"),
|
|
22
|
+
allowedIntegrationKeys: keys.default([]),
|
|
23
|
+
revision: z.number().int().nonnegative().safe().default(0),
|
|
24
|
+
})
|
|
25
|
+
.strict(),
|
|
26
|
+
);
|
|
27
|
+
export type OrganizationIntegrationPolicy = z.infer<typeof OrganizationIntegrationPolicy>;
|
|
28
|
+
|
|
29
|
+
export const UpdateOrganizationIntegrationPolicyRequest = /* @__PURE__ */ defineSchema(() =>
|
|
30
|
+
z
|
|
31
|
+
.object({
|
|
32
|
+
mode: z.enum(["unrestricted", "restricted"]),
|
|
33
|
+
allowedIntegrationKeys: keys,
|
|
34
|
+
expectedRevision: z
|
|
35
|
+
.number()
|
|
36
|
+
.int()
|
|
37
|
+
.nonnegative()
|
|
38
|
+
.max(Number.MAX_SAFE_INTEGER - 1),
|
|
39
|
+
operationId: z.string().uuid(),
|
|
40
|
+
})
|
|
41
|
+
.strict(),
|
|
42
|
+
);
|
|
43
|
+
export type UpdateOrganizationIntegrationPolicyRequest = z.infer<
|
|
44
|
+
typeof UpdateOrganizationIntegrationPolicyRequest
|
|
45
|
+
>;
|
|
46
|
+
|
|
47
|
+
export class OrganizationIntegrationDeniedError extends Error {
|
|
48
|
+
constructor() {
|
|
49
|
+
super("Integration acquisition is not allowed by organization policy");
|
|
50
|
+
this.name = "OrganizationIntegrationDeniedError";
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/** integrationKey must come from trusted classification, not client-supplied metadata. */
|
|
55
|
+
export function assertOrganizationIntegrationAllowed(
|
|
56
|
+
policy: OrganizationIntegrationPolicy,
|
|
57
|
+
integrationKey: string | null,
|
|
58
|
+
): void {
|
|
59
|
+
if (policy.mode === "unrestricted") return;
|
|
60
|
+
if (integrationKey === null || !policy.allowedIntegrationKeys.includes(integrationKey)) {
|
|
61
|
+
throw new OrganizationIntegrationDeniedError();
|
|
62
|
+
}
|
|
63
|
+
}
|