eve 0.86.0 → 0.88.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (282) hide show
  1. package/CHANGELOG.md +25 -0
  2. package/README.md +1 -1
  3. package/dist/src/acp/adapter.d.ts +2 -26
  4. package/dist/src/acp/adapter.js +1 -1
  5. package/dist/src/acp/server.d.ts +0 -3
  6. package/dist/src/ai/decision-adapter.d.ts +5 -3
  7. package/dist/src/ai/decision-adapter.js +1 -1
  8. package/dist/src/ai/decision-types.d.ts +4 -3
  9. package/dist/src/channel/adapter.d.ts +0 -14
  10. package/dist/src/channel/auth/definitions.d.ts +0 -4
  11. package/dist/src/channel/channel-address.d.ts +1 -1
  12. package/dist/src/channel/channel-address.js +1 -1
  13. package/dist/src/channel/channel-operations.d.ts +2 -2
  14. package/dist/src/channel/channel-operations.js +1 -1
  15. package/dist/src/channel/prompt-queue.d.ts +0 -2
  16. package/dist/src/channel/session-not-active-error.d.ts +10 -5
  17. package/dist/src/channel/session-not-active-error.js +1 -1
  18. package/dist/src/channel/session-stranded-error.d.ts +1 -1
  19. package/dist/src/channel/session.d.ts +3 -4
  20. package/dist/src/channel/session.js +1 -1
  21. package/dist/src/channel/types.d.ts +5 -14
  22. package/dist/src/chunks/{use-eve-agent-B2jCfcnG.js → use-eve-agent-BExXjBv6.js} +82 -72
  23. package/dist/src/chunks/{use-eve-agent-DCLFi26P.js → use-eve-agent-C0KHCyb9.js} +82 -72
  24. package/dist/src/cli/dev/command-options.d.ts +4 -4
  25. package/dist/src/cli/dev/command.js +1 -1
  26. package/dist/src/cli/dev/tui/runner.js +1 -1
  27. package/dist/src/cli/dev/tui/test/fake-eve-server.js +1 -1
  28. package/dist/src/cli/dev/tui/tool-format.d.ts +2 -2
  29. package/dist/src/cli/dev/ui-options.d.ts +4 -4
  30. package/dist/src/cli/dev/ui-options.js +1 -1
  31. package/dist/src/client/agent-info-error.d.ts +4 -1
  32. package/dist/src/client/agent-info-error.js +1 -1
  33. package/dist/src/client/agent-session.d.ts +1 -4
  34. package/dist/src/client/agent-session.js +1 -1
  35. package/dist/src/client/agent-stream-follower.js +1 -1
  36. package/dist/src/client/client-error.d.ts +13 -4
  37. package/dist/src/client/client-error.js +1 -1
  38. package/dist/src/client/delivery.d.ts +2 -17
  39. package/dist/src/client/health-response-error.d.ts +4 -1
  40. package/dist/src/client/health-response-error.js +1 -1
  41. package/dist/src/client/index.d.ts +5 -3
  42. package/dist/src/client/index.js +1 -1
  43. package/dist/src/client/open-stream.d.ts +7 -12
  44. package/dist/src/client/open-stream.js +1 -1
  45. package/dist/src/client/session-controls.d.ts +2 -2
  46. package/dist/src/client/session-controls.js +1 -1
  47. package/dist/src/client/session-event-stream.d.ts +2 -2
  48. package/dist/src/client/session-event-stream.js +1 -1
  49. package/dist/src/client/session-store.d.ts +2 -6
  50. package/dist/src/client/session-store.js +1 -1
  51. package/dist/src/client/session.d.ts +4 -13
  52. package/dist/src/client/session.js +1 -1
  53. package/dist/src/client/sessions.d.ts +3 -6
  54. package/dist/src/client/types.d.ts +23 -32
  55. package/dist/src/compiled/.vendor-stamp.json +3 -3
  56. package/dist/src/compiled/@vercel/agent-runs/LICENSE +202 -0
  57. package/dist/src/compiler/manifest.js +1 -1
  58. package/dist/src/compiler/normalize-agent-config.js +1 -1
  59. package/dist/src/compiler/normalize-connection.d.ts +1 -1
  60. package/dist/src/compiler/normalize-connection.js +1 -1
  61. package/dist/src/compiler/normalize-instructions.js +1 -1
  62. package/dist/src/compiler/normalize-skill.js +1 -1
  63. package/dist/src/compiler/resolve-workspace-subagent.js +1 -1
  64. package/dist/src/context/memory-tools.d.ts +9 -5
  65. package/dist/src/discover/sandbox.js +1 -1
  66. package/dist/src/dynamic/definition.d.ts +11 -5
  67. package/dist/src/dynamic/definition.js +1 -1
  68. package/dist/src/evals/mock-model.d.ts +1 -1
  69. package/dist/src/evals/session-manager.d.ts +0 -2
  70. package/dist/src/evals/session.d.ts +1 -11
  71. package/dist/src/evals/session.js +1 -1
  72. package/dist/src/eve-channel/index.js +1 -1
  73. package/dist/src/eve-channel/support.js +1 -1
  74. package/dist/src/execution/dynamic-workflow/tool.js +1 -1
  75. package/dist/src/execution/effective-agent-config.js +1 -1
  76. package/dist/src/execution/sandbox/bindings/just-bash-runtime.d.ts +1 -2
  77. package/dist/src/execution/sandbox/bindings/just-bash-runtime.js +1 -1
  78. package/dist/src/execution/sandbox/bindings/just-bash.js +1 -1
  79. package/dist/src/execution/tools/agent-router-workflow.js +1 -1
  80. package/dist/src/extensions/git/extension/extension.d.ts +5 -2
  81. package/dist/src/extensions/git/extension/extension.js +1 -1
  82. package/dist/src/extensions/git/extension/instructions/github.js +1 -1
  83. package/dist/src/extensions/git/extension/lib/connect-user-auth.d.ts +15 -0
  84. package/dist/src/extensions/git/extension/lib/connect-user-auth.js +1 -0
  85. package/dist/src/extensions/git/extension/lib/gh-tool.d.ts +8 -1
  86. package/dist/src/extensions/git/extension/lib/gh-tool.js +1 -1
  87. package/dist/src/extensions/git/extension/lib/github-guidance.d.ts +2 -1
  88. package/dist/src/extensions/git/extension/lib/github-guidance.js +14 -1
  89. package/dist/src/extensions/git/extension/lib/github-shell.d.ts +12 -4
  90. package/dist/src/extensions/git/extension/lib/github-shell.js +1 -1
  91. package/dist/src/instrumentation/ai-sdk-telemetry.d.ts +0 -2
  92. package/dist/src/instrumentation/providers.d.ts +1 -38
  93. package/dist/src/instrumentation/providers.js +1 -1
  94. package/dist/src/instrumentation/setup-context.d.ts +1 -7
  95. package/dist/src/internal/application/package.d.ts +1 -0
  96. package/dist/src/internal/application/package.js +1 -1
  97. package/dist/src/internal/application/stamped-package-version.js +1 -1
  98. package/dist/src/internal/authored-definition/core.js +1 -1
  99. package/dist/src/internal/authored-definition/schema-backed.js +1 -1
  100. package/dist/src/internal/classify-model-routing.d.ts +2 -3
  101. package/dist/src/internal/nitro/host/create-application-nitro.js +1 -1
  102. package/dist/src/internal/runtime-model.d.ts +9 -4
  103. package/dist/src/internal/runtime-model.js +1 -1
  104. package/dist/src/internal/workflow-bundle/authored-workflow-directives.js +1 -1
  105. package/dist/src/internal/workflow-bundle/builder-support.d.ts +1 -1
  106. package/dist/src/internal/workflow-bundle/builder-support.js +1 -1
  107. package/dist/src/internal/workflow-bundle/workflow-transformer.js +1 -1
  108. package/dist/src/models/auto.js +1 -1
  109. package/dist/src/protocol/delivery.d.ts +1 -0
  110. package/dist/src/protocol/reset-session.d.ts +0 -2
  111. package/dist/src/protocol/routes.d.ts +9 -2
  112. package/dist/src/protocol/routes.js +1 -1
  113. package/dist/src/public/channels/chat-sdk/chatSdkChannel.d.ts +1 -22
  114. package/dist/src/public/channels/discord/discordChannel.d.ts +3 -12
  115. package/dist/src/public/channels/discord/gateway/{index.d.ts → relay.d.ts} +2 -2
  116. package/dist/src/public/channels/discord/gateway/relay.js +1 -0
  117. package/dist/src/public/channels/discord/messages.d.ts +4 -4
  118. package/dist/src/public/channels/github/state.d.ts +0 -2
  119. package/dist/src/public/channels/index.d.ts +1 -2
  120. package/dist/src/public/channels/index.js +1 -1
  121. package/dist/src/public/channels/linear/index.d.ts +1 -1
  122. package/dist/src/public/channels/linear/index.js +1 -1
  123. package/dist/src/public/channels/linear/linearChannel.d.ts +0 -5
  124. package/dist/src/public/channels/linq/index.d.ts +1 -1
  125. package/dist/src/public/channels/linq/linqChannel.d.ts +7 -5
  126. package/dist/src/public/channels/photon/index.d.ts +1 -1
  127. package/dist/src/public/channels/photon/photonIMessageChannel.d.ts +15 -4
  128. package/dist/src/public/channels/slack/api.d.ts +1 -1
  129. package/dist/src/public/channels/slack/api.js +1 -1
  130. package/dist/src/public/channels/slack/app-manifest.d.ts +4 -0
  131. package/dist/src/public/channels/slack/app-manifest.js +1 -1
  132. package/dist/src/public/channels/slack/auth.d.ts +1 -0
  133. package/dist/src/public/channels/slack/auth.js +1 -1
  134. package/dist/src/public/channels/slack/blocks.d.ts +1 -1
  135. package/dist/src/public/channels/slack/blocks.js +2 -2
  136. package/dist/src/public/channels/slack/cards.d.ts +2 -297
  137. package/dist/src/public/channels/slack/cards.js +1 -1
  138. package/dist/src/public/channels/slack/defaults.js +1 -1
  139. package/dist/src/public/channels/slack/inbound.d.ts +7 -0
  140. package/dist/src/public/channels/slack/index.d.ts +3 -2
  141. package/dist/src/public/channels/slack/index.js +1 -1
  142. package/dist/src/public/channels/slack/model-context.d.ts +3 -2
  143. package/dist/src/public/channels/slack/model-context.js +3 -3
  144. package/dist/src/public/channels/slack/session-operations.d.ts +2 -2
  145. package/dist/src/public/channels/slack/session-operations.js +1 -1
  146. package/dist/src/public/channels/slack/slackChannel.d.ts +37 -72
  147. package/dist/src/public/channels/slack/slackChannel.js +1 -1
  148. package/dist/src/public/channels/slack/user-info.d.ts +64 -0
  149. package/dist/src/public/channels/slack/user-info.js +1 -0
  150. package/dist/src/public/channels/teams/teamsChannel.d.ts +4 -3
  151. package/dist/src/public/channels/telegram/hitl.d.ts +2 -9
  152. package/dist/src/public/channels/telegram/index.d.ts +1 -1
  153. package/dist/src/public/channels/telegram/telegramChannel.d.ts +0 -2
  154. package/dist/src/public/channels/twilio/twilioChannel.d.ts +0 -2
  155. package/dist/src/public/channels/undelivered-reply.d.ts +0 -5
  156. package/dist/src/public/definitions/agent.d.ts +15 -7
  157. package/dist/src/public/definitions/agent.js +1 -1
  158. package/dist/src/public/definitions/channel.d.ts +7 -5
  159. package/dist/src/public/definitions/channel.js +1 -1
  160. package/dist/src/public/definitions/connections/protocol.d.ts +1 -7
  161. package/dist/src/public/definitions/connections/protocol.js +1 -1
  162. package/dist/src/public/experimental/channels/discord/gateway.d.ts +1 -0
  163. package/dist/src/public/experimental/channels/discord/gateway.js +1 -0
  164. package/dist/src/public/experimental/sandbox/just-bash.d.ts +1 -0
  165. package/dist/src/public/experimental/sandbox/just-bash.js +1 -0
  166. package/dist/src/public/experimental/workspace/index.d.ts +1 -0
  167. package/dist/src/public/experimental/workspace/index.js +1 -0
  168. package/dist/src/public/index.d.ts +2 -2
  169. package/dist/src/public/index.js +1 -1
  170. package/dist/src/public/instrumentation/otel.d.ts +1 -1
  171. package/dist/src/public/instrumentation/provider.d.ts +1 -1
  172. package/dist/src/public/instrumentation/provider.js +1 -1
  173. package/dist/src/public/memory/file/backend.d.ts +1 -1
  174. package/dist/src/public/memory/file/backends/in-memory.js +1 -1
  175. package/dist/src/public/memory/file/backends/vercel-blob.js +1 -1
  176. package/dist/src/public/memory/file/provider.js +1 -1
  177. package/dist/src/public/memory/index.d.ts +3 -11
  178. package/dist/src/public/models/anthropic/index.d.ts +1 -1
  179. package/dist/src/public/models/index.d.ts +1 -0
  180. package/dist/src/public/models/openai/index.d.ts +2 -2
  181. package/dist/src/public/next/index.d.ts +2 -2
  182. package/dist/src/public/sandbox/just-bash-sandbox.d.ts +27 -20
  183. package/dist/src/public/sandbox/just-bash.d.ts +0 -1
  184. package/dist/src/public/sessions/index.d.ts +1 -0
  185. package/dist/src/public/sessions/index.js +1 -1
  186. package/dist/src/public/tools/index.d.ts +1 -1
  187. package/dist/src/public/tools/index.js +1 -1
  188. package/dist/src/public/workflow/api.d.ts +25 -0
  189. package/dist/src/public/workflow/api.js +1 -0
  190. package/dist/src/public/workflow/index.d.ts +76 -0
  191. package/dist/src/public/workflow/index.js +1 -0
  192. package/dist/src/public/workflow-modules.d.ts +2 -17
  193. package/dist/src/react/use-eve-agent.d.ts +3 -2
  194. package/dist/src/react/use-eve-agent.js +1 -1
  195. package/dist/src/reactions/kinds/model.js +1 -1
  196. package/dist/src/runtime/agent/resolve-model.js +1 -1
  197. package/dist/src/runtime/resolve-agent.js +1 -1
  198. package/dist/src/runtime/resolve-dynamic.js +1 -1
  199. package/dist/src/runtime/subagents/dynamic-agent-config.js +1 -1
  200. package/dist/src/runtime/subagents/workflow.js +1 -1
  201. package/dist/src/sandbox/providers/default.js +1 -1
  202. package/dist/src/self-modification/extension/subagents/agent/agent.d.ts +2 -2
  203. package/dist/src/self-modification/sandbox.js +1 -1
  204. package/dist/src/setup/integrations/discord/daemon.js +2 -2
  205. package/dist/src/setup/scaffold/create/project.js +2 -2
  206. package/dist/src/setup/scaffold/create/web-template.d.ts +2 -2
  207. package/dist/src/setup/scaffold/create/web-template.js +2 -2
  208. package/dist/src/setup/verified-remote-agent.d.ts +1 -3
  209. package/dist/src/shared/agent-definition.d.ts +18 -9
  210. package/dist/src/shared/eve-error.d.ts +22 -0
  211. package/dist/src/shared/eve-error.js +1 -0
  212. package/dist/src/shared/session.d.ts +2 -2
  213. package/dist/src/shared/token-usage.d.ts +7 -1
  214. package/dist/src/svelte/index.js +1 -1
  215. package/dist/src/svelte/use-eve-agent.d.ts +2 -1
  216. package/dist/src/svelte/use-eve-agent.js +1 -1
  217. package/dist/src/tools/definition.d.ts +7 -5
  218. package/dist/src/tools/definition.js +1 -1
  219. package/dist/src/tools/provided/ask-question-workflow.js +1 -1
  220. package/dist/src/tools/provided/sleep-workflow.js +1 -1
  221. package/dist/src/tracing/eve/batch-span-processor.d.ts +1 -1
  222. package/dist/src/tracing/eve/content-span-processor.d.ts +1 -19
  223. package/dist/src/tracing/eve/otel-configuration.d.ts +6 -0
  224. package/dist/src/tracing/eve/otel-declaration.d.ts +6 -19
  225. package/dist/src/tracing/eve/span-export-policy.d.ts +0 -2
  226. package/dist/src/tracing/local/instrumentation-runtime.d.ts +0 -3
  227. package/dist/src/tracing/local/traces.d.ts +0 -13
  228. package/dist/src/vue/index.js +1 -1
  229. package/dist/src/vue/use-eve-agent.d.ts +3 -2
  230. package/dist/src/vue/use-eve-agent.js +1 -1
  231. package/docs/agent-config.md +15 -11
  232. package/docs/channels/custom.mdx +26 -10
  233. package/docs/channels/discord.mdx +10 -10
  234. package/docs/channels/eve.mdx +14 -8
  235. package/docs/channels/linear.mdx +11 -0
  236. package/docs/channels/linq.mdx +5 -1
  237. package/docs/channels/photon.mdx +6 -1
  238. package/docs/channels/slack.mdx +141 -15
  239. package/docs/channels/telegram.mdx +6 -0
  240. package/docs/code-extension.mdx +76 -12
  241. package/docs/concepts/default-harness.md +2 -2
  242. package/docs/concepts/execution-model-and-durability.mdx +11 -11
  243. package/docs/concepts/security-model.md +2 -2
  244. package/docs/concepts/sessions-runs-and-streaming.md +23 -10
  245. package/docs/concepts/upgrade-to-v27-events.md +2 -1
  246. package/docs/connections/overview.mdx +4 -0
  247. package/docs/evals/reporters.mdx +21 -0
  248. package/docs/extensions.md +12 -0
  249. package/docs/getting-started.mdx +5 -1
  250. package/docs/guides/auth-and-route-protection.md +1 -1
  251. package/docs/guides/client/continuations.mdx +12 -10
  252. package/docs/guides/client/messages.mdx +24 -1
  253. package/docs/guides/client/overview.mdx +8 -6
  254. package/docs/guides/client/streaming.mdx +24 -6
  255. package/docs/guides/decide.md +3 -3
  256. package/docs/guides/deployment/vercel.mdx +1 -1
  257. package/docs/guides/dev-tui.md +2 -2
  258. package/docs/guides/frontend/overview.mdx +1 -1
  259. package/docs/guides/frontend/use-eve-agent-svelte.mdx +13 -11
  260. package/docs/guides/frontend/use-eve-agent-vue.mdx +13 -11
  261. package/docs/guides/frontend/use-eve-agent.mdx +4 -4
  262. package/docs/guides/instrumentation/otel.mdx +3 -1
  263. package/docs/guides/prepare-for-1-0.md +255 -0
  264. package/docs/guides/remote-agents.md +22 -20
  265. package/docs/instructions.mdx +1 -1
  266. package/docs/memory/custom-provider.md +1 -1
  267. package/docs/memory/file.md +11 -2
  268. package/docs/meta.json +1 -0
  269. package/docs/reference/agent-files.md +17 -17
  270. package/docs/reference/cli.md +14 -9
  271. package/docs/reference/typescript-api.md +46 -20
  272. package/docs/sandbox/custom-providers.mdx +2 -0
  273. package/docs/sandbox/default.mdx +6 -6
  274. package/docs/sandbox/index.mdx +5 -5
  275. package/docs/sandbox/just-bash.mdx +30 -21
  276. package/docs/subagents/index.mdx +4 -4
  277. package/docs/tools/human-in-the-loop.md +1 -1
  278. package/docs/tools/workflows.mdx +52 -8
  279. package/docs/tutorial/first-agent.mdx +1 -1
  280. package/package.json +36 -9
  281. package/dist/CHANGELOG.md +0 -38
  282. package/dist/src/public/channels/discord/gateway/index.js +0 -1
