eve 0.50.0 → 0.51.1
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 +41 -0
- package/dist/src/acp/adapter.js +1 -1
- package/dist/src/channel/session.d.ts +2 -1
- package/dist/src/channel/session.js +1 -1
- package/dist/src/channel/types.d.ts +16 -20
- package/dist/src/chunks/{use-eve-agent-B5I-k6Ek.js → use-eve-agent-3DZuvuWE.js} +21 -10
- package/dist/src/chunks/{use-eve-agent-DUMU6dap.js → use-eve-agent-D7apPojZ.js} +21 -10
- 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/agent-instructions.d.ts +3 -1
- package/dist/src/cli/commands/agent-instructions.js +1 -1
- 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.d.ts +2 -13
- package/dist/src/cli/commands/init.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-project-commands.d.ts +1 -1
- package/dist/src/cli/commands/register-project-commands.js +1 -1
- package/dist/src/cli/commands/register-registry-commands.js +2 -2
- 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/run-interactive-ui.js +1 -1
- package/dist/src/cli/dev/tui/prompt-command-handler.js +1 -1
- package/dist/src/cli/dev/tui/runner.js +1 -1
- package/dist/src/cli/dev/tui/setup-commands.d.ts +3 -1
- package/dist/src/cli/dev/tui/setup-commands.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/client/open-stream.js +1 -1
- package/dist/src/client/session-controls.d.ts +3 -0
- package/dist/src/client/session-controls.js +1 -1
- package/dist/src/client/session.d.ts +4 -1
- package/dist/src/compiled/.vendor-stamp.json +11 -11
- package/dist/src/compiled/@clack/core/LICENSE +9 -0
- package/dist/src/compiled/@clack/core/index.d.ts +363 -0
- package/dist/src/compiled/@clack/core/index.js +20 -0
- package/dist/src/compiled/@eve/catalog/index.js +1 -1
- package/dist/src/compiled/@vercel/sandbox/api-client/api-client.d.ts +34 -92
- package/dist/src/compiled/@vercel/sandbox/api-client/base-client.d.ts +1 -1
- package/dist/src/compiled/@vercel/sandbox/api-client/index.d.ts +1 -1
- package/dist/src/compiled/@vercel/sandbox/api-client/validators.d.ts +13 -29
- package/dist/src/compiled/@vercel/sandbox/constants.d.ts +11 -1
- package/dist/src/compiled/@vercel/sandbox/index.d.ts +3 -3
- package/dist/src/compiled/@vercel/sandbox/index.js +9 -9
- package/dist/src/compiled/@vercel/sandbox/sandbox-user.d.ts +5 -6
- package/dist/src/compiled/@vercel/sandbox/sandbox.d.ts +79 -67
- package/dist/src/compiled/@vercel/sandbox/session.d.ts +5 -3
- package/dist/src/compiled/@vercel/sandbox/snapshot.d.ts +9 -0
- package/dist/src/compiled/@vercel/{sandbox-delete → sandbox-drives}/api-client/api-client.d.ts +86 -1
- package/dist/src/compiled/@vercel/sandbox-drives/api-client/index.d.ts +2 -0
- package/dist/src/compiled/@vercel/{sandbox-delete → sandbox-drives}/api-client/validators.d.ts +26 -1
- package/dist/src/compiled/@vercel/{sandbox-delete → sandbox-drives}/constants.d.ts +2 -2
- package/dist/src/compiled/@vercel/{sandbox → sandbox-drives}/drive.d.ts +10 -0
- package/dist/src/compiled/@vercel/{sandbox-delete → sandbox-drives}/index.d.ts +3 -2
- package/dist/src/compiled/@vercel/sandbox-drives/index.js +9 -0
- package/dist/src/compiled/@vercel/{sandbox-delete → sandbox-drives}/sandbox.d.ts +35 -6
- package/dist/src/compiled/@workflow/core/index.js +1 -1
- package/dist/src/compiled/@workflow/core/private.d.ts +2 -4
- package/dist/src/compiled/@workflow/core/private.js +1 -1
- package/dist/src/compiled/@workflow/core/runtime/constants.d.ts +9 -7
- package/dist/src/compiled/@workflow/core/runtime/helpers.d.ts +13 -0
- package/dist/src/compiled/@workflow/core/runtime/suspension-handler.d.ts +54 -1
- package/dist/src/compiled/@workflow/core/runtime.js +3 -3
- package/dist/src/compiled/@workflow/core/serialization/types.d.ts +7 -0
- package/dist/src/compiled/@workflow/core/serialization.d.ts +24 -2
- package/dist/src/compiled/@workflow/core/version.d.ts +1 -1
- package/dist/src/compiled/@workflow/core/workflow.js +1 -1
- package/dist/src/compiled/@workflow/errors/error-codes.d.ts +2 -0
- package/dist/src/compiled/@workflow/errors/index.d.ts +19 -0
- package/dist/src/compiled/@workflow/errors/index.js +1 -1
- package/dist/src/compiled/@workflow/world/analytics.d.ts +46 -2
- package/dist/src/compiled/@workflow/world/events.d.ts +26 -1
- package/dist/src/compiled/@workflow/world/index.d.ts +1 -1
- package/dist/src/compiled/@workflow/world/runs.d.ts +2 -2
- package/dist/src/compiled/@workflow/world-local/index.js +3 -3
- package/dist/src/compiled/@workflow/world-vercel/index.js +12 -12
- package/dist/src/compiled/_chunks/node/{auth-BSKyPAEP.js → auth-Bx1Aoyfo.js} +1 -1
- package/dist/src/compiled/_chunks/node/{auth-YpKlwhP1.js → auth-CA8ZMfB8.js} +1 -1
- package/dist/src/compiled/_chunks/node/esm-CE0tAvRh.js +7 -0
- package/dist/src/compiled/_chunks/node/version-BC6t2Txc.js +1 -0
- package/dist/src/compiled/_chunks/node/version-DSQqVZ5T.js +1 -0
- package/dist/src/compiled/_chunks/workflow/{attribute-changes-BwAadFfB.js → attribute-changes-03lzo29R.js} +1 -1
- package/dist/src/compiled/_chunks/workflow/dist-BIdMK5N8.js +40 -0
- package/dist/src/compiled/_chunks/workflow/dist-DMQ3CtWt.js +3 -0
- package/dist/src/compiled/_chunks/workflow/frames-Boesh7kU.js +3 -0
- package/dist/src/compiled/_chunks/workflow/{private-CZFMABEf.js → private-CKx3PkSS.js} +1 -1
- package/dist/src/compiled/_chunks/workflow/{resume-hook-BToMtPbH.js → resume-hook-C6eL-S_T.js} +1 -1
- package/dist/src/compiled/_chunks/workflow/run-BV0S6Zc2.js +1 -0
- package/dist/src/compiled/_chunks/workflow/sleep-Bh3jP9ii.js +1 -0
- package/dist/src/compiled/_chunks/workflow/wait-until-l-cwfJvm.js +15 -0
- package/dist/src/compiled/_chunks/workflow/{ws-transport-PnVVxT0R.js → ws-transport-BagXNxCE.js} +1 -1
- package/dist/src/compiler/compile-from-memory.d.ts +1 -0
- package/dist/src/compiler/extension-compatibility.d.ts +20 -20
- package/dist/src/compiler/extension-compatibility.js +1 -1
- package/dist/src/compiler/manifest.d.ts +2 -2
- 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/compiler/normalize-tool.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/extensions.d.ts +2 -0
- package/dist/src/discover/extensions.js +1 -1
- package/dist/src/discover/filesystem.d.ts +1 -0
- package/dist/src/discover/filesystem.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/evals/runner/execute-task.js +1 -1
- package/dist/src/evals/session-cleanup.d.ts +7 -0
- package/dist/src/evals/session-cleanup.js +1 -0
- package/dist/src/evals/session.d.ts +4 -0
- package/dist/src/evals/session.js +1 -1
- package/dist/src/eve-channel/index.js +1 -1
- package/dist/src/eve-channel/request.d.ts +1 -0
- package/dist/src/eve-channel/request.js +1 -1
- package/dist/src/execution/activity-collector.js +1 -1
- package/dist/src/execution/activity-work-id.js +1 -1
- package/dist/src/execution/activity-work.d.ts +8 -0
- package/dist/src/execution/activity-work.js +1 -1
- package/dist/src/execution/cancel-descendant-turns-step.js +1 -1
- package/dist/src/execution/cancel-indexed-session-tasks-step.d.ts +6 -0
- package/dist/src/execution/cancel-indexed-session-tasks-step.js +1 -0
- 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.d.ts +2 -0
- package/dist/src/execution/inline-turn.js +1 -1
- package/dist/src/execution/next-driver-action.d.ts +7 -13
- package/dist/src/execution/node-step.d.ts +1 -2
- package/dist/src/execution/node-step.js +1 -1
- package/dist/src/execution/parked-delivery-wait.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/run-session-limits.d.ts +5 -5
- package/dist/src/execution/runtime-context.js +1 -1
- package/dist/src/execution/sandbox/bindings/vercel-create-sdk.js +1 -1
- package/dist/src/execution/sandbox/bindings/vercel-sdk-types.d.ts +4 -4
- package/dist/src/execution/sandbox/bindings/vercel.js +1 -1
- package/dist/src/execution/session-activity-projection.js +1 -1
- package/dist/src/execution/session-activity.js +1 -1
- package/dist/src/execution/session-command-inbox.d.ts +2 -3
- package/dist/src/execution/session-timeout-workflow.js +1 -1
- package/dist/src/execution/session.d.ts +2 -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 +19 -11
- 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 -27
- 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 -48
- 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/subagent-task-projection.d.ts +26 -0
- package/dist/src/execution/tasks/parent/subagent-task-projection.js +1 -0
- 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/sleep-workflow.d.ts +3 -0
- package/dist/src/execution/tools/sleep-workflow.js +1 -0
- package/dist/src/execution/tools/sleep.d.ts +1 -5
- package/dist/src/execution/tools/sleep.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-cancellation-control.d.ts +1 -0
- package/dist/src/execution/turn-cancellation-control.js +1 -1
- package/dist/src/execution/turn-cancellation-token.d.ts +1 -0
- package/dist/src/execution/turn-control-receiver.d.ts +3 -0
- package/dist/src/execution/turn-control-receiver.js +1 -1
- package/dist/src/execution/turn-dispatch.d.ts +2 -0
- package/dist/src/execution/turn-dispatch.js +1 -1
- 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 +14 -2
- package/dist/src/execution/wire/session-inbox-encoder.js +1 -1
- package/dist/src/execution/wire/session-inbox-resume.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/wire/session-inbox-wire.v5.d.ts +341 -0
- package/dist/src/execution/wire/session-inbox-wire.v5.js +1 -0
- package/dist/src/execution/wire/session-inbox-wire.v5.migration.d.ts +3 -0
- package/dist/src/execution/wire/session-inbox-wire.v5.migration.js +1 -0
- package/dist/src/execution/wire/session-inbox-wire.v6.d.ts +341 -0
- package/dist/src/execution/wire/session-inbox-wire.v6.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/session-limit-continuation.d.ts +5 -5
- package/dist/src/harness/session-limit-continuation.js +1 -1
- package/dist/src/harness/session-limit-enforcement.d.ts +4 -4
- package/dist/src/harness/session-limit-enforcement.js +1 -1
- package/dist/src/harness/session-usage-limits.d.ts +48 -0
- package/dist/src/harness/session-usage-limits.js +1 -0
- 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 +20 -21
- package/dist/src/harness/turn-tag-state.js +1 -1
- package/dist/src/harness/types.d.ts +9 -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/application/build-output-environment.d.ts +1 -0
- package/dist/src/internal/application/build-output-environment.js +1 -1
- package/dist/src/internal/application/package.js +1 -1
- package/dist/src/internal/application/paths.js +1 -1
- package/dist/src/internal/authored-definition/core.js +1 -1
- package/dist/src/internal/eve-project-root.d.ts +8 -0
- package/dist/src/internal/eve-project-root.js +1 -0
- package/dist/src/internal/invocation/workflow-execution.js +1 -1
- package/dist/src/internal/nitro/host/build-application.js +1 -1
- package/dist/src/internal/nitro/host/create-application-nitro.d.ts +1 -0
- package/dist/src/internal/nitro/host/create-application-nitro.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/host/types.d.ts +2 -0
- package/dist/src/internal/nitro/host/vercel-build-output-config.d.ts +1 -0
- package/dist/src/internal/nitro/host/vercel-build-output-config.js +1 -1
- package/dist/src/internal/nitro/routes/runtime-stack.js +1 -1
- package/dist/src/internal/project-context.d.ts +31 -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 +28 -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/reference.d.ts +2 -0
- package/dist/src/internal/workflow/reference.js +1 -0
- package/dist/src/internal/workflow-bundle/authored-workflow-modules.d.ts +0 -9
- package/dist/src/internal/workflow-bundle/authored-workflow-modules.js +1 -1
- package/dist/src/internal/workflow-bundle/builder.js +1 -1
- package/dist/src/internal/workflow-bundle/workflow-builders.d.ts +1 -1
- package/dist/src/internal/workflow-bundle/workflow-builders.js +1 -1
- package/dist/src/internal/workflow-bundle/workflow-transformer.d.ts +1 -1
- package/dist/src/internal/workflow-bundle/workflow-transformer.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/channels/slack/activity-plan.d.ts +4 -0
- package/dist/src/public/channels/slack/activity-plan.js +1 -0
- package/dist/src/public/channels/slack/activity.d.ts +45 -2
- package/dist/src/public/channels/slack/activity.js +2 -1
- package/dist/src/public/channels/slack/index.d.ts +1 -1
- package/dist/src/public/channels/slack/index.js +1 -1
- package/dist/src/public/channels/slack/slackChannel.js +1 -1
- package/dist/src/public/memory/file/backends/vercel-blob.js +1 -1
- package/dist/src/public/memory/index.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/nuxt/index.js +1 -1
- package/dist/src/public/nuxt/module.d.ts +3 -2
- package/dist/src/public/nuxt/module.js +1 -1
- package/dist/src/public/sandbox/vercel-sandbox.d.ts +9 -5
- package/dist/src/public/sandbox/vercel.d.ts +1 -1
- package/dist/src/public/sandbox/vercel.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/self-modification/agent.d.ts +22 -0
- package/dist/src/self-modification/agent.js +1 -0
- package/dist/src/self-modification/extension/classify-registry-item.d.ts +19 -0
- package/dist/src/self-modification/extension/classify-registry-item.js +1 -0
- package/dist/src/self-modification/extension/eve-add.d.ts +56 -0
- package/dist/src/self-modification/extension/eve-add.js +2 -0
- package/dist/src/self-modification/extension/extension.d.ts +2 -0
- package/dist/src/self-modification/extension/extension.js +1 -0
- package/dist/src/self-modification/extension/instructions.d.ts +4 -0
- package/dist/src/self-modification/extension/instructions.js +23 -0
- package/dist/src/self-modification/extension/source-lock.d.ts +2 -0
- package/dist/src/self-modification/extension/source-lock.js +1 -0
- package/dist/src/self-modification/extension/tools/edit_file.d.ts +16 -0
- package/dist/src/self-modification/extension/tools/edit_file.js +1 -0
- package/dist/src/self-modification/extension/tools/registry_add.d.ts +52 -0
- package/dist/src/self-modification/extension/tools/registry_add.js +1 -0
- package/dist/src/self-modification/extension/tools/search_models.d.ts +22 -0
- package/dist/src/self-modification/extension/tools/search_models.js +1 -0
- package/dist/src/self-modification/extension/tools/search_registry.d.ts +103 -0
- package/dist/src/self-modification/extension/tools/search_registry.js +1 -0
- package/dist/src/self-modification/filesystem.d.ts +6 -0
- package/dist/src/self-modification/filesystem.js +1 -0
- package/dist/src/self-modification/sandbox.d.ts +2 -0
- package/dist/src/self-modification/sandbox.js +1 -0
- package/dist/src/services/dev-client/target.d.ts +3 -1
- package/dist/src/setup/boxes/select-model.d.ts +3 -21
- package/dist/src/setup/boxes/select-model.js +1 -1
- package/dist/src/setup/cli/prompt-ui.js +4 -4
- package/dist/src/setup/cli/select-component.d.ts +1 -1
- package/dist/src/setup/cli/select-component.js +1 -1
- package/dist/src/setup/flows/model.d.ts +3 -0
- package/dist/src/setup/flows/model.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/prompter.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/setup/scaffold/update/web-options.js +1 -1
- package/dist/src/shared/action-types.d.ts +103 -30
- package/dist/src/shared/action-types.js +1 -1
- package/dist/src/shared/agent-definition.d.ts +13 -0
- package/dist/src/shared/agent-turn-outcome.d.ts +2 -0
- package/dist/src/shared/agent-turn-outcome.js +1 -1
- package/dist/src/shared/extension-package-contract.d.ts +2 -0
- package/dist/src/shared/extension-package-contract.js +1 -1
- package/dist/src/shared/gateway-model-catalog.d.ts +21 -0
- package/dist/src/shared/gateway-model-catalog.js +1 -0
- package/dist/src/shared/json.js +1 -1
- package/dist/src/shared/sandbox-network-policy.d.ts +1 -1
- package/dist/src/shared/token-usage.d.ts +11 -15
- package/dist/src/shared/token-usage.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/subagents/token-budget.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 +70 -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/tools/provided/sleep.d.ts +2 -2
- package/dist/src/vue/index.js +1 -1
- package/dist/src/vue/use-eve-agent.js +1 -1
- package/docs/agent-config.md +24 -19
- package/docs/channels/eve.mdx +1 -1
- package/docs/concepts/built-in-tools.md +10 -91
- 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 +11 -3
- package/docs/guides/client/streaming.mdx +1 -1
- 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/memory/overview.mdx +1 -1
- package/docs/reference/cli.md +5 -2
- package/docs/sandbox.mdx +3 -1
- package/docs/subagents/index.mdx +9 -8
- package/docs/tools/overview.mdx +11 -10
- package/docs/tools/workflows.mdx +52 -18
- package/package.json +38 -13
- package/dist/src/compiled/@vercel/sandbox-delete/api-client/index.d.ts +0 -2
- package/dist/src/compiled/@vercel/sandbox-delete/index.js +0 -9
- package/dist/src/compiled/@vercel/sandbox-stable/LICENSE +0 -201
- package/dist/src/compiled/@vercel/sandbox-stable/_async-retry.d.ts +0 -8
- package/dist/src/compiled/@vercel/sandbox-stable/_workflow-serde.d.ts +0 -5
- package/dist/src/compiled/@vercel/sandbox-stable/api-client/api-client.d.ts +0 -1456
- package/dist/src/compiled/@vercel/sandbox-stable/api-client/api-error.d.ts +0 -29
- package/dist/src/compiled/@vercel/sandbox-stable/api-client/base-client.d.ts +0 -39
- package/dist/src/compiled/@vercel/sandbox-stable/api-client/file-writer.d.ts +0 -66
- package/dist/src/compiled/@vercel/sandbox-stable/api-client/index.d.ts +0 -2
- package/dist/src/compiled/@vercel/sandbox-stable/api-client/validators.d.ts +0 -899
- package/dist/src/compiled/@vercel/sandbox-stable/api-client/with-retry.d.ts +0 -10
- package/dist/src/compiled/@vercel/sandbox-stable/auth/error.d.ts +0 -15
- package/dist/src/compiled/@vercel/sandbox-stable/auth/file.d.ts +0 -18
- package/dist/src/compiled/@vercel/sandbox-stable/auth/index.d.ts +0 -6
- package/dist/src/compiled/@vercel/sandbox-stable/auth/oauth.d.ts +0 -111
- package/dist/src/compiled/@vercel/sandbox-stable/auth/poll-for-token.d.ts +0 -28
- package/dist/src/compiled/@vercel/sandbox-stable/auth/project.d.ts +0 -40
- package/dist/src/compiled/@vercel/sandbox-stable/command.d.ts +0 -292
- package/dist/src/compiled/@vercel/sandbox-stable/constants.d.ts +0 -5
- package/dist/src/compiled/@vercel/sandbox-stable/execution-context.d.ts +0 -116
- package/dist/src/compiled/@vercel/sandbox-stable/filesystem.d.ts +0 -258
- package/dist/src/compiled/@vercel/sandbox-stable/index.d.ts +0 -12
- package/dist/src/compiled/@vercel/sandbox-stable/index.js +0 -1
- package/dist/src/compiled/@vercel/sandbox-stable/network-policy.d.ts +0 -169
- package/dist/src/compiled/@vercel/sandbox-stable/proxy.d.ts +0 -55
- package/dist/src/compiled/@vercel/sandbox-stable/sandbox-user.d.ts +0 -212
- package/dist/src/compiled/@vercel/sandbox-stable/sandbox.d.ts +0 -1216
- package/dist/src/compiled/@vercel/sandbox-stable/session.d.ts +0 -433
- package/dist/src/compiled/@vercel/sandbox-stable/snapshot.d.ts +0 -229
- package/dist/src/compiled/@vercel/sandbox-stable/utils/get-credentials.d.ts +0 -21
- package/dist/src/compiled/@vercel/sandbox-stable/utils/paginator.d.ts +0 -16
- package/dist/src/compiled/@vercel/sandbox-stable/utils/resolveSignal.d.ts +0 -15
- package/dist/src/compiled/@vercel/sandbox-stable/utils/sandbox-snapshot.d.ts +0 -11
- package/dist/src/compiled/@vercel/sandbox-stable/utils/types.d.ts +0 -11
- package/dist/src/compiled/_chunks/node/decode_jwt-Col8JOnf.js +0 -7
- package/dist/src/compiled/_chunks/node/version-BYHw-SDY.js +0 -1
- package/dist/src/compiled/_chunks/node/version-DH6yRy-M.js +0 -1
- package/dist/src/compiled/_chunks/workflow/dist-CgbVZs5l.js +0 -40
- package/dist/src/compiled/_chunks/workflow/dist-DjojkP5e.js +0 -3
- package/dist/src/compiled/_chunks/workflow/frames-CZ9eHShe.js +0 -3
- package/dist/src/compiled/_chunks/workflow/run-DzyAoGh4.js +0 -1
- package/dist/src/compiled/_chunks/workflow/sleep-3_A5uOp-.js +0 -1
- package/dist/src/compiled/_chunks/workflow/wait-until-BtySPYD0.js +0 -15
- 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/session-token-limits.d.ts +0 -41
- package/dist/src/harness/session-token-limits.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/subagent-token-budget.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/turn-sleep.d.ts +0 -12
- package/dist/src/harness/turn-sleep.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/node_modules/.pnpm/@clack_core@1.3.1/node_modules/@clack/core/dist/index.js +0 -16
- package/dist/src/node_modules/.pnpm/fast-string-truncated-width@3.0.3/node_modules/fast-string-truncated-width/dist/index.js +0 -1
- package/dist/src/node_modules/.pnpm/fast-string-truncated-width@3.0.3/node_modules/fast-string-truncated-width/dist/utils.js +0 -1
- package/dist/src/node_modules/.pnpm/fast-string-width@3.0.2/node_modules/fast-string-width/dist/index.js +0 -1
- package/dist/src/node_modules/.pnpm/fast-wrap-ansi@0.2.2/node_modules/fast-wrap-ansi/lib/main.js +0 -5
- package/dist/src/node_modules/.pnpm/sisteransi@1.0.5/node_modules/sisteransi/src/index.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/compiled/@vercel/{sandbox-delete → sandbox-drives}/LICENSE +0 -0
- /package/dist/src/compiled/@vercel/{sandbox-delete → sandbox-drives}/_async-retry.d.ts +0 -0
- /package/dist/src/compiled/@vercel/{sandbox-delete → sandbox-drives}/_workflow-serde.d.ts +0 -0
- /package/dist/src/compiled/@vercel/{sandbox-delete → sandbox-drives}/api-client/api-error.d.ts +0 -0
- /package/dist/src/compiled/@vercel/{sandbox-delete → sandbox-drives}/api-client/base-client.d.ts +0 -0
- /package/dist/src/compiled/@vercel/{sandbox-delete → sandbox-drives}/api-client/file-writer.d.ts +0 -0
- /package/dist/src/compiled/@vercel/{sandbox-delete → sandbox-drives}/api-client/with-retry.d.ts +0 -0
- /package/dist/src/compiled/@vercel/{sandbox-delete → sandbox-drives}/auth/error.d.ts +0 -0
- /package/dist/src/compiled/@vercel/{sandbox-delete → sandbox-drives}/auth/file.d.ts +0 -0
- /package/dist/src/compiled/@vercel/{sandbox-delete → sandbox-drives}/auth/index.d.ts +0 -0
- /package/dist/src/compiled/@vercel/{sandbox-delete → sandbox-drives}/auth/oauth.d.ts +0 -0
- /package/dist/src/compiled/@vercel/{sandbox-delete → sandbox-drives}/auth/poll-for-token.d.ts +0 -0
- /package/dist/src/compiled/@vercel/{sandbox-delete → sandbox-drives}/auth/project.d.ts +0 -0
- /package/dist/src/compiled/@vercel/{sandbox-delete → sandbox-drives}/command.d.ts +0 -0
- /package/dist/src/compiled/@vercel/{sandbox-delete → sandbox-drives}/execution-context.d.ts +0 -0
- /package/dist/src/compiled/@vercel/{sandbox-delete → sandbox-drives}/filesystem.d.ts +0 -0
- /package/dist/src/compiled/@vercel/{sandbox-delete → sandbox-drives}/network-policy.d.ts +0 -0
- /package/dist/src/compiled/@vercel/{sandbox-delete → sandbox-drives}/proxy.d.ts +0 -0
- /package/dist/src/compiled/@vercel/{sandbox-delete → sandbox-drives}/sandbox-user.d.ts +0 -0
- /package/dist/src/compiled/@vercel/{sandbox-delete → sandbox-drives}/session.d.ts +0 -0
- /package/dist/src/compiled/@vercel/{sandbox-delete → sandbox-drives}/snapshot.d.ts +0 -0
- /package/dist/src/compiled/@vercel/{sandbox-delete → sandbox-drives}/utils/get-credentials.d.ts +0 -0
- /package/dist/src/compiled/@vercel/{sandbox-delete → sandbox-drives}/utils/paginator.d.ts +0 -0
- /package/dist/src/compiled/@vercel/{sandbox-delete → sandbox-drives}/utils/resolveSignal.d.ts +0 -0
- /package/dist/src/compiled/@vercel/{sandbox-delete → sandbox-drives}/utils/sandbox-snapshot.d.ts +0 -0
- /package/dist/src/compiled/@vercel/{sandbox-delete → sandbox-drives}/utils/types.d.ts +0 -0
- /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
|
@@ -1,9 +1,7 @@
|
|
|
1
|
-
import type { RuntimeSession } from "#
|
|
2
|
-
import {
|
|
3
|
-
import type { RuntimeActionResult } from "#shared/action-types.js";
|
|
4
|
-
import type { TaskControlInvocation } from "#shared/dispatch-action.js";
|
|
1
|
+
import type { HarnessSession as RuntimeSession } from "#harness/types.js";
|
|
2
|
+
import type { RuntimeActionResult, RuntimeToolCallActionRequest } from "#shared/action-types.js";
|
|
5
3
|
import { type SessionTaskIndexEntry } from "#tasks/session-index.js";
|
|
6
|
-
import {
|
|
4
|
+
import type { TaskView } from "#tasks/types.js";
|
|
7
5
|
/**
|
|
8
6
|
* Result and lookup helpers shared by the task-control executors
|
|
9
7
|
* (`task_cancel` in the dispatch module,
|
|
@@ -20,18 +18,9 @@ export declare function lookupTaskEntries(session: RuntimeSession, taskIds: read
|
|
|
20
18
|
/** Reads the latest view of every entry, defaulting to `working`. */
|
|
21
19
|
export declare function readTaskViews(entries: readonly SessionTaskIndexEntry[]): Promise<TaskView[]>;
|
|
22
20
|
export declare function readTaskView(entry: SessionTaskIndexEntry): Promise<TaskView>;
|
|
23
|
-
/** Finds the persistent address record for one task-owned agent. */
|
|
24
|
-
export declare function findTaskAgentAddress(session: RuntimeSession, agentId: string): Extract<AgentHandle, {
|
|
25
|
-
phase: "addressed";
|
|
26
|
-
}> | undefined;
|
|
27
|
-
/** Returns the one nonterminal task owning an agent, if any. */
|
|
28
|
-
export declare function findActiveTaskForAgent(session: RuntimeSession, agentId: string, parentTurnId?: string, parentStepIndex?: number): Promise<{
|
|
29
|
-
readonly entry: SessionTaskIndexEntry;
|
|
30
|
-
readonly view: TaskView;
|
|
31
|
-
} | undefined>;
|
|
32
21
|
/** One successful task-control result carrying full task views. */
|
|
33
|
-
export declare function createTaskViewsResult(action:
|
|
22
|
+
export declare function createTaskViewsResult(action: RuntimeToolCallActionRequest, views: readonly TaskView[]): RuntimeActionResult;
|
|
34
23
|
/** One task-control error the model can act on. */
|
|
35
|
-
export declare function createTaskControlError(action:
|
|
24
|
+
export declare function createTaskControlError(action: RuntimeToolCallActionRequest, message: string): RuntimeActionResult;
|
|
36
25
|
/** The ownership error for ids outside this session's task index. */
|
|
37
|
-
export declare function createUnknownTasksError(action:
|
|
26
|
+
export declare function createUnknownTasksError(action: RuntimeToolCallActionRequest, unknown: readonly string[]): RuntimeActionResult;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{findSessionTaskEntry}from"#tasks/session-index.js";import{readLatestTaskView}from"#execution/tasks/parent/run-parent.js";import{isTaskWorkflowTargetGone}from"#execution/tasks/workflow-target.js";import{taskViewsToJson}from"#tasks/json.js";function lookupTaskEntries(t,n){let r=[],i=[];for(let a of n){let n=findSessionTaskEntry(t.state,a);n===void 0?i.push(a):r.push(n)}return i.length>0?{kind:`unknown`,unknown:i}:{entries:r,kind:`found`}}async function readTaskViews(e){return Promise.all(e.map(readTaskView))}async function readTaskView(e){try{return await readLatestTaskView({taskRunId:e.taskRunId})??createPendingTaskView(e)}catch(t){if(isTaskWorkflowTargetGone(t)&&e.terminalView!==void 0)return e.terminalView;throw t}}function createPendingTaskView(e){let t={metadata:e.metadata,status:`working`,taskId:e.taskId};return e.executor===void 0?t:{...t,executor:{binding:e.executor}}}function createTaskViewsResult(e,t){return{callId:e.callId,kind:`tool-result`,output:taskViewsToJson(t),toolName:e.toolName}}function createTaskControlError(e,t){return{callId:e.callId,isError:!0,kind:`tool-result`,output:{message:t},toolName:e.toolName}}function createUnknownTasksError(e,t){return createTaskControlError(e,`Unknown task ids: ${t.join(`, `)}. Tasks belong to the session that created them.`)}export{createTaskControlError,createTaskViewsResult,createUnknownTasksError,lookupTaskEntries,readTaskView,readTaskViews};
|
|
@@ -1,72 +1,43 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
* builds metadata and the parked-tool-call receipt, records the session
|
|
4
|
-
* index, and defines failure semantics for an unacknowledged dispatch.
|
|
2
|
+
* Generic task creation, readiness acknowledgement, and dispatch rejection.
|
|
5
3
|
* Task-run transport (start/command/view) lives in `run-parent.ts`, which
|
|
6
|
-
*
|
|
4
|
+
* Callers compose these primitives around their own executor policy.
|
|
7
5
|
*/
|
|
8
6
|
import type { ActivityObserverConfig } from "#channel/types.js";
|
|
9
|
-
import type {
|
|
10
|
-
import type { RuntimeSubagentChildResult } from "#shared/action-types.js";
|
|
7
|
+
import type { HarnessSession } from "#harness/types.js";
|
|
11
8
|
import type { JsonValue } from "#shared/json.js";
|
|
12
9
|
import type { TaskExecutorBinding } from "#tools/task.js";
|
|
13
|
-
import { type
|
|
10
|
+
import { type TaskMetadata } from "#tasks/types.js";
|
|
14
11
|
/** A prepared background task: identity plus its started durable run. */
|
|
15
12
|
export interface BackgroundTask {
|
|
16
13
|
readonly taskInboxToken: string;
|
|
17
14
|
readonly createdByStepIndex?: number;
|
|
18
15
|
readonly createdByTurnId: string;
|
|
19
16
|
readonly executor?: TaskExecutorBinding;
|
|
20
|
-
readonly metadata:
|
|
17
|
+
readonly metadata: TaskMetadata;
|
|
21
18
|
readonly taskId: string;
|
|
22
19
|
readonly taskRunId: string;
|
|
23
20
|
}
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
}
|
|
28
|
-
/**
|
|
29
|
-
* Creates the durable task record for one delegated subagent call,
|
|
30
|
-
* before the child dispatch side effect. The task must exist first so
|
|
31
|
-
* a fast child always finds a live command hook; a duplicate replay
|
|
32
|
-
* re-derives the same token and the loser exits on the hook claim.
|
|
33
|
-
*/
|
|
34
|
-
export declare function beginDelegatedTask(input: {
|
|
35
|
-
readonly activityObserver?: ActivityObserverConfig;
|
|
36
|
-
readonly agentId: string;
|
|
21
|
+
type BackgroundTaskDraft = Omit<BackgroundTask, "taskRunId">;
|
|
22
|
+
/** Derives the replay-stable task identity before its owning run is started. */
|
|
23
|
+
export declare function prepareBackgroundTask(input: {
|
|
37
24
|
readonly callId: string;
|
|
38
|
-
readonly
|
|
39
|
-
readonly name: string;
|
|
25
|
+
readonly metadata: TaskMetadata;
|
|
40
26
|
readonly parentSessionId: string;
|
|
41
27
|
readonly parentStepIndex?: number;
|
|
42
28
|
readonly parentTurnId: string;
|
|
43
|
-
readonly session:
|
|
44
|
-
}):
|
|
45
|
-
/**
|
|
29
|
+
readonly session: HarnessSession;
|
|
30
|
+
}): BackgroundTaskDraft;
|
|
31
|
+
/** Starts a lifecycle-only task run for a non-workflow external executor. */
|
|
46
32
|
export declare function beginBackgroundTask(input: {
|
|
47
33
|
readonly activityObserver?: ActivityObserverConfig;
|
|
48
34
|
readonly callId: string;
|
|
49
|
-
readonly metadata:
|
|
35
|
+
readonly metadata: TaskMetadata;
|
|
50
36
|
readonly parentSessionId: string;
|
|
51
37
|
readonly parentStepIndex?: number;
|
|
52
38
|
readonly parentTurnId: string;
|
|
53
|
-
readonly session:
|
|
39
|
+
readonly session: HarnessSession;
|
|
54
40
|
}): Promise<BackgroundTask>;
|
|
55
|
-
/**
|
|
56
|
-
* Settles a delegated dispatch that acknowledged a child: persists the task
|
|
57
|
-
* in the session index and returns the receipt that resolves the originating
|
|
58
|
-
* tool call. Agent identity and routing remain in the persistent address
|
|
59
|
-
* record; task state owns execution availability.
|
|
60
|
-
*/
|
|
61
|
-
export declare function settleDelegatedDispatch(input: {
|
|
62
|
-
readonly callId: string;
|
|
63
|
-
readonly session: RuntimeSession;
|
|
64
|
-
readonly subagentName: string;
|
|
65
|
-
readonly task: DelegatedTask;
|
|
66
|
-
}): Promise<{
|
|
67
|
-
readonly receipt: RuntimeSubagentChildResult;
|
|
68
|
-
readonly session: RuntimeSession;
|
|
69
|
-
}>;
|
|
70
41
|
/** Releases task events only after the parent session index committed. */
|
|
71
42
|
export declare function acknowledgeDelegatedTasksStep(input: {
|
|
72
43
|
readonly tasks: readonly {
|
|
@@ -75,13 +46,9 @@ export declare function acknowledgeDelegatedTasksStep(input: {
|
|
|
75
46
|
readonly taskRunId: string;
|
|
76
47
|
}[];
|
|
77
48
|
}): Promise<void>;
|
|
78
|
-
/** Fails an indexed task whose child dispatch was definitively rejected. */
|
|
79
|
-
export declare function failDelegatedDispatch(input: {
|
|
80
|
-
readonly error: JsonValue;
|
|
81
|
-
readonly task: DelegatedTask;
|
|
82
|
-
}): Promise<void>;
|
|
83
49
|
/** Silently terminates a task whose child dispatch failed before parent indexing. */
|
|
84
50
|
export declare function rejectDelegatedDispatch(input: {
|
|
85
51
|
readonly error: JsonValue;
|
|
86
52
|
readonly task: BackgroundTask;
|
|
87
53
|
}): Promise<void>;
|
|
54
|
+
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{sessionCommandHookToken}from"#execution/session-command-token.js";import{
|
|
1
|
+
import{sessionCommandHookToken}from"#execution/session-command-token.js";import{readLatestTaskView,sendTaskCommand,sendTaskCommandToOwner,startTaskRun,waitForTaskCommandOwner}from"#execution/tasks/parent/run-parent.js";import{isTerminalTaskStatus}from"#tasks/types.js";import{deriveTaskId,deriveTaskInboxToken}from"#tasks/task-id.js";function prepareBackgroundTask(e){let t=deriveTaskId({callId:e.callId,parentSessionId:e.parentSessionId,parentTurnId:e.parentTurnId});return{taskInboxToken:deriveTaskInboxToken({parentContinuationToken:e.session.continuationToken,taskId:t}),createdByStepIndex:e.parentStepIndex??0,createdByTurnId:e.parentTurnId,metadata:e.metadata,taskId:t}}async function beginBackgroundTask(t){let n=prepareBackgroundTask(t);await startTaskRun({activityObserver:t.activityObserver,taskInboxToken:n.taskInboxToken,initialView:{metadata:n.metadata,status:`working`,taskId:n.taskId},parentContinuationToken:sessionCommandHookToken(t.session.sessionId)});let r=await waitForTaskCommandOwner({taskInboxToken:n.taskInboxToken});return{...n,taskRunId:r.runId}}async function acknowledgeDelegatedTasksStep(e){"use step";for(let n of e.tasks){if(await sendTaskCommandToOwner({command:{kind:`ready`},taskInboxToken:n.taskInboxToken,retryUnreachable:{attempts:20,delayMs:250}})!==void 0)continue;let e=await readLatestTaskView({taskRunId:n.taskRunId});if(!(e!==void 0&&isTerminalTaskStatus(e.status)))throw Error(`Task run "${n.taskId}" did not accept its readiness command.`)}}async function rejectDelegatedDispatch(e){await sendTaskCommand({command:{data:e.error,kind:`reject-dispatch`},taskInboxToken:e.task.taskInboxToken,retryUnreachable:{attempts:20,delayMs:250}})}export{acknowledgeDelegatedTasksStep,beginBackgroundTask,prepareBackgroundTask,rejectDelegatedDispatch};
|
|
@@ -1,24 +1,22 @@
|
|
|
1
|
-
import type { RuntimeSession } from "#execution/agent-handle-dispatch.js";
|
|
2
1
|
import type { ChannelAdapter } from "#channel/adapter.js";
|
|
3
|
-
import type {
|
|
4
|
-
import type {
|
|
5
|
-
import
|
|
6
|
-
import type {
|
|
2
|
+
import type { HarnessSession as RuntimeSession } from "#harness/types.js";
|
|
3
|
+
import type { BackgroundTask } from "#execution/tasks/parent/delegate.js";
|
|
4
|
+
import { type TaskExecutorCancel } from "#execution/tasks/parent/task-cancel.js";
|
|
5
|
+
import type { RuntimeActionResult, RuntimeToolCallActionRequest } from "#shared/action-types.js";
|
|
7
6
|
import type { SessionTaskIndexEntry } from "#tasks/session-index.js";
|
|
8
|
-
import { type
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
*
|
|
16
|
-
* Returns the current session alongside the action result.
|
|
17
|
-
*/
|
|
7
|
+
import { type TaskInboundUpdate, type TaskView } from "#tasks/types.js";
|
|
8
|
+
export type DeliverTaskUpdate = (input: {
|
|
9
|
+
readonly adapter?: ChannelAdapter;
|
|
10
|
+
readonly callback: unknown;
|
|
11
|
+
readonly update: TaskInboundUpdate;
|
|
12
|
+
}) => Promise<string | undefined>;
|
|
13
|
+
export declare function isTaskControlAction(action: RuntimeToolCallActionRequest): boolean;
|
|
18
14
|
export declare function executeTaskControlAction(input: {
|
|
19
|
-
readonly action:
|
|
15
|
+
readonly action: RuntimeToolCallActionRequest;
|
|
20
16
|
readonly adapter?: ChannelAdapter;
|
|
21
|
-
readonly bundle: CompiledBundle;
|
|
17
|
+
readonly bundle: import("#runtime/sessions/runtime-context-keys.js").CompiledBundle;
|
|
18
|
+
readonly cancelOwnedWork?: TaskExecutorCancel;
|
|
19
|
+
readonly deliverUpdate?: DeliverTaskUpdate;
|
|
22
20
|
readonly parentStepIndex?: number;
|
|
23
21
|
readonly parentTurnId: string;
|
|
24
22
|
readonly serializedContext?: Record<string, unknown>;
|
|
@@ -26,25 +24,12 @@ export declare function executeTaskControlAction(input: {
|
|
|
26
24
|
}): Promise<{
|
|
27
25
|
readonly result: RuntimeActionResult;
|
|
28
26
|
readonly session: RuntimeSession;
|
|
29
|
-
readonly pendingTask?:
|
|
27
|
+
readonly pendingTask?: BackgroundTask;
|
|
30
28
|
}>;
|
|
31
|
-
/** Commits
|
|
29
|
+
/** Commits cancellation, then stops task-owned child work and its lifecycle run. */
|
|
32
30
|
export declare function cancelOwnedTask(input: {
|
|
33
|
-
readonly
|
|
31
|
+
readonly cancelOwnedWork?: TaskExecutorCancel;
|
|
34
32
|
readonly entry: SessionTaskIndexEntry;
|
|
35
33
|
readonly serializedContext?: Record<string, unknown>;
|
|
36
|
-
readonly session
|
|
34
|
+
readonly session?: RuntimeSession;
|
|
37
35
|
}): Promise<TaskView>;
|
|
38
|
-
/**
|
|
39
|
-
* Sends the cooperative abort to the child identified by a subagent
|
|
40
|
-
* executor binding. Failures are logged, never thrown: the task is already
|
|
41
|
-
* terminal when this runs, so the worst outcome is a child that runs to
|
|
42
|
-
* completion and has its callback refused.
|
|
43
|
-
*/
|
|
44
|
-
export declare function propagateSubagentExecutorCancel(input: {
|
|
45
|
-
readonly bundle: CompiledBundle | undefined;
|
|
46
|
-
readonly childTurnId?: string;
|
|
47
|
-
readonly executor: SubagentExecutorData;
|
|
48
|
-
readonly serializedContext?: Record<string, unknown>;
|
|
49
|
-
readonly taskId: string;
|
|
50
|
-
}): Promise<void>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{sendTaskCommand}from"#execution/tasks/parent/run-parent.js";import{isTerminalTaskStatus}from"#tasks/types.js";import{createTaskControlError,createTaskViewsResult,createUnknownTasksError,lookupTaskEntries,readTaskView}from"#execution/tasks/parent/control-shared.js";import{cancelTaskOwnedWork}from"#execution/tasks/parent/task-cancel.js";import{TASK_CANCEL_TOOL_NAME,TASK_TOOL_NAMES,TASK_UPDATE_TOOL_NAME}from"#tools/framework/task-contract.js";function isTaskControlAction(e){return e.kind===`tool-call`&&TASK_TOOL_NAMES.has(e.toolName)}async function executeTaskControlAction(e){let{action:t,session:o}=e;if(t.toolName===TASK_UPDATE_TOOL_NAME){let r=t.input.message;if(typeof r!=`string`||r.trim()===``)return{result:createTaskControlError(t,"Provide a non-empty `message`."),session:o};let i={callId:t.callId,kind:`task-update`,message:r,updateEpoch:e.parentTurnId,updateIndex:e.parentStepIndex??0},a=await e.deliverUpdate?.({adapter:e.adapter,callback:e.serializedContext?.[`eve.sessionCallback`],update:i});return{result:a===void 0?createTaskControlError(t,`task_update requires a task-owned session.`):{callId:t.callId,kind:`tool-result`,output:{status:`sent`,taskId:a},toolName:t.toolName},session:o}}let s=readTaskIds(t.input);if(s===void 0||s.length===0)return{result:createTaskControlError(t,"Provide a non-empty `taskIds` array."),session:o};let c=lookupTaskEntries(o,s);if(c.kind===`unknown`)return{result:createUnknownTasksError(t,c.unknown),session:o};if(t.toolName!==TASK_CANCEL_TOOL_NAME)return{result:createTaskControlError(t,`Unsupported task control "${t.toolName}".`),session:o};let l=[];for(let t of c.entries)l.push(await cancelOwnedTask({cancelOwnedWork:e.cancelOwnedWork,entry:t,serializedContext:e.serializedContext,session:o}));return{result:createTaskViewsResult(t,l),session:o}}async function cancelOwnedTask(n){let r=await sendTaskCommand({command:{kind:`cancel`},taskInboxToken:n.entry.taskInboxToken}),i=await readTaskView(n.entry);for(let e=0;e<10&&!isTerminalTaskStatus(i.status);e+=1)await new Promise(e=>setTimeout(e,250)),i=await readTaskView(n.entry);if(!isTerminalTaskStatus(i.status))throw Error(`Task "${n.entry.taskId}" did not commit cancellation before timeout.`);return i.status!==`cancelled`||r!==`delivered`||await cancelTaskOwnedWork({cancelOwnedWork:n.cancelOwnedWork,entry:n.entry,serializedContext:n.serializedContext,session:n.session}),i}function readTaskIds(e){let t=e.taskIds;if(Array.isArray(t))return t.filter(e=>typeof e==`string`&&e.trim()!==``)}export{cancelOwnedTask,executeTaskControlAction,isTaskControlAction};
|
|
@@ -1,28 +1,18 @@
|
|
|
1
|
-
import type { SubagentInputRequestHookPayload } from "#channel/types.js";
|
|
2
|
-
import type { SubagentAuthorizationEventHookPayload } from "#channel/types.js";
|
|
3
1
|
import { type DurableSessionState } from "#execution/durable-session-store.js";
|
|
4
|
-
import {
|
|
5
|
-
/** Validates and
|
|
2
|
+
import type { TaskInputRequestDelivery, TaskView } from "#tasks/types.js";
|
|
3
|
+
/** Validates and records a generic task-owned workflow request. */
|
|
6
4
|
export declare function recordTaskInputRequestStep(input: {
|
|
7
|
-
readonly
|
|
8
|
-
readonly serializedContext: Record<string, unknown>;
|
|
5
|
+
readonly request: TaskInputRequestDelivery;
|
|
9
6
|
readonly sessionState: DurableSessionState;
|
|
10
|
-
readonly taskId: string;
|
|
11
7
|
}): Promise<{
|
|
12
8
|
readonly accepted: false;
|
|
13
9
|
readonly sessionState: DurableSessionState;
|
|
14
10
|
} | {
|
|
15
11
|
readonly accepted: true;
|
|
16
|
-
readonly
|
|
12
|
+
readonly request: TaskInputRequestDelivery;
|
|
17
13
|
readonly sessionState: DurableSessionState;
|
|
18
14
|
}>;
|
|
19
|
-
/**
|
|
20
|
-
export declare function acceptTaskAuthorizationEventStep(input: {
|
|
21
|
-
readonly hookPayload: SubagentAuthorizationEventHookPayload;
|
|
22
|
-
readonly sessionState: DurableSessionState;
|
|
23
|
-
readonly taskId: string;
|
|
24
|
-
}): Promise<boolean>;
|
|
25
|
-
/** Caches terminal task views before their workflow runs can expire. */
|
|
15
|
+
/** Caches terminal task views before their workflow runs expire. */
|
|
26
16
|
export declare function recordTerminalTaskViewsStep(input: {
|
|
27
17
|
readonly sessionState: DurableSessionState;
|
|
28
18
|
readonly views: readonly TaskView[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{createEveTaskInputRoutePath}from"#protocol/routes.js";import{isInputRequest}from"#shared/input.js";import{
|
|
1
|
+
import{createEveTaskInputRoutePath}from"#protocol/routes.js";import{isInputRequest}from"#shared/input.js";import{readDurableSession}from"#execution/durable-session-store.js";import{getAgentHandleStore}from"#subagents/handles/store.js";import{cacheTerminalTaskView,findSessionTaskEntry}from"#tasks/session-index.js";import{createTaskInputRequestId,upsertProxyInputRequestState}from"#harness/proxy-input-requests.js";import{readLatestTaskView}from"#execution/tasks/parent/run-parent.js";import{applyTaskAgentHandleCommand}from"#subagents/handles/transitions.js";import{createTaskInputCapabilityToken}from"#execution/task-input-capability.js";import{createRemoteTaskInputCallbackUrl}from"#execution/workflow-callback-url.js";async function recordTaskInputRequestStep(i){"use step";let a=await readDurableSession(i.sessionState),o=findSessionTaskEntry(a.state,i.request.taskId),s=i.request.requests??[i.request.request];if(o===void 0||s.length===0||!s.every(isInputRequest))return{accepted:!1,sessionState:i.sessionState};let c=await readLatestTaskView({taskRunId:o.taskRunId}),l=s.map(e=>e.requestId);if(c?.status!==`input_required`||c.inputRequests.length!==l.length||!c.inputRequests.every((e,t)=>typeof e==`object`&&!!e&&!Array.isArray(e)&&Reflect.get(e,`requestId`)===l[t]))return{accepted:!1,sessionState:i.sessionState};let u=s.map(e=>({...e,requestId:createTaskInputRequestId(i.request.taskId,e.requestId)})),d=getAgentHandleStore(a.state)?.handles.find(e=>e.phase===`claimed`&&e.ownerId===i.request.taskId),f=d?.phase===`claimed`&&d.address.kind===`agent/remote`?createRemoteTaskInputCallbackUrl(d.address.url,createEveTaskInputRoutePath(createTaskInputCapabilityToken(i.request.replyTo))):void 0,p=upsertProxyInputRequestState({entries:s.map((e,t)=>{let n=u[t],r={childContinuationToken:i.request.replyTo,childRequestId:e.requestId,kind:e.kind,taskId:i.request.taskId};return f!==void 0&&(r.childResponseUrl=f),[n.requestId,r]}),forChildContinuationToken:i.request.replyTo,state:a.state});return{accepted:!0,request:i.request.requests===void 0?{...i.request,request:u[0]}:{...i.request,request:void 0,requests:u},sessionState:{...i.sessionState,hasProxyInputRequests:!0,snapshot:{session:{...a,state:p},version:i.sessionState.version}}}}async function recordTerminalTaskViewsStep(e){"use step";let t=await readDurableSession(e.sessionState),r=t;for(let t of e.views){if(findSessionTaskEntry(r.state,t.taskId)===void 0)continue;let e=cacheTerminalTaskView(r.state,t);e!==r.state&&(r={...r,state:e}),r=applyTaskAgentHandleCommand(r,{kind:`release-owner`,ownerId:t.taskId}).session}return r===t?e.sessionState:{...e.sessionState,snapshot:{session:r,version:e.sessionState.version}}}export{recordTaskInputRequestStep,recordTerminalTaskViewsStep};
|
|
@@ -3,8 +3,8 @@ import { type TaskCommand, type TaskRunInboundPayload, type TaskView } from "#ta
|
|
|
3
3
|
/**
|
|
4
4
|
* Node-side controls for durable task runs — the generic transport layer.
|
|
5
5
|
* This module only speaks `TaskCommand`/`TaskView`; it knows nothing about
|
|
6
|
-
*
|
|
7
|
-
*
|
|
6
|
+
* executor implementations, receipts, or the session index. Caller-specific
|
|
7
|
+
* policy composes these primitives.
|
|
8
8
|
*
|
|
9
9
|
* Every export must be called from inside a `"use step"` body; none of
|
|
10
10
|
* these are steps themselves so dispatch and tool steps can compose them
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { loadContext } from "#context/container.js";
|
|
2
|
+
import { createSubagentReceiptIdentity } from "#execution/tools/subagent/receipt-identity.js";
|
|
3
|
+
import type { JsonObject } from "#shared/json.js";
|
|
4
|
+
export interface SubagentTaskProjection {
|
|
5
|
+
readonly identity?: ReturnType<typeof createSubagentReceiptIdentity>;
|
|
6
|
+
readonly metadata: {
|
|
7
|
+
readonly agentId: string;
|
|
8
|
+
readonly kind: "subagent";
|
|
9
|
+
readonly mode: "local" | "remote";
|
|
10
|
+
readonly name: string;
|
|
11
|
+
};
|
|
12
|
+
readonly receipt: {
|
|
13
|
+
readonly agentId: string;
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
export declare function projectSubagentTask(input: {
|
|
17
|
+
readonly ctx: ReturnType<typeof loadContext>;
|
|
18
|
+
readonly input: JsonObject;
|
|
19
|
+
readonly name: string;
|
|
20
|
+
readonly nodeId: string;
|
|
21
|
+
readonly taskInput: {
|
|
22
|
+
readonly callId: string;
|
|
23
|
+
readonly parentSessionId: string;
|
|
24
|
+
readonly parentTurnId: string;
|
|
25
|
+
};
|
|
26
|
+
}): SubagentTaskProjection;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{BundleKey}from"#runtime/sessions/runtime-context-keys.js";import{getDynamicSubagentSelection}from"#context/dynamic-subagent-lifecycle.js";import{createSubagentReceiptIdentity}from"#execution/tools/subagent/receipt-identity.js";function projectSubagentTask(e){let t=e.input.agentId;if(typeof t==`string`&&t.trim()!==``)return{metadata:{agentId:t,kind:`subagent`,mode:readSubagentTaskMode(e.ctx,e.nodeId),name:e.name},receipt:{agentId:t}};let r=createSubagentReceiptIdentity({callId:e.taskInput.callId,nodeId:e.nodeId,parentSessionId:e.taskInput.parentSessionId,parentTurnId:e.taskInput.parentTurnId,subagentName:e.name});return{identity:r,metadata:{agentId:r.identity.id,kind:`subagent`,mode:readSubagentTaskMode(e.ctx,e.nodeId),name:e.name},receipt:{agentId:r.identity.id}}}function readSubagentTaskMode(n,r){let i=getDynamicSubagentSelection(n,r);return i===void 0?(n.get(BundleKey)?.subagentRegistry.subagentsByNodeId.get(r))?.definition.kind===`remote`?`remote`:`local`:i.kind===`remote`?`remote`:`local`}export{projectSubagentTask};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { SessionTaskIndexEntry } from "#tasks/session-index.js";
|
|
2
|
+
export interface TaskExecutorCancelContext {
|
|
3
|
+
readonly entry: SessionTaskIndexEntry;
|
|
4
|
+
readonly serializedContext?: Record<string, unknown>;
|
|
5
|
+
readonly session?: unknown;
|
|
6
|
+
}
|
|
7
|
+
export type TaskExecutorCancel = (input: TaskExecutorCancelContext) => Promise<void>;
|
|
8
|
+
/** Cancels policy-specific work associated with one task. */
|
|
9
|
+
export declare function cancelTaskOwnedWork(input: TaskExecutorCancelContext & {
|
|
10
|
+
readonly cancelOwnedWork?: TaskExecutorCancel;
|
|
11
|
+
}): Promise<void>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{cancelRun,getRun,getWorld}from"#internal/workflow/runtime.js";import{cancelWorkflowToolRun}from"#execution/tools/workflow/cancel.js";import{readWorkflowToolExecutorAddress}from"#execution/tools/workflow/types.js";async function cancelTaskOwnedWork(t){let n=readWorkflowToolExecutorAddress(t.entry.executor);n!==void 0&&await cancelWorkflowToolRun(n,`Task ${t.entry.taskId} was cancelled.`),await t.cancelOwnedWork?.(t);let r=Date.now()+1e3;for(;Date.now()<r;){try{let e=await getRun(t.entry.taskRunId).status;if(e!==`pending`&&e!==`running`)return}catch{return}await new Promise(e=>setTimeout(e,50))}try{await cancelRun(await getWorld(),t.entry.taskRunId,{cancelReason:`Task ${t.entry.taskId} was cancelled.`})}catch{}}export{cancelTaskOwnedWork};
|
|
@@ -10,7 +10,7 @@ export declare function runBackgroundStep(ctx: ContextContainer, session: Harnes
|
|
|
10
10
|
/**
|
|
11
11
|
* Makes background tool work transactional with the harness step.
|
|
12
12
|
*
|
|
13
|
-
* Concretely: when the model calls a background tool
|
|
13
|
+
* Concretely: when the model calls a background tool,
|
|
14
14
|
* the tool does real external work mid-step — it creates a task run and
|
|
15
15
|
* delivers commands to its inbox — while the step itself can still fail. This
|
|
16
16
|
* provider scopes that work to the step so it either lands with the step or
|
|
@@ -23,8 +23,7 @@ export declare function runBackgroundStep(ctx: ContextContainer, session: Harnes
|
|
|
23
23
|
*
|
|
24
24
|
* - `commit` — step succeeded. Compensates executions that never settled
|
|
25
25
|
* (the tool neither delegated nor completed its task), then records the
|
|
26
|
-
* task entries
|
|
27
|
-
* persisted.
|
|
26
|
+
* task entries onto the session being persisted.
|
|
28
27
|
* - `rollback` — step failed. Compensates incomplete executions, and settled
|
|
29
28
|
* ones too — unless the cause is turn cancellation: those tasks are already
|
|
30
29
|
* running, so they are retained for {@link readRetainedBackgroundToolResult}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{createEveCallbackRoutePath}from"#protocol/routes.js";import{loadContext}from"#context/container.js";import{parseJsonValue}from"#shared/json.js";import{BundleKey}from"#runtime/sessions/runtime-context-keys.js";import{getHarnessEmissionState}from"#harness/emission.js";import{recordTaskAgentAddress}from"#harness/handles/transitions.js";import{createWorkflowCallbackUrl}from"#execution/workflow-callback-url.js";import{cancelToolRun}from"#execution/tool-run/cancel.js";import{runStep}from"#context/run-step.js";import{activeTurnId}from"#harness/active-turn-id.js";import{propagateSubagentExecutorCancel}from"#execution/tasks/parent/dispatch.js";import{isTurnCancellation}from"#harness/turn-cancellation.js";import{readWorkflowToolExecutor}from"#execution/tool-run/background.js";import{CallbackBaseUrlKey,isAuthorizationSignal}from"#harness/authorization.js";import{sendTaskCommand,sendTaskInboundPayload}from"#execution/tasks/parent/run-parent.js";import{recordSessionTask}from"#tasks/session-index.js";import{readSubagentExecutor}from"#tasks/types.js";import{beginBackgroundTask,rejectDelegatedDispatch}from"#execution/tasks/parent/delegate.js";import{BackgroundToolExecutorKey}from"#harness/background-tools.js";import{isAsyncIterable}from"#shared/async-iterable.js";import{createTaskDelegated,isTaskDelegated}from"#tools/task.js";function runBackgroundStep(e,t,n){return runStep(e,t,n,[backgroundToolExecutionProvider])}const backgroundToolExecutionProvider={key:BackgroundToolExecutorKey,create(e,t){return{value:new BackgroundToolExecutionScope(t,e.get(BundleKey))}},async commit(e,t){return await requireExecutionScope(e).commit(t)},async rollback(e,t){await requireExecutionScope(e).rollback(t)},decorateStepResult(e,t){return requireExecutionScope(e).decorate(t)}};function readRetainedBackgroundToolResult(e){let t=e.get(BackgroundToolExecutorKey);return t instanceof BackgroundToolExecutionScope?t.retainedResult():void 0}var BackgroundToolExecutionScope=class{bundle;executions=new Map;records=[];retained=!1;initialSession;constructor(e,t){this.bundle=t,this.initialSession=e}execute(e){let t=this.executions.get(e.options.toolCallId);if(t!==void 0)return t;if(!e.batch.calls.some(t=>t.callId===e.options.toolCallId))throw Error(`Background tool call "${e.options.toolCallId}" was not registered before execution.`);let n=this.start(e);return this.executions.set(e.options.toolCallId,n),n}async commit(e){let t=this.records.filter(e=>!e.settled);return t.length>0&&await compensateBackgroundToolExecution(t,Error(`Background tool execution did not delegate or complete its task.`),this.bundle),this.apply(e)}decorate(e){let t=this.resultFields();return t===void 0?e:{...e,...t}}async rollback(e){let t=this.records.filter(e=>e.settled),n=this.records.filter(e=>!e.settled);if(n.length>0&&await compensateBackgroundToolExecution(n,e,this.bundle),t.length!==0){if(isTurnCancellation(e)){this.retained=!0;return}await compensateBackgroundToolExecution(t,e,this.bundle)}}retainedResult(){return this.retained?this.resultFields():void 0}apply(e){let t=e;for(let e of this.records){if(!e.settled||e.task===void 0)continue;let n=readSubagentExecutor(e.task.executor);n!==void 0&&(t=recordTaskAgentAddress(t,n)),t=recordSessionTask(t,e.task)}return t}resultFields(){let e=this.records.flatMap(e=>e.settled&&e.task!==void 0?[e.task]:[]);if(e.length!==0)return{backgroundTaskSession:this.apply(this.initialSession),backgroundTasks:e.map(({taskInboxToken:e,taskId:t,taskRunId:n})=>({taskInboxToken:e,taskId:t,taskRunId:n}))}}async start(r){let a={settled:!1};this.records.push(a);let o=getHarnessEmissionState(this.initialSession.state),s=await beginBackgroundTask({callId:r.options.toolCallId,metadata:{kind:`tool`,name:r.definition.name},parentSessionId:this.initialSession.sessionId,parentStepIndex:o.stepIndex,parentTurnId:activeTurnId(o),session:this.initialSession});a.task=s;let c=loadContext().get(CallbackBaseUrlKey),l={taskId:s.taskId,token:s.taskInboxToken,...c===void 0?{}:{url:createWorkflowCallbackUrl(c,createEveCallbackRoutePath(s.taskInboxToken))}},u={batch:r.batch.calls,binding:l,delegated:({executor:e,receipt:t})=>createTaskDelegated({binding:l,executor:e,receipt:t}),send:createTaskSender(s,r.options.toolCallId),session:this.initialSession,task:s},d=r.definition.execute(r.toolInput,r.options,u);if(isAsyncIterable(d))throw Error(`Background tools cannot return AsyncIterable output.`);let f=await d;return isAuthorizationSignal(f)?f:isTaskDelegated(f)?(await deliverTaskCommand(s,{executor:f.executor,kind:`bind`}),a.task={...s,executor:f.executor},a.settled=!0,f.receipt):(await deliverTaskCommand(s,{data:parseJsonValue(f),kind:`complete`}),a.settled=!0,f)}};function requireExecutionScope(e){if(!(e instanceof BackgroundToolExecutionScope))throw Error(`The background tool executor is not owned by the task runtime.`);return e}async function deliverTaskCommand(e,t){if(await sendTaskCommand({command:t,taskInboxToken:e.taskInboxToken})!==`delivered`)throw Error(`Task run "${e.taskId}" did not accept "${t.kind}".`)}function createTaskSender(e,t){let n=0;return async r=>{if(r.kind!==`update`){await deliverTaskCommand(e,r);return}if(await sendTaskInboundPayload({payload:{callId:t,kind:`task-update`,message:r.message,updateEpoch:e.taskId,updateIndex:n++},taskInboxToken:e.taskInboxToken})!==`delivered`)throw Error(`Task run "${e.taskId}" did not accept "${r.kind}".`)}}async function compensateBackgroundToolExecution(e,t,n){let r=[];for(let i of e.toReversed()){if(i.task===void 0)continue;try{await rejectDelegatedDispatch({error:{code:`PARENT_STEP_FAILED`,message:t instanceof Error?t.message:String(t)},task:i.task})}catch(e){r.push(e)}let e=readSubagentExecutor(i.task.executor);e!==void 0&&await propagateSubagentExecutorCancel({bundle:n,executor:e,taskId:i.task.taskId});let a=readWorkflowToolExecutor(i.task.executor);a!==void 0&&await cancelToolRun(a,`The step that started the tool failed.`)}if(r.length>0)throw AggregateError([t,...r],`Background tool execution failed and its tasks could not all be rejected.`,{cause:t})}export{backgroundToolExecutionProvider,readRetainedBackgroundToolResult,runBackgroundStep};
|
|
1
|
+
import{createEveCallbackRoutePath}from"#protocol/routes.js";import{sessionCommandHookToken}from"#execution/session-command-token.js";import{loadContext}from"#context/container.js";import{ActivityObserverKey}from"#context/keys.js";import{parseJsonValue}from"#shared/json.js";import{buildCallbackContext}from"#context/build-callback-context.js";import{parseWorkflowToolInput}from"#execution/tools/workflow/background.js";import{getHarnessEmissionState}from"#harness/emission.js";import{deriveAgentOperationId}from"#subagents/handles/operation-id.js";import{getAgentHandleStore,writeHandles}from"#subagents/handles/store.js";import{recordSessionTask}from"#tasks/session-index.js";import{runStep}from"#context/run-step.js";import{activeTurnId}from"#harness/active-turn-id.js";import{AGENT_BUSY,AGENT_MISMATCH,AGENT_UNREACHABLE,formatAgentBusyMessage}from"#subagents/agent-handle-errors.js";import{isTurnCancellation}from"#harness/turn-cancellation.js";import{CallbackBaseUrlKey,isAuthorizationSignal}from"#harness/authorization.js";import{sendTaskCommand,sendTaskInboundPayload,startTaskRun,waitForTaskCommandOwner}from"#execution/tasks/parent/run-parent.js";import{applyTaskAgentHandleCommand}from"#subagents/handles/transitions.js";import{createWorkflowCallbackUrl}from"#execution/workflow-callback-url.js";import{BackgroundToolExecutorKey}from"#harness/background-tools.js";import{deriveBackgroundTaskActivityObserver}from"#execution/activity-work.js";import{isAsyncIterable}from"#shared/async-iterable.js";import{createTaskDelegated,isTaskDelegated}from"#tools/task.js";import{beginBackgroundTask,prepareBackgroundTask,rejectDelegatedDispatch}from"#execution/tasks/parent/delegate.js";import{projectSubagentTask}from"#execution/tasks/parent/subagent-task-projection.js";const IN_PROCESS_WORKFLOW_EXECUTOR={data:{},kind:`workflow-task`};function runBackgroundStep(e,t,n){return runStep(e,t,n,[backgroundToolExecutionProvider])}const backgroundToolExecutionProvider={key:BackgroundToolExecutorKey,create(e,t){return{value:new BackgroundToolExecutionScope(t)}},async commit(e,t){return await requireExecutionScope(e).commit(t)},async rollback(e,t){await requireExecutionScope(e).rollback(t)},decorateStepResult(e,t){return requireExecutionScope(e).decorate(t)}};function readRetainedBackgroundToolResult(e){let t=e.get(BackgroundToolExecutorKey);return t instanceof BackgroundToolExecutionScope?t.retainedResult():void 0}var BackgroundToolExecutionScope=class{executions=new Map;records=[];agentHandleSession;agentHandlesChanged=!1;retained=!1;initialSession;constructor(e){this.initialSession=e,this.agentHandleSession=e}execute(e){let t=this.executions.get(e.options.toolCallId);if(t!==void 0)return t;if(!e.batch.calls.some(t=>t.callId===e.options.toolCallId))throw Error(`Background tool call "${e.options.toolCallId}" was not registered before execution.`);let n=this.start(e);return this.executions.set(e.options.toolCallId,n),n}async readAgentViews(){return(getAgentHandleStore(this.agentHandleSession.state)?.handles??[]).flatMap(e=>e.phase===`reserved`?[]:e.phase===`available`?[{availability:`available`,id:e.identity.id,name:e.identity.name}]:e.phase===`claimed`?[{availability:`busy`,id:e.identity.id,name:e.identity.name,taskId:e.ownerId,taskStatus:`working`}]:[])}async commit(e){let t=this.records.filter(e=>!e.settled);return t.length>0&&await this.compensate(t,Error(`Background tool execution did not delegate or complete its task.`)),this.apply(e)}decorate(e){let t=this.resultFields();return t===void 0?e:{...e,...t}}async rollback(e){let t=this.records.filter(e=>e.settled),n=this.records.filter(e=>!e.settled);if(n.length>0&&await this.compensate(n,e),t.length!==0){if(isTurnCancellation(e)){this.retained=!0;return}await this.compensate(t,e)}}retainedResult(){return this.retained?this.resultFields():void 0}apply(e){let t=e;for(let e of this.records)!e.settled||e.task===void 0||(t=recordSessionTask(t,e.task));return this.agentHandlesChanged&&(t=writeHandles(t,getAgentHandleStore(this.agentHandleSession.state)?.handles??[])),t}resultFields(){let e=this.records.flatMap(e=>e.settled&&e.task!==void 0?[e.task]:[]);if(e.length!==0)return{backgroundTaskSession:this.apply(this.initialSession),backgroundTasks:e.map(({taskInboxToken:e,taskId:t,taskRunId:n})=>({taskInboxToken:e,taskId:t,taskRunId:n}))}}async start(t){let r={settled:!1};this.records.push(r);let a=getHarnessEmissionState(this.initialSession.state),o=loadContext(),c=await this.startTask({ctx:o,emission:a,input:t,record:r}),l=c.task;r.task=l;let u=o.get(CallbackBaseUrlKey),d={taskId:l.taskId,token:l.taskInboxToken,...u===void 0?{}:{url:createWorkflowCallbackUrl(u,createEveCallbackRoutePath(l.taskInboxToken))}},f={batch:t.batch.calls,binding:d,delegated:({executor:e,receipt:t})=>createTaskDelegated({binding:d,executor:e,receipt:t}),send:createTaskSender(l,t.options.toolCallId),session:this.initialSession,task:l};if(t.definition.workflowId!==void 0)return r.settled=!0,{...c.receipt,status:`working`,taskId:l.taskId};let p=t.definition.execute(t.toolInput,t.options,f);if(isAsyncIterable(p))throw Error(`Background tools cannot return AsyncIterable output.`);let m=await p;return isAuthorizationSignal(m)?m:isTaskDelegated(m)?(m.executor!==void 0&&(await deliverTaskCommand(l,{executor:m.executor,kind:`bind`}),r.task={...l,executor:m.executor}),r.settled=!0,c.receipt===void 0?m.receipt:{...m.receipt,...c.receipt}):(await deliverTaskCommand(l,{data:parseJsonValue(m),kind:`complete`}),r.settled=!0,m)}async startTask(e){let n=e.input.definition.workflowId===void 0?void 0:{...e.input.definition,workflowId:e.input.definition.workflowId},i=n===void 0?void 0:parseWorkflowToolInput(e.input.toolInput,e.input.definition.name),s=activeTurnId(e.emission),l=n?.resultKind===`subagent`&&i!==void 0?projectSubagentTask({ctx:e.ctx,input:i,name:e.input.definition.name,nodeId:n.nodeId??e.input.definition.name,taskInput:{callId:e.input.options.toolCallId,parentSessionId:this.initialSession.sessionId,parentTurnId:s}}):void 0;if(l!==void 0&&l.identity===void 0&&!hasAgentHandle(this.agentHandleSession,l.metadata.agentId)){let{agentId:t,...r}=i;i=r,l=projectSubagentTask({ctx:e.ctx,input:r,name:e.input.definition.name,nodeId:n.nodeId??e.input.definition.name,taskInput:{callId:e.input.options.toolCallId,parentSessionId:this.initialSession.sessionId,parentTurnId:s}})}let u=l?.metadata??{kind:`tool`,name:e.input.definition.name},d={activityObserver:deriveBackgroundTaskActivityObserver({activityObserver:e.ctx.get(ActivityObserverKey),callId:e.input.options.toolCallId,name:u.name,parentSessionId:this.initialSession.sessionId,parentTurnId:s,rootSessionId:this.initialSession.rootSessionId??this.initialSession.sessionId}),callId:e.input.options.toolCallId,metadata:u,parentSessionId:this.initialSession.sessionId,parentStepIndex:e.emission.stepIndex,parentTurnId:s,session:this.initialSession};if(n===void 0)return{task:await beginBackgroundTask({activityObserver:d.activityObserver,callId:d.callId,metadata:d.metadata,parentSessionId:d.parentSessionId,parentStepIndex:d.parentStepIndex,parentTurnId:d.parentTurnId,session:d.session})};if(i===void 0)throw Error(`Background workflow tool "${e.input.definition.name}" has no input.`);let f=prepareBackgroundTask(d);if(n.resultKind===`subagent`&&l!==void 0&&l.identity!==void 0){let t=l.identity;if(this.applyAgentHandleCommand({identity:t.identity,callId:d.callId,kind:`reserve`,operationId:t.operation.id,ownerId:f.taskId}).kind!==`ready`)throw Error(`Agent handle store rejected start operation "${t.operation.id}".`);e.record.reservation={agentId:t.identity.id,operationId:t.operation.id}}if(n.resultKind===`subagent`&&l!==void 0&&l.identity===void 0){let t=deriveAgentOperationId({callId:d.callId,parentSessionId:d.parentSessionId,parentTurnId:s}),n=this.applyAgentHandleCommand({agentId:l.metadata.agentId,callId:d.callId,expectedTarget:l.metadata.mode,invokedName:l.metadata.name,kind:`claim`,operationId:t,ownerId:f.taskId});readClaimedHandle(n)?e.record.claim={operationId:t,taskId:f.taskId}:throwAgentClaimError(l.metadata.agentId,n)}await startTaskRun({activityObserver:d.activityObserver,initialView:{metadata:f.metadata,status:`working`,taskId:f.taskId},parentContinuationToken:sessionCommandHookToken(this.initialSession.sessionId),taskInboxToken:f.taskInboxToken,workflow:{callId:d.callId,executeInput:n.executeInput?.(i),input:i,resultKind:n.resultKind,session:buildCallbackContext().session,stepIndex:e.emission.stepIndex,toolName:e.input.definition.name,workflowId:n.workflowId}});let m=await waitForTaskCommandOwner({taskInboxToken:f.taskInboxToken}),h={...f,executor:IN_PROCESS_WORKFLOW_EXECUTOR,taskRunId:m.runId};return e.record.task=h,n.resultKind!==`subagent`||l===void 0?{task:h}:(l.identity,{receipt:l.receipt,task:h})}applyAgentHandleCommand(e){let t=applyTaskAgentHandleCommand(this.agentHandleSession,e);return t.session!==this.agentHandleSession&&(this.agentHandleSession=t.session,this.agentHandlesChanged=!0),t.result}async compensate(e,t){let n=[];for(let r of e.toReversed()){if(r.task!==void 0)try{await rejectDelegatedDispatch({error:{code:`PARENT_STEP_FAILED`,message:t instanceof Error?t.message:String(t)},task:r.task})}catch(e){n.push(e)}r.claim!==void 0&&this.applyAgentHandleCommand({kind:`release-owner`,ownerId:r.claim.taskId}),r.reservation!==void 0&&r.task!==void 0&&this.applyAgentHandleCommand({agentId:r.reservation.agentId,kind:`remove`,ownerId:r.task.taskId})}if(n.length>0)throw AggregateError([t,...n],`Background tool execution failed and its tasks could not all be rejected.`,{cause:t})}};function hasAgentHandle(e,t){return getAgentHandleStore(e.state)?.handles.some(e=>e.identity.id===t)===!0}function requireExecutionScope(e){if(!(e instanceof BackgroundToolExecutionScope))throw Error(`The background tool executor is not owned by the task runtime.`);return e}async function deliverTaskCommand(e,t){if(await sendTaskCommand({command:t,taskInboxToken:e.taskInboxToken})!==`delivered`)throw Error(`Task run "${e.taskId}" did not accept "${t.kind}".`)}function createTaskSender(e,t){let n=0;return async r=>{if(r.kind!==`update`){await deliverTaskCommand(e,r);return}if(await sendTaskInboundPayload({payload:{callId:t,kind:`task-update`,message:r.message,updateEpoch:e.taskId,updateIndex:n++},taskInboxToken:e.taskInboxToken})!==`delivered`)throw Error(`Task run "${e.taskId}" did not accept "${r.kind}".`)}}function readClaimedHandle(e){return e.kind===`ready`&&e.handle?.phase===`claimed`}function throwAgentClaimError(e,t){throw t.kind===`mismatch`?Error(JSON.stringify({code:AGENT_MISMATCH,message:`Agent "${e}" no longer matches this subagent definition. Start a new agent instead.`})):t.kind===`busy`?Error(JSON.stringify({code:AGENT_BUSY,message:formatAgentBusyMessage({agentId:e,agentName:t.handle.identity.name,ownerId:`ownerId`in t.handle?t.handle.ownerId:void 0})})):Error(JSON.stringify({code:AGENT_UNREACHABLE,message:`Agent with id "${e}" is no longer reachable.`}))}export{backgroundToolExecutionProvider,readRetainedBackgroundToolResult,runBackgroundStep};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{createLogger,logError}from"#internal/logging.js";import{BundleKey}from"#runtime/sessions/runtime-context-keys.js";import{cancelRun,getWorld}from"#internal/workflow/runtime.js";import{
|
|
1
|
+
import{createLogger,logError}from"#internal/logging.js";import{BundleKey}from"#runtime/sessions/runtime-context-keys.js";import{cancelRun,getWorld}from"#internal/workflow/runtime.js";import{deserializeContext}from"#context/serialize.js";import{readDurableSession}from"#execution/durable-session-store.js";import{resetRemoteAgentSession,resolveRemoteAgentForAction,resolveRemoteAgentStreamHeaders}from"#subagents/remote-dispatch.js";import{getAgentHandleStore}from"#subagents/handles/store.js";import{getDynamicSubagentSelection}from"#context/dynamic-subagent-lifecycle.js";import{cancelAllIndexedSessionTasksStep}from"#execution/cancel-indexed-session-tasks-step.js";const log=createLogger(`execution.terminate-child-sessions`);async function terminateChildSessionsStep(e){"use step";let r;try{r=await readDurableSession(e.sessionState)}catch(n){logError(log,`failed to read child sessions for termination`,n,{parentSessionId:e.sessionState.sessionId});return}let i=getAgentHandleStore(r.state)?.handles??[],a=i.some(e=>`address`in e&&e.address.kind===`agent/remote`),o;if(await cancelAllIndexedSessionTasksStep({serializedContext:e.serializedContext,sessionState:e.sessionState}),a){if(e.serializedContext===void 0)throw Error(`Child finalization requires serialized runtime context.`);let t=await deserializeContext(e.serializedContext);o={bundle:t.require(BundleKey),ctx:t}}if(i.length!==0)for(let e of i){if(!(`address`in e)){log.debug(`skipping unaddressed child`,{agentId:e.identity.id,parentSessionId:r.sessionId});continue}try{if(e.address.kind===`agent/remote`)if(e.address.credentialResolver!==void 0){let t=e.address.credentialResolver.resolverId;await resetRemoteAgentSession({headers:t===void 0?{}:await resolveRemoteAgentStreamHeaders({bundle:o.bundle,name:e.identity.name,resolverId:t,url:e.address.url}),remote:{name:e.identity.name,url:e.address.url},sessionId:e.address.sessionId})}else{let t=getDynamicSubagentSelection(o.ctx,e.identity.nodeId),n=resolveRemoteAgentForAction({dynamicRemoteAgent:t?.kind===`remote`?t.remoteAgent:void 0,nodeId:e.identity.nodeId,registry:o.bundle.subagentRegistry.subagentsByNodeId,remoteAgentName:e.identity.name});n.url===e.address.url?await resetRemoteAgentSession({remote:n,sessionId:e.address.sessionId}):await resetRemoteAgentSession({headers:{},remote:{name:e.identity.name,url:e.address.url},sessionId:e.address.sessionId})}else await cancelRun(await getWorld(),e.address.sessionId,{cancelReason:`Parent session ended`})}catch(n){logError(log,`failed to terminate child session`,n,{agentId:e.identity.id,childSessionId:e.address.sessionId,kind:e.address.kind,parentSessionId:r.sessionId})}}}export{terminateChildSessionsStep};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{sleep}from"#compiled/@workflow/core/index.js";async function executeSleepTool(e){"use workflow";return await sleep(Math.ceil(e.seconds*1e3)),{waitedSeconds:e.seconds}}executeSleepTool.workflowId=`workflow//eve@0.51.1//executeSleepTool`;export{executeSleepTool};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { z } from "#compiled/zod/index.js";
|
|
2
|
+
export { executeSleepTool } from "#execution/tools/sleep-workflow.js";
|
|
2
3
|
export declare const SLEEP_TOOL_DESCRIPTION = "Wait for a specified amount of time before continuing. Use this when a process or condition needs time to change before it is useful to check its progress or status again.";
|
|
3
4
|
export declare const SLEEP_INPUT_SCHEMA: z.ZodObject<{
|
|
4
5
|
seconds: z.ZodNumber;
|
|
@@ -8,8 +9,3 @@ export declare const SLEEP_OUTPUT_SCHEMA: z.ZodObject<{
|
|
|
8
9
|
}, z.core.$strict>;
|
|
9
10
|
export type SleepToolInput = z.infer<typeof SLEEP_INPUT_SCHEMA>;
|
|
10
11
|
export type SleepToolOutput = z.infer<typeof SLEEP_OUTPUT_SCHEMA>;
|
|
11
|
-
/**
|
|
12
|
-
* Records a durable wait for the owning turn workflow to fulfill after the
|
|
13
|
-
* current atomic step finishes.
|
|
14
|
-
*/
|
|
15
|
-
export declare function executeSleepTool(input: SleepToolInput): SleepToolOutput;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{z}from"#compiled/zod/index.js";import{
|
|
1
|
+
import{z}from"#compiled/zod/index.js";import{executeSleepTool}from"#execution/tools/sleep-workflow.js";const MAX_SLEEP_SECONDS=Math.floor((2**53-1)/1e3),SLEEP_TOOL_DESCRIPTION=`Wait for a specified amount of time before continuing. Use this when a process or condition needs time to change before it is useful to check its progress or status again.`,SLEEP_INPUT_SCHEMA=z.strictObject({seconds:z.number().positive().max(MAX_SLEEP_SECONDS).describe(`How long to wait, in seconds.`)}),SLEEP_OUTPUT_SCHEMA=z.strictObject({waitedSeconds:z.number().positive()});export{SLEEP_INPUT_SCHEMA,SLEEP_OUTPUT_SCHEMA,SLEEP_TOOL_DESCRIPTION,executeSleepTool};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { type DurableSessionState } from "#execution/durable-session-store.js";
|
|
2
|
+
import { type TaskAuthorizationEventDelivery } from "#tasks/types.js";
|
|
3
|
+
/** Validates that a task child's authorization event came from an agent the task owns. */
|
|
4
|
+
export declare function acceptTaskAuthorizationEventStep(input: {
|
|
5
|
+
readonly delivery: TaskAuthorizationEventDelivery;
|
|
6
|
+
readonly sessionState: DurableSessionState;
|
|
7
|
+
}): Promise<boolean>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{readDurableSession}from"#execution/durable-session-store.js";import{getAgentHandleStore}from"#subagents/handles/store.js";import{findSessionTaskEntry}from"#tasks/session-index.js";import{readLatestTaskView}from"#execution/tasks/parent/run-parent.js";import{isTerminalTaskStatus}from"#tasks/types.js";async function acceptTaskAuthorizationEventStep(t){"use step";let{hookPayload:n,taskId:r}=t.delivery,i=await readDurableSession(t.sessionState),a=findSessionTaskEntry(i.state,r);if(a===void 0)return!1;let o=getAgentHandleStore(i.state)?.handles??[],s=o.find(e=>e.phase===`claimed`&&e.ownerId===r&&e.identity.name===n.subagentName&&e.address.sessionId===n.childSessionId),c=o.filter(e=>e.phase===`reserved`&&e.ownerId===r&&e.identity.name===n.subagentName);if(s===void 0&&c.length!==1)return!1;let l=await readLatestTaskView({taskRunId:a.taskRunId});return l!==void 0&&!isTerminalTaskStatus(l.status)}export{acceptTaskAuthorizationEventStep};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { type UnstampedMessageStreamEvent } from "#protocol/message.js";
|
|
2
|
+
/** Emits an already-projected task-owned `subagent.called` event on the parent stream. */
|
|
3
|
+
export declare function emitTaskSubagentCalledStep(input: {
|
|
4
|
+
readonly event: UnstampedMessageStreamEvent;
|
|
5
|
+
readonly parentWritable: WritableStream<Uint8Array>;
|
|
6
|
+
readonly serializedContext: Record<string, unknown>;
|
|
7
|
+
}): Promise<{
|
|
8
|
+
readonly serializedContext: Record<string, unknown>;
|
|
9
|
+
}>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{callAdapterEventHandler}from"#channel/adapter.js";import{encodeMessageStreamEvent,stampMessageStreamEvent}from"#protocol/message.js";import{ChannelKey}from"#runtime/sessions/runtime-context-keys.js";import{deserializeContext,serializeContext}from"#context/serialize.js";import{buildAdapterContext}from"#channel/adapter-context.js";async function emitTaskSubagentCalledStep(e){"use step";let t=await deserializeContext(e.serializedContext),n=t.require(ChannelKey),r=await callAdapterEventHandler(n,e.event,buildAdapterContext(n,t)),i=e.parentWritable.getWriter();try{await i.write(encodeMessageStreamEvent(stampMessageStreamEvent(r)))}finally{i.releaseLock()}return{serializedContext:serializeContext(t)}}export{emitTaskSubagentCalledStep};
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import type { RuntimeActionResultHookPayload, SubagentAuthorizationEventHookPayload, SubagentInputRequestHookPayload } from "#channel/types.js";
|
|
2
|
+
import type { RuntimeSubagentChildResult, RuntimeSubagentResult } from "#shared/action-types.js";
|
|
3
|
+
import type { JsonValue } from "#shared/json.js";
|
|
4
|
+
import type { JsonObject } from "#shared/json.js";
|
|
5
|
+
import type { ToolContext } from "#tools/definition.js";
|
|
6
|
+
import type { TaskInboundUpdate } from "#tasks/types.js";
|
|
7
|
+
export type InternalAgentInput = {
|
|
8
|
+
readonly agentId?: string;
|
|
9
|
+
readonly message: string;
|
|
10
|
+
readonly outputSchema?: JsonObject;
|
|
11
|
+
readonly target: string;
|
|
12
|
+
};
|
|
13
|
+
export interface AgentInput {
|
|
14
|
+
readonly agentId?: string;
|
|
15
|
+
readonly key: string;
|
|
16
|
+
readonly message: string;
|
|
17
|
+
readonly outputSchema?: JsonObject;
|
|
18
|
+
readonly target: string;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Asks the owning session to spawn an agent for a workflow tool run. Spawning
|
|
22
|
+
* needs owner-held material (auth, capabilities, admission, the agent handle
|
|
23
|
+
* store) that a workflow tool body never has.
|
|
24
|
+
*/
|
|
25
|
+
export interface AgentInvocationRequest {
|
|
26
|
+
readonly input: InternalAgentInput;
|
|
27
|
+
readonly invocationId: string;
|
|
28
|
+
readonly kind: "agent-invoke";
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Tells the owning session that an owner-spawned agent replied to the run, so
|
|
32
|
+
* the owner can release the handle it reserved for `agent-invoke`.
|
|
33
|
+
*/
|
|
34
|
+
export interface AgentSettlementRequest {
|
|
35
|
+
readonly kind: "agent-settled";
|
|
36
|
+
readonly result: RuntimeSubagentChildResult;
|
|
37
|
+
}
|
|
38
|
+
export type AgentInvocationEvent = SubagentAuthorizationEventHookPayload | SubagentInputRequestHookPayload;
|
|
39
|
+
export type AgentInvocationReply = AgentInvocationEvent | RuntimeActionResultHookPayload | TaskInboundUpdate;
|
|
40
|
+
/** Invokes an agent from a task-owned background workflow tool. */
|
|
41
|
+
export declare function agent(ctx: ToolContext, input: AgentInput): Promise<JsonValue>;
|
|
42
|
+
/** Invokes an agent with a framework-selected replay-stable invocation id. */
|
|
43
|
+
export declare function invokeAgent(ctx: ToolContext, input: InternalAgentInput, options: {
|
|
44
|
+
readonly invocationId: string;
|
|
45
|
+
readonly returnResult: true;
|
|
46
|
+
}): Promise<JsonValue | RuntimeSubagentResult>;
|
|
47
|
+
export declare function invokeAgent(ctx: ToolContext, input: InternalAgentInput, options: {
|
|
48
|
+
readonly invocationId: string;
|
|
49
|
+
readonly returnResult?: false;
|
|
50
|
+
}): Promise<JsonValue>;
|
|
51
|
+
export declare function validateAgentInput(input: InternalAgentInput | AgentInput, requireKey: boolean): void;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{createHook}from"#compiled/@workflow/core/index.js";import{claimHookOwnership,disposeHook}from"#execution/hook-ownership.js";import{readWorkflowToolRunAdmission,readWorkflowToolRunOwner,readWorkflowToolRunRef}from"#execution/tools/workflow/ask.js";import{resumeHookStep}from"#execution/tools/workflow/resume-hook-step.js";const AGENT_INVOCATION_IDS=Symbol.for(`eve.workflow-tool-run.agent-invocation-ids`);async function agent(e,t){return validateAgentInput(t,!0),await invokeAgent(e,{agentId:t.agentId,message:t.message,outputSchema:t.outputSchema,target:t.target},{invocationId:`${e.callId}:${t.key}`})}async function invokeAgent(i,a,o){validateAgentInput(a,!1);let s=readWorkflowToolRunRef(i),c=readWorkflowToolRunOwner(i),l=readWorkflowToolRunAdmission(i);claimInvocationId(i,o.invocationId);let u=createHook(),d=!1;try{if(await claimHookOwnership(u),d=!0,l!==void 0){let e=await l;if(e.status===`rejected`)throw Error(e.reason)}await resumeHookStep(c.request,{from:s,replyTo:u.token,request:{input:a,invocationId:o.invocationId,kind:`agent-invoke`}});let e=u[Symbol.asyncIterator]();for(;;){let t=await nextAgentReply(e,i.abortSignal);if(t.done)break;let n=t.value;if(n.kind===`runtime-action-result`){let e=n.results.find(e=>e.kind===`subagent-result`&&e.callId===o.invocationId);if(e!==void 0){if(e.origin===`child`&&await resumeHookStep(c.request,{from:s,replyTo:u.token,request:{kind:`agent-settled`,result:e}}),o.returnResult===!0&&s.execution===`blocking`)return e;if(e.isError===!0)throw e.output;return e.output}continue}if(n.kind===`subagent-input-request`){await resumeHookStep(c.request,{from:s,replyTo:n.childContinuationToken,request:{kind:`input-batch`,requests:n.event.requests},requestCoordinates:{sequence:n.event.sequence,stepIndex:n.event.stepIndex,turnId:n.event.turnId}});continue}if(n.kind===`task-update`){await resumeHookStep(c.report,{from:s,update:n.message});continue}await resumeHookStep(c.request,{from:s,replyTo:u.token,request:{event:n,kind:`authorization-request`}})}}finally{if(d)try{await disposeHook(u)}catch{}}throw Error(`Agent "${a.target}" closed without a result.`)}async function nextAgentReply(e,t){if(t===void 0)return await e.next();if(t.aborted)throw t.reason;let n,r=new Promise((e,t)=>{n=t}),abort=()=>n?.(t.reason);t.addEventListener(`abort`,abort,{once:!0});try{return await Promise.race([e.next(),r])}finally{t.removeEventListener(`abort`,abort)}}function validateAgentInput(e,t){if(t&&(typeof e.key!=`string`||e.key.trim()===``))throw TypeError("agent() requires a non-empty `key`.");if(typeof e.target!=`string`||e.target.trim()===``)throw TypeError("agent() requires a non-empty `target`.");if(typeof e.message!=`string`||e.message.trim()===``)throw TypeError("agent() requires a non-empty `message`.")}function claimInvocationId(e,t){let n=e,r=n[AGENT_INVOCATION_IDS]??new Set;if(r.has(t)){let e=t.lastIndexOf(`:`),n=e<0?t:t.slice(e+1);throw TypeError(`agent() invocation key "${n}" was already used in this run; keys must be unique per run.`)}r.add(t),n[AGENT_INVOCATION_IDS]===void 0&&Object.defineProperty(n,AGENT_INVOCATION_IDS,{enumerable:!1,value:r})}export{agent,invokeAgent,validateAgentInput};
|