eve 0.58.1 → 0.59.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (234) hide show
  1. package/CHANGELOG.md +28 -0
  2. package/dist/src/approval/definition.d.ts +2 -0
  3. package/dist/src/channel/session.d.ts +2 -0
  4. package/dist/src/channel/session.js +1 -1
  5. package/dist/src/channel/types.d.ts +8 -1
  6. package/dist/src/chunks/{use-eve-agent-X0asmJg-.js → use-eve-agent-Dmc6sX4d.js} +558 -233
  7. package/dist/src/chunks/{use-eve-agent-CxWcZCsU.js → use-eve-agent-jSR8P4nK.js} +565 -235
  8. package/dist/src/cli/dev/tui/runner.d.ts +4 -0
  9. package/dist/src/cli/dev/tui/runner.js +1 -1
  10. package/dist/src/cli/dev/tui/terminal-renderer.js +12 -12
  11. package/dist/src/client/eve-agent-projection.d.ts +10 -0
  12. package/dist/src/client/eve-agent-projection.js +1 -0
  13. package/dist/src/client/eve-agent-store-helpers.d.ts +6 -2
  14. package/dist/src/client/eve-agent-store-helpers.js +2 -2
  15. package/dist/src/client/eve-agent-store-state.d.ts +54 -1
  16. package/dist/src/client/eve-agent-store.d.ts +12 -82
  17. package/dist/src/client/eve-agent-store.js +1 -1
  18. package/dist/src/client/index.d.ts +2 -2
  19. package/dist/src/client/index.js +1 -1
  20. package/dist/src/client/message-response.d.ts +5 -1
  21. package/dist/src/client/message-response.js +1 -1
  22. package/dist/src/client/ndjson.d.ts +1 -0
  23. package/dist/src/client/ndjson.js +2 -2
  24. package/dist/src/client/open-stream.d.ts +4 -1
  25. package/dist/src/client/open-stream.js +1 -1
  26. package/dist/src/client/session-event-stream.d.ts +30 -0
  27. package/dist/src/client/session-event-stream.js +1 -0
  28. package/dist/src/client/session-utils.d.ts +2 -1
  29. package/dist/src/client/session-utils.js +1 -1
  30. package/dist/src/client/session.d.ts +14 -1
  31. package/dist/src/client/session.js +1 -1
  32. package/dist/src/client/sessions.d.ts +8 -2
  33. package/dist/src/client/sessions.js +1 -1
  34. package/dist/src/client/types.d.ts +7 -0
  35. package/dist/src/compiled/.vendor-stamp.json +2 -3
  36. package/dist/src/compiled/@vercel/sandbox/api-client/api-client.d.ts +88 -1
  37. package/dist/src/compiled/@vercel/sandbox/api-client/index.d.ts +1 -1
  38. package/dist/src/compiled/@vercel/sandbox/api-client/validators.d.ts +41 -1
  39. package/dist/src/compiled/@vercel/sandbox/constants.d.ts +3 -3
  40. package/dist/src/compiled/@vercel/{sandbox-drives → sandbox}/drive.d.ts +13 -2
  41. package/dist/src/compiled/@vercel/sandbox/index.d.ts +3 -2
  42. package/dist/src/compiled/@vercel/sandbox/index.js +15 -9
  43. package/dist/src/compiled/@vercel/sandbox/sandbox.d.ts +40 -5
  44. package/dist/src/compiled/_chunks/node/auth-DDrvYko5.js +2 -0
  45. package/dist/src/compiled/_chunks/node/version-C__MqbLM.js +1 -0
  46. package/dist/src/compiler/default-tool-policy.d.ts +3 -1
  47. package/dist/src/compiler/default-tool-policy.js +1 -1
  48. package/dist/src/compiler/extension-compatibility.d.ts +16 -16
  49. package/dist/src/compiler/extension-compatibility.js +1 -1
  50. package/dist/src/compiler/manifest.d.ts +8 -2
  51. package/dist/src/compiler/manifest.js +1 -1
  52. package/dist/src/compiler/normalize-agent-config.js +1 -1
  53. package/dist/src/compiler/normalize-manifest-helpers.js +1 -1
  54. package/dist/src/compiler/normalize-manifest.js +1 -1
  55. package/dist/src/compiler/normalize-subagent.d.ts +1 -0
  56. package/dist/src/compiler/normalize-subagent.js +1 -1
  57. package/dist/src/compiler/remote-agent-node.d.ts +1 -0
  58. package/dist/src/compiler/remote-agent-node.js +1 -1
  59. package/dist/src/compiler/source-graph.d.ts +1 -0
  60. package/dist/src/compiler/source-graph.js +1 -1
  61. package/dist/src/context/build-dynamic-tools.js +1 -1
  62. package/dist/src/context/dynamic-subagent-lifecycle.js +1 -1
  63. package/dist/src/context/dynamic-tool-lifecycle.js +1 -1
  64. package/dist/src/context/memory-tools.js +1 -1
  65. package/dist/src/evals/context.d.ts +1 -1
  66. package/dist/src/evals/context.js +1 -1
  67. package/dist/src/evals/define-eval.d.ts +1 -1
  68. package/dist/src/evals/define-eval.js +1 -1
  69. package/dist/src/evals/index.js +1 -1
  70. package/dist/src/evals/judge.d.ts +1 -1
  71. package/dist/src/evals/runner/execute-task.d.ts +1 -1
  72. package/dist/src/evals/runner/execute-task.js +1 -1
  73. package/dist/src/evals/session-manager.d.ts +27 -0
  74. package/dist/src/evals/session-manager.js +1 -0
  75. package/dist/src/evals/session.d.ts +8 -28
  76. package/dist/src/evals/session.js +2 -1
  77. package/dist/src/evals/target.d.ts +1 -1
  78. package/dist/src/evals/target.js +1 -1
  79. package/dist/src/evals/types.d.ts +19 -15
  80. package/dist/src/eve-channel/create-request.d.ts +24 -0
  81. package/dist/src/eve-channel/create-request.js +1 -0
  82. package/dist/src/eve-channel/index.js +1 -1
  83. package/dist/src/eve-channel/request.d.ts +3 -12
  84. package/dist/src/eve-channel/request.js +2 -2
  85. package/dist/src/eve-channel/types.d.ts +4 -2
  86. package/dist/src/execution/dynamic-workflow/tool.js +1 -1
  87. package/dist/src/execution/legacy-session/turn-workflow.js +1 -1
  88. package/dist/src/execution/runtime-context.js +1 -1
  89. package/dist/src/execution/sandbox/bindings/vercel-lifecycle.d.ts +3 -3
  90. package/dist/src/execution/sandbox/bindings/vercel-lifecycle.js +1 -1
  91. package/dist/src/execution/sandbox/bindings/vercel-sdk-types.d.ts +1 -4
  92. package/dist/src/execution/sandbox/bindings/vercel.d.ts +1 -2
  93. package/dist/src/execution/sandbox/bindings/vercel.js +1 -1
  94. package/dist/src/execution/session/entry.js +1 -1
  95. package/dist/src/execution/session/handoff-steps.js +1 -1
  96. package/dist/src/execution/session/program.d.ts +2 -0
  97. package/dist/src/execution/session/program.js +1 -1
  98. package/dist/src/execution/session/turn-step.js +1 -1
  99. package/dist/src/execution/session/turn.js +1 -1
  100. package/dist/src/execution/session-inbox/protocol.js +1 -1
  101. package/dist/src/execution/tools/connection-search.js +1 -1
  102. package/dist/src/execution/tools/sleep-workflow.js +1 -1
  103. package/dist/src/execution/workflow-runtime.js +1 -1
  104. package/dist/src/experimental/evaluate/auto-model.js +2 -2
  105. package/dist/src/experimental/evaluate/evaluate.d.ts +7 -0
  106. package/dist/src/experimental/evaluate/evaluate.js +1 -0
  107. package/dist/src/framework/sources/registry.js +1 -1
  108. package/dist/src/harness/compaction.d.ts +3 -3
  109. package/dist/src/harness/compaction.js +1 -1
  110. package/dist/src/harness/request-envelope.d.ts +11 -0
  111. package/dist/src/harness/request-envelope.js +1 -0
  112. package/dist/src/harness/tool-loop.js +2 -2
  113. package/dist/src/harness/tools.d.ts +1 -1
  114. package/dist/src/harness/tools.js +1 -1
  115. package/dist/src/instrumentation/prepare-trace-context.d.ts +2 -1
  116. package/dist/src/instrumentation/prepare-trace-context.js +1 -1
  117. package/dist/src/internal/application/package.js +1 -1
  118. package/dist/src/internal/authored-definition/core.js +1 -1
  119. package/dist/src/internal/authored-module-loader.d.ts +4 -1
  120. package/dist/src/internal/authored-module-loader.js +1 -1
  121. package/dist/src/internal/bundler/nitro-rolldown.d.ts +2 -0
  122. package/dist/src/internal/nitro/host/build-extension.js +1 -1
  123. package/dist/src/internal/nitro/host/extension-capability-requirements.d.ts +1 -0
  124. package/dist/src/internal/nitro/host/extension-capability-requirements.js +1 -1
  125. package/dist/src/internal/nitro/host/extension-distribution.d.ts +1 -1
  126. package/dist/src/internal/nitro/host/extension-distribution.js +1 -1
  127. package/dist/src/internal/workflow-bundle/dynamic-tool-transform.js +1 -1
  128. package/dist/src/public/definitions/connections/mcp.d.ts +1 -0
  129. package/dist/src/public/definitions/connections/openapi.d.ts +1 -0
  130. package/dist/src/public/definitions/remote-agent.d.ts +5 -0
  131. package/dist/src/public/definitions/workspace-agent.d.ts +5 -0
  132. package/dist/src/public/definitions/workspace-agent.js +1 -1
  133. package/dist/src/public/experimental/evaluate/index.d.ts +1 -0
  134. package/dist/src/public/experimental/evaluate/index.js +1 -1
  135. package/dist/src/public/sandbox/vercel-sandbox.d.ts +1 -1
  136. package/dist/src/public/sandbox/vercel.d.ts +1 -1
  137. package/dist/src/public/sandbox/vercel.js +1 -1
  138. package/dist/src/public/tools/approval/index.d.ts +2 -1
  139. package/dist/src/public/tools/approval/index.js +1 -1
  140. package/dist/src/public/tools/index.d.ts +1 -0
  141. package/dist/src/public/tools/index.js +1 -1
  142. package/dist/src/react/use-eve-agent.d.ts +4 -0
  143. package/dist/src/react/use-eve-agent.js +1 -1
  144. package/dist/src/runtime/resolve-agent-graph.js +1 -1
  145. package/dist/src/runtime/resolve-agent.js +1 -1
  146. package/dist/src/runtime/subagents/dynamic-agent-config.d.ts +1 -0
  147. package/dist/src/runtime/subagents/dynamic-agent-config.js +1 -1
  148. package/dist/src/runtime/subagents/dynamic-remote-agent-config.d.ts +1 -0
  149. package/dist/src/runtime/subagents/dynamic-remote-agent-config.js +1 -1
  150. package/dist/src/runtime/subagents/registry.d.ts +5 -2
  151. package/dist/src/runtime/subagents/registry.js +1 -1
  152. package/dist/src/runtime/types.d.ts +2 -0
  153. package/dist/src/setup/scaffold/create/project.js +1 -1
  154. package/dist/src/shared/agent-definition.d.ts +9 -0
  155. package/dist/src/subagents/handle-dispatch.js +1 -1
  156. package/dist/src/svelte/index.js +1 -1
  157. package/dist/src/svelte/use-eve-agent.d.ts +4 -0
  158. package/dist/src/svelte/use-eve-agent.js +1 -1
  159. package/dist/src/tools/approval/policies.d.ts +18 -0
  160. package/dist/src/tools/approval/policies.js +1 -1
  161. package/dist/src/tools/definition.d.ts +6 -3
  162. package/dist/src/tools/definition.js +1 -1
  163. package/dist/src/tools/durable-callbacks.d.ts +8 -2
  164. package/dist/src/tools/durable-callbacks.js +1 -1
  165. package/dist/src/tools/durable-schema.d.ts +16 -0
  166. package/dist/src/tools/durable-schema.js +1 -0
  167. package/dist/src/vue/index.js +1 -1
  168. package/dist/src/vue/use-eve-agent.d.ts +4 -0
  169. package/dist/src/vue/use-eve-agent.js +1 -1
  170. package/docs/agent-config.md +1 -0
  171. package/docs/channels/eve.mdx +20 -10
  172. package/docs/concepts/context-control.md +4 -0
  173. package/docs/concepts/sessions-runs-and-streaming.md +18 -3
  174. package/docs/connections/mcp.mdx +2 -2
  175. package/docs/connections/overview.mdx +1 -1
  176. package/docs/evals/assertions.mdx +6 -6
  177. package/docs/evals/cases.mdx +59 -23
  178. package/docs/evals/judge.mdx +10 -8
  179. package/docs/evals/overview.mdx +6 -6
  180. package/docs/evals/reporters.mdx +1 -1
  181. package/docs/evals/targets.mdx +5 -0
  182. package/docs/guides/client/messages.mdx +5 -5
  183. package/docs/guides/client/overview.mdx +15 -1
  184. package/docs/guides/dynamic-capabilities.md +22 -0
  185. package/docs/guides/evaluate.md +78 -3
  186. package/docs/guides/frontend/overview.mdx +54 -5
  187. package/docs/guides/frontend/use-eve-agent-svelte.mdx +13 -8
  188. package/docs/guides/frontend/use-eve-agent-vue.mdx +13 -8
  189. package/docs/guides/remote-agents.md +2 -1
  190. package/docs/reference/typescript-api.md +38 -37
  191. package/docs/subagents/index.mdx +25 -8
  192. package/docs/tools/human-in-the-loop.md +27 -5
  193. package/docs/tools/overview.mdx +2 -2
  194. package/docs/tools/workflows.mdx +2 -3
  195. package/package.json +2 -3
  196. package/dist/src/compiled/@vercel/sandbox-drives/LICENSE +0 -201
  197. package/dist/src/compiled/@vercel/sandbox-drives/_async-retry.d.ts +0 -8
  198. package/dist/src/compiled/@vercel/sandbox-drives/_workflow-serde.d.ts +0 -5
  199. package/dist/src/compiled/@vercel/sandbox-drives/api-client/api-client.d.ts +0 -1815
  200. package/dist/src/compiled/@vercel/sandbox-drives/api-client/api-error.d.ts +0 -29
  201. package/dist/src/compiled/@vercel/sandbox-drives/api-client/base-client.d.ts +0 -39
  202. package/dist/src/compiled/@vercel/sandbox-drives/api-client/file-writer.d.ts +0 -66
  203. package/dist/src/compiled/@vercel/sandbox-drives/api-client/index.d.ts +0 -2
  204. package/dist/src/compiled/@vercel/sandbox-drives/api-client/validators.d.ts +0 -932
  205. package/dist/src/compiled/@vercel/sandbox-drives/api-client/with-retry.d.ts +0 -10
  206. package/dist/src/compiled/@vercel/sandbox-drives/auth/error.d.ts +0 -15
  207. package/dist/src/compiled/@vercel/sandbox-drives/auth/file.d.ts +0 -18
  208. package/dist/src/compiled/@vercel/sandbox-drives/auth/index.d.ts +0 -6
  209. package/dist/src/compiled/@vercel/sandbox-drives/auth/oauth.d.ts +0 -111
  210. package/dist/src/compiled/@vercel/sandbox-drives/auth/poll-for-token.d.ts +0 -28
  211. package/dist/src/compiled/@vercel/sandbox-drives/auth/project.d.ts +0 -40
  212. package/dist/src/compiled/@vercel/sandbox-drives/command.d.ts +0 -292
  213. package/dist/src/compiled/@vercel/sandbox-drives/constants.d.ts +0 -15
  214. package/dist/src/compiled/@vercel/sandbox-drives/execution-context.d.ts +0 -116
  215. package/dist/src/compiled/@vercel/sandbox-drives/filesystem.d.ts +0 -258
  216. package/dist/src/compiled/@vercel/sandbox-drives/index.d.ts +0 -14
  217. package/dist/src/compiled/@vercel/sandbox-drives/index.js +0 -9
  218. package/dist/src/compiled/@vercel/sandbox-drives/network-policy.d.ts +0 -169
  219. package/dist/src/compiled/@vercel/sandbox-drives/proxy.d.ts +0 -55
  220. package/dist/src/compiled/@vercel/sandbox-drives/sandbox-user.d.ts +0 -211
  221. package/dist/src/compiled/@vercel/sandbox-drives/sandbox.d.ts +0 -1287
  222. package/dist/src/compiled/@vercel/sandbox-drives/session.d.ts +0 -435
  223. package/dist/src/compiled/@vercel/sandbox-drives/snapshot.d.ts +0 -238
  224. package/dist/src/compiled/@vercel/sandbox-drives/utils/get-credentials.d.ts +0 -21
  225. package/dist/src/compiled/@vercel/sandbox-drives/utils/paginator.d.ts +0 -16
  226. package/dist/src/compiled/@vercel/sandbox-drives/utils/resolveSignal.d.ts +0 -15
  227. package/dist/src/compiled/@vercel/sandbox-drives/utils/sandbox-snapshot.d.ts +0 -11
  228. package/dist/src/compiled/@vercel/sandbox-drives/utils/types.d.ts +0 -11
  229. package/dist/src/compiled/_chunks/node/auth-8aQozzfi.js +0 -2
  230. package/dist/src/compiled/_chunks/node/auth-Bvv0xGTY.js +0 -2
  231. package/dist/src/compiled/_chunks/node/esm-Fqlolk7e.js +0 -7
  232. package/dist/src/compiled/_chunks/node/version-BC6t2Txc.js +0 -1
  233. package/dist/src/compiled/_chunks/node/version-DSQqVZ5T.js +0 -1
  234. package/dist/src/compiled/_chunks/node/xdg-app-paths-F-QHrdza.js +0 -1
