@parcha/agentrun-serve 0.1.0-beta.56 → 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 (275) hide show
  1. package/CHANGELOG.md +229 -0
  2. package/README.md +201 -52
  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 +17 -5
  11. package/dist/api-only.js +34 -8
  12. package/dist/browser-hold.d.ts +23 -0
  13. package/dist/browser-hold.js +48 -0
  14. package/dist/browser-person.d.ts +3 -0
  15. package/dist/browser-person.js +4 -1
  16. package/dist/chatgpt-plan.d.ts +18 -8
  17. package/dist/chatgpt-plan.js +91 -34
  18. package/dist/claude-login.d.ts +74 -16
  19. package/dist/claude-login.js +215 -56
  20. package/dist/claude-sign-in.d.ts +17 -6
  21. package/dist/claude-sign-in.js +42 -39
  22. package/dist/cli.js +63 -6
  23. package/dist/composio-made.d.ts +4 -0
  24. package/dist/composio-made.js +4 -0
  25. package/dist/composio-preset.d.ts +43 -2
  26. package/dist/composio-preset.js +92 -4
  27. package/dist/computer-held-routes.d.ts +5 -4
  28. package/dist/computer-held-routes.js +29 -8
  29. package/dist/computer-held.d.ts +6 -1
  30. package/dist/computer-held.js +14 -0
  31. package/dist/computer-record.js +4 -2
  32. package/dist/computer-viewer.js +4 -1
  33. package/dist/console/assets/{backend-Boh7tC4i.js → backend-DVhHzJX2.js} +19 -19
  34. package/dist/console/assets/index-Bwn1oTem.css +1 -0
  35. package/dist/console/assets/index-okP-y8PK.js +747 -0
  36. package/dist/console/index.html +2 -2
  37. package/dist/decisions.d.ts +1 -1
  38. package/dist/decisions.js +1 -1
  39. package/dist/docker-host-addresses.d.ts +22 -11
  40. package/dist/docker-host-addresses.js +38 -26
  41. package/dist/env-switch.d.ts +10 -0
  42. package/dist/env-switch.js +33 -2
  43. package/dist/errors.d.ts +1 -0
  44. package/dist/errors.js +2 -0
  45. package/dist/fal-price.d.ts +58 -20
  46. package/dist/fal-price.js +341 -82
  47. package/dist/handed-values.d.ts +43 -1
  48. package/dist/handed-values.js +119 -2
  49. package/dist/harness-archive.d.ts +13 -10
  50. package/dist/harness-archive.js +60 -34
  51. package/dist/harness-check.d.ts +3 -1
  52. package/dist/harness-check.js +25 -46
  53. package/dist/harness-keys.d.ts +73 -27
  54. package/dist/harness-keys.js +194 -61
  55. package/dist/harness-recipe-entry.d.ts +8 -7
  56. package/dist/harness-recipe-entry.js +21 -32
  57. package/dist/harness-recipe.d.ts +38 -25
  58. package/dist/harness-recipe.js +49 -36
  59. package/dist/harness-sign-in.js +12 -23
  60. package/dist/harness-table.d.ts +10 -3
  61. package/dist/harness-table.js +26 -21
  62. package/dist/harness.d.ts +1 -0
  63. package/dist/harness.js +17 -5
  64. package/dist/hosted-search.d.ts +1 -1
  65. package/dist/hosted-search.js +1 -2
  66. package/dist/import-worker.d.ts +4 -2
  67. package/dist/import-worker.js +9 -2
  68. package/dist/in-flight.d.ts +26 -0
  69. package/dist/in-flight.js +52 -0
  70. package/dist/key-refusal.d.ts +9 -4
  71. package/dist/key-refusal.js +107 -25
  72. package/dist/learn/secrets.d.ts +13 -3
  73. package/dist/learn/secrets.js +118 -17
  74. package/dist/learning-cost.d.ts +6 -3
  75. package/dist/learning-cost.js +4 -2
  76. package/dist/link-check.js +1 -1
  77. package/dist/llms.txt +1 -1
  78. package/dist/marketplace.d.ts +77 -0
  79. package/dist/marketplace.js +224 -0
  80. package/dist/mcp-api-only-origins.d.ts +30 -0
  81. package/dist/mcp-api-only-origins.js +57 -0
  82. package/dist/mcp-gateway.d.ts +7 -5
  83. package/dist/mcp-gateway.js +9 -12
  84. package/dist/mcp-secret-writes.js +5 -3
  85. package/dist/mcp-servers-store.d.ts +28 -6
  86. package/dist/mcp-servers-store.js +53 -4
  87. package/dist/media-duration.d.ts +3 -0
  88. package/dist/media-duration.js +90 -9
  89. package/dist/model-form.d.ts +5 -4
  90. package/dist/model-form.js +11 -7
  91. package/dist/model.d.ts +5 -2
  92. package/dist/model.js +9 -5
  93. package/dist/ollama-provider.d.ts +7 -1
  94. package/dist/ollama-provider.js +14 -2
  95. package/dist/openapi.js +178 -27
  96. package/dist/otel/genai.d.ts +65 -0
  97. package/dist/otel/genai.js +116 -0
  98. package/dist/otel/tracer.d.ts +55 -0
  99. package/dist/otel/tracer.js +308 -0
  100. package/dist/page.d.ts +2 -0
  101. package/dist/page.js +3 -1
  102. package/dist/paid-calls.d.ts +1 -32
  103. package/dist/paid-calls.js +4 -39
  104. package/dist/provider.d.ts +9 -0
  105. package/dist/provider.js +50 -3
  106. package/dist/redact/match.d.ts +30 -3
  107. package/dist/redact/match.js +422 -41
  108. package/dist/refusal-words.d.ts +11 -0
  109. package/dist/refusal-words.js +11 -0
  110. package/dist/run-census.d.ts +67 -0
  111. package/dist/run-census.js +240 -0
  112. package/dist/run-computer.d.ts +6 -3
  113. package/dist/run-computer.js +4 -1
  114. package/dist/run-cut.d.ts +15 -6
  115. package/dist/run-cut.js +30 -9
  116. package/dist/run-files.d.ts +3 -0
  117. package/dist/run-files.js +3 -0
  118. package/dist/run-launch.d.ts +12 -1
  119. package/dist/run-launch.js +9 -10
  120. package/dist/run-learning-served.d.ts +2 -0
  121. package/dist/run-model-key.d.ts +8 -0
  122. package/dist/run-model-key.js +31 -1
  123. package/dist/run-reads-over-store.d.ts +24 -6
  124. package/dist/run-reads-over-store.js +67 -23
  125. package/dist/run-recordings.d.ts +5 -1
  126. package/dist/run-recordings.js +39 -14
  127. package/dist/run-timeline-served.d.ts +2 -0
  128. package/dist/run-timeline-served.js +2 -2
  129. package/dist/run-usage.d.ts +1 -0
  130. package/dist/runnable.d.ts +10 -1
  131. package/dist/runnable.js +20 -8
  132. package/dist/runner/adapter-loop.d.ts +11 -0
  133. package/dist/runner/adapter-loop.js +55 -10
  134. package/dist/runner/adapter-run-spec.d.ts +45 -8
  135. package/dist/runner/adapter-run-spec.js +150 -28
  136. package/dist/runner/adapters/pi.js +25 -3
  137. package/dist/runner/beside.js +4 -3
  138. package/dist/runner/big-writes.js +1 -10
  139. package/dist/runner/claim-secrets.d.ts +18 -3
  140. package/dist/runner/claim-secrets.js +35 -6
  141. package/dist/runner/cli-run-spec.d.ts +6 -0
  142. package/dist/runner/cli-run-spec.js +82 -35
  143. package/dist/runner/computer-journal.d.ts +9 -1
  144. package/dist/runner/computer-journal.js +26 -0
  145. package/dist/runner/conformance/harness.js +1 -1
  146. package/dist/runner/feedback-round.js +3 -0
  147. package/dist/runner/harness-loops.d.ts +6 -5
  148. package/dist/runner/harness-loops.js +7 -7
  149. package/dist/runner/held.d.ts +11 -5
  150. package/dist/runner/journal-kinds.d.ts +5 -0
  151. package/dist/runner/journal-kinds.js +5 -0
  152. package/dist/runner/main.js +7 -2
  153. package/dist/runner/mcp-claim.js +30 -3
  154. package/dist/runner/mcp-run.d.ts +12 -0
  155. package/dist/runner/mcp-run.js +12 -5
  156. package/dist/runner/model-route.d.ts +17 -0
  157. package/dist/runner/model-route.js +120 -2
  158. package/dist/runner/run-child-host.d.ts +3 -0
  159. package/dist/runner/run-child-host.js +69 -28
  160. package/dist/runner/run-child.js +5 -2
  161. package/dist/runner/runner.d.ts +14 -3
  162. package/dist/runner/runner.js +129 -33
  163. package/dist/runner/store-port.d.ts +1 -1
  164. package/dist/runner/store-secrets.d.ts +6 -0
  165. package/dist/runner/store-secrets.js +49 -7
  166. package/dist/runner/subagent.js +4 -40
  167. package/dist/runner/workflow-first.d.ts +11 -4
  168. package/dist/runner/workflow-first.js +14 -8
  169. package/dist/runner/workflow-spec.js +3 -2
  170. package/dist/runs-over-store.d.ts +15 -6
  171. package/dist/runs-over-store.js +33 -21
  172. package/dist/scrub-command.d.ts +73 -0
  173. package/dist/scrub-command.js +307 -0
  174. package/dist/secret-cut.d.ts +73 -0
  175. package/dist/secret-cut.js +291 -4
  176. package/dist/secret-rules.d.ts +143 -0
  177. package/dist/secret-rules.js +2564 -0
  178. package/dist/secrets.d.ts +7 -0
  179. package/dist/secrets.js +20 -0
  180. package/dist/server-keys.d.ts +20 -0
  181. package/dist/server-keys.js +25 -6
  182. package/dist/server.d.ts +52 -11
  183. package/dist/server.js +345 -118
  184. package/dist/skills/agentrun-serve/SKILL.md +4 -0
  185. package/dist/store/index.d.ts +1 -1
  186. package/dist/store/index.js +1 -1
  187. package/dist/store/journal/storage.js +1 -1
  188. package/dist/store/postgres/migrations/0027_run_launch_census.sql +31 -0
  189. package/dist/store/schema.d.ts +6 -0
  190. package/dist/store/schema.js +11 -1
  191. package/dist/store/seal.d.ts +6 -1
  192. package/dist/store/seal.js +5 -3
  193. package/dist/store/sqlite/run-launch.d.ts +9 -1
  194. package/dist/store/sqlite/run-launch.js +24 -13
  195. package/dist/store/sqlite/run-patch.d.ts +1 -1
  196. package/dist/store/sqlite/run-patch.js +13 -4
  197. package/dist/store/sqlite/store.js +34 -4
  198. package/dist/store/store.d.ts +43 -2
  199. package/dist/store/store.js +20 -0
  200. package/dist/store-reads/learning.d.ts +6 -3
  201. package/dist/store-reads/learning.js +22 -7
  202. package/dist/store-view.d.ts +3 -0
  203. package/dist/store-view.js +3 -3
  204. package/dist/suggestions.js +3 -2
  205. package/dist/template-eval.d.ts +20 -9
  206. package/dist/template-eval.js +115 -33
  207. package/dist/template-import.d.ts +10 -0
  208. package/dist/template-import.js +16 -7
  209. package/dist/templates.d.ts +10 -2
  210. package/dist/templates.js +28 -8
  211. package/dist/timeline/labels.d.ts +6 -4
  212. package/dist/timeline/labels.js +18 -6
  213. package/dist/timeline/timeline.d.ts +5 -0
  214. package/dist/timeline/timeline.js +14 -8
  215. package/dist/timeline/util.js +1 -1
  216. package/dist/timeline/web-calls.d.ts +26 -9
  217. package/dist/timeline/web-calls.js +124 -37
  218. package/dist/tool-gate.d.ts +42 -3
  219. package/dist/tool-gate.js +66 -5
  220. package/dist/tool-keys-store.d.ts +2 -4
  221. package/dist/tool-keys-store.js +5 -21
  222. package/dist/tool-keys.d.ts +2 -2
  223. package/dist/tool-keys.js +2 -2
  224. package/dist/tool-list.js +1 -1
  225. package/dist/tool-plane.d.ts +2 -2
  226. package/dist/tool-plane.js +35 -33
  227. package/dist/tools.js +13 -7
  228. package/dist/trigger-targets.d.ts +4 -0
  229. package/dist/trigger-targets.js +9 -2
  230. package/dist/triggers.d.ts +67 -4
  231. package/dist/triggers.js +171 -22
  232. package/dist/until.d.ts +3 -0
  233. package/dist/until.js +11 -0
  234. package/dist/web-fake.d.ts +1 -3
  235. package/dist/web-fake.js +7 -18
  236. package/dist/web-fetch.d.ts +6 -72
  237. package/dist/web-fetch.js +11 -265
  238. package/dist/web-run.d.ts +31 -0
  239. package/dist/web-run.js +90 -0
  240. package/dist/web-save.d.ts +6 -4
  241. package/dist/web-save.js +9 -12
  242. package/dist/web-search.d.ts +9 -127
  243. package/dist/web-search.js +23 -259
  244. package/dist/wires.d.ts +13 -0
  245. package/dist/wires.js +11 -0
  246. package/dist/workflow-run.d.ts +5 -4
  247. package/dist/workflow-run.js +5 -4
  248. package/dist/workspace/computer-deps.d.ts +2 -1
  249. package/dist/workspace/computer-deps.js +9 -2
  250. package/dist/workspace/computer-for-claim.d.ts +12 -1
  251. package/dist/workspace/computer-for-claim.js +77 -8
  252. package/dist/workspace/computer-kept.d.ts +3 -0
  253. package/dist/workspace/computer-kept.js +11 -2
  254. package/dist/workspace/index.d.ts +1 -1
  255. package/dist/workspace/index.js +1 -1
  256. package/dist/workspace/kind-skills.d.ts +4 -0
  257. package/dist/workspace/kind-skills.js +9 -0
  258. package/dist/workspace/synced-folder.js +3 -4
  259. package/dist/wrapped.d.ts +13 -5
  260. package/dist/wrapped.js +52 -26
  261. package/package.json +17 -11
  262. package/skills/agentrun-serve/SKILL.md +4 -0
  263. package/templates/README.md +30 -8
  264. package/dist/console/assets/index-CQ3cJRzI.js +0 -746
  265. package/dist/console/assets/index-DKkaS3a0.css +0 -1
  266. package/dist/exa-keyless.d.ts +0 -34
  267. package/dist/exa-keyless.js +0 -118
  268. package/dist/firecrawl-keyless.d.ts +0 -41
  269. package/dist/firecrawl-keyless.js +0 -152
  270. package/dist/keyless-mcp.d.ts +0 -36
  271. package/dist/keyless-mcp.js +0 -127
  272. package/dist/text-urls.d.ts +0 -38
  273. package/dist/text-urls.js +0 -170
  274. package/dist/web-fetch-direct.d.ts +0 -119
  275. package/dist/web-fetch-direct.js +0 -190
