@parcha/agentrun-serve 0.1.0-beta.36 → 0.1.0-beta.37

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 (325) hide show
  1. package/CHANGELOG.md +170 -0
  2. package/README.md +158 -52
  3. package/dist/attach-conformance-cli.d.ts +1 -0
  4. package/dist/attach-conformance-cli.js +18 -0
  5. package/dist/attach-conformance.d.ts +25 -0
  6. package/dist/attach-conformance.js +343 -0
  7. package/dist/browser-cost.d.ts +1 -1
  8. package/dist/browser-live.d.ts +20 -8
  9. package/dist/browser-live.js +50 -27
  10. package/dist/cap.d.ts +0 -17
  11. package/dist/cap.js +0 -91
  12. package/dist/catalog.d.ts +1 -12
  13. package/dist/catalog.js +3 -33
  14. package/dist/cli.js +13 -4
  15. package/dist/composio-preset.d.ts +36 -0
  16. package/dist/composio-preset.js +179 -0
  17. package/dist/computer-attach.d.ts +125 -0
  18. package/dist/computer-attach.js +330 -0
  19. package/dist/computer-calls.d.ts +48 -0
  20. package/dist/computer-calls.js +126 -0
  21. package/dist/computer-channel.d.ts +57 -0
  22. package/dist/computer-channel.js +115 -0
  23. package/dist/computer-commands.d.ts +1 -1
  24. package/dist/computer-held-routes.d.ts +35 -0
  25. package/dist/computer-held-routes.js +106 -0
  26. package/dist/computer-held.d.ts +48 -0
  27. package/dist/computer-held.js +87 -0
  28. package/dist/computer-keys.d.ts +21 -1
  29. package/dist/computer-keys.js +53 -11
  30. package/dist/computer-live.d.ts +160 -0
  31. package/dist/computer-live.js +643 -0
  32. package/dist/computer-view.d.ts +13 -0
  33. package/dist/computer-view.js +50 -3
  34. package/dist/computer-viewer.d.ts +6 -0
  35. package/dist/computer-viewer.js +297 -0
  36. package/dist/computers.d.ts +33 -7
  37. package/dist/computers.js +50 -8
  38. package/dist/console/assets/index-Cn6JX1uH.js +563 -0
  39. package/dist/console/assets/index-DRN62V5v.css +1 -0
  40. package/dist/console/index.html +2 -2
  41. package/dist/faux-computers.d.ts +9 -20
  42. package/dist/faux-computers.js +53 -25
  43. package/dist/github-connection.d.ts +10 -2
  44. package/dist/github-connection.js +65 -2
  45. package/dist/github-faux.js +1 -1
  46. package/dist/graph-view.d.ts +1 -1
  47. package/dist/harness.d.ts +1 -0
  48. package/dist/harness.js +35 -1
  49. package/dist/host-tools.d.ts +1 -1
  50. package/dist/hosted-search.d.ts +5 -4
  51. package/dist/hosted-search.js +2 -7
  52. package/dist/import-sources.d.ts +10 -0
  53. package/dist/import-sources.js +44 -2
  54. package/dist/import.d.ts +3 -3
  55. package/dist/import.js +37 -6
  56. package/dist/learn/check.d.ts +4 -1
  57. package/dist/learn/check.js +1 -1
  58. package/dist/learn/commit.d.ts +4 -2
  59. package/dist/learn/commit.js +5 -5
  60. package/dist/learn/folder.d.ts +6 -0
  61. package/dist/learn/folder.js +4 -1
  62. package/dist/learn/general.d.ts +66 -0
  63. package/dist/learn/general.js +73 -0
  64. package/dist/learn/grade.d.ts +4 -0
  65. package/dist/learn/grade.js +22 -1
  66. package/dist/learn/reflect.d.ts +10 -1
  67. package/dist/learn/reflect.js +14 -4
  68. package/dist/learn/skills.d.ts +33 -5
  69. package/dist/learn/skills.js +53 -7
  70. package/dist/learned-workflow.d.ts +24 -0
  71. package/dist/learned-workflow.js +66 -3
  72. package/dist/learning-batch.d.ts +283 -0
  73. package/dist/learning-batch.js +574 -0
  74. package/dist/learning-evals.d.ts +33 -0
  75. package/dist/learning-evals.js +98 -0
  76. package/dist/learning-routes.d.ts +25 -2
  77. package/dist/learning-routes.js +39 -6
  78. package/dist/learning-words.d.ts +6 -0
  79. package/dist/learning-words.js +6 -0
  80. package/dist/learning.d.ts +28 -15
  81. package/dist/learning.js +84 -44
  82. package/dist/live/stream.js +6 -3
  83. package/dist/live/translate.d.ts +4 -3
  84. package/dist/live/translate.js +8 -4
  85. package/dist/live-reach.d.ts +37 -0
  86. package/dist/live-reach.js +62 -0
  87. package/dist/mcp-gateway.d.ts +9 -0
  88. package/dist/mcp-gateway.js +60 -11
  89. package/dist/mcp-oauth.d.ts +57 -7
  90. package/dist/mcp-oauth.js +133 -18
  91. package/dist/mcp-private-hosts.d.ts +4 -4
  92. package/dist/mcp-private-hosts.js +20 -12
  93. package/dist/mcp-probe.d.ts +19 -2
  94. package/dist/mcp-probe.js +44 -9
  95. package/dist/mcp-secret-writes.js +4 -0
  96. package/dist/mcp-servers-store.d.ts +38 -15
  97. package/dist/mcp-servers-store.js +112 -20
  98. package/dist/mcp-store.d.ts +10 -4
  99. package/dist/mcp-store.js +17 -6
  100. package/dist/model-form.d.ts +26 -0
  101. package/dist/model-form.js +80 -0
  102. package/dist/model.js +23 -10
  103. package/dist/openapi.js +386 -21
  104. package/dist/page.d.ts +18 -0
  105. package/dist/page.js +48 -20
  106. package/dist/paid-calls.d.ts +1 -1
  107. package/dist/place-offers.d.ts +2 -3
  108. package/dist/place-offers.js +3 -7
  109. package/dist/place.js +1 -2
  110. package/dist/print.d.ts +15 -1
  111. package/dist/print.js +14 -3
  112. package/dist/propose.d.ts +3 -0
  113. package/dist/propose.js +13 -5
  114. package/dist/provider.js +3 -2
  115. package/dist/reflect-range.d.ts +8 -1
  116. package/dist/reflect-range.js +1 -1
  117. package/dist/run-launch.d.ts +14 -2
  118. package/dist/run-launch.js +9 -4
  119. package/dist/run-learning-served.d.ts +2 -2
  120. package/dist/run-reads-over-store.d.ts +1 -1
  121. package/dist/run-repo.d.ts +20 -0
  122. package/dist/run-repo.js +63 -0
  123. package/dist/run-timeline-served.d.ts +1 -1
  124. package/dist/run-view.d.ts +3 -3
  125. package/dist/run-view.js +14 -7
  126. package/dist/runner/adapter-loop.d.ts +23 -7
  127. package/dist/runner/adapter-loop.js +648 -62
  128. package/dist/runner/adapter-run-spec.d.ts +11 -3
  129. package/dist/runner/adapter-run-spec.js +77 -22
  130. package/dist/runner/adapters/pi-computer.d.ts +7 -0
  131. package/dist/runner/adapters/pi-computer.js +43 -0
  132. package/dist/runner/adapters/pi.d.ts +9 -4
  133. package/dist/runner/adapters/pi.js +76 -14
  134. package/dist/runner/beside.d.ts +7 -3
  135. package/dist/runner/beside.js +21 -11
  136. package/dist/runner/claim-secrets.d.ts +4 -0
  137. package/dist/runner/claim-secrets.js +6 -1
  138. package/dist/runner/cli-run-spec.d.ts +20 -3
  139. package/dist/runner/cli-run-spec.js +113 -43
  140. package/dist/runner/commands.d.ts +3 -1
  141. package/dist/runner/commands.js +28 -3
  142. package/dist/runner/computer-channel.d.ts +34 -0
  143. package/dist/runner/computer-channel.js +61 -0
  144. package/dist/runner/conformance/harness.js +80 -14
  145. package/dist/runner/conformance/subject.d.ts +1 -1
  146. package/dist/runner/dispatch.js +3 -0
  147. package/dist/runner/end-of-run.d.ts +22 -12
  148. package/dist/runner/end-of-run.js +38 -16
  149. package/dist/runner/github-app.d.ts +2 -1
  150. package/dist/runner/github-app.js +4 -2
  151. package/dist/runner/harness-loops.js +15 -1
  152. package/dist/runner/held-run.d.ts +65 -0
  153. package/dist/runner/held-run.js +158 -0
  154. package/dist/runner/journal-kinds.d.ts +20 -1
  155. package/dist/runner/journal-kinds.js +14 -0
  156. package/dist/runner/journal-reader.d.ts +5 -4
  157. package/dist/runner/journal-reader.js +12 -10
  158. package/dist/runner/learning-ask.d.ts +7 -1
  159. package/dist/runner/learning-ask.js +21 -6
  160. package/dist/runner/learning-dispatch.d.ts +22 -0
  161. package/dist/runner/learning-dispatch.js +77 -10
  162. package/dist/runner/learning-end.d.ts +22 -1
  163. package/dist/runner/learning-end.js +92 -12
  164. package/dist/runner/learning-factory.d.ts +1 -1
  165. package/dist/runner/learning-factory.js +11 -5
  166. package/dist/runner/learning-loop.d.ts +67 -7
  167. package/dist/runner/learning-loop.js +173 -21
  168. package/dist/runner/learning-seed.d.ts +7 -0
  169. package/dist/runner/learning-seed.js +13 -0
  170. package/dist/runner/live-ticker.js +1 -0
  171. package/dist/runner/loop-contract.d.ts +8 -1
  172. package/dist/runner/loop.d.ts +5 -1
  173. package/dist/runner/loop.js +2 -1
  174. package/dist/runner/main.d.ts +13 -1
  175. package/dist/runner/main.js +27 -5
  176. package/dist/runner/mcp-claim.d.ts +10 -7
  177. package/dist/runner/mcp-claim.js +113 -24
  178. package/dist/runner/mcp-github.js +1 -1
  179. package/dist/runner/mcp-run.d.ts +5 -5
  180. package/dist/runner/mcp-run.js +15 -3
  181. package/dist/runner/metrics.d.ts +11 -2
  182. package/dist/runner/metrics.js +12 -2
  183. package/dist/runner/pr-checkout.d.ts +1 -0
  184. package/dist/runner/pr-checkout.js +1 -1
  185. package/dist/runner/reflect-hook.d.ts +18 -0
  186. package/dist/runner/reflect-hook.js +20 -8
  187. package/dist/runner/runner.d.ts +26 -0
  188. package/dist/runner/runner.js +184 -15
  189. package/dist/runner/scratch-sweep.d.ts +13 -0
  190. package/dist/runner/scratch-sweep.js +62 -0
  191. package/dist/runner/sessions.d.ts +1 -1
  192. package/dist/runner/store-port.d.ts +4 -2
  193. package/dist/runner/store-secrets.js +4 -3
  194. package/dist/runner/subagent.js +3 -1
  195. package/dist/runner/workflow-host.d.ts +6 -1
  196. package/dist/runner/workflow-host.js +1 -1
  197. package/dist/runner/workflow-loop.d.ts +1 -1
  198. package/dist/runner/workflow-spec.d.ts +14 -2
  199. package/dist/runner/workflow-spec.js +56 -20
  200. package/dist/runs-over-store.d.ts +6 -1
  201. package/dist/runs-over-store.js +38 -9
  202. package/dist/seal-key.js +3 -3
  203. package/dist/sealed-settings-store.d.ts +5 -2
  204. package/dist/sealed-settings-store.js +10 -4
  205. package/dist/secret-writes.d.ts +5 -4
  206. package/dist/secret-writes.js +5 -4
  207. package/dist/server-secrets-store.d.ts +4 -3
  208. package/dist/server-secrets-store.js +15 -9
  209. package/dist/server-secrets.js +3 -2
  210. package/dist/server.d.ts +43 -14
  211. package/dist/server.js +472 -126
  212. package/dist/settings-wake.d.ts +21 -0
  213. package/dist/settings-wake.js +59 -0
  214. package/dist/standard-webhooks.d.ts +4 -1
  215. package/dist/standard-webhooks.js +8 -4
  216. package/dist/store/command-wake.d.ts +12 -0
  217. package/dist/store/command-wake.js +37 -0
  218. package/dist/store/dialect.d.ts +6 -0
  219. package/dist/store/dialect.js +5 -0
  220. package/dist/store/index.d.ts +1 -1
  221. package/dist/store/journal/storage.d.ts +3 -2
  222. package/dist/store/journal/storage.js +13 -5
  223. package/dist/store/postgres/dialect.js +4 -0
  224. package/dist/store/postgres/migrations/0005_learning_rounds.sql +14 -0
  225. package/dist/store/postgres/migrations/0006_run_changes_channel_attempts.sql +57 -0
  226. package/dist/store/postgres/migrations/0007_viewer_host.sql +11 -0
  227. package/dist/store/postgres/migrations/0008_paired_computers.sql +30 -0
  228. package/dist/store/postgres/migrations/0009_commands_answer.sql +10 -0
  229. package/dist/store/schema.d.ts +1 -1
  230. package/dist/store/schema.js +77 -8
  231. package/dist/store/sqlite/run-patch.d.ts +7 -5
  232. package/dist/store/sqlite/run-patch.js +28 -13
  233. package/dist/store/sqlite/store.js +272 -54
  234. package/dist/store/store.d.ts +268 -9
  235. package/dist/store/store.js +12 -1
  236. package/dist/store-reads/cap.d.ts +1 -1
  237. package/dist/store-reads/cap.js +8 -1
  238. package/dist/store-reads/decisions.d.ts +2 -2
  239. package/dist/store-reads/decisions.js +1 -1
  240. package/dist/store-reads/import-summary.d.ts +1 -1
  241. package/dist/store-reads/journal.d.ts +5 -4
  242. package/dist/store-reads/journal.js +73 -15
  243. package/dist/store-reads/learning.d.ts +20 -4
  244. package/dist/store-reads/learning.js +74 -18
  245. package/dist/store-reads/runs.d.ts +1 -1
  246. package/dist/store-reads/workflow.d.ts +1 -1
  247. package/dist/store-view.d.ts +5 -0
  248. package/dist/store-view.js +26 -11
  249. package/dist/template-eval.js +6 -4
  250. package/dist/template-github-permissions.d.ts +22 -8
  251. package/dist/template-github-permissions.js +35 -15
  252. package/dist/timeline/timeline.d.ts +27 -0
  253. package/dist/timeline/timeline.js +10 -9
  254. package/dist/timeline/util.d.ts +4 -0
  255. package/dist/timeline/util.js +14 -0
  256. package/dist/tool-budget.d.ts +19 -7
  257. package/dist/tool-budget.js +14 -8
  258. package/dist/tool-gate.d.ts +16 -9
  259. package/dist/tool-gate.js +53 -42
  260. package/dist/tool-plane.d.ts +16 -12
  261. package/dist/tool-plane.js +9 -4
  262. package/dist/tools.d.ts +13 -4
  263. package/dist/tools.js +13 -4
  264. package/dist/trigger-adapter.d.ts +4 -0
  265. package/dist/trigger-secrets-shown.d.ts +2 -2
  266. package/dist/trigger-secrets-shown.js +1 -1
  267. package/dist/trigger-signatures.d.ts +25 -6
  268. package/dist/trigger-signatures.js +41 -7
  269. package/dist/trigger-targets.d.ts +2 -0
  270. package/dist/trigger-targets.js +1 -0
  271. package/dist/trigger-webhook.js +5 -2
  272. package/dist/triggers.d.ts +7 -3
  273. package/dist/triggers.js +35 -5
  274. package/dist/turns.js +16 -1
  275. package/dist/validate.js +11 -1
  276. package/dist/web-fetch.d.ts +1 -1
  277. package/dist/web-search.d.ts +10 -5
  278. package/dist/web-search.js +7 -6
  279. package/dist/webhooks.d.ts +145 -102
  280. package/dist/webhooks.js +559 -322
  281. package/dist/workflow/decisions.d.ts +1 -1
  282. package/dist/workflow/node-runner.d.ts +2 -1
  283. package/dist/workflow/node.d.ts +2 -1
  284. package/dist/workflow/node.js +3 -1
  285. package/dist/workflow/pi-versions.d.ts +23 -0
  286. package/dist/workflow/pi-versions.js +57 -0
  287. package/dist/workflow/record-tool.d.ts +2 -1
  288. package/dist/workflow/store.d.ts +1 -1
  289. package/dist/workflow/task.js +3 -2
  290. package/dist/workflow-run.d.ts +1 -1
  291. package/dist/workspace/attached-computers.d.ts +41 -0
  292. package/dist/workspace/attached-computers.js +114 -0
  293. package/dist/workspace/computer-deps.d.ts +16 -9
  294. package/dist/workspace/computer-deps.js +19 -7
  295. package/dist/workspace/computer-for-claim.d.ts +17 -8
  296. package/dist/workspace/computer-for-claim.js +62 -21
  297. package/dist/workspace/computer-hold.d.ts +11 -27
  298. package/dist/workspace/computer-hold.js +36 -56
  299. package/dist/workspace/computer-ledger.d.ts +3 -1
  300. package/dist/workspace/computer-ledger.js +4 -0
  301. package/dist/workspace/computer-mcp.d.ts +25 -0
  302. package/dist/workspace/computer-mcp.js +41 -0
  303. package/dist/workspace/computer-ports.d.ts +4 -13
  304. package/dist/workspace/computer-ports.js +4 -107
  305. package/dist/workspace/computer-script.d.ts +37 -0
  306. package/dist/workspace/computer-script.js +138 -0
  307. package/dist/workspace/executors.d.ts +1 -1
  308. package/dist/workspace/index.d.ts +4 -2
  309. package/dist/workspace/index.js +3 -1
  310. package/dist/workspace/kind-skills/desktop/SKILL.md +119 -84
  311. package/dist/workspace/kind-skills/phone/SKILL.md +100 -85
  312. package/dist/workspace/resolve-computer.d.ts +3 -0
  313. package/dist/workspace/resolve-computer.js +8 -2
  314. package/dist/workspace/run-tools.d.ts +32 -15
  315. package/dist/workspace/run-tools.js +23 -30
  316. package/package.json +19 -16
  317. package/templates/market-monitor/agent.md +1 -1
  318. package/dist/console/assets/index-BI4Byidu.js +0 -550
  319. package/dist/console/assets/index-C19gUF2n.css +0 -1
  320. package/dist/run-db.d.ts +0 -53
  321. package/dist/run-db.js +0 -116
  322. package/dist/workflow/readers.d.ts +0 -36
  323. package/dist/workflow/readers.js +0 -145
  324. package/dist/workflow/wal.d.ts +0 -11
  325. package/dist/workflow/wal.js +0 -106
