@parcha/agentrun-serve 0.1.0-beta.32 → 0.1.0-beta.34

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 (444) hide show
  1. package/CHANGELOG.md +270 -0
  2. package/README.md +343 -246
  3. package/dist/adapters.d.ts +0 -7
  4. package/dist/adapters.js +11 -22
  5. package/dist/agent-rows.d.ts +98 -0
  6. package/dist/agent-rows.js +1 -0
  7. package/dist/agents-store.d.ts +6 -2
  8. package/dist/agents-store.js +60 -25
  9. package/dist/agents.d.ts +9 -125
  10. package/dist/agents.js +15 -305
  11. package/dist/answer-json.d.ts +23 -0
  12. package/dist/answer-json.js +58 -0
  13. package/dist/api-only.d.ts +14 -0
  14. package/dist/api-only.js +33 -0
  15. package/dist/archil-routes.d.ts +1 -1
  16. package/dist/bash-read-only.d.ts +22 -0
  17. package/dist/bash-read-only.js +701 -0
  18. package/dist/box-egress-vm.d.ts +0 -8
  19. package/dist/box-egress-vm.js +0 -10
  20. package/dist/box-egress.d.ts +0 -4
  21. package/dist/box-egress.js +1 -16
  22. package/dist/box-paths.d.ts +25 -2
  23. package/dist/box-paths.js +79 -11
  24. package/dist/box-relay.d.ts +0 -11
  25. package/dist/box-relay.js +0 -20
  26. package/dist/box-settings.d.ts +26 -0
  27. package/dist/box-settings.js +63 -0
  28. package/dist/boxes.d.ts +21 -1
  29. package/dist/boxes.js +27 -20
  30. package/dist/browser-commands.d.ts +5 -2
  31. package/dist/browser-commands.js +4 -4
  32. package/dist/browser-computer.d.ts +5 -0
  33. package/dist/browser-computer.js +21 -0
  34. package/dist/browser-cost.d.ts +9 -6
  35. package/dist/browser-cost.js +94 -51
  36. package/dist/browser-live.d.ts +7 -20
  37. package/dist/browser-live.js +15 -93
  38. package/dist/browser-person.d.ts +18 -53
  39. package/dist/browser-person.js +94 -279
  40. package/dist/budget.d.ts +0 -4
  41. package/dist/budget.js +0 -7
  42. package/dist/cap.d.ts +8 -12
  43. package/dist/cap.js +12 -27
  44. package/dist/cli.js +61 -20
  45. package/dist/closed-pipes.d.ts +2 -0
  46. package/dist/closed-pipes.js +13 -0
  47. package/dist/computer-commands.d.ts +2 -0
  48. package/dist/computer-commands.js +2 -0
  49. package/dist/computer-keys.js +5 -2
  50. package/dist/computer-setting.d.ts +20 -4
  51. package/dist/computer-setting.js +25 -5
  52. package/dist/computers.d.ts +31 -3
  53. package/dist/computers.js +70 -11
  54. package/dist/confine.d.ts +120 -0
  55. package/dist/confine.js +436 -0
  56. package/dist/console/assets/index-RPHGlXmM.js +540 -0
  57. package/dist/console/assets/index-opTN5Naq.css +1 -0
  58. package/dist/console/index.html +2 -2
  59. package/dist/daytona-api.d.ts +0 -11
  60. package/dist/daytona-api.js +1 -82
  61. package/dist/decision-rows.d.ts +1 -1
  62. package/dist/decision-rows.js +1 -1
  63. package/dist/docker-daemon.d.ts +31 -0
  64. package/dist/docker-daemon.js +56 -0
  65. package/dist/docker-host-addresses.d.ts +37 -0
  66. package/dist/docker-host-addresses.js +110 -0
  67. package/dist/effort-guidance.js +4 -3
  68. package/dist/environment.d.ts +0 -3
  69. package/dist/environment.js +3 -5
  70. package/dist/errors.d.ts +0 -2
  71. package/dist/errors.js +6 -9
  72. package/dist/filed-answer.d.ts +32 -0
  73. package/dist/filed-answer.js +160 -0
  74. package/dist/files.d.ts +1 -11
  75. package/dist/files.js +2 -21
  76. package/dist/github-connection.d.ts +2 -2
  77. package/dist/github-connection.js +1 -1
  78. package/dist/graph-view.d.ts +3 -5
  79. package/dist/graph-view.js +4 -14
  80. package/dist/handed-values.d.ts +9 -0
  81. package/dist/handed-values.js +26 -0
  82. package/dist/harness-install.d.ts +22 -5
  83. package/dist/harness-install.js +98 -20
  84. package/dist/harness-opencode/adapter.d.ts +7 -0
  85. package/dist/harness-opencode/adapter.js +23 -6
  86. package/dist/harness-opencode/index.d.ts +1 -1
  87. package/dist/harness-opencode/index.js +1 -1
  88. package/dist/harness-opencode/verify.d.ts +17 -0
  89. package/dist/harness-opencode/verify.js +30 -10
  90. package/dist/harness-table.js +6 -1
  91. package/dist/harness.d.ts +4 -3
  92. package/dist/harness.js +16 -1
  93. package/dist/heard.js +1 -1
  94. package/dist/held-fd.d.ts +5 -0
  95. package/dist/held-fd.js +14 -0
  96. package/dist/host-calls.d.ts +20 -0
  97. package/dist/host-calls.js +12 -0
  98. package/dist/host-tools.d.ts +4 -21
  99. package/dist/host-tools.js +4 -61
  100. package/dist/host.d.ts +2 -4
  101. package/dist/host.js +2 -7
  102. package/dist/import-summary.d.ts +1 -5
  103. package/dist/import-summary.js +0 -21
  104. package/dist/import.d.ts +6 -6
  105. package/dist/import.js +62 -24
  106. package/dist/key-refusal.d.ts +5 -1
  107. package/dist/key-refusal.js +19 -4
  108. package/dist/learn/check.d.ts +6 -2
  109. package/dist/learn/check.js +83 -29
  110. package/dist/learn/folder.d.ts +5 -1
  111. package/dist/learn/folder.js +10 -3
  112. package/dist/learn/grade.d.ts +14 -0
  113. package/dist/learn/grade.js +68 -12
  114. package/dist/learn/index.d.ts +4 -4
  115. package/dist/learn/index.js +4 -4
  116. package/dist/learn/reflect.d.ts +31 -2
  117. package/dist/learn/reflect.js +79 -4
  118. package/dist/learn/relevance.d.ts +24 -0
  119. package/dist/learn/relevance.js +91 -0
  120. package/dist/learn/secrets.d.ts +8 -1
  121. package/dist/learn/secrets.js +95 -15
  122. package/dist/learn/skills.d.ts +112 -14
  123. package/dist/learn/skills.js +556 -52
  124. package/dist/learned-workflow.d.ts +37 -5
  125. package/dist/learned-workflow.js +106 -12
  126. package/dist/learning-routes.d.ts +16 -49
  127. package/dist/learning-routes.js +46 -36
  128. package/dist/learning-run.d.ts +6 -250
  129. package/dist/learning-run.js +11 -665
  130. package/dist/learning-words.d.ts +12 -5
  131. package/dist/learning-words.js +18 -9
  132. package/dist/learning.d.ts +93 -77
  133. package/dist/learning.js +176 -304
  134. package/dist/live/stream.js +1 -1
  135. package/dist/live/translate.js +13 -3
  136. package/dist/local-models.d.ts +11 -5
  137. package/dist/local-models.js +13 -8
  138. package/dist/mcp-gateway.d.ts +11 -52
  139. package/dist/mcp-gateway.js +44 -148
  140. package/dist/mcp-oauth.d.ts +10 -14
  141. package/dist/mcp-oauth.js +14 -32
  142. package/dist/mcp-probe.d.ts +0 -7
  143. package/dist/mcp-probe.js +4 -10
  144. package/dist/mcp-servers-store.d.ts +6 -6
  145. package/dist/mcp-servers-store.js +13 -15
  146. package/dist/mcp-store.js +3 -4
  147. package/dist/mcp.js +4 -3
  148. package/dist/model.d.ts +6 -7
  149. package/dist/model.js +43 -27
  150. package/dist/monid.d.ts +0 -2
  151. package/dist/monid.js +3 -6
  152. package/dist/openapi.d.ts +8 -1
  153. package/dist/openapi.js +124 -50
  154. package/dist/page.d.ts +1 -3
  155. package/dist/page.js +9 -19
  156. package/dist/paid-calls.d.ts +21 -27
  157. package/dist/paid-calls.js +28 -62
  158. package/dist/pause.d.ts +0 -2
  159. package/dist/pause.js +1 -8
  160. package/dist/place.d.ts +0 -5
  161. package/dist/place.js +0 -10
  162. package/dist/print.d.ts +2 -1
  163. package/dist/print.js +4 -2
  164. package/dist/propose.js +83 -39
  165. package/dist/push-handler.d.ts +1 -1
  166. package/dist/reflect-range.d.ts +25 -0
  167. package/dist/reflect-range.js +30 -0
  168. package/dist/refusal-words.d.ts +5 -1
  169. package/dist/refusal-words.js +5 -1
  170. package/dist/rows.d.ts +1 -1
  171. package/dist/run-cut.d.ts +0 -6
  172. package/dist/run-cut.js +0 -6
  173. package/dist/run-db.d.ts +2 -13
  174. package/dist/run-db.js +2 -41
  175. package/dist/run-launch.d.ts +19 -2
  176. package/dist/run-launch.js +13 -5
  177. package/dist/run-learning-served.d.ts +46 -2
  178. package/dist/run-learning-served.js +26 -7
  179. package/dist/run-reads-over-store.d.ts +1 -1
  180. package/dist/run-reads-over-store.js +15 -6
  181. package/dist/run-secrets.d.ts +33 -0
  182. package/dist/run-secrets.js +53 -0
  183. package/dist/run-timeline-served.d.ts +5 -1
  184. package/dist/run-timeline-served.js +19 -5
  185. package/dist/run-view.d.ts +12 -17
  186. package/dist/run-view.js +29 -28
  187. package/dist/runnable.d.ts +18 -10
  188. package/dist/runnable.js +21 -10
  189. package/dist/runner/adapter-loop.d.ts +14 -3
  190. package/dist/runner/adapter-loop.js +464 -62
  191. package/dist/runner/adapter-run-spec.d.ts +29 -8
  192. package/dist/runner/adapter-run-spec.js +96 -37
  193. package/dist/runner/adapters/index.js +11 -1
  194. package/dist/runner/adapters/pi.d.ts +15 -1
  195. package/dist/runner/adapters/pi.js +19 -5
  196. package/dist/runner/beside.d.ts +30 -3
  197. package/dist/runner/beside.js +54 -12
  198. package/dist/runner/claim-secrets.d.ts +10 -1
  199. package/dist/runner/claim-secrets.js +49 -15
  200. package/dist/runner/cli-run-spec.d.ts +2 -0
  201. package/dist/runner/cli-run-spec.js +60 -17
  202. package/dist/runner/commands.js +1 -1
  203. package/dist/runner/computer-journal.d.ts +15 -2
  204. package/dist/runner/computer-journal.js +41 -5
  205. package/dist/runner/conformance/harness.js +118 -8
  206. package/dist/runner/conformance/subject.d.ts +4 -1
  207. package/dist/runner/dispatch.d.ts +8 -1
  208. package/dist/runner/dispatch.js +81 -7
  209. package/dist/runner/end-of-run.d.ts +8 -2
  210. package/dist/runner/end-of-run.js +10 -4
  211. package/dist/runner/github-app.js +1 -1
  212. package/dist/runner/harness-loops.d.ts +9 -1
  213. package/dist/runner/harness-loops.js +15 -2
  214. package/dist/runner/journal-kinds.d.ts +30 -6
  215. package/dist/runner/journal-kinds.js +20 -5
  216. package/dist/runner/journal-reader.d.ts +1 -1
  217. package/dist/runner/journal-reader.js +2 -2
  218. package/dist/runner/learning-ask.d.ts +4 -0
  219. package/dist/runner/learning-ask.js +15 -1
  220. package/dist/runner/learning-end.d.ts +18 -3
  221. package/dist/runner/learning-end.js +113 -11
  222. package/dist/runner/learning-loop.d.ts +5 -0
  223. package/dist/runner/learning-loop.js +26 -6
  224. package/dist/runner/live-ticker.d.ts +1 -1
  225. package/dist/runner/live-ticker.js +28 -4
  226. package/dist/runner/loop-contract.d.ts +3 -2
  227. package/dist/runner/main.d.ts +64 -10
  228. package/dist/runner/main.js +165 -27
  229. package/dist/runner/mcp-claim.d.ts +1 -1
  230. package/dist/runner/mcp-claim.js +2 -3
  231. package/dist/runner/mcp-run.d.ts +2 -0
  232. package/dist/runner/mcp-run.js +15 -5
  233. package/dist/runner/memory-claim.d.ts +9 -0
  234. package/dist/runner/memory-claim.js +25 -0
  235. package/dist/runner/metrics.d.ts +33 -1
  236. package/dist/runner/metrics.js +85 -1
  237. package/dist/runner/model-route.d.ts +13 -0
  238. package/dist/runner/model-route.js +154 -11
  239. package/dist/runner/redact.d.ts +8 -2
  240. package/dist/runner/redact.js +11 -2
  241. package/dist/runner/reflect-hook.d.ts +12 -1
  242. package/dist/runner/reflect-hook.js +33 -3
  243. package/dist/runner/runner.d.ts +20 -0
  244. package/dist/runner/runner.js +56 -10
  245. package/dist/runner/store-port.d.ts +1 -1
  246. package/dist/runner/store-secrets.d.ts +3 -3
  247. package/dist/runner/store-secrets.js +8 -12
  248. package/dist/runner/text-tools.d.ts +44 -0
  249. package/dist/runner/text-tools.js +237 -0
  250. package/dist/runner/workflow-loop.d.ts +6 -0
  251. package/dist/runner/workflow-loop.js +6 -4
  252. package/dist/runner/workflow-spec.d.ts +18 -0
  253. package/dist/runner/workflow-spec.js +68 -26
  254. package/dist/runs-over-store.d.ts +8 -3
  255. package/dist/runs-over-store.js +76 -19
  256. package/dist/seal-key.d.ts +54 -15
  257. package/dist/seal-key.js +232 -82
  258. package/dist/sealed-settings-store.d.ts +19 -4
  259. package/dist/sealed-settings-store.js +9 -9
  260. package/dist/sealing.d.ts +4 -0
  261. package/dist/sealing.js +20 -0
  262. package/dist/secret-cut.d.ts +1 -1
  263. package/dist/secret-cut.js +1 -1
  264. package/dist/secret-name.d.ts +9 -0
  265. package/dist/secret-name.js +15 -0
  266. package/dist/secret-writes.d.ts +0 -1
  267. package/dist/secret-writes.js +0 -1
  268. package/dist/secrets.d.ts +2 -10
  269. package/dist/secrets.js +21 -17
  270. package/dist/server-fs.d.ts +4 -0
  271. package/dist/server-fs.js +8 -2
  272. package/dist/server-lock.d.ts +0 -24
  273. package/dist/server-lock.js +1 -80
  274. package/dist/server-secrets-store.d.ts +4 -4
  275. package/dist/server-secrets-store.js +10 -32
  276. package/dist/server-secrets.d.ts +4 -9
  277. package/dist/server-secrets.js +12 -33
  278. package/dist/server.d.ts +26 -44
  279. package/dist/server.js +229 -142
  280. package/dist/sign-ins-store.d.ts +34 -36
  281. package/dist/sign-ins-store.js +27 -38
  282. package/dist/sign-ins.d.ts +2 -119
  283. package/dist/sign-ins.js +5 -311
  284. package/dist/standard-webhooks.d.ts +1 -1
  285. package/dist/standard-webhooks.js +1 -1
  286. package/dist/stats.d.ts +3 -2
  287. package/dist/stats.js +1 -1
  288. package/dist/store/agent-body.d.ts +8 -2
  289. package/dist/store/agent-body.js +16 -4
  290. package/dist/store/index.d.ts +3 -3
  291. package/dist/store/index.js +3 -3
  292. package/dist/store/open.d.ts +18 -5
  293. package/dist/store/open.js +23 -3
  294. package/dist/store/postgres/connection.d.ts +18 -2
  295. package/dist/store/postgres/connection.js +156 -32
  296. package/dist/store/postgres/migrate.d.ts +4 -0
  297. package/dist/store/postgres/migrate.js +27 -3
  298. package/dist/store/postgres/migrations/0003_commands_one_answer.check.sql +19 -0
  299. package/dist/store/postgres/migrations/0003_commands_one_answer.sql +13 -0
  300. package/dist/store/postgres/store.d.ts +9 -2
  301. package/dist/store/postgres/store.js +9 -0
  302. package/dist/store/schema.js +1 -1
  303. package/dist/store/seal.js +2 -2
  304. package/dist/store/sqlite/connection.js +49 -5
  305. package/dist/store/sqlite/run-patch.d.ts +3 -0
  306. package/dist/store/sqlite/run-patch.js +3 -0
  307. package/dist/store/sqlite/store.js +64 -20
  308. package/dist/store/store.d.ts +38 -6
  309. package/dist/store/store.js +12 -2
  310. package/dist/store-reads/cap.d.ts +1 -1
  311. package/dist/store-reads/cap.js +22 -4
  312. package/dist/store-reads/journal.d.ts +25 -6
  313. package/dist/store-reads/journal.js +173 -21
  314. package/dist/store-reads/learning.d.ts +26 -8
  315. package/dist/store-reads/learning.js +12 -4
  316. package/dist/store-reads/workflow.d.ts +1 -1
  317. package/dist/store-reads/workflow.js +1 -1
  318. package/dist/store-view.d.ts +5 -1
  319. package/dist/store-view.js +91 -23
  320. package/dist/template-eval.d.ts +60 -4
  321. package/dist/template-eval.js +120 -54
  322. package/dist/templates.d.ts +24 -10
  323. package/dist/templates.js +69 -38
  324. package/dist/timeline/group.d.ts +33 -0
  325. package/dist/timeline/group.js +77 -0
  326. package/dist/timeline/index.d.ts +7 -0
  327. package/dist/timeline/index.js +7 -0
  328. package/dist/timeline/labels.d.ts +79 -0
  329. package/dist/timeline/labels.js +150 -0
  330. package/dist/timeline/origin.d.ts +56 -0
  331. package/dist/timeline/origin.js +92 -0
  332. package/dist/timeline/render-text.d.ts +11 -0
  333. package/dist/timeline/render-text.js +62 -0
  334. package/dist/timeline/timeline.d.ts +274 -0
  335. package/dist/timeline/timeline.js +1308 -0
  336. package/dist/timeline/util.d.ts +17 -0
  337. package/dist/timeline/util.js +49 -0
  338. package/dist/tool-gate.d.ts +41 -216
  339. package/dist/tool-gate.js +79 -540
  340. package/dist/tool-keys-store.d.ts +11 -12
  341. package/dist/tool-keys-store.js +24 -31
  342. package/dist/tool-keys.d.ts +9 -104
  343. package/dist/tool-keys.js +15 -271
  344. package/dist/tool-plane.d.ts +14 -42
  345. package/dist/tool-plane.js +23 -81
  346. package/dist/tool-settings-store.d.ts +1 -2
  347. package/dist/tool-settings-store.js +5 -8
  348. package/dist/tools.d.ts +31 -19
  349. package/dist/tools.js +101 -108
  350. package/dist/trigger-adapter.d.ts +2 -2
  351. package/dist/trigger-schedule.js +2 -1
  352. package/dist/trigger-secrets-shown.js +5 -1
  353. package/dist/trigger-targets.d.ts +13 -1
  354. package/dist/trigger-targets.js +31 -1
  355. package/dist/triggers.d.ts +2 -2
  356. package/dist/triggers.js +3 -3
  357. package/dist/turn-end.d.ts +1 -1
  358. package/dist/turn-end.js +1 -1
  359. package/dist/turns.d.ts +0 -6
  360. package/dist/turns.js +0 -19
  361. package/dist/uploads.js +1 -1
  362. package/dist/usage.d.ts +0 -2
  363. package/dist/usage.js +0 -2
  364. package/dist/validate.d.ts +2 -0
  365. package/dist/validate.js +23 -14
  366. package/dist/webhooks.d.ts +102 -76
  367. package/dist/webhooks.js +266 -233
  368. package/dist/workflow-run.d.ts +114 -0
  369. package/dist/workflow-run.js +144 -0
  370. package/dist/workspace/beneath.d.ts +19 -0
  371. package/dist/workspace/beneath.js +106 -0
  372. package/dist/workspace/computer-deps.d.ts +52 -5
  373. package/dist/workspace/computer-deps.js +154 -19
  374. package/dist/workspace/computer-for-claim.d.ts +19 -14
  375. package/dist/workspace/computer-for-claim.js +77 -16
  376. package/dist/workspace/computer-hold.d.ts +6 -1
  377. package/dist/workspace/computer-hold.js +6 -1
  378. package/dist/workspace/computer-janitor.d.ts +47 -0
  379. package/dist/workspace/computer-janitor.js +182 -0
  380. package/dist/workspace/computer-providers.d.ts +6 -2
  381. package/dist/workspace/computer-providers.js +1 -1
  382. package/dist/workspace/grep-worker.d.ts +5 -0
  383. package/dist/workspace/grep-worker.js +9 -6
  384. package/dist/workspace/index.d.ts +4 -3
  385. package/dist/workspace/index.js +4 -4
  386. package/dist/workspace/local.d.ts +11 -2
  387. package/dist/workspace/local.js +161 -43
  388. package/dist/workspace/resolve-computer.d.ts +50 -10
  389. package/dist/workspace/resolve-computer.js +46 -11
  390. package/dist/workspace/run-tools.d.ts +13 -31
  391. package/dist/workspace/run-tools.js +10 -27
  392. package/dist/workspace-paths.d.ts +0 -17
  393. package/dist/workspace-paths.js +1 -41
  394. package/dist/workspace.d.ts +0 -17
  395. package/dist/workspace.js +3 -99
  396. package/launcher/agentrun-serve +6 -33
  397. package/package.json +14 -14
  398. package/templates/README.md +9 -3
  399. package/templates/inbound-lead/agent.md +1 -1
  400. package/templates/kyb/agent.md +1 -1
  401. package/templates/market-monitor/agent.md +2 -2
  402. package/templates/market-monitor/skills/monitor/SKILL.md +6 -4
  403. package/dist/app.d.ts +0 -5
  404. package/dist/app.js +0 -514
  405. package/dist/bound-files.d.ts +0 -4
  406. package/dist/bound-files.js +0 -164
  407. package/dist/bounds.d.ts +0 -26
  408. package/dist/bounds.js +0 -137
  409. package/dist/coding-tools.d.ts +0 -47
  410. package/dist/coding-tools.js +0 -189
  411. package/dist/computer-adb.d.ts +0 -12
  412. package/dist/computer-adb.js +0 -14
  413. package/dist/console/assets/index-35-7aeIZ.js +0 -519
  414. package/dist/console/assets/index-Cejbov-Y.css +0 -1
  415. package/dist/content-filter.d.ts +0 -7
  416. package/dist/content-filter.js +0 -23
  417. package/dist/disk.d.ts +0 -33
  418. package/dist/disk.js +0 -85
  419. package/dist/door-line.d.ts +0 -23
  420. package/dist/door-line.js +0 -83
  421. package/dist/grade.d.ts +0 -63
  422. package/dist/grade.js +0 -150
  423. package/dist/harness-app.d.ts +0 -69
  424. package/dist/harness-app.js +0 -1162
  425. package/dist/mcp-servers.d.ts +0 -269
  426. package/dist/mcp-servers.js +0 -456
  427. package/dist/packs.d.ts +0 -71
  428. package/dist/packs.js +0 -180
  429. package/dist/request-start.d.ts +0 -27
  430. package/dist/request-start.js +0 -381
  431. package/dist/run-box.d.ts +0 -205
  432. package/dist/run-box.js +0 -661
  433. package/dist/run-holder.d.ts +0 -52
  434. package/dist/run-holder.js +0 -139
  435. package/dist/runs.d.ts +0 -1200
  436. package/dist/runs.js +0 -4103
  437. package/dist/sealed-settings.d.ts +0 -60
  438. package/dist/sealed-settings.js +0 -178
  439. package/dist/served-only.d.ts +0 -5
  440. package/dist/served-only.js +0 -12
  441. package/dist/sessions.d.ts +0 -6
  442. package/dist/sessions.js +0 -109
  443. package/dist/workspace/computer-serves.d.ts +0 -12
  444. package/dist/workspace/computer-serves.js +0 -15
