@code-yeongyu/senpi-agent-core 2026.9.12 → 2026.9.13

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 (344) hide show
  1. package/README.md +4 -0
  2. package/dist/harness/agent-harness.d.ts +639 -384
  3. package/dist/harness/agent-harness.d.ts.map +1 -1
  4. package/dist/harness/agent-harness.js +5 -250
  5. package/dist/harness/agent-harness.js.map +1 -1
  6. package/dist/harness/compaction/branch-summarization.d.ts +12 -6
  7. package/dist/harness/compaction/branch-summarization.d.ts.map +1 -1
  8. package/dist/harness/compaction/branch-summarization.js +33 -27
  9. package/dist/harness/compaction/branch-summarization.js.map +1 -1
  10. package/dist/harness/compaction/compaction.d.ts +30 -8
  11. package/dist/harness/compaction/compaction.d.ts.map +1 -1
  12. package/dist/harness/compaction/compaction.js +53 -64
  13. package/dist/harness/compaction/compaction.js.map +1 -1
  14. package/dist/harness/config.d.ts +9 -0
  15. package/dist/harness/config.d.ts.map +1 -0
  16. package/dist/harness/config.js +35 -0
  17. package/dist/harness/config.js.map +1 -0
  18. package/dist/harness/context.d.ts +9 -0
  19. package/dist/harness/context.d.ts.map +1 -0
  20. package/dist/harness/context.js +13 -0
  21. package/dist/harness/context.js.map +1 -0
  22. package/dist/harness/env/nodejs.d.ts +25 -28
  23. package/dist/harness/env/nodejs.d.ts.map +1 -1
  24. package/dist/harness/env/nodejs.js +368 -125
  25. package/dist/harness/env/nodejs.js.map +1 -1
  26. package/dist/harness/events.d.ts +20 -38
  27. package/dist/harness/events.d.ts.map +1 -1
  28. package/dist/harness/events.js +233 -55
  29. package/dist/harness/events.js.map +1 -1
  30. package/dist/harness/execution/assistant.d.ts +42 -0
  31. package/dist/harness/execution/assistant.d.ts.map +1 -0
  32. package/dist/harness/execution/assistant.js +82 -0
  33. package/dist/harness/execution/assistant.js.map +1 -0
  34. package/dist/harness/execution/effect-gate.d.ts +22 -0
  35. package/dist/harness/execution/effect-gate.d.ts.map +1 -0
  36. package/dist/harness/execution/effect-gate.js +48 -0
  37. package/dist/harness/execution/effect-gate.js.map +1 -0
  38. package/dist/harness/execution/tools.d.ts +67 -0
  39. package/dist/harness/execution/tools.d.ts.map +1 -0
  40. package/dist/harness/execution/tools.js +121 -0
  41. package/dist/harness/execution/tools.js.map +1 -0
  42. package/dist/harness/hooks.d.ts +38 -0
  43. package/dist/harness/hooks.d.ts.map +1 -0
  44. package/dist/harness/hooks.js +404 -0
  45. package/dist/harness/hooks.js.map +1 -0
  46. package/dist/harness/messages.d.ts +2 -2
  47. package/dist/harness/messages.d.ts.map +1 -1
  48. package/dist/harness/messages.js.map +1 -1
  49. package/dist/harness/prompt-templates.d.ts +3 -2
  50. package/dist/harness/prompt-templates.d.ts.map +1 -1
  51. package/dist/harness/prompt-templates.js +17 -17
  52. package/dist/harness/prompt-templates.js.map +1 -1
  53. package/dist/harness/result.d.ts +93 -0
  54. package/dist/harness/result.d.ts.map +1 -1
  55. package/dist/harness/result.js +39 -0
  56. package/dist/harness/result.js.map +1 -1
  57. package/dist/harness/runtime/drive/boundary.d.ts +28 -0
  58. package/dist/harness/runtime/drive/boundary.d.ts.map +1 -0
  59. package/dist/harness/runtime/drive/boundary.js +173 -0
  60. package/dist/harness/runtime/drive/boundary.js.map +1 -0
  61. package/dist/harness/runtime/drive/checkpoint.d.ts +8 -0
  62. package/dist/harness/runtime/drive/checkpoint.d.ts.map +1 -0
  63. package/dist/harness/runtime/drive/checkpoint.js +133 -0
  64. package/dist/harness/runtime/drive/checkpoint.js.map +1 -0
  65. package/dist/harness/runtime/drive/deferred.d.ts +15 -0
  66. package/dist/harness/runtime/drive/deferred.d.ts.map +1 -0
  67. package/dist/harness/runtime/drive/deferred.js +179 -0
  68. package/dist/harness/runtime/drive/deferred.js.map +1 -0
  69. package/dist/harness/runtime/drive/generation.d.ts +8 -0
  70. package/dist/harness/runtime/drive/generation.d.ts.map +1 -0
  71. package/dist/harness/runtime/drive/generation.js +205 -0
  72. package/dist/harness/runtime/drive/generation.js.map +1 -0
  73. package/dist/harness/runtime/drive/reconcile.d.ts +5 -0
  74. package/dist/harness/runtime/drive/reconcile.d.ts.map +1 -0
  75. package/dist/harness/runtime/drive/reconcile.js +140 -0
  76. package/dist/harness/runtime/drive/reconcile.js.map +1 -0
  77. package/dist/harness/runtime/drive/recovery.d.ts +8 -0
  78. package/dist/harness/runtime/drive/recovery.d.ts.map +1 -0
  79. package/dist/harness/runtime/drive/recovery.js +85 -0
  80. package/dist/harness/runtime/drive/recovery.js.map +1 -0
  81. package/dist/harness/runtime/drive/response.d.ts +23 -0
  82. package/dist/harness/runtime/drive/response.d.ts.map +1 -0
  83. package/dist/harness/runtime/drive/response.js +394 -0
  84. package/dist/harness/runtime/drive/response.js.map +1 -0
  85. package/dist/harness/runtime/drive/retry.d.ts +4 -0
  86. package/dist/harness/runtime/drive/retry.d.ts.map +1 -0
  87. package/dist/harness/runtime/drive/retry.js +34 -0
  88. package/dist/harness/runtime/drive/retry.js.map +1 -0
  89. package/dist/harness/runtime/drive/structural.d.ts +32 -0
  90. package/dist/harness/runtime/drive/structural.d.ts.map +1 -0
  91. package/dist/harness/runtime/drive/structural.js +929 -0
  92. package/dist/harness/runtime/drive/structural.js.map +1 -0
  93. package/dist/harness/runtime/drive/terminal.d.ts +7 -0
  94. package/dist/harness/runtime/drive/terminal.d.ts.map +1 -0
  95. package/dist/harness/runtime/drive/terminal.js +49 -0
  96. package/dist/harness/runtime/drive/terminal.js.map +1 -0
  97. package/dist/harness/runtime/drive/tool-placement.d.ts +14 -0
  98. package/dist/harness/runtime/drive/tool-placement.d.ts.map +1 -0
  99. package/dist/harness/runtime/drive/tool-placement.js +244 -0
  100. package/dist/harness/runtime/drive/tool-placement.js.map +1 -0
  101. package/dist/harness/runtime/drive/tools.d.ts +6 -0
  102. package/dist/harness/runtime/drive/tools.d.ts.map +1 -0
  103. package/dist/harness/runtime/drive/tools.js +449 -0
  104. package/dist/harness/runtime/drive/tools.js.map +1 -0
  105. package/dist/harness/runtime/drive.d.ts +6 -0
  106. package/dist/harness/runtime/drive.d.ts.map +1 -0
  107. package/dist/harness/runtime/drive.js +93 -0
  108. package/dist/harness/runtime/drive.js.map +1 -0
  109. package/dist/harness/runtime/harness.d.ts +59 -0
  110. package/dist/harness/runtime/harness.d.ts.map +1 -0
  111. package/dist/harness/runtime/harness.js +302 -0
  112. package/dist/harness/runtime/harness.js.map +1 -0
  113. package/dist/harness/runtime/index.d.ts +2 -0
  114. package/dist/harness/runtime/index.d.ts.map +1 -0
  115. package/dist/harness/runtime/index.js +2 -0
  116. package/dist/harness/runtime/index.js.map +1 -0
  117. package/dist/harness/runtime/lane.d.ts +118 -0
  118. package/dist/harness/runtime/lane.d.ts.map +1 -0
  119. package/dist/harness/runtime/lane.js +1559 -0
  120. package/dist/harness/runtime/lane.js.map +1 -0
  121. package/dist/harness/runtime/progress.d.ts +15 -0
  122. package/dist/harness/runtime/progress.d.ts.map +1 -0
  123. package/dist/harness/runtime/progress.js +66 -0
  124. package/dist/harness/runtime/progress.js.map +1 -0
  125. package/dist/harness/runtime/reducer.d.ts +5 -0
  126. package/dist/harness/runtime/reducer.d.ts.map +1 -0
  127. package/dist/harness/runtime/reducer.js +240 -0
  128. package/dist/harness/runtime/reducer.js.map +1 -0
  129. package/dist/harness/runtime/restore.d.ts +24 -0
  130. package/dist/harness/runtime/restore.d.ts.map +1 -0
  131. package/dist/harness/runtime/restore.js +117 -0
  132. package/dist/harness/runtime/restore.js.map +1 -0
  133. package/dist/harness/runtime/transcript.d.ts +21 -0
  134. package/dist/harness/runtime/transcript.d.ts.map +1 -0
  135. package/dist/harness/runtime/transcript.js +72 -0
  136. package/dist/harness/runtime/transcript.js.map +1 -0
  137. package/dist/harness/runtime/types.d.ts +105 -0
  138. package/dist/harness/runtime/types.d.ts.map +1 -0
  139. package/dist/harness/runtime/types.js +50 -0
  140. package/dist/harness/runtime/types.js.map +1 -0
  141. package/dist/harness/session/commit.d.ts +53 -0
  142. package/dist/harness/session/commit.d.ts.map +1 -0
  143. package/dist/harness/session/commit.js +57 -0
  144. package/dist/harness/session/commit.js.map +1 -0
  145. package/dist/harness/session/context.d.ts +6 -19
  146. package/dist/harness/session/context.d.ts.map +1 -1
  147. package/dist/harness/session/context.js +31 -53
  148. package/dist/harness/session/context.js.map +1 -1
  149. package/dist/harness/session/fork-policy.d.ts +21 -0
  150. package/dist/harness/session/fork-policy.d.ts.map +1 -0
  151. package/dist/harness/session/fork-policy.js +55 -0
  152. package/dist/harness/session/fork-policy.js.map +1 -0
  153. package/dist/harness/session/fork.d.ts +16 -0
  154. package/dist/harness/session/fork.d.ts.map +1 -0
  155. package/dist/harness/session/fork.js +79 -0
  156. package/dist/harness/session/fork.js.map +1 -0
  157. package/dist/harness/session/in-memory-storage-state.d.ts +39 -0
  158. package/dist/harness/session/in-memory-storage-state.d.ts.map +1 -0
  159. package/dist/harness/session/in-memory-storage-state.js +269 -0
  160. package/dist/harness/session/in-memory-storage-state.js.map +1 -0
  161. package/dist/harness/session/index.d.ts +9 -5
  162. package/dist/harness/session/index.d.ts.map +1 -1
  163. package/dist/harness/session/index.js +7 -4
  164. package/dist/harness/session/index.js.map +1 -1
  165. package/dist/harness/session/jsonl/codec.d.ts +19 -8
  166. package/dist/harness/session/jsonl/codec.d.ts.map +1 -1
  167. package/dist/harness/session/jsonl/codec.js +34 -219
  168. package/dist/harness/session/jsonl/codec.js.map +1 -1
  169. package/dist/harness/session/jsonl/fork.d.ts +38 -0
  170. package/dist/harness/session/jsonl/fork.d.ts.map +1 -0
  171. package/dist/harness/session/jsonl/fork.js +266 -0
  172. package/dist/harness/session/jsonl/fork.js.map +1 -0
  173. package/dist/harness/session/jsonl/index.d.ts +4 -0
  174. package/dist/harness/session/jsonl/index.d.ts.map +1 -0
  175. package/dist/harness/session/jsonl/index.js +4 -0
  176. package/dist/harness/session/jsonl/index.js.map +1 -0
  177. package/dist/harness/session/jsonl/io.d.ts +14 -0
  178. package/dist/harness/session/jsonl/io.d.ts.map +1 -0
  179. package/dist/harness/session/jsonl/io.js +86 -0
  180. package/dist/harness/session/jsonl/io.js.map +1 -0
  181. package/dist/harness/session/jsonl/legacy-v3.d.ts +44 -0
  182. package/dist/harness/session/jsonl/legacy-v3.d.ts.map +1 -0
  183. package/dist/harness/session/jsonl/legacy-v3.js +454 -0
  184. package/dist/harness/session/jsonl/legacy-v3.js.map +1 -0
  185. package/dist/harness/session/jsonl/repo.d.ts +27 -24
  186. package/dist/harness/session/jsonl/repo.d.ts.map +1 -1
  187. package/dist/harness/session/jsonl/repo.js +276 -151
  188. package/dist/harness/session/jsonl/repo.js.map +1 -1
  189. package/dist/harness/session/jsonl/storage.d.ts +39 -41
  190. package/dist/harness/session/jsonl/storage.d.ts.map +1 -1
  191. package/dist/harness/session/jsonl/storage.js +175 -196
  192. package/dist/harness/session/jsonl/storage.js.map +1 -1
  193. package/dist/harness/session/jsonl/types.d.ts +23 -22
  194. package/dist/harness/session/jsonl/types.d.ts.map +1 -1
  195. package/dist/harness/session/jsonl/types.js +2 -1
  196. package/dist/harness/session/jsonl/types.js.map +1 -1
  197. package/dist/harness/session/memory.d.ts +44 -40
  198. package/dist/harness/session/memory.d.ts.map +1 -1
  199. package/dist/harness/session/memory.js +333 -115
  200. package/dist/harness/session/memory.js.map +1 -1
  201. package/dist/harness/session/mutation-line.d.ts +8 -0
  202. package/dist/harness/session/mutation-line.d.ts.map +1 -0
  203. package/dist/harness/session/mutation-line.js +22 -0
  204. package/dist/harness/session/mutation-line.js.map +1 -0
  205. package/dist/harness/session/session.d.ts +78 -51
  206. package/dist/harness/session/session.d.ts.map +1 -1
  207. package/dist/harness/session/session.js +327 -207
  208. package/dist/harness/session/session.js.map +1 -1
  209. package/dist/harness/session/testing/benchmark/datasets.d.ts +12 -0
  210. package/dist/harness/session/testing/benchmark/datasets.d.ts.map +1 -0
  211. package/dist/harness/session/testing/benchmark/datasets.js +24 -0
  212. package/dist/harness/session/testing/benchmark/datasets.js.map +1 -0
  213. package/dist/harness/session/testing/benchmark/session-repo.d.ts +42 -0
  214. package/dist/harness/session/testing/benchmark/session-repo.d.ts.map +1 -0
  215. package/dist/harness/session/testing/benchmark/session-repo.js +127 -0
  216. package/dist/harness/session/testing/benchmark/session-repo.js.map +1 -0
  217. package/dist/harness/session/testing/benchmark/storage.d.ts +25 -0
  218. package/dist/harness/session/testing/benchmark/storage.d.ts.map +1 -0
  219. package/dist/harness/session/testing/benchmark/storage.js +114 -0
  220. package/dist/harness/session/testing/benchmark/storage.js.map +1 -0
  221. package/dist/harness/session/testing/conformance/session-repo.d.ts +23 -0
  222. package/dist/harness/session/testing/conformance/session-repo.d.ts.map +1 -0
  223. package/dist/harness/session/testing/conformance/session-repo.js +809 -0
  224. package/dist/harness/session/testing/conformance/session-repo.js.map +1 -0
  225. package/dist/harness/session/testing/conformance/storage.d.ts +4 -0
  226. package/dist/harness/session/testing/conformance/storage.d.ts.map +1 -0
  227. package/dist/harness/session/testing/conformance/storage.js +600 -0
  228. package/dist/harness/session/testing/conformance/storage.js.map +1 -0
  229. package/dist/harness/session/testing/gating-storage.d.ts +26 -0
  230. package/dist/harness/session/testing/gating-storage.d.ts.map +1 -0
  231. package/dist/harness/session/testing/gating-storage.js +103 -0
  232. package/dist/harness/session/testing/gating-storage.js.map +1 -0
  233. package/dist/harness/session/testing/index.d.ts +9 -2
  234. package/dist/harness/session/testing/index.d.ts.map +1 -1
  235. package/dist/harness/session/testing/index.js +8 -1
  236. package/dist/harness/session/testing/index.js.map +1 -1
  237. package/dist/harness/session/testing/instrumented-storage.d.ts +11 -0
  238. package/dist/harness/session/testing/instrumented-storage.d.ts.map +1 -0
  239. package/dist/harness/session/testing/instrumented-storage.js +19 -0
  240. package/dist/harness/session/testing/instrumented-storage.js.map +1 -0
  241. package/dist/harness/session/testing/storage-decorator.d.ts +20 -0
  242. package/dist/harness/session/testing/storage-decorator.d.ts.map +1 -0
  243. package/dist/harness/session/testing/storage-decorator.js +40 -0
  244. package/dist/harness/session/testing/storage-decorator.js.map +1 -0
  245. package/dist/harness/session/testing/types.d.ts +5 -7
  246. package/dist/harness/session/testing/types.d.ts.map +1 -1
  247. package/dist/harness/session/testing/types.js.map +1 -1
  248. package/dist/harness/session/types.d.ts +425 -265
  249. package/dist/harness/session/types.d.ts.map +1 -1
  250. package/dist/harness/session/types.js +7 -7
  251. package/dist/harness/session/types.js.map +1 -1
  252. package/dist/harness/session/values.d.ts +95 -0
  253. package/dist/harness/session/values.d.ts.map +1 -0
  254. package/dist/harness/session/values.js +81 -0
  255. package/dist/harness/session/values.js.map +1 -0
  256. package/dist/harness/skills.d.ts +3 -2
  257. package/dist/harness/skills.d.ts.map +1 -1
  258. package/dist/harness/skills.js +29 -26
  259. package/dist/harness/skills.js.map +1 -1
  260. package/dist/harness/telemetry.d.ts +64 -43
  261. package/dist/harness/telemetry.d.ts.map +1 -1
  262. package/dist/harness/telemetry.js +45 -26
  263. package/dist/harness/telemetry.js.map +1 -1
  264. package/dist/harness/tools/bash.d.ts +4 -4
  265. package/dist/harness/tools/bash.d.ts.map +1 -1
  266. package/dist/harness/tools/bash.js +66 -93
  267. package/dist/harness/tools/bash.js.map +1 -1
  268. package/dist/harness/tools/edit.d.ts.map +1 -1
  269. package/dist/harness/tools/edit.js +17 -13
  270. package/dist/harness/tools/edit.js.map +1 -1
  271. package/dist/harness/tools/file-mutation-queue.d.ts +2 -1
  272. package/dist/harness/tools/file-mutation-queue.d.ts.map +1 -1
  273. package/dist/harness/tools/file-mutation-queue.js +5 -5
  274. package/dist/harness/tools/file-mutation-queue.js.map +1 -1
  275. package/dist/harness/tools/path-utils.d.ts +3 -2
  276. package/dist/harness/tools/path-utils.d.ts.map +1 -1
  277. package/dist/harness/tools/path-utils.js +5 -5
  278. package/dist/harness/tools/path-utils.js.map +1 -1
  279. package/dist/harness/tools/read.d.ts +2 -1
  280. package/dist/harness/tools/read.d.ts.map +1 -1
  281. package/dist/harness/tools/read.js +4 -6
  282. package/dist/harness/tools/read.js.map +1 -1
  283. package/dist/harness/tools/write.d.ts.map +1 -1
  284. package/dist/harness/tools/write.js +12 -8
  285. package/dist/harness/tools/write.js.map +1 -1
  286. package/dist/harness/types.d.ts +128 -45
  287. package/dist/harness/types.d.ts.map +1 -1
  288. package/dist/harness/types.js.map +1 -1
  289. package/dist/harness/utils/adaptive-publisher.d.ts +24 -0
  290. package/dist/harness/utils/adaptive-publisher.d.ts.map +1 -0
  291. package/dist/harness/utils/adaptive-publisher.js +79 -0
  292. package/dist/harness/utils/adaptive-publisher.js.map +1 -0
  293. package/dist/harness/utils/output-capture.d.ts +31 -0
  294. package/dist/harness/utils/output-capture.d.ts.map +1 -0
  295. package/dist/harness/utils/output-capture.js +217 -0
  296. package/dist/harness/utils/output-capture.js.map +1 -0
  297. package/dist/harness/utils/shell-output.d.ts +19 -5
  298. package/dist/harness/utils/shell-output.d.ts.map +1 -1
  299. package/dist/harness/utils/shell-output.js +65 -192
  300. package/dist/harness/utils/shell-output.js.map +1 -1
  301. package/dist/harness/utils/truncate.d.ts +1 -0
  302. package/dist/harness/utils/truncate.d.ts.map +1 -1
  303. package/dist/harness/utils/truncate.js +1 -1
  304. package/dist/harness/utils/truncate.js.map +1 -1
  305. package/dist/harness/utils/usage.d.ts +4 -0
  306. package/dist/harness/utils/usage.d.ts.map +1 -0
  307. package/dist/harness/utils/usage.js +33 -0
  308. package/dist/harness/utils/usage.js.map +1 -0
  309. package/dist/index.d.ts +4 -1
  310. package/dist/index.d.ts.map +1 -1
  311. package/dist/index.js +3 -6
  312. package/dist/index.js.map +1 -1
  313. package/dist/search/index.d.ts +24 -16
  314. package/dist/search/index.d.ts.map +1 -1
  315. package/dist/search/index.js +1 -1
  316. package/dist/search/index.js.map +1 -1
  317. package/dist/types.d.ts +2 -0
  318. package/dist/types.d.ts.map +1 -1
  319. package/dist/types.js.map +1 -1
  320. package/package.json +27 -6
  321. package/dist/harness/reducer.d.ts +0 -100
  322. package/dist/harness/reducer.d.ts.map +0 -1
  323. package/dist/harness/reducer.js +0 -420
  324. package/dist/harness/reducer.js.map +0 -1
  325. package/dist/harness/session/jsonl/errors.d.ts +0 -9
  326. package/dist/harness/session/jsonl/errors.d.ts.map +0 -1
  327. package/dist/harness/session/jsonl/errors.js +0 -18
  328. package/dist/harness/session/jsonl/errors.js.map +0 -1
  329. package/dist/harness/session/jsonl.d.ts +0 -3
  330. package/dist/harness/session/jsonl.d.ts.map +0 -1
  331. package/dist/harness/session/jsonl.js +0 -2
  332. package/dist/harness/session/jsonl.js.map +0 -1
  333. package/dist/harness/session/state.d.ts +0 -65
  334. package/dist/harness/session/state.d.ts.map +0 -1
  335. package/dist/harness/session/state.js +0 -320
  336. package/dist/harness/session/state.js.map +0 -1
  337. package/dist/harness/session/testing/conformance.d.ts +0 -4
  338. package/dist/harness/session/testing/conformance.d.ts.map +0 -1
  339. package/dist/harness/session/testing/conformance.js +0 -762
  340. package/dist/harness/session/testing/conformance.js.map +0 -1
  341. package/dist/search/scanning.d.ts +0 -29
  342. package/dist/search/scanning.d.ts.map +0 -1
  343. package/dist/search/scanning.js +0 -103
  344. package/dist/search/scanning.js.map +0 -1
