@parcha/agentrun-serve 0.1.0-beta.33 → 0.1.0-beta.35

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 (466) hide show
  1. package/CHANGELOG.md +368 -0
  2. package/README.md +341 -208
  3. package/dist/adapters.d.ts +3 -4
  4. package/dist/adapters.js +18 -15
  5. package/dist/agent-rows.d.ts +99 -0
  6. package/dist/agent-rows.js +1 -0
  7. package/dist/agents-store.d.ts +6 -2
  8. package/dist/agents-store.js +75 -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 +1 -1
  14. package/dist/api-only.js +2 -2
  15. package/dist/archil-settings.d.ts +11 -1
  16. package/dist/archil-settings.js +10 -0
  17. package/dist/bash-read-only.d.ts +35 -0
  18. package/dist/bash-read-only.js +778 -0
  19. package/dist/box-settings.d.ts +3 -23
  20. package/dist/box-settings.js +7 -51
  21. package/dist/boxes.d.ts +17 -0
  22. package/dist/boxes.js +27 -20
  23. package/dist/browser-commands.d.ts +5 -2
  24. package/dist/browser-commands.js +4 -4
  25. package/dist/browser-computer.d.ts +5 -0
  26. package/dist/browser-computer.js +21 -0
  27. package/dist/browser-cost.d.ts +9 -6
  28. package/dist/browser-cost.js +95 -51
  29. package/dist/browser-live.d.ts +7 -20
  30. package/dist/browser-live.js +15 -93
  31. package/dist/browser-person.d.ts +18 -51
  32. package/dist/browser-person.js +94 -277
  33. package/dist/budget.d.ts +0 -5
  34. package/dist/budget.js +0 -5
  35. package/dist/cap.d.ts +14 -8
  36. package/dist/cap.js +19 -9
  37. package/dist/cli.js +71 -18
  38. package/dist/closed-pipes.d.ts +2 -0
  39. package/dist/closed-pipes.js +13 -0
  40. package/dist/computer-commands.d.ts +2 -0
  41. package/dist/computer-commands.js +2 -0
  42. package/dist/computer-keys.d.ts +20 -10
  43. package/dist/computer-keys.js +36 -54
  44. package/dist/computer-setting.d.ts +20 -3
  45. package/dist/computer-setting.js +58 -10
  46. package/dist/computers.d.ts +35 -2
  47. package/dist/computers.js +72 -11
  48. package/dist/confine.d.ts +120 -0
  49. package/dist/confine.js +436 -0
  50. package/dist/console/assets/index-B7NKTU8E.css +1 -0
  51. package/dist/console/assets/index-CXZMgJE7.js +550 -0
  52. package/dist/console/index.html +2 -2
  53. package/dist/content-filter.d.ts +7 -0
  54. package/dist/content-filter.js +23 -0
  55. package/dist/decision-cap.d.ts +7 -29
  56. package/dist/decision-cap.js +3 -94
  57. package/dist/decision-rows.d.ts +1 -1
  58. package/dist/decision-rows.js +1 -1
  59. package/dist/docker-daemon.d.ts +31 -0
  60. package/dist/docker-daemon.js +56 -0
  61. package/dist/effort-guidance.js +4 -3
  62. package/dist/environment.d.ts +0 -3
  63. package/dist/environment.js +3 -5
  64. package/dist/errors.d.ts +1 -2
  65. package/dist/errors.js +9 -9
  66. package/dist/explain.js +3 -1
  67. package/dist/filed-answer.d.ts +32 -0
  68. package/dist/filed-answer.js +160 -0
  69. package/dist/files.d.ts +1 -3
  70. package/dist/files.js +2 -4
  71. package/dist/github-connection.d.ts +1 -1
  72. package/dist/github-connection.js +25 -7
  73. package/dist/github-faux.d.ts +26 -0
  74. package/dist/github-faux.js +76 -0
  75. package/dist/github.d.ts +6 -2
  76. package/dist/github.js +5 -3
  77. package/dist/graph-served.d.ts +5 -3
  78. package/dist/graph-served.js +14 -6
  79. package/dist/graph-view.d.ts +3 -5
  80. package/dist/graph-view.js +9 -16
  81. package/dist/handed-values.d.ts +9 -0
  82. package/dist/handed-values.js +26 -0
  83. package/dist/harness-install.d.ts +1 -7
  84. package/dist/harness-install.js +1 -18
  85. package/dist/harness-opencode/adapter.d.ts +7 -0
  86. package/dist/harness-opencode/adapter.js +23 -6
  87. package/dist/harness-opencode/harness.js +0 -1
  88. package/dist/harness-opencode/host/policy.js +2 -2
  89. package/dist/harness-opencode/index.d.ts +1 -1
  90. package/dist/harness-opencode/index.js +1 -1
  91. package/dist/harness-opencode/verify.d.ts +17 -0
  92. package/dist/harness-opencode/verify.js +30 -10
  93. package/dist/harness-table.js +6 -1
  94. package/dist/heard.js +1 -1
  95. package/dist/held-fd.d.ts +5 -0
  96. package/dist/held-fd.js +14 -0
  97. package/dist/host-calls.d.ts +20 -0
  98. package/dist/host-calls.js +12 -0
  99. package/dist/host-tools.d.ts +4 -21
  100. package/dist/host-tools.js +4 -61
  101. package/dist/host.d.ts +2 -4
  102. package/dist/host.js +2 -7
  103. package/dist/import-summary.d.ts +1 -5
  104. package/dist/import-summary.js +0 -21
  105. package/dist/import.d.ts +6 -6
  106. package/dist/import.js +14 -15
  107. package/dist/index.d.ts +1 -0
  108. package/dist/index.js +1 -0
  109. package/dist/key-refusal.d.ts +5 -1
  110. package/dist/key-refusal.js +19 -4
  111. package/dist/learn/check.d.ts +8 -2
  112. package/dist/learn/check.js +85 -31
  113. package/dist/learn/folder.d.ts +11 -4
  114. package/dist/learn/folder.js +17 -19
  115. package/dist/learn/grade.d.ts +18 -1
  116. package/dist/learn/grade.js +108 -14
  117. package/dist/learn/index.d.ts +5 -5
  118. package/dist/learn/index.js +5 -5
  119. package/dist/learn/learning.sh +1 -14
  120. package/dist/learn/notes.d.ts +14 -3
  121. package/dist/learn/notes.js +16 -6
  122. package/dist/learn/reflect.d.ts +31 -2
  123. package/dist/learn/reflect.js +83 -6
  124. package/dist/learn/relevance.d.ts +24 -0
  125. package/dist/learn/relevance.js +91 -0
  126. package/dist/learn/secrets.d.ts +7 -1
  127. package/dist/learn/secrets.js +86 -19
  128. package/dist/learn/skills.d.ts +159 -18
  129. package/dist/learn/skills.js +644 -64
  130. package/dist/learned-nodes.d.ts +14 -0
  131. package/dist/learned-nodes.js +8 -0
  132. package/dist/learned-workflow.d.ts +41 -6
  133. package/dist/learned-workflow.js +153 -18
  134. package/dist/learning-routes.d.ts +49 -4
  135. package/dist/learning-routes.js +113 -31
  136. package/dist/learning-run.d.ts +16 -31
  137. package/dist/learning-run.js +31 -38
  138. package/dist/learning-words.d.ts +12 -5
  139. package/dist/learning-words.js +18 -9
  140. package/dist/learning.d.ts +91 -97
  141. package/dist/learning.js +176 -320
  142. package/dist/live/stream.js +1 -1
  143. package/dist/live/translate.js +12 -2
  144. package/dist/llm.d.ts +4 -1
  145. package/dist/llm.js +4 -2
  146. package/dist/local-models.d.ts +11 -5
  147. package/dist/local-models.js +13 -8
  148. package/dist/mcp-gateway.d.ts +17 -49
  149. package/dist/mcp-gateway.js +55 -136
  150. package/dist/mcp-oauth.d.ts +10 -14
  151. package/dist/mcp-oauth.js +14 -32
  152. package/dist/mcp-probe.d.ts +0 -7
  153. package/dist/mcp-probe.js +4 -10
  154. package/dist/mcp-servers-store.d.ts +18 -18
  155. package/dist/mcp-servers-store.js +12 -14
  156. package/dist/mcp-store.js +3 -4
  157. package/dist/mcp.js +4 -3
  158. package/dist/model.d.ts +9 -7
  159. package/dist/model.js +51 -27
  160. package/dist/monid.d.ts +0 -2
  161. package/dist/monid.js +3 -6
  162. package/dist/openapi.d.ts +8 -1
  163. package/dist/openapi.js +156 -58
  164. package/dist/page.d.ts +1 -3
  165. package/dist/page.js +6 -18
  166. package/dist/paid-calls.d.ts +21 -27
  167. package/dist/paid-calls.js +26 -61
  168. package/dist/pause.d.ts +2 -19
  169. package/dist/pause.js +5 -74
  170. package/dist/port-models.d.ts +10 -3
  171. package/dist/port-models.js +26 -6
  172. package/dist/propose.d.ts +2 -0
  173. package/dist/propose.js +80 -45
  174. package/dist/push-handler.d.ts +1 -1
  175. package/dist/reflect-range.d.ts +25 -0
  176. package/dist/reflect-range.js +30 -0
  177. package/dist/refusal-words.d.ts +5 -1
  178. package/dist/refusal-words.js +5 -1
  179. package/dist/rows.d.ts +1 -1
  180. package/dist/run-cut.d.ts +0 -6
  181. package/dist/run-cut.js +0 -6
  182. package/dist/run-db.d.ts +2 -11
  183. package/dist/run-db.js +2 -37
  184. package/dist/run-launch.d.ts +21 -2
  185. package/dist/run-launch.js +14 -5
  186. package/dist/run-learning-served.d.ts +21 -4
  187. package/dist/run-learning-served.js +23 -13
  188. package/dist/run-reads-over-store.d.ts +5 -3
  189. package/dist/run-reads-over-store.js +25 -14
  190. package/dist/run-secrets.d.ts +1 -1
  191. package/dist/run-timeline-served.d.ts +5 -1
  192. package/dist/run-timeline-served.js +27 -6
  193. package/dist/run-view.d.ts +37 -22
  194. package/dist/run-view.js +85 -38
  195. package/dist/runnable.d.ts +21 -10
  196. package/dist/runnable.js +35 -12
  197. package/dist/runner/adapter-loop.d.ts +36 -5
  198. package/dist/runner/adapter-loop.js +663 -69
  199. package/dist/runner/adapter-run-spec.d.ts +42 -8
  200. package/dist/runner/adapter-run-spec.js +186 -52
  201. package/dist/runner/adapters/index.js +11 -1
  202. package/dist/runner/adapters/pi.d.ts +40 -2
  203. package/dist/runner/adapters/pi.js +110 -27
  204. package/dist/runner/beside.d.ts +38 -3
  205. package/dist/runner/beside.js +54 -5
  206. package/dist/runner/claim-secrets.d.ts +16 -1
  207. package/dist/runner/claim-secrets.js +62 -14
  208. package/dist/runner/cli-run-spec.d.ts +5 -0
  209. package/dist/runner/cli-run-spec.js +159 -41
  210. package/dist/runner/commands.js +1 -1
  211. package/dist/runner/computer-journal.d.ts +15 -2
  212. package/dist/runner/computer-journal.js +41 -5
  213. package/dist/runner/conformance/harness.d.ts +1 -0
  214. package/dist/runner/conformance/harness.js +123 -13
  215. package/dist/runner/conformance/subject.d.ts +4 -1
  216. package/dist/runner/dispatch.d.ts +8 -1
  217. package/dist/runner/dispatch.js +81 -7
  218. package/dist/runner/end-of-run.d.ts +8 -2
  219. package/dist/runner/end-of-run.js +10 -4
  220. package/dist/runner/github-app.d.ts +7 -2
  221. package/dist/runner/github-app.js +47 -16
  222. package/dist/runner/harness-loops.d.ts +15 -2
  223. package/dist/runner/harness-loops.js +38 -2
  224. package/dist/runner/journal-kinds.d.ts +60 -6
  225. package/dist/runner/journal-kinds.js +43 -5
  226. package/dist/runner/journal-reader.d.ts +1 -1
  227. package/dist/runner/journal-reader.js +2 -2
  228. package/dist/runner/learning-ask.d.ts +4 -0
  229. package/dist/runner/learning-ask.js +15 -1
  230. package/dist/runner/learning-end.d.ts +18 -3
  231. package/dist/runner/learning-end.js +194 -20
  232. package/dist/runner/learning-loop.d.ts +7 -0
  233. package/dist/runner/learning-loop.js +36 -8
  234. package/dist/runner/learning-seed.d.ts +6 -0
  235. package/dist/runner/learning-seed.js +6 -0
  236. package/dist/runner/loop-contract.d.ts +4 -0
  237. package/dist/runner/main.d.ts +61 -9
  238. package/dist/runner/main.js +144 -20
  239. package/dist/runner/mcp-claim.d.ts +3 -0
  240. package/dist/runner/mcp-claim.js +7 -3
  241. package/dist/runner/mcp-github.d.ts +11 -2
  242. package/dist/runner/mcp-github.js +55 -4
  243. package/dist/runner/mcp-run.d.ts +2 -0
  244. package/dist/runner/mcp-run.js +16 -5
  245. package/dist/runner/memory-claim.d.ts +9 -0
  246. package/dist/runner/memory-claim.js +25 -0
  247. package/dist/runner/metrics.d.ts +46 -1
  248. package/dist/runner/metrics.js +156 -1
  249. package/dist/runner/model-route.d.ts +16 -0
  250. package/dist/runner/model-route.js +134 -10
  251. package/dist/runner/reflect-hook.d.ts +12 -1
  252. package/dist/runner/reflect-hook.js +33 -3
  253. package/dist/runner/runner.d.ts +20 -0
  254. package/dist/runner/runner.js +146 -18
  255. package/dist/runner/spec-holds.d.ts +7 -2
  256. package/dist/runner/spec-holds.js +4 -3
  257. package/dist/runner/store-port.d.ts +1 -1
  258. package/dist/runner/store-secrets.d.ts +3 -3
  259. package/dist/runner/store-secrets.js +8 -12
  260. package/dist/runner/text-tools.d.ts +44 -0
  261. package/dist/runner/text-tools.js +237 -0
  262. package/dist/runner/workflow-host.d.ts +7 -2
  263. package/dist/runner/workflow-host.js +3 -1
  264. package/dist/runner/workflow-loop.d.ts +10 -1
  265. package/dist/runner/workflow-loop.js +14 -6
  266. package/dist/runner/workflow-spec.d.ts +21 -0
  267. package/dist/runner/workflow-spec.js +217 -93
  268. package/dist/runs-over-store.d.ts +14 -3
  269. package/dist/runs-over-store.js +100 -23
  270. package/dist/seal-key.d.ts +0 -2
  271. package/dist/seal-key.js +5 -45
  272. package/dist/sealed-settings-store.d.ts +19 -4
  273. package/dist/sealed-settings-store.js +9 -9
  274. package/dist/sealing.d.ts +4 -0
  275. package/dist/sealing.js +20 -0
  276. package/dist/secret-cut.d.ts +1 -1
  277. package/dist/secret-cut.js +1 -1
  278. package/dist/secret-name.d.ts +9 -0
  279. package/dist/secret-name.js +15 -0
  280. package/dist/secret-writes.d.ts +0 -1
  281. package/dist/secret-writes.js +0 -1
  282. package/dist/server-fs.d.ts +4 -0
  283. package/dist/server-fs.js +8 -2
  284. package/dist/server-lock.d.ts +0 -24
  285. package/dist/server-lock.js +5 -85
  286. package/dist/server-secrets-store.d.ts +4 -4
  287. package/dist/server-secrets-store.js +9 -31
  288. package/dist/server-secrets.d.ts +4 -9
  289. package/dist/server-secrets.js +12 -36
  290. package/dist/server.d.ts +37 -56
  291. package/dist/server.js +322 -134
  292. package/dist/sign-ins-store.d.ts +34 -36
  293. package/dist/sign-ins-store.js +27 -38
  294. package/dist/sign-ins.d.ts +2 -119
  295. package/dist/sign-ins.js +5 -311
  296. package/dist/standard-webhooks.d.ts +1 -1
  297. package/dist/standard-webhooks.js +1 -1
  298. package/dist/stats.d.ts +3 -2
  299. package/dist/stats.js +1 -1
  300. package/dist/stop-signals.d.ts +4 -2
  301. package/dist/stop-signals.js +5 -3
  302. package/dist/store/agent-body.d.ts +12 -2
  303. package/dist/store/agent-body.js +22 -4
  304. package/dist/store/deadline.d.ts +18 -0
  305. package/dist/store/deadline.js +45 -0
  306. package/dist/store/index.d.ts +2 -2
  307. package/dist/store/index.js +2 -2
  308. package/dist/store/open.d.ts +6 -3
  309. package/dist/store/open.js +2 -2
  310. package/dist/store/postgres/connection.d.ts +22 -2
  311. package/dist/store/postgres/connection.js +211 -41
  312. package/dist/store/postgres/migrate.d.ts +4 -0
  313. package/dist/store/postgres/migrate.js +9 -2
  314. package/dist/store/postgres/migrations/0003_commands_one_answer.check.sql +19 -0
  315. package/dist/store/postgres/migrations/0003_commands_one_answer.sql +13 -0
  316. package/dist/store/postgres/store.d.ts +9 -2
  317. package/dist/store/postgres/store.js +9 -0
  318. package/dist/store/schema.js +1 -1
  319. package/dist/store/seal.js +2 -2
  320. package/dist/store/sqlite/connection.js +14 -5
  321. package/dist/store/sqlite/run-patch.d.ts +3 -0
  322. package/dist/store/sqlite/run-patch.js +3 -0
  323. package/dist/store/sqlite/store.js +41 -12
  324. package/dist/store/store.d.ts +35 -6
  325. package/dist/store/store.js +12 -2
  326. package/dist/store-reads/cap.d.ts +1 -1
  327. package/dist/store-reads/cap.js +22 -4
  328. package/dist/store-reads/journal.d.ts +9 -6
  329. package/dist/store-reads/journal.js +129 -18
  330. package/dist/store-reads/learning.d.ts +82 -8
  331. package/dist/store-reads/learning.js +184 -11
  332. package/dist/store-reads/workflow.d.ts +1 -1
  333. package/dist/store-reads/workflow.js +1 -1
  334. package/dist/store-view.d.ts +19 -1
  335. package/dist/store-view.js +95 -27
  336. package/dist/template-eval.d.ts +60 -4
  337. package/dist/template-eval.js +120 -54
  338. package/dist/templates.d.ts +33 -14
  339. package/dist/templates.js +82 -46
  340. package/dist/timeline/group.d.ts +33 -0
  341. package/dist/timeline/group.js +77 -0
  342. package/dist/timeline/index.d.ts +7 -0
  343. package/dist/timeline/index.js +7 -0
  344. package/dist/timeline/labels.d.ts +79 -0
  345. package/dist/timeline/labels.js +150 -0
  346. package/dist/timeline/origin.d.ts +56 -0
  347. package/dist/timeline/origin.js +92 -0
  348. package/dist/timeline/render-text.d.ts +11 -0
  349. package/dist/timeline/render-text.js +62 -0
  350. package/dist/timeline/timeline.d.ts +282 -0
  351. package/dist/timeline/timeline.js +1308 -0
  352. package/dist/timeline/util.d.ts +17 -0
  353. package/dist/timeline/util.js +49 -0
  354. package/dist/tool-budget.d.ts +18 -0
  355. package/dist/tool-budget.js +50 -0
  356. package/dist/tool-gate.d.ts +47 -218
  357. package/dist/tool-gate.js +87 -545
  358. package/dist/tool-keys-store.d.ts +11 -12
  359. package/dist/tool-keys-store.js +24 -31
  360. package/dist/tool-keys.d.ts +5 -101
  361. package/dist/tool-keys.js +8 -267
  362. package/dist/tool-plane.d.ts +23 -52
  363. package/dist/tool-plane.js +23 -81
  364. package/dist/tool-settings-store.d.ts +1 -2
  365. package/dist/tool-settings-store.js +5 -8
  366. package/dist/tools.d.ts +67 -25
  367. package/dist/tools.js +170 -119
  368. package/dist/trigger-adapter.d.ts +2 -2
  369. package/dist/trigger-targets.d.ts +13 -1
  370. package/dist/trigger-targets.js +31 -1
  371. package/dist/triggers.d.ts +2 -2
  372. package/dist/triggers.js +3 -3
  373. package/dist/turn-end.d.ts +1 -1
  374. package/dist/turn-end.js +1 -1
  375. package/dist/turns.d.ts +0 -6
  376. package/dist/turns.js +0 -19
  377. package/dist/uploads.d.ts +28 -5
  378. package/dist/uploads.js +83 -10
  379. package/dist/usage.d.ts +1 -49
  380. package/dist/usage.js +3 -84
  381. package/dist/validate.d.ts +4 -0
  382. package/dist/validate.js +33 -14
  383. package/dist/webhooks.d.ts +102 -76
  384. package/dist/webhooks.js +266 -233
  385. package/dist/workflow-run.d.ts +114 -0
  386. package/dist/workflow-run.js +144 -0
  387. package/dist/workspace/archil-claim.d.ts +2 -2
  388. package/dist/workspace/archil-claim.js +4 -3
  389. package/dist/workspace/archil-disk.d.ts +10 -1
  390. package/dist/workspace/archil-disk.js +4 -0
  391. package/dist/workspace/archil-exec.d.ts +12 -2
  392. package/dist/workspace/archil-exec.js +16 -0
  393. package/dist/workspace/archil.d.ts +2 -2
  394. package/dist/workspace/archil.js +25 -5
  395. package/dist/workspace/attach.js +2 -0
  396. package/dist/workspace/beneath.d.ts +19 -0
  397. package/dist/workspace/beneath.js +106 -0
  398. package/dist/workspace/computer-deps.d.ts +26 -9
  399. package/dist/workspace/computer-deps.js +144 -43
  400. package/dist/workspace/computer-for-claim.d.ts +17 -14
  401. package/dist/workspace/computer-for-claim.js +99 -26
  402. package/dist/workspace/computer-hold.d.ts +6 -1
  403. package/dist/workspace/computer-hold.js +6 -1
  404. package/dist/workspace/computer-janitor.d.ts +47 -0
  405. package/dist/workspace/computer-janitor.js +182 -0
  406. package/dist/workspace/computer-ledger.d.ts +1 -8
  407. package/dist/workspace/computer-ledger.js +0 -3
  408. package/dist/workspace/computer-providers.d.ts +5 -3
  409. package/dist/workspace/computer-providers.js +11 -9
  410. package/dist/workspace/grep-worker.d.ts +5 -0
  411. package/dist/workspace/grep-worker.js +9 -6
  412. package/dist/workspace/hands.d.ts +5 -2
  413. package/dist/workspace/hands.js +4 -3
  414. package/dist/workspace/index.d.ts +6 -5
  415. package/dist/workspace/index.js +4 -4
  416. package/dist/workspace/local.d.ts +14 -2
  417. package/dist/workspace/local.js +170 -43
  418. package/dist/workspace/paths.js +3 -2
  419. package/dist/workspace/pi-env.d.ts +4 -0
  420. package/dist/workspace/pi-env.js +3 -2
  421. package/dist/workspace/resolve-computer.d.ts +55 -10
  422. package/dist/workspace/resolve-computer.js +66 -14
  423. package/dist/workspace/run-tools.d.ts +15 -31
  424. package/dist/workspace/run-tools.js +19 -30
  425. package/dist/workspace/workspace.d.ts +5 -0
  426. package/dist/workspace-paths.d.ts +0 -17
  427. package/dist/workspace-paths.js +1 -41
  428. package/dist/workspace.d.ts +0 -17
  429. package/dist/workspace.js +4 -110
  430. package/package.json +14 -14
  431. package/skills/agentrun-serve/SKILL.md +1 -1
  432. package/templates/README.md +11 -5
  433. package/templates/code-review/evals/mentions-defused/case.yaml +15 -0
  434. package/templates/code-review/evals/mentions-defused/fixtures/github-mcp.json +254 -0
  435. package/templates/code-review/evals/mentions-defused/graders/no-pings.md +16 -0
  436. package/templates/code-review/evals/mentions-defused/graders/posted-a-review.md +5 -0
  437. package/templates/code-review/evals/mentions-defused/graders/schema.md +5 -0
  438. package/templates/code-review/evals/mentions-defused/prompt.md +10 -0
  439. package/templates/kyb/evals/clean-public-company/graders/no-opensanctions.md +5 -0
  440. package/templates/kyb/evals/opensanctions-on/case.yaml +5 -0
  441. package/templates/kyb/evals/opensanctions-on/graders/licence-and-evidence.md +18 -0
  442. package/templates/kyb/evals/opensanctions-on/graders/schema.md +5 -0
  443. package/templates/kyb/evals/opensanctions-on/prompt.md +11 -0
  444. package/templates/market-monitor/agent.md +2 -2
  445. package/templates/market-monitor/skills/monitor/SKILL.md +6 -4
  446. package/templates/release-notes/agent.md +11 -0
  447. package/dist/bound-files.d.ts +0 -4
  448. package/dist/bound-files.js +0 -164
  449. package/dist/coding-tools.d.ts +0 -47
  450. package/dist/coding-tools.js +0 -189
  451. package/dist/computer-adb.d.ts +0 -12
  452. package/dist/computer-adb.js +0 -14
  453. package/dist/console/assets/index-Dn0ngwG9.js +0 -535
  454. package/dist/console/assets/index-DvW6Aled.css +0 -1
  455. package/dist/grade.d.ts +0 -63
  456. package/dist/grade.js +0 -150
  457. package/dist/mcp-servers.d.ts +0 -269
  458. package/dist/mcp-servers.js +0 -456
  459. package/dist/packs.d.ts +0 -71
  460. package/dist/packs.js +0 -180
  461. package/dist/sealed-settings.d.ts +0 -60
  462. package/dist/sealed-settings.js +0 -171
  463. package/dist/sessions.d.ts +0 -6
  464. package/dist/sessions.js +0 -109
  465. package/dist/workspace/computer-serves.d.ts +0 -12
  466. package/dist/workspace/computer-serves.js +0 -15