@@ -1,36 +1,9 @@
1
- import { type AnalyticsFilter, type Revision, type RunRow, type StartedRun } from "@parcha/pi-durable-agent";
2
- import type { TimelineEvent } from "@parcha/pi-durable-agent/timeline";
3
- import { type Learning, type NoteRuns, type LearningReason, type LearningState, type Shown } from "./learning.js";
4
- import type { Run, RunsOptions, Status } from "./runs.js";
5
- import { type NoteFiles } from "./usage.js";
6
- import { type Json } from "./validate.js";
7
- /** A run's end-of-run turn: the job's outcome, the newest store entry before the turn and, once the run ended, the newest
8
- * after it (its rows are those between), its deadline, and how it ended. */
9
- export type Reflect = {
10
- outcome: Status;
11
- after: number;
12
- until?: number;
13
- deadline: string;
14
- ended?: true;
15
- timedOut?: true;
16
- };
17
- /** Who sent the end-of-run turn: the server, never a person, and no request field sets it. The one value it is sent
18
- * with, at its one call (reflectTurn); the tool gate reads it there and refuses that turn's writes under work/.learning/ (tool-gate.ts NOTE_ONLY_TEXT). */
19
- declare const REFLECT_ORIGIN = "reflect";
20
- export type TurnOrigin = typeof REFLECT_ORIGIN;
21
- /** The run asked its end-of-run turn and has not ended since. */
22
- export declare const reflecting: (run: {
23
- meta: {
24
- reflect?: Reflect;
25
- };
26
- }) => boolean;
27
- /** Whether entry `id` (a number), or the row `id`, is the end-of-run turn's. Before the run has ended every later entry
28
- * is, and so is a live row. */
29
- export declare function reflects(reflect: Reflect | undefined, id: string | number): boolean;
30
- /** `rows` with the end-of-run turn's labelled: never the run's answer (meaningful skips the label), its answer shown as
31
- * a text row, and its message as the host's, in a person's words (learning-words.ts): what the model is asked stays in
32
- * the run's store, and no row shows it. */
33
- export declare function labelled(reflect: Reflect | undefined, rows: TimelineEvent[]): TimelineEvent[];
1
+ import type { RunRow } from "./agent-rows.js";
2
+ import type { AnalyticsFilter } from "./store-reads/analytics.js";
3
+ import type { TimelineEvent } from "./timeline/index.js";
4
+ import { type Learning, type NoteRuns, type Shown } from "./learning.js";
5
+ import { type Reflect } from "./reflect-range.js";
6
+ import type { NoteFiles } from "./usage.js";
34
7
  /** The files of the run's copy of the folder its job read, in the order it first read them, each once: every `read`
35
8
  * call whose result came back a success, matched to its call by id (claude-agent's rows can hold the result above the
36
9
  * call), on any harness: pi's, claude-agent's (the host's `read`, served to its CLI as `mcp__hands__read`) and codex's
@@ -94,220 +67,3 @@ export type ImpactLearning = {
94
67
  * An imported or archived run is on neither side, nor is a later one with learning off or seeded with no note (every
95
68
  * note retired), nor one whose learning predates these figures. Null unless both sides hold 2 runs or more. */
