@draht/agent-core 2026.10.20 → 2026.10.23

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 (468) hide show
  1. package/dist/agent-loop.d.ts +6 -1
  2. package/dist/agent-loop.d.ts.map +1 -1
  3. package/dist/agent-loop.js +16 -2
  4. package/dist/agent-loop.js.map +1 -1
  5. package/dist/agent.d.ts +8 -1
  6. package/dist/agent.d.ts.map +1 -1
  7. package/dist/agent.js +4 -0
  8. package/dist/agent.js.map +1 -1
  9. package/dist/index.d.ts +0 -22
  10. package/dist/index.d.ts.map +1 -1
  11. package/dist/index.js +0 -20
  12. package/dist/index.js.map +1 -1
  13. package/dist/proxy.d.ts +2 -5
  14. package/dist/proxy.d.ts.map +1 -1
  15. package/dist/proxy.js +2 -14
  16. package/dist/proxy.js.map +1 -1
  17. package/dist/types.d.ts +4 -0
  18. package/dist/types.d.ts.map +1 -1
  19. package/dist/types.js.map +1 -1
  20. package/package.json +4 -47
  21. package/dist/harness/agent-harness.d.ts +0 -716
  22. package/dist/harness/agent-harness.d.ts.map +0 -1
  23. package/dist/harness/agent-harness.js +0 -6
  24. package/dist/harness/agent-harness.js.map +0 -1
  25. package/dist/harness/compaction/branch-summarization.d.ts +0 -68
  26. package/dist/harness/compaction/branch-summarization.d.ts.map +0 -1
  27. package/dist/harness/compaction/branch-summarization.js +0 -176
  28. package/dist/harness/compaction/branch-summarization.js.map +0 -1
  29. package/dist/harness/compaction/compaction.d.ts +0 -126
  30. package/dist/harness/compaction/compaction.d.ts.map +0 -1
  31. package/dist/harness/compaction/compaction.js +0 -561
  32. package/dist/harness/compaction/compaction.js.map +0 -1
  33. package/dist/harness/compaction/utils.d.ts +0 -28
  34. package/dist/harness/compaction/utils.d.ts.map +0 -1
  35. package/dist/harness/compaction/utils.js +0 -123
  36. package/dist/harness/compaction/utils.js.map +0 -1
  37. package/dist/harness/config.d.ts +0 -9
  38. package/dist/harness/config.d.ts.map +0 -1
  39. package/dist/harness/config.js +0 -35
  40. package/dist/harness/config.js.map +0 -1
  41. package/dist/harness/context.d.ts +0 -9
  42. package/dist/harness/context.d.ts.map +0 -1
  43. package/dist/harness/context.js +0 -13
  44. package/dist/harness/context.js.map +0 -1
  45. package/dist/harness/env/nodejs.d.ts +0 -43
  46. package/dist/harness/env/nodejs.d.ts.map +0 -1
  47. package/dist/harness/env/nodejs.js +0 -865
  48. package/dist/harness/env/nodejs.js.map +0 -1
  49. package/dist/harness/events.d.ts +0 -24
  50. package/dist/harness/events.d.ts.map +0 -1
  51. package/dist/harness/events.js +0 -233
  52. package/dist/harness/events.js.map +0 -1
  53. package/dist/harness/execution/assistant.d.ts +0 -42
  54. package/dist/harness/execution/assistant.d.ts.map +0 -1
  55. package/dist/harness/execution/assistant.js +0 -82
  56. package/dist/harness/execution/assistant.js.map +0 -1
  57. package/dist/harness/execution/effect-gate.d.ts +0 -22
  58. package/dist/harness/execution/effect-gate.d.ts.map +0 -1
  59. package/dist/harness/execution/effect-gate.js +0 -49
  60. package/dist/harness/execution/effect-gate.js.map +0 -1
  61. package/dist/harness/execution/tools.d.ts +0 -67
  62. package/dist/harness/execution/tools.d.ts.map +0 -1
  63. package/dist/harness/execution/tools.js +0 -119
  64. package/dist/harness/execution/tools.js.map +0 -1
  65. package/dist/harness/execution-env.d.ts +0 -4
  66. package/dist/harness/execution-env.d.ts.map +0 -1
  67. package/dist/harness/execution-env.js +0 -3
  68. package/dist/harness/execution-env.js.map +0 -1
  69. package/dist/harness/hooks.d.ts +0 -38
  70. package/dist/harness/hooks.d.ts.map +0 -1
  71. package/dist/harness/hooks.js +0 -406
  72. package/dist/harness/hooks.js.map +0 -1
  73. package/dist/harness/messages.d.ts +0 -51
  74. package/dist/harness/messages.d.ts.map +0 -1
  75. package/dist/harness/messages.js +0 -103
  76. package/dist/harness/messages.js.map +0 -1
  77. package/dist/harness/pico3/bash.d.ts +0 -10
  78. package/dist/harness/pico3/bash.d.ts.map +0 -1
  79. package/dist/harness/pico3/bash.js +0 -25
  80. package/dist/harness/pico3/bash.js.map +0 -1
  81. package/dist/harness/pico3/bounded.d.ts +0 -21
  82. package/dist/harness/pico3/bounded.d.ts.map +0 -1
  83. package/dist/harness/pico3/bounded.js +0 -98
  84. package/dist/harness/pico3/bounded.js.map +0 -1
  85. package/dist/harness/pico3/chord.d.ts +0 -41
  86. package/dist/harness/pico3/chord.d.ts.map +0 -1
  87. package/dist/harness/pico3/chord.js +0 -147
  88. package/dist/harness/pico3/chord.js.map +0 -1
  89. package/dist/harness/pico3/context.d.ts +0 -16
  90. package/dist/harness/pico3/context.d.ts.map +0 -1
  91. package/dist/harness/pico3/context.js +0 -88
  92. package/dist/harness/pico3/context.js.map +0 -1
  93. package/dist/harness/pico3/harness.d.ts +0 -198
  94. package/dist/harness/pico3/harness.d.ts.map +0 -1
  95. package/dist/harness/pico3/harness.js +0 -654
  96. package/dist/harness/pico3/harness.js.map +0 -1
  97. package/dist/harness/pico3/hooks.d.ts +0 -10
  98. package/dist/harness/pico3/hooks.d.ts.map +0 -1
  99. package/dist/harness/pico3/hooks.js +0 -33
  100. package/dist/harness/pico3/hooks.js.map +0 -1
  101. package/dist/harness/pico3/index.d.ts +0 -19
  102. package/dist/harness/pico3/index.d.ts.map +0 -1
  103. package/dist/harness/pico3/index.js +0 -15
  104. package/dist/harness/pico3/index.js.map +0 -1
  105. package/dist/harness/pico3/jsonl.d.ts +0 -58
  106. package/dist/harness/pico3/jsonl.d.ts.map +0 -1
  107. package/dist/harness/pico3/jsonl.js +0 -325
  108. package/dist/harness/pico3/jsonl.js.map +0 -1
  109. package/dist/harness/pico3/kinds/collapse.d.ts +0 -49
  110. package/dist/harness/pico3/kinds/collapse.d.ts.map +0 -1
  111. package/dist/harness/pico3/kinds/collapse.js +0 -191
  112. package/dist/harness/pico3/kinds/collapse.js.map +0 -1
  113. package/dist/harness/pico3/kinds/entries.d.ts +0 -78
  114. package/dist/harness/pico3/kinds/entries.d.ts.map +0 -1
  115. package/dist/harness/pico3/kinds/entries.js +0 -13
  116. package/dist/harness/pico3/kinds/entries.js.map +0 -1
  117. package/dist/harness/pico3/kinds/frames.d.ts +0 -9
  118. package/dist/harness/pico3/kinds/frames.d.ts.map +0 -1
  119. package/dist/harness/pico3/kinds/frames.js +0 -75
  120. package/dist/harness/pico3/kinds/frames.js.map +0 -1
  121. package/dist/harness/pico3/kinds/generation.d.ts +0 -94
  122. package/dist/harness/pico3/kinds/generation.d.ts.map +0 -1
  123. package/dist/harness/pico3/kinds/generation.js +0 -504
  124. package/dist/harness/pico3/kinds/generation.js.map +0 -1
  125. package/dist/harness/pico3/kinds/job.d.ts +0 -44
  126. package/dist/harness/pico3/kinds/job.d.ts.map +0 -1
  127. package/dist/harness/pico3/kinds/job.js +0 -143
  128. package/dist/harness/pico3/kinds/job.js.map +0 -1
  129. package/dist/harness/pico3/kinds/plugin.d.ts +0 -15
  130. package/dist/harness/pico3/kinds/plugin.d.ts.map +0 -1
  131. package/dist/harness/pico3/kinds/plugin.js +0 -35
  132. package/dist/harness/pico3/kinds/plugin.js.map +0 -1
  133. package/dist/harness/pico3/kinds/post-tools.d.ts +0 -22
  134. package/dist/harness/pico3/kinds/post-tools.d.ts.map +0 -1
  135. package/dist/harness/pico3/kinds/post-tools.js +0 -145
  136. package/dist/harness/pico3/kinds/post-tools.js.map +0 -1
  137. package/dist/harness/pico3/kinds/task-api.d.ts +0 -3
  138. package/dist/harness/pico3/kinds/task-api.d.ts.map +0 -1
  139. package/dist/harness/pico3/kinds/task-api.js +0 -45
  140. package/dist/harness/pico3/kinds/task-api.js.map +0 -1
  141. package/dist/harness/pico3/kinds/tool.d.ts +0 -43
  142. package/dist/harness/pico3/kinds/tool.d.ts.map +0 -1
  143. package/dist/harness/pico3/kinds/tool.js +0 -373
  144. package/dist/harness/pico3/kinds/tool.js.map +0 -1
  145. package/dist/harness/pico3/legacy-tracker.d.ts +0 -11
  146. package/dist/harness/pico3/legacy-tracker.d.ts.map +0 -1
  147. package/dist/harness/pico3/legacy-tracker.js +0 -41
  148. package/dist/harness/pico3/legacy-tracker.js.map +0 -1
  149. package/dist/harness/pico3/membrane.d.ts +0 -23
  150. package/dist/harness/pico3/membrane.d.ts.map +0 -1
  151. package/dist/harness/pico3/membrane.js +0 -141
  152. package/dist/harness/pico3/membrane.js.map +0 -1
  153. package/dist/harness/pico3/memory.d.ts +0 -53
  154. package/dist/harness/pico3/memory.d.ts.map +0 -1
  155. package/dist/harness/pico3/memory.js +0 -264
  156. package/dist/harness/pico3/memory.js.map +0 -1
  157. package/dist/harness/pico3/scheduler.d.ts +0 -49
  158. package/dist/harness/pico3/scheduler.d.ts.map +0 -1
  159. package/dist/harness/pico3/scheduler.js +0 -438
  160. package/dist/harness/pico3/scheduler.js.map +0 -1
  161. package/dist/harness/pico3/session.d.ts +0 -264
  162. package/dist/harness/pico3/session.d.ts.map +0 -1
  163. package/dist/harness/pico3/session.js +0 -1348
  164. package/dist/harness/pico3/session.js.map +0 -1
  165. package/dist/harness/pico3/system.d.ts +0 -126
  166. package/dist/harness/pico3/system.d.ts.map +0 -1
  167. package/dist/harness/pico3/system.js +0 -244
  168. package/dist/harness/pico3/system.js.map +0 -1
  169. package/dist/harness/pico3/types.d.ts +0 -973
  170. package/dist/harness/pico3/types.d.ts.map +0 -1
  171. package/dist/harness/pico3/types.js +0 -106
  172. package/dist/harness/pico3/types.js.map +0 -1
  173. package/dist/harness/pico3/view.d.ts +0 -34
  174. package/dist/harness/pico3/view.d.ts.map +0 -1
  175. package/dist/harness/pico3/view.js +0 -411
  176. package/dist/harness/pico3/view.js.map +0 -1
  177. package/dist/harness/prompt-templates.d.ts +0 -49
  178. package/dist/harness/prompt-templates.d.ts.map +0 -1
  179. package/dist/harness/prompt-templates.js +0 -225
  180. package/dist/harness/prompt-templates.js.map +0 -1
  181. package/dist/harness/result.d.ts +0 -133
  182. package/dist/harness/result.d.ts.map +0 -1
  183. package/dist/harness/result.js +0 -81
  184. package/dist/harness/result.js.map +0 -1
  185. package/dist/harness/runtime/drive/boundary.d.ts +0 -28
  186. package/dist/harness/runtime/drive/boundary.d.ts.map +0 -1
  187. package/dist/harness/runtime/drive/boundary.js +0 -173
  188. package/dist/harness/runtime/drive/boundary.js.map +0 -1
  189. package/dist/harness/runtime/drive/checkpoint.d.ts +0 -8
  190. package/dist/harness/runtime/drive/checkpoint.d.ts.map +0 -1
  191. package/dist/harness/runtime/drive/checkpoint.js +0 -133
  192. package/dist/harness/runtime/drive/checkpoint.js.map +0 -1
  193. package/dist/harness/runtime/drive/deferred.d.ts +0 -15
  194. package/dist/harness/runtime/drive/deferred.d.ts.map +0 -1
  195. package/dist/harness/runtime/drive/deferred.js +0 -179
  196. package/dist/harness/runtime/drive/deferred.js.map +0 -1
  197. package/dist/harness/runtime/drive/generation.d.ts +0 -8
  198. package/dist/harness/runtime/drive/generation.d.ts.map +0 -1
  199. package/dist/harness/runtime/drive/generation.js +0 -205
  200. package/dist/harness/runtime/drive/generation.js.map +0 -1
  201. package/dist/harness/runtime/drive/reconcile.d.ts +0 -5
  202. package/dist/harness/runtime/drive/reconcile.d.ts.map +0 -1
  203. package/dist/harness/runtime/drive/reconcile.js +0 -140
  204. package/dist/harness/runtime/drive/reconcile.js.map +0 -1
  205. package/dist/harness/runtime/drive/recovery.d.ts +0 -8
  206. package/dist/harness/runtime/drive/recovery.d.ts.map +0 -1
  207. package/dist/harness/runtime/drive/recovery.js +0 -85
  208. package/dist/harness/runtime/drive/recovery.js.map +0 -1
  209. package/dist/harness/runtime/drive/response.d.ts +0 -23
  210. package/dist/harness/runtime/drive/response.d.ts.map +0 -1
  211. package/dist/harness/runtime/drive/response.js +0 -394
  212. package/dist/harness/runtime/drive/response.js.map +0 -1
  213. package/dist/harness/runtime/drive/retry.d.ts +0 -4
  214. package/dist/harness/runtime/drive/retry.d.ts.map +0 -1
  215. package/dist/harness/runtime/drive/retry.js +0 -34
  216. package/dist/harness/runtime/drive/retry.js.map +0 -1
  217. package/dist/harness/runtime/drive/structural.d.ts +0 -32
  218. package/dist/harness/runtime/drive/structural.d.ts.map +0 -1
  219. package/dist/harness/runtime/drive/structural.js +0 -929
  220. package/dist/harness/runtime/drive/structural.js.map +0 -1
  221. package/dist/harness/runtime/drive/terminal.d.ts +0 -7
  222. package/dist/harness/runtime/drive/terminal.d.ts.map +0 -1
  223. package/dist/harness/runtime/drive/terminal.js +0 -49
  224. package/dist/harness/runtime/drive/terminal.js.map +0 -1
  225. package/dist/harness/runtime/drive/tool-placement.d.ts +0 -14
  226. package/dist/harness/runtime/drive/tool-placement.d.ts.map +0 -1
  227. package/dist/harness/runtime/drive/tool-placement.js +0 -219
  228. package/dist/harness/runtime/drive/tool-placement.js.map +0 -1
  229. package/dist/harness/runtime/drive/tools.d.ts +0 -6
  230. package/dist/harness/runtime/drive/tools.d.ts.map +0 -1
  231. package/dist/harness/runtime/drive/tools.js +0 -449
  232. package/dist/harness/runtime/drive/tools.js.map +0 -1
  233. package/dist/harness/runtime/drive.d.ts +0 -6
  234. package/dist/harness/runtime/drive.d.ts.map +0 -1
  235. package/dist/harness/runtime/drive.js +0 -93
  236. package/dist/harness/runtime/drive.js.map +0 -1
  237. package/dist/harness/runtime/harness.d.ts +0 -59
  238. package/dist/harness/runtime/harness.d.ts.map +0 -1
  239. package/dist/harness/runtime/harness.js +0 -311
  240. package/dist/harness/runtime/harness.js.map +0 -1
  241. package/dist/harness/runtime/index.d.ts +0 -2
  242. package/dist/harness/runtime/index.d.ts.map +0 -1
  243. package/dist/harness/runtime/index.js +0 -2
  244. package/dist/harness/runtime/index.js.map +0 -1
  245. package/dist/harness/runtime/lane.d.ts +0 -118
  246. package/dist/harness/runtime/lane.d.ts.map +0 -1
  247. package/dist/harness/runtime/lane.js +0 -1575
  248. package/dist/harness/runtime/lane.js.map +0 -1
  249. package/dist/harness/runtime/progress.d.ts +0 -15
  250. package/dist/harness/runtime/progress.d.ts.map +0 -1
  251. package/dist/harness/runtime/progress.js +0 -66
  252. package/dist/harness/runtime/progress.js.map +0 -1
  253. package/dist/harness/runtime/reducer.d.ts +0 -5
  254. package/dist/harness/runtime/reducer.d.ts.map +0 -1
  255. package/dist/harness/runtime/reducer.js +0 -240
  256. package/dist/harness/runtime/reducer.js.map +0 -1
  257. package/dist/harness/runtime/restore.d.ts +0 -24
  258. package/dist/harness/runtime/restore.d.ts.map +0 -1
  259. package/dist/harness/runtime/restore.js +0 -117
  260. package/dist/harness/runtime/restore.js.map +0 -1
  261. package/dist/harness/runtime/transcript.d.ts +0 -21
  262. package/dist/harness/runtime/transcript.d.ts.map +0 -1
  263. package/dist/harness/runtime/transcript.js +0 -72
  264. package/dist/harness/runtime/transcript.js.map +0 -1
  265. package/dist/harness/runtime/types.d.ts +0 -105
  266. package/dist/harness/runtime/types.d.ts.map +0 -1
  267. package/dist/harness/runtime/types.js +0 -61
  268. package/dist/harness/runtime/types.js.map +0 -1
  269. package/dist/harness/session/commit.d.ts +0 -53
  270. package/dist/harness/session/commit.d.ts.map +0 -1
  271. package/dist/harness/session/commit.js +0 -57
  272. package/dist/harness/session/commit.js.map +0 -1
  273. package/dist/harness/session/context.d.ts +0 -10
  274. package/dist/harness/session/context.d.ts.map +0 -1
  275. package/dist/harness/session/context.js +0 -49
  276. package/dist/harness/session/context.js.map +0 -1
  277. package/dist/harness/session/fork-policy.d.ts +0 -21
  278. package/dist/harness/session/fork-policy.d.ts.map +0 -1
  279. package/dist/harness/session/fork-policy.js +0 -55
  280. package/dist/harness/session/fork-policy.js.map +0 -1
  281. package/dist/harness/session/fork.d.ts +0 -16
  282. package/dist/harness/session/fork.d.ts.map +0 -1
  283. package/dist/harness/session/fork.js +0 -79
  284. package/dist/harness/session/fork.js.map +0 -1
  285. package/dist/harness/session/in-memory-storage-state.d.ts +0 -39
  286. package/dist/harness/session/in-memory-storage-state.d.ts.map +0 -1
  287. package/dist/harness/session/in-memory-storage-state.js +0 -276
  288. package/dist/harness/session/in-memory-storage-state.js.map +0 -1
  289. package/dist/harness/session/index.d.ts +0 -11
  290. package/dist/harness/session/index.d.ts.map +0 -1
  291. package/dist/harness/session/index.js +0 -9
  292. package/dist/harness/session/index.js.map +0 -1
  293. package/dist/harness/session/jsonl/codec.d.ts +0 -21
  294. package/dist/harness/session/jsonl/codec.d.ts.map +0 -1
  295. package/dist/harness/session/jsonl/codec.js +0 -45
  296. package/dist/harness/session/jsonl/codec.js.map +0 -1
  297. package/dist/harness/session/jsonl/fork.d.ts +0 -38
  298. package/dist/harness/session/jsonl/fork.d.ts.map +0 -1
  299. package/dist/harness/session/jsonl/fork.js +0 -264
  300. package/dist/harness/session/jsonl/fork.js.map +0 -1
  301. package/dist/harness/session/jsonl/index.d.ts +0 -4
  302. package/dist/harness/session/jsonl/index.d.ts.map +0 -1
  303. package/dist/harness/session/jsonl/index.js +0 -4
  304. package/dist/harness/session/jsonl/index.js.map +0 -1
  305. package/dist/harness/session/jsonl/io.d.ts +0 -14
  306. package/dist/harness/session/jsonl/io.d.ts.map +0 -1
  307. package/dist/harness/session/jsonl/io.js +0 -86
  308. package/dist/harness/session/jsonl/io.js.map +0 -1
  309. package/dist/harness/session/jsonl/legacy-v3.d.ts +0 -44
  310. package/dist/harness/session/jsonl/legacy-v3.d.ts.map +0 -1
  311. package/dist/harness/session/jsonl/legacy-v3.js +0 -462
  312. package/dist/harness/session/jsonl/legacy-v3.js.map +0 -1
  313. package/dist/harness/session/jsonl/repo.d.ts +0 -35
  314. package/dist/harness/session/jsonl/repo.d.ts.map +0 -1
  315. package/dist/harness/session/jsonl/repo.js +0 -301
  316. package/dist/harness/session/jsonl/repo.js.map +0 -1
  317. package/dist/harness/session/jsonl/storage.d.ts +0 -41
  318. package/dist/harness/session/jsonl/storage.d.ts.map +0 -1
  319. package/dist/harness/session/jsonl/storage.js +0 -200
  320. package/dist/harness/session/jsonl/storage.js.map +0 -1
  321. package/dist/harness/session/jsonl/types.d.ts +0 -39
  322. package/dist/harness/session/jsonl/types.d.ts.map +0 -1
  323. package/dist/harness/session/jsonl/types.js +0 -3
  324. package/dist/harness/session/jsonl/types.js.map +0 -1
  325. package/dist/harness/session/memory.d.ts +0 -48
  326. package/dist/harness/session/memory.d.ts.map +0 -1
  327. package/dist/harness/session/memory.js +0 -369
  328. package/dist/harness/session/memory.js.map +0 -1
  329. package/dist/harness/session/mutation-line.d.ts +0 -8
  330. package/dist/harness/session/mutation-line.d.ts.map +0 -1
  331. package/dist/harness/session/mutation-line.js +0 -21
  332. package/dist/harness/session/mutation-line.js.map +0 -1
  333. package/dist/harness/session/session.d.ts +0 -82
  334. package/dist/harness/session/session.d.ts.map +0 -1
  335. package/dist/harness/session/session.js +0 -361
  336. package/dist/harness/session/session.js.map +0 -1
  337. package/dist/harness/session/testing/benchmark/datasets.d.ts +0 -12
  338. package/dist/harness/session/testing/benchmark/datasets.d.ts.map +0 -1
  339. package/dist/harness/session/testing/benchmark/datasets.js +0 -24
  340. package/dist/harness/session/testing/benchmark/datasets.js.map +0 -1
  341. package/dist/harness/session/testing/benchmark/session-repo.d.ts +0 -42
  342. package/dist/harness/session/testing/benchmark/session-repo.d.ts.map +0 -1
  343. package/dist/harness/session/testing/benchmark/session-repo.js +0 -127
  344. package/dist/harness/session/testing/benchmark/session-repo.js.map +0 -1
  345. package/dist/harness/session/testing/benchmark/storage.d.ts +0 -25
  346. package/dist/harness/session/testing/benchmark/storage.d.ts.map +0 -1
  347. package/dist/harness/session/testing/benchmark/storage.js +0 -114
  348. package/dist/harness/session/testing/benchmark/storage.js.map +0 -1
  349. package/dist/harness/session/testing/conformance/session-repo.d.ts +0 -23
  350. package/dist/harness/session/testing/conformance/session-repo.d.ts.map +0 -1
  351. package/dist/harness/session/testing/conformance/session-repo.js +0 -809
  352. package/dist/harness/session/testing/conformance/session-repo.js.map +0 -1
  353. package/dist/harness/session/testing/conformance/storage.d.ts +0 -4
  354. package/dist/harness/session/testing/conformance/storage.d.ts.map +0 -1
  355. package/dist/harness/session/testing/conformance/storage.js +0 -600
  356. package/dist/harness/session/testing/conformance/storage.js.map +0 -1
  357. package/dist/harness/session/testing/gating-storage.d.ts +0 -26
  358. package/dist/harness/session/testing/gating-storage.d.ts.map +0 -1
  359. package/dist/harness/session/testing/gating-storage.js +0 -100
  360. package/dist/harness/session/testing/gating-storage.js.map +0 -1
  361. package/dist/harness/session/testing/index.d.ts +0 -10
  362. package/dist/harness/session/testing/index.d.ts.map +0 -1
  363. package/dist/harness/session/testing/index.js +0 -9
  364. package/dist/harness/session/testing/index.js.map +0 -1
  365. package/dist/harness/session/testing/instrumented-storage.d.ts +0 -11
  366. package/dist/harness/session/testing/instrumented-storage.d.ts.map +0 -1
  367. package/dist/harness/session/testing/instrumented-storage.js +0 -16
  368. package/dist/harness/session/testing/instrumented-storage.js.map +0 -1
  369. package/dist/harness/session/testing/storage-decorator.d.ts +0 -20
  370. package/dist/harness/session/testing/storage-decorator.d.ts.map +0 -1
  371. package/dist/harness/session/testing/storage-decorator.js +0 -41
  372. package/dist/harness/session/testing/storage-decorator.js.map +0 -1
  373. package/dist/harness/session/testing/types.d.ts +0 -12
  374. package/dist/harness/session/testing/types.d.ts.map +0 -1
  375. package/dist/harness/session/testing/types.js +0 -2
  376. package/dist/harness/session/testing/types.js.map +0 -1
  377. package/dist/harness/session/types.d.ts +0 -512
  378. package/dist/harness/session/types.d.ts.map +0 -1
  379. package/dist/harness/session/types.js +0 -9
  380. package/dist/harness/session/types.js.map +0 -1
  381. package/dist/harness/session/values.d.ts +0 -95
  382. package/dist/harness/session/values.d.ts.map +0 -1
  383. package/dist/harness/session/values.js +0 -81
  384. package/dist/harness/session/values.js.map +0 -1
  385. package/dist/harness/skills.d.ts +0 -46
  386. package/dist/harness/skills.d.ts.map +0 -1
  387. package/dist/harness/skills.js +0 -326
  388. package/dist/harness/skills.js.map +0 -1
  389. package/dist/harness/system-prompt.d.ts +0 -3
  390. package/dist/harness/system-prompt.d.ts.map +0 -1
  391. package/dist/harness/system-prompt.js +0 -30
  392. package/dist/harness/system-prompt.js.map +0 -1
  393. package/dist/harness/telemetry.d.ts +0 -1242
  394. package/dist/harness/telemetry.d.ts.map +0 -1
  395. package/dist/harness/telemetry.js +0 -527
  396. package/dist/harness/telemetry.js.map +0 -1
  397. package/dist/harness/tools/bash.d.ts +0 -27
  398. package/dist/harness/tools/bash.d.ts.map +0 -1
  399. package/dist/harness/tools/bash.js +0 -105
  400. package/dist/harness/tools/bash.js.map +0 -1
  401. package/dist/harness/tools/edit-diff.d.ts +0 -89
  402. package/dist/harness/tools/edit-diff.d.ts.map +0 -1
  403. package/dist/harness/tools/edit-diff.js +0 -386
  404. package/dist/harness/tools/edit-diff.js.map +0 -1
  405. package/dist/harness/tools/edit.d.ts +0 -19
  406. package/dist/harness/tools/edit.d.ts.map +0 -1
  407. package/dist/harness/tools/edit.js +0 -108
  408. package/dist/harness/tools/edit.js.map +0 -1
  409. package/dist/harness/tools/file-mutation-queue.d.ts +0 -5
  410. package/dist/harness/tools/file-mutation-queue.d.ts.map +0 -1
  411. package/dist/harness/tools/file-mutation-queue.js +0 -46
  412. package/dist/harness/tools/file-mutation-queue.js.map +0 -1
  413. package/dist/harness/tools/image.d.ts +0 -3
  414. package/dist/harness/tools/image.d.ts.map +0 -1
  415. package/dist/harness/tools/image.js +0 -106
  416. package/dist/harness/tools/image.js.map +0 -1
  417. package/dist/harness/tools/index.d.ts +0 -6
  418. package/dist/harness/tools/index.d.ts.map +0 -1
  419. package/dist/harness/tools/index.js +0 -5
  420. package/dist/harness/tools/index.js.map +0 -1
  421. package/dist/harness/tools/path-utils.d.ts +0 -5
  422. package/dist/harness/tools/path-utils.d.ts.map +0 -1
  423. package/dist/harness/tools/path-utils.js +0 -26
  424. package/dist/harness/tools/path-utils.js.map +0 -1
  425. package/dist/harness/tools/read.d.ts +0 -35
  426. package/dist/harness/tools/read.d.ts.map +0 -1
  427. package/dist/harness/tools/read.js +0 -108
  428. package/dist/harness/tools/read.js.map +0 -1
  429. package/dist/harness/tools/tool-context.d.ts +0 -6
  430. package/dist/harness/tools/tool-context.d.ts.map +0 -1
  431. package/dist/harness/tools/tool-context.js +0 -2
  432. package/dist/harness/tools/tool-context.js.map +0 -1
  433. package/dist/harness/tools/write.d.ts +0 -11
  434. package/dist/harness/tools/write.d.ts.map +0 -1
  435. package/dist/harness/tools/write.js +0 -31
  436. package/dist/harness/tools/write.js.map +0 -1
  437. package/dist/harness/types.d.ts +0 -305
  438. package/dist/harness/types.d.ts.map +0 -1
  439. package/dist/harness/types.js +0 -75
  440. package/dist/harness/types.js.map +0 -1
  441. package/dist/harness/utils/adaptive-publisher.d.ts +0 -24
  442. package/dist/harness/utils/adaptive-publisher.d.ts.map +0 -1
  443. package/dist/harness/utils/adaptive-publisher.js +0 -79
  444. package/dist/harness/utils/adaptive-publisher.js.map +0 -1
  445. package/dist/harness/utils/output-capture.d.ts +0 -31
  446. package/dist/harness/utils/output-capture.d.ts.map +0 -1
  447. package/dist/harness/utils/output-capture.js +0 -217
  448. package/dist/harness/utils/output-capture.js.map +0 -1
  449. package/dist/harness/utils/shell-output.d.ts +0 -29
  450. package/dist/harness/utils/shell-output.d.ts.map +0 -1
  451. package/dist/harness/utils/shell-output.js +0 -71
  452. package/dist/harness/utils/shell-output.js.map +0 -1
  453. package/dist/harness/utils/truncate.d.ts +0 -71
  454. package/dist/harness/utils/truncate.d.ts.map +0 -1
  455. package/dist/harness/utils/truncate.js +0 -296
  456. package/dist/harness/utils/truncate.js.map +0 -1
  457. package/dist/harness/utils/usage.d.ts +0 -4
  458. package/dist/harness/utils/usage.d.ts.map +0 -1
  459. package/dist/harness/utils/usage.js +0 -33
  460. package/dist/harness/utils/usage.js.map +0 -1
  461. package/dist/node.d.ts +0 -3
  462. package/dist/node.d.ts.map +0 -1
  463. package/dist/node.js +0 -3
  464. package/dist/node.js.map +0 -1
  465. package/dist/search/index.d.ts +0 -29
  466. package/dist/search/index.d.ts.map +0 -1
  467. package/dist/search/index.js +0 -2
  468. package/dist/search/index.js.map +0 -1