@@ -55,9 +55,12 @@ import { pairedProvider, withPaired } from "./attached-computers.js";
55
55
  import { computerHold, heldHands } from "./computer-hold.js";
56
56
  import { endingDeletes, figuresOf, intervalWrites } from "./computer-intervals.js";
57
57
  import { computeMeter } from "../compute-cost.js";
58
- import { deleteKept, endKept, KEEP_MS, keptBy, pinnedOf, readKept, takeKept, writeKept } from "./computer-kept.js";
58
+ import { bounded, deleteKept, endKept, KEEP_MS, KEPT_DELETE_MS, keptBy, pinnedOf, readKept, takeKept, writeKept } from "./computer-kept.js";
59
59
  import { storeLedger } from "./computer-ledger.js";
60
- import { providerKeys, registryHere, resolveComputer } from "./resolve-computer.js";
60
+ import { providerKeys, registryHere, resolveComputer, runShellOf } from "./resolve-computer.js";
61
+ import { computerDenied } from "../tool-gate.js";
62
+ import { loadToolSettings } from "../tool-plane.js";
63
+ import { computerDeniedWords, computerStillOffWords } from "../refusal-words.js";
61
64
  import { claimHolds, fencedStore, holdSynced, storedFolder } from "./synced-folder.js";
62
65
  /** A computer that cannot be had, with the code the run fails with and the server's words. */
