@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,799 @@
|
|
|
1
|
+
import {
|
|
2
|
+
retainedOutputUnavailable,
|
|
3
|
+
validateRetainedOutputEvidence
|
|
4
|
+
} from "./chunk-UH4K7GP7.js";
|
|
5
|
+
|
|
6
|
+
// src/event-preview.ts
|
|
7
|
+
var SESSION_EVENT_PAYLOAD_MAX_BYTES = 64 * 1024;
|
|
8
|
+
var TOOL_CALL_OUTPUT_EVENT_MAX_BYTES = 256 * 1024;
|
|
9
|
+
var TOOL_CALL_OUTPUT_EVENT_STRING_BYTES = 64 * 1024;
|
|
10
|
+
var TARGET_PAYLOAD_BYTES = 60 * 1024;
|
|
11
|
+
var DEFAULT_STRING_BYTES = 8 * 1024;
|
|
12
|
+
var RETRY_STRING_BYTES = 1024;
|
|
13
|
+
var DEFAULT_ARRAY_ENTRIES = 40;
|
|
14
|
+
var RETRY_ARRAY_ENTRIES = 12;
|
|
15
|
+
var DEFAULT_OBJECT_FIELDS = 80;
|
|
16
|
+
var RETRY_OBJECT_FIELDS = 32;
|
|
17
|
+
var MAX_PREVIEW_DEPTH = 12;
|
|
18
|
+
var MAX_PREVIEW_NODES = 512;
|
|
19
|
+
var MAX_MEASUREMENT_NODES = 2048;
|
|
20
|
+
var MAX_MEASUREMENT_DEPTH = 64;
|
|
21
|
+
var MAX_DETAIL_RECORDS = 24;
|
|
22
|
+
var APPROX_BYTES_PER_TOKEN = 4;
|
|
23
|
+
var encoder = new TextEncoder();
|
|
24
|
+
var IDENTITY_FIELDS = /* @__PURE__ */ new Set([
|
|
25
|
+
"id",
|
|
26
|
+
"callId",
|
|
27
|
+
"call_id",
|
|
28
|
+
"name",
|
|
29
|
+
"toolName",
|
|
30
|
+
"type",
|
|
31
|
+
"status",
|
|
32
|
+
"code",
|
|
33
|
+
"isError",
|
|
34
|
+
"stream",
|
|
35
|
+
"commandId",
|
|
36
|
+
"sequence"
|
|
37
|
+
]);
|
|
38
|
+
function sessionEventJsonBytes(value) {
|
|
39
|
+
return encoder.encode(stringifyForBoundary(value)).byteLength;
|
|
40
|
+
}
|
|
41
|
+
function measureSessionEventJson(value) {
|
|
42
|
+
return measureJsonBytes(value);
|
|
43
|
+
}
|
|
44
|
+
function approximateSessionEventTokens(bytes) {
|
|
45
|
+
return Math.ceil(Math.max(0, bytes) / APPROX_BYTES_PER_TOKEN);
|
|
46
|
+
}
|
|
47
|
+
function sessionEventMediaPreview(mediaType, inlineBytes) {
|
|
48
|
+
return {
|
|
49
|
+
type: "media_preview",
|
|
50
|
+
mediaType: mediaType || "application/octet-stream",
|
|
51
|
+
inlineBytes: inlineBytes === null ? null : Math.max(0, Math.floor(Number.isFinite(inlineBytes) ? inlineBytes : 0)),
|
|
52
|
+
fullOutputAvailable: false,
|
|
53
|
+
preview: "Inline media omitted from the audit timeline; source bytes were not retained."
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
function sessionEventMediaPreviewFromDataUrl(value) {
|
|
57
|
+
const match = /^data:([^;,]+)(?:;[^,]*)?;base64,/i.exec(value);
|
|
58
|
+
if (!match) return null;
|
|
59
|
+
const encodedLength = Math.max(0, value.length - match[0].length);
|
|
60
|
+
const padding = value.endsWith("==") ? 2 : value.endsWith("=") ? 1 : 0;
|
|
61
|
+
return sessionEventMediaPreview(
|
|
62
|
+
match[1] ?? "application/octet-stream",
|
|
63
|
+
Math.max(0, Math.floor(encodedLength * 3 / 4) - padding)
|
|
64
|
+
);
|
|
65
|
+
}
|
|
66
|
+
function sessionEventPayloadTruncation(payload) {
|
|
67
|
+
if (!isPlainRecord(payload)) return null;
|
|
68
|
+
const value = payload.truncation;
|
|
69
|
+
if (!isPlainRecord(value) || value.truncated !== true) return null;
|
|
70
|
+
return value;
|
|
71
|
+
}
|
|
72
|
+
function boundSessionEventPayload(payload, options = {}) {
|
|
73
|
+
const maxBytes = Math.max(1024, Math.floor(options.maxBytes ?? SESSION_EVENT_PAYLOAD_MAX_BYTES));
|
|
74
|
+
const surface = options.surface ?? "durable_audit";
|
|
75
|
+
const customStringBytes = options.stringBytes === void 0 ? null : Math.max(RETRY_STRING_BYTES, Math.floor(options.stringBytes));
|
|
76
|
+
const stringBytes = customStringBytes ?? DEFAULT_STRING_BYTES;
|
|
77
|
+
const retryStringBytes = customStringBytes === null ? RETRY_STRING_BYTES : Math.max(RETRY_STRING_BYTES, Math.floor(customStringBytes / 8));
|
|
78
|
+
const targetBytes = customStringBytes === null ? Math.min(maxBytes, TARGET_PAYLOAD_BYTES) : maxBytes;
|
|
79
|
+
const fullEvidence = validateRetainedOutputEvidence(options.fullEvidence) ?? retainedOutputUnavailable();
|
|
80
|
+
const originalMeasurement = measureJsonBytes(payload);
|
|
81
|
+
const originalBytes = originalMeasurement.bytes;
|
|
82
|
+
let state = previewState(stringBytes, DEFAULT_ARRAY_ENTRIES, DEFAULT_OBJECT_FIELDS);
|
|
83
|
+
let preview = previewValue(payload, state, "$", 0);
|
|
84
|
+
if (!state.changed && originalBytes !== null && originalBytes <= maxBytes) {
|
|
85
|
+
return payload;
|
|
86
|
+
}
|
|
87
|
+
let reason = payloadTruncationReason(originalMeasurement, state);
|
|
88
|
+
let bounded = attachTruncation(
|
|
89
|
+
preview,
|
|
90
|
+
boundaryMetadata(surface, reason, originalBytes, state, fullEvidence)
|
|
91
|
+
);
|
|
92
|
+
if (sessionEventJsonBytes(bounded) > targetBytes) {
|
|
93
|
+
state = previewState(retryStringBytes, RETRY_ARRAY_ENTRIES, RETRY_OBJECT_FIELDS);
|
|
94
|
+
preview = previewValue(payload, state, "$", 0);
|
|
95
|
+
reason = payloadTruncationReason(originalMeasurement, state);
|
|
96
|
+
bounded = attachTruncation(
|
|
97
|
+
preview,
|
|
98
|
+
boundaryMetadata(surface, reason, originalBytes, state, fullEvidence)
|
|
99
|
+
);
|
|
100
|
+
}
|
|
101
|
+
if (sessionEventJsonBytes(bounded) > maxBytes) {
|
|
102
|
+
const identity = identityPreview(payload);
|
|
103
|
+
state.changed = true;
|
|
104
|
+
recordDetail(state, {
|
|
105
|
+
path: "$",
|
|
106
|
+
kind: "object",
|
|
107
|
+
...originalBytes === null ? {} : { originalBytes }
|
|
108
|
+
});
|
|
109
|
+
bounded = attachTruncation(
|
|
110
|
+
{
|
|
111
|
+
...identity,
|
|
112
|
+
preview: "[event payload omitted: bounded audit preview exceeded the storage envelope]"
|
|
113
|
+
},
|
|
114
|
+
boundaryMetadata(surface, reason, originalBytes, state, fullEvidence)
|
|
115
|
+
);
|
|
116
|
+
}
|
|
117
|
+
settleDeliveredSizes(bounded, maxBytes);
|
|
118
|
+
return bounded;
|
|
119
|
+
}
|
|
120
|
+
function boundSessionEventPayloadForWrite(type, payload) {
|
|
121
|
+
if (type !== "agent.toolCall.output") return payload;
|
|
122
|
+
let bytes;
|
|
123
|
+
try {
|
|
124
|
+
bytes = sessionEventJsonBytes(payload);
|
|
125
|
+
} catch {
|
|
126
|
+
bytes = null;
|
|
127
|
+
}
|
|
128
|
+
if (bytes !== null && bytes <= TOOL_CALL_OUTPUT_EVENT_MAX_BYTES) return payload;
|
|
129
|
+
return boundSessionEventPayload(payload, {
|
|
130
|
+
surface: "durable_audit",
|
|
131
|
+
maxBytes: TOOL_CALL_OUTPUT_EVENT_MAX_BYTES,
|
|
132
|
+
stringBytes: TOOL_CALL_OUTPUT_EVENT_STRING_BYTES
|
|
133
|
+
});
|
|
134
|
+
}
|
|
135
|
+
function previewState(stringBytes, arrayEntries, objectFields) {
|
|
136
|
+
return {
|
|
137
|
+
changed: false,
|
|
138
|
+
sawMedia: false,
|
|
139
|
+
details: [],
|
|
140
|
+
stringBytes,
|
|
141
|
+
arrayEntries,
|
|
142
|
+
objectFields,
|
|
143
|
+
remainingNodes: MAX_PREVIEW_NODES
|
|
144
|
+
};
|
|
145
|
+
}
|
|
146
|
+
function payloadTruncationReason(measurement, state) {
|
|
147
|
+
if (state.sawMedia) return "inline_media_not_retained";
|
|
148
|
+
return measurement.bytes === null ? measurement.reason : "payload_bytes_exceeded";
|
|
149
|
+
}
|
|
150
|
+
function previewValue(value, state, path, depth) {
|
|
151
|
+
if (state.remainingNodes <= 0) {
|
|
152
|
+
state.changed = true;
|
|
153
|
+
recordDetail(state, { path, kind: "budget" });
|
|
154
|
+
return "[nested value omitted at audit preview traversal boundary]";
|
|
155
|
+
}
|
|
156
|
+
state.remainingNodes -= 1;
|
|
157
|
+
if (typeof value === "string") {
|
|
158
|
+
const media = inlineMediaFact(value);
|
|
159
|
+
if (media) {
|
|
160
|
+
state.changed = true;
|
|
161
|
+
state.sawMedia = true;
|
|
162
|
+
recordDetail(state, {
|
|
163
|
+
path,
|
|
164
|
+
kind: "media",
|
|
165
|
+
originalBytes: utf8Bytes(value),
|
|
166
|
+
deliveredBytes: sessionEventJsonBytes(media),
|
|
167
|
+
mediaType: media.mediaType
|
|
168
|
+
});
|
|
169
|
+
return media;
|
|
170
|
+
}
|
|
171
|
+
const originalBytes = utf8Bytes(value);
|
|
172
|
+
if (originalBytes <= state.stringBytes) return value;
|
|
173
|
+
state.changed = true;
|
|
174
|
+
const delivered = truncateUtf8Middle(value, state.stringBytes, originalBytes);
|
|
175
|
+
recordDetail(state, {
|
|
176
|
+
path,
|
|
177
|
+
kind: "string",
|
|
178
|
+
originalBytes,
|
|
179
|
+
deliveredBytes: utf8Bytes(delivered)
|
|
180
|
+
});
|
|
181
|
+
return delivered;
|
|
182
|
+
}
|
|
183
|
+
if (typeof value === "bigint" || typeof value === "function" || typeof value === "symbol") {
|
|
184
|
+
state.changed = true;
|
|
185
|
+
recordDetail(state, { path, kind: "unserializable" });
|
|
186
|
+
return `[${typeof value} value omitted at audit serialization boundary]`;
|
|
187
|
+
}
|
|
188
|
+
if (value === null || typeof value !== "object") return value;
|
|
189
|
+
const binary = binaryFact(value);
|
|
190
|
+
if (binary) {
|
|
191
|
+
state.changed = true;
|
|
192
|
+
recordDetail(state, {
|
|
193
|
+
path,
|
|
194
|
+
kind: "binary",
|
|
195
|
+
originalBytes: binary.originalBytes,
|
|
196
|
+
deliveredBytes: sessionEventJsonBytes(binary.preview)
|
|
197
|
+
});
|
|
198
|
+
return binary.preview;
|
|
199
|
+
}
|
|
200
|
+
if (depth >= MAX_PREVIEW_DEPTH) {
|
|
201
|
+
state.changed = true;
|
|
202
|
+
recordDetail(state, { path, kind: "depth" });
|
|
203
|
+
return "[nested value omitted at audit preview depth boundary]";
|
|
204
|
+
}
|
|
205
|
+
if (Array.isArray(value)) {
|
|
206
|
+
const keep = Math.max(2, state.arrayEntries);
|
|
207
|
+
if (value.length <= keep) {
|
|
208
|
+
return Array.from(
|
|
209
|
+
{ length: value.length },
|
|
210
|
+
(_, index) => previewArrayEntry(value, index, state, path, depth)
|
|
211
|
+
);
|
|
212
|
+
}
|
|
213
|
+
state.changed = true;
|
|
214
|
+
const head = Math.ceil(keep / 2);
|
|
215
|
+
const tail = Math.floor(keep / 2);
|
|
216
|
+
const omitted2 = value.length - head - tail;
|
|
217
|
+
recordDetail(state, { path, kind: "array", omittedEntries: omitted2 });
|
|
218
|
+
return [
|
|
219
|
+
...Array.from(
|
|
220
|
+
{ length: head },
|
|
221
|
+
(_, index) => previewArrayEntry(value, index, state, path, depth)
|
|
222
|
+
),
|
|
223
|
+
{ omittedEntries: omitted2, preview: "[middle array entries omitted]" },
|
|
224
|
+
...Array.from(
|
|
225
|
+
{ length: tail },
|
|
226
|
+
(_, index) => previewArrayEntry(value, value.length - tail + index, state, path, depth)
|
|
227
|
+
)
|
|
228
|
+
];
|
|
229
|
+
}
|
|
230
|
+
if (value instanceof Date) {
|
|
231
|
+
if (!hasCanonicalDateSerialization(value)) {
|
|
232
|
+
state.changed = true;
|
|
233
|
+
recordDetail(state, { path, kind: "unserializable" });
|
|
234
|
+
return "[Date value with custom serialization omitted at audit boundary]";
|
|
235
|
+
}
|
|
236
|
+
try {
|
|
237
|
+
const epoch = Date.prototype.getTime.call(value);
|
|
238
|
+
return Number.isFinite(epoch) ? Date.prototype.toISOString.call(value) : null;
|
|
239
|
+
} catch {
|
|
240
|
+
state.changed = true;
|
|
241
|
+
recordDetail(state, { path, kind: "unserializable" });
|
|
242
|
+
return "[Date value omitted at audit serialization boundary]";
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
const record = value;
|
|
246
|
+
const { entries, omitted, accessorKeys } = selectObjectEntries(record, state.objectFields);
|
|
247
|
+
for (const key of accessorKeys) {
|
|
248
|
+
state.changed = true;
|
|
249
|
+
recordDetail(state, {
|
|
250
|
+
path: `${path}.${key}`,
|
|
251
|
+
kind: "unserializable"
|
|
252
|
+
});
|
|
253
|
+
}
|
|
254
|
+
if (omitted) {
|
|
255
|
+
state.changed = true;
|
|
256
|
+
recordDetail(state, {
|
|
257
|
+
path,
|
|
258
|
+
kind: "object",
|
|
259
|
+
// Counting every remaining field would defeat the traversal bound. `null`
|
|
260
|
+
// is deliberate: at least one field was omitted, but its exact count is
|
|
261
|
+
// unknown because the source was not fully enumerated.
|
|
262
|
+
omittedEntries: null
|
|
263
|
+
});
|
|
264
|
+
}
|
|
265
|
+
const out = {};
|
|
266
|
+
for (const [key, entry] of entries) {
|
|
267
|
+
out[key] = previewValue(entry, state, `${path}.${key}`, depth + 1);
|
|
268
|
+
}
|
|
269
|
+
if (omitted) {
|
|
270
|
+
out.omittedFields = "additional fields omitted; exact count not measured";
|
|
271
|
+
}
|
|
272
|
+
return out;
|
|
273
|
+
}
|
|
274
|
+
function previewArrayEntry(value, index, state, path, depth) {
|
|
275
|
+
let descriptor;
|
|
276
|
+
try {
|
|
277
|
+
descriptor = Object.getOwnPropertyDescriptor(value, String(index));
|
|
278
|
+
} catch {
|
|
279
|
+
state.changed = true;
|
|
280
|
+
recordDetail(state, { path: `${path}[${index}]`, kind: "unserializable" });
|
|
281
|
+
return "[array element omitted at audit serialization boundary]";
|
|
282
|
+
}
|
|
283
|
+
if (descriptor && !("value" in descriptor)) {
|
|
284
|
+
state.changed = true;
|
|
285
|
+
recordDetail(state, { path: `${path}[${index}]`, kind: "unserializable" });
|
|
286
|
+
return "[array accessor value omitted at audit serialization boundary]";
|
|
287
|
+
}
|
|
288
|
+
return previewValue(
|
|
289
|
+
descriptor && "value" in descriptor ? descriptor.value : void 0,
|
|
290
|
+
state,
|
|
291
|
+
`${path}[${index}]`,
|
|
292
|
+
depth + 1
|
|
293
|
+
);
|
|
294
|
+
}
|
|
295
|
+
function selectObjectEntries(record, maxFields) {
|
|
296
|
+
const entries = [];
|
|
297
|
+
const selected = /* @__PURE__ */ new Set();
|
|
298
|
+
const accessorKeys = [];
|
|
299
|
+
const select = (key) => {
|
|
300
|
+
const descriptor = Object.getOwnPropertyDescriptor(record, key);
|
|
301
|
+
if (!descriptor?.enumerable) return false;
|
|
302
|
+
selected.add(key);
|
|
303
|
+
if ("value" in descriptor) {
|
|
304
|
+
entries.push([key, descriptor.value]);
|
|
305
|
+
} else {
|
|
306
|
+
entries.push([key, "[accessor value omitted at audit serialization boundary]"]);
|
|
307
|
+
accessorKeys.push(key);
|
|
308
|
+
}
|
|
309
|
+
return true;
|
|
310
|
+
};
|
|
311
|
+
try {
|
|
312
|
+
for (const key of IDENTITY_FIELDS) {
|
|
313
|
+
if (entries.length >= maxFields) break;
|
|
314
|
+
select(key);
|
|
315
|
+
}
|
|
316
|
+
for (const key in record) {
|
|
317
|
+
if (!Object.prototype.hasOwnProperty.call(record, key) || selected.has(key)) continue;
|
|
318
|
+
if (entries.length >= maxFields) {
|
|
319
|
+
return { entries, omitted: true, accessorKeys };
|
|
320
|
+
}
|
|
321
|
+
select(key);
|
|
322
|
+
}
|
|
323
|
+
} catch {
|
|
324
|
+
return { entries, omitted: true, accessorKeys };
|
|
325
|
+
}
|
|
326
|
+
return { entries, omitted: false, accessorKeys };
|
|
327
|
+
}
|
|
328
|
+
function attachTruncation(preview, truncation) {
|
|
329
|
+
if (isPlainRecord(preview)) {
|
|
330
|
+
return { ...preview, truncation };
|
|
331
|
+
}
|
|
332
|
+
return { value: preview, truncation };
|
|
333
|
+
}
|
|
334
|
+
function boundaryMetadata(surface, reason, originalBytes, state, fullEvidence) {
|
|
335
|
+
return {
|
|
336
|
+
truncated: true,
|
|
337
|
+
surface,
|
|
338
|
+
reason,
|
|
339
|
+
originalBytes,
|
|
340
|
+
deliveredBytes: 0,
|
|
341
|
+
omittedBytes: originalBytes,
|
|
342
|
+
estimatedOriginalTokens: originalBytes === null ? null : approximateSessionEventTokens(originalBytes),
|
|
343
|
+
estimatedDeliveredTokens: 0,
|
|
344
|
+
fullEvidence,
|
|
345
|
+
details: state.details
|
|
346
|
+
};
|
|
347
|
+
}
|
|
348
|
+
function settleDeliveredSizes(payload, maxBytes) {
|
|
349
|
+
const truncation = payload.truncation;
|
|
350
|
+
convergeDeliveredSizes(payload, truncation);
|
|
351
|
+
if (sessionEventJsonBytes(payload) > maxBytes) {
|
|
352
|
+
payload.preview = "[event payload omitted at audit byte boundary]";
|
|
353
|
+
for (const key of Object.keys(payload)) {
|
|
354
|
+
if (key !== "preview" && key !== "truncation" && IDENTITY_FIELDS.has(key) === false) {
|
|
355
|
+
delete payload[key];
|
|
356
|
+
}
|
|
357
|
+
}
|
|
358
|
+
truncation.details = truncation.details.slice(0, 4);
|
|
359
|
+
convergeDeliveredSizes(payload, truncation);
|
|
360
|
+
}
|
|
361
|
+
}
|
|
362
|
+
function convergeDeliveredSizes(payload, truncation) {
|
|
363
|
+
for (let attempt = 0; attempt < 16; attempt += 1) {
|
|
364
|
+
const deliveredBytes = sessionEventJsonBytes(payload);
|
|
365
|
+
const omittedBytes = truncation.originalBytes === null ? null : Math.max(0, truncation.originalBytes - deliveredBytes);
|
|
366
|
+
const estimatedDeliveredTokens = approximateSessionEventTokens(deliveredBytes);
|
|
367
|
+
if (truncation.deliveredBytes === deliveredBytes && truncation.omittedBytes === omittedBytes && truncation.estimatedDeliveredTokens === estimatedDeliveredTokens) {
|
|
368
|
+
return;
|
|
369
|
+
}
|
|
370
|
+
truncation.deliveredBytes = deliveredBytes;
|
|
371
|
+
truncation.omittedBytes = omittedBytes;
|
|
372
|
+
truncation.estimatedDeliveredTokens = estimatedDeliveredTokens;
|
|
373
|
+
}
|
|
374
|
+
throw new RangeError("Session event byte accounting did not converge");
|
|
375
|
+
}
|
|
376
|
+
function recordDetail(state, detail) {
|
|
377
|
+
if (state.details.length < MAX_DETAIL_RECORDS) state.details.push(detail);
|
|
378
|
+
}
|
|
379
|
+
function identityPreview(value) {
|
|
380
|
+
if (!isPlainRecord(value)) return {};
|
|
381
|
+
const out = {};
|
|
382
|
+
for (const key of IDENTITY_FIELDS) {
|
|
383
|
+
let field;
|
|
384
|
+
try {
|
|
385
|
+
const descriptor = Object.getOwnPropertyDescriptor(value, key);
|
|
386
|
+
if (!descriptor?.enumerable || !("value" in descriptor)) continue;
|
|
387
|
+
field = descriptor.value;
|
|
388
|
+
} catch {
|
|
389
|
+
continue;
|
|
390
|
+
}
|
|
391
|
+
if (typeof field === "string") {
|
|
392
|
+
out[key] = truncateUtf8Middle(field, 256, utf8Bytes(field));
|
|
393
|
+
} else if (typeof field === "number" || typeof field === "boolean" || field === null) {
|
|
394
|
+
out[key] = field;
|
|
395
|
+
}
|
|
396
|
+
}
|
|
397
|
+
return out;
|
|
398
|
+
}
|
|
399
|
+
function inlineMediaFact(value) {
|
|
400
|
+
return sessionEventMediaPreviewFromDataUrl(value);
|
|
401
|
+
}
|
|
402
|
+
function binaryFact(value) {
|
|
403
|
+
if (ArrayBuffer.isView(value)) {
|
|
404
|
+
return {
|
|
405
|
+
originalBytes: value.byteLength,
|
|
406
|
+
preview: {
|
|
407
|
+
type: "binary_preview",
|
|
408
|
+
byteLength: value.byteLength,
|
|
409
|
+
fullOutputAvailable: false,
|
|
410
|
+
preview: "Inline binary value omitted from the audit timeline; bytes were not retained."
|
|
411
|
+
}
|
|
412
|
+
};
|
|
413
|
+
}
|
|
414
|
+
if (value instanceof ArrayBuffer) {
|
|
415
|
+
return {
|
|
416
|
+
originalBytes: value.byteLength,
|
|
417
|
+
preview: {
|
|
418
|
+
type: "binary_preview",
|
|
419
|
+
byteLength: value.byteLength,
|
|
420
|
+
fullOutputAvailable: false,
|
|
421
|
+
preview: "Inline binary value omitted from the audit timeline; bytes were not retained."
|
|
422
|
+
}
|
|
423
|
+
};
|
|
424
|
+
}
|
|
425
|
+
return null;
|
|
426
|
+
}
|
|
427
|
+
function truncateUtf8Middle(value, maxBytes, knownBytes = utf8Bytes(value)) {
|
|
428
|
+
if (knownBytes <= maxBytes) return value;
|
|
429
|
+
let omittedBytes = Math.max(0, knownBytes - maxBytes);
|
|
430
|
+
for (let attempt = 0; attempt < 4; attempt += 1) {
|
|
431
|
+
const marker2 = `\u2026[${omittedBytes} bytes omitted]\u2026`;
|
|
432
|
+
const contentBudget2 = Math.max(0, maxBytes - utf8Bytes(marker2));
|
|
433
|
+
if (contentBudget2 === 0) return marker2;
|
|
434
|
+
const left2 = utf8Prefix(value, Math.floor(contentBudget2 / 2));
|
|
435
|
+
const right2 = utf8Suffix(value, contentBudget2 - left2.bytes);
|
|
436
|
+
const exactOmittedBytes = Math.max(0, knownBytes - left2.bytes - right2.bytes);
|
|
437
|
+
if (exactOmittedBytes === omittedBytes) {
|
|
438
|
+
return `${value.slice(0, left2.end)}${marker2}${value.slice(right2.start)}`;
|
|
439
|
+
}
|
|
440
|
+
omittedBytes = exactOmittedBytes;
|
|
441
|
+
}
|
|
442
|
+
const marker = `\u2026[${omittedBytes} bytes omitted]\u2026`;
|
|
443
|
+
const contentBudget = Math.max(0, maxBytes - utf8Bytes(marker));
|
|
444
|
+
const left = utf8Prefix(value, Math.floor(contentBudget / 2));
|
|
445
|
+
const right = utf8Suffix(value, contentBudget - left.bytes);
|
|
446
|
+
return `${value.slice(0, left.end)}${marker}${value.slice(right.start)}`;
|
|
447
|
+
}
|
|
448
|
+
function utf8Prefix(value, maxBytes) {
|
|
449
|
+
let end = 0;
|
|
450
|
+
let bytes = 0;
|
|
451
|
+
while (end < value.length) {
|
|
452
|
+
const unit = utf8UnitAt(value, end);
|
|
453
|
+
if (bytes + unit.bytes > maxBytes) break;
|
|
454
|
+
bytes += unit.bytes;
|
|
455
|
+
end += unit.codeUnits;
|
|
456
|
+
}
|
|
457
|
+
return { end, bytes };
|
|
458
|
+
}
|
|
459
|
+
function utf8Suffix(value, maxBytes) {
|
|
460
|
+
let start = value.length;
|
|
461
|
+
let bytes = 0;
|
|
462
|
+
while (start > 0) {
|
|
463
|
+
const unit = utf8UnitBefore(value, start);
|
|
464
|
+
if (bytes + unit.bytes > maxBytes) break;
|
|
465
|
+
bytes += unit.bytes;
|
|
466
|
+
start -= unit.codeUnits;
|
|
467
|
+
}
|
|
468
|
+
return { start, bytes };
|
|
469
|
+
}
|
|
470
|
+
function utf8UnitAt(value, index) {
|
|
471
|
+
const code = value.charCodeAt(index);
|
|
472
|
+
if (code <= 127) return { codeUnits: 1, bytes: 1 };
|
|
473
|
+
if (code <= 2047) return { codeUnits: 1, bytes: 2 };
|
|
474
|
+
if (code >= 55296 && code <= 56319) {
|
|
475
|
+
const next = index + 1 < value.length ? value.charCodeAt(index + 1) : 0;
|
|
476
|
+
if (next >= 56320 && next <= 57343) {
|
|
477
|
+
return { codeUnits: 2, bytes: 4 };
|
|
478
|
+
}
|
|
479
|
+
}
|
|
480
|
+
return { codeUnits: 1, bytes: 3 };
|
|
481
|
+
}
|
|
482
|
+
function utf8UnitBefore(value, end) {
|
|
483
|
+
const code = value.charCodeAt(end - 1);
|
|
484
|
+
if (code >= 56320 && code <= 57343 && end >= 2) {
|
|
485
|
+
const previous = value.charCodeAt(end - 2);
|
|
486
|
+
if (previous >= 55296 && previous <= 56319) {
|
|
487
|
+
return { codeUnits: 2, bytes: 4 };
|
|
488
|
+
}
|
|
489
|
+
}
|
|
490
|
+
if (code <= 127) return { codeUnits: 1, bytes: 1 };
|
|
491
|
+
if (code <= 2047) return { codeUnits: 1, bytes: 2 };
|
|
492
|
+
return { codeUnits: 1, bytes: 3 };
|
|
493
|
+
}
|
|
494
|
+
function utf8Bytes(value) {
|
|
495
|
+
let bytes = 0;
|
|
496
|
+
for (let index = 0; index < value.length; ) {
|
|
497
|
+
const unit = utf8UnitAt(value, index);
|
|
498
|
+
bytes += unit.bytes;
|
|
499
|
+
index += unit.codeUnits;
|
|
500
|
+
}
|
|
501
|
+
return bytes;
|
|
502
|
+
}
|
|
503
|
+
function measureJsonBytes(value) {
|
|
504
|
+
const state = {
|
|
505
|
+
remainingNodes: MAX_MEASUREMENT_NODES,
|
|
506
|
+
seen: /* @__PURE__ */ new WeakSet(),
|
|
507
|
+
failureReason: null
|
|
508
|
+
};
|
|
509
|
+
try {
|
|
510
|
+
const bytes = measureJsonValue(value, state, "top", 0);
|
|
511
|
+
return bytes === null ? {
|
|
512
|
+
bytes: null,
|
|
513
|
+
reason: state.failureReason ?? "payload_measurement_bounded"
|
|
514
|
+
} : { bytes, reason: null };
|
|
515
|
+
} catch {
|
|
516
|
+
return { bytes: null, reason: "payload_measurement_bounded" };
|
|
517
|
+
}
|
|
518
|
+
}
|
|
519
|
+
function measureJsonValue(value, state, position, depth) {
|
|
520
|
+
if (state.remainingNodes <= 0 || depth > MAX_MEASUREMENT_DEPTH) {
|
|
521
|
+
return failJsonMeasurement(state, "payload_measurement_bounded");
|
|
522
|
+
}
|
|
523
|
+
state.remainingNodes -= 1;
|
|
524
|
+
if (value === null) return 4;
|
|
525
|
+
if (typeof value === "string") return jsonStringBytes(value);
|
|
526
|
+
if (typeof value === "boolean") return value ? 4 : 5;
|
|
527
|
+
if (typeof value === "number") {
|
|
528
|
+
const serialized = JSON.stringify(value);
|
|
529
|
+
return serialized === void 0 ? null : serialized.length;
|
|
530
|
+
}
|
|
531
|
+
if (typeof value === "undefined" || typeof value === "function" || typeof value === "symbol") {
|
|
532
|
+
return position === "array" ? 4 : failJsonMeasurement(state, "payload_not_serializable");
|
|
533
|
+
}
|
|
534
|
+
if (typeof value === "bigint") {
|
|
535
|
+
return failJsonMeasurement(state, "payload_not_serializable");
|
|
536
|
+
}
|
|
537
|
+
if (typeof value !== "object") {
|
|
538
|
+
return failJsonMeasurement(state, "payload_not_serializable");
|
|
539
|
+
}
|
|
540
|
+
if (value instanceof Date) {
|
|
541
|
+
if (!hasCanonicalDateSerialization(value)) {
|
|
542
|
+
return failJsonMeasurement(state, "payload_measurement_bounded");
|
|
543
|
+
}
|
|
544
|
+
try {
|
|
545
|
+
const epoch = Date.prototype.getTime.call(value);
|
|
546
|
+
return Number.isFinite(epoch) ? jsonStringBytes(Date.prototype.toISOString.call(value)) : 4;
|
|
547
|
+
} catch {
|
|
548
|
+
return failJsonMeasurement(state, "payload_not_serializable");
|
|
549
|
+
}
|
|
550
|
+
}
|
|
551
|
+
if (ArrayBuffer.isView(value) || value instanceof ArrayBuffer) {
|
|
552
|
+
return failJsonMeasurement(state, "payload_measurement_bounded");
|
|
553
|
+
}
|
|
554
|
+
if (state.seen.has(value)) {
|
|
555
|
+
return failJsonMeasurement(state, "payload_not_serializable");
|
|
556
|
+
}
|
|
557
|
+
state.seen.add(value);
|
|
558
|
+
try {
|
|
559
|
+
if (Array.isArray(value)) {
|
|
560
|
+
if (Object.getPrototypeOf(value) !== Array.prototype) {
|
|
561
|
+
return failJsonMeasurement(state, "payload_measurement_bounded");
|
|
562
|
+
}
|
|
563
|
+
const toJson2 = Object.getOwnPropertyDescriptor(value, "toJSON");
|
|
564
|
+
if (toJson2 && ("get" in toJson2 || typeof toJson2.value === "function")) {
|
|
565
|
+
return failJsonMeasurement(state, "payload_measurement_bounded");
|
|
566
|
+
}
|
|
567
|
+
if (value.length > state.remainingNodes) {
|
|
568
|
+
return failJsonMeasurement(state, "payload_measurement_bounded");
|
|
569
|
+
}
|
|
570
|
+
let bytes2 = 2;
|
|
571
|
+
for (let index = 0; index < value.length; index += 1) {
|
|
572
|
+
if (index > 0) bytes2 += 1;
|
|
573
|
+
const descriptor = Object.getOwnPropertyDescriptor(value, String(index));
|
|
574
|
+
if (descriptor && !("value" in descriptor)) {
|
|
575
|
+
return failJsonMeasurement(state, "payload_measurement_bounded");
|
|
576
|
+
}
|
|
577
|
+
const entry = descriptor && "value" in descriptor ? descriptor.value : void 0;
|
|
578
|
+
const measured = measureJsonValue(entry, state, "array", depth + 1);
|
|
579
|
+
if (measured === null) return null;
|
|
580
|
+
bytes2 += measured;
|
|
581
|
+
}
|
|
582
|
+
return bytes2;
|
|
583
|
+
}
|
|
584
|
+
const prototype = Object.getPrototypeOf(value);
|
|
585
|
+
if (prototype !== Object.prototype && prototype !== null) {
|
|
586
|
+
return failJsonMeasurement(state, "payload_measurement_bounded");
|
|
587
|
+
}
|
|
588
|
+
const toJson = Object.getOwnPropertyDescriptor(value, "toJSON");
|
|
589
|
+
if (toJson && ("get" in toJson || typeof toJson.value === "function")) {
|
|
590
|
+
return failJsonMeasurement(state, "payload_measurement_bounded");
|
|
591
|
+
}
|
|
592
|
+
let bytes = 2;
|
|
593
|
+
let fields = 0;
|
|
594
|
+
try {
|
|
595
|
+
for (const key in value) {
|
|
596
|
+
if (!Object.prototype.hasOwnProperty.call(value, key)) continue;
|
|
597
|
+
if (state.remainingNodes <= 0) {
|
|
598
|
+
return failJsonMeasurement(state, "payload_measurement_bounded");
|
|
599
|
+
}
|
|
600
|
+
state.remainingNodes -= 1;
|
|
601
|
+
const descriptor = Object.getOwnPropertyDescriptor(value, key);
|
|
602
|
+
if (!descriptor || !("value" in descriptor)) {
|
|
603
|
+
return failJsonMeasurement(state, "payload_measurement_bounded");
|
|
604
|
+
}
|
|
605
|
+
const entry = descriptor.value;
|
|
606
|
+
if (typeof entry === "undefined" || typeof entry === "function" || typeof entry === "symbol") {
|
|
607
|
+
continue;
|
|
608
|
+
}
|
|
609
|
+
const measured = measureJsonValue(entry, state, "object", depth + 1);
|
|
610
|
+
if (measured === null) return null;
|
|
611
|
+
if (fields > 0) bytes += 1;
|
|
612
|
+
bytes += jsonStringBytes(key) + 1 + measured;
|
|
613
|
+
fields += 1;
|
|
614
|
+
}
|
|
615
|
+
} catch {
|
|
616
|
+
return null;
|
|
617
|
+
}
|
|
618
|
+
return bytes;
|
|
619
|
+
} finally {
|
|
620
|
+
state.seen.delete(value);
|
|
621
|
+
}
|
|
622
|
+
}
|
|
623
|
+
function hasCanonicalDateSerialization(value) {
|
|
624
|
+
try {
|
|
625
|
+
if (Object.getPrototypeOf(value) !== Date.prototype) return false;
|
|
626
|
+
return Object.getOwnPropertyDescriptor(value, "toJSON") === void 0;
|
|
627
|
+
} catch {
|
|
628
|
+
return false;
|
|
629
|
+
}
|
|
630
|
+
}
|
|
631
|
+
function failJsonMeasurement(state, reason) {
|
|
632
|
+
state.failureReason ??= reason;
|
|
633
|
+
return null;
|
|
634
|
+
}
|
|
635
|
+
function jsonStringBytes(value) {
|
|
636
|
+
let bytes = 2;
|
|
637
|
+
for (let index = 0; index < value.length; index += 1) {
|
|
638
|
+
const code = value.charCodeAt(index);
|
|
639
|
+
if (code === 34 || code === 92 || code === 8 || code === 9 || code === 10 || code === 12 || code === 13) {
|
|
640
|
+
bytes += 2;
|
|
641
|
+
} else if (code <= 31) {
|
|
642
|
+
bytes += 6;
|
|
643
|
+
} else if (code <= 127) {
|
|
644
|
+
bytes += 1;
|
|
645
|
+
} else if (code <= 2047) {
|
|
646
|
+
bytes += 2;
|
|
647
|
+
} else if (code >= 55296 && code <= 56319) {
|
|
648
|
+
const next = index + 1 < value.length ? value.charCodeAt(index + 1) : 0;
|
|
649
|
+
if (next >= 56320 && next <= 57343) {
|
|
650
|
+
bytes += 4;
|
|
651
|
+
index += 1;
|
|
652
|
+
} else {
|
|
653
|
+
bytes += 6;
|
|
654
|
+
}
|
|
655
|
+
} else if (code >= 56320 && code <= 57343) {
|
|
656
|
+
bytes += 6;
|
|
657
|
+
} else {
|
|
658
|
+
bytes += 3;
|
|
659
|
+
}
|
|
660
|
+
}
|
|
661
|
+
return bytes;
|
|
662
|
+
}
|
|
663
|
+
function serializeForBoundary(value) {
|
|
664
|
+
try {
|
|
665
|
+
const serialized = JSON.stringify(value);
|
|
666
|
+
return {
|
|
667
|
+
value: serialized === void 0 ? "null" : serialized,
|
|
668
|
+
serializable: serialized !== void 0
|
|
669
|
+
};
|
|
670
|
+
} catch {
|
|
671
|
+
return {
|
|
672
|
+
value: JSON.stringify("[unserializable event payload omitted]"),
|
|
673
|
+
serializable: false
|
|
674
|
+
};
|
|
675
|
+
}
|
|
676
|
+
}
|
|
677
|
+
function stringifyForBoundary(value) {
|
|
678
|
+
return serializeForBoundary(value).value;
|
|
679
|
+
}
|
|
680
|
+
function isPlainRecord(value) {
|
|
681
|
+
return Boolean(value && typeof value === "object" && !Array.isArray(value));
|
|
682
|
+
}
|
|
683
|
+
|
|
684
|
+
// src/workspace-control-event.ts
|
|
685
|
+
var WORKSPACE_CONTROL_REASON_MAX_BYTES = 8 * 1024;
|
|
686
|
+
var WORKSPACE_CONTROL_ACTOR_MAX_BYTES = 1024;
|
|
687
|
+
var WORKSPACE_CONTROL_EVENT_MAX_BYTES = 16 * 1024;
|
|
688
|
+
function workspaceControlUtf8Bytes(value) {
|
|
689
|
+
return new TextEncoder().encode(value).byteLength;
|
|
690
|
+
}
|
|
691
|
+
function boundWorkspaceControlEvent(event, options = {}) {
|
|
692
|
+
const existingFields = new Map(
|
|
693
|
+
(event.truncation?.fields ?? []).map((field) => [field.field, field])
|
|
694
|
+
);
|
|
695
|
+
const reason = event.reason === null ? null : boundWorkspaceControlText(event.reason, WORKSPACE_CONTROL_REASON_MAX_BYTES);
|
|
696
|
+
const actor = boundWorkspaceControlText(event.actor, WORKSPACE_CONTROL_ACTOR_MAX_BYTES);
|
|
697
|
+
const reasonBytes = reason === null ? 0 : workspaceControlUtf8Bytes(reason);
|
|
698
|
+
const actorBytes = workspaceControlUtf8Bytes(actor);
|
|
699
|
+
const reasonOriginalBytes = event.reason === null ? null : Math.max(
|
|
700
|
+
workspaceControlUtf8Bytes(event.reason),
|
|
701
|
+
normalizedWorkspaceControlOriginalBytes(options.reasonOriginalBytes),
|
|
702
|
+
existingFields.get("reason")?.originalBytes ?? 0
|
|
703
|
+
);
|
|
704
|
+
const actorOriginalBytes = Math.max(
|
|
705
|
+
workspaceControlUtf8Bytes(event.actor),
|
|
706
|
+
normalizedWorkspaceControlOriginalBytes(options.actorOriginalBytes),
|
|
707
|
+
existingFields.get("actor")?.originalBytes ?? 0
|
|
708
|
+
);
|
|
709
|
+
const fields = [];
|
|
710
|
+
if (reasonOriginalBytes !== null && reasonOriginalBytes > reasonBytes) {
|
|
711
|
+
fields.push({
|
|
712
|
+
field: "reason",
|
|
713
|
+
originalBytes: reasonOriginalBytes,
|
|
714
|
+
deliveredBytes: reasonBytes,
|
|
715
|
+
omittedBytes: reasonOriginalBytes - reasonBytes
|
|
716
|
+
});
|
|
717
|
+
}
|
|
718
|
+
if (actorOriginalBytes > actorBytes) {
|
|
719
|
+
fields.push({
|
|
720
|
+
field: "actor",
|
|
721
|
+
originalBytes: actorOriginalBytes,
|
|
722
|
+
deliveredBytes: actorBytes,
|
|
723
|
+
omittedBytes: actorOriginalBytes - actorBytes
|
|
724
|
+
});
|
|
725
|
+
}
|
|
726
|
+
if (fields.length === 0 && event.truncation == null) {
|
|
727
|
+
if (sessionEventJsonBytes(event) > WORKSPACE_CONTROL_EVENT_MAX_BYTES) {
|
|
728
|
+
throw new RangeError("Workspace control event exceeds its bounded envelope");
|
|
729
|
+
}
|
|
730
|
+
return event;
|
|
731
|
+
}
|
|
732
|
+
const truncation = {
|
|
733
|
+
truncated: true,
|
|
734
|
+
surface: event.truncation?.surface ?? options.surface ?? "durable_control",
|
|
735
|
+
deliveredBytes: 0,
|
|
736
|
+
fields,
|
|
737
|
+
fullEvidence: { available: false, reason: "not_retained" }
|
|
738
|
+
};
|
|
739
|
+
const bounded = {
|
|
740
|
+
...event,
|
|
741
|
+
reason,
|
|
742
|
+
actor,
|
|
743
|
+
truncation
|
|
744
|
+
};
|
|
745
|
+
settleWorkspaceControlDeliveredBytes(bounded, truncation);
|
|
746
|
+
const deliveredBytes = sessionEventJsonBytes(bounded);
|
|
747
|
+
if (deliveredBytes > WORKSPACE_CONTROL_EVENT_MAX_BYTES) {
|
|
748
|
+
throw new RangeError(
|
|
749
|
+
`Bounded workspace control event exceeds its final envelope (${deliveredBytes} > ${WORKSPACE_CONTROL_EVENT_MAX_BYTES} bytes)`
|
|
750
|
+
);
|
|
751
|
+
}
|
|
752
|
+
return bounded;
|
|
753
|
+
}
|
|
754
|
+
function boundWorkspaceControlText(value, maxBytes) {
|
|
755
|
+
const encoder2 = new TextEncoder();
|
|
756
|
+
const decoder = new TextDecoder();
|
|
757
|
+
const bytes = encoder2.encode(value);
|
|
758
|
+
if (bytes.byteLength <= maxBytes) return value;
|
|
759
|
+
const marker = "\u2026[truncated]";
|
|
760
|
+
const prefixBudget = Math.max(0, maxBytes - encoder2.encode(marker).byteLength);
|
|
761
|
+
let prefixEnd = Math.min(prefixBudget, bytes.byteLength);
|
|
762
|
+
while (prefixEnd > 0 && prefixEnd < bytes.byteLength && (bytes[prefixEnd] & 192) === 128) {
|
|
763
|
+
prefixEnd -= 1;
|
|
764
|
+
}
|
|
765
|
+
return `${decoder.decode(bytes.subarray(0, prefixEnd))}${marker}`;
|
|
766
|
+
}
|
|
767
|
+
function normalizedWorkspaceControlOriginalBytes(value) {
|
|
768
|
+
return value === null || value === void 0 || !Number.isFinite(value) ? 0 : Math.max(0, Math.floor(value));
|
|
769
|
+
}
|
|
770
|
+
function settleWorkspaceControlDeliveredBytes(event, truncation) {
|
|
771
|
+
for (let attempt = 0; attempt < 16; attempt += 1) {
|
|
772
|
+
const deliveredBytes2 = sessionEventJsonBytes(event);
|
|
773
|
+
if (truncation.deliveredBytes === deliveredBytes2) return;
|
|
774
|
+
truncation.deliveredBytes = deliveredBytes2;
|
|
775
|
+
}
|
|
776
|
+
const deliveredBytes = sessionEventJsonBytes(event);
|
|
777
|
+
if (truncation.deliveredBytes !== deliveredBytes) {
|
|
778
|
+
throw new RangeError("Workspace control event byte accounting did not converge");
|
|
779
|
+
}
|
|
780
|
+
}
|
|
781
|
+
|
|
782
|
+
export {
|
|
783
|
+
SESSION_EVENT_PAYLOAD_MAX_BYTES,
|
|
784
|
+
TOOL_CALL_OUTPUT_EVENT_MAX_BYTES,
|
|
785
|
+
sessionEventJsonBytes,
|
|
786
|
+
measureSessionEventJson,
|
|
787
|
+
approximateSessionEventTokens,
|
|
788
|
+
sessionEventMediaPreview,
|
|
789
|
+
sessionEventMediaPreviewFromDataUrl,
|
|
790
|
+
sessionEventPayloadTruncation,
|
|
791
|
+
boundSessionEventPayload,
|
|
792
|
+
boundSessionEventPayloadForWrite,
|
|
793
|
+
WORKSPACE_CONTROL_REASON_MAX_BYTES,
|
|
794
|
+
WORKSPACE_CONTROL_ACTOR_MAX_BYTES,
|
|
795
|
+
WORKSPACE_CONTROL_EVENT_MAX_BYTES,
|
|
796
|
+
workspaceControlUtf8Bytes,
|
|
797
|
+
boundWorkspaceControlEvent
|
|
798
|
+
};
|
|
799
|
+
//# sourceMappingURL=chunk-4YDDHSO2.js.map
|