@parcha/agentrun-serve 0.1.0-beta.56 → 0.1.0-beta.58

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 (312) hide show
  1. package/CHANGELOG.md +281 -0
  2. package/README.md +246 -66
  3. package/dist/acp-package.d.ts +2 -0
  4. package/dist/adapters.d.ts +15 -3
  5. package/dist/adapters.js +17 -6
  6. package/dist/agent-package.d.ts +3 -3
  7. package/dist/agent-package.js +17 -8
  8. package/dist/api-keys.d.ts +76 -0
  9. package/dist/api-keys.js +217 -0
  10. package/dist/api-only.d.ts +15 -5
  11. package/dist/api-only.js +32 -8
  12. package/dist/box-paths.d.ts +4 -3
  13. package/dist/box-paths.js +7 -4
  14. package/dist/browser-hold.d.ts +23 -0
  15. package/dist/browser-hold.js +48 -0
  16. package/dist/browser-person.d.ts +3 -0
  17. package/dist/browser-person.js +4 -1
  18. package/dist/chatgpt-plan.d.ts +18 -8
  19. package/dist/chatgpt-plan.js +91 -34
  20. package/dist/claude-login-token.d.ts +117 -0
  21. package/dist/claude-login-token.js +737 -0
  22. package/dist/claude-login.d.ts +120 -22
  23. package/dist/claude-login.js +347 -63
  24. package/dist/claude-sign-in.d.ts +17 -6
  25. package/dist/claude-sign-in.js +42 -39
  26. package/dist/cli.js +33 -10
  27. package/dist/composio-made.d.ts +4 -0
  28. package/dist/composio-made.js +4 -0
  29. package/dist/composio-preset.d.ts +43 -2
  30. package/dist/composio-preset.js +92 -4
  31. package/dist/computer-attach.d.ts +35 -17
  32. package/dist/computer-attach.js +301 -49
  33. package/dist/computer-held-routes.d.ts +5 -4
  34. package/dist/computer-held-routes.js +29 -8
  35. package/dist/computer-held.d.ts +6 -1
  36. package/dist/computer-held.js +14 -0
  37. package/dist/computer-record.js +4 -2
  38. package/dist/computer-viewer.js +4 -1
  39. package/dist/computers.d.ts +10 -10
  40. package/dist/computers.js +5 -5
  41. package/dist/console/assets/{backend-Boh7tC4i.js → backend-CSAWUqtZ.js} +19 -19
  42. package/dist/console/assets/index-Bwn1oTem.css +1 -0
  43. package/dist/console/assets/index-DPh29cyz.js +747 -0
  44. package/dist/console/index.html +2 -2
  45. package/dist/decisions.d.ts +1 -1
  46. package/dist/decisions.js +1 -1
  47. package/dist/dial-relay.d.ts +25 -4
  48. package/dist/dial-relay.js +129 -1
  49. package/dist/docker-host-addresses.d.ts +22 -11
  50. package/dist/docker-host-addresses.js +38 -26
  51. package/dist/env-switch.d.ts +8 -0
  52. package/dist/env-switch.js +31 -2
  53. package/dist/errors.d.ts +1 -0
  54. package/dist/errors.js +2 -0
  55. package/dist/fal-price.d.ts +56 -20
  56. package/dist/fal-price.js +400 -90
  57. package/dist/handed-values.d.ts +43 -1
  58. package/dist/handed-values.js +119 -2
  59. package/dist/harness-archive.d.ts +13 -10
  60. package/dist/harness-archive.js +60 -34
  61. package/dist/harness-check.d.ts +3 -1
  62. package/dist/harness-check.js +25 -46
  63. package/dist/harness-keys.d.ts +73 -27
  64. package/dist/harness-keys.js +194 -61
  65. package/dist/harness-recipe-entry.d.ts +8 -7
  66. package/dist/harness-recipe-entry.js +21 -32
  67. package/dist/harness-recipe.d.ts +38 -25
  68. package/dist/harness-recipe.js +49 -36
  69. package/dist/harness-sign-in.js +12 -23
  70. package/dist/harness-table.d.ts +10 -3
  71. package/dist/harness-table.js +26 -21
  72. package/dist/harness.d.ts +1 -0
  73. package/dist/harness.js +17 -5
  74. package/dist/hosted-search.d.ts +1 -1
  75. package/dist/hosted-search.js +1 -2
  76. package/dist/import-worker.d.ts +4 -2
  77. package/dist/import-worker.js +9 -2
  78. package/dist/in-flight.d.ts +26 -0
  79. package/dist/in-flight.js +52 -0
  80. package/dist/key-refusal.d.ts +9 -4
  81. package/dist/key-refusal.js +107 -25
  82. package/dist/learn/ledger.d.ts +170 -0
  83. package/dist/learn/ledger.js +218 -0
  84. package/dist/learn/promote.d.ts +3 -3
  85. package/dist/learn/promote.js +1 -1
  86. package/dist/learn/secrets.d.ts +13 -3
  87. package/dist/learn/secrets.js +118 -17
  88. package/dist/learning-cost.d.ts +28 -23
  89. package/dist/learning-cost.js +19 -23
  90. package/dist/link-check.js +1 -1
  91. package/dist/live-reach.d.ts +2 -0
  92. package/dist/live-reach.js +2 -0
  93. package/dist/llms.txt +1 -1
  94. package/dist/marketplace.d.ts +77 -0
  95. package/dist/marketplace.js +224 -0
  96. package/dist/mcp-api-only-origins.d.ts +35 -0
  97. package/dist/mcp-api-only-origins.js +57 -0
  98. package/dist/mcp-gateway.d.ts +7 -5
  99. package/dist/mcp-gateway.js +9 -12
  100. package/dist/mcp-secret-writes.js +5 -3
  101. package/dist/mcp-servers-store.d.ts +28 -6
  102. package/dist/mcp-servers-store.js +53 -4
  103. package/dist/media-duration.d.ts +3 -0
  104. package/dist/media-duration.js +90 -9
  105. package/dist/micro.d.ts +2 -0
  106. package/dist/micro.js +2 -0
  107. package/dist/model-form.d.ts +5 -4
  108. package/dist/model-form.js +11 -7
  109. package/dist/model.d.ts +10 -6
  110. package/dist/model.js +16 -11
  111. package/dist/monid.d.ts +14 -1
  112. package/dist/monid.js +103 -26
  113. package/dist/ollama-provider.d.ts +7 -1
  114. package/dist/ollama-provider.js +14 -2
  115. package/dist/openapi.js +210 -37
  116. package/dist/otel/genai.d.ts +65 -0
  117. package/dist/otel/genai.js +116 -0
  118. package/dist/otel/tracer.d.ts +55 -0
  119. package/dist/otel/tracer.js +308 -0
  120. package/dist/page.d.ts +2 -0
  121. package/dist/page.js +3 -1
  122. package/dist/paid-calls.d.ts +1 -32
  123. package/dist/paid-calls.js +4 -39
  124. package/dist/place-offers.d.ts +4 -0
  125. package/dist/place-offers.js +7 -4
  126. package/dist/provider.d.ts +11 -2
  127. package/dist/provider.js +59 -8
  128. package/dist/redact/match.d.ts +30 -3
  129. package/dist/redact/match.js +422 -41
  130. package/dist/refusal-words.d.ts +11 -0
  131. package/dist/refusal-words.js +11 -0
  132. package/dist/run-census.d.ts +67 -0
  133. package/dist/run-census.js +240 -0
  134. package/dist/run-computer.d.ts +6 -3
  135. package/dist/run-computer.js +4 -1
  136. package/dist/run-cut.d.ts +15 -6
  137. package/dist/run-cut.js +30 -9
  138. package/dist/run-files.d.ts +3 -0
  139. package/dist/run-files.js +3 -0
  140. package/dist/run-launch.d.ts +12 -1
  141. package/dist/run-launch.js +9 -10
  142. package/dist/run-learning-served.d.ts +4 -2
  143. package/dist/run-model-key.d.ts +8 -0
  144. package/dist/run-model-key.js +31 -1
  145. package/dist/run-reads-over-store.d.ts +24 -6
  146. package/dist/run-reads-over-store.js +67 -23
  147. package/dist/run-recordings.d.ts +5 -1
  148. package/dist/run-recordings.js +39 -14
  149. package/dist/run-timeline-served.d.ts +2 -0
  150. package/dist/run-timeline-served.js +2 -2
  151. package/dist/run-usage.d.ts +1 -0
  152. package/dist/run-view.d.ts +1 -2
  153. package/dist/run-view.js +2 -1
  154. package/dist/runnable.d.ts +10 -1
  155. package/dist/runnable.js +20 -8
  156. package/dist/runner/adapter-loop.d.ts +11 -0
  157. package/dist/runner/adapter-loop.js +58 -26
  158. package/dist/runner/adapter-run-spec.d.ts +55 -11
  159. package/dist/runner/adapter-run-spec.js +183 -52
  160. package/dist/runner/adapters/pi.js +25 -3
  161. package/dist/runner/beside.d.ts +9 -2
  162. package/dist/runner/beside.js +27 -9
  163. package/dist/runner/big-writes.js +1 -10
  164. package/dist/runner/claim-secrets.d.ts +27 -10
  165. package/dist/runner/claim-secrets.js +49 -22
  166. package/dist/runner/cli-run-spec.d.ts +6 -0
  167. package/dist/runner/cli-run-spec.js +97 -38
  168. package/dist/runner/computer-journal.d.ts +9 -1
  169. package/dist/runner/computer-journal.js +26 -0
  170. package/dist/runner/conformance/harness.js +1 -1
  171. package/dist/runner/feedback-round.js +3 -0
  172. package/dist/runner/harness-loops.d.ts +6 -5
  173. package/dist/runner/harness-loops.js +7 -7
  174. package/dist/runner/held.d.ts +24 -6
  175. package/dist/runner/journal-kinds.d.ts +5 -0
  176. package/dist/runner/journal-kinds.js +5 -0
  177. package/dist/runner/main.d.ts +11 -6
  178. package/dist/runner/main.js +19 -9
  179. package/dist/runner/mcp-claim.js +31 -3
  180. package/dist/runner/mcp-run.d.ts +9 -0
  181. package/dist/runner/mcp-run.js +11 -5
  182. package/dist/runner/model-route.d.ts +17 -0
  183. package/dist/runner/model-route.js +120 -2
  184. package/dist/runner/presence.d.ts +11 -1
  185. package/dist/runner/presence.js +7 -0
  186. package/dist/runner/reflect-hook.js +1 -1
  187. package/dist/runner/run-child-host.d.ts +22 -8
  188. package/dist/runner/run-child-host.js +128 -41
  189. package/dist/runner/run-child.js +5 -2
  190. package/dist/runner/runner.d.ts +17 -3
  191. package/dist/runner/runner.js +130 -34
  192. package/dist/runner/save-slots.js +2 -1
  193. package/dist/runner/store-port.d.ts +1 -1
  194. package/dist/runner/store-secrets.d.ts +6 -0
  195. package/dist/runner/store-secrets.js +49 -7
  196. package/dist/runner/subagent.d.ts +11 -0
  197. package/dist/runner/subagent.js +16 -38
  198. package/dist/runner/workflow-first.d.ts +35 -15
  199. package/dist/runner/workflow-first.js +38 -25
  200. package/dist/runner/workflow-spec.js +4 -3
  201. package/dist/runs-over-store.d.ts +15 -6
  202. package/dist/runs-over-store.js +33 -21
  203. package/dist/scrub-command.d.ts +73 -0
  204. package/dist/scrub-command.js +307 -0
  205. package/dist/secret-cut.d.ts +73 -0
  206. package/dist/secret-cut.js +291 -4
  207. package/dist/secret-rules.d.ts +143 -0
  208. package/dist/secret-rules.js +2564 -0
  209. package/dist/secrets.d.ts +7 -0
  210. package/dist/secrets.js +20 -0
  211. package/dist/server-keys.d.ts +20 -0
  212. package/dist/server-keys.js +25 -6
  213. package/dist/server.d.ts +65 -13
  214. package/dist/server.js +470 -157
  215. package/dist/skills/agentrun-serve/SKILL.md +4 -0
  216. package/dist/slots.d.ts +9 -0
  217. package/dist/slots.js +45 -0
  218. package/dist/store/index.d.ts +1 -1
  219. package/dist/store/index.js +1 -1
  220. package/dist/store/journal/storage.js +1 -1
  221. package/dist/store/postgres/migrations/0027_run_launch_census.sql +31 -0
  222. package/dist/store/postgres/migrations/0028_learning_ledger.sql +44 -0
  223. package/dist/store/schema.d.ts +23 -0
  224. package/dist/store/schema.js +58 -2
  225. package/dist/store/seal.d.ts +6 -1
  226. package/dist/store/seal.js +5 -3
  227. package/dist/store/sqlite/run-launch.d.ts +9 -1
  228. package/dist/store/sqlite/run-launch.js +24 -13
  229. package/dist/store/sqlite/run-patch.d.ts +12 -2
  230. package/dist/store/sqlite/run-patch.js +42 -5
  231. package/dist/store/sqlite/store.js +105 -12
  232. package/dist/store/store.d.ts +57 -2
  233. package/dist/store/store.js +20 -0
  234. package/dist/store-reads/learning.d.ts +84 -124
  235. package/dist/store-reads/learning.js +210 -274
  236. package/dist/store-view.d.ts +3 -0
  237. package/dist/store-view.js +3 -3
  238. package/dist/suggestions.js +3 -2
  239. package/dist/template-eval.d.ts +39 -9
  240. package/dist/template-eval.js +191 -60
  241. package/dist/template-import.js +6 -2
  242. package/dist/templates.d.ts +10 -2
  243. package/dist/templates.js +28 -8
  244. package/dist/timeline/labels.d.ts +6 -4
  245. package/dist/timeline/labels.js +18 -6
  246. package/dist/timeline/timeline.d.ts +5 -0
  247. package/dist/timeline/timeline.js +14 -8
  248. package/dist/timeline/util.js +1 -1
  249. package/dist/timeline/web-calls.d.ts +22 -7
  250. package/dist/timeline/web-calls.js +106 -35
  251. package/dist/tool-gate.d.ts +42 -3
  252. package/dist/tool-gate.js +66 -5
  253. package/dist/tool-keys-store.d.ts +2 -4
  254. package/dist/tool-keys-store.js +5 -21
  255. package/dist/tool-keys.d.ts +2 -2
  256. package/dist/tool-keys.js +2 -2
  257. package/dist/tool-list.js +1 -1
  258. package/dist/tool-plane.d.ts +2 -2
  259. package/dist/tool-plane.js +35 -33
  260. package/dist/tools.js +13 -7
  261. package/dist/trigger-targets.d.ts +4 -0
  262. package/dist/trigger-targets.js +9 -2
  263. package/dist/triggers.d.ts +67 -4
  264. package/dist/triggers.js +171 -22
  265. package/dist/until.d.ts +3 -0
  266. package/dist/until.js +11 -0
  267. package/dist/web-fake.d.ts +1 -3
  268. package/dist/web-fake.js +7 -18
  269. package/dist/web-fetch.d.ts +6 -72
  270. package/dist/web-fetch.js +11 -265
  271. package/dist/web-run.d.ts +31 -0
  272. package/dist/web-run.js +90 -0
  273. package/dist/web-save.d.ts +10 -13
  274. package/dist/web-save.js +13 -55
  275. package/dist/web-search.d.ts +9 -127
  276. package/dist/web-search.js +23 -259
  277. package/dist/wires.d.ts +13 -0
  278. package/dist/wires.js +11 -0
  279. package/dist/workflow-run.d.ts +5 -4
  280. package/dist/workflow-run.js +5 -4
  281. package/dist/workspace/attached-computers.d.ts +32 -9
  282. package/dist/workspace/attached-computers.js +77 -13
  283. package/dist/workspace/computer-deps.d.ts +8 -2
  284. package/dist/workspace/computer-deps.js +10 -3
  285. package/dist/workspace/computer-for-claim.d.ts +12 -1
  286. package/dist/workspace/computer-for-claim.js +83 -11
  287. package/dist/workspace/computer-kept.d.ts +3 -0
  288. package/dist/workspace/computer-kept.js +11 -2
  289. package/dist/workspace/index.d.ts +1 -1
  290. package/dist/workspace/index.js +1 -1
  291. package/dist/workspace/kind-skills.d.ts +4 -0
  292. package/dist/workspace/kind-skills.js +9 -0
  293. package/dist/workspace/paired-route.d.ts +91 -0
  294. package/dist/workspace/paired-route.js +153 -0
  295. package/dist/workspace/synced-folder.js +3 -4
  296. package/dist/wrapped.d.ts +20 -6
  297. package/dist/wrapped.js +66 -25
  298. package/package.json +17 -11
  299. package/skills/agentrun-serve/SKILL.md +4 -0
  300. package/templates/README.md +32 -10
  301. package/dist/console/assets/index-CQ3cJRzI.js +0 -746
  302. package/dist/console/assets/index-DKkaS3a0.css +0 -1
  303. package/dist/exa-keyless.d.ts +0 -34
  304. package/dist/exa-keyless.js +0 -118
  305. package/dist/firecrawl-keyless.d.ts +0 -41
  306. package/dist/firecrawl-keyless.js +0 -152
  307. package/dist/keyless-mcp.d.ts +0 -36
  308. package/dist/keyless-mcp.js +0 -127
  309. package/dist/text-urls.d.ts +0 -38
  310. package/dist/text-urls.js +0 -170
  311. package/dist/web-fetch-direct.d.ts +0 -119
  312. package/dist/web-fetch-direct.js +0 -190
