@opengeni/contracts 3.1.0-canary.2 → 3.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/agent-authored-durable-text.d.ts +9 -9
- package/dist/agent-config.d.ts +971 -0
- package/dist/agent-instruction-changes.d.ts +0 -2
- package/dist/allowance-refusal.d.ts +9 -0
- package/dist/allowance-refusal.js +50 -0
- package/dist/allowance-refusal.js.map +1 -0
- package/dist/analytics-consent-report.d.ts +19 -0
- package/dist/analytics-consent-report.js +10 -0
- package/dist/analytics-consent-report.js.map +1 -0
- package/dist/api-key-presets.d.ts +19 -0
- package/dist/artifact-catalog.d.ts +188 -0
- package/dist/artifacts.d.ts +86 -0
- package/dist/atlassian-native-retirement.d.ts +16 -0
- package/dist/atlassian-native-retirement.js +30 -0
- package/dist/atlassian-native-retirement.js.map +1 -0
- package/dist/atlassian.d.ts +1 -0
- package/dist/atlassian.js +34 -19
- package/dist/browser-storage.d.ts +5 -0
- package/dist/browser-storage.js +9 -0
- package/dist/browser-storage.js.map +1 -0
- package/dist/bundled-skills.d.ts +24 -1
- package/dist/canonical-human-identities.js +2 -1
- package/dist/chunk-2ZIHHL72.js +153 -0
- package/dist/chunk-2ZIHHL72.js.map +1 -0
- package/dist/{chunk-5LYFSZ7O.js → chunk-352X6ENP.js} +31 -31
- package/dist/chunk-4JGHSSB7.js +11 -0
- package/dist/chunk-4JGHSSB7.js.map +1 -0
- package/dist/chunk-4QO6GJUX.js +85 -0
- package/dist/chunk-4QO6GJUX.js.map +1 -0
- package/dist/chunk-4VDMHLLL.js +49 -0
- package/dist/chunk-4VDMHLLL.js.map +1 -0
- package/dist/chunk-56SNIMDO.js +9 -0
- package/dist/chunk-56SNIMDO.js.map +1 -0
- package/dist/chunk-6C2HKFTU.js +207 -0
- package/dist/chunk-6C2HKFTU.js.map +1 -0
- package/dist/chunk-6IXO76Z6.js +72 -0
- package/dist/chunk-6IXO76Z6.js.map +1 -0
- package/dist/chunk-7272KVWZ.js +60 -0
- package/dist/chunk-7272KVWZ.js.map +1 -0
- package/dist/{chunk-7ABONTXE.js → chunk-E3GGUBHS.js} +49 -5
- package/dist/chunk-E3GGUBHS.js.map +1 -0
- package/dist/chunk-EFZYKUE2.js +767 -0
- package/dist/chunk-EFZYKUE2.js.map +1 -0
- package/dist/chunk-EKWNTOG3.js +154 -0
- package/dist/chunk-EKWNTOG3.js.map +1 -0
- package/dist/chunk-HABQ7ADB.js +234 -0
- package/dist/chunk-HABQ7ADB.js.map +1 -0
- package/dist/chunk-HRRU4QPI.js +91 -0
- package/dist/chunk-HRRU4QPI.js.map +1 -0
- package/dist/{chunk-3SIZGL3O.js → chunk-IK36LXKC.js} +18 -2
- package/dist/chunk-IK36LXKC.js.map +1 -0
- package/dist/{chunk-TXTQIYCV.js → chunk-ILJ72KPO.js} +56 -3
- package/dist/chunk-ILJ72KPO.js.map +1 -0
- package/dist/chunk-J4HQ3UKY.js +93 -0
- package/dist/chunk-J4HQ3UKY.js.map +1 -0
- package/dist/chunk-KHHZTBP7.js +11 -0
- package/dist/chunk-KHHZTBP7.js.map +1 -0
- package/dist/{chunk-WYBDERIY.js → chunk-LZ2LAHIX.js} +47 -41
- package/dist/chunk-LZ2LAHIX.js.map +1 -0
- package/dist/chunk-NDZHPTCL.js +400 -0
- package/dist/chunk-NDZHPTCL.js.map +1 -0
- package/dist/chunk-OF6OKOBF.js +54793 -0
- package/dist/chunk-OF6OKOBF.js.map +1 -0
- package/dist/chunk-OL23ARTF.js +94 -0
- package/dist/chunk-OL23ARTF.js.map +1 -0
- package/dist/chunk-PUIUXIOL.js +189 -0
- package/dist/chunk-PUIUXIOL.js.map +1 -0
- package/dist/{chunk-Y3KNXVTD.js → chunk-RMWXDZEO.js} +128 -21
- package/dist/chunk-RMWXDZEO.js.map +1 -0
- package/dist/{chunk-MRWYRAS5.js → chunk-SHO4YO4B.js} +27 -35
- package/dist/chunk-SHO4YO4B.js.map +1 -0
- package/dist/chunk-SWRN2DJ3.js +153 -0
- package/dist/chunk-SWRN2DJ3.js.map +1 -0
- package/dist/chunk-TCXCRBPF.js +267 -0
- package/dist/chunk-TCXCRBPF.js.map +1 -0
- package/dist/chunk-TLU3UEMD.js +324 -0
- package/dist/chunk-TLU3UEMD.js.map +1 -0
- package/dist/chunk-TSWWZMUS.js +186 -0
- package/dist/chunk-TSWWZMUS.js.map +1 -0
- package/dist/{chunk-PX3VCKAU.js → chunk-WVCFSOUZ.js} +1 -1
- package/dist/{chunk-PX3VCKAU.js.map → chunk-WVCFSOUZ.js.map} +1 -1
- package/dist/chunk-XDLAGX66.js +127 -0
- package/dist/chunk-XDLAGX66.js.map +1 -0
- package/dist/chunk-YKZ4WU4P.js +33 -0
- package/dist/chunk-YKZ4WU4P.js.map +1 -0
- package/dist/{chunk-O5LEQHDM.js → chunk-Z7WEVGCL.js} +3 -3
- package/dist/{chunk-YBW5JSA3.js → chunk-ZDCRWCGZ.js} +119 -101
- package/dist/chunk-ZDCRWCGZ.js.map +1 -0
- package/dist/claude-provider-account-authority.d.ts +18 -0
- package/dist/claude-subscription-oauth.d.ts +42 -0
- package/dist/claude-subscription-usage.d.ts +159 -0
- package/dist/client-error-report.d.ts +158 -0
- package/dist/client-error-report.js +164 -0
- package/dist/client-error-report.js.map +1 -0
- package/dist/code-search.d.ts +52 -0
- package/dist/code-search.js +40 -0
- package/dist/code-search.js.map +1 -0
- package/dist/codex-provider-account-authority.js +20 -12
- package/dist/codex-provider-account-authority.js.map +1 -1
- package/dist/company-profile.d.ts +144 -6
- package/dist/connect.d.ts +37 -0
- package/dist/connect.js +216 -159
- package/dist/connect.js.map +1 -1
- package/dist/connection-account-label.d.ts +2 -0
- package/dist/connection-account-label.js +35 -0
- package/dist/connection-account-label.js.map +1 -0
- package/dist/connection-authority.d.ts +9 -317
- package/dist/connection-authority.js +37 -42
- package/dist/connector-attachments.js +2 -1
- package/dist/connector-destinations.js +2 -1
- package/dist/connector-tool-permissions.d.ts +137 -0
- package/dist/cua-desktop-tools.d.ts +17 -0
- package/dist/define-schema.d.ts +8 -0
- package/dist/direct-model-provider.d.ts +36 -0
- package/dist/editable-artifact-codec-registry.js +5 -5
- package/dist/editable-artifact-committed-transaction.js +3 -2
- package/dist/editable-artifact-live.js +5 -5
- package/dist/editable-artifact-serialized-commit.js +6 -6
- package/dist/editable-artifact-versions.d.ts +7 -1
- package/dist/editable-artifact-versions.js +1 -1
- package/dist/editable-artifacts.js +62 -56
- package/dist/event-preview.d.ts +22 -0
- package/dist/external-identities.d.ts +138 -0
- package/dist/external-identities.js +9 -4
- package/dist/first-party-tool-authorization.d.ts +815 -0
- package/dist/github-repository-contracts.js +60 -43
- package/dist/github-repository-contracts.js.map +1 -1
- package/dist/google-drive.d.ts +2 -1
- package/dist/google-drive.js +305 -238
- package/dist/google-drive.js.map +1 -1
- package/dist/host-mcp-bindings.d.ts +5 -0
- package/dist/host-mcp-bindings.js +233 -170
- package/dist/host-mcp-bindings.js.map +1 -1
- package/dist/image-generation.d.ts +1 -0
- package/dist/index.d.ts +16761 -5946
- package/dist/index.js +1973 -260
- package/dist/insights-usage.d.ts +877 -0
- package/dist/insights-usage.js +559 -0
- package/dist/insights-usage.js.map +1 -0
- package/dist/interaction.d.ts +1176 -829
- package/dist/knowledge-entries.d.ts +81 -2
- package/dist/knowledge-preparation.d.ts +239 -0
- package/dist/managed-auth-session-sets.d.ts +7 -0
- package/dist/managed-auth-session-sets.js +198 -132
- package/dist/managed-auth-session-sets.js.map +1 -1
- package/dist/managed-sign-in-methods.d.ts +56 -0
- package/dist/managed-sign-in-methods.js +64 -0
- package/dist/managed-sign-in-methods.js.map +1 -0
- package/dist/mcp-catalog-limits.d.ts +2 -0
- package/dist/mcp-oauth.d.ts +2 -2
- package/dist/mcp-structured-content.d.ts +25 -0
- package/dist/modal-native-proof-v2.d.ts +587 -0
- package/dist/modal-native-proof-v2.js +38 -0
- package/dist/modal-native-proof-v2.js.map +1 -0
- package/dist/model-account-choice.d.ts +235 -0
- package/dist/model-account-settings.d.ts +422 -0
- package/dist/model-availability.d.ts +15 -0
- package/dist/model-connection-access.d.ts +13 -0
- package/dist/model-context-inspector.d.ts +98 -0
- package/dist/model-display.d.ts +43 -0
- package/dist/model-display.js +17 -0
- package/dist/model-display.js.map +1 -0
- package/dist/model-picker-order.d.ts +3 -1
- package/dist/model-picker-order.js +3 -0
- package/dist/model-picker-order.js.map +1 -1
- package/dist/organization-access.d.ts +412 -0
- package/dist/organization-access.js +39 -0
- package/dist/organization-access.js.map +1 -0
- package/dist/organization-integration-policy.d.ts +27 -0
- package/dist/organization-membership-lifecycle.d.ts +38 -0
- package/dist/organization-model-usage.d.ts +146 -0
- package/dist/organization-model-usage.js +78 -0
- package/dist/organization-model-usage.js.map +1 -0
- package/dist/organization-recovery.js +2 -1
- package/dist/organization-usage.d.ts +138 -0
- package/dist/permissions.d.ts +18 -0
- package/dist/personal-github.d.ts +1 -0
- package/dist/personal-github.js +199 -144
- package/dist/personal-github.js.map +1 -1
- package/dist/prepared-mcp-setup.d.ts +54 -0
- package/dist/prepared-mcp-setup.js +12 -0
- package/dist/prepared-mcp-setup.js.map +1 -0
- package/dist/product-analytics.d.ts +116 -0
- package/dist/product-lifecycle-facts.d.ts +73 -0
- package/dist/remember.d.ts +98 -6
- package/dist/retained-output.d.ts +8 -0
- package/dist/sandbox-file-artifacts.d.ts +1 -0
- package/dist/sandbox-provider-command.d.ts +91 -1
- package/dist/sandbox-recovery.d.ts +146 -0
- package/dist/secret-generator.d.ts +44 -0
- package/dist/secret-references.d.ts +90 -0
- package/dist/secret-resolution.d.ts +111 -0
- package/dist/secret-totp.d.ts +41 -0
- package/dist/session-final-reply.d.ts +6 -0
- package/dist/session-final-reply.js +9 -0
- package/dist/session-final-reply.js.map +1 -0
- package/dist/session-goal-reports.d.ts +21 -0
- package/dist/session-history-import.d.ts +1272 -0
- package/dist/session-list-entries.d.ts +4 -0
- package/dist/session-list-entries.js +56 -0
- package/dist/session-list-entries.js.map +1 -0
- package/dist/session-mcp-projections.d.ts +6 -0
- package/dist/session-mcp-tool-permissions.d.ts +62 -0
- package/dist/session-message-search.d.ts +68 -0
- package/dist/session-target.d.ts +18 -0
- package/dist/session-titles.d.ts +8 -0
- package/dist/session-titles.js +5 -1
- package/dist/session-usage-limit-refusal.d.ts +34 -0
- package/dist/session-usage-limit-refusal.js +15 -0
- package/dist/session-usage-limit-refusal.js.map +1 -0
- package/dist/session-usage-limits.d.ts +127 -0
- package/dist/session-usage-limits.js +41 -0
- package/dist/session-usage-limits.js.map +1 -0
- package/dist/signup-attribution.d.ts +39 -0
- package/dist/site-data.d.ts +286 -0
- package/dist/site-operations.d.ts +39 -0
- package/dist/site-publishing.d.ts +778 -0
- package/dist/site-session-http.d.ts +89 -4
- package/dist/site-session-http.js +25 -1
- package/dist/site-sql.d.ts +421 -0
- package/dist/skill-catalog-context.d.ts +7 -0
- package/dist/skill-files.d.ts +1 -1
- package/dist/skill-use.d.ts +61 -0
- package/dist/skills.d.ts +15 -0
- package/dist/slack-bot-scopes.d.ts +17 -12
- package/dist/slack-bot-scopes.js +10 -3
- package/dist/slack-rest-mcp.d.ts +36 -0
- package/dist/slack-rest-mcp.js +25 -0
- package/dist/slack-rest-mcp.js.map +1 -0
- package/dist/spreadsheet-artifact-commands.d.ts +14 -1
- package/dist/spreadsheet-artifact-commands.js +8 -2
- package/dist/spreadsheet-artifact-query.d.ts +13 -6
- package/dist/spreadsheet-artifact-query.js +3 -3
- package/dist/subscription-account-actions.d.ts +64 -0
- package/dist/subscription-account-pools.d.ts +292 -0
- package/dist/subscription-personal-authority-v2.d.ts +28 -0
- package/dist/subscription-personal-authority-v2.js +12 -0
- package/dist/subscription-personal-authority-v2.js.map +1 -0
- package/dist/tool-action-review.d.ts +132 -0
- package/dist/tool-catalog.d.ts +408 -0
- package/dist/tool-policy.d.ts +5 -0
- package/dist/tool-review-presentation.d.ts +12 -0
- package/dist/tool-review-presentation.js +17 -0
- package/dist/tool-review-presentation.js.map +1 -0
- package/dist/transcription-recordings.d.ts +21 -0
- package/dist/turn-serving-policy.d.ts +221 -0
- package/dist/usage-allowances.d.ts +314 -0
- package/dist/usage-allowances.js +52 -0
- package/dist/usage-allowances.js.map +1 -0
- package/dist/vaults.d.ts +1286 -0
- package/dist/video-generation.d.ts +3 -0
- package/dist/video-generation.js +2 -1
- package/dist/workspace-integration-wire.d.ts +36 -0
- package/dist/workspace-integration-wire.js +23 -0
- package/dist/workspace-integration-wire.js.map +1 -0
- package/dist/workspace-integrations.d.ts +1028 -0
- package/dist/xai-provider-account-authority.js +2 -1
- package/package.json +93 -5
- package/src/agent-authored-durable-text.ts +14 -11
- package/src/agent-config.ts +1698 -0
- package/src/agent-instruction-changes.ts +91 -74
- package/src/agent-learning.ts +94 -67
- package/src/agent-topology.ts +57 -52
- package/src/allowance-refusal.ts +81 -0
- package/src/analytics-consent-report.ts +20 -0
- package/src/api-key-presets.ts +28 -0
- package/src/artifact-catalog.ts +82 -0
- package/src/artifacts.ts +299 -227
- package/src/atlassian-native-retirement.ts +33 -0
- package/src/atlassian.ts +135 -108
- package/src/browser-storage.ts +10 -0
- package/src/bundled-skills.ts +60 -17
- package/src/canonical-human-identities.ts +60 -58
- package/src/claude-provider-account-authority.ts +12 -0
- package/src/claude-subscription-oauth.ts +73 -0
- package/src/claude-subscription-usage.ts +68 -0
- package/src/client-error-report.ts +343 -0
- package/src/code-search.ts +105 -0
- package/src/codex-provider-account-authority.ts +21 -16
- package/src/company-brain-governed-writes.ts +255 -233
- package/src/company-brain.ts +164 -153
- package/src/company-profile.ts +365 -292
- package/src/connect.ts +212 -173
- package/src/connection-account-label.ts +46 -0
- package/src/connection-authority.ts +183 -364
- package/src/connector-attachments.ts +137 -122
- package/src/connector-destinations.ts +46 -42
- package/src/connector-tool-permissions.ts +117 -0
- package/src/cua-desktop-tools.gen.json +6512 -0
- package/src/cua-desktop-tools.linux.gen.json +6600 -0
- package/src/cua-desktop-tools.ts +36 -0
- package/src/cua-desktop-tools.windows.gen.json +6353 -0
- package/src/define-schema.ts +10 -0
- package/src/direct-model-provider.ts +108 -0
- package/src/editable-artifact-committed-transaction.ts +17 -0
- package/src/editable-artifact-versions.ts +7 -1
- package/src/event-preview.ts +53 -3
- package/src/external-identities.ts +249 -176
- package/src/feedback.ts +43 -30
- package/src/first-party-tool-authorization.ts +356 -0
- package/src/github-repository-contracts.ts +78 -64
- package/src/google-drive.ts +285 -234
- package/src/governed-learning-activation.ts +152 -131
- package/src/governed-learning-evaluator.ts +140 -133
- package/src/host-mcp-bindings.ts +252 -198
- package/src/image-generation.ts +104 -95
- package/src/index.ts +13235 -8687
- package/src/insights-usage.ts +727 -0
- package/src/interaction.ts +3070 -2326
- package/src/knowledge-entries.ts +361 -276
- package/src/knowledge-preparation.ts +57 -0
- package/src/knowledge.ts +246 -213
- package/src/managed-auth-session-sets.ts +220 -144
- package/src/managed-sign-in-methods.ts +52 -0
- package/src/mcp-catalog-limits.ts +2 -0
- package/src/mcp-oauth.ts +43 -34
- package/src/mcp-receipts.ts +192 -192
- package/src/mcp-structured-content.ts +81 -0
- package/src/memory-slack-delivery.ts +171 -142
- package/src/modal-native-proof-v2.ts +429 -0
- package/src/model-account-choice.ts +177 -0
- package/src/model-account-settings.ts +210 -0
- package/src/model-availability.ts +22 -0
- package/src/model-connection-access.ts +61 -14
- package/src/model-context-inspector.ts +133 -99
- package/src/model-display.ts +221 -0
- package/src/model-picker-order.ts +12 -1
- package/src/organization-access.ts +217 -0
- package/src/organization-integration-policy.ts +63 -0
- package/src/organization-membership-lifecycle.ts +528 -382
- package/src/organization-model-usage.ts +81 -0
- package/src/organization-recovery.ts +147 -135
- package/src/organization-usage.ts +94 -0
- package/src/permissions.ts +88 -52
- package/src/personal-github.ts +210 -171
- package/src/preference-registry.ts +314 -258
- package/src/prepared-mcp-setup.ts +189 -0
- package/src/product-analytics.ts +261 -0
- package/src/product-lifecycle-facts.ts +122 -0
- package/src/remember.ts +181 -167
- package/src/retained-output.ts +194 -165
- package/src/sandbox-file-artifacts.ts +60 -47
- package/src/sandbox-provider-command.ts +88 -20
- package/src/sandbox-recovery.ts +129 -0
- package/src/scoped-knowledge.ts +61 -43
- package/src/secret-generator.ts +155 -0
- package/src/secret-references.ts +414 -0
- package/src/secret-resolution.ts +274 -0
- package/src/secret-totp.ts +188 -0
- package/src/session-final-reply.ts +16 -0
- package/src/session-goal-reports.ts +64 -0
- package/src/session-history-import.ts +177 -0
- package/src/session-list-entries.ts +96 -0
- package/src/session-mcp-projections.ts +11 -0
- package/src/session-mcp-tool-permissions.ts +108 -0
- package/src/session-message-search.ts +61 -0
- package/src/session-target.ts +57 -0
- package/src/session-titles.ts +80 -10
- package/src/session-topology-primitives.ts +19 -12
- package/src/session-usage-limit-refusal.ts +101 -0
- package/src/session-usage-limits.ts +171 -0
- package/src/signup-attribution.ts +86 -0
- package/src/site-data.ts +339 -0
- package/src/site-operations.ts +154 -0
- package/src/site-publishing.ts +876 -0
- package/src/site-session-http.ts +294 -16
- package/src/site-sql.ts +1123 -0
- package/src/skill-catalog-context.ts +50 -0
- package/src/skill-files.ts +3 -3
- package/src/skill-use.ts +80 -0
- package/src/skills.ts +82 -54
- package/src/slack-bot-scopes.ts +31 -39
- package/src/slack-rest-mcp.ts +222 -0
- package/src/slack-task-policy.ts +96 -73
- package/src/spreadsheet-artifact-commands.ts +73 -2
- package/src/spreadsheet-artifact-query.ts +187 -39
- package/src/subscription-account-actions.ts +84 -0
- package/src/subscription-account-pools.ts +53 -0
- package/src/subscription-personal-authority-v2.ts +66 -0
- package/src/task-notes.ts +55 -51
- package/src/tool-action-review.ts +258 -0
- package/src/tool-catalog.ts +609 -372
- package/src/tool-policy.ts +82 -0
- package/src/tool-result-spill.ts +12 -9
- package/src/tool-review-presentation.ts +385 -0
- package/src/transcription-recordings.ts +145 -131
- package/src/turn-serving-policy.ts +166 -0
- package/src/usage-allowances.ts +248 -0
- package/src/vaults.ts +850 -0
- package/src/video-generation.ts +385 -360
- package/src/work-claims.ts +173 -149
- package/src/workspace-instruction-policies.ts +349 -276
- package/src/workspace-integration-wire.ts +101 -0
- package/src/workspace-integrations.ts +724 -0
- package/src/workspace-learning-administration.ts +57 -44
- package/src/workspace-learning-policy.ts +127 -96
- package/src/workspace-state.ts +250 -220
- package/src/xai-provider-account-authority.ts +22 -17
- package/dist/chunk-2AC63F4S.js +0 -171
- package/dist/chunk-2AC63F4S.js.map +0 -1
- package/dist/chunk-3SIZGL3O.js.map +0 -1
- package/dist/chunk-7ABONTXE.js.map +0 -1
- package/dist/chunk-BCS7WHCK.js +0 -139
- package/dist/chunk-BCS7WHCK.js.map +0 -1
- package/dist/chunk-GRG7PHWQ.js +0 -25
- package/dist/chunk-GRG7PHWQ.js.map +0 -1
- package/dist/chunk-JUFK3T4Q.js +0 -80
- package/dist/chunk-JUFK3T4Q.js.map +0 -1
- package/dist/chunk-M5ZGRVIQ.js +0 -719
- package/dist/chunk-M5ZGRVIQ.js.map +0 -1
- package/dist/chunk-MRWYRAS5.js.map +0 -1
- package/dist/chunk-OVFORMPW.js +0 -348
- package/dist/chunk-OVFORMPW.js.map +0 -1
- package/dist/chunk-P3HLDT77.js +0 -59
- package/dist/chunk-P3HLDT77.js.map +0 -1
- package/dist/chunk-QQUJ6NPW.js +0 -23093
- package/dist/chunk-QQUJ6NPW.js.map +0 -1
- package/dist/chunk-TXTQIYCV.js.map +0 -1
- package/dist/chunk-WYBDERIY.js.map +0 -1
- package/dist/chunk-Y3KNXVTD.js.map +0 -1
- package/dist/chunk-YBW5JSA3.js.map +0 -1
- package/dist/chunk-YRXAWWCU.js +0 -45
- package/dist/chunk-YRXAWWCU.js.map +0 -1
- package/dist/host-mcp-resolvers.d.ts +0 -32
- package/dist/host-mcp-resolvers.js +0 -34
- package/dist/host-mcp-resolvers.js.map +0 -1
- package/src/host-mcp-resolvers.ts +0 -50
- /package/dist/{chunk-5LYFSZ7O.js.map → chunk-352X6ENP.js.map} +0 -0
- /package/dist/{chunk-O5LEQHDM.js.map → chunk-Z7WEVGCL.js.map} +0 -0
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
/** Only a declared action discriminator can select an action-specific preference.
|
|
2
|
+
* Callers still validate the complete arguments against the tool schema. */
|
|
3
|
+
export function toolPolicyActionName(
|
|
4
|
+
toolName: string,
|
|
5
|
+
inputSchema: unknown,
|
|
6
|
+
args: unknown,
|
|
7
|
+
): string {
|
|
8
|
+
if (
|
|
9
|
+
!inputSchema ||
|
|
10
|
+
typeof inputSchema !== "object" ||
|
|
11
|
+
Array.isArray(inputSchema) ||
|
|
12
|
+
!args ||
|
|
13
|
+
typeof args !== "object" ||
|
|
14
|
+
Array.isArray(args)
|
|
15
|
+
)
|
|
16
|
+
return toolName;
|
|
17
|
+
const properties = (inputSchema as Record<string, unknown>).properties;
|
|
18
|
+
if (!properties || typeof properties !== "object" || Array.isArray(properties)) return toolName;
|
|
19
|
+
const actionSchema = (properties as Record<string, unknown>).action;
|
|
20
|
+
const action = (args as Record<string, unknown>).action;
|
|
21
|
+
if (
|
|
22
|
+
!actionSchema ||
|
|
23
|
+
typeof actionSchema !== "object" ||
|
|
24
|
+
Array.isArray(actionSchema) ||
|
|
25
|
+
typeof action !== "string" ||
|
|
26
|
+
!action.trim() ||
|
|
27
|
+
action !== action.trim() ||
|
|
28
|
+
action.length > 512
|
|
29
|
+
)
|
|
30
|
+
return toolName;
|
|
31
|
+
const declared = actionSchema as Record<string, unknown>;
|
|
32
|
+
if (declared.enum && (!Array.isArray(declared.enum) || !declared.enum.includes(action)))
|
|
33
|
+
return toolName;
|
|
34
|
+
if (declared.const !== undefined && declared.const !== action) return toolName;
|
|
35
|
+
return declared.type === "string" || declared.enum !== undefined || declared.const !== undefined
|
|
36
|
+
? action
|
|
37
|
+
: toolName;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/** Strip only JSON Schema annotations, never object property names or literal values. */
|
|
41
|
+
export function executableToolSchema(value: unknown): unknown {
|
|
42
|
+
if (!value || typeof value !== "object" || Array.isArray(value)) return value;
|
|
43
|
+
const annotations = new Set(["title", "description", "examples", "$comment"]);
|
|
44
|
+
const schemaMaps = new Set([
|
|
45
|
+
"properties",
|
|
46
|
+
"patternProperties",
|
|
47
|
+
"$defs",
|
|
48
|
+
"definitions",
|
|
49
|
+
"dependentSchemas",
|
|
50
|
+
]);
|
|
51
|
+
const schemaLists = new Set(["allOf", "anyOf", "oneOf", "prefixItems"]);
|
|
52
|
+
const schemaValues = new Set([
|
|
53
|
+
"items",
|
|
54
|
+
"contains",
|
|
55
|
+
"additionalProperties",
|
|
56
|
+
"unevaluatedProperties",
|
|
57
|
+
"unevaluatedItems",
|
|
58
|
+
"propertyNames",
|
|
59
|
+
"not",
|
|
60
|
+
"if",
|
|
61
|
+
"then",
|
|
62
|
+
"else",
|
|
63
|
+
]);
|
|
64
|
+
return Object.fromEntries(
|
|
65
|
+
Object.entries(value).flatMap(([key, entry]) => {
|
|
66
|
+
if (annotations.has(key)) return [];
|
|
67
|
+
if (schemaMaps.has(key) && entry && typeof entry === "object" && !Array.isArray(entry))
|
|
68
|
+
return [
|
|
69
|
+
[
|
|
70
|
+
key,
|
|
71
|
+
Object.fromEntries(
|
|
72
|
+
Object.entries(entry).map(([name, schema]) => [name, executableToolSchema(schema)]),
|
|
73
|
+
),
|
|
74
|
+
],
|
|
75
|
+
];
|
|
76
|
+
if (schemaLists.has(key) && Array.isArray(entry))
|
|
77
|
+
return [[key, entry.map(executableToolSchema)]];
|
|
78
|
+
if (schemaValues.has(key)) return [[key, executableToolSchema(entry)]];
|
|
79
|
+
return [[key, entry]];
|
|
80
|
+
}),
|
|
81
|
+
);
|
|
82
|
+
}
|
package/src/tool-result-spill.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { defineSchema } from "./define-schema";
|
|
1
2
|
import { z } from "zod";
|
|
2
3
|
|
|
3
4
|
/** Model-visible overflow of one tool result. Exact bytes live on a workspace File. */
|
|
@@ -7,15 +8,17 @@ export const TOOL_RESULT_SPILL_MOUNT_PATH = "tool-results" as const;
|
|
|
7
8
|
|
|
8
9
|
const LOWERCASE_UUID = /^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/;
|
|
9
10
|
|
|
10
|
-
export const ToolResultSpilledReceipt =
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
11
|
+
export const ToolResultSpilledReceipt = /* @__PURE__ */ defineSchema(() =>
|
|
12
|
+
z
|
|
13
|
+
.object({
|
|
14
|
+
type: z.literal(TOOL_RESULT_SPILLED_TYPE),
|
|
15
|
+
sandboxPath: z.string().min(1).max(4_096).nullable(),
|
|
16
|
+
fileId: z.string().regex(LOWERCASE_UUID),
|
|
17
|
+
byteSize: z.number().int().positive().safe(),
|
|
18
|
+
mediaType: z.literal(TOOL_RESULT_SPILL_MEDIA_TYPE),
|
|
19
|
+
})
|
|
20
|
+
.strict(),
|
|
21
|
+
);
|
|
19
22
|
export type ToolResultSpilledReceipt = z.infer<typeof ToolResultSpilledReceipt>;
|
|
20
23
|
|
|
21
24
|
export function isToolResultSpilledReceipt(value: unknown): value is ToolResultSpilledReceipt {
|
|
@@ -0,0 +1,385 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
ToolActionReview,
|
|
3
|
+
ToolReviewContext,
|
|
4
|
+
ToolReviewDetailsPage,
|
|
5
|
+
} from "./tool-action-review";
|
|
6
|
+
|
|
7
|
+
const protectedName =
|
|
8
|
+
/password|passwd|secret|credential|authorization|cookie|(^|[_-])token($|[_-])|api[_-]?key|accessToken|refreshToken|privateKey/i;
|
|
9
|
+
const protectedReviewField = (key: string, fields: readonly string[] = []) =>
|
|
10
|
+
protectedName.test(key) || fields.includes(key) || fields.includes("*");
|
|
11
|
+
const bound = (value: string, limit: number) =>
|
|
12
|
+
value.length > limit ? `${value.slice(0, limit)}…` : value;
|
|
13
|
+
export function toolReviewFieldLabel(key: string): string {
|
|
14
|
+
const label = key
|
|
15
|
+
.replace(/([a-z0-9])([A-Z])/g, "$1 $2")
|
|
16
|
+
.replace(/[_-]+/g, " ")
|
|
17
|
+
.replace(/\bids?\b/gi, (word) => (word.length === 3 ? "IDs" : "ID"))
|
|
18
|
+
.replace(
|
|
19
|
+
/\b(api|url|uri|http|https|ip|sql|json|html)(s?)\b/gi,
|
|
20
|
+
(_word, name: string, plural: string) => `${name.toUpperCase()}${plural}`,
|
|
21
|
+
)
|
|
22
|
+
// Sentence case, keeping acronyms: "Working Directory" → "Working directory".
|
|
23
|
+
.replace(
|
|
24
|
+
/(?<=\S\s+)([A-Z])([a-z]+)\b/g,
|
|
25
|
+
(_word, first: string, rest: string) => `${first.toLowerCase()}${rest}`,
|
|
26
|
+
)
|
|
27
|
+
.trim();
|
|
28
|
+
return label.charAt(0).toUpperCase() + label.slice(1);
|
|
29
|
+
}
|
|
30
|
+
export function decodeReviewArguments(value: unknown): Record<string, unknown> | null {
|
|
31
|
+
// Historical SDK entries sometimes wrapped arguments in JSON. Decode only once.
|
|
32
|
+
let decoded = value;
|
|
33
|
+
if (typeof decoded === "string") {
|
|
34
|
+
try {
|
|
35
|
+
decoded = JSON.parse(decoded);
|
|
36
|
+
} catch {
|
|
37
|
+
return null;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
return decoded && typeof decoded === "object" && !Array.isArray(decoded)
|
|
41
|
+
? (decoded as Record<string, unknown>)
|
|
42
|
+
: null;
|
|
43
|
+
}
|
|
44
|
+
export function safeReviewValue(
|
|
45
|
+
value: unknown,
|
|
46
|
+
key = "",
|
|
47
|
+
protectedFields: readonly string[] = [],
|
|
48
|
+
depth = 0,
|
|
49
|
+
): unknown {
|
|
50
|
+
if (protectedReviewField(key, protectedFields)) return "[Protected value]";
|
|
51
|
+
if (depth > 20) return "[Nested value; open this field for details]";
|
|
52
|
+
if (Array.isArray(value))
|
|
53
|
+
return value.map((entry) => safeReviewValue(entry, "", protectedFields, depth + 1));
|
|
54
|
+
if (value && typeof value === "object")
|
|
55
|
+
return Object.fromEntries(
|
|
56
|
+
Object.entries(value).map(([name, entry]) => [
|
|
57
|
+
name,
|
|
58
|
+
safeReviewValue(entry, name, protectedFields, depth + 1),
|
|
59
|
+
]),
|
|
60
|
+
);
|
|
61
|
+
return value;
|
|
62
|
+
}
|
|
63
|
+
function valueText(value: unknown): string {
|
|
64
|
+
return typeof value === "string"
|
|
65
|
+
? value
|
|
66
|
+
: value === null
|
|
67
|
+
? "None"
|
|
68
|
+
: typeof value === "boolean"
|
|
69
|
+
? value
|
|
70
|
+
? "Yes"
|
|
71
|
+
: "No"
|
|
72
|
+
: (JSON.stringify(value) ?? "Unavailable");
|
|
73
|
+
}
|
|
74
|
+
const pointer = (name: string) => `/${name.replaceAll("~", "~0").replaceAll("/", "~1")}`;
|
|
75
|
+
// Long arbitrary property names remain readable without placing them in every
|
|
76
|
+
// preview or URL. An indexed segment opens their saved name and value together.
|
|
77
|
+
const fieldPointer = (key: string, index: number, parent = "") =>
|
|
78
|
+
pointer(key).length > 256 || parent.length + pointer(key).length > 1024
|
|
79
|
+
? `/~2${index}`
|
|
80
|
+
: pointer(key);
|
|
81
|
+
|
|
82
|
+
export function toolReviewFields(
|
|
83
|
+
argumentsValue: unknown,
|
|
84
|
+
context?: ToolReviewContext,
|
|
85
|
+
): { fields: ToolActionReview["fields"]; moreFields: number } {
|
|
86
|
+
const args = decodeReviewArguments(argumentsValue);
|
|
87
|
+
if (!args) return { fields: [], moreFields: 0 };
|
|
88
|
+
const entries = Object.entries(args);
|
|
89
|
+
if (context?.email) {
|
|
90
|
+
const email = toolReviewFields(context.email);
|
|
91
|
+
const original = toolReviewFields(args, { ...context, email: undefined });
|
|
92
|
+
const fields = [
|
|
93
|
+
...email.fields
|
|
94
|
+
.filter(
|
|
95
|
+
(field) =>
|
|
96
|
+
field.path !== "/contentSha256" && field.path !== "/htmlBody" && field.preview !== "",
|
|
97
|
+
)
|
|
98
|
+
.map((field) => ({
|
|
99
|
+
...field,
|
|
100
|
+
label: field.path === "/textBody" ? "Message" : field.label,
|
|
101
|
+
path: `/$email${field.path}`,
|
|
102
|
+
...(field.path === "/attachments"
|
|
103
|
+
? {
|
|
104
|
+
preview: context
|
|
105
|
+
.email!.attachments.map((attachment) => attachment.name)
|
|
106
|
+
.join(", ")
|
|
107
|
+
.slice(0, 240),
|
|
108
|
+
}
|
|
109
|
+
: {}),
|
|
110
|
+
})),
|
|
111
|
+
...original.fields.filter(
|
|
112
|
+
(field) =>
|
|
113
|
+
![
|
|
114
|
+
"/raw",
|
|
115
|
+
"/expectedContentSha256",
|
|
116
|
+
"/from",
|
|
117
|
+
"/to",
|
|
118
|
+
"/cc",
|
|
119
|
+
"/bcc",
|
|
120
|
+
"/subject",
|
|
121
|
+
"/body",
|
|
122
|
+
"/textBody",
|
|
123
|
+
"/htmlBody",
|
|
124
|
+
"/attachments",
|
|
125
|
+
].includes(field.path),
|
|
126
|
+
),
|
|
127
|
+
];
|
|
128
|
+
return {
|
|
129
|
+
fields: fields.slice(0, 16),
|
|
130
|
+
moreFields: original.moreFields + Math.max(0, fields.length - 16),
|
|
131
|
+
};
|
|
132
|
+
}
|
|
133
|
+
return {
|
|
134
|
+
moreFields: Math.max(0, entries.length - 16),
|
|
135
|
+
fields: entries.slice(0, 16).map(([key, value], index) => {
|
|
136
|
+
const hidden = protectedReviewField(key, context?.protectedFields);
|
|
137
|
+
const safe = hidden ? "[Protected value]" : value;
|
|
138
|
+
const count = !hidden && Array.isArray(value) ? value.length : undefined;
|
|
139
|
+
const compactList =
|
|
140
|
+
!hidden &&
|
|
141
|
+
Array.isArray(value) &&
|
|
142
|
+
value.length > 0 &&
|
|
143
|
+
value.length <= 4 &&
|
|
144
|
+
value.every(
|
|
145
|
+
(entry) =>
|
|
146
|
+
typeof entry === "string" || typeof entry === "number" || typeof entry === "boolean",
|
|
147
|
+
)
|
|
148
|
+
? value.map(valueText).join(", ")
|
|
149
|
+
: undefined;
|
|
150
|
+
const text =
|
|
151
|
+
compactList !== undefined
|
|
152
|
+
? compactList
|
|
153
|
+
: count !== undefined
|
|
154
|
+
? `${count.toLocaleString("en-US")} item${count === 1 ? "" : "s"}`
|
|
155
|
+
: safe && typeof safe === "object"
|
|
156
|
+
? `${Object.keys(safe).length} field${Object.keys(safe).length === 1 ? "" : "s"}`
|
|
157
|
+
: valueText(safe);
|
|
158
|
+
return {
|
|
159
|
+
path: fieldPointer(key, index),
|
|
160
|
+
label: bound(
|
|
161
|
+
(context?.fieldLabels && Object.hasOwn(context.fieldLabels, key)
|
|
162
|
+
? context.fieldLabels[key]
|
|
163
|
+
: undefined) ?? toolReviewFieldLabel(key),
|
|
164
|
+
256,
|
|
165
|
+
),
|
|
166
|
+
preview: bound(text, 240),
|
|
167
|
+
...(count !== undefined ? { count } : {}),
|
|
168
|
+
truncated:
|
|
169
|
+
!hidden &&
|
|
170
|
+
(text.length > 240 ||
|
|
171
|
+
(compactList === undefined && typeof value === "object" && value !== null)),
|
|
172
|
+
...(hidden ? { protected: true } : {}),
|
|
173
|
+
};
|
|
174
|
+
}),
|
|
175
|
+
};
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
/** Deterministic consequences from the reviewed bytes. Unknown fields remain visible. */
|
|
179
|
+
export function toolReviewAction(
|
|
180
|
+
toolName: string,
|
|
181
|
+
argumentsValue: unknown,
|
|
182
|
+
context?: ToolReviewContext,
|
|
183
|
+
): Pick<
|
|
184
|
+
ToolActionReview,
|
|
185
|
+
"title" | "approveLabel" | "effects" | "consequence" | "selectionCount" | "selectionKind"
|
|
186
|
+
> {
|
|
187
|
+
const fallback = {
|
|
188
|
+
title:
|
|
189
|
+
context?.title ??
|
|
190
|
+
bound(
|
|
191
|
+
toolReviewFieldLabel(
|
|
192
|
+
toolName.replace(/^mcp_[^_]+__/, "").replace(/^batch[_-](?=[a-z])/i, ""),
|
|
193
|
+
),
|
|
194
|
+
256,
|
|
195
|
+
),
|
|
196
|
+
approveLabel: "Approve action",
|
|
197
|
+
effects: [] as string[],
|
|
198
|
+
};
|
|
199
|
+
if (context?.kind !== "gmail") return fallback;
|
|
200
|
+
const args = decodeReviewArguments(argumentsValue);
|
|
201
|
+
if (!args) return fallback;
|
|
202
|
+
const thread = toolName.endsWith("_thread");
|
|
203
|
+
const selectionKind = thread ? ("threads" as const) : ("messages" as const);
|
|
204
|
+
const ids =
|
|
205
|
+
thread && typeof args.threadId === "string"
|
|
206
|
+
? [args.threadId]
|
|
207
|
+
: Array.isArray(args.messageIds)
|
|
208
|
+
? args.messageIds
|
|
209
|
+
: typeof args.messageId === "string"
|
|
210
|
+
? [args.messageId]
|
|
211
|
+
: null;
|
|
212
|
+
const selectionCount = ids?.every((id) => typeof id === "string") ? new Set(ids).size : undefined;
|
|
213
|
+
const noun =
|
|
214
|
+
selectionCount === undefined
|
|
215
|
+
? thread
|
|
216
|
+
? "conversations"
|
|
217
|
+
: "messages"
|
|
218
|
+
: `${selectionCount.toLocaleString("en-US")} ${thread ? "conversation" : "message"}${selectionCount === 1 ? "" : "s"}`;
|
|
219
|
+
const addValues = toolName.startsWith("label_") ? args.labelIds : args.addLabelIds;
|
|
220
|
+
const adds = Array.isArray(addValues)
|
|
221
|
+
? addValues.filter((v): v is string => typeof v === "string")
|
|
222
|
+
: [];
|
|
223
|
+
const removeValues = toolName.startsWith("unlabel_") ? args.labelIds : args.removeLabelIds;
|
|
224
|
+
const removes = Array.isArray(removeValues)
|
|
225
|
+
? removeValues.filter((v): v is string => typeof v === "string")
|
|
226
|
+
: [];
|
|
227
|
+
const labelEffect = (label: string, adding: boolean): string => {
|
|
228
|
+
const known: Record<string, [string, string]> = {
|
|
229
|
+
TRASH: ["Move to Trash", "Remove from Trash"],
|
|
230
|
+
INBOX: ["Move to Inbox", "Remove from Inbox"],
|
|
231
|
+
UNREAD: ["Mark as unread", "Mark as read"],
|
|
232
|
+
STARRED: ["Add star", "Remove star"],
|
|
233
|
+
SPAM: ["Mark as spam", "Remove from Spam"],
|
|
234
|
+
IMPORTANT: ["Mark as important", "Remove importance"],
|
|
235
|
+
};
|
|
236
|
+
return (
|
|
237
|
+
(Object.hasOwn(known, label) ? known[label]?.[adding ? 0 : 1] : undefined) ??
|
|
238
|
+
`${adding ? "Add" : "Remove"} label ${bound(label, 120)}`
|
|
239
|
+
);
|
|
240
|
+
};
|
|
241
|
+
const effects = [
|
|
242
|
+
...adds.map((id) => labelEffect(id, true)),
|
|
243
|
+
...removes.map((id) => labelEffect(id, false)),
|
|
244
|
+
];
|
|
245
|
+
if (
|
|
246
|
+
[
|
|
247
|
+
"batch_modify_messages",
|
|
248
|
+
"modify_message",
|
|
249
|
+
"modify_thread",
|
|
250
|
+
"label_message",
|
|
251
|
+
"label_thread",
|
|
252
|
+
"unlabel_message",
|
|
253
|
+
"unlabel_thread",
|
|
254
|
+
].includes(toolName)
|
|
255
|
+
) {
|
|
256
|
+
const trash = adds.includes("TRASH");
|
|
257
|
+
return {
|
|
258
|
+
title: trash ? `Move ${noun} to Trash` : `Update ${noun}`,
|
|
259
|
+
approveLabel: trash ? "Move to Trash" : "Apply changes",
|
|
260
|
+
effects,
|
|
261
|
+
...(selectionCount === undefined ? {} : { selectionCount, selectionKind }),
|
|
262
|
+
...(trash
|
|
263
|
+
? { consequence: "Messages stay recoverable in Trash until Gmail deletes them." }
|
|
264
|
+
: thread
|
|
265
|
+
? { consequence: "Applies to every message in the conversation." }
|
|
266
|
+
: {}),
|
|
267
|
+
};
|
|
268
|
+
}
|
|
269
|
+
if (["trash_message", "restore_message", "trash_thread", "restore_thread"].includes(toolName))
|
|
270
|
+
return {
|
|
271
|
+
title: toolName.startsWith("trash_") ? `Move ${noun} to Trash` : `Remove ${noun} from Trash`,
|
|
272
|
+
approveLabel: toolName.startsWith("trash_") ? "Move to Trash" : "Remove from Trash",
|
|
273
|
+
effects,
|
|
274
|
+
...(selectionCount === undefined ? {} : { selectionCount, selectionKind }),
|
|
275
|
+
};
|
|
276
|
+
const named: Record<string, [string, string]> = {
|
|
277
|
+
send_message: ["Send email", "Send email"],
|
|
278
|
+
send_draft: ["Send draft", "Send draft"],
|
|
279
|
+
create_draft: ["Create email draft", "Create draft"],
|
|
280
|
+
update_draft: ["Update email draft", "Update draft"],
|
|
281
|
+
delete_draft: ["Delete email draft", "Delete draft"],
|
|
282
|
+
create_label: ["Create label", "Create label"],
|
|
283
|
+
update_label: ["Update label", "Update label"],
|
|
284
|
+
delete_label: ["Delete label", "Delete label"],
|
|
285
|
+
};
|
|
286
|
+
const action = Object.hasOwn(named, toolName) ? named[toolName] : undefined;
|
|
287
|
+
return action ? { title: action[0], approveLabel: action[1], effects } : fallback;
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
/** A bounded slice of the immutable saved arguments; never evaluates a fresh provider query. */
|
|
291
|
+
export function toolReviewDetails(
|
|
292
|
+
argumentsValue: unknown,
|
|
293
|
+
context: ToolReviewContext | undefined,
|
|
294
|
+
path: string,
|
|
295
|
+
offset: number,
|
|
296
|
+
limit = 25,
|
|
297
|
+
): Omit<ToolReviewDetailsPage, "id" | "actionDigest" | "version"> {
|
|
298
|
+
if (
|
|
299
|
+
!Number.isSafeInteger(offset) ||
|
|
300
|
+
offset < 0 ||
|
|
301
|
+
!Number.isSafeInteger(limit) ||
|
|
302
|
+
limit < 1 ||
|
|
303
|
+
limit > 50
|
|
304
|
+
)
|
|
305
|
+
throw new Error("Invalid review page");
|
|
306
|
+
const args = decodeReviewArguments(argumentsValue);
|
|
307
|
+
let value: unknown = context?.email ? { ...args, $email: context.email } : args;
|
|
308
|
+
if (path !== "") {
|
|
309
|
+
if (!path.startsWith("/")) throw new Error("Invalid review field");
|
|
310
|
+
for (const escaped of path.slice(1).split("/")) {
|
|
311
|
+
if (/^~2\d+$/.test(escaped)) {
|
|
312
|
+
if (!value || typeof value !== "object" || Array.isArray(value))
|
|
313
|
+
throw new Error("Review field not found");
|
|
314
|
+
const selected = Object.entries(value)[Number(escaped.slice(2))];
|
|
315
|
+
if (!selected) throw new Error("Review field not found");
|
|
316
|
+
value = {
|
|
317
|
+
fieldName: selected[0],
|
|
318
|
+
value: protectedReviewField(selected[0], context?.protectedFields)
|
|
319
|
+
? "[Protected value]"
|
|
320
|
+
: selected[1],
|
|
321
|
+
};
|
|
322
|
+
continue;
|
|
323
|
+
}
|
|
324
|
+
const key = escaped.replaceAll("~1", "/").replaceAll("~0", "~");
|
|
325
|
+
if (protectedReviewField(key, context?.protectedFields)) {
|
|
326
|
+
value = "[Protected value]";
|
|
327
|
+
break;
|
|
328
|
+
}
|
|
329
|
+
if (!value || typeof value !== "object" || !Object.hasOwn(value, key))
|
|
330
|
+
throw new Error("Review field not found");
|
|
331
|
+
value = (value as Record<string, unknown>)[key];
|
|
332
|
+
}
|
|
333
|
+
}
|
|
334
|
+
type DetailItem = ToolReviewDetailsPage["items"][number];
|
|
335
|
+
const preview = (
|
|
336
|
+
entry: unknown,
|
|
337
|
+
key: string,
|
|
338
|
+
childPath: string,
|
|
339
|
+
): Pick<DetailItem, "value" | "truncated" | "path"> => {
|
|
340
|
+
const hidden = protectedReviewField(key, context?.protectedFields);
|
|
341
|
+
if (!hidden && entry !== null && typeof entry === "object") {
|
|
342
|
+
const count = Array.isArray(entry) ? entry.length : Object.keys(entry).length;
|
|
343
|
+
return {
|
|
344
|
+
value: `${count.toLocaleString("en-US")} ${Array.isArray(entry) ? (count === 1 ? "item" : "items") : count === 1 ? "field" : "fields"}`,
|
|
345
|
+
path: childPath,
|
|
346
|
+
truncated: true,
|
|
347
|
+
};
|
|
348
|
+
}
|
|
349
|
+
const text = valueText(safeReviewValue(entry, key, context?.protectedFields));
|
|
350
|
+
return {
|
|
351
|
+
value: bound(text, 4000),
|
|
352
|
+
...(hidden ? {} : { path: childPath }),
|
|
353
|
+
truncated: !hidden && text.length > 4000,
|
|
354
|
+
};
|
|
355
|
+
};
|
|
356
|
+
let total: number;
|
|
357
|
+
let items: DetailItem[];
|
|
358
|
+
if (Array.isArray(value)) {
|
|
359
|
+
total = value.length;
|
|
360
|
+
items = value.slice(offset, offset + limit).map((entry, index) => ({
|
|
361
|
+
label: `${offset + index + 1}`,
|
|
362
|
+
...preview(entry, "", `${path}/${offset + index}`),
|
|
363
|
+
}));
|
|
364
|
+
} else if (value && typeof value === "object") {
|
|
365
|
+
const entries = Object.entries(value);
|
|
366
|
+
total = entries.length;
|
|
367
|
+
items = entries.slice(offset, offset + limit).map(([key, entry], index) => ({
|
|
368
|
+
label: bound(
|
|
369
|
+
(context?.fieldLabels && Object.hasOwn(context.fieldLabels, key)
|
|
370
|
+
? context.fieldLabels[key]
|
|
371
|
+
: undefined) ?? toolReviewFieldLabel(key),
|
|
372
|
+
256,
|
|
373
|
+
),
|
|
374
|
+
...preview(entry, key, `${path}${fieldPointer(key, offset + index, path)}`),
|
|
375
|
+
}));
|
|
376
|
+
} else {
|
|
377
|
+
const text = valueText(value);
|
|
378
|
+
total = Math.max(1, Math.ceil(text.length / 4000));
|
|
379
|
+
items = Array.from({ length: Math.max(0, Math.min(limit, total - offset)) }, (_, index) => ({
|
|
380
|
+
label: `Part ${offset + index + 1}`,
|
|
381
|
+
value: text.slice((offset + index) * 4000, (offset + index + 1) * 4000),
|
|
382
|
+
}));
|
|
383
|
+
}
|
|
384
|
+
return { path, items, total, nextOffset: offset + limit < total ? offset + limit : null };
|
|
385
|
+
}
|