operon-agents-core 0.1.0-alpha.2 → 0.1.0-alpha.21

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 (289) hide show
  1. package/dist/agent/agent.d.ts +8 -7
  2. package/dist/agent/compose-hooks.d.ts +10 -1
  3. package/dist/agent/compose-hooks.js +61 -6
  4. package/dist/agent/concurrency.js +1 -1
  5. package/dist/agent/context-report.d.ts +2 -2
  6. package/dist/agent/durable-state.d.ts +22 -0
  7. package/dist/agent/durable-state.js +54 -0
  8. package/dist/agent/index.d.ts +2 -2
  9. package/dist/agent/index.js +1 -1
  10. package/dist/agent/instruction-context.d.ts +6 -6
  11. package/dist/agent/instruction-context.js +23 -23
  12. package/dist/agent/profile-builtins.js +1 -1
  13. package/dist/agent/run-support.d.ts +1 -1
  14. package/dist/agent/run-support.js +6 -5
  15. package/dist/agent/runner.d.ts +25 -22
  16. package/dist/agent/runner.js +217 -121
  17. package/dist/agent/session.d.ts +262 -156
  18. package/dist/agent/session.js +590 -418
  19. package/dist/agent/subagent-tools.js +3 -3
  20. package/dist/agent/subagent.js +28 -13
  21. package/dist/agent/toolset.d.ts +1 -0
  22. package/dist/agent/toolset.js +13 -7
  23. package/dist/agent/workflow/journal.d.ts +2 -2
  24. package/dist/agent/workflow/journal.js +2 -2
  25. package/dist/agent/workflow/manager.d.ts +1 -1
  26. package/dist/agent/workflow/manager.js +1 -1
  27. package/dist/agent/workflow/prompt.js +2 -2
  28. package/dist/agent/workflow/sandbox.d.ts +1 -1
  29. package/dist/agent/workflow/sandbox.js +1 -1
  30. package/dist/agent/workflow/tool.js +30 -43
  31. package/dist/agent/worktree.d.ts +8 -8
  32. package/dist/agent/worktree.js +15 -15
  33. package/dist/capabilities/assembler.d.ts +29 -5
  34. package/dist/capabilities/assembler.js +85 -9
  35. package/dist/capabilities/background/code-task.d.ts +43 -0
  36. package/dist/capabilities/background/code-task.js +75 -0
  37. package/dist/capabilities/background/command-task.d.ts +9 -2
  38. package/dist/capabilities/background/command-task.js +22 -6
  39. package/dist/capabilities/background/index.d.ts +6 -1
  40. package/dist/capabilities/background/index.js +26 -20
  41. package/dist/capabilities/background/manager.d.ts +57 -1
  42. package/dist/capabilities/background/manager.js +210 -45
  43. package/dist/capabilities/background/persist-disk.d.ts +1 -1
  44. package/dist/capabilities/background/persist-disk.js +1 -1
  45. package/dist/capabilities/background/persist.js +4 -2
  46. package/dist/capabilities/background/projections.d.ts +16 -0
  47. package/dist/capabilities/background/projections.js +86 -0
  48. package/dist/capabilities/background/stall-watchdog.d.ts +41 -0
  49. package/dist/capabilities/background/stall-watchdog.js +85 -0
  50. package/dist/capabilities/background/task.d.ts +8 -7
  51. package/dist/capabilities/background/tools.js +33 -7
  52. package/dist/capabilities/capability-data.d.ts +52 -0
  53. package/dist/capabilities/capability-data.js +88 -0
  54. package/dist/capabilities/capability-state.d.ts +2 -4
  55. package/dist/capabilities/capability-state.js +5 -23
  56. package/dist/capabilities/capability.d.ts +203 -38
  57. package/dist/capabilities/compaction/index.js +10 -4
  58. package/dist/capabilities/compaction/service.d.ts +20 -5
  59. package/dist/capabilities/compaction/service.js +27 -11
  60. package/dist/capabilities/goal/goal-store.d.ts +76 -12
  61. package/dist/capabilities/goal/goal-store.js +137 -53
  62. package/dist/capabilities/goal/index.d.ts +1 -1
  63. package/dist/capabilities/goal/index.js +30 -7
  64. package/dist/capabilities/index.d.ts +9 -6
  65. package/dist/capabilities/index.js +4 -3
  66. package/dist/capabilities/plan/index.js +22 -5
  67. package/dist/capabilities/plan/plan-mode.d.ts +30 -9
  68. package/dist/capabilities/plan/plan-mode.js +57 -32
  69. package/dist/capabilities/plan/tools.js +1 -1
  70. package/dist/capabilities/skills/flow-provider.js +3 -3
  71. package/dist/capabilities/skills/index.d.ts +13 -1
  72. package/dist/capabilities/skills/index.js +30 -21
  73. package/dist/capabilities/skills/parser.d.ts +2 -2
  74. package/dist/capabilities/skills/parser.js +3 -3
  75. package/dist/capabilities/skills/registry.d.ts +5 -6
  76. package/dist/capabilities/skills/registry.js +6 -9
  77. package/dist/capabilities/skills/scanner.d.ts +3 -3
  78. package/dist/capabilities/skills/scanner.js +14 -14
  79. package/dist/capabilities/skills/service.d.ts +2 -1
  80. package/dist/capabilities/skills/service.js +3 -3
  81. package/dist/capabilities/skills/skill-tool.d.ts +2 -0
  82. package/dist/capabilities/skills/skill-tool.js +1 -1
  83. package/dist/capabilities/task/index.js +2 -1
  84. package/dist/capabilities/task/persist-disk.d.ts +1 -1
  85. package/dist/capabilities/task/persist-disk.js +1 -1
  86. package/dist/capabilities/task/persist.js +1 -1
  87. package/dist/capabilities/todo/index.js +11 -6
  88. package/dist/capabilities/todo/injector.js +2 -1
  89. package/dist/capabilities/todo/todo-store.d.ts +28 -7
  90. package/dist/capabilities/todo/todo-store.js +44 -11
  91. package/dist/capabilities/todo/tools.js +8 -3
  92. package/dist/capabilities/tool-provider.d.ts +3 -3
  93. package/dist/capabilities/user-hooks/engine.d.ts +3 -3
  94. package/dist/capabilities/user-hooks/engine.js +7 -7
  95. package/dist/capabilities/user-hooks/index.js +2 -1
  96. package/dist/capabilities/workflow/index.d.ts +5 -3
  97. package/dist/capabilities/workflow/index.js +3 -2
  98. package/dist/commands/index.js +34 -32
  99. package/dist/config/index.d.ts +1 -1
  100. package/dist/config/provider-manager.js +0 -28
  101. package/dist/config/schema.d.ts +53 -4
  102. package/dist/config/schema.js +53 -1
  103. package/dist/events/events.d.ts +43 -11
  104. package/dist/events/events.js +1 -0
  105. package/dist/events/index.d.ts +2 -2
  106. package/dist/events/index.js +1 -1
  107. package/dist/events/projection.d.ts +49 -1
  108. package/dist/events/projection.js +144 -19
  109. package/dist/events/publisher.js +2 -21
  110. package/dist/home.d.ts +1 -1
  111. package/dist/home.js +1 -1
  112. package/dist/index.d.ts +3 -2
  113. package/dist/index.js +2 -1
  114. package/dist/internal.d.ts +5 -2
  115. package/dist/internal.js +5 -2
  116. package/dist/llm/define-model.d.ts +4 -0
  117. package/dist/llm/define-model.js +63 -25
  118. package/dist/llm/index.d.ts +1 -0
  119. package/dist/llm/index.js +1 -0
  120. package/dist/llm/model.d.ts +2 -0
  121. package/dist/llm/provider.d.ts +17 -0
  122. package/dist/llm/provider.js +14 -0
  123. package/dist/llm/retry.js +1 -1
  124. package/dist/loop/context.d.ts +21 -1
  125. package/dist/loop/context.js +47 -9
  126. package/dist/loop/events.d.ts +5 -1
  127. package/dist/loop/index.d.ts +2 -2
  128. package/dist/loop/index.js +1 -1
  129. package/dist/loop/interruption.d.ts +9 -4
  130. package/dist/loop/interruption.js +11 -25
  131. package/dist/loop/run-turn.d.ts +16 -3
  132. package/dist/loop/run-turn.js +13 -4
  133. package/dist/loop/steer.d.ts +78 -12
  134. package/dist/loop/steer.js +101 -38
  135. package/dist/loop/tool-call.d.ts +13 -2
  136. package/dist/loop/tool-call.js +135 -5
  137. package/dist/loop/turn-step.d.ts +13 -2
  138. package/dist/loop/turn-step.js +29 -7
  139. package/dist/loop/types.d.ts +6 -0
  140. package/dist/mcp/auth-tool.d.ts +3 -1
  141. package/dist/mcp/auth-tool.js +2 -2
  142. package/dist/mcp/capability.d.ts +13 -0
  143. package/dist/mcp/capability.js +36 -17
  144. package/dist/mcp/config-loader.d.ts +5 -5
  145. package/dist/mcp/config-loader.js +17 -17
  146. package/dist/mcp/credentials.d.ts +35 -0
  147. package/dist/mcp/credentials.js +2 -0
  148. package/dist/mcp/filter.d.ts +2 -2
  149. package/dist/mcp/index.d.ts +4 -3
  150. package/dist/mcp/index.js +1 -1
  151. package/dist/mcp/manager.d.ts +108 -6
  152. package/dist/mcp/manager.js +262 -18
  153. package/dist/mcp/oauth/callback-server.d.ts +10 -1
  154. package/dist/mcp/oauth/callback-server.js +82 -16
  155. package/dist/mcp/oauth/index.d.ts +2 -2
  156. package/dist/mcp/oauth/provider.d.ts +18 -0
  157. package/dist/mcp/oauth/provider.js +31 -1
  158. package/dist/mcp/oauth/service.d.ts +9 -3
  159. package/dist/mcp/oauth/service.js +29 -4
  160. package/dist/mcp/sdk-transport.js +1 -1
  161. package/dist/mcp/server.js +1 -1
  162. package/dist/permission/auto-approver/prompts-data.d.ts +1 -1
  163. package/dist/permission/auto-approver/prompts-data.js +1 -1
  164. package/dist/permission/manager.d.ts +5 -3
  165. package/dist/permission/manager.js +7 -3
  166. package/dist/permission/policies.d.ts +2 -2
  167. package/dist/permission/policies.js +4 -4
  168. package/dist/plugins/fields.d.ts +14 -0
  169. package/dist/plugins/fields.js +30 -0
  170. package/dist/plugins/hooks.d.ts +2 -2
  171. package/dist/plugins/hooks.js +12 -12
  172. package/dist/plugins/index.js +1 -0
  173. package/dist/plugins/manager.d.ts +8 -3
  174. package/dist/plugins/manager.js +18 -7
  175. package/dist/plugins/manifest.d.ts +2 -2
  176. package/dist/plugins/manifest.js +101 -91
  177. package/dist/plugins/marketplace.js +76 -57
  178. package/dist/plugins/store.d.ts +3 -3
  179. package/dist/plugins/store.js +6 -6
  180. package/dist/protocol/index.d.ts +1 -1
  181. package/dist/store/catalog-store.d.ts +4 -1
  182. package/dist/store/catalog-store.js +5 -1
  183. package/dist/store/checkpointing-store.d.ts +41 -0
  184. package/dist/store/checkpointing-store.js +86 -0
  185. package/dist/store/disk-store.d.ts +8 -0
  186. package/dist/store/disk-store.js +127 -5
  187. package/dist/store/index.d.ts +3 -2
  188. package/dist/store/index.js +2 -1
  189. package/dist/store/log-store.d.ts +9 -1
  190. package/dist/store/log-store.js +68 -4
  191. package/dist/store/migrate.d.ts +8 -2
  192. package/dist/store/migrate.js +9 -2
  193. package/dist/store/origin.d.ts +31 -6
  194. package/dist/store/origin.js +0 -14
  195. package/dist/store/pg.d.ts +1 -0
  196. package/dist/store/pg.js +37 -2
  197. package/dist/store/redis.d.ts +1 -0
  198. package/dist/store/redis.js +30 -0
  199. package/dist/store/repository.d.ts +13 -1
  200. package/dist/store/repository.js +45 -2
  201. package/dist/store/session-catalog.d.ts +4 -0
  202. package/dist/store/session-catalog.js +6 -0
  203. package/dist/store/storage.js +3 -0
  204. package/dist/store/store.d.ts +97 -34
  205. package/dist/store/store.js +64 -10
  206. package/dist/telemetry/appender.d.ts +43 -0
  207. package/dist/telemetry/appender.js +46 -0
  208. package/dist/telemetry/events.d.ts +142 -0
  209. package/dist/telemetry/events.js +141 -0
  210. package/dist/telemetry/index.d.ts +10 -0
  211. package/dist/telemetry/index.js +6 -0
  212. package/dist/telemetry/projection.d.ts +23 -0
  213. package/dist/telemetry/projection.js +185 -0
  214. package/dist/telemetry/redact.d.ts +20 -0
  215. package/dist/telemetry/redact.js +40 -0
  216. package/dist/telemetry/service.d.ts +49 -0
  217. package/dist/telemetry/service.js +137 -0
  218. package/dist/testing.d.ts +58 -0
  219. package/dist/testing.js +123 -0
  220. package/dist/tool/background.d.ts +9 -6
  221. package/dist/tool/background.js +7 -1
  222. package/dist/tool/builtin/ask-user-question.js +6 -5
  223. package/dist/tool/builtin/bash.d.ts +6 -0
  224. package/dist/tool/builtin/bash.js +79 -42
  225. package/dist/tool/builtin/edit.js +82 -109
  226. package/dist/tool/builtin/glob.js +13 -13
  227. package/dist/tool/builtin/grep.js +13 -13
  228. package/dist/tool/builtin/read.js +25 -15
  229. package/dist/tool/builtin/write.js +49 -33
  230. package/dist/tool/define.d.ts +14 -8
  231. package/dist/tool/define.js +8 -2
  232. package/dist/tool/{machine-base.d.ts → environment-base.d.ts} +37 -37
  233. package/dist/tool/{machine-base.js → environment-base.js} +45 -119
  234. package/dist/tool/{machine-local.d.ts → environment-local.d.ts} +9 -8
  235. package/dist/tool/{machine-local.js → environment-local.js} +60 -81
  236. package/dist/tool/{machine-null.d.ts → environment-null.d.ts} +9 -9
  237. package/dist/tool/{machine-null.js → environment-null.js} +9 -9
  238. package/dist/tool/{machine-ssh.d.ts → environment-ssh.d.ts} +33 -18
  239. package/dist/tool/{machine-ssh.js → environment-ssh.js} +118 -149
  240. package/dist/tool/{machine.d.ts → environment.d.ts} +53 -82
  241. package/dist/tool/environment.js +2 -0
  242. package/dist/tool/file-freshness.d.ts +33 -19
  243. package/dist/tool/file-freshness.js +39 -30
  244. package/dist/tool/filesystem-tools.d.ts +1 -1
  245. package/dist/tool/filesystem-tools.js +1 -1
  246. package/dist/tool/git-context.d.ts +2 -2
  247. package/dist/tool/git-context.js +8 -8
  248. package/dist/tool/index.d.ts +12 -12
  249. package/dist/tool/index.js +12 -10
  250. package/dist/tool/policies/path-access.d.ts +4 -4
  251. package/dist/tool/policies/path-access.js +12 -12
  252. package/dist/tool/questions.d.ts +8 -0
  253. package/dist/tool/search/catalog.d.ts +37 -0
  254. package/dist/tool/search/catalog.js +182 -0
  255. package/dist/tool/search/deferral.d.ts +3 -2
  256. package/dist/tool/search/loaded.d.ts +32 -0
  257. package/dist/tool/search/loaded.js +96 -0
  258. package/dist/tool/search/search-tool.d.ts +2 -6
  259. package/dist/tool/search/search-tool.js +16 -15
  260. package/dist/tool/shell-env.js +4 -0
  261. package/dist/tool/support/bash-paths.js +38 -7
  262. package/dist/tool/support/{machine-ops.d.ts → environment-ops.d.ts} +12 -14
  263. package/dist/tool/support/{machine-ops.js → environment-ops.js} +21 -2
  264. package/dist/tool/support/git-worktree.d.ts +3 -3
  265. package/dist/tool/support/git-worktree.js +6 -6
  266. package/dist/tool/support/rg-locator.d.ts +6 -6
  267. package/dist/tool/support/rg-locator.js +6 -6
  268. package/dist/tool/support/ripgrep-run.d.ts +5 -5
  269. package/dist/tool/support/ripgrep-run.js +3 -3
  270. package/dist/tool/support/tool-path.d.ts +3 -3
  271. package/dist/tool/support/tool-path.js +7 -7
  272. package/dist/tool/types.d.ts +54 -10
  273. package/dist/tool/web/fetch-url.js +1 -1
  274. package/dist/tool/web/web-search.js +1 -1
  275. package/dist/tool/workspace-spec.d.ts +3 -3
  276. package/dist/tool/workspace-spec.js +27 -27
  277. package/dist/tracing/bridge.d.ts +9 -1
  278. package/dist/tracing/bridge.js +307 -77
  279. package/dist/tracing/index.d.ts +2 -2
  280. package/dist/tracing/otel.d.ts +28 -1
  281. package/dist/tracing/otel.js +150 -38
  282. package/dist/tracing/processor.d.ts +22 -0
  283. package/dist/tracing/processor.js +2 -0
  284. package/dist/tracing/spans.d.ts +54 -0
  285. package/dist/tracing/spans.js +5 -0
  286. package/package.json +6 -2
  287. package/dist/tool/machine.js +0 -15
  288. package/dist/tool/search/activation.d.ts +0 -13
  289. package/dist/tool/search/activation.js +0 -31