63
66
  const unavailable = (words) => Object.assign(new Error(words), { code: "computer_unavailable" });
@@ -94,6 +97,20 @@ export async function settingOf(launch, store) {
94
97
  return computerOfPlace(body.place);
95
98
  return launch.place ? computerOfPlace(launch.place) : undefined;
96
99
  }
100
+ /** The kind of the claim's computer `setting` when every tool it serves the run is set to deny (tool-gate.ts
101
+ * computerDenied): the revision's grants and tool settings over the server's, as the run's gate reads them. `shell`: where
102
+ * the run's shell would be with it. A store with no settings, or settings that do not read, deny nothing. */
103
+ async function deniedKind(launch, setting, store, shell) {
104
+ if (setting.kind === "none" || !store.settings || !launch.revisionId)
105
+ return undefined;
106
+ const revision = await store.agents.revision(launch.revisionId);
107
+ if (!revision || revision.kind !== "agentic")
108
+ return undefined;
109
+ const server = await loadToolSettings({ settings: store.settings }).catch(() => undefined);
110
+ if (!server || server.unreadable)
111
+ return undefined;
112
+ return computerDenied({ kind: revision.kind, body: { ...revision.body, computer: setting } }, shell, server);
113
+ }
97
114
  /** A phone's platform: what the phone says it is, else its provider's phone configuration's machine kind; android when
98
115
  * neither says ios. */
