eve 0.36.0 → 0.37.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +29 -0
- package/README.md +1 -0
- package/dist/src/channel/routes.d.ts +13 -3
- package/dist/src/channel/routes.js +1 -1
- package/dist/src/channel/session-callback.js +1 -1
- package/dist/src/channel/session.d.ts +2 -1
- package/dist/src/channel/session.js +1 -1
- package/dist/src/channel/types.d.ts +41 -0
- package/dist/src/chunks/{use-eve-agent-CnppTEFk.js → use-eve-agent-Bi5fRxcZ.js} +9 -1
- package/dist/src/chunks/{use-eve-agent-COmP-H8R.js → use-eve-agent-DbKUBhl-.js} +9 -1
- package/dist/src/cli/commands/agent-instructions.d.ts +4 -4
- package/dist/src/cli/commands/init-confirm.d.ts +12 -0
- package/dist/src/cli/commands/init-confirm.js +1 -0
- package/dist/src/cli/commands/init-git.js +1 -1
- package/dist/src/cli/commands/init-recovery.d.ts +3 -0
- package/dist/src/cli/commands/init-recovery.js +3 -0
- package/dist/src/cli/commands/init-target.d.ts +21 -0
- package/dist/src/cli/commands/init-target.js +1 -0
- package/dist/src/cli/commands/init.d.ts +6 -5
- package/dist/src/cli/commands/init.js +1 -1
- package/dist/src/cli/dev/tui/runner.d.ts +8 -0
- package/dist/src/cli/dev/tui/runner.js +1 -1
- package/dist/src/cli/dev/tui/subagent-pump.d.ts +27 -22
- package/dist/src/cli/dev/tui/subagent-pump.js +1 -1
- package/dist/src/cli/dev/tui/terminal-renderer.d.ts +16 -0
- package/dist/src/cli/dev/tui/terminal-renderer.js +12 -12
- package/dist/src/cli/dev/tui/tool-presentation.js +1 -1
- package/dist/src/cli/run.d.ts +1 -0
- package/dist/src/cli/run.js +3 -3
- package/dist/src/client/open-stream.d.ts +2 -0
- package/dist/src/client/open-stream.js +1 -1
- package/dist/src/client/session.js +1 -1
- package/dist/src/compiled/.vendor-stamp.json +3 -1
- package/dist/src/compiled/@modelcontextprotocol/server/LICENSE +216 -0
- package/dist/src/compiled/@modelcontextprotocol/server/index.d.ts +98 -0
- package/dist/src/compiled/@modelcontextprotocol/server/index.js +80 -0
- package/dist/src/compiled/@vercel/sandbox/api-client/api-client.d.ts +339 -0
- package/dist/src/compiled/@vercel/sandbox/api-client/index.d.ts +1 -1
- package/dist/src/compiled/@vercel/sandbox/api-client/validators.d.ts +25 -1
- package/dist/src/compiled/@vercel/sandbox/drive.d.ts +140 -0
- package/dist/src/compiled/@vercel/sandbox/index.d.ts +3 -2
- package/dist/src/compiled/@vercel/sandbox/index.js +13 -13
- package/dist/src/compiled/@vercel/sandbox/sandbox.d.ts +55 -18
- package/dist/src/compiled/@vercel/sandbox-stable/LICENSE +201 -0
- package/dist/src/compiled/@vercel/sandbox-stable/_async-retry.d.ts +8 -0
- package/dist/src/compiled/@vercel/sandbox-stable/_workflow-serde.d.ts +5 -0
- package/dist/src/compiled/@vercel/sandbox-stable/api-client/api-client.d.ts +1456 -0
- package/dist/src/compiled/@vercel/sandbox-stable/api-client/api-error.d.ts +29 -0
- package/dist/src/compiled/@vercel/sandbox-stable/api-client/base-client.d.ts +39 -0
- package/dist/src/compiled/@vercel/sandbox-stable/api-client/file-writer.d.ts +66 -0
- package/dist/src/compiled/@vercel/sandbox-stable/api-client/index.d.ts +2 -0
- package/dist/src/compiled/@vercel/sandbox-stable/api-client/validators.d.ts +899 -0
- package/dist/src/compiled/@vercel/sandbox-stable/api-client/with-retry.d.ts +10 -0
- package/dist/src/compiled/@vercel/sandbox-stable/auth/error.d.ts +15 -0
- package/dist/src/compiled/@vercel/sandbox-stable/auth/file.d.ts +18 -0
- package/dist/src/compiled/@vercel/sandbox-stable/auth/index.d.ts +6 -0
- package/dist/src/compiled/@vercel/sandbox-stable/auth/oauth.d.ts +111 -0
- package/dist/src/compiled/@vercel/sandbox-stable/auth/poll-for-token.d.ts +28 -0
- package/dist/src/compiled/@vercel/sandbox-stable/auth/project.d.ts +40 -0
- package/dist/src/compiled/@vercel/sandbox-stable/command.d.ts +292 -0
- package/dist/src/compiled/@vercel/sandbox-stable/constants.d.ts +5 -0
- package/dist/src/compiled/@vercel/sandbox-stable/execution-context.d.ts +116 -0
- package/dist/src/compiled/@vercel/sandbox-stable/filesystem.d.ts +258 -0
- package/dist/src/compiled/@vercel/sandbox-stable/index.d.ts +12 -0
- package/dist/src/compiled/@vercel/sandbox-stable/index.js +1 -0
- package/dist/src/compiled/@vercel/sandbox-stable/network-policy.d.ts +169 -0
- package/dist/src/compiled/@vercel/sandbox-stable/proxy.d.ts +55 -0
- package/dist/src/compiled/@vercel/sandbox-stable/sandbox-user.d.ts +212 -0
- package/dist/src/compiled/@vercel/sandbox-stable/sandbox.d.ts +1216 -0
- package/dist/src/compiled/@vercel/sandbox-stable/session.d.ts +433 -0
- package/dist/src/compiled/@vercel/sandbox-stable/snapshot.d.ts +229 -0
- package/dist/src/compiled/@vercel/sandbox-stable/utils/get-credentials.d.ts +21 -0
- package/dist/src/compiled/@vercel/sandbox-stable/utils/paginator.d.ts +16 -0
- package/dist/src/compiled/@vercel/sandbox-stable/utils/resolveSignal.d.ts +15 -0
- package/dist/src/compiled/@vercel/sandbox-stable/utils/sandbox-snapshot.d.ts +11 -0
- package/dist/src/compiled/@vercel/sandbox-stable/utils/types.d.ts +11 -0
- package/dist/src/compiled/_chunks/node/{auth-BS3UoyvT.js → auth-BaNbsImr.js} +1 -1
- package/dist/src/compiled/_chunks/node/version-BYHw-SDY.js +1 -0
- package/dist/src/compiler/extension-compatibility.d.ts +10 -10
- package/dist/src/compiler/extension-compatibility.js +1 -1
- package/dist/src/compiler/manifest.js +1 -1
- package/dist/src/compiler/normalize-agent-config.js +1 -1
- package/dist/src/compiler/normalize-manifest.js +1 -1
- package/dist/src/compiler/normalize-subagent.d.ts +1 -1
- package/dist/src/compiler/normalize-subagent.js +1 -1
- package/dist/src/context/serialized-dynamic-model-selection.d.ts +2 -0
- package/dist/src/context/serialized-dynamic-model-selection.js +1 -0
- package/dist/src/execution/agent-handle-dispatch.d.ts +15 -1
- package/dist/src/execution/agent-handle-dispatch.js +1 -1
- package/dist/src/execution/cancel-descendant-turns-step.js +1 -1
- package/dist/src/execution/delegated-parent-notification.d.ts +17 -0
- package/dist/src/execution/delegated-parent-notification.js +1 -1
- package/dist/src/execution/deliver-payloads.js +1 -1
- package/dist/src/execution/dispatch-runtime-actions-shared.d.ts +155 -0
- package/dist/src/execution/dispatch-runtime-actions-shared.js +1 -0
- package/dist/src/execution/dispatch-runtime-actions-step.d.ts +18 -14
- package/dist/src/execution/dispatch-runtime-actions-step.js +1 -1
- package/dist/src/execution/dispatch-workflow-runtime-actions-step.d.ts +7 -2
- package/dist/src/execution/dispatch-workflow-runtime-actions-step.js +1 -1
- package/dist/src/execution/effective-output-schema.d.ts +21 -0
- package/dist/src/execution/effective-output-schema.js +1 -0
- package/dist/src/execution/eve-workflow-attributes.d.ts +2 -0
- package/dist/src/execution/node-step.js +1 -1
- package/dist/src/execution/parked-delivery-wait.d.ts +8 -12
- package/dist/src/execution/parked-delivery-wait.js +1 -1
- package/dist/src/execution/{route-proxied-deliver-step.d.ts → proxied-deliver-step.d.ts} +7 -4
- package/dist/src/execution/proxied-deliver-step.js +1 -0
- package/dist/src/execution/remote-agent-dispatch.d.ts +32 -0
- package/dist/src/execution/remote-agent-dispatch.js +1 -1
- package/dist/src/execution/remote-agent-route-url.d.ts +2 -0
- package/dist/src/execution/remote-agent-route-url.js +1 -0
- package/dist/src/execution/route-child-delivery.d.ts +2 -1
- package/dist/src/execution/route-child-delivery.js +1 -1
- package/dist/src/execution/sandbox/bindings/vercel.d.ts +2 -1
- package/dist/src/execution/sandbox/bindings/vercel.js +1 -1
- package/dist/src/execution/session-callback-step.d.ts +11 -0
- package/dist/src/execution/session-callback-step.js +1 -1
- package/dist/src/execution/session-command-wire.js +1 -1
- package/dist/src/execution/session-state-cursor.d.ts +25 -0
- package/dist/src/execution/session-state-cursor.js +1 -0
- package/dist/src/execution/settle-cancelled-turn-step.d.ts +2 -0
- package/dist/src/execution/settle-cancelled-turn-step.js +1 -1
- package/dist/src/execution/subagent-event-proxy-step.d.ts +15 -0
- package/dist/src/execution/subagent-event-proxy-step.js +1 -1
- package/dist/src/execution/subagent-hitl-proxy.d.ts +14 -7
- package/dist/src/execution/subagent-hitl-proxy.js +1 -1
- package/dist/src/execution/subagent-start-local.d.ts +29 -0
- package/dist/src/execution/subagent-start-local.js +1 -0
- package/dist/src/execution/subagent-start-remote.d.ts +23 -0
- package/dist/src/execution/subagent-start-remote.js +1 -0
- package/dist/src/execution/task-event-callback.d.ts +13 -0
- package/dist/src/execution/task-event-callback.js +1 -0
- package/dist/src/execution/task-input-capability.d.ts +4 -0
- package/dist/src/execution/task-input-capability.js +1 -0
- package/dist/src/execution/tasks/child/steps.d.ts +46 -0
- package/dist/src/execution/tasks/child/steps.js +1 -0
- package/dist/src/execution/tasks/child/workflow.d.ts +31 -0
- package/dist/src/execution/tasks/child/workflow.js +1 -0
- package/dist/src/execution/tasks/parent/agent-identity.d.ts +13 -0
- package/dist/src/execution/tasks/parent/agent-identity.js +1 -0
- package/dist/src/execution/tasks/parent/agent-views.d.ts +6 -0
- package/dist/src/execution/tasks/parent/agent-views.js +1 -0
- package/dist/src/execution/tasks/parent/continuation-dispatch.d.ts +37 -0
- package/dist/src/execution/tasks/parent/continuation-dispatch.js +1 -0
- package/dist/src/execution/tasks/parent/control-shared.d.ts +36 -0
- package/dist/src/execution/tasks/parent/control-shared.js +1 -0
- package/dist/src/execution/tasks/parent/delegate.d.ts +70 -0
- package/dist/src/execution/tasks/parent/delegate.js +1 -0
- package/dist/src/execution/tasks/parent/dispatch-task-step.d.ts +19 -0
- package/dist/src/execution/tasks/parent/dispatch-task-step.js +1 -0
- package/dist/src/execution/tasks/parent/dispatch.d.ts +33 -0
- package/dist/src/execution/tasks/parent/dispatch.js +1 -0
- package/dist/src/execution/tasks/parent/hitl-proxy-steps.d.ts +29 -0
- package/dist/src/execution/tasks/parent/hitl-proxy-steps.js +1 -0
- package/dist/src/execution/tasks/parent/run-parent.d.ts +72 -0
- package/dist/src/execution/tasks/parent/run-parent.js +1 -0
- package/dist/src/execution/tasks/parent/send.d.ts +25 -0
- package/dist/src/execution/tasks/parent/send.js +1 -0
- package/dist/src/execution/tasks/workflow-target.d.ts +2 -0
- package/dist/src/execution/tasks/workflow-target.js +1 -0
- package/dist/src/execution/terminate-child-sessions-step.d.ts +1 -0
- package/dist/src/execution/terminate-child-sessions-step.js +1 -1
- package/dist/src/execution/turn-control-receiver.d.ts +10 -0
- package/dist/src/execution/turn-control-receiver.js +1 -1
- package/dist/src/execution/turn-dispatch.d.ts +2 -0
- package/dist/src/execution/turn-dispatch.js +1 -1
- package/dist/src/execution/turn-execution-cursor.d.ts +2 -8
- package/dist/src/execution/turn-execution-cursor.js +1 -1
- package/dist/src/execution/turn-workflow.js +1 -1
- package/dist/src/execution/workflow-callback-url.d.ts +5 -0
- package/dist/src/execution/workflow-callback-url.js +1 -1
- package/dist/src/execution/workflow-entry.js +1 -1
- package/dist/src/execution/workflow-runtime.d.ts +9 -0
- package/dist/src/execution/workflow-runtime.js +1 -1
- package/dist/src/execution/workflow-steps.d.ts +7 -21
- package/dist/src/execution/workflow-steps.js +1 -1
- package/dist/src/harness/advertised-tools.js +1 -1
- package/dist/src/harness/authorization.js +1 -1
- package/dist/src/harness/execute-tool.d.ts +7 -0
- package/dist/src/harness/handles/prompt.d.ts +12 -0
- package/dist/src/harness/handles/prompt.js +2 -1
- package/dist/src/harness/handles/query.js +1 -1
- package/dist/src/harness/handles/store.d.ts +9 -2
- package/dist/src/harness/handles/store.js +1 -1
- package/dist/src/harness/handles/transitions.d.ts +10 -1
- package/dist/src/harness/handles/transitions.js +1 -1
- package/dist/src/harness/proxy-input-requests.d.ts +21 -4
- package/dist/src/harness/proxy-input-requests.js +1 -1
- package/dist/src/harness/runtime-actions.d.ts +2 -0
- package/dist/src/harness/runtime-actions.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/workflow-runtime-action-state.js +1 -1
- package/dist/src/internal/application/package.js +1 -1
- package/dist/src/internal/authored-definition/core.js +1 -1
- package/dist/src/internal/invocation/agent-invocation.d.ts +54 -0
- package/dist/src/internal/invocation/agent-invocation.js +1 -0
- package/dist/src/internal/invocation/attributes.d.ts +2 -0
- package/dist/src/internal/invocation/attributes.js +1 -0
- package/dist/src/internal/invocation/metadata.d.ts +9 -0
- package/dist/src/internal/invocation/metadata.js +1 -0
- package/dist/src/internal/invocation/workflow-execution.d.ts +32 -0
- package/dist/src/internal/invocation/workflow-execution.js +1 -0
- package/dist/src/internal/mcp/http-security.d.ts +12 -0
- package/dist/src/internal/mcp/http-security.js +1 -0
- package/dist/src/internal/mcp/protected-resource.d.ts +9 -0
- package/dist/src/internal/mcp/protected-resource.js +1 -0
- package/dist/src/internal/mcp/streamable-http-server.d.ts +51 -0
- package/dist/src/internal/mcp/streamable-http-server.js +1 -0
- package/dist/src/internal/nitro/routes/channel-dispatch.js +1 -1
- package/dist/src/internal/nitro/routes/channel-route-context.d.ts +14 -0
- package/dist/src/internal/nitro/routes/channel-route-context.js +1 -1
- package/dist/src/internal/nitro/routes/runtime-stack.d.ts +2 -0
- package/dist/src/internal/nitro/routes/runtime-stack.js +1 -1
- package/dist/src/internal/vercel-agent-summary.d.ts +1 -1
- package/dist/src/packages/eve-catalog/src/index.js +1 -1
- package/dist/src/protocol/message.d.ts +28 -0
- package/dist/src/protocol/message.js +2 -2
- package/dist/src/protocol/routes.d.ts +14 -0
- package/dist/src/protocol/routes.js +1 -1
- package/dist/src/public/channels/auth.d.ts +36 -0
- package/dist/src/public/channels/auth.js +1 -1
- package/dist/src/public/channels/eve.js +1 -1
- package/dist/src/public/channels/mcp.d.ts +19 -0
- package/dist/src/public/channels/mcp.js +1 -0
- package/dist/src/public/definitions/channel.d.ts +2 -2
- package/dist/src/public/definitions/channel.js +1 -1
- package/dist/src/public/sandbox/backends/vercel.d.ts +5 -4
- package/dist/src/public/sandbox/backends/vercel.js +1 -1
- package/dist/src/public/sandbox/vercel-sandbox.d.ts +25 -1
- package/dist/src/public/sandbox/vercel.d.ts +2 -1
- package/dist/src/public/sandbox/vercel.js +1 -1
- package/dist/src/react/use-eve-agent.js +1 -1
- package/dist/src/runtime/actions/types.d.ts +9 -0
- package/dist/src/runtime/actions/types.js +1 -1
- package/dist/src/runtime/agent/bootstrap.js +1 -1
- package/dist/src/runtime/connections/authorization-complete-page.js +70 -28
- package/dist/src/runtime/framework-channels/index.js +1 -1
- package/dist/src/runtime/framework-tools/index.js +1 -1
- package/dist/src/runtime/framework-tools/tasks.d.ts +95 -0
- package/dist/src/runtime/framework-tools/tasks.js +1 -0
- package/dist/src/runtime/prompt/compose.d.ts +1 -0
- package/dist/src/runtime/prompt/compose.js +1 -1
- package/dist/src/runtime/resolve-agent-graph.js +1 -1
- package/dist/src/runtime/resolve-agent.js +1 -1
- package/dist/src/runtime/session-callback-route.js +1 -1
- package/dist/src/runtime/task-input-response-route.d.ts +5 -0
- package/dist/src/runtime/task-input-response-route.js +1 -0
- package/dist/src/setup/scaffold/create/add-to-project.js +1 -1
- package/dist/src/setup/scaffold/create/project.js +1 -1
- package/dist/src/setup/scaffold/create/web-template.d.ts +1 -1
- package/dist/src/setup/scaffold/create/web-template.js +0 -1
- package/dist/src/shared/agent-definition.d.ts +7 -0
- package/dist/src/shared/sandbox-network-policy.d.ts +1 -1
- package/dist/src/svelte/index.js +1 -1
- package/dist/src/svelte/use-eve-agent.js +1 -1
- package/dist/src/tasks/json.d.ts +88 -0
- package/dist/src/tasks/json.js +1 -0
- package/dist/src/tasks/session-index.d.ts +48 -0
- package/dist/src/tasks/session-index.js +1 -0
- package/dist/src/tasks/task-id.d.ts +34 -0
- package/dist/src/tasks/task-id.js +1 -0
- package/dist/src/tasks/transitions.d.ts +23 -0
- package/dist/src/tasks/transitions.js +1 -0
- package/dist/src/tasks/types.d.ts +295 -0
- package/dist/src/tasks/types.js +1 -0
- package/dist/src/tasks/wire.d.ts +26 -0
- package/dist/src/tasks/wire.js +1 -0
- package/dist/src/vue/index.js +1 -1
- package/dist/src/vue/use-eve-agent.js +1 -1
- package/docs/channels/eve.mdx +14 -0
- package/docs/guides/client/streaming.mdx +1 -1
- package/docs/reference/cli.md +10 -6
- package/docs/tools/human-in-the-loop.md +3 -1
- package/package.json +8 -1
- package/dist/src/compiled/_chunks/node/version-Cztrk7z6.js +0 -1
- package/dist/src/execution/route-proxied-deliver-step.js +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,34 @@
|
|
|
1
1
|
# eve
|
|
2
2
|
|
|
3
|
+
## 0.37.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 8bf1e5b: Render background subagent activity in one persistent dev TUI section across parent turns. Idle task wakes render while the prompt remains active, remote child streams use the authenticated parent proxy, and child boundaries finalize sections without later-turn cancellation closing unrelated background work.
|
|
8
|
+
- 046981e: Add experimental background tasks for local and remote subagents. With `experimental.tasks` enabled, subagent calls return durable task receipts; parents can inspect, continue, or cancel work while lifecycle notifications and human-input requests arrive asynchronously. Remote child streams are exposed through an authenticated parent-origin proxy so clients never receive remote credentials.
|
|
9
|
+
- d8cef1a: Scope create-once operations to the effective forwarded principal so two forwarded users behind the same trusted forwarder cannot adopt each other's session.
|
|
10
|
+
- 5d12328: Preserve a session-scoped dynamic model selection when the first turn is cancelled so later turns can reuse it without requiring a `turn.started` resolver.
|
|
11
|
+
- 10a09a1: Make failed `eve init` runs recoverable: new targets are cleaned up, preexisting empty targets are restored, and existing projects receive clear dependency-install recovery guidance.
|
|
12
|
+
- 8bf1e5b: The dev TUI now presents and routes approval or question prompts raised by background tasks while the parent session is idle, instead of leaving the task blocked.
|
|
13
|
+
- 046981e: Preserve remote task HITL response routes for loopback HTTP children and Vercel deployments configured with Protection Bypass for Automation. HTTPS remains required for every non-loopback remote child.
|
|
14
|
+
- 63726db: Polish the connection authorization completion page with a Vercel-styled success state.
|
|
15
|
+
- d8cef1a: Add authenticated create-once session requests through `operationId`. Concurrent or retried creates adopt the active session that first claimed the operation without dispatching duplicate input.
|
|
16
|
+
- 5ba9749: Add a secure MCP channel that reuses eve route auth and lets clients start, inspect, update, authorize, and cancel principal-bound durable agent invocations over MCP 2026-07-28 with a stateless 2025 compatibility path.
|
|
17
|
+
- 60e87ef: Keep active client turns connected while they are paused for authorization so responses resume automatically after the callback completes.
|
|
18
|
+
|
|
19
|
+
## 0.37.0
|
|
20
|
+
|
|
21
|
+
### Minor Changes
|
|
22
|
+
|
|
23
|
+
- fe691aa: Expose Vercel Sandbox Drives and allow authors to mount them when creating live session sandboxes.
|
|
24
|
+
|
|
25
|
+
### Patch Changes
|
|
26
|
+
|
|
27
|
+
- d0bb6af: Fix Sign in with Vercel Web Chat projects failing to load user-scoped Vercel Connect tools because the generated channel used a reserved issuer.
|
|
28
|
+
- 7ab7d97: Running eve without a command now initializes the current directory when no eve project is present, and starts development when one is detected.
|
|
29
|
+
- c77c661: `eve init` now asks whether to scaffold a non-empty current directory in place or create a named subdirectory. In-place scaffolds preserve unrelated files and overwrite generated paths; coding-agent and non-interactive launches must pass an explicit directory name.
|
|
30
|
+
- 456c0a5: `eve init` now scaffolds the current directory when no target is provided, including when launched by a coding agent.
|
|
31
|
+
|
|
3
32
|
## 0.36.0
|
|
4
33
|
|
|
5
34
|
### Minor Changes
|
package/README.md
CHANGED
|
@@ -133,6 +133,7 @@ project or deploy the agent.
|
|
|
133
133
|
|
|
134
134
|
CLI commands:
|
|
135
135
|
|
|
136
|
+
- `eve` (including `npx eve`) — initialize the current directory, or start development in an eve project
|
|
136
137
|
- `eve init <name>` — create a new agent
|
|
137
138
|
- `eve info` — discovery results and compiled artifacts
|
|
138
139
|
- `eve build` — compile `.eve/` and build the host output
|
|
@@ -149,9 +149,9 @@ export interface WebSocketRouteDefinition<TState = undefined> {
|
|
|
149
149
|
}
|
|
150
150
|
/**
|
|
151
151
|
* A single channel route: either an {@link HttpRouteDefinition} or a
|
|
152
|
-
* {@link WebSocketRouteDefinition}. Produced by the {@link GET}, {@link
|
|
153
|
-
* {@link PUT}, {@link PATCH}, {@link DELETE},
|
|
154
|
-
* in a channel's `routes` array.
|
|
152
|
+
* {@link WebSocketRouteDefinition}. Produced by the {@link GET}, {@link HEAD},
|
|
153
|
+
* {@link POST}, {@link PUT}, {@link PATCH}, {@link DELETE}, {@link OPTIONS},
|
|
154
|
+
* and {@link WS} helpers and listed in a channel's `routes` array.
|
|
155
155
|
*/
|
|
156
156
|
export type RouteDefinition<TState = undefined> = HttpRouteDefinition<TState> | WebSocketRouteDefinition<TState>;
|
|
157
157
|
/**
|
|
@@ -159,6 +159,11 @@ export type RouteDefinition<TState = undefined> = HttpRouteDefinition<TState> |
|
|
|
159
159
|
* receives the `Request` and {@link RouteHandlerArgs}.
|
|
160
160
|
*/
|
|
161
161
|
export declare function GET<TState = undefined>(path: string, handler: RouteHandler<TState>): HttpRouteDefinition<TState>;
|
|
162
|
+
/**
|
|
163
|
+
* Declares an HTTP `HEAD` route at `path`. See {@link GET} for the handler
|
|
164
|
+
* contract.
|
|
165
|
+
*/
|
|
166
|
+
export declare function HEAD<TState = undefined>(path: string, handler: RouteHandler<TState>): HttpRouteDefinition<TState>;
|
|
162
167
|
/**
|
|
163
168
|
* Declares an HTTP `POST` route at `path`. See {@link GET} for the handler
|
|
164
169
|
* contract.
|
|
@@ -179,6 +184,11 @@ export declare function PATCH<TState = undefined>(path: string, handler: RouteHa
|
|
|
179
184
|
* contract.
|
|
180
185
|
*/
|
|
181
186
|
export declare function DELETE<TState = undefined>(path: string, handler: RouteHandler<TState>): HttpRouteDefinition<TState>;
|
|
187
|
+
/**
|
|
188
|
+
* Declares an HTTP `OPTIONS` route at `path`. See {@link GET} for the handler
|
|
189
|
+
* contract.
|
|
190
|
+
*/
|
|
191
|
+
export declare function OPTIONS<TState = undefined>(path: string, handler: RouteHandler<TState>): HttpRouteDefinition<TState>;
|
|
182
192
|
/**
|
|
183
193
|
* Declares a WebSocket channel route.
|
|
184
194
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function GET(e,t){return{transport:`http`,method:`GET`,path:e,handler:t}}function POST(e,t){return{transport:`http`,method:`POST`,path:e,handler:t}}function PUT(e,t){return{transport:`http`,method:`PUT`,path:e,handler:t}}function PATCH(e,t){return{transport:`http`,method:`PATCH`,path:e,handler:t}}function DELETE(e,t){return{transport:`http`,method:`DELETE`,path:e,handler:t}}function WS(e,t){return{transport:`websocket`,method:`WEBSOCKET`,path:e,handler:t}}function isHttpRouteDefinition(e){return e.transport!==`websocket`}function isWebSocketRouteDefinition(e){return e.transport===`websocket`}export{DELETE,GET,PATCH,POST,PUT,WS,isHttpRouteDefinition,isWebSocketRouteDefinition};
|
|
1
|
+
function GET(e,t){return{transport:`http`,method:`GET`,path:e,handler:t}}function HEAD(e,t){return{transport:`http`,method:`HEAD`,path:e,handler:t}}function POST(e,t){return{transport:`http`,method:`POST`,path:e,handler:t}}function PUT(e,t){return{transport:`http`,method:`PUT`,path:e,handler:t}}function PATCH(e,t){return{transport:`http`,method:`PATCH`,path:e,handler:t}}function DELETE(e,t){return{transport:`http`,method:`DELETE`,path:e,handler:t}}function OPTIONS(e,t){return{transport:`http`,method:`OPTIONS`,path:e,handler:t}}function WS(e,t){return{transport:`websocket`,method:`WEBSOCKET`,path:e,handler:t}}function isHttpRouteDefinition(e){return e.transport!==`websocket`}function isWebSocketRouteDefinition(e){return e.transport===`websocket`}export{DELETE,GET,HEAD,OPTIONS,PATCH,POST,PUT,WS,isHttpRouteDefinition,isWebSocketRouteDefinition};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{z}from"#compiled/zod/index.js";import{createEveCallbackRoutePath}from"#protocol/routes.js";import{isReservedIpAddress}from"#shared/network-address.js";const sessionCallbackSchema=z.object({callId:z.string().min(1),subagentName:z.string().min(1),token:z.string().min(1),url:z.string().min(1)}).strict().superRefine((e,t)=>{let r;try{r=new URL(e.url)}catch{t.addIssue({code:`custom`,message:`Callback url must be absolute.`,path:[`url`]});return}readCallbackUrlToken(r)!==e.token&&t.addIssue({code:`custom`,message:`Callback url token must match callback token.`,path:[`url`]}),isReservedIpAddress(r.hostname)&&t.addIssue({code:`custom`,message:`Callback url host must not be a private or reserved address.`,path:[`url`]})});function parseSessionCallback(e){let t=sessionCallbackSchema.safeParse(e);return t.success?{callback:t.data,ok:!0}:{cause:t.error,message:formatSessionCallbackParseError(t.error),ok:!1}}function readCallbackUrlToken(e){let n=createEveCallbackRoutePath(``),r=e.pathname.lastIndexOf(n);if(r===-1)return null;let i=e.pathname.slice(r+n.length);if(i.length===0||i.includes(`/`))return null;try{return decodeURIComponent(i)}catch{return null}}function formatSessionCallbackParseError(e){return`Invalid callback metadata: ${e.issues.map(e=>`${e.path.length===0?`callback`:`callback.${e.path.join(`.`)}`}: ${e.message}`).join(`; `)}`}export{parseSessionCallback};
|
|
1
|
+
import{z}from"#compiled/zod/index.js";import{createEveCallbackRoutePath}from"#protocol/routes.js";import{isReservedIpAddress}from"#shared/network-address.js";const sessionCallbackSchema=z.object({callId:z.string().min(1),subagentName:z.string().min(1),taskId:z.string().min(1).optional(),token:z.string().min(1),url:z.string().min(1)}).strict().superRefine((e,t)=>{let r;try{r=new URL(e.url)}catch{t.addIssue({code:`custom`,message:`Callback url must be absolute.`,path:[`url`]});return}readCallbackUrlToken(r)!==e.token&&t.addIssue({code:`custom`,message:`Callback url token must match callback token.`,path:[`url`]}),isReservedIpAddress(r.hostname)&&t.addIssue({code:`custom`,message:`Callback url host must not be a private or reserved address.`,path:[`url`]})});function parseSessionCallback(e){let t=sessionCallbackSchema.safeParse(e);return t.success?{callback:t.data,ok:!0}:{cause:t.error,message:formatSessionCallbackParseError(t.error),ok:!1}}function readCallbackUrlToken(e){let n=createEveCallbackRoutePath(``),r=e.pathname.lastIndexOf(n);if(r===-1)return null;let i=e.pathname.slice(r+n.length);if(i.length===0||i.includes(`/`))return null;try{return decodeURIComponent(i)}catch{return null}}function formatSessionCallbackParseError(e){return`Invalid callback metadata: ${e.issues.map(e=>`${e.path.length===0?`callback`:`callback.${e.path.join(`.`)}`}: ${e.message}`).join(`; `)}`}export{parseSessionCallback};
|
|
@@ -13,8 +13,9 @@ export interface Session {
|
|
|
13
13
|
send(message: string | UserContent, options: SessionSendOptions): Promise<SessionSendCommandResult>;
|
|
14
14
|
/** Answers pending input requests on this exact session ID. */
|
|
15
15
|
respond(inputResponses: readonly InputResponse[], options: SessionRespondOptions): Promise<SessionSendCommandResult>;
|
|
16
|
-
/** Requests cancellation of this exact session's active turn. */
|
|
16
|
+
/** Requests cancellation of this exact session's active turn or one owned task. */
|
|
17
17
|
cancel(options?: {
|
|
18
|
+
taskId?: string;
|
|
18
19
|
turnId?: string;
|
|
19
20
|
}): Promise<CancelTurnResult>;
|
|
20
21
|
/** Queues compaction on this exact session ID. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{createChannelDeliveryMetadata}from"#channel/delivery-metadata.js";import{serializeUrlFilePartsInMessage}from"#channel/send-input.js";import{DEFAULT_TURN_POLICY}from"#channel/types.js";import{AuthKey,ContinuationTokenKey,InitiatorAuthKey,SessionIdKey}from"#context/keys.js";import{toChannelLocalContinuationToken}from"#shared/continuation-token.js";function createSession(e,r,i={}){return{id:e,async send(a,o){let s=createDelivery(i),c=sessionCallbackToTurnCaller(o.callback),l={message:serializeUrlFilePartsInMessage(a)};o.context!==void 0&&(l.context=o.context),o.outputSchema!==void 0&&(l.outputSchema=o.outputSchema);let u={auth:o.auth,delivery:s,kind:`send`,payload:l,requestId:i.requestId,turnPolicy:o.turnPolicy??i.turnPolicy??DEFAULT_TURN_POLICY};return await r.dispatchSession({command:c===void 0?u:{...u,caller:c},sessionId:e})},async respond(t,n){if(t.length===0)throw Error(`respond() requires at least one input response.`);let a=sessionCallbackToTurnCaller(n.callback),o=createDelivery(i),s={inputResponses:t};n.context!==void 0&&(s.context=n.context),n.outputSchema!==void 0&&(s.outputSchema=n.outputSchema);let c={auth:n.auth,delivery:o,kind:`send`,payload:s,requestId:i.requestId};return await r.dispatchSession({command:a===void 0?c:{...c,caller:a},sessionId:e})},async cancel(t){return await r.dispatchSession({command:{kind:`cancel`,turnId:t?.turnId},sessionId:e})},async compact(){return await r.dispatchSession({command:{kind:`compact`},sessionId:e})},async clear(){return await r.dispatchSession({command:{kind:`clear`},sessionId:e})},async reset(t){return await r.dispatchSession({command:{kind:`reset`,reason:t?.reason},sessionId:e})},async getEventStream(t){return r.getEventStream(e,t)},async getStreamTailIndex(){return r.getStreamTailIndex(e)}}}function createAttachSessionFn(e,t={}){return n=>createSession(n,e,t)}function createDelivery(t){return t.channelKind!==void 0&&t.channelName!==void 0?createChannelDeliveryMetadata(t):void 0}function buildSessionHandle(e){return{get id(){return e.get(SessionIdKey)??``},get auth(){return{current:e.get(AuthKey)??null,initiator:e.get(InitiatorAuthKey)??null}},get continuation(){let t=e.get(ContinuationTokenKey);if(!(t===void 0||t.length===0))return{token:toChannelLocalContinuationToken(t),rekey(n){let r=namespaceContinuationToken(t,n);t!==r&&e.set(ContinuationTokenKey,r)}}}}}function namespaceContinuationToken(e,t){let n=e.indexOf(`:`);if(n<=0)throw Error(`Cannot set session continuation token without an existing namespaced continuation token. Start the session with a placeholder continuationToken.`);return`${e.slice(0,n+1)}${t}`}function sessionCallbackToTurnCaller(e){return e===void 0?void 0:{callId:e.callId,replyTo:{kind:`callback`,url:e.url},subagentName:e.subagentName}}export{buildSessionHandle,createAttachSessionFn,createSession,sessionCallbackToTurnCaller};
|
|
1
|
+
import{createChannelDeliveryMetadata}from"#channel/delivery-metadata.js";import{serializeUrlFilePartsInMessage}from"#channel/send-input.js";import{DEFAULT_TURN_POLICY}from"#channel/types.js";import{AuthKey,ContinuationTokenKey,InitiatorAuthKey,SessionIdKey}from"#context/keys.js";import{toChannelLocalContinuationToken}from"#shared/continuation-token.js";function createSession(e,r,i={}){return{id:e,async send(a,o){let s=createDelivery(i),c=sessionCallbackToTurnCaller(o.callback),l={message:serializeUrlFilePartsInMessage(a)};o.context!==void 0&&(l.context=o.context),o.outputSchema!==void 0&&(l.outputSchema=o.outputSchema);let u={auth:o.auth,delivery:s,kind:`send`,payload:l,requestId:i.requestId,turnPolicy:o.turnPolicy??i.turnPolicy??DEFAULT_TURN_POLICY};return await r.dispatchSession({command:c===void 0?u:{...u,caller:c},sessionId:e})},async respond(t,n){if(t.length===0)throw Error(`respond() requires at least one input response.`);let a=sessionCallbackToTurnCaller(n.callback),o=createDelivery(i),s={inputResponses:t};n.context!==void 0&&(s.context=n.context),n.outputSchema!==void 0&&(s.outputSchema=n.outputSchema);let c={auth:n.auth,delivery:o,kind:`send`,payload:s,requestId:i.requestId};return await r.dispatchSession({command:a===void 0?c:{...c,caller:a},sessionId:e})},async cancel(t){return await r.dispatchSession({command:{kind:`cancel`,taskId:t?.taskId,turnId:t?.turnId},sessionId:e})},async compact(){return await r.dispatchSession({command:{kind:`compact`},sessionId:e})},async clear(){return await r.dispatchSession({command:{kind:`clear`},sessionId:e})},async reset(t){return await r.dispatchSession({command:{kind:`reset`,reason:t?.reason},sessionId:e})},async getEventStream(t){return r.getEventStream(e,t)},async getStreamTailIndex(){return r.getStreamTailIndex(e)}}}function createAttachSessionFn(e,t={}){return n=>createSession(n,e,t)}function createDelivery(t){return t.channelKind!==void 0&&t.channelName!==void 0?createChannelDeliveryMetadata(t):void 0}function buildSessionHandle(e){return{get id(){return e.get(SessionIdKey)??``},get auth(){return{current:e.get(AuthKey)??null,initiator:e.get(InitiatorAuthKey)??null}},get continuation(){let t=e.get(ContinuationTokenKey);if(!(t===void 0||t.length===0))return{token:toChannelLocalContinuationToken(t),rekey(n){let r=namespaceContinuationToken(t,n);t!==r&&e.set(ContinuationTokenKey,r)}}}}}function namespaceContinuationToken(e,t){let n=e.indexOf(`:`);if(n<=0)throw Error(`Cannot set session continuation token without an existing namespaced continuation token. Start the session with a placeholder continuationToken.`);return`${e.slice(0,n+1)}${t}`}function sessionCallbackToTurnCaller(e){return e===void 0?void 0:{callId:e.callId,replyTo:{kind:`callback`,token:e.token,url:e.url},subagentName:e.subagentName,taskId:e.taskId}}export{buildSessionHandle,createAttachSessionFn,createSession,sessionCallbackToTurnCaller};
|
|
@@ -7,6 +7,7 @@ import type { InputRequest, InputResponse } from "#runtime/input/types.js";
|
|
|
7
7
|
import type { ChannelAdapter } from "#channel/adapter.js";
|
|
8
8
|
import type { AgentLimitsDefinition } from "#shared/agent-definition.js";
|
|
9
9
|
import type { JsonObject } from "#shared/json.js";
|
|
10
|
+
import type { TaskView } from "#tasks/types.js";
|
|
10
11
|
export type { ContextAccessor } from "#context/key.js";
|
|
11
12
|
export type { ChannelInstrumentationProjection } from "#channel/instrumentation.js";
|
|
12
13
|
import type { ChannelInstrumentationProjection } from "#channel/instrumentation.js";
|
|
@@ -14,6 +15,8 @@ export type RunSessionLimits = Pick<AgentLimitsDefinition, "maxInputTokensPerSes
|
|
|
14
15
|
/** Identifies the session turn to cancel. */
|
|
15
16
|
export interface CancelTurnInput {
|
|
16
17
|
readonly sessionId: string;
|
|
18
|
+
/** Framework task whose queued child deliveries should be discarded. */
|
|
19
|
+
readonly taskId?: string;
|
|
17
20
|
/** Limits the request to the turn the caller observed. */
|
|
18
21
|
readonly turnId?: string;
|
|
19
22
|
}
|
|
@@ -110,11 +113,14 @@ export type EventEmitFn = (event: UnstampedMessageStreamEvent) => Promise<void>;
|
|
|
110
113
|
export interface TurnCaller {
|
|
111
114
|
readonly callId: string;
|
|
112
115
|
readonly subagentName: string;
|
|
116
|
+
/** Present when this turn is the executor for a durable background task. */
|
|
117
|
+
readonly taskId?: string;
|
|
113
118
|
readonly replyTo: {
|
|
114
119
|
readonly kind: "hook";
|
|
115
120
|
readonly token: string;
|
|
116
121
|
} | {
|
|
117
122
|
readonly kind: "callback";
|
|
123
|
+
readonly token: string;
|
|
118
124
|
readonly url: string;
|
|
119
125
|
};
|
|
120
126
|
}
|
|
@@ -135,6 +141,21 @@ export interface DeliverPayload {
|
|
|
135
141
|
readonly message?: string | UserContent;
|
|
136
142
|
readonly context?: readonly string[];
|
|
137
143
|
readonly outputSchema?: JsonObject;
|
|
144
|
+
/** Framework-only task envelopes consumed before adapter/model delivery. */
|
|
145
|
+
readonly task?: {
|
|
146
|
+
/** Task HITL input-request batches for the parent's pre-model router. */
|
|
147
|
+
readonly inputRequests?: readonly {
|
|
148
|
+
readonly hookPayload: SubagentInputRequestHookPayload;
|
|
149
|
+
readonly taskId: string;
|
|
150
|
+
}[];
|
|
151
|
+
/** Task authorization events projected through the parent channel. */
|
|
152
|
+
readonly authorizationEvents?: readonly {
|
|
153
|
+
readonly hookPayload: SubagentAuthorizationEventHookPayload;
|
|
154
|
+
readonly taskId: string;
|
|
155
|
+
}[];
|
|
156
|
+
/** Terminal views cached before task-run retention expires. */
|
|
157
|
+
readonly views?: readonly TaskView[];
|
|
158
|
+
};
|
|
138
159
|
readonly [key: string]: unknown;
|
|
139
160
|
}
|
|
140
161
|
/** Controls how a channel message interacts with an active turn. */
|
|
@@ -149,9 +170,16 @@ export type SessionCommand = {
|
|
|
149
170
|
readonly payload: DeliverPayload;
|
|
150
171
|
readonly delivery?: ChannelDeliveryMetadata;
|
|
151
172
|
readonly requestId?: string;
|
|
173
|
+
/**
|
|
174
|
+
* Replay-stable identity for one task-owned child delivery; lets the
|
|
175
|
+
* parent inbox dedupe retried durable-step deliveries. See
|
|
176
|
+
* {@link DeliverHookPayload.taskDeliveryId}.
|
|
177
|
+
*/
|
|
178
|
+
readonly taskDeliveryId?: string;
|
|
152
179
|
readonly turnPolicy?: TurnPolicy;
|
|
153
180
|
} | {
|
|
154
181
|
readonly kind: "cancel";
|
|
182
|
+
readonly taskId?: string;
|
|
155
183
|
readonly turnId?: string;
|
|
156
184
|
} | {
|
|
157
185
|
readonly kind: "compact";
|
|
@@ -205,6 +233,13 @@ export interface DeliverHookPayload {
|
|
|
205
233
|
readonly deliveryMetadata?: readonly ChannelDeliveryMetadataEntry[];
|
|
206
234
|
/** Inbound channel request id used only for workflow attributes. */
|
|
207
235
|
readonly requestId?: string;
|
|
236
|
+
/**
|
|
237
|
+
* Replay-stable identity for one task-owned child delivery. Task-run steps
|
|
238
|
+
* derive it from deterministic inputs (task id, event kind, sequence) so the
|
|
239
|
+
* parent inbox can drop the duplicate when a durable step retries after
|
|
240
|
+
* `resumeHook` already succeeded.
|
|
241
|
+
*/
|
|
242
|
+
readonly taskDeliveryId?: string;
|
|
208
243
|
readonly kind: "deliver";
|
|
209
244
|
readonly payloads: readonly DeliverPayload[];
|
|
210
245
|
readonly turnPolicy?: TurnPolicy;
|
|
@@ -292,6 +327,7 @@ export type HookPayload = ClearSessionHookPayload | CompactSessionHookPayload |
|
|
|
292
327
|
export interface SessionCallback {
|
|
293
328
|
readonly callId: string;
|
|
294
329
|
readonly subagentName: string;
|
|
330
|
+
readonly taskId?: string;
|
|
295
331
|
readonly token: string;
|
|
296
332
|
readonly url: string;
|
|
297
333
|
}
|
|
@@ -402,6 +438,11 @@ export interface RunInput {
|
|
|
402
438
|
* parent depth + 1.
|
|
403
439
|
*/
|
|
404
440
|
readonly subagentDepth?: number;
|
|
441
|
+
/** Framework-owned metadata for a protocol-neutral external invocation. */
|
|
442
|
+
readonly externalInvocation?: {
|
|
443
|
+
readonly continuationToken: string;
|
|
444
|
+
readonly ownerKey: string;
|
|
445
|
+
};
|
|
405
446
|
}
|
|
406
447
|
export interface DeliverInput {
|
|
407
448
|
/**
|
|
@@ -13,6 +13,7 @@ const EVE_SESSION_COMPACT_ROUTE_PATTERN = `${EVE_SESSION_ROUTE_PATH}/:sessionId/
|
|
|
13
13
|
const EVE_SESSION_CLEAR_ROUTE_PATTERN = `${EVE_SESSION_ROUTE_PATH}/:sessionId/clear`;
|
|
14
14
|
const EVE_SESSION_RESET_ROUTE_PATTERN = `${EVE_SESSION_ROUTE_PATH}/:sessionId/reset`;
|
|
15
15
|
const EVE_SESSION_STREAM_ROUTE_PATTERN = `${EVE_SESSION_ROUTE_PATH}/:sessionId/stream`;
|
|
16
|
+
const EVE_SUBAGENT_STREAM_ROUTE_PATTERN = `${EVE_SESSION_ROUTE_PATH}/:parentSessionId/subagents/:callId/:childSessionId/stream`;
|
|
16
17
|
const EVE_DEV_DISPATCH_SCHEDULE_ROUTE_PATTERN = `${EVE_ROUTE_PREFIX}/dev/schedules/:scheduleId`;
|
|
17
18
|
const EVE_DEV_RUNTIME_ARTIFACTS_ROUTE_PATH = `${EVE_ROUTE_PREFIX}/dev/runtime-artifacts`;
|
|
18
19
|
const EVE_DEV_RUNTIME_ARTIFACTS_REBUILD_ROUTE_PATH = `${EVE_DEV_RUNTIME_ARTIFACTS_ROUTE_PATH}/rebuild`;
|
|
@@ -21,6 +22,7 @@ const EVE_DEV_RUNTIME_ARTIFACTS_RESUME_ROUTE_PATH = `${EVE_DEV_RUNTIME_ARTIFACTS
|
|
|
21
22
|
const EVE_CONNECTION_CALLBACK_ROUTE_PATTERN = `${EVE_ROUTE_PREFIX}/connections/:name/callback/:attemptId/:token`;
|
|
22
23
|
const EVE_LEGACY_CONNECTION_CALLBACK_ROUTE_PATTERN = `${EVE_ROUTE_PREFIX}/connections/:name/callback/:token`;
|
|
23
24
|
const EVE_CALLBACK_ROUTE_PATTERN = `${EVE_ROUTE_PREFIX}/callback/:token`;
|
|
25
|
+
const EVE_TASK_INPUT_ROUTE_PATTERN = `${EVE_ROUTE_PREFIX}/task-input/:token`;
|
|
24
26
|
function createEveSessionRoutePath(sessionId) {
|
|
25
27
|
return `${EVE_SESSION_ROUTE_PATH}/${encodeURIComponent(sessionId)}`;
|
|
26
28
|
}
|
|
@@ -651,7 +653,7 @@ async function* followStreamIterable(input) {
|
|
|
651
653
|
if (!isStreamDisconnectError(error)) throw error;
|
|
652
654
|
}
|
|
653
655
|
if (input.signal?.aborted || input.startIndex < 0 || idleRetryPolicy.maxAttempts === 0) return;
|
|
654
|
-
if (!deliveredEvent && !initialConnection && (idleReconnects += 1) >= idleRetryPolicy.maxAttempts) return;
|
|
656
|
+
if (input.keepAlive !== true && !deliveredEvent && !initialConnection && (idleReconnects += 1) >= idleRetryPolicy.maxAttempts) return;
|
|
655
657
|
initialConnection = false;
|
|
656
658
|
await sleep(reconnectDelayMs, input.signal);
|
|
657
659
|
if (input.signal?.aborted) return;
|
|
@@ -1034,6 +1036,7 @@ var ClientSession = class ClientSession {
|
|
|
1034
1036
|
try {
|
|
1035
1037
|
for await (const event of this.#readStream({
|
|
1036
1038
|
headers: input.headers,
|
|
1039
|
+
keepAlive: shouldKeepActiveTurnAlive(input.streamReconnectPolicy),
|
|
1037
1040
|
signal: input.signal,
|
|
1038
1041
|
startIndex: initialStreamIndex,
|
|
1039
1042
|
streamReconnectPolicy: input.streamReconnectPolicy
|
|
@@ -1073,6 +1076,7 @@ var ClientSession = class ClientSession {
|
|
|
1073
1076
|
return followStreamIterable({
|
|
1074
1077
|
follow: input.follow,
|
|
1075
1078
|
host: this.#context.host,
|
|
1079
|
+
keepAlive: input.keepAlive,
|
|
1076
1080
|
resolveHeaders: () => this.#context.resolveHeaders(input.headers),
|
|
1077
1081
|
redirect: this.#context.redirect,
|
|
1078
1082
|
sessionId: this.#state.sessionId,
|
|
@@ -1082,6 +1086,10 @@ var ClientSession = class ClientSession {
|
|
|
1082
1086
|
});
|
|
1083
1087
|
}
|
|
1084
1088
|
};
|
|
1089
|
+
function shouldKeepActiveTurnAlive(policy) {
|
|
1090
|
+
if (policy && "reconnect" in policy) return false;
|
|
1091
|
+
return policy?.streamIdleReconnectPolicy?.maxAttempts === void 0;
|
|
1092
|
+
}
|
|
1085
1093
|
async function postTurn(context, path, input, requireMessage) {
|
|
1086
1094
|
const body = createMessageBody(input, requireMessage);
|
|
1087
1095
|
if (body === null) throw new Error(requireMessage ? "Creating a session requires a non-empty message." : "A session turn requires a non-empty message or inputResponses.");
|
|
@@ -13,6 +13,7 @@ const EVE_SESSION_COMPACT_ROUTE_PATTERN = `${EVE_SESSION_ROUTE_PATH}/:sessionId/
|
|
|
13
13
|
const EVE_SESSION_CLEAR_ROUTE_PATTERN = `${EVE_SESSION_ROUTE_PATH}/:sessionId/clear`;
|
|
14
14
|
const EVE_SESSION_RESET_ROUTE_PATTERN = `${EVE_SESSION_ROUTE_PATH}/:sessionId/reset`;
|
|
15
15
|
const EVE_SESSION_STREAM_ROUTE_PATTERN = `${EVE_SESSION_ROUTE_PATH}/:sessionId/stream`;
|
|
16
|
+
const EVE_SUBAGENT_STREAM_ROUTE_PATTERN = `${EVE_SESSION_ROUTE_PATH}/:parentSessionId/subagents/:callId/:childSessionId/stream`;
|
|
16
17
|
const EVE_DEV_DISPATCH_SCHEDULE_ROUTE_PATTERN = `${EVE_ROUTE_PREFIX}/dev/schedules/:scheduleId`;
|
|
17
18
|
const EVE_DEV_RUNTIME_ARTIFACTS_ROUTE_PATH = `${EVE_ROUTE_PREFIX}/dev/runtime-artifacts`;
|
|
18
19
|
const EVE_DEV_RUNTIME_ARTIFACTS_REBUILD_ROUTE_PATH = `${EVE_DEV_RUNTIME_ARTIFACTS_ROUTE_PATH}/rebuild`;
|
|
@@ -21,6 +22,7 @@ const EVE_DEV_RUNTIME_ARTIFACTS_RESUME_ROUTE_PATH = `${EVE_DEV_RUNTIME_ARTIFACTS
|
|
|
21
22
|
const EVE_CONNECTION_CALLBACK_ROUTE_PATTERN = `${EVE_ROUTE_PREFIX}/connections/:name/callback/:attemptId/:token`;
|
|
22
23
|
const EVE_LEGACY_CONNECTION_CALLBACK_ROUTE_PATTERN = `${EVE_ROUTE_PREFIX}/connections/:name/callback/:token`;
|
|
23
24
|
const EVE_CALLBACK_ROUTE_PATTERN = `${EVE_ROUTE_PREFIX}/callback/:token`;
|
|
25
|
+
const EVE_TASK_INPUT_ROUTE_PATTERN = `${EVE_ROUTE_PREFIX}/task-input/:token`;
|
|
24
26
|
function createEveSessionRoutePath(sessionId) {
|
|
25
27
|
return `${EVE_SESSION_ROUTE_PATH}/${encodeURIComponent(sessionId)}`;
|
|
26
28
|
}
|
|
@@ -651,7 +653,7 @@ async function* followStreamIterable(input) {
|
|
|
651
653
|
if (!isStreamDisconnectError(error)) throw error;
|
|
652
654
|
}
|
|
653
655
|
if (input.signal?.aborted || input.startIndex < 0 || idleRetryPolicy.maxAttempts === 0) return;
|
|
654
|
-
if (!deliveredEvent && !initialConnection && (idleReconnects += 1) >= idleRetryPolicy.maxAttempts) return;
|
|
656
|
+
if (input.keepAlive !== true && !deliveredEvent && !initialConnection && (idleReconnects += 1) >= idleRetryPolicy.maxAttempts) return;
|
|
655
657
|
initialConnection = false;
|
|
656
658
|
await sleep(reconnectDelayMs, input.signal);
|
|
657
659
|
if (input.signal?.aborted) return;
|
|
@@ -1034,6 +1036,7 @@ var ClientSession = class ClientSession {
|
|
|
1034
1036
|
try {
|
|
1035
1037
|
for await (const event of this.#readStream({
|
|
1036
1038
|
headers: input.headers,
|
|
1039
|
+
keepAlive: shouldKeepActiveTurnAlive(input.streamReconnectPolicy),
|
|
1037
1040
|
signal: input.signal,
|
|
1038
1041
|
startIndex: initialStreamIndex,
|
|
1039
1042
|
streamReconnectPolicy: input.streamReconnectPolicy
|
|
@@ -1073,6 +1076,7 @@ var ClientSession = class ClientSession {
|
|
|
1073
1076
|
return followStreamIterable({
|
|
1074
1077
|
follow: input.follow,
|
|
1075
1078
|
host: this.#context.host,
|
|
1079
|
+
keepAlive: input.keepAlive,
|
|
1076
1080
|
resolveHeaders: () => this.#context.resolveHeaders(input.headers),
|
|
1077
1081
|
redirect: this.#context.redirect,
|
|
1078
1082
|
sessionId: this.#state.sessionId,
|
|
@@ -1082,6 +1086,10 @@ var ClientSession = class ClientSession {
|
|
|
1082
1086
|
});
|
|
1083
1087
|
}
|
|
1084
1088
|
};
|
|
1089
|
+
function shouldKeepActiveTurnAlive(policy) {
|
|
1090
|
+
if (policy && "reconnect" in policy) return false;
|
|
1091
|
+
return policy?.streamIdleReconnectPolicy?.maxAttempts === void 0;
|
|
1092
|
+
}
|
|
1085
1093
|
async function postTurn(context, path, input, requireMessage) {
|
|
1086
1094
|
const body = createMessageBody(input, requireMessage);
|
|
1087
1095
|
if (body === null) throw new Error(requireMessage ? "Creating a session requires a non-empty message." : "A session turn requires a non-empty message or inputResponses.");
|
|
@@ -3,12 +3,12 @@ export declare const SETUP_SECTIONS: readonly ["intro-setup.md", "collect-intent
|
|
|
3
3
|
/** Ordered `agent-prompt/` sections composed into the post-scaffold handoff. */
|
|
4
4
|
export declare const HANDOFF_SECTIONS: readonly ["intro-handoff.md", "collect-intent.md", "vercel-connect.md", "build-and-verify.md"];
|
|
5
5
|
/**
|
|
6
|
-
* The pre-scaffold setup guide
|
|
7
|
-
*
|
|
8
|
-
*
|
|
6
|
+
* The pre-scaffold setup guide shown after malformed coding-agent input. It
|
|
7
|
+
* scaffolds from scratch, so it renders with the universal `npx eve dev` rather
|
|
8
|
+
* than a launcher-specific command.
|
|
9
9
|
*/
|
|
10
10
|
export declare function initAgentInstructions(): string;
|
|
11
|
-
/** The post-scaffold handoff printed after a coding agent runs `eve init
|
|
11
|
+
/** The post-scaffold handoff printed after a coding agent runs `eve init`. */
|
|
12
12
|
export declare function initAgentDevHandoff(options: {
|
|
13
13
|
projectPath: string;
|
|
14
14
|
devCommand: string;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { type Prompter } from "#setup/prompter.js";
|
|
2
|
+
export interface InitConfirmDependencies {
|
|
3
|
+
createPrompter(): Prompter;
|
|
4
|
+
hasInteractiveTerminal(): boolean;
|
|
5
|
+
}
|
|
6
|
+
export type InitNonEmptyDirectoryTarget = {
|
|
7
|
+
kind: "current-directory";
|
|
8
|
+
} | {
|
|
9
|
+
kind: "subdirectory";
|
|
10
|
+
name: string;
|
|
11
|
+
};
|
|
12
|
+
export declare function confirmInitInNonEmptyDirectory(entries: readonly string[], dependencies?: InitConfirmDependencies): Promise<InitNonEmptyDirectoryTarget>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{hasInteractiveTerminal}from"./preconditions.js";import{createPrompter}from"#setup/prompter.js";import{parseProjectName,validateProjectName}from"#setup/project-name.js";const defaultDependencies={createPrompter,hasInteractiveTerminal};function formatEntries(e){return`${e.slice(0,5).join(`, `)}${e.length>5?`, and ${e.length-5} more`:``}`}async function confirmInitInNonEmptyDirectory(e,t=defaultDependencies){let n=formatEntries(e);if(!t.hasInteractiveTerminal())throw Error(`Cannot choose where to initialize the non-empty current directory without an interactive terminal. Found: ${n}. Pass a new directory name, for example: eve init my-agent.`);let r=t.createPrompter();return await r.select({message:`Where should eve initialize the project?`,description:`The current directory isn't empty. Found: ${n}.`,options:[{value:`subdirectory`,label:`Create a new subdirectory`,hint:`Keep the current directory unchanged`},{value:`current-directory`,label:`Use the current directory`,hint:`Overwrite files at generated paths`,accent:`warning`}],initialValue:`subdirectory`})===`current-directory`?{kind:`current-directory`}:{kind:`subdirectory`,name:parseProjectName(await r.text({message:`Subdirectory name`,defaultValue:`my-agent`,validate:validateProjectName}))}}export{confirmInitInNonEmptyDirectory};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{rm}from"node:fs/promises";import{join}from"node:path";import{execFile}from"node:child_process";import{promisify}from"node:util";const GIT_TIMEOUT_MS=5e3,runFile=promisify(execFile);async function commandSucceeds(e,t,n){try{let r={timeout:GIT_TIMEOUT_MS,windowsHide:!0};return n!==void 0&&(r.cwd=n),await runFile(e,[...t],r),!0}catch{return!1}}function isGitAvailable(){return commandSucceeds(`git`,[`--version`])}async function isInsideExistingRepository(e){return await commandSucceeds(`git`,[`rev-parse`,`--is-inside-work-tree`],e)||await commandSucceeds(`hg`,[`--cwd`,`.`,`root`],e)}function hasConfiguredDefaultBranch(e){return commandSucceeds(`git`,[`config`,`init.defaultBranch`],e)}async function runGit(e,t){await runFile(`git`,[...t],{cwd:e,timeout:GIT_TIMEOUT_MS,windowsHide:!0})}async function tryInitializeGit(
|
|
1
|
+
import{rm,stat}from"node:fs/promises";import{join}from"node:path";import{execFile}from"node:child_process";import{promisify}from"node:util";const GIT_TIMEOUT_MS=5e3,runFile=promisify(execFile);async function commandSucceeds(e,t,n){try{let r={timeout:GIT_TIMEOUT_MS,windowsHide:!0};return n!==void 0&&(r.cwd=n),await runFile(e,[...t],r),!0}catch{return!1}}function isGitAvailable(){return commandSucceeds(`git`,[`--version`])}async function isInsideExistingRepository(e){return await commandSucceeds(`git`,[`rev-parse`,`--is-inside-work-tree`],e)||await commandSucceeds(`hg`,[`--cwd`,`.`,`root`],e)}function hasConfiguredDefaultBranch(e){return commandSucceeds(`git`,[`config`,`init.defaultBranch`],e)}async function runGit(e,t){await runFile(`git`,[...t],{cwd:e,timeout:GIT_TIMEOUT_MS,windowsHide:!0})}async function tryInitializeGit(r){let i=join(r,`.git`);if(await stat(i).then(()=>!0,e=>{if(e.code===`ENOENT`)return!1;throw e})||!await isGitAvailable()||await isInsideExistingRepository(r))return{kind:`skipped`};let a=!1;try{return await runGit(r,[`init`]),a=!0,await hasConfiguredDefaultBranch(r)||await runGit(r,[`checkout`,`-b`,`main`]),await runGit(r,[`add`,`-A`]),await runGit(r,[`commit`,`-m`,`Initial commit from eve`]),{kind:`initialized`}}catch(t){return a&&await rm(i,{recursive:!0,force:!0}).catch(()=>{}),{kind:`failed`,reason:t instanceof Error?t.message:String(t)}}}export{tryInitializeGit};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export type InitFailurePolicy = "clear" | "preserve" | "remove";
|
|
2
|
+
export declare function cleanupFreshInitTarget(projectPath: string, policy: Exclude<InitFailurePolicy, "preserve">, preservedEntries?: readonly string[]): Promise<boolean>;
|
|
3
|
+
export declare function workspaceFailureNote(workspaceMember: boolean): string;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import{readdir,rm}from"node:fs/promises";import{join}from"node:path";async function cleanupFreshInitTarget(t,n,r=[]){try{if(n===`remove`)await rm(t,{recursive:!0,force:!0});else{let n=new Set(r);for(let r of await readdir(t))n.has(r)||await rm(join(t,r),{recursive:!0,force:!0})}return!0}catch{return!1}}function workspaceFailureNote(e){return e?`
|
|
2
|
+
|
|
3
|
+
Shared workspace files may have changed. Review your workspace changes before committing.`:``}export{cleanupFreshInitTarget,workspaceFailureNote};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { InitNonEmptyDirectoryTarget } from "./init-confirm.js";
|
|
2
|
+
import type { InitFailurePolicy } from "./init-recovery.js";
|
|
3
|
+
export type InitTarget = {
|
|
4
|
+
kind: "existing";
|
|
5
|
+
projectPath: string;
|
|
6
|
+
} | {
|
|
7
|
+
failurePolicy: InitFailurePolicy;
|
|
8
|
+
kind: "fresh";
|
|
9
|
+
overwriteExisting: boolean;
|
|
10
|
+
preservedEntries: readonly string[];
|
|
11
|
+
projectName: string;
|
|
12
|
+
projectPath: string;
|
|
13
|
+
};
|
|
14
|
+
interface ResolveInitTargetInput {
|
|
15
|
+
agentLaunched: boolean;
|
|
16
|
+
confirmInitInNonEmptyDirectory(entries: readonly string[]): Promise<InitNonEmptyDirectoryTarget>;
|
|
17
|
+
parentDirectory: string;
|
|
18
|
+
target: string | undefined;
|
|
19
|
+
}
|
|
20
|
+
export declare function resolveInitTarget(input: ResolveInitTargetInput): Promise<InitTarget>;
|
|
21
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{readdir,stat}from"node:fs/promises";import{join,resolve}from"node:path";import{pathExists}from"#setup/path-exists.js";import{parseProjectName}from"#setup/project-name.js";import{blockingCreateInPlaceEntries}from"#setup/scaffold/create-in-place.js";function isCurrentDirectoryTarget(e){return/^\.(?:[/\\]+\.?)*$/u.test(e.trim())}async function resolveNamedTarget(n,r){let a=parseProjectName(r),o=join(n,a),s=await stat(o).then(e=>e,e=>{if(e.code!==`ENOENT`)throw e});if(s===void 0)return{failurePolicy:`remove`,kind:`fresh`,overwriteExisting:!1,preservedEntries:[],projectName:a,projectPath:o};if(!s.isDirectory())throw Error(`Cannot create project because "${o}" already exists.`);return(await readdir(o)).length>0?{kind:`existing`,projectPath:o}:{failurePolicy:`clear`,kind:`fresh`,overwriteExisting:!1,preservedEntries:[],projectName:a,projectPath:o}}async function resolveInitTarget(t){let i=resolve(t.parentDirectory),o=t.target??`.`;if(!isCurrentDirectoryTarget(o))return resolveNamedTarget(i,o);if(await pathExists(join(i,`package.json`)))return{kind:`existing`,projectPath:i};let s=await readdir(i),c=blockingCreateInPlaceEntries(s);if(c.length===0)return{failurePolicy:`clear`,kind:`fresh`,overwriteExisting:!1,preservedEntries:s,projectName:`.`,projectPath:i};if(t.agentLaunched)throw Error(`Coding-agent launches cannot choose where to initialize a non-empty current directory. Pass a new directory name, for example: eve init my-agent.`);let l=await t.confirmInitInNonEmptyDirectory(c);return l.kind===`subdirectory`?resolveNamedTarget(i,l.name):{failurePolicy:`preserve`,kind:`fresh`,overwriteExisting:!0,preservedEntries:s,projectName:`.`,projectPath:i}}export{resolveInitTarget};
|
|
@@ -5,6 +5,7 @@ import { runPackageManagerInstall, spawnPackageManager } from "#setup/primitives
|
|
|
5
5
|
import { addAgentToProject } from "#setup/scaffold/create/add-to-project.js";
|
|
6
6
|
import { ensureChannel, scaffoldBaseProject } from "#setup/scaffold/index.js";
|
|
7
7
|
import { validateModelSlug } from "#setup/flows/model-source-change.js";
|
|
8
|
+
import { confirmInitInNonEmptyDirectory } from "./init-confirm.js";
|
|
8
9
|
import { tryInitializeGit } from "./init-git.js";
|
|
9
10
|
import { selectInitHandoff, spawnCodingAgentRepl } from "./init-repl.js";
|
|
10
11
|
export interface InitCliLogger {
|
|
@@ -21,6 +22,7 @@ export interface InitCommandOptions {
|
|
|
21
22
|
}
|
|
22
23
|
export interface InitCommandDependencies {
|
|
23
24
|
addAgentToProject: typeof addAgentToProject;
|
|
25
|
+
confirmInitInNonEmptyDirectory: typeof confirmInitInNonEmptyDirectory;
|
|
24
26
|
detectInvokingPackageManager: typeof detectInvokingPackageManager;
|
|
25
27
|
detectPackageManager: typeof detectPackageManager;
|
|
26
28
|
ensureChannel: typeof ensureChannel;
|
|
@@ -37,14 +39,13 @@ export interface InitCommandDependencies {
|
|
|
37
39
|
export declare const EVE_INIT_PACKAGE_SPEC_ENV = "EVE_INIT_PACKAGE_SPEC";
|
|
38
40
|
/**
|
|
39
41
|
* Creates a new eve agent (`target` is a project name), or adds one to an
|
|
40
|
-
* existing project (`target` is a directory), without
|
|
41
|
-
*
|
|
42
|
+
* existing project (`target` is a directory), without external provisioning.
|
|
43
|
+
* A fresh in-place scaffold asks whether to use the current directory or a new
|
|
44
|
+
* subdirectory when the current directory is not empty. Coding-agent launches
|
|
45
|
+
* must pass an explicit subdirectory instead.
|
|
42
46
|
*
|
|
43
47
|
* Runs launched by a coding agent get the dev command printed instead of
|
|
44
48
|
* spawned after scaffolding, since the dev TUI would wedge the launching agent.
|
|
45
|
-
* A coding agent that omits the target entirely gets the setup guide printed and
|
|
46
|
-
* nothing scaffolded, since a bare `eve init` means it has not yet chosen what to
|
|
47
|
-
* build.
|
|
48
49
|
*
|
|
49
50
|
* For extension packages, use `eve extension init` instead.
|
|
50
51
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{__toESM}from"../../_virtual/_rolldown/runtime.js";import{require_picocolors}from"../../node_modules/.pnpm/picocolors@1.1.1/node_modules/picocolors/picocolors.js";import{initAgentDevHandoff,initAgentInstructions,initAgentReplPrompt}from"./agent-instructions.js";import{tryInitializeGit}from"./init-git.js";import{selectInitHandoff,spawnCodingAgentRepl}from"./init-repl.js";import{mkdtemp,readdir,rename,rm,stat}from"node:fs/promises";import{createLogger,isLogLevelEnabled}from"#internal/logging.js";import{basename,join,resolve}from"node:path";import{ensureChannel,scaffoldBaseProject}from"#setup/scaffold/index.js";import{performance}from"node:perf_hooks";import{isCodingAgentLaunch}from"#cli/agent-detection.js";import{EVE_WORDMARK}from"#cli/banner.js";import{formatElapsed}from"#cli/format-elapsed.js";import{startCliLiveRow}from"#cli/ui/live-row.js";import{formatNodeEngineOverrideWarning}from"#setup/node-engine.js";import{detectInvokingPackageManager,detectPackageManager}from"#setup/package-manager.js";import{pathExists}from"#setup/path-exists.js";import{parseProjectName}from"#setup/project-name.js";import{eveDevArguments,runPackageManagerInstall,spawnPackageManager}from"#setup/primitives/index.js";import{blockingCreateInPlaceEntries}from"#setup/scaffold/create-in-place.js";import{DEFAULT_EVE_PACKAGE_CONTRACT}from"#setup/scaffold/create/project.js";import{DEFAULT_AGENT_MODEL_ID}from"#shared/default-agent-model.js";import{addAgentToProject}from"#setup/scaffold/create/add-to-project.js";import{WizardCancelledError}from"#setup/step.js";import{validateModelSlug}from"#setup/flows/model-source-change.js";var import_picocolors=__toESM(require_picocolors(),1);const defaultDependencies={addAgentToProject,detectInvokingPackageManager,detectPackageManager,ensureChannel,isCodingAgentLaunch,now:()=>performance.now(),runPackageManagerInstall,scaffoldBaseProject,selectInitHandoff,spawnCodingAgentRepl,spawnPackageManager,tryInitializeGit,validateModelSlug},EVE_INIT_PACKAGE_SPEC_ENV=`EVE_INIT_PACKAGE_SPEC`,initLog=createLogger(`init`);async function resolveTargetDirectory(e,t){let n=resolve(e,t);return(await stat(n).catch(()=>void 0))?.isDirectory()?n:void 0}function isCurrentDirectoryTarget(e){return/^\.(?:[/\\]+\.?)*$/u.test(e.trim())}async function assertCanScaffoldInPlace(e){let t=blockingCreateInPlaceEntries(await readdir(e));if(t.length===0)return;let n=t.slice(0,5).join(`, `),r=t.length>5?`, and ${t.length-5} more`:``;throw Error(`Cannot create project in current directory because it is not empty. Found: ${n}${r}. Use an empty directory.`)}async function moveDirectoryContents(e,t){for(let n of await readdir(e))await rename(join(e,n),join(t,n))}function uniqueWorkspaceRootMutations(e){let t=new Map;for(let n of e){let e=`${n.kind}:${n.path}`,r=t.get(e);t.set(e,{...n,nodeEngineOverride:n.nodeEngineOverride??r?.nodeEngineOverride})}return[...t.values()]}function formatWorkspaceRootMutationWarning(e){let t=e.kind===`package-json`?`package.json`:`configuration`,n=e.nodeEngineOverride===void 0?``:` (${formatNodeEngineOverrideWarning(e.nodeEngineOverride)})`;return`Updated workspace root ${t} at ${e.path}${n}`}async function addToExistingProject(e,t,n,r){if(t.channelWebNextjs===!0)throw Error("`--channel-web-nextjs` is not supported when adding an agent to an existing project. Run `eve add channel/web` from the project afterwards instead.");if(t.model!==void 0){let r=await n.validateModelSlug(e,t.model);if(r!==null)throw Error(r)}let i=await n.detectPackageManager(e),a=await n.addAgentToProject({projectRoot:e,model:t.model??DEFAULT_AGENT_MODEL_ID,reasoning:t.reasoning,packageManager:i.kind,evePackage:r});return{packageManager:i.kind,nodeEngineOverride:a.nodeEngineOverride}}async function resolveScaffoldPackageManager(e,t){let n=await t.detectPackageManager(e);return n.source==="default"?t.detectInvokingPackageManager()??`pnpm`:n.kind}async function scaffoldProject(e,t,n,r,i,a){let o=resolve(e),s=t===`.`,l=s?o:join(o,t);if(s)await assertCanScaffoldInPlace(l);else if(await pathExists(l))throw Error(`Cannot create project because "${l}" already exists.`);let f=await mkdtemp(join(o,`.eve-init-`)),p=[];try{if(r.model!==void 0){let e=await i.validateModelSlug(f,r.model);if(e!==null)throw Error(e)}let e={projectName:s?basename(l):t,model:r.model??DEFAULT_AGENT_MODEL_ID,reasoning:r.reasoning,evePackage:a,targetDirectory:f,workspaceProbeDirectory:l,packageManager:n,onWorkspaceRootMutation:e=>{p.push(e)}},o=await i.scaffoldBaseProject(e);return r.channelWebNextjs===!0&&await i.ensureChannel({projectRoot:o,kind:`web`,packageManager:n,workspaceProbeDirectory:l,configureVercelServices:!1,onWorkspaceRootMutation:e=>{p.push(e)}}),s?await moveDirectoryContents(o,l):await rename(o,l),{projectPath:l,workspaceRootMutations:uniqueWorkspaceRootMutations(p)}}finally{await rm(f,{recursive:!0,force:!0})}}function installProgressDetail(e,t){let n=t.text.trim();if(n===``||e!==`npm`)return n||void 0;let r=/^npm silly fetch manifest (.+)$/u.exec(n);if(r!==null)return`Resolving ${r[1]}`;let i=/^npm http fetch \S+ \S+ attempt (\d+) failed with (\S+)$/u.exec(n);if(i!==null)return`npm registry · attempt ${i[1]} failed: ${i[2]}`;if(t.stream===`stdout`||/^npm (?:error|warn)\b/u.test(n))return n}const NPM_NOISE_LINE=/^\s*npm (?:silly|verbose|http|timing)\b/u;async function runInitSteps(e){let{dependencies:t,logger:n,options:r,parentDirectory:i,target:a}=e,o=isLogLevelEnabled(`debug`),s=startCliLiveRow(n);s.update(`Preparing project`);try{let e=await t.isCodingAgentLaunch(),c=a??`.`,l=isCurrentDirectoryTarget(c),u=l?await pathExists(join(resolve(i),`package.json`))?resolve(i):void 0:await resolveTargetDirectory(i,c),d=resolveInitEvePackageOverride(),f=u===void 0?`creating agent`:`adding agent`;s.update(u===void 0?`Creating agent`:`Adding agent`),initLog.debug(f);let p=t.now(),m;if(u===void 0){let e=l?`.`:parseProjectName(c),n=resolve(i),a=await resolveScaffoldPackageManager(e===`.`?n:join(n,e),t),o=await scaffoldProject(i,e,a,r,t,d);m={kind:`created`,packageManager:a,projectPath:o.projectPath,workspaceRootMutations:o.workspaceRootMutations}}else{let e=await addToExistingProject(u,r,t,d);m=e.nodeEngineOverride===void 0?{kind:`added`,packageManager:e.packageManager,projectPath:u}:{kind:`added`,nodeEngineOverride:e.nodeEngineOverride,packageManager:e.packageManager,projectPath:u}}let h=t.now()-p;initLog.debug(`${f} done`,{ms:h}),s.update(`Installing dependencies`,`${m.packageManager} install`),initLog.debug(`installing dependencies with ${m.packageManager}`);let g=t.now(),_=[],v=[],y=await t.runPackageManagerInstall(m.packageManager,m.projectPath,{bypassMinimumReleaseAge:!0,progressDetails:process.stdout.isTTY===!0&&!o,onOutput:e=>{e.text.trim()!==``&&(v.push(e.text),v.length>20&&v.shift(),NPM_NOISE_LINE.test(e.text)||_.push(e.text)),o&&initLog.debug(e.text);let t=installProgressDetail(m.packageManager,e);t!==void 0&&s.update(`Installing dependencies`,t)}}),b=t.now()-g;if(!y){initLog.debug(`dependency installation failed`,{ms:b}),s.stop();let e=_.length>0?_:v;for(let t of e)n.error(t);throw Error(`Failed to install dependencies in "${m.projectPath}".`)}return initLog.debug(`dependencies installed`,{ms:b}),m.kind===`created`?(s.update(`Initializing Git repository`),initLog.debug(`initializing git repository`),{...m,agentElapsedMs:h,agentLaunched:e,gitResult:await t.tryInitializeGit(m.projectPath),installElapsedMs:b}):{...m,agentElapsedMs:h,agentLaunched:e,installElapsedMs:b}}finally{s.stop()}}async function runInitCommand(e,t,a,o,s=defaultDependencies){if(a===void 0&&await s.isCodingAgentLaunch()){e.log(initAgentInstructions());return}let c=await runInitSteps({dependencies:s,logger:e,options:o,parentDirectory:t,target:a});if(c.kind===`created`){e.log(`${import_picocolors.default.green(`✓`)} Created an ${EVE_WORDMARK} agent in ${import_picocolors.default.bold(c.projectPath)} ${import_picocolors.default.dim(`in ${formatElapsed(c.agentElapsedMs)}`)}`);for(let t of c.workspaceRootMutations)e.log(import_picocolors.default.yellow(`⚠ ${formatWorkspaceRootMutationWarning(t)}`))}else e.log(`${import_picocolors.default.green(`✓`)} Added an ${EVE_WORDMARK} agent to ${import_picocolors.default.bold(c.projectPath)} ${import_picocolors.default.dim(`in ${formatElapsed(c.agentElapsedMs)}`)}`),c.nodeEngineOverride!==void 0&&e.log(import_picocolors.default.yellow(`⚠ ${formatNodeEngineOverrideWarning(c.nodeEngineOverride)}`));e.log(`${import_picocolors.default.green(`✓`)} Installed dependencies ${import_picocolors.default.dim(`in ${formatElapsed(c.installElapsedMs)}`)}`),c.kind===`created`&&c.gitResult.kind===`failed`&&e.error(import_picocolors.default.yellow(`Git initialization failed: ${c.gitResult.reason}`));let l=[c.packageManager,...eveDevArguments(c.packageManager)].join(` `),u=initAgentDevHandoff({projectPath:c.projectPath,devCommand:l});if(c.agentLaunched){e.log(u);return}let d;try{d=await s.selectInitHandoff({agentName:basename(c.projectPath)})}catch(e){if(e instanceof WizardCancelledError)return;throw e}if(d===`exit`)return;if(d!==`eve-dev`){if(e.log(import_picocolors.default.dim(`$ ${d}`)),!await s.spawnCodingAgentRepl({command:d,cwd:c.projectPath,prompt:initAgentReplPrompt({devCommand:l}),onPromptUnseeded:t=>{e.log(import_picocolors.default.yellow(`Could not seed ${d} automatically. Paste this prompt into it:`)),e.log(t)}}))throw Error(`Coding-agent REPL exited unsuccessfully in "${c.projectPath}".`);return}let f=c.kind===`created`,p=f?[...eveDevArguments(c.packageManager),`--input`,`/model`]:eveDevArguments(c.packageManager);if(e.log(import_picocolors.default.dim(f?`$ eve dev --input /model`:`$ eve dev`)),!await s.spawnPackageManager(c.packageManager,c.projectPath,p))throw Error(`Development server exited unsuccessfully in "${c.projectPath}".`)}function resolveInitEvePackageOverride(){let e=process.env[EVE_INIT_PACKAGE_SPEC_ENV]?.trim();if(!(e===void 0||e.length===0))return{nodeEngine:DEFAULT_EVE_PACKAGE_CONTRACT.nodeEngine,version:e}}export{EVE_INIT_PACKAGE_SPEC_ENV,runInitCommand};
|
|
1
|
+
import{__toESM}from"../../_virtual/_rolldown/runtime.js";import{require_picocolors}from"../../node_modules/.pnpm/picocolors@1.1.1/node_modules/picocolors/picocolors.js";import{initAgentDevHandoff,initAgentReplPrompt}from"./agent-instructions.js";import{tryInitializeGit}from"./init-git.js";import{confirmInitInNonEmptyDirectory}from"./init-confirm.js";import{cleanupFreshInitTarget,workspaceFailureNote}from"./init-recovery.js";import{selectInitHandoff,spawnCodingAgentRepl}from"./init-repl.js";import{resolveInitTarget}from"./init-target.js";import{mkdtemp,readdir,rename,rm}from"node:fs/promises";import{createLogger,isLogLevelEnabled}from"#internal/logging.js";import{basename,join,resolve}from"node:path";import{ensureChannel,scaffoldBaseProject}from"#setup/scaffold/index.js";import{performance}from"node:perf_hooks";import{isCodingAgentLaunch}from"#cli/agent-detection.js";import{EVE_WORDMARK}from"#cli/banner.js";import{formatElapsed}from"#cli/format-elapsed.js";import{startCliLiveRow}from"#cli/ui/live-row.js";import{formatNodeEngineOverrideWarning}from"#setup/node-engine.js";import{detectInvokingPackageManager,detectPackageManager}from"#setup/package-manager.js";import{pathExists}from"#setup/path-exists.js";import{eveDevArguments,runPackageManagerInstall,spawnPackageManager}from"#setup/primitives/index.js";import{DEFAULT_EVE_PACKAGE_CONTRACT}from"#setup/scaffold/create/project.js";import{DEFAULT_AGENT_MODEL_ID}from"#shared/default-agent-model.js";import{addAgentToProject}from"#setup/scaffold/create/add-to-project.js";import{WizardCancelledError}from"#setup/step.js";import{validateModelSlug}from"#setup/flows/model-source-change.js";import{isPackageManagerWorkspaceMember}from"#setup/scaffold/workspace-root.js";var import_picocolors=__toESM(require_picocolors(),1);const defaultDependencies={addAgentToProject,confirmInitInNonEmptyDirectory,detectInvokingPackageManager,detectPackageManager,ensureChannel,isCodingAgentLaunch,now:()=>performance.now(),runPackageManagerInstall,scaffoldBaseProject,selectInitHandoff,spawnCodingAgentRepl,spawnPackageManager,tryInitializeGit,validateModelSlug},EVE_INIT_PACKAGE_SPEC_ENV=`EVE_INIT_PACKAGE_SPEC`,initLog=createLogger(`init`);async function moveDirectoryContents(e,t){for(let n of await readdir(e))await rename(join(e,n),join(t,n))}function uniqueWorkspaceRootMutations(e){let t=new Map;for(let n of e){let e=`${n.kind}:${n.path}`,r=t.get(e);t.set(e,{...n,nodeEngineOverride:n.nodeEngineOverride??r?.nodeEngineOverride})}return[...t.values()]}function formatWorkspaceRootMutationWarning(e){let t=e.kind===`package-json`?`package.json`:`configuration`,n=e.nodeEngineOverride===void 0?``:` (${formatNodeEngineOverrideWarning(e.nodeEngineOverride)})`;return`Updated workspace root ${t} at ${e.path}${n}`}async function addToExistingProject(e,t,n,r){if(t.channelWebNextjs===!0)throw Error("`--channel-web-nextjs` is not supported when adding an agent to an existing project. Run `eve add channel/web` from the project afterwards instead.");if(t.model!==void 0){let r=await n.validateModelSlug(e,t.model);if(r!==null)throw Error(r)}let i=await n.detectPackageManager(e),a=await n.addAgentToProject({projectRoot:e,model:t.model??DEFAULT_AGENT_MODEL_ID,reasoning:t.reasoning,packageManager:i.kind,evePackage:r});return{packageManager:i.kind,nodeEngineOverride:a.nodeEngineOverride}}async function resolveScaffoldPackageManager(e,t){let n=await t.detectPackageManager(e);return n.source==="default"?t.detectInvokingPackageManager()??`pnpm`:n.kind}async function scaffoldProject(e,t,n,r,i,a,o){let s=resolve(e),c=t===`.`,l=c?s:join(s,t),u=!c&&await pathExists(l)&&(await readdir(l)).length===0;if(!c&&await pathExists(l)&&!u)throw Error(`Cannot create project because "${l}" already exists.`);let h=c&&o?void 0:await mkdtemp(join(s,`.eve-init-`)),g=[];try{let e=h??l;if(r.model!==void 0){let t=await i.validateModelSlug(e,r.model);if(t!==null)throw Error(t)}let s={projectName:h===void 0?`.`:c?basename(l):t,model:r.model??DEFAULT_AGENT_MODEL_ID,reasoning:r.reasoning,evePackage:a,targetDirectory:e,overwriteExisting:o,workspaceProbeDirectory:l,packageManager:n,onWorkspaceRootMutation:e=>{g.push(e)}},d=await i.scaffoldBaseProject(s);return r.channelWebNextjs===!0&&await i.ensureChannel({projectRoot:d,kind:`web`,packageManager:n,force:o,workspaceProbeDirectory:l,configureVercelServices:!1,onWorkspaceRootMutation:e=>{g.push(e)}}),h!==void 0&&(c||u?await moveDirectoryContents(d,l):await rename(d,l)),{projectPath:l,workspaceRootMutations:uniqueWorkspaceRootMutations(g)}}finally{h!==void 0&&await rm(h,{recursive:!0,force:!0})}}function installProgressDetail(e,t){let n=t.text.trim();if(n===``||e!==`npm`)return n||void 0;let r=/^npm silly fetch manifest (.+)$/u.exec(n);if(r!==null)return`Resolving ${r[1]}`;let i=/^npm http fetch \S+ \S+ attempt (\d+) failed with (\S+)$/u.exec(n);if(i!==null)return`npm registry · attempt ${i[1]} failed: ${i[2]}`;if(t.stream===`stdout`||/^npm (?:error|warn)\b/u.test(n))return n}const NPM_NOISE_LINE=/^\s*npm (?:silly|verbose|http|timing)\b/u;async function runInitSteps(e){let{dependencies:t,logger:n,options:r,parentDirectory:i,target:a}=e,c=isLogLevelEnabled(`debug`),l=await t.isCodingAgentLaunch(),d=await resolveInitTarget({agentLaunched:l,confirmInitInNonEmptyDirectory:t.confirmInitInNonEmptyDirectory,parentDirectory:i,target:a}),f=resolveInitEvePackageOverride(),p=startCliLiveRow(n);p.update(`Preparing project`);try{let e=d.kind===`fresh`?`creating agent`:`adding agent`;p.update(d.kind===`fresh`?`Creating agent`:`Adding agent`),initLog.debug(e);let a=t.now(),u;if(d.kind===`fresh`){let e=await resolveScaffoldPackageManager(d.projectPath,t),n=isPackageManagerWorkspaceMember(e,d.projectPath),a;try{a=await scaffoldProject(i,d.projectName,e,r,t,f,d.overwriteExisting)}catch(e){if(d.failurePolicy===`clear`){let t=await cleanupFreshInitTarget(d.projectPath,d.failurePolicy,d.preservedEntries),r=e instanceof Error?e.message:String(e),i=t?`eve restored "${d.projectPath}" to its original state.`:`eve could not completely clean "${d.projectPath}".`;throw Error(`${r}\n\n${i}${workspaceFailureNote(n)}`)}if(d.failurePolicy===`remove`&&n){let t=e instanceof Error?e.message:String(e);throw Error(`${t}${workspaceFailureNote(!0)}`)}throw e}u={failurePolicy:d.failurePolicy,kind:`created`,packageManager:e,preservedTargetEntries:d.preservedEntries,projectPath:a.projectPath,retryCommand:`eve init ${d.projectName}`,workspaceMember:n,workspaceRootMutations:a.workspaceRootMutations}}else{let e=await addToExistingProject(d.projectPath,r,t,f);u=e.nodeEngineOverride===void 0?{failurePolicy:`preserve`,kind:`added`,packageManager:e.packageManager,projectPath:d.projectPath}:{failurePolicy:`preserve`,kind:`added`,nodeEngineOverride:e.nodeEngineOverride,packageManager:e.packageManager,projectPath:d.projectPath}}let m=t.now()-a;initLog.debug(`${e} done`,{ms:m}),p.update(`Installing dependencies`,`${u.packageManager} install`),initLog.debug(`installing dependencies with ${u.packageManager}`);let h=t.now(),g=[],_=[],v=await t.runPackageManagerInstall(u.packageManager,u.projectPath,{bypassMinimumReleaseAge:!0,progressDetails:process.stdout.isTTY===!0&&!c,onOutput:e=>{e.text.trim()!==``&&(_.push(e.text),_.length>20&&_.shift(),NPM_NOISE_LINE.test(e.text)||g.push(e.text)),c&&initLog.debug(e.text);let t=installProgressDetail(u.packageManager,e);t!==void 0&&p.update(`Installing dependencies`,t)}}),y=t.now()-h;if(!v){initLog.debug(`dependency installation failed`,{ms:y}),p.stop();let e=g.length>0?g:_;for(let t of e)n.error(t);if(u.failurePolicy!==`preserve`){if(await cleanupFreshInitTarget(u.projectPath,u.failurePolicy,u.preservedTargetEntries)){let e=u.failurePolicy===`remove`?`eve removed the incomplete project at "${u.projectPath}".`:`eve restored "${u.projectPath}" to its original state.`,t=u.workspaceMember||u.workspaceRootMutations.length>0;throw Error(`Failed to install dependencies.\n\n${e}\n\nResolve the package-manager error above, then retry:\n ${u.retryCommand}${workspaceFailureNote(t)}`)}let e=u.workspaceMember||u.workspaceRootMutations.length>0;throw Error(`Failed to install dependencies, and eve could not completely clean "${u.projectPath}".\n\nResolve the package-manager error above, then install dependencies with ${u.packageManager} in that directory. Or clean the target manually before rerunning eve init.${workspaceFailureNote(e)}`)}throw Error(`The eve agent was added, but dependency installation failed.\n\nResolve the package-manager error above, then install dependencies with ${u.packageManager} in "${u.projectPath}".\n\nDo not rerun eve init; the agent is already configured.`)}return initLog.debug(`dependencies installed`,{ms:y}),u.kind===`created`?(p.update(`Initializing Git repository`),initLog.debug(`initializing git repository`),{...u,agentElapsedMs:m,agentLaunched:l,gitResult:await t.tryInitializeGit(u.projectPath),installElapsedMs:y}):{...u,agentElapsedMs:m,agentLaunched:l,installElapsedMs:y}}finally{p.stop()}}async function runInitCommand(e,t,i,a,o=defaultDependencies){let s;try{s=await runInitSteps({dependencies:o,logger:e,options:a,parentDirectory:t,target:i})}catch(e){if(e instanceof WizardCancelledError)return;throw e}if(s.kind===`created`){e.log(`${import_picocolors.default.green(`✓`)} Created an ${EVE_WORDMARK} agent in ${import_picocolors.default.bold(s.projectPath)} ${import_picocolors.default.dim(`in ${formatElapsed(s.agentElapsedMs)}`)}`);for(let t of s.workspaceRootMutations)e.log(import_picocolors.default.yellow(`⚠ ${formatWorkspaceRootMutationWarning(t)}`))}else e.log(`${import_picocolors.default.green(`✓`)} Added an ${EVE_WORDMARK} agent to ${import_picocolors.default.bold(s.projectPath)} ${import_picocolors.default.dim(`in ${formatElapsed(s.agentElapsedMs)}`)}`),s.nodeEngineOverride!==void 0&&e.log(import_picocolors.default.yellow(`⚠ ${formatNodeEngineOverrideWarning(s.nodeEngineOverride)}`));e.log(`${import_picocolors.default.green(`✓`)} Installed dependencies ${import_picocolors.default.dim(`in ${formatElapsed(s.installElapsedMs)}`)}`),s.kind===`created`&&s.gitResult.kind===`failed`&&e.error(import_picocolors.default.yellow(`Git initialization failed: ${s.gitResult.reason}`));let c=[s.packageManager,...eveDevArguments(s.packageManager)].join(` `),l=initAgentDevHandoff({projectPath:s.projectPath,devCommand:c});if(s.agentLaunched){e.log(l);return}let u;try{u=await o.selectInitHandoff({agentName:basename(s.projectPath)})}catch(e){if(e instanceof WizardCancelledError)return;throw e}if(u===`exit`)return;if(u!==`eve-dev`){if(e.log(import_picocolors.default.dim(`$ ${u}`)),!await o.spawnCodingAgentRepl({command:u,cwd:s.projectPath,prompt:initAgentReplPrompt({devCommand:c}),onPromptUnseeded:t=>{e.log(import_picocolors.default.yellow(`Could not seed ${u} automatically. Paste this prompt into it:`)),e.log(t)}}))throw Error(`Coding-agent REPL exited unsuccessfully in "${s.projectPath}".`);return}let d=s.kind===`created`,f=d?[...eveDevArguments(s.packageManager),`--input`,`/model`]:eveDevArguments(s.packageManager);if(e.log(import_picocolors.default.dim(d?`$ eve dev --input /model`:`$ eve dev`)),!await o.spawnPackageManager(s.packageManager,s.projectPath,f))throw Error(`Development server exited unsuccessfully in "${s.projectPath}".`)}function resolveInitEvePackageOverride(){let e=process.env[EVE_INIT_PACKAGE_SPEC_ENV]?.trim();if(!(e===void 0||e.length===0))return{nodeEngine:DEFAULT_EVE_PACKAGE_CONTRACT.nodeEngine,version:e}}export{EVE_INIT_PACKAGE_SPEC_ENV,runInitCommand};
|
|
@@ -212,6 +212,12 @@ export type AgentTUIRenderer = {
|
|
|
212
212
|
readToolApproval?(request: AgentTUIToolApprovalRequest, options?: AgentTUISessionOptions): Promise<AgentTUIToolApprovalResponse>;
|
|
213
213
|
readInputQuestion?(question: AgentTUIInputQuestion, options?: AgentTUISessionOptions): Promise<AgentTUIInputQuestionResponse | undefined>;
|
|
214
214
|
renderStream(result: AgentTUIStreamResult, options?: AgentTUISessionOptions): Promise<void>;
|
|
215
|
+
/**
|
|
216
|
+
* Renders a server-initiated turn while `readPrompt` still owns input.
|
|
217
|
+
* Unlike `renderStream`, this must not replace the active key consumer or
|
|
218
|
+
* clear the user's draft.
|
|
219
|
+
*/
|
|
220
|
+
renderIdleStream?(result: AgentTUIStreamResult, options?: AgentTUISessionOptions): Promise<void>;
|
|
215
221
|
/**
|
|
216
222
|
* The renderer's whole subagent surface — sections, nested steps and
|
|
217
223
|
* tools, ghost sweeps, completion. One optional capability with required
|
|
@@ -273,6 +279,8 @@ export type AgentTUIRenderer = {
|
|
|
273
279
|
* lifecycle ends.
|
|
274
280
|
*/
|
|
275
281
|
shutdown?(): void;
|
|
282
|
+
/** Suspends an idle prompt so a server-initiated HITL request can own input. */
|
|
283
|
+
suspendPromptForInput?(): void;
|
|
276
284
|
requestInterrupt?(): void;
|
|
277
285
|
exitRequested?(): boolean;
|
|
278
286
|
};
|