@parcha/agentrun-serve 0.1.0-beta.55 → 0.1.0-beta.57

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 (296) hide show
  1. package/CHANGELOG.md +261 -0
  2. package/README.md +228 -45
  3. package/dist/acp-package.d.ts +2 -0
  4. package/dist/adapters.d.ts +18 -5
  5. package/dist/adapters.js +23 -9
  6. package/dist/agent-package.d.ts +3 -3
  7. package/dist/agent-package.js +17 -8
  8. package/dist/answer-json.d.ts +6 -2
  9. package/dist/answer-json.js +22 -4
  10. package/dist/api-keys.d.ts +76 -0
  11. package/dist/api-keys.js +217 -0
  12. package/dist/api-only.d.ts +17 -5
  13. package/dist/api-only.js +36 -8
  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/calendar/tools.js +3 -2
  19. package/dist/chatgpt-plan.d.ts +28 -3
  20. package/dist/chatgpt-plan.js +182 -21
  21. package/dist/claude-login.d.ts +101 -14
  22. package/dist/claude-login.js +232 -49
  23. package/dist/claude-sign-in.d.ts +46 -0
  24. package/dist/claude-sign-in.js +93 -0
  25. package/dist/cli.js +63 -6
  26. package/dist/composio-made.d.ts +4 -0
  27. package/dist/composio-made.js +4 -0
  28. package/dist/composio-preset.d.ts +43 -2
  29. package/dist/composio-preset.js +92 -4
  30. package/dist/computer-held-routes.d.ts +5 -4
  31. package/dist/computer-held-routes.js +29 -8
  32. package/dist/computer-held.d.ts +6 -1
  33. package/dist/computer-held.js +14 -0
  34. package/dist/computer-record.js +4 -2
  35. package/dist/computer-viewer.js +4 -1
  36. package/dist/console/assets/{backend-D5EmB4N3.js → backend-DVhHzJX2.js} +19 -19
  37. package/dist/console/assets/index-Bwn1oTem.css +1 -0
  38. package/dist/console/assets/index-okP-y8PK.js +747 -0
  39. package/dist/console/index.html +2 -2
  40. package/dist/decisions.d.ts +1 -1
  41. package/dist/decisions.js +1 -1
  42. package/dist/docker-host-addresses.d.ts +22 -11
  43. package/dist/docker-host-addresses.js +38 -26
  44. package/dist/env-switch.d.ts +10 -0
  45. package/dist/env-switch.js +33 -2
  46. package/dist/errors.d.ts +1 -0
  47. package/dist/errors.js +2 -0
  48. package/dist/fal-price.d.ts +58 -20
  49. package/dist/fal-price.js +341 -82
  50. package/dist/handed-values.d.ts +43 -1
  51. package/dist/handed-values.js +119 -2
  52. package/dist/harness-archive.d.ts +13 -10
  53. package/dist/harness-archive.js +60 -34
  54. package/dist/harness-check.d.ts +3 -1
  55. package/dist/harness-check.js +25 -46
  56. package/dist/harness-keys.d.ts +73 -27
  57. package/dist/harness-keys.js +194 -61
  58. package/dist/harness-recipe-entry.d.ts +8 -7
  59. package/dist/harness-recipe-entry.js +21 -32
  60. package/dist/harness-recipe.d.ts +38 -25
  61. package/dist/harness-recipe.js +49 -36
  62. package/dist/harness-sign-in.js +12 -23
  63. package/dist/harness-table.d.ts +10 -3
  64. package/dist/harness-table.js +26 -21
  65. package/dist/harness.d.ts +1 -0
  66. package/dist/harness.js +17 -5
  67. package/dist/host-check.d.ts +4 -0
  68. package/dist/host-check.js +4 -0
  69. package/dist/hosted-search.d.ts +1 -1
  70. package/dist/hosted-search.js +1 -2
  71. package/dist/import-worker.d.ts +4 -2
  72. package/dist/import-worker.js +9 -2
  73. package/dist/in-flight.d.ts +26 -0
  74. package/dist/in-flight.js +52 -0
  75. package/dist/key-refusal.d.ts +26 -5
  76. package/dist/key-refusal.js +313 -37
  77. package/dist/learn/secrets.d.ts +31 -11
  78. package/dist/learn/secrets.js +152 -191
  79. package/dist/learning-cost.d.ts +6 -3
  80. package/dist/learning-cost.js +4 -2
  81. package/dist/link-check.js +1 -1
  82. package/dist/llms.txt +2 -2
  83. package/dist/marketplace.d.ts +77 -0
  84. package/dist/marketplace.js +224 -0
  85. package/dist/mcp-api-only-origins.d.ts +30 -0
  86. package/dist/mcp-api-only-origins.js +57 -0
  87. package/dist/mcp-gateway.d.ts +7 -5
  88. package/dist/mcp-gateway.js +9 -12
  89. package/dist/mcp-secret-writes.js +5 -3
  90. package/dist/mcp-servers-store.d.ts +28 -6
  91. package/dist/mcp-servers-store.js +53 -4
  92. package/dist/media-duration.d.ts +3 -0
  93. package/dist/media-duration.js +90 -9
  94. package/dist/model-form.d.ts +5 -4
  95. package/dist/model-form.js +11 -7
  96. package/dist/model.d.ts +5 -2
  97. package/dist/model.js +9 -5
  98. package/dist/ollama-provider.d.ts +7 -1
  99. package/dist/ollama-provider.js +14 -2
  100. package/dist/openapi.d.ts +3 -3
  101. package/dist/openapi.js +245 -42
  102. package/dist/otel/genai.d.ts +65 -0
  103. package/dist/otel/genai.js +116 -0
  104. package/dist/otel/tracer.d.ts +55 -0
  105. package/dist/otel/tracer.js +308 -0
  106. package/dist/page.d.ts +2 -0
  107. package/dist/page.js +3 -1
  108. package/dist/paid-calls.d.ts +1 -32
  109. package/dist/paid-calls.js +4 -39
  110. package/dist/place-offers.d.ts +14 -6
  111. package/dist/place-offers.js +26 -13
  112. package/dist/provider.d.ts +9 -0
  113. package/dist/provider.js +50 -3
  114. package/dist/redact/match.d.ts +101 -0
  115. package/dist/redact/match.js +1152 -0
  116. package/dist/refusal-words.d.ts +11 -0
  117. package/dist/refusal-words.js +11 -0
  118. package/dist/run-census.d.ts +67 -0
  119. package/dist/run-census.js +240 -0
  120. package/dist/run-computer.d.ts +6 -3
  121. package/dist/run-computer.js +4 -1
  122. package/dist/run-cut.d.ts +15 -6
  123. package/dist/run-cut.js +30 -9
  124. package/dist/run-files.d.ts +3 -0
  125. package/dist/run-files.js +3 -0
  126. package/dist/run-launch.d.ts +12 -1
  127. package/dist/run-launch.js +9 -10
  128. package/dist/run-learning-served.d.ts +2 -0
  129. package/dist/run-model-key.d.ts +8 -0
  130. package/dist/run-model-key.js +31 -1
  131. package/dist/run-reads-over-store.d.ts +24 -6
  132. package/dist/run-reads-over-store.js +67 -23
  133. package/dist/run-recordings.d.ts +5 -1
  134. package/dist/run-recordings.js +39 -14
  135. package/dist/run-timeline-served.d.ts +3 -1
  136. package/dist/run-timeline-served.js +4 -4
  137. package/dist/run-usage.d.ts +1 -0
  138. package/dist/runnable.d.ts +10 -1
  139. package/dist/runnable.js +20 -8
  140. package/dist/runner/adapter-loop.d.ts +14 -0
  141. package/dist/runner/adapter-loop.js +56 -11
  142. package/dist/runner/adapter-run-spec.d.ts +45 -8
  143. package/dist/runner/adapter-run-spec.js +154 -29
  144. package/dist/runner/adapters/pi.js +25 -3
  145. package/dist/runner/beside.js +11 -6
  146. package/dist/runner/big-writes.js +1 -10
  147. package/dist/runner/claim-secrets.d.ts +18 -3
  148. package/dist/runner/claim-secrets.js +35 -6
  149. package/dist/runner/cli-run-spec.d.ts +6 -0
  150. package/dist/runner/cli-run-spec.js +85 -36
  151. package/dist/runner/computer-journal.d.ts +9 -1
  152. package/dist/runner/computer-journal.js +26 -0
  153. package/dist/runner/conformance/harness.js +1 -1
  154. package/dist/runner/feedback-round.js +3 -0
  155. package/dist/runner/harness-loops.d.ts +6 -5
  156. package/dist/runner/harness-loops.js +7 -7
  157. package/dist/runner/held.d.ts +11 -5
  158. package/dist/runner/journal-kinds.d.ts +5 -0
  159. package/dist/runner/journal-kinds.js +5 -0
  160. package/dist/runner/loop-contract.d.ts +4 -0
  161. package/dist/runner/main.js +15 -6
  162. package/dist/runner/mcp-claim.js +30 -3
  163. package/dist/runner/mcp-run.d.ts +12 -0
  164. package/dist/runner/mcp-run.js +12 -5
  165. package/dist/runner/model-route.d.ts +17 -0
  166. package/dist/runner/model-route.js +120 -2
  167. package/dist/runner/presence.d.ts +4 -3
  168. package/dist/runner/presence.js +4 -2
  169. package/dist/runner/run-child-host.d.ts +5 -0
  170. package/dist/runner/run-child-host.js +71 -30
  171. package/dist/runner/run-child.js +5 -2
  172. package/dist/runner/runner.d.ts +18 -3
  173. package/dist/runner/runner.js +162 -36
  174. package/dist/runner/store-port.d.ts +1 -1
  175. package/dist/runner/store-secrets.d.ts +6 -0
  176. package/dist/runner/store-secrets.js +49 -7
  177. package/dist/runner/subagent.js +4 -40
  178. package/dist/runner/workflow-first.d.ts +11 -4
  179. package/dist/runner/workflow-first.js +14 -8
  180. package/dist/runner/workflow-spec.js +3 -2
  181. package/dist/runs-over-store.d.ts +15 -6
  182. package/dist/runs-over-store.js +33 -21
  183. package/dist/scrub-command.d.ts +73 -0
  184. package/dist/scrub-command.js +307 -0
  185. package/dist/secret-cut.d.ts +73 -0
  186. package/dist/secret-cut.js +291 -4
  187. package/dist/secret-rules.d.ts +143 -0
  188. package/dist/secret-rules.js +2564 -0
  189. package/dist/secrets.d.ts +7 -0
  190. package/dist/secrets.js +20 -0
  191. package/dist/server-keys.d.ts +20 -0
  192. package/dist/server-keys.js +25 -6
  193. package/dist/server.d.ts +57 -13
  194. package/dist/server.js +371 -113
  195. package/dist/skills/agentrun-serve/SKILL.md +4 -0
  196. package/dist/store/dialect.d.ts +3 -0
  197. package/dist/store/dialect.js +1 -0
  198. package/dist/store/index.d.ts +1 -1
  199. package/dist/store/index.js +1 -1
  200. package/dist/store/journal/storage.js +1 -1
  201. package/dist/store/postgres/dialect.js +3 -0
  202. package/dist/store/postgres/migrations/0027_run_launch_census.sql +31 -0
  203. package/dist/store/schema.d.ts +6 -0
  204. package/dist/store/schema.js +11 -1
  205. package/dist/store/seal.d.ts +6 -1
  206. package/dist/store/seal.js +5 -3
  207. package/dist/store/sqlite/run-launch.d.ts +9 -1
  208. package/dist/store/sqlite/run-launch.js +24 -13
  209. package/dist/store/sqlite/run-patch.d.ts +1 -1
  210. package/dist/store/sqlite/run-patch.js +13 -4
  211. package/dist/store/sqlite/store.js +76 -16
  212. package/dist/store/store.d.ts +53 -3
  213. package/dist/store/store.js +27 -0
  214. package/dist/store-reads/learning.d.ts +6 -3
  215. package/dist/store-reads/learning.js +22 -7
  216. package/dist/store-view.d.ts +3 -0
  217. package/dist/store-view.js +4 -4
  218. package/dist/suggestions.js +3 -2
  219. package/dist/template-eval.d.ts +22 -11
  220. package/dist/template-eval.js +124 -41
  221. package/dist/template-import.d.ts +10 -0
  222. package/dist/template-import.js +16 -7
  223. package/dist/templates.d.ts +10 -2
  224. package/dist/templates.js +28 -8
  225. package/dist/timeline/index.d.ts +1 -1
  226. package/dist/timeline/index.js +1 -1
  227. package/dist/timeline/labels.d.ts +6 -4
  228. package/dist/timeline/labels.js +18 -6
  229. package/dist/timeline/timeline.d.ts +17 -7
  230. package/dist/timeline/timeline.js +28 -14
  231. package/dist/timeline/util.js +1 -1
  232. package/dist/timeline/web-calls.d.ts +26 -9
  233. package/dist/timeline/web-calls.js +124 -37
  234. package/dist/tool-gate.d.ts +42 -3
  235. package/dist/tool-gate.js +69 -6
  236. package/dist/tool-keys-store.d.ts +2 -4
  237. package/dist/tool-keys-store.js +5 -21
  238. package/dist/tool-keys.d.ts +2 -2
  239. package/dist/tool-keys.js +2 -2
  240. package/dist/tool-list.js +1 -1
  241. package/dist/tool-plane.d.ts +2 -2
  242. package/dist/tool-plane.js +35 -33
  243. package/dist/tools.js +13 -7
  244. package/dist/trigger-targets.d.ts +4 -0
  245. package/dist/trigger-targets.js +9 -2
  246. package/dist/triggers.d.ts +67 -4
  247. package/dist/triggers.js +171 -22
  248. package/dist/until.d.ts +3 -0
  249. package/dist/until.js +11 -0
  250. package/dist/validate.js +1 -1
  251. package/dist/web-fake.d.ts +1 -3
  252. package/dist/web-fake.js +7 -18
  253. package/dist/web-fetch.d.ts +6 -72
  254. package/dist/web-fetch.js +11 -265
  255. package/dist/web-run.d.ts +31 -0
  256. package/dist/web-run.js +90 -0
  257. package/dist/web-save.d.ts +6 -4
  258. package/dist/web-save.js +9 -12
  259. package/dist/web-search.d.ts +9 -127
  260. package/dist/web-search.js +23 -259
  261. package/dist/wires.d.ts +13 -0
  262. package/dist/wires.js +11 -0
  263. package/dist/workflow-run.d.ts +5 -4
  264. package/dist/workflow-run.js +5 -4
  265. package/dist/workspace/computer-deps.d.ts +3 -1
  266. package/dist/workspace/computer-deps.js +12 -4
  267. package/dist/workspace/computer-for-claim.d.ts +19 -2
  268. package/dist/workspace/computer-for-claim.js +101 -13
  269. package/dist/workspace/computer-janitor.d.ts +15 -7
  270. package/dist/workspace/computer-janitor.js +33 -8
  271. package/dist/workspace/computer-kept.d.ts +55 -4
  272. package/dist/workspace/computer-kept.js +129 -8
  273. package/dist/workspace/index.d.ts +1 -1
  274. package/dist/workspace/index.js +1 -1
  275. package/dist/workspace/kind-skills.d.ts +4 -0
  276. package/dist/workspace/kind-skills.js +9 -0
  277. package/dist/workspace/run-end-computers.d.ts +5 -1
  278. package/dist/workspace/run-end-computers.js +27 -1
  279. package/dist/workspace/synced-folder.js +3 -4
  280. package/dist/wrapped.d.ts +65 -0
  281. package/dist/wrapped.js +77 -0
  282. package/package.json +17 -11
  283. package/skills/agentrun-serve/SKILL.md +4 -0
  284. package/templates/README.md +38 -15
  285. package/dist/console/assets/index-DUYLaqiR.js +0 -746
  286. package/dist/console/assets/index-DYhU4adm.css +0 -1
  287. package/dist/exa-keyless.d.ts +0 -34
  288. package/dist/exa-keyless.js +0 -118
  289. package/dist/firecrawl-keyless.d.ts +0 -41
  290. package/dist/firecrawl-keyless.js +0 -152
  291. package/dist/keyless-mcp.d.ts +0 -36
  292. package/dist/keyless-mcp.js +0 -127
  293. package/dist/text-urls.d.ts +0 -38
  294. package/dist/text-urls.js +0 -170
  295. package/dist/web-fetch-direct.d.ts +0 -119
  296. package/dist/web-fetch-direct.js +0 -190
