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
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { SessionContext } from "#context/session-context.js";
|
|
2
|
+
import type { JsonObject, JsonValue } from "#shared/json.js";
|
|
3
|
+
import type { TaskExecutorBinding } from "#tools/task.js";
|
|
4
|
+
import type { WorkflowToolRunOwner } from "#execution/tools/workflow/messages.js";
|
|
5
|
+
export type WorkflowToolRunSessionContext = SessionContext["session"];
|
|
6
|
+
export declare const WORKFLOW_TOOL_EXECUTOR_KIND = "workflow-tool";
|
|
7
|
+
/** Private task executor binding for the workflow tool run doing the task's work. */
|
|
8
|
+
export declare function createWorkflowToolExecutorBinding(input: WorkflowToolRunAddress): TaskExecutorBinding;
|
|
9
|
+
export declare function readWorkflowToolExecutorAddress(executor: TaskExecutorBinding | undefined): WorkflowToolRunAddress | undefined;
|
|
10
|
+
export interface WorkflowToolRunInput {
|
|
11
|
+
readonly callId: string;
|
|
12
|
+
readonly execution?: "background" | "blocking";
|
|
13
|
+
readonly executeInput?: JsonValue;
|
|
14
|
+
readonly hookToken: string;
|
|
15
|
+
readonly input: JsonObject;
|
|
16
|
+
readonly owner: WorkflowToolRunOwner;
|
|
17
|
+
readonly resultKind?: "subagent" | "tool";
|
|
18
|
+
readonly session: WorkflowToolRunSessionContext;
|
|
19
|
+
readonly stepIndex: number;
|
|
20
|
+
readonly toolName: string;
|
|
21
|
+
readonly workflowId: string;
|
|
22
|
+
}
|
|
23
|
+
export interface WorkflowToolRunAddress {
|
|
24
|
+
readonly hookToken: string;
|
|
25
|
+
readonly runId: string;
|
|
26
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const WORKFLOW_TOOL_EXECUTOR_KIND=`workflow-tool`;function createWorkflowToolExecutorBinding(t){return{data:{hookToken:t.hookToken,runId:t.runId},kind:WORKFLOW_TOOL_EXECUTOR_KIND}}function readWorkflowToolExecutorAddress(e){if(e?.kind!==`workflow-tool`)return;let t=e.data.hookToken,n=e.data.runId;return typeof t==`string`&&typeof n==`string`?{hookToken:t,runId:n}:void 0}export{WORKFLOW_TOOL_EXECUTOR_KIND,createWorkflowToolExecutorBinding,readWorkflowToolExecutorAddress};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{sleep}from"#compiled/@workflow/core/index.js";import{claimHookOwnership,disposeHook,isHookConflictError}from"#execution/hook-ownership.js";import{createWorkflowBodyRef,executeWorkflowBody}from"#execution/tools/workflow/body.js";import{resumeHookStep}from"#execution/tools/workflow/resume-hook-step.js";import{normalizeSerializableError}from"#execution/workflow-errors.js";import{openWorkflowToolRunControlInbox}from"#execution/tools/workflow/run-control.js";async function workflowToolRunWorkflow(i){"use workflow";let a=openWorkflowToolRunControlInbox(i.hookToken),o=!1;try{try{await claimHookOwnership(a.hook),o=!0}catch(e){if(isHookConflictError(e))return;throw e}let n={...i,execution:i.execution??`blocking`},r=createWorkflowBodyRef(n),s=executeWorkflowBody(n,a.signal).then(e=>{if(e.status===`completed`)return e.output;throw e.status===`failed`?e.error:a.signal.reason??Error(e.reason??`Workflow tool run cancelled.`)}),c=s.catch(()=>{}),l;try{l={output:await Promise.race([s,a.cancelled]),status:`completed`}}catch(t){a.signal.aborted?(await Promise.race([c,sleep(`30s`)]),l={reason:a.reason(),status:`cancelled`}):l={error:normalizeSerializableError(t),status:`failed`}}let u={from:r,result:l};await resumeHookStep(i.owner.outcome,u,{ifPresent:l.status===`cancelled`})}finally{o&&await disposeHook(a.hook)}}workflowToolRunWorkflow.workflowId=`workflow//eve//workflowToolRunWorkflow`;export{workflowToolRunWorkflow};
|
|
@@ -13,6 +13,7 @@ export interface TurnCancellationControl {
|
|
|
13
13
|
* the signal aborted. Race it against turn-owned awaits — never
|
|
14
14
|
* `await` it alone.
|
|
15
15
|
*/
|
|
16
|
+
readonly payload: Promise<TurnCancelPayload>;
|
|
16
17
|
readonly requested: Promise<"cancel">;
|
|
17
18
|
/** Disposes the hook, abandoning any outstanding read. Idempotent. */
|
|
18
19
|
dispose(): Promise<void>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{createHook}from"#compiled/@workflow/core/index.js";import{claimHookOwnership,disposeHook,isHookConflictError}from"#execution/hook-ownership.js";import{TurnCancelledError}from"#harness/turn-cancellation.js";import{turnCancellationHookToken}from"#execution/turn-cancellation-token.js";async function createTurnCancellationControl(i){let a=createHook({token:turnCancellationHookToken(i.controlToken)}),o=a[Symbol.asyncIterator]();try{await claimHookOwnership(a)}catch(e){if(isHookConflictError(e))return;throw e}let s=new AbortController,abort=()=>s.abort(new TurnCancelledError),c=i.initialPayload!==void 0&&matchesActiveTurn(i.initialPayload,i.expectedTurnId);c&&abort();let l=c?Promise.resolve(
|
|
1
|
+
import{createHook}from"#compiled/@workflow/core/index.js";import{claimHookOwnership,disposeHook,isHookConflictError}from"#execution/hook-ownership.js";import{TurnCancelledError}from"#harness/turn-cancellation.js";import{turnCancellationHookToken}from"#execution/turn-cancellation-token.js";async function createTurnCancellationControl(i){let a=createHook({token:turnCancellationHookToken(i.controlToken)}),o=a[Symbol.asyncIterator]();try{await claimHookOwnership(a)}catch(e){if(isHookConflictError(e))return;throw e}let s=new AbortController,abort=()=>s.abort(new TurnCancelledError),c=i.initialPayload!==void 0&&matchesActiveTurn(i.initialPayload,i.expectedTurnId);c&&abort();let l=c?Promise.resolve(i.initialPayload):consumeMatchingCancel(o,i.expectedTurnId,abort),u=!1;return{payload:l,signal:s.signal,requested:l.then(()=>`cancel`),async dispose(){u||(u=!0,await disposeHook(a))}}}async function consumeMatchingCancel(e,t,n){for(;;){let r=await e.next();if(r.done)return await new Promise(()=>{});if(matchesActiveTurn(r.value,t))return n(),r.value}}function matchesActiveTurn(e,t){if(typeof e!=`object`||!e)return!0;let n=e.turnId;return n===void 0||n===t}export{createTurnCancellationControl};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { DeliverHookPayload } from "#channel/types.js";
|
|
2
2
|
import type { NextDriverAction } from "#execution/next-driver-action.js";
|
|
3
3
|
import type { SessionCommandInbox } from "#execution/session-command-inbox.js";
|
|
4
|
+
import type { SessionStateCursor } from "#execution/session-state-cursor.js";
|
|
4
5
|
export type TurnDriverAction = NextDriverAction;
|
|
5
6
|
/** Owns one turn's driver-side control hook and public-delivery relay state. */
|
|
6
7
|
export declare class TurnControlReceiver {
|
|
@@ -12,6 +13,7 @@ export declare class TurnControlReceiver {
|
|
|
12
13
|
private readonly expectedTurnId;
|
|
13
14
|
private readonly cancelledTaskIds;
|
|
14
15
|
private readonly seenTaskDeliveries;
|
|
16
|
+
private readonly stateCursor;
|
|
15
17
|
private pendingControl;
|
|
16
18
|
constructor(input: {
|
|
17
19
|
readonly bufferedDeliveries: DeliverHookPayload[];
|
|
@@ -20,6 +22,7 @@ export declare class TurnControlReceiver {
|
|
|
20
22
|
readonly commandInbox: SessionCommandInbox;
|
|
21
23
|
readonly expectedTurnId: string;
|
|
22
24
|
readonly seenTaskDeliveries?: Set<string>;
|
|
25
|
+
readonly stateCursor: SessionStateCursor;
|
|
23
26
|
readonly token: string;
|
|
24
27
|
});
|
|
25
28
|
/** Token passed to the turn workflow so it can publish control messages. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{createHook}from"#compiled/@workflow/core/index.js";import{closeHookIterator,disposeHook}from"#execution/hook-ownership.js";import{reportDroppedWirePayloadStep}from"#execution/report-dropped-wire-payload-step.js";import{SessionInboxWireError,sessionInboxWire}from"#execution/wire/session-inbox-wire.js";import{rebuildSerializableError}from"#execution/workflow-errors.js";import{turnCancellationHookToken}from"#execution/turn-cancellation-token.js";import{forwardTurnCancellationStep}from"#execution/forward-turn-cancellation-step.js";import{forwardTurnDeliveryStep}from"#execution/forward-turn-delivery-step.js";var TurnControlReceiver=class{bufferedDeliveries;bufferedSessionControls;commandInbox;control;controlIterator;expectedTurnId;cancelledTaskIds;seenTaskDeliveries;pendingControl=null;constructor(t){this.bufferedDeliveries=t.bufferedDeliveries,this.bufferedSessionControls=t.bufferedSessionControls,this.cancelledTaskIds=t.cancelledTaskIds??new Set,this.commandInbox=t.commandInbox,this.seenTaskDeliveries=t.seenTaskDeliveries??new Set,this.control=createHook({token:t.token}),this.controlIterator=this.control[Symbol.asyncIterator](),this.expectedTurnId=t.expectedTurnId}get token(){return this.control.token}async dispose(){await closeHookIterator(this.controlIterator),await disposeHook(this.control)}async waitForAction(){for(;;){let e=await this.nextControlOrCommand();if(e.kind===`command`){let t=await this.handleSessionCommand(e.command);if(t!==void 0)return t;continue}let t=e.payload,n=this.readTerminalControl(t);if(n!==void 0)return n;if(t.kind===`turn-delivery-request`){let e=await this.serviceDeliveryRequest(t);if(e!==void 0)return e}}}async handleSessionCommand(e){if(e.kind===`deliver`){if(!this.acceptTaskDelivery(e))return;await this.bufferDelivery(e);return}if(e.kind===`clear`||e.kind===`compact`){this.bufferedSessionControls.push(e.kind);return}if(e.kind===`session-timeout`){this.bufferedSessionControls.push(`expired`);return}if(e.kind===`cancel`){e.taskId!==void 0&&this.discardTaskDeliveries(e.taskId);let t=e.taskId!==void 0&&e.turnId!==void 0&&e.turnId!==this.expectedTurnId?void 0:e.turnId
|
|
1
|
+
import{createHook}from"#compiled/@workflow/core/index.js";import{closeHookIterator,disposeHook}from"#execution/hook-ownership.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{rebuildSerializableError}from"#execution/workflow-errors.js";import{turnCancellationHookToken}from"#execution/turn-cancellation-token.js";import{forwardTurnCancellationStep}from"#execution/forward-turn-cancellation-step.js";import{forwardTurnDeliveryStep}from"#execution/forward-turn-delivery-step.js";var TurnControlReceiver=class{bufferedDeliveries;bufferedSessionControls;commandInbox;control;controlIterator;expectedTurnId;cancelledTaskIds;seenTaskDeliveries;stateCursor;pendingControl=null;constructor(t){this.bufferedDeliveries=t.bufferedDeliveries,this.bufferedSessionControls=t.bufferedSessionControls,this.cancelledTaskIds=t.cancelledTaskIds??new Set,this.commandInbox=t.commandInbox,this.seenTaskDeliveries=t.seenTaskDeliveries??new Set,this.stateCursor=t.stateCursor,this.control=createHook({token:t.token}),this.controlIterator=this.control[Symbol.asyncIterator](),this.expectedTurnId=t.expectedTurnId}get token(){return this.control.token}async dispose(){await closeHookIterator(this.controlIterator),await disposeHook(this.control)}async waitForAction(){for(;;){let e=await this.nextControlOrCommand();if(e.kind===`command`){let t=await this.handleSessionCommand(e.command);if(t!==void 0)return t;continue}let t=e.payload,n=this.readTerminalControl(t);if(n!==void 0)return n;if(t.kind===`turn-delivery-request`){let e=await this.serviceDeliveryRequest(t);if(e!==void 0)return e}}}async handleSessionCommand(e){if(e.kind===`deliver`){if(!this.acceptTaskDelivery(e))return;await this.bufferDelivery(e);return}if(e.kind===`clear`||e.kind===`compact`){this.bufferedSessionControls.push(e.kind);return}if(e.kind===`session-timeout`){this.bufferedSessionControls.push(`expired`);return}if(e.kind===`cancel`){`tasks`in e&&e.tasks===!0&&await cancelAllIndexedSessionTasksStep({serializedContext:this.stateCursor.serializedContext,sessionState:this.stateCursor.sessionState}),e.taskId!==void 0&&this.discardTaskDeliveries(e.taskId);let t=e.taskId!==void 0&&e.turnId!==void 0&&e.turnId!==this.expectedTurnId?void 0:e.turnId,n={tasks:e.tasks};t!==void 0&&(n.turnId=t),await forwardTurnCancellationStep({payload:n,token:turnCancellationHookToken(this.control.token)});return}if(e.kind===`reset`){await forwardTurnCancellationStep({payload:{},token:turnCancellationHookToken(this.control.token)}),this.bufferedSessionControls.push(`reset`);return}return unsupportedSessionCommand(e)}async bufferDelivery(e){this.bufferedDeliveries.push(e),!(e.turnPolicy!==`steer`||!deliveryHasMessage(e))&&await forwardTurnCancellationStep({payload:{},token:turnCancellationHookToken(this.control.token)})}bufferTurnDeliveries(e){e.bufferedDeliveries!==void 0&&this.bufferedDeliveries.unshift(...e.bufferedDeliveries.filter(e=>!this.shouldDiscard(e)))}consumeControl(){this.pendingControl=null}getControlPromise(){return this.pendingControl??=this.controlIterator.next(),this.pendingControl}async nextControlOrCommand(){let e=await Promise.race([this.getControlPromise().then(e=>({kind:`control`,value:e})),this.commandInbox.next().then(e=>({kind:`command`,value:e}))]);if(e.kind===`command`){if(e.value.done)throw Error(`Session command inbox closed before the active turn settled.`);if(this.commandInbox.consumeNext(),e.value.value.kind===`runtime-action-result`)return await this.nextControlOrCommand();try{return{command:sessionInboxWire.decode(e.value.value),kind:`command`}}catch(e){if(!(e instanceof SessionInboxWireError))throw e;return await reportDroppedWirePayloadStep({detail:e.message,family:`session-inbox`}),await this.nextControlOrCommand()}}if(this.consumeControl(),e.value.done)throw Error(`Turn control hook closed before delivering a result.`);let t=e.value.value;if(t.kind===`turn-error`)throw rebuildSerializableError(t.error);return t.kind===`turn-continuation-token`?(await this.commandInbox.rekeyContinuation(t.continuationToken),await this.nextControlOrCommand()):{kind:`control`,payload:t}}readTerminalControl(e){if(e.kind===`turn-error`)throw rebuildSerializableError(e.error);if(e.kind===`turn-result`)return this.bufferTurnDeliveries(e),e.action}async serviceDeliveryRequest(e){await this.commandInbox.rekeyContinuation(e.continuationToken);let t=this.takeInputResponseDelivery();for(;t===void 0;){let n=await Promise.race([this.getControlPromise().then(e=>({kind:`control`,value:e})),this.commandInbox.next().then(e=>({kind:`command`,value:e}))]);if(n.kind===`control`){if(this.consumeControl(),n.value.done)throw Error(`Turn control hook closed during a delivery request.`);if(n.value.value.kind===`turn-continuation-token`){await this.commandInbox.rekeyContinuation(n.value.value.continuationToken);continue}let t=this.readTerminalControl(n.value.value);if(t!==void 0)return t;if(n.value.value.kind===`turn-delivery-cancelled`&&n.value.value.requestId===e.requestId)return;continue}if(n.value.done)throw Error(`Session command inbox closed during a turn delivery request.`);if(this.commandInbox.consumeNext(),n.value.value.kind===`runtime-action-result`)continue;let r;try{r=sessionInboxWire.decode(n.value.value)}catch(e){if(!(e instanceof SessionInboxWireError))throw e;await reportDroppedWirePayloadStep({detail:e.message,family:`session-inbox`});continue}if(r.kind===`deliver`){if(!this.acceptTaskDelivery(r))continue;deliveryHasMessage(r)?await this.bufferDelivery(r):t=r;continue}let a=await this.handleSessionCommand(r);if(a!==void 0)return a}try{await forwardTurnDeliveryStep({inboxToken:e.inboxToken,payload:{delivery:t,kind:`driver-delivery`,requestId:e.requestId}})}catch(e){if(!(e instanceof Error&&e.name===`HookNotFoundError`))throw e}return await this.awaitForwardedDelivery(e.requestId,t)}takeInputResponseDelivery(){let e=this.bufferedDeliveries.findIndex(e=>!deliveryHasMessage(e));if(e!==-1)return this.bufferedDeliveries.splice(e,1)[0]}async awaitForwardedDelivery(e,t){for(;;){let n=await this.nextControlOrCommand();if(n.kind===`command`){let e=await this.handleSessionCommand(n.command);if(e!==void 0)return this.shouldDiscard(t)||this.bufferedDeliveries.unshift(t),e;continue}let r=n.payload;if(r.kind===`turn-delivery-accepted`){if(r.requestId===e)return;continue}if(r.kind===`turn-delivery-cancelled`&&r.requestId===e){this.shouldDiscard(t)||this.bufferedDeliveries.unshift(t);return}r.kind===`turn-result`&&(this.shouldDiscard(t)||this.bufferedDeliveries.unshift(t));let i=this.readTerminalControl(r);if(i!==void 0)return i}}acceptTaskDelivery(e){let t=e.taskDeliveryId??e.caller?.taskId;return t===void 0?!0:this.originatesFromCancelledTask(t)||this.seenTaskDeliveries.has(t)?!1:(this.seenTaskDeliveries.add(t),!0)}discardTaskDeliveries(e){this.cancelledTaskIds.add(e);let t=this.bufferedDeliveries.filter(e=>!this.shouldDiscard(e));this.bufferedDeliveries.splice(0,this.bufferedDeliveries.length,...t)}originatesFromCancelledTask(e){return[...this.cancelledTaskIds].some(t=>deliveryOriginatesFromTask(e,t))}shouldDiscard(e){let t=e.taskDeliveryId??e.caller?.taskId;return t!==void 0&&this.originatesFromCancelledTask(t)}};function deliveryOriginatesFromTask(e,t){return e===t||e.startsWith(`${t}:`)}function deliveryHasMessage(e){return e.payloads.some(e=>e.message!==void 0)}function unsupportedSessionCommand(e){throw Error(`Unsupported session command: ${JSON.stringify(e)}`)}export{TurnControlReceiver};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { DeliverHookPayload, HookPayload, SessionCapabilities } from "#channel/types.js";
|
|
2
2
|
import type { DurableSessionState } from "#execution/durable-session-store.js";
|
|
3
3
|
import type { SessionCommandInbox } from "#execution/session-command-inbox.js";
|
|
4
|
+
import { SessionStateCursor } from "#execution/session-state-cursor.js";
|
|
4
5
|
import type { TurnDriverAction } from "#execution/turn-control-receiver.js";
|
|
5
6
|
import type { RunMode } from "#shared/run-mode.js";
|
|
6
7
|
/** One settled turn: its terminal driver action plus deferred hook cleanup. */
|
|
@@ -30,6 +31,7 @@ interface TurnDispatchInput {
|
|
|
30
31
|
readonly serializedContext: Record<string, unknown>;
|
|
31
32
|
readonly seenTaskDeliveries?: Set<string>;
|
|
32
33
|
readonly sessionState: DurableSessionState;
|
|
34
|
+
readonly stateCursor?: SessionStateCursor;
|
|
33
35
|
}
|
|
34
36
|
export declare function dispatchAndAwaitTurn(input: TurnDispatchInput): Promise<DispatchedTurn>;
|
|
35
37
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{activeTurnId}from"#harness/active-turn-id.js";import{dispatchTurnStep}from"#execution/dispatch-turn-step.js";import{TurnControlReceiver}from"#execution/turn-control-receiver.js";import{runInlineTurn}from"#execution/inline-turn.js";async function dispatchAndAwaitTurn(e){let
|
|
1
|
+
import{activeTurnId}from"#harness/active-turn-id.js";import{SessionStateCursor}from"#execution/session-state-cursor.js";import{dispatchTurnStep}from"#execution/dispatch-turn-step.js";import{TurnControlReceiver}from"#execution/turn-control-receiver.js";import{runInlineTurn}from"#execution/inline-turn.js";async function dispatchAndAwaitTurn(e){let n=e.stateCursor??new SessionStateCursor({serializedContext:e.serializedContext,sessionState:e.sessionState}),r=await runInlineTurn({...e,stateCursor:n});return r.kind===`result`?{action:r.action,async dispose(){}}:await dispatchAndAwaitChildTurn({...e,initialCancellation:r.initialCancellation,stateCursor:n,initialStep:r.initialStep})}async function dispatchAndAwaitChildTurn(t){let i=new TurnControlReceiver({bufferedDeliveries:t.bufferedDeliveries,bufferedSessionControls:t.bufferedSessionControls,cancelledTaskIds:t.cancelledTaskIds,commandInbox:t.commandInbox,expectedTurnId:activeTurnId(t.sessionState.emissionState),seenTaskDeliveries:t.seenTaskDeliveries??new Set,stateCursor:t.stateCursor,token:t.controlToken});try{return await dispatchTurnStep({capabilities:t.capabilities,completionToken:i.token,delivery:t.delivery,initialCancellation:t.initialCancellation,initialStep:t.initialStep,mode:t.mode,parentWritable:t.parentWritable,serializedContext:t.serializedContext,sessionState:t.sessionState}),{action:await i.waitForAction(),dispose:()=>i.dispose()}}catch(e){throw await i.dispose(),e}}export{dispatchAndAwaitTurn};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { WorkflowToolRunOutcomeMessage, WorkflowToolRunRequestMessage } from "#execution/tools/workflow/messages.js";
|
|
2
|
+
import type { TurnExecutionCursor } from "#execution/turn-execution-cursor.js";
|
|
3
|
+
import type { RuntimeActionResult } from "#shared/action-types.js";
|
|
4
|
+
interface HandlerInput<T> {
|
|
5
|
+
readonly callbackMetadataUrl: string;
|
|
6
|
+
readonly cursor: TurnExecutionCursor;
|
|
7
|
+
readonly message: T;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Settles a workflow tool run outcome against the turn's recorded runs and
|
|
11
|
+
* returns the runtime action result the turn should accept, or `undefined`
|
|
12
|
+
* when the outcome does not bind to a run this turn owns.
|
|
13
|
+
*/
|
|
14
|
+
export declare function handleWorkflowToolRunOutcome(input: HandlerInput<WorkflowToolRunOutcomeMessage>): Promise<RuntimeActionResult | undefined>;
|
|
15
|
+
export declare function handleWorkflowToolRunRequest(input: HandlerInput<WorkflowToolRunRequestMessage>): Promise<void>;
|
|
16
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{findWorkflowToolRun,isInboxSubagentResultFromRecordedWorkflowToolRun,isInboxToolResultFromRecordedWorkflowToolRun}from"#harness/workflow-tool-runs.js";import{cancelAgentInvocationOwnerStep}from"#execution/tools/subagent/task-cancel.js";import{runProxySubagentEventStep}from"#subagents/event-proxy-step.js";import{applyTaskAgentRequest}from"#execution/tools/subagent/task-agent-requests.js";import{workflowToolRunOutcomeToSubagentResult,workflowToolRunOutcomeToToolResult,workflowToolRunRequestToInputRequestPayload}from"#execution/tools/workflow/owner-inbox.js";import{resolveWorkflowCallbackBaseUrl}from"#execution/workflow-callback-url.js";import{resumeHookStep}from"#execution/tools/workflow/resume-hook-step.js";import{releaseAgentInvocationOwnerStep}from"#execution/tools/subagent/invoke-step.js";async function handleWorkflowToolRunOutcome(i){let{cursor:a,message:o}=i,s=findWorkflowToolRun(a.sessionState.snapshot?.session.state,o.from.callId);if(s?.runId!==o.from.runId)return;let c=s.resultKind===`subagent`?await settleSubagentOutcome(i):workflowToolRunOutcomeToToolResult(o);await cancelAgentInvocationOwnerStep({ownerId:o.from.runId,serializedContext:a.serializedContext,sessionState:a.sessionState});let l=await releaseAgentInvocationOwnerStep({cancelled:o.result.status===`cancelled`,ownerId:o.from.runId,sessionState:a.sessionState});await a.adopt({serializedContext:a.serializedContext,sessionState:l.sessionState});let u=a.sessionState.snapshot?.session.state;return(c.kind===`subagent-result`?c.callId===o.from.callId&&isInboxSubagentResultFromRecordedWorkflowToolRun(u,c):isInboxToolResultFromRecordedWorkflowToolRun(u,c))?c:void 0}async function settleSubagentOutcome(e){let{cursor:t,message:n}=e,r=workflowToolRunOutcomeToSubagentResult(n);return r.origin===`child`&&await t.adopt(await applyTaskAgentRequest({accumulateUsage:!1,ownerId:n.from.runId,replyTo:n.from.runId,request:{kind:`agent-settled`,result:r}},requestContext(e))),r}async function handleWorkflowToolRunRequest(t){let{cursor:n,message:r}=t;if(r.request.kind===`agent-invoke`||r.request.kind===`agent-settled`){if(findWorkflowToolRun(n.sessionState.snapshot?.session.state,r.from.callId)?.runId!==r.from.runId){r.request.kind===`agent-invoke`&&await resumeHookStep(r.replyTo,{kind:`runtime-action-result`,results:[{callId:r.request.invocationId,isError:!0,kind:`subagent-result`,origin:`dispatch`,output:{code:`AGENT_INVOCATION_NOT_ADMITTED`,message:`The workflow tool run no longer owns this agent invocation.`},subagentName:r.request.input.target}]});return}await n.adopt(await applyTaskAgentRequest({accumulateUsage:r.from.resultKind!==`subagent`,ownerId:r.from.runId,replyTo:r.replyTo,request:r.request},requestContext(t)));return}if(r.request.kind===`authorization-request`){await n.adopt(await runProxySubagentEventStep({hookPayload:r.request.event,parentWritable:n.parentWritable,serializedContext:n.serializedContext,sessionState:n.sessionState}));return}await n.adopt(await runProxySubagentEventStep({...r.requestCoordinates===void 0?{answerHook:{runId:r.from.runId}}:{},hookPayload:workflowToolRunRequestToInputRequestPayload(r),parentWritable:n.parentWritable,serializedContext:n.serializedContext,sessionState:n.sessionState}))}function requestContext(e){return{callbackBaseUrl:resolveWorkflowCallbackBaseUrl(e.callbackMetadataUrl),parentWritable:e.cursor.parentWritable,serializedContext:e.cursor.serializedContext,sessionState:e.cursor.sessionState}}export{handleWorkflowToolRunOutcome,handleWorkflowToolRunRequest};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{createHook,getWorkflowMetadata,sleep}from"#compiled/@workflow/core/index.js";import{claimHookOwnership,disposeHook,isHookConflictError}from"#execution/hook-ownership.js";import{resolveWorkflowCallbackBaseUrl}from"#execution/workflow-callback-url.js";import{isInboxToolResultFromRecordedRun}from"#harness/tool-runs.js";import{activeTurnId}from"#harness/active-turn-id.js";import{migrateTurnWorkflowInput}from"#execution/durable-session-migrations/turn-workflow.js";import{dispatchRuntimeActionsStep}from"#execution/dispatch-runtime-actions-step.js";import{dispatchTaskStep}from"#execution/tasks/parent/dispatch-task-step.js";import{turnStep}from"#execution/workflow-steps.js";import{routeDeliverToChildren}from"#execution/route-child-delivery.js";import{getRuntimeActionResultKey}from"#runtime/actions/keys.js";import{runProxySubagentEventStep}from"#execution/subagent-event-proxy-step.js";import{createChannelReader,raceChannelReads}from"#execution/tool-run/owner-channels.js";import{openRunOwnerChannels}from"#execution/tool-run/owner.js";import{runOutcomeToToolResult,runRequestToInputRequestPayload}from"#execution/tool-run/owner-inbox.js";import{acknowledgeDelegatedTasksStep}from"#execution/tasks/parent/delegate.js";import{normalizeSerializableError}from"#execution/workflow-errors.js";import{sendTurnControlStep}from"#execution/turn-control-protocol.js";import{isInboxSubagentResultFromRunningHandle}from"#harness/handles/query.js";import{preserveSerializedSessionDynamicModelSelection}from"#context/serialized-dynamic-model-selection.js";import{cancelDescendantTurnsStep}from"#execution/cancel-descendant-turns-step.js";import{dispatchWorkflowRuntimeActionsStep}from"#execution/dispatch-workflow-runtime-actions-step.js";import{emitRunReportStep}from"#execution/tool-run/emit-run-report-step.js";import{createTurnCancellationControl}from"#execution/turn-cancellation-control.js";import{TurnExecutionCursor}from"#execution/turn-execution-cursor.js";import{resolveRuntimeActionResultsForKeys}from"#runtime/actions/results.js";const TASK_MODE_WAIT_ERROR_MESSAGE="Task mode cannot wait for follow-up input (`next: null`).";async function turnWorkflow(e){"use workflow";let t=migrateTurnWorkflowInput(e);return t.driverCapabilities?.turnInbox===!0?runTurnOwnedWorkflow(t):runLegacyTurnWorkflow(t)}async function runTurnOwnedWorkflow(n){let s=createHook({token:`${n.completionToken}:inbox`}),l=createChannelReader(`inbox`,s),d=n.initialStep,f=new TurnExecutionCursor({controlToken:n.completionToken,parentWritable:n.stepInput.parentWritable,serializedContext:d?.beforeStep.serializedContext??n.stepInput.serializedContext,sessionState:d?.beforeStep.sessionState??n.stepInput.sessionState}),p=0,nextDeliveryRequestId=()=>`${s.token}:delivery:${String(p++)}`,m=[],h=n.stepInput.input,g=!1,_,v;try{try{await claimHookOwnership(s),g=!0}catch(e){if(isHookConflictError(e))return;throw e}for(n.driverCapabilities?.cancelledTurnSettle===!0&&(v=await createTurnCancellationControl({controlToken:n.completionToken,expectedTurnId:activeTurnId(f.sessionState.emissionState),initialPayload:n.initialCancellation}));;){let e=d?.beforeStep??{serializedContext:f.serializedContext,sessionState:f.sessionState},r=d?.result??await turnStep(f.createStepInput(h,v?.signal));d=void 0;let i=r.action===`dispatch-workflow-runtime-actions`||r.action===`park`?r.pendingRuntimeActionKeys:void 0,a=(r.backgroundTasks?.length??0)>0;if(a){if(r.backgroundTaskState===void 0)throw Error(`Background tasks were returned without their committed session state.`);await f.adopt({serializedContext:e.serializedContext,sessionState:r.backgroundTaskState}),await acknowledgeDelegatedTasksStep({tasks:r.backgroundTasks??[]})}if(r.action===`cancelled`){await f.adopt({serializedContext:r.serializedContext,sessionState:r.backgroundTaskState??r.sessionState}),await finishCancelledTurn({bufferedDeliveries:m,cancellation:v,cursor:f});return}if(v?.signal.aborted===!0&&(i===void 0||a)){await f.adopt({serializedContext:preserveSerializedSessionDynamicModelSelection(e.serializedContext,r.serializedContext),sessionState:f.sessionState}),await finishCancelledTurn({bufferedDeliveries:m,cancellation:v,cursor:f});return}if(r.sleepDurationMs!==void 0&&await waitForTurnSleep(r.sleepDurationMs,v)===`cancel`){await finishCancelledTurn({bufferedDeliveries:m,cancellation:v,cursor:f});return}if(r.action===`done`){await v?.dispose(),await f.finish(r,{kind:`done`,output:r.output??``,isError:r.isError,usage:r.usage,usageDelta:r.usageDelta},m);return}if(i!==void 0){await f.adopt(r),r.action===`park`&&r.startsWorkflowToolRuns===!0&&(_??=openRunOwnerChannels(s.token));let e=r.action===`park`&&r.tasksEnabled,n;n=r.action===`dispatch-workflow-runtime-actions`?dispatchWorkflowRuntimeActionsStep:e?dispatchTaskStep:dispatchRuntimeActionsStep;let a=await n({callbackBaseUrl:resolveWorkflowCallbackBaseUrl(getWorkflowMetadata().url),parentContinuationToken:s.token,parentWritable:f.parentWritable,serializedContext:f.serializedContext,sessionState:f.sessionState}),c=a.results.length===0?void 0:Date.now();await f.adopt(a),await acknowledgeDelegatedTasksStep({tasks:a.pendingTasks});let u=await waitForRuntimeActionResults({bufferedDeliveries:m,cancellation:v,cursor:f,inboxToken:s.token,initialAcceptedAtMs:c,initialResults:a.results,nextDeliveryRequestId,readers:_===void 0?[l]:[..._.readers,l],pendingActionKeys:i});if(u===`cancelled`){h=void 0;continue}if(u===`cancel-turn`){await finishCancelledTurn({bufferedDeliveries:m,cancellation:v,cursor:f});return}h={kind:`runtime-action-result`,...u};continue}if(r.action===`park`){if(!(r.hasPendingAuthorization||r.hasPendingInputBatch&&n.capabilities?.requestInput===!0||n.mode===`conversation`))throw Error(TASK_MODE_WAIT_ERROR_MESSAGE);await v?.dispose(),await f.finish(r,{authorizationAttemptIds:r.authorizationAttemptIds,authorizationNames:r.authorizationNames,kind:`park`,settled:r.settled},m);return}await f.adopt(r),h=void 0}}catch(e){throw await f.send({error:normalizeSerializableError(e),kind:`turn-error`}),e}finally{v!==void 0&&await v.dispose(),_!==void 0&&await _.dispose(),g&&await disposeHook(s)}}async function finishCancelledTurn(e){await cancelDescendantTurnsStep({serializedContext:e.cursor.serializedContext,sessionState:e.cursor.sessionState}),await e.cancellation?.dispose(),await e.cursor.finish({sessionState:e.cursor.sessionState},{cancelled:!0,kind:`park`},e.bufferedDeliveries)}async function waitForTurnSleep(e,t){if(t?.signal.aborted===!0)return`cancel`;let r=sleep(e).then(()=>`slept`);return t===void 0?r:Promise.race([r,t.requested])}async function waitForRuntimeActionResults(e){let t,n=[...e.initialResults],r=new Map;if(e.initialAcceptedAtMs!==void 0)for(let t of e.initialResults)r.set(getRuntimeActionResultKey(t),e.initialAcceptedAtMs);for(;;){let i=resolveRuntimeActionResultsForKeys({pendingKeys:e.pendingActionKeys,results:n});if(i!==void 0)return t!==void 0&&await e.cursor.send({kind:`turn-delivery-cancelled`,requestId:t}),{acceptedAtMsByCallId:Object.fromEntries(i.map(e=>[e.callId,r.get(getRuntimeActionResultKey(e))])),results:i};e.cursor.sessionState.hasProxyInputRequests&&t===void 0&&(t=e.nextDeliveryRequestId(),await e.cursor.send({continuationToken:e.cursor.sessionState.continuationToken,inboxToken:e.inboxToken,kind:`turn-delivery-request`,requestId:t}));let a=await raceChannelReads(e.readers,e.cancellation?.requested);if(a===`cancel`)return t!==void 0&&await e.cursor.send({kind:`turn-delivery-cancelled`,requestId:t}),`cancelled`;if(a.next.done)throw Error(`Turn inbox closed before runtime actions completed.`);if(a.channel===`outcome`){let t=runOutcomeToToolResult(a.next.value),i=e.cursor.sessionState.snapshot?.session.state;if(isInboxToolResultFromRecordedRun(i,t)){let e=Date.now();n.push(t),r.set(getRuntimeActionResultKey(t),e)}continue}if(a.channel===`request`){let t=await runProxySubagentEventStep({answerHook:{runId:a.next.value.from.runId},hookPayload:runRequestToInputRequestPayload(a.next.value),parentWritable:e.cursor.parentWritable,serializedContext:e.cursor.serializedContext,sessionState:e.cursor.sessionState});await e.cursor.adopt(t);continue}if(a.channel===`report`){await emitRunReportStep({from:a.next.value.from,parentWritable:e.cursor.parentWritable,update:a.next.value.update});continue}let o=a.next.value;if(o.kind===`runtime-action-result`){let t=e.cursor.sessionState.snapshot?.session.state,i=o.results.filter(e=>e.kind===`tool-result`?isInboxToolResultFromRecordedRun(t,e):isInboxSubagentResultFromRunningHandle(t,e));if(i.length>0){let e=Date.now();n.push(...i);for(let t of i)r.set(getRuntimeActionResultKey(t),e)}continue}if(o.kind===`subagent-input-request`||o.kind===`subagent-authorization-event`){let t=await runProxySubagentEventStep({hookPayload:o,parentWritable:e.cursor.parentWritable,serializedContext:e.cursor.serializedContext,sessionState:e.cursor.sessionState});await e.cursor.adopt(t);continue}if(o.kind===`driver-delivery`&&o.requestId===t){await e.cursor.send({kind:`turn-delivery-accepted`,requestId:o.requestId}),t=void 0;let n=await routeDeliverToChildren({delivery:o.delivery,parentWritable:e.cursor.parentWritable,serializedContext:e.cursor.serializedContext,sessionState:e.cursor.sessionState});if(await e.cursor.adopt({serializedContext:n.serializedContext??e.cursor.serializedContext,sessionState:n.sessionState??e.cursor.sessionState}),n.kind===`cancel-turn`)return n.kind;n.remainder!==void 0&&e.bufferedDeliveries.push(n.remainder)}}}async function runLegacyTurnWorkflow(e){let t=e.stepInput;try{for(;;){let r=await turnStep(t);if(r.action!==`cancelled`&&r.sleepDurationMs!==void 0&&await sleep(r.sleepDurationMs),r.action===`done`){await sendTurnControlStep({controlToken:e.completionToken,payload:{action:{kind:`done`,output:r.output??``,isError:r.isError,serializedContext:r.serializedContext,sessionState:r.sessionState,usage:r.usage,usageDelta:r.usageDelta},kind:`turn-result`}});return}if(r.action===`dispatch-workflow-runtime-actions`){await sendTurnControlStep({controlToken:e.completionToken,payload:{action:{kind:`dispatch-workflow-runtime-actions`,pendingActionKeys:r.pendingRuntimeActionKeys,serializedContext:r.serializedContext,sessionState:r.sessionState},kind:`turn-result`}});return}if(r.action===`park`){let t=r.pendingRuntimeActionKeys;if(!(t!==void 0||r.hasPendingAuthorization||r.hasPendingInputBatch&&e.capabilities?.requestInput===!0||e.mode===`conversation`))throw Error(TASK_MODE_WAIT_ERROR_MESSAGE);let n=t===void 0?{kind:`park`,serializedContext:r.serializedContext,sessionState:r.sessionState,authorizationAttemptIds:r.authorizationAttemptIds,authorizationNames:r.authorizationNames,settled:r.settled}:{kind:`dispatch-runtime-actions`,pendingActionKeys:t,serializedContext:r.serializedContext,sessionState:r.sessionState};await sendTurnControlStep({controlToken:e.completionToken,payload:{action:n,kind:`turn-result`}});return}t={input:void 0,parentWritable:t.parentWritable,serializedContext:r.serializedContext,sessionState:r.sessionState}}}catch(t){throw await sendTurnControlStep({controlToken:e.completionToken,payload:{error:normalizeSerializableError(t),kind:`turn-error`}}),t}}export{turnWorkflow};
|
|
1
|
+
import{createHook,getWorkflowMetadata}from"#compiled/@workflow/core/index.js";import{claimHookOwnership,disposeHook,isHookConflictError}from"#execution/hook-ownership.js";import{isInboxSubagentResultFromRecordedWorkflowToolRun,isInboxToolResultFromRecordedWorkflowToolRun}from"#harness/workflow-tool-runs.js";import{activeTurnId}from"#harness/active-turn-id.js";import{migrateTurnWorkflowInput}from"#execution/durable-session-migrations/turn-workflow.js";import{cancelAllIndexedSessionTasksStep}from"#execution/cancel-indexed-session-tasks-step.js";import{turnStep}from"#execution/workflow-steps.js";import{routeDeliverToChildren}from"#execution/route-child-delivery.js";import{runProxySubagentEventStep}from"#subagents/event-proxy-step.js";import{createChannelReader,raceChannelReads}from"#execution/tools/workflow/owner-channels.js";import{openWorkflowToolRunOwnerChannels}from"#execution/tools/workflow/owner.js";import{resolveWorkflowCallbackBaseUrl}from"#execution/workflow-callback-url.js";import{acknowledgeDelegatedTasksStep}from"#execution/tasks/parent/delegate.js";import{normalizeSerializableError}from"#execution/workflow-errors.js";import{sendTurnControlStep}from"#execution/turn-control-protocol.js";import{findRunningAgentHandle,isInboxSubagentResultFromRunningHandle}from"#subagents/handles/query.js";import{preserveSerializedSessionDynamicModelSelection}from"#context/serialized-dynamic-model-selection.js";import{cancelDescendantTurnsStep}from"#execution/cancel-descendant-turns-step.js";import{dispatchCoordinationStep}from"#execution/coordination-dispatch-step.js";import{emitWorkflowToolRunReportStep}from"#execution/tools/workflow/emit-workflow-tool-run-report-step.js";import{createTurnCancellationControl}from"#execution/turn-cancellation-control.js";import{TurnExecutionCursor}from"#execution/turn-execution-cursor.js";import{resolveRuntimeActionResultsForCallIds}from"#runtime/actions/results.js";import{handleWorkflowToolRunOutcome,handleWorkflowToolRunRequest}from"#execution/turn-workflow-tool-run.js";const TASK_MODE_WAIT_ERROR_MESSAGE="Task mode cannot wait for follow-up input (`next: null`).";async function turnWorkflow(e){"use workflow";let t=migrateTurnWorkflowInput(e);return t.driverCapabilities?.turnInbox===!0?runTurnOwnedWorkflow(t):runLegacyTurnWorkflow(t)}async function runTurnOwnedWorkflow(a){let o=createHook({token:`${a.completionToken}:inbox`}),c=createChannelReader(`inbox`,o),l=a.initialStep,u=new TurnExecutionCursor({controlToken:a.completionToken,parentWritable:a.stepInput.parentWritable,serializedContext:l?.beforeStep.serializedContext??a.stepInput.serializedContext,sessionState:l?.beforeStep.sessionState??a.stepInput.sessionState}),d=0,nextDeliveryRequestId=()=>`${o.token}:delivery:${String(d++)}`,f=[],p=a.stepInput.input,m=!1,h,g;try{try{await claimHookOwnership(o),m=!0}catch(e){if(isHookConflictError(e))return;throw e}h=openWorkflowToolRunOwnerChannels(o.token);let e=[...h.readers,c];for(a.driverCapabilities?.cancelledTurnSettle===!0&&(g=await createTurnCancellationControl({controlToken:a.completionToken,expectedTurnId:activeTurnId(u.sessionState.emissionState),initialPayload:a.initialCancellation}));;){let n=l?.beforeStep??{serializedContext:u.serializedContext,sessionState:u.sessionState},r=l?.result??await turnStep(u.createStepInput(p,g?.signal));l=void 0;let i=r.action===`dispatch-workflow-tasks`?r.pendingTaskCallIds:r.action===`park`?r.pendingCoordinationCallIds:void 0,s=(r.backgroundTasks?.length??0)>0;if(s){if(r.backgroundTaskState===void 0)throw Error(`Background tasks were returned without their committed session state.`);await u.adopt({serializedContext:n.serializedContext,sessionState:r.backgroundTaskState}),await acknowledgeDelegatedTasksStep({tasks:r.backgroundTasks??[]})}if(r.action===`cancelled`){await u.adopt({serializedContext:r.serializedContext,sessionState:r.backgroundTaskState??r.sessionState}),await finishCancelledTurn({bufferedDeliveries:f,cancellation:g,cursor:u});return}if(g?.signal.aborted===!0&&(i===void 0||s)){await u.adopt({serializedContext:preserveSerializedSessionDynamicModelSelection(n.serializedContext,r.serializedContext),sessionState:u.sessionState}),await finishCancelledTurn({bufferedDeliveries:f,cancellation:g,cursor:u});return}if(r.action===`done`){await g?.dispose(),await u.finish(r,{kind:`done`,output:r.output??``,isError:r.isError,usage:r.usage,usageDelta:r.usageDelta},f);return}if(i!==void 0&&(r.action===`park`||r.action===`dispatch-workflow-tasks`)){await u.adopt(r);let n=await dispatchCoordinationStep({action:r.action,callbackBaseUrl:resolveWorkflowCallbackBaseUrl(getWorkflowMetadata().url),parentContinuationToken:o.token,parentWritable:u.parentWritable,serializedContext:u.serializedContext,sessionState:u.sessionState}),a=n.results.length===0?void 0:Date.now();await u.adopt(n),await acknowledgeDelegatedTasksStep({tasks:n.pendingTasks});let s=await waitForRuntimeActionResults({bufferedDeliveries:f,cancellation:g,cursor:u,inboxToken:o.token,initialAcceptedAtMs:a,initialResults:n.results,nextDeliveryRequestId,readers:e,pendingCallIds:i});if(s===`cancelled`){p=void 0;continue}if(s===`cancel-turn`){await finishCancelledTurn({bufferedDeliveries:f,cancellation:g,cursor:u});return}p={kind:`runtime-action-result`,...s};continue}if(r.action===`park`){if(!(r.hasPendingAuthorization||r.hasPendingInputBatch&&a.capabilities?.requestInput===!0||a.mode===`conversation`))throw Error(TASK_MODE_WAIT_ERROR_MESSAGE);await g?.dispose(),await u.finish(r,{authorizationAttemptIds:r.authorizationAttemptIds,authorizationNames:r.authorizationNames,kind:`park`,settled:r.settled},f);return}await u.adopt(r),p=void 0}}catch(e){throw await u.send({error:normalizeSerializableError(e),kind:`turn-error`}),e}finally{g!==void 0&&await g.dispose(),h!==void 0&&await h.dispose(),m&&await disposeHook(o)}}async function finishCancelledTurn(e){(e.cancellation?.signal.aborted===!0?await e.cancellation.payload:void 0)?.tasks===!0&&await cancelAllIndexedSessionTasksStep({serializedContext:e.cursor.serializedContext,sessionState:e.cursor.sessionState}),await cancelDescendantTurnsStep({serializedContext:e.cursor.serializedContext,sessionState:e.cursor.sessionState}),await e.cancellation?.dispose(),await e.cursor.finish({sessionState:e.cursor.sessionState},{cancelled:!0,kind:`park`},e.bufferedDeliveries)}async function waitForRuntimeActionResults(e){let n,r=[...e.initialResults],i=new Map;if(e.initialAcceptedAtMs!==void 0)for(let t of e.initialResults)i.set(t.callId,e.initialAcceptedAtMs);for(;;){let s=resolveRuntimeActionResultsForCallIds({pendingCallIds:e.pendingCallIds,results:r});if(s!==void 0)return n!==void 0&&await e.cursor.send({kind:`turn-delivery-cancelled`,requestId:n}),{acceptedAtMsByCallId:Object.fromEntries(s.map(e=>[e.callId,i.get(e.callId)])),results:s};e.cursor.sessionState.hasProxyInputRequests&&n===void 0&&(n=e.nextDeliveryRequestId(),await e.cursor.send({continuationToken:e.cursor.sessionState.continuationToken,inboxToken:e.inboxToken,kind:`turn-delivery-request`,requestId:n}));let c=await raceChannelReads(e.readers,e.cancellation?.requested);if(c===`cancel`)return n!==void 0&&await e.cursor.send({kind:`turn-delivery-cancelled`,requestId:n}),`cancelled`;if(c.next.done)throw Error(`Turn inbox closed before runtime actions completed.`);if(c.channel===`outcome`){let n=await handleWorkflowToolRunOutcome({callbackMetadataUrl:getWorkflowMetadata().url,cursor:e.cursor,message:c.next.value});n!==void 0&&(r.push(n),i.set(n.callId,Date.now()));continue}if(c.channel===`request`){await handleWorkflowToolRunRequest({callbackMetadataUrl:getWorkflowMetadata().url,cursor:e.cursor,message:c.next.value});continue}if(c.channel===`report`){await emitWorkflowToolRunReportStep({from:c.next.value.from,parentWritable:e.cursor.parentWritable,update:c.next.value.update});continue}let l=c.next.value;if(l.kind===`runtime-action-result`){let t=e.cursor.sessionState.snapshot?.session.state,n=l.results.filter(e=>e.kind===`tool-result`?isInboxToolResultFromRecordedWorkflowToolRun(t,e):e.origin===`child`&&isInboxSubagentResultFromRunningHandle(t,e)||isInboxSubagentResultFromRecordedWorkflowToolRun(t,e));if(n.length>0){let e=Date.now();r.push(...n);for(let t of n)i.set(t.callId,e)}continue}if(l.kind===`subagent-input-request`||l.kind===`subagent-authorization-event`){let t=findRunningAgentHandle(e.cursor.sessionState.snapshot?.session.state,{callId:l.callId});if(t?.identity.name!==l.subagentName||t.address.sessionId!==l.childSessionId)continue;let n=await runProxySubagentEventStep({hookPayload:l,parentWritable:e.cursor.parentWritable,serializedContext:e.cursor.serializedContext,sessionState:e.cursor.sessionState});await e.cursor.adopt(n);continue}if(l.kind===`driver-delivery`&&l.requestId===n){await e.cursor.send({kind:`turn-delivery-accepted`,requestId:l.requestId}),n=void 0;let t=await routeDeliverToChildren({delivery:l.delivery,parentWritable:e.cursor.parentWritable,serializedContext:e.cursor.serializedContext,sessionState:e.cursor.sessionState});if(await e.cursor.adopt({serializedContext:t.serializedContext??e.cursor.serializedContext,sessionState:t.sessionState??e.cursor.sessionState}),t.kind===`cancel-turn`)return t.kind;t.remainder!==void 0&&e.bufferedDeliveries.push(t.remainder)}}}async function runLegacyTurnWorkflow(e){let t=e.stepInput;try{for(;;){let n=await turnStep(t);if(n.action===`done`){await sendTurnControlStep({controlToken:e.completionToken,payload:{action:{kind:`done`,output:n.output??``,isError:n.isError,serializedContext:n.serializedContext,sessionState:n.sessionState,usage:n.usage,usageDelta:n.usageDelta},kind:`turn-result`}});return}if(n.action===`dispatch-workflow-tasks`){await sendTurnControlStep({controlToken:e.completionToken,payload:{action:{kind:`dispatch-workflow-tasks`,pendingCallIds:n.pendingTaskCallIds,serializedContext:n.serializedContext,sessionState:n.sessionState},kind:`turn-result`}});return}if(n.action===`park`){let t=n.pendingCoordinationCallIds;if(!(t!==void 0||n.hasPendingAuthorization||n.hasPendingInputBatch&&e.capabilities?.requestInput===!0||e.mode===`conversation`))throw Error(TASK_MODE_WAIT_ERROR_MESSAGE);let r=t===void 0?{kind:`park`,serializedContext:n.serializedContext,sessionState:n.sessionState,authorizationAttemptIds:n.authorizationAttemptIds,authorizationNames:n.authorizationNames,settled:n.settled}:{kind:`dispatch-coordination`,pendingCallIds:t,serializedContext:n.serializedContext,sessionState:n.sessionState};await sendTurnControlStep({controlToken:e.completionToken,payload:{action:r,kind:`turn-result`}});return}t={input:void 0,parentWritable:t.parentWritable,serializedContext:n.serializedContext,sessionState:n.sessionState}}}catch(t){throw await sendTurnControlStep({controlToken:e.completionToken,payload:{error:normalizeSerializableError(t),kind:`turn-error`}}),t}}turnWorkflow.workflowId=`workflow//eve//turnWorkflow`;export{turnWorkflow};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/** Every explicit session-inbox wire version still supported by producers. */
|
|
2
|
-
export declare const SESSION_INBOX_WIRE_VERSIONS: readonly [1, 2, 3];
|
|
2
|
+
export declare const SESSION_INBOX_WIRE_VERSIONS: readonly [1, 2, 3, 4, 5, 6];
|
|
3
3
|
export type SessionInboxWireVersion = (typeof SESSION_INBOX_WIRE_VERSIONS)[number];
|
|
4
4
|
/** Current persisted session-inbox wire version. */
|
|
5
|
-
export declare const SESSION_INBOX_WIRE_VERSION: 1 | 2 | 3;
|
|
5
|
+
export declare const SESSION_INBOX_WIRE_VERSION: 1 | 2 | 3 | 4 | 5 | 6;
|
|
6
6
|
/** Hook metadata field advertising the consumer's inbox wire capability. */
|
|
7
7
|
export declare const SESSION_INBOX_WIRE_VERSION_METADATA_KEY = "sessionInboxWireVersion";
|
|
8
8
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const SESSION_INBOX_WIRE_VERSIONS=[1,2,3],SESSION_INBOX_WIRE_VERSION=SESSION_INBOX_WIRE_VERSIONS[SESSION_INBOX_WIRE_VERSIONS.length-1],SESSION_INBOX_WIRE_VERSION_METADATA_KEY=`sessionInboxWireVersion`;function isSessionInboxWireVersion(t){return SESSION_INBOX_WIRE_VERSIONS.some(e=>e===t)}var SessionInboxWireError=class extends Error{constructor(e){super(e),this.name=`SessionInboxWireError`}};export{SESSION_INBOX_WIRE_VERSION,SESSION_INBOX_WIRE_VERSIONS,SESSION_INBOX_WIRE_VERSION_METADATA_KEY,SessionInboxWireError,isSessionInboxWireVersion};
|
|
1
|
+
const SESSION_INBOX_WIRE_VERSIONS=[1,2,3,4,5,6],SESSION_INBOX_WIRE_VERSION=SESSION_INBOX_WIRE_VERSIONS[SESSION_INBOX_WIRE_VERSIONS.length-1],SESSION_INBOX_WIRE_VERSION_METADATA_KEY=`sessionInboxWireVersion`;function isSessionInboxWireVersion(t){return SESSION_INBOX_WIRE_VERSIONS.some(e=>e===t)}var SessionInboxWireError=class extends Error{constructor(e){super(e),this.name=`SessionInboxWireError`}};export{SESSION_INBOX_WIRE_VERSION,SESSION_INBOX_WIRE_VERSIONS,SESSION_INBOX_WIRE_VERSION_METADATA_KEY,SessionInboxWireError,isSessionInboxWireVersion};
|
|
@@ -3,9 +3,12 @@ import { type SessionInboxWireV1 } from "#execution/wire/session-inbox-wire.v1.j
|
|
|
3
3
|
import { type SessionInboxWireV2 } from "#execution/wire/session-inbox-wire.v2.js";
|
|
4
4
|
import { type SessionInboxWireV3 } from "#execution/wire/session-inbox-wire.v3.js";
|
|
5
5
|
import { type SessionInboxWireTarget, type SessionInboxWireVersion } from "#execution/wire/session-inbox-contract.js";
|
|
6
|
+
import { type SessionInboxWireV4 } from "#execution/wire/session-inbox-wire.v4.js";
|
|
7
|
+
import { type SessionInboxWireV5 } from "#execution/wire/session-inbox-wire.v5.js";
|
|
8
|
+
import { type SessionInboxWireV6 } from "#execution/wire/session-inbox-wire.v6.js";
|
|
6
9
|
type SessionInboxCommand = DeliverHookPayload | SessionCommand | SessionTimeoutHookPayload;
|
|
7
10
|
/** Current wire type consumed after migration. */
|
|
8
|
-
export type SessionInboxWire =
|
|
11
|
+
export type SessionInboxWire = SessionInboxWireV6;
|
|
9
12
|
type LegacySessionInboxWireTarget = Extract<SessionInboxWireTarget, {
|
|
10
13
|
readonly version: 0;
|
|
11
14
|
}>;
|
|
@@ -19,11 +22,20 @@ declare function encode(command: SessionInboxCommand, target: {
|
|
|
19
22
|
declare function encode(command: SessionInboxCommand, target: {
|
|
20
23
|
readonly version: 3;
|
|
21
24
|
}): SessionInboxWireV3;
|
|
25
|
+
declare function encode(command: SessionInboxCommand, target: {
|
|
26
|
+
readonly version: 4;
|
|
27
|
+
}): SessionInboxWireV4;
|
|
28
|
+
declare function encode(command: SessionInboxCommand, target: {
|
|
29
|
+
readonly version: 5;
|
|
30
|
+
}): SessionInboxWireV5;
|
|
31
|
+
declare function encode(command: SessionInboxCommand, target: {
|
|
32
|
+
readonly version: 6;
|
|
33
|
+
}): SessionInboxWireV6;
|
|
22
34
|
declare function encode(command: SessionInboxCommand, target: {
|
|
23
35
|
readonly version: SessionInboxWireVersion;
|
|
24
36
|
}): unknown;
|
|
25
37
|
declare function encode(command: SessionInboxCommand, target: LegacySessionInboxWireTarget): Record<string, unknown>;
|
|
26
|
-
declare function encode(command: SessionInboxCommand, target: SessionInboxWireTarget): SessionInboxWireV1 | SessionInboxWireV2 | SessionInboxWireV3 | Record<string, unknown>;
|
|
38
|
+
declare function encode(command: SessionInboxCommand, target: SessionInboxWireTarget): SessionInboxWireV1 | SessionInboxWireV2 | SessionInboxWireV3 | SessionInboxWireV4 | SessionInboxWireV5 | SessionInboxWireV6 | Record<string, unknown>;
|
|
27
39
|
/** Server/step-safe producer facade. */
|
|
28
40
|
export declare const sessionInboxWire: {
|
|
29
41
|
readonly encode: typeof encode;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{SessionInboxWireError,isSessionInboxWireVersion}from"#execution/wire/session-inbox-contract.js";import{encodeSessionCommandV1}from"#execution/wire/session-inbox-wire.v1.js";import{encodeSessionCommandV2}from"#execution/wire/session-inbox-wire.v2.js";import{encodeSessionCommandV3}from"#execution/wire/session-inbox-wire.v3.js";import{encodeSessionCommandV0}from"#execution/wire/session-inbox-wire.v0.js";const versionedEncoders={1:e=>encodeSessionCommandV1(withoutAcceptedDeployment(e)),2:e=>encodeSessionCommandV2(withoutAcceptedDeployment(e)),3:encodeSessionCommandV3};function encode(r,i){if(i.version===0){let e=encodeSessionCommandV0(encodeSessionCommandV1(withoutAcceptedDeployment(r)),i.variant)
|
|
1
|
+
import{SessionInboxWireError,isSessionInboxWireVersion}from"#execution/wire/session-inbox-contract.js";import{encodeSessionCommandV1}from"#execution/wire/session-inbox-wire.v1.js";import{encodeSessionCommandV2}from"#execution/wire/session-inbox-wire.v2.js";import{encodeSessionCommandV3}from"#execution/wire/session-inbox-wire.v3.js";import{encodeSessionCommandV0}from"#execution/wire/session-inbox-wire.v0.js";import{encodeSessionCommandV4}from"#execution/wire/session-inbox-wire.v4.js";import{encodeSessionCommandV5}from"#execution/wire/session-inbox-wire.v5.js";import{encodeSessionCommandV6}from"#execution/wire/session-inbox-wire.v6.js";const versionedEncoders={1:e=>encodeSessionCommandV1(withoutAcceptedDeployment(withoutOwnedTaskCancellation(e))),2:e=>encodeSessionCommandV2(withoutAcceptedDeployment(withoutOwnedTaskCancellation(e))),3:e=>encodeSessionCommandV3(withoutOwnedTaskCancellation(e)),4:e=>encodeSessionCommandV4(withoutOwnedTaskCancellation(e)),5:e=>encodeSessionCommandV5(withoutOwnedTaskCancellation(e)),6:encodeSessionCommandV6};function encode(r,i){if(r.kind===`cancel`&&r.tasks===!0&&i.version<6)throw new SessionInboxWireError(`Cannot encode session-owned task cancellation for wire version ${i.version}.`);if(i.version===0){let e=i.variant===`send`&&r.kind===`send`&&r.payload.task!==void 0?encodeSessionCommandV5(r):void 0,t=encodeSessionCommandV0(encodeSessionCommandV1(withoutCurrentTaskMessages(withoutAcceptedDeployment(withoutOwnedTaskCancellation(r)))),i.variant);e?.kind===`deliver`&&(t={...t,payload:e.payload});let a=t,o=a.delivery,s=readAcceptedDeploymentId(r);return i.variant!==`send`||s===void 0||a.kind!==`send`||typeof o!=`object`||!o?t:{...t,delivery:{...o,acceptedDeploymentId:s}}}if(isSessionInboxWireVersion(i.version))return versionedEncoders[i.version](r);throw new SessionInboxWireError(`Cannot encode session inbox payload for unknown wire version ${JSON.stringify(i.version)}.`)}function withoutOwnedTaskCancellation(e){if(e.kind!==`cancel`||e.tasks===void 0)return e;let{tasks:t,...n}=e;return n}function withoutCurrentTaskMessages(e){if(e.kind!==`send`||e.payload.task===void 0)return e;let{agentRequests:t,inputRequests:n,...r}=e.payload.task;return{...e,payload:{...e.payload,task:r}}}function withoutAcceptedDeployment(e){if(e.kind===`send`&&e.delivery?.acceptedDeploymentId!==void 0){let{acceptedDeploymentId:t,...n}=e.delivery;return{...e,delivery:n}}return e.kind!==`deliver`||e.deliveryMetadata===void 0?e:{...e,deliveryMetadata:e.deliveryMetadata.map(e=>{let{acceptedDeploymentId:t,...n}=e;return n})}}function readAcceptedDeploymentId(e){if(e.kind===`send`)return e.delivery?.acceptedDeploymentId;if(e.kind===`deliver`)return e.deliveryMetadata?.find(e=>e.payloadIndex===0)?.acceptedDeploymentId}const sessionInboxWire={encode};export{sessionInboxWire};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{isSessionCommandHookToken,sessionCommandHookToken}from"#execution/session-command-token.js";import{isObject}from"#shared/guards.js";import{getHookByToken,resumeHook}from"#internal/workflow/runtime.js";import{HookNotFoundError}from"#compiled/@workflow/errors/index.js";import{SESSION_INBOX_WIRE_VERSION_METADATA_KEY,SessionInboxWireError,isSessionInboxWireVersion}from"#execution/wire/session-inbox-contract.js";import{sessionInboxWire}from"#execution/wire/session-inbox-encoder.js";async function resumeSessionInbox(e,t){if(isStableInboxFastPathCompatible(e,t))return await resumeHook(e,sessionInboxWire.encode(t,{variant:`send`,version:0}));let n=await getHookByToken(e),i=await resolveSessionInboxWireTarget(n);return await resumeHook(n,sessionInboxWire.encode(t,i))}function isStableInboxFastPathCompatible(t,n){return
|
|
1
|
+
import{isSessionCommandHookToken,sessionCommandHookToken}from"#execution/session-command-token.js";import{isObject}from"#shared/guards.js";import{getHookByToken,resumeHook}from"#internal/workflow/runtime.js";import{HookNotFoundError}from"#compiled/@workflow/errors/index.js";import{SESSION_INBOX_WIRE_VERSION_METADATA_KEY,SessionInboxWireError,isSessionInboxWireVersion}from"#execution/wire/session-inbox-contract.js";import{sessionInboxWire}from"#execution/wire/session-inbox-encoder.js";async function resumeSessionInbox(e,t){if(isStableInboxFastPathCompatible(e,t))return await resumeHook(e,sessionInboxWire.encode(t,{variant:`send`,version:0}));let n=await getHookByToken(e),i=await resolveSessionInboxWireTarget(n);return await resumeHook(n,sessionInboxWire.encode(t,i))}function isStableInboxFastPathCompatible(t,n){return!isSessionCommandHookToken(t)||n.kind===`cancel`&&n.tasks===!0?!1:!(`caller`in n&&n.caller?.activityObserver!==void 0)}async function resolveSessionInboxWireTarget(e){let r=isObject(e.metadata)?e.metadata:void 0;if(r!==void 0&&SESSION_INBOX_WIRE_VERSION_METADATA_KEY in r){let e=r[SESSION_INBOX_WIRE_VERSION_METADATA_KEY];if(isSessionInboxWireVersion(e))return{version:e};throw new SessionInboxWireError(`Session inbox target declares unsupported wire version ${JSON.stringify(e)}.`)}let a=sessionCommandHookToken(e.runId);if(e.token===a)return{variant:`send`,version:0};try{let t=await getHookByToken(a);if(t.runId!==e.runId)throw new SessionInboxWireError(`Stable session inbox ${JSON.stringify(a)} belongs to run ${JSON.stringify(t.runId)}, expected ${JSON.stringify(e.runId)}.`);return{variant:`send`,version:0}}catch(e){if(HookNotFoundError.is(e))return{variant:`deliver`,version:0};throw e}}export{resolveSessionInboxWireTarget,resumeSessionInbox};
|
|
@@ -18,9 +18,9 @@ export { SessionInboxWireError } from "#execution/wire/session-inbox-contract.js
|
|
|
18
18
|
/**
|
|
19
19
|
* Decodes a persisted inbox payload or throws {@link SessionInboxWireError}.
|
|
20
20
|
*
|
|
21
|
-
* Unknown newer versions and shape mismatches both throw: a
|
|
22
|
-
* with an operator-visible signal is the designed failure; a
|
|
23
|
-
* delivery is the bug this module exists to prevent.
|
|
21
|
+
* Unknown newer versions and migration-bound shape mismatches both throw: a
|
|
22
|
+
* lost delivery with an operator-visible signal is the designed failure; a
|
|
23
|
+
* reinterpreted delivery is the bug this module exists to prevent.
|
|
24
24
|
*/
|
|
25
25
|
declare function decode(value: unknown): DecodedSessionInbox;
|
|
26
26
|
/** Workflow-safe consumer facade. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{SESSION_INBOX_WIRE_VERSION,SessionInboxWireError,SessionInboxWireError as SessionInboxWireError$1}from"#execution/wire/session-inbox-contract.js";import{sessionInboxWireV0Migration}from"#execution/wire/session-inbox-wire.v0.js";import{runMigrationChain}from"#execution/durable-session-migrations/chain.js";import{normalizeSessionInboxWireV2}from"#execution/wire/session-inbox-wire.v2-migration.js";import{sessionInboxWireV1Migration}from"#execution/wire/session-inbox-wire.v2.migration.js";import{sessionInboxWireV2Migration}from"#execution/wire/session-inbox-wire.v3.migration.js";const WIRE_LABEL=`session inbox payload`,sessionInboxMigrations=[sessionInboxWireV0Migration,sessionInboxWireV1Migration,sessionInboxWireV2Migration];function decode(
|
|
1
|
+
import{isObject}from"#shared/guards.js";import{SESSION_INBOX_WIRE_VERSION,SessionInboxWireError,SessionInboxWireError as SessionInboxWireError$1}from"#execution/wire/session-inbox-contract.js";import{sessionInboxWireV0Migration}from"#execution/wire/session-inbox-wire.v0.js";import{runMigrationChain}from"#execution/durable-session-migrations/chain.js";import{normalizeSessionInboxWireV2}from"#execution/wire/session-inbox-wire.v2-migration.js";import{sessionInboxWireV1Migration}from"#execution/wire/session-inbox-wire.v2.migration.js";import{sessionInboxWireV2Migration}from"#execution/wire/session-inbox-wire.v3.migration.js";import{sessionInboxWireV3Migration}from"#execution/wire/session-inbox-wire.v4.migration.js";import{sessionInboxWireV4Migration}from"#execution/wire/session-inbox-wire.v5.migration.js";const WIRE_LABEL=`session inbox payload`,sessionInboxMigrations=[sessionInboxWireV0Migration,sessionInboxWireV1Migration,sessionInboxWireV2Migration,sessionInboxWireV3Migration,sessionInboxWireV4Migration,{from:5,migrate(t){if(!isObject(t))throw Error(`session inbox wire v5 value is not an object.`);return{...t,version:6}},to:6}];function decode(e){let n=typeof e==`object`&&e&&`version`in e?e.version:void 0;if(typeof e==`object`&&e&&`version`in e&&typeof n!=`number`)throw new SessionInboxWireError$1(`${WIRE_LABEL}: value has no numeric "version" field.`);let r=normalizeSessionInboxWireV2(e);if((n===1||n===2||n===3)&&containsCurrentTaskMessages(r))throw new SessionInboxWireError$1(`${WIRE_LABEL} does not match wire version ${n}.`);let i;try{i=runMigrationChain({initialVersion:0,label:WIRE_LABEL,migrations:sessionInboxMigrations,targetVersion:SESSION_INBOX_WIRE_VERSION,value:r})}catch(e){throw new SessionInboxWireError$1(e instanceof Error?e.message:String(e))}let a=normalizeSessionInboxWireV2(i);if(a.version!==SESSION_INBOX_WIRE_VERSION)throw new SessionInboxWireError$1(`${WIRE_LABEL} declares version ${JSON.stringify(a.version)}, expected ${SESSION_INBOX_WIRE_VERSION}.`);if(typeof n==`number`&&n>=2&&a.kind===`deliver`&&!(`payload`in a))throw new SessionInboxWireError$1(`${WIRE_LABEL} does not match wire version ${n}.`);return normalizeWire(a)}const sessionInboxWire={decode};function containsCurrentTaskMessages(t){return!isObject(t)||t.kind!==`deliver`?!1:(Array.isArray(t.payloads)?t.payloads:[]).some(t=>{if(!isObject(t)||!isObject(t.task))return!1;if(Object.hasOwn(t.task,`agentRequests`))return!0;let n=t.task.inputRequests;return Array.isArray(n)&&n.some(t=>isObject(t)&&(`request`in t||`requests`in t))})}function normalizeWire(e){switch(e.kind){case`deliver`:return{auth:e.auth,caller:e.caller,deliveryMetadata:e.deliveryMetadata,kind:`deliver`,payloads:e.payloads,requestId:e.requestId,taskDeliveryId:e.taskDeliveryId,turnPolicy:e.turnPolicy};case`session-timeout`:return{kind:`session-timeout`};case`clear`:return{kind:`clear`};case`compact`:return{kind:`compact`};case`reset`:return{kind:`reset`,reason:e.reason};case`cancel`:return{kind:`cancel`,taskId:e.taskId,tasks:e.tasks,turnId:e.turnId};default:throw new SessionInboxWireError$1(`${WIRE_LABEL} has an unrecognized kind ${JSON.stringify(e.kind)}.`)}}export{SessionInboxWireError,sessionInboxWire};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{z}from"#compiled/zod/index.js";import{inputRequestSchema,inputResponseSchema}from"#shared/input.js";import{formatValidationError}from"#runtime/validation.js";import{jsonObjectSchema,jsonValueSchema}from"#shared/json-schemas.js";import{coalesceDeliverPayloads}from"#execution/deliver-payloads.js";import{
|
|
1
|
+
import{z}from"#compiled/zod/index.js";import{inputRequestSchema,inputResponseSchema}from"#shared/input.js";import{formatValidationError}from"#runtime/validation.js";import{jsonObjectSchema,jsonValueSchema}from"#shared/json-schemas.js";import{coalesceDeliverPayloads}from"#execution/deliver-payloads.js";import{SessionInboxWireError}from"#execution/wire/session-inbox-contract.js";import{tokenUsageSchema}from"#shared/token-usage.js";const providerOptionsSchema=z.record(z.string(),jsonObjectSchema),textPartSchema=z.object({providerOptions:providerOptionsSchema.optional(),text:z.string(),type:z.literal(`text`)}).strict(),binaryDataSchema=z.custom(e=>typeof e==`string`||e instanceof Uint8Array||e instanceof ArrayBuffer||e instanceof URL,`Expected a string, URL, Uint8Array, or ArrayBuffer.`),imagePartSchema=z.object({image:binaryDataSchema,mediaType:z.string().optional(),providerOptions:providerOptionsSchema.optional(),type:z.literal(`image`)}).strict(),filePartSchema=z.object({data:binaryDataSchema,filename:z.string().optional(),mediaType:z.string(),providerOptions:providerOptionsSchema.optional(),type:z.literal(`file`)}).strict(),userContentSchema=z.union([z.string(),z.array(z.discriminatedUnion(`type`,[textPartSchema,imagePartSchema,filePartSchema]))]),eventCoordinateSchema=z.number().int().nonnegative(),opaqueObjectSchema=z.custom(e=>typeof e==`object`&&!!e&&!Array.isArray(e),`Expected an object.`),subagentInputRequestHookPayloadSchema=z.object({callId:z.string(),childContinuationToken:z.string(),childSessionId:z.string(),event:z.object({requests:z.array(inputRequestSchema),sequence:eventCoordinateSchema,stepIndex:eventCoordinateSchema,turnId:z.string()}).strict(),kind:z.literal(`subagent-input-request`),subagentName:z.string()}).strict(),subagentAuthorizationEventHookPayloadSchema=z.object({callId:z.string(),childSessionId:z.string(),event:opaqueObjectSchema,kind:z.literal(`subagent-authorization-event`),subagentName:z.string()}).strict(),taskMetadataSchema=z.union([z.object({agentId:z.string(),kind:z.literal(`subagent`),mode:z.enum([`local`,`remote`]),name:z.string()}).strict(),z.object({kind:z.string(),name:z.string()}).strict()]),taskViewBase={executor:z.object({binding:z.object({data:z.record(z.string(),jsonValueSchema),kind:z.string()}).strict().optional(),childSessionId:z.string().optional(),childTurnId:z.string().optional(),lifecycle:z.enum([`parked`,`terminal`]).optional()}).strict().optional(),metadata:taskMetadataSchema,taskId:z.string(),usage:tokenUsageSchema.optional()},taskViewSchema=z.discriminatedUnion(`status`,[z.object({...taskViewBase,status:z.literal(`working`)}).strict(),z.object({...taskViewBase,inputRequests:z.array(jsonValueSchema),status:z.literal(`input_required`)}).strict(),z.object({...taskViewBase,lastOutput:z.object({data:jsonValueSchema,type:z.literal(`result`)}).strict(),status:z.literal(`completed`)}).strict(),z.object({...taskViewBase,lastOutput:z.object({data:jsonValueSchema,type:z.literal(`error`)}).strict(),status:z.literal(`failed`)}).strict(),z.object({...taskViewBase,status:z.literal(`cancelled`)}).strict()]),taskPayloadSchema=z.object({authorizationEvents:z.array(z.object({hookPayload:subagentAuthorizationEventHookPayloadSchema,taskId:z.string()}).strict()).optional(),inputRequests:z.array(z.object({hookPayload:subagentInputRequestHookPayloadSchema,taskId:z.string()}).strict()).optional(),views:z.array(taskViewSchema).optional()}).strict(),deliverPayloadSchema=z.object({context:z.array(z.string()).optional(),inputResponses:z.array(inputResponseSchema).optional(),message:userContentSchema.optional(),outputSchema:jsonObjectSchema.optional(),task:taskPayloadSchema.optional()}).loose(),authSchema=z.object({attributes:z.record(z.string(),z.union([z.string(),z.array(z.string())])),authenticator:z.string(),issuer:z.string().optional(),principalId:z.string(),principalType:z.string(),subject:z.string().optional()}).strict(),callerSchema=z.object({callId:z.string(),replyTo:z.discriminatedUnion(`kind`,[z.object({kind:z.literal(`hook`),token:z.string()}).strict(),z.object({kind:z.literal(`callback`),token:z.string(),url:z.string()}).strict()]),subagentName:z.string(),taskId:z.string().optional()}).strict(),callerProjectionSchema=callerSchema.strip(),traceContextSchema=z.object({spanId:z.string(),traceFlags:z.number(),traceId:z.string()}).strict(),deliveryMetadataSchema=z.object({channelKind:z.string(),channelName:z.string(),deliveryId:z.string(),payloadIndex:z.number().int().nonnegative(),requestId:z.string().optional(),requestTraceContext:traceContextSchema.optional()}).strict(),version=z.literal(1),sessionInboxWireV1Schema=z.discriminatedUnion(`kind`,[z.object({auth:authSchema.nullable().optional(),caller:callerSchema.optional(),deliveryMetadata:z.array(deliveryMetadataSchema).optional(),kind:z.literal(`deliver`),payload:deliverPayloadSchema.optional(),payloads:z.array(deliverPayloadSchema),requestId:z.string().optional(),taskDeliveryId:z.string().optional(),turnPolicy:z.enum([`queue`,`steer`]).optional(),version}).strict(),z.object({kind:z.literal(`session-timeout`),version}).strict(),z.object({kind:z.literal(`clear`),version}).strict(),z.object({kind:z.literal(`compact`),version}).strict(),z.object({kind:z.literal(`reset`),reason:z.string().optional(),version}).strict(),z.object({kind:z.literal(`cancel`),taskId:z.string().optional(),turnId:z.string().optional(),version}).strict()]);function encodeSessionCommandV1(e){let t=toV1Command(e),n=t.kind===`send`?{auth:t.auth,caller:t.caller,deliveryMetadata:t.delivery===void 0?void 0:[{...t.delivery,payloadIndex:0}],kind:`deliver`,payload:t.payload,payloads:[t.payload],requestId:t.requestId,taskDeliveryId:t.taskDeliveryId,turnPolicy:t.turnPolicy,version:1}:t.kind===`deliver`?{...t,payload:coalesceDeliverPayloads(t.payloads),version:1}:{...t,version:1},r=sessionInboxWireV1Schema.safeParse(n);if(!r.success)throw new SessionInboxWireError(`Produced a session inbox payload that does not match wire version 1: ${formatValidationError(r.error)}`);return r.data}function toV1Command(e){return!(`caller`in e)||e.caller===void 0?e:{...e,caller:toV1Caller(e.caller)}}function toV1Caller(e){let t=callerProjectionSchema.safeParse(e);if(!t.success)throw new SessionInboxWireError(`Produced a session inbox payload that does not match wire version 1: ${formatValidationError(t.error)}`);return t.data}export{encodeSessionCommandV1,sessionInboxWireV1Schema};
|