@@ -36,6 +36,8 @@ export interface UseEveAgentReturn<TData> {
36
36
  readonly events: readonly MessageStreamEvent[];
37
37
  /** Replay the attached durable session and follow its in-flight turn, if any. */
38
38
  readonly resume: () => Promise<void>;
39
+ /** Create the session without starting its first turn. */
40
+ readonly prewarm: () => Promise<void>;
39
41
  /** Clear all state and start a new session. */
40
42
  readonly reset: () => void;
41
43
  /** Send a message with optional turn settings. */
@@ -98,6 +100,8 @@ export interface UseEveAgentOptions<TData> extends EveAgentStoreCallbacks<TData>
98
100
  * @default true
99
101
  */
100
102
  readonly optimistic?: boolean;
103
+ /** Prewarm an owned session on mount and after reset. @default false */
104
+ readonly prewarm?: boolean;
101
105
  /**
102
106
  * Projects stream events into `TData`. Defaults to {@link defaultMessageReducer},
103
107
  * which fixes `TData` to {@link EveMessageData}.
@@ -1,3 +1,3 @@
1
- import { t as useEveAgent } from "../chunks/use-eve-agent-CxWcZCsU.js";
1
+ import { t as useEveAgent } from "../chunks/use-eve-agent-jSR8P4nK.js";
2
2
 
3
3
  export { useEveAgent };
@@ -1,4 +1,22 @@
1
+ import type { Experimental_EvaluationModel as EvaluationModel } from "ai";
1
2
  import type { ApprovalPolicy } from "#approval/definition.js";
3
+ export interface AutoApprovalOptions {
4
+ /** Evaluation model instance or ID. Defaults to TypeSafe Jev. */
5
+ readonly model?: EvaluationModel;
6
+ /** Instructions used to classify the exact tool call. */
7
+ readonly instructions?: string;
8
+ /** Descriptions of the fixed approval outcomes. */
9
+ readonly criteria?: {
10
+ readonly clear?: string;
11
+ readonly caution?: string;
12
+ };
13
+ }
14
+ /**
15
+ * Returns an `approval` callback that asks an AI SDK evaluation model whether
16
+ * the exact tool call presents concrete security danger. Defaults to TypeSafe Jev.
17
+ * Unavailable or invalid evaluations require user approval.
18
+ */
19
+ export declare function auto<TInput = unknown>(options?: AutoApprovalOptions): ApprovalPolicy<TInput>;
2
20
  /**
3
21
  * Returns an `approval` callback that always requires user approval before
4
22
  * the tool executes.
@@ -1 +1 @@
1
- import{stampDurableDynamicCallback}from"#tools/durable-callbacks.js";function alwaysApproval(e){return`user-approval`}function neverApproval(e){return`not-applicable`}function onceApproval(e,t){return t.approvedTools.has(t.toolName)?`not-applicable`:`user-approval`}function always(){return stampDurableDynamicCallback(()=>`user-approval`,{callback:alwaysApproval,closure:{}})}function never(){return stampDurableDynamicCallback(()=>`not-applicable`,{callback:neverApproval,closure:{}})}function once(){return stampDurableDynamicCallback(({approvedTools:e,toolName:t})=>e.has(t)?`not-applicable`:`user-approval`,{callback:onceApproval,closure:{}})}export{always,never,once};
1
+ import{parseJsonValue}from"#shared/json.js";import{stampDurableDynamicCallback}from"#tools/durable-callbacks.js";import{evaluate}from"#experimental/evaluate/evaluate.js";async function autoApproval(e,t,n){try{let r=parseJsonValue(n.toolInput??null),i=JSON.stringify(r);if(new TextEncoder().encode(i).byteLength>65536)return`user-approval`;let a=AbortSignal.any([n.abortSignal,AbortSignal.timeout(3e4)]);return(await evaluate({model:e,state:{action:{input:r,tool:n.toolName}},questions:{permission:{type:`choice`,instructions:t.instructions??`Review the exact tool action for dangerous effects. Return caution when it could cause meaningful harm, including destructive data loss, credential exposure, financial transactions, deployments or public changes, external communication, privilege or system changes, or concealed execution. Return clear for routine, low-impact actions. Judge the action's actual effects from its name and input. If important effects are unclear, return caution.`,criteria:{clear:t.criteria?.clear??`The action is routine and low impact.`,caution:t.criteria?.caution??`The action is dangerous or its important effects are unclear.`}}},abortSignal:a,maxRetries:0})).answers.permission.choice===`clear`?`approved`:`user-approval`}catch{return n.abortSignal.throwIfAborted(),`user-approval`}}function alwaysApproval(e){return`user-approval`}function neverApproval(e){return`not-applicable`}function onceApproval(e,t){return t.approvedTools.has(t.toolName)?`not-applicable`:`user-approval`}function auto(e={}){let t=e.model??`typesafe-ai/jev`;return stampDurableDynamicCallback(n=>autoApproval(t,e,n),{callback:(n,r)=>autoApproval(t,e,r),closure:{}})}function always(){return stampDurableDynamicCallback(()=>`user-approval`,{callback:alwaysApproval,closure:{}})}function never(){return stampDurableDynamicCallback(()=>`not-applicable`,{callback:neverApproval,closure:{}})}function once(){return stampDurableDynamicCallback(({approvedTools:e,toolName:t})=>e.has(t)?`not-applicable`:`user-approval`,{callback:onceApproval,closure:{}})}export{always,auto,never,once};
@@ -243,6 +243,8 @@ export declare function defineTool<TReturn>(definition: {
243
243
  export declare function defineTool<TInput = unknown, TOutput = unknown>(definition: ToolDefinition<TInput, TOutput>): ToolDefinition<TInput, TOutput>;
244
244
  export declare function stampToolDefinition<T extends {
245
245
  readonly description: string;
246
+ readonly inputSchema?: unknown;
247
+ readonly outputSchema?: unknown;
246
248
  readonly execute: (...args: never[]) => unknown;
247
249
  readonly label?: ToolLabelDefinition;
248
250
  readonly approval?: Approval<never>;
@@ -255,14 +257,15 @@ export declare function stampToolDefinition<T extends {
255
257
  declare const DISABLED_TOOL_SENTINEL_KIND = "eve:disabled-tool";
256
258
  /**
257
259
  * Marker value returned from {@link disableTool}. Export this as the default
258
- * export of a file in `agent/tools/` to remove the framework default whose
259
- * name matches the file's slug.
260
+ * export of a file in `agent/tools/` to remove the model tool whose name
261
+ * matches the file's slug, including framework defaults and derived subagent
262
+ * tools.
260
263
  */