@@ -1,108 +0,0 @@
1
- import { Type } from "typebox";
2
- import { getOrThrow } from "../types.js";
3
- import { DEFAULT_MAX_BYTES, DEFAULT_MAX_LINES, formatSize, truncateHead, } from "../utils/truncate.js";
4
- import { detectSupportedImageMimeType, encodeBase64 } from "./image.js";
5
- import { resolveReadToolPath } from "./path-utils.js";
6
- const readSchema = Type.Object({
7
- path: Type.String({ description: "Path to the file to read (relative or absolute)" }),
8
- offset: Type.Optional(Type.Number({ description: "Line number to start reading from (1-indexed)" })),
9
- limit: Type.Optional(Type.Number({ description: "Maximum number of lines to read" })),
10
- });
11
- export function createReadTool(options) {
12
- return {
13
- name: "read",
14
- label: "read",
15
- description: `Read the contents of a file. Supports text files and images (jpg, png, gif, webp, bmp). Images are sent as attachments. For text files, output is truncated to ${DEFAULT_MAX_LINES} lines or ${DEFAULT_MAX_BYTES / 1024}KB (whichever is hit first). Use offset/limit for large files. When you need the full file, continue with offset until complete.`,
16
- parameters: readSchema,
17
- async execute(_toolCallId, { path, offset, limit }, _onUpdate, { env }, _invocation, context) {
18
- const absolutePath = await resolveReadToolPath(env, path, context);
19
- const bytes = getOrThrow(await env.readBinaryFile(absolutePath, context));
20
- const mimeType = detectSupportedImageMimeType(bytes);
21
- if (mimeType) {
22
- if (options?.imageProcessor) {
23
- const processed = await options.imageProcessor(bytes, mimeType, { autoResizeImages: options.autoResizeImages ?? true }, context);
24
- if (!processed.ok) {
25
- return {
26
- content: [{ type: "text", text: `Read image file [${mimeType}]\n${processed.message}` }],
27
- details: undefined,
28
- };
29
- }
30
- const hints = processed.hints.length > 0 ? `\n${processed.hints.join("\n")}` : "";
31
- return {
32
- content: [
33
- { type: "text", text: `Read image file [${processed.mimeType}]${hints}` },
34
- { type: "image", data: processed.data, mimeType: processed.mimeType },
35
- ],
36
- details: undefined,
37
- };
38
- }
39
- if (mimeType === "image/bmp") {
40
- return {
41
- content: [
42
- {
43
- type: "text",
44
- text: "Read image file [image/bmp]\n[Image omitted: configure an imageProcessor to convert BMP images.]",
45
- },
46
- ],
47
- details: undefined,
48
- };
49
- }
50
- return {
51
- content: [
52
- { type: "text", text: `Read image file [${mimeType}]` },
53
- { type: "image", data: encodeBase64(bytes), mimeType },
54
- ],
55
- details: undefined,
56
- };
57
- }
58
- const textContent = new TextDecoder().decode(bytes);
59
- const allLines = textContent.split("\n");
60
- const totalFileLines = allLines.length;
61
- const startLine = offset ? Math.max(0, offset - 1) : 0;
62
- const startLineDisplay = startLine + 1;
63
- if (startLine >= allLines.length) {
64
- throw new Error(`Offset ${offset} is beyond end of file (${allLines.length} lines total)`);
65
- }
66
- let selectedContent;
67
- let userLimitedLines;
68
- if (limit !== undefined) {
69
- const endLine = Math.min(startLine + limit, allLines.length);
70
- selectedContent = allLines.slice(startLine, endLine).join("\n");
71
- userLimitedLines = endLine - startLine;
72
- }
73
- else {
74
- selectedContent = allLines.slice(startLine).join("\n");
75
- }
76
- const truncation = truncateHead(selectedContent);
77
- let outputText;
78
- let details;
79
- if (truncation.firstLineExceedsLimit) {
80
- const firstLineSize = formatSize(new TextEncoder().encode(allLines[startLine]).byteLength);
81
- outputText = `[Line ${startLineDisplay} is ${firstLineSize}, exceeds ${formatSize(DEFAULT_MAX_BYTES)} limit. Use bash: sed -n '${startLineDisplay}p' ${path} | head -c ${DEFAULT_MAX_BYTES}]`;
82
- details = { truncation };
83
- }
84
- else if (truncation.truncated) {
85
- const endLineDisplay = startLineDisplay + truncation.outputLines - 1;
86
- const nextOffset = endLineDisplay + 1;
87
- outputText = truncation.content;
88
- if (truncation.truncatedBy === "lines") {
89
- outputText += `\n\n[Showing lines ${startLineDisplay}-${endLineDisplay} of ${totalFileLines}. Use offset=${nextOffset} to continue.]`;
90
- }
91
- else {
92
- outputText += `\n\n[Showing lines ${startLineDisplay}-${endLineDisplay} of ${totalFileLines} (${formatSize(DEFAULT_MAX_BYTES)} limit). Use offset=${nextOffset} to continue.]`;
93
- }
94
- details = { truncation };
95
- }
96
- else if (userLimitedLines !== undefined && startLine + userLimitedLines < allLines.length) {
97
- const remaining = allLines.length - (startLine + userLimitedLines);
98
- const nextOffset = startLine + userLimitedLines + 1;
99
- outputText = `${truncation.content}\n\n[${remaining} more lines in file. Use offset=${nextOffset} to continue.]`;
100
- }
101
- else {
102
- outputText = truncation.content;
103
- }
104
- return { content: [{ type: "text", text: outputText }], details };
105
- },
106
- };
107
- }
108
- //# sourceMappingURL=read.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"read.js","sourceRoot":"","sources":["../../../src/harness/tools/read.ts"],"names":[],"mappings":"AACA,OAAO,EAAe,IAAI,EAAE,MAAM,SAAS,CAAC;AAG5C,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EACN,iBAAiB,EACjB,iBAAiB,EACjB,UAAU,EAEV,YAAY,GACZ,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,4BAA4B,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AACxE,OAAO,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AAGtD,MAAM,UAAU,GAAG,IAAI,CAAC,MAAM,CAAC;IAC9B,IAAI,EAAE,IAAI,CAAC,MAAM,CAAC,EAAE,WAAW,EAAE,iDAAiD,EAAE,CAAC;IACrF,MAAM,EAAE,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,WAAW,EAAE,+CAA+C,EAAE,CAAC,CAAC;IACpG,KAAK,EAAE,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,WAAW,EAAE,iCAAiC,EAAE,CAAC,CAAC;CACrF,CAAC,CAAC;AA0BH,MAAM,UAAU,cAAc,CAC7B,OAAyB;IAEzB,OAAO;QACN,IAAI,EAAE,MAAM;QACZ,KAAK,EAAE,MAAM;QACb,WAAW,EAAE,kKAAkK,iBAAiB,aAAa,iBAAiB,GAAG,IAAI,kIAAkI;QACvW,UAAU,EAAE,UAAU;QACtB,KAAK,CAAC,OAAO,CAAC,WAAW,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,KAA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AAgB,CAAC;gBAChL,CAAC;gBACD,OAAO,GAAG,EAAE,UAAU,EAAE,CAAC;YAC1B,CAAC;iBAAM,IAAI,gBAAgB,KAAK,SAAS,IAAI,SAAS,GAAG,gBAAgB,GAAG,QAAQ,CAAC,MAAM,EAAE,CAAC;gBAC7F,MAAM,SAAS,GAAG,QAAQ,CAAC,MAAM,GAAG,CAAC,SAAS,GAAG,gBAAgB,CAAC,CAAC;gBACnE,MAAM,UAAU,GAAG,SAAS,GAAG,gBAAgB,GAAG,CAAC,CAAC;gBACpD,UAAU,GAAG,GAAG,UAAU,CAAC,OAAO,QAAQ,SAAS,mCAAmC,UAAU,gBAAgB,CAAC;YAClH,CAAC;iBAAM,CAAC;gBACP,UAAU,GAAG,UAAU,CAAC,OAAO,CAAC;YACjC,CAAC;YAED,OAAO,EAAE,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,UAAU,EAAE,CAAC,EAAE,OAAO,EAAE,CAAC;QACnE,CAAC;KACD,CAAC;AACH,CAAC","sourcesContent":["import type { ImageContent, TextContent } from \"@draht/ai\";\nimport { type Static, Type } from \"typebox\";\nimport type { Context } from \"../context.ts\";\nimport type { AgentHarnessTool } from \"../types.ts\";\nimport { getOrThrow } from \"../types.ts\";\nimport {\n\tDEFAULT_MAX_BYTES,\n\tDEFAULT_MAX_LINES,\n\tformatSize,\n\ttype TruncationResult,\n\ttruncateHead,\n} from \"../utils/truncate.ts\";\nimport { detectSupportedImageMimeType, encodeBase64 } from \"./image.ts\";\nimport { resolveReadToolPath } from \"./path-utils.ts\";\nimport type { ExecutionToolContext } from \"./tool-context.ts\";\n\nconst readSchema = Type.Object({\n\tpath: Type.String({ description: \"Path to the file to read (relative or absolute)\" }),\n\toffset: Type.Optional(Type.Number({ description: \"Line number to start reading from (1-indexed)\" })),\n\tlimit: Type.Optional(Type.Number({ description: \"Maximum number of lines to read\" })),\n});\n\nexport type ReadToolInput = Static<typeof readSchema>;\n\nexport interface ReadToolDetails {\n\ttruncation?: TruncationResult;\n}\n\nexport type ReadImageProcessorResult =\n\t| { ok: true; data: string; mimeType: string; hints: string[] }\n\t| { ok: false; message: string };\n\nexport type ReadImageProcessor = (\n\tbytes: Uint8Array,\n\tmimeType: string,\n\toptions: { autoResizeImages: boolean },\n\tcontext: Context,\n) => Promise<ReadImageProcessorResult>;\n\nexport interface ReadToolOptions {\n\t/** Whether an injected image processor should resize images. Default: true. */\n\tautoResizeImages?: boolean;\n\t/** Optional image conversion/resizing implementation. */\n\timageProcessor?: ReadImageProcessor;\n}\n\nexport function createReadTool<TContext extends ExecutionToolContext = ExecutionToolContext>(\n\toptions?: ReadToolOptions,\n): AgentHarnessTool<TContext, typeof readSchema, ReadToolDetails | undefined> {\n\treturn {\n\t\tname: \"read\",\n\t\tlabel: \"read\",\n\t\tdescription: `Read the contents of a file. Supports text files and images (jpg, png, gif, webp, bmp). Images are sent as attachments. For text files, output is truncated to ${DEFAULT_MAX_LINES} lines or ${DEFAULT_MAX_BYTES / 1024}KB (whichever is hit first). Use offset/limit for large files. When you need the full file, continue with offset until complete.`,\n\t\tparameters: readSchema,\n\t\tasync execute(_toolCallId, { path, offset, limit }, _onUpdate, { env }, _invocation, context) {\n\t\t\tconst absolutePath = await resolveReadToolPath(env, path, context);\n\t\t\tconst bytes = getOrThrow(await env.readBinaryFile(absolutePath, context));\n\t\t\tconst mimeType = detectSupportedImageMimeType(bytes);\n\t\t\tif (mimeType) {\n\t\t\t\tif (options?.imageProcessor) {\n\t\t\t\t\tconst processed = await options.imageProcessor(\n\t\t\t\t\t\tbytes,\n\t\t\t\t\t\tmimeType,\n\t\t\t\t\t\t{ autoResizeImages: options.autoResizeImages ?? true },\n\t\t\t\t\t\tcontext,\n\t\t\t\t\t);\n\t\t\t\t\tif (!processed.ok) {\n\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\tcontent: [{ type: \"text\", text: `Read image file [${mimeType}]\\n${processed.message}` }],\n\t\t\t\t\t\t\tdetails: undefined,\n\t\t\t\t\t\t};\n\t\t\t\t\t}\n\t\t\t\t\tconst hints = processed.hints.length > 0 ? `\\n${processed.hints.join(\"\\n\")}` : \"\";\n\t\t\t\t\treturn {\n\t\t\t\t\t\tcontent: [\n\t\t\t\t\t\t\t{ type: \"text\", text: `Read image file [${processed.mimeType}]${hints}` },\n\t\t\t\t\t\t\t{ type: \"image\", data: processed.data, mimeType: processed.mimeType },\n\t\t\t\t\t\t] satisfies Array<TextContent | ImageContent>,\n\t\t\t\t\t\tdetails: undefined,\n\t\t\t\t\t};\n\t\t\t\t}\n\t\t\t\tif (mimeType === \"image/bmp\") {\n\t\t\t\t\treturn {\n\t\t\t\t\t\tcontent: [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\ttype: \"text\",\n\t\t\t\t\t\t\t\ttext: \"Read image file [image/bmp]\\n[Image omitted: configure an imageProcessor to convert BMP images.]\",\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t],\n\t\t\t\t\t\tdetails: undefined,\n\t\t\t\t\t};\n\t\t\t\t}\n\t\t\t\treturn {\n\t\t\t\t\tcontent: [\n\t\t\t\t\t\t{ type: \"text\", text: `Read image file [${mimeType}]` },\n\t\t\t\t\t\t{ type: \"image\", data: encodeBase64(bytes), mimeType },\n\t\t\t\t\t] satisfies Array<TextContent | ImageContent>,\n\t\t\t\t\tdetails: undefined,\n\t\t\t\t};\n\t\t\t}\n\n\t\t\tconst textContent = new TextDecoder().decode(bytes);\n\t\t\tconst allLines = textContent.split(\"\\n\");\n\t\t\tconst totalFileLines = allLines.length;\n\t\t\tconst startLine = offset ? Math.max(0, offset - 1) : 0;\n\t\t\tconst startLineDisplay = startLine + 1;\n\t\t\tif (startLine >= allLines.length) {\n\t\t\t\tthrow new Error(`Offset ${offset} is beyond end of file (${allLines.length} lines total)`);\n\t\t\t}\n\n\t\t\tlet selectedContent: string;\n\t\t\tlet userLimitedLines: number | undefined;\n\t\t\tif (limit !== undefined) {\n\t\t\t\tconst endLine = Math.min(startLine + limit, allLines.length);\n\t\t\t\tselectedContent = allLines.slice(startLine, endLine).join(\"\\n\");\n\t\t\t\tuserLimitedLines = endLine - startLine;\n\t\t\t} else {\n\t\t\t\tselectedContent = allLines.slice(startLine).join(\"\\n\");\n\t\t\t}\n\n\t\t\tconst truncation = truncateHead(selectedContent);\n\t\t\tlet outputText: string;\n\t\t\tlet details: ReadToolDetails | undefined;\n\t\t\tif (truncation.firstLineExceedsLimit) {\n\t\t\t\tconst firstLineSize = formatSize(new TextEncoder().encode(allLines[startLine]).byteLength);\n\t\t\t\toutputText = `[Line ${startLineDisplay} is ${firstLineSize}, exceeds ${formatSize(DEFAULT_MAX_BYTES)} limit. Use bash: sed -n '${startLineDisplay}p' ${path} | head -c ${DEFAULT_MAX_BYTES}]`;\n\t\t\t\tdetails = { truncation };\n\t\t\t} else if (truncation.truncated) {\n\t\t\t\tconst endLineDisplay = startLineDisplay + truncation.outputLines - 1;\n\t\t\t\tconst nextOffset = endLineDisplay + 1;\n\t\t\t\toutputText = truncation.content;\n\t\t\t\tif (truncation.truncatedBy === \"lines\") {\n\t\t\t\t\toutputText += `\\n\\n[Showing lines ${startLineDisplay}-${endLineDisplay} of ${totalFileLines}. Use offset=${nextOffset} to continue.]`;\n\t\t\t\t} else {\n\t\t\t\t\toutputText += `\\n\\n[Showing lines ${startLineDisplay}-${endLineDisplay} of ${totalFileLines} (${formatSize(DEFAULT_MAX_BYTES)} limit). Use offset=${nextOffset} to continue.]`;\n\t\t\t\t}\n\t\t\t\tdetails = { truncation };\n\t\t\t} else if (userLimitedLines !== undefined && startLine + userLimitedLines < allLines.length) {\n\t\t\t\tconst remaining = allLines.length - (startLine + userLimitedLines);\n\t\t\t\tconst nextOffset = startLine + userLimitedLines + 1;\n\t\t\t\toutputText = `${truncation.content}\\n\\n[${remaining} more lines in file. Use offset=${nextOffset} to continue.]`;\n\t\t\t} else {\n\t\t\t\toutputText = truncation.content;\n\t\t\t}\n\n\t\t\treturn { content: [{ type: \"text\", text: outputText }], details };\n\t\t},\n\t};\n}\n"]}
@@ -1,6 +0,0 @@
1
- import type { ExecutionEnv } from "../types.ts";
2
- /** Filesystem and shell context required by the built-in execution tools. */
3
- export interface ExecutionToolContext {
4
- env: ExecutionEnv;
5
- }
6
- //# sourceMappingURL=tool-context.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"tool-context.d.ts","sourceRoot":"","sources":["../../../src/harness/tools/tool-context.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAEhD,6EAA6E;AAC7E,MAAM,WAAW,oBAAoB;IACpC,GAAG,EAAE,YAAY,CAAC;CAClB"}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=tool-context.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"tool-context.js","sourceRoot":"","sources":["../../../src/harness/tools/tool-context.ts"],"names":[],"mappings":"","sourcesContent":["import type { ExecutionEnv } from \"../types.ts\";\n\n/** Filesystem and shell context required by the built-in execution tools. */\nexport interface ExecutionToolContext {\n\tenv: ExecutionEnv;\n}\n"]}
@@ -1,11 +0,0 @@
1
- import { type Static, Type } from "typebox";
2
- import type { AgentHarnessTool } from "../types.ts";
3
- import type { ExecutionToolContext } from "./tool-context.ts";
4
- declare const writeSchema: Type.TObject<{
5
- path: Type.TString;
6
- content: Type.TString;
7
- }>;
8
- export type WriteToolInput = Static<typeof writeSchema>;
9
- export declare function createWriteTool<TContext extends ExecutionToolContext = ExecutionToolContext>(): AgentHarnessTool<TContext, typeof writeSchema, undefined>;
10
- export {};
11
- //# sourceMappingURL=write.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"write.d.ts","sourceRoot":"","sources":["../../../src/harness/tools/write.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,MAAM,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAC5C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAIpD,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AAE9D,QAAA,MAAM,WAAW;;;EAGf,CAAC;AAEH,MAAM,MAAM,cAAc,GAAG,MAAM,CAAC,OAAO,WAAW,CAAC,CAAC;AAExD,wBAAgB,eAAe,CAAC,QAAQ,SAAS,oBAAoB,GAAG,oBAAoB,KAAK,gBAAgB,CAChH,QAAQ,EACR,OAAO,WAAW,EAClB,SAAS,CACT,CAyBA"}
@@ -1,31 +0,0 @@
1
- import { Type } from "typebox";
2
- import { getOrThrow } from "../types.js";
3
- import { withFileMutationQueue } from "./file-mutation-queue.js";
4
- import { resolveToolPath } from "./path-utils.js";
5
- const writeSchema = Type.Object({
6
- path: Type.String({ description: "Path to the file to write (relative or absolute)" }),
7
- content: Type.String({ description: "Content to write to the file" }),
8
- });
9
- export function createWriteTool() {
10
- return {
11
- name: "write",
12
- label: "write",
13
- description: "Write content to a file. Creates the file if it doesn't exist, overwrites if it does. Automatically creates parent directories.",
14
- parameters: writeSchema,
15
- async execute(_toolCallId, { path, content }, _onUpdate, { env }, _invocation, context) {
16
- const absolutePath = await resolveToolPath(env, path, context);
17
- return withFileMutationQueue(env, absolutePath, async () => {
18
- if (context.abortSignal?.aborted)
19
- throw new Error("Operation aborted");
20
- getOrThrow(await env.writeFile(absolutePath, content, context));
21
- if (context.abortSignal?.aborted)
22
- throw new Error("Operation aborted");
23
- return {
24
- content: [{ type: "text", text: `Successfully wrote to ${path}` }],
25
- details: undefined,
26
- };
27
- }, context);
28
- },
29
- };
30
- }
31
- //# sourceMappingURL=write.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"write.js","sourceRoot":"","sources":["../../../src/harness/tools/write.ts"],"names":[],"mappings":"AAAA,OAAO,EAAe,IAAI,EAAE,MAAM,SAAS,CAAC;AAE5C,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,qBAAqB,EAAE,MAAM,0BAA0B,CAAC;A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port type { AgentHarnessTool } from \"../types.ts\";\nimport { getOrThrow } from \"../types.ts\";\nimport { withFileMutationQueue } from \"./file-mutation-queue.ts\";\nimport { resolveToolPath } from \"./path-utils.ts\";\nimport type { ExecutionToolContext } from \"./tool-context.ts\";\n\nconst writeSchema = Type.Object({\n\tpath: Type.String({ description: \"Path to the file to write (relative or absolute)\" }),\n\tcontent: Type.String({ description: \"Content to write to the file\" }),\n});\n\nexport type WriteToolInput = Static<typeof writeSchema>;\n\nexport function createWriteTool<TContext extends ExecutionToolContext = ExecutionToolContext>(): AgentHarnessTool<\n\tTContext,\n\ttypeof writeSchema,\n\tundefined\n> {\n\treturn {\n\t\tname: \"write\",\n\t\tlabel: \"write\",\n\t\tdescription:\n\t\t\t\"Write content to a file. Creates the file if it doesn't exist, overwrites if it does. Automatically creates parent directories.\",\n\t\tparameters: writeSchema,\n\t\tasync execute(_toolCallId, { path, content }, _onUpdate, { env }, _invocation, context) {\n\t\t\tconst absolutePath = await resolveToolPath(env, path, context);\n\t\t\treturn withFileMutationQueue(\n\t\t\t\tenv,\n\t\t\t\tabsolutePath,\n\t\t\t\tasync () => {\n\t\t\t\t\tif (context.abortSignal?.aborted) throw new Error(\"Operation aborted\");\n\t\t\t\t\tgetOrThrow(await env.writeFile(absolutePath, content, context));\n\t\t\t\t\tif (context.abortSignal?.aborted) throw new Error(\"Operation aborted\");\n\t\t\t\t\treturn {\n\t\t\t\t\t\tcontent: [{ type: \"text\", text: `Successfully wrote to ${path}` }],\n\t\t\t\t\t\tdetails: undefined,\n\t\t\t\t\t};\n\t\t\t\t},\n\t\t\t\tcontext,\n\t\t\t);\n\t\t},\n\t};\n}\n"]}
@@ -1,305 +0,0 @@
1
- import type { SimpleStreamOptions, Transport } from "@draht/ai";
2
- import type { Static, TSchema } from "typebox";
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";
7
- /** Result of a fallible operation. Expected failures are returned as `ok: false` instead of thrown. */
8
- export type Result<TValue, TError> = {
9
- ok: true;
10
- value: TValue;
11
- } | {
12
- ok: false;
13
- error: TError;
14
- };
15
- /** Create a successful {@link Result}. */
16
- export declare function ok<TValue, TError>(value: TValue): Result<TValue, TError>;
17
- /** Create a failed {@link Result}. */
18
- export declare function err<TValue, TError>(error: TError): Result<TValue, TError>;
19
- /** Return the success value or throw the failure error. Intended for tests and explicit adapter boundaries. */
20
- export declare function getOrThrow<TValue, TError>(result: Result<TValue, TError>): TValue;
21
- /** Return the success value or `undefined`. Only object values are allowed to avoid truthiness bugs with primitives. */
22
- export declare function getOrUndefined<TValue extends object, TError>(result: Result<TValue, TError>): TValue | undefined;
23
- /** Normalize unknown thrown values into Error instances before using them as typed error causes. */
24
- export declare function toError(error: unknown): Error;
25
- /**
26
- * Skill loaded from a `SKILL.md` file or provided by an application.
27
- *
28
- * `name`, `description`, and `filePath` are inserted into the system prompt in an XML-formatted block as suggested by agentskills.io.
29
- * Use {@link formatSkillsForSystemPrompt} to generate the spec-compatible system prompt block.
30
- */
31
- export interface Skill {
32
- /** Stable skill name used for lookup and model-visible listings. */
33
- name: string;
34
- /** Short model-visible description of when to use the skill. */
35
- description: string;
36
- /** Full skill instructions. */
37
- content: string;
38
- /** Absolute path to the skill file. Used for model-visible location and resolving relative references. */
39
- filePath: string;
40
- /** Exclude this skill from model-visible skill lists while still allowing explicit application invocation. */
41
- disableModelInvocation?: boolean;
42
- }
43
- /** Prompt template that can be formatted into a prompt for explicit invocation. */
44
- export interface PromptTemplate {
45
- /** Stable template name used for lookup or application command routing. */
46
- name: string;
47
- /** Optional description for command lists or autocomplete. */
48
- description?: string;
49
- /** Template content. Argument placeholders are formatted by `formatPromptTemplateInvocation`. */
50
- content: string;
51
- }
52
- /** Resources made available to explicit invocation methods and system-prompt callbacks. */
53
- export interface AgentHarnessResources<TSkill extends Skill = Skill, TPromptTemplate extends PromptTemplate = PromptTemplate> {
54
- /** Prompt templates available for explicit invocation. */
55
- promptTemplates?: TPromptTemplate[];
56
- /** Skills available to the model and explicit skill invocation. */
57
- skills?: TSkill[];
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
- }
77
- /** Tool definition executed by an {@link AgentHarness} with an application-defined context. */
78
- export type AgentHarnessTool<TContext extends object | undefined, TParameters extends TSchema = TSchema, TDetails = unknown> = Omit<AgentTool<TParameters, TDetails>, "execute"> & {
79
- /** Execute the tool call with the context resolved for the current turn snapshot. */
80
- execute(toolCallId: string, params: Static<TParameters>, onUpdate: AgentHarnessToolUpdateCallback<TDetails>, toolContext: TContext, invocation: AgentHarnessToolInvocation, context: Context): Promise<AgentToolResult<TDetails>>;
81
- };
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>);
84
- /** Curated provider request options owned by the harness and snapshotted per turn. */
85
- export interface AgentHarnessStreamOptions {
86
- /** Preferred transport forwarded to the stream function. */
87
- transport?: Transport;
88
- /** Provider request timeout in milliseconds. */
89
- timeoutMs?: number;
90
- /** Maximum provider retry attempts. */
91
- maxRetries?: number;
92
- /** Optional cap for provider-requested retry delays. */
93
- maxRetryDelayMs?: number;
94
- /** Additional request headers merged with auth and lifecycle headers. */
95
- headers?: Record<string, string>;
96
- /** Provider metadata forwarded with requests. */
97
- metadata?: SimpleStreamOptions["metadata"];
98
- /** Provider cache retention hint. */
99
- cacheRetention?: SimpleStreamOptions["cacheRetention"];
100
- /** Ask a capable provider to continue generation asynchronously. */
101
- deferred?: boolean | {
102
- window?: "15m" | "1h" | "24h";
103
- };
104
- }
105
- /** Per-request stream option patch returned by provider hooks. */
106
- export interface AgentHarnessStreamOptionsPatch extends Omit<Partial<AgentHarnessStreamOptions>, "headers" | "metadata"> {
107
- /** Header patch. `undefined` values delete keys; explicit `headers: undefined` clears all headers. */
108
- headers?: Record<string, string | undefined>;
109
- /** Metadata patch. `undefined` values delete keys; explicit `metadata: undefined` clears all metadata. */
110
- metadata?: Record<string, unknown | undefined>;
111
- }
112
- /** Kind of filesystem object as addressed by a {@link FileSystem}. Symlinks are not followed automatically. */
113
- export type FileKind = "file" | "directory" | "symlink";
114
- /** Stable, backend-independent file error codes returned by {@link FileSystem} file operations. */
115
- export type FileErrorCode = "aborted" | "not_found" | "permission_denied" | "not_directory" | "is_directory" | "invalid" | "not_supported" | "unknown";
116
- /** Error returned by {@link FileSystem} file operations. */
117
- export declare class FileError extends Error {
118
- /** Backend-independent error code. */
119
- code: FileErrorCode;
120
- /** Absolute addressed path associated with the failure, when available. */
121
- path?: string;
122
- constructor(code: FileErrorCode, message: string, path?: string, cause?: Error);
123
- }
124
- /** Stable, backend-independent execution error codes returned by {@link ExecutionEnv.exec}. */
125
- export type ExecutionErrorCode = "aborted" | "timeout" | "shell_unavailable" | "spawn_error" | "callback_error" | "unknown";
126
- /** Error returned by {@link ExecutionEnv.exec}. */
127
- export declare class ExecutionError extends Error {
128
- /** Backend-independent error code. */
129
- code: ExecutionErrorCode;
130
- constructor(code: ExecutionErrorCode, message: string, cause?: Error);
131
- }
132
- /** Stable compaction error codes returned by compaction helpers. */
133
- export type CompactionErrorCode = "aborted" | "summarization_failed";
134
- /** Error returned by compaction helpers. */
135
- export declare class CompactionError extends Error {
136
- /** Backend-independent error code. */
137
- code: CompactionErrorCode;
138
- constructor(code: CompactionErrorCode, message: string, cause?: Error);
139
- }
140
- /** Stable branch-summary error codes returned by branch summarization helpers. */
141
- export type BranchSummaryErrorCode = "aborted" | "summarization_failed";
142
- /** Error returned by branch summarization helpers. */
143
- export declare class BranchSummaryError extends Error {
144
- /** Backend-independent error code. */
145
- code: BranchSummaryErrorCode;
146
- constructor(code: BranchSummaryErrorCode, message: string, cause?: Error);
147
- }
148
- /** Metadata for one filesystem object in a {@link FileSystem}. */
149
- export interface FileInfo {
150
- /** Basename of {@link path}. */
151
- name: string;
152
- /** Absolute, syntactically normalized addressed path in the execution environment. Symlinks are not followed. */
153
- path: string;
154
- /** Object kind. Symlink targets are not followed; use {@link FileSystem.canonicalPath} explicitly. */
155
- kind: FileKind;
156
- /** Size in bytes for the addressed filesystem object. */
157
- size: number;
158
- /** Modification time as milliseconds since Unix epoch. */
159
- mtimeMs: number;
160
- }
161
- /** One UTF-8 line read from a text file. */
162
- export interface TextLine {
163
- text: string;
164
- /** Whether the line ended with `\n`; callers use this to discard a torn final record. */
165
- terminated: boolean;
166
- }
167
- /** Pull-based UTF-8 line reader that preserves final-line termination. */
168
- export interface TextLineReader {
169
- readLine(context: Context): Promise<Result<TextLine | undefined, FileError>>;
170
- /** Release the open file. Must be best-effort and must not throw or reject. */
171
- close(context: Context): Promise<void>;
172
- }
173
- /**
174
- * Filesystem capability used by the harness.
175
- *
176
- * Paths passed to methods may be absolute or relative to {@link cwd}. Paths returned by file operations are addressed paths
177
- * in the filesystem namespace, but are not canonicalized through symlinks unless returned by {@link canonicalPath}.
178
- *
179
- * Operation methods must never throw or reject. All filesystem failures, including unexpected backend failures, must be
180
- * encoded in the returned {@link Result}. Implementations must preserve this invariant.
181
- */
182
- export interface FileSystem {
183
- /** Current working directory for relative paths. */
184
- cwd: string;
185
- /** Return an absolute addressed path without requiring it to exist and without resolving symlinks. */
186
- absolutePath(path: string, context: Context): Promise<Result<string, FileError>>;
187
- /** Join path segments in the filesystem namespace without requiring the result to exist. */
188
- joinPath(parts: string[], context: Context): Promise<Result<string, FileError>>;
189
- /** Read a UTF-8 text file. */
190
- readTextFile(path: string, context: Context): Promise<Result<string, FileError>>;
191
- /** Open a UTF-8 text file for pull-based line reading. */
192
- openTextLineReader(path: string, context: Context): Promise<Result<TextLineReader, FileError>>;
193
- /** Read UTF-8 text lines. Implementations should stop once `maxLines` lines have been read. */
194
- readTextLines(path: string, options: {
195
- maxLines?: number;
196
- } | undefined, context: Context): Promise<Result<string[], FileError>>;
197
- /** Read a binary file. */
198
- readBinaryFile(path: string, context: Context): Promise<Result<Uint8Array, FileError>>;
199
- /** Create or overwrite a file, creating parent directories when supported. */
200
- writeFile(path: string, content: string | Uint8Array, context: Context): Promise<Result<void, FileError>>;
201
- /** Create or append to a file, creating parent directories when supported. */
202
- appendFile(path: string, content: string | Uint8Array, context: Context): Promise<Result<void, FileError>>;
203
- /** Atomically rename a file, replacing the destination when it exists. Does not copy across filesystems. */
204
- renameFile(sourcePath: string, destinationPath: string, context: Context): Promise<Result<void, FileError>>;
205
- /** Return metadata for the addressed path without following symlinks. */
206
- fileInfo(path: string, context: Context): Promise<Result<FileInfo, FileError>>;
207
- /** List direct children of a directory without following symlinks. */
208
- listDir(path: string, context: Context): Promise<Result<FileInfo[], FileError>>;
209
- /** Return the canonical path for an existing path, resolving symlinks where supported. */
210
- canonicalPath(path: string, context: Context): Promise<Result<string, FileError>>;
211
- /** Return false for missing paths. Other errors, such as permission failures, return a {@link FileError}. */
212
- exists(path: string, context: Context): Promise<Result<boolean, FileError>>;
213
- /** Create a directory. Defaults to `recursive: true`. */
214
- createDir(path: string, options: {
215
- recursive?: boolean;
216
- } | undefined, context: Context): Promise<Result<void, FileError>>;
217
- /** Remove a file or directory. Defaults to `recursive: false` and `force: false`. */
218
- remove(path: string, options: {
219
- recursive?: boolean;
220
- force?: boolean;
221
- } | undefined, context: Context): Promise<Result<void, FileError>>;
222
- /** Create a temporary directory and return its absolute path. Defaults to `prefix: "tmp-"`. */
223
- createTempDir(prefix: string | undefined, context: Context): Promise<Result<string, FileError>>;
224
- /** Create a temporary file and return its absolute path. Defaults to `prefix: ""` and `suffix: ""`. */
225
- createTempFile(options: {
226
- prefix?: string;
227
- suffix?: string;
228
- } | undefined, context: Context): Promise<Result<string, FileError>>;
229
- /** Release filesystem resources. Must be best-effort and must not throw or reject. */
230
- cleanup(context: Context): Promise<void>;
231
- }
232
- /** Which portion of bounded output survives after the limit is crossed. */
233
- export type ShellOutputRetention = "head" | "tail";
234
- /** Source-side limits for one combined shell output view. */
235
- export interface ShellOutputLimits {
236
- maxBytes: number;
237
- maxLines: number;
238
- /** Defaults to `"tail"`. */
239
- retain?: ShellOutputRetention;
240
- }
241
- /** Bounded shell capture requested by the caller. */
242
- export interface ShellOutputCaptureOptions {
243
- limits: ShellOutputLimits;
244
- /** Preserve complete output in an execution-environment-local file after the limits are crossed. */
245
- spill?: boolean;
246
- }
247
- /** Truncation metadata without a duplicate copy of the retained text. */
248
- export type ShellOutputTruncation = Omit<TruncationResult, "content">;
249
- /** Metadata accompanying a bounded shell output view. */
250
- export interface ShellOutputMetadata {
251
- truncation: ShellOutputTruncation;
252
- spillPath?: string;
253
- lastLineBytes?: number;
254
- }
255
- /** Complete bounded shell output view. */
256
- export interface ShellOutputView extends ShellOutputMetadata {
257
- text: string;
258
- }
259
- /** Incremental source-side change to one bounded shell output view. */
260
- export type ShellOutputUpdate = {
261
- kind: "replace";
262
- output: ShellOutputView;
263
- } | {
264
- kind: "append";
265
- text: string;
266
- metadata: ShellOutputMetadata;
267
- } | {
268
- kind: "slide";
269
- drop: number;
270
- text: string;
271
- metadata: ShellOutputMetadata;
272
- } | {
273
- kind: "metadata";
274
- metadata: ShellOutputMetadata;
275
- };
276
- /** Bounded shell completion. Output text is delivered through {@link ShellExecOptions.onUpdate}. */
277
- export interface ShellExecResult extends ShellOutputMetadata {
278
- exitCode: number;
279
- }
280
- /** Options for {@link Shell.exec}. */
281
- export interface ShellExecOptions {
282
- /** Working directory for the command. Relative paths are resolved against {@link ExecutionEnv.cwd}. Defaults to {@link ExecutionEnv.cwd}. */
283
- cwd?: string;
284
- /** Environment variables for the command. Values override inherited defaults when `inheritEnv` is true. */
285
- env?: Record<string, string>;
286
- /** Whether to inherit the execution environment's default variables. Defaults to true. */
287
- inheritEnv?: boolean;
288
- /** Timeout in seconds. Implementations should return a timeout error when the command exceeds this duration. Defaults to no timeout. */
289
- timeout?: number;
290
- /** Source-side bounded capture. Output is discarded when this and `onUpdate` are both absent. */
291
- capture?: ShellOutputCaptureOptions;
292
- /** Called with bounded output changes. */
293
- onUpdate?: (update: ShellOutputUpdate, context: Context) => void;
294
- }
295
- /** Shell execution capability used by the harness. */
296
- export interface Shell {
297
- /** Execute a shell command in {@link FileSystem.cwd} unless `options.cwd` is provided. */
298
- exec(command: string, options: ShellExecOptions | undefined, context: Context): Promise<Result<ShellExecResult, ExecutionError>>;
299
- /** Release shell resources. Must be best-effort and must not throw or reject. */
300
- cleanup(context: Context): Promise<void>;
301
- }
302
- /** Filesystem and process execution environment used by the harness. */
303
- export interface ExecutionEnv extends FileSystem, Shell {
304
- }
305
- //# sourceMappingURL=types.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/harness/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAChE,OAAO,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAC/C,OAAO,KAAK,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAC9D,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAC5C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AACp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AE,OAAO,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,mBAAmB,CAAA;CAAE,GAC5E;IAAE,IAAI,EAAE,UAAU,CAAC;IAAC,QAAQ,EAAE,mBAAmB,CAAA;CAAE,CAAC;AAEvD,oGAAoG;AACpG,MAAM,WAAW,eAAgB,SAAQ,mBAAmB;IAC3D,QAAQ,EAAE,MAAM,CAAC;CACjB;AAED,sCAAsC;AACtC,MAAM,WAAW,gBAAgB;IAChC,6IAA6I;IAC7I,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,2GAA2G;IAC3G,GAAG,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC7B,0FAA0F;IAC1F,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,wIAAwI;IACxI,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,iGAAiG;IACjG,OAAO,CAAC,EAAE,yBAAyB,CAAC;IACpC,0CAA0C;IAC1C,QAAQ,CAAC,EAAE,CAAC,MAAM,EAAE,iBAAiB,EAAE,OAAO,EAAE,OAAO,KAAK,IAAI,CAAC;CACjE;AAED,sDAAsD;AACtD,MAAM,WAAW,KAAK;IACrB,0FAA0F;IAC1F,IAAI,CACH,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,gBAAgB,GAAG,SAAS,EACrC,OAAO,EAAE,OAAO,GACd,OAAO,CAAC,MAAM,CAAC,eAAe,EAAE,cAAc,CAAC,CAAC,CAAC;IACpD,iFAAiF;IACjF,OAAO,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CACzC;AAED,wEAAwE;AACxE,MAAM,WAAW,YAAa,SAAQ,UAAU,EAAE,KAAK;CAAG"}
@@ -1,75 +0,0 @@
1
- /** Create a successful {@link Result}. */
2
- export function ok(value) {
3
- return { ok: true, value };
4
- }
5
- /** Create a failed {@link Result}. */
6
- export function err(error) {
7
- return { ok: false, error };
8
- }
9
- /** Return the success value or throw the failure error. Intended for tests and explicit adapter boundaries. */
10
- export function getOrThrow(result) {
11
- if (!result.ok)
12
- throw result.error;
13
- return result.value;
14
- }
15
- /** Return the success value or `undefined`. Only object values are allowed to avoid truthiness bugs with primitives. */
16
- export function getOrUndefined(result) {
17
- return result.ok ? result.value : undefined;
18
- }
19
- /** Normalize unknown thrown values into Error instances before using them as typed error causes. */
20
- export function toError(error) {
21
- if (error instanceof Error)
22
- return error;
23
- if (typeof error === "string")
24
- return new Error(error);
25
- try {
26
- return new Error(JSON.stringify(error));
27
- }
28
- catch {
29
- return new Error(String(error));
30
- }
31
- }
32
- /** Error returned by {@link FileSystem} file operations. */
33
- export class FileError extends Error {
34
- /** Backend-independent error code. */
35
- code;
36
- /** Absolute addressed path associated with the failure, when available. */
37
- path;
38
- constructor(code, message, path, cause) {
39
- super(message, cause === undefined ? undefined : { cause });
40
- this.name = "FileError";
41
- this.code = code;
42
- this.path = path;
43
- }
44
- }
45
- /** Error returned by {@link ExecutionEnv.exec}. */
46
- export class ExecutionError extends Error {
47
- /** Backend-independent error code. */
48
- code;
49
- constructor(code, message, cause) {
50
- super(message, cause === undefined ? undefined : { cause });
51
- this.name = "ExecutionError";
52
- this.code = code;
53
- }
54
- }
55
- /** Error returned by compaction helpers. */
56
- export class CompactionError extends Error {
57
- /** Backend-independent error code. */
58
- code;
59
- constructor(code, message, cause) {
60
- super(message, cause === undefined ? undefined : { cause });
61
- this.name = "CompactionError";
62
- this.code = code;
63
- }
64
- }
65
- /** Error returned by branch summarization helpers. */
66
- export class BranchSummaryError extends Error {
67
- /** Backend-independent error code. */
68
- code;
69
- constructor(code, message, cause) {
70
- super(message, cause === undefined ? undefined : { cause });
71
- this.name = "BranchSummaryError";
72
- this.code = code;
73
- }
74
- }
75
- //# sourceMappingURL=types.js.map