@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
package/dist/propose.js CHANGED
@@ -1,23 +1,16 @@
1
- // Learning, after a run: the notes its end-of-run turn answered with, and a skill or a workflow draft beside them, are read
2
- // by the host (learn/reflect.ts parseReflection), checked against the commit the run started from (learn/check.ts
3
- // checkProposal), and kept in the run's own directory as its proposal (`learning-proposal.json`), or dropped. The answer
4
- // is read from what the run's directory kept as the run settled (learning.ts keepTurn), never from the run's work or its
5
- // rows, which a follow-up may change; and no file the run wrote is read at all, in `.learning/` or anywhere. The seed is
6
- // read from the agent's learning folder through its Workspace, as the reflect hook's check reads it (learn/seed-check.ts):
7
- // the snapshot and its bodies when main is the seed (no exec), else one read-only exec of the learning script at that
8
- // commit. Nothing is written to git here, and nothing is written at all before the checks pass: what they refuse (a
9
- // note holding a secret among them) is never kept anywhere.
10
1
  import { join } from "node:path";
11
- import { checkProposal, draftFiles, unstorable, parseReflection, redactSecrets, shortMessage, SKILLS_DIR, WORKFLOWS_DIR } from "./learn/index.js";
2
+ import { checkProposal, draftDryRun, draftFiles, NOTE_BLOCK, unstorable, parseReflection, redactSecrets, shortMessage, SKILL_BLOCK, SKILLS_DIR, WORKFLOW_BLOCK, WORKFLOWS_DIR } from "./learn/index.js";
12
3
  import { folderAt, readLearning, readSnapshot } from "./learn/folder.js";
13
4
  import { baseOf } from "./learn/seed-check.js";
14
5
  import { writeDurable } from "./files.js";
15
6
  import { PROPOSAL } from "./learning.js";
16
- /** The rules that refuse a proposal whole, whatever item they name: its counts and caps, a path outside what a run may
17
- * write, a deletion, the folder's index full, anything that must never be stored (a secret, a character a reader does
18
- * not see), which says the run's answer is not to be trusted for any item, and text that is not UTF-8, which cannot be
19
- * read for one. Every other problem is its item's alone; unstorable reads every item's text whole first. */
20
- const WHOLE = new Set(["too_many_files", "too_many_notes", "too_many_skills", "too_many_workflows", "outside", "deleted", "index_full", "secret_value", "secret_shape", "invisible_unicode", "encoding"]);
7
+ /** The rules that refuse a proposal whole, whatever item they name: a path outside what a run may write, a deletion,
8
+ * the folder's index full (the notes' total, which no one item is past), anything that must never be stored (a secret,
9
+ * a character a reader does not see), which says the run's answer is not to be trusted for any item, and text that is
10
+ * not UTF-8, which cannot be read for one. Every other problem is its item's alone: a count cap names the items past it
11
+ * (learn/check.ts), a size cap the item over it, and they are left out and the rest kept; unstorable reads every item's
12
+ * text whole first. */
13
+ const WHOLE = new Set(["outside", "deleted", "index_full", "secret_value", "secret_shape", "invisible_unicode", "encoding"]);
21
14
  /** The item a changed file belongs to: a draft's two files are one item (its folder), every other file is itself. */
22
15
  const itemOf = (path) => (path.startsWith(`${WORKFLOWS_DIR}/`) ? path.split("/").slice(0, 2).join("/") : path);
23
16
  const utf8 = new TextDecoder("utf-8", { fatal: true });
