eve 0.56.0 → 0.57.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 +40 -0
- package/dist/src/channel/adapter-context.d.ts +1 -1
- package/dist/src/channel/adapter.d.ts +2 -2
- package/dist/src/channel/channel-address.js +1 -1
- package/dist/src/channel/session.d.ts +4 -3
- package/dist/src/channel/session.js +1 -1
- package/dist/src/channel/types.d.ts +7 -4
- package/dist/src/chunks/{use-eve-agent-RUGSwq8b.js → use-eve-agent-C2APNCdP.js} +45 -12
- package/dist/src/chunks/{use-eve-agent-CMdMlS7Y.js → use-eve-agent-D0YnDLi_.js} +45 -12
- package/dist/src/cli/commands/init.d.ts +2 -6
- package/dist/src/cli/commands/init.js +1 -1
- package/dist/src/cli/commands/trace-detail.js +1 -1
- package/dist/src/cli/dev/environment.js +1 -1
- package/dist/src/cli/dev/run-interactive-ui.js +1 -1
- package/dist/src/cli/dev/tui/agent-header.js +1 -1
- package/dist/src/cli/dev/tui/blocks.d.ts +1 -6
- package/dist/src/cli/dev/tui/blocks.js +1 -1
- package/dist/src/cli/dev/tui/command-typeahead.js +1 -1
- package/dist/src/cli/dev/tui/message-queue.d.ts +11 -7
- package/dist/src/cli/dev/tui/message-queue.js +1 -1
- package/dist/src/cli/dev/tui/model-editor.d.ts +1 -1
- package/dist/src/cli/dev/tui/model-editor.js +1 -1
- package/dist/src/cli/dev/tui/prompt-command-handler.d.ts +0 -3
- package/dist/src/cli/dev/tui/prompt-command-handler.js +1 -1
- package/dist/src/cli/dev/tui/prompt-commands.d.ts +1 -1
- package/dist/src/cli/dev/tui/prompt-commands.js +1 -1
- package/dist/src/cli/dev/tui/question-panel.js +1 -1
- package/dist/src/cli/dev/tui/remote-auth-result.js +1 -1
- package/dist/src/cli/dev/tui/remote-auth.js +1 -1
- package/dist/src/cli/dev/tui/remote-startup.d.ts +10 -0
- package/dist/src/cli/dev/tui/remote-startup.js +1 -0
- package/dist/src/cli/dev/tui/runner.d.ts +12 -18
- package/dist/src/cli/dev/tui/runner.js +3 -1
- package/dist/src/cli/dev/tui/setup-commands.d.ts +7 -13
- package/dist/src/cli/dev/tui/setup-commands.js +2 -2
- package/dist/src/cli/dev/tui/setup-issues.d.ts +1 -1
- package/dist/src/cli/dev/tui/setup-issues.js +1 -1
- package/dist/src/cli/dev/tui/setup-panel.d.ts +5 -17
- package/dist/src/cli/dev/tui/setup-panel.js +5 -6
- package/dist/src/cli/dev/tui/status-line.d.ts +1 -8
- package/dist/src/cli/dev/tui/status-line.js +1 -1
- package/dist/src/cli/dev/tui/steering-stream.d.ts +15 -0
- package/dist/src/cli/dev/tui/steering-stream.js +1 -0
- package/dist/src/cli/dev/tui/terminal-renderer.d.ts +3 -2
- package/dist/src/cli/dev/tui/terminal-renderer.js +12 -12
- package/dist/src/cli/dev/tui/test/mock-terminal.d.ts +2 -2
- package/dist/src/cli/dev/tui/test/mock-terminal.js +1 -1
- package/dist/src/cli/dev/tui/theme.d.ts +0 -2
- package/dist/src/cli/dev/tui/theme.js +1 -1
- package/dist/src/cli/dev/tui/vercel-status.d.ts +4 -2
- package/dist/src/cli/dev/tui/vercel-status.js +1 -1
- package/dist/src/cli/run.js +1 -1
- package/dist/src/cli/telemetry/index.d.ts +1 -1
- package/dist/src/cli/telemetry/index.js +1 -1
- package/dist/src/client/agent-info-schema.d.ts +2 -0
- package/dist/src/client/agent-info-schema.js +1 -1
- package/dist/src/client/eve-agent-store-state.d.ts +19 -0
- package/dist/src/client/eve-agent-store.js +1 -1
- package/dist/src/client/ndjson.d.ts +2 -0
- package/dist/src/client/ndjson.js +3 -3
- package/dist/src/client/open-stream.d.ts +1 -0
- package/dist/src/client/open-stream.js +1 -1
- package/dist/src/compiled/.vendor-stamp.json +1 -1
- package/dist/src/compiled/@workflow/core/index.js +2 -2
- package/dist/src/compiled/@workflow/core/private.js +1 -1
- package/dist/src/compiled/@workflow/core/runtime/helpers.js +1 -0
- package/dist/src/compiled/@workflow/core/runtime.js +2 -2
- package/dist/src/compiled/@workflow/core/serialization.js +1 -0
- package/dist/src/compiled/@workflow/core/workflow.js +1 -1
- package/dist/src/compiled/@workflow/world-local/index.js +5 -5
- package/dist/src/compiled/@workflow/world-vercel/index.js +2 -2
- package/dist/src/compiled/_chunks/workflow/attribute-changes-DTFAjP0J.js +6 -0
- package/dist/src/compiled/_chunks/workflow/{dist-PLkAQ-U7.js → dist-C5KCXSdI.js} +1 -1
- package/dist/src/compiled/_chunks/workflow/{frames-BvATzM2t.js → frames-DJw9L4rO.js} +3 -3
- package/dist/src/compiled/_chunks/workflow/global-DFW-hO6M.js +1 -0
- package/dist/src/compiled/_chunks/workflow/helpers-ClCA9Lmc.js +1 -0
- package/dist/src/compiled/_chunks/workflow/logger-D6vwIEf9.js +13 -0
- package/dist/src/compiled/_chunks/workflow/resume-hook-_baK8jaT.js +1 -0
- package/dist/src/compiled/_chunks/workflow/run-CRdL17z4.js +1 -0
- package/dist/src/compiled/_chunks/workflow/serialization-CWYPL4Eq.js +3 -0
- package/dist/src/compiled/_chunks/workflow/sleep-BL0kgJnT.js +1 -0
- package/dist/src/compiled/_chunks/workflow/wait-until-DyIt9lEx.js +1 -0
- package/dist/src/compiled/_chunks/workflow/{ws-transport-CVezyWwZ.js → ws-transport-Dl5FG4Sw.js} +1 -1
- package/dist/src/compiler/extension-compatibility.d.ts +15 -6
- package/dist/src/compiler/extension-compatibility.js +1 -1
- package/dist/src/context/dynamic-skill-lifecycle.js +1 -1
- package/dist/src/context/keys.d.ts +3 -1
- package/dist/src/context/keys.js +1 -1
- package/dist/src/eve-channel/index.js +1 -1
- package/dist/src/eve-channel/request.js +4 -3
- package/dist/src/execution/activity-cohort.js +1 -1
- package/dist/src/execution/activity-collector.js +1 -1
- package/dist/src/execution/authorization-callback-match.d.ts +2 -1
- package/dist/src/execution/authorization-callback-match.js +1 -1
- package/dist/src/execution/cancel-descendant-turns-step.js +1 -1
- package/dist/src/execution/cancel-indexed-session-tasks-step.js +1 -1
- package/dist/src/execution/cancelled-model-call-batch.d.ts +1 -1
- package/dist/src/execution/connections/callback-route.d.ts +1 -11
- package/dist/src/execution/connections/callback-route.js +1 -1
- package/dist/src/execution/continuation-conflict-step.d.ts +0 -1
- package/dist/src/execution/continuation-conflict-step.js +1 -1
- package/dist/src/execution/coordination-dispatch-shared.d.ts +1 -1
- package/dist/src/execution/coordination-dispatch-shared.js +1 -1
- package/dist/src/execution/create-session-step.d.ts +1 -1
- package/dist/src/execution/durable-session-store.d.ts +10 -48
- package/dist/src/execution/durable-session-store.js +1 -1
- package/dist/src/execution/dynamic-workflow/tool.js +1 -1
- package/dist/src/execution/eve-workflow-attributes.d.ts +0 -16
- package/dist/src/execution/eve-workflow-attributes.js +1 -1
- package/dist/src/execution/hook-ownership.d.ts +2 -4
- package/dist/src/execution/hook-ownership.js +1 -1
- package/dist/src/execution/legacy-session/authorization.d.ts +9 -0
- package/dist/src/execution/legacy-session/authorization.js +1 -0
- package/dist/src/execution/legacy-session/completion-step.d.ts +10 -0
- package/dist/src/execution/legacy-session/completion-step.js +1 -0
- package/dist/src/execution/legacy-session/inbox.d.ts +24 -0
- package/dist/src/execution/legacy-session/inbox.js +1 -0
- package/dist/src/execution/legacy-session/input.d.ts +19 -0
- package/dist/src/execution/legacy-session/input.js +1 -0
- package/dist/src/execution/legacy-session/interrupt-step.d.ts +3 -0
- package/dist/src/execution/legacy-session/interrupt-step.js +1 -0
- package/dist/src/execution/legacy-session/prepare-step.d.ts +24 -0
- package/dist/src/execution/legacy-session/prepare-step.js +1 -0
- package/dist/src/execution/legacy-session/snapshot.d.ts +12 -0
- package/dist/src/execution/legacy-session/snapshot.js +1 -0
- package/dist/src/execution/legacy-session/turn-workflow.d.ts +8 -0
- package/dist/src/execution/legacy-session/turn-workflow.js +1 -0
- package/dist/src/execution/model-call-batching.d.ts +1 -0
- package/dist/src/execution/model-call-batching.js +1 -1
- package/dist/src/execution/node-step.d.ts +1 -0
- package/dist/src/execution/node-step.js +1 -1
- package/dist/src/execution/proxied-deliver-step.d.ts +2 -20
- package/dist/src/execution/proxied-deliver-step.js +1 -1
- package/dist/src/execution/reconcile-session-continuation-token.d.ts +1 -1
- package/dist/src/execution/report-dropped-wire-payload-step.d.ts +1 -1
- package/dist/src/execution/route-child-delivery.d.ts +2 -2
- package/dist/src/execution/route-child-delivery.js +1 -1
- package/dist/src/execution/runtime-context.js +1 -1
- package/dist/src/execution/sandbox/bindings/eve-image.js +1 -1
- package/dist/src/execution/session/accepted-deployment.d.ts +3 -0
- package/dist/src/execution/session/accepted-deployment.js +1 -0
- package/dist/src/execution/session/admission.d.ts +38 -0
- package/dist/src/execution/session/admission.js +1 -0
- package/dist/src/execution/session/entry-input.d.ts +42 -0
- package/dist/src/execution/session/entry-input.js +1 -0
- package/dist/src/execution/session/entry.d.ts +13 -0
- package/dist/src/execution/session/entry.js +1 -0
- package/dist/src/execution/session/event-sink.d.ts +31 -0
- package/dist/src/execution/session/event-sink.js +1 -0
- package/dist/src/execution/session/finalization.d.ts +33 -0
- package/dist/src/execution/session/finalization.js +1 -0
- package/dist/src/execution/session/handoff-steps.d.ts +22 -0
- package/dist/src/execution/session/handoff-steps.js +1 -0
- package/dist/src/execution/session/handoff.d.ts +69 -0
- package/dist/src/execution/session/handoff.js +1 -0
- package/dist/src/execution/session/hook-tokens.d.ts +11 -0
- package/dist/src/execution/session/hook-tokens.js +1 -0
- package/dist/src/execution/session/input-queue.d.ts +72 -0
- package/dist/src/execution/session/input-queue.js +1 -0
- package/dist/src/execution/session/next-input.d.ts +32 -0
- package/dist/src/execution/session/next-input.js +1 -0
- package/dist/src/execution/{pending-turn-state.d.ts → session/pending-turn-state.d.ts} +0 -1
- package/dist/src/execution/{pending-turn-state.js → session/pending-turn-state.js} +1 -1
- package/dist/src/execution/session/program.d.ts +47 -0
- package/dist/src/execution/session/program.js +1 -0
- package/dist/src/execution/session/route-selected-delivery.d.ts +9 -0
- package/dist/src/execution/session/route-selected-delivery.js +1 -0
- package/dist/src/execution/session/state-cursor.d.ts +31 -0
- package/dist/src/execution/session/state-cursor.js +1 -0
- package/dist/src/execution/{session-timeout-control.d.ts → session/timeout-control.d.ts} +1 -1
- package/dist/src/execution/session/timeout-control.js +1 -0
- package/dist/src/execution/{session-timeout-steps.d.ts → session/timeout-steps.d.ts} +3 -2
- package/dist/src/execution/session/timeout-steps.js +1 -0
- package/dist/src/execution/{session-timeout-workflow.d.ts → session/timeout-workflow.d.ts} +3 -1
- package/dist/src/execution/session/timeout-workflow.js +1 -0
- package/dist/src/execution/session/timeout.d.ts +3 -0
- package/dist/src/execution/session/timeout.js +1 -0
- package/dist/src/execution/session/turn-step-result.d.ts +4 -0
- package/dist/src/execution/session/turn-step-result.js +1 -0
- package/dist/src/execution/session/turn-step-types.d.ts +68 -0
- package/dist/src/execution/session/turn-step-types.js +1 -0
- package/dist/src/execution/{workflow-steps.d.ts → session/turn-step.d.ts} +1 -2
- package/dist/src/execution/session/turn-step.js +1 -0
- package/dist/src/execution/session/turn.d.ts +31 -0
- package/dist/src/execution/session/turn.js +1 -0
- package/dist/src/execution/session-inbox/address.d.ts +21 -0
- package/dist/src/execution/session-inbox/address.js +1 -0
- package/dist/src/execution/session-inbox/inbox.d.ts +54 -0
- package/dist/src/execution/session-inbox/inbox.js +1 -0
- package/dist/src/execution/session-inbox/protocol.d.ts +10 -0
- package/dist/src/execution/session-inbox/protocol.js +1 -0
- package/dist/src/execution/session-inbox/release-step.d.ts +5 -0
- package/dist/src/execution/session-inbox/release-step.js +1 -0
- package/dist/src/execution/session-inbox/resume.d.ts +21 -0
- package/dist/src/execution/session-inbox/resume.js +1 -0
- package/dist/src/execution/{turn-workflow-tool-run.d.ts → session-workflow-tool-run.d.ts} +2 -2
- package/dist/src/execution/session-workflow-tool-run.js +1 -0
- package/dist/src/execution/settle-cancelled-turn-step.d.ts +2 -2
- package/dist/src/execution/settle-cancelled-turn-step.js +1 -1
- package/dist/src/execution/skills/instructions.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-input-response-route.js +1 -1
- package/dist/src/execution/tasks/child/steps.d.ts +1 -1
- package/dist/src/execution/tasks/child/steps.js +1 -1
- package/dist/src/execution/tasks/child/workflow.js +1 -1
- package/dist/src/execution/tasks/parent/delegate.js +1 -1
- package/dist/src/execution/tasks/parent/dispatch.js +1 -1
- package/dist/src/execution/tasks/parent/hitl-proxy-steps.js +1 -1
- package/dist/src/execution/tasks/parent/tool-execution.js +1 -1
- package/dist/src/execution/terminal-session-completion-step.d.ts +1 -1
- package/dist/src/execution/terminal-session-event.d.ts +1 -1
- package/dist/src/execution/terminal-session-event.js +1 -1
- package/dist/src/execution/terminal-session-failure-step.d.ts +1 -1
- package/dist/src/execution/terminal-session-failure-step.js +1 -1
- package/dist/src/execution/terminate-child-sessions-step.js +1 -1
- package/dist/src/execution/tools/sleep-workflow.js +1 -1
- package/dist/src/execution/tools/subagent/accept-event-step.js +1 -1
- package/dist/src/execution/tools/subagent/emit-called-step.d.ts +1 -1
- package/dist/src/execution/tools/subagent/emit-called-step.js +1 -1
- package/dist/src/execution/tools/subagent/invoke-agent.d.ts +1 -1
- package/dist/src/execution/tools/subagent/invoke-agent.js +1 -1
- package/dist/src/execution/tools/subagent/invoke-preparation.d.ts +6 -0
- package/dist/src/execution/tools/subagent/invoke-preparation.js +1 -1
- package/dist/src/execution/tools/subagent/invoke-step.js +1 -1
- package/dist/src/execution/tools/subagent/steer.d.ts +13 -0
- package/dist/src/execution/tools/subagent/steer.js +1 -0
- package/dist/src/execution/tools/subagent/task-agent-requests.d.ts +1 -1
- package/dist/src/execution/tools/subagent/task-agent-requests.js +1 -1
- package/dist/src/execution/tools/subagent/task-cancel.js +1 -1
- package/dist/src/execution/tools/workflow/ask.d.ts +0 -9
- package/dist/src/execution/tools/workflow/ask.js +1 -1
- package/dist/src/execution/tools/workflow/body.d.ts +0 -2
- package/dist/src/execution/tools/workflow/body.js +1 -1
- package/dist/src/execution/tools/workflow/emit-workflow-tool-run-report-step.d.ts +1 -1
- package/dist/src/execution/tools/workflow/emit-workflow-tool-run-report-step.js +1 -1
- package/dist/src/execution/tools/workflow/messages.d.ts +0 -1
- package/dist/src/execution/tools/workflow/messages.js +1 -1
- package/dist/src/execution/tools/workflow/owner.d.ts +3 -1
- package/dist/src/execution/tools/workflow/owner.js +1 -1
- package/dist/src/execution/tools/workflow/resume-hook-step.d.ts +1 -1
- package/dist/src/execution/tools/workflow/step-context.d.ts +0 -1
- package/dist/src/execution/tools/workflow/step-execution.js +1 -1
- package/dist/src/execution/tools/workflow/step.js +1 -1
- package/dist/src/execution/tools/workflow/workflow.js +1 -1
- package/dist/src/execution/workflow-runtime.d.ts +15 -18
- package/dist/src/execution/workflow-runtime.js +1 -1
- package/dist/src/harness/authorization.d.ts +5 -37
- package/dist/src/harness/authorization.js +1 -1
- package/dist/src/harness/compaction.js +1 -1
- package/dist/src/harness/coordination.js +1 -1
- package/dist/src/harness/emission-state.d.ts +1 -0
- package/dist/src/harness/emission.js +1 -1
- package/dist/src/harness/generation-steering.d.ts +22 -0
- package/dist/src/harness/generation-steering.js +1 -0
- package/dist/src/harness/messages.d.ts +1 -1
- package/dist/src/harness/messages.js +1 -1
- package/dist/src/harness/prompt-cache.js +1 -1
- package/dist/src/harness/proxy-input-requests.d.ts +1 -1
- package/dist/src/harness/proxy-input-requests.js +1 -1
- package/dist/src/harness/semantic-errors/rules/gateway.js +1 -1
- package/dist/src/harness/semantic-errors/signals.js +1 -1
- package/dist/src/harness/session-limit-enforcement.js +1 -1
- package/dist/src/harness/tool-loop.js +2 -2
- package/dist/src/harness/types.d.ts +2 -0
- package/dist/src/instrumentation/ai-sdk-hook-bridge.js +1 -1
- package/dist/src/instrumentation/channel-delivery.js +1 -1
- package/dist/src/instrumentation/lifecycle.d.ts +1 -0
- package/dist/src/instrumentation/native-events.js +1 -1
- package/dist/src/internal/application/compiled-artifacts.js +3 -2
- package/dist/src/internal/application/package.js +1 -1
- package/dist/src/internal/gateway.d.ts +1 -0
- package/dist/src/internal/gateway.js +1 -1
- package/dist/src/internal/model-auth/api-key.d.ts +7 -0
- package/dist/src/internal/model-auth/api-key.js +1 -0
- package/dist/src/internal/model-auth/available-models.d.ts +2 -0
- package/dist/src/internal/model-auth/available-models.js +1 -0
- package/dist/src/internal/model-auth/development-broker-client.d.ts +3 -0
- package/dist/src/internal/model-auth/development-broker-client.js +1 -0
- package/dist/src/internal/model-auth/development-broker-protocol.d.ts +12 -0
- package/dist/src/internal/model-auth/development-broker-protocol.js +1 -0
- package/dist/src/internal/model-auth/development-broker-server.d.ts +4 -0
- package/dist/src/internal/model-auth/development-broker-server.js +1 -0
- package/dist/src/internal/model-auth/gateway-credential.d.ts +2 -0
- package/dist/src/internal/model-auth/gateway-credential.js +1 -0
- package/dist/src/internal/model-auth/store.d.ts +16 -0
- package/dist/src/internal/model-auth/store.js +1 -0
- package/dist/src/internal/model-auth/transport.d.ts +6 -0
- package/dist/src/internal/model-auth/transport.js +1 -0
- package/dist/src/internal/model-auth/vercel-cli.d.ts +7 -0
- package/dist/src/internal/model-auth/vercel-cli.js +1 -0
- package/dist/src/internal/model-auth/vercel-team.d.ts +3 -0
- package/dist/src/internal/model-auth/vercel-team.js +1 -0
- package/dist/src/internal/model-auth/vercel.d.ts +13 -0
- package/dist/src/internal/model-auth/vercel.js +1 -0
- package/dist/src/internal/nitro/host/dev-authored-source-watcher.js +1 -1
- package/dist/src/internal/nitro/host/drained-nitro-dev-server.js +1 -1
- package/dist/src/internal/nitro/host/start-development-server.js +2 -2
- package/dist/src/internal/nitro/routes/channel-dispatch.js +1 -1
- package/dist/src/internal/nitro/routes/info.js +1 -1
- package/dist/src/internal/resolve-model-endpoint-status.d.ts +2 -0
- package/dist/src/internal/resolve-model-endpoint-status.js +1 -1
- package/dist/src/internal/vercel/api-resource.d.ts +4 -0
- package/dist/src/internal/vercel/api-resource.js +1 -0
- package/dist/src/internal/vercel/eve-service-contribution.js +1 -1
- package/dist/src/internal/vercel/vercel-services-config.d.ts +2 -0
- package/dist/src/internal/vercel/vercel-services-config.js +1 -1
- package/dist/src/internal/workflow/development-world-client.js +1 -1
- package/dist/src/internal/workflow/development-world-server.js +1 -1
- package/dist/src/internal/workflow/local-world-delivery-timeouts.d.ts +1 -1
- package/dist/src/internal/workflow/runtime.d.ts +1 -6
- package/dist/src/internal/workflow/runtime.js +1 -1
- package/dist/src/internal/workflow/vercel-world-defaults.d.ts +4 -0
- package/dist/src/internal/workflow/vercel-world-defaults.js +1 -0
- package/dist/src/protocol/activity.js +1 -1
- package/dist/src/protocol/message.d.ts +8 -0
- package/dist/src/protocol/message.js +2 -2
- package/dist/src/protocol/routes.d.ts +0 -2
- package/dist/src/protocol/routes.js +1 -1
- package/dist/src/public/channels/discord/discordChannel.js +1 -1
- package/dist/src/public/channels/slack/slackChannel.js +1 -1
- package/dist/src/public/channels/teams/teamsChannel.js +1 -1
- package/dist/src/public/channels/telegram/telegramChannel.js +1 -1
- package/dist/src/public/definitions/channel.d.ts +1 -1
- package/dist/src/public/definitions/channel.js +1 -1
- package/dist/src/public/models/anthropic/index.d.ts +3 -0
- package/dist/src/public/models/anthropic/index.js +1 -0
- package/dist/src/public/models/openai/chatgpt/codex-app-server.js +1 -1
- package/dist/src/public/models/openai/chatgpt/credential-store.js +1 -1
- package/dist/src/public/models/openai/chatgpt/oauth.js +1 -1
- package/dist/src/public/models/openai/chatgpt/transport.js +1 -1
- package/dist/src/public/models/openai/index.d.ts +4 -2
- package/dist/src/public/models/openai/index.js +1 -1
- package/dist/src/public/sandbox/docker-sandbox.d.ts +1 -1
- package/dist/src/public/sandbox/microsandbox-sandbox.d.ts +1 -1
- package/dist/src/public/sandbox/vercel-sandbox.d.ts +1 -1
- package/dist/src/public/vercel/index.d.ts +2 -1
- package/dist/src/public/vercel/index.js +1 -1
- package/dist/src/runtime/agent/resolve-model.js +1 -1
- package/dist/src/runtime/prompt/compose.js +1 -1
- package/dist/src/runtime/tools/registry.js +1 -1
- package/dist/src/self-modification/agent.js +1 -1
- package/dist/src/self-modification/setup.d.ts +9 -3
- package/dist/src/self-modification/setup.js +2 -2
- package/dist/src/setup/cli/option-row.d.ts +2 -1
- package/dist/src/setup/cli/option-row.js +1 -1
- package/dist/src/setup/cli/prompt-ui.d.ts +2 -0
- package/dist/src/setup/cli/prompt-ui.js +1 -1
- package/dist/src/setup/cli/select-state.d.ts +1 -1
- package/dist/src/setup/cli/select-state.js +1 -1
- package/dist/src/setup/flows/chatgpt-auth.js +1 -1
- package/dist/src/setup/flows/deploy.d.ts +4 -9
- package/dist/src/setup/flows/deploy.js +1 -1
- package/dist/src/setup/flows/ensure-vercel-project.js +1 -1
- package/dist/src/setup/flows/install-vercel-cli.d.ts +2 -3
- package/dist/src/setup/flows/login.d.ts +3 -1
- package/dist/src/setup/flows/login.js +1 -1
- package/dist/src/setup/flows/model-login-connection.d.ts +36 -0
- package/dist/src/setup/flows/model-login-connection.js +1 -0
- package/dist/src/setup/flows/model-login-progress.d.ts +7 -0
- package/dist/src/setup/flows/model-login-progress.js +1 -0
- package/dist/src/setup/flows/model-login.d.ts +22 -0
- package/dist/src/setup/flows/model-login.js +1 -0
- package/dist/src/setup/flows/model-source-change.d.ts +7 -0
- package/dist/src/setup/flows/model-source-change.js +1 -1
- package/dist/src/setup/flows/model.d.ts +6 -24
- package/dist/src/setup/flows/model.js +1 -1
- package/dist/src/setup/flows/registry.d.ts +3 -19
- package/dist/src/setup/flows/registry.js +1 -1
- package/dist/src/setup/flows/vercel-model-login.d.ts +5 -0
- package/dist/src/setup/flows/vercel-model-login.js +1 -0
- package/dist/src/setup/integrations/self-modification/setup.d.ts +2 -0
- package/dist/src/setup/integrations/self-modification/setup.js +1 -1
- package/dist/src/setup/project-resolution.js +1 -1
- package/dist/src/setup/prompter.d.ts +3 -1
- package/dist/src/setup/provider-settings.d.ts +19 -6
- package/dist/src/setup/provider-settings.js +1 -1
- package/dist/src/setup/scaffold/create/project.js +1 -1
- package/dist/src/setup/vercel-project.js +0 -0
- package/dist/src/setup/with-spinner.d.ts +1 -1
- package/dist/src/setup/with-spinner.js +1 -1
- package/dist/src/shared/action-types.js +1 -1
- package/dist/src/shared/agent-definition.d.ts +6 -4
- package/dist/src/shared/chatgpt-model.d.ts +2 -2
- package/dist/src/shared/chatgpt-model.js +1 -1
- package/dist/src/shared/model-connection.d.ts +17 -0
- package/dist/src/shared/model-connection.js +1 -0
- package/dist/src/shared/model-endpoint-status.d.ts +2 -1
- package/dist/src/shared/model-helper.d.ts +26 -0
- package/dist/src/shared/model-helper.js +1 -0
- package/dist/src/shared/package-version.d.ts +2 -0
- package/dist/src/shared/package-version.js +1 -0
- package/dist/src/shared/vercel-services.d.ts +1 -0
- package/dist/src/shared/vercel-services.js +1 -1
- package/dist/src/source-change/agent-config-ast.d.ts +6 -0
- package/dist/src/source-change/agent-config-ast.js +1 -1
- package/dist/src/source-change/apply-model-selection.d.ts +3 -1
- package/dist/src/source-change/apply-model-selection.js +1 -2
- package/dist/src/source-change/static-source-change.js +1 -1
- package/dist/src/subagents/callback-route.js +1 -1
- package/dist/src/subagents/event-proxy-step.d.ts +3 -3
- package/dist/src/subagents/event-proxy-step.js +1 -1
- package/dist/src/subagents/handle-dispatch.d.ts +12 -2
- package/dist/src/subagents/handle-dispatch.js +1 -1
- package/dist/src/subagents/handles/operation-id.d.ts +1 -1
- package/dist/src/subagents/handles/query.d.ts +0 -6
- package/dist/src/subagents/handles/query.js +1 -1
- package/dist/src/subagents/handles/state-key.d.ts +1 -1
- package/dist/src/subagents/handles/store.d.ts +1 -1
- package/dist/src/subagents/handles/store.js +1 -1
- package/dist/src/subagents/hitl-proxy.d.ts +1 -1
- package/dist/src/subagents/parent-notification.d.ts +2 -2
- package/dist/src/subagents/parent-result.d.ts +1 -1
- package/dist/src/subagents/remote-dispatch.d.ts +1 -1
- package/dist/src/subagents/remote-dispatch.js +1 -1
- package/dist/src/subagents/start-local.js +1 -1
- package/dist/src/subagents/tool.js +1 -1
- package/dist/src/svelte/index.js +1 -1
- package/dist/src/svelte/use-eve-agent.js +1 -1
- package/dist/src/tasks/session-index.js +1 -1
- package/dist/src/tasks/types.d.ts +1 -1
- package/dist/src/tracing/agent-otel-provider.js +2 -2
- package/dist/src/tracing/agent-otel-usage.js +1 -1
- package/dist/src/tracing/agent-span-contract.d.ts +1 -0
- package/dist/src/tracing/agent-span-contract.js +1 -1
- package/dist/src/tracing/agent-tool-instrumentation.js +1 -1
- package/dist/src/vue/index.js +1 -1
- package/dist/src/vue/use-eve-agent.js +1 -1
- package/docs/agent-config.md +22 -22
- package/docs/channels/chat-sdk.mdx +4 -2
- package/docs/channels/custom.mdx +16 -10
- package/docs/channels/eve.mdx +3 -1
- package/docs/channels/linq.mdx +1 -1
- package/docs/channels/overview.mdx +4 -2
- package/docs/channels/photon.mdx +4 -1
- package/docs/channels/slack.mdx +3 -1
- package/docs/concepts/execution-model-and-durability.mdx +62 -13
- package/docs/concepts/sessions-runs-and-streaming.md +14 -5
- package/docs/getting-started.mdx +7 -3
- package/docs/guides/deployment/vercel.mdx +1 -1
- package/docs/guides/dev-tui.md +54 -27
- package/docs/guides/frontend/overview.mdx +3 -1
- package/docs/guides/instrumentation/meta.json +1 -0
- package/docs/memory/custom-provider.md +1 -1
- package/docs/protocols/acp.md +1 -1
- package/docs/reference/cli.md +2 -2
- package/docs/reference/telemetry.md +1 -1
- package/docs/reference/typescript-api.md +12 -5
- package/docs/sandbox.mdx +3 -3
- package/docs/subagents/index.mdx +2 -2
- package/docs/tools/workflows.mdx +1 -1
- package/docs/tutorial/how-it-runs.mdx +1 -1
- package/package.json +6 -1
- package/dist/src/cli/commands/init-repl.d.ts +0 -80
- package/dist/src/cli/commands/init-repl.js +0 -1
- package/dist/src/cli/commands/init-self-modification.d.ts +0 -7
- package/dist/src/cli/commands/init-self-modification.js +0 -1
- package/dist/src/cli/dev/tui/prompt-placeholder.d.ts +0 -12
- package/dist/src/cli/dev/tui/prompt-placeholder.js +0 -1
- package/dist/src/cli/dev/tui/remote-auth-command.d.ts +0 -11
- package/dist/src/cli/dev/tui/remote-auth-command.js +0 -3
- package/dist/src/compiled/_chunks/workflow/attribute-changes-BAcgmlXp.js +0 -20
- package/dist/src/compiled/_chunks/workflow/private-CFJkQA7R.js +0 -1
- package/dist/src/compiled/_chunks/workflow/resume-hook-BEHe0Uut.js +0 -1
- package/dist/src/compiled/_chunks/workflow/run-ChHLjaCt.js +0 -1
- package/dist/src/compiled/_chunks/workflow/sleep-BB2HuVie.js +0 -1
- package/dist/src/execution/accepted-delivery-deployment.d.ts +0 -7
- package/dist/src/execution/accepted-delivery-deployment.js +0 -1
- package/dist/src/execution/dispatch-turn-step.d.ts +0 -5
- package/dist/src/execution/dispatch-turn-step.js +0 -1
- package/dist/src/execution/durable-session-migrations/chain.d.ts +0 -38
- package/dist/src/execution/durable-session-migrations/chain.js +0 -1
- package/dist/src/execution/durable-session-migrations/snapshot.d.ts +0 -6
- package/dist/src/execution/durable-session-migrations/snapshot.js +0 -1
- package/dist/src/execution/durable-session-migrations/turn-workflow-v0-to-v1.d.ts +0 -12
- package/dist/src/execution/durable-session-migrations/turn-workflow-v0-to-v1.js +0 -1
- package/dist/src/execution/durable-session-migrations/turn-workflow-v1-to-v2.d.ts +0 -2
- package/dist/src/execution/durable-session-migrations/turn-workflow-v1-to-v2.js +0 -1
- package/dist/src/execution/durable-session-migrations/turn-workflow.d.ts +0 -88
- package/dist/src/execution/durable-session-migrations/turn-workflow.js +0 -1
- package/dist/src/execution/forward-turn-cancellation-step.d.ts +0 -6
- package/dist/src/execution/forward-turn-cancellation-step.js +0 -1
- package/dist/src/execution/forward-turn-delivery-step.d.ts +0 -6
- package/dist/src/execution/forward-turn-delivery-step.js +0 -1
- package/dist/src/execution/inline-turn.d.ts +0 -31
- package/dist/src/execution/inline-turn.js +0 -1
- package/dist/src/execution/next-driver-action.d.ts +0 -85
- package/dist/src/execution/parked-delivery-wait.d.ts +0 -54
- package/dist/src/execution/parked-delivery-wait.js +0 -1
- package/dist/src/execution/session-command-inbox.d.ts +0 -52
- package/dist/src/execution/session-command-inbox.js +0 -1
- package/dist/src/execution/session-command-token.d.ts +0 -6
- package/dist/src/execution/session-command-token.js +0 -1
- package/dist/src/execution/session-state-cursor.d.ts +0 -25
- package/dist/src/execution/session-state-cursor.js +0 -1
- package/dist/src/execution/session-timeout-control.js +0 -1
- package/dist/src/execution/session-timeout-steps.js +0 -1
- package/dist/src/execution/session-timeout-workflow.js +0 -1
- package/dist/src/execution/session-timeout.d.ts +0 -2
- package/dist/src/execution/session-timeout.js +0 -1
- package/dist/src/execution/turn-cancellation-control.d.ts +0 -30
- package/dist/src/execution/turn-cancellation-control.js +0 -1
- package/dist/src/execution/turn-cancellation-token.d.ts +0 -10
- package/dist/src/execution/turn-cancellation-token.js +0 -1
- package/dist/src/execution/turn-control-protocol.d.ts +0 -36
- package/dist/src/execution/turn-control-protocol.js +0 -1
- package/dist/src/execution/turn-control-receiver.d.ts +0 -54
- package/dist/src/execution/turn-control-receiver.js +0 -1
- package/dist/src/execution/turn-dispatch.d.ts +0 -39
- package/dist/src/execution/turn-dispatch.js +0 -1
- package/dist/src/execution/turn-execution-cursor.d.ts +0 -49
- package/dist/src/execution/turn-execution-cursor.js +0 -1
- package/dist/src/execution/turn-workflow-tool-run.js +0 -1
- package/dist/src/execution/turn-workflow.d.ts +0 -13
- package/dist/src/execution/turn-workflow.js +0 -1
- package/dist/src/execution/wire/session-inbox-contract.d.ts +0 -38
- package/dist/src/execution/wire/session-inbox-contract.js +0 -1
- package/dist/src/execution/wire/session-inbox-encoder.d.ts +0 -47
- package/dist/src/execution/wire/session-inbox-encoder.js +0 -1
- package/dist/src/execution/wire/session-inbox-resume.d.ts +0 -12
- package/dist/src/execution/wire/session-inbox-resume.js +0 -1
- package/dist/src/execution/wire/session-inbox-wire.d.ts +0 -29
- package/dist/src/execution/wire/session-inbox-wire.js +0 -1
- package/dist/src/execution/wire/session-inbox-wire.v0.d.ts +0 -5
- package/dist/src/execution/wire/session-inbox-wire.v0.js +0 -1
- package/dist/src/execution/wire/session-inbox-wire.v1.d.ts +0 -237
- package/dist/src/execution/wire/session-inbox-wire.v1.js +0 -1
- package/dist/src/execution/wire/session-inbox-wire.v2-migration.d.ts +0 -2
- package/dist/src/execution/wire/session-inbox-wire.v2-migration.js +0 -1
- package/dist/src/execution/wire/session-inbox-wire.v2.d.ts +0 -478
- package/dist/src/execution/wire/session-inbox-wire.v2.js +0 -1
- package/dist/src/execution/wire/session-inbox-wire.v2.migration.d.ts +0 -3
- package/dist/src/execution/wire/session-inbox-wire.v2.migration.js +0 -1
- package/dist/src/execution/wire/session-inbox-wire.v3.d.ts +0 -480
- package/dist/src/execution/wire/session-inbox-wire.v3.js +0 -1
- package/dist/src/execution/wire/session-inbox-wire.v3.migration.d.ts +0 -3
- package/dist/src/execution/wire/session-inbox-wire.v3.migration.js +0 -1
- package/dist/src/execution/wire/session-inbox-wire.v4.d.ts +0 -267
- package/dist/src/execution/wire/session-inbox-wire.v4.js +0 -1
- package/dist/src/execution/wire/session-inbox-wire.v4.migration.d.ts +0 -3
- package/dist/src/execution/wire/session-inbox-wire.v4.migration.js +0 -1
- package/dist/src/execution/wire/session-inbox-wire.v5.d.ts +0 -341
- package/dist/src/execution/wire/session-inbox-wire.v5.js +0 -1
- package/dist/src/execution/wire/session-inbox-wire.v5.migration.d.ts +0 -3
- package/dist/src/execution/wire/session-inbox-wire.v5.migration.js +0 -1
- package/dist/src/execution/wire/session-inbox-wire.v6.d.ts +0 -341
- package/dist/src/execution/wire/session-inbox-wire.v6.js +0 -1
- package/dist/src/execution/wire/session-inbox-wire.v7.d.ts +0 -342
- package/dist/src/execution/wire/session-inbox-wire.v7.js +0 -1
- package/dist/src/execution/workflow-entry-crash.d.ts +0 -39
- package/dist/src/execution/workflow-entry-crash.js +0 -1
- package/dist/src/execution/workflow-entry-finalization.d.ts +0 -28
- package/dist/src/execution/workflow-entry-finalization.js +0 -1
- package/dist/src/execution/workflow-entry.d.ts +0 -37
- package/dist/src/execution/workflow-entry.js +0 -1
- package/dist/src/execution/workflow-steps.js +0 -1
- package/dist/src/subagents/handles/rebase.d.ts +0 -4
- package/dist/src/subagents/handles/rebase.js +0 -1
- /package/dist/src/{execution/next-driver-action.js → client/eve-agent-store-state.js} +0 -0
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{findWorkflowToolRun,isInboxSubagentResultFromRecordedWorkflowToolRun,isInboxToolResultFromRecordedWorkflowToolRun}from"#harness/workflow-tool-runs.js";import{cancelAgentInvocationOwnerStep}from"#execution/tools/subagent/task-cancel.js";import{runProxySubagentEventStep}from"#subagents/event-proxy-step.js";import{applyTaskAgentRequest}from"#execution/tools/subagent/task-agent-requests.js";import{resumeHookStep}from"#execution/tools/workflow/resume-hook-step.js";import{workflowToolRunOutcomeToSubagentResult,workflowToolRunOutcomeToToolResult,workflowToolRunRequestToInputRequestPayload}from"#execution/tools/workflow/owner-inbox.js";import{resolveWorkflowCallbackBaseUrl}from"#execution/workflow-callback-url.js";import{releaseAgentInvocationOwnerStep}from"#execution/tools/subagent/invoke-step.js";import{emitWorkflowToolRunReportStep}from"#execution/tools/workflow/emit-workflow-tool-run-report-step.js";async function handleWorkflowToolRunMessage(e){let{message:t}=e;switch(t.kind){case`outcome`:return await handleWorkflowToolRunOutcome({...e,message:t});case`request`:await handleWorkflowToolRunRequest({...e,message:t});return;case`report`:await emitWorkflowToolRunReportStep({from:t.from,parentWritable:e.cursor.parentWritable,update:t.update});return}}async function handleWorkflowToolRunOutcome(e){let{cursor:t,message:n}=e,r=findWorkflowToolRun(t.sessionState.snapshot?.session.state,n.from.callId);if(r?.runId!==n.from.runId)return;let i=r.resultKind===`subagent`?await settleSubagentOutcome(e):workflowToolRunOutcomeToToolResult(n);await cancelAgentInvocationOwnerStep({ownerId:n.from.runId,serializedContext:t.serializedContext,sessionState:t.sessionState});let a=await releaseAgentInvocationOwnerStep({cancelled:n.result.status===`cancelled`,ownerId:n.from.runId,sessionState:t.sessionState});await t.adopt({serializedContext:t.serializedContext,sessionState:a.sessionState});let o=t.sessionState.snapshot?.session.state;return(i.kind===`subagent-result`?i.callId===n.from.callId&&isInboxSubagentResultFromRecordedWorkflowToolRun(o,i):isInboxToolResultFromRecordedWorkflowToolRun(o,i))?i:void 0}async function settleSubagentOutcome(e){let{cursor:t,message:n}=e,r=workflowToolRunOutcomeToSubagentResult(n);return r.origin===`child`&&await t.adopt(await applyTaskAgentRequest({accumulateUsage:!1,ownerId:n.from.runId,replyTo:n.from.runId,request:{kind:`agent-settled`,result:r}},requestContext(e))),r}async function handleWorkflowToolRunRequest(e){let{cursor:t,message:n}=e;if(n.request.kind===`agent-invoke`||n.request.kind===`agent-settled`){if(findWorkflowToolRun(t.sessionState.snapshot?.session.state,n.from.callId)?.runId!==n.from.runId){n.request.kind===`agent-invoke`&&await resumeHookStep(n.replyTo,{kind:`runtime-action-result`,results:[{callId:n.request.invocationId,isError:!0,kind:`subagent-result`,origin:`dispatch`,output:{code:`AGENT_INVOCATION_NOT_ADMITTED`,message:`The workflow tool run no longer owns this agent invocation.`},subagentName:n.request.input.target}]});return}await t.adopt(await applyTaskAgentRequest({accumulateUsage:n.from.resultKind!==`subagent`,ownerId:n.from.runId,replyTo:n.replyTo,request:n.request},requestContext(e)));return}if(n.request.kind===`authorization-request`){await t.adopt(await runProxySubagentEventStep({hookPayload:n.request.event,parentWritable:t.parentWritable,serializedContext:t.serializedContext,sessionState:t.sessionState})),n.request.event.childSessionId===n.from.runId&&await resumeHookStep(n.replyTo,null,{ifPresent:!0});return}await t.adopt(await runProxySubagentEventStep({...n.requestCoordinates===void 0?{answerHook:{runId:n.from.runId}}:{},hookPayload:workflowToolRunRequestToInputRequestPayload(n),parentWritable:t.parentWritable,serializedContext:t.serializedContext,sessionState:t.sessionState}))}function requestContext(e){return{callbackBaseUrl:resolveWorkflowCallbackBaseUrl(e.callbackMetadataUrl),parentWritable:e.cursor.parentWritable,serializedContext:e.cursor.serializedContext,sessionState:e.cursor.sessionState}}export{handleWorkflowToolRunMessage};
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { type TurnWorkflowInput } from "#execution/durable-session-migrations/turn-workflow.js";
|
|
2
|
-
export type { TurnWorkflowInput };
|
|
3
|
-
/**
|
|
4
|
-
* Runs one complete logical turn, including child-agent waits when supported.
|
|
5
|
-
*
|
|
6
|
-
* The turn-owned path also owns turn cancellation: resuming the
|
|
7
|
-
* turn-private cancel hook (`{completionToken}:cancel`) mid-turn aborts the
|
|
8
|
-
* signal serialized into every `turnStep` and settles the turn as
|
|
9
|
-
* `turn.cancelled` → `session.waiting` — never as a failure. A late or
|
|
10
|
-
* guard-mismatched cancel is a benign no-op.
|
|
11
|
-
*/
|
|
12
|
-
export declare function turnWorkflow(rawInput: unknown): Promise<void>;
|
|
13
|
-
export declare function runTurnOwnedWorkflow(input: TurnWorkflowInput, onReady?: () => void): Promise<void>;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{createHook,getWorkflowMetadata}from"#compiled/@workflow/core/index.js";import{claimHookOwnership,disposeHook,isHookConflictError}from"#execution/hook-ownership.js";import{isInboxSubagentResultFromRecordedWorkflowToolRun,isInboxToolResultFromRecordedWorkflowToolRun}from"#harness/workflow-tool-runs.js";import{activeTurnId}from"#harness/active-turn-id.js";import{migrateTurnWorkflowInput}from"#execution/durable-session-migrations/turn-workflow.js";import{cancelAllIndexedSessionTasksStep}from"#execution/cancel-indexed-session-tasks-step.js";import{turnStep}from"#execution/workflow-steps.js";import{routeDeliverToChildren}from"#execution/route-child-delivery.js";import{runProxySubagentEventStep}from"#subagents/event-proxy-step.js";import{createChannelReader,raceChannelReads}from"#execution/tools/workflow/owner-channels.js";import{openWorkflowToolRunOwnerInbox}from"#execution/tools/workflow/owner.js";import{resolveWorkflowCallbackBaseUrl}from"#execution/workflow-callback-url.js";import{acknowledgeDelegatedTasksStep}from"#execution/tasks/parent/delegate.js";import{normalizeSerializableError}from"#execution/workflow-errors.js";import{sendTurnControlStep}from"#execution/turn-control-protocol.js";import{findRunningAgentHandle,isInboxSubagentResultFromRunningHandle}from"#subagents/handles/query.js";import{cancelDescendantTurnsStep}from"#execution/cancel-descendant-turns-step.js";import{dispatchCoordinationStep}from"#execution/coordination-dispatch-step.js";import{createTurnCancellationControl}from"#execution/turn-cancellation-control.js";import{TurnExecutionCursor}from"#execution/turn-execution-cursor.js";import{resolveRuntimeActionResultsForCallIds}from"#runtime/actions/results.js";import{handleWorkflowToolRunMessage}from"#execution/turn-workflow-tool-run.js";const TASK_MODE_WAIT_ERROR_MESSAGE="Task mode cannot wait for follow-up input (`next: null`).";async function turnWorkflow(e){"use workflow";let t=migrateTurnWorkflowInput(e);return t.driverCapabilities?.turnInbox===!0?runTurnOwnedWorkflow(t):runLegacyTurnWorkflow(t)}async function runTurnOwnedWorkflow(e,t){let n=createHook({token:`${e.completionToken}:inbox`}),r=createChannelReader(`inbox`,n),i=e.initialStep,a=new TurnExecutionCursor({controlToken:e.completionToken,parentWritable:e.stepInput.parentWritable,serializedContext:i?.beforeStep.serializedContext??e.stepInput.serializedContext,sessionState:i?.beforeStep.sessionState??e.stepInput.sessionState}),o=0,nextDeliveryRequestId=()=>`${n.token}:delivery:${String(o++)}`,s=[],c=e.stepInput.input,l=!1,u;try{try{await claimHookOwnership(n),l=!0}catch(e){if(isHookConflictError(e))return;throw e}let o=openWorkflowToolRunOwnerInbox(),d=[o.reader,r];for(e.driverCapabilities?.cancelledTurnSettle===!0&&(u=await createTurnCancellationControl({controlToken:e.completionToken,expectedTurnId:activeTurnId(a.sessionState.emissionState),initialPayload:e.initialCancellation})),t?.();;){let t=i?.beforeStep??{serializedContext:a.serializedContext,sessionState:a.sessionState},r=i?.result??await turnStep(a.createStepInput(c,u?.signal));i=void 0;let l=r.action===`park`?r.pendingCoordinationCallIds:void 0,f=(r.backgroundTasks?.length??0)>0;if(f){if(r.backgroundTaskState===void 0)throw Error(`Background tasks were returned without their committed session state.`);await a.adopt({serializedContext:r.backgroundTaskContext??t.serializedContext,sessionState:r.backgroundTaskState}),await acknowledgeDelegatedTasksStep({tasks:r.backgroundTasks??[]})}if(r.action===`cancelled`){await a.adopt({serializedContext:r.serializedContext,sessionState:r.backgroundTaskState??r.sessionState}),await finishCancelledTurn({bufferedDeliveries:s,cancellation:u,cursor:a});return}if(u?.signal.aborted===!0&&(l===void 0||f)){await a.adopt({serializedContext:r.serializedContext,sessionState:r.backgroundTaskState??r.sessionState}),await finishCancelledTurn({bufferedDeliveries:s,cancellation:u,cursor:a});return}if(r.action===`done`){await u?.dispose(),await a.finish(r,{kind:`done`,output:r.output??``,isError:r.isError,usage:r.usage,usageDelta:r.usageDelta},s);return}if(l!==void 0&&r.action===`park`){await a.adopt(r);let e=await dispatchCoordinationStep({action:r.action,callbackBaseUrl:resolveWorkflowCallbackBaseUrl(getWorkflowMetadata().url),workflowToolRunOwner:o.owner,parentWritable:a.parentWritable,serializedContext:a.serializedContext,sessionState:a.sessionState}),t=e.results.length===0?void 0:Date.now();await a.adopt(e),await acknowledgeDelegatedTasksStep({tasks:e.pendingTasks});let i=await waitForRuntimeActionResults({bufferedDeliveries:s,cancellation:u,cursor:a,inboxToken:n.token,initialAcceptedAtMs:t,initialResults:e.results,nextDeliveryRequestId,readers:d,pendingCallIds:l});if(i===`cancelled`){c=void 0;continue}if(i===`cancel-turn`){await finishCancelledTurn({bufferedDeliveries:s,cancellation:u,cursor:a});return}c={kind:`runtime-action-result`,...i};continue}if(r.action===`park`){if(!(r.hasPendingAuthorization||r.hasPendingInputBatch&&e.capabilities?.requestInput===!0||e.mode===`conversation`))throw Error(TASK_MODE_WAIT_ERROR_MESSAGE);await u?.dispose(),await a.finish(r,{authorizationAttemptIds:r.authorizationAttemptIds,authorizationNames:r.authorizationNames,kind:`park`,settled:r.settled},s);return}await a.adopt(r),c=void 0}}catch(e){throw await a.send({error:normalizeSerializableError(e),kind:`turn-error`}),e}finally{u!==void 0&&await u.dispose(),l&&await disposeHook(n)}}async function finishCancelledTurn(e){(e.cancellation?.signal.aborted===!0?await e.cancellation.payload:void 0)?.tasks===!0&&await cancelAllIndexedSessionTasksStep({serializedContext:e.cursor.serializedContext,sessionState:e.cursor.sessionState}),await cancelDescendantTurnsStep({serializedContext:e.cursor.serializedContext,sessionState:e.cursor.sessionState}),await e.cancellation?.dispose(),await e.cursor.finish({sessionState:e.cursor.sessionState},{cancelled:!0,kind:`park`},e.bufferedDeliveries)}async function waitForRuntimeActionResults(e){let t,n=[...e.initialResults],r=new Map;if(e.initialAcceptedAtMs!==void 0)for(let t of e.initialResults)r.set(t.callId,e.initialAcceptedAtMs);for(;;){let i=resolveRuntimeActionResultsForCallIds({pendingCallIds:e.pendingCallIds,results:n});if(i!==void 0)return t!==void 0&&await e.cursor.send({kind:`turn-delivery-cancelled`,requestId:t}),{acceptedAtMsByCallId:Object.fromEntries(i.map(e=>[e.callId,r.get(e.callId)])),results:i};e.cursor.sessionState.hasProxyInputRequests&&t===void 0&&(t=e.nextDeliveryRequestId(),await e.cursor.send({continuationToken:e.cursor.sessionState.continuationToken,inboxToken:e.inboxToken,kind:`turn-delivery-request`,requestId:t}));let a=await raceChannelReads(e.readers,e.cancellation?.requested);if(a===`cancel`)return t!==void 0&&await e.cursor.send({kind:`turn-delivery-cancelled`,requestId:t}),`cancelled`;if(a.next.done)throw Error(`Turn inbox closed before runtime actions completed.`);if(a.channel===`workflow`){let t=await handleWorkflowToolRunMessage({callbackMetadataUrl:getWorkflowMetadata().url,cursor:e.cursor,message:a.next.value});t!==void 0&&(n.push(t),r.set(t.callId,Date.now()));continue}let o=a.next.value;if(o.kind===`runtime-action-result`){let t=e.cursor.sessionState.snapshot?.session.state,i=o.results.filter(e=>e.kind===`tool-result`?isInboxToolResultFromRecordedWorkflowToolRun(t,e):e.origin===`child`&&isInboxSubagentResultFromRunningHandle(t,e)||isInboxSubagentResultFromRecordedWorkflowToolRun(t,e));if(i.length>0){let e=Date.now();n.push(...i);for(let t of i)r.set(t.callId,e)}continue}if(o.kind===`subagent-input-request`||o.kind===`subagent-authorization-event`){let t=findRunningAgentHandle(e.cursor.sessionState.snapshot?.session.state,{callId:o.callId});if(t?.identity.name!==o.subagentName||t.address.sessionId!==o.childSessionId)continue;let n=await runProxySubagentEventStep({hookPayload:o,parentWritable:e.cursor.parentWritable,serializedContext:e.cursor.serializedContext,sessionState:e.cursor.sessionState});await e.cursor.adopt(n);continue}if(o.kind===`driver-delivery`&&o.requestId===t){await e.cursor.send({kind:`turn-delivery-accepted`,requestId:o.requestId}),t=void 0;let n=await routeDeliverToChildren({delivery:o.delivery,parentWritable:e.cursor.parentWritable,serializedContext:e.cursor.serializedContext,sessionState:e.cursor.sessionState});if(await e.cursor.adopt({serializedContext:n.serializedContext??e.cursor.serializedContext,sessionState:n.sessionState??e.cursor.sessionState}),n.kind===`cancel-turn`)return n.kind;n.remainder!==void 0&&e.bufferedDeliveries.push(n.remainder)}}}async function runLegacyTurnWorkflow(e){let t=e.stepInput;try{for(;;){let n=await turnStep(t);if(n.action===`done`){await sendTurnControlStep({controlToken:e.completionToken,payload:{action:{kind:`done`,output:n.output??``,isError:n.isError,serializedContext:n.serializedContext,sessionState:n.sessionState,usage:n.usage,usageDelta:n.usageDelta},kind:`turn-result`}});return}if(n.action===`park`){let t=n.pendingCoordinationCallIds;if(!(t!==void 0||n.hasPendingAuthorization||n.hasPendingInputBatch&&e.capabilities?.requestInput===!0||e.mode===`conversation`))throw Error(TASK_MODE_WAIT_ERROR_MESSAGE);let r=t===void 0?{kind:`park`,serializedContext:n.serializedContext,sessionState:n.sessionState,authorizationAttemptIds:n.authorizationAttemptIds,authorizationNames:n.authorizationNames,settled:n.settled}:{kind:`dispatch-coordination`,pendingCallIds:t,serializedContext:n.serializedContext,sessionState:n.sessionState};await sendTurnControlStep({controlToken:e.completionToken,payload:{action:r,kind:`turn-result`}});return}t={input:void 0,parentWritable:t.parentWritable,serializedContext:n.serializedContext,sessionState:n.sessionState}}}catch(t){throw await sendTurnControlStep({controlToken:e.completionToken,payload:{error:normalizeSerializableError(t),kind:`turn-error`}}),t}}turnWorkflow.workflowId=`workflow//eve//turnWorkflow`;export{runTurnOwnedWorkflow,turnWorkflow};
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
/** Every explicit session-inbox wire version still supported by producers. */
|
|
2
|
-
export declare const SESSION_INBOX_WIRE_VERSIONS: readonly [1, 2, 3, 4, 5, 6, 7];
|
|
3
|
-
export type SessionInboxWireVersion = (typeof SESSION_INBOX_WIRE_VERSIONS)[number];
|
|
4
|
-
/** Current persisted session-inbox wire version. */
|
|
5
|
-
export declare const SESSION_INBOX_WIRE_VERSION: 1 | 2 | 3 | 4 | 5 | 6 | 7;
|
|
6
|
-
/** Hook metadata field advertising the consumer's inbox wire capability. */
|
|
7
|
-
export declare const SESSION_INBOX_WIRE_VERSION_METADATA_KEY = "sessionInboxWireVersion";
|
|
8
|
-
/**
|
|
9
|
-
* Hook metadata field advertising that the driver displays authorization
|
|
10
|
-
* events raised by a workflow task itself. Drivers pinned before this marker
|
|
11
|
-
* drop those events, so producers fail fast instead of waiting on a callback
|
|
12
|
-
* no channel will render.
|
|
13
|
-
*/
|
|
14
|
-
export declare const WORKFLOW_TASK_AUTHORIZATION_METADATA_KEY = "workflowTaskAuthorization";
|
|
15
|
-
export declare const SESSION_INBOX_CONTEXT_KEY = "eve.sessionInbox";
|
|
16
|
-
/** Immutable inbox coordinates advertised by the receiving session's driver. */
|
|
17
|
-
export interface SessionInboxAddress {
|
|
18
|
-
readonly sessionId: string;
|
|
19
|
-
readonly version: number;
|
|
20
|
-
}
|
|
21
|
-
export declare function isSessionInboxAddress(value: unknown): value is SessionInboxAddress;
|
|
22
|
-
/**
|
|
23
|
-
* The consumer wire selected before a producer persists a payload.
|
|
24
|
-
*
|
|
25
|
-
* Version 0 had two incompatible unversioned shapes, so its historical
|
|
26
|
-
* variants remain explicit rather than pretending they were one protocol.
|
|
27
|
-
*/
|
|
28
|
-
export type SessionInboxWireTarget = {
|
|
29
|
-
readonly variant: "deliver" | "send";
|
|
30
|
-
readonly version: 0;
|
|
31
|
-
} | {
|
|
32
|
-
readonly version: SessionInboxWireVersion;
|
|
33
|
-
};
|
|
34
|
-
export declare function isSessionInboxWireVersion(value: unknown): value is SessionInboxWireVersion;
|
|
35
|
-
/** Raised when a session inbox value violates its versioned wire contract. */
|
|
36
|
-
export declare class SessionInboxWireError extends Error {
|
|
37
|
-
constructor(message: string);
|
|
38
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
const SESSION_INBOX_WIRE_VERSIONS=[1,2,3,4,5,6,7],SESSION_INBOX_WIRE_VERSION=SESSION_INBOX_WIRE_VERSIONS[SESSION_INBOX_WIRE_VERSIONS.length-1],SESSION_INBOX_WIRE_VERSION_METADATA_KEY=`sessionInboxWireVersion`,WORKFLOW_TASK_AUTHORIZATION_METADATA_KEY=`workflowTaskAuthorization`,SESSION_INBOX_CONTEXT_KEY=`eve.sessionInbox`;function isSessionInboxAddress(e){return typeof e!=`object`||!e?!1:`sessionId`in e&&typeof e.sessionId==`string`&&e.sessionId.length>0&&!e.sessionId.includes(`:`)&&`version`in e&&typeof e.version==`number`&&Number.isSafeInteger(e.version)&&e.version>0}function isSessionInboxWireVersion(e){return SESSION_INBOX_WIRE_VERSIONS.some(t=>t===e)}var SessionInboxWireError=class extends Error{constructor(e){super(e),this.name=`SessionInboxWireError`}};export{SESSION_INBOX_CONTEXT_KEY,SESSION_INBOX_WIRE_VERSION,SESSION_INBOX_WIRE_VERSIONS,SESSION_INBOX_WIRE_VERSION_METADATA_KEY,SessionInboxWireError,WORKFLOW_TASK_AUTHORIZATION_METADATA_KEY,isSessionInboxAddress,isSessionInboxWireVersion};
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import type { DeliverHookPayload, SessionCommand, SessionTimeoutHookPayload } from "#channel/types.js";
|
|
2
|
-
import { type SessionInboxWireV1 } from "#execution/wire/session-inbox-wire.v1.js";
|
|
3
|
-
import { type SessionInboxWireV2 } from "#execution/wire/session-inbox-wire.v2.js";
|
|
4
|
-
import { type SessionInboxWireV3 } from "#execution/wire/session-inbox-wire.v3.js";
|
|
5
|
-
import { type SessionInboxWireTarget, type SessionInboxWireVersion } from "#execution/wire/session-inbox-contract.js";
|
|
6
|
-
import { type SessionInboxWireV4 } from "#execution/wire/session-inbox-wire.v4.js";
|
|
7
|
-
import { type SessionInboxWireV5 } from "#execution/wire/session-inbox-wire.v5.js";
|
|
8
|
-
import { type SessionInboxWireV6 } from "#execution/wire/session-inbox-wire.v6.js";
|
|
9
|
-
import { type SessionInboxWireV7 } from "#execution/wire/session-inbox-wire.v7.js";
|
|
10
|
-
type SessionInboxCommand = DeliverHookPayload | SessionCommand | SessionTimeoutHookPayload;
|
|
11
|
-
/** Current wire type consumed after migration. */
|
|
12
|
-
export type SessionInboxWire = SessionInboxWireV7;
|
|
13
|
-
type LegacySessionInboxWireTarget = Extract<SessionInboxWireTarget, {
|
|
14
|
-
readonly version: 0;
|
|
15
|
-
}>;
|
|
16
|
-
/** Encodes a command for the selected session-inbox consumer. */
|
|
17
|
-
declare function encode(command: SessionInboxCommand, target: {
|
|
18
|
-
readonly version: 1;
|
|
19
|
-
}): SessionInboxWireV1;
|
|
20
|
-
declare function encode(command: SessionInboxCommand, target: {
|
|
21
|
-
readonly version: 2;
|
|
22
|
-
}): SessionInboxWireV2;
|
|
23
|
-
declare function encode(command: SessionInboxCommand, target: {
|
|
24
|
-
readonly version: 3;
|
|
25
|
-
}): SessionInboxWireV3;
|
|
26
|
-
declare function encode(command: SessionInboxCommand, target: {
|
|
27
|
-
readonly version: 4;
|
|
28
|
-
}): SessionInboxWireV4;
|
|
29
|
-
declare function encode(command: SessionInboxCommand, target: {
|
|
30
|
-
readonly version: 5;
|
|
31
|
-
}): SessionInboxWireV5;
|
|
32
|
-
declare function encode(command: SessionInboxCommand, target: {
|
|
33
|
-
readonly version: 6;
|
|
34
|
-
}): SessionInboxWireV6;
|
|
35
|
-
declare function encode(command: SessionInboxCommand, target: {
|
|
36
|
-
readonly version: 7;
|
|
37
|
-
}): SessionInboxWireV7;
|
|
38
|
-
declare function encode(command: SessionInboxCommand, target: {
|
|
39
|
-
readonly version: SessionInboxWireVersion;
|
|
40
|
-
}): unknown;
|
|
41
|
-
declare function encode(command: SessionInboxCommand, target: LegacySessionInboxWireTarget): Record<string, unknown>;
|
|
42
|
-
declare function encode(command: SessionInboxCommand, target: SessionInboxWireTarget): SessionInboxWireV1 | SessionInboxWireV2 | SessionInboxWireV3 | SessionInboxWireV4 | SessionInboxWireV5 | SessionInboxWireV6 | SessionInboxWireV7 | Record<string, unknown>;
|
|
43
|
-
/** Server/step-safe producer facade. */
|
|
44
|
-
export declare const sessionInboxWire: {
|
|
45
|
-
readonly encode: typeof encode;
|
|
46
|
-
};
|
|
47
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{SessionInboxWireError,isSessionInboxWireVersion}from"#execution/wire/session-inbox-contract.js";import{encodeSessionCommandV1}from"#execution/wire/session-inbox-wire.v1.js";import{encodeSessionCommandV2}from"#execution/wire/session-inbox-wire.v2.js";import{encodeSessionCommandV3}from"#execution/wire/session-inbox-wire.v3.js";import{encodeSessionCommandV0}from"#execution/wire/session-inbox-wire.v0.js";import{encodeSessionCommandV4}from"#execution/wire/session-inbox-wire.v4.js";import{encodeSessionCommandV5}from"#execution/wire/session-inbox-wire.v5.js";import{encodeSessionCommandV6}from"#execution/wire/session-inbox-wire.v6.js";import{encodeSessionCommandV7}from"#execution/wire/session-inbox-wire.v7.js";const versionedEncoders={1:e=>encodeSessionCommandV1(withoutAcceptedDeployment(withoutOwnedTaskCancellation(e))),2:e=>encodeSessionCommandV2(withoutAcceptedDeployment(withoutOwnedTaskCancellation(e))),3:e=>encodeSessionCommandV3(withoutOwnedTaskCancellation(e)),4:e=>encodeSessionCommandV4(withoutOwnedTaskCancellation(e)),5:e=>encodeSessionCommandV5(withoutOwnedTaskCancellation(e)),6:encodeSessionCommandV6,7:encodeSessionCommandV7};function encode(e,t){if(e.kind===`cancel`&&e.tasks===!0&&t.version<6)throw new SessionInboxWireError(`Cannot encode session-owned task cancellation for wire version ${t.version}.`);let n=t.version<7?withoutActivityLabels(e):e;if(t.version===0){let r=t.variant===`send`&&n.kind===`send`&&n.payload.task!==void 0?encodeSessionCommandV5(n):void 0,i=encodeSessionCommandV0(encodeSessionCommandV1(withoutCurrentTaskMessages(withoutAcceptedDeployment(withoutOwnedTaskCancellation(n)))),t.variant);r?.kind===`deliver`&&(i={...i,payload:r.payload});let a=i,o=a.delivery,s=readAcceptedDeploymentId(e);return t.variant!==`send`||s===void 0||a.kind!==`send`||typeof o!=`object`||!o?i:{...i,delivery:{...o,acceptedDeploymentId:s}}}if(isSessionInboxWireVersion(t.version))return versionedEncoders[t.version](n);throw new SessionInboxWireError(`Cannot encode session inbox payload for unknown wire version ${JSON.stringify(t.version)}.`)}function withoutActivityLabels(e){if(e.kind!==`send`&&e.kind!==`deliver`||e.caller?.activityObserver?.workIdentity?.label===void 0)return e;let{label:t,...n}=e.caller.activityObserver.workIdentity;return{...e,caller:{...e.caller,activityObserver:{...e.caller.activityObserver,workIdentity:n}}}}function withoutOwnedTaskCancellation(e){if(e.kind!==`cancel`||e.tasks===void 0)return e;let{tasks:t,...n}=e;return n}function withoutCurrentTaskMessages(e){if(e.kind!==`send`||e.payload.task===void 0)return e;let{agentRequests:t,inputRequests:n,...r}=e.payload.task;return{...e,payload:{...e.payload,task:r}}}function withoutAcceptedDeployment(e){if(e.kind===`send`&&e.delivery?.acceptedDeploymentId!==void 0){let{acceptedDeploymentId:t,...n}=e.delivery;return{...e,delivery:n}}return e.kind!==`deliver`||e.deliveryMetadata===void 0?e:{...e,deliveryMetadata:e.deliveryMetadata.map(e=>{let{acceptedDeploymentId:t,...n}=e;return n})}}function readAcceptedDeploymentId(e){if(e.kind===`send`)return e.delivery?.acceptedDeploymentId;if(e.kind===`deliver`)return e.deliveryMetadata?.find(e=>e.payloadIndex===0)?.acceptedDeploymentId}const sessionInboxWire={encode};export{sessionInboxWire};
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import type { DeliverHookPayload, SessionCommand, SessionTimeoutHookPayload } from "#channel/types.js";
|
|
2
|
-
import { type SessionInboxAddress, type SessionInboxWireTarget } from "#execution/wire/session-inbox-contract.js";
|
|
3
|
-
import { getHookByToken, resumeHook } from "#internal/workflow/runtime.js";
|
|
4
|
-
type ResumedSessionInboxHook = Awaited<ReturnType<typeof resumeHook>>;
|
|
5
|
-
/** Resolves the consumer contract, encodes for it, and resumes that exact hook. */
|
|
6
|
-
export declare function resumeSessionInbox(address: string | SessionInboxAddress, command: DeliverHookPayload | SessionCommand | SessionTimeoutHookPayload): Promise<ResumedSessionInboxHook>;
|
|
7
|
-
type SessionInboxHook = Awaited<ReturnType<typeof getHookByToken>>;
|
|
8
|
-
/** Whether the session's pinned driver displays authorization events raised by workflow tasks. */
|
|
9
|
-
export declare function sessionDriverSupportsWorkflowTaskAuthorization(sessionId: string): Promise<boolean>;
|
|
10
|
-
/** Selects the encoder understood by a persisted hook's consumer deployment. */
|
|
11
|
-
export declare function resolveSessionInboxWireTarget(hook: SessionInboxHook): Promise<SessionInboxWireTarget>;
|
|
12
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{isObject}from"#shared/guards.js";import{isSessionCommandHookToken,sessionCommandHookToken}from"#execution/session-command-token.js";import{SESSION_INBOX_WIRE_VERSION_METADATA_KEY,SessionInboxWireError,WORKFLOW_TASK_AUTHORIZATION_METADATA_KEY,isSessionInboxAddress,isSessionInboxWireVersion}from"#execution/wire/session-inbox-contract.js";import{getHookByToken,getRawHookByToken,resumeHook}from"#internal/workflow/runtime.js";import{HookNotFoundError}from"#compiled/@workflow/errors/index.js";import{sessionInboxWire}from"#execution/wire/session-inbox-encoder.js";async function resumeSessionInbox(e,t){if(typeof e!=`string`){if(!isSessionInboxAddress(e))throw new SessionInboxWireError(`Session inbox target has an invalid address.`);if(!isSessionInboxWireVersion(e.version))throw new SessionInboxWireError(`Session inbox target declares unsupported wire version ${JSON.stringify(e.version)}.`);return await resumeHook(sessionCommandHookToken(e.sessionId),sessionInboxWire.encode(t,{version:e.version}))}let n=e;if(isStableInboxFastPathCompatible(n,t))return await resumeHook(n,sessionInboxWire.encode(t,{variant:`send`,version:0}));let r=await getHookByToken(n),i=await resolveSessionInboxWireTarget(r);return await resumeHook(r,sessionInboxWire.encode(t,i))}function isStableInboxFastPathCompatible(e,t){return!isSessionCommandHookToken(e)||t.kind===`cancel`&&t.tasks===!0?!1:!(`caller`in t&&t.caller?.activityObserver!==void 0)}async function sessionDriverSupportsWorkflowTaskAuthorization(e){let t=await(await getHookByToken(sessionCommandHookToken(e))).metadata;return isObject(t)&&t[WORKFLOW_TASK_AUTHORIZATION_METADATA_KEY]===!0}async function resolveSessionInboxWireTarget(e){let t=await e.metadata;if(isObject(t)&&SESSION_INBOX_WIRE_VERSION_METADATA_KEY in t){let e=t[SESSION_INBOX_WIRE_VERSION_METADATA_KEY];if(isSessionInboxWireVersion(e))return{version:e};throw new SessionInboxWireError(`Session inbox target declares unsupported wire version ${JSON.stringify(e)}.`)}let n=sessionCommandHookToken(e.runId);if(e.token===n)return{variant:`send`,version:0};try{let t=await getRawHookByToken(n);if(t.runId!==e.runId)throw new SessionInboxWireError(`Stable session inbox ${JSON.stringify(n)} belongs to run ${JSON.stringify(t.runId)}, expected ${JSON.stringify(e.runId)}.`);return{variant:`send`,version:0}}catch(e){if(HookNotFoundError.is(e))return{variant:`deliver`,version:0};throw e}}export{resolveSessionInboxWireTarget,resumeSessionInbox,sessionDriverSupportsWorkflowTaskAuthorization};
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import type { DeliverHookPayload, SessionCommand, SessionTimeoutHookPayload } from "#channel/types.js";
|
|
2
|
-
/**
|
|
3
|
-
* The session inbox wire family: every payload persisted to a session's
|
|
4
|
-
* durable inbox hooks crosses through `sessionInboxWire.encode` /
|
|
5
|
-
* `sessionInboxWire.decode`.
|
|
6
|
-
*
|
|
7
|
-
* Historic migrations live in `session-inbox-wire.vN.ts` modules; the
|
|
8
|
-
* current schema and encoder live in the current version module. This file
|
|
9
|
-
* remains the dependency-free decoder facade reached by the workflow body.
|
|
10
|
-
*
|
|
11
|
-
* See research/session-inbox-wire-schema.md and issue #1765.
|
|
12
|
-
*/
|
|
13
|
-
/** A persisted inbox payload normalized for consumption; `send` never survives decode. */
|
|
14
|
-
export type DecodedSessionInbox = DeliverHookPayload | SessionTimeoutHookPayload | Extract<SessionCommand, {
|
|
15
|
-
readonly kind: "cancel" | "clear" | "compact" | "reset";
|
|
16
|
-
}>;
|
|
17
|
-
export { SessionInboxWireError } from "#execution/wire/session-inbox-contract.js";
|
|
18
|
-
/**
|
|
19
|
-
* Decodes a persisted inbox payload or throws {@link SessionInboxWireError}.
|
|
20
|
-
*
|
|
21
|
-
* Unknown newer versions and migration-bound shape mismatches both throw: a
|
|
22
|
-
* lost delivery with an operator-visible signal is the designed failure; a
|
|
23
|
-
* reinterpreted delivery is the bug this module exists to prevent.
|
|
24
|
-
*/
|
|
25
|
-
declare function decode(value: unknown): DecodedSessionInbox;
|
|
26
|
-
/** Workflow-safe consumer facade. */
|
|
27
|
-
export declare const sessionInboxWire: {
|
|
28
|
-
readonly decode: typeof decode;
|
|
29
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{isObject}from"#shared/guards.js";import{SESSION_INBOX_WIRE_VERSION,SessionInboxWireError,SessionInboxWireError as SessionInboxWireError$1}from"#execution/wire/session-inbox-contract.js";import{sessionInboxWireV0Migration}from"#execution/wire/session-inbox-wire.v0.js";import{runMigrationChain}from"#execution/durable-session-migrations/chain.js";import{normalizeSessionInboxWireV2}from"#execution/wire/session-inbox-wire.v2-migration.js";import{sessionInboxWireV1Migration}from"#execution/wire/session-inbox-wire.v2.migration.js";import{sessionInboxWireV2Migration}from"#execution/wire/session-inbox-wire.v3.migration.js";import{sessionInboxWireV3Migration}from"#execution/wire/session-inbox-wire.v4.migration.js";import{sessionInboxWireV4Migration}from"#execution/wire/session-inbox-wire.v5.migration.js";const WIRE_LABEL=`session inbox payload`,sessionInboxMigrations=[sessionInboxWireV0Migration,sessionInboxWireV1Migration,sessionInboxWireV2Migration,sessionInboxWireV3Migration,sessionInboxWireV4Migration,{from:5,migrate(e){if(!isObject(e))throw Error(`session inbox wire v5 value is not an object.`);return{...e,version:6}},to:6},{from:6,migrate(e){if(!isObject(e))throw Error(`session inbox wire v6 value is not an object.`);return{...e,version:7}},to:7}];function decode(e){let t=typeof e==`object`&&e&&`version`in e?e.version:void 0;if(typeof e==`object`&&e&&`version`in e&&typeof t!=`number`)throw new SessionInboxWireError$1(`${WIRE_LABEL}: value has no numeric "version" field.`);let n=normalizeSessionInboxWireV2(e);if((t===1||t===2||t===3)&&containsCurrentTaskMessages(n))throw new SessionInboxWireError$1(`${WIRE_LABEL} does not match wire version ${t}.`);let r;try{r=runMigrationChain({initialVersion:0,label:WIRE_LABEL,migrations:sessionInboxMigrations,targetVersion:SESSION_INBOX_WIRE_VERSION,value:n})}catch(e){throw new SessionInboxWireError$1(e instanceof Error?e.message:String(e))}let i=normalizeSessionInboxWireV2(r);if(i.version!==SESSION_INBOX_WIRE_VERSION)throw new SessionInboxWireError$1(`${WIRE_LABEL} declares version ${JSON.stringify(i.version)}, expected ${SESSION_INBOX_WIRE_VERSION}.`);if(typeof t==`number`&&t>=2&&i.kind===`deliver`&&!(`payload`in i))throw new SessionInboxWireError$1(`${WIRE_LABEL} does not match wire version ${t}.`);return normalizeWire(i)}const sessionInboxWire={decode};function containsCurrentTaskMessages(e){return!isObject(e)||e.kind!==`deliver`?!1:(Array.isArray(e.payloads)?e.payloads:[]).some(e=>{if(!isObject(e)||!isObject(e.task))return!1;if(Object.hasOwn(e.task,`agentRequests`))return!0;let t=e.task.inputRequests;return Array.isArray(t)&&t.some(e=>isObject(e)&&(`request`in e||`requests`in e))})}function normalizeWire(e){switch(e.kind){case`deliver`:return{auth:e.auth,caller:e.caller,deliveryMetadata:e.deliveryMetadata,kind:`deliver`,payloads:e.payloads,requestId:e.requestId,taskDeliveryId:e.taskDeliveryId,turnPolicy:e.turnPolicy};case`session-timeout`:return{kind:`session-timeout`};case`clear`:return{kind:`clear`};case`compact`:return{kind:`compact`};case`reset`:return{kind:`reset`,reason:e.reason};case`cancel`:return{kind:`cancel`,taskId:e.taskId,tasks:e.tasks,turnId:e.turnId};default:throw new SessionInboxWireError$1(`${WIRE_LABEL} has an unrecognized kind ${JSON.stringify(e.kind)}.`)}}export{SessionInboxWireError,sessionInboxWire};
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import type { VersionMigration } from "#execution/durable-session-migrations/chain.js";
|
|
2
|
-
import type { SessionInboxWireV1 } from "#execution/wire/session-inbox-wire.v1.js";
|
|
3
|
-
export declare const sessionInboxWireV0Migration: VersionMigration;
|
|
4
|
-
/** Encodes the two incompatible shapes from the unversioned wire era. */
|
|
5
|
-
export declare function encodeSessionCommandV0(wire: SessionInboxWireV1, variant: "deliver" | "send"): Omit<SessionInboxWireV1, "version"> | Record<string, unknown>;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{isObject}from"#shared/guards.js";function migrateSessionInboxWireV0(e){let t=e;if(t.kind===`send`)return migrateLegacySend(t);if(t.kind===`deliver`&&!(Array.isArray(t.payloads)&&t.payloads.every(isObject)))throw Error(`legacy deliver payload has no object-array payloads field.`);return{...t,version:1}}function migrateLegacySend(e){if(!isObject(e.payload))throw Error(`legacy send command has no object payload field.`);if(e.delivery!==void 0&&!isObject(e.delivery))throw Error(`legacy send command has a non-object delivery field.`);return{auth:e.auth,caller:e.caller,deliveryMetadata:e.delivery===void 0?void 0:[{...e.delivery,payloadIndex:0}],kind:`deliver`,payload:e.payload,payloads:[e.payload],requestId:e.requestId,taskDeliveryId:e.taskDeliveryId,turnPolicy:e.turnPolicy,version:1}}const sessionInboxWireV0Migration={from:0,migrate:migrateSessionInboxWireV0,to:1};function encodeSessionCommandV0(e,t){if(e.kind!==`deliver`){let{version:t,...n}=e;return n}if(t===`deliver`){let{payload:t,version:n,...r}=e;return r}let n=e.deliveryMetadata?.find(e=>e.payloadIndex===0),r;if(n!==void 0){let{payloadIndex:e,...t}=n;r=t}return{auth:e.auth,caller:e.caller,delivery:r,kind:`send`,payload:e.payload,requestId:e.requestId,taskDeliveryId:e.taskDeliveryId,turnPolicy:e.turnPolicy}}export{encodeSessionCommandV0,sessionInboxWireV0Migration};
|
|
@@ -1,237 +0,0 @@
|
|
|
1
|
-
import type { DataContent } from "ai";
|
|
2
|
-
import { z } from "#compiled/zod/index.js";
|
|
3
|
-
import type { DeliverHookPayload, SessionCommand, SessionTimeoutHookPayload } from "#channel/types.js";
|
|
4
|
-
import type { TaskView } from "#tasks/types.js";
|
|
5
|
-
/** The complete schema for persisted session-inbox wire version 1. */
|
|
6
|
-
export declare const sessionInboxWireV1Schema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
7
|
-
auth: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
8
|
-
attributes: z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
|
|
9
|
-
authenticator: z.ZodString;
|
|
10
|
-
issuer: z.ZodOptional<z.ZodString>;
|
|
11
|
-
principalId: z.ZodString;
|
|
12
|
-
principalType: z.ZodString;
|
|
13
|
-
subject: z.ZodOptional<z.ZodString>;
|
|
14
|
-
}, z.core.$strict>>>;
|
|
15
|
-
caller: z.ZodOptional<z.ZodObject<{
|
|
16
|
-
callId: z.ZodString;
|
|
17
|
-
replyTo: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
18
|
-
kind: z.ZodLiteral<"hook">;
|
|
19
|
-
token: z.ZodString;
|
|
20
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
21
|
-
kind: z.ZodLiteral<"callback">;
|
|
22
|
-
token: z.ZodString;
|
|
23
|
-
url: z.ZodString;
|
|
24
|
-
}, z.core.$strict>], "kind">;
|
|
25
|
-
subagentName: z.ZodString;
|
|
26
|
-
taskId: z.ZodOptional<z.ZodString>;
|
|
27
|
-
}, z.core.$strict>>;
|
|
28
|
-
deliveryMetadata: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
29
|
-
channelKind: z.ZodString;
|
|
30
|
-
channelName: z.ZodString;
|
|
31
|
-
deliveryId: z.ZodString;
|
|
32
|
-
payloadIndex: z.ZodNumber;
|
|
33
|
-
requestId: z.ZodOptional<z.ZodString>;
|
|
34
|
-
requestTraceContext: z.ZodOptional<z.ZodObject<{
|
|
35
|
-
spanId: z.ZodString;
|
|
36
|
-
traceFlags: z.ZodNumber;
|
|
37
|
-
traceId: z.ZodString;
|
|
38
|
-
}, z.core.$strict>>;
|
|
39
|
-
}, z.core.$strict>>>;
|
|
40
|
-
kind: z.ZodLiteral<"deliver">;
|
|
41
|
-
payload: z.ZodOptional<z.ZodObject<{
|
|
42
|
-
context: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
43
|
-
inputResponses: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
44
|
-
optionId: z.ZodOptional<z.ZodString>;
|
|
45
|
-
requestId: z.ZodString;
|
|
46
|
-
text: z.ZodOptional<z.ZodString>;
|
|
47
|
-
}, z.core.$strict>>>;
|
|
48
|
-
message: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
49
|
-
providerOptions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<import("../../shared/json.ts").JsonObject, unknown, z.core.$ZodTypeInternals<import("../../shared/json.ts").JsonObject, unknown>>>>;
|
|
50
|
-
text: z.ZodString;
|
|
51
|
-
type: z.ZodLiteral<"text">;
|
|
52
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
53
|
-
image: z.ZodCustom<URL | DataContent, URL | DataContent>;
|
|
54
|
-
mediaType: z.ZodOptional<z.ZodString>;
|
|
55
|
-
providerOptions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<import("../../shared/json.ts").JsonObject, unknown, z.core.$ZodTypeInternals<import("../../shared/json.ts").JsonObject, unknown>>>>;
|
|
56
|
-
type: z.ZodLiteral<"image">;
|
|
57
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
58
|
-
data: z.ZodCustom<URL | DataContent, URL | DataContent>;
|
|
59
|
-
filename: z.ZodOptional<z.ZodString>;
|
|
60
|
-
mediaType: z.ZodString;
|
|
61
|
-
providerOptions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<import("../../shared/json.ts").JsonObject, unknown, z.core.$ZodTypeInternals<import("../../shared/json.ts").JsonObject, unknown>>>>;
|
|
62
|
-
type: z.ZodLiteral<"file">;
|
|
63
|
-
}, z.core.$strict>], "type">>]>>;
|
|
64
|
-
outputSchema: z.ZodOptional<z.ZodType<import("../../shared/json.ts").JsonObject, unknown, z.core.$ZodTypeInternals<import("../../shared/json.ts").JsonObject, unknown>>>;
|
|
65
|
-
task: z.ZodOptional<z.ZodObject<{
|
|
66
|
-
authorizationEvents: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
67
|
-
hookPayload: z.ZodObject<{
|
|
68
|
-
callId: z.ZodString;
|
|
69
|
-
childSessionId: z.ZodString;
|
|
70
|
-
event: z.ZodCustom<Record<string, unknown>, Record<string, unknown>>;
|
|
71
|
-
kind: z.ZodLiteral<"subagent-authorization-event">;
|
|
72
|
-
subagentName: z.ZodString;
|
|
73
|
-
}, z.core.$strict>;
|
|
74
|
-
taskId: z.ZodString;
|
|
75
|
-
}, z.core.$strict>>>;
|
|
76
|
-
inputRequests: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
77
|
-
hookPayload: z.ZodObject<{
|
|
78
|
-
callId: z.ZodString;
|
|
79
|
-
childContinuationToken: z.ZodString;
|
|
80
|
-
childSessionId: z.ZodString;
|
|
81
|
-
event: z.ZodObject<{
|
|
82
|
-
requests: z.ZodArray<z.ZodObject<{
|
|
83
|
-
action: z.ZodObject<{
|
|
84
|
-
callId: z.ZodString;
|
|
85
|
-
input: z.ZodType<import("../../shared/json.ts").JsonObject, unknown, z.core.$ZodTypeInternals<import("../../shared/json.ts").JsonObject, unknown>>;
|
|
86
|
-
kind: z.ZodLiteral<"tool-call">;
|
|
87
|
-
toolName: z.ZodString;
|
|
88
|
-
}, z.core.$strict>;
|
|
89
|
-
allowFreeform: z.ZodOptional<z.ZodBoolean>;
|
|
90
|
-
display: z.ZodOptional<z.ZodEnum<{
|
|
91
|
-
confirmation: "confirmation";
|
|
92
|
-
select: "select";
|
|
93
|
-
text: "text";
|
|
94
|
-
}>>;
|
|
95
|
-
kind: z.ZodEnum<{
|
|
96
|
-
question: "question";
|
|
97
|
-
"session-limit": "session-limit";
|
|
98
|
-
"tool-approval": "tool-approval";
|
|
99
|
-
}>;
|
|
100
|
-
options: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
101
|
-
description: z.ZodOptional<z.ZodString>;
|
|
102
|
-
id: z.ZodString;
|
|
103
|
-
label: z.ZodString;
|
|
104
|
-
style: z.ZodOptional<z.ZodEnum<{
|
|
105
|
-
danger: "danger";
|
|
106
|
-
default: "default";
|
|
107
|
-
primary: "primary";
|
|
108
|
-
}>>;
|
|
109
|
-
}, z.core.$strict>>>;
|
|
110
|
-
prompt: z.ZodString;
|
|
111
|
-
requestId: z.ZodString;
|
|
112
|
-
}, z.core.$strict>>;
|
|
113
|
-
sequence: z.ZodNumber;
|
|
114
|
-
stepIndex: z.ZodNumber;
|
|
115
|
-
turnId: z.ZodString;
|
|
116
|
-
}, z.core.$strict>;
|
|
117
|
-
kind: z.ZodLiteral<"subagent-input-request">;
|
|
118
|
-
subagentName: z.ZodString;
|
|
119
|
-
}, z.core.$strict>;
|
|
120
|
-
taskId: z.ZodString;
|
|
121
|
-
}, z.core.$strict>>>;
|
|
122
|
-
views: z.ZodOptional<z.ZodArray<z.ZodType<TaskView, unknown, z.core.$ZodTypeInternals<TaskView, unknown>>>>;
|
|
123
|
-
}, z.core.$strict>>;
|
|
124
|
-
}, z.core.$loose>>;
|
|
125
|
-
payloads: z.ZodArray<z.ZodObject<{
|
|
126
|
-
context: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
127
|
-
inputResponses: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
128
|
-
optionId: z.ZodOptional<z.ZodString>;
|
|
129
|
-
requestId: z.ZodString;
|
|
130
|
-
text: z.ZodOptional<z.ZodString>;
|
|
131
|
-
}, z.core.$strict>>>;
|
|
132
|
-
message: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
133
|
-
providerOptions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<import("../../shared/json.ts").JsonObject, unknown, z.core.$ZodTypeInternals<import("../../shared/json.ts").JsonObject, unknown>>>>;
|
|
134
|
-
text: z.ZodString;
|
|
135
|
-
type: z.ZodLiteral<"text">;
|
|
136
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
137
|
-
image: z.ZodCustom<URL | DataContent, URL | DataContent>;
|
|
138
|
-
mediaType: z.ZodOptional<z.ZodString>;
|
|
139
|
-
providerOptions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<import("../../shared/json.ts").JsonObject, unknown, z.core.$ZodTypeInternals<import("../../shared/json.ts").JsonObject, unknown>>>>;
|
|
140
|
-
type: z.ZodLiteral<"image">;
|
|
141
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
142
|
-
data: z.ZodCustom<URL | DataContent, URL | DataContent>;
|
|
143
|
-
filename: z.ZodOptional<z.ZodString>;
|
|
144
|
-
mediaType: z.ZodString;
|
|
145
|
-
providerOptions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<import("../../shared/json.ts").JsonObject, unknown, z.core.$ZodTypeInternals<import("../../shared/json.ts").JsonObject, unknown>>>>;
|
|
146
|
-
type: z.ZodLiteral<"file">;
|
|
147
|
-
}, z.core.$strict>], "type">>]>>;
|
|
148
|
-
outputSchema: z.ZodOptional<z.ZodType<import("../../shared/json.ts").JsonObject, unknown, z.core.$ZodTypeInternals<import("../../shared/json.ts").JsonObject, unknown>>>;
|
|
149
|
-
task: z.ZodOptional<z.ZodObject<{
|
|
150
|
-
authorizationEvents: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
151
|
-
hookPayload: z.ZodObject<{
|
|
152
|
-
callId: z.ZodString;
|
|
153
|
-
childSessionId: z.ZodString;
|
|
154
|
-
event: z.ZodCustom<Record<string, unknown>, Record<string, unknown>>;
|
|
155
|
-
kind: z.ZodLiteral<"subagent-authorization-event">;
|
|
156
|
-
subagentName: z.ZodString;
|
|
157
|
-
}, z.core.$strict>;
|
|
158
|
-
taskId: z.ZodString;
|
|
159
|
-
}, z.core.$strict>>>;
|
|
160
|
-
inputRequests: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
161
|
-
hookPayload: z.ZodObject<{
|
|
162
|
-
callId: z.ZodString;
|
|
163
|
-
childContinuationToken: z.ZodString;
|
|
164
|
-
childSessionId: z.ZodString;
|
|
165
|
-
event: z.ZodObject<{
|
|
166
|
-
requests: z.ZodArray<z.ZodObject<{
|
|
167
|
-
action: z.ZodObject<{
|
|
168
|
-
callId: z.ZodString;
|
|
169
|
-
input: z.ZodType<import("../../shared/json.ts").JsonObject, unknown, z.core.$ZodTypeInternals<import("../../shared/json.ts").JsonObject, unknown>>;
|
|
170
|
-
kind: z.ZodLiteral<"tool-call">;
|
|
171
|
-
toolName: z.ZodString;
|
|
172
|
-
}, z.core.$strict>;
|
|
173
|
-
allowFreeform: z.ZodOptional<z.ZodBoolean>;
|
|
174
|
-
display: z.ZodOptional<z.ZodEnum<{
|
|
175
|
-
confirmation: "confirmation";
|
|
176
|
-
select: "select";
|
|
177
|
-
text: "text";
|
|
178
|
-
}>>;
|
|
179
|
-
kind: z.ZodEnum<{
|
|
180
|
-
question: "question";
|
|
181
|
-
"session-limit": "session-limit";
|
|
182
|
-
"tool-approval": "tool-approval";
|
|
183
|
-
}>;
|
|
184
|
-
options: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
185
|
-
description: z.ZodOptional<z.ZodString>;
|
|
186
|
-
id: z.ZodString;
|
|
187
|
-
label: z.ZodString;
|
|
188
|
-
style: z.ZodOptional<z.ZodEnum<{
|
|
189
|
-
danger: "danger";
|
|
190
|
-
default: "default";
|
|
191
|
-
primary: "primary";
|
|
192
|
-
}>>;
|
|
193
|
-
}, z.core.$strict>>>;
|
|
194
|
-
prompt: z.ZodString;
|
|
195
|
-
requestId: z.ZodString;
|
|
196
|
-
}, z.core.$strict>>;
|
|
197
|
-
sequence: z.ZodNumber;
|
|
198
|
-
stepIndex: z.ZodNumber;
|
|
199
|
-
turnId: z.ZodString;
|
|
200
|
-
}, z.core.$strict>;
|
|
201
|
-
kind: z.ZodLiteral<"subagent-input-request">;
|
|
202
|
-
subagentName: z.ZodString;
|
|
203
|
-
}, z.core.$strict>;
|
|
204
|
-
taskId: z.ZodString;
|
|
205
|
-
}, z.core.$strict>>>;
|
|
206
|
-
views: z.ZodOptional<z.ZodArray<z.ZodType<TaskView, unknown, z.core.$ZodTypeInternals<TaskView, unknown>>>>;
|
|
207
|
-
}, z.core.$strict>>;
|
|
208
|
-
}, z.core.$loose>>;
|
|
209
|
-
requestId: z.ZodOptional<z.ZodString>;
|
|
210
|
-
taskDeliveryId: z.ZodOptional<z.ZodString>;
|
|
211
|
-
turnPolicy: z.ZodOptional<z.ZodEnum<{
|
|
212
|
-
queue: "queue";
|
|
213
|
-
steer: "steer";
|
|
214
|
-
}>>;
|
|
215
|
-
version: z.ZodLiteral<1>;
|
|
216
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
217
|
-
kind: z.ZodLiteral<"session-timeout">;
|
|
218
|
-
version: z.ZodLiteral<1>;
|
|
219
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
220
|
-
kind: z.ZodLiteral<"clear">;
|
|
221
|
-
version: z.ZodLiteral<1>;
|
|
222
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
223
|
-
kind: z.ZodLiteral<"compact">;
|
|
224
|
-
version: z.ZodLiteral<1>;
|
|
225
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
226
|
-
kind: z.ZodLiteral<"reset">;
|
|
227
|
-
reason: z.ZodOptional<z.ZodString>;
|
|
228
|
-
version: z.ZodLiteral<1>;
|
|
229
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
230
|
-
kind: z.ZodLiteral<"cancel">;
|
|
231
|
-
taskId: z.ZodOptional<z.ZodString>;
|
|
232
|
-
turnId: z.ZodOptional<z.ZodString>;
|
|
233
|
-
version: z.ZodLiteral<1>;
|
|
234
|
-
}, z.core.$strict>], "kind">;
|
|
235
|
-
export type SessionInboxWireV1 = z.infer<typeof sessionInboxWireV1Schema>;
|
|
236
|
-
/** Builds and validates one complete version-1 wire value. */
|
|
237
|
-
export declare function encodeSessionCommandV1(command: DeliverHookPayload | SessionCommand | SessionTimeoutHookPayload): SessionInboxWireV1;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{z}from"#compiled/zod/index.js";import{inputRequestSchema,inputResponseSchema}from"#shared/input.js";import{formatValidationError}from"#runtime/validation.js";import{jsonObjectSchema,jsonValueSchema}from"#shared/json-schemas.js";import{SessionInboxWireError}from"#execution/wire/session-inbox-contract.js";import{coalesceDeliverPayloads}from"#execution/deliver-payloads.js";import{tokenUsageSchema}from"#shared/token-usage.js";const providerOptionsSchema=z.record(z.string(),jsonObjectSchema),textPartSchema=z.object({providerOptions:providerOptionsSchema.optional(),text:z.string(),type:z.literal(`text`)}).strict(),binaryDataSchema=z.custom(e=>typeof e==`string`||e instanceof Uint8Array||e instanceof ArrayBuffer||e instanceof URL,`Expected a string, URL, Uint8Array, or ArrayBuffer.`),imagePartSchema=z.object({image:binaryDataSchema,mediaType:z.string().optional(),providerOptions:providerOptionsSchema.optional(),type:z.literal(`image`)}).strict(),filePartSchema=z.object({data:binaryDataSchema,filename:z.string().optional(),mediaType:z.string(),providerOptions:providerOptionsSchema.optional(),type:z.literal(`file`)}).strict(),userContentSchema=z.union([z.string(),z.array(z.discriminatedUnion(`type`,[textPartSchema,imagePartSchema,filePartSchema]))]),eventCoordinateSchema=z.number().int().nonnegative(),opaqueObjectSchema=z.custom(e=>typeof e==`object`&&!!e&&!Array.isArray(e),`Expected an object.`),subagentInputRequestHookPayloadSchema=z.object({callId:z.string(),childContinuationToken:z.string(),childSessionId:z.string(),event:z.object({requests:z.array(inputRequestSchema),sequence:eventCoordinateSchema,stepIndex:eventCoordinateSchema,turnId:z.string()}).strict(),kind:z.literal(`subagent-input-request`),subagentName:z.string()}).strict(),subagentAuthorizationEventHookPayloadSchema=z.object({callId:z.string(),childSessionId:z.string(),event:opaqueObjectSchema,kind:z.literal(`subagent-authorization-event`),subagentName:z.string()}).strict(),taskMetadataSchema=z.union([z.object({agentId:z.string(),kind:z.literal(`subagent`),mode:z.enum([`local`,`remote`]),name:z.string()}).strict(),z.object({kind:z.string(),name:z.string()}).strict()]),taskViewBase={executor:z.object({binding:z.object({data:z.record(z.string(),jsonValueSchema),kind:z.string()}).strict().optional(),childSessionId:z.string().optional(),childTurnId:z.string().optional(),lifecycle:z.enum([`parked`,`terminal`]).optional()}).strict().optional(),metadata:taskMetadataSchema,taskId:z.string(),usage:tokenUsageSchema.optional()},taskViewSchema=z.discriminatedUnion(`status`,[z.object({...taskViewBase,status:z.literal(`working`)}).strict(),z.object({...taskViewBase,inputRequests:z.array(jsonValueSchema),status:z.literal(`input_required`)}).strict(),z.object({...taskViewBase,lastOutput:z.object({data:jsonValueSchema,type:z.literal(`result`)}).strict(),status:z.literal(`completed`)}).strict(),z.object({...taskViewBase,lastOutput:z.object({data:jsonValueSchema,type:z.literal(`error`)}).strict(),status:z.literal(`failed`)}).strict(),z.object({...taskViewBase,status:z.literal(`cancelled`)}).strict()]),taskPayloadSchema=z.object({authorizationEvents:z.array(z.object({hookPayload:subagentAuthorizationEventHookPayloadSchema,taskId:z.string()}).strict()).optional(),inputRequests:z.array(z.object({hookPayload:subagentInputRequestHookPayloadSchema,taskId:z.string()}).strict()).optional(),views:z.array(taskViewSchema).optional()}).strict(),deliverPayloadSchema=z.object({context:z.array(z.string()).optional(),inputResponses:z.array(inputResponseSchema).optional(),message:userContentSchema.optional(),outputSchema:jsonObjectSchema.optional(),task:taskPayloadSchema.optional()}).loose(),authSchema=z.object({attributes:z.record(z.string(),z.union([z.string(),z.array(z.string())])),authenticator:z.string(),issuer:z.string().optional(),principalId:z.string(),principalType:z.string(),subject:z.string().optional()}).strict(),callerSchema=z.object({callId:z.string(),replyTo:z.discriminatedUnion(`kind`,[z.object({kind:z.literal(`hook`),token:z.string()}).strict(),z.object({kind:z.literal(`callback`),token:z.string(),url:z.string()}).strict()]),subagentName:z.string(),taskId:z.string().optional()}).strict(),callerProjectionSchema=callerSchema.strip(),traceContextSchema=z.object({spanId:z.string(),traceFlags:z.number(),traceId:z.string()}).strict(),deliveryMetadataSchema=z.object({channelKind:z.string(),channelName:z.string(),deliveryId:z.string(),payloadIndex:z.number().int().nonnegative(),requestId:z.string().optional(),requestTraceContext:traceContextSchema.optional()}).strict(),version=z.literal(1),sessionInboxWireV1Schema=z.discriminatedUnion(`kind`,[z.object({auth:authSchema.nullable().optional(),caller:callerSchema.optional(),deliveryMetadata:z.array(deliveryMetadataSchema).optional(),kind:z.literal(`deliver`),payload:deliverPayloadSchema.optional(),payloads:z.array(deliverPayloadSchema),requestId:z.string().optional(),taskDeliveryId:z.string().optional(),turnPolicy:z.enum([`queue`,`steer`]).optional(),version}).strict(),z.object({kind:z.literal(`session-timeout`),version}).strict(),z.object({kind:z.literal(`clear`),version}).strict(),z.object({kind:z.literal(`compact`),version}).strict(),z.object({kind:z.literal(`reset`),reason:z.string().optional(),version}).strict(),z.object({kind:z.literal(`cancel`),taskId:z.string().optional(),turnId:z.string().optional(),version}).strict()]);function encodeSessionCommandV1(e){let t=toV1Command(e),n=t.kind===`send`?{auth:t.auth,caller:t.caller,deliveryMetadata:t.delivery===void 0?void 0:[{...t.delivery,payloadIndex:0}],kind:`deliver`,payload:t.payload,payloads:[t.payload],requestId:t.requestId,taskDeliveryId:t.taskDeliveryId,turnPolicy:t.turnPolicy,version:1}:t.kind===`deliver`?{...t,payload:coalesceDeliverPayloads(t.payloads),version:1}:{...t,version:1},r=sessionInboxWireV1Schema.safeParse(n);if(!r.success)throw new SessionInboxWireError(`Produced a session inbox payload that does not match wire version 1: ${formatValidationError(r.error)}`);return r.data}function toV1Command(e){return!(`caller`in e)||e.caller===void 0?e:{...e,caller:toV1Caller(e.caller)}}function toV1Caller(e){let t=callerProjectionSchema.safeParse(e);if(!t.success)throw new SessionInboxWireError(`Produced a session inbox payload that does not match wire version 1: ${formatValidationError(t.error)}`);return t.data}export{encodeSessionCommandV1,sessionInboxWireV1Schema};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{isObject}from"#shared/guards.js";function normalizeSessionInboxWireV2(e,t=!1){return e===void 0?t?null:void 0:Array.isArray(e)?e.map(e=>normalizeSessionInboxWireV2(e,!0)):isPlainRecord$1(e)?Object.fromEntries(Object.entries(e).filter(e=>e[1]!==void 0).map(([e,t])=>[e,normalizeSessionInboxWireV2(t)])):e}function isPlainRecord$1(e){if(!isObject(e))return!1;let t=Object.getPrototypeOf(e);return t===null||t===Object.prototype||Object.getPrototypeOf(t)===null}export{normalizeSessionInboxWireV2};
|