99
116
  function phonePlatform(machine, entry) {
@@ -442,13 +459,14 @@ function lostAware(first, renewal) {
442
459
  },
443
460
  };
444
461
  }
445
- /** The computer an earlier claim of the run kept at its park (`kept`), attached again through `provider` and connected,
446
- * or undefined when its provider no longer has it or it does not connect (one that does not is deleted). */
462
+ /** The computer an earlier claim of the run kept at its park (`kept`), attached again through `provider` and connected;
463
+ * `refused`, the provider's words, when it refuses to attach it; or undefined when its provider no longer has it or it
464
+ * does not connect (one that does not is deleted). */
447
465
  async function keptLaunch(provider, kept, signal, ended) {
448
466
  const ref = { id: kept.id, name: kept.name };
449
467
  const found = await provider.attach({ id: ref.id }, signal ? { signal } : {});
450
468
  if (!found.ok)
451
- return undefined;
469
+ return found.error.code === "refused" ? { refused: found.error.message } : undefined;
452
470
  const connected = await provider.connect(ref);
453
471
  if (!connected.ok) {
454
472
  const released = await provider.release(ref, "delete").catch(() => undefined);
@@ -657,6 +675,8 @@ store, deps) {
657
675
  /** The kept computer was pinned to another runner, gone by this claim, and this claim could not reach it: the new one
658
676
  * says so (Replaced.lost). */
659
677
  let lost = false;
678
+ /** The kept computer's provider refused to attach it again, in these words: the new one says why (Replaced.refused). */
679
+ let refused;
660
680
  /** What a park of this claim keeps (ClaimComputer.park): a desktop, a phone or a sandbox it made through its provider, or took
661
681
  * back, with its provider, its connection's close and the claim epoch its labels carry; `pinned`: only this runner can
662
682
  * reach it again (computer-kept.ts pinnedOf), so the park names this claim's holder on its row. */
@@ -793,8 +813,9 @@ store, deps) {
793
813
  }
794
814
  const provider = await vendorProvider(entry, keys, configuration);
795
815
  const taken = await keptLaunch(provider, record, signal, () => writes.ended(entry.id, record.id));
796
- if (!taken) {
816
+ if (!taken || "refused" in taken) {
797
817
  lost = elsewhere;
818
+ refused = taken?.refused;
798
819
  return undefined;
799
820
  }
800
821
  // Metered again from here, with what its interval says it was made with: the time it was kept is no claim's.
@@ -881,8 +902,8 @@ store, deps) {
881
902
  ownKind = kind;
882
903
  if (!pairedRow && (kind === "desktop" || kind === "phone" || kind === "sandbox"))
883
904
  keepable = { provider, entry: entry.id, kind, computer: held, pinned: pinnedHere(entry, configuration), epoch: launch.epoch };
884
- if (!pairedRow && (releasedOlder || journalSays || lost))
885
- replaced = { kind: kind, folderKept: deps.mode === 2 && mount !== undefined, ...(lost ? { lost: true } : lapsed ? { lapsed: true } : {}) };
905
+ if (!pairedRow && (releasedOlder || journalSays || lost || refused !== undefined))
906
+ replaced = { kind: kind, folderKept: deps.mode === 2 && mount !== undefined, ...(lost ? { lost: true } : lapsed ? { lapsed: true } : {}), ...(refused !== undefined ? { refused } : {}) };
886
907
  }
887
908
  made = { id: launched.id, machine: launched.machine, ...(launched.watch ? { watch: launched.watch, ...(kind === "desktop" || kind === "phone" ? { gone: goneOf(provider, launched.id, listedUnder, kind) } : {}) } : {}) };
888
909
  madeBy = entry;
@@ -891,6 +912,46 @@ store, deps) {
891
912
  return launched;
892
913
  },
