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,2 +1,2 @@
|
|
|
1
|
-
import{createRegistrySession}from"./registry-session.js";import{
|
|
1
|
+
import{createRegistrySession}from"./registry-session.js";import{WizardCancelledError}from"#setup/step.js";import{HumanActionRequiredError}from"#setup/human-action.js";import{withSpinner}from"#setup/with-spinner.js";function label(e){return e.name}var RegistryFlowFailedError=class extends Error{completed;constructor(e,t){super(e instanceof Error?e.message:String(e),{cause:e}),this.name=`RegistryFlowFailedError`,this.completed=t}};function hasSettledOutcomes(e){return e!==void 0&&(e.items.length>0||e.failures.length>0||e.outcomes!==void 0)}async function runRegistryFlow(e){let t;try{let n=e.initialAddress?.trim(),r;if(n!==void 0&&n!==``)r=[{address:n,name:n,source:`Registry`}];else{let t=e.deps?.browseRegistryCatalog??(await import(`#cli/commands/registry.js`)).browseRegistryCatalog,n=await withSpinner(e.prompter,`Loading registry…`,()=>t(e.appRoot)),i=[...n.items],a=await e.prompter.select({message:`Add to your agent`,search:!0,options:i.map(e=>({value:e.address,label:e.name,hint:e.address,keywords:[e.title??``,e.description??``]})),notices:n.errors.map(e=>({tone:`warning`,text:`${e.registry}: ${e.message}`}))}),o=i.find(e=>e.address===a);if(o===void 0)throw Error(`That registry item is no longer available. Run /add to try again.`);r=[o]}let i=e.deps?.installRegistryItem??(await import(`#cli/commands/registry.js`)).installRegistryItem,a=e.deps?.detectDeployment??(await import(`#setup/project-resolution.js`)).detectDeployment,o=e.deps?.runDeployFlow??(await import(`./deploy.js`)).runDeployFlow;t=createRegistrySession({detectDeployment:a,runDeployFlow:o}),e.onScreen?.({screen:`registry_install`});let s=t;for(let[t,n]of r.entries()){e.signal?.throwIfAborted(),e.onItemStart?.(n,t,r.length);try{let install=(t=e.signal)=>i(e.appRoot,n.address,{silent:!0,prompter:e.prompter,signal:t}),run=()=>e.runItem===void 0?install():e.runItem(install),t=await(e.prompter.withExclusiveTerminal?.(run)??run());s.add(label(n),t.output,t.setup)}catch(t){if(e.signal?.throwIfAborted(),t instanceof WizardCancelledError){s.addCancellation(label(n));continue}if(t instanceof HumanActionRequiredError)throw t;let r=(t instanceof Error?t.message:String(t)).trim()||`Installation failed.`,i=r.split(`
|
|
2
2
|
`).find(e=>e.trim()!==``);s.addFailure(label(n),r);let a={message:`Couldn't add ${label(n)}`,options:[{value:`skip`,label:`Skip ${label(n)}`},{value:`cancel`,label:`Cancel setup`}]};if(i!==void 0&&(a.description=i),await e.prompter.select(a)===`cancel`)return{kind:`done`,result:{...s.result(),cancelled:!0}}}}return{kind:`done`,result:await s.continueAfterInstall({appRoot:e.appRoot,prompter:e.prompter,signal:e.signal})}}catch(e){if(e instanceof WizardCancelledError){let e=t?.result();return hasSettledOutcomes(e)?{kind:`done`,result:{...e,cancelled:!0}}:{kind:`cancelled`}}let n=t?.result();throw hasSettledOutcomes(n)?new RegistryFlowFailedError(e,n):e}}export{RegistryFlowFailedError,runRegistryFlow};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{withLoginProgress}from"./model-login-progress.js";import{isObject}from"#shared/guards.js";import{rememberModelTeamSlug}from"#internal/model-auth/vercel-team.js";import{setTimeout}from"node:timers/promises";import{openUrl}from"#setup/primitives/open-url.js";import{writeVercelSession}from"#internal/model-auth/store.js";import{readVercelCliTeam}from"#internal/model-auth/vercel-cli.js";import{VERCEL_MODEL_CLIENT_ID,VERCEL_OAUTH_ISSUER,authJson,sessionFromToken,validateVercelAccess,vercelApiJson,vercelOAuthEndpoints}from"#internal/model-auth/vercel.js";async function loginVercelModel(e,t,n){let{endpoints:r,device:i}=await withLoginProgress(e,`Opening Vercel sign-in…`,async()=>{let e=await vercelOAuthEndpoints(t);return{endpoints:e,device:await authJson(e.device,{method:`POST`,body:new URLSearchParams({client_id:VERCEL_MODEL_CLIENT_ID,scope:`openid offline_access`}),signal:t})}});if(typeof i.device_code!=`string`||typeof i.verification_uri!=`string`||typeof i.user_code!=`string`)throw Error(`Could not start Vercel sign-in. Retry /login.`);let a=typeof i.verification_uri_complete==`string`?i.verification_uri_complete:i.verification_uri;if(URL.parse(a)?.origin!==VERCEL_OAUTH_ISSUER)throw Error(`Vercel returned an unexpected sign-in URL. Retry /login.`);e.log.info(`Open ${a} · code ${i.user_code}`),openUrl(a);let o=typeof i.interval==`number`?Math.max(1,Math.min(30,i.interval)):5,s=typeof i.expires_in==`number`?Math.min(600,i.expires_in):300,c=Date.now()+s*1e3,l=e.log.spinner?.(`Finish signing in to Vercel in your browser`,{kind:`external-action`,emphasis:`your browser`}),u;try{for(;Date.now()<c;){await setTimeout(o*1e3,void 0,{signal:t});let e=await authJson(r.token,{method:`POST`,body:new URLSearchParams({client_id:VERCEL_MODEL_CLIENT_ID,grant_type:`urn:ietf:params:oauth:grant-type:device_code`,device_code:i.device_code}),signal:t});if(e.error!==`authorization_pending`){if(e.error===`slow_down`){o=Math.min(30,o+5);continue}if(e.error)throw Error(`Vercel sign-in was declined or expired. Retry /login.`);u=sessionFromToken(e);break}}}finally{l?.stop()}if(!u)throw Error(`Vercel sign-in timed out. Retry /login.`);let[d,f]=await withLoginProgress(e,`Loading Vercel teams…`,()=>Promise.all([loadTeams(u.accessToken,t),readVercelCliTeam()])),p=d.find(e=>e.id===n)??d.find(e=>e.id===f),m=d.length===1?d[0]:void 0;for(;;){if(!m){let t=await e.select({message:`Choose a Vercel team`,search:!0,initialValue:p?.id,options:d.map(e=>({value:e.id,label:e.name}))});m=d.find(e=>e.id===t)}if(!m)throw Error(`That Vercel team is no longer available. Retry /login.`);let n=m;try{await withLoginProgress(e,`Checking AI Gateway access for ${m.slug??m.name}…`,()=>validateVercelAccess(u.accessToken,n.id,t));break}catch(n){if(t?.throwIfAborted(),d.length===1)throw n;e.log.warning(`AI Gateway is unavailable for that team. Choose another team or press Esc to return.`),m=void 0}}return u.teamId=m.id,u.teamName=m.name,t?.throwIfAborted(),await writeVercelSession(u,VERCEL_MODEL_CLIENT_ID),m.slug&&rememberModelTeamSlug(m.id,m.slug),{teamId:m.id,teamName:m.name}}async function loadTeams(e,t){let n=[],r;for(let i=0;i<20;i++){let i=await vercelApiJson(`https://api.vercel.com/v2/teams?limit=100${r===void 0?``:`&until=${r}`}`,{headers:{authorization:`Bearer ${e}`},signal:t});if(!Array.isArray(i.teams))throw Error(`Could not list Vercel teams. Retry /login.`);for(let e of i.teams)isObject(e)&&typeof e.id==`string`&&typeof e.name==`string`&&n.push({id:e.id,name:e.name,slug:typeof e.slug==`string`?e.slug:void 0});if(r=isObject(i.pagination)&&typeof i.pagination.next==`number`?i.pagination.next:void 0,r===void 0)break}if(n.length===0)throw Error(`No Vercel team is available. Join a team or choose another connection in /login.`);return n}export{loginVercelModel};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { type SelfModificationSetupOperations, type SelfModificationSetupValues } from "#self-modification/setup.js";
|
|
2
|
+
import type { VercelProjectReference } from "#setup/project-resolution.js";
|
|
2
3
|
import { type SetupApplyContext, type SetupPrepareContext } from "../types.js";
|
|
3
4
|
type SelfModificationSetupPlan = {
|
|
4
5
|
readonly kind: "authored";
|
|
@@ -7,6 +8,7 @@ type SelfModificationSetupPlan = {
|
|
|
7
8
|
} | {
|
|
8
9
|
readonly kind: "deployed";
|
|
9
10
|
readonly connectorName: string;
|
|
11
|
+
readonly project: VercelProjectReference;
|
|
10
12
|
readonly values: SelfModificationSetupValues;
|
|
11
13
|
};
|
|
12
14
|
export declare function prepareSelfModificationSetup(context: SetupPrepareContext, operations?: SelfModificationSetupOperations): Promise<SelfModificationSetupPlan>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{defineSetupIntegration}from"../types.js";import{describeIntegrationSetupEnvironment}from"../shared/environment.js";import{confirm,select,text}from"#setup/ask.js";import{classifySelfModificationConfig,connectorName,defaultSelfModificationSetupOperations,directoryError,gitRefError,renderSelfModificationConfig,repositoryPartError}from"#self-modification/setup.js";import{SELF_MODIFICATION_CONFIG_PATH}from"#self-modification/git-workspace.js";function validationResult(e){return e??null}async function prepareSelfModificationSetup(e,t=defaultSelfModificationSetupOperations(e.appRoot)){let n=await t.readConfig();if(classifySelfModificationConfig(n)===`authored`)return e.presenter.note(`The existing ${SELF_MODIFICATION_CONFIG_PATH} contains authored configuration and was not overwritten.`,`Manual update required`,{tone:`warning`}),{kind:`authored`};if(await e.asker.ask(select({key:`self-modification-mode`,message:`How should self-modification be enabled?`,options:[{id:`deployed`,value:`deployed`,label:`Enable for deployed`,hint:`Let deployed agents propose source changes through draft pull requests`},{id:`local`,value:`local`,label:`Keep local`,hint:`Only enable source editing during local development`}],recommended:`local`,required:!0}))===`local`)return{kind:`local`};let[r,i]=await Promise.all([t.detectGitRepository(),t.detectChannelNames()]),
|
|
1
|
+
import{defineSetupIntegration}from"../types.js";import{describeIntegrationSetupEnvironment}from"../shared/environment.js";import{confirm,select,text}from"#setup/ask.js";import{classifySelfModificationConfig,connectorName,defaultSelfModificationSetupOperations,directoryError,gitRefError,renderSelfModificationConfig,repositoryPartError}from"#self-modification/setup.js";import{SELF_MODIFICATION_CONFIG_PATH}from"#self-modification/git-workspace.js";function validationResult(e){return e??null}async function prepareSelfModificationSetup(e,t=defaultSelfModificationSetupOperations(e.appRoot)){let n=await t.readConfig();if(classifySelfModificationConfig(n)===`authored`)return e.presenter.note(`The existing ${SELF_MODIFICATION_CONFIG_PATH} contains authored configuration and was not overwritten.`,`Manual update required`,{tone:`warning`}),{kind:`authored`};if(await e.asker.ask(select({key:`self-modification-mode`,message:`How should self-modification be enabled?`,options:[{id:`deployed`,value:`deployed`,label:`Enable for deployed`,hint:`Let deployed agents propose source changes through draft pull requests`},{id:`local`,value:`local`,label:`Keep local`,hint:`Only enable source editing during local development`}],recommended:`local`,required:!0}))===`local`)return{kind:`local`};let[r,i,a]=await Promise.all([e.resolveVercelProject(`self-modification`),t.detectGitRepository(),t.detectChannelNames()]),o=await e.asker.ask(text({key:`self-modification-repository-owner`,message:`GitHub repository owner`,detected:i.owner,required:!0,validate:e=>validationResult(repositoryPartError(e))})),s=await e.asker.ask(text({key:`self-modification-repository-name`,message:`GitHub repository name`,detected:i.repo,required:!0,validate:e=>validationResult(repositoryPartError(e))})),c=await e.asker.ask(text({key:`self-modification-repository-directory`,message:`Application directory relative to the repository root`,detected:i.directory??`.`,required:!0,validate:e=>validationResult(directoryError(e))})),l=await e.asker.ask(text({key:`self-modification-target-branch`,message:`Target branch`,detected:i.branch??`main`,required:!0,validate:e=>validationResult(gitRefError(e))})),u=connectorName(o,s),d={branch:l,channelNames:a,connector:`github/${u}`,directory:c,repository:`github.com/${o}/${s}`,vercelBackend:!0};return e.presenter.note(renderSelfModificationConfig(d),`Generated ${SELF_MODIFICATION_CONFIG_PATH}`),e.presenter.note(`Vercel Connect will issue short-lived GitHub App credentials restricted to this repository. Install the managed GitHub App and select only this repository. Review, merge, and deployment remain separate operator boundaries.`,`Security summary`),await e.asker.ask(confirm({key:`self-modification-confirm`,message:`Create or attach this GitHub connector and write this configuration?`,recommended:!1,required:!0}))?{kind:`deployed`,connectorName:u,project:r,values:d}:{kind:`local`}}async function applySelfModificationSetup(e,t,n=defaultSelfModificationSetupOperations(t.appRoot)){if(e.kind===`authored`)return{facts:[{label:`Self-modification`,value:`manual configuration update required`}]};if(e.kind===`local`)return{facts:[]};let r=await n.findOrCreateConnector(e.connectorName,e.project);return await n.attachConnector(r,e.project),await n.writeConfig(renderSelfModificationConfig({...e.values,connector:r})),t.presenter.log.success(`Updated ${SELF_MODIFICATION_CONFIG_PATH}.`),t.presenter.nextSteps([`Install the managed GitHub App for the configured repository, then deploy or redeploy.`,e.values.vercelBackend?"After deployment, try self-modification by running `eve dev <deployment-url>` from this linked project. The generated policy admits its Vercel OIDC identity over HTTP; configured channels remain denied until you update `agent/subagents/self-modification/config.ts`.":"Before deployment, configure `deployed.authorize` in `agent/subagents/self-modification/config.ts` to admit a trusted principal for your deployment's channel. After deployment, use that channel to try self-modification."]),{deploymentRequired:!0,facts:[{label:`Repository`,value:e.values.repository},{label:`Application directory`,value:e.values.directory},{label:`Target branch`,value:e.values.branch},{label:`Credential`,value:r}]}}async function prepareLocalSelfModificationSetup(e,t=defaultSelfModificationSetupOperations(e.appRoot)){let n=await t.readConfig();return classifySelfModificationConfig(n)===`authored`?(e.presenter.note(`The existing ${SELF_MODIFICATION_CONFIG_PATH} contains authored configuration and was not overwritten.`,`Manual update required`,{tone:`warning`}),{kind:`authored`}):{kind:`local`}}function describeEnvironment(e){if(e.vercel.kind===`available`)return describeIntegrationSetupEnvironment(e);switch(e.vercel.reason){case`logged-out`:return`No authenticated Vercel account found. Local editing remains available; deployed proposals require Vercel Connect.`;case`cli-missing`:return`Vercel CLI not found. Local editing remains available; deployed proposals require Vercel Connect.`;case`unavailable`:return`Could not verify the Vercel account. Local editing remains available; deployed proposals require Vercel Connect.`}}const SELF_MODIFICATION_SETUP=defineSetupIntegration({kind:`self-modification`,label:`Self-modification`,hint:`Local source editing is enabled`,describeEnvironment,prepare:prepareLocalSelfModificationSetup,apply:applySelfModificationSetup}),SELF_MODIFICATION_PRODUCTION_SETUP=defineSetupIntegration({kind:`self-modification-production`,label:`Self-modification production`,hint:`Configure deployed draft pull requests`,describeEnvironment,prepare:prepareSelfModificationSetup,apply:applySelfModificationSetup});export{SELF_MODIFICATION_PRODUCTION_SETUP,SELF_MODIFICATION_SETUP,applySelfModificationSetup,prepareLocalSelfModificationSetup,prepareSelfModificationSetup};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{object}from"../node_modules/.pnpm/zod@4.5.4/node_modules/zod/v4/classic/schemas.js";import"../node_modules/.pnpm/zod@4.5.4/node_modules/zod/index.js";import{captureVercel}from"./primitives/run-vercel.js";import{stat}from"node:fs/promises";import{join}from"node:path";import{VercelProjectLinkSchema,readVercelProjectLink}from"#internal/vercel/project-link.js";const VercelProjectEnvironmentSchema=object({VERCEL_ORG_ID:VercelProjectLinkSchema.shape.orgId,VERCEL_PROJECT_ID:VercelProjectLinkSchema.shape.projectId});function projectReferenceFromEnvironment(e){let t=VercelProjectEnvironmentSchema.safeParse(e);if(t.success)return{orgId:t.data.VERCEL_ORG_ID,projectId:t.data.VERCEL_PROJECT_ID}}async function assertNoLegacyProjectLinkDirectory(e){try{if(!(await stat(join(e,`.now`))).isDirectory())return}catch(e){if(e instanceof Error&&`code`in e&&e.code===`ENOENT`)return;throw e}throw Error("Legacy Vercel link directory `.now` is not supported. Remove `.now` before linking this project.")}async function readProjectLink(e){return await assertNoLegacyProjectLinkDirectory(e),await readVercelProjectLink(e)}function pickShortestAlias(e){if(!Array.isArray(e))return;let t;for(let n of e)typeof n==`string`&&n.length!==0&&(t===void 0||n.length<t.length)&&(t=n);return t}async function fetchProductionAlias(e,t,n,r){let i=await captureVercel([`api`,`/v9/projects/${e}?teamId=${t}`,`--scope`,t],{cwd:n,signal:r.signal});if(i.ok)try{let e=pickShortestAlias(JSON.parse(i.stdout).targets?.production?.alias);return e?`https://${e}`:void 0}catch{return}}async function detectDeployment(e,t={}){t.signal?.throwIfAborted();let n=await readProjectLink(e);if(n===void 0)return{state:`unlinked`};let r=await fetchProductionAlias(n.projectId,n.orgId,e,t);return t.signal?.throwIfAborted(),{state:r?`deployed`:`linked`,projectId:n.projectId,orgId:n.orgId,productionUrl:r}}async function fetchVercelName(e,t,n,r){let i=await captureVercel([`api`,e,`--scope`,t],{cwd:n,signal:r.signal});if(i.ok)try{
|
|
1
|
+
import{object}from"../node_modules/.pnpm/zod@4.5.4/node_modules/zod/v4/classic/schemas.js";import"../node_modules/.pnpm/zod@4.5.4/node_modules/zod/index.js";import{captureVercel}from"./primitives/run-vercel.js";import{stat}from"node:fs/promises";import{join}from"node:path";import{readVercelResourceName}from"#internal/vercel/api-resource.js";import{VercelProjectLinkSchema,readVercelProjectLink}from"#internal/vercel/project-link.js";const VercelProjectEnvironmentSchema=object({VERCEL_ORG_ID:VercelProjectLinkSchema.shape.orgId,VERCEL_PROJECT_ID:VercelProjectLinkSchema.shape.projectId});function projectReferenceFromEnvironment(e){let t=VercelProjectEnvironmentSchema.safeParse(e);if(t.success)return{orgId:t.data.VERCEL_ORG_ID,projectId:t.data.VERCEL_PROJECT_ID}}async function assertNoLegacyProjectLinkDirectory(e){try{if(!(await stat(join(e,`.now`))).isDirectory())return}catch(e){if(e instanceof Error&&`code`in e&&e.code===`ENOENT`)return;throw e}throw Error("Legacy Vercel link directory `.now` is not supported. Remove `.now` before linking this project.")}async function readProjectLink(e){return await assertNoLegacyProjectLinkDirectory(e),await readVercelProjectLink(e)}function pickShortestAlias(e){if(!Array.isArray(e))return;let t;for(let n of e)typeof n==`string`&&n.length!==0&&(t===void 0||n.length<t.length)&&(t=n);return t}async function fetchProductionAlias(e,t,n,r){let i=await captureVercel([`api`,`/v9/projects/${e}?teamId=${t}`,`--scope`,t],{cwd:n,signal:r.signal});if(i.ok)try{let e=pickShortestAlias(JSON.parse(i.stdout).targets?.production?.alias);return e?`https://${e}`:void 0}catch{return}}async function detectDeployment(e,t={}){t.signal?.throwIfAborted();let n=await readProjectLink(e);if(n===void 0)return{state:`unlinked`};let r=await fetchProductionAlias(n.projectId,n.orgId,e,t);return t.signal?.throwIfAborted(),{state:r?`deployed`:`linked`,projectId:n.projectId,orgId:n.orgId,productionUrl:r}}async function fetchVercelName(e,t,n,r){let i=await captureVercel([`api`,e,`--scope`,t],{cwd:n,signal:r.signal});if(i.ok)try{return readVercelResourceName(JSON.parse(i.stdout))}catch{return}}async function detectProjectIdentity(e,t={}){t.signal?.throwIfAborted();let n=await readProjectLink(e);if(n===void 0)return;let[r,i]=await Promise.all([fetchVercelName(`/v9/projects/${n.projectId}?teamId=${n.orgId}`,n.orgId,e,t).then(e=>e??n.projectId),n.orgId.startsWith(`team_`)?fetchVercelName(`/v2/teams/${n.orgId}`,n.orgId,e,t):Promise.resolve(void 0)]);return t.signal?.throwIfAborted(),{projectName:r,teamName:i}}function projectResolutionFromDeployment(e){return e.state===`unlinked`||e.projectId===void 0?{kind:`unresolved`}:e.state===`deployed`&&e.productionUrl!==void 0?{kind:`deployed`,projectId:e.projectId,productionUrl:e.productionUrl}:{kind:`linked`,projectId:e.projectId}}async function detectProjectResolution(e,t={}){return projectResolutionFromDeployment(await detectDeployment(e,t))}function mergeProjectResolution(e,t){return t.kind===`unresolved`||e.kind===`deployed`&&e.projectId===t.projectId?e:t}function projectResolutionFromDeployResult(e,t){return e.kind===`unresolved`||!t.deployed||t.productionUrl===void 0?e:{kind:`deployed`,projectId:e.projectId,productionUrl:t.productionUrl}}function isProjectResolved(e){return e.kind!==`unresolved`}function projectProductionUrlFromResolution(e){return e.kind===`deployed`?e.productionUrl:void 0}export{assertNoLegacyProjectLinkDirectory,detectDeployment,detectProjectIdentity,detectProjectResolution,isProjectResolved,mergeProjectResolution,projectProductionUrlFromResolution,projectReferenceFromEnvironment,projectResolutionFromDeployResult,projectResolutionFromDeployment,readProjectLink};
|
|
@@ -9,6 +9,8 @@ export type PrompterValue = string | number | boolean;
|
|
|
9
9
|
export interface SelectOption<T extends PrompterValue> {
|
|
10
10
|
value: T;
|
|
11
11
|
label: string;
|
|
12
|
+
/** Additional searchable text that is never rendered in the menu. */
|
|
13
|
+
keywords?: readonly string[];
|
|
12
14
|
/** Completion action kept after searchable results instead of being filtered. */
|
|
13
15
|
trailingAction?: boolean;
|
|
14
16
|
hint?: string;
|
|
@@ -96,7 +98,7 @@ export interface SelectCommonOptions<T extends PrompterValue> {
|
|
|
96
98
|
options: SelectOption<T>[];
|
|
97
99
|
/**
|
|
98
100
|
* Add a type-ahead filter line. The filter is a case-insensitive substring
|
|
99
|
-
* match against each option's label, value, and
|
|
101
|
+
* match against each option's label, value, hints, and keywords.
|
|
100
102
|
*/
|
|
101
103
|
search?: boolean;
|
|
102
104
|
/** Placeholder shown in the filter line while it is empty (with `search`). */
|
|
@@ -1,12 +1,25 @@
|
|
|
1
|
-
|
|
2
|
-
export type ProviderSelection =
|
|
1
|
+
import { type ModelConnectionSelection } from "#shared/model-connection.js";
|
|
2
|
+
export type ProviderSelection = ModelConnectionSelection;
|
|
3
3
|
export declare function providerSettingsPath(appRoot: string): string;
|
|
4
4
|
export declare function resolveAvailableProviders(appRoot: string, options?: {
|
|
5
5
|
signal?: AbortSignal;
|
|
6
6
|
env?: Record<string, string | undefined>;
|
|
7
7
|
}): Promise<readonly ProviderSelection[]>;
|
|
8
8
|
export declare function readProviderSelection(appRoot: string): Promise<ProviderSelection | undefined>;
|
|
9
|
-
|
|
10
|
-
export
|
|
11
|
-
|
|
12
|
-
|
|
9
|
+
export declare function readProviderSettingsSync(appRoot: string): ProviderSettings | undefined;
|
|
10
|
+
export interface ProviderSettings {
|
|
11
|
+
selected: ProviderSelection;
|
|
12
|
+
teamId?: string;
|
|
13
|
+
teamName?: string;
|
|
14
|
+
keySource?: "environment" | "secret";
|
|
15
|
+
}
|
|
16
|
+
export declare function providerSettingsMatch(appRoot: string, settings: ProviderSettings): Promise<boolean>;
|
|
17
|
+
export declare function writeProviderSelection(appRoot: string, selected: ProviderSelection, team?: {
|
|
18
|
+
teamId: string;
|
|
19
|
+
teamName: string;
|
|
20
|
+
}, keySource?: "environment" | "secret"): Promise<void>;
|
|
21
|
+
export declare function readProviderTeamSync(appRoot: string): {
|
|
22
|
+
teamId: string;
|
|
23
|
+
teamName: string;
|
|
24
|
+
} | undefined;
|
|
25
|
+
export declare function readProviderKeySourceSync(appRoot: string): "environment" | "secret" | undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{mkdir,readFile
|
|
1
|
+
import{mkdir,readFile}from"node:fs/promises";import{isObject}from"#shared/guards.js";import{join}from"node:path";import{readFileSync}from"node:fs";import{readProjectLink}from"#setup/project-resolution.js";import{hasEnvValue}from"#internal/resolve-model-endpoint-status.js";import{atomicWriteFile}from"#shared/atomic-write-file.js";import{isModelConnection}from"#shared/model-connection.js";import{AI_GATEWAY_API_KEY_ENV_VAR}from"#setup/ai-gateway-api-key.js";import{findEnvFileWithKey}from"#setup/boxes/detect-ai-gateway.js";function providerSettingsPath(e){return join(e,`.eve`,`provider.json`)}async function resolveAvailableProviders(e,t={}){let{signal:n,env:r=process.env}=t;n?.throwIfAborted();let[i,a,o]=await Promise.all([readProjectLink(e),findEnvFileWithKey(e,AI_GATEWAY_API_KEY_ENV_VAR),findEnvFileWithKey(e,`VERCEL_OIDC_TOKEN`)]);n?.throwIfAborted();let s=[`chatgpt`];return(a!==void 0||hasEnvValue(r[AI_GATEWAY_API_KEY_ENV_VAR]))&&s.push(`ai-gateway-key`),(i!==void 0||o!==void 0)&&s.push(`ai-gateway-project`),s}async function readProviderSelection(e){try{return parseProviderSelection(JSON.parse(await readFile(providerSettingsPath(e),`utf8`)))}catch{return}}function readProviderSettingsSync(e){try{let t=JSON.parse(readFileSync(providerSettingsPath(e),`utf8`));return!isObject(t)||!isProviderSelection(t.selected)?void 0:{selected:t.selected,...typeof t.teamId==`string`&&typeof t.teamName==`string`&&{teamId:t.teamId,teamName:t.teamName},...(t.keySource===`environment`||t.keySource===`secret`)&&{keySource:t.keySource}}}catch{return}}async function providerSettingsMatch(e,t){try{let n=JSON.parse(await readFile(providerSettingsPath(e),`utf8`));return isObject(n)&&n.selected===t.selected&&n.teamId===t.teamId&&n.teamName===t.teamName&&n.keySource===t.keySource}catch{return!1}}async function writeProviderSelection(e,t,n,r){await mkdir(join(e,`.eve`),{recursive:!0}),await atomicWriteFile(providerSettingsPath(e),`${JSON.stringify({selected:t,...n,keySource:r},null,2)}\n`)}function parseProviderSelection(e){return isObject(e)&&isProviderSelection(e.selected)?e.selected:void 0}function isProviderSelection(e){return isModelConnection(e)||e===`vercel-cli`||e===`ai-gateway-project`}function readProviderTeamSync(e){let t=readProviderSettingsSync(e);return t?.teamId&&t.teamName?{teamId:t.teamId,teamName:t.teamName}:void 0}function readProviderKeySourceSync(e){return readProviderSettingsSync(e)?.keySource}export{providerSettingsMatch,providerSettingsPath,readProviderKeySourceSync,readProviderSelection,readProviderSettingsSync,readProviderTeamSync,resolveAvailableProviders,writeProviderSelection};
|
|
@@ -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.93`,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.93`,DEFAULT_CONNECT_PACKAGE_VERSION=`1.0.0`,DEFAULT_ZOD_PACKAGE_VERSION=`4.5.4`,DEFAULT_EVE_PACKAGE_CONTRACT={version:`0.57.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,t){let n=parseChatGptModelSelection(e);return n===void 0?BASE_AGENT_TEMPLATE.replaceAll(`__EVE_INIT_MODEL__`,e).replaceAll(`__EVE_INIT_REASONING__`,reasoningTemplateLine(t)):`import { defineAgent } from "eve";\nimport { chatgpt } from "eve/models/openai";\n\nexport default defineAgent({\n model: chatgpt(${JSON.stringify(n)}),\n${reasoningTemplateLine(t)}});\n`}function reasoningTemplateLine(e){return e===void 0||e===`provider-default`?``:` reasoning: "${e}",\n`}function renderTemplate(e,t){return e===BASE_AGENT_TEMPLATE&&parseChatGptModelSelection(t.model)!==void 0?renderAgentTemplate(t.model,t.reasoning):e.replaceAll(`__EVE_INIT_APP_NAME__`,t.appName).replaceAll(`__EVE_INIT_MODEL__`,t.model).replaceAll(`__EVE_INIT_REASONING__`,reasoningTemplateLine(t.reasoning)).replaceAll(`__EVE_INIT_BYOK_PROVIDER__`,modelProviderSlug(t.model)).replaceAll(`__EVE_INIT_BYOK_ENV_VAR__`,byokProviderEnvVar(t.model)).replaceAll(`__EVE_INIT_PACKAGE_VERSION__`,formatEveDependencySpecifier(t.eveVersion)).replaceAll(`__EVE_INIT_AI_SDK_VERSION__`,t.aiPackageVersion).replaceAll(`__EVE_INIT_CONNECT_VERSION__`,t.connectPackageVersion).replaceAll(`__EVE_INIT_ZOD_VERSION__`,t.zodPackageVersion).replaceAll(`__EVE_INIT_TYPESCRIPT_VERSION__`,t.typescriptPackageVersion).replaceAll(`__EVE_INIT_TYPES_NODE_VERSION__`,t.nodeTypesVersion).replaceAll(`__EVE_INIT_NODE_ENGINE__`,t.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__",
|
|
Binary file
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { Prompter } from "./prompter.js";
|
|
2
2
|
/** Runs asynchronous work behind an optional spinner that always stops. */
|
|
3
|
-
export declare function withSpinner<T>(prompter: Prompter, message: string, task: () => Promise<T
|
|
3
|
+
export declare function withSpinner<T>(prompter: Prompter, message: string, task: () => Promise<T>, delayMs?: number): Promise<T>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
async function withSpinner(e,t,n){let
|
|
1
|
+
async function withSpinner(e,t,n,r=0){let i,start=()=>{i=e.log.spinner?.(t)},a=r>0?setTimeout(start,r):void 0;a===void 0&&start();try{return await n()}finally{clearTimeout(a),i?.stop()}}export{withSpinner};
|
|
@@ -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{agentTurnOutcomeSchema,agentTurnOutcomeWithCostSchema}from"#shared/agent-turn-outcome.js";import{tokenUsageSchema,tokenUsageWithCostSchema}from"#shared/token-usage.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(),RUNTIME_WORKFLOW_TOOL_ACTION=Symbol.for(`eve:runtime-workflow-tool-action`);function markRuntimeWorkflowToolAction(e){return Object.defineProperty(e,RUNTIME_WORKFLOW_TOOL_ACTION,{value:!0}),e}function isRuntimeWorkflowToolAction(e){return e.kind===`workflow-tool-call`||e.kind===`tool-call`&&Reflect.get(e,RUNTIME_WORKFLOW_TOOL_ACTION)===!0}const 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 runtimeSubagentChildResultFields={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`),output:jsonValueSchema,subagentName:z.string()},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(),runtimeSubagentChildResultWithCostSchema=z.object({...runtimeSubagentChildResultFields,outcome:agentTurnOutcomeWithCostSchema,usage:tokenUsageWithCostSchema.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{isRuntimeWorkflowToolAction,markRuntimeWorkflowToolAction,runtimeActionRequestSchema,runtimeRemoteAgentCallActionRequestSchema,runtimeRemoteAgentDispatchRequestSchema,runtimeSubagentChildResultSchema,runtimeSubagentChildResultWithCostSchema,runtimeToolCallActionRequestSchema,runtimeWorkflowTaskRequestSchema};
|
|
@@ -119,10 +119,11 @@ export interface PublicAgentCompactionDefinition {
|
|
|
119
119
|
*/
|
|
120
120
|
export interface AgentLimitsDefinition {
|
|
121
121
|
/**
|
|
122
|
-
*
|
|
122
|
+
* Session lifetime from creation or the latest ownership handoff, in milliseconds.
|
|
123
123
|
*
|
|
124
|
-
*
|
|
125
|
-
*
|
|
124
|
+
* A successful deployment handoff or legacy-session import restarts the
|
|
125
|
+
* original configured duration. Process restarts and failed or skipped
|
|
126
|
+
* handoffs preserve the deadline. If it elapses during an active turn, eve lets
|
|
126
127
|
* that turn settle before completing the session normally.
|
|
127
128
|
*
|
|
128
129
|
* `false` disables the timeout.
|
|
@@ -255,7 +256,8 @@ export interface AgentWorkflowDefinition {
|
|
|
255
256
|
readonly modelCallsPerStep?: number;
|
|
256
257
|
/**
|
|
257
258
|
* How long the agent's run data is kept after the run finishes.
|
|
258
|
-
* Applied to
|
|
259
|
+
* Applied to every run that owns the session, including successors created
|
|
260
|
+
* by deployment handoff.
|
|
259
261
|
*
|
|
260
262
|
* - `"default"`: same as omission. The Workflow SDK World decides.
|
|
261
263
|
* On Vercel this follows your team's plan.
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { ModelRouting } from "./agent-definition.js";
|
|
2
|
-
export declare const DEFAULT_CHATGPT_MODEL_ID = "gpt-5.6-
|
|
2
|
+
export declare const DEFAULT_CHATGPT_MODEL_ID = "gpt-5.6-luna-fast";
|
|
3
3
|
export declare const CHATGPT_MODEL_SELECTION_PREFIX = "chatgpt/";
|
|
4
|
-
export declare const DEFAULT_CHATGPT_MODEL_SELECTION = "chatgpt/gpt-5.6-
|
|
4
|
+
export declare const DEFAULT_CHATGPT_MODEL_SELECTION = "chatgpt/gpt-5.6-luna-fast";
|
|
5
5
|
/** Returns the bare OpenAI model id encoded by a setup-facing ChatGPT selection. */
|
|
6
6
|
export declare function parseChatGptModelSelection(selection: string): string | undefined;
|
|
7
7
|
export declare function isChatGptModelRouting(routing: ModelRouting | null | undefined): boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const DEFAULT_CHATGPT_MODEL_ID=`gpt-5.6-
|
|
1
|
+
const DEFAULT_CHATGPT_MODEL_ID=`gpt-5.6-luna-fast`,CHATGPT_MODEL_SELECTION_PREFIX=`chatgpt/`,DEFAULT_CHATGPT_MODEL_SELECTION=`${CHATGPT_MODEL_SELECTION_PREFIX}${DEFAULT_CHATGPT_MODEL_ID}`;function parseChatGptModelSelection(e){if(!e.startsWith(`chatgpt/`))return;let t=e.slice(8);return isBareChatGptModelId(t)?t:void 0}function isChatGptModelRouting(e){return e?.kind===`external`&&e.provider===`codex`}function normalizeChatGptModelId(e){let t=e.trim(),n=t.startsWith(`openai/`)?t.slice(7):t;return isBareChatGptModelId(n)?n:void 0}function isBareChatGptModelId(e){return e.length>0&&e===e.trim()&&!e.includes(`/`)}export{CHATGPT_MODEL_SELECTION_PREFIX,DEFAULT_CHATGPT_MODEL_ID,DEFAULT_CHATGPT_MODEL_SELECTION,isChatGptModelRouting,normalizeChatGptModelId,parseChatGptModelSelection};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { ModelRouting } from "./agent-definition.js";
|
|
2
|
+
import type { ModelEndpointStatus } from "./model-endpoint-status.js";
|
|
3
|
+
export declare const CONNECTIONS: readonly ["chatgpt", "vercel", "ai-gateway-key", "openai", "anthropic"];
|
|
4
|
+
export type ModelConnection = (typeof CONNECTIONS)[number];
|
|
5
|
+
export type ModelConnectionSelection = ModelConnection | "ai-gateway-project" | "vercel-cli";
|
|
6
|
+
export declare function isModelConnection(value: unknown): value is ModelConnection;
|
|
7
|
+
export interface ConnectedModel {
|
|
8
|
+
id: string;
|
|
9
|
+
routing: ModelRouting;
|
|
10
|
+
endpoint: ModelEndpointStatus;
|
|
11
|
+
}
|
|
12
|
+
/** Whether a completed connection or model edit still needs runtime activation. */
|
|
13
|
+
export interface ModelAccessChange {
|
|
14
|
+
kind: "model-access-changed";
|
|
15
|
+
reload: boolean;
|
|
16
|
+
model?: ConnectedModel;
|
|
17
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const CONNECTIONS=[`chatgpt`,`vercel`,`ai-gateway-key`,`openai`,`anthropic`];function isModelConnection(e){return CONNECTIONS.some(t=>t===e)}export{CONNECTIONS,isModelConnection};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export declare const MODEL_CONNECTION_ENV = "EVE_MODEL_CONNECTION";
|
|
2
|
+
export declare const MODEL_HELPERS: {
|
|
3
|
+
readonly chatgpt: {
|
|
4
|
+
readonly module: "eve/models/openai";
|
|
5
|
+
readonly prefix: "chatgpt/";
|
|
6
|
+
readonly defaultModel: "gpt-5.6-luna-fast";
|
|
7
|
+
readonly provider: "codex";
|
|
8
|
+
};
|
|
9
|
+
readonly openai: {
|
|
10
|
+
readonly module: "eve/models/openai";
|
|
11
|
+
readonly prefix: "openai-api/";
|
|
12
|
+
readonly defaultModel: "gpt-5.6-luna-fast";
|
|
13
|
+
readonly provider: "openai";
|
|
14
|
+
};
|
|
15
|
+
readonly anthropic: {
|
|
16
|
+
readonly module: "eve/models/anthropic";
|
|
17
|
+
readonly prefix: "anthropic-api/";
|
|
18
|
+
readonly defaultModel: "claude-sonnet-5";
|
|
19
|
+
readonly provider: "anthropic";
|
|
20
|
+
};
|
|
21
|
+
};
|
|
22
|
+
export type ModelHelper = keyof typeof MODEL_HELPERS;
|
|
23
|
+
export declare function parseModelHelper(selection: string): {
|
|
24
|
+
helper: ModelHelper;
|
|
25
|
+
id: string;
|
|
26
|
+
} | undefined;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const MODEL_CONNECTION_ENV=`EVE_MODEL_CONNECTION`,MODEL_HELPERS={chatgpt:{module:`eve/models/openai`,prefix:`chatgpt/`,defaultModel:`gpt-5.6-luna-fast`,provider:`codex`},openai:{module:`eve/models/openai`,prefix:`openai-api/`,defaultModel:`gpt-5.6-luna-fast`,provider:`openai`},anthropic:{module:`eve/models/anthropic`,prefix:`anthropic-api/`,defaultModel:`claude-sonnet-5`,provider:`anthropic`}};function parseModelHelper(e){for(let t of Object.keys(MODEL_HELPERS)){let{prefix:n}=MODEL_HELPERS[t];if(e.startsWith(n)){let r=e.slice(n.length);if(r&&r===r.trim()&&!r.includes(`/`))return{helper:t,id:r}}}}export{MODEL_CONNECTION_ENV,MODEL_HELPERS,parseModelHelper};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function stripVersionBuildMetadata(e){return e.split(`+`,1)[0]}export{stripVersionBuildMetadata};
|
|
@@ -45,6 +45,7 @@ export type EveVercelServiceRequestPathRoute = {
|
|
|
45
45
|
export type EveVercelGeneratedService = {
|
|
46
46
|
readonly buildCommand: string;
|
|
47
47
|
readonly framework: "eve";
|
|
48
|
+
readonly outputDirectory: ".vercel/output";
|
|
48
49
|
readonly routes: readonly VercelRouteConfig[];
|
|
49
50
|
readonly root: string;
|
|
50
51
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{mkdir,readFile}from"node:fs/promises";import{EVE_ROUTE_PREFIX}from"#protocol/routes.js";import{dirname,join,relative}from"node:path";import{EVE_INTERNAL_BUILD_OUTPUT_DIRECTORY_ENV,EVE_INTERNAL_HOST_BUILD_OUTPUT_DIRECTORY_ENV}from"#internal/application/paths.js";import{shellQuote}from"#shared/shell-quote.js";import{findClosestLinkedVercelDirectory}from"#shared/vercel-output-directory.js";import{resolveEveBinaryPath}from"#shared/resolve-eve-binary.js";const VERCEL_JSON_FILE_NAME=`vercel.json`,EVE_SERVICE_ROUTE_SRC=`^${EVE_ROUTE_PREFIX}/(.*)$`,EVE_SERVICE_ROUTE_PATH=`${EVE_ROUTE_PREFIX}/$1`;function isRecord(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function toPosixRelative(e,t){let n=relative(e,t);return n.length===0?`.`:n.replaceAll(`\\`,`/`)}function isNamedServiceConfigArray(e){return Array.isArray(e)}function createServiceConfigRecord(e){if(e===void 0)return{};if(isNamedServiceConfigArray(e)){let t={};for(let n of e)if(typeof n.name==`string`&&n.name.trim().length>0){let{name:e,...r}=n;t[e]=r}return t}return e}function normalizeVercelJsonConfig(e){if(!isRecord(e))throw Error(`${VERCEL_JSON_FILE_NAME} must contain a JSON object.`);let t=e.services;if(t!==void 0&&!isRecord(t)&&!(Array.isArray(t)&&t.every(e=>isRecord(e)&&typeof e.name==`string`&&e.name.trim().length>0)))throw Error(`${VERCEL_JSON_FILE_NAME} services must be a JSON object or named service array.`);return e}async function readVercelJsonConfig(e){try{return normalizeVercelJsonConfig(JSON.parse(await readFile(e,`utf8`)))}catch(e){if(e instanceof Error&&`code`in e&&e.code===`ENOENT`)return{};throw e}}function findEveService(e){return Object.values(e).find(e=>e.framework===`eve`)}function assertRootServicesIncludeEve(e,t){if(findEveService(e)===void 0)throw Error(`${VERCEL_JSON_FILE_NAME} already defines services, so the eve ${t} integration cannot add a generated eve service. Add an eve service (framework "eve") and a rewrite from ${EVE_ROUTE_PREFIX}/(.*) to it in ${VERCEL_JSON_FILE_NAME}, or remove services from ${VERCEL_JSON_FILE_NAME}.`)}function createEveServiceRoute(e=`eve`){return{destination:{service:e,type:`service`},src:EVE_SERVICE_ROUTE_SRC}}function createEveServiceRequestPathRoute(){return{src:EVE_SERVICE_ROUTE_SRC,transforms:[{args:EVE_SERVICE_ROUTE_PATH,op:`set`,type:`request.path`}]}}function isEveServiceRoute(e,t){let n=e.destination;return e.src===EVE_SERVICE_ROUTE_SRC&&isRecord(n)&&n.type===`service`&&n.service===t}function insertEveServiceRoute(e,t){let n=e.filter(e=>!(isRecord(e)&&isEveServiceRoute(e,t))),r=n.findIndex(e=>isRecord(e)&&e.handle===`filesystem`);return r===-1?[createEveServiceRoute(t),...n]:[...n.slice(0,r),createEveServiceRoute(t),...n.slice(r)]}function insertEveServiceRequestPathRoute(e){let t=(e??[]).filter(e=>e.src!==EVE_SERVICE_ROUTE_SRC);return[createEveServiceRequestPathRoute(),...t]}function createGeneratedServiceBuild(e){let t=join(e.hostRoot,`.eve/vercel-services`,`eve`),n=join(t,`.vercel`,`output`),r=join(e.hostRoot,`.vercel`,`output`),i=toPosixRelative(t,e.appRoot),a=toPosixRelative(e.appRoot,n),o=toPosixRelative(e.appRoot,r),s=e.eveBuildCommand??`node ${shellQuote(toPosixRelative(e.appRoot,resolveEveBinaryPath(e.hostRoot)))} build`;return{buildCommand:`cd ${shellQuote(i)} && export ${EVE_INTERNAL_BUILD_OUTPUT_DIRECTORY_ENV}=${shellQuote(a)} && export ${EVE_INTERNAL_HOST_BUILD_OUTPUT_DIRECTORY_ENV}=${shellQuote(o)} && ${s}`,root:toPosixRelative(e.hostRoot,t),rootDirectory:t}}async function ensureEveVercelServicesConfig(e){let t=await findClosestLinkedVercelDirectory(e.hostRoot),n=t===void 0?e.hostRoot:dirname(t),r=await readVercelJsonConfig(join(e.hostRoot,VERCEL_JSON_FILE_NAME)),i=n===e.hostRoot||Object.keys(createServiceConfigRecord(r.services)).length>0?r:await readVercelJsonConfig(join(n,VERCEL_JSON_FILE_NAME)),a=createServiceConfigRecord(i.services);if(Object.keys(a).length>0)return assertRootServicesIncludeEve(a,e.frameworkName),{mode:`root`};i.experimentalServices!==void 0&&console.warn(`[eve] ${VERCEL_JSON_FILE_NAME} defines experimentalServices, which Vercel no longer routes. The eve ${e.frameworkName} integration now generates the stable services config automatically — remove experimentalServices from ${VERCEL_JSON_FILE_NAME}.`);let o=createGeneratedServiceBuild(e);return await mkdir(o.rootDirectory,{recursive:!0}),{mode:`generated`,services:{eve:{buildCommand:o.buildCommand,framework:`eve`,routes:[createEveServiceRequestPathRoute()],root:o.root}}}}function mergeEveVercelConfig(e,t){let n=e?.services??{},r=Object.entries(n).find(([e,t])=>e===`eve`||t.framework===`eve`),i=r?.[0]??`eve`,a=r?{...n,[i]:{...r[1],routes:insertEveServiceRequestPathRoute(r[1].routes)}}:{...n,...t.services};return{version:3,...e,routes:insertEveServiceRoute(e?.routes??[],i),services:a}}export{createEveServiceRequestPathRoute,createEveServiceRoute,ensureEveVercelServicesConfig,mergeEveVercelConfig};
|
|
1
|
+
import{mkdir,readFile}from"node:fs/promises";import{EVE_ROUTE_PREFIX}from"#protocol/routes.js";import{dirname,join,relative}from"node:path";import{EVE_INTERNAL_BUILD_OUTPUT_DIRECTORY_ENV,EVE_INTERNAL_HOST_BUILD_OUTPUT_DIRECTORY_ENV}from"#internal/application/paths.js";import{shellQuote}from"#shared/shell-quote.js";import{findClosestLinkedVercelDirectory}from"#shared/vercel-output-directory.js";import{resolveEveBinaryPath}from"#shared/resolve-eve-binary.js";const VERCEL_JSON_FILE_NAME=`vercel.json`,EVE_SERVICE_ROUTE_SRC=`^${EVE_ROUTE_PREFIX}/(.*)$`,EVE_SERVICE_ROUTE_PATH=`${EVE_ROUTE_PREFIX}/$1`;function isRecord(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function toPosixRelative(e,t){let n=relative(e,t);return n.length===0?`.`:n.replaceAll(`\\`,`/`)}function isNamedServiceConfigArray(e){return Array.isArray(e)}function createServiceConfigRecord(e){if(e===void 0)return{};if(isNamedServiceConfigArray(e)){let t={};for(let n of e)if(typeof n.name==`string`&&n.name.trim().length>0){let{name:e,...r}=n;t[e]=r}return t}return e}function normalizeVercelJsonConfig(e){if(!isRecord(e))throw Error(`${VERCEL_JSON_FILE_NAME} must contain a JSON object.`);let t=e.services;if(t!==void 0&&!isRecord(t)&&!(Array.isArray(t)&&t.every(e=>isRecord(e)&&typeof e.name==`string`&&e.name.trim().length>0)))throw Error(`${VERCEL_JSON_FILE_NAME} services must be a JSON object or named service array.`);return e}async function readVercelJsonConfig(e){try{return normalizeVercelJsonConfig(JSON.parse(await readFile(e,`utf8`)))}catch(e){if(e instanceof Error&&`code`in e&&e.code===`ENOENT`)return{};throw e}}function findEveService(e){return Object.values(e).find(e=>e.framework===`eve`)}function assertRootServicesIncludeEve(e,t){if(findEveService(e)===void 0)throw Error(`${VERCEL_JSON_FILE_NAME} already defines services, so the eve ${t} integration cannot add a generated eve service. Add an eve service (framework "eve") and a rewrite from ${EVE_ROUTE_PREFIX}/(.*) to it in ${VERCEL_JSON_FILE_NAME}, or remove services from ${VERCEL_JSON_FILE_NAME}.`)}function createEveServiceRoute(e=`eve`){return{destination:{service:e,type:`service`},src:EVE_SERVICE_ROUTE_SRC}}function createEveServiceRequestPathRoute(){return{src:EVE_SERVICE_ROUTE_SRC,transforms:[{args:EVE_SERVICE_ROUTE_PATH,op:`set`,type:`request.path`}]}}function isEveServiceRoute(e,t){let n=e.destination;return e.src===EVE_SERVICE_ROUTE_SRC&&isRecord(n)&&n.type===`service`&&n.service===t}function insertEveServiceRoute(e,t){let n=e.filter(e=>!(isRecord(e)&&isEveServiceRoute(e,t))),r=n.findIndex(e=>isRecord(e)&&e.handle===`filesystem`);return r===-1?[createEveServiceRoute(t),...n]:[...n.slice(0,r),createEveServiceRoute(t),...n.slice(r)]}function insertEveServiceRequestPathRoute(e){let t=(e??[]).filter(e=>e.src!==EVE_SERVICE_ROUTE_SRC);return[createEveServiceRequestPathRoute(),...t]}function createGeneratedServiceBuild(e){let t=join(e.hostRoot,`.eve/vercel-services`,`eve`),n=join(t,`.vercel`,`output`),r=join(e.hostRoot,`.vercel`,`output`),i=toPosixRelative(t,e.appRoot),a=toPosixRelative(e.appRoot,n),o=toPosixRelative(e.appRoot,r),s=e.eveBuildCommand??`node ${shellQuote(toPosixRelative(e.appRoot,resolveEveBinaryPath(e.hostRoot)))} build`;return{buildCommand:`cd ${shellQuote(i)} && export ${EVE_INTERNAL_BUILD_OUTPUT_DIRECTORY_ENV}=${shellQuote(a)} && export ${EVE_INTERNAL_HOST_BUILD_OUTPUT_DIRECTORY_ENV}=${shellQuote(o)} && ${s}`,root:toPosixRelative(e.hostRoot,t),rootDirectory:t}}async function ensureEveVercelServicesConfig(e){let t=await findClosestLinkedVercelDirectory(e.hostRoot),n=t===void 0?e.hostRoot:dirname(t),r=await readVercelJsonConfig(join(e.hostRoot,VERCEL_JSON_FILE_NAME)),i=n===e.hostRoot||Object.keys(createServiceConfigRecord(r.services)).length>0?r:await readVercelJsonConfig(join(n,VERCEL_JSON_FILE_NAME)),a=createServiceConfigRecord(i.services);if(Object.keys(a).length>0)return assertRootServicesIncludeEve(a,e.frameworkName),{mode:`root`};i.experimentalServices!==void 0&&console.warn(`[eve] ${VERCEL_JSON_FILE_NAME} defines experimentalServices, which Vercel no longer routes. The eve ${e.frameworkName} integration now generates the stable services config automatically — remove experimentalServices from ${VERCEL_JSON_FILE_NAME}.`);let o=createGeneratedServiceBuild(e);return await mkdir(o.rootDirectory,{recursive:!0}),{mode:`generated`,services:{eve:{buildCommand:o.buildCommand,framework:`eve`,outputDirectory:`.vercel/output`,routes:[createEveServiceRequestPathRoute()],root:o.root}}}}function mergeEveVercelConfig(e,t){let n=e?.services??{},r=Object.entries(n).find(([e,t])=>e===`eve`||t.framework===`eve`),i=r?.[0]??`eve`,a=r?{...n,[i]:{...r[1],routes:insertEveServiceRequestPathRoute(r[1].routes)}}:{...n,...t.services};return{version:3,...e,routes:insertEveServiceRoute(e?.routes??[],i),services:a}}export{createEveServiceRequestPathRoute,createEveServiceRoute,ensureEveVercelServicesConfig,mergeEveVercelConfig};
|
|
@@ -8,6 +8,11 @@ export type Program = {
|
|
|
8
8
|
readonly body?: readonly AstNode[];
|
|
9
9
|
};
|
|
10
10
|
export type AstNode = {
|
|
11
|
+
readonly source?: AstNode;
|
|
12
|
+
readonly specifiers?: readonly AstNode[];
|
|
13
|
+
readonly local?: AstNode;
|
|
14
|
+
readonly imported?: AstNode;
|
|
15
|
+
readonly importKind?: string;
|
|
11
16
|
readonly arguments?: readonly AstNode[];
|
|
12
17
|
readonly callee?: AstNode;
|
|
13
18
|
readonly computed?: boolean;
|
|
@@ -31,6 +36,7 @@ export type ObjectExpression = AstNode & {
|
|
|
31
36
|
export type ParsedAgentObject = {
|
|
32
37
|
readonly kind: "ok";
|
|
33
38
|
readonly object: ObjectExpression;
|
|
39
|
+
readonly program: Program;
|
|
34
40
|
} | {
|
|
35
41
|
readonly kind: "bail";
|
|
36
42
|
readonly reason: string;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{parseWithNitroRolldownAst}from"#internal/bundler/nitro-rolldown.js";async function parseAgentObject(e){let t;try{t=await parseWithNitroRolldownAst(`agent.ts`,e)}catch(t){let n=t;return{kind:`bail`,reason:`agent.ts does not parse: ${n.message??`unknown parse error`}`,line:parseErrorLine(e,n)}}if((t.errors?.length??0)>0){let n=t.errors?.[0];return{kind:`bail`,reason:`agent.ts does not parse: ${n?.message??`unknown parse error`}`,line:parseErrorLine(e,n)}}let n=findDefineAgentObject(t.program??t);return n===void 0?{kind:`bail`,reason:"no `export default defineAgent({ ... })` call found",line:1}:{kind:`ok`,object:n}}async function checkAgentConfigSource(e){let t=await parseAgentObject(e);return t.kind===`bail`?t.reason:void 0}function findDefineAgentObject(e){for(let t of e.body??[]){if(t.type!==`ExportDefaultDeclaration`||t.declaration==null)continue;let e=unwrapExpression(t.declaration);if(e.type!==`CallExpression`||e.callee?.type!==`Identifier`||e.callee.name!==`defineAgent`)continue;let n=e.arguments?.[0];if(n===void 0||n.type===`SpreadElement`)continue;let r=unwrapExpression(n);if(r.type===`ObjectExpression`&&r.start!==void 0&&r.end!==void 0&&r.properties!==void 0)return r}}function unwrapExpression(e){let t=e;for(;t.type===`ParenthesizedExpression`||t.type===`TSAsExpression`||t.type===`TSSatisfiesExpression`;){if(t.expression==null)return t;t=t.expression}return t}function keyMatches(e,t){return e?.type===`Identifier`?e.name===t:e?.type===`Literal`&&typeof e.value==`string`&&e.value===t}function isAstNode(e){return typeof e==`object`&&!!e&&typeof e.type==`string`}function escapeForQuote(e,t){return e.replaceAll(`\\`,`\\\\`).replaceAll(t,`\\${t}`)}function lineAt(e,t){let n=1;for(let r=0;r<t&&r<e.length;r+=1)e[r]===`
|
|
1
|
+
import{parseWithNitroRolldownAst}from"#internal/bundler/nitro-rolldown.js";async function parseAgentObject(e){let t;try{t=await parseWithNitroRolldownAst(`agent.ts`,e)}catch(t){let n=t;return{kind:`bail`,reason:`agent.ts does not parse: ${n.message??`unknown parse error`}`,line:parseErrorLine(e,n)}}if((t.errors?.length??0)>0){let n=t.errors?.[0];return{kind:`bail`,reason:`agent.ts does not parse: ${n?.message??`unknown parse error`}`,line:parseErrorLine(e,n)}}let n=findDefineAgentObject(t.program??t);return n===void 0?{kind:`bail`,reason:"no `export default defineAgent({ ... })` call found",line:1}:{kind:`ok`,object:n,program:t.program??t}}async function checkAgentConfigSource(e){let t=await parseAgentObject(e);return t.kind===`bail`?t.reason:void 0}function findDefineAgentObject(e){for(let t of e.body??[]){if(t.type!==`ExportDefaultDeclaration`||t.declaration==null)continue;let e=unwrapExpression(t.declaration);if(e.type!==`CallExpression`||e.callee?.type!==`Identifier`||e.callee.name!==`defineAgent`)continue;let n=e.arguments?.[0];if(n===void 0||n.type===`SpreadElement`)continue;let r=unwrapExpression(n);if(r.type===`ObjectExpression`&&r.start!==void 0&&r.end!==void 0&&r.properties!==void 0)return r}}function unwrapExpression(e){let t=e;for(;t.type===`ParenthesizedExpression`||t.type===`TSAsExpression`||t.type===`TSSatisfiesExpression`;){if(t.expression==null)return t;t=t.expression}return t}function keyMatches(e,t){return e?.type===`Identifier`?e.name===t:e?.type===`Literal`&&typeof e.value==`string`&&e.value===t}function isAstNode(e){return typeof e==`object`&&!!e&&typeof e.type==`string`}function escapeForQuote(e,t){return e.replaceAll(`\\`,`\\\\`).replaceAll(t,`\\${t}`)}function lineAt(e,t){let n=1;for(let r=0;r<t&&r<e.length;r+=1)e[r]===`
|
|
2
2
|
`&&(n+=1);return n}function parseErrorLine(e,t){return typeof t?.loc?.line==`number`?t.loc.line:lineAt(e,t?.labels?.[0]?.start??t?.start??0)}export{checkAgentConfigSource,escapeForQuote,isAstNode,keyMatches,lineAt,parseAgentObject,unwrapExpression};
|
|
@@ -8,5 +8,7 @@ export type SourceEdit = {
|
|
|
8
8
|
readonly reason: string;
|
|
9
9
|
readonly line: number;
|
|
10
10
|
};
|
|
11
|
-
/**
|
|
11
|
+
/** Reads only model expressions the source editor can safely rewrite. */
|
|
12
|
+
export declare function readModelSelectionFromSource(sourceText: string): Promise<string | undefined>;
|
|
13
|
+
/** Rewrites between a Gateway string model and an eve-owned model helper. */
|
|
12
14
|
export declare function applyModelSelectionToSource(sourceText: string, selection: string): Promise<SourceEdit>;
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
import{escapeForQuote,isAstNode,keyMatches,lineAt,parseAgentObject,unwrapExpression}from"./agent-config-ast.js";import{
|
|
2
|
-
`;return`${e.slice(0,r)}${i}import { chatgpt } from "eve/models/openai";${e.slice(r)}`}function removeChatGptImport(e){return e.replace(/import\s*\{([^}]*)\}\s*from\s*["']eve\/models\/openai["'];?\n?/u,(e,t)=>{let n=t.split(`,`).map(e=>e.trim()).filter(Boolean),r=n.filter(e=>e!==`chatgpt`);return r.length===n.length?e:r.length===0?``:`import { ${r.join(`, `)} } from "eve/models/openai";\n`})}export{applyModelSelectionToSource};
|
|
1
|
+
import{escapeForQuote,isAstNode,keyMatches,lineAt,parseAgentObject,unwrapExpression}from"./agent-config-ast.js";import{MODEL_HELPERS,parseModelHelper}from"#shared/model-helper.js";async function readModelSelectionFromSource(e){let t=await parseAgentObject(e);if(t.kind===`bail`)return;let n=findModelValue(t.object);return n===void 0?void 0:currentSelection(n,t.program)}async function applyModelSelectionToSource(e,t){let n=await parseAgentObject(e);if(n.kind===`bail`)return n;let r=findModelValue(n.object);if(r===void 0||r.start===void 0||r.end===void 0)return{kind:`bail`,reason:"`model` is absent or cannot be edited safely",line:lineAt(e,n.object.start)};let i=currentSelection(r,n.program);if(i===void 0)return{kind:`bail`,reason:"`model` is neither a string literal nor an eve model helper",line:lineAt(e,r.start)};let a=parseModelHelper(t);if(a){let t=a.helper;if(!hasHelperImport(n.program,t)&&hasIdentifier(n.program,t))return{kind:`bail`,reason:`Cannot safely introduce the ${t} import; that name is already used`,line:lineAt(e,r.start)}}let o=a===void 0?`${e[r.start]===`'`?`'`:`"`}${escapeForQuote(t,e[r.start]===`'`?`'`:`"`)}${e[r.start]===`'`?`'`:`"`}`:`${a.helper}(${JSON.stringify(a.id)})`,s=e.slice(0,r.start)+o+e.slice(r.end);a!==void 0&&(s=hasHelperImport(n.program,a.helper)?s:`import { ${a.helper} } from "${MODEL_HELPERS[a.helper].module}";\n${s}`);let c=parseModelHelper(i);if(c&&c.helper!==a?.helper){let e=await parseAgentObject(s),t=e.kind===`ok`?helperImport(e.program,c.helper):void 0,n=t?.start!==void 0&&t.end!==void 0?s.slice(0,t.start)+removeHelperImport(s.slice(t.start,t.end),c.helper)+s.slice(t.end):s,r=await parseAgentObject(n);r.kind===`ok`&&!hasIdentifier(r.program,c.helper)&&(s=n)}return{kind:`applied`,from:i,to:t,nextSource:s}}function findModelValue(e){for(let t of e.properties)if(t.type===`Property`&&!t.computed&&keyMatches(t.key,`model`))return isAstNode(t.value)?unwrapExpression(t.value):void 0}function currentSelection(e,t){if(e.type===`Literal`&&typeof e.value==`string`)return e.value;if(e.type!==`CallExpression`||!isAstNode(e.callee))return;let n=unwrapExpression(e.callee);if(n.type!==`Identifier`||typeof n.name!=`string`||!(n.name in MODEL_HELPERS))return;let r=n.name,i=MODEL_HELPERS[r];if(!hasHelperImport(t,r)||(e.arguments?.length??0)>1)return;let a=e.arguments?.[0];if(a===void 0)return i.prefix+i.defaultModel;if(!isAstNode(a))return;let o=unwrapExpression(a);if(o.type!==`Literal`||typeof o.value!=`string`)return;let s=o.value.trim().replace(RegExp(`^${r===`chatgpt`?`openai`:r}/`,`u`),``);return s&&!s.includes(`/`)?i.prefix+s:void 0}function helperImportPattern(e){return RegExp(`import\\s*\\{([^}]*)\\}\\s*from\\s*["']${MODEL_HELPERS[e].module}["'];?`,`u`)}function removeHelperImport(e,t){return e.replace(helperImportPattern(t),(e,n)=>{let r=n.split(`,`).map(e=>e.trim()).filter(Boolean),i=r.filter(e=>e!==t);return i.length===r.length?e:i.length===0?``:`import { ${i.join(`, `)} } from "${MODEL_HELPERS[t].module}";`})}function hasIdentifier(e,t){return typeof e!=`object`||!e?!1:isAstNode(e)&&e.type===`Identifier`&&e.name===t?!0:Object.values(e).some(e=>hasIdentifier(e,t))}function helperImport(e,t){return e.body?.find(e=>e.type===`ImportDeclaration`&&e.source?.value===MODEL_HELPERS[t].module&&e.importKind!==`type`&&e.specifiers?.some(e=>e.imported?.name===t&&e.local?.name===t&&e.importKind!==`type`))}function hasHelperImport(e,t){return helperImport(e,t)!==void 0}export{applyModelSelectionToSource,readModelSelectionFromSource};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{readFile,rename,writeFile}from"node:fs/promises";import{join}from"node:path";import{
|
|
1
|
+
import{readFile,rename,writeFile}from"node:fs/promises";import{join}from"node:path";import{applyModelSelectionToSource}from"#source-change/apply-model-selection.js";import{checkAgentConfigSource}from"#source-change/agent-config-string-path.js";import{applyAgentModelSettingsToSource}from"#source-change/apply-agent-model-settings.js";function createStaticSourceChange(e){return{updateModelName:t=>updateAgentModelName(e,t),updateModelSettings:t=>updateAgentModelSettings(e,t)}}async function updateAgentModelSettings(e,t){let n=e.configModule;if(n===void 0)return{kind:`bail`,reason:`agent has no agent.ts config module to edit`,at:{logicalPath:`agent.ts`,line:1}};let r=join(e.agentRoot,n.logicalPath),i=await readFile(r,`utf8`),a=await applyAgentModelSettingsToSource(i,t);if(a.kind===`bail`)return{kind:`bail`,reason:a.reason,at:{logicalPath:n.logicalPath,line:a.line}};let o=await editedSourceBail(i,a.nextSource,n.logicalPath);return o===void 0?(await writeSourceIfChanged(r,i,a.nextSource),{kind:`applied`,changed:a.changed}):o}async function updateAgentModelName(e,t){let n=e.configModule;if(n===void 0)return{kind:`bail`,reason:`agent has no agent.ts config module to edit`,at:{logicalPath:`agent.ts`,line:1}};let r=join(e.agentRoot,n.logicalPath),i=await readFile(r,`utf8`),a=await applyModelSelectionToSource(i,t);if(a.kind===`bail`)return{kind:`bail`,reason:a.reason,at:{logicalPath:n.logicalPath,line:a.line}};let o=await editedSourceBail(i,a.nextSource,n.logicalPath);return o===void 0?(await writeSourceIfChanged(r,i,a.nextSource),{kind:`applied`,from:a.from,to:a.to}):o}async function writeSourceIfChanged(e,t,n){if(n===t)return;let r=`${e}.${process.pid}.eve-tmp`;await writeFile(r,n,`utf8`),await rename(r,e)}async function editedSourceBail(e,t,n){if(t===e)return;let r=await checkAgentConfigSource(t);if(r!==void 0)return{kind:`bail`,reason:`the edit produced source eve refuses to write (${r})`,at:{logicalPath:n,line:1}}}export{createStaticSourceChange};
|
|
@@ -1 +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{
|
|
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{agentTurnOutcomeWithCostSchema}from"#shared/agent-turn-outcome.js";import{tokenUsageWithCostSchema}from"#shared/token-usage.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)}),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:agentTurnOutcomeWithCostSchema,output:jsonValueSchema.optional(),subagentName:z.string().min(1)}),z.object({callId:z.string().min(1),error:jsonValueSchema,kind:z.literal(`turn.failed`),outcome:agentTurnOutcomeWithCostSchema,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 r;try{r=await e.json()}catch{return Response.json({error:`Invalid JSON body.`,ok:!1},{status:400})}let i=projectTaskEvent(r,n);if(i instanceof Response)return i;if(i!==void 0){try{await resumeHook(n,i)}catch{return Response.json({error:`Session callback not pending.`,ok:!1},{status:404})}return Response.json({ok:!0},{status:202})}let a=rejectDirectTaskTurnStarted(r,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=projectSessionCallbackResult(r);if(o instanceof Response)return o;try{await resumeHook(n,{kind:`runtime-action-result`,results:[o]})}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 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=tokenUsageWithCostSchema.safeParse(e);return t.success?t.data:void 0}export{handleSessionCallbackRequest};
|
|
@@ -12,14 +12,14 @@ interface ProxySubagentEventResult {
|
|
|
12
12
|
export declare function runProxySubagentEventStep(input: {
|
|
13
13
|
readonly answerHook?: AnswerHookRoute;
|
|
14
14
|
readonly hookPayload: SubagentEventHookPayload;
|
|
15
|
-
readonly
|
|
15
|
+
readonly sessionWritable: WritableStream<Uint8Array>;
|
|
16
16
|
readonly serializedContext: Record<string, unknown>;
|
|
17
17
|
readonly sessionState: DurableSessionState;
|
|
18
18
|
}): Promise<ProxySubagentEventResult>;
|
|
19
19
|
/** Emits a task request whose proxy routes were committed by a prior step. */
|
|
20
20
|
export declare function emitRecordedTaskInputRequestStep(input: {
|
|
21
21
|
readonly request: TaskInputRequestDelivery;
|
|
22
|
-
readonly
|
|
22
|
+
readonly sessionWritable: WritableStream<Uint8Array>;
|
|
23
23
|
readonly serializedContext: Record<string, unknown>;
|
|
24
24
|
readonly sessionState: DurableSessionState;
|
|
25
25
|
}): Promise<ProxySubagentEventResult>;
|
|
@@ -29,7 +29,7 @@ export declare function emitProxiedSubagentEvent(input: {
|
|
|
29
29
|
readonly ctx: ContextContainer;
|
|
30
30
|
readonly durableSession: DurableSession;
|
|
31
31
|
readonly hookPayload: SubagentEventHookPayload;
|
|
32
|
-
readonly
|
|
32
|
+
readonly sessionWritable: WritableStream<Uint8Array>;
|
|
33
33
|
readonly recordProxyInputRequests?: boolean;
|
|
34
34
|
}): Promise<ProxySubagentEventResult>;
|
|
35
35
|
export {};
|
|
@@ -1 +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{resolveEffectiveAgentRuntime}from"#execution/effective-agent-config.js";import{hydrateDurableSession}from"#execution/session.js";import{buildAdapterContext}from"#channel/adapter-context.js";import{withContextScope}from"#context/run-step.js";import{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=
|
|
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{resolveEffectiveAgentRuntime}from"#execution/effective-agent-config.js";import{hydrateDurableSession}from"#execution/session.js";import{buildAdapterContext}from"#channel/adapter-context.js";import{withContextScope}from"#context/run-step.js";import{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=readDurableSession(e.sessionState),n=await deserializeContext(e.serializedContext);return emitProxiedSubagentEvent({answerHook:e.answerHook,ctx:n,durableSession:t,hookPayload:e.hookPayload,sessionWritable:e.sessionWritable})}async function emitRecordedTaskInputRequestStep(e){"use step";let t=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},sessionWritable:e.sessionWritable,recordProxyInputRequests:!1})}async function emitProxiedSubagentEvent(e){let{ctx:t}=e,n=t.require(ChannelKey),r=t.require(BundleKey),i=resolveEffectiveAgentRuntime(r,t),a=hydrateDurableSession({compactionOverrides:{thresholdPercent:i.thresholdPercent},durable:e.durableSession,turnAgent:i.turnAgent}),o=buildAdapterContext(n,t),s=e.sessionWritable.getWriter(),c,l;try{let emit=async e=>{let t=await callAdapterEventHandler(n,e,o);await s.write(encodeMessageStreamEvent(stampMessageStreamEvent(t)))},r=await withContextScope(t,a,async n=>{if(e.hookPayload.kind===`subagent-authorization-event`)return await emit(e.hookPayload.event),{result:void 0,session:await closeStandaloneAuthorizationEvent({emit,eventType:e.hookPayload.event.type,mode:t.require(ModeKey),session:n})};let r=await emitProxiedInputRequest({emit,hookPayload:e.hookPayload,mode:t.require(ModeKey),session:n});return{result:r.entries,session:r.session}});c=r.result,l=r.session}finally{s.releaseLock()}if(setChannelContext(t,{...n,state:{...o.state}}),e.recordProxyInputRequests!==!1&&c!==void 0&&e.hookPayload.kind===`subagent-input-request`){let t=e.answerHook;l=upsertProxyInputRequests({entries:t===void 0?c:c.map(([e,n])=>[e,{...n,answerHook:t}]),forChildContinuationToken:e.hookPayload.childContinuationToken,session:l})}let u=reconcileSessionContinuationToken(t,l);return{serializedContext:serializeContext(t),sessionState:createDurableSessionState({session:u})}}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};
|
|
@@ -35,6 +35,17 @@ export type DispatchOutcome = {
|
|
|
35
35
|
readonly result: RuntimeSubagentDispatchFailure;
|
|
36
36
|
readonly session: RuntimeSession;
|
|
37
37
|
};
|
|
38
|
+
/**
|
|
39
|
+
* Where the callee reports its result. A new turn replies to the caller's
|
|
40
|
+
* hook; steering an active turn keeps that turn's original reply target.
|
|
41
|
+
*/
|
|
42
|
+
export type AgentReplyTarget = {
|
|
43
|
+
readonly kind: "reply";
|
|
44
|
+
readonly parentToken: string;
|
|
45
|
+
readonly taskId?: string;
|
|
46
|
+
} | {
|
|
47
|
+
readonly kind: "steer";
|
|
48
|
+
};
|
|
38
49
|
/** Delivers a continuation after the session handle store atomically claimed it for one owner. */
|
|
39
50
|
export declare function dispatchToClaimedAgentAddress(input: {
|
|
40
51
|
readonly activityObserver?: ActivityObserverConfig;
|
|
@@ -42,11 +53,10 @@ export declare function dispatchToClaimedAgentAddress(input: {
|
|
|
42
53
|
readonly auth: SessionAuthContext | null;
|
|
43
54
|
readonly bundle: CompiledBundle;
|
|
44
55
|
readonly currentSession: RuntimeSession;
|
|
45
|
-
readonly parentToken: string;
|
|
46
56
|
readonly handle: Extract<TaskOwnedAgentHandle, {
|
|
47
57
|
phase: "claimed";
|
|
48
58
|
}>;
|
|
49
|
-
readonly
|
|
59
|
+
readonly reply: AgentReplyTarget;
|
|
50
60
|
}): Promise<DispatchOutcome>;
|
|
51
61
|
export declare function createAgentErrorResult(input: {
|
|
52
62
|
readonly action: RuntimeAgentHandleAction;
|