@@ -0,0 +1,98 @@
1
+ // An agent's eval records (POST and GET /agents/{id}/learning/evals): the counts of a held-out test of what the agent
2
+ // learned, posted by whoever ran it (a bench, a script, a person): `n` jobs it never learned from, `correct` of them right,
3
+ // the cost a task with learning and by hand, where the labels came from and the learned revision it tested. The server
4
+ // computes the accuracy and its 95% Wilson interval from the counts (a caller never sends either), so the console's
5
+ // Learning tab can say how accurate and how cheap the learned agent is, with how many jobs and how sure. A record is only
6
+ // ever what was posted: the server never computes one from the agent's own runs (the jobs it learned from, never held
7
+ // out). Append-only, the latest first and the one shown, the latest EVALS_KEPT kept in the store's settings under the
8
+ // agent's key. Aggregates only: no rows, no inputs.
9
+ import { randomUUID } from "node:crypto";
10
+ import { invalid } from "./errors.js";
11
+ /** How many records an agent keeps, newest first. */
12
+ export const EVALS_KEPT = 20;
13
+ /** The most jobs one test may count. */
14
+ export const EVAL_JOBS_MAX = 10_000_000;
15
+ /** The longest `name` and `label_source`. */
16
+ export const EVAL_TEXT_MAX = 200;
17
+ const FIELDS = ["name", "label_source", "n", "correct", "cost_per_task_usd", "baseline_cost_per_task_usd", "learned_revision"];
18
+ /** z for a two-sided 95% interval. */
19
+ const Z95 = 1.959963984540054;
20
+ const places = (value) => Math.round(value * 1e4) / 1e4;
21
+ /** The 95% Wilson score interval of `correct` right of `n`, [low, high], each from 0 to 1, to four places: unlike the
22
+ * normal approximation it holds at 0 and at n right and with few jobs. */
23
+ export function wilsonOf(n, correct) {
24
+ const p = correct / n;
25
+ const z2 = Z95 * Z95;
26
+ const over = 1 + z2 / n;
27
+ const centre = (p + z2 / (2 * n)) / over;
28
+ const half = (Z95 * Math.sqrt((p * (1 - p)) / n + z2 / (4 * n * n))) / over;
29
+ return [places(Math.max(0, centre - half)), places(Math.min(1, centre + half))];
30
+ }
31
+ const isObject = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
32
+ const oneLine = (value) => typeof value === "string" && !!value.trim() && value.length <= EVAL_TEXT_MAX && !/[\u0000-\u001f\u007f]/.test(value);
33
+ const whole = (value, least, most) => Number.isInteger(value) && value >= least && value <= most;
34
+ const dollars = (value) => value === null || (typeof value === "number" && Number.isFinite(value) && value >= 0);
35
+ /** A posted record, checked for its shape only: each field that is missing or wrong is 422 input_invalid by field, and
36
+ * nothing is kept. */
37
+ export function evalOf(body, now) {
38
+ if (!isObject(body))
39
+ throw invalid([{ field: "body", reason: "invalid", message: "the body is a JSON object" }]);
40
+ const issues = [];
41
+ for (const key of Object.keys(body)) {
42
+ const why = key === "accuracy" || key === "ci" ? "the server computes accuracy and ci from n and correct" : `the body takes ${FIELDS.join(", ")}`;
43
+ if (!FIELDS.includes(key))
44
+ issues.push({ field: key, reason: "unknown", message: why });
45
+ }
46
+ const { name, label_source: source = null, n, correct, cost_per_task_usd: cost = null, baseline_cost_per_task_usd: baseline = null, learned_revision: revision = null } = body;
47
+ if (!oneLine(name))
48
+ issues.push({ field: "name", reason: "invalid", message: `name says what ran the test, in one line of at most ${EVAL_TEXT_MAX} characters`, example: "invoice bench, sealed test" });
49
+ if (!(source === null || oneLine(source)))
50
+ issues.push({ field: "label_source", reason: "invalid", message: `label_source says where the right answers came from, in one line of at most ${EVAL_TEXT_MAX} characters, or null`, example: "teacher labels, 87% strict vs people" });
51
+ const jobs = whole(n, 1, EVAL_JOBS_MAX);
52
+ if (!jobs)
53
+ issues.push({ field: "n", reason: "invalid", message: `n is the held-out jobs counted, a whole number from 1 to ${EVAL_JOBS_MAX}`, example: 200 });
54
+ if (!whole(correct, 0, jobs ? n : EVAL_JOBS_MAX))
55
+ issues.push({ field: "correct", reason: "invalid", message: "correct is how many of the n jobs it got right, a whole number from 0 to n", example: 188 });
56
+ if (!dollars(cost))
57
+ issues.push({ field: "cost_per_task_usd", reason: "invalid", message: "cost_per_task_usd is the mean cost a task with learning, in dollars, 0 or more, or null" });
58
+ if (!dollars(baseline))
59
+ issues.push({ field: "baseline_cost_per_task_usd", reason: "invalid", message: "baseline_cost_per_task_usd is the mean cost a task by hand, in dollars, 0 or more, or null" });
60
+ if (!(revision === null || (typeof revision === "string" && /^[0-9a-f]{7,64}$/.test(revision))))
61
+ issues.push({ field: "learned_revision", reason: "invalid", message: "learned_revision is the learning folder's commit it tested (7 to 64 hex characters), or null" });
62
+ if (issues.length)
63
+ throw invalid(issues);
64
+ const [jobsN, right] = [n, correct];
65
+ return {
66
+ id: `eval_${randomUUID()}`,
67
+ name: name.trim(),
68
+ label_source: source === null ? null : source.trim(),
69
+ n: jobsN,
70
+ correct: right,
71
+ accuracy: places(right / jobsN),
72
+ ci: wilsonOf(jobsN, right),
73
+ cost_per_task_usd: cost,
74
+ baseline_cost_per_task_usd: baseline,
75
+ learned_revision: revision,
76
+ recorded_at: now.toISOString(),
77
+ };
78
+ }
79
+ const keyOf = (agentId) => `learning.evals.${agentId}`;
80
+ const listOf = (value) => (Array.isArray(value) ? value : []);
81
+ /** Agent `agentId`'s records, newest recorded first. */
82
+ export async function evalsOf(store, agentId) {
83
+ return listOf(await store.settings.get(keyOf(agentId)));
84
+ }
85
+ /** Appends `record` first in agent `agentId`'s records, the latest EVALS_KEPT kept: a compare-and-set, so of two posts at
86
+ * once neither is lost. */
87
+ export async function recordEval(store, agentId, record) {
88
+ const key = keyOf(agentId);
89
+ for (;;) {
90
+ const was = await store.settings.get(key);
91
+ const next = [record, ...listOf(was)].slice(0, EVALS_KEPT);
92
+ // putIfAbsent answers what the key holds after: ours, or ours under a post that raced in between (Postgres inserts and reads
93
+ // back in separate calls), so ours is kept when its id is in the list, never when the list merely differs from ours.
94
+ const kept = was === undefined ? listOf(await store.settings.putIfAbsent(key, next)).some((e) => e.id === record.id) : await store.settings.replaceIf(key, was, next);
95
+ if (kept)
96
+ return;
97
+ }
98
+ }
@@ -1,5 +1,6 @@
1
1
  import type { DraftAsk } from "./learn/skills.js";