@@ -0,0 +1,153 @@
1
+ // Where a paired computer's socket goes on a server whose runner runs in a process of its own (the image's
2
+ // server-and-runner, `agentrun-serve runner`): its route. The box's driver dials the server's one public address, and
3
+ // keeps that one socket. While no run holds the box, the server's own hub takes it; while a run holds it, the server
4
+ // relays the same socket to the attach listener of the runner that holds the run (computer-attach.ts, the relay of
5
+ // dial-relay.ts), where that runner's hub takes it and the run's hold lives. A move is the server closing the socket with
6
+ // 1001 and the box's own redial landing where the route now says; nothing changes on the box.
7
+ //
8
+ // One server setting per paired computer holds it (`paired_route:<computer id>`): the runner, its incarnation, the run,
9
+ // the hold's end (shown, never judged), and a note the server keeps of why a route was refused or dropped. It is written
10
+ // by compare-and-set, as computer_kept:<run id> is (computer-kept.ts), the same calls on SQLite and Postgres: the run's
11
+ // claim takes it (takeRoute, with the claim, so a superseded claim's take is Fenced), the runner that holds it drops it
12
+ // once its hold ended (dropRoute), and the server notes and drops a stale one (replaceRoute). A row exists only while it
13
+ // holds a route or a note, so the server's tick reads only rows that matter (one indexed read of the prefix).
14
+ //
15
+ // The runner beside the server, in its process, takes a route the same way for a box its run holds in the server's own
16
+ // hub (runner/beside.ts, under the name and incarnation Serve.beside gives it): the box stays where it is, and a runner
17
+ // apart's take for another run is refused while that hold lasts.
18
+ //
19
+ // A route is stale only when its runner is not live (runner/presence.ts: no word of it for PRESENCE_STALE_MS; a runner
20
+ // beside its server says it is there with no relay) or names another incarnation (that runner restarted since, or the
21
+ // server it ran beside did); or when its run is final, so a runner's release that never dropped its route (its write
22
+ // failed) keeps the box from no other run. A route of another run, on a live runner, refuses the take: one run at a time.
23
+ import { ATTACH_HELLO_MS, ATTACH_REDIAL_MAX_MS } from "@parcha/agentrun-computer";
24
+ import { RELAY_CONNECT_MS } from "../live-reach.js";
25
+ import { PRESENCE_STALE_MS } from "../runner/presence.js";
26
+ import { FINAL_STATES } from "../store/index.js";
27
+ /** The settings key prefix of the paired computers' routes, one row per computer. */
28
+ export const ROUTE_PREFIX = "paired_route:";
29
+ /** The settings key of computer `id`'s route. */
30
+ export const routeKeyOf = (id) => `${ROUTE_PREFIX}${id}`;
31
+ /** How often the server compares each route with where the box's socket is (server.ts, computer-attach.ts tick). */
32
+ export const PAIRED_ROUTE_MS = 1_000;
33
+ /** How long a run's claim waits for its box to reach its runner: one tick of the server's, the driver's longest wait
34
+ * between dials (it backs off after quick reconnects), the relay's connect and the hub's hello. */
35
+ export const PAIRED_BRING_MS = PAIRED_ROUTE_MS + ATTACH_REDIAL_MAX_MS + RELAY_CONNECT_MS + ATTACH_HELLO_MS;
36
+ /** How often the claim reads the route while it waits. */
37
+ export const PAIRED_BRING_POLL_MS = 500;
38
+ /** How many times a take or a drop reads the row again after another writer changed it between its read and its write. */
39
+ const ROUTE_TRIES = 5;
40
+ /** No route and no note. */
41
+ export const EMPTY_ROUTE = { runner: null, incarnation: null, run: null, until: null, refused: null };
42
+ const text = (value) => (typeof value === "string" && value !== "" ? value : null);
43
+ /** A row's value as a Route; anything else reads as EMPTY_ROUTE. */
44
+ export function routeOf(value) {
45
+ if (!value || typeof value !== "object")
46
+ return EMPTY_ROUTE;
47
+ const row = value;
48
+ const runner = text(row.runner);
49
+ const incarnation = text(row.incarnation);
50
+ const refused = text(row.refused);
51
+ // A route names its runner, its incarnation and its run together, or none of them.
52
+ const run = text(row.run);
53
+ if (runner === null || incarnation === null || run === null)
54
+ return { ...EMPTY_ROUTE, refused };
55
+ const until = typeof row.until === "number" && Number.isFinite(row.until) ? row.until : null;
56
+ return { runner, incarnation, run, until, refused };
57
+ }
58
+ /** The row as written: its fields in one order, so a compare-and-set reads the same text. */
59
+ const rowOf = (route) => ({ runner: route.runner, incarnation: route.incarnation, run: route.run, until: route.until, refused: route.refused });
60
+ const isEmpty = (route) => route.runner === null && route.refused === null;
61
+ /** Computer `id`'s route as its row reads now: EMPTY_ROUTE when there is none. */
62
+ export async function readRoute(settings, id) {
63
+ return routeOf(await settings.get(routeKeyOf(id)));
64
+ }
65
+ /** Computer `id`'s route and its row's value as read (undefined: no row), for a compare-and-set on it. */
66
+ export async function seeRoute(settings, id) {
67
+ const seen = await settings.get(routeKeyOf(id));
68
+ return { seen, route: routeOf(seen) };
69
+ }
70
+ /** Every route row, as the server's tick reads them: one read of the prefix, a range on the settings' primary key. */
71
+ export async function allRoutes(settings) {
72
+ return (await settings.all({ prefix: ROUTE_PREFIX })).map((row) => ({ id: row.key.slice(ROUTE_PREFIX.length), seen: row.value, route: routeOf(row.value) }));
73
+ }
74
+ /** Writes `next` over computer `id`'s row while it still holds `seen` (as read): one compare-and-set. An empty `next` (no
75
+ * route, no note) removes the row. False when the row changed since. */
76
+ export async function replaceRoute(settings, id, seen, next, claim) {
77
+ const key = routeKeyOf(id);
78
+ if (seen === undefined) {
79
+ if (isEmpty(next))
80
+ return true;
81
+ const there = await settings.putIfAbsent(key, rowOf(EMPTY_ROUTE));
82
+ // Another writer's row landed between the read and this put (a route, or a note): the row changed since, so the
83
+ // caller reads it again and judges it, never writes over it unread. Only the empty placeholder goes on to the
84
+ // compare-and-set.
85
+ if (!isEmpty(routeOf(there)))
86
+ return false;
87
+ return replaceRoute(settings, id, there, next, claim);
88
+ }
89
+ if (isEmpty(next) && claim === undefined)
90
+ return settings.removeIf(key, seen);
91
+ return settings.replaceIf(key, seen, rowOf(next), claim);
92
+ }
93
+ /** `name` held by another run, on a live runner. */
94
+ export const heldWords = (name, run, runner) => `${name} is held by run ${run} on runner ${runner}: one run at a time`;
95
+ /** How a stale route's words end (the server's 503 and the box's note): where the box goes, and when. */
96
+ export const ROUTE_COMES_BACK = `it comes back to this server at its next dial, within ${ATTACH_REDIAL_MAX_MS / 1000} s, and the run's next claim takes it again`;
97
+ /** What a route says once its runner restarted. The words for a runner gone are the relay's own (computer-attach.ts
98
+ * relayDial), ending in ROUTE_COMES_BACK. */
99
+ export const routeRestartedWords = (runner) => `runner ${runner}, which holds it, restarted since, and the hold was its earlier process's: ${ROUTE_COMES_BACK}`;
100
+ /** A box routed to a run's runner, attached nowhere: the claim's wait ends in these words. */
101
+ export const notAttachedWords = (name) => `${name} is not attached now: open its driver on that computer, which dials this server`;
102
+ /** A box that did not reach its run's runner within PAIRED_BRING_MS. */
103
+ export const lateWords = (name, runner) => `${name} did not reach runner ${runner} within ${PAIRED_BRING_MS / 1000} s: its driver waits up to ${ATTACH_REDIAL_MAX_MS / 1000} s between dials after quick reconnects, so the run's next claim may find it there`;
104
+ /** A take or a drop that lost every compare-and-set to another writer. */
105
+ const changedWords = (name) => `${name}'s route changed while this run took it: its next claim tries again`;
106
+ /** Why `route` keeps computer `name` from `want`'s run, or undefined where the run may take it: no route, the run's own
107
+ * (a resume on another runner), a route whose runner is not live or restarted since, or one whose run is final. A
108
+ * live runner is any runner's row seen within PRESENCE_STALE_MS, with a relay or without one: the runner beside its
109
+ * server keeps none, and its route holds the same. */
110
+ async function holdsAgainst(deps, route, want, name) {
111
+ if (route.runner === null || route.run === want.run)
112
+ return undefined;
113
+ const at = (await deps.runners.live(PRESENCE_STALE_MS)).find((row) => row.runner === route.runner);
114
+ if (at === undefined || at.incarnation !== route.incarnation)
115
+ return undefined;
116
+ // A run that ended, stopped or failed holds nothing: its runner's release dropped the route, or that write failed. It
117
+ // fails closed: a run the store has no row of (purged included), or a read that throws, is not final, so the route
118
+ // stands. One read per refusal, no retry.
119
+ const run = deps.runs === undefined ? undefined : await deps.runs.get(route.run).catch(() => undefined);
120
+ if (run !== undefined && FINAL_STATES.includes(run.state))
121
+ return undefined;
122
+ return heldWords(name, route.run, route.runner);
123
+ }
124
+ /** Routes computer `id` to `want`'s runner for its run, where holdsAgainst lets it: the run's claim, before it waits for
125
+ * the box (dial-relay.ts bring). With `claim`, the write checks the claim's epoch and lease in its transaction, so a
126
+ * claim another runner superseded throws Fenced and writes nothing. `name` is the computer's, for the words. */
127
+ export async function takeRoute(deps, id, want, { claim, name = id } = {}) {
128
+ const mine = rowOf({ runner: want.runner, incarnation: want.incarnation, run: want.run, until: want.until, refused: null });
129
+ let route = EMPTY_ROUTE;
130
+ for (let tried = 0; tried < ROUTE_TRIES; tried++) {
131
+ const read = await seeRoute(deps.settings, id);
132
+ route = read.route;
133
+ const why = await holdsAgainst(deps, route, want, name);
134
+ if (why !== undefined)
135
+ return { taken: false, why, route };
136
+ if (await replaceRoute(deps.settings, id, read.seen, mine, claim))
137
+ return { taken: true, route: mine };
138
+ }
139
+ return { taken: false, why: changedWords(name), route };
140
+ }
141
+ /** Drops computer `id`'s route where it is `mine` (its runner and incarnation, and its run where given): the runner
142
+ * that holds it, once its hold ended. `note` is kept on the row (why the run let it go); none: the row goes. False when
143
+ * the route is not mine (another's, or none). */
144
+ export async function dropRoute(settings, id, mine, note) {
145
+ for (let tried = 0; tried < ROUTE_TRIES; tried++) {
146
+ const { seen, route } = await seeRoute(settings, id);
147
+ if (route.runner !== mine.runner || route.incarnation !== mine.incarnation || (mine.run !== undefined && route.run !== mine.run))
148
+ return false;
149
+ if (await replaceRoute(settings, id, seen, { ...EMPTY_ROUTE, refused: note ?? null }))
150
+ return true;
151
+ }
152
+ return false;
153
+ }
@@ -101,11 +101,10 @@ async function* tarEntries(store, { entries, meta }) {
101
101
  export async function holdSynced(store, client, stored, signal) {
102
102
  const folder = new FolderSync(client, store);
103
103
  const options = signal ? { signal } : {};
104
- // An empty folder has nothing to push (no tar), its listing is the baseline all the same.
105
- const empty = stored.entries.length === 0 && Object.keys(stored.meta.links).length === 0;
106
- const held = empty ? await folder.baseline(options) : await folder.push(tarEntries(store, stored), options);
104
+ // An empty folder is an empty tar, as conformance pushes it.
105
+ const held = await folder.push(tarEntries(store, stored), options);
107
106
  if (!held.ok)
108
- throw new Error(empty ? `the run's folder pushed into the computer could not be listed: ${held.error.message}` : `the run's folder ${held.error.message}`);
107
+ throw new Error(`the run's folder ${held.error.message}`);
109
108
  for (const path of stored.linkObjects) {
110
109
  const removed = await store.remove(path, "file");
111
110
  if (!removed.ok)
package/dist/wrapped.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import type { Wrapped } from "@parcha/agentrun-import";
1
+ import { type Wrapped } from "@parcha/agentrun-import";
2
2
  /** `wrapped` (the import package's) as GET /v2/wrapped serves it, and the runs imported from each source (`imported`). */
3
3
  export declare function wrappedView(wrapped: Wrapped, imported: readonly {
4
4
  source: string;
@@ -25,6 +25,7 @@ export declare function wrappedView(wrapped: Wrapped, imported: readonly {
25
25
  weekdays: number[];
26
26
  active_ms: number;
27
27
  harnesses: {
28
+ sources: string[];
28
29
  harness: string;
29
30
  sessions: number;
30
31
  requests: number;
@@ -35,6 +36,7 @@ export declare function wrappedView(wrapped: Wrapped, imported: readonly {
35
36
  requests: number;
36
37
  tokens: number;
37
38
  cost_usd: number;
39
+ unpriced_requests: number;
38
40
  }[];
39
41
  sources: {
40
42
  source: string;
@@ -47,11 +49,23 @@ export declare function wrappedView(wrapped: Wrapped, imported: readonly {
47
49
  }[];
48
50
  unread_files: number;
49
51
  };
50
- type Read = {
52
+ /** How long GET /v2/wrapped waits for a read before it answers 503 with a retry (the read goes on). */
53
+ export declare const WRAPPED_WAIT_MS = 15000;
54
+ /** A year's wrappedHome over this machine's home, and how many session files it could not read (one gone since it was
55
+ * listed, or one this user cannot open): the numbers are short by those, and say so. */
56
+ export type WrappedRead = {
51
57
  wrapped: Wrapped;
52
58
  unread: number;
53
59
  };
54
- /** The year's wrappedHome over this machine's home, shared by the reads of the minute, and how many session files it could
55
- * not read (one gone since it was listed, or one this user cannot open): the numbers are short by those, and say so. */
56
- export declare function readWrapped(year: number, now?: number): Promise<Read>;
57
- export {};
60
+ /** `read` (one year's read, on the server's import worker), each year's shared: a read still going, or waiting its turn,
61
+ * is shared however long it takes; once it ends, a year already over when its read began is kept until the server stops
62
+ * (its requests were all in), and any other (this year's, or one that ended while it was read) for a minute. One read at
63
+ * a time: each is a worker holding a year's sessions, so a year asked while another is read waits for it to end. A read
64
+ * that fails frees the turn and is kept for a minute too, whatever its year: an ask within it gets the same failure, not
65
+ * another read of a home that fails it (one past the worker's heap would fail each one). One per server. */
66
+ export declare function keptReads(read: (year: number) => Promise<WrappedRead>): (year: number) => Promise<WrappedRead>;
67
+ /** keptReads over `read`, with each failed read given to `log` once, as it fails: the ask that started it may have had its
68
+ * answer (a 503) long before, and the asks in the minute it is kept get the same failure, not another read or log. */
69
+ export declare function loggedReads(read: (year: number) => Promise<WrappedRead>, log: (year: number, error: Error) => void): (year: number) => Promise<WrappedRead>;
70
+ /** `read`'s answer if it comes within `ms`, else undefined (the read goes on). */
71
+ export declare function within<T>(read: Promise<T>, ms: number): Promise<T | undefined>;
package/dist/wrapped.js CHANGED
@@ -1,7 +1,7 @@
1
1
  // GET /v2/wrapped: a year of the work under this machine's home (Claude Code, Codex, pi and every other source the import
2
2
  // package reads), as numbers. The import package's wrappedHome does the reading; this is its answer in the API's words,
3
3
  // with the runs imported here beside it. Numbers and names only: no prompt, title, path or project is in it.
4
- import { homedir } from "node:os";
4
+ import { HARNESS_OF } from "@parcha/agentrun-import";
5
5
  const total = ({ input, output, cacheRead, cacheWrite }) => input + output + cacheRead + cacheWrite;
6
6
  /** `wrapped` (the import package's) as GET /v2/wrapped serves it, and the runs imported from each source (`imported`). */
7
7
  export function wrappedView(wrapped, imported, unreadFiles = 0) {
@@ -18,34 +18,75 @@ export function wrappedView(wrapped, imported, unreadFiles = 0) {
18
18
  hours: wrapped.hours,
19
19
  weekdays: wrapped.weekdays,
20
20
  active_ms: wrapped.activeMs,
21
- harnesses: wrapped.harnesses,
22
- models: wrapped.models.map(({ model, requests, tokens, cost }) => ({ model, requests, tokens: total(tokens), cost_usd: cost })),
21
+ // The sources behind each harness (several can share one), so the console links a harness's numbers to their runs
22
+ // without a copy of the table, in the order of `sources`: a source of a reader outside it is its own harness, as wrappedHome counts it.
23
+ harnesses: wrapped.harnesses.map((h) => ({ ...h, sources: wrapped.sources.map((s) => s.source).filter((source) => (HARNESS_OF[source] ?? source) === h.harness) })),
24
+ models: wrapped.models.map(({ model, requests, tokens, cost, unpricedRequests }) => ({ model, requests, tokens: total(tokens), cost_usd: cost, unpriced_requests: unpricedRequests })),
23
25
  sources: wrapped.sources,
24
26
  imported: imported.map(({ source, runs }) => ({ source, runs })),
25
27
  unread_files: unreadFiles,
26
28
  };
27
29
  }
28
- /** A year read lately is not read again for a minute: a whole home is a long read, and the page asks for it on every open.
29
- * A read still going is shared however long it takes; its minute starts when it ends. */
30
+ /** A read of the current year is kept for a minute after it ends: a whole home is a long read. */
30
31
  const KEEP_MS = 60_000;
31
- const kept = new Map();
32
- /** The year's wrappedHome over this machine's home, shared by the reads of the minute, and how many session files it could
33
- * not read (one gone since it was listed, or one this user cannot open): the numbers are short by those, and say so. */
34
- export function readWrapped(year, now = Date.now()) {
35
- const home = homedir();
36
- const key = `${home}:${year}`;
37
- const held = kept.get(key);
38
- if (held && (held.at === undefined || now - held.at < KEEP_MS))
39
- return held.read;
40
- const failures = [];
41
- const read = import("@parcha/agentrun-import").then(async ({ wrappedHome }) => ({ wrapped: await wrappedHome(home, year, { failures }), unread: failures.length }));
42
- const entry = { read };
43
- kept.set(key, entry);
44
- read.then(() => {
45
- entry.at = Date.now();
46
- }, () => {
47
- if (kept.get(key) === entry)
48
- kept.delete(key);
49
- });
50
- return read;
32
+ /** How long GET /v2/wrapped waits for a read before it answers 503 with a retry (the read goes on). */
33
+ export const WRAPPED_WAIT_MS = 15_000;
34
+ /** `read` (one year's read, on the server's import worker), each year's shared: a read still going, or waiting its turn,
35
+ * is shared however long it takes; once it ends, a year already over when its read began is kept until the server stops
36
+ * (its requests were all in), and any other (this year's, or one that ended while it was read) for a minute. One read at
37
+ * a time: each is a worker holding a year's sessions, so a year asked while another is read waits for it to end. A read
38
+ * that fails frees the turn and is kept for a minute too, whatever its year: an ask within it gets the same failure, not
39
+ * another read of a home that fails it (one past the worker's heap would fail each one). One per server. */
40
+ export function keptReads(read) {
41
+ const kept = new Map();
42
+ // The read whose turn it is or the last one given a turn, until it ends: the next starts after it.
43
+ let turn;
44
+ const inTurn = (start) => {
45
+ const started = turn ? turn.then(start) : start();
46
+ const mine = started.then(() => undefined, () => undefined);
47
+ turn = mine;
48
+ void mine.then(() => {
49
+ if (turn === mine)
50
+ turn = undefined;
51
+ });
52
+ return started;
53
+ };
54
+ return (year) => {
55
+ const held = kept.get(year);
56
+ const now = Date.now();
57
+ if (held && (held.at === undefined || (!held.failed && year < held.began) || now - held.at < KEEP_MS))
58
+ return held.read;
59
+ const entry = {};
60
+ entry.read = inTurn(() => {
61
+ entry.began = new Date(Date.now()).getFullYear();
62
+ return read(year);
63
+ });
64
+ kept.set(year, entry);
65
+ entry.read.then(() => {
66
+ entry.at = Date.now();
67
+ }, () => {
68
+ entry.at = Date.now();
69
+ entry.failed = true;
70
+ });
71
+ return entry.read;
72
+ };
73
+ }
74
+ /** keptReads over `read`, with each failed read given to `log` once, as it fails: the ask that started it may have had its
75
+ * answer (a 503) long before, and the asks in the minute it is kept get the same failure, not another read or log. */
76
+ export function loggedReads(read, log) {
77
+ return keptReads((year) => read(year).catch((error) => {
78
+ log(year, error);
79
+ throw error;
80
+ }));
81
+ }
82
+ /** `read`'s answer if it comes within `ms`, else undefined (the read goes on). */
83
+ export async function within(read, ms) {
84
+ let timer;
85
+ const late = new Promise((resolve) => void (timer = setTimeout(resolve, ms, undefined)));
86
+ try {
87
+ return await Promise.race([read, late]);
88
+ }
89
+ finally {
90
+ clearTimeout(timer);
91
+ }
51
92
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@parcha/agentrun-serve",
3
- "version": "0.1.0-beta.56",
3
+ "version": "0.1.0-beta.58",
4
4
  "description": "The AgentRun server: the /v2 API and console over one store, with runners that run your agents; the deployable process of the AgentRun platform.",
5
5
  "keywords": [
6
6
  "agentrun",
@@ -66,16 +66,22 @@
66
66
  "@earendil-works/pi-coding-agent": "1.5.2",
67
67
  "@modelcontextprotocol/client": "2.4.0",
68
68
  "@modelcontextprotocol/server": "2.4.0",
69
- "@parcha/agentrun-computer": "0.1.0-beta.56",
70
- "@parcha/agentrun-decisions": "0.1.0-beta.56",
71
- "@parcha/agentrun-dsl": "0.1.0-beta.56",
72
- "@parcha/agentrun-harness-acp": "0.1.0-beta.56",
73
- "@parcha/agentrun-harness-claude": "0.1.0-beta.56",
74
- "@parcha/agentrun-harness-codex": "0.1.0-beta.56",
75
- "@parcha/agentrun-import": "0.1.0-beta.56",
76
- "@parcha/agentrun-jev": "0.1.0-beta.56",
77
- "@parcha/agentrun-kernel": "0.1.0-beta.56",
78
- "@parcha/pi-browser": "0.1.0-beta.56",
69
+ "@opentelemetry/api": "1.10.0",
70
+ "@opentelemetry/exporter-trace-otlp-http": "0.301.2",
71
+ "@opentelemetry/resources": "3.1.1",
72
+ "@opentelemetry/sdk-trace": "3.1.1",
73
+ "@opentelemetry/semantic-conventions": "1.43.0",
74
+ "@parcha/agentrun-computer": "0.1.0-beta.58",
75
+ "@parcha/agentrun-decisions": "0.1.0-beta.58",
76
+ "@parcha/agentrun-dsl": "0.1.0-beta.58",
77
+ "@parcha/agentrun-harness-acp": "0.1.0-beta.58",
78
+ "@parcha/agentrun-harness-claude": "0.1.0-beta.58",
79
+ "@parcha/agentrun-harness-codex": "0.1.0-beta.58",
80
+ "@parcha/agentrun-import": "0.1.0-beta.58",
81
+ "@parcha/agentrun-jev": "0.1.0-beta.58",
82
+ "@parcha/agentrun-kernel": "0.1.0-beta.58",
83
+ "@parcha/agentrun-web": "0.1.0-beta.58",
84
+ "@parcha/pi-browser": "0.1.0-beta.58",
79
85
  "@secretlint/core": "14.1.0",
80
86
  "@secretlint/profiler": "14.1.0",
81
87
  "croner": "11.0.0",
@@ -20,6 +20,10 @@ forbidden` with `error.details.console_url`, the console's form with the rest fi
20
20
  Open that link in the person's browser for them and tell them to paste the secret there and save. Never ask for a
21
21
  secret in the chat.
22
22
 
23
+ An API key for an app (`AGENTRUN_API_KEY`) is made the same way: the owner makes it in the console at
24
+ `<console>/#/settings/api-keys`, where it is shown once. `POST /v2/settings/api-keys` with the token is `403
25
+ forbidden`. A key the owner hands you is sent as the token is, as `Authorization: Bearer <key>`.
26
+
23
27
  ## Choose the onboarding path
24
28
 
25
29
  For general setup, establish whether the user wants to **start a new agent** or **bring an existing agent**.
@@ -106,7 +106,7 @@ Each `evals/<case>/` is one test of the package's agent. No eval runs on the ser
106
106
  the corrections the agent starts with, as its `corrections.md`: one line each), `web` (fakes `web_search`, `web_fetch` and `web_save` for the case's runs),
107
107
  `monid` (fakes the package's monid endpoints for the case's runs), `now` (the case's clock), `email` (a fake mailbox
108
108
  for the case's runs), `calendar` (a fake calendar for the case's runs), `feed` (fake feeds for the case's runs),
109
- `previous` (the earlier results the schedule's run is handed).
109
+ `previous` (the earlier results the schedule's run is handed), `files` (the files each run's work folder starts with).
110
110
  - `web: unavailable`: every `web_search` answers with the words a rate-limited free search answers with, and every
111
111
  `web_fetch` and `web_save` fails as a host that never answers does; no call reaches the network. `web:` a fixture file in the case
112
112
  answers from that file instead:
@@ -135,11 +135,13 @@ Each `evals/<case>/` is one test of the package's agent. No eval runs on the ser
135
135
  tools it sees live and needs `MONID_API_KEY` as a live eval does. The package must grant a monid endpoint; only the
136
136
  eval's own server honours `monid`, so a case with it refuses `--server`. `unavailable` is its only value.
137
137
  - `now: 2026-11-14T09:00:00Z`, a date and time with its offset: each run's current date and time. The run's environment
138
- line says that day ("Today is 2026-11-14 (UTC)"), as does claude-agent's turn date, and each `llm` grader is told it,
139
- so a rubric can say "the run's date". A tool that reads the machine's clock (a shell's `date`, a browser's page) and
140
- a harness CLI's own date (Codex adds its own to each turn) still read the real one. A fixture case whose prompt or
141
- pages carry dates sets `now:`, else it drifts a day each day it is run. Only the eval's own server honours it: a case with `now` refuses
142
- `--server`. Without it, the real clock.
138
+ line says that day ("Today is 2026-11-14 (UTC)"), as do claude-agent's turn date and the Claude CLI's own date lines
139
+ (rewritten at the session's model proxy, so a claude-agent case on a person's Claude login keeps the real date: run it
140
+ on the provider route), and each `llm` grader is told it, so a rubric can say "the run's date". A tool that reads the
141
+ machine's clock (a shell's `date`, a browser's page) and another harness CLI's own date (Codex adds its own to each
142
+ turn) still read the real one. A fixture case whose prompt or pages carry dates sets `now:`, else it drifts a day each
143
+ day it is run. Only the eval's own server honours it: a case with `now` refuses `--server`. Without it, the real
144
+ clock.
143
145
  - `email: fixtures/mailbox.json`, a fixture file in the case: each run gets a fake mail account of its own, seeded from
144
146
  it and saved as the server's email account (plaintext, on this machine's loopback), closed after the run, so no run
145
147
  reads real mail or shares another's mailbox. The fixture:
@@ -226,6 +228,20 @@ Each `evals/<case>/` is one test of the package's agent. No eval runs on the ser
226
228
  its report as `handed_previous` (`kind`: `whole`, `carried`, `too_large` or `none`; `text`, as handed; `run_id`; and
227
229
  for carried fields, `fields` and `dropped`, the count each carried array gave up, 0 for none). Only the eval's own server honours
228
230
  `previous`, so a case with it refuses `--server`.
231
+ - `files`, a mapping of a path in the run's work folder to the text that file starts with: each run's folder holds them
232
+ before its first turn, so a case can start where an earlier run left off (a run that resumes on the keys an earlier
233
+ one made, say):
234
+ ```yaml
235
+ files:
236
+ media/run-keys.json: |
237
+ {"stem": "k7m2p9qa"}
238
+ ```
239
+ A path is relative, with no empty, `.` or `..` segment, and outside `inputs/`, where the server puts the run's
240
+ uploads and its message; a file's text is a string, written as UTF-8. The eval's runner writes them at the run's
241
+ claim, before its computer starts, so a computer's `/workspace` holds them as it holds the run's uploads; a file the
242
+ folder already holds (a claim that resumes the run) is left as the run made it. They are the run's files like any
243
+ other, so `file_exists` finds them. Only the eval's own server honours
244
+ `files`, so a case with it refuses `--server`.
229
245
  - A fake MCP server's fixture, one shape for every package:
230
246
  ```json
231
247
  { "server": "github", "description": "what the fake holds",
@@ -235,7 +251,12 @@ Each `evals/<case>/` is one test of the package's agent. No eval runs on the ser
235
251
  ```
236
252
  An answer is taken when every argument its `when` lists equals the call's, the first that does; else `default`. A
237
253
  `when` may be a list of such mappings, taken when any one matches (one answer for each spelling of a call: a file by
238
- `sha` or by `ref`). Each `result` is an MCP tool result. A tool may also hold `search`, `{query, files: [{path,
254
+ `sha` or by `ref`). An argument's value may instead be `{"$pattern": "<regex>"}`, nothing else in it: the call's
255
+ argument must be a string the JavaScript regular expression matches whole, as if it began with `^` and ended with
256
+ `$` (`{"submission_key": {"$pattern": "ns-[a-z0-9]{8}-voice-cold-open"}}` answers whatever random stem a run made,
257
+ and never `ns-k7m2p9qa-voice-cold-open-2`). A `$pattern` that is no string or does not compile, or one beside another
258
+ key, fails the case when it is read. Any other value, a string or a mapping, is compared by equality. Each `result`
259
+ is an MCP tool result. A tool may also hold `search`, `{query, files: [{path,
239
260
  text}], limit?, note?}`: a call no answer matches is answered by searching its `query` argument over those files
240
261
  (GitHub code search's syntax, read loosely: terms every one of which a file holds, `NOT` before a term or a
241
262
  qualifier, and `path:`, `filename:`, `extension:`, `language:`; a `/.../` term is read as literal text, never as a
@@ -273,7 +294,7 @@ case's `max_cost_usd`, and each `llm` grade is a run of its own, capped at $0.50
273
294
  | `--case NAME` | A case to run; repeat it. Without one, every case. |
274
295
  | `--runs N` | Runs of each case, in place of each case's `runs`. |
275
296
  | `--server URL` | Run on that server instead, with its token as the CLI finds one (`AGENTRUN_API_KEY`, the CLI's config, or the data directory's for the server on this machine). The token goes to the runner over the launcher's pipe and is never printed. An eval's runs carry no `keys`, so on a server started with `AGENTRUN_RUN_KEYS=1` that lacks a tool key the package declares, the eval stops at the first case's apply, before any run, names the key and exits 2. |
276
- | `--on-data DIR` | Run the eval's own server on DIR, a stopped server's data folder, in place of a temp one: the runs use what that server keeps (its ChatGPT sign-in, so a package is measured on the owner's plan), and every case's fakes still bind (`now`, `email`, `calendar`, `web`, `monid`). The agents the eval made are archived there, and the folder stays, its tool settings as they were (the agent's own pin holds a pinned write, as on `--server`). Refused with `--server`, while another server holds DIR, when DIR's server has work of its own (an enabled trigger, a run not ended) that the eval's server and runner would take up, for an email case when DIR's server keeps an email account, which the case's fake mailbox would replace, and for a calendar case when DIR's server keeps a calendar. A case that fakes an MCP server DIR's server keeps by the same name fails, as on `--server`. |
297
+ | `--on-data DIR` | Run the eval's own server on DIR, a stopped server's data folder, in place of a temp one: the runs use what that server keeps (its ChatGPT sign-in, so a package is measured on the owner's plan), and every case's fakes still bind (`now`, `email`, `calendar`, `web`, `monid`, `files`). The agents the eval made are archived there, and the folder stays, its tool settings as they were (the agent's own pin holds a pinned write, as on `--server`). Refused with `--server`, while another server holds DIR, when DIR's server has work of its own (an enabled trigger, a run not ended) that the eval's server and runner would take up, for an email case when DIR's server keeps an email account, which the case's fake mailbox would replace, and for a calendar case when DIR's server keeps a calendar. A case that fakes an MCP server DIR's server keeps by the same name fails, as on `--server`. |
277
298
  | `--grader-model PROVIDER/MODEL` | The `llm` graders' model. Absent: the server's default. |
278
299
  | `--report FILE` | The whole report as JSON: per case, per run and per grader, its pass, its reason and its cost. A summary goes to stdout either way, progress to stderr. |
279
300
  | `--faux MODULE` | Answer every model request from the module, as the server's `--faux` does: no key, no network. |
@@ -308,7 +329,8 @@ and runs on the eval's own server.
308
329
  permission; with `--server` it writes nothing.
309
330
  3. The `learning` file is written as the agent's corrections (`PUT .../learning/corrections`), checked as that route
310
331
  checks them.
311
- 4. A run starts with the prompt's body as its input's `content` and its `input` front matter as its typed fields, and
332
+ 4. The case's `files` are written into the run's work folder at its claim, before its first turn. A run starts with the
333
+ prompt's body as its input's `content` and its `input` front matter as its typed fields, and
312
334
  `max_cost_usd` as its cap, and is waited for (30 minutes at
313
335
  most, then cancelled and failed). A run that ends waiting on its person's answer (an `ask_person` question, a tool
314
336
  call's approval) is graded as it stands, then cancelled. One paused at its cap, stopped, failed or cancelled fails,
@@ -379,7 +401,7 @@ package}`, and a line in the markdown).
379
401
  | `parameters` | The setup an owner fills once, at apply. Written exactly as `inputs` are (the same keys, the same rule: required unless `required: false`, a `default` only on one that is not) and compiled by the same code; `GET /v2/templates` shows them as a JSON Schema like `input_schema`, and the console's Apply form is the run form. The one difference is where they are filled: apply takes them in `parameters` (a blank one takes its `default`; they are checked as a run's input is, with the same `422` words under `parameters.<name>`), and puts them where the package writes `${parameters.<name>}`: `display_name`, the body, a trigger's `target.input`, a schedule's `cron` and `timezone`, the `in` values of a github, webhook, composio or feed trigger's `accept` where conditions, a composio trigger's `config` values, a feed trigger's `urls`, a trigger's `enabled`, and an `mcp` entry's `pin` values, nowhere else. Text takes the value as text (a list as its items joined by `, `). A `target.input` value, a composio trigger's `config` value or a pin value that is one placeholder alone takes the value with its type (a list pinned is a one-of); in `target.input` one given no value is dropped, so the input schema sees the field absent. A trigger's `enabled` takes only one placeholder alone, naming a boolean parameter with a default: the trigger is made on or off by its value. A feed trigger's `urls` that are one placeholder alone take an array-of-strings parameter whole. A parameter a where, a composio `config` or a feed's `urls` take is required or has a default, so none fills empty; one a schedule uses has a default, which the package's own schedule is checked with, and apply checks every trigger with the values given before it makes anything (`422` under `triggers.<i>`). |
380
402
  | `inputs` | By name: each run's typed input, which apply compiles into the agent's `input_schema` (a closed JSON Schema object). Each is `{type: string \| number \| integer \| boolean \| array, required?, title?, description?, examples?, default?, enum?, pattern? and format? (strings), minLength?/maxLength? (strings), minimum?/maximum? (numbers), items? (an array's scalar, with that scalar's keys)}`, nothing else; an input is required unless it says `required: false`, and a `default` is for one that is not. `format` is `uri`, `email`, `hostname`, `date`, `date-time` or `uuid`, which the server checks, or `cron` or `timezone`, which a form reads. A default and each example are checked against their own input. `content` is the run's message: named, it is a string. Every path that starts a run (the API, the CLI, a trigger, the console) checks the input against it and refuses one that does not meet it with `422 input_invalid`, a path per field (`input.country`). The model is sent the input's `content`, then the other fields as one fenced `json` block under the line `Input:`, so the instructions read each field by its name. `GET /v2/templates` shows it as `input_schema`, and the console's run form is drawn from it. A trigger's `target.input` and an eval case's `input` are checked against it too. Absent: a run takes `{content}`, as before. |
381
403
  | `secrets` | Variable names (never values) the server must hold: a model or tool key Settings saves (`OPENROUTER_API_KEY`, `PARALLEL_API_KEY`, ...), set where it starts or saved there. Any other name is refused: the server could neither save it nor hand it to a run. Apply refuses with `409 agent_not_runnable`, making nothing, when one is missing. |
382
- | `budget` | `{per_run_usd}`: each run's cap (the agent's `max_cost_usd`), required when the package has triggers. A call count belongs in the instructions ("about 30 calls"); the cap is the hard stop. |
404
+ | `budget` | `{per_run_usd}`: each run's cap (the agent's `max_cost_usd`). Every run a trigger starts is capped, so a package with triggers has a budget, or each of its triggers has a cap of its own (`target.max_cost_usd`, above 0); validate names each trigger with neither. Without a budget the agent has no cap, so a run its person starts has none, as on any agent without `max_cost_usd`. A call count belongs in the instructions ("about 30 calls"); the cap is the hard stop. |
383
405
  | `learning` | `true`, `false`, or an object (on, with the loop's settings), as an agent definition's `learning` takes it: whether the agent's runs learn. A package whose answer carries a decision names it in `agree_on`, dotted paths into the answer's JSON object (kyb's `{agree_on: [verdict.decision]}`, inbound-lead's `[next_step.action]`): a learned workflow's check and audit compare two answers on those alone, never on the rationale or prose two runs never repeat. Each path must be a required property at every level of the `output` schema (validate refuses one an answer may leave out: a path missing on both sides never agrees). Without it, two answers that differ are compared by the agent's fast model, which says whether they reach the same decision (one request per pair, on the run's own cap), so a learning agent with no `agree_on` wants a fast tier: `model_tiers.fast`, or the host's AGENT_MODEL_FAST. With neither, the whole answer is compared, word for word. |
384
406
  | `approvals` | `ask` (the default: the agent asks its person before a tool runs) or `never` (it runs unattended). The package's recommendation, shown as `approvals_default` for the apply screen; a template whose job runs on triggers says `never`. `never` only skips asking for the tools the agent was granted: an MCP tool the owner left unticked at apply is not one. Under `ask`, a ticked tool is granted but not allowed: it follows this server's tool settings, so a write asks unless the owner allowed it in Settings → Tools, and a read runs unasked only where the owner turned on Allow reads for its server. Deny settings and pins hold either way. |
385
407
  | `triggers` | `POST /v2/triggers` bodies with no `agent_id` (the target is a `start_run`), each with a `name`, unique in the package: the key an upgrade will match triggers by. `enabled` is `true` (the default), `false`, or `"${parameters.<name>}"`, one placeholder alone naming a boolean parameter that has a default (validate refuses any other text there, a parameter of another type, or one with no default): apply makes the trigger enabled or disabled by the owner's answer, the default when it is left out, so a second schedule can be one the owner opts into (`weekly`, default `false`, turning on a `monday-brief` at `0 8 * * 1`). A trigger made off is off as any trigger is: the owner switches it on or off later with `PATCH /v2/triggers/{id}` or the console. A `composio` trigger's `source.server` is the toolkit of one of the package's `mcp` needs, one with `source: composio` and `required: true` (`server: github` for `{source: composio, toolkit: github}`), never a saved server's name: apply makes the trigger on the saved Composio server that need maps to, the one candidate or the owner's pick under `servers`. Its `config` values and its `accept` where `in` values may hold `${parameters.<name>}`, a parameter that is required or has a default (`config: {owner: "${parameters.owner}", repo: "${parameters.repo}"}`); its `server` and `event` can't. It can't carry `instance_id`, `hook` or `move_subscription`, which this server sets when it makes the trigger on Composio. A composio trigger this server can't set up yet (no public URL, the saved server's user with no connected account or several, the project's subscription at another address) is skipped with a `triggers.<i>` warning in the refusal's words, as a github one is with GitHub not connected: the agent stands, and the owner makes the trigger from Triggers → New app trigger once that's fixed. Any other refusal undoes the apply. A `feed` trigger's `urls` is a list of URLs, each of which may hold `${parameters.<name>}` (pr-alert's `https://api.github.com/repos/${parameters.owner}/${parameters.repo}/pulls?state=open&sort=created&direction=desc`), or one placeholder alone naming an array-of-strings parameter (vendor-outage-watch's `"${parameters.status_feeds}"`), filled whole; each parameter required or with a default, and each filled value an http(s) URL, which apply checks (`422` under `triggers.<i>.source.urls[<j>]`). An array parameter given empty (`[]`) reads no feed: apply skips that trigger with a `triggers.<i>` warning naming the parameter, as it skips a github one with GitHub not connected, and the agent stands. Its `every_s`, `items` and `id` take no placeholder, its `accept` where `in` values may, and it has no `key` in a package. |