@@ -1,6 +1,9 @@
1
1
  import type { SimpleStreamOptions, Transport } from "@earendil-works/pi-ai";
2
2
  import type { Static, TSchema } from "typebox";
3
- import type { AgentTool, AgentToolResult, AgentToolUpdateCallback } from "../types.ts";
3
+ import type { AgentTool, AgentToolResult } from "../types.ts";
4
+ import type { Context } from "./context.ts";
5
+ import type { JsonValue } from "./session/types.ts";
6
+ import type { TruncationResult } from "./utils/truncate.ts";
4
7
  /** Result of a fallible operation. Expected failures are returned as `ok: false` instead of thrown. */
5
8
  export type Result<TValue, TError> = {
6
9
  ok: true;
@@ -53,13 +56,31 @@ export interface AgentHarnessResources<TSkill extends Skill = Skill, TPromptTemp
53
56
  /** Skills available to the model and explicit skill invocation. */
54
57
  skills?: TSkill[];
55
58
  }
59
+ /** Options for one live harness tool progress update. */
60
+ export interface AgentHarnessToolUpdateOptions {
61
+ /** Request replacement of this invocation's durable recovery checkpoint. */
62
+ checkpoint?: true;
63
+ }
64
+ /** Synchronous full-snapshot progress callback supplied to harness-native tools. */
65
+ export type AgentHarnessToolUpdateCallback<TDetails> = (partialResult: AgentToolResult<TDetails>, options?: AgentHarnessToolUpdateOptions) => void;
66
+ /** Stable harness identity for one logical tool call, unchanged during safe replay. */
67
+ export interface AgentHarnessToolInvocation {
68
+ /** Opaque session-unique id equal to the call's reserved result-entry id. */
69
+ readonly invocationId: string;
70
+ readonly operationId: string;
71
+ readonly turnId: string;
72
+ /** Read one invocation-scoped durable replay memo. */
73
+ getMemo(name: string): Promise<JsonValue | undefined>;
74
+ /** Set or delete one invocation-scoped durable replay memo. */
75
+ setMemo(name: string, value: JsonValue | undefined): Promise<void>;
76
+ }
56
77
  /** Tool definition executed by an {@link AgentHarness} with an application-defined context. */
