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
|
@@ -1 +0,0 @@
|
|
|
1
|
-
const WORKFLOW_TOOL_EXECUTOR_KIND=`workflow-tool`;export{WORKFLOW_TOOL_EXECUTOR_KIND};
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import type { ToolRunWorkflowInput } from "#execution/tool-run/types.js";
|
|
2
|
-
/**
|
|
3
|
-
* Runs one authored workflow tool call. The run's own hook is its identity
|
|
4
|
-
* claim and its control inbox: a duplicate start loses the claim and exits; a
|
|
5
|
-
* `cancel` message aborts `ctx.abortSignal`, and the run waits up to
|
|
6
|
-
* {@link CANCEL_GRACE} for the body to unwind before ending as cancelled, so a
|
|
7
|
-
* body parked on a hook or sleep cannot keep a cancelled run alive.
|
|
8
|
-
*/
|
|
9
|
-
export declare function toolRunWorkflow(input: ToolRunWorkflowInput): Promise<void>;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{getWorkflowMetadata,sleep}from"#compiled/@workflow/core/index.js";import{claimHookOwnership,disposeHook,isHookConflictError}from"#execution/hook-ownership.js";import{attachRunContext}from"#execution/tool-run/messages.js";import{resumeHookStep}from"#execution/tool-run/resume-hook-step.js";import{openRunControlInbox}from"#execution/tool-run/run-control.js";import{normalizeSerializableError}from"#execution/workflow-errors.js";import{readRegisteredWorkflow}from"#execution/workflow-registry.js";function noop(){}async function toolRunWorkflow(e){"use workflow";let s=openRunControlInbox(e.hookToken),c=!1;try{try{await claimHookOwnership(s.hook),c=!0}catch(e){if(isHookConflictError(e))return;throw e}let r=readRunId(),o={callId:e.callId,input:e.input,runId:r,sequence:e.session.turn.sequence,stepIndex:e.stepIndex,toolName:e.toolName,turnId:e.session.turn.id},l=createWorkflowToolContext(e,s.signal);attachRunContext(l,{from:o,owner:e.owner});let u=runBody(e,l,o),d=u.catch(noop),f;try{f={output:await Promise.race([u,s.cancelled]),status:`completed`}}catch(e){s.signal.aborted?(await Promise.race([d,sleep(`30s`)]),f={reason:s.reason(),status:`cancelled`}):f={error:normalizeSerializableError(e),status:`failed`}}let p={from:o,result:f};await resumeHookStep(e.owner.outcome,p,{ifPresent:f.status===`cancelled`})}finally{c&&await disposeHook(s.hook)}}async function runBody(e,t,n){let r=resolveWorkflowToolExecute(e)(e.input,t);if(!isAsyncIterable(r))return await r;let i=r[Symbol.asyncIterator](),a,o=await i.next();for(;o.done!==!0;){a=o.value;let t={from:n,update:o.value};await resumeHookStep(e.owner.report,t),o=await i.next()}return o.value??a??null}function isAsyncIterable(e){return typeof e==`object`&&!!e&&typeof e[Symbol.asyncIterator]==`function`}function readRunId(){let t=getWorkflowMetadata().workflowRunId;if(typeof t!=`string`)throw Error(`The tool run has no workflow run id.`);return t}function resolveWorkflowToolExecute(e){let t=readRegisteredWorkflow(e.workflowId);if(typeof t!=`function`)throw Error(`Tool "${e.toolName}" is not registered as a workflow in this deployment (${e.workflowId}). The tool was renamed or removed after this run started.`);return t}function createWorkflowToolContext(e,t){let{callId:n,session:r,toolName:i}=e,unavailable=(e,t)=>{throw Error(`ctx.${e} is not available inside a workflow tool; ${t}. Tool "${i}" runs as a durable workflow body, which only replays deterministic code.`)};return{abortSignal:t,callId:n,getSandbox:()=>unavailable(`getSandbox()`,`the session sandbox belongs to the turn`),getSkill:()=>unavailable(`getSkill()`,`skills are read through the session sandbox`),getToken:()=>unavailable(`getToken()`,`read credentials from the environment inside a "use step" helper`),requireAuth:()=>unavailable(`requireAuth()`,`a workflow body cannot park on authorization`),session:r,toolName:i}}export{toolRunWorkflow};
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import { type TaskExec, type ToolContext } from "#tools/definition.js";
|
|
2
|
-
import type { PendingAgentDispatchAction } from "#shared/dispatch-action.js";
|
|
3
|
-
interface SubagentDefinitionInput {
|
|
4
|
-
readonly description: string;
|
|
5
|
-
readonly name: string;
|
|
6
|
-
readonly target: PendingAgentDispatchAction["target"];
|
|
7
|
-
}
|
|
8
|
-
export declare function defineSubagent(input: SubagentDefinitionInput): import("#tools/definition.js").BackgroundToolDefinition<{
|
|
9
|
-
agentId?: string | null | undefined;
|
|
10
|
-
message: string;
|
|
11
|
-
outputSchema?: {
|
|
12
|
-
[x: string]: unknown;
|
|
13
|
-
} | undefined;
|
|
14
|
-
}, import("#tools/definition.js").TaskReceipt<{
|
|
15
|
-
agentId: string;
|
|
16
|
-
}>> & {
|
|
17
|
-
execute(input: {
|
|
18
|
-
agentId?: string | null | undefined;
|
|
19
|
-
message: string;
|
|
20
|
-
outputSchema?: {
|
|
21
|
-
[x: string]: unknown;
|
|
22
|
-
} | undefined;
|
|
23
|
-
}, ctx: ToolContext, task: TaskExec): Promise<import("#tools/definition.js").TaskDelegated<{
|
|
24
|
-
agentId: string;
|
|
25
|
-
}>>;
|
|
26
|
-
};
|
|
27
|
-
export declare function countLocalSubagentCalls(calls: readonly {
|
|
28
|
-
readonly definition: {
|
|
29
|
-
readonly behavior?: import("#tools/behavior.js").PreparedToolBehavior;
|
|
30
|
-
};
|
|
31
|
-
}[]): number;
|
|
32
|
-
export declare function executeSubagentTool(input: {
|
|
33
|
-
readonly definition: SubagentDefinitionInput;
|
|
34
|
-
readonly task: TaskExec;
|
|
35
|
-
readonly toolContext: ToolContext;
|
|
36
|
-
readonly toolInput: unknown;
|
|
37
|
-
}): Promise<import("#tools/definition.js").TaskDelegated<{
|
|
38
|
-
agentId: string;
|
|
39
|
-
}>>;
|
|
40
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{createLogger,logError}from"#internal/logging.js";import{loadContext}from"#context/container.js";import{HandleEventKey}from"#context/keys.js";import{createSubagentCalledEvent}from"#protocol/message.js";import{defineTool}from"#tools/definition.js";import{parseJsonObject}from"#shared/json.js";import{getHarnessEmissionState}from"#harness/emission.js";import{workflowEntryReference}from"#execution/workflow-runtime.js";import{serializeContext}from"#context/serialize.js";import{createDurableSessionState}from"#execution/durable-session-store.js";import{dispatchToTaskAgentAddress}from"#execution/agent-handle-dispatch.js";import{activeTurnId}from"#harness/active-turn-id.js";import{resolvePreparedAgentAction}from"#execution/prepared-agent-action.js";import{createAgentContinuationBundle}from"#execution/agent-continuation-bundle.js";import{prepareAgentActionDispatch}from"#execution/dispatch-runtime-actions-shared.js";import{startSubagent}from"#execution/dispatch-runtime-actions-start.js";import{deriveChildActivityObserverConfig}from"#execution/activity-work.js";import{CallbackBaseUrlKey}from"#harness/authorization.js";import{createSubagentExecutorBinding}from"#tasks/types.js";import{findTaskAgentAddress}from"#execution/tasks/parent/control-shared.js";import{checkTaskContinuationAvailability,createTaskContinuationBusyResult,describeTaskDispatch}from"#execution/tasks/parent/continuation-dispatch.js";import{SUBAGENT_TASK_RECEIPT_OUTPUT_SCHEMA}from"#tools/framework/task-contract.js";import{SUBAGENT_TOOL_INPUT_SCHEMA}from"#tools/framework/agent-contract.js";const batchAgentClaims=new WeakMap,log=createLogger(`runtime.framework-tools.subagent`);function defineSubagent(e){return defineTool({description:e.description,execution:`background`,inputSchema:SUBAGENT_TOOL_INPUT_SCHEMA,outputSchema:SUBAGENT_TASK_RECEIPT_OUTPUT_SCHEMA,execute:(t,n,r)=>executeSubagentTool({definition:e,task:r,toolContext:n,toolInput:t})})}function countLocalSubagentCalls(e){return e.filter(e=>{let t=e.definition.behavior?.handling;return t?.kind===`dispatch`&&(t.target.kind===`self-agent-call`||t.target.kind===`subagent-call`)}).length}async function executeSubagentTool(e){let t=loadContext(),{batch:r,session:i,task:a}=e.task,o=getHarnessEmissionState(i.state),s={callId:e.toolContext.callId,description:e.definition.description,input:parseJsonObject(SUBAGENT_TOOL_INPUT_SCHEMA.parse(e.toolInput)),target:e.definition.target,toolName:e.definition.name},c=resolvePreparedAgentAction(s).action,l=await dispatchSubagent({action:c,batch:r,callbackBaseUrl:t.get(CallbackBaseUrlKey),ctx:t,dispatchAction:s,event:{...o,turnId:activeTurnId(o)},localFanoutSize:countLocalSubagentCalls(r),serializedContext:serializeContext(t),sessionState:createDurableSessionState({session:i}),task:a}),u=findTaskAgentAddress(l.session,l.agentId);if(u===void 0)throw Error(`Subagent dispatch for "${l.agentId}" recorded no task agent address.`);let d=createSubagentExecutorBinding({address:u.address,identity:u.identity});await emitSubagentCalled$1({callId:e.toolContext.callId,childSessionId:l.address.sessionId,event:{...o,turnId:activeTurnId(o)},name:l.name,remote:l.remote,sessionId:i.sessionId,toolName:e.definition.name});let f=e.task.delegated({executor:d,receipt:{agentId:l.agentId}});return await emitSubagentCompleted({callId:e.toolContext.callId,output:JSON.stringify(f.receipt),subagentName:l.name,taskId:f.receipt.taskId}),f}async function dispatchSubagent(e){let t=await prepareAgentActionDispatch({action:e.dispatchAction,ctx:e.ctx,event:e.event,localFanoutSize:e.localFanoutSize,serializedContext:e.serializedContext,sessionState:e.sessionState}),n=t.plan[0];if(n===void 0||n.kind===`task-control`||n.kind===`workflow-tool`)throw Error(`Subagent tool dispatch produced no executable plan entry.`);if(n.kind===`reject`)throw Error(JSON.stringify(n.result.output));if(n.kind===`resume`){let r=await checkTaskContinuationAvailability({action:n.action,agentId:n.agentId,parentStepIndex:e.event.stepIndex,parentTurnId:e.event.turnId,session:t.session});if(r!==void 0)throw Error(JSON.stringify(r.output));let i=claimBatchAgent(e.batch,n.agentId,e.task.taskId);if(i!==void 0){let e=createTaskContinuationBusyResult({action:n.action,agentId:n.agentId,status:`working`,taskId:i});throw Error(JSON.stringify(e.output))}}let r=n.kind===`resume`?await dispatchToTaskAgentAddress({action:n.action,activityObserver:t.activityObserver===void 0?void 0:deriveChildActivityObserverConfig({activityObserver:t.activityObserver,callId:n.action.callId,kind:`task`,name:n.action.name,parentSessionId:t.session.sessionId,parentTurnId:e.event.turnId}),agentId:n.agentId,auth:t.auth,bundle:createAgentContinuationBundle({action:n.action,bundle:t.bundle,dynamicRemoteAgent:n.dynamicRemoteAgent}),currentSession:t.session,parentToken:e.task.taskInboxToken}):await startSubagent({auth:t.auth,batchEvent:e.event,bundle:t.bundle,callbackBaseUrl:e.callbackBaseUrl,capabilities:t.capabilities,channelMetadata:t.channelMetadata,currentSession:t.session,fanoutSize:t.fanoutSize,initiatorAuth:t.initiatorAuth,localDevRequest:t.localDevRequest,parentContinuationToken:e.task.taskInboxToken,parentTraceContext:t.parentTraceContext,activityObserver:t.activityObserver,sandboxSessionId:t.sandboxSessionId,serializedContext:t.serializedContext,session:t.session,taskOwned:!0,target:n.target});if(r.kind===`error`)throw Error(JSON.stringify(r.result.output));let i=describeTaskDispatch({action:e.action,agentId:n.kind===`resume`?n.agentId:void 0,parentSessionId:t.session.sessionId,parentTurnId:e.event.turnId,session:r.session}),a=n.kind===`resume`?n.dynamicRemoteAgent:n.target.kind===`remote`?n.target.dynamicRemoteAgent:void 0;return{address:r.address,agentId:i.agentId,mode:i.mode,name:i.name,...r.address.kind===`agent/remote`?{remote:{resolverId:a?.credentialsStepId??e.action.nodeId,url:r.address.url}}:{},session:r.session}}function claimBatchAgent(e,t,n){let r=batchAgentClaims.get(e);r===void 0&&(r=new Map,batchAgentClaims.set(e,r));let i=r.get(t);if(i!==void 0)return i;r.set(t,n)}async function emitSubagentCalled$1(e){let a=loadContext().get(HandleEventKey);if(a!==void 0)try{await a(createSubagentCalledEvent({callId:e.callId,childSessionId:e.childSessionId,name:e.name,remote:e.remote,sequence:e.event.sequence,sessionId:e.sessionId,toolName:e.toolName,turnId:e.event.turnId,workflowId:workflowEntryReference.workflowId}))}catch(n){logError(log,`subagent.called emission failed`,n,{callId:e.callId,childSessionId:e.childSessionId,toolName:e.toolName})}}async function emitSubagentCompleted(e){let i=loadContext().get(HandleEventKey);if(i!==void 0)try{await i({data:{backgroundTask:{status:`working`,taskId:e.taskId},callId:e.callId,output:e.output,subagentName:e.subagentName},type:`subagent.completed`})}catch(n){logError(log,`subagent.completed emission failed`,n,{callId:e.callId,taskId:e.taskId})}}export{countLocalSubagentCalls,defineSubagent,executeSubagentTool};
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import type { PendingAgentDispatchAction } from "#shared/dispatch-action.js";
|
|
2
|
-
export declare function defineRemoteSubagent(input: {
|
|
3
|
-
readonly description: string;
|
|
4
|
-
readonly name: string;
|
|
5
|
-
readonly target: Extract<PendingAgentDispatchAction["target"], {
|
|
6
|
-
readonly kind: "remote-agent-call";
|
|
7
|
-
}>;
|
|
8
|
-
}): import("#tools/definition.js").BackgroundToolDefinition<{
|
|
9
|
-
agentId?: string | null | undefined;
|
|
10
|
-
message: string;
|
|
11
|
-
outputSchema?: {
|
|
12
|
-
[x: string]: unknown;
|
|
13
|
-
} | undefined;
|
|
14
|
-
}, import("#tools/definition.js").TaskReceipt<{
|
|
15
|
-
agentId: string;
|
|
16
|
-
}>> & {
|
|
17
|
-
execute(input: {
|
|
18
|
-
agentId?: string | null | undefined;
|
|
19
|
-
message: string;
|
|
20
|
-
outputSchema?: {
|
|
21
|
-
[x: string]: unknown;
|
|
22
|
-
} | undefined;
|
|
23
|
-
}, ctx: import("#tools/definition.js").ToolContext, task: import("#tools/definition.js").TaskExec): Promise<import("#tools/definition.js").TaskDelegated<{
|
|
24
|
-
agentId: string;
|
|
25
|
-
}>>;
|
|
26
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{defineTool}from"#tools/definition.js";import{executeSubagentTool}from"#execution/tools/subagent/local.js";import{SUBAGENT_TASK_RECEIPT_OUTPUT_SCHEMA}from"#tools/framework/task-contract.js";import{SUBAGENT_TOOL_INPUT_SCHEMA}from"#tools/framework/agent-contract.js";function defineRemoteSubagent(r){return defineTool({description:r.description,execution:`background`,inputSchema:SUBAGENT_TOOL_INPUT_SCHEMA,outputSchema:SUBAGENT_TASK_RECEIPT_OUTPUT_SCHEMA,execute:(e,t,n)=>executeSubagentTool({definition:r,task:n,toolContext:t,toolInput:e})})}export{defineRemoteSubagent};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
const AGENT_MISMATCH=`AGENT_MISMATCH`,AGENT_UNREACHABLE=`AGENT_UNREACHABLE`,AGENT_BUSY=`AGENT_BUSY`,SUBAGENT_START_FAILED=`SUBAGENT_START_FAILED`,SUBAGENT_EXECUTION_FAILED=`SUBAGENT_EXECUTION_FAILED`,REMOTE_AGENT_START_FAILED=`REMOTE_AGENT_START_FAILED`,REMOTE_AGENT_FAILED=`REMOTE_AGENT_FAILED`,SESSION_FAILED=`SESSION_FAILED`;export{AGENT_BUSY,AGENT_MISMATCH,AGENT_UNREACHABLE,REMOTE_AGENT_FAILED,REMOTE_AGENT_START_FAILED,SESSION_FAILED,SUBAGENT_EXECUTION_FAILED,SUBAGENT_START_FAILED};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{AGENT_HANDLES_STATE_KEY}from"#harness/handles/state-key.js";function readAgentHandles(t){let n=t?.[AGENT_HANDLES_STATE_KEY];if(n===void 0)return[];let r=n.handles;return Array.isArray(r)?r:[]}function findRunningAgentHandle(e,t){return readAgentHandles(e).find(e=>e.phase===`running`&&e.operation.callId===t.callId)}function isResultBoundToRunningHandle(e,t){return t.kind!==`subagent-result`||t.origin===`dispatch`||t.backgroundTask!==void 0||findRunningAgentHandle(e,{callId:t.callId})!==void 0}function isInboxSubagentResultFromRunningHandle(e,t){return findRunningAgentHandle(e,{callId:t.callId})!==void 0}export{findRunningAgentHandle,isInboxSubagentResultFromRunningHandle,isResultBoundToRunningHandle};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{AGENT_HANDLES_STATE_KEY}from"./state-key.js";import{z}from"#compiled/zod/index.js";const nonEmptyString=z.string().min(1),identitySchema=z.strictObject({id:nonEmptyString,name:nonEmptyString,nodeId:nonEmptyString}),startOperationSchema=z.strictObject({callId:nonEmptyString,id:nonEmptyString,kind:z.literal(`start`),parentTurnId:nonEmptyString}),continueOperationSchema=z.strictObject({callId:nonEmptyString,id:nonEmptyString,kind:z.literal(`continue`),parentTurnId:nonEmptyString,previousStatus:z.string().max(120)}),startTargetSchema=z.discriminatedUnion(`kind`,[z.strictObject({continuationToken:nonEmptyString,kind:z.literal(`agent/local`)}),z.strictObject({continuationToken:nonEmptyString,kind:z.literal(`agent/self`)}),z.strictObject({callbackBaseUrl:z.url(),credentialResolver:z.strictObject({resolverId:nonEmptyString.optional()}).optional(),kind:z.literal(`agent/remote`),url:z.url()})]),addressSchema=z.discriminatedUnion(`kind`,[z.strictObject({continuationToken:nonEmptyString,kind:z.literal(`agent/local`),sessionId:nonEmptyString}),z.strictObject({continuationToken:nonEmptyString,kind:z.literal(`agent/self`),sessionId:nonEmptyString}),z.strictObject({callbackBaseUrl:z.url(),credentialResolver:z.strictObject({resolverId:nonEmptyString.optional()}).optional(),kind:z.literal(`agent/remote`),sessionId:nonEmptyString,url:z.url()})]),agentHandleSchema=z.discriminatedUnion(`phase`,[z.strictObject({identity:identitySchema,operation:startOperationSchema,phase:z.literal(`starting`),target:startTargetSchema}),z.strictObject({address:addressSchema,identity:identitySchema,operation:z.discriminatedUnion(`kind`,[startOperationSchema,continueOperationSchema]),phase:z.literal(`running`)}),z.strictObject({address:addressSchema,identity:identitySchema,lastStatus:z.string().max(120),phase:z.literal(`parked`)}),z.strictObject({address:addressSchema,identity:identitySchema,phase:z.literal(`addressed`)})]),agentHandleStoreSchema=z.strictObject({handles:z.array(agentHandleSchema)}).refine(e=>new Set(e.handles.map(e=>e.identity.id)).size===e.handles.length,{message:`Agent handle ids must be unique.`});function deriveAgentId(e,t){return`ag_${e}:${t.slice(0,12)}`}function formatAgentStatus(e){return(typeof e==`string`?e:JSON.stringify(e)??``).replaceAll(/\s+/g,` `).trim().slice(0,120)}function assertPersistableAgentHandleStore(e){let t=agentHandleStoreSchema.safeParse(e);if(!t.success)throw Error(`Refusing to persist a corrupt agent handle store: ${t.error.message}`);return t.data}function getAgentHandleStore(t){let n=t?.[AGENT_HANDLES_STATE_KEY];if(n===void 0)return;let r=agentHandleStoreSchema.safeParse(n);if(!r.success)throw Error(`Corrupt agent handle store under session state key "${AGENT_HANDLES_STATE_KEY}": ${r.error.message}`);return r.data}export{AGENT_HANDLES_STATE_KEY,assertPersistableAgentHandleStore,deriveAgentId,formatAgentStatus,getAgentHandleStore};
|
|
@@ -1,167 +0,0 @@
|
|
|
1
|
-
import { type AgentAddress, type AgentHandle, type AgentIdentity, type ContinueOperation, type StartOperation } from "#harness/handles/store.js";
|
|
2
|
-
import type { HarnessSession, SessionStateMap } from "#harness/types.js";
|
|
3
|
-
import type { AgentTurnOutcome } from "#shared/agent-turn-outcome.js";
|
|
4
|
-
/**
|
|
5
|
-
* Records intent to start a fresh child. Must be applied to the step's
|
|
6
|
-
* working snapshot before the start side effect runs, so the returned state
|
|
7
|
-
* owns any child the step may have created.
|
|
8
|
-
*
|
|
9
|
-
* The guarantee is intra-step, not exactly-once: the prepared handle
|
|
10
|
-
* durably commits only when the enclosing dispatch step's result commits.
|
|
11
|
-
* A crash between an accepted start and that commit replays the step from
|
|
12
|
-
* the pre-step snapshot and re-runs the side effect.
|
|
13
|
-
*
|
|
14
|
-
* Throws when the identity or operation already exists: fresh starts mint
|
|
15
|
-
* a new identity, so a collision means corrupted derivation, not a replay.
|
|
16
|
-
*/
|
|
17
|
-
export declare function prepareAgentStart(session: HarnessSession, input: {
|
|
18
|
-
readonly identity: AgentIdentity;
|
|
19
|
-
readonly operation: StartOperation;
|
|
20
|
-
readonly target: AgentStartTargetInput;
|
|
21
|
-
}): HarnessSession;
|
|
22
|
-
type AgentStartTargetInput = Extract<AgentHandle, {
|
|
23
|
-
phase: "starting";
|
|
24
|
-
}>["target"];
|
|
25
|
-
/** Result of preparing a continuation against an existing handle. */
|
|
26
|
-
export type PrepareAgentContinuationResult = {
|
|
27
|
-
readonly kind: "ready";
|
|
28
|
-
readonly session: HarnessSession;
|
|
29
|
-
readonly handle: Extract<AgentHandle, {
|
|
30
|
-
phase: "running";
|
|
31
|
-
}>;
|
|
32
|
-
} | {
|
|
33
|
-
readonly kind: "unknown";
|
|
34
|
-
} | {
|
|
35
|
-
readonly kind: "mismatch";
|
|
36
|
-
} | {
|
|
37
|
-
readonly kind: "busy";
|
|
38
|
-
};
|
|
39
|
-
/**
|
|
40
|
-
* Records intent to deliver a follow-up turn to a parked child. Must be
|
|
41
|
-
* applied to the step's working snapshot before the delivery side effect
|
|
42
|
-
* runs.
|
|
43
|
-
*
|
|
44
|
-
* Delivery is at-least-once, not exactly-once: the `running` handle durably
|
|
45
|
-
* commits only when the enclosing dispatch step's result commits. If the
|
|
46
|
-
* step dies after a successful delivery, replay starts from `parked` and
|
|
47
|
-
* delivers the same operation again — which is why replaying the operation
|
|
48
|
-
* already recorded on a running handle returns `ready` with the unchanged
|
|
49
|
-
* session instead of a busy conflict.
|
|
50
|
-
*
|
|
51
|
-
* `unknown`, `mismatch`, and `busy` do not change the session; the caller
|
|
52
|
-
* maps them onto `AGENT_UNREACHABLE`, `AGENT_MISMATCH`, and `AGENT_BUSY`
|
|
53
|
-
* results.
|
|
54
|
-
*/
|
|
55
|
-
export declare function prepareAgentContinuation(session: HarnessSession, input: {
|
|
56
|
-
readonly agentId: string;
|
|
57
|
-
readonly invokedName: string;
|
|
58
|
-
readonly operation: ContinueOperation;
|
|
59
|
-
}): PrepareAgentContinuationResult;
|
|
60
|
-
/**
|
|
61
|
-
* Confirms a started child: `starting` becomes `running` with the child's
|
|
62
|
-
* confirmed address. Throws when no starting handle carries the operation,
|
|
63
|
-
* because confirming an unprepared start means ownership was never
|
|
64
|
-
* committed. Re-confirming an already-running handle with the same
|
|
65
|
-
* operation and address is a replay no-op.
|
|
66
|
-
*/
|
|
67
|
-
export declare function confirmAgentStarted(session: HarnessSession, input: {
|
|
68
|
-
readonly operationId: string;
|
|
69
|
-
readonly address: AgentAddress;
|
|
70
|
-
}): HarnessSession;
|
|
71
|
-
/** Confirms a task-mode child as a persistent identity/address record. */
|
|
72
|
-
export declare function confirmTaskAgentAddress(session: HarnessSession, input: {
|
|
73
|
-
readonly operationId: string;
|
|
74
|
-
readonly address: AgentAddress;
|
|
75
|
-
}): HarnessSession;
|
|
76
|
-
/**
|
|
77
|
-
* Records a task-mode child's persistent address from its durable executor
|
|
78
|
-
* binding, applied when the parent step that delegated the task commits.
|
|
79
|
-
*
|
|
80
|
-
* Replay-idempotent: a record identical to the stored handle is a no-op
|
|
81
|
-
* (a resumed child, or a replayed commit). A different record under the
|
|
82
|
-
* same id throws — ids derive from unique operations, so a collision
|
|
83
|
-
* means corrupted derivation, not a replay.
|
|
84
|
-
*/
|
|
85
|
-
export declare function recordTaskAgentAddress(session: HarnessSession, input: {
|
|
86
|
-
readonly address: AgentAddress;
|
|
87
|
-
readonly identity: AgentIdentity;
|
|
88
|
-
}): HarnessSession;
|
|
89
|
-
/** Removes a task-mode address after permanent delivery failure. */
|
|
90
|
-
export declare function removeTaskAgentAddress(session: HarnessSession, agentId: string): HarnessSession;
|
|
91
|
-
/** State-only variant used while consuming a terminal task wake. */
|
|
92
|
-
export declare function removeTaskAgentAddressFromState(state: SessionStateMap | undefined, agentId: string): SessionStateMap;
|
|
93
|
-
/**
|
|
94
|
-
* Resolves a dispatch that definitively failed.
|
|
95
|
-
*
|
|
96
|
-
* - A dead start or dead continuation deletes the handle: there is no
|
|
97
|
-
* child left to own.
|
|
98
|
-
* - A retryable continuation failure restores `parked` with the status the
|
|
99
|
-
* handle showed before the delivery, so the model may retry the same
|
|
100
|
-
* `agentId` later.
|
|
101
|
-
*
|
|
102
|
-
* Unknown operations are a no-op: the failure raced a settlement that
|
|
103
|
-
* already resolved the handle.
|
|
104
|
-
*/
|
|
105
|
-
export declare function rejectAgentEffect(session: HarnessSession, input: {
|
|
106
|
-
readonly operationId: string;
|
|
107
|
-
readonly disposition: "dead" | "retryable";
|
|
108
|
-
}): HarnessSession;
|
|
109
|
-
/**
|
|
110
|
-
* Parks every running child when the parent abandons a cancelled turn.
|
|
111
|
-
*
|
|
112
|
-
* Cancellation requests each running descendant's cancellation and then
|
|
113
|
-
* tears down the turn inbox — the only hook a child settlement can
|
|
114
|
-
* resume — so no later settlement can move these handles. Without this
|
|
115
|
-
* transition they would stay `running` forever: invisible to the model,
|
|
116
|
-
* unresumable, and retried by every future cancellation.
|
|
117
|
-
*
|
|
118
|
-
* A cancelled child settles its own turn as a park, so `parked` with
|
|
119
|
-
* `"(cancelled)"` mirrors {@link settleAgentTurn}'s cancelled outcome. If
|
|
120
|
-
* the child instead died, a later continuation attempt discovers the dead
|
|
121
|
-
* session and {@link rejectAgentEffect} deletes the handle.
|
|
122
|
-
*/
|
|
123
|
-
export declare function abandonRunningAgentTurns(session: HarnessSession): HarnessSession;
|
|
124
|
-
/** Result of applying a settled child turn to the store. */
|
|
125
|
-
export type SettleAgentTurnResult = {
|
|
126
|
-
readonly kind: "settled";
|
|
127
|
-
readonly session: HarnessSession;
|
|
128
|
-
} | {
|
|
129
|
-
readonly kind: "ignored";
|
|
130
|
-
readonly reason: "unknown-operation";
|
|
131
|
-
};
|
|
132
|
-
/**
|
|
133
|
-
* Applies one settled child turn: `running` becomes `parked` for a parked
|
|
134
|
-
* outcome or is deleted for a terminal outcome.
|
|
135
|
-
*
|
|
136
|
-
* The settlement must carry the operation currently recorded on the
|
|
137
|
-
* running handle; anything else is ignored so a stale delivery can never
|
|
138
|
-
* move a newer turn.
|
|
139
|
-
*/
|
|
140
|
-
export declare function settleAgentTurn(session: HarnessSession, input: {
|
|
141
|
-
readonly operationId: string;
|
|
142
|
-
readonly outcome: AgentTurnOutcome;
|
|
143
|
-
}): SettleAgentTurnResult;
|
|
144
|
-
/**
|
|
145
|
-
* Rebases the handle delta one dispatch produced (`base` → `next`) onto a
|
|
146
|
-
* working session that other concurrently staged effects may have advanced
|
|
147
|
-
* past `base`.
|
|
148
|
-
*
|
|
149
|
-
* Per handle id:
|
|
150
|
-
*
|
|
151
|
-
* - deleted by the dispatch → deleted from the working session.
|
|
152
|
-
* - added by the dispatch → appended. If the working session already holds
|
|
153
|
-
* the id with different content, throws: ids derive from unique
|
|
154
|
-
* operations, so a collision means corrupted derivation.
|
|
155
|
-
* - changed in place by the dispatch → the dispatched copy replaces the
|
|
156
|
-
* working copy while that copy still matches `base`. A working copy that
|
|
157
|
-
* diverged from both throws instead of silently dropping either change.
|
|
158
|
-
* - untouched by the dispatch → the working copy is kept.
|
|
159
|
-
*
|
|
160
|
-
* A delta the working session already contains is a no-op, so replaying an
|
|
161
|
-
* effect is safe.
|
|
162
|
-
*/
|
|
163
|
-
export declare function rebaseAgentHandles(session: HarnessSession, input: {
|
|
164
|
-
readonly base: SessionStateMap | undefined;
|
|
165
|
-
readonly next: SessionStateMap | undefined;
|
|
166
|
-
}): HarnessSession;
|
|
167
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{jsonValuesEqual}from"#shared/json.js";import{AGENT_HANDLES_STATE_KEY,assertPersistableAgentHandleStore,formatAgentStatus,getAgentHandleStore}from"#harness/handles/store.js";function prepareAgentStart(e,t){let n=getAgentHandleStore(e.state)?.handles??[];if(n.some(e=>e.identity.id===t.identity.id))throw Error(`Agent handle "${t.identity.id}" already exists.`);return writeHandles(e,[...n,{identity:t.identity,operation:t.operation,phase:`starting`,target:t.target}])}function prepareAgentContinuation(e,t){let n=getAgentHandleStore(e.state)?.handles??[],r=n.find(e=>e.identity.id===t.agentId);if(r===void 0)return{kind:`unknown`};if(r.identity.name!==t.invokedName)return{kind:`mismatch`};if(r.phase===`running`&&r.operation.id===t.operation.id)return{handle:r,kind:`ready`,session:e};if(r.phase!==`parked`)return{kind:`busy`};let a={address:r.address,identity:r.identity,operation:{...t.operation,previousStatus:r.lastStatus},phase:`running`};return{handle:a,kind:`ready`,session:writeHandles(e,n.map(e=>e.identity.id===t.agentId?a:e))}}function findActiveHandle(e,t){return e.find(e=>(e.phase===`starting`||e.phase===`running`)&&e.operation.id===t)}function confirmAgentStarted(e,t){let n=getAgentHandleStore(e.state)?.handles??[],r=findActiveHandle(n,t.operationId);if(r===void 0)throw Error(`No prepared agent handle for operation "${t.operationId}".`);return r.phase===`running`?e:writeHandles(e,n.map(e=>e===r?{address:t.address,identity:r.identity,operation:r.operation,phase:`running`}:e))}function confirmTaskAgentAddress(e,t){let n=getAgentHandleStore(e.state)?.handles??[],r=findActiveHandle(n,t.operationId);if(r===void 0)throw Error(`No prepared agent handle for operation "${t.operationId}".`);if(r.phase===`running`)throw Error(`Task agent operation "${t.operationId}" was confirmed as a running handle.`);return writeHandles(e,n.map(e=>e===r?{address:t.address,identity:r.identity,phase:`addressed`}:e))}function recordTaskAgentAddress(t,n){let r=getAgentHandleStore(t.state)?.handles??[],a={address:n.address,identity:n.identity,phase:`addressed`},o=r.find(e=>e.identity.id===n.identity.id);if(o!==void 0){if(jsonValuesEqual(o,a))return t;throw Error(`Agent handle "${n.identity.id}" already exists with different content.`)}return writeHandles(t,[...r,a])}function removeTaskAgentAddress(e,t){return{...e,state:removeTaskAgentAddressFromState(e.state,t)}}function removeTaskAgentAddressFromState(e,r){let a=getAgentHandleStore(e)?.handles??[];return{...e,[AGENT_HANDLES_STATE_KEY]:assertPersistableAgentHandleStore({handles:a.filter(e=>!(e.phase===`addressed`&&e.identity.id===r))})}}function rejectAgentEffect(e,t){let n=getAgentHandleStore(e.state)?.handles??[],r=findActiveHandle(n,t.operationId);if(r===void 0)return e;if(t.disposition===`retryable`&&r.phase===`running`){let{operation:t}=r;if(t.kind===`continue`)return writeHandles(e,n.map(e=>e===r?{address:r.address,identity:r.identity,lastStatus:t.previousStatus,phase:`parked`}:e))}return writeHandles(e,n.filter(e=>e!==r))}function abandonRunningAgentTurns(e){let t=getAgentHandleStore(e.state)?.handles??[];return t.some(e=>e.phase===`running`)?writeHandles(e,t.map(e=>e.phase===`running`?{address:e.address,identity:e.identity,lastStatus:`(cancelled)`,phase:`parked`}:e)):e}function settleAgentTurn(e,t){let n=getAgentHandleStore(e.state)?.handles??[],a=n.find(e=>e.phase===`running`&&e.operation.id===t.operationId);if(a===void 0||a.phase!==`running`)return{kind:`ignored`,reason:`unknown-operation`};if(t.outcome.kind===`terminal`)return{kind:`settled`,session:writeHandles(e,n.filter(e=>e!==a))};let{result:o}=t.outcome,s=o.kind===`succeeded`?formatAgentStatus(o.output):o.kind===`failed`?formatAgentStatus(o.error):`(cancelled)`;return{kind:`settled`,session:writeHandles(e,n.map(e=>e===a?{address:a.address,identity:a.identity,lastStatus:s,phase:`parked`}:e))}}function rebaseAgentHandles(t,n){let r=handlesById(n.base),a=handlesById(n.next),o=getAgentHandleStore(t.state)?.handles??[],s=new Set(o.map(e=>e.identity.id)),c=!1,l=[];for(let t of o){let n=t.identity.id,i=r.get(n),o=a.get(n);if(i!==void 0&&o===void 0){c=!0;continue}if(i===void 0&&o!==void 0&&!jsonValuesEqual(t,o))throw Error(`Agent handle "${n}" added by a dispatch already exists with different content.`);if(i!==void 0&&o!==void 0&&!jsonValuesEqual(i,o)){if(jsonValuesEqual(t,i)){l.push(o),c=!0;continue}if(!jsonValuesEqual(t,o))throw Error(`Agent handle "${n}" was changed by a dispatch and concurrently by another effect.`)}l.push(t)}let u=[...a.values()].filter(e=>!r.has(e.identity.id)&&!s.has(e.identity.id));return!c&&u.length===0?t:writeHandles(t,[...l,...u])}function handlesById(e){let t=getAgentHandleStore(e)?.handles??[];return new Map(t.map(e=>[e.identity.id,e]))}function writeHandles(e,r){return{...e,state:{...e.state,[AGENT_HANDLES_STATE_KEY]:assertPersistableAgentHandleStore({handles:r})}}}export{abandonRunningAgentTurns,confirmAgentStarted,confirmTaskAgentAddress,prepareAgentContinuation,prepareAgentStart,rebaseAgentHandles,recordTaskAgentAddress,rejectAgentEffect,removeTaskAgentAddress,removeTaskAgentAddressFromState,settleAgentTurn};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{createActionResultEvent}from"#protocol/message.js";import{parseJsonObject}from"#shared/json.js";import{settleAgentTurn}from"#harness/handles/transitions.js";import{findToolRun,removeToolRun}from"#harness/tool-runs.js";import{clearProxyInputRequestsForChild,clearProxyInputRequestsWhere}from"#harness/proxy-input-requests.js";import{getPendingDispatchActionKey}from"#runtime/actions/keys.js";import{accumulateSessionUsage,getTurnUsageState,setTurnUsageState}from"#harness/turn-tag-state.js";import{findRunningAgentHandle,isResultBoundToRunningHandle}from"#harness/handles/query.js";import{resolveRuntimeActionResultsForKeys}from"#runtime/actions/results.js";import{normalizeToolModelOutput}from"#harness/tool-model-output.js";const PENDING_RUNTIME_ACTION_BATCH_KEY=`eve.runtime.pendingActionBatch`;function readSubagentResultOutcome(e){return e.origin===`child`?e.outcome:void 0}function getPendingRuntimeActionBatch(e){let t=e?.[PENDING_RUNTIME_ACTION_BATCH_KEY];if(typeof t!=`object`||!t)return;let n=t;if(!(!Array.isArray(n.actions)||!Array.isArray(n.responseMessages)||typeof n.event!=`object`||n.event===null))return n}function hasPendingRuntimeActionBatch(e){return getPendingRuntimeActionBatch(e)!==void 0}function clearPendingRuntimeActionBatch(e){if(e.state?.[PENDING_RUNTIME_ACTION_BATCH_KEY]===void 0)return e;let t={...e.state};return delete t[PENDING_RUNTIME_ACTION_BATCH_KEY],{...e,state:Object.keys(t).length>0?t:void 0}}function setPendingRuntimeActionBatch(e){assertUniqueRuntimeActionCallIds(e.actions);let t={...e.session.state};return t[PENDING_RUNTIME_ACTION_BATCH_KEY]={actions:[...e.actions],event:e.event,responseMessages:[...e.responseMessages]},{...e.session,state:t}}function assertUniqueRuntimeActionCallIds(e){let t=new Set;for(let n of e){if(t.has(n.callId))throw Error(`Runtime action batch contains duplicate callId "${n.callId}".`);t.add(n.callId)}}function resolveReadyRuntimeActionResults(e){let t=getPendingRuntimeActionBatch(e.session.state);if(t!==void 0)return resolveRuntimeActionResultsForBatch({batch:t,results:e.results,state:e.session.state})}function resolveRuntimeActionResultsForBatch(e){return resolveRuntimeActionResultsForKeys({pendingKeys:e.batch.actions.map(e=>getPendingDispatchActionKey(e)),results:e.results.filter(t=>isResultBoundToRunningHandle(e.state,t))})}async function resolvePendingRuntimeActions(t){let a=getPendingRuntimeActionBatch(t.session.state);if(a===void 0)return{messages:[...t.session.history],outcome:`continue`,session:t.session};let o=resolveReadyRuntimeActionResults({results:t.stepInput?.runtimeActionResults??[],session:t.session});if(o===void 0)return{messages:[...t.session.history],outcome:`unresolved`,session:t.session};if(t.emit!==void 0)for(let n of o){if(n.kind===`subagent-result`&&n.isError!==!0){let e=readBackgroundTaskReceipt(n),r={callId:n.callId,output:typeof n.output==`string`?n.output:JSON.stringify(n.output),subagentName:n.subagentName};await t.emit({data:e===void 0?r:{...r,backgroundTask:e},type:`subagent.completed`})}await t.emit(createActionResultEvent({result:n,sequence:a.event.sequence,stepIndex:a.event.stepIndex,turnId:a.event.turnId}))}let s=t.session;for(let e of o){if(e.kind!==`subagent-result`||e.origin!==`child`||readBackgroundTaskReceipt(e)!==void 0)continue;let t=findRunningAgentHandle(s.state,{callId:e.callId});if(t===void 0)continue;let r=readSubagentResultOutcome(e);if(r===void 0)continue;r.kind===`terminal`&&`continuationToken`in t.address&&(s=clearProxyInputRequestsForChild(s,t.address.continuationToken));let i=settleAgentTurn(s,{operationId:t.operation.id,outcome:r});i.kind===`settled`&&(s=i.session)}for(let e of o){if(e.kind!==`tool-result`)continue;let t=findToolRun(s.state,e.callId);t!==void 0&&(s=removeToolRun(clearProxyInputRequestsWhere(s,e=>e.answerHook?.runId===t.runId),t.callId))}let c={...s.state};delete c[PENDING_RUNTIME_ACTION_BATCH_KEY],s={...s,state:Object.keys(c).length>0?c:void 0};for(let e of o){if(e.kind!==`subagent-result`)continue;let t=readSubagentResultOutcome(e);t!==void 0&&(s=setTurnUsageState(s,accumulateSessionUsage({previous:getTurnUsageState(s.state),usage:t.usageDelta})))}let l=[];for(let e of o){switch(e.kind){case`load-skill-result`:l.push({output:toToolResultOutput(e),toolCallId:e.callId,toolName:`load_skill`,type:`tool-result`});continue;case`subagent-result`:l.push({output:toToolResultOutput(e),toolCallId:e.callId,toolName:e.subagentName,type:`tool-result`});continue;case`tool-result`:l.push({output:await projectToolResultOutput(e,t.tools?.get(e.toolName)),toolCallId:e.callId,toolName:e.toolName,type:`tool-result`});continue}throw Error(`Unsupported runtime action result kind "${String(e)}".`)}let u=[...s.history,...a.responseMessages];return l.length>0&&u.push({content:l,role:`tool`}),{messages:u,outcome:`resolved`,session:s}}function readBackgroundTaskReceipt(e){return`backgroundTask`in e?e.backgroundTask:void 0}function createRuntimeActionRequestFromToolCall(e){let t=e.tools.get(e.toolCall.toolName),n=resolveToolCallInputObject(e.toolCall.input,{callId:e.toolCall.toolCallId,toolName:e.toolCall.toolName});if(t?.behavior?.presentation===`load-skill`)return{callId:e.toolCall.toolCallId,input:n,kind:`load-skill`};let r=t?.execution===`background`||t?.behavior?.handling?.kind!==`dispatch`?void 0:t.behavior.handling.target;return t!==void 0&&(r?.kind===`self-agent-call`||r?.kind===`subagent-call`)?{callId:e.toolCall.toolCallId,description:t.description,input:n,kind:`subagent-call`,name:t.name,nodeId:r.nodeId,subagentName:r.subagentName}:t!==void 0&&r?.kind===`remote-agent-call`?{callId:e.toolCall.toolCallId,description:t.description,input:n,kind:`remote-agent-call`,name:t.name,nodeId:r.nodeId,remoteAgentName:r.remoteAgentName}:{callId:e.toolCall.toolCallId,input:n,kind:`tool-call`,toolName:e.toolCall.toolName}}function createPendingDispatchActionFromToolCall(e){let t=e.tools.get(e.toolCall.toolName);if(t===void 0)throw Error(`Unknown tool "${e.toolCall.toolName}" in dispatch projection.`);let n=t.behavior?.handling;if(n?.kind!==`dispatch`||t.execution===`background`)throw Error(`Tool "${e.toolCall.toolName}" is not a durable dispatch tool.`);return{callId:e.toolCall.toolCallId,description:t.description,input:resolveToolCallInputObject(e.toolCall.input,{callId:e.toolCall.toolCallId,toolName:e.toolCall.toolName}),target:n.target,toolName:t.name}}function resolveToolCallInputObject(e,n){if(e==null||typeof e==`string`&&e.trim()===``)return{};try{return parseJsonObject(typeof e==`string`?parseJsonStringInput(e):e)}catch(e){let t=e instanceof Error?e.message:String(e);throw TypeError(`Failed to parse tool-call arguments for "${n.toolName}" (${n.callId}): ${t}`,{cause:e})}}function parseJsonStringInput(e){return JSON.parse(e)}async function projectToolResultOutput(e,t){return e.isError===!0||t?.toModelOutput===void 0?toToolResultOutput(e):normalizeToolModelOutput({output:await t.toModelOutput(e.output),toolCallId:e.callId,toolName:e.toolName})}function toToolResultOutput(e){return typeof e.output==`string`?e.isError===!0?{type:`error-text`,value:e.output}:{type:`text`,value:e.output}:e.isError===!0?{type:`error-json`,value:toMutableJsonValue(e.output)}:{type:`json`,value:toMutableJsonValue(e.output)}}function toMutableJsonValue(e){if(e===null||typeof e==`string`||typeof e==`number`||typeof e==`boolean`)return e;if(Array.isArray(e))return e.map(e=>toMutableJsonValue(e));let t={};for(let[n,r]of Object.entries(e))t[n]=toMutableJsonValue(r);return t}export{assertUniqueRuntimeActionCallIds,clearPendingRuntimeActionBatch,createPendingDispatchActionFromToolCall,createRuntimeActionRequestFromToolCall,getPendingRuntimeActionBatch,hasPendingRuntimeActionBatch,resolvePendingRuntimeActions,resolveToolCallInputObject,setPendingRuntimeActionBatch};
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import type { HarnessSession } from "#harness/types.js";
|
|
2
|
-
import type { PendingAgentDispatchAction, PendingDispatchAction } from "#shared/dispatch-action.js";
|
|
3
|
-
export type ResolvedSubagentDepth = {
|
|
4
|
-
readonly currentDepth: number;
|
|
5
|
-
readonly nextChildDepth: number;
|
|
6
|
-
};
|
|
7
|
-
export declare function resolveSubagentDepth(session: Pick<HarnessSession, "subagentDepth">): ResolvedSubagentDepth;
|
|
8
|
-
export declare function readSerializedSubagentDepth(serializedContext: Readonly<Record<string, unknown>>): number | undefined;
|
|
9
|
-
export declare function isSubagentDelegationAction(action: PendingDispatchAction): action is PendingAgentDispatchAction;
|
|
10
|
-
export declare function getSubagentDelegationName(action: PendingAgentDispatchAction): string;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{SubagentDepthKey}from"#context/keys.js";function resolveSubagentDepth(e){let t=parseSubagentDepth(e.subagentDepth);return{currentDepth:t,nextChildDepth:t+1}}function readSerializedSubagentDepth(t){let n=parseSubagentDepth(t[SubagentDepthKey.name]);return n===0?void 0:n}function isSubagentDelegationAction(e){return e.target.kind===`self-agent-call`||e.target.kind===`subagent-call`||e.target.kind===`remote-agent-call`}function getSubagentDelegationName(e){switch(e.target.kind){case`remote-agent-call`:return e.target.remoteAgentName;case`self-agent-call`:case`subagent-call`:return e.target.subagentName;default:return e.target}}function parseSubagentDepth(e){return typeof e==`number`&&Number.isInteger(e)&&e>0?e:0}export{getSubagentDelegationName,isSubagentDelegationAction,readSerializedSubagentDepth,resolveSubagentDepth};
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import type { HarnessSession, SessionStateMap } from "#harness/types.js";
|
|
2
|
-
import type { RuntimeToolResultActionResult } from "#shared/action-types.js";
|
|
3
|
-
export declare function toolRunAnswerToken(runId: string, seq: number): string;
|
|
4
|
-
/** A workflow tool run the active turn waits on. Background runs live in the task index. */
|
|
5
|
-
export interface ToolRunRecord {
|
|
6
|
-
readonly callId: string;
|
|
7
|
-
readonly hookToken: string;
|
|
8
|
-
readonly runId: string;
|
|
9
|
-
readonly toolName: string;
|
|
10
|
-
}
|
|
11
|
-
export declare function getToolRuns(state: SessionStateMap | undefined): readonly ToolRunRecord[];
|
|
12
|
-
export declare function findToolRun(state: SessionStateMap | undefined, callId: string): ToolRunRecord | undefined;
|
|
13
|
-
export declare function recordToolRun<T extends {
|
|
14
|
-
readonly state?: SessionStateMap;
|
|
15
|
-
}>(session: T, record: ToolRunRecord): T;
|
|
16
|
-
export declare function removeToolRun<T extends {
|
|
17
|
-
readonly state?: SessionStateMap;
|
|
18
|
-
}>(session: T, callId: string): T;
|
|
19
|
-
export declare function clearToolRuns(session: HarnessSession): HarnessSession;
|
|
20
|
-
/** The turn inbox is shared; a result settles a call only if the turn recorded that run. */
|
|
21
|
-
export declare function isInboxToolResultFromRecordedRun(state: SessionStateMap | undefined, result: RuntimeToolResultActionResult): boolean;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
const TOOL_RUNS_STATE_KEY=`eve.runtime.toolRuns`;function toolRunAnswerToken(e,t){return`eve:tool-run-answer:${e}:${t}`}function getToolRuns(t){let n=t?.[TOOL_RUNS_STATE_KEY];return Array.isArray(n)?n:[]}function findToolRun(e,t){return getToolRuns(e).find(e=>e.callId===t)}function recordToolRun(e,t){return writeToolRuns(e,[...getToolRuns(e.state).filter(e=>e.callId!==t.callId),t])}function removeToolRun(e,t){let n=getToolRuns(e.state),r=n.filter(e=>e.callId!==t);return r.length===n.length?e:writeToolRuns(e,r)}function clearToolRuns(e){return getToolRuns(e.state).length===0?e:writeToolRuns(e,[])}function isInboxToolResultFromRecordedRun(e,t){let n=findToolRun(e,t.callId);return n!==void 0&&n.toolName===t.toolName}function writeToolRuns(t,n){let r={...t.state};return n.length===0?delete r[TOOL_RUNS_STATE_KEY]:r[TOOL_RUNS_STATE_KEY]=n,{...t,state:Object.keys(r).length>0?r:void 0}}export{clearToolRuns,findToolRun,getToolRuns,isInboxToolResultFromRecordedRun,recordToolRun,removeToolRun,toolRunAnswerToken};
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import type { PendingDispatchAction } from "#shared/dispatch-action.js";
|
|
2
|
-
import { type WorkflowSandboxInterrupt } from "#shared/workflow-sandbox.js";
|
|
3
|
-
export declare const WORKFLOW_RUNTIME_ACTION_INTERRUPT_KIND = "eve.workflow-runtime-action";
|
|
4
|
-
export declare function isWorkflowRuntimeActionInterrupt(interrupt: unknown): boolean;
|
|
5
|
-
export declare function buildRuntimeActionFromWorkflowInterrupt(interrupt: WorkflowSandboxInterrupt): PendingDispatchAction;
|
|
6
|
-
/** Returns every pending runtime-action interrupt in deterministic request order. */
|
|
7
|
-
export declare function getWorkflowRuntimeActionInterrupts(interrupt: WorkflowSandboxInterrupt): WorkflowSandboxInterrupt[];
|
|
8
|
-
export declare function buildRuntimeActionsFromWorkflowInterrupt(interrupt: WorkflowSandboxInterrupt): PendingDispatchAction[];
|
|
9
|
-
export declare function getRuntimeActionKeysFromWorkflowInterrupt(interrupt: WorkflowSandboxInterrupt): string[];
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{getPendingDispatchActionKey}from"#runtime/actions/keys.js";import{getWorkflowSandboxPendingInterrupts}from"#shared/workflow-sandbox.js";const WORKFLOW_RUNTIME_ACTION_INTERRUPT_KIND=`eve.workflow-runtime-action`;function isWorkflowRuntimeActionInterrupt(e){return isRecord(e)&&isRecord(e.payload)&&e.payload.kind===`eve.workflow-runtime-action`}function buildRuntimeActionFromWorkflowInterrupt(e){let t=e.payload,n=t.dispatchTarget,r=t.toolInput,i=t.toolName,a=sanitizeCallId(`${i}_${`interruptId`in e?String(e.interruptId):``}`);if(n.kind===`self-agent-call`||n.kind===`subagent-call`||n.kind===`remote-agent-call`)return{callId:a,description:``,input:r,target:n,toolName:i};throw Error(`Workflow runtime actions cannot carry "${n.kind}" tools.`)}function getWorkflowRuntimeActionInterrupts(e){return getWorkflowSandboxPendingInterrupts(e).filter(isWorkflowRuntimeActionInterrupt)}function buildRuntimeActionsFromWorkflowInterrupt(e){return getWorkflowRuntimeActionInterrupts(e).map(e=>buildRuntimeActionFromWorkflowInterrupt(e))}function getRuntimeActionKeysFromWorkflowInterrupt(t){return buildRuntimeActionsFromWorkflowInterrupt(t).map(getPendingDispatchActionKey)}function sanitizeCallId(e){return e.replace(/[^a-zA-Z0-9_-]/g,`_`)}function isRecord(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}export{WORKFLOW_RUNTIME_ACTION_INTERRUPT_KIND,buildRuntimeActionFromWorkflowInterrupt,buildRuntimeActionsFromWorkflowInterrupt,getRuntimeActionKeysFromWorkflowInterrupt,getWorkflowRuntimeActionInterrupts,isWorkflowRuntimeActionInterrupt};
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import type { RuntimeActionRequest, RuntimeActionResult } from "#shared/action-types.js";
|
|
2
|
-
import type { PendingDispatchAction } from "#shared/dispatch-action.js";
|
|
3
|
-
/**
|
|
4
|
-
* Returns the stable match key used to pair one pending runtime action request
|
|
5
|
-
* with its resume result.
|
|
6
|
-
*/
|
|
7
|
-
export declare function getRuntimeActionRequestKey(action: RuntimeActionRequest): string;
|
|
8
|
-
/** Returns the stable match key for one durable dispatch request. */
|
|
9
|
-
export declare function getPendingDispatchActionKey(action: PendingDispatchAction): string;
|
|
10
|
-
/**
|
|
11
|
-
* Returns the stable match key used to pair one runtime action result with its
|
|
12
|
-
* originating request.
|
|
13
|
-
*/
|
|
14
|
-
export declare function getRuntimeActionResultKey(result: RuntimeActionResult): string;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
function getRuntimeActionRequestKey(e){switch(e.kind){case`load-skill`:return`runtime-action:${e.kind}:${e.callId}`;case`remote-agent-call`:return`subagent-call:${e.remoteAgentName}:${e.callId}`;case`subagent-call`:return`subagent-call:${e.subagentName}:${e.callId}`;case`tool-call`:return`tool-call:${e.toolName}:${e.callId}`}}function getPendingDispatchActionKey(e){switch(e.target.kind){case`remote-agent-call`:return`subagent-call:${e.target.remoteAgentName}:${e.callId}`;case`self-agent-call`:case`subagent-call`:return`subagent-call:${e.target.subagentName}:${e.callId}`;case`task-cancel`:case`task-update`:case`workflow-tool-call`:return`tool-call:${e.toolName}:${e.callId}`;default:return e.target}}function getRuntimeActionResultKey(e){switch(e.kind){case`load-skill-result`:return`runtime-action:load-skill:${e.callId}`;case`subagent-result`:return`subagent-call:${e.subagentName}:${e.callId}`;case`tool-result`:return`tool-call:${e.toolName}:${e.callId}`}}export{getPendingDispatchActionKey,getRuntimeActionRequestKey,getRuntimeActionResultKey};
|
package/dist/src/tasks/wire.d.ts
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import type { TaskCommand, TaskRunInboundPayload } from "#tasks/types.js";
|
|
2
|
-
/**
|
|
3
|
-
* Translates one inbound hook payload into a lifecycle command.
|
|
4
|
-
*
|
|
5
|
-
* Delegated dispatch hands children the task run's hook token, so the
|
|
6
|
-
* payloads that used to resume the parent turn arrive here instead:
|
|
7
|
-
*
|
|
8
|
-
* - a settled child turn (local notification or remote callback)
|
|
9
|
-
* carries an explicit outcome — its result status decides
|
|
10
|
-
* `complete`, `fail`, or `cancel`;
|
|
11
|
-
* - a forwarded HITL batch marks the task `input_required` with the
|
|
12
|
-
* outstanding requests;
|
|
13
|
-
* - `authorization.required` also blocks the task (the child cannot
|
|
14
|
-
* proceed without the parent's user) under a reserved request id, and
|
|
15
|
-
* `authorization.completed` clears exactly that id. Authorization
|
|
16
|
-
* payloads never enter the view — only the fact that the child is
|
|
17
|
-
* blocked does.
|
|
18
|
-
*
|
|
19
|
-
* `input-response` is deliberately absent: the run must forward the
|
|
20
|
-
* answers to the child before it may record them, so it builds that
|
|
21
|
-
* command itself rather than translating one here.
|
|
22
|
-
*
|
|
23
|
-
* Returns `undefined` for unrecognized payloads, which the run ignores.
|
|
24
|
-
*/
|
|
25
|
-
export declare function translateTaskInboundPayload(payload: TaskRunInboundPayload): TaskCommand | undefined;
|
package/dist/src/tasks/wire.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{readTaskUsage,taskAuthorizationRequestId}from"#tasks/types.js";function translateTaskInboundPayload(n){switch(n.kind){case`task-command`:return n.command;case`runtime-action-result`:{let t=n.results[0];if(t===void 0)return;if(t.outcome!==void 0){let n=readTaskUsage(t.outcome.usageDelta);switch(t.outcome.result.kind){case`succeeded`:return withUsage({data:t.output,kind:`complete`,lifecycle:t.outcome.kind},n);case`failed`:return withUsage({data:t.output,kind:`fail`,lifecycle:t.outcome.kind},n);case`cancelled`:return withUsage({kind:`cancel`,lifecycle:t.outcome.kind},n)}}return}case`subagent-input-request`:return{inputRequests:n.event.requests,kind:`require-input`};case`turn-started`:return{childSessionId:n.childSessionId,childTurnId:n.childTurnId,kind:`start-turn`,taskId:n.taskId};case`authorization-event`:{let e=taskAuthorizationRequestId(n.event);return n.event.type===`authorization.required`?{kind:`require-authorization`,requestId:e}:{kind:`answered`,requestIds:[e]}}default:return}}function withUsage(e,t){return t===void 0?e:{...e,usage:t}}export{translateTaskInboundPayload};
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|