eve 0.7.0 → 0.7.3

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.
Files changed (145) hide show
  1. package/CHANGELOG.md +27 -0
  2. package/dist/docs/public/README.md +16 -11
  3. package/dist/docs/public/agent-config.md +9 -9
  4. package/dist/docs/public/channels/custom.mdx +4 -4
  5. package/dist/docs/public/channels/discord.mdx +1 -1
  6. package/dist/docs/public/channels/eve.mdx +9 -9
  7. package/dist/docs/public/channels/github.mdx +1 -1
  8. package/dist/docs/public/channels/overview.mdx +21 -15
  9. package/dist/docs/public/channels/slack.mdx +2 -2
  10. package/dist/docs/public/channels/teams.mdx +1 -1
  11. package/dist/docs/public/channels/telegram.mdx +1 -1
  12. package/dist/docs/public/channels/twilio.mdx +1 -1
  13. package/dist/docs/public/{advanced → concepts}/context-control.md +3 -3
  14. package/dist/docs/public/{advanced → concepts}/default-harness.md +3 -3
  15. package/dist/docs/public/{advanced → concepts}/execution-model-and-durability.md +3 -1
  16. package/dist/docs/public/concepts/meta.json +10 -0
  17. package/dist/docs/public/{advanced → concepts}/security-model.md +2 -2
  18. package/dist/docs/public/{advanced → concepts}/sessions-runs-and-streaming.md +7 -7
  19. package/dist/docs/public/connections.mdx +3 -3
  20. package/dist/docs/public/evals/cases.mdx +2 -3
  21. package/dist/docs/public/evals/judge.mdx +1 -1
  22. package/dist/docs/public/evals/overview.mdx +4 -4
  23. package/dist/docs/public/evals/running.mdx +5 -10
  24. package/dist/docs/public/evals/targets.mdx +4 -23
  25. package/dist/docs/public/getting-started.mdx +28 -35
  26. package/dist/docs/public/{advanced → guides}/auth-and-route-protection.md +2 -2
  27. package/dist/docs/public/{client → guides/client}/continuations.mdx +2 -2
  28. package/dist/docs/public/{client → guides/client}/messages.mdx +1 -1
  29. package/dist/docs/public/{client → guides/client}/meta.json +1 -1
  30. package/dist/docs/public/{client → guides/client}/output-schema.mdx +2 -2
  31. package/dist/docs/public/{client → guides/client}/overview.mdx +5 -5
  32. package/dist/docs/public/{client → guides/client}/streaming.mdx +1 -1
  33. package/dist/docs/public/{advanced → guides}/deployment.md +9 -1
  34. package/dist/docs/public/{advanced → guides}/dynamic-capabilities.md +1 -1
  35. package/dist/docs/public/{advanced → guides}/dynamic-workflows.md +1 -1
  36. package/dist/docs/public/{frontend → guides/frontend}/nextjs.mdx +3 -3
  37. package/dist/docs/public/{frontend → guides/frontend}/nuxt.mdx +3 -3
  38. package/dist/docs/public/{frontend → guides/frontend}/overview.mdx +6 -6
  39. package/dist/docs/public/{frontend → guides/frontend}/sveltekit.mdx +3 -3
  40. package/dist/docs/public/{frontend → guides/frontend}/use-eve-agent-svelte.mdx +2 -2
  41. package/dist/docs/public/{frontend → guides/frontend}/use-eve-agent-vue.mdx +2 -2
  42. package/dist/docs/public/{advanced → guides}/hooks.md +2 -2
  43. package/dist/docs/public/{advanced → guides}/instrumentation.md +2 -0
  44. package/dist/docs/public/{advanced → guides}/meta.json +8 -11
  45. package/dist/docs/public/{advanced → guides}/session-context.md +2 -2
  46. package/dist/docs/public/{advanced → guides}/state.md +1 -1
  47. package/dist/docs/public/instructions.mdx +2 -2
  48. package/dist/docs/public/introduction.md +5 -2
  49. package/dist/docs/public/meta.json +3 -3
  50. package/dist/docs/public/reference/cli.md +3 -3
  51. package/dist/docs/public/reference/meta.json +1 -1
  52. package/dist/docs/public/reference/project-layout.md +5 -1
  53. package/dist/docs/public/reference/typescript-api.md +23 -23
  54. package/dist/docs/public/sandbox.mdx +1 -1
  55. package/dist/docs/public/schedules.mdx +2 -2
  56. package/dist/docs/public/skills.mdx +3 -3
  57. package/dist/docs/public/subagents.mdx +3 -3
  58. package/dist/docs/public/tools.mdx +4 -4
  59. package/dist/docs/public/tutorial/connect-a-warehouse.mdx +2 -2
  60. package/dist/docs/public/tutorial/first-agent.mdx +1 -1
  61. package/dist/docs/public/tutorial/guard-the-spend.mdx +1 -1
  62. package/dist/docs/public/tutorial/how-it-runs.mdx +2 -2
  63. package/dist/docs/public/tutorial/meta.json +1 -1
  64. package/dist/docs/public/tutorial/query-sample-data.mdx +1 -1
  65. package/dist/docs/public/tutorial/remember-definitions.mdx +3 -3
  66. package/dist/docs/public/tutorial/run-analysis.mdx +1 -1
  67. package/dist/docs/public/tutorial/ship-it.mdx +4 -4
  68. package/dist/docs/public/tutorial/team-playbooks.mdx +3 -3
  69. package/dist/src/cli/dev/tui/prompt-command-handler.js +1 -1
  70. package/dist/src/cli/dev/tui/runner.d.ts +2 -2
  71. package/dist/src/cli/dev/tui/runner.js +1 -1
  72. package/dist/src/cli/dev/tui/tui.js +1 -1
  73. package/dist/src/cli/run.d.ts +0 -2
  74. package/dist/src/cli/run.js +1 -1
  75. package/dist/src/client/types.d.ts +0 -1
  76. package/dist/src/compiled/.vendor-stamp.json +2 -2
  77. package/dist/src/compiled/@workflow/core/capabilities.d.ts +19 -1
  78. package/dist/src/compiled/@workflow/core/class-serialization.d.ts +32 -0
  79. package/dist/src/compiled/@workflow/core/create-hook.d.ts +37 -0
  80. package/dist/src/compiled/@workflow/core/global.d.ts +11 -1
  81. package/dist/src/compiled/@workflow/core/index.js +2 -2
  82. package/dist/src/compiled/@workflow/core/runtime/start.d.ts +6 -0
  83. package/dist/src/compiled/@workflow/core/runtime/suspension-handler.d.ts +15 -2
  84. package/dist/src/compiled/@workflow/core/runtime/wait-continuation.d.ts +84 -0
  85. package/dist/src/compiled/@workflow/core/runtime.js +27 -27
  86. package/dist/src/compiled/@workflow/core/serialization/types.d.ts +21 -0
  87. package/dist/src/compiled/@workflow/core/serialization.d.ts +72 -6
  88. package/dist/src/compiled/@workflow/core/symbols.d.ts +2 -0
  89. package/dist/src/compiled/@workflow/core/version.d.ts +1 -1
  90. package/dist/src/compiled/@workflow/core/workflow/attribute-dispatcher.d.ts +6 -0
  91. package/dist/src/compiled/@workflow/core/workflow/set-attributes.d.ts +3 -4
  92. package/dist/src/compiled/@workflow/core/workflow.js +1 -1
  93. package/dist/src/compiled/@workflow/world/events.d.ts +48 -0
  94. package/dist/src/compiled/@workflow/world/index.d.ts +1 -1
  95. package/dist/src/compiled/@workflow/world/queue.d.ts +3 -0
  96. package/dist/src/compiled/@workflow/world/runs.d.ts +2 -0
  97. package/dist/src/compiled/@workflow/world/spec-version.d.ts +2 -1
  98. package/dist/src/compiled/_chunks/workflow/attribute-changes-DGVGRGfw.js +59 -0
  99. package/dist/src/compiled/_chunks/workflow/resume-hook-DMSadN9o.js +1 -0
  100. package/dist/src/compiled/_chunks/workflow/run-BRdn7zy_.js +1 -0
  101. package/dist/src/compiled/_chunks/workflow/sleep-CpXfoXLF.js +1 -0
  102. package/dist/src/evals/cli/eval.d.ts +0 -2
  103. package/dist/src/evals/cli/eval.js +1 -1
  104. package/dist/src/evals/define-eval.d.ts +1 -1
  105. package/dist/src/evals/define-eval.js +1 -1
  106. package/dist/src/evals/index.d.ts +1 -2
  107. package/dist/src/evals/index.js +1 -1
  108. package/dist/src/evals/runner/artifacts.js +1 -1
  109. package/dist/src/evals/runner/execute-eval.d.ts +2 -3
  110. package/dist/src/evals/runner/execute-eval.js +1 -1
  111. package/dist/src/evals/runner/execute-task.d.ts +1 -2
  112. package/dist/src/evals/runner/execute-task.js +1 -1
  113. package/dist/src/evals/runner/reporters/console.js +1 -1
  114. package/dist/src/evals/runner/reporters/junit.js +3 -4
  115. package/dist/src/evals/runner/run-evals.d.ts +0 -1
  116. package/dist/src/evals/runner/run-evals.js +1 -1
  117. package/dist/src/evals/target.d.ts +1 -6
  118. package/dist/src/evals/target.js +1 -1
  119. package/dist/src/evals/types.d.ts +2 -18
  120. package/dist/src/execution/node-step.js +1 -1
  121. package/dist/src/execution/sandbox/bindings/vercel.d.ts +2 -6
  122. package/dist/src/execution/sandbox/bindings/vercel.js +1 -1
  123. package/dist/src/internal/application/package.js +1 -1
  124. package/dist/src/internal/nitro/routes/agent-info/build-agent-info-response-from-manifest.js +1 -1
  125. package/dist/src/internal/nitro/routes/agent-info/build-agent-info-response.d.ts +0 -1
  126. package/dist/src/internal/nitro/routes/agent-info/build-agent-info-response.js +1 -1
  127. package/dist/src/runtime/agent/mock-model-adapter.d.ts +3 -6
  128. package/dist/src/runtime/agent/mock-model-adapter.js +2 -2
  129. package/dist/src/runtime/agent/resolve-model.d.ts +2 -2
  130. package/dist/src/runtime/agent/resolve-model.js +1 -1
  131. package/dist/src/runtime/sandbox/keys.js +1 -1
  132. package/dist/src/setup/primitives/pm/pnpm.js +1 -1
  133. package/dist/src/setup/scaffold/create/add-to-project.js +1 -1
  134. package/dist/src/setup/scaffold/create/project.js +2 -2
  135. package/dist/src/setup/scaffold/update/channels.js +1 -1
  136. package/package.json +6 -6
  137. package/dist/docs/public/reference/faqs.md +0 -48
  138. package/dist/src/compiled/_chunks/workflow/resume-hook-CEAS3opc.js +0 -12
  139. package/dist/src/compiled/_chunks/workflow/sleep-Cup6vPoA.js +0 -1
  140. package/dist/src/compiled/_chunks/workflow/symbols-BUTtwS7j.js +0 -48
  141. package/dist/src/evals/requirements.d.ts +0 -3
  142. package/dist/src/evals/requirements.js +0 -1
  143. /package/dist/docs/public/{advanced → guides}/dev-tui.md +0 -0
  144. /package/dist/docs/public/{frontend → guides/frontend}/meta.json +0 -0
  145. /package/dist/docs/public/{advanced → guides}/remote-agents.md +0 -0