@@ -1,7 +1,8 @@
1
1
  import type { Message, TextContent, ThinkingContent, Usage } from "../protocol/index.ts";
2
- import type { PromptOrigin } from "../store/origin.ts";
2
+ import type { LoadedToolSchema, PromptOrigin } from "../store/origin.ts";
3
3
  import type { ToolInputRequest, ToolResult, ToolUpdate } from "../tool/types.ts";
4
4
  import type { PendingRunInterrupt } from "../loop/interruption.ts";
5
+ import type { ModelSettings } from "../llm/model.ts";
5
6
  import type { SkillActivationTrigger } from "../capabilities/skills/service.ts";
6
7
  import type { SkillSource } from "../capabilities/skills/types.ts";
7
8
  /** One step of a workflow run, as it happens. Defined here because it is a WIRE shape: the
@@ -127,6 +128,15 @@ export type AgentEventBody = {
127
128
  readonly step: number;
128
129
  readonly reason: string;
129
130
  readonly message?: string;
131
+ } | {
132
+ readonly type: "model.request";
133
+ readonly turnId: string;
134
+ readonly step: number;
135
+ readonly stepId: string;
136
+ readonly system?: string;
137
+ readonly messages: readonly Message[];
138
+ readonly toolNames: readonly string[];
139
+ readonly params?: ModelSettings;
130
140
  } | {
131
141
  readonly type: "content.part";
132
142
  readonly turnId: string;
@@ -155,22 +165,20 @@ export type AgentEventBody = {
155
165
  readonly summary: string;
156
166
  /** Pinned so live and replay build a byte-identical summary message. */