57
78
  export type AgentHarnessTool<TContext extends object | undefined, TParameters extends TSchema = TSchema, TDetails = unknown> = Omit<AgentTool<TParameters, TDetails>, "execute"> & {
58
79
  /** Execute the tool call with the context resolved for the current turn snapshot. */
59
- execute(toolCallId: string, params: Static<TParameters>, signal: AbortSignal | undefined, onUpdate: AgentToolUpdateCallback<TDetails> | undefined, context: TContext): Promise<AgentToolResult<TDetails>>;
80
+ execute(toolCallId: string, params: Static<TParameters>, onUpdate: AgentHarnessToolUpdateCallback<TDetails>, toolContext: TContext, invocation: AgentHarnessToolInvocation, context: Context): Promise<AgentToolResult<TDetails>>;
60
81
  };
61
- /** Static tool context or zero-argument provider resolved for each turn snapshot. */
62
- export type AgentHarnessToolContextSource<TContext extends object | undefined> = TContext | (() => TContext | Promise<TContext>);
82
+ /** Static tool context or provider resolved for each turn snapshot. */
83
+ export type AgentHarnessToolContextSource<TContext extends object | undefined> = TContext | ((context: Context) => TContext | Promise<TContext>);
63
84
  /** Curated provider request options owned by the harness and snapshotted per turn. */
