@assemblyline-agents/runtime 2.0.0 → 3.0.0
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/LICENSE +1 -1
- package/dist/a2a-client.d.ts +22 -0
- package/dist/a2a-client.d.ts.map +1 -0
- package/dist/a2a-client.js +211 -0
- package/dist/a2a-client.js.map +1 -0
- package/dist/agent-hook-context.d.ts +6 -1
- package/dist/agent-hook-context.d.ts.map +1 -1
- package/dist/agent-hook-context.js +24 -11
- package/dist/agent-hook-context.js.map +1 -1
- package/dist/agent-hook-evaluation.d.ts +6 -1
- package/dist/agent-hook-evaluation.d.ts.map +1 -1
- package/dist/agent-hook-evaluation.js +16 -5
- package/dist/agent-hook-evaluation.js.map +1 -1
- package/dist/agent-hook-run-lifecycle.d.ts +5 -1
- package/dist/agent-hook-run-lifecycle.d.ts.map +1 -1
- package/dist/agent-hook-run-lifecycle.js +11 -13
- package/dist/agent-hook-run-lifecycle.js.map +1 -1
- package/dist/agent-surface.d.ts +32 -0
- package/dist/agent-surface.d.ts.map +1 -0
- package/dist/agent-surface.js +85 -0
- package/dist/agent-surface.js.map +1 -0
- package/dist/attachments.d.ts +5 -1
- package/dist/attachments.d.ts.map +1 -1
- package/dist/attachments.js +58 -32
- package/dist/attachments.js.map +1 -1
- package/dist/audience.d.ts +30 -0
- package/dist/audience.d.ts.map +1 -0
- package/dist/audience.js +68 -0
- package/dist/audience.js.map +1 -0
- package/dist/automation-event-match.d.ts +8 -0
- package/dist/automation-event-match.d.ts.map +1 -0
- package/dist/automation-event-match.js +25 -0
- package/dist/automation-event-match.js.map +1 -0
- package/dist/background-review-trigger.d.ts.map +1 -1
- package/dist/background-review-trigger.js +14 -16
- package/dist/background-review-trigger.js.map +1 -1
- package/dist/background-review-types.d.ts +9 -2
- package/dist/background-review-types.d.ts.map +1 -1
- package/dist/background-review-worker.js +2 -2
- package/dist/background-review-worker.js.map +1 -1
- package/dist/background-review.d.ts.map +1 -1
- package/dist/background-review.js +27 -10
- package/dist/background-review.js.map +1 -1
- package/dist/builtin-tool-executors.d.ts +47 -21
- package/dist/builtin-tool-executors.d.ts.map +1 -1
- package/dist/builtin-tool-executors.js +293 -121
- package/dist/builtin-tool-executors.js.map +1 -1
- package/dist/builtin-tools.d.ts +16 -8
- package/dist/builtin-tools.d.ts.map +1 -1
- package/dist/builtin-tools.js +309 -70
- package/dist/builtin-tools.js.map +1 -1
- package/dist/capability-catalog.d.ts +3 -2
- package/dist/capability-catalog.d.ts.map +1 -1
- package/dist/capability-catalog.js +10 -6
- package/dist/capability-catalog.js.map +1 -1
- package/dist/capability-inspection.d.ts +31 -0
- package/dist/capability-inspection.d.ts.map +1 -0
- package/dist/capability-inspection.js +58 -0
- package/dist/capability-inspection.js.map +1 -0
- package/dist/channel-http-util.d.ts.map +1 -1
- package/dist/channel-http-util.js +6 -2
- package/dist/channel-http-util.js.map +1 -1
- package/dist/channel-ingress.d.ts +16 -1
- package/dist/channel-ingress.d.ts.map +1 -1
- package/dist/channel-ingress.js +117 -7
- package/dist/channel-ingress.js.map +1 -1
- package/dist/channel.d.ts +58 -2
- package/dist/channel.d.ts.map +1 -1
- package/dist/checkpoints.d.ts +1 -1
- package/dist/checkpoints.d.ts.map +1 -1
- package/dist/checkpoints.js +6 -6
- package/dist/checkpoints.js.map +1 -1
- package/dist/child-process-env.d.ts +7 -0
- package/dist/child-process-env.d.ts.map +1 -0
- package/dist/child-process-env.js +41 -0
- package/dist/child-process-env.js.map +1 -0
- package/dist/computer-relay-protocol.d.ts.map +1 -1
- package/dist/computer-relay-protocol.js +4 -4
- package/dist/computer-relay-protocol.js.map +1 -1
- package/dist/concurrency.d.ts +1 -1
- package/dist/concurrency.js +1 -1
- package/dist/connection-auth-util.d.ts +1 -0
- package/dist/connection-auth-util.d.ts.map +1 -1
- package/dist/connection-auth-util.js +1 -1
- package/dist/connection-auth-util.js.map +1 -1
- package/dist/connection-clients.d.ts +11 -3
- package/dist/connection-clients.d.ts.map +1 -1
- package/dist/connection-clients.js +71 -8
- package/dist/connection-clients.js.map +1 -1
- package/dist/connection-event-store.d.ts +98 -0
- package/dist/connection-event-store.d.ts.map +1 -0
- package/dist/connection-event-store.js +162 -0
- package/dist/connection-event-store.js.map +1 -0
- package/dist/connection-events.d.ts +51 -0
- package/dist/connection-events.d.ts.map +1 -0
- package/dist/connection-events.js +343 -0
- package/dist/connection-events.js.map +1 -0
- package/dist/connection-stores.d.ts +3 -0
- package/dist/connection-stores.d.ts.map +1 -1
- package/dist/connection-stores.js +4 -1
- package/dist/connection-stores.js.map +1 -1
- package/dist/connection-util.d.ts +3 -2
- package/dist/connection-util.d.ts.map +1 -1
- package/dist/connection-util.js +18 -1
- package/dist/connection-util.js.map +1 -1
- package/dist/connections.d.ts +54 -5
- package/dist/connections.d.ts.map +1 -1
- package/dist/connections.js +342 -53
- package/dist/connections.js.map +1 -1
- package/dist/context-policy-util.d.ts.map +1 -1
- package/dist/context-policy-util.js +1 -3
- package/dist/context-policy-util.js.map +1 -1
- package/dist/conversation-context.d.ts +6 -2
- package/dist/conversation-context.d.ts.map +1 -1
- package/dist/conversation-context.js +45 -12
- package/dist/conversation-context.js.map +1 -1
- package/dist/conversation-transcript.d.ts +8 -5
- package/dist/conversation-transcript.d.ts.map +1 -1
- package/dist/conversation-transcript.js +24 -5
- package/dist/conversation-transcript.js.map +1 -1
- package/dist/conversation-turn-coalescing.d.ts +22 -0
- package/dist/conversation-turn-coalescing.d.ts.map +1 -0
- package/dist/conversation-turn-coalescing.js +121 -0
- package/dist/conversation-turn-coalescing.js.map +1 -0
- package/dist/conversation-turn-dispatch.d.ts +5 -2
- package/dist/conversation-turn-dispatch.d.ts.map +1 -1
- package/dist/conversation-turn-dispatch.js +59 -22
- package/dist/conversation-turn-dispatch.js.map +1 -1
- package/dist/default-outbound-route.d.ts +29 -0
- package/dist/default-outbound-route.d.ts.map +1 -0
- package/dist/default-outbound-route.js +105 -0
- package/dist/default-outbound-route.js.map +1 -0
- package/dist/delivery-artifacts.d.ts +2 -0
- package/dist/delivery-artifacts.d.ts.map +1 -0
- package/dist/delivery-artifacts.js +34 -0
- package/dist/delivery-artifacts.js.map +1 -0
- package/dist/delivery-files.d.ts +5 -0
- package/dist/delivery-files.d.ts.map +1 -0
- package/dist/delivery-files.js +33 -0
- package/dist/delivery-files.js.map +1 -0
- package/dist/delivery-queue.d.ts +21 -1
- package/dist/delivery-queue.d.ts.map +1 -1
- package/dist/delivery-queue.js +144 -1
- package/dist/delivery-queue.js.map +1 -1
- package/dist/delivery-send.d.ts +2 -2
- package/dist/delivery-send.d.ts.map +1 -1
- package/dist/delivery-send.js +256 -100
- package/dist/delivery-send.js.map +1 -1
- package/dist/durable-files.d.ts +37 -0
- package/dist/durable-files.d.ts.map +1 -0
- package/dist/durable-files.js +63 -0
- package/dist/durable-files.js.map +1 -0
- package/dist/harness-loop.d.ts +6 -1
- package/dist/harness-loop.d.ts.map +1 -1
- package/dist/harness-loop.js +110 -25
- package/dist/harness-loop.js.map +1 -1
- package/dist/heic-transcode-worker.d.ts +2 -0
- package/dist/heic-transcode-worker.d.ts.map +1 -0
- package/dist/heic-transcode-worker.js +59 -0
- package/dist/heic-transcode-worker.js.map +1 -0
- package/dist/heic-transcode.d.ts +18 -0
- package/dist/heic-transcode.d.ts.map +1 -0
- package/dist/heic-transcode.js +99 -0
- package/dist/heic-transcode.js.map +1 -0
- package/dist/human-input-routing.d.ts +22 -0
- package/dist/human-input-routing.d.ts.map +1 -0
- package/dist/human-input-routing.js +26 -0
- package/dist/human-input-routing.js.map +1 -0
- package/dist/in-memory-conversation-turn-store.d.ts +3 -1
- package/dist/in-memory-conversation-turn-store.d.ts.map +1 -1
- package/dist/in-memory-conversation-turn-store.js +41 -2
- package/dist/in-memory-conversation-turn-store.js.map +1 -1
- package/dist/in-memory-run-store.d.ts +8 -0
- package/dist/in-memory-run-store.d.ts.map +1 -1
- package/dist/in-memory-run-store.js +28 -5
- package/dist/in-memory-run-store.js.map +1 -1
- package/dist/in-memory-sandbox-session-store.d.ts +2 -1
- package/dist/in-memory-sandbox-session-store.d.ts.map +1 -1
- package/dist/in-memory-sandbox-session-store.js +65 -1
- package/dist/in-memory-sandbox-session-store.js.map +1 -1
- package/dist/in-memory-small-stores.d.ts +18 -1
- package/dist/in-memory-small-stores.d.ts.map +1 -1
- package/dist/in-memory-small-stores.js +107 -1
- package/dist/in-memory-small-stores.js.map +1 -1
- package/dist/in-memory-workspace-store.d.ts +40 -0
- package/dist/in-memory-workspace-store.d.ts.map +1 -0
- package/dist/in-memory-workspace-store.js +370 -0
- package/dist/in-memory-workspace-store.js.map +1 -0
- package/dist/index.d.ts +73 -36
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +390 -258
- package/dist/index.js.map +1 -1
- package/dist/json-util.d.ts +8 -0
- package/dist/json-util.d.ts.map +1 -1
- package/dist/json-util.js +8 -0
- package/dist/json-util.js.map +1 -1
- package/dist/local-sandbox.d.ts +3 -2
- package/dist/local-sandbox.d.ts.map +1 -1
- package/dist/local-sandbox.js +69 -25
- package/dist/local-sandbox.js.map +1 -1
- package/dist/mcp-client.d.ts.map +1 -1
- package/dist/mcp-client.js +3 -2
- package/dist/mcp-client.js.map +1 -1
- package/dist/media-processor.d.ts +42 -0
- package/dist/media-processor.d.ts.map +1 -0
- package/dist/media-processor.js +2 -0
- package/dist/media-processor.js.map +1 -0
- package/dist/model-media.d.ts +13 -1
- package/dist/model-media.d.ts.map +1 -1
- package/dist/model-media.js +81 -18
- package/dist/model-media.js.map +1 -1
- package/dist/model-visible-interrupts.d.ts +10 -0
- package/dist/model-visible-interrupts.d.ts.map +1 -0
- package/dist/model-visible-interrupts.js +41 -0
- package/dist/model-visible-interrupts.js.map +1 -0
- package/dist/operator-controls.d.ts.map +1 -1
- package/dist/operator-controls.js +16 -3
- package/dist/operator-controls.js.map +1 -1
- package/dist/outbound-http-policy.d.ts +7 -0
- package/dist/outbound-http-policy.d.ts.map +1 -0
- package/dist/outbound-http-policy.js +155 -0
- package/dist/outbound-http-policy.js.map +1 -0
- package/dist/public-api.d.ts +21 -0
- package/dist/public-api.d.ts.map +1 -0
- package/dist/public-api.js +19 -0
- package/dist/public-api.js.map +1 -0
- package/dist/replay-resume.d.ts +8 -0
- package/dist/replay-resume.d.ts.map +1 -1
- package/dist/replay-resume.js +141 -11
- package/dist/replay-resume.js.map +1 -1
- package/dist/resource-projection-util.d.ts +1 -1
- package/dist/resource-projection-util.d.ts.map +1 -1
- package/dist/resource-projection-util.js +21 -10
- package/dist/resource-projection-util.js.map +1 -1
- package/dist/resource-projection.d.ts +8 -1
- package/dist/resource-projection.d.ts.map +1 -1
- package/dist/resource-projection.js +229 -29
- package/dist/resource-projection.js.map +1 -1
- package/dist/run-heartbeat.d.ts +12 -2
- package/dist/run-heartbeat.d.ts.map +1 -1
- package/dist/run-heartbeat.js +31 -4
- package/dist/run-heartbeat.js.map +1 -1
- package/dist/run-outcome.d.ts +9 -5
- package/dist/run-outcome.d.ts.map +1 -1
- package/dist/run-outcome.js +14 -5
- package/dist/run-outcome.js.map +1 -1
- package/dist/run-recovery.d.ts +19 -3
- package/dist/run-recovery.d.ts.map +1 -1
- package/dist/run-recovery.js +205 -34
- package/dist/run-recovery.js.map +1 -1
- package/dist/run-replay.d.ts +35 -0
- package/dist/run-replay.d.ts.map +1 -0
- package/dist/run-replay.js +193 -0
- package/dist/run-replay.js.map +1 -0
- package/dist/run-result.d.ts +4 -0
- package/dist/run-result.d.ts.map +1 -0
- package/dist/run-result.js +18 -0
- package/dist/run-result.js.map +1 -0
- package/dist/run-timeline-query.d.ts +38 -0
- package/dist/run-timeline-query.d.ts.map +1 -0
- package/dist/run-timeline-query.js +99 -0
- package/dist/run-timeline-query.js.map +1 -0
- package/dist/runs-query.d.ts.map +1 -1
- package/dist/runs-query.js +11 -3
- package/dist/runs-query.js.map +1 -1
- package/dist/runtime-bundle.d.ts.map +1 -1
- package/dist/runtime-bundle.js +2 -0
- package/dist/runtime-bundle.js.map +1 -1
- package/dist/runtime-learning.d.ts +15 -13
- package/dist/runtime-learning.d.ts.map +1 -1
- package/dist/runtime-learning.js +79 -58
- package/dist/runtime-learning.js.map +1 -1
- package/dist/runtime-types.d.ts +68 -9
- package/dist/runtime-types.d.ts.map +1 -1
- package/dist/sandbox-fs.d.ts +8 -5
- package/dist/sandbox-fs.d.ts.map +1 -1
- package/dist/sandbox-fs.js +30 -31
- package/dist/sandbox-fs.js.map +1 -1
- package/dist/sandbox-handle.d.ts +25 -0
- package/dist/sandbox-handle.d.ts.map +1 -0
- package/dist/sandbox-handle.js +120 -0
- package/dist/sandbox-handle.js.map +1 -0
- package/dist/sandbox-session-identity.d.ts +14 -0
- package/dist/sandbox-session-identity.d.ts.map +1 -0
- package/dist/sandbox-session-identity.js +33 -0
- package/dist/sandbox-session-identity.js.map +1 -0
- package/dist/sandbox-session-key.d.ts.map +1 -1
- package/dist/sandbox-session-key.js +12 -9
- package/dist/sandbox-session-key.js.map +1 -1
- package/dist/sandbox-session-lifecycle.d.ts.map +1 -1
- package/dist/sandbox-session-lifecycle.js +187 -44
- package/dist/sandbox-session-lifecycle.js.map +1 -1
- package/dist/sandbox-snapshot-policy.js +3 -3
- package/dist/sandbox-snapshot-policy.js.map +1 -1
- package/dist/sandbox-state-sync.d.ts +4 -2
- package/dist/sandbox-state-sync.d.ts.map +1 -1
- package/dist/sandbox-state-sync.js +47 -15
- package/dist/sandbox-state-sync.js.map +1 -1
- package/dist/sandbox-sync-worker.d.ts +11 -2
- package/dist/sandbox-sync-worker.d.ts.map +1 -1
- package/dist/sandbox-sync-worker.js +143 -31
- package/dist/sandbox-sync-worker.js.map +1 -1
- package/dist/schedule-execution.d.ts.map +1 -1
- package/dist/schedule-execution.js +127 -23
- package/dist/schedule-execution.js.map +1 -1
- package/dist/sdk-api-client.d.ts +17 -0
- package/dist/sdk-api-client.d.ts.map +1 -0
- package/dist/sdk-api-client.js +55 -0
- package/dist/sdk-api-client.js.map +1 -0
- package/dist/security.js +2 -2
- package/dist/security.js.map +1 -1
- package/dist/self-improvement.d.ts +5 -1
- package/dist/self-improvement.d.ts.map +1 -1
- package/dist/self-improvement.js +28 -14
- package/dist/self-improvement.js.map +1 -1
- package/dist/skill-bundles.d.ts +55 -0
- package/dist/skill-bundles.d.ts.map +1 -0
- package/dist/skill-bundles.js +134 -0
- package/dist/skill-bundles.js.map +1 -0
- package/dist/source-loader.js +7 -7
- package/dist/source-loader.js.map +1 -1
- package/dist/state-store-helpers.d.ts +2 -0
- package/dist/state-store-helpers.d.ts.map +1 -1
- package/dist/state-store-helpers.js +11 -1
- package/dist/state-store-helpers.js.map +1 -1
- package/dist/state-stores.d.ts +1 -0
- package/dist/state-stores.d.ts.map +1 -1
- package/dist/state-stores.js +26 -7
- package/dist/state-stores.js.map +1 -1
- package/dist/state.d.ts +305 -5
- package/dist/state.d.ts.map +1 -1
- package/dist/state.js +41 -2
- package/dist/state.js.map +1 -1
- package/dist/storage.d.ts +47 -2
- package/dist/storage.d.ts.map +1 -1
- package/dist/storage.js +158 -6
- package/dist/storage.js.map +1 -1
- package/dist/subagent-execution.d.ts +1 -1
- package/dist/subagent-execution.d.ts.map +1 -1
- package/dist/subagent-execution.js +10 -12
- package/dist/subagent-execution.js.map +1 -1
- package/dist/target-instructions.js +1 -1
- package/dist/target-instructions.js.map +1 -1
- package/dist/tool-apis.d.ts.map +1 -1
- package/dist/tool-apis.js +33 -9
- package/dist/tool-apis.js.map +1 -1
- package/dist/tool-execution.d.ts +22 -12
- package/dist/tool-execution.d.ts.map +1 -1
- package/dist/tool-execution.js +368 -238
- package/dist/tool-execution.js.map +1 -1
- package/dist/turn-media.d.ts +29 -0
- package/dist/turn-media.d.ts.map +1 -0
- package/dist/turn-media.js +233 -0
- package/dist/turn-media.js.map +1 -0
- package/dist/usage-reconciliation.d.ts +1 -1
- package/dist/usage-reconciliation.js +1 -1
- package/dist/workspace-id.d.ts +10 -0
- package/dist/workspace-id.d.ts.map +1 -0
- package/dist/workspace-id.js +55 -0
- package/dist/workspace-id.js.map +1 -0
- package/dist/workspace-manifest.d.ts +24 -0
- package/dist/workspace-manifest.d.ts.map +1 -0
- package/dist/workspace-manifest.js +111 -0
- package/dist/workspace-manifest.js.map +1 -0
- package/dist/workspace-operation-limiter.d.ts +16 -0
- package/dist/workspace-operation-limiter.d.ts.map +1 -0
- package/dist/workspace-operation-limiter.js +31 -0
- package/dist/workspace-operation-limiter.js.map +1 -0
- package/dist/workspace-operations.d.ts +145 -0
- package/dist/workspace-operations.d.ts.map +1 -0
- package/dist/workspace-operations.js +420 -0
- package/dist/workspace-operations.js.map +1 -0
- package/dist/workspace-runtime.d.ts +110 -0
- package/dist/workspace-runtime.d.ts.map +1 -0
- package/dist/workspace-runtime.js +240 -0
- package/dist/workspace-runtime.js.map +1 -0
- package/dist/workspace-search.d.ts +55 -0
- package/dist/workspace-search.d.ts.map +1 -0
- package/dist/workspace-search.js +262 -0
- package/dist/workspace-search.js.map +1 -0
- package/dist/workspace-service.d.ts +173 -0
- package/dist/workspace-service.d.ts.map +1 -0
- package/dist/workspace-service.js +619 -0
- package/dist/workspace-service.js.map +1 -0
- package/dist/workspace.d.ts +7 -0
- package/dist/workspace.d.ts.map +1 -0
- package/dist/workspace.js +7 -0
- package/dist/workspace.js.map +1 -0
- package/package.json +7 -4
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"builtin-tool-executors.d.ts","sourceRoot":"","sources":["../src/builtin-tool-executors.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;
|
|
1
|
+
{"version":3,"file":"builtin-tool-executors.d.ts","sourceRoot":"","sources":["../src/builtin-tool-executors.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AAiB1E,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAChD,OAAO,EAIL,yBAAyB,EACzB,KA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E,MAAM,CAAC;IAClB,sBAAsB,CAAC,EAAE,MAAM,CAAC;CACjC,CAAC,CAgFD"}
|
|
@@ -1,38 +1,71 @@
|
|
|
1
|
-
import { isConnectionAuthorizationRequiredError, shellQuote } from "@assemblyline-agents/core";
|
|
2
|
-
import {
|
|
1
|
+
import { isConnectionAuthorizationRequiredError, isRecoverableToolError, shellQuote } from "@assemblyline-agents/core";
|
|
2
|
+
import { HISTORY_SEARCH_TOOL_NAME, LOAD_SKILL_TOOL_NAME, PAIR_TOOL_NAME, runtimeToolsForSurface, TOOL_SEARCH_TOOL_NAME } from "./builtin-tools.js";
|
|
3
3
|
import { connectionSearchResultForModel, normalizeDeferredToolSearchInput } from "./capability-catalog.js";
|
|
4
|
-
import { CONNECTION_SEARCH_TOOL_NAME, parseQualifiedName, RuntimeConnectionRegistry } from "./connections.js";
|
|
4
|
+
import { CONNECTION_SEARCH_TOOL_NAME, isConnectionConfigurationError, parseQualifiedName, RuntimeConnectionRegistry } from "./connections.js";
|
|
5
5
|
import { evalRunOptionsForRun } from "./eval-run-options.js";
|
|
6
|
-
import { isJsonObject, redactedToolInput, safeJson } from "./json-util.js";
|
|
7
|
-
import {
|
|
8
|
-
import { skillNameFromSkillPath } from "./resource-projection-util.js";
|
|
6
|
+
import { isJsonObject, previewString, redactedToolInput, safeJson } from "./json-util.js";
|
|
7
|
+
import { normalizeResourcePath, skillNameFromSkillPath } from "./resource-projection-util.js";
|
|
9
8
|
import { normalizeConnectionApproval, stringValue } from "./runtime-util.js";
|
|
9
|
+
import { audienceFromRun, principalKey } from "./audience.js";
|
|
10
|
+
import { applyCoreToolPolicy } from "./security.js";
|
|
10
11
|
import { parseSkillBody } from "./self-improvement.js";
|
|
11
12
|
import { initiatorFromRun, principalFromRun } from "./principals.js";
|
|
13
|
+
import { authorizationRequiredModelOutput } from "./model-visible-interrupts.js";
|
|
12
14
|
/**
|
|
13
15
|
* Runtime-handled tool executors: the builtin skill/discovery tools
|
|
14
|
-
* (load_skill
|
|
15
|
-
*
|
|
16
|
-
*
|
|
16
|
+
* (load_skill and tool_search), the deferred tool catalog, the tool-call
|
|
17
|
+
* bookkeeping those paths share, and the connection tool executors together
|
|
18
|
+
* with the connection-registry factories they run against.
|
|
17
19
|
* None of these route through an authored tool definition, so their records
|
|
18
20
|
* are written here rather than by executeToolWithRecord in
|
|
19
21
|
* ./tool-execution.js. Imports only the {@link ToolExecutionHost} type from
|
|
20
22
|
* ./tool-execution.js, so the value-level module graph stays acyclic.
|
|
21
23
|
*/
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
24
|
+
/** Cap on inventory entries returned by load_skill; the full tree stays reachable via list/grep. */
|
|
25
|
+
const LOAD_SKILL_RESOURCE_INVENTORY_LIMIT = 150;
|
|
26
|
+
export async function skillLoadDetailsImpl(host, run, skillName) {
|
|
27
|
+
await host.ensureSkillsSeeded(run);
|
|
28
|
+
const skill = await host.skillStore.get(host.skillScopeForRun(run), skillName);
|
|
25
29
|
if (!skill || skill.pending || skill.archived)
|
|
26
30
|
throw new Error(`Skill not found: ${skillName}`);
|
|
27
31
|
const parsed = parseSkillBody(skill.body);
|
|
28
|
-
|
|
32
|
+
const surfacePath = host.surfaceForRun(run).path;
|
|
33
|
+
const entryPath = host.skillBundleIndex.entrypointPathForSkill(skill.name, surfacePath);
|
|
34
|
+
const bundle = host.skillBundleIndex.bundleForSkill(skill.name, surfacePath);
|
|
35
|
+
const closure = host.skillBundleIndex
|
|
36
|
+
.resourceClosureForSkill(skill.name, surfacePath)
|
|
37
|
+
.filter((resource) => resource.runtimePath !== entryPath);
|
|
38
|
+
const details = {
|
|
29
39
|
name: skill.name,
|
|
30
40
|
description: parsed.description || `Skill ${skill.name}`,
|
|
31
41
|
declaredTools: parsed.allowedTools,
|
|
32
42
|
instructions: parsed.instructions,
|
|
33
43
|
origin: skill.origin,
|
|
34
|
-
path:
|
|
44
|
+
path: entryPath,
|
|
45
|
+
resources: closure
|
|
46
|
+
.slice(0, LOAD_SKILL_RESOURCE_INVENTORY_LIMIT)
|
|
47
|
+
.map((resource) => ({ path: resource.runtimePath, size: resource.size, contentType: resource.contentType })),
|
|
48
|
+
resourceCount: closure.length,
|
|
49
|
+
resourceBytes: closure.reduce((total, resource) => total + resource.size, 0)
|
|
35
50
|
};
|
|
51
|
+
if (bundle) {
|
|
52
|
+
details.bundle = {
|
|
53
|
+
id: bundle.id,
|
|
54
|
+
kind: bundle.kind,
|
|
55
|
+
...(bundle.plugin ? { plugin: { name: bundle.plugin.name, ...(bundle.plugin.version ? { version: bundle.plugin.version } : {}) } } : {})
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
return details;
|
|
59
|
+
}
|
|
60
|
+
/** Resolve a load_skill `path` input: canonical entrypoint paths first, then the legacy shapes. */
|
|
61
|
+
function skillNameFromLoadInput(host, requested) {
|
|
62
|
+
try {
|
|
63
|
+
return host.skillBundleIndex.skillNameForEntrypointPath(normalizeResourcePath(requested))
|
|
64
|
+
?? skillNameFromSkillPath(requested);
|
|
65
|
+
}
|
|
66
|
+
catch {
|
|
67
|
+
return skillNameFromSkillPath(requested);
|
|
68
|
+
}
|
|
36
69
|
}
|
|
37
70
|
export function createConnectionRegistryImpl(host, channel, turn) {
|
|
38
71
|
const session = { channel };
|
|
@@ -51,6 +84,8 @@ export function createConnectionRegistryImpl(host, channel, turn) {
|
|
|
51
84
|
env: host.env,
|
|
52
85
|
fetch: host.fetch,
|
|
53
86
|
session,
|
|
87
|
+
audience: turn?.audience ?? { private: true },
|
|
88
|
+
agentId: host.manifest.agent.id ?? host.manifest.agentRevision,
|
|
54
89
|
grantStore: host.connectionGrantStore,
|
|
55
90
|
authorizationSessionStore: host.connectionAuthorizationSessionStore,
|
|
56
91
|
...(host.connectionCallbackBaseUrl ? { callbackBaseUrl: host.connectionCallbackBaseUrl } : {}),
|
|
@@ -73,20 +108,20 @@ export function createConnectionRegistryForRunImpl(host, run, fallbackChannel, s
|
|
|
73
108
|
session.principal = principal;
|
|
74
109
|
if (initiator)
|
|
75
110
|
session.initiator = initiator;
|
|
76
|
-
const
|
|
77
|
-
const subagentConnectionNames =
|
|
78
|
-
? new Set(host.manifest.subagents.find((subagent) => subagent.name === subagentName)?.connections ?? [])
|
|
79
|
-
: undefined;
|
|
111
|
+
const surface = host.surfaceForRun(run);
|
|
112
|
+
const subagentConnectionNames = surface.path !== "root" ? new Set(surface.connections) : undefined;
|
|
80
113
|
const scopedConnectionNames = selectedConnections && subagentConnectionNames
|
|
81
114
|
? new Set([...selectedConnections].filter((name) => subagentConnectionNames.has(name)))
|
|
82
115
|
: selectedConnections ?? subagentConnectionNames;
|
|
83
116
|
return new RuntimeConnectionRegistry({
|
|
84
|
-
connections: scopedConnectionNames
|
|
117
|
+
connections: (scopedConnectionNames
|
|
85
118
|
? host.mergedConnections().filter((connection) => scopedConnectionNames.has(connection.name))
|
|
86
|
-
: host.mergedConnections(),
|
|
119
|
+
: host.mergedConnections()),
|
|
87
120
|
env: host.env,
|
|
88
121
|
fetch: host.fetch,
|
|
89
122
|
session,
|
|
123
|
+
audience: audienceFromRun(run),
|
|
124
|
+
agentId: host.manifest.agent.id ?? host.manifest.agentRevision,
|
|
90
125
|
grantStore: host.connectionGrantStore,
|
|
91
126
|
authorizationSessionStore: host.connectionAuthorizationSessionStore,
|
|
92
127
|
...(host.connectionCallbackBaseUrl ? { callbackBaseUrl: host.connectionCallbackBaseUrl } : {}),
|
|
@@ -131,6 +166,7 @@ export async function beginConnectionAuthorizationImpl(host, connectionName, ses
|
|
|
131
166
|
env: host.env,
|
|
132
167
|
fetch: host.fetch,
|
|
133
168
|
session: resolverSession,
|
|
169
|
+
agentId: host.manifest.agent.id ?? host.manifest.agentRevision,
|
|
134
170
|
grantStore: host.connectionGrantStore,
|
|
135
171
|
authorizationSessionStore: host.connectionAuthorizationSessionStore,
|
|
136
172
|
...(host.connectionCallbackBaseUrl ? { callbackBaseUrl: host.connectionCallbackBaseUrl } : {}),
|
|
@@ -144,6 +180,7 @@ export function createConnectionRegistryForSessionImpl(host, session) {
|
|
|
144
180
|
env: host.env,
|
|
145
181
|
fetch: host.fetch,
|
|
146
182
|
session: session.session,
|
|
183
|
+
agentId: host.manifest.agent.id ?? host.manifest.agentRevision,
|
|
147
184
|
grantStore: host.connectionGrantStore,
|
|
148
185
|
authorizationSessionStore: host.connectionAuthorizationSessionStore,
|
|
149
186
|
...(host.connectionCallbackBaseUrl ? { callbackBaseUrl: host.connectionCallbackBaseUrl } : {}),
|
|
@@ -153,7 +190,9 @@ export function createConnectionRegistryForSessionImpl(host, session) {
|
|
|
153
190
|
export async function executeLoadSkillTool(host, run, state, input, idempotencyKey) {
|
|
154
191
|
const raw = isJsonObject(input) ? input : {};
|
|
155
192
|
const requested = stringValue(raw.name) || stringValue(raw.skillName) || stringValue(raw.path);
|
|
156
|
-
const skillName = requested
|
|
193
|
+
const skillName = requested
|
|
194
|
+
? skillNameFromLoadInput(host, requested) ?? requested
|
|
195
|
+
: "";
|
|
157
196
|
const toolCall = await recordRuntimeHandledToolStart(host, run, LOAD_SKILL_TOOL_NAME, input, idempotencyKey);
|
|
158
197
|
try {
|
|
159
198
|
if (!skillName)
|
|
@@ -161,7 +200,7 @@ export async function executeLoadSkillTool(host, run, state, input, idempotencyK
|
|
|
161
200
|
if (!state.allowedSkills.has(skillName)) {
|
|
162
201
|
throw new Error(`Skill ${skillName} is not enabled by the current agent capability snapshot.`);
|
|
163
202
|
}
|
|
164
|
-
const loaded = await skillLoadDetailsImpl(host, skillName);
|
|
203
|
+
const loaded = await skillLoadDetailsImpl(host, run, skillName);
|
|
165
204
|
let sandboxProjected = false;
|
|
166
205
|
const activeSandbox = state.sandboxHandle.current();
|
|
167
206
|
if (activeSandbox) {
|
|
@@ -187,24 +226,109 @@ export async function executeLoadSkillTool(host, run, state, input, idempotencyK
|
|
|
187
226
|
};
|
|
188
227
|
if (loaded.declaredTools.length > 0)
|
|
189
228
|
output.declaredTools = loaded.declaredTools;
|
|
229
|
+
if (loaded.bundle)
|
|
230
|
+
output.bundle = safeJson(loaded.bundle);
|
|
231
|
+
if (loaded.resourceCount > 0) {
|
|
232
|
+
output.resources = loaded.resources.map((resource) => safeJson(resource));
|
|
233
|
+
output.resourceCount = loaded.resourceCount;
|
|
234
|
+
output.resourceBytes = loaded.resourceBytes;
|
|
235
|
+
if (loaded.resourceCount > loaded.resources.length) {
|
|
236
|
+
output.resourceInventoryTruncated = true;
|
|
237
|
+
}
|
|
238
|
+
}
|
|
190
239
|
await completeRuntimeHandledTool(host, run, toolCall, LOAD_SKILL_TOOL_NAME, output);
|
|
191
240
|
await host.state.appendEvent(run.id, "skill.loaded", {
|
|
192
241
|
skill: loaded.name,
|
|
193
242
|
origin: loaded.origin,
|
|
194
243
|
path: loaded.path,
|
|
244
|
+
...(loaded.bundle ? { bundle: loaded.bundle.id } : {}),
|
|
245
|
+
resourceCount: loaded.resourceCount,
|
|
195
246
|
sandboxProjected
|
|
196
247
|
});
|
|
197
248
|
return { run: await host.state.getRun(run.id) ?? run, modelOutput: output, skillName: loaded.name };
|
|
198
249
|
}
|
|
199
250
|
catch (error) {
|
|
200
|
-
return failRuntimeHandledTool(host, run, toolCall, LOAD_SKILL_TOOL_NAME, error
|
|
251
|
+
return failRuntimeHandledTool(host, run, toolCall, LOAD_SKILL_TOOL_NAME, error);
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
export async function executeHistorySearchTool(host, run, input, idempotencyKey) {
|
|
255
|
+
const raw = isJsonObject(input) ? input : {};
|
|
256
|
+
const query = stringValue(raw.query);
|
|
257
|
+
const scope = stringValue(raw.scope) || "current_conversation";
|
|
258
|
+
const rawLimit = typeof raw.limit === "number" && Number.isFinite(raw.limit) ? Math.floor(raw.limit) : 8;
|
|
259
|
+
const limit = Math.min(50, Math.max(1, rawLimit));
|
|
260
|
+
const toolCall = await recordRuntimeHandledToolStart(host, run, HISTORY_SEARCH_TOOL_NAME, input, idempotencyKey);
|
|
261
|
+
try {
|
|
262
|
+
if (!query)
|
|
263
|
+
throw new Error("history_search requires query.");
|
|
264
|
+
if (!["current_conversation", "current_channel", "my_conversations"].includes(scope)) {
|
|
265
|
+
throw new Error(`Unsupported history_search scope: ${scope}`);
|
|
266
|
+
}
|
|
267
|
+
const search = {
|
|
268
|
+
agentScope: host.memoryScopeForRun(run).agentScope,
|
|
269
|
+
query,
|
|
270
|
+
limit
|
|
271
|
+
};
|
|
272
|
+
if (scope === "current_conversation") {
|
|
273
|
+
const conversationId = stringValue(run.input.conversationId);
|
|
274
|
+
if (!conversationId)
|
|
275
|
+
throw new Error("history_search current_conversation requires an active conversation.");
|
|
276
|
+
search.conversationId = conversationId;
|
|
277
|
+
}
|
|
278
|
+
else if (scope === "current_channel") {
|
|
279
|
+
const metadata = isJsonObject(run.input.metadata) ? run.input.metadata : {};
|
|
280
|
+
const source = isJsonObject(metadata.source) ? metadata.source : undefined;
|
|
281
|
+
const provider = stringValue(source?.provider);
|
|
282
|
+
const workspaceId = stringValue(source?.workspaceId);
|
|
283
|
+
const channelId = stringValue(source?.channelId);
|
|
284
|
+
if (!provider || !workspaceId || !channelId) {
|
|
285
|
+
throw new Error("history_search current_channel is unavailable because this turn has no attributed channel scope.");
|
|
286
|
+
}
|
|
287
|
+
const channel = stringValue(run.input.channel);
|
|
288
|
+
if (channel)
|
|
289
|
+
search.channel = channel;
|
|
290
|
+
search.source = { provider, workspaceId, channelId };
|
|
291
|
+
}
|
|
292
|
+
else {
|
|
293
|
+
if (!audienceFromRun(run).private) {
|
|
294
|
+
throw new Error("history_search my_conversations is unavailable in a shared conversation.");
|
|
295
|
+
}
|
|
296
|
+
const principal = principalFromRun(run);
|
|
297
|
+
const subject = principal ? principalKey(principal) : stringValue(run.input.userId);
|
|
298
|
+
if (!subject)
|
|
299
|
+
throw new Error("history_search my_conversations requires an authenticated conversation subject.");
|
|
300
|
+
search.subject = subject;
|
|
301
|
+
}
|
|
302
|
+
const results = await host.state.searchMessages(search);
|
|
303
|
+
const output = {
|
|
304
|
+
query,
|
|
305
|
+
scope,
|
|
306
|
+
matches: results.map((result) => {
|
|
307
|
+
const contentSource = isJsonObject(result.message.content.source) ? result.message.content.source : undefined;
|
|
308
|
+
const conversationSource = isJsonObject(result.conversationMetadata.source) ? result.conversationMetadata.source : undefined;
|
|
309
|
+
return {
|
|
310
|
+
messageId: result.message.id,
|
|
311
|
+
conversationId: result.message.conversationId,
|
|
312
|
+
role: result.message.role,
|
|
313
|
+
text: previewString(stringValue(result.message.content.text), 1_200),
|
|
314
|
+
createdAt: result.message.createdAt,
|
|
315
|
+
score: result.score,
|
|
316
|
+
source: safeJson(contentSource ?? conversationSource ?? {})
|
|
317
|
+
};
|
|
318
|
+
})
|
|
319
|
+
};
|
|
320
|
+
await completeRuntimeHandledTool(host, run, toolCall, HISTORY_SEARCH_TOOL_NAME, output);
|
|
321
|
+
return { run: await host.state.getRun(run.id) ?? run, modelOutput: output };
|
|
322
|
+
}
|
|
323
|
+
catch (error) {
|
|
324
|
+
return failRuntimeHandledTool(host, run, toolCall, HISTORY_SEARCH_TOOL_NAME, error);
|
|
201
325
|
}
|
|
202
326
|
}
|
|
203
327
|
export async function executeToolSearchTool(host, run, state, input, idempotencyKey) {
|
|
204
328
|
const request = normalizeDeferredToolSearchInput(input);
|
|
205
329
|
const toolCall = await recordRuntimeHandledToolStart(host, run, TOOL_SEARCH_TOOL_NAME, input, idempotencyKey);
|
|
206
330
|
try {
|
|
207
|
-
const local =
|
|
331
|
+
const local = searchDeferredTools(host, run, request.query, request.limit);
|
|
208
332
|
const connectionResults = state.connectionRegistry.hasLiveConnections()
|
|
209
333
|
? await state.connectionRegistry.search({
|
|
210
334
|
keywords: request.query,
|
|
@@ -238,10 +362,18 @@ export async function executeToolSearchTool(host, run, state, input, idempotency
|
|
|
238
362
|
if (result.outputSchema)
|
|
239
363
|
metadata.outputSchema = result.outputSchema;
|
|
240
364
|
state.discoveredConnectionTools.set(result.qualifiedName, metadata);
|
|
365
|
+
state.activeToolNames.add(result.qualifiedName);
|
|
241
366
|
}
|
|
367
|
+
for (const tool of local)
|
|
368
|
+
state.activeToolNames.add(tool.name);
|
|
369
|
+
const activated = [
|
|
370
|
+
...local.map((tool) => tool.name),
|
|
371
|
+
...actionableConnectionMatches.flatMap((result) => result.qualifiedName ? [result.qualifiedName] : [])
|
|
372
|
+
];
|
|
242
373
|
const output = {
|
|
243
374
|
query: request.query,
|
|
244
|
-
totalAvailable:
|
|
375
|
+
totalAvailable: deferredTools(host, run).length + connectionMatches.length,
|
|
376
|
+
activated,
|
|
245
377
|
matches: [
|
|
246
378
|
...local.map((tool) => ({
|
|
247
379
|
name: tool.name,
|
|
@@ -263,77 +395,20 @@ export async function executeToolSearchTool(host, run, state, input, idempotency
|
|
|
263
395
|
return { run: await host.state.getRun(run.id) ?? run, modelOutput: output };
|
|
264
396
|
}
|
|
265
397
|
catch (error) {
|
|
266
|
-
return failRuntimeHandledTool(host, run, toolCall, TOOL_SEARCH_TOOL_NAME, error
|
|
398
|
+
return failRuntimeHandledTool(host, run, toolCall, TOOL_SEARCH_TOOL_NAME, error);
|
|
267
399
|
}
|
|
268
400
|
}
|
|
269
|
-
export
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
const local = deferredLocalTools(host).find((tool) => tool.name === name);
|
|
277
|
-
if (local) {
|
|
278
|
-
const definition = await host.loadTool(local);
|
|
279
|
-
const output = {
|
|
280
|
-
name: local.name,
|
|
281
|
-
kind: "tool",
|
|
282
|
-
description: definition.description ?? local.description,
|
|
283
|
-
inputSchema: safeJson(definition.inputSchema ?? local.inputSchema),
|
|
284
|
-
outputSchema: safeJson(definition.outputSchema ?? local.outputSchema ?? {})
|
|
285
|
-
};
|
|
286
|
-
await completeRuntimeHandledTool(host, run, toolCall, TOOL_DESCRIBE_TOOL_NAME, output);
|
|
287
|
-
return { run: await host.state.getRun(run.id) ?? run, modelOutput: output };
|
|
288
|
-
}
|
|
289
|
-
let connection = state.discoveredConnectionTools.get(name);
|
|
290
|
-
if (!connection && parseQualifiedName(name) && state.connectionRegistry.hasLiveConnections()) {
|
|
291
|
-
const parsed = parseQualifiedName(name);
|
|
292
|
-
const results = parsed
|
|
293
|
-
? await state.connectionRegistry.search({ keywords: parsed.toolName, connection: parsed.connectionName, limit: 10 }, {
|
|
294
|
-
runId: run.id,
|
|
295
|
-
toolCallId: toolCall.id,
|
|
296
|
-
toolName: TOOL_DESCRIBE_TOOL_NAME
|
|
297
|
-
})
|
|
298
|
-
: [];
|
|
299
|
-
const result = results.find((candidate) => candidate.qualifiedName === name);
|
|
300
|
-
if (result?.qualifiedName && result.tool && result.inputSchema) {
|
|
301
|
-
connection = {
|
|
302
|
-
connection: result.connection,
|
|
303
|
-
name: result.tool,
|
|
304
|
-
qualifiedName: result.qualifiedName,
|
|
305
|
-
description: result.description,
|
|
306
|
-
inputSchema: result.inputSchema,
|
|
307
|
-
...(result.outputSchema ? { outputSchema: result.outputSchema } : {})
|
|
308
|
-
};
|
|
309
|
-
state.discoveredConnectionTools.set(name, connection);
|
|
310
|
-
}
|
|
311
|
-
}
|
|
312
|
-
if (!connection)
|
|
313
|
-
throw new Error(`Deferred tool not found: ${name}`);
|
|
314
|
-
const output = {
|
|
315
|
-
name: connection.qualifiedName,
|
|
316
|
-
kind: "connection_tool",
|
|
317
|
-
connection: connection.connection,
|
|
318
|
-
description: connection.description,
|
|
319
|
-
inputSchema: safeJson(connection.inputSchema),
|
|
320
|
-
outputSchema: safeJson(connection.outputSchema ?? {})
|
|
321
|
-
};
|
|
322
|
-
await completeRuntimeHandledTool(host, run, toolCall, TOOL_DESCRIBE_TOOL_NAME, output);
|
|
323
|
-
return { run: await host.state.getRun(run.id) ?? run, modelOutput: output };
|
|
324
|
-
}
|
|
325
|
-
catch (error) {
|
|
326
|
-
return failRuntimeHandledTool(host, run, toolCall, TOOL_DESCRIBE_TOOL_NAME, error, { recoverable: true });
|
|
327
|
-
}
|
|
328
|
-
}
|
|
329
|
-
export function deferredLocalTools(host) {
|
|
330
|
-
return runtimeToolsForManifest(host.manifest)
|
|
331
|
-
.filter((tool) => !CORE_HARNESS_TOOL_NAMES.includes(tool.name))
|
|
332
|
-
.filter((tool) => tool.visibility !== "hidden");
|
|
401
|
+
export function deferredTools(host, run) {
|
|
402
|
+
return runtimeToolsForSurface(host.surfaceForRun(run).tools)
|
|
403
|
+
.filter((tool) => tool.visibility === "deferred")
|
|
404
|
+
.flatMap((tool) => {
|
|
405
|
+
const policyTool = applyCoreToolPolicy(tool, host.coreToolPolicy);
|
|
406
|
+
return policyTool ? [policyTool] : [];
|
|
407
|
+
});
|
|
333
408
|
}
|
|
334
|
-
|
|
409
|
+
function searchDeferredTools(host, run, query, limit) {
|
|
335
410
|
const lower = query.toLowerCase();
|
|
336
|
-
return
|
|
411
|
+
return deferredTools(host, run)
|
|
337
412
|
.map((tool) => ({
|
|
338
413
|
tool,
|
|
339
414
|
haystack: [
|
|
@@ -348,13 +423,14 @@ async function searchDeferredLocalTools(host, query, limit) {
|
|
|
348
423
|
.map((entry) => entry.tool)
|
|
349
424
|
.slice(0, limit);
|
|
350
425
|
}
|
|
351
|
-
async function recordRuntimeHandledToolStart(host, run, toolName, input, idempotencyKey) {
|
|
426
|
+
export async function recordRuntimeHandledToolStart(host, run, toolName, input, idempotencyKey) {
|
|
352
427
|
await host.state.appendEvent(run.id, "tool.call_requested", { toolName, input: redactedToolInput(input) });
|
|
353
428
|
let toolCall = await host.state.createToolCall({
|
|
354
429
|
runId: run.id,
|
|
355
430
|
toolName,
|
|
356
431
|
status: "requested",
|
|
357
|
-
|
|
432
|
+
// Raw, not redacted: resume paths re-execute persisted tool-call input.
|
|
433
|
+
input: safeJson(input),
|
|
358
434
|
idempotencyKey
|
|
359
435
|
});
|
|
360
436
|
toolCall = await host.state.updateToolCall(toolCall.id, { status: "running" });
|
|
@@ -373,21 +449,86 @@ async function completeRuntimeHandledTool(host, run, toolCall, toolName, output)
|
|
|
373
449
|
modelOutput: safeJson(output)
|
|
374
450
|
});
|
|
375
451
|
}
|
|
452
|
+
/**
|
|
453
|
+
* Finalize a durably recordable model-invoked tool failure. Tool failures are
|
|
454
|
+
* model results, not run failures; callers only throw when durable state cannot
|
|
455
|
+
* be written and continuing would therefore be unsafe.
|
|
456
|
+
*/
|
|
376
457
|
export async function failRuntimeHandledTool(host, run, toolCall, toolName, error, options) {
|
|
377
458
|
const message = error instanceof Error ? error.message : String(error);
|
|
459
|
+
const failureKind = options?.failureKind
|
|
460
|
+
?? (isRecoverableToolError(error) ? "invalid_input" : "execution_error");
|
|
461
|
+
const modelOutput = {
|
|
462
|
+
error: message,
|
|
463
|
+
failure: {
|
|
464
|
+
kind: failureKind,
|
|
465
|
+
runCanContinue: true
|
|
466
|
+
}
|
|
467
|
+
};
|
|
378
468
|
await host.state.updateToolCall(toolCall.id, { status: "failed", error: message });
|
|
379
|
-
await host.state.appendEvent(run.id, "tool.execution_failed", {
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
// over rather than irreversibly failing the whole run.
|
|
383
|
-
return { run, modelOutput: { error: message } };
|
|
384
|
-
}
|
|
385
|
-
const failedRun = await failRun({ state: host.state }, run.id, {
|
|
386
|
-
reason: "tool.execution_failed",
|
|
469
|
+
await host.state.appendEvent(run.id, "tool.execution_failed", {
|
|
470
|
+
toolCallId: toolCall.id,
|
|
471
|
+
toolName,
|
|
387
472
|
error: message,
|
|
388
|
-
|
|
473
|
+
failureKind,
|
|
474
|
+
recoverable: true
|
|
389
475
|
});
|
|
390
|
-
return { run:
|
|
476
|
+
return { run: await host.state.getRun(run.id) ?? run, modelOutput };
|
|
477
|
+
}
|
|
478
|
+
/** Event appended whenever a pair call cannot proceed for a connection. */
|
|
479
|
+
export const CONNECTION_PAIRING_UNAVAILABLE_EVENT = "connection.pairing_unavailable";
|
|
480
|
+
/**
|
|
481
|
+
* The core `pair` tool: redeem a user-pasted one-time binding packet against a
|
|
482
|
+
* live connection, host-side. Unlike the synthetic `<connection>__pair`
|
|
483
|
+
* discovery tool this executor never requires prior discovery, and when no
|
|
484
|
+
* connection can pair it reports the per-connection resolve failures instead
|
|
485
|
+
* of a generic "not exposed" dead end. Errors are recoverable: the model
|
|
486
|
+
* relays the cause to the user rather than failing the run.
|
|
487
|
+
*/
|
|
488
|
+
export async function executePairTool(host, run, registry, input, idempotencyKey) {
|
|
489
|
+
const toolCall = await recordRuntimeHandledToolStart(host, run, PAIR_TOOL_NAME, input, idempotencyKey);
|
|
490
|
+
try {
|
|
491
|
+
const raw = isJsonObject(input) ? input : {};
|
|
492
|
+
const secret = typeof raw.secret === "string" ? raw.secret.trim() : "";
|
|
493
|
+
const requested = typeof raw.connection === "string" ? raw.connection.trim() : "";
|
|
494
|
+
if (!secret)
|
|
495
|
+
throw new Error("pair requires the full pasted packet or claim code as `secret`.");
|
|
496
|
+
const status = await registry.pairingStatus();
|
|
497
|
+
const target = requested || (status.pairable.length === 1 ? status.pairable[0] : "");
|
|
498
|
+
if (!target) {
|
|
499
|
+
if (status.pairable.length > 1) {
|
|
500
|
+
throw new Error(`Multiple connections support pairing (${status.pairable.join(", ")}); pass the intended one as \`connection\`.`);
|
|
501
|
+
}
|
|
502
|
+
throw await pairingUnavailableError(host, run, status.unavailable);
|
|
503
|
+
}
|
|
504
|
+
if (!status.pairable.includes(target)) {
|
|
505
|
+
const failure = status.unavailable.find((item) => item.connection === target);
|
|
506
|
+
if (failure)
|
|
507
|
+
throw await pairingUnavailableError(host, run, [failure]);
|
|
508
|
+
}
|
|
509
|
+
// Redemption re-validates the target (registered, private-surface access,
|
|
510
|
+
// pairing support) and reports the precise refusal to the model.
|
|
511
|
+
const result = await registry.redeemPairingCode(target, secret);
|
|
512
|
+
const output = { connected: true, connection: result.connection, message: result.message };
|
|
513
|
+
await completeRuntimeHandledTool(host, run, toolCall, PAIR_TOOL_NAME, output);
|
|
514
|
+
return { run: await host.state.getRun(run.id) ?? run, modelOutput: output };
|
|
515
|
+
}
|
|
516
|
+
catch (error) {
|
|
517
|
+
return failRuntimeHandledTool(host, run, toolCall, PAIR_TOOL_NAME, error);
|
|
518
|
+
}
|
|
519
|
+
}
|
|
520
|
+
// Persist why pairing is impossible before the error reaches the model, so an
|
|
521
|
+
// operator can see the cause in the event log even if the conversation moves on.
|
|
522
|
+
async function pairingUnavailableError(host, run, unavailable) {
|
|
523
|
+
for (const item of unavailable) {
|
|
524
|
+
await host.state.appendEvent(run.id, CONNECTION_PAIRING_UNAVAILABLE_EVENT, {
|
|
525
|
+
connection: item.connection,
|
|
526
|
+
reason: item.reason
|
|
527
|
+
});
|
|
528
|
+
}
|
|
529
|
+
if (unavailable.length === 0)
|
|
530
|
+
return new Error("No live connection supports pairing.");
|
|
531
|
+
return new Error(`No connection can pair right now: ${unavailable.map((item) => `${item.connection}: ${item.reason}`).join("; ")}`);
|
|
391
532
|
}
|
|
392
533
|
export async function executeConnectionSearchTool(host, run, registry, input, idempotencyKey) {
|
|
393
534
|
await host.state.appendEvent(run.id, "tool.call_requested", { toolName: CONNECTION_SEARCH_TOOL_NAME, input: redactedToolInput(input) });
|
|
@@ -395,7 +536,8 @@ export async function executeConnectionSearchTool(host, run, registry, input, id
|
|
|
395
536
|
runId: run.id,
|
|
396
537
|
toolName: CONNECTION_SEARCH_TOOL_NAME,
|
|
397
538
|
status: "requested",
|
|
398
|
-
|
|
539
|
+
// Raw, not redacted: resume paths re-execute persisted tool-call input.
|
|
540
|
+
input: safeJson(input),
|
|
399
541
|
idempotencyKey
|
|
400
542
|
});
|
|
401
543
|
await host.state.updateToolCall(toolCall.id, { status: "running" });
|
|
@@ -430,17 +572,24 @@ export async function executeConnectionSearchTool(host, run, registry, input, id
|
|
|
430
572
|
// Recoverable: model-invoked discovery, so return the error, don't fail the run.
|
|
431
573
|
const message = error instanceof Error ? error.message : String(error);
|
|
432
574
|
await host.state.updateToolCall(toolCall.id, { status: "failed", error: message });
|
|
433
|
-
await host.state.appendEvent(run.id, "tool.execution_failed", {
|
|
575
|
+
await host.state.appendEvent(run.id, "tool.execution_failed", {
|
|
576
|
+
toolCallId: toolCall.id,
|
|
577
|
+
toolName: CONNECTION_SEARCH_TOOL_NAME,
|
|
578
|
+
error: message,
|
|
579
|
+
failureKind: "execution_error",
|
|
580
|
+
recoverable: true
|
|
581
|
+
});
|
|
434
582
|
return { run: await host.state.getRun(run.id) ?? run, results: [{ connection: "connection_search", description: "Connection search failed.", error: message }] };
|
|
435
583
|
}
|
|
436
584
|
}
|
|
437
|
-
export async function executeConnectionTool(host, run, registry, toolName, input, approved, idempotencyKey) {
|
|
585
|
+
export async function executeConnectionTool(host, run, registry, toolName, input, approved, idempotencyKey, authorizationBehavior = "pause") {
|
|
438
586
|
await host.state.appendEvent(run.id, "tool.call_requested", { toolName, input: redactedToolInput(input) });
|
|
439
587
|
let toolCall = await host.state.createToolCall({
|
|
440
588
|
runId: run.id,
|
|
441
589
|
toolName,
|
|
442
590
|
status: "requested",
|
|
443
|
-
|
|
591
|
+
// Raw, not redacted: connection-auth resume re-executes this input.
|
|
592
|
+
input: safeJson(input),
|
|
444
593
|
idempotencyKey
|
|
445
594
|
});
|
|
446
595
|
const parsed = parseQualifiedName(toolName);
|
|
@@ -461,7 +610,7 @@ export async function executeConnectionTool(host, run, registry, toolName, input
|
|
|
461
610
|
toolName,
|
|
462
611
|
source: "eval"
|
|
463
612
|
});
|
|
464
|
-
return executeConnectionToolWithRecordImpl(host, run, registry, toolName, toolCall, input);
|
|
613
|
+
return executeConnectionToolWithRecordImpl(host, run, registry, toolName, toolCall, input, authorizationBehavior);
|
|
465
614
|
}
|
|
466
615
|
if (approval.mode !== "never" && !approved) {
|
|
467
616
|
toolCall = await host.state.updateToolCall(toolCall.id, { status: "waiting_for_approval" });
|
|
@@ -478,9 +627,9 @@ export async function executeConnectionTool(host, run, registry, toolName, input
|
|
|
478
627
|
});
|
|
479
628
|
return { run: waitingRun, waitingForApproval: true, toolCallId: toolCall.id, toolName };
|
|
480
629
|
}
|
|
481
|
-
return executeConnectionToolWithRecordImpl(host, run, registry, toolName, toolCall, input);
|
|
630
|
+
return executeConnectionToolWithRecordImpl(host, run, registry, toolName, toolCall, input, authorizationBehavior);
|
|
482
631
|
}
|
|
483
|
-
export async function executeConnectionToolWithRecordImpl(host, run, registry, toolName, toolCall, input) {
|
|
632
|
+
export async function executeConnectionToolWithRecordImpl(host, run, registry, toolName, toolCall, input, authorizationBehavior = "pause") {
|
|
484
633
|
await host.state.updateToolCall(toolCall.id, { status: "running" });
|
|
485
634
|
await host.state.appendEvent(run.id, "tool.execution_started", { toolCallId: toolCall.id, toolName });
|
|
486
635
|
try {
|
|
@@ -508,9 +657,13 @@ export async function executeConnectionToolWithRecordImpl(host, run, registry, t
|
|
|
508
657
|
}
|
|
509
658
|
catch (error) {
|
|
510
659
|
if (isConnectionAuthorizationRequiredError(error)) {
|
|
511
|
-
await host.state.updateToolCall(toolCall.id, { status: "failed", error: error.message });
|
|
512
|
-
const waitingRun = await host.state.updateRun(run.id, { status: "waiting_for_connection" });
|
|
513
660
|
const authorizationSessionId = isJsonObject(error.challenge) && typeof error.challenge.sessionId === "string" ? error.challenge.sessionId : undefined;
|
|
661
|
+
const modelOutput = authorizationRequiredModelOutput(error);
|
|
662
|
+
await host.state.updateToolCall(toolCall.id, {
|
|
663
|
+
status: "failed",
|
|
664
|
+
error: error.message,
|
|
665
|
+
modelOutput
|
|
666
|
+
});
|
|
514
667
|
await host.state.appendEvent(run.id, "authorization.required", {
|
|
515
668
|
toolCallId: toolCall.id,
|
|
516
669
|
toolName,
|
|
@@ -518,20 +671,39 @@ export async function executeConnectionToolWithRecordImpl(host, run, registry, t
|
|
|
518
671
|
reason: error.reason,
|
|
519
672
|
challenge: safeJson(error.challenge ?? {})
|
|
520
673
|
});
|
|
674
|
+
if (authorizationBehavior === "return") {
|
|
675
|
+
await host.state.appendEvent(run.id, "authorization.returned_to_model", {
|
|
676
|
+
toolCallId: toolCall.id,
|
|
677
|
+
toolName,
|
|
678
|
+
connectionName: error.connectionName,
|
|
679
|
+
recoverable: true
|
|
680
|
+
});
|
|
681
|
+
return {
|
|
682
|
+
run: await host.state.getRun(run.id) ?? run,
|
|
683
|
+
modelOutput,
|
|
684
|
+
toolCallId: toolCall.id,
|
|
685
|
+
toolName
|
|
686
|
+
};
|
|
687
|
+
}
|
|
688
|
+
const waitingRun = await host.state.updateRun(run.id, { status: "waiting_for_connection" });
|
|
521
689
|
const out = { run: waitingRun, waitingForConnection: true, toolCallId: toolCall.id, toolName };
|
|
522
690
|
if (authorizationSessionId)
|
|
523
691
|
out.authorizationSessionId = authorizationSessionId;
|
|
524
692
|
return out;
|
|
525
693
|
}
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
error:
|
|
532
|
-
data: { toolCallId: toolCall.id, toolName }
|
|
694
|
+
// Every connection failure that reached a model-invoked tool boundary is
|
|
695
|
+
// returned through the normal result channel. The model may correct its
|
|
696
|
+
// arguments, choose another connection, or explain configuration trouble
|
|
697
|
+
// to the user. Authorization remains the explicit pause path above.
|
|
698
|
+
const failure = await failRuntimeHandledTool(host, run, toolCall, toolName, error, {
|
|
699
|
+
failureKind: isConnectionConfigurationError(error) ? "configuration_error" : "execution_error"
|
|
533
700
|
});
|
|
534
|
-
return {
|
|
701
|
+
return {
|
|
702
|
+
run: failure.run,
|
|
703
|
+
modelOutput: failure.modelOutput,
|
|
704
|
+
toolCallId: toolCall.id,
|
|
705
|
+
toolName
|
|
706
|
+
};
|
|
535
707
|
}
|
|
536
708
|
}
|
|
537
709
|
//# sourceMappingURL=builtin-tool-executors.js.map
|