@@ -29,6 +29,7 @@ const EVE_SESSION_ROUTE_PATTERN = `${EVE_SESSION_ROUTE_PATH}/:sessionId`;
29
29
  const EVE_SESSION_CANCEL_ROUTE_PATTERN = `${EVE_SESSION_ROUTE_PATH}/:sessionId/cancel`;
30
30
  const EVE_SESSION_COMPACT_ROUTE_PATTERN = `${EVE_SESSION_ROUTE_PATH}/:sessionId/compact`;
31
31
  const EVE_SESSION_CLEAR_ROUTE_PATTERN = `${EVE_SESSION_ROUTE_PATH}/:sessionId/clear`;
32
+ const EVE_SESSION_END_ROUTE_PATTERN = `${EVE_SESSION_ROUTE_PATH}/:sessionId/end`;
32
33
  const EVE_SESSION_RESET_ROUTE_PATTERN = `${EVE_SESSION_ROUTE_PATH}/:sessionId/reset`;
33
34
  const EVE_SESSION_STUBS_ROUTE_PATTERN = `${EVE_SESSION_ROUTE_PATH}/:sessionId/stubs`;
34
35
  const EVE_SESSION_STREAM_ROUTE_PATTERN = `${EVE_SESSION_ROUTE_PATH}/:sessionId/stream`;
