@parcha/agentrun-serve 0.1.0-beta.43 → 0.1.0-beta.45

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 (388) hide show
  1. package/CHANGELOG.md +231 -0
  2. package/README.md +580 -320
  3. package/dist/acp-package.d.ts +28 -0
  4. package/dist/acp-package.js +23 -0
  5. package/dist/adapter-facts.d.ts +8 -1
  6. package/dist/adapter-facts.js +9 -1
  7. package/dist/adapters.d.ts +5 -0
  8. package/dist/adapters.js +36 -3
  9. package/dist/agent-delete.d.ts +50 -0
  10. package/dist/agent-delete.js +125 -0
  11. package/dist/agents-store.d.ts +9 -3
  12. package/dist/agents-store.js +22 -8
  13. package/dist/agents.d.ts +5 -1
  14. package/dist/agents.js +8 -4
  15. package/dist/api-only.d.ts +8 -3
  16. package/dist/api-only.js +10 -4
  17. package/dist/archil-routes.d.ts +5 -1
  18. package/dist/archil-routes.js +57 -2
  19. package/dist/browser-wait-ended.d.ts +2 -0
  20. package/dist/browser-wait-ended.js +2 -0
  21. package/dist/calendar/ics-faux.d.ts +3 -1
  22. package/dist/calendar/ics-faux.js +12 -2
  23. package/dist/calendar/tools.js +5 -2
  24. package/dist/chatgpt-plan.js +3 -1
  25. package/dist/claude-login.d.ts +135 -0
  26. package/dist/claude-login.js +244 -0
  27. package/dist/cli.js +92 -22
  28. package/dist/composio-preset.d.ts +4 -3
  29. package/dist/composio-preset.js +81 -11
  30. package/dist/composio-triggers.d.ts +34 -2
  31. package/dist/composio-triggers.js +261 -31
  32. package/dist/computer-attach.d.ts +40 -5
  33. package/dist/computer-attach.js +130 -15
  34. package/dist/computer-keys.d.ts +3 -0
  35. package/dist/computer-keys.js +7 -1
  36. package/dist/computer-live.js +3 -2
  37. package/dist/computer-lost.d.ts +11 -0
  38. package/dist/computer-lost.js +19 -0
  39. package/dist/computer-record.d.ts +10 -2
  40. package/dist/computer-record.js +50 -18
  41. package/dist/computer-setting.d.ts +1 -0
  42. package/dist/computer-setting.js +2 -2
  43. package/dist/computers.d.ts +21 -10
  44. package/dist/computers.js +39 -28
  45. package/dist/console/assets/index-3O2Yl6hZ.js +701 -0
  46. package/dist/console/assets/index-DaFsZuzQ.css +1 -0
  47. package/dist/console/index.html +2 -2
  48. package/dist/decisions.d.ts +1 -1
  49. package/dist/dial-relay.d.ts +29 -0
  50. package/dist/dial-relay.js +94 -0
  51. package/dist/email/tools.js +10 -5
  52. package/dist/env-proxy.d.ts +2 -0
  53. package/dist/env-proxy.js +35 -0
  54. package/dist/errors.d.ts +4 -1
  55. package/dist/errors.js +10 -4
  56. package/dist/faux-computers.d.ts +8 -2
  57. package/dist/faux-computers.js +83 -6
  58. package/dist/harness-archive.d.ts +67 -0
  59. package/dist/harness-archive.js +177 -0
  60. package/dist/harness-goose.d.ts +34 -0
  61. package/dist/harness-goose.js +87 -0
  62. package/dist/harness-install.d.ts +21 -0
  63. package/dist/harness-install.js +24 -11
  64. package/dist/harness-opencode/adapter.js +1 -1
  65. package/dist/harness-table.d.ts +59 -3
  66. package/dist/harness-table.js +119 -14
  67. package/dist/harness.d.ts +17 -1
  68. package/dist/harness.js +22 -11
  69. package/dist/host.d.ts +12 -10
  70. package/dist/host.js +19 -16
  71. package/dist/import-worker.d.ts +3 -0
  72. package/dist/import-worker.js +7 -5
  73. package/dist/import.d.ts +22 -1
  74. package/dist/import.js +141 -28
  75. package/dist/key-check.js +3 -0
  76. package/dist/learn/audit.d.ts +6 -6
  77. package/dist/learn/audit.js +3 -7
  78. package/dist/learn/check.d.ts +26 -89
  79. package/dist/learn/check.js +58 -336
  80. package/dist/learn/commit.d.ts +63 -90
  81. package/dist/learn/commit.js +124 -316
  82. package/dist/learn/compile.d.ts +53 -50
  83. package/dist/learn/compile.js +88 -103
  84. package/dist/learn/corrections.d.ts +13 -0
  85. package/dist/learn/corrections.js +23 -0
  86. package/dist/learn/delete.d.ts +17 -0
  87. package/dist/learn/delete.js +42 -0
  88. package/dist/learn/folder.d.ts +35 -47
  89. package/dist/learn/folder.js +118 -134
  90. package/dist/learn/index.d.ts +3 -5
  91. package/dist/learn/index.js +6 -9
  92. package/dist/learn/learning.sh +45 -15
  93. package/dist/learn/promote.d.ts +20 -2
  94. package/dist/learn/promote.js +17 -4
  95. package/dist/learn/{skills.d.ts → workflow-draft.d.ts} +34 -38
  96. package/dist/learn/{skills.js → workflow-draft.js} +65 -59
  97. package/dist/learn/workflow-nodes.d.ts +22 -1
  98. package/dist/learn/workflow-nodes.js +29 -10
  99. package/dist/learned-workflow.js +2 -2
  100. package/dist/learning-cost.d.ts +127 -13
  101. package/dist/learning-cost.js +142 -10
  102. package/dist/learning-routes.d.ts +99 -170
  103. package/dist/learning-routes.js +199 -420
  104. package/dist/learning-run.d.ts +19 -40
  105. package/dist/learning-run.js +23 -93
  106. package/dist/learning-setting.d.ts +4 -4
  107. package/dist/learning-setting.js +6 -6
  108. package/dist/learning-words.d.ts +28 -74
  109. package/dist/learning-words.js +64 -162
  110. package/dist/learning.d.ts +62 -393
  111. package/dist/learning.js +101 -651
  112. package/dist/listen-first.d.ts +30 -0
  113. package/dist/listen-first.js +115 -0
  114. package/dist/live-reach.d.ts +25 -2
  115. package/dist/live-reach.js +46 -4
  116. package/dist/llms.txt +2 -1
  117. package/dist/local-models.d.ts +3 -11
  118. package/dist/local-models.js +5 -6
  119. package/dist/mcp-servers-store.d.ts +16 -16
  120. package/dist/model-form.js +6 -5
  121. package/dist/model.d.ts +12 -4
  122. package/dist/model.js +41 -16
  123. package/dist/native/binding.js +1 -1
  124. package/dist/native/connection.js +1 -1
  125. package/dist/native/discovery.js +1 -1
  126. package/dist/native/instructions.d.ts +3 -0
  127. package/dist/native/instructions.js +5 -3
  128. package/dist/native/remote-worker-bridge.js +9 -43
  129. package/dist/native/remote.d.ts +8 -15
  130. package/dist/native/remote.js +3 -3
  131. package/dist/native/schema.js +1 -1
  132. package/dist/native/types.d.ts +2 -2
  133. package/dist/openapi.js +375 -347
  134. package/dist/owner.d.ts +8 -0
  135. package/dist/owner.js +11 -0
  136. package/dist/paid-calls.d.ts +14 -0
  137. package/dist/paid-calls.js +31 -1
  138. package/dist/particle-provider.d.ts +11 -0
  139. package/dist/particle-provider.js +135 -0
  140. package/dist/place.d.ts +8 -3
  141. package/dist/place.js +13 -9
  142. package/dist/port-models.d.ts +12 -4
  143. package/dist/port-models.js +28 -11
  144. package/dist/print.d.ts +27 -0
  145. package/dist/print.js +21 -0
  146. package/dist/provider.d.ts +7 -0
  147. package/dist/provider.js +30 -2
  148. package/dist/reflect-range.js +2 -3
  149. package/dist/run-launch.d.ts +14 -28
  150. package/dist/run-launch.js +9 -12
  151. package/dist/run-learning-served.d.ts +16 -90
  152. package/dist/run-listing.d.ts +34 -0
  153. package/dist/run-listing.js +128 -0
  154. package/dist/run-model-key.d.ts +64 -0
  155. package/dist/run-model-key.js +147 -0
  156. package/dist/run-timeline-served.js +5 -3
  157. package/dist/run-trace.d.ts +97 -0
  158. package/dist/run-trace.js +253 -0
  159. package/dist/run-view.d.ts +15 -0
  160. package/dist/run-view.js +9 -0
  161. package/dist/runnable.js +2 -1
  162. package/dist/runner/adapter-loop.d.ts +14 -6
  163. package/dist/runner/adapter-loop.js +25 -14
  164. package/dist/runner/adapter-run-spec.d.ts +22 -7
  165. package/dist/runner/adapter-run-spec.js +130 -77
  166. package/dist/runner/adapters/index.d.ts +4 -2
  167. package/dist/runner/adapters/index.js +35 -4
  168. package/dist/runner/adapters/pi.d.ts +4 -12
  169. package/dist/runner/adapters/pi.js +2 -2
  170. package/dist/runner/audit.d.ts +5 -1
  171. package/dist/runner/audit.js +31 -12
  172. package/dist/runner/beside.d.ts +7 -2
  173. package/dist/runner/beside.js +41 -9
  174. package/dist/runner/claim-secrets.d.ts +66 -1
  175. package/dist/runner/claim-secrets.js +136 -3
  176. package/dist/runner/cli-run-spec.d.ts +2 -1
  177. package/dist/runner/cli-run-spec.js +82 -59
  178. package/dist/runner/commands.d.ts +3 -6
  179. package/dist/runner/conformance/harness.d.ts +6 -0
  180. package/dist/runner/conformance/harness.js +16 -5
  181. package/dist/runner/dispatch.d.ts +2 -2
  182. package/dist/runner/end-of-run.d.ts +6 -14
  183. package/dist/runner/end-of-run.js +8 -33
  184. package/dist/runner/feedback-round.d.ts +5 -4
  185. package/dist/runner/feedback-round.js +14 -10
  186. package/dist/runner/github-app.js +3 -1
  187. package/dist/runner/harness-loops.d.ts +0 -8
  188. package/dist/runner/harness-loops.js +30 -56
  189. package/dist/runner/held.d.ts +170 -0
  190. package/dist/runner/held.js +57 -0
  191. package/dist/runner/journal-kinds.d.ts +7 -3
  192. package/dist/runner/journal-kinds.js +2 -3
  193. package/dist/runner/learned-first.d.ts +40 -0
  194. package/dist/runner/learned-first.js +32 -0
  195. package/dist/runner/learning-end.d.ts +77 -66
  196. package/dist/runner/learning-end.js +250 -299
  197. package/dist/runner/learning-seed.d.ts +15 -33
  198. package/dist/runner/learning-seed.js +24 -45
  199. package/dist/runner/loop-contract.d.ts +8 -3
  200. package/dist/runner/loop-contract.js +4 -0
  201. package/dist/runner/loop.js +6 -2
  202. package/dist/runner/main.d.ts +18 -9
  203. package/dist/runner/main.js +82 -22
  204. package/dist/runner/mcp-run.d.ts +11 -0
  205. package/dist/runner/mcp-run.js +67 -0
  206. package/dist/runner/memory-claim.d.ts +14 -6
  207. package/dist/runner/memory-claim.js +18 -9
  208. package/dist/runner/model-route.d.ts +7 -4
  209. package/dist/runner/model-route.js +22 -10
  210. package/dist/runner/native-loop.d.ts +0 -7
  211. package/dist/runner/native-loop.js +9 -101
  212. package/dist/runner/promotion.d.ts +13 -6
  213. package/dist/runner/promotion.js +63 -17
  214. package/dist/runner/reflect-hook.d.ts +64 -91
  215. package/dist/runner/reflect-hook.js +112 -206
  216. package/dist/runner/run-channel.d.ts +43 -0
  217. package/dist/runner/run-channel.js +467 -0
  218. package/dist/runner/run-child-host.d.ts +169 -0
  219. package/dist/runner/run-child-host.js +1222 -0
  220. package/dist/runner/run-child.d.ts +1 -0
  221. package/dist/runner/run-child.js +254 -0
  222. package/dist/runner/run-errors.d.ts +2 -0
  223. package/dist/runner/run-errors.js +20 -0
  224. package/dist/runner/runner.js +58 -9
  225. package/dist/runner/sdk-ask.d.ts +78 -0
  226. package/dist/runner/sdk-ask.js +158 -0
  227. package/dist/runner/sdk-loop.d.ts +2 -4
  228. package/dist/runner/sdk-loop.js +29 -49
  229. package/dist/runner/store-secrets.d.ts +5 -3
  230. package/dist/runner/store-secrets.js +14 -6
  231. package/dist/runner/workflow-first.d.ts +5 -0
  232. package/dist/runner/workflow-first.js +4 -0
  233. package/dist/runner/workflow-spec.js +17 -4
  234. package/dist/runs-over-store.d.ts +21 -32
  235. package/dist/runs-over-store.js +44 -41
  236. package/dist/sdk/runs.d.ts +6 -11
  237. package/dist/sdk/runs.js +20 -41
  238. package/dist/sdk/schema.js +3 -4
  239. package/dist/sdk/workflows.d.ts +1 -1
  240. package/dist/seal-key.d.ts +5 -0
  241. package/dist/seal-key.js +7 -0
  242. package/dist/secrets.d.ts +3 -0
  243. package/dist/secrets.js +16 -3
  244. package/dist/server.d.ts +119 -83
  245. package/dist/server.js +1121 -419
  246. package/dist/sign-ins-store.d.ts +8 -0
  247. package/dist/sign-ins-store.js +36 -1
  248. package/dist/skills.js +1 -1
  249. package/dist/store/index.d.ts +3 -3
  250. package/dist/store/index.js +2 -2
  251. package/dist/store/journal/storage.js +3 -0
  252. package/dist/store/postgres/migrations/0017_run_listing.sql +83 -0
  253. package/dist/store/postgres/migrations/0018_trigger_template.sql +6 -0
  254. package/dist/store/postgres/migrations/0019_runner_relays.sql +28 -0
  255. package/dist/store/schema.d.ts +53 -4
  256. package/dist/store/schema.js +137 -6
  257. package/dist/store/seal.d.ts +20 -2
  258. package/dist/store/seal.js +24 -8
  259. package/dist/store/sqlite/connection.d.ts +2 -0
  260. package/dist/store/sqlite/connection.js +3 -1
  261. package/dist/store/sqlite/run-launch.d.ts +4 -1
  262. package/dist/store/sqlite/run-launch.js +12 -0
  263. package/dist/store/sqlite/run-patch.d.ts +0 -17
  264. package/dist/store/sqlite/run-patch.js +4 -33
  265. package/dist/store/sqlite/store.d.ts +3 -2
  266. package/dist/store/sqlite/store.js +360 -75
  267. package/dist/store/sqlite/worker.js +25 -0
  268. package/dist/store/store.d.ts +231 -39
  269. package/dist/store/store.js +25 -3
  270. package/dist/store-reads/analytics.js +11 -1
  271. package/dist/store-reads/learning.d.ts +131 -194
  272. package/dist/store-reads/learning.js +292 -301
  273. package/dist/store-reads/loop.d.ts +0 -1
  274. package/dist/store-reads/loop.js +1 -1
  275. package/dist/store-reads/stats.js +13 -3
  276. package/dist/store-view.d.ts +34 -2
  277. package/dist/store-view.js +108 -41
  278. package/dist/telemetry.d.ts +59 -0
  279. package/dist/telemetry.js +153 -0
  280. package/dist/template-eval.d.ts +3 -6
  281. package/dist/template-eval.js +22 -36
  282. package/dist/templates.d.ts +2 -1
  283. package/dist/templates.js +6 -3
  284. package/dist/timeline/index.d.ts +1 -1
  285. package/dist/timeline/index.js +1 -1
  286. package/dist/timeline/timeline.d.ts +5 -1
  287. package/dist/timeline/timeline.js +16 -0
  288. package/dist/tool-gate.d.ts +0 -7
  289. package/dist/tool-gate.js +1 -15
  290. package/dist/tool-keys-store.d.ts +1 -1
  291. package/dist/tool-keys.d.ts +6 -4
  292. package/dist/tool-keys.js +12 -6
  293. package/dist/tool-plane.d.ts +12 -12
  294. package/dist/tools.d.ts +13 -13
  295. package/dist/tools.js +29 -9
  296. package/dist/trigger-adapter.d.ts +3 -0
  297. package/dist/trigger-adapters.d.ts +4 -0
  298. package/dist/trigger-adapters.js +13 -0
  299. package/dist/trigger-composio.d.ts +58 -1
  300. package/dist/trigger-composio.js +160 -6
  301. package/dist/triggers.d.ts +64 -5
  302. package/dist/triggers.js +141 -17
  303. package/dist/validate.d.ts +11 -7
  304. package/dist/validate.js +9 -8
  305. package/dist/webhooks.d.ts +4 -1
  306. package/dist/webhooks.js +11 -4
  307. package/dist/workspace/agent-computer.d.ts +2 -0
  308. package/dist/workspace/agent-computer.js +2 -0
  309. package/dist/workspace/archil-claim.d.ts +7 -0
  310. package/dist/workspace/archil-claim.js +29 -0
  311. package/dist/workspace/archil.d.ts +9 -1
  312. package/dist/workspace/archil.js +165 -3
  313. package/dist/workspace/attach.d.ts +3 -1
  314. package/dist/workspace/attach.js +2 -0
  315. package/dist/workspace/attached-computers.d.ts +16 -5
  316. package/dist/workspace/attached-computers.js +25 -9
  317. package/dist/workspace/computer-deps.js +1 -1
  318. package/dist/workspace/computer-for-claim.d.ts +22 -8
  319. package/dist/workspace/computer-for-claim.js +339 -46
  320. package/dist/workspace/computer-hold.js +2 -1
  321. package/dist/workspace/computer-kept.d.ts +11 -1
  322. package/dist/workspace/computer-kept.js +24 -3
  323. package/dist/workspace/resolve-computer.d.ts +41 -21
  324. package/dist/workspace/resolve-computer.js +172 -64
  325. package/dist/workspace/revision-skills.d.ts +1 -2
  326. package/dist/workspace/revision-skills.js +3 -4
  327. package/dist/workspace/run-workspace.d.ts +1 -1
  328. package/dist/workspace/run-workspace.js +5 -0
  329. package/dist/workspace/synced-folder.d.ts +85 -0
  330. package/dist/workspace/synced-folder.js +230 -0
  331. package/dist/workspace/workspace.d.ts +4 -0
  332. package/launcher/agentrun-serve +1 -1
  333. package/package.json +10 -9
  334. package/templates/README.md +7 -7
  335. package/templates/inbound-lead/agent.md +3 -3
  336. package/templates/inbound-lead/evals/learned-correction/case.yaml +3 -3
  337. package/templates/inbound-lead/evals/learned-correction/fixtures/corrections.md +1 -0
  338. package/templates/inbound-lead/evals/learned-correction/graders/applies-correction.md +22 -0
  339. package/templates/inbound-lead/evals/learned-correction/graders/learned-origin.md +1 -1
  340. package/templates/inbound-lead/evals/learned-correction/prompt.md +1 -1
  341. package/templates/inbound-lead/lead.schema.json +6 -5
  342. package/templates/inbound-lead/rules/RUBRIC.md +4 -4
  343. package/templates/inbound-lead/skills/lead/SKILL.md +4 -4
  344. package/templates/market-monitor/evals/learned-preference/case.yaml +4 -4
  345. package/templates/market-monitor/evals/learned-preference/fixtures/corrections.md +1 -0
  346. package/templates/market-monitor/evals/learned-preference/graders/omits-junior-post.md +3 -3
  347. package/templates/market-monitor/evals/learned-preference/prompt.md +1 -1
  348. package/templates/release-notes/evals/learned-style/case.yaml +4 -4
  349. package/templates/release-notes/evals/learned-style/fixtures/corrections.md +1 -0
  350. package/templates/release-notes/evals/learned-style/graders/same-changes.md +2 -2
  351. package/templates/release-notes/evals/learned-style/prompt.md +1 -1
  352. package/dist/console/assets/index-BrcDSBD8.css +0 -1
  353. package/dist/console/assets/index-Bz6IWncl.js +0 -711
  354. package/dist/learn/grade.d.ts +0 -138
  355. package/dist/learn/grade.js +0 -682
  356. package/dist/learn/notes.d.ts +0 -81
  357. package/dist/learn/notes.js +0 -178
  358. package/dist/learn/reflect.d.ts +0 -77
  359. package/dist/learn/reflect.js +0 -228
  360. package/dist/learn/relevance.d.ts +0 -24
  361. package/dist/learn/relevance.js +0 -91
  362. package/dist/learn/seed-check.d.ts +0 -74
  363. package/dist/learn/seed-check.js +0 -103
  364. package/dist/learning-batch.d.ts +0 -291
  365. package/dist/learning-batch.js +0 -600
  366. package/dist/learning-evals.d.ts +0 -33
  367. package/dist/learning-evals.js +0 -98
  368. package/dist/native/context.d.ts +0 -6
  369. package/dist/native/context.js +0 -22
  370. package/dist/propose.d.ts +0 -52
  371. package/dist/propose.js +0 -224
  372. package/dist/runner/learning-ask.d.ts +0 -47
  373. package/dist/runner/learning-ask.js +0 -128
  374. package/dist/runner/learning-dispatch.d.ts +0 -45
  375. package/dist/runner/learning-dispatch.js +0 -99
  376. package/dist/runner/learning-factory.d.ts +0 -16
  377. package/dist/runner/learning-factory.js +0 -50
  378. package/dist/runner/learning-loop.d.ts +0 -273
  379. package/dist/runner/learning-loop.js +0 -521
  380. package/dist/usage.d.ts +0 -11
  381. package/dist/usage.js +0 -11
  382. package/templates/inbound-lead/evals/learned-correction/fixtures/learning/MEMORY.md +0 -1
  383. package/templates/inbound-lead/evals/learned-correction/fixtures/learning/no-agencies.md +0 -14
  384. package/templates/inbound-lead/evals/learned-correction/graders/applies-note.md +0 -21
  385. package/templates/market-monitor/evals/learned-preference/fixtures/learning/MEMORY.md +0 -1
  386. package/templates/market-monitor/evals/learned-preference/fixtures/learning/skip-junior-job-posts.md +0 -8
  387. package/templates/release-notes/evals/learned-style/fixtures/learning/MEMORY.md +0 -1
  388. package/templates/release-notes/evals/learned-style/fixtures/learning/say-agent-not-bot.md +0 -13
