eve 0.50.0 → 0.51.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/CHANGELOG.md +18 -0
- package/dist/src/acp/adapter.js +1 -1
- package/dist/src/channel/types.d.ts +12 -19
- package/dist/src/chunks/{use-eve-agent-DUMU6dap.js → use-eve-agent-B4xN7-fK.js} +4 -4
- package/dist/src/chunks/{use-eve-agent-B5I-k6Ek.js → use-eve-agent-C3vUG5g2.js} +4 -4
- package/dist/src/cli/acp/command.d.ts +1 -1
- package/dist/src/cli/acp/command.js +2 -2
- package/dist/src/cli/agent-command.d.ts +5 -0
- package/dist/src/cli/agent-command.js +1 -0
- package/dist/src/cli/application-command.d.ts +2 -0
- package/dist/src/cli/commands/build.d.ts +1 -1
- package/dist/src/cli/commands/build.js +1 -1
- package/dist/src/cli/commands/deploy.d.ts +2 -0
- package/dist/src/cli/commands/deploy.js +1 -1
- package/dist/src/cli/commands/init-agent-workspace.d.ts +14 -0
- package/dist/src/cli/commands/init-agent-workspace.js +1 -0
- package/dist/src/cli/commands/init-repl.js +1 -1
- package/dist/src/cli/commands/init.d.ts +2 -13
- package/dist/src/cli/commands/init.js +1 -1
- package/dist/src/cli/commands/integration-connect.js +1 -1
- package/dist/src/cli/commands/link.d.ts +2 -0
- package/dist/src/cli/commands/link.js +1 -1
- package/dist/src/cli/commands/preconditions.d.ts +15 -0
- package/dist/src/cli/commands/preconditions.js +1 -1
- package/dist/src/cli/commands/register-integration-commands.d.ts +1 -1
- package/dist/src/cli/commands/register-integration-commands.js +1 -1
- package/dist/src/cli/commands/register-registry-commands.js +2 -2
- package/dist/src/cli/commands/registry.js +1 -1
- package/dist/src/cli/dev/environment.d.ts +1 -1
- package/dist/src/cli/dev/environment.js +1 -1
- package/dist/src/cli/dev/local-server-process.js +1 -1
- package/dist/src/cli/dev/tui/runner.js +1 -1
- package/dist/src/cli/invoke/command.d.ts +1 -1
- package/dist/src/cli/invoke/command.js +1 -1
- package/dist/src/cli/option-parsers.d.ts +1 -0
- package/dist/src/cli/option-parsers.js +1 -1
- package/dist/src/cli/run.js +3 -3
- package/dist/src/client/agent-info-schema.d.ts +0 -1
- package/dist/src/client/agent-info-schema.js +1 -1
- package/dist/src/client/message-action-parts.js +1 -1
- package/dist/src/compiled/.vendor-stamp.json +1 -1
- package/dist/src/compiler/extension-compatibility.d.ts +18 -18
- package/dist/src/compiler/extension-compatibility.js +1 -1
- package/dist/src/compiler/manifest.js +1 -1
- package/dist/src/compiler/normalize-agent-config.js +1 -1
- package/dist/src/compiler/normalize-manifest-helpers.js +1 -1
- package/dist/src/compiler/normalize-manifest.js +1 -1
- package/dist/src/context/build-dynamic-tools.js +1 -1
- package/dist/src/context/dynamic-subagent-lifecycle.js +1 -1
- package/dist/src/context/dynamic-tool-lifecycle.js +1 -1
- package/dist/src/context/dynamic-tool-metadata.d.ts +1 -0
- package/dist/src/context/keys.d.ts +0 -3
- package/dist/src/context/keys.js +1 -1
- package/dist/src/discover/project.js +1 -1
- package/dist/src/evals/cli/eval.js +1 -1
- package/dist/src/evals/mock-model.js +1 -1
- package/dist/src/eve-channel/index.js +1 -1
- package/dist/src/execution/activity-work-id.js +1 -1
- package/dist/src/execution/cancel-descendant-turns-step.js +1 -1
- package/dist/src/execution/channel-context.js +1 -1
- package/dist/src/execution/coordination-dispatch-shared.d.ts +103 -0
- package/dist/src/execution/coordination-dispatch-shared.js +1 -0
- package/dist/src/execution/coordination-dispatch-step.d.ts +7 -0
- package/dist/src/execution/coordination-dispatch-step.js +1 -0
- package/dist/src/execution/create-session-step.d.ts +1 -2
- package/dist/src/execution/create-session-step.js +1 -1
- package/dist/src/execution/deliver-payloads.js +1 -1
- package/dist/src/execution/dispatch-action-failures.d.ts +5 -5
- package/dist/src/execution/dispatch-action-failures.js +1 -1
- package/dist/src/execution/dispatch-start-operation.d.ts +1 -1
- package/dist/src/execution/dispatch-start-operation.js +1 -1
- package/dist/src/execution/durable-session-store.d.ts +1 -1
- package/dist/src/execution/eve-workflow-attributes.d.ts +1 -1
- package/dist/src/execution/inline-turn.js +1 -1
- package/dist/src/execution/next-driver-action.d.ts +7 -10
- package/dist/src/execution/node-step.d.ts +1 -2
- package/dist/src/execution/node-step.js +1 -1
- package/dist/src/execution/pending-turn-state.d.ts +1 -2
- package/dist/src/execution/pending-turn-state.js +1 -1
- package/dist/src/execution/proxied-deliver-step.js +1 -1
- package/dist/src/execution/route-child-delivery.js +1 -1
- package/dist/src/execution/runtime-context.js +1 -1
- package/dist/src/execution/session-command-inbox.d.ts +2 -3
- package/dist/src/execution/session.d.ts +1 -1
- package/dist/src/execution/session.js +2 -2
- package/dist/src/execution/settle-cancelled-turn-step.d.ts +1 -1
- package/dist/src/execution/settle-cancelled-turn-step.js +1 -1
- package/dist/src/execution/stable-workflow-names.d.ts +1 -1
- package/dist/src/execution/stable-workflow-names.js +1 -1
- package/dist/src/execution/task-event-callback.js +1 -1
- package/dist/src/execution/tasks/child/steps.d.ts +18 -18
- package/dist/src/execution/tasks/child/steps.js +1 -1
- package/dist/src/execution/tasks/child/update-step.d.ts +6 -0
- package/dist/src/execution/tasks/child/update-step.js +1 -0
- package/dist/src/execution/tasks/child/update.d.ts +7 -10
- package/dist/src/execution/tasks/child/update.js +1 -1
- package/dist/src/execution/tasks/child/workflow.d.ts +21 -29
- package/dist/src/execution/tasks/child/workflow.js +1 -1
- package/dist/src/execution/tasks/parent/control-shared.d.ts +6 -17
- package/dist/src/execution/tasks/parent/control-shared.js +1 -1
- package/dist/src/execution/tasks/parent/delegate.d.ts +15 -50
- package/dist/src/execution/tasks/parent/delegate.js +1 -1
- package/dist/src/execution/tasks/parent/dispatch.d.ts +19 -34
- package/dist/src/execution/tasks/parent/dispatch.js +1 -1
- package/dist/src/execution/tasks/parent/hitl-proxy-steps.d.ts +5 -15
- package/dist/src/execution/tasks/parent/hitl-proxy-steps.js +1 -1
- package/dist/src/execution/tasks/parent/run-parent.d.ts +2 -2
- package/dist/src/execution/tasks/parent/task-cancel.d.ts +11 -0
- package/dist/src/execution/tasks/parent/task-cancel.js +1 -0
- package/dist/src/execution/tasks/parent/tool-execution.d.ts +2 -3
- package/dist/src/execution/tasks/parent/tool-execution.js +1 -1
- package/dist/src/execution/terminate-child-sessions-step.js +1 -1
- package/dist/src/execution/tools/subagent/accept-event-step.d.ts +7 -0
- package/dist/src/execution/tools/subagent/accept-event-step.js +1 -0
- package/dist/src/execution/tools/subagent/emit-called-step.d.ts +9 -0
- package/dist/src/execution/tools/subagent/emit-called-step.js +1 -0
- package/dist/src/execution/tools/subagent/invoke-agent.d.ts +51 -0
- package/dist/src/execution/tools/subagent/invoke-agent.js +1 -0
- package/dist/src/execution/tools/subagent/invoke-preparation.d.ts +37 -0
- package/dist/src/execution/tools/subagent/invoke-preparation.js +1 -0
- package/dist/src/execution/tools/subagent/invoke-step.d.ts +55 -0
- package/dist/src/execution/tools/subagent/invoke-step.js +1 -0
- package/dist/src/execution/tools/subagent/receipt-identity.d.ts +11 -0
- package/dist/src/execution/tools/subagent/receipt-identity.js +1 -0
- package/dist/src/execution/{dispatch-runtime-actions-start.d.ts → tools/subagent/start.d.ts} +17 -5
- package/dist/src/execution/tools/subagent/start.js +1 -0
- package/dist/src/execution/tools/subagent/task-agent-requests.d.ts +24 -0
- package/dist/src/execution/tools/subagent/task-agent-requests.js +1 -0
- package/dist/src/execution/tools/subagent/task-cancel.d.ts +10 -0
- package/dist/src/execution/tools/subagent/task-cancel.js +1 -0
- package/dist/src/execution/tools/tasks.d.ts +10 -0
- package/dist/src/execution/tools/tasks.js +1 -0
- package/dist/src/execution/{tool-run → tools/workflow}/answer.d.ts +1 -1
- package/dist/src/execution/tools/workflow/answer.js +1 -0
- package/dist/src/execution/tools/workflow/ask.d.ts +22 -0
- package/dist/src/execution/tools/workflow/ask.js +1 -0
- package/dist/src/execution/tools/workflow/background.d.ts +18 -0
- package/dist/src/execution/tools/workflow/background.js +1 -0
- package/dist/src/execution/tools/workflow/body.d.ts +25 -0
- package/dist/src/execution/tools/workflow/body.js +1 -0
- package/dist/src/execution/tools/workflow/cancel.d.ts +11 -0
- package/dist/src/execution/tools/workflow/cancel.js +1 -0
- package/dist/src/execution/tools/workflow/emit-workflow-tool-run-report-step.d.ts +7 -0
- package/dist/src/execution/tools/workflow/emit-workflow-tool-run-report-step.js +1 -0
- package/dist/src/execution/tools/workflow/messages.d.ts +88 -0
- package/dist/src/execution/tools/workflow/messages.js +1 -0
- package/dist/src/execution/tools/workflow/owner-inbox.d.ts +13 -0
- package/dist/src/execution/tools/workflow/owner-inbox.js +1 -0
- package/dist/src/execution/tools/workflow/owner.d.ts +13 -0
- package/dist/src/execution/tools/workflow/owner.js +1 -0
- package/dist/src/execution/tools/workflow/run-control.d.ts +18 -0
- package/dist/src/execution/tools/workflow/run-control.js +1 -0
- package/dist/src/execution/tools/workflow/start.d.ts +33 -0
- package/dist/src/execution/tools/workflow/start.js +1 -0
- package/dist/src/execution/tools/workflow/types.d.ts +26 -0
- package/dist/src/execution/tools/workflow/types.js +1 -0
- package/dist/src/execution/tools/workflow/workflow.d.ts +3 -0
- package/dist/src/execution/tools/workflow/workflow.js +1 -0
- package/dist/src/execution/turn-workflow-tool-run.d.ts +16 -0
- package/dist/src/execution/turn-workflow-tool-run.js +1 -0
- package/dist/src/execution/turn-workflow.js +1 -1
- package/dist/src/execution/wire/session-inbox-contract.d.ts +2 -2
- package/dist/src/execution/wire/session-inbox-contract.js +1 -1
- package/dist/src/execution/wire/session-inbox-encoder.d.ts +6 -2
- package/dist/src/execution/wire/session-inbox-encoder.js +1 -1
- package/dist/src/execution/wire/session-inbox-wire.d.ts +3 -3
- package/dist/src/execution/wire/session-inbox-wire.js +1 -1
- package/dist/src/execution/wire/session-inbox-wire.v1.js +1 -1
- package/dist/src/execution/wire/session-inbox-wire.v4.d.ts +267 -0
- package/dist/src/execution/wire/session-inbox-wire.v4.js +1 -0
- package/dist/src/execution/wire/session-inbox-wire.v4.migration.d.ts +3 -0
- package/dist/src/execution/wire/session-inbox-wire.v4.migration.js +1 -0
- package/dist/src/execution/workflow-entry-finalization.d.ts +6 -0
- package/dist/src/execution/workflow-entry-finalization.js +1 -1
- package/dist/src/execution/workflow-entry.d.ts +2 -1
- package/dist/src/execution/workflow-entry.js +1 -1
- package/dist/src/execution/workflow-runtime.d.ts +1 -1
- package/dist/src/execution/workflow-runtime.js +1 -1
- package/dist/src/execution/workflow-steps.js +1 -1
- package/dist/src/framework/sources/registry.js +1 -1
- package/dist/src/harness/advertised-tools.d.ts +1 -7
- package/dist/src/harness/advertised-tools.js +1 -1
- package/dist/src/harness/background-tools.d.ts +8 -2
- package/dist/src/harness/{runtime-actions.d.ts → coordination.d.ts} +40 -27
- package/dist/src/harness/coordination.js +1 -0
- package/dist/src/harness/emission.d.ts +9 -2
- package/dist/src/harness/emission.js +1 -1
- package/dist/src/harness/execute-tool.d.ts +52 -0
- package/dist/src/harness/hitl/session-limit-input-requests.js +1 -1
- package/dist/src/harness/input-requests.js +1 -1
- package/dist/src/harness/proxy-input-requests.d.ts +6 -2
- package/dist/src/harness/stale-input-responses.js +1 -1
- package/dist/src/harness/step-hooks.d.ts +1 -2
- package/dist/src/harness/step-hooks.js +1 -1
- package/dist/src/harness/tool-call-action.js +1 -1
- package/dist/src/harness/tool-call-input-errors.js +1 -1
- package/dist/src/harness/tool-loop.js +2 -2
- package/dist/src/harness/tools.js +1 -1
- package/dist/src/harness/turn-tag-state.d.ts +3 -1
- package/dist/src/harness/types.d.ts +4 -7
- package/dist/src/harness/workflow-interrupt-state.js +1 -1
- package/dist/src/harness/workflow-lifecycle.d.ts +10 -0
- package/dist/src/harness/workflow-lifecycle.js +1 -1
- package/dist/src/harness/workflow-sandbox.d.ts +1 -1
- package/dist/src/harness/workflow-sandbox.js +2 -2
- package/dist/src/harness/workflow-subagent-limit.d.ts +7 -7
- package/dist/src/harness/workflow-subagent-limit.js +1 -1
- package/dist/src/harness/workflow-task-state.d.ts +9 -0
- package/dist/src/harness/workflow-task-state.js +1 -0
- package/dist/src/harness/workflow-tool-runs.d.ts +27 -0
- package/dist/src/harness/workflow-tool-runs.js +1 -0
- package/dist/src/instrumentation/native-events.js +1 -1
- package/dist/src/instrumentation/parent-lineage.js +1 -1
- package/dist/src/internal/agent-name.d.ts +4 -0
- package/dist/src/internal/agent-name.js +1 -0
- package/dist/src/internal/agent-workspace.d.ts +15 -0
- package/dist/src/internal/agent-workspace.js +1 -0
- package/dist/src/internal/application/package.js +1 -1
- package/dist/src/internal/authored-definition/core.js +1 -1
- package/dist/src/internal/nitro/host/build-application.js +1 -1
- package/dist/src/internal/nitro/host/start-development-server.js +1 -1
- package/dist/src/internal/nitro/host/start-production-server.js +3 -3
- package/dist/src/internal/nitro/routes/runtime-stack.js +1 -1
- package/dist/src/internal/project-context.d.ts +26 -0
- package/dist/src/internal/project-context.js +1 -0
- package/dist/src/internal/vercel/assemble-eve-services.d.ts +17 -0
- package/dist/src/internal/vercel/assemble-eve-services.js +1 -0
- package/dist/src/internal/vercel/build-agent-workspace.d.ts +3 -0
- package/dist/src/internal/vercel/build-agent-workspace.js +1 -0
- package/dist/src/internal/vercel/build-command.d.ts +4 -0
- package/dist/src/internal/vercel/build-command.js +1 -0
- package/dist/src/internal/vercel/eve-service-contribution.d.ts +27 -0
- package/dist/src/internal/vercel/eve-service-contribution.js +1 -0
- package/dist/src/internal/vercel/vercel-service-config-operations.d.ts +18 -0
- package/dist/src/internal/vercel/vercel-service-config-operations.js +1 -0
- package/dist/src/internal/vercel/vercel-service-name.d.ts +6 -0
- package/dist/src/internal/vercel/vercel-service-name.js +1 -0
- package/dist/src/internal/vercel/vercel-services-config.d.ts +53 -0
- package/dist/src/internal/vercel/vercel-services-config.js +1 -0
- package/dist/src/internal/workflow-bundle/builder.js +1 -1
- package/dist/src/internal/workflow-bundle/workflow-builders.js +1 -1
- package/dist/src/protocol/message.d.ts +2 -0
- package/dist/src/protocol/message.js +1 -1
- package/dist/src/public/channels/slack/action-status.js +1 -1
- package/dist/src/public/memory/file/backends/vercel-blob.js +1 -1
- package/dist/src/public/next/index.js +1 -1
- package/dist/src/public/next/vercel-output-config.js +1 -1
- package/dist/src/public/workflow/index.d.ts +3 -1
- package/dist/src/public/workflow/index.js +1 -1
- package/dist/src/runtime/actions/results.d.ts +3 -3
- package/dist/src/runtime/actions/results.js +1 -1
- package/dist/src/runtime/agent/bootstrap-model-utils.js +1 -1
- package/dist/src/runtime/agent/bootstrap.d.ts +1 -0
- package/dist/src/runtime/agent/bootstrap.js +1 -1
- package/dist/src/runtime/agent/mock-model-adapter.js +1 -1
- package/dist/src/runtime/channels/registry.js +1 -1
- package/dist/src/runtime/prompt/compose.d.ts +0 -1
- package/dist/src/runtime/prompt/compose.js +1 -1
- package/dist/src/runtime/resolve-agent-graph.js +1 -1
- package/dist/src/runtime/resolve-agent.js +1 -1
- package/dist/src/runtime/sessions/turn.d.ts +16 -1
- package/dist/src/runtime/subagents/registry.js +1 -1
- package/dist/src/runtime/subagents/workflow-reference.d.ts +5 -0
- package/dist/src/runtime/subagents/workflow-reference.js +1 -0
- package/dist/src/runtime/subagents/workflow.d.ts +8 -0
- package/dist/src/runtime/subagents/workflow.js +1 -0
- package/dist/src/runtime/tools/registry.js +1 -1
- package/dist/src/setup/integrations/discord/setup.js +1 -1
- package/dist/src/setup/integrations/file-memory/vercel.js +1 -1
- package/dist/src/setup/integrations/linear/setup.js +1 -1
- package/dist/src/setup/integrations/linq/setup.js +3 -3
- package/dist/src/setup/integrations/shopify/setup.js +1 -1
- package/dist/src/setup/scaffold/create/project.js +1 -1
- package/dist/src/setup/scaffold/update/channels.d.ts +4 -12
- package/dist/src/setup/scaffold/update/channels.js +1 -1
- package/dist/src/shared/action-types.d.ts +74 -14
- package/dist/src/shared/action-types.js +1 -1
- package/dist/src/shared/json.js +1 -1
- package/dist/src/shared/workflow-sandbox.d.ts +1 -1
- package/dist/src/{execution/subagent-adapter-state.d.ts → subagents/adapter-state.d.ts} +2 -0
- package/dist/src/{execution/subagent-adapter-state.js → subagents/adapter-state.js} +1 -1
- package/dist/src/subagents/adapter.js +1 -0
- package/dist/src/{harness → subagents}/agent-handle-errors.d.ts +6 -0
- package/dist/src/subagents/agent-handle-errors.js +1 -0
- package/dist/src/subagents/callback-route.js +1 -0
- package/dist/src/subagents/callback-step.js +1 -0
- package/dist/src/{execution/agent-continuation-bundle.d.ts → subagents/continuation-bundle.d.ts} +1 -1
- package/dist/src/subagents/continuation-bundle.js +1 -0
- package/dist/src/{execution/subagent-event-proxy-step.d.ts → subagents/event-proxy-step.d.ts} +2 -8
- package/dist/src/subagents/event-proxy-step.js +1 -0
- package/dist/src/subagents/handle-dispatch.d.ts +54 -0
- package/dist/src/subagents/handle-dispatch.js +1 -0
- package/dist/src/{harness → subagents}/handles/prompt.d.ts +4 -4
- package/dist/src/{harness → subagents}/handles/prompt.js +1 -1
- package/dist/src/{harness → subagents}/handles/query.d.ts +8 -2
- package/dist/src/subagents/handles/query.js +1 -0
- package/dist/src/subagents/handles/rebase.d.ts +4 -0
- package/dist/src/subagents/handles/rebase.js +1 -0
- package/dist/src/{harness → subagents}/handles/store.d.ts +90 -15
- package/dist/src/subagents/handles/store.js +1 -0
- package/dist/src/subagents/handles/transitions.d.ts +103 -0
- package/dist/src/subagents/handles/transitions.js +1 -0
- package/dist/src/{execution/delegated-parent-notification.d.ts → subagents/parent-notification.d.ts} +1 -7
- package/dist/src/subagents/parent-notification.js +1 -0
- package/dist/src/subagents/parent-result.js +1 -0
- package/dist/src/{execution/remote-agent-dispatch.d.ts → subagents/remote-dispatch.d.ts} +3 -2
- package/dist/src/subagents/remote-dispatch.js +1 -0
- package/dist/src/{execution/subagent-start-local.d.ts → subagents/start-local.d.ts} +5 -6
- package/dist/src/subagents/start-local.js +1 -0
- package/dist/src/{execution/subagent-start-remote.d.ts → subagents/start-remote.d.ts} +5 -5
- package/dist/src/subagents/start-remote.js +1 -0
- package/dist/src/{execution/subagent-tool.d.ts → subagents/tool.d.ts} +5 -3
- package/dist/src/subagents/tool.js +1 -0
- package/dist/src/svelte/index.js +1 -1
- package/dist/src/svelte/use-eve-agent.js +1 -1
- package/dist/src/tasks/json.js +1 -1
- package/dist/src/tasks/session-index.d.ts +2 -3
- package/dist/src/tasks/session-index.js +1 -1
- package/dist/src/tasks/task-id.d.ts +3 -4
- package/dist/src/tasks/task-id.js +1 -1
- package/dist/src/tasks/transitions.d.ts +3 -47
- package/dist/src/tasks/transitions.js +1 -1
- package/dist/src/tasks/types.d.ts +69 -247
- package/dist/src/tasks/types.js +1 -1
- package/dist/src/tools/dynamic.d.ts +3 -1
- package/dist/src/tools/framework/agent.d.ts +18 -2
- package/dist/src/tools/framework/agent.js +1 -1
- package/dist/src/tools/framework/task-cancel.d.ts +2 -6
- package/dist/src/tools/framework/task-contract.d.ts +44 -65
- package/dist/src/tools/framework/task-contract.js +1 -1
- package/dist/src/tools/framework/task-update.d.ts +1 -0
- package/dist/src/tools/framework/task-update.js +1 -1
- package/dist/src/vue/index.js +1 -1
- package/dist/src/vue/use-eve-agent.js +1 -1
- package/docs/concepts/built-in-tools.md +9 -90
- package/docs/concepts/context-control.md +2 -2
- package/docs/concepts/execution-model-and-durability.mdx +1 -1
- package/docs/concepts/sessions-runs-and-streaming.md +3 -3
- package/docs/guides/deployment/vercel.mdx +20 -2
- package/docs/guides/dynamic-capabilities.md +2 -2
- package/docs/guides/frontend/overview.mdx +1 -1
- package/docs/guides/instrumentation-providers.md +242 -0
- package/docs/guides/instrumentation.md +2 -0
- package/docs/guides/meta.json +1 -0
- package/docs/guides/remote-agents.md +8 -9
- package/docs/reference/cli.md +5 -2
- package/docs/sandbox.mdx +2 -0
- package/docs/subagents/index.mdx +9 -8
- package/docs/tools/overview.mdx +11 -10
- package/docs/tools/workflows.mdx +52 -18
- package/package.json +1 -1
- package/dist/src/execution/agent-continuation-bundle.js +0 -1
- package/dist/src/execution/agent-handle-dispatch.d.ts +0 -79
- package/dist/src/execution/agent-handle-dispatch.js +0 -1
- package/dist/src/execution/delegated-parent-notification.js +0 -1
- package/dist/src/execution/delegated-parent-result.js +0 -1
- package/dist/src/execution/delegation-tool.d.ts +0 -10
- package/dist/src/execution/delegation-tool.js +0 -1
- package/dist/src/execution/dispatch-runtime-actions-shared.d.ts +0 -165
- package/dist/src/execution/dispatch-runtime-actions-shared.js +0 -1
- package/dist/src/execution/dispatch-runtime-actions-start.js +0 -1
- package/dist/src/execution/dispatch-runtime-actions-step.d.ts +0 -18
- package/dist/src/execution/dispatch-runtime-actions-step.js +0 -1
- package/dist/src/execution/dispatch-workflow-runtime-actions-step.d.ts +0 -18
- package/dist/src/execution/dispatch-workflow-runtime-actions-step.js +0 -1
- package/dist/src/execution/finalize-terminal-session.d.ts +0 -17
- package/dist/src/execution/finalize-terminal-session.js +0 -1
- package/dist/src/execution/prepared-agent-action.d.ts +0 -7
- package/dist/src/execution/prepared-agent-action.js +0 -1
- package/dist/src/execution/remote-agent-dispatch.js +0 -1
- package/dist/src/execution/session-callback-route.js +0 -1
- package/dist/src/execution/session-callback-step.js +0 -1
- package/dist/src/execution/subagent-adapter.js +0 -1
- package/dist/src/execution/subagent-event-proxy-step.js +0 -1
- package/dist/src/execution/subagent-start-local.js +0 -1
- package/dist/src/execution/subagent-start-remote.js +0 -1
- package/dist/src/execution/subagent-tool.js +0 -1
- package/dist/src/execution/tasks/child/instructions.d.ts +0 -3
- package/dist/src/execution/tasks/child/instructions.js +0 -1
- package/dist/src/execution/tasks/parent/agent-identity.d.ts +0 -13
- package/dist/src/execution/tasks/parent/agent-identity.js +0 -1
- package/dist/src/execution/tasks/parent/agent-views.d.ts +0 -7
- package/dist/src/execution/tasks/parent/agent-views.js +0 -1
- package/dist/src/execution/tasks/parent/continuation-dispatch.d.ts +0 -43
- package/dist/src/execution/tasks/parent/continuation-dispatch.js +0 -1
- package/dist/src/execution/tasks/parent/dispatch-task-step.d.ts +0 -19
- package/dist/src/execution/tasks/parent/dispatch-task-step.js +0 -1
- package/dist/src/execution/tool-run/answer.js +0 -1
- package/dist/src/execution/tool-run/background.d.ts +0 -14
- package/dist/src/execution/tool-run/background.js +0 -1
- package/dist/src/execution/tool-run/cancel.d.ts +0 -7
- package/dist/src/execution/tool-run/cancel.js +0 -1
- package/dist/src/execution/tool-run/dispatch.d.ts +0 -24
- package/dist/src/execution/tool-run/dispatch.js +0 -1
- package/dist/src/execution/tool-run/emit-run-report-step.d.ts +0 -7
- package/dist/src/execution/tool-run/emit-run-report-step.js +0 -1
- package/dist/src/execution/tool-run/messages.d.ts +0 -70
- package/dist/src/execution/tool-run/messages.js +0 -1
- package/dist/src/execution/tool-run/owner-inbox.d.ts +0 -11
- package/dist/src/execution/tool-run/owner-inbox.js +0 -1
- package/dist/src/execution/tool-run/owner.d.ts +0 -13
- package/dist/src/execution/tool-run/owner.js +0 -1
- package/dist/src/execution/tool-run/run-control.d.ts +0 -18
- package/dist/src/execution/tool-run/run-control.js +0 -1
- package/dist/src/execution/tool-run/start.d.ts +0 -11
- package/dist/src/execution/tool-run/start.js +0 -1
- package/dist/src/execution/tool-run/types.d.ts +0 -21
- package/dist/src/execution/tool-run/types.js +0 -1
- package/dist/src/execution/tool-run/workflow.d.ts +0 -9
- package/dist/src/execution/tool-run/workflow.js +0 -1
- package/dist/src/execution/tools/subagent/local.d.ts +0 -40
- package/dist/src/execution/tools/subagent/local.js +0 -1
- package/dist/src/execution/tools/subagent/remote.d.ts +0 -26
- package/dist/src/execution/tools/subagent/remote.js +0 -1
- package/dist/src/harness/agent-handle-errors.js +0 -1
- package/dist/src/harness/handles/query.js +0 -1
- package/dist/src/harness/handles/store.js +0 -1
- package/dist/src/harness/handles/transitions.d.ts +0 -167
- package/dist/src/harness/handles/transitions.js +0 -1
- package/dist/src/harness/runtime-actions.js +0 -1
- package/dist/src/harness/subagent-depth.d.ts +0 -10
- package/dist/src/harness/subagent-depth.js +0 -1
- package/dist/src/harness/tool-runs.d.ts +0 -21
- package/dist/src/harness/tool-runs.js +0 -1
- package/dist/src/harness/workflow-runtime-action-state.d.ts +0 -9
- package/dist/src/harness/workflow-runtime-action-state.js +0 -1
- package/dist/src/runtime/actions/keys.d.ts +0 -14
- package/dist/src/runtime/actions/keys.js +0 -1
- package/dist/src/tasks/wire.d.ts +0 -25
- package/dist/src/tasks/wire.js +0 -1
- /package/dist/src/execution/{tool-run → tools/workflow}/owner-channels.d.ts +0 -0
- /package/dist/src/execution/{tool-run → tools/workflow}/owner-channels.js +0 -0
- /package/dist/src/execution/{tool-run → tools/workflow}/resume-hook-step.d.ts +0 -0
- /package/dist/src/execution/{tool-run → tools/workflow}/resume-hook-step.js +0 -0
- /package/dist/src/{execution/subagent-adapter.d.ts → subagents/adapter.d.ts} +0 -0
- /package/dist/src/{execution/session-callback-route.d.ts → subagents/callback-route.d.ts} +0 -0
- /package/dist/src/{execution/session-callback-step.d.ts → subagents/callback-step.d.ts} +0 -0
- /package/dist/src/{harness → subagents}/handles/operation-id.d.ts +0 -0
- /package/dist/src/{harness → subagents}/handles/operation-id.js +0 -0
- /package/dist/src/{harness → subagents}/handles/state-key.d.ts +0 -0
- /package/dist/src/{harness → subagents}/handles/state-key.js +0 -0
- /package/dist/src/{execution/subagent-hitl-proxy.d.ts → subagents/hitl-proxy.d.ts} +0 -0
- /package/dist/src/{execution/subagent-hitl-proxy.js → subagents/hitl-proxy.js} +0 -0
- /package/dist/src/{execution/subagent-invocation.d.ts → subagents/invocation.d.ts} +0 -0
- /package/dist/src/{execution/subagent-invocation.js → subagents/invocation.js} +0 -0
- /package/dist/src/{execution/delegated-parent-result.d.ts → subagents/parent-result.d.ts} +0 -0
- /package/dist/src/{execution/remote-agent-route-url.d.ts → subagents/remote-route-url.d.ts} +0 -0
- /package/dist/src/{execution/remote-agent-route-url.js → subagents/remote-route-url.js} +0 -0
- /package/dist/src/{harness/subagent-token-budget.d.ts → subagents/token-budget.d.ts} +0 -0
- /package/dist/src/{harness/subagent-token-budget.js → subagents/token-budget.js} +0 -0
package/docs/reference/cli.md
CHANGED
|
@@ -3,7 +3,7 @@ title: "CLI"
|
|
|
3
3
|
description: "Reference for every eve CLI command: init, set, info, build, start, dev, logs, trace, link, deploy, eval, channels, and extension."
|
|
4
4
|
---
|
|
5
5
|
|
|
6
|
-
Relevant `eve` commands can run from the application root or any directory beneath it. Running `eve` with no command runs `eve init` when the current directory is not an eve project, or `eve dev` when it is.
|
|
6
|
+
Relevant `eve` commands can run from the application root or any directory beneath it. In an `agents/` workspace, agent-specific commands accept `--agent <name>` and otherwise open a picker when more than one agent exists. Non-interactive runs must pass `--agent`. Running `eve` with no command runs `eve init` when the current directory is not an eve project, or `eve dev` when it is.
|
|
7
7
|
|
|
8
8
|
## Commands
|
|
9
9
|
|
|
@@ -37,7 +37,7 @@ When `eve build` fails on discovery errors, it prints the full diagnostics repor
|
|
|
37
37
|
## `eve init`
|
|
38
38
|
|
|
39
39
|
```bash
|
|
40
|
-
eve init [target] [--model <provider/model-id>] [--reasoning <effort>] [--channel-web-nextjs]
|
|
40
|
+
eve init [target] [--agents <name,...>] [--model <provider/model-id>] [--reasoning <effort>] [--channel-web-nextjs]
|
|
41
41
|
```
|
|
42
42
|
|
|
43
43
|
Creates a new agent app or adds an agent to an existing app. Always installs dependencies. New directories also initialize Git.
|
|
@@ -48,6 +48,8 @@ Creates a new agent app or adds an agent to an existing app. Always installs dep
|
|
|
48
48
|
| `eve init` or `eve init .` in an empty directory | Creates an agent project in the current directory |
|
|
49
49
|
| `eve init` or `eve init .` in a non-empty directory without `package.json` | Asks whether to scaffold in the current directory or a named subdirectory. Using the current directory preserves unrelated files but overwrites files at generated paths |
|
|
50
50
|
| `eve init .` in an existing project | Adds `agent/` plus missing `eve`, `ai`, and `zod` dependencies. Requires `package.json` and no existing `agent/` files |
|
|
51
|
+
| `eve init my-project --agents foreman,researcher` | Creates a workspace with `agents/foreman/agent/` and `agents/researcher/agent/` |
|
|
52
|
+
| `eve init billing` from an `agents/` workspace | Adds only `agents/billing/agent/`; the workspace keeps its existing package, dependencies, and TypeScript configuration |
|
|
51
53
|
|
|
52
54
|
Coding-agent launches and non-interactive terminals cannot answer the location prompt and fail before writing. Pass a new directory name, such as `eve init my-agent`, in those environments.
|
|
53
55
|
|
|
@@ -55,6 +57,7 @@ After scaffolding, a human terminal usually continues into `eve dev`. If a codin
|
|
|
55
57
|
|
|
56
58
|
| Flag | Type | Default | Description |
|
|
57
59
|
| ---------------------- | ------ | -------------------------- | ------------------------------------------------------------------------------------------------------------------------ |
|
|
60
|
+
| `--agents <names>` | list | unset | Create an `agents/` workspace with one or more comma-separated agent names. |
|
|
58
61
|
| `--model <model>` | string | `openai/gpt-5.6-luna-fast` | Set the root agent's AI Gateway model ID. |
|
|
59
62
|
| `--reasoning <effort>` | enum | provider default | Set reasoning to `none`, `minimal`, `low`, `medium`, `high`, or `xhigh`. `provider-default` leaves the field unauthored. |
|
|
60
63
|
| `--channel-web-nextjs` | flag | off | Add the Web Chat app (Next.js). Not for existing projects — run `eve add channel/web` there instead. |
|
package/docs/sandbox.mdx
CHANGED
|
@@ -158,6 +158,8 @@ With `backend` omitted, eve uses `defaultBackend()`, which resolves on first use
|
|
|
158
158
|
|
|
159
159
|
By default, Docker and microsandbox pull `ghcr.io/vercel/eve` while Vercel Sandbox pulls `vcr.vercel.com/vercel/eve/base`. Each image tag matches the installed eve version. Set `EVE_SANDBOX_IMAGE_TAG` to replace the version-derived tag for these default images. An explicit `image` passed to `docker()` or `microsandbox()` still takes precedence.
|
|
160
160
|
|
|
161
|
+
On every backend, authored commands run as the non-root `vercel-sandbox` user through a non-interactive `bash -lc` login shell. `/workspace` and `$HOME` are writable, `$HOME/.local/bin` is on `PATH` for user-scoped executables, and system paths such as `/usr/local` stay root-owned. Use passwordless `sudo` when setup genuinely needs system-wide changes; `sudo` resets the environment, so pass through variables like `NPM_CONFIG_PREFIX` explicitly if a privileged step depends on them.
|
|
162
|
+
|
|
161
163
|
`defaultBackend()` also accepts a keyed bag so each inner backend gets its own typed create options:
|
|
162
164
|
|
|
163
165
|
```ts
|
package/docs/subagents/index.mdx
CHANGED
|
@@ -17,7 +17,7 @@ The root session receives `agent` by default. The model calls it to delegate a t
|
|
|
17
17
|
}
|
|
18
18
|
```
|
|
19
19
|
|
|
20
|
-
The copy uses the root's instructions, connections, auth, and sandbox. It receives the same tools except for the root-only `agent` and `Workflow`, and starts with fresh conversation history and fresh state. Its file writes are immediately visible to the root.
|
|
20
|
+
The copy uses the root's instructions, connections, auth, and sandbox. It receives the same tools except for the root-only `agent` and `Workflow`, and starts with fresh conversation history and fresh state. Its file writes are immediately visible to the root. The built-in `agent` always runs in the background and needs no configuration: each call returns `{ status: "working", taskId, agentId }`, then task notifications wake the parent with updates or the final result. Give parallel children non-overlapping write scopes.
|
|
21
21
|
|
|
22
22
|
`agent` is intentionally root-only. Copies created by it cannot call `agent`, and declared subagents never receive the built-in tool. If a stale or forced recursive call reaches execution, eve rejects it instead of starting another child session.
|
|
23
23
|
|
|
@@ -46,7 +46,9 @@ export default defineAgent({
|
|
|
46
46
|
});
|
|
47
47
|
```
|
|
48
48
|
|
|
49
|
-
`description` is required. The parent reads it to decide whether to delegate, so the compiler rejects any subagent whose `agent.ts` leaves it out.
|
|
49
|
+
`description` is required. The parent reads it to decide whether to delegate, so the compiler rejects any subagent whose `agent.ts` leaves it out. Every declared local or remote subagent runs as a durable background task: the call returns `{ status: "working", taskId, agentId }` immediately, then task notifications wake the parent with updates, completion, failure, or cancellation. Human input requests surface separately on the parent session.
|
|
50
|
+
|
|
51
|
+
A child running as a background task receives the framework `task_update` tool. It uses `task_update` to report progress to its parent. `task_cancel` is available to sessions that own background tasks, including a child that starts nested background work.
|
|
50
52
|
|
|
51
53
|
A mounted extension can also contribute declared subagents from `extension/subagents/`. The mount namespace prefixes the subagent visible to the consuming agent node: mounting an extension as `crm` exposes its `reviewer` subagent as `crm__reviewer`. The contributed subagent keeps its own isolated tools, connections, skills, hooks, instructions, sandbox, and nested subagents, and its modules can read configuration from the extension handle. See [Extensions](./extensions#add-a-subagent) for the authoring and override behavior.
|
|
52
54
|
|
|
@@ -54,7 +56,7 @@ A mounted extension can also contribute declared subagents from `extension/subag
|
|
|
54
56
|
|
|
55
57
|
To expose a declared subagent only for certain sessions or turns, export
|
|
56
58
|
`defineDynamic` from that subagent's `agent.ts`. Return a `defineAgent`
|
|
57
|
-
configuration to expose the subagent, or
|
|
59
|
+
configuration to expose the subagent, or `null` to omit it from the parent's tools.
|
|
58
60
|
|
|
59
61
|
```ts title="agent/subagents/researcher/agent.ts"
|
|
60
62
|
import { defineAgent, defineDynamic } from "eve";
|
|
@@ -73,9 +75,9 @@ export default defineDynamic({
|
|
|
73
75
|
```
|
|
74
76
|
|
|
75
77
|
Resolvers run at `session.started` or `turn.started`; `step.started` is not
|
|
76
|
-
supported for subagents. A
|
|
78
|
+
supported for subagents. A nullish result (`null` or `undefined`) removes the
|
|
77
79
|
subagent's description and tool definition from the model-visible surface.
|
|
78
|
-
The subagent's filesystem manifest is always compiled; a non-
|
|
80
|
+
The subagent's filesystem manifest is always compiled; a non-nullish result injects
|
|
79
81
|
the returned agent configuration when the child runs.
|
|
80
82
|
|
|
81
83
|
Packaging controls must be available before the resolver runs. Put them on
|
|
@@ -151,7 +153,7 @@ eve lowers every subagent visible to the current agent (the root built-in copy,
|
|
|
151
153
|
|
|
152
154
|
Declared subagents can call nested subagents defined under their own directories. eve does not apply a separate depth limit; nesting ends where the authored directory tree ends. The built-in `agent` follows the stricter root-only rule above, so `limits.maxSubagentDepth` no longer exists.
|
|
153
155
|
|
|
154
|
-
|
|
156
|
+
Child sessions can still call their own declared or remote subagents, but they receive neither `Workflow` nor the built-in `agent`. Background subagents run through the model tool loop and are not available inside a model-authored `Workflow` program.
|
|
155
157
|
|
|
156
158
|
A directly declared subagent's tool name is the bare path-derived name, with no prefix. `agent/subagents/researcher/` registers as the tool `researcher`. A subagent supplied by a mounted extension includes the mount namespace, such as `crm__reviewer`. The model, approvals, logs, and evals reference the resulting name. Its input schema is:
|
|
157
159
|
|
|
@@ -169,7 +171,7 @@ Do not rely on subagent delegation by itself as an approval boundary. Put sensit
|
|
|
169
171
|
|
|
170
172
|
Each delegated subagent spins up its own child session and stream. The parent stream carries the control-plane events `subagent.called` and `subagent.completed`, plus interactive `input.requested`, `authorization.required`, and `authorization.completed` events proxied from descendants so the root channel can prompt the user. To follow the child's other progress, read `subagent.called.data.childSessionId` and subscribe at `GET /eve/v1/session/:childSessionId/stream`.
|
|
171
173
|
|
|
172
|
-
|
|
174
|
+
A background task that was already admitted survives cancellation of the turn that started it; background work that has not yet been admitted is rejected with the cancelled step. Use `task_cancel` to stop an admitted task. Parent-session finalization cancels remaining live tasks.
|
|
173
175
|
|
|
174
176
|
Subagent model calls automatically retry classified transient provider failures, including overload errors delivered after a stream starts. eve makes at most three fresh model-call attempts, repeating only the current uncommitted call so completed earlier steps, tool results, and sandbox work remain available to the child. Other recoverable task errors fall back to Workflow's durable step retry from the last committed session snapshot. Exhausting the transient model-call attempts or the dedicated empty-response reissue returns one failed task result instead of stacking both retry budgets; terminal errors fail immediately.
|
|
175
177
|
|
|
@@ -188,4 +190,3 @@ Split out a subagent when the task needs a different prompt or specialist role,
|
|
|
188
190
|
## What to read next
|
|
189
191
|
|
|
190
192
|
- [Remote agents](./guides/remote-agents): call another eve deployment as a subagent.
|
|
191
|
-
- [Workflow tool](./concepts/built-in-tools#workflow-tool): have the model orchestrate its subagents programmatically (fan-out, map-reduce).
|
package/docs/tools/overview.mdx
CHANGED
|
@@ -56,15 +56,16 @@ history or `toModelOutput`; only the final yield does. Treat snapshots as
|
|
|
56
56
|
last-write-wins by tool call id, not append-only progress. The durable runtime
|
|
57
57
|
can retry a step and replay overlapping snapshots.
|
|
58
58
|
|
|
59
|
-
###
|
|
59
|
+
### Background execution
|
|
60
60
|
|
|
61
61
|
`defineTool({ execution: "background" })` receives a third `task` argument. Returning a normal
|
|
62
62
|
value completes the durable task with that value. Returning `task.delegated({ executor, receipt })`
|
|
63
|
-
returns a `working` receipt immediately while an external executor continues the task.
|
|
64
|
-
|
|
63
|
+
returns a `working` receipt immediately while an external executor continues the task. Background
|
|
64
|
+
tools are a normal execution mode and need no root-agent flag.
|
|
65
65
|
|
|
66
|
-
|
|
67
|
-
|
|
66
|
+
Built-in, declared local, and remote subagents use this background task lifecycle automatically.
|
|
67
|
+
After delegating, an
|
|
68
|
+
in-process executor reports
|
|
68
69
|
progress with `task.send({ kind: "update", message })` and the terminal result with
|
|
69
70
|
`task.send({ kind: "complete", data })` (or `fail` / `cancel`). `send` is not restart-safe — an
|
|
70
71
|
in-memory callback dies with the process — so the cross-process executor wire remains
|
|
@@ -78,12 +79,12 @@ Later task-triggered parent turns receive fresh state for the same cohort. The m
|
|
|
78
79
|
to keep related intermediate results silent while any task remains pending. Once every related
|
|
79
80
|
task is terminal, the state includes their outputs so the model can combine the useful results.
|
|
80
81
|
|
|
81
|
-
###
|
|
82
|
+
### Workflows as tools
|
|
82
83
|
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
84
|
+
Put `"use workflow"` at the start of a tool's `execute` function to run each call as a durable
|
|
85
|
+
Workflow run. The tool can wait for a person, webhook, or timer without holding compute, then return
|
|
86
|
+
its result to the model. See [Workflows as tools](/docs/tools/workflows) for the authoring rules and
|
|
87
|
+
examples.
|
|
87
88
|
|
|
88
89
|
### The `ctx` parameter
|
|
89
90
|
|
package/docs/tools/workflows.mdx
CHANGED
|
@@ -1,26 +1,33 @@
|
|
|
1
1
|
---
|
|
2
|
-
title: "
|
|
3
|
-
description: "
|
|
2
|
+
title: "Workflows as Tools"
|
|
3
|
+
description: "Define durable workflow tools that wait for people, webhooks, or timers without holding compute."
|
|
4
4
|
url: /tools/workflows
|
|
5
5
|
---
|
|
6
6
|
|
|
7
|
-
A tool
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
`execution: "background"` and the model gets a receipt instead; eve wakes the agent with the return
|
|
11
|
-
value when the run ends.
|
|
7
|
+
A workflow tool is an authored tool whose `execute` function starts with `"use workflow"`. Each
|
|
8
|
+
call starts a durable Workflow run. Use one when a tool must wait for a person, webhook, or timer,
|
|
9
|
+
delegate work to subagents, or coordinate retryable steps over a long period.
|
|
12
10
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
11
|
+
By default, the model's tool call waits for the run's return value. While the run is suspended, the
|
|
12
|
+
turn is parked and holds no compute. Set `execution: "background"` when the conversation should
|
|
13
|
+
continue; the model receives a task receipt, and eve wakes the agent with the result when the run
|
|
14
|
+
ends.
|
|
17
15
|
|
|
18
|
-
|
|
16
|
+
Workflow tools use the [Workflow SDK](https://workflow-sdk.dev): `"use workflow"`, `"use step"`,
|
|
17
|
+
`createHook`, `createWebhook`, `sleep`, retries, and replay. eve adds `ask` from `eve/workflow` for
|
|
18
|
+
questions answered through the session's channel and `agent` for durable subagent delegation. Each
|
|
19
|
+
`yield` becomes a durable progress report.
|
|
20
|
+
|
|
21
|
+
A workflow tool runs code you wrote and appears to the model under its path-derived tool name, such
|
|
22
|
+
as `deploy`.
|
|
23
|
+
|
|
24
|
+
## Define a workflow tool
|
|
19
25
|
|
|
20
26
|
```ts title="agent/tools/deploy.ts"
|
|
21
27
|
import { defineTool } from "eve/tools";
|
|
22
28
|
import { ask } from "eve/workflow";
|
|
23
29
|
import { z } from "zod";
|
|
30
|
+
import { computePlan, runDeploy, type DeployPlan } from "../lib/deploy";
|
|
24
31
|
|
|
25
32
|
export default defineTool({
|
|
26
33
|
description: "Deploy a service to production. Pauses for a human to approve the plan.",
|
|
@@ -85,8 +92,8 @@ or days later, the run resumes, deploys, and returns. The model sees one tool re
|
|
|
85
92
|
| cancel | cancelling the turn cancels the run | `task_cancel`, or the session ending |
|
|
86
93
|
|
|
87
94
|
Wait when the model needs the answer to continue. Go background when the wait may outlive the
|
|
88
|
-
conversation or the user should keep talking in the meantime. Background tools
|
|
89
|
-
|
|
95
|
+
conversation or the user should keep talking in the meantime. Background tools need no root-agent
|
|
96
|
+
flag.
|
|
90
97
|
|
|
91
98
|
## Ask a human: `ask`
|
|
92
99
|
|
|
@@ -123,6 +130,25 @@ if (answer === undefined) return { deployed: false, reason: "timed out" };
|
|
|
123
130
|
Compare the [`approval`](/docs/human-in-the-loop) policy, which gates the call before `execute` runs
|
|
124
131
|
and can only show the model's input. Both compose: `approval` before the run, `ask` inside it.
|
|
125
132
|
|
|
133
|
+
## Delegate work: `agent`
|
|
134
|
+
|
|
135
|
+
Workflow tools can call a visible subagent and wait for its result:
|
|
136
|
+
|
|
137
|
+
```ts
|
|
138
|
+
import { agent } from "eve/workflow";
|
|
139
|
+
|
|
140
|
+
const result = await agent(ctx, {
|
|
141
|
+
key: "security-review",
|
|
142
|
+
target: "reviewer",
|
|
143
|
+
message: "Review the deployment plan for security risks.",
|
|
144
|
+
});
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
`key` is required, non-empty, and unique within the workflow run. It makes the invocation identity
|
|
148
|
+
stable across replay, so use a fixed key for each logical call site. Parallel calls must use distinct
|
|
149
|
+
keys. `target` is the model-visible subagent name; pass `agentId` to continue an existing child and
|
|
150
|
+
`outputSchema` to require structured output.
|
|
151
|
+
|
|
126
152
|
## Report progress: `yield`
|
|
127
153
|
|
|
128
154
|
A workflow body may be an async generator. Each `yield` is a durable progress snapshot; the return
|
|
@@ -167,7 +193,7 @@ as cancelled whether or not it did. A body parked on a hook or a `sleep` does no
|
|
|
167
193
|
it is abandoned when the grace period ends. Steps that received the signal are how you clean up
|
|
168
194
|
first.
|
|
169
195
|
|
|
170
|
-
##
|
|
196
|
+
## Workflow tool examples
|
|
171
197
|
|
|
172
198
|
### Approve with a deadline and an escalation
|
|
173
199
|
|
|
@@ -195,8 +221,11 @@ and returning withdraws the request.
|
|
|
195
221
|
|
|
196
222
|
### Wait for an external system to call back
|
|
197
223
|
|
|
198
|
-
```ts
|
|
224
|
+
```ts title="agent/tools/render_video.ts"
|
|
225
|
+
import { defineTool } from "eve/tools";
|
|
199
226
|
import { createWebhook, FatalError } from "workflow";
|
|
227
|
+
import { z } from "zod";
|
|
228
|
+
import { submitRender } from "../lib/render";
|
|
200
229
|
|
|
201
230
|
export default defineTool({
|
|
202
231
|
description: "Render a video. Returns the URL once the render farm finishes.",
|
|
@@ -220,8 +249,11 @@ system posts to it when it is done. Nothing runs in between.
|
|
|
220
249
|
|
|
221
250
|
### Ask now, act when answered
|
|
222
251
|
|
|
223
|
-
```ts
|
|
252
|
+
```ts title="agent/tools/refund_order.ts"
|
|
253
|
+
import { defineTool } from "eve/tools";
|
|
224
254
|
import { ask } from "eve/workflow";
|
|
255
|
+
import { z } from "zod";
|
|
256
|
+
import { issueRefund } from "../lib/refunds";
|
|
225
257
|
|
|
226
258
|
export default defineTool({
|
|
227
259
|
description: "Request approval to refund an order, then issue the refund once approved.",
|
|
@@ -250,8 +282,10 @@ on the channel. When it is answered, the refund runs and the agent is woken with
|
|
|
250
282
|
|
|
251
283
|
### Remind me later
|
|
252
284
|
|
|
253
|
-
```ts
|
|
285
|
+
```ts title="agent/tools/remind.ts"
|
|
286
|
+
import { defineTool } from "eve/tools";
|
|
254
287
|
import { sleep } from "workflow";
|
|
288
|
+
import { z } from "zod";
|
|
255
289
|
|
|
256
290
|
export default defineTool({
|
|
257
291
|
description: "Remind the user about something after a delay.",
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{resolveRemoteAgentForAction}from"#execution/remote-agent-dispatch.js";function createAgentContinuationBundle(e){let{action:t,dynamicRemoteAgent:n}=e;if(t.kind!==`remote-agent-call`||n===void 0)return e.bundle;let r=e.bundle.subagentRegistry.subagentsByNodeId,i=Object.assign(new Map(r),{get:e=>e===t.nodeId?{definition:resolveRemoteAgentForAction({dynamicRemoteAgent:n,nodeId:e,registry:r,remoteAgentName:t.remoteAgentName})}:r.get(e)});return{...e.bundle,subagentRegistry:{...e.bundle.subagentRegistry,subagentsByNodeId:i}}}export{createAgentContinuationBundle};
|
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Continuation dispatch for stored agent handles.
|
|
3
|
-
*
|
|
4
|
-
* Owns the `agentId` leg of the runtime-action dispatch step: resolving a
|
|
5
|
-
* model-supplied agentId against the session's handle store via
|
|
6
|
-
* `prepareAgentContinuation`, delivering the follow-up message to the
|
|
7
|
-
* address the running handle records, and resolving delivery failures as
|
|
8
|
-
* dead (handle deleted) or retryable (handle restored to `parked`).
|
|
9
|
-
*/
|
|
10
|
-
import type { ActivityObserverConfig, SessionAuthContext } from "#channel/types.js";
|
|
11
|
-
import { type AgentAddress } from "#harness/handles/store.js";
|
|
12
|
-
import type { RuntimeActionRequest, RuntimeRemoteAgentCallActionRequest, RuntimeSubagentCallActionRequest, RuntimeSubagentDispatchFailure } from "#shared/action-types.js";
|
|
13
|
-
import type { CompiledBundle } from "#runtime/sessions/runtime-context-keys.js";
|
|
14
|
-
import type { hydrateDurableSession } from "#execution/session.js";
|
|
15
|
-
/** Runtime action kinds that may address an agent handle via `agentId`. */
|
|
16
|
-
export type RuntimeAgentHandleAction = RuntimeRemoteAgentCallActionRequest | RuntimeSubagentCallActionRequest;
|
|
17
|
-
/** Narrows an action to the kinds that may carry an `agentId` continuation. */
|
|
18
|
-
export declare function isAgentHandleAction(action: RuntimeActionRequest): action is RuntimeAgentHandleAction;
|
|
19
|
-
/** Hydrated parent session snapshot threaded through dispatch. */
|
|
20
|
-
export type RuntimeSession = ReturnType<typeof hydrateDurableSession>;
|
|
21
|
-
/**
|
|
22
|
-
* Outcome of dispatching one planned runtime action: an adopted child ready
|
|
23
|
-
* for the `subagent.called` emission tail, or a per-action error result.
|
|
24
|
-
* Either way the (possibly updated) session snapshot rides along.
|
|
25
|
-
*
|
|
26
|
-
* `address` is the same confirmed {@link AgentAddress} recorded on the
|
|
27
|
-
* child's running handle; consumers project it into wire shapes (e.g. the
|
|
28
|
-
* flat `childSessionId` / `remote` fields of `subagent.called`) at the
|
|
29
|
-
* emission site instead of this type re-encoding them.
|
|
30
|
-
*/
|
|
31
|
-
export type DispatchOutcome = {
|
|
32
|
-
readonly address: AgentAddress;
|
|
33
|
-
readonly callId: string;
|
|
34
|
-
readonly kind: "called";
|
|
35
|
-
readonly name: string;
|
|
36
|
-
readonly session: RuntimeSession;
|
|
37
|
-
readonly toolName: string;
|
|
38
|
-
} | {
|
|
39
|
-
readonly deliveryAmbiguous?: boolean;
|
|
40
|
-
readonly kind: "error";
|
|
41
|
-
readonly result: RuntimeSubagentDispatchFailure;
|
|
42
|
-
readonly session: RuntimeSession;
|
|
43
|
-
};
|
|
44
|
-
/**
|
|
45
|
-
* Delivers one `agentId` continuation to the child the handle names.
|
|
46
|
-
*
|
|
47
|
-
* Planning converts initially unknown ids into fresh starts, so an id that
|
|
48
|
-
* matches no handle here disappeared mid-batch and reports
|
|
49
|
-
* `AGENT_UNREACHABLE`. Name mismatches and busy handles report
|
|
50
|
-
* `AGENT_MISMATCH` / `AGENT_BUSY` without touching the store. Delivery
|
|
51
|
-
* failures report `AGENT_UNREACHABLE`: permanent ones resolve the handle as
|
|
52
|
-
* dead, transient ones restore it to `parked` so the model can retry the
|
|
53
|
-
* same agentId.
|
|
54
|
-
*/
|
|
55
|
-
export declare function dispatchToAgentHandle(input: {
|
|
56
|
-
readonly action: RuntimeAgentHandleAction;
|
|
57
|
-
readonly activityObserver?: ActivityObserverConfig;
|
|
58
|
-
readonly agentId: string;
|
|
59
|
-
readonly auth: SessionAuthContext | null;
|
|
60
|
-
readonly bundle: CompiledBundle;
|
|
61
|
-
readonly currentSession: RuntimeSession;
|
|
62
|
-
readonly parentToken: string;
|
|
63
|
-
readonly parentTurnId: string;
|
|
64
|
-
}): Promise<DispatchOutcome>;
|
|
65
|
-
/** Delivers a tasks-mode continuation without creating a second lifecycle claim. */
|
|
66
|
-
export declare function dispatchToTaskAgentAddress(input: {
|
|
67
|
-
readonly action: RuntimeAgentHandleAction;
|
|
68
|
-
readonly activityObserver?: ActivityObserverConfig;
|
|
69
|
-
readonly agentId: string;
|
|
70
|
-
readonly auth: SessionAuthContext | null;
|
|
71
|
-
readonly bundle: CompiledBundle;
|
|
72
|
-
readonly currentSession: RuntimeSession;
|
|
73
|
-
readonly parentToken: string;
|
|
74
|
-
}): Promise<DispatchOutcome>;
|
|
75
|
-
export declare function createAgentErrorResult(input: {
|
|
76
|
-
readonly action: RuntimeAgentHandleAction;
|
|
77
|
-
readonly code: string;
|
|
78
|
-
readonly message: string;
|
|
79
|
-
}): RuntimeSubagentDispatchFailure;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{createEveCallbackRoutePath}from"#protocol/routes.js";import{createLogger,logError}from"#internal/logging.js";import{createWorkflowRuntime}from"#execution/workflow-runtime.js";import{deriveAgentOperationId}from"#harness/handles/operation-id.js";import{continueRemoteAgentSession,isAmbiguousRemoteAgentContinueError,isRetryableRemoteAgentContinueError,resolveRemoteAgentForAction}from"#execution/remote-agent-dispatch.js";import{AGENT_BUSY,AGENT_MISMATCH,AGENT_UNREACHABLE}from"#harness/agent-handle-errors.js";import{getAgentHandleStore}from"#harness/handles/store.js";import{prepareAgentContinuation,rejectAgentEffect,removeTaskAgentAddress}from"#harness/handles/transitions.js";import{isRuntimeNoActiveSessionError}from"#execution/runtime-errors.js";import{normalizeRequestedOutputSchema}from"#execution/subagent-invocation.js";import{createWorkflowCallbackUrl}from"#execution/workflow-callback-url.js";import{err,ok}from"#shared/result.js";import{readTaskIdFromInboxToken}from"#tasks/task-inbox-token.js";const log=createLogger(`execution.agent-handle-dispatch`);function isAgentHandleAction(e){return e.kind===`subagent-call`||e.kind===`remote-agent-call`}async function dispatchToAgentHandle(e){let{action:t,agentId:r,bundle:a}=e,o=t.kind===`remote-agent-call`?t.remoteAgentName:t.subagentName,s={callId:t.callId,id:deriveAgentOperationId({callId:t.callId,parentSessionId:e.currentSession.sessionId,parentTurnId:e.parentTurnId}),kind:`continue`,parentTurnId:e.parentTurnId,previousStatus:``},c=prepareAgentContinuation(e.currentSession,{agentId:r,invokedName:o,operation:s});switch(c.kind){case`unknown`:return{kind:`error`,result:createAgentErrorResult({action:t,code:AGENT_UNREACHABLE,message:`Agent with id "${r}" is no longer reachable.`}),session:e.currentSession};case`mismatch`:return{kind:`error`,result:createAgentErrorResult({action:t,code:AGENT_MISMATCH,message:`Agent "${r}" from the <agents> list does not belong to "${o}".`}),session:e.currentSession};case`busy`:return{kind:`error`,result:createAgentErrorResult({action:t,code:AGENT_BUSY,message:`Agent "${r}" is still working on its previous request. Wait for its result before continuing it.`}),session:e.currentSession};case`ready`:break}let{handle:f}=c,p=await deliverToAgentAddress({action:t,activityObserver:e.activityObserver,address:f.address,auth:e.auth,bundle:a,identity:f.identity,parentToken:e.parentToken});if(!p.ok){let{cause:e,permanent:i}=p.error;return logError(log,`agent delivery failed`,e,{agentId:r,callId:t.callId,nodeId:f.identity.nodeId,permanent:i,subagentName:f.identity.name}),{deliveryAmbiguous:p.error.deliveryAmbiguous,kind:`error`,result:createAgentErrorResult({action:t,code:AGENT_UNREACHABLE,message:i?`Agent "${f.identity.name}" with id "${r}" is no longer reachable.`:`Agent "${f.identity.name}" with id "${r}" is temporarily unreachable. Try again.`}),session:rejectAgentEffect(c.session,{disposition:i?`dead`:`retryable`,operationId:s.id})}}return{address:f.address,callId:t.callId,kind:`called`,name:t.name,session:c.session,toolName:f.identity.name}}async function dispatchToTaskAgentAddress(e){let{action:t,agentId:r}=e,i=t.kind===`remote-agent-call`?t.remoteAgentName:t.subagentName,a=(getAgentHandleStore(e.currentSession.state)?.handles??[]).find(e=>e.phase===`addressed`&&e.identity.id===r);if(a===void 0)return{kind:`error`,result:createAgentErrorResult({action:t,code:AGENT_UNREACHABLE,message:`Agent with id "${r}" is no longer reachable.`}),session:e.currentSession};if(a.identity.name!==i)return{kind:`error`,result:createAgentErrorResult({action:t,code:AGENT_MISMATCH,message:`Agent "${r}" from the <agents> list does not belong to "${i}".`}),session:e.currentSession};let o=await deliverToAgentAddress({action:t,activityObserver:e.activityObserver,address:a.address,auth:e.auth,bundle:e.bundle,identity:a.identity,parentToken:e.parentToken});if(!o.ok){let{cause:i,permanent:s}=o.error;return logError(log,`task agent delivery failed`,i,{agentId:r,callId:t.callId,nodeId:a.identity.nodeId,permanent:s,subagentName:a.identity.name}),{deliveryAmbiguous:o.error.deliveryAmbiguous,kind:`error`,result:createAgentErrorResult({action:t,code:AGENT_UNREACHABLE,message:s?`Agent "${a.identity.name}" with id "${r}" is no longer reachable.`:`Agent "${a.identity.name}" with id "${r}" is temporarily unreachable. Try again.`}),session:s?removeTaskAgentAddress(e.currentSession,r):e.currentSession}}return{address:a.address,callId:t.callId,kind:`called`,name:t.name,session:e.currentSession,toolName:a.identity.name}}async function deliverToAgentAddress(t){let{action:n,address:i,bundle:l,identity:u}=t;if(i.kind===`agent/remote`){let r;try{r=resolveRemoteAgentForAction({nodeId:u.nodeId,remoteAgentName:u.name,registry:l.subagentRegistry.subagentsByNodeId})}catch(e){return err({cause:e,deliveryAmbiguous:!1,permanent:!0})}try{await continueRemoteAgentSession({activityObserver:t.activityObserver,auth:t.auth,callback:{callId:n.callId,subagentName:u.name,taskId:readTaskIdFromInboxToken(t.parentToken),token:t.parentToken,url:createWorkflowCallbackUrl(i.callbackBaseUrl,createEveCallbackRoutePath(t.parentToken))},message:readSubagentMessage(n),outputSchema:normalizeRequestedOutputSchema(n.input.outputSchema),remote:{...r,url:i.url},sessionId:i.sessionId})}catch(e){return err({cause:e,deliveryAmbiguous:isAmbiguousRemoteAgentContinueError(e),permanent:!isRetryableRemoteAgentContinueError(e)})}return ok(void 0)}let d=createWorkflowRuntime({compiledArtifactsSource:l.compiledArtifactsSource,nodeId:u.nodeId});try{if((await d.dispatchSession({command:{auth:t.auth,caller:{activityObserver:t.activityObserver,callId:n.callId,replyTo:{kind:`hook`,token:t.parentToken},subagentName:u.name,taskId:readTaskIdFromInboxToken(t.parentToken)},kind:`send`,payload:{message:readSubagentMessage(n),outputSchema:normalizeRequestedOutputSchema(n.input.outputSchema)}},sessionId:i.sessionId})).status===`session_not_active`)return err({cause:Error(`Agent session "${i.sessionId}" is no longer active.`),deliveryAmbiguous:!1,permanent:!0})}catch(e){let t=isRuntimeNoActiveSessionError(e);return err({cause:e,deliveryAmbiguous:!t,permanent:t})}return ok(void 0)}function createAgentErrorResult(e){return{callId:e.action.callId,isError:!0,kind:`subagent-result`,origin:`dispatch`,output:{code:e.code,message:e.message},subagentName:e.action.kind===`remote-agent-call`?e.action.remoteAgentName:e.action.subagentName}}function readSubagentMessage(e){return typeof e.input.message==`string`?e.input.message:``}export{createAgentErrorResult,dispatchToAgentHandle,dispatchToTaskAgentAddress,isAgentHandleAction};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{createLogger}from"#internal/logging.js";import{ActivityObserverKey,SessionCallbackKey}from"#context/keys.js";import{toErrorMessage}from"#shared/errors.js";import{parseJsonValue}from"#shared/json.js";import{ChannelKey}from"#runtime/sessions/runtime-context-keys.js";import{parseSessionCallback}from"#channel/session-callback.js";import{resumeHook}from"#internal/workflow/runtime.js";import{SUBAGENT_EXECUTION_FAILED}from"#harness/agent-handle-errors.js";import{readTaskIdFromInboxToken}from"#tasks/task-inbox-token.js";import{deserializeContext}from"#context/serialize.js";import{HookNotFoundError}from"#compiled/@workflow/errors/index.js";import{SUBAGENT_ADAPTER_KIND,isSubagentAdapterState}from"#execution/subagent-adapter-state.js";import{postSessionCallbackRequest}from"#execution/session-callback-request.js";const log=createLogger(`execution.delegated-parent-notification`);async function notifyDelegatedParentStep(e){"use step";if(e.result===void 0)return;let t=(await deserializeContext(e.serializedContext)).get(ChannelKey);if(t?.kind!==SUBAGENT_ADAPTER_KIND)return;let n=String(t.state?.parentContinuationToken??``);n!==``&&await resumeHook(n,{kind:`runtime-action-result`,results:[e.usage===void 0?e.result:{...e.result,outcome:{...e.result.outcome,usageDelta:e.usage},usage:e.usage}]})}const ZERO_TOKEN_USAGE={cacheReadTokens:0,cacheWriteTokens:0,inputTokens:0,outputTokens:0};async function notifyTurnCallerStep(e){"use step";if(e.caller===void 0)return;let t=createSettledTurnResult({caller:e.caller,lifecycle:e.lifecycle,sessionId:e.sessionId,settled:e.settled});if(e.caller.replyTo.kind===`callback`){await postSettledTurnCallback({result:t,sessionId:e.sessionId,url:e.caller.replyTo.url});return}await resumeSettledTurnHook(e.caller.replyTo.token,t)}async function notifyCancelledTaskCallerStep(e){"use step";if(e.caller?.taskId===void 0)return;let t=e.usage??ZERO_TOKEN_USAGE,n={callId:e.caller.callId,kind:`subagent-result`,origin:`child`,outcome:{kind:`parked`,result:{kind:`cancelled`},usageDelta:t},output:``,subagentName:e.caller.subagentName},r=e.usage===void 0?n:{...n,usage:e.usage};if(e.caller.replyTo.kind===`callback`){await postSettledTurnCallback({result:r,sessionId:e.sessionId,url:e.caller.replyTo.url});return}await resumeSettledTurnHook(e.caller.replyTo.token,r)}async function notifyTaskTurnStartedStep(e){"use step";let t=e.caller?.taskId;if(e.caller===void 0||t===void 0)return;let n={childSessionId:e.childSessionId,childTurnId:e.childTurnId,kind:`turn-started`,taskId:t};if(e.caller.replyTo.kind===`hook`){await resumeHook(e.caller.replyTo.token,n);return}let r=await postSessionCallbackRequest({body:{callId:e.caller.callId,kind:`turn.started`,sessionId:e.childSessionId,subagentName:e.caller.subagentName,taskId:t,turnId:e.childTurnId},url:e.caller.replyTo.url});if(!r.ok)throw Error(`Task turn-start callback failed with HTTP ${r.status}.`)}function createSettledTurnResult(e){let t=e.settled.usage??ZERO_TOKEN_USAGE;if(e.settled.isError===!0){let n={code:SUBAGENT_EXECUTION_FAILED,message:toErrorMessage(e.settled.output)};return{callId:e.caller.callId,isError:!0,kind:`subagent-result`,origin:`child`,outcome:{kind:e.lifecycle,result:{error:n,kind:`failed`},usageDelta:t},output:n,subagentName:e.caller.subagentName}}let n=parseJsonValue(e.settled.output),a={callId:e.caller.callId,kind:`subagent-result`,origin:`child`,outcome:{kind:e.lifecycle,result:{kind:`succeeded`,output:n},usageDelta:t},output:n,subagentName:e.caller.subagentName};return e.settled.usage===void 0?a:{...a,usage:e.settled.usage}}async function resolveInitialTurnCallerStep(e){"use step";let t=e.serializedContext[SessionCallbackKey.name];if(t!==void 0){let e=parseSessionCallback(t);if(!e.ok)throw Error(`Serialized session callback is invalid.`,{cause:e.cause});return{callId:e.callback.callId,replyTo:{kind:`callback`,token:e.callback.token,url:e.callback.url},subagentName:e.callback.subagentName,taskId:e.callback.taskId??readTaskIdFromInboxToken(e.callback.token)}}let r=(await deserializeContext(e.serializedContext)).get(ChannelKey);if(!(r?.kind!==SUBAGENT_ADAPTER_KIND||!isSubagentAdapterState(r.state)))return{callId:r.state.callId,replyTo:{kind:`hook`,token:r.state.parentContinuationToken},subagentName:r.state.subagentName,taskId:readTaskIdFromInboxToken(r.state.parentContinuationToken)}}async function bindTurnCallerContextStep(e){"use step";let r=e.caller;if(r===void 0)return e.serializedContext;let i=r.activityObserver===void 0?e.serializedContext:{...e.serializedContext,[ActivityObserverKey.name]:r.activityObserver};if(r.replyTo.kind===`callback`){let e={callId:r.callId,subagentName:r.subagentName,token:r.replyTo.token,url:r.replyTo.url};return{...i,[SessionCallbackKey.name]:r.taskId===void 0?e:{...e,taskId:r.taskId}}}let o=i[ChannelKey.name];if(typeof o!=`object`||!o||Reflect.get(o,`kind`)!==SUBAGENT_ADAPTER_KIND||!isSubagentAdapterState(Reflect.get(o,`state`)))throw Error(`Delegated local turn is missing its subagent adapter binding.`);let s=Reflect.get(o,`state`);return{...i,[ChannelKey.name]:{...o,state:{...s,callId:r.callId,parentContinuationToken:r.replyTo.token,subagentName:r.subagentName}}}}async function postSettledTurnCallback(e){let{sessionId:t}=e;if(e.result.isError===!0){await postCallbackPayload({payload:{callId:e.result.callId,error:e.result.output,kind:`turn.failed`,outcome:e.result.outcome,sessionId:t,subagentName:e.result.subagentName},url:e.url});return}await postCallbackPayload({payload:{callId:e.result.callId,kind:`turn.completed`,outcome:e.result.outcome,output:e.result.output,sessionId:t,subagentName:e.result.subagentName},url:e.url})}async function postCallbackPayload(e){let t=await postSessionCallbackRequest({body:e.payload,url:e.url});if(!t.ok)throw Error(`Turn callback failed with HTTP ${t.status}.`)}async function resumeSettledTurnHook(e,t){try{await resumeHook(e,{kind:`runtime-action-result`,results:[t]})}catch(n){if(!HookNotFoundError.is(n))throw n;log.warn(`turn caller hook no longer exists`,{callId:t.callId,callerToken:e})}}export{bindTurnCallerContextStep,notifyCancelledTaskCallerStep,notifyDelegatedParentStep,notifyTaskTurnStartedStep,notifyTurnCallerStep,resolveInitialTurnCallerStep};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{toErrorMessage}from"#shared/errors.js";import{CHANNEL_CONTEXT_KEY_NAME}from"#context/key-names.js";import{SUBAGENT_EXECUTION_FAILED}from"#harness/agent-handle-errors.js";import{SUBAGENT_ADAPTER_KIND}from"#execution/subagent-adapter-state.js";const ZERO_TOKEN_USAGE={cacheReadTokens:0,cacheWriteTokens:0,inputTokens:0,outputTokens:0};function createDelegatedSubagentSuccessResult(e,n){let i=e[CHANNEL_CONTEXT_KEY_NAME];if(i?.kind===SUBAGENT_ADAPTER_KIND)return{callId:String(i.state?.callId??``),kind:`subagent-result`,origin:`child`,outcome:{kind:`terminal`,result:{kind:`succeeded`,output:n},usageDelta:ZERO_TOKEN_USAGE},output:n,subagentName:String(i.state?.subagentName??``)}}function createDelegatedSubagentErrorResult(t,r){let i=createDelegatedSubagentSuccessResult(t,``);if(i===void 0)return;let a={code:SUBAGENT_EXECUTION_FAILED,message:toErrorMessage(r)};return{...i,isError:!0,outcome:{kind:`terminal`,result:{error:a,kind:`failed`},usageDelta:ZERO_TOKEN_USAGE},output:a}}export{createDelegatedSubagentErrorResult,createDelegatedSubagentSuccessResult};
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import type { HarnessToolDefinition } from "#harness/execute-tool.js";
|
|
2
|
-
import type { PreparedRuntimeDelegationTool } from "#runtime/sessions/turn.js";
|
|
3
|
-
import { type ToolSchemaSource } from "#tools/schema.js";
|
|
4
|
-
type HarnessDelegationTool = Pick<PreparedRuntimeDelegationTool, "behavior" | "description" | "name"> & {
|
|
5
|
-
readonly inputSchema?: ToolSchemaSource | null;
|
|
6
|
-
readonly outputSchema?: ToolSchemaSource | null;
|
|
7
|
-
};
|
|
8
|
-
export declare function createHarnessDelegationToolDefinition(tool: HarnessDelegationTool): HarnessToolDefinition;
|
|
9
|
-
export declare function createBackgroundSubagentHarnessDefinition(tool: HarnessDelegationTool): HarnessToolDefinition;
|
|
10
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{UNSPECIFIED_INPUT_SCHEMA,toInputSchema,toOutputSchema}from"#tools/schema.js";import{createToolExecuteWithAuth}from"#execution/tool-auth.js";import{defineSubagent}from"#execution/tools/subagent/local.js";import{defineRemoteSubagent}from"#execution/tools/subagent/remote.js";function createHarnessDelegationToolDefinition(t){return{behavior:t.behavior,description:t.description??``,inputSchema:toInputSchema(t.inputSchema)??UNSPECIFIED_INPUT_SCHEMA,name:t.name,outputSchema:toOutputSchema(t.outputSchema)??void 0}}function createBackgroundSubagentHarnessDefinition(n){let r=n.behavior?.handling;if(r?.kind!==`dispatch`)throw Error(`Background subagent tool "${n.name}" has no prepared dispatch target.`);if(r.target.kind===`task-cancel`||r.target.kind===`task-update`||r.target.kind===`workflow-tool-call`)throw Error(`Background subagent tool "${n.name}" cannot dispatch ${r.target.kind}.`);let i=createBackgroundSubagentDefinition({description:n.description??``,name:n.name,target:r.target}),a=createToolExecuteWithAuth({execute:i.execute,execution:i.execution,scope:n.name});return{behavior:n.behavior,description:i.description,execute:a,execution:i.execution,inputSchema:toInputSchema(i.inputSchema)??UNSPECIFIED_INPUT_SCHEMA,name:n.name,outputSchema:toOutputSchema(i.outputSchema)??void 0}}function createBackgroundSubagentDefinition(e){switch(e.target.kind){case`remote-agent-call`:return defineRemoteSubagent({description:e.description,name:e.name,target:e.target});case`self-agent-call`:case`subagent-call`:return defineSubagent({description:e.description,name:e.name,target:e.target})}}export{createBackgroundSubagentHarnessDefinition,createHarnessDelegationToolDefinition};
|
|
@@ -1,165 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Machinery shared by the two runtime-action dispatch steps:
|
|
3
|
-
* `dispatchRuntimeActionsStep` (plain mode) and `dispatchTaskStep`
|
|
4
|
-
* (task mode). Both run the same preflight → plan → dispatch → emit
|
|
5
|
-
* skeleton over one pending batch and differ only in the per-entry
|
|
6
|
-
* delegation lifecycle, so planning and the replay-safe
|
|
7
|
-
* `subagent.called` emission tail live here.
|
|
8
|
-
*/
|
|
9
|
-
import type { ActivityObserverConfig, SessionParent } from "#channel/types.js";
|
|
10
|
-
import { type ChannelAdapter, type ChannelAdapterContext } from "#channel/adapter.js";
|
|
11
|
-
import { type LocalDevRequestProvenance } from "#context/keys.js";
|
|
12
|
-
import { type AlsContext } from "#context/container.js";
|
|
13
|
-
import { type CompiledBundle } from "#runtime/sessions/runtime-context-keys.js";
|
|
14
|
-
import { type DispatchOutcome, type RuntimeAgentHandleAction, type RuntimeSession } from "#execution/agent-handle-dispatch.js";
|
|
15
|
-
import { getPendingRuntimeActionBatch } from "#harness/runtime-actions.js";
|
|
16
|
-
import type { ActivityWorkIdentityV1 } from "#protocol/activity.js";
|
|
17
|
-
import type { RuntimeActionResult, RuntimeRemoteAgentCallActionRequest, RuntimeSubagentCallActionRequest, RuntimeSubagentDispatchFailure } from "#shared/action-types.js";
|
|
18
|
-
import type { PendingAgentDispatchAction, PendingTaskControlAction, PendingWorkflowToolAction } from "#shared/dispatch-action.js";
|
|
19
|
-
import { type DurableSessionState } from "#execution/durable-session-store.js";
|
|
20
|
-
import { buildSubagentRunInput, type SubagentInputSource } from "#execution/subagent-tool.js";
|
|
21
|
-
import { getDynamicSubagentSelection } from "#context/dynamic-subagent-lifecycle.js";
|
|
22
|
-
type DynamicSubagentAgentConfig = NonNullable<Extract<ReturnType<typeof getDynamicSubagentSelection>, {
|
|
23
|
-
readonly kind: "subagent";
|
|
24
|
-
}>["agentConfig"]>;
|
|
25
|
-
type DynamicRemoteAgentConfig = NonNullable<Extract<ReturnType<typeof getDynamicSubagentSelection>, {
|
|
26
|
-
readonly kind: "remote";
|
|
27
|
-
}>["remoteAgent"]>;
|
|
28
|
-
export type DispatchPlanEntry = {
|
|
29
|
-
readonly kind: "resume";
|
|
30
|
-
readonly action: RuntimeAgentHandleAction;
|
|
31
|
-
readonly agentId: string;
|
|
32
|
-
readonly dynamicRemoteAgent?: DynamicRemoteAgentConfig;
|
|
33
|
-
} | {
|
|
34
|
-
readonly kind: "reject";
|
|
35
|
-
readonly result: RuntimeSubagentDispatchFailure;
|
|
36
|
-
} | {
|
|
37
|
-
readonly kind: "start";
|
|
38
|
-
readonly target: DispatchStartTarget;
|
|
39
|
-
} | {
|
|
40
|
-
readonly kind: "task-control";
|
|
41
|
-
readonly action: PendingTaskControlAction;
|
|
42
|
-
} | {
|
|
43
|
-
readonly kind: "workflow-tool";
|
|
44
|
-
readonly action: PendingWorkflowToolAction;
|
|
45
|
-
};
|
|
46
|
-
export type DispatchStartTarget = {
|
|
47
|
-
readonly kind: "local";
|
|
48
|
-
readonly action: RuntimeSubagentCallActionRequest;
|
|
49
|
-
readonly dynamicSubagentAgentConfig?: DynamicSubagentAgentConfig;
|
|
50
|
-
readonly selfAgent: boolean;
|
|
51
|
-
readonly source: SubagentInputSource;
|
|
52
|
-
} | {
|
|
53
|
-
readonly kind: "remote";
|
|
54
|
-
readonly action: RuntimeRemoteAgentCallActionRequest;
|
|
55
|
-
readonly dynamicRemoteAgent?: DynamicRemoteAgentConfig;
|
|
56
|
-
};
|
|
57
|
-
/** Input contract shared by both dispatch steps so the turn workflow can select either. */
|
|
58
|
-
export interface RuntimeActionDispatchInput {
|
|
59
|
-
readonly callbackBaseUrl?: string;
|
|
60
|
-
/** Internal hook that receives child completion and HITL payloads. */
|
|
61
|
-
readonly parentContinuationToken?: string;
|
|
62
|
-
readonly parentWritable: WritableStream<Uint8Array>;
|
|
63
|
-
readonly serializedContext: Record<string, unknown>;
|
|
64
|
-
readonly sessionState: DurableSessionState;
|
|
65
|
-
}
|
|
66
|
-
/**
|
|
67
|
-
* Result contract shared by both dispatch steps. `pendingTasks` is
|
|
68
|
-
* always empty in plain mode; keeping it on both keeps the turn
|
|
69
|
-
* workflow's acknowledgement call site uniform.
|
|
70
|
-
*/
|
|
71
|
-
export interface RuntimeActionDispatchResult {
|
|
72
|
-
readonly results: readonly RuntimeActionResult[];
|
|
73
|
-
readonly sessionState: DurableSessionState;
|
|
74
|
-
readonly pendingTasks: readonly {
|
|
75
|
-
readonly taskInboxToken: string;
|
|
76
|
-
readonly taskId: string;
|
|
77
|
-
readonly taskRunId: string;
|
|
78
|
-
}[];
|
|
79
|
-
}
|
|
80
|
-
/** Everything preflight produces before either step's dispatch loop runs. */
|
|
81
|
-
export interface PreparedRuntimeActionDispatch {
|
|
82
|
-
readonly adapter: ChannelAdapter;
|
|
83
|
-
readonly adapterCtx: ChannelAdapterContext;
|
|
84
|
-
readonly auth: Parameters<typeof buildSubagentRunInput>[0]["auth"];
|
|
85
|
-
readonly batch: NonNullable<ReturnType<typeof getPendingRuntimeActionBatch>>;
|
|
86
|
-
readonly bundle: CompiledBundle;
|
|
87
|
-
readonly capabilities: Parameters<typeof buildSubagentRunInput>[0]["capabilities"];
|
|
88
|
-
readonly channelMetadata: Parameters<typeof buildSubagentRunInput>[0]["channelMetadata"];
|
|
89
|
-
/**
|
|
90
|
-
* Number of freshly started local subagents in the plan. The parent's
|
|
91
|
-
* remaining token quota is split across these, the children that
|
|
92
|
-
* actually receive an enforced cap: continuations already run under
|
|
93
|
-
* their own budget, and remote agents run on their own deployment
|
|
94
|
-
* under their own limits, so neither dilutes the local shares.
|
|
95
|
-
*/
|
|
96
|
-
readonly fanoutSize: number;
|
|
97
|
-
readonly initiatorAuth: Parameters<typeof buildSubagentRunInput>[0]["initiatorAuth"];
|
|
98
|
-
readonly localDevRequest?: LocalDevRequestProvenance;
|
|
99
|
-
/** Lineage of the session running this dispatch, when it is itself a delegated child. */
|
|
100
|
-
readonly parentSession: SessionParent | undefined;
|
|
101
|
-
readonly parentTraceContext: Parameters<typeof buildSubagentRunInput>[0]["parentTraceContext"];
|
|
102
|
-
readonly activityObserver?: ActivityObserverConfig & {
|
|
103
|
-
readonly workIdentity: ActivityWorkIdentityV1;
|
|
104
|
-
};
|
|
105
|
-
readonly sandboxSessionId: string;
|
|
106
|
-
readonly serializedContext: Record<string, unknown>;
|
|
107
|
-
readonly plan: readonly DispatchPlanEntry[];
|
|
108
|
-
readonly session: RuntimeSession;
|
|
109
|
-
}
|
|
110
|
-
interface PreparedPendingRuntimeActionDispatch extends PreparedRuntimeActionDispatch {
|
|
111
|
-
/** Returns the durable baseline corresponding to `session`. */
|
|
112
|
-
readonly getBaselineSessionState: () => DurableSessionState;
|
|
113
|
-
}
|
|
114
|
-
/**
|
|
115
|
-
* Runs every dispatch precondition that may throw — durable reads, context
|
|
116
|
-
* deserialization, handle-store validation, and batch planning — before
|
|
117
|
-
* the caller acquires the parent stream writer, so a preflight failure
|
|
118
|
-
* never leaks the writer lock. Returns undefined when no actions are
|
|
119
|
-
* pending.
|
|
120
|
-
*/
|
|
121
|
-
export declare function prepareRuntimeActionDispatch(input: {
|
|
122
|
-
readonly serializedContext: Record<string, unknown>;
|
|
123
|
-
readonly sessionState: DurableSessionState;
|
|
124
|
-
/**
|
|
125
|
-
* Classify task-control calls as
|
|
126
|
-
* task-control plan entries. Only task mode plans them; in plain mode
|
|
127
|
-
* those calls fail as unsupported batch actions.
|
|
128
|
-
*/
|
|
129
|
-
readonly taskControls: boolean;
|
|
130
|
-
}): Promise<PreparedPendingRuntimeActionDispatch | undefined>;
|
|
131
|
-
export declare function prepareAgentActionDispatch(input: {
|
|
132
|
-
readonly action: PendingAgentDispatchAction;
|
|
133
|
-
readonly ctx: AlsContext;
|
|
134
|
-
readonly event: {
|
|
135
|
-
readonly sequence: number;
|
|
136
|
-
readonly stepIndex: number;
|
|
137
|
-
readonly turnId: string;
|
|
138
|
-
};
|
|
139
|
-
readonly localFanoutSize: number;
|
|
140
|
-
readonly serializedContext: Record<string, unknown>;
|
|
141
|
-
readonly sessionState: DurableSessionState;
|
|
142
|
-
}): Promise<PreparedRuntimeActionDispatch>;
|
|
143
|
-
/**
|
|
144
|
-
* Emits the parent `subagent.called` control-plane event for one adopted
|
|
145
|
-
* child. Emission is observability, not control flow: a failure is logged
|
|
146
|
-
* and swallowed, because a throw escaping the dispatch loop would durably
|
|
147
|
-
* replay the step and re-dispatch children that already started.
|
|
148
|
-
*/
|
|
149
|
-
export declare function emitSubagentCalled(input: {
|
|
150
|
-
readonly adapter: ChannelAdapter;
|
|
151
|
-
readonly adapterCtx: ChannelAdapterContext;
|
|
152
|
-
readonly batchEvent: {
|
|
153
|
-
readonly sequence: number;
|
|
154
|
-
readonly turnId: string;
|
|
155
|
-
};
|
|
156
|
-
readonly entry: Extract<DispatchPlanEntry, {
|
|
157
|
-
readonly kind: "resume" | "start";
|
|
158
|
-
}>;
|
|
159
|
-
readonly outcome: Extract<DispatchOutcome, {
|
|
160
|
-
readonly kind: "called";
|
|
161
|
-
}>;
|
|
162
|
-
readonly sessionId: string;
|
|
163
|
-
readonly writer: WritableStreamDefaultWriter<Uint8Array>;
|
|
164
|
-
}): Promise<void>;
|
|
165
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{createLogger,logError}from"#internal/logging.js";import{callAdapterEventHandler}from"#channel/adapter.js";import{ContextContainer}from"#context/container.js";import{ActivityObserverKey,AuthKey,CapabilitiesKey,ChannelInstrumentationKey,InitiatorAuthKey,ParentSessionKey,SandboxKey}from"#context/keys.js";import{createSubagentCalledEvent,encodeMessageStreamEvent,stampMessageStreamEvent}from"#protocol/message.js";import{BundleKey,ChannelKey}from"#runtime/sessions/runtime-context-keys.js";import{workflowEntryReference}from"#execution/workflow-runtime.js";import{deriveRootTurnActivityWorkId}from"#execution/activity-work-id.js";import{getAgentHandleStore}from"#harness/handles/store.js";import{deserializeContext}from"#context/serialize.js";import{createDurableSessionState,readDurableSession}from"#execution/durable-session-store.js";import{getDynamicSubagentSelection}from"#context/dynamic-subagent-lifecycle.js";import{hydrateDurableSession}from"#execution/session.js";import{resolveEffectiveAgentRuntime}from"#execution/effective-agent-config.js";import{buildAdapterContext}from"#channel/adapter-context.js";import{withContextScope}from"#context/run-step.js";import"#execution/agent-handle-dispatch.js";import{assertUniqueRuntimeActionCallIds,getPendingRuntimeActionBatch,setPendingRuntimeActionBatch}from"#harness/runtime-actions.js";import{activeTurnId}from"#harness/active-turn-id.js";import{createRecursiveAgentRootOnlyResult,createUnavailableDynamicSubagentResult,getSubagentName}from"#execution/dispatch-action-failures.js";import"#execution/subagent-tool.js";import{readSessionTraceContext}from"#tracing/agent-trace-context-store.js";import{isSubagentDelegationAction,resolveSubagentDepth}from"#harness/subagent-depth.js";import{isTaskControlAction}from"#execution/tasks/parent/dispatch.js";import{isWorkflowToolAction}from"#execution/tool-run/dispatch.js";import{resolvePreparedAgentAction}from"#execution/prepared-agent-action.js";const log=createLogger(`execution.dispatch-runtime-actions`);async function prepareRuntimeActionDispatch(e){let t=await readDurableSession(e.sessionState),n=getPendingRuntimeActionBatch(t.state);if(n===void 0||n.actions.length===0)return;let r=n.event.turnId||activeTurnId(e.sessionState.emissionState),i=n.event.turnId!==r,a=i?{...n,event:{...n.event,turnId:r}}:n,o=await prepareActionDispatch({batch:a,ctx:await deserializeContext(e.serializedContext),durableSession:t,serializedContext:e.serializedContext,taskControls:e.taskControls});if(!i)return{...o,getBaselineSessionState:()=>e.sessionState};let s=setPendingRuntimeActionBatch({...a,session:o.session});return{...o,getBaselineSessionState:()=>createDurableSessionState({session:s}),session:s}}async function prepareAgentActionDispatch(e){let t=await readDurableSession(e.sessionState);return await prepareActionDispatch({batch:{actions:[e.action],event:e.event,responseMessages:[]},ctx:copyDurableContext(e.ctx),durableSession:t,fanoutSize:e.localFanoutSize,serializedContext:e.serializedContext,taskControls:!1})}function copyDurableContext(e){let t=new ContextContainer;for(let[n,r]of e.entries())t.set(n,r);return t}async function prepareActionDispatch(e){let{batch:t,durableSession:n}=e;assertUniqueRuntimeActionCallIds(t.actions);let r=e.ctx,c=r.require(BundleKey),l=resolveEffectiveAgentRuntime(c,r),u=hydrateDurableSession({compactionOverrides:{thresholdPercent:l.thresholdPercent},durable:n,turnAgent:l.turnAgent}),d=r.require(ChannelKey);getAgentHandleStore(n.state);let f=planDispatch({actions:t.actions,bundle:c,ctx:r,session:u,taskControls:e.taskControls}),p=resolveActiveSandboxSessionId(d.state,u.sessionId);if(planSharesSandbox({bundle:c,plan:f}))try{u=(await withContextScope(r,u,async e=>(await r.require(SandboxKey).get(),{result:void 0,session:e}))).session}finally{r.clearVirtualContext()}return{adapter:d,adapterCtx:buildAdapterContext(d,r),auth:r.get(AuthKey)??null,batch:t,bundle:c,capabilities:r.get(CapabilitiesKey),channelMetadata:r.get(ChannelInstrumentationKey),fanoutSize:e.fanoutSize??f.filter(e=>e.kind===`start`&&e.target.kind===`local`).length,initiatorAuth:r.get(InitiatorAuthKey)??null,localDevRequest:r.localDevRequest,parentSession:r.get(ParentSessionKey),parentTraceContext:readSessionTraceContext(e.serializedContext,u.sessionId),plan:f,activityObserver:resolvePreparedActivity(r.get(ActivityObserverKey),u,t.event.turnId),sandboxSessionId:p,serializedContext:e.serializedContext,session:u}}function resolvePreparedActivity(e,t,n){if(e!==void 0)return{sink:e.sink,workIdentity:e.workIdentity??{id:deriveRootTurnActivityWorkId({sessionId:t.sessionId,turnId:n}),kind:`root-turn`,rootSessionId:t.rootSessionId??t.sessionId,rootTurnId:n,sessionId:t.sessionId,turnId:n}}}function planSharesSandbox(e){let t=e.bundle.graph;return e.plan.some(e=>e.kind!==`start`||e.target.kind!==`local`?!1:e.target.selfAgent||t?.nodesByNodeId.get(e.target.action.nodeId)?.sandboxRegistry.sandbox.definition.inheritsParent===!0)}function resolveActiveSandboxSessionId(e,t){if(typeof e!=`object`||!e)return t;let n=e.sandboxSessionId;return typeof n==`string`&&n.length>0?n:t}async function emitSubagentCalled(e){let{entry:r,outcome:i}=e;try{let t=r.kind===`resume`?r.action:r.target.action,a=r.kind===`resume`?r.dynamicRemoteAgent:r.target.kind===`remote`?r.target.dynamicRemoteAgent:void 0,o=await callAdapterEventHandler(e.adapter,createSubagentCalledEvent({callId:i.callId,childSessionId:i.address.sessionId,name:i.name,remote:i.address.kind===`agent/remote`?{resolverId:a===void 0?t.nodeId:a.credentialsStepId,url:i.address.url}:void 0,sequence:e.batchEvent.sequence,sessionId:e.sessionId,toolName:i.toolName,turnId:e.batchEvent.turnId,workflowId:workflowEntryReference.workflowId}),e.adapterCtx);await e.writer.write(encodeMessageStreamEvent(stampMessageStreamEvent(o)))}catch(e){logError(log,`subagent.called emission failed`,e,{callId:i.callId,childSessionId:i.address.sessionId,toolName:i.toolName})}}function planDispatch(e){let t=getAgentHandleStore(e.session.state)?.handles??[];return e.actions.map(n=>{if(e.taskControls&&isTaskControlAction(n))return{action:n,kind:`task-control`};if(isWorkflowToolAction(n))return{action:n,kind:`workflow-tool`};if(!isSubagentDelegationAction(n))throw Error(`Unsupported prepared dispatch target "${n.target.kind}" in workflow runtime.`);let r=resolvePreparedAgentAction(n),i=n.input.agentId,a=typeof i==`string`&&i.trim()!==``?i:void 0;if(a!==void 0){if(t.some(e=>e.identity.id===a)){let t=e.bundle.subagentRegistry.dynamicNodeIds?.has(r.action.nodeId)===!0?getDynamicSubagentSelection(e.ctx,r.action.nodeId):void 0;return{action:r.action,agentId:a,dynamicRemoteAgent:r.action.kind===`remote-agent-call`&&t?.kind===`remote`?t.remoteAgent:void 0,kind:`resume`}}log.warn(`unknown agentId on subagent call; starting a new agent`,{agentId:a,callId:n.callId})}return classifyFreshStart({action:r.action,bundle:e.bundle,ctx:e.ctx,selfAgent:r.selfAgent,session:e.session})})}function classifyFreshStart(e){let{action:t}=e,n=e.bundle.subagentRegistry.subagentsByNodeId,r=resolveSubagentDepth(e.session),i=e.session.rootSessionId!==void 0||r.currentDepth>0,a=(t.kind===`subagent-call`||t.kind===`remote-agent-call`)&&e.bundle.subagentRegistry.dynamicNodeIds?.has(t.nodeId)===!0,o=a?getDynamicSubagentSelection(e.ctx,t.nodeId):void 0;if(a&&(o===void 0||t.kind===`subagent-call`&&o.kind!==`subagent`||t.kind===`remote-agent-call`&&o.kind!==`remote`)){let e=getSubagentName(t);return log.warn(`dynamic subagent call blocked after availability changed`,{callId:t.callId,nodeId:t.nodeId,subagentName:e}),{kind:`reject`,result:createUnavailableDynamicSubagentResult(t)}}if(e.selfAgent&&t.kind!==`subagent-call`)throw Error(`A self-agent dispatch target must resolve to a local subagent action.`);if(e.selfAgent&&i&&t.kind===`subagent-call`)return log.warn(`recursive agent call blocked outside the root session`,{callId:t.callId,currentDepth:r.currentDepth,nodeId:t.nodeId,subagentName:t.subagentName}),{kind:`reject`,result:createRecursiveAgentRootOnlyResult(t)};switch(t.kind){case`subagent-call`:{let r=o?.kind===`subagent`?o.agentConfig:void 0,i=n.get(t.nodeId),a=r?.description??(i?.definition.kind===`subagent`?i.definition.description:void 0),s=a===void 0?{outputSchema:e.bundle.turnAgent.outputSchema,type:`runtime`}:{description:a,outputSchema:r?.outputSchema??e.bundle.graph?.nodesByNodeId.get(t.nodeId)?.turnAgent?.outputSchema,type:`local`};return{kind:`start`,target:{action:t,dynamicSubagentAgentConfig:r,kind:`local`,selfAgent:e.selfAgent,source:s}}}case`remote-agent-call`:return{kind:`start`,target:{action:t,dynamicRemoteAgent:o?.kind===`remote`?o.remoteAgent:void 0,kind:`remote`}};default:return t}}export{emitSubagentCalled,prepareAgentActionDispatch,prepareRuntimeActionDispatch};
|