2
2
  import type { IncomingMessage, ServerResponse } from "node:http";
3
+ import type { DraftDecisions } from "./learn/skills.js";
3
4
  import { type ItemStatus, type Learning, type NoteRuns, type Shown } from "./learning.js";
4
5
  import type { Impact } from "./learning-run.js";
5
6
  import { type LearnedUse } from "./store-reads/learning.js";
@@ -112,6 +113,26 @@ export declare function agentLearning(data: string, agentId: string, shown: Show
112
113
  export declare function learningNotes(data: string, agentId: string, query: URLSearchParams, shown: Shown, runs?: NoteRuns): Promise<Page<NoteView>>;
113
114
  /** GET /agents/{id}/learning/log?cursor=&limit=: a page of the changes on main, newest first. */
114
115
  export declare function learningLog(data: string, agentId: string, query: URLSearchParams, shown: Shown): Promise<Page<Change>>;
116
+ /** One revision of a learned workflow: a commit on main that changed its workflow.json, with that commit's text (null
117
+ * when the commit holds no such file: it was deleted there), cut of the host's secrets. */
118
+ type WorkflowRevision = {
119
+ commit: string;
120
+ at: string;
121
+ by: Change["by"];
122
+ reason: string;
123
+ text: string | null;
124
+ };
125
+ /** GET /agents/{id}/learning/workflows/{name}/revisions?limit=: the latest revisions of learned workflow `name` (the
126
+ * commits on main's log that changed `workflows/<name>/workflow.json`), oldest first, each with the workflow's text at
127
+ * that commit, so a person can step through how it changed. One read-only exec per revision (textsAt), at most `limit`
128
+ * of them. `total` counts every such commit the log holds, `truncated` says the log itself is cut (it keeps the latest
129
+ * LOG_KEEP changes). A workflow no commit of the log changed is not_found. */
130
+ export declare function workflowRevisions(data: string, agentId: string, name: string, query: URLSearchParams, shown: Shown): Promise<{
131
+ name: string;
132
+ revisions: WorkflowRevision[];
133
+ total: number;
134
+ truncated: boolean;
135
+ }>;
115
136
  /** GET /agents/{id}/learning/files/{file}: the file on main as text, its ETag, and its type (a draft's workflow.json is
116
137
  * JSON). */
117
138
  export declare function readNote(data: string, agentId: string, raw: string, shown: Shown): Promise<{
@@ -151,6 +172,7 @@ export declare function writeNote(data: string, agentId: string, raw: string, in
151
172
  gated: Record<string, string>;
152
173
  deniedBy?: Record<string, "agent" | "server" | "default">;
153
174
  ask?: DraftAsk;
175
+ decisions?: DraftDecisions;
154
176
  }>;
155
177
  }): Promise<{
156
178
  status: 200 | 201;
@@ -180,6 +202,7 @@ export declare function promotable(data: string, agentId: string, raw: string, i
180
202
  tools: string[];
181
203
  gated: Record<string, string>;
182
204
  deniedBy?: Record<string, "agent" | "server" | "default">;
205
+ decisions?: DraftDecisions;
183
206
  }>;
184
207
  }): Promise<Promotable>;