@@ -110,11 +110,8 @@ export type EvalCase = {
110
110
  /** How the case's runs' monid endpoints answer in place of monid (runner/monid-run.ts): `unavailable`, as monid
111
111
  * unreachable does, never sent. The eval's own server's runner alone binds it. Absent: monid. */
112
112
  monid?: MonidFake;
113
- /** The notes a run's agent starts with (not MEMORY.md, which the server builds from them). */
114
- learning: {
115
- file: string;
116
- text: string;
117
- }[];
113
+ /** The owner's corrections a run's agent starts with (its corrections.md, whole). Absent: none. */
114
+ learning?: string;
118
115
  graders: Grader[];
119
116
  /** The case's clock (`now:`, an RFC 3339 date-time with its offset, as written): each run's current date and time,
120
117
  * which the eval's own runner alone sets, and its llm graders are told. Absent: the real clock. */
@@ -141,7 +138,7 @@ export declare class CaseError extends Error {
141
138
  }
142
139
  /** The package in `dir`, checked as the server checks it, and its eval cases (all, or those `names` lists), each read and
143
140
  * checked whole: the prompt, case.yaml against the package (an apply's parameters and grants), each fake MCP server's
144
- * fixture, each learned note as the learning API checks one, and each grader's fields. Nothing runs. PackageError or
141
+ * fixture, its corrections as the learning API checks them, and each grader's fields. Nothing runs. PackageError or
145
142
  * CaseError with every problem found. */
146
143
  export declare function readCases(dir: string, names?: readonly string[]): {
147
144
  pkg: Package;
@@ -3,7 +3,7 @@
3
3
  // Everything goes through the v2 API alone, on an in-process server over a temp data directory by default (an eval never
4
4
  // touches the owner's server) or on one named by its address and token. Per case: a fake MCP server per `mcp` fixture,
5
5
  // saved under its name with no credential and recording every call; the package applied with the case's parameters and
6
- // grants, a fresh agent per run, its learning seeded from the case's notes; one run per `runs` with the prompt's body as
6
+ // grants, a fresh agent per run, its learning seeded from the case's corrections; one run per `runs` with the prompt's body as
7
7
  // its input and the case's cap, on the case's clock when it sets one (`now`), waited for; then its answer, its tool calls (its timeline read with calls=whole, each
8
8
  // call's arguments and its output's head through the run's redaction, and the fakes' own logs) and its files, graded, and held to the package's output schema when it declares one (outputVerdict,
9
9
  // the server's own verdict). Every grader is deterministic but `llm`, which is itself a run on the same
@@ -16,8 +16,7 @@ import { tmpdir } from "node:os";
16
16
  import { join } from "node:path";
17
17
  import { parseDocument } from "yaml";
18
18
  import { answerJson, lastJsonBlock } from "./answer-json.js";
19
- import { checkNote } from "./learn/index.js";
20
- import { NOTE_FILE } from "./learn/notes.js";
19
+ import { correctionsProblems } from "./learn/index.js";
21
20
  import { linkCheck } from "./link-check.js";
22
21
  import { inputMessage } from "./run-manifest.js";
23
22
  import { shownUrl } from "./mcp-probe.js";
@@ -272,7 +271,7 @@ function graderOfType(p, file, text, bad) {
272
271
  }
273
272
  /** The package in `dir`, checked as the server checks it, and its eval cases (all, or those `names` lists), each read and
274
273
  * checked whole: the prompt, case.yaml against the package (an apply's parameters and grants), each fake MCP server's
275
- * fixture, each learned note as the learning API checks one, and each grader's fields. Nothing runs. PackageError or
274
+ * fixture, its corrections as the learning API checks them, and each grader's fields. Nothing runs. PackageError or
276
275
  * CaseError with every problem found. */
277
276
  export function readCases(dir, names) {
278
277
  // The cases are read below, each fixture checked there in the case's own words (a CaseError), not by the package read.
@@ -471,29 +470,18 @@ export function readCases(dir, names) {
471
470
  if (body || fields || f.max_cost_usd !== undefined)
472
471
  bad(`${at}/prompt.md: a feed case's run is started by the package's trigger, on the trigger's input and cap: its prompt.md holds description and runs alone`);
473
472
  }
474
- const learning = [];
473
+ let learning;
475
474
  if (c.learning !== undefined) {
476
- const folder = inside(root, c.learning, "dir");
477
- if (!folder)
478
- bad(`${at}/case.yaml: learning names ${JSON.stringify(c.learning)}, not a folder in the case`);
475
+ const file = inside(root, c.learning, "file");
476
+ if (!file)
477
+ bad(`${at}/case.yaml: learning names ${JSON.stringify(c.learning)}, not a file in the case`);
479
478
  else {
480
- for (const entry of readdirSync(join(root, folder), { withFileTypes: true }).sort((a, b) => (a.name < b.name ? -1 : 1))) {
481
- if (entry.name === "MEMORY.md")
482
- continue;
483
- const path = `${at}/${folder}/${entry.name}`;
484
- if (!entry.isFile() || !NOTE_FILE.test(entry.name)) {
485
- bad(`${path}: a learning folder holds MEMORY.md and notes (<name>.md) only`);
486
- continue;
487
- }
488
- const bytes = readFileSync(join(root, folder, entry.name));
489
- const checked = checkNote(entry.name, bytes);
490
- if (!checked.note)
491
- for (const problem of checked.problems)
492
- bad(`${path}: ${problem.detail}`);
493
- learning.push({ file: entry.name, text: bytes.toString("utf8") });
494
- }
495
- if (!learning.length)
496
- bad(`${at}/${folder}: holds no note`);
479
+ // The owner's corrections as the learning API takes them (PUT .../learning/corrections): one file, within its cap.
480
+ learning = readFileSync(join(root, file), "utf8");
481
+ for (const problem of correctionsProblems(learning))
482
+ bad(`${at}/${file}: ${problem.detail}`);
483
+ if (!learning.trim())
484
+ bad(`${at}/${file}: holds no correction`);
497
485
  }
498
486
  }
499
487
  const graders = [];
@@ -516,7 +504,7 @@ export function readCases(dir, names) {
516
504
  cases.push({
517
505
  name, description: typeof f.description === "string" ? f.description : "", runs: typeof f.runs === "number" ? f.runs : 1,
518
506
  ...(typeof f.max_cost_usd === "number" ? { maxCostUsd: f.max_cost_usd } : {}), input: body, ...(fields ? { fields } : {}),
519
- parameters, grants, mcp, ...(web ? { web } : {}), ...(monid ? { monid } : {}), learning, graders, ...(typeof c.now === "string" ? { now: c.now } : {}), ...(email ? { email } : {}), ...(calendar ? { calendar } : {}), ...(feed ? { feed } : {}),
507
+ parameters, grants, mcp, ...(web ? { web } : {}), ...(monid ? { monid } : {}), ...(learning !== undefined ? { learning } : {}), graders, ...(typeof c.now === "string" ? { now: c.now } : {}), ...(email ? { email } : {}), ...(calendar ? { calendar } : {}), ...(feed ? { feed } : {}),
520
508
  });
521
509
  }
522
510
  if (problems.length)
@@ -1034,7 +1022,7 @@ export async function evalTemplate(options) {
1034
1022
  const work = await workOf(options.data).catch((error) => (removeTree(scratch), Promise.reject(error)));
1035
1023
  if (work) {
1036
1024
  removeTree(scratch);
1037
- throw new Error(`the server on ${options.data} has work of its own: ${work}, which the eval's server and runner would take up: disable its triggers and let its runs and learning batches end (or stop them), then run the eval; or run it without --on-data`);
1025
+ throw new Error(`the server on ${options.data} has work of its own: ${work}, which the eval's server and runner would take up: disable its triggers and let its runs end (or stop them), then run the eval; or run it without --on-data`);
1038
1026
  }
1039
1027
  }
1040
1028
  const { startServe } = await import("./server.js");
@@ -1257,18 +1245,14 @@ async function workOf(data) {
1257
1245
  const store = await openStore({ dataDir: data, role: "server" });
1258
1246
  try {
1259
1247
  const triggers = (await store.triggers.all()).filter((one) => one.enabled && !one.disabled).length;
1260
- // The runs not ended a list shows, and every run a runner would claim: the list leaves out built-in learning runs
1261
- // (a kept learning's), which the eval's runner claims as any other.
1248
+ // The runs not ended a list shows, and every run a runner would claim.
1262
1249
  const runs = new Set();
1263
1250
  for (const state of ["queued", "running", "parked"])
1264
1251
  for (const run of await store.runs.list({ state }))
1265
1252
  runs.add(run.id);
1266
1253
  for (const id of await store.runs.claimable())
1267
1254
  runs.add(id);
1268
- // A learning batch still running, which the eval's server would resume at its start (learning-batch.ts resume), its
1269
- // next rows' runs with it.
1270
- const batches = (await store.settings.all()).filter(({ key, value }) => /^learning_batch\/lb_[0-9a-f]{16}$/.test(key) && isObject(value) && value.status === "running").length;
1271
- const said = [triggers ? `${triggers} enabled trigger${triggers === 1 ? "" : "s"}` : "", runs.size ? `${runs.size} run${runs.size === 1 ? "" : "s"} not ended` : "", batches ? `${batches} learning batch${batches === 1 ? "" : "es"} running` : ""].filter(Boolean);
1255
+ const said = [triggers ? `${triggers} enabled trigger${triggers === 1 ? "" : "s"}` : "", runs.size ? `${runs.size} run${runs.size === 1 ? "" : "s"} not ended` : ""].filter(Boolean);
1272
1256
  return said.length ? said.join(", ") : undefined;
1273
1257
  }
1274
1258
  finally {
@@ -1357,7 +1341,7 @@ async function triggerRun(ctx, name, agentId, triggerId, deliver, hint) {
1357
1341
  await sleep(200);
1358
1342
  }
1359
1343
  }
1360
- /** One run of a case: a fresh agent (so one run's learning never reaches the next), its notes, the run, its grades. An
1344
+ /** One run of a case: a fresh agent (so one run's learning never reaches the next), its corrections, the run, its grades. An
1361
1345
  * email case's run (`mail`) is its trigger's (triggerRun). */
1362
1346
  async function runOnce(ctx, one, n, fakes, mail, feeds) {
1363
1347
  const { api, pkg, options, made } = ctx;
@@ -1400,8 +1384,10 @@ async function runOnce(ctx, one, n, fakes, mail, feeds) {
1400
1384
  const used = Object.fromEntries(Object.entries(isObject(applied.servers) ? applied.servers : {}).filter((entry) => typeof entry[1] === "string"));
1401
1385
  await sameAsLocal(ctx, one, agent, used);
1402
1386
  stopped();
1403
- for (const note of one.learning) {
1404
- expectOk(`seeding the note ${note.file}`, await api("PUT", `/agents/${encodeURIComponent(agentId)}/learning/files/${encodeURIComponent(note.file)}`, note.text, { "if-none-match": "*" }));
1387
+ if (one.learning !== undefined) {
1388
+ const corrections = `/agents/${encodeURIComponent(agentId)}/learning/corrections`;
1389
+ const read = expectOk("reading the agent's corrections", await api("GET", corrections));
1390
+ expectOk("seeding the agent's corrections", await api("PUT", corrections, { text: one.learning }, { "if-match": String(read.etag) }));
1405
1391
  }
1406
1392
  stopped();
1407
1393
  // The case's fakes, for this run's agent alone, before its run can be claimed.
@@ -383,7 +383,7 @@ export declare class TemplateRegistry {
383
383
  /** Whether an imported package of that id was there to remove. */
384
384
  remove(id: string): boolean;
385
385
  }
386
- /** POST /v2/templates/{name}/apply's body (`{parameters, grants?, overrides?: {model?, choice?, approvals?}}`), checked
386
+ /** POST /v2/templates/{name}/apply's body (`{parameters, grants?, servers?, overrides?: {model?, choice?, approvals?}, agent_id?}`), checked
387
387
  * against the package: the parameters as given (a blank one at its default), the MCP tools the owner allows (each one the
388
388
  * package lists, by its gate name), and the model asked for in place of the package's: one of its own (`model`), or one
389
389
  * of the package's model choices by id (`choice`), never both. 422 naming every field that is wrong. */
@@ -394,6 +394,7 @@ export declare function applyBodyOf(p: Package, body: Json): {
394
394
  model?: string;
395
395
  choice?: ModelChoice;
396
396
  approvals?: Approvals;
397
+ agentId?: string;
397
398
  };
398
399
  /** The model a package's agent gets here, as `{model?, warning?}`: its `prefer` when this server runs it on `harness`
399
400
  * with a key for its provider, else `refused` (preferUnrunnable): apply makes nothing, never the tier's model in its
package/dist/templates.js CHANGED
@@ -1027,12 +1027,15 @@ export class TemplateRegistry {
1027
1027
  return this.imported.delete(id);
1028
1028
  }
1029
1029
  }
1030
- /** POST /v2/templates/{name}/apply's body (`{parameters, grants?, overrides?: {model?, choice?, approvals?}}`), checked
1030
+ /** POST /v2/templates/{name}/apply's body (`{parameters, grants?, servers?, overrides?: {model?, choice?, approvals?}, agent_id?}`), checked
1031
1031
  * against the package: the parameters as given (a blank one at its default), the MCP tools the owner allows (each one the
1032
1032
  * package lists, by its gate name), and the model asked for in place of the package's: one of its own (`model`), or one
1033
1033
  * of the package's model choices by id (`choice`), never both. 422 naming every field that is wrong. */
1034
1034
  export function applyBodyOf(p, body) {
1035
- const issues = unknownFields(body, ["parameters", "grants", "servers", "overrides"]);
1035
+ const issues = unknownFields(body, ["parameters", "grants", "servers", "overrides", "agent_id"]);
1036
+ // The agent an update writes onto (the server checks it was made from this package): text, else a 422 with the rest.
1037
+ if (body.agent_id !== undefined && !(typeof body.agent_id === "string" && body.agent_id.trim()))
1038
+ issues.push({ field: "agent_id", reason: "wrong_type", message: `agent_id is the id of an agent the ${p.name} template made: the apply writes a new revision of it in place of making another` });
1036
1039
  const listed = p.mcp.flatMap(({ toolkit, tools }) => tools.map((tool) => mcpToolName(toolkit, tool)));
1037
1040
  const grants = [];
1038
1041
  if (body.grants !== undefined && !Array.isArray(body.grants))
@@ -1088,7 +1091,7 @@ export function applyBodyOf(p, body) {
1088
1091
  }
1089
1092
  if (issues.length)
1090
1093
  throw invalid(issues);
1091
- return { parameters, grants, servers, ...(isObject(overrides) && typeof overrides.model === "string" ? { model: overrides.model } : {}), ...(choice ? { choice } : {}), ...(isObject(overrides) && (overrides.approvals === "ask" || overrides.approvals === "never") ? { approvals: overrides.approvals } : {}) };
1094
+ return { parameters, grants, servers, ...(typeof body.agent_id === "string" ? { agentId: body.agent_id.trim() } : {}), ...(isObject(overrides) && typeof overrides.model === "string" ? { model: overrides.model } : {}), ...(choice ? { choice } : {}), ...(isObject(overrides) && (overrides.approvals === "ask" || overrides.approvals === "never") ? { approvals: overrides.approvals } : {}) };
1092
1095
  }
1093
1096
  /** The model a package's agent gets here, as `{model?, warning?}`: its `prefer` when this server runs it on `harness`
1094
1097
  * with a key for its provider, else `refused` (preferUnrunnable): apply makes nothing, never the tier's model in its
@@ -6,4 +6,4 @@ export { costLabel, endedUsage, PAGE_CHANGED_ROW, RUN_RESUMED, toolCallWords, TU
6
6
  export { FEEDBACK_SUFFIX, isFeedbackRow, isMessageRow, isUserEntry, MESSAGE_ORIGIN, messageOrigins, NOTE_SUFFIX, originMatcher, originOf, TRIGGER_LABELS, TRIGGER_SOURCES, type MessageOrigin, type TriggerSource } from "./origin.js";
7
7
  export { cut, scrubUrl, scrubUrls } from "./util.js";
8
8
  export { webCut, webShownOf, webWithin, type WebShown } from "./web-calls.js";
9
- export { BROWSER_CHARGE, CALL_ENDED_WITH_RUN, CALL_REFUSED, CALL_RESULT_CHARS, CAP_WRAPUP, CAPS, chargedTool, COMPUTER_NOTE, endedOnTurnEndingTool, HOST_PHASE, METRIC_NAMES, REQUEST_CONTINUED, REQUEST_COST, REQUEST_COST_LATE, REQUEST_COST_PENDING, REQUEST_ENDED, REQUEST_REFUSED, REQUEST_STARTED, runMetricsOf, runMetricsWithDecisions, timelineOf, timelineReducer, TOOL_COST, TOOL_STARTED, TOOL_UNMETERED, type AgentEventLike, type DecisionLike, type EntryLike, type RunMetrics, type SideSpend, type TimelineEvent, type TimelineKind, type TimelineOptions, type ToolMetrics, } from "./timeline.js";
9
+ export { answeredRequests, BROWSER_CHARGE, CALL_ENDED_WITH_RUN, CALL_REFUSED, CALL_RESULT_CHARS, CAP_WRAPUP, CAPS, chargedTool, COMPUTER_NOTE, endedOnTurnEndingTool, HOST_PHASE, METRIC_NAMES, REQUEST_CONTINUED, REQUEST_COST, REQUEST_COST_LATE, REQUEST_COST_PENDING, REQUEST_ENDED, REQUEST_REFUSED, REQUEST_STARTED, runMetricsOf, runMetricsWithDecisions, timelineOf, timelineReducer, TOOL_COST, TOOL_STARTED, TOOL_UNMETERED, type AgentEventLike, type DecisionLike, type EntryLike, type RunMetrics, type SideSpend, type TimelineEvent, type TimelineKind, type TimelineOptions, type ToolMetrics, } from "./timeline.js";
@@ -6,4 +6,4 @@ export { costLabel, endedUsage, PAGE_CHANGED_ROW, RUN_RESUMED, toolCallWords, TU
6
6
  export { FEEDBACK_SUFFIX, isFeedbackRow, isMessageRow, isUserEntry, MESSAGE_ORIGIN, messageOrigins, NOTE_SUFFIX, originMatcher, originOf, TRIGGER_LABELS, TRIGGER_SOURCES } from "./origin.js";
7
7
  export { cut, scrubUrl, scrubUrls } from "./util.js";
8
8
  export { webCut, webShownOf, webWithin } from "./web-calls.js";
9
- export { BROWSER_CHARGE, CALL_ENDED_WITH_RUN, CALL_REFUSED, CALL_RESULT_CHARS, CAP_WRAPUP, CAPS, chargedTool, COMPUTER_NOTE, endedOnTurnEndingTool, HOST_PHASE, METRIC_NAMES, REQUEST_CONTINUED, REQUEST_COST, REQUEST_COST_LATE, REQUEST_COST_PENDING, REQUEST_ENDED, REQUEST_REFUSED, REQUEST_STARTED, runMetricsOf, runMetricsWithDecisions, timelineOf, timelineReducer, TOOL_COST, TOOL_STARTED, TOOL_UNMETERED, } from "./timeline.js";
9
+ export { answeredRequests, BROWSER_CHARGE, CALL_ENDED_WITH_RUN, CALL_REFUSED, CALL_RESULT_CHARS, CAP_WRAPUP, CAPS, chargedTool, COMPUTER_NOTE, endedOnTurnEndingTool, HOST_PHASE, METRIC_NAMES, REQUEST_CONTINUED, REQUEST_COST, REQUEST_COST_LATE, REQUEST_COST_PENDING, REQUEST_ENDED, REQUEST_REFUSED, REQUEST_STARTED, runMetricsOf, runMetricsWithDecisions, timelineOf, timelineReducer, TOOL_COST, TOOL_STARTED, TOOL_UNMETERED, } from "./timeline.js";
@@ -5,7 +5,7 @@ import type { ComputerCallRow } from "./computer.js";
5
5
  export type TimelineKind = "thinking" | "text_block" | "tool_use" | "tool_result" | "phase" | "subagent_started" | "subagent_progress" | "subagent_completed" | "final_answer" | "error" | "user_message" | "waiting" | "usage"
6
6
  /** A workflow decision: a judge's answers or a route's branch (serve's decision rows). */
7
7
  | "decision"
8
- /** Where a run's learning ended: proposed, merged or dropped (serve's learning row). */
8
+ /** Where a run's learning ended: merged or dropped (serve's learning row). */
9
9
  | "learning"
10
10
  /** A tool call that waited for a person's approval, after its result's row (serve's tool gate). */
11
11
  | "tool_approval_requested";
@@ -365,3 +365,7 @@ export declare function timelineReducer(options?: TimelineOptions): {
365
365
  * conversation no longer holds it. */
366
366
  isLive: (id: string) => boolean;
367
367
  };
368
+ /** The run's model requests that an answer of pi's carries, in log order: each `pi.assistant` entry the usage row counts
369
+ * as a request (createMeter's "answer"). A request the cap or the proxy refused before it left, a continuation of the
370
+ * answer before it and a call the loop's record kept (`recordedCall`) are none. An entry seen twice counts once. */
371
+ export declare function answeredRequests(entries: readonly EntryLike[]): EntryLike[];
@@ -1467,3 +1467,19 @@ export function timelineReducer(options = {}) {
1467
1467
  isLive: (id) => liveIds.has(id),
1468
1468
  };
1469
1469
  }
1470
+ /** The run's model requests that an answer of pi's carries, in log order: each `pi.assistant` entry the usage row counts
1471
+ * as a request (createMeter's "answer"). A request the cap or the proxy refused before it left, a continuation of the
1472
+ * answer before it and a call the loop's record kept (`recordedCall`) are none. An entry seen twice counts once. */
1473
+ export function answeredRequests(entries) {
1474
+ const meter = createMeter();
1475
+ const seen = new Set();
1476
+ return entries.filter((entry) => {
1477
+ if (entry.id !== undefined) {
1478
+ const key = `${entry.conversationId ?? 0}:${entry.id}`;
1479
+ if (seen.has(key))
1480
+ return false;
1481
+ seen.add(key);
1482
+ }
1483
+ return meter.push(entry) === "answer";
1484
+ });
1485
+ }
@@ -157,13 +157,6 @@ export declare const noApproverText: (tool: string, ran?: "no" | "unknown", beca
157
157
  export declare const APPROVAL_ROW: "tool_approval_requested";
158
158
  /** A call's arguments shown on its approval, at most this many bytes. */
159
159
  export declare const ARGS_PREVIEW_BYTES = 2048;
160
- /** The refusal of the end-of-run turn's write or edit under work/.learning/: its notes are kept only from its answer's
161
- * note blocks (learn/reflect.ts parseReflection), which the host merges in its own store; a file there is never kept. */
162
- export declare const NOTE_ONLY_TEXT = "A note is kept only from your answer: write it in a ```note block, not to a file.";
163
- /** Whether `args.path`, as a file tool resolves it (a leading `@` dropped, Unicode spaces made plain, then the port's
164
- * path of it, portPath), names .learning/ in the run's folder or a path under it: by the folder's path here (`work`)
165
- * or a computer's name for it (COMPUTER_ROOT). */
166
- export declare function underLearning(work: string, args: unknown): boolean;
167
160
  /** One call that waits for approval, as the run's store keeps it. */
168
161
  export type ApprovalRequest = {
169
162
  id: string;
package/dist/tool-gate.js CHANGED
@@ -26,8 +26,7 @@
26
26
  // in words, never parked.
27
27
  import { COMPUTER_OP_TOOL, computerToolDefs, defaultPermissionOf, SHELL_FAMILY, SHELL_WATCHERS, shellPermission, shellToolOf } from "@parcha/agentrun-kernel/kernel";
28
28
  import { READ_SKILL_FILE } from "@parcha/agentrun-kernel";
29
- import { LEARNED_DIR } from "./learning.js";
30
- import { COMPUTER_ROOT, portPath } from "./workspace/paths.js";
29
+ import { COMPUTER_ROOT } from "./workspace/paths.js";
31
30
  import { builtinHarness } from "./harness-table.js";
32
31
  import { META_TOOLS } from "./meta-tool-names.js";
33
32
  import { DEFAULT_HARNESS } from "./harness.js";
@@ -338,19 +337,6 @@ export const noApproverText = (tool, ran = "no", because) => because === undefin
338
337
  export const APPROVAL_ROW = "tool_approval_requested";
339
338
  /** A call's arguments shown on its approval, at most this many bytes. */
340
339
  export const ARGS_PREVIEW_BYTES = 2048;
341
- /** The refusal of the end-of-run turn's write or edit under work/.learning/: its notes are kept only from its answer's
342
- * note blocks (learn/reflect.ts parseReflection), which the host merges in its own store; a file there is never kept. */
343
- export const NOTE_ONLY_TEXT = "A note is kept only from your answer: write it in a ```note block, not to a file.";
344
- /** Whether `args.path`, as a file tool resolves it (a leading `@` dropped, Unicode spaces made plain, then the port's
345
- * path of it, portPath), names .learning/ in the run's folder or a path under it: by the folder's path here (`work`)
346
- * or a computer's name for it (COMPUTER_ROOT). */
347
- export function underLearning(work, args) {
348
- const path = args?.path;
349
- if (typeof path !== "string")
350
- return false;
351
- const plain = path.replace(/[\u00A0\u2002-\u200A\u202F\u205F\u3000]/g, " ").replace(/^@/, "");
352
- return portPath(plain, [work, COMPUTER_ROOT])?.split("/")[0] === LEARNED_DIR;
353
- }
354
340
  /** `text` cut to at most ARGS_PREVIEW_BYTES. What is shown of a call's arguments is the whole of them redacted first, then
355
341
  * cut (runs.ts), so a cut never leaves the head of a key no redaction recognizes. */
356
342
  export function previewOf(text) {
@@ -69,7 +69,7 @@ declare class ToolKeysOverStore {
69
69
  at: string;
70
70
  } | null;
71
71
  unlocks: string[];
72
- harnesses: ("opencode" | "codex" | "pi" | "claude-agent")[];
72
+ harnesses: string[];
73
73
  id: string;
74
74
  kind: "model" | "tool";
75
75
  label: string;
@@ -50,7 +50,8 @@ export declare const TOOL_KEYS: readonly [{
50
50
  export declare const TOOL_FIELDS: readonly string[];
51
51
  /** What `candidates` unlock here, as capabilities show it: the tools of `tools` (capabilities' `tools`, available or
52
52
  * not) and the providers of `providers` (its `workflows.decisions.providers`) named among them, and the harnesses
53
- * that run those tools. A name neither holds is left out; a key that unlocks none of its names lists nothing. */
53
+ * that run those tools: the built-in ones first, then any other the tools run on (Goose once its owner installs it). A
54
+ * name neither holds is left out; a key that unlocks none of its names lists nothing. */
54
55
  export declare function unlockedBy(candidates: readonly string[], tools: readonly {
55
56
  name: string;
56
57
  harnesses: readonly string[];
@@ -58,14 +59,15 @@ export declare function unlockedBy(candidates: readonly string[], tools: readonl
58
59
  id: string;
59
60
  }[]): {
60
61
  unlocks: string[];
61
- harnesses: ("opencode" | "codex" | "pi" | "claude-agent")[];
62
+ harnesses: string[];
62
63
  };
63
64
  /** What a row unlocks here: a `tool` row's, its tools and providers as capabilities bind them (unlockedBy); any other
64
65
  * kind's (a model's), no tool, on those that run on it (its `harnesses`, when it names them) that this server runs
65
66
  * (`offers`, harness.ts' harnessOffers) on the row's key: one whose `keys` (the model keys that run it here, available
66
67
  * now or once one is saved) include the row's (its first field). So OpenRouter's row names all three before any key
67
68
  * is saved, and no row changes when another provider's key is saved; a harness not installed, off its pins or too big
68
- * for this host is left out. */
69
+ * for this host is left out. A harness the server lists beyond the built-in ones (Goose once its owner installs it: it
70
+ * has no offer before) is named, after them, where its own offer's `keys` name the row's. */
69
71
  export declare function rowUnlocks(row: {
70
72
  kind: string;
71
73
  unlocks: readonly string[];
@@ -77,7 +79,7 @@ export declare function rowUnlocks(row: {
77
79
  keys?: readonly string[];
78
80
  }[]): {
79
81
  unlocks: string[];
80
- harnesses: ("opencode" | "codex" | "pi" | "claude-agent")[];
82
+ harnesses: string[];
81
83
  };
82
84
  /** Whether a key row's `unlock` unlocks the tool `name`: by its name, or `<source>:*` for every tool of a catalog source
83
85
  * (`monid:*`: `monid:apollo/people/match`, `monid:apollo/*`). */
package/dist/tool-keys.js CHANGED
@@ -29,21 +29,25 @@ export const TOOL_KEYS = [
29
29
  export const TOOL_FIELDS = TOOL_KEYS.filter((row) => row.kind === "tool").flatMap((row) => row.fields);
30
30
  /** What `candidates` unlock here, as capabilities show it: the tools of `tools` (capabilities' `tools`, available or
31
31
  * not) and the providers of `providers` (its `workflows.decisions.providers`) named among them, and the harnesses
32
- * that run those tools. A name neither holds is left out; a key that unlocks none of its names lists nothing. */
32
+ * that run those tools: the built-in ones first, then any other the tools run on (Goose once its owner installs it). A
33
+ * name neither holds is left out; a key that unlocks none of its names lists nothing. */
33
34
  export function unlockedBy(candidates, tools, providers) {
34
35
  const bound = new Set([...tools.map((tool) => tool.name), ...providers.map((provider) => `decisions.${provider.id}`)]);
35
36
  // A catalog source's tools (`monid:*`) are granted by name, never listed: the source is shown as it is, and its tools are
36
- // host tools, run on every harness.
37
+ // host tools, run on every harness: the built-in ones and any other a tool here runs on.
37
38
  const unlocks = candidates.filter((name) => bound.has(name) || name.endsWith(":*"));
38
- const run = new Set(tools.filter((tool) => unlocks.includes(tool.name)).flatMap((tool) => tool.harnesses));
39
- return { unlocks, harnesses: HARNESSES.filter((harness) => run.has(harness) || unlocks.some((name) => name.endsWith(":*"))) };
39
+ const every = unlocks.some((name) => name.endsWith(":*"));
40
+ const run = new Set(tools.filter((tool) => every || unlocks.includes(tool.name)).flatMap((tool) => tool.harnesses));
41
+ const listed = [...run].filter((harness) => !HARNESSES.includes(harness));
42
+ return { unlocks, harnesses: [...HARNESSES.filter((harness) => every || run.has(harness)), ...listed] };
40
43
  }
41
44
  /** What a row unlocks here: a `tool` row's, its tools and providers as capabilities bind them (unlockedBy); any other
42
45
  * kind's (a model's), no tool, on those that run on it (its `harnesses`, when it names them) that this server runs
43
46
  * (`offers`, harness.ts' harnessOffers) on the row's key: one whose `keys` (the model keys that run it here, available
44
47
  * now or once one is saved) include the row's (its first field). So OpenRouter's row names all three before any key
45
48
  * is saved, and no row changes when another provider's key is saved; a harness not installed, off its pins or too big
46
- * for this host is left out. */
49
+ * for this host is left out. A harness the server lists beyond the built-in ones (Goose once its owner installs it: it
50
+ * has no offer before) is named, after them, where its own offer's `keys` name the row's. */
47
51
  export function rowUnlocks(row, tools, providers, offers) {
48
52
  if (row.kind === "tool")
49
53
  return unlockedBy(row.unlocks, tools, providers);
@@ -51,7 +55,9 @@ export function rowUnlocks(row, tools, providers, offers) {
51
55
  // Where an offer knows which model keys run it (its `keys`), the row's key must be one of them, available now or not;
52
56
  // else (no key runs it: pi on any, or one unavailable for another reason) whether it runs here now.
53
57
  const runs = (harness) => offers.some((offer) => offer.id === harness && (offer.keys ? key !== undefined && offer.keys.includes(key) : offer.available));
54
- return { unlocks: [], harnesses: HARNESSES.filter((harness) => (row.harnesses ?? HARNESSES).includes(harness) && runs(harness)) };
58
+ const builtin = HARNESSES.filter((harness) => (row.harnesses ?? HARNESSES).includes(harness) && runs(harness));
59
+ const listed = offers.filter((offer) => !HARNESSES.includes(offer.id) && key !== undefined && offer.keys?.includes(key)).map((offer) => offer.id);
60
+ return { unlocks: [], harnesses: [...builtin, ...listed] };
55
61
  }
56
62
  /** Whether a key row's `unlock` unlocks the tool `name`: by its name, or `<source>:*` for every tool of a catalog source
57
63
  * (`monid:*`: `monid:apollo/people/match`, `monid:apollo/*`). */
@@ -39,11 +39,11 @@ export declare const permissionsOf: (name: string) => readonly Permission[];
39
39
  * give it: the one in force under the server's settings (`permission`), the owner's default (`default_permission`) and
40
40
  * those it may be set to. An agent's read gives the same, the agent's own layer over it (agentTools). */
41
41
  export declare const serverGate: (name: string, settings: ToolSettingsMap, effect?: ToolEffect) => {
42
- default_permission: "allow" | "ask" | "deny";
43
- permissions: ("allow" | "ask" | "deny")[];
42
+ default_permission: "ask" | "allow" | "deny";
43
+ permissions: ("ask" | "allow" | "deny")[];
44
44
  fallback_allow_reads?: true | undefined;
45
45
  allow_reads?: true | undefined;
46
- permission: "allow" | "ask" | "deny";
46
+ permission: "ask" | "allow" | "deny";
47
47
  };
48
48
  /** The run's own tools beyond the table, each its own settings key, allowed by default like a table tool: the learned
49
49
  * workflow a run's pin names runs as `learned_workflow` (learned-workflow.ts LEARNED_WORKFLOW_TOOL), and the host's
@@ -285,17 +285,17 @@ export declare function shellUnavailable(name: string, shell: ShellPlace): Resol
285
285
  * computer setting); a tool of bash's family that leaves out resolves unavailable, saying why (shellUnavailable). */
286
286
  export declare function agentTools(env: NodeJS.ProcessEnv, settings: ToolSettingsMap, agent: Tooling, order: readonly string[], shell?: ShellPlace, effectOf?: (name: string) => ToolEffect | undefined): ({
287
287
  resolved: Resolution;
288
- permission: "allow" | "ask" | "deny";
288
+ permission: "ask" | "allow" | "deny";
289
289
  permission_from: import("./refusal-words.js").SettingFrom;
290
- default_permission: "allow" | "ask" | "deny";
291
- permissions: ("allow" | "ask" | "deny")[];
290
+ default_permission: "ask" | "allow" | "deny";
291
+ permissions: ("ask" | "allow" | "deny")[];
292
292
  blurb?: string | undefined;
293
293
  name: string;
294
294
  } | {
295
- permission: "allow" | "ask" | "deny";
295
+ permission: "ask" | "allow" | "deny";
296
296
  permission_from: import("./refusal-words.js").SettingFrom;
297
- default_permission: "allow" | "ask" | "deny";
298
- permissions: ("allow" | "ask" | "deny")[];
297
+ default_permission: "ask" | "allow" | "deny";
298
+ permissions: ("ask" | "allow" | "deny")[];
299
299
  blurb?: string | undefined;
300
300
  name: string;
301
301
  } | {
@@ -303,10 +303,10 @@ export declare function agentTools(env: NodeJS.ProcessEnv, settings: ToolSetting
303
303
  provider_from: string;
304
304
  default_provider: string;
305
305
  resolved: Resolution;
306
- permission: "allow" | "ask" | "deny";
306
+ permission: "ask" | "allow" | "deny";
307
307
  permission_from: import("./refusal-words.js").SettingFrom;
308
- default_permission: "allow" | "ask" | "deny";
309
- permissions: ("allow" | "ask" | "deny")[];
308
+ default_permission: "ask" | "allow" | "deny";
309
+ permissions: ("ask" | "allow" | "deny")[];
310
310
  blurb?: string | undefined;
311
311
  name: string;
312
312
  })[];
package/dist/tools.d.ts CHANGED
@@ -261,7 +261,7 @@ export declare const savedOnRelease: (row: {
261
261
  /** On the runner, the per-session hook that verifies the run's saved sign-in: a session that saved to it (savedOnRelease,
262
262
  * in a run handed it to save) verifies it under the run's claim, at the session's own end (its time, else now), as the
263
263
  * saved mark main reads at the lease's end. Answers whether it verified (sign-ins-store.ts verifyRunSignIn). */
264
- export declare const runSignInSaved: (store: Pick<Store, "runs" | "signIns">, sealKey: Buffer, claim: Claim, kept: RunSignIn) => (row: {
264
+ export declare const runSignInSaved: (store: Pick<Store, "runs" | "signIns">, sealKey: Buffer | undefined, claim: Claim, kept: RunSignIn) => (row: {
265
265
  session: {
266
266
  resourceId: string | null;
267
267
  releaseReason: string | null;
@@ -279,7 +279,7 @@ export declare const allows: (allowed: readonly string[], name: string) => boole
279
279
  * agent's `granted` tools a workflow's call node runs here (CALL_TOOLS, and each MCP tool granted by its own name,
280
280
  * tool-names.ts mcpNameOf), and with the run's `plane`, none it resolves unavailable (its agent's own tool of the name
281
281
  * does not run either). A
282
- * learned model node runs without tools (learn/skills.ts MODEL_NODE_TOOLS), and a harness's own tool (Bash,
282
+ * learned model node runs without tools (learn/workflow-draft.ts MODEL_NODE_TOOLS), and a harness's own tool (Bash,
283
283
  * exec_command, apply_patch) is never one, so the DSL refuses a draft that names it. */
284
284
  export declare const learnedWorkflowTools: (granted: readonly string[], plane?: Plane, options?: LearnedMcp) => string[];
285
285
  /** `mcp: true` at learn time (the end-of-run step's draft tools, a person's write): an MCP tool the revision grants by its
@@ -323,7 +323,7 @@ export declare function toolingOf(revision: Revision): Promise<Tooling>;
323
323
  /** The variables `entry` needs that `env` does not set, by name. */
324
324
  export declare const missingEnv: (entry: ToolEntry, env: NodeJS.ProcessEnv) => string[];
325
325
  /** Every tool as capabilities show it, the server's one tool catalog: available here, or the variables it is missing
326
- * (names only), and the harnesses that run it (another harness than pi runs only the host tools, host-tools.ts). A tool
326
+ * (names only), and the harnesses that run it (one on an adapter runs only the host tools, host-tools.ts). A tool
327
327
  * a user picks a provider for (tool-plane.ts) gives the providers offered, the server's (`provider`, the default where it
328
328
  * sets none), the default, and what it resolves to on each harness under the server's `settings`: available where any
329
329
  * is not unavailable, and missing PARALLEL_API_KEY where Parallel is picked without it. An unavailable tool says why
@@ -337,14 +337,14 @@ export declare const toolsView: (env: NodeJS.ProcessEnv, settings?: ToolSettings
337
337
  providers?: string[] | undefined;
338
338
  provider?: string | undefined;
339
339
  default_provider?: string | undefined;
340
- resolves?: Record<"opencode" | "codex" | "pi" | "claude-agent", Resolution> | undefined;
341
- why?: Record<"opencode" | "codex" | "pi" | "claude-agent", string> | undefined;
342
- default_permission: "allow" | "ask" | "deny";
343
- permissions: ("allow" | "ask" | "deny")[];
340
+ resolves?: Record<"opencode" | "codex" | "claude-agent" | "pi", Resolution> | undefined;
341
+ why?: Record<"opencode" | "codex" | "claude-agent" | "pi", string> | undefined;
342
+ default_permission: "ask" | "allow" | "deny";
343
+ permissions: ("ask" | "allow" | "deny")[];
344
344
  fallback_allow_reads?: true | undefined;
345
345
  allow_reads?: true | undefined;
346
- permission: "allow" | "ask" | "deny";
347
- harnesses: ("opencode" | "codex" | "pi" | "claude-agent")[];
346
+ permission: "ask" | "allow" | "deny";
347
+ harnesses: string[];
348
348
  missing?: string[] | undefined;
349
349
  reason?: string | undefined;
350
350
  available: boolean;
@@ -356,11 +356,11 @@ export declare const toolsView: (env: NodeJS.ProcessEnv, settings?: ToolSettings
356
356
  name: string;
357
357
  summary: string;
358
358
  } | {
359
- default_permission: "allow" | "ask" | "deny";
360
- permissions: ("allow" | "ask" | "deny")[];
359
+ default_permission: "ask" | "allow" | "deny";
360
+ permissions: ("ask" | "allow" | "deny")[];
361
361
  fallback_allow_reads?: true | undefined;
362
362
  allow_reads?: true | undefined;
363
- permission: "allow" | "ask" | "deny";
363
+ permission: "ask" | "allow" | "deny";
364
364
  name: string;
365
365
  summary: string;
366
366
  blurb: string;
@@ -368,5 +368,5 @@ export declare const toolsView: (env: NodeJS.ProcessEnv, settings?: ToolSettings
368
368
  calls: boolean;
369
369
  meta: true;
370
370
  available: boolean;
371
- harnesses: ("opencode" | "codex" | "pi" | "claude-agent")[];
371
+ harnesses: string[];
372
372
  })[];