@capybara-hq/kernel 0.1.0-rc.9 → 0.1.0-rc.91
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/bootstrap.json +55 -28
- package/dist/admin/admin-agents.controller.d.ts +28 -0
- package/dist/admin/admin-agents.controller.js +79 -0
- package/dist/admin/admin-connectors.controller.d.ts +29 -0
- package/dist/admin/admin-connectors.controller.js +79 -0
- package/dist/admin/admin-items.schemas.d.ts +42 -0
- package/dist/admin/admin-items.schemas.js +48 -0
- package/dist/admin/admin.controller.d.ts +26 -27
- package/dist/admin/admin.controller.js +60 -41
- package/dist/admin/admin.module.d.ts +6 -1
- package/dist/admin/admin.module.js +72 -4
- package/dist/admin/admin.schemas.d.ts +53 -0
- package/dist/admin/admin.schemas.js +6 -2
- package/dist/admin/audit-log.service.d.ts +52 -0
- package/dist/admin/audit-log.service.js +81 -0
- package/dist/admin/audit.controller.d.ts +26 -0
- package/dist/admin/audit.controller.js +72 -0
- package/dist/admin/audit.schemas.d.ts +16 -0
- package/dist/admin/audit.schemas.js +37 -0
- package/dist/admin/extensions.controller.d.ts +34 -11
- package/dist/admin/extensions.controller.js +74 -27
- package/dist/admin/extensions.schemas.d.ts +21 -0
- package/dist/admin/extensions.schemas.js +39 -0
- package/dist/admin/health.service.d.ts +111 -0
- package/dist/admin/health.service.js +282 -0
- package/dist/admin/org-network.controller.d.ts +30 -0
- package/dist/admin/org-network.controller.js +77 -0
- package/dist/admin/org-network.schemas.d.ts +16 -0
- package/dist/admin/org-network.schemas.js +27 -0
- package/dist/admin/org-network.service.d.ts +43 -0
- package/dist/admin/org-network.service.js +109 -0
- package/dist/admin/outbox-dead.controller.d.ts +21 -0
- package/dist/admin/outbox-dead.controller.js +65 -0
- package/dist/admin/outbox-dead.schemas.d.ts +24 -0
- package/dist/admin/outbox-dead.schemas.js +42 -0
- package/dist/admin/outbox-dead.service.d.ts +81 -0
- package/dist/admin/outbox-dead.service.js +264 -0
- package/dist/admin/overview.controller.d.ts +31 -0
- package/dist/admin/overview.controller.js +78 -0
- package/dist/admin/overview.schemas.d.ts +8 -0
- package/dist/admin/overview.schemas.js +13 -0
- package/dist/admin/overview.service.d.ts +147 -0
- package/dist/admin/overview.service.js +256 -0
- package/dist/admin/usage.service.d.ts +149 -0
- package/dist/admin/usage.service.js +321 -0
- package/dist/agents/admin-agents.d.ts +106 -0
- package/dist/agents/admin-agents.js +234 -0
- package/dist/agents/agent-lookup.d.ts +10 -2
- package/dist/agents/agent-lookup.js +26 -11
- package/dist/agents/agent-profile.service.d.ts +5 -2
- package/dist/agents/agent-profile.service.js +16 -2
- package/dist/agents/agents.controller.d.ts +5 -13
- package/dist/agents/agents.controller.js +9 -17
- package/dist/agents/agents.module.d.ts +4 -3
- package/dist/agents/agents.module.js +16 -3
- package/dist/agents/agents.schemas.d.ts +73 -12
- package/dist/agents/agents.schemas.js +20 -1
- package/dist/agents/agents.service.d.ts +73 -8
- package/dist/agents/agents.service.js +241 -72
- package/dist/agents/avatar-view.d.ts +8 -0
- package/dist/agents/avatar-view.js +12 -0
- package/dist/agents/definition.d.ts +54 -37
- package/dist/agents/definition.js +103 -234
- package/dist/agents/from-template.d.ts +6 -3
- package/dist/agents/from-template.js +58 -45
- package/dist/agents/instruction-files.js +0 -3
- package/dist/agents/models.controller.d.ts +5 -1
- package/dist/agents/models.controller.js +22 -5
- package/dist/agents/org-templates.js +100 -39
- package/dist/agents/pending-connector-requests.js +6 -0
- package/dist/agents/pending-connectors.service.js +3 -1
- package/dist/agents/profile.d.ts +38 -13
- package/dist/agents/profile.js +31 -20
- package/dist/agents/readiness.controller.d.ts +9 -19
- package/dist/agents/readiness.controller.js +12 -25
- package/dist/agents/readiness.service.d.ts +81 -0
- package/dist/agents/readiness.service.js +121 -0
- package/dist/agents/templates.js +9 -20
- package/dist/app.d.ts +6 -0
- package/dist/app.js +4 -0
- package/dist/attribution/platform-attribution.d.ts +113 -0
- package/dist/attribution/platform-attribution.js +166 -0
- package/dist/background/background.module.js +2 -2
- package/dist/background/finish.d.ts +16 -3
- package/dist/background/finish.js +74 -6
- package/dist/background/launch-lock.d.ts +1 -1
- package/dist/background/launch-lock.js +1 -1
- package/dist/background/launch.d.ts +32 -20
- package/dist/background/launch.js +59 -43
- package/dist/background/managed-output.d.ts +110 -0
- package/dist/background/managed-output.js +219 -0
- package/dist/background/managed.d.ts +56 -0
- package/dist/background/managed.js +131 -0
- package/dist/background/poll.job.d.ts +51 -11
- package/dist/background/poll.job.js +226 -64
- package/dist/background/render.d.ts +9 -0
- package/dist/background/render.js +20 -0
- package/dist/background/retire-legacy-tasks.job.d.ts +57 -0
- package/dist/background/retire-legacy-tasks.job.js +149 -0
- package/dist/background/session.d.ts +3 -44
- package/dist/background/session.js +3 -76
- package/dist/background/stop.d.ts +88 -26
- package/dist/background/stop.js +240 -91
- package/dist/background/store.d.ts +164 -59
- package/dist/background/store.js +350 -122
- package/dist/background/tasks.service.d.ts +65 -11
- package/dist/background/tasks.service.js +146 -77
- package/dist/background/wake-rules.d.ts +5 -0
- package/dist/background/wake-rules.js +19 -6
- package/dist/catalog/admin-catalog.controller.d.ts +75 -14
- package/dist/catalog/admin-catalog.controller.js +141 -17
- package/dist/catalog/admin-catalog.schemas.d.ts +17 -0
- package/dist/catalog/admin-catalog.schemas.js +21 -0
- package/dist/catalog/appearance.schemas.d.ts +10 -0
- package/dist/catalog/appearance.schemas.js +20 -0
- package/dist/catalog/appearance.service.d.ts +105 -0
- package/dist/catalog/appearance.service.js +304 -0
- package/dist/catalog/catalog-content.d.ts +92 -17
- package/dist/catalog/catalog-content.js +96 -66
- package/dist/catalog/catalog-files.d.ts +42 -0
- package/dist/catalog/catalog-files.js +89 -0
- package/dist/catalog/catalog-import.module.d.ts +1 -1
- package/dist/catalog/catalog-import.module.js +4 -5
- package/dist/catalog/catalog-items.d.ts +11 -0
- package/dist/catalog/catalog-items.js +29 -3
- package/dist/catalog/catalog-scope.service.d.ts +95 -43
- package/dist/catalog/catalog-scope.service.js +278 -135
- package/dist/catalog/catalog.module.d.ts +5 -2
- package/dist/catalog/catalog.module.js +34 -7
- package/dist/catalog/catalog.service.d.ts +43 -6
- package/dist/catalog/catalog.service.js +113 -17
- package/dist/catalog/claude/report.d.ts +9 -2
- package/dist/catalog/claude/report.js +1 -0
- package/dist/catalog/claude/translate.js +5 -2
- package/dist/catalog/cli.d.ts +7 -10
- package/dist/catalog/cli.js +13 -29
- package/dist/catalog/component-promotion.js +3 -2
- package/dist/catalog/component-scope.controller.d.ts +24 -18
- package/dist/catalog/component-scope.controller.js +41 -13
- package/dist/catalog/component-scope.schemas.d.ts +4 -0
- package/dist/catalog/component-scope.schemas.js +2 -0
- package/dist/catalog/component-scope.service.d.ts +82 -10
- package/dist/catalog/component-scope.service.js +193 -31
- package/dist/catalog/component-state.d.ts +68 -7
- package/dist/catalog/component-state.js +110 -24
- package/dist/catalog/credential-key.d.ts +10 -0
- package/dist/catalog/credential-key.js +28 -0
- package/dist/catalog/git-source.d.ts +25 -1
- package/dist/catalog/git-source.js +77 -8
- package/dist/catalog/install-status.d.ts +6 -0
- package/dist/catalog/install-status.js +6 -0
- package/dist/catalog/job-ids.d.ts +38 -25
- package/dist/catalog/job-ids.js +40 -20
- package/dist/catalog/jobs.d.ts +12 -3
- package/dist/catalog/jobs.js +28 -7
- package/dist/catalog/marketplace-fetch.d.ts +6 -3
- package/dist/catalog/marketplace-fetch.js +5 -2
- package/dist/catalog/marketplace-icons.d.ts +64 -0
- package/dist/catalog/marketplace-icons.js +131 -0
- package/dist/catalog/marketplaces.controller.d.ts +29 -6
- package/dist/catalog/marketplaces.controller.js +84 -18
- package/dist/catalog/marketplaces.schemas.d.ts +7 -0
- package/dist/catalog/marketplaces.schemas.js +13 -0
- package/dist/catalog/marketplaces.service.d.ts +112 -14
- package/dist/catalog/marketplaces.service.js +462 -39
- package/dist/catalog/org-catalog.controller.d.ts +43 -40
- package/dist/catalog/org-catalog.controller.js +81 -50
- package/dist/catalog/org-catalog.schemas.d.ts +67 -18
- package/dist/catalog/org-catalog.schemas.js +97 -6
- package/dist/catalog/org-catalog.service.d.ts +12 -1
- package/dist/catalog/org-catalog.service.js +68 -42
- package/dist/catalog/org-extension-switch.d.ts +11 -11
- package/dist/catalog/org-extension-switch.js +67 -59
- package/dist/catalog/org-extension.controller.d.ts +36 -31
- package/dist/catalog/org-extension.controller.js +66 -47
- package/dist/catalog/org-extension.schemas.d.ts +30 -0
- package/dist/catalog/org-extension.schemas.js +63 -0
- package/dist/catalog/org-plugin-uploads.controller.d.ts +2 -6
- package/dist/catalog/org-plugin-uploads.controller.js +0 -1
- package/dist/catalog/org-plugin-uploads.d.ts +18 -13
- package/dist/catalog/org-plugin-uploads.js +17 -17
- package/dist/catalog/org-plugin-uploads.schemas.d.ts +0 -1
- package/dist/catalog/org-plugin-uploads.schemas.js +2 -2
- package/dist/catalog/owned-items.d.ts +6 -13
- package/dist/catalog/owned-items.js +29 -33
- package/dist/catalog/owned-plugin-cleanup.d.ts +8 -17
- package/dist/catalog/owned-plugin-cleanup.js +12 -66
- package/dist/catalog/ownership.js +2 -0
- package/dist/catalog/platform-components.d.ts +73 -32
- package/dist/catalog/platform-components.js +175 -81
- package/dist/catalog/platform-import-update.d.ts +50 -0
- package/dist/catalog/platform-import-update.js +116 -0
- package/dist/catalog/plugin-import.d.ts +170 -51
- package/dist/catalog/plugin-import.js +400 -203
- package/dist/catalog/plugin-install.d.ts +144 -135
- package/dist/catalog/plugin-install.js +392 -406
- package/dist/catalog/plugin-package.d.ts +55 -13
- package/dist/catalog/plugin-package.js +227 -33
- package/dist/catalog/plugin-upgrade.d.ts +149 -22
- package/dist/catalog/plugin-upgrade.js +444 -100
- package/dist/catalog/request-rules.js +6 -0
- package/dist/catalog/requests.service.d.ts +72 -10
- package/dist/catalog/requests.service.js +237 -16
- package/dist/catalog/reserved-names.js +3 -9
- package/dist/catalog/scope-jobs.d.ts +59 -0
- package/dist/catalog/scope-jobs.js +78 -0
- package/dist/catalog/scope-orgs.d.ts +1 -1
- package/dist/catalog/scope-orgs.js +2 -2
- package/dist/catalog/scope-sync-workers.d.ts +23 -0
- package/dist/catalog/scope-sync-workers.js +73 -2
- package/dist/catalog/scope-sync.d.ts +89 -111
- package/dist/catalog/scope-sync.js +187 -251
- package/dist/catalog/template-connector-ensure.d.ts +100 -0
- package/dist/catalog/template-connector-ensure.js +285 -0
- package/dist/catalog/template-connector-jobs.d.ts +28 -0
- package/dist/catalog/template-connector-jobs.js +54 -0
- package/dist/catalog/template-connector-reconcile.d.ts +44 -0
- package/dist/catalog/template-connector-reconcile.js +114 -0
- package/dist/catalog/template-connectors.processor.d.ts +32 -0
- package/dist/catalog/template-connectors.processor.js +101 -0
- package/dist/catalog/template-description.d.ts +17 -0
- package/dist/catalog/template-description.js +18 -0
- package/dist/catalog/unshare.d.ts +3 -4
- package/dist/catalog/unshare.js +9 -8
- package/dist/channels/actions.d.ts +2 -0
- package/dist/channels/actions.js +51 -8
- package/dist/channels/cards.d.ts +88 -9
- package/dist/channels/cards.js +269 -31
- package/dist/channels/channels.module.d.ts +13 -9
- package/dist/channels/channels.module.js +36 -13
- package/dist/channels/channels.schemas.d.ts +11 -0
- package/dist/channels/channels.schemas.js +14 -0
- package/dist/channels/connections.controller.d.ts +45 -9
- package/dist/channels/connections.controller.js +76 -12
- package/dist/channels/connections.service.d.ts +115 -16
- package/dist/channels/connections.service.js +264 -27
- package/dist/channels/deliver-job.d.ts +32 -0
- package/dist/channels/deliver-job.js +29 -0
- package/dist/channels/features.d.ts +2 -0
- package/dist/channels/features.js +9 -5
- package/dist/channels/file-delivery.d.ts +76 -0
- package/dist/channels/file-delivery.js +176 -0
- package/dist/channels/inbound.d.ts +19 -33
- package/dist/channels/inbound.js +109 -56
- package/dist/channels/job-ids.d.ts +2 -6
- package/dist/channels/job-ids.js +2 -6
- package/dist/channels/jobs.d.ts +37 -20
- package/dist/channels/jobs.js +80 -27
- package/dist/channels/outbound.d.ts +45 -5
- package/dist/channels/outbound.js +383 -29
- package/dist/channels/phrases.d.ts +250 -42
- package/dist/channels/phrases.js +216 -39
- package/dist/channels/supervisor.d.ts +4 -3
- package/dist/channels/supervisor.js +7 -3
- package/dist/channels/threads.d.ts +16 -3
- package/dist/channels/threads.js +39 -3
- package/dist/channels/webhook.d.ts +21 -1
- package/dist/channels/webhook.js +39 -4
- package/dist/client/client-access.service.d.ts +102 -0
- package/dist/client/client-access.service.js +303 -0
- package/dist/client/client-builds.service.d.ts +109 -0
- package/dist/client/client-builds.service.js +229 -0
- package/dist/client/client-delivery.controller.d.ts +25 -0
- package/dist/client/client-delivery.controller.js +66 -0
- package/dist/client/client-files.d.ts +48 -0
- package/dist/client/client-files.js +136 -0
- package/dist/client/client-reports.cron.d.ts +13 -0
- package/dist/client/client-reports.cron.js +42 -0
- package/dist/client/client-reports.service.d.ts +30 -0
- package/dist/client/client-reports.service.js +106 -0
- package/dist/client/client-sign-in.service.d.ts +21 -0
- package/dist/client/client-sign-in.service.js +49 -0
- package/dist/client/client.controller.d.ts +49 -0
- package/dist/client/client.controller.js +129 -0
- package/dist/client/client.module.d.ts +8 -0
- package/dist/client/client.module.js +28 -0
- package/dist/client/client.schemas.d.ts +61 -0
- package/dist/client/client.schemas.js +27 -0
- package/dist/config/docs.js +1 -1
- package/dist/config/env.js +19 -1
- package/dist/config/fields.js +20 -4
- package/dist/config/load.d.ts +32 -2
- package/dist/config/load.js +105 -4
- package/dist/config/permission-migration.d.ts +34 -0
- package/dist/config/permission-migration.js +115 -0
- package/dist/config/product-name.d.ts +8 -0
- package/dist/config/product-name.js +9 -0
- package/dist/config/schema.d.ts +142 -54
- package/dist/config/schema.js +709 -113
- package/dist/conversations/access.d.ts +14 -5
- package/dist/conversations/access.js +30 -20
- package/dist/conversations/agent-tree.d.ts +16 -0
- package/dist/conversations/agent-tree.js +36 -0
- package/dist/conversations/approval-profile.d.ts +30 -0
- package/dist/conversations/approval-profile.js +62 -0
- package/dist/conversations/attachments.controller.d.ts +11 -3
- package/dist/conversations/attachments.controller.js +18 -5
- package/dist/conversations/attachments.service.d.ts +169 -10
- package/dist/conversations/attachments.service.js +575 -127
- package/dist/conversations/conversations.controller.d.ts +55 -61
- package/dist/conversations/conversations.controller.js +97 -72
- package/dist/conversations/conversations.module.d.ts +1 -1
- package/dist/conversations/conversations.module.js +23 -7
- package/dist/conversations/conversations.schemas.d.ts +21 -0
- package/dist/conversations/conversations.schemas.js +27 -1
- package/dist/conversations/conversations.service.d.ts +286 -44
- package/dist/conversations/conversations.service.js +594 -135
- package/dist/conversations/delivery-scope.d.ts +34 -0
- package/dist/conversations/delivery-scope.js +23 -0
- package/dist/conversations/{environment-status.d.ts → device-status.d.ts} +9 -9
- package/dist/conversations/{environment-status.js → device-status.js} +18 -18
- package/dist/conversations/event-log.d.ts +67 -13
- package/dist/conversations/event-log.js +148 -25
- package/dist/conversations/event-people.d.ts +12 -0
- package/dist/conversations/event-people.js +28 -0
- package/dist/conversations/events.d.ts +1050 -42
- package/dist/conversations/events.js +1066 -106
- package/dist/conversations/files.d.ts +82 -12
- package/dist/conversations/files.js +211 -54
- package/dist/conversations/leak-check.d.ts +26 -0
- package/dist/conversations/leak-check.js +69 -0
- package/dist/conversations/media-types.d.ts +25 -0
- package/dist/conversations/media-types.js +38 -0
- package/dist/conversations/message-context.d.ts +57 -3
- package/dist/conversations/message-context.js +102 -9
- package/dist/conversations/model-image.d.ts +39 -0
- package/dist/conversations/model-image.js +80 -0
- package/dist/conversations/permission-profile-store.d.ts +50 -0
- package/dist/conversations/permission-profile-store.js +67 -0
- package/dist/conversations/permission-profile-store.module.d.ts +2 -0
- package/dist/conversations/permission-profile-store.module.js +19 -0
- package/dist/conversations/permission-profiles.controller.d.ts +97 -0
- package/dist/conversations/permission-profiles.controller.js +105 -0
- package/dist/conversations/permission-profiles.schemas.d.ts +31 -0
- package/dist/conversations/permission-profiles.schemas.js +23 -0
- package/dist/conversations/permission-profiles.service.d.ts +69 -0
- package/dist/conversations/permission-profiles.service.js +191 -0
- package/dist/conversations/prompt-suggestion-request.d.ts +95 -0
- package/dist/conversations/prompt-suggestion-request.js +213 -0
- package/dist/conversations/prompt-suggestion-store.d.ts +51 -0
- package/dist/conversations/prompt-suggestion-store.js +136 -0
- package/dist/conversations/prompt-suggestions.d.ts +153 -0
- package/dist/conversations/prompt-suggestions.js +565 -0
- package/dist/conversations/queue.d.ts +18 -3
- package/dist/conversations/queue.js +30 -3
- package/dist/conversations/queue.service.d.ts +20 -9
- package/dist/conversations/queue.service.js +98 -29
- package/dist/conversations/source.d.ts +10 -0
- package/dist/conversations/source.js +19 -0
- package/dist/conversations/titles.d.ts +21 -8
- package/dist/conversations/titles.js +67 -24
- package/dist/conversations/tree.d.ts +10 -0
- package/dist/conversations/tree.js +41 -0
- package/dist/ctx/bus.js +5 -3
- package/dist/ctx/create-ctx.d.ts +109 -14
- package/dist/ctx/create-ctx.js +338 -55
- package/dist/ctx/device-provider-check.d.ts +11 -0
- package/dist/ctx/device-provider-check.js +36 -0
- package/dist/ctx/net.d.ts +50 -0
- package/dist/ctx/net.js +67 -0
- package/dist/ctx/queue.js +4 -2
- package/dist/ctx/secrets.d.ts +41 -5
- package/dist/ctx/secrets.js +140 -30
- package/dist/db/kernel-schema.d.ts +821 -69
- package/dist/db/pool.d.ts +6 -0
- package/dist/db/pool.js +3 -2
- package/dist/device-access/device-access.module.d.ts +7 -0
- package/dist/device-access/device-access.module.js +41 -0
- package/dist/device-access/device-access.service.d.ts +145 -0
- package/dist/device-access/device-access.service.js +493 -0
- package/dist/device-access/token.d.ts +6 -0
- package/dist/device-access/token.js +6 -0
- package/dist/device-access/viewer-routes.d.ts +45 -0
- package/dist/device-access/viewer-routes.js +81 -0
- package/dist/device-access/viewer.d.ts +244 -0
- package/dist/device-access/viewer.js +845 -0
- package/dist/devices/access.d.ts +35 -0
- package/dist/devices/access.js +76 -0
- package/dist/devices/access.module.d.ts +2 -0
- package/dist/devices/access.module.js +19 -0
- package/dist/devices/conversation-devices.d.ts +159 -0
- package/dist/devices/conversation-devices.js +352 -0
- package/dist/devices/default-provider-setting.d.ts +45 -0
- package/dist/devices/default-provider-setting.js +59 -0
- package/dist/devices/device-projects.service.d.ts +148 -0
- package/dist/devices/device-projects.service.js +471 -0
- package/dist/devices/device-provider-selection.d.ts +36 -0
- package/dist/devices/device-provider-selection.js +85 -0
- package/dist/devices/device-provider-selection.module.d.ts +3 -0
- package/dist/devices/device-provider-selection.module.js +22 -0
- package/dist/devices/devices.controller.d.ts +55 -0
- package/dist/devices/devices.controller.js +182 -0
- package/dist/devices/devices.module.d.ts +5 -13
- package/dist/devices/devices.module.js +38 -29
- package/dist/devices/devices.schemas.d.ts +7 -0
- package/dist/devices/devices.schemas.js +26 -0
- package/dist/devices/devices.service.d.ts +492 -0
- package/dist/devices/devices.service.js +1196 -0
- package/dist/devices/dto.d.ts +83 -45
- package/dist/devices/dto.js +85 -28
- package/dist/devices/errors.d.ts +14 -0
- package/dist/devices/errors.js +14 -0
- package/dist/devices/label.d.ts +9 -0
- package/dist/devices/label.js +14 -0
- package/dist/{environments → devices}/legacy-cleanup.job.d.ts +5 -5
- package/dist/devices/legacy-cleanup.job.js +147 -0
- package/dist/devices/project-rules.d.ts +30 -0
- package/dist/devices/project-rules.js +16 -0
- package/dist/devices/public-suffix.d.ts +6 -0
- package/dist/devices/public-suffix.js +79 -0
- package/dist/devices/working-root.d.ts +43 -0
- package/dist/devices/working-root.js +56 -0
- package/dist/dial-in/access.d.ts +45 -0
- package/dist/dial-in/access.js +90 -0
- package/dist/{devices/device-auth.controller.d.ts → dial-in/auth.controller.d.ts} +17 -11
- package/dist/{devices/device-auth.controller.js → dial-in/auth.controller.js} +34 -19
- package/dist/dial-in/auth.module.d.ts +7 -0
- package/dist/dial-in/auth.module.js +27 -0
- package/dist/{devices/device-auth.d.ts → dial-in/auth.service.d.ts} +65 -26
- package/dist/{devices/device-auth.js → dial-in/auth.service.js} +142 -70
- package/dist/dial-in/dial-in.module.d.ts +9 -0
- package/dist/dial-in/dial-in.module.js +37 -0
- package/dist/dial-in/dto.d.ts +81 -0
- package/dist/dial-in/dto.js +56 -0
- package/dist/dial-in/envelope.d.ts +95 -0
- package/dist/dial-in/envelope.js +89 -0
- package/dist/dial-in/gateway.d.ts +273 -0
- package/dist/dial-in/gateway.js +1064 -0
- package/dist/dial-in/handlers.d.ts +56 -0
- package/dist/dial-in/handlers.js +100 -0
- package/dist/dial-in/keys.d.ts +37 -0
- package/dist/dial-in/keys.js +37 -0
- package/dist/dial-in/machines.d.ts +144 -0
- package/dist/dial-in/machines.js +337 -0
- package/dist/dial-in/relay.d.ts +167 -0
- package/dist/dial-in/relay.js +517 -0
- package/dist/dial-in/relay.module.d.ts +7 -0
- package/dist/dial-in/relay.module.js +24 -0
- package/dist/dial-in/routes.d.ts +56 -0
- package/dist/dial-in/routes.js +133 -0
- package/dist/dial-in/streams.d.ts +66 -0
- package/dist/dial-in/streams.js +296 -0
- package/dist/dial-in/targets.d.ts +45 -0
- package/dist/dial-in/targets.js +91 -0
- package/dist/errors.d.ts +361 -38
- package/dist/errors.js +361 -38
- package/dist/evals/budget.js +14 -1
- package/dist/evals/evals.module.js +16 -3
- package/dist/evals/jobs.d.ts +14 -6
- package/dist/evals/jobs.js +21 -19
- package/dist/evals/plan.d.ts +20 -15
- package/dist/evals/plan.js +29 -6
- package/dist/evals/reconstruct.d.ts +86 -23
- package/dist/evals/reconstruct.js +176 -73
- package/dist/evals/recorded-permission-context.d.ts +79 -0
- package/dist/evals/recorded-permission-context.js +157 -0
- package/dist/evals/recorded-tools.d.ts +23 -34
- package/dist/evals/recorded-tools.js +36 -99
- package/dist/evals/run-replay.d.ts +33 -8
- package/dist/evals/run-replay.js +93 -28
- package/dist/evals/runs.service.d.ts +5 -6
- package/dist/evals/runs.service.js +24 -40
- package/dist/evals/sets.service.d.ts +17 -4
- package/dist/evals/sets.service.js +65 -15
- package/dist/evals/snapshot.d.ts +8 -3
- package/dist/evals/snapshot.js +6 -18
- package/dist/evals/step-replay.d.ts +6 -0
- package/dist/evals/step-replay.js +5 -0
- package/dist/evals/trajectory.d.ts +19 -3
- package/dist/evals/trajectory.js +14 -1
- package/dist/evals/trajectory.service.d.ts +4 -1
- package/dist/evals/trajectory.service.js +3 -0
- package/dist/evals/worker.d.ts +10 -1
- package/dist/evals/worker.js +31 -15
- package/dist/extensions/admin-ops.d.ts +48 -4
- package/dist/extensions/admin-ops.js +148 -26
- package/dist/extensions/admin-view.d.ts +25 -4
- package/dist/extensions/admin-view.js +169 -30
- package/dist/extensions/approvals.d.ts +12 -2
- package/dist/extensions/blobs.d.ts +14 -1
- package/dist/extensions/blobs.js +48 -5
- package/dist/extensions/bootstrap-defaults.d.ts +24 -0
- package/dist/extensions/bootstrap-defaults.js +78 -0
- package/dist/extensions/bootstrap-extra.d.ts +84 -0
- package/dist/extensions/bootstrap-extra.js +151 -0
- package/dist/extensions/bootstrap-manifest.d.ts +14 -0
- package/dist/extensions/bootstrap-manifest.js +23 -0
- package/dist/extensions/bootstrap-packages.d.ts +98 -0
- package/dist/extensions/bootstrap-packages.js +303 -0
- package/dist/extensions/bootstrap.d.ts +184 -51
- package/dist/extensions/bootstrap.js +514 -259
- package/dist/extensions/cli.js +0 -1
- package/dist/extensions/config-hash.d.ts +2 -0
- package/dist/extensions/config-hash.js +1 -1
- package/dist/extensions/config-json-schema.d.ts +2 -2
- package/dist/extensions/config-json-schema.js +1 -3
- package/dist/extensions/deployment-config.d.ts +11 -5
- package/dist/extensions/deployment-config.js +38 -26
- package/dist/extensions/effective-config.d.ts +14 -7
- package/dist/extensions/effective-config.js +26 -14
- package/dist/extensions/enabled.d.ts +24 -4
- package/dist/extensions/enabled.js +48 -10
- package/dist/extensions/extensions.module.js +26 -1
- package/dist/extensions/guide-places.d.ts +82 -0
- package/dist/extensions/guide-places.js +175 -0
- package/dist/extensions/hooks.d.ts +22 -3
- package/dist/extensions/hooks.js +15 -1
- package/dist/extensions/host.d.ts +66 -12
- package/dist/extensions/host.js +204 -49
- package/dist/extensions/installs.d.ts +9 -4
- package/dist/extensions/installs.js +13 -2
- package/dist/extensions/instance.d.ts +16 -3
- package/dist/extensions/instance.js +19 -1
- package/dist/extensions/ledger.d.ts +1 -1
- package/dist/extensions/lifecycle-hooks.d.ts +99 -0
- package/dist/extensions/lifecycle-hooks.js +275 -0
- package/dist/extensions/lifecycle.d.ts +6 -1
- package/dist/extensions/lifecycle.js +9 -2
- package/dist/extensions/locks.d.ts +12 -0
- package/dist/extensions/locks.js +26 -0
- package/dist/extensions/org-config.d.ts +53 -77
- package/dist/extensions/org-config.js +102 -320
- package/dist/extensions/org-levels.d.ts +22 -9
- package/dist/extensions/org-levels.js +100 -20
- package/dist/extensions/org-overrides.d.ts +16 -15
- package/dist/extensions/org-overrides.js +23 -22
- package/dist/extensions/package.d.ts +6 -5
- package/dist/extensions/package.js +6 -6
- package/dist/extensions/permission-set.d.ts +68 -11
- package/dist/extensions/permission-set.js +67 -15
- package/dist/extensions/permission-view.d.ts +104 -18
- package/dist/extensions/permission-view.js +61 -21
- package/dist/extensions/plugin-guides.d.ts +320 -0
- package/dist/extensions/plugin-guides.js +635 -0
- package/dist/extensions/plugin-icons.d.ts +133 -0
- package/dist/extensions/plugin-icons.js +334 -0
- package/dist/extensions/plugin-items.d.ts +21 -1
- package/dist/extensions/plugin-items.js +28 -0
- package/dist/extensions/point-defaults.d.ts +48 -8
- package/dist/extensions/point-defaults.js +102 -51
- package/dist/extensions/registry.js +1 -0
- package/dist/extensions/resolve.d.ts +46 -0
- package/dist/extensions/resolve.js +77 -3
- package/dist/extensions/single-provider.d.ts +92 -0
- package/dist/extensions/single-provider.js +180 -0
- package/dist/extensions/sources.d.ts +13 -2
- package/dist/extensions/sources.js +2 -0
- package/dist/extensions/state.module.js +9 -1
- package/dist/extensions/sync.js +5 -10
- package/dist/extensions/unavailable.d.ts +2 -1
- package/dist/extensions/unavailable.js +2 -1
- package/dist/extensions/usage-subscribers.d.ts +43 -0
- package/dist/extensions/usage-subscribers.js +108 -0
- package/dist/files/files.module.d.ts +4 -1
- package/dist/files/files.module.js +6 -2
- package/dist/files/previewers.controller.d.ts +12 -0
- package/dist/files/previewers.controller.js +52 -0
- package/dist/files/previewers.d.ts +91 -4
- package/dist/files/previewers.js +192 -36
- package/dist/git/gateway.d.ts +102 -0
- package/dist/git/gateway.js +771 -0
- package/dist/git/gateway.route.d.ts +16 -0
- package/dist/git/gateway.route.js +39 -0
- package/dist/git/git.module.d.ts +10 -0
- package/dist/git/git.module.js +31 -0
- package/dist/git/identity.d.ts +80 -0
- package/dist/git/identity.js +209 -0
- package/dist/git/pkt-line.d.ts +53 -0
- package/dist/git/pkt-line.js +146 -0
- package/dist/git/run-end.d.ts +29 -0
- package/dist/git/run-end.js +121 -0
- package/dist/git/sources.d.ts +42 -0
- package/dist/git/sources.js +134 -0
- package/dist/git/tickets.d.ts +69 -0
- package/dist/git/tickets.js +194 -0
- package/dist/html/csp.d.ts +13 -0
- package/dist/html/csp.js +33 -0
- package/dist/html/html-document.controller.d.ts +31 -0
- package/dist/html/html-document.controller.js +75 -0
- package/dist/html/html-document.service.d.ts +49 -0
- package/dist/html/html-document.service.js +143 -0
- package/dist/html/html-token.d.ts +58 -0
- package/dist/html/html-token.js +154 -0
- package/dist/html/html-type.d.ts +15 -0
- package/dist/html/html-type.js +44 -0
- package/dist/html/html.module.d.ts +6 -0
- package/dist/html/html.module.js +26 -0
- package/dist/http/api.module.js +100 -9
- package/dist/http/app.d.ts +14 -2
- package/dist/http/app.js +27 -3
- package/dist/http/error.filter.d.ts +2 -0
- package/dist/http/error.filter.js +11 -2
- package/dist/http/gateway-routes.d.ts +9 -5
- package/dist/http/gateway-routes.js +5 -4
- package/dist/http/meta.controller.d.ts +49 -0
- package/dist/http/meta.controller.js +114 -0
- package/dist/http/plugin-dispatch.d.ts +55 -18
- package/dist/http/plugin-dispatch.js +132 -29
- package/dist/http/plugin-route-access.d.ts +57 -0
- package/dist/http/plugin-route-access.js +208 -0
- package/dist/identity/account-avatar.controller.d.ts +30 -0
- package/dist/identity/account-avatar.controller.js +117 -0
- package/dist/identity/account-avatar.d.ts +67 -0
- package/dist/identity/account-avatar.js +136 -0
- package/dist/identity/account-avatars.service.d.ts +77 -0
- package/dist/identity/account-avatars.service.js +321 -0
- package/dist/identity/accounts.d.ts +51 -5
- package/dist/identity/accounts.js +165 -17
- package/dist/identity/api-tokens.js +8 -0
- package/dist/identity/app-auth.controller.d.ts +26 -0
- package/dist/identity/app-auth.controller.js +65 -0
- package/dist/identity/app-auth.d.ts +84 -0
- package/dist/identity/app-auth.js +212 -0
- package/dist/identity/app-auth.schemas.d.ts +60 -0
- package/dist/identity/app-auth.schemas.js +46 -0
- package/dist/identity/audit.d.ts +0 -12
- package/dist/identity/audit.js +0 -27
- package/dist/identity/auth.controller.js +5 -9
- package/dist/identity/auth.guard.d.ts +26 -12
- package/dist/identity/auth.guard.js +74 -35
- package/dist/identity/cookies.d.ts +4 -9
- package/dist/identity/cookies.js +8 -32
- package/dist/identity/external.js +7 -1
- package/dist/identity/identity.module.d.ts +2 -1
- package/dist/identity/identity.module.js +12 -1
- package/dist/identity/initial-passwords.controller.d.ts +8 -6
- package/dist/identity/initial-passwords.controller.js +13 -7
- package/dist/identity/initial-passwords.d.ts +23 -14
- package/dist/identity/initial-passwords.job.d.ts +3 -2
- package/dist/identity/initial-passwords.job.js +11 -5
- package/dist/identity/initial-passwords.js +26 -31
- package/dist/identity/me.controller.d.ts +36 -12
- package/dist/identity/me.controller.js +65 -12
- package/dist/identity/me.schemas.d.ts +49 -3
- package/dist/identity/me.schemas.js +40 -2
- package/dist/identity/principal.d.ts +2 -2
- package/dist/identity/principal.js +2 -2
- package/dist/identity/sessions.d.ts +7 -6
- package/dist/identity/sessions.js +26 -22
- package/dist/identity/settings.d.ts +280 -3
- package/dist/identity/settings.js +693 -14
- package/dist/identity/sso-paths.d.ts +7 -0
- package/dist/identity/sso-paths.js +13 -0
- package/dist/identity/sso.d.ts +13 -7
- package/dist/identity/sso.js +24 -9
- package/dist/identity/write-actor.d.ts +11 -0
- package/dist/identity/write-actor.js +7 -0
- package/dist/inbox/inbox.module.js +2 -1
- package/dist/inbox/inbox.service.d.ts +27 -25
- package/dist/inbox/inbox.service.js +14 -6
- package/dist/inbox/org-notices.d.ts +1 -1
- package/dist/inbox/platform-inbox.service.d.ts +54 -35
- package/dist/inbox/platform-inbox.service.js +100 -66
- package/dist/inbox/platform-notices.d.ts +15 -1
- package/dist/inbox/platform-notices.js +20 -0
- package/dist/index.d.ts +18 -3
- package/dist/index.js +17 -3
- package/dist/infra/cli/kernel-cli.module.d.ts +2 -2
- package/dist/infra/cli/kernel-cli.module.js +10 -2
- package/dist/infra/cli/master-key-rewrap.d.ts +15 -0
- package/dist/infra/cli/master-key-rewrap.js +24 -0
- package/dist/infra/cli/permission-cutover.d.ts +59 -0
- package/dist/infra/cli/permission-cutover.js +107 -0
- package/dist/infra/config/kernel-config.service.d.ts +8 -1
- package/dist/infra/config/kernel-config.service.js +92 -25
- package/dist/infra/database/database.module.js +1 -0
- package/dist/infra/database/org-scope.d.ts +59 -0
- package/dist/infra/database/org-scope.js +68 -0
- package/dist/infra/database/rls-role.d.ts +11 -0
- package/dist/infra/database/rls-role.js +33 -0
- package/dist/infra/database/scoped-dialect.d.ts +18 -0
- package/dist/infra/database/scoped-dialect.js +245 -0
- package/dist/infra/database/startup-activation-transaction.d.ts +36 -0
- package/dist/infra/database/startup-activation-transaction.js +242 -0
- package/dist/infra/database/transaction-host.d.ts +79 -0
- package/dist/infra/database/transaction-host.js +159 -3
- package/dist/infra/database/xact-lock.d.ts +17 -0
- package/dist/infra/database/xact-lock.js +34 -1
- package/dist/infra/events/kernel-events.d.ts +14 -36
- package/dist/infra/health/health.controller.js +8 -0
- package/dist/infra/health/process-fault.d.ts +16 -0
- package/dist/infra/health/process-fault.js +49 -0
- package/dist/infra/lifecycle/process-guards.d.ts +8 -2
- package/dist/infra/lifecycle/process-guards.js +12 -3
- package/dist/infra/lifecycle/shutdown-signals.d.ts +10 -1
- package/dist/infra/lifecycle/shutdown-signals.js +28 -13
- package/dist/infra/lock/lock.service.d.ts +13 -1
- package/dist/infra/lock/lock.service.js +37 -4
- package/dist/infra/outbox/outbox-relay.module.d.ts +6 -0
- package/dist/infra/outbox/outbox-relay.module.js +18 -0
- package/dist/infra/outbox/outbox.dispatcher.d.ts +103 -0
- package/dist/infra/outbox/outbox.dispatcher.js +321 -0
- package/dist/infra/outbox/outbox.module.d.ts +24 -0
- package/dist/infra/outbox/outbox.module.js +50 -0
- package/dist/infra/outbox/outbox.relay.d.ts +31 -0
- package/dist/infra/outbox/outbox.relay.js +76 -0
- package/dist/infra/outbox/outbox.service.d.ts +60 -0
- package/dist/infra/outbox/outbox.service.js +166 -0
- package/dist/infra/outbox/registry.d.ts +450 -0
- package/dist/infra/outbox/registry.js +415 -0
- package/dist/infra/presence/presence.module.d.ts +6 -0
- package/dist/infra/presence/presence.module.js +22 -0
- package/dist/infra/presence/replica-presence.d.ts +87 -0
- package/dist/infra/presence/replica-presence.js +189 -0
- package/dist/infra/queue/queue-names.d.ts +8 -0
- package/dist/infra/queue/queue-names.js +21 -0
- package/dist/infra/queue/run-job.d.ts +8 -2
- package/dist/infra/queue/run-job.js +16 -3
- package/dist/infra/schedule/locked-tick.js +12 -4
- package/dist/infra/schedule/scheduled-runs.js +3 -1
- package/dist/infra/throttler/credential-throttler.d.ts +4 -1
- package/dist/infra/throttler/credential-throttler.js +5 -2
- package/dist/infra/throttler/named-throttlers.d.ts +17 -2
- package/dist/infra/throttler/named-throttlers.js +89 -2
- package/dist/infra/throttler/throttler.guard.d.ts +2 -1
- package/dist/infra/throttler/throttler.guard.js +3 -2
- package/dist/kernel.module.js +24 -4
- package/dist/lifecycle/kernel-lifecycle.d.ts +28 -2
- package/dist/lifecycle/kernel-lifecycle.js +204 -51
- package/dist/media/image-header.d.ts +10 -0
- package/dist/media/image-header.js +87 -0
- package/dist/models/embeddings.d.ts +9 -9
- package/dist/models/embeddings.js +11 -18
- package/dist/models/enablement.d.ts +5 -6
- package/dist/models/enablement.js +7 -14
- package/dist/models/image-usable.d.ts +46 -0
- package/dist/models/image-usable.js +60 -0
- package/dist/models/images.d.ts +127 -0
- package/dist/models/images.js +445 -0
- package/dist/models/models.module.d.ts +3 -2
- package/dist/models/models.module.js +18 -4
- package/dist/models/org-models.schemas.js +1 -0
- package/dist/models/purposes.controller.d.ts +7 -0
- package/dist/models/purposes.controller.js +9 -0
- package/dist/models/purposes.d.ts +38 -46
- package/dist/models/purposes.js +76 -17
- package/dist/net/public-address.d.ts +38 -8
- package/dist/net/public-address.js +83 -24
- package/dist/net/safe-fetch.d.ts +6 -2
- package/dist/net/safe-fetch.js +31 -8
- package/dist/orgs/device-network-setting.d.ts +82 -0
- package/dist/orgs/device-network-setting.js +142 -0
- package/dist/orgs/directory-sync.d.ts +18 -11
- package/dist/orgs/directory-sync.js +22 -17
- package/dist/orgs/invitations.controller.d.ts +3 -11
- package/dist/orgs/invitations.controller.js +9 -10
- package/dist/orgs/invitations.service.d.ts +12 -2
- package/dist/orgs/invitations.service.js +16 -7
- package/dist/orgs/members.service.d.ts +15 -3
- package/dist/orgs/members.service.js +27 -11
- package/dist/orgs/network-allowances.service.d.ts +79 -0
- package/dist/orgs/network-allowances.service.js +371 -0
- package/dist/orgs/offboarding.d.ts +59 -58
- package/dist/orgs/offboarding.js +160 -168
- package/dist/orgs/org-lock.d.ts +34 -2
- package/dist/orgs/org-lock.js +65 -4
- package/dist/orgs/org-owner.d.ts +7 -0
- package/dist/orgs/org-owner.js +16 -0
- package/dist/orgs/org.guard.js +4 -0
- package/dist/orgs/orgs.controller.d.ts +14 -13
- package/dist/orgs/orgs.controller.js +28 -12
- package/dist/orgs/orgs.module.d.ts +3 -2
- package/dist/orgs/orgs.module.js +13 -12
- package/dist/orgs/orgs.schemas.d.ts +38 -0
- package/dist/orgs/orgs.schemas.js +27 -0
- package/dist/orgs/orgs.service.d.ts +16 -6
- package/dist/orgs/orgs.service.js +57 -14
- package/dist/orgs/roles.d.ts +1 -1
- package/dist/orgs/roles.js +6 -0
- package/dist/orgs/settings.controller.d.ts +5 -2
- package/dist/orgs/settings.controller.js +9 -4
- package/dist/orgs/settings.service.d.ts +442 -55
- package/dist/orgs/settings.service.js +705 -86
- package/dist/overrides.d.ts +65 -5
- package/dist/overrides.js +36 -2
- package/dist/packages/npm.d.ts +37 -10
- package/dist/packages/npm.js +67 -24
- package/dist/packages/provenance.d.ts +3 -1
- package/dist/packages/provenance.js +7 -3
- package/dist/packages/tgz.d.ts +0 -2
- package/dist/packages/tgz.js +0 -2
- package/dist/platform/availability.d.ts +5 -0
- package/dist/platform/availability.js +7 -3
- package/dist/platform/connector-person-fields.d.ts +67 -0
- package/dist/platform/connector-person-fields.js +129 -0
- package/dist/platform/exclusions.js +301 -174
- package/dist/platform/file-ref.d.ts +88 -0
- package/dist/platform/file-ref.js +164 -0
- package/dist/platform/method.js +1 -0
- package/dist/platform/operation.d.ts +92 -4
- package/dist/platform/operation.js +26 -10
- package/dist/platform/ops/accounts.ops.d.ts +1 -1
- package/dist/platform/ops/accounts.ops.js +3 -2
- package/dist/platform/ops/admin-items.ops.d.ts +37 -0
- package/dist/platform/ops/admin-items.ops.js +279 -0
- package/dist/platform/ops/admin.ops.d.ts +12 -10
- package/dist/platform/ops/admin.ops.js +245 -54
- package/dist/platform/ops/agent-skills.ops.d.ts +31 -3
- package/dist/platform/ops/agent-skills.ops.js +449 -11
- package/dist/platform/ops/agent-templates.ops.js +2 -2
- package/dist/platform/ops/agents.ops.d.ts +10 -3
- package/dist/platform/ops/agents.ops.js +146 -54
- package/dist/platform/ops/approvals.ops.d.ts +1 -1
- package/dist/platform/ops/approvals.ops.js +7 -2
- package/dist/platform/ops/background.ops.js +5 -2
- package/dist/platform/ops/catalog-admin.ops.d.ts +29 -1
- package/dist/platform/ops/catalog-admin.ops.js +213 -7
- package/dist/platform/ops/channels.ops.d.ts +10 -3
- package/dist/platform/ops/channels.ops.js +223 -5
- package/dist/platform/ops/components.ops.d.ts +3 -1
- package/dist/platform/ops/components.ops.js +62 -2
- package/dist/platform/ops/connectors.ops.d.ts +22 -4
- package/dist/platform/ops/connectors.ops.js +738 -13
- package/dist/platform/ops/conversations.ops.d.ts +3 -3
- package/dist/platform/ops/conversations.ops.js +54 -16
- package/dist/platform/ops/devices.ops.d.ts +28 -0
- package/dist/platform/ops/devices.ops.js +520 -0
- package/dist/platform/ops/evals.ops.js +5 -57
- package/dist/platform/ops/extensions-admin.ops.d.ts +23 -4
- package/dist/platform/ops/extensions-admin.ops.js +389 -15
- package/dist/platform/ops/extensions.ops.d.ts +25 -5
- package/dist/platform/ops/extensions.ops.js +336 -13
- package/dist/platform/ops/inbox.ops.d.ts +1 -1
- package/dist/platform/ops/inbox.ops.js +71 -32
- package/dist/platform/ops/list-handoff.d.ts +10 -0
- package/dist/platform/ops/list-handoff.js +11 -0
- package/dist/platform/ops/marketplaces.ops.js +29 -5
- package/dist/platform/ops/models.ops.js +10 -0
- package/dist/platform/ops/org-plugins.ops.d.ts +19 -3
- package/dist/platform/ops/org-plugins.ops.js +219 -11
- package/dist/platform/ops/org-settings.ops.d.ts +3 -1
- package/dist/platform/ops/org-settings.ops.js +69 -19
- package/dist/platform/ops/orgs.ops.d.ts +48 -3
- package/dist/platform/ops/orgs.ops.js +436 -9
- package/dist/platform/ops/outbox.ops.d.ts +21 -0
- package/dist/platform/ops/outbox.ops.js +126 -0
- package/dist/platform/ops/person-inputs.d.ts +61 -0
- package/dist/platform/ops/person-inputs.js +121 -0
- package/dist/platform/ops/platform-icons.ops.d.ts +14 -0
- package/dist/platform/ops/platform-icons.ops.js +117 -0
- package/dist/platform/ops/platform.ops.d.ts +17 -2
- package/dist/platform/ops/platform.ops.js +142 -32
- package/dist/platform/ops/plugins.ops.d.ts +5 -1
- package/dist/platform/ops/plugins.ops.js +15 -37
- package/dist/platform/ops/requests.ops.js +13 -3
- package/dist/platform/ops/schedules.ops.d.ts +21 -0
- package/dist/platform/ops/schedules.ops.js +509 -0
- package/dist/platform/ops/setup.ops.d.ts +24 -0
- package/dist/platform/ops/setup.ops.js +212 -0
- package/dist/platform/ops/shares.ops.d.ts +16 -0
- package/dist/platform/ops/shares.ops.js +107 -0
- package/dist/platform/ops/skills.ops.d.ts +7 -1
- package/dist/platform/ops/skills.ops.js +111 -48
- package/dist/platform/ops/summary.d.ts +5 -0
- package/dist/platform/ops/summary.js +10 -0
- package/dist/platform/ops/themes.ops.d.ts +14 -0
- package/dist/platform/ops/themes.ops.js +47 -0
- package/dist/platform/ops/ui.ops.d.ts +8 -0
- package/dist/platform/ops/ui.ops.js +41 -0
- package/dist/platform/ops/unavailable.js +7 -0
- package/dist/platform/parity.d.ts +13 -6
- package/dist/platform/parity.js +139 -51
- package/dist/platform/person-fields.d.ts +120 -0
- package/dist/platform/person-fields.js +404 -0
- package/dist/platform/platform-ops.module.d.ts +10 -2
- package/dist/platform/platform-ops.module.js +43 -5
- package/dist/platform/platform.module.d.ts +4 -3
- package/dist/platform/platform.module.js +8 -5
- package/dist/platform/route-schemas.js +45 -3
- package/dist/platform/sealed-inputs.d.ts +44 -0
- package/dist/platform/sealed-inputs.js +116 -0
- package/dist/platform/sealed-reveals.controller.d.ts +17 -0
- package/dist/platform/sealed-reveals.controller.js +48 -0
- package/dist/platform/sealed-reveals.d.ts +54 -0
- package/dist/platform/sealed-reveals.js +155 -0
- package/dist/push/delivery.d.ts +88 -0
- package/dist/push/delivery.js +269 -0
- package/dist/push/fanout.d.ts +29 -0
- package/dist/push/fanout.js +95 -0
- package/dist/push/jobs.d.ts +43 -0
- package/dist/push/jobs.js +19 -0
- package/dist/push/preferences.service.d.ts +18 -0
- package/dist/push/preferences.service.js +82 -0
- package/dist/push/provider-host.d.ts +34 -0
- package/dist/push/provider-host.js +94 -0
- package/dist/push/push-owed.d.ts +33 -0
- package/dist/push/push-owed.js +93 -0
- package/dist/push/push-processor.d.ts +40 -0
- package/dist/push/push-processor.js +114 -0
- package/dist/push/push.controller.d.ts +28 -0
- package/dist/push/push.controller.js +92 -0
- package/dist/push/push.module.d.ts +6 -0
- package/dist/push/push.module.js +29 -0
- package/dist/push/push.schemas.d.ts +88 -0
- package/dist/push/push.schemas.js +53 -0
- package/dist/push/recipients.d.ts +29 -0
- package/dist/push/recipients.js +270 -0
- package/dist/push/registration-cleanup.d.ts +9 -0
- package/dist/push/registration-cleanup.js +16 -0
- package/dist/push/registrations.service.d.ts +55 -0
- package/dist/push/registrations.service.js +254 -0
- package/dist/push/stale.job.d.ts +25 -0
- package/dist/push/stale.job.js +76 -0
- package/dist/push/texts.d.ts +31 -0
- package/dist/push/texts.js +46 -0
- package/dist/push/token-store.d.ts +31 -0
- package/dist/push/token-store.js +52 -0
- package/dist/push/triggers.d.ts +19 -0
- package/dist/push/triggers.js +30 -0
- package/dist/roles/gateway-role.d.ts +18 -7
- package/dist/roles/gateway-role.js +37 -11
- package/dist/roles/gateway.module.d.ts +3 -2
- package/dist/roles/gateway.module.js +16 -6
- package/dist/roles/worker-role.d.ts +24 -9
- package/dist/roles/worker-role.js +59 -31
- package/dist/roles/worker.module.d.ts +1 -1
- package/dist/roles/worker.module.js +47 -10
- package/dist/runtime/checkpointer.d.ts +3 -0
- package/dist/runtime/checkpointer.js +9 -3
- package/dist/runtime/compaction-progress.d.ts +62 -0
- package/dist/runtime/compaction-progress.js +82 -0
- package/dist/runtime/compaction-settings.service.d.ts +24 -0
- package/dist/runtime/compaction-settings.service.js +48 -0
- package/dist/runtime/compaction.service.d.ts +50 -0
- package/dist/runtime/compaction.service.js +75 -0
- package/dist/runtime/context/build.d.ts +148 -41
- package/dist/runtime/context/build.js +439 -92
- package/dist/runtime/context/compaction.d.ts +111 -16
- package/dist/runtime/context/compaction.js +414 -58
- package/dist/runtime/context/device-paths.d.ts +92 -0
- package/dist/runtime/context/device-paths.js +185 -0
- package/dist/runtime/context/fit.d.ts +111 -0
- package/dist/runtime/context/fit.js +278 -0
- package/dist/runtime/context/permission-profile.d.ts +55 -0
- package/dist/runtime/context/permission-profile.js +275 -0
- package/dist/runtime/context/plugin-context.d.ts +20 -0
- package/dist/runtime/context/plugin-context.js +30 -0
- package/dist/runtime/context/project-root.d.ts +43 -0
- package/dist/runtime/context/project-root.js +85 -0
- package/dist/runtime/context/run-context.d.ts +23 -0
- package/dist/runtime/context/run-context.js +80 -0
- package/dist/runtime/context/skills.d.ts +38 -54
- package/dist/runtime/context/skills.js +76 -117
- package/dist/runtime/context/tool-changes.d.ts +3 -3
- package/dist/runtime/context/tool-changes.js +6 -16
- package/dist/runtime/conversation-lock.d.ts +4 -11
- package/dist/runtime/conversation-lock.js +14 -18
- package/dist/runtime/hook-calls.d.ts +17 -7
- package/dist/runtime/hook-calls.js +31 -8
- package/dist/runtime/langgraph-loop.js +26 -8
- package/dist/runtime/limits.d.ts +15 -0
- package/dist/runtime/limits.js +25 -0
- package/dist/runtime/loop.d.ts +16 -3
- package/dist/runtime/loop.js +2 -1
- package/dist/runtime/maintenance.d.ts +25 -14
- package/dist/runtime/maintenance.js +141 -34
- package/dist/runtime/model-call.d.ts +180 -19
- package/dist/runtime/model-call.js +1027 -394
- package/dist/runtime/permission-context-errors.d.ts +39 -0
- package/dist/runtime/permission-context-errors.js +67 -0
- package/dist/runtime/permission-context.service.d.ts +60 -0
- package/dist/runtime/permission-context.service.js +289 -0
- package/dist/runtime/plugin-context.service.d.ts +75 -0
- package/dist/runtime/plugin-context.service.js +210 -0
- package/dist/runtime/project/knowledge.d.ts +135 -0
- package/dist/runtime/project/knowledge.js +256 -0
- package/dist/runtime/project/knowledge.service.d.ts +94 -0
- package/dist/runtime/project/knowledge.service.js +347 -0
- package/dist/runtime/providers.d.ts +74 -39
- package/dist/runtime/providers.js +140 -117
- package/dist/runtime/queue-lost-jobs.d.ts +24 -0
- package/dist/runtime/queue-lost-jobs.js +51 -0
- package/dist/runtime/run-context.service.d.ts +21 -4
- package/dist/runtime/run-context.service.js +48 -12
- package/dist/runtime/run-control.d.ts +52 -5
- package/dist/runtime/run-control.js +86 -12
- package/dist/runtime/run-deletion.d.ts +29 -0
- package/dist/runtime/run-deletion.js +157 -0
- package/dist/runtime/run-execution.d.ts +80 -0
- package/dist/runtime/run-execution.js +191 -0
- package/dist/runtime/run-finish.d.ts +49 -12
- package/dist/runtime/run-finish.js +143 -15
- package/dist/runtime/run-jobs.d.ts +112 -13
- package/dist/runtime/run-jobs.js +239 -29
- package/dist/runtime/run-liveness.d.ts +11 -0
- package/dist/runtime/run-liveness.js +19 -0
- package/dist/runtime/run-orphan-check.job.d.ts +145 -0
- package/dist/runtime/run-orphan-check.job.js +425 -0
- package/dist/runtime/run-processors.d.ts +30 -15
- package/dist/runtime/run-processors.js +44 -9
- package/dist/runtime/run-queue.d.ts +96 -68
- package/dist/runtime/run-queue.js +344 -301
- package/dist/runtime/run-status.d.ts +12 -0
- package/dist/runtime/run-status.js +21 -0
- package/dist/runtime/run-steps.d.ts +11 -4
- package/dist/runtime/run-steps.js +32 -13
- package/dist/runtime/run-worker.d.ts +68 -24
- package/dist/runtime/run-worker.js +446 -136
- package/dist/runtime/runtime.module.d.ts +3 -4
- package/dist/runtime/runtime.module.js +54 -7
- package/dist/runtime/step-log.d.ts +23 -5
- package/dist/runtime/step-log.js +37 -10
- package/dist/runtime/stream.controller.d.ts +2 -4
- package/dist/runtime/stream.controller.js +5 -11
- package/dist/runtime/stream.d.ts +7 -1
- package/dist/runtime/stream.js +77 -5
- package/dist/runtime/subagents/child.js +3 -1
- package/dist/runtime/subagents/definition.d.ts +41 -25
- package/dist/runtime/subagents/definition.js +120 -115
- package/dist/runtime/subagents/deliveries.d.ts +6 -3
- package/dist/runtime/subagents/deliveries.js +19 -7
- package/dist/runtime/subagents/dispatch.d.ts +18 -14
- package/dist/runtime/subagents/dispatch.js +37 -42
- package/dist/runtime/subagents/messages.d.ts +5 -1
- package/dist/runtime/subagents/messages.js +13 -3
- package/dist/runtime/subagents/org-agents.d.ts +1 -1
- package/dist/runtime/subagents/org-agents.js +3 -3
- package/dist/runtime/subagents/preamble.d.ts +3 -1
- package/dist/runtime/subagents/preamble.js +3 -1
- package/dist/runtime/subagents/render.d.ts +1 -2
- package/dist/runtime/subagents/render.js +1 -2
- package/dist/runtime/subagents/skill-fork.d.ts +5 -7
- package/dist/runtime/subagents/skill-fork.js +8 -5
- package/dist/runtime/subagents/subagents.service.js +1 -1
- package/dist/runtime/subagents/template-skills.d.ts +47 -0
- package/dist/runtime/subagents/template-skills.js +76 -0
- package/dist/runtime/subagents/tree-jobs.d.ts +62 -0
- package/dist/runtime/subagents/tree-jobs.js +86 -0
- package/dist/runtime/usage-report-jobs.d.ts +23 -48
- package/dist/runtime/usage-report-jobs.js +68 -119
- package/dist/runtime/usage-report.d.ts +42 -82
- package/dist/runtime/usage-report.js +74 -224
- package/dist/runtime/waits.d.ts +64 -204
- package/dist/runtime/waits.js +172 -826
- package/dist/sandbox/attachments-path.d.ts +15 -0
- package/dist/sandbox/attachments-path.js +15 -0
- package/dist/sandbox/cloud-permission-snapshot.d.ts +159 -0
- package/dist/sandbox/cloud-permission-snapshot.js +430 -0
- package/dist/sandbox/cloud-permission-snapshot.module.d.ts +8 -0
- package/dist/sandbox/cloud-permission-snapshot.module.js +34 -0
- package/dist/sandbox/device-reports.d.ts +110 -0
- package/dist/sandbox/device-reports.js +317 -0
- package/dist/sandbox/device-reports.module.d.ts +7 -0
- package/dist/sandbox/device-reports.module.js +25 -0
- package/dist/sandbox/device-sandbox-settings.d.ts +230 -0
- package/dist/sandbox/device-sandbox-settings.js +470 -0
- package/dist/sandbox/device-sandbox.d.ts +210 -0
- package/dist/sandbox/device-sandbox.js +234 -0
- package/dist/sandbox/device-services.d.ts +74 -0
- package/dist/sandbox/device-services.js +202 -0
- package/dist/sandbox/held-operations.d.ts +43 -0
- package/dist/sandbox/held-operations.js +137 -0
- package/dist/sandbox/jobs.d.ts +42 -21
- package/dist/sandbox/jobs.js +57 -33
- package/dist/sandbox/kernel-read.d.ts +55 -0
- package/dist/sandbox/kernel-read.js +57 -0
- package/dist/sandbox/leases.d.ts +34 -14
- package/dist/sandbox/leases.js +106 -26
- package/dist/sandbox/legacy-retirement.d.ts +269 -0
- package/dist/sandbox/legacy-retirement.js +925 -0
- package/dist/sandbox/legacy-retirement.module.d.ts +8 -0
- package/dist/sandbox/legacy-retirement.module.js +25 -0
- package/dist/sandbox/managed-device-context.d.ts +118 -0
- package/dist/sandbox/managed-device-context.js +374 -0
- package/dist/sandbox/managed-device-context.module.d.ts +6 -0
- package/dist/sandbox/managed-device-context.module.js +37 -0
- package/dist/sandbox/modes.d.ts +210 -0
- package/dist/sandbox/modes.js +253 -0
- package/dist/sandbox/network-grants.d.ts +69 -0
- package/dist/sandbox/network-grants.js +227 -0
- package/dist/sandbox/network-grants.module.d.ts +2 -0
- package/dist/sandbox/network-grants.module.js +14 -0
- package/dist/sandbox/operation-authority-types.d.ts +27 -0
- package/dist/sandbox/operation-authority-types.js +50 -0
- package/dist/sandbox/operation-authority.d.ts +162 -0
- package/dist/sandbox/operation-authority.js +910 -0
- package/dist/sandbox/operation-authority.module.d.ts +2 -0
- package/dist/sandbox/operation-authority.module.js +29 -0
- package/dist/sandbox/operation-intents.d.ts +253 -0
- package/dist/sandbox/operation-intents.js +1440 -0
- package/dist/sandbox/operation-intents.module.d.ts +2 -0
- package/dist/sandbox/operation-intents.module.js +21 -0
- package/dist/sandbox/operation-payloads.d.ts +33 -0
- package/dist/sandbox/operation-payloads.js +332 -0
- package/dist/sandbox/operation-reconcile.job.d.ts +73 -0
- package/dist/sandbox/operation-reconcile.job.js +332 -0
- package/dist/sandbox/permission-authority-epochs.d.ts +18 -0
- package/dist/sandbox/permission-authority-epochs.js +83 -0
- package/dist/sandbox/permission-authority-lock.d.ts +44 -0
- package/dist/sandbox/permission-authority-lock.js +167 -0
- package/dist/sandbox/permission-authority.module.d.ts +9 -0
- package/dist/sandbox/permission-authority.module.js +55 -0
- package/dist/sandbox/permission-auto-grants.d.ts +42 -0
- package/dist/sandbox/permission-auto-grants.js +145 -0
- package/dist/sandbox/permission-availability.d.ts +63 -0
- package/dist/sandbox/permission-availability.js +71 -0
- package/dist/sandbox/permission-call-grants.d.ts +47 -0
- package/dist/sandbox/permission-call-grants.js +427 -0
- package/dist/sandbox/permission-call-grants.module.d.ts +2 -0
- package/dist/sandbox/permission-call-grants.module.js +28 -0
- package/dist/sandbox/permission-call-types.d.ts +149 -0
- package/dist/sandbox/permission-call-types.js +1 -0
- package/dist/sandbox/permission-ceiling-writes.d.ts +57 -0
- package/dist/sandbox/permission-ceiling-writes.js +236 -0
- package/dist/sandbox/permission-config-publication.d.ts +126 -0
- package/dist/sandbox/permission-config-publication.js +529 -0
- package/dist/sandbox/permission-context-types.d.ts +60 -0
- package/dist/sandbox/permission-context-types.js +11 -0
- package/dist/sandbox/permission-facts.d.ts +384 -0
- package/dist/sandbox/permission-facts.js +714 -0
- package/dist/sandbox/permission-facts.module.d.ts +2 -0
- package/dist/sandbox/permission-facts.module.js +20 -0
- package/dist/sandbox/permission-instance-writes.d.ts +76 -0
- package/dist/sandbox/permission-instance-writes.js +232 -0
- package/dist/sandbox/permission-runtime-reports.d.ts +92 -0
- package/dist/sandbox/permission-runtime-reports.js +337 -0
- package/dist/sandbox/permission-transitions.d.ts +31 -0
- package/dist/sandbox/permission-transitions.js +158 -0
- package/dist/sandbox/providers.d.ts +48 -29
- package/dist/sandbox/providers.js +69 -41
- package/dist/sandbox/providers.module.d.ts +2 -0
- package/dist/sandbox/providers.module.js +19 -0
- package/dist/sandbox/request-not-sent.d.ts +15 -0
- package/dist/sandbox/request-not-sent.js +20 -0
- package/dist/sandbox/review/classifier.d.ts +221 -0
- package/dist/sandbox/review/classifier.js +536 -0
- package/dist/sandbox/review/index.d.ts +13 -0
- package/dist/sandbox/review/index.js +10 -0
- package/dist/sandbox/review/permission-candidate.d.ts +142 -0
- package/dist/sandbox/review/permission-candidate.js +446 -0
- package/dist/sandbox/review/review.service.d.ts +184 -0
- package/dist/sandbox/review/review.service.js +586 -0
- package/dist/sandbox/review/rules.d.ts +87 -0
- package/dist/sandbox/review/rules.js +5363 -0
- package/dist/sandbox/review/types.d.ts +122 -0
- package/dist/sandbox/review/types.js +48 -0
- package/dist/sandbox/sandbox-file-reader.d.ts +47 -0
- package/dist/sandbox/sandbox-file-reader.js +125 -0
- package/dist/sandbox/sandbox.module.d.ts +4 -3
- package/dist/sandbox/sandbox.module.js +51 -9
- package/dist/sandbox/sandbox.service.d.ts +751 -199
- package/dist/sandbox/sandbox.service.js +2896 -628
- package/dist/sandbox/unreachable.d.ts +30 -0
- package/dist/sandbox/unreachable.js +125 -0
- package/dist/sandbox/use-context.d.ts +20 -0
- package/dist/sandbox/use-context.js +1 -0
- package/dist/schedules/calendar.d.ts +134 -0
- package/dist/schedules/calendar.js +410 -0
- package/dist/schedules/effective-settings.d.ts +22 -0
- package/dist/schedules/effective-settings.js +18 -0
- package/dist/schedules/errors.d.ts +8 -0
- package/dist/schedules/errors.js +8 -0
- package/dist/schedules/fire.d.ts +146 -0
- package/dist/schedules/fire.js +728 -0
- package/dist/schedules/grant-rules.d.ts +120 -0
- package/dist/schedules/grant-rules.js +186 -0
- package/dist/schedules/job-ids.d.ts +81 -0
- package/dist/schedules/job-ids.js +95 -0
- package/dist/schedules/pause.d.ts +9 -0
- package/dist/schedules/pause.js +35 -0
- package/dist/schedules/run-tracker.d.ts +84 -0
- package/dist/schedules/run-tracker.js +350 -0
- package/dist/schedules/scan.job.d.ts +45 -0
- package/dist/schedules/scan.job.js +189 -0
- package/dist/schedules/schedule-math.d.ts +73 -0
- package/dist/schedules/schedule-math.js +294 -0
- package/dist/schedules/scheduled-tasks.service.d.ts +359 -0
- package/dist/schedules/scheduled-tasks.service.js +1249 -0
- package/dist/schedules/schedules.controller.d.ts +72 -0
- package/dist/schedules/schedules.controller.js +256 -0
- package/dist/schedules/schedules.module.d.ts +16 -0
- package/dist/schedules/schedules.module.js +63 -0
- package/dist/schedules/schedules.schemas.d.ts +351 -0
- package/dist/schedules/schedules.schemas.js +213 -0
- package/dist/schedules/store.d.ts +86 -0
- package/dist/schedules/store.js +421 -0
- package/dist/schedules/store.module.d.ts +6 -0
- package/dist/schedules/store.module.js +21 -0
- package/dist/schedules/types.d.ts +110 -0
- package/dist/schedules/types.js +1 -0
- package/dist/schedules/unattended.d.ts +89 -0
- package/dist/schedules/unattended.js +193 -0
- package/dist/setup/kernel-checks.d.ts +91 -0
- package/dist/setup/kernel-checks.js +296 -0
- package/dist/setup/oauth-token-probe.d.ts +40 -0
- package/dist/setup/oauth-token-probe.js +96 -0
- package/dist/setup/redact-check.d.ts +18 -0
- package/dist/setup/redact-check.js +46 -0
- package/dist/setup/setup-check-registry.d.ts +86 -0
- package/dist/setup/setup-check-registry.js +75 -0
- package/dist/setup/setup-checks.controller.d.ts +28 -0
- package/dist/setup/setup-checks.controller.js +78 -0
- package/dist/setup/setup-checks.schemas.d.ts +67 -0
- package/dist/setup/setup-checks.schemas.js +75 -0
- package/dist/setup/setup-checks.service.d.ts +168 -0
- package/dist/setup/setup-checks.service.js +781 -0
- package/dist/setup/setup-guides.controller.d.ts +18 -0
- package/dist/setup/setup-guides.controller.js +48 -0
- package/dist/setup/setup-guides.schemas.d.ts +10 -0
- package/dist/setup/setup-guides.schemas.js +6 -0
- package/dist/setup/setup-guides.service.d.ts +141 -0
- package/dist/setup/setup-guides.service.js +348 -0
- package/dist/setup/setup.module.d.ts +8 -0
- package/dist/setup/setup.module.js +31 -0
- package/dist/shares/liveness.d.ts +59 -0
- package/dist/shares/liveness.js +163 -0
- package/dist/shares/revoke.d.ts +26 -0
- package/dist/shares/revoke.js +43 -0
- package/dist/shares/settings.d.ts +76 -0
- package/dist/shares/settings.js +117 -0
- package/dist/shares/share-code.d.ts +4 -0
- package/dist/shares/share-code.js +28 -0
- package/dist/shares/share-objects.d.ts +52 -0
- package/dist/shares/share-objects.js +123 -0
- package/dist/shares/share-open.controller.d.ts +35 -0
- package/dist/shares/share-open.controller.js +107 -0
- package/dist/shares/share-open.service.d.ts +107 -0
- package/dist/shares/share-open.service.js +288 -0
- package/dist/shares/share-previews.controller.d.ts +50 -0
- package/dist/shares/share-previews.controller.js +115 -0
- package/dist/shares/shares.controller.d.ts +34 -0
- package/dist/shares/shares.controller.js +114 -0
- package/dist/shares/shares.module.d.ts +8 -0
- package/dist/shares/shares.module.js +41 -0
- package/dist/shares/shares.schemas.d.ts +31 -0
- package/dist/shares/shares.schemas.js +25 -0
- package/dist/shares/shares.service.d.ts +183 -0
- package/dist/shares/shares.service.js +561 -0
- package/dist/shares/sweep.job.d.ts +74 -0
- package/dist/shares/sweep.job.js +332 -0
- package/dist/skills/agent-skills.controller.d.ts +48 -0
- package/dist/skills/agent-skills.controller.js +131 -0
- package/dist/skills/agent-skills.service.d.ts +258 -0
- package/dist/skills/agent-skills.service.js +971 -0
- package/dist/skills/catalog.d.ts +83 -71
- package/dist/skills/catalog.js +147 -215
- package/dist/skills/changes.controller.d.ts +6 -23
- package/dist/skills/changes.controller.js +8 -56
- package/dist/skills/changes.service.d.ts +70 -115
- package/dist/skills/changes.service.js +261 -606
- package/dist/skills/conversation-catalog.d.ts +52 -0
- package/dist/skills/conversation-catalog.js +142 -0
- package/dist/skills/invocation-keys.d.ts +1 -1
- package/dist/skills/invocation-keys.js +1 -1
- package/dist/skills/invoke.d.ts +67 -4
- package/dist/skills/invoke.js +138 -4
- package/dist/skills/package.d.ts +0 -5
- package/dist/skills/package.js +0 -14
- package/dist/skills/skill-files.d.ts +91 -0
- package/dist/skills/skill-files.js +144 -0
- package/dist/skills/skills.controller.d.ts +28 -10
- package/dist/skills/skills.controller.js +77 -31
- package/dist/skills/skills.module.js +23 -2
- package/dist/skills/skills.schemas.d.ts +62 -14
- package/dist/skills/skills.schemas.js +106 -16
- package/dist/skills/skills.service.d.ts +106 -71
- package/dist/skills/skills.service.js +330 -204
- package/dist/skills/usable.d.ts +57 -7
- package/dist/skills/usable.js +178 -36
- package/dist/storage/storage.service.d.ts +2 -0
- package/dist/storage/storage.service.js +12 -1
- package/dist/themes/avatar-preset-key.d.ts +6 -0
- package/dist/themes/avatar-preset-key.js +9 -0
- package/dist/themes/platform-icon-objects.d.ts +51 -0
- package/dist/themes/platform-icon-objects.js +113 -0
- package/dist/themes/platform-icon-public.controller.d.ts +17 -0
- package/dist/themes/platform-icon-public.controller.js +58 -0
- package/dist/themes/platform-icon.controller.d.ts +22 -0
- package/dist/themes/platform-icon.controller.js +65 -0
- package/dist/themes/platform-icon.schemas.d.ts +48 -0
- package/dist/themes/platform-icon.schemas.js +53 -0
- package/dist/themes/platform-icon.service.d.ts +83 -0
- package/dist/themes/platform-icon.service.js +301 -0
- package/dist/themes/render-css.d.ts +13 -0
- package/dist/themes/render-css.js +135 -0
- package/dist/themes/theme-delivery.service.d.ts +44 -0
- package/dist/themes/theme-delivery.service.js +131 -0
- package/dist/themes/theme-state.d.ts +157 -0
- package/dist/themes/theme-state.js +278 -0
- package/dist/themes/theme-usage.d.ts +61 -0
- package/dist/themes/theme-usage.js +98 -0
- package/dist/themes/themes-public.controller.d.ts +33 -0
- package/dist/themes/themes-public.controller.js +98 -0
- package/dist/themes/themes.controller.d.ts +13 -0
- package/dist/themes/themes.controller.js +38 -0
- package/dist/themes/themes.module.d.ts +6 -0
- package/dist/themes/themes.module.js +26 -0
- package/dist/themes/themes.schemas.d.ts +3 -0
- package/dist/themes/themes.schemas.js +2 -0
- package/dist/themes/themes.service.d.ts +77 -0
- package/dist/themes/themes.service.js +133 -0
- package/dist/tools/admin-connectors.d.ts +71 -0
- package/dist/tools/admin-connectors.js +139 -0
- package/dist/tools/approvals.controller.d.ts +6 -2
- package/dist/tools/approvals.controller.js +36 -2
- package/dist/tools/approvals.schemas.d.ts +2 -0
- package/dist/tools/approvals.schemas.js +5 -1
- package/dist/tools/approvals.service.d.ts +561 -17
- package/dist/tools/approvals.service.js +1566 -34
- package/dist/tools/builtin-names.d.ts +32 -17
- package/dist/tools/builtin-names.js +63 -23
- package/dist/tools/builtins/agent.js +5 -5
- package/dist/tools/builtins/artifacts.d.ts +69 -0
- package/dist/tools/builtins/artifacts.js +143 -0
- package/dist/tools/builtins/ask-user.js +3 -2
- package/dist/tools/builtins/builtin-tools.d.ts +33 -8
- package/dist/tools/builtins/builtin-tools.js +182 -33
- package/dist/tools/builtins/conversation-files.d.ts +48 -0
- package/dist/tools/builtins/conversation-files.js +162 -0
- package/dist/tools/builtins/image/generate.d.ts +65 -0
- package/dist/tools/builtins/image/generate.js +593 -0
- package/dist/tools/builtins/image/index.d.ts +2 -0
- package/dist/tools/builtins/image/index.js +2 -0
- package/dist/tools/builtins/image/paths.d.ts +12 -0
- package/dist/tools/builtins/image/paths.js +26 -0
- package/dist/tools/builtins/image/size.d.ts +12 -0
- package/dist/tools/builtins/image/size.js +36 -0
- package/dist/tools/builtins/platform.d.ts +47 -2
- package/dist/tools/builtins/platform.js +339 -35
- package/dist/tools/builtins/sandbox/bash.d.ts +51 -1
- package/dist/tools/builtins/sandbox/bash.js +353 -206
- package/dist/tools/builtins/sandbox/common.d.ts +243 -64
- package/dist/tools/builtins/sandbox/common.js +450 -202
- package/dist/tools/builtins/sandbox/deliver.d.ts +3 -0
- package/dist/tools/builtins/sandbox/deliver.js +113 -71
- package/dist/tools/builtins/sandbox/device-code.d.ts +40 -0
- package/dist/tools/builtins/sandbox/device-code.js +57 -0
- package/dist/tools/builtins/sandbox/device-owner.d.ts +12 -0
- package/dist/tools/builtins/sandbox/device-owner.js +13 -0
- package/dist/tools/builtins/sandbox/edit.js +14 -8
- package/dist/tools/builtins/sandbox/fetch-attachment.d.ts +10 -0
- package/dist/tools/builtins/sandbox/fetch-attachment.js +126 -0
- package/dist/tools/builtins/sandbox/file-state.d.ts +31 -1
- package/dist/tools/builtins/sandbox/file-state.js +33 -3
- package/dist/tools/builtins/sandbox/glob.js +8 -7
- package/dist/tools/builtins/sandbox/grep.js +8 -8
- package/dist/tools/builtins/sandbox/index.d.ts +10 -6
- package/dist/tools/builtins/sandbox/index.js +14 -6
- package/dist/tools/builtins/sandbox/read.d.ts +56 -2
- package/dist/tools/builtins/sandbox/read.js +272 -50
- package/dist/tools/builtins/sandbox/task-list.d.ts +12 -0
- package/dist/tools/builtins/sandbox/task-list.js +136 -0
- package/dist/tools/builtins/sandbox/task-output.d.ts +31 -42
- package/dist/tools/builtins/sandbox/task-output.js +327 -202
- package/dist/tools/builtins/sandbox/task-stop.d.ts +4 -3
- package/dist/tools/builtins/sandbox/task-stop.js +59 -30
- package/dist/tools/builtins/sandbox/write.js +14 -9
- package/dist/tools/builtins/schedules.d.ts +109 -0
- package/dist/tools/builtins/schedules.js +952 -0
- package/dist/tools/builtins/send-message.d.ts +1 -1
- package/dist/tools/builtins/send-message.js +3 -3
- package/dist/tools/builtins/size-text.d.ts +2 -0
- package/dist/tools/builtins/size-text.js +8 -0
- package/dist/tools/builtins/skill-load.d.ts +58 -6
- package/dist/tools/builtins/skill-load.js +192 -15
- package/dist/tools/builtins/tool-search.d.ts +4 -7
- package/dist/tools/builtins/tool-search.js +10 -13
- package/dist/tools/builtins/vision/read-image.d.ts +59 -0
- package/dist/tools/builtins/vision/read-image.js +220 -0
- package/dist/tools/builtins/web/extract.d.ts +2 -4
- package/dist/tools/builtins/web/extract.js +3 -6
- package/dist/tools/builtins/web/fetch.js +1 -1
- package/dist/tools/builtins/web/search.js +3 -5
- package/dist/tools/call-scope.d.ts +81 -0
- package/dist/tools/call-scope.js +48 -0
- package/dist/tools/connector-account-policies.d.ts +86 -0
- package/dist/tools/connector-account-policies.js +223 -0
- package/dist/tools/connector-content.js +1 -0
- package/dist/tools/connector-setup.d.ts +28 -0
- package/dist/tools/connector-setup.js +33 -0
- package/dist/tools/connector-tools-jobs.d.ts +35 -0
- package/dist/tools/connector-tools-jobs.js +40 -0
- package/dist/tools/connector-tools.processor.d.ts +32 -0
- package/dist/tools/connector-tools.processor.js +97 -0
- package/dist/tools/connectors.controller.d.ts +118 -17
- package/dist/tools/connectors.controller.js +191 -55
- package/dist/tools/connectors.schemas.d.ts +205 -1
- package/dist/tools/connectors.schemas.js +126 -3
- package/dist/tools/connectors.service.d.ts +291 -24
- package/dist/tools/connectors.service.js +810 -83
- package/dist/tools/credentials.d.ts +78 -0
- package/dist/tools/credentials.js +239 -2
- package/dist/tools/credentials.module.d.ts +7 -0
- package/dist/tools/credentials.module.js +22 -0
- package/dist/tools/drift.d.ts +11 -2
- package/dist/tools/drift.js +67 -31
- package/dist/tools/editable-endpoint.d.ts +23 -0
- package/dist/tools/editable-endpoint.js +92 -0
- package/dist/tools/elicitation.d.ts +2 -0
- package/dist/tools/elicitation.js +1 -1
- package/dist/tools/fixed-ask.d.ts +7 -0
- package/dist/tools/fixed-ask.js +9 -0
- package/dist/tools/git-asks.d.ts +113 -0
- package/dist/tools/git-asks.js +174 -0
- package/dist/tools/git-push-policy.d.ts +92 -0
- package/dist/tools/git-push-policy.js +180 -0
- package/dist/tools/info.d.ts +7 -11
- package/dist/tools/info.js +8 -21
- package/dist/tools/job-ids.d.ts +0 -4
- package/dist/tools/job-ids.js +1 -6
- package/dist/tools/network-asks.d.ts +252 -0
- package/dist/tools/network-asks.js +396 -0
- package/dist/tools/oauth/authorization-params.d.ts +7 -0
- package/dist/tools/oauth/authorization-params.js +19 -0
- package/dist/tools/oauth/discovery.d.ts +40 -16
- package/dist/tools/oauth/discovery.js +62 -34
- package/dist/tools/oauth/flow.d.ts +1 -1
- package/dist/tools/oauth/flow.js +12 -3
- package/dist/tools/oauth/oauth.controller.d.ts +3 -6
- package/dist/tools/oauth/oauth.controller.js +3 -12
- package/dist/tools/oauth/oauth.schemas.d.ts +14 -0
- package/dist/tools/oauth/oauth.schemas.js +27 -0
- package/dist/tools/oauth/tokens.d.ts +54 -7
- package/dist/tools/oauth/tokens.js +89 -18
- package/dist/tools/org-tool-switches.d.ts +3 -2
- package/dist/tools/org-tool-switches.js +4 -4
- package/dist/tools/outputs.d.ts +6 -4
- package/dist/tools/outputs.js +33 -29
- package/dist/tools/permission-approval-jobs.d.ts +18 -0
- package/dist/tools/permission-approval-jobs.js +95 -0
- package/dist/tools/pipeline.d.ts +421 -26
- package/dist/tools/pipeline.js +2038 -122
- package/dist/tools/policy.d.ts +55 -13
- package/dist/tools/policy.js +189 -58
- package/dist/tools/questions.controller.js +2 -2
- package/dist/tools/questions.service.d.ts +85 -11
- package/dist/tools/questions.service.js +153 -14
- package/dist/tools/registry.d.ts +157 -18
- package/dist/tools/registry.js +65 -27
- package/dist/tools/result-images.d.ts +91 -0
- package/dist/tools/result-images.js +195 -0
- package/dist/tools/tool-review.d.ts +113 -0
- package/dist/tools/tool-review.js +303 -0
- package/dist/tools/tools.module.js +60 -9
- package/dist/ui/admin-ui.controller.d.ts +56 -0
- package/dist/ui/admin-ui.controller.js +192 -0
- package/dist/ui/arrangement.d.ts +65 -0
- package/dist/ui/arrangement.js +171 -0
- package/dist/ui/embed-token.d.ts +2 -2
- package/dist/ui/embed-token.js +106 -7
- package/dist/ui/registry.d.ts +42 -17
- package/dist/ui/registry.js +46 -14
- package/dist/ui/slots.controller.d.ts +11 -0
- package/dist/ui/slots.controller.js +25 -0
- package/dist/ui/ui-stream.d.ts +20 -3
- package/dist/ui/ui-stream.js +25 -7
- package/dist/ui/ui.schemas.d.ts +73 -0
- package/dist/ui/ui.schemas.js +73 -0
- package/dist/ui/views.controller.d.ts +38 -50
- package/dist/ui/views.controller.js +67 -71
- package/dist/ui/views.d.ts +142 -20
- package/dist/ui/views.js +301 -53
- package/dist/until-aborted.d.ts +5 -0
- package/dist/until-aborted.js +16 -0
- package/package.json +4 -3
- package/src/migrations/0095_environment_files_resets.sql +5 -0
- package/src/migrations/0096_environment_demoted_default.sql +18 -0
- package/src/migrations/0097_extension_installs_enabled_at.sql +16 -0
- package/src/migrations/0098_single_provider_running_first.sql +41 -0
- package/src/migrations/0099_channel_connection_guide_ack.sql +6 -0
- package/src/migrations/0100_catalog_files.sql +13 -0
- package/src/migrations/0101_marketplace_icons.sql +32 -0
- package/src/migrations/0102_themes.sql +64 -0
- package/src/migrations/0103_ui_theme_setting.sql +7 -0
- package/src/migrations/0104_connector_tool_account_policies.sql +16 -0
- package/src/migrations/0105_devices_rename.sql +136 -0
- package/src/migrations/0106_setup_guides_v2.sql +10 -0
- package/src/migrations/0107_extension_client_builds.sql +50 -0
- package/src/migrations/0108_question_skipped.sql +6 -0
- package/src/migrations/0109_audit_platform_idx.sql +5 -0
- package/src/migrations/0110_usage_time_idx.sql +8 -0
- package/src/migrations/0111_agent_skill_sharing.sql +22 -0
- package/src/migrations/0112_skill_share_requests.sql +4 -0
- package/src/migrations/0113_scheduled_tasks.sql +108 -0
- package/src/migrations/0114_network_asks.sql +23 -0
- package/src/migrations/0115_network_requests.sql +28 -0
- package/src/migrations/0116_skills_default_on.sql +37 -0
- package/src/migrations/0117_sandbox_tiers.sql +11 -0
- package/src/migrations/0118_device_policy_ops.sql +6 -0
- package/src/migrations/0119_outbox.sql +22 -0
- package/src/migrations/0120_drop_usage_report_sweep.sql +7 -0
- package/src/migrations/0121_drop_platform_migration_runs.sql +12 -0
- package/src/migrations/0122_drop_scheduled_task_runs_rechecked_at.sql +5 -0
- package/src/migrations/0123_pgvector.sql +27 -0
- package/src/migrations/0124_conversation_source.sql +36 -0
- package/src/migrations/0125_conversation_tree_stopped_at.sql +5 -0
- package/src/migrations/0126_git_gateway.sql +10 -0
- package/src/migrations/0127_git_push_policy.sql +12 -0
- package/src/migrations/0128_scheduled_task_plugin_disabled.sql +10 -0
- package/src/migrations/0129_connector_plugin_disabled.sql +5 -0
- package/src/migrations/0130_auto_mode.sql +48 -0
- package/src/migrations/0131_device_mode.sql +9 -0
- package/src/migrations/0132_compact_runs.sql +6 -0
- package/src/migrations/0133_project_root.sql +30 -0
- package/src/migrations/0134_org_cloud_network_delta.sql +38 -0
- package/src/migrations/0135_run_execution_claim.sql +2 -0
- package/src/migrations/0136_run_recovery_cursor.sql +6 -0
- package/src/migrations/0137_audit_org_idx.sql +5 -0
- package/src/migrations/0138_plugin_install_status_no_upgrading.sql +18 -0
- package/src/migrations/0139_retire_legacy_forms.sql +183 -0
- package/src/migrations/0140_retire_history_forms.sql +148 -0
- package/src/migrations/0141_install_ledger_promoted_rows.sql +36 -0
- package/src/migrations/0142_backfill_event_fields.sql +74 -0
- package/src/migrations/0143_backfill_model_call_fields.sql +105 -0
- package/src/migrations/0144_retire_frozen_definition_keys.sql +163 -0
- package/src/migrations/0145_org_network_allowances.sql +12 -0
- package/src/migrations/0146_permission_authority_epochs.sql +6 -0
- package/src/migrations/0147_conversation_permission_profiles.sql +4 -0
- package/src/migrations/0148_first_message_request_hash.sql +2 -0
- package/src/migrations/0149_sandbox_operation_intents.sql +66 -0
- package/src/migrations/0150_permission_call_grants_and_approvals.sql +36 -0
- package/src/migrations/0151_starting_execution_grants.sql +8 -0
- package/src/migrations/0152_background_launch_identity.sql +66 -0
- package/src/migrations/0153_background_cancel_requester.sql +13 -0
- package/src/migrations/0154_cloud_owner_ceiling.sql +14 -0
- package/src/migrations/0155_device_instance_generations.sql +30 -0
- package/src/migrations/0156_device_owner_report.sql +7 -0
- package/src/migrations/0157_legacy_retirement.sql +116 -0
- package/src/migrations/0158_legacy_freeze_enumerated.sql +5 -0
- package/src/migrations/0159_retirement_exact_cancel.sql +9 -0
- package/src/migrations/0160_model_usage_image_kind.sql +10 -0
- package/src/migrations/0161_file_shares.sql +35 -0
- package/src/migrations/0162_permission_call_escalation.sql +9 -0
- package/src/migrations/0163_read_attachments.sql +10 -0
- package/src/migrations/0164_platform_icons.sql +10 -0
- package/src/migrations/0165_device_network_columns.sql +50 -0
- package/src/migrations/0166_permission_grant_full_access.sql +17 -0
- package/src/migrations/0167_device_network_backfill.sql +32 -0
- package/src/migrations/0168_binding_installed_connection.sql +6 -0
- package/src/migrations/0169_platform_sealed_inputs.sql +23 -0
- package/src/migrations/0170_platform_sealed_reveals.sql +27 -0
- package/src/migrations/0171_account_avatar.sql +26 -0
- package/src/migrations/0172_push.sql +40 -0
- package/src/migrations/0173_push_auth_notice.sql +10 -0
- package/src/migrations/0174_marketplace_managed_username.sql +4 -0
- package/src/migrations/0175_secure_input_kind.sql +8 -0
- package/src/migrations/0176_device_report.sql +6 -0
- package/src/migrations/0177_dial_in_contract.sql +32 -0
- package/src/migrations/0178_bootstrap_run_extra.sql +17 -0
- package/src/migrations/0179_device_report_limit_text.sql +28 -0
- package/src/migrations/0180_device_instance_abandoned.sql +6 -0
- package/src/migrations/0181_connector_description.sql +3 -0
- package/src/migrations/0182_rls_policies.sql +202 -0
- package/src/migrations/0183_connectors_created_by_nullable.sql +5 -0
- package/src/migrations/0184_background_cancel_failure.sql +10 -0
- package/dist/background/status.d.ts +0 -35
- package/dist/background/status.js +0 -57
- package/dist/catalog/platform-migration.d.ts +0 -115
- package/dist/catalog/platform-migration.js +0 -582
- package/dist/conversations/job-ids.d.ts +0 -6
- package/dist/conversations/job-ids.js +0 -6
- package/dist/devices/device-auth.module.d.ts +0 -7
- package/dist/devices/device-auth.module.js +0 -25
- package/dist/devices/device-gateway.d.ts +0 -128
- package/dist/devices/device-gateway.js +0 -530
- package/dist/devices/device-provider.d.ts +0 -89
- package/dist/devices/device-provider.js +0 -151
- package/dist/devices/device-routes.d.ts +0 -36
- package/dist/devices/device-routes.js +0 -90
- package/dist/devices/keys.d.ts +0 -25
- package/dist/devices/keys.js +0 -25
- package/dist/devices/machines.d.ts +0 -106
- package/dist/devices/machines.js +0 -301
- package/dist/devices/relay.d.ts +0 -100
- package/dist/devices/relay.js +0 -373
- package/dist/devices/targets.d.ts +0 -28
- package/dist/devices/targets.js +0 -73
- package/dist/environments/access.d.ts +0 -46
- package/dist/environments/access.js +0 -92
- package/dist/environments/conversation-environments.d.ts +0 -75
- package/dist/environments/conversation-environments.js +0 -231
- package/dist/environments/dto.d.ts +0 -25
- package/dist/environments/dto.js +0 -12
- package/dist/environments/environments.controller.d.ts +0 -36
- package/dist/environments/environments.controller.js +0 -124
- package/dist/environments/environments.module.d.ts +0 -8
- package/dist/environments/environments.module.js +0 -29
- package/dist/environments/environments.schemas.d.ts +0 -3
- package/dist/environments/environments.schemas.js +0 -14
- package/dist/environments/environments.service.d.ts +0 -212
- package/dist/environments/environments.service.js +0 -670
- package/dist/environments/legacy-cleanup.job.js +0 -141
- package/dist/extensions/job-ids.d.ts +0 -6
- package/dist/extensions/job-ids.js +0 -6
- package/dist/infra/queue/add-job-once.d.ts +0 -14
- package/dist/infra/queue/add-job-once.js +0 -16
- package/dist/infra/queue/retired-schedulers.d.ts +0 -7
- package/dist/infra/queue/retired-schedulers.js +0 -9
- package/dist/orgs/job-ids.d.ts +0 -8
- package/dist/orgs/job-ids.js +0 -8
- package/dist/platform/ops/environments.ops.d.ts +0 -26
- package/dist/platform/ops/environments.ops.js +0 -307
- package/dist/runtime/context/environment-paths.d.ts +0 -40
- package/dist/runtime/context/environment-paths.js +0 -48
- package/dist/runtime/context/legacy-text.d.ts +0 -22
- package/dist/runtime/context/legacy-text.js +0 -37
- package/dist/runtime/job-ids.d.ts +0 -10
- package/dist/runtime/job-ids.js +0 -10
- package/dist/runtime/retired-schedulers.d.ts +0 -7
- package/dist/runtime/retired-schedulers.js +0 -31
- package/dist/storage/job-ids.d.ts +0 -6
- package/dist/storage/job-ids.js +0 -6
- package/dist/tools/builtins/skill-write.d.ts +0 -59
- package/dist/tools/builtins/skill-write.js +0 -244
- package/dist/tools/legacy-data.d.ts +0 -34
- package/dist/tools/legacy-data.js +0 -76
- package/dist/tools/legacy-keys.d.ts +0 -51
- package/dist/tools/legacy-keys.js +0 -115
package/dist/tools/pipeline.js
CHANGED
|
@@ -7,89 +7,200 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
7
7
|
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
8
8
|
return function (target, key) { decorator(target, key, paramIndex); }
|
|
9
9
|
};
|
|
10
|
-
import {
|
|
10
|
+
import { DeviceAccessError, ToolError, validateInputForm, validateToolDisplay, } from "@capybara-hq/plugin-sdk";
|
|
11
11
|
import { Inject, Injectable, Optional } from "@nestjs/common";
|
|
12
|
+
import { sql } from "kysely";
|
|
13
|
+
import { backgroundMaxSeconds } from "../background/launch.js";
|
|
14
|
+
import { ConversationApprovalProfile } from "../conversations/approval-profile.js";
|
|
15
|
+
import { AttachmentsService } from "../conversations/attachments.service.js";
|
|
12
16
|
import { EventLog } from "../conversations/event-log.js";
|
|
13
|
-
import { ToolViewSchema } from "../conversations/events.js";
|
|
17
|
+
import { COMMAND_ASK_MAX_CHARS, COMMAND_ASK_TEXT_MAX_CHARS, ToolViewSchema, } from "../conversations/events.js";
|
|
18
|
+
import { ConversationDevices } from "../devices/conversation-devices.js";
|
|
19
|
+
import { pathAgainstWorkingRoot } from "../devices/working-root.js";
|
|
14
20
|
import { ApiError } from "../errors.js";
|
|
15
21
|
import { EffectiveConfigs, NEEDS_CONFIG_REASON } from "../extensions/effective-config.js";
|
|
16
22
|
import { clipText } from "../extensions/hooks.js";
|
|
17
23
|
import { ExtensionHost } from "../extensions/host.js";
|
|
18
24
|
import { ExtensionUnloadedError, PLUGIN_UNLOADED_TOOL_ERROR } from "../extensions/inflight.js";
|
|
19
25
|
import { audit } from "../identity/audit.js";
|
|
26
|
+
import { sha256Hex } from "../identity/hash.js";
|
|
20
27
|
import { KernelConfigService } from "../infra/config/kernel-config.service.js";
|
|
21
28
|
import { KernelDb } from "../infra/database/kernel-db.js";
|
|
22
|
-
import { TransactionHost } from "../infra/database/transaction-host.js";
|
|
29
|
+
import { TransactionHost, withTransactionFencePrelude, } from "../infra/database/transaction-host.js";
|
|
23
30
|
import { Transactional } from "../infra/database/transactional.decorator.js";
|
|
24
31
|
import { KERNEL_LOGGER } from "../infra/tokens.js";
|
|
25
32
|
import { UNKNOWN_RESULT_TEXT } from "../runtime/context/pairing.js";
|
|
26
33
|
import { fireObserve, hookDeniedAudit, hookDeniedEvent, hookScope, } from "../runtime/hook-calls.js";
|
|
27
34
|
import { subagentWaitingIdemKey } from "../runtime/loop.js";
|
|
28
|
-
import { assistantIdemKey,
|
|
35
|
+
import { assistantIdemKey, MAX_STEP_MODEL_CALLS, modelCallIdemKey } from "../runtime/model-call.js";
|
|
36
|
+
import { currentExecutionClaim } from "../runtime/run-execution.js";
|
|
29
37
|
import { rootSurfaceOf } from "../runtime/subagents/child.js";
|
|
30
38
|
import { SubagentMessages } from "../runtime/subagents/messages.js";
|
|
31
39
|
import { pairStoppedForks } from "../runtime/subagents/skill-fork.js";
|
|
32
40
|
import { SubagentsService } from "../runtime/subagents/subagents.service.js";
|
|
41
|
+
import { orgHostOutsideCeiling } from "../sandbox/modes.js";
|
|
42
|
+
import { NetworkGrants } from "../sandbox/network-grants.js";
|
|
43
|
+
import { SandboxOperationAuthority } from "../sandbox/operation-authority.js";
|
|
44
|
+
import { PermissionAuthorityLock } from "../sandbox/permission-authority-lock.js";
|
|
45
|
+
import { PermissionAutoGrants } from "../sandbox/permission-auto-grants.js";
|
|
46
|
+
import { PermissionCallGrants } from "../sandbox/permission-call-grants.js";
|
|
47
|
+
import { permissionScopeHash } from "../sandbox/permission-facts.js";
|
|
48
|
+
import { isSessionGrantableRule, } from "../sandbox/review/index.js";
|
|
49
|
+
import { approverForCrossing, buildPermissionCandidate, crossingOfCandidate, ESCALATION_RETRY_HINT, ESCALATION_UNATTENDED_WHY, escalationRefusedText, isEscalatedCall, } from "../sandbox/review/permission-candidate.js";
|
|
50
|
+
import { CommandReviewService } from "../sandbox/review/review.service.js";
|
|
51
|
+
import { SandboxService } from "../sandbox/sandbox.service.js";
|
|
52
|
+
import { appendMissingGrant, connectionGrantKey, UNATTENDED_CONNECTION_ERROR, UNATTENDED_ELICITATION_NOTE, UNATTENDED_QUESTION_ERROR, unattendedFails, unattendedRules, unattendedRunOf, } from "../schedules/unattended.js";
|
|
33
53
|
import { skillLoadOfferedIn } from "../skills/catalog.js";
|
|
34
|
-
import { ApprovalsService } from "./approvals.service.js";
|
|
54
|
+
import { ApprovalsService, } from "./approvals.service.js";
|
|
35
55
|
import { Breaker, breakerOpenMessage } from "./breaker.js";
|
|
36
|
-
import { SEND_MESSAGE, SUBAGENT_HANDBACK, TOOL_SEARCH } from "./builtin-names.js";
|
|
56
|
+
import { BUILTIN, SEND_MESSAGE, SUBAGENT_HANDBACK, TOOL_SEARCH } from "./builtin-names.js";
|
|
37
57
|
import { AGENT_TOOL, AgentToolInput } from "./builtins/agent.js";
|
|
38
58
|
import { HandbackInput } from "./builtins/handback.js";
|
|
59
|
+
import { generateImagePaths } from "./builtins/image/paths.js";
|
|
60
|
+
import { admissionUnavailableText } from "./builtins/sandbox/common.js";
|
|
61
|
+
import { DEVICE_CODE_PATTERN, deviceCodeIdemKey, GITHUB_DEVICE_LOGIN_URL, } from "./builtins/sandbox/device-code.js";
|
|
62
|
+
import { DEVICE_OF_ANOTHER_ACCOUNT_TEXT } from "./builtins/sandbox/device-owner.js";
|
|
39
63
|
import { SendMessageInput } from "./builtins/send-message.js";
|
|
40
64
|
import { isAlwaysLoaded, notLoadedText } from "./builtins/tool-search.js";
|
|
65
|
+
import { attachCallScope, stillStartingUnsent } from "./call-scope.js";
|
|
41
66
|
import { canonicalJson } from "./canonical-json.js";
|
|
42
67
|
import { CredentialMissing, Credentials } from "./credentials.js";
|
|
43
68
|
import { ToolDrift } from "./drift.js";
|
|
44
69
|
import { ElicitationSession } from "./elicitation.js";
|
|
45
|
-
import {
|
|
70
|
+
import { addressEscalationHint, blockedEventHosts, clipKept, deviceAskTerms, NETWORK_ASK_KEPT_MAX_BYTES, networkBlockedIdemKey, planNetworkAsk, serviceAskedNote, serviceAskTerms, settledNetworkNotes, withNetworkNotes, } from "./network-asks.js";
|
|
46
71
|
import { OrgToolSwitches, toolTurnedOffReason } from "./org-tool-switches.js";
|
|
47
72
|
import { renderResult, resolveOutputRefs, spillIfLarge, ToolOutputs } from "./outputs.js";
|
|
48
73
|
import { createDecidePolicy } from "./policy.js";
|
|
49
|
-
import { QuestionsService } from "./questions.service.js";
|
|
74
|
+
import { QuestionsService, } from "./questions.service.js";
|
|
50
75
|
import { redactDeep, redactorFor } from "./redact.js";
|
|
51
76
|
import { ToolRegistry, } from "./registry.js";
|
|
52
77
|
import { runResourceTool } from "./resources.js";
|
|
78
|
+
import { storeResultImages } from "./result-images.js";
|
|
79
|
+
import { ToolAskReview } from "./tool-review.js";
|
|
53
80
|
import { validateInput } from "./validate.js";
|
|
54
81
|
// ---- 模型可见文案(英文) ----
|
|
55
82
|
/** 审批被拒绝。 */
|
|
56
83
|
export const APPROVAL_DENIED_TEXT = "The user denied this tool call.";
|
|
57
84
|
/**
|
|
58
85
|
* The denied call's result when the approver gave a reason (model-visible, in the log). "An
|
|
59
|
-
* approver": under role escalation an admin, not the requester, decides.
|
|
60
|
-
* they recorded ("The user denied this tool call. Reason: …"); only new denials use this one.
|
|
86
|
+
* approver": under role escalation an admin, not the requester, decides.
|
|
61
87
|
*/
|
|
62
88
|
export const approvalDeniedText = (reason) => reason === null ? APPROVAL_DENIED_TEXT : `An approver denied this tool call. Reason: ${reason}`;
|
|
63
89
|
/** 审批超时(按拒绝)。 */
|
|
64
90
|
export const approvalExpiredText = (hours) => `Approval timed out after ${hours}h; treated as denied.`;
|
|
65
91
|
/** 等待审批期间 run 被中止。 */
|
|
66
92
|
export const APPROVAL_CANCELLED_TEXT = "The run was stopped while waiting for approval.";
|
|
93
|
+
/** A person field refused on the approval card as leaked, for a call that then did not run. */
|
|
94
|
+
export const leakedOnCardText = (path) => `The person's \`${path}\` appeared in the conversation earlier and was refused as leaked; ask them to rotate it.`;
|
|
95
|
+
/**
|
|
96
|
+
* A call that ended without running: its text, then the leaked-on-card line per person field the
|
|
97
|
+
* approval card refused as leaked (`detail.leakedFields`), so the agent has the key rotated.
|
|
98
|
+
*/
|
|
99
|
+
export const withLeakedOnCard = (text, leakedFields) => leakedFields === undefined || leakedFields.length === 0
|
|
100
|
+
? text
|
|
101
|
+
: [text, ...leakedFields.map(leakedOnCardText)].join("\n");
|
|
102
|
+
/**
|
|
103
|
+
* The command review's deny text (auto mode spec §5.4, P-D12): the model-visible reason and what it
|
|
104
|
+
* can do instead. `kind` says whether a shell command, a file write or a file read was held.
|
|
105
|
+
*/
|
|
106
|
+
export const commandDeniedText = (reason, kind) => kind === "write"
|
|
107
|
+
? `This write is blocked by review: ${reason}. Write it another way or ask the user to allow it.`
|
|
108
|
+
: kind === "read"
|
|
109
|
+
? `This read is blocked by review: ${reason}. Read another file or ask the user to allow it.`
|
|
110
|
+
: `Command blocked by review: ${reason}. Do the work another way or ask the user to run it.`;
|
|
111
|
+
/**
|
|
112
|
+
* A command (or write, or read) the review held in an unattended run: no one can answer, so it is a
|
|
113
|
+
* deny at once — no approval, no grant (P-D3).
|
|
114
|
+
*/
|
|
115
|
+
export const commandUnattendedText = (reason, kind) => kind === "command"
|
|
116
|
+
? `This command needs approval (${reason}), and no one can approve it now; do the work another way or leave it for the person.`
|
|
117
|
+
: `This ${kind} needs approval (${reason}), and no one can approve it now; do it another way or leave it for the person.`;
|
|
118
|
+
/**
|
|
119
|
+
* A command longer than the ask ceiling (`COMMAND_ASK_MAX_CHARS`): it cannot be shown for approval,
|
|
120
|
+
* and an approval must bind the whole text, so the call is refused before any approval exists.
|
|
121
|
+
*/
|
|
122
|
+
export const commandTooLongReason = (chars) => `The command is ${chars} characters long; commands over ${COMMAND_ASK_MAX_CHARS} are too long to review and approve.`;
|
|
123
|
+
/** The model-visible result of a command over the ask ceiling (actionable, English). */
|
|
124
|
+
export const commandTooLongText = (chars) => `This command is too long to review (${chars} characters; the limit is ${COMMAND_ASK_MAX_CHARS}). Split it into shorter commands; long inline scripts are reviewed as code the review cannot read.`;
|
|
125
|
+
/** The person declined a held command, write or read (P-D12); `reason` is what they said, if any. */
|
|
126
|
+
export const commandDeclinedText = (reason, kind) => {
|
|
127
|
+
const what = kind === "write" ? "this write" : kind === "read" ? "this read" : "to run this command";
|
|
128
|
+
return reason === null
|
|
129
|
+
? `The user declined ${what}. Continue without it or ask the user.`
|
|
130
|
+
: `The user declined ${what}: ${reason}. Continue without it or ask the user.`;
|
|
131
|
+
};
|
|
67
132
|
/** 等待用户输入期间 run 被中止。 */
|
|
68
133
|
export const INPUT_CANCELLED_TEXT = "The run was stopped while waiting for user input.";
|
|
134
|
+
/**
|
|
135
|
+
* The result of an `AskUserQuestion` call whose question the user skipped by sending a message
|
|
136
|
+
* (reply-while-question spec §7.1): the message follows in the log as an ordinary user message.
|
|
137
|
+
*/
|
|
138
|
+
export const QUESTION_SKIPPED_TEXT = "The user did not answer this question and sent a message instead; read it below and continue.";
|
|
139
|
+
/** The result of any other tool's input request (extension `input_required`, MCP elicitation) skipped by a message. */
|
|
140
|
+
export const INPUT_SKIPPED_TEXT = "The user did not provide the requested input and sent a message instead; read it below and continue. Call the tool again only if it is still needed.";
|
|
69
141
|
/** 同一调用连续请求输入超过上限。 */
|
|
70
142
|
export const TOO_MANY_INPUT_REQUESTS_TEXT = "Tool requested user input too many times.";
|
|
71
143
|
/** run 已被中止 / 到达截止时间,调用尚未开始执行。 */
|
|
72
144
|
export const RUN_STOPPED_TEXT = "The run was stopped before this tool call was executed.";
|
|
145
|
+
/**
|
|
146
|
+
* A call with person fields in an unattended run (ruling R6): no person is there to type the
|
|
147
|
+
* values on the card.
|
|
148
|
+
*/
|
|
149
|
+
export const PERSON_FIELDS_UNATTENDED_TEXT = "This write needs the person to enter values on the web; it cannot run unattended.";
|
|
150
|
+
/**
|
|
151
|
+
* A call with person fields whose ask would go to a role instead of the person (ruling R5): only the
|
|
152
|
+
* person the run works for may type the values, and they lack the role.
|
|
153
|
+
*/
|
|
154
|
+
export const PERSON_FIELDS_ROLE_TEXT = "This write needs the person you work for to enter values; they lack the role. Ask an admin to do it on the web.";
|
|
155
|
+
/**
|
|
156
|
+
* A call only the person may confirm (`CallPolicy.personOnly`: its result is shown once to the
|
|
157
|
+
* run's person) in an unattended run: nobody is there to read it.
|
|
158
|
+
*/
|
|
159
|
+
export const PERSON_ONLY_UNATTENDED_TEXT = "This write shows its result once, on the web, to the person you work for, and no one is there to read it; it cannot run unattended.";
|
|
160
|
+
/** A call only the person may confirm whose ask would go to a role instead of the person. */
|
|
161
|
+
export const PERSON_ONLY_ROLE_TEXT = "This write shows its result once to the person you work for, so it runs only for them, and they lack the role. Ask an admin to do it on the web.";
|
|
162
|
+
/**
|
|
163
|
+
* The review model declined, under Approve for me, a call whose approval would have gone to the
|
|
164
|
+
* person (profiles govern every approval, R3): nothing ran.
|
|
165
|
+
*/
|
|
166
|
+
export const toolReviewDeniedText = (reason) => `The review model declined this call for the person (Approve for me): ${reason} Nothing ran. Tell the person what you wanted to do and why; they can do it themselves, or switch this conversation to Request approval and approve it when you call again.`;
|
|
167
|
+
/** The reason recorded when Auto runs an approval addressed to the person (R2). */
|
|
168
|
+
export const TOOL_AUTO_REASON = "Auto runs approvals addressed to the person without asking.";
|
|
169
|
+
/** The person cancelled the secure input request of a call with person fields (R4): nothing ran. */
|
|
170
|
+
export const secureInputCancelledText = (id) => `The person cancelled secure input ${id}, so nothing ran. Never ask for the value in the conversation; call the operation again only if the person asks for it.`;
|
|
171
|
+
/** A secure input request expired unanswered (R4): nothing ran. */
|
|
172
|
+
export const secureInputExpiredText = (id, hours) => `Secure input ${id} expired after ${hours} h without the person submitting it, so nothing ran. Call the operation again if it is still needed.`;
|
|
73
173
|
/** 调用执行中 run 被中止 / 到达截止时间。 */
|
|
74
174
|
export const RUN_STOPPED_DURING_TEXT = "The run was stopped while this tool call was running; its outcome is unknown. Verify before retrying.";
|
|
175
|
+
/** The fixed result of a call whose input request was skipped by a message (spec §7.1). */
|
|
176
|
+
const skippedResult = (toolKey) => toolKey === "AskUserQuestion"
|
|
177
|
+
? {
|
|
178
|
+
content: QUESTION_SKIPPED_TEXT,
|
|
179
|
+
isError: false,
|
|
180
|
+
display: {
|
|
181
|
+
summary: {
|
|
182
|
+
zh: "用户没有回答,直接发了消息",
|
|
183
|
+
en: "User sent a message instead of answering",
|
|
184
|
+
},
|
|
185
|
+
},
|
|
186
|
+
}
|
|
187
|
+
: {
|
|
188
|
+
content: INPUT_SKIPPED_TEXT,
|
|
189
|
+
isError: true,
|
|
190
|
+
display: {
|
|
191
|
+
summary: { zh: "用户没有提供输入,直接发了消息", en: "User sent a message instead" },
|
|
192
|
+
},
|
|
193
|
+
};
|
|
75
194
|
const timeoutText = (key, ms) => `Tool ${key} timed out after ${ms / 1000}s. The operation may or may not have completed; verify before retrying.`;
|
|
195
|
+
/**
|
|
196
|
+
* The timeout of a call whose device was still starting (its instance being created or resumed,
|
|
197
|
+
* or the device service being launched) and that had sent nothing to a device service: its
|
|
198
|
+
* target was not reached. The start was stopped with the call, so a retry starts it again.
|
|
199
|
+
*/
|
|
200
|
+
export const deviceStartingTimeoutText = (key, ms) => `Tool ${key} timed out after ${ms / 1000}s while the device was still starting (its sandbox or the device service), before the call sent anything to its target. The start was stopped with the call; a retry starts the device again, and if it times out the same way the tool's time limit is too short for this device's first start: tell the user.`;
|
|
76
201
|
const failedText = (key, errName) => `Tool ${key} failed (${errName}). The operation may not have completed; check before retrying or try another approach.`;
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
const connectorSlugs = new Set();
|
|
80
|
-
const extensionNames = new Set();
|
|
81
|
-
for (const t of tools) {
|
|
82
|
-
const p = parseToolKey(t.key);
|
|
83
|
-
if (p?.kind === "connector")
|
|
84
|
-
connectorSlugs.add(p.slug);
|
|
85
|
-
else if (p?.kind === "extension")
|
|
86
|
-
extensionNames.add(p.plugin);
|
|
87
|
-
}
|
|
88
|
-
return { connectorSlugs, extensionNames };
|
|
89
|
-
};
|
|
90
|
-
const unknownToolText = (name, keys, toolSearch, hint = null) => `Unknown tool "${name}". Available tools: ${keys.length === 0 ? "(none)" : keys.join(", ")}.` +
|
|
91
|
-
(toolSearch ? " Use ToolSearch to load other tools." : "") +
|
|
92
|
-
(hint === null ? "" : ` ${hint}`);
|
|
202
|
+
const unknownToolText = (name, keys, toolSearch) => `Unknown tool "${name}". Available tools: ${keys.length === 0 ? "(none)" : keys.join(", ")}.` +
|
|
203
|
+
(toolSearch ? " Use ToolSearch to load other tools." : "");
|
|
93
204
|
const unavailableText = (name, reason) => `Tool "${name}" is unavailable: ${reason}.`;
|
|
94
205
|
/** With a per-call policy key (`Platform:<operation>`), the text names it. */
|
|
95
206
|
const deniedText = (key, policyKey) => policyKey === undefined || policyKey === key
|
|
@@ -105,9 +216,146 @@ export const hookDeniedText = (plugin, reason) => `Tool call blocked by the "${p
|
|
|
105
216
|
const invalidFormText = (key, problems) => `Tool ${key} returned an invalid input form: ${problems.join("; ")}.`;
|
|
106
217
|
const stateTooLargeText = (key) => `Tool ${key} returned input state larger than ${MAX_INPUT_STATE_BYTES / 1024} KB.`;
|
|
107
218
|
const personalMissingText = (connectorName) => `The user has not connected ${connectorName}. A connect card was shown; ask the user to connect, then retry.`;
|
|
108
|
-
|
|
219
|
+
/**
|
|
220
|
+
* A connector lacking its org input (`needs_config`, plugin pages spec §5.2.1): `Credentials`
|
|
221
|
+
* throws an org `CredentialMissing` before any credential is presented, so the call never opens.
|
|
222
|
+
*/
|
|
223
|
+
const ORG_MISSING_TEXT = "This connector needs to be configured by an organization admin before it can be used.";
|
|
109
224
|
/** Optional provider: the pipeline's {@link ToolPipelineHooks} (tests). */
|
|
110
225
|
export const TOOL_PIPELINE_HOOKS = Symbol("TOOL_PIPELINE_HOOKS");
|
|
226
|
+
/** Review usage and hooks retain the same tree ancestry on both review routes. */
|
|
227
|
+
function reviewParentOf(parent) {
|
|
228
|
+
return parent === undefined
|
|
229
|
+
? {}
|
|
230
|
+
: {
|
|
231
|
+
parentRunId: parent.runId,
|
|
232
|
+
...(parent.budgetRunId !== undefined && { budgetRunId: parent.budgetRunId }),
|
|
233
|
+
parent: {
|
|
234
|
+
conversationId: parent.conversationId,
|
|
235
|
+
runId: parent.runId,
|
|
236
|
+
callId: parent.callId,
|
|
237
|
+
},
|
|
238
|
+
};
|
|
239
|
+
}
|
|
240
|
+
/**
|
|
241
|
+
* The tools the command review covers (auto mode spec §5.1): the shell and the file tools whose
|
|
242
|
+
* writes may leave the workspace, and `GenerateImage` when it writes its images into the device
|
|
243
|
+
* (`file_path`; image generation spec §5.3, reviewed as a `Write`). Any other tool call is not
|
|
244
|
+
* reviewed (the review service answers `allow` for it too; the pipeline skips the facts read).
|
|
245
|
+
*/
|
|
246
|
+
const REVIEWED_TOOL_KEYS = new Set(["Bash", "Write", "Edit", "GenerateImage"]);
|
|
247
|
+
/** Whether the review covers this call ({@link REVIEWED_TOOL_KEYS}; `GenerateImage` with a path). */
|
|
248
|
+
const isReviewedCall = (toolKey, input) => REVIEWED_TOOL_KEYS.has(toolKey) &&
|
|
249
|
+
(toolKey !== "GenerateImage" || generateImagePaths(input).length > 0);
|
|
250
|
+
/** The paths a reviewed write writes: `file_path`, or every path of a `GenerateImage` call. */
|
|
251
|
+
const writePathsOf = (toolKey, input) => toolKey === "GenerateImage" ? generateImagePaths(input) : [textField(input, "file_path")];
|
|
252
|
+
/**
|
|
253
|
+
* A call that needs reach beyond the working directory on a device whose permission support is
|
|
254
|
+
* not verified: no approval could let admission run it, so nothing is offered.
|
|
255
|
+
*/
|
|
256
|
+
export const PERMISSION_SUPPORT_UNVERIFIED_TEXT = "This call needs access outside the working directory, but this device's permission support is not verified yet, so only paths inside the working directory work now. Keep the call inside the working directory, or retry once the device is ready.";
|
|
257
|
+
/**
|
|
258
|
+
* The managed builtins whose review depends on the device's facts (a proposed reach or a
|
|
259
|
+
* sensitive command): their first call starts the device before it is reviewed. The others start
|
|
260
|
+
* it only when they run (a Skill without scripts never does).
|
|
261
|
+
*/
|
|
262
|
+
const REVIEWED_ON_FACTS = new Set([
|
|
263
|
+
BUILTIN.Bash,
|
|
264
|
+
BUILTIN.Read,
|
|
265
|
+
BUILTIN.Write,
|
|
266
|
+
BUILTIN.Edit,
|
|
267
|
+
BUILTIN.GenerateImage,
|
|
268
|
+
]);
|
|
269
|
+
/** The refusals of a permission review that end the call (fail closed), not the run. */
|
|
270
|
+
const FAIL_CLOSED_CODES = new Set([
|
|
271
|
+
"forbidden",
|
|
272
|
+
"conflict",
|
|
273
|
+
"conversation.not_found",
|
|
274
|
+
]);
|
|
275
|
+
/** What the model gets when the permission check of its call refused (fail closed). */
|
|
276
|
+
export const permissionCheckFailedText = (why) => `The permission check for this call could not be completed (${why.replace(/\.$/, "")}), so it did not run. Retry the call once; if it fails again, ask the user to check the conversation's permission profile or to approve the call again.`;
|
|
277
|
+
/** The builtins whose device entry is the managed operation route. */
|
|
278
|
+
const MANAGED_OPERATION_TOOLS = new Set([
|
|
279
|
+
BUILTIN.Bash,
|
|
280
|
+
BUILTIN.Read,
|
|
281
|
+
BUILTIN.Write,
|
|
282
|
+
BUILTIN.Edit,
|
|
283
|
+
BUILTIN.Glob,
|
|
284
|
+
BUILTIN.Grep,
|
|
285
|
+
BUILTIN.Deliver,
|
|
286
|
+
BUILTIN.FetchAttachment,
|
|
287
|
+
BUILTIN.Skill,
|
|
288
|
+
BUILTIN.GenerateImage,
|
|
289
|
+
]);
|
|
290
|
+
/**
|
|
291
|
+
* Whether a managed builtin's call enters the device: every call of the device tools, a
|
|
292
|
+
* `GenerateImage` call only with `file_path` (one without writes nothing into the device, so it
|
|
293
|
+
* takes neither the device-owner guard nor the permission review: image generation spec §5.3),
|
|
294
|
+
* and a `Read` only with `file_path` (a `file_id` read comes from the object store: vision-read
|
|
295
|
+
* design §1.1).
|
|
296
|
+
*/
|
|
297
|
+
const entersDevice = (toolKey, input) => {
|
|
298
|
+
if (toolKey === BUILTIN.Read) {
|
|
299
|
+
return typeof input?.file_path === "string";
|
|
300
|
+
}
|
|
301
|
+
return toolKey !== BUILTIN.GenerateImage || generateImagePaths(input).length > 0;
|
|
302
|
+
};
|
|
303
|
+
/**
|
|
304
|
+
* What the review holds, for the texts and the ask's detail: a shell command, a file read (a read
|
|
305
|
+
* tool's crossing asks to read, never to write) or a file write.
|
|
306
|
+
*/
|
|
307
|
+
const reviewKindOf = (toolKey) => toolKey === BUILTIN.Bash
|
|
308
|
+
? "command"
|
|
309
|
+
: toolKey === BUILTIN.Read || toolKey === BUILTIN.Glob || toolKey === BUILTIN.Grep
|
|
310
|
+
? "read"
|
|
311
|
+
: "write";
|
|
312
|
+
/**
|
|
313
|
+
* The working root a reviewed call carries to its tool: a project root only. In free mode the
|
|
314
|
+
* reviewed root is the recorded workspace, which may be stale; the tool then maps it to the held
|
|
315
|
+
* instance's own workspace as it always has.
|
|
316
|
+
*/
|
|
317
|
+
const carriedRoot = (facts) => facts.workingRoot !== undefined && facts.workingRoot !== facts.workspace
|
|
318
|
+
? facts.workingRoot
|
|
319
|
+
: undefined;
|
|
320
|
+
/** The review record of an allowed call. */
|
|
321
|
+
const allowRecord = (v) => ({
|
|
322
|
+
decision: "allow",
|
|
323
|
+
by: v.by,
|
|
324
|
+
rule: v.rule,
|
|
325
|
+
reason: v.reason,
|
|
326
|
+
});
|
|
327
|
+
/** The review record of a denied call (the rule table's, the classifier's or a person's). */
|
|
328
|
+
const denyRecord = (by, rule, reason) => ({
|
|
329
|
+
decision: "deny",
|
|
330
|
+
by,
|
|
331
|
+
rule,
|
|
332
|
+
reason,
|
|
333
|
+
});
|
|
334
|
+
/** A string field of a validated tool input, or "" (never another type). */
|
|
335
|
+
const textField = (input, field) => {
|
|
336
|
+
const v = input?.[field];
|
|
337
|
+
return typeof v === "string" ? v : "";
|
|
338
|
+
};
|
|
339
|
+
/**
|
|
340
|
+
* The binding of an automatic decision (R2): the first 16 hex chars of the sha256 of the policy
|
|
341
|
+
* key, the definition and the raw input, as an approval binds them.
|
|
342
|
+
*/
|
|
343
|
+
const askBindingHash = (policyKey, specHash, rawInput) => sha256Hex(canonicalJson([policyKey, specHash, rawInput ?? {}])).slice(0, 16);
|
|
344
|
+
/** The profile step's outcome from a recorded automatic decision. */
|
|
345
|
+
const askDecisionOf = (event) => {
|
|
346
|
+
const p = event.payload;
|
|
347
|
+
return p.outcome === "deny"
|
|
348
|
+
? { kind: "deny", reason: p.reason }
|
|
349
|
+
: {
|
|
350
|
+
kind: "allow",
|
|
351
|
+
decision: {
|
|
352
|
+
source: p.decisionSource,
|
|
353
|
+
revision: p.profileRevision,
|
|
354
|
+
seq: event.seq,
|
|
355
|
+
...(p.fileSha256 !== undefined && { fileSha256: p.fileSha256 }),
|
|
356
|
+
},
|
|
357
|
+
};
|
|
358
|
+
};
|
|
111
359
|
const approvalAuthorization = (a) => ({
|
|
112
360
|
approvalId: a.id,
|
|
113
361
|
approvedByAccountId: a.decidedBy,
|
|
@@ -124,6 +372,11 @@ const idem = {
|
|
|
124
372
|
connection: (runId, callId) => `connection_required:${runId}:${callId}`,
|
|
125
373
|
hookDenied: (runId, callId) => `hook_denied:${runId}:${callId}`,
|
|
126
374
|
};
|
|
375
|
+
/**
|
|
376
|
+
* `ToolCallContext.idempotencyKey`: one logical call's key (a call id is unique only within its
|
|
377
|
+
* run), the same for every `InputRequired` round of the call.
|
|
378
|
+
*/
|
|
379
|
+
export const toolIdempotencyKey = (conversationId, runId, callId) => sha256Hex(`capybara:tool-call:${conversationId}:${runId}:${callId}`);
|
|
127
380
|
/** 同一调用最多连续请求用户输入的次数。 */
|
|
128
381
|
const MAX_INPUT_ROUNDS = 3;
|
|
129
382
|
/** 输入请求 state 的上限(JSON 序列化后的字节数)。 */
|
|
@@ -142,6 +395,11 @@ function loadedFrom(result, tools) {
|
|
|
142
395
|
const known = new Set(tools.filter((t) => !isAlwaysLoaded(t.key)).map((t) => t.key));
|
|
143
396
|
return [...new Set(raw.filter((k) => typeof k === "string" && known.has(k)))];
|
|
144
397
|
}
|
|
398
|
+
/** A builtin result's `media` (see `BuiltinResult`): a non-empty array, else nothing. */
|
|
399
|
+
function mediaFrom(result) {
|
|
400
|
+
const raw = result?.media;
|
|
401
|
+
return Array.isArray(raw) && raw.length > 0 ? raw : undefined;
|
|
402
|
+
}
|
|
145
403
|
class Stopped extends Error {
|
|
146
404
|
}
|
|
147
405
|
/** 在工具结果末尾附上说明(如被拒绝的 elicitation);结果不是 `{ content: [] }` 形状时原样返回。 */
|
|
@@ -156,6 +414,140 @@ function withNotes(result, notes) {
|
|
|
156
414
|
content: [...content, ...notes.map((text) => ({ type: "text", text }))],
|
|
157
415
|
};
|
|
158
416
|
}
|
|
417
|
+
/** A network ask's kept display fields, written with its result when the ask settles. */
|
|
418
|
+
export const keptExtras = (kept) => ({
|
|
419
|
+
...(kept?.outputId !== undefined && { outputId: kept.outputId }),
|
|
420
|
+
...(kept?.contentTypes !== undefined && { contentTypes: kept.contentTypes }),
|
|
421
|
+
...(kept?.display !== undefined && { display: kept.display }),
|
|
422
|
+
...(kept?.view !== undefined && { view: kept.view }),
|
|
423
|
+
...(kept?.media !== undefined && { media: kept.media }),
|
|
424
|
+
});
|
|
425
|
+
function withBlocked(outcome, scope) {
|
|
426
|
+
if (outcome.kind === "connection_required")
|
|
427
|
+
return outcome;
|
|
428
|
+
const blocked = scope?.blocked;
|
|
429
|
+
const review = scope?.review ?? null;
|
|
430
|
+
return {
|
|
431
|
+
...outcome,
|
|
432
|
+
...(blocked != null &&
|
|
433
|
+
blocked.hosts.size > 0 && {
|
|
434
|
+
blocked: { deviceId: blocked.deviceId, hosts: [...blocked.hosts], url: blocked.url },
|
|
435
|
+
}),
|
|
436
|
+
// a device service launch's review (ctx.deviceAccess), recorded with the call's result
|
|
437
|
+
...(review !== null && { review }),
|
|
438
|
+
};
|
|
439
|
+
}
|
|
440
|
+
/**
|
|
441
|
+
* What a call's earlier input rounds carried for its result ({@link QuestionCarried}): the latest
|
|
442
|
+
* launch review, and every refused host (the latest device and page) in one report.
|
|
443
|
+
*/
|
|
444
|
+
function carriedOf(rounds) {
|
|
445
|
+
let review;
|
|
446
|
+
let blocked;
|
|
447
|
+
for (const r of rounds) {
|
|
448
|
+
if (r.carried?.review !== undefined)
|
|
449
|
+
review = r.carried.review;
|
|
450
|
+
const b = r.carried?.blocked;
|
|
451
|
+
if (b !== undefined)
|
|
452
|
+
blocked = mergeBlocked(blocked, b);
|
|
453
|
+
}
|
|
454
|
+
return {
|
|
455
|
+
...(review !== undefined && { review }),
|
|
456
|
+
...(blocked !== undefined && { blocked }),
|
|
457
|
+
};
|
|
458
|
+
}
|
|
459
|
+
/** Two refused-host reports of one call as one: the hosts of both, the later device and page. */
|
|
460
|
+
function mergeBlocked(a, b) {
|
|
461
|
+
if (a === undefined)
|
|
462
|
+
return { ...b, hosts: [...b.hosts] };
|
|
463
|
+
return {
|
|
464
|
+
deviceId: b.deviceId ?? a.deviceId,
|
|
465
|
+
hosts: [...new Set([...a.hosts, ...b.hosts])],
|
|
466
|
+
url: b.url ?? a.url,
|
|
467
|
+
};
|
|
468
|
+
}
|
|
469
|
+
/**
|
|
470
|
+
* The outcome with what earlier input rounds carried: their launch review when this round
|
|
471
|
+
* reviewed none, their refused hosts merged before this round's.
|
|
472
|
+
*/
|
|
473
|
+
function withCarried(outcome, carried) {
|
|
474
|
+
if (outcome.kind === "connection_required")
|
|
475
|
+
return outcome;
|
|
476
|
+
if (carried.review === undefined && carried.blocked === undefined)
|
|
477
|
+
return outcome;
|
|
478
|
+
const blocked = carried.blocked === undefined
|
|
479
|
+
? outcome.blocked
|
|
480
|
+
: outcome.blocked === undefined
|
|
481
|
+
? carried.blocked
|
|
482
|
+
: mergeBlocked(carried.blocked, outcome.blocked);
|
|
483
|
+
const review = outcome.review ?? carried.review;
|
|
484
|
+
return {
|
|
485
|
+
...outcome,
|
|
486
|
+
...(blocked !== undefined && { blocked }),
|
|
487
|
+
...(review !== undefined && { review }),
|
|
488
|
+
};
|
|
489
|
+
}
|
|
490
|
+
/**
|
|
491
|
+
* The attempt of a device service's call whose network ask was approved (the person added its
|
|
492
|
+
* hosts to the device's list, browser use spec §7.1) with hosts in force from the next command:
|
|
493
|
+
* the call runs again in the next attempt. Null for any other ask, or none.
|
|
494
|
+
*/
|
|
495
|
+
function serviceRerunAfter(ask) {
|
|
496
|
+
const d = ask?.detail;
|
|
497
|
+
if (ask?.status !== "approved" || ask.scope !== "always" || d?.kind !== "service")
|
|
498
|
+
return null;
|
|
499
|
+
// hosts that apply only at the device's next use or after a files reset are not in force for
|
|
500
|
+
// a re-run now: the kept result is written with the outcome's note instead, as for a command
|
|
501
|
+
if (d.appliesAt !== "next-command")
|
|
502
|
+
return null;
|
|
503
|
+
return d.attempt;
|
|
504
|
+
}
|
|
505
|
+
/** A builtin result's kernel-internal network report (see `BuiltinResult.networkReport`). */
|
|
506
|
+
function networkReportOf(result) {
|
|
507
|
+
const r = result?.networkReport;
|
|
508
|
+
if (r === undefined || typeof r.deviceId !== "string" || !Array.isArray(r.blocked)) {
|
|
509
|
+
return undefined;
|
|
510
|
+
}
|
|
511
|
+
const blocked = r.blocked.filter((b) => typeof b === "object" &&
|
|
512
|
+
b !== null &&
|
|
513
|
+
typeof b.host === "string" &&
|
|
514
|
+
typeof b.port === "number" &&
|
|
515
|
+
["device", "org", "address", "unknown"].includes(b.layer));
|
|
516
|
+
return blocked.length === 0 ? undefined : { deviceId: r.deviceId, blocked };
|
|
517
|
+
}
|
|
518
|
+
/**
|
|
519
|
+
* A kernel-internal device code (see `BuiltinResult.loginCode` and `KeptToolResult.loginCode`):
|
|
520
|
+
* the shape is checked again here so a malformed value never reaches the log (the event schema
|
|
521
|
+
* would throw).
|
|
522
|
+
*/
|
|
523
|
+
function validLoginCode(v) {
|
|
524
|
+
const r = v;
|
|
525
|
+
if (r == null ||
|
|
526
|
+
typeof r.url !== "string" ||
|
|
527
|
+
typeof r.code !== "string" ||
|
|
528
|
+
r.url !== GITHUB_DEVICE_LOGIN_URL ||
|
|
529
|
+
!DEVICE_CODE_PATTERN.test(r.code)) {
|
|
530
|
+
return undefined;
|
|
531
|
+
}
|
|
532
|
+
return { url: r.url, code: r.code };
|
|
533
|
+
}
|
|
534
|
+
/** A builtin result's kernel-internal device code (`{ loginCode: { url, code } }`). */
|
|
535
|
+
function loginCodeOf(result) {
|
|
536
|
+
return validLoginCode(result?.loginCode);
|
|
537
|
+
}
|
|
538
|
+
/**
|
|
539
|
+
* The display-only `device_code` event of the call whose output carried the code (auto mode spec
|
|
540
|
+
* §6, P-D13). The key is per (run, call), so a retry of that call appends it once; a different
|
|
541
|
+
* call with the same code is deduplicated by value (`EventLog.deviceCodeShown`).
|
|
542
|
+
*/
|
|
543
|
+
function deviceCodeEvent(runId, step, callId, code) {
|
|
544
|
+
return {
|
|
545
|
+
type: "device_code",
|
|
546
|
+
runId,
|
|
547
|
+
idemKey: deviceCodeIdemKey(runId, callId),
|
|
548
|
+
payload: { step, callId, ...code },
|
|
549
|
+
};
|
|
550
|
+
}
|
|
159
551
|
/** 审批的等待时长(小时,四舍五入,至少 1)。 */
|
|
160
552
|
const approvalHours = (a) => Math.max(1, Math.round((new Date(a.expiresAt).getTime() - new Date(a.createdAt).getTime()) / 3_600_000));
|
|
161
553
|
const approvalWait = (a) => ({
|
|
@@ -178,6 +570,14 @@ const inputWait = (q) => ({
|
|
|
178
570
|
let ToolPipeline = class ToolPipeline {
|
|
179
571
|
config;
|
|
180
572
|
txHost;
|
|
573
|
+
permissionAuthority;
|
|
574
|
+
permissionGrants;
|
|
575
|
+
autoGrants;
|
|
576
|
+
permissionLocks;
|
|
577
|
+
sandboxes;
|
|
578
|
+
approvalProfile;
|
|
579
|
+
toolReview;
|
|
580
|
+
resultImages;
|
|
181
581
|
decide;
|
|
182
582
|
deps;
|
|
183
583
|
constructor(kdb, eventLog,
|
|
@@ -186,10 +586,42 @@ let ToolPipeline = class ToolPipeline {
|
|
|
186
586
|
/** The message tools between agents; absent (tests): their calls are refused. */
|
|
187
587
|
messages, registry, credentials, breaker, outputs, approvals, questions, config, log,
|
|
188
588
|
/** Plugin hooks and inline ui contributions; absent (tests): no hooks, cards dropped. */
|
|
189
|
-
host, drift, effective, switches, txHost, hooks
|
|
589
|
+
host, drift, effective, switches, txHost, hooks, networkGrants,
|
|
590
|
+
/** The command review (auto mode spec §5.4); absent in hand-built pipelines. */
|
|
591
|
+
review,
|
|
592
|
+
/** The reviewed call's device facts; absent in hand-built pipelines. */
|
|
593
|
+
devices, permissionAuthority, permissionGrants,
|
|
594
|
+
/** Full access auto-grants, recorded exactly once (absent in hand-built pipelines). */
|
|
595
|
+
autoGrants, permissionLocks,
|
|
596
|
+
/** Starts a cloud device before its first managed call is reviewed (absent: never). */
|
|
597
|
+
sandboxes,
|
|
598
|
+
/**
|
|
599
|
+
* The profile of an ask addressed to the conversation's person (profiles govern every
|
|
600
|
+
* approval, R1); absent with {@link toolReview} (hand-built pipelines): every ask asks.
|
|
601
|
+
*/
|
|
602
|
+
approvalProfile,
|
|
603
|
+
/** The review model's judgment of an ask under Approve for me (R3); absent: every ask asks. */
|
|
604
|
+
toolReview,
|
|
605
|
+
/**
|
|
606
|
+
* Stores the images a tool result carries as `read` copies of the calling conversation (tool
|
|
607
|
+
* result images design §2); absent (hand-built pipelines): images are named as not stored.
|
|
608
|
+
*/
|
|
609
|
+
resultImages) {
|
|
190
610
|
this.config = config;
|
|
191
611
|
this.txHost = txHost;
|
|
612
|
+
this.permissionAuthority = permissionAuthority;
|
|
613
|
+
this.permissionGrants = permissionGrants;
|
|
614
|
+
this.autoGrants = autoGrants;
|
|
615
|
+
this.permissionLocks = permissionLocks;
|
|
616
|
+
this.sandboxes = sandboxes;
|
|
617
|
+
this.approvalProfile = approvalProfile;
|
|
618
|
+
this.toolReview = toolReview;
|
|
619
|
+
this.resultImages = resultImages;
|
|
192
620
|
this.deps = {
|
|
621
|
+
// the builtins that enter a device on the managed operation route (common.ts
|
|
622
|
+
// `inToolSandbox`, `inSandboxPreparation`): their review is the permission review, whose
|
|
623
|
+
// approvals issue the exact call grants admission reads
|
|
624
|
+
permissionOperations: MANAGED_OPERATION_TOOLS,
|
|
193
625
|
get db() {
|
|
194
626
|
return kdb.db;
|
|
195
627
|
},
|
|
@@ -207,9 +639,12 @@ let ToolPipeline = class ToolPipeline {
|
|
|
207
639
|
},
|
|
208
640
|
effective,
|
|
209
641
|
switches,
|
|
210
|
-
inlineViews: (plugin) => new Set((host?.current(plugin)?.
|
|
211
|
-
.filter((
|
|
212
|
-
.map((
|
|
642
|
+
inlineViews: (plugin) => new Set((host?.current(plugin)?.ui ?? [])
|
|
643
|
+
.filter((r) => r.slot.id === "conversation.tool-result.card")
|
|
644
|
+
.map((r) => r.contribution.id)),
|
|
645
|
+
panels: (plugin) => new Set((host?.current(plugin)?.ui ?? [])
|
|
646
|
+
.filter((r) => r.slot.id === "conversation.panel")
|
|
647
|
+
.map((r) => r.contribution.id)),
|
|
213
648
|
onToolsChanged: (orgId, connectorId) => {
|
|
214
649
|
void drift?.onToolsChanged(orgId, connectorId);
|
|
215
650
|
},
|
|
@@ -217,10 +652,20 @@ let ToolPipeline = class ToolPipeline {
|
|
|
217
652
|
return subagents ? { dispatch: (a) => subagents.dispatch(a) } : undefined;
|
|
218
653
|
},
|
|
219
654
|
messages,
|
|
655
|
+
review,
|
|
656
|
+
devices,
|
|
657
|
+
network: networkGrants
|
|
658
|
+
? {
|
|
659
|
+
grants: networkGrants,
|
|
660
|
+
...(this.sandboxes !== undefined && { sandbox: this.sandboxes }),
|
|
661
|
+
}
|
|
662
|
+
: undefined,
|
|
220
663
|
};
|
|
221
664
|
const decide = hooks?.decidePolicy;
|
|
222
665
|
// the default policy reads live, on the context's handle
|
|
223
|
-
this.decide =
|
|
666
|
+
this.decide =
|
|
667
|
+
decide ??
|
|
668
|
+
((tool, def, c) => createDecidePolicy(kdb.db, log.debug && { debug: log.debug.bind(log) })(tool, def, c));
|
|
224
669
|
}
|
|
225
670
|
/**
|
|
226
671
|
* tools 节点:按顺序处理本步 assistant 消息里的全部 `tool_call`,每个调用都以一条 `tool_result` 结束
|
|
@@ -229,12 +674,21 @@ let ToolPipeline = class ToolPipeline {
|
|
|
229
674
|
* 某个调用需要等人处理(审批 / 用户输入)→ 返回 `suspended`,之后的调用留到续跑时处理;
|
|
230
675
|
* 续跑时重新进入本函数,按 PG 里的审批 / 输入请求结果继续。
|
|
231
676
|
*/
|
|
232
|
-
async runStep(
|
|
677
|
+
async runStep(given) {
|
|
678
|
+
let ctx = given;
|
|
233
679
|
const { eventLog } = this.deps;
|
|
234
680
|
const msg = await eventLog.findByIdem(ctx.conversationId, assistantIdemKey(ctx.runId, ctx.step));
|
|
235
681
|
if (msg?.type !== "assistant_message")
|
|
236
682
|
return { kind: "done" };
|
|
237
683
|
const calls = msg.payload.content.flatMap((b) => b.type === "tool_call" ? [{ id: b.id, name: b.name, input: b.input }] : []);
|
|
684
|
+
// scheduled tasks spec §7: read live for each step (a person's message absorbed since makes the
|
|
685
|
+
// rest of the run attended)
|
|
686
|
+
if (calls.length > 0 && ctx.unattended === undefined) {
|
|
687
|
+
ctx = {
|
|
688
|
+
...ctx,
|
|
689
|
+
unattended: await unattendedRunOf(this.deps.db, this.config, ctx.orgId, ctx.runId),
|
|
690
|
+
};
|
|
691
|
+
}
|
|
238
692
|
let resolved;
|
|
239
693
|
const resolve = async () => {
|
|
240
694
|
// 每步实时解析(连接器 / 插件状态可能在模型调用之后变化)
|
|
@@ -251,6 +705,7 @@ let ToolPipeline = class ToolPipeline {
|
|
|
251
705
|
forkChild: ctx.parent?.forSkill === true,
|
|
252
706
|
sandboxConversationId: ctx.parent?.rootConversationId ?? ctx.conversationId,
|
|
253
707
|
replay: ctx.conversationKind === "eval",
|
|
708
|
+
source: ctx.source,
|
|
254
709
|
});
|
|
255
710
|
}
|
|
256
711
|
return resolved;
|
|
@@ -268,7 +723,7 @@ let ToolPipeline = class ToolPipeline {
|
|
|
268
723
|
}
|
|
269
724
|
/**
|
|
270
725
|
* Writes, in the caller's transaction (`mandatory`), what a run that is being stopped (a person,
|
|
271
|
-
* its deadline, a failure,
|
|
726
|
+
* its deadline, a failure, an orphan repair) still owes its log: the report of its fork invocation
|
|
272
727
|
* (phase D, `pairStoppedForks`; a still active fork child is stopped by the caller after its
|
|
273
728
|
* commit). An `Agent` call has its result from its dispatch (agent map spec §4.1), so there is
|
|
274
729
|
* nothing to write for it. Returns the fork's call id (the caller must not write a "not executed"
|
|
@@ -288,24 +743,93 @@ let ToolPipeline = class ToolPipeline {
|
|
|
288
743
|
const last = rounds.at(-1);
|
|
289
744
|
if (last?.status === "pending")
|
|
290
745
|
return inputWait(last);
|
|
291
|
-
|
|
292
|
-
|
|
746
|
+
// skipped by the starter's message: the kernel writes the result, the tool is not called again
|
|
747
|
+
// (spec D6: an extension would only see `answer: null`, an MCP call would be re-sent)
|
|
748
|
+
if (last?.status === "skipped") {
|
|
749
|
+
await this.writeResult(ctx, call.id, last.toolKey, skippedResult(last.toolKey));
|
|
750
|
+
return undefined;
|
|
751
|
+
}
|
|
752
|
+
let attempt = rounds.length + 1;
|
|
753
|
+
// a device service's call that ran again after its network ask took one attempt more (browser
|
|
754
|
+
// use spec §7.1): input rounds the re-run asked come after it
|
|
755
|
+
if (rounds.length > 0) {
|
|
756
|
+
const asked = serviceRerunAfter(await this.deps.approvals.networkForCall(ctx.runId, call.id));
|
|
757
|
+
if (asked !== null && attempt > asked)
|
|
758
|
+
attempt += 1;
|
|
759
|
+
}
|
|
760
|
+
const resume = last
|
|
761
|
+
? { state: last.state, answer: last.status === "answered" ? last.answer : null }
|
|
762
|
+
: undefined;
|
|
763
|
+
let started = await this.deps.eventLog.findByIdem(ctx.conversationId, idem.started(ctx.runId, call.id, attempt));
|
|
293
764
|
if (started?.type === "tool_call_started") {
|
|
765
|
+
// a command that ran and was refused a network host waits for the device owner (network
|
|
766
|
+
// ask-to-allow spec §6.2, P-D2): pending → wait on; settled → its kept result and the
|
|
767
|
+
// outcome's note (the command is never run again; its tool.called was audited when it ran).
|
|
768
|
+
// A device service's ask (browser use spec §7.1) belongs to the attempt that asked; once
|
|
769
|
+
// the person added its hosts to the device's list the call runs again in the next attempt
|
|
770
|
+
const ask = await this.deps.approvals.networkForCall(ctx.runId, call.id);
|
|
771
|
+
const askedHere = ask !== null && (ask.detail?.kind !== "service" || ask.detail.attempt === attempt);
|
|
772
|
+
if (ask !== null && askedHere) {
|
|
773
|
+
const notes = settledNetworkNotes(ask, approvalHours(ask));
|
|
774
|
+
if (notes === null)
|
|
775
|
+
return approvalWait(ask);
|
|
776
|
+
if (serviceRerunAfter(ask) === null) {
|
|
777
|
+
const kept = ask.detail?.result;
|
|
778
|
+
// the device code the command printed is carried in the kept result: write its
|
|
779
|
+
// display-only event here too (a crash before the ask's first write, or an older kept
|
|
780
|
+
// result; the event's ids and the per-conversation code check keep it to one)
|
|
781
|
+
const keptCode = validLoginCode(kept?.loginCode);
|
|
782
|
+
const pre = keptCode !== undefined &&
|
|
783
|
+
!(await this.deps.eventLog.deviceCodeShown(ctx.conversationId, keptCode.code))
|
|
784
|
+
? [deviceCodeEvent(ctx.runId, ctx.step, call.id, keptCode)]
|
|
785
|
+
: [];
|
|
786
|
+
await this.writeResult(ctx, call.id, call.name, {
|
|
787
|
+
...keptExtras(kept),
|
|
788
|
+
content: withNetworkNotes(kept?.content ?? UNKNOWN_RESULT_TEXT, notes),
|
|
789
|
+
isError: kept?.isError ?? true,
|
|
790
|
+
...(kept?.review !== undefined && { review: kept.review }),
|
|
791
|
+
}, pre);
|
|
792
|
+
return undefined;
|
|
793
|
+
}
|
|
794
|
+
const rerun = await this.deps.eventLog.findByIdem(ctx.conversationId, idem.started(ctx.runId, call.id, attempt + 1));
|
|
795
|
+
if (rerun?.type !== "tool_call_started") {
|
|
796
|
+
// the asked hosts are settled: only an earlier round's launch review is carried
|
|
797
|
+
const { review: carriedReview } = carriedOf(rounds);
|
|
798
|
+
return this.runCall(ctx, call, await resolve(), attempt + 1, resume, {
|
|
799
|
+
...(carriedReview !== undefined && { review: carriedReview }),
|
|
800
|
+
});
|
|
801
|
+
}
|
|
802
|
+
// the re-run started and its result was lost: the result is unknown, as below
|
|
803
|
+
started = rerun;
|
|
804
|
+
}
|
|
294
805
|
// 确实开始执行过:照样审计 tool.called(耗时未知);放行依据只认批准了所执行定义的审批记录
|
|
295
806
|
const key = started.payload.toolKey;
|
|
296
807
|
const approval = await this.deps.approvals.forCall(ctx.runId, call.id);
|
|
297
808
|
const approved = approval?.status === "approved" && approval.specHash === started.payload.specHash
|
|
298
809
|
? approval
|
|
299
810
|
: null;
|
|
811
|
+
// a command that ran under the person's `command` approval: its review record and
|
|
812
|
+
// authorization survive the lost result too (the ask is the whole truth on a resume)
|
|
813
|
+
const commandAsk = await this.deps.approvals.commandForCall(ctx.runId, call.id);
|
|
814
|
+
const command = commandAsk?.status === "approved" ? commandAsk : null;
|
|
815
|
+
const authorization = approved !== null
|
|
816
|
+
? approvalAuthorization(approved)
|
|
817
|
+
: command !== null
|
|
818
|
+
? approvalAuthorization(command)
|
|
819
|
+
: null;
|
|
300
820
|
const source = approved ? null : (await resolve()).tools.find((t) => t.key === key)?.source;
|
|
301
|
-
await this.writeResult(ctx, call.id, key, {
|
|
821
|
+
await this.writeResult(ctx, call.id, key, {
|
|
822
|
+
content: UNKNOWN_RESULT_TEXT,
|
|
823
|
+
isError: true,
|
|
824
|
+
...(command !== null && { review: this.personAllowRecord(command) }),
|
|
825
|
+
}, [], {
|
|
302
826
|
durationMs: null,
|
|
303
827
|
connectorId: approved
|
|
304
828
|
? approved.connectorId
|
|
305
829
|
: source?.kind === "connector"
|
|
306
830
|
? source.connectorId
|
|
307
831
|
: null,
|
|
308
|
-
...(
|
|
832
|
+
...(authorization !== null && { authorization }),
|
|
309
833
|
});
|
|
310
834
|
return undefined;
|
|
311
835
|
}
|
|
@@ -316,31 +840,29 @@ let ToolPipeline = class ToolPipeline {
|
|
|
316
840
|
});
|
|
317
841
|
return undefined;
|
|
318
842
|
}
|
|
319
|
-
|
|
320
|
-
? { state: last.state, answer: last.status === "answered" ? last.answer : null }
|
|
321
|
-
: undefined;
|
|
322
|
-
return this.runCall(ctx, call, await resolve(), attempt, resume);
|
|
843
|
+
return this.runCall(ctx, call, await resolve(), attempt, resume, carriedOf(rounds));
|
|
323
844
|
}
|
|
324
|
-
async runCall(ctx, call, resolved, attempt, resume
|
|
325
|
-
|
|
326
|
-
|
|
845
|
+
async runCall(ctx, call, resolved, attempt, resume,
|
|
846
|
+
/** What earlier input rounds of the call collected for its result ({@link carriedOf}). */
|
|
847
|
+
carried = {}) {
|
|
848
|
+
// the command review's record for this call's result (absent: not reviewed, or no device)
|
|
849
|
+
let review;
|
|
850
|
+
const fail = async (content, key = call.name, view) => {
|
|
851
|
+
await this.writeResult(ctx, call.id, key, {
|
|
852
|
+
content,
|
|
853
|
+
isError: true,
|
|
854
|
+
...(view !== undefined && { view }),
|
|
855
|
+
...(review !== undefined && { review }),
|
|
856
|
+
});
|
|
327
857
|
return undefined;
|
|
328
858
|
};
|
|
329
|
-
|
|
330
|
-
// A call logged before the tool keys were renamed (spec 8.1): the request that issued it offered
|
|
331
|
-
// the old key. It runs as the current tool with translated input; the result keeps the logged key.
|
|
332
|
-
let legacy = false;
|
|
333
|
-
if (!tool) {
|
|
334
|
-
const next = legacyToolKey(call.name, legacyScopeOf(resolved.tools));
|
|
335
|
-
const current = next === null ? undefined : resolved.tools.find((t) => t.key === next);
|
|
336
|
-
if (current && (await this.requestToolKeys(ctx))?.has(call.name) === true) {
|
|
337
|
-
tool = current;
|
|
338
|
-
legacy = true;
|
|
339
|
-
}
|
|
340
|
-
}
|
|
859
|
+
const tool = resolved.tools.find((t) => t.key === call.name);
|
|
341
860
|
if (!tool) {
|
|
861
|
+
// a hidden `<prefix>__*` ref covers every tool of that source (a disabled or needs_config
|
|
862
|
+
// connector), so a call of one of them gets the reason, not "unknown tool"
|
|
863
|
+
const covers = (ref) => ref === call.name || (ref.endsWith("__*") && call.name.startsWith(ref.slice(0, -1)));
|
|
342
864
|
const why = resolved.unavailable.find((u) => u.ref === call.name) ??
|
|
343
|
-
resolved.hidden?.find((u) => u.ref
|
|
865
|
+
resolved.hidden?.find((u) => covers(u.ref));
|
|
344
866
|
if (why)
|
|
345
867
|
return fail(unavailableText(call.name, why.reason));
|
|
346
868
|
let keys = resolved.tools.map((t) => t.key);
|
|
@@ -351,20 +873,22 @@ let ToolPipeline = class ToolPipeline {
|
|
|
351
873
|
keys = keys.filter((k) => isAlwaysLoaded(k) || sent.has(k));
|
|
352
874
|
}
|
|
353
875
|
keys.sort();
|
|
354
|
-
|
|
876
|
+
// In ToolSearch mode a name the model has not loaded (a catalog tool, or one it misspelled) is
|
|
877
|
+
// the protocol asking it to search, not a failure: the row reads neutral like `not_loaded`.
|
|
878
|
+
return fail(unknownToolText(call.name, keys, keys.includes(TOOL_SEARCH)), call.name, resolved.toolSearch === true ? { kind: "not_loaded" } : undefined);
|
|
355
879
|
}
|
|
356
|
-
const outKey =
|
|
880
|
+
const outKey = tool.key;
|
|
357
881
|
// ToolSearch 模式下,模型只能调用请求里带了完整定义的工具:目录里有、但发出本次调用的请求没加载 →
|
|
358
882
|
// 明确错误,不自动加载(spec 5.5 / 6.3)。同一步里先 ToolSearch 再调用刚加载的工具同样报错。
|
|
359
|
-
|
|
883
|
+
// This is the protocol working, not a failure: the `not_loaded` view lets the row read neutral.
|
|
884
|
+
if (resolved.toolSearch === true && !isAlwaysLoaded(tool.key)) {
|
|
360
885
|
const sent = await this.sentTools(ctx);
|
|
361
886
|
if (sent !== null && !sent.has(tool.key))
|
|
362
|
-
return fail(notLoadedText(tool.key), outKey);
|
|
887
|
+
return fail(notLoadedText(tool.key), outKey, { kind: "not_loaded" });
|
|
363
888
|
}
|
|
364
|
-
const rawInput = legacy ? legacyToolInput(call.name, call.input) : call.input;
|
|
365
889
|
let input;
|
|
366
890
|
try {
|
|
367
|
-
input = await resolveOutputRefs(
|
|
891
|
+
input = await resolveOutputRefs(call.input, (id) => this.deps.outputs.load({ orgId: ctx.orgId, conversationId: ctx.conversationId }, id));
|
|
368
892
|
}
|
|
369
893
|
catch (e) {
|
|
370
894
|
if (e instanceof ToolError)
|
|
@@ -386,7 +910,8 @@ let ToolPipeline = class ToolPipeline {
|
|
|
386
910
|
agentId: ctx.agentId,
|
|
387
911
|
conversationId: ctx.conversationId,
|
|
388
912
|
runId: ctx.runId,
|
|
389
|
-
|
|
913
|
+
callId: call.id,
|
|
914
|
+
rawInput: call.input,
|
|
390
915
|
signal: ctx.signal,
|
|
391
916
|
})) ?? null;
|
|
392
917
|
// a deny with a reason (e.g. an unavailable operation): the reason is the tool error
|
|
@@ -394,7 +919,16 @@ let ToolPipeline = class ToolPipeline {
|
|
|
394
919
|
return fail(callPolicy.denyReason, outKey);
|
|
395
920
|
}
|
|
396
921
|
const policyKey = callPolicy?.key ?? tool.key;
|
|
397
|
-
|
|
922
|
+
// person fields (platform web parity spec §4.2; profiles govern every approval R4, R5): the
|
|
923
|
+
// person types the values in a secure input request, so an unattended run (a trial run has its
|
|
924
|
+
// creator there) cannot make the call at all
|
|
925
|
+
const personFields = callPolicy?.personFields;
|
|
926
|
+
// a call whose result is shown once to the run's person is refused there the same way
|
|
927
|
+
const personOnly = callPolicy?.personOnly === true;
|
|
928
|
+
if ((personFields !== undefined || personOnly) && unattendedRules(ctx.unattended)) {
|
|
929
|
+
return fail(personFields !== undefined ? PERSON_FIELDS_UNATTENDED_TEXT : PERSON_ONLY_UNATTENDED_TEXT, outKey);
|
|
930
|
+
}
|
|
931
|
+
let decision = await this.decide(tool, ctx.agent, {
|
|
398
932
|
orgId: ctx.orgId,
|
|
399
933
|
accountId: ctx.accountId,
|
|
400
934
|
agentId: ctx.agentId,
|
|
@@ -406,28 +940,71 @@ let ToolPipeline = class ToolPipeline {
|
|
|
406
940
|
...(ctx.parent.otherAgent !== undefined && { parentAgentDiffers: ctx.parent.otherAgent }),
|
|
407
941
|
}),
|
|
408
942
|
callPolicy,
|
|
943
|
+
...(ctx.unattended != null && { unattended: ctx.unattended }),
|
|
409
944
|
});
|
|
410
945
|
if (decision === "deny")
|
|
411
946
|
return fail(deniedText(tool.key, callPolicy?.key), outKey);
|
|
947
|
+
if (typeof decision === "object" && "refused" in decision) {
|
|
948
|
+
if (decision.missingGrant !== undefined && ctx.unattended != null) {
|
|
949
|
+
await appendMissingGrant(this.deps.db, ctx.unattended.taskRunId, decision.missingGrant);
|
|
950
|
+
}
|
|
951
|
+
return fail(decision.refused, outKey);
|
|
952
|
+
}
|
|
412
953
|
if (typeof decision === "object" && "unavailable" in decision) {
|
|
413
954
|
return fail(unavailableText(tool.key, decision.unavailable), outKey);
|
|
414
955
|
}
|
|
956
|
+
if (personOnly || personFields !== undefined) {
|
|
957
|
+
// R6: a call only the person may confirm is always their own ask, never a grant or an
|
|
958
|
+
// `allow` (the default policy already asks for them; this holds for any decision). Person
|
|
959
|
+
// fields no longer force the consent (R5): it follows the call's policy, grants and profile
|
|
960
|
+
if (personOnly && (decision === "allow" || "grant" in decision)) {
|
|
961
|
+
decision = {
|
|
962
|
+
ask: {
|
|
963
|
+
toolKey: policyKey,
|
|
964
|
+
specHash: tool.specHash,
|
|
965
|
+
connectorId: tool.source.kind === "connector" ? tool.source.connectorId : null,
|
|
966
|
+
requestedFor: ctx.accountId,
|
|
967
|
+
approverRole: null,
|
|
968
|
+
policy: "fixed",
|
|
969
|
+
},
|
|
970
|
+
};
|
|
971
|
+
}
|
|
972
|
+
// R5: only the person the run works for types the values or reads the result; a role
|
|
973
|
+
// escalation cannot ask them
|
|
974
|
+
if (typeof decision === "object" && "ask" in decision && decision.ask.requestedFor === null) {
|
|
975
|
+
return fail(personFields !== undefined ? PERSON_FIELDS_ROLE_TEXT : PERSON_ONLY_ROLE_TEXT, outKey);
|
|
976
|
+
}
|
|
977
|
+
}
|
|
415
978
|
// 该调用已有审批(续跑)→ 按审批结果;没有且策略为 ask → 建审批并等待
|
|
416
979
|
// (不写 tool_call_started:此时尚未开始执行)。
|
|
417
980
|
let approval = await this.deps.approvals.forCall(ctx.runId, call.id);
|
|
418
981
|
// 批准的是旧定义(等待期间工具定义变了):原批准不适用于当前定义,策略仍需审批时按新定义重新审批。
|
|
419
|
-
// An in-flight rc call (spec §9) is the exception: its approval was asked under the rc definition
|
|
420
|
-
// of the same call, and the rename changed every builtin's definition; the person approved this
|
|
421
|
-
// very call, so the approval stands.
|
|
422
982
|
// An approval binds the exact input it showed (Platform tool spec §6.3): an approved record
|
|
423
983
|
// whose stored input differs from the call's is not used.
|
|
424
984
|
const approvedHere = approval?.status === "approved" &&
|
|
425
|
-
|
|
985
|
+
approval.specHash === tool.specHash &&
|
|
426
986
|
canonicalJson(approval.input) === canonicalJson(call.input ?? {});
|
|
427
987
|
const stale = approval?.status === "approved" && !approvedHere;
|
|
988
|
+
// the profile step (profiles govern every approval, R1-R3): an ask addressed to the person
|
|
989
|
+
// with no approval governing the call yet is decided by the conversation's profile
|
|
990
|
+
let auto;
|
|
991
|
+
let reviewUnsure = false;
|
|
428
992
|
if ((!approval || stale) && typeof decision === "object" && "ask" in decision) {
|
|
993
|
+
const step = await this.profileStep(ctx, call, tool, input, decision.ask, callPolicy);
|
|
994
|
+
if (step.kind === "deny")
|
|
995
|
+
return fail(toolReviewDeniedText(step.reason), outKey);
|
|
996
|
+
if (step.kind === "allow")
|
|
997
|
+
auto = step.decision;
|
|
998
|
+
else
|
|
999
|
+
reviewUnsure = step.unsure;
|
|
1000
|
+
}
|
|
1001
|
+
if ((!approval || stale) &&
|
|
1002
|
+
auto === undefined &&
|
|
1003
|
+
typeof decision === "object" &&
|
|
1004
|
+
"ask" in decision) {
|
|
429
1005
|
approval = await this.deps.approvals.request({
|
|
430
|
-
|
|
1006
|
+
// after every earlier request of the call, whatever its kind (attempts share one key)
|
|
1007
|
+
attempt: (await this.lastAttempt(ctx.runId, call.id)) + 1,
|
|
431
1008
|
orgId: ctx.orgId,
|
|
432
1009
|
conversationId: ctx.conversationId,
|
|
433
1010
|
runId: ctx.runId,
|
|
@@ -442,6 +1019,13 @@ let ToolPipeline = class ToolPipeline {
|
|
|
442
1019
|
policy: decision.ask.policy,
|
|
443
1020
|
...(callPolicy?.summary !== undefined && { summary: callPolicy.summary }),
|
|
444
1021
|
...(callPolicy !== null && !callPolicy.remember && { scopes: ["once"] }),
|
|
1022
|
+
// the referenced file the approval binds by its sha256
|
|
1023
|
+
...((callPolicy?.file !== undefined || reviewUnsure) && {
|
|
1024
|
+
detail: {
|
|
1025
|
+
...(callPolicy?.file !== undefined && { file: callPolicy.file }),
|
|
1026
|
+
...(reviewUnsure && { reviewUnsure: true }),
|
|
1027
|
+
},
|
|
1028
|
+
}),
|
|
445
1029
|
});
|
|
446
1030
|
}
|
|
447
1031
|
if (approval && approval.status !== "approved") {
|
|
@@ -449,16 +1033,52 @@ let ToolPipeline = class ToolPipeline {
|
|
|
449
1033
|
return refused === null ? approvalWait(approval) : fail(refused, outKey);
|
|
450
1034
|
}
|
|
451
1035
|
// 走到这里即放行:在(与当前定义一致的)审批下执行,否则是授权或策略放行
|
|
452
|
-
|
|
1036
|
+
let authorization = approval?.status === "approved" && approvedHere
|
|
453
1037
|
? approvalAuthorization(approval)
|
|
454
|
-
:
|
|
455
|
-
? {
|
|
456
|
-
:
|
|
1038
|
+
: auto !== undefined
|
|
1039
|
+
? { decisionSource: auto.source, profileRevision: auto.revision, decisionSeq: auto.seq }
|
|
1040
|
+
: typeof decision === "object" && "grant" in decision
|
|
1041
|
+
? { grant: decision.grant }
|
|
1042
|
+
: { policy: "allow" };
|
|
1043
|
+
// the secure input (profiles govern every approval, R4): once the call's consent is settled
|
|
1044
|
+
// (approved here, a grant, an allow or the profile's decision), the person enters the call's
|
|
1045
|
+
// secret fields under every profile, before the command review
|
|
1046
|
+
let secureInputId;
|
|
1047
|
+
if (personFields !== undefined) {
|
|
1048
|
+
const secured = await this.secureInput(ctx, call, tool, policyKey, personFields);
|
|
1049
|
+
if (secured.kind === "wait")
|
|
1050
|
+
return secured.wait;
|
|
1051
|
+
if (secured.kind === "refused")
|
|
1052
|
+
return fail(secured.text, outKey);
|
|
1053
|
+
secureInputId = secured.id;
|
|
1054
|
+
}
|
|
1055
|
+
// Auto mode spec §5.1: the command review, after argument validation and the tool policy (and
|
|
1056
|
+
// its approval), before the plugin hooks and `tool_call_started`. A deny ends the call here; an
|
|
1057
|
+
// ask parks the run on the command approval (attended) or is a deny at once (unattended). An
|
|
1058
|
+
// already decided command approval resumes the call without re-reviewing.
|
|
1059
|
+
const reviewed = await this.reviewCall(ctx, call, tool, input);
|
|
1060
|
+
if (reviewed.kind === "wait")
|
|
1061
|
+
return reviewed.wait;
|
|
1062
|
+
if (reviewed.kind === "result") {
|
|
1063
|
+
review = reviewed.review;
|
|
1064
|
+
return fail(reviewed.content, outKey);
|
|
1065
|
+
}
|
|
1066
|
+
review = reviewed.review;
|
|
1067
|
+
const reviewedRoots = {
|
|
1068
|
+
workingRoot: reviewed.workingRoot,
|
|
1069
|
+
against: reviewed.reviewedAgainst,
|
|
1070
|
+
...(reviewed.sandboxEscalation !== undefined && { escalation: reviewed.sandboxEscalation }),
|
|
1071
|
+
...(reviewed.sandboxEscalationRefusal !== undefined && {
|
|
1072
|
+
escalationRefusal: reviewed.sandboxEscalationRefusal,
|
|
1073
|
+
}),
|
|
1074
|
+
};
|
|
1075
|
+
if (reviewed.commandAsk !== undefined)
|
|
1076
|
+
authorization = approvalAuthorization(reviewed.commandAsk);
|
|
457
1077
|
// tool.preExecute after policy and approval, before tool_call_started (F10)
|
|
458
1078
|
const hooks = this.deps.pluginHooks;
|
|
459
1079
|
const scope = hookScope(hooks, ctx);
|
|
460
1080
|
if (scope && hooks?.has("tool.preExecute")) {
|
|
461
|
-
// sticky: a denial already logged for this call (e.g.
|
|
1081
|
+
// sticky: a denial already logged for this call (e.g. a crash right after it)
|
|
462
1082
|
// is final: fail with the recorded reason, never re-run the hooks or execute the tool. Only
|
|
463
1083
|
// looked up when a tool.preExecute hook could run (M-2: no query without hooks); a denial is
|
|
464
1084
|
// written with the call's tool_result, so a call with a logged denial never runs again anyway.
|
|
@@ -504,7 +1124,11 @@ let ToolPipeline = class ToolPipeline {
|
|
|
504
1124
|
step: ctx.step,
|
|
505
1125
|
callId: call.id,
|
|
506
1126
|
});
|
|
507
|
-
await this.writeResult(ctx, call.id, outKey, {
|
|
1127
|
+
await this.writeResult(ctx, call.id, outKey, {
|
|
1128
|
+
content: hookDeniedText(verdict.plugin, verdict.reason),
|
|
1129
|
+
isError: true,
|
|
1130
|
+
...(review !== undefined && { review }),
|
|
1131
|
+
}, [event], undefined, [hookDeniedAudit(site, event.payload, verdict)]);
|
|
508
1132
|
return undefined;
|
|
509
1133
|
}
|
|
510
1134
|
}
|
|
@@ -580,26 +1204,108 @@ let ToolPipeline = class ToolPipeline {
|
|
|
580
1204
|
type: "tool_call_started",
|
|
581
1205
|
runId: ctx.runId,
|
|
582
1206
|
idemKey: idem.started(ctx.runId, call.id, attempt),
|
|
583
|
-
payload: {
|
|
1207
|
+
payload: {
|
|
1208
|
+
step: ctx.step,
|
|
1209
|
+
callId: call.id,
|
|
1210
|
+
toolKey: tool.key,
|
|
1211
|
+
specHash: tool.specHash,
|
|
1212
|
+
...(this.operationScoped(tool, input)
|
|
1213
|
+
? {
|
|
1214
|
+
permissionInput: {
|
|
1215
|
+
callInputHash: permissionScopeHash(call.input),
|
|
1216
|
+
resolvedInputHash: permissionScopeHash(input),
|
|
1217
|
+
...(isEscalatedCall(tool.key, input) ? { sandbox: "escalated" } : {}),
|
|
1218
|
+
},
|
|
1219
|
+
}
|
|
1220
|
+
: {}),
|
|
1221
|
+
},
|
|
584
1222
|
},
|
|
585
1223
|
]);
|
|
586
1224
|
const t0 = Date.now();
|
|
587
|
-
let outcome = await this.execute(tool, input, ctx, call.id, resume, resolved.tools
|
|
1225
|
+
let outcome = await this.execute(tool, input, ctx, call.id, resume, resolved.tools, reviewedRoots,
|
|
1226
|
+
// the approval the call runs under (a Platform write reads the person's values by it)
|
|
1227
|
+
approval?.status === "approved" && approvedHere ? approval.id : undefined,
|
|
1228
|
+
// or the automatic decision and the file bytes it was bound to (R7)
|
|
1229
|
+
auto === undefined
|
|
1230
|
+
? undefined
|
|
1231
|
+
: {
|
|
1232
|
+
source: auto.source,
|
|
1233
|
+
...(auto.fileSha256 !== undefined && { fileSha256: auto.fileSha256 }),
|
|
1234
|
+
},
|
|
1235
|
+
// and the submitted secure input holding the person's values
|
|
1236
|
+
secureInputId);
|
|
588
1237
|
const durationMs = Date.now() - t0;
|
|
589
1238
|
await this.deps.hooks?.afterExecute?.(ctx.runId, call.id);
|
|
1239
|
+
// what earlier input rounds collected: a launch reviewed in a round that asked, the hosts a
|
|
1240
|
+
// service reported refused there (this round, a resume, finds the service running)
|
|
1241
|
+
outcome = withCarried(outcome, carried);
|
|
1242
|
+
// a device service launch's review during the call (ctx.deviceAccess, the call scope)
|
|
1243
|
+
if (review === undefined && outcome.kind !== "connection_required")
|
|
1244
|
+
review = outcome.review;
|
|
1245
|
+
// the record says a call ran outside the sandbox only when admission gave it that scope
|
|
1246
|
+
if (review !== undefined && isEscalatedCall(tool.key, input)) {
|
|
1247
|
+
const { sandbox: _asked, ...rest } = review;
|
|
1248
|
+
review = (await this.admittedOutsideSandbox(ctx.runId, call.id))
|
|
1249
|
+
? { ...rest, sandbox: "escalated" }
|
|
1250
|
+
: rest;
|
|
1251
|
+
}
|
|
1252
|
+
// scheduled tasks spec §7, `fail` mode: no one answers an input request or connects an app
|
|
1253
|
+
if (unattendedFails(ctx.unattended) && ctx.unattended != null) {
|
|
1254
|
+
if (outcome.kind === "input_required") {
|
|
1255
|
+
outcome = {
|
|
1256
|
+
kind: "error",
|
|
1257
|
+
message: UNATTENDED_QUESTION_ERROR,
|
|
1258
|
+
...(outcome.blocked !== undefined && { blocked: outcome.blocked }),
|
|
1259
|
+
...(outcome.review !== undefined && { review: outcome.review }),
|
|
1260
|
+
};
|
|
1261
|
+
}
|
|
1262
|
+
else if (outcome.kind === "connection_required") {
|
|
1263
|
+
await appendMissingGrant(this.deps.db, ctx.unattended.taskRunId, connectionGrantKey(outcome.connectorSlug));
|
|
1264
|
+
outcome = { kind: "error", message: UNATTENDED_CONNECTION_ERROR(outcome.connectorName) };
|
|
1265
|
+
}
|
|
1266
|
+
}
|
|
590
1267
|
if (outcome.kind === "input_required") {
|
|
591
|
-
const
|
|
1268
|
+
const open = tool.source.kind === "plugin" && outcome.open !== undefined
|
|
1269
|
+
? this.openOf(outcome.open, tool.source.plugin, tool.key)
|
|
1270
|
+
: undefined;
|
|
1271
|
+
const { open: _raw, ...asking } = outcome;
|
|
1272
|
+
const asked = await this.askInput(ctx, call.id, tool.key, attempt, {
|
|
1273
|
+
...asking,
|
|
1274
|
+
...(open !== undefined && { open }),
|
|
1275
|
+
});
|
|
592
1276
|
if (typeof asked !== "string")
|
|
593
1277
|
return asked;
|
|
594
|
-
outcome = {
|
|
1278
|
+
outcome = {
|
|
1279
|
+
kind: "error",
|
|
1280
|
+
message: asked,
|
|
1281
|
+
...(outcome.blocked !== undefined && { blocked: outcome.blocked }),
|
|
1282
|
+
...(outcome.review !== undefined && { review: outcome.review }),
|
|
1283
|
+
};
|
|
595
1284
|
}
|
|
1285
|
+
// the images of the result (any tool): stored as `read` copies of the calling conversation,
|
|
1286
|
+
// named in the text and in `tool_result.media`, so a model with vision sees them after the
|
|
1287
|
+
// step's results and the person sees them on the call's row (tool result images design §2)
|
|
1288
|
+
const images = outcome.kind === "result"
|
|
1289
|
+
? await storeResultImages(outcome.result, tool.key, this.storeResultImage(ctx), (err) => this.deps.log.warn("cannot store an image of a tool result", {
|
|
1290
|
+
toolKey: tool.key,
|
|
1291
|
+
error: err instanceof Error ? err.message : String(err),
|
|
1292
|
+
}), ctx.signal)
|
|
1293
|
+
: undefined;
|
|
596
1294
|
const rendered = outcome.kind === "result"
|
|
597
|
-
? renderResult(outcome.result)
|
|
1295
|
+
? renderResult(outcome.result, images?.texts)
|
|
598
1296
|
: { text: outcome.message, contentTypes: [], isError: true };
|
|
599
|
-
//
|
|
1297
|
+
// the tools a builtin (ToolSearch) reports as loaded: only keys available in this step and not
|
|
1298
|
+
// builtin, written to tool_result (the log is the source of truth)
|
|
600
1299
|
const loadedTools = outcome.kind === "result" && tool.source.kind === "builtin"
|
|
601
1300
|
? loadedFrom(outcome.result, resolved.tools)
|
|
602
1301
|
: [];
|
|
1302
|
+
// the images the builtin Read stored for the call (vision-read design §1.2): builtins only,
|
|
1303
|
+
// so a plugin can never name an attachment for request building
|
|
1304
|
+
const builtinMedia = outcome.kind === "result" && tool.source.kind === "builtin"
|
|
1305
|
+
? mediaFrom(outcome.result)
|
|
1306
|
+
: undefined;
|
|
1307
|
+
const allMedia = [...(builtinMedia ?? []), ...(images?.media ?? [])];
|
|
1308
|
+
const media = allMedia.length > 0 ? allMedia : undefined;
|
|
603
1309
|
// 显示摘要:只认插件 / 内置工具与内核的 resources 工具给的(连接器结果来自外部服务,不采信),
|
|
604
1310
|
// 校验不过就丢弃并告警
|
|
605
1311
|
const display = outcome.kind === "result" && (tool.source.kind !== "connector" || tool.source.resources)
|
|
@@ -613,6 +1319,11 @@ let ToolPipeline = class ToolPipeline {
|
|
|
613
1319
|
const card = outcome.kind === "result" && tool.source.kind === "plugin"
|
|
614
1320
|
? this.cardOf(outcome.result, tool.source.plugin, tool.key)
|
|
615
1321
|
: undefined;
|
|
1322
|
+
// a `gh auth login --web` device code (`Bash`; auto mode spec §6): display only, written under
|
|
1323
|
+
// this call before its result, never part of the result or the request the model sees
|
|
1324
|
+
const loginCode = outcome.kind === "result" && tool.source.kind === "builtin"
|
|
1325
|
+
? loginCodeOf(outcome.result)
|
|
1326
|
+
: undefined;
|
|
616
1327
|
const cfg = this.config.get().tools;
|
|
617
1328
|
const spilled = await spillIfLarge(rendered.text, {
|
|
618
1329
|
// 内置工具可给更低的转存阈值(沙箱 bash 30000 字符)
|
|
@@ -640,20 +1351,82 @@ let ToolPipeline = class ToolPipeline {
|
|
|
640
1351
|
},
|
|
641
1352
|
]
|
|
642
1353
|
: [];
|
|
1354
|
+
if (loginCode !== undefined &&
|
|
1355
|
+
!(await this.deps.eventLog.deviceCodeShown(ctx.conversationId, loginCode.code))) {
|
|
1356
|
+
// the per-call id makes a retry or a resumed run append it once; a second call (a task read
|
|
1357
|
+
// again, another command printing the same code) does not show the same code twice (P-D13)
|
|
1358
|
+
pre.push(deviceCodeEvent(ctx.runId, ctx.step, call.id, loginCode));
|
|
1359
|
+
}
|
|
1360
|
+
const callAudit = {
|
|
1361
|
+
durationMs,
|
|
1362
|
+
connectorId: tool.source.kind === "connector" ? tool.source.connectorId : null,
|
|
1363
|
+
authorization,
|
|
1364
|
+
};
|
|
1365
|
+
// a foreground command refused network hosts (network ask-to-allow spec §6.2): display-only
|
|
1366
|
+
// `network_blocked` before the result, then an ask to the device owner (the run waits; the
|
|
1367
|
+
// result is written when the ask settles) or notes after the output
|
|
1368
|
+
const commandReport = outcome.kind === "result" && tool.source.kind === "builtin"
|
|
1369
|
+
? networkReportOf(outcome.result)
|
|
1370
|
+
: undefined;
|
|
1371
|
+
// a device service's refusals reported in the call scope (browser use spec §7.1), any source:
|
|
1372
|
+
// asked as "always" only, the call runs again once approved
|
|
1373
|
+
// a report about another device than the conversation's is ignored: only the device the call
|
|
1374
|
+
// works in may be asked about, and only its owner
|
|
1375
|
+
const scoped = commandReport === undefined && (outcome.kind === "result" || outcome.kind === "error")
|
|
1376
|
+
? await this.ownDeviceReport(ctx, outKey, outcome.blocked)
|
|
1377
|
+
: undefined;
|
|
1378
|
+
const report = commandReport ??
|
|
1379
|
+
(scoped === undefined
|
|
1380
|
+
? undefined
|
|
1381
|
+
: {
|
|
1382
|
+
deviceId: scoped.deviceId,
|
|
1383
|
+
// a service reports host names only: the event carries the HTTPS port
|
|
1384
|
+
blocked: scoped.hosts.map((host) => ({ host, port: 443, layer: "device" })),
|
|
1385
|
+
});
|
|
1386
|
+
let content = spilled.content;
|
|
1387
|
+
if (report !== undefined) {
|
|
1388
|
+
const handled = await this.networkBlocked(ctx, call.id, outKey, input, report, pre, callAudit, {
|
|
1389
|
+
text: rendered.text,
|
|
1390
|
+
content: spilled.content,
|
|
1391
|
+
isError: rendered.isError,
|
|
1392
|
+
...(spilled.outputId !== undefined && { outputId: spilled.outputId }),
|
|
1393
|
+
...(rendered.contentTypes.length > 0 && { contentTypes: rendered.contentTypes }),
|
|
1394
|
+
...(display !== undefined && { display }),
|
|
1395
|
+
...(view !== undefined && { view }),
|
|
1396
|
+
...(media !== undefined && { media }),
|
|
1397
|
+
...(review !== undefined && { review }),
|
|
1398
|
+
// carried into the kept result so a resumed run writes the event too (it was written
|
|
1399
|
+
// with `network_blocked` below when the ask was created)
|
|
1400
|
+
...(loginCode !== undefined && { loginCode }),
|
|
1401
|
+
}, reviewedRoots.escalation, reviewedRoots.escalationRefusal, scoped === undefined
|
|
1402
|
+
? undefined
|
|
1403
|
+
: {
|
|
1404
|
+
name: tool.source.kind === "plugin" ? tool.source.plugin : tool.key,
|
|
1405
|
+
attempt,
|
|
1406
|
+
url: scoped.url,
|
|
1407
|
+
});
|
|
1408
|
+
if (handled.kind === "wait") {
|
|
1409
|
+
if (hooks && hookBase) {
|
|
1410
|
+
fireObserve(hooks, "tool.postExecute", { ...hookBase, isError: rendered.isError, content: handled.content, durationMs }, ctx.signal, this.deps.log);
|
|
1411
|
+
}
|
|
1412
|
+
return handled.wait;
|
|
1413
|
+
}
|
|
1414
|
+
if (handled.event !== null)
|
|
1415
|
+
pre.push(handled.event);
|
|
1416
|
+
content = withNetworkNotes(content, handled.notes);
|
|
1417
|
+
}
|
|
643
1418
|
await this.writeResult(ctx, call.id, outKey, {
|
|
644
|
-
content
|
|
1419
|
+
content,
|
|
645
1420
|
isError: rendered.isError,
|
|
646
1421
|
...(spilled.outputId !== undefined && { outputId: spilled.outputId }),
|
|
647
1422
|
...(rendered.contentTypes.length > 0 && { contentTypes: rendered.contentTypes }),
|
|
648
1423
|
...(loadedTools.length > 0 && { loadedTools }),
|
|
1424
|
+
...(media !== undefined && { media }),
|
|
649
1425
|
...(display !== undefined && { display }),
|
|
650
1426
|
...(view !== undefined && { view }),
|
|
651
1427
|
...(card !== undefined && { card }),
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
connectorId: tool.source.kind === "connector" ? tool.source.connectorId : null,
|
|
655
|
-
authorization,
|
|
656
|
-
});
|
|
1428
|
+
...(review !== undefined && { review }),
|
|
1429
|
+
}, pre, callAudit);
|
|
657
1430
|
// a sub-agent that needs a personal connection: mirrored in the root conversation of its tree
|
|
658
1431
|
// for display (sub-agents spec §9, agent map spec §7; not a wait, the child got the connect
|
|
659
1432
|
// text as its result)
|
|
@@ -664,8 +1437,930 @@ let ToolPipeline = class ToolPipeline {
|
|
|
664
1437
|
}));
|
|
665
1438
|
}
|
|
666
1439
|
if (hooks && hookBase) {
|
|
667
|
-
fireObserve(hooks, "tool.postExecute", { ...hookBase, isError: rendered.isError, content
|
|
1440
|
+
fireObserve(hooks, "tool.postExecute", { ...hookBase, isError: rendered.isError, content, durationMs }, ctx.signal, this.deps.log);
|
|
1441
|
+
}
|
|
1442
|
+
return undefined;
|
|
1443
|
+
}
|
|
1444
|
+
/**
|
|
1445
|
+
* The profile step (profiles govern every approval, R1-R3) of an ask `decide` returned for a call
|
|
1446
|
+
* no approval governs yet. It applies only to an ask addressed to the person (no role, the root
|
|
1447
|
+
* conversation's own owner), in an attended interactive chat, and for a tool that does not
|
|
1448
|
+
* itself require the person's interaction (D3); a call's secret fields are asked afterwards in a
|
|
1449
|
+
* secure input request whatever it decides (R4). Request approval asks; Auto allows; Approve for
|
|
1450
|
+
* me asks the review model, whose unsure answer asks the person. An `allow` or `deny` is recorded
|
|
1451
|
+
* once (`tool_ask_decided` and its audit row); a resumed call reads that record before the profile
|
|
1452
|
+
* and never calls the review model again. Anything that cannot be read asks the person (fail closed).
|
|
1453
|
+
*/
|
|
1454
|
+
async profileStep(ctx, call, tool, input, ask, callPolicy) {
|
|
1455
|
+
const asks = { kind: "ask", unsure: false };
|
|
1456
|
+
const profiles = this.approvalProfile;
|
|
1457
|
+
const reviewer = this.toolReview;
|
|
1458
|
+
if (profiles === undefined || reviewer === undefined)
|
|
1459
|
+
return asks;
|
|
1460
|
+
if (ask.approverRole !== null || ask.requestedFor === null)
|
|
1461
|
+
return asks;
|
|
1462
|
+
if (ctx.unattended != null)
|
|
1463
|
+
return asks;
|
|
1464
|
+
if (tool.spec.annotations?.requiresUserInteraction === true)
|
|
1465
|
+
return asks;
|
|
1466
|
+
// a decision already recorded for this call governs it whatever the profile reads now (R2: a
|
|
1467
|
+
// resumed call reuses it; a profile change never revokes started work)
|
|
1468
|
+
const bindingHash = askBindingHash(ask.toolKey, ask.specHash, call.input);
|
|
1469
|
+
const idemKey = `tool_ask_decided:${ctx.runId}:${call.id}:${bindingHash}`;
|
|
1470
|
+
const recorded = await this.deps.eventLog.findByIdem(ctx.conversationId, idemKey);
|
|
1471
|
+
if (recorded?.type === "tool_ask_decided")
|
|
1472
|
+
return askDecisionOf(recorded);
|
|
1473
|
+
const rootConversationId = ctx.parent?.rootConversationId ?? ctx.conversationId;
|
|
1474
|
+
let resolved;
|
|
1475
|
+
try {
|
|
1476
|
+
resolved = await profiles.resolve({
|
|
1477
|
+
orgId: ctx.orgId,
|
|
1478
|
+
rootConversationId,
|
|
1479
|
+
requestedFor: ask.requestedFor,
|
|
1480
|
+
});
|
|
1481
|
+
}
|
|
1482
|
+
catch (err) {
|
|
1483
|
+
this.deps.log.warn("cannot read the conversation's permission profile; asking the person", {
|
|
1484
|
+
conversationId: ctx.conversationId,
|
|
1485
|
+
callId: call.id,
|
|
1486
|
+
err,
|
|
1487
|
+
});
|
|
1488
|
+
return asks;
|
|
1489
|
+
}
|
|
1490
|
+
if (resolved === null || resolved.profile === "request-approval")
|
|
1491
|
+
return asks;
|
|
1492
|
+
let decision;
|
|
1493
|
+
if (resolved.profile === "full-access") {
|
|
1494
|
+
decision = { outcome: "allow", reason: TOOL_AUTO_REASON, source: "full-access" };
|
|
1495
|
+
}
|
|
1496
|
+
else {
|
|
1497
|
+
const parent = ctx.parent;
|
|
1498
|
+
const verdict = await reviewer.review({
|
|
1499
|
+
orgId: ctx.orgId,
|
|
1500
|
+
rootConversationId,
|
|
1501
|
+
conversationId: ctx.conversationId,
|
|
1502
|
+
runId: ctx.runId,
|
|
1503
|
+
step: ctx.step,
|
|
1504
|
+
callId: call.id,
|
|
1505
|
+
accountId: ctx.accountId,
|
|
1506
|
+
signal: ctx.signal,
|
|
1507
|
+
toolKey: ask.toolKey,
|
|
1508
|
+
title: tool.spec.title ?? null,
|
|
1509
|
+
summary: callPolicy?.summary ?? null,
|
|
1510
|
+
input,
|
|
1511
|
+
inputSchema: tool.spec.inputSchema,
|
|
1512
|
+
// a sub-agent's review counts on its parent run, as the command review's does
|
|
1513
|
+
...(parent !== undefined && {
|
|
1514
|
+
parentRunId: parent.runId,
|
|
1515
|
+
...(parent.budgetRunId !== undefined && { budgetRunId: parent.budgetRunId }),
|
|
1516
|
+
}),
|
|
1517
|
+
hookFacts: {
|
|
1518
|
+
accountId: ctx.accountId,
|
|
1519
|
+
agentId: ctx.agentId,
|
|
1520
|
+
agentVersion: ctx.agentVersion,
|
|
1521
|
+
conversationKind: ctx.conversationKind,
|
|
1522
|
+
parent: parent === undefined
|
|
1523
|
+
? undefined
|
|
1524
|
+
: {
|
|
1525
|
+
conversationId: parent.conversationId,
|
|
1526
|
+
runId: parent.runId,
|
|
1527
|
+
callId: parent.callId,
|
|
1528
|
+
},
|
|
1529
|
+
},
|
|
1530
|
+
});
|
|
1531
|
+
if (verdict.decision === "ask")
|
|
1532
|
+
return { kind: "ask", unsure: true };
|
|
1533
|
+
decision = { outcome: verdict.decision, reason: verdict.reason, source: "review-model" };
|
|
1534
|
+
}
|
|
1535
|
+
const fileSha256 = callPolicy?.file?.sha256;
|
|
1536
|
+
const event = await this.recordAskDecision(ctx, idemKey, {
|
|
1537
|
+
step: ctx.step,
|
|
1538
|
+
callId: call.id,
|
|
1539
|
+
toolKey: ask.toolKey,
|
|
1540
|
+
specHash: ask.specHash,
|
|
1541
|
+
bindingHash,
|
|
1542
|
+
outcome: decision.outcome,
|
|
1543
|
+
decisionSource: decision.source,
|
|
1544
|
+
reason: decision.reason,
|
|
1545
|
+
profileRevision: resolved.revision,
|
|
1546
|
+
...(fileSha256 !== undefined && { fileSha256 }),
|
|
1547
|
+
});
|
|
1548
|
+
return askDecisionOf(event);
|
|
1549
|
+
}
|
|
1550
|
+
/** Records an automatic decision once (R2) and announces it after the commit. */
|
|
1551
|
+
async recordAskDecision(ctx, idemKey, payload) {
|
|
1552
|
+
const { event, fresh } = await this.recordAskDecisionIn(ctx, idemKey, payload);
|
|
1553
|
+
if (fresh)
|
|
1554
|
+
await this.deps.eventLog.notify(ctx.conversationId, event.seq);
|
|
1555
|
+
return event;
|
|
1556
|
+
}
|
|
1557
|
+
/**
|
|
1558
|
+
* The `tool_ask_decided` event and, when this call wrote it, its audit row
|
|
1559
|
+
* `tool.ask_auto_decided`, in one transaction: a retry or another replica returns the recorded
|
|
1560
|
+
* event and audits nothing (every automatic decision is audited exactly once).
|
|
1561
|
+
*/
|
|
1562
|
+
async recordAskDecisionIn(ctx, idemKey, payload) {
|
|
1563
|
+
const report = await this.deps.eventLog.appendInReport(ctx.conversationId, [
|
|
1564
|
+
{ type: "tool_ask_decided", runId: ctx.runId, idemKey, payload },
|
|
1565
|
+
]);
|
|
1566
|
+
const event = report.events[0];
|
|
1567
|
+
if (event?.type !== "tool_ask_decided")
|
|
1568
|
+
throw new Error("The ask decision was not recorded");
|
|
1569
|
+
const fresh = report.fresh[0] === true;
|
|
1570
|
+
if (fresh) {
|
|
1571
|
+
await audit(this.deps.db, {
|
|
1572
|
+
actorAccountId: ctx.accountId,
|
|
1573
|
+
orgId: ctx.orgId,
|
|
1574
|
+
action: "tool.ask_auto_decided",
|
|
1575
|
+
target: ctx.conversationId,
|
|
1576
|
+
detail: {
|
|
1577
|
+
callId: payload.callId,
|
|
1578
|
+
runId: ctx.runId,
|
|
1579
|
+
toolKey: payload.toolKey,
|
|
1580
|
+
outcome: payload.outcome,
|
|
1581
|
+
decisionSource: payload.decisionSource,
|
|
1582
|
+
profileRevision: payload.profileRevision,
|
|
1583
|
+
reason: payload.reason,
|
|
1584
|
+
},
|
|
1585
|
+
});
|
|
1586
|
+
}
|
|
1587
|
+
return { event, fresh };
|
|
1588
|
+
}
|
|
1589
|
+
/**
|
|
1590
|
+
* The command review of one call (auto mode spec §5.1, §5.4), after argument validation and the
|
|
1591
|
+
* tool policy (and its approval), before the plugin hooks and execution. The device facts come
|
|
1592
|
+
* from the same `ConversationDevices.forTool` the tool enters; with no device (or a deployment
|
|
1593
|
+
* without a review service) the call runs unreviewed and fails on its own if it cannot. A deny is
|
|
1594
|
+
* final whatever the mode and approvals; an `ask` waits for the device owner's `command` approval
|
|
1595
|
+
* when the run is attended, and is a deny at once when it is not. A command approval already
|
|
1596
|
+
* asked is the whole truth on a resume: the call is never reviewed twice.
|
|
1597
|
+
*/
|
|
1598
|
+
async reviewCall(ctx, call, tool, input) {
|
|
1599
|
+
// a device tool of a run another account triggered never uses the owner's device: refused
|
|
1600
|
+
// here, with no review and no review model call (the tools refuse it the same way)
|
|
1601
|
+
if (this.operationScoped(tool, input) && ctx.ownerAccountId !== ctx.accountId)
|
|
1602
|
+
return {
|
|
1603
|
+
kind: "result",
|
|
1604
|
+
content: DEVICE_OF_ANOTHER_ACCOUNT_TEXT,
|
|
1605
|
+
review: denyRecord("rule", null, "The run's account is not the conversation's owner"),
|
|
1606
|
+
};
|
|
1607
|
+
if (this.operationScoped(tool, input)) {
|
|
1608
|
+
let scoped;
|
|
1609
|
+
try {
|
|
1610
|
+
scoped = await this.reviewPermissionCall(ctx, call, tool, input);
|
|
1611
|
+
}
|
|
1612
|
+
catch (error) {
|
|
1613
|
+
// fail closed: a permission evidence conflict or an owner check that refuses while the
|
|
1614
|
+
// call is asked about, reviewed or matched to its grant is a refusal of this call, never a
|
|
1615
|
+
// run error and never a run of it
|
|
1616
|
+
if (!(error instanceof ApiError) || !FAIL_CLOSED_CODES.has(error.code))
|
|
1617
|
+
throw error;
|
|
1618
|
+
this.deps.log.warn("permission review refused the call", {
|
|
1619
|
+
conversationId: ctx.conversationId,
|
|
1620
|
+
callId: call.id,
|
|
1621
|
+
err: error,
|
|
1622
|
+
});
|
|
1623
|
+
const content = permissionCheckFailedText(error.message);
|
|
1624
|
+
return { kind: "result", content, review: denyRecord("rule", null, error.message) };
|
|
1625
|
+
}
|
|
1626
|
+
if (scoped)
|
|
1627
|
+
return scoped;
|
|
1628
|
+
}
|
|
1629
|
+
const review = this.deps.review;
|
|
1630
|
+
const devices = this.deps.devices;
|
|
1631
|
+
if (review === undefined || devices === undefined)
|
|
1632
|
+
return { kind: "continue" };
|
|
1633
|
+
if (!isReviewedCall(tool.key, input))
|
|
1634
|
+
return { kind: "continue" };
|
|
1635
|
+
const asked = await this.deps.approvals.commandForCall(ctx.runId, call.id);
|
|
1636
|
+
const rootConversationId = ctx.parent?.rootConversationId ?? ctx.conversationId;
|
|
1637
|
+
if (asked !== null && asked.status !== "superseded") {
|
|
1638
|
+
const settled = this.settledCommandAsk(asked, tool.key);
|
|
1639
|
+
// an approved call runs in the root it was reviewed against only while the device still runs
|
|
1640
|
+
// in the mode recorded with the ask; otherwise the tool decides its working root afresh. A
|
|
1641
|
+
// judged root that is the recorded workspace (free mode) is not carried either
|
|
1642
|
+
// ({@link carriedRoot}): the tool maps it to the held instance's workspace as always
|
|
1643
|
+
if (settled.kind === "continue" && settled.workingRoot !== undefined) {
|
|
1644
|
+
const now = await devices.reviewFacts(ctx.orgId, rootConversationId, ctx.conversationId);
|
|
1645
|
+
if (now === null ||
|
|
1646
|
+
now.mode !== asked.command?.mode ||
|
|
1647
|
+
carriedRoot({ workspace: now.workspace, workingRoot: settled.workingRoot }) === undefined) {
|
|
1648
|
+
// the root the person approved stays the one judged (B-18): only the carried root goes
|
|
1649
|
+
return { ...settled, workingRoot: undefined };
|
|
1650
|
+
}
|
|
1651
|
+
}
|
|
1652
|
+
return settled;
|
|
1653
|
+
}
|
|
1654
|
+
const facts = await devices.reviewFacts(ctx.orgId, rootConversationId, ctx.conversationId);
|
|
1655
|
+
if (facts === null)
|
|
1656
|
+
return { kind: "continue" }; // no device: the tool fails on its own
|
|
1657
|
+
const kind = reviewKindOf(tool.key);
|
|
1658
|
+
const attended = ctx.unattended == null && ctx.accountId === facts.ownerAccountId;
|
|
1659
|
+
// a command over the ceiling is refused before any review: no stage reads it in full, and no
|
|
1660
|
+
// approval could bind a text the person cannot see (hardening spec R8)
|
|
1661
|
+
if (kind === "command") {
|
|
1662
|
+
const text = textField(input, "command");
|
|
1663
|
+
if (text.length > COMMAND_ASK_MAX_CHARS) {
|
|
1664
|
+
return {
|
|
1665
|
+
kind: "result",
|
|
1666
|
+
content: commandTooLongText(text.length),
|
|
1667
|
+
review: denyRecord("rule", null, commandTooLongReason(text.length)),
|
|
1668
|
+
};
|
|
1669
|
+
}
|
|
1670
|
+
}
|
|
1671
|
+
const verdict = await review.review({
|
|
1672
|
+
orgId: ctx.orgId,
|
|
1673
|
+
conversationId: rootConversationId,
|
|
1674
|
+
runId: ctx.runId,
|
|
1675
|
+
accountId: ctx.accountId,
|
|
1676
|
+
toolKey: tool.key,
|
|
1677
|
+
input,
|
|
1678
|
+
mode: facts.mode,
|
|
1679
|
+
// the working root: a bound project's root, where commands start and writes need no ask
|
|
1680
|
+
workspace: facts.workingRoot,
|
|
1681
|
+
// the owner's home, never the project root: the home-level rules stay where they were
|
|
1682
|
+
home: facts.home,
|
|
1683
|
+
// and the device workspace's home, so a project outside every home still protects it
|
|
1684
|
+
deviceHome: facts.deviceHome,
|
|
1685
|
+
attended,
|
|
1686
|
+
step: ctx.step,
|
|
1687
|
+
callId: call.id,
|
|
1688
|
+
signal: ctx.signal,
|
|
1689
|
+
...reviewParentOf(ctx.parent),
|
|
1690
|
+
agentId: ctx.agentId,
|
|
1691
|
+
agentVersion: ctx.agentVersion,
|
|
1692
|
+
...(ctx.conversationKind !== undefined && { conversationKind: ctx.conversationKind }),
|
|
1693
|
+
});
|
|
1694
|
+
if (verdict.decision === "allow") {
|
|
1695
|
+
return {
|
|
1696
|
+
kind: "continue",
|
|
1697
|
+
review: allowRecord(verdict),
|
|
1698
|
+
workingRoot: carriedRoot(facts),
|
|
1699
|
+
reviewedAgainst: facts.workingRoot,
|
|
1700
|
+
};
|
|
1701
|
+
}
|
|
1702
|
+
if (verdict.decision === "deny") {
|
|
1703
|
+
return {
|
|
1704
|
+
kind: "result",
|
|
1705
|
+
content: commandDeniedText(verdict.reason, kind),
|
|
1706
|
+
review: denyRecord(verdict.by, verdict.rule, verdict.reason),
|
|
1707
|
+
};
|
|
1708
|
+
}
|
|
1709
|
+
// ask
|
|
1710
|
+
const command = kind === "command" ? textField(input, "command") : tool.key;
|
|
1711
|
+
if (!attended) {
|
|
1712
|
+
const reason = verdict.reason;
|
|
1713
|
+
return {
|
|
1714
|
+
kind: "result",
|
|
1715
|
+
content: commandUnattendedText(reason, kind),
|
|
1716
|
+
review: denyRecord(verdict.by, verdict.rule, reason),
|
|
1717
|
+
};
|
|
1718
|
+
}
|
|
1719
|
+
const detail = {
|
|
1720
|
+
deviceId: facts.deviceId,
|
|
1721
|
+
deviceName: facts.deviceName,
|
|
1722
|
+
mode: facts.mode,
|
|
1723
|
+
kind,
|
|
1724
|
+
// the whole command the approval covers (the event keeps a clamped copy for display)
|
|
1725
|
+
command,
|
|
1726
|
+
// a relative path as it will be written: resolved against the working root
|
|
1727
|
+
// (every path a GenerateImage call writes, comma-separated)
|
|
1728
|
+
...(kind === "write" && {
|
|
1729
|
+
path: clipText(writePathsOf(tool.key, input)
|
|
1730
|
+
.map((p) => facts.workingRoot === undefined ? p : pathAgainstWorkingRoot(p, facts.workingRoot))
|
|
1731
|
+
.join(", "), 4096),
|
|
1732
|
+
}),
|
|
1733
|
+
rule: verdict.rule,
|
|
1734
|
+
reason: clipText(verdict.reason, COMMAND_ASK_TEXT_MAX_CHARS),
|
|
1735
|
+
// the root the review judged, always (the workspace in free mode): the approved call runs
|
|
1736
|
+
// against what the person approved, not a later snapshot
|
|
1737
|
+
...(facts.workingRoot !== undefined && { workingRoot: facts.workingRoot }),
|
|
1738
|
+
};
|
|
1739
|
+
let ask;
|
|
1740
|
+
try {
|
|
1741
|
+
ask = await this.deps.approvals.requestCommand({
|
|
1742
|
+
orgId: ctx.orgId,
|
|
1743
|
+
conversationId: ctx.conversationId,
|
|
1744
|
+
runId: ctx.runId,
|
|
1745
|
+
step: ctx.step,
|
|
1746
|
+
callId: call.id,
|
|
1747
|
+
requestedFor: facts.ownerAccountId,
|
|
1748
|
+
detail,
|
|
1749
|
+
// `once` always; `session` only for a concrete rule class, never an `unsure.*` catch-all (P-D2)
|
|
1750
|
+
scopes: isSessionGrantableRule(verdict.rule) ? ["once", "session"] : ["once"],
|
|
1751
|
+
});
|
|
1752
|
+
}
|
|
1753
|
+
catch (err) {
|
|
1754
|
+
// fail closed: an ask that cannot be created is a deny, never a run of the held call
|
|
1755
|
+
this.deps.log.warn("command ask could not be created; denying the call", {
|
|
1756
|
+
conversationId: ctx.conversationId,
|
|
1757
|
+
callId: call.id,
|
|
1758
|
+
err,
|
|
1759
|
+
});
|
|
1760
|
+
const reason = "The approval could not be created";
|
|
1761
|
+
return {
|
|
1762
|
+
kind: "result",
|
|
1763
|
+
content: commandDeniedText(reason, kind),
|
|
1764
|
+
review: denyRecord(verdict.by, verdict.rule, reason),
|
|
1765
|
+
};
|
|
1766
|
+
}
|
|
1767
|
+
return { kind: "wait", wait: approvalWait(ask) };
|
|
1768
|
+
}
|
|
1769
|
+
/**
|
|
1770
|
+
* Whether this call takes the managed route's permission review: a managed builtin once
|
|
1771
|
+
* activated ({@link MANAGED_OPERATION_TOOLS}) whose call enters the device ({@link entersDevice}).
|
|
1772
|
+
*/
|
|
1773
|
+
operationScoped(tool, input) {
|
|
1774
|
+
return (tool.source.kind === "builtin" &&
|
|
1775
|
+
this.deps.permissionOperations?.has(tool.key) === true &&
|
|
1776
|
+
entersDevice(tool.key, input));
|
|
1777
|
+
}
|
|
1778
|
+
/**
|
|
1779
|
+
* The permission review of a managed call, with the escalation state a continued restricted
|
|
1780
|
+
* `Bash` call carries to its tool (its sandbox hints: retry with `sandbox: "escalated"` only
|
|
1781
|
+
* where this device and org allow it).
|
|
1782
|
+
*/
|
|
1783
|
+
async reviewPermissionCall(ctx, call, tool, input) {
|
|
1784
|
+
const note = {};
|
|
1785
|
+
const outcome = await this.reviewPermissionCallWith(ctx, call, tool, input, note);
|
|
1786
|
+
if (outcome?.kind !== "continue")
|
|
1787
|
+
return outcome;
|
|
1788
|
+
return {
|
|
1789
|
+
...outcome,
|
|
1790
|
+
...(note.escalation !== undefined && { sandboxEscalation: note.escalation }),
|
|
1791
|
+
...(note.refusal !== undefined && { sandboxEscalationRefusal: note.refusal }),
|
|
1792
|
+
};
|
|
1793
|
+
}
|
|
1794
|
+
async reviewPermissionCallWith(ctx, call, tool, input, note) {
|
|
1795
|
+
if (!this.permissionAuthority ||
|
|
1796
|
+
!this.permissionGrants ||
|
|
1797
|
+
!this.permissionLocks ||
|
|
1798
|
+
!this.deps.devices ||
|
|
1799
|
+
!this.deps.review)
|
|
1800
|
+
return null;
|
|
1801
|
+
const permissionLocks = this.permissionLocks;
|
|
1802
|
+
const previous = await this.deps.approvals.commandForCall(ctx.runId, call.id);
|
|
1803
|
+
// A settled refusal belongs to this call, not to a replaceable permission revision.
|
|
1804
|
+
if (previous && !["pending", "approved", "superseded"].includes(previous.status))
|
|
1805
|
+
return this.settledCommandAsk(previous, tool.key);
|
|
1806
|
+
const device = await this.deps.devices.reviewFacts(ctx.orgId, ctx.parent?.rootConversationId ?? ctx.conversationId, ctx.conversationId);
|
|
1807
|
+
if (!device)
|
|
1808
|
+
return null;
|
|
1809
|
+
// a run another account triggered never uses the owner's device (the tool refuses it): there
|
|
1810
|
+
// is no permission authority of that account here to review against
|
|
1811
|
+
if (ctx.accountId !== device.ownerAccountId)
|
|
1812
|
+
return null;
|
|
1813
|
+
const use = {
|
|
1814
|
+
orgId: ctx.orgId,
|
|
1815
|
+
deviceId: device.deviceId,
|
|
1816
|
+
holderConversationId: ctx.conversationId,
|
|
1817
|
+
actor: { accountId: ctx.accountId, conversationId: ctx.conversationId, runId: ctx.runId },
|
|
1818
|
+
};
|
|
1819
|
+
const preview = () => this.permissionAuthority.previewCall(use, { runId: ctx.runId, callId: call.id }, ctx.signal);
|
|
1820
|
+
let facts = await preview();
|
|
1821
|
+
// the facts first: a device not yet started (or not yet probed) whose review depends on them
|
|
1822
|
+
// is started under the normal lifecycle lease, which records a cloud instance's permission
|
|
1823
|
+
// evidence or a local one's installed binding, and read again
|
|
1824
|
+
if (facts.availability.state === "unprobed" &&
|
|
1825
|
+
!facts.unattended &&
|
|
1826
|
+
this.sandboxes &&
|
|
1827
|
+
REVIEWED_ON_FACTS.has(tool.key)) {
|
|
1828
|
+
try {
|
|
1829
|
+
await this.sandboxes.ensureRunning(use, ctx.signal);
|
|
1830
|
+
facts = await preview();
|
|
1831
|
+
}
|
|
1832
|
+
catch (err) {
|
|
1833
|
+
// a start that fails leaves the facts unverified (the conservative branch below); the
|
|
1834
|
+
// tool's own entry reports the device's state
|
|
1835
|
+
ctx.signal.throwIfAborted();
|
|
1836
|
+
this.deps.log.warn("cannot start the device before its review; reviewing unverified", {
|
|
1837
|
+
conversationId: ctx.conversationId,
|
|
1838
|
+
deviceId: device.deviceId,
|
|
1839
|
+
err,
|
|
1840
|
+
});
|
|
1841
|
+
}
|
|
1842
|
+
}
|
|
1843
|
+
if (facts.unattended) {
|
|
1844
|
+
// an unattended run never runs a call outside the sandbox: no one could approve it
|
|
1845
|
+
if (isEscalatedCall(tool.key, input)) {
|
|
1846
|
+
const content = escalationRefusedText(ESCALATION_UNATTENDED_WHY, facts.workingRoot);
|
|
1847
|
+
return { kind: "result", content, review: denyRecord("rule", null, content) };
|
|
1848
|
+
}
|
|
1849
|
+
return null;
|
|
1850
|
+
}
|
|
1851
|
+
if (facts.availability.state !== "supported") {
|
|
1852
|
+
// still unverified: the conservative command review decides (every profile), but a call
|
|
1853
|
+
// that needs more reach is refused now: admission could never run what an approval allowed
|
|
1854
|
+
const unverified = buildPermissionCandidate({ toolKey: tool.key, specHash: tool.specHash, rawInput: call.input, validatedInput: input }, facts, [device.home, device.deviceHome], { backgroundMaxSeconds: backgroundMaxSeconds(this.config.get()) });
|
|
1855
|
+
if (unverified.kind === "in-scope")
|
|
1856
|
+
return null;
|
|
1857
|
+
// a device that cannot run scoped work at all says why (R9); one not checked yet says that
|
|
1858
|
+
const content = unverified.kind !== "proposal"
|
|
1859
|
+
? unverified.message
|
|
1860
|
+
: facts.availability.state === "unsupported"
|
|
1861
|
+
? admissionUnavailableText(facts.availability.cause ?? { kind: "runtime" })
|
|
1862
|
+
: PERMISSION_SUPPORT_UNVERIFIED_TEXT;
|
|
1863
|
+
return { kind: "result", content, review: denyRecord("rule", null, content) };
|
|
668
1864
|
}
|
|
1865
|
+
if (tool.key === "Bash" && textField(input, "command").length > COMMAND_ASK_MAX_CHARS)
|
|
1866
|
+
return {
|
|
1867
|
+
kind: "result",
|
|
1868
|
+
content: commandTooLongText(textField(input, "command").length),
|
|
1869
|
+
review: denyRecord("rule", null, "The command exceeds the review limit"),
|
|
1870
|
+
};
|
|
1871
|
+
const escalated = isEscalatedCall(tool.key, input);
|
|
1872
|
+
// the escalation state the tool's hints read: a Bash call (every profile runs it in the
|
|
1873
|
+
// sandbox) on a device and org whose ceiling allows running outside the sandbox
|
|
1874
|
+
if (tool.key === "Bash" && !facts.escalationRefusal)
|
|
1875
|
+
note.escalation = escalated ? "escalated" : "available";
|
|
1876
|
+
// where it cannot (a layer's outside-sandbox setting is off, the runtime cannot), the hints
|
|
1877
|
+
// say why and who changes it, in the escalation refusal's per-layer words
|
|
1878
|
+
else if (tool.key === "Bash" && facts.escalationRefusal && !escalated)
|
|
1879
|
+
note.refusal = facts.escalationRefusal;
|
|
1880
|
+
// candidate building runs for every profile: the profile only chooses who approves
|
|
1881
|
+
const built = buildPermissionCandidate({
|
|
1882
|
+
toolKey: tool.key,
|
|
1883
|
+
specHash: tool.specHash,
|
|
1884
|
+
rawInput: call.input,
|
|
1885
|
+
validatedInput: input,
|
|
1886
|
+
}, facts, [device.home, device.deviceHome], { backgroundMaxSeconds: backgroundMaxSeconds(this.config.get()) });
|
|
1887
|
+
if (built.kind === "unsupported") {
|
|
1888
|
+
// a Bash reach the restricted scope cannot grant: retrying outside the sandbox may (a
|
|
1889
|
+
// protected location's text names the escalation itself)
|
|
1890
|
+
const content = note.escalation === "available" && built.code === "unbounded-scope"
|
|
1891
|
+
? `${built.message}${ESCALATION_RETRY_HINT}`
|
|
1892
|
+
: built.message;
|
|
1893
|
+
return { kind: "result", content, review: denyRecord("rule", null, content) };
|
|
1894
|
+
}
|
|
1895
|
+
const candidate = built.kind === "proposal" ? built.candidate : undefined;
|
|
1896
|
+
// who approves this call's crossing: the person, the review model, or nobody (Full access
|
|
1897
|
+
// grants it within the device's ceilings); a sub-agent's escalation never goes to nobody
|
|
1898
|
+
const approver = approverForCrossing({
|
|
1899
|
+
profile: facts.profile,
|
|
1900
|
+
crossing: candidate ? crossingOfCandidate(candidate) : "sensitive",
|
|
1901
|
+
subAgent: ctx.parent !== undefined,
|
|
1902
|
+
});
|
|
1903
|
+
// a sensitive-command consent the person settled (no proposed reach): the call runs under
|
|
1904
|
+
// the base scope it was asked under; the approval adds nothing
|
|
1905
|
+
if (previous &&
|
|
1906
|
+
previous.status !== "superseded" &&
|
|
1907
|
+
!candidate &&
|
|
1908
|
+
!previous.command?.permissionCandidate) {
|
|
1909
|
+
const settled = this.settledCommandAsk(previous, tool.key);
|
|
1910
|
+
// the root the person approved is carried only while the device still runs in the mode
|
|
1911
|
+
// recorded with the ask (B-18: the judged root stays the one recorded)
|
|
1912
|
+
if (settled.kind === "continue" &&
|
|
1913
|
+
settled.workingRoot !== undefined &&
|
|
1914
|
+
(device.mode !== previous.command?.mode ||
|
|
1915
|
+
carriedRoot({ workspace: device.workspace, workingRoot: settled.workingRoot }) ===
|
|
1916
|
+
undefined))
|
|
1917
|
+
return { ...settled, workingRoot: undefined };
|
|
1918
|
+
return settled;
|
|
1919
|
+
}
|
|
1920
|
+
if (previous &&
|
|
1921
|
+
previous.status !== "superseded" &&
|
|
1922
|
+
candidate &&
|
|
1923
|
+
previous.command?.permissionCandidate?.candidateHash === candidate.candidateHash) {
|
|
1924
|
+
if (previous.status !== "approved")
|
|
1925
|
+
return this.settledCommandAsk(previous, tool.key);
|
|
1926
|
+
const grant = await withTransactionFencePrelude(() => permissionLocks.acquire({
|
|
1927
|
+
orgId: facts.orgId,
|
|
1928
|
+
deviceId: facts.deviceId,
|
|
1929
|
+
rootConversationId: facts.rootConversationId,
|
|
1930
|
+
}, { kind: "admit" }), () => this.findPermissionGrant(candidate));
|
|
1931
|
+
if (grant)
|
|
1932
|
+
return this.settledCommandAsk(previous, tool.key);
|
|
1933
|
+
}
|
|
1934
|
+
if (candidate) {
|
|
1935
|
+
const existingGrant = await withTransactionFencePrelude(() => permissionLocks.acquire({
|
|
1936
|
+
orgId: facts.orgId,
|
|
1937
|
+
deviceId: facts.deviceId,
|
|
1938
|
+
rootConversationId: facts.rootConversationId,
|
|
1939
|
+
}, { kind: "admit" }), () => this.findPermissionGrant(candidate));
|
|
1940
|
+
if (existingGrant) {
|
|
1941
|
+
if (existingGrant.scopeKind !== candidate.scopeKind ||
|
|
1942
|
+
permissionScopeHash(existingGrant.expansion) !==
|
|
1943
|
+
permissionScopeHash(candidate.permissionScope))
|
|
1944
|
+
return {
|
|
1945
|
+
kind: "result",
|
|
1946
|
+
content: "This call already has different permission evidence; submit a new call with the intended directory scope.",
|
|
1947
|
+
review: denyRecord("rule", null, "Conflicting permission evidence"),
|
|
1948
|
+
};
|
|
1949
|
+
return {
|
|
1950
|
+
kind: "continue",
|
|
1951
|
+
workingRoot: carriedRoot(device),
|
|
1952
|
+
reviewedAgainst: facts.workingRoot,
|
|
1953
|
+
// the evidence's real source: the person's approval, the review model's allow or the
|
|
1954
|
+
// Full access auto-grant
|
|
1955
|
+
review: {
|
|
1956
|
+
decision: "allow",
|
|
1957
|
+
by: existingGrant.source === "human"
|
|
1958
|
+
? "person"
|
|
1959
|
+
: existingGrant.source === "review-model"
|
|
1960
|
+
? "classifier"
|
|
1961
|
+
: "rule",
|
|
1962
|
+
rule: null,
|
|
1963
|
+
reason: "The exact current call already has approved permission evidence.",
|
|
1964
|
+
profile: facts.profile,
|
|
1965
|
+
profileRevision: facts.profileRevision,
|
|
1966
|
+
scopeRevision: facts.scopeRevision,
|
|
1967
|
+
decisionSource: existingGrant.source,
|
|
1968
|
+
crossing: crossingOfCandidate(candidate),
|
|
1969
|
+
...(candidate.escalation ? { sandbox: "escalated" } : {}),
|
|
1970
|
+
},
|
|
1971
|
+
};
|
|
1972
|
+
}
|
|
1973
|
+
}
|
|
1974
|
+
const verdict = await this.deps.review.review({
|
|
1975
|
+
orgId: ctx.orgId,
|
|
1976
|
+
conversationId: facts.rootConversationId,
|
|
1977
|
+
runId: ctx.runId,
|
|
1978
|
+
accountId: ctx.accountId,
|
|
1979
|
+
toolKey: tool.key,
|
|
1980
|
+
input,
|
|
1981
|
+
mode: device.mode,
|
|
1982
|
+
workspace: facts.workingRoot,
|
|
1983
|
+
home: device.home,
|
|
1984
|
+
deviceHome: device.deviceHome,
|
|
1985
|
+
attended: true,
|
|
1986
|
+
step: ctx.step,
|
|
1987
|
+
callId: call.id,
|
|
1988
|
+
signal: ctx.signal,
|
|
1989
|
+
...reviewParentOf(ctx.parent),
|
|
1990
|
+
agentId: ctx.agentId,
|
|
1991
|
+
agentVersion: ctx.agentVersion,
|
|
1992
|
+
...(ctx.conversationKind ? { conversationKind: ctx.conversationKind } : {}),
|
|
1993
|
+
permissionProfile: facts.profile,
|
|
1994
|
+
...(candidate ? { permissionCandidate: candidate } : {}),
|
|
1995
|
+
...(note.escalation === "available" ? { escalationAvailable: true } : {}),
|
|
1996
|
+
});
|
|
1997
|
+
// who decided: the review knows the call's consents (a credential consent sends a Full access
|
|
1998
|
+
// escalation to the review model); without its answer, the profile's approver
|
|
1999
|
+
const decidedBy = verdict.approver ?? approver;
|
|
2000
|
+
if (candidate && decidedBy === "review-model") {
|
|
2001
|
+
await withTransactionFencePrelude(() => permissionLocks.acquire({
|
|
2002
|
+
orgId: facts.orgId,
|
|
2003
|
+
deviceId: facts.deviceId,
|
|
2004
|
+
rootConversationId: facts.rootConversationId,
|
|
2005
|
+
}, { kind: "admit" }), () => this.recordPermissionReview(candidate, verdict));
|
|
2006
|
+
}
|
|
2007
|
+
// Full access: the crossing is granted for this call, recorded exactly once (its event, the
|
|
2008
|
+
// audit row and the grant in one fenced transaction); a fixed deny never reaches this
|
|
2009
|
+
if (candidate && decidedBy === "none" && verdict.decision === "allow") {
|
|
2010
|
+
if (!this.autoGrants)
|
|
2011
|
+
throw new Error("Permission auto-grants are unavailable");
|
|
2012
|
+
await this.autoGrants.record(candidate, verdict.sensitive ?? []);
|
|
2013
|
+
}
|
|
2014
|
+
const provenance = {
|
|
2015
|
+
profile: facts.profile,
|
|
2016
|
+
profileRevision: facts.profileRevision,
|
|
2017
|
+
scopeRevision: facts.scopeRevision,
|
|
2018
|
+
};
|
|
2019
|
+
if (verdict.decision === "deny")
|
|
2020
|
+
return {
|
|
2021
|
+
kind: "result",
|
|
2022
|
+
content: commandDeniedText(verdict.reason, reviewKindOf(tool.key)),
|
|
2023
|
+
review: { ...denyRecord(verdict.by, verdict.rule, verdict.reason), ...provenance },
|
|
2024
|
+
};
|
|
2025
|
+
if (verdict.decision === "allow")
|
|
2026
|
+
return {
|
|
2027
|
+
kind: "continue",
|
|
2028
|
+
workingRoot: carriedRoot(device),
|
|
2029
|
+
reviewedAgainst: facts.workingRoot,
|
|
2030
|
+
review: {
|
|
2031
|
+
...allowRecord(verdict),
|
|
2032
|
+
...provenance,
|
|
2033
|
+
decisionSource: verdict.by === "classifier"
|
|
2034
|
+
? "review-model"
|
|
2035
|
+
: facts.profile === "full-access"
|
|
2036
|
+
? "full-access"
|
|
2037
|
+
: "scope",
|
|
2038
|
+
...(candidate
|
|
2039
|
+
? { crossing: crossingOfCandidate(candidate) }
|
|
2040
|
+
: verdict.crossing
|
|
2041
|
+
? { crossing: verdict.crossing }
|
|
2042
|
+
: {}),
|
|
2043
|
+
// the review model's allow or Full access issued this call's escalation grant: it runs
|
|
2044
|
+
// outside the sandbox
|
|
2045
|
+
...(candidate?.escalation && (verdict.by === "classifier" || decidedBy === "none")
|
|
2046
|
+
? { sandbox: "escalated" }
|
|
2047
|
+
: {}),
|
|
2048
|
+
},
|
|
2049
|
+
};
|
|
2050
|
+
// an ask: the sensitive-command consent (no proposed reach: approved, the call runs under the
|
|
2051
|
+
// base scope) or the displayed expansion (approved, the call's grant is issued)
|
|
2052
|
+
const kind = reviewKindOf(tool.key);
|
|
2053
|
+
// every path the call writes (a GenerateImage call's suffixed paths, comma-separated)
|
|
2054
|
+
const filePaths = kind === "write" ? writePathsOf(tool.key, input).filter(Boolean) : [];
|
|
2055
|
+
const ask = await this.deps.approvals.requestCommand({
|
|
2056
|
+
orgId: ctx.orgId,
|
|
2057
|
+
conversationId: ctx.conversationId,
|
|
2058
|
+
runId: ctx.runId,
|
|
2059
|
+
step: ctx.step,
|
|
2060
|
+
callId: call.id,
|
|
2061
|
+
requestedFor: ctx.accountId,
|
|
2062
|
+
// `session` only for a consent rule class with no expansion (a grant is per call)
|
|
2063
|
+
scopes: !candidate && isSessionGrantableRule(verdict.rule) ? ["once", "session"] : ["once"],
|
|
2064
|
+
detail: {
|
|
2065
|
+
deviceId: device.deviceId,
|
|
2066
|
+
deviceName: device.deviceName,
|
|
2067
|
+
mode: device.mode,
|
|
2068
|
+
kind,
|
|
2069
|
+
command: tool.key === "Bash" ? textField(input, "command") : tool.key,
|
|
2070
|
+
rule: verdict.rule,
|
|
2071
|
+
reason: clipText(verdict.reason, COMMAND_ASK_TEXT_MAX_CHARS),
|
|
2072
|
+
workingRoot: facts.workingRoot,
|
|
2073
|
+
...(candidate
|
|
2074
|
+
? {
|
|
2075
|
+
permissionCandidate: candidate,
|
|
2076
|
+
permissionScope: candidate.permissionScope,
|
|
2077
|
+
candidateHash: candidate.candidateHash,
|
|
2078
|
+
...(candidate.targetPath
|
|
2079
|
+
? { targetPath: candidate.targetPath, path: candidate.targetPath }
|
|
2080
|
+
: {}),
|
|
2081
|
+
...(candidate.escalation ? { escalation: candidate.escalation } : {}),
|
|
2082
|
+
}
|
|
2083
|
+
: filePaths.length > 0
|
|
2084
|
+
? {
|
|
2085
|
+
path: clipText(filePaths.map((p) => pathAgainstWorkingRoot(p, facts.workingRoot)).join(", "), 4096),
|
|
2086
|
+
}
|
|
2087
|
+
: {}),
|
|
2088
|
+
},
|
|
2089
|
+
});
|
|
2090
|
+
return { kind: "wait", wait: approvalWait(ask) };
|
|
2091
|
+
}
|
|
2092
|
+
/**
|
|
2093
|
+
* Whether an execution of this call was admitted outside the sandbox (a per-call escalation's
|
|
2094
|
+
* full reach, under any profile): an intent past admission, or one revoked after dispatch, whose
|
|
2095
|
+
* device-wide scope came from the call's escalation grant.
|
|
2096
|
+
*/
|
|
2097
|
+
// org-filter: runId is the call context's own run (ctx.runId), a runtime uuid, never caller input
|
|
2098
|
+
async admittedOutsideSandbox(runId, callId) {
|
|
2099
|
+
const rows = await this.deps.db
|
|
2100
|
+
.selectFrom("sandbox_operation_intents as i")
|
|
2101
|
+
.innerJoin("permission_call_grants as g", "g.id", "i.permission_grant_id")
|
|
2102
|
+
.select(["i.scope", "i.state", "i.outcome_unknown"])
|
|
2103
|
+
.where("i.run_id", "=", runId)
|
|
2104
|
+
.where("i.call_id", "=", callId)
|
|
2105
|
+
.where("i.method", "in", ["exec", "backgroundStart"])
|
|
2106
|
+
.where("g.scope_kind", "=", "sandbox-escalation")
|
|
2107
|
+
.execute();
|
|
2108
|
+
return rows.some((r) => {
|
|
2109
|
+
const scope = r.scope;
|
|
2110
|
+
const admitted = r.state === "revoked" ? r.outcome_unknown : r.state !== "pending";
|
|
2111
|
+
return admitted && scope.filesystem?.kind === "device";
|
|
2112
|
+
});
|
|
2113
|
+
}
|
|
2114
|
+
findPermissionGrant(candidate) {
|
|
2115
|
+
if (!this.permissionGrants)
|
|
2116
|
+
throw new Error("Permission grants are unavailable");
|
|
2117
|
+
return this.permissionGrants.findForAdmission(candidate.binding);
|
|
2118
|
+
}
|
|
2119
|
+
async recordPermissionReview(candidate, verdict) {
|
|
2120
|
+
if (!this.permissionGrants)
|
|
2121
|
+
throw new Error("Permission grants are unavailable");
|
|
2122
|
+
await this.permissionGrants.assertCurrent(candidate.binding);
|
|
2123
|
+
const events = await this.deps.eventLog.appendIn(candidate.binding.conversationId, [
|
|
2124
|
+
{
|
|
2125
|
+
type: "permission_reviewed",
|
|
2126
|
+
runId: candidate.binding.runId,
|
|
2127
|
+
payload: {
|
|
2128
|
+
...candidate,
|
|
2129
|
+
outcome: verdict.decision,
|
|
2130
|
+
reason: verdict.reason,
|
|
2131
|
+
// the review model only for its own verdict: a fixed rule's deny, a rule ask (the review
|
|
2132
|
+
// model unmapped or not consulted) and the fail-closed ask are the rules'
|
|
2133
|
+
decisionSource: verdict.by === "classifier" ? "review-model" : "rule",
|
|
2134
|
+
},
|
|
2135
|
+
},
|
|
2136
|
+
]);
|
|
2137
|
+
const event = events[0];
|
|
2138
|
+
if (!event)
|
|
2139
|
+
throw new Error("The review event was not recorded");
|
|
2140
|
+
if (verdict.decision === "allow" && verdict.by === "classifier")
|
|
2141
|
+
await this.permissionGrants.issueLocked(candidate, {
|
|
2142
|
+
source: "review-model",
|
|
2143
|
+
reviewEventSeq: event.seq,
|
|
2144
|
+
decidedBy: null,
|
|
2145
|
+
});
|
|
2146
|
+
}
|
|
2147
|
+
/** The outcome of a call whose `command` approval was already asked (a resume). */
|
|
2148
|
+
settledCommandAsk(ask, toolKey) {
|
|
2149
|
+
const kind = reviewKindOf(toolKey);
|
|
2150
|
+
const rule = ask.command?.rule ?? null;
|
|
2151
|
+
if (ask.status === "pending")
|
|
2152
|
+
return { kind: "wait", wait: approvalWait(ask) };
|
|
2153
|
+
if (ask.status === "approved") {
|
|
2154
|
+
return {
|
|
2155
|
+
kind: "continue",
|
|
2156
|
+
commandAsk: ask,
|
|
2157
|
+
review: this.personAllowRecord(ask),
|
|
2158
|
+
workingRoot: ask.command?.workingRoot,
|
|
2159
|
+
reviewedAgainst: ask.command?.workingRoot,
|
|
2160
|
+
};
|
|
2161
|
+
}
|
|
2162
|
+
if (ask.status === "denied") {
|
|
2163
|
+
const reason = ask.denyReason;
|
|
2164
|
+
return {
|
|
2165
|
+
kind: "result",
|
|
2166
|
+
content: commandDeclinedText(reason, kind),
|
|
2167
|
+
review: denyRecord("person", rule, reason ?? "The user declined."),
|
|
2168
|
+
};
|
|
2169
|
+
}
|
|
2170
|
+
const text = ask.status === "expired" ? approvalExpiredText(approvalHours(ask)) : APPROVAL_CANCELLED_TEXT;
|
|
2171
|
+
return { kind: "result", content: text, review: denyRecord("person", rule, text) };
|
|
2172
|
+
}
|
|
2173
|
+
/**
|
|
2174
|
+
* The review record of a command (or write) the person allowed: its scope, and for a shell
|
|
2175
|
+
* command the SHA-256 of the text the ask holds in full, so an audit can match record and text.
|
|
2176
|
+
*/
|
|
2177
|
+
personAllowRecord(ask) {
|
|
2178
|
+
const binding = ask.command?.permissionCandidate?.binding;
|
|
2179
|
+
const escalated = ask.command?.permissionCandidate?.scopeKind === "sandbox-escalation";
|
|
2180
|
+
return {
|
|
2181
|
+
...(escalated ? { sandbox: "escalated" } : {}),
|
|
2182
|
+
...(binding
|
|
2183
|
+
? {
|
|
2184
|
+
profile: binding.profile,
|
|
2185
|
+
profileRevision: binding.profileRevision,
|
|
2186
|
+
scopeRevision: binding.scopeRevision,
|
|
2187
|
+
decisionSource: "human",
|
|
2188
|
+
}
|
|
2189
|
+
: {}),
|
|
2190
|
+
decision: "allow",
|
|
2191
|
+
by: "person",
|
|
2192
|
+
rule: ask.command?.rule ?? null,
|
|
2193
|
+
reason: ask.command?.reason ?? "The user allowed this call.",
|
|
2194
|
+
...((ask.scope === "once" || ask.scope === "session") && { scope: ask.scope }),
|
|
2195
|
+
...(ask.command !== null &&
|
|
2196
|
+
ask.command.kind === "command" && {
|
|
2197
|
+
commandHash: sha256Hex(ask.command.command),
|
|
2198
|
+
}),
|
|
2199
|
+
};
|
|
2200
|
+
}
|
|
2201
|
+
/**
|
|
2202
|
+
* A foreground command's refused network hosts (network ask-to-allow spec §6.2, §6.8, §8.3):
|
|
2203
|
+
* the `network_blocked` event, the missing grants of an unattended run, and either notes for the
|
|
2204
|
+
* result written now, or (device-layer hosts worth asking) `network_blocked` and the call's
|
|
2205
|
+
* `tool.called` audit written now, the result kept in a network ask to the device's owner and
|
|
2206
|
+
* the run's wait. The kept result is the formatted one (≤ 16 KB: larger output is archived)
|
|
2207
|
+
* followed by the notes written now; it is written with the decision's note when the ask
|
|
2208
|
+
* settles (P-D2).
|
|
2209
|
+
*/
|
|
2210
|
+
async networkBlocked(ctx, callId, toolKey, input, report, pre, callAudit, result,
|
|
2211
|
+
/** Admission's verdict for this call: `available` when it may run outside the sandbox. */
|
|
2212
|
+
escalation,
|
|
2213
|
+
/** Why this call could not run outside the sandbox here (absent when it could). */
|
|
2214
|
+
escalationRefusal,
|
|
2215
|
+
/**
|
|
2216
|
+
* A device service's refusals (browser use spec §7.1): the extension whose service asked and
|
|
2217
|
+
* the call's attempt. Only "always" is offered; once approved the call runs again.
|
|
2218
|
+
*/
|
|
2219
|
+
service) {
|
|
2220
|
+
const hosts = blockedEventHosts(report.blocked);
|
|
2221
|
+
if (hosts.length === 0)
|
|
2222
|
+
return { kind: "write", event: null, notes: [] };
|
|
2223
|
+
const event = {
|
|
2224
|
+
type: "network_blocked",
|
|
2225
|
+
runId: ctx.runId,
|
|
2226
|
+
idemKey: networkBlockedIdemKey(ctx.runId, callId),
|
|
2227
|
+
payload: { step: ctx.step, callId, hosts },
|
|
2228
|
+
};
|
|
2229
|
+
const network = this.deps.network;
|
|
2230
|
+
if (network === undefined)
|
|
2231
|
+
return { kind: "write", event, notes: [] };
|
|
2232
|
+
const run = hosts.some((h) => h.layer === "device")
|
|
2233
|
+
? await network.grants.runState(ctx.runId, report.deviceId)
|
|
2234
|
+
: null;
|
|
2235
|
+
const limits = this.config.get().sandbox.limits;
|
|
2236
|
+
// the ask offers what the device's provider enforces (device-provider spec §6.3): a run grant
|
|
2237
|
+
// only with per-operation hosts, "add to this device's list" only for hosts its own list can
|
|
2238
|
+
// take; a host neither reaches is unavailable, never asked about
|
|
2239
|
+
const sandbox = await network.sandbox?.hostRefusal({
|
|
2240
|
+
orgId: ctx.orgId,
|
|
2241
|
+
deviceId: report.deviceId,
|
|
2242
|
+
});
|
|
2243
|
+
const plan = planNetworkAsk(hosts, run, {
|
|
2244
|
+
unattended: ctx.unattended,
|
|
2245
|
+
outsideCeiling: (h) => orgHostOutsideCeiling(limits, h),
|
|
2246
|
+
...(sandbox !== undefined &&
|
|
2247
|
+
(service !== undefined
|
|
2248
|
+
? serviceAskTerms(sandbox)
|
|
2249
|
+
: {
|
|
2250
|
+
...deviceAskTerms(sandbox),
|
|
2251
|
+
// the hint follows admission's verdict for this call (never a recomputation), and
|
|
2252
|
+
// only the open network makes a private address the one thing escalation adds
|
|
2253
|
+
escalation: addressEscalationHint(escalation, sandbox.box.networkMode),
|
|
2254
|
+
})),
|
|
2255
|
+
...(service === undefined && escalationRefusal !== undefined && { escalationRefusal }),
|
|
2256
|
+
});
|
|
2257
|
+
if (ctx.unattended != null) {
|
|
2258
|
+
for (const key of plan.missingGrants) {
|
|
2259
|
+
await appendMissingGrant(this.deps.db, ctx.unattended.taskRunId, key);
|
|
2260
|
+
}
|
|
2261
|
+
}
|
|
2262
|
+
const offer = plan.offer;
|
|
2263
|
+
if (plan.ask.length === 0 || offer === undefined)
|
|
2264
|
+
return { kind: "write", event, notes: plan.notes };
|
|
2265
|
+
// one ask per call: a service call that ran again after its ask is not asked again; only a
|
|
2266
|
+
// would-be ask is replaced, the plan's other notes (a host on the list, not yet applied) stay
|
|
2267
|
+
if (service !== undefined &&
|
|
2268
|
+
(await this.deps.approvals.networkForCall(ctx.runId, callId)) !== null) {
|
|
2269
|
+
return {
|
|
2270
|
+
kind: "write",
|
|
2271
|
+
event,
|
|
2272
|
+
notes: [...plan.notes, serviceAskedNote(plan.ask.map((h) => h.host))],
|
|
2273
|
+
};
|
|
2274
|
+
}
|
|
2275
|
+
// the device's owner is the only person who may decide (spec §5.2)
|
|
2276
|
+
const owner = await this.deps.db
|
|
2277
|
+
.selectFrom("devices")
|
|
2278
|
+
.select("owner_account_id")
|
|
2279
|
+
.where("id", "=", report.deviceId)
|
|
2280
|
+
.where("org_id", "=", ctx.orgId)
|
|
2281
|
+
.where("deleted_at", "is", null)
|
|
2282
|
+
.executeTakeFirst();
|
|
2283
|
+
if (owner === undefined)
|
|
2284
|
+
return { kind: "write", event, notes: plan.notes };
|
|
2285
|
+
let { content, outputId } = result;
|
|
2286
|
+
if (Buffer.byteLength(content, "utf8") > NETWORK_ASK_KEPT_MAX_BYTES && outputId === undefined) {
|
|
2287
|
+
// output under the spill threshold but over what an ask keeps: archive it after all
|
|
2288
|
+
const spilled = await spillIfLarge(result.text, { spillChars: 0, previewChars: this.config.get().tools.outputPreviewChars }, (c) => this.deps.outputs.save({
|
|
2289
|
+
orgId: ctx.orgId,
|
|
2290
|
+
conversationId: ctx.conversationId,
|
|
2291
|
+
callId,
|
|
2292
|
+
content: c,
|
|
2293
|
+
}));
|
|
2294
|
+
content = spilled.content;
|
|
2295
|
+
outputId = spilled.outputId;
|
|
2296
|
+
}
|
|
2297
|
+
const { text: _text, ...rest } = result;
|
|
2298
|
+
const kept = {
|
|
2299
|
+
...rest,
|
|
2300
|
+
content: withNetworkNotes(clipKept(content), plan.notes),
|
|
2301
|
+
...(outputId !== undefined && { outputId }),
|
|
2302
|
+
};
|
|
2303
|
+
// the command ran: the call's display-only events (a `device_code`) and network_blocked with
|
|
2304
|
+
// its tool.called now, the result once the ask settles
|
|
2305
|
+
const written = await this.writeResultIn(ctx, callId, toolKey, { isError: result.isError }, [...pre, event], callAudit, []);
|
|
2306
|
+
await this.deps.eventLog.notify(ctx.conversationId, Math.max(...written.map((e) => e.seq)));
|
|
2307
|
+
const given = (input ?? {});
|
|
2308
|
+
const ask = await this.deps.approvals.requestNetwork({
|
|
2309
|
+
orgId: ctx.orgId,
|
|
2310
|
+
conversationId: ctx.conversationId,
|
|
2311
|
+
runId: ctx.runId,
|
|
2312
|
+
step: ctx.step,
|
|
2313
|
+
callId,
|
|
2314
|
+
requestedFor: owner.owner_account_id,
|
|
2315
|
+
toolKey,
|
|
2316
|
+
detail: service === undefined
|
|
2317
|
+
? {
|
|
2318
|
+
kind: "command",
|
|
2319
|
+
deviceId: report.deviceId,
|
|
2320
|
+
hosts: plan.ask,
|
|
2321
|
+
command: typeof given.command === "string" ? clipText(given.command, 2000) : "",
|
|
2322
|
+
description: typeof given.description === "string" ? given.description : null,
|
|
2323
|
+
appliesAt: offer.appliesAt,
|
|
2324
|
+
result: kept,
|
|
2325
|
+
}
|
|
2326
|
+
: {
|
|
2327
|
+
kind: "service",
|
|
2328
|
+
deviceId: report.deviceId,
|
|
2329
|
+
service: service.name,
|
|
2330
|
+
url: service.url,
|
|
2331
|
+
hosts: plan.ask.map((h) => h.host),
|
|
2332
|
+
attempt: service.attempt,
|
|
2333
|
+
appliesAt: offer.appliesAt,
|
|
2334
|
+
result: kept,
|
|
2335
|
+
},
|
|
2336
|
+
scopes: offer.scopes,
|
|
2337
|
+
});
|
|
2338
|
+
return { kind: "wait", wait: approvalWait(ask), content: kept.content };
|
|
2339
|
+
}
|
|
2340
|
+
/**
|
|
2341
|
+
* A device service's report (the call scope, browser use spec §7.1) on the device the call's
|
|
2342
|
+
* conversation works in (the root conversation's for a sub-agent, as the sandbox tools resolve
|
|
2343
|
+
* it): a report that names no device is about that one; a report naming another device id (the
|
|
2344
|
+
* conversation moved to another device during the call) is ignored with a warning, never asked
|
|
2345
|
+
* about.
|
|
2346
|
+
*/
|
|
2347
|
+
async ownDeviceReport(ctx, toolKey, blocked) {
|
|
2348
|
+
if (blocked === undefined)
|
|
2349
|
+
return undefined;
|
|
2350
|
+
const conv = await this.deps.db
|
|
2351
|
+
.selectFrom("conversations")
|
|
2352
|
+
.select("device_id")
|
|
2353
|
+
.where("id", "=", ctx.parent?.rootConversationId ?? ctx.conversationId)
|
|
2354
|
+
.where("org_id", "=", ctx.orgId)
|
|
2355
|
+
.executeTakeFirst();
|
|
2356
|
+
const deviceId = conv?.device_id ?? null;
|
|
2357
|
+
if (deviceId !== null && (blocked.deviceId === null || blocked.deviceId === deviceId))
|
|
2358
|
+
return { ...blocked, deviceId };
|
|
2359
|
+
this.deps.log.warn("ignored refused hosts reported for another device than the call's", {
|
|
2360
|
+
runId: ctx.runId,
|
|
2361
|
+
toolKey,
|
|
2362
|
+
deviceId: blocked.deviceId,
|
|
2363
|
+
});
|
|
669
2364
|
return undefined;
|
|
670
2365
|
}
|
|
671
2366
|
/** Appends a sub-agent's connect card to its root conversation ({@link rootSurfaceOf}). */
|
|
@@ -689,19 +2384,15 @@ let ToolPipeline = class ToolPipeline {
|
|
|
689
2384
|
]);
|
|
690
2385
|
}
|
|
691
2386
|
/**
|
|
692
|
-
*
|
|
693
|
-
*
|
|
694
|
-
*
|
|
2387
|
+
* How a call's result images are stored: a `read` copy bound to the calling conversation (a
|
|
2388
|
+
* sub-agent's own, never its root), owned by the run's trigger account; absent without the
|
|
2389
|
+
* attachments service.
|
|
695
2390
|
*/
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
const { tools, catalog } = e.payload.request;
|
|
702
|
-
return new Set([...(tools ?? []), ...(catalog ?? [])].map((t) => t.key));
|
|
703
|
-
}
|
|
704
|
-
return null;
|
|
2391
|
+
storeResultImage(ctx) {
|
|
2392
|
+
const attachments = this.resultImages;
|
|
2393
|
+
if (attachments === undefined)
|
|
2394
|
+
return undefined;
|
|
2395
|
+
return (file) => attachments.storeRead(ctx.orgId, ctx.conversationId, ctx.accountId || null, file);
|
|
705
2396
|
}
|
|
706
2397
|
/**
|
|
707
2398
|
* 发出本步调用的请求里带了完整定义的工具 key:本步最后一次尝试的 `model_call.request.tools`
|
|
@@ -709,7 +2400,9 @@ let ToolPipeline = class ToolPipeline {
|
|
|
709
2400
|
* 或找不到 model_call 时返回 null(不做加载检查)。已加载集合由此从日志得出,不放进程内存。
|
|
710
2401
|
*/
|
|
711
2402
|
async sentTools(ctx) {
|
|
712
|
-
|
|
2403
|
+
// attempts can reach MAX_STEP_MODEL_CALLS after reactive overflow fix-ups; the assistant_message
|
|
2404
|
+
// comes from the last attempt, so scan from the top
|
|
2405
|
+
for (let attempt = MAX_STEP_MODEL_CALLS; attempt >= 1; attempt--) {
|
|
713
2406
|
const e = await this.deps.eventLog.findByIdem(ctx.conversationId, modelCallIdemKey(ctx.runId, ctx.step, attempt));
|
|
714
2407
|
if (e?.type !== "model_call")
|
|
715
2408
|
continue;
|
|
@@ -718,13 +2411,82 @@ let ToolPipeline = class ToolPipeline {
|
|
|
718
2411
|
}
|
|
719
2412
|
return null;
|
|
720
2413
|
}
|
|
721
|
-
/**
|
|
2414
|
+
/**
|
|
2415
|
+
* The secure input of a call with person fields (R4): the latest request of the call, bound like
|
|
2416
|
+
* an approval to the definition and the raw input it was made for. None, or a submitted one made
|
|
2417
|
+
* for another definition or input, asks again; a pending one waits. A cancel, an expiry or a
|
|
2418
|
+
* stopped run ends the call with nothing run; a submitted one returns its id, which the tool
|
|
2419
|
+
* reads the sealed values by. The request goes to the run's person, who alone may submit it.
|
|
2420
|
+
*/
|
|
2421
|
+
async secureInput(ctx, call, tool, policyKey, personFields) {
|
|
2422
|
+
let si = await this.deps.approvals.secureInputForCall(ctx.runId, call.id);
|
|
2423
|
+
const current = si !== null &&
|
|
2424
|
+
si.specHash === tool.specHash &&
|
|
2425
|
+
canonicalJson(si.input) === canonicalJson(call.input ?? {});
|
|
2426
|
+
// only a submitted request is re-asked when stale: a pending one keeps waiting (the person
|
|
2427
|
+
// still sees and may submit it; the stale check then asks again), and a cancelled or expired
|
|
2428
|
+
// one ends the call, as a decided approval keeps governing its call
|
|
2429
|
+
if (si === null || (si.status === "approved" && !current)) {
|
|
2430
|
+
si = await this.deps.approvals.requestSecureInput({
|
|
2431
|
+
attempt: (await this.lastAttempt(ctx.runId, call.id)) + 1,
|
|
2432
|
+
orgId: ctx.orgId,
|
|
2433
|
+
conversationId: ctx.conversationId,
|
|
2434
|
+
runId: ctx.runId,
|
|
2435
|
+
step: ctx.step,
|
|
2436
|
+
callId: call.id,
|
|
2437
|
+
toolKey: policyKey,
|
|
2438
|
+
specHash: tool.specHash,
|
|
2439
|
+
connectorId: tool.source.kind === "connector" ? tool.source.connectorId : null,
|
|
2440
|
+
input: call.input,
|
|
2441
|
+
requestedFor: ctx.accountId,
|
|
2442
|
+
target: personFields.target,
|
|
2443
|
+
personFields: personFields.fields,
|
|
2444
|
+
});
|
|
2445
|
+
}
|
|
2446
|
+
switch (si.status) {
|
|
2447
|
+
case "pending":
|
|
2448
|
+
return { kind: "wait", wait: approvalWait(si) };
|
|
2449
|
+
case "approved":
|
|
2450
|
+
return { kind: "submitted", id: si.id };
|
|
2451
|
+
case "denied":
|
|
2452
|
+
return {
|
|
2453
|
+
kind: "refused",
|
|
2454
|
+
text: withLeakedOnCard(secureInputCancelledText(si.id), si.leakedFields),
|
|
2455
|
+
};
|
|
2456
|
+
case "expired":
|
|
2457
|
+
// the request's own wait (creation to expiry), not the current config
|
|
2458
|
+
return {
|
|
2459
|
+
kind: "refused",
|
|
2460
|
+
text: withLeakedOnCard(secureInputExpiredText(si.id, approvalHours(si)), si.leakedFields),
|
|
2461
|
+
};
|
|
2462
|
+
default:
|
|
2463
|
+
return {
|
|
2464
|
+
kind: "refused",
|
|
2465
|
+
text: withLeakedOnCard(APPROVAL_CANCELLED_TEXT, si.leakedFields),
|
|
2466
|
+
};
|
|
2467
|
+
}
|
|
2468
|
+
}
|
|
2469
|
+
/** The highest attempt of any approval of the call, of every kind (0: none yet). */
|
|
2470
|
+
// org-filter: runId is the call context's own run (ctx.runId), a runtime uuid, never caller input
|
|
2471
|
+
async lastAttempt(runId, callId) {
|
|
2472
|
+
const row = await this.deps.db
|
|
2473
|
+
.selectFrom("approvals")
|
|
2474
|
+
.select(sql `max(attempt)`.as("attempt"))
|
|
2475
|
+
.where("run_id", "=", runId)
|
|
2476
|
+
.where("call_id", "=", callId)
|
|
2477
|
+
.executeTakeFirst();
|
|
2478
|
+
return Number(row?.attempt ?? 0);
|
|
2479
|
+
}
|
|
2480
|
+
/**
|
|
2481
|
+
* A decided tool approval other than approved → the model's text; still pending → null (wait).
|
|
2482
|
+
* A tool approval takes no values (a secure input does), so it never names leaked fields.
|
|
2483
|
+
*/
|
|
722
2484
|
refusalText(a) {
|
|
723
2485
|
switch (a.status) {
|
|
724
2486
|
case "denied":
|
|
725
2487
|
return approvalDeniedText(a.denyReason);
|
|
726
2488
|
case "expired":
|
|
727
|
-
//
|
|
2489
|
+
// Use the approval's own wait (creation to expiry), not the current config: it can be hot-reloaded
|
|
728
2490
|
return approvalExpiredText(approvalHours(a));
|
|
729
2491
|
case "cancelled":
|
|
730
2492
|
return APPROVAL_CANCELLED_TEXT;
|
|
@@ -733,8 +2495,9 @@ let ToolPipeline = class ToolPipeline {
|
|
|
733
2495
|
}
|
|
734
2496
|
}
|
|
735
2497
|
/**
|
|
736
|
-
*
|
|
737
|
-
*
|
|
2498
|
+
* A handler returned `input_required`: past the round limit, an invalid form
|
|
2499
|
+
* (`validateInputForm`) or an oversized state is an error text for the model; otherwise an
|
|
2500
|
+
* input request is made (writing `question_asked`) and its wait returned.
|
|
738
2501
|
*/
|
|
739
2502
|
async askInput(ctx, callId, toolKey, attempt, req) {
|
|
740
2503
|
if (attempt > MAX_INPUT_ROUNDS)
|
|
@@ -764,6 +2527,14 @@ let ToolPipeline = class ToolPipeline {
|
|
|
764
2527
|
toolKey,
|
|
765
2528
|
form: req.form,
|
|
766
2529
|
state: JSON.parse(stateJson),
|
|
2530
|
+
...(req.open !== undefined && { open: req.open }),
|
|
2531
|
+
// kept for the call's result, which a later round writes
|
|
2532
|
+
...((req.review !== undefined || req.blocked !== undefined) && {
|
|
2533
|
+
carried: {
|
|
2534
|
+
...(req.review !== undefined && { review: req.review }),
|
|
2535
|
+
...(req.blocked !== undefined && { blocked: req.blocked }),
|
|
2536
|
+
},
|
|
2537
|
+
}),
|
|
767
2538
|
});
|
|
768
2539
|
return inputWait(q);
|
|
769
2540
|
}
|
|
@@ -772,7 +2543,15 @@ let ToolPipeline = class ToolPipeline {
|
|
|
772
2543
|
* 带 `tools.timeoutMs` 超时与 run 的中止信号(合并后传给处理函数 / 连接器,不响应信号的也按时结束)。
|
|
773
2544
|
* 熔断只作用于连接器工具(键为组织 × 连接器)。
|
|
774
2545
|
*/
|
|
775
|
-
async execute(tool, input, ctx, callId, resume, stepTools
|
|
2546
|
+
async execute(tool, input, ctx, callId, resume, stepTools, reviewed,
|
|
2547
|
+
/** The approved approval of this call, matching its definition and input (builtins only). */
|
|
2548
|
+
approvalId,
|
|
2549
|
+
/** The automatic decision the call runs under instead of an approval (builtins only, R2). */
|
|
2550
|
+
decision,
|
|
2551
|
+
/** The submitted secure input request of this call (builtins only, R4). */
|
|
2552
|
+
secureInputId) {
|
|
2553
|
+
const reviewedWorkingRoot = reviewed?.workingRoot;
|
|
2554
|
+
const reviewedAgainstRoot = reviewed?.against;
|
|
776
2555
|
if (tool.source.kind === "connector") {
|
|
777
2556
|
return this.executeConnector(tool, tool.source, input, ctx, resume);
|
|
778
2557
|
}
|
|
@@ -786,11 +2565,34 @@ let ToolPipeline = class ToolPipeline {
|
|
|
786
2565
|
agentId: ctx.agentId,
|
|
787
2566
|
conversationId: ctx.conversationId,
|
|
788
2567
|
callId,
|
|
2568
|
+
idempotencyKey: toolIdempotencyKey(ctx.conversationId, ctx.runId, callId),
|
|
789
2569
|
...(resume !== undefined && { resume }),
|
|
2570
|
+
// who and where (memory plugin spec §6.2): `accountId` stays the trigger account
|
|
2571
|
+
source: ctx.source,
|
|
2572
|
+
ownerAccountId: ctx.ownerAccountId,
|
|
2573
|
+
role: ctx.role,
|
|
790
2574
|
...(tool.source.kind === "builtin" && stepTools !== undefined && { tools: stepTools }),
|
|
791
|
-
...(tool.source.kind === "builtin" && {
|
|
2575
|
+
...(tool.source.kind === "builtin" && {
|
|
2576
|
+
runId: ctx.runId,
|
|
2577
|
+
executionClaim: currentExecutionClaim(),
|
|
2578
|
+
}),
|
|
792
2579
|
...(tool.source.kind === "builtin" &&
|
|
793
2580
|
ctx.deadline !== undefined && { runDeadline: ctx.deadline }),
|
|
2581
|
+
...(tool.source.kind === "builtin" && approvalId !== undefined && { approvalId }),
|
|
2582
|
+
...(tool.source.kind === "builtin" && decision !== undefined && { decision }),
|
|
2583
|
+
...(tool.source.kind === "builtin" && secureInputId !== undefined && { secureInputId }),
|
|
2584
|
+
// a reviewed call runs in the working root its review judged (project root spec §4.3)
|
|
2585
|
+
...(tool.source.kind === "builtin" &&
|
|
2586
|
+
reviewedWorkingRoot !== undefined && { reviewedWorkingRoot }),
|
|
2587
|
+
// and the root it was judged against, workspace included (B-18, the managed route)
|
|
2588
|
+
...(tool.source.kind === "builtin" &&
|
|
2589
|
+
reviewedAgainstRoot !== undefined && { reviewedAgainstRoot }),
|
|
2590
|
+
...(tool.source.kind === "builtin" &&
|
|
2591
|
+
reviewed?.escalation !== undefined && { sandboxEscalation: reviewed.escalation }),
|
|
2592
|
+
...(tool.source.kind === "builtin" &&
|
|
2593
|
+
reviewed?.escalationRefusal !== undefined && {
|
|
2594
|
+
sandboxEscalationRefusal: reviewed.escalationRefusal,
|
|
2595
|
+
}),
|
|
794
2596
|
// a sub-agent works in its root conversation's sandbox (spec §10.1, at every depth)
|
|
795
2597
|
...(tool.source.kind === "builtin" &&
|
|
796
2598
|
ctx.parent !== undefined && { sandboxConversationId: ctx.parent.rootConversationId }),
|
|
@@ -813,7 +2615,15 @@ let ToolPipeline = class ToolPipeline {
|
|
|
813
2615
|
}),
|
|
814
2616
|
};
|
|
815
2617
|
// 内置工具可按输入给自己的时限(沙箱 bash 按命令超时加余量);缺省 tools.timeoutMs
|
|
816
|
-
const
|
|
2618
|
+
const toolsCfg = this.config.get().tools;
|
|
2619
|
+
const ownMs = tool.timeoutMs?.(input);
|
|
2620
|
+
// an extension tool's declared limit never exceeds the deployment's ceiling
|
|
2621
|
+
const timeoutMs = ownMs === undefined
|
|
2622
|
+
? toolsCfg.timeoutMs
|
|
2623
|
+
: tool.source.kind === "plugin"
|
|
2624
|
+
? Math.min(ownMs, toolsCfg.maxTimeoutMs)
|
|
2625
|
+
: ownMs;
|
|
2626
|
+
let scope;
|
|
817
2627
|
try {
|
|
818
2628
|
// a plugin tool runs with the extension's effective config for the org, never without it
|
|
819
2629
|
// (layering spec A §6): one read per call, cached by EffectiveConfigs
|
|
@@ -832,19 +2642,58 @@ let ToolPipeline = class ToolPipeline {
|
|
|
832
2642
|
}
|
|
833
2643
|
config = { config: effective.config };
|
|
834
2644
|
}
|
|
835
|
-
const r = await this.bounded(ctx.signal, (signal) =>
|
|
2645
|
+
const r = await this.bounded(ctx.signal, async (signal) => {
|
|
2646
|
+
await this.txHost.run(async () => { });
|
|
2647
|
+
signal.throwIfAborted();
|
|
2648
|
+
// the call scope lives on this call's own context object (never a module map)
|
|
2649
|
+
const call = { ...base, ...config, signal };
|
|
2650
|
+
scope = attachCallScope(call, {
|
|
2651
|
+
runId: ctx.runId,
|
|
2652
|
+
step: ctx.step,
|
|
2653
|
+
rootConversationId: ctx.parent?.rootConversationId ?? ctx.conversationId,
|
|
2654
|
+
unattended: ctx.unattended != null,
|
|
2655
|
+
agentVersion: ctx.agentVersion,
|
|
2656
|
+
...(ctx.conversationKind !== undefined && { conversationKind: ctx.conversationKind }),
|
|
2657
|
+
...(ctx.parent !== undefined && {
|
|
2658
|
+
parent: {
|
|
2659
|
+
conversationId: ctx.parent.conversationId,
|
|
2660
|
+
runId: ctx.parent.runId,
|
|
2661
|
+
callId: ctx.parent.callId,
|
|
2662
|
+
...(ctx.parent.budgetRunId !== undefined && {
|
|
2663
|
+
budgetRunId: ctx.parent.budgetRunId,
|
|
2664
|
+
}),
|
|
2665
|
+
},
|
|
2666
|
+
}),
|
|
2667
|
+
});
|
|
2668
|
+
return handler(input, call);
|
|
2669
|
+
}, undefined, timeoutMs);
|
|
836
2670
|
if (r === "timeout") {
|
|
837
|
-
|
|
2671
|
+
const starting = stillStartingUnsent(scope);
|
|
2672
|
+
if (starting)
|
|
2673
|
+
this.deps.log.info("tool call timed out while its device was still starting", {
|
|
2674
|
+
toolKey: tool.key,
|
|
2675
|
+
timeoutMs,
|
|
2676
|
+
});
|
|
2677
|
+
const message = starting
|
|
2678
|
+
? deviceStartingTimeoutText(tool.key, timeoutMs)
|
|
2679
|
+
: timeoutText(tool.key, timeoutMs);
|
|
2680
|
+
return withBlocked({ kind: "error", message }, scope);
|
|
838
2681
|
}
|
|
2682
|
+
// a launch reviewed before the call stopped or asked is kept with its result
|
|
839
2683
|
if (r === "aborted")
|
|
840
|
-
return { kind: "error", message: RUN_STOPPED_DURING_TEXT };
|
|
2684
|
+
return withBlocked({ kind: "error", message: RUN_STOPPED_DURING_TEXT }, scope);
|
|
841
2685
|
if (isInputRequired(r.value)) {
|
|
842
|
-
return {
|
|
2686
|
+
return withBlocked({
|
|
2687
|
+
kind: "input_required",
|
|
2688
|
+
form: r.value.form,
|
|
2689
|
+
state: r.value.state ?? null,
|
|
2690
|
+
...(r.value.open !== undefined && { open: r.value.open }),
|
|
2691
|
+
}, scope);
|
|
843
2692
|
}
|
|
844
|
-
return { kind: "result", result: r.value };
|
|
2693
|
+
return withBlocked({ kind: "result", result: r.value }, scope);
|
|
845
2694
|
}
|
|
846
2695
|
catch (e) {
|
|
847
|
-
return this.thrown(tool.key, e);
|
|
2696
|
+
return withBlocked(this.thrown(tool.key, e), scope);
|
|
848
2697
|
}
|
|
849
2698
|
}
|
|
850
2699
|
async executeConnector(tool, source, input, ctx, resume) {
|
|
@@ -853,7 +2702,7 @@ let ToolPipeline = class ToolPipeline {
|
|
|
853
2702
|
const connectorId = source.connectorId;
|
|
854
2703
|
const app = await db
|
|
855
2704
|
.selectFrom("connectors")
|
|
856
|
-
.select(["name", "connector", "endpoint", "auth", "status"])
|
|
2705
|
+
.select(["name", "slug", "connector", "endpoint", "auth", "status"])
|
|
857
2706
|
.where("id", "=", connectorId)
|
|
858
2707
|
.where("org_id", "=", orgId)
|
|
859
2708
|
.where("deleted_at", "is", null)
|
|
@@ -889,10 +2738,13 @@ let ToolPipeline = class ToolPipeline {
|
|
|
889
2738
|
// 远端在调用途中向用户要输入(MCP elicitation,见 elicitation.ts):需要问用户时中止本次调用、按 input_required
|
|
890
2739
|
// 处理;续跑时用 ctx.resume 的答案答复远端再次发起的同一请求。resources 工具不续跑,一律拒绝。
|
|
891
2740
|
const suspend = new AbortController();
|
|
2741
|
+
// an unattended run in `fail` mode declines every elicitation: no one is there to answer
|
|
2742
|
+
const unattended = unattendedFails(ctx.unattended);
|
|
892
2743
|
const elicit = new ElicitationSession({
|
|
893
2744
|
resume,
|
|
894
2745
|
onSuspend: () => suspend.abort(),
|
|
895
|
-
declineAll: source.resources === true,
|
|
2746
|
+
declineAll: source.resources === true || unattended,
|
|
2747
|
+
...(unattended && { declineNote: UNATTENDED_ELICITATION_NOTE }),
|
|
896
2748
|
});
|
|
897
2749
|
// 远端可能把收到的凭据回显在结果 / 错误 / elicitation 表单里:写入事件之前按本次注入的值打码(见 redact.ts)
|
|
898
2750
|
const clean = (o) => {
|
|
@@ -928,17 +2780,20 @@ let ToolPipeline = class ToolPipeline {
|
|
|
928
2780
|
kind: "connection_required",
|
|
929
2781
|
connectorId,
|
|
930
2782
|
connectorName: app.name,
|
|
2783
|
+
connectorSlug: app.slug,
|
|
931
2784
|
message: personalMissingText(app.name),
|
|
932
2785
|
}
|
|
933
|
-
: { kind: "error", message:
|
|
934
|
-
//
|
|
2786
|
+
: { kind: "error", message: ORG_MISSING_TEXT };
|
|
2787
|
+
// Read the credential once first: a missing one (or a needs_config connector) is settled before
|
|
2788
|
+
// any session opens, without relying on the connector to rethrow CredentialMissing.
|
|
935
2789
|
try {
|
|
936
2790
|
await getAuth();
|
|
937
2791
|
}
|
|
938
2792
|
catch (e) {
|
|
939
2793
|
if (e instanceof CredentialMissing)
|
|
940
2794
|
return missing(e);
|
|
941
|
-
//
|
|
2795
|
+
// the authorization server is briefly unavailable for the token (OAuth): an actionable
|
|
2796
|
+
// message for the model instead of failing the whole turn
|
|
942
2797
|
if (e instanceof ToolError)
|
|
943
2798
|
return { kind: "error", message: e.message };
|
|
944
2799
|
throw e;
|
|
@@ -958,6 +2813,7 @@ let ToolPipeline = class ToolPipeline {
|
|
|
958
2813
|
await credentials.onUnauthorized(orgId, connectorId, auth, ctx.accountId, stale);
|
|
959
2814
|
},
|
|
960
2815
|
signal,
|
|
2816
|
+
orgId,
|
|
961
2817
|
onElicit: elicit.handle,
|
|
962
2818
|
onToolsChanged: () => {
|
|
963
2819
|
try {
|
|
@@ -973,6 +2829,8 @@ let ToolPipeline = class ToolPipeline {
|
|
|
973
2829
|
},
|
|
974
2830
|
});
|
|
975
2831
|
const session = await opened;
|
|
2832
|
+
await this.txHost.run(async () => { });
|
|
2833
|
+
signal.throwIfAborted();
|
|
976
2834
|
return source.resources
|
|
977
2835
|
? runResourceTool(session, source.name, input)
|
|
978
2836
|
: // 交回已复核的定义(connector_tools.spec,含 connectorData):连接器按它路由,远端变化须先经漂移复核
|
|
@@ -1017,6 +2875,9 @@ let ToolPipeline = class ToolPipeline {
|
|
|
1017
2875
|
thrown(key, e) {
|
|
1018
2876
|
if (e instanceof ToolError)
|
|
1019
2877
|
return { kind: "error", message: e.message };
|
|
2878
|
+
// a ctx.deviceAccess refusal the handler let through: its message is actionable English
|
|
2879
|
+
if (e instanceof DeviceAccessError)
|
|
2880
|
+
return { kind: "error", message: e.message };
|
|
1020
2881
|
// an extension tool's ctx.models.embed denied by a policy hook (spec B §5.4): the model sees the
|
|
1021
2882
|
// deny text (sanitized reason), as for a denied tool call, not a generic failure
|
|
1022
2883
|
if (e instanceof ApiError && e.code === "model.hook_denied") {
|
|
@@ -1123,6 +2984,30 @@ let ToolPipeline = class ToolPipeline {
|
|
|
1123
2984
|
}
|
|
1124
2985
|
return { plugin, view: x.view, ...(x.key !== undefined && { key: x.key }) };
|
|
1125
2986
|
}
|
|
2987
|
+
/**
|
|
2988
|
+
* A plugin tool's `InputRequired.open` (display only): `contribution` must be a
|
|
2989
|
+
* `conversation.panel` of the same extension and `item` at most 200 characters; anything else is
|
|
2990
|
+
* dropped with a warning and the form is asked as usual. The plugin is the tool's, never the
|
|
2991
|
+
* extension's word.
|
|
2992
|
+
*/
|
|
2993
|
+
openOf(open, plugin, toolKey) {
|
|
2994
|
+
const x = (typeof open === "object" && open !== null ? open : {});
|
|
2995
|
+
const itemOk = x.item === undefined || (typeof x.item === "string" && x.item !== "" && x.item.length <= 200);
|
|
2996
|
+
if (typeof x.contribution !== "string" ||
|
|
2997
|
+
!this.deps.panels(plugin).has(x.contribution) ||
|
|
2998
|
+
!itemOk) {
|
|
2999
|
+
this.deps.log.warn("tool asked for input with an open target that is not a panel of its extension; dropped", {
|
|
3000
|
+
toolKey,
|
|
3001
|
+
contribution: typeof x.contribution === "string" ? x.contribution.slice(0, 100) : undefined,
|
|
3002
|
+
});
|
|
3003
|
+
return undefined;
|
|
3004
|
+
}
|
|
3005
|
+
return {
|
|
3006
|
+
plugin,
|
|
3007
|
+
contribution: x.contribution,
|
|
3008
|
+
...(x.item !== undefined && { item: x.item }),
|
|
3009
|
+
};
|
|
3010
|
+
}
|
|
1126
3011
|
/**
|
|
1127
3012
|
* A builtin's structured view (`tool_result.view`, display only): checked against
|
|
1128
3013
|
* {@link ToolViewSchema}; an invalid one is dropped with a warning and the result is written as usual.
|
|
@@ -1195,6 +3080,15 @@ let ToolPipeline = class ToolPipeline {
|
|
|
1195
3080
|
__decorate([
|
|
1196
3081
|
Transactional({ propagation: "mandatory" })
|
|
1197
3082
|
], ToolPipeline.prototype, "stopOpenAgentCalls", null);
|
|
3083
|
+
__decorate([
|
|
3084
|
+
Transactional()
|
|
3085
|
+
], ToolPipeline.prototype, "recordAskDecisionIn", null);
|
|
3086
|
+
__decorate([
|
|
3087
|
+
Transactional()
|
|
3088
|
+
], ToolPipeline.prototype, "findPermissionGrant", null);
|
|
3089
|
+
__decorate([
|
|
3090
|
+
Transactional()
|
|
3091
|
+
], ToolPipeline.prototype, "recordPermissionReview", null);
|
|
1198
3092
|
__decorate([
|
|
1199
3093
|
Transactional()
|
|
1200
3094
|
], ToolPipeline.prototype, "writeResultIn", null);
|
|
@@ -1218,6 +3112,28 @@ ToolPipeline = __decorate([
|
|
|
1218
3112
|
__param(15, Inject(OrgToolSwitches)),
|
|
1219
3113
|
__param(16, Inject(TransactionHost)),
|
|
1220
3114
|
__param(17, Optional()),
|
|
1221
|
-
__param(17, Inject(TOOL_PIPELINE_HOOKS))
|
|
3115
|
+
__param(17, Inject(TOOL_PIPELINE_HOOKS)),
|
|
3116
|
+
__param(18, Optional()),
|
|
3117
|
+
__param(18, Inject(NetworkGrants)),
|
|
3118
|
+
__param(19, Optional()),
|
|
3119
|
+
__param(19, Inject(CommandReviewService)),
|
|
3120
|
+
__param(20, Optional()),
|
|
3121
|
+
__param(20, Inject(ConversationDevices)),
|
|
3122
|
+
__param(21, Optional()),
|
|
3123
|
+
__param(21, Inject(SandboxOperationAuthority)),
|
|
3124
|
+
__param(22, Optional()),
|
|
3125
|
+
__param(22, Inject(PermissionCallGrants)),
|
|
3126
|
+
__param(23, Optional()),
|
|
3127
|
+
__param(23, Inject(PermissionAutoGrants)),
|
|
3128
|
+
__param(24, Optional()),
|
|
3129
|
+
__param(24, Inject(PermissionAuthorityLock)),
|
|
3130
|
+
__param(25, Optional()),
|
|
3131
|
+
__param(25, Inject(SandboxService)),
|
|
3132
|
+
__param(26, Optional()),
|
|
3133
|
+
__param(26, Inject(ConversationApprovalProfile)),
|
|
3134
|
+
__param(27, Optional()),
|
|
3135
|
+
__param(27, Inject(ToolAskReview)),
|
|
3136
|
+
__param(28, Optional()),
|
|
3137
|
+
__param(28, Inject(AttachmentsService))
|
|
1222
3138
|
], ToolPipeline);
|
|
1223
3139
|
export { ToolPipeline };
|