@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
@@ -1,8 +1,9 @@
1
- import { type Learning, type NoteUsed, type Shown } from "../learning.js";
1
+ import { type ItemStatus, type Learning, type NoteUsed, type Shown } from "../learning.js";
2
2
  import { type RunLaunch } from "../run-launch.js";
3
- import { type Impact, type Reflect } from "../learning-run.js";
3
+ import { type Impact } from "../learning-run.js";
4
+ import { type Reflect } from "../reflect-range.js";
4
5
  import type { NoteRuns } from "../learning.js";
5
- import type { TimelineEvent } from "@parcha/pi-durable-agent/timeline";
6
+ import type { EntryLike, TimelineEvent } from "../timeline/index.js";
6
7
  import type { AnalyticsFilter } from "./analytics.js";
7
8
  import type { Store } from "../store/store.js";
8
9
  /** A run's learning end: the Learning fields its end sets. */
@@ -23,6 +24,18 @@ export type LearningCounts = {
23
24
  * read as the run's view reads it (runLearningEnd). A workflow's run, and one with no learning, is not counted; nor is
24
25
  * one whose reason this server does not give (an older server's). An imported run keeps no learning in the store. */
25
26
  export declare function learningCountsOverStore(store: Store, filter: AnalyticsFilter): Promise<LearningCounts>;
27
+ /** What learning spent outside any run (GET /usage's `learning` meter) in [from, to) (ms), one entry per run whose
28
+ * learning ended then, as the learning ledger's lines gave it: its agent, when its learning ended, and what its grade
29
+ * cost: 0 for a run never graded, null when the grade's spend is unknown (a grade that failed), never $0 then. One read
30
+ * of the store (Learning.spend), whatever the number of runs. */
31
+ export declare function learningSpendOverStore(store: Store, window: {
32
+ from: number;
33
+ to: number;
34
+ }): Promise<{
35
+ agent: string;
36
+ at: string;
37
+ cost: number | null;
38
+ }[]>;
26
39
  /** An agent's learning counts as its learning view gives them (GET /agents/{id}/learning, learning-run.ts ofAgent's
27
40
  * counts): how its runs that tried to learn fared, less `runs`, from the one store. Its notes' runs and its impact are
28
41
  * agentLearningOverStore's. */
@@ -38,6 +51,15 @@ export declare function agentLearningOverStore(store: Store, agentId: string): P
38
51
  impact: Impact;
39
52
  notes: NoteRuns;
40
53
  }>;
54
+ /** What a run's claim laid of its learning seed: the learned skills and workflows it was given, by name. */
55
+ type Laid = {
56
+ readonly skills: readonly string[];
57
+ readonly workflows: readonly string[];
58
+ };
59
+ /** What every claim of a run laid, from its learningLaid entries, each name once: a resumed claim finds an earlier
60
+ * claim's skill folders there already and lays none of them again, though the run still has them. None laid when it has
61
+ * no entry. */
62
+ export declare function laidOf(entries: readonly EntryLike[]): Laid;
41
63
  /** A run's learning end with the notes its start gave it (`given`, when it started from a seed) and those its job read
42
64
  * (`read`, only when it read one): what a run view and GET /runs/{id}/learning show beside the end. */
43
65
  export type RunLearning = RunLearningEnd & {
@@ -48,13 +70,49 @@ export type RunLearning = RunLearningEnd & {
48
70
  * `read` calls on a file of its copy of the folder, the end-of-run turn's (`reflect`) left out, keyed on the notes it was
49
71
  * `given` and named as given. A file it was not given (MEMORY.md, one it wrote, one not in its seed) is not one of them. */
50
72
  export declare function notesReadOf(given: readonly NoteUsed[] | undefined, reflect: Pick<Reflect, "after" | "until"> | undefined, rows: readonly TimelineEvent[]): NoteUsed[];
73
+ /** What a run's job did with the learned skills and workflows its launch offered it (GET /runs/{id}/learning `used`:
74
+ * its `skills` and `workflows`, apart from the skills and workflows it learned): each skill, and whether the job read its SKILL.md (a read of `.agents/skills/<name>/SKILL.md`, or a
75
+ * harness's own skill tool on it); each learned workflow the job called, by the call's `name` (callArgsOf), how
76
+ * many calls and how many failed. The end-of-run turn's rows are left out, as notesRead leaves them. */
77
+ export type LearnedUse = {
78
+ readonly skills: readonly {
79
+ readonly name: string;
80
+ readonly read: boolean;
81
+ }[];
82
+ readonly workflows: readonly {
83
+ readonly name: string;
84
+ readonly calls: number;
85
+ readonly failed: number;
86
+ }[];
87
+ };
88
+ /** Each tool call of a run's journal, by its call's id: its tool and the arguments it was called with, as recorded (pi's
89
+ * call in its assistant entry, a CLI harness's in its record's call start). A timeline row's input preview is cut and
90
+ * for some tools absent, so what a call read or ran is read from these. */
91
+ export declare function callArgsOf(entries: readonly EntryLike[]): Map<string, {
92
+ tool: string;
93
+ args: Record<string, unknown>;
94
+ }>;
95
+ /** The skills a run's job loaded with a harness's own Skill tool (claude-agent's): a native call, which the CLI's session
96
+ * records as a kernel step of its own (`kernel.start` named `tool.Skill`, keyed `tool:<call id>`, then its `kernel.end`)
97
+ * and never as a host tool's call record, so no timeline row or callArgsOf entry has it. Each by the name the model
98
+ * gave (`agentrun:<name>` or the bare one), only when its step completed, and only outside every end-of-run turn (a
99
+ * reopened run's follow-up's loads are the job's). */
100
+ export declare function nativeSkillLoads(entries: readonly EntryLike[]): string[];
101
+ /** `laid`: what the run's claims laid (laidOf): a skill its launch offered but no claim laid (over the budget, or a name
102
+ * the revision's own skill holds, whose copy is the one installed) is not the run's learned skill, whatever it read.
103
+ * `loads`: the skills its job loaded with a harness's own Skill tool (nativeSkillLoads), each a read of its SKILL.md. */
104
+ export declare function learnedUseOf(started: RunLaunch["learning"], reflect: Pick<Reflect, "after" | "until"> | undefined, rows: readonly TimelineEvent[], args?: ReadonlyMap<string, {
105
+ tool: string;
106
+ args: Record<string, unknown>;
107
+ }>, laid?: Pick<Laid, "skills">, loads?: readonly string[]): LearnedUse;
51
108
  /** `end` with its run's given notes (from its launch's learning start) and the notes its job read. */
52
109
  export declare function withNotes(end: RunLearningEnd, started: RunLaunch["learning"], read: readonly NoteUsed[]): RunLearning;
53
110
  /** GET /runs/{id}/learning from the one store, in the shape the route gives (learning-routes.ts runLearningBody): the
54
111
  * run's learning end (runLearningEnd), the notes it was given and the seed it started from as its launch records them,
55
- * what it held for its owner's OK as the store's run view reads it (no statuses: never the learning folder), settled
56
- * once the run is final. Null when the run kept no learning. */
57
- export declare function runLearningOverStore(store: Store, runId: string, shown: Shown, secrets: readonly string[]): Promise<{
112
+ * what it held for its owner's OK as it stands on its agent's folder's main (`statuses`, learning-routes.ts statusesOf,
113
+ * read only when it held something; none: as the merge wrote it), settled once the run is final. Null when the run kept
114
+ * no learning. */
115
+ export declare function runLearningOverStore(store: Store, runId: string, shown: Shown, secrets: readonly string[], statuses?: (agentId: string) => Promise<ReadonlyMap<string, ItemStatus> | undefined>): Promise<{
58
116
  seed: string | null;
59
117
  merged: string | null;
60
118
  pending: {
@@ -73,13 +131,28 @@ export declare function runLearningOverStore(store: Store, runId: string, shown:
73
131
  keep: boolean;
74
132
  }[];
75
133
  } | null;
76
- problems: import("../learn/check.js").Problem[];
134
+ problems: {
135
+ detail: string;
136
+ path?: string | undefined;
137
+ rule: import("../learn/check.js").Rule;
138
+ }[];
77
139
  cost_usd: {
78
140
  grade: number | null;
79
141
  };
80
142
  tokens: {
81
143
  grade: import("../learning.js").Tokens | null;
82
144
  };
145
+ used: {
146
+ skills: {
147
+ name: string;
148
+ read: boolean;
149
+ }[];
150
+ workflows: {
151
+ name: string;
152
+ calls: number;
153
+ failed: number;
154
+ }[];
155
+ };
83
156
  given?: NoteUsed[];
84
157
  read?: NoteUsed[];
85
158
  learned?: import("../learning.js").NoteLearned[];
@@ -87,7 +160,8 @@ export declare function runLearningOverStore(store: Store, runId: string, shown:
87
160
  workflows?: import("../learning.js").LearnedFile[];
88
161
  run: string;
89
162
  state: "proposed" | "merged" | "seeded" | "reflecting" | "dropped";
90
- reason: "empty" | "unparsed" | "seed_failed" | "no_budget" | "unknown_cost" | "cancelled" | "crashed" | "reflect_timeout" | "reflect_failed" | "propose_failed" | "checker" | "grader" | "grade_failed" | null;
163
+ reason: "empty" | "cancelled" | "unparsed" | "seed_failed" | "no_budget" | "unknown_cost" | "crashed" | "reflect_timeout" | "reflect_failed" | "propose_failed" | "checker" | "grader" | "grade_failed" | null;
91
164
  detail: string | null;
92
165
  at: string;
93
166
  } | null>;
167
+ export {};
@@ -5,13 +5,15 @@
5
5
  // a person's words, the verdict, what it merged, learned, held for the owner's OK and lost, what the checks left out,
6
6
  // and what the grade spent. What the server keeps on a run before its end (what it was given and read, its seed's
7
7
  // notes, its answer's time and costs) is the run's, not this.
8
+ import { posix } from "node:path";
8
9
  import { BACKGROUND_CONTEXT } from "@earendil-works/chord/context";
9
10
  import { currentLearning, holdsForOk, LEARNING_REASONS } from "../learning.js";
10
11
  import { runLearningBody } from "../learning-routes.js";
11
12
  import { learningStartOf, readLaunchBody } from "../run-launch.js";
12
13
  import { learningImpact, noteRuns, notesRead } from "../learning-run.js";
14
+ import { reflects } from "../reflect-range.js";
13
15
  import { notesOf } from "../usage.js";
14
- import { runReflect, runTimeline } from "./journal.js";
16
+ import { runEntries, runReflect, runTimeline } from "./journal.js";
15
17
  import { FINAL_STATES } from "../store/store.js";
16
18
  import { journalEntries } from "../runner/journal-reader.js";
17
19
  import { KINDS } from "../runner/journal-kinds.js";
@@ -109,6 +111,13 @@ export async function learningCountsOverStore(store, filter) {
109
111
  }
110
112
  return out;
111
113
  }
114
+ /** What learning spent outside any run (GET /usage's `learning` meter) in [from, to) (ms), one entry per run whose
115
+ * learning ended then, as the learning ledger's lines gave it: its agent, when its learning ended, and what its grade
116
+ * cost: 0 for a run never graded, null when the grade's spend is unknown (a grade that failed), never $0 then. One read
117
+ * of the store (Learning.spend), whatever the number of runs. */
118
+ export async function learningSpendOverStore(store, window) {
119
+ return (await store.learning.spend(window)).map((one) => ({ agent: one.agentId, at: timeOf(one.at), cost: one.costUsd }));
120
+ }
112
121
  /** An agent's learning counts as its learning view gives them (GET /agents/{id}/learning, learning-run.ts ofAgent's
113
122
  * counts): how its runs that tried to learn fared, less `runs`, from the one store. Its notes' runs and its impact are
114
123
  * agentLearningOverStore's. */
@@ -136,7 +145,14 @@ export async function agentLearningOverStore(store, agentId) {
136
145
  const final = FINAL_STATES.includes(run.state);
137
146
  const started = await learningStartOfRun(store, run.id);
138
147
  const end = await runLearningEnd(store, run.id);
139
- const read = final && started?.given.length ? notesReadOf(started.given, await runReflect(store, run.id, BACKGROUND_CONTEXT), await runTimeline(store, run.id, BACKGROUND_CONTEXT, { settled: true })) : [];
148
+ // What the run's journal says here (the notes its job opened, what its claims laid of the skills and workflows it was
149
+ // offered): read once for a settled run and kept by its epoch (settledJournalReads), else read now.
150
+ const offered = !!(started?.skills?.length || started?.workflows?.length);
151
+ const journal = async () => ({
152
+ read: final && started?.given.length ? notesReadOf(started.given, await runReflect(store, run.id, BACKGROUND_CONTEXT), await runTimeline(store, run.id, BACKGROUND_CONTEXT, { settled: true })) : [],
153
+ laid: offered ? laidOf(await runEntries(store, run.id, BACKGROUND_CONTEXT)) : undefined,
154
+ });
155
+ const { read, laid } = final ? await settledJournalReads(store, run.id, run.epoch, journal) : await journal();
140
156
  if (started || end)
141
157
  files.push(notesOf({ given: started?.given ?? [], read }));
142
158
  // The row learningImpact reads (the file path's RunRow): an ended run is a completed one.
@@ -145,18 +161,58 @@ export async function agentLearningOverStore(store, agentId) {
145
161
  startedAt: new Date(run.startedAt).toISOString(), endedAt: run.endedAt === null ? null : new Date(run.endedAt).toISOString(),
146
162
  costUsd: run.costUsd, importedFrom: run.importedFrom, archivedAt: run.archivedAt === null ? null : new Date(run.archivedAt).toISOString(),
147
163
  });
148
- learnings.set(run.id, end ? impactLearningOf(end, started) : null);
164
+ // What its claims laid of the skills and workflows it was offered (every learningLaid entry, laidOf): the run started
165
+ // from those alone.
166
+ learnings.set(run.id, end ? impactLearningOf(end, started, laid) : null);
149
167
  }
150
168
  return { counts, impact: learningImpact(rows, (row) => learnings.get(row.id) ?? null), notes: noteRuns(files) };
151
169
  }
170
+ /** What a settled run's journal tells the agent's learning view, kept by store and run id with the run's epoch: a claim
171
+ * and a run's end each move the epoch, and only a claim writes to its journal, so a settled run's reads hold until the
172
+ * next claim of it. At most SETTLED_READS_MAX runs a store, the oldest read dropped first. */
173
+ const settledReads = new WeakMap();
174
+ const SETTLED_READS_MAX = 4096;
175
+ async function settledJournalReads(store, runId, epoch, read) {
176
+ let runs = settledReads.get(store);
177
+ if (!runs)
178
+ settledReads.set(store, (runs = new Map()));
179
+ const kept = runs.get(runId);
180
+ if (kept && kept.epoch === epoch)
181
+ return kept.value;
182
+ const value = await read();
183
+ runs.delete(runId);
184
+ runs.set(runId, { epoch, value });
185
+ if (runs.size > SETTLED_READS_MAX)
186
+ runs.delete(runs.keys().next().value);
187
+ return value;
188
+ }
189
+ /** What every claim of a run laid, from its learningLaid entries, each name once: a resumed claim finds an earlier
190
+ * claim's skill folders there already and lays none of them again, though the run still has them. None laid when it has
191
+ * no entry. */
192
+ export function laidOf(entries) {
193
+ const names = (list) => (Array.isArray(list) ? list.filter((name) => typeof name === "string") : []);
194
+ const skills = new Set();
195
+ const workflows = new Set();
196
+ for (const entry of entries) {
197
+ if (entry.kind !== KINDS.learningLaid)
198
+ continue;
199
+ const data = (entry.data ?? {});
200
+ for (const name of names(data.skills))
201
+ skills.add(name);
202
+ for (const name of names(data.workflows))
203
+ workflows.add(name);
204
+ }
205
+ return { skills: [...skills], workflows: [...workflows] };
206
+ }
152
207
  /** What a run's learning end tells its impact, as ofAgent's learningOf read a held run: how it ended and when, the notes
153
208
  * it started from; when its job answered and its costs once it looked back (a look-back of 0 for an ended one that did
154
209
  * not); its grade's cost once it ended (0 when nothing was graded). */
155
- function impactLearningOf(end, started) {
210
+ function impactLearningOf(end, started, laid) {
156
211
  const over = end.state === "merged" || end.state === "dropped";
157
212
  const looked = end.answered_at !== undefined ? { answered_at: end.answered_at, job_cost_usd: end.job_cost_usd ?? null, look_back_usd: end.look_back_usd ?? null } : over ? { look_back_usd: 0 } : {};
158
213
  return {
159
- state: end.state, reason: end.reason, at: end.at, ...(started?.seedNotes !== undefined ? { seed_notes: started.seedNotes } : {}), ...looked,
214
+ state: end.state, reason: end.reason, at: end.at, ...(started?.seedNotes !== undefined ? { seed_notes: started.seedNotes } : {}),
215
+ ...(laid?.skills.length ? { seed_skills: laid.skills.length } : {}), ...(laid?.workflows.length ? { seed_workflows: laid.workflows.length } : {}), ...looked,
160
216
  ...(over ? { grade_usd: end.cost_usd ? end.cost_usd.grade : 0 } : {}),
161
217
  };
162
218
  }
@@ -169,6 +225,120 @@ export function notesReadOf(given, reflect, rows) {
169
225
  const names = new Map(given.map((note) => [note.file, note.name]));
170
226
  return notesRead(reflect, rows).flatMap((file) => (names.has(file) ? [{ file, name: names.get(file) }] : []));
171
227
  }
228
+ /** learned_workflow by every name a harness calls it (runner/learning-end.ts LEARNED_NAMES). */
229
+ const WORKFLOW_CALLS = new Set(["learned_workflow", "mcp__hands__learned_workflow"]);
230
+ /** Each tool call of a run's journal, by its call's id: its tool and the arguments it was called with, as recorded (pi's
231
+ * call in its assistant entry, a CLI harness's in its record's call start). A timeline row's input preview is cut and
232
+ * for some tools absent, so what a call read or ran is read from these. */
233
+ export function callArgsOf(entries) {
234
+ const out = new Map();
235
+ const argsOf = (value) => (value && typeof value === "object" && !Array.isArray(value) ? value : {});
236
+ for (const entry of entries) {
237
+ if (entry.kind === "pi.assistant") {
238
+ for (const part of (entry.model?.[0]?.content ?? [])) {
239
+ if (part?.type === "toolCall" && typeof part.id === "string" && typeof part.name === "string")
240
+ out.set(part.id, { tool: part.name, args: argsOf(part.arguments) });
241
+ }
242
+ }
243
+ else if (entry.kind === KINDS.callStart) {
244
+ const data = (entry.data ?? {});
245
+ if (typeof data.callId === "string" && typeof data.tool === "string")
246
+ out.set(data.callId, { tool: data.tool, args: argsOf(data.input) });
247
+ }
248
+ }
249
+ return out;
250
+ }
251
+ /** The plugin claude-agent serves a run's skills from (@parcha/agentrun-harness-claude CLAUDE_AGENT_SKILLS_PLUGIN): the
252
+ * model loads each as `agentrun:<name>`, or by its bare name. */
253
+ const CLAUDE_SKILLS_PLUGIN = "agentrun";
254
+ /** The id ranges of a run's end-of-run turns, each from its prompt (an endOfRunTurn entry, `role: "person"`) to its
255
+ * answer (`role: "model"`); one with no answer runs to the person's next message (a reopened run's follow-up), else to
256
+ * the end. A reopened run has one per time it looked back. */
257
+ function endOfRunTurns(entries) {
258
+ const turns = [];
259
+ let open;
260
+ for (const entry of [...entries].filter((one) => one.id !== undefined).sort((a, b) => a.id - b.id)) {
261
+ const role = entry.data?.role;
262
+ if (entry.kind === KINDS.endOfRunTurn && role === "person")
263
+ open ??= entry.id;
264
+ else if (open !== undefined && ((entry.kind === KINDS.endOfRunTurn && role === "model") || (entry.kind === KINDS.message && role === "person"))) {
265
+ turns.push([open, entry.id]);
266
+ open = undefined;
267
+ }
268
+ }
269
+ if (open !== undefined)
270
+ turns.push([open, Number.POSITIVE_INFINITY]);
271
+ return turns;
272
+ }
273
+ /** The skills a run's job loaded with a harness's own Skill tool (claude-agent's): a native call, which the CLI's session
274
+ * records as a kernel step of its own (`kernel.start` named `tool.Skill`, keyed `tool:<call id>`, then its `kernel.end`)
275
+ * and never as a host tool's call record, so no timeline row or callArgsOf entry has it. Each by the name the model
276
+ * gave (`agentrun:<name>` or the bare one), only when its step completed, and only outside every end-of-run turn (a
277
+ * reopened run's follow-up's loads are the job's). */
278
+ export function nativeSkillLoads(entries) {
279
+ const turns = endOfRunTurns(entries);
280
+ const inTurn = (id) => id !== undefined && turns.some(([from, to]) => id >= from && id <= to);
281
+ const asked = new Map();
282
+ const loaded = [];
283
+ for (const entry of entries) {
284
+ if (inTurn(entry.id))
285
+ continue;
286
+ const data = (entry.data ?? {});
287
+ if (entry.kind === "kernel.start" && data.name === "tool.Skill" && typeof data.stepId === "string") {
288
+ const skill = data.input?.skill;
289
+ if (typeof skill === "string")
290
+ asked.set(data.stepId, skill);
291
+ }
292
+ else if (entry.kind === "kernel.end" && typeof data.stepId === "string" && data.status === "completed" && asked.has(data.stepId)) {
293
+ loaded.push(asked.get(data.stepId));
294
+ }
295
+ }
296
+ return loaded;
297
+ }
298
+ /** Whether a skill loaded by the name `asked` is skill `name`: by its plugin-qualified name or its bare one. */
299
+ const loadsSkill = (asked, name) => asked === name || asked === `${CLAUDE_SKILLS_PLUGIN}:${name}`;
300
+ /** Where a claim lays a learned skill's SKILL.md in the run's work (learning.ts RUN_SKILLS). */
301
+ const laidSkillPath = (name) => `.agents/skills/${name}/SKILL.md`;
302
+ /** Whether call `call` read skill `name`'s SKILL.md: the read hand on the path its claim laid it at (`.agents/skills/
303
+ * <name>/SKILL.md` in the run's work, relative or absolute under it, never another file whose path ends the same way), a
304
+ * CLI adapter's read_skill_file of the skill's SKILL.md, or a Skill tool call on the skill. */
305
+ function readsSkill(call, name) {
306
+ const text = (key) => (typeof call.args[key] === "string" ? call.args[key] : "");
307
+ if (call.tool === "read" || call.tool === "mcp__hands__read") {
308
+ const path = posix.normalize(text("path"));
309
+ return path === laidSkillPath(name) || (path.startsWith("/") && path.endsWith(`/${laidSkillPath(name)}`));
310
+ }
311
+ if (call.tool === "read_skill_file")
312
+ return text("skill") === name && posix.normalize(text("path")) === "SKILL.md";
313
+ if (call.tool === "Skill")
314
+ return [text("skill"), text("command"), text("name")].some((asked) => loadsSkill(asked, name));
315
+ return false;
316
+ }
317
+ /** `laid`: what the run's claims laid (laidOf): a skill its launch offered but no claim laid (over the budget, or a name
318
+ * the revision's own skill holds, whose copy is the one installed) is not the run's learned skill, whatever it read.
319
+ * `loads`: the skills its job loaded with a harness's own Skill tool (nativeSkillLoads), each a read of its SKILL.md. */
320
+ export function learnedUseOf(started, reflect, rows, args = new Map(), laid = { skills: [] }, loads = []) {
321
+ const job = rows.filter((row) => !reflects(reflect, row.id));
322
+ const results = new Map(job.flatMap((row) => (row.kind === "tool_result" && row.tool_use_id ? [[row.tool_use_id, row.tool_status]] : [])));
323
+ const calls = job.filter((row) => row.kind === "tool_use" && !row.parent_tool_use_id && row.tool_use_id).flatMap((row) => {
324
+ const call = args.get(row.tool_use_id);
325
+ return call ? [{ id: row.tool_use_id, ...call }] : [];
326
+ });
327
+ const installed = new Set(laid.skills);
328
+ const skills = (started?.skills ?? []).filter((name) => installed.has(name)).map((name) => ({ name, read: calls.some((call) => results.get(call.id) === "success" && readsSkill(call, name)) || loads.some((asked) => loadsSkill(asked, name)) }));
329
+ const workflows = new Map();
330
+ for (const call of calls) {
331
+ if (!WORKFLOW_CALLS.has(call.tool) || typeof call.args.name !== "string")
332
+ continue;
333
+ const seen = workflows.get(call.args.name) ?? { calls: 0, failed: 0 };
334
+ seen.calls += 1;
335
+ // Only a result that says so: a call with no result yet (one still running) is no failure.
336
+ if (results.get(call.id) === "failed")
337
+ seen.failed += 1;
338
+ workflows.set(call.args.name, seen);
339
+ }
340
+ return { skills, workflows: [...workflows].map(([name, seen]) => ({ name, ...seen })) };
341
+ }
172
342
  /** `end` with its run's given notes (from its launch's learning start) and the notes its job read. */
173
343
  export function withNotes(end, started, read) {
174
344
  return {
@@ -186,17 +356,20 @@ async function learningStartOfRun(store, runId) {
186
356
  }
187
357
  /** GET /runs/{id}/learning from the one store, in the shape the route gives (learning-routes.ts runLearningBody): the
188
358
  * run's learning end (runLearningEnd), the notes it was given and the seed it started from as its launch records them,
189
- * what it held for its owner's OK as the store's run view reads it (no statuses: never the learning folder), settled
190
- * once the run is final. Null when the run kept no learning. */
191
- export async function runLearningOverStore(store, runId, shown, secrets) {
359
+ * what it held for its owner's OK as it stands on its agent's folder's main (`statuses`, learning-routes.ts statusesOf,
360
+ * read only when it held something; none: as the merge wrote it), settled once the run is final. Null when the run kept
361
+ * no learning. */
362
+ export async function runLearningOverStore(store, runId, shown, secrets, statuses) {
192
363
  const end = await runLearningEnd(store, runId);
193
364
  if (!end)
194
365
  return null;
195
366
  const started = await learningStartOfRun(store, runId);
196
367
  const row = await store.runs.get(runId);
197
368
  const settled = row !== undefined && FINAL_STATES.includes(row.state);
198
- const read = started?.given.length ? notesReadOf(started.given, await runReflect(store, runId, BACKGROUND_CONTEXT), await runTimeline(store, runId, BACKGROUND_CONTEXT, { settled })) : [];
369
+ const used = started?.given.length || started?.skills?.length || started?.workflows?.length;
370
+ const [reflect, rows, entries] = used ? await Promise.all([runReflect(store, runId, BACKGROUND_CONTEXT), runTimeline(store, runId, BACKGROUND_CONTEXT, { settled }), runEntries(store, runId, BACKGROUND_CONTEXT)]) : [undefined, [], []];
371
+ const read = started?.given.length ? notesReadOf(started.given, reflect, rows) : [];
199
372
  const learning = withNotes(end, started, read);
200
- const current = holdsForOk(learning) ? currentLearning(learning, undefined) : learning;
201
- return runLearningBody({ id: runId, learning: current, seed: started?.seed ?? null, settled }, shown, secrets);
373
+ const current = holdsForOk(learning) && row && statuses ? currentLearning(learning, await statuses(row.agentId)) : learning;
374
+ return runLearningBody({ id: runId, learning: current, seed: started?.seed ?? null, settled, used: learnedUseOf(started, reflect, rows, callArgsOf(entries), laidOf(entries), nativeSkillLoads(entries)) }, shown, secrets);
202
375
  }
@@ -1,5 +1,5 @@
1
1
  import type { Context } from "@earendil-works/chord";
2
- import { type WorkflowRunView } from "@parcha/pi-durable-agent/workflow";
2
+ import { type WorkflowRunView } from "../workflow-run.js";
3
3
  import type { Store } from "../store/store.js";
4
4
  /** The workflow run `runId`'s view from A: its graph's node status, and, once it ended, its outcome, the node it escalated
5
5
  * at and its output, read from the run's journal (no claim). Undefined when there is no such run, or its revision is gone
@@ -1,5 +1,5 @@
1
1
  import { BACKGROUND_CONTEXT } from "@earendil-works/chord/context";
2
- import { readWorkflowRun } from "@parcha/pi-durable-agent/workflow";
2
+ import { readWorkflowRun } from "../workflow-run.js";
3
3
  /** The workflow run `runId`'s view from A: its graph's node status, and, once it ended, its outcome, the node it escalated
4
4
  * at and its output, read from the run's journal (no claim). Undefined when there is no such run, or its revision is gone
5
5
  * or is not a workflow. A read never writes or fences. */
@@ -1,4 +1,5 @@
1
- import type { TimelineEvent } from "@parcha/pi-durable-agent/timeline";
1
+ import { type TimelineEvent } from "./timeline/index.js";
2
+ import { type ItemStatus } from "./learning.js";
2
3
  import { type RunMoment, type SignInReader } from "./run-view.js";
3
4
  import { type Store } from "./store/store.js";
4
5
  /** What the store-backed view needs beside the store: where its console lives, every secret it never shows (read now, so
@@ -15,11 +16,28 @@ export interface ViewDeps {
15
16
  * run's error names a refused key in plain words, as its Timeline's error row does. Default: this process's
16
17
  * environment (the server passes it with the keys a person saved). */
17
18
  readonly keyEnv?: () => NodeJS.ProcessEnv;
19
+ /** Each learned item's status on agent `agentId`'s learning folder's main (learning-routes.ts statusesOf): what a run held
20
+ * for its owner's OK reads as it stands there. None: as the merge wrote it. */
21
+ readonly statuses?: (agentId: string) => Promise<ReadonlyMap<string, ItemStatus> | undefined>;
18
22
  }
19
23
  /** GET /runs/{id}'s answer from the store, byte-identical to runs.ts's view for the same run. Undefined for an unknown run. */
20
24
  export declare function viewOverStore(store: Store, runId: string, deps: ViewDeps): Promise<Record<string, unknown> | undefined>;
21
25
  /** The run list's answer from the store, byte-identical to runs.ts's summary: the view's subset a list shows. */
22
26
  export declare function summaryOverStore(store: Store, runId: string, deps: ViewDeps): Promise<Record<string, unknown> | undefined>;
27
+ /** A run's facts as its view states them, and none of its words: its kind, revision, agent, status and times, and whether
28
+ * its output is withheld (`unshown`). What a read that serves its own parts (the graph) needs of the run: read off the
29
+ * run as viewOverStore reads it, with nothing of it served, so nothing is redacted here. Undefined for an unknown run. */
30
+ export declare function factsOverStore(store: Store, runId: string, deps: ViewDeps): Promise<RunStated | undefined>;
31
+ /** A run's facts as its view states them (factsOverStore): no word of it, so nothing in it is redacted. */
32
+ export type RunStated = {
33
+ readonly kind: string;
34
+ readonly revision: string;
35
+ readonly agentId: string;
36
+ readonly status: string;
37
+ readonly createdAt: string;
38
+ readonly endedAt: string | null;
39
+ readonly unshown: boolean;
40
+ };
23
41
  /** A run's live moment from the store (momentOf), for the one acceptance each act a run takes reads. A run no runner holds
24
42
  * (ended, or running with no live claim) reads live false. */
25
43
  export declare function momentOverStore(store: Store, runId: string, deps?: ViewDeps): Promise<RunMoment | undefined>;