157
167
  readonly summaryTimestamp?: number;
168
+ /** See `CompactionSummaryOrigin.loadedTools`. */
169
+ readonly loadedTools?: readonly LoadedToolSchema[];
158
170
  } | {
159
171
  readonly type: "steer.queued";
160
172
  readonly steerId: string;
161
173
  readonly channel: "steering" | "follow_up";
162
174
  readonly origin: PromptOrigin;
163
175
  readonly message: Message;
164
- } | {
165
- readonly type: "delivery.accepted";
166
- readonly deliveryId: string;
167
- readonly source: string;
168
- readonly channel: "turn" | "steering" | "follow_up";
169
176
  } | {
170
177
  readonly type: "tool.call.started";
171
178
  readonly toolCallId: string;
172
179
  readonly toolName: string;
173
180
  readonly args: unknown;
181
+ readonly parentToolCallId?: string;
174
182
  } | {
175
183
  readonly type: "tool.call.delta";
176
184
  readonly turnId: string;
@@ -183,6 +191,7 @@ export type AgentEventBody = {
183
191
  readonly toolName: string;
184
192
  readonly args: unknown;
185
193
  readonly update: ToolUpdate;
194
+ readonly parentToolCallId?: string;
186
195
  } | {
187
196
  readonly type: "tool.detachable";
188
197
  readonly toolCallId: string;
@@ -193,6 +202,7 @@ export type AgentEventBody = {
193
202
  readonly toolName: string;
194
203
  readonly result: ToolResult;
195
204
  readonly isError: boolean;
205
+ readonly parentToolCallId?: string;
196
206
  } | {
197
207
  readonly type: "tool.suspended";
198
208
  readonly toolCallId: string;
@@ -290,14 +300,36 @@ export type LifecycleEvent = Extract<AgentEventBody, {
290
300
  }>;
291
301
  /** Runtime detail that is intentionally not replayable from `events.list()`. */
292
302
  export type LiveOnlyEvent = Extract<AgentEventBody, {
293
- readonly type: "assistant.delta" | "thinking.delta" | "tool.call.delta" | "tool.progress" | "turn.step.retrying";
303
+ readonly type: "assistant.delta" | "thinking.delta" | "tool.call.delta" | "tool.progress" | "turn.step.retrying" | "model.request";
294
304
  }>;
295
- /** Lifecycle bodies persisted separately because they affect Projection state but are not
296
- * already encoded in a context/workflow/audit record. */
305
+ /**
306
+ * Lifecycle bodies persisted separately because they affect Projection state but are not
307
+ * already encoded in a context/workflow/audit record.
308
+ *
309
+ * ADMISSION TEST — this is the one record class defined by what a CONSUMER needs rather
310
+ * than by a domain fact, so it has no natural boundary and will accrete unless the bar is
311
+ * explicit. A lifecycle event earns a record only if, after a crash and reopen, its absence
312
+ * would leave state WRONG or lose completed work. "A client would like to display it" is
313
+ * not sufficient: losing detail on replay is the accepted cost of not journaling it.
314
+ *
315
+ * Applying the test to what is here:
316
+ * - `agent.*` / `turn.started` / `turn.ended`: turn and agent boundaries cannot be recovered
317
+ * from the message sequence, and `turn.ended` carries the failure reason.
318
+ * - `tool.detachable` / `tool.suspended` / `turn.paused`: mid-flight tool state that never
319
+ * reaches a message (history holds only settled results). Losing it strands live work.
320
+ * - `steer.queued`: derivable in principle by joining `inbox.received` against the
321
+ * `deliveryId` of later history, but the join is the kind of reconstruction this test
322
+ * exists to avoid paying for at every read.
323
+ *
324
+ * `turn.step.started` was removed by this test: `step` is the count of assistant messages
325
+ * within the turn and `stepId` is literally `${turnId}.${step}` (see loop/turn-step.ts), so
326
+ * the record duplicated derivable data — and journaling it grew the log linearly in steps.
327
+ * It remains a live event; only its record is gone.
328
+ */
297
329
  export type PersistedLifecycleEvent = Extract<LifecycleEvent, {
298
330
  readonly type: "agent.started" | "agent.ended";
299
331
  } | {
300
- readonly type: "turn.started" | "turn.ended" | "turn.step.started" | "turn.paused";
332
+ readonly type: "turn.started" | "turn.ended" | "turn.paused";
301
333
  } | {
302
334
  readonly type: "steer.queued";
303
335
  } | {
@@ -312,7 +344,7 @@ export type PersistedLifecycleEvent = Extract<LifecycleEvent, {
312
344
  * low-frequency lifecycle events additionally use compact `event.lifecycle` records because
313
345
  * they affect Projection state but are not encoded in messages.
314
346
  */
315
- export declare const VOLATILE_EVENT_TYPES: readonly ["assistant.delta", "thinking.delta", "tool.call.delta", "tool.progress", "turn.step.retrying"];
347
+ export declare const VOLATILE_EVENT_TYPES: readonly ["assistant.delta", "thinking.delta", "tool.call.delta", "tool.progress", "turn.step.retrying", "model.request"];
316
348
  export declare function isVolatileEventType(type: string): boolean;
317
349
  export type AgentEventListener = (event: AgentEvent) => void | Promise<void>;
318
350
  export interface EventSink {
@@ -23,6 +23,7 @@ export const VOLATILE_EVENT_TYPES = [
23
23
  "tool.call.delta",
24
24
  "tool.progress",
25
25
  "turn.step.retrying",
26
+ "model.request",
26
27
  ];
27
28
  const volatileEventTypeSet = new Set(VOLATILE_EVENT_TYPES);
28
29
  export function isVolatileEventType(type) {
@@ -4,7 +4,7 @@ export { SessionEventPublisher, agentEventFromRecord, isDurableAgentEvent, workf
4
4
  export type { WorkflowRecordProjection } from "./publisher.ts";
5
5
  export type { EventPublicationMode } from "./publisher.ts";
6
6
  export { RedactingSink } from "./redacting-sink.ts";
7
- export { SessionProjection } from "./projection.ts";
7
+ export { SessionProjection, readSessionTails } from "./projection.ts";
8
8
  export type { WorkflowProgressEvent, WorkflowAgentRecord } from "./events.ts";
9
- export type { AgentSnapshot, WorkflowRunSnapshot, DirectoryEntry, ProjectedPendingSteer, ProjectedToolCall, ProjectedTurn, ProjectionObservation, ProjectionListener, ProjectionSource, SessionSnapshot, SnapshotOptions, } from "./projection.ts";
9
+ export type { AgentSnapshot, WorkflowRunSnapshot, DirectoryEntry, ProjectedPendingSteer, ProjectedToolCall, ProjectedTurn, ProjectionObservation, ProjectionListener, ProjectionSource, SessionSnapshot, SnapshotOptions, FrameCheckpoint, SessionProjectionOptions, } from "./projection.ts";
10
10
  //# sourceMappingURL=index.d.ts.map
@@ -1,5 +1,5 @@
1
1
  export { ListenerSink, NullSink, IterableSink, joinAddress, newAgentEventId, normalizeAgentEvent } from "./events.js";
2
2
  export { SessionEventPublisher, agentEventFromRecord, isDurableAgentEvent, workflowProgressFromRecord } from "./publisher.js";
3
3
  export { RedactingSink } from "./redacting-sink.js";
4
- export { SessionProjection } from "./projection.js";
4
+ export { SessionProjection, readSessionTails } from "./projection.js";
5
5
  //# sourceMappingURL=index.js.map
@@ -156,6 +156,35 @@ export interface ProjectionSource {
156
156
  readonly store?: SessionStore;
157
157
  readonly events: EventSink;
158
158
  }
159
+ /**
160
+ * One address's durable non-history state at a checkpoint (`checkpoint["#frame"]`): what was
161
+ * folded from lifecycle events that may sit BEFORE the checkpoint — a compaction runs inside a
162
+ * turn, so the `agent.started` and `turn.started` it happened under are behind it. History is
163
+ * not here (the checkpoint record carries it), and neither is anything live-only (streaming
164
+ * tails, in-flight parts), which no replay could recover anyway.
165
+ */
166
+ export interface FrameCheckpoint {
167
+ readonly agent?: string;
168
+ readonly parentToolCallId?: string;
169
+ readonly live: boolean;
170
+ readonly turn?: {
171
+ readonly turnId: string;
172
+ readonly origin?: PromptOrigin;
173
+ readonly step: number;
174
+ readonly stepId?: string;
175
+ readonly toolCalls: readonly ProjectedToolCall[];
176
+ readonly paused?: readonly PendingRunInterrupt[];
177
+ };
178
+ readonly pendingSteers: readonly ProjectedPendingSteer[];
179
+ readonly usage?: Usage;
180
+ }
181
+ export interface SessionProjectionOptions {
182
+ /**
183
+ * Fold message history (default true). False keeps only the lifecycle side — what a
184
+ * checkpoint's `#frame` needs — without holding any message references.
185
+ */
186
+ readonly history?: boolean;
187
+ }
159
188
  export declare class SessionProjection {
160
189
  readonly sessionId: string;
161
190
  private readonly agents;
@@ -163,7 +192,8 @@ export declare class SessionProjection {
163
192
  private readonly listeners;
164
193
  private detachFn?;
165
194
  private lastEventId?;
166
- constructor(sessionId: string);
195
+ private readonly trackHistory;
196
+ constructor(sessionId: string, options?: SessionProjectionOptions);
167
197
  /**
168
198
  * Seed from the append log, then subscribe to the live event stream.
169
199
  * MUST be called before the session's first run (see the class doc's lifecycle
@@ -175,6 +205,17 @@ export declare class SessionProjection {
175
205
  * session's live context instead of holding a second parsed copy.
176
206
  */
177
207
  static attach(source: ProjectionSource, preloadedLog?: readonly AgentRecord[]): Promise<SessionProjection>;
208
+ /**
209
+ * Fold one durable record (replay). A checkpoint is folded as what it is — a self-contained
210
+ * reset of the address's history — and, when it is the first record seen for its address
211
+ * (the shard was read from that checkpoint on), it also seeds the address's lifecycle from
212
+ * its `#frame`. So a whole log and a log of shard tails fold to the same state.
213
+ */
214
+ applyRecord(record: AgentRecord): void;
215
+ /** True once anything has been folded for `address`. */
216
+ has(address: string): boolean;
217
+ /** `address`'s durable lifecycle state, for a checkpoint of its shard. */
218
+ frameCheckpoint(address: string): FrameCheckpoint;
178
219
  /** Stop receiving live events (the projection keeps its last state). */
179
220
  detach(): void;
180
221
  /**
@@ -204,4 +245,11 @@ export declare class SessionProjection {
204
245
  private foldWorkflow;
205
246
  private fold;
206
247
  }
248
+ /**
249
+ * Every shard of the log, each read from its newest checkpoint on (append order across shards)
250
+ * — what a projection or a session open needs, since each checkpoint carries the history and the
251
+ * `#frame` before it. A shard whose newest checkpoint was written without a `#frame` (outside a
252
+ * session) is read whole instead, so its lifecycle is folded from its head.
253
+ */
254
+ export declare function readSessionTails(store: SessionStore): Promise<AgentRecord[]>;
207
255
  //# sourceMappingURL=projection.d.ts.map
@@ -1,4 +1,4 @@
1
- import { foldAppend, foldCompaction, foldReplace, } from "../store/store.js";
1
+ import { DEFAULT_ADDRESS, foldAppend, foldCompaction, foldCompactionRecord, foldReplace, isCheckpointRecord, } from "../store/store.js";
2
2
  import { agentEventFromRecord } from "./publisher.js";
3
3
  const DEFAULT_SNAPSHOT_MAX_MESSAGES = 200;
4
4
  export class SessionProjection {
@@ -8,8 +8,10 @@ export class SessionProjection {
8
8
  listeners = new Set();
9
9
  detachFn;
10
10
  lastEventId;
11
- constructor(sessionId) {
11
+ trackHistory;
12
+ constructor(sessionId, options = {}) {
12
13
  this.sessionId = sessionId;
14
+ this.trackHistory = options.history !== false;
13
15
  }
14
16
  /**
15
17
  * Seed from the append log, then subscribe to the live event stream.
@@ -23,17 +25,69 @@ export class SessionProjection {
23
25
  */
24
26
  static async attach(source, preloadedLog) {
25
27
  const projection = new SessionProjection(source.id);
26
- const records = preloadedLog ?? (source.store !== undefined ? await collectRecords(source.store) : []);
27
- for (const record of records) {
28
- const event = agentEventFromRecord(record, source.id);
29
- if (event !== undefined)
30
- projection.apply(event, record.time);
31
- }
28
+ const records = preloadedLog ?? (source.store !== undefined ? await readSessionTails(source.store) : []);
29
+ for (const record of records)
30
+ projection.applyRecord(record);
32
31
  projection.detachFn = source.events.subscribe((event) => {
33
32
  projection.apply(event);
34
33
  });
35
34
  return projection;
36
35
  }
36
+ /**
37
+ * Fold one durable record (replay). A checkpoint is folded as what it is — a self-contained
38
+ * reset of the address's history — and, when it is the first record seen for its address
39
+ * (the shard was read from that checkpoint on), it also seeds the address's lifecycle from
40
+ * its `#frame`. So a whole log and a log of shard tails fold to the same state.
41
+ */
42
+ applyRecord(record) {
43
+ if (!isCheckpointRecord(record)) {
44
+ const event = agentEventFromRecord(record, this.sessionId);
45
+ if (event !== undefined)
46
+ this.apply(event, record.time);
47
+ return;
48
+ }
49
+ const address = record.address ?? DEFAULT_ADDRESS;
50
+ const fresh = !this.agents.has(address);
51
+ const state = this.stateFor(address);
52
+ if (fresh)
53
+ seedFrame(state, record.checkpoint?.["#frame"]);
54
+ if (this.trackHistory)
55
+ resetHistory(state, record);
56
+ if (record.time !== undefined)
57
+ state.lastEventAt = record.time;
58
+ if (record.eventId !== undefined)
59
+ this.lastEventId = record.eventId;
60
+ }
61
+ /** True once anything has been folded for `address`. */
62
+ has(address) {
63
+ return this.agents.has(address);
64
+ }
65
+ /** `address`'s durable lifecycle state, for a checkpoint of its shard. */
66
+ frameCheckpoint(address) {
67
+ const state = this.agents.get(address);
68
+ if (state === undefined)
69
+ return { live: false, pendingSteers: [] };
70
+ const turn = state.turn;
71
+ return {
72
+ ...(state.agent !== undefined ? { agent: state.agent } : {}),
73
+ ...(state.parentToolCallId !== undefined ? { parentToolCallId: state.parentToolCallId } : {}),
74
+ live: state.live,
75
+ ...(turn !== undefined
76
+ ? {
77
+ turn: {
78
+ turnId: turn.turnId,
79
+ ...(turn.origin !== undefined ? { origin: turn.origin } : {}),
80
+ step: turn.step,
81
+ ...(turn.stepId !== undefined ? { stepId: turn.stepId } : {}),
82
+ toolCalls: [...turn.toolCalls.values()].map((call) => ({ ...call })),
83
+ ...(turn.paused !== undefined ? { paused: turn.paused } : {}),
84
+ },
85
+ }
86
+ : {}),
87
+ pendingSteers: [...state.pendingSteers],
88
+ ...(state.usage !== undefined ? { usage: state.usage } : {}),
89
+ };
90
+ }
37
91
  /** Stop receiving live events (the projection keeps its last state). */
38
92
  detach() {
39
93
  this.detachFn?.();
@@ -217,6 +271,9 @@ export class SessionProjection {
217
271
  // step boundary.
218
272
  break;
219
273
  case "turn.step.retrying":
274
+ // Live-only observer signal (tracing): the transcript it describes is already folded
275
+ // from `message.appended`.
276
+ case "model.request":
220
277
  break;
221
278
  case "turn.step.reset": {
222
279
  const turn = state.turn;
@@ -259,7 +316,8 @@ export class SessionProjection {
259
316
  break;
260
317
  }
261
318
  case "message.appended": {
262
- foldAppend(state, event.message, event.origin);
319
+ if (this.trackHistory)
320
+ foldAppend(state, event.message, event.origin);
263
321
  const turn = state.turn;
264
322
  if (turn !== undefined && event.message.role === "assistant") {
265
323
  // The step's parts are now durable inside this message.
@@ -296,10 +354,12 @@ export class SessionProjection {
296
354
  // transcript watched live and the same transcript after a reopen cannot diverge —
297
355
  // which they silently did while these mutations were journaled but never broadcast.
298
356
  case "history.replaced":
299
- foldReplace(state, event.messages, event.origins);
357
+ if (this.trackHistory)
358
+ foldReplace(state, event.messages, event.origins);
300
359
  break;
301
360
  case "history.compacted":
302
- foldCompaction(state, event.cutoff, event.summary, event.summaryTimestamp);
361
+ if (this.trackHistory)
362
+ foldCompaction(state, event.cutoff, event.summary, event.summaryTimestamp, event.loadedTools);
303
363
  break;
304
364
  case "steer.queued":
305
365
  state.pendingSteers.push({
@@ -309,8 +369,6 @@ export class SessionProjection {
309
369
  message: event.message,
310
370
  });
311
371
  break;
312
- case "delivery.accepted":
313
- break;
314
372
  case "tool.call.started": {
315
373
  const turn = state.turn;
316
374
  if (turn === undefined)
@@ -362,6 +420,17 @@ export class SessionProjection {
362
420
  turn.paused = event.pending;
363
421
  break;
364
422
  }
423
+ // A handoff is this shard's LAST event: control moved to `toAddress`, and the
424
+ // runtime emits the next `agent.started` against that new address. Only the
425
+ // final agent in a handoff chain ever reaches `finish()` and its `agent.ended`,
426
+ // so without closing the source here every handed-off shard would sit at
427
+ // `live: true` forever and read as a running agent. `agent.handoff` is emitted
428
+ // BEFORE `state.address` moves (see handoff-executor), so this event lands on
429
+ // the source shard and `state` is the one to close.
430
+ case "agent.handoff":
431
+ state.live = false;
432
+ state.turn = undefined;
433
+ break;
365
434
  // Directory-level or audit-only signals: they bump lastEventAt (done in apply)
366
435
  // but carry no per-agent state the projection tracks.
367
436
  case "goal.updated":
@@ -370,7 +439,6 @@ export class SessionProjection {
370
439
  case "background.task.started":
371
440
  case "background.task.terminated":
372
441
  case "extension":
373
- case "agent.handoff":
374
442
  case "compaction.started":
375
443
  // compaction.completed is a process signal; history.compacted already performed the
376
444
  // transcript fold from the same journal mutation.
@@ -394,11 +462,68 @@ export class SessionProjection {
394
462
  }
395
463
  }
396
464
  }
397
- async function collectRecords(store) {
398
- const records = [];
399
- for await (const record of store.readRecords())
400
- records.push(record);
401
- return records;
465
+ /**
466
+ * Every shard of the log, each read from its newest checkpoint on (append order across shards)
467
+ * — what a projection or a session open needs, since each checkpoint carries the history and the
468
+ * `#frame` before it. A shard whose newest checkpoint was written without a `#frame` (outside a
469
+ * session) is read whole instead, so its lifecycle is folded from its head.
470
+ */
471
+ export async function readSessionTails(store) {
472
+ const tails = [];
473
+ for await (const record of store.readRecords({ fromCheckpoint: true }))
474
+ tails.push(record);
475
+ const seen = new Set();
476
+ const incomplete = new Set();
477
+ for (const record of tails) {
478
+ const address = record.address ?? DEFAULT_ADDRESS;
479
+ if (seen.has(address))
480
+ continue;
481
+ seen.add(address);
482
+ if (isCheckpointRecord(record) && record.checkpoint?.["#frame"] === undefined)
483
+ incomplete.add(address);
484
+ }
485
+ if (incomplete.size === 0)
486
+ return tails;
487
+ const out = tails.filter((record) => !incomplete.has(record.address ?? DEFAULT_ADDRESS));
488
+ for (const address of incomplete) {
489
+ for await (const record of store.readRecords({ address }))
490
+ out.push(record);
491
+ }
492
+ // Re-merge in append order. Records carry no sequence here, so order by time; within one
493
+ // address the shard's own order is kept (stable sort).
494
+ return out.sort((a, b) => (a.time ?? 0) - (b.time ?? 0));
495
+ }
496
+ function seedFrame(state, frame) {
497
+ if (frame === undefined)
498
+ return;
499
+ if (frame.agent !== undefined)
500
+ state.agent = frame.agent;
501
+ if (frame.parentToolCallId !== undefined)
502
+ state.parentToolCallId = frame.parentToolCallId;
503
+ state.live = frame.live;
504
+ if (frame.turn !== undefined) {
505
+ state.turn = {
506
+ turnId: frame.turn.turnId,
507
+ ...(frame.turn.origin !== undefined ? { origin: frame.turn.origin } : {}),
508
+ step: frame.turn.step,
509
+ ...(frame.turn.stepId !== undefined ? { stepId: frame.turn.stepId } : {}),
510
+ parts: [],
511
+ textTail: "",
512
+ thinkingTail: "",
513
+ toolCalls: new Map(frame.turn.toolCalls.map((call) => [call.toolCallId, { ...call }])),
514
+ ...(frame.turn.paused !== undefined ? { paused: frame.turn.paused } : {}),
515
+ };
516
+ }
517
+ state.pendingSteers = [...frame.pendingSteers];
518
+ if (frame.usage !== undefined)
519
+ state.usage = frame.usage;
520
+ }
521
+ /** A checkpoint replayed on its own: the history becomes exactly what the record holds. */
522
+ function resetHistory(state, record) {
523
+ if (record.type === "context.replace")
524
+ foldReplace(state, record.messages, record.origins);
525
+ else
526
+ foldCompactionRecord(state, record);
402
527
  }
403
528
  function snapshotAgent(state, maxMessages) {
404
529
  // One slice point for both arrays: `origins[i]` describes `messages[i]`, and a tail limit
@@ -168,9 +168,10 @@ function projectableEventBody(record) {
168
168
  case "context.apply_compaction":
169
169
  return {
170
170
  type: "history.compacted",
171
- cutoff: record.cutoff,
171
+ cutoff: record.compactedCount,
172
172
  summary: record.summary,
173
173
  summaryTimestamp: record.summaryTimestamp,
174
+ ...(record.loadedTools !== undefined ? { loadedTools: record.loadedTools } : {}),
174
175
  };
175
176
  case "usage.record":
176
177
  return record.total === undefined ? undefined : { type: "usage.updated", usage: record.total };
@@ -208,25 +209,9 @@ function projectableEventBody(record) {
208
209
  progress: projected.progress,
209
210
  };
210
211
  }
211
- // The durable half of a delivery receipt. Projecting it means a client that reconnects and
212
- // replays history sees "this was accepted" even if the run that consumes it never started —
213
- // which is the whole point of journaling acceptance separately from processing.
214
- //
215
- // `channel` here is the delivery's INTENT, not the outcome: acceptance can precede
216
- // processing by an arbitrary gap, so whether an `auto` delivery ends up steering a running
217
- // turn or starting a fresh one isn't known yet. The outcome is carried by the events the
218
- // run itself emits (`steer.queued` / `turn.started`).
219
- case "inbox.received":
220
- return {
221
- type: "delivery.accepted",
222
- deliveryId: record.origin.deliveryId,
223
- source: record.origin.source,
224
- channel: record.mode === "follow_up" ? "follow_up" : record.mode === "steer" ? "steering" : "turn",
225
- };
226
212
  case "metadata":
227
213
  case "permission.record_approval":
228
214
  case "permission.set_mode":
229
- case "config.update":
230
215
  case "agent.handoff.accepted":
231
216
  return undefined;
232
217
  default: {
@@ -255,7 +240,6 @@ export function isDurableAgentEvent(event) {
255
240
  case "agent.handoff":
256
241
  case "guardrail.blocked":
257
242
  case "workflow.progress":
258
- case "delivery.accepted":
259
243
  return true;
260
244
  default:
261
245
  return false;
@@ -267,7 +251,6 @@ function isPersistedLifecycleEvent(event) {
267
251
  case "agent.ended":
268
252
  case "turn.started":
269
253
  case "turn.ended":
270
- case "turn.step.started":
271
254
  case "turn.paused":
272
255
  case "steer.queued":
273
256
  case "tool.detachable":
@@ -287,8 +270,6 @@ function lifecycleBody(event) {
287
270
  return { type: event.type, turnId: event.turnId, ...(event.origin !== undefined ? { origin: event.origin } : {}) };
288
271
  case "turn.ended":
289
272
  return { type: event.type, turnId: event.turnId, reason: event.reason, ...(event.error !== undefined ? { error: event.error } : {}), ...(event.contextWindow !== undefined ? { contextWindow: event.contextWindow } : {}) };
290
- case "turn.step.started":
291
- return { type: event.type, turnId: event.turnId, step: event.step, stepId: event.stepId };
292
273
  case "turn.paused":
293
274
  return { type: event.type, pending: event.pending };
294
275
  case "steer.queued":
package/dist/home.d.ts CHANGED
@@ -11,6 +11,6 @@
11
11
  * authenticating again).
12
12
  */
13
13
  export declare const OPERON_HOME_DIRNAME = ".operon";
14
- /** `~/.operon` on the machine this process runs on. */
14
+ /** `~/.operon` on the environment this process runs on. */
15
15
  export declare function operonHomeDir(): string;
16
16
  //# sourceMappingURL=home.d.ts.map
package/dist/home.js CHANGED
@@ -13,7 +13,7 @@ import { join } from "node:path";
13
13
  * authenticating again).
14
14
  */
15
15
  export const OPERON_HOME_DIRNAME = ".operon";
16
- /** `~/.operon` on the machine this process runs on. */
16
+ /** `~/.operon` on the environment this process runs on. */
17
17
  export function operonHomeDir() {
18
18
  return join(homedir(), OPERON_HOME_DIRNAME);
19
19
  }
package/dist/index.d.ts CHANGED
@@ -9,6 +9,7 @@ export * from "./store/index.ts";
9
9
  export * from "./logging/index.ts";
10
10
  export * from "./net/index.ts";
11
11
  export * from "./tracing/index.ts";
12
+ export * from "./telemetry/index.ts";
12
13
  export * from "./agent/index.ts";
13
14
  export * from "./capabilities/index.ts";
14
15
  export * from "./config/index.ts";
@@ -17,6 +18,6 @@ export { loadMarketplace, parseMarketplace, loadMarketplaceEntryDetails, parseGi
17
18
  export type { Marketplace, MarketplaceEntry, LoadMarketplaceOptions, MarketplaceEntryDetails, } from "./plugins/marketplace.ts";
18
19
  export { PluginManager, pluginsCapability, parseHooksDocument, hookDefsFromConfig, } from "./plugins/index.ts";
19
20
  export type { PluginManagerOptions, SessionStartSkillResolver, PluginSummary, PluginInfo, PluginSource, ParsedPluginHooks, } from "./plugins/index.ts";
20
- export { mcpServersCapability, McpOAuthService, JsonFileStore, MemoryMcpCredentialStore } from "./mcp/index.ts";
21
- export type { McpServersCapabilityOptions, McpOAuthServiceOptions, McpCredentialStore } from "./mcp/index.ts";
21
+ export { mcpServersCapability, createMcpServers, McpOAuthService, JsonFileStore, MemoryMcpCredentialStore, McpTransportNotPermittedError } from "./mcp/index.ts";
22
+ export type { McpServersCapabilityOptions, McpOAuthServiceOptions, McpCredentialStore, McpTransportKind, McpServersHandle, McpServerView, McpCredential, McpCredentialProvider, McpCredentialRequest } from "./mcp/index.ts";
22
23
  //# sourceMappingURL=index.d.ts.map
package/dist/index.js CHANGED
@@ -8,6 +8,7 @@ export * from "./store/index.js";
8
8
  export * from "./logging/index.js";
9
9
  export * from "./net/index.js";
10
10
  export * from "./tracing/index.js";
11
+ export * from "./telemetry/index.js";
11
12
  export * from "./agent/index.js";
12
13
  export * from "./capabilities/index.js";
13
14
  export * from "./config/index.js";
@@ -18,5 +19,5 @@ export { loadMarketplace, parseMarketplace, loadMarketplaceEntryDetails, parseGi
18
19
  export { PluginManager, pluginsCapability, parseHooksDocument, hookDefsFromConfig, } from "./plugins/index.js";
19
20
  // The per-workspace MCP capability, exposed so `defaultCapabilities` can build it from
20
21
  // workspace + plugin servers (it lives under the ./mcp subtree, not the main capabilities barrel).
21
- export { mcpServersCapability, McpOAuthService, JsonFileStore, MemoryMcpCredentialStore } from "./mcp/index.js";
22
+ export { mcpServersCapability, createMcpServers, McpOAuthService, JsonFileStore, MemoryMcpCredentialStore, McpTransportNotPermittedError } from "./mcp/index.js";
22
23
  //# sourceMappingURL=index.js.map
@@ -24,10 +24,13 @@ export type { RecordMigration } from "./store/migrate.ts";
24
24
  export { encodeWorkdirKey, normalizeWorkDir, slugifyWorkDirName } from "./store/workdir-key.ts";
25
25
  export { sessionCatalogPath, appendSessionCatalogRecord, readSessionCatalog } from "./store/session-catalog.ts";
26
26
  export type { DiskSessionCatalogEntry, DiskSessionCatalogRecord } from "./store/session-catalog.ts";
27
- export { readTextFile, writeTextFile, decodeText, fileVersionFromInfo, normalizeForCompare, } from "./tool/support/machine-ops.ts";
27
+ export { readTextFile, writeTextFile, decodeText, fileVersionFromInfo, normalizeForCompare, hashFileContent, } from "./tool/support/environment-ops.ts";
28
28
  export { matchesBashRule, matchWildcardPattern, permissionRuleExtractPrefix, scanShellCommand, singleCommandMatchesRule, stripSafeEnvPrefix, } from "./tool/support/bash-rule-match.ts";
29
- export { SshProcess, buildSshExecCommand, sshShellQuote } from "./tool/machine-ssh.ts";
29
+ export { SshProcess, buildSshExecCommand, sshShellQuote } from "./tool/environment-ssh.ts";
30
30
  export { setSessionCloseTimeoutsForTest } from "./agent/session.ts";
31
31
  export { assembleCapabilities, AssembledCapabilities } from "./capabilities/assembler.ts";
32
32
  export type { AssembleCapabilitiesOptions } from "./capabilities/assembler.ts";
33
+ export { withProviderHooks } from "./agent/compose-hooks.ts";
34
+ export { sessionOptionsFrom, testRunner, openTestSession, testSessionContext, testProvisionContext, testRunContext, provisionCapability, } from "./testing.ts";
35
+ export type { TestSessionWiring, TestRunnerOptions, TestSessionOptions, TestCapabilityHandle } from "./testing.ts";
33
36
  //# sourceMappingURL=internal.d.ts.map
package/dist/internal.js CHANGED
@@ -19,11 +19,14 @@ export { WIRE_PROTOCOL_VERSION, WIRE_VERSION_KEY, RECORD_MIGRATIONS, migrateReco
19
19
  export { encodeWorkdirKey, normalizeWorkDir, slugifyWorkDirName } from "./store/workdir-key.js";
20
20
  export { sessionCatalogPath, appendSessionCatalogRecord, readSessionCatalog } from "./store/session-catalog.js";
21
21
  // ── tool: file-op and shell-rule helpers, SSH transport internals ────────────
22
- export { readTextFile, writeTextFile, decodeText, fileVersionFromInfo, normalizeForCompare, } from "./tool/support/machine-ops.js";
22
+ export { readTextFile, writeTextFile, decodeText, fileVersionFromInfo, normalizeForCompare, hashFileContent, } from "./tool/support/environment-ops.js";
23
23
  export { matchesBashRule, matchWildcardPattern, permissionRuleExtractPrefix, scanShellCommand, singleCommandMatchesRule, stripSafeEnvPrefix, } from "./tool/support/bash-rule-match.js";
24
- export { SshProcess, buildSshExecCommand, sshShellQuote } from "./tool/machine-ssh.js";
24
+ export { SshProcess, buildSshExecCommand, sshShellQuote } from "./tool/environment-ssh.js";
25
25
  // ── agent: test-only hooks ────────────────────────────────────────────────────
26
26
  export { setSessionCloseTimeoutsForTest } from "./agent/session.js";
27
27
  // ── capabilities: the assembler (Runner-internal wiring) ─────────────────────
28
28
  export { assembleCapabilities, AssembledCapabilities } from "./capabilities/assembler.js";
29
+ export { withProviderHooks } from "./agent/compose-hooks.js";
30
+ // ── testing: wiring helpers (a flat options bag → session options / context) ─────────────────
31
+ export { sessionOptionsFrom, testRunner, openTestSession, testSessionContext, testProvisionContext, testRunContext, provisionCapability, } from "./testing.js";
29
32
  //# sourceMappingURL=internal.js.map
@@ -87,6 +87,7 @@ export declare class ChatModel {
87
87
  * holds back for the summary against this — a model that cannot emit 20k never needs 20k
88
88
  * reserved. */
89
89
  readonly maxOutputTokens: number;
90
+ /** Loading a deferred tool mid-conversation keeps the request prefix: SearchTool mode. */
90
91
  readonly supportsDeferredTools: boolean;
91
92
  private readonly piModel;
92
93
  private readonly runtime;
@@ -96,6 +97,7 @@ export declare class ChatModel {
96
97
  constructor(spec: ModelSpec);
97
98
  stream(req: LlmRequest, call?: CallOptions): AssistantMessageEventStream;
98
99
  complete(req: LlmRequest, call?: CallOptions): Promise<AssistantMessage>;
100
+ private options;
99
101
  private streamWithAuthRetry;
100
102
  /** Stream one attempt. Non-terminal events are relayed live; the terminal event is held so
101
103
  * a clean pre-content failure can be retried instead of surfaced. */
@@ -106,5 +108,7 @@ export declare class ChatModel {
106
108
  }
107
109
  export declare function defineModel(spec: ModelSpec): ChatModel;
108
110
  export declare function tryGetPiModel(provider: string, model: string, runtime?: ModelRuntime): Model<Api> | undefined;
111
+ /** `claude-opus-4-8`, `anthropic/claude-sonnet-5.5`, `claude-fable-5-20260101`, ... */
112
+ export declare function acceptsMidConvoToolChanges(modelId: string): boolean;
109
113
  export {};
110
114
  //# sourceMappingURL=define-model.d.ts.map