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 +1 @@
|
|
|
1
|
-
import{createLogger}from"#internal/logging.js";import{resolveInstalledPackageInfo}from"#internal/application/package.js";import{UNSPECIFIED_INPUT_SCHEMA}from"#tools/schema.js";import{createToolExecuteWithAuth}from"#execution/tool-auth.js";import{resolveRuntimeModelReference}from"#runtime/agent/resolve-model.js";import{
|
|
1
|
+
import{createLogger}from"#internal/logging.js";import{resolveInstalledPackageInfo}from"#internal/application/package.js";import{UNSPECIFIED_INPUT_SCHEMA}from"#tools/schema.js";import{createToolExecuteWithAuth}from"#execution/tool-auth.js";import{resolveRuntimeModelReference}from"#runtime/agent/resolve-model.js";import{createPreparedWorkflowToolHarnessDefinition,createWorkflowToolHarnessDefinition}from"#execution/tools/workflow/background.js";import{LOAD_SKILL_TOOL_NAME}from"#runtime/skills/fragment-context.js";import{dispatchDynamicModelEvent}from"#context/dynamic-model-lifecycle.js";import{preparePersistedStepDynamicToolMetadata}from"#context/dynamic-tool-lifecycle.js";import{createToolLoopHarness}from"#harness/tool-loop.js";import{createTaskToolHarnessDefinitions}from"#execution/tools/tasks.js";import{findRegisteredRuntimeTool}from"#runtime/tools/registry.js";import{preserveFrameworkStateOnCompaction}from"#execution/compaction.js";import{ASK_QUESTION_TOOL_NAME}from"#harness/request-input-tool.js";const log=createLogger(`execution.node-step`);function createExecutionNodeStep(e){let t=createRuntimeModelResolver(e.modelResolutionScope),n=e.node.turnAgent.dynamicModel===void 0?void 0:createRuntimeDynamicModelEventDispatcher(e.modelResolutionScope,e.node.turnAgent.dynamicModel),r=createNodeHarnessTools({node:e.node}),i=e.instrumentation,a=i?.prepareExecution(),o=createToolLoopHarness({abortSignal:e.abortSignal,capabilities:e.capabilities,clearOnly:e.clearOnly,compactOnly:e.compactOnly,workflow:e.node.agent.workflowTool!==void 0,workflowMaxSubagents:e.workflowMaxSubagents,handleEvent:e.handleEvent,historyProjector:e.historyProjector,historyView:e.historyView,instrumentation:a,mode:e.mode,onCompaction:preserveFrameworkStateOnCompaction,resolveStepDynamicTools:t=>preparePersistedStepDynamicToolMetadata({...t,resolvers:e.node.agent.dynamicToolResolvers??[]}),dispatchDynamicModelEvent:n,resolveModel:t,runtimeIdentity:buildRuntimeIdentity(e.node),tools:r});return i===void 0?o:async(e,t)=>{try{return await o(e,t)}finally{await i.flush()}}}function buildRuntimeIdentity(e){let n=resolveInstalledPackageInfo(),r={agentId:e.turnAgent.id,agentName:e.agent.config?.name,eveVersion:n.version},i=process.env.VERCEL_GIT_COMMIT_SHA?.trim(),a=process.env.VERCEL_GIT_COMMIT_REF?.trim(),o=process.env.VERCEL_DEPLOYMENT_CREATED_AT?.trim();return i||a||o?{...r,build:{deployedAt:o||void 0,gitBranch:a||void 0,gitSha:i||void 0}}:r}function createRuntimeModelResolver(e){return t=>resolveRuntimeModelReference(t,e)}function createRuntimeDynamicModelEventDispatcher(e,t){return n=>dispatchDynamicModelEvent({ctx:n.ctx,dynamicModel:t,event:n.event,messages:n.messages,scope:e})}function createNodeHarnessTools(e){let t=new Map;for(let n of e.node.turnAgent.tools){let r=resolveHarnessToolDefinition({node:e.node,tool:n});r!==null&&t.set(n.name,r)}return t}function resolveHarnessToolDefinition(e){let t=findRegisteredRuntimeTool(e.node.toolRegistry,e.tool.name);return isPreparedRuntimeWorkflowTool(e.tool)?t===null?createPreparedWorkflowToolHarnessDefinition(e.tool):createWorkflowToolHarnessDefinition({definition:createRegisteredHarnessToolDefinition({behavior:e.tool.behavior,definition:t.definition,rootOnly:e.tool.rootOnly}),nodeId:e.tool.task.nodeId,resultKind:e.tool.task.resultKind,workflowId:e.tool.task.workflowId}):t===null?(log.warn(`declared tool is not registered — omitting from toolset`,{toolName:e.tool.name,nodeId:e.node.nodeId}),null):createRegisteredHarnessToolDefinition({behavior:e.tool.behavior,definition:t.definition,rootOnly:e.tool.rootOnly})}function isPreparedRuntimeWorkflowTool(e){return e.task!==void 0}function createRegisteredHarnessToolDefinition(e){let t=e.definition;if(t.owner.kind===`framework`){let n=createTaskToolHarnessDefinitions().find(e=>e.name===t.name);if(n!==void 0)return{...n,behavior:e.behavior}}let r=t.execute,i=t.owner.kind===`framework`&&t.name===ASK_QUESTION_TOOL_NAME;return{approvalKey:t.approvalKey,behavior:e.behavior,description:t.description,execution:t.execution,execute:i?void 0:resolveAuthoredExecute({rawExecute:r,scope:t.name}),frameworkAction:t.owner.kind===`framework`&&t.name===LOAD_SKILL_TOOL_NAME?`load-skill`:void 0,inputSchema:t.inputSchema??UNSPECIFIED_INPUT_SCHEMA,name:t.name,approval:t.approval,outputSchema:t.outputSchema,rootOnly:e.rootOnly,toModelOutput:t.toModelOutput}}function resolveAuthoredExecute(e){let{rawExecute:t,scope:n}=e;return t===void 0?void 0:createToolExecuteWithAuth({execute:t,scope:n})}export{buildRuntimeIdentity,createExecutionNodeStep,createNodeHarnessTools};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{coalesceDeliveries}from"#harness/messages.js";import{reportDroppedWirePayloadStep}from"#execution/report-dropped-wire-payload-step.js";import{SessionInboxWireError,sessionInboxWire}from"#execution/wire/session-inbox-wire.js";import{routeDeliverToChildren}from"#execution/route-child-delivery.js";async function nextTurnDelivery(e){if(e.awaitAuthorizationCallbacks!==!0)return await awaitNextTurnDelivery(e);e.commandInbox.setAuthorizationWindow(!0);try{return await awaitNextTurnDelivery(e)}finally{e.commandInbox.setAuthorizationWindow(!1)}}async function awaitNextTurnDelivery(e){let t=e.cancelledTaskIds??new Set,n=e.seenTaskDeliveries??new Set;for(;;){let r=await waitForNextSessionAction({bufferedDeliveries:e.bufferedDeliveries,bufferedSessionControls:e.bufferedSessionControls,cancelledTaskIds:t,commandInbox:e.commandInbox,deferDeliveries:e.deferDeliveries,seenTaskDeliveries:n});if(r.kind===`authorization`)return r;if(r.kind!==`delivery`)return{kind:r.kind};let
|
|
1
|
+
import{coalesceDeliveries}from"#harness/messages.js";import{cancelAllIndexedSessionTasksStep}from"#execution/cancel-indexed-session-tasks-step.js";import{reportDroppedWirePayloadStep}from"#execution/report-dropped-wire-payload-step.js";import{SessionInboxWireError,sessionInboxWire}from"#execution/wire/session-inbox-wire.js";import{routeDeliverToChildren}from"#execution/route-child-delivery.js";async function nextTurnDelivery(e){if(e.awaitAuthorizationCallbacks!==!0)return await awaitNextTurnDelivery(e);e.commandInbox.setAuthorizationWindow(!0);try{return await awaitNextTurnDelivery(e)}finally{e.commandInbox.setAuthorizationWindow(!1)}}async function awaitNextTurnDelivery(e){let t=e.cancelledTaskIds??new Set,n=e.seenTaskDeliveries??new Set;for(;;){let r=await waitForNextSessionAction({bufferedDeliveries:e.bufferedDeliveries,bufferedSessionControls:e.bufferedSessionControls,cancelledTaskIds:t,commandInbox:e.commandInbox,deferDeliveries:e.deferDeliveries,seenTaskDeliveries:n,stateCursor:e.stateCursor});if(r.kind===`authorization`)return r;if(r.kind!==`delivery`)return{kind:r.kind};let i=r.delivery;if(i===null)return{kind:`closed`};let o=await routeDeliverToChildren({delivery:i,parentWritable:e.driverWritable,serializedContext:e.stateCursor.serializedContext,sessionState:e.stateCursor.sessionState});if(e.stateCursor.adoptState(o),o.kind===`cancel-turn`)return{kind:`cancel-turn`};if(o.remainder!==void 0)return{delivery:o.remainder,kind:`turn`}}}async function waitForNextSessionAction(e){let a=e.bufferedSessionControls.shift();if(a!==void 0)return{kind:a};for(;e.bufferedDeliveries[0]!==void 0&&isCancelledTaskDelivery(e.bufferedDeliveries[0],e.cancelledTaskIds);)e.bufferedDeliveries.shift();if(e.deferDeliveries!==!0&&!e.commandInbox.hasReadyAuthorization()&&e.bufferedDeliveries.length>0)return{delivery:takeBufferedTurnDelivery(e.bufferedDeliveries),kind:`delivery`};for(;;){let{result:a,source:o}=await e.commandInbox.nextWithSource();if(e.commandInbox.consumeNext(),o===`authorization`)return a.done?{closed:!0,kind:`authorization`,payloads:[]}:{closed:!1,kind:`authorization`,payloads:a.value.kind===`deliver`?a.value.payloads:[]};if(a.done)return{delivery:null,kind:`delivery`};if(a.value.kind===`runtime-action-result`)continue;let s;try{s=sessionInboxWire.decode(a.value)}catch(e){if(!(e instanceof SessionInboxWireError))throw e;await reportDroppedWirePayloadStep({detail:e.message,family:`session-inbox`});continue}if(s.kind===`session-timeout`)return{kind:`expired`};if(s.kind===`clear`||s.kind===`compact`||s.kind===`reset`)return{kind:s.kind};if(s.kind===`cancel`){if(`tasks`in s&&s.tasks===!0&&await cancelAllIndexedSessionTasksStep({serializedContext:e.stateCursor.serializedContext,sessionState:e.stateCursor.sessionState}),s.taskId!==void 0){e.cancelledTaskIds.add(s.taskId);let t=e.bufferedDeliveries.filter(t=>!isCancelledTaskDelivery(t,e.cancelledTaskIds));e.bufferedDeliveries.splice(0,e.bufferedDeliveries.length,...t)}continue}let c=s.taskDeliveryId??s.caller?.taskId;if(!(c!==void 0&&isCancelledTaskDeliveryId(c,e.cancelledTaskIds))){if(c!==void 0){if(e.seenTaskDeliveries.has(c))continue;e.seenTaskDeliveries.add(c)}if(e.deferDeliveries===!0){e.bufferedDeliveries.push(s);continue}return{delivery:s,kind:`delivery`}}}}function isCancelledTaskDelivery(e,t){let n=e.taskDeliveryId??e.caller?.taskId;return n!==void 0&&isCancelledTaskDeliveryId(n,t)}function isCancelledTaskDeliveryId(e,t){return[...t].some(t=>e===t||e.startsWith(`${t}:`))}function takeBufferedTurnDelivery(t){let n=t.shift();if(n===void 0)throw Error(`Cannot take a turn delivery from an empty buffer.`);let r=[n],i=n.caller;for(;t.length>0;){let e=t[0];if(e===void 0||n.taskDeliveryId!==void 0||e.taskDeliveryId!==void 0||i!==void 0&&e.caller!==void 0)break;let a=t.shift();if(a===void 0)throw Error(`Buffered turn delivery disappeared while partitioning.`);r.push(a),i??=a.caller}return coalesceDeliveries(r)}export{nextTurnDelivery};
|
|
@@ -5,6 +5,5 @@ export declare function derivePendingState(session: HarnessSession): {
|
|
|
5
5
|
readonly authorizationNames?: readonly string[];
|
|
6
6
|
readonly hasPendingAuthorization: boolean;
|
|
7
7
|
readonly hasPendingInputBatch: boolean;
|
|
8
|
-
readonly
|
|
9
|
-
readonly startsWorkflowToolRuns?: boolean;
|
|
8
|
+
readonly pendingCoordinationCallIds?: readonly string[];
|
|
10
9
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{getPendingCoordinationBatch}from"#harness/coordination.js";import{getPendingAuthorization}from"#harness/authorization.js";import{hasPendingInputBatch}from"#harness/input-requests.js";function derivePendingState(t){let n=getPendingCoordinationBatch(t.state),r=getPendingAuthorization(t.state),i={authorizationAttemptIds:r?.challenges.flatMap(e=>e.attemptId===void 0?[]:[e.attemptId]),authorizationNames:r?.challenges.map(e=>e.name),hasPendingAuthorization:r!==void 0,hasPendingInputBatch:hasPendingInputBatch(t.state)};return n===void 0?i:{...i,pendingCoordinationCallIds:[...n.runtimeActions,...n.tasks].map(e=>e.callId)}}export{derivePendingState};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{readDurableSession,replaceDurableSessionSnapshot}from"#execution/durable-session-store.js";import{resumeSessionInbox}from"#execution/wire/session-inbox-resume.js";import{createTaskInputRequestId,retireProxyInputRequests}from"#harness/proxy-input-requests.js";import{coalesceDeliverPayloads}from"#execution/deliver-payloads.js";import{routeDeliverPayload}from"#
|
|
1
|
+
import{readDurableSession,replaceDurableSessionSnapshot}from"#execution/durable-session-store.js";import{findSessionTaskEntry}from"#tasks/session-index.js";import{resumeSessionInbox}from"#execution/wire/session-inbox-resume.js";import{createTaskInputRequestId,retireProxyInputRequests}from"#harness/proxy-input-requests.js";import{coalesceDeliverPayloads}from"#execution/deliver-payloads.js";import{routeDeliverPayload}from"#subagents/hitl-proxy.js";import{sendTaskInboundPayload}from"#execution/tasks/parent/run-parent.js";import{resumeWorkflowToolRunAnswers}from"#execution/tools/workflow/answer.js";async function routeProxiedDeliverStep(i){"use step";let l=await readDurableSession(i.sessionState),u=!(`delivery`in i),d=`delivery`in i?i.delivery:{auth:i.auth,kind:`deliver`,payloads:[i.payload]},f=new Map,p=new Map,m;for(let[e,t]of d.payloads.entries()){let r=routeDeliverPayload({allowRoute:(e,t)=>t.taskId===void 0||findSessionTaskEntry(l.state,t.taskId)!==void 0,payload:t,state:l.state});m??=r.parentAction,r.forSelf!==void 0&&f.set(e,r.forSelf);for(let[t,n]of r.forChildren.entries()){let i=n.taskId===void 0?n.childContinuationToken:[n.childContinuationToken,n.childResponseUrl??``,n.taskId].join(`\0`),a=p.get(i)??{answerHook:n.answerHook,childContinuationToken:n.childContinuationToken,childResponseUrl:n.childResponseUrl,metadata:[],payloads:[],retireRequestIds:[],sourcePayloadIndexes:[],taskId:n.taskId},o=a.payloads.length;if(a.payloads.push(n.payload),a.retireRequestIds.push(...n.retireRequestIds),a.sourcePayloadIndexes.push(e),r.forSelf===void 0&&t===0)for(let t of d.deliveryMetadata??[])t.payloadIndex===e&&a.metadata.push({...t,payloadIndex:o});p.set(i,a)}}let h=!1;for(let e of p.values()){let t=e.taskId;if(t!==void 0){let r=findSessionTaskEntry(l.state,t);if(r===void 0){mergeStrandedResponses(f,e,t);continue}if(await sendTaskInboundPayload({taskInboxToken:r.taskInboxToken,payload:{auth:d.auth,childContinuationToken:e.childContinuationToken,childResponseUrl:e.childResponseUrl,inputResponses:coalesceDeliverPayloads(e.payloads).inputResponses??[],kind:`input-response`,taskId:t}})===`unreachable`){mergeStrandedResponses(f,e,t);continue}l=retireProxyInputRequests(l,e.retireRequestIds),h=!0;continue}if(e.answerHook!==void 0){await resumeWorkflowToolRunAnswers(e.childContinuationToken,coalesceDeliverPayloads(e.payloads).inputResponses),l=retireProxyInputRequests(l,e.retireRequestIds),h=!0;continue}let i={...d,deliveryMetadata:e.metadata.length===0?void 0:e.metadata,payloads:e.payloads};await resumeSessionInbox(e.childContinuationToken,i),l=retireProxyInputRequests(l,e.retireRequestIds),h=!0}let g={serializedContext:i.serializedContext??{},sessionState:h?replaceDurableSessionSnapshot({session:l,state:i.sessionState}):i.sessionState};if(m!==void 0)return{...g,...m};let _=[...f].sort(([e],[t])=>e-t),v=_.flatMap(([e],t)=>(d.deliveryMetadata??[]).filter(t=>t.payloadIndex===e).map(e=>({...e,payloadIndex:t}))),y=_.length===0?void 0:u?coalesceDeliverPayloads(_.map(([,e])=>e)):{...d,deliveryMetadata:v.length===0?void 0:v,payloads:_.map(([,e])=>e)};return{...g,kind:`continue`,remainder:y}}function mergeStrandedResponses(e,t,n){for(let[r,a]of t.payloads.entries()){let o=t.sourcePayloadIndexes[r];if(o===void 0)continue;let s=(a.inputResponses??[]).map(e=>({...e,requestId:createTaskInputRequestId(n,e.requestId)}));if(s.length===0)continue;let c=e.get(o);e.set(o,{...c,inputResponses:[...c?.inputResponses??[],...s]})}}export{routeProxiedDeliverStep};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{coalesceDeliverPayloads}from"#execution/deliver-payloads.js";import{routeProxiedDeliverStep}from"#execution/proxied-deliver-step.js";import{
|
|
1
|
+
import{coalesceDeliverPayloads}from"#execution/deliver-payloads.js";import{routeProxiedDeliverStep}from"#execution/proxied-deliver-step.js";import{emitRecordedTaskInputRequestStep,runProxySubagentEventStep}from"#subagents/event-proxy-step.js";import{recordTaskInputRequestStep,recordTerminalTaskViewsStep}from"#execution/tasks/parent/hitl-proxy-steps.js";import{acceptTaskAuthorizationEventStep}from"#execution/tools/subagent/accept-event-step.js";import{applyTaskAgentRequest}from"#execution/tools/subagent/task-agent-requests.js";async function routeDeliverToChildren(i){let a=coalesceDeliverPayloads(i.delivery.payloads),o=i.serializedContext,s=i.sessionState;for(let e of a.task?.inputRequests??[]){let t=await recordTaskInputRequestStep({request:e,sessionState:s});if(s=t.sessionState,!t.accepted)continue;let r=await emitRecordedTaskInputRequestStep({parentWritable:i.parentWritable,request:t.request,serializedContext:o,sessionState:s});o=r.serializedContext,s=r.sessionState}for(let e of a.task?.agentRequests??[]){let t=await applyTaskAgentRequest({...e,ownerId:e.taskId},{parentWritable:i.parentWritable,serializedContext:o,sessionState:s});o=t.serializedContext,s=t.sessionState}for(let e of a.task?.authorizationEvents??[]){if(!await acceptTaskAuthorizationEventStep({delivery:e,sessionState:s}))continue;let t=await runProxySubagentEventStep({hookPayload:e.hookPayload,parentWritable:i.parentWritable,serializedContext:o,sessionState:s});o=t.serializedContext,s=t.sessionState}(a.task?.views?.length??0)>0&&(s=await recordTerminalTaskViewsStep({sessionState:s,views:a.task?.views??[]}));let c=[],l=[];for(let[e,t]of i.delivery.payloads.entries()){let n={...t};if(delete n.task,Object.keys(n).length===0)continue;let r=c.length;c.push(n);for(let t of i.delivery.deliveryMetadata??[])t.payloadIndex===e&&l.push({...t,payloadIndex:r})}let u=c.length===0?void 0:{...i.delivery,deliveryMetadata:l.length===0?void 0:l,payloads:c};return u===void 0?{kind:`continue`,remainder:void 0,serializedContext:o,sessionState:s}:s.hasProxyInputRequests?await routeProxiedDeliverStep({delivery:u,parentWritable:i.parentWritable,serializedContext:o,sessionState:s}):{kind:`continue`,remainder:u,serializedContext:o,sessionState:s}}export{routeDeliverToChildren};
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import type { AgentLimitsDefinition } from "#shared/agent-definition.js";
|
|
2
|
-
type
|
|
2
|
+
type UsageLimit = AgentLimitsDefinition["maxInputTokensPerSession"] | AgentLimitsDefinition["maxOutputTokensPerSession"] | AgentLimitsDefinition["maxTokenCostUsdPerSession"];
|
|
3
3
|
/**
|
|
4
|
-
* Resolves an authored
|
|
4
|
+
* Resolves an authored usage cap against an inherited parent cap. `false`
|
|
5
5
|
* only means "uncapped" before inheritance; an actual inherited cap still
|
|
6
6
|
* bounds the child.
|
|
7
7
|
*/
|
|
8
8
|
export declare function resolveInheritedTokenLimit(input: {
|
|
9
|
-
readonly configured:
|
|
10
|
-
readonly inherited:
|
|
11
|
-
}):
|
|
9
|
+
readonly configured: UsageLimit | undefined;
|
|
10
|
+
readonly inherited: UsageLimit | undefined;
|
|
11
|
+
}): UsageLimit | undefined;
|
|
12
12
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{ContextContainer,contextStorage}from"#context/container.js";import{ActivityObserverKey,AuthKey,CapabilitiesKey,ChannelDeliveryKey,ChannelInstrumentationKey,ChannelRequestIdKey,ContinuationTokenKey,DynamicSubagentAgentConfigKey,InitiatorAuthKey,ModeKey,ParentSessionKey,ParentTraceContextKey,ScheduleIdKey,SessionCallbackKey
|
|
1
|
+
import{ContextContainer,contextStorage}from"#context/container.js";import{ActivityObserverKey,AuthKey,CapabilitiesKey,ChannelDeliveryKey,ChannelInstrumentationKey,ChannelRequestIdKey,ContinuationTokenKey,DynamicSubagentAgentConfigKey,InitiatorAuthKey,ModeKey,ParentSessionKey,ParentTraceContextKey,ScheduleIdKey,SessionCallbackKey}from"#context/keys.js";import{BundleKey}from"#runtime/sessions/runtime-context-keys.js";import{setChannelContext}from"#execution/channel-context.js";function buildRunContext(t){let{bundle:n,run:r}=t,i=new ContextContainer,a=r.auth;if(i.set(BundleKey,n),setChannelContext(i,r.adapter,{channelName:r.channelName}),r.channelMetadata!==void 0){let e=i.get(ChannelInstrumentationKey);i.set(ChannelInstrumentationKey,{channelType:e?.channelType??r.channelMetadata.channelType,kind:e?.kind??r.channelMetadata.kind,metadata:r.channelMetadata.metadata})}r.continuationToken!==void 0&&i.set(ContinuationTokenKey,r.continuationToken),i.set(ModeKey,r.mode),i.set(AuthKey,a),i.set(InitiatorAuthKey,r.initiatorAuth??a),t.dynamicSubagentAgentConfig!==void 0&&i.set(DynamicSubagentAgentConfigKey,t.dynamicSubagentAgentConfig),r.capabilities!==void 0&&i.set(CapabilitiesKey,r.capabilities),r.requestId!==void 0&&i.set(ChannelRequestIdKey,r.requestId);let o=contextStorage.getStore()?.get(ScheduleIdKey);return o!==void 0&&i.set(ScheduleIdKey,o),r.delivery!==void 0&&i.set(ChannelDeliveryKey,r.delivery),r.callback!==void 0&&i.set(SessionCallbackKey,r.callback),r.activityObserver!==void 0&&i.set(ActivityObserverKey,r.activityObserver),r.parent!==void 0&&i.set(ParentSessionKey,r.parent),r.parentTraceContext!==void 0&&i.set(ParentTraceContextKey,r.parentTraceContext),i}export{buildRunContext};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{VERCEL_EVE_SANDBOX_IMAGE}from"#execution/sandbox/bindings/eve-image.js";import{getVercelSandboxFetch}from"#execution/sandbox/bindings/vercel-credentials.js";async function createVercelEveImageSandbox(e){let{image:t,runtime:n,source:r,...i}=e.createOptions,a=getVercelSandboxFetch(e.createOptions);return r?.type===`snapshot`?await e.sandboxModule.Sandbox.create({...i,source:r,fetch:a}):await e.sandboxModule.Sandbox.create({...i,source:r,image:VERCEL_EVE_SANDBOX_IMAGE,fetch:a})}export{createVercelEveImageSandbox};
|
|
1
|
+
import{VERCEL_EVE_SANDBOX_IMAGE}from"#execution/sandbox/bindings/eve-image.js";import{getVercelSandboxFetch}from"#execution/sandbox/bindings/vercel-credentials.js";async function createVercelEveImageSandbox(e){let{image:t,runtime:n,source:r,...i}=e.createOptions,a=getVercelSandboxFetch(e.createOptions);return r?.type===`snapshot`?await e.sandboxModule.Sandbox.create({...i,source:r,fetch:a}):await e.sandboxModule.Sandbox.create({...i,source:r,image:t??VERCEL_EVE_SANDBOX_IMAGE,fetch:a})}export{createVercelEveImageSandbox};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import type * as Vercel from "#compiled/@vercel/sandbox/index.js";
|
|
2
|
-
import type * as
|
|
1
|
+
import type * as Vercel from "#compiled/@vercel/sandbox-drives/index.js";
|
|
2
|
+
import type * as VercelStable from "#compiled/@vercel/sandbox/index.js";
|
|
3
3
|
export type VercelCreateOptions = NonNullable<Parameters<typeof Vercel.Sandbox.create>[0]>;
|
|
4
4
|
export type VercelGetOptions = Parameters<typeof Vercel.Sandbox.get>[0];
|
|
5
5
|
export type VercelModule = typeof Vercel;
|
|
6
6
|
export type VercelSandbox = Vercel.Sandbox;
|
|
7
|
-
export type VercelDeleteGetOptions = Parameters<typeof
|
|
8
|
-
export type VercelDeleteModule = typeof
|
|
7
|
+
export type VercelDeleteGetOptions = Parameters<typeof VercelStable.Sandbox.get>[0];
|
|
8
|
+
export type VercelDeleteModule = typeof VercelStable;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{resolveSandboxModelPath}from"#shared/skill-paths.js";import{WORKSPACE_ROOT}from"#runtime/workspace/types.js";import{streamToBuffer}from"#execution/sandbox/stream-utils.js";import{createLoggingSandboxSession}from"#execution/sandbox/logging-session.js";import{buildSandboxSession}from"#execution/sandbox/session.js";import{SandboxTemplateNotProvisionedError}from"#public/definitions/sandbox-backend.js";import{adaptMultiplexedCommandToSandboxProcess}from"#execution/sandbox/multiplexed-command.js";import{applyInitialVercelNetworkPolicy,createVercelNetworkPolicySetter,ensureVercelSandboxBaseRuntime,withBaseSetupNetworkPolicy}from"#execution/sandbox/bindings/vercel-base-runtime.js";import{createVercelEveImageSandbox}from"#execution/sandbox/bindings/vercel-create-sdk.js";import{isVercelSandboxMissingError,isVercelSnapshotUnavailableError}from"#execution/sandbox/bindings/vercel-errors.js";import{getNamedVercelSandbox}from"#execution/sandbox/bindings/vercel-lookup.js";import{deleteVercelSandbox,stopVercelSandbox}from"#execution/sandbox/bindings/vercel-lifecycle.js";import{normalizeVercelReadStream}from"#execution/sandbox/bindings/vercel-read-stream.js";function createVercelSandbox(e={}){let t=e.loadSandboxModule??(async()=>await import(`#compiled/@vercel/sandbox/index.js`)),n=e.loadDeleteSandboxModule??(async()=>await import(`#compiled/@vercel/sandbox
|
|
1
|
+
import{resolveSandboxModelPath}from"#shared/skill-paths.js";import{WORKSPACE_ROOT}from"#runtime/workspace/types.js";import{streamToBuffer}from"#execution/sandbox/stream-utils.js";import{createLoggingSandboxSession}from"#execution/sandbox/logging-session.js";import{buildSandboxSession}from"#execution/sandbox/session.js";import{SandboxTemplateNotProvisionedError}from"#public/definitions/sandbox-backend.js";import{adaptMultiplexedCommandToSandboxProcess}from"#execution/sandbox/multiplexed-command.js";import{applyInitialVercelNetworkPolicy,createVercelNetworkPolicySetter,ensureVercelSandboxBaseRuntime,withBaseSetupNetworkPolicy}from"#execution/sandbox/bindings/vercel-base-runtime.js";import{createVercelEveImageSandbox}from"#execution/sandbox/bindings/vercel-create-sdk.js";import{isVercelSandboxMissingError,isVercelSnapshotUnavailableError}from"#execution/sandbox/bindings/vercel-errors.js";import{getNamedVercelSandbox}from"#execution/sandbox/bindings/vercel-lookup.js";import{deleteVercelSandbox,stopVercelSandbox}from"#execution/sandbox/bindings/vercel-lifecycle.js";import{normalizeVercelReadStream}from"#execution/sandbox/bindings/vercel-read-stream.js";function createVercelSandbox(e={}){let t=e.loadSandboxModule??(async()=>await import(`#compiled/@vercel/sandbox-drives/index.js`)),n=e.loadDeleteSandboxModule??(async()=>await import(`#compiled/@vercel/sandbox/index.js`)),r={timeout:DEFAULT_SANDBOX_TIMEOUT_MS,...e.createOptions},i=e.createSandbox??createVercelEveImageSandbox,o=new Map;return{name:`vercel`,async create(c){let l=resolveVercelSandboxTags(r.tags,c.tags),u=c.templateKey===null?null:await readTemplateForCreate({createOptions:r,loadSandboxModule:t,prewarmedTemplates:o,templateKey:c.templateKey}),f=await t(),p;try{p=await ensureSession({createOptions:r,createSandbox:i,existingMetadata:c.existingMetadata,resolveSessionCreateOptions:e.resolveSessionCreateOptions,sandboxModule:f,sessionId:c.tags?.sessionId??c.sessionKey,sessionKey:c.sessionKey,snapshotId:u?.snapshotId,tags:l})}catch(e){throw u!==null&&(isVercelSnapshotUnavailableError(e)||isVercelSandboxMissingError(e))?(o.delete(u.templateKey),await(await getNamedVercelSandbox({createOptions:r,sandboxModule:f,sandboxName:u.sandboxName}))?.delete(),new SandboxTemplateNotProvisionedError({backendName:`vercel`,templateKey:u.templateKey})):Error(`Failed to create sandbox session "${c.sessionKey}": ${errorMessage(e)}`,{cause:e})}return await ensureVercelSandboxBaseRuntime(p.sandbox),u===null&&p.created&&await applyInitialVercelNetworkPolicy(p.sandbox,r.networkPolicy),createHandle({createOptions:r,loadDeleteSandboxModule:n,sandbox:p.sandbox,sessionKey:c.sessionKey})},async prewarm(e){let n;try{n=await ensureTemplateWithUnavailableRetry({bootstrap:e.bootstrap,createOptions:r,createSandbox:i,loadSandboxModule:t,log:e.log,seedFiles:e.seedFiles,templateKey:e.templateKey})}catch(t){throw Error(`Failed to prewarm Vercel sandbox template "${e.templateKey}": ${errorMessage(t)}`,{cause:t})}return o.set(e.templateKey,n.template),{reused:n.reused}}}}async function ensureTemplateWithUnavailableRetry(e){try{return await ensureTemplate(e)}catch(t){if(!isVercelSnapshotUnavailableError(t)&&!isVercelSandboxMissingError(t))throw t;return e.log?.(`cached template disappeared; rebuilding sandbox template`),await ensureTemplate(e)}}async function readTemplate(e){let t=e.prewarmedTemplates.get(e.templateKey);if(t!==void 0)return t;let n=await e.loadSandboxModule(),r=await getNamedVercelSandbox({createOptions:e.createOptions,sandboxModule:n,sandboxName:e.templateKey});if(r===null||typeof r.currentSnapshotId!=`string`)throw new SandboxTemplateNotProvisionedError({backendName:`vercel`,templateKey:e.templateKey});return{sandboxName:r.name,snapshotId:r.currentSnapshotId,templateKey:e.templateKey}}async function readTemplateForCreate(e){try{return await readTemplate(e)}catch(t){throw SandboxTemplateNotProvisionedError.is(t)?t:Error(`Failed to read sandbox template "${e.templateKey}": ${errorMessage(t)}`,{cause:t})}}async function ensureTemplate(e){let t=await e.loadSandboxModule(),n=await getNamedVercelSandbox({createOptions:e.createOptions,sandboxModule:t,sandboxName:e.templateKey}),a=resolveVercelSandboxTags(e.createOptions.tags,e.tags),o=extractAuthorSnapshotId(e.createOptions);if(n!==null&&isUnprovisionedTerminalTemplateSandbox(n,o)&&(await n.delete(),n=null),n===null?n=await e.createSandbox({sandboxModule:t,createOptions:withBaseSetupNetworkPolicy({...e.createOptions,name:e.templateKey,persistent:!1,tags:a})}):await ensureVercelSandboxTags(n,a),typeof n.currentSnapshotId==`string`&&n.currentSnapshotId.length>0&&n.currentSnapshotId!==o)return{reused:!0,template:{sandboxName:n.name,snapshotId:n.currentSnapshotId,templateKey:e.templateKey}};e.log?.(`preparing base runtime inside sandbox`),await ensureVercelSandboxBaseRuntime(n),await applyInitialVercelNetworkPolicy(n,e.createOptions.networkPolicy);let u=buildSandboxSession(createVercelInternalSandboxSession(n,e.templateKey),createVercelNetworkPolicySetter(n));await writeVercelSandboxSeedFiles({sandbox:n,seedFiles:e.seedFiles,session:u}),e.bootstrap!==void 0&&(e.log?.(`running sandbox bootstrap`),await e.bootstrap({use:async t=>(t!==void 0&&await n.update(t),createLoggingSandboxSession({log:e.log,session:u}))}));let d=await n.snapshot();return{reused:!1,template:{sandboxName:n.name,snapshotId:d.snapshotId,templateKey:e.templateKey}}}async function ensureSession(e){let t=getVercelSandboxName(e.existingMetadata)??e.sessionKey,n=await getNamedVercelSandbox({createOptions:e.createOptions,sandboxModule:e.sandboxModule,sandboxName:t});if(n!==null)return await ensureVercelSandboxTags(n,e.tags),{created:!1,sandbox:n};let r=createSessionCreateParams(e,t,await e.resolveSessionCreateOptions?.({session:{id:e.sessionId}}));return e.tags!==void 0&&(r.tags=e.tags),{created:!0,sandbox:await e.createSandbox({createOptions:r,sandboxModule:e.sandboxModule})}}function createSessionCreateParams(e,t,n={}){let r={...e.createOptions,...n};if(e.snapshotId===void 0)return withBaseSetupNetworkPolicy({...r,name:t,persistent:!0});let{image:i,runtime:a,source:o,...s}=r;return{...s,name:t,persistent:!0,source:{snapshotId:e.snapshotId,type:`snapshot`}}}function createHandle(e){let{sandbox:t,sessionKey:n}=e;return{session:buildSandboxSession(createVercelInternalSandboxSession(t,n),createVercelNetworkPolicySetter(t)),useSessionFn:async e=>(e!==void 0&&await t.update(e),buildSandboxSession(createVercelInternalSandboxSession(t,n),createVercelNetworkPolicySetter(t))),async captureState(){return{backendName:`vercel`,metadata:{sandboxName:t.name},sessionKey:n}},async delete(n){await deleteVercelSandbox({createOptions:e.createOptions,loadDeleteSandboxModule:e.loadDeleteSandboxModule,sandbox:t,signal:n?.abortSignal})},async stop(){await stopVercelSandbox(t)},async shutdown(){try{await stopVercelSandbox(t)}catch{}}}}function createVercelInternalSandboxSession(e,r){return{id:r,resolvePath:resolveVercelSandboxPath,async spawn(n){return adaptMultiplexedCommandToSandboxProcess({command:await e.runCommand({args:[`-lc`,n.command],cmd:`bash`,cwd:n.workingDirectory??WORKSPACE_ROOT,detached:!0,env:n.env,signal:n.abortSignal}),getOutput:e=>e.stream})},async readFile(t){return normalizeVercelReadStream(await e.readFile({path:t.path}))},async writeFile(t){let r=await streamToBuffer(t.content);await e.writeFiles([{content:r,path:t.path}])},async removePath(t){await e.fs.rm(t.path,{force:t.force,recursive:t.recursive,signal:t.abortSignal})}}}async function writeVercelSandboxSeedFiles(t){if(t.seedFiles.length===0)return;let n=await Promise.all(t.seedFiles.map(async n=>({content:typeof n.content==`string`?Buffer.from(n.content):n.content,path:await resolveSandboxModelPath({path:n.path,sandbox:t.session})})));await t.sandbox.writeFiles(n)}function resolveVercelSandboxPath(e){return e.startsWith(`/`)?e:`${WORKSPACE_ROOT}/${e}`}function isUnprovisionedTerminalTemplateSandbox(e,t){let n=e.currentSnapshotId;return typeof n==`string`&&n.length>0&&n!==t?!1:e.status===`aborted`||e.status===`failed`||e.status===`stopped`}function extractAuthorSnapshotId(e){let t=e.source;if(t?.type===`snapshot`&&typeof t.snapshotId==`string`)return t.snapshotId}function getVercelSandboxName(e){let t=e?.sandboxName;return typeof t==`string`?t:void 0}function resolveVercelSandboxTags(e,t){let n={};if(e!==void 0)for(let[t,r]of Object.entries(e))n[t]=r;if(t!==void 0)for(let[e,r]of Object.entries(t))n[e]=r;let r=Object.keys(n).length;if(r!==0){if(r>VERCEL_SANDBOX_TAG_LIMIT)throw Error(`Vercel Sandbox supports at most ${VERCEL_SANDBOX_TAG_LIMIT} tags. eve reserves "agent", "channel", and "sessionId"; remove or consolidate custom tags passed to vercel().`);return n}}async function ensureVercelSandboxTags(e,t){t===void 0||areVercelSandboxTagsEqual(e.tags,t)||await e.update({tags:t})}function areVercelSandboxTagsEqual(e,t){let n=e??{},r=Object.entries(n),i=Object.entries(t);return r.length===i.length&&i.every(([e,t])=>n[e]===t)}function errorMessage(e){if(e instanceof Error){let t=e.json,n=e.text,r=typeof n==`string`&&n.length>0?n:t===void 0?void 0:JSON.stringify(t);return r===void 0?e.message:`${e.message}: ${r}`}return String(e)}const DEFAULT_SANDBOX_TIMEOUT_MS=1800*1e3,VERCEL_SANDBOX_TAG_LIMIT=5;export{createVercelSandbox};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{ActivityObserverKey}from"#context/keys.js";import{deriveRootTurnActivityWorkId}from"#execution/activity-work-id.js";import{projectActivityEvents}from"#execution/activity-events.js";import{submitActivity}from"#execution/submit-activity.js";async function observeSessionActivity(
|
|
1
|
+
import{ActivityObserverKey,TurnTaskDeliveryKey}from"#context/keys.js";import{deriveRootTurnActivityWorkId}from"#execution/activity-work-id.js";import{projectActivityEvents}from"#execution/activity-events.js";import{submitActivity}from"#execution/submit-activity.js";async function observeSessionActivity(n){let r=n.ctx.get(ActivityObserverKey);if(r===void 0)return;let i=n.ctx.get(TurnTaskDeliveryKey);r.workIdentity===void 0&&(i===`pending`||i===`settled`)||await submitActivity({events:projectSessionActivity({event:n.event,sessionId:n.sessionId,workIdentity:r.workIdentity}),sink:r.sink})}function projectSessionActivity(e){let t=workFor(e);if(t===void 0)return[];let n=[];return(t.kind===`root-turn`&&e.event.type===`turn.started`||t.kind!==`root-turn`&&(e.event.type===`session.started`||e.event.type===`turn.started`))&&n.push({eventId:`${t.id}:started`,kind:`work.started`,startedAt:e.event.meta.at,work:t}),n.push(...projectActivityEvents({at:e.event.meta.at,event:e.event,lineage:t})),n}function workFor(e){let t=eventTurnId(e.event);if(e.workIdentity!==void 0)return{...e.workIdentity,sessionId:e.sessionId,turnId:t??e.workIdentity.turnId};if(t!==void 0)return{id:deriveRootTurnActivityWorkId({sessionId:e.sessionId,turnId:t}),kind:`root-turn`,rootSessionId:e.sessionId,rootTurnId:t,sessionId:e.sessionId,turnId:t}}function eventTurnId(e){if(`data`in e&&`turnId`in e.data&&typeof e.data.turnId==`string`)return e.data.turnId}export{observeSessionActivity,projectSessionActivity};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"#protocol/activity.js";import{normalizeActivityText}from"#execution/activity-text.js";const MAX_ACTIVITY_EVENT_IDS=1e3,MAX_ACTIVITY_PENDING_SETTLEMENTS=500,MAX_ACTIVITY_ENTITIES=500;function createActivitySnapshot(){return{actions:{},blockers:{},pendingSettlements:{},revision:0,seenEventIds:[],version:1,work:{}}}function reduceActivityBatch(e,n){let r=e,i=e.seenEventIds,a=!1,o=!1;for(let e of n.events){if(i.includes(e.eventId))continue;let n=reduceEvent(r,e);n!==r&&(o=!0,i=appendBounded(i,e.eventId,MAX_ACTIVITY_EVENT_IDS),a||=presentationDiffers(r,n),r=n)}return o?a?{...r,revision:e.revision+1,seenEventIds:i}:{...r,revision:e.revision,seenEventIds:i}:e}function presentationDiffers(e,t){return e.actions!==t.actions||e.blockers!==t.blockers||e.work!==t.work}function reduceEvent(e,t){switch(t.kind){case`work.started`:return startWork(e,t);case`work.settled`:return settleWork(e,t);case`action.started`:return startAction(e,t);case`action.settled`:return settleAction(e,t);case`blocker.started`:return startBlocker(e,t);case`blocker.settled`:return settleBlocker(e,t)}}function startWork(t,n){if(t.work[n.work.id]!==void 0)return t;let r=pendingFor(t,`work`,n.work.id),i=n.work.parentId===void 0?void 0:t.work[n.work.parentId],a=r?.outcome??(i!==void 0&&i.phase!==`running`?`cancelled`:`running`),o={...n.work,name:n.work.name===void 0?void 0:normalizeActivityText(n.work.name),phase:a,settledAt:r?.settledAt??(a===`cancelled`?i?.settledAt:void 0),startedAt:n.startedAt},s={...t,pendingSettlements:removeKey(t.pendingSettlements,pendingKey(`work`,o.id)),work:replaceBounded(t.work,o.id,o)};return o.phase===`running`?s:settleWorkTree(s,{outcome:o.phase,settledAt:o.settledAt??n.startedAt,workId:o.id})}function settleWork(e,t){let n=e.work[t.workId];return n===void 0?retainPending(e,`work`,t.workId,t):n.phase===`running`?settleWorkTree(e,{outcome:t.outcome,settledAt:t.settledAt,workId:t.workId}):e}function startAction(t,n){if(t.actions[n.action.id]!==void 0)return t;let r=pendingFor(t,`action`,n.action.id),i=t.work[n.action.parentWorkId],a=r?.outcome??(i!==void 0&&i.phase!==`running`?`cancelled`:`running`);return{...t,actions:replaceBounded(t.actions,n.action.id,{...n.action,name:normalizeActivityText(n.action.name),phase:a,settledAt:r?.settledAt??(a===`cancelled`?i?.settledAt:void 0),startedAt:n.startedAt}),pendingSettlements:removeKey(t.pendingSettlements,pendingKey(`action`,n.action.id))}}function settleAction(e,t){let n=e.actions[t.actionId];return n===void 0?retainPending(e,`action`,t.actionId,t):n.phase===`running`?{...e,actions:replaceBounded(e.actions,t.actionId,{...n,phase:t.outcome,settledAt:t.settledAt})}:e}function startBlocker(t,n){if(t.blockers[n.blocker.id]!==void 0)return t;let r=pendingFor(t,`blocker`,n.blocker.id),i=t.work[n.blocker.parentWorkId],a=r?.outcome??(i!==void 0&&i.phase!==`running`?`cancelled`:`blocked`);return{...t,blockers:replaceBounded(t.blockers,n.blocker.id,{...n.blocker,label:n.blocker.label===void 0?void 0:normalizeActivityText(n.blocker.label),phase:a,settledAt:r?.settledAt??(a===`cancelled`?i?.settledAt:void 0),startedAt:n.startedAt}),pendingSettlements:removeKey(t.pendingSettlements,pendingKey(`blocker`,n.blocker.id))}}function settleBlocker(e,t){let n=e.blockers[t.blockerId];return n===void 0?retainPending(e,`blocker`,t.blockerId,t):n.phase===`blocked`?{...e,blockers:replaceBounded(e.blockers,t.blockerId,{...n,phase:t.outcome,settledAt:t.settledAt})}:e}function retainPending(e,t,n,r){let i=pendingKey(t,n);return e.pendingSettlements[i]===void 0?{...e,pendingSettlements:replaceBounded(e.pendingSettlements,i,{entityKind:t,eventId:r.eventId,outcome:r.outcome,settledAt:r.settledAt},500)}:e}function pendingFor(e,t,n){return e.pendingSettlements[pendingKey(t,n)]}function pendingKey(e,t){return`${e}:${t}`}function settleWorkTree(e,t){let n=new Set([t.workId]),r=!0;for(;r;){r=!1;for(let t of Object.values(e.work))t.parentId===void 0||!n.has(t.parentId)||n.has(t.id)||(n.add(t.id),r=!0)}return{...e,actions:mapActivityStates(e.actions,e=>n.has(e.parentWorkId)&&e.phase===`running`?{...e,phase:`cancelled`,settledAt:t.settledAt}:e),blockers:mapActivityStates(e.blockers,e=>n.has(e.parentWorkId)&&e.phase===`blocked`?{...e,phase:`cancelled`,settledAt:t.settledAt}:e),work:mapActivityStates(e.work,e=>e.id===t.workId?{...e,phase:t.outcome,settledAt:t.settledAt}:n.has(e.id)&&e.phase===`running`?{...e,phase:`cancelled`,settledAt:t.settledAt}:e)}}function mapActivityStates(e,t){let n=e;for(let[r,i]of Object.entries(e)){let a=t(i);a!==i&&(n===e&&(n={...e}),n[r]=a)}return n}function replaceBounded(e,t,n,r=500){let i={...e,[t]:n},a=Object.keys(i).length-r;for(let e of Object.keys(i).slice(0,Math.max(0,a)))delete i[e];return i}function removeKey(e,t){if(e[t]===void 0)return e;let n={...e};return delete n[t],n}function appendBounded(e,t,n){return[...e,t].slice(-n)}export{MAX_ACTIVITY_ENTITIES,MAX_ACTIVITY_EVENT_IDS,MAX_ACTIVITY_PENDING_SETTLEMENTS,createActivitySnapshot,reduceActivityBatch};
|
|
1
|
+
import"#protocol/activity.js";import{normalizeActivityText}from"#execution/activity-text.js";const MAX_ACTIVITY_EVENT_IDS=1e3,MAX_ACTIVITY_PENDING_SETTLEMENTS=500,MAX_ACTIVITY_ENTITIES=500;function createActivitySnapshot(){return{actions:{},blockers:{},pendingSettlements:{},revision:0,seenEventIds:[],version:1,work:{}}}function reduceActivityBatch(e,n){let r=e,i=e.seenEventIds,a=!1,o=!1;for(let e of n.events){if(i.includes(e.eventId))continue;let n=reduceEvent(r,e);n!==r&&(o=!0,i=appendBounded(i,e.eventId,MAX_ACTIVITY_EVENT_IDS),a||=presentationDiffers(r,n),r=n)}return o?a?{...r,revision:e.revision+1,seenEventIds:i}:{...r,revision:e.revision,seenEventIds:i}:e}function presentationDiffers(e,t){return e.actions!==t.actions||e.blockers!==t.blockers||e.work!==t.work}function reduceEvent(e,t){switch(t.kind){case`work.started`:return startWork(e,t);case`work.settled`:return settleWork(e,t);case`action.started`:return startAction(e,t);case`action.settled`:return settleAction(e,t);case`blocker.started`:return startBlocker(e,t);case`blocker.settled`:return settleBlocker(e,t)}}function startWork(t,n){if(t.work[n.work.id]!==void 0)return t;let r=pendingFor(t,`work`,n.work.id),i=n.work.parentId===void 0?void 0:t.work[n.work.parentId],a=r?.outcome??(!isBackgroundWorkBoundary(t,n.work)&&i!==void 0&&i.phase!==`running`?`cancelled`:`running`),o={...n.work,name:n.work.name===void 0?void 0:normalizeActivityText(n.work.name),phase:a,settledAt:r?.settledAt??(a===`cancelled`?i?.settledAt:void 0),startedAt:n.startedAt},s={...t,pendingSettlements:removeKey(t.pendingSettlements,pendingKey(`work`,o.id)),work:replaceBounded(t.work,o.id,o)};return o.phase===`running`?s:settleWorkTree(s,{outcome:o.phase,settledAt:o.settledAt??n.startedAt,workId:o.id})}function settleWork(e,t){let n=e.work[t.workId];return n===void 0?retainPending(e,`work`,t.workId,t):n.phase===`running`?settleWorkTree(e,{outcome:t.outcome,settledAt:t.settledAt,workId:t.workId}):e}function startAction(t,n){if(t.actions[n.action.id]!==void 0)return t;let r=pendingFor(t,`action`,n.action.id),i=t.work[n.action.parentWorkId],a=r?.outcome??(i!==void 0&&i.phase!==`running`?`cancelled`:`running`);return{...t,actions:replaceBounded(t.actions,n.action.id,{...n.action,name:normalizeActivityText(n.action.name),phase:a,settledAt:r?.settledAt??(a===`cancelled`?i?.settledAt:void 0),startedAt:n.startedAt}),pendingSettlements:removeKey(t.pendingSettlements,pendingKey(`action`,n.action.id))}}function settleAction(e,t){let n=e.actions[t.actionId];return n===void 0?retainPending(e,`action`,t.actionId,t):n.phase===`running`?{...e,actions:replaceBounded(e.actions,t.actionId,{...n,phase:t.outcome,settledAt:t.settledAt})}:e}function startBlocker(t,n){if(t.blockers[n.blocker.id]!==void 0)return t;let r=pendingFor(t,`blocker`,n.blocker.id),i=t.work[n.blocker.parentWorkId],a=r?.outcome??(i!==void 0&&i.phase!==`running`?`cancelled`:`blocked`);return{...t,blockers:replaceBounded(t.blockers,n.blocker.id,{...n.blocker,label:n.blocker.label===void 0?void 0:normalizeActivityText(n.blocker.label),phase:a,settledAt:r?.settledAt??(a===`cancelled`?i?.settledAt:void 0),startedAt:n.startedAt}),pendingSettlements:removeKey(t.pendingSettlements,pendingKey(`blocker`,n.blocker.id))}}function settleBlocker(e,t){let n=e.blockers[t.blockerId];return n===void 0?retainPending(e,`blocker`,t.blockerId,t):n.phase===`blocked`?{...e,blockers:replaceBounded(e.blockers,t.blockerId,{...n,phase:t.outcome,settledAt:t.settledAt})}:e}function retainPending(e,t,n,r){let i=pendingKey(t,n);return e.pendingSettlements[i]===void 0?{...e,pendingSettlements:replaceBounded(e.pendingSettlements,i,{entityKind:t,eventId:r.eventId,outcome:r.outcome,settledAt:r.settledAt},500)}:e}function pendingFor(e,t,n){return e.pendingSettlements[pendingKey(t,n)]}function pendingKey(e,t){return`${e}:${t}`}function settleWorkTree(e,t){let n=new Set([t.workId]),r=!0;for(;r;){r=!1;for(let t of Object.values(e.work))t.parentId===void 0||!n.has(t.parentId)||n.has(t.id)||isBackgroundWorkBoundary(e,t)||(n.add(t.id),r=!0)}return{...e,actions:mapActivityStates(e.actions,e=>n.has(e.parentWorkId)&&e.phase===`running`?{...e,phase:`cancelled`,settledAt:t.settledAt}:e),blockers:mapActivityStates(e.blockers,e=>n.has(e.parentWorkId)&&e.phase===`blocked`?{...e,phase:`cancelled`,settledAt:t.settledAt}:e),work:mapActivityStates(e.work,e=>e.id===t.workId?{...e,phase:t.outcome,settledAt:t.settledAt}:n.has(e.id)&&e.phase===`running`?{...e,phase:`cancelled`,settledAt:t.settledAt}:e)}}function isBackgroundWorkBoundary(e,t){return t.kind===`task`?!0:t.callId===void 0||t.parentId===void 0?!1:e.actions[`action:${t.parentId}:${t.callId}`]!==void 0}function mapActivityStates(e,t){let n=e;for(let[r,i]of Object.entries(e)){let a=t(i);a!==i&&(n===e&&(n={...e}),n[r]=a)}return n}function replaceBounded(e,t,n,r=500){let i={...e,[t]:n},a=Object.keys(i).length-r;for(let e of Object.keys(i).slice(0,Math.max(0,a)))delete i[e];return i}function removeKey(e,t){if(e[t]===void 0)return e;let n={...e};return delete n[t],n}function appendBounded(e,t,n){return[...e,t].slice(-n)}export{MAX_ACTIVITY_ENTITIES,MAX_ACTIVITY_EVENT_IDS,MAX_ACTIVITY_PENDING_SETTLEMENTS,createActivitySnapshot,reduceActivityBatch};
|
|
@@ -2,9 +2,8 @@ import type { DeliverHookPayload, RuntimeActionResultHookPayload, SessionCommand
|
|
|
2
2
|
/**
|
|
3
3
|
* Payloads accepted by a session driver's stable and channel aliases.
|
|
4
4
|
*
|
|
5
|
-
* This union is the hook's transport typing only
|
|
6
|
-
*
|
|
7
|
-
* which owns the versioned wire schema and its legacy-shape fallbacks.
|
|
5
|
+
* This union is the hook's transport typing only. The driver routes payloads
|
|
6
|
+
* after the inbox surfaces them; the inbox owns no command semantics.
|
|
8
7
|
*/
|
|
9
8
|
export type SessionInboxPayload = DeliverHookPayload | RuntimeActionResultHookPayload | SessionCommand | SessionTimeoutHookPayload;
|
|
10
9
|
/** Which hook family produced an inbox read. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{sleep}from"#compiled/@workflow/core/index.js";import{signalSessionTimeoutStep}from"#execution/session-timeout-steps.js";async function sessionTimeoutWorkflow(e){"use workflow";await sleep(e.deadline),await signalSessionTimeoutStep({token:e.token})}export{sessionTimeoutWorkflow};
|
|
1
|
+
import{sleep}from"#compiled/@workflow/core/index.js";import{signalSessionTimeoutStep}from"#execution/session-timeout-steps.js";async function sessionTimeoutWorkflow(e){"use workflow";await sleep(e.deadline),await signalSessionTimeoutStep({token:e.token})}sessionTimeoutWorkflow.workflowId=`workflow//eve//sessionTimeoutWorkflow`;export{sessionTimeoutWorkflow};
|
|
@@ -10,6 +10,7 @@ export declare const DEFAULT_ROOT_MAX_INPUT_TOKENS_PER_SESSION = 40000000;
|
|
|
10
10
|
export interface AuthoredSessionLimits {
|
|
11
11
|
readonly maxInputTokensPerSession?: number | false;
|
|
12
12
|
readonly maxOutputTokensPerSession?: number | false;
|
|
13
|
+
readonly maxTokenCostUsdPerSession?: number | false;
|
|
13
14
|
}
|
|
14
15
|
/**
|
|
15
16
|
* Creates the durable compaction configuration used by one harness session.
|
|
@@ -45,8 +46,8 @@ export interface CreateSessionInput {
|
|
|
45
46
|
readonly turnAgent: RuntimeTurnAgent;
|
|
46
47
|
readonly limits?: AuthoredSessionLimits;
|
|
47
48
|
readonly outputSchema?: HarnessSession["outputSchema"];
|
|
48
|
-
readonly subagentDepth?: number;
|
|
49
49
|
readonly systemPromptAdditions?: readonly string[];
|
|
50
|
+
readonly taskId?: string;
|
|
50
51
|
readonly workflowMaxSubagents?: number;
|
|
51
52
|
}
|
|
52
53
|
/** Creates a fresh {@link HarnessSession} from the current `turnAgent`. */
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{formatAvailableSkillsSection}from"#execution/skills/instructions.js";const DEFAULT_ROOT_MAX_INPUT_TOKENS_PER_SESSION=4e7;function createCompactionConfig(e={}){let t=e.thresholdPercent??.9,n={recentWindowSize:10,threshold:e.contextWindowTokens===void 0?1e5:Math.max(1,Math.floor(e.contextWindowTokens*t)),thresholdPercent:t};return e.lastKnownInputTokens===void 0?n:{...n,lastKnownInputTokens:e.lastKnownInputTokens,lastKnownPromptMessageCount:e.lastKnownPromptMessageCount}}function createSession(e){let{turnAgent:t}=e,n=createSessionToolDefinitions(t),r={agent:createSessionAgent(t,createSessionSystemPrompt({additions:e.systemPromptAdditions,turnAgent:t}),n),compaction:createCompactionConfig({contextWindowTokens:t.model?.contextWindowTokens,thresholdPercent:e.compactionOverrides?.thresholdPercent}),continuationToken:e.continuationToken,history:[...t.initialMessages??[]],sessionId:e.sessionId};return e.rootSessionId!==void 0&&(r.rootSessionId=e.rootSessionId),r.limits=resolveSessionLimits(e),e.outputSchema!==void 0&&(r.outputSchema=e.outputSchema),e.
|
|
1
|
+
import{formatAvailableSkillsSection}from"#execution/skills/instructions.js";const DEFAULT_ROOT_MAX_INPUT_TOKENS_PER_SESSION=4e7;function createCompactionConfig(e={}){let t=e.thresholdPercent??.9,n={recentWindowSize:10,threshold:e.contextWindowTokens===void 0?1e5:Math.max(1,Math.floor(e.contextWindowTokens*t)),thresholdPercent:t};return e.lastKnownInputTokens===void 0?n:{...n,lastKnownInputTokens:e.lastKnownInputTokens,lastKnownPromptMessageCount:e.lastKnownPromptMessageCount}}function createSession(e){let{turnAgent:t}=e,n=createSessionToolDefinitions(t),r={agent:createSessionAgent(t,createSessionSystemPrompt({additions:e.systemPromptAdditions,turnAgent:t}),n),compaction:createCompactionConfig({contextWindowTokens:t.model?.contextWindowTokens,thresholdPercent:e.compactionOverrides?.thresholdPercent}),continuationToken:e.continuationToken,history:[...t.initialMessages??[]],sessionId:e.sessionId};return e.rootSessionId!==void 0&&(r.rootSessionId=e.rootSessionId),r.limits=resolveSessionLimits(e),e.outputSchema!==void 0&&(r.outputSchema=e.outputSchema),e.taskId!==void 0&&(r.taskId=e.taskId),e.workflowMaxSubagents!==void 0&&(r.workflowMaxSubagents=e.workflowMaxSubagents),r}function createSessionAgent(e,t,n){let r={compactionModelReference:e.compactionModel,reasoning:e.reasoning,system:t,tools:n};if(e.model!==void 0)return{...r,modelReference:e.model};if(e.dynamicModel!==void 0)return{...r,dynamicModel:!0};throw Error(`Cannot create a session before dynamic subagent config is selected.`)}function refreshSessionFromTurnAgent(e){return{...e.session,agent:createSessionAgent(e.turnAgent,createSessionSystemPrompt({additions:e.systemPromptAdditions,turnAgent:e.turnAgent}),createSessionToolDefinitions(e.turnAgent)),compaction:createCompactionConfig({contextWindowTokens:e.turnAgent.model?.contextWindowTokens,lastKnownInputTokens:e.session.compaction.lastKnownInputTokens,lastKnownPromptMessageCount:e.session.compaction.lastKnownPromptMessageCount,thresholdPercent:e.compactionOverrides?.thresholdPercent})}}function createSessionSystemPrompt(t){let n=formatAvailableSkillsSection(t.turnAgent.availableSkills??[]);return[...n===null?t.turnAgent.instructions:[...t.turnAgent.instructions,n],...t.additions??[]].join(`
|
|
2
2
|
|
|
3
|
-
`)}function mintSubagentContinuationToken(e){return`subagent:${e??crypto.randomUUID()}`}function projectToDurableSession(e){let t={agent:{system:e.agent.system},continuationToken:e.continuationToken,history:e.history,sessionId:e.sessionId};return(e.compaction.lastKnownInputTokens!==void 0||e.compaction.lastKnownPromptMessageCount!==void 0)&&(t.compaction={lastKnownInputTokens:e.compaction.lastKnownInputTokens,lastKnownPromptMessageCount:e.compaction.lastKnownPromptMessageCount}),e.rootSessionId!==void 0&&(t.rootSessionId=e.rootSessionId),e.limits!==void 0&&(t.limits=e.limits),e.outputSchema!==void 0&&(t.outputSchema=e.outputSchema),e.sandboxState!==void 0&&(t.sandboxState=e.sandboxState),e.state!==void 0&&(t.state=e.state),e.
|
|
3
|
+
`)}function mintSubagentContinuationToken(e){return`subagent:${e??crypto.randomUUID()}`}function projectToDurableSession(e){let t={agent:{system:e.agent.system},continuationToken:e.continuationToken,history:e.history,sessionId:e.sessionId};return(e.compaction.lastKnownInputTokens!==void 0||e.compaction.lastKnownPromptMessageCount!==void 0)&&(t.compaction={lastKnownInputTokens:e.compaction.lastKnownInputTokens,lastKnownPromptMessageCount:e.compaction.lastKnownPromptMessageCount}),e.rootSessionId!==void 0&&(t.rootSessionId=e.rootSessionId),e.limits!==void 0&&(t.limits=e.limits),e.outputSchema!==void 0&&(t.outputSchema=e.outputSchema),e.sandboxState!==void 0&&(t.sandboxState=e.sandboxState),e.state!==void 0&&(t.state=e.state),e.taskId!==void 0&&(t.taskId=e.taskId),e.workflowMaxSubagents!==void 0&&(t.workflowMaxSubagents=e.workflowMaxSubagents),t}function hydrateDurableSession(e){let{durable:t,turnAgent:n}=e,r=createSessionToolDefinitions(n),i={agent:createSessionAgent(n,t.agent.system,r),compaction:createCompactionConfig({contextWindowTokens:n.model?.contextWindowTokens,lastKnownInputTokens:t.compaction?.lastKnownInputTokens,lastKnownPromptMessageCount:t.compaction?.lastKnownPromptMessageCount,thresholdPercent:e.compactionOverrides?.thresholdPercent}),continuationToken:t.continuationToken,history:t.history,sessionId:t.sessionId};return t.rootSessionId!==void 0&&(i.rootSessionId=t.rootSessionId),t.limits!==void 0&&(i.limits=t.limits),t.outputSchema!==void 0&&(i.outputSchema=t.outputSchema),t.sandboxState!==void 0&&(i.sandboxState=t.sandboxState),t.state!==void 0&&(i.state=t.state),t.taskId!==void 0&&(i.taskId=t.taskId),t.workflowMaxSubagents!==void 0&&(i.workflowMaxSubagents=t.workflowMaxSubagents),i}function createSessionToolDefinitions(e){return e.tools.map(e=>({description:e.description??``,inputSchema:e.inputSchema,name:e.name,outputSchema:e.outputSchema}))}function resolveSessionLimits(e){let n=e.rootSessionId!==void 0,r=resolveSessionTokenLimit({authored:e.limits?.maxInputTokensPerSession,fallback:n?void 0:DEFAULT_ROOT_MAX_INPUT_TOKENS_PER_SESSION}),i=resolveSessionTokenLimit({authored:e.limits?.maxOutputTokensPerSession,fallback:void 0}),a=resolveSessionTokenLimit({authored:e.limits?.maxTokenCostUsdPerSession,fallback:void 0}),o={};return r!==void 0&&(o.maxInputTokensPerSession=r),i!==void 0&&(o.maxOutputTokensPerSession=i),a!==void 0&&(o.maxTokenCostUsdPerSession=a),o}function resolveSessionTokenLimit(e){return e.authored===!1?void 0:e.authored??e.fallback}export{DEFAULT_ROOT_MAX_INPUT_TOKENS_PER_SESSION,createCompactionConfig,createSession,hydrateDurableSession,mintSubagentContinuationToken,projectToDurableSession,refreshSessionFromTurnAgent};
|
|
@@ -7,7 +7,7 @@ export interface CancelledTurnSettleResult {
|
|
|
7
7
|
}
|
|
8
8
|
/**
|
|
9
9
|
* Settles one cancelled turn: emits `turn.cancelled` → `session.waiting`,
|
|
10
|
-
* drops pending
|
|
10
|
+
* drops pending coordination state, and persists the between-turns
|
|
11
11
|
* session. Runs in the *driver* run, whose wake sources exclude the
|
|
12
12
|
* cancel hook, so a queued cancel wake cannot re-dispatch it.
|
|
13
13
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{callAdapterEventHandler}from"#channel/adapter.js";import{encodeMessageStreamEvent,stampMessageStreamEvent}from"#protocol/message.js";import{BundleKey,ChannelKey}from"#runtime/sessions/runtime-context-keys.js";import{getHarnessEmissionState,isHarnessBetweenTurns,setHarnessEmissionState}from"#harness/emission.js";import{
|
|
1
|
+
import{callAdapterEventHandler}from"#channel/adapter.js";import{encodeMessageStreamEvent,stampMessageStreamEvent}from"#protocol/message.js";import{BundleKey,ChannelKey}from"#runtime/sessions/runtime-context-keys.js";import{getHarnessEmissionState,isHarnessBetweenTurns,setHarnessEmissionState}from"#harness/emission.js";import{deserializeContext,serializeContext}from"#context/serialize.js";import{createDurableSessionState,readDurableSession}from"#execution/durable-session-store.js";import{clearWorkflowToolRuns,getWorkflowToolRuns}from"#harness/workflow-tool-runs.js";import{resolveEffectiveAgentRuntime}from"#execution/effective-agent-config.js";import{hydrateDurableSession}from"#execution/session.js";import{buildAdapterContext}from"#channel/adapter-context.js";import{withContextScope}from"#context/run-step.js";import{clearPendingCoordinationBatch}from"#harness/coordination.js";import{activeTurnId}from"#harness/active-turn-id.js";import{clearPendingWorkflowInterrupt}from"#harness/workflow-interrupt-state.js";import{clearAllProxyInputRequests,getProxyInputRequests,hasProxyInputRequests}from"#harness/proxy-input-requests.js";import{clearPendingSessionLimitPrompt}from"#harness/input-requests.js";import{setChannelContext}from"#execution/channel-context.js";import{dispatchStreamEventHooks}from"#context/hook-lifecycle.js";import{observeSessionActivity}from"#execution/session-activity-projection.js";import{reconcileSessionContinuationToken}from"#execution/reconcile-session-continuation-token.js";import{emitCancelledTurn}from"#harness/cancelled-turn-emission.js";import{abandonAgentInvocationOwners,abandonRunningAgentTurns}from"#subagents/handles/transitions.js";import{bindSessionInstrumentation}from"#instrumentation/runtime.js";import{getTurnUsageState,toUsage}from"#harness/turn-tag-state.js";async function settleCancelledTurnStep(a){"use step";let o=await readDurableSession(a.sessionState),s=await deserializeContext(a.serializedContext),c=s.require(ChannelKey),l=buildAdapterContext(c,s),u=s.require(BundleKey),d=resolveEffectiveAgentRuntime(u,s),f=hydrateDurableSession({compactionOverrides:{thresholdPercent:d.thresholdPercent},durable:o,turnAgent:d.turnAgent}),p=bindSessionInstrumentation({agentName:d.turnAgent.id,ctx:s,rootSessionId:f.rootSessionId??f.sessionId,sessionId:f.sessionId}),m=getHarnessEmissionState(o.state),h=[...getProxyInputRequests(o.state).values()].some(e=>e.kind===`session-limit`);if(!(isHarnessBetweenTurns(f)&&hasProxyInputRequests(o.state)&&!h)){let t=a.parentWritable.getWriter();try{let n=await withContextScope(s,f,async n=>{let baseEmit=async n=>{let r=await callAdapterEventHandler(c,n,l);setChannelContext(s,{...c,state:{...l.state}});let i=stampMessageStreamEvent(r);await t.write(encodeMessageStreamEvent(i)),observeSessionActivity({ctx:s,event:i,sessionId:f.sessionId}),await dispatchStreamEventHooks({ctx:s,event:i,registry:u.hookRegistry})};return{result:await emitCancelledTurn(p?.createHandleEvent({handleEvent:baseEmit,turnId:activeTurnId(m)})??baseEmit,m),session:n}});m=n.result,f=n.session}finally{await p?.flush(),t.releaseLock()}}let g=getWorkflowToolRuns(f.state);f=abandonAgentInvocationOwners(f,new Set(g.map(e=>e.runId)));let _=reconcileSessionContinuationToken(s,setHarnessEmissionState(clearPendingSessionLimitPrompt(clearAllProxyInputRequests(clearPendingWorkflowInterrupt(clearPendingCoordinationBatch(clearWorkflowToolRuns(abandonRunningAgentTurns({...f,outputSchema:void 0})))))),m)),v=getTurnUsageState(f.state)?.session,y={serializedContext:serializeContext(s),sessionState:createDurableSessionState({session:_})};return v===void 0?y:{...y,usage:toUsage(v)}}export{settleCancelledTurnStep};
|
|
@@ -7,6 +7,6 @@ export declare const WORKFLOW_ENTRY_NAME = "workflowEntry";
|
|
|
7
7
|
export declare const TURN_WORKFLOW_NAME = "turnWorkflow";
|
|
8
8
|
export declare const SESSION_TIMEOUT_WORKFLOW_NAME = "sessionTimeoutWorkflow";
|
|
9
9
|
export declare const TASK_RUN_WORKFLOW_NAME = "taskRunWorkflow";
|
|
10
|
-
export declare const
|
|
10
|
+
export declare const WORKFLOW_TOOL_RUN_WORKFLOW_NAME = "workflowToolRunWorkflow";
|
|
11
11
|
export declare const ACTIVITY_COLLECTOR_WORKFLOW_NAME = "activityCollectorWorkflow";
|
|
12
12
|
export declare const STABLE_WORKFLOW_NAMES: ReadonlySet<string>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const WORKFLOW_ENTRY_NAME=`workflowEntry`,TURN_WORKFLOW_NAME=`turnWorkflow`,SESSION_TIMEOUT_WORKFLOW_NAME=`sessionTimeoutWorkflow`,TASK_RUN_WORKFLOW_NAME=`taskRunWorkflow`,
|
|
1
|
+
const WORKFLOW_ENTRY_NAME=`workflowEntry`,TURN_WORKFLOW_NAME=`turnWorkflow`,SESSION_TIMEOUT_WORKFLOW_NAME=`sessionTimeoutWorkflow`,TASK_RUN_WORKFLOW_NAME=`taskRunWorkflow`,WORKFLOW_TOOL_RUN_WORKFLOW_NAME=`workflowToolRunWorkflow`,ACTIVITY_COLLECTOR_WORKFLOW_NAME=`activityCollectorWorkflow`,STABLE_WORKFLOW_NAMES=new Set([WORKFLOW_ENTRY_NAME,TURN_WORKFLOW_NAME,SESSION_TIMEOUT_WORKFLOW_NAME,TASK_RUN_WORKFLOW_NAME,WORKFLOW_TOOL_RUN_WORKFLOW_NAME,ACTIVITY_COLLECTOR_WORKFLOW_NAME]);export{ACTIVITY_COLLECTOR_WORKFLOW_NAME,SESSION_TIMEOUT_WORKFLOW_NAME,STABLE_WORKFLOW_NAMES,TASK_RUN_WORKFLOW_NAME,TURN_WORKFLOW_NAME,WORKFLOW_ENTRY_NAME,WORKFLOW_TOOL_RUN_WORKFLOW_NAME};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{ContinuationTokenKey,SessionCallbackKey,SessionIdKey}from"#context/keys.js";import{fireTaskEventCallbackStep}from"#
|
|
1
|
+
import{ContinuationTokenKey,SessionCallbackKey,SessionIdKey}from"#context/keys.js";import{fireTaskEventCallbackStep}from"#subagents/callback-step.js";async function forwardTaskEventToSessionCallback(e,t){let n=e.get(SessionCallbackKey);return n?.taskId===void 0||t.type!==`input.requested`&&t.type!==`authorization.required`&&t.type!==`authorization.completed`?!1:(await fireTaskEventCallbackStep({callback:n,childContinuationToken:e.require(ContinuationTokenKey),childSessionId:e.require(SessionIdKey),event:t}),!0)}export{forwardTaskEventToSessionCallback};
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import type { ActivityObserverConfig } from "#channel/types.js";
|
|
2
|
+
import type { WorkflowToolAuthorizationRequest, WorkflowToolRunRequestMessage } from "#execution/tools/workflow/messages.js";
|
|
3
|
+
import type { WorkflowToolRunTaskInputRequest } from "./workflow.js";
|
|
2
4
|
import type { AnswerHookRoute } from "#harness/proxy-input-requests.js";
|
|
3
5
|
import type { ActivityEventV1 } from "#protocol/activity.js";
|
|
4
|
-
import { type TaskInboundAnswerInput, type
|
|
6
|
+
import { type TaskInboundAnswerInput, type TaskInboundUpdate, type TaskView } from "#tasks/types.js";
|
|
5
7
|
/**
|
|
6
8
|
* Appends one full task view to the owning task run's `eve.task`
|
|
7
9
|
* stream. Only the task run workflow calls this, which is what makes
|
|
@@ -11,17 +13,11 @@ export declare function appendTaskViewStep(input: {
|
|
|
11
13
|
readonly activityObserver?: ActivityObserverConfig;
|
|
12
14
|
readonly view: TaskView;
|
|
13
15
|
}): Promise<void>;
|
|
14
|
-
export declare function
|
|
16
|
+
export declare function projectTaskActivity(input: {
|
|
15
17
|
readonly activityObserver: ActivityObserverConfig | undefined;
|
|
16
18
|
readonly settledAt: string;
|
|
17
19
|
readonly view: TaskView;
|
|
18
20
|
}): readonly ActivityEventV1[];
|
|
19
|
-
/** Re-emits a task-owned child authorization event through the parent channel. */
|
|
20
|
-
export declare function wakeTaskAuthorizationParentStep(input: {
|
|
21
|
-
readonly request: TaskInboundAuthorizationEvent;
|
|
22
|
-
readonly taskId: string;
|
|
23
|
-
readonly token: string;
|
|
24
|
-
}): Promise<void>;
|
|
25
21
|
/**
|
|
26
22
|
* Wakes the parent session with a framework task notification.
|
|
27
23
|
*
|
|
@@ -40,9 +36,21 @@ export declare function wakeTaskUpdateParentStep(input: {
|
|
|
40
36
|
readonly update: TaskInboundUpdate;
|
|
41
37
|
readonly view: TaskView;
|
|
42
38
|
}): Promise<void>;
|
|
43
|
-
/**
|
|
44
|
-
export declare function
|
|
45
|
-
readonly request:
|
|
39
|
+
/** Forwards one agent spawn or settlement request to the parent session. */
|
|
40
|
+
export declare function wakeTaskAgentRequestParentStep(input: {
|
|
41
|
+
readonly request: WorkflowToolRunRequestMessage;
|
|
42
|
+
readonly taskId: string;
|
|
43
|
+
readonly token: string;
|
|
44
|
+
}): Promise<void>;
|
|
45
|
+
/** Re-emits a task child's authorization event through the parent channel. */
|
|
46
|
+
export declare function wakeTaskAuthorizationParentStep(input: {
|
|
47
|
+
readonly request: WorkflowToolAuthorizationRequest;
|
|
48
|
+
readonly taskId: string;
|
|
49
|
+
readonly token: string;
|
|
50
|
+
}): Promise<void>;
|
|
51
|
+
/** Sends a workflow-body question to the owning parent's pre-model router. */
|
|
52
|
+
export declare function wakeWorkflowTaskInputRequestParentStep(input: {
|
|
53
|
+
readonly request: WorkflowToolRunTaskInputRequest;
|
|
46
54
|
readonly taskId: string;
|
|
47
55
|
readonly token: string;
|
|
48
56
|
}): Promise<void>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{createLogger}from"#internal/logging.js";import{getWritable}from"#compiled/@workflow/core/index.js";import{resumeSessionInbox}from"#execution/wire/session-inbox-resume.js";import{
|
|
1
|
+
import{createLogger}from"#internal/logging.js";import{getWritable}from"#compiled/@workflow/core/index.js";import{resumeSessionInbox}from"#execution/wire/session-inbox-resume.js";import{resumeWorkflowToolRunAnswers}from"#execution/tools/workflow/answer.js";import{submitActivity}from"#execution/submit-activity.js";import{isTaskWorkflowTargetGone}from"#execution/tasks/workflow-target.js";import{TASK_VIEW_STREAM_NAMESPACE,isTerminalTaskStatus,taskAuthorizationRequestId}from"#tasks/types.js";const log=createLogger(`execution.tasks.run`);async function appendTaskViewStep(e){"use step";let n=getWritable({namespace:TASK_VIEW_STREAM_NAMESPACE}).getWriter();try{await n.write(e.view)}finally{n.releaseLock()}submitActivity({events:projectTaskActivity({activityObserver:e.activityObserver,settledAt:new Date().toISOString(),view:e.view}),sink:e.activityObserver?.sink})}function projectTaskActivity(e){let t=e.activityObserver?.workIdentity;if(t===void 0)return[];let n=e.view.status;return n===`working`?[{eventId:`${t.id}:started`,kind:`work.started`,startedAt:e.settledAt,work:t}]:n!==`completed`&&n!==`failed`&&n!==`cancelled`?[]:[{eventId:`${t.id}:settled:${n}`,kind:`work.settled`,outcome:n,settledAt:e.settledAt,workId:t.id}]}async function wakeTaskParentStep(e){"use step";let t={message:formatTaskNotification(e.view)};isTerminalTaskStatus(e.view.status)&&(t.task={views:[e.view]});let r={kind:`send`,payload:t,taskDeliveryId:`${e.view.taskId}:ready:${e.view.status}`};try{await resumeSessionInbox(e.token,r)}catch(t){if(isTaskWorkflowTargetGone(t)){log.warn(`task wake target is gone; the parent session already ended`,{status:e.view.status,taskId:e.view.taskId});return}throw t}}async function wakeTaskUpdateParentStep(e){"use step";let t={kind:`send`,payload:{message:`Background task ${e.view.taskId} (${e.view.metadata.name}) update: ${e.update.message}`},taskDeliveryId:`${e.view.taskId}:update:${e.update.updateEpoch}:${e.update.updateIndex}:${e.update.callId}`};try{await resumeSessionInbox(e.token,t)}catch(e){if(isTaskWorkflowTargetGone(e))return;throw e}}async function wakeTaskAgentRequestParentStep(e){"use step";let t=e.request.request;if(t.kind!==`agent-invoke`&&t.kind!==`agent-settled`)throw Error(`Cannot forward task input as an agent request.`);let r={replyTo:e.request.replyTo,request:t,taskId:e.taskId},i=t.kind===`agent-invoke`?t.invocationId:`${t.result.callId}:settled`,a={kind:`send`,payload:{task:{agentRequests:[r]}},taskDeliveryId:`${e.taskId}:agent:${e.request.from.runId}:${i}`};try{await resumeSessionInbox(e.token,a)}catch(e){if(!isTaskWorkflowTargetGone(e))throw e}}async function wakeTaskAuthorizationParentStep(e){"use step";let{event:t}=e.request,r=t.event.data,i={task:{authorizationEvents:[{hookPayload:t,taskId:e.taskId}]}};t.event.type===`authorization.required`&&(i.message=`Background task ${e.taskId} needs authorization.`);let a={kind:`send`,payload:i,taskDeliveryId:`${e.taskId}:authorization:${t.event.type}:${r.turnId}:${r.stepIndex}:${r.sequence}:${taskAuthorizationRequestId(t.event)}`};try{await resumeSessionInbox(e.token,a)}catch(e){if(!isTaskWorkflowTargetGone(e))throw e}}async function wakeWorkflowTaskInputRequestParentStep(e){"use step";let t={kind:`send`,payload:{task:{inputRequests:[e.request.requests===void 0?{replyTo:e.request.replyTo,request:e.request.request,sequence:e.request.sequence,stepIndex:e.request.stepIndex,taskId:e.taskId,turnId:e.request.turnId}:{replyTo:e.request.replyTo,requests:e.request.requests,sequence:e.request.sequence,stepIndex:e.request.stepIndex,taskId:e.taskId,turnId:e.request.turnId}]}},taskDeliveryId:`${e.taskId}:input:${e.request.turnId}:${e.request.stepIndex}:${e.request.sequence}`};try{await resumeSessionInbox(e.token,t)}catch(e){if(!isTaskWorkflowTargetGone(e))throw e}}async function deliverTaskInputResponsesStep(e){"use step";let t=new Set(e.requestIds),i={auth:e.answer.auth,kind:`send`,payload:{inputResponses:e.answer.inputResponses.filter(e=>t.has(e.requestId))},taskDeliveryId:`${e.answer.taskId}:${[...e.requestIds].sort().join(`,`)}`};try{if(e.answer.childResponseUrl!==void 0){let t=await fetch(e.answer.childResponseUrl,{body:JSON.stringify({inputResponses:i.payload.inputResponses}),headers:{"content-type":`application/json`},method:`POST`,redirect:`error`});if(t.status===404)return`unreachable`;if(!t.ok)throw Error(`Remote task input delivery failed with HTTP ${t.status}.`)}else e.answerHook===void 0?await resumeSessionInbox(e.answer.childContinuationToken,i):await resumeWorkflowToolRunAnswers(e.answer.childContinuationToken,i.payload.inputResponses);return`delivered`}catch(t){if(isTaskWorkflowTargetGone(t))return log.warn(`task input answer target is gone; the child turn already ended`,{taskId:e.answer.taskId}),`unreachable`;throw t}}function formatTaskNotification(e){let t=`Background task ${e.taskId} (${e.metadata.name})`;return e.status===`input_required`?`${t} needs input.`:e.status===`completed`?`${t} is completed.\n\nResult:\n${formatTaskOutput(e.lastOutput.data)}`:e.status===`failed`?`${t} failed.\n\nError:\n${formatTaskOutput(e.lastOutput.data)}`:`${t} is cancelled.`}function formatTaskOutput(e){return typeof e==`string`?e:JSON.stringify(e)??`null`}export{appendTaskViewStep,deliverTaskInputResponsesStep,formatTaskNotification,projectTaskActivity,wakeTaskAgentRequestParentStep,wakeTaskAuthorizationParentStep,wakeTaskParentStep,wakeTaskUpdateParentStep,wakeWorkflowTaskInputRequestParentStep};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { TaskInboundUpdate } from "#tasks/types.js";
|
|
2
|
+
/** Forwards a local task-owned child's progress update to its active parent hook. */
|
|
3
|
+
export declare function forwardLocalTaskUpdateStep(input: {
|
|
4
|
+
readonly parentContinuationToken: string;
|
|
5
|
+
readonly update: TaskInboundUpdate;
|
|
6
|
+
}): Promise<void>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{resumeHook}from"#internal/workflow/runtime.js";async function forwardLocalTaskUpdateStep(e){"use step";await resumeHook(e.parentContinuationToken,e.update)}export{forwardLocalTaskUpdateStep};
|
|
@@ -1,11 +1,8 @@
|
|
|
1
1
|
import type { ChannelAdapter } from "#channel/adapter.js";
|
|
2
|
-
import type {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
readonly
|
|
7
|
-
readonly
|
|
8
|
-
|
|
9
|
-
readonly updateEpoch: string;
|
|
10
|
-
readonly serializedContext: Record<string, unknown> | undefined;
|
|
11
|
-
}): Promise<RuntimeActionResult>;
|
|
2
|
+
import type { TaskInboundUpdate } from "#tasks/types.js";
|
|
3
|
+
/** Delivers a task update through the local child adapter or remote callback. */
|
|
4
|
+
export declare function deliverTaskUpdate(input: {
|
|
5
|
+
readonly adapter?: ChannelAdapter;
|
|
6
|
+
readonly callback: unknown;
|
|
7
|
+
readonly update: TaskInboundUpdate;
|
|
8
|
+
}): Promise<string | undefined>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{fireTaskUpdateCallbackStep}from"#subagents/callback-step.js";import{forwardLocalTaskUpdateStep}from"#execution/tasks/child/update-step.js";import{SUBAGENT_ADAPTER_KIND,isSubagentAdapterState}from"#subagents/adapter-state.js";async function deliverTaskUpdate(e){let t=e.adapter?.state;return e.adapter?.kind===SUBAGENT_ADAPTER_KIND&&isSubagentAdapterState(t)&&t.taskId!==void 0?(await forwardLocalTaskUpdateStep({parentContinuationToken:t.parentContinuationToken,update:e.update}),t.taskId):await fireTaskUpdateCallbackStep({callback:e.callback,callId:e.update.callId,message:e.update.message,updateEpoch:e.update.updateEpoch,updateIndex:e.update.updateIndex})}export{deliverTaskUpdate};
|
|
@@ -1,34 +1,28 @@
|
|
|
1
1
|
import type { ActivityObserverConfig } from "#channel/types.js";
|
|
2
|
-
import { type
|
|
3
|
-
|
|
2
|
+
import { type WorkflowBodyDefinition } from "#execution/tools/workflow/body.js";
|
|
3
|
+
import { type TaskInputRequest, type TaskView } from "#tasks/types.js";
|
|
4
4
|
export interface TaskRunWorkflowInput {
|
|
5
|
-
/** Activity sink and work identity for best-effort terminal settlement. */
|
|
6
5
|
readonly activityObserver?: ActivityObserverConfig;
|
|
7
|
-
/** Private task inbox token; a routing credential, never model-visible. */
|
|
8
|
-
readonly taskInboxToken: string;
|
|
9
|
-
/** The creation view, normally `working`. */
|
|
10
6
|
readonly initialView: TaskView;
|
|
11
|
-
/** Parent session delivery token used to wake the task's owning parent. */
|
|
12
7
|
readonly parentContinuationToken: string;
|
|
8
|
+
readonly taskInboxToken: string;
|
|
9
|
+
readonly workflow?: WorkflowBodyDefinition;
|
|
10
|
+
}
|
|
11
|
+
/** A workflow-body question routed through the task that owns the workflow tool run. */
|
|
12
|
+
interface WorkflowToolRunTaskInputRequestBase {
|
|
13
|
+
readonly kind: "task-input-request";
|
|
14
|
+
readonly replyTo: string;
|
|
15
|
+
readonly sequence: number;
|
|
16
|
+
readonly stepIndex: number;
|
|
17
|
+
readonly turnId: string;
|
|
13
18
|
}
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
* change nothing.
|
|
23
|
-
*
|
|
24
|
-
* Wake policy: a transition into a ready status — terminal or
|
|
25
|
-
* `input_required` — and an explicit child `task_update` deliver a
|
|
26
|
-
* framework notification to the parent session. A parked parent starts
|
|
27
|
-
* a turn; an active turn observes the delivery at its next safe boundary.
|
|
28
|
-
*
|
|
29
|
-
* The run ends when the task reaches a terminal status. Its view
|
|
30
|
-
* stream stays readable, so terminal tasks remain peekable; the
|
|
31
|
-
* disposed hook makes any later command fail loudly instead of queueing
|
|
32
|
-
* against a finished task.
|
|
33
|
-
*/
|
|
19
|
+
export type WorkflowToolRunTaskInputRequest = WorkflowToolRunTaskInputRequestBase & ({
|
|
20
|
+
readonly request: TaskInputRequest;
|
|
21
|
+
readonly requests?: never;
|
|
22
|
+
} | {
|
|
23
|
+
readonly request?: never;
|
|
24
|
+
readonly requests: readonly TaskInputRequest[];
|
|
25
|
+
});
|
|
26
|
+
/** Owns lifecycle for one background task and consumes its executor traffic. */
|
|
34
27
|
export declare function taskRunWorkflow(input: TaskRunWorkflowInput): Promise<void>;
|
|
28
|
+
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{createHook}from"#compiled/@workflow/core/index.js";import{claimHookOwnership,disposeHook,isHookConflictError}from"#execution/hook-ownership.js";import{isReadyTaskStatus,isTerminalTaskStatus,readTaskInputRequestId
|
|
1
|
+
import{createHook}from"#compiled/@workflow/core/index.js";import{claimHookOwnership,disposeHook,isHookConflictError}from"#execution/hook-ownership.js";import{isReadyTaskStatus,isTerminalTaskStatus,readTaskInputRequestId}from"#tasks/types.js";import{appendTaskViewStep,deliverTaskInputResponsesStep,wakeTaskAgentRequestParentStep,wakeTaskAuthorizationParentStep,wakeTaskParentStep,wakeTaskUpdateParentStep,wakeWorkflowTaskInputRequestParentStep}from"#execution/tasks/child/steps.js";import{createWorkflowBodyRef,executeWorkflowBody}from"#execution/tools/workflow/body.js";import{deriveWorkflowToolRunOwner}from"#execution/tools/workflow/messages.js";import{createChannelReader,raceChannelReads}from"#execution/tools/workflow/owner-channels.js";import{openWorkflowToolRunOwnerChannels}from"#execution/tools/workflow/owner.js";import{workflowToolRunOutcomeToTaskCommand,workflowToolRunReportToTaskUpdate,workflowToolRunRequestToTaskInputRequest}from"#execution/tools/workflow/owner-inbox.js";import{applyTaskTransition}from"#tasks/transitions.js";async function taskRunWorkflow(a){"use workflow";let o=createHook({token:a.taskInboxToken}),c=openWorkflowToolRunOwnerChannels(a.taskInboxToken),l=[...c.readers,createChannelReader(`commands`,o)],u=!1,d=a.initialView,f=!1,p=!1,m,h=[],g=0,_={ownerRequests:[]},v=new Map,y=new AbortController,b,x=a.workflow===void 0;try{try{await claimHookOwnership(o),u=!0}catch(e){if(isHookConflictError(e))return;throw e}for(await appendTaskViewStep({activityObserver:a.activityObserver,view:d});!isFinished();){let e=await raceChannelReads(b===void 0?l:[...l,b]);if(e.channel===`body`){if(x=!0,b=void 0,e.next.done)continue;await applyPayload({command:workflowToolRunOutcomeToTaskCommand({from:createWorkflowBodyRef({...a.workflow,execution:`background`}),result:e.next.value}),kind:`task-command`}),d.status===`cancelled`&&f&&!p&&await wakeTaskParentStep({token:a.parentContinuationToken,view:d});continue}if(e.next.done)return;if(e.channel===`report`){await applyPayload(workflowToolRunReportToTaskUpdate(e.next.value,d.taskId,g++));continue}if(e.channel===`outcome`){await applyPayload({command:workflowToolRunOutcomeToTaskCommand(e.next.value),kind:`task-command`});continue}if(e.channel===`request`){let t=e.next.value,n=t.request.kind;if(n===`agent-invoke`||n===`agent-settled`||n===`authorization-request`){await handleOwnerRequest(t);continue}t.requestCoordinates===void 0&&v.set(t.replyTo,{runId:t.from.runId}),await applyPayload(workflowToolRunRequestToTaskInputRequest(t));continue}await applyPayload(e.next.value)}}finally{u&&(await c.dispose(),await disposeHook(o))}function isFinished(){return isTerminalTaskStatus(d.status)&&f&&x}async function handleUpdate(e){f&&!isTerminalTaskStatus(d.status)?await wakeTaskUpdateParentStep({token:a.parentContinuationToken,update:e,view:d}):h.push(e)}async function applyPayload(e){let t=e.kind===`task-command`&&e.command.kind===`ready`,n=e.kind===`task-command`&&e.command.kind===`reject-dispatch`;if((t||n)&&(f=!0),n&&(p=!0),(t||n)&&(n||isTerminalTaskStatus(d.status)?x=!0:a.workflow!==void 0&&b===void 0&&!x&&(b=createChannelReader(`body`,awaitBodyResult(executeWorkflowBody({...a.workflow,execution:`background`,owner:deriveWorkflowToolRunOwner(a.taskInboxToken)},y.signal)))),await flushPendingTraffic()),e.kind===`task-input-request`&&(m=e),e.kind===`task-update`){await handleUpdate(e);return}let r;if(e.kind===`input-response`)r=d.status===`input_required`?await resolveAnsweredCommand(d,e,v.get(e.childContinuationToken)):void 0;else if(e.kind===`task-input-request`)r={inputRequests:e.requests??[e.request],kind:`require-input`};else if(e.kind===`task-command`)r=e.command;else return;if(r===void 0)return;if(t&&isTerminalTaskStatus(d.status)){await flushUpdates(!0),await wakeTaskParentStep({token:a.parentContinuationToken,view:d});return}let o=d,s=applyTaskTransition(d,r);s.action===`accepted`&&(d=s.view,await appendTaskViewStep({activityObserver:a.activityObserver,view:d}),r.kind===`cancel`&&(y.abort(Error(`Task ${d.taskId} was cancelled.`)),b===void 0&&(x=!0)),isTerminalTaskStatus(d.status)||await flushUpdates(),m!==void 0&&f&&d.status===`input_required`?(await wakeWorkflowTaskInputRequestParentStep({request:m,taskId:d.taskId,token:a.parentContinuationToken}),m=void 0):!p&&f&&(r.kind!==`cancel`||x)&&(!isTerminalTaskStatus(o.status)&&isTerminalTaskStatus(d.status)||!isReadyTaskStatus(o.status)&&isReadyTaskStatus(d.status)&&m===void 0)&&await wakeTaskParentStep({token:a.parentContinuationToken,view:d}),d.status!==`input_required`&&(m=void 0))}async function flushUpdates(e=!1){if(!(!f||isTerminalTaskStatus(d.status)&&!e)){for(let e of h)await wakeTaskUpdateParentStep({token:a.parentContinuationToken,update:e,view:d});h=[]}}async function handleOwnerRequest(e){if(!(p||isTerminalTaskStatus(d.status))){if(!f){_.ownerRequests.push(e);return}await wakeTaskOwnerRequestParent(e)}}async function flushPendingTraffic(){if(!p)for(let e of _.ownerRequests)await wakeTaskOwnerRequestParent(e);_.ownerRequests.length=0}async function wakeTaskOwnerRequestParent(e){if(e.request.kind===`authorization-request`){await wakeTaskAuthorizationParentStep({request:e.request,taskId:d.taskId,token:a.parentContinuationToken});return}await wakeTaskAgentRequestParentStep({request:e,taskId:d.taskId,token:a.parentContinuationToken})}}async function*awaitBodyResult(e){yield await e}async function resolveAnsweredCommand(e,t,n){if(t.taskId!==e.taskId)return;let r=new Set(e.inputRequests.flatMap(e=>{let t=readTaskInputRequestId(e);return t===void 0?[]:[t]})),i=t.inputResponses.map(e=>e.requestId).filter(e=>r.has(e));if(i.length!==0)return await deliverTaskInputResponsesStep({answer:t,answerHook:n,requestIds:i})===`delivered`?{kind:`answered`,requestIds:i}:void 0}taskRunWorkflow.workflowId=`workflow//eve//taskRunWorkflow`;export{taskRunWorkflow};
|