261
264
  export interface DisabledToolSentinel {
262
265
  readonly kind: typeof DISABLED_TOOL_SENTINEL_KIND;
263
266
  }
264
267
  /**
265
- * Returns a sentinel that disables the framework tool whose name matches the
268
+ * Returns a sentinel that disables the model tool whose name matches the
266
269
  * containing file's slug.
267
270
  */
268
271
  export declare function disableTool(): DisabledToolSentinel;
@@ -1 +1 @@
1
- import{collectDurableDynamicToolCallbacks,stampDurableDynamicToolCallbacks}from"#tools/durable-callbacks.js";import{TOOL_BRAND}from"#tools/dynamic.js";import{stampDefinitionKey}from"#internal/authored-definition/source-identity.js";function defineTool(e){return stampToolDefinition(e,`defineTool`)}function stampToolDefinition(e,t){if(e.auth!==void 0)throw Error(`${t}: The "auth" field is no longer supported. Pass auth providers inline to ctx.getToken(provider) or ctx.requireAuth(provider).`);return Object.assign(e,{[TOOL_BRAND]:!0}),stampDurableDynamicToolCallbacks(e,collectDurableDynamicToolCallbacks({label:e.label,approval:e.approval,approvalKey:e.approvalKey,execute:e.execute,toModelOutput:e.toModelOutput})),stampDefinitionKey(e,`tool:${e.description}`),e}const DISABLED_TOOL_SENTINEL_KIND=`eve:disabled-tool`;function disableTool(){return{kind:DISABLED_TOOL_SENTINEL_KIND}}function isDisabledToolSentinel(e){return typeof e==`object`&&!!e&&e.kind===DISABLED_TOOL_SENTINEL_KIND}export{defineTool,disableTool,isDisabledToolSentinel,stampToolDefinition};
1
+ import{collectDurableDynamicToolCallbacks,stampDurableDynamicToolCallbacks}from"#tools/durable-callbacks.js";import{TOOL_BRAND}from"#tools/dynamic.js";import{stampDefinitionKey}from"#internal/authored-definition/source-identity.js";function defineTool(e){return stampToolDefinition(e,`defineTool`)}function stampToolDefinition(e,t){if(e.auth!==void 0)throw Error(`${t}: The "auth" field is no longer supported. Pass auth providers inline to ctx.getToken(provider) or ctx.requireAuth(provider).`);return Object.assign(e,{[TOOL_BRAND]:!0}),stampDurableDynamicToolCallbacks(e,collectDurableDynamicToolCallbacks({inputSchema:e.inputSchema,outputSchema:e.outputSchema,label:e.label,approval:e.approval,approvalKey:e.approvalKey,execute:e.execute,toModelOutput:e.toModelOutput})),stampDefinitionKey(e,`tool:${e.description}`),e}const DISABLED_TOOL_SENTINEL_KIND=`eve:disabled-tool`;function disableTool(){return{kind:DISABLED_TOOL_SENTINEL_KIND}}function isDisabledToolSentinel(e){return typeof e==`object`&&!!e&&e.kind===DISABLED_TOOL_SENTINEL_KIND}export{defineTool,disableTool,isDisabledToolSentinel,stampToolDefinition};
@@ -1,6 +1,6 @@
1
1
  import type { Approval } from "#approval/definition.js";