@@ -82,14 +75,21 @@ async function seedAt(lw, seed, wanted) {
82
75
  * `tools`, those a draft may name (tools.ts learnedWorkflowTools); `refuse`: this host's secrets. */
83
76
  export const proposeRun = async (input) => {
84
77
  const parsed = parseReflection(input.turn.answer);
85
- // Each skill and draft as the folder would hold it; a draft is its two files, given together or not at all.
86
- const given = parsed.ok ? [
87
- ...(parsed.skills ?? []).map(({ name, text }) => [{ file: `${SKILLS_DIR}/${name}/SKILL.md`, text }]),
88
- ...(parsed.workflows ?? []).map(({ name, text }) => {
89
- const { json, readme } = draftFiles(name, text);
90
- return [{ file: `${WORKFLOWS_DIR}/${name}/workflow.json`, text: json }, { file: `${WORKFLOWS_DIR}/${name}/README.md`, text: readme }];
91
- }),
92
- ] : [];
78
+ // Each skill and draft as the folder would hold it, keyed by its block (kind and name) so the changes keep the
79
+ // answer's order; a draft is its two files, given together or not at all. A draft's `example:` line, by its
80
+ // workflow.json's path: the input its dry run runs on, never a file's (draftFiles leaves it out of the README).
81
+ const fileGroups = new Map();
82
+ const examples = new Map();
83
+ const keyOf = (kind, name) => `${kind}\u0000${name}`;
84
+ for (const { name, text } of parsed.ok ? (parsed.skills ?? []) : [])
85
+ fileGroups.set(keyOf(SKILL_BLOCK, name), [{ file: `${SKILLS_DIR}/${name}/SKILL.md`, text }]);
86
+ for (const { name, text } of parsed.ok ? (parsed.workflows ?? []) : []) {
87
+ const { json, readme, example } = draftFiles(name, text);
88
+ if (example !== undefined)
89
+ examples.set(`${WORKFLOWS_DIR}/${name}/workflow.json`, example);
90
+ fileGroups.set(keyOf(WORKFLOW_BLOCK, name), [{ file: `${WORKFLOWS_DIR}/${name}/workflow.json`, text: json }, { file: `${WORKFLOWS_DIR}/${name}/README.md`, text: readme }]);
91
+ }
92
+ const given = [...fileGroups.values()];
93
93
  // The seed is read whatever the answer: a seed the folder does not hold fails the check.
94
94
  const { snapshot, texts } = await seedAt(input.folder, input.seed, () => (parsed.ok ? [...parsed.notes.map(({ file }) => file), ...given.flat().map(({ file }) => file)] : []));
95
95
  if (!parsed.ok)
@@ -97,39 +97,72 @@ export const proposeRun = async (input) => {
97
97
  const { base, kept } = baseOf(snapshot);
98
98
  const held = new Set(base.files);
99
99
  const files = given.filter((group) => group.some(({ file, text }) => texts.get(file) !== text)).flat();
100
- const changes = [
101
- ...parsed.notes.filter(({ file, text }) => texts.get(file) !== text).map(({ file, text }) => ({ path: file, status: held.has(file) ? "modified" : "added", mode: "100644", bytes: Buffer.from(text) })),
102
- ...files.map(({ file, text }) => ({ path: file, status: held.has(file) ? "modified" : "added", mode: "100644", bytes: Buffer.from(text) })),
103
- ];
100
+ const changeOf = ({ file, text }) => ({ path: file, status: held.has(file) ? "modified" : "added", mode: "100644", bytes: Buffer.from(text) });
101
+ // Each changed item in the order the answer gave its block, whatever its kind: a count cap names the items past it in
102
+ // that order (learn/check.ts), so a skill the answer led with is never the one past the changed-path cap.
103
+ const noteTexts = new Map(parsed.notes.map(({ file, text }) => [file, text]));
104
+ const changed = new Set(files.map(({ file }) => file));
105
+ const changes = parsed.order.flatMap(({ kind, name }) => {
106
+ if (kind === NOTE_BLOCK) {
107
+ const text = noteTexts.get(name);
108
+ return texts.get(name) !== text ? [changeOf({ file: name, text })] : [];
109
+ }
110
+ return (fileGroups.get(keyOf(kind, name)) ?? []).filter(({ file }) => changed.has(file)).map(changeOf);
111
+ });
104
112
  // The workflow DSL reads a draft, and is loaded only when there is one to read.
105
113
  const dsl = files.some(({ file }) => file.endsWith("/workflow.json")) ? await import("@parcha/agentrun-dsl") : undefined;
114
+ // A draft's example: the run's own input, so read as every text the run gave is, for what must never be stored (a
115
+ // held secret, a secret's shape): one that holds any refuses the whole answer, said at the draft's README, though it
116
+ // is never written there.
117
+ const exampled = files.filter(({ file }) => examples.has(file)).map(({ file }) => ({ path: file.replace(/workflow\.json$/, "README.md"), status: "added", mode: "100644", bytes: Buffer.from(examples.get(file)) }));
118
+ const leaky = unstorable(exampled, input.refuse);
119
+ if (leaky.length)
120
+ return { state: "dropped", reason: "checker", problems: leaky };
106
121
  // A skill or a draft whose seed text has a status is a person's call (retired, or waiting for their OK): never changed.
107
- const check = (some) => checkProposal({ base, changes: some, refuseValues: input.refuse, ...(kept.length ? { kept } : {}), ...(input.outcome === undefined ? {} : { outcome: input.outcome }), ...(input.tools ? { tools: input.tools } : {}), ...(input.gated ? { gated: input.gated } : {}), ...(input.deniedBy ? { deniedBy: input.deniedBy } : {}), ...(dsl ? { dsl } : {}) });
122
+ const dryRuns = {};
123
+ const check = (some) => checkProposal({ base, changes: some, refuseValues: input.refuse, ...(kept.length ? { kept } : {}), ...(input.outcome === undefined ? {} : { outcome: input.outcome }), ...(input.tools ? { tools: input.tools } : {}), ...(input.gated ? { gated: input.gated } : {}), ...(input.deniedBy ? { deniedBy: input.deniedBy } : {}), ...(input.ask ? { ask: input.ask } : {}), ...(dsl ? { dsl, dryRuns } : {}) });
124
+ // The static checks first, every one (validateWorkflow with executeCode: false, draftProblems' refusal of code nodes,
125
+ // caps, secrets): a draft they refuse is never dry-run, nor is any when they refuse the answer whole. Then each draft
126
+ // left is dry-run on its example, else on a synthesized input (learn/skills.ts draftDryRun): every model and tool
127
+ // answer synthesized, nothing sent, paid or run, and no code it holds run in this process.
128
+ if (dsl) {
129
+ const statics = check(changes).problems;
130
+ const whole = statics.some((problem) => WHOLE.has(problem.rule) || problem.path === undefined);
131
+ const refused = new Set(statics.flatMap((problem) => (problem.path === undefined ? [] : [itemOf(problem.path)])));
132
+ if (!whole)
133
+ for (const { file, text } of files)
134
+ if (file.endsWith("/workflow.json") && !refused.has(itemOf(file)))
135
+ dryRuns[file] = await draftDryRun(dsl, text, examples.get(file));
136
+ }
108
137
  // A verdict per item from the checks too: the items a problem names are left out (a draft's two files together),
109
- // and the rest is checked again; a problem that names no item, or one that refuses the whole (WHOLE), drops it all,
110
- // as does a rest the checks still refuse.
138
+ // and the rest is checked again, until it passes; a problem that names no item, or one that refuses the whole (WHOLE),
139
+ // drops it all, as does a rest with nothing left. A later pass can name what an earlier one did not reach (the
140
+ // supersedes count, asked only of a rest with no other problem); each pass leaves out at least one item, so it ends.
111
141
  let checked = check(changes);
112
142
  let left = [];
113
- let passing = files;
143
+ const out = new Set();
114
144
  if (checked.problems.length) {
115
145
  const named = new Set(changes.map(({ path }) => itemOf(path)));
116
- if (checked.problems.some((problem) => WHOLE.has(problem.rule) || problem.path === undefined || !named.has(itemOf(problem.path))))
117
- return { state: "dropped", reason: "checker", problems: checked.problems };
118
146
  // Before any item is kept from an answer the checks refuse: every name and text it gave, read whole. Something
119
147
  // that must never be stored anywhere in it (in an item the checks refused unread, too) refuses it all.
120
148
  const never = unstorable(changes, input.refuse);
121
- if (never.length)
122
- return { state: "dropped", reason: "checker", problems: [...checked.problems, ...never] };
123
- const out = new Set(checked.problems.map((problem) => itemOf(problem.path)));
124
- const rest = changes.filter(({ path }) => !out.has(itemOf(path)));
125
- const again = rest.length ? check(rest) : undefined;
126
- // A rest the checks refuse again: its own problems are what keeps it out, said with the first pass's.
127
- if (!again || again.problems.length)
128
- return { state: "dropped", reason: "checker", problems: [...checked.problems, ...(again?.problems ?? [])] };
129
- left = checked.problems;
130
- checked = again;
131
- passing = files.filter(({ file }) => !out.has(itemOf(file)));
149
+ for (;;) {
150
+ if (checked.problems.some((problem) => WHOLE.has(problem.rule) || problem.path === undefined || !named.has(itemOf(problem.path))))
151
+ return { state: "dropped", reason: "checker", problems: [...left, ...checked.problems] };
152
+ if (never.length)
153
+ return { state: "dropped", reason: "checker", problems: [...left, ...checked.problems, ...never] };
154
+ left = [...left, ...checked.problems];
155
+ for (const problem of checked.problems)
156
+ out.add(itemOf(problem.path));
157
+ const rest = changes.filter(({ path }) => !out.has(itemOf(path)));
158
+ if (!rest.length)
159
+ return { state: "dropped", reason: "checker", problems: left };
160
+ checked = check(rest);
161
+ if (!checked.problems.length)
162
+ break;
163
+ }
132
164
  }
165
+ const passing = files.filter(({ file }) => !out.has(itemOf(file)));
133
166
  if (!checked.notes.length && !passing.length)
134
167
  return { state: "dropped", reason: "empty" };
135
168
  // Each message cut of the host's secrets whole first, and only then shortened: a secret the cut fell inside would
@@ -138,7 +171,9 @@ export const proposeRun = async (input) => {
138
171
  const asked = input.turn.asked.map((message) => shortMessage(redactSecrets(message, input.refuse, Number.POSITIVE_INFINITY)));
139
172
  // A trigger's input, apart from what the user said, cut and shortened the same way.
140
173
  const triggered = (input.turn.triggered ?? []).map(({ source, text }) => ({ source, text: shortMessage(redactSecrets(text, input.refuse, Number.POSITIVE_INFINITY)) }));
141
- const proposal = { seed: input.seed, notes: checked.notes.map(({ file, text }) => ({ file, text })), ...(passing.length ? { files: passing } : {}), asked, ...(triggered.length ? { triggered } : {}) };
174
+ // How each kept draft's dry run went, for the grader: passed, or not run and why.
175
+ const ran = Object.fromEntries(passing.filter(({ file }) => dryRuns[file]).map(({ file }) => [file, dryRuns[file]]));
176
+ const proposal = { seed: input.seed, notes: checked.notes.map(({ file, text }) => ({ file, text })), ...(passing.length ? { files: passing } : {}), ...(Object.keys(ran).length ? { dryRuns: ran } : {}), asked, ...(triggered.length ? { triggered } : {}) };
142
177
  await writeDurable(join(input.runDir, PROPOSAL), `${JSON.stringify(proposal)}\n`);
143
178
  const count = (suffix) => passing.filter(({ file }) => file.endsWith(suffix)).length;
144
179
  return { state: "proposed", notes: proposal.notes.length, skills: count("/SKILL.md"), workflows: count("/workflow.json"), ...(left.length ? { left } : {}) };
@@ -37,7 +37,7 @@ export type PushDeps = {
37
37
  status: number;
38
38
  body: Record<string, unknown>;
39
39
  } | undefined>;
40
- /** A source's sealed setting (sealed-settings.ts): its key, for a scope. */
40
+ /** A source's sealed setting (sealed-settings-store.ts): its key, for a scope. */
41
41
  setting(adapterId: string, scope: string, field: string): string | undefined;
42
42
  /** A refusal, said: its route and why. */
43
43
  refused(route: string, reason: string): void;
@@ -0,0 +1,25 @@
1
+ import type { TimelineEvent } from "./timeline/index.js";
2
+ import type { Status } from "./run-view.js";
3
+ /** 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
4
+ * after it (its rows are those between), its deadline, and how it ended. */
5
+ export type Reflect = {
6
+ outcome: Status;
7
+ after: number;
8
+ until?: number;
9
+ deadline: string;
10
+ ended?: true;
11
+ timedOut?: true;
12
+ };
13
+ /** The run asked its end-of-run turn and has not ended since. */
14
+ export declare const reflecting: (run: {
15
+ meta: {
16
+ reflect?: Reflect;
17
+ };
18
+ }) => boolean;
19
+ /** Whether entry `id` (a number), or the row `id`, is the end-of-run turn's. Before the run has ended every later entry
20
+ * is, and so is a live row. */
21
+ export declare function reflects(reflect: Reflect | undefined, id: string | number): boolean;
22
+ /** `rows` with the end-of-run turn's labelled: never the run's answer (meaningful skips the label), its answer shown as
23
+ * 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
24
+ * the run's store, and no row shows it. */
25
+ export declare function labelled(reflect: Reflect | undefined, rows: TimelineEvent[]): TimelineEvent[];
@@ -0,0 +1,30 @@
1
+ import { LEARNING_LABEL } from "./learning.js";
2
+ import { said } from "./learning-words.js";
3
+ import { askedForDryRun } from "./learn/reflect.js";
4
+ /** The run asked its end-of-run turn and has not ended since. */
5
+ export const reflecting = (run) => run.meta.reflect !== undefined && run.meta.reflect.until === undefined;
6
+ /** A row's store entry, from its id (`<conversation>:<entry>[:...]`); NaN for a row no entry made (a live one, usage). */
7
+ const entryOf = (id) => Number(id.split(":")[1]);
8
+ /** Whether entry `id` (a number), or the row `id`, is the end-of-run turn's. Before the run has ended every later entry
9
+ * is, and so is a live row. */
10
+ export function reflects(reflect, id) {
11
+ if (!reflect)
12
+ return false;
13
+ const entry = typeof id === "number" ? id : entryOf(id);
14
+ if (Number.isInteger(entry))
15
+ return entry > reflect.after && (reflect.until === undefined || entry <= reflect.until);
16
+ return reflect.until === undefined && typeof id === "string" && id.includes(":live:");
17
+ }
18
+ /** `rows` with the end-of-run turn's labelled: never the run's answer (meaningful skips the label), its answer shown as
19
+ * 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
20
+ * the run's store, and no row shows it. */
21
+ export function labelled(reflect, rows) {
22
+ if (!reflect)
23
+ return rows;
24
+ return rows.map((row) => (!reflects(reflect, row.id) ? row : {
25
+ ...row, agent_label: LEARNING_LABEL,
26
+ ...(row.kind === "final_answer" ? { kind: "text_block" } : {}),
27
+ // The turn asked again for a draft whose dry run failed says so; every other message of the turn is its ask.
28
+ ...(row.kind === "user_message" ? (askedForDryRun(row.text) ? { summary: said.askedDryRun, text: said.askedDryRun } : { summary: said.asked, text: said.asked }) : {}),
29
+ }));
30
+ }
@@ -3,6 +3,10 @@ export declare const NOT_RUN = "It was not run: nothing was sent and nothing was
3
3
  /** What a refusal says instead when an earlier attempt of the call may have been sent: an approved call cut mid-flight,
4
4
  * or a replay-safe call the kernel runs again after a crash. Never a claim that nothing was charged. */
5
5
  export declare const RAN_UNKNOWN = "It had started before the deny, and whether it took effect is not known.";
6
+ /** A call that waited for approval when its run was stopped: withdrawn, never sent (its row's words, and its end's). */
7
+ export declare const STOPPED_WHILE_WAITING = "Not run: the run was stopped while it waited";
8
+ /** A call that waited when its run ended (completed or failed) without anyone stopping it: never sent. */
9
+ export declare const ENDED_WHILE_WAITING = "Not run: the run ended while it waited";
6
10
  /** Where a permission was set (permissionFrom's `from`): the agent's own tool settings, the server's, or the default; or
7
11
  * "unattended": an ask the agent's approvals "never" allowed. */
8
12
  export type SettingFrom = "agent" | "server" | "default" | "unattended";
@@ -15,7 +19,7 @@ export declare const denyPlace: (from?: SettingFrom) => string;
15
19
  export declare const deniedText: (tool: string, heldTo?: string, from?: SettingFrom, ran?: "no" | "unknown") => string;
16
20
  /** A workflow model node's tool set to ask: a model node cannot wait for a person's approval (the gate parks no workflow
17
21
  * call), so the call is refused unrun and the model reads why (tool-gate.ts RunGate, on main and on the runner). */
18
- export declare const modelNodeAskText: (tool: string) => string;
22
+ export declare const modelNodeAskText: (tool: string, ran?: "no" | "unknown") => string;
19
23
  /** A workflow call node's tool set to ask: a call node cannot wait for a person's approval, so it is refused unrun
20
24
  * (main's per-run process and the runner's workflow spec, the same words). */
21
25
  export declare const callNodeAskText: (tool: string) => string;
@@ -5,6 +5,10 @@ export const NOT_RUN = "It was not run: nothing was sent and nothing was charged
5
5
  /** What a refusal says instead when an earlier attempt of the call may have been sent: an approved call cut mid-flight,
6
6
  * or a replay-safe call the kernel runs again after a crash. Never a claim that nothing was charged. */
7
7
  export const RAN_UNKNOWN = "It had started before the deny, and whether it took effect is not known.";
8
+ /** A call that waited for approval when its run was stopped: withdrawn, never sent (its row's words, and its end's). */
9
+ export const STOPPED_WHILE_WAITING = "Not run: the run was stopped while it waited";
10
+ /** A call that waited when its run ended (completed or failed) without anyone stopping it: never sent. */
11
+ export const ENDED_WHILE_WAITING = "Not run: the run ended while it waited";
8
12
  /** Where a deny was set, in words: the place a person changes it. */
9
13
  export const denyPlace = (from = "server") => (from === "agent" ? "for this agent" : from === "default" ? "by default" : "on this server");
10
14
  /** The refusal of a call whose tool is set to deny; of one held to another tool's setting (`heldTo`, a shell tool's
@@ -17,7 +21,7 @@ export const deniedText = (tool, heldTo, from = "server", ran = "no") => {
17
21
  };
18
22
  /** A workflow model node's tool set to ask: a model node cannot wait for a person's approval (the gate parks no workflow
19
23
  * call), so the call is refused unrun and the model reads why (tool-gate.ts RunGate, on main and on the runner). */
20
- export const modelNodeAskText = (tool) => `This ${tool} call needs a person's approval, which a workflow's model node cannot wait for; it was not run.`;
24
+ export const modelNodeAskText = (tool, ran = "no") => `This ${tool} call needs a person's approval, which a workflow's model node cannot wait for; ${ran === "no" ? "it was not run." : `it was not run again. ${RAN_UNKNOWN}`}`;
21
25
  /** A workflow call node's tool set to ask: a call node cannot wait for a person's approval, so it is refused unrun
22
26
  * (main's per-run process and the runner's workflow spec, the same words). */
23
27
  export const callNodeAskText = (tool) => `This ${tool} call needs a person's approval, which a workflow's call node cannot wait for; it was not run.`;
package/dist/rows.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import type { TimelineEvent } from "@parcha/pi-durable-agent/timeline";
1
+ import type { TimelineEvent } from "./timeline/index.js";
2
2
  export type Row = TimelineEvent & {
3
3
  seq: number;
4
4
  };
package/dist/run-cut.d.ts CHANGED
@@ -13,12 +13,6 @@ export declare function runCutValues(deps: {
13
13
  }): Promise<{
14
14
  values: string[];
15
15
  } | "unreadable">;
16
- /** Run `runId`'s cut as a function of a text: the one rule its served words are shown by (run-view.ts shownOf: no value
17
- * of the cut set, in any spelling, and no loopback address), or `unreadable` when the run is withheld. */
18
- export declare function runCutOf(deps: {
19
- serverSecrets: () => string[];
20
- signIns?: SignInReader;
21
- }, store: Pick<Store, "runs">, runId: string): Promise<((text: string) => string) | "unreadable">;
22
16
  /** Run `runId`'s error words: how its error text reads wherever it is served (its view's error, its Timeline's error
23
17
  * rows), main's errorWords: a refused key in plain words (key-refusal.ts keyRefusal, the key its harness's route sends
24
18
  * by this server's settings and keys), else the text by the one rule (shownOf); `unreadable` when the run is withheld.
package/dist/run-cut.js CHANGED
@@ -18,12 +18,6 @@ export async function runCutValues(deps, store, runId, known) {
18
18
  return "unreadable";
19
19
  return { values: [...deps.serverSecrets(), ...handed.refs.filter((ref) => ref.length >= MIN_SECRET)] };
20
20
  }
21
- /** Run `runId`'s cut as a function of a text: the one rule its served words are shown by (run-view.ts shownOf: no value
22
- * of the cut set, in any spelling, and no loopback address), or `unreadable` when the run is withheld. */
23
- export async function runCutOf(deps, store, runId) {
24
- const cut = await runCutValues(deps, store, runId);
25
- return cut === "unreadable" ? "unreadable" : shownOf(cut.values);
26
- }
27
21
  /** Run `runId`'s error words: how its error text reads wherever it is served (its view's error, its Timeline's error
28
22
  * rows), main's errorWords: a refused key in plain words (key-refusal.ts keyRefusal, the key its harness's route sends
29
23
  * by this server's settings and keys), else the text by the one rule (shownOf); `unreadable` when the run is withheld.
package/dist/run-db.d.ts CHANGED
@@ -3,17 +3,16 @@ import { DatabaseSync } from "node:sqlite";
3
3
  /** `dropped`: a read of the file alone whose file changed during it, made again (readRunDbSync). */
4
4
  export type RunDbOpen = {
5
5
  file: string;
6
- mode: "read" | "checkpoint" | "dropped";
6
+ mode: "read" | "dropped";
7
7
  held: boolean;
8
8
  };
9
9
  /** Tells `observer` of every open of a run's database from here on (tests); the returned call stops it. */
10
10
  export declare function observeRunDbOpens(observer: (open: RunDbOpen) => void): () => void;
11
11
  /** Tests' seams: `afterPlan`, called between a read's choice of how to open the file and its open; `madeReads`, called
12
- * with each MonotonicReads made; `beforeCheckpoint`, called with the take-back's connection just before its close. */
12
+ * with each MonotonicReads made. */
13
13
  export declare const runDbTestHooks: {
14
14
  afterPlan?: (file: string) => void;
15
15
  madeReads?: (reads: MonotonicReads) => void;
16
- beforeCheckpoint?: (db: DatabaseSync) => void;
17
16
  };
18
17
  /** A read of a run's database file alone whose file changed during it (a run's process wrote and a take-back checkpointed
19
18
  * meanwhile), every try: none of them is shown. */
@@ -52,11 +51,3 @@ export declare class MonotonicReads {
52
51
  /** Forgets run `runId`'s reads: a run that is gone, or whose store was replaced. */
53
52
  forget(runId: string): void;
54
53
  }
55
- /** A read-write open of a run's database while a process holds the run: refused, never made. */
56
- export declare class HeldRunDbError extends Error {
57
- constructor(file: string);
58
- }
59
- /** Checkpoints the run database at `file` into its database file and removes its WAL, once no process holds the run
60
- * (`held` false; true throws HeldRunDbError before any open). A database with no WAL left is untouched but for the
61
- * open. The one read-write open the server makes of a run's database. */
62
- export declare function checkpointRunDb(file: string, held: boolean, platform?: NodeJS.Platform): Promise<void>;
package/dist/run-db.js CHANGED
@@ -7,8 +7,7 @@
7
7
  // guard). The one read-write open is the checkpoint when the server takes the run back (runs.ts), with no process left.
8
8
  import { closeSync, openSync, readSync, statSync } from "node:fs";
9
9
  import { DatabaseSync } from "node:sqlite";
10
- import { forgetWalWalk, walHasCommit } from "@parcha/agentrun-pi/durable";
11
- import { profilePragmas } from "@parcha/pi-durable-disk/internals";
10
+ import { walHasCommit } from "@parcha/agentrun-pi/durable";
12
11
  const observers = new Set();
13
12
  /** Tells `observer` of every open of a run's database from here on (tests); the returned call stops it. */
14
13
  export function observeRunDbOpens(observer) {
@@ -33,7 +32,7 @@ function fileMark(file) {
33
32
  return `${at.ino}:${at.size}:${at.mtimeNs}:${header.toString("hex")}`;
34
33
  }
35
34
  /** Tests' seams: `afterPlan`, called between a read's choice of how to open the file and its open; `madeReads`, called
36
- * with each MonotonicReads made; `beforeCheckpoint`, called with the take-back's connection just before its close. */
35
+ * with each MonotonicReads made. */
37
36
  export const runDbTestHooks = {};
38
37
  /** A read of a run's database file alone whose file changed during it (a run's process wrote and a take-back checkpointed
39
38
  * meanwhile), every try: none of them is shown. */
@@ -115,37 +114,3 @@ export class MonotonicReads {
115
114
  this.#seen.delete(runId);
116
115
  }
117
116
  }
118
- /** A read-write open of a run's database while a process holds the run: refused, never made. */
119
- export class HeldRunDbError extends Error {
120
- constructor(file) {
121
- super(`the server never opens a run's database read-write while a process holds the run (${file})`);
122
- }
123
- }
124
- /** Checkpoints the run database at `file` into its database file and removes its WAL, once no process holds the run
125
- * (`held` false; true throws HeldRunDbError before any open). A database with no WAL left is untouched but for the
126
- * open. The one read-write open the server makes of a run's database. */
127
- export async function checkpointRunDb(file, held, platform = process.platform) {
128
- for (const observer of observers)
129
- observer({ file, mode: "checkpoint", held });
130
- if (held)
131
- throw new HeldRunDbError(file);
132
- const db = new DatabaseSync(file, { timeout: 0 });
133
- try {
134
- // As its writer opened it (pi-durable-disk's exclusive profile): the WAL index in heap, so no -shm is made; and on
135
- // macOS F_FULLFSYNC (`fullfsync`, `checkpoint_fullfsync`), as fsync there leaves the drive's cache unflushed. And
136
- // synchronous FULL whatever level the run's journal runs at, so the checkpoint's copy is synced into the database file
137
- // before the WAL that held it is removed (pi-durable-disk barriers.ts lists this store as FULL).
138
- for (const [pragma, value] of Object.entries(profilePragmas("exclusive", platform, "FULL")))
139
- db.exec(`PRAGMA ${pragma} = ${value}`);
140
- db.prepare("SELECT count(*) FROM sqlite_schema").get();
141
- runDbTestHooks.beforeCheckpoint?.(db);
142
- }
143
- finally {
144
- // The close checkpoints: it copies into the database file only pages the WAL holds too, so a lock-free reader still
145
- // reading the WAL reads the same bytes either way; then it removes the WAL, which a reader that holds it open goes on
146
- // reading. Never wal_checkpoint(TRUNCATE): that cuts the WAL under such a reader, whose read then fails.
147
- db.close();
148
- // The WAL is gone, and with it what was kept of its walk (walHasCommit).
149
- forgetWalWalk(`${file}-wal`);
150
- }
151
- }
@@ -1,4 +1,4 @@
1
- import { type MessageOrigin } from "@parcha/pi-durable-agent/timeline";
1
+ import { type MessageOrigin } from "./timeline/index.js";
2
2
  import type { Plane } from "./tool-plane.js";
3
3
  import type { RunTrigger } from "./triggers.js";
4
4
  import { type Json } from "./validate.js";
@@ -32,6 +32,9 @@ export interface RunLaunch {
32
32
  readonly documents?: string;
33
33
  /** What a run's box may reach, as the server resolved it: the list, or "none". */
34
34
  readonly boxAllow?: readonly string[] | "none";
35
+ /** The operator set AGENTRUN_BOX_ALLOW (box-settings.ts boxAllowSetIn): `boxAllow` is theirs, not the default. A
36
+ * browser is held to an operator's list and runs open under the default. Absent: the default. */
37
+ readonly boxAllowSet?: true;
35
38
  /** The uploaded file ids the run was started with, in order (the create body's file_ids, already checked ready): the
36
39
  * runner copies them into the run's work/inputs/ at its claim, as the old start copied them before the process ran. */
37
40
  readonly files?: readonly string[];
@@ -40,7 +43,12 @@ export interface RunLaunch {
40
43
  * shows them); `seed`, the learning commit's sha (or null when the seed could not be read); and `section`, the exact
41
44
  * # Learned text to lay into the prompt for those notes (what the old layLearned laid), within the learning budget; and
42
45
  * `seedNotes`, the count of all notes in the seed before the budget picked `given` (present with a read seed; absent when
43
- * the seed could not be read). Absent when the run does not learn. */
46
+ * the seed could not be read); `skills`, the names of the learned skills the seed offers the run (each active one that
47
+ * fits a run's skill budget at all; its claim lays them), absent when none; `workflows`, the names of the learned
48
+ * workflows the seed offers its learned_workflow tool (chooseWorkflows), absent when none; `gradeModel`, the model the
49
+ * server names to grade what the run proposes (learning.ts gradeModelOf: --grade-model, else AGENTRUN_SERVE_GRADE_MODEL,
50
+ * else AGENT_MODEL_STRONG), absent when it names none and the agent's own grades it; and `seedFailed`, why it starts with
51
+ * nothing learned when it does (SeedFailed). Absent when the run does not learn. */
44
52
  readonly learning?: {
45
53
  readonly given: readonly {
46
54
  readonly file: string;
@@ -49,6 +57,10 @@ export interface RunLaunch {
49
57
  readonly seed: string | null;
50
58
  readonly section: string;
51
59
  readonly seedNotes?: number;
60
+ readonly skills?: readonly string[];
61
+ readonly workflows?: readonly string[];
62
+ readonly gradeModel?: string;
63
+ readonly seedFailed?: SeedFailed;
52
64
  };
53
65
  /** The trigger and firing that started the run, or none for a person's run. */
54
66
  readonly trigger?: RunTrigger;
@@ -70,3 +82,10 @@ export declare function readLaunchBody(stored: unknown): RunLaunch | undefined;
70
82
  /** The run's learning start (its given notes, its seed sha and its # Learned section), read from one place by learning's
71
83
  * routes and the runner; undefined when the run does not learn. */
72
84
  export declare const learningStartOf: (launch: RunLaunch) => RunLaunch["learning"];
85
+ /** Why a learning run starts with nothing learned, as main says it: its agent's learning folder could not be read
86
+ * (`unreadable`, STOPPED.unreadable), or what was read could not be made into its start (`not_copied`,
87
+ * STOPPED.notCopied). */
88
+ export type SeedFailed = "unreadable" | "not_copied";
89
+ /** A learning start with no seed (no commit of main, runs-over-store.ts learningStartFor): the run learns nothing, is
90
+ * never asked what to keep, and so is never told it learns. Why is its `seedFailed`, when its start records one. */
91
+ export declare const seedFailed: (start: NonNullable<RunLaunch["learning"]>) => boolean;
@@ -6,7 +6,7 @@
6
6
  // The input's origin keeps its fail-safe on read (#1856): a run started by a trigger keeps an origin only when it names
7
7
  // the run's own trigger with owner === (the source is a schedule, whose words its owner wrote when they set it up), else
8
8
  // that trigger's own with owner false, so a forged or lost origin never reads as the person's or the owner's.
9
- import { originOf } from "@parcha/pi-durable-agent/timeline";
9
+ import { originOf } from "./timeline/index.js";
10
10
  import { isObject } from "./validate.js";
11
11
  /** The trigger a launch body names, as read back: `{ id, firing_key }`, or null (triggerOf of the old serve.json). */
12
12
  function readTrigger(value) {
@@ -54,22 +54,26 @@ export function launchBody(launch) {
54
54
  ...(launch.approvers !== undefined ? { approvers: launch.approvers } : {}),
55
55
  ...(launch.documents !== undefined ? { documents: launch.documents } : {}),
56
56
  ...(launch.boxAllow !== undefined ? { box_allow: launch.boxAllow } : {}),
57
+ ...(launch.boxAllowSet ? { box_allow_set: true } : {}),
57
58
  ...(launch.files?.length ? { files: launch.files } : {}),
58
- ...(launch.learning ? { learning: { given: launch.learning.given.map((note) => ({ file: note.file, name: note.name })), seed: launch.learning.seed, section: launch.learning.section, ...(launch.learning.seedNotes !== undefined ? { seedNotes: launch.learning.seedNotes } : {}) } } : {}),
59
+ ...(launch.learning ? { learning: { given: launch.learning.given.map((note) => ({ file: note.file, name: note.name })), seed: launch.learning.seed, section: launch.learning.section, ...(launch.learning.seedNotes !== undefined ? { seedNotes: launch.learning.seedNotes } : {}), ...(launch.learning.skills?.length ? { skills: [...launch.learning.skills] } : {}), ...(launch.learning.workflows?.length ? { workflows: [...launch.learning.workflows] } : {}), ...(launch.learning.gradeModel ? { gradeModel: launch.learning.gradeModel } : {}), ...(launch.learning.seedFailed ? { seedFailed: launch.learning.seedFailed } : {}) } } : {}),
59
60
  ...(launch.trigger ? { trigger: launch.trigger } : {}),
60
61
  ...(launch.inputOrigin ? { input_origin: launch.inputOrigin } : {}),
61
62
  ...(launch.followUp ? { follow_up: true } : {}),
62
63
  };
63
64
  }
64
- /** The learning start a launch body names, as read back: its given notes (each {file, name}), its seed sha and its # Learned
65
- * section text, or undefined when the body names none (a run that does not learn). */
65
+ /** The learning start a launch body names, as read back: its given notes (each {file, name}), its seed sha, its # Learned
66
+ * section text, the learned skills and workflows it was offered, its grade model and why its seed failed, or undefined
67
+ * when the body names none (a run that does not learn). */
66
68
  function readLearning(value) {
67
69
  if (!isObject(value))
68
70
  return undefined;
69
71
  const given = Array.isArray(value.given) ? value.given.flatMap((note) => (isObject(note) && typeof note.file === "string" && typeof note.name === "string" ? [{ file: note.file, name: note.name }] : [])) : [];
70
72
  const seed = typeof value.seed === "string" ? value.seed : null;
71
73
  const section = typeof value.section === "string" ? value.section : "";
72
- return { given, seed, section, ...(typeof value.seedNotes === "number" ? { seedNotes: value.seedNotes } : {}) };
74
+ const names = (list) => (Array.isArray(list) ? list.filter((name) => typeof name === "string") : []);
75
+ const [skills, workflows] = [names(value.skills), names(value.workflows)];
76
+ return { given, seed, section, ...(typeof value.seedNotes === "number" ? { seedNotes: value.seedNotes } : {}), ...(skills.length ? { skills } : {}), ...(workflows.length ? { workflows } : {}), ...(typeof value.gradeModel === "string" && value.gradeModel !== "" ? { gradeModel: value.gradeModel } : {}), ...(typeof value.seedFailed === "string" && SEED_FAILURES.includes(value.seedFailed) ? { seedFailed: value.seedFailed } : {}) };
73
77
  }
74
78
  /** A launch body read back into a `RunLaunch`, with the input-origin fail-safe applied through the body's own trigger, or
75
79
  * undefined when the body is not one (not an object, or it names no place: a damaged or hand-edited body). */
@@ -96,6 +100,7 @@ export function readLaunchBody(stored) {
96
100
  ...(typeof stored.approvers === "boolean" ? { approvers: stored.approvers } : {}),
97
101
  ...(typeof stored.documents === "string" ? { documents: stored.documents } : {}),
98
102
  ...(boxAllow !== undefined ? { boxAllow } : {}),
103
+ ...(stored.box_allow_set === true ? { boxAllowSet: true } : {}),
99
104
  ...(Array.isArray(stored.files) && stored.files.every((id) => typeof id === "string") ? { files: stored.files } : {}),
100
105
  ...(stored.learning !== undefined ? { learning: readLearning(stored.learning) ?? { given: [], seed: null, section: "" } } : {}),
101
106
  ...(trigger ? { trigger } : {}),
@@ -106,3 +111,7 @@ export function readLaunchBody(stored) {
106
111
  /** The run's learning start (its given notes, its seed sha and its # Learned section), read from one place by learning's
107
112
  * routes and the runner; undefined when the run does not learn. */
108
113
  export const learningStartOf = (launch) => launch.learning;
114
+ const SEED_FAILURES = ["unreadable", "not_copied"];
115
+ /** A learning start with no seed (no commit of main, runs-over-store.ts learningStartFor): the run learns nothing, is
116
+ * never asked what to keep, and so is never told it learns. Why is its `seedFailed`, when its start records one. */
117
+ export const seedFailed = (start) => start.seed === null;
@@ -1,9 +1,11 @@
1
+ import { type ItemStatus } from "./learning.js";
1
2
  import { type SignInReader } from "./run-view.js";
2
3
  import type { Store } from "./store/store.js";
3
4
  /** Run `runId`'s learning as GET /runs/{id}/learning serves it, or ApiError forbidden for a withheld run. */
4
5
  export declare function servedRunLearning(deps: {
5
6
  serverSecrets: () => string[];
6
7
  signIns?: SignInReader;
8
+ statuses?: (agentId: string) => Promise<ReadonlyMap<string, ItemStatus> | undefined>;
7
9
  }, store: Store, runId: string): Promise<{
8
10
  seed: string | null;
9
11
  merged: string | null;
@@ -23,13 +25,28 @@ export declare function servedRunLearning(deps: {
23
25
  keep: boolean;
24
26
  }[];
25
27
  } | null;
26
- problems: import("./learn/check.js").Problem[];
28
+ problems: {
29
+ detail: string;
30
+ path?: string | undefined;
31
+ rule: import("./learn/check.js").Rule;
32
+ }[];
27
33
  cost_usd: {
28
34
  grade: number | null;
29
35
  };
30
36
  tokens: {
31
37
  grade: import("./learning.js").Tokens | null;
32
38
  };
39
+ used: {
40
+ skills: {
41
+ name: string;
42
+ read: boolean;
43
+ }[];
44
+ workflows: {
45
+ name: string;
46
+ calls: number;
47
+ failed: number;
48
+ }[];
49
+ };
33
50
  given?: import("./learning.js").NoteUsed[];
34
51
  read?: import("./learning.js").NoteUsed[];
35
52
  learned?: import("./learning.js").NoteLearned[];
@@ -37,12 +54,12 @@ export declare function servedRunLearning(deps: {
37
54
  workflows?: import("./learning.js").LearnedFile[];
38
55
  run: string;
39
56
  state: "proposed" | "merged" | "seeded" | "reflecting" | "dropped";
40
- reason: "empty" | "unparsed" | "seed_failed" | "no_budget" | "unknown_cost" | "cancelled" | "crashed" | "reflect_timeout" | "reflect_failed" | "propose_failed" | "checker" | "grader" | "grade_failed" | null;
57
+ reason: "empty" | "cancelled" | "unparsed" | "seed_failed" | "no_budget" | "unknown_cost" | "crashed" | "reflect_timeout" | "reflect_failed" | "propose_failed" | "checker" | "grader" | "grade_failed" | null;
41
58
  detail: string | null;
42
59
  at: string;
43
60
  } | null>;
44
- /** Run `runId`'s learning diff as GET /runs/{id}/learning/diff serves it (learning-routes.ts runDiffOverStore), cut by the
45
- * run's one cut, or ApiError forbidden for a withheld run. */
61
+ /** Run `runId`'s learning diff as GET /runs/{id}/learning/diff serves it (learning-routes.ts runDiffOverStore), cut as its
62
+ * learning is, or ApiError forbidden for a withheld run. */
46
63
  export declare function servedRunDiff(deps: {
47
64
  serverSecrets: () => string[];
48
65
  signIns?: SignInReader;