@opengeni/contracts 3.1.0-canary.2 → 3.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/agent-authored-durable-text.d.ts +9 -9
- package/dist/agent-config.d.ts +971 -0
- package/dist/agent-instruction-changes.d.ts +0 -2
- package/dist/allowance-refusal.d.ts +9 -0
- package/dist/allowance-refusal.js +50 -0
- package/dist/allowance-refusal.js.map +1 -0
- package/dist/analytics-consent-report.d.ts +19 -0
- package/dist/analytics-consent-report.js +10 -0
- package/dist/analytics-consent-report.js.map +1 -0
- package/dist/api-key-presets.d.ts +19 -0
- package/dist/artifact-catalog.d.ts +188 -0
- package/dist/artifacts.d.ts +86 -0
- package/dist/atlassian-native-retirement.d.ts +16 -0
- package/dist/atlassian-native-retirement.js +30 -0
- package/dist/atlassian-native-retirement.js.map +1 -0
- package/dist/atlassian.d.ts +1 -0
- package/dist/atlassian.js +34 -19
- package/dist/browser-storage.d.ts +5 -0
- package/dist/browser-storage.js +9 -0
- package/dist/browser-storage.js.map +1 -0
- package/dist/bundled-skills.d.ts +24 -1
- package/dist/canonical-human-identities.js +2 -1
- package/dist/chunk-2ZIHHL72.js +153 -0
- package/dist/chunk-2ZIHHL72.js.map +1 -0
- package/dist/{chunk-5LYFSZ7O.js → chunk-352X6ENP.js} +31 -31
- package/dist/chunk-4JGHSSB7.js +11 -0
- package/dist/chunk-4JGHSSB7.js.map +1 -0
- package/dist/chunk-4QO6GJUX.js +85 -0
- package/dist/chunk-4QO6GJUX.js.map +1 -0
- package/dist/chunk-4VDMHLLL.js +49 -0
- package/dist/chunk-4VDMHLLL.js.map +1 -0
- package/dist/chunk-56SNIMDO.js +9 -0
- package/dist/chunk-56SNIMDO.js.map +1 -0
- package/dist/chunk-6C2HKFTU.js +207 -0
- package/dist/chunk-6C2HKFTU.js.map +1 -0
- package/dist/chunk-6IXO76Z6.js +72 -0
- package/dist/chunk-6IXO76Z6.js.map +1 -0
- package/dist/chunk-7272KVWZ.js +60 -0
- package/dist/chunk-7272KVWZ.js.map +1 -0
- package/dist/{chunk-7ABONTXE.js → chunk-E3GGUBHS.js} +49 -5
- package/dist/chunk-E3GGUBHS.js.map +1 -0
- package/dist/chunk-EFZYKUE2.js +767 -0
- package/dist/chunk-EFZYKUE2.js.map +1 -0
- package/dist/chunk-EKWNTOG3.js +154 -0
- package/dist/chunk-EKWNTOG3.js.map +1 -0
- package/dist/chunk-HABQ7ADB.js +234 -0
- package/dist/chunk-HABQ7ADB.js.map +1 -0
- package/dist/chunk-HRRU4QPI.js +91 -0
- package/dist/chunk-HRRU4QPI.js.map +1 -0
- package/dist/{chunk-3SIZGL3O.js → chunk-IK36LXKC.js} +18 -2
- package/dist/chunk-IK36LXKC.js.map +1 -0
- package/dist/{chunk-TXTQIYCV.js → chunk-ILJ72KPO.js} +56 -3
- package/dist/chunk-ILJ72KPO.js.map +1 -0
- package/dist/chunk-J4HQ3UKY.js +93 -0
- package/dist/chunk-J4HQ3UKY.js.map +1 -0
- package/dist/chunk-KHHZTBP7.js +11 -0
- package/dist/chunk-KHHZTBP7.js.map +1 -0
- package/dist/{chunk-WYBDERIY.js → chunk-LZ2LAHIX.js} +47 -41
- package/dist/chunk-LZ2LAHIX.js.map +1 -0
- package/dist/chunk-NDZHPTCL.js +400 -0
- package/dist/chunk-NDZHPTCL.js.map +1 -0
- package/dist/chunk-OF6OKOBF.js +54793 -0
- package/dist/chunk-OF6OKOBF.js.map +1 -0
- package/dist/chunk-OL23ARTF.js +94 -0
- package/dist/chunk-OL23ARTF.js.map +1 -0
- package/dist/chunk-PUIUXIOL.js +189 -0
- package/dist/chunk-PUIUXIOL.js.map +1 -0
- package/dist/{chunk-Y3KNXVTD.js → chunk-RMWXDZEO.js} +128 -21
- package/dist/chunk-RMWXDZEO.js.map +1 -0
- package/dist/{chunk-MRWYRAS5.js → chunk-SHO4YO4B.js} +27 -35
- package/dist/chunk-SHO4YO4B.js.map +1 -0
- package/dist/chunk-SWRN2DJ3.js +153 -0
- package/dist/chunk-SWRN2DJ3.js.map +1 -0
- package/dist/chunk-TCXCRBPF.js +267 -0
- package/dist/chunk-TCXCRBPF.js.map +1 -0
- package/dist/chunk-TLU3UEMD.js +324 -0
- package/dist/chunk-TLU3UEMD.js.map +1 -0
- package/dist/chunk-TSWWZMUS.js +186 -0
- package/dist/chunk-TSWWZMUS.js.map +1 -0
- package/dist/{chunk-PX3VCKAU.js → chunk-WVCFSOUZ.js} +1 -1
- package/dist/{chunk-PX3VCKAU.js.map → chunk-WVCFSOUZ.js.map} +1 -1
- package/dist/chunk-XDLAGX66.js +127 -0
- package/dist/chunk-XDLAGX66.js.map +1 -0
- package/dist/chunk-YKZ4WU4P.js +33 -0
- package/dist/chunk-YKZ4WU4P.js.map +1 -0
- package/dist/{chunk-O5LEQHDM.js → chunk-Z7WEVGCL.js} +3 -3
- package/dist/{chunk-YBW5JSA3.js → chunk-ZDCRWCGZ.js} +119 -101
- package/dist/chunk-ZDCRWCGZ.js.map +1 -0
- package/dist/claude-provider-account-authority.d.ts +18 -0
- package/dist/claude-subscription-oauth.d.ts +42 -0
- package/dist/claude-subscription-usage.d.ts +159 -0
- package/dist/client-error-report.d.ts +158 -0
- package/dist/client-error-report.js +164 -0
- package/dist/client-error-report.js.map +1 -0
- package/dist/code-search.d.ts +52 -0
- package/dist/code-search.js +40 -0
- package/dist/code-search.js.map +1 -0
- package/dist/codex-provider-account-authority.js +20 -12
- package/dist/codex-provider-account-authority.js.map +1 -1
- package/dist/company-profile.d.ts +144 -6
- package/dist/connect.d.ts +37 -0
- package/dist/connect.js +216 -159
- package/dist/connect.js.map +1 -1
- package/dist/connection-account-label.d.ts +2 -0
- package/dist/connection-account-label.js +35 -0
- package/dist/connection-account-label.js.map +1 -0
- package/dist/connection-authority.d.ts +9 -317
- package/dist/connection-authority.js +37 -42
- package/dist/connector-attachments.js +2 -1
- package/dist/connector-destinations.js +2 -1
- package/dist/connector-tool-permissions.d.ts +137 -0
- package/dist/cua-desktop-tools.d.ts +17 -0
- package/dist/define-schema.d.ts +8 -0
- package/dist/direct-model-provider.d.ts +36 -0
- package/dist/editable-artifact-codec-registry.js +5 -5
- package/dist/editable-artifact-committed-transaction.js +3 -2
- package/dist/editable-artifact-live.js +5 -5
- package/dist/editable-artifact-serialized-commit.js +6 -6
- package/dist/editable-artifact-versions.d.ts +7 -1
- package/dist/editable-artifact-versions.js +1 -1
- package/dist/editable-artifacts.js +62 -56
- package/dist/event-preview.d.ts +22 -0
- package/dist/external-identities.d.ts +138 -0
- package/dist/external-identities.js +9 -4
- package/dist/first-party-tool-authorization.d.ts +815 -0
- package/dist/github-repository-contracts.js +60 -43
- package/dist/github-repository-contracts.js.map +1 -1
- package/dist/google-drive.d.ts +2 -1
- package/dist/google-drive.js +305 -238
- package/dist/google-drive.js.map +1 -1
- package/dist/host-mcp-bindings.d.ts +5 -0
- package/dist/host-mcp-bindings.js +233 -170
- package/dist/host-mcp-bindings.js.map +1 -1
- package/dist/image-generation.d.ts +1 -0
- package/dist/index.d.ts +16761 -5946
- package/dist/index.js +1973 -260
- package/dist/insights-usage.d.ts +877 -0
- package/dist/insights-usage.js +559 -0
- package/dist/insights-usage.js.map +1 -0
- package/dist/interaction.d.ts +1176 -829
- package/dist/knowledge-entries.d.ts +81 -2
- package/dist/knowledge-preparation.d.ts +239 -0
- package/dist/managed-auth-session-sets.d.ts +7 -0
- package/dist/managed-auth-session-sets.js +198 -132
- package/dist/managed-auth-session-sets.js.map +1 -1
- package/dist/managed-sign-in-methods.d.ts +56 -0
- package/dist/managed-sign-in-methods.js +64 -0
- package/dist/managed-sign-in-methods.js.map +1 -0
- package/dist/mcp-catalog-limits.d.ts +2 -0
- package/dist/mcp-oauth.d.ts +2 -2
- package/dist/mcp-structured-content.d.ts +25 -0
- package/dist/modal-native-proof-v2.d.ts +587 -0
- package/dist/modal-native-proof-v2.js +38 -0
- package/dist/modal-native-proof-v2.js.map +1 -0
- package/dist/model-account-choice.d.ts +235 -0
- package/dist/model-account-settings.d.ts +422 -0
- package/dist/model-availability.d.ts +15 -0
- package/dist/model-connection-access.d.ts +13 -0
- package/dist/model-context-inspector.d.ts +98 -0
- package/dist/model-display.d.ts +43 -0
- package/dist/model-display.js +17 -0
- package/dist/model-display.js.map +1 -0
- package/dist/model-picker-order.d.ts +3 -1
- package/dist/model-picker-order.js +3 -0
- package/dist/model-picker-order.js.map +1 -1
- package/dist/organization-access.d.ts +412 -0
- package/dist/organization-access.js +39 -0
- package/dist/organization-access.js.map +1 -0
- package/dist/organization-integration-policy.d.ts +27 -0
- package/dist/organization-membership-lifecycle.d.ts +38 -0
- package/dist/organization-model-usage.d.ts +146 -0
- package/dist/organization-model-usage.js +78 -0
- package/dist/organization-model-usage.js.map +1 -0
- package/dist/organization-recovery.js +2 -1
- package/dist/organization-usage.d.ts +138 -0
- package/dist/permissions.d.ts +18 -0
- package/dist/personal-github.d.ts +1 -0
- package/dist/personal-github.js +199 -144
- package/dist/personal-github.js.map +1 -1
- package/dist/prepared-mcp-setup.d.ts +54 -0
- package/dist/prepared-mcp-setup.js +12 -0
- package/dist/prepared-mcp-setup.js.map +1 -0
- package/dist/product-analytics.d.ts +116 -0
- package/dist/product-lifecycle-facts.d.ts +73 -0
- package/dist/remember.d.ts +98 -6
- package/dist/retained-output.d.ts +8 -0
- package/dist/sandbox-file-artifacts.d.ts +1 -0
- package/dist/sandbox-provider-command.d.ts +91 -1
- package/dist/sandbox-recovery.d.ts +146 -0
- package/dist/secret-generator.d.ts +44 -0
- package/dist/secret-references.d.ts +90 -0
- package/dist/secret-resolution.d.ts +111 -0
- package/dist/secret-totp.d.ts +41 -0
- package/dist/session-final-reply.d.ts +6 -0
- package/dist/session-final-reply.js +9 -0
- package/dist/session-final-reply.js.map +1 -0
- package/dist/session-goal-reports.d.ts +21 -0
- package/dist/session-history-import.d.ts +1272 -0
- package/dist/session-list-entries.d.ts +4 -0
- package/dist/session-list-entries.js +56 -0
- package/dist/session-list-entries.js.map +1 -0
- package/dist/session-mcp-projections.d.ts +6 -0
- package/dist/session-mcp-tool-permissions.d.ts +62 -0
- package/dist/session-message-search.d.ts +68 -0
- package/dist/session-target.d.ts +18 -0
- package/dist/session-titles.d.ts +8 -0
- package/dist/session-titles.js +5 -1
- package/dist/session-usage-limit-refusal.d.ts +34 -0
- package/dist/session-usage-limit-refusal.js +15 -0
- package/dist/session-usage-limit-refusal.js.map +1 -0
- package/dist/session-usage-limits.d.ts +127 -0
- package/dist/session-usage-limits.js +41 -0
- package/dist/session-usage-limits.js.map +1 -0
- package/dist/signup-attribution.d.ts +39 -0
- package/dist/site-data.d.ts +286 -0
- package/dist/site-operations.d.ts +39 -0
- package/dist/site-publishing.d.ts +778 -0
- package/dist/site-session-http.d.ts +89 -4
- package/dist/site-session-http.js +25 -1
- package/dist/site-sql.d.ts +421 -0
- package/dist/skill-catalog-context.d.ts +7 -0
- package/dist/skill-files.d.ts +1 -1
- package/dist/skill-use.d.ts +61 -0
- package/dist/skills.d.ts +15 -0
- package/dist/slack-bot-scopes.d.ts +17 -12
- package/dist/slack-bot-scopes.js +10 -3
- package/dist/slack-rest-mcp.d.ts +36 -0
- package/dist/slack-rest-mcp.js +25 -0
- package/dist/slack-rest-mcp.js.map +1 -0
- package/dist/spreadsheet-artifact-commands.d.ts +14 -1
- package/dist/spreadsheet-artifact-commands.js +8 -2
- package/dist/spreadsheet-artifact-query.d.ts +13 -6
- package/dist/spreadsheet-artifact-query.js +3 -3
- package/dist/subscription-account-actions.d.ts +64 -0
- package/dist/subscription-account-pools.d.ts +292 -0
- package/dist/subscription-personal-authority-v2.d.ts +28 -0
- package/dist/subscription-personal-authority-v2.js +12 -0
- package/dist/subscription-personal-authority-v2.js.map +1 -0
- package/dist/tool-action-review.d.ts +132 -0
- package/dist/tool-catalog.d.ts +408 -0
- package/dist/tool-policy.d.ts +5 -0
- package/dist/tool-review-presentation.d.ts +12 -0
- package/dist/tool-review-presentation.js +17 -0
- package/dist/tool-review-presentation.js.map +1 -0
- package/dist/transcription-recordings.d.ts +21 -0
- package/dist/turn-serving-policy.d.ts +221 -0
- package/dist/usage-allowances.d.ts +314 -0
- package/dist/usage-allowances.js +52 -0
- package/dist/usage-allowances.js.map +1 -0
- package/dist/vaults.d.ts +1286 -0
- package/dist/video-generation.d.ts +3 -0
- package/dist/video-generation.js +2 -1
- package/dist/workspace-integration-wire.d.ts +36 -0
- package/dist/workspace-integration-wire.js +23 -0
- package/dist/workspace-integration-wire.js.map +1 -0
- package/dist/workspace-integrations.d.ts +1028 -0
- package/dist/xai-provider-account-authority.js +2 -1
- package/package.json +93 -5
- package/src/agent-authored-durable-text.ts +14 -11
- package/src/agent-config.ts +1698 -0
- package/src/agent-instruction-changes.ts +91 -74
- package/src/agent-learning.ts +94 -67
- package/src/agent-topology.ts +57 -52
- package/src/allowance-refusal.ts +81 -0
- package/src/analytics-consent-report.ts +20 -0
- package/src/api-key-presets.ts +28 -0
- package/src/artifact-catalog.ts +82 -0
- package/src/artifacts.ts +299 -227
- package/src/atlassian-native-retirement.ts +33 -0
- package/src/atlassian.ts +135 -108
- package/src/browser-storage.ts +10 -0
- package/src/bundled-skills.ts +60 -17
- package/src/canonical-human-identities.ts +60 -58
- package/src/claude-provider-account-authority.ts +12 -0
- package/src/claude-subscription-oauth.ts +73 -0
- package/src/claude-subscription-usage.ts +68 -0
- package/src/client-error-report.ts +343 -0
- package/src/code-search.ts +105 -0
- package/src/codex-provider-account-authority.ts +21 -16
- package/src/company-brain-governed-writes.ts +255 -233
- package/src/company-brain.ts +164 -153
- package/src/company-profile.ts +365 -292
- package/src/connect.ts +212 -173
- package/src/connection-account-label.ts +46 -0
- package/src/connection-authority.ts +183 -364
- package/src/connector-attachments.ts +137 -122
- package/src/connector-destinations.ts +46 -42
- package/src/connector-tool-permissions.ts +117 -0
- package/src/cua-desktop-tools.gen.json +6512 -0
- package/src/cua-desktop-tools.linux.gen.json +6600 -0
- package/src/cua-desktop-tools.ts +36 -0
- package/src/cua-desktop-tools.windows.gen.json +6353 -0
- package/src/define-schema.ts +10 -0
- package/src/direct-model-provider.ts +108 -0
- package/src/editable-artifact-committed-transaction.ts +17 -0
- package/src/editable-artifact-versions.ts +7 -1
- package/src/event-preview.ts +53 -3
- package/src/external-identities.ts +249 -176
- package/src/feedback.ts +43 -30
- package/src/first-party-tool-authorization.ts +356 -0
- package/src/github-repository-contracts.ts +78 -64
- package/src/google-drive.ts +285 -234
- package/src/governed-learning-activation.ts +152 -131
- package/src/governed-learning-evaluator.ts +140 -133
- package/src/host-mcp-bindings.ts +252 -198
- package/src/image-generation.ts +104 -95
- package/src/index.ts +13235 -8687
- package/src/insights-usage.ts +727 -0
- package/src/interaction.ts +3070 -2326
- package/src/knowledge-entries.ts +361 -276
- package/src/knowledge-preparation.ts +57 -0
- package/src/knowledge.ts +246 -213
- package/src/managed-auth-session-sets.ts +220 -144
- package/src/managed-sign-in-methods.ts +52 -0
- package/src/mcp-catalog-limits.ts +2 -0
- package/src/mcp-oauth.ts +43 -34
- package/src/mcp-receipts.ts +192 -192
- package/src/mcp-structured-content.ts +81 -0
- package/src/memory-slack-delivery.ts +171 -142
- package/src/modal-native-proof-v2.ts +429 -0
- package/src/model-account-choice.ts +177 -0
- package/src/model-account-settings.ts +210 -0
- package/src/model-availability.ts +22 -0
- package/src/model-connection-access.ts +61 -14
- package/src/model-context-inspector.ts +133 -99
- package/src/model-display.ts +221 -0
- package/src/model-picker-order.ts +12 -1
- package/src/organization-access.ts +217 -0
- package/src/organization-integration-policy.ts +63 -0
- package/src/organization-membership-lifecycle.ts +528 -382
- package/src/organization-model-usage.ts +81 -0
- package/src/organization-recovery.ts +147 -135
- package/src/organization-usage.ts +94 -0
- package/src/permissions.ts +88 -52
- package/src/personal-github.ts +210 -171
- package/src/preference-registry.ts +314 -258
- package/src/prepared-mcp-setup.ts +189 -0
- package/src/product-analytics.ts +261 -0
- package/src/product-lifecycle-facts.ts +122 -0
- package/src/remember.ts +181 -167
- package/src/retained-output.ts +194 -165
- package/src/sandbox-file-artifacts.ts +60 -47
- package/src/sandbox-provider-command.ts +88 -20
- package/src/sandbox-recovery.ts +129 -0
- package/src/scoped-knowledge.ts +61 -43
- package/src/secret-generator.ts +155 -0
- package/src/secret-references.ts +414 -0
- package/src/secret-resolution.ts +274 -0
- package/src/secret-totp.ts +188 -0
- package/src/session-final-reply.ts +16 -0
- package/src/session-goal-reports.ts +64 -0
- package/src/session-history-import.ts +177 -0
- package/src/session-list-entries.ts +96 -0
- package/src/session-mcp-projections.ts +11 -0
- package/src/session-mcp-tool-permissions.ts +108 -0
- package/src/session-message-search.ts +61 -0
- package/src/session-target.ts +57 -0
- package/src/session-titles.ts +80 -10
- package/src/session-topology-primitives.ts +19 -12
- package/src/session-usage-limit-refusal.ts +101 -0
- package/src/session-usage-limits.ts +171 -0
- package/src/signup-attribution.ts +86 -0
- package/src/site-data.ts +339 -0
- package/src/site-operations.ts +154 -0
- package/src/site-publishing.ts +876 -0
- package/src/site-session-http.ts +294 -16
- package/src/site-sql.ts +1123 -0
- package/src/skill-catalog-context.ts +50 -0
- package/src/skill-files.ts +3 -3
- package/src/skill-use.ts +80 -0
- package/src/skills.ts +82 -54
- package/src/slack-bot-scopes.ts +31 -39
- package/src/slack-rest-mcp.ts +222 -0
- package/src/slack-task-policy.ts +96 -73
- package/src/spreadsheet-artifact-commands.ts +73 -2
- package/src/spreadsheet-artifact-query.ts +187 -39
- package/src/subscription-account-actions.ts +84 -0
- package/src/subscription-account-pools.ts +53 -0
- package/src/subscription-personal-authority-v2.ts +66 -0
- package/src/task-notes.ts +55 -51
- package/src/tool-action-review.ts +258 -0
- package/src/tool-catalog.ts +609 -372
- package/src/tool-policy.ts +82 -0
- package/src/tool-result-spill.ts +12 -9
- package/src/tool-review-presentation.ts +385 -0
- package/src/transcription-recordings.ts +145 -131
- package/src/turn-serving-policy.ts +166 -0
- package/src/usage-allowances.ts +248 -0
- package/src/vaults.ts +850 -0
- package/src/video-generation.ts +385 -360
- package/src/work-claims.ts +173 -149
- package/src/workspace-instruction-policies.ts +349 -276
- package/src/workspace-integration-wire.ts +101 -0
- package/src/workspace-integrations.ts +724 -0
- package/src/workspace-learning-administration.ts +57 -44
- package/src/workspace-learning-policy.ts +127 -96
- package/src/workspace-state.ts +250 -220
- package/src/xai-provider-account-authority.ts +22 -17
- package/dist/chunk-2AC63F4S.js +0 -171
- package/dist/chunk-2AC63F4S.js.map +0 -1
- package/dist/chunk-3SIZGL3O.js.map +0 -1
- package/dist/chunk-7ABONTXE.js.map +0 -1
- package/dist/chunk-BCS7WHCK.js +0 -139
- package/dist/chunk-BCS7WHCK.js.map +0 -1
- package/dist/chunk-GRG7PHWQ.js +0 -25
- package/dist/chunk-GRG7PHWQ.js.map +0 -1
- package/dist/chunk-JUFK3T4Q.js +0 -80
- package/dist/chunk-JUFK3T4Q.js.map +0 -1
- package/dist/chunk-M5ZGRVIQ.js +0 -719
- package/dist/chunk-M5ZGRVIQ.js.map +0 -1
- package/dist/chunk-MRWYRAS5.js.map +0 -1
- package/dist/chunk-OVFORMPW.js +0 -348
- package/dist/chunk-OVFORMPW.js.map +0 -1
- package/dist/chunk-P3HLDT77.js +0 -59
- package/dist/chunk-P3HLDT77.js.map +0 -1
- package/dist/chunk-QQUJ6NPW.js +0 -23093
- package/dist/chunk-QQUJ6NPW.js.map +0 -1
- package/dist/chunk-TXTQIYCV.js.map +0 -1
- package/dist/chunk-WYBDERIY.js.map +0 -1
- package/dist/chunk-Y3KNXVTD.js.map +0 -1
- package/dist/chunk-YBW5JSA3.js.map +0 -1
- package/dist/chunk-YRXAWWCU.js +0 -45
- package/dist/chunk-YRXAWWCU.js.map +0 -1
- package/dist/host-mcp-resolvers.d.ts +0 -32
- package/dist/host-mcp-resolvers.js +0 -34
- package/dist/host-mcp-resolvers.js.map +0 -1
- package/src/host-mcp-resolvers.ts +0 -50
- /package/dist/{chunk-5LYFSZ7O.js.map → chunk-352X6ENP.js.map} +0 -0
- /package/dist/{chunk-O5LEQHDM.js.map → chunk-Z7WEVGCL.js.map} +0 -0
package/src/site-data.ts
ADDED
|
@@ -0,0 +1,339 @@
|
|
|
1
|
+
import { defineSchema } from "./define-schema";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Site Data: persistent JSON collections and files that belong to a
|
|
6
|
+
* published Site. Shared by the HTTP API, first-party agent tools and the SDK.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
export const SiteDataAccessMode = /* @__PURE__ */ defineSchema(() =>
|
|
10
|
+
z
|
|
11
|
+
.enum(["shared", "shared_read", "per_viewer", "append_only"])
|
|
12
|
+
.describe(
|
|
13
|
+
"shared: viewers read and write every record. shared_read: viewers read, only managers write. per_viewer: each viewer reads and writes only their own records. append_only: viewers add records and read only their own.",
|
|
14
|
+
),
|
|
15
|
+
);
|
|
16
|
+
export type SiteDataAccessMode = z.infer<typeof SiteDataAccessMode>;
|
|
17
|
+
|
|
18
|
+
/** What anonymous guests of a public published Site may do in a collection. */
|
|
19
|
+
export const SiteDataGuestAccess = /* @__PURE__ */ defineSchema(() =>
|
|
20
|
+
z
|
|
21
|
+
.enum(["none", "read", "append", "own"])
|
|
22
|
+
.describe(
|
|
23
|
+
"Published Sites only: what anonymous guests may do. none (default): nothing. read: read what viewers read. append: add records and read their own. own: add, read, change and delete their own.",
|
|
24
|
+
),
|
|
25
|
+
);
|
|
26
|
+
export type SiteDataGuestAccess = z.infer<typeof SiteDataGuestAccess>;
|
|
27
|
+
|
|
28
|
+
const CollectionName = z
|
|
29
|
+
.string()
|
|
30
|
+
.regex(/^[A-Za-z][A-Za-z0-9_-]{0,63}$/)
|
|
31
|
+
.describe("Collection name: a letter, then letters, digits, - or _ (up to 64).");
|
|
32
|
+
const FieldPath = z
|
|
33
|
+
.string()
|
|
34
|
+
.min(1)
|
|
35
|
+
.max(300)
|
|
36
|
+
.describe(
|
|
37
|
+
"A data field as a dotted path (up to 4 levels), or a system field: $id, $key, $owner, $createdAt, $updatedAt, $version.",
|
|
38
|
+
);
|
|
39
|
+
const RecordKey = z.string().min(1).max(256).describe("Your own stable record key.");
|
|
40
|
+
const Scalar = z.union([z.string().max(1024), z.number(), z.boolean(), z.null()]);
|
|
41
|
+
const RecordData = z
|
|
42
|
+
.record(z.string(), z.unknown())
|
|
43
|
+
.describe("The record's JSON object (at most 256 KB by default).");
|
|
44
|
+
|
|
45
|
+
export const SiteDataFilter = /* @__PURE__ */ defineSchema(() =>
|
|
46
|
+
z.object({
|
|
47
|
+
field: FieldPath,
|
|
48
|
+
op: z
|
|
49
|
+
.enum(["eq", "ne", "in", "gt", "gte", "lt", "lte", "contains", "exists"])
|
|
50
|
+
.describe(
|
|
51
|
+
"contains matches an array element or a case-insensitive substring; exists takes true or false.",
|
|
52
|
+
),
|
|
53
|
+
value: z
|
|
54
|
+
.union([Scalar, z.array(Scalar).max(100)])
|
|
55
|
+
.optional()
|
|
56
|
+
.describe("The value to compare with; an array for in. $owner accepts me."),
|
|
57
|
+
}),
|
|
58
|
+
);
|
|
59
|
+
export type SiteDataFilter = z.infer<typeof SiteDataFilter>;
|
|
60
|
+
|
|
61
|
+
export const SiteDataSort = /* @__PURE__ */ defineSchema(() =>
|
|
62
|
+
z.object({
|
|
63
|
+
field: FieldPath,
|
|
64
|
+
direction: z.enum(["asc", "desc"]).optional().describe("Defaults to asc."),
|
|
65
|
+
}),
|
|
66
|
+
);
|
|
67
|
+
export type SiteDataSort = z.infer<typeof SiteDataSort>;
|
|
68
|
+
|
|
69
|
+
export const SiteDataQueryRequest = /* @__PURE__ */ defineSchema(() =>
|
|
70
|
+
z.object({
|
|
71
|
+
collection: CollectionName,
|
|
72
|
+
where: z.array(SiteDataFilter).max(20).optional().describe("All filters must match."),
|
|
73
|
+
sort: z
|
|
74
|
+
.array(SiteDataSort)
|
|
75
|
+
.max(2)
|
|
76
|
+
.optional()
|
|
77
|
+
.describe("Up to two sort keys. Defaults to newest first."),
|
|
78
|
+
limit: z.number().int().min(1).max(200).optional().describe("Page size, 50 by default."),
|
|
79
|
+
cursor: z.string().max(4096).nullable().optional().describe("nextCursor from the last page."),
|
|
80
|
+
count: z.boolean().optional().describe("Also return the total number of matches."),
|
|
81
|
+
scope: z
|
|
82
|
+
.enum(["own", "all"])
|
|
83
|
+
.optional()
|
|
84
|
+
.describe("own returns only the caller's records; all returns every readable record."),
|
|
85
|
+
}),
|
|
86
|
+
);
|
|
87
|
+
export type SiteDataQueryRequest = z.infer<typeof SiteDataQueryRequest>;
|
|
88
|
+
|
|
89
|
+
export const SiteDataGetRequest = /* @__PURE__ */ defineSchema(() =>
|
|
90
|
+
z
|
|
91
|
+
.object({
|
|
92
|
+
collection: CollectionName,
|
|
93
|
+
id: z.string().uuid().optional().describe("Record id."),
|
|
94
|
+
key: RecordKey.optional(),
|
|
95
|
+
})
|
|
96
|
+
.refine((value) => (value.id === undefined) !== (value.key === undefined), {
|
|
97
|
+
message: "Give exactly one of id or key",
|
|
98
|
+
}),
|
|
99
|
+
);
|
|
100
|
+
export type SiteDataGetRequest = z.infer<typeof SiteDataGetRequest>;
|
|
101
|
+
|
|
102
|
+
const RecordRef = {
|
|
103
|
+
id: z.string().uuid().optional().describe("Record id; give id or key."),
|
|
104
|
+
key: RecordKey.optional(),
|
|
105
|
+
};
|
|
106
|
+
const ExpectedVersion = z
|
|
107
|
+
.number()
|
|
108
|
+
.int()
|
|
109
|
+
.min(0)
|
|
110
|
+
.optional()
|
|
111
|
+
.describe("Fail with a conflict unless the record has this version (0: must not exist).");
|
|
112
|
+
|
|
113
|
+
export const SiteDataWriteOperation = /* @__PURE__ */ defineSchema(() =>
|
|
114
|
+
z.discriminatedUnion("op", [
|
|
115
|
+
z.object({
|
|
116
|
+
op: z.literal("insert"),
|
|
117
|
+
collection: CollectionName,
|
|
118
|
+
key: RecordKey.optional(),
|
|
119
|
+
data: RecordData,
|
|
120
|
+
}),
|
|
121
|
+
z.object({
|
|
122
|
+
op: z.literal("put").describe("Create or replace the record with this key."),
|
|
123
|
+
collection: CollectionName,
|
|
124
|
+
key: RecordKey,
|
|
125
|
+
data: RecordData,
|
|
126
|
+
expectedVersion: ExpectedVersion,
|
|
127
|
+
}),
|
|
128
|
+
z.object({
|
|
129
|
+
op: z.literal("patch").describe("Shallow-merge data into the record."),
|
|
130
|
+
collection: CollectionName,
|
|
131
|
+
...RecordRef,
|
|
132
|
+
data: RecordData,
|
|
133
|
+
expectedVersion: ExpectedVersion,
|
|
134
|
+
}),
|
|
135
|
+
z.object({
|
|
136
|
+
op: z.literal("delete"),
|
|
137
|
+
collection: CollectionName,
|
|
138
|
+
...RecordRef,
|
|
139
|
+
expectedVersion: ExpectedVersion,
|
|
140
|
+
}),
|
|
141
|
+
z.object({
|
|
142
|
+
op: z.literal("increment").describe("Atomically add to a numeric field."),
|
|
143
|
+
collection: CollectionName,
|
|
144
|
+
...RecordRef,
|
|
145
|
+
field: FieldPath,
|
|
146
|
+
by: z.number().optional().describe("Amount to add, 1 by default."),
|
|
147
|
+
}),
|
|
148
|
+
]),
|
|
149
|
+
);
|
|
150
|
+
export type SiteDataWriteOperation = z.infer<typeof SiteDataWriteOperation>;
|
|
151
|
+
|
|
152
|
+
export const SiteDataWriteRequest = /* @__PURE__ */ defineSchema(() =>
|
|
153
|
+
z.object({
|
|
154
|
+
operations: z
|
|
155
|
+
.array(SiteDataWriteOperation)
|
|
156
|
+
.min(1)
|
|
157
|
+
.max(100)
|
|
158
|
+
.describe("Up to 100 operations, applied together or not at all."),
|
|
159
|
+
}),
|
|
160
|
+
);
|
|
161
|
+
export type SiteDataWriteRequest = z.infer<typeof SiteDataWriteRequest>;
|
|
162
|
+
|
|
163
|
+
export const SiteDataCollectionDefinitionRequest = /* @__PURE__ */ defineSchema(() =>
|
|
164
|
+
z.object({
|
|
165
|
+
accessMode: SiteDataAccessMode,
|
|
166
|
+
privateRecords: z
|
|
167
|
+
.boolean()
|
|
168
|
+
.optional()
|
|
169
|
+
.describe("per_viewer only: keep records private even from the Site's managers."),
|
|
170
|
+
guestAccess: SiteDataGuestAccess.optional().describe(
|
|
171
|
+
"Anonymous guests of a public published Site; omitted keeps the current rule (none for a new collection).",
|
|
172
|
+
),
|
|
173
|
+
jsonSchema: z
|
|
174
|
+
.record(z.string(), z.unknown())
|
|
175
|
+
.nullable()
|
|
176
|
+
.optional()
|
|
177
|
+
.describe("Optional JSON Schema every written record must match."),
|
|
178
|
+
indexedFields: z
|
|
179
|
+
.array(z.string().min(1).max(300).describe("Dotted data path."))
|
|
180
|
+
.max(10)
|
|
181
|
+
.optional()
|
|
182
|
+
.describe("Fields to index for faster numeric range filters."),
|
|
183
|
+
uniqueFields: z
|
|
184
|
+
.array(
|
|
185
|
+
z
|
|
186
|
+
.array(z.string().min(1).max(300).describe("Dotted data path."))
|
|
187
|
+
.min(1)
|
|
188
|
+
.max(4)
|
|
189
|
+
.describe("A set of fields whose combined value must be unique."),
|
|
190
|
+
)
|
|
191
|
+
.max(5)
|
|
192
|
+
.optional()
|
|
193
|
+
.describe("Unique field sets. Per-viewer collections enforce them per viewer."),
|
|
194
|
+
}),
|
|
195
|
+
);
|
|
196
|
+
export type SiteDataCollectionDefinitionRequest = z.infer<
|
|
197
|
+
typeof SiteDataCollectionDefinitionRequest
|
|
198
|
+
>;
|
|
199
|
+
|
|
200
|
+
export const SiteDataConfirmRequest = /* @__PURE__ */ defineSchema(() =>
|
|
201
|
+
z.object({ confirm: z.literal(true).describe("Must be true.") }),
|
|
202
|
+
);
|
|
203
|
+
|
|
204
|
+
export const SiteDataImportRequest = /* @__PURE__ */ defineSchema(() =>
|
|
205
|
+
z
|
|
206
|
+
.object({
|
|
207
|
+
format: z.enum(["json", "csv"]),
|
|
208
|
+
records: z
|
|
209
|
+
.array(RecordData)
|
|
210
|
+
.max(1000)
|
|
211
|
+
.optional()
|
|
212
|
+
.describe("JSON format: the records to import."),
|
|
213
|
+
csv: z
|
|
214
|
+
.string()
|
|
215
|
+
.max(2 * 1024 * 1024)
|
|
216
|
+
.optional()
|
|
217
|
+
.describe("CSV format: a header row, then one record per row. Values import as text."),
|
|
218
|
+
keyField: z
|
|
219
|
+
.string()
|
|
220
|
+
.min(1)
|
|
221
|
+
.max(300)
|
|
222
|
+
.optional()
|
|
223
|
+
.describe("Use this field as each record's key, so re-importing replaces records."),
|
|
224
|
+
})
|
|
225
|
+
.refine((value) => (value.format === "json" ? !!value.records : value.csv !== undefined), {
|
|
226
|
+
message: "Give records for json or csv for csv",
|
|
227
|
+
}),
|
|
228
|
+
);
|
|
229
|
+
export type SiteDataImportRequest = z.infer<typeof SiteDataImportRequest>;
|
|
230
|
+
|
|
231
|
+
export const SiteDataFileScope = /* @__PURE__ */ defineSchema(() =>
|
|
232
|
+
z
|
|
233
|
+
.enum(["shared", "private"])
|
|
234
|
+
.describe("shared: every viewer can open it. private: only the uploader and managers."),
|
|
235
|
+
);
|
|
236
|
+
export type SiteDataFileScope = z.infer<typeof SiteDataFileScope>;
|
|
237
|
+
|
|
238
|
+
export const SiteDataErrorCode = /* @__PURE__ */ defineSchema(() =>
|
|
239
|
+
z.enum(["validation", "conflict", "not_found", "forbidden", "quota_exceeded", "rate_limited"]),
|
|
240
|
+
);
|
|
241
|
+
export type SiteDataErrorCode = z.infer<typeof SiteDataErrorCode>;
|
|
242
|
+
|
|
243
|
+
/** HTTP status for each Site Data error code. */
|
|
244
|
+
export const SITE_DATA_ERROR_STATUS: Record<SiteDataErrorCode, number> = {
|
|
245
|
+
validation: 422,
|
|
246
|
+
conflict: 409,
|
|
247
|
+
not_found: 404,
|
|
248
|
+
forbidden: 403,
|
|
249
|
+
quota_exceeded: 413,
|
|
250
|
+
rate_limited: 429,
|
|
251
|
+
};
|
|
252
|
+
|
|
253
|
+
export type SiteDataRecordResponse = {
|
|
254
|
+
id: string;
|
|
255
|
+
key: string | null;
|
|
256
|
+
data: Record<string, unknown>;
|
|
257
|
+
owner: string;
|
|
258
|
+
createdBy: string;
|
|
259
|
+
updatedBy: string;
|
|
260
|
+
version: number;
|
|
261
|
+
sizeBytes: number;
|
|
262
|
+
createdAt: string;
|
|
263
|
+
updatedAt: string;
|
|
264
|
+
};
|
|
265
|
+
|
|
266
|
+
export type SiteDataCollectionResponse = {
|
|
267
|
+
id: string;
|
|
268
|
+
name: string;
|
|
269
|
+
accessMode: SiteDataAccessMode;
|
|
270
|
+
privateRecords: boolean;
|
|
271
|
+
guestAccess: SiteDataGuestAccess;
|
|
272
|
+
jsonSchema: Record<string, unknown> | null;
|
|
273
|
+
indexedFields: string[];
|
|
274
|
+
uniqueFields: string[][];
|
|
275
|
+
recordCount: number;
|
|
276
|
+
recordBytes: number;
|
|
277
|
+
createdAt: string;
|
|
278
|
+
updatedAt: string;
|
|
279
|
+
};
|
|
280
|
+
|
|
281
|
+
export type SiteDataLimitsResponse = {
|
|
282
|
+
recordBytesPerSite: number;
|
|
283
|
+
maxRecordBytes: number;
|
|
284
|
+
maxCollectionsPerSite: number;
|
|
285
|
+
fileBytesPerSite: number;
|
|
286
|
+
maxFileBytes: number;
|
|
287
|
+
workspaceBytes: number;
|
|
288
|
+
};
|
|
289
|
+
|
|
290
|
+
export type SiteDataDescribeResponse = {
|
|
291
|
+
siteId: string;
|
|
292
|
+
collections: SiteDataCollectionResponse[];
|
|
293
|
+
usage: {
|
|
294
|
+
collectionCount: number;
|
|
295
|
+
recordCount: number;
|
|
296
|
+
recordBytes: number;
|
|
297
|
+
fileCount: number;
|
|
298
|
+
fileBytes: number;
|
|
299
|
+
workspaceBytes: number;
|
|
300
|
+
};
|
|
301
|
+
limits: SiteDataLimitsResponse;
|
|
302
|
+
};
|
|
303
|
+
|
|
304
|
+
export type SiteDataFileResponse = {
|
|
305
|
+
id: string;
|
|
306
|
+
name: string;
|
|
307
|
+
contentType: string;
|
|
308
|
+
sizeBytes: number;
|
|
309
|
+
sha256: string;
|
|
310
|
+
scope: SiteDataFileScope;
|
|
311
|
+
owner: string;
|
|
312
|
+
createdBy: string;
|
|
313
|
+
createdAt: string;
|
|
314
|
+
};
|
|
315
|
+
|
|
316
|
+
export type SiteDataQueryResponse = {
|
|
317
|
+
records: SiteDataRecordResponse[];
|
|
318
|
+
nextCursor: string | null;
|
|
319
|
+
count?: number;
|
|
320
|
+
};
|
|
321
|
+
|
|
322
|
+
export type SiteDataWriteResultResponse =
|
|
323
|
+
| { op: "insert" | "put" | "patch" | "increment"; record: SiteDataRecordResponse }
|
|
324
|
+
| { op: "delete"; deleted: { id: string } };
|
|
325
|
+
|
|
326
|
+
export type SiteDataWriteResponse = { results: SiteDataWriteResultResponse[] };
|
|
327
|
+
|
|
328
|
+
export type SiteDataImportResponse = { imported: number };
|
|
329
|
+
|
|
330
|
+
export type SiteDataFileListResponse = {
|
|
331
|
+
files: SiteDataFileResponse[];
|
|
332
|
+
nextCursor: string | null;
|
|
333
|
+
};
|
|
334
|
+
|
|
335
|
+
export type SiteDataFileUrlResponse = {
|
|
336
|
+
url: string;
|
|
337
|
+
expiresAt: string;
|
|
338
|
+
file: SiteDataFileResponse;
|
|
339
|
+
};
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
// Zod-free on purpose: browser bundles (the Site runtime, the console Site
|
|
2
|
+
// bridge and the gateway shell) import this module, and must not pull in zod.
|
|
3
|
+
|
|
4
|
+
// ---------------------------------------------------------------------------
|
|
5
|
+
// Site operation allowlist
|
|
6
|
+
// ---------------------------------------------------------------------------
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Every HTTP operation Site code may perform through a host, as an explicit
|
|
10
|
+
* allowlist (method + exact path shape) rather than a URL prefix. Paths are
|
|
11
|
+
* the suffix after `/v1/workspaces/site-host` that the in-Site SDK client
|
|
12
|
+
* uses; `/v1/config/client` is the one path outside that prefix.
|
|
13
|
+
*
|
|
14
|
+
* The console host forwards an allowed operation to the ordinary workspace
|
|
15
|
+
* route with Site provenance. The gateway forwards it to `/_og/api<suffix>`
|
|
16
|
+
* and the API serves it at `/v1/site-runtime<suffix>`. `agent: true` marks
|
|
17
|
+
* operations that start or message an agent; every such route records which
|
|
18
|
+
* Site (and version) originated it.
|
|
19
|
+
*/
|
|
20
|
+
export type SiteOperationMethod = "GET" | "POST" | "PUT" | "PATCH" | "DELETE";
|
|
21
|
+
export type SiteOperation = {
|
|
22
|
+
id: string;
|
|
23
|
+
method: SiteOperationMethod;
|
|
24
|
+
/** Anchored pattern on the site-host suffix (`""` is the workspace itself). */
|
|
25
|
+
pattern: RegExp;
|
|
26
|
+
agent?: true;
|
|
27
|
+
stream?: true;
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
const ID = "[A-Za-z0-9_-]{1,128}";
|
|
31
|
+
const DATA = "/published-artifacts/current/(?:data|files)(?:/[A-Za-z0-9._~:@!$&'()*+,;=-]+)*";
|
|
32
|
+
|
|
33
|
+
export const SITE_OPERATIONS: readonly SiteOperation[] = Object.freeze([
|
|
34
|
+
{ id: "config.client", method: "GET", pattern: /^\/v1\/config\/client$/u },
|
|
35
|
+
{ id: "workspace.get", method: "GET", pattern: /^$/u },
|
|
36
|
+
{ id: "site.config", method: "GET", pattern: /^\/site\/config$/u },
|
|
37
|
+
{ id: "models.list", method: "GET", pattern: /^\/model-catalog$/u },
|
|
38
|
+
{ id: "sessions.list", method: "GET", pattern: /^\/sessions$/u },
|
|
39
|
+
{ id: "sessions.create", method: "POST", pattern: /^\/sessions$/u, agent: true },
|
|
40
|
+
{ id: "sessions.get", method: "GET", pattern: new RegExp(`^/sessions/${ID}$`, "u") },
|
|
41
|
+
{ id: "sessions.events", method: "GET", pattern: new RegExp(`^/sessions/${ID}/events$`, "u") },
|
|
42
|
+
{
|
|
43
|
+
id: "sessions.stream",
|
|
44
|
+
method: "GET",
|
|
45
|
+
pattern: new RegExp(`^/sessions/${ID}/events/stream$`, "u"),
|
|
46
|
+
stream: true,
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
id: "sessions.send",
|
|
50
|
+
method: "POST",
|
|
51
|
+
pattern: new RegExp(`^/sessions/${ID}/events$`, "u"),
|
|
52
|
+
agent: true,
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
id: "sessions.steer",
|
|
56
|
+
method: "POST",
|
|
57
|
+
pattern: new RegExp(`^/sessions/${ID}/steer$`, "u"),
|
|
58
|
+
agent: true,
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
id: "sessions.control",
|
|
62
|
+
method: "POST",
|
|
63
|
+
pattern: new RegExp(`^/sessions/${ID}/control$`, "u"),
|
|
64
|
+
agent: true,
|
|
65
|
+
},
|
|
66
|
+
{ id: "sessions.queue", method: "GET", pattern: new RegExp(`^/sessions/${ID}/queue$`, "u") },
|
|
67
|
+
// SessionConversation's documented queue edit/delete/steer/move.
|
|
68
|
+
{
|
|
69
|
+
id: "sessions.queue.item",
|
|
70
|
+
method: "POST",
|
|
71
|
+
pattern: new RegExp(`^/sessions/${ID}/queue/${ID}/(?:move|edit|steer|delete)$`, "u"),
|
|
72
|
+
agent: true,
|
|
73
|
+
},
|
|
74
|
+
// SessionConversation's durable composer draft and its Send.
|
|
75
|
+
{
|
|
76
|
+
id: "sessions.composerDraft.get",
|
|
77
|
+
method: "GET",
|
|
78
|
+
pattern: new RegExp(`^/sessions/${ID}/composer-draft$`, "u"),
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
id: "sessions.composerDraft.put",
|
|
82
|
+
method: "PUT",
|
|
83
|
+
pattern: new RegExp(`^/sessions/${ID}/composer-draft$`, "u"),
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
id: "sessions.composerDraft.submit",
|
|
87
|
+
method: "POST",
|
|
88
|
+
pattern: new RegExp(`^/sessions/${ID}/composer-draft/submit$`, "u"),
|
|
89
|
+
agent: true,
|
|
90
|
+
},
|
|
91
|
+
{
|
|
92
|
+
id: "sessions.humanInput",
|
|
93
|
+
method: "GET",
|
|
94
|
+
pattern: new RegExp(`^/sessions/${ID}/human-input-requests$`, "u"),
|
|
95
|
+
},
|
|
96
|
+
// SessionConversation's human-input form reads the one open request.
|
|
97
|
+
{
|
|
98
|
+
id: "sessions.humanInput.get",
|
|
99
|
+
method: "GET",
|
|
100
|
+
pattern: new RegExp(`^/sessions/${ID}/human-input-requests/${ID}$`, "u"),
|
|
101
|
+
},
|
|
102
|
+
{ id: "data.read", method: "GET", pattern: new RegExp(`^${DATA}$`, "u") },
|
|
103
|
+
{ id: "data.write", method: "POST", pattern: new RegExp(`^${DATA}$`, "u") },
|
|
104
|
+
{ id: "data.put", method: "PUT", pattern: new RegExp(`^${DATA}$`, "u") },
|
|
105
|
+
{ id: "data.patch", method: "PATCH", pattern: new RegExp(`^${DATA}$`, "u") },
|
|
106
|
+
{ id: "data.delete", method: "DELETE", pattern: new RegExp(`^${DATA}$`, "u") },
|
|
107
|
+
// Site SQL (PR B): run one named query the owner defined; never raw SQL.
|
|
108
|
+
{
|
|
109
|
+
id: "sql.run",
|
|
110
|
+
method: "POST",
|
|
111
|
+
pattern: /^\/published-artifacts\/current\/sql\/queries\/[A-Za-z][A-Za-z0-9_-]{0,63}$/u,
|
|
112
|
+
},
|
|
113
|
+
{ id: "site.report", method: "POST", pattern: /^\/site\/reports$/u },
|
|
114
|
+
] satisfies SiteOperation[]);
|
|
115
|
+
|
|
116
|
+
/**
|
|
117
|
+
* Tool bridge methods (MessagePort, not HTTP). The gateway serves them at
|
|
118
|
+
* POST /_og/api/tools/<method>; the console uses its tool gateway client.
|
|
119
|
+
*/
|
|
120
|
+
export const SITE_TOOL_METHODS = Object.freeze([
|
|
121
|
+
"catalog",
|
|
122
|
+
"declarations",
|
|
123
|
+
"call",
|
|
124
|
+
"resolve",
|
|
125
|
+
"invoke",
|
|
126
|
+
] as const);
|
|
127
|
+
export type SiteToolMethod = (typeof SITE_TOOL_METHODS)[number];
|
|
128
|
+
|
|
129
|
+
const SITE_HOST_PREFIX = "/v1/workspaces/site-host";
|
|
130
|
+
|
|
131
|
+
/**
|
|
132
|
+
* Match a Site-originated request against the allowlist. `path` is the
|
|
133
|
+
* pathname the in-Site SDK used (`/v1/workspaces/site-host/...` or
|
|
134
|
+
* `/v1/config/client`), without query. Returns the operation and the
|
|
135
|
+
* site-host suffix, or null when the operation is not allowed. Refuses
|
|
136
|
+
* encoded separators, dot segments and control characters.
|
|
137
|
+
*/
|
|
138
|
+
export function matchSiteOperation(
|
|
139
|
+
method: string,
|
|
140
|
+
path: string,
|
|
141
|
+
): { operation: SiteOperation; suffix: string } | null {
|
|
142
|
+
if (/[%\\#\u0000-\u0020\u007f]/u.test(path)) return null;
|
|
143
|
+
if (path.split("/").some((part) => part === "." || part === "..")) return null;
|
|
144
|
+
const upper = method.toUpperCase();
|
|
145
|
+
let suffix: string;
|
|
146
|
+
if (path === "/v1/config/client") suffix = path;
|
|
147
|
+
else if (path === SITE_HOST_PREFIX) suffix = "";
|
|
148
|
+
else if (path.startsWith(`${SITE_HOST_PREFIX}/`)) suffix = path.slice(SITE_HOST_PREFIX.length);
|
|
149
|
+
else return null;
|
|
150
|
+
const operation = SITE_OPERATIONS.find(
|
|
151
|
+
(candidate) => candidate.method === upper && candidate.pattern.test(suffix),
|
|
152
|
+
);
|
|
153
|
+
return operation ? { operation, suffix } : null;
|
|
154
|
+
}
|