2
2
  import type { JsonObject, JsonPrimitive } from "#shared/json.js";
3
- export type DurableDynamicCallbackPhase = "labelComplete" | "labelDelta" | "labelStart" | "approvalKey" | "approvalRequest" | "approvalResponse" | "execute" | "toModelOutput";
3
+ export type DurableDynamicCallbackPhase = "labelComplete" | "labelDelta" | "labelStart" | "approvalKey" | "approvalRequest" | "approvalResponse" | "execute" | "toModelOutput" | "inputSchema" | "outputSchema";
4
4
  export type DurableDynamicCallbackFn = (closure: JsonObject, ...args: never[]) => unknown;
5
5
  /**
6
6
  * Persisted binding for one callback phase. Identity is
@@ -14,6 +14,8 @@ export interface DurableDynamicCallbackReference {
14
14
  }
15
15
  export interface DurableDynamicToolCallbacks {
16
16
  readonly execute: DurableDynamicCallbackReference;
17
+ readonly inputSchema?: DurableDynamicCallbackReference;
18
+ readonly outputSchema?: DurableDynamicCallbackReference;
17
19
  readonly label?: {
18
20
  readonly complete?: DurableDynamicCallbackReference;
19
21
  readonly delta?: DurableDynamicCallbackReference;
@@ -31,6 +33,8 @@ export interface StampedDurableDynamicCallback {
31
33
  }
32
34
  export type LiveDurableDynamicToolCallbacks = Partial<{
33
35
  execute: StampedDurableDynamicCallback;
36
+ inputSchema: StampedDurableDynamicCallback;
37
+ outputSchema: StampedDurableDynamicCallback;
34
38
  label: {
35
39
  readonly complete?: StampedDurableDynamicCallback;
36
40
  readonly delta?: StampedDurableDynamicCallback;
@@ -72,7 +76,7 @@ export declare function hasUnregisteredDurableDynamicCallbacks(metadata: readonl
72
76
  entryKey: string;
73
77
  }[], scope: Pick<DynamicToolCallbackOwner, "sessionId" | "scope">): boolean;
74
78
  type DurableCallbackJsonValue<T> = T extends (...args: never[]) => unknown ? never : T extends JsonPrimitive ? T : T extends readonly (infer TItem)[] ? readonly DurableCallbackJsonValue<TItem>[] : T extends object ? DurableCallbackJsonObject<T> : never;
75
- type DurableCallbackJsonObject<T extends object> = Extract<keyof T, symbol> extends never ? {
79
+ export type DurableCallbackJsonObject<T extends object> = Extract<keyof T, symbol> extends never ? {
76
80
  readonly [TKey in keyof T]: DurableCallbackJsonValue<Exclude<T[TKey], undefined>> | Extract<T[TKey], undefined>;
77
81
  } : never;
78
82
  /**
@@ -93,6 +97,8 @@ export declare function readDurableDynamicCallback(callback: unknown): StampedDu
93
97
  /** Copies phase-specific callback descriptors onto a branded tool definition. */
94
98
  export declare function stampDurableDynamicToolCallbacks(definition: object, callbacks: LiveDurableDynamicToolCallbacks): void;
