@parcha/agentrun-serve 0.1.0-beta.44 → 0.1.0-beta.46

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 (350) hide show
  1. package/CHANGELOG.md +148 -5
  2. package/README.md +385 -305
  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 +62 -19
  28. package/dist/composio-preset.js +69 -7
  29. package/dist/composio-triggers.d.ts +14 -0
  30. package/dist/composio-triggers.js +79 -15
  31. package/dist/computer-attach.d.ts +40 -5
  32. package/dist/computer-attach.js +130 -15
  33. package/dist/computer-keys.d.ts +3 -0
  34. package/dist/computer-keys.js +7 -1
  35. package/dist/computer-live.js +3 -2
  36. package/dist/computers.d.ts +21 -10
  37. package/dist/computers.js +39 -28
  38. package/dist/console/assets/index-C2MYaUBa.css +1 -0
  39. package/dist/console/assets/index-CZZeCReB.js +701 -0
  40. package/dist/console/index.html +2 -2
  41. package/dist/decisions.d.ts +1 -1
  42. package/dist/dial-relay.d.ts +29 -0
  43. package/dist/dial-relay.js +94 -0
  44. package/dist/email/tools.js +10 -5
  45. package/dist/env-proxy.d.ts +2 -0
  46. package/dist/env-proxy.js +35 -0
  47. package/dist/errors.d.ts +3 -1
  48. package/dist/errors.js +7 -4
  49. package/dist/faux-computers.d.ts +8 -2
  50. package/dist/faux-computers.js +83 -6
  51. package/dist/harness-archive.d.ts +67 -0
  52. package/dist/harness-archive.js +177 -0
  53. package/dist/harness-goose.d.ts +34 -0
  54. package/dist/harness-goose.js +87 -0
  55. package/dist/harness-install.d.ts +21 -0
  56. package/dist/harness-install.js +24 -11
  57. package/dist/harness-opencode/adapter.js +1 -1
  58. package/dist/harness-table.d.ts +9 -1
  59. package/dist/harness-table.js +20 -3
  60. package/dist/harness.d.ts +1 -2
  61. package/dist/harness.js +3 -4
  62. package/dist/host.js +2 -1
  63. package/dist/import.d.ts +10 -0
  64. package/dist/import.js +28 -8
  65. package/dist/key-check.js +3 -0
  66. package/dist/learn/audit.d.ts +6 -6
  67. package/dist/learn/audit.js +3 -7
  68. package/dist/learn/check.d.ts +23 -89
  69. package/dist/learn/check.js +57 -335
  70. package/dist/learn/commit.d.ts +63 -90
  71. package/dist/learn/commit.js +124 -316
  72. package/dist/learn/compile.d.ts +53 -50
  73. package/dist/learn/compile.js +89 -104
  74. package/dist/learn/corrections.d.ts +13 -0
  75. package/dist/learn/corrections.js +23 -0
  76. package/dist/learn/delete.d.ts +5 -5
  77. package/dist/learn/delete.js +8 -10
  78. package/dist/learn/folder.d.ts +35 -47
  79. package/dist/learn/folder.js +118 -134
  80. package/dist/learn/index.d.ts +3 -5
  81. package/dist/learn/index.js +6 -9
  82. package/dist/learn/learning.sh +45 -15
  83. package/dist/learn/promote.d.ts +23 -5
  84. package/dist/learn/promote.js +40 -2
  85. package/dist/learn/{skills.d.ts → workflow-draft.d.ts} +30 -38
  86. package/dist/learn/{skills.js → workflow-draft.js} +48 -58
  87. package/dist/learn/workflow-nodes.js +1 -1
  88. package/dist/learned-workflow.js +2 -2
  89. package/dist/learning-cost.d.ts +38 -24
  90. package/dist/learning-cost.js +41 -24
  91. package/dist/learning-routes.d.ts +91 -170
  92. package/dist/learning-routes.js +183 -421
  93. package/dist/learning-run.d.ts +19 -40
  94. package/dist/learning-run.js +23 -93
  95. package/dist/learning-setting.d.ts +21 -10
  96. package/dist/learning-setting.js +47 -11
  97. package/dist/learning-words.d.ts +28 -74
  98. package/dist/learning-words.js +64 -162
  99. package/dist/learning.d.ts +61 -392
  100. package/dist/learning.js +101 -651
  101. package/dist/live-reach.d.ts +25 -2
  102. package/dist/live-reach.js +46 -4
  103. package/dist/llms.txt +1 -1
  104. package/dist/local-models.d.ts +3 -11
  105. package/dist/local-models.js +5 -6
  106. package/dist/mcp-servers-store.d.ts +4 -4
  107. package/dist/model-form.js +6 -5
  108. package/dist/model.d.ts +4 -0
  109. package/dist/model.js +26 -9
  110. package/dist/native/binding.js +1 -1
  111. package/dist/native/connection.js +1 -1
  112. package/dist/native/discovery.js +1 -1
  113. package/dist/native/instructions.d.ts +3 -0
  114. package/dist/native/instructions.js +5 -3
  115. package/dist/native/remote-worker-bridge.js +9 -43
  116. package/dist/native/remote.d.ts +8 -15
  117. package/dist/native/remote.js +3 -3
  118. package/dist/native/schema.js +1 -1
  119. package/dist/native/types.d.ts +2 -2
  120. package/dist/openapi.js +273 -319
  121. package/dist/paid-calls.d.ts +8 -0
  122. package/dist/paid-calls.js +20 -0
  123. package/dist/particle-provider.d.ts +11 -0
  124. package/dist/particle-provider.js +135 -0
  125. package/dist/port-models.d.ts +12 -4
  126. package/dist/port-models.js +28 -11
  127. package/dist/print.d.ts +27 -0
  128. package/dist/print.js +21 -0
  129. package/dist/provider.d.ts +7 -0
  130. package/dist/provider.js +15 -1
  131. package/dist/reflect-range.js +2 -3
  132. package/dist/run-launch.d.ts +14 -28
  133. package/dist/run-launch.js +9 -12
  134. package/dist/run-learning-served.d.ts +15 -89
  135. package/dist/run-listing.d.ts +34 -0
  136. package/dist/run-listing.js +128 -0
  137. package/dist/run-model-key.js +1 -1
  138. package/dist/run-timeline-served.js +5 -3
  139. package/dist/run-trace.d.ts +97 -0
  140. package/dist/run-trace.js +253 -0
  141. package/dist/run-view.d.ts +15 -0
  142. package/dist/run-view.js +9 -0
  143. package/dist/runnable.js +2 -1
  144. package/dist/runner/adapter-loop.d.ts +8 -6
  145. package/dist/runner/adapter-loop.js +16 -12
  146. package/dist/runner/adapter-run-spec.d.ts +16 -4
  147. package/dist/runner/adapter-run-spec.js +64 -58
  148. package/dist/runner/adapters/index.js +22 -0
  149. package/dist/runner/adapters/pi.d.ts +4 -12
  150. package/dist/runner/adapters/pi.js +2 -2
  151. package/dist/runner/audit.d.ts +1 -1
  152. package/dist/runner/audit.js +30 -13
  153. package/dist/runner/beside.d.ts +6 -2
  154. package/dist/runner/beside.js +38 -9
  155. package/dist/runner/claim-secrets.d.ts +18 -2
  156. package/dist/runner/claim-secrets.js +42 -18
  157. package/dist/runner/cli-run-spec.js +55 -51
  158. package/dist/runner/conformance/harness.d.ts +6 -0
  159. package/dist/runner/conformance/harness.js +35 -13
  160. package/dist/runner/conformance/subject.d.ts +6 -0
  161. package/dist/runner/dispatch.d.ts +2 -2
  162. package/dist/runner/end-of-run.d.ts +6 -14
  163. package/dist/runner/end-of-run.js +8 -33
  164. package/dist/runner/feedback-round.d.ts +2 -2
  165. package/dist/runner/feedback-round.js +7 -7
  166. package/dist/runner/github-app.js +3 -1
  167. package/dist/runner/harness-loops.d.ts +0 -8
  168. package/dist/runner/harness-loops.js +11 -59
  169. package/dist/runner/held.d.ts +170 -0
  170. package/dist/runner/held.js +57 -0
  171. package/dist/runner/journal-kinds.d.ts +2 -3
  172. package/dist/runner/journal-kinds.js +2 -3
  173. package/dist/runner/learned-first.d.ts +40 -0
  174. package/dist/runner/learned-first.js +32 -0
  175. package/dist/runner/learning-end.d.ts +77 -69
  176. package/dist/runner/learning-end.js +250 -303
  177. package/dist/runner/learning-seed.d.ts +15 -33
  178. package/dist/runner/learning-seed.js +24 -45
  179. package/dist/runner/loop-contract.d.ts +2 -3
  180. package/dist/runner/main.d.ts +17 -9
  181. package/dist/runner/main.js +82 -20
  182. package/dist/runner/mcp-run.d.ts +11 -0
  183. package/dist/runner/mcp-run.js +67 -0
  184. package/dist/runner/memory-claim.d.ts +10 -5
  185. package/dist/runner/memory-claim.js +12 -6
  186. package/dist/runner/model-route.d.ts +7 -4
  187. package/dist/runner/model-route.js +22 -10
  188. package/dist/runner/native-loop.d.ts +0 -7
  189. package/dist/runner/native-loop.js +9 -101
  190. package/dist/runner/promotion.d.ts +12 -8
  191. package/dist/runner/promotion.js +37 -28
  192. package/dist/runner/reflect-hook.d.ts +64 -95
  193. package/dist/runner/reflect-hook.js +112 -225
  194. package/dist/runner/run-channel.d.ts +43 -0
  195. package/dist/runner/run-channel.js +467 -0
  196. package/dist/runner/run-child-host.d.ts +169 -0
  197. package/dist/runner/run-child-host.js +1230 -0
  198. package/dist/runner/run-child.d.ts +1 -0
  199. package/dist/runner/run-child.js +254 -0
  200. package/dist/runner/run-errors.d.ts +2 -0
  201. package/dist/runner/run-errors.js +20 -0
  202. package/dist/runner/runner.js +1 -5
  203. package/dist/runner/sdk-ask.d.ts +78 -0
  204. package/dist/runner/sdk-ask.js +158 -0
  205. package/dist/runner/sdk-loop.d.ts +2 -4
  206. package/dist/runner/sdk-loop.js +29 -49
  207. package/dist/runner/store-secrets.d.ts +5 -3
  208. package/dist/runner/store-secrets.js +5 -1
  209. package/dist/runner/workflow-first.d.ts +5 -0
  210. package/dist/runner/workflow-first.js +4 -0
  211. package/dist/runner/workflow-spec.js +7 -2
  212. package/dist/runs-over-store.d.ts +16 -28
  213. package/dist/runs-over-store.js +31 -38
  214. package/dist/sdk/runs.d.ts +6 -11
  215. package/dist/sdk/runs.js +20 -41
  216. package/dist/sdk/schema.js +3 -4
  217. package/dist/seal-key.d.ts +5 -0
  218. package/dist/seal-key.js +7 -0
  219. package/dist/secrets.d.ts +3 -0
  220. package/dist/secrets.js +16 -3
  221. package/dist/server.d.ts +55 -33
  222. package/dist/server.js +689 -322
  223. package/dist/sign-ins-store.d.ts +8 -0
  224. package/dist/sign-ins-store.js +36 -1
  225. package/dist/skills.js +1 -1
  226. package/dist/store/index.d.ts +2 -2
  227. package/dist/store/index.js +1 -1
  228. package/dist/store/journal/storage.js +3 -0
  229. package/dist/store/postgres/migrations/0017_run_listing.sql +83 -0
  230. package/dist/store/postgres/migrations/0018_trigger_template.sql +6 -0
  231. package/dist/store/postgres/migrations/0019_runner_relays.sql +28 -0
  232. package/dist/store/schema.d.ts +53 -4
  233. package/dist/store/schema.js +137 -6
  234. package/dist/store/sqlite/connection.d.ts +2 -0
  235. package/dist/store/sqlite/connection.js +3 -1
  236. package/dist/store/sqlite/run-patch.d.ts +0 -17
  237. package/dist/store/sqlite/run-patch.js +4 -33
  238. package/dist/store/sqlite/store.js +246 -63
  239. package/dist/store/sqlite/worker.js +25 -0
  240. package/dist/store/store.d.ts +193 -36
  241. package/dist/store/store.js +25 -3
  242. package/dist/store-reads/learning.d.ts +102 -204
  243. package/dist/store-reads/learning.js +159 -321
  244. package/dist/store-reads/loop.d.ts +0 -1
  245. package/dist/store-reads/loop.js +1 -1
  246. package/dist/store-view.d.ts +29 -1
  247. package/dist/store-view.js +97 -31
  248. package/dist/template-eval.d.ts +3 -6
  249. package/dist/template-eval.js +22 -36
  250. package/dist/templates.d.ts +8 -4
  251. package/dist/templates.js +44 -6
  252. package/dist/timeline/index.d.ts +1 -1
  253. package/dist/timeline/index.js +1 -1
  254. package/dist/timeline/timeline.d.ts +5 -1
  255. package/dist/timeline/timeline.js +16 -0
  256. package/dist/tool-gate.d.ts +0 -7
  257. package/dist/tool-gate.js +1 -15
  258. package/dist/tool-keys-store.d.ts +1 -1
  259. package/dist/tool-keys.d.ts +6 -4
  260. package/dist/tool-keys.js +12 -6
  261. package/dist/tools.d.ts +2 -2
  262. package/dist/tools.js +11 -4
  263. package/dist/triggers.d.ts +65 -6
  264. package/dist/triggers.js +125 -19
  265. package/dist/validate.js +1 -1
  266. package/dist/webhooks.d.ts +7 -2
  267. package/dist/webhooks.js +12 -5
  268. package/dist/workspace/agent-computer.d.ts +2 -0
  269. package/dist/workspace/agent-computer.js +2 -0
  270. package/dist/workspace/archil-claim.d.ts +7 -0
  271. package/dist/workspace/archil-claim.js +29 -0
  272. package/dist/workspace/archil.d.ts +9 -1
  273. package/dist/workspace/archil.js +165 -3
  274. package/dist/workspace/attach.d.ts +3 -1
  275. package/dist/workspace/attach.js +2 -0
  276. package/dist/workspace/attached-computers.d.ts +16 -5
  277. package/dist/workspace/attached-computers.js +25 -9
  278. package/dist/workspace/computer-deps.js +1 -1
  279. package/dist/workspace/computer-for-claim.d.ts +7 -3
  280. package/dist/workspace/computer-for-claim.js +119 -22
  281. package/dist/workspace/computer-hold.js +2 -1
  282. package/dist/workspace/computer-kept.d.ts +11 -1
  283. package/dist/workspace/computer-kept.js +24 -3
  284. package/dist/workspace/resolve-computer.d.ts +33 -19
  285. package/dist/workspace/resolve-computer.js +172 -64
  286. package/dist/workspace/revision-skills.d.ts +1 -2
  287. package/dist/workspace/revision-skills.js +3 -4
  288. package/dist/workspace/run-workspace.d.ts +1 -1
  289. package/dist/workspace/run-workspace.js +5 -0
  290. package/dist/workspace/synced-folder.d.ts +85 -0
  291. package/dist/workspace/synced-folder.js +230 -0
  292. package/dist/workspace/workspace.d.ts +4 -0
  293. package/launcher/agentrun-serve +1 -1
  294. package/package.json +10 -10
  295. package/templates/README.md +8 -8
  296. package/templates/inbound-lead/agent.md +5 -4
  297. package/templates/inbound-lead/evals/learned-correction/case.yaml +3 -3
  298. package/templates/inbound-lead/evals/learned-correction/fixtures/corrections.md +1 -0
  299. package/templates/inbound-lead/evals/learned-correction/graders/applies-correction.md +22 -0
  300. package/templates/inbound-lead/evals/learned-correction/graders/learned-origin.md +1 -1
  301. package/templates/inbound-lead/evals/learned-correction/prompt.md +1 -1
  302. package/templates/inbound-lead/lead.schema.json +6 -5
  303. package/templates/inbound-lead/rules/RUBRIC.md +4 -4
  304. package/templates/inbound-lead/skills/lead/SKILL.md +4 -4
  305. package/templates/kyb/agent.md +2 -1
  306. package/templates/market-monitor/evals/learned-preference/case.yaml +4 -4
  307. package/templates/market-monitor/evals/learned-preference/fixtures/corrections.md +1 -0
  308. package/templates/market-monitor/evals/learned-preference/graders/omits-junior-post.md +3 -3
  309. package/templates/market-monitor/evals/learned-preference/prompt.md +1 -1
  310. package/templates/release-notes/evals/learned-style/case.yaml +4 -4
  311. package/templates/release-notes/evals/learned-style/fixtures/corrections.md +1 -0
  312. package/templates/release-notes/evals/learned-style/graders/same-changes.md +2 -2
  313. package/templates/release-notes/evals/learned-style/prompt.md +1 -1
  314. package/dist/console/assets/index-BUktRvS-.css +0 -1
  315. package/dist/console/assets/index-nB9kTfIN.js +0 -711
  316. package/dist/learn/grade.d.ts +0 -138
  317. package/dist/learn/grade.js +0 -682
  318. package/dist/learn/notes.d.ts +0 -81
  319. package/dist/learn/notes.js +0 -178
  320. package/dist/learn/reflect.d.ts +0 -77
  321. package/dist/learn/reflect.js +0 -228
  322. package/dist/learn/relevance.d.ts +0 -24
  323. package/dist/learn/relevance.js +0 -91
  324. package/dist/learn/seed-check.d.ts +0 -74
  325. package/dist/learn/seed-check.js +0 -103
  326. package/dist/learning-batch.d.ts +0 -291
  327. package/dist/learning-batch.js +0 -600
  328. package/dist/learning-evals.d.ts +0 -35
  329. package/dist/learning-evals.js +0 -99
  330. package/dist/native/context.d.ts +0 -6
  331. package/dist/native/context.js +0 -22
  332. package/dist/propose.d.ts +0 -52
  333. package/dist/propose.js +0 -224
  334. package/dist/runner/learning-ask.d.ts +0 -47
  335. package/dist/runner/learning-ask.js +0 -128
  336. package/dist/runner/learning-dispatch.d.ts +0 -45
  337. package/dist/runner/learning-dispatch.js +0 -99
  338. package/dist/runner/learning-factory.d.ts +0 -16
  339. package/dist/runner/learning-factory.js +0 -50
  340. package/dist/runner/learning-loop.d.ts +0 -273
  341. package/dist/runner/learning-loop.js +0 -521
  342. package/dist/usage.d.ts +0 -11
  343. package/dist/usage.js +0 -11
  344. package/templates/inbound-lead/evals/learned-correction/fixtures/learning/MEMORY.md +0 -1
  345. package/templates/inbound-lead/evals/learned-correction/fixtures/learning/no-agencies.md +0 -14
  346. package/templates/inbound-lead/evals/learned-correction/graders/applies-note.md +0 -21
  347. package/templates/market-monitor/evals/learned-preference/fixtures/learning/MEMORY.md +0 -1
  348. package/templates/market-monitor/evals/learned-preference/fixtures/learning/skip-junior-job-posts.md +0 -8
  349. package/templates/release-notes/evals/learned-style/fixtures/learning/MEMORY.md +0 -1
  350. package/templates/release-notes/evals/learned-style/fixtures/learning/say-agent-not-bot.md +0 -13