893
914
  };
915
+ /** The computer an earlier claim kept at the run's park, ended now by a claim that starts none (the run's computer is
916
+ * off): deleted, its interval ended, and its mount credential, the parking claim's, taken on and removed
917
+ * (archil-claim.ts revoke removes only one its claim minted or took on), so the run's folder is its own again before
918
+ * its tools touch it. The credential is taken on only once this claim's end holds the row (endKept's compare-and-set):
919
+ * a later claim that took the computer back first holds its mount, which this claim's revoke (at its loss, its end)
920
+ * then never removes. Once taken on, a revoke this claim does not finish here is the run's end's. The delete and the
921
+ * revoke together are bounded (KEPT_DELETE_MS) and end at the run's stop: one that fails or does not answer leaves the
922
+ * row ending, for the janitor's next pass. Never throws. */
923
+ const endKeptNow = async () => {
924
+ const record = kept;
925
+ kept = undefined;
926
+ const settings = store.settings;
927
+ const entry = record && kinds.PROVIDERS.find((one) => one.id === record.provider);
928
+ if (!record || record.ended || !settings || !entry)
929
+ return;
930
+ try {
931
+ await endKept(settings, launch.runId, record, () => {
932
+ deps.inheritMount?.();
933
+ return bounded(KEPT_DELETE_MS, (async () => {
934
+ try {
935
+ const provider = await vendorProvider(entry, await side.keysOf(entry.id), {});
936
+ if (await deleteKept(provider, record))
937
+ await writes.ended(entry.id, record.id);
938
+ }
939
+ finally {
940
+ await deps.revokeMount?.().catch(() => undefined);
941
+ }
942
+ })(), deps.signal);
943
+ });
944
+ }
945
+ catch {
946
+ // Left ending for the janitor.
947
+ }
948
+ };
949
+ // The run's computer turned off by an earlier claim's deny: none is started, and the one a park kept goes now.
950
+ if (deps.turnedOff) {
951
+ deps.onComputerNote?.(computerStillOffWords(deps.turnedOff));
952
+ await endKeptNow();
953
+ return { computer: undefined, off: true, release: noop };
954
+ }
894
955
  const setting = await settingOf(launch, store);