96
69
  export declare function learningImpact(rows: readonly RunRow[], learningOf: (row: RunRow) => ImpactLearning | null | undefined): Impact;
97
- /** What learning needs of the server's options: the data directory and the agents, its tokens, the switch, and its bounds. */
98
- export type LearningOptions = Pick<RunsOptions, "agents" | "token" | "doorToken" | "storedKeys" | "serverSecrets" | "learning" | "learningBudget" | "reflectTimeoutMs">;
99
- /** What the kernel (runs.ts) hands learning: its runs, and the parts of a run's life learning moves. */
100
- export type LearningKernel = {
101
- /** Run `id` when the kernel holds it; read from the agent store the first time (`get`). */
102
- held(id: string): Run | undefined;
103
- get(id: string): Promise<Run | null>;
104
- /** Whether the run's process lives. */
105
- live(run: Run): boolean;
106
- /** One request to a live run's door, never waking it, with who sent a turn it sends; one to its door, waking it. */
107
- toLiveDoor(run: Run, path: string, body?: Json, turnOrigin?: TurnOrigin): Promise<Json | null>;
108
- toDoor(run: Run, path: string, body: Json): Promise<unknown>;
109
- /** The run's turn aborted; its process let go (SIGTERM). */
110
- abortTurn(run: Run): Promise<void>;
111
- terminate(run: Run): void;
112
- /** Its status as one more change; its rows, as served, again. */
113
- mark(run: Run): void;
114
- show(run: Run): void;
115
- /** Its serve.json written, in turn (onSaved follows). */
116
- save(run: Run): Promise<void>;
117
- /** A run's cost from its rows: null when unknown. */
118
- costOf(rows: readonly TimelineEvent[]): number | null;
119
- /** The test hooks startServe's options name, as a run's process gets them. */
120
- fauxEnv(): NodeJS.ProcessEnv;
121
- };
122
- /** The learning of every run the kernel holds, from the end-of-run turn to the merge. */
123
- export declare class LearningRuns {
124
- private readonly options;
125
- private readonly kernel;
126
- /** The secrets each launch of a run that learns handed its process (runs.ts launch()), by run id, so a key a person
127
- * replaced or deleted while the run lived is still refused in what its end-of-run turn wrote. In memory only, never on
128
- * disk: a server that restarts loses them, and the run's next launch hands it the keys as they are then, which the
129
- * check reads too. Dropped once the run's learning ends, and when the server closes. */
130
- private readonly handed;
131
- /** Aborted as the server closes: no check starts after it. */
132
- private readonly stopping;
133
- /** The runs whose learning's end is in the learning ledger (usage.ts), each with the files its lines say it was given
134
- * and read (filesKey): read at the start, and each one written since. */
135
- private readonly recorded;
136
- /** By run: what its end-of-run turn wrote, being checked (proposeOnce). */
137
- private readonly proposing;
138
- /** The host's secrets as shown() last cut them, by their values, and the saved keys it read. */
139
- private cut?;
140
- private saved?;
141
- constructor(options: LearningOptions, kernel: LearningKernel);
142
- private get closing();
143
- /** A run of `revision` about to be made for agent `agentId`. It learns when the server's switch (`--learning`) is on and
144
- * its agent's definition says `learning: true`; then its seed is read now, before the run is made, so the folder is
145
- * read once whatever the run's setup does, and what comes back pins it in the run once it is made and its input
146
- * saved (a server that goes down during the copy leaves no learning saved: onLoad), at `at`: its
147
- * learning, `seeded`, or `dropped` as `seed_failed` (a learning fault never refuses a run). Undefined when it does
148
- * not learn. What the run reads under `# Learned` is its notes within the server's learning budget, told of
149
- * `.learning/` only when its agent has the read tool, and cut of the host's secrets as they are then. */
150
- onStart(agentId: string, revision: Revision): Promise<((started: Pick<StartedRun, "runId" | "dir" | "workspace">, at: string) => Promise<Learning>) | undefined>;
151
- /** A start whose seed copy threw out of its pin (runs.ts start): its learning, in its own words, as a copy that failed
152
- * says it; the copy taken back. */
153
- copyThrew(started: Pick<StartedRun, "runId" | "dir" | "workspace">, at: string, error: unknown): Promise<Learning>;
154
- /** The run's serve.json holds `learning` now: the learning ledger's line for the run (usage.ts), once, when that
155
- * learning has ended; after it, a `notes` line each time the notes it was given or read are no longer what the
156
- * ledger says (a follow-up read another note), which counts neither the run nor its costs again. Never rejects: a
157
- * line not written is written by the next save, or by the next start's pass. */
158
- onSaved(run: Pick<Run, "id" | "agentId">, learning: Learning | null | undefined): Promise<void>;
159
- /** The run's job ended with `end`. True when its end-of-run turn is asked first: the run is finishing with that
160
- * outcome, and is let go once the turn ends. False when it is let go now, its learning dropped when it skips the turn. */
161
- beforeFinish(run: Run, end: {
162
- outcome: Status;
163
- error?: Run["error"];
164
- abort?: boolean;
165
- }): boolean;
166
- /** A run read at a start, before the kernel holds it, `save` writing its serve.json: one a server went down while it
167
- * copied the run's seed (running, its input saved and no learning, and a pin or a `work/.learning/` there) has both
168
- * taken back, so it starts again with nothing learned, and its learning dropped as `seed_failed`, saved before the
169
- * ledger's line (onSaved). Called before anything reads the run: its relaunch, a settle, a follow-up. A seed_failed
170
- * run asks no end-of-run turn (reflectSkip). A copy that never began leaves nothing, and the learning stays null. */
171
- onLoad(row: Pick<RunRow, "id" | "agent" | "state">, dir: string, meta: Run["meta"], save: () => Promise<void>): Promise<void>;
172
- /** A run's process launched, handed the secrets named `names`: what each held then, as handover read it, kept beside
173
- * the run while its learning is under way (a key replaced since stays refused in its notes). */
174
- onLaunch(run: Run, names: readonly string[], also?: readonly string[]): void;
175
- /** A running run read at a start, `live` when its process serves it still. One a server left while its end-of-run turn
176
- * ran is finishing with its job's outcome, and nothing opens it again; when its process lives, the turn is asked again
177
- * under the same request id, which it takes once, and waited for. */
178
- onAdopt(run: Run, live: boolean): void;
179
- /** The run's end being written: its end-of-run turn's rows closed, and its learning settled from how the turn went;
180
- * then what the turn answered, and what the user said in the run, kept in its directory before the run reads ended,
181
- * so a follow-up that opens it again never changes what is checked. */
182
- beforeSettle(run: Run, outcome: Status): Promise<void>;
183
- /** The run's end written, as it would be without learning: what its end-of-run turn wrote checked, and kept as its
184
- * proposal or dropped. Called only then, so a slow or failing check never holds the job. A proposal is graded and
185
- * merged by the runner's built-in learning run (runner/learning-loop.ts), never here. */
186
- afterSettle(run: Run): Promise<void>;
187
- /** A run that learns, opened again for a follow-up, before its process starts: `work/.learning/` laid again from its
188
- * seed where the run took it away, so the follow-up finds the notes its instructions name where they say, and the
189
- * learned skills its pin names laid again, fresh, so its process reads each where it was. A fault leaves it without. */
190
- onReopen(run: Run): Promise<void>;
191
- /** Its process launched again for the follow-up: an end-of-run turn its process went in would resume with the run, so
192
- * it is aborted before the follow-up is sent. One that cannot be aborted runs out ahead of it, and its rows are never
193
- * the follow-up's answer, which comes after them. */
194
- afterReopen(run: Run): Promise<void>;
195
- /** The server's start: the learning ledger read from now, beside the running runs' pass, never before it (a line
196
- * written twice meanwhile is read once). What comes back takes every run once that pass is done: each ended run whose
197
- * learning a server left between steps, what its end-of-run turn wrote not checked yet, is checked now, once; a
198
- * learning end saved and not in the ledger (a server that went between the two) is written there. */
199
- recover(): (rows: readonly RunRow[]) => Promise<void>;
200
- /** The server closing: nothing new starts. */
201
- close(): void;
202
- /** Once every run has settled: each check in flight ended. */
203
- idle(): Promise<void>;
204
- /** A held run's learning, in short, from memory (null when it does not learn); undefined for a run the kernel does not
205
- * hold. For a count, which reads the rest from the learning ledger and never a run's files. */
206
- heldLearning(runId: string): {
207
- state: LearningState;
208
- reason: LearningReason | null;
209
- } | null | undefined;
210
- /** The secrets this server never shows as they are now (serverSecrets), as a reader cuts them (secretsShown), as the
211
- * learning routes cut them. Built again only once they change. Every run's view and every row of a list asks it, so
212
- * the saved keys, which are read from their file and opened one by one, are read once and kept until a person saves
213
- * or deletes one (keysChanged); the rest is read each time. */
214
- shown(): Shown;
215
- /** A key was saved on this server or deleted from it: the next view reads them again. */
216
- keysChanged(): void;
217
- /** Agent `agentId`'s run's `learning` as it reads now (learning.ts currentLearning): what it held for its owner's OK
218
- * checked against the folder's main (learning-routes.ts statusesOf, one read per commit of main). Its record stays as
219
- * the merge wrote it; one that held nothing is read as it is, with no read of the folder. */
220
- current(agentId: string, learning: Learning | undefined): Promise<Learning | undefined>;
221
- /** `rows` with their learning row as it reads now (current): its words from what it held, checked against main. */
222
- rowsNow(agentId: string, learning: Learning | undefined, rows: readonly TimelineEvent[]): Promise<TimelineEvent[]>;
223
- /** A run's learning as its view shows it (learning.ts learningView), cut of the host's secrets now; `settled`, once
224
- * the run has ended and settled, shows the notes it read. */
225
- view(learning: Learning | undefined, settled: boolean): {
226
- given?: import("./learning.js").NoteUsed[];
227
- read?: import("./learning.js").NoteUsed[];
228
- learned?: import("./learning.js").NoteLearned[];
229
- pending?: import("./learning.js").NoteUsed[];
230
- skills?: import("./learning.js").LearnedFile[];
231
- workflows?: import("./learning.js").LearnedFile[];
232
- state: "proposed" | "merged" | "seeded" | "reflecting" | "dropped";
233
- reason: "empty" | "unparsed" | "seed_failed" | "no_budget" | "unknown_cost" | "cancelled" | "crashed" | "reflect_timeout" | "reflect_failed" | "propose_failed" | "checker" | "grader" | "grade_failed" | null;
234
- detail: string | null;
235
- at: string;
236
- } | null;
237
- /** A run's learning as a list shows it (learning.ts shortLearning): from serve.json for a run the kernel does not hold. */
238
- short(learning: Learning | null, settled: boolean): ({
239
- state: "proposed" | "merged" | "seeded" | "reflecting" | "dropped";
240
- reason: "empty" | "unparsed" | "seed_failed" | "no_budget" | "unknown_cost" | "cancelled" | "crashed" | "reflect_timeout" | "reflect_failed" | "propose_failed" | "checker" | "grader" | "grade_failed" | null;
241
- detail: string | null;
242
- } & Omit<{
243
- given?: import("./learning.js").NoteUsed[];
244
- read?: import("./learning.js").NoteUsed[];
245
- learned?: import("./learning.js").NoteLearned[];
246
- pending?: import("./learning.js").NoteUsed[];
247
- skills?: import("./learning.js").LearnedFile[];
248
- workflows?: import("./learning.js").LearnedFile[];
249
- state: "proposed" | "merged" | "seeded" | "reflecting" | "dropped";
250
- reason: "empty" | "unparsed" | "seed_failed" | "no_budget" | "unknown_cost" | "cancelled" | "crashed" | "reflect_timeout" | "reflect_failed" | "propose_failed" | "checker" | "grader" | "grade_failed" | null;
251
- detail: string | null;
252
- at: string;
253
- }, "at" | "reason" | "detail" | "state">) | null;
254
- /** How the runs `rows` holds that tried to learn fared, over `filter` (learningStats): a held run's learning from
255
- * memory, any other's end from the learning ledger, never a run's files. */
256
- counts(rows: readonly RunRow[], filter: AnalyticsFilter): Promise<ReturnType<typeof learningStats>>;
257
- /** Agent `agentId`'s runs (`rows`, its own) as its learning view counts them, the ledger read once: how they fared
258
- * (counts, less `runs`), and what learning changed (learningImpact), each run's learning from memory when the kernel
259
- * holds it, else its end from its ledger line; never a run's files. */
260
- ofAgent(rows: readonly RunRow[], agentId: string): Promise<{
261
- counts: Omit<ReturnType<typeof learningStats>, "runs">;
262
- impact: Impact;
263
- notes: NoteRuns;
264
- }>;
265
- /** What a run of `agentId` starts from: its learning folder's main (learning.ts seedOf, through the folder's script
266
- * and file API), the folder made first when it is absent, with the lines its read said (a skill it left out); else
267
- * why it starts with nothing learned. A learning fault never refuses a run: a folder that cannot be made or read is
268
- * said once per run. */
269
- private seedFor;
270
- /** Moves the run's learning on, and shows its row. What it keeps whatever it does after (learning.ts KEPT_LEARNING:
271
- * the notes the run read, how many it started from, its answer's time and costs) stays with it. Saved by the caller,
272
- * or with the run's end. */
273
- private setLearning;
274
- /** As the run settles, before its end is written: the notes its job read from its copy of the folder (notesRead), by
275
- * their names in its seed, kept with its learning (`read`), so a view or a list reads them from serve.json and never
276
- * from its rows again. Only a note the run started from counts: MEMORY.md, a file the run wrote there, and a note
277
- * not in its seed are not notes it read. Read again at each settle, a follow-up's reads with the rest. A seed that
278
- * cannot be read leaves what was there, and says why. */
279
- private noteRead;
280
- private dropLearning;
281
- /** Why a run that just ended asks no end-of-run turn: a drop's reason and detail; null when it does not learn, or asked
282
- * one already (one per run, ever); undefined when it asks one. The cap keeps no reserve: a run its cap stopped has no
283
- * room left, and one whose spend is unknown cannot be kept within its cap. */
284
- private reflectSkip;
285
- /** The run answered or failed: it is finishing with that outcome, and its harness is asked one end-of-run turn first.
286
- * The turn is saved before it is asked, so a restart asks it again under the same id, never twice. */
287
- private reflect;
288
- /** Asks the end-of-run turn through the run's door and waits for its end, its deadline (the turn is aborted) or the
289
- * process to go; then lets the run go. The turn answers with its notes: it writes nothing, so nothing the run left in
290
- * its copy of the folder counts. */
291
- private reflectTurn;
292
- /** How the end-of-run turn ends: `ended` once the run's door says it is idle (the turn was taken before the submit was
293
- * answered, so idle is after it), `timeout` at `deadline`, `gone` when the process went or the run was cancelled. */
294
- private reflectEnd;
295
- /** At the run's end: the end-of-run turn's rows closed, and its learning settled from how the turn went. A run that
296
- * never left `seeded` went before it could reflect. */
297
- private closeLearning;
298
- /** What the run's end-of-run turn wrote, checked and kept as its proposal or dropped (propose.ts), once at a time, after
299
- * the run has ended. Never rejects: `proposed` or `dropped`, `propose_failed` for a fault. A server that goes
300
- * meanwhile leaves it `reflecting` in serve.json, and the next start checks it again. */
301
- private proposeOnce;
302
- /** The tools a run's workflow draft may name: its revision's granted tools a workflow's call node runs here that the
303
- * gate allows, under the server's tool settings and the agent's own (tools.ts learnedDraftTools); `gated`, those set to
304
- * ask or deny, which a draft that calls one is refused for. None for a revision not found, so a draft that names one is
305
- * refused. */
306
- private draftTools;
307
- private propose;
308
- /** What a run's learning refuses, and cuts from what it says: every secret this server never shows (serverSecrets),
309
- * what each launch handed the run, and every value its errors and answers never show (runs.ts' `handed`: its browser
310
- * sign-in's pointer among them, read back after a restart). */
311
- private refused;
312
- }
313
- export {};