185
208
  /** GET /runs/{id}/learning's body, from the run's learning as it reads now, the seed it started from and whether it
@@ -238,8 +261,8 @@ export declare function runLearningBody(input: {
238
261
  skills?: import("./learning.js").LearnedFile[];
239
262
  workflows?: import("./learning.js").LearnedFile[];
240
263
  run: string;
241
- state: "proposed" | "merged" | "seeded" | "reflecting" | "dropped";
242
- reason: "cancelled" | "empty" | "unparsed" | "seed_failed" | "no_budget" | "unknown_cost" | "crashed" | "reflect_timeout" | "reflect_failed" | "propose_failed" | "checker" | "grader" | "grade_failed" | null;
264
+ state: "dropped" | "proposed" | "merged" | "seeded" | "reflecting";
265
+ reason: "cancelled" | "use" | "empty" | "unparsed" | "seed_failed" | "no_budget" | "unknown_cost" | "crashed" | "reflect_timeout" | "reflect_failed" | "propose_failed" | "checker" | "grader" | "grade_failed" | null;
243
266
  detail: string | null;
244
267
  at: string;
245
268
  };
@@ -1,5 +1,5 @@
1
1
  import { approve, buildIndex, CAPS, checkNote, draftProblems, frontKeys, INDEX_FILE, INDEX_LINES, isHeld, LEARNED_KEYS, learnedName, learnedPlace, learnedStatus, NOTE_FILE, NOTE_STATUSES, parseNoteFile, printable, released, retire, retiredLearned, skillProblems, SKILLS_DIR, supersede, UNCLEAR_FRONT, unstorable, WORKFLOWS_DIR, unclearFront, restorable, restore, restoredLearned } from "./learn/index.js";
2
- import { blobOid, FolderBusy, FolderRefused, FolderTooLarge, FolderUnreadable, heldOnMain, isBodyMismatch, readLearning, PATCH_CAP, readRunDiff, readSnapshot, snapshotNotes, writeLearning } from "./learn/folder.js";
2
+ import { blobOid, FolderBusy, FolderRefused, FolderTooLarge, FolderUnreadable, heldOnMain, isBodyMismatch, readLearning, PATCH_CAP, readRunDiff, readSnapshot, runDiffKey, snapshotNotes, textsAt, writeLearning } from "./learn/folder.js";
3
3
  import { ApiError, invalid } from "./errors.js";
4
4
  import { detailShown, learningFolderOf, notesView, reasonShown, secretsShown, withAgentRepo } from "./learning.js";
5
5
  import { isObject } from "./validate.js";
@@ -209,6 +209,38 @@ export async function learningLog(data, agentId, query, shown) {
209
209
  return logPage(page.snapshot, page.offset, limit, shown);
210
210
  }, () => EMPTY);
211
211
  }
212
+ /** The most revisions a workflow's history answers, and its default. */
213
+ const REVISIONS_MAX = 50;
214
+ const REVISIONS_DEFAULT = 20;
215
+ /** GET /agents/{id}/learning/workflows/{name}/revisions?limit=: the latest revisions of learned workflow `name` (the
216
+ * commits on main's log that changed `workflows/<name>/workflow.json`), oldest first, each with the workflow's text at
217
+ * that commit, so a person can step through how it changed. One read-only exec per revision (textsAt), at most `limit`
218
+ * of them. `total` counts every such commit the log holds, `truncated` says the log itself is cut (it keeps the latest
219
+ * LOG_KEEP changes). A workflow no commit of the log changed is not_found. */
220
+ export async function workflowRevisions(data, agentId, name, query, shown) {
221
+ if (!learnedName("workflow", name))
222
+ throw new ApiError("bad_request", "A workflow's folder is named with lowercase letters, digits, dashes and underscores.");
223
+ const given = query.get("limit");
224
+ const limit = given === null ? REVISIONS_DEFAULT : Number(given);
225
+ if ((given !== null && !/^\d+$/.test(given)) || limit < 1 || limit > REVISIONS_MAX)
226
+ throw new ApiError("bad_request", `limit is an integer from 1 to ${REVISIONS_MAX}`);
227
+ const path = `${WORKFLOWS_DIR}/${name}/workflow.json`;
228
+ if (shown.name(path) !== path)
229
+ throw new ApiError("not_found", "the agent's learning folder has no such workflow");
230
+ const found = await reading(data, agentId, async ({ ws, snapshot }) => {
231
+ const touched = snapshot.log.filter((change) => change.files.includes(path));
232
+ const latest = touched.slice(0, limit).reverse();
233
+ const revisions = [];
234
+ for (const change of latest) {
235
+ const texts = await textsAt(ws, change.commit, [path]).catch((error) => { throw routeFailure(error); });
236
+ revisions.push({ commit: change.commit, at: change.at, by: change.by, reason: shown.text(change.reason), text: texts?.[path] === undefined ? null : shown.text(texts[path]) });
237
+ }
238
+ return { revisions, total: touched.length, truncated: snapshot.log_more };
239
+ }, () => undefined);
240
+ if (!found || !found.total)
241
+ throw new ApiError("not_found", "the agent's learning folder has no such workflow");
242
+ return { name, ...found };
243
+ }
212
244
  /** The blob of `file` on the snapshot's main, as a route names it: the index, a note, a skill's SKILL.md, a draft's
213
245
  * README.md or workflow.json; undefined when main holds no such file the snapshot names. */