package/dist/sdk/runs.js CHANGED
@@ -7,14 +7,15 @@ import { canonical, isObject } from "../store/agent-body.js";
7
7
  import { uuidv7 } from "../agents-store.js";
8
8
  import { launchBody } from "../run-launch.js";
9
9
  import { learningStartFor } from "../runs-over-store.js";
10
- import { learnsWorkflowsOf } from "../learning-setting.js";
11
- import { chooseWorkflows, chooseSkills, learningFolderOf, readerOf, seedFrom, secretsShown } from "../learning.js";
12
- import { NATIVE_GRADE_INSTRUCTION_BYTES } from "../learn/grade.js";
10
+ import { chooseWorkflows, learningFolderOf, seedAt, secretsShown } from "../learning.js";
11
+ import { INSTRUCTION_EVIDENCE_BYTES } from "../native/instructions.js";
13
12
  import { secretRedactor } from "../runner/redact.js";
14
13
  import { redactedOutput } from "../key-refusal.js";
15
- import { decodedStrings, draftProblems, servedSkill } from "../learn/skills.js";
14
+ import { decodedStrings, draftProblems } from "../learn/workflow-draft.js";
16
15
  import { sdkWorkflowManifest, sdkDraftTools } from "./workflows.js";
17
16
  const keyOf = (id) => `sdk-run:${id}`;