@@ -7,7 +7,7 @@
7
7
  // secret later is found only whole, so a part of it kept would show for good. A run's learning keeps the parts its
8
8
  // words are made of (`learned`, `verdict`), and each read says them again (wordsOf): every part cut of the host's
9
9
  // secrets as they are then, and only then the words cut short (DETAIL_MAX for a run, LIST_DETAIL for a list's row).
10
- import { CAPS, learnedPlace, parseVerdict } from "./learn/index.js";
10
+ import { CAPS, CONTRADICTED_REASON, CONTRADICTED_TWICE_REASON, learnedPlace, parseVerdict } from "./learn/index.js";
11
11
  /** `n` of `one`, said as a person says it: "1 note", "2 notes". */
12
12
  const count = (n, one) => `${n} ${one}${n === 1 ? "" : "s"}`;
13
13
  /** `parts` as a person lists them: "a", "a and b", "a, b and c". */
@@ -78,19 +78,19 @@ const rulesIn = (problems) => [...new Set(problems.map(wordOf))].join("; ");
78
78
  export const STOPPED = {
79
79
  unreadable: "the agent's notes could not be read, so the run started without them",
80
80
  notCopied: "the agent's notes could not be copied into the run, so the run started without them",
81
+ noSeed: "the run started without the agent's notes",
81
82
  serverStopped: "the server stopped while it set up the run's notes, so the run started without them",
82
83
  cancelled: "the run was cancelled",
83
84
  cancelledLooking: "the run was cancelled while it looked back",
84
85
  crashed: "the run's process ended before it could look back",
85
- crashedLooking: "the run's process ended while it looked back",
86
86
  timedOut: "looking back took too long",
87
- notAsked: "looking back could not start",
88
87
  failed: "looking back ended on an error",
89
- notSetAside: "the new notes could not be set aside to be checked",
90
88
  notChecked: "the new notes could not be checked",
91
89
  refuseUnread: "what the run must never learn (its agent's browser sign-in, the server's secrets) could not be read back, so nothing it learned is kept",
92
90
  noReview: "the review of the new notes gave no answer",
93
91
  unread: "the review of the new notes gave an answer that could not be read",
92
+ contradicted: "the review of the new notes contradicted itself: it kept them and said not to",
93
+ contradictedTwice: "the review of the new notes contradicted itself twice: it kept them and said not to",
94
94
  };
