@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
|
@@ -0,0 +1,891 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { defineSchema } from "./define-schema";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Event sources, normalized events and event triggers.
|
|
6
|
+
*
|
|
7
|
+
* An event source delivers events into a workspace: a webhook endpoint a person
|
|
8
|
+
* pastes into another app, an app Opengeni receives events from directly, or an
|
|
9
|
+
* MCP connection whose server offers the MCP Events extension. Every source
|
|
10
|
+
* produces the same normalized event. An automation (a scheduled task) runs
|
|
11
|
+
* when one of its event triggers matches an event.
|
|
12
|
+
*
|
|
13
|
+
* This module must not import `./index`: the scheduled-task schemas there
|
|
14
|
+
* embed these schemas.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* `workspace` is "This workspace": things that happen in Opengeni itself, such
|
|
19
|
+
* as a meeting's transcript becoming ready, as one person may see them.
|
|
20
|
+
*/
|
|
21
|
+
export const EVENT_SOURCE_KINDS = [
|
|
22
|
+
"webhook",
|
|
23
|
+
"github",
|
|
24
|
+
"slack",
|
|
25
|
+
"gmail",
|
|
26
|
+
"mcp",
|
|
27
|
+
"workspace",
|
|
28
|
+
] as const;
|
|
29
|
+
export const EventSourceKind = /* @__PURE__ */ defineSchema(() => z.enum(EVENT_SOURCE_KINDS));
|
|
30
|
+
export type EventSourceKind = z.infer<typeof EventSourceKind>;
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* How a webhook endpoint verifies and reads deliveries: `standard` is
|
|
34
|
+
* Opengeni's own format (Standard Webhooks with an Opengeni secret), `linear`
|
|
35
|
+
* and `sentry` are those apps' webhooks, and `custom` reads any other app's
|
|
36
|
+
* webhooks as the source's `format` describes.
|
|
37
|
+
*/
|
|
38
|
+
export const WEBHOOK_EVENT_ADAPTERS = ["standard", "linear", "sentry", "custom"] as const;
|
|
39
|
+
export const WebhookEventAdapter = /* @__PURE__ */ defineSchema(() =>
|
|
40
|
+
z.enum(WEBHOOK_EVENT_ADAPTERS),
|
|
41
|
+
);
|
|
42
|
+
export type WebhookEventAdapter = z.infer<typeof WebhookEventAdapter>;
|
|
43
|
+
|
|
44
|
+
/** An HTTP header name, matched without regard to case. */
|
|
45
|
+
export const WebhookHeaderName = /* @__PURE__ */ defineSchema(() =>
|
|
46
|
+
z.string().regex(/^[!#$%&'*+.^_`|~0-9A-Za-z-]{1,100}$/u, "A header name such as X-Signature"),
|
|
47
|
+
);
|
|
48
|
+
|
|
49
|
+
/** A dot-separated path into a JSON object, such as `data.object.id`. */
|
|
50
|
+
export const WebhookJsonPath = /* @__PURE__ */ defineSchema(() =>
|
|
51
|
+
z
|
|
52
|
+
.string()
|
|
53
|
+
.max(200)
|
|
54
|
+
.regex(/^[^.\s]+(?:\.[^.\s]+)*$/u, "A dot-separated path such as data.object.id"),
|
|
55
|
+
);
|
|
56
|
+
|
|
57
|
+
/** Where a value comes from: a JSON path in the event, or a request header. */
|
|
58
|
+
export const WebhookValueSource = /* @__PURE__ */ defineSchema(() =>
|
|
59
|
+
z.union([
|
|
60
|
+
z.object({ path: WebhookJsonPath }).strict(),
|
|
61
|
+
z.object({ header: WebhookHeaderName }).strict(),
|
|
62
|
+
]),
|
|
63
|
+
);
|
|
64
|
+
export type WebhookValueSource = z.infer<typeof WebhookValueSource>;
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* How a custom webhook proves it came from the app, always over the exact raw
|
|
68
|
+
* body and with the source's secret:
|
|
69
|
+
* - `standard_webhooks`: Standard Webhooks (`webhook-id`, `webhook-timestamp`,
|
|
70
|
+
* `webhook-signature`) with a `whsec_` secret, as Svix-based apps send.
|
|
71
|
+
* - `hmac_sha256`: the HMAC-SHA256 of the body in `header`, hex or base64,
|
|
72
|
+
* after an optional `prefix` such as `sha256=`.
|
|
73
|
+
* - `timestamped_hmac_sha256`: a `t=<unix seconds>,v1=<hex>` header whose
|
|
74
|
+
* signature is the HMAC-SHA256 of `<t>.<body>`, as Stripe and Tailscale
|
|
75
|
+
* send; deliveries signed more than `toleranceSeconds` away are refused.
|
|
76
|
+
* - `token`: the secret itself in `header`, after an optional `prefix` such
|
|
77
|
+
* as `Bearer ` (a shared token, as GitLab sends).
|
|
78
|
+
*/
|
|
79
|
+
export const WebhookSignatureFormat = /* @__PURE__ */ defineSchema(() =>
|
|
80
|
+
z.discriminatedUnion("scheme", [
|
|
81
|
+
z.object({ scheme: z.literal("standard_webhooks") }).strict(),
|
|
82
|
+
z
|
|
83
|
+
.object({
|
|
84
|
+
scheme: z.literal("hmac_sha256"),
|
|
85
|
+
header: WebhookHeaderName,
|
|
86
|
+
encoding: z.enum(["hex", "base64"]).default("hex"),
|
|
87
|
+
prefix: z.string().max(32).default(""),
|
|
88
|
+
})
|
|
89
|
+
.strict(),
|
|
90
|
+
z
|
|
91
|
+
.object({
|
|
92
|
+
scheme: z.literal("timestamped_hmac_sha256"),
|
|
93
|
+
header: WebhookHeaderName,
|
|
94
|
+
toleranceSeconds: z.number().int().min(60).max(3600).default(300),
|
|
95
|
+
})
|
|
96
|
+
.strict(),
|
|
97
|
+
z
|
|
98
|
+
.object({
|
|
99
|
+
scheme: z.literal("token"),
|
|
100
|
+
header: WebhookHeaderName,
|
|
101
|
+
prefix: z.string().max(32).default(""),
|
|
102
|
+
})
|
|
103
|
+
.strict(),
|
|
104
|
+
]),
|
|
105
|
+
);
|
|
106
|
+
export type WebhookSignatureFormat = z.infer<typeof WebhookSignatureFormat>;
|
|
107
|
+
|
|
108
|
+
export const EventSourceStatus = /* @__PURE__ */ defineSchema(() =>
|
|
109
|
+
z.enum(["active", "disabled", "blocked"]),
|
|
110
|
+
);
|
|
111
|
+
export type EventSourceStatus = z.infer<typeof EventSourceStatus>;
|
|
112
|
+
|
|
113
|
+
/**
|
|
114
|
+
* Why an event source or trigger is not active, or why a source can't send
|
|
115
|
+
* an event type, as a code clients word in their own language. Each comes
|
|
116
|
+
* with the same reason as an English sentence (`statusReason`,
|
|
117
|
+
* `unavailableReason`) and, for some, what the app or server said
|
|
118
|
+
* (`…Detail`). The wire carries a plain string: a client reads a code it
|
|
119
|
+
* doesn't know, or none, as "show the sentence".
|
|
120
|
+
*
|
|
121
|
+
* - `turned_off`: someone turned it off.
|
|
122
|
+
* - `awaiting_secret`: a pasted Linear, Sentry or custom webhook waits for its signing secret.
|
|
123
|
+
* - `reconnect`: the owner's connection to the app has to be signed in again.
|
|
124
|
+
* - `missing_permission`: the connection no longer allows reading what the events need.
|
|
125
|
+
* - `app_not_enabled`: the app isn't turned on for the connected account.
|
|
126
|
+
* - `account_changed`: the connection now signs in as another account (the detail names it).
|
|
127
|
+
* - `connector_removed`: the app or connector is no longer added to the workspace.
|
|
128
|
+
* - `host_sign_in`: the server signs in through the app that embeds Opengeni, which automations can't use.
|
|
129
|
+
* - `events_unsupported`: the server doesn't offer events.
|
|
130
|
+
* - `event_type_gone`: the server no longer offers this event type.
|
|
131
|
+
* - `forbidden`: the server won't let the owner's account receive these events with these settings.
|
|
132
|
+
* - `invalid_arguments`: the server rejected the trigger's subscription arguments.
|
|
133
|
+
* - `needs_public_address`: the server sends this type only to a public https address, which the deployment lacks.
|
|
134
|
+
* - `push_only`: the server sends this type only over a held-open connection, which isn't supported yet.
|
|
135
|
+
* - `delivery_mode_unsupported`: the server won't send this type in a way the deployment can receive.
|
|
136
|
+
* - `callback_unreachable`: the server can't reach the deployment's webhook address.
|
|
137
|
+
* - `not_answering`: the app or server hasn't answered for over an hour.
|
|
138
|
+
* - `github_event_not_subscribed`: the GitHub App isn't subscribed to the event (the detail names it).
|
|
139
|
+
* - `unavailable`: the source can't receive events for another reason.
|
|
140
|
+
*/
|
|
141
|
+
export const EVENT_STATUS_REASON_CODES = [
|
|
142
|
+
"turned_off",
|
|
143
|
+
"awaiting_secret",
|
|
144
|
+
"reconnect",
|
|
145
|
+
"missing_permission",
|
|
146
|
+
"app_not_enabled",
|
|
147
|
+
"account_changed",
|
|
148
|
+
"connector_removed",
|
|
149
|
+
"host_sign_in",
|
|
150
|
+
"events_unsupported",
|
|
151
|
+
"event_type_gone",
|
|
152
|
+
"forbidden",
|
|
153
|
+
"invalid_arguments",
|
|
154
|
+
"needs_public_address",
|
|
155
|
+
"push_only",
|
|
156
|
+
"delivery_mode_unsupported",
|
|
157
|
+
"callback_unreachable",
|
|
158
|
+
"not_answering",
|
|
159
|
+
"github_event_not_subscribed",
|
|
160
|
+
"unavailable",
|
|
161
|
+
] as const;
|
|
162
|
+
export type EventStatusReasonCode = (typeof EVENT_STATUS_REASON_CODES)[number];
|
|
163
|
+
|
|
164
|
+
/** Whether `code` is one this version of the contract knows. */
|
|
165
|
+
export function isEventStatusReasonCode(code: unknown): code is EventStatusReasonCode {
|
|
166
|
+
return (
|
|
167
|
+
typeof code === "string" && (EVENT_STATUS_REASON_CODES as readonly string[]).includes(code)
|
|
168
|
+
);
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
/** Who can use a source and see its events: only its owner, or the workspace. */
|
|
172
|
+
export const EventSourceVisibility = /* @__PURE__ */ defineSchema(() =>
|
|
173
|
+
z.enum(["private", "workspace"]),
|
|
174
|
+
);
|
|
175
|
+
export type EventSourceVisibility = z.infer<typeof EventSourceVisibility>;
|
|
176
|
+
|
|
177
|
+
export const EVENT_SOURCE_NAME_MAX_LENGTH = 120;
|
|
178
|
+
export const EVENT_TYPE_MAX_LENGTH = 200;
|
|
179
|
+
export const EVENT_SUMMARY_MAX_LENGTH = 500;
|
|
180
|
+
export const EVENT_SUBJECT_MAX_LENGTH = 300;
|
|
181
|
+
/** Serialized UTF-8 bytes of an event's stored `data`; larger data is cut. */
|
|
182
|
+
export const EVENT_DATA_MAX_BYTES = 64 * 1024;
|
|
183
|
+
/** Raw request bodies above this size are refused before verification. */
|
|
184
|
+
export const EVENT_DELIVERY_BODY_MAX_BYTES = 1024 * 1024;
|
|
185
|
+
export const EVENT_TRIGGERS_PER_AUTOMATION_MAX = 16;
|
|
186
|
+
export const EVENT_TRIGGER_TYPES_MAX = 32;
|
|
187
|
+
export const EVENT_TRIGGER_CONDITIONS_MAX = 16;
|
|
188
|
+
export const DEFAULT_EVENT_RUNS_PER_HOUR = 30;
|
|
189
|
+
export const MAX_EVENT_RUNS_PER_HOUR = 1000;
|
|
190
|
+
/** Raw delivery bodies are deleted after this many days; delivery rows stay. */
|
|
191
|
+
export const EVENT_DELIVERY_BODY_RETENTION_DAYS = 7;
|
|
192
|
+
/** Normalized events and delivery rows are deleted after this many days. */
|
|
193
|
+
export const EVENT_RETENTION_DAYS = 30;
|
|
194
|
+
|
|
195
|
+
const Uuid = /* @__PURE__ */ defineSchema(() => z.string().uuid());
|
|
196
|
+
const Timestamp = /* @__PURE__ */ defineSchema(() => z.string());
|
|
197
|
+
|
|
198
|
+
export const EventSourceName = /* @__PURE__ */ defineSchema(() =>
|
|
199
|
+
z.string().trim().min(1).max(EVENT_SOURCE_NAME_MAX_LENGTH),
|
|
200
|
+
);
|
|
201
|
+
|
|
202
|
+
export const EventTypeName = /* @__PURE__ */ defineSchema(() =>
|
|
203
|
+
z
|
|
204
|
+
.string()
|
|
205
|
+
.min(1)
|
|
206
|
+
.max(EVENT_TYPE_MAX_LENGTH)
|
|
207
|
+
.regex(/^[\x21-\x7e]+$/u, "Event types are printable ASCII without spaces"),
|
|
208
|
+
);
|
|
209
|
+
|
|
210
|
+
/**
|
|
211
|
+
* How a custom webhook source reads another app's deliveries. Paths are read
|
|
212
|
+
* in each event: the body, or each item of the list `batch` names.
|
|
213
|
+
*/
|
|
214
|
+
export const WebhookFormat = /* @__PURE__ */ defineSchema(() =>
|
|
215
|
+
z
|
|
216
|
+
.object({
|
|
217
|
+
/** The preset that filled this in, such as `tailscale`: names the app and its documented event types. */
|
|
218
|
+
preset: z
|
|
219
|
+
.string()
|
|
220
|
+
.regex(/^[a-z0-9][a-z0-9-]{0,63}$/u)
|
|
221
|
+
.optional(),
|
|
222
|
+
signature: WebhookSignatureFormat,
|
|
223
|
+
/**
|
|
224
|
+
* Present when one delivery holds several events: the body is a JSON
|
|
225
|
+
* list of them, or holds one at `path`. Absent: the body is one event.
|
|
226
|
+
*/
|
|
227
|
+
batch: z.object({ path: WebhookJsonPath.optional() }).strict().optional(),
|
|
228
|
+
/** The event type: a path or header, or one `value` for every delivery. */
|
|
229
|
+
type: z.union([
|
|
230
|
+
z.object({ path: WebhookJsonPath }).strict(),
|
|
231
|
+
z.object({ header: WebhookHeaderName }).strict(),
|
|
232
|
+
z.object({ value: EventTypeName }).strict(),
|
|
233
|
+
]),
|
|
234
|
+
/** The delivery's id, so a retried delivery is kept once; else the body's hash. */
|
|
235
|
+
deliveryId: WebhookValueSource.optional(),
|
|
236
|
+
/** Each event's own id, so an event delivered twice runs automations once. */
|
|
237
|
+
eventId: WebhookJsonPath.optional(),
|
|
238
|
+
/** When it happened: an ISO time or Unix seconds or milliseconds. */
|
|
239
|
+
occurredAt: WebhookJsonPath.optional(),
|
|
240
|
+
/** A one-line description; the event type when absent. */
|
|
241
|
+
summary: WebhookJsonPath.optional(),
|
|
242
|
+
/** What it is about, such as a device or order name. */
|
|
243
|
+
subject: WebhookJsonPath.optional(),
|
|
244
|
+
/** A link to it in the app. */
|
|
245
|
+
url: WebhookJsonPath.optional(),
|
|
246
|
+
/** Who did it. */
|
|
247
|
+
actor: WebhookJsonPath.optional(),
|
|
248
|
+
})
|
|
249
|
+
.strict(),
|
|
250
|
+
);
|
|
251
|
+
export type WebhookFormat = z.infer<typeof WebhookFormat>;
|
|
252
|
+
export type WebhookFormatInput = z.input<typeof WebhookFormat>;
|
|
253
|
+
|
|
254
|
+
/**
|
|
255
|
+
* Formats for apps whose webhooks are well known, keyed by their `preset`.
|
|
256
|
+
* A custom source made with one is the same as one that spells it out.
|
|
257
|
+
*/
|
|
258
|
+
export const WEBHOOK_FORMAT_PRESETS = {
|
|
259
|
+
/** Tailscale: a JSON list of events, signed `t=…,v1=…` over `<t>.<body>`. */
|
|
260
|
+
tailscale: {
|
|
261
|
+
preset: "tailscale",
|
|
262
|
+
signature: { scheme: "timestamped_hmac_sha256", header: "Tailscale-Webhook-Signature" },
|
|
263
|
+
batch: {},
|
|
264
|
+
type: { path: "type" },
|
|
265
|
+
occurredAt: "timestamp",
|
|
266
|
+
summary: "message",
|
|
267
|
+
subject: "data.deviceName",
|
|
268
|
+
url: "data.url",
|
|
269
|
+
actor: "data.actor",
|
|
270
|
+
},
|
|
271
|
+
} as const satisfies Record<string, WebhookFormatInput>;
|
|
272
|
+
export type WebhookFormatPreset = keyof typeof WEBHOOK_FORMAT_PRESETS;
|
|
273
|
+
|
|
274
|
+
export const EventSourceMcpBinding = /* @__PURE__ */ defineSchema(() =>
|
|
275
|
+
z
|
|
276
|
+
.object({
|
|
277
|
+
/** The MCP server id as configured for the workspace. */
|
|
278
|
+
serverId: z.string().min(1).max(256),
|
|
279
|
+
/** The owner's connection used for every events/* request. */
|
|
280
|
+
connectionId: Uuid.nullable(),
|
|
281
|
+
})
|
|
282
|
+
.strict(),
|
|
283
|
+
);
|
|
284
|
+
export type EventSourceMcpBinding = z.infer<typeof EventSourceMcpBinding>;
|
|
285
|
+
|
|
286
|
+
export const EventSource = /* @__PURE__ */ defineSchema(() =>
|
|
287
|
+
z.object({
|
|
288
|
+
id: Uuid,
|
|
289
|
+
workspaceId: Uuid,
|
|
290
|
+
kind: EventSourceKind,
|
|
291
|
+
/** Webhook sources only. */
|
|
292
|
+
adapter: WebhookEventAdapter.nullable(),
|
|
293
|
+
/** How a `custom` webhook source reads its app's deliveries; null otherwise. */
|
|
294
|
+
format: WebhookFormat.nullable().default(null),
|
|
295
|
+
name: z.string(),
|
|
296
|
+
/** The person the source belongs to; null for workspace app sources. */
|
|
297
|
+
ownerSubjectId: z.string().nullable(),
|
|
298
|
+
visibility: EventSourceVisibility,
|
|
299
|
+
status: EventSourceStatus,
|
|
300
|
+
/** Why the source is blocked or disabled, in plain language. */
|
|
301
|
+
statusReason: z.string().nullable(),
|
|
302
|
+
/**
|
|
303
|
+
* The same reason as a code (`EVENT_STATUS_REASON_CODES`) a client words
|
|
304
|
+
* in its own language; null when active or from an older server.
|
|
305
|
+
*/
|
|
306
|
+
statusReasonCode: z.string().nullable().default(null),
|
|
307
|
+
/** What the app or server said about it, verbatim, when it said something. */
|
|
308
|
+
statusReasonDetail: z.string().nullable().default(null),
|
|
309
|
+
/** The URL to paste into the sending app. Webhook sources only. */
|
|
310
|
+
webhookUrl: z.string().nullable(),
|
|
311
|
+
/**
|
|
312
|
+
* A Linear, Sentry or custom webhook whose secret is not pasted yet: it
|
|
313
|
+
* refuses deliveries until the secret is set with an update.
|
|
314
|
+
*/
|
|
315
|
+
awaitingSigningSecret: z.boolean().default(false),
|
|
316
|
+
/** MCP sources only. */
|
|
317
|
+
mcp: EventSourceMcpBinding.nullable(),
|
|
318
|
+
lastDeliveryAt: Timestamp.nullable(),
|
|
319
|
+
createdAt: Timestamp,
|
|
320
|
+
updatedAt: Timestamp,
|
|
321
|
+
/**
|
|
322
|
+
* What the reading person can do with the source: `manage` (its owner or
|
|
323
|
+
* a workspace admin: edit, rotate, test, replay, delete) or `use` (point
|
|
324
|
+
* triggers at it and read its log). Set on REST reads.
|
|
325
|
+
*/
|
|
326
|
+
viewerAccess: z.enum(["manage", "use"]).optional(),
|
|
327
|
+
}),
|
|
328
|
+
);
|
|
329
|
+
export type EventSource = z.infer<typeof EventSource>;
|
|
330
|
+
|
|
331
|
+
/**
|
|
332
|
+
* Linear and Sentry generate the secret once they have the webhook URL, so it
|
|
333
|
+
* is pasted on create or afterwards; a custom webhook takes the secret its app
|
|
334
|
+
* shows or the one a person chose there. Standard sources get one from
|
|
335
|
+
* Opengeni.
|
|
336
|
+
*/
|
|
337
|
+
export const EventSourceSigningSecretInput = /* @__PURE__ */ defineSchema(() =>
|
|
338
|
+
z.string().min(8).max(512),
|
|
339
|
+
);
|
|
340
|
+
|
|
341
|
+
export const CreateEventSourceRequest = /* @__PURE__ */ defineSchema(() =>
|
|
342
|
+
z
|
|
343
|
+
.discriminatedUnion("kind", [
|
|
344
|
+
z
|
|
345
|
+
.object({
|
|
346
|
+
kind: z.literal("webhook"),
|
|
347
|
+
adapter: WebhookEventAdapter,
|
|
348
|
+
name: EventSourceName,
|
|
349
|
+
visibility: EventSourceVisibility.default("private"),
|
|
350
|
+
signingSecret: EventSourceSigningSecretInput.optional(),
|
|
351
|
+
/** Required for, and only for, the `custom` adapter. */
|
|
352
|
+
format: WebhookFormat.optional(),
|
|
353
|
+
})
|
|
354
|
+
.strict(),
|
|
355
|
+
z
|
|
356
|
+
.object({
|
|
357
|
+
kind: z.enum(["github", "slack"]),
|
|
358
|
+
name: EventSourceName.optional(),
|
|
359
|
+
})
|
|
360
|
+
.strict(),
|
|
361
|
+
z
|
|
362
|
+
.object({
|
|
363
|
+
kind: z.literal("gmail"),
|
|
364
|
+
/** The mailbox connection; defaults to the caller's only Gmail connection. */
|
|
365
|
+
connectionId: Uuid.optional(),
|
|
366
|
+
name: EventSourceName.optional(),
|
|
367
|
+
})
|
|
368
|
+
.strict(),
|
|
369
|
+
z
|
|
370
|
+
.object({
|
|
371
|
+
kind: z.literal("mcp"),
|
|
372
|
+
serverId: z.string().min(1).max(256),
|
|
373
|
+
connectionId: Uuid.optional(),
|
|
374
|
+
name: EventSourceName.optional(),
|
|
375
|
+
})
|
|
376
|
+
.strict(),
|
|
377
|
+
z
|
|
378
|
+
.object({
|
|
379
|
+
/**
|
|
380
|
+
* The caller's own "This workspace" source. There is one per person,
|
|
381
|
+
* so creating it again returns the existing one.
|
|
382
|
+
*/
|
|
383
|
+
kind: z.literal("workspace"),
|
|
384
|
+
name: EventSourceName.optional(),
|
|
385
|
+
})
|
|
386
|
+
.strict(),
|
|
387
|
+
])
|
|
388
|
+
.superRefine((value, context) => {
|
|
389
|
+
if (
|
|
390
|
+
value.kind === "webhook" &&
|
|
391
|
+
value.adapter === "standard" &&
|
|
392
|
+
value.signingSecret !== undefined
|
|
393
|
+
) {
|
|
394
|
+
context.addIssue({
|
|
395
|
+
code: "custom",
|
|
396
|
+
path: ["signingSecret"],
|
|
397
|
+
message: "Opengeni generates the signing secret for standard webhooks",
|
|
398
|
+
});
|
|
399
|
+
}
|
|
400
|
+
if (
|
|
401
|
+
value.kind === "webhook" &&
|
|
402
|
+
(value.adapter === "custom") !== (value.format !== undefined)
|
|
403
|
+
) {
|
|
404
|
+
context.addIssue({
|
|
405
|
+
code: "custom",
|
|
406
|
+
path: ["format"],
|
|
407
|
+
message:
|
|
408
|
+
value.adapter === "custom"
|
|
409
|
+
? "A custom webhook needs a format"
|
|
410
|
+
: "Only a custom webhook takes a format",
|
|
411
|
+
});
|
|
412
|
+
}
|
|
413
|
+
}),
|
|
414
|
+
);
|
|
415
|
+
/** What a caller sends; a webhook source's `visibility` defaults to `private`. */
|
|
416
|
+
export type CreateEventSourceRequest = z.input<typeof CreateEventSourceRequest>;
|
|
417
|
+
export type ParsedCreateEventSourceRequest = z.output<typeof CreateEventSourceRequest>;
|
|
418
|
+
|
|
419
|
+
export const CreateEventSourceResponse = /* @__PURE__ */ defineSchema(() =>
|
|
420
|
+
z
|
|
421
|
+
.object({
|
|
422
|
+
source: EventSource,
|
|
423
|
+
/** Standard webhook sources only; shown once. */
|
|
424
|
+
signingSecret: z.string().optional(),
|
|
425
|
+
})
|
|
426
|
+
.strict(),
|
|
427
|
+
);
|
|
428
|
+
export type CreateEventSourceResponse = z.infer<typeof CreateEventSourceResponse>;
|
|
429
|
+
|
|
430
|
+
export const UpdateEventSourceRequest = /* @__PURE__ */ defineSchema(() =>
|
|
431
|
+
z
|
|
432
|
+
.object({
|
|
433
|
+
name: EventSourceName.optional(),
|
|
434
|
+
visibility: EventSourceVisibility.optional(),
|
|
435
|
+
status: z.enum(["active", "disabled"]).optional(),
|
|
436
|
+
/** Replace a pasted Linear, Sentry or custom webhook secret. */
|
|
437
|
+
signingSecret: EventSourceSigningSecretInput.optional(),
|
|
438
|
+
/** Replace a custom webhook's format. */
|
|
439
|
+
format: WebhookFormat.optional(),
|
|
440
|
+
})
|
|
441
|
+
.strict()
|
|
442
|
+
.refine((value) => Object.keys(value).length > 0, "Supply at least one field"),
|
|
443
|
+
);
|
|
444
|
+
export type UpdateEventSourceRequest = z.infer<typeof UpdateEventSourceRequest>;
|
|
445
|
+
|
|
446
|
+
export const RotateEventSourceSecretResponse = /* @__PURE__ */ defineSchema(() =>
|
|
447
|
+
z.object({ signingSecret: z.string() }).strict(),
|
|
448
|
+
);
|
|
449
|
+
export type RotateEventSourceSecretResponse = z.infer<typeof RotateEventSourceSecretResponse>;
|
|
450
|
+
|
|
451
|
+
export const ListEventSourcesResponse = /* @__PURE__ */ defineSchema(() =>
|
|
452
|
+
z.object({ sources: z.array(EventSource) }).strict(),
|
|
453
|
+
);
|
|
454
|
+
export type ListEventSourcesResponse = z.infer<typeof ListEventSourcesResponse>;
|
|
455
|
+
|
|
456
|
+
/**
|
|
457
|
+
* Sources that need no setting up, named by a key until they are used: an
|
|
458
|
+
* MCP server the person is signed in to that offers events
|
|
459
|
+
* (`mcp-server:<serverId>`), a Gmail account they connected
|
|
460
|
+
* (`gmail:<connectionId>`), and "This workspace" (`workspace`). A trigger may
|
|
461
|
+
* name one by its key: the person's own source is added the first time it is
|
|
462
|
+
* used, and using the key again finds that same source.
|
|
463
|
+
*/
|
|
464
|
+
export const READY_EVENT_SOURCE_KINDS = ["mcp", "gmail", "workspace"] as const;
|
|
465
|
+
export type ReadyEventSourceKind = (typeof READY_EVENT_SOURCE_KINDS)[number];
|
|
466
|
+
|
|
467
|
+
/** What adds a ready source: the matching create request. */
|
|
468
|
+
export type ReadyEventSourceRequest =
|
|
469
|
+
| { kind: "mcp"; serverId: string }
|
|
470
|
+
| { kind: "gmail"; connectionId: string }
|
|
471
|
+
| { kind: "workspace" };
|
|
472
|
+
|
|
473
|
+
const MCP_SERVER_KEY_PREFIX = "mcp-server:";
|
|
474
|
+
const GMAIL_KEY_PREFIX = "gmail:";
|
|
475
|
+
const WORKSPACE_KEY = "workspace";
|
|
476
|
+
const UUID_PATTERN = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/iu;
|
|
477
|
+
const SERVER_ID_MAX_LENGTH = 256;
|
|
478
|
+
|
|
479
|
+
export function readyEventSourceKey(request: ReadyEventSourceRequest): string {
|
|
480
|
+
if (request.kind === "mcp") return `${MCP_SERVER_KEY_PREFIX}${request.serverId}`;
|
|
481
|
+
if (request.kind === "gmail") return `${GMAIL_KEY_PREFIX}${request.connectionId}`;
|
|
482
|
+
return WORKSPACE_KEY;
|
|
483
|
+
}
|
|
484
|
+
|
|
485
|
+
/** The source a key names, or null when it is not a ready source's key. */
|
|
486
|
+
export function readyEventSourceRequest(key: string): ReadyEventSourceRequest | null {
|
|
487
|
+
if (key === WORKSPACE_KEY) return { kind: "workspace" };
|
|
488
|
+
if (key.startsWith(MCP_SERVER_KEY_PREFIX)) {
|
|
489
|
+
const serverId = key.slice(MCP_SERVER_KEY_PREFIX.length);
|
|
490
|
+
return serverId.length > 0 && serverId.length <= SERVER_ID_MAX_LENGTH
|
|
491
|
+
? { kind: "mcp", serverId }
|
|
492
|
+
: null;
|
|
493
|
+
}
|
|
494
|
+
if (key.startsWith(GMAIL_KEY_PREFIX)) {
|
|
495
|
+
const connectionId = key.slice(GMAIL_KEY_PREFIX.length);
|
|
496
|
+
return UUID_PATTERN.test(connectionId) ? { kind: "gmail", connectionId } : null;
|
|
497
|
+
}
|
|
498
|
+
return null;
|
|
499
|
+
}
|
|
500
|
+
|
|
501
|
+
export const ReadyEventSource = /* @__PURE__ */ defineSchema(() =>
|
|
502
|
+
z
|
|
503
|
+
.object({
|
|
504
|
+
/** Use it wherever a trigger names a source; see `readyEventSourceRequest`. */
|
|
505
|
+
key: z.string(),
|
|
506
|
+
kind: z.enum(READY_EVENT_SOURCE_KINDS),
|
|
507
|
+
name: z.string(),
|
|
508
|
+
})
|
|
509
|
+
.strict(),
|
|
510
|
+
);
|
|
511
|
+
export type ReadyEventSource = z.infer<typeof ReadyEventSource>;
|
|
512
|
+
|
|
513
|
+
export const ListReadyEventSourcesResponse = /* @__PURE__ */ defineSchema(() =>
|
|
514
|
+
z.object({ sources: z.array(ReadyEventSource) }).strict(),
|
|
515
|
+
);
|
|
516
|
+
export type ListReadyEventSourcesResponse = z.infer<typeof ListReadyEventSourcesResponse>;
|
|
517
|
+
|
|
518
|
+
/** A source's id, or a ready source's key. */
|
|
519
|
+
export const EventSourceRef = /* @__PURE__ */ defineSchema(() =>
|
|
520
|
+
z
|
|
521
|
+
.string()
|
|
522
|
+
.min(1)
|
|
523
|
+
.max(MCP_SERVER_KEY_PREFIX.length + SERVER_ID_MAX_LENGTH)
|
|
524
|
+
.refine(
|
|
525
|
+
(ref) => UUID_PATTERN.test(ref) || readyEventSourceRequest(ref) !== null,
|
|
526
|
+
"Use an event source's id or a ready source's key",
|
|
527
|
+
),
|
|
528
|
+
);
|
|
529
|
+
|
|
530
|
+
/** Whether a trigger's source names a ready source by its key rather than an id. */
|
|
531
|
+
export function isReadyEventSourceKey(ref: string): boolean {
|
|
532
|
+
return !UUID_PATTERN.test(ref) && readyEventSourceRequest(ref) !== null;
|
|
533
|
+
}
|
|
534
|
+
|
|
535
|
+
/**
|
|
536
|
+
* Who caused an event. `opengeni` marks Opengeni's own identities (its GitHub
|
|
537
|
+
* App bot, its Slack bot); triggers ignore those events unless they opt in.
|
|
538
|
+
*/
|
|
539
|
+
export const EventActorKind = /* @__PURE__ */ defineSchema(() =>
|
|
540
|
+
z.enum(["person", "bot", "opengeni", "unknown"]),
|
|
541
|
+
);
|
|
542
|
+
export type EventActorKind = z.infer<typeof EventActorKind>;
|
|
543
|
+
|
|
544
|
+
export const EventActor = /* @__PURE__ */ defineSchema(() =>
|
|
545
|
+
z
|
|
546
|
+
.object({
|
|
547
|
+
kind: EventActorKind,
|
|
548
|
+
name: z.string().max(200).nullable(),
|
|
549
|
+
})
|
|
550
|
+
.strict(),
|
|
551
|
+
);
|
|
552
|
+
export type EventActor = z.infer<typeof EventActor>;
|
|
553
|
+
|
|
554
|
+
export const InboundEvent = /* @__PURE__ */ defineSchema(() =>
|
|
555
|
+
z.object({
|
|
556
|
+
id: Uuid,
|
|
557
|
+
sourceId: Uuid,
|
|
558
|
+
sourceKind: EventSourceKind,
|
|
559
|
+
type: z.string(),
|
|
560
|
+
occurredAt: Timestamp,
|
|
561
|
+
receivedAt: Timestamp,
|
|
562
|
+
/** What the event is about, such as `acme/api#42`. */
|
|
563
|
+
subject: z.string().nullable(),
|
|
564
|
+
/** One line a person or agent can read. */
|
|
565
|
+
summary: z.string(),
|
|
566
|
+
/** A link to the thing in its app, when known. */
|
|
567
|
+
url: z.string().nullable(),
|
|
568
|
+
actor: EventActor,
|
|
569
|
+
data: z.record(z.string(), z.unknown()),
|
|
570
|
+
/** The source's data was larger than the stored budget and was cut. */
|
|
571
|
+
dataTruncated: z.boolean(),
|
|
572
|
+
/** Events from this source may have been missed just before this one. */
|
|
573
|
+
gapBefore: z.boolean(),
|
|
574
|
+
}),
|
|
575
|
+
);
|
|
576
|
+
export type InboundEvent = z.infer<typeof InboundEvent>;
|
|
577
|
+
|
|
578
|
+
export const InboundEventSummary = /* @__PURE__ */ defineSchema(() =>
|
|
579
|
+
InboundEvent.pick({
|
|
580
|
+
id: true,
|
|
581
|
+
sourceId: true,
|
|
582
|
+
sourceKind: true,
|
|
583
|
+
type: true,
|
|
584
|
+
occurredAt: true,
|
|
585
|
+
subject: true,
|
|
586
|
+
summary: true,
|
|
587
|
+
url: true,
|
|
588
|
+
actor: true,
|
|
589
|
+
}),
|
|
590
|
+
);
|
|
591
|
+
export type InboundEventSummary = z.infer<typeof InboundEventSummary>;
|
|
592
|
+
|
|
593
|
+
export const ListInboundEventsResponse = /* @__PURE__ */ defineSchema(() =>
|
|
594
|
+
z
|
|
595
|
+
.object({
|
|
596
|
+
events: z.array(InboundEvent),
|
|
597
|
+
nextCursor: z.string().nullable(),
|
|
598
|
+
})
|
|
599
|
+
.strict(),
|
|
600
|
+
);
|
|
601
|
+
export type ListInboundEventsResponse = z.infer<typeof ListInboundEventsResponse>;
|
|
602
|
+
|
|
603
|
+
export const EventDeliveryStatus = /* @__PURE__ */ defineSchema(() =>
|
|
604
|
+
z.enum(["accepted", "ignored", "rejected", "failed"]),
|
|
605
|
+
);
|
|
606
|
+
export type EventDeliveryStatus = z.infer<typeof EventDeliveryStatus>;
|
|
607
|
+
|
|
608
|
+
export const EventDelivery = /* @__PURE__ */ defineSchema(() =>
|
|
609
|
+
z.object({
|
|
610
|
+
id: Uuid,
|
|
611
|
+
sourceId: Uuid,
|
|
612
|
+
receivedAt: Timestamp,
|
|
613
|
+
status: EventDeliveryStatus,
|
|
614
|
+
/** Why a delivery was ignored, rejected or failed, in plain language. */
|
|
615
|
+
reason: z.string().nullable(),
|
|
616
|
+
eventIds: z.array(Uuid),
|
|
617
|
+
/** The types of the events it became, each once, in order. */
|
|
618
|
+
eventTypes: z.array(z.string()),
|
|
619
|
+
bodyBytes: z.number().int().nonnegative(),
|
|
620
|
+
/** The raw body is kept for a few days so a delivery can be replayed. */
|
|
621
|
+
bodyRetained: z.boolean(),
|
|
622
|
+
/** How many times the sender delivered this same delivery again. */
|
|
623
|
+
duplicateCount: z.number().int().nonnegative(),
|
|
624
|
+
replayOfDeliveryId: Uuid.nullable(),
|
|
625
|
+
}),
|
|
626
|
+
);
|
|
627
|
+
export type EventDelivery = z.infer<typeof EventDelivery>;
|
|
628
|
+
|
|
629
|
+
export const ListEventDeliveriesResponse = /* @__PURE__ */ defineSchema(() =>
|
|
630
|
+
z
|
|
631
|
+
.object({
|
|
632
|
+
deliveries: z.array(EventDelivery),
|
|
633
|
+
nextCursor: z.string().nullable(),
|
|
634
|
+
})
|
|
635
|
+
.strict(),
|
|
636
|
+
);
|
|
637
|
+
export type ListEventDeliveriesResponse = z.infer<typeof ListEventDeliveriesResponse>;
|
|
638
|
+
|
|
639
|
+
export const ReplayEventDeliveryResponse = /* @__PURE__ */ defineSchema(() =>
|
|
640
|
+
z.object({ delivery: EventDelivery }).strict(),
|
|
641
|
+
);
|
|
642
|
+
export type ReplayEventDeliveryResponse = z.infer<typeof ReplayEventDeliveryResponse>;
|
|
643
|
+
|
|
644
|
+
export const SendTestEventRequest = /* @__PURE__ */ defineSchema(() =>
|
|
645
|
+
z
|
|
646
|
+
.object({
|
|
647
|
+
type: EventTypeName.default("opengeni.test"),
|
|
648
|
+
data: z.record(z.string(), z.unknown()).default({}),
|
|
649
|
+
})
|
|
650
|
+
.strict(),
|
|
651
|
+
);
|
|
652
|
+
/** What a caller sends; `type` defaults to `opengeni.test` and `data` to `{}`. */
|
|
653
|
+
export type SendTestEventRequest = z.input<typeof SendTestEventRequest>;
|
|
654
|
+
export type ParsedSendTestEventRequest = z.output<typeof SendTestEventRequest>;
|
|
655
|
+
|
|
656
|
+
export const SendTestEventResponse = /* @__PURE__ */ defineSchema(() =>
|
|
657
|
+
z.object({ event: InboundEvent, matchedAutomationIds: z.array(Uuid) }).strict(),
|
|
658
|
+
);
|
|
659
|
+
export type SendTestEventResponse = z.infer<typeof SendTestEventResponse>;
|
|
660
|
+
|
|
661
|
+
/** A field an event condition can read. */
|
|
662
|
+
export const EVENT_CONDITION_FIELD_PATTERN =
|
|
663
|
+
/^(?:type|subject|summary|url|actor\.kind|actor\.name|data(?:\.[A-Za-z0-9_@$-]{1,64}){1,8})$/u;
|
|
664
|
+
|
|
665
|
+
export const EventConditionOperator = /* @__PURE__ */ defineSchema(() =>
|
|
666
|
+
z.enum(["equals", "not_equals", "in", "not_in", "contains", "exists", "not_exists"]),
|
|
667
|
+
);
|
|
668
|
+
export type EventConditionOperator = z.infer<typeof EventConditionOperator>;
|
|
669
|
+
|
|
670
|
+
const EventConditionScalar = /* @__PURE__ */ defineSchema(() =>
|
|
671
|
+
z.union([z.string().max(500), z.number().finite(), z.boolean(), z.null()]),
|
|
672
|
+
);
|
|
673
|
+
|
|
674
|
+
export const EventCondition = /* @__PURE__ */ defineSchema(() =>
|
|
675
|
+
z
|
|
676
|
+
.object({
|
|
677
|
+
/** `type`, `subject`, `summary`, `url`, `actor.kind`, `actor.name`, or `data.<path>`. */
|
|
678
|
+
field: z.string().regex(EVENT_CONDITION_FIELD_PATTERN, "Unsupported event field"),
|
|
679
|
+
op: EventConditionOperator,
|
|
680
|
+
value: z.union([EventConditionScalar, z.array(EventConditionScalar).max(50)]).optional(),
|
|
681
|
+
})
|
|
682
|
+
.strict()
|
|
683
|
+
.superRefine((condition, context) => {
|
|
684
|
+
const presence = condition.op === "exists" || condition.op === "not_exists";
|
|
685
|
+
const list = condition.op === "in" || condition.op === "not_in";
|
|
686
|
+
if (presence && condition.value !== undefined) {
|
|
687
|
+
context.addIssue({
|
|
688
|
+
code: "custom",
|
|
689
|
+
path: ["value"],
|
|
690
|
+
message: `${condition.op} takes no value`,
|
|
691
|
+
});
|
|
692
|
+
}
|
|
693
|
+
if (!presence && condition.value === undefined) {
|
|
694
|
+
context.addIssue({
|
|
695
|
+
code: "custom",
|
|
696
|
+
path: ["value"],
|
|
697
|
+
message: `${condition.op} needs a value`,
|
|
698
|
+
});
|
|
699
|
+
}
|
|
700
|
+
if (list && !Array.isArray(condition.value)) {
|
|
701
|
+
context.addIssue({
|
|
702
|
+
code: "custom",
|
|
703
|
+
path: ["value"],
|
|
704
|
+
message: `${condition.op} needs a list`,
|
|
705
|
+
});
|
|
706
|
+
}
|
|
707
|
+
if (!list && Array.isArray(condition.value)) {
|
|
708
|
+
context.addIssue({
|
|
709
|
+
code: "custom",
|
|
710
|
+
path: ["value"],
|
|
711
|
+
message: `${condition.op} needs one value`,
|
|
712
|
+
});
|
|
713
|
+
}
|
|
714
|
+
}),
|
|
715
|
+
);
|
|
716
|
+
export type EventCondition = z.infer<typeof EventCondition>;
|
|
717
|
+
|
|
718
|
+
export const EventTriggerInput = /* @__PURE__ */ defineSchema(() =>
|
|
719
|
+
z
|
|
720
|
+
.object({
|
|
721
|
+
/** The source's id, or a ready source's key: the owner's source is added on first use. */
|
|
722
|
+
sourceId: EventSourceRef,
|
|
723
|
+
/** Event types that fire the trigger. An MCP trigger names exactly one. */
|
|
724
|
+
eventTypes: z.array(EventTypeName).min(1).max(EVENT_TRIGGER_TYPES_MAX),
|
|
725
|
+
/** All conditions must hold. */
|
|
726
|
+
conditions: z.array(EventCondition).max(EVENT_TRIGGER_CONDITIONS_MAX).default([]),
|
|
727
|
+
/** Also fire on events made by Opengeni's own bots. */
|
|
728
|
+
includeOwnEvents: z.boolean().default(false),
|
|
729
|
+
/** MCP subscription arguments, validated against the event type's inputSchema. */
|
|
730
|
+
arguments: z.record(z.string(), z.unknown()).optional(),
|
|
731
|
+
})
|
|
732
|
+
.strict(),
|
|
733
|
+
);
|
|
734
|
+
export type EventTriggerInput = z.input<typeof EventTriggerInput>;
|
|
735
|
+
export type ParsedEventTriggerInput = z.output<typeof EventTriggerInput>;
|
|
736
|
+
|
|
737
|
+
export const EventTriggerStatus = /* @__PURE__ */ defineSchema(() =>
|
|
738
|
+
z.enum(["active", "blocked", "disabled"]),
|
|
739
|
+
);
|
|
740
|
+
export type EventTriggerStatus = z.infer<typeof EventTriggerStatus>;
|
|
741
|
+
|
|
742
|
+
export const EventTrigger = /* @__PURE__ */ defineSchema(() =>
|
|
743
|
+
z.object({
|
|
744
|
+
id: Uuid,
|
|
745
|
+
sourceId: Uuid,
|
|
746
|
+
sourceKind: EventSourceKind,
|
|
747
|
+
eventTypes: z.array(z.string()),
|
|
748
|
+
conditions: z.array(EventCondition),
|
|
749
|
+
includeOwnEvents: z.boolean(),
|
|
750
|
+
arguments: z.record(z.string(), z.unknown()).nullable(),
|
|
751
|
+
status: EventTriggerStatus,
|
|
752
|
+
statusReason: z.string().nullable(),
|
|
753
|
+
/** The reason as a code a client words itself; see `EVENT_STATUS_REASON_CODES`. */
|
|
754
|
+
statusReasonCode: z.string().nullable().default(null),
|
|
755
|
+
/** What the source's server said about it, verbatim, when it said something. */
|
|
756
|
+
statusReasonDetail: z.string().nullable().default(null),
|
|
757
|
+
createdAt: Timestamp,
|
|
758
|
+
updatedAt: Timestamp,
|
|
759
|
+
}),
|
|
760
|
+
);
|
|
761
|
+
export type EventTrigger = z.infer<typeof EventTrigger>;
|
|
762
|
+
|
|
763
|
+
/**
|
|
764
|
+
* What the automations that continue a chat are waiting for, as the chat list
|
|
765
|
+
* and header show it: the soonest scheduled run and the events that can start
|
|
766
|
+
* a run. Only automations the reader can see contribute; a chat that waits
|
|
767
|
+
* only on someone else's private automation has none.
|
|
768
|
+
*/
|
|
769
|
+
export const SessionAutomationWaitSummary = /* @__PURE__ */ defineSchema(() => {
|
|
770
|
+
const waitEvent = z
|
|
771
|
+
.object({
|
|
772
|
+
source: z.object({ kind: EventSourceKind, name: z.string() }).strict().nullable(),
|
|
773
|
+
eventTypes: z.array(z.string()),
|
|
774
|
+
})
|
|
775
|
+
.strict();
|
|
776
|
+
return z
|
|
777
|
+
.object({
|
|
778
|
+
/** The soonest scheduled run into the chat, or null when none is ahead. */
|
|
779
|
+
nextRunAt: z.string().datetime({ offset: true }).nullable(),
|
|
780
|
+
/**
|
|
781
|
+
* The first active event trigger that can start a run: its event types
|
|
782
|
+
* and its source, null when the reader can't see the source. Null when
|
|
783
|
+
* no event can start a run. `events` names them all.
|
|
784
|
+
*/
|
|
785
|
+
event: waitEvent.nullable(),
|
|
786
|
+
/**
|
|
787
|
+
* Every event that can start a run, one entry per source in the order
|
|
788
|
+
* the automations were made: the event types its active triggers wait
|
|
789
|
+
* for (just `*` when one takes every event). Sources the reader can't
|
|
790
|
+
* see share one entry with a null source. Empty when no event can start
|
|
791
|
+
* a run; absent from servers that only send `event`.
|
|
792
|
+
*/
|
|
793
|
+
events: z.array(waitEvent).optional(),
|
|
794
|
+
/** How many automations can still start a run in the chat, this one included. */
|
|
795
|
+
automations: z.number().int().positive(),
|
|
796
|
+
})
|
|
797
|
+
.strict();
|
|
798
|
+
});
|
|
799
|
+
export type SessionAutomationWaitSummary = z.infer<typeof SessionAutomationWaitSummary>;
|
|
800
|
+
|
|
801
|
+
/** Event triggers and the event run policy of an automation. */
|
|
802
|
+
export const ScheduledTaskEventsInput = /* @__PURE__ */ defineSchema(() =>
|
|
803
|
+
z
|
|
804
|
+
.object({
|
|
805
|
+
triggers: z.array(EventTriggerInput).max(EVENT_TRIGGERS_PER_AUTOMATION_MAX),
|
|
806
|
+
/** Storm guard: at most this many event runs in a rolling hour. */
|
|
807
|
+
maxRunsPerHour: z.number().int().min(1).max(MAX_EVENT_RUNS_PER_HOUR).optional(),
|
|
808
|
+
/** Finish the automation after its first run, whichever trigger fires first. */
|
|
809
|
+
once: z.boolean().optional(),
|
|
810
|
+
})
|
|
811
|
+
.strict(),
|
|
812
|
+
);
|
|
813
|
+
export type ScheduledTaskEventsInput = z.input<typeof ScheduledTaskEventsInput>;
|
|
814
|
+
export type ParsedScheduledTaskEventsInput = z.output<typeof ScheduledTaskEventsInput>;
|
|
815
|
+
|
|
816
|
+
export const ScheduledTaskEvents = /* @__PURE__ */ defineSchema(() =>
|
|
817
|
+
z.object({
|
|
818
|
+
triggers: z.array(EventTrigger),
|
|
819
|
+
maxRunsPerHour: z.number().int(),
|
|
820
|
+
once: z.boolean(),
|
|
821
|
+
/** When a once-automation finished. */
|
|
822
|
+
completedAt: Timestamp.nullable(),
|
|
823
|
+
/** When the storm guard last held events back; null when it is not holding any. */
|
|
824
|
+
throttledSince: Timestamp.nullable(),
|
|
825
|
+
}),
|
|
826
|
+
);
|
|
827
|
+
export type ScheduledTaskEvents = z.infer<typeof ScheduledTaskEvents>;
|
|
828
|
+
|
|
829
|
+
/** The events an event run carried. */
|
|
830
|
+
export const ScheduledTaskRunEventOccurrence = /* @__PURE__ */ defineSchema(() =>
|
|
831
|
+
z.object({
|
|
832
|
+
triggerIds: z.array(Uuid),
|
|
833
|
+
eventCount: z.number().int().nonnegative(),
|
|
834
|
+
events: z.array(InboundEventSummary),
|
|
835
|
+
}),
|
|
836
|
+
);
|
|
837
|
+
export type ScheduledTaskRunEventOccurrence = z.infer<typeof ScheduledTaskRunEventOccurrence>;
|
|
838
|
+
|
|
839
|
+
/** Bytes of a run's chat update spent on its events at most. */
|
|
840
|
+
export const SCHEDULED_OCCURRENCE_EVENTS_MAX_BYTES = 12 * 1024;
|
|
841
|
+
/** Bytes of one carried event's `data` at most; the full event stays fetchable by id. */
|
|
842
|
+
export const SCHEDULED_OCCURRENCE_EVENT_DATA_MAX_BYTES = 2 * 1024;
|
|
843
|
+
|
|
844
|
+
export const ScheduledOccurrenceEvent = /* @__PURE__ */ defineSchema(() =>
|
|
845
|
+
InboundEventSummary.extend({
|
|
846
|
+
data: z.record(z.string(), z.unknown()),
|
|
847
|
+
/** The data was cut to fit; the stored event has more. */
|
|
848
|
+
dataTruncated: z.boolean(),
|
|
849
|
+
}),
|
|
850
|
+
);
|
|
851
|
+
export type ScheduledOccurrenceEvent = z.infer<typeof ScheduledOccurrenceEvent>;
|
|
852
|
+
|
|
853
|
+
/**
|
|
854
|
+
* The events an event run delivers into its chat, bounded to fit the chat
|
|
855
|
+
* update. `events` holds the oldest that fit; `eventCount` counts them all.
|
|
856
|
+
*/
|
|
857
|
+
export const ScheduledOccurrenceEvents = /* @__PURE__ */ defineSchema(() =>
|
|
858
|
+
z.object({
|
|
859
|
+
occurrenceId: Uuid,
|
|
860
|
+
eventCount: z.number().int().nonnegative(),
|
|
861
|
+
events: z.array(ScheduledOccurrenceEvent),
|
|
862
|
+
/** The source may have missed events just before these. */
|
|
863
|
+
gapBefore: z.boolean(),
|
|
864
|
+
}),
|
|
865
|
+
);
|
|
866
|
+
export type ScheduledOccurrenceEvents = z.infer<typeof ScheduledOccurrenceEvents>;
|
|
867
|
+
|
|
868
|
+
/** An event type a source offers, for trigger pickers and agents. */
|
|
869
|
+
export const EventTypeDescriptor = /* @__PURE__ */ defineSchema(() =>
|
|
870
|
+
z.object({
|
|
871
|
+
type: z.string(),
|
|
872
|
+
description: z.string(),
|
|
873
|
+
/** Fields worth matching in conditions, such as `data.repository`. */
|
|
874
|
+
fields: z.array(z.object({ field: z.string(), description: z.string() })),
|
|
875
|
+
/** MCP sources: the subscription arguments the server accepts. */
|
|
876
|
+
argumentsSchema: z.record(z.string(), z.unknown()).nullable(),
|
|
877
|
+
/** False when Opengeni cannot receive this type from this source. */
|
|
878
|
+
available: z.boolean(),
|
|
879
|
+
unavailableReason: z.string().nullable(),
|
|
880
|
+
/** The reason as a code a client words itself; see `EVENT_STATUS_REASON_CODES`. */
|
|
881
|
+
unavailableReasonCode: z.string().nullable().default(null),
|
|
882
|
+
/** What the reason names, such as the GitHub App event to subscribe to. */
|
|
883
|
+
unavailableReasonDetail: z.string().nullable().default(null),
|
|
884
|
+
}),
|
|
885
|
+
);
|
|
886
|
+
export type EventTypeDescriptor = z.infer<typeof EventTypeDescriptor>;
|
|
887
|
+
|
|
888
|
+
export const ListEventTypesResponse = /* @__PURE__ */ defineSchema(() =>
|
|
889
|
+
z.object({ sourceId: Uuid, eventTypes: z.array(EventTypeDescriptor) }).strict(),
|
|
890
|
+
);
|
|
891
|
+
export type ListEventTypesResponse = z.infer<typeof ListEventTypesResponse>;
|