17
+ /** The settings key an SDK run's record is kept under (the run's delete with its agent's: agent-delete.ts). */
18
+ export const sdkRunKey = keyOf;
18
19
  const TEXT_LIMIT = 128_000, BATCH_LIMIT = 256_000, TOTAL_LIMIT = 4_000_000;
19
20
  // Always leave enough room for bounded completion after an evidence upload reaches its limit.
20
21
  const EVIDENCE_LIMIT = TOTAL_LIMIT - 600_000;
@@ -157,7 +158,7 @@ export class SdkRuns {
157
158
  // so treating serialized JSON as prose could remove its delimiters and corrupt the envelope.
158
159
  return redactedOutput(body, redact.heldValues?.() ?? []);
159
160
  }
160
- async start(entry, body, deps, origin, checkGrade, consoleOrigin) {
161
+ async start(entry, body, deps, origin, compile, consoleOrigin) {
161
162
  only(body, ["runtime", "input", "instructions", "model", "workflow_tools", "workflow_adapters"]);
162
163
  const workflow = sdkWorkflowManifest(body.workflow_tools, body.workflow_adapters);
163
164
  if (workflow && canonical(this.clean(workflow)) !== canonical(workflow))
@@ -186,18 +187,20 @@ export class SdkRuns {
186
187
  const revisionBody = entry.revision.body;
187
188
  if (revisionBody.maxCostUsd !== undefined)
188
189
  throw new ApiError("agent_not_runnable", "AgentRun cannot enforce a spend cap on an external SDK. Configure the budget in the backend SDK and remove this managed run cap.");
189
- const learning = await learningStartFor(deps, entry, pinned.revision, { ...revisionBody, ...(!workflow && learnsWorkflowsOf(revisionBody.learning) ? { learning: "notes" } : {}) }, { content: cleanedInput });
190
+ const learning = await learningStartFor(deps, entry, pinned.revision, revisionBody, {
191
+ noWorkflows: !workflow,
192
+ ...(compile.model ? { model: compile.model } : {}),
193
+ });
190
194
  if (learning) {
191
- if (Buffer.byteLength(instructions) > NATIVE_GRADE_INSTRUCTION_BYTES)
192
- refuse("Original SDK instructions exceed the 64 KiB grading evidence limit. Keep learning off or provide a complete policy within that limit.");
193
- if (!learning.gradeModel)
194
- throw new ApiError("agent_not_runnable", "Self-improving SDK runs need a server grading model and its model key. Configure the grading model or turn self-improving off.");
195
- await checkGrade(learning.gradeModel);
195
+ if (Buffer.byteLength(instructions) > INSTRUCTION_EVIDENCE_BYTES)
196
+ refuse("Original SDK instructions exceed the 64 KiB learning evidence limit. Keep learning off or provide a complete policy within that limit.");
197
+ if (!learning.model)
198
+ throw new ApiError("agent_not_runnable", "Self-improving SDK runs need a server model and its model key to compile workflows. Configure the model or turn self-improving off.");
199
+ await compile.check(learning.model);
196
200
  if (learning.seedFailed)
197
201
  throw new ApiError("unavailable", "The learning seed could not be read. Retry after restoring the agent learning folder.");
198
202
  }
199
- const skills = learning ? await this.selectedSkills(entry.agent.id, learning.seed) : [];
200
- const workflows = learning && !learning.notesOnly && workflow ? await this.selectedWorkflows(entry.agent.id, learning.seed, workflow) : [];
203
+ const workflows = learning && !learning.noWorkflows && workflow ? await this.selectedWorkflows(entry.agent.id, learning.seed, workflow) : [];
201
204
  const cleaned = this.clean({ instructions, ...(model ? { model } : {}) });
202
205
  const runId = uuidv7();
203
206
  const launch = {
@@ -211,7 +214,7 @@ export class SdkRuns {
211
214
  instructions: cleaned.instructions,
212
215
  ...(cleaned.model ? { model: cleaned.model } : {}),
213
216
  },
214
- ...(learning ? { learning: { ...learning, skills: skills.map((skill) => skill.name), workflows: workflows.map((flow) => flow.name) } } : {}),
217
+ ...(learning ? { learning: { ...learning, workflows: workflows.map((flow) => flow.name) } } : {}),
215
218
  };
216
219
  const now = Date.now();
217
220
  await this.store.settings.put(keyOf(runId), {
@@ -219,7 +222,6 @@ export class SdkRuns {
219
222
  created_at: now,
220
223
  expires_at: now + 3_600_000,
221
224
  batches: [],
222
- learning_skills: skills,
223
225
  learning_workflows: workflows,
224
226
  });
225
227
  try {
@@ -236,25 +238,14 @@ export class SdkRuns {
236
238
  if (!run)
237
239
  throw new ApiError("not_found", "SDK run not found.");
238
240
  const launch = (await this.store.runs.launch(runId)).body;
239
- let inbox = await sdkInbox(this.store, runId);
240
- if (inbox.learning_skills === undefined) {
241
- // Older runs did not persist their delivered files. Pin a receipt from their original
242
- // commit now; do not claim these reconstructed files were supplied on an earlier attempt.
243
- const skills = launch.learning ? await this.selectedSkills(run.agentId, launch.learning.seed) : [];
244
- await this.modify(runId, (row) => row.learning_skills === undefined ? { ...row, learning_skills: skills } : row);
245
- inbox = await sdkInbox(this.store, runId);
246
- }
247
- const skills = inbox.learning_skills ?? [];
248
- // Older SDK receipts never included executable workflows. Do not retroactively deliver one.
241
+ const inbox = await sdkInbox(this.store, runId);
249
242
  const workflows = inbox.learning_workflows ?? [];
250
243
  const shown = secretsShown(this.secrets(), { local: true });
251
244
  if (shown.holds(launch.learning?.section ?? "") ||
252
245
  workflows.some((flow) => {
253
246
  const decoded = decodedStrings(flow.workflow);
254
247
  return shown.holds(flow.name) || shown.holds(flow.description) || shown.holds(flow.workflow) || decoded === "too_deep" || decoded.some(shown.holds);
255
- }) ||
256
- skills.some((skill) => shown.holds(skill.name) ||
257
- Object.entries(skill.files).some(([path, text]) => shown.holds(path) || shown.holds(text) || (path === "SKILL.md" && shown.holds(servedSkill(text))))))
248
+ }))
258
249
  throw new ApiError("unavailable", "The pinned SDK learning contains a protected value. Start a new run to receive a fresh safe seed.");
259
250
  return {
260
251
  run_id: runId,
@@ -265,7 +256,6 @@ export class SdkRuns {
265
256
  enabled: !!launch.learning,
266
257
  revision: launch.learning?.seed ?? null,
267
258
  context: launch.learning?.section ?? "",
268
- skills,
269
259
  workflows,
270
260
  },
271
261
  };
@@ -273,7 +263,7 @@ export class SdkRuns {
273
263
  async selectedWorkflows(agentId, revision, binding) {
274
264
  const folder = learningFolderOf(this.data, agentId);
275
265
  try {
276
- const seed = await seedFrom(revision, readerOf(folder.workspace));
266
+ const seed = await seedAt(folder.workspace, revision);
277
267
  const { flows } = chooseWorkflows(seed, secretsShown(this.secrets(), { local: true }));
278
268
  const dsl = await import("@parcha/agentrun-dsl");
279
269
  const { tools, gated, deniedBy } = sdkDraftTools(binding.workflow_tools);
@@ -290,17 +280,6 @@ export class SdkRuns {
290
280
  await folder.end();
291
281
  }
292
282
  }
293
- async selectedSkills(agentId, revision) {
294
- const folder = learningFolderOf(this.data, agentId);
295
- try {
296
- const seed = await seedFrom(revision, readerOf(folder.workspace));
297
- const { taken } = await chooseSkills(folder.workspace, seed, [], secretsShown(this.secrets(), { local: true }));
298
- return taken.map((skill) => ({ name: skill.name, files: { ...skill.files } }));
299
- }
300
- finally {
301
- await folder.end();
302
- }
303
- }
304
283
  async modify(runId, change, limit = TOTAL_LIMIT) {
305
284
  for (let retry = 0; retry < 20; retry++) {
306
285
  const old = await sdkInbox(this.store, runId), next = change(old);
@@ -48,9 +48,8 @@ const errors = Object.fromEntries([400, 401, 404, 409, 413, 422, 503].map((statu
48
48
  const learning = object({
49
49
  enabled: { type: "boolean" },
50
50
  revision: { type: ["string", "null"] },
51
- context: text,
52
- skills: { type: "array", items: object({ name: text, files: { type: "object", additionalProperties: text } }) },
53
- workflows: { type: "array", items: object({ name: text, workflow: text, description: text }), description: "Approved, capability-compatible workflows pinned to this run; empty without a backend workflow bridge or when learning is notes-only or Off." },
51
+ context: { ...text, description: "The agent's corrections.md as the run reads it under # Learned; empty when Off or nothing is learned yet." },
52
+ workflows: { type: "array", items: object({ name: text, workflow: text, description: text }), description: "Active, capability-compatible learned workflows pinned to this run; empty without a backend workflow bridge or when learning is Off." },
54
53
  });
55
54
  export const SDK_PATHS = {
56
55
  "/agents/{agent_id}/sdk-runs": {
@@ -92,7 +91,7 @@ export const SDK_PATHS = {
92
91
  ...mark,
93
92
  operationId: "getSdkRun",
94
93
  summary: "Read SDK run and learning state",
95
- description: "Use the scoped token returned by startSdkRun. A completed task can still have proposed learning awaiting its separate grader. The learning field is the ordinary run learning view.",
94
+ description: "Use the scoped token returned by startSdkRun. A completed task can still be reflecting while its compile turn runs. The learning field is the ordinary run learning view.",
96
95
  parameters: [id("run_id")],
97
96
  responses: {
98
97
  200: response(object({
@@ -32,6 +32,11 @@ export type BootedSealKey = SealKey & {
32
32
  export declare function ensureSealKey(given: string | undefined, { dataDir }: {
33
33
  dataDir: string;
34
34
  }): SealKey;
35
+ /** The digest a template apply keeps of its parameters (`text`: their stable JSON), in place of the parameters: an
36
+ * HMAC-SHA256 of it under a key drawn from the seal key `key` by a label of its own, so the store holds neither a
37
+ * parameter (one may be a credential) nor a hash a guess could be checked against without the seal key. The same
38
+ * parameters under the same seal key give the same digest. */
39
+ export declare const parametersDigest: (key: Buffer, text: string) => string;
35
40
  /** The fingerprint the store records of `key`: an HMAC of a fixed label under it. Neither the key nor a hash of it alone. */
36
41
  export declare const sealKeyFingerprint: (key: Buffer) => string;
37
42
  /** The store slice the check reads and writes. */
package/dist/seal-key.js CHANGED
@@ -151,6 +151,13 @@ export function ensureSealKey(given, { dataDir }) {
151
151
  throw refused(`${join(dir, SEAL_KEY_FILE)} could not be read back`);
152
152
  return { ...made, generated };
153
153
  }
154
+ /** The label the key of a template apply's parameters digest is drawn from the seal key by: that key is no other's. */
155
+ const PARAMETERS_DIGEST_LABEL = "agentrun template parameters digest v1";
156
+ /** The digest a template apply keeps of its parameters (`text`: their stable JSON), in place of the parameters: an
157
+ * HMAC-SHA256 of it under a key drawn from the seal key `key` by a label of its own, so the store holds neither a
158
+ * parameter (one may be a credential) nor a hash a guess could be checked against without the seal key. The same
159
+ * parameters under the same seal key give the same digest. */
160
+ export const parametersDigest = (key, text) => createHmac("sha256", createHmac("sha256", key).update(PARAMETERS_DIGEST_LABEL).digest()).update(text).digest("base64url");
154
161
  /** The fingerprint the store records of `key`: an HMAC of a fixed label under it. Neither the key nor a hash of it alone. */
155
162
  export const sealKeyFingerprint = (key) => createHmac("sha256", key).update(FINGERPRINT_LABEL).digest("base64url");
156
163
  /** The fingerprint a store setting's value records: undefined with none, null for one that does not read. */
package/dist/secrets.d.ts CHANGED
@@ -12,6 +12,9 @@ export declare const MCP_AUTH = "AGENTRUN_MCP_AUTH";
12
12
  /** The decision keys among them: a run's process gets them only on its decision descriptor (decisions.ts), never with
13
13
  * the secrets on its pipe, which are its tools' environment. */
14
14
  export declare const DECISION_KEYS: readonly string[];
15
+ /** NAME=VALUE pairs, each ended by a NUL: what a pipe of secrets carries. A runner writes a run's own process its pairs
16
+ * with it (run-child-host.ts), as a launcher writes its server's. */
17
+ export declare const encode: (pairs: Iterable<readonly [string, string]>) => Buffer;
15
18
  /** Reads a tool key a person saved through a server's settings API (tool-keys.ts), by name, opened when asked for. Each
16
19
  * server hands its own to what reads for it (its reading, its runs' handover), never through this module, so two
17
20
  * servers in one process never read each other's saved keys. A run's process has none: it gets what it needs over its
package/dist/secrets.js CHANGED
@@ -39,8 +39,9 @@ let handed;
39
39
  * the secrets, so it is no tool's environment and no key a scan looks for by name. */
40
40
  const SIGN_IN_PAIR = "AGENTRUN_SIGN_IN";
41
41
  let signIn;
42
- /** NAME=VALUE pairs, each ended by a NUL. */
43
- const encode = (pairs) => Buffer.concat([...pairs].map(([name, value]) => Buffer.from(`${name}=${value}\0`)));
42
+ /** NAME=VALUE pairs, each ended by a NUL: what a pipe of secrets carries. A runner writes a run's own process its pairs
43
+ * with it (run-child-host.ts), as a launcher writes its server's. */
44
+ export const encode = (pairs) => Buffer.concat([...pairs].map(([name, value]) => Buffer.from(`${name}=${value}\0`)));
44
45
  function decode(bytes) {
45
46
  for (const pair of bytes.toString("utf8").split("\0")) {
46
47
  const at = pair.indexOf("=");
@@ -54,8 +55,20 @@ function decode(bytes) {
54
55
  * gone short, and refused. */
55
56
  function readExactly(fd, length) {
56
57
  const bytes = Buffer.alloc(length);
58
+ // A run's process gets its pipe from Node's spawn as a socket that does not block: a read before the runner's write
59
+ // lands is EAGAIN, waited out here for as long as a slow start may take, never past it.
60
+ const until = Date.now() + 60_000;
57
61
  for (let read = 0; read < length;) {
58
- const got = readSync(fd, bytes, read, length - read, null);
62
+ let got;
63
+ try {
64
+ got = readSync(fd, bytes, read, length - read, null);
65
+ }
66
+ catch (error) {
67
+ if (error.code !== "EAGAIN" || Date.now() > until)
68
+ throw error;
69
+ Atomics.wait(new Int32Array(new SharedArrayBuffer(4)), 0, 0, 5);
70
+ continue;
71
+ }
59
72
  if (got === 0)
60
73
  throw new Error(`the secrets' pipe ended after ${read} of ${length} bytes`);
61
74
  read += got;
package/dist/server.d.ts CHANGED
@@ -14,6 +14,9 @@ import type { TriggerAdapter } from "./trigger-adapter.js";
14
14
  import { type TriggerClock } from "./triggers.js";
15
15
  import { type ToolSettingsMap } from "./tool-plane.js";
16
16
  import { AttachHub, type HostedDial } from "@parcha/agentrun-computer";
17
+ import { type AttachTiming } from "./computer-attach.js";
18
+ import { type ArchilRoutesOptions } from "./archil-routes.js";
19
+ import { type AgentDeleteStep, type DeleteLearning } from "./agent-delete.js";
17
20
  export declare const CONTRACT = "agentrun.v2/0";
18
21
  export { DEFAULT_PORT };
19
22
  export type ServeOptions = {
@@ -84,12 +87,10 @@ export type ServeOptions = {
84
87
  * (the console, sign-in, setup, settings, MCP, triggers, hooks, ...) with a 404 before anything reads the request.
85
88
  * It has no owner: accounts and open setup are off, there being no page to sign in to. */
86
89
  apiOnly?: boolean;
87
- /** Another Archil control plane than the key's region's, and its fetch: a test's fake, for the server's own Archil calls
88
- * (a launch's disk read, the settings' test, an agent's disk removed). */
89
- archilControl?: {
90
- readonly baseUrl?: string;
91
- readonly fetch?: typeof fetch;
92
- };
90
+ /** Another Archil control plane than the key's region's, and its fetch, and another maker of a disk's file API: a
91
+ * test's fakes, for the server's own Archil calls (a launch's disk read, the settings' test, an agent's disk removed,
92
+ * a deleted agent's run folder removed from a disk its launch named). */
93
+ archilControl?: ArchilRoutesOptions["control"];
93
94
  /** Another Composio than the real one, and its fetch: a test's fake, for the Composio preset's calls (composio-preset.ts). */
94
95
  composioControl?: ComposioControl;
95
96
  /** With `faux` only: a module whose default export gives the `browser` tool's `{ provider, driver }` (the tests' fake
@@ -154,6 +155,16 @@ export type ServeOptions = {
154
155
  console?: string;
155
156
  /** How long a run's process may finish its turn after SIGTERM (default 30s): `8s`, `500ms`, `1m`. */
156
157
  drainTimeout?: string;
158
+ /** How often the runs' listings' builder looks again when it found nothing to build (run-listing.ts; default
159
+ * LISTER_IDLE_MS). `Infinity`: it builds only when Serve.listingSettled asks, so a test reads what a list builds alone. */
160
+ listerIdleMs?: number;
161
+ /** No runner beside this server in its process (the CLI's --no-runner, the image's server-and-runner): a paired
162
+ * computer's socket is held here, where no run reaches it, so a pairing code, the pair answer and each paired computer
163
+ * say so and how to start the server instead (attached-computers.ts RUNNER_APART_WORDS). */
164
+ runnerApart?: boolean;
165
+ /** For tests: the attach socket's liveness timing (computer-attach.ts AttachTiming), a relayed dial's included; the
166
+ * protocol's by default. */
167
+ attachTiming?: AttachTiming;
157
168
  /** The most runs at once (default: AGENTRUN_MAX_RUNS, else as many pi runs as this host's memory holds: host.ts),
158
169
  * beside the memory each run's harness reserves; over either, 429. */
159
170
  maxRuns?: number;
@@ -164,21 +175,15 @@ export type ServeOptions = {
164
175
  /** The lines a person reads about a stop on this data root: this server's, as its close begins and runs' processes are
165
176
  * left to finish their turn. Default: standard error, after `agentrun-serve: `. */
166
177
  notice?: (line: string) => void;
167
- /** The model the grader runs on (`--grade-model`; default AGENTRUN_SERVE_GRADE_MODEL, else the strong tier,
168
- * AGENT_MODEL_STRONG, else each run's agent's own model). */
169
- gradeModel?: string;
170
178
  /** Whether runs learn (`--learning`; default AGENTRUN_SERVE_LEARNING, else `on`). `on`: a run of an agent whose
171
179
  * definition says `learning: true` starts from what its agent learned. `off`: no run this server starts does, whatever
172
180
  * its agent's definition says, and its `learning` is null. */
173
181
  learning?: LearningMode;
174
- /** A test's seam: how often a learning batch's loop looks at its run, in ms (learning-batch.ts; default 1000). */
175
- batchPollMs?: number;
176
- /** How much of what a run learned its instructions hold under `# Learned`, in UTF-8 bytes (`--learning-budget`;
177
- * default AGENTRUN_SERVE_LEARNING_BUDGET, else 8000): every note whole while they fit, else the notes that bear on
178
- * the run's input whole and a line for each of the rest (learning.ts learnedParts, its note selector). */
179
- learningBudget?: number;
180
182
  /** A test's seam: the triggers' clock and timer (triggers.ts), in place of Date.now and setTimeout. */
181
183
  triggerClock?: TriggerClock;
184
+ /** A test's seam: awaited by a template apply with agent_id right after it read that agent, inside its turn on the
185
+ * agent (applyTemplate), so a test can hold an update there and write meanwhile. */
186
+ templateApplyRead?: (agentId: string) => Promise<void>;
182
187
  /** A test's and a template eval's seam: the URL a feed trigger's read of `url` goes to in its place (a fake feed on
183
188
  * loopback, feed/feed-faux.ts); null when it serves no feed at `url` (read as unreachable, nothing sent); undefined
184
189
  * to read it as it is. The trigger, its payload and its words keep `url`. */
@@ -199,6 +204,17 @@ export type ServeOptions = {
199
204
  * command row is written, with the run's id and the message's text, so a test can hold a message at the run's door while
200
205
  * the run's state changes under it (runs-over-store.ts message). */
201
206
  beforeSubmit?: (runId: string, content: string) => Promise<void> | void;
207
+ /** A test's seam: step 2 of DELETE /agents/{id} (agent-delete.ts) in place of the learning module's deleteLearning over
208
+ * the agent's learning folder (learn/delete.ts), the server's own. */
209
+ deleteLearning?: DeleteLearning;
210
+ /** A test's seam: awaited at each step's point of DELETE /agents/{id} (agent-delete.ts AgentDeleteStep), so a throw
211
+ * there stops the delete as a crash would. */
212
+ agentDeleteAt?: (step: AgentDeleteStep, agentId: string) => void | Promise<void>;
213
+ /** A test's seam: awaited with a request's path and answer once its work under an Idempotency-Key is done, before the
214
+ * answer is kept, so a test can hold a request there while a DELETE /agents/{id} runs. */
215
+ beforeKeep?: (path: string, answer: unknown) => void | Promise<void>;
216
+ /** How long DELETE /agents/{id} waits for the agent's cancelled runs to end (default 30 s), then 409 runs_in_flight. */
217
+ agentDeleteWaitMs?: number;
202
218
  /** A test's seam: the folder the template packages are read from, in place of the package's own (templates.ts). */
203
219
  templates?: string;
204
220
  /** A test's seam: the GitHub a template import reads, its API's origin and the one host it may be sent to, in place of
@@ -206,6 +222,9 @@ export type ServeOptions = {
206
222
  templateImportApi?: string;
207
223
  /** The waits before each try again of a webhook delivery (default 5 s, 5 min, 30 min, 2 h, 5 h and 10 h: webhooks.ts RETRY_MS). */
208
224
  webhookRetryMs?: readonly number[];
225
+ /** The bound on one webhook try, whole milliseconds under the 60 s claim it holds its message by (default 15 s:
226
+ * webhooks.ts TIMEOUT_MS); any other value refuses the server's start. */
227
+ webhookTimeoutMs?: number;
209
228
  /** Whether the outbound webhook may send to a private network or this machine: off by default, so no caller of the API
210
229
  * can make the server POST inside its own network. The operator's AGENTRUN_WEBHOOK_PRIVATE_TARGETS=1 turns it on. */
211
230
  webhookPrivateTargets?: boolean;
@@ -260,6 +279,8 @@ export type Serve = {
260
279
  runs: number;
261
280
  boundMs: number;
262
281
  };
282
+ /** Resolves once every run's listing is current (run-listing.ts Lister.settled): for tests and benchmarks. */
283
+ listingSettled(): Promise<void>;
263
284
  };
264
285
  /** A route: `name` is its operationId in the OpenAPI document (openapi.ts); `capability`, when this server turns it off;
265
286
  * `raw`, a route whose body is bytes and not JSON, which the page's session may send with any content type, still only
@@ -296,9 +317,8 @@ export declare function offersEnvOf(env: NodeJS.ProcessEnv): NodeJS.ProcessEnv;
296
317
  * AGENTRUN_SERVE_LEARNING's when not given), its tool settings (`toolSettings`, what each web tool resolves to) and the
297
318
  * box offers (`boxes`, what the server found at the start, place-offers.ts), with whether a revision that names no
298
319
  * model runs (needsOf). The server makes it once at its start and then remakes only the parts a write changes
299
- * (startHolding), so a key saved later can make a harness, a provider or the default model available with no restart.
300
- * `gradeModel` is its `--grade-model`. */
301
- export declare function readingOf(base: NodeJS.ProcessEnv, maxRuns: number, stored?: StoredKeys, learning?: LearningMode, toolSettings?: ToolSettingsMap, boxes?: readonly BoxOffer[], gradeModel?: string): Promise<{
320
+ * (startHolding), so a key saved later can make a harness, a provider or the default model available with no restart. */
321
+ export declare function readingOf(base: NodeJS.ProcessEnv, maxRuns: number, stored?: StoredKeys, learning?: LearningMode, toolSettings?: ToolSettingsMap, boxes?: readonly BoxOffer[]): Promise<{
302
322
  env: NodeJS.ProcessEnv;
303
323
  offers: HarnessCapability[];
304
324
  caps: {
@@ -311,6 +331,9 @@ export declare function readingOf(base: NodeJS.ProcessEnv, maxRuns: number, stor
311
331
  };
312
332
  /** What runs a run here (the contract's `runtimes`, informational): this server's runners, over its one store. */
313
333
  runtimes: string[];
334
+ /** How a run is kept from another here (run-child-host.ts runIsolationOf): each a process of its own, and `uid`, each
335
+ * a user of its own too. */
336
+ run_isolation: "uid" | "process";
314
337
  /** The harnesses a revision may name (`definition.harness`), whether this server runs each, and how many at once. */
315
338
  harnesses: {
316
339
  max_concurrent_runs: number;
@@ -353,10 +376,9 @@ export declare function readingOf(base: NodeJS.ProcessEnv, maxRuns: number, stor
353
376
  fast: string | null;
354
377
  strong: string | null;
355
378
  };
356
- /** What grades a run's proposed notes: the model this server names for it (learning.ts gradeModelOf), or null when
357
- * each run is graded on its agent's own model; and `pending`: a risky rule, the user's or the run's own, is kept to
358
- * wait for its owner's OK, served to no run; `approve`: whether the caller can approve one, which takes the owner's
359
- * password session (forCaller), and `approve_needs` when not. */
379
+ /** `pending`: a workflow draft with a call no price covers is kept to wait for its owner's OK, served to no run;
380
+ * `approve`: whether the caller can approve one, which takes the owner's password session (forCaller), and
381
+ * `approve_needs` when not. */
360
382
  learning: LearningCaps;
361
383
  /** Every tool a revision may name (the closed table in tools.ts): available here, or the variables it is missing; a
362
384
  * web tool, what it resolves to on each harness under this server's tool settings; `key`, the tool key that unlocks
@@ -551,7 +573,7 @@ export declare function readingOf(base: NodeJS.ProcessEnv, maxRuns: number, stor
551
573
  harnesses: string[];
552
574
  };
553
575
  /** This server's learning switch (`--learning`): on, a run learns when its agent says `learning: true`; off, none does. */
554
- learning: "off" | "on";
576
+ learning: "on" | "off";
555
577
  /** /settings/webhook: one URL POSTed, signed by the Standard Webhooks spec, when a run needs its person and when it
556
578
  * ends (webhooks.ts); its secret kept sealed under the same seal key. */
557
579
  webhooks: {
@@ -607,9 +629,8 @@ export declare function readingOf(base: NodeJS.ProcessEnv, maxRuns: number, stor
607
629
  * included (harnessOffers), and whether a revision that names no model runs here (`models.ready`, and what it `needs`
608
630
  * when not), so what this returns is what the route serves and what the document's schema holds.
609
631
  * `learning` is the server's learning switch (`--learning`), AGENTRUN_SERVE_LEARNING's when not given; with this
610
- * server's tool settings, what each web tool resolves to (tool-plane.ts); `boxes`, the box offers its places show;
611
- * `gradeModel`, its `--grade-model`. */
612
- export declare function capabilities(env?: NodeJS.ProcessEnv, maxRuns?: number, learning?: LearningMode, toolSettings?: ToolSettingsMap, boxes?: readonly BoxOffer[], gradeModel?: string): Promise<{
632
+ * server's tool settings, what each web tool resolves to (tool-plane.ts); `boxes`, the box offers its places show. */
633
+ export declare function capabilities(env?: NodeJS.ProcessEnv, maxRuns?: number, learning?: LearningMode, toolSettings?: ToolSettingsMap, boxes?: readonly BoxOffer[]): Promise<{
613
634
  backend: string;
614
635
  contract: string;
615
636
  server: {
@@ -619,6 +640,9 @@ export declare function capabilities(env?: NodeJS.ProcessEnv, maxRuns?: number,
619
640
  };
620
641
  /** What runs a run here (the contract's `runtimes`, informational): this server's runners, over its one store. */
621
642
  runtimes: string[];
643
+ /** How a run is kept from another here (run-child-host.ts runIsolationOf): each a process of its own, and `uid`, each
644
+ * a user of its own too. */
645
+ run_isolation: "uid" | "process";
622
646
  /** The harnesses a revision may name (`definition.harness`), whether this server runs each, and how many at once. */
623
647
  harnesses: {
624
648
  max_concurrent_runs: number;
@@ -661,10 +685,9 @@ export declare function capabilities(env?: NodeJS.ProcessEnv, maxRuns?: number,
661
685
  fast: string | null;
662
686
  strong: string | null;
663
687
  };
664
- /** What grades a run's proposed notes: the model this server names for it (learning.ts gradeModelOf), or null when
665
- * each run is graded on its agent's own model; and `pending`: a risky rule, the user's or the run's own, is kept to
666
- * wait for its owner's OK, served to no run; `approve`: whether the caller can approve one, which takes the owner's
667
- * password session (forCaller), and `approve_needs` when not. */
688
+ /** `pending`: a workflow draft with a call no price covers is kept to wait for its owner's OK, served to no run;
689
+ * `approve`: whether the caller can approve one, which takes the owner's password session (forCaller), and
690
+ * `approve_needs` when not. */
668
691
  learning: LearningCaps;
669
692
  /** Every tool a revision may name (the closed table in tools.ts): available here, or the variables it is missing; a
670
693
  * web tool, what it resolves to on each harness under this server's tool settings; `key`, the tool key that unlocks
@@ -859,7 +882,7 @@ export declare function capabilities(env?: NodeJS.ProcessEnv, maxRuns?: number,
859
882
  harnesses: string[];
860
883
  };
861
884
  /** This server's learning switch (`--learning`): on, a run learns when its agent says `learning: true`; off, none does. */
862
- learning: "off" | "on";
885
+ learning: "on" | "off";
863
886
  /** /settings/webhook: one URL POSTed, signed by the Standard Webhooks spec, when a run needs its person and when it
864
887
  * ends (webhooks.ts); its secret kept sealed under the same seal key. */
865
888
  webhooks: {
@@ -910,9 +933,8 @@ export declare function capabilities(env?: NodeJS.ProcessEnv, maxRuns?: number,
910
933
  free_model_requests: number;
911
934
  };
912
935
  }>;
913
- /** capabilities.learning: whether the caller may approve a note that waits, and what that needs when not. */
936
+ /** capabilities.learning: whether the caller may approve a workflow draft that waits, and what that needs when not. */
914
937
  type LearningCaps = {
915
- grade_model: string | null;
916
938
  pending: true;
917
939
  approve: boolean;
918
940
  approve_needs?: "password";