95
95
  /** A run's learning, in words, by where it stands. */
96
96
  export const said = {
@@ -98,6 +98,9 @@ export const said = {
98
98
  reflecting: "Looking back on this run…",
99
99
  /** The end-of-run turn's message, as a person reads it in the timeline: never the prompt the model is sent. */
100
100
  asked: "Looking back on this run.",
101
+ /** The end-of-run turn asked again because a workflow draft failed its dry run (learn/reflect.ts reflectDryRun), as a
102
+ * person reads it in the timeline: never the ask, which holds the check's words. */
103
+ askedDryRun: "Looking back again: a workflow draft did not pass its dry run.",
101
104
  proposed: (notes, skills = 0, workflows = 0) => `Checking ${listed([...(notes || !(skills || workflows) ? [count(notes, "new note")] : []), ...(skills ? [count(skills, "skill")] : []), ...(workflows ? [count(workflows, "workflow")] : [])])}…`,
102
105
  /** What it learned, by name, and how many older notes they replace, and its skill and workflow by name; then what
103
106
  * waits for the owner's OK, by name; then, when the grader dropped an item and kept others (a verdict per item), its
@@ -119,6 +122,9 @@ export const said = {
119
122
  return dropped ? `${base}${base.endsWith(".") ? "" : "."} ${dropped}` : base;
120
123
  },
121
124
  empty: "Nothing new to remember from this run.",
125
+ /** A run whose only work was its learned workflows, each answering, with nothing said after its first message: it was
126
+ * not asked to look back (runner/learning-end.ts onlyLearnedWorkflows). */
127
+ onlyWorkflow: "Nothing new: the run only ran a learned workflow.",
122
128
  /** A merge whose every item the owner has since retired: nothing it learned is kept now. */
123
129
  retiredSince: "What it learned was retired since.",
124
130
  /** The run's answer gave its notes, but not in the format asked for, so none was read. */
@@ -143,7 +149,7 @@ export const said = {
143
149
  /** The reasons learn/grade.ts' parseVerdict gives of its own, never the grader's: an answer it could not read, and one
144
150
  * it refused (an item for a file it was not asked about, a file judged twice, a new note with no item, a merge that
145
151
  * did not keep every note). Found by asking it, so they follow it. */
146
- const OWN_REASONS = new Set(["", "[]", '{"merge":true,"reason":"r","items":[{"file":"a.md","keep":false,"why":"w"}]}', '{"merge":false,"reason":"r","items":[]}', '{"merge":false,"reason":"r","items":[{"file":"b.md","keep":false,"why":"w"}]}', '{"merge":false,"reason":"r","items":[{"file":"a.md","keep":false,"why":"w"},{"file":"a.md","keep":false,"why":"w"}]}'].map((answer) => parseVerdict(answer, ["a.md"]).reason));
152
+ const OWN_REASONS = new Set(["", "[]", '{"merge":true,"reason":"r","items":[{"file":"a.md","decision":"drop","why":"w"}]}', '{"merge":false,"reason":"r","items":[]}', '{"merge":false,"reason":"r","items":[{"file":"b.md","decision":"drop","why":"w"}]}', '{"merge":false,"reason":"r","items":[{"file":"a.md","decision":"drop","why":"w"},{"file":"a.md","decision":"drop","why":"w"}]}'].map((answer) => parseVerdict(answer, ["a.md"]).reason));
147
153
  /** The skill or the workflow draft at `file` as a person names it ("the skill X", "the workflow Y"), or undefined for a
148
154
  * note's file or a draft's README.md. */
149
155
  const learnedWords = (file) => {
@@ -159,7 +165,9 @@ const learnedWords = (file) => {
159
165
  * secrets: a name is the run's to choose. */
160
166
  export function notKept(verdict, lost = []) {
161
167
  const dropped = verdict.items.find((item) => !item.keep);
162
- const said_ = dropped?.why ? said.grader(dropped.why) : OWN_REASONS.has(verdict.reason) ? said.stopped(STOPPED.unread) : said.grader(verdict.reason);
168
+ // A grade that contradicted itself (it kept every item and said no merge: once, or again when asked again) is said as
169
+ // such: never its own reason, which may say the items can be kept.
170
+ const said_ = dropped?.why ? said.grader(dropped.why) : verdict.reason === CONTRADICTED_TWICE_REASON ? said.stopped(STOPPED.contradictedTwice) : verdict.reason === CONTRADICTED_REASON ? said.stopped(STOPPED.contradicted) : OWN_REASONS.has(verdict.reason) ? said.stopped(STOPPED.unread) : said.grader(verdict.reason);
163
171
  const subject = dropped?.why ? learnedWords(dropped.file) : undefined;
164
172
  const others = [...new Set(lost.flatMap(({ file }) => learnedWords(file) ?? []))].filter((words) => words !== subject);
165
173
  if (!subject && !others.length)
@@ -169,8 +177,9 @@ export function notKept(verdict, lost = []) {
169
177
  }
170
178
  /** A run's learning in words as a read says them, whole: what it learned and what waits for the owner's OK, or why the
171
179
  * grader kept nothing, said again from its parts (`learned`, `pending`, `verdict`) each cut by `cut` first (the host's
172
- * secrets as they are now); any other detail, the server's own sentence, cut as well. The caller cuts the words short
173
- * after. */
180
+ * secrets as they are now), and the whole line cut again, as notKept's is: a skill's or a workflow's file names it in
181
+ * the words, uncut until then; any other detail, the server's own sentence, cut as well. The caller cuts the words
182
+ * short after. */
174
183
  export function wordsOf(learning, cut) {
175
184
  const { learned, pending, verdict } = learning;
176
185
  if (learning.state === "merged") {
@@ -178,7 +187,7 @@ export function wordsOf(learning, cut) {
178
187
  const waiting = Array.isArray(pending) ? pending.filter((note) => typeof note?.name === "string") : [];
179
188
  const files = [...(Array.isArray(learning.skills) ? learning.skills : []), ...(Array.isArray(learning.workflows) ? learning.workflows : [])].filter((file) => typeof file?.file === "string" && typeof file.name === "string");
180
189
  if (kept.length || waiting.length || files.length)
181
- return said.merged(kept.map((note) => ({ name: cut(note.name), supersedes: note.supersedes })), waiting.map((note) => ({ name: cut(note.name) })), files.map((file) => ({ file: file.file, name: cut(file.name), ...(file.pending ? { pending: true } : {}) })), (verdict?.items ?? []).filter((item) => !item.keep && typeof item.why === "string").map((item) => ({ why: cut(item.why) })), Array.isArray(learning.problems) ? learning.problems : []);
190
+ return cut(said.merged(kept.map((note) => ({ name: cut(note.name), supersedes: note.supersedes })), waiting.map((note) => ({ name: cut(note.name) })), files.map((file) => ({ file: file.file, name: cut(file.name), ...(file.pending ? { pending: true } : {}) })), (verdict?.items ?? []).filter((item) => !item.keep && typeof item.why === "string").map((item) => ({ why: cut(item.why) })), Array.isArray(learning.problems) ? learning.problems : []));
182
191
  }
183
192
  if (learning.state === "dropped" && learning.reason === "grader" && verdict) {
184
193
  // serve.json's `lost` is read as untrusted: an entry out of shape is left out. The whole line is cut again, the names
@@ -1,4 +1,4 @@
1
- import { type LearnedNote, type Problem, type Verdict } from "./learn/index.js";
1
+ import { type DraftDryRun, type LearnedNote, type Problem, type Verdict } from "./learn/index.js";
2
2
  import { type LearningFolder } from "./learn/folder.js";
3
3
  import { type Workspace } from "./workspace/index.js";
4
4
  /** The server's learning switch (`--learning`, AGENTRUN_SERVE_LEARNING; capabilities.features.learning). `on`, the
@@ -8,7 +8,7 @@ export type LearningMode = (typeof LEARNING_MODES)[number];
8
8
  export declare const LEARNING_ENV = "AGENTRUN_SERVE_LEARNING";
9
9
  /** The switch: `given`, else AGENTRUN_SERVE_LEARNING, else on. Any other value is an error, and the server does not start. */
10
10
  export declare function learningOf(env: NodeJS.ProcessEnv, given?: string): LearningMode;
11
- /** How much of what a run learned its instructions hold under `# Learned` by default, in UTF-8 bytes (learnedOf): its
11
+ /** How much of what a run learned its instructions hold under `# Learned` by default, in UTF-8 bytes (learnedParts): its
12
12
  * notes whole while they fit, else the index and the notes changed last, whole, while they fit. */
13
13
  export declare const LEARNING_BUDGET = 8000;
14
14
  export declare const LEARNING_BUDGET_ENV = "AGENTRUN_SERVE_LEARNING_BUDGET";
@@ -17,7 +17,7 @@ export declare const LEARNING_BUDGET_ENV = "AGENTRUN_SERVE_LEARNING_BUDGET";
17
17
  export declare function learningBudgetOf(env: NodeJS.ProcessEnv, given?: number): number;
18
18
  /** Where a run's learning stands (its `learning`, runs.ts): `seeded` once it starts from what its agent learned,
19
19
  * `reflecting` while its end-of-run turn runs and until what it answered is checked, `proposed` once that passed the
20
- * checks and is kept in the run's directory (propose.ts), `merged` once it is on main (grade.ts), or `dropped` with a
20
+ * checks and is kept (propose.ts), `merged` once it is on main (runner/learning-loop.ts), or `dropped` with a
21
21
  * reason from the closed list. A learning fault never refuses a run: it starts with nothing learned, `seed_failed`. */
22
22
  export declare const LEARNING_STATES: readonly ["seeded", "reflecting", "proposed", "merged", "dropped"];
23
23
  export declare const LEARNING_REASONS: readonly ["seed_failed", "no_budget", "unknown_cost", "cancelled", "crashed", "reflect_timeout", "reflect_failed", "empty", "unparsed", "propose_failed", "checker", "grader", "grade_failed"];
@@ -35,7 +35,7 @@ export declare const NO_TOKENS: Tokens;
35
35
  /** The variable that names the grader's model, as `--grade-model` does. */
36
36
  export declare const GRADE_MODEL_ENV = "AGENTRUN_SERVE_GRADE_MODEL";
37
37
  /** The model this server grades on, by name: `given` (`--grade-model`), else GRADE_MODEL_ENV, else its strong tier
38
- * (AGENT_MODEL_STRONG); undefined when it names none, and each run is graded on its agent's own model (grade.ts). A
38
+ * (AGENT_MODEL_STRONG); undefined when it names none, and each run is graded on its agent's own model (runner/learning-loop.ts). A
39
39
  * name is a model as the strong tier takes one: sent as it is to a gateway, a provider/model-id otherwise. */
40
40
  export declare const gradeModelOf: (env: NodeJS.ProcessEnv, given?: string) => string | undefined;
41
41
  /** How many of an agent's runs were given a note, and read it, by the note's file (learning-run.ts noteRuns). */
@@ -107,9 +107,6 @@ export type LearnedFile = {
107
107
  name: string;
108
108
  pending?: true;
109
109
  };
110
- /** What a run's learning keeps whatever its learning does after: what it read, how many notes it started from, and its
111
- * answer's time and its costs (learning-run.ts setLearning). */
112
- export declare const KEPT_LEARNING: readonly ["given", "read", "seed_notes", "answered_at", "job_cost_usd", "look_back_usd"];
113
110
  /** What a text or a name that leaves shows of the host's secrets now: none (secretsShown). */
114
111
  export type Shown = {
115
112
  text: (text: string) => string;
@@ -117,9 +114,15 @@ export type Shown = {
117
114
  holds: (text: string) => boolean;
118
115
  };
119
116
  /** The host's secrets as a reader cuts them: a text holding a value or a shape is cut of it (whole when long:
120
- * learn/secrets.ts redactSecrets), and a file's name holding one reads REDACTED whole, not a name of the folder's (its
121
- * route still answers the real name, to a caller who knows it); any other text or name is shown as it is. */
122
- export declare function secretsShown(values: readonly string[]): Shown;
117
+ * learn/secrets.ts redactLearned, a bank's numbers too), and a file's name holding one reads REDACTED whole, not a name of the folder's (its
118
+ * route still answers the real name, to a caller who knows it); any other text or name is shown as it is. A text served
119
+ * has no loopback address, the address alone (key-refusal.ts withoutLoopbackAddresses, the pattern a run's words share,
120
+ * run-view.ts shownOf): the host's own, never a person's; a run error's `url:` tail is no rule of a note's, a patch's or a
121
+ * workflow.json's, so their label, line ends and JSON stay. `local`: kept, for what a run itself is given (its .learning/ notes, runner/learning-seed.ts, and its
122
+ * # Learned section, server.ts's learning start), where an address on the run's own machine is the note's to give. */
123
+ export declare function secretsShown(values: readonly string[], { local }?: {
124
+ local?: boolean;
125
+ }): Shown;
123
126
  /** The notes a run read and learned, as a view or a list shows them, each name cut of the host's secrets (`shown`):
124
127
  * `given` from its start, `read` once the run settled, `learned` and `pending` (what waits for the owner's OK) once it merged, and the skill
125
128
  * and the workflow draft it merged (`skills`, `workflows`, each `pending` while it waits), each only when it holds one.
@@ -159,29 +162,13 @@ export declare const learningView: (learning: Learning, shown: Shown, settled: b
159
162
  skills?: LearnedFile[];
160
163
  workflows?: LearnedFile[];
161
164
  state: "proposed" | "merged" | "seeded" | "reflecting" | "dropped";
162
- reason: "empty" | "unparsed" | "seed_failed" | "no_budget" | "unknown_cost" | "cancelled" | "crashed" | "reflect_timeout" | "reflect_failed" | "propose_failed" | "checker" | "grader" | "grade_failed" | null;
165
+ reason: "empty" | "cancelled" | "unparsed" | "seed_failed" | "no_budget" | "unknown_cost" | "crashed" | "reflect_timeout" | "reflect_failed" | "propose_failed" | "checker" | "grader" | "grade_failed" | null;
163
166
  detail: string | null;
164
167
  at: string;
165
168
  };
166
- /** A run's learning as a list shows it: its state and reason, its detail cut of the host's secrets and then short (at
167
- * most LIST_DETAIL characters, so a secret is never cut in half and shown), and the notes it read and learned
168
- * (notesView); never its time. */
169
- export declare const shortLearning: (learning: Learning | null, shown: Shown, settled: boolean) => ({
170
- state: "proposed" | "merged" | "seeded" | "reflecting" | "dropped";
171
- reason: "empty" | "unparsed" | "seed_failed" | "no_budget" | "unknown_cost" | "cancelled" | "crashed" | "reflect_timeout" | "reflect_failed" | "propose_failed" | "checker" | "grader" | "grade_failed" | null;
172
- detail: string | null;
173
- } & Omit<{
174
- given?: NoteUsed[];
175
- read?: NoteUsed[];
176
- learned?: NoteLearned[];
177
- pending?: NoteUsed[];
178
- skills?: LearnedFile[];
179
- workflows?: LearnedFile[];
180
- state: "proposed" | "merged" | "seeded" | "reflecting" | "dropped";
181
- reason: "empty" | "unparsed" | "seed_failed" | "no_budget" | "unknown_cost" | "cancelled" | "crashed" | "reflect_timeout" | "reflect_failed" | "propose_failed" | "checker" | "grader" | "grade_failed" | null;
182
- detail: string | null;
183
- at: string;
184
- }, "at" | "reason" | "detail" | "state">) | null;
169
+ /** A learning's `reason` as it is served: one of its words as the server writes them, read back from a kept row, which is
170
+ * untrusted, so cut of the host's secrets as every text is. */
171
+ export declare const reasonShown: (reason: Learning["reason"] | undefined, shown: Shown) => Learning["reason"];
185
172
  /** A run's learning as its view shows it, in short for a list: all of it but its time, its detail cut short. */
186
173
  export declare function shortOf<T extends {
187
174
  state: LearningState;
@@ -190,7 +177,7 @@ export declare function shortOf<T extends {
190
177
  at: string;
191
178
  }>({ state, reason, detail, at: _, ...notes }: T): {
192
179
  state: "proposed" | "merged" | "seeded" | "reflecting" | "dropped";
193
- reason: "empty" | "unparsed" | "seed_failed" | "no_budget" | "unknown_cost" | "cancelled" | "crashed" | "reflect_timeout" | "reflect_failed" | "propose_failed" | "checker" | "grader" | "grade_failed" | null;
180
+ reason: "empty" | "cancelled" | "unparsed" | "seed_failed" | "no_budget" | "unknown_cost" | "crashed" | "reflect_timeout" | "reflect_failed" | "propose_failed" | "checker" | "grader" | "grade_failed" | null;
194
181
  detail: string | null;
195
182
  } & Omit<T, "at" | "reason" | "detail" | "state">;
196
183
  /** The label of the end-of-run turn's timeline rows, and the kind and label of a run's learning row. */
@@ -200,6 +187,8 @@ export declare const LEARNING_LABEL = "learning";
200
187
  * when it gives none), and what the user said in the run as the grader reads it (each message cut of the host's
201
188
  * secrets, then shortened to its head and tail, shortMessage; absent in a proposal kept before the grader read them). */
202
189
  export declare const PROPOSAL = "learning-proposal.json";
190
+ /** A run's proposal: its notes, skill and drafts, each draft's dry run by its workflow.json's path (learn/skills.ts
191
+ * draftDryRun: passed, or not run and why), and what was said in the run. */
203
192
  export type Proposal = {
204
193
  seed: string;
205
194
  notes: {
@@ -210,6 +199,7 @@ export type Proposal = {
210
199
  file: string;
211
200
  text: string;
212
201
  }[];
202
+ dryRuns?: Record<string, DraftDryRun>;
213
203
  asked?: string[];
214
204
  triggered?: Triggered[];
215
205
  };
@@ -223,16 +213,14 @@ export type Triggered = {
223
213
  export declare const LEARNING_PIN = "learning.json";
224
214
  /** Where a run finds its agent's notes: in its work, a copy the run may read and nothing reads back. */
225
215
  export declare const LEARNED_DIR = ".learning";
226
- /** What the run's end-of-run turn answered, and what the user said in the run, kept in the run's directory as the run
227
- * settles (learning-run.ts beforeSettle), where the host alone reads it: what propose.ts checks. */
228
- export declare const LEARNING_TURN = "learning-turn.json";
216
+ /** What the run's end-of-run turn answered, and what the user said in the run: what propose.ts checks. */
229
217
  export type Turn = {
230
218
  answer: string;
231
219
  asked: string[];
232
220
  triggered?: Triggered[];
233
221
  };
234
222
  /** What a run's pin holds: the commit of main it was seeded from (null: the folder had no main yet, so the run learns
235
- * from an empty seed), and what it reads under `# Learned` (learnedOf), when it learned anything.
223
+ * from an empty seed), and what it reads under `# Learned` (learnedParts), when it learned anything.
236
224
  * `skills`: the files of the learned skills laid in its work, by their paths under `.agents/skills/`, as a revision
237
225
  * names its own; `skills_left_out`: the learned skills it does not get, over their budget or holding a secret.
238
226
  * `workflows`: the names of the learned workflows the run may run (its `learned_workflow` tool), each written whole in
@@ -275,7 +263,9 @@ export declare const LEARNED_WORKFLOWS_FILE = "learned-workflows.json";
275
263
  /** The most bytes the `learned_workflow` tool's description gives its workflows, each one's line (workflowLine)
276
264
  * together: every harness sends the description with each request, so it never grows with what an agent learned. */
277
265
  export declare const LEARNED_WORKFLOWS_BUDGET: number;
278
- /** A learned workflow's line in the `learned_workflow` tool's description: its name, and what its README says it does. */
266
+ /** A learned workflow's line in the `learned_workflow` tool's description: its name, its input's fields (inputFields;
267
+ * none for a workflow whose input names no schema) and what its README says it does. One line: the tool's own line says
268
+ * once that `*` marks a required field. */
279
269
  export declare const workflowLine: ({ name, description, workflow }: Pick<LearnedWorkflow, "name" | "description"> & {
280
270
  workflow?: string;
281
271
  }) => string;
@@ -291,34 +281,14 @@ export type LearnedSkill = {
291
281
  files?: Record<string, string>;
292
282
  };
293
283
  /** The agent's learning folder: `learning/` in its folder on the disk, which only the host writes. The folder is files.ts
294
- * agentFolderOf (pi-durable-agent agentDiskDir), so two ids that differ only in case never share one. */
284
+ * agentFolderOf (server-fs.ts agentDiskDir), so two ids that differ only in case never share one. */
295
285
  export declare const learningRepo: (data: string, agentId: string) => string;
296
- /** The agent's learning folder, its home and the folder made where absent (checkedFolder). A link swapped in for a part
297
- * just made is caught by the check after. `<data>/disk/agents` is the operator's, as the data directory is. Every write into
298
- * the folder goes through it, in the agent's queue: before a run's seed reads or makes
299
- * the repository, before its end-of-run turn reads its seed again (seedAt), before its proposal is checked against it
300
- * (propose.ts), before its grade reads main and its merge writes it (grade.ts), and before a person's edit, create,
301
- * retire, approve or restore (learning-routes.ts). A refusal throws: a run about to start starts with nothing
302
- * learned (seed_failed), a run that ended drops what it learned (reflect_failed, propose_failed or grade_failed), and
303
- * a person's write is an error. */
304
- export declare const agentFolder: (data: string, agentId: string) => Promise<string>;
305
- /** One git call on `repo` (none for `init`), from `cwd`: its stdout, or a rejection naming the command and its stderr.
306
- * `env` adds to the call's environment (a temporary index, a work tree named outright). */
307
- export declare function git(cwd: string, repo: string | undefined, args: readonly string[], input?: string | Uint8Array, env?: NodeJS.ProcessEnv): Promise<Buffer>;
308
286
  /** Runs `work` once every call queued before it on the agent's folder has finished: one at a time per agent, in this
309
287
  * process. Everything that touches an agent's folder goes through it, so two runs made at once never both make it. */
310
288
  export declare const withAgentRepo: <T>(data: string, agentId: string, work: () => Promise<T>) => Promise<T>;
311
289
  /** Agent `agentId`'s learning folder (learn/folder.ts learningWorkspace), in this server's place: Mode 1's local folder
312
290
  * under `data`. The one point that names the place; its `end()` is called in a finally after every use. */
313
291
  export declare const learningFolderOf: (data: string, agentId: string) => LearningFolder;
314
- /** The blobs `oids` hold, in order, read in one `cat-file --batch`. One git cannot read throws. */
315
- export declare function readBlobs(cwd: string, repo: string, oids: readonly string[]): Promise<Buffer[]>;
316
- /** What commit `sha` holds for a run, read with plumbing: its index and its active notes, the `.md` files at its top.
317
- * Only a regular file (mode 100644) under FILE_CAP, in UTF-8, is read, and only a note in shape (learn/notes.ts
318
- * parseNoteFile); anything else is named in `skipped`. Only an active note is a run's: a pending, superseded or retired
319
- * one is not, and nothing serves it (learnedOf, layLearned). A read git fails (an
320
- * object missing, a timeout) throws. */
321
- export declare function readSeed(cwd: string, repo: string, sha: string): Promise<Seed>;
322
292
  /** What the learning folder's read at a commit gives a run's seed (the folder's script's read op, through the agent's
323
293
  * learning Workspace): each file of its index, its active notes and its active skills, by its path from the folder's
324
294
  * root, each skill it left out whole and why (`refused`, always there: a skill holding a tracked link), and every entry
@@ -367,11 +337,6 @@ export declare function seedFrom(commit: string | null, read: SeedReader, { orde
367
337
  /** What seedFrom reads through the agent's learning folder: the script's read at a commit, or the snapshot and its
368
338
  * bodies when the commit is main's (learn/seed-check.ts readSeed). No git in this process. */
369
339
  export declare const readerOf: (ws: Workspace) => SeedReader;
370
- /** A learned workflow README's front matter, each key to its value (quotes dropped; a `>` or `|` value's indented lines
371
- * joined by spaces), or undefined when it does not read one way: no front matter, none closed (`---` on a line of its
372
- * own, the last line or not), a line that is neither a key at its left edge, a comment, blank, nor a line of a `>` or
373
- * `|` value, or a key set twice. */
374
- export declare function readmeFront(text: string): Map<string, string> | undefined;
375
340
  /** The seed of a run of agent `agentId` about to be made: main's commit, the folder made first when it is absent (the
376
341
  * learning script's init), and what main holds for a run (seedFrom over the folder's read): its index, its active
377
342
  * notes the one changed last first, its active skills, and its active learned workflows. A skill the read refused is
@@ -388,45 +353,75 @@ export declare const activeOf: (seed: Pick<Seed, "notes">) => LearnedNote[];
388
353
  * learned files are written, once its pin is in place, before what its end-of-run turn wrote is checked, as a run that
389
354
  * learns opens again for a follow-up, and as each git call starts (its arguments). */
390
355
  export declare const learningTestHooks: {
391
- git?: (args: readonly string[]) => void;
392
- afterMkdir?: (dir: string) => Promise<void> | void;
393
- beforePin?: (runDir: string) => Promise<void> | void;
394
356
  afterPin?: (runDir: string) => Promise<void> | void;
395
- /** Once a start's seed is copied and pinned, before its learning is said: a throw here leaves the start's pin. */
396
- afterSeed?: (runDir: string) => Promise<void> | void;
397
- beforePropose?: (runDir: string) => Promise<void> | void;
398
- beforeReopen?: (runDir: string) => Promise<void> | void;
399
357
  };
400
- /** As the run in `runDir` settles after its end-of-run turn ended, before it reads ended and before a follow-up can
401
- * open it again: what the turn answered and what the user said, kept whole in `<run dir>/learning-turn.json`, so
402
- * nothing the run does after its end reaches what is checked. One already there stays (a server that went after it
403
- * was written). Throws when the write fails. */
404
- export declare function keepTurn(runDir: string, turn: Turn): Promise<void>;
405
- /** The turn a run's directory keeps (keepTurn). One that is not there, or out of shape, throws. */
406
- export declare function readTurn(runDir: string): Promise<Turn>;
407
358
  /** Lays `seed`'s index and active notes in the run's `.learning/`, through its Workspace, made fresh: whatever was there
408
359
  * goes. The index names the active notes alone (servedIndex), and each file is cut of the host's secrets (`shown`), the
409
360
  * index a line at a time. */
410
361
  export declare function layLearned(work: Workspace, seed: Seed, shown: Shown): Promise<void>;
411
- /** How a run reads what it learned (learnedOf): the server's learning budget, in bytes; whether its agent has the read
412
- * tool; the host's secrets, which every text is cut of. */
362
+ /** How a run reads what it learned (learnedParts): the server's learning budget, in bytes; whether its agent has the read
363
+ * tool; the host's secrets, which every text is cut of; and which of its notes it is given (`select`, byRelevance when
364
+ * none) for the run it starts (`run`: what the selector may read of it, its input). */
413
365
  export type LearnedOptions = {
414
366
  budget: number;
415
367
  read: boolean;
416
368
  shown: Shown;
369
+ select?: NoteSelector;
370
+ run?: RunInput;
371
+ };
372
+ /** What a note selector may read of the run it chooses for: the input it was started with. */
373
+ export type RunInput = {
374
+ readonly input?: unknown;
375
+ };
376
+ /** What a note selector chooses from: the agent's active notes, newest first, each with the UTF-8 bytes it takes whole
377
+ * (its block and the blank line before it); the bytes the served index takes (0 when there is none); whether every index
378
+ * line names an active note (none names one main does not hold whole); and the learning budget. */
379
+ export type NoteCandidates = {
380
+ /** Each note, with the bytes it takes whole and the bytes it takes as one rule line (`lineBytes`: its name, file and
381
+ * description on one line). */
382
+ readonly notes: readonly {
383
+ readonly note: LearnedNote;
384
+ readonly bytes: number;
385
+ readonly lineBytes: number;
386
+ }[];
387
+ readonly indexBytes: number;
388
+ readonly indexComplete: boolean;
389
+ readonly budget: number;
390
+ };
391
+ /** A selector's choice: the notes the run reads whole, in the order it reads them (a subset of the candidates), and
392
+ * whether it reads the index first. Without the index, the notes are all it is given; or, with `lines`, the notes it
393
+ * reads as one rule line each after them, in their place (`index` is then false). */
394
+ export type NoteSelection = {
395
+ readonly whole: readonly LearnedNote[];
396
+ readonly index: boolean;
397
+ readonly lines?: readonly LearnedNote[];
398
+ };
399
+ /** The port that chooses which of an agent's notes a run gets (learnedParts; byRelevance when none is named). It chooses only: the seed, the pin, the cut of
400
+ * the host's secrets and the section's words stay learnedParts'. A selector keeps the budget: its whole notes, and the
401
+ * index when it serves it, fit `budget`, past which only the index may go (as loadedIndex bounds it). */
402
+ export type NoteSelector = (candidates: NoteCandidates, run: RunInput) => NoteSelection;
403
+ /** The selector by recency: every note whole while all fit the budget and the index names no note main does not hold
404
+ * whole; else the index, then the newest notes that fit what it leaves, each whole. */
405
+ export declare const byRecency: NoteSelector;
406
+ /** The default selector, by relevance, past the budget: while the notes fit it, recency's choice (byRecency). Else each
407
+ * note is scored against the run's input (learn/relevance.ts: BM25 over its name, description and body, a code
408
+ * review's changed paths' words weighed PATH_WEIGHT; no model call), and the run reads the notes that bear on it most
409
+ * whole, in score order, while they fit, then one rule line for each of the rest, best first, in place of the index; the lines count toward the
410
+ * budget before the whole notes, as the index did, and no more of them than a run reads of the index (loadedIndex). An
411
+ * input with no word any note holds reads by recency. */
412
+ export declare const byRelevance: NoteSelector;
413
+ /** What a run of `seed` reads under `# Learned` (`section`, the same for every harness, undefined when it learned
414
+ * nothing) and the notes that names (`given`), from one choice of the selector, so the section and the given notes never
415
+ * come from two choices. Only active notes are served: a pending, superseded or retired one is never there, whole or in
416
+ * the index, nor counted toward the budget (readSeed reads active notes alone, and servedIndex drops their lines). Its
417
+ * active notes, newest first (`seed.recent`, else by name), each whole while all fit `budget`; past it, the selector's
418
+ * choice (byRelevance by default). An agent with the read tool is told the rest are in `.learning/`, one without is not.
419
+ * Every text is cut of the host's secrets. A run "was given" `given`; of them, it "read" those whose file it opened
420
+ * (store-reads/learning.ts notesReadOf). Whether it applied one given whole is not measured. */
421
+ export declare function learnedParts(seed: Seed, options: LearnedOptions): {
422
+ section: string | undefined;
423
+ given: LearnedNote[];
417
424
  };
418
- /** What a run of `seed` reads under `# Learned`, the same for every harness, or undefined when it learned nothing. Only
419
- * active notes are served: a pending, superseded or retired one is never there, whole or in the index, nor counted
420
- * toward the budget (readSeed reads active notes alone, and servedIndex drops their lines). Its active notes, newest
421
- * first (`seed.recent`, else by name): each whole while all fit `budget`, the UTF-8 bytes of
422
- * what follows the first paragraph. Past it, or when the index names a note main does not hold whole: the index as a
423
- * run loads it (learn/notes.ts loadedIndex, the first 200 lines and no more than 25 KB, past the budget when it is
424
- * larger), then the newest notes that fit what is left, each whole, and the rest named only in the index; an agent
425
- * with the read tool is told they are in `.learning/`, one without is not. Every text is cut of the host's secrets. */
426
- export declare function learnedOf(seed: Seed, options: LearnedOptions): string | undefined;
427
- /** The notes a run's # Learned section names (learnedOf): each given whole, and each an index line names by its file;
428
- * every active note when all are given whole. A run "was given" these; whether it applied one is not measured. */
429
- export declare function givenOf(seed: Seed, options: LearnedOptions): NoteUsed[];
430
425
  /** Lays each of `skills` in the run's `.agents/skills/<name>/` through its Workspace, a folder made new for it (one
431
426
  * already there throws EXISTS); a link on the way is ESCAPE, and nothing is written through it. Each name goes in
432
427
  * `made` once its folder is, so a caller that fails takes back what was laid. */
@@ -435,9 +430,11 @@ export declare function laySkills(work: Workspace, skills: readonly LearnedSkill
435
430
  * way is a link (or no folder), when nothing is touched. */
436
431
  export declare function takeSkills(work: Workspace, names: Iterable<string>): Promise<void>;
437
432
  /** Which of `seed`'s learned skills a run gets, in `work`, in the seed's order: each whole while they fit their budget,
438
- * LEARNED_SKILLS_BUDGET and never more than the revision's `own` skill files (by their bytes in `work`) leave of
439
- * SKILL_BYTES. One named like a folder of the revision's skills, or like anything already in `work/.agents/skills/`, is
440
- * the revision's, and not the run's; one that does not fit, or holds a host secret (`shown`), is left out. */
433
+ * LEARNED_SKILLS_BUDGET and never more than the revision's `own` skill files leave of SKILL_BYTES, sized in each form a
434
+ * harness is handed them, the larger: as they are in `work` (claude-agent, codex) and as servedSkills writes them
435
+ * (OpenCode, whose check reads that form). One named like a folder of the revision's skills, or like anything already in `work/.agents/skills/`, is
436
+ * the revision's, and not the run's; one that does not fit, or holds a host secret (`shown`) as stored or as laid, is
437
+ * left out. */
441
438
  export declare function chooseSkills(work: Workspace, seed: Seed, own: readonly string[], shown: Shown): Promise<{
442
439
  taken: LearnedSkill[];
443
440
  left: string[];
@@ -452,7 +449,7 @@ export declare function chooseWorkflows(seed: Seed, shown: Shown): {
452
449
  };
453
450
  /** Writes `seed` into the run just made in `runDir`, its files through the run's Workspace (`work`): the index and each
454
451
  * active note into `.learning/`, made fresh (whatever was there goes), then the pin, with what the run reads under
455
- * `# Learned` (learnedOf) and the learned skills it gets beside the revision's `own` skill files (chooseSkills), then
452
+ * `# Learned` (learnedParts) and the learned skills it gets beside the revision's `own` skill files (chooseSkills), then
456
453
  * those skills, last, into `.agents/skills/`. A write that fails leaves no `.learning/`, no learned skill and no pin,
457
454
  * and throws. */
458
455
  export declare function pinSeed(runDir: string, work: Workspace, seed: Seed, options: LearnedOptions & {
@@ -486,6 +483,3 @@ export declare function withLearned(runDir: string, given: Workspace | string, i
486
483
  instructions: string;
487
484
  skills: string[];
488
485
  }>;
489
- /** The learned workflows a run's pin names, as its directory keeps them (LEARNED_WORKFLOWS_FILE): none when the pin
490
- * names none. A file that is not the list the pin names throws. */
491
- export declare function pinnedWorkflows(runDir: string, pin: Pin | undefined): Promise<LearnedWorkflow[]>;