@opengeni/contracts 5.5.0 → 5.5.2-canary.40656248492001
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 +148 -37
- package/dist/api-key-presets.d.ts +19 -0
- package/dist/app-action-catalog-types.d.ts +32 -0
- package/dist/app-action-catalog.gen.d.ts +2 -0
- package/dist/app-actions.d.ts +91 -0
- package/dist/app-actions.js +10130 -0
- package/dist/app-actions.js.map +1 -0
- package/dist/app-shot.d.ts +55 -0
- package/dist/artifact-catalog.d.ts +33 -0
- package/dist/artifacts.d.ts +166 -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.js +48 -23
- package/dist/automation-templates.d.ts +434 -0
- package/dist/automation-templates.js +31 -0
- package/dist/automation-templates.js.map +1 -0
- package/dist/billing-subscriptions.d.ts +61 -0
- package/dist/bots.d.ts +583 -0
- package/dist/bundled-skills.d.ts +58 -2
- package/dist/canonical-human-identities.js +3 -1
- package/dist/child-lifecycle-notice-protocol.d.ts +45 -0
- package/dist/chunk-2QKIEAGY.js +396 -0
- package/dist/chunk-2QKIEAGY.js.map +1 -0
- package/dist/chunk-2WOWEWXV.js +426 -0
- package/dist/chunk-2WOWEWXV.js.map +1 -0
- package/dist/chunk-2ZIHHL72.js +153 -0
- package/dist/chunk-2ZIHHL72.js.map +1 -0
- package/dist/chunk-32U6NKQQ.js +389 -0
- package/dist/chunk-32U6NKQQ.js.map +1 -0
- package/dist/chunk-4YDDHSO2.js +799 -0
- package/dist/chunk-4YDDHSO2.js.map +1 -0
- package/dist/chunk-56SNIMDO.js +9 -0
- package/dist/chunk-56SNIMDO.js.map +1 -0
- package/dist/chunk-5RWB6QVL.js +101 -0
- package/dist/chunk-5RWB6QVL.js.map +1 -0
- package/dist/chunk-5UGUOT3L.js +243 -0
- package/dist/chunk-5UGUOT3L.js.map +1 -0
- package/dist/chunk-6LAT33BH.js +130 -0
- package/dist/chunk-6LAT33BH.js.map +1 -0
- package/dist/chunk-7272KVWZ.js +60 -0
- package/dist/chunk-7272KVWZ.js.map +1 -0
- package/dist/chunk-72QC2GTL.js +36 -0
- package/dist/chunk-72QC2GTL.js.map +1 -0
- package/dist/chunk-7EQGGZBY.js +105 -0
- package/dist/chunk-7EQGGZBY.js.map +1 -0
- package/dist/chunk-A3LXWVYU.js +382 -0
- package/dist/chunk-A3LXWVYU.js.map +1 -0
- package/dist/chunk-AQYDZUJV.js +34 -0
- package/dist/chunk-AQYDZUJV.js.map +1 -0
- package/dist/chunk-BHCEVVUP.js +93 -0
- package/dist/chunk-BHCEVVUP.js.map +1 -0
- package/dist/chunk-BMUTAZX5.js +486 -0
- package/dist/chunk-BMUTAZX5.js.map +1 -0
- package/dist/chunk-DGG6IBBK.js +150 -0
- package/dist/chunk-DGG6IBBK.js.map +1 -0
- package/dist/{chunk-YBW5JSA3.js → chunk-FBCTUMHI.js} +123 -102
- package/dist/chunk-FBCTUMHI.js.map +1 -0
- package/dist/chunk-G2KJTFIC.js +97 -0
- package/dist/chunk-G2KJTFIC.js.map +1 -0
- package/dist/chunk-G4RKARXZ.js +1167 -0
- package/dist/chunk-G4RKARXZ.js.map +1 -0
- package/dist/chunk-H6UJJIUM.js +350 -0
- package/dist/chunk-H6UJJIUM.js.map +1 -0
- package/dist/chunk-JOTHDW4H.js +18 -0
- package/dist/chunk-JOTHDW4H.js.map +1 -0
- package/dist/chunk-L4GUEP7K.js +56480 -0
- package/dist/chunk-L4GUEP7K.js.map +1 -0
- package/dist/{chunk-SIOU2K4U.js → chunk-LJH2EYGT.js} +23 -23
- package/dist/chunk-MTJKSIGA.js +161 -0
- package/dist/chunk-MTJKSIGA.js.map +1 -0
- package/dist/chunk-MYHMB6GZ.js +202 -0
- package/dist/chunk-MYHMB6GZ.js.map +1 -0
- package/dist/chunk-PI5VIKJY.js +660 -0
- package/dist/chunk-PI5VIKJY.js.map +1 -0
- package/dist/{chunk-RIY7GYQS.js → chunk-PTSROVDG.js} +2 -2
- package/dist/chunk-PUIUXIOL.js +189 -0
- package/dist/chunk-PUIUXIOL.js.map +1 -0
- package/dist/chunk-R6VXJIMB.js +19 -0
- package/dist/chunk-R6VXJIMB.js.map +1 -0
- package/dist/chunk-RLJUNVAM.js +15 -0
- package/dist/chunk-RLJUNVAM.js.map +1 -0
- package/dist/chunk-RR6APCBK.js +213 -0
- package/dist/chunk-RR6APCBK.js.map +1 -0
- package/dist/{chunk-TXTQIYCV.js → chunk-RUQ4I6DO.js} +59 -13
- package/dist/chunk-RUQ4I6DO.js.map +1 -0
- package/dist/{chunk-WYBDERIY.js → chunk-RWEEUDHD.js} +53 -42
- package/dist/chunk-RWEEUDHD.js.map +1 -0
- package/dist/chunk-S7MSQQL6.js +158 -0
- package/dist/chunk-S7MSQQL6.js.map +1 -0
- package/dist/{chunk-5Q54VCCH.js → chunk-SHO4YO4B.js} +20 -36
- package/dist/chunk-SHO4YO4B.js.map +1 -0
- package/dist/{chunk-HHZSZYYF.js → chunk-T3HSWMA5.js} +20 -4
- package/dist/chunk-T3HSWMA5.js.map +1 -0
- package/dist/{chunk-YRKRZ6OF.js → chunk-TOOJIBJC.js} +2 -2
- package/dist/chunk-UCUOTRS6.js +431 -0
- package/dist/chunk-UCUOTRS6.js.map +1 -0
- package/dist/chunk-UH4K7GP7.js +424 -0
- package/dist/chunk-UH4K7GP7.js.map +1 -0
- package/dist/chunk-UIZWGPHV.js +120 -0
- package/dist/chunk-UIZWGPHV.js.map +1 -0
- package/dist/chunk-VLUKBV6Y.js +1170 -0
- package/dist/chunk-VLUKBV6Y.js.map +1 -0
- package/dist/chunk-W2QQ5Y6K.js +55 -0
- package/dist/chunk-W2QQ5Y6K.js.map +1 -0
- package/dist/{chunk-Y3KNXVTD.js → chunk-W3NBPR4E.js} +131 -31
- package/dist/chunk-W3NBPR4E.js.map +1 -0
- package/dist/{chunk-NRMCVHAU.js → chunk-WMGO4HJU.js} +11 -9
- package/dist/chunk-WMGO4HJU.js.map +1 -0
- package/dist/{chunk-MYBZRDTY.js → chunk-WQI7VNN4.js} +19 -9
- package/dist/chunk-WQI7VNN4.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-XB6GQLBH.js +76 -0
- package/dist/chunk-XB6GQLBH.js.map +1 -0
- package/dist/{chunk-D2HKF2EF.js → chunk-XP5M3IKT.js} +2 -2
- package/dist/{chunk-O77VSFYZ.js → chunk-ZMPU5BWE.js} +12 -2
- package/dist/chunk-ZMPU5BWE.js.map +1 -0
- package/dist/{chunk-3SIZGL3O.js → chunk-ZYVEJFNU.js} +22 -18
- package/dist/chunk-ZYVEJFNU.js.map +1 -0
- package/dist/claude-provider-account-authority.d.ts +18 -0
- package/dist/claude-subscription-oauth.d.ts +25 -0
- package/dist/claude-subscription-usage.d.ts +95 -1
- package/dist/client-error-report.d.ts +154 -8
- package/dist/client-error-report.js +157 -2
- package/dist/client-error-report.js.map +1 -1
- package/dist/code-search.d.ts +1 -1
- package/dist/code-search.js.map +1 -1
- package/dist/codex-provider-account-authority.js +23 -12
- package/dist/codex-provider-account-authority.js.map +1 -1
- package/dist/company-profile.d.ts +144 -0
- package/dist/connect.d.ts +38 -0
- package/dist/connect.js +244 -164
- package/dist/connect.js.map +1 -1
- package/dist/connection-account-label.d.ts +2 -0
- package/dist/connection-account-label.js +34 -0
- package/dist/connection-account-label.js.map +1 -0
- package/dist/connection-authority.js +49 -24
- package/dist/connector-attachments.js +3 -1
- package/dist/connector-destinations.js +3 -1
- package/dist/connector-tool-permissions.d.ts +68 -4
- package/dist/credential-profiles.d.ts +166 -0
- package/dist/cua-desktop-tools.d.ts +19 -0
- package/dist/define-schema.d.ts +8 -0
- package/dist/desktop-app.d.ts +28 -0
- package/dist/direct-model-provider.d.ts +38 -0
- package/dist/document-artifact-commands.js +2 -2
- package/dist/document-artifact-query.js +2 -2
- package/dist/editable-artifact-binary.d.ts +7 -0
- package/dist/editable-artifact-causal-frontier.js +2 -2
- package/dist/editable-artifact-codec-registry.js +7 -7
- package/dist/editable-artifact-committed-transaction.js +4 -2
- package/dist/editable-artifact-live.js +8 -8
- package/dist/editable-artifact-serialized-commit.js +9 -9
- package/dist/editable-artifact-versions.d.ts +7 -1
- package/dist/editable-artifact-versions.js +1 -1
- package/dist/editable-artifacts.js +49 -43
- package/dist/event-preview.d.ts +22 -0
- package/dist/event-triggers.d.ts +1253 -0
- package/dist/event-triggers.js +148 -0
- package/dist/event-triggers.js.map +1 -0
- package/dist/external-identities.d.ts +34 -0
- package/dist/external-identities.js +4 -2
- package/dist/feedback.d.ts +181 -0
- package/dist/file-access.d.ts +23 -0
- package/dist/first-party-tool-authorization.d.ts +852 -0
- package/dist/github-repository-contracts.js +64 -43
- package/dist/github-repository-contracts.js.map +1 -1
- package/dist/google-drive-native-retirement.d.ts +12 -0
- package/dist/google-drive-native-retirement.js +20 -0
- package/dist/google-drive-native-retirement.js.map +1 -0
- package/dist/google-drive.d.ts +1 -1
- package/dist/google-drive.js +323 -239
- package/dist/google-drive.js.map +1 -1
- package/dist/host-mcp-bindings.js +250 -198
- package/dist/host-mcp-bindings.js.map +1 -1
- package/dist/index.d.ts +29072 -20593
- package/dist/index.js +2432 -366
- package/dist/inference-residency.d.ts +22 -0
- package/dist/insights-usage.d.ts +948 -0
- package/dist/insights-usage.js +608 -0
- package/dist/insights-usage.js.map +1 -0
- package/dist/integration-capability-id.d.ts +8 -0
- package/dist/interaction-action-deadline.d.ts +48 -0
- package/dist/interaction-driver-diagnostic.d.ts +28 -0
- package/dist/interaction.d.ts +2126 -881
- package/dist/knowledge-entries.d.ts +38 -0
- package/dist/knowledge-preparation.d.ts +4 -0
- package/dist/learning-refusal.d.ts +43 -0
- package/dist/learning-refusal.js +49 -0
- package/dist/learning-refusal.js.map +1 -0
- package/dist/managed-auth-session-sets.d.ts +1 -0
- package/dist/managed-auth-session-sets.js +207 -146
- package/dist/managed-auth-session-sets.js.map +1 -1
- package/dist/managed-sign-in-methods.d.ts +96 -0
- package/dist/managed-sign-in-methods.js +157 -35
- package/dist/managed-sign-in-methods.js.map +1 -1
- package/dist/mcp-structured-content.d.ts +25 -0
- package/dist/message-time-zone.d.ts +38 -0
- package/dist/message-time-zone.js +19 -0
- package/dist/message-time-zone.js.map +1 -0
- package/dist/modal-native-proof-v2.d.ts +587 -0
- package/dist/modal-native-proof-v2.js +39 -0
- package/dist/modal-native-proof-v2.js.map +1 -0
- package/dist/model-account-choice.d.ts +237 -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 +8 -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.js.map +1 -1
- package/dist/model-residency.d.ts +304 -0
- package/dist/organization-access.d.ts +416 -0
- package/dist/organization-access.js +40 -0
- package/dist/organization-access.js.map +1 -0
- package/dist/organization-integration-policy.d.ts +18 -0
- package/dist/organization-membership-lifecycle.d.ts +66 -0
- package/dist/organization-model-usage.d.ts +146 -0
- package/dist/organization-model-usage.js +87 -0
- package/dist/organization-model-usage.js.map +1 -0
- package/dist/organization-recovery.js +3 -1
- package/dist/organization-usage.d.ts +12 -0
- package/dist/passkey-only-account.d.ts +14 -0
- package/dist/passkey-only-account.js +13 -0
- package/dist/passkey-only-account.js.map +1 -0
- package/dist/permissions.d.ts +19 -0
- package/dist/personal-github.js +220 -148
- package/dist/personal-github.js.map +1 -1
- package/dist/personal-integration-setup.d.ts +81 -0
- package/dist/personal-integration-setup.js +42 -0
- package/dist/personal-integration-setup.js.map +1 -0
- package/dist/prepared-mcp-setup.d.ts +54 -0
- package/dist/prepared-mcp-setup.js +13 -0
- package/dist/prepared-mcp-setup.js.map +1 -0
- package/dist/presentation-artifact-commands.js +2 -2
- package/dist/presentation-artifact-query.js +2 -2
- package/dist/primitives.d.ts +18 -0
- package/dist/product-analytics.d.ts +27 -10
- package/dist/product-lifecycle-facts.d.ts +26 -3
- package/dist/prompt-cache-diagnostics.d.ts +92 -0
- package/dist/recordings.d.ts +1371 -0
- package/dist/remember.d.ts +98 -2
- package/dist/retained-output.d.ts +4 -2
- package/dist/sandbox-file-artifacts.d.ts +19 -2
- package/dist/sandbox-provider-command.d.ts +5 -44
- package/dist/sandbox-recovery.d.ts +139 -8
- package/dist/secret-generator.d.ts +44 -0
- package/dist/secret-mask-strings.d.ts +32 -0
- package/dist/secret-references.d.ts +90 -0
- package/dist/secret-resolution.d.ts +143 -0
- package/dist/secret-shape-masking.d.ts +52 -0
- package/dist/secret-shape-masking.js +19 -0
- package/dist/secret-shape-masking.js.map +1 -0
- package/dist/secret-totp.d.ts +41 -0
- package/dist/secret-use-approval-question.d.ts +11 -0
- package/dist/secret-use-approval-question.js +11 -0
- package/dist/secret-use-approval-question.js.map +1 -0
- package/dist/secret-use-approvals.d.ts +106 -0
- package/dist/secret-value-masking.d.ts +299 -0
- package/dist/secret-value-masking.js +62 -0
- package/dist/secret-value-masking.js.map +1 -0
- package/dist/secret-value.d.ts +19 -0
- package/dist/session-history-import.d.ts +444 -8
- package/dist/session-history.d.ts +111 -0
- package/dist/session-history.js +35 -0
- package/dist/session-history.js.map +1 -0
- package/dist/session-list-entries.d.ts +8 -0
- package/dist/session-list-entries.js +61 -0
- package/dist/session-list-entries.js.map +1 -0
- package/dist/session-mcp-projections.d.ts +13 -1
- package/dist/session-mcp-tool-permissions.d.ts +62 -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 +43 -0
- package/dist/session-usage-limits.js.map +1 -0
- package/dist/site-data.d.ts +286 -0
- package/dist/site-operations.d.ts +39 -0
- package/dist/site-publishing.d.ts +813 -0
- package/dist/site-session-http.d.ts +103 -4
- package/dist/site-session-http.js +27 -1
- package/dist/site-sql.d.ts +425 -0
- package/dist/skills.d.ts +38 -0
- package/dist/slack-bot-scopes.d.ts +9 -7
- package/dist/slack-bot-scopes.js +6 -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 +9 -2
- package/dist/spreadsheet-artifact-query.d.ts +13 -6
- package/dist/spreadsheet-artifact-query.js +4 -3
- package/dist/subscription-account-actions.d.ts +83 -0
- package/dist/subscription-account-pools.d.ts +326 -0
- package/dist/subscription-personal-authority-v2.d.ts +28 -0
- package/dist/subscription-personal-authority-v2.js +13 -0
- package/dist/subscription-personal-authority-v2.js.map +1 -0
- package/dist/subscription-plans.d.ts +38 -0
- package/dist/subscription-usage-pool.d.ts +89 -0
- package/dist/tool-action-review.d.ts +141 -0
- package/dist/tool-catalog.d.ts +479 -0
- package/dist/tool-policy.d.ts +5 -0
- package/dist/tool-review-presentation.d.ts +29 -0
- package/dist/tool-review-presentation.js +21 -0
- package/dist/tool-review-presentation.js.map +1 -0
- package/dist/turn-serving-policy.d.ts +223 -0
- package/dist/usage-allowances.d.ts +30 -0
- package/dist/usage-allowances.js +5 -1
- package/dist/values.d.ts +11 -0
- package/dist/values.js +19 -0
- package/dist/values.js.map +1 -0
- package/dist/vault-provider-wire.d.ts +907 -0
- package/dist/vault-provider-wire.js +74 -0
- package/dist/vault-provider-wire.js.map +1 -0
- package/dist/vaults.d.ts +2185 -0
- package/dist/video-generation.d.ts +75 -0
- package/dist/video-generation.js +8 -1
- package/dist/workspace-control-event.d.ts +18 -0
- package/dist/workspace-control-event.js +18 -0
- package/dist/workspace-control-event.js.map +1 -0
- package/dist/workspace-governance-context.d.ts +18 -0
- package/dist/workspace-integration-wire.d.ts +1 -1
- package/dist/workspace-integration-wire.js +1 -1
- package/dist/workspace-integrations.d.ts +212 -12
- package/dist/xai-provider-account-authority.js +3 -1
- package/package.json +121 -4
- package/src/agent-authored-durable-text.ts +14 -11
- package/src/agent-config.ts +382 -203
- package/src/agent-instruction-changes.ts +94 -74
- package/src/agent-learning.ts +94 -66
- package/src/agent-topology.ts +58 -52
- package/src/api-key-presets.ts +28 -0
- package/src/app-action-catalog-types.ts +32 -0
- package/src/app-action-catalog.gen.ts +9905 -0
- package/src/app-actions.ts +365 -0
- package/src/app-shot.ts +176 -0
- package/src/artifact-catalog.ts +81 -46
- package/src/artifacts.ts +360 -227
- package/src/atlassian-native-retirement.ts +33 -0
- package/src/atlassian.ts +136 -108
- package/src/automation-templates.ts +201 -0
- package/src/billing-subscriptions.ts +48 -0
- package/src/bots.ts +238 -0
- package/src/bundled-skills.ts +79 -22
- package/src/canonical-human-identities.ts +65 -62
- package/src/child-lifecycle-notice-protocol.gen.json +1310 -0
- package/src/child-lifecycle-notice-protocol.ts +224 -0
- package/src/claude-provider-account-authority.ts +12 -0
- package/src/claude-subscription-oauth.ts +61 -19
- package/src/claude-subscription-usage.ts +64 -35
- package/src/client-error-report.ts +344 -9
- package/src/code-search.ts +1 -1
- package/src/codex-provider-account-authority.ts +22 -16
- package/src/company-brain-governed-writes.ts +265 -244
- package/src/company-brain.ts +165 -154
- package/src/company-profile.ts +362 -297
- package/src/connect.ts +222 -173
- package/src/connection-account-label.ts +45 -0
- package/src/connection-authority.ts +172 -152
- package/src/connector-attachments.ts +139 -123
- package/src/connector-destinations.ts +48 -43
- package/src/connector-tool-permissions.ts +104 -46
- package/src/credential-profiles.ts +161 -0
- package/src/cua-desktop-tools.gen.json +6722 -0
- package/src/cua-desktop-tools.linux.gen.json +6798 -0
- package/src/cua-desktop-tools.ts +42 -0
- package/src/cua-desktop-tools.windows.gen.json +6739 -0
- package/src/define-schema.ts +10 -0
- package/src/desktop-app.ts +50 -0
- package/src/direct-model-provider.ts +112 -0
- package/src/editable-artifact-binary.ts +29 -8
- package/src/editable-artifact-committed-transaction.ts +19 -18
- package/src/editable-artifact-serialized-commit.ts +8 -2
- package/src/editable-artifact-versions.ts +7 -1
- package/src/event-preview.ts +53 -3
- package/src/event-triggers.ts +891 -0
- package/src/external-identities.ts +239 -195
- package/src/feedback.ts +125 -30
- package/src/file-access.ts +26 -0
- package/src/first-party-tool-authorization.ts +383 -0
- package/src/github-repository-contracts.ts +78 -64
- package/src/google-drive-native-retirement.ts +20 -0
- package/src/google-drive.ts +286 -234
- package/src/governed-learning-activation.ts +159 -137
- package/src/governed-learning-evaluator.ts +141 -133
- package/src/host-mcp-bindings.ts +244 -221
- package/src/image-generation.ts +105 -95
- package/src/index.ts +13928 -9899
- package/src/inference-residency.ts +36 -0
- package/src/insights-usage.ts +774 -0
- package/src/integration-capability-id.ts +16 -0
- package/src/interaction-action-deadline.ts +143 -0
- package/src/interaction-driver-diagnostic.ts +89 -0
- package/src/interaction.ts +3527 -2427
- package/src/knowledge-entries.ts +386 -299
- package/src/knowledge-preparation.ts +49 -41
- package/src/knowledge.ts +242 -213
- package/src/learning-refusal.ts +90 -0
- package/src/managed-auth-session-sets.ts +180 -133
- package/src/managed-sign-in-methods.ts +156 -34
- package/src/mcp-oauth.ts +58 -46
- package/src/mcp-receipts.ts +199 -194
- package/src/mcp-structured-content.ts +81 -0
- package/src/memory-slack-delivery.ts +172 -142
- package/src/message-time-zone.ts +109 -0
- package/src/modal-native-proof-v2.ts +430 -0
- package/src/model-account-choice.ts +178 -0
- package/src/model-account-settings.ts +210 -0
- package/src/model-availability.ts +22 -0
- package/src/model-connection-access.ts +62 -14
- package/src/model-context-inspector.ts +130 -109
- package/src/model-display.ts +221 -0
- package/src/model-picker-order.ts +1 -1
- package/src/model-residency.ts +535 -0
- package/src/organization-access.ts +216 -0
- package/src/organization-integration-policy.ts +47 -28
- package/src/organization-membership-lifecycle.ts +558 -384
- package/src/organization-model-usage.ts +82 -0
- package/src/organization-recovery.ts +148 -135
- package/src/organization-usage.ts +84 -52
- package/src/passkey-only-account.ts +29 -0
- package/src/permissions.ts +94 -52
- package/src/personal-github.ts +211 -171
- package/src/personal-integration-setup.ts +150 -0
- package/src/preference-registry.ts +319 -263
- package/src/prepared-mcp-setup.ts +190 -0
- package/src/primitives.ts +22 -0
- package/src/product-analytics.ts +40 -15
- package/src/product-lifecycle-facts.ts +50 -20
- package/src/prompt-cache-diagnostics.ts +212 -0
- package/src/recordings.ts +1153 -0
- package/src/remember.ts +184 -172
- package/src/retained-output.ts +181 -168
- package/src/sandbox-file-artifacts.ts +78 -57
- package/src/sandbox-provider-command.ts +55 -72
- package/src/sandbox-recovery.ts +163 -77
- package/src/scoped-knowledge.ts +62 -43
- package/src/secret-generator.ts +156 -0
- package/src/secret-mask-strings.ts +175 -0
- package/src/secret-references.ts +414 -0
- package/src/secret-resolution.ts +322 -0
- package/src/secret-shape-masking.ts +573 -0
- package/src/secret-totp.ts +188 -0
- package/src/secret-use-approval-question.ts +22 -0
- package/src/secret-use-approvals.ts +219 -0
- package/src/secret-value-masking.ts +1283 -0
- package/src/secret-value.ts +22 -0
- package/src/session-goal-reports.ts +55 -49
- package/src/session-history-import.ts +84 -68
- package/src/session-history.ts +197 -0
- package/src/session-list-entries.ts +106 -0
- package/src/session-mcp-projections.ts +21 -3
- package/src/session-mcp-tool-permissions.ts +109 -0
- package/src/session-message-search.ts +46 -38
- package/src/session-target.ts +58 -0
- package/src/session-titles.ts +40 -4
- package/src/session-topology-primitives.ts +20 -12
- package/src/session-usage-limit-refusal.ts +101 -0
- package/src/session-usage-limits.ts +169 -0
- package/src/signup-attribution.ts +20 -15
- package/src/site-data.ts +337 -0
- package/src/site-operations.ts +154 -0
- package/src/site-publishing.ts +903 -0
- package/src/site-session-http.ts +344 -16
- package/src/site-sql.ts +1120 -0
- package/src/skill-use.ts +18 -17
- package/src/skills.ts +105 -50
- package/src/slack-bot-scopes.ts +18 -35
- package/src/slack-rest-mcp.ts +222 -0
- package/src/slack-task-policy.ts +97 -73
- package/src/spreadsheet-artifact-commands.ts +74 -13
- package/src/spreadsheet-artifact-query.ts +188 -50
- package/src/subscription-account-actions.ts +103 -0
- package/src/subscription-account-pools.ts +74 -0
- package/src/subscription-personal-authority-v2.ts +69 -0
- package/src/subscription-plans.ts +51 -0
- package/src/subscription-usage-pool.ts +44 -0
- package/src/task-notes.ts +70 -68
- package/src/tool-action-review.ts +271 -0
- package/src/tool-catalog.ts +694 -379
- package/src/tool-policy.ts +82 -0
- package/src/tool-result-spill.ts +13 -9
- package/src/tool-review-presentation.ts +643 -0
- package/src/turn-serving-policy.ts +167 -0
- package/src/usage-allowances.ts +212 -136
- package/src/values.ts +25 -0
- package/src/vault-provider-wire.ts +580 -0
- package/src/vaults.ts +1296 -0
- package/src/video-generation.ts +430 -361
- package/src/work-claims.ts +183 -166
- package/src/workspace-control-event.ts +134 -0
- package/src/workspace-governance-context.ts +63 -0
- package/src/workspace-instruction-policies.ts +346 -279
- package/src/workspace-integration-wire.ts +10 -0
- package/src/workspace-integrations.ts +488 -398
- package/src/workspace-learning-administration.ts +58 -44
- package/src/workspace-learning-policy.ts +126 -99
- package/src/workspace-state.ts +239 -220
- package/src/xai-provider-account-authority.ts +23 -17
- package/dist/chunk-3SIZGL3O.js.map +0 -1
- package/dist/chunk-566IFOVP.js +0 -26133
- package/dist/chunk-566IFOVP.js.map +0 -1
- package/dist/chunk-5IXYF6XN.js +0 -728
- package/dist/chunk-5IXYF6XN.js.map +0 -1
- package/dist/chunk-5Q54VCCH.js.map +0 -1
- package/dist/chunk-BCS7WHCK.js +0 -139
- package/dist/chunk-BCS7WHCK.js.map +0 -1
- package/dist/chunk-EK7NDGFR.js +0 -128
- package/dist/chunk-EK7NDGFR.js.map +0 -1
- package/dist/chunk-GRG7PHWQ.js +0 -25
- package/dist/chunk-GRG7PHWQ.js.map +0 -1
- package/dist/chunk-HHZSZYYF.js.map +0 -1
- package/dist/chunk-ICDZGUX2.js +0 -186
- package/dist/chunk-ICDZGUX2.js.map +0 -1
- package/dist/chunk-JUFK3T4Q.js +0 -80
- package/dist/chunk-JUFK3T4Q.js.map +0 -1
- package/dist/chunk-MYBZRDTY.js.map +0 -1
- package/dist/chunk-NRMCVHAU.js.map +0 -1
- package/dist/chunk-O77VSFYZ.js.map +0 -1
- package/dist/chunk-P3HLDT77.js +0 -59
- package/dist/chunk-P3HLDT77.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/chunk-YWMOIZ6A.js +0 -185
- package/dist/chunk-YWMOIZ6A.js.map +0 -1
- package/dist/site-request-headers.test.d.ts +0 -1
- package/dist/transcription-recordings.d.ts +0 -300
- package/src/transcription-recordings.ts +0 -169
- /package/dist/{chunk-SIOU2K4U.js.map → chunk-LJH2EYGT.js.map} +0 -0
- /package/dist/{chunk-RIY7GYQS.js.map → chunk-PTSROVDG.js.map} +0 -0
- /package/dist/{chunk-YRKRZ6OF.js.map → chunk-TOOJIBJC.js.map} +0 -0
- /package/dist/{chunk-D2HKF2EF.js.map → chunk-XP5M3IKT.js.map} +0 -0
package/src/vaults.ts
ADDED
|
@@ -0,0 +1,1296 @@
|
|
|
1
|
+
import * as primitives from "./primitives";
|
|
2
|
+
import { defineSchema } from "./define-schema";
|
|
3
|
+
/**
|
|
4
|
+
* Vaults: the Opengeni secrets model (replaces variable sets).
|
|
5
|
+
*
|
|
6
|
+
* A vault holds a flat list of items; an item holds named fields; hosted
|
|
7
|
+
* fields keep encrypted versions. Every type here is `z.infer` of its schema.
|
|
8
|
+
*
|
|
9
|
+
* This module must not import runtime values from `./index` (the index
|
|
10
|
+
* re-exports it); only types cross that edge.
|
|
11
|
+
*/
|
|
12
|
+
import { z } from "zod";
|
|
13
|
+
import { GeneratePasswordSpec } from "./secret-generator";
|
|
14
|
+
|
|
15
|
+
export const VaultOwnerKind = /* @__PURE__ */ defineSchema(() =>
|
|
16
|
+
z.enum(["user", "workspace", "organization", "task"]),
|
|
17
|
+
);
|
|
18
|
+
export type VaultOwnerKind = z.infer<typeof VaultOwnerKind>;
|
|
19
|
+
export const VaultSource = /* @__PURE__ */ defineSchema(() =>
|
|
20
|
+
z.enum(["opengeni", "onepassword", "host", "external", "protonpass", "keeper", "bitwarden"]),
|
|
21
|
+
);
|
|
22
|
+
export type VaultSource = z.infer<typeof VaultSource>;
|
|
23
|
+
export const VaultMode = /* @__PURE__ */ defineSchema(() => z.enum(["read_write", "read_only"]));
|
|
24
|
+
export type VaultMode = z.infer<typeof VaultMode>;
|
|
25
|
+
export const VaultSyncStatus = /* @__PURE__ */ defineSchema(() =>
|
|
26
|
+
z.enum(["ok", "syncing", "error", "auth_expired", "rate_limited"]),
|
|
27
|
+
);
|
|
28
|
+
export type VaultSyncStatus = z.infer<typeof VaultSyncStatus>;
|
|
29
|
+
/**
|
|
30
|
+
* The kind of item, which decides its standard fields and its primary field.
|
|
31
|
+
* Each provider item maps to one type; anything more specific (a database
|
|
32
|
+
* login, a bank account, a passport) is its `category` (see
|
|
33
|
+
* `VAULT_ITEM_CATEGORIES`), so an item keeps both when it moves between
|
|
34
|
+
* providers.
|
|
35
|
+
*/
|
|
36
|
+
export const VaultItemType = /* @__PURE__ */ defineSchema(() =>
|
|
37
|
+
z.enum(["login", "api_key", "note", "file", "passkey", "card", "identity", "ssh_key"]),
|
|
38
|
+
);
|
|
39
|
+
export type VaultItemType = z.infer<typeof VaultItemType>;
|
|
40
|
+
|
|
41
|
+
/** The item types that exist; `createItemTypes` lists at most all of them. */
|
|
42
|
+
export const VAULT_ITEM_TYPE_COUNT = 8;
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* A provider-specific kind of item, as a lower-case snake_case token. Known
|
|
46
|
+
* categories use the names in `VAULT_ITEM_CATEGORIES`; a provider category
|
|
47
|
+
* Opengeni does not know is kept as the snake_case form of its own name.
|
|
48
|
+
*/
|
|
49
|
+
export const VAULT_ITEM_CATEGORY_PATTERN = /^[a-z][a-z0-9_]{0,63}$/;
|
|
50
|
+
export const VaultItemCategory = /* @__PURE__ */ defineSchema(() =>
|
|
51
|
+
z.string().regex(VAULT_ITEM_CATEGORY_PATTERN, "a lower-case snake_case category"),
|
|
52
|
+
);
|
|
53
|
+
export type VaultItemCategory = z.infer<typeof VaultItemCategory>;
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* Categories with a shared meaning across providers, and the item type each
|
|
57
|
+
* belongs to. An item with no category is the plain form of its type.
|
|
58
|
+
*/
|
|
59
|
+
export const VAULT_ITEM_CATEGORIES = {
|
|
60
|
+
password: "api_key",
|
|
61
|
+
database: "api_key",
|
|
62
|
+
server: "api_key",
|
|
63
|
+
wifi: "api_key",
|
|
64
|
+
email_account: "api_key",
|
|
65
|
+
software_license: "api_key",
|
|
66
|
+
crypto_wallet: "api_key",
|
|
67
|
+
bank_account: "note",
|
|
68
|
+
membership: "note",
|
|
69
|
+
passport: "note",
|
|
70
|
+
driver_license: "note",
|
|
71
|
+
outdoor_license: "note",
|
|
72
|
+
reward_program: "note",
|
|
73
|
+
national_id: "note",
|
|
74
|
+
medical_record: "note",
|
|
75
|
+
health_insurance: "note",
|
|
76
|
+
birth_certificate: "note",
|
|
77
|
+
email_alias: "note",
|
|
78
|
+
address: "identity",
|
|
79
|
+
person: "identity",
|
|
80
|
+
photo: "file",
|
|
81
|
+
} as const satisfies Record<string, VaultItemType>;
|
|
82
|
+
export type KnownVaultItemCategory = keyof typeof VAULT_ITEM_CATEGORIES;
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* The category token for a provider's own category or record-type name:
|
|
86
|
+
* "BankAccount", "bank account" and "bankAccount" all become "bank_account".
|
|
87
|
+
* Null when nothing usable remains.
|
|
88
|
+
*/
|
|
89
|
+
export function vaultItemCategoryToken(raw: string): string | null {
|
|
90
|
+
const token = raw
|
|
91
|
+
.normalize("NFKD")
|
|
92
|
+
.replace(/[\u0300-\u036f]/g, "")
|
|
93
|
+
.replace(/([a-z0-9])([A-Z])/g, "$1_$2")
|
|
94
|
+
.replace(/([A-Z]+)([A-Z][a-z])/g, "$1_$2")
|
|
95
|
+
.toLowerCase()
|
|
96
|
+
.replace(/[^a-z0-9]+/g, "_")
|
|
97
|
+
.replace(/^[^a-z]+/, "")
|
|
98
|
+
.slice(0, 64)
|
|
99
|
+
.replace(/_+$/, "");
|
|
100
|
+
return VAULT_ITEM_CATEGORY_PATTERN.test(token) ? token : null;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
/**
|
|
104
|
+
* The standard fields of each type, in display order, as Opengeni names them
|
|
105
|
+
* in every vault. Providers store them in their own built-in slots; any other
|
|
106
|
+
* field is kept as a custom field under its own name.
|
|
107
|
+
*/
|
|
108
|
+
export const VAULT_ITEM_TYPE_FIELDS: Readonly<
|
|
109
|
+
Record<VaultItemType, ReadonlyArray<{ name: string; kind: "text" | "concealed" | "totp" }>>
|
|
110
|
+
> = {
|
|
111
|
+
login: [
|
|
112
|
+
{ name: "username", kind: "text" },
|
|
113
|
+
{ name: "password", kind: "concealed" },
|
|
114
|
+
{ name: "one-time password", kind: "totp" },
|
|
115
|
+
],
|
|
116
|
+
api_key: [{ name: "value", kind: "concealed" }],
|
|
117
|
+
note: [{ name: "note", kind: "concealed" }],
|
|
118
|
+
file: [],
|
|
119
|
+
passkey: [],
|
|
120
|
+
card: [
|
|
121
|
+
{ name: "cardholder name", kind: "text" },
|
|
122
|
+
{ name: "brand", kind: "text" },
|
|
123
|
+
{ name: "number", kind: "concealed" },
|
|
124
|
+
{ name: "expiry month", kind: "text" },
|
|
125
|
+
{ name: "expiry year", kind: "text" },
|
|
126
|
+
{ name: "security code", kind: "concealed" },
|
|
127
|
+
],
|
|
128
|
+
identity: [
|
|
129
|
+
{ name: "title", kind: "text" },
|
|
130
|
+
{ name: "first name", kind: "text" },
|
|
131
|
+
{ name: "middle name", kind: "text" },
|
|
132
|
+
{ name: "last name", kind: "text" },
|
|
133
|
+
{ name: "username", kind: "text" },
|
|
134
|
+
{ name: "company", kind: "text" },
|
|
135
|
+
{ name: "email", kind: "text" },
|
|
136
|
+
{ name: "phone", kind: "text" },
|
|
137
|
+
{ name: "address 1", kind: "text" },
|
|
138
|
+
{ name: "address 2", kind: "text" },
|
|
139
|
+
{ name: "address 3", kind: "text" },
|
|
140
|
+
{ name: "city", kind: "text" },
|
|
141
|
+
{ name: "state", kind: "text" },
|
|
142
|
+
{ name: "postal code", kind: "text" },
|
|
143
|
+
{ name: "country", kind: "text" },
|
|
144
|
+
{ name: "national ID number", kind: "concealed" },
|
|
145
|
+
{ name: "passport number", kind: "concealed" },
|
|
146
|
+
{ name: "license number", kind: "concealed" },
|
|
147
|
+
],
|
|
148
|
+
ssh_key: [
|
|
149
|
+
{ name: "private key", kind: "concealed" },
|
|
150
|
+
{ name: "public key", kind: "text" },
|
|
151
|
+
{ name: "fingerprint", kind: "text" },
|
|
152
|
+
],
|
|
153
|
+
};
|
|
154
|
+
|
|
155
|
+
/**
|
|
156
|
+
* A freshly generated SSH key pair for an `ssh_key` item's "private key"
|
|
157
|
+
* field. Opengeni writes the private key in OpenSSH format and fills in the
|
|
158
|
+
* "public key" and "fingerprint" fields; the private key never leaves the
|
|
159
|
+
* vault.
|
|
160
|
+
*/
|
|
161
|
+
export const GenerateSshKeySpec = /* @__PURE__ */ defineSchema(() =>
|
|
162
|
+
z.object({ algorithm: z.enum(["ed25519", "rsa4096"]).default("ed25519") }).strict(),
|
|
163
|
+
);
|
|
164
|
+
export type GenerateSshKeySpec = z.infer<typeof GenerateSshKeySpec>;
|
|
165
|
+
|
|
166
|
+
/**
|
|
167
|
+
* Other names password managers give a type's standard fields (1Password's
|
|
168
|
+
* "verification number" is Bitwarden's "security code"). A write stores a
|
|
169
|
+
* field under any of these names in the provider's own slot, and a reference
|
|
170
|
+
* that names one of them still resolves when the item names it another way.
|
|
171
|
+
*/
|
|
172
|
+
export const VAULT_FIELD_NAME_SYNONYMS: Readonly<
|
|
173
|
+
Partial<Record<VaultItemType, Readonly<Record<string, readonly string[]>>>>
|
|
174
|
+
> = {
|
|
175
|
+
card: {
|
|
176
|
+
"cardholder name": ["cardholder", "name on card"],
|
|
177
|
+
brand: ["type", "card type"],
|
|
178
|
+
number: ["card number"],
|
|
179
|
+
"security code": ["verification number", "cvv", "cvc", "cvv2", "csc"],
|
|
180
|
+
"expiry month": ["exp month", "expiration month"],
|
|
181
|
+
"expiry year": ["exp year", "expiration year"],
|
|
182
|
+
},
|
|
183
|
+
identity: {
|
|
184
|
+
"first name": ["firstname", "given name"],
|
|
185
|
+
"middle name": ["initial", "middle initial"],
|
|
186
|
+
"last name": ["lastname", "surname", "family name"],
|
|
187
|
+
email: ["email address"],
|
|
188
|
+
phone: ["phone number", "default phone"],
|
|
189
|
+
"address 1": ["address", "street address"],
|
|
190
|
+
"postal code": ["zip", "zip code", "postcode"],
|
|
191
|
+
"national ID number": ["ssn", "social security number"],
|
|
192
|
+
},
|
|
193
|
+
ssh_key: {},
|
|
194
|
+
};
|
|
195
|
+
|
|
196
|
+
function fieldNameKey(name: string): string {
|
|
197
|
+
return name.normalize("NFC").trim().toLowerCase();
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
/**
|
|
201
|
+
* The standard field a field name stands for in an item of this type, as
|
|
202
|
+
* Opengeni names it ("cvv" is a card's "security code"), or null for a
|
|
203
|
+
* custom field.
|
|
204
|
+
*/
|
|
205
|
+
export function standardVaultFieldName(type: VaultItemType, name: string): string | null {
|
|
206
|
+
const key = fieldNameKey(name);
|
|
207
|
+
const standard = VAULT_ITEM_TYPE_FIELDS[type].find((field) => fieldNameKey(field.name) === key);
|
|
208
|
+
if (standard) return standard.name;
|
|
209
|
+
for (const [canonical, synonyms] of Object.entries(VAULT_FIELD_NAME_SYNONYMS[type] ?? {})) {
|
|
210
|
+
if (synonyms.some((synonym) => fieldNameKey(synonym) === key)) return canonical;
|
|
211
|
+
}
|
|
212
|
+
return null;
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
/**
|
|
216
|
+
* Every other name a reference's field name may have in another password
|
|
217
|
+
* manager, across all types: a group's names when it belongs to one, else
|
|
218
|
+
* nothing. Used only when the exact name finds no field.
|
|
219
|
+
*/
|
|
220
|
+
export function vaultFieldNameAlternatives(name: string): string[] {
|
|
221
|
+
const key = fieldNameKey(name);
|
|
222
|
+
const out = new Set<string>();
|
|
223
|
+
for (const table of Object.values(VAULT_FIELD_NAME_SYNONYMS)) {
|
|
224
|
+
for (const [canonical, synonyms] of Object.entries(table ?? {})) {
|
|
225
|
+
const group = [canonical, ...synonyms];
|
|
226
|
+
if (!group.some((entry) => fieldNameKey(entry) === key)) continue;
|
|
227
|
+
for (const entry of group) if (fieldNameKey(entry) !== key) out.add(entry);
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
return [...out];
|
|
231
|
+
}
|
|
232
|
+
export const VaultFieldKind = /* @__PURE__ */ defineSchema(() =>
|
|
233
|
+
z.enum(["text", "concealed", "totp", "file"]),
|
|
234
|
+
);
|
|
235
|
+
export type VaultFieldKind = z.infer<typeof VaultFieldKind>;
|
|
236
|
+
|
|
237
|
+
/** Effective operations, not a promise that upstream permissions cannot change. */
|
|
238
|
+
export const VaultProviderOperations = /* @__PURE__ */ defineSchema(() =>
|
|
239
|
+
z
|
|
240
|
+
.object({
|
|
241
|
+
createItemTypes: z.array(VaultItemType).max(VAULT_ITEM_TYPE_COUNT),
|
|
242
|
+
updateItem: primitives.boolean,
|
|
243
|
+
removeField: primitives.boolean,
|
|
244
|
+
archiveItem: primitives.boolean,
|
|
245
|
+
archiveKind: z.enum(["archive", "trash", "none"]),
|
|
246
|
+
/** Permanent provider deletion is deliberately not exposed. */
|
|
247
|
+
deleteItem: z.literal(false),
|
|
248
|
+
restoreItem: primitives.boolean,
|
|
249
|
+
readFiles: primitives.boolean,
|
|
250
|
+
writeFiles: primitives.boolean,
|
|
251
|
+
createTotp: primitives.boolean,
|
|
252
|
+
updateTotp: primitives.boolean,
|
|
253
|
+
createVault: primitives.boolean,
|
|
254
|
+
restoreFieldHistory: primitives.boolean,
|
|
255
|
+
})
|
|
256
|
+
.strict(),
|
|
257
|
+
);
|
|
258
|
+
export type VaultProviderOperations = z.infer<typeof VaultProviderOperations>;
|
|
259
|
+
|
|
260
|
+
const ARCHIVE_KIND_STRENGTH = { archive: 2, trash: 1, none: 0 } as const;
|
|
261
|
+
|
|
262
|
+
/**
|
|
263
|
+
* The weaker of two archive kinds: an archive (hidden, restorable as is) is
|
|
264
|
+
* stronger than a trash (restorable until emptied), which is stronger than
|
|
265
|
+
* none. A vault may narrow its adapter's archive to a trash, never widen it.
|
|
266
|
+
*/
|
|
267
|
+
export function weakerArchiveKind(
|
|
268
|
+
left: VaultProviderOperations["archiveKind"],
|
|
269
|
+
right: VaultProviderOperations["archiveKind"],
|
|
270
|
+
): VaultProviderOperations["archiveKind"] {
|
|
271
|
+
return ARCHIVE_KIND_STRENGTH[left] <= ARCHIVE_KIND_STRENGTH[right] ? left : right;
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
/** A successful mirror check does not prove a customer's upstream cache is current. */
|
|
275
|
+
export const VaultProviderFreshness = /* @__PURE__ */ defineSchema(() =>
|
|
276
|
+
z
|
|
277
|
+
.object({
|
|
278
|
+
state: z.enum(["current", "stale", "refreshing", "unavailable"]),
|
|
279
|
+
lastCheckedAt: z.string().datetime().nullable(),
|
|
280
|
+
sourceSyncedAt: z.string().datetime().nullable(),
|
|
281
|
+
source: z.enum(["live", "cache", "unknown"]),
|
|
282
|
+
errorCode: z.string().max(100).nullable(),
|
|
283
|
+
retryAt: z.string().datetime().nullable(),
|
|
284
|
+
})
|
|
285
|
+
.strict(),
|
|
286
|
+
);
|
|
287
|
+
export type VaultProviderFreshness = z.infer<typeof VaultProviderFreshness>;
|
|
288
|
+
/** Lookup order for references that name no vault; index = tier. */
|
|
289
|
+
export const VAULT_LOOKUP_TIERS = ["task", "user", "workspace", "organization"] as const;
|
|
290
|
+
export type VaultLookupTier = (typeof VAULT_LOOKUP_TIERS)[number];
|
|
291
|
+
|
|
292
|
+
export const VAULT_LIMITS = {
|
|
293
|
+
vaultsPerOwnerScope: 200,
|
|
294
|
+
itemsPerVault: 2_000,
|
|
295
|
+
fieldsPerItem: 50,
|
|
296
|
+
versionsPerField: 10,
|
|
297
|
+
nameMaxChars: 120,
|
|
298
|
+
descriptionMaxChars: 2_000,
|
|
299
|
+
websitesPerItem: 20,
|
|
300
|
+
websiteMaxChars: 2_048,
|
|
301
|
+
usernameMaxChars: 1_024,
|
|
302
|
+
textValueMaxBytes: 65_536,
|
|
303
|
+
fileValueMaxBytes: 262_144,
|
|
304
|
+
referenceMaxChars: 300,
|
|
305
|
+
execEnvMaxBytes: 262_144,
|
|
306
|
+
execValueMaxBytes: 102_400,
|
|
307
|
+
policyVaultIdsMax: 200,
|
|
308
|
+
searchResultsMax: 50,
|
|
309
|
+
/** Items one agent search call examines before it returns a cursor. */
|
|
310
|
+
searchScanMax: 1_000,
|
|
311
|
+
searchCursorMaxChars: 1_024,
|
|
312
|
+
providerReadsPerAttempt: 50,
|
|
313
|
+
providerValueCacheMs: 60_000,
|
|
314
|
+
} as const;
|
|
315
|
+
|
|
316
|
+
/** Default names of lazily created hosted vaults (Q-06). */
|
|
317
|
+
export const DEFAULT_VAULT_NAMES = {
|
|
318
|
+
user: "Private",
|
|
319
|
+
workspace: "Shared",
|
|
320
|
+
task: "Task",
|
|
321
|
+
} as const;
|
|
322
|
+
|
|
323
|
+
/**
|
|
324
|
+
* Default primary field per item type (§10B.2); passkeys have none, and an
|
|
325
|
+
* identity's primary is its first concealed field.
|
|
326
|
+
*/
|
|
327
|
+
export const VAULT_DEFAULT_PRIMARY_FIELD: Readonly<Record<VaultItemType, string | null>> = {
|
|
328
|
+
login: "password",
|
|
329
|
+
api_key: "value",
|
|
330
|
+
note: "note",
|
|
331
|
+
file: "file",
|
|
332
|
+
passkey: null,
|
|
333
|
+
card: "number",
|
|
334
|
+
identity: null,
|
|
335
|
+
ssh_key: "private key",
|
|
336
|
+
};
|
|
337
|
+
|
|
338
|
+
/** Fixed passkey fields (D20). `privateKey` is concealed; the rest are text. */
|
|
339
|
+
export const PASSKEY_FIELD_NAMES = [
|
|
340
|
+
"rpId",
|
|
341
|
+
"credentialId",
|
|
342
|
+
"userHandle",
|
|
343
|
+
"userName",
|
|
344
|
+
"privateKey",
|
|
345
|
+
] as const;
|
|
346
|
+
|
|
347
|
+
// Forbidden anywhere in a name: / { } # \ and C0/C1 control characters.
|
|
348
|
+
// oxlint-disable-next-line no-control-regex
|
|
349
|
+
const FORBIDDEN_NAME_CHARACTERS = /[/{}#\\\u0000-\u001f\u007f-\u009f]/;
|
|
350
|
+
|
|
351
|
+
/**
|
|
352
|
+
* Q-10: 1–120 characters, no `/ { } # \` or control characters, no leading
|
|
353
|
+
* or trailing whitespace, and not starting with `id:` (reserved for the ID
|
|
354
|
+
* reference form). Interior spaces and any other Unicode are allowed.
|
|
355
|
+
*/
|
|
356
|
+
export function isValidSecretName(name: string): boolean {
|
|
357
|
+
if (typeof name !== "string") return false;
|
|
358
|
+
const length = [...name].length;
|
|
359
|
+
if (length < 1 || length > VAULT_LIMITS.nameMaxChars) return false;
|
|
360
|
+
if (FORBIDDEN_NAME_CHARACTERS.test(name)) return false;
|
|
361
|
+
if (name.trim() !== name) return false;
|
|
362
|
+
if (name.toLowerCase().startsWith("id:")) return false;
|
|
363
|
+
return true;
|
|
364
|
+
}
|
|
365
|
+
|
|
366
|
+
/** True when `name` is reserved as a field name (the `/otp` suffix). */
|
|
367
|
+
export function isReservedVaultFieldName(name: string): boolean {
|
|
368
|
+
return name.normalize("NFC").trim().toLowerCase() === "otp";
|
|
369
|
+
}
|
|
370
|
+
|
|
371
|
+
export const VaultName = /* @__PURE__ */ defineSchema(() =>
|
|
372
|
+
primitives.nonEmptyString
|
|
373
|
+
.max(VAULT_LIMITS.nameMaxChars)
|
|
374
|
+
.refine(isValidSecretName, "invalid_secret_name"),
|
|
375
|
+
);
|
|
376
|
+
export const VaultFieldName = /* @__PURE__ */ defineSchema(() =>
|
|
377
|
+
VaultName.refine((name) => !isReservedVaultFieldName(name), "invalid_secret_name"),
|
|
378
|
+
);
|
|
379
|
+
|
|
380
|
+
export const VaultPolicy = /* @__PURE__ */ defineSchema(() =>
|
|
381
|
+
z.discriminatedUnion("mode", [
|
|
382
|
+
z.object({ mode: z.literal("all") }).strict(),
|
|
383
|
+
z
|
|
384
|
+
.object({
|
|
385
|
+
mode: z.literal("selected"),
|
|
386
|
+
vaultIds: z.array(primitives.uuid).max(VAULT_LIMITS.policyVaultIdsMax),
|
|
387
|
+
})
|
|
388
|
+
.strict(),
|
|
389
|
+
]),
|
|
390
|
+
);
|
|
391
|
+
export type VaultPolicy = z.infer<typeof VaultPolicy>;
|
|
392
|
+
export const VAULT_POLICY_ALL: VaultPolicy = Object.freeze({ mode: "all" }) as VaultPolicy;
|
|
393
|
+
|
|
394
|
+
/**
|
|
395
|
+
* Intersect two policies. `all` is the identity; two selections keep the IDs
|
|
396
|
+
* present in both (order of `a`).
|
|
397
|
+
*/
|
|
398
|
+
export function intersectVaultPolicies(a: VaultPolicy, b: VaultPolicy): VaultPolicy {
|
|
399
|
+
if (a.mode === "all")
|
|
400
|
+
return b.mode === "all" ? VAULT_POLICY_ALL : { mode: "selected", vaultIds: [...b.vaultIds] };
|
|
401
|
+
if (b.mode === "all") return { mode: "selected", vaultIds: [...a.vaultIds] };
|
|
402
|
+
const allowed = new Set(b.vaultIds);
|
|
403
|
+
return { mode: "selected", vaultIds: a.vaultIds.filter((id) => allowed.has(id)) };
|
|
404
|
+
}
|
|
405
|
+
|
|
406
|
+
export const VaultAvailability = /* @__PURE__ */ defineSchema(() =>
|
|
407
|
+
z
|
|
408
|
+
.object({
|
|
409
|
+
allowedWorkspaceIds: z.array(primitives.uuid).max(500).nullable(), // null = every workspace
|
|
410
|
+
allowPersonalWorkspaces: primitives.boolean,
|
|
411
|
+
})
|
|
412
|
+
.strict(),
|
|
413
|
+
);
|
|
414
|
+
export type VaultAvailability = z.infer<typeof VaultAvailability>;
|
|
415
|
+
|
|
416
|
+
export const VaultSummary = /* @__PURE__ */ defineSchema(() =>
|
|
417
|
+
z.object({
|
|
418
|
+
id: primitives.uuid,
|
|
419
|
+
workspaceId: primitives.uuid,
|
|
420
|
+
ownerKind: VaultOwnerKind,
|
|
421
|
+
/** "Only me" | workspace name | organization name | "This task" */
|
|
422
|
+
ownerLabel: primitives.string,
|
|
423
|
+
rootSessionId: primitives.nullableUuid,
|
|
424
|
+
name: primitives.string,
|
|
425
|
+
description: primitives.nullableString,
|
|
426
|
+
source: VaultSource,
|
|
427
|
+
mode: VaultMode,
|
|
428
|
+
syncStatus: VaultSyncStatus,
|
|
429
|
+
syncErrorCode: primitives.nullableString,
|
|
430
|
+
syncErrorMessage: primitives.nullableString,
|
|
431
|
+
lastSyncedAt: primitives.nullableString,
|
|
432
|
+
rateLimitedUntil: primitives.nullableString,
|
|
433
|
+
providerConnectionId: primitives.nullableUuid,
|
|
434
|
+
providerOperations: VaultProviderOperations.optional(),
|
|
435
|
+
freshness: VaultProviderFreshness.optional(),
|
|
436
|
+
/** Organization and Only-me vaults; null for workspace and task vaults. */
|
|
437
|
+
availability: VaultAvailability.nullable(),
|
|
438
|
+
isDefault: primitives.boolean,
|
|
439
|
+
itemCount: z.number().int(),
|
|
440
|
+
canWrite: primitives.boolean,
|
|
441
|
+
canManage: primitives.boolean,
|
|
442
|
+
generation: z.number().int(),
|
|
443
|
+
createdAt: primitives.string,
|
|
444
|
+
updatedAt: primitives.string,
|
|
445
|
+
}),
|
|
446
|
+
);
|
|
447
|
+
export type VaultSummary = z.infer<typeof VaultSummary>;
|
|
448
|
+
|
|
449
|
+
export const VaultItemReferences = /* @__PURE__ */ defineSchema(() =>
|
|
450
|
+
z.object({
|
|
451
|
+
primary: primitives.nullableString,
|
|
452
|
+
otp: primitives.nullableString,
|
|
453
|
+
byField: z.record(primitives.string, primitives.string),
|
|
454
|
+
}),
|
|
455
|
+
);
|
|
456
|
+
export type VaultItemReferences = z.infer<typeof VaultItemReferences>;
|
|
457
|
+
|
|
458
|
+
export const VaultItemSummary = /* @__PURE__ */ defineSchema(() =>
|
|
459
|
+
z.object({
|
|
460
|
+
id: primitives.uuid,
|
|
461
|
+
vaultId: primitives.uuid,
|
|
462
|
+
type: VaultItemType,
|
|
463
|
+
/** Provider-specific kind of item (`VAULT_ITEM_CATEGORIES`); null for the plain type. */
|
|
464
|
+
category: primitives.nullableString,
|
|
465
|
+
name: primitives.string,
|
|
466
|
+
websites: z.array(primitives.string),
|
|
467
|
+
/** Native username text field or the connected provider's display hint. */
|
|
468
|
+
username: primitives.nullableString,
|
|
469
|
+
hasTotp: primitives.boolean,
|
|
470
|
+
hasPasskey: primitives.boolean,
|
|
471
|
+
expiresAt: primitives.nullableString,
|
|
472
|
+
archivedAt: primitives.nullableString,
|
|
473
|
+
lastUsedAt: primitives.nullableString,
|
|
474
|
+
updatedAt: primitives.string,
|
|
475
|
+
references: VaultItemReferences,
|
|
476
|
+
}),
|
|
477
|
+
);
|
|
478
|
+
export type VaultItemSummary = z.infer<typeof VaultItemSummary>;
|
|
479
|
+
|
|
480
|
+
export const VaultItemField = /* @__PURE__ */ defineSchema(() =>
|
|
481
|
+
z.object({
|
|
482
|
+
id: primitives.uuid,
|
|
483
|
+
name: primitives.string,
|
|
484
|
+
kind: VaultFieldKind,
|
|
485
|
+
position: z.number().int(),
|
|
486
|
+
/** null for provider fields */
|
|
487
|
+
currentVersion: z.number().int().nullable(),
|
|
488
|
+
/** Plaintext ONLY for kind "text"; null otherwise. */
|
|
489
|
+
value: primitives.nullableString,
|
|
490
|
+
fileName: primitives.nullableString,
|
|
491
|
+
fileSize: z.number().int().nullable(),
|
|
492
|
+
reference: primitives.string,
|
|
493
|
+
updatedAt: primitives.string,
|
|
494
|
+
}),
|
|
495
|
+
);
|
|
496
|
+
export type VaultItemField = z.infer<typeof VaultItemField>;
|
|
497
|
+
|
|
498
|
+
export const PasskeySummary = /* @__PURE__ */ defineSchema(() =>
|
|
499
|
+
z.object({
|
|
500
|
+
rpId: primitives.string,
|
|
501
|
+
userName: primitives.nullableString,
|
|
502
|
+
/** Last 8 characters of the credential ID. */
|
|
503
|
+
credentialIdSuffix: primitives.string,
|
|
504
|
+
signCount: z.number().int(),
|
|
505
|
+
leasedUntil: primitives.nullableString,
|
|
506
|
+
lastUsedAt: primitives.nullableString,
|
|
507
|
+
}),
|
|
508
|
+
);
|
|
509
|
+
export type PasskeySummary = z.infer<typeof PasskeySummary>;
|
|
510
|
+
|
|
511
|
+
export const VaultItem = /* @__PURE__ */ defineSchema(() =>
|
|
512
|
+
VaultItemSummary.extend({
|
|
513
|
+
fields: z.array(VaultItemField),
|
|
514
|
+
passkey: PasskeySummary.nullable(),
|
|
515
|
+
aliases: z.array(primitives.string),
|
|
516
|
+
primaryFieldId: primitives.nullableUuid,
|
|
517
|
+
createdBySubjectId: primitives.nullableString,
|
|
518
|
+
createdAt: primitives.string,
|
|
519
|
+
generation: z.number().int(),
|
|
520
|
+
}),
|
|
521
|
+
);
|
|
522
|
+
export type VaultItem = z.infer<typeof VaultItem>;
|
|
523
|
+
|
|
524
|
+
export const VaultVersionCreatedByKind = /* @__PURE__ */ defineSchema(() =>
|
|
525
|
+
z.enum(["human", "agent", "api_key", "migration", "provider", "system"]),
|
|
526
|
+
);
|
|
527
|
+
export type VaultVersionCreatedByKind = z.infer<typeof VaultVersionCreatedByKind>;
|
|
528
|
+
|
|
529
|
+
export const VaultFieldVersionMeta = /* @__PURE__ */ defineSchema(() =>
|
|
530
|
+
z.object({
|
|
531
|
+
version: z.number().int(),
|
|
532
|
+
current: primitives.boolean,
|
|
533
|
+
createdAt: primitives.string,
|
|
534
|
+
createdByKind: VaultVersionCreatedByKind,
|
|
535
|
+
createdBySubjectId: primitives.nullableString,
|
|
536
|
+
}),
|
|
537
|
+
);
|
|
538
|
+
export type VaultFieldVersionMeta = z.infer<typeof VaultFieldVersionMeta>;
|
|
539
|
+
|
|
540
|
+
// ---------------------------------------------------------------------------
|
|
541
|
+
// Requests
|
|
542
|
+
// ---------------------------------------------------------------------------
|
|
543
|
+
|
|
544
|
+
export const CreateVaultRequest = /* @__PURE__ */ defineSchema(() =>
|
|
545
|
+
z
|
|
546
|
+
.object({
|
|
547
|
+
name: VaultName,
|
|
548
|
+
description: primitives.string.max(VAULT_LIMITS.descriptionMaxChars).optional(),
|
|
549
|
+
ownerKind: z.enum(["user", "workspace", "organization"]),
|
|
550
|
+
availability: VaultAvailability.optional(),
|
|
551
|
+
})
|
|
552
|
+
.strict(),
|
|
553
|
+
);
|
|
554
|
+
export type CreateVaultRequest = z.infer<typeof CreateVaultRequest>;
|
|
555
|
+
|
|
556
|
+
export const UpdateVaultRequest = /* @__PURE__ */ defineSchema(() =>
|
|
557
|
+
z
|
|
558
|
+
.object({
|
|
559
|
+
expectedGeneration: z.number().int(),
|
|
560
|
+
name: VaultName.optional(),
|
|
561
|
+
description: primitives.string.max(VAULT_LIMITS.descriptionMaxChars).nullable().optional(),
|
|
562
|
+
availability: VaultAvailability.optional(),
|
|
563
|
+
})
|
|
564
|
+
.strict(),
|
|
565
|
+
);
|
|
566
|
+
export type UpdateVaultRequest = z.infer<typeof UpdateVaultRequest>;
|
|
567
|
+
|
|
568
|
+
export const DeleteVaultRequest = /* @__PURE__ */ defineSchema(() =>
|
|
569
|
+
z.object({ confirmName: primitives.nonEmptyString }).strict(),
|
|
570
|
+
);
|
|
571
|
+
export type DeleteVaultRequest = z.infer<typeof DeleteVaultRequest>;
|
|
572
|
+
|
|
573
|
+
const VALUE_SOURCE_KEYS = [
|
|
574
|
+
"value",
|
|
575
|
+
"generate",
|
|
576
|
+
"generateKey",
|
|
577
|
+
"fromReference",
|
|
578
|
+
"fileBase64",
|
|
579
|
+
"restoreVersion",
|
|
580
|
+
"remove",
|
|
581
|
+
] as const;
|
|
582
|
+
|
|
583
|
+
/** Exactly one value source per field input. */
|
|
584
|
+
export function exactlyOneValueSource(
|
|
585
|
+
input: Partial<Record<(typeof VALUE_SOURCE_KEYS)[number], unknown>>,
|
|
586
|
+
): boolean {
|
|
587
|
+
return VALUE_SOURCE_KEYS.filter((key) => input[key] !== undefined).length === 1;
|
|
588
|
+
}
|
|
589
|
+
|
|
590
|
+
export const VaultFieldInput = /* @__PURE__ */ defineSchema(() =>
|
|
591
|
+
z
|
|
592
|
+
.object({
|
|
593
|
+
fieldId: primitives.optionalUuid,
|
|
594
|
+
name: VaultFieldName,
|
|
595
|
+
/** Default concealed; a field named "username" defaults to text. */
|
|
596
|
+
kind: VaultFieldKind.optional(),
|
|
597
|
+
value: z.string().optional(),
|
|
598
|
+
generate: GeneratePasswordSpec.optional(),
|
|
599
|
+
generateKey: GenerateSshKeySpec.optional(),
|
|
600
|
+
fromReference: primitives.string.max(VAULT_LIMITS.referenceMaxChars).optional(),
|
|
601
|
+
fileBase64: z.string().optional(),
|
|
602
|
+
fileName: z.string().max(255).optional(),
|
|
603
|
+
restoreVersion: z.number().int().optional(),
|
|
604
|
+
remove: z.literal(true).optional(),
|
|
605
|
+
})
|
|
606
|
+
.strict()
|
|
607
|
+
.refine(
|
|
608
|
+
exactlyOneValueSource,
|
|
609
|
+
"exactly one of value|generate|generateKey|fromReference|fileBase64|restoreVersion|remove",
|
|
610
|
+
),
|
|
611
|
+
);
|
|
612
|
+
export type VaultFieldInput = z.infer<typeof VaultFieldInput>;
|
|
613
|
+
|
|
614
|
+
const CreateVaultItemShape = /* @__PURE__ */ defineSchema(() =>
|
|
615
|
+
z
|
|
616
|
+
.object({
|
|
617
|
+
type: VaultItemType,
|
|
618
|
+
category: VaultItemCategory.nullable().optional(),
|
|
619
|
+
name: VaultName,
|
|
620
|
+
websites: z
|
|
621
|
+
.array(primitives.string.max(VAULT_LIMITS.websiteMaxChars))
|
|
622
|
+
.max(VAULT_LIMITS.websitesPerItem)
|
|
623
|
+
.optional(),
|
|
624
|
+
expiresAt: primitives.string.datetime({ offset: true }).nullable().optional(),
|
|
625
|
+
fields: z.array(VaultFieldInput).max(VAULT_LIMITS.fieldsPerItem),
|
|
626
|
+
primaryFieldName: z.string().optional(),
|
|
627
|
+
})
|
|
628
|
+
.strict(),
|
|
629
|
+
);
|
|
630
|
+
export const CreateVaultItemRequest = CreateVaultItemShape;
|
|
631
|
+
export type CreateVaultItemRequest = z.infer<typeof CreateVaultItemRequest>;
|
|
632
|
+
|
|
633
|
+
export const UpdateVaultItemRequest = /* @__PURE__ */ defineSchema(() =>
|
|
634
|
+
CreateVaultItemShape.partial().extend({ expectedGeneration: z.number().int() }).strict(),
|
|
635
|
+
);
|
|
636
|
+
export type UpdateVaultItemRequest = z.infer<typeof UpdateVaultItemRequest>;
|
|
637
|
+
|
|
638
|
+
export const MoveVaultItemRequest = /* @__PURE__ */ defineSchema(() =>
|
|
639
|
+
z
|
|
640
|
+
.object({
|
|
641
|
+
targetVaultId: primitives.uuid,
|
|
642
|
+
mode: z.enum(["move", "copy"]),
|
|
643
|
+
newName: VaultName.optional(),
|
|
644
|
+
})
|
|
645
|
+
.strict(),
|
|
646
|
+
);
|
|
647
|
+
export type MoveVaultItemRequest = z.infer<typeof MoveVaultItemRequest>;
|
|
648
|
+
|
|
649
|
+
export const RevealVaultFieldRequest = /* @__PURE__ */ defineSchema(() =>
|
|
650
|
+
z.object({ version: z.number().int().optional() }).strict(),
|
|
651
|
+
);
|
|
652
|
+
export type RevealVaultFieldRequest = z.infer<typeof RevealVaultFieldRequest>;
|
|
653
|
+
|
|
654
|
+
export const RevealVaultFieldResponse = /* @__PURE__ */ defineSchema(() =>
|
|
655
|
+
z.object({
|
|
656
|
+
value: primitives.string,
|
|
657
|
+
encoding: z.enum(["utf8", "base64"]),
|
|
658
|
+
version: z.number().int().nullable(),
|
|
659
|
+
totp: z
|
|
660
|
+
.object({
|
|
661
|
+
code: primitives.string,
|
|
662
|
+
periodSeconds: z.number().int(),
|
|
663
|
+
expiresAt: primitives.string,
|
|
664
|
+
})
|
|
665
|
+
.nullable(),
|
|
666
|
+
}),
|
|
667
|
+
);
|
|
668
|
+
export type RevealVaultFieldResponse = z.infer<typeof RevealVaultFieldResponse>;
|
|
669
|
+
|
|
670
|
+
export const RestoreVaultFieldVersionRequest = /* @__PURE__ */ defineSchema(() =>
|
|
671
|
+
z.object({ version: primitives.positiveInteger }).strict(),
|
|
672
|
+
);
|
|
673
|
+
export type RestoreVaultFieldVersionRequest = z.infer<typeof RestoreVaultFieldVersionRequest>;
|
|
674
|
+
|
|
675
|
+
const QUERY_TRUE = new Set(["true", "1", "yes"]);
|
|
676
|
+
const QUERY_FALSE = new Set(["false", "0", "no"]);
|
|
677
|
+
const QueryBoolean = /* @__PURE__ */ defineSchema(() =>
|
|
678
|
+
z.preprocess((value) => {
|
|
679
|
+
if (typeof value !== "string") return value;
|
|
680
|
+
const normalized = value.trim().toLowerCase();
|
|
681
|
+
return QUERY_TRUE.has(normalized) ? true : QUERY_FALSE.has(normalized) ? false : value;
|
|
682
|
+
}, primitives.boolean),
|
|
683
|
+
);
|
|
684
|
+
const QueryInt = /* @__PURE__ */ defineSchema(() =>
|
|
685
|
+
z.preprocess(
|
|
686
|
+
(value) => (typeof value === "string" && /^\d+$/.test(value) ? Number(value) : value),
|
|
687
|
+
z.number().int().min(1).max(200),
|
|
688
|
+
),
|
|
689
|
+
);
|
|
690
|
+
|
|
691
|
+
/**
|
|
692
|
+
* Query strings are accepted as strings too ("true", "1", "50"). Archived
|
|
693
|
+
* items are left out unless `includeArchived` is set; a connected vault's
|
|
694
|
+
* archived items are the ones its connected account archived.
|
|
695
|
+
*/
|
|
696
|
+
export const ListVaultItemsQuery = /* @__PURE__ */ defineSchema(() =>
|
|
697
|
+
z.object({
|
|
698
|
+
q: z.string().max(200).optional(),
|
|
699
|
+
type: VaultItemType.optional(),
|
|
700
|
+
includeArchived: QueryBoolean.optional(),
|
|
701
|
+
cursor: z.string().optional(),
|
|
702
|
+
limit: QueryInt.optional(),
|
|
703
|
+
}),
|
|
704
|
+
);
|
|
705
|
+
export type ListVaultItemsQuery = z.infer<typeof ListVaultItemsQuery>;
|
|
706
|
+
|
|
707
|
+
export const ListVaultsResponse = /* @__PURE__ */ defineSchema(() =>
|
|
708
|
+
z.object({ vaults: z.array(VaultSummary) }),
|
|
709
|
+
);
|
|
710
|
+
export type ListVaultsResponse = z.infer<typeof ListVaultsResponse>;
|
|
711
|
+
export const ListVaultItemsResponse = /* @__PURE__ */ defineSchema(() =>
|
|
712
|
+
z.object({
|
|
713
|
+
items: z.array(VaultItemSummary),
|
|
714
|
+
nextCursor: primitives.nullableString,
|
|
715
|
+
}),
|
|
716
|
+
);
|
|
717
|
+
export type ListVaultItemsResponse = z.infer<typeof ListVaultItemsResponse>;
|
|
718
|
+
export const ListVaultFieldVersionsResponse = /* @__PURE__ */ defineSchema(() =>
|
|
719
|
+
z.object({
|
|
720
|
+
versions: z.array(VaultFieldVersionMeta),
|
|
721
|
+
}),
|
|
722
|
+
);
|
|
723
|
+
export type ListVaultFieldVersionsResponse = z.infer<typeof ListVaultFieldVersionsResponse>;
|
|
724
|
+
|
|
725
|
+
export const SetSessionVaultPolicyRequest = /* @__PURE__ */ defineSchema(() =>
|
|
726
|
+
z.object({ policy: VaultPolicy }).strict(),
|
|
727
|
+
);
|
|
728
|
+
export type SetSessionVaultPolicyRequest = z.infer<typeof SetSessionVaultPolicyRequest>;
|
|
729
|
+
|
|
730
|
+
export const SessionSecretsView = /* @__PURE__ */ defineSchema(() =>
|
|
731
|
+
z.object({
|
|
732
|
+
capabilityEnabled: primitives.boolean,
|
|
733
|
+
policy: VaultPolicy,
|
|
734
|
+
effectiveVaultIds: z.array(primitives.uuid),
|
|
735
|
+
/** Nearest ancestor that narrowed, if any. */
|
|
736
|
+
narrowedBySessionId: primitives.nullableUuid,
|
|
737
|
+
taskVault: VaultSummary.nullable(),
|
|
738
|
+
taskItems: z.array(VaultItemSummary),
|
|
739
|
+
reachableVaults: z.array(
|
|
740
|
+
VaultSummary.extend({ selected: primitives.boolean, selectable: primitives.boolean }),
|
|
741
|
+
),
|
|
742
|
+
}),
|
|
743
|
+
);
|
|
744
|
+
export type SessionSecretsView = z.infer<typeof SessionSecretsView>;
|
|
745
|
+
|
|
746
|
+
export const InstallOnePasswordRequest = /* @__PURE__ */ defineSchema(() =>
|
|
747
|
+
z
|
|
748
|
+
.object({
|
|
749
|
+
// Real service-account tokens are long; the dev fakes (ops_fake_healthy) are 16 chars.
|
|
750
|
+
token: primitives.string.trim().min(16).max(4_096),
|
|
751
|
+
ownership: z.enum(["user", "workspace", "organization"]),
|
|
752
|
+
planTier: z.enum(["family", "teams", "business"]).default("teams"),
|
|
753
|
+
label: z.string().max(120).optional(),
|
|
754
|
+
})
|
|
755
|
+
.strict(),
|
|
756
|
+
);
|
|
757
|
+
export type InstallOnePasswordRequest = z.infer<typeof InstallOnePasswordRequest>;
|
|
758
|
+
|
|
759
|
+
export const ProviderVaultMeta = /* @__PURE__ */ defineSchema(() =>
|
|
760
|
+
z.object({
|
|
761
|
+
externalVaultId: primitives.string,
|
|
762
|
+
name: primitives.string,
|
|
763
|
+
itemCount: z.number().int().nullable(),
|
|
764
|
+
linkedVaultId: primitives.nullableUuid,
|
|
765
|
+
/** Unknown means the provider does not expose the grant; writes still check upstream. */
|
|
766
|
+
writeAccess: z.enum(["read_only", "read_write", "unknown"]).optional(),
|
|
767
|
+
operations: VaultProviderOperations.optional(),
|
|
768
|
+
}),
|
|
769
|
+
);
|
|
770
|
+
export type ProviderVaultMeta = z.infer<typeof ProviderVaultMeta>;
|
|
771
|
+
|
|
772
|
+
export const InstallOnePasswordResponse = /* @__PURE__ */ defineSchema(() =>
|
|
773
|
+
z.object({
|
|
774
|
+
connectionId: primitives.uuid,
|
|
775
|
+
accountName: primitives.nullableString,
|
|
776
|
+
vaults: z.array(ProviderVaultMeta),
|
|
777
|
+
}),
|
|
778
|
+
);
|
|
779
|
+
export type InstallOnePasswordResponse = z.infer<typeof InstallOnePasswordResponse>;
|
|
780
|
+
|
|
781
|
+
/** A 1Password service account connected in a workspace. Never carries the token. */
|
|
782
|
+
export const OnePasswordConnectionSummary = /* @__PURE__ */ defineSchema(() =>
|
|
783
|
+
z.object({
|
|
784
|
+
id: primitives.uuid,
|
|
785
|
+
/** Who can use the vaults linked through it. */
|
|
786
|
+
ownership: z.enum(["user", "workspace", "organization"]),
|
|
787
|
+
/** Sign-in host from the token, for example "my.1password.com". */
|
|
788
|
+
accountName: primitives.nullableString,
|
|
789
|
+
label: primitives.nullableString,
|
|
790
|
+
planTier: z.enum(["family", "teams", "business"]),
|
|
791
|
+
/** When the current token was last checked against 1Password. */
|
|
792
|
+
verifiedAt: primitives.string,
|
|
793
|
+
createdAt: primitives.string,
|
|
794
|
+
createdBySubjectId: primitives.nullableString,
|
|
795
|
+
/** The caller can link vaults, replace the token and disconnect it. */
|
|
796
|
+
canManage: primitives.boolean,
|
|
797
|
+
}),
|
|
798
|
+
);
|
|
799
|
+
export type OnePasswordConnectionSummary = z.infer<typeof OnePasswordConnectionSummary>;
|
|
800
|
+
|
|
801
|
+
export const ListOnePasswordConnectionsResponse = /* @__PURE__ */ defineSchema(() =>
|
|
802
|
+
z.object({
|
|
803
|
+
connections: z.array(OnePasswordConnectionSummary),
|
|
804
|
+
}),
|
|
805
|
+
);
|
|
806
|
+
export type ListOnePasswordConnectionsResponse = z.infer<typeof ListOnePasswordConnectionsResponse>;
|
|
807
|
+
|
|
808
|
+
/** A new token for an existing connection; its linked vaults keep working. */
|
|
809
|
+
export const ReplaceOnePasswordTokenRequest = /* @__PURE__ */ defineSchema(() =>
|
|
810
|
+
z
|
|
811
|
+
.object({
|
|
812
|
+
token: primitives.string.trim().min(16).max(4_096),
|
|
813
|
+
planTier: z.enum(["family", "teams", "business"]).optional(),
|
|
814
|
+
})
|
|
815
|
+
.strict(),
|
|
816
|
+
);
|
|
817
|
+
export type ReplaceOnePasswordTokenRequest = z.infer<typeof ReplaceOnePasswordTokenRequest>;
|
|
818
|
+
|
|
819
|
+
export const DisconnectOnePasswordResponse = /* @__PURE__ */ defineSchema(() =>
|
|
820
|
+
z.object({
|
|
821
|
+
/** The Opengeni vaults that were unlinked. Nothing is deleted in 1Password. */
|
|
822
|
+
unlinkedVaultIds: z.array(primitives.uuid),
|
|
823
|
+
}),
|
|
824
|
+
);
|
|
825
|
+
export type DisconnectOnePasswordResponse = z.infer<typeof DisconnectOnePasswordResponse>;
|
|
826
|
+
|
|
827
|
+
/** Providers installed through the generic connection lifecycle. */
|
|
828
|
+
export const ExternalVaultProviderKind = /* @__PURE__ */ defineSchema(() =>
|
|
829
|
+
z.enum(["external", "protonpass", "keeper", "bitwarden"]),
|
|
830
|
+
);
|
|
831
|
+
export type ExternalVaultProviderKind = z.infer<typeof ExternalVaultProviderKind>;
|
|
832
|
+
|
|
833
|
+
/** Write-only setup material. Never included in connection summaries or logs. */
|
|
834
|
+
export const VaultProviderCredentials = /* @__PURE__ */ defineSchema(() =>
|
|
835
|
+
z.discriminatedUnion("provider", [
|
|
836
|
+
z
|
|
837
|
+
.object({
|
|
838
|
+
provider: z.literal("external"),
|
|
839
|
+
endpoint: z.string().url().max(2_048),
|
|
840
|
+
signingSecret: z.string().min(32).max(4_096),
|
|
841
|
+
})
|
|
842
|
+
.strict(),
|
|
843
|
+
/**
|
|
844
|
+
* Bitwarden or Vaultwarden: the server address, the account's personal
|
|
845
|
+
* API key (Settings, Security, Keys) and the master password. The master
|
|
846
|
+
* password opens the account once during setup and is never stored.
|
|
847
|
+
*/
|
|
848
|
+
z
|
|
849
|
+
.object({
|
|
850
|
+
provider: z.literal("bitwarden"),
|
|
851
|
+
serverUrl: z.string().trim().min(1).max(2_048),
|
|
852
|
+
clientId: z.string().trim().min(1).max(200),
|
|
853
|
+
clientSecret: z.string().trim().min(1).max(1_024),
|
|
854
|
+
masterPassword: z.string().min(1).max(1_024),
|
|
855
|
+
})
|
|
856
|
+
.strict(),
|
|
857
|
+
z
|
|
858
|
+
.object({
|
|
859
|
+
provider: z.literal("protonpass"),
|
|
860
|
+
token: z.string().min(16).max(4_096),
|
|
861
|
+
})
|
|
862
|
+
.strict(),
|
|
863
|
+
z
|
|
864
|
+
.object({
|
|
865
|
+
provider: z.literal("keeper"),
|
|
866
|
+
oneTimeToken: z.string().min(16).max(4_096),
|
|
867
|
+
/** Optional region host for tokens that do not encode one. */
|
|
868
|
+
hostname: z.string().max(253).optional(),
|
|
869
|
+
})
|
|
870
|
+
.strict(),
|
|
871
|
+
]),
|
|
872
|
+
);
|
|
873
|
+
export type VaultProviderCredentials = z.infer<typeof VaultProviderCredentials>;
|
|
874
|
+
|
|
875
|
+
export const InstallVaultProviderRequest = /* @__PURE__ */ defineSchema(() =>
|
|
876
|
+
z
|
|
877
|
+
.object({
|
|
878
|
+
credentials: VaultProviderCredentials,
|
|
879
|
+
ownership: z.enum(["user", "workspace", "organization"]),
|
|
880
|
+
label: primitives.string.trim().min(1).max(120).optional(),
|
|
881
|
+
})
|
|
882
|
+
.strict(),
|
|
883
|
+
);
|
|
884
|
+
export type InstallVaultProviderRequest = z.infer<typeof InstallVaultProviderRequest>;
|
|
885
|
+
|
|
886
|
+
export const ReplaceVaultProviderCredentialsRequest = /* @__PURE__ */ defineSchema(() =>
|
|
887
|
+
z.object({ credentials: VaultProviderCredentials }).strict(),
|
|
888
|
+
);
|
|
889
|
+
export type ReplaceVaultProviderCredentialsRequest = z.infer<
|
|
890
|
+
typeof ReplaceVaultProviderCredentialsRequest
|
|
891
|
+
>;
|
|
892
|
+
|
|
893
|
+
/** Includes legacy 1Password connections; existing 1Password routes remain supported. */
|
|
894
|
+
export const VaultProviderConnectionSummary = /* @__PURE__ */ defineSchema(() =>
|
|
895
|
+
z.object({
|
|
896
|
+
id: primitives.uuid,
|
|
897
|
+
provider: z.enum(["onepassword", "external", "protonpass", "keeper", "bitwarden"]),
|
|
898
|
+
ownership: z.enum(["user", "workspace", "organization"]),
|
|
899
|
+
accountName: primitives.nullableString,
|
|
900
|
+
label: primitives.nullableString,
|
|
901
|
+
verifiedAt: primitives.string,
|
|
902
|
+
createdAt: primitives.string,
|
|
903
|
+
createdBySubjectId: primitives.nullableString,
|
|
904
|
+
canManage: primitives.boolean,
|
|
905
|
+
operations: VaultProviderOperations,
|
|
906
|
+
/** Only 1Password uses a plan tier. */
|
|
907
|
+
planTier: z.enum(["family", "teams", "business"]).optional(),
|
|
908
|
+
/** Unavailable means this deployment cannot run the adapter, not bad credentials. */
|
|
909
|
+
available: primitives.boolean,
|
|
910
|
+
/** Setup material is saved, but provider verification has not completed. */
|
|
911
|
+
verificationStatus: z.enum(["ready", "pending"]).optional(),
|
|
912
|
+
}),
|
|
913
|
+
);
|
|
914
|
+
export type VaultProviderConnectionSummary = z.infer<typeof VaultProviderConnectionSummary>;
|
|
915
|
+
|
|
916
|
+
/** Deployment configuration, independent of whether anyone has connected yet. */
|
|
917
|
+
export const VaultProviderAvailability = /* @__PURE__ */ defineSchema(() =>
|
|
918
|
+
z.object({
|
|
919
|
+
provider: VaultProviderConnectionSummary.shape.provider,
|
|
920
|
+
available: primitives.boolean,
|
|
921
|
+
reason: z.enum(["not_enabled"]).nullable(),
|
|
922
|
+
}),
|
|
923
|
+
);
|
|
924
|
+
export type VaultProviderAvailability = z.infer<typeof VaultProviderAvailability>;
|
|
925
|
+
|
|
926
|
+
export const ListVaultProviderConnectionsResponse = /* @__PURE__ */ defineSchema(() =>
|
|
927
|
+
z.object({
|
|
928
|
+
connections: z.array(VaultProviderConnectionSummary),
|
|
929
|
+
/** Additive: older servers may omit this metadata-only deployment catalog. */
|
|
930
|
+
providers: z.array(VaultProviderAvailability).optional(),
|
|
931
|
+
}),
|
|
932
|
+
);
|
|
933
|
+
export type ListVaultProviderConnectionsResponse = z.infer<
|
|
934
|
+
typeof ListVaultProviderConnectionsResponse
|
|
935
|
+
>;
|
|
936
|
+
|
|
937
|
+
export const InstallVaultProviderResponse = /* @__PURE__ */ defineSchema(() =>
|
|
938
|
+
z.object({
|
|
939
|
+
connectionId: primitives.uuid,
|
|
940
|
+
accountName: primitives.nullableString,
|
|
941
|
+
provider: ExternalVaultProviderKind,
|
|
942
|
+
operations: VaultProviderOperations,
|
|
943
|
+
vaults: z.array(ProviderVaultMeta),
|
|
944
|
+
/** Retry verification on this connection; never replay a consumed bootstrap token. */
|
|
945
|
+
discoveryPending: primitives.optionalBoolean,
|
|
946
|
+
errorCode: z.string().max(100).optional(),
|
|
947
|
+
}),
|
|
948
|
+
);
|
|
949
|
+
export type InstallVaultProviderResponse = z.infer<typeof InstallVaultProviderResponse>;
|
|
950
|
+
|
|
951
|
+
export const DisconnectVaultProviderResponse = /* @__PURE__ */ defineSchema(() =>
|
|
952
|
+
z.object({ unlinkedVaultIds: z.array(primitives.uuid) }),
|
|
953
|
+
);
|
|
954
|
+
export type DisconnectVaultProviderResponse = z.infer<typeof DisconnectVaultProviderResponse>;
|
|
955
|
+
|
|
956
|
+
export const LinkProviderVaultRequest = /* @__PURE__ */ defineSchema(() =>
|
|
957
|
+
z
|
|
958
|
+
.object({
|
|
959
|
+
provider: z.enum(["onepassword", "host", "external", "protonpass", "keeper", "bitwarden"]),
|
|
960
|
+
/** Required except for an in-process host provider. */
|
|
961
|
+
connectionId: primitives.optionalUuid,
|
|
962
|
+
externalVaultId: primitives.string,
|
|
963
|
+
ownerKind: z.enum(["user", "workspace", "organization"]),
|
|
964
|
+
mode: VaultMode,
|
|
965
|
+
name: VaultName.optional(),
|
|
966
|
+
availability: VaultAvailability.optional(),
|
|
967
|
+
})
|
|
968
|
+
.strict(),
|
|
969
|
+
);
|
|
970
|
+
export type LinkProviderVaultRequest = z.infer<typeof LinkProviderVaultRequest>;
|
|
971
|
+
|
|
972
|
+
export const CreateManagedProviderVaultRequest = /* @__PURE__ */ defineSchema(() =>
|
|
973
|
+
z
|
|
974
|
+
.object({
|
|
975
|
+
name: VaultName,
|
|
976
|
+
ownerKind: z.enum(["user", "workspace", "organization"]),
|
|
977
|
+
groupId: z.string().optional(),
|
|
978
|
+
})
|
|
979
|
+
.strict(),
|
|
980
|
+
);
|
|
981
|
+
export type CreateManagedProviderVaultRequest = z.infer<typeof CreateManagedProviderVaultRequest>;
|
|
982
|
+
|
|
983
|
+
// ---------------------------------------------------------------------------
|
|
984
|
+
// Errors
|
|
985
|
+
// ---------------------------------------------------------------------------
|
|
986
|
+
|
|
987
|
+
export const VaultErrorCode = /* @__PURE__ */ defineSchema(() =>
|
|
988
|
+
z.enum([
|
|
989
|
+
"vault_not_found",
|
|
990
|
+
"vault_item_not_found",
|
|
991
|
+
"vault_field_not_found",
|
|
992
|
+
"vault_name_conflict",
|
|
993
|
+
"vault_item_name_conflict",
|
|
994
|
+
"vault_limit_reached",
|
|
995
|
+
"vault_read_only",
|
|
996
|
+
/**
|
|
997
|
+
* A writable connected vault cannot do this one thing (an item type, a
|
|
998
|
+
* file, a one-time password or an operation its provider does not
|
|
999
|
+
* offer). Unlike `vault_read_only`, other writes still work.
|
|
1000
|
+
*/
|
|
1001
|
+
"vault_operation_unsupported",
|
|
1002
|
+
"vault_generation_conflict",
|
|
1003
|
+
"vault_permission_denied",
|
|
1004
|
+
/** A session's vault policy reaches outside its parent's effective vaults (AX-2). */
|
|
1005
|
+
"vault_policy_outside_parent",
|
|
1006
|
+
"vault_reveal_requires_human",
|
|
1007
|
+
"encryption_key_missing",
|
|
1008
|
+
"provider_auth_invalid",
|
|
1009
|
+
"provider_auth_expired",
|
|
1010
|
+
"provider_rate_limited",
|
|
1011
|
+
"provider_unavailable",
|
|
1012
|
+
"provider_conflict",
|
|
1013
|
+
"provider_locked",
|
|
1014
|
+
"provider_inventory_incomplete",
|
|
1015
|
+
"provider_outcome_unknown",
|
|
1016
|
+
"variable_sets_removed",
|
|
1017
|
+
"secret_save_forbidden",
|
|
1018
|
+
"invalid_secret_name",
|
|
1019
|
+
"secret_value_too_large",
|
|
1020
|
+
"human_auth_required",
|
|
1021
|
+
"secret_search_cursor_invalid",
|
|
1022
|
+
]),
|
|
1023
|
+
);
|
|
1024
|
+
export type VaultErrorCode = z.infer<typeof VaultErrorCode>;
|
|
1025
|
+
|
|
1026
|
+
export const VaultApiError = /* @__PURE__ */ defineSchema(() =>
|
|
1027
|
+
z.object({
|
|
1028
|
+
error: VaultErrorCode,
|
|
1029
|
+
message: primitives.string,
|
|
1030
|
+
details: z.record(primitives.string, z.unknown()).optional(),
|
|
1031
|
+
}),
|
|
1032
|
+
);
|
|
1033
|
+
export type VaultApiError = z.infer<typeof VaultApiError>;
|
|
1034
|
+
|
|
1035
|
+
/** HTTP status for every vault error code (§10B.1.1). */
|
|
1036
|
+
export const VAULT_ERROR_HTTP_STATUS: Readonly<Record<VaultErrorCode, number>> = {
|
|
1037
|
+
vault_not_found: 404,
|
|
1038
|
+
vault_item_not_found: 404,
|
|
1039
|
+
vault_field_not_found: 404,
|
|
1040
|
+
vault_name_conflict: 409,
|
|
1041
|
+
vault_item_name_conflict: 409,
|
|
1042
|
+
vault_generation_conflict: 409,
|
|
1043
|
+
provider_conflict: 409,
|
|
1044
|
+
vault_limit_reached: 422,
|
|
1045
|
+
invalid_secret_name: 422,
|
|
1046
|
+
secret_value_too_large: 422,
|
|
1047
|
+
secret_save_forbidden: 422,
|
|
1048
|
+
secret_search_cursor_invalid: 422,
|
|
1049
|
+
vault_policy_outside_parent: 422,
|
|
1050
|
+
vault_read_only: 403,
|
|
1051
|
+
vault_operation_unsupported: 422,
|
|
1052
|
+
vault_permission_denied: 403,
|
|
1053
|
+
vault_reveal_requires_human: 403,
|
|
1054
|
+
human_auth_required: 403,
|
|
1055
|
+
variable_sets_removed: 422,
|
|
1056
|
+
encryption_key_missing: 503,
|
|
1057
|
+
provider_unavailable: 503,
|
|
1058
|
+
provider_rate_limited: 429,
|
|
1059
|
+
provider_auth_invalid: 401,
|
|
1060
|
+
provider_auth_expired: 401,
|
|
1061
|
+
provider_locked: 423,
|
|
1062
|
+
provider_inventory_incomplete: 503,
|
|
1063
|
+
provider_outcome_unknown: 503,
|
|
1064
|
+
};
|
|
1065
|
+
|
|
1066
|
+
// ---------------------------------------------------------------------------
|
|
1067
|
+
// Agent tools (capability `secrets`)
|
|
1068
|
+
// ---------------------------------------------------------------------------
|
|
1069
|
+
|
|
1070
|
+
export const SECRET_TOOL_NAMES = [
|
|
1071
|
+
"secret_search",
|
|
1072
|
+
"secret_save",
|
|
1073
|
+
"secret_get",
|
|
1074
|
+
"secret_move",
|
|
1075
|
+
"secret_delete",
|
|
1076
|
+
] as const;
|
|
1077
|
+
export type SecretToolName = (typeof SECRET_TOOL_NAMES)[number];
|
|
1078
|
+
|
|
1079
|
+
export const SECRET_SAVE_TO = /* @__PURE__ */ defineSchema(() =>
|
|
1080
|
+
z.enum(["user", "task", "workspace"]),
|
|
1081
|
+
);
|
|
1082
|
+
export type SecretSaveTo = z.infer<typeof SECRET_SAVE_TO>;
|
|
1083
|
+
|
|
1084
|
+
export const SecretSearchInput = /* @__PURE__ */ defineSchema(() =>
|
|
1085
|
+
z
|
|
1086
|
+
.object({
|
|
1087
|
+
query: z.string().max(200).optional(),
|
|
1088
|
+
website: primitives.string.max(VAULT_LIMITS.websiteMaxChars).optional(),
|
|
1089
|
+
type: VaultItemType.optional(),
|
|
1090
|
+
/** Vault name or ID. */
|
|
1091
|
+
vault: z.string().max(200).optional(),
|
|
1092
|
+
limit: z.number().int().min(1).max(VAULT_LIMITS.searchResultsMax).default(20),
|
|
1093
|
+
/** `nextCursor` from the previous call with the same filters. */
|
|
1094
|
+
cursor: primitives.string.max(VAULT_LIMITS.searchCursorMaxChars).optional(),
|
|
1095
|
+
/** Refresh provider metadata and subsequent value reads; never bypass rate limits. */
|
|
1096
|
+
refresh: primitives.optionalBoolean,
|
|
1097
|
+
})
|
|
1098
|
+
.strict(),
|
|
1099
|
+
);
|
|
1100
|
+
export type SecretSearchInput = z.infer<typeof SecretSearchInput>;
|
|
1101
|
+
|
|
1102
|
+
export const SecretSearchResult = /* @__PURE__ */ defineSchema(() =>
|
|
1103
|
+
z.object({
|
|
1104
|
+
vault: z.object({
|
|
1105
|
+
id: primitives.uuid,
|
|
1106
|
+
name: primitives.string,
|
|
1107
|
+
ownerKind: VaultOwnerKind,
|
|
1108
|
+
source: VaultSource,
|
|
1109
|
+
mode: VaultMode,
|
|
1110
|
+
}),
|
|
1111
|
+
item: z.object({
|
|
1112
|
+
id: primitives.uuid,
|
|
1113
|
+
name: primitives.string,
|
|
1114
|
+
type: VaultItemType,
|
|
1115
|
+
category: primitives.nullableString,
|
|
1116
|
+
websites: z.array(primitives.string),
|
|
1117
|
+
username: primitives.nullableString,
|
|
1118
|
+
hasTotp: primitives.boolean,
|
|
1119
|
+
hasPasskey: primitives.boolean,
|
|
1120
|
+
expiresAt: primitives.nullableString,
|
|
1121
|
+
}),
|
|
1122
|
+
fields: z.array(z.object({ name: primitives.string, kind: VaultFieldKind })),
|
|
1123
|
+
references: VaultItemReferences,
|
|
1124
|
+
}),
|
|
1125
|
+
);
|
|
1126
|
+
export type SecretSearchResult = z.infer<typeof SecretSearchResult>;
|
|
1127
|
+
export const SecretSearchVault = /* @__PURE__ */ defineSchema(() =>
|
|
1128
|
+
z.object({
|
|
1129
|
+
id: primitives.uuid,
|
|
1130
|
+
name: primitives.string,
|
|
1131
|
+
ownerKind: VaultOwnerKind,
|
|
1132
|
+
source: VaultSource,
|
|
1133
|
+
mode: VaultMode,
|
|
1134
|
+
itemCount: primitives.nonnegativeInteger,
|
|
1135
|
+
freshness: VaultProviderFreshness.optional(),
|
|
1136
|
+
}),
|
|
1137
|
+
);
|
|
1138
|
+
export type SecretSearchVault = z.infer<typeof SecretSearchVault>;
|
|
1139
|
+
export const SecretSearchOutput = /* @__PURE__ */ defineSchema(() =>
|
|
1140
|
+
z.object({
|
|
1141
|
+
items: z.array(SecretSearchResult),
|
|
1142
|
+
/** True when more matches remain; pass `nextCursor` to continue. */
|
|
1143
|
+
truncated: primitives.boolean,
|
|
1144
|
+
nextCursor: primitives.nullableString,
|
|
1145
|
+
/** Every vault the caller can reach, on the first page only. */
|
|
1146
|
+
vaults: z.array(SecretSearchVault).optional(),
|
|
1147
|
+
/** False when a reachable provider could not be checked; empty items are not proof of absence. */
|
|
1148
|
+
complete: primitives.optionalBoolean,
|
|
1149
|
+
/** Included on every page so failures are not lost after page one. */
|
|
1150
|
+
sources: z
|
|
1151
|
+
.array(
|
|
1152
|
+
z.object({
|
|
1153
|
+
vaultId: primitives.uuid,
|
|
1154
|
+
freshness: VaultProviderFreshness,
|
|
1155
|
+
}),
|
|
1156
|
+
)
|
|
1157
|
+
.optional(),
|
|
1158
|
+
}),
|
|
1159
|
+
);
|
|
1160
|
+
export type SecretSearchOutput = z.infer<typeof SecretSearchOutput>;
|
|
1161
|
+
|
|
1162
|
+
export const SecretSaveFieldInput = /* @__PURE__ */ defineSchema(() =>
|
|
1163
|
+
z
|
|
1164
|
+
.object({
|
|
1165
|
+
name: VaultFieldName,
|
|
1166
|
+
kind: VaultFieldKind.optional(),
|
|
1167
|
+
value: z.string().optional(),
|
|
1168
|
+
generate: GeneratePasswordSpec.optional(),
|
|
1169
|
+
/** An `ssh_key` item's "private key" only: a new key pair. */
|
|
1170
|
+
generateKey: GenerateSshKeySpec.optional(),
|
|
1171
|
+
fromReference: primitives.string.max(VAULT_LIMITS.referenceMaxChars).optional(),
|
|
1172
|
+
restoreVersion: z.number().int().optional(),
|
|
1173
|
+
})
|
|
1174
|
+
.strict()
|
|
1175
|
+
.refine(
|
|
1176
|
+
exactlyOneValueSource,
|
|
1177
|
+
"exactly one of value|generate|generateKey|fromReference|restoreVersion",
|
|
1178
|
+
),
|
|
1179
|
+
);
|
|
1180
|
+
export type SecretSaveFieldInput = z.infer<typeof SecretSaveFieldInput>;
|
|
1181
|
+
|
|
1182
|
+
export const SecretSaveInput = /* @__PURE__ */ defineSchema(() =>
|
|
1183
|
+
z
|
|
1184
|
+
.object({
|
|
1185
|
+
item: VaultName,
|
|
1186
|
+
/** Vault name or ID; defaults to the saveTo scope's default vault. */
|
|
1187
|
+
vault: z.string().max(200).optional(),
|
|
1188
|
+
saveTo: SECRET_SAVE_TO.optional(),
|
|
1189
|
+
type: VaultItemType.default("login"),
|
|
1190
|
+
/** A more specific kind of item, such as "database" or "bank_account". */
|
|
1191
|
+
category: VaultItemCategory.nullable().optional(),
|
|
1192
|
+
websites: z
|
|
1193
|
+
.array(primitives.string.max(VAULT_LIMITS.websiteMaxChars))
|
|
1194
|
+
.max(VAULT_LIMITS.websitesPerItem)
|
|
1195
|
+
.optional(),
|
|
1196
|
+
username: z.string().max(512).optional(),
|
|
1197
|
+
fields: z.array(SecretSaveFieldInput).max(VAULT_LIMITS.fieldsPerItem).optional(),
|
|
1198
|
+
mode: z.enum(["create", "update", "upsert"]).default("upsert"),
|
|
1199
|
+
})
|
|
1200
|
+
.strict(),
|
|
1201
|
+
);
|
|
1202
|
+
export type SecretSaveInput = z.infer<typeof SecretSaveInput>;
|
|
1203
|
+
export const SecretSaveOutput = /* @__PURE__ */ defineSchema(() =>
|
|
1204
|
+
z.object({
|
|
1205
|
+
item: VaultItemSummary,
|
|
1206
|
+
references: VaultItemReferences,
|
|
1207
|
+
generatedFields: z.array(primitives.string),
|
|
1208
|
+
}),
|
|
1209
|
+
);
|
|
1210
|
+
export type SecretSaveOutput = z.infer<typeof SecretSaveOutput>;
|
|
1211
|
+
|
|
1212
|
+
export const SecretGetInput = /* @__PURE__ */ defineSchema(() =>
|
|
1213
|
+
z
|
|
1214
|
+
.object({
|
|
1215
|
+
reference: primitives.nonEmptyString.max(VAULT_LIMITS.referenceMaxChars),
|
|
1216
|
+
version: z.number().int().optional(),
|
|
1217
|
+
})
|
|
1218
|
+
.strict(),
|
|
1219
|
+
);
|
|
1220
|
+
export type SecretGetInput = z.infer<typeof SecretGetInput>;
|
|
1221
|
+
export const SecretGetOutput = RevealVaultFieldResponse;
|
|
1222
|
+
export type SecretGetOutput = RevealVaultFieldResponse;
|
|
1223
|
+
|
|
1224
|
+
export const SecretMoveInput = /* @__PURE__ */ defineSchema(() =>
|
|
1225
|
+
z
|
|
1226
|
+
.object({
|
|
1227
|
+
reference: primitives.nonEmptyString.max(VAULT_LIMITS.referenceMaxChars),
|
|
1228
|
+
/** Vault name or ID. */
|
|
1229
|
+
toVault: z.string().min(1).max(200),
|
|
1230
|
+
mode: z.enum(["move", "copy"]).default("move"),
|
|
1231
|
+
newName: VaultName.optional(),
|
|
1232
|
+
})
|
|
1233
|
+
.strict(),
|
|
1234
|
+
);
|
|
1235
|
+
export type SecretMoveInput = z.infer<typeof SecretMoveInput>;
|
|
1236
|
+
export const SecretMoveOutput = /* @__PURE__ */ defineSchema(() =>
|
|
1237
|
+
z.object({
|
|
1238
|
+
item: VaultItemSummary,
|
|
1239
|
+
references: VaultItemReferences,
|
|
1240
|
+
}),
|
|
1241
|
+
);
|
|
1242
|
+
export type SecretMoveOutput = z.infer<typeof SecretMoveOutput>;
|
|
1243
|
+
|
|
1244
|
+
export const SecretDeleteInput = /* @__PURE__ */ defineSchema(() =>
|
|
1245
|
+
z.object({ reference: primitives.nonEmptyString.max(VAULT_LIMITS.referenceMaxChars) }).strict(),
|
|
1246
|
+
);
|
|
1247
|
+
export type SecretDeleteInput = z.infer<typeof SecretDeleteInput>;
|
|
1248
|
+
export const SecretDeleteOutput = /* @__PURE__ */ defineSchema(() =>
|
|
1249
|
+
z.object({ archived: z.literal(true), restoreHint: primitives.string }),
|
|
1250
|
+
);
|
|
1251
|
+
export type SecretDeleteOutput = z.infer<typeof SecretDeleteOutput>;
|
|
1252
|
+
|
|
1253
|
+
// ---------------------------------------------------------------------------
|
|
1254
|
+
// Events, audit and metrics (§10B.1.9)
|
|
1255
|
+
// ---------------------------------------------------------------------------
|
|
1256
|
+
|
|
1257
|
+
export const VAULT_POLICY_UPDATED_EVENT_TYPE = "session.vaultPolicy.updated" as const;
|
|
1258
|
+
|
|
1259
|
+
export const VAULT_AUDIT_ACTIONS = [
|
|
1260
|
+
"vault.created",
|
|
1261
|
+
"vault.updated",
|
|
1262
|
+
"vault.deleted",
|
|
1263
|
+
"vault.item.created",
|
|
1264
|
+
"vault.item.updated",
|
|
1265
|
+
"vault.item.archived",
|
|
1266
|
+
"vault.item.restored",
|
|
1267
|
+
"vault.item.deleted",
|
|
1268
|
+
"vault.item.moved",
|
|
1269
|
+
"vault.item.copied",
|
|
1270
|
+
"vault.field.set",
|
|
1271
|
+
"vault.field.revealed",
|
|
1272
|
+
"vault.secret.used",
|
|
1273
|
+
"vault.secret.read",
|
|
1274
|
+
"vault.secret.read.denied",
|
|
1275
|
+
"vault.reference.failed",
|
|
1276
|
+
"vault.provider.connected",
|
|
1277
|
+
"vault.provider.linked",
|
|
1278
|
+
"vault.provider.synced",
|
|
1279
|
+
"vault.provider.error",
|
|
1280
|
+
"vault.passkey.registered",
|
|
1281
|
+
"vault.passkey.asserted",
|
|
1282
|
+
"vault.policy.updated",
|
|
1283
|
+
"vault.migrated",
|
|
1284
|
+
] as const;
|
|
1285
|
+
export const VaultAuditAction = /* @__PURE__ */ defineSchema(() => z.enum(VAULT_AUDIT_ACTIONS));
|
|
1286
|
+
export type VaultAuditAction = z.infer<typeof VaultAuditAction>;
|
|
1287
|
+
export const VAULT_AUDIT_TARGET_TYPES = ["vault", "vault_item"] as const;
|
|
1288
|
+
|
|
1289
|
+
export const VAULT_METRIC_NAMES = {
|
|
1290
|
+
resolutions: "opengeni_secret_resolutions_total",
|
|
1291
|
+
resolutionDuration: "opengeni_secret_resolution_duration_seconds",
|
|
1292
|
+
execEnvBytes: "opengeni_secret_exec_env_bytes",
|
|
1293
|
+
providerCalls: "opengeni_vault_provider_calls_total",
|
|
1294
|
+
providerRateLimited: "opengeni_vault_provider_rate_limited_total",
|
|
1295
|
+
passkeyAssertions: "opengeni_passkey_assertions_total",
|
|
1296
|
+
} as const;
|