64
85
  export interface AgentHarnessStreamOptions {
65
86
  /** Preferred transport forwarded to the stream function. */
@@ -76,6 +97,10 @@ export interface AgentHarnessStreamOptions {
76
97
  metadata?: SimpleStreamOptions["metadata"];
77
98
  /** Provider cache retention hint. */
78
99
  cacheRetention?: SimpleStreamOptions["cacheRetention"];
100
+ /** Ask a capable provider to continue generation asynchronously. */
101
+ deferred?: boolean | {
102
+ window?: "15m" | "1h" | "24h";
103
+ };
79
104
  }
80
105
  /** Per-request stream option patch returned by provider hooks. */
81
106
  export interface AgentHarnessStreamOptionsPatch extends Omit<Partial<AgentHarnessStreamOptions>, "headers" | "metadata"> {
@@ -136,6 +161,18 @@ export interface FileInfo {
136
161
  /** Modification time as milliseconds since Unix epoch. */
137
162
  mtimeMs: number;
138
163
  }
164
+ /** One UTF-8 line read from a text file. */
165
+ export interface TextLine {
166
+ text: string;
167
+ /** Whether the line ended with `\n`; callers use this to discard a torn final record. */
168
+ terminated: boolean;
169
+ }
170
+ /** Pull-based UTF-8 line reader that preserves final-line termination. */
171
+ export interface TextLineReader {
172
+ readLine(context: Context): Promise<Result<TextLine | undefined, FileError>>;
173
+ /** Release the open file. Must be best-effort and must not throw or reject. */
174
+ close(context: Context): Promise<void>;
175
+ }
139
176
  /**
140
177
  * Filesystem capability used by the harness.
141
178
  *
@@ -149,53 +186,99 @@ export interface FileSystem {
149
186
  /** Current working directory for relative paths. */
150
187
  cwd: string;
151
188
  /** Return an absolute addressed path without requiring it to exist and without resolving symlinks. */
152
- absolutePath(path: string, abortSignal?: AbortSignal): Promise<Result<string, FileError>>;
189
+ absolutePath(path: string, context: Context): Promise<Result<string, FileError>>;
153
190
  /** Join path segments in the filesystem namespace without requiring the result to exist. */
154
- joinPath(parts: string[], abortSignal?: AbortSignal): Promise<Result<string, FileError>>;
191
+ joinPath(parts: string[], context: Context): Promise<Result<string, FileError>>;
155
192
  /** Read a UTF-8 text file. */
156
- readTextFile(path: string, abortSignal?: AbortSignal): Promise<Result<string, FileError>>;
193
+ readTextFile(path: string, context: Context): Promise<Result<string, FileError>>;
194
+ /** Open a UTF-8 text file for pull-based line reading. */
195
+ openTextLineReader(path: string, context: Context): Promise<Result<TextLineReader, FileError>>;
157
196
  /** Read UTF-8 text lines. Implementations should stop once `maxLines` lines have been read. */
158
- readTextLines(path: string, options?: {
197
+ readTextLines(path: string, options: {
159
198
  maxLines?: number;
160
- abortSignal?: AbortSignal;
161
- }): Promise<Result<string[], FileError>>;
199
+ } | undefined, context: Context): Promise<Result<string[], FileError>>;
162
200
  /** Read a binary file. */
163
- readBinaryFile(path: string, abortSignal?: AbortSignal): Promise<Result<Uint8Array, FileError>>;
201
+ readBinaryFile(path: string, context: Context): Promise<Result<Uint8Array, FileError>>;
164
202
  /** Create or overwrite a file, creating parent directories when supported. */
165
- writeFile(path: string, content: string | Uint8Array, abortSignal?: AbortSignal): Promise<Result<void, FileError>>;
203
+ writeFile(path: string, content: string | Uint8Array, context: Context): Promise<Result<void, FileError>>;
166
204
  /** Create or append to a file, creating parent directories when supported. */
167
- appendFile(path: string, content: string | Uint8Array, abortSignal?: AbortSignal): Promise<Result<void, FileError>>;
205
+ appendFile(path: string, content: string | Uint8Array, context: Context): Promise<Result<void, FileError>>;
168
206
  /** Atomically rename a file, replacing the destination when it exists. Does not copy across filesystems. */
169
- renameFile(sourcePath: string, destinationPath: string, abortSignal?: AbortSignal): Promise<Result<void, FileError>>;
207
+ renameFile(sourcePath: string, destinationPath: string, context: Context): Promise<Result<void, FileError>>;
170
208
  /** Return metadata for the addressed path without following symlinks. */
171
- fileInfo(path: string, abortSignal?: AbortSignal): Promise<Result<FileInfo, FileError>>;
209
+ fileInfo(path: string, context: Context): Promise<Result<FileInfo, FileError>>;
172
210
  /** List direct children of a directory without following symlinks. */
173
- listDir(path: string, abortSignal?: AbortSignal): Promise<Result<FileInfo[], FileError>>;
211
+ listDir(path: string, context: Context): Promise<Result<FileInfo[], FileError>>;
174
212
  /** Return the canonical path for an existing path, resolving symlinks where supported. */
175
- canonicalPath(path: string, abortSignal?: AbortSignal): Promise<Result<string, FileError>>;
213
+ canonicalPath(path: string, context: Context): Promise<Result<string, FileError>>;
176
214
  /** Return false for missing paths. Other errors, such as permission failures, return a {@link FileError}. */
177
- exists(path: string, abortSignal?: AbortSignal): Promise<Result<boolean, FileError>>;
178
- /** Create a directory. Defaults: `recursive: true`, no abort signal. */
179
- createDir(path: string, options?: {
215
+ exists(path: string, context: Context): Promise<Result<boolean, FileError>>;
216
+ /** Create a directory. Defaults to `recursive: true`. */
217
+ createDir(path: string, options: {
180
218
  recursive?: boolean;
181
- abortSignal?: AbortSignal;
182
- }): Promise<Result<void, FileError>>;
183
- /** Remove a file or directory. Defaults: `recursive: false`, `force: false`, no abort signal. */
184
- remove(path: string, options?: {
219
+ } | undefined, context: Context): Promise<Result<void, FileError>>;
220
+ /** Remove a file or directory. Defaults to `recursive: false` and `force: false`. */
221
+ remove(path: string, options: {
185
222
  recursive?: boolean;
186
223
  force?: boolean;
187
- abortSignal?: AbortSignal;
188
- }): Promise<Result<void, FileError>>;
189
- /** Create a temporary directory and return its absolute path. Defaults: `prefix: "tmp-"`, no abort signal. */
190
- createTempDir(prefix?: string, abortSignal?: AbortSignal): Promise<Result<string, FileError>>;
191
- /** Create a temporary file and return its absolute path. Defaults: `prefix: ""`, `suffix: ""`, no abort signal. */
192
- createTempFile(options?: {
224
+ } | undefined, context: Context): Promise<Result<void, FileError>>;
225
+ /** Create a temporary directory and return its absolute path. Defaults to `prefix: "tmp-"`. */
226
+ createTempDir(prefix: string | undefined, context: Context): Promise<Result<string, FileError>>;
227
+ /** Create a temporary file and return its absolute path. Defaults to `prefix: ""` and `suffix: ""`. */
228
+ createTempFile(options: {
193
229
  prefix?: string;
194
230
  suffix?: string;
195
- abortSignal?: AbortSignal;
196
- }): Promise<Result<string, FileError>>;
231
+ } | undefined, context: Context): Promise<Result<string, FileError>>;
197
232
  /** Release filesystem resources. Must be best-effort and must not throw or reject. */
198
- cleanup(): Promise<void>;
233
+ cleanup(context: Context): Promise<void>;
234
+ }
235
+ /** Which portion of bounded output survives after the limit is crossed. */
236
+ export type ShellOutputRetention = "head" | "tail";
237
+ /** Source-side limits for one combined shell output view. */
238
+ export interface ShellOutputLimits {
239
+ maxBytes: number;
240
+ maxLines: number;
241
+ /** Defaults to `"tail"`. */
242
+ retain?: ShellOutputRetention;
243
+ }
244
+ /** Bounded shell capture requested by the caller. */
245
+ export interface ShellOutputCaptureOptions {
246
+ limits: ShellOutputLimits;
247
+ /** Preserve complete output in an execution-environment-local file after the limits are crossed. */
248
+ spill?: boolean;
249
+ }
250
+ /** Truncation metadata without a duplicate copy of the retained text. */
251
+ export type ShellOutputTruncation = Omit<TruncationResult, "content">;
252
+ /** Metadata accompanying a bounded shell output view. */
253
+ export interface ShellOutputMetadata {
254
+ truncation: ShellOutputTruncation;
255
+ spillPath?: string;
256
+ lastLineBytes?: number;
257
+ }
258
+ /** Complete bounded shell output view. */
259
+ export interface ShellOutputView extends ShellOutputMetadata {
260
+ text: string;
261
+ }
262
+ /** Incremental source-side change to one bounded shell output view. */
263
+ export type ShellOutputUpdate = {
264
+ kind: "replace";
265
+ output: ShellOutputView;
266
+ } | {
267
+ kind: "append";
268
+ text: string;
269
+ metadata: ShellOutputMetadata;
270
+ } | {
271
+ kind: "slide";
272
+ drop: number;
273
+ text: string;
274
+ metadata: ShellOutputMetadata;
275
+ } | {
276
+ kind: "metadata";
277
+ metadata: ShellOutputMetadata;
278
+ };
279
+ /** Bounded shell completion. Output text is delivered through {@link ShellExecOptions.onUpdate}. */
280
+ export interface ShellExecResult extends ShellOutputMetadata {
281
+ exitCode: number;
199
282
  }
200
283
  /** Options for {@link Shell.exec}. */
201
284
  export interface ShellExecOptions {
@@ -207,23 +290,23 @@ export interface ShellExecOptions {
207
290
  inheritEnv?: boolean;
208
291
  /** Timeout in seconds. Implementations should return a timeout error when the command exceeds this duration. Defaults to no timeout. */
209
292
  timeout?: number;
210
- /** Abort signal used to terminate the command. Defaults to no abort signal. */
211
- abortSignal?: AbortSignal;
212
- /** Called with stdout chunks as they are produced. */
213
- onStdout?: (chunk: string) => void | PromiseLike<void>;
214
- /** Called with stderr chunks as they are produced. */
215
- onStderr?: (chunk: string) => void | PromiseLike<void>;
293
+ /** Source-side bounded capture. Output is discarded when this and `onUpdate` are both absent. */
294
+ capture?: ShellOutputCaptureOptions;
295
+ /**
296
+ * Called with bounded output changes.
297
+ *
298
+ * A returned promise is awaited before the execution result settles: an observer that rejects
299
+ * fails the execution with a `callback_error` whose `cause` is the value it rejected with,
300
+ * instead of surfacing as an unhandled rejection.
301
+ */
302
+ onUpdate?: (update: ShellOutputUpdate, context: Context) => void | PromiseLike<void>;
216
303
  }
217
304
  /** Shell execution capability used by the harness. */
218
305
  export interface Shell {
219
306
  /** Execute a shell command in {@link FileSystem.cwd} unless `options.cwd` is provided. */
220
- exec(command: string, options?: ShellExecOptions): Promise<Result<{
221
- stdout: string;
222
- stderr: string;
223
- exitCode: number;
224
- }, ExecutionError>>;
307
+ exec(command: string, options: ShellExecOptions | undefined, context: Context): Promise<Result<ShellExecResult, ExecutionError>>;
225
308
  /** Release shell resources. Must be best-effort and must not throw or reject. */
226
- cleanup(): Promise<void>;
309
+ cleanup(context: Context): Promise<void>;
227
310
  }
228
311
  /** Filesystem and process execution environment used by the harness. */
229
312
  export interface ExecutionEnv extends FileSystem, Shell {
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/harness/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAC5E,OAAO,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAC/C,OAAO,KAAK,EAAE,SAAS,EAAE,eAAe,EAAE,uBAAuB,EAAE,MAAM,aAAa,CAAC;AAEvF,uGAAuG;AACvG,MAAM,MAAM,MAAM,CAAC,MAAM,EAAE,MAAM,IAAI;IAAE,EAAE,EAAE,IAAI,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,GAAG;IAAE,EAAE,EAAE,KAAK,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GAAG,IAAI,CAAC;QACjB,IAAI,KAAK,KAAK,SAAS;YAAE,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;IAC7C,CAAC;CACD;AAKD,sDAAsD;AACtD,MAAM,OAAO,kBAAmB,SAAQ,KAAK;IAI5C,YAAY,IAA4B,EAAE,OAAe,EAAE,KAAa;QACvE,KAAK,CAAC,OAAO,EAAE,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC;QAC5D,IAAI,CAAC,IAAI,GAAG,oBAAoB,CAAC;QACjC,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IAClB,CAAC;CACD","sourcesContent":["import type { SimpleStreamOptions, Transport } from \"@earendil-works/pi-ai\";\nimport type { Static, TSchema } from \"typebox\";\nimport type { AgentTool, AgentToolResult, AgentToolUpdateCallback } from \"../types.ts\";\n\n/** Result of a fallible operation. Expected failures are returned as `ok: false` instead of thrown. */\nexport type Result<TValue, TError> = { ok: true; value: TValue } | { ok: false; error: TError };\n\n/** Create a successful {@link Result}. */\nexport function ok<TValue, TError>(value: TValue): Result<TValue, TError> {\n\treturn { ok: true, value };\n}\n\n/** Create a failed {@link Result}. */\nexport function err<TValue, TError>(error: TError): Result<TValue, TError> {\n\treturn { ok: false, error };\n}\n\n/** Return the success value or throw the failure error. Intended for tests and explicit adapter boundaries. */\nexport function getOrThrow<TValue, TError>(result: Result<TValue, TError>): TValue {\n\tif (!result.ok) throw result.error;\n\treturn result.value;\n}\n\n/** Normalize nullable values to optional values. */\nexport function getOrUndefined<T>(value: T | null | undefined): T | undefined {\n\treturn value ?? undefined;\n}\n\n/** Normalize unknown thrown values into Error instances before using them as typed error causes. */\nexport function toError(error: unknown): Error {\n\tif (error instanceof Error) return error;\n\tif (typeof error === \"string\") return new Error(error);\n\ttry {\n\t\treturn new Error(JSON.stringify(error));\n\t} catch {\n\t\treturn new Error(String(error));\n\t}\n}\n\n/**\n * Skill loaded from a `SKILL.md` file or provided by an application.\n *\n * `name`, `description`, and `filePath` are inserted into the system prompt in an XML-formatted block as suggested by agentskills.io.\n * Use {@link formatSkillsForSystemPrompt} to generate the spec-compatible system prompt block.\n */\nexport interface Skill {\n\t/** Stable skill name used for lookup and model-visible listings. */\n\tname: string;\n\t/** Short model-visible description of when to use the skill. */\n\tdescription: string;\n\t/** Full skill instructions. */\n\tcontent: string;\n\t/** Absolute path to the skill file. Used for model-visible location and resolving relative references. */\n\tfilePath: string;\n\t/** Exclude this skill from model-visible skill lists while still allowing explicit application invocation. */\n\tdisableModelInvocation?: boolean;\n}\n\n/** Prompt template that can be formatted into a prompt for explicit invocation. */\nexport interface PromptTemplate {\n\t/** Stable template name used for lookup or application command routing. */\n\tname: string;\n\t/** Optional description for command lists or autocomplete. */\n\tdescription?: string;\n\t/** Template content. Argument placeholders are formatted by `formatPromptTemplateInvocation`. */\n\tcontent: string;\n}\n\n/** Resources made available to explicit invocation methods and system-prompt callbacks. */\nexport interface AgentHarnessResources<\n\tTSkill extends Skill = Skill,\n\tTPromptTemplate extends PromptTemplate = PromptTemplate,\n> {\n\t/** Prompt templates available for explicit invocation. */\n\tpromptTemplates?: TPromptTemplate[];\n\t/** Skills available to the model and explicit skill invocation. */\n\tskills?: TSkill[];\n}\n\n/** Tool definition executed by an {@link AgentHarness} with an application-defined context. */\nexport type AgentHarnessTool<\n\tTContext extends object | undefined,\n\tTParameters extends TSchema = TSchema,\n\tTDetails = unknown,\n> = Omit<AgentTool<TParameters, TDetails>, \"execute\"> & {\n\t/** Execute the tool call with the context resolved for the current turn snapshot. */\n\texecute(\n\t\ttoolCallId: string,\n\t\tparams: Static<TParameters>,\n\t\tsignal: AbortSignal | undefined,\n\t\tonUpdate: AgentToolUpdateCallback<TDetails> | undefined,\n\t\tcontext: TContext,\n\t): Promise<AgentToolResult<TDetails>>;\n};\n\n/** Static tool context or zero-argument provider resolved for each turn snapshot. */\nexport type AgentHarnessToolContextSource<TContext extends object | undefined> =\n\t| TContext\n\t| (() => TContext | Promise<TContext>);\n\n/** Curated provider request options owned by the harness and snapshotted per turn. */\nexport interface AgentHarnessStreamOptions {\n\t/** Preferred transport forwarded to the stream function. */\n\ttransport?: Transport;\n\t/** Provider request timeout in milliseconds. */\n\ttimeoutMs?: number;\n\t/** Maximum provider retry attempts. */\n\tmaxRetries?: number;\n\t/** Optional cap for provider-requested retry delays. */\n\tmaxRetryDelayMs?: number;\n\t/** Additional request headers merged with auth and lifecycle headers. */\n\theaders?: Record<string, string>;\n\t/** Provider metadata forwarded with requests. */\n\tmetadata?: SimpleStreamOptions[\"metadata\"];\n\t/** Provider cache retention hint. */\n\tcacheRetention?: SimpleStreamOptions[\"cacheRetention\"];\n}\n\n/** Per-request stream option patch returned by provider hooks. */\nexport interface AgentHarnessStreamOptionsPatch\n\textends Omit<Partial<AgentHarnessStreamOptions>, \"headers\" | \"metadata\"> {\n\t/** Header patch. `undefined` values delete keys; explicit `headers: undefined` clears all headers. */\n\theaders?: Record<string, string | undefined>;\n\t/** Metadata patch. `undefined` values delete keys; explicit `metadata: undefined` clears all metadata. */\n\tmetadata?: Record<string, unknown | undefined>;\n}\n\n/** Kind of filesystem object as addressed by a {@link FileSystem}. Symlinks are not followed automatically. */\nexport type FileKind = \"file\" | \"directory\" | \"symlink\";\n\n/** Stable, backend-independent file error codes returned by {@link FileSystem} file operations. */\nexport type FileErrorCode =\n\t| \"aborted\"\n\t| \"not_found\"\n\t| \"permission_denied\"\n\t| \"not_directory\"\n\t| \"is_directory\"\n\t| \"invalid\"\n\t| \"not_supported\"\n\t| \"unknown\";\n\n/** Error returned by {@link FileSystem} file operations. */\nexport class FileError extends Error {\n\treadonly cause?: unknown;\n\t/** Backend-independent error code. */\n\tpublic code: FileErrorCode;\n\t/** Absolute addressed path associated with the failure, when available. */\n\tpublic path?: string;\n\n\tconstructor(code: FileErrorCode, message: string, path?: string, cause?: Error) {\n\t\tsuper(message, cause === undefined ? undefined : { cause });\n\t\tthis.name = \"FileError\";\n\t\tthis.code = code;\n\t\tthis.path = path;\n\t\tif (cause !== undefined) this.cause = cause;\n\t}\n}\n\n/** Stable, backend-independent execution error codes returned by {@link ExecutionEnv.exec}. */\nexport type ExecutionErrorCode =\n\t| \"aborted\"\n\t| \"timeout\"\n\t| \"shell_unavailable\"\n\t| \"spawn_error\"\n\t| \"callback_error\"\n\t| \"unknown\";\n\n/** Error returned by {@link ExecutionEnv.exec}. */\nexport class ExecutionError extends Error {\n\treadonly cause?: unknown;\n\t/** Backend-independent error code. */\n\tpublic code: ExecutionErrorCode;\n\n\tconstructor(code: ExecutionErrorCode, message: string, cause?: unknown) {\n\t\tsuper(message, cause === undefined ? undefined : { cause });\n\t\tthis.name = \"ExecutionError\";\n\t\tthis.code = code;\n\t\tif (cause !== undefined) this.cause = cause;\n\t}\n}\n\n/** Stable compaction error codes returned by compaction helpers. */\nexport type CompactionErrorCode = \"aborted\" | \"summarization_failed\";\n\n/** Error returned by compaction helpers. */\nexport class CompactionError extends Error {\n\treadonly cause?: unknown;\n\t/** Backend-independent error code. */\n\tpublic code: CompactionErrorCode;\n\n\tconstructor(code: CompactionErrorCode, message: string, cause?: Error) {\n\t\tsuper(message, cause === undefined ? undefined : { cause });\n\t\tthis.name = \"CompactionError\";\n\t\tthis.code = code;\n\t\tif (cause !== undefined) this.cause = cause;\n\t}\n}\n\n/** Stable branch-summary error codes returned by branch summarization helpers. */\nexport type BranchSummaryErrorCode = \"aborted\" | \"summarization_failed\";\n\n/** Error returned by branch summarization helpers. */\nexport class BranchSummaryError extends Error {\n\t/** Backend-independent error code. */\n\tpublic code: BranchSummaryErrorCode;\n\n\tconstructor(code: BranchSummaryErrorCode, message: string, cause?: Error) {\n\t\tsuper(message, cause === undefined ? undefined : { cause });\n\t\tthis.name = \"BranchSummaryError\";\n\t\tthis.code = code;\n\t}\n}\n\n/** Metadata for one filesystem object in a {@link FileSystem}. */\nexport interface FileInfo {\n\t/** Basename of {@link path}. */\n\tname: string;\n\t/** Absolute, syntactically normalized addressed path in the execution environment. Symlinks are not followed. */\n\tpath: string;\n\t/** Object kind. Symlink targets are not followed; use {@link FileSystem.canonicalPath} explicitly. */\n\tkind: FileKind;\n\t/** Size in bytes for the addressed filesystem object. */\n\tsize: number;\n\t/** Modification time as milliseconds since Unix epoch. */\n\tmtimeMs: number;\n}\n\n/**\n * Filesystem capability used by the harness.\n *\n * Paths passed to methods may be absolute or relative to {@link cwd}. Paths returned by file operations are addressed paths\n * in the filesystem namespace, but are not canonicalized through symlinks unless returned by {@link canonicalPath}.\n *\n * Operation methods must never throw or reject. All filesystem failures, including unexpected backend failures, must be\n * encoded in the returned {@link Result}. Implementations must preserve this invariant.\n */\nexport interface FileSystem {\n\t/** Current working directory for relative paths. */\n\tcwd: string;\n\n\t/** Return an absolute addressed path without requiring it to exist and without resolving symlinks. */\n\tabsolutePath(path: string, abortSignal?: AbortSignal): Promise<Result<string, FileError>>;\n\t/** Join path segments in the filesystem namespace without requiring the result to exist. */\n\tjoinPath(parts: string[], abortSignal?: AbortSignal): Promise<Result<string, FileError>>;\n\t/** Read a UTF-8 text file. */\n\treadTextFile(path: string, abortSignal?: AbortSignal): Promise<Result<string, FileError>>;\n\t/** Read UTF-8 text lines. Implementations should stop once `maxLines` lines have been read. */\n\treadTextLines(\n\t\tpath: string,\n\t\toptions?: { maxLines?: number; abortSignal?: AbortSignal },\n\t): Promise<Result<string[], FileError>>;\n\t/** Read a binary file. */\n\treadBinaryFile(path: string, abortSignal?: AbortSignal): Promise<Result<Uint8Array, FileError>>;\n\t/** Create or overwrite a file, creating parent directories when supported. */\n\twriteFile(path: string, content: string | Uint8Array, abortSignal?: AbortSignal): Promise<Result<void, FileError>>;\n\t/** Create or append to a file, creating parent directories when supported. */\n\tappendFile(path: string, content: string | Uint8Array, abortSignal?: AbortSignal): Promise<Result<void, FileError>>;\n\t/** Atomically rename a file, replacing the destination when it exists. Does not copy across filesystems. */\n\trenameFile(sourcePath: string, destinationPath: string, abortSignal?: AbortSignal): Promise<Result<void, FileError>>;\n\t/** Return metadata for the addressed path without following symlinks. */\n\tfileInfo(path: string, abortSignal?: AbortSignal): Promise<Result<FileInfo, FileError>>;\n\t/** List direct children of a directory without following symlinks. */\n\tlistDir(path: string, abortSignal?: AbortSignal): Promise<Result<FileInfo[], FileError>>;\n\t/** Return the canonical path for an existing path, resolving symlinks where supported. */\n\tcanonicalPath(path: string, abortSignal?: AbortSignal): Promise<Result<string, FileError>>;\n\t/** Return false for missing paths. Other errors, such as permission failures, return a {@link FileError}. */\n\texists(path: string, abortSignal?: AbortSignal): Promise<Result<boolean, FileError>>;\n\t/** Create a directory. Defaults: `recursive: true`, no abort signal. */\n\tcreateDir(\n\t\tpath: string,\n\t\toptions?: { recursive?: boolean; abortSignal?: AbortSignal },\n\t): Promise<Result<void, FileError>>;\n\t/** Remove a file or directory. Defaults: `recursive: false`, `force: false`, no abort signal. */\n\tremove(\n\t\tpath: string,\n\t\toptions?: { recursive?: boolean; force?: boolean; abortSignal?: AbortSignal },\n\t): Promise<Result<void, FileError>>;\n\t/** Create a temporary directory and return its absolute path. Defaults: `prefix: \"tmp-\"`, no abort signal. */\n\tcreateTempDir(prefix?: string, abortSignal?: AbortSignal): Promise<Result<string, FileError>>;\n\t/** Create a temporary file and return its absolute path. Defaults: `prefix: \"\"`, `suffix: \"\"`, no abort signal. */\n\tcreateTempFile(options?: {\n\t\tprefix?: string;\n\t\tsuffix?: string;\n\t\tabortSignal?: AbortSignal;\n\t}): Promise<Result<string, FileError>>;\n\n\t/** Release filesystem resources. Must be best-effort and must not throw or reject. */\n\tcleanup(): Promise<void>;\n}\n\n/** Options for {@link Shell.exec}. */\nexport interface ShellExecOptions {\n\t/** Working directory for the command. Relative paths are resolved against {@link ExecutionEnv.cwd}. Defaults to {@link ExecutionEnv.cwd}. */\n\tcwd?: string;\n\t/** Environment variables for the command. Values override inherited defaults when `inheritEnv` is true. */\n\tenv?: Record<string, string>;\n\t/** Whether to inherit the execution environment's default variables. Defaults to true. */\n\tinheritEnv?: boolean;\n\t/** Timeout in seconds. Implementations should return a timeout error when the command exceeds this duration. Defaults to no timeout. */\n\ttimeout?: number;\n\t/** Abort signal used to terminate the command. Defaults to no abort signal. */\n\tabortSignal?: AbortSignal;\n\t/** Called with stdout chunks as they are produced. */\n\tonStdout?: (chunk: string) => void | PromiseLike<void>;\n\t/** Called with stderr chunks as they are produced. */\n\tonStderr?: (chunk: string) => void | PromiseLike<void>;\n}\n\n/** Shell execution capability used by the harness. */\nexport interface Shell {\n\t/** Execute a shell command in {@link FileSystem.cwd} unless `options.cwd` is provided. */\n\texec(\n\t\tcommand: string,\n\t\toptions?: ShellExecOptions,\n\t): Promise<Result<{ stdout: string; stderr: string; exitCode: number }, ExecutionError>>;\n\t/** Release shell resources. Must be best-effort and must not throw or reject. */\n\tcleanup(): Promise<void>;\n}\n\n/** Filesystem and process execution environment used by the harness. */\nexport interface ExecutionEnv extends FileSystem, Shell {}\n"]}
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/harness/types.ts"],"names":[],"mappings":"AAUA,0CAA0C;AAC1C,MAAM,UAAU,EAAE,CAAiB,KAAa;IAC/C,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;AAC5B,CAAC;AAED,sCAAsC;AACtC,MAAM,UAAU,GAAG,CAAiB,KAAa;IAChD,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC;AAC7B,CAAC;AAED,+GAA+G;AAC/G,MAAM,UAAU,UAAU,CAAiB,MAA8B;IACxE,IAAI,CAAC,MAAM,CAAC,EAAE;QAAE,MAAM,MAAM,CAAC,KAAK,CAAC;IACnC,OAAO,MAAM,CAAC,KAAK,CAAC;AACrB,CAAC;AAED,oDAAoD;AACpD,MAAM,UAAU,cAAc,CAAI,KAA2B;IAC5D,OAAO,KAAK,IAAI,SAAS,CAAC;AAC3B,CAAC;AAED,oGAAoG;AACpG,MAAM,UAAU,OAAO,CAAC,KAAc;IACrC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B,SAAQ,KAAK;IAKzC,YAAY,IAAyB,EAAE,OAAe,EAAE,KAAa;QACpE,KAAK,CAAC,OAAO,EAAE,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC;QAC5D,IAAI,CAAC,IAAI,GAAG,iBAAiB,CAAC;QAC9B,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,KAAK,KAAK,SAAS;YAAE,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;IAC7C,CAAC;CACD;AAKD,sDAAsD;AACtD,MAAM,OAAO,kBAAmB,SAAQ,KAAK;IAI5C,YAAY,IAA4B,EAAE,OAAe,EAAE,KAAa;QACvE,KAAK,CAAC,OAAO,EAAE,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC;QAC5D,IAAI,CAAC,IAAI,GAAG,oBAAoB,CAAC;QACjC,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IAClB,CAAC;CACD","sourcesContent":["import type { SimpleStreamOptions, Transport } from \"@earendil-works/pi-ai\";\nimport type { Static, TSchema } from \"typebox\";\nimport type { AgentTool, AgentToolResult } from \"../types.ts\";\nimport type { Context } from \"./context.ts\";\nimport type { JsonValue } from \"./session/types.ts\";\nimport type { TruncationResult } from \"./utils/truncate.ts\";\n\n/** Result of a fallible operation. Expected failures are returned as `ok: false` instead of thrown. */\nexport type Result<TValue, TError> = { ok: true; value: TValue } | { ok: false; error: TError };\n\n/** Create a successful {@link Result}. */\nexport function ok<TValue, TError>(value: TValue): Result<TValue, TError> {\n\treturn { ok: true, value };\n}\n\n/** Create a failed {@link Result}. */\nexport function err<TValue, TError>(error: TError): Result<TValue, TError> {\n\treturn { ok: false, error };\n}\n\n/** Return the success value or throw the failure error. Intended for tests and explicit adapter boundaries. */\nexport function getOrThrow<TValue, TError>(result: Result<TValue, TError>): TValue {\n\tif (!result.ok) throw result.error;\n\treturn result.value;\n}\n\n/** Normalize nullable values to optional values. */\nexport function getOrUndefined<T>(value: T | null | undefined): T | undefined {\n\treturn value ?? undefined;\n}\n\n/** Normalize unknown thrown values into Error instances before using them as typed error causes. */\nexport function toError(error: unknown): Error {\n\tif (error instanceof Error) return error;\n\tif (typeof error === \"string\") return new Error(error);\n\ttry {\n\t\treturn new Error(JSON.stringify(error));\n\t} catch {\n\t\treturn new Error(String(error));\n\t}\n}\n\n/**\n * Skill loaded from a `SKILL.md` file or provided by an application.\n *\n * `name`, `description`, and `filePath` are inserted into the system prompt in an XML-formatted block as suggested by agentskills.io.\n * Use {@link formatSkillsForSystemPrompt} to generate the spec-compatible system prompt block.\n */\nexport interface Skill {\n\t/** Stable skill name used for lookup and model-visible listings. */\n\tname: string;\n\t/** Short model-visible description of when to use the skill. */\n\tdescription: string;\n\t/** Full skill instructions. */\n\tcontent: string;\n\t/** Absolute path to the skill file. Used for model-visible location and resolving relative references. */\n\tfilePath: string;\n\t/** Exclude this skill from model-visible skill lists while still allowing explicit application invocation. */\n\tdisableModelInvocation?: boolean;\n}\n\n/** Prompt template that can be formatted into a prompt for explicit invocation. */\nexport interface PromptTemplate {\n\t/** Stable template name used for lookup or application command routing. */\n\tname: string;\n\t/** Optional description for command lists or autocomplete. */\n\tdescription?: string;\n\t/** Template content. Argument placeholders are formatted by `formatPromptTemplateInvocation`. */\n\tcontent: string;\n}\n\n/** Resources made available to explicit invocation methods and system-prompt callbacks. */\nexport interface AgentHarnessResources<\n\tTSkill extends Skill = Skill,\n\tTPromptTemplate extends PromptTemplate = PromptTemplate,\n> {\n\t/** Prompt templates available for explicit invocation. */\n\tpromptTemplates?: TPromptTemplate[];\n\t/** Skills available to the model and explicit skill invocation. */\n\tskills?: TSkill[];\n}\n\n/** Options for one live harness tool progress update. */\nexport interface AgentHarnessToolUpdateOptions {\n\t/** Request replacement of this invocation's durable recovery checkpoint. */\n\tcheckpoint?: true;\n}\n\n/** Synchronous full-snapshot progress callback supplied to harness-native tools. */\nexport type AgentHarnessToolUpdateCallback<TDetails> = (\n\tpartialResult: AgentToolResult<TDetails>,\n\toptions?: AgentHarnessToolUpdateOptions,\n) => void;\n\n/** Stable harness identity for one logical tool call, unchanged during safe replay. */\nexport interface AgentHarnessToolInvocation {\n\t/** Opaque session-unique id equal to the call's reserved result-entry id. */\n\treadonly invocationId: string;\n\treadonly operationId: string;\n\treadonly turnId: string;\n\t/** Read one invocation-scoped durable replay memo. */\n\tgetMemo(name: string): Promise<JsonValue | undefined>;\n\t/** Set or delete one invocation-scoped durable replay memo. */\n\tsetMemo(name: string, value: JsonValue | undefined): Promise<void>;\n}\n\n/** Tool definition executed by an {@link AgentHarness} with an application-defined context. */\nexport type AgentHarnessTool<\n\tTContext extends object | undefined,\n\tTParameters extends TSchema = TSchema,\n\tTDetails = unknown,\n> = Omit<AgentTool<TParameters, TDetails>, \"execute\"> & {\n\t/** Execute the tool call with the context resolved for the current turn snapshot. */\n\texecute(\n\t\ttoolCallId: string,\n\t\tparams: Static<TParameters>,\n\t\tonUpdate: AgentHarnessToolUpdateCallback<TDetails>,\n\t\ttoolContext: TContext,\n\t\tinvocation: AgentHarnessToolInvocation,\n\t\tcontext: Context,\n\t): Promise<AgentToolResult<TDetails>>;\n};\n\n/** Static tool context or provider resolved for each turn snapshot. */\nexport type AgentHarnessToolContextSource<TContext extends object | undefined> =\n\t| TContext\n\t| ((context: Context) => TContext | Promise<TContext>);\n\n/** Curated provider request options owned by the harness and snapshotted per turn. */\nexport interface AgentHarnessStreamOptions {\n\t/** Preferred transport forwarded to the stream function. */\n\ttransport?: Transport;\n\t/** Provider request timeout in milliseconds. */\n\ttimeoutMs?: number;\n\t/** Maximum provider retry attempts. */\n\tmaxRetries?: number;\n\t/** Optional cap for provider-requested retry delays. */\n\tmaxRetryDelayMs?: number;\n\t/** Additional request headers merged with auth and lifecycle headers. */\n\theaders?: Record<string, string>;\n\t/** Provider metadata forwarded with requests. */\n\tmetadata?: SimpleStreamOptions[\"metadata\"];\n\t/** Provider cache retention hint. */\n\tcacheRetention?: SimpleStreamOptions[\"cacheRetention\"];\n\t/** Ask a capable provider to continue generation asynchronously. */\n\tdeferred?: boolean | { window?: \"15m\" | \"1h\" | \"24h\" };\n}\n\n/** Per-request stream option patch returned by provider hooks. */\nexport interface AgentHarnessStreamOptionsPatch\n\textends Omit<Partial<AgentHarnessStreamOptions>, \"headers\" | \"metadata\"> {\n\t/** Header patch. `undefined` values delete keys; explicit `headers: undefined` clears all headers. */\n\theaders?: Record<string, string | undefined>;\n\t/** Metadata patch. `undefined` values delete keys; explicit `metadata: undefined` clears all metadata. */\n\tmetadata?: Record<string, unknown | undefined>;\n}\n\n/** Kind of filesystem object as addressed by a {@link FileSystem}. Symlinks are not followed automatically. */\nexport type FileKind = \"file\" | \"directory\" | \"symlink\";\n\n/** Stable, backend-independent file error codes returned by {@link FileSystem} file operations. */\nexport type FileErrorCode =\n\t| \"aborted\"\n\t| \"not_found\"\n\t| \"permission_denied\"\n\t| \"not_directory\"\n\t| \"is_directory\"\n\t| \"invalid\"\n\t| \"not_supported\"\n\t| \"unknown\";\n\n/** Error returned by {@link FileSystem} file operations. */\nexport class FileError extends Error {\n\treadonly cause?: unknown;\n\t/** Backend-independent error code. */\n\tpublic code: FileErrorCode;\n\t/** Absolute addressed path associated with the failure, when available. */\n\tpublic path?: string;\n\n\tconstructor(code: FileErrorCode, message: string, path?: string, cause?: Error) {\n\t\tsuper(message, cause === undefined ? undefined : { cause });\n\t\tthis.name = \"FileError\";\n\t\tthis.code = code;\n\t\tthis.path = path;\n\t\tif (cause !== undefined) this.cause = cause;\n\t}\n}\n\n/** Stable, backend-independent execution error codes returned by {@link ExecutionEnv.exec}. */\nexport type ExecutionErrorCode =\n\t| \"aborted\"\n\t| \"timeout\"\n\t| \"shell_unavailable\"\n\t| \"spawn_error\"\n\t| \"callback_error\"\n\t| \"unknown\";\n\n/** Error returned by {@link ExecutionEnv.exec}. */\nexport class ExecutionError extends Error {\n\treadonly cause?: unknown;\n\t/** Backend-independent error code. */\n\tpublic code: ExecutionErrorCode;\n\n\tconstructor(code: ExecutionErrorCode, message: string, cause?: unknown) {\n\t\tsuper(message, cause === undefined ? undefined : { cause });\n\t\tthis.name = \"ExecutionError\";\n\t\tthis.code = code;\n\t\tif (cause !== undefined) this.cause = cause;\n\t}\n}\n\n/** Stable compaction error codes returned by compaction helpers. */\nexport type CompactionErrorCode = \"aborted\" | \"summarization_failed\";\n\n/** Error returned by compaction helpers. */\nexport class CompactionError extends Error {\n\treadonly cause?: unknown;\n\t/** Backend-independent error code. */\n\tpublic code: CompactionErrorCode;\n\n\tconstructor(code: CompactionErrorCode, message: string, cause?: Error) {\n\t\tsuper(message, cause === undefined ? undefined : { cause });\n\t\tthis.name = \"CompactionError\";\n\t\tthis.code = code;\n\t\tif (cause !== undefined) this.cause = cause;\n\t}\n}\n\n/** Stable branch-summary error codes returned by branch summarization helpers. */\nexport type BranchSummaryErrorCode = \"aborted\" | \"summarization_failed\";\n\n/** Error returned by branch summarization helpers. */\nexport class BranchSummaryError extends Error {\n\t/** Backend-independent error code. */\n\tpublic code: BranchSummaryErrorCode;\n\n\tconstructor(code: BranchSummaryErrorCode, message: string, cause?: Error) {\n\t\tsuper(message, cause === undefined ? undefined : { cause });\n\t\tthis.name = \"BranchSummaryError\";\n\t\tthis.code = code;\n\t}\n}\n\n/** Metadata for one filesystem object in a {@link FileSystem}. */\nexport interface FileInfo {\n\t/** Basename of {@link path}. */\n\tname: string;\n\t/** Absolute, syntactically normalized addressed path in the execution environment. Symlinks are not followed. */\n\tpath: string;\n\t/** Object kind. Symlink targets are not followed; use {@link FileSystem.canonicalPath} explicitly. */\n\tkind: FileKind;\n\t/** Size in bytes for the addressed filesystem object. */\n\tsize: number;\n\t/** Modification time as milliseconds since Unix epoch. */\n\tmtimeMs: number;\n}\n\n/** One UTF-8 line read from a text file. */\nexport interface TextLine {\n\ttext: string;\n\t/** Whether the line ended with `\\n`; callers use this to discard a torn final record. */\n\tterminated: boolean;\n}\n\n/** Pull-based UTF-8 line reader that preserves final-line termination. */\nexport interface TextLineReader {\n\treadLine(context: Context): Promise<Result<TextLine | undefined, FileError>>;\n\t/** Release the open file. Must be best-effort and must not throw or reject. */\n\tclose(context: Context): Promise<void>;\n}\n\n/**\n * Filesystem capability used by the harness.\n *\n * Paths passed to methods may be absolute or relative to {@link cwd}. Paths returned by file operations are addressed paths\n * in the filesystem namespace, but are not canonicalized through symlinks unless returned by {@link canonicalPath}.\n *\n * Operation methods must never throw or reject. All filesystem failures, including unexpected backend failures, must be\n * encoded in the returned {@link Result}. Implementations must preserve this invariant.\n */\nexport interface FileSystem {\n\t/** Current working directory for relative paths. */\n\tcwd: string;\n\n\t/** Return an absolute addressed path without requiring it to exist and without resolving symlinks. */\n\tabsolutePath(path: string, context: Context): Promise<Result<string, FileError>>;\n\t/** Join path segments in the filesystem namespace without requiring the result to exist. */\n\tjoinPath(parts: string[], context: Context): Promise<Result<string, FileError>>;\n\t/** Read a UTF-8 text file. */\n\treadTextFile(path: string, context: Context): Promise<Result<string, FileError>>;\n\t/** Open a UTF-8 text file for pull-based line reading. */\n\topenTextLineReader(path: string, context: Context): Promise<Result<TextLineReader, FileError>>;\n\t/** Read UTF-8 text lines. Implementations should stop once `maxLines` lines have been read. */\n\treadTextLines(\n\t\tpath: string,\n\t\toptions: { maxLines?: number } | undefined,\n\t\tcontext: Context,\n\t): Promise<Result<string[], FileError>>;\n\t/** Read a binary file. */\n\treadBinaryFile(path: string, context: Context): Promise<Result<Uint8Array, FileError>>;\n\t/** Create or overwrite a file, creating parent directories when supported. */\n\twriteFile(path: string, content: string | Uint8Array, context: Context): Promise<Result<void, FileError>>;\n\t/** Create or append to a file, creating parent directories when supported. */\n\tappendFile(path: string, content: string | Uint8Array, context: Context): Promise<Result<void, FileError>>;\n\t/** Atomically rename a file, replacing the destination when it exists. Does not copy across filesystems. */\n\trenameFile(sourcePath: string, destinationPath: string, context: Context): Promise<Result<void, FileError>>;\n\t/** Return metadata for the addressed path without following symlinks. */\n\tfileInfo(path: string, context: Context): Promise<Result<FileInfo, FileError>>;\n\t/** List direct children of a directory without following symlinks. */\n\tlistDir(path: string, context: Context): Promise<Result<FileInfo[], FileError>>;\n\t/** Return the canonical path for an existing path, resolving symlinks where supported. */\n\tcanonicalPath(path: string, context: Context): Promise<Result<string, FileError>>;\n\t/** Return false for missing paths. Other errors, such as permission failures, return a {@link FileError}. */\n\texists(path: string, context: Context): Promise<Result<boolean, FileError>>;\n\t/** Create a directory. Defaults to `recursive: true`. */\n\tcreateDir(\n\t\tpath: string,\n\t\toptions: { recursive?: boolean } | undefined,\n\t\tcontext: Context,\n\t): Promise<Result<void, FileError>>;\n\t/** Remove a file or directory. Defaults to `recursive: false` and `force: false`. */\n\tremove(\n\t\tpath: string,\n\t\toptions: { recursive?: boolean; force?: boolean } | undefined,\n\t\tcontext: Context,\n\t): Promise<Result<void, FileError>>;\n\t/** Create a temporary directory and return its absolute path. Defaults to `prefix: \"tmp-\"`. */\n\tcreateTempDir(prefix: string | undefined, context: Context): Promise<Result<string, FileError>>;\n\t/** Create a temporary file and return its absolute path. Defaults to `prefix: \"\"` and `suffix: \"\"`. */\n\tcreateTempFile(\n\t\toptions: { prefix?: string; suffix?: string } | undefined,\n\t\tcontext: Context,\n\t): Promise<Result<string, FileError>>;\n\n\t/** Release filesystem resources. Must be best-effort and must not throw or reject. */\n\tcleanup(context: Context): Promise<void>;\n}\n\n/** Which portion of bounded output survives after the limit is crossed. */\nexport type ShellOutputRetention = \"head\" | \"tail\";\n\n/** Source-side limits for one combined shell output view. */\nexport interface ShellOutputLimits {\n\tmaxBytes: number;\n\tmaxLines: number;\n\t/** Defaults to `\"tail\"`. */\n\tretain?: ShellOutputRetention;\n}\n\n/** Bounded shell capture requested by the caller. */\nexport interface ShellOutputCaptureOptions {\n\tlimits: ShellOutputLimits;\n\t/** Preserve complete output in an execution-environment-local file after the limits are crossed. */\n\tspill?: boolean;\n}\n\n/** Truncation metadata without a duplicate copy of the retained text. */\nexport type ShellOutputTruncation = Omit<TruncationResult, \"content\">;\n\n/** Metadata accompanying a bounded shell output view. */\nexport interface ShellOutputMetadata {\n\ttruncation: ShellOutputTruncation;\n\tspillPath?: string;\n\tlastLineBytes?: number;\n}\n\n/** Complete bounded shell output view. */\nexport interface ShellOutputView extends ShellOutputMetadata {\n\ttext: string;\n}\n\n/** Incremental source-side change to one bounded shell output view. */\nexport type ShellOutputUpdate =\n\t| { kind: \"replace\"; output: ShellOutputView }\n\t| { kind: \"append\"; text: string; metadata: ShellOutputMetadata }\n\t| { kind: \"slide\"; drop: number; text: string; metadata: ShellOutputMetadata }\n\t| { kind: \"metadata\"; metadata: ShellOutputMetadata };\n\n/** Bounded shell completion. Output text is delivered through {@link ShellExecOptions.onUpdate}. */\nexport interface ShellExecResult extends ShellOutputMetadata {\n\texitCode: number;\n}\n\n/** Options for {@link Shell.exec}. */\nexport interface ShellExecOptions {\n\t/** Working directory for the command. Relative paths are resolved against {@link ExecutionEnv.cwd}. Defaults to {@link ExecutionEnv.cwd}. */\n\tcwd?: string;\n\t/** Environment variables for the command. Values override inherited defaults when `inheritEnv` is true. */\n\tenv?: Record<string, string>;\n\t/** Whether to inherit the execution environment's default variables. Defaults to true. */\n\tinheritEnv?: boolean;\n\t/** Timeout in seconds. Implementations should return a timeout error when the command exceeds this duration. Defaults to no timeout. */\n\ttimeout?: number;\n\t/** Source-side bounded capture. Output is discarded when this and `onUpdate` are both absent. */\n\tcapture?: ShellOutputCaptureOptions;\n\t/**\n\t * Called with bounded output changes.\n\t *\n\t * A returned promise is awaited before the execution result settles: an observer that rejects\n\t * fails the execution with a `callback_error` whose `cause` is the value it rejected with,\n\t * instead of surfacing as an unhandled rejection.\n\t */\n\tonUpdate?: (update: ShellOutputUpdate, context: Context) => void | PromiseLike<void>;\n}\n\n/** Shell execution capability used by the harness. */\nexport interface Shell {\n\t/** Execute a shell command in {@link FileSystem.cwd} unless `options.cwd` is provided. */\n\texec(\n\t\tcommand: string,\n\t\toptions: ShellExecOptions | undefined,\n\t\tcontext: Context,\n\t): Promise<Result<ShellExecResult, ExecutionError>>;\n\t/** Release shell resources. Must be best-effort and must not throw or reject. */\n\tcleanup(context: Context): Promise<void>;\n}\n\n/** Filesystem and process execution environment used by the harness. */\nexport interface ExecutionEnv extends FileSystem, Shell {}\n"]}
@@ -0,0 +1,24 @@
1
+ export interface AdaptivePublisherOptions<TValue, TUpdate> {
2
+ snapshot(): TValue;
3
+ update(previous: TValue | undefined, current: TValue): TUpdate | undefined;
4
+ measure(update: TUpdate): number;
5
+ publish(update: TUpdate): void;
6
+ onError(error: unknown): void;
7
+ minIntervalMs?: number;
8
+ targetBytesPerSecond?: number;
9
+ }
10
+ /**
11
+ * Publishes the latest state without queuing intermediate mutations.
12
+ *
13
+ * The first dirty state after idle is immediate. Each publication then buys a
14
+ * delay proportional to its encoded size, with a minimum interval that also
15
+ * bounds event count. A single trailing timer guarantees eventual publication.
16
+ */
17
+ export declare class AdaptivePublisher<TValue, TUpdate> {
18
+ #private;
19
+ constructor(options: AdaptivePublisherOptions<TValue, TUpdate>);
20
+ markDirty(): void;
21
+ flush(force?: boolean): void;
22
+ dispose(): void;
23
+ }
24
+ //# sourceMappingURL=adaptive-publisher.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"adaptive-publisher.d.ts","sourceRoot":"","sources":["../../../src/harness/utils/adaptive-publisher.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,wBAAwB,CAAC,MAAM,EAAE,OAAO;IACxD,QAAQ,IAAI,MAAM,CAAC;IACnB,MAAM,CAAC,QAAQ,EAAE,MAAM,GAAG,SAAS,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,GAAG,SAAS,CAAC;IAC3E,OAAO,CAAC,MAAM,EAAE,OAAO,GAAG,MAAM,CAAC;IACjC,OAAO,CAAC,MAAM,EAAE,OAAO,GAAG,IAAI,CAAC;IAC/B,OAAO,CAAC,KAAK,EAAE,OAAO,GAAG,IAAI,CAAC;IAC9B,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,oBAAoB,CAAC,EAAE,MAAM,CAAC;CAC9B;AAED;;;;;;GAMG;AACH,qBAAa,iBAAiB,CAAC,MAAM,EAAE,OAAO;;IAU7C,YAAY,OAAO,EAAE,wBAAwB,CAAC,MAAM,EAAE,OAAO,CAAC,EAI7D;IAED,SAAS,IAAI,IAAI,CAShB;IAED,KAAK,CAAC,KAAK,UAAQ,GAAG,IAAI,CAuBzB;IAED,OAAO,IAAI,IAAI,CAId;CAaD"}
@@ -0,0 +1,79 @@
1
+ /**
2
+ * Publishes the latest state without queuing intermediate mutations.
3
+ *
4
+ * The first dirty state after idle is immediate. Each publication then buys a
5
+ * delay proportional to its encoded size, with a minimum interval that also
6
+ * bounds event count. A single trailing timer guarantees eventual publication.
7
+ */
8
+ export class AdaptivePublisher {
9
+ #options;
10
+ #minIntervalMs;
11
+ #targetBytesPerSecond;
12
+ #published;
13
+ #dirty = false;
14
+ #nextEmitAt = 0;
15
+ #timer;
16
+ #disposed = false;
17
+ constructor(options) {
18
+ this.#options = options;
19
+ this.#minIntervalMs = options.minIntervalMs ?? 100;
20
+ this.#targetBytesPerSecond = options.targetBytesPerSecond ?? 100 * 1024;
21
+ }
22
+ markDirty() {
23
+ if (this.#disposed)
24
+ return;
25
+ this.#dirty = true;
26
+ const wait = this.#nextEmitAt - Date.now();
27
+ if (wait <= 0) {
28
+ this.flush();
29
+ return;
30
+ }
31
+ this.#armTimer(wait);
32
+ }
33
+ flush(force = false) {
34
+ if (this.#disposed || !this.#dirty)
35
+ return;
36
+ const now = Date.now();
37
+ if (!force && now < this.#nextEmitAt) {
38
+ this.#armTimer(this.#nextEmitAt - now);
39
+ return;
40
+ }
41
+ if (this.#timer !== undefined)
42
+ clearTimeout(this.#timer);
43
+ this.#timer = undefined;
44
+ const current = this.#options.snapshot();
45
+ const update = this.#options.update(this.#published, current);
46
+ if (update === undefined) {
47
+ this.#published = current;
48
+ this.#dirty = false;
49
+ return;
50
+ }
51
+ const encodedBytes = this.#options.measure(update);
52
+ this.#published = current;
53
+ this.#dirty = false;
54
+ this.#nextEmitAt = now + Math.max(this.#minIntervalMs, (encodedBytes * 1000) / this.#targetBytesPerSecond);
55
+ // Commit before delivery. A consumer may apply the update and then throw or
56
+ // reenter the producer; retaining the old baseline would duplicate that delta.
57
+ this.#options.publish(update);
58
+ }
59
+ dispose() {
60
+ if (this.#timer !== undefined)
61
+ clearTimeout(this.#timer);
62
+ this.#timer = undefined;
63
+ this.#disposed = true;
64
+ }
65
+ #armTimer(wait) {
66
+ if (this.#timer !== undefined)
67
+ return;
68
+ this.#timer = setTimeout(() => {
69
+ this.#timer = undefined;
70
+ try {
71
+ this.flush();
72
+ }
73
+ catch (error) {
74
+ this.#options.onError(error);
75
+ }
76
+ }, wait);
77
+ }
78
+ }
79
+ //# sourceMappingURL=adaptive-publisher.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"adaptive-publisher.js","sourceRoot":"","sources":["../../../src/harness/utils/adaptive-publisher.ts"],"names":[],"mappings":"AAUA;;;;;;GAMG;AACH,MAAM,OAAO,iBAAiB;IACpB,QAAQ,CAA4C;IACpD,cAAc,CAAS;IACvB,qBAAqB,CAAS;IACvC,UAAU,CAAqB;IAC/B,MAAM,GAAG,KAAK,CAAC;IACf,WAAW,GAAG,CAAC,CAAC;IAChB,MAAM,CAA4C;IAClD,SAAS,GAAG,KAAK,CAAC;IAElB,YAAY,OAAkD;QAC7D,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC;QACxB,IAAI,CAAC,cAAc,GAAG,OAAO,CAAC,aAAa,IAAI,GAAG,CAAC;QACnD,IAAI,CAAC,qBAAqB,GAAG,OAAO,CAAC,oBAAoB,IAAI,GAAG,GAAG,IAAI,CAAC;IACzE,CAAC;IAED,SAAS;QACR,IAAI,IAAI,CAAC,SAAS;YAAE,OAAO;QAC3B,IAAI,CAAC,MAAM,GAAG,IAAI,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G,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,cAAc,EAAE,CAAC,YAAY,GAAG,IAAI,CAAC,GAAG,IAAI,CAAC,qBAAqB,CAAC,CAAC;QAC3G,4EAA4E;QAC5E,+EAA+E;QAC/E,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;IAC/B,CAAC;IAED,OAAO;QACN,IAAI,IAAI,CAAC,MAAM,KAAK,SAAS;YAAE,YAAY,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QACzD,IAAI,CAAC,MAAM,GAAG,SAAS,CAAC;QACxB,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC;IACvB,CAAC;IAED,SAAS,CAAC,IAAY;QACrB,IAAI,IAAI,CAAC,MAAM,KAAK,SAAS;YAAE,OAAO;QACtC,IAAI,CAAC,MAAM,GAAG,UAAU,CAAC,GAAG,EAAE;YAC7B,IAAI,CAAC,MAAM,GAAG,SAAS,CAAC;YACxB,IAAI,CAAC;gBACJ,IAAI,CAAC,KAAK,EAAE,CAAC;YACd,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBAChB,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;YAC9B,CAAC;QACF,CAAC,EAAE,IAAI,CAAC,CAAC;IACV,CAAC;CACD","sourcesContent":["export interface AdaptivePublisherOptions<TValue, TUpdate> {\n\tsnapshot(): TValue;\n\tupdate(previous: TValue | undefined, current: TValue): TUpdate | undefined;\n\tmeasure(update: TUpdate): number;\n\tpublish(update: TUpdate): void;\n\tonError(error: unknown): void;\n\tminIntervalMs?: number;\n\ttargetBytesPerSecond?: number;\n}\n\n/**\n * Publishes the latest state without queuing intermediate mutations.\n *\n * The first dirty state after idle is immediate. Each publication then buys a\n * delay proportional to its encoded size, with a minimum interval that also\n * bounds event count. A single trailing timer guarantees eventual publication.\n */\nexport class AdaptivePublisher<TValue, TUpdate> {\n\treadonly #options: AdaptivePublisherOptions<TValue, TUpdate>;\n\treadonly #minIntervalMs: number;\n\treadonly #targetBytesPerSecond: number;\n\t#published: TValue | undefined;\n\t#dirty = false;\n\t#nextEmitAt = 0;\n\t#timer: ReturnType<typeof setTimeout> | undefined;\n\t#disposed = false;\n\n\tconstructor(options: AdaptivePublisherOptions<TValue, TUpdate>) {\n\t\tthis.#options = options;\n\t\tthis.#minIntervalMs = options.minIntervalMs ?? 100;\n\t\tthis.#targetBytesPerSecond = options.targetBytesPerSecond ?? 100 * 1024;\n\t}\n\n\tmarkDirty(): void {\n\t\tif (this.#disposed) return;\n\t\tthis.#dirty = true;\n\t\tconst wait = this.#nextEmitAt - Date.now();\n\t\tif (wait <= 0) {\n\t\t\tthis.flush();\n\t\t\treturn;\n\t\t}\n\t\tthis.#armTimer(wait);\n\t}\n\n\tflush(force = false): void {\n\t\tif (this.#disposed || !this.#dirty) return;\n\t\tconst now = Date.now();\n\t\tif (!force && now < this.#nextEmitAt) {\n\t\t\tthis.#armTimer(this.#nextEmitAt - now);\n\t\t\treturn;\n\t\t}\n\t\tif (this.#timer !== undefined) clearTimeout(this.#timer);\n\t\tthis.#timer = undefined;\n\t\tconst current = this.#options.snapshot();\n\t\tconst update = this.#options.update(this.#published, current);\n\t\tif (update === undefined) {\n\t\t\tthis.#published = current;\n\t\t\tthis.#dirty = false;\n\t\t\treturn;\n\t\t}\n\t\tconst encodedBytes = this.#options.measure(update);\n\t\tthis.#published = current;\n\t\tthis.#dirty = false;\n\t\tthis.#nextEmitAt = now + Math.max(this.#minIntervalMs, (encodedBytes * 1000) / this.#targetBytesPerSecond);\n\t\t// Commit before delivery. A consumer may apply the update and then throw or\n\t\t// reenter the producer; retaining the old baseline would duplicate that delta.\n\t\tthis.#options.publish(update);\n\t}\n\n\tdispose(): void {\n\t\tif (this.#timer !== undefined) clearTimeout(this.#timer);\n\t\tthis.#timer = undefined;\n\t\tthis.#disposed = true;\n\t}\n\n\t#armTimer(wait: number): void {\n\t\tif (this.#timer !== undefined) return;\n\t\tthis.#timer = setTimeout(() => {\n\t\t\tthis.#timer = undefined;\n\t\t\ttry {\n\t\t\t\tthis.flush();\n\t\t\t} catch (error) {\n\t\t\t\tthis.#options.onError(error);\n\t\t\t}\n\t\t}, wait);\n\t}\n}\n"]}
@@ -0,0 +1,31 @@
1
+ import type { Context } from "../context.ts";
2
+ import type { ShellOutputCaptureOptions, ShellOutputUpdate, ShellOutputView } from "../types.ts";
3
+ export declare const OUTPUT_MIN_EMIT_INTERVAL_MS = 100;
4
+ export declare const OUTPUT_TARGET_BYTES_PER_SECOND: number;
5
+ interface OutputCaptureHandlers {
6
+ onUpdate?: (update: ShellOutputUpdate, context: Context) => void;
7
+ onError(error: unknown): void;
8
+ }
9
+ /**
10
+ * Maintains and publishes one bounded shell-output view.
11
+ *
12
+ * Writes received while publication is rate-limited collapse into the latest
13
+ * view. Small changes remain responsive; complete window turnovers purchase a
14
+ * proportionally longer delay. The first update after idle and an explicit
15
+ * final flush are immediate.
16
+ */
17
+ export declare class OutputCapture {
18
+ #private;
19
+ constructor(options: ShellOutputCaptureOptions | undefined, context: Context, handlers: OutputCaptureHandlers);
20
+ get truncated(): boolean;
21
+ push(chunk: string | Uint8Array): void;
22
+ finish(): void;
23
+ setSpillPath(path: string): void;
24
+ snapshot(): ShellOutputView;
25
+ flush(): void;
26
+ dispose(): void;
27
+ }
28
+ export declare function applyShellOutputUpdate(current: ShellOutputView | undefined, update: ShellOutputUpdate): ShellOutputView;
29
+ export declare function sanitizeShellOutput(text: string): string;
30
+ export {};
31
+ //# sourceMappingURL=output-capture.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"output-capture.d.ts","sourceRoot":"","sources":["../../../src/harness/utils/output-capture.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAC7C,OAAO,KAAK,EAAE,yBAAyB,EAAuB,iBAAiB,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAItH,eAAO,MAAM,2BAA2B,MAAM,CAAC;AAC/C,eAAO,MAAM,8BAA8B,QAAa,CAAC;AAMzD,UAAU,qBAAqB;IAC9B,QAAQ,CAAC,EAAE,CAAC,MAAM,EAAE,iBAAiB,EAAE,OAAO,EAAE,OAAO,KAAK,IAAI,CAAC;IACjE,OAAO,CAAC,KAAK,EAAE,OAAO,GAAG,IAAI,CAAC;CAC9B;AAED;;;;;;;GAOG;AACH,qBAAa,aAAa;;IAkBzB,YAAY,OAAO,EAAE,yBAAyB,GAAG,SAAS,EAAE,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,qBAAqB,EAqB5G;IAED,IAAI,SAAS,IAAI,OAAO,CAEvB;IAED,IAAI,CAAC,KAAK,EAAE,MAAM,GAAG,UAAU,GAAG,IAAI,CAQrC;IAED,MAAM,IAAI,IAAI,CAGb;IAED,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAK/B;IAED,QAAQ,IAAI,eAAe,CAoB1B;IAED,KAAK,IAAI,IAAI,CAGZ;IAED,OAAO,IAAI,IAAI,CAGd;CA4BD;AAED,wBAAgB,sBAAsB,CACrC,OAAO,EAAE,eAAe,GAAG,SAAS,EACpC,MAAM,EAAE,iBAAiB,GACvB,eAAe,CAWjB;AA+CD,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAExD"}