895
956
  // Programs it needs (computer.needs) are checked in a sandbox's box alone: a setting that needs them and is any other
896
957
  // kind is refused before anything is rented, never run without them.
@@ -899,6 +960,14 @@ store, deps) {
899
960
  const label = setting?.provider ? kinds.PROVIDERS.find((one) => one.id === setting.provider)?.label ?? setting.provider : undefined;
900
961
  throw unavailable(needsNoSandboxWords(needs, setting?.kind === "none" || !setting ? "none" : `a ${setting.kind}${label ? ` on ${label}` : ""}`));
901
962
  }
963
+ // A computer every tool of which is set to deny (tool-gate.ts computerDenied) serves the run nothing: none is started,
964
+ // nothing is rented or checked, and the run goes on without it, its timeline saying why.
965
+ const denied = setting && (await deniedKind(launch, setting, store, runShellOf(setting, deps.mode, kinds)));
966
+ if (denied) {
967
+ deps.onComputerNote?.(computerDeniedWords(denied));
968
+ await endKeptNow();
969
+ return { computer: undefined, off: true, release: noop };
970
+ }
902
971
  const resolved = await resolveComputer(setting, deps.mode, kinds, side);
903
972
  if ("refused" in resolved)
904
973
  throw unavailable(resolved.refused);