@@ -30,31 +30,31 @@ export default defineTool({
30
30
 
31
31
  ## The define\* helpers
32
32
 
33
- | Helper | Import from | Authored at | Guide |
34
- | ------------------------------------------------------ | --------------------------------------------- | ------------------------------------ | -------------------------------------------------------- |
35
- | `defineAgent` | `eve` | `agent/agent.ts` | [agent.ts](../agent-config) |
36
- | `defineTool` | `eve/tools` | `agent/tools/<name>.ts` | [Tools](../tools) |
37
- | `defineDynamic` | `eve/tools`, `eve/skills`, `eve/instructions` | `agent/{tools,skills,instructions}/` | [Dynamic capabilities](../advanced/dynamic-capabilities) |
38
- | `defineMcpClientConnection`, `defineOpenAPIConnection` | `eve/connections` | `agent/connections/<name>.ts` | [Connections](../connections) |
39
- | `defineChannel` | `eve/channels` | `agent/channels/<name>.ts` | [Custom channels](../channels/custom) |
40
- | `eveChannel`, `slackChannel`, and the other platforms | `eve/channels/<platform>` | `agent/channels/<platform>.ts` | [Channels](../channels/overview) |
41
- | `defineSkill` | `eve/skills` | `agent/skills/<name>.ts` | [Skills](../skills) |
42
- | `defineInstructions` | `eve/instructions` | `agent/instructions.ts` | [Instructions](../instructions) |
43
- | `defineHook` | `eve/hooks` | `agent/hooks/<slug>.ts` | [Hooks](../advanced/hooks) |
44
- | `defineSchedule` | `eve/schedules` | `agent/schedules/<name>.ts` | [Schedules](../schedules) |
45
- | `defineState` | `eve/context` | tools, hooks, lifecycle | [Session context](../advanced/session-context) |
46
- | `defineSandbox` | `eve/sandbox` | `agent/sandbox.ts` | [Sandbox](../sandbox) |
47
- | `defineInstrumentation` | `eve/instrumentation` | `agent/instrumentation.ts` | [instrumentation.ts](../advanced/instrumentation) |
48
- | `defineRemoteAgent` | `eve` | `agent/subagents/<id>/agent.ts` | [Remote agents](../advanced/remote-agents) |
49
- | `defineEval` | `eve/evals` | `evals/*.eval.ts` | [Evals](../evals/overview) |
50
- | `defineEvalConfig` | `eve/evals` | `evals/evals.config.ts` | [Evals](../evals/overview) |
51
- | `useEveAgent` | `eve/react`, `eve/vue`, `eve/svelte` | frontend | [Frontend](../frontend/overview) |
52
-
53
- A few non-`define*` helpers round out the set: `disableTool` and `ExperimentalWorkflow` from `eve/tools` (see [Default harness](../advanced/default-harness)), the route verbs `GET`/`POST`/`PUT`/`PATCH`/`DELETE`/`WS` from `eve/channels`, the approval predicates `always`/`once`/`never` from `eve/tools/approval`, and the channel auth helpers `localDev`/`vercelOidc`/`placeholderAuth` from `eve/channels/auth`. To wrap a built-in tool, import its default value from `eve/tools/defaults` (`bash`, `readFile`, `writeFile`, `glob`, `grep`, `webFetch`, `webSearch`, `todo`, `loadSkill`).
33
+ | Helper | Import from | Authored at | Guide |
34
+ | ------------------------------------------------------ | --------------------------------------------- | ------------------------------------ | ------------------------------------------------------ |
35
+ | `defineAgent` | `eve` | `agent/agent.ts` | [agent.ts](../agent-config) |
36
+ | `defineTool` | `eve/tools` | `agent/tools/<name>.ts` | [Tools](../tools) |
37
+ | `defineDynamic` | `eve/tools`, `eve/skills`, `eve/instructions` | `agent/{tools,skills,instructions}/` | [Dynamic capabilities](../guides/dynamic-capabilities) |
38
+ | `defineMcpClientConnection`, `defineOpenAPIConnection` | `eve/connections` | `agent/connections/<name>.ts` | [Connections](../connections) |
39
+ | `defineChannel` | `eve/channels` | `agent/channels/<name>.ts` | [Custom channels](../channels/custom) |
40
+ | `eveChannel`, `slackChannel`, and the other platforms | `eve/channels/<platform>` | `agent/channels/<platform>.ts` | [Channels](../channels/overview) |
41
+ | `defineSkill` | `eve/skills` | `agent/skills/<name>.ts` | [Skills](../skills) |
42
+ | `defineInstructions` | `eve/instructions` | `agent/instructions.ts` | [Instructions](../instructions) |
43
+ | `defineHook` | `eve/hooks` | `agent/hooks/<slug>.ts` | [Hooks](../guides/hooks) |
44
+ | `defineSchedule` | `eve/schedules` | `agent/schedules/<name>.ts` | [Schedules](../schedules) |
45
+ | `defineState` | `eve/context` | tools, hooks, lifecycle | [Session context](../guides/session-context) |
46
+ | `defineSandbox` | `eve/sandbox` | `agent/sandbox.ts` | [Sandbox](../sandbox) |
47
+ | `defineInstrumentation` | `eve/instrumentation` | `agent/instrumentation.ts` | [instrumentation.ts](../guides/instrumentation) |
48
+ | `defineRemoteAgent` | `eve` | `agent/subagents/<id>/agent.ts` | [Remote agents](../guides/remote-agents) |
49
+ | `defineEval` | `eve/evals` | `evals/*.eval.ts` | [Evals](../evals/overview) |
50
+ | `defineEvalConfig` | `eve/evals` | `evals/evals.config.ts` | [Evals](../evals/overview) |
51
+ | `useEveAgent` | `eve/react`, `eve/vue`, `eve/svelte` | frontend | [Frontend](../guides/frontend/overview) |
52
+
53
+ A few non-`define*` helpers round out the set: `disableTool` and `ExperimentalWorkflow` from `eve/tools` (see [Default harness](../concepts/default-harness)), the route verbs `GET`/`POST`/`PUT`/`PATCH`/`DELETE`/`WS` from `eve/channels`, the approval predicates `always`/`once`/`never` from `eve/tools/approval`, and the channel auth helpers `localDev`/`vercelOidc`/`placeholderAuth` from `eve/channels/auth`. To wrap a built-in tool, import its default value from `eve/tools/defaults` (`bash`, `readFile`, `writeFile`, `glob`, `grep`, `webFetch`, `webSearch`, `todo`, `loadSkill`).
54
54
 
55
55
  ## Runtime context (`ctx`)
56
56
 
57
- `ctx` is passed to your tool `execute`, hook handlers, and channel event handlers. It is live only while authored code is actually running, so reaching for it at module top level throws. See [Session context](../advanced/session-context) for the full model.
57
+ `ctx` is passed to your tool `execute`, hook handlers, and channel event handlers. It is live only while authored code is actually running, so reaching for it at module top level throws. See [Session context](../guides/session-context) for the full model.
58
58
 
59
59
  | Member | Use |
60
60
  | -------------------------- | ----------------------------------------------------------------------------- |
@@ -90,7 +90,7 @@ A few non-`define*` helpers round out the set: `disableTool` and `ExperimentalWo
90
90
  | `eve/evals/loaders` | `loadJson`, `loadYaml` |
91
91
  | `eve/react`, `eve/vue`, `eve/svelte` | `useEveAgent` |
92
92
  | `eve/next`, `eve/nuxt`, `eve/sveltekit` | framework bundler plugins |
93
- | [`eve/client`](../client/overview) | `Client`, `ClientSession` |
93
+ | [`eve/client`](../guides/client/overview) | `Client`, `ClientSession` |
94
94
 
95
95
  Exported types ship from the same entrypoint as the helper they describe (for example `ToolDefinition` and `ToolContext` from `eve/tools`). For the exhaustive list, read `packages/eve/src/public/index.ts`.
96
96
 
@@ -196,5 +196,5 @@ The `"*": []` catch-all keeps general egress open while the `transform` applies
196
196
 
197
197
  - [Subagents](./subagents): each subagent gets its own sandbox, independent of its parent.
198
198
  - [Tools](./tools): authored tools run in the app runtime (full `process.env`); only sandbox tools run in the sandbox.
199
- - [Security model](./advanced/security-model): the app-runtime/sandbox trust boundary in full.
199
+ - [Security model](./concepts/security-model): the app-runtime/sandbox trust boundary in full.
200
200
  - [Vercel Sandbox](https://vercel.com/docs/sandbox): platform docs, including credential brokering and persistence limits.
@@ -90,7 +90,7 @@ curl -X POST http://localhost:3000/eve/v1/dev/schedules/heartbeat
90
90
  # -> { "scheduleId": "heartbeat", "sessionIds": ["..."] }
91
91
  ```
92
92
 
93
- `:scheduleId` is the path-derived schedule name (`agent/schedules/heartbeat.ts` → `heartbeat`; URL-encode the `/` in nested names). It runs the exact dispatch path the production cron handler uses and returns the started session ids as JSON, so you can subscribe to each one’s [stream](./advanced/sessions-runs-and-streaming) at `GET /eve/v1/session/:sessionId/stream`. An unknown id comes back `404` with `availableScheduleIds`, listing the schedules the app actually defines.
93
+ `:scheduleId` is the path-derived schedule name (`agent/schedules/heartbeat.ts` → `heartbeat`; URL-encode the `/` in nested names). It runs the exact dispatch path the production cron handler uses and returns the started session ids as JSON, so you can subscribe to each one’s [stream](./concepts/sessions-runs-and-streaming) at `GET /eve/v1/session/:sessionId/stream`. An unknown id comes back `404` with `availableScheduleIds`, listing the schedules the app actually defines.
94
94
 
95
95
  The route is dev-only. Production builds never mount it, and it needs no auth since the dev server is local-only.
96
96
 
@@ -101,4 +101,4 @@ Hosted Vercel builds turn every `defineSchedule(...)` into a Vercel Cron Job, wi
101
101
  ## What to read next
102
102
 
103
103
  - Deliver schedule output to users → [Channels](./channels/overview)
104
- - Inspect a schedule run → [Sessions, runs & streaming](./advanced/sessions-runs-and-streaming)
104
+ - Inspect a schedule run → [Sessions, runs & streaming](./concepts/sessions-runs-and-streaming)
@@ -70,10 +70,10 @@ The handle exposes the skill's `name` and `file(relativePath)`; file content is
70
70
 
71
71
  ## Dynamic skills
72
72
 
73
- Want a different skill per principal, tenant, or channel, like the caller's own team playbook? Wrap `defineSkill` in a `defineDynamic` resolver keyed on `ctx.session.auth`. See [Dynamic capabilities](./advanced/dynamic-capabilities).
73
+ Want a different skill per principal, tenant, or channel, like the caller's own team playbook? Wrap `defineSkill` in a `defineDynamic` resolver keyed on `ctx.session.auth`. See [Dynamic capabilities](./guides/dynamic-capabilities).
74
74
 
75
75
  ## What to read next
76
76
 
77
77
  - [Connections](./connections): add tools from external MCP and OpenAPI servers
78
- - [Dynamic capabilities](./advanced/dynamic-capabilities): resolve skills per caller with `defineDynamic`
79
- - [Context control](./advanced/context-control): how skills fit the full context model
78
+ - [Dynamic capabilities](./guides/dynamic-capabilities): resolve skills per caller with `defineDynamic`
79
+ - [Context control](./concepts/context-control): how skills fit the full context model
@@ -62,7 +62,7 @@ The built-in `agent` tool is the exception: its children share the parent's sand
62
62
 
63
63
  ## What the parent sees
64
64
 
65
- Eve lowers every subagent (built-in copy, declared, or [remote](./advanced/remote-agents)) into a model-visible tool with the same `{ message, outputSchema? }` shape. The parent packs `message` with everything the child needs, since the child never sees the parent's history. Set `outputSchema` and the child runs in task mode, returning structured output as the tool result.
65
+ Eve lowers every subagent (built-in copy, declared, or [remote](./guides/remote-agents)) into a model-visible tool with the same `{ message, outputSchema? }` shape. The parent packs `message` with everything the child needs, since the child never sees the parent's history. Set `outputSchema` and the child runs in task mode, returning structured output as the tool result.
66
66
 
67
67
  Each delegated subagent spins up its own child session and stream. The parent stream carries only the control-plane events `subagent.called` and `subagent.completed`. To follow the child's full progress, read `subagent.called.data.childSessionId` and subscribe at `GET /eve/v1/session/:childSessionId/stream`.
68
68
 
@@ -72,5 +72,5 @@ Split out a subagent when the task needs a different prompt or specialist role,
72
72
 
73
73
  ## What to read next
74
74
 
75
- - Call another Eve deployment as a subagent → [Remote agents](./advanced/remote-agents)
76
- - Have the model orchestrate its subagents programmatically (fan-out, map-reduce) → [Dynamic workflows](./advanced/dynamic-workflows)
75
+ - Call another Eve deployment as a subagent → [Remote agents](./guides/remote-agents)
76
+ - Have the model orchestrate its subagents programmatically (fan-out, map-reduce) → [Dynamic workflows](./guides/dynamic-workflows)
@@ -85,7 +85,7 @@ Approvals and questions share one protocol:
85
85
 
86
86
  The run picks back up exactly where it parked, and channels render the request for you. The Slack adapter, for example, turns approvals into buttons and questions into select menus.
87
87
 
88
- See [Sessions, runs & streaming](./advanced/sessions-runs-and-streaming) for the event and resume contract.
88
+ See [Sessions, runs & streaming](./concepts/sessions-runs-and-streaming) for the event and resume contract.
89
89
 
90
90
  ## Shape what the model sees with `toModelOutput`
91
91
 
@@ -102,6 +102,6 @@ It receives the full, typed `execute` return and only affects the model. Channel
102
102
  ## What to read next
103
103
 
104
104
  - [Skills](./skills): on-demand procedures the model loads when relevant
105
- - [Default harness](./advanced/default-harness): the built-in tools and how to override or disable them
106
- - [Dynamic capabilities](./advanced/dynamic-capabilities): tools whose set is resolved per session with `defineDynamic`
107
- - [Auth & route protection](./advanced/auth-and-route-protection): authenticate a tool to an external service
105
+ - [Default harness](./concepts/default-harness): the built-in tools and how to override or disable them
106
+ - [Dynamic capabilities](./guides/dynamic-capabilities): tools whose set is resolved per session with `defineDynamic`
107
+ - [Auth & route protection](./guides/auth-and-route-protection): authenticate a tool to an external service
@@ -1,5 +1,5 @@
1
1
  ---
2
- title: "Step 4: Connect a warehouse"
2
+ title: "Step 4: Connect a Warehouse"
3
3
  description: "Let each user connect their own warehouse over an OAuth MCP via Vercel Connect."
4
4
  ---
5
5
 
@@ -44,4 +44,4 @@ If you want more control, gate the connection behind approval (`approval: once()
44
44
 
45
45
  → Next: [Step 5: Run analysis](./run-analysis)
46
46
 
47
- Depth: [Connections](../connections) · [Auth & route protection](../advanced/auth-and-route-protection)
47
+ Depth: [Connections](../connections) · [Auth & route protection](../guides/auth-and-route-protection)
@@ -1,5 +1,5 @@
1
1
  ---
2
- title: "Step 1: Your first agent"
2
+ title: "Step 1: Your First Agent"
3
3
  description: "Scaffold the analytics assistant, give it an analyst persona, run it, and ask a question."
4
4
  ---
5
5
 
@@ -1,5 +1,5 @@
1
1
  ---
2
- title: "Step 8: Guard the spend"
2
+ title: "Step 8: Guard the Spend"
3
3
  description: "Gate expensive queries with cost-based approval: the agent pauses, asks, and resumes."
4
4
  ---
5
5
 
@@ -1,5 +1,5 @@
1
1
  ---
2
- title: "Step 2: How it runs"
2
+ title: "Step 2: How It Runs"
3
3
  description: "Session, turn, and durable steps: what you just watched, and why it survives a crash."
4
4
  ---
5
5
 
@@ -21,4 +21,4 @@ Your job is to author capabilities: tools, instructions, channels, skills. Eve d
21
21
 
22
22
  → Next: [Step 3: Query sample data](./query-sample-data)
23
23
 
24
- Depth: [Execution model & durability](../advanced/execution-model-and-durability)
24
+ Depth: [Execution model & durability](../concepts/execution-model-and-durability)
@@ -1,5 +1,5 @@
1
1
  {
2
- "title": "Build an agent",
2
+ "title": "Build an Agent",
3
3
  "pages": [
4
4
  "first-agent",
5
5
  "how-it-runs",
@@ -1,5 +1,5 @@
1
1
  ---
2
- title: "Step 3: Query sample data"
2
+ title: "Step 3: Query Sample Data"
3
3
  description: "Add a run_sql tool over the bundled sample dataset and watch the tool loop."
4
4
  ---
5
5
 
@@ -1,5 +1,5 @@
1
1
  ---
2
- title: "Step 6: Remember definitions"
2
+ title: "Step 6: Remember Definitions"
3
3
  description: "Use defineState to remember the team's metric glossary across turns."
4
4
  ---
5
5
 
@@ -65,8 +65,8 @@ export default defineTool({
65
65
 
66
66
  The second turn is a separate turn in the same session, yet the definition is still there. State checkpoints at step boundaries, so it's the same durability from [Step 2](./how-it-runs), now applied to your own data.
67
67
 
68
- State is scoped to a session and isolated per agent, so a subagent starts with fresh state and never sees the parent's. Need to reset something each turn? Call `update(() => fresh)` in a lifecycle hook. More in [State](../advanced/state).
68
+ State is scoped to a session and isolated per agent, so a subagent starts with fresh state and never sees the parent's. Need to reset something each turn? Call `update(() => fresh)` in a lifecycle hook. More in [State](../guides/state).
69
69
 
70
70
  → Next: [Step 7: Team playbooks](./team-playbooks)
71
71
 
72
- Depth: [State](../advanced/state)
72
+ Depth: [State](../guides/state)
@@ -1,5 +1,5 @@
1
1
  ---
2
- title: "Step 5: Run analysis"
2
+ title: "Step 5: Run Analysis"
3
3
  description: "Seed the warehouse schema into the sandbox workspace, then compute and chart beyond SQL."
4
4
  ---
5
5
 
@@ -1,5 +1,5 @@
1
1
  ---
2
- title: "Step 9: Ship it"
2
+ title: "Step 9: Ship It"
3
3
  description: "Put a web dashboard on the agent with useEveAgent, replace placeholderAuth, and deploy to Vercel."
4
4
  ---
5
5
 
@@ -51,7 +51,7 @@ export function AnalyticsChat() {
51
51
  }
52
52
  ```
53
53
 
54
- `agent.data.messages` and `agent.status` cover most chat UIs. The hook also surfaces HITL prompts (the spend approval from [Step 8](./guard-the-spend)), so the dashboard can render approve/deny controls. Full API: [Frontend](../frontend/overview).
54
+ `agent.data.messages` and `agent.status` cover most chat UIs. The hook also surfaces HITL prompts (the spend approval from [Step 8](./guard-the-spend)), so the dashboard can render approve/deny controls. Full API: [Frontend](../guides/frontend/overview).
55
55
 
56
56
  ## Replace `placeholderAuth`
57
57
 
@@ -95,6 +95,6 @@ eve dev https://your-analytics-app.vercel.app
95
95
 
96
96
  That's the full assistant, deployed and authed. It queries the warehouse, runs analysis in a sandbox, charts the results, remembers your team's definitions, loads the right playbook per team, and asks before it spends.
97
97
 
98
- Depth: [Frontend](../frontend/overview) · [Auth & route protection](../advanced/auth-and-route-protection) · [Deployment](../advanced/deployment)
98
+ Depth: [Frontend](../guides/frontend/overview) · [Auth & route protection](../guides/auth-and-route-protection) · [Deployment](../guides/deployment)
99
99
 
100
- Go deeper on this same example in [Advanced](../advanced/dynamic-capabilities): schema-derived dynamic tools, a read-only analyst subagent, and model-authored report workflows.
100
+ Go deeper on this same example in [Advanced](../guides/dynamic-capabilities): schema-derived dynamic tools, a read-only analyst subagent, and model-authored report workflows.
@@ -1,5 +1,5 @@
1
1
  ---
2
- title: "Step 7: Team playbooks"
2
+ title: "Step 7: Team Playbooks"
3
3
  description: "Load the caller's team playbook with a dynamic skill keyed on the principal."
4
4
  ---
5
5
 
@@ -56,8 +56,8 @@ A Growth user asks "what's our 8-week retention?" The model sees the playbook fi
56
56
 
57
57
  The team comes from authenticated claims, not from the message, so one tenant can't borrow another's playbook by asking nicely. (Those `attributes` are set by the auth layer in [Step 9](./ship-it).)
58
58
 
59
- The same `defineDynamic` resolver drives dynamic tools and instructions too. For the full mechanism, see [Dynamic capabilities](../advanced/dynamic-capabilities).
59
+ The same `defineDynamic` resolver drives dynamic tools and instructions too. For the full mechanism, see [Dynamic capabilities](../guides/dynamic-capabilities).
60
60
 
61
61
  → Next: [Step 8: Guard the spend](./guard-the-spend)
62
62
 
63
- Depth: [Skills](../skills) · [Dynamic capabilities](../advanced/dynamic-capabilities)
63
+ Depth: [Skills](../skills) · [Dynamic capabilities](../guides/dynamic-capabilities)
@@ -1 +1 @@
1
- function createPromptCommandHandler(e){return{async handle(t,n){let r=e.appRoot;if(r===void 0)return{message:`/${t.name} needs eve dev running the local server (it is not available with --url).`};if(t.name===`model`&&t.argument.length>0){let{changeAgentModel:n,formatApplyModelOutcome:i}=await import(`#setup/flows/model.js`),a=e.applyModel??n;try{return{message:i(await a({appRoot:r,slug:t.argument}))}}catch(e){return{message:`Couldn't change the model: ${e instanceof Error?e.message:String(e)}`}}}let i=n.renderer.setupFlow;if(i===void 0)return{message:`/${t.name} is not supported by this renderer.`};let{runTuiSetupCommand:a,SETUP_FLOW_TITLES:o}=await import(`./setup-commands.js`);i.begin(o[t.name]);let s=!0;try{let n={command:t.name,appRoot:r,renderer:i};e.flows!==void 0&&(n.flows=e.flows);let o=await a(n);s=o.preserveFlowDiagnostics;let c={message:o.message};return o.vercelEffect!==void 0&&(c.vercelEffect=o.vercelEffect),c}finally{i.end({preserveDiagnostics:s})}}}}export{createPromptCommandHandler};
1
+ import{toErrorMessage}from"#shared/errors.js";function createPromptCommandHandler(t){return{async handle(n,r){let i=t.appRoot;if(i===void 0)return{message:`/${n.name} needs eve dev running the local server (it is not available with --url).`};if(n.name===`model`&&n.argument.length>0)try{let{changeAgentModel:e,formatApplyModelOutcome:r}=await import(`#setup/flows/model.js`);return{message:r(await(t.applyModel??e)({appRoot:i,slug:n.argument}))}}catch(t){return{message:`Couldn't change the model: ${toErrorMessage(t)}`}}let a=r.renderer.setupFlow;if(a===void 0)return{message:`/${n.name} is not supported by this renderer.`};let o;try{o=await import(`./setup-commands.js`)}catch(t){return{message:`/${n.name} failed: ${toErrorMessage(t)}`}}let{runTuiSetupCommand:s,SETUP_FLOW_TITLES:c}=o;a.begin(c[n.name]);let l=!0;try{let e={command:n.name,appRoot:i,renderer:a};t.flows!==void 0&&(e.flows=t.flows);let r=await s(e);l=r.preserveFlowDiagnostics;let o={message:r.message};return r.vercelEffect!==void 0&&(o.vercelEffect=r.vercelEffect),o}finally{a.end({preserveDiagnostics:l})}}}}export{createPromptCommandHandler};
@@ -194,8 +194,8 @@ export type AgentTUIRenderer = {
194
194
  */
195
195
  reset?(): void;
196
196
  /**
197
- * Tears down interactive mode and restores the terminal, as if the user
198
- * pressed Ctrl+C. Used by the `/exit` command.
197
+ * Tears down interactive mode and restores the terminal when the runner's
198
+ * lifecycle ends.
199
199
  */
200
200
  shutdown?(): void;
201
201
  };
@@ -1 +1 @@
1
- import{pickAgentHeaderTip}from"./agent-header.js";import{formatPromptCommandHelp,parsePromptCommand}from"./prompt-commands.js";import{failureKey,formatFailureDetail,formatFailureMessage,formatGatewayAuthFailureNotice,isAbortLikeError,isGatewayAuthFailure,isInterruptedError}from"./errors.js";import{BOOT_DETECTIONS,detectSetupIssues,formatSetupIssuesLine}from"./setup-issues.js";import{TerminalRenderer}from"./terminal-renderer.js";import{createVercelStatusTracker}from"./vercel-status.js";import{isCurrentTurnBoundaryEvent}from"#client/index.js";import{createDevelopmentRuntimeArtifactSessionRefresher}from"#services/dev-client.js";import{toErrorMessage}from"#shared/errors.js";var EveTUIRunner=class{#e;#t;#n;#r;#i;#a;#o;#s;#c;#l;#u;#d;#f;#p;#m;#h;#g;#_=pickAgentHeaderTip();#v;#y=new Map;#b=new Map;#x=new Map;#S=new Map;#C=new Set;#w=!1;constructor(e){if(this.#e=e.session,e.client!==void 0&&(this.#t=e.client),this.#n=createRenderer(e),this.#r=e.name??`Eve`,this.#i=e.tools??`full`,this.#a=e.reasoning??`full`,this.#o=e.subagents??`full`,this.#s=e.connectionAuth??`full`,this.#c=e.assistantResponseStats??`tokensPerSecond`,this.#l=e.contextSize,this.#u=e.formatTransportError??toErrorMessage,e.appRoot!==void 0){this.#p=e.appRoot;let t={appRoot:e.appRoot,onChange:e=>this.#n.setVercelStatus?.(e)};e.detectProjectIdentity!==void 0&&(t.detectIdentity=e.detectProjectIdentity),this.#g=createVercelStatusTracker(t)}e.promptCommandHandler!==void 0&&(this.#m=e.promptCommandHandler),this.#h=e.bootDetections??BOOT_DETECTIONS,e.serverUrl!==void 0&&(this.#f=e.serverUrl,this.#d=createDevelopmentRuntimeArtifactSessionRefresher({serverUrl:e.serverUrl}))}async#T(){let e=this.#f;if(e===void 0){await this.#A(void 0);return}let t;try{t=await this.#t?.info()}catch{t=void 0}this.#v=t;let n={name:this.#r,serverUrl:e};t!==void 0&&(n.info=t),this.#p!==void 0&&(n.tip=this.#_),this.#n.renderAgentHeader?.(n),await this.#A(t)}async run(){try{await this.#E()}finally{this.#g?.dispose()}}async#E(){let e=this.#r,r,i,a=!1,o=!1;for(await this.#T(),this.#g?.refreshIdentity();;){if(!o){if(r==null){if(!this.#n.readPrompt){if(a)return;throw Error(`No prompt was provided and the renderer does not support prompt input.`)}try{r=await this.#O({title:e})}catch(e){if(isInterruptedError(e))return;throw e}if(r==null)return}let s=parsePromptCommand(r);if(s?.type===`exit`){this.#n.shutdown?.();return}if(s?.type===`new`){this.#D(),i=void 0,o=!1,r=void 0,this.#n.reset?.();continue}if(s?.type===`help`){this.#j(formatPromptCommandHelp()),i=void 0,o=!1,r=void 0;continue}if(s?.type===`loglevel`){this.#j(this.#M(s.argument)),i=void 0,o=!1,r=void 0;continue}if(s?.type===`extension`){try{let t=this.#m===void 0?{message:`/${s.name} is not available in this session.`}:await this.#m.handle(s,{renderer:this.#n,title:e});t?.message!==void 0&&this.#j(t.message),t?.vercelEffect!==void 0&&this.#g?.applyEffect(t.vercelEffect)}catch(e){if(isInterruptedError(e))return;throw e}i=void 0,r=void 0,o=!1;continue}a=!0}let s=await this.#k({prompt:o?void 0:r,inputResponses:i});try{await this.#n.renderStream(s,{title:e,submittedPrompt:r,continueSession:!!this.#n.readPrompt,tools:this.#i,reasoning:this.#a,subagents:this.#o,connectionAuth:this.#s,assistantResponseStats:this.#c,contextSize:this.#l});let t=s.turnState?.pendingApprovals??[],n=s.turnState?.pendingQuestions??[];if(t.length>0||n.length>0){let a=[];if(t.length>0){if(!this.#n.readToolApproval)throw Error(`Tool approval was requested, but the renderer does not support tool approval input.`);for(let n of t){let t=await this.#n.readToolApproval(n,{title:e});a.push({requestId:n.approvalId,optionId:t.approved?`approve`:`deny`}),this.#y.delete(n.approvalId)}}if(n.length>0){if(!this.#n.readInputQuestion)throw Error(`An interactive question was requested, but the renderer does not support input questions.`);for(let t of n){let n=toAgentTUIInputQuestion(t),r=await this.#n.readInputQuestion(n,{title:e});if(r===void 0)continue;let i={requestId:t.requestId};r.optionId!==void 0&&(i.optionId=r.optionId),r.text!==void 0&&(i.text=r.text),a.push(i),this.#y.delete(t.requestId)}}o=!0,i=a,r=void 0;continue}s.turnState&&s.turnState.boundaryEvent===void 0&&(this.#w=!0)}catch(e){if(isInterruptedError(e))return;throw e}o=!1,i=void 0,r=void 0,this.#w&&(this.#w=!1,this.#D(),this.#n.renderNotice?.(`Session ended — started a new session. Earlier context was cleared.`))}}#D(){for(let e of this.#x.values())e.abort();this.#x.clear(),this.#b.clear(),this.#y.clear(),this.#S.clear(),this.#C.clear(),this.#t&&(this.#e=this.#t.session()),this.#d?.clear()}async#O(e){if(!this.#n.readPrompt)return;let t=this.#n.readPrompt(e),n=this.#t,r=this.#d;if(n===void 0||r===void 0)return await t;let i=!1,a=!1,o,refresh=async()=>{if(!(i||a)){a=!0;try{this.#e=await r.refreshIdle({createSession:()=>n.session(),onRuntimeArtifactsChanged:()=>this.#N(),session:this.#e})}finally{a=!1}}},startRefresh=()=>{if(i||a)return;let e=refresh().finally(()=>{o===e&&(o=void 0)});o=e};startRefresh();let s=setInterval(()=>{startRefresh()},500);s.unref?.();try{return await t}finally{i=!0,clearInterval(s),await o}}async#k(e){let t=new AbortController,n={signal:t.signal};e.prompt!==void 0&&(n.message=e.prompt),e.inputResponses!==void 0&&e.inputResponses.length>0&&(n.inputResponses=e.inputResponses);let r;try{let e=this.#t;e!==void 0&&this.#d!==void 0&&(this.#e=await this.#d.refresh({createSession:()=>e.session(),inputResponses:n.inputResponses,message:n.message,onRuntimeArtifactsChanged:()=>this.#N(),session:this.#e})),r=await this.#e.send(n)}catch(e){if(isInterruptedError(e))throw e;return this.#w=!0,{events:errorOnlyTUIStream({errorText:this.#u(e)}),turnState:createTurnState()}}let i=createTurnState();return{abort:()=>t.abort(),events:eveEventsToTUIStream({events:r,pendingInputRequests:this.#y,subagentRuns:this.#b,turnState:i,onSubagentCalled:e=>this.#L(e),onSubagentCompleted:e=>this.#z(e),onConnectionAuthRequired:e=>this.#P(e),onConnectionAuthCompleted:e=>this.#F(e),onTerminalFailure:()=>{this.#w=!0},failureOverride:this.#p===void 0?void 0:e=>isGatewayAuthFailure(e)?formatGatewayAuthFailureNotice(e):void 0}),turnState:i}}async#A(e){if(this.#p===void 0||this.#n.renderSetupWarning===void 0)return;let t={appRoot:this.#p,env:process.env};e!==void 0&&(t.info=e);let n=await detectSetupIssues(t,this.#h);n.length!==0&&this.#n.renderSetupWarning(formatSetupIssuesLine(n))}#j(e){if(this.#n.renderCommandResult!==void 0){this.#n.renderCommandResult(e);return}this.#n.renderNotice?.(e)}#M(e){let t=this.#n;if(t.logDisplayMode===void 0||t.setLogDisplayMode===void 0)return`/loglevel is not available in this session.`;if(e===``)return`Logs: ${t.logDisplayMode()}. Use /loglevel all|stderr|none — logs stay buffered, so switching also hides or restores past lines.`;let n=parseLogDisplayMode(e);if(n===void 0)return`Unknown log level "${e}". Use all, stderr, or none.`;if(n===t.logDisplayMode())return`Logs already set to ${n}.`;switch(t.setLogDisplayMode(n),n){case`none`:return`Logs hidden. Output stays buffered — /loglevel all restores it.`;case`stderr`:return`Showing stderr logs only.`;case`all`:return`Showing all logs.`}}async#N(){let e=this.#v,t;try{t=await this.#t?.info()}catch{t=void 0}if(t!==void 0&&(this.#v=t,this.#f!==void 0)){let e={info:t,name:this.#r,serverUrl:this.#f};this.#p!==void 0&&(e.tip=this.#_),this.#n.renderAgentHeader?.(e)}(!this.#n.renderAgentHeader||t===void 0)&&this.#n.renderNotice?.(formatAgentUpdateNotice(e,t))}#P(e){let t={name:e.data.name,description:e.data.description,state:`required`};e.data.authorization!==void 0&&(t.challenge=e.data.authorization),e.data.webhookUrl!==void 0&&(t.webhookUrl=e.data.webhookUrl),this.#S.set(e.data.name,t),this.#I(t)}#F(e){let t=this.#S.get(e.data.name)??{name:e.data.name,description:``,state:e.data.outcome};t.state=e.data.outcome,e.data.reason!==void 0&&(t.reason=e.data.reason),this.#S.set(e.data.name,t),this.#C.delete(e.data.name),this.#I(t),this.#n.setConnectionAuthPendingCount?.(this.#C.size)}#I(e){let t={name:e.name,description:e.description,state:e.state};e.challenge!==void 0&&(t.challenge=e.challenge),e.reason!==void 0&&(t.reason=e.reason),this.#n.upsertConnectionAuth?.(t)}#L(e){let t=e.data.callId;if(this.#x.has(t))return;let n=this.#t;if(!n)return;let r=new AbortController;this.#x.set(t,r),(async()=>{try{let i=n.session({sessionId:e.data.childSessionId,streamIndex:0}).stream({signal:r.signal});for await(let e of i)if(r.signal.aborted||(this.#B(t,e),isCurrentTurnBoundaryEvent(e)))break}catch(e){if(!isAbortLikeError(e)){let n=toErrorMessage(e),r=this.#b.get(t);if(r){let{key:e,step:i}=openCurrentSubagentSection(r);i.message=i.message?`${i.message}\n\nstream error: ${n}`:`stream error: ${n}`,i.finalized=!0,r.currentSectionKey=null,this.#n.upsertSubagentStep?.({callId:t,subagentName:r.name,sectionKey:e,reasoning:i.reasoning,message:i.message,finalized:!0})}}}finally{this.#x.delete(t)}})()}#R(e,t,n){let r=t.tools.get(n.childCallId),i=r??{toolName:n.toolName,input:n.input,status:n.status};if(r){let e={"approval-requested":0,executing:1,done:2,failed:2};e[n.status]>e[r.status]&&(r.status=n.status),r.input=n.input}else t.tools.set(n.childCallId,i);this.#n.markChildToolCallId?.(n.childCallId),this.#n.upsertSubagentTool?.({callId:e,subagentName:t.name,childCallId:n.childCallId,toolName:i.toolName,input:i.input,status:i.status})}#z(e){let t=this.#b.get(e);if(t){for(let[n,r]of t.steps)r.finalized||(r.finalized=!0,this.#n.upsertSubagentStep?.({callId:e,subagentName:t.name,sectionKey:n,reasoning:r.reasoning,message:r.message,finalized:!0}));t.currentSectionKey=null}}#B(e,t){let n=this.#b.get(e);if(!n)return;let r=this.#n,emit=(t,i)=>{r.upsertSubagentStep?.({callId:e,subagentName:n.name,sectionKey:t,reasoning:i.reasoning,message:i.message,finalized:i.finalized})},finalizeCurrent=()=>{if(n.currentSectionKey===null)return;let e=n.steps.get(n.currentSectionKey);e&&(e.finalized=!0,emit(n.currentSectionKey,e)),n.currentSectionKey=null};switch(t.type){case`reasoning.appended`:{let{key:e,step:r}=openCurrentSubagentSection(n);r.reasoning+=t.data.reasoningDelta,emit(e,r);break}case`reasoning.completed`:break;case`message.appended`:{let{key:e,step:r}=openCurrentSubagentSection(n);r.message+=t.data.messageDelta,emit(e,r);break}case`message.completed`:{let{key:e,step:r}=openCurrentSubagentSection(n);t.data.message!==null&&r.message.length===0&&(r.message=t.data.message),r.finalized=!0,emit(e,r),n.currentSectionKey=null;break}case`step.completed`:finalizeCurrent();break;case`actions.requested`:finalizeCurrent();for(let r of t.data.actions)r.kind===`tool-call`&&this.#R(e,n,{childCallId:r.callId,toolName:r.toolName,input:r.input,status:`executing`});break;case`input.requested`:finalizeCurrent();for(let r of t.data.requests)r.action.kind===`tool-call`&&this.#R(e,n,{childCallId:r.action.callId,toolName:r.action.toolName,input:r.action.input,status:`approval-requested`});break;case`action.result`:{let i=t.data.result;if(i.kind!==`tool-result`)break;let a=n.tools.get(i.callId);if(!a)break;t.data.status===`failed`?(a.status=`failed`,a.errorText=formatActionResultError(t)):(a.status=`done`,a.output=i.output);let o={callId:e,subagentName:n.name,childCallId:i.callId,toolName:a.toolName,input:a.input,status:a.status};a.output!==void 0&&(o.output=a.output),a.errorText!==void 0&&(o.errorText=a.errorText),r.upsertSubagentTool?.(o);break}default:break}}};function createRenderer(e){return e.renderer?e.renderer:new TerminalRenderer({tools:e.tools,reasoning:e.reasoning,subagents:e.subagents,connectionAuth:e.connectionAuth,assistantResponseStats:e.assistantResponseStats,contextSize:e.contextSize,logs:e.logs,input:e.userInput,output:e.screen})}function parseLogDisplayMode(e){return e===`all`||e===`stderr`||e===`none`?e:void 0}function formatAgentUpdateNotice(e,t){let n=e?.agent.model.id,r=t?.agent.model.id;return n!==void 0&&r!==void 0&&n!==r?`Agent updated: Model ${n} -> ${r}`:`Agent updated.`}async function*eveEventsToTUIStream(e){let{events:t,pendingInputRequests:n,subagentRuns:r,turnState:i,onSubagentCalled:a,onSubagentCompleted:o,onConnectionAuthRequired:s,onConnectionAuthCompleted:c,onTerminalFailure:l,failureOverride:u}=e,d=new Map,f=new Map,p=0,m=new Set,h=new Set,g=new Set,_=new Set,v=!1,y=!1,b;for await(let e of t)if(!(y&&isPostTurnVisibleEvent(e)))switch(e.type){case`session.started`:case`turn.started`:case`message.received`:break;case`step.started`:p+=1,yield{type:`step-start`};break;case`step.completed`:{let t=e;b=t.data.usage,yield*closeOpenParts(d,`assistant-complete`,p),yield*closeOpenParts(f,`reasoning-complete`,p),yield{type:`step-finish`,usage:t.data.usage};break}case`message.appended`:{let t=e,n=textPartId(t.data.turnId,t.data.stepIndex),r=partStateFor(d,n),i=t.data.messageSoFar;if(r.completed){if(r.text.startsWith(i)||p<=r.completedEpoch)break;r.generation+=1,r.text=``,r.completed=!1}if(!i.startsWith(r.text)||i.length<=r.text.length)break;let a=i.slice(r.text.length);r.text=i,yield{type:`assistant-delta`,id:partGenerationId(n,r.generation),delta:a};break}case`message.completed`:{let t=textPartId(e.data.turnId,e.data.stepIndex),n=partStateFor(d,t),r=e.data.message;if(n.completed){if(r===null||r===n.text||p<=n.completedEpoch)break;n.generation+=1,n.text=r,n.completedEpoch=p,yield{type:`assistant-complete`,id:partGenerationId(t,n.generation),text:r};break}let i=partGenerationId(t,n.generation);if(r!==null){if(n.text.length===0)n.text=r,n.completed=!0,n.completedEpoch=p,yield{type:`assistant-complete`,id:i,text:r};else if(r.startsWith(n.text)){let e=r.slice(n.text.length);e.length>0&&(yield{type:`assistant-delta`,id:i,delta:e}),n.text=r,n.completed=!0,n.completedEpoch=p,yield{type:`assistant-complete`,id:i}}}else n.text.length>0&&(n.completed=!0,n.completedEpoch=p,yield{type:`assistant-complete`,id:i});break}case`reasoning.appended`:{let t=e,n=reasoningPartId(t.data.turnId,t.data.stepIndex),r=partStateFor(f,n),i=t.data.reasoningSoFar;if(r.completed){if(r.text.startsWith(i)||p<=r.completedEpoch)break;r.generation+=1,r.text=``,r.completed=!1}if(!i.startsWith(r.text)||i.length<=r.text.length)break;let a=i.slice(r.text.length);r.text=i,yield{type:`reasoning-delta`,id:partGenerationId(n,r.generation),delta:a};break}case`reasoning.completed`:{let t=reasoningPartId(e.data.turnId,e.data.stepIndex),n=partStateFor(f,t),r=e.data.reasoning;if(n.completed){if(r.length===0||r===n.text||n.text.startsWith(r)||p<=n.completedEpoch)break;n.generation+=1,n.text=r,n.completedEpoch=p;let e=partGenerationId(t,n.generation);yield{type:`reasoning-delta`,id:e,delta:r},yield{type:`reasoning-complete`,id:e};break}let i=partGenerationId(t,n.generation);if(n.text.length===0&&r.length>0)n.text=r,yield{type:`reasoning-delta`,id:i,delta:r};else if(r.length>0&&!r.startsWith(n.text))break;n.completed=!0,n.completedEpoch=p,yield{type:`reasoning-complete`,id:i};break}case`actions.requested`:{let t=e.data,n=t.actions.filter(e=>e.kind===`tool-call`);if(n.length===0)break;let r=toolBatchKey(`actions.requested`,t.turnId,t.stepIndex,n);if(g.has(r)){for(let e of n)m.has(e.callId)||h.add(e.callId);break}g.add(r);for(let e of n)m.has(e.callId)||(m.add(e.callId),yield{type:`tool-call`,toolCallId:e.callId,toolName:e.toolName,input:e.input});break}case`input.requested`:{let t=e.data,r=t.requests.filter(e=>e.action.kind===`tool-call`);if(r.length===0)break;let a=inputRequestBatchKey(t.turnId,t.stepIndex,r);if(g.has(a)){for(let e of r)m.has(e.action.callId)||h.add(e.action.callId);break}g.add(a);for(let e of r){let t=e.action.callId;if(m.has(t)||(m.add(t),yield{type:`tool-call`,toolCallId:t,toolName:e.action.toolName,input:e.action.input}),n.set(e.requestId,e),isQuestionRequest(e)){upsertPendingQuestion(i,e);continue}upsertPendingApproval(i,e),yield{type:`tool-approval-request`,approvalId:e.requestId,toolCallId:t}}break}case`action.result`:{let t=e;if(t.data.result.kind!==`tool-result`)break;let n=t.data.result.callId;if(h.has(n)||!m.has(n))break;t.data.status===`failed`?yield{type:`tool-error`,toolCallId:n,errorText:formatActionResultError(t)}:yield{type:`tool-result`,toolCallId:n,output:t.data.result.output};break}case`step.failed`:case`turn.failed`:{let t=toFailureEvent(e,_,u);t&&(yield t);break}case`session.failed`:{i.sawSessionFailure=!0,l?.(e);let t=toFailureEvent(e,_,u);t&&(yield t),i.boundaryEvent=e.type,yield*closeOpenParts(d,`assistant-complete`,p),yield*closeOpenParts(f,`reasoning-complete`,p),yield{type:`finish`,usage:b},v=!0;return}case`session.waiting`:case`session.completed`:i.boundaryEvent=e.type,yield*closeOpenParts(d,`assistant-complete`,p),yield*closeOpenParts(f,`reasoning-complete`,p),yield{type:`finish`,usage:b},v=!0;return;case`turn.completed`:y=!0,yield*closeOpenParts(d,`assistant-complete`,p),yield*closeOpenParts(f,`reasoning-complete`,p);break;case`subagent.called`:{let t=e;if(!r.has(t.data.callId))r.set(t.data.callId,{name:t.data.name,steps:new Map,currentSectionKey:null,nextSectionKey:0,tools:new Map});else{let e=r.get(t.data.callId);e&&(e.name=t.data.name)}a?.(t);break}case`subagent.started`:case`subagent.event`:break;case`subagent.completed`:o?.(e.data.callId);break;case`authorization.required`:s?.(e);break;case`authorization.completed`:c?.(e);break;default:break}v||(yield*closeOpenParts(d,`assistant-complete`,p),yield*closeOpenParts(f,`reasoning-complete`,p),yield{type:`finish`,usage:b})}async function*errorOnlyTUIStream(e){yield{type:`error`,errorText:e.errorText},yield{type:`finish`}}function createTurnState(){return{pendingApprovals:[],pendingQuestions:[],sawSessionFailure:!1}}function upsertPendingApproval(e,t){let n=toAgentTUIToolApprovalRequest(t),r=e.pendingApprovals.findIndex(e=>e.approvalId===n.approvalId);r===-1?e.pendingApprovals.push(n):e.pendingApprovals[r]=n}function toAgentTUIToolApprovalRequest(e){return{approvalId:e.requestId,toolCallId:e.action.callId,toolName:e.action.toolName,input:e.action.input}}function upsertPendingQuestion(e,t){let n=e.pendingQuestions.findIndex(e=>e.requestId===t.requestId);n===-1?e.pendingQuestions.push(t):e.pendingQuestions[n]=t}function textPartId(e,t){return`text:${e}:${t}`}function reasoningPartId(e,t){return`reasoning:${e}:${t}`}function partStateFor(e,t){let n=e.get(t);return n===void 0&&(n={generation:0,text:``,completed:!1,completedEpoch:0},e.set(t,n)),n}function partGenerationId(e,t){return t===0?e:`${e}#${t}`}function*closeOpenParts(e,t,n){for(let[r,i]of e)i.completed||i.text.length===0||(i.completed=!0,i.completedEpoch=n,yield{type:t,id:partGenerationId(r,i.generation)})}function isPostTurnVisibleEvent(e){switch(e.type){case`action.result`:case`actions.requested`:case`authorization.completed`:case`authorization.required`:case`input.requested`:case`message.appended`:case`message.completed`:case`reasoning.appended`:case`reasoning.completed`:case`result.completed`:case`step.completed`:case`step.failed`:case`step.started`:case`subagent.called`:case`subagent.completed`:case`subagent.event`:case`subagent.started`:case`turn.completed`:case`turn.failed`:return!0;default:return!1}}function toolBatchKey(e,t,n,r){return`${e}:${t}:${String(n)}:${stableStringify(r.map(e=>({input:e.input,toolName:e.toolName})))}`}function inputRequestBatchKey(e,t,n){return toolBatchKey(`input.requested`,e,t,n.map(e=>({input:e.action.input,toolName:e.action.toolName})))}function stableStringify(e){return JSON.stringify(toStableJson(e))??`undefined`}function toStableJson(e,t=new WeakSet){if(typeof e!=`object`||!e)return e;if(t.has(e))return`[Circular]`;if(t.add(e),Array.isArray(e))return e.map(e=>toStableJson(e,t));let n=e,r={};for(let e of Object.keys(n).sort())r[e]=toStableJson(n[e],t);return r}function formatActionResultError(e){if(e.data.error?.message)return e.data.error.message;let t=e.data.result.output;if(typeof t==`string`)return t;try{return JSON.stringify(t)}catch{return`Tool execution failed.`}}function toFailureEvent(e,t,n){let o=failureKey(e);if(t.has(o))return;t.add(o);let s=n?.(e),c={type:`error`,errorText:s??formatFailureMessage(e)};if(s!==void 0)return c;let l=formatFailureDetail(e);return l!==void 0&&(c.detail=l),c}function isQuestionRequest(e){return e.display===`select`||e.display===`text`?!0:e.display===`confirmation`?!1:e.options!==void 0&&e.options.length>0}function toAgentTUIInputQuestion(e){let t=e.display===`text`?`text`:e.display===`select`||e.options!==void 0&&e.options.length>0?`select`:`text`,n={requestId:e.requestId,prompt:e.prompt,display:t};return e.options!==void 0&&(n.options=e.options.map(e=>{let t={id:e.id,label:e.label};return e.description!==void 0&&(t.description=e.description),e.style!==void 0&&(t.style=e.style),t})),e.allowFreeform!==void 0&&(n.allowFreeform=e.allowFreeform),n}function openCurrentSubagentSection(e){e.currentSectionKey===null&&(e.currentSectionKey=e.nextSectionKey++,e.steps.set(e.currentSectionKey,{reasoning:``,message:``,finalized:!1}));let t=e.steps.get(e.currentSectionKey);if(!t)throw Error(`invariant: subagent section state missing for current key`);return{key:e.currentSectionKey,step:t}}export{EveTUIRunner,parsePromptCommand};
1
+ import{pickAgentHeaderTip}from"./agent-header.js";import{formatPromptCommandHelp,parsePromptCommand}from"./prompt-commands.js";import{failureKey,formatFailureDetail,formatFailureMessage,formatGatewayAuthFailureNotice,isAbortLikeError,isGatewayAuthFailure,isInterruptedError}from"./errors.js";import{BOOT_DETECTIONS,detectSetupIssues,formatSetupIssuesLine}from"./setup-issues.js";import{TerminalRenderer}from"./terminal-renderer.js";import{createVercelStatusTracker}from"./vercel-status.js";import{toErrorMessage}from"#shared/errors.js";import{isCurrentTurnBoundaryEvent}from"#client/index.js";import{createDevelopmentRuntimeArtifactSessionRefresher}from"#services/dev-client.js";var EveTUIRunner=class{#e;#t;#n;#r;#i;#a;#o;#s;#c;#l;#u;#d;#f;#p;#m;#h;#g;#_=pickAgentHeaderTip();#v;#y=new Map;#b=new Map;#x=new Map;#S=new Map;#C=new Set;#w=!1;constructor(e){if(this.#e=e.session,e.client!==void 0&&(this.#t=e.client),this.#n=createRenderer(e),this.#r=e.name??`Eve`,this.#i=e.tools??`full`,this.#a=e.reasoning??`full`,this.#o=e.subagents??`full`,this.#s=e.connectionAuth??`full`,this.#c=e.assistantResponseStats??`tokensPerSecond`,this.#l=e.contextSize,this.#u=e.formatTransportError??toErrorMessage,e.appRoot!==void 0){this.#p=e.appRoot;let t={appRoot:e.appRoot,onChange:e=>this.#n.setVercelStatus?.(e)};e.detectProjectIdentity!==void 0&&(t.detectIdentity=e.detectProjectIdentity),this.#g=createVercelStatusTracker(t)}e.promptCommandHandler!==void 0&&(this.#m=e.promptCommandHandler),this.#h=e.bootDetections??BOOT_DETECTIONS,e.serverUrl!==void 0&&(this.#f=e.serverUrl,this.#d=createDevelopmentRuntimeArtifactSessionRefresher({serverUrl:e.serverUrl}))}async#T(){let e=this.#f;if(e===void 0){await this.#A(void 0);return}let t;try{t=await this.#t?.info()}catch{t=void 0}this.#v=t;let n={name:this.#r,serverUrl:e};t!==void 0&&(n.info=t),this.#p!==void 0&&(n.tip=this.#_),this.#n.renderAgentHeader?.(n),await this.#A(t)}async run(){try{await this.#E()}finally{this.#n.shutdown?.(),this.#g?.dispose()}}async#E(){let e=this.#r,r,i,a=!1,o=!1;for(await this.#T(),this.#g?.refreshIdentity();;){if(!o){if(r==null){if(!this.#n.readPrompt){if(a)return;throw Error(`No prompt was provided and the renderer does not support prompt input.`)}try{r=await this.#O({title:e})}catch(e){if(isInterruptedError(e))return;throw e}if(r==null)return}let s=parsePromptCommand(r);if(s?.type===`exit`)return;if(s?.type===`new`){this.#D(),i=void 0,o=!1,r=void 0,this.#n.reset?.();continue}if(s?.type===`help`){this.#j(formatPromptCommandHelp()),i=void 0,o=!1,r=void 0;continue}if(s?.type===`loglevel`){this.#j(this.#M(s.argument)),i=void 0,o=!1,r=void 0;continue}if(s?.type===`extension`){try{let t=this.#m===void 0?{message:`/${s.name} is not available in this session.`}:await this.#m.handle(s,{renderer:this.#n,title:e});t?.message!==void 0&&this.#j(t.message),t?.vercelEffect!==void 0&&this.#g?.applyEffect(t.vercelEffect)}catch(e){if(isInterruptedError(e))return;throw e}i=void 0,r=void 0,o=!1;continue}a=!0}let s=await this.#k({prompt:o?void 0:r,inputResponses:i});try{await this.#n.renderStream(s,{title:e,submittedPrompt:r,continueSession:!!this.#n.readPrompt,tools:this.#i,reasoning:this.#a,subagents:this.#o,connectionAuth:this.#s,assistantResponseStats:this.#c,contextSize:this.#l});let t=s.turnState?.pendingApprovals??[],n=s.turnState?.pendingQuestions??[];if(t.length>0||n.length>0){let a=[];if(t.length>0){if(!this.#n.readToolApproval)throw Error(`Tool approval was requested, but the renderer does not support tool approval input.`);for(let n of t){let t=await this.#n.readToolApproval(n,{title:e});a.push({requestId:n.approvalId,optionId:t.approved?`approve`:`deny`}),this.#y.delete(n.approvalId)}}if(n.length>0){if(!this.#n.readInputQuestion)throw Error(`An interactive question was requested, but the renderer does not support input questions.`);for(let t of n){let n=toAgentTUIInputQuestion(t),r=await this.#n.readInputQuestion(n,{title:e});if(r===void 0)continue;let i={requestId:t.requestId};r.optionId!==void 0&&(i.optionId=r.optionId),r.text!==void 0&&(i.text=r.text),a.push(i),this.#y.delete(t.requestId)}}o=!0,i=a,r=void 0;continue}s.turnState&&s.turnState.boundaryEvent===void 0&&(this.#w=!0)}catch(e){if(isInterruptedError(e))return;throw e}o=!1,i=void 0,r=void 0,this.#w&&(this.#w=!1,this.#D(),this.#n.renderNotice?.(`Session ended — started a new session. Earlier context was cleared.`))}}#D(){for(let e of this.#x.values())e.abort();this.#x.clear(),this.#b.clear(),this.#y.clear(),this.#S.clear(),this.#C.clear(),this.#t&&(this.#e=this.#t.session()),this.#d?.clear()}async#O(e){if(!this.#n.readPrompt)return;let t=this.#n.readPrompt(e),n=this.#t,r=this.#d;if(n===void 0||r===void 0)return await t;let i=!1,a=!1,o,refresh=async()=>{if(!(i||a)){a=!0;try{this.#e=await r.refreshIdle({createSession:()=>n.session(),onRuntimeArtifactsChanged:()=>this.#N(),session:this.#e})}finally{a=!1}}},startRefresh=()=>{if(i||a)return;let e=refresh().finally(()=>{o===e&&(o=void 0)});o=e};startRefresh();let s=setInterval(()=>{startRefresh()},500);s.unref?.();try{return await t}finally{i=!0,clearInterval(s),await o}}async#k(e){let t=new AbortController,n={signal:t.signal};e.prompt!==void 0&&(n.message=e.prompt),e.inputResponses!==void 0&&e.inputResponses.length>0&&(n.inputResponses=e.inputResponses);let r;try{let e=this.#t;e!==void 0&&this.#d!==void 0&&(this.#e=await this.#d.refresh({createSession:()=>e.session(),inputResponses:n.inputResponses,message:n.message,onRuntimeArtifactsChanged:()=>this.#N(),session:this.#e})),r=await this.#e.send(n)}catch(e){if(isInterruptedError(e))throw e;return this.#w=!0,{events:errorOnlyTUIStream({errorText:this.#u(e)}),turnState:createTurnState()}}let i=createTurnState();return{abort:()=>t.abort(),events:eveEventsToTUIStream({events:r,pendingInputRequests:this.#y,subagentRuns:this.#b,turnState:i,onSubagentCalled:e=>this.#L(e),onSubagentCompleted:e=>this.#z(e),onConnectionAuthRequired:e=>this.#P(e),onConnectionAuthCompleted:e=>this.#F(e),onTerminalFailure:()=>{this.#w=!0},failureOverride:this.#p===void 0?void 0:e=>isGatewayAuthFailure(e)?formatGatewayAuthFailureNotice(e):void 0}),turnState:i}}async#A(e){if(this.#p===void 0||this.#n.renderSetupWarning===void 0)return;let t={appRoot:this.#p,env:process.env};e!==void 0&&(t.info=e);let n=await detectSetupIssues(t,this.#h);n.length!==0&&this.#n.renderSetupWarning(formatSetupIssuesLine(n))}#j(e){if(this.#n.renderCommandResult!==void 0){this.#n.renderCommandResult(e);return}this.#n.renderNotice?.(e)}#M(e){let t=this.#n;if(t.logDisplayMode===void 0||t.setLogDisplayMode===void 0)return`/loglevel is not available in this session.`;if(e===``)return`Logs: ${t.logDisplayMode()}. Use /loglevel all|stderr|none — logs stay buffered, so switching also hides or restores past lines.`;let n=parseLogDisplayMode(e);if(n===void 0)return`Unknown log level "${e}". Use all, stderr, or none.`;if(n===t.logDisplayMode())return`Logs already set to ${n}.`;switch(t.setLogDisplayMode(n),n){case`none`:return`Logs hidden. Output stays buffered — /loglevel all restores it.`;case`stderr`:return`Showing stderr logs only.`;case`all`:return`Showing all logs.`}}async#N(){let e=this.#v,t;try{t=await this.#t?.info()}catch{t=void 0}if(t!==void 0&&(this.#v=t,this.#f!==void 0)){let e={info:t,name:this.#r,serverUrl:this.#f};this.#p!==void 0&&(e.tip=this.#_),this.#n.renderAgentHeader?.(e)}(!this.#n.renderAgentHeader||t===void 0)&&this.#n.renderNotice?.(formatAgentUpdateNotice(e,t))}#P(e){let t={name:e.data.name,description:e.data.description,state:`required`};e.data.authorization!==void 0&&(t.challenge=e.data.authorization),e.data.webhookUrl!==void 0&&(t.webhookUrl=e.data.webhookUrl),this.#S.set(e.data.name,t),this.#I(t)}#F(e){let t=this.#S.get(e.data.name)??{name:e.data.name,description:``,state:e.data.outcome};t.state=e.data.outcome,e.data.reason!==void 0&&(t.reason=e.data.reason),this.#S.set(e.data.name,t),this.#C.delete(e.data.name),this.#I(t),this.#n.setConnectionAuthPendingCount?.(this.#C.size)}#I(e){let t={name:e.name,description:e.description,state:e.state};e.challenge!==void 0&&(t.challenge=e.challenge),e.reason!==void 0&&(t.reason=e.reason),this.#n.upsertConnectionAuth?.(t)}#L(e){let t=e.data.callId;if(this.#x.has(t))return;let n=this.#t;if(!n)return;let r=new AbortController;this.#x.set(t,r),(async()=>{try{let i=n.session({sessionId:e.data.childSessionId,streamIndex:0}).stream({signal:r.signal});for await(let e of i)if(r.signal.aborted||(this.#B(t,e),isCurrentTurnBoundaryEvent(e)))break}catch(e){if(!isAbortLikeError(e)){let n=toErrorMessage(e),r=this.#b.get(t);if(r){let{key:e,step:i}=openCurrentSubagentSection(r);i.message=i.message?`${i.message}\n\nstream error: ${n}`:`stream error: ${n}`,i.finalized=!0,r.currentSectionKey=null,this.#n.upsertSubagentStep?.({callId:t,subagentName:r.name,sectionKey:e,reasoning:i.reasoning,message:i.message,finalized:!0})}}}finally{this.#x.delete(t)}})()}#R(e,t,n){let r=t.tools.get(n.childCallId),i=r??{toolName:n.toolName,input:n.input,status:n.status};if(r){let e={"approval-requested":0,executing:1,done:2,failed:2};e[n.status]>e[r.status]&&(r.status=n.status),r.input=n.input}else t.tools.set(n.childCallId,i);this.#n.markChildToolCallId?.(n.childCallId),this.#n.upsertSubagentTool?.({callId:e,subagentName:t.name,childCallId:n.childCallId,toolName:i.toolName,input:i.input,status:i.status})}#z(e){let t=this.#b.get(e);if(t){for(let[n,r]of t.steps)r.finalized||(r.finalized=!0,this.#n.upsertSubagentStep?.({callId:e,subagentName:t.name,sectionKey:n,reasoning:r.reasoning,message:r.message,finalized:!0}));t.currentSectionKey=null}}#B(e,t){let n=this.#b.get(e);if(!n)return;let r=this.#n,emit=(t,i)=>{r.upsertSubagentStep?.({callId:e,subagentName:n.name,sectionKey:t,reasoning:i.reasoning,message:i.message,finalized:i.finalized})},finalizeCurrent=()=>{if(n.currentSectionKey===null)return;let e=n.steps.get(n.currentSectionKey);e&&(e.finalized=!0,emit(n.currentSectionKey,e)),n.currentSectionKey=null};switch(t.type){case`reasoning.appended`:{let{key:e,step:r}=openCurrentSubagentSection(n);r.reasoning+=t.data.reasoningDelta,emit(e,r);break}case`reasoning.completed`:break;case`message.appended`:{let{key:e,step:r}=openCurrentSubagentSection(n);r.message+=t.data.messageDelta,emit(e,r);break}case`message.completed`:{let{key:e,step:r}=openCurrentSubagentSection(n);t.data.message!==null&&r.message.length===0&&(r.message=t.data.message),r.finalized=!0,emit(e,r),n.currentSectionKey=null;break}case`step.completed`:finalizeCurrent();break;case`actions.requested`:finalizeCurrent();for(let r of t.data.actions)r.kind===`tool-call`&&this.#R(e,n,{childCallId:r.callId,toolName:r.toolName,input:r.input,status:`executing`});break;case`input.requested`:finalizeCurrent();for(let r of t.data.requests)r.action.kind===`tool-call`&&this.#R(e,n,{childCallId:r.action.callId,toolName:r.action.toolName,input:r.action.input,status:`approval-requested`});break;case`action.result`:{let i=t.data.result;if(i.kind!==`tool-result`)break;let a=n.tools.get(i.callId);if(!a)break;t.data.status===`failed`?(a.status=`failed`,a.errorText=formatActionResultError(t)):(a.status=`done`,a.output=i.output);let o={callId:e,subagentName:n.name,childCallId:i.callId,toolName:a.toolName,input:a.input,status:a.status};a.output!==void 0&&(o.output=a.output),a.errorText!==void 0&&(o.errorText=a.errorText),r.upsertSubagentTool?.(o);break}default:break}}};function createRenderer(e){return e.renderer?e.renderer:new TerminalRenderer({tools:e.tools,reasoning:e.reasoning,subagents:e.subagents,connectionAuth:e.connectionAuth,assistantResponseStats:e.assistantResponseStats,contextSize:e.contextSize,logs:e.logs,input:e.userInput,output:e.screen})}function parseLogDisplayMode(e){return e===`all`||e===`stderr`||e===`none`?e:void 0}function formatAgentUpdateNotice(e,t){let n=e?.agent.model.id,r=t?.agent.model.id;return n!==void 0&&r!==void 0&&n!==r?`Agent updated: Model ${n} -> ${r}`:`Agent updated.`}async function*eveEventsToTUIStream(e){let{events:t,pendingInputRequests:n,subagentRuns:r,turnState:i,onSubagentCalled:a,onSubagentCompleted:o,onConnectionAuthRequired:s,onConnectionAuthCompleted:c,onTerminalFailure:l,failureOverride:u}=e,d=new Map,f=new Map,p=0,m=new Set,h=new Set,g=new Set,_=new Set,v=!1,y=!1,b;for await(let e of t)if(!(y&&isPostTurnVisibleEvent(e)))switch(e.type){case`session.started`:case`turn.started`:case`message.received`:break;case`step.started`:p+=1,yield{type:`step-start`};break;case`step.completed`:{let t=e;b=t.data.usage,yield*closeOpenParts(d,`assistant-complete`,p),yield*closeOpenParts(f,`reasoning-complete`,p),yield{type:`step-finish`,usage:t.data.usage};break}case`message.appended`:{let t=e,n=textPartId(t.data.turnId,t.data.stepIndex),r=partStateFor(d,n),i=t.data.messageSoFar;if(r.completed){if(r.text.startsWith(i)||p<=r.completedEpoch)break;r.generation+=1,r.text=``,r.completed=!1}if(!i.startsWith(r.text)||i.length<=r.text.length)break;let a=i.slice(r.text.length);r.text=i,yield{type:`assistant-delta`,id:partGenerationId(n,r.generation),delta:a};break}case`message.completed`:{let t=textPartId(e.data.turnId,e.data.stepIndex),n=partStateFor(d,t),r=e.data.message;if(n.completed){if(r===null||r===n.text||p<=n.completedEpoch)break;n.generation+=1,n.text=r,n.completedEpoch=p,yield{type:`assistant-complete`,id:partGenerationId(t,n.generation),text:r};break}let i=partGenerationId(t,n.generation);if(r!==null){if(n.text.length===0)n.text=r,n.completed=!0,n.completedEpoch=p,yield{type:`assistant-complete`,id:i,text:r};else if(r.startsWith(n.text)){let e=r.slice(n.text.length);e.length>0&&(yield{type:`assistant-delta`,id:i,delta:e}),n.text=r,n.completed=!0,n.completedEpoch=p,yield{type:`assistant-complete`,id:i}}}else n.text.length>0&&(n.completed=!0,n.completedEpoch=p,yield{type:`assistant-complete`,id:i});break}case`reasoning.appended`:{let t=e,n=reasoningPartId(t.data.turnId,t.data.stepIndex),r=partStateFor(f,n),i=t.data.reasoningSoFar;if(r.completed){if(r.text.startsWith(i)||p<=r.completedEpoch)break;r.generation+=1,r.text=``,r.completed=!1}if(!i.startsWith(r.text)||i.length<=r.text.length)break;let a=i.slice(r.text.length);r.text=i,yield{type:`reasoning-delta`,id:partGenerationId(n,r.generation),delta:a};break}case`reasoning.completed`:{let t=reasoningPartId(e.data.turnId,e.data.stepIndex),n=partStateFor(f,t),r=e.data.reasoning;if(n.completed){if(r.length===0||r===n.text||n.text.startsWith(r)||p<=n.completedEpoch)break;n.generation+=1,n.text=r,n.completedEpoch=p;let e=partGenerationId(t,n.generation);yield{type:`reasoning-delta`,id:e,delta:r},yield{type:`reasoning-complete`,id:e};break}let i=partGenerationId(t,n.generation);if(n.text.length===0&&r.length>0)n.text=r,yield{type:`reasoning-delta`,id:i,delta:r};else if(r.length>0&&!r.startsWith(n.text))break;n.completed=!0,n.completedEpoch=p,yield{type:`reasoning-complete`,id:i};break}case`actions.requested`:{let t=e.data,n=t.actions.filter(e=>e.kind===`tool-call`);if(n.length===0)break;let r=toolBatchKey(`actions.requested`,t.turnId,t.stepIndex,n);if(g.has(r)){for(let e of n)m.has(e.callId)||h.add(e.callId);break}g.add(r);for(let e of n)m.has(e.callId)||(m.add(e.callId),yield{type:`tool-call`,toolCallId:e.callId,toolName:e.toolName,input:e.input});break}case`input.requested`:{let t=e.data,r=t.requests.filter(e=>e.action.kind===`tool-call`);if(r.length===0)break;let a=inputRequestBatchKey(t.turnId,t.stepIndex,r);if(g.has(a)){for(let e of r)m.has(e.action.callId)||h.add(e.action.callId);break}g.add(a);for(let e of r){let t=e.action.callId;if(m.has(t)||(m.add(t),yield{type:`tool-call`,toolCallId:t,toolName:e.action.toolName,input:e.action.input}),n.set(e.requestId,e),isQuestionRequest(e)){upsertPendingQuestion(i,e);continue}upsertPendingApproval(i,e),yield{type:`tool-approval-request`,approvalId:e.requestId,toolCallId:t}}break}case`action.result`:{let t=e;if(t.data.result.kind!==`tool-result`)break;let n=t.data.result.callId;if(h.has(n)||!m.has(n))break;t.data.status===`failed`?yield{type:`tool-error`,toolCallId:n,errorText:formatActionResultError(t)}:yield{type:`tool-result`,toolCallId:n,output:t.data.result.output};break}case`step.failed`:case`turn.failed`:{let t=toFailureEvent(e,_,u);t&&(yield t);break}case`session.failed`:{i.sawSessionFailure=!0,l?.(e);let t=toFailureEvent(e,_,u);t&&(yield t),i.boundaryEvent=e.type,yield*closeOpenParts(d,`assistant-complete`,p),yield*closeOpenParts(f,`reasoning-complete`,p),yield{type:`finish`,usage:b},v=!0;return}case`session.waiting`:case`session.completed`:i.boundaryEvent=e.type,yield*closeOpenParts(d,`assistant-complete`,p),yield*closeOpenParts(f,`reasoning-complete`,p),yield{type:`finish`,usage:b},v=!0;return;case`turn.completed`:y=!0,yield*closeOpenParts(d,`assistant-complete`,p),yield*closeOpenParts(f,`reasoning-complete`,p);break;case`subagent.called`:{let t=e;if(!r.has(t.data.callId))r.set(t.data.callId,{name:t.data.name,steps:new Map,currentSectionKey:null,nextSectionKey:0,tools:new Map});else{let e=r.get(t.data.callId);e&&(e.name=t.data.name)}a?.(t);break}case`subagent.started`:case`subagent.event`:break;case`subagent.completed`:o?.(e.data.callId);break;case`authorization.required`:s?.(e);break;case`authorization.completed`:c?.(e);break;default:break}v||(yield*closeOpenParts(d,`assistant-complete`,p),yield*closeOpenParts(f,`reasoning-complete`,p),yield{type:`finish`,usage:b})}async function*errorOnlyTUIStream(e){yield{type:`error`,errorText:e.errorText},yield{type:`finish`}}function createTurnState(){return{pendingApprovals:[],pendingQuestions:[],sawSessionFailure:!1}}function upsertPendingApproval(e,t){let n=toAgentTUIToolApprovalRequest(t),r=e.pendingApprovals.findIndex(e=>e.approvalId===n.approvalId);r===-1?e.pendingApprovals.push(n):e.pendingApprovals[r]=n}function toAgentTUIToolApprovalRequest(e){return{approvalId:e.requestId,toolCallId:e.action.callId,toolName:e.action.toolName,input:e.action.input}}function upsertPendingQuestion(e,t){let n=e.pendingQuestions.findIndex(e=>e.requestId===t.requestId);n===-1?e.pendingQuestions.push(t):e.pendingQuestions[n]=t}function textPartId(e,t){return`text:${e}:${t}`}function reasoningPartId(e,t){return`reasoning:${e}:${t}`}function partStateFor(e,t){let n=e.get(t);return n===void 0&&(n={generation:0,text:``,completed:!1,completedEpoch:0},e.set(t,n)),n}function partGenerationId(e,t){return t===0?e:`${e}#${t}`}function*closeOpenParts(e,t,n){for(let[r,i]of e)i.completed||i.text.length===0||(i.completed=!0,i.completedEpoch=n,yield{type:t,id:partGenerationId(r,i.generation)})}function isPostTurnVisibleEvent(e){switch(e.type){case`action.result`:case`actions.requested`:case`authorization.completed`:case`authorization.required`:case`input.requested`:case`message.appended`:case`message.completed`:case`reasoning.appended`:case`reasoning.completed`:case`result.completed`:case`step.completed`:case`step.failed`:case`step.started`:case`subagent.called`:case`subagent.completed`:case`subagent.event`:case`subagent.started`:case`turn.completed`:case`turn.failed`:return!0;default:return!1}}function toolBatchKey(e,t,n,r){return`${e}:${t}:${String(n)}:${stableStringify(r.map(e=>({input:e.input,toolName:e.toolName})))}`}function inputRequestBatchKey(e,t,n){return toolBatchKey(`input.requested`,e,t,n.map(e=>({input:e.action.input,toolName:e.action.toolName})))}function stableStringify(e){return JSON.stringify(toStableJson(e))??`undefined`}function toStableJson(e,t=new WeakSet){if(typeof e!=`object`||!e)return e;if(t.has(e))return`[Circular]`;if(t.add(e),Array.isArray(e))return e.map(e=>toStableJson(e,t));let n=e,r={};for(let e of Object.keys(n).sort())r[e]=toStableJson(n[e],t);return r}function formatActionResultError(e){if(e.data.error?.message)return e.data.error.message;let t=e.data.result.output;if(typeof t==`string`)return t;try{return JSON.stringify(t)}catch{return`Tool execution failed.`}}function toFailureEvent(e,t,n){let o=failureKey(e);if(t.has(o))return;t.add(o);let s=n?.(e),c={type:`error`,errorText:s??formatFailureMessage(e)};if(s!==void 0)return c;let l=formatFailureDetail(e);return l!==void 0&&(c.detail=l),c}function isQuestionRequest(e){return e.display===`select`||e.display===`text`?!0:e.display===`confirmation`?!1:e.options!==void 0&&e.options.length>0}function toAgentTUIInputQuestion(e){let t=e.display===`text`?`text`:e.display===`select`||e.options!==void 0&&e.options.length>0?`select`:`text`,n={requestId:e.requestId,prompt:e.prompt,display:t};return e.options!==void 0&&(n.options=e.options.map(e=>{let t={id:e.id,label:e.label};return e.description!==void 0&&(t.description=e.description),e.style!==void 0&&(t.style=e.style),t})),e.allowFreeform!==void 0&&(n.allowFreeform=e.allowFreeform),n}function openCurrentSubagentSection(e){e.currentSectionKey===null&&(e.currentSectionKey=e.nextSectionKey++,e.steps.set(e.currentSectionKey,{reasoning:``,message:``,finalized:!1}));let t=e.steps.get(e.currentSectionKey);if(!t)throw Error(`invariant: subagent section state missing for current key`);return{key:e.currentSectionKey,step:t}}export{EveTUIRunner,parsePromptCommand};
@@ -1 +1 @@
1
- import{createPromptCommandHandler}from"./prompt-command-handler.js";import{EveTUIRunner}from"./runner.js";import{Client}from"#client/index.js";import{toErrorMessage}from"#shared/errors.js";import{resolveDevelopmentClientOptions}from"#services/dev-client/client-options.js";import{formatVercelAuthChallengeMessage,isVercelAuthChallenge}from"#services/dev-client/vercel-auth-error.js";async function runDevelopmentTui(t){let{serverUrl:n,appRoot:r,...i}=t,a=new Client(resolveDevelopmentClientOptions(n)),o={...i,session:a.session(),client:a,serverUrl:n,promptCommandHandler:createPromptCommandHandler({appRoot:r}),formatTransportError:e=>isVercelAuthChallenge(e)?formatVercelAuthChallengeMessage({serverUrl:n}):toErrorMessage(e)};r!==void 0&&(o.appRoot=r),await new EveTUIRunner(o).run()}export{runDevelopmentTui};
1
+ import{createPromptCommandHandler}from"./prompt-command-handler.js";import{EveTUIRunner}from"./runner.js";import{toErrorMessage}from"#shared/errors.js";import{Client}from"#client/index.js";import{resolveDevelopmentClientOptions}from"#services/dev-client/client-options.js";import{formatVercelAuthChallengeMessage,isVercelAuthChallenge}from"#services/dev-client/vercel-auth-error.js";async function runDevelopmentTui(t){let{serverUrl:n,appRoot:r,...i}=t,a=new Client(resolveDevelopmentClientOptions(n)),o={...i,session:a.session(),client:a,serverUrl:n,promptCommandHandler:createPromptCommandHandler({appRoot:r}),formatTransportError:e=>isVercelAuthChallenge(e)?formatVercelAuthChallengeMessage({serverUrl:n}):toErrorMessage(e)};r!==void 0&&(o.appRoot=r),await new EveTUIRunner(o).run()}export{runDevelopmentTui};
@@ -51,8 +51,6 @@ interface EvalCliOptions {
51
51
  junit?: string;
52
52
  list?: boolean;
53
53
  maxConcurrency?: string;
54
- mockModels?: boolean;
55
- noSkips?: boolean;
56
54
  skipReport?: boolean;
57
55
  strict?: boolean;
58
56
  tag?: string[];
@@ -1,3 +1,3 @@
1
1
  import{resolveInstalledPackageInfo}from"#internal/application/package.js";import{basename}from"node:path";import{createCliTheme,renderCliTaggedLine}from"#cli/ui/output.js";import{eveCliBanner}from"#cli/banner.js";import{Command,CommanderError,InvalidArgumentError}from"#compiled/commander/index.js";import{resolveApplicationRoot}from"#internal/application/paths.js";import{registerProjectCommands}from"#cli/commands/register-project-commands.js";import{parseDevelopmentServerUrl}from"#cli/dev/url.js";async function loadBuildHost(){return(await import(`#internal/nitro/host.js`)).buildApplication}async function loadPrintApplicationInfo(){return(await import(`#cli/commands/info.js`)).printApplicationInfo}async function loadRunDevelopmentTui(){return(await import(`#cli/dev/tui/tui.js`)).runDevelopmentTui}async function loadRunEvalCommand(){return(await import(`#evals/cli/eval.js`)).runEvalCommand}async function loadStartHost(){return(await import(`#internal/nitro/host.js`)).startDevelopmentServer}async function loadStartProductionHost(){return(await import(`#internal/nitro/host.js`)).startProductionServer}function shouldPrintCliBootBanner(e){return e.name()===`info`||e.name()===`dev`||e.name()===`init`}async function waitForShutdownSignal(e){await new Promise((t,n)=>{let r=!1,cleanup=()=>{process.off(`SIGINT`,handleSignal),process.off(`SIGTERM`,handleSignal)},handleSignal=()=>{r||(r=!0,cleanup(),e.close().then(t,n))};process.once(`SIGINT`,handleSignal),process.once(`SIGTERM`,handleSignal)})}async function waitForProductionServer(e){await Promise.race([e.wait(),waitForShutdownSignal({close:()=>e.close()})])}function parsePortOption(e){if(!/^-?\d+$/.test(e))throw new InvalidArgumentError(`Expected a numeric port, received "${e}".`);let t=Number(e);if(t<0||t>65535)throw new InvalidArgumentError(`Expected a port between 0 and 65535, received "${e}".`);return t}const DISPLAY_MODES=new Set([`full`,`collapsed`,`auto-collapsed`,`hidden`]),STATS_MODES=new Set([`tokens`,`tokensPerSecond`]),LOG_MODES=new Set([`all`,`stderr`,`none`]);function parseDisplayMode(e){if(!DISPLAY_MODES.has(e))throw new InvalidArgumentError(`Expected one of ${[...DISPLAY_MODES].join(`, `)}, received "${e}".`);return e}function parseStatsMode(e){if(!STATS_MODES.has(e))throw new InvalidArgumentError(`Expected one of ${[...STATS_MODES].join(`, `)}, received "${e}".`);return e}function parseLogsMode(e){if(!LOG_MODES.has(e))throw new InvalidArgumentError(`Expected one of ${[...LOG_MODES].join(`, `)}, received "${e}".`);return e}function parseContextSizeOption(e){let t=Number(e);if(!Number.isFinite(t)||t<=0)throw new InvalidArgumentError(`Expected a positive number, received "${e}".`);return t}function resolveDevUiMode(e){return e.options.ui===!1||!e.interactive?`headless`:`tui`}function resolveTuiTitle(e){if(e.name!==void 0&&e.name.length>0)return e.name;if(e.remoteServerUrl!==void 0)try{return new URL(e.remoteServerUrl).host}catch{return}let n=humanizeProjectName(basename(e.appRoot));return n.length>0?n:void 0}function humanizeProjectName(e){return e.replace(/[-_.]+/gu,` `).trim().split(/\s+/u).filter(e=>e.length>0).map(e=>e[0].toUpperCase()+e.slice(1)).join(` `)}function resolveTuiDisplayOptions(e){let t={reasoning:e.reasoning??`full`,tools:e.tools??`auto-collapsed`};return e.subagents!==void 0&&(t.subagents=e.subagents),e.connectionAuth!==void 0&&(t.connectionAuth=e.connectionAuth),e.assistantResponseStats!==void 0&&(t.assistantResponseStats=e.assistantResponseStats),e.contextSize!==void 0&&(t.contextSize=e.contextSize),e.logs!==void 0&&(t.logs=e.logs),t}function hasInteractiveTerminal(){return!!(process.stdin.isTTY&&process.stdout.isTTY)}function rewriteDevelopmentUrlShorthand(e){let t=e[1];return e[0]!==`dev`||e.length!==2||t===void 0||t.startsWith(`-`)?[...e]:[`dev`,`--url`,t]}function resolveRemoteDevelopmentServerUrl(e){if(e.url){if(e.host!==void 0)throw new InvalidArgumentError(`The --host option cannot be used with --url.`);if(e.port!==void 0)throw new InvalidArgumentError(`The --port option cannot be used with --url.`);if(e.ui===!1)throw new InvalidArgumentError(`The --no-ui option cannot be used with --url.`);return e.url}}function createCliProgram(t,o){let s=resolveApplicationRoot(),l=resolveInstalledPackageInfo().version,u=new Command,d=createCliTheme();u.name(`eve`).description(`Build and run an Eve application.`).version(l).showHelpAfterError().exitOverride().hook(`preAction`,(e,n)=>{shouldPrintCliBootBanner(n)&&t.log(eveCliBanner())}).configureOutput({writeErr:e=>{t.error(e.trimEnd())},writeOut:e=>{t.log(e.trimEnd())}});let f=u.command(`channels`).description(`Manage user-authored channels in the current project.`);return f.command(`add [kind]`).description(`Add channels interactively, or scaffold a channel kind (slack | web).`).option(`-f, --force`,`Overwrite existing channel files`).option(`-y, --yes`,`Assume yes for confirmations; requires an explicit channel kind`).action(async(e,n)=>{let{runChannelsAddCommand:r}=await import(`#cli/commands/channels.js`);await r(t,s,{kind:e,options:n})}),f.command(`list`).description(`List user-authored channels in the current project.`).option(`--json`,`Output as JSON`).action(async e=>{let{runChannelsListCommand:n}=await import(`#cli/commands/channels.js`);await n(t,s,e)}),u.command(`init <target>`).description(`Create a new Eve agent, or add one to an existing project directory.`).option(`--channel-web-nextjs`,`Add the Web Chat application (Next.js)`).action(async(e,n)=>{let{runInitCommand:r}=await import(`#cli/commands/init.js`);await r(t,s,e,n)}),registerProjectCommands({program:u,logger:t,appRoot:s}),u.command(`build`).description(`Build the current Eve application.`).action(async()=>{let{loadDevelopmentEnvironmentFiles:e}=await import(`#cli/dev/environment.js`);e(s);let n=await(o.buildHost??await loadBuildHost())(s);t.log(renderCliTaggedLine(d,{message:`built output at ${n}`,tag:`build`,tone:`success`}))}),u.command(`start`).description(`Start a built Eve application.`).option(`--host <host>`,`Host interface to bind`).option(`--port <port>`,`Port to listen on (defaults to $PORT, then 3000)`,parsePortOption).action(async e=>{let{loadDevelopmentEnvironmentFiles:n}=await import(`#cli/dev/environment.js`);n(s);let i=await(o.startProductionHost??await loadStartProductionHost())(s,{host:e.host,port:e.port});t.log(renderCliTaggedLine(d,{message:`server listening at ${i.url}`,tag:`start`,tone:`success`})),await waitForProductionServer(i)}),u.command(`dev`).description(`Start the Eve development server or connect to an existing URL.`).option(`--host <host>`,`Host interface to bind`).option(`--port <port>`,`Port to listen on (defaults to $PORT, then 3000)`,parsePortOption).option(`-u, --url <url>`,`Connect to an existing server URL`,parseDevelopmentServerUrl).option(`--no-ui`,`Start the server without an interactive UI`).option(`--name <name>`,`Title shown in the terminal UI (defaults to the app folder name)`).option(`--tools <mode>`,`How tool calls render: full | collapsed | auto-collapsed | hidden`,parseDisplayMode).option(`--reasoning <mode>`,`How reasoning renders: full | collapsed | auto-collapsed | hidden`,parseDisplayMode).option(`--subagents <mode>`,`How subagent sections render: full | collapsed | auto-collapsed | hidden`,parseDisplayMode).option(`--connection-auth <mode>`,`How connection authorization renders: full | collapsed | auto-collapsed | hidden`,parseDisplayMode).option(`--assistant-response-stats <mode>`,`Assistant header statistic: tokens | tokensPerSecond`,parseStatsMode).option(`--context-size <tokens>`,`Model context window size, shown as a usage percentage`,parseContextSizeOption).option(`--logs <mode>`,`Which server/agent logs to show: all | stderr | none`,parseLogsMode).addHelpText(`after`,`
2
2
  You can also pass a bare URL as the only argument, for example: eve dev https://example.com
3
- `).action(async e=>{let n=resolveRemoteDevelopmentServerUrl(e),{loadDevelopmentEnvironmentFiles:i}=await import(`#cli/dev/environment.js`);i(s);let runInteractiveUi=async r=>{t.log(``);let i=o.runDevelopmentTui??await loadRunDevelopmentTui(),a=resolveTuiDisplayOptions(e),c=resolveTuiTitle({name:e.name,remoteServerUrl:n,appRoot:s});c!==void 0&&(a.name=c),await i(n===void 0?{serverUrl:r,appRoot:s,...a}:{serverUrl:r,...a})};if(n){if(t.log(renderCliTaggedLine(d,{message:`connecting to ${n}`,tag:`dev`,tone:`info`})),resolveDevUiMode({options:e,interactive:hasInteractiveTerminal()})===`headless`){t.log(renderCliTaggedLine(d,{message:`Interactive UI disabled because the current terminal is not a TTY.`,tag:`dev`,tone:`warning`}));return}await runInteractiveUi(n);return}let a=await(o.startHost??await loadStartHost())(s,{host:e.host,port:e.port}),c=!1,closeServer=async()=>{c||(c=!0,await a.close())};try{let n=hasInteractiveTerminal(),i=resolveDevUiMode({options:e,interactive:n});if(i!==`tui`&&t.log(renderCliTaggedLine(d,{message:`server listening at ${a.url}`,tag:`dev`,tone:`success`})),i===`headless`)return e.ui!==!1&&!n&&t.log(renderCliTaggedLine(d,{message:`Interactive UI disabled because the current terminal is not a TTY.`,tag:`dev`,tone:`warning`})),await waitForShutdownSignal({close:closeServer});await runInteractiveUi(a.url)}finally{await closeServer()}}),u.command(`info`).description(`Print resolved application information.`).option(`--json`,`Output as JSON`).action(async e=>{await(o.printApplicationInfo??await loadPrintApplicationInfo())(t,s,e)}),u.command(`eval`).description(`Run evals against an Eve agent.`).argument(`[evalIds...]`,`Eval ids (or directory prefixes) to run (all discovered evals when omitted)`).option(`--url <url>`,`Remote agent URL (skip local host startup)`).option(`--mock-models`,`Boot the local dev target with deterministic mock models`).option(`--tag <tag...>`,`Run only evals carrying a tag`).option(`--strict`,`Fail the exit code when any score falls below its threshold`).option(`--no-skips`,`Treat unmet eval requirements as failures`).option(`--list`,`Print discovered evals without running them`).option(`--timeout <ms>`,`Per-eval timeout in milliseconds`).option(`--max-concurrency <n>`,`Max concurrent eval executions`).option(`--json`,`Output results as JSON`).option(`--junit <path>`,`Write JUnit XML results to a file`).option(`--skip-report`,`Skip eval-defined reporters (e.g. Braintrust)`).option(`--verbose`,`Stream per-eval ctx.log lines to stdout`).action(async(e,n)=>{await(o.runEvalCommand??await loadRunEvalCommand())(e,n,t)}),u}async function runCli(e=process.argv.slice(2),t=console,n={}){let r=createCliProgram(t,n),i=e.length===0?[`dev`]:rewriteDevelopmentUrlShorthand(e);try{await r.parseAsync(i,{from:`user`})}catch(e){if(e instanceof CommanderError){if(e.exitCode===0)return;throw Error(e.message)}throw e}}export{resolveDevUiMode,resolveTuiDisplayOptions,resolveTuiTitle,runCli};
3
+ `).action(async e=>{let n=resolveRemoteDevelopmentServerUrl(e),{loadDevelopmentEnvironmentFiles:i}=await import(`#cli/dev/environment.js`);i(s);let runInteractiveUi=async r=>{t.log(``);let i=o.runDevelopmentTui??await loadRunDevelopmentTui(),a=resolveTuiDisplayOptions(e),c=resolveTuiTitle({name:e.name,remoteServerUrl:n,appRoot:s});c!==void 0&&(a.name=c),await i(n===void 0?{serverUrl:r,appRoot:s,...a}:{serverUrl:r,...a})};if(n){if(t.log(renderCliTaggedLine(d,{message:`connecting to ${n}`,tag:`dev`,tone:`info`})),resolveDevUiMode({options:e,interactive:hasInteractiveTerminal()})===`headless`){t.log(renderCliTaggedLine(d,{message:`Interactive UI disabled because the current terminal is not a TTY.`,tag:`dev`,tone:`warning`}));return}await runInteractiveUi(n);return}let a=await(o.startHost??await loadStartHost())(s,{host:e.host,port:e.port}),c=!1,closeServer=async()=>{c||(c=!0,await a.close())};try{let n=hasInteractiveTerminal(),i=resolveDevUiMode({options:e,interactive:n});if(i!==`tui`&&t.log(renderCliTaggedLine(d,{message:`server listening at ${a.url}`,tag:`dev`,tone:`success`})),i===`headless`)return e.ui!==!1&&!n&&t.log(renderCliTaggedLine(d,{message:`Interactive UI disabled because the current terminal is not a TTY.`,tag:`dev`,tone:`warning`})),await waitForShutdownSignal({close:closeServer});await runInteractiveUi(a.url)}finally{await closeServer()}}),u.command(`info`).description(`Print resolved application information.`).option(`--json`,`Output as JSON`).action(async e=>{await(o.printApplicationInfo??await loadPrintApplicationInfo())(t,s,e)}),u.command(`eval`).description(`Run evals against an Eve agent.`).argument(`[evalIds...]`,`Eval ids (or directory prefixes) to run (all discovered evals when omitted)`).option(`--url <url>`,`Remote agent URL (skip local host startup)`).option(`--tag <tag...>`,`Run only evals carrying a tag`).option(`--strict`,`Fail the exit code when any score falls below its threshold`).option(`--list`,`Print discovered evals without running them`).option(`--timeout <ms>`,`Per-eval timeout in milliseconds`).option(`--max-concurrency <n>`,`Max concurrent eval executions`).option(`--json`,`Output results as JSON`).option(`--junit <path>`,`Write JUnit XML results to a file`).option(`--skip-report`,`Skip eval-defined reporters (e.g. Braintrust)`).option(`--verbose`,`Stream per-eval ctx.log lines to stdout`).action(async(e,n)=>{await(o.runEvalCommand??await loadRunEvalCommand())(e,n,t)}),u}async function runCli(e=process.argv.slice(2),t=console,n={}){let r=createCliProgram(t,n),i=e.length===0?[`dev`]:rewriteDevelopmentUrlShorthand(e);try{await r.parseAsync(i,{from:`user`})}catch(e){if(e instanceof CommanderError){if(e.exitCode===0)return;throw Error(e.message)}throw e}}export{resolveDevUiMode,resolveTuiDisplayOptions,resolveTuiTitle,runCli};
@@ -289,7 +289,6 @@ export interface AgentInfoResult {
289
289
  };
290
290
  readonly capabilities: {
291
291
  readonly devRoutes: boolean;
292
- readonly mockModels: boolean;
293
292
  };
294
293
  readonly channels: AgentInfoChannels;
295
294
  readonly connections: readonly AgentInfoConnectionEntry[];
@@ -22,9 +22,9 @@
22
22
  "turndown": "7.2.4",
23
23
  "@vercel/oidc": "3.5.0",
24
24
  "@vercel/sandbox": "2.1.0",
25
- "@workflow/core": "5.0.0-beta.14",
25
+ "@workflow/core": "5.0.0-beta.15",
26
26
  "@workflow/errors": "5.0.0-beta.7",
27
- "@workflow/world": "5.0.0-beta.8",
27
+ "@workflow/world": "5.0.0-beta.9",
28
28
  "zod": "4.4.3",
29
29
  "zod-validation-error": "5.0.0"
30
30
  },
@@ -15,11 +15,19 @@
15
15
  * `@workflow/core` version that supports it
16
16
  * 3. The `getRunCapabilities()` function will automatically include it
17
17
  *
18
+ * ## Adding a new non-format capability
19
+ *
20
+ * Some capabilities aren't serialization format prefixes — e.g.
21
+ * byte-stream wire framing is an envelope around chunks rather than
22
+ * a content format. For those, add a boolean field to `RunCapabilities`
23
+ * and an entry in `CAPABILITY_VERSION_TABLE` below.
24
+ *
18
25
  * ## History
19
26
  *
20
27
  * - `encr` (AES-256-GCM encryption): added in `4.2.0-beta.64`
21
28
  * Commit: 7618ac36 "Wire AES-GCM encryption into serialization layer (#1251)"
22
29
  * https://github.com/vercel/workflow/commit/7618ac36
30
+ * - `framedByteStreams` (wire-level chunk framing for byte streams): added in `5.0.0-beta.15`
23
31
  */
24
32
  import { type SerializationFormatType } from './serialization.js';
25
33
  /**
@@ -32,6 +40,15 @@ export interface RunCapabilities {
32
40
  * if encryption is supported, etc.
33
41
  */
34
42
  supportedFormats: ReadonlySet<SerializationFormatType>;
43
+ /**
44
+ * Whether the target run can decode wire-framed byte streams. When true,
45
+ * byte streams (`type: 'bytes'` ReadableStreams passed across boundaries)
46
+ * are wrapped in a length-prefixed frame envelope on the wire so the
47
+ * reader can identify chunk boundaries — which enables auto-reconnect
48
+ * on transient stream errors. When false, byte streams are written as
49
+ * raw bytes (the legacy format) for compatibility with older runs.
50
+ */
51
+ framedByteStreams: boolean;
35
52
  }
36
53
  /**
37
54
  * Look up what serialization capabilities a workflow run supports based on
@@ -39,7 +56,8 @@ export interface RunCapabilities {
39
56
  *
40
57
  * When the version is `undefined`, not a string, or not a valid semver string
41
58
  * (e.g. very old runs that predate the field, or corrupted metadata),
42
- * we assume the most conservative capabilities (baseline formats only).
59
+ * we assume the most conservative capabilities (baseline formats only,
60
+ * non-format capabilities all `false`).
43
61
  */
44
62
  export declare function getRunCapabilities(workflowCoreVersion: string | undefined): RunCapabilities;
45
63
  //# sourceMappingURL=capabilities.d.ts.map
@@ -18,6 +18,38 @@
18
18
  * when serializing instances (e.g., step return values).
19
19
  */
20
20
  export declare function registerSerializationClass(classId: string, cls: Function): void;
21
+ /**
22
+ * Stable, well-known registry id for the SDK's `Run` class.
23
+ *
24
+ * The SWC plugin auto-registers `Run` under a *path-derived* id (e.g.
25
+ * `class//./node_modules/@workflow/core/dist/runtime/run//Run`), which
26
+ * varies with the app's dependency layout and bundler. Host-side code
27
+ * that needs to construct `Run` instances inside the workflow VM (e.g.
28
+ * the hook event consumer resolving `hook.getConflict()`) cannot know
29
+ * that id statically, so the workflow-mode `create-hook` module also
30
+ * aliases the bundle's `Run` under this stable id at evaluation time.
31
+ *
32
+ * The `workflow` pseudo-path cannot collide with plugin-derived ids,
33
+ * which always use real relative module paths (`./…` / `../…`).
34
+ */
35
+ export declare const RUN_CLASS_ID = "class//workflow//Run";
36
+ /**
37
+ * Register an additional registry id for a class without touching its
38
+ * `classId` property.
39
+ *
40
+ * Unlike {@link registerSerializationClass}, this is safe to call for a
41
+ * class the SWC plugin has already registered: the plugin's inlined IIFE
42
+ * defines `classId` as non-configurable, so a second `defineProperty`
43
+ * would throw. Aliasing only adds a registry entry — the class keeps
44
+ * serializing under its primary (path-derived) id, while lookups succeed
45
+ * under both.
46
+ *
47
+ * Registration is per-global by construction: evaluated inside the
48
+ * workflow VM it registers the VM's compiled class on the VM's registry;
49
+ * evaluated on the host it registers the host class on the host's
50
+ * registry. Each context resolves its own correct variant.
51
+ */
52
+ export declare function aliasSerializationClass(classId: string, cls: Function, global?: Record<string, any>): void;
21
53
  /**
22
54
  * Find a registered class constructor by ID (used during deserialization)
23
55
  *