@@ -56,33 +57,58 @@ function createEveSessionCompactRoutePath(sessionId) {
56
57
  function createEveSessionClearRoutePath(sessionId) {
57
58
  return `${EVE_SESSION_ROUTE_PATH}/${encodeURIComponent(sessionId)}/clear`;
58
59
  }
59
- function createEveSessionResetRoutePath(sessionId) {
60
- return `${EVE_SESSION_ROUTE_PATH}/${encodeURIComponent(sessionId)}/reset`;
60
+ function createEveSessionEndRoutePath(sessionId) {
61
+ return `${EVE_SESSION_ROUTE_PATH}/${encodeURIComponent(sessionId)}/end`;
61
62
  }
62
63
  function createEveSessionStreamRoutePath(sessionId) {
63
64
  return `${EVE_SESSION_ROUTE_PATH}/${encodeURIComponent(sessionId)}/stream`;
64
65
  }
65
66
 
67
+ //#endregion
68
+ //#region src/shared/eve-error.ts
69
+ const LINEAGE = Symbol.for("eve.error.lineage");
70
+ var EveError = class EveError extends Error {
71
+ static errorName = "EveError";
72
+ code;
73
+ constructor(code, message, options) {
74
+ super(message, options);
75
+ if (new.target !== EveError && !Object.hasOwn(new.target, "errorName")) throw new TypeError(`${new.target.name} must declare its own static errorName.`);
76
+ this.name = new.target.errorName;
77
+ this.code = code;
78
+ const lineage = [new.target.errorName];
79
+ for (let type = new.target; type !== EveError;) {
80
+ type = Object.getPrototypeOf(type);
81
+ lineage.push(type.errorName);
82
+ }
83
+ Object.defineProperty(this, LINEAGE, { value: Object.freeze(lineage) });
84
+ }
85
+ static is(error) {
86
+ if (typeof error !== "object" || error === null) return false;
87
+ const lineage = Reflect.get(error, LINEAGE);
88
+ return Array.isArray(lineage) && lineage.includes(this.errorName);
89
+ }
90
+ };
91
+
66
92
  //#endregion
67
93
  //#region src/client/agent-info-error.ts
68
- var AgentInfoResponseError = class extends Error {
94
+ var AgentInfoResponseError = class extends EveError {
95
+ static errorName = "AgentInfoResponseError";
69
96
  issues;
70
97
  constructor(issues = []) {
71
98
  const detail = issues.length === 0 ? "" : ` (${issues.join("; ")})`;
72
- super(`The server returned an unrecognized response from the eve agent info route.${detail}`);
73
- this.name = "AgentInfoResponseError";
99
+ super("invalid_agent_info_response", `The server returned an unrecognized response from the eve agent info route.${detail}`);
74
100
  this.issues = issues;
75
101
  }
76
102
  };
77
103
 
78
104
  //#endregion
79
105
  //#region src/client/health-response-error.ts
80
- var HealthResponseError = class extends Error {
106
+ var HealthResponseError = class extends EveError {
107
+ static errorName = "HealthResponseError";
81
108
  issues;
82
109
  constructor(issues = []) {
83
110
  const detail = issues.length === 0 ? "" : ` (${issues.join("; ")})`;
84
- super(`The server returned an unrecognized eve health response.${detail}`);
85
- this.name = "HealthResponseError";
111
+ super("invalid_health_response", `The server returned an unrecognized eve health response.${detail}`);
86
112
  this.issues = issues;
87
113
  }
88
114
  };
@@ -558,24 +584,20 @@ function isObject$1(value) {
558
584
 
559
585
  //#endregion
560
586
  //#region src/channel/session-not-active-error.ts
561
- const CODE = "EVE_SESSION_NOT_ACTIVE";
562
- var SessionNotActiveError = class extends Error {
563
- code = CODE;
587
+ var SessionNotActiveError = class extends EveError {
588
+ static errorName = "SessionNotActiveError";
564
589
  retryable;
565
590
  constructor(options = {}) {
566
- super(options.retryable === true ? "The session is not ready to accept commands. Retry shortly." : "The session is no longer active. Start a new session.");
567
- this.name = "SessionNotActiveError";
568
- this.retryable = options.retryable === true;
569
- }
570
- static is(error) {
571
- return error !== null && typeof error === "object" && Reflect.get(error, "code") === CODE && typeof Reflect.get(error, "retryable") === "boolean";
591
+ const retryable = options.retryable === true;
592
+ super(retryable ? "session_not_ready" : "session_not_active", retryable ? "The session is not ready to accept commands. Retry shortly." : "The session is no longer active. Start a new session.");
593
+ this.retryable = retryable;
572
594
  }
573
595
  };
574
596
 
575
597
  //#endregion
576
598
  //#region src/client/client-error.ts
577
- var ClientError = class extends Error {
578
- code;
599
+ var ClientError = class extends EveError {
600
+ static errorName = "ClientError";
579
601
  status;
580
602
  body;
581
603
  headers;
@@ -586,19 +608,17 @@ var ClientError = class extends Error {
586
608
  let message = body || `Server returned ${status}.`;
587
609
  if (typeof parsed?.error === "string") message = parsed.error;
588
610
  else if (parsed === void 0 && contentType?.includes("text/html")) message = `Server returned ${status} with an HTML response. Check the eve route and development server configuration.`;
589
- super(message);
590
- this.name = "ClientError";
591
- this.code = typeof parsed?.code === "string" ? parsed.code : void 0;
611
+ super(typeof parsed?.code === "string" ? parsed.code : "http_error", message);
592
612
  this.status = status;
593
613
  this.body = body;
594
614
  this.headers = normalizedHeaders;
595
615
  }
596
616
  };
597
617
  var ClientSessionStrandedError = class extends ClientError {
618
+ static errorName = "ClientSessionStrandedError";
598
619
  eveVersion;
599
620
  constructor(status, body, headers, details) {
600
621
  super(status, body, headers);
601
- this.name = "ClientSessionStrandedError";
602
622
  this.eveVersion = details.eveVersion;
603
623
  }
604
624
  };
@@ -2115,7 +2135,7 @@ const RECONNECT_BACKOFF = {
2115
2135
  };
2116
2136
  const DEFAULT_STREAM_RECONNECT_POLICY = {
2117
2137
  reconnect: true,
2118
- retryableErrorStatuses: /* @__PURE__ */ new Set([
2138
+ retryableStatuses: /* @__PURE__ */ new Set([
2119
2139
  404,
2120
2140
  409,
2121
2141
  425,
@@ -2124,43 +2144,34 @@ const DEFAULT_STREAM_RECONNECT_POLICY = {
2124
2144
  503,
2125
2145
  504
2126
2146
  ]),
2127
- streamOpenReconnectPolicy: {
2128
- baseDelayMs: 250,
2129
- maxAttempts: 12,
2130
- maxDelayMs: 5e3
2131
- }
2147
+ baseDelayMs: 250,
2148
+ maxAttempts: 12,
2149
+ maxDelayMs: 5e3
2132
2150
  };
2133
2151
  const NO_STREAM_RECONNECT_POLICY = {
2134
2152
  ...DEFAULT_STREAM_RECONNECT_POLICY,
2135
2153
  reconnect: false,
2136
- streamOpenReconnectPolicy: {
2137
- ...DEFAULT_STREAM_RECONNECT_POLICY.streamOpenReconnectPolicy,
2138
- maxAttempts: 1
2139
- }
2154
+ maxAttempts: 1
2140
2155
  };
2141
- function isRetryableStreamError(error, statuses = DEFAULT_STREAM_RECONNECT_POLICY.retryableErrorStatuses) {
2156
+ function isRetryableStreamError(error, statuses = DEFAULT_STREAM_RECONNECT_POLICY.retryableStatuses) {
2142
2157
  if (error instanceof ClientSessionStrandedError) return false;
2143
2158
  if (SessionNotActiveError.is(error)) return statuses.has(409);
2144
2159
  if (error instanceof ClientError) return error.code !== "session_version_unsupported" && statuses.has(error.status);
2145
2160
  return isStreamDisconnectError(error);
2146
2161
  }
2147
- function resolveRetryPolicy(policy, defaults) {
2148
- return {
2149
- ...defaults,
2150
- ...policy
2151
- };
2152
- }
2153
- function resolveStreamReconnectPolicy(policy) {
2154
- if (policy && "reconnect" in policy && policy.reconnect === false) return NO_STREAM_RECONNECT_POLICY;
2155
- const configured = policy;
2162
+ function resolveStreamReconnectPolicy(options) {
2163
+ if (options === false) return NO_STREAM_RECONNECT_POLICY;
2164
+ const defaults = DEFAULT_STREAM_RECONNECT_POLICY;
2156
2165
  return {
2157
2166
  reconnect: true,
2158
- retryableErrorStatuses: configured?.retryableErrorStatuses ? new Set(configured.retryableErrorStatuses) : DEFAULT_STREAM_RECONNECT_POLICY.retryableErrorStatuses,
2159
- streamOpenReconnectPolicy: resolveRetryPolicy(configured?.streamOpenReconnectPolicy, DEFAULT_STREAM_RECONNECT_POLICY.streamOpenReconnectPolicy)
2167
+ retryableStatuses: options?.retryableStatuses ? new Set(options.retryableStatuses) : defaults.retryableStatuses,
2168
+ baseDelayMs: options?.baseDelayMs ?? defaults.baseDelayMs,
2169
+ maxAttempts: options?.maxAttempts ?? defaults.maxAttempts,
2170
+ maxDelayMs: options?.maxDelayMs ?? defaults.maxDelayMs
2160
2171
  };
2161
2172
  }
2162
2173
  async function* followStreamLines(input) {
2163
- const resolvePolicy = () => resolveStreamReconnectPolicy(input.resolveReconnectPolicy === void 0 ? input.streamReconnectPolicy : input.resolveReconnectPolicy());
2174
+ const resolvePolicy = () => resolveStreamReconnectPolicy(input.resolveReconnectPolicy === void 0 ? input.reconnect : input.resolveReconnectPolicy());
2164
2175
  const bounded = input.follow === false || input.onCaughtUp !== void 0;
2165
2176
  let startIndex = input.startIndex;
2166
2177
  let reconnectDelayMs = RECONNECT_BACKOFF.baseDelayMs;
@@ -2255,7 +2266,7 @@ async function* followStreamLines(input) {
2255
2266
  if (streamEnded || input.signal?.aborted || !resolvePolicy().reconnect) return;
2256
2267
  if (leaseEnded) continue;
2257
2268
  failures += 1;
2258
- if (input.follow === false && failures >= retryPolicy.streamOpenReconnectPolicy.maxAttempts) throw new Error("The session stream kept disconnecting before the read reached its tail.");
2269
+ if (input.follow === false && failures >= retryPolicy.maxAttempts) throw new Error("The session stream kept disconnecting before the read reached its tail.");
2259
2270
  await sleep(reconnectDelayMs, input.signal);
2260
2271
  if (input.signal?.aborted) return;
2261
2272
  reconnectDelayMs = Math.min(reconnectDelayMs * 2, RECONNECT_BACKOFF.maxDelayMs);
@@ -2273,17 +2284,16 @@ async function* followStreamIterable(input) {
2273
2284
  }
2274
2285
  }
2275
2286
  async function openStreamBody(input) {
2276
- const retryPolicy = input.retryPolicy ?? resolveStreamReconnectPolicy(input.streamReconnectPolicy);
2277
- const openRetryPolicy = retryPolicy.streamOpenReconnectPolicy;
2287
+ const retryPolicy = input.retryPolicy ?? resolveStreamReconnectPolicy(input.reconnect);
2278
2288
  let lastStatus;
2279
2289
  let lastBody;
2280
2290
  let lastHeaders;
2281
- let retryDelayMs = openRetryPolicy.baseDelayMs;
2291
+ let retryDelayMs = retryPolicy.baseDelayMs;
2282
2292
  const searchParams = { ...input.searchParams };
2283
2293
  if (input.startIndex !== 0) searchParams.startIndex = String(input.startIndex);
2284
2294
  if (input.requestTailIndex === true) searchParams.includeTailIndex = "1";
2285
2295
  if (input.follow === false) searchParams.follow = "false";
2286
- for (let attempt = 0; attempt < openRetryPolicy.maxAttempts; attempt += 1) {
2296
+ for (let attempt = 0; attempt < retryPolicy.maxAttempts; attempt += 1) {
2287
2297
  throwIfAborted(input.signal);
2288
2298
  const url = createClientUrl(input.baseUrl, input.path, Object.keys(searchParams).length > 0 ? searchParams : void 0);
2289
2299
  const headers = await input.resolveHeaders();
@@ -2300,9 +2310,9 @@ async function openStreamBody(input) {
2300
2310
  });
2301
2311
  } catch (error) {
2302
2312
  if (input.redirect === "error" && error instanceof Error && error.cause instanceof Error && error.cause.message === "unexpected redirect") throw new Error("The session stream refused a redirect. Use the final agent URL instead.", { cause: error });
2303
- if (input.signal?.aborted || !isStreamDisconnectError(error) || attempt === openRetryPolicy.maxAttempts - 1) throw error;
2313
+ if (input.signal?.aborted || !isStreamDisconnectError(error) || attempt === retryPolicy.maxAttempts - 1) throw error;
2304
2314
  await sleep(retryDelayMs, input.signal);
2305
- retryDelayMs = Math.min(retryDelayMs * 2, openRetryPolicy.maxDelayMs);
2315
+ retryDelayMs = Math.min(retryDelayMs * 2, retryPolicy.maxDelayMs);
2306
2316
  continue;
2307
2317
  }
2308
2318
  if (response.ok) {
@@ -2331,10 +2341,10 @@ async function openStreamBody(input) {
2331
2341
  lastBody = await response.text();
2332
2342
  lastHeaders = response.headers;
2333
2343
  const error = createClientError(response.status, lastBody, response.headers);
2334
- if (!isRetryableStreamError(error, retryPolicy.retryableErrorStatuses)) throw error;
2335
- if (attempt < openRetryPolicy.maxAttempts - 1) {
2344
+ if (!isRetryableStreamError(error, retryPolicy.retryableStatuses)) throw error;
2345
+ if (attempt < retryPolicy.maxAttempts - 1) {
2336
2346
  await sleep(retryDelayMs, input.signal);
2337
- retryDelayMs = Math.min(retryDelayMs * 2, openRetryPolicy.maxDelayMs);
2347
+ retryDelayMs = Math.min(retryDelayMs * 2, retryPolicy.maxDelayMs);
2338
2348
  }
2339
2349
  }
2340
2350
  throw new ClientError(lastStatus ?? 0, lastBody ?? "Failed to open message stream.", lastHeaders);
@@ -2407,7 +2417,7 @@ var ClientAgentSession = class ClientAgentSession {
2407
2417
  resolveHeaders: () => this.#context.resolveHeaders(),
2408
2418
  signal: options?.signal,
2409
2419
  startIndex: options?.startIndex ?? 0,
2410
- streamReconnectPolicy: options?.streamReconnectPolicy,
2420
+ reconnect: options?.reconnect,
2411
2421
  onOpen: (headers) => {
2412
2422
  if (onIdentity === void 0) return;
2413
2423
  const key = headers.get(EVE_OBSERVATION_KEY_HEADER);
@@ -2524,7 +2534,7 @@ const paths = {
2524
2534
  cancel: createEveSessionCancelRoutePath,
2525
2535
  clear: createEveSessionClearRoutePath,
2526
2536
  compact: createEveSessionCompactRoutePath,
2527
- reset: createEveSessionResetRoutePath
2537
+ end: createEveSessionEndRoutePath
2528
2538
  };
2529
2539
  async function prewarmClientSession(input) {
2530
2540
  const response = await fetch(createClientUrl(input.context.baseUrl, createEveSessionRoutePath(input.sessionId)), {
@@ -2547,7 +2557,7 @@ async function prewarmClientSession(input) {
2547
2557
  }
2548
2558
  async function sendClientControl(input) {
2549
2559
  const { signal, turnId, reason } = input.options ?? {};
2550
- const body = input.kind === "cancel" ? { turnId } : input.kind === "reset" ? { reason } : {};
2560
+ const body = input.kind === "cancel" ? { turnId } : input.kind === "end" ? { reason } : {};
2551
2561
  const headers = await input.context.resolveHeaders();
2552
2562
  headers.set("content-type", "application/json");
2553
2563
  const response = await fetch(createClientUrl(input.context.baseUrl, paths[input.kind](input.sessionId)), {
@@ -2992,7 +3002,7 @@ var ClientSession = class ClientSession {
2992
3002
  return {
2993
3003
  events,
2994
3004
  session: {
2995
- sessionId: this.#state.sessionId,
3005
+ ...this.#state,
2996
3006
  streamIndex
2997
3007
  }
2998
3008
  };
@@ -3042,8 +3052,8 @@ var ClientSession = class ClientSession {
3042
3052
  async compact(options) {
3043
3053
  return this.#control("compact", options);
3044
3054
  }
3045
- async reset(options) {
3046
- return this.#control("reset", options);
3055
+ async end(options) {
3056
+ return this.#control("end", options);
3047
3057
  }
3048
3058
  async #control(kind, options) {
3049
3059
  const startIndex = this.#state.streamIndex;
@@ -3055,7 +3065,7 @@ var ClientSession = class ClientSession {
3055
3065
  });
3056
3066
  return new StreamDelivery({
3057
3067
  ...receipt,
3058
- createStream: (read) => this.#createEventStream(startIndex, { signal: read?.signal }, receipt.deliveryId, kind !== "reset")
3068
+ createStream: (read) => this.#createEventStream(startIndex, { signal: read?.signal }, receipt.deliveryId, kind !== "end")
3059
3069
  });
3060
3070
  }
3061
3071
  stream(options) {
@@ -3086,7 +3096,7 @@ var ClientSession = class ClientSession {
3086
3096
  headers: input.headers,
3087
3097
  signal: input.signal,
3088
3098
  startIndex: initialStreamIndex,
3089
- streamReconnectPolicy: input.streamReconnectPolicy
3099
+ reconnect: input.reconnect
3090
3100
  }), deliveryId, input.signal);
3091
3101
  }
3092
3102
  async *#streamAndAdvance(options) {
@@ -3099,7 +3109,7 @@ var ClientSession = class ClientSession {
3099
3109
  resolveReconnectPolicy: options?.resolveReconnectPolicy,
3100
3110
  signal: options?.signal,
3101
3111
  startIndex,
3102
- streamReconnectPolicy: options?.streamReconnectPolicy
3112
+ reconnect: options?.reconnect
3103
3113
  })) {
3104
3114
  this.#advanceStreamIndex(cursor);
3105
3115
  yield event;
@@ -3121,7 +3131,7 @@ var ClientSession = class ClientSession {
3121
3131
  redirect: this.#context.redirect,
3122
3132
  signal: input.signal,
3123
3133
  startIndex: input.startIndex,
3124
- streamReconnectPolicy: input.streamReconnectPolicy,
3134
+ reconnect: input.reconnect,
3125
3135
  resolveReconnectPolicy: input.resolveReconnectPolicy
3126
3136
  });
3127
3137
  }
@@ -4169,7 +4179,7 @@ var AgentStreamFollower = class {
4169
4179
  signal: controller.signal,
4170
4180
  startIndex: conversation.view.position,
4171
4181
  follow: false,
4172
- streamReconnectPolicy: { reconnect: false }
4182
+ reconnect: false
4173
4183
  }, (key) => {
4174
4184
  if (!current()) throw new Error("Observation stopped.");
4175
4185
  if (node.key !== void 0 && node.key !== key) throw new ClientError(422, "Descendant reader identity changed.");
@@ -4214,7 +4224,7 @@ var AgentStreamFollower = class {
4214
4224
  if (!current()) return;
4215
4225
  node.failures += 1;
4216
4226
  const status = error instanceof ClientError ? error.status : void 0;
4217
- node.status = isRetryableStreamError(error) && node.failures < DEFAULT_STREAM_RECONNECT_POLICY.streamOpenReconnectPolicy.maxAttempts ? "interrupted" : "unavailable";
4227
+ node.status = isRetryableStreamError(error) && node.failures < DEFAULT_STREAM_RECONNECT_POLICY.maxAttempts ? "interrupted" : "unavailable";
4218
4228
  node.reason = status === 401 || status === 403 ? "unauthorized" : status === 410 ? "expired" : status === 422 ? error instanceof ClientError && error.code === "cycle" ? "cycle" : "unsupported" : "transport";
4219
4229
  node.readyAt = Date.now() + Math.min(RECONNECT_BACKOFF.maxDelayMs, RECONNECT_BACKOFF.baseDelayMs * 2 ** Math.min(node.failures - 1, 5));
4220
4230
  } finally {
@@ -4316,7 +4326,7 @@ var SessionEventStream = class {
4316
4326
  }
4317
4327
  setOptions(options) {
4318
4328
  if ("headers" in options) this.#headers = options.headers;
4319
- if ("streamReconnectPolicy" in options) this.#reconnectPolicy = options.streamReconnectPolicy;
4329
+ if ("reconnect" in options) this.#reconnectPolicy = options.reconnect;
4320
4330
  }
4321
4331
  close() {
4322
4332
  this.#ended = true;
@@ -4679,8 +4689,8 @@ var SessionStore = class {
4679
4689
  clear() {
4680
4690
  return this.#control((session) => session.clear());
4681
4691
  }
4682
- reset() {
4683
- return this.#control((session) => session.reset());
4692
+ end() {
4693
+ return this.#control((session) => session.end());
4684
4694
  }
4685
4695
  async #control(dispatch) {
4686
4696
  const session = this.#session;
@@ -5025,7 +5035,7 @@ function useEveAgent(options = {}) {
5025
5035
  error: computed(() => snapshot.value.error),
5026
5036
  events: computed(() => snapshot.value.events),
5027
5037
  prewarm: () => store.prewarm(),
5028
- reset: () => store.reset(),
5038
+ end: () => store.end(),
5029
5039
  newSession: () => store.newSession(),
5030
5040
  clear: () => store.clear(),
5031
5041
  compact: () => store.compact(),