eve 0.50.0 → 0.51.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +41 -0
- package/dist/src/acp/adapter.js +1 -1
- package/dist/src/channel/session.d.ts +2 -1
- package/dist/src/channel/session.js +1 -1
- package/dist/src/channel/types.d.ts +16 -20
- package/dist/src/chunks/{use-eve-agent-B5I-k6Ek.js → use-eve-agent-3DZuvuWE.js} +21 -10
- package/dist/src/chunks/{use-eve-agent-DUMU6dap.js → use-eve-agent-D7apPojZ.js} +21 -10
- package/dist/src/cli/acp/command.d.ts +1 -1
- package/dist/src/cli/acp/command.js +2 -2
- package/dist/src/cli/agent-command.d.ts +5 -0
- package/dist/src/cli/agent-command.js +1 -0
- package/dist/src/cli/application-command.d.ts +2 -0
- package/dist/src/cli/commands/agent-instructions.d.ts +3 -1
- package/dist/src/cli/commands/agent-instructions.js +1 -1
- package/dist/src/cli/commands/build.d.ts +1 -1
- package/dist/src/cli/commands/build.js +1 -1
- package/dist/src/cli/commands/deploy.d.ts +2 -0
- package/dist/src/cli/commands/deploy.js +1 -1
- package/dist/src/cli/commands/init-agent-workspace.d.ts +14 -0
- package/dist/src/cli/commands/init-agent-workspace.js +1 -0
- package/dist/src/cli/commands/init.d.ts +2 -13
- package/dist/src/cli/commands/init.js +1 -1
- package/dist/src/cli/commands/link.d.ts +2 -0
- package/dist/src/cli/commands/link.js +1 -1
- package/dist/src/cli/commands/preconditions.d.ts +15 -0
- package/dist/src/cli/commands/preconditions.js +1 -1
- package/dist/src/cli/commands/register-integration-commands.d.ts +1 -1
- package/dist/src/cli/commands/register-integration-commands.js +1 -1
- package/dist/src/cli/commands/register-project-commands.d.ts +1 -1
- package/dist/src/cli/commands/register-project-commands.js +1 -1
- package/dist/src/cli/commands/register-registry-commands.js +2 -2
- package/dist/src/cli/dev/environment.d.ts +1 -1
- package/dist/src/cli/dev/environment.js +1 -1
- package/dist/src/cli/dev/local-server-process.js +1 -1
- package/dist/src/cli/dev/run-interactive-ui.js +1 -1
- package/dist/src/cli/dev/tui/prompt-command-handler.js +1 -1
- package/dist/src/cli/dev/tui/runner.js +1 -1
- package/dist/src/cli/dev/tui/setup-commands.d.ts +3 -1
- package/dist/src/cli/dev/tui/setup-commands.js +1 -1
- package/dist/src/cli/invoke/command.d.ts +1 -1
- package/dist/src/cli/invoke/command.js +1 -1
- package/dist/src/cli/option-parsers.d.ts +1 -0
- package/dist/src/cli/option-parsers.js +1 -1
- package/dist/src/cli/run.js +3 -3
- package/dist/src/client/agent-info-schema.d.ts +0 -1
- package/dist/src/client/agent-info-schema.js +1 -1
- package/dist/src/client/message-action-parts.js +1 -1
- package/dist/src/client/open-stream.js +1 -1
- package/dist/src/client/session-controls.d.ts +3 -0
- package/dist/src/client/session-controls.js +1 -1
- package/dist/src/client/session.d.ts +4 -1
- package/dist/src/compiled/.vendor-stamp.json +11 -11
- package/dist/src/compiled/@clack/core/LICENSE +9 -0
- package/dist/src/compiled/@clack/core/index.d.ts +363 -0
- package/dist/src/compiled/@clack/core/index.js +20 -0
- package/dist/src/compiled/@eve/catalog/index.js +1 -1
- package/dist/src/compiled/@vercel/sandbox/api-client/api-client.d.ts +34 -92
- package/dist/src/compiled/@vercel/sandbox/api-client/base-client.d.ts +1 -1
- package/dist/src/compiled/@vercel/sandbox/api-client/index.d.ts +1 -1
- package/dist/src/compiled/@vercel/sandbox/api-client/validators.d.ts +13 -29
- package/dist/src/compiled/@vercel/sandbox/constants.d.ts +11 -1
- package/dist/src/compiled/@vercel/sandbox/index.d.ts +3 -3
- package/dist/src/compiled/@vercel/sandbox/index.js +9 -9
- package/dist/src/compiled/@vercel/sandbox/sandbox-user.d.ts +5 -6
- package/dist/src/compiled/@vercel/sandbox/sandbox.d.ts +79 -67
- package/dist/src/compiled/@vercel/sandbox/session.d.ts +5 -3
- package/dist/src/compiled/@vercel/sandbox/snapshot.d.ts +9 -0
- package/dist/src/compiled/@vercel/{sandbox-delete → sandbox-drives}/api-client/api-client.d.ts +86 -1
- package/dist/src/compiled/@vercel/sandbox-drives/api-client/index.d.ts +2 -0
- package/dist/src/compiled/@vercel/{sandbox-delete → sandbox-drives}/api-client/validators.d.ts +26 -1
- package/dist/src/compiled/@vercel/{sandbox-delete → sandbox-drives}/constants.d.ts +2 -2
- package/dist/src/compiled/@vercel/{sandbox → sandbox-drives}/drive.d.ts +10 -0
- package/dist/src/compiled/@vercel/{sandbox-delete → sandbox-drives}/index.d.ts +3 -2
- package/dist/src/compiled/@vercel/sandbox-drives/index.js +9 -0
- package/dist/src/compiled/@vercel/{sandbox-delete → sandbox-drives}/sandbox.d.ts +35 -6
- package/dist/src/compiled/@workflow/core/index.js +1 -1
- package/dist/src/compiled/@workflow/core/private.d.ts +2 -4
- package/dist/src/compiled/@workflow/core/private.js +1 -1
- package/dist/src/compiled/@workflow/core/runtime/constants.d.ts +9 -7
- package/dist/src/compiled/@workflow/core/runtime/helpers.d.ts +13 -0
- package/dist/src/compiled/@workflow/core/runtime/suspension-handler.d.ts +54 -1
- package/dist/src/compiled/@workflow/core/runtime.js +3 -3
- package/dist/src/compiled/@workflow/core/serialization/types.d.ts +7 -0
- package/dist/src/compiled/@workflow/core/serialization.d.ts +24 -2
- package/dist/src/compiled/@workflow/core/version.d.ts +1 -1
- package/dist/src/compiled/@workflow/core/workflow.js +1 -1
- package/dist/src/compiled/@workflow/errors/error-codes.d.ts +2 -0
- package/dist/src/compiled/@workflow/errors/index.d.ts +19 -0
- package/dist/src/compiled/@workflow/errors/index.js +1 -1
- package/dist/src/compiled/@workflow/world/analytics.d.ts +46 -2
- package/dist/src/compiled/@workflow/world/events.d.ts +26 -1
- package/dist/src/compiled/@workflow/world/index.d.ts +1 -1
- package/dist/src/compiled/@workflow/world/runs.d.ts +2 -2
- package/dist/src/compiled/@workflow/world-local/index.js +3 -3
- package/dist/src/compiled/@workflow/world-vercel/index.js +12 -12
- package/dist/src/compiled/_chunks/node/{auth-BSKyPAEP.js → auth-Bx1Aoyfo.js} +1 -1
- package/dist/src/compiled/_chunks/node/{auth-YpKlwhP1.js → auth-CA8ZMfB8.js} +1 -1
- package/dist/src/compiled/_chunks/node/esm-CE0tAvRh.js +7 -0
- package/dist/src/compiled/_chunks/node/version-BC6t2Txc.js +1 -0
- package/dist/src/compiled/_chunks/node/version-DSQqVZ5T.js +1 -0
- package/dist/src/compiled/_chunks/workflow/{attribute-changes-BwAadFfB.js → attribute-changes-03lzo29R.js} +1 -1
- package/dist/src/compiled/_chunks/workflow/dist-BIdMK5N8.js +40 -0
- package/dist/src/compiled/_chunks/workflow/dist-DMQ3CtWt.js +3 -0
- package/dist/src/compiled/_chunks/workflow/frames-Boesh7kU.js +3 -0
- package/dist/src/compiled/_chunks/workflow/{private-CZFMABEf.js → private-CKx3PkSS.js} +1 -1
- package/dist/src/compiled/_chunks/workflow/{resume-hook-BToMtPbH.js → resume-hook-C6eL-S_T.js} +1 -1
- package/dist/src/compiled/_chunks/workflow/run-BV0S6Zc2.js +1 -0
- package/dist/src/compiled/_chunks/workflow/sleep-Bh3jP9ii.js +1 -0
- package/dist/src/compiled/_chunks/workflow/wait-until-l-cwfJvm.js +15 -0
- package/dist/src/compiled/_chunks/workflow/{ws-transport-PnVVxT0R.js → ws-transport-BagXNxCE.js} +1 -1
- package/dist/src/compiler/compile-from-memory.d.ts +1 -0
- package/dist/src/compiler/extension-compatibility.d.ts +20 -20
- package/dist/src/compiler/extension-compatibility.js +1 -1
- package/dist/src/compiler/manifest.d.ts +2 -2
- package/dist/src/compiler/manifest.js +1 -1
- package/dist/src/compiler/normalize-agent-config.js +1 -1
- package/dist/src/compiler/normalize-manifest-helpers.js +1 -1
- package/dist/src/compiler/normalize-manifest.js +1 -1
- package/dist/src/compiler/normalize-tool.js +1 -1
- package/dist/src/context/build-dynamic-tools.js +1 -1
- package/dist/src/context/dynamic-subagent-lifecycle.js +1 -1
- package/dist/src/context/dynamic-tool-lifecycle.js +1 -1
- package/dist/src/context/dynamic-tool-metadata.d.ts +1 -0
- package/dist/src/context/keys.d.ts +0 -3
- package/dist/src/context/keys.js +1 -1
- package/dist/src/discover/extensions.d.ts +2 -0
- package/dist/src/discover/extensions.js +1 -1
- package/dist/src/discover/filesystem.d.ts +1 -0
- package/dist/src/discover/filesystem.js +1 -1
- package/dist/src/discover/project.js +1 -1
- package/dist/src/evals/cli/eval.js +1 -1
- package/dist/src/evals/mock-model.js +1 -1
- package/dist/src/evals/runner/execute-task.js +1 -1
- package/dist/src/evals/session-cleanup.d.ts +7 -0
- package/dist/src/evals/session-cleanup.js +1 -0
- package/dist/src/evals/session.d.ts +4 -0
- package/dist/src/evals/session.js +1 -1
- package/dist/src/eve-channel/index.js +1 -1
- package/dist/src/eve-channel/request.d.ts +1 -0
- package/dist/src/eve-channel/request.js +1 -1
- package/dist/src/execution/activity-collector.js +1 -1
- package/dist/src/execution/activity-work-id.js +1 -1
- package/dist/src/execution/activity-work.d.ts +8 -0
- package/dist/src/execution/activity-work.js +1 -1
- package/dist/src/execution/cancel-descendant-turns-step.js +1 -1
- package/dist/src/execution/cancel-indexed-session-tasks-step.d.ts +6 -0
- package/dist/src/execution/cancel-indexed-session-tasks-step.js +1 -0
- package/dist/src/execution/channel-context.js +1 -1
- package/dist/src/execution/coordination-dispatch-shared.d.ts +103 -0
- package/dist/src/execution/coordination-dispatch-shared.js +1 -0
- package/dist/src/execution/coordination-dispatch-step.d.ts +7 -0
- package/dist/src/execution/coordination-dispatch-step.js +1 -0
- package/dist/src/execution/create-session-step.d.ts +1 -2
- package/dist/src/execution/create-session-step.js +1 -1
- package/dist/src/execution/deliver-payloads.js +1 -1
- package/dist/src/execution/dispatch-action-failures.d.ts +5 -5
- package/dist/src/execution/dispatch-action-failures.js +1 -1
- package/dist/src/execution/dispatch-start-operation.d.ts +1 -1
- package/dist/src/execution/dispatch-start-operation.js +1 -1
- package/dist/src/execution/durable-session-store.d.ts +1 -1
- package/dist/src/execution/eve-workflow-attributes.d.ts +1 -1
- package/dist/src/execution/inline-turn.d.ts +2 -0
- package/dist/src/execution/inline-turn.js +1 -1
- package/dist/src/execution/next-driver-action.d.ts +7 -13
- package/dist/src/execution/node-step.d.ts +1 -2
- package/dist/src/execution/node-step.js +1 -1
- package/dist/src/execution/parked-delivery-wait.js +1 -1
- package/dist/src/execution/pending-turn-state.d.ts +1 -2
- package/dist/src/execution/pending-turn-state.js +1 -1
- package/dist/src/execution/proxied-deliver-step.js +1 -1
- package/dist/src/execution/route-child-delivery.js +1 -1
- package/dist/src/execution/run-session-limits.d.ts +5 -5
- package/dist/src/execution/runtime-context.js +1 -1
- package/dist/src/execution/sandbox/bindings/vercel-create-sdk.js +1 -1
- package/dist/src/execution/sandbox/bindings/vercel-sdk-types.d.ts +4 -4
- package/dist/src/execution/sandbox/bindings/vercel.js +1 -1
- package/dist/src/execution/session-activity-projection.js +1 -1
- package/dist/src/execution/session-activity.js +1 -1
- package/dist/src/execution/session-command-inbox.d.ts +2 -3
- package/dist/src/execution/session-timeout-workflow.js +1 -1
- package/dist/src/execution/session.d.ts +2 -1
- package/dist/src/execution/session.js +2 -2
- package/dist/src/execution/settle-cancelled-turn-step.d.ts +1 -1
- package/dist/src/execution/settle-cancelled-turn-step.js +1 -1
- package/dist/src/execution/stable-workflow-names.d.ts +1 -1
- package/dist/src/execution/stable-workflow-names.js +1 -1
- package/dist/src/execution/task-event-callback.js +1 -1
- package/dist/src/execution/tasks/child/steps.d.ts +19 -11
- package/dist/src/execution/tasks/child/steps.js +1 -1
- package/dist/src/execution/tasks/child/update-step.d.ts +6 -0
- package/dist/src/execution/tasks/child/update-step.js +1 -0
- package/dist/src/execution/tasks/child/update.d.ts +7 -10
- package/dist/src/execution/tasks/child/update.js +1 -1
- package/dist/src/execution/tasks/child/workflow.d.ts +21 -27
- package/dist/src/execution/tasks/child/workflow.js +1 -1
- package/dist/src/execution/tasks/parent/control-shared.d.ts +6 -17
- package/dist/src/execution/tasks/parent/control-shared.js +1 -1
- package/dist/src/execution/tasks/parent/delegate.d.ts +15 -48
- package/dist/src/execution/tasks/parent/delegate.js +1 -1
- package/dist/src/execution/tasks/parent/dispatch.d.ts +19 -34
- package/dist/src/execution/tasks/parent/dispatch.js +1 -1
- package/dist/src/execution/tasks/parent/hitl-proxy-steps.d.ts +5 -15
- package/dist/src/execution/tasks/parent/hitl-proxy-steps.js +1 -1
- package/dist/src/execution/tasks/parent/run-parent.d.ts +2 -2
- package/dist/src/execution/tasks/parent/subagent-task-projection.d.ts +26 -0
- package/dist/src/execution/tasks/parent/subagent-task-projection.js +1 -0
- package/dist/src/execution/tasks/parent/task-cancel.d.ts +11 -0
- package/dist/src/execution/tasks/parent/task-cancel.js +1 -0
- package/dist/src/execution/tasks/parent/tool-execution.d.ts +2 -3
- package/dist/src/execution/tasks/parent/tool-execution.js +1 -1
- package/dist/src/execution/terminate-child-sessions-step.js +1 -1
- package/dist/src/execution/tools/sleep-workflow.d.ts +3 -0
- package/dist/src/execution/tools/sleep-workflow.js +1 -0
- package/dist/src/execution/tools/sleep.d.ts +1 -5
- package/dist/src/execution/tools/sleep.js +1 -1
- package/dist/src/execution/tools/subagent/accept-event-step.d.ts +7 -0
- package/dist/src/execution/tools/subagent/accept-event-step.js +1 -0
- package/dist/src/execution/tools/subagent/emit-called-step.d.ts +9 -0
- package/dist/src/execution/tools/subagent/emit-called-step.js +1 -0
- package/dist/src/execution/tools/subagent/invoke-agent.d.ts +51 -0
- package/dist/src/execution/tools/subagent/invoke-agent.js +1 -0
- package/dist/src/execution/tools/subagent/invoke-preparation.d.ts +37 -0
- package/dist/src/execution/tools/subagent/invoke-preparation.js +1 -0
- package/dist/src/execution/tools/subagent/invoke-step.d.ts +55 -0
- package/dist/src/execution/tools/subagent/invoke-step.js +1 -0
- package/dist/src/execution/tools/subagent/receipt-identity.d.ts +11 -0
- package/dist/src/execution/tools/subagent/receipt-identity.js +1 -0
- package/dist/src/execution/{dispatch-runtime-actions-start.d.ts → tools/subagent/start.d.ts} +17 -5
- package/dist/src/execution/tools/subagent/start.js +1 -0
- package/dist/src/execution/tools/subagent/task-agent-requests.d.ts +24 -0
- package/dist/src/execution/tools/subagent/task-agent-requests.js +1 -0
- package/dist/src/execution/tools/subagent/task-cancel.d.ts +10 -0
- package/dist/src/execution/tools/subagent/task-cancel.js +1 -0
- package/dist/src/execution/tools/tasks.d.ts +10 -0
- package/dist/src/execution/tools/tasks.js +1 -0
- package/dist/src/execution/{tool-run → tools/workflow}/answer.d.ts +1 -1
- package/dist/src/execution/tools/workflow/answer.js +1 -0
- package/dist/src/execution/tools/workflow/ask.d.ts +22 -0
- package/dist/src/execution/tools/workflow/ask.js +1 -0
- package/dist/src/execution/tools/workflow/background.d.ts +18 -0
- package/dist/src/execution/tools/workflow/background.js +1 -0
- package/dist/src/execution/tools/workflow/body.d.ts +25 -0
- package/dist/src/execution/tools/workflow/body.js +1 -0
- package/dist/src/execution/tools/workflow/cancel.d.ts +11 -0
- package/dist/src/execution/tools/workflow/cancel.js +1 -0
- package/dist/src/execution/tools/workflow/emit-workflow-tool-run-report-step.d.ts +7 -0
- package/dist/src/execution/tools/workflow/emit-workflow-tool-run-report-step.js +1 -0
- package/dist/src/execution/tools/workflow/messages.d.ts +88 -0
- package/dist/src/execution/tools/workflow/messages.js +1 -0
- package/dist/src/execution/tools/workflow/owner-inbox.d.ts +13 -0
- package/dist/src/execution/tools/workflow/owner-inbox.js +1 -0
- package/dist/src/execution/tools/workflow/owner.d.ts +13 -0
- package/dist/src/execution/tools/workflow/owner.js +1 -0
- package/dist/src/execution/tools/workflow/run-control.d.ts +18 -0
- package/dist/src/execution/tools/workflow/run-control.js +1 -0
- package/dist/src/execution/tools/workflow/start.d.ts +33 -0
- package/dist/src/execution/tools/workflow/start.js +1 -0
- package/dist/src/execution/tools/workflow/types.d.ts +26 -0
- package/dist/src/execution/tools/workflow/types.js +1 -0
- package/dist/src/execution/tools/workflow/workflow.d.ts +3 -0
- package/dist/src/execution/tools/workflow/workflow.js +1 -0
- package/dist/src/execution/turn-cancellation-control.d.ts +1 -0
- package/dist/src/execution/turn-cancellation-control.js +1 -1
- package/dist/src/execution/turn-cancellation-token.d.ts +1 -0
- package/dist/src/execution/turn-control-receiver.d.ts +3 -0
- package/dist/src/execution/turn-control-receiver.js +1 -1
- package/dist/src/execution/turn-dispatch.d.ts +2 -0
- package/dist/src/execution/turn-dispatch.js +1 -1
- package/dist/src/execution/turn-workflow-tool-run.d.ts +16 -0
- package/dist/src/execution/turn-workflow-tool-run.js +1 -0
- package/dist/src/execution/turn-workflow.js +1 -1
- package/dist/src/execution/wire/session-inbox-contract.d.ts +2 -2
- package/dist/src/execution/wire/session-inbox-contract.js +1 -1
- package/dist/src/execution/wire/session-inbox-encoder.d.ts +14 -2
- package/dist/src/execution/wire/session-inbox-encoder.js +1 -1
- package/dist/src/execution/wire/session-inbox-resume.js +1 -1
- package/dist/src/execution/wire/session-inbox-wire.d.ts +3 -3
- package/dist/src/execution/wire/session-inbox-wire.js +1 -1
- package/dist/src/execution/wire/session-inbox-wire.v1.js +1 -1
- package/dist/src/execution/wire/session-inbox-wire.v4.d.ts +267 -0
- package/dist/src/execution/wire/session-inbox-wire.v4.js +1 -0
- package/dist/src/execution/wire/session-inbox-wire.v4.migration.d.ts +3 -0
- package/dist/src/execution/wire/session-inbox-wire.v4.migration.js +1 -0
- package/dist/src/execution/wire/session-inbox-wire.v5.d.ts +341 -0
- package/dist/src/execution/wire/session-inbox-wire.v5.js +1 -0
- package/dist/src/execution/wire/session-inbox-wire.v5.migration.d.ts +3 -0
- package/dist/src/execution/wire/session-inbox-wire.v5.migration.js +1 -0
- package/dist/src/execution/wire/session-inbox-wire.v6.d.ts +341 -0
- package/dist/src/execution/wire/session-inbox-wire.v6.js +1 -0
- package/dist/src/execution/workflow-entry-finalization.d.ts +6 -0
- package/dist/src/execution/workflow-entry-finalization.js +1 -1
- package/dist/src/execution/workflow-entry.d.ts +2 -1
- package/dist/src/execution/workflow-entry.js +1 -1
- package/dist/src/execution/workflow-runtime.d.ts +1 -1
- package/dist/src/execution/workflow-runtime.js +1 -1
- package/dist/src/execution/workflow-steps.js +1 -1
- package/dist/src/framework/sources/registry.js +1 -1
- package/dist/src/harness/advertised-tools.d.ts +1 -7
- package/dist/src/harness/advertised-tools.js +1 -1
- package/dist/src/harness/background-tools.d.ts +8 -2
- package/dist/src/harness/{runtime-actions.d.ts → coordination.d.ts} +40 -27
- package/dist/src/harness/coordination.js +1 -0
- package/dist/src/harness/emission.d.ts +9 -2
- package/dist/src/harness/emission.js +1 -1
- package/dist/src/harness/execute-tool.d.ts +52 -0
- package/dist/src/harness/hitl/session-limit-input-requests.js +1 -1
- package/dist/src/harness/input-requests.js +1 -1
- package/dist/src/harness/proxy-input-requests.d.ts +6 -2
- package/dist/src/harness/session-limit-continuation.d.ts +5 -5
- package/dist/src/harness/session-limit-continuation.js +1 -1
- package/dist/src/harness/session-limit-enforcement.d.ts +4 -4
- package/dist/src/harness/session-limit-enforcement.js +1 -1
- package/dist/src/harness/session-usage-limits.d.ts +48 -0
- package/dist/src/harness/session-usage-limits.js +1 -0
- package/dist/src/harness/stale-input-responses.js +1 -1
- package/dist/src/harness/step-hooks.d.ts +1 -2
- package/dist/src/harness/step-hooks.js +1 -1
- package/dist/src/harness/tool-call-action.js +1 -1
- package/dist/src/harness/tool-call-input-errors.js +1 -1
- package/dist/src/harness/tool-loop.js +2 -2
- package/dist/src/harness/tools.js +1 -1
- package/dist/src/harness/turn-tag-state.d.ts +20 -21
- package/dist/src/harness/turn-tag-state.js +1 -1
- package/dist/src/harness/types.d.ts +9 -7
- package/dist/src/harness/workflow-interrupt-state.js +1 -1
- package/dist/src/harness/workflow-lifecycle.d.ts +10 -0
- package/dist/src/harness/workflow-lifecycle.js +1 -1
- package/dist/src/harness/workflow-sandbox.d.ts +1 -1
- package/dist/src/harness/workflow-sandbox.js +2 -2
- package/dist/src/harness/workflow-subagent-limit.d.ts +7 -7
- package/dist/src/harness/workflow-subagent-limit.js +1 -1
- package/dist/src/harness/workflow-task-state.d.ts +9 -0
- package/dist/src/harness/workflow-task-state.js +1 -0
- package/dist/src/harness/workflow-tool-runs.d.ts +27 -0
- package/dist/src/harness/workflow-tool-runs.js +1 -0
- package/dist/src/instrumentation/native-events.js +1 -1
- package/dist/src/instrumentation/parent-lineage.js +1 -1
- package/dist/src/internal/agent-name.d.ts +4 -0
- package/dist/src/internal/agent-name.js +1 -0
- package/dist/src/internal/application/build-output-environment.d.ts +1 -0
- package/dist/src/internal/application/build-output-environment.js +1 -1
- package/dist/src/internal/application/package.js +1 -1
- package/dist/src/internal/application/paths.js +1 -1
- package/dist/src/internal/authored-definition/core.js +1 -1
- package/dist/src/internal/eve-project-root.d.ts +8 -0
- package/dist/src/internal/eve-project-root.js +1 -0
- package/dist/src/internal/invocation/workflow-execution.js +1 -1
- package/dist/src/internal/nitro/host/build-application.js +1 -1
- package/dist/src/internal/nitro/host/create-application-nitro.d.ts +1 -0
- package/dist/src/internal/nitro/host/create-application-nitro.js +1 -1
- package/dist/src/internal/nitro/host/start-development-server.js +1 -1
- package/dist/src/internal/nitro/host/start-production-server.js +3 -3
- package/dist/src/internal/nitro/host/types.d.ts +2 -0
- package/dist/src/internal/nitro/host/vercel-build-output-config.d.ts +1 -0
- package/dist/src/internal/nitro/host/vercel-build-output-config.js +1 -1
- package/dist/src/internal/nitro/routes/runtime-stack.js +1 -1
- package/dist/src/internal/project-context.d.ts +31 -0
- package/dist/src/internal/project-context.js +1 -0
- package/dist/src/internal/vercel/assemble-eve-services.d.ts +17 -0
- package/dist/src/internal/vercel/assemble-eve-services.js +1 -0
- package/dist/src/internal/vercel/build-agent-workspace.d.ts +3 -0
- package/dist/src/internal/vercel/build-agent-workspace.js +1 -0
- package/dist/src/internal/vercel/build-command.d.ts +4 -0
- package/dist/src/internal/vercel/build-command.js +1 -0
- package/dist/src/internal/vercel/eve-service-contribution.d.ts +28 -0
- package/dist/src/internal/vercel/eve-service-contribution.js +1 -0
- package/dist/src/internal/vercel/vercel-service-config-operations.d.ts +18 -0
- package/dist/src/internal/vercel/vercel-service-config-operations.js +1 -0
- package/dist/src/internal/vercel/vercel-service-name.d.ts +6 -0
- package/dist/src/internal/vercel/vercel-service-name.js +1 -0
- package/dist/src/internal/vercel/vercel-services-config.d.ts +53 -0
- package/dist/src/internal/vercel/vercel-services-config.js +1 -0
- package/dist/src/internal/workflow/reference.d.ts +2 -0
- package/dist/src/internal/workflow/reference.js +1 -0
- package/dist/src/internal/workflow-bundle/authored-workflow-modules.d.ts +0 -9
- package/dist/src/internal/workflow-bundle/authored-workflow-modules.js +1 -1
- package/dist/src/internal/workflow-bundle/builder.js +1 -1
- package/dist/src/internal/workflow-bundle/workflow-builders.d.ts +1 -1
- package/dist/src/internal/workflow-bundle/workflow-builders.js +1 -1
- package/dist/src/internal/workflow-bundle/workflow-transformer.d.ts +1 -1
- package/dist/src/internal/workflow-bundle/workflow-transformer.js +1 -1
- package/dist/src/protocol/message.d.ts +2 -0
- package/dist/src/protocol/message.js +1 -1
- package/dist/src/public/channels/slack/action-status.js +1 -1
- package/dist/src/public/channels/slack/activity-plan.d.ts +4 -0
- package/dist/src/public/channels/slack/activity-plan.js +1 -0
- package/dist/src/public/channels/slack/activity.d.ts +45 -2
- package/dist/src/public/channels/slack/activity.js +2 -1
- package/dist/src/public/channels/slack/index.d.ts +1 -1
- package/dist/src/public/channels/slack/index.js +1 -1
- package/dist/src/public/channels/slack/slackChannel.js +1 -1
- package/dist/src/public/memory/file/backends/vercel-blob.js +1 -1
- package/dist/src/public/memory/index.js +1 -1
- package/dist/src/public/next/index.js +1 -1
- package/dist/src/public/next/vercel-output-config.js +1 -1
- package/dist/src/public/nuxt/index.js +1 -1
- package/dist/src/public/nuxt/module.d.ts +3 -2
- package/dist/src/public/nuxt/module.js +1 -1
- package/dist/src/public/sandbox/vercel-sandbox.d.ts +9 -5
- package/dist/src/public/sandbox/vercel.d.ts +1 -1
- package/dist/src/public/sandbox/vercel.js +1 -1
- package/dist/src/public/workflow/index.d.ts +3 -1
- package/dist/src/public/workflow/index.js +1 -1
- package/dist/src/runtime/actions/results.d.ts +3 -3
- package/dist/src/runtime/actions/results.js +1 -1
- package/dist/src/runtime/agent/bootstrap-model-utils.js +1 -1
- package/dist/src/runtime/agent/bootstrap.d.ts +1 -0
- package/dist/src/runtime/agent/bootstrap.js +1 -1
- package/dist/src/runtime/agent/mock-model-adapter.js +1 -1
- package/dist/src/runtime/channels/registry.js +1 -1
- package/dist/src/runtime/prompt/compose.d.ts +0 -1
- package/dist/src/runtime/prompt/compose.js +1 -1
- package/dist/src/runtime/resolve-agent-graph.js +1 -1
- package/dist/src/runtime/resolve-agent.js +1 -1
- package/dist/src/runtime/sessions/turn.d.ts +16 -1
- package/dist/src/runtime/subagents/registry.js +1 -1
- package/dist/src/runtime/subagents/workflow-reference.d.ts +5 -0
- package/dist/src/runtime/subagents/workflow-reference.js +1 -0
- package/dist/src/runtime/subagents/workflow.d.ts +8 -0
- package/dist/src/runtime/subagents/workflow.js +1 -0
- package/dist/src/runtime/tools/registry.js +1 -1
- package/dist/src/self-modification/agent.d.ts +22 -0
- package/dist/src/self-modification/agent.js +1 -0
- package/dist/src/self-modification/extension/classify-registry-item.d.ts +19 -0
- package/dist/src/self-modification/extension/classify-registry-item.js +1 -0
- package/dist/src/self-modification/extension/eve-add.d.ts +56 -0
- package/dist/src/self-modification/extension/eve-add.js +2 -0
- package/dist/src/self-modification/extension/extension.d.ts +2 -0
- package/dist/src/self-modification/extension/extension.js +1 -0
- package/dist/src/self-modification/extension/instructions.d.ts +4 -0
- package/dist/src/self-modification/extension/instructions.js +23 -0
- package/dist/src/self-modification/extension/source-lock.d.ts +2 -0
- package/dist/src/self-modification/extension/source-lock.js +1 -0
- package/dist/src/self-modification/extension/tools/edit_file.d.ts +16 -0
- package/dist/src/self-modification/extension/tools/edit_file.js +1 -0
- package/dist/src/self-modification/extension/tools/registry_add.d.ts +52 -0
- package/dist/src/self-modification/extension/tools/registry_add.js +1 -0
- package/dist/src/self-modification/extension/tools/search_models.d.ts +22 -0
- package/dist/src/self-modification/extension/tools/search_models.js +1 -0
- package/dist/src/self-modification/extension/tools/search_registry.d.ts +103 -0
- package/dist/src/self-modification/extension/tools/search_registry.js +1 -0
- package/dist/src/self-modification/filesystem.d.ts +6 -0
- package/dist/src/self-modification/filesystem.js +1 -0
- package/dist/src/self-modification/sandbox.d.ts +2 -0
- package/dist/src/self-modification/sandbox.js +1 -0
- package/dist/src/services/dev-client/target.d.ts +3 -1
- package/dist/src/setup/boxes/select-model.d.ts +3 -21
- package/dist/src/setup/boxes/select-model.js +1 -1
- package/dist/src/setup/cli/prompt-ui.js +4 -4
- package/dist/src/setup/cli/select-component.d.ts +1 -1
- package/dist/src/setup/cli/select-component.js +1 -1
- package/dist/src/setup/flows/model.d.ts +3 -0
- package/dist/src/setup/flows/model.js +1 -1
- package/dist/src/setup/integrations/discord/setup.js +1 -1
- package/dist/src/setup/integrations/file-memory/vercel.js +1 -1
- package/dist/src/setup/integrations/linear/setup.js +1 -1
- package/dist/src/setup/integrations/linq/setup.js +3 -3
- package/dist/src/setup/integrations/shopify/setup.js +1 -1
- package/dist/src/setup/prompter.js +1 -1
- package/dist/src/setup/scaffold/create/project.js +1 -1
- package/dist/src/setup/scaffold/update/channels.d.ts +4 -12
- package/dist/src/setup/scaffold/update/channels.js +1 -1
- package/dist/src/setup/scaffold/update/web-options.js +1 -1
- package/dist/src/shared/action-types.d.ts +103 -30
- package/dist/src/shared/action-types.js +1 -1
- package/dist/src/shared/agent-definition.d.ts +13 -0
- package/dist/src/shared/agent-turn-outcome.d.ts +2 -0
- package/dist/src/shared/agent-turn-outcome.js +1 -1
- package/dist/src/shared/extension-package-contract.d.ts +2 -0
- package/dist/src/shared/extension-package-contract.js +1 -1
- package/dist/src/shared/gateway-model-catalog.d.ts +21 -0
- package/dist/src/shared/gateway-model-catalog.js +1 -0
- package/dist/src/shared/json.js +1 -1
- package/dist/src/shared/sandbox-network-policy.d.ts +1 -1
- package/dist/src/shared/token-usage.d.ts +11 -15
- package/dist/src/shared/token-usage.js +1 -1
- package/dist/src/shared/workflow-sandbox.d.ts +1 -1
- package/dist/src/{execution/subagent-adapter-state.d.ts → subagents/adapter-state.d.ts} +2 -0
- package/dist/src/{execution/subagent-adapter-state.js → subagents/adapter-state.js} +1 -1
- package/dist/src/subagents/adapter.js +1 -0
- package/dist/src/{harness → subagents}/agent-handle-errors.d.ts +6 -0
- package/dist/src/subagents/agent-handle-errors.js +1 -0
- package/dist/src/subagents/callback-route.js +1 -0
- package/dist/src/subagents/callback-step.js +1 -0
- package/dist/src/{execution/agent-continuation-bundle.d.ts → subagents/continuation-bundle.d.ts} +1 -1
- package/dist/src/subagents/continuation-bundle.js +1 -0
- package/dist/src/{execution/subagent-event-proxy-step.d.ts → subagents/event-proxy-step.d.ts} +2 -8
- package/dist/src/subagents/event-proxy-step.js +1 -0
- package/dist/src/subagents/handle-dispatch.d.ts +54 -0
- package/dist/src/subagents/handle-dispatch.js +1 -0
- package/dist/src/{harness → subagents}/handles/prompt.d.ts +4 -4
- package/dist/src/{harness → subagents}/handles/prompt.js +1 -1
- package/dist/src/{harness → subagents}/handles/query.d.ts +8 -2
- package/dist/src/subagents/handles/query.js +1 -0
- package/dist/src/subagents/handles/rebase.d.ts +4 -0
- package/dist/src/subagents/handles/rebase.js +1 -0
- package/dist/src/{harness → subagents}/handles/store.d.ts +90 -15
- package/dist/src/subagents/handles/store.js +1 -0
- package/dist/src/subagents/handles/transitions.d.ts +103 -0
- package/dist/src/subagents/handles/transitions.js +1 -0
- package/dist/src/{execution/delegated-parent-notification.d.ts → subagents/parent-notification.d.ts} +1 -7
- package/dist/src/subagents/parent-notification.js +1 -0
- package/dist/src/subagents/parent-result.js +1 -0
- package/dist/src/{execution/remote-agent-dispatch.d.ts → subagents/remote-dispatch.d.ts} +3 -2
- package/dist/src/subagents/remote-dispatch.js +1 -0
- package/dist/src/{execution/subagent-start-local.d.ts → subagents/start-local.d.ts} +5 -6
- package/dist/src/subagents/start-local.js +1 -0
- package/dist/src/{execution/subagent-start-remote.d.ts → subagents/start-remote.d.ts} +5 -5
- package/dist/src/subagents/start-remote.js +1 -0
- package/dist/src/subagents/token-budget.js +1 -0
- package/dist/src/{execution/subagent-tool.d.ts → subagents/tool.d.ts} +5 -3
- package/dist/src/subagents/tool.js +1 -0
- package/dist/src/svelte/index.js +1 -1
- package/dist/src/svelte/use-eve-agent.js +1 -1
- package/dist/src/tasks/json.js +1 -1
- package/dist/src/tasks/session-index.d.ts +2 -3
- package/dist/src/tasks/session-index.js +1 -1
- package/dist/src/tasks/task-id.d.ts +3 -4
- package/dist/src/tasks/task-id.js +1 -1
- package/dist/src/tasks/transitions.d.ts +3 -47
- package/dist/src/tasks/transitions.js +1 -1
- package/dist/src/tasks/types.d.ts +70 -247
- package/dist/src/tasks/types.js +1 -1
- package/dist/src/tools/dynamic.d.ts +3 -1
- package/dist/src/tools/framework/agent.d.ts +18 -2
- package/dist/src/tools/framework/agent.js +1 -1
- package/dist/src/tools/framework/task-cancel.d.ts +2 -6
- package/dist/src/tools/framework/task-contract.d.ts +44 -65
- package/dist/src/tools/framework/task-contract.js +1 -1
- package/dist/src/tools/framework/task-update.d.ts +1 -0
- package/dist/src/tools/framework/task-update.js +1 -1
- package/dist/src/tools/provided/sleep.d.ts +2 -2
- package/dist/src/vue/index.js +1 -1
- package/dist/src/vue/use-eve-agent.js +1 -1
- package/docs/agent-config.md +24 -19
- package/docs/channels/eve.mdx +1 -1
- package/docs/concepts/built-in-tools.md +10 -91
- package/docs/concepts/context-control.md +2 -2
- package/docs/concepts/execution-model-and-durability.mdx +1 -1
- package/docs/concepts/sessions-runs-and-streaming.md +11 -3
- package/docs/guides/client/streaming.mdx +1 -1
- package/docs/guides/deployment/vercel.mdx +20 -2
- package/docs/guides/dynamic-capabilities.md +2 -2
- package/docs/guides/frontend/overview.mdx +1 -1
- package/docs/guides/instrumentation-providers.md +242 -0
- package/docs/guides/instrumentation.md +2 -0
- package/docs/guides/meta.json +1 -0
- package/docs/guides/remote-agents.md +8 -9
- package/docs/memory/overview.mdx +1 -1
- package/docs/reference/cli.md +5 -2
- package/docs/sandbox.mdx +3 -1
- package/docs/subagents/index.mdx +9 -8
- package/docs/tools/overview.mdx +11 -10
- package/docs/tools/workflows.mdx +52 -18
- package/package.json +38 -13
- package/dist/src/compiled/@vercel/sandbox-delete/api-client/index.d.ts +0 -2
- package/dist/src/compiled/@vercel/sandbox-delete/index.js +0 -9
- package/dist/src/compiled/@vercel/sandbox-stable/LICENSE +0 -201
- package/dist/src/compiled/@vercel/sandbox-stable/_async-retry.d.ts +0 -8
- package/dist/src/compiled/@vercel/sandbox-stable/_workflow-serde.d.ts +0 -5
- package/dist/src/compiled/@vercel/sandbox-stable/api-client/api-client.d.ts +0 -1456
- package/dist/src/compiled/@vercel/sandbox-stable/api-client/api-error.d.ts +0 -29
- package/dist/src/compiled/@vercel/sandbox-stable/api-client/base-client.d.ts +0 -39
- package/dist/src/compiled/@vercel/sandbox-stable/api-client/file-writer.d.ts +0 -66
- package/dist/src/compiled/@vercel/sandbox-stable/api-client/index.d.ts +0 -2
- package/dist/src/compiled/@vercel/sandbox-stable/api-client/validators.d.ts +0 -899
- package/dist/src/compiled/@vercel/sandbox-stable/api-client/with-retry.d.ts +0 -10
- package/dist/src/compiled/@vercel/sandbox-stable/auth/error.d.ts +0 -15
- package/dist/src/compiled/@vercel/sandbox-stable/auth/file.d.ts +0 -18
- package/dist/src/compiled/@vercel/sandbox-stable/auth/index.d.ts +0 -6
- package/dist/src/compiled/@vercel/sandbox-stable/auth/oauth.d.ts +0 -111
- package/dist/src/compiled/@vercel/sandbox-stable/auth/poll-for-token.d.ts +0 -28
- package/dist/src/compiled/@vercel/sandbox-stable/auth/project.d.ts +0 -40
- package/dist/src/compiled/@vercel/sandbox-stable/command.d.ts +0 -292
- package/dist/src/compiled/@vercel/sandbox-stable/constants.d.ts +0 -5
- package/dist/src/compiled/@vercel/sandbox-stable/execution-context.d.ts +0 -116
- package/dist/src/compiled/@vercel/sandbox-stable/filesystem.d.ts +0 -258
- package/dist/src/compiled/@vercel/sandbox-stable/index.d.ts +0 -12
- package/dist/src/compiled/@vercel/sandbox-stable/index.js +0 -1
- package/dist/src/compiled/@vercel/sandbox-stable/network-policy.d.ts +0 -169
- package/dist/src/compiled/@vercel/sandbox-stable/proxy.d.ts +0 -55
- package/dist/src/compiled/@vercel/sandbox-stable/sandbox-user.d.ts +0 -212
- package/dist/src/compiled/@vercel/sandbox-stable/sandbox.d.ts +0 -1216
- package/dist/src/compiled/@vercel/sandbox-stable/session.d.ts +0 -433
- package/dist/src/compiled/@vercel/sandbox-stable/snapshot.d.ts +0 -229
- package/dist/src/compiled/@vercel/sandbox-stable/utils/get-credentials.d.ts +0 -21
- package/dist/src/compiled/@vercel/sandbox-stable/utils/paginator.d.ts +0 -16
- package/dist/src/compiled/@vercel/sandbox-stable/utils/resolveSignal.d.ts +0 -15
- package/dist/src/compiled/@vercel/sandbox-stable/utils/sandbox-snapshot.d.ts +0 -11
- package/dist/src/compiled/@vercel/sandbox-stable/utils/types.d.ts +0 -11
- package/dist/src/compiled/_chunks/node/decode_jwt-Col8JOnf.js +0 -7
- package/dist/src/compiled/_chunks/node/version-BYHw-SDY.js +0 -1
- package/dist/src/compiled/_chunks/node/version-DH6yRy-M.js +0 -1
- package/dist/src/compiled/_chunks/workflow/dist-CgbVZs5l.js +0 -40
- package/dist/src/compiled/_chunks/workflow/dist-DjojkP5e.js +0 -3
- package/dist/src/compiled/_chunks/workflow/frames-CZ9eHShe.js +0 -3
- package/dist/src/compiled/_chunks/workflow/run-DzyAoGh4.js +0 -1
- package/dist/src/compiled/_chunks/workflow/sleep-3_A5uOp-.js +0 -1
- package/dist/src/compiled/_chunks/workflow/wait-until-BtySPYD0.js +0 -15
- package/dist/src/execution/agent-continuation-bundle.js +0 -1
- package/dist/src/execution/agent-handle-dispatch.d.ts +0 -79
- package/dist/src/execution/agent-handle-dispatch.js +0 -1
- package/dist/src/execution/delegated-parent-notification.js +0 -1
- package/dist/src/execution/delegated-parent-result.js +0 -1
- package/dist/src/execution/delegation-tool.d.ts +0 -10
- package/dist/src/execution/delegation-tool.js +0 -1
- package/dist/src/execution/dispatch-runtime-actions-shared.d.ts +0 -165
- package/dist/src/execution/dispatch-runtime-actions-shared.js +0 -1
- package/dist/src/execution/dispatch-runtime-actions-start.js +0 -1
- package/dist/src/execution/dispatch-runtime-actions-step.d.ts +0 -18
- package/dist/src/execution/dispatch-runtime-actions-step.js +0 -1
- package/dist/src/execution/dispatch-workflow-runtime-actions-step.d.ts +0 -18
- package/dist/src/execution/dispatch-workflow-runtime-actions-step.js +0 -1
- package/dist/src/execution/finalize-terminal-session.d.ts +0 -17
- package/dist/src/execution/finalize-terminal-session.js +0 -1
- package/dist/src/execution/prepared-agent-action.d.ts +0 -7
- package/dist/src/execution/prepared-agent-action.js +0 -1
- package/dist/src/execution/remote-agent-dispatch.js +0 -1
- package/dist/src/execution/session-callback-route.js +0 -1
- package/dist/src/execution/session-callback-step.js +0 -1
- package/dist/src/execution/subagent-adapter.js +0 -1
- package/dist/src/execution/subagent-event-proxy-step.js +0 -1
- package/dist/src/execution/subagent-start-local.js +0 -1
- package/dist/src/execution/subagent-start-remote.js +0 -1
- package/dist/src/execution/subagent-tool.js +0 -1
- package/dist/src/execution/tasks/child/instructions.d.ts +0 -3
- package/dist/src/execution/tasks/child/instructions.js +0 -1
- package/dist/src/execution/tasks/parent/agent-identity.d.ts +0 -13
- package/dist/src/execution/tasks/parent/agent-identity.js +0 -1
- package/dist/src/execution/tasks/parent/agent-views.d.ts +0 -7
- package/dist/src/execution/tasks/parent/agent-views.js +0 -1
- package/dist/src/execution/tasks/parent/continuation-dispatch.d.ts +0 -43
- package/dist/src/execution/tasks/parent/continuation-dispatch.js +0 -1
- package/dist/src/execution/tasks/parent/dispatch-task-step.d.ts +0 -19
- package/dist/src/execution/tasks/parent/dispatch-task-step.js +0 -1
- package/dist/src/execution/tool-run/answer.js +0 -1
- package/dist/src/execution/tool-run/background.d.ts +0 -14
- package/dist/src/execution/tool-run/background.js +0 -1
- package/dist/src/execution/tool-run/cancel.d.ts +0 -7
- package/dist/src/execution/tool-run/cancel.js +0 -1
- package/dist/src/execution/tool-run/dispatch.d.ts +0 -24
- package/dist/src/execution/tool-run/dispatch.js +0 -1
- package/dist/src/execution/tool-run/emit-run-report-step.d.ts +0 -7
- package/dist/src/execution/tool-run/emit-run-report-step.js +0 -1
- package/dist/src/execution/tool-run/messages.d.ts +0 -70
- package/dist/src/execution/tool-run/messages.js +0 -1
- package/dist/src/execution/tool-run/owner-inbox.d.ts +0 -11
- package/dist/src/execution/tool-run/owner-inbox.js +0 -1
- package/dist/src/execution/tool-run/owner.d.ts +0 -13
- package/dist/src/execution/tool-run/owner.js +0 -1
- package/dist/src/execution/tool-run/run-control.d.ts +0 -18
- package/dist/src/execution/tool-run/run-control.js +0 -1
- package/dist/src/execution/tool-run/start.d.ts +0 -11
- package/dist/src/execution/tool-run/start.js +0 -1
- package/dist/src/execution/tool-run/types.d.ts +0 -21
- package/dist/src/execution/tool-run/types.js +0 -1
- package/dist/src/execution/tool-run/workflow.d.ts +0 -9
- package/dist/src/execution/tool-run/workflow.js +0 -1
- package/dist/src/execution/tools/subagent/local.d.ts +0 -40
- package/dist/src/execution/tools/subagent/local.js +0 -1
- package/dist/src/execution/tools/subagent/remote.d.ts +0 -26
- package/dist/src/execution/tools/subagent/remote.js +0 -1
- package/dist/src/harness/agent-handle-errors.js +0 -1
- package/dist/src/harness/handles/query.js +0 -1
- package/dist/src/harness/handles/store.js +0 -1
- package/dist/src/harness/handles/transitions.d.ts +0 -167
- package/dist/src/harness/handles/transitions.js +0 -1
- package/dist/src/harness/runtime-actions.js +0 -1
- package/dist/src/harness/session-token-limits.d.ts +0 -41
- package/dist/src/harness/session-token-limits.js +0 -1
- package/dist/src/harness/subagent-depth.d.ts +0 -10
- package/dist/src/harness/subagent-depth.js +0 -1
- package/dist/src/harness/subagent-token-budget.js +0 -1
- package/dist/src/harness/tool-runs.d.ts +0 -21
- package/dist/src/harness/tool-runs.js +0 -1
- package/dist/src/harness/turn-sleep.d.ts +0 -12
- package/dist/src/harness/turn-sleep.js +0 -1
- package/dist/src/harness/workflow-runtime-action-state.d.ts +0 -9
- package/dist/src/harness/workflow-runtime-action-state.js +0 -1
- package/dist/src/node_modules/.pnpm/@clack_core@1.3.1/node_modules/@clack/core/dist/index.js +0 -16
- package/dist/src/node_modules/.pnpm/fast-string-truncated-width@3.0.3/node_modules/fast-string-truncated-width/dist/index.js +0 -1
- package/dist/src/node_modules/.pnpm/fast-string-truncated-width@3.0.3/node_modules/fast-string-truncated-width/dist/utils.js +0 -1
- package/dist/src/node_modules/.pnpm/fast-string-width@3.0.2/node_modules/fast-string-width/dist/index.js +0 -1
- package/dist/src/node_modules/.pnpm/fast-wrap-ansi@0.2.2/node_modules/fast-wrap-ansi/lib/main.js +0 -5
- package/dist/src/node_modules/.pnpm/sisteransi@1.0.5/node_modules/sisteransi/src/index.js +0 -1
- package/dist/src/runtime/actions/keys.d.ts +0 -14
- package/dist/src/runtime/actions/keys.js +0 -1
- package/dist/src/tasks/wire.d.ts +0 -25
- package/dist/src/tasks/wire.js +0 -1
- /package/dist/src/compiled/@vercel/{sandbox-delete → sandbox-drives}/LICENSE +0 -0
- /package/dist/src/compiled/@vercel/{sandbox-delete → sandbox-drives}/_async-retry.d.ts +0 -0
- /package/dist/src/compiled/@vercel/{sandbox-delete → sandbox-drives}/_workflow-serde.d.ts +0 -0
- /package/dist/src/compiled/@vercel/{sandbox-delete → sandbox-drives}/api-client/api-error.d.ts +0 -0
- /package/dist/src/compiled/@vercel/{sandbox-delete → sandbox-drives}/api-client/base-client.d.ts +0 -0
- /package/dist/src/compiled/@vercel/{sandbox-delete → sandbox-drives}/api-client/file-writer.d.ts +0 -0
- /package/dist/src/compiled/@vercel/{sandbox-delete → sandbox-drives}/api-client/with-retry.d.ts +0 -0
- /package/dist/src/compiled/@vercel/{sandbox-delete → sandbox-drives}/auth/error.d.ts +0 -0
- /package/dist/src/compiled/@vercel/{sandbox-delete → sandbox-drives}/auth/file.d.ts +0 -0
- /package/dist/src/compiled/@vercel/{sandbox-delete → sandbox-drives}/auth/index.d.ts +0 -0
- /package/dist/src/compiled/@vercel/{sandbox-delete → sandbox-drives}/auth/oauth.d.ts +0 -0
- /package/dist/src/compiled/@vercel/{sandbox-delete → sandbox-drives}/auth/poll-for-token.d.ts +0 -0
- /package/dist/src/compiled/@vercel/{sandbox-delete → sandbox-drives}/auth/project.d.ts +0 -0
- /package/dist/src/compiled/@vercel/{sandbox-delete → sandbox-drives}/command.d.ts +0 -0
- /package/dist/src/compiled/@vercel/{sandbox-delete → sandbox-drives}/execution-context.d.ts +0 -0
- /package/dist/src/compiled/@vercel/{sandbox-delete → sandbox-drives}/filesystem.d.ts +0 -0
- /package/dist/src/compiled/@vercel/{sandbox-delete → sandbox-drives}/network-policy.d.ts +0 -0
- /package/dist/src/compiled/@vercel/{sandbox-delete → sandbox-drives}/proxy.d.ts +0 -0
- /package/dist/src/compiled/@vercel/{sandbox-delete → sandbox-drives}/sandbox-user.d.ts +0 -0
- /package/dist/src/compiled/@vercel/{sandbox-delete → sandbox-drives}/session.d.ts +0 -0
- /package/dist/src/compiled/@vercel/{sandbox-delete → sandbox-drives}/snapshot.d.ts +0 -0
- /package/dist/src/compiled/@vercel/{sandbox-delete → sandbox-drives}/utils/get-credentials.d.ts +0 -0
- /package/dist/src/compiled/@vercel/{sandbox-delete → sandbox-drives}/utils/paginator.d.ts +0 -0
- /package/dist/src/compiled/@vercel/{sandbox-delete → sandbox-drives}/utils/resolveSignal.d.ts +0 -0
- /package/dist/src/compiled/@vercel/{sandbox-delete → sandbox-drives}/utils/sandbox-snapshot.d.ts +0 -0
- /package/dist/src/compiled/@vercel/{sandbox-delete → sandbox-drives}/utils/types.d.ts +0 -0
- /package/dist/src/execution/{tool-run → tools/workflow}/owner-channels.d.ts +0 -0
- /package/dist/src/execution/{tool-run → tools/workflow}/owner-channels.js +0 -0
- /package/dist/src/execution/{tool-run → tools/workflow}/resume-hook-step.d.ts +0 -0
- /package/dist/src/execution/{tool-run → tools/workflow}/resume-hook-step.js +0 -0
- /package/dist/src/{execution/subagent-adapter.d.ts → subagents/adapter.d.ts} +0 -0
- /package/dist/src/{execution/session-callback-route.d.ts → subagents/callback-route.d.ts} +0 -0
- /package/dist/src/{execution/session-callback-step.d.ts → subagents/callback-step.d.ts} +0 -0
- /package/dist/src/{harness → subagents}/handles/operation-id.d.ts +0 -0
- /package/dist/src/{harness → subagents}/handles/operation-id.js +0 -0
- /package/dist/src/{harness → subagents}/handles/state-key.d.ts +0 -0
- /package/dist/src/{harness → subagents}/handles/state-key.js +0 -0
- /package/dist/src/{execution/subagent-hitl-proxy.d.ts → subagents/hitl-proxy.d.ts} +0 -0
- /package/dist/src/{execution/subagent-hitl-proxy.js → subagents/hitl-proxy.js} +0 -0
- /package/dist/src/{execution/subagent-invocation.d.ts → subagents/invocation.d.ts} +0 -0
- /package/dist/src/{execution/subagent-invocation.js → subagents/invocation.js} +0 -0
- /package/dist/src/{execution/delegated-parent-result.d.ts → subagents/parent-result.d.ts} +0 -0
- /package/dist/src/{execution/remote-agent-route-url.d.ts → subagents/remote-route-url.d.ts} +0 -0
- /package/dist/src/{execution/remote-agent-route-url.js → subagents/remote-route-url.js} +0 -0
- /package/dist/src/{harness/subagent-token-budget.d.ts → subagents/token-budget.d.ts} +0 -0
|
@@ -1,22 +1,16 @@
|
|
|
1
1
|
import type { ToolSet } from "ai";
|
|
2
2
|
import type { HarnessToolDefinition } from "#harness/execute-tool.js";
|
|
3
3
|
import type { HarnessSession, HarnessToolMap } from "#harness/types.js";
|
|
4
|
-
type AdvertisedToolSession = Pick<HarnessSession, "rootSessionId" | "
|
|
4
|
+
type AdvertisedToolSession = Pick<HarnessSession, "rootSessionId" | "taskId">;
|
|
5
5
|
type AdvertisedToolMapInput = {
|
|
6
|
-
readonly canRequestInput?: boolean;
|
|
7
|
-
readonly delegatedCaller?: boolean;
|
|
8
6
|
readonly session: AdvertisedToolSession;
|
|
9
7
|
readonly tools: HarnessToolMap;
|
|
10
8
|
};
|
|
11
9
|
type AdvertisedToolDefinitionsInput = {
|
|
12
|
-
readonly canRequestInput?: boolean;
|
|
13
|
-
readonly delegatedCaller?: boolean;
|
|
14
10
|
readonly session: AdvertisedToolSession;
|
|
15
11
|
readonly tools: readonly HarnessToolDefinition[];
|
|
16
12
|
};
|
|
17
13
|
type AdvertisedModelToolsInput = {
|
|
18
|
-
readonly canRequestInput?: boolean;
|
|
19
|
-
readonly delegatedCaller?: boolean;
|
|
20
14
|
readonly modelTools: ToolSet;
|
|
21
15
|
readonly session: HarnessSession;
|
|
22
16
|
readonly tools: HarnessToolMap;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{ensureWorkflowContinuationSecurity,getWorkflowContinuationSecurity}from"#harness/workflow-continuation-security.js";import{applyWorkflowTool}from"#harness/workflow-sandbox.js";function getAdvertisedTools(e){return`modelTools`in e?getAdvertisedModelTools(e):isToolDefinitionList(e.tools)?filterUnavailableToolDefinitions(e.tools,e.session):filterUnavailableToolMap(e.tools,e.session)}async function getAdvertisedModelTools(r){let i=filterUnavailableToolMap(r.tools,r.session);if(r.workflow===void 0)return{harnessTools:i,modelTools:r.modelTools,session:r.session};let a=filterWorkflowHostToolsForRootSession(i,r.session);if(a.size===0)return{harnessTools:i,modelTools:r.modelTools,session:r.session};let o=ensureWorkflowContinuationSecurity(r.session),{modelTools:s}=await applyWorkflowTool({continuationSecurity:getWorkflowContinuationSecurity(o),harnessTools:a,maxSubagents:r.workflow.maxSubagents,tools:r.modelTools});return{harnessTools:i,modelTools:s,session:o}}function filterUnavailableToolDefinitions(e,t){let n=[];for(let r of e)shouldHideTool(r,t)||n.push(r);return n}function filterUnavailableToolMap(e,t){let n=new Map;for(let[r,i]of e)shouldHideTool(i,t)||n.set(r,i);return n}function filterWorkflowHostToolsForRootSession(e,t){let n=new Map;if(t.rootSessionId!==void 0)return n;for(let[t,r]of e)r.resultKind===`subagent`&&n.set(t,r);return n}function shouldHideTool(e,t){let n=t.rootSessionId!==void 0;return e.rootOnly===!0||e.behavior?.availability.includes(`root-session`)===!0?n:e.behavior?.availability.includes(`delegated-task-child`)===!0&&t.taskId===void 0}function isToolDefinitionList(e){return Array.isArray(e)}export{getAdvertisedTools};
|
|
@@ -1,11 +1,16 @@
|
|
|
1
1
|
import { ContextKey } from "#context/key.js";
|
|
2
2
|
import type { ToolExecuteOptions } from "#tools/definition.js";
|
|
3
3
|
import type { TaskExec } from "#tools/task.js";
|
|
4
|
-
import type {
|
|
4
|
+
import type { AgentView } from "#subagents/handles/prompt.js";
|
|
5
|
+
import type { JsonValue } from "#shared/json.js";
|
|
5
6
|
export interface BackgroundExecutableTool {
|
|
6
|
-
readonly behavior?: PreparedToolBehavior;
|
|
7
7
|
readonly execute: (input: unknown, options: ToolExecuteOptions, task: TaskExec) => unknown;
|
|
8
|
+
readonly executeInput?: (input: unknown) => JsonValue;
|
|
8
9
|
readonly name: string;
|
|
10
|
+
readonly nodeId?: string;
|
|
11
|
+
readonly resultKind?: "subagent" | "tool";
|
|
12
|
+
/** Present when the execute body runs in the task-owned durable workflow. */
|
|
13
|
+
readonly workflowId?: string;
|
|
9
14
|
}
|
|
10
15
|
export interface BackgroundToolCall {
|
|
11
16
|
readonly callId: string;
|
|
@@ -22,6 +27,7 @@ export interface BackgroundToolCallBatch {
|
|
|
22
27
|
setTool(name: string, definition?: BackgroundExecutableTool): void;
|
|
23
28
|
}
|
|
24
29
|
export interface BackgroundToolExecutor {
|
|
30
|
+
readAgentViews?(): Promise<readonly AgentView[]>;
|
|
25
31
|
execute(input: {
|
|
26
32
|
readonly batch: BackgroundToolCallBatch;
|
|
27
33
|
readonly definition: BackgroundExecutableTool;
|
|
@@ -1,72 +1,79 @@
|
|
|
1
1
|
import type { ModelMessage, ToolSet, TypedToolCall } from "ai";
|
|
2
|
-
import type { RuntimeActionRequest } from "#shared/action-types.js";
|
|
3
|
-
import type { PendingDispatchAction } from "#shared/dispatch-action.js";
|
|
2
|
+
import type { RuntimeActionRequest, RuntimeToolCallActionRequest, RuntimeWorkflowTaskRequest } from "#shared/action-types.js";
|
|
4
3
|
import { type JsonObject } from "#shared/json.js";
|
|
5
4
|
import type { HarnessEmitFn, HarnessSession, HarnessToolMap, SessionStateMap, StepInput } from "#harness/types.js";
|
|
6
5
|
/**
|
|
7
|
-
* Serializable event coordinates for one pending
|
|
6
|
+
* Serializable event coordinates for one pending coordination batch.
|
|
8
7
|
*
|
|
9
8
|
* Runtime action results are projected back onto the parent stream using the
|
|
10
9
|
* same turn and step identity as the originating `actions.requested` batch.
|
|
11
10
|
*/
|
|
12
|
-
interface
|
|
11
|
+
interface PendingCoordinationEventMetadata {
|
|
13
12
|
readonly sequence: number;
|
|
14
13
|
readonly stepIndex: number;
|
|
15
14
|
readonly turnId: string;
|
|
16
15
|
}
|
|
17
16
|
/**
|
|
18
|
-
* Serializable pending
|
|
17
|
+
* Serializable pending coordination batch stored on `session.state`.
|
|
19
18
|
*
|
|
20
19
|
* Child ownership does not live here: the agent handle store records every
|
|
21
20
|
* dispatched child (from before its start side effect) and is the sole
|
|
22
21
|
* authority for continuing, settling, and cancelling children.
|
|
23
22
|
*/
|
|
24
|
-
export interface
|
|
25
|
-
|
|
26
|
-
readonly
|
|
23
|
+
export interface PendingCoordinationBatch {
|
|
24
|
+
/** Framework task controls deferred to the turn owner. */
|
|
25
|
+
readonly runtimeActions: readonly RuntimeToolCallActionRequest[];
|
|
26
|
+
/** Authored-tool and subagent workflow tasks pending coordination. */
|
|
27
|
+
readonly tasks: readonly RuntimeWorkflowTaskRequest[];
|
|
28
|
+
readonly event: PendingCoordinationEventMetadata;
|
|
29
|
+
readonly localFanoutSize?: number;
|
|
27
30
|
readonly responseMessages: readonly ModelMessage[];
|
|
28
31
|
}
|
|
29
32
|
/**
|
|
30
|
-
* Outcome of resolving a pending
|
|
33
|
+
* Outcome of resolving a pending coordination batch.
|
|
31
34
|
*/
|
|
32
|
-
interface
|
|
35
|
+
interface ResolvePendingCoordinationResult {
|
|
33
36
|
readonly messages: ModelMessage[];
|
|
34
37
|
readonly outcome: "continue" | "resolved" | "unresolved";
|
|
35
38
|
readonly session: HarnessSession;
|
|
36
39
|
}
|
|
37
|
-
/** Returns the pending
|
|
38
|
-
export declare function
|
|
40
|
+
/** Returns the pending coordination batch stored on the session, if any. */
|
|
41
|
+
export declare function getPendingCoordinationBatch(state: SessionStateMap | undefined): PendingCoordinationBatch | undefined;
|
|
39
42
|
/**
|
|
40
|
-
* Returns true when the session is parked on
|
|
43
|
+
* Returns true when the session is parked on pending task/control coordination.
|
|
41
44
|
*/
|
|
42
|
-
export declare function
|
|
43
|
-
export declare function
|
|
45
|
+
export declare function hasPendingCoordinationBatch(state: SessionStateMap | undefined): boolean;
|
|
46
|
+
export declare function clearPendingCoordinationBatch(session: HarnessSession): HarnessSession;
|
|
44
47
|
/**
|
|
45
|
-
* Stores one pending
|
|
48
|
+
* Stores one pending coordination batch on the session.
|
|
46
49
|
*/
|
|
47
|
-
export declare function
|
|
48
|
-
readonly
|
|
49
|
-
readonly
|
|
50
|
+
export declare function setPendingCoordinationBatch(input: {
|
|
51
|
+
readonly runtimeActions: readonly RuntimeToolCallActionRequest[];
|
|
52
|
+
readonly tasks: readonly RuntimeWorkflowTaskRequest[];
|
|
53
|
+
readonly event: PendingCoordinationEventMetadata;
|
|
54
|
+
readonly localFanoutSize?: number;
|
|
50
55
|
readonly responseMessages: readonly ModelMessage[];
|
|
51
56
|
readonly session: HarnessSession;
|
|
52
57
|
}): HarnessSession;
|
|
53
|
-
/** Rejects
|
|
54
|
-
export declare function
|
|
58
|
+
/** Rejects a batch before any result or side effect can bind ambiguously by call id. */
|
|
59
|
+
export declare function assertUniqueCoordinationCallIds(requests: readonly {
|
|
60
|
+
readonly callId: string;
|
|
61
|
+
}[]): void;
|
|
55
62
|
/**
|
|
56
|
-
* Resolves one pending
|
|
63
|
+
* Resolves one pending coordination batch back into model history.
|
|
57
64
|
*
|
|
58
65
|
* When all expected runtime action results are present, this appends the
|
|
59
66
|
* stored assistant tool-call messages plus synthesized tool-result messages to
|
|
60
67
|
* history, clears the pending batch, and emits `subagent.completed` and
|
|
61
68
|
* `action.result` events back onto the parent stream.
|
|
62
69
|
*/
|
|
63
|
-
export declare function
|
|
70
|
+
export declare function resolvePendingCoordination(input: {
|
|
64
71
|
readonly emit?: HarnessEmitFn;
|
|
65
72
|
readonly session: HarnessSession;
|
|
66
73
|
readonly stepInput?: StepInput;
|
|
67
74
|
/** Definitions whose `toModelOutput` projects a workflow tool's result for the model. */
|
|
68
75
|
readonly tools?: HarnessToolMap;
|
|
69
|
-
}): Promise<
|
|
76
|
+
}): Promise<ResolvePendingCoordinationResult>;
|
|
70
77
|
/**
|
|
71
78
|
* Projects one AI SDK tool call into the eve runtime-action contract.
|
|
72
79
|
*/
|
|
@@ -74,11 +81,17 @@ export declare function createRuntimeActionRequestFromToolCall(input: {
|
|
|
74
81
|
readonly toolCall: TypedToolCall<ToolSet>;
|
|
75
82
|
readonly tools: HarnessToolMap;
|
|
76
83
|
}): RuntimeActionRequest;
|
|
77
|
-
/** Projects one
|
|
78
|
-
export declare function
|
|
84
|
+
/** Projects one deferred harness tool call into task/control coordination. */
|
|
85
|
+
export declare function createCoordinationRequestFromToolCall(input: {
|
|
79
86
|
readonly toolCall: TypedToolCall<ToolSet>;
|
|
80
87
|
readonly tools: HarnessToolMap;
|
|
81
|
-
}):
|
|
88
|
+
}): {
|
|
89
|
+
readonly kind: "runtime-action";
|
|
90
|
+
readonly request: RuntimeToolCallActionRequest;
|
|
91
|
+
} | {
|
|
92
|
+
readonly kind: "task";
|
|
93
|
+
readonly request: RuntimeWorkflowTaskRequest;
|
|
94
|
+
};
|
|
82
95
|
/**
|
|
83
96
|
* Coerces an AI SDK tool-call `input` into the runtime-action `JsonObject`
|
|
84
97
|
* contract, throwing a `TypeError` (with the original as `cause`) that names
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{createActionResultEvent}from"#protocol/message.js";import{parseJsonObject}from"#shared/json.js";import{findWorkflowToolRun,isInboxSubagentResultFromRecordedWorkflowToolRun,removeWorkflowToolRun}from"#harness/workflow-tool-runs.js";import{clearProxyInputRequestsForChild,clearProxyInputRequestsWhere}from"#harness/proxy-input-requests.js";import{settleAgentTurn}from"#subagents/handles/transitions.js";import{accumulateSessionUsage,getTurnUsageState,setTurnUsageState}from"#harness/turn-tag-state.js";import{findRunningAgentHandle,isResultBoundToRunningHandle}from"#subagents/handles/query.js";import{resolveRuntimeActionResultsForCallIds}from"#runtime/actions/results.js";import{normalizeToolModelOutput}from"#harness/tool-model-output.js";const PENDING_COORDINATION_BATCH_KEY=`eve.runtime.pendingCoordinationBatch`;function readSubagentResultOutcome(e){return e.origin===`child`?e.outcome:void 0}function getPendingCoordinationBatch(e){let t=e?.[PENDING_COORDINATION_BATCH_KEY];if(typeof t!=`object`||!t)return;let n=t;if(!(!Array.isArray(n.runtimeActions)||!Array.isArray(n.tasks)||!Array.isArray(n.responseMessages)||typeof n.event!=`object`||n.event===null))return n}function hasPendingCoordinationBatch(e){return getPendingCoordinationBatch(e)!==void 0}function clearPendingCoordinationBatch(e){if(e.state?.[PENDING_COORDINATION_BATCH_KEY]===void 0)return e;let t={...e.state};return delete t[PENDING_COORDINATION_BATCH_KEY],{...e,state:Object.keys(t).length>0?t:void 0}}function setPendingCoordinationBatch(e){assertUniqueCoordinationCallIds([...e.runtimeActions,...e.tasks]);let t={...e.session.state};return t[PENDING_COORDINATION_BATCH_KEY]={runtimeActions:[...e.runtimeActions],tasks:[...e.tasks],event:e.event,localFanoutSize:e.localFanoutSize,responseMessages:[...e.responseMessages]},{...e.session,state:t}}function assertUniqueCoordinationCallIds(e){let t=new Set;for(let n of e){if(t.has(n.callId))throw Error(`Coordination batch contains duplicate callId "${n.callId}".`);t.add(n.callId)}}function resolveReadyCoordinationResults(e){let t=getPendingCoordinationBatch(e.session.state);if(t!==void 0)return resolveResultsForCoordinationBatch({batch:t,results:e.results,state:e.session.state})}function resolveResultsForCoordinationBatch(e){return resolveRuntimeActionResultsForCallIds({pendingCallIds:[...e.batch.runtimeActions,...e.batch.tasks].map(e=>e.callId),results:e.results.filter(t=>isResultBoundToRunningHandle(e.state,t)||t.kind===`subagent-result`&&isInboxSubagentResultFromRecordedWorkflowToolRun(e.state,t))})}async function resolvePendingCoordination(t){let r=getPendingCoordinationBatch(t.session.state);if(r===void 0)return{messages:[...t.session.history],outcome:`continue`,session:t.session};let i=resolveReadyCoordinationResults({results:t.stepInput?.runtimeActionResults??[],session:t.session});if(i===void 0)return{messages:[...t.session.history],outcome:`unresolved`,session:t.session};if(t.emit!==void 0)for(let n of i){if(n.kind===`subagent-result`&&n.isError!==!0){let e=readBackgroundTaskReceipt(n),r={callId:n.callId,output:typeof n.output==`string`?n.output:JSON.stringify(n.output),subagentName:n.subagentName};await t.emit({data:e===void 0?r:{...r,backgroundTask:e},type:`subagent.completed`})}await t.emit(createActionResultEvent({result:n,sequence:r.event.sequence,stepIndex:r.event.stepIndex,turnId:r.event.turnId}))}let a=t.session;for(let e of i){if(e.kind!==`subagent-result`||e.origin!==`child`||readBackgroundTaskReceipt(e)!==void 0)continue;let t=findRunningAgentHandle(a.state,{callId:e.callId});if(t===void 0)continue;let n=readSubagentResultOutcome(e);if(n===void 0)continue;n.kind===`terminal`&&`continuationToken`in t.address&&(a=clearProxyInputRequestsForChild(a,t.address.continuationToken));let r=settleAgentTurn(a,{operationId:t.operation.id,outcome:n});r.kind===`settled`&&(a=r.session)}for(let e of i){if(e.kind!==`tool-result`)continue;let t=findWorkflowToolRun(a.state,e.callId);t!==void 0&&(a=removeWorkflowToolRun(clearProxyInputRequestsWhere(a,e=>e.answerHook?.runId===t.runId),t.callId))}for(let e of i){if(e.kind!==`subagent-result`)continue;let t=findWorkflowToolRun(a.state,e.callId);t?.resultKind===`subagent`&&(a=removeWorkflowToolRun(clearProxyInputRequestsForChild(a,t.hookToken),t.callId))}let o={...a.state};delete o[PENDING_COORDINATION_BATCH_KEY],a={...a,state:Object.keys(o).length>0?o:void 0};for(let e of i){if(e.kind!==`subagent-result`)continue;let t=readSubagentResultOutcome(e);t!==void 0&&(a=setTurnUsageState(a,accumulateSessionUsage({previous:getTurnUsageState(a.state),usage:t.usageDelta})))}let s=[];for(let e of i){switch(e.kind){case`load-skill-result`:s.push({output:toToolResultOutput(e),toolCallId:e.callId,toolName:`load_skill`,type:`tool-result`});continue;case`subagent-result`:s.push({output:toToolResultOutput(e),toolCallId:e.callId,toolName:e.subagentName,type:`tool-result`});continue;case`tool-result`:s.push({output:await projectToolResultOutput(e,t.tools?.get(e.toolName)),toolCallId:e.callId,toolName:e.toolName,type:`tool-result`});continue}throw Error(`Unsupported runtime action result kind "${String(e)}".`)}let c=[...a.history,...r.responseMessages];return s.length>0&&c.push({content:s,role:`tool`}),{messages:c,outcome:`resolved`,session:a}}function readBackgroundTaskReceipt(e){return`backgroundTask`in e?e.backgroundTask:void 0}function createRuntimeActionRequestFromToolCall(e){return e.tools.get(e.toolCall.toolName)?.frameworkAction===`load-skill`?{callId:e.toolCall.toolCallId,input:resolveToolCallInputObject(e.toolCall.input,{callId:e.toolCall.toolCallId,toolName:e.toolCall.toolName}),kind:`load-skill`}:{callId:e.toolCall.toolCallId,input:resolveToolCallInputObject(e.toolCall.input,{callId:e.toolCall.toolCallId,toolName:e.toolCall.toolName}),kind:`tool-call`,toolName:e.toolCall.toolName}}function createCoordinationRequestFromToolCall(e){let t=e.tools.get(e.toolCall.toolName),n=resolveToolCallInputObject(e.toolCall.input,{callId:e.toolCall.toolCallId,toolName:e.toolCall.toolName});if(t?.runtimeAction?.kind===`task-control`)return{kind:`runtime-action`,request:{callId:e.toolCall.toolCallId,input:n,kind:`tool-call`,toolName:e.toolCall.toolName}};if(t?.workflowId!==void 0)return{kind:`task`,request:{callId:e.toolCall.toolCallId,executeInput:t.executeInput?.(n),input:n,kind:`workflow-task`,resultKind:t.resultKind,toolName:e.toolCall.toolName,workflowId:t.workflowId}};throw Error(`Deferred tool "${e.toolCall.toolName}" has no task or runtime action.`)}function resolveToolCallInputObject(e,n){if(e==null||typeof e==`string`&&e.trim()===``)return{};try{return parseJsonObject(typeof e==`string`?parseJsonStringInput(e):e)}catch(e){let t=e instanceof Error?e.message:String(e);throw TypeError(`Failed to parse tool-call arguments for "${n.toolName}" (${n.callId}): ${t}`,{cause:e})}}function parseJsonStringInput(e){return JSON.parse(e)}async function projectToolResultOutput(e,t){return e.isError===!0||t?.toModelOutput===void 0?toToolResultOutput(e):normalizeToolModelOutput({output:await t.toModelOutput(e.output),toolCallId:e.callId,toolName:e.toolName})}function toToolResultOutput(e){return typeof e.output==`string`?e.isError===!0?{type:`error-text`,value:e.output}:{type:`text`,value:e.output}:e.isError===!0?{type:`error-json`,value:toMutableJsonValue(e.output)}:{type:`json`,value:toMutableJsonValue(e.output)}}function toMutableJsonValue(e){if(e===null||typeof e==`string`||typeof e==`number`||typeof e==`boolean`)return e;if(Array.isArray(e))return e.map(e=>toMutableJsonValue(e));let t={};for(let[n,r]of Object.entries(e))t[n]=toMutableJsonValue(r);return t}export{assertUniqueCoordinationCallIds,clearPendingCoordinationBatch,createCoordinationRequestFromToolCall,createRuntimeActionRequestFromToolCall,getPendingCoordinationBatch,hasPendingCoordinationBatch,resolvePendingCoordination,resolveToolCallInputObject,setPendingCoordinationBatch};
|
|
@@ -53,7 +53,7 @@ export declare function advanceStep(state: HarnessEmissionState): HarnessEmissio
|
|
|
53
53
|
* Emits `turn.completed` and either `session.waiting` or `session.completed`.
|
|
54
54
|
* Returns updated emission state with an incremented sequence.
|
|
55
55
|
*/
|
|
56
|
-
export declare function emitTurnEpilogue(emitFn: HarnessEmitFn, state: HarnessEmissionState, mode: RunMode
|
|
56
|
+
export declare function emitTurnEpilogue(emitFn: HarnessEmitFn, state: HarnessEmissionState, mode: RunMode): Promise<HarnessEmissionState>;
|
|
57
57
|
/**
|
|
58
58
|
* Maps an AI SDK finish reason string to the eve-owned
|
|
59
59
|
* {@link AssistantStepFinishReason} union. Unknown values become `"other"`.
|
|
@@ -76,5 +76,12 @@ interface StreamActionEmissionOptions {
|
|
|
76
76
|
readonly excludedActionToolNames: ReadonlySet<string>;
|
|
77
77
|
readonly tools: HarnessToolMap;
|
|
78
78
|
}
|
|
79
|
-
/**
|
|
79
|
+
/**
|
|
80
|
+
* Consumes the AI SDK `fullStream` and emits real-time text and reasoning
|
|
81
|
+
* events.
|
|
82
|
+
*
|
|
83
|
+
* Emits local tool events in source order. Provider calls that arrive in one
|
|
84
|
+
* stream batch into one request event before their first result. A result
|
|
85
|
+
* without a streamed call resumes a call from an earlier step.
|
|
86
|
+
*/
|
|
80
87
|
export declare function emitStreamContent(emitFn: HarnessEmitFn, state: HarnessEmissionState, fullStream: AsyncIterable<TextStreamPart<ToolSet>>, options?: StreamActionEmissionOptions): Promise<EmittedStreamContent>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{createActionInputAppendedEvent,createActionPartialEvent,createActionResultEvent,createActionsRequestedEvent,createMessageAppendedEvent,createMessageCompletedEvent,createMessageReceivedEvent,createReasoningAppendedEvent,createReasoningCompletedEvent,createSessionCompletedEvent,createSessionFailedEvent,createSessionStartedEvent,createSessionWaitingEvent,createStepFailedEvent,createStepStartedEvent,createTurnCompletedEvent,createTurnFailedEvent,createTurnStartedEvent}from"#protocol/message.js";import{createRuntimeActionRequestFromToolCall}from"#harness/
|
|
1
|
+
import{createActionInputAppendedEvent,createActionPartialEvent,createActionResultEvent,createActionsRequestedEvent,createMessageAppendedEvent,createMessageCompletedEvent,createMessageReceivedEvent,createReasoningAppendedEvent,createReasoningCompletedEvent,createSessionCompletedEvent,createSessionFailedEvent,createSessionStartedEvent,createSessionWaitingEvent,createStepFailedEvent,createStepStartedEvent,createTurnCompletedEvent,createTurnFailedEvent,createTurnStartedEvent}from"#protocol/message.js";import{createRuntimeActionRequestFromToolCall}from"#harness/coordination.js";import{createRuntimeToolResultFromStepResult,createRuntimeToolResultFromToolError,createToolResultMessagePartFromToolError}from"#harness/action-result-helpers.js";import{hasEmptyDeliverySentinel}from"#shared/empty-delivery.js";import{createInvalidToolCallInputError,isInvalidToolCall,resolveProviderToolCallRequest}from"#harness/tool-call-input-errors.js";import{createProviderStreamActionBatch}from"#harness/stream-actions.js";import{normalizeModelStreamError}from"#harness/model-call-error.js";import{createOrderedStreamEmitter}from"#harness/ordered-stream-emitter.js";import{interruptStreamOnFailure}from"#harness/interruptible-stream.js";import{isInlineAuthorizationToolResult}from"#harness/inline-tool-authorization.js";import{getHarnessEmissionState,isHarnessBetweenTurns,setHarnessEmissionState}from"#harness/emission-state.js";async function emitTurnPreamble(e,t,n,r,i){let a=`turn_${n.sequence}`;return n.sessionStarted||await e(createSessionStartedEvent({runtime:r,trace:i})),await e(createTurnStartedEvent({sequence:n.sequence,trace:i,turnId:a})),t.message!==void 0&&await e(createMessageReceivedEvent({message:t.message,sequence:n.sequence,turnId:a})),{sessionStarted:!0,sequence:n.sequence,stepIndex:0,turnId:a}}async function emitStepStarted(e,t,n,r){await e(createStepStartedEvent({modelId:n,sequence:t.sequence,stepIndex:t.stepIndex,turnId:t.turnId}),r)}async function emitStepAndTurnFailed(e,t,n){await e(createStepFailedEvent({...n,sequence:t.sequence,stepIndex:t.stepIndex,turnId:t.turnId})),await e(createTurnFailedEvent({...n,sequence:t.sequence,turnId:t.turnId}))}async function emitFailedStep(e,t,n){await emitStepAndTurnFailed(e,t,n),await e(createSessionFailedEvent(n))}async function emitRecoverableFailedTurn(e,t,n){return await emitStepAndTurnFailed(e,t,n),await e(createSessionWaitingEvent()),{sessionStarted:t.sessionStarted,sequence:t.sequence+1,stepIndex:0,turnId:``}}function advanceStep(e){return{...e,stepIndex:e.stepIndex+1}}async function emitTurnEpilogue(e,t,n){return await e(createTurnCompletedEvent({sequence:t.sequence,turnId:t.turnId})),n===`conversation`?await e(createSessionWaitingEvent()):await e(createSessionCompletedEvent()),{sessionStarted:t.sessionStarted,sequence:t.sequence+1,stepIndex:0,turnId:``}}function normalizeAssistantStepFinishReason(e){switch(e){case`content-filter`:case`error`:case`length`:case`stop`:case`tool-calls`:return e;default:return`other`}}function readSubagentBackgroundTaskReceipt(e,t){if(e.isError===!0||t?.get(e.toolName)?.resultKind!==`subagent`||typeof e.output!=`object`||e.output===null||Array.isArray(e.output))return;let n=Reflect.get(e.output,`status`),r=Reflect.get(e.output,`taskId`);return n===`working`&&typeof r==`string`?{status:n,taskId:r}:void 0}async function emitStreamContent(e,t,n,r){let i=createOrderedStreamEmitter(e),a=createProviderStreamActionBatch({emitFn:i.emit,state:t});try{return await consumeStreamContent(i.emit,t,interruptStreamOnFailure(n,i.failureSignal),a,r)}finally{try{await a.cancel()}finally{await i.closeAndDrain()}}}async function consumeStreamContent(o,s,c,l,u){let d=``,f=``,p=`stop`,m,h=new Set,g=new Set,_=new Set,v=new Set,y=new Set,b=new Set,x=[],S=[],C=new Map,flushCurrentMessage=async()=>{f.length!==0&&(await o(createMessageCompletedEvent({finishReason:`tool-calls`,message:f,sequence:s.sequence,stepIndex:s.stepIndex,turnId:s.turnId})),f=``)},emitActionInput=async(t,n,r)=>o(createActionInputAppendedEvent({callId:t,inputTextDelta:r,sequence:s.sequence,stepIndex:s.stepIndex,toolName:n,turnId:s.turnId})),emitActionRequest=async e=>{g.has(e.callId)||(f.trim().length>0&&await flushCurrentMessage(),g.add(e.callId),await o(createActionsRequestedEvent({actions:[e],sequence:s.sequence,stepIndex:s.stepIndex,turnId:s.turnId})))},collectProviderToolCall=async e=>{if(v.has(e.toolCallId)||(v.add(e.toolCallId),g.has(e.toolCallId)))return;g.add(e.toolCallId),f.trim().length>0&&await flushCurrentMessage();let t=resolveProviderToolCallRequest(e);if(t.toolError!==void 0){b.add(e.toolCallId),await emitActionResult(createRuntimeToolResultFromToolError(t.toolError)),y.add(e.toolCallId),S.push(createToolResultMessagePartFromToolError(t.toolError));return}l.observe(t.request)},emitActionResult=async e=>{if(_.has(e.callId))return;_.add(e.callId);let t=readSubagentBackgroundTaskReceipt(e,u?.tools);t!==void 0&&await o({data:{backgroundTask:t,callId:e.callId,output:typeof e.output==`string`?e.output:JSON.stringify(e.output),subagentName:e.toolName},type:`subagent.completed`}),await o(createActionResultEvent({result:e,sequence:s.sequence,stepIndex:s.stepIndex,turnId:s.turnId}))},emitActionPartial=async e=>{await o(createActionPartialEvent({result:e,sequence:s.sequence,stepIndex:s.stepIndex,turnId:s.turnId}))},emitToolCall=async e=>{if(isInvalidToolCall(e)){b.add(e.toolCallId);return}if(!(u===void 0||u.excludedActionToolNames.has(e.toolName)))try{await emitActionRequest(createRuntimeActionRequestFromToolCall({toolCall:e,tools:u.tools}))}catch(t){if(t instanceof TypeError){let n=createInvalidToolCallInputError({error:t,toolCall:e});b.add(e.toolCallId),f.trim().length>0&&await flushCurrentMessage(),await emitActionResult(createRuntimeToolResultFromToolError(n)),y.add(e.toolCallId),S.push(createToolResultMessagePartFromToolError(n));return}throw t}};for await(let e of c)if(m===void 0)switch(e.type){case`reasoning-delta`:await l.flush(),d+=e.text,await o(createReasoningAppendedEvent({reasoningDelta:e.text,sequence:s.sequence,stepIndex:s.stepIndex,turnId:s.turnId}));break;case`text-delta`:await l.flush(),d.trim().length>0&&(await o(createReasoningCompletedEvent({reasoning:d,sequence:s.sequence,stepIndex:s.stepIndex,turnId:s.turnId})),d=``),f+=e.text,await o(createMessageAppendedEvent({messageDelta:e.text,sequence:s.sequence,stepIndex:s.stepIndex,turnId:s.turnId}));break;case`tool-input-start`:if(u===void 0||e.providerExecuted===!0||u.excludedActionToolNames.has(e.toolName)){C.delete(e.id);break}await l.flush(),f.trim().length>0&&await flushCurrentMessage(),C.set(e.id,{toolName:e.toolName});break;case`tool-input-delta`:{let t=C.get(e.id);if(t===void 0)break;await l.flush(),await emitActionInput(e.id,t.toolName,e.delta);break}case`tool-input-end`:C.delete(e.id);break;case`tool-call`:{let t=e;C.delete(t.toolCallId),h.add(t.toolCallId),t.providerExecuted===!0?await collectProviderToolCall(t):(await l.flush(),await emitToolCall(t));break}case`tool-result`:{let t=e;if(t.preliminary===!0){t.providerExecuted!==!0&&await emitActionPartial(createRuntimeToolResultFromStepResult(t));break}if(t.providerExecuted===!0){await collectProviderToolCall({input:`input`in t?t.input:void 0,toolCallId:t.toolCallId,toolName:t.toolName}),await l.flush(),await emitActionResult(createRuntimeToolResultFromStepResult(t));break}if(h.has(e.toolCallId)){if(isInlineAuthorizationToolResult(t))break;g.has(e.toolCallId)&&(await emitActionResult(createRuntimeToolResultFromStepResult(t)),y.add(e.toolCallId));break}if(await l.flush(),await flushCurrentMessage(),isInlineAuthorizationToolResult(t)){y.add(e.toolCallId),x.push(t);break}await emitActionResult(createRuntimeToolResultFromStepResult(t)),y.add(e.toolCallId);break}case`tool-error`:{let t=e;t.providerExecuted===!0?(await collectProviderToolCall(t),await l.flush(),await emitActionResult(createRuntimeToolResultFromToolError(t))):g.has(t.toolCallId)&&(await emitActionResult(createRuntimeToolResultFromToolError(t)),y.add(t.toolCallId),S.push(createToolResultMessagePartFromToolError(t)));break}case`finish-step`:p=normalizeAssistantStepFinishReason(e.finishReason),await l.flush();break;case`error`:m=normalizeModelStreamError(e.error);break;case`abort`:throw new DOMException(e.reason??`The model stream was aborted.`,`AbortError`);default:break}if(await l.flush(),m!==void 0)throw m;return d.trim().length>0&&await o(createReasoningCompletedEvent({reasoning:d,sequence:s.sequence,stepIndex:s.stepIndex,turnId:s.turnId})),p!==`tool-calls`&&hasEmptyDeliverySentinel(f)?await o(createMessageCompletedEvent({finishReason:p,message:null,sequence:s.sequence,stepIndex:s.stepIndex,turnId:s.turnId})):f.trim().length>0&&await o(createMessageCompletedEvent({finishReason:p,message:f,sequence:s.sequence,stepIndex:s.stepIndex,turnId:s.turnId})),{emittedActionCallIds:g,handledInlineToolResultCallIds:y,invalidInputToolCallIds:b,inlineAuthorizationResults:x,trailingInlineToolResultParts:S}}export{advanceStep,emitFailedStep,emitRecoverableFailedTurn,emitStepStarted,emitStreamContent,emitTurnEpilogue,emitTurnPreamble,getHarnessEmissionState,isHarnessBetweenTurns,normalizeAssistantStepFinishReason,setHarnessEmissionState};
|
|
@@ -2,7 +2,19 @@ import type { FlexibleSchema } from "ai";
|
|
|
2
2
|
import type { Approval } from "#approval/definition.js";
|
|
3
3
|
import type { ToolExecuteOptions } from "#tools/definition.js";
|
|
4
4
|
import type { TaskExec } from "#tools/task.js";
|
|
5
|
+
import type { JsonValue } from "#shared/json.js";
|
|
5
6
|
import type { PreparedToolBehavior } from "#tools/behavior.js";
|
|
7
|
+
/**
|
|
8
|
+
* Runtime-owned action metadata attached to one harness-visible tool.
|
|
9
|
+
*
|
|
10
|
+
* `task-control` marks the parent-side background task tools
|
|
11
|
+
* (`task_cancel`, `task_update`): they carry no child
|
|
12
|
+
* address of their own — the dispatch step resolves targets through the
|
|
13
|
+
* session task index by tool name.
|
|
14
|
+
*/
|
|
15
|
+
export type HarnessRuntimeActionDefinition = {
|
|
16
|
+
readonly kind: "task-control";
|
|
17
|
+
};
|
|
6
18
|
/**
|
|
7
19
|
* Unified harness-owned tool definition.
|
|
8
20
|
*/
|
|
@@ -11,10 +23,50 @@ export interface HarnessToolDefinition {
|
|
|
11
23
|
readonly behavior?: PreparedToolBehavior;
|
|
12
24
|
readonly description: string;
|
|
13
25
|
readonly execute?: (input: any, options: ToolExecuteOptions, task?: TaskExec) => any;
|
|
26
|
+
/** Optional JSON input substituted when this tool starts its workflow body. */
|
|
27
|
+
readonly executeInput?: (input: unknown) => JsonValue;
|
|
14
28
|
readonly execution?: "background";
|
|
29
|
+
readonly frameworkAction?: "load-skill";
|
|
15
30
|
readonly inputSchema: FlexibleSchema;
|
|
16
31
|
readonly name: string;
|
|
32
|
+
/** Runtime graph node for a framework subagent workflow body. */
|
|
33
|
+
readonly nodeId?: string;
|
|
17
34
|
readonly approval?: Approval;
|
|
18
35
|
readonly outputSchema?: FlexibleSchema;
|
|
36
|
+
/**
|
|
37
|
+
* How the result of this workflow-backed tool is settled: as a
|
|
38
|
+
* `subagent-result` (delegation tools — `behavior.handling.target.kind` is
|
|
39
|
+
* `subagent-call`, `remote-agent-call`, or `self-agent-call`) or as an
|
|
40
|
+
* ordinary `tool-result` (authored workflow tools). Absent means `"tool"`.
|
|
41
|
+
*
|
|
42
|
+
* On the definition itself this duplicates the dispatch target kind; it
|
|
43
|
+
* exists because the value must survive past the tool map. `buildToolSet`,
|
|
44
|
+
* `createCoordinationRequestFromToolCall`, and the workflow sandbox host
|
|
45
|
+
* tool copy it into the `RuntimeWorkflowTaskRequest`, which `startWorkflowTask`
|
|
46
|
+
* persists on the `WorkflowToolRunRecord` in session state and the run echoes
|
|
47
|
+
* back on every `WorkflowToolRunRef` inbox message. The owner turn then routes
|
|
48
|
+
* outcomes, counts the workflow subagent budget, and decides whether child
|
|
49
|
+
* usage accrues without access to a `HarnessToolMap`. Harness-side readers
|
|
50
|
+
* (`advertised-tools`, `emission`, the background tool executor) use it to
|
|
51
|
+
* expose only delegation tools inside workflow sandboxes, emit task receipts,
|
|
52
|
+
* and reserve/claim agent handles for subagent starts.
|
|
53
|
+
*
|
|
54
|
+
* The persisted copy is dropped by `removeWorkflowToolRun` when the run
|
|
55
|
+
* settles, or `clearWorkflowToolRuns` at turn end.
|
|
56
|
+
*
|
|
57
|
+
* TODO: once subagent starts no longer need harness-specific handling,
|
|
58
|
+
* derive this from `behavior.handling.target.kind` at the projection points
|
|
59
|
+
* above and remove the field.
|
|
60
|
+
*/
|
|
61
|
+
readonly resultKind?: "subagent" | "tool";
|
|
62
|
+
/**
|
|
63
|
+
* Advertise this tool only to the root session, hiding it from subagent
|
|
64
|
+
* sessions. Set on the injected `agent` self-delegation tool so children
|
|
65
|
+
* cannot delegate recursively. Absent means visible everywhere.
|
|
66
|
+
*/
|
|
67
|
+
readonly rootOnly?: boolean;
|
|
68
|
+
readonly runtimeAction?: HarnessRuntimeActionDefinition;
|
|
19
69
|
readonly toModelOutput?: (output: unknown) => unknown;
|
|
70
|
+
/** Present when this tool starts an associated durable workflow. */
|
|
71
|
+
readonly workflowId?: string;
|
|
20
72
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{getPendingInputBatches,queueDeferredStepInput,removePendingInputBatches}from"#harness/pending-input-batches.js";import{buildResolvedInputBatch}from"#harness/input-request-resolution.js";import{appendResolvedBatchTranscript,compactStepInput,finishResolvedInput,responsesForBatches}from"#harness/hitl/pending-input-resolution.js";import{isSessionLimitContinuationRequest,resolveSessionLimitContinuation}from"#harness/session-limit-continuation.js";function isSessionLimitInputBatch(e){let t=e.requests.some(e=>e.kind===`session-limit`);if(t&&e.requests.some(e=>e.kind!==`session-limit`))throw TypeError(`Session-limit pending input batches must contain only session-limit requests.`);return t}function resolveSessionLimitInput(e){let r=new Set(e.responses.map(e=>e.requestId));if(!(e.pendingBatch.requests.some(e=>r.has(e.requestId))&&e.pendingBatch.requests.every(e=>r.has(e.requestId))))return{deferredMessage:!0,outcome:`unresolved`,messages:[...e.baseHistory],session:queueDeferredStepInput(e.session,compactStepInput(e.resolvedStepInput))};let i=e.batches.filter(t=>t!==e.pendingBatch),a=responsesForBatches(e.responses,i),o=i.some(e=>e.requests.some(e=>isSessionLimitContinuationRequest(e))),s=[...e.baseHistory];appendResolvedBatchTranscript(s,e.pendingBatch,[]);let c=removePendingInputBatches(e.session,[e.pendingBatch]),l=resolveSessionLimitContinuation({requests:e.pendingBatch.requests,responses:e.responses});return finishResolvedInput({deferTurnInput:e.deferTurnInput||o,leftoverResponses:a,limitContinuation:l,messages:s,resolvedInputs:[buildResolvedInputBatch(e.pendingBatch,e.responses)].filter(e=>e!==void 0),resolvedStepInput:e.resolvedStepInput,session:c})}function clearPendingSessionLimitPrompt(t){let n=getPendingInputBatches(t.state).filter(e=>e.requests.length>0&&e.requests.every(e=>isSessionLimitContinuationRequest(e)));return n.length===0?t:removePendingInputBatches(t,n)}export{clearPendingSessionLimitPrompt,isSessionLimitInputBatch,resolveSessionLimitInput};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{readClientContext}from"#internal/client-context.js";import{resolveTextToResponses}from"#channel/resolve-text.js";import{resolveToolCallInputObject}from"#harness/
|
|
1
|
+
import{readClientContext}from"#internal/client-context.js";import{resolveTextToResponses}from"#channel/resolve-text.js";import{resolveToolCallInputObject}from"#harness/coordination.js";import{isApprovalRequest}from"#harness/input-request-class.js";import{appendPendingInputBatch,consumeDeferredStepInput,getPendingInputBatches,getPendingInputRequestIds,hasDeferredStepInput,hasPendingInputBatch,queueDeferredStepInput}from"#harness/pending-input-batches.js";import{compactStepInput}from"#harness/hitl/pending-input-resolution.js";import{resolveQuestionOnlyInputBatches}from"#harness/hitl/question-input-requests.js";import{hasTailApprovalResponse}from"#harness/current-messages.js";import{getApprovedTools,hasAnsweredApprovalBatch,resolveApprovalInputBatches}from"#harness/hitl/approval-input-requests.js";import{clearPendingSessionLimitPrompt,isSessionLimitInputBatch,resolveSessionLimitInput}from"#harness/hitl/session-limit-input-requests.js";function hasStepInput(e){return e===void 0?!1:e.message!==void 0||(e.inputResponses?.length??0)>0}function hasPendingApprovalBatch(e){return getPendingInputBatches(e.state).some(e=>e.requests.some(e=>isApprovalRequest(e)))}function resolvePendingInput(t){let n=[...t.history??t.session.history],r=getPendingInputBatches(t.session.state);if(r.length===0)return{outcome:`continue`,messages:n,session:t.session};let i=routePendingInput(r),a=hasTailApprovalResponse(n),s=i.kind===`session-limit`?i.batch:r.length===1?r[0]:void 0,c=s===void 0?t.stepInput:resolveTextMessageInput(s,t.stepInput),l=canonicalizeInputResponses(c?.inputResponses??[]);if(i.kind===`approval`&&t.deferMessagesWhileApprovalsPending===!0&&c?.message!==void 0&&!hasAnsweredApprovalBatch(i.approvalBatches,l))return{deferredMessage:!0,outcome:`unresolved`,messages:n,session:queueDeferredStepInput(t.session,compactStepInput(c))};if(l.length===0&&c?.message===void 0){let r=compactStepInput(c);return{outcome:`unresolved`,messages:n,session:r.context!==void 0||readClientContext(r)!==void 0||r.outputSchema!==void 0?queueDeferredStepInput(t.session,r):t.session}}let u={baseHistory:n,batches:r,deferTurnInput:a,resolvedStepInput:c,responses:l,session:t.session};switch(i.kind){case`session-limit`:return resolveSessionLimitInput({...u,pendingBatch:i.batch});case`approval`:return resolveApprovalInputBatches({...u,approvalBatches:i.approvalBatches,questionBatches:i.questionBatches,resolveApprovalKey:t.resolveApprovalKey});case`question`:return resolveQuestionOnlyInputBatches(u)}}function routePendingInput(e){let t=e.map(e=>({batch:e,domain:classifyPendingInputBatch(e)})),n=t.find(({domain:e})=>e===`session-limit`)?.batch;if(n!==void 0)return{batch:n,kind:`session-limit`};let r=t.filter(({domain:e})=>e===`approval`).map(({batch:e})=>e);if(r.length>0){let t=new Set(r);return{approvalBatches:r,kind:`approval`,questionBatches:e.filter(e=>!t.has(e))}}return{kind:`question`}}function classifyPendingInputBatch(e){for(let t of e.requests)switch(t.kind){case`question`:case`session-limit`:case`tool-approval`:break;default:{let e=t.kind;throw TypeError(`Unhandled pending input request kind: ${String(e)}`)}}return isSessionLimitInputBatch(e)?`session-limit`:e.requests.some(e=>isApprovalRequest(e))?`approval`:`question`}function canonicalizeInputResponses(e){let t=new Map;for(let n of e)t.set(n.requestId,n);return[...t.values()]}function resolveTextMessageInput(e,n){if(typeof n?.message!=`string`)return n;let r=new Set(e.requests.map(e=>e.requestId));if(n.inputResponses?.some(e=>r.has(e.requestId)))return n;let i=new Set(e.responseAuthRequiredRequestIds??[]),a=e.requests.filter(e=>!i.has(e.requestId)),o=resolveTextToResponses(n.message,a);return o.length===0?n:compactStepInput({...n,inputResponses:[...n.inputResponses??[],...o],messageConsumed:!0,message:void 0})}function createRuntimeToolCallActionFromToolCall(e){return{callId:e.toolCall.toolCallId,input:resolveToolCallInputObject(e.toolCall.input,{callId:e.toolCall.toolCallId,toolName:e.toolCall.toolName}),kind:`tool-call`,toolName:e.toolCall.toolName}}export{appendPendingInputBatch,clearPendingSessionLimitPrompt,consumeDeferredStepInput,createRuntimeToolCallActionFromToolCall,getApprovedTools,getPendingInputRequestIds,hasDeferredStepInput,hasPendingApprovalBatch,hasPendingInputBatch,hasStepInput,resolvePendingInput};
|
|
@@ -61,13 +61,17 @@ export declare function upsertProxyInputRequestState(input: {
|
|
|
61
61
|
*/
|
|
62
62
|
export declare function clearProxyInputRequestsForChild(session: HarnessSession, childContinuationToken: string): HarnessSession;
|
|
63
63
|
/** Removes every proxy route the predicate selects. */
|
|
64
|
-
export declare function clearProxyInputRequestsWhere
|
|
64
|
+
export declare function clearProxyInputRequestsWhere<T extends {
|
|
65
|
+
readonly state?: SessionStateMap;
|
|
66
|
+
}>(session: T, select: (route: ProxyInputRequest) => boolean): T;
|
|
65
67
|
/** Removes only the request IDs whose responses were successfully forwarded. */
|
|
66
68
|
export declare function retireProxyInputRequests<T extends {
|
|
67
69
|
readonly state?: SessionStateMap;
|
|
68
70
|
}>(session: T, requestIds: readonly string[]): T;
|
|
69
71
|
/** Removes every proxy route owned by one durable task. */
|
|
70
|
-
export declare function clearProxyInputRequestsForTask
|
|
72
|
+
export declare function clearProxyInputRequestsForTask<T extends {
|
|
73
|
+
readonly state?: SessionStateMap;
|
|
74
|
+
}>(session: T, taskId: string): T;
|
|
71
75
|
/**
|
|
72
76
|
* Removes every proxy entry. Called when a cancelled turn orphans its
|
|
73
77
|
* descendants so stale HITL responses no longer route to them.
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Deterministic HITL continuation prompt for session
|
|
2
|
+
* Deterministic HITL continuation prompt for session usage limits.
|
|
3
3
|
*
|
|
4
|
-
* When a durable session reaches its configured token budget, the harness
|
|
4
|
+
* When a durable session reaches its configured token or token-cost budget, the harness
|
|
5
5
|
* parks on a harness-authored input request instead of failing the session.
|
|
6
6
|
* The request is derived only from the session identity and violation, so
|
|
7
7
|
* identical session state always produces an identical prompt — no model call
|
|
8
8
|
* is involved.
|
|
9
9
|
*/
|
|
10
10
|
import type { InputRequest, InputResponse } from "#shared/input.js";
|
|
11
|
-
import type {
|
|
11
|
+
import type { SessionUsageLimitViolation } from "#harness/turn-tag-state.js";
|
|
12
12
|
/** Synthetic action tool name carried by session-limit continuation requests. */
|
|
13
13
|
export declare const SESSION_LIMIT_CONTINUATION_TOOL_NAME = "session_limit_continuation";
|
|
14
14
|
/** Option id that grants a fresh token budget window. */
|
|
@@ -16,12 +16,12 @@ export declare const SESSION_LIMIT_CONTINUE_OPTION_ID = "continue";
|
|
|
16
16
|
/** Option id that declines continuation and ends the session. */
|
|
17
17
|
export declare const SESSION_LIMIT_STOP_OPTION_ID = "stop";
|
|
18
18
|
/**
|
|
19
|
-
* Builds the deterministic continuation prompt for one session
|
|
19
|
+
* Builds the deterministic continuation prompt for one session usage-limit
|
|
20
20
|
* violation.
|
|
21
21
|
*/
|
|
22
22
|
export declare function createSessionLimitContinuationRequest(input: {
|
|
23
23
|
readonly sessionId: string;
|
|
24
|
-
readonly violation:
|
|
24
|
+
readonly violation: SessionUsageLimitViolation;
|
|
25
25
|
}): InputRequest;
|
|
26
26
|
/**
|
|
27
27
|
* Returns true when a request is a harness-authored session-limit
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const SESSION_LIMIT_CONTINUATION_TOOL_NAME=`session_limit_continuation`,SESSION_LIMIT_CONTINUE_OPTION_ID=`continue`,SESSION_LIMIT_STOP_OPTION_ID=`stop`;function createSessionLimitContinuationRequest(r){let{sessionId:i,violation:a}=r,o=`${i}:limit:${a.kind}:${String(
|
|
1
|
+
const SESSION_LIMIT_CONTINUATION_TOOL_NAME=`session_limit_continuation`,SESSION_LIMIT_CONTINUE_OPTION_ID=`continue`,SESSION_LIMIT_STOP_OPTION_ID=`stop`;function createSessionLimitContinuationRequest(r){let{sessionId:i,violation:a}=r,o=a.kind===`token-cost`?a.usedCostUsd:a.usedTokens,s=`${i}:limit:${a.kind}:${String(o)}`;return{action:{callId:s,input:a.kind===`token-cost`?{kind:a.kind,limitUsd:a.limitUsd,usedCostUsd:a.usedCostUsd}:{kind:a.kind,limit:a.limit,usedTokens:a.usedTokens},kind:`tool-call`,toolName:SESSION_LIMIT_CONTINUATION_TOOL_NAME},allowFreeform:!1,display:`confirmation`,kind:`session-limit`,options:[{description:a.kind===`token-cost`?`Grant a fresh model token-cost budget`:`Grant a fresh token budget`,id:SESSION_LIMIT_CONTINUE_OPTION_ID,label:`Approve`,style:`primary`},{description:`Stop now`,id:SESSION_LIMIT_STOP_OPTION_ID,label:`Stop`,style:`danger`}],prompt:formatSessionLimitPrompt(a),requestId:s}}function formatCompactTokenCount(e){return e>=1e6?`${trimTrailingZero(e/1e6)}M`:e>=1e3?`${trimTrailingZero(e/1e3)}K`:String(e)}function trimTrailingZero(e){let t=e.toFixed(1);return t.endsWith(`.0`)?t.slice(0,-2):t}function formatSessionLimitPrompt(e){return`This session has hit the ${e.kind===`token-cost`?`${formatUsd(e.limitUsd)} model token-cost limit per session`:`${e.kind}-token limit (${formatCompactTokenCount(e.limit)}) per session`}. This is a guardrail against defective long-running sessions. If session activity looks fine, just approve to keep going.`}function formatUsd(e){return`$${(e<1e-6?String(e):e.toFixed(6)).replace(/0+$/u,``).replace(/\.$/u,``)}`}function isSessionLimitContinuationRequest(e){return e.kind===`session-limit`}function isSessionLimitContinuationRequestId(e){return/:limit:(?:input|output):\d+$/u.test(e)||/:limit:token-cost:\d+(?:\.\d+)?(?:e[+-]?\d+)?$/iu.test(e)}function resolveSessionLimitContinuation(e){let t=e.requests.find(isSessionLimitContinuationRequest);if(t===void 0)return;let n=e.responses.find(e=>e.requestId===t.requestId);if(n!==void 0){if(n.optionId===`continue`)return{granted:!0};if(n.optionId===`stop`)return{granted:!1}}}export{SESSION_LIMIT_CONTINUATION_TOOL_NAME,SESSION_LIMIT_CONTINUE_OPTION_ID,SESSION_LIMIT_STOP_OPTION_ID,createSessionLimitContinuationRequest,isSessionLimitContinuationRequest,isSessionLimitContinuationRequestId,resolveSessionLimitContinuation};
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Session token limit policy for the tool-loop harness.
|
|
2
|
+
* Session token and token-cost limit policy for the tool-loop harness.
|
|
3
3
|
*
|
|
4
4
|
* Two seams into the harness step:
|
|
5
5
|
*
|
|
6
6
|
* 1. {@link applySessionLimitContinuation} runs after pending-input
|
|
7
7
|
* resolution and acts on the user's answer to a continuation prompt —
|
|
8
8
|
* grant a fresh budget window, or cancel the in-flight turn tree.
|
|
9
|
-
* 2. {@link
|
|
9
|
+
* 2. {@link enforceSessionUsageLimit} runs before each model call and, when
|
|
10
10
|
* the session is over budget, parks it on the deterministic continuation
|
|
11
11
|
* prompt (sessions that can reach a human) or fails it (task-mode sessions
|
|
12
12
|
* without HITL — nobody can answer the prompt).
|
|
@@ -24,7 +24,7 @@ interface SessionLimitPolicyInput {
|
|
|
24
24
|
* Acts on a resolved session-limit continuation answer.
|
|
25
25
|
*
|
|
26
26
|
* Granted: bumps the runtime token limits via
|
|
27
|
-
* {@link
|
|
27
|
+
* {@link bumpSessionRuntimeUsageLimits} and lets the step continue
|
|
28
28
|
* transparently.
|
|
29
29
|
* Declined: a user decision, not an error — the decline cancels the
|
|
30
30
|
* in-flight turn tree through the standard cancellation path, settling as
|
|
@@ -53,7 +53,7 @@ export declare function applySessionLimitContinuation(input: SessionLimitPolicyI
|
|
|
53
53
|
* task-mode sessions without HITL fail fast with
|
|
54
54
|
* `SESSION_TOKEN_LIMIT_REACHED`.
|
|
55
55
|
*/
|
|
56
|
-
export declare function
|
|
56
|
+
export declare function enforceSessionUsageLimit(input: SessionLimitPolicyInput & {
|
|
57
57
|
readonly messages: readonly ModelMessage[];
|
|
58
58
|
}): Promise<StepResult | null>;
|
|
59
59
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{createInputRequestedEvent}from"#protocol/message.js";import{emitFailedStep,emitTurnEpilogue,setHarnessEmissionState}from"#harness/emission.js";import{SessionLimitDeclinedError}from"#harness/turn-cancellation.js";import{appendPendingInputBatch}from"#harness/input-requests.js";import{
|
|
1
|
+
import{createInputRequestedEvent}from"#protocol/message.js";import{emitFailedStep,emitTurnEpilogue,setHarnessEmissionState}from"#harness/emission.js";import{SessionLimitDeclinedError}from"#harness/turn-cancellation.js";import{appendPendingInputBatch}from"#harness/input-requests.js";import{bumpSessionRuntimeUsageLimits,getSessionTokenUsage,getSessionUsageLimitViolation}from"#harness/turn-tag-state.js";import{createSessionLimitContinuationRequest}from"#harness/session-limit-continuation.js";async function applySessionLimitContinuation(e){if(e.limitContinuation===void 0)return{result:null,session:e.session};if(e.limitContinuation.granted)return{result:null,session:bumpSessionRuntimeUsageLimits(e.session)};if(!(e.config.mode===`conversation`||e.session.continuationToken!==``)){let t=getSessionUsageLimitViolation(e.session);return{result:t===null?{next:{done:!0,output:``},session:e.session}:await failSessionUsageLimit({...e,violation:t}),session:e.session}}throw new SessionLimitDeclinedError}async function enforceSessionUsageLimit(e){let t=getSessionUsageLimitViolation(e.session);if(t===null)return null;let{emit:n}=e;return violationWindow(t)>0&&n!==void 0&&(e.config.mode===`conversation`||e.config.capabilities?.requestInput===!0)?parkOnSessionUsageLimit({...e,emit:n,violation:t}):failSessionUsageLimit({...e,violation:t})}async function parkOnSessionUsageLimit(t){let i=createSessionLimitContinuationRequest({sessionId:t.session.sessionId,violation:t.violation}),a=t.emissionState,o=appendPendingInputBatch({event:{sequence:a.sequence,stepIndex:a.stepIndex,turnId:a.turnId},requests:[i],responseMessages:[],session:{...t.session,history:[...t.messages]}});return await t.emit(createInputRequestedEvent({requests:[i],sequence:a.sequence,stepIndex:a.stepIndex,turnId:a.turnId})),t.config.mode===`conversation`&&(a=await emitTurnEpilogue(t.emit,a,t.config.mode)),{next:null,session:setHarnessEmissionState(o,a)}}function violationWindow(e){return e.kind===`token-cost`?e.limitUsd:e.limit}function formatSessionLimitMessage(e){return e===`token-cost`?`The session reached its configured model token-cost limit.`:`The session reached its configured ${e} token limit.`}async function failSessionUsageLimit(e){let n=getSessionTokenUsage(e.session),r=formatSessionLimitMessage(e.violation.kind),i=e.violation.kind===`token-cost`?{costUsd:n.costUsd,kind:e.violation.kind,limitUsd:e.violation.limitUsd,usedCostUsd:e.violation.usedCostUsd}:{inputTokens:n.inputTokens,kind:e.violation.kind,limit:e.violation.limit,outputTokens:n.outputTokens,usedTokens:e.violation.usedTokens};return e.emit&&await emitFailedStep(e.emit,e.emissionState,{code:e.violation.kind===`token-cost`?`SESSION_TOKEN_COST_LIMIT_REACHED`:`SESSION_TOKEN_LIMIT_REACHED`,details:i,message:r,sessionId:e.session.sessionId}),{next:{done:!0,isError:e.config.mode===`task`||void 0,output:e.config.mode===`task`?r:``},session:e.session}}export{applySessionLimitContinuation,enforceSessionUsageLimit};
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
export interface SessionUsageAmounts {
|
|
2
|
+
readonly costUsd?: number;
|
|
3
|
+
readonly inputTokens: number;
|
|
4
|
+
readonly outputTokens: number;
|
|
5
|
+
}
|
|
6
|
+
export interface SessionRuntimeUsageLimits {
|
|
7
|
+
readonly costUsd?: number;
|
|
8
|
+
readonly inputTokens?: number;
|
|
9
|
+
readonly outputTokens?: number;
|
|
10
|
+
}
|
|
11
|
+
export type SessionUsageLimitViolation = {
|
|
12
|
+
readonly kind: "input";
|
|
13
|
+
readonly limit: number;
|
|
14
|
+
readonly usedTokens: number;
|
|
15
|
+
} | {
|
|
16
|
+
readonly kind: "output";
|
|
17
|
+
readonly limit: number;
|
|
18
|
+
readonly usedTokens: number;
|
|
19
|
+
} | {
|
|
20
|
+
readonly kind: "token-cost";
|
|
21
|
+
readonly limitUsd: number;
|
|
22
|
+
readonly usedCostUsd: number;
|
|
23
|
+
};
|
|
24
|
+
/** Resolves per-axis lifetime ceilings, preferring a previously granted ceiling. */
|
|
25
|
+
export declare function resolveRuntimeUsageLimits(input: {
|
|
26
|
+
readonly configured: SessionRuntimeUsageLimits;
|
|
27
|
+
readonly stored?: SessionRuntimeUsageLimits;
|
|
28
|
+
}): SessionRuntimeUsageLimits;
|
|
29
|
+
/** Grants one full configured window from the current lifetime usage. */
|
|
30
|
+
export declare function grantRuntimeUsageLimits(input: {
|
|
31
|
+
readonly configured: SessionRuntimeUsageLimits;
|
|
32
|
+
readonly usage: SessionUsageAmounts;
|
|
33
|
+
}): SessionRuntimeUsageLimits;
|
|
34
|
+
/** Returns the unspent quota for each capped axis. */
|
|
35
|
+
export declare function remainingRuntimeUsageQuota(input: {
|
|
36
|
+
readonly runtime: SessionRuntimeUsageLimits;
|
|
37
|
+
readonly usage: SessionUsageAmounts;
|
|
38
|
+
}): {
|
|
39
|
+
readonly costUsd: number | false;
|
|
40
|
+
readonly inputTokens: number | false;
|
|
41
|
+
readonly outputTokens: number | false;
|
|
42
|
+
};
|
|
43
|
+
/** Returns the first exhausted axis: input tokens, output tokens, then token cost. */
|
|
44
|
+
export declare function findRuntimeUsageLimitViolation(input: {
|
|
45
|
+
readonly configured: SessionRuntimeUsageLimits;
|
|
46
|
+
readonly runtime: SessionRuntimeUsageLimits;
|
|
47
|
+
readonly usage: SessionUsageAmounts;
|
|
48
|
+
}): SessionUsageLimitViolation | null;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function resolveRuntimeUsageLimits(e){let t={},n=e.stored?.inputTokens??e.configured.inputTokens;n!==void 0&&(t.inputTokens=n);let r=e.stored?.outputTokens??e.configured.outputTokens;r!==void 0&&(t.outputTokens=r);let i=e.stored?.costUsd??e.configured.costUsd;return i!==void 0&&(t.costUsd=i),t}function grantRuntimeUsageLimits(e){let t={};return e.configured.inputTokens!==void 0&&(t.inputTokens=e.usage.inputTokens+e.configured.inputTokens),e.configured.outputTokens!==void 0&&(t.outputTokens=e.usage.outputTokens+e.configured.outputTokens),e.configured.costUsd!==void 0&&(t.costUsd=(e.usage.costUsd??0)+e.configured.costUsd),t}function remainingRuntimeUsageQuota(e){return{costUsd:e.runtime.costUsd!==void 0&&Math.max(0,e.runtime.costUsd-(e.usage.costUsd??0)),inputTokens:e.runtime.inputTokens!==void 0&&Math.max(0,e.runtime.inputTokens-e.usage.inputTokens),outputTokens:e.runtime.outputTokens!==void 0&&Math.max(0,e.runtime.outputTokens-e.usage.outputTokens)}}function findRuntimeUsageLimitViolation(e){return e.runtime.inputTokens!==void 0&&e.configured.inputTokens!==void 0&&e.usage.inputTokens>=e.runtime.inputTokens?{kind:`input`,limit:e.configured.inputTokens,usedTokens:e.usage.inputTokens}:e.runtime.outputTokens!==void 0&&e.configured.outputTokens!==void 0&&e.usage.outputTokens>=e.runtime.outputTokens?{kind:`output`,limit:e.configured.outputTokens,usedTokens:e.usage.outputTokens}:e.runtime.costUsd!==void 0&&e.configured.costUsd!==void 0&&(e.usage.costUsd??0)>=e.runtime.costUsd?{kind:`token-cost`,limitUsd:e.configured.costUsd,usedCostUsd:e.usage.costUsd??0}:null}export{findRuntimeUsageLimitViolation,grantRuntimeUsageLimits,remainingRuntimeUsageQuota,resolveRuntimeUsageLimits};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{appendUserContent,normalizeUserContent}from"#harness/messages.js";import{
|
|
1
|
+
import{appendUserContent,normalizeUserContent}from"#harness/messages.js";import{isApprovalRequest}from"#harness/input-request-class.js";import{isSessionLimitContinuationRequestId}from"#harness/session-limit-continuation.js";import{extractHistoricalInputRequests}from"#harness/input-extraction.js";function dropStaleSessionLimitContinuationResponses(e){if(e.stepInput===void 0)return;let t=e.stepInput.inputResponses??[],n=e.stepInput.attributedInputResponses??[],keep=t=>e.pendingRequestIds.has(t)||!isSessionLimitContinuationRequestId(t),i=t.filter(e=>keep(e.requestId)),a=n.filter(({response:e})=>keep(e.requestId));if(i.length===t.length&&a.length===n.length)return e.stepInput;let{attributedInputResponses:o,inputResponses:s,...c}=e.stepInput,l=c;return i.length>0&&(l.inputResponses=i),a.length>0&&(l.attributedInputResponses=a),l}function convertStaleResponsesToUserMessage(e){if(e.stepInput===void 0)return{kind:`unchanged`};let t=e.stepInput.inputResponses??[],n=e.stepInput.attributedInputResponses??[];if(t.length===0&&n.length===0)return{kind:`unchanged`,stepInput:e.stepInput};let r=[],a=[],o=[];for(let n of t)(e.pendingRequestIds.has(n.requestId)?r:o).push(n);for(let t of n)e.pendingRequestIds.has(t.response.requestId)?a.push(t):o.push(t.response);if(o.length===0)return{kind:`unchanged`,stepInput:e.stepInput};let s=extractHistoricalInputRequests({history:e.history,requestIds:new Set(o.map(e=>e.requestId)),tools:e.tools}),c=appendOptionalUserContent(e.stepInput.message,formatModelMessage(o,s)),l=appendOptionalUserContent(e.stepInput.message,formatDisplayMessage(o,s)),{attributedInputResponses:u,inputResponses:d,...f}=e.stepInput,p={...f,message:c};return r.length>0&&(p.inputResponses=r),a.length>0&&(p.attributedInputResponses=a),{displayMessage:l,kind:`converted`,stepInput:p}}function formatModelMessage(e,t){let r=e.map(e=>{let r=t.get(e.requestId),i=r?.options?.find(t=>t.id===e.optionId),a={};if(e.optionId!==void 0&&(a.optionId=e.optionId),i!==void 0){let e={id:i.id,label:i.label};i.description!==void 0&&(e.description=i.description),a.selectedOption=e}e.text!==void 0&&(a.text=e.text);let o={requestId:e.requestId,response:a};return r!==void 0&&(o.prompt=r.prompt,o.requestType=isApprovalRequest(r)?`approval`:`question`),o});return[`The user submitted the following response to an earlier interactive prompt.`,`Treat it as new input at the current point in the conversation and decide whether it is still relevant.${e.some(e=>{let r=t.get(e.requestId);return r===void 0||isApprovalRequest(r)})?` This does not authorize an earlier action; request approval again if that action is still needed.`:``}`,JSON.stringify(r,null,2)].join(`
|
|
2
2
|
`)}function formatDisplayMessage(e,t){return e.map(e=>e.text!==void 0&&e.text.length>0?e.text:t.get(e.requestId)?.options?.find(t=>t.id===e.optionId)?.label??e.optionId??`Response to an earlier interactive prompt`).join(`
|
|
3
3
|
`)}function appendOptionalUserContent(n,r){let i=normalizeUserContent(n);return i===void 0?r:appendUserContent({appended:r,existing:i})}export{convertStaleResponsesToUserMessage,dropStaleSessionLimitContinuationResponses};
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import type { PrepareStepFunction, StepResult, ToolSet } from "ai";
|
|
2
|
-
import type { SessionAuthContext } from "#channel/types.js";
|
|
3
2
|
import type { HarnessEmissionState } from "#harness/emission.js";
|
|
4
3
|
import { type AnthropicCacheMarker, type PromptCachePath } from "#harness/prompt-cache.js";
|
|
5
4
|
import { type HarnessEmitFn, type HarnessSession, type ToolLoopHarnessConfig } from "#harness/types.js";
|
|
@@ -16,7 +15,7 @@ export type HarnessStepResult = Pick<StepResult<ToolSet>, "content" | "finishRea
|
|
|
16
15
|
* Input for {@link buildStepHooks}.
|
|
17
16
|
*/
|
|
18
17
|
interface StepHooksInput {
|
|
19
|
-
readonly auth
|
|
18
|
+
readonly auth?: import("#channel/types.js").SessionAuthContext | null;
|
|
20
19
|
readonly cachePath: PromptCachePath;
|
|
21
20
|
readonly emit?: HarnessEmitFn;
|
|
22
21
|
readonly emissionState: HarnessEmissionState;
|