214
246
  function blobIn(snapshot, file) {
@@ -423,9 +455,9 @@ export async function writeNote(data, agentId, raw, input) {
423
455
  // a restore never brings back a draft no run could run.
424
456
  const draft = changes.find(({ path }) => path === `${folder}workflow.json`);
425
457
  if (learned.kind !== "skill" && draft && input.draftTools) {
426
- const { tools, gated, deniedBy, ask } = await input.draftTools();
458
+ const { tools, gated, deniedBy, ask, decisions } = await input.draftTools();
427
459
  const dsl = await import("@parcha/agentrun-dsl");
428
- for (const { rule, detail } of draftProblems(dsl, draft.bytes.toString("utf8"), tools, gated, deniedBy ?? {}, ask))
460
+ for (const { rule, detail } of draftProblems(dsl, draft.bytes.toString("utf8"), tools, gated, deniedBy ?? {}, ask, decisions))
429
461
  problems.push(printable({ rule, path: draft.path, detail }, input.refuse));
430
462
  }
431
463
  if (problems.length)
@@ -559,8 +591,9 @@ export async function promotable(data, agentId, raw, input) {
559
591
  problems.push(printable({ rule: "workflow", path: file, detail: "the workflow's folder holds no workflow.json" }, input.refuse));
560
592
  const dsl = await import("@parcha/agentrun-dsl");
561
593
  if (json && !problems.length) {
562
- const { tools, gated, deniedBy } = await input.draftTools();
563
- for (const { rule, detail } of draftProblems(dsl, json.text, tools, gated, deniedBy ?? {}))
594
+ // A learned workflow's decision nodes (LS-07) are checked on this server's decision providers, as a restore checks them.
595
+ const { tools, gated, deniedBy, decisions } = await input.draftTools();
596
+ for (const { rule, detail } of draftProblems(dsl, json.text, tools, gated, deniedBy ?? {}, undefined, decisions))
564
597
  problems.push(printable({ rule, path: file, detail }, input.refuse));
565
598
  }
566
599
  if (problems.length)
@@ -630,7 +663,7 @@ export async function runDiffOverStore(data, store, runId, shown) {
630
663
  };
631
664
  if (end?.merged) {
632
665
  const folder = learningFolderOf(data, row.agentId);
633
- const diff = await readRunDiff(folder.workspace, runId).catch((error) => Promise.reject(routeFailure(error))).finally(() => folder.end());
666
+ const diff = await readRunDiff(folder.workspace, runDiffKey(runId, kept?.round)).catch((error) => Promise.reject(routeFailure(error))).finally(() => folder.end());
634
667
  if (!diff || diff.merge !== end.merged)
635
668
  throw new ApiError("not_found", "the run's merge is not in its agent's learning folder");
636
669
  return { base: diff.parent, head: diff.merge, files: diff.files.map((entry) => ("patch" in entry ? file(entry.path, entry.status, entry.patch) : { path: shown.name(entry.path), status: entry.status, withheld: entry.withheld })) };
@@ -52,6 +52,8 @@ export declare const said: {
52
52
  /** A run whose only work was its learned workflows, each answering, with nothing said after its first message: it was
53
53
  * not asked to look back (runner/learning-end.ts onlyLearnedWorkflows). */
54
54
  onlyWorkflow: string;
55
+ /** A run started with `learning: "use"`: it read what its agent learned and kept nothing, as asked. */
56
+ use: string;
55
57
  /** A merge whose every item the owner has since retired: nothing it learned is kept now. */
56
58
  retiredSince: string;
57
59
  /** The run's answer gave its notes, but not in the format asked for, so none was read. */
@@ -66,6 +68,10 @@ export declare const said: {
66
68
  * either way: said in one sentence true of both. */
67
69
  stale: (problems: readonly Pick<Problem, "rule">[]) => string;
68
70
  noBudget: string;
71
+ /** The run's grade did not fit what its cap left (its learning run's cap): not run, so nothing it learned is kept. */
72
+ noRoomToGrade: string;
73
+ /** A grade under a cap whose cost can't be kept within it (its spend or the grade model's price unknown). */
74
+ gradeUncapped: string;
69
75
  unknownCost: string;
70
76
  stopped: (cause: string) => string;
71
77
  };
@@ -126,6 +126,8 @@ export const said = {
126
126
  /** A run whose only work was its learned workflows, each answering, with nothing said after its first message: it was
127
127
  * not asked to look back (runner/learning-end.ts onlyLearnedWorkflows). */
128
128
  onlyWorkflow: "Nothing new: the run only ran a learned workflow.",
129
+ /** A run started with `learning: "use"`: it read what its agent learned and kept nothing, as asked. */
130
+ use: "Used what its agent learned; this run keeps nothing.",
129
131
  /** A merge whose every item the owner has since retired: nothing it learned is kept now. */
130
132
  retiredSince: "What it learned was retired since.",
131
133
  /** The run's answer gave its notes, but not in the format asked for, so none was read. */
@@ -144,6 +146,10 @@ export const said = {
144
146
  ? "Not kept: a note it would replace is gone or was changed since."
145
147
  : `Not kept: the agent's notes changed while this run ran (${rulesIn(problems)}).`,
146
148
  noBudget: "Skipped: no budget left in this run to look back.",
149
+ /** The run's grade did not fit what its cap left (its learning run's cap): not run, so nothing it learned is kept. */
150
+ noRoomToGrade: "Not graded: no room under the cap.",
151
+ /** A grade under a cap whose cost can't be kept within it (its spend or the grade model's price unknown). */
152
+ gradeUncapped: "Not graded: the grade's cost can't be kept under the cap.",
147
153
  unknownCost: "Skipped: this run's spend is unknown, so its budget can't cover looking back.",
148
154
  stopped: (cause) => `Not kept: learning stopped (${cause}).`,
149
155
  };
@@ -12,7 +12,8 @@ export declare const LEARNING_ENV = "AGENTRUN_SERVE_LEARNING";
12
12
  /** The switch: `given`, else AGENTRUN_SERVE_LEARNING, else on. Any other value is an error, and the server does not start. */
13
13
  export declare function learningOf(env: NodeJS.ProcessEnv, given?: string): LearningMode;
14
14
  /** How much of what a run learned its instructions hold under `# Learned` by default, in UTF-8 bytes (learnedParts): its
15
- * notes whole while they fit, else the index and the notes changed last, whole, while they fit. */
15
+ * notes whole while they fit, else the notes that bear most on the run whole while they fit, then a line for each of
16
+ * the next while they fit; the rest are left out, and the run's log names them. */
16
17
  export declare const LEARNING_BUDGET = 8000;
17
18
  export declare const LEARNING_BUDGET_ENV = "AGENTRUN_SERVE_LEARNING_BUDGET";
18
19
  /** The learning budget: `given` (`--learning-budget`), else AGENTRUN_SERVE_LEARNING_BUDGET, else LEARNING_BUDGET. Any
@@ -23,7 +24,11 @@ export declare function learningBudgetOf(env: NodeJS.ProcessEnv, given?: number)
23
24
  * checks and is kept (propose.ts), `merged` once it is on main (runner/learning-loop.ts), or `dropped` with a
24
25
  * reason from the closed list. A learning fault never refuses a run: it starts with nothing learned, `seed_failed`. */
25
26
  export declare const LEARNING_STATES: readonly ["seeded", "reflecting", "proposed", "merged", "dropped"];
26
- export declare const LEARNING_REASONS: readonly ["seed_failed", "no_budget", "unknown_cost", "cancelled", "crashed", "reflect_timeout", "reflect_failed", "empty", "unparsed", "propose_failed", "checker", "grader", "grade_failed"];
27
+ export declare const LEARNING_REASONS: readonly ["seed_failed", "no_budget", "unknown_cost", "cancelled", "crashed", "reflect_timeout", "reflect_failed", "empty", "unparsed", "propose_failed", "checker", "grader", "grade_failed", "use"];
28
+ /** A run's own `learning` on its start (POST /agents/{agent_id}/runs): it starts from what its agent learned, as a run that
29
+ * learns does, and keeps nothing (no end-of-run turn, no proposal, no grade, no merge, at any end), so runs of one agent
30
+ * read one learned state however many run at once. Its learning ends `dropped`, reason `use`. */
31
+ export declare const RUN_LEARNING_USE = "use";
27
32
  export type LearningState = (typeof LEARNING_STATES)[number];
28
33
  export type LearningReason = (typeof LEARNING_REASONS)[number];
29
34
  /** Tokens by the platform's names, as a run's metrics and /v2/stats count them: `input` is the input neither read from
@@ -163,8 +168,8 @@ export declare const learningView: (learning: Learning, shown: Shown, settled: b
163
168
  pending?: NoteUsed[];
164
169
  skills?: LearnedFile[];
165
170
  workflows?: LearnedFile[];
166
- state: "proposed" | "merged" | "seeded" | "reflecting" | "dropped";
167
- reason: "cancelled" | "empty" | "unparsed" | "seed_failed" | "no_budget" | "unknown_cost" | "crashed" | "reflect_timeout" | "reflect_failed" | "propose_failed" | "checker" | "grader" | "grade_failed" | null;
171
+ state: "dropped" | "proposed" | "merged" | "seeded" | "reflecting";
172
+ reason: "cancelled" | "use" | "empty" | "unparsed" | "seed_failed" | "no_budget" | "unknown_cost" | "crashed" | "reflect_timeout" | "reflect_failed" | "propose_failed" | "checker" | "grader" | "grade_failed" | null;
168
173
  detail: string | null;
169
174
  at: string;
170
175
  };
@@ -178,8 +183,8 @@ export declare function shortOf<T extends {
178
183
  detail: string | null;
179
184
  at: string;
180
185
  }>({ state, reason, detail, at: _, ...notes }: T): {
181
- state: "proposed" | "merged" | "seeded" | "reflecting" | "dropped";
182
- reason: "cancelled" | "empty" | "unparsed" | "seed_failed" | "no_budget" | "unknown_cost" | "crashed" | "reflect_timeout" | "reflect_failed" | "propose_failed" | "checker" | "grader" | "grade_failed" | null;
186
+ state: "dropped" | "proposed" | "merged" | "seeded" | "reflecting";
187
+ reason: "cancelled" | "use" | "empty" | "unparsed" | "seed_failed" | "no_budget" | "unknown_cost" | "crashed" | "reflect_timeout" | "reflect_failed" | "propose_failed" | "checker" | "grader" | "grade_failed" | null;
183
188
  detail: string | null;
184
189
  } & Omit<T, "at" | "reason" | "detail" | "state">;
185
190
  /** The label of the end-of-run turn's timeline rows, and the kind and label of a run's learning row. */
@@ -394,6 +399,9 @@ export type NoteCandidates = {
394
399
  readonly indexBytes: number;
395
400
  readonly indexComplete: boolean;
396
401
  readonly budget: number;
402
+ /** Whether the run has the read tool, so the section past the budget names `.learning/` (READ_LINE) and its room is kept
403
+ * for that line. Absent: kept, as for a run that has it. */
404
+ readonly read?: boolean;
397
405
  };
398
406
  /** A selector's choice: the notes the run reads whole, in the order it reads them (a subset of the candidates), and
399
407
  * whether it reads the index first. Without the index, the notes are all it is given; or, with `lines`, the notes it
@@ -408,14 +416,16 @@ export type NoteSelection = {
408
416
  * index when it serves it, fit `budget`, past which only the index may go (as loadedIndex bounds it). */
409
417
  export type NoteSelector = (candidates: NoteCandidates, run: RunInput) => NoteSelection;
410
418
  /** The selector by recency: every note whole while all fit the budget and the index names no note main does not hold
411
- * whole; else the index, then the newest notes that fit what it leaves, each whole. */
419
+ * whole; notes that fit with an index that names one it lacks, the index, then the newest notes that fit what it
420
+ * leaves, each whole; past the budget, the newest notes whole while they fit, then a line for each of the next while
421
+ * they fit (withinBudget). */
412
422
  export declare const byRecency: NoteSelector;
413
423
  /** The default selector, by relevance, past the budget: while the notes fit it, recency's choice (byRecency). Else each
414
424
  * note is scored against the run's input (learn/relevance.ts: BM25 over its name, description and body, a code
415
425
  * review's changed paths' words weighed PATH_WEIGHT; no model call), and the run reads the notes that bear on it most
416
- * whole, in score order, while they fit, then one rule line for each of the rest, best first, in place of the index; the lines count toward the
417
- * budget before the whole notes, as the index did, and no more of them than a run reads of the index (loadedIndex). An
418
- * input with no word any note holds reads by recency. */
426
+ * whole, best first, while they fit the budget, then one rule line for each of the next while they fit what is left
427
+ * (withinBudget), a note that bears on it in no word a line at most; the rest are left out. An input with no word any
428
+ * note holds reads by recency. */
419
429
  export declare const byRelevance: NoteSelector;
420
430
  /** What a run of `seed` reads under `# Learned` (`section`, the same for every harness, undefined when it learned
421
431
  * nothing) and the notes that names (`given`), from one choice of the selector, so the section and the given notes never
@@ -423,11 +433,14 @@ export declare const byRelevance: NoteSelector;
423
433
  * the index, nor counted toward the budget (readSeed reads active notes alone, and servedIndex drops their lines). Its
424
434
  * active notes, newest first (`seed.recent`, else by name), each whole while all fit `budget`; past it, the selector's
425
435
  * choice (byRelevance by default). An agent with the read tool is told the rest are in `.learning/`, one without is not.
436
+ * Notes past a budget that holds none of them (0 among them) are said to be there (NONE_FIT), never "Nothing learned yet.".
426
437
  * Every text is cut of the host's secrets. A run "was given" `given`; of them, it "read" those whose file it opened
427
- * (store-reads/learning.ts notesReadOf). Whether it applied one given whole is not measured. */
438
+ * (store-reads/learning.ts notesReadOf). Whether it applied one given whole is not measured. `left`: the active notes
439
+ * the section names in no way, over the budget, which the run's log names (runner/learning-seed.ts). */
428
440
  export declare function learnedParts(seed: Seed, options: LearnedOptions): {
429
441
  section: string | undefined;
430
442
  given: LearnedNote[];
443
+ left: LearnedNote[];
431
444
  };
432
445
  /** Lays each of `skills` in the run's `.agents/skills/<name>/` through its Workspace, a folder made new for it (one
433
446
  * already there throws EXISTS); a link on the way is ESCAPE, and nothing is written through it. Each name goes in
@@ -475,10 +488,10 @@ export declare function readPin(runDir: string): Promise<Pin | undefined>;
475
488
  /** The heading of what a run learned, in its instructions. */
476
489
  export declare const LEARNED_HEADING = "# Learned";
477
490
  /** A run's instructions with its # Learned section laid in main's position: the revision's instructions, then the heading,
478
- * LEARNS, and the section text — "Nothing learned yet." when the run learns but its section is empty (no notes yet, or a
479
- * seed that could not be read). Shared so the runner (laying launch.learning.section, read with no folder) and app.ts
480
- * (withLearned) lay the same bytes. */
481
- export declare const laidLearned: (instructions: string, section: string | undefined) => string;
491
+ * LEARNS (USES for a run that only `use`s what its agent learned), and the section text — "Nothing learned yet." when the
492
+ * run learns but its section is empty (no notes yet, or a seed that could not be read). Shared so the runner (laying
493
+ * launch.learning.section, read with no folder) and app.ts (withLearned) lay the same bytes. */
494
+ export declare const laidLearned: (instructions: string, section: string | undefined, use?: boolean) => string;
482
495
  /** A run's instructions, with `# Learned` after them when its pin in `runDir` says it learns: that it learns, then what
483
496
  * the pin says it learned, or that it has learned nothing yet. A run with no pin (its agent does not learn, its seed
484
497
  * failed, a workflow's run) is never asked what to keep, so it is told nothing. And its skill files: the revision's