95
99
  export declare function collectDurableDynamicToolCallbacks(input: {
100
+ readonly inputSchema?: unknown;
101
+ readonly outputSchema?: unknown;
96
102
  readonly label?: {
97
103
  readonly complete?: (...args: never[]) => unknown;
98
104
  readonly delta?: (...args: never[]) => unknown;
@@ -1 +1 @@
1
- import{resolveApprovalPolicy}from"#approval/definition.js";const STAMPED_CALLBACK=Symbol.for(`eve:durable-dynamic-callback`),DURABLE_DYNAMIC_TOOL_CALLBACKS=Symbol.for(`eve:durable-dynamic-tool-callbacks`),REGISTRY=Symbol.for(`eve:scoped-dynamic-tool-callbacks`);function getRegistry(){let e=globalThis;return e[REGISTRY]??=new Map}function getSessionBindings(e){let t=getRegistry(),n=t.get(e);return n!==void 0&&(t.delete(e),t.set(e,n)),n}function callbackKey(e,t){return JSON.stringify([e.scope,e.resolverSlug,e.entryKey,e.name,t])}function registerDurableDynamicCallback(e){let t=getRegistry(),n=getSessionBindings(e.owner.sessionId);n===void 0&&(n=new Map,t.set(e.owner.sessionId,n),t.size>1024&&t.delete(t.keys().next().value)),n.set(callbackKey(e.owner,e.phase),e.callback)}function lookupDurableDynamicCallback(e,t){return getSessionBindings(e.sessionId)?.get(callbackKey(e,t))}function clearDurableDynamicCallbacks(e,t){if(t===void 0){getRegistry().delete(e);return}let n=getSessionBindings(e);if(n===void 0)return;let r=JSON.stringify([t.scope,t.resolverSlug]).slice(0,-1)+`,`;for(let e of n.keys())e.startsWith(r)&&n.delete(e)}function callDurableDynamicCallback(e,t,...n){return e(t,...n)}function hasUnregisteredDurableDynamicCallbacks(e,t){return e.some(e=>durableCallbackPhases(e.callbacks).some(n=>lookupDurableDynamicCallback({...e,...t},n)===void 0))}function durableCallbackPhases(e){return[[`execute`,e.execute],[`labelComplete`,e.label?.complete],[`labelDelta`,e.label?.delta],[`labelStart`,e.label?.start],[`approvalKey`,e.approvalKey],[`approvalRequest`,e.approvalRequest],[`approvalResponse`,e.approvalResponse],[`toModelOutput`,e.toModelOutput]].flatMap(([e,t])=>t===void 0?[]:[e])}function defineDurableCallback(e){return stampDurableDynamicCallback((...t)=>e.callback(e.closure,...t),{callback:(t,...n)=>Reflect.apply(e.callback,void 0,[t,...n]),closure:e.closure})}function stampDurableDynamicCallback(e,t){return Object.defineProperty(e,STAMPED_CALLBACK,{configurable:!0,value:t}),e}function readDurableDynamicCallback(e){if(typeof e==`function`)return Reflect.get(e,STAMPED_CALLBACK)}function stampDurableDynamicToolCallbacks(e,t){Object.defineProperty(e,DURABLE_DYNAMIC_TOOL_CALLBACKS,{configurable:!0,value:t})}function collectDurableDynamicToolCallbacks(e){let t=readDurableDynamicCallback(e.label?.complete),n=readDurableDynamicCallback(e.label?.delta),r=readDurableDynamicCallback(e.label?.start),i=e.approval===void 0?void 0:readDurableDynamicCallback(resolveApprovalPolicy(e.approval)),a=e.approval===void 0||typeof e.approval==`function`?void 0:readDurableDynamicCallback(e.approval.response),o=readDurableDynamicCallback(e.approvalKey),s=readDurableDynamicCallback(e.execute),c=readDurableDynamicCallback(e.toModelOutput),l={};return s!==void 0&&(l.execute=s),(t!==void 0||n!==void 0||r!==void 0)&&(l.label={complete:t,delta:n,start:r}),o!==void 0&&(l.approvalKey=o),i!==void 0&&(l.approvalRequest=i),a!==void 0&&(l.approvalResponse=a),c!==void 0&&(l.toModelOutput=c),l}function readDurableDynamicToolCallbacks(e){return e[DURABLE_DYNAMIC_TOOL_CALLBACKS]}export{DURABLE_DYNAMIC_TOOL_CALLBACKS,callDurableDynamicCallback,clearDurableDynamicCallbacks,collectDurableDynamicToolCallbacks,defineDurableCallback,hasUnregisteredDurableDynamicCallbacks,lookupDurableDynamicCallback,readDurableDynamicCallback,readDurableDynamicToolCallbacks,registerDurableDynamicCallback,stampDurableDynamicCallback,stampDurableDynamicToolCallbacks};
1
+ import{readDurableSchema}from"#tools/durable-schema.js";import{resolveApprovalPolicy}from"#approval/definition.js";const STAMPED_CALLBACK=Symbol.for(`eve:durable-dynamic-callback`),DURABLE_DYNAMIC_TOOL_CALLBACKS=Symbol.for(`eve:durable-dynamic-tool-callbacks`),REGISTRY=Symbol.for(`eve:scoped-dynamic-tool-callbacks`);function getRegistry(){let e=globalThis;return e[REGISTRY]??=new Map}function getSessionBindings(e){let t=getRegistry(),n=t.get(e);return n!==void 0&&(t.delete(e),t.set(e,n)),n}function callbackKey(e,t){return JSON.stringify([e.scope,e.resolverSlug,e.entryKey,e.name,t])}function registerDurableDynamicCallback(e){let t=getRegistry(),n=getSessionBindings(e.owner.sessionId);n===void 0&&(n=new Map,t.set(e.owner.sessionId,n),t.size>1024&&t.delete(t.keys().next().value)),n.set(callbackKey(e.owner,e.phase),e.callback)}function lookupDurableDynamicCallback(e,t){return getSessionBindings(e.sessionId)?.get(callbackKey(e,t))}function clearDurableDynamicCallbacks(e,t){if(t===void 0){getRegistry().delete(e);return}let n=getSessionBindings(e);if(n===void 0)return;let r=JSON.stringify([t.scope,t.resolverSlug]).slice(0,-1)+`,`;for(let e of n.keys())e.startsWith(r)&&n.delete(e)}function callDurableDynamicCallback(e,t,...n){return e(t,...n)}function hasUnregisteredDurableDynamicCallbacks(e,t){return e.some(e=>durableCallbackPhases(e.callbacks).some(n=>lookupDurableDynamicCallback({...e,...t},n)===void 0))}function durableCallbackPhases(e){return[[`execute`,e.execute],[`inputSchema`,e.inputSchema],[`outputSchema`,e.outputSchema],[`labelComplete`,e.label?.complete],[`labelDelta`,e.label?.delta],[`labelStart`,e.label?.start],[`approvalKey`,e.approvalKey],[`approvalRequest`,e.approvalRequest],[`approvalResponse`,e.approvalResponse],[`toModelOutput`,e.toModelOutput]].flatMap(([e,t])=>t===void 0?[]:[e])}function defineDurableCallback(e){return stampDurableDynamicCallback((...t)=>e.callback(e.closure,...t),{callback:(t,...n)=>Reflect.apply(e.callback,void 0,[t,...n]),closure:e.closure})}function stampDurableDynamicCallback(e,t){return Object.defineProperty(e,STAMPED_CALLBACK,{configurable:!0,value:t}),e}function readDurableDynamicCallback(e){if(typeof e==`function`)return Reflect.get(e,STAMPED_CALLBACK)}function stampDurableDynamicToolCallbacks(e,t){Object.defineProperty(e,DURABLE_DYNAMIC_TOOL_CALLBACKS,{configurable:!0,value:t})}function collectDurableDynamicToolCallbacks(e){let t=readDurableDynamicCallback(e.label?.complete),n=readDurableDynamicCallback(e.label?.delta),r=readDurableDynamicCallback(e.label?.start),i=e.approval===void 0?void 0:readDurableDynamicCallback(resolveApprovalPolicy(e.approval)),a=e.approval===void 0||typeof e.approval==`function`?void 0:readDurableDynamicCallback(e.approval.response),o=readDurableDynamicCallback(e.approvalKey),s=readDurableDynamicCallback(e.execute),c=readDurableDynamicCallback(e.toModelOutput),l={},u=readDurableSchema(e.inputSchema),d=readDurableSchema(e.outputSchema);return u!==void 0&&(l.inputSchema=u),d!==void 0&&(l.outputSchema=d),s!==void 0&&(l.execute=s),(t!==void 0||n!==void 0||r!==void 0)&&(l.label={complete:t,delta:n,start:r}),o!==void 0&&(l.approvalKey=o),i!==void 0&&(l.approvalRequest=i),a!==void 0&&(l.approvalResponse=a),c!==void 0&&(l.toModelOutput=c),l}function readDurableDynamicToolCallbacks(e){return e[DURABLE_DYNAMIC_TOOL_CALLBACKS]}export{DURABLE_DYNAMIC_TOOL_CALLBACKS,callDurableDynamicCallback,clearDurableDynamicCallbacks,collectDurableDynamicToolCallbacks,defineDurableCallback,hasUnregisteredDurableDynamicCallbacks,lookupDurableDynamicCallback,readDurableDynamicCallback,readDurableDynamicToolCallbacks,registerDurableDynamicCallback,stampDurableDynamicCallback,stampDurableDynamicToolCallbacks};
@@ -0,0 +1,16 @@
1
+ import type { StandardSchemaV1 } from "#compiled/@standard-schema/spec/index.js";
2
+ import type { DurableCallbackJsonObject, StampedDurableDynamicCallback } from "#tools/durable-callbacks.js";
3
+ import { type ToolSchema, type ToolSchemaSource } from "#tools/schema.js";
4
+ export declare function hasSchemaValidator(source: unknown): source is StandardSchemaV1;
5
+ type DurableSchema<TSchema> = TSchema extends StandardSchemaV1 ? ToolSchema<StandardSchemaV1.InferInput<TSchema>, StandardSchemaV1.InferOutput<TSchema>> : TSchema;
6
+ /**
7
+ * Defines a replayable schema for dynamic tools returned by provider packages.
8
+ * Put per-tool values in `closure`; `schema` rebuilds the validator from that
9
+ * JSON snapshot. Authored inline schema expressions are transformed automatically.
10
+ */
11
+ export declare function defineDurableSchema<TClosure extends object, TSchema extends ToolSchemaSource | undefined>(input: {
12
+ readonly closure: TClosure & DurableCallbackJsonObject<TClosure>;
13
+ readonly schema: (closure: TClosure) => TSchema;
14
+ }): DurableSchema<TSchema>;
15
+ export declare function readDurableSchema(source: unknown): StampedDurableDynamicCallback | undefined;
16
+ export {};
@@ -0,0 +1 @@
1
+ import{serializeInputSchema,serializeOutputSchema}from"#tools/schema.js";const DURABLE_SCHEMA=Symbol.for(`eve:durable-dynamic-schema`);function hasSchemaValidator(e){if(typeof e!=`object`||!e||!(`~standard`in e))return!1;let t=e[`~standard`];return typeof t==`object`&&!!t&&`validate`in t&&typeof t.validate==`function`}function defineDurableSchema(e){let t=e.schema(e.closure);if(!hasSchemaValidator(t))return t;let n={"~standard":{version:1,vendor:`eve`,validate:e=>t[`~standard`].validate(e),jsonSchema:{input:()=>serializeInputSchema(t),output:()=>serializeOutputSchema(t)}}};return Object.defineProperty(n,DURABLE_SCHEMA,{value:{callback:t=>e.schema(t),closure:e.closure}}),n}function readDurableSchema(e){if(typeof e==`object`&&e)return Reflect.get(e,DURABLE_SCHEMA)}export{defineDurableSchema,hasSchemaValidator,readDurableSchema};
@@ -1,3 +1,3 @@
1
- import { n as defaultMessageReducer, t as useEveAgent } from "../chunks/use-eve-agent-X0asmJg-.js";
1
+ import { n as defaultMessageReducer, t as useEveAgent } from "../chunks/use-eve-agent-Dmc6sX4d.js";
2
2
 
3
3
  export { defaultMessageReducer, useEveAgent };
@@ -35,6 +35,8 @@ export interface UseEveAgentReturn<TData> {
35
35
  readonly events: ComputedRef<readonly MessageStreamEvent[]>;
36
36
  /** Replay the attached durable session and follow its in-flight turn, if any. */
37
37
  readonly resume: () => Promise<void>;
38
+ /** Create the session without starting its first turn. */
39
+ readonly prewarm: () => Promise<void>;
38
40
  /** Clear all state and start a new session. */
39
41
  readonly reset: () => void;
40
42
  /** Send a message with optional turn settings. */
@@ -98,6 +100,8 @@ export interface UseEveAgentOptions<TData> extends EveAgentStoreCallbacks<TData>
98
100
  * @default true
99
101
  */
100
102
  readonly optimistic?: boolean;
103
+ /** Prewarm an owned session on mount and after reset. @default false */
104
+ readonly prewarm?: boolean;
101
105
  /**
102
106
  * Projects stream events into `TData`.
103
107
  *
@@ -1,3 +1,3 @@
1
- import { t as useEveAgent } from "../chunks/use-eve-agent-X0asmJg-.js";
1
+ import { t as useEveAgent } from "../chunks/use-eve-agent-Dmc6sX4d.js";
2
2
 
3
3
  export { useEveAgent };
@@ -336,6 +336,7 @@ it falls back to the World's default retention period.
336
336
  | `experimental` | `AgentExperimentalDefinition` | unset | Unstable opt-ins. `workflow.world` selects the Workflow world package on the root agent; `workflow.modelCallsPerStep` batches sequential model calls into a wider replay unit; `workflow.retention` controls how long the durable runtime keeps run data. |
337
337
  | `outputSchema` | Standard Schema or a JSON Schema object | none | Structured return type for function-like invocations such as a subagent turn, schedule, or remote job. Ordinary interactive turns ignore it unless the client supplies a per-message schema. |
338
338
  | `build` | `{ externalDependencies?: string[] }` | none | Hosted-build packaging controls. `externalDependencies` keeps listed packages external while eve compiles authored modules such as tools and channels, and traces those packages into the hosted output. |
339
+ | `tool` | `boolean` | `true` | Exposes this agent to its parent model as a tool. On the root agent, controls the built-in `agent` tool. A subagent with `tool: false` remains callable from authored workflow tools through `ctx.agent()`. |
339
340
 
340
341
  `externalDependencies` is a packaging control only. It keeps selected packages as runtime dependencies in the hosted output; it does not authorize, configure, or review any third-party service those packages may call.
341
342
 
@@ -24,7 +24,7 @@ The default eve channel inspects the agent, creates sessions, accepts callbacks
24
24
 
25
25
  - `GET /eve/v1/health` (check whether the application is reachable)
26
26
  - `GET /eve/v1/info` (inspect the agent)
27
- - `POST /eve/v1/session` (start a session and send its first message)
27
+ - `POST /eve/v1/session` (create a session, optionally sending its first message)
28
28
  - `POST /eve/v1/session/:sessionId` (send a follow-up)
29
29
  - `POST /eve/v1/session/:sessionId/cancel` (cancel the in-flight turn)
30
30
  - `POST /eve/v1/session/:sessionId/clear` (clear the session's model history)
@@ -38,7 +38,21 @@ The session routes use only durable session IDs. Create a session explicitly, th
38
38
 
39
39
  ### Start and continue a session
40
40
 
41
- Start a session with an initial message, then use the returned `sessionId` for every follow-up and control operation:
41
+ Create a conversation session before its first message with a bodyless request:
42
+
43
+ ```bash
44
+ curl -X POST https://<deployment>/eve/v1/session
45
+ # {"ok":true,"sessionId":"wrun_A","status":"accepted"}
46
+ ```
47
+
48
+ See [Start a session](../concepts/sessions-runs-and-streaming#start-a-session) for the
49
+ initialization boundary, first-turn identity, readiness response, and retry behavior.
50
+
51
+ The create request still requires route auth. Session audience and the timeout are selected
52
+ at creation; they do not change when the first message arrives. Task mode and turn-scoped
53
+ fields such as `clientContext` and `outputSchema` require a message on the create request.
54
+
55
+ Include an initial message to create the session and start its first turn in one request:
42
56
 
43
57
  ```bash
44
58
  curl -X POST https://<deployment>/eve/v1/session \
@@ -47,11 +61,6 @@ curl -X POST https://<deployment>/eve/v1/session \
47
61
  # {"ok":true,"sessionId":"wrun_A","status":"accepted"}
48
62
  ```
49
63
 
50
- The `202` response means Workflow accepted the durable run. The route does not wait for command
51
- inbox or continuation-token ownership. The inbox may still be starting, so an immediate follow-up
52
- or control request can report that the session is not active. The event-stream client retries the
53
- brief window before the new run becomes readable.
54
-
55
64
  Authenticated callers that may retry a create request can pass their own `operationId` for
56
65
  create-once semantics. Once the operation owner is active, the same operation under the same
57
66
  authenticated principal returns that session instead of dispatching the input again. The create
@@ -69,7 +78,7 @@ curl -X POST https://<deployment>/eve/v1/session \
69
78
  # {"ok":true,"sessionId":"wrun_A","status":"accepted"}
70
79
  ```
71
80
 
72
- The first request requires `message`. A follow-up request accepts exactly one of
81
+ When the create request includes a message, a follow-up request accepts exactly one of
73
82
  `message` or `inputResponses`; use the latter to answer a pending HITL request:
74
83
 
75
84
  ```bash
@@ -82,8 +91,9 @@ Follow-up messages use `turnPolicy: "steer"` by default. Before assistant answer
82
91
 
83
92
  Set `turnPolicy: "queue"` on `eveChannel(...)` when follow-ups should wait for active turns to finish. `inputResponses` answer their addressed requests.
84
93
 
85
- Sending a message to an unknown, terminal, or not-yet-active session ID returns `409` with
94
+ Sending a message to an unknown or terminal session ID returns `409` with
86
95
  `{"code":"session_not_active","error":"The session is no longer active.","ok":false}`.
96
+ An existing workflow whose inbox is not yet available returns `409 session_not_ready` instead.
87
97
  TypeScript clients expose the stable code as `ClientError.code`. The route never
88
98
  creates or follows a replacement session.
89
99
 
@@ -225,7 +235,7 @@ export default eveChannel({
225
235
  });
226
236
  ```
227
237
 
228
- `onMessage` must return an auth result. Return `title` alongside `auth` to set the title when the dispatch starts a run. A successful canonical eve HTTP message always dispatches and therefore always produces or continues a session.
238
+ `onMessage` must return an auth result. Return `title` alongside `auth` to set the title when the dispatch creates a session or sends the first message to a prewarmed session. A successful canonical eve HTTP message always dispatches and therefore always produces or continues a session.
229
239
 
230
240
  ## Clients
231
241
 
@@ -58,6 +58,10 @@ See [Dynamic capabilities](../guides/dynamic-capabilities) for the resolver API,
58
58
 
59
59
  ## Compaction and clear
60
60
 
61
+ Before a model call, eve checks the projected history together with the effective system instructions and advertised tool schemas. The check runs after `step.started` resolves dynamic capabilities. When the provider reports input usage, eve adds estimates for new messages and growth in the instructions and tool catalog to that count; unchanged schemas are not counted again.
62
+
63
+ Compaction reserves space for those instructions and tools while reducing conversation history. It cannot shrink the instructions or tool catalog themselves, so keep them within the selected model's context window.
64
+
61
65
  User-role instructions follow the normal history lifecycle. Compaction can summarize them, and clear removes them without rerunning their static definitions or dynamic resolvers. System-role instructions remain outside history and continue to apply after either operation.
62
66
 
63
67
  Recalled memory also uses user-role messages, but eve keeps their attribution
@@ -33,16 +33,31 @@ React, Vue, and Svelte apps reach for [`useEveAgent()`](../guides/frontend/overv
33
33
 
34
34
  ## Start a session
35
35
 
36
+ Create and park a conversation session before its first turn by omitting `message`:
37
+
38
+ ```bash
39
+ curl -X POST http://127.0.0.1:2000/eve/v1/session
40
+ ```
41
+
42
+ eve starts the durable workflow, establishes its inbox, and waits for the first message before
43
+ running session-scoped initialization or emitting `session.started`. The first message sent to the returned
44
+ `sessionId` remains `turn_0`. Message-free creation supports conversation mode only and does not
45
+ accept turn-scoped `clientContext`, `outputSchema`, callbacks, or activity observers.
46
+
47
+ To create the session and start its first turn in one request, include the message:
48
+
36
49
  ```bash
37
50
  curl -X POST http://127.0.0.1:2000/eve/v1/session \
38
51
  -H 'content-type: application/json' \
39
52
  -d '{"message":"Summarize the latest forecast."}'
40
53
  ```
41
54
 
42
- eve responds with `202` and the durable `sessionId` in the JSON body and
55
+ In both forms, eve responds with `202` and the durable `sessionId` in the JSON body and
43
56
  `x-eve-session-id` header as soon as Workflow accepts the run. The command inbox can still be
44
- starting at that point. An immediate follow-up can return `409 session_not_active`; wait for
45
- `session.waiting` before sending the next message.
57
+ starting at that point. An immediate follow-up can return `409 session_not_ready`; retry that
58
+ code with bounded backoff. The TypeScript client retries sends for up to 20 seconds and respects
59
+ the caller's abort signal. Do not wait
60
+ for `session.waiting` on a prewarmed session: initialization and its first events require a message.
46
61
 
47
62
  ## Stream a session
48
63
 
@@ -100,11 +100,11 @@ Prefer `allow` for the smallest safe surface, especially when the server exposes
100
100
 
101
101
  ## Approval gates
102
102
 
103
- Use the shared `approval` option to gate every tool served by an MCP connection. The [connections overview](../connections#per-connection-approval) defines the `never()`, `once()`, and `always()` helpers; [Human-in-the-loop](../human-in-the-loop#approvals) defines the pause-and-resume contract.
103
+ Use the shared `approval` option to gate every tool served by an MCP connection. The [connections overview](../connections#per-connection-approval) defines the `never()`, `once()`, `always()`, and `auto()` helpers; [Human-in-the-loop](../human-in-the-loop#approvals) defines the pause-and-resume contract.
104
104
 
105
105
  ### Gate specific tools by name or input
106
106
 
107
- A remote MCP server usually mixes read tools with destructive or publishing ones, so a blanket `always()` would prompt on every harmless call. Pass a custom policy instead — the same [`Approval`](/docs/human-in-the-loop#approvals) shape authored tools use — to gate only the calls that matter. The policy receives `{ session, toolName, toolInput, approvedTools }` and returns an approval status, synchronously or as a promise.
107
+ A remote MCP server usually mixes read tools with destructive or publishing ones, so a blanket `always()` would prompt on every harmless call. Pass a custom policy instead — the same [`Approval`](/docs/human-in-the-loop#approvals) shape authored tools use — to gate only the calls that matter. The policy receives `{ session, toolName, toolInput, approvedTools, callId, abortSignal }` and returns an approval status, synchronously or as a promise.
108
108
 
109
109
  This connection always gates deletes, gates a publish only when the call actually schedules a post, and lets everything else through:
110
110
 
@@ -172,7 +172,7 @@ export default defineMcpClientConnection({
172
172
  });
173
173
  ```
174
174
 
175
- `never()` lets every call through, `once()` asks for approval the first time in a session, and `always()` asks every time. The pause and resume is the same human-in-the-loop flow covered in [Tools](/docs/tools).
175
+ `never()` lets every call through, `once()` asks for approval the first time in a session, `always()` asks every time, and `auto()` uses an evaluation model to allow routine calls and ask about dangerous or unclear effects. The pause and resume is the same human-in-the-loop flow covered in [Tools](/docs/tools).
176
176
 
177
177
  For connection tools that can create, modify, delete, transmit, purchase, message, or access sensitive data, use approval, allow-lists, or other safeguards appropriate to the action.
178
178
 
@@ -50,15 +50,15 @@ attached.messageIncludes("Sunny");
50
50
 
51
51
  ## Value assertions with `t.check`
52
52
 
53
- `t.check(value, assertion)` grades an explicit value against a builder from `eve/evals/expect`. The value can be `t.reply`, a turn's `.message`, parsed JSON, or any local you computed:
53
+ `t.check(value, assertion)` grades an explicit value against a builder from `eve/evals/expect`. The value can be a turn’s `.message`, parsed JSON, or any local you computed:
54
54
 
55
55
  ```ts
56
56
  import { includes, equals, matches, satisfies, similarity } from "eve/evals/expect";
57
57
 
58
- t.check(t.reply, includes(/sunny/i)); // substring or RegExp (gate)
58
+ t.check(turn.message, includes(/sunny/i)); // substring or RegExp (gate)
59
59
  t.check(parsed, equals({ city: "Brooklyn" })); // deep structural equality (gate)
60
60
  t.check(parsed, matches(WeatherSchema)); // Standard Schema, e.g. Zod (gate)
61
- t.check(t.reply, similarity("Sunny, 72F")); // fuzzy 0–1 Levenshtein (soft)
61
+ t.check(turn.message, similarity("Sunny, 72F")); // fuzzy 0–1 Levenshtein (soft)
62
62
  t.check(
63
63
  latencyMs,
64
64
  satisfies((value) => value < 1_000, "latency under one second"),
@@ -114,7 +114,7 @@ const request = session.requireInputRequest({
114
114
 
115
115
  ## Run state and derived facts
116
116
 
117
- Beyond the raw `t.events` stream, the runner derives typed facts the assertions read: tool calls (name, input, output, lifecycle status), subagent calls, and HITL input requests. A turn that leaves the session open for a next message is the normal end state of a successful turn; parking on unanswered HITL input is tracked separately.
117
+ Beyond the raw `session.events` stream, the runner derives typed facts the assertions read: tool calls (name, input, output, lifecycle status), subagent calls, and HITL input requests. A turn that leaves the session open for a next message is the normal end state of a successful turn; parking on unanswered HITL input is tracked separately.
118
118
 
119
119
  Typed event matching covers presence, absence, numeric or predicate counts, partial event data, and ordering:
120
120
 
@@ -166,8 +166,8 @@ The defaults are chosen so you rarely set severity. Run-level methods and `inclu
166
166
 
167
167
  ```ts
168
168
  t.calledTool("get_weather").soft(); // record the tool call as a metric, don't gate
169
- t.check(t.reply, similarity("Sunny")).label("forecast wording").atLeast(0.8);
170
- t.check(t.reply, includes("error")).soft(); // track without failing the build
169
+ t.check(turn.message, similarity("Sunny")).label("forecast wording").atLeast(0.8);
170
+ t.check(turn.message, includes("error")).soft(); // track without failing the build
171
171
  ```
172
172
 
173
173
  ## What to read next
@@ -15,7 +15,7 @@ export default defineEvalConfig({});
15
15
 
16
16
  ## Single-turn evals
17
17
 
18
- The common case sends one turn and asserts on the reply. `t.send(input)` resolves once the turn settles, and `t.reply` is the last assistant message:
18
+ The common case sends one turn and asserts on the reply. `t.send(input)` resolves once the turn settles, and the returned turn’s `.message` is the assistant reply:
19
19
 
20
20
  ```ts title="evals/weather/brooklyn-forecast.eval.ts"
21
21
  import { defineEval } from "eve/evals";
@@ -23,9 +23,9 @@ import { includes } from "eve/evals/expect";
23
23
 
24
24
  export default defineEval({
25
25
  async test(t) {
26
- await t.send("What is the weather in Brooklyn?");
26
+ const turn = await t.send("What is the weather in Brooklyn?");
27
27
  t.succeeded();
28
- t.check(t.reply, includes("Sunny"));
28
+ t.check(turn.message, includes("Sunny"));
29
29
  },
30
30
  });
31
31
  ```
@@ -60,7 +60,7 @@ evals/
60
60
 
61
61
  ## Multi-turn evals
62
62
 
63
- Drive several turns in sequence for branching, HITL approvals, structured output, attachments, or multiple sessions. Because assertions live in the function, an intermediate value is a local variable. Judge a draft before the next turn overwrites it, then keep going.
63
+ Drive several turns in sequence for branching, HITL approvals, structured output, attachments, or multiple sessions. Because assertions live in the function, an intermediate value is a local variable. Keep each turn in a local variable and continue through its `.session`.
64
64
 
65
65
  ```ts title="evals/draft-then-send.eval.ts"
66
66
  import { defineEval } from "eve/evals";
@@ -72,7 +72,7 @@ export default defineEval({
72
72
  t.check(draft.message, includes("Best regards"));
73
73
  t.judge.autoevals.closedQA("professional tone", { on: draft.message }).atLeast(0.6);
74
74
 
75
- await t.send("Now send it.");
75
+ await draft.session.send("Now send it.");
76
76
  t.calledTool("send_email");
77
77
  },
78
78
  });
@@ -88,7 +88,7 @@ export default defineEval({
88
88
  async test(t) {
89
89
  const first = await t.send("My favorite word is marigold.");
90
90
 
91
- const second = await t.send("What is my favorite word?");
91
+ const second = await first.session.send("What is my favorite word?");
92
92
  await t.require(second.sessionId, equals(first.sessionId));
93
93
 
94
94
  t.succeeded();
@@ -96,7 +96,7 @@ export default defineEval({
96
96
 
97
97
  t.judge.autoevals
98
98
  .closedQA("The assistant remembers the user's favorite word across turns", {
99
- on: t.transcript,
99
+ on: first.session.transcript,
100
100
  })
101
101
  .atLeast(0.8);
102
102
  },
@@ -105,21 +105,56 @@ export default defineEval({
105
105
 
106
106
  ## The drive API
107
107
 
108
- `t` drives the primary session; `t.newSession()` returns an independent `EveEvalSession` against the same target, whose events feed the same run-level assertions.
108
+ Every `t.session()` or `t.send()` creates a new independent conversation. Continue an existing conversation through its session handle. Events from all sessions feed the same run-level assertions.
109
109
 
110
- - `t.send(message, options?)` sends a turn and waits for it to settle. It matches `ClientSession.send()` and resolves to a turn carrying `.message` and `.expectOk()`.
111
- - `t.start(message)` starts a text turn but returns as soon as the server accepts it. The returned live turn exposes `.sessionId`, `.waitForEvent(...)`, `.cancel()`, and `.result()` for coordinating with work that is still running.
112
- - `t.cancel()` requests cooperative cancellation of the primary session's active turn. Both `accepted` and `no_active_turn` are successful outcomes.
113
- - `t.sendFile(text, path, mediaType?)` attaches a local file as a data URL.
114
- - `t.requireInputRequest(filter?)` records a gate, requires exactly one pending request, and returns it. Filters match tool name, action input, prompt, display, and option ids.
115
- - `t.respond(responses, options?)` answers specific pending input requests and sends them as the next turn.
116
- - `t.respondAll(optionId)` answers every pending input request with the same option and sends the responses as the next turn.
117
- - `t.reply` is the last assistant message (or `null`); `t.sessionId` is the current session id; `t.events` is the full typed event stream captured so far.
118
- - `t.transcript` formats the primary session's observed user and assistant messages in turn order. Pass it as a judge's `on` value to grade the complete conversation. An independent session returned by `t.newSession()` exposes its own `session.transcript`.
110
+ - `t.session(options?)` creates a session without starting a turn or consuming its stream. It resolves on `202 Accepted` with an `EveEvalSession` whose `.sessionId` and `.state` are available. Options accept per-request `headers` and `signal`; creation uses the eval timeout signal by default.
111
+ - `t.send(message, options?)` creates a new session with its first message in one request and waits for the turn to settle. The returned turn carries `.session`, `.message`, and `.expectOk()`.
112
+ - `session.send(message, options?)` sends a follow-up on that session and waits for it to settle.
113
+ - `session.start(message, options?)` starts a text turn and returns as soon as the server accepts it. The live turn exposes `.session`, `.sessionId`, `.waitForEvent(...)`, `.cancel()`, and `.result()`.
114
+ - `session.cancel()` requests cooperative cancellation of that session's active turn. Both `accepted` and `no_active_turn` are successful outcomes.
115
+ - `session.sendFile(text, path, mediaType?)` attaches a local file as a data URL.
116
+ - `session.requireInputRequest(filter?)` records a gate, requires exactly one pending request, and returns it. Filters match tool name, action input, prompt, display, and option ids.
117
+ - `session.respond(responses, options?)` answers specific pending input requests and sends them as the next turn. `session.startRespond(...)` returns a live turn for the same operation.
118
+ - `session.respondAll(optionId)` answers every pending input request with the same option and sends the responses as the next turn.
119
+ - `session.events` contains the events captured for that session. `session.transcript` formats its observed user and assistant messages in turn order.
119
120
 
120
- The transcript uses `User:` and `Assistant:` labels separated by blank lines. It excludes reasoning, tool calls, tool results, and messages from other sessions. It updates after each turn settles, so read it after `await t.send(...)`, `await t.respond(...)`, or `await live.result()`.
121
+ The transcript uses `User:` and `Assistant:` labels separated by blank lines. It excludes reasoning, tool calls, tool results, and messages from other sessions. It updates after each turn settles, so read it after `await session.send(...)`, `await session.respond(...)`, or `await live.result()`.
121
122
 
122
- Each `send` (and `respond`/`respondAll`) resolves to an immutable turn with `.message`, `.data`, `.events`, `.inputRequests`, `.toolCalls`, `.sessionId`, `.status`, and `.expectOk()`. Use `.sessionId` to relate turns or attach follow-up work to the session that produced a specific turn. `expectOk()` throws only when the turn ended failed; a session left open for a next message is the normal end state of a successful turn.
123
+ Each `send` (and `respond`/`respondAll`) resolves to a turn with `.message`, `.data`, `.events`, `.inputRequests`, `.toolCalls`, `.session`, `.sessionId`, `.status`, and `.expectOk()`. Turn results retain their captured output and events; `.session` references the live conversation handle. `expectOk()` throws only when the turn ended failed; a session left open for a next message is the normal end state of a successful turn.
124
+
125
+ ## Prewarming a session
126
+
127
+ Use `t.session()` to create a session before its first message:
128
+
129
+ ```ts title="evals/prewarm.eval.ts"
130
+ import { defineEval } from "eve/evals";
131
+ import { equals } from "eve/evals/expect";
132
+
133
+ export default defineEval({
134
+ async test(t) {
135
+ const session = await t.session();
136
+ const turn = await session.send("Greet Alice briefly.");
137
+ await t.require(turn.sessionId, equals(session.sessionId));
138
+ turn.event("session.started", { count: 1 });
139
+ turn.event("turn.started", { count: 1, data: { turnId: "turn_0" } });
140
+ t.succeeded();
141
+ },
142
+ });
143
+ ```
144
+
145
+ Acceptance is not an initialization barrier. The first message runs session initialization;
146
+ the TypeScript client handles bounded retries if the workflow inbox is still starting.
147
+ Creation failures reject `t.session()` without returning a handle. Each call creates an
148
+ independent session, including concurrent calls. Accepted sessions appear in eval results
149
+ and participate in timeout cleanup even when no message was sent.
150
+
151
+ ## Migrating existing evals
152
+
153
+ Replace `t.newSession()` and `t.prewarm()` with `const session = await t.session()`.
154
+ Replace consecutive `t.send()` calls with `session.send()` calls, or continue the first
155
+ returned turn through `turn.session.send()`. Read identity, cursor, events, and transcript
156
+ from `session`; read replies from `turn.message`. Session operations such as `respond()`,
157
+ `requireInputRequest()`, and `cancel()` also move from `t` to `session`.
123
158
 
124
159
  ## In-flight turns
125
160
 
@@ -130,7 +165,8 @@ import { defineEval } from "eve/evals";
130
165
 
131
166
  export default defineEval({
132
167
  async test(t) {
133
- const live = await t.start("Run the long operation.");
168
+ const session = await t.session();
169
+ const live = await session.start("Run the long operation.");
134
170
 
135
171
  await live.waitForEvent("actions.requested", {
136
172
  data: {
@@ -152,7 +188,7 @@ export default defineEval({
152
188
 
153
189
  Use `expectOk()` only when the next operation depends on that intermediate turn succeeding. A final `t.succeeded()` already records a complete-run gate.
154
190
 
155
- To intentionally omit an eval for the current target, call `t.skip(reason)` before sending messages or recording assertions. Skipped evals are reported separately and do not affect the exit code.
191
+ To intentionally omit an eval for the current target, call `t.skip(reason)` before creating sessions, sending messages, or recording assertions. Skipped evals are reported separately and do not affect the exit code.
156
192
 
157
193
  Events from every session are captured in the result and artifacts. `t.log(message)` records debug lines into the eval artifact; `--verbose` also streams them to stdout as evals run. `t.signal` is an `AbortSignal` that fires on timeout.
158
194
 
@@ -174,9 +210,9 @@ export default rows.map((row) =>
174
210
  defineEval({
175
211
  description: row.task,
176
212
  async test(t) {
177
- await t.send(row.prompt);
213
+ const turn = await t.send(row.prompt);
178
214
  t.succeeded();
179
- t.check(t.reply, equals(row.sql));
215
+ t.check(turn.message, equals(row.sql));
180
216
  },
181
217
  }),
182
218
  );