@@ -314,6 +314,13 @@ export interface RunPatch {
314
314
  * cancel waiting at its commit cut the look-back, never the job's end, and is refused (refuseLeftovers), unless a
315
315
  * person's message waits too: that message's run is the one they stop or cancel. */
316
316
  readonly keepsEnd?: boolean;
317
+ /** A final patch's census (run-census.ts): where in the run's files the secrets its launch holds sit, made under the
318
+ * launch's `sealed` bytes as they were then. The end that erases them writes it as the launch's census when its sealed
319
+ * bytes are still those, else the marker "unscanned" (refuseLeftovers), as it does for an end with none. */
320
+ readonly census?: {
321
+ readonly json: string;
322
+ readonly sealed: Uint8Array;
323
+ };
317
324
  }
318
325
  /** The row runs.update answers. When the patch wrote `signInHanded` (the runner's bind at its claim), `save` rides with it:
319
326
  * whether this run holds the sign-in's save lease — true unless another run already holds one of the handed pointers,
@@ -331,12 +338,24 @@ export interface RunLaunchInput {
331
338
  readonly body: unknown;
332
339
  readonly sealed?: Uint8Array | null;
333
340
  }
341
+ /** The census a launch takes when sealed bytes are first written on it (RunLaunchRow.census): it holds secrets its caller
342
+ * handed it, and no end has counted where they sit. An end erases them and writes its census in its place; an end that
343
+ * wrote none (a runner from before the census, during a rolling deploy) leaves it, and an ended run's files under it are
344
+ * withheld from a cut read, as under CENSUS_UNSCANNED. */
345
+ export declare const CENSUS_PENDING: string;
346
+ /** The census an end that erased a launch's sealed bytes writes when it has none made under them (RunLaunchRow.census), and
347
+ * a message's seal writes over CENSUS_PENDING left by such an end: what the run was handed may be in its files, and
348
+ * nothing says where. */
349
+ export declare const CENSUS_UNSCANNED: string;
334
350
  /** A run's launch as the store holds it: the body the runner reads at its claim, and its sealed bytes, which the store never
335
- * opens. */
351
+ * opens. `census`: null when its launch never held sealed bytes (none handed, or a run ended before the census was kept);
352
+ * CENSUS_PENDING from when they were first written until an end counted them; then the JSON text the last end that
353
+ * erased them wrote (RunPatch.census, run-census.ts), or CENSUS_UNSCANNED when that end had none made under them. */
336
354
  export interface RunLaunchRow {
337
355
  readonly runId: string;
338
356
  readonly body: unknown;
339
357
  readonly sealed: Uint8Array | null;
358
+ readonly census: string | null;
340
359
  readonly createdAt: number;
341
360
  }
