eve 0.50.0 → 0.51.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +18 -0
- package/dist/src/acp/adapter.js +1 -1
- package/dist/src/channel/types.d.ts +12 -19
- package/dist/src/chunks/{use-eve-agent-DUMU6dap.js → use-eve-agent-B4xN7-fK.js} +4 -4
- package/dist/src/chunks/{use-eve-agent-B5I-k6Ek.js → use-eve-agent-C3vUG5g2.js} +4 -4
- package/dist/src/cli/acp/command.d.ts +1 -1
- package/dist/src/cli/acp/command.js +2 -2
- package/dist/src/cli/agent-command.d.ts +5 -0
- package/dist/src/cli/agent-command.js +1 -0
- package/dist/src/cli/application-command.d.ts +2 -0
- package/dist/src/cli/commands/build.d.ts +1 -1
- package/dist/src/cli/commands/build.js +1 -1
- package/dist/src/cli/commands/deploy.d.ts +2 -0
- package/dist/src/cli/commands/deploy.js +1 -1
- package/dist/src/cli/commands/init-agent-workspace.d.ts +14 -0
- package/dist/src/cli/commands/init-agent-workspace.js +1 -0
- package/dist/src/cli/commands/init-repl.js +1 -1
- package/dist/src/cli/commands/init.d.ts +2 -13
- package/dist/src/cli/commands/init.js +1 -1
- package/dist/src/cli/commands/integration-connect.js +1 -1
- package/dist/src/cli/commands/link.d.ts +2 -0
- package/dist/src/cli/commands/link.js +1 -1
- package/dist/src/cli/commands/preconditions.d.ts +15 -0
- package/dist/src/cli/commands/preconditions.js +1 -1
- package/dist/src/cli/commands/register-integration-commands.d.ts +1 -1
- package/dist/src/cli/commands/register-integration-commands.js +1 -1
- package/dist/src/cli/commands/register-registry-commands.js +2 -2
- package/dist/src/cli/commands/registry.js +1 -1
- package/dist/src/cli/dev/environment.d.ts +1 -1
- package/dist/src/cli/dev/environment.js +1 -1
- package/dist/src/cli/dev/local-server-process.js +1 -1
- package/dist/src/cli/dev/tui/runner.js +1 -1
- package/dist/src/cli/invoke/command.d.ts +1 -1
- package/dist/src/cli/invoke/command.js +1 -1
- package/dist/src/cli/option-parsers.d.ts +1 -0
- package/dist/src/cli/option-parsers.js +1 -1
- package/dist/src/cli/run.js +3 -3
- package/dist/src/client/agent-info-schema.d.ts +0 -1
- package/dist/src/client/agent-info-schema.js +1 -1
- package/dist/src/client/message-action-parts.js +1 -1
- package/dist/src/compiled/.vendor-stamp.json +1 -1
- package/dist/src/compiler/extension-compatibility.d.ts +18 -18
- package/dist/src/compiler/extension-compatibility.js +1 -1
- package/dist/src/compiler/manifest.js +1 -1
- package/dist/src/compiler/normalize-agent-config.js +1 -1
- package/dist/src/compiler/normalize-manifest-helpers.js +1 -1
- package/dist/src/compiler/normalize-manifest.js +1 -1
- package/dist/src/context/build-dynamic-tools.js +1 -1
- package/dist/src/context/dynamic-subagent-lifecycle.js +1 -1
- package/dist/src/context/dynamic-tool-lifecycle.js +1 -1
- package/dist/src/context/dynamic-tool-metadata.d.ts +1 -0
- package/dist/src/context/keys.d.ts +0 -3
- package/dist/src/context/keys.js +1 -1
- package/dist/src/discover/project.js +1 -1
- package/dist/src/evals/cli/eval.js +1 -1
- package/dist/src/evals/mock-model.js +1 -1
- package/dist/src/eve-channel/index.js +1 -1
- package/dist/src/execution/activity-work-id.js +1 -1
- package/dist/src/execution/cancel-descendant-turns-step.js +1 -1
- package/dist/src/execution/channel-context.js +1 -1
- package/dist/src/execution/coordination-dispatch-shared.d.ts +103 -0
- package/dist/src/execution/coordination-dispatch-shared.js +1 -0
- package/dist/src/execution/coordination-dispatch-step.d.ts +7 -0
- package/dist/src/execution/coordination-dispatch-step.js +1 -0
- package/dist/src/execution/create-session-step.d.ts +1 -2
- package/dist/src/execution/create-session-step.js +1 -1
- package/dist/src/execution/deliver-payloads.js +1 -1
- package/dist/src/execution/dispatch-action-failures.d.ts +5 -5
- package/dist/src/execution/dispatch-action-failures.js +1 -1
- package/dist/src/execution/dispatch-start-operation.d.ts +1 -1
- package/dist/src/execution/dispatch-start-operation.js +1 -1
- package/dist/src/execution/durable-session-store.d.ts +1 -1
- package/dist/src/execution/eve-workflow-attributes.d.ts +1 -1
- package/dist/src/execution/inline-turn.js +1 -1
- package/dist/src/execution/next-driver-action.d.ts +7 -10
- package/dist/src/execution/node-step.d.ts +1 -2
- package/dist/src/execution/node-step.js +1 -1
- package/dist/src/execution/pending-turn-state.d.ts +1 -2
- package/dist/src/execution/pending-turn-state.js +1 -1
- package/dist/src/execution/proxied-deliver-step.js +1 -1
- package/dist/src/execution/route-child-delivery.js +1 -1
- package/dist/src/execution/runtime-context.js +1 -1
- package/dist/src/execution/session-command-inbox.d.ts +2 -3
- package/dist/src/execution/session.d.ts +1 -1
- package/dist/src/execution/session.js +2 -2
- package/dist/src/execution/settle-cancelled-turn-step.d.ts +1 -1
- package/dist/src/execution/settle-cancelled-turn-step.js +1 -1
- package/dist/src/execution/stable-workflow-names.d.ts +1 -1
- package/dist/src/execution/stable-workflow-names.js +1 -1
- package/dist/src/execution/task-event-callback.js +1 -1
- package/dist/src/execution/tasks/child/steps.d.ts +18 -18
- package/dist/src/execution/tasks/child/steps.js +1 -1
- package/dist/src/execution/tasks/child/update-step.d.ts +6 -0
- package/dist/src/execution/tasks/child/update-step.js +1 -0
- package/dist/src/execution/tasks/child/update.d.ts +7 -10
- package/dist/src/execution/tasks/child/update.js +1 -1
- package/dist/src/execution/tasks/child/workflow.d.ts +21 -29
- package/dist/src/execution/tasks/child/workflow.js +1 -1
- package/dist/src/execution/tasks/parent/control-shared.d.ts +6 -17
- package/dist/src/execution/tasks/parent/control-shared.js +1 -1
- package/dist/src/execution/tasks/parent/delegate.d.ts +15 -50
- package/dist/src/execution/tasks/parent/delegate.js +1 -1
- package/dist/src/execution/tasks/parent/dispatch.d.ts +19 -34
- package/dist/src/execution/tasks/parent/dispatch.js +1 -1
- package/dist/src/execution/tasks/parent/hitl-proxy-steps.d.ts +5 -15
- package/dist/src/execution/tasks/parent/hitl-proxy-steps.js +1 -1
- package/dist/src/execution/tasks/parent/run-parent.d.ts +2 -2
- package/dist/src/execution/tasks/parent/task-cancel.d.ts +11 -0
- package/dist/src/execution/tasks/parent/task-cancel.js +1 -0
- package/dist/src/execution/tasks/parent/tool-execution.d.ts +2 -3
- package/dist/src/execution/tasks/parent/tool-execution.js +1 -1
- package/dist/src/execution/terminate-child-sessions-step.js +1 -1
- package/dist/src/execution/tools/subagent/accept-event-step.d.ts +7 -0
- package/dist/src/execution/tools/subagent/accept-event-step.js +1 -0
- package/dist/src/execution/tools/subagent/emit-called-step.d.ts +9 -0
- package/dist/src/execution/tools/subagent/emit-called-step.js +1 -0
- package/dist/src/execution/tools/subagent/invoke-agent.d.ts +51 -0
- package/dist/src/execution/tools/subagent/invoke-agent.js +1 -0
- package/dist/src/execution/tools/subagent/invoke-preparation.d.ts +37 -0
- package/dist/src/execution/tools/subagent/invoke-preparation.js +1 -0
- package/dist/src/execution/tools/subagent/invoke-step.d.ts +55 -0
- package/dist/src/execution/tools/subagent/invoke-step.js +1 -0
- package/dist/src/execution/tools/subagent/receipt-identity.d.ts +11 -0
- package/dist/src/execution/tools/subagent/receipt-identity.js +1 -0
- package/dist/src/execution/{dispatch-runtime-actions-start.d.ts → tools/subagent/start.d.ts} +17 -5
- package/dist/src/execution/tools/subagent/start.js +1 -0
- package/dist/src/execution/tools/subagent/task-agent-requests.d.ts +24 -0
- package/dist/src/execution/tools/subagent/task-agent-requests.js +1 -0
- package/dist/src/execution/tools/subagent/task-cancel.d.ts +10 -0
- package/dist/src/execution/tools/subagent/task-cancel.js +1 -0
- package/dist/src/execution/tools/tasks.d.ts +10 -0
- package/dist/src/execution/tools/tasks.js +1 -0
- package/dist/src/execution/{tool-run → tools/workflow}/answer.d.ts +1 -1
- package/dist/src/execution/tools/workflow/answer.js +1 -0
- package/dist/src/execution/tools/workflow/ask.d.ts +22 -0
- package/dist/src/execution/tools/workflow/ask.js +1 -0
- package/dist/src/execution/tools/workflow/background.d.ts +18 -0
- package/dist/src/execution/tools/workflow/background.js +1 -0
- package/dist/src/execution/tools/workflow/body.d.ts +25 -0
- package/dist/src/execution/tools/workflow/body.js +1 -0
- package/dist/src/execution/tools/workflow/cancel.d.ts +11 -0
- package/dist/src/execution/tools/workflow/cancel.js +1 -0
- package/dist/src/execution/tools/workflow/emit-workflow-tool-run-report-step.d.ts +7 -0
- package/dist/src/execution/tools/workflow/emit-workflow-tool-run-report-step.js +1 -0
- package/dist/src/execution/tools/workflow/messages.d.ts +88 -0
- package/dist/src/execution/tools/workflow/messages.js +1 -0
- package/dist/src/execution/tools/workflow/owner-inbox.d.ts +13 -0
- package/dist/src/execution/tools/workflow/owner-inbox.js +1 -0
- package/dist/src/execution/tools/workflow/owner.d.ts +13 -0
- package/dist/src/execution/tools/workflow/owner.js +1 -0
- package/dist/src/execution/tools/workflow/run-control.d.ts +18 -0
- package/dist/src/execution/tools/workflow/run-control.js +1 -0
- package/dist/src/execution/tools/workflow/start.d.ts +33 -0
- package/dist/src/execution/tools/workflow/start.js +1 -0
- package/dist/src/execution/tools/workflow/types.d.ts +26 -0
- package/dist/src/execution/tools/workflow/types.js +1 -0
- package/dist/src/execution/tools/workflow/workflow.d.ts +3 -0
- package/dist/src/execution/tools/workflow/workflow.js +1 -0
- package/dist/src/execution/turn-workflow-tool-run.d.ts +16 -0
- package/dist/src/execution/turn-workflow-tool-run.js +1 -0
- package/dist/src/execution/turn-workflow.js +1 -1
- package/dist/src/execution/wire/session-inbox-contract.d.ts +2 -2
- package/dist/src/execution/wire/session-inbox-contract.js +1 -1
- package/dist/src/execution/wire/session-inbox-encoder.d.ts +6 -2
- package/dist/src/execution/wire/session-inbox-encoder.js +1 -1
- package/dist/src/execution/wire/session-inbox-wire.d.ts +3 -3
- package/dist/src/execution/wire/session-inbox-wire.js +1 -1
- package/dist/src/execution/wire/session-inbox-wire.v1.js +1 -1
- package/dist/src/execution/wire/session-inbox-wire.v4.d.ts +267 -0
- package/dist/src/execution/wire/session-inbox-wire.v4.js +1 -0
- package/dist/src/execution/wire/session-inbox-wire.v4.migration.d.ts +3 -0
- package/dist/src/execution/wire/session-inbox-wire.v4.migration.js +1 -0
- package/dist/src/execution/workflow-entry-finalization.d.ts +6 -0
- package/dist/src/execution/workflow-entry-finalization.js +1 -1
- package/dist/src/execution/workflow-entry.d.ts +2 -1
- package/dist/src/execution/workflow-entry.js +1 -1
- package/dist/src/execution/workflow-runtime.d.ts +1 -1
- package/dist/src/execution/workflow-runtime.js +1 -1
- package/dist/src/execution/workflow-steps.js +1 -1
- package/dist/src/framework/sources/registry.js +1 -1
- package/dist/src/harness/advertised-tools.d.ts +1 -7
- package/dist/src/harness/advertised-tools.js +1 -1
- package/dist/src/harness/background-tools.d.ts +8 -2
- package/dist/src/harness/{runtime-actions.d.ts → coordination.d.ts} +40 -27
- package/dist/src/harness/coordination.js +1 -0
- package/dist/src/harness/emission.d.ts +9 -2
- package/dist/src/harness/emission.js +1 -1
- package/dist/src/harness/execute-tool.d.ts +52 -0
- package/dist/src/harness/hitl/session-limit-input-requests.js +1 -1
- package/dist/src/harness/input-requests.js +1 -1
- package/dist/src/harness/proxy-input-requests.d.ts +6 -2
- package/dist/src/harness/stale-input-responses.js +1 -1
- package/dist/src/harness/step-hooks.d.ts +1 -2
- package/dist/src/harness/step-hooks.js +1 -1
- package/dist/src/harness/tool-call-action.js +1 -1
- package/dist/src/harness/tool-call-input-errors.js +1 -1
- package/dist/src/harness/tool-loop.js +2 -2
- package/dist/src/harness/tools.js +1 -1
- package/dist/src/harness/turn-tag-state.d.ts +3 -1
- package/dist/src/harness/types.d.ts +4 -7
- package/dist/src/harness/workflow-interrupt-state.js +1 -1
- package/dist/src/harness/workflow-lifecycle.d.ts +10 -0
- package/dist/src/harness/workflow-lifecycle.js +1 -1
- package/dist/src/harness/workflow-sandbox.d.ts +1 -1
- package/dist/src/harness/workflow-sandbox.js +2 -2
- package/dist/src/harness/workflow-subagent-limit.d.ts +7 -7
- package/dist/src/harness/workflow-subagent-limit.js +1 -1
- package/dist/src/harness/workflow-task-state.d.ts +9 -0
- package/dist/src/harness/workflow-task-state.js +1 -0
- package/dist/src/harness/workflow-tool-runs.d.ts +27 -0
- package/dist/src/harness/workflow-tool-runs.js +1 -0
- package/dist/src/instrumentation/native-events.js +1 -1
- package/dist/src/instrumentation/parent-lineage.js +1 -1
- package/dist/src/internal/agent-name.d.ts +4 -0
- package/dist/src/internal/agent-name.js +1 -0
- package/dist/src/internal/agent-workspace.d.ts +15 -0
- package/dist/src/internal/agent-workspace.js +1 -0
- package/dist/src/internal/application/package.js +1 -1
- package/dist/src/internal/authored-definition/core.js +1 -1
- package/dist/src/internal/nitro/host/build-application.js +1 -1
- package/dist/src/internal/nitro/host/start-development-server.js +1 -1
- package/dist/src/internal/nitro/host/start-production-server.js +3 -3
- package/dist/src/internal/nitro/routes/runtime-stack.js +1 -1
- package/dist/src/internal/project-context.d.ts +26 -0
- package/dist/src/internal/project-context.js +1 -0
- package/dist/src/internal/vercel/assemble-eve-services.d.ts +17 -0
- package/dist/src/internal/vercel/assemble-eve-services.js +1 -0
- package/dist/src/internal/vercel/build-agent-workspace.d.ts +3 -0
- package/dist/src/internal/vercel/build-agent-workspace.js +1 -0
- package/dist/src/internal/vercel/build-command.d.ts +4 -0
- package/dist/src/internal/vercel/build-command.js +1 -0
- package/dist/src/internal/vercel/eve-service-contribution.d.ts +27 -0
- package/dist/src/internal/vercel/eve-service-contribution.js +1 -0
- package/dist/src/internal/vercel/vercel-service-config-operations.d.ts +18 -0
- package/dist/src/internal/vercel/vercel-service-config-operations.js +1 -0
- package/dist/src/internal/vercel/vercel-service-name.d.ts +6 -0
- package/dist/src/internal/vercel/vercel-service-name.js +1 -0
- package/dist/src/internal/vercel/vercel-services-config.d.ts +53 -0
- package/dist/src/internal/vercel/vercel-services-config.js +1 -0
- package/dist/src/internal/workflow-bundle/builder.js +1 -1
- package/dist/src/internal/workflow-bundle/workflow-builders.js +1 -1
- package/dist/src/protocol/message.d.ts +2 -0
- package/dist/src/protocol/message.js +1 -1
- package/dist/src/public/channels/slack/action-status.js +1 -1
- package/dist/src/public/memory/file/backends/vercel-blob.js +1 -1
- package/dist/src/public/next/index.js +1 -1
- package/dist/src/public/next/vercel-output-config.js +1 -1
- package/dist/src/public/workflow/index.d.ts +3 -1
- package/dist/src/public/workflow/index.js +1 -1
- package/dist/src/runtime/actions/results.d.ts +3 -3
- package/dist/src/runtime/actions/results.js +1 -1
- package/dist/src/runtime/agent/bootstrap-model-utils.js +1 -1
- package/dist/src/runtime/agent/bootstrap.d.ts +1 -0
- package/dist/src/runtime/agent/bootstrap.js +1 -1
- package/dist/src/runtime/agent/mock-model-adapter.js +1 -1
- package/dist/src/runtime/channels/registry.js +1 -1
- package/dist/src/runtime/prompt/compose.d.ts +0 -1
- package/dist/src/runtime/prompt/compose.js +1 -1
- package/dist/src/runtime/resolve-agent-graph.js +1 -1
- package/dist/src/runtime/resolve-agent.js +1 -1
- package/dist/src/runtime/sessions/turn.d.ts +16 -1
- package/dist/src/runtime/subagents/registry.js +1 -1
- package/dist/src/runtime/subagents/workflow-reference.d.ts +5 -0
- package/dist/src/runtime/subagents/workflow-reference.js +1 -0
- package/dist/src/runtime/subagents/workflow.d.ts +8 -0
- package/dist/src/runtime/subagents/workflow.js +1 -0
- package/dist/src/runtime/tools/registry.js +1 -1
- package/dist/src/setup/integrations/discord/setup.js +1 -1
- package/dist/src/setup/integrations/file-memory/vercel.js +1 -1
- package/dist/src/setup/integrations/linear/setup.js +1 -1
- package/dist/src/setup/integrations/linq/setup.js +3 -3
- package/dist/src/setup/integrations/shopify/setup.js +1 -1
- package/dist/src/setup/scaffold/create/project.js +1 -1
- package/dist/src/setup/scaffold/update/channels.d.ts +4 -12
- package/dist/src/setup/scaffold/update/channels.js +1 -1
- package/dist/src/shared/action-types.d.ts +74 -14
- package/dist/src/shared/action-types.js +1 -1
- package/dist/src/shared/json.js +1 -1
- package/dist/src/shared/workflow-sandbox.d.ts +1 -1
- package/dist/src/{execution/subagent-adapter-state.d.ts → subagents/adapter-state.d.ts} +2 -0
- package/dist/src/{execution/subagent-adapter-state.js → subagents/adapter-state.js} +1 -1
- package/dist/src/subagents/adapter.js +1 -0
- package/dist/src/{harness → subagents}/agent-handle-errors.d.ts +6 -0
- package/dist/src/subagents/agent-handle-errors.js +1 -0
- package/dist/src/subagents/callback-route.js +1 -0
- package/dist/src/subagents/callback-step.js +1 -0
- package/dist/src/{execution/agent-continuation-bundle.d.ts → subagents/continuation-bundle.d.ts} +1 -1
- package/dist/src/subagents/continuation-bundle.js +1 -0
- package/dist/src/{execution/subagent-event-proxy-step.d.ts → subagents/event-proxy-step.d.ts} +2 -8
- package/dist/src/subagents/event-proxy-step.js +1 -0
- package/dist/src/subagents/handle-dispatch.d.ts +54 -0
- package/dist/src/subagents/handle-dispatch.js +1 -0
- package/dist/src/{harness → subagents}/handles/prompt.d.ts +4 -4
- package/dist/src/{harness → subagents}/handles/prompt.js +1 -1
- package/dist/src/{harness → subagents}/handles/query.d.ts +8 -2
- package/dist/src/subagents/handles/query.js +1 -0
- package/dist/src/subagents/handles/rebase.d.ts +4 -0
- package/dist/src/subagents/handles/rebase.js +1 -0
- package/dist/src/{harness → subagents}/handles/store.d.ts +90 -15
- package/dist/src/subagents/handles/store.js +1 -0
- package/dist/src/subagents/handles/transitions.d.ts +103 -0
- package/dist/src/subagents/handles/transitions.js +1 -0
- package/dist/src/{execution/delegated-parent-notification.d.ts → subagents/parent-notification.d.ts} +1 -7
- package/dist/src/subagents/parent-notification.js +1 -0
- package/dist/src/subagents/parent-result.js +1 -0
- package/dist/src/{execution/remote-agent-dispatch.d.ts → subagents/remote-dispatch.d.ts} +3 -2
- package/dist/src/subagents/remote-dispatch.js +1 -0
- package/dist/src/{execution/subagent-start-local.d.ts → subagents/start-local.d.ts} +5 -6
- package/dist/src/subagents/start-local.js +1 -0
- package/dist/src/{execution/subagent-start-remote.d.ts → subagents/start-remote.d.ts} +5 -5
- package/dist/src/subagents/start-remote.js +1 -0
- package/dist/src/{execution/subagent-tool.d.ts → subagents/tool.d.ts} +5 -3
- package/dist/src/subagents/tool.js +1 -0
- package/dist/src/svelte/index.js +1 -1
- package/dist/src/svelte/use-eve-agent.js +1 -1
- package/dist/src/tasks/json.js +1 -1
- package/dist/src/tasks/session-index.d.ts +2 -3
- package/dist/src/tasks/session-index.js +1 -1
- package/dist/src/tasks/task-id.d.ts +3 -4
- package/dist/src/tasks/task-id.js +1 -1
- package/dist/src/tasks/transitions.d.ts +3 -47
- package/dist/src/tasks/transitions.js +1 -1
- package/dist/src/tasks/types.d.ts +69 -247
- package/dist/src/tasks/types.js +1 -1
- package/dist/src/tools/dynamic.d.ts +3 -1
- package/dist/src/tools/framework/agent.d.ts +18 -2
- package/dist/src/tools/framework/agent.js +1 -1
- package/dist/src/tools/framework/task-cancel.d.ts +2 -6
- package/dist/src/tools/framework/task-contract.d.ts +44 -65
- package/dist/src/tools/framework/task-contract.js +1 -1
- package/dist/src/tools/framework/task-update.d.ts +1 -0
- package/dist/src/tools/framework/task-update.js +1 -1
- package/dist/src/vue/index.js +1 -1
- package/dist/src/vue/use-eve-agent.js +1 -1
- package/docs/concepts/built-in-tools.md +9 -90
- package/docs/concepts/context-control.md +2 -2
- package/docs/concepts/execution-model-and-durability.mdx +1 -1
- package/docs/concepts/sessions-runs-and-streaming.md +3 -3
- package/docs/guides/deployment/vercel.mdx +20 -2
- package/docs/guides/dynamic-capabilities.md +2 -2
- package/docs/guides/frontend/overview.mdx +1 -1
- package/docs/guides/instrumentation-providers.md +242 -0
- package/docs/guides/instrumentation.md +2 -0
- package/docs/guides/meta.json +1 -0
- package/docs/guides/remote-agents.md +8 -9
- package/docs/reference/cli.md +5 -2
- package/docs/sandbox.mdx +2 -0
- package/docs/subagents/index.mdx +9 -8
- package/docs/tools/overview.mdx +11 -10
- package/docs/tools/workflows.mdx +52 -18
- package/package.json +1 -1
- package/dist/src/execution/agent-continuation-bundle.js +0 -1
- package/dist/src/execution/agent-handle-dispatch.d.ts +0 -79
- package/dist/src/execution/agent-handle-dispatch.js +0 -1
- package/dist/src/execution/delegated-parent-notification.js +0 -1
- package/dist/src/execution/delegated-parent-result.js +0 -1
- package/dist/src/execution/delegation-tool.d.ts +0 -10
- package/dist/src/execution/delegation-tool.js +0 -1
- package/dist/src/execution/dispatch-runtime-actions-shared.d.ts +0 -165
- package/dist/src/execution/dispatch-runtime-actions-shared.js +0 -1
- package/dist/src/execution/dispatch-runtime-actions-start.js +0 -1
- package/dist/src/execution/dispatch-runtime-actions-step.d.ts +0 -18
- package/dist/src/execution/dispatch-runtime-actions-step.js +0 -1
- package/dist/src/execution/dispatch-workflow-runtime-actions-step.d.ts +0 -18
- package/dist/src/execution/dispatch-workflow-runtime-actions-step.js +0 -1
- package/dist/src/execution/finalize-terminal-session.d.ts +0 -17
- package/dist/src/execution/finalize-terminal-session.js +0 -1
- package/dist/src/execution/prepared-agent-action.d.ts +0 -7
- package/dist/src/execution/prepared-agent-action.js +0 -1
- package/dist/src/execution/remote-agent-dispatch.js +0 -1
- package/dist/src/execution/session-callback-route.js +0 -1
- package/dist/src/execution/session-callback-step.js +0 -1
- package/dist/src/execution/subagent-adapter.js +0 -1
- package/dist/src/execution/subagent-event-proxy-step.js +0 -1
- package/dist/src/execution/subagent-start-local.js +0 -1
- package/dist/src/execution/subagent-start-remote.js +0 -1
- package/dist/src/execution/subagent-tool.js +0 -1
- package/dist/src/execution/tasks/child/instructions.d.ts +0 -3
- package/dist/src/execution/tasks/child/instructions.js +0 -1
- package/dist/src/execution/tasks/parent/agent-identity.d.ts +0 -13
- package/dist/src/execution/tasks/parent/agent-identity.js +0 -1
- package/dist/src/execution/tasks/parent/agent-views.d.ts +0 -7
- package/dist/src/execution/tasks/parent/agent-views.js +0 -1
- package/dist/src/execution/tasks/parent/continuation-dispatch.d.ts +0 -43
- package/dist/src/execution/tasks/parent/continuation-dispatch.js +0 -1
- package/dist/src/execution/tasks/parent/dispatch-task-step.d.ts +0 -19
- package/dist/src/execution/tasks/parent/dispatch-task-step.js +0 -1
- package/dist/src/execution/tool-run/answer.js +0 -1
- package/dist/src/execution/tool-run/background.d.ts +0 -14
- package/dist/src/execution/tool-run/background.js +0 -1
- package/dist/src/execution/tool-run/cancel.d.ts +0 -7
- package/dist/src/execution/tool-run/cancel.js +0 -1
- package/dist/src/execution/tool-run/dispatch.d.ts +0 -24
- package/dist/src/execution/tool-run/dispatch.js +0 -1
- package/dist/src/execution/tool-run/emit-run-report-step.d.ts +0 -7
- package/dist/src/execution/tool-run/emit-run-report-step.js +0 -1
- package/dist/src/execution/tool-run/messages.d.ts +0 -70
- package/dist/src/execution/tool-run/messages.js +0 -1
- package/dist/src/execution/tool-run/owner-inbox.d.ts +0 -11
- package/dist/src/execution/tool-run/owner-inbox.js +0 -1
- package/dist/src/execution/tool-run/owner.d.ts +0 -13
- package/dist/src/execution/tool-run/owner.js +0 -1
- package/dist/src/execution/tool-run/run-control.d.ts +0 -18
- package/dist/src/execution/tool-run/run-control.js +0 -1
- package/dist/src/execution/tool-run/start.d.ts +0 -11
- package/dist/src/execution/tool-run/start.js +0 -1
- package/dist/src/execution/tool-run/types.d.ts +0 -21
- package/dist/src/execution/tool-run/types.js +0 -1
- package/dist/src/execution/tool-run/workflow.d.ts +0 -9
- package/dist/src/execution/tool-run/workflow.js +0 -1
- package/dist/src/execution/tools/subagent/local.d.ts +0 -40
- package/dist/src/execution/tools/subagent/local.js +0 -1
- package/dist/src/execution/tools/subagent/remote.d.ts +0 -26
- package/dist/src/execution/tools/subagent/remote.js +0 -1
- package/dist/src/harness/agent-handle-errors.js +0 -1
- package/dist/src/harness/handles/query.js +0 -1
- package/dist/src/harness/handles/store.js +0 -1
- package/dist/src/harness/handles/transitions.d.ts +0 -167
- package/dist/src/harness/handles/transitions.js +0 -1
- package/dist/src/harness/runtime-actions.js +0 -1
- package/dist/src/harness/subagent-depth.d.ts +0 -10
- package/dist/src/harness/subagent-depth.js +0 -1
- package/dist/src/harness/tool-runs.d.ts +0 -21
- package/dist/src/harness/tool-runs.js +0 -1
- package/dist/src/harness/workflow-runtime-action-state.d.ts +0 -9
- package/dist/src/harness/workflow-runtime-action-state.js +0 -1
- package/dist/src/runtime/actions/keys.d.ts +0 -14
- package/dist/src/runtime/actions/keys.js +0 -1
- package/dist/src/tasks/wire.d.ts +0 -25
- package/dist/src/tasks/wire.js +0 -1
- /package/dist/src/execution/{tool-run → tools/workflow}/owner-channels.d.ts +0 -0
- /package/dist/src/execution/{tool-run → tools/workflow}/owner-channels.js +0 -0
- /package/dist/src/execution/{tool-run → tools/workflow}/resume-hook-step.d.ts +0 -0
- /package/dist/src/execution/{tool-run → tools/workflow}/resume-hook-step.js +0 -0
- /package/dist/src/{execution/subagent-adapter.d.ts → subagents/adapter.d.ts} +0 -0
- /package/dist/src/{execution/session-callback-route.d.ts → subagents/callback-route.d.ts} +0 -0
- /package/dist/src/{execution/session-callback-step.d.ts → subagents/callback-step.d.ts} +0 -0
- /package/dist/src/{harness → subagents}/handles/operation-id.d.ts +0 -0
- /package/dist/src/{harness → subagents}/handles/operation-id.js +0 -0
- /package/dist/src/{harness → subagents}/handles/state-key.d.ts +0 -0
- /package/dist/src/{harness → subagents}/handles/state-key.js +0 -0
- /package/dist/src/{execution/subagent-hitl-proxy.d.ts → subagents/hitl-proxy.d.ts} +0 -0
- /package/dist/src/{execution/subagent-hitl-proxy.js → subagents/hitl-proxy.js} +0 -0
- /package/dist/src/{execution/subagent-invocation.d.ts → subagents/invocation.d.ts} +0 -0
- /package/dist/src/{execution/subagent-invocation.js → subagents/invocation.js} +0 -0
- /package/dist/src/{execution/delegated-parent-result.d.ts → subagents/parent-result.d.ts} +0 -0
- /package/dist/src/{execution/remote-agent-route-url.d.ts → subagents/remote-route-url.d.ts} +0 -0
- /package/dist/src/{execution/remote-agent-route-url.js → subagents/remote-route-url.js} +0 -0
- /package/dist/src/{harness/subagent-token-budget.d.ts → subagents/token-budget.d.ts} +0 -0
- /package/dist/src/{harness/subagent-token-budget.js → subagents/token-budget.js} +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{pinnedNodeEngineMajor}from"../../node-engine.js";import{parseChatGptModelSelection}from"../../../shared/chatgpt-model.js";import{SUPPORTED_AUTHORED_MODULE_FILE_EXTENSIONS}from"../update/module-files.js";import{pathExists,writeTextFile}from"../files.js";import{blockingCreateInPlaceEntries}from"../create-in-place.js";import{resolveVersionToken}from"../version-tokens.js";import{applyPackageManagerWorkspaceConfiguration,isPackageManagerWorkspaceMember,patchWorkspaceRootPackageJson}from"../workspace-root.js";import{WEB_APP_TEMPLATE_FILES}from"./web-template.js";import{mkdir,readdir,stat}from"node:fs/promises";import{basename,join,resolve}from"node:path";const CURRENT_DIRECTORY_PROJECT_NAME=`.`,DEFAULT_AI_PACKAGE_VERSION=`^7.0.82`,DEFAULT_CONNECT_PACKAGE_VERSION=`1.0.0`,DEFAULT_ZOD_PACKAGE_VERSION=`4.5.4`,DEFAULT_EVE_PACKAGE_CONTRACT={version:`0.
|
|
1
|
+
import{pinnedNodeEngineMajor}from"../../node-engine.js";import{parseChatGptModelSelection}from"../../../shared/chatgpt-model.js";import{SUPPORTED_AUTHORED_MODULE_FILE_EXTENSIONS}from"../update/module-files.js";import{pathExists,writeTextFile}from"../files.js";import{blockingCreateInPlaceEntries}from"../create-in-place.js";import{resolveVersionToken}from"../version-tokens.js";import{applyPackageManagerWorkspaceConfiguration,isPackageManagerWorkspaceMember,patchWorkspaceRootPackageJson}from"../workspace-root.js";import{WEB_APP_TEMPLATE_FILES}from"./web-template.js";import{mkdir,readdir,stat}from"node:fs/promises";import{basename,join,resolve}from"node:path";const CURRENT_DIRECTORY_PROJECT_NAME=`.`,DEFAULT_AI_PACKAGE_VERSION=`^7.0.82`,DEFAULT_CONNECT_PACKAGE_VERSION=`1.0.0`,DEFAULT_ZOD_PACKAGE_VERSION=`4.5.4`,DEFAULT_EVE_PACKAGE_CONTRACT={version:`0.51.0`,nodeEngine:`>=24`};function resolveEvePackageContract(e=DEFAULT_EVE_PACKAGE_CONTRACT){return{version:resolveVersionToken(`evePackage.version`,e.version),nodeEngine:resolveVersionToken(`evePackage.nodeEngine`,e.nodeEngine)}}function modelProviderSlug(e){let t=(e.split(`/`)[0]??``).replaceAll(/[^A-Za-z0-9._-]/gu,``);return t.length>0?t:`anthropic`}function byokProviderEnvVar(e){let t=modelProviderSlug(e).toUpperCase().replaceAll(/[^A-Z0-9]/gu,`_`);return`${/^[0-9]/.test(t)?`_`:``}${t}_API_KEY`}function agentTemplateFiles(e,t){return{"agent/agent.ts":renderAgentTemplate(e,t),"agent/channels/eve.ts":WEB_APP_TEMPLATE_FILES[`agent/channels/eve.ts`],"agent/instructions.md":AGENT_INSTRUCTIONS_TEMPLATE}}function renderAgentTemplate(e,n){let r=parseChatGptModelSelection(e);return r===void 0?BASE_AGENT_TEMPLATE.replaceAll(`__EVE_INIT_MODEL__`,e).replaceAll(`__EVE_INIT_REASONING__`,reasoningTemplateLine(n)):`import { defineAgent } from "eve";\nimport { chatgpt } from "eve/models/openai";\n\nexport default defineAgent({\n model: chatgpt(${JSON.stringify(r)}),\n${reasoningTemplateLine(n)}});\n`}function reasoningTemplateLine(e){return e===void 0||e===`provider-default`?``:` reasoning: "${e}",\n`}function renderTemplate(e,n){return e===BASE_AGENT_TEMPLATE&&parseChatGptModelSelection(n.model)!==void 0?renderAgentTemplate(n.model,n.reasoning):e.replaceAll(`__EVE_INIT_APP_NAME__`,n.appName).replaceAll(`__EVE_INIT_MODEL__`,n.model).replaceAll(`__EVE_INIT_REASONING__`,reasoningTemplateLine(n.reasoning)).replaceAll(`__EVE_INIT_BYOK_PROVIDER__`,modelProviderSlug(n.model)).replaceAll(`__EVE_INIT_BYOK_ENV_VAR__`,byokProviderEnvVar(n.model)).replaceAll(`__EVE_INIT_PACKAGE_VERSION__`,formatEveDependencySpecifier(n.eveVersion)).replaceAll(`__EVE_INIT_AI_SDK_VERSION__`,n.aiPackageVersion).replaceAll(`__EVE_INIT_CONNECT_VERSION__`,n.connectPackageVersion).replaceAll(`__EVE_INIT_ZOD_VERSION__`,n.zodPackageVersion).replaceAll(`__EVE_INIT_TYPESCRIPT_VERSION__`,n.typescriptPackageVersion).replaceAll(`__EVE_INIT_TYPES_NODE_VERSION__`,n.nodeTypesVersion).replaceAll(`__EVE_INIT_NODE_ENGINE__`,n.nodeEngine)}function formatEveDependencySpecifier(e){return/^\d+\.\d+\.\d+(?:[-+][0-9A-Za-z-.]+)?$/.test(e)?`^${e}`:e}const BASE_AGENT_TEMPLATE=`import { defineAgent } from "eve";
|
|
2
2
|
|
|
3
3
|
export default defineAgent({
|
|
4
4
|
model: "__EVE_INIT_MODEL__",
|
|
@@ -56,6 +56,10 @@ interface WebChannelSkippedResult {
|
|
|
56
56
|
packageJsonUpdated: [];
|
|
57
57
|
}
|
|
58
58
|
type WebChannelMutationResult = WebChannelWrittenResult | WebChannelSkippedResult;
|
|
59
|
+
/** The Vercel Framework Preset slug for the host framework a project declares. */
|
|
60
|
+
export declare function resolveVercelHostFrameworkPreset(projectRoot: string): Promise<string | undefined>;
|
|
61
|
+
/** Whether the root app declares a Vercel framework that owns its top-level deployment. */
|
|
62
|
+
export declare function hasVercelHostFramework(projectRoot: string): Promise<boolean>;
|
|
59
63
|
/**
|
|
60
64
|
* Whether the project already carries a Next.js app: `package.json` declares a
|
|
61
65
|
* `next` dependency in the same dependency fields Vercel framework detection
|
|
@@ -65,18 +69,6 @@ type WebChannelMutationResult = WebChannelWrittenResult | WebChannelSkippedResul
|
|
|
65
69
|
* A missing `package.json` reads as "no app".
|
|
66
70
|
*/
|
|
67
71
|
export declare function isNextJsProject(projectRoot: string): Promise<boolean>;
|
|
68
|
-
/**
|
|
69
|
-
* The Vercel Framework Preset slug for the host framework a project declares, or
|
|
70
|
-
* `undefined` when it declares none (a missing `package.json` reads as none).
|
|
71
|
-
*/
|
|
72
|
-
export declare function resolveVercelHostFrameworkPreset(projectRoot: string): Promise<string | undefined>;
|
|
73
|
-
/**
|
|
74
|
-
* Whether the root app declares a Vercel framework that should own the
|
|
75
|
-
* top-level deployment while eve runs as a sibling service. These match Eve's
|
|
76
|
-
* current framework integrations: Next.js, Nuxt, and SvelteKit. Derived from
|
|
77
|
-
* {@link resolveVercelHostFrameworkPreset} so the two share one dependency list.
|
|
78
|
-
*/
|
|
79
|
-
export declare function hasVercelHostFramework(projectRoot: string): Promise<boolean>;
|
|
80
72
|
export declare function normalizeSlackConnectorSlug(input: string): SlackConnectorSlug;
|
|
81
73
|
export declare function deriveSlackConnectorSlug(projectRoot: string, projectNameHint?: string): Promise<SlackConnectorSlug>;
|
|
82
74
|
export interface EnsureChannelOptions {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{appendEnv}from"../../append-env.js";import{pinnedNodeEngineMajor}from"../../node-engine.js";import{getSupportedModuleBaseName,matchesSupportedModuleBaseName}from"./module-files.js";import{pathExists,writeTextFile}from"../files.js";import{resolveVersionToken}from"../version-tokens.js";import{patchPackageJson}from"./package-json.js";import{applyPackageManagerWorkspaceConfiguration,isPackageManagerWorkspaceMember,patchWorkspaceRootPackageJson}from"../workspace-root.js";import{WEB_APP_SIGN_IN_WITH_VERCEL_TEMPLATE_FILES,WEB_APP_TEMPLATE_FILES,WEB_APP_TEMPLATE_PACKAGE_JSON}from"../create/web-template.js";import{resolveEvePackageContract}from"../create/project.js";import{resolveWebPackageVersions}from"./web-options.js";import{readFile,readdir,unlink,writeFile}from"node:fs/promises";import{basename,join,resolve}from"node:path";const SLACK_CHANNEL_DEFAULT_ROUTE=`/eve/v1/slack`,DEFAULT_SLACK_CONNECTOR_SLUG=`my-agent`,NEXT_PACKAGE_NAME=`next`,PACKAGE_DEPENDENCY_FIELDS=[`dependencies`,`devDependencies`],WEB_NEXT_CONFIG_PATH=`next.config.ts`,WEB_COMPETING_NEXT_CONFIG_PATHS=[`next.config.js`,`next.config.mjs`,WEB_NEXT_CONFIG_PATH,`next.config.mts`].filter(e=>e!==WEB_NEXT_CONFIG_PATH);function toSlackConnectorSlug(e){return e}function isJsonObject(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}async function readPackageJsonObject(e){if(!await pathExists(e))return;let t=JSON.parse(await readFile(e,`utf8`));return isJsonObject(t)?t:void 0}async function readDependencyVersion(e,t){let n=await readPackageJsonObject(e);if(n===void 0||!isJsonObject(n.dependencies))return;let r=n.dependencies[t];return typeof r==`string`?r:void 0}function packageJsonHasDependency(e,t){for(let n of PACKAGE_DEPENDENCY_FIELDS){let r=e[n];if(isJsonObject(r)&&typeof r[t]==`string`)return!0}return!1}async function hasPackageDependency(e,t){let n=await readPackageJsonObject(e);return n!==void 0&&packageJsonHasDependency(n,t)}
|
|
1
|
+
import{appendEnv}from"../../append-env.js";import{pinnedNodeEngineMajor}from"../../node-engine.js";import{getSupportedModuleBaseName,matchesSupportedModuleBaseName}from"./module-files.js";import{pathExists,writeTextFile}from"../files.js";import{resolveVersionToken}from"../version-tokens.js";import{patchPackageJson}from"./package-json.js";import{applyPackageManagerWorkspaceConfiguration,isPackageManagerWorkspaceMember,patchWorkspaceRootPackageJson}from"../workspace-root.js";import{WEB_APP_SIGN_IN_WITH_VERCEL_TEMPLATE_FILES,WEB_APP_TEMPLATE_FILES,WEB_APP_TEMPLATE_PACKAGE_JSON}from"../create/web-template.js";import{resolveEvePackageContract}from"../create/project.js";import{resolveWebPackageVersions}from"./web-options.js";import{readFile,readdir,unlink,writeFile}from"node:fs/promises";import{basename,join,resolve}from"node:path";const SLACK_CHANNEL_DEFAULT_ROUTE=`/eve/v1/slack`,DEFAULT_SLACK_CONNECTOR_SLUG=`my-agent`,NEXT_PACKAGE_NAME=`next`,PACKAGE_DEPENDENCY_FIELDS=[`dependencies`,`devDependencies`],WEB_NEXT_CONFIG_PATH=`next.config.ts`,WEB_COMPETING_NEXT_CONFIG_PATHS=[`next.config.js`,`next.config.mjs`,WEB_NEXT_CONFIG_PATH,`next.config.mts`].filter(e=>e!==WEB_NEXT_CONFIG_PATH);function toSlackConnectorSlug(e){return e}function isJsonObject(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}async function readPackageJsonObject(e){if(!await pathExists(e))return;let t=JSON.parse(await readFile(e,`utf8`));return isJsonObject(t)?t:void 0}async function readDependencyVersion(e,t){let n=await readPackageJsonObject(e);if(n===void 0||!isJsonObject(n.dependencies))return;let r=n.dependencies[t];return typeof r==`string`?r:void 0}function packageJsonHasDependency(e,t){for(let n of PACKAGE_DEPENDENCY_FIELDS){let r=e[n];if(isJsonObject(r)&&typeof r[t]==`string`)return!0}return!1}async function hasPackageDependency(e,t){let n=await readPackageJsonObject(e);return n!==void 0&&packageJsonHasDependency(n,t)}const VERCEL_HOST_FRAMEWORK_PRESETS={"@sveltejs/kit":`sveltekit`,[NEXT_PACKAGE_NAME]:`nextjs`,nuxt:`nuxtjs`,nuxt3:`nuxtjs`,"nuxt-edge":`nuxtjs`,"nuxt-nightly":`nuxtjs`};async function resolveVercelHostFrameworkPreset(e){let t=await readPackageJsonObject(join(e,`package.json`));if(t!==void 0){for(let[e,n]of Object.entries(VERCEL_HOST_FRAMEWORK_PRESETS))if(packageJsonHasDependency(t,e))return n}}async function hasVercelHostFramework(e){return await resolveVercelHostFrameworkPreset(e)!==void 0}async function isNextJsProject(e){return hasPackageDependency(join(e,`package.json`),NEXT_PACKAGE_NAME)}async function ensurePackageDependency(e,t,n){return!await pathExists(e)||await readDependencyVersion(e,t)===n?[]:(await patchPackageJson(e,{dependencies:{[t]:n}}),[{path:e,dependencies:[t],devDependencies:[],scripts:[]}])}function formatEveDependencySpecifier(e){return/^\d+\.\d+\.\d+(?:[-+][0-9A-Za-z-.]+)?$/.test(e)?`^${e}`:e}async function patchWebPackageJson(e,n,r,a,c,d=!0,f){let h=join(e,`package.json`);if(!await pathExists(h))return{mutations:[]};let g=resolveEvePackageContract(a.evePackage),_=pinnedNodeEngineMajor(g.nodeEngine),v={...WEB_APP_TEMPLATE_PACKAGE_JSON.dependencies,ai:resolveVersionToken(`aiPackageVersion`,a.aiPackageVersion),eve:formatEveDependencySpecifier(g.version),next:resolveVersionToken(`nextPackageVersion`,a.nextPackageVersion),react:resolveVersionToken(`reactPackageVersion`,a.reactPackageVersion),"react-dom":resolveVersionToken(`reactDomPackageVersion`,a.reactDomPackageVersion),streamdown:resolveVersionToken(`streamdownPackageVersion`,a.streamdownPackageVersion),zod:resolveVersionToken(`zodPackageVersion`,a.zodPackageVersion),...f===`sign-in-with-vercel`?{"better-auth":resolveVersionToken(`betterAuthPackageVersion`,a.betterAuthPackageVersion)}:{}},y={...WEB_APP_TEMPLATE_PACKAGE_JSON.devDependencies,"@types/node":_,"@types/react":resolveVersionToken(`typesReactPackageVersion`,a.typesReactPackageVersion),"@types/react-dom":resolveVersionToken(`typesReactDomPackageVersion`,a.typesReactDomPackageVersion),typescript:`6.0.3`},b=WEB_APP_TEMPLATE_PACKAGE_JSON.scripts,x=isPackageManagerWorkspaceMember(n,r),S={scripts:b};d&&(S.dependencies=v,S.devDependencies=y),x||(S.nodeEngineRequirement=g.nodeEngine);let C=await patchPackageJson(h,S),w=(await patchWorkspaceRootPackageJson(n,r,{nodeEngineRequirement:g.nodeEngine,onWorkspaceRootMutation:c})).nodeEngineOverride??C.nodeEngineOverride;return{mutations:[{path:h,dependencies:d?Object.keys(v):[],devDependencies:d?Object.keys(y):[],scripts:Object.keys(b)}],nodeEngineOverride:w}}function normalizeSlackConnectorSlug(e){return toSlackConnectorSlug((e.trim().replace(/^@/,``).split(`/`).at(-1)??``).toLowerCase().replace(/[^a-z0-9_-]+/g,`-`).replace(/^[^a-z0-9]+/,``).replace(/[^a-z0-9]+$/,``).slice(0,100).replace(/[^a-z0-9]+$/,``)||`my-agent`)}async function deriveSlackConnectorSlug(e,t){if(t!==void 0&&t.length>0&&t!==`.`)return normalizeSlackConnectorSlug(t);try{let t=await readFile(join(e,`package.json`),`utf8`),n=JSON.parse(t);if(typeof n.name==`string`&&n.name.length>0)return normalizeSlackConnectorSlug(n.name)}catch{}return normalizeSlackConnectorSlug(basename(resolve(e))||`my-agent`)}function buildSlackConnectTemplate(e){if(!e.startsWith(`slack/`)||e.length===6)throw Error(`Invalid Slack connector UID "${e}".`);return`import { connectSlackCredentials } from "@vercel/connect/eve";
|
|
2
2
|
import { slackChannel } from "eve/channels/slack";
|
|
3
3
|
|
|
4
4
|
export default slackChannel({
|
|
@@ -15,15 +15,45 @@ export declare const runtimeToolCallActionRequestSchema: z.ZodObject<{
|
|
|
15
15
|
kind: z.ZodLiteral<"tool-call">;
|
|
16
16
|
toolName: z.ZodString;
|
|
17
17
|
}, z.core.$strict>;
|
|
18
|
+
export type RuntimeSubagentCallActionRequest = z.infer<typeof runtimeSubagentCallActionRequestSchema>;
|
|
19
|
+
declare const runtimeSubagentCallActionRequestSchema: z.ZodObject<{
|
|
20
|
+
callId: z.ZodString;
|
|
21
|
+
description: z.ZodString;
|
|
22
|
+
input: z.ZodType<import("./json.ts").JsonObject, unknown, z.core.$ZodTypeInternals<import("./json.ts").JsonObject, unknown>>;
|
|
23
|
+
kind: z.ZodLiteral<"subagent-call">;
|
|
24
|
+
name: z.ZodString;
|
|
25
|
+
nodeId: z.ZodString;
|
|
26
|
+
subagentName: z.ZodString;
|
|
27
|
+
}, z.core.$strict>;
|
|
28
|
+
export type RuntimeRemoteAgentCallActionRequest = z.infer<typeof runtimeRemoteAgentCallActionRequestSchema>;
|
|
29
|
+
export declare const runtimeRemoteAgentCallActionRequestSchema: z.ZodObject<{
|
|
30
|
+
callId: z.ZodString;
|
|
31
|
+
description: z.ZodString;
|
|
32
|
+
input: z.ZodType<import("./json.ts").JsonObject, unknown, z.core.$ZodTypeInternals<import("./json.ts").JsonObject, unknown>>;
|
|
33
|
+
kind: z.ZodLiteral<"remote-agent-call">;
|
|
34
|
+
name: z.ZodString;
|
|
35
|
+
nodeId: z.ZodString;
|
|
36
|
+
remoteAgentName: z.ZodString;
|
|
37
|
+
}, z.core.$strict>;
|
|
38
|
+
export type RuntimeWorkflowToolCallActionRequest = z.infer<typeof runtimeWorkflowToolCallActionRequestSchema>;
|
|
39
|
+
declare const runtimeWorkflowToolCallActionRequestSchema: z.ZodObject<{
|
|
40
|
+
callId: z.ZodString;
|
|
41
|
+
input: z.ZodType<import("./json.ts").JsonObject, unknown, z.core.$ZodTypeInternals<import("./json.ts").JsonObject, unknown>>;
|
|
42
|
+
kind: z.ZodLiteral<"workflow-tool-call">;
|
|
43
|
+
toolName: z.ZodString;
|
|
44
|
+
workflowId: z.ZodString;
|
|
45
|
+
}, z.core.$strict>;
|
|
18
46
|
/**
|
|
19
|
-
*
|
|
20
|
-
*
|
|
47
|
+
* Internal subagent dispatch request issued by the agent workflow task.
|
|
48
|
+
*
|
|
49
|
+
* This is deliberately not a {@link RuntimeActionRequest}: subagent tools are
|
|
50
|
+
* workflow tasks, while runtime actions are reserved for framework controls.
|
|
21
51
|
*/
|
|
22
|
-
export type
|
|
52
|
+
export type RuntimeSubagentDispatchRequest = z.infer<typeof runtimeSubagentDispatchRequestSchema>;
|
|
23
53
|
/**
|
|
24
|
-
* Zod schema for one
|
|
54
|
+
* Zod schema for one internal local-subagent dispatch request.
|
|
25
55
|
*/
|
|
26
|
-
declare const
|
|
56
|
+
declare const runtimeSubagentDispatchRequestSchema: z.ZodObject<{
|
|
27
57
|
callId: z.ZodString;
|
|
28
58
|
description: z.ZodString;
|
|
29
59
|
input: z.ZodType<import("./json.ts").JsonObject, unknown, z.core.$ZodTypeInternals<import("./json.ts").JsonObject, unknown>>;
|
|
@@ -33,14 +63,13 @@ declare const runtimeSubagentCallActionRequestSchema: z.ZodObject<{
|
|
|
33
63
|
subagentName: z.ZodString;
|
|
34
64
|
}, z.core.$strict>;
|
|
35
65
|
/**
|
|
36
|
-
*
|
|
37
|
-
* later by workflow-backed runtime code.
|
|
66
|
+
* Internal remote-agent dispatch request issued by the agent workflow task.
|
|
38
67
|
*/
|
|
39
|
-
export type
|
|
68
|
+
export type RuntimeRemoteAgentDispatchRequest = z.infer<typeof runtimeRemoteAgentDispatchRequestSchema>;
|
|
40
69
|
/**
|
|
41
|
-
* Zod schema for one
|
|
70
|
+
* Zod schema for one internal remote-agent dispatch request.
|
|
42
71
|
*/
|
|
43
|
-
export declare const
|
|
72
|
+
export declare const runtimeRemoteAgentDispatchRequestSchema: z.ZodObject<{
|
|
44
73
|
callId: z.ZodString;
|
|
45
74
|
description: z.ZodString;
|
|
46
75
|
input: z.ZodType<import("./json.ts").JsonObject, unknown, z.core.$ZodTypeInternals<import("./json.ts").JsonObject, unknown>>;
|
|
@@ -49,6 +78,28 @@ export declare const runtimeRemoteAgentCallActionRequestSchema: z.ZodObject<{
|
|
|
49
78
|
nodeId: z.ZodString;
|
|
50
79
|
remoteAgentName: z.ZodString;
|
|
51
80
|
}, z.core.$strict>;
|
|
81
|
+
/**
|
|
82
|
+
* One workflow task requested by the harness. The turn owner starts the
|
|
83
|
+
* durable run named by `workflowId`; blocking tools wait for its result,
|
|
84
|
+
* while background tools settle after task admission.
|
|
85
|
+
*
|
|
86
|
+
* Tasks are the coordination contract for authored workflow tools and
|
|
87
|
+
* subagents. They are intentionally separate from `RuntimeActionRequest`.
|
|
88
|
+
*/
|
|
89
|
+
export type RuntimeWorkflowTaskRequest = z.infer<typeof runtimeWorkflowTaskRequestSchema>;
|
|
90
|
+
export declare const runtimeWorkflowTaskRequestSchema: z.ZodObject<{
|
|
91
|
+
callId: z.ZodString;
|
|
92
|
+
executeInput: z.ZodOptional<z.ZodType<import("./json.ts").JsonValue, unknown, z.core.$ZodTypeInternals<import("./json.ts").JsonValue, unknown>>>;
|
|
93
|
+
input: z.ZodType<import("./json.ts").JsonObject, unknown, z.core.$ZodTypeInternals<import("./json.ts").JsonObject, unknown>>;
|
|
94
|
+
kind: z.ZodLiteral<"workflow-task">;
|
|
95
|
+
nodeId: z.ZodOptional<z.ZodString>;
|
|
96
|
+
resultKind: z.ZodOptional<z.ZodEnum<{
|
|
97
|
+
subagent: "subagent";
|
|
98
|
+
tool: "tool";
|
|
99
|
+
}>>;
|
|
100
|
+
toolName: z.ZodString;
|
|
101
|
+
workflowId: z.ZodString;
|
|
102
|
+
}, z.core.$strict>;
|
|
52
103
|
/**
|
|
53
104
|
* Eve-owned `load-skill` action requested by the model.
|
|
54
105
|
*/
|
|
@@ -64,10 +115,13 @@ declare const runtimeLoadSkillActionRequestSchema: z.ZodObject<{
|
|
|
64
115
|
/**
|
|
65
116
|
* Eve-owned action request surfaced by the harness.
|
|
66
117
|
*
|
|
67
|
-
*
|
|
68
|
-
*
|
|
118
|
+
* `tool-call` covers ordinary model-visible calls, including framework task
|
|
119
|
+
* controls. Deferred workflow and subagent execution uses
|
|
120
|
+
* {@link RuntimeWorkflowTaskRequest} instead.
|
|
69
121
|
*/
|
|
70
|
-
export type RuntimeActionRequest = RuntimeLoadSkillActionRequest | RuntimeRemoteAgentCallActionRequest | RuntimeSubagentCallActionRequest | RuntimeToolCallActionRequest;
|
|
122
|
+
export type RuntimeActionRequest = RuntimeLoadSkillActionRequest | RuntimeRemoteAgentCallActionRequest | RuntimeSubagentCallActionRequest | RuntimeToolCallActionRequest | RuntimeWorkflowToolCallActionRequest;
|
|
123
|
+
/** Internal agent dispatch request owned by a workflow task. */
|
|
124
|
+
export type RuntimeAgentDispatchRequest = RuntimeRemoteAgentDispatchRequest | RuntimeSubagentDispatchRequest;
|
|
71
125
|
/**
|
|
72
126
|
* Zod schema for one runtime action request.
|
|
73
127
|
*/
|
|
@@ -96,6 +150,12 @@ export declare const runtimeActionRequestSchema: z.ZodDiscriminatedUnion<[z.ZodO
|
|
|
96
150
|
input: z.ZodType<import("./json.ts").JsonObject, unknown, z.core.$ZodTypeInternals<import("./json.ts").JsonObject, unknown>>;
|
|
97
151
|
kind: z.ZodLiteral<"tool-call">;
|
|
98
152
|
toolName: z.ZodString;
|
|
153
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
154
|
+
callId: z.ZodString;
|
|
155
|
+
input: z.ZodType<import("./json.ts").JsonObject, unknown, z.core.$ZodTypeInternals<import("./json.ts").JsonObject, unknown>>;
|
|
156
|
+
kind: z.ZodLiteral<"workflow-tool-call">;
|
|
157
|
+
toolName: z.ZodString;
|
|
158
|
+
workflowId: z.ZodString;
|
|
99
159
|
}, z.core.$strict>], "kind">;
|
|
100
160
|
/**
|
|
101
161
|
* Runtime-owned authored tool-result projected back into a harness resume call.
|
|
@@ -141,7 +201,7 @@ export type RuntimeSubagentChildResult = z.infer<typeof runtimeSubagentChildResu
|
|
|
141
201
|
/**
|
|
142
202
|
* Zod schema for one child-produced subagent result.
|
|
143
203
|
*/
|
|
144
|
-
declare const runtimeSubagentChildResultSchema: z.ZodObject<{
|
|
204
|
+
export declare const runtimeSubagentChildResultSchema: z.ZodObject<{
|
|
145
205
|
backgroundTask: z.ZodOptional<z.ZodObject<{
|
|
146
206
|
status: z.ZodLiteral<"working">;
|
|
147
207
|
taskId: z.ZodString;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{z}from"#compiled/zod/index.js";import{jsonObjectSchema,jsonValueSchema}from"#shared/json-schemas.js";import{
|
|
1
|
+
import{z}from"#compiled/zod/index.js";import{jsonObjectSchema,jsonValueSchema}from"#shared/json-schemas.js";import{tokenUsageSchema}from"#shared/token-usage.js";import{agentTurnOutcomeSchema}from"#shared/agent-turn-outcome.js";const runtimeToolCallActionRequestSchema=z.object({callId:z.string(),input:jsonObjectSchema,kind:z.literal(`tool-call`),toolName:z.string()}).strict(),runtimeSubagentCallActionRequestSchema=z.object({callId:z.string(),description:z.string(),input:jsonObjectSchema,kind:z.literal(`subagent-call`),name:z.string(),nodeId:z.string(),subagentName:z.string()}).strict(),runtimeRemoteAgentCallActionRequestSchema=z.object({callId:z.string(),description:z.string(),input:jsonObjectSchema,kind:z.literal(`remote-agent-call`),name:z.string(),nodeId:z.string(),remoteAgentName:z.string()}).strict(),runtimeWorkflowToolCallActionRequestSchema=z.object({callId:z.string(),input:jsonObjectSchema,kind:z.literal(`workflow-tool-call`),toolName:z.string(),workflowId:z.string()}).strict();z.object({callId:z.string(),description:z.string(),input:jsonObjectSchema,kind:z.literal(`subagent-call`),name:z.string(),nodeId:z.string(),subagentName:z.string()}).strict();const runtimeRemoteAgentDispatchRequestSchema=z.object({callId:z.string(),description:z.string(),input:jsonObjectSchema,kind:z.literal(`remote-agent-call`),name:z.string(),nodeId:z.string(),remoteAgentName:z.string()}).strict(),runtimeWorkflowTaskRequestSchema=z.object({callId:z.string(),executeInput:jsonValueSchema.optional(),input:jsonObjectSchema,kind:z.literal(`workflow-task`),nodeId:z.string().optional(),resultKind:z.enum([`subagent`,`tool`]).optional(),toolName:z.string(),workflowId:z.string()}).strict(),runtimeLoadSkillActionRequestSchema=z.object({callId:z.string(),input:jsonObjectSchema,kind:z.literal(`load-skill`)}).strict(),runtimeActionRequestSchema=z.discriminatedUnion(`kind`,[runtimeLoadSkillActionRequestSchema,runtimeRemoteAgentCallActionRequestSchema,runtimeSubagentCallActionRequestSchema,runtimeToolCallActionRequestSchema,runtimeWorkflowToolCallActionRequestSchema]);z.object({callId:z.string(),isError:z.boolean().optional(),kind:z.literal(`tool-result`),output:jsonValueSchema,toolName:z.string()}).strict();const runtimeSubagentChildResultSchema=z.object({backgroundTask:z.strictObject({status:z.literal(`working`),taskId:z.string()}).optional(),callId:z.string(),isError:z.boolean().optional(),kind:z.literal(`subagent-result`),origin:z.literal(`child`),outcome:agentTurnOutcomeSchema,output:jsonValueSchema,subagentName:z.string(),usage:tokenUsageSchema.optional()}).strict();z.object({callId:z.string(),isError:z.literal(!0),kind:z.literal(`subagent-result`),origin:z.literal(`dispatch`),output:jsonValueSchema,subagentName:z.string()}).strict(),z.object({callId:z.string(),isError:z.boolean().optional(),kind:z.literal(`load-skill-result`),output:jsonValueSchema,name:z.string().optional()}).strict();export{runtimeActionRequestSchema,runtimeRemoteAgentCallActionRequestSchema,runtimeRemoteAgentDispatchRequestSchema,runtimeSubagentChildResultSchema,runtimeToolCallActionRequestSchema,runtimeWorkflowTaskRequestSchema};
|
package/dist/src/shared/json.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
function jsonValuesEqual(e,t){if(e===t)return!0;if(Array.isArray(e)||Array.isArray(t))return Array.isArray(e)&&Array.isArray(t)&&e.length===t.length&&e.every((e,n)=>jsonValuesEqual(e,t[n]));if(e===null||t===null||typeof e!=`object`||typeof t!=`object`)return!1;let n=Object.entries(e),r=t;return n.length===Object.keys(r).length&&n.every(([e,t])=>Object.hasOwn(r,e)&&jsonValuesEqual(t,r[e]))}const INVALID_JSON_VALUE_CANDIDATE=Symbol(`invalid-json-value-candidate`);function parseJsonValue(t){let n=normalizeJsonValueCandidate(t);if(n===INVALID_JSON_VALUE_CANDIDATE)throw TypeError(`Expected a JSON-serializable value.`);return n}function parseJsonObject(e){let t=parseJsonValue(e);if(!isJsonObjectValue(t))throw TypeError(`Expected a JSON-serializable object.`);return t}function normalizeJsonValueCandidate(t,n=new WeakSet){if(t===null||typeof t==`boolean`||typeof t==`string`)return t;if(typeof t==`number`)return Number.isFinite(t)?t:INVALID_JSON_VALUE_CANDIDATE;if(Array.isArray(t)){let r=[];for(let i of t){let t=normalizeJsonValueCandidate(i,n);if(t===INVALID_JSON_VALUE_CANDIDATE)return INVALID_JSON_VALUE_CANDIDATE;r.push(t)}return r}if(typeof t!=`object`||t===void 0||!isPlainObject(t)||n.has(t))return INVALID_JSON_VALUE_CANDIDATE;n.add(t);let r={};for(let[i,a]of Object.entries(t)){if(a===void 0)continue;let t=normalizeJsonValueCandidate(a,n);if(t===INVALID_JSON_VALUE_CANDIDATE)return INVALID_JSON_VALUE_CANDIDATE;r[i]=t}return n.delete(t),r}function isJsonObjectValue(e){return e!==null&&!Array.isArray(e)&&typeof e==`object`}function isPlainObject(e){let t=Object.getPrototypeOf(e);return t===null||t===
|
|
1
|
+
function jsonValuesEqual(e,t){if(e===t)return!0;if(Array.isArray(e)||Array.isArray(t))return Array.isArray(e)&&Array.isArray(t)&&e.length===t.length&&e.every((e,n)=>jsonValuesEqual(e,t[n]));if(e===null||t===null||typeof e!=`object`||typeof t!=`object`)return!1;let n=Object.entries(e),r=t;return n.length===Object.keys(r).length&&n.every(([e,t])=>Object.hasOwn(r,e)&&jsonValuesEqual(t,r[e]))}const INVALID_JSON_VALUE_CANDIDATE=Symbol(`invalid-json-value-candidate`);function parseJsonValue(t){let n=normalizeJsonValueCandidate(t);if(n===INVALID_JSON_VALUE_CANDIDATE)throw TypeError(`Expected a JSON-serializable value.`);return n}function parseJsonObject(e){let t=parseJsonValue(e);if(!isJsonObjectValue(t))throw TypeError(`Expected a JSON-serializable object.`);return t}function normalizeJsonValueCandidate(t,n=new WeakSet){if(t===null||typeof t==`boolean`||typeof t==`string`)return t;if(typeof t==`number`)return Number.isFinite(t)?t:INVALID_JSON_VALUE_CANDIDATE;if(Array.isArray(t)){let r=[];for(let i of t){let t=normalizeJsonValueCandidate(i,n);if(t===INVALID_JSON_VALUE_CANDIDATE)return INVALID_JSON_VALUE_CANDIDATE;r.push(t)}return r}if(typeof t!=`object`||t===void 0||!isPlainObject(t)||n.has(t))return INVALID_JSON_VALUE_CANDIDATE;n.add(t);let r={};for(let[i,a]of Object.entries(t)){if(a===void 0)continue;let t=normalizeJsonValueCandidate(a,n);if(t===INVALID_JSON_VALUE_CANDIDATE)return INVALID_JSON_VALUE_CANDIDATE;r[i]=t}return n.delete(t),r}function isJsonObjectValue(e){return e!==null&&!Array.isArray(e)&&typeof e==`object`}function isPlainObject(e){let t=Object.getPrototypeOf(e);return t===null||Object.getPrototypeOf(t)===null}export{isJsonObjectValue,jsonValuesEqual,parseJsonObject,parseJsonValue};
|
|
@@ -18,8 +18,8 @@ export declare function createWorkflowSandboxTool(input: {
|
|
|
18
18
|
readonly hostTools: ToolSet;
|
|
19
19
|
}): Promise<ToolSet[string]>;
|
|
20
20
|
export declare function requestWorkflowSandboxInterrupt(input: {
|
|
21
|
-
readonly dispatchTarget: unknown;
|
|
22
21
|
readonly kind: string;
|
|
22
|
+
readonly task: unknown;
|
|
23
23
|
readonly toolInput: unknown;
|
|
24
24
|
readonly toolName: string;
|
|
25
25
|
}): Promise<unknown>;
|
|
@@ -28,6 +28,8 @@ export interface SubagentAdapterState extends Record<string, unknown> {
|
|
|
28
28
|
readonly parentContinuationToken: string;
|
|
29
29
|
readonly parentSessionId: string;
|
|
30
30
|
readonly subagentName: string;
|
|
31
|
+
/** Owning task when this child was started by a background workflow tool. */
|
|
32
|
+
readonly taskId?: string;
|
|
31
33
|
}
|
|
32
34
|
/**
|
|
33
35
|
* Narrow runtime guard for {@link SubagentAdapterState}.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const SUBAGENT_ADAPTER_KIND=`subagent`;function isSubagentAdapterState(e){if(typeof e!=`object`||!e)return!1;let t=e;return typeof t.callId==`string`&&t.callId.length>0&&typeof t.parentContinuationToken==`string`&&t.parentContinuationToken.length>0&&typeof t.parentSessionId==`string`&&typeof t.subagentName==`string`&&t.subagentName.length>0}export{SUBAGENT_ADAPTER_KIND,isSubagentAdapterState};
|
|
1
|
+
const SUBAGENT_ADAPTER_KIND=`subagent`;function isSubagentAdapterState(e){if(typeof e!=`object`||!e)return!1;let t=e;return typeof t.callId==`string`&&t.callId.length>0&&typeof t.parentContinuationToken==`string`&&t.parentContinuationToken.length>0&&typeof t.parentSessionId==`string`&&typeof t.subagentName==`string`&&t.subagentName.length>0&&(t.taskId===void 0||typeof t.taskId==`string`&&t.taskId.length>0)}export{SUBAGENT_ADAPTER_KIND,isSubagentAdapterState};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{createErrorId,createLogger}from"#internal/logging.js";import{ContinuationTokenKey,SessionIdKey}from"#context/keys.js";import{resumeHook}from"#internal/workflow/runtime.js";import{SUBAGENT_ADAPTER_KIND,isSubagentAdapterState}from"#subagents/adapter-state.js";const log=createLogger(`execution.subagent-adapter`),SUBAGENT_ADAPTER={kind:SUBAGENT_ADAPTER_KIND,async"approval.candidate"(e,t){await forwardSubagentAuthorizationEvent({data:e,type:`approval.candidate`},t)},async"approval.settled"(e,t){await forwardSubagentAuthorizationEvent({data:e,type:`approval.settled`},t)},async"authorization.required"(e,t){await forwardSubagentAuthorizationEvent({data:e,type:`authorization.required`},t)},async"authorization.completed"(e,t){await forwardSubagentAuthorizationEvent({data:e,type:`authorization.completed`},t)},async"input.requested"(e,t){let i=t.state;isSubagentAdapterState(i)&&await forwardSubagentInputRequestStep({hookPayload:{callId:i.callId,childContinuationToken:t.ctx.require(ContinuationTokenKey),childSessionId:t.ctx.require(SessionIdKey),event:{requests:e.requests,sequence:e.sequence,stepIndex:e.stepIndex,turnId:e.turnId},kind:`subagent-input-request`,subagentName:i.subagentName},parentContinuationToken:i.parentContinuationToken})}};async function forwardSubagentAuthorizationEvent(e,t){let n=t.state;isSubagentAdapterState(n)&&await forwardSubagentAuthorizationEventStep({hookPayload:{callId:n.callId,childSessionId:t.ctx.require(SessionIdKey),event:e,kind:`subagent-authorization-event`,subagentName:n.subagentName},parentContinuationToken:n.parentContinuationToken})}async function forwardSubagentAuthorizationEventStep(t){"use step";try{await resumeHook(t.parentContinuationToken,t.hookPayload)}catch(n){let r=createErrorId();throw log.warn(`failed to forward subagent authorization event to parent`,{callId:t.hookPayload.callId,childSessionId:t.hookPayload.childSessionId,errorId:r,eventType:t.hookPayload.event.type,parentContinuationToken:t.parentContinuationToken,subagentName:t.hookPayload.subagentName,error:n}),n}}async function forwardSubagentInputRequestStep(t){"use step";try{await resumeHook(t.parentContinuationToken,t.hookPayload)}catch(n){let r=createErrorId();throw log.warn(`failed to forward proxied HITL batch to parent`,{callId:t.hookPayload.callId,childContinuationToken:t.hookPayload.childContinuationToken,childSessionId:t.hookPayload.childSessionId,errorId:r,parentContinuationToken:t.parentContinuationToken,subagentName:t.hookPayload.subagentName,error:n}),n}}export{SUBAGENT_ADAPTER};
|
|
@@ -11,6 +11,12 @@ export declare const AGENT_MISMATCH = "AGENT_MISMATCH";
|
|
|
11
11
|
export declare const AGENT_UNREACHABLE = "AGENT_UNREACHABLE";
|
|
12
12
|
/** Error code for an agent that is starting or already running a turn. */
|
|
13
13
|
export declare const AGENT_BUSY = "AGENT_BUSY";
|
|
14
|
+
/** Describes the owner blocking a continuation without exposing workflow run ids. */
|
|
15
|
+
export declare function formatAgentBusyMessage(input: {
|
|
16
|
+
readonly agentId: string;
|
|
17
|
+
readonly agentName: string;
|
|
18
|
+
readonly ownerId?: string;
|
|
19
|
+
}): string;
|
|
14
20
|
/** Error code for a local subagent that failed to start. */
|
|
15
21
|
export declare const SUBAGENT_START_FAILED = "SUBAGENT_START_FAILED";
|
|
16
22
|
/** Error code for a delegated subagent whose execution threw. */
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const AGENT_MISMATCH=`AGENT_MISMATCH`,AGENT_UNREACHABLE=`AGENT_UNREACHABLE`,AGENT_BUSY=`AGENT_BUSY`;function formatAgentBusyMessage(e){let t=`Agent "${e.agentName}" with id "${e.agentId}" is still working on`;return e.ownerId?.startsWith(`task_`)?`${t} task "${e.ownerId}".`:`${t} ${e.ownerId===void 0?`another task`:`another invocation`}.`}const SUBAGENT_START_FAILED=`SUBAGENT_START_FAILED`,SUBAGENT_EXECUTION_FAILED=`SUBAGENT_EXECUTION_FAILED`,REMOTE_AGENT_START_FAILED=`REMOTE_AGENT_START_FAILED`,REMOTE_AGENT_FAILED=`REMOTE_AGENT_FAILED`,SESSION_FAILED=`SESSION_FAILED`;export{AGENT_BUSY,AGENT_MISMATCH,AGENT_UNREACHABLE,REMOTE_AGENT_FAILED,REMOTE_AGENT_START_FAILED,SESSION_FAILED,SUBAGENT_EXECUTION_FAILED,SUBAGENT_START_FAILED,formatAgentBusyMessage};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{z}from"#compiled/zod/index.js";import{isInputRequest}from"#shared/input.js";import{jsonValueSchema}from"#shared/json-schemas.js";import{resumeHook}from"#internal/workflow/runtime.js";import{REMOTE_AGENT_FAILED}from"#subagents/agent-handle-errors.js";import{tokenUsageSchema}from"#shared/token-usage.js";import{agentTurnOutcomeSchema}from"#shared/agent-turn-outcome.js";import{readTaskIdFromInboxToken}from"#tasks/task-inbox-token.js";const ZERO_TOKEN_USAGE={cacheReadTokens:0,cacheWriteTokens:0,inputTokens:0,outputTokens:0},eventCoordinateSchema=z.number().int().nonnegative(),authorizationChallengeSchema=z.looseObject({displayName:z.string().optional(),expiresAt:z.string().optional(),instructions:z.string().optional(),url:z.string().optional(),userCode:z.string().optional()}),taskInputEventSchema=z.looseObject({requests:z.array(jsonValueSchema.refine(isInputRequest)).min(1),sequence:eventCoordinateSchema,stepIndex:eventCoordinateSchema,turnId:z.string()}),taskAuthorizationEventSchema=z.discriminatedUnion(`type`,[z.looseObject({data:z.looseObject({attemptId:z.string().optional(),authorization:authorizationChallengeSchema.optional(),description:z.string(),name:z.string(),sequence:eventCoordinateSchema,stepIndex:eventCoordinateSchema,turnId:z.string(),webhookUrl:z.string().optional()}),type:z.literal(`authorization.required`)}),z.looseObject({data:z.looseObject({attemptId:z.string().optional(),authorization:authorizationChallengeSchema.optional(),name:z.string(),outcome:z.enum([`authorized`,`declined`,`failed`,`timed-out`]),reason:z.string().optional(),sequence:eventCoordinateSchema,stepIndex:eventCoordinateSchema,turnId:z.string()}),type:z.literal(`authorization.completed`)})]),taskEventCallbackSchema=z.discriminatedUnion(`kind`,[z.object({callId:z.string(),childContinuationToken:z.string(),childSessionId:z.string(),event:taskInputEventSchema,kind:z.literal(`task.input-requested`),subagentName:z.string(),taskId:z.string()}),z.object({callId:z.string(),childContinuationToken:z.string(),childSessionId:z.string(),event:taskAuthorizationEventSchema,kind:z.literal(`task.authorization`),subagentName:z.string(),taskId:z.string()})]),taskTurnStartedCallbackSchema=z.object({kind:z.literal(`turn.started`),sessionId:z.string().min(1),taskId:z.string().min(1),turnId:z.string().min(1)}),taskUpdateCallbackSchema=z.object({callId:z.string().min(1),kind:z.literal(`task.update`),message:z.string().min(1),taskId:z.string().min(1),updateEpoch:z.string().min(1),updateIndex:eventCoordinateSchema}),sessionResultCallbackSchema=z.discriminatedUnion(`kind`,[z.object({callId:z.string().min(1),kind:z.literal(`session.completed`),output:jsonValueSchema.optional(),subagentName:z.string().min(1),usage:z.unknown().optional()}),z.object({callId:z.string().min(1),error:jsonValueSchema.optional(),kind:z.literal(`session.failed`),subagentName:z.string().min(1),usage:z.unknown().optional()}),z.object({callId:z.string().min(1),kind:z.literal(`turn.completed`),outcome:agentTurnOutcomeSchema,output:jsonValueSchema.optional(),subagentName:z.string().min(1)}),z.object({callId:z.string().min(1),error:jsonValueSchema,kind:z.literal(`turn.failed`),outcome:agentTurnOutcomeSchema,subagentName:z.string().min(1)})]);async function handleSessionCallbackRequest(e,t){let n=t.params.token;if(typeof n!=`string`||n.length===0)return Response.json({error:`Missing callback token.`,ok:!1},{status:400});let i;try{i=await e.json()}catch{return Response.json({error:`Invalid JSON body.`,ok:!1},{status:400})}let a=projectTaskEvent(i,n);if(a instanceof Response)return a;if(a!==void 0){try{await resumeHook(n,a)}catch{return Response.json({error:`Session callback not pending.`,ok:!1},{status:404})}return Response.json({ok:!0},{status:202})}let o=projectTaskUpdate(i,n);if(o instanceof Response)return o;if(o!==void 0){try{await resumeHook(n,o)}catch{return Response.json({error:`Session callback not pending.`,ok:!1},{status:404})}return Response.json({ok:!0},{status:202})}let s=rejectDirectTaskTurnStarted(i,n);if(s instanceof Response)return s;if(s!==void 0){try{await resumeHook(n,s)}catch{return Response.json({error:`Session callback not pending.`,ok:!1},{status:404})}return Response.json({ok:!0},{status:202})}let c=projectSessionCallbackResult(i);if(c instanceof Response)return c;try{await resumeHook(n,{kind:`runtime-action-result`,results:[c]})}catch{return Response.json({error:`Session callback not pending.`,ok:!1},{status:404})}return Response.json({ok:!0},{status:202})}function callbackKind(e){if(!(typeof e!=`object`||!e))return Reflect.get(e,`kind`)}function projectTaskEvent(e,t){let n=callbackKind(e);if(n!==`task.input-requested`&&n!==`task.authorization`)return;let r=taskEventCallbackSchema.safeParse(e);if(!r.success)return Response.json({error:`Invalid task event callback.`,ok:!1},{status:400});let i=r.data;if(readTaskIdFromInboxToken(t)!==void 0){let e=rejectMismatchedTaskToken(t,i.taskId);return e===void 0?Response.json({error:`Direct subagent task events are no longer accepted.`,ok:!1},{status:410}):e}return i.kind===`task.input-requested`?{callId:i.callId,childContinuationToken:i.childContinuationToken,childSessionId:i.childSessionId,event:i.event,kind:`subagent-input-request`,subagentName:i.subagentName}:{callId:i.callId,childSessionId:i.childSessionId,event:i.event,kind:`subagent-authorization-event`,subagentName:i.subagentName}}function rejectDirectTaskTurnStarted(e,t){if(callbackKind(e)!==`turn.started`)return;let n=taskTurnStartedCallbackSchema.safeParse(e);if(!n.success)return Response.json({error:`Invalid task turn-start callback.`,ok:!1},{status:400});let r=rejectMismatchedTaskToken(t,n.data.taskId);return r===void 0?Response.json({error:`Direct subagent task turn callbacks are no longer accepted.`,ok:!1},{status:410}):r}function projectTaskUpdate(e,t){if(callbackKind(e)!==`task.update`)return;let n=taskUpdateCallbackSchema.safeParse(e);if(!n.success)return Response.json({error:`Invalid task update callback.`,ok:!1},{status:400});if(readTaskIdFromInboxToken(t)!==void 0){let e=rejectMismatchedTaskToken(t,n.data.taskId);if(e!==void 0)return e}return{callId:n.data.callId,kind:`task-update`,message:n.data.message,updateEpoch:n.data.updateEpoch,updateIndex:n.data.updateIndex}}function rejectMismatchedTaskToken(e,t){return readTaskIdFromInboxToken(e)===t?void 0:Response.json({error:`Task callback token mismatch.`,ok:!1},{status:403})}function projectSessionCallbackResult(e){if(typeof e!=`object`||!e)return Response.json({error:`Expected a JSON object.`,ok:!1},{status:400});let t=callbackKind(e);if(t!==`session.completed`&&t!==`session.failed`&&t!==`turn.completed`&&t!==`turn.failed`)return Response.json({error:`Unsupported callback kind.`,ok:!1},{status:400});let n=sessionResultCallbackSchema.safeParse(e);if(!n.success)return Response.json({error:`Invalid session result callback.`,ok:!1},{status:400});let r=n.data;if(r.kind===`session.completed`){let e=r.output??``,t=parseCallbackUsage(r.usage),n={callId:r.callId,kind:`subagent-result`,origin:`child`,outcome:{kind:`terminal`,result:{kind:`succeeded`,output:e},usageDelta:t??ZERO_TOKEN_USAGE},output:e,subagentName:r.subagentName};return t===void 0?n:{...n,usage:t}}if(r.kind===`session.failed`){let e=r.error===void 0?{code:REMOTE_AGENT_FAILED,message:`Remote agent failed.`}:r.error,t=parseCallbackUsage(r.usage);return{callId:r.callId,isError:!0,kind:`subagent-result`,origin:`child`,outcome:{kind:`terminal`,result:{error:e,kind:`failed`},usageDelta:t??ZERO_TOKEN_USAGE},output:e,subagentName:r.subagentName}}return r.kind===`turn.completed`?{callId:r.callId,kind:`subagent-result`,origin:`child`,outcome:r.outcome,output:r.output??``,subagentName:r.subagentName,usage:r.outcome.usageDelta}:{callId:r.callId,isError:!0,kind:`subagent-result`,origin:`child`,outcome:r.outcome,output:r.error,subagentName:r.subagentName}}function parseCallbackUsage(e){if(e===void 0)return;let t=tokenUsageSchema.safeParse(e);return t.success?t.data:void 0}export{handleSessionCallbackRequest};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{createLogger}from"#internal/logging.js";import{SessionCallbackKey}from"#context/keys.js";import{toErrorMessage}from"#shared/errors.js";import{parseSessionCallback}from"#channel/session-callback.js";import{SESSION_FAILED}from"#subagents/agent-handle-errors.js";import{postSessionCallbackRequest}from"#execution/session-callback-request.js";const log=createLogger(`execution.session-callback`);async function fireTaskEventCallbackStep(e){"use step";let t=parseSerializedSessionCallback(e.callback);if(t.taskId===void 0)return;let n=e.event.type===`input.requested`,r=n?`task.input-requested`:`task.authorization`,i=await postSessionCallbackRequest({body:{callId:t.callId,childContinuationToken:e.childContinuationToken,childSessionId:e.childSessionId,event:n?e.event.data:e.event,kind:r,subagentName:t.subagentName,taskId:t.taskId},url:t.url});if(!i.ok)throw Error(`Task event callback failed with HTTP ${i.status}.`)}async function fireTaskUpdateCallbackStep(e){"use step";let t=parseSerializedSessionCallback(e.callback);if(t.taskId===void 0)return;let n=await postSessionCallbackRequest({body:{callId:e.callId,updateIndex:e.updateIndex,updateEpoch:e.updateEpoch,kind:`task.update`,message:e.message,taskId:t.taskId},url:t.url});if(!n.ok)throw Error(`Task update callback failed with HTTP ${n.status}.`);return t.taskId}async function fireSessionCallbackStep(e){"use step";let r=e.serializedContext[`eve.sessionId`]??``,o=e.serializedContext[SessionCallbackKey.name];if(o!==void 0)try{let t=parseSerializedSessionCallback(o),a=await postSessionCallbackRequest({body:e.status===`completed`?buildCompletedCallbackBody({callback:t,output:e.output,sessionId:r,usage:e.usage}):{callId:t.callId,error:{code:SESSION_FAILED,message:toErrorMessage(e.error)},kind:`session.failed`,sessionId:r,subagentName:t.subagentName,usage:e.usage},url:t.url});if(!a.ok)throw Error(`Session callback failed with HTTP ${a.status}.`)}catch(e){throw log.error(`failed to post session callback`,{error:e,sessionId:r}),e}}function buildCompletedCallbackBody(e){let t={callId:e.callback.callId,kind:`session.completed`,output:e.output??``,sessionId:e.sessionId,subagentName:e.callback.subagentName};return e.usage===void 0?t:{...t,usage:e.usage}}function parseSerializedSessionCallback(e){let t=parseSessionCallback(e);if(!t.ok)throw Error(`Serialized session callback is invalid.`,{cause:t.cause});return t.callback}export{fireSessionCallbackStep,fireTaskEventCallbackStep,fireTaskUpdateCallbackStep};
|
package/dist/src/{execution/agent-continuation-bundle.d.ts → subagents/continuation-bundle.d.ts}
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { RuntimeAgentHandleAction } from "#
|
|
1
|
+
import type { RuntimeAgentHandleAction } from "#subagents/handle-dispatch.js";
|
|
2
2
|
import type { CompiledBundle } from "#runtime/sessions/runtime-context-keys.js";
|
|
3
3
|
import type { getDynamicSubagentSelection } from "#context/dynamic-subagent-lifecycle.js";
|
|
4
4
|
type DynamicRemoteAgentConfig = NonNullable<Extract<ReturnType<typeof getDynamicSubagentSelection>, {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{resolveRemoteAgentForAction}from"#subagents/remote-dispatch.js";function createAgentContinuationBundle(e){let{action:t,dynamicRemoteAgent:n}=e;if(t.kind!==`remote-agent-call`||n===void 0)return e.bundle;let r=e.bundle.subagentRegistry.subagentsByNodeId,i=Object.assign(new Map(r),{get:e=>e===t.nodeId?{definition:resolveRemoteAgentForAction({dynamicRemoteAgent:n,nodeId:e,registry:r,remoteAgentName:t.remoteAgentName})}:r.get(e)});return{...e.bundle,subagentRegistry:{...e.bundle.subagentRegistry,subagentsByNodeId:i}}}export{createAgentContinuationBundle};
|
package/dist/src/{execution/subagent-event-proxy-step.d.ts → subagents/event-proxy-step.d.ts}
RENAMED
|
@@ -2,6 +2,7 @@ import type { SubagentAuthorizationEventHookPayload, SubagentInputRequestHookPay
|
|
|
2
2
|
import type { ContextContainer } from "#context/container.js";
|
|
3
3
|
import { type DurableSession, type DurableSessionState } from "#execution/durable-session-store.js";
|
|
4
4
|
import type { AnswerHookRoute } from "#harness/proxy-input-requests.js";
|
|
5
|
+
import type { TaskInputRequestDelivery } from "#tasks/types.js";
|
|
5
6
|
type SubagentEventHookPayload = SubagentAuthorizationEventHookPayload | SubagentInputRequestHookPayload;
|
|
6
7
|
interface ProxySubagentEventResult {
|
|
7
8
|
readonly serializedContext: Record<string, unknown>;
|
|
@@ -17,14 +18,7 @@ export declare function runProxySubagentEventStep(input: {
|
|
|
17
18
|
}): Promise<ProxySubagentEventResult>;
|
|
18
19
|
/** Emits a task request whose proxy routes were committed by a prior step. */
|
|
19
20
|
export declare function emitRecordedTaskInputRequestStep(input: {
|
|
20
|
-
readonly
|
|
21
|
-
readonly parentWritable: WritableStream<Uint8Array>;
|
|
22
|
-
readonly serializedContext: Record<string, unknown>;
|
|
23
|
-
readonly sessionState: DurableSessionState;
|
|
24
|
-
}): Promise<ProxySubagentEventResult>;
|
|
25
|
-
/** Emits a task authorization event after its ownership was validated. */
|
|
26
|
-
export declare function emitRecordedTaskAuthorizationEventStep(input: {
|
|
27
|
-
readonly hookPayload: SubagentAuthorizationEventHookPayload;
|
|
21
|
+
readonly request: TaskInputRequestDelivery;
|
|
28
22
|
readonly parentWritable: WritableStream<Uint8Array>;
|
|
29
23
|
readonly serializedContext: Record<string, unknown>;
|
|
30
24
|
readonly sessionState: DurableSessionState;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{callAdapterEventHandler}from"#channel/adapter.js";import{ModeKey}from"#context/keys.js";import{encodeMessageStreamEvent,stampMessageStreamEvent}from"#protocol/message.js";import{BundleKey,ChannelKey}from"#runtime/sessions/runtime-context-keys.js";import{emitTurnEpilogue,getHarnessEmissionState,setHarnessEmissionState}from"#harness/emission.js";import{deserializeContext,serializeContext}from"#context/serialize.js";import{createDurableSessionState,readDurableSession}from"#execution/durable-session-store.js";import{buildAdapterContext}from"#channel/adapter-context.js";import{withContextScope}from"#context/run-step.js";import{hydrateDurableSession}from"#execution/session.js";import{resolveEffectiveAgentRuntime}from"#execution/effective-agent-config.js";import{upsertProxyInputRequests}from"#harness/proxy-input-requests.js";import{emitProxiedInputRequest}from"#subagents/hitl-proxy.js";import{setChannelContext}from"#execution/channel-context.js";import{reconcileSessionContinuationToken}from"#execution/reconcile-session-continuation-token.js";async function runProxySubagentEventStep(e){"use step";let t=await readDurableSession(e.sessionState),n=await deserializeContext(e.serializedContext);return emitProxiedSubagentEvent({answerHook:e.answerHook,ctx:n,durableSession:t,hookPayload:e.hookPayload,parentWritable:e.parentWritable})}async function emitRecordedTaskInputRequestStep(e){"use step";let t=await readDurableSession(e.sessionState);return await emitProxiedSubagentEvent({ctx:await deserializeContext(e.serializedContext),durableSession:t,hookPayload:{callId:e.request.taskId,childContinuationToken:e.request.replyTo,childSessionId:e.request.taskId,event:{requests:e.request.requests??[e.request.request],sequence:e.request.sequence,stepIndex:e.request.stepIndex,turnId:e.request.turnId},kind:`subagent-input-request`,subagentName:e.request.taskId},parentWritable:e.parentWritable,recordProxyInputRequests:!1})}async function emitProxiedSubagentEvent(i){let{ctx:a}=i,o=a.require(ChannelKey),s=resolveEffectiveAgentRuntime(a.require(BundleKey),a),c=hydrateDurableSession({compactionOverrides:{thresholdPercent:s.thresholdPercent},durable:i.durableSession,turnAgent:s.turnAgent}),l=buildAdapterContext(o,a),u=i.parentWritable.getWriter(),d,f;try{let emit=async t=>{let r=await callAdapterEventHandler(o,t,l);await u.write(encodeMessageStreamEvent(stampMessageStreamEvent(r)))},r=await withContextScope(a,c,async e=>{if(i.hookPayload.kind===`subagent-authorization-event`)return await emit(i.hookPayload.event),{result:void 0,session:await closeStandaloneAuthorizationEvent({emit,eventType:i.hookPayload.event.type,mode:a.require(ModeKey),session:e})};let n=await emitProxiedInputRequest({emit,hookPayload:i.hookPayload,mode:a.require(ModeKey),session:e});return{result:n.entries,session:n.session}});d=r.result,f=r.session}finally{u.releaseLock()}if(setChannelContext(a,{...o,state:{...l.state}}),i.recordProxyInputRequests!==!1&&d!==void 0&&i.hookPayload.kind===`subagent-input-request`){let e=i.answerHook;f=upsertProxyInputRequests({entries:e===void 0?d:d.map(([t,n])=>[t,{...n,answerHook:e}]),forChildContinuationToken:i.hookPayload.childContinuationToken,session:f})}let p=reconcileSessionContinuationToken(a,f);return{serializedContext:serializeContext(a),sessionState:createDurableSessionState({session:p})}}async function closeStandaloneAuthorizationEvent(e){if(e.mode!==`conversation`||e.eventType!==`authorization.required`&&e.eventType!==`authorization.completed`)return e.session;let t=getHarnessEmissionState(e.session.state),n=await emitTurnEpilogue(e.emit,t,e.mode);return setHarnessEmissionState(e.session,n)}export{emitProxiedSubagentEvent,emitRecordedTaskInputRequestStep,runProxySubagentEventStep};
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/** Continuation delivery for task-owned agent sessions. */
|
|
2
|
+
import type { SessionAuthContext } from "#channel/types.js";
|
|
3
|
+
import type { AgentAddress } from "#subagents/handles/store.js";
|
|
4
|
+
import type { RuntimeAgentDispatchRequest, RuntimeRemoteAgentDispatchRequest, RuntimeSubagentDispatchRequest, RuntimeSubagentDispatchFailure } from "#shared/action-types.js";
|
|
5
|
+
import type { CompiledBundle } from "#runtime/sessions/runtime-context-keys.js";
|
|
6
|
+
import type { hydrateDurableSession } from "#execution/session.js";
|
|
7
|
+
import type { TaskOwnedAgentHandle } from "#subagents/handles/store.js";
|
|
8
|
+
/** Agent-task requests that may address an agent handle via `agentId`. */
|
|
9
|
+
export type RuntimeAgentHandleAction = RuntimeRemoteAgentDispatchRequest | RuntimeSubagentDispatchRequest;
|
|
10
|
+
/** Narrows an action to the kinds that may carry an `agentId` continuation. */
|
|
11
|
+
export declare function isAgentHandleAction(action: RuntimeAgentDispatchRequest): action is RuntimeAgentHandleAction;
|
|
12
|
+
/** Hydrated parent session snapshot threaded through dispatch. */
|
|
13
|
+
export type RuntimeSession = ReturnType<typeof hydrateDurableSession>;
|
|
14
|
+
/**
|
|
15
|
+
* Outcome of dispatching one planned agent task: an adopted child ready for
|
|
16
|
+
* the `subagent.called` emission tail, or a per-task error result.
|
|
17
|
+
* Either way the (possibly updated) session snapshot rides along.
|
|
18
|
+
*
|
|
19
|
+
* `address` is the same confirmed {@link AgentAddress} recorded on the
|
|
20
|
+
* child's running handle; consumers project it into wire shapes (e.g. the
|
|
21
|
+
* flat `childSessionId` / `remote` fields of `subagent.called`) at the
|
|
22
|
+
* emission site instead of this type re-encoding them.
|
|
23
|
+
*/
|
|
24
|
+
export type DispatchOutcome = {
|
|
25
|
+
readonly address: AgentAddress;
|
|
26
|
+
readonly callId: string;
|
|
27
|
+
readonly kind: "called";
|
|
28
|
+
readonly name: string;
|
|
29
|
+
readonly session: RuntimeSession;
|
|
30
|
+
readonly toolName: string;
|
|
31
|
+
} | {
|
|
32
|
+
readonly deliveryAmbiguous?: boolean;
|
|
33
|
+
readonly deliveryPermanent?: boolean;
|
|
34
|
+
readonly kind: "error";
|
|
35
|
+
readonly result: RuntimeSubagentDispatchFailure;
|
|
36
|
+
readonly session: RuntimeSession;
|
|
37
|
+
};
|
|
38
|
+
/** Delivers a continuation after the session handle store atomically claimed it for one owner. */
|
|
39
|
+
export declare function dispatchToClaimedAgentAddress(input: {
|
|
40
|
+
readonly action: RuntimeAgentHandleAction;
|
|
41
|
+
readonly auth: SessionAuthContext | null;
|
|
42
|
+
readonly bundle: CompiledBundle;
|
|
43
|
+
readonly currentSession: RuntimeSession;
|
|
44
|
+
readonly parentToken: string;
|
|
45
|
+
readonly handle: Extract<TaskOwnedAgentHandle, {
|
|
46
|
+
phase: "claimed";
|
|
47
|
+
}>;
|
|
48
|
+
readonly taskId?: string;
|
|
49
|
+
}): Promise<DispatchOutcome>;
|
|
50
|
+
export declare function createAgentErrorResult(input: {
|
|
51
|
+
readonly action: RuntimeAgentHandleAction;
|
|
52
|
+
readonly code: string;
|
|
53
|
+
readonly message: string;
|
|
54
|
+
}): RuntimeSubagentDispatchFailure;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{createEveCallbackRoutePath}from"#protocol/routes.js";import{createLogger,logError}from"#internal/logging.js";import{createWorkflowRuntime}from"#execution/workflow-runtime.js";import{continueRemoteAgentSession,isAmbiguousRemoteAgentContinueError,isRetryableRemoteAgentContinueError,resolveRemoteAgentForAction}from"#subagents/remote-dispatch.js";import{AGENT_UNREACHABLE}from"#subagents/agent-handle-errors.js";import{createWorkflowCallbackUrl}from"#execution/workflow-callback-url.js";import{readTaskIdFromInboxToken}from"#tasks/task-inbox-token.js";import{isRuntimeNoActiveSessionError}from"#execution/runtime-errors.js";import{normalizeRequestedOutputSchema}from"#subagents/invocation.js";import{err,ok}from"#shared/result.js";const log=createLogger(`execution.agent-handle-dispatch`);function isAgentHandleAction(e){return e.kind===`subagent-call`||e.kind===`remote-agent-call`}async function dispatchToClaimedAgentAddress(e){return await dispatchToAgentAddress(e)}async function dispatchToAgentAddress(e){let{action:t,handle:r}=e,i=r.identity.id,a=await deliverToAgentAddress({action:t,address:r.address,auth:e.auth,bundle:e.bundle,identity:r.identity,parentToken:e.parentToken,taskId:e.taskId});if(!a.ok){let{cause:o,permanent:s}=a.error;return logError(log,`task agent delivery failed`,o,{agentId:i,callId:t.callId,nodeId:r.identity.nodeId,permanent:s,subagentName:r.identity.name}),{deliveryAmbiguous:a.error.deliveryAmbiguous,deliveryPermanent:s,kind:`error`,result:createAgentErrorResult({action:t,code:AGENT_UNREACHABLE,message:s?`Agent "${r.identity.name}" with id "${i}" is no longer reachable.`:`Agent "${r.identity.name}" with id "${i}" is temporarily unreachable. Try again.`}),session:e.currentSession}}return{address:r.address,callId:t.callId,kind:`called`,name:t.name,session:e.currentSession,toolName:r.identity.name}}async function deliverToAgentAddress(t){let{action:n,address:c,bundle:l,identity:u}=t;if(c.kind===`agent/remote`){let r;try{r=resolveRemoteAgentForAction({nodeId:u.nodeId,remoteAgentName:u.name,registry:l.subagentRegistry.subagentsByNodeId})}catch(e){return err({cause:e,deliveryAmbiguous:!1,permanent:!0})}try{await continueRemoteAgentSession({auth:t.auth,callback:{callId:n.callId,subagentName:u.name,taskId:t.taskId??readTaskIdFromInboxToken(t.parentToken),token:t.parentToken,url:createWorkflowCallbackUrl(c.callbackBaseUrl,createEveCallbackRoutePath(t.parentToken))},message:readSubagentMessage(n),outputSchema:normalizeRequestedOutputSchema(n.input.outputSchema),remote:{...r,url:c.url},sessionId:c.sessionId})}catch(e){return err({cause:e,deliveryAmbiguous:isAmbiguousRemoteAgentContinueError(e),permanent:!isRetryableRemoteAgentContinueError(e)})}return ok(void 0)}let d=createWorkflowRuntime({compiledArtifactsSource:l.compiledArtifactsSource,nodeId:u.nodeId});try{if((await d.dispatchSession({command:{auth:t.auth,caller:{callId:n.callId,replyTo:{kind:`hook`,token:t.parentToken},subagentName:u.name,taskId:t.taskId??readTaskIdFromInboxToken(t.parentToken)},kind:`send`,payload:{message:readSubagentMessage(n),outputSchema:normalizeRequestedOutputSchema(n.input.outputSchema)}},sessionId:c.sessionId})).status===`session_not_active`)return err({cause:Error(`Agent session "${c.sessionId}" is no longer active.`),deliveryAmbiguous:!1,permanent:!0})}catch(e){let t=isRuntimeNoActiveSessionError(e);return err({cause:e,deliveryAmbiguous:!t,permanent:t})}return ok(void 0)}function createAgentErrorResult(e){return{callId:e.action.callId,isError:!0,kind:`subagent-result`,origin:`dispatch`,output:{code:e.code,message:e.message},subagentName:e.action.kind===`remote-agent-call`?e.action.remoteAgentName:e.action.subagentName}}function readSubagentMessage(e){return typeof e.input.message==`string`?e.input.message:``}export{createAgentErrorResult,dispatchToClaimedAgentAddress,isAgentHandleAction};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ModelMessage } from "ai";
|
|
2
|
-
import type { AgentHandle, AgentHandleStore } from "#
|
|
2
|
+
import type { AgentHandle, AgentHandleStore } from "#subagents/handles/store.js";
|
|
3
3
|
/**
|
|
4
4
|
* Label prefixing every framework-injected agents announcement. Mock model
|
|
5
5
|
* adapters use it to treat announcements as transparent scaffolding rather
|
|
@@ -15,12 +15,12 @@ export interface AgentView {
|
|
|
15
15
|
readonly taskId?: string;
|
|
16
16
|
readonly taskStatus?: "working" | "input_required";
|
|
17
17
|
}
|
|
18
|
-
/** Returns the resumable handles: the only
|
|
18
|
+
/** Returns the resumable handles: the only phases the model may continue. */
|
|
19
19
|
export declare function projectParkedAgentHandles(store: AgentHandleStore): readonly Extract<AgentHandle, {
|
|
20
|
-
phase: "parked";
|
|
20
|
+
phase: "available" | "parked";
|
|
21
21
|
}>[];
|
|
22
22
|
/**
|
|
23
|
-
* Renders the model-visible agent listing. Only
|
|
23
|
+
* Renders the model-visible agent listing. Only idle handles appear:
|
|
24
24
|
* starting and running children cannot accept a continuation, and private
|
|
25
25
|
* delivery coordinates never render.
|
|
26
26
|
*/
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
const AGENTS_SNIPPET_LABEL=`[Agents]`;function projectParkedAgentHandles(e){return e.handles.filter(e=>e.phase===`parked`)}function renderAgentsSnippet(t){let n=projectParkedAgentHandles(t).map(e
|
|
1
|
+
const AGENTS_SNIPPET_LABEL=`[Agents]`;function projectParkedAgentHandles(e){return e.handles.filter(e=>e.phase===`available`||e.phase===`parked`)}function renderAgentsSnippet(t){let n=projectParkedAgentHandles(t).map(e=>{let t=e.phase===`parked`?e.lastStatus:`(available)`;return`<agent id="${escapeXml(e.identity.id)}" name="${escapeXml(e.identity.name)}">${escapeXml(t===``?`(no status)`:t)}</agent>`});return[AGENTS_SNIPPET_LABEL,`<agents>`,...n,`</agents>`].join(`
|
|
2
2
|
`)}function renderAgentViewsSnippet(t){let n=t.map(e=>{let t=e.taskId===void 0||e.taskStatus===void 0?``:` taskId="${escapeXml(e.taskId)}" taskStatus="${e.taskStatus}"`,n=e.statusLine??(e.availability===`busy`?`(busy)`:`(available)`);return`<agent id="${escapeXml(e.id)}" name="${escapeXml(e.name)}" availability="${e.availability}"${t}>${escapeXml(n)}</agent>`});return[AGENTS_SNIPPET_LABEL,`<agents>`,...n,`</agents>`].join(`
|
|
3
3
|
`)}function resolveAgentsAnnouncement(e){let t=e.messages.findLast(e=>e.role===`user`&&typeof e.content==`string`&&e.content.startsWith(`[Agents]`)),n=e.store??{handles:[]},r=e.agentViews?.length??projectParkedAgentHandles(n).length;if(t===void 0&&r===0)return;let i=e.agentViews===void 0?renderAgentsSnippet(n):renderAgentViewsSnippet(e.agentViews);return t?.content===i?void 0:i}function escapeXml(e){return e.replaceAll(`&`,`&`).replaceAll(`"`,`"`).replaceAll(`<`,`<`).replaceAll(`>`,`>`)}export{AGENTS_SNIPPET_LABEL,projectParkedAgentHandles,renderAgentViewsSnippet,renderAgentsSnippet,resolveAgentsAnnouncement};
|
|
@@ -1,10 +1,16 @@
|
|
|
1
1
|
import type { RuntimeActionResult, RuntimeSubagentChildResult } from "#shared/action-types.js";
|
|
2
|
-
import type {
|
|
2
|
+
import type { TurnOwnedAgentHandle } from "#subagents/handles/store.js";
|
|
3
3
|
import type { SessionStateMap } from "#harness/types.js";
|
|
4
4
|
/** A handle with one outstanding operation and a confirmed child address. */
|
|
5
|
-
export type RunningAgentHandle = Extract<
|
|
5
|
+
export type RunningAgentHandle = Extract<TurnOwnedAgentHandle, {
|
|
6
6
|
phase: "running";
|
|
7
7
|
}>;
|
|
8
|
+
/** Preserves driver-owned task leases when a concurrent turn returns an older snapshot. */
|
|
9
|
+
export declare function mergeTaskOwnedAgentHandlesIntoTurnState(input: {
|
|
10
|
+
readonly baseState: SessionStateMap | undefined;
|
|
11
|
+
readonly driverState: SessionStateMap | undefined;
|
|
12
|
+
readonly turnState: SessionStateMap | undefined;
|
|
13
|
+
}): SessionStateMap | undefined;
|
|
8
14
|
/**
|
|
9
15
|
* Finds the running agent handle a child-produced result must settle: the
|
|
10
16
|
* handle whose recorded operation carries the result's callId.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{AGENT_HANDLES_STATE_KEY}from"#subagents/handles/state-key.js";function readAgentHandles(t){let n=t?.[AGENT_HANDLES_STATE_KEY];if(n===void 0)return[];let r=n.handles;return Array.isArray(r)?r:[]}function mergeTaskOwnedAgentHandlesIntoTurnState(t){let n=new Map(readAgentHandles(t.baseState).map(e=>[e.identity.id,e])),r=new Map(readAgentHandles(t.driverState).map(e=>[e.identity.id,e])),i=new Set([...n.keys(),...r.keys()]);for(let e of i)handlesEqual(n.get(e),r.get(e))&&i.delete(e);if(i.size===0)return t.turnState;let a=[];for(let e of readAgentHandles(t.turnState)){if(!i.has(e.identity.id)){a.push(e);continue}let t=r.get(e.identity.id);if(!handlesEqual(e,n.get(e.identity.id))&&!handlesEqual(e,t))throw Error(`Agent handle "${e.identity.id}" changed ownership while its turn was running.`);t!==void 0&&a.push(t),i.delete(e.identity.id)}for(let e of i){let t=r.get(e);t!==void 0&&a.push(t)}return{...t.turnState,[AGENT_HANDLES_STATE_KEY]:{handles:a}}}function handlesEqual(e,t){if(e===t)return!0;if(e===void 0||t===void 0)return!1;let n=Object.keys(e),r=Object.keys(t);return n.length===r.length&&n.every(n=>valuesEqual(Reflect.get(e,n),Reflect.get(t,n)))}function valuesEqual(e,t){if(e===t)return!0;if(typeof e!=`object`||!e||typeof t!=`object`||!t)return!1;let n=Object.keys(e),r=Object.keys(t);return n.length===r.length&&n.every(n=>valuesEqual(Reflect.get(e,n),Reflect.get(t,n)))}function findRunningAgentHandle(e,t){return readAgentHandles(e).find(e=>e.phase===`running`&&e.operation.callId===t.callId)}function isResultBoundToRunningHandle(e,t){return t.kind!==`subagent-result`||t.origin===`dispatch`||t.backgroundTask!==void 0||findRunningAgentHandle(e,{callId:t.callId})!==void 0}function isInboxSubagentResultFromRunningHandle(e,t){return findRunningAgentHandle(e,{callId:t.callId})!==void 0}export{findRunningAgentHandle,isInboxSubagentResultFromRunningHandle,isResultBoundToRunningHandle,mergeTaskOwnedAgentHandlesIntoTurnState};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { DurableSessionState } from "#execution/durable-session-store.js";
|
|
2
|
+
import type { TurnDriverAction } from "#execution/turn-control-receiver.js";
|
|
3
|
+
/** Preserves handle leases accepted by the driver against a turn's older snapshot. */
|
|
4
|
+
export declare function rebaseTaskAgentHandleMutations(action: TurnDriverAction, driverState: DurableSessionState, baseState: DurableSessionState): TurnDriverAction;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{mergeTaskOwnedAgentHandlesIntoTurnState}from"#subagents/handles/query.js";function rebaseTaskAgentHandleMutations(e,t,n){let r=e.sessionState.snapshot;if(r===void 0)throw Error(`Cannot merge task-owned agent handles into a session state without a snapshot.`);return{...e,sessionState:{...e.sessionState,snapshot:{...r,session:{...r.session,state:mergeTaskOwnedAgentHandlesIntoTurnState({baseState:n.snapshot?.session.state,driverState:t.snapshot?.session.state,turnState:r.session.state})}}}}}export{rebaseTaskAgentHandleMutations};
|