@@ -136,3 +136,6 @@ export declare function sweepKept(deps: {
136
136
  * provider's delete answered ok, the one answer that proves its end now (its interval's, computer-intervals.ts); false
137
137
  * for one already gone, whose end is not known. */
138
138
  export declare function deleteKept(provider: Pick<ComputerProvider, "release">, kept: Pick<Kept, "id" | "name">): Promise<boolean>;
139
+ /** `work`, or its timeout in words after `ms`, or `signal`'s abort, whichever is first: a delete that hangs is left to
140
+ * finish on its own. */
141
+ export declare function bounded(ms: number, work: Promise<void>, signal?: AbortSignal): Promise<void>;
@@ -254,17 +254,26 @@ export async function deleteKept(provider, kept) {
254
254
  throw new Error(released.error.message);
255
255
  return released.ok;
256
256
  }
257
- /** `work`, or its timeout in words after `ms`: a delete that hangs is left to finish on its own. */
258
- async function bounded(ms, work) {
257
+ /** `work`, or its timeout in words after `ms`, or `signal`'s abort, whichever is first: a delete that hangs is left to
258
+ * finish on its own. */
259
+ export async function bounded(ms, work, signal) {
259
260
  let timer;
261
+ let stopped;
260
262
  const late = new Promise((_, reject) => {
261
263
  timer = setTimeout(() => reject(new Error(`its delete did not answer within ${ms / 1000} s; the next pass tries again`)), ms);
264
+ stopped = () => reject(new Error("its delete was left at the run's stop; the next pass tries again"));
265
+ if (signal?.aborted)
266
+ stopped();
267
+ else
268
+ signal?.addEventListener("abort", stopped, { once: true });
262
269
  });
263
270
  try {
264
271
  await Promise.race([work, late]);
265
272
  }
266
273
  finally {
267
274
  clearTimeout(timer);
275
+ if (stopped)
276
+ signal?.removeEventListener("abort", stopped);
268
277
  }
269
278
  }
270
279
  const words = (error) => (error instanceof Error ? error.message : String(error));
@@ -24,4 +24,4 @@ export { type ClaimComputer, type ClaimLaunch, computerForClaim, type ComputerFo
24
24
  export { JANITOR_EVERY_MS, type JanitorDeps, type ProviderSweep, startJanitor, sweepServerComputers } from "./computer-janitor.js";
25
25
  export { agentComputerOf, agentComputerView, ownerGoneOf, reconcileAgentComputer, serverIdOf } from "./agent-computer.js";
26
26
  export { layOwnSkills, RUN_SKILLS_DIR } from "./revision-skills.js";
27
- export { KIND_SKILLS, type KindSkill, kindSkillOf, type SkillKind } from "./kind-skills.js";
27
+ export { KIND_SKILLS, type KindSkill, kindSkillOf, type SkillKind, withoutKindSkill } from "./kind-skills.js";
@@ -26,4 +26,4 @@ export { computerForClaim } from "./computer-for-claim.js";
26
26
  export { JANITOR_EVERY_MS, startJanitor, sweepServerComputers } from "./computer-janitor.js";
27
27
  export { agentComputerOf, agentComputerView, ownerGoneOf, reconcileAgentComputer, serverIdOf } from "./agent-computer.js";
28
28
  export { layOwnSkills, RUN_SKILLS_DIR } from "./revision-skills.js";
29
- export { KIND_SKILLS, kindSkillOf } from "./kind-skills.js";
29
+ export { KIND_SKILLS, kindSkillOf, withoutKindSkill } from "./kind-skills.js";
@@ -9,3 +9,7 @@ export type SkillKind = "desktop" | "phone";
9
9
  export declare const KIND_SKILLS: Readonly<Record<SkillKind, KindSkill>>;
10
10
  /** The skill a run's computer kind brings, if it brings one. */
11
11
  export declare const kindSkillOf: (kind: string | undefined) => KindSkill | undefined;
12
+ /** A run's skill files without the one its computer kind brings: for a computer the claim did not start (every tool of
13
+ * it set to deny: ClaimComputer.off), whose skill is named to no one. An authored skill of that name is the agent's own,
14
+ * and stays. */
15
+ export declare function withoutKindSkill(files: readonly string[], authored: Readonly<Record<string, unknown>>, kind: string | undefined): readonly string[];
@@ -14,3 +14,12 @@ const read = (kind) => {
14
14
  export const KIND_SKILLS = Object.freeze({ desktop: read("desktop"), phone: read("phone") });
15
15
  /** The skill a run's computer kind brings, if it brings one. */
16
16
  export const kindSkillOf = (kind) => (kind === "desktop" || kind === "phone" ? KIND_SKILLS[kind] : undefined);
17
+ /** A run's skill files without the one its computer kind brings: for a computer the claim did not start (every tool of
18
+ * it set to deny: ClaimComputer.off), whose skill is named to no one. An authored skill of that name is the agent's own,
19
+ * and stays. */
20
+ export function withoutKindSkill(files, authored, kind) {
21
+ const skill = kindSkillOf(kind);
22
+ if (!skill || Object.keys(authored).some((path) => path.split("/")[0] === skill.name))
23
+ return files;
24
+ return files.filter((file) => file !== `${skill.name}/SKILL.md`);
25
+ }
@@ -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
@@ -47,11 +47,19 @@ export declare function wrappedView(wrapped: Wrapped, imported: readonly {
47
47
  }[];
48
48
  unread_files: number;
49
49
  };
50
- type Read = {
50
+ /** How long GET /v2/wrapped waits for a read before it answers 503 with a retry (the read goes on). */
51
+ export declare const WRAPPED_WAIT_MS = 15000;
52
+ /** A year's wrappedHome over this machine's home, and how many session files it could not read (one gone since it was
53
+ * listed, or one this user cannot open): the numbers are short by those, and say so. */
54
+ export type WrappedRead = {
51
55
  wrapped: Wrapped;
52
56
  unread: number;
53
57
  };
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 {};
58
+ /** `read` (one year's read, on the server's import worker), each year's shared: a read still going, or waiting its turn,
59
+ * is shared however long it takes; once it ends, a year already over when its read began is kept until the server stops
60
+ * (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
61
+ * 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
62
+ * that fails is dropped, so the next ask reads again, and frees the turn. One per server. */
63
+ export declare function keptReads(read: (year: number) => Promise<WrappedRead>): (year: number) => Promise<WrappedRead>;
64
+ /** `read`'s answer if it comes within `ms`, else undefined (the read goes on). */
65
+ export declare function within<T>(read: Promise<T>, ms: number): Promise<T | undefined>;
package/dist/wrapped.js CHANGED
@@ -1,7 +1,3 @@
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
- // package reads), as numbers. The import package's wrappedHome does the reading; this is its answer in the API's words,
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";
5
1
  const total = ({ input, output, cacheRead, cacheWrite }) => input + output + cacheRead + cacheWrite;
6
2
  /** `wrapped` (the import package's) as GET /v2/wrapped serves it, and the runs imported from each source (`imported`). */
7
3
  export function wrappedView(wrapped, imported, unreadFiles = 0) {
@@ -25,27 +21,57 @@ export function wrappedView(wrapped, imported, unreadFiles = 0) {
25
21
  unread_files: unreadFiles,
26
22
  };
27
23
  }
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. */
24
+ /** A read of the current year is kept for a minute after it ends: a whole home is a long read. */
30
25
  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;
26
+ /** How long GET /v2/wrapped waits for a read before it answers 503 with a retry (the read goes on). */
27
+ export const WRAPPED_WAIT_MS = 15_000;
28
+ /** `read` (one year's read, on the server's import worker), each year's shared: a read still going, or waiting its turn,
29
+ * is shared however long it takes; once it ends, a year already over when its read began is kept until the server stops
30
+ * (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
31
+ * 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
32
+ * that fails is dropped, so the next ask reads again, and frees the turn. One per server. */
33
+ export function keptReads(read) {
34
+ const kept = new Map();
35
+ // The read whose turn it is or the last one given a turn, until it ends: the next starts after it.
36
+ let turn;
37
+ const inTurn = (start) => {
38
+ const started = turn ? turn.then(start) : start();
39
+ const mine = started.then(() => undefined, () => undefined);
40
+ turn = mine;
41
+ void mine.then(() => {
42
+ if (turn === mine)
43
+ turn = undefined;
44
+ });
45
+ return started;
46
+ };
47
+ return (year) => {
48
+ const held = kept.get(year);
49
+ const now = Date.now();
50
+ if (held && (held.at === undefined || year < held.began || now - held.at < KEEP_MS))
51
+ return held.read;
52
+ const entry = {};
53
+ entry.read = inTurn(() => {
54
+ entry.began = new Date(Date.now()).getFullYear();
55
+ return read(year);
56
+ });
57
+ kept.set(year, entry);
58
+ entry.read.then(() => {
59
+ entry.at = Date.now();
60
+ }, () => {
61
+ if (kept.get(year) === entry)
62
+ kept.delete(year);
63
+ });
64
+ return entry.read;
65
+ };
66
+ }
67
+ /** `read`'s answer if it comes within `ms`, else undefined (the read goes on). */
68
+ export async function within(read, ms) {
69
+ let timer;
70
+ const late = new Promise((resolve) => void (timer = setTimeout(resolve, ms, undefined)));
71
+ try {
72
+ return await Promise.race([read, late]);
73
+ }
74
+ finally {
75
+ clearTimeout(timer);
76
+ }
51
77
  }
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.57",
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.57",
75
+ "@parcha/agentrun-decisions": "0.1.0-beta.57",
76
+ "@parcha/agentrun-dsl": "0.1.0-beta.57",
77
+ "@parcha/agentrun-harness-acp": "0.1.0-beta.57",
78
+ "@parcha/agentrun-harness-claude": "0.1.0-beta.57",
79
+ "@parcha/agentrun-harness-codex": "0.1.0-beta.57",
80
+ "@parcha/agentrun-import": "0.1.0-beta.57",
81
+ "@parcha/agentrun-jev": "0.1.0-beta.57",
82
+ "@parcha/agentrun-kernel": "0.1.0-beta.57",
83
+ "@parcha/agentrun-web": "0.1.0-beta.57",
84
+ "@parcha/pi-browser": "0.1.0-beta.57",
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,9 +135,11 @@ 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
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
141
143
  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
144
  `--server`. Without it, the real 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
@@ -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. |