342
361
  /** A message's new launch secrets (runs.command, runs.reopen): `launchSealed` replaces the run's launch `sealed` in the
@@ -745,6 +764,10 @@ export interface FiringChange {
745
764
  * transaction: a host start that pushed a startBy out and wrote no run puts it back (triggers.ts handedStart), unless
746
765
  * its run started, or another start moved it, meanwhile. */
747
766
  readonly startByWas?: number;
767
+ /** Written only while the firing has no run, read in the settle's own transaction (with `from`, a firing's start by a
768
+ * run written apart from it, triggers.ts handedRan): one a release failed, or another run started, meanwhile is left
769
+ * as it is. */
770
+ readonly noRun?: true;
748
771
  }
749
772
  /** What a settle does to the firing's trigger besides: `reset` its failure streak (a run started, a message sent), or
750
773
  * count a `failure` toward it, turning it off at `pauseAt` in a row (auto-pause, the firing marked paused). */
@@ -1020,7 +1043,10 @@ export interface Runs {
1020
1043
  * `expectedCurrent` checks the agent's current revision under its lock (RevisionMoved on mismatch); this is separate
1021
1044
  * from the pinned revisionId. Settings guards are locked before the agent. Refusal writes no run, origin or launch.
1022
1045
  * `startedAt` (ms) is when the run began, for one reported after it began elsewhere (a backend SDK run's
1023
- * `started_at`); absent, now. */
1046
+ * `started_at`); absent, now. With `firing` (a launch hook's host starting the firing it was handed), that firing is
1047
+ * started with the run in the same transaction, its trigger's last run and failure streak as a started firing's
1048
+ * are, only while it has no run and is still due or sent with a start_by: any other (released, failed, settled) is
1049
+ * refused (FiringMoved), and nothing is written. */
1024
1050
  create(run: {
1025
1051
  id: string;
1026
1052
  agentId: string;
@@ -1030,6 +1056,10 @@ export interface Runs {
1030
1056
  expectedCurrent?: string | null;
1031
1057
  settingsGuards?: readonly SettingsGuard[];
1032
1058
  startedAt?: number;
1059
+ firing?: {
1060
+ triggerId: string;
1061
+ key: string;
1062
+ };
1033
1063
  }, launch?: RunLaunchInput): Promise<RunRow>;
1034
1064
  /** A run whose agent is given inline and mapped to a source system by `agent.ref` and `revision.version`. In one
1035
1065
  * transaction: the agent (one per `ref`, written on its first run, its name and description brought up to the version
@@ -1247,9 +1277,11 @@ export interface Runs {
1247
1277
  failUnclaimed(summary: string): Promise<string[]>;
1248
1278
  /** The runs a runner may claim, oldest first: queued; parked with an untaken command or its wake_at passed; running with
1249
1279
  * no runner (released at a runner's shutdown: it stays running, a run that started keeps that fact) or its claim run
1250
- * out. */
1280
+ * out. A parked run whose computer is kept for another runner that is still there (its pin, KEPT_PREFIX) is that
1281
+ * runner's alone: with `runner`, the claimer, such a run is left out; without it every run is counted. */
1251
1282
  claimable(options?: {
1252
1283
  limit?: number;
1284
+ runner?: string;
1253
1285
  }): Promise<string[]>;
1254
1286
  /** The epoch a runner's claim holds run `runId` at now, judged by the store's own clock (the one claims are stamped
1255
1287
  * and fenced by), never a reader's; undefined when no claim holds it (none, released, or run out) or there is no
@@ -1782,6 +1814,13 @@ export interface RunCapacity {
1782
1814
  /** How long a runner's row is kept once it stopped saying it is there (a runner that died without its close): its next
1783
1815
  * put removes every row older than this. */
1784
1816
  export declare const RUNNER_ROWS_KEPT_MS: number;
1817
+ /** How old a runner's row can be and still count as there, on the store's clock (runner/presence.ts PRESENCE_STALE_MS:
1818
+ * three renewals missed). The claim rule reads it for a kept computer's pin. */
1819
+ export declare const RUNNER_STALE_MS = 30000;
1820
+ /** The settings key prefix of the computers kept at a run's park, one row per run (workspace/computer-kept.ts). A row
1821
+ * whose computer is pinned to the runner that kept it (its `runner` and `incarnation`) holds the run for that runner in
1822
+ * the claim rule, while that runner is there under that incarnation and the keep lasts. */
1823
+ export declare const KEPT_PREFIX = "computer_kept:";
1785
1824
  /** Every runner's word that it is there (runner/presence.ts). */
1786
1825
  export interface Runners {
1787
1826
  /** Keeps `row` for its runner, replacing any earlier incarnation's, seen now; rows no runner renewed for
@@ -2102,6 +2141,11 @@ export interface Store {
2102
2141
  /** Reads the store's schema version and its runner floor now, without a lock or a write: a runner reads it at each
2103
2142
  * renewal (runner/main.ts), and stops once the floor is above the version its build knows. */
2104
2143
  schemaState?(): Promise<StoreSchemaState>;
2144
+ /** The clock a claim's lease is judged and stamped on (its `until`), when it is this process's own: the store's clock on
2145
+ * SQLite (one host), or a test's. A runner reckons a claim's deadline from its `until` on it, so a claim or renew that
2146
+ * waited for the writer lock keeps the lease the store granted from the lock. Absent when the lease is the database's
2147
+ * clock (Postgres), which this process cannot read: the runner reckons from when it asked. */
2148
+ readonly leaseClock?: () => number;
2105
2149
  /** Claims the run for `runner` until now + `leaseMs`: the run's epoch + 1 when it is claimable (runs.claimable); null when
2106
2150
  * another claim holds it, or it is final, or parked with nothing to wake it. A queued or parked run becomes running. */
2107
2151
  claim(runId: string, runner: string, options?: {
@@ -2313,6 +2357,12 @@ export declare class RunsMadeFromLeft extends StoreConstraint {
2313
2357
  readonly runs: readonly string[];
2314
2358
  constructor(runId: string, runs: readonly string[]);
2315
2359
  }
2360
+ /** A run's firing (Runs.create `firing`) that no longer takes it: no longer due or sent with a start_by, or it has a run. */
2361
+ export declare class FiringMoved extends Error {
2362
+ readonly triggerId: string;
2363
+ readonly key: string;
2364
+ constructor(triggerId: string, key: string);
2365
+ }
2316
2366
  /** A run made from a purged run (its launch's `replay.of` or `audit.of` names it): refused, nothing written. Its source's
2317
2367
  * input is gone, and a copy of it is never made again (Runs.create). `runId`: the purged run. */
2318
2368
  export declare class RunPurged extends Error {
@@ -30,6 +30,15 @@ export function tombstoneMetrics(metrics, kept) {
30
30
  out.purged = kept;
31
31
  return out;
32
32
  }
33
+ /** The census a launch takes when sealed bytes are first written on it (RunLaunchRow.census): it holds secrets its caller
34
+ * handed it, and no end has counted where they sit. An end erases them and writes its census in its place; an end that
35
+ * wrote none (a runner from before the census, during a rolling deploy) leaves it, and an ended run's files under it are
36
+ * withheld from a cut read, as under CENSUS_UNSCANNED. */
37
+ export const CENSUS_PENDING = JSON.stringify("pending");
38
+ /** The census an end that erased a launch's sealed bytes writes when it has none made under them (RunLaunchRow.census), and
39
+ * a message's seal writes over CENSUS_PENDING left by such an end: what the run was handed may be in its files, and
40
+ * nothing says where. */
41
+ export const CENSUS_UNSCANNED = JSON.stringify("unscanned");
33
42
  /** A firing a trigger has no room for: `due` firings are DUE_KEPT already. Nothing was written. */
34
43
  export class TriggerFull extends Error {
35
44
  triggerId;
@@ -119,6 +128,13 @@ export const MCP_REFRESH_LEASE_MS = MCP_REFRESH_CALL_MS + STORE_WRITE_DEADLINE_M
119
128
  /** How long a runner's row is kept once it stopped saying it is there (a runner that died without its close): its next
120
129
  * put removes every row older than this. */
121
130
  export const RUNNER_ROWS_KEPT_MS = 24 * 60 * 60_000;
131
+ /** How old a runner's row can be and still count as there, on the store's clock (runner/presence.ts PRESENCE_STALE_MS:
132
+ * three renewals missed). The claim rule reads it for a kept computer's pin. */
133
+ export const RUNNER_STALE_MS = 30_000;
134
+ /** The settings key prefix of the computers kept at a run's park, one row per run (workspace/computer-kept.ts). A row
135
+ * whose computer is pinned to the runner that kept it (its `runner` and `incarnation`) holds the run for that runner in
136
+ * the claim rule, while that runner is there under that incarnation and the keep lasts. */
137
+ export const KEPT_PREFIX = "computer_kept:";
122
138
  /** The id prefix of a package uploaded whole (POST /v2/templates/import {files}): `upload:<name>`. */
123
139
  export const UPLOAD_PREFIX = "upload:";
124
140
  /** A write under a claim whose epoch is no longer the run's: refused, and nothing written. */
@@ -301,6 +317,17 @@ export class RunsMadeFromLeft extends StoreConstraint {
301
317
  this.name = "RunsMadeFromLeft";
302
318
  }
303
319
  }
320
+ /** A run's firing (Runs.create `firing`) that no longer takes it: no longer due or sent with a start_by, or it has a run. */
321
+ export class FiringMoved extends Error {
322
+ triggerId;
323
+ key;
324
+ constructor(triggerId, key) {
325
+ super(`firing ${key} of trigger ${triggerId} no longer takes a run: nothing was written`);
326
+ this.triggerId = triggerId;
327
+ this.key = key;
328
+ this.name = "FiringMoved";
329
+ }
330
+ }
304
331
  /** A run made from a purged run (its launch's `replay.of` or `audit.of` names it): refused, nothing written. Its source's
305
332
  * input is gone, and a copy of it is never made again (Runs.create). `runId`: the purged run. */
306
333
  export class RunPurged extends Error {
@@ -185,8 +185,9 @@ export declare function costRunOf(store: RunRecords, run: RunRecord, n: number |
185
185
  * and the cost page: of its newest PAST_RUNS runs on no named disk (learn/learning-of.ts: one on a named disk learns
186
186
  * nothing), each that ended (ended, stopped or failed) since its learning's reset (learn/compile.ts sinceReset: a
187
187
  * workflow before it is not the one it learned after, whatever its name), is neither imported nor archived nor a
188
- * workflow revision's run, with its all-in cost (allInOf). `known`: all-in costs already read, by run id (the cost
189
- * page's series), read again for no run; `records`, where any other's rows are read (the store's by default). */
188
+ * workflow revision's run, with its all-in cost as the money rule reads it (moneyAllInOf). `known`: all-in costs already
189
+ * read (allInOf), by run id (the cost page's series), read again for no served run; `records`, where any other's rows
190
+ * are read (the store's by default). */
190
191
  export declare function pastRunsOverStore(store: Store, agentId: string, known?: ReadonlyMap<string, number | null>, records?: RunRecords): Promise<PastRun[]>;
191
192
  /** The money rule's decision for agent `agentId` (runner/workflow-first.ts costStopOf) over the runs a run's launch reads
192
193
  * (pastRunsOverStore), as the launch reads them: runs that can't be read now stop nothing (workflowFirstOf serves). What
@@ -199,12 +200,14 @@ export declare const costStopOverStore: (store: Store, agentId: string) => Promi
199
200
  * new answer is the agent's, with its digest. Else, for a run its launch offered a learned workflow, its timeline
200
201
  * (runner/learning-end.ts runPathOf, the agent calling the tool itself): `workflow` when its job did only that,
201
202
  * `handed_back` when the agent went on, with the workflow its job called last. Any other run's path is `agent`. Both
202
- * read the run's rows less its feedback rounds' (withoutFeedbackRounds): a grade's round never moves the path. */
203
+ * read the run's rows less its feedback rounds' (withoutFeedbackRounds): a grade's round never moves the path. `cut` on a
204
+ * hand-back a restart cut (servedOf: the workflow's call ended `interrupted`), never one the workflow made itself. */
203
205
  export declare function runPathOverStore(store: Store, runId: string, started: RunLaunch["learning"], redact?: (text: string) => string): Promise<{
204
206
  path: RunPath;
205
207
  workflow: string | null;
206
208
  digest?: string;
207
209
  promotion?: number;
210
+ cut?: true;
208
211
  }>;
209
212
  /** The path a run's views say it took (GET /runs/{id} and each runs list row: `path`, and `workflow`), read off its record
210
213
  * as the cost per run reads it (pathOfRow, revisionOfRow: costRunOf's own read, so the run views and GET
@@ -216,6 +216,8 @@ export async function agentCostOverStore(store, agentId, limit = Infinity, refus
216
216
  const ended = listed.filter((run) => FINAL_STATES.includes(run.state) && !run.importedFrom && run.archivedAt === null && !isShadowRun(run.id)).sort((a, b) => a.startedAt - b.startedAt || (a.id < b.id ? -1 : 1));
217
217
  const rows = [];
218
218
  let unknownPath = 0;
219
+ // The hand-backs a restart cut (metrics.workflow_cut: pathMetrics), counted apart from the workflow's own (costSummary).
220
+ const cut = new Set();
219
221
  // One numbering, the bill's: the runs that do a job, 1 the first; a replay checks a revision and has none.
220
222
  let jobs = 0;
221
223
  for (const run of ended) {
@@ -229,12 +231,14 @@ export async function agentCostOverStore(store, agentId, limit = Infinity, refus
229
231
  unknownPath += 1;
230
232
  continue;
231
233
  }
234
+ if (placed.path === "handed_back" && run.metrics?.workflow_cut === true)
235
+ cut.add(run.id);
232
236
  rows.push(await costRunOf(records, run, JOB_PATHS.includes(placed.path) ? (jobs += 1) : null, placed));
233
237
  }
234
238
  // Where each revision took over, over every run before the limit cuts the read (the first is the summary's takeover).
235
239
  const runs = tookOverOf(rows);
236
240
  // Each learned workflow that ran first, where it stands against the money rule (workflow-first.ts workflowCostsOf), over
237
- // the runs the run's launch reads (pastRunsOverStore) at the all-in cost this series shows: a workflow over the line
241
+ // the runs the run's launch reads (pastRunsOverStore) at the all-in it reads (moneyAllInOf): a workflow over the line
238
242
  // shows `needs_revision` with its two numbers, so the page and the launch's decision agree.
239
243
  const workflows = workflowCostsOf(await pastRunsOverStore(store, agentId, new Map(runs.map((run) => [run.run_id, run.total_usd])), records));
240
244
  const promotions = await promotionsOf(store.settings, agentId);
@@ -245,7 +249,7 @@ export async function agentCostOverStore(store, agentId, limit = Infinity, refus
245
249
  // not be the first promotion), and each revision's compile and check over the served runs that carry it: runs on no
246
250
  // named disk alone, as a run on one learns nothing and serves nothing (learn/learning-of.ts).
247
251
  const ledger = await agentLedgerOf(records, promotions, listed.filter((run) => run.disk === null), await resetLedgerOf(store.settings, agentId), skip);
248
- const summary = costSummary(runs, replay);
252
+ const summary = costSummary(runs, replay, cut);
249
253
  const booked = billOf(runs, summary);
250
254
  // What no run carries is the booked total less every run's all-in (A8), so a revision whose records aged out of the
251
255
  // feed lands here, never nowhere: unknown while any run's figures are.
@@ -480,8 +484,9 @@ export async function costRunOf(store, run, n, { path, workflow }) {
480
484
  * and the cost page: of its newest PAST_RUNS runs on no named disk (learn/learning-of.ts: one on a named disk learns
481
485
  * nothing), each that ended (ended, stopped or failed) since its learning's reset (learn/compile.ts sinceReset: a
482
486
  * workflow before it is not the one it learned after, whatever its name), is neither imported nor archived nor a
483
- * workflow revision's run, with its all-in cost (allInOf). `known`: all-in costs already read, by run id (the cost
484
- * page's series), read again for no run; `records`, where any other's rows are read (the store's by default). */
487
+ * workflow revision's run, with its all-in cost as the money rule reads it (moneyAllInOf). `known`: all-in costs already
488
+ * read (allInOf), by run id (the cost page's series), read again for no served run; `records`, where any other's rows
489
+ * are read (the store's by default). */
485
490
  export async function pastRunsOverStore(store, agentId, known, records = store) {
486
491
  const kinds = new Map();
487
492
  const kept = [];
@@ -510,10 +515,19 @@ export async function pastRunsOverStore(store, agentId, known, records = store)
510
515
  // A few reads a run, a batch at a time: a launch reads up to PAST_RUNS of them.
511
516
  const past = [];
512
517
  for (let at = 0; at < kept.length; at += 16) {
513
- past.push(...(await Promise.all(kept.slice(at, at + 16).map(async (run) => ({ metrics: run.metrics, startedAt: run.startedAt, allInUsd: known?.has(run.id) ? known.get(run.id) : (await allInOf(paged, run)).total_usd })))));
518
+ past.push(...(await Promise.all(kept.slice(at, at + 16).map(async (run) => ({ metrics: run.metrics, startedAt: run.startedAt, allInUsd: await moneyAllInOf(paged, run, known) })))));
514
519
  }
515
520
  return past;
516
521
  }
522
+ /** A run's all-in as the money rule reads it (runner/workflow-first.ts PastRun): a run a learned workflow served
523
+ * (SERVED_PATHS) at its all-in (allInOf, or `known`'s); any other as the run view reads it (runAllInOverStore's
524
+ * allInV2Of), its compile turns its revision's, never the agent's by-hand cost, and no revision's share (only a served
525
+ * run carries one). Its recurring learning (a follow-up's rounds, its audit shadow) stays on it. */
526
+ async function moneyAllInOf(records, run, known) {
527
+ if (SERVED_PATHS.includes(metricOf(run).path))
528
+ return known?.has(run.id) ? known.get(run.id) : (await allInOf(records, run)).total_usd;
529
+ return allInV2Of({ run_id: run.id, ...(await allInOf(records, run)) }, await compilesOf(records, run.id), new Map());
530
+ }
517
531
  /** The money rule's decision for agent `agentId` (runner/workflow-first.ts costStopOf) over the runs a run's launch reads
518
532
  * (pastRunsOverStore), as the launch reads them: runs that can't be read now stop nothing (workflowFirstOf serves). What
519
533
  * the promotions read and the learning view fold into each workflow's state (learn/promote.ts servingStateOf). */
@@ -525,7 +539,8 @@ export const costStopOverStore = async (store, agentId) => costStopOf(await past
525
539
  * new answer is the agent's, with its digest. Else, for a run its launch offered a learned workflow, its timeline
526
540
  * (runner/learning-end.ts runPathOf, the agent calling the tool itself): `workflow` when its job did only that,
527
541
  * `handed_back` when the agent went on, with the workflow its job called last. Any other run's path is `agent`. Both
528
- * read the run's rows less its feedback rounds' (withoutFeedbackRounds): a grade's round never moves the path. */
542
+ * read the run's rows less its feedback rounds' (withoutFeedbackRounds): a grade's round never moves the path. `cut` on a
543
+ * hand-back a restart cut (servedOf: the workflow's call ended `interrupted`), never one the workflow made itself. */
529
544
  export async function runPathOverStore(store, runId, started, redact) {
530
545
  const entries = await runEntries(store, runId, BACKGROUND_CONTEXT);
531
546
  const served = servedOf(entries);
@@ -541,7 +556,7 @@ export async function runPathOverStore(store, runId, started, redact) {
541
556
  // runner's `redact`, adapter-loop.ts servedAnswerText): an agent that says it again leaves the path the workflow's.
542
557
  const answer = servedAnswerOf(entries)?.answer ?? "";
543
558
  const alone = served.outcome === "answered" && servedAnswerStands(answer, rows, redact ? redact(answer) : undefined);
544
- return { path: alone ? "workflow" : "handed_back", workflow: served.workflow, ...(served.digest ? { digest: served.digest } : {}), ...(served.promotion !== undefined ? { promotion: served.promotion } : {}) };
559
+ return { path: alone ? "workflow" : "handed_back", workflow: served.workflow, ...(served.digest ? { digest: served.digest } : {}), ...(served.promotion !== undefined ? { promotion: served.promotion } : {}), ...(served.cut ? { cut: true } : {}) };
545
560
  }
546
561
  const path = runPathOf(rows);
547
562
  // Only a name the launch offered: a call's raw `name` (a failed call's included) is the model's text, never shown.
@@ -17,6 +17,9 @@ export interface ViewDeps {
17
17
  readonly origin: string;
18
18
  readonly serverSecrets: () => string[];
19
19
  readonly signIns?: SignInReader;
20
+ /** The server's seal key, which opens what a run's caller handed it while its launch holds it (run-cut.ts runCutValues);
21
+ * undefined when it has none, and a run that holds some is then withheld. */
22
+ readonly sealKey: Buffer | undefined;
20
23
  /** The server's clock (ms), for the claim-lease check that decides a run is live; defaults to Date.now. The server
21
24
  * passes the same clock the store uses, so a test on a moved clock reads a fresh claim as live. */
22
25
  readonly now?: () => number;
@@ -8,7 +8,7 @@ import { isDeepStrictEqual } from "node:util";
8
8
  import { BACKGROUND_CONTEXT } from "@earendil-works/chord/context";
9
9
  import { CAPS, isMessageRow } from "./timeline/index.js";
10
10
  import { runLink } from "./console-links.js";
11
- import { redacted, redactedAnswer, redactedOutput, withoutLoopback } from "./key-refusal.js";
11
+ import { redacted, redactedAnswer, redactedOutput, withheldWhole, withoutLoopback } from "./key-refusal.js";
12
12
  import { structuredAnswer } from "./answer-json.js";
13
13
  import { isObject } from "./validate.js";
14
14
  import { currentLearning, holdsForOk, learningView, LEARNING_LABEL, secretsShown, shortOf } from "./learning.js";
@@ -266,7 +266,7 @@ async function storeRunIn(store, runId, deps, cut, since) {
266
266
  // Its final answer whole (store-reads/journal.ts wholeAnswers), as main served a run's answer: a row's cut is no answer's.
267
267
  // A run that ended reads settled, and its usage row says its cost ("Cost: …"), never what it has cost so far. One
268
268
  // looking back is still going: its look-back's rows come yet.
269
- const timelineOptions = { settled: terminal && !lookingBack, ended: terminal && !lookingBack, redact: (text) => redacted(text, values) };
269
+ const timelineOptions = { settled: terminal && !lookingBack, ended: terminal && !lookingBack, redact: (text) => redacted(text, values), holds: (text) => withheldWhole(text, values) };
270
270
  // Rendered from the records read above, so its usage row and the cost's `plan` (bookedSpend over the same entries) are
271
271
  // of one read.
272
272
  const timeline = withAsks(await wholeAnswers(store, runId, context, await runTimeline(store, runId, context, timelineOptions, records), timelineOptions, wholeAnswerFor(values), since));
@@ -601,7 +601,7 @@ async function viewOfRun(store, runId, deps, run, read) {
601
601
  const servedAnswer = (text) => (text ? servedOnce(store, runId, text, values, run.since) : text);
602
602
  const finalAnswer = row.kind === "workflow" || unshown ? null : answerOf(run.rows) ?? row.summary ?? null;
603
603
  // A workflow run's output, as its end kept it; an agentic run's, its final answer's structured part when its agent has
604
- // an output schema and the answer's last fenced json block meets it (storeRunOf's `structured`), else none. Served as
604
+ // an output schema and the answer's json block (answer-json.ts jsonBlockOf) meets it (storeRunOf's `structured`), else none. Served as
605
605
  // runs.ts serves it (servedOutput): each string in it cut of the values the run holds, its shape kept; none while the
606
606
  // run's sign-in can't be read back.
607
607
  const ownOutput = row.kind === "workflow" ? output : status === "completed" && structured && "value" in structured ? structured.value : null;
@@ -788,7 +788,7 @@ export async function factsOverStore(store, runId, deps) {
788
788
  }
789
789
  /** A run's live moment from the store (momentOf), for the one acceptance each act a run takes reads. A run no runner holds
790
790
  * (ended, or running with no live claim) reads live false. */
791
- export async function momentOverStore(store, runId, deps = { origin: "", serverSecrets: () => [] }) {
791
+ export async function momentOverStore(store, runId, deps = { origin: "", serverSecrets: () => [], sealKey: undefined }) {
792
792
  const run = await storeRunOf(store, runId, deps);
793
793
  if (!run)
794
794
  return undefined;
@@ -18,6 +18,7 @@
18
18
  // server's, made when a person presses Create, and its token is never the run's. Decisions are kept in the store's
19
19
  // settings (suggestions.item.<id>, suggestions.scan.<repo>), so every server on one store sees the same list.
20
20
  import { createHash, randomUUID } from "node:crypto";
21
+ import { API_KEYS_PAGE } from "./api-keys.js";
21
22
  import { ApiError, invalid } from "./errors.js";
22
23
  import { githubCall } from "./github.js";
23
24
  import { deleteBranch, GithubWriteRefused, openPull, pushFiles } from "./github-pull-request.js";
@@ -271,7 +272,7 @@ function header(s, repo, commit, mark) {
271
272
  `wire it in at ${oneLine(s.integration.call_site.path)}:${s.integration.call_site.line}. ${oneLine(s.integration.call_site.note)}`,
272
273
  "",
273
274
  "Configure in the app's environment (never commit the key):",
274
- ...[["AGENTRUN_URL", "the AgentRun server, like https://agentrun.example.com"], ["AGENTRUN_API_KEY", "an API key of that server"], [agentVariable(s.key), "the agent's id there (the pull request that added this file names it)"]].map(([name, what], _, all) => ` ${name.padEnd(Math.max(...all.map(([n]) => n.length)) + 2)}${what}`),
275
+ ...[["AGENTRUN_URL", "the AgentRun server, like https://agentrun.example.com"], ["AGENTRUN_API_KEY", "an API key of that server (make one in its console: Settings > AgentRun API keys)"], [agentVariable(s.key), "the agent's id there (the pull request that added this file names it)"]].map(([name, what], _, all) => ` ${name.padEnd(Math.max(...all.map(([n]) => n.length)) + 2)}${what}`),
275
276
  ];
276
277
  return lines.map((line) => (line ? `${mark} ${line}` : mark)).join("\n");
277
278
  }
@@ -443,7 +444,7 @@ The app's own code is not changed: nothing calls the agent until you wire it in.
443
444
  | Variable | Value |
444
445
  | --- | --- |
445
446
  | \`AGENTRUN_URL\` | ${at.publicUrl ? `\`${at.publicUrl}\`` : "your AgentRun server's address"} |
446
- | \`AGENTRUN_API_KEY\` | an API key of that server: keep it in your secrets, never in the repository |
447
+ | \`AGENTRUN_API_KEY\` | an API key of that server, made in its console under ${at.publicUrl ? `[Settings → AgentRun API keys](${at.publicUrl.replace(/\/+$/, "")}${API_KEYS_PAGE})` : "Settings → AgentRun API keys"} and shown once: keep it in your secrets, never in the repository |
447
448
  | \`${agentVariable(s.key)}\` | \`${at.agentId}\` |
448
449
 
449
450
  The agent is already made on the AgentRun server as \`${at.agentId}\`, from these same files: try it there before you merge.
@@ -18,8 +18,8 @@ export declare const GRADER_CAP_USD = 0.5;
18
18
  export declare const GRADER_PROMPT_MAX = 120000;
19
19
  /** How long one run may take before the eval cancels it and fails it. */
20
20
  export declare const RUN_TIMEOUT_MS: number;
21
- /** How long a run may stay queued, no runner having taken it, before the eval stops waiting on it: it fails by that
22
- * name, its state when the wait gave up, never by the run's whole timeout. */
21
+ /** How long a run may stay queued, no runner holding it, before the eval stops waiting on it: it fails by that name,
22
+ * never by the run's whole timeout. 5 minutes: a busy machine's runner can be slow to make its first claim. */
23
23
  export declare const QUEUE_TIMEOUT_MS: number;
24
24
  export declare const GRADER_NAME = "Template eval grader";
25
25
  /** The folder under TMPDIR where local evals keep the one install of each harness's pin they all share. */
@@ -67,8 +67,9 @@ export type Grader = ({
67
67
  /** An email case's layouts this grader grades the runs of; absent, every run. */
68
68
  layouts?: Layout[];
69
69
  };
70
- /** One answer of a fake tool: taken when every argument `when` lists equals the call's; `when` a list, when any one of
71
- * its entries does (one answer for each spelling of a call: a file by `sha` or by `ref`, say). */
70
+ /** One answer of a fake tool: taken when every argument `when` lists equals the call's, or, listed as `{"$pattern":
71
+ * <regex>}`, is a string the regex matches whole; `when` a list, when any one of its entries does (one answer for each
72
+ * spelling of a call: a file by `sha` or by `ref`, say). */
72
73
  type Answer = {
73
74
  when: Json | Json[];
74
75
  result: Json;
@@ -139,6 +140,9 @@ export type EvalCase = {
139
140
  /** The case's previous runs (eval-previous.ts): each run's agent gets them seeded as completed runs of the package's
140
141
  * schedule trigger, which then starts the run as it would, handing it the last one's result. */
141
142
  previous?: PreviousFixture;
143
+ /** The files each run's work folder holds before its first turn (`files:`, a path in the folder to its text): the eval's
144
+ * own runner writes them at the claim (EvalFakes.files), so a case can start where an earlier run left off. */
145
+ files?: Record<string, string>;
142
146
  };
143
147
  /** Cases that do not check: every problem, each naming its file. */
144
148
  export declare class CaseError extends Error {
@@ -164,9 +168,11 @@ export type ToolCall = {
164
168
  result?: string | null;
165
169
  arguments?: Json;
166
170
  };
167
- /** A file a run left in its work folder: its path, its size in bytes and, for a text file read whole, its text. */
171
+ /** A file a run left in its work folder, as a grader is told of it: its name (its path under the run's cut, the listing's
172
+ * `name`; absent from a server that doesn't cut its listing's names, when the file is shown by no name, never its path),
173
+ * its size in bytes and, for a text file read whole, its text. */
168
174
  export type FinalFile = {
169
- path: string;
175
+ name?: string;
170
176
  bytes: number;
171
177
  text?: string;
172
178
  };
@@ -229,9 +235,10 @@ export declare function fitCalls(lines: readonly {
229
235
  /** A run's final files in at most `room` characters: each text file in a <file> block, whole when they all fit; else each
230
236
  * text past a length L keeps its head and tail with its middle cut and marked, L the longest that fits (so the largest
231
237
  * is cut first); else every text left out. A file with no text (media, a binary, one past what was read) is named with
232
- * its size on a last line, cut to the room when even that passes it. */
238
+ * its size on a last line, cut to the room when even that passes it. Each file is named by its cut name alone: one with
239
+ * none is in a block with no path, or counted. */
233
240
  export declare function fitFiles(files: readonly FinalFile[], room: number): string;
234
- /** A grader run's answer read as its verdict: the last json block's (else the last JSON object's) {pass, reason}. */
241
+ /** A grader run's answer read as its verdict: its json block's (jsonBlockOf), else the last flat JSON object's, {pass, reason}. */
235
242
  export declare function verdictOf(answer: string): {
236
243
  pass: boolean;
237
244
  reason: string;
@@ -262,16 +269,20 @@ export type Api = (method: string, path: string, body?: unknown, headers?: Recor
262
269
  export declare function apiOf(baseUrl: string, token: string): Api;
263
270
  /** How long the run read that asks whether a runner holds a queued run may take. */
264
271
  export declare const CLAIM_READ_TIMEOUT_MS = 10000;
272
+ /** The least time between two of those reads of one run. */
273
+ export declare const CLAIM_READ_EVERY_MS = 5000;
265
274
  /** A run's tool calls, each named as a grader names it: the gate's own rule (RunGate.enter), its settings key, but a
266
275
  * shell tool held to bash's setting (bash_background, bash_output, ...) keeps its own name, so its grader sees it. A
267
276
  * call on a saved server `toolkits` names ({<saved server>: <the package's toolkit>}, a need an owner's server filled
268
277
  * under another name) is named on the package's toolkit, as the package's graders name it. Each with its arguments and
269
- * its output's head as the rows of a calls=whole read carry them (tool_input, tool_result_text), else its previews. */
278
+ * its output as the rows of a calls=whole read carry them (tool_input, tool_result_text), else its previews. */
270
279
  export declare function callsOf(rows: readonly Json[], harness: string, toolkits?: Readonly<Record<string, string>>): ToolCall[];
271
- /** A file of a run's work folder as its listing names it: its size, its type (null for an extension the server does not
272
- * type) and whether the server could read it. */
280
+ /** A file of a run's work folder as its listing names it: its path (for this eval's own reads, never a grader's prompt),
281
+ * its name under the run's cut (the listing's `name`, absent from a server that doesn't cut it), its size, its type
282
+ * (null for an extension the server does not type) and whether the server could read it. */
273
283
  export type Listed = {
274
284
  path: string;
285
+ name?: string;
275
286
  bytes: number;
276
287
  type: string | null;
277
288
  unreadable: boolean;