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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (312) hide show
  1. package/CHANGELOG.md +281 -0
  2. package/README.md +246 -66
  3. package/dist/acp-package.d.ts +2 -0
  4. package/dist/adapters.d.ts +15 -3
  5. package/dist/adapters.js +17 -6
  6. package/dist/agent-package.d.ts +3 -3
  7. package/dist/agent-package.js +17 -8
  8. package/dist/api-keys.d.ts +76 -0
  9. package/dist/api-keys.js +217 -0
  10. package/dist/api-only.d.ts +15 -5
  11. package/dist/api-only.js +32 -8
  12. package/dist/box-paths.d.ts +4 -3
  13. package/dist/box-paths.js +7 -4
  14. package/dist/browser-hold.d.ts +23 -0
  15. package/dist/browser-hold.js +48 -0
  16. package/dist/browser-person.d.ts +3 -0
  17. package/dist/browser-person.js +4 -1
  18. package/dist/chatgpt-plan.d.ts +18 -8
  19. package/dist/chatgpt-plan.js +91 -34
  20. package/dist/claude-login-token.d.ts +117 -0
  21. package/dist/claude-login-token.js +737 -0
  22. package/dist/claude-login.d.ts +120 -22
  23. package/dist/claude-login.js +347 -63
  24. package/dist/claude-sign-in.d.ts +17 -6
  25. package/dist/claude-sign-in.js +42 -39
  26. package/dist/cli.js +33 -10
  27. package/dist/composio-made.d.ts +4 -0
  28. package/dist/composio-made.js +4 -0
  29. package/dist/composio-preset.d.ts +43 -2
  30. package/dist/composio-preset.js +92 -4
  31. package/dist/computer-attach.d.ts +35 -17
  32. package/dist/computer-attach.js +301 -49
  33. package/dist/computer-held-routes.d.ts +5 -4
  34. package/dist/computer-held-routes.js +29 -8
  35. package/dist/computer-held.d.ts +6 -1
  36. package/dist/computer-held.js +14 -0
  37. package/dist/computer-record.js +4 -2
  38. package/dist/computer-viewer.js +4 -1
  39. package/dist/computers.d.ts +10 -10
  40. package/dist/computers.js +5 -5
  41. package/dist/console/assets/{backend-Boh7tC4i.js → backend-CSAWUqtZ.js} +19 -19
  42. package/dist/console/assets/index-Bwn1oTem.css +1 -0
  43. package/dist/console/assets/index-DPh29cyz.js +747 -0
  44. package/dist/console/index.html +2 -2
  45. package/dist/decisions.d.ts +1 -1
  46. package/dist/decisions.js +1 -1
  47. package/dist/dial-relay.d.ts +25 -4
  48. package/dist/dial-relay.js +129 -1
  49. package/dist/docker-host-addresses.d.ts +22 -11
  50. package/dist/docker-host-addresses.js +38 -26
  51. package/dist/env-switch.d.ts +8 -0
  52. package/dist/env-switch.js +31 -2
  53. package/dist/errors.d.ts +1 -0
  54. package/dist/errors.js +2 -0
  55. package/dist/fal-price.d.ts +56 -20
  56. package/dist/fal-price.js +400 -90
  57. package/dist/handed-values.d.ts +43 -1
  58. package/dist/handed-values.js +119 -2
  59. package/dist/harness-archive.d.ts +13 -10
  60. package/dist/harness-archive.js +60 -34
  61. package/dist/harness-check.d.ts +3 -1
  62. package/dist/harness-check.js +25 -46
  63. package/dist/harness-keys.d.ts +73 -27
  64. package/dist/harness-keys.js +194 -61
  65. package/dist/harness-recipe-entry.d.ts +8 -7
  66. package/dist/harness-recipe-entry.js +21 -32
  67. package/dist/harness-recipe.d.ts +38 -25
  68. package/dist/harness-recipe.js +49 -36
  69. package/dist/harness-sign-in.js +12 -23
  70. package/dist/harness-table.d.ts +10 -3
  71. package/dist/harness-table.js +26 -21
  72. package/dist/harness.d.ts +1 -0
  73. package/dist/harness.js +17 -5
  74. package/dist/hosted-search.d.ts +1 -1
  75. package/dist/hosted-search.js +1 -2
  76. package/dist/import-worker.d.ts +4 -2
  77. package/dist/import-worker.js +9 -2
  78. package/dist/in-flight.d.ts +26 -0
  79. package/dist/in-flight.js +52 -0
  80. package/dist/key-refusal.d.ts +9 -4
  81. package/dist/key-refusal.js +107 -25
  82. package/dist/learn/ledger.d.ts +170 -0
  83. package/dist/learn/ledger.js +218 -0
  84. package/dist/learn/promote.d.ts +3 -3
  85. package/dist/learn/promote.js +1 -1
  86. package/dist/learn/secrets.d.ts +13 -3
  87. package/dist/learn/secrets.js +118 -17
  88. package/dist/learning-cost.d.ts +28 -23
  89. package/dist/learning-cost.js +19 -23
  90. package/dist/link-check.js +1 -1
  91. package/dist/live-reach.d.ts +2 -0
  92. package/dist/live-reach.js +2 -0
  93. package/dist/llms.txt +1 -1
  94. package/dist/marketplace.d.ts +77 -0
  95. package/dist/marketplace.js +224 -0
  96. package/dist/mcp-api-only-origins.d.ts +35 -0
  97. package/dist/mcp-api-only-origins.js +57 -0
  98. package/dist/mcp-gateway.d.ts +7 -5
  99. package/dist/mcp-gateway.js +9 -12
  100. package/dist/mcp-secret-writes.js +5 -3
  101. package/dist/mcp-servers-store.d.ts +28 -6
  102. package/dist/mcp-servers-store.js +53 -4
  103. package/dist/media-duration.d.ts +3 -0
  104. package/dist/media-duration.js +90 -9
  105. package/dist/micro.d.ts +2 -0
  106. package/dist/micro.js +2 -0
  107. package/dist/model-form.d.ts +5 -4
  108. package/dist/model-form.js +11 -7
  109. package/dist/model.d.ts +10 -6
  110. package/dist/model.js +16 -11
  111. package/dist/monid.d.ts +14 -1
  112. package/dist/monid.js +103 -26
  113. package/dist/ollama-provider.d.ts +7 -1
  114. package/dist/ollama-provider.js +14 -2
  115. package/dist/openapi.js +210 -37
  116. package/dist/otel/genai.d.ts +65 -0
  117. package/dist/otel/genai.js +116 -0
  118. package/dist/otel/tracer.d.ts +55 -0
  119. package/dist/otel/tracer.js +308 -0
  120. package/dist/page.d.ts +2 -0
  121. package/dist/page.js +3 -1
  122. package/dist/paid-calls.d.ts +1 -32
  123. package/dist/paid-calls.js +4 -39
  124. package/dist/place-offers.d.ts +4 -0
  125. package/dist/place-offers.js +7 -4
  126. package/dist/provider.d.ts +11 -2
  127. package/dist/provider.js +59 -8
  128. package/dist/redact/match.d.ts +30 -3
  129. package/dist/redact/match.js +422 -41
  130. package/dist/refusal-words.d.ts +11 -0
  131. package/dist/refusal-words.js +11 -0
  132. package/dist/run-census.d.ts +67 -0
  133. package/dist/run-census.js +240 -0
  134. package/dist/run-computer.d.ts +6 -3
  135. package/dist/run-computer.js +4 -1
  136. package/dist/run-cut.d.ts +15 -6
  137. package/dist/run-cut.js +30 -9
  138. package/dist/run-files.d.ts +3 -0
  139. package/dist/run-files.js +3 -0
  140. package/dist/run-launch.d.ts +12 -1
  141. package/dist/run-launch.js +9 -10
  142. package/dist/run-learning-served.d.ts +4 -2
  143. package/dist/run-model-key.d.ts +8 -0
  144. package/dist/run-model-key.js +31 -1
  145. package/dist/run-reads-over-store.d.ts +24 -6
  146. package/dist/run-reads-over-store.js +67 -23
  147. package/dist/run-recordings.d.ts +5 -1
  148. package/dist/run-recordings.js +39 -14
  149. package/dist/run-timeline-served.d.ts +2 -0
  150. package/dist/run-timeline-served.js +2 -2
  151. package/dist/run-usage.d.ts +1 -0
  152. package/dist/run-view.d.ts +1 -2
  153. package/dist/run-view.js +2 -1
  154. package/dist/runnable.d.ts +10 -1
  155. package/dist/runnable.js +20 -8
  156. package/dist/runner/adapter-loop.d.ts +11 -0
  157. package/dist/runner/adapter-loop.js +58 -26
  158. package/dist/runner/adapter-run-spec.d.ts +55 -11
  159. package/dist/runner/adapter-run-spec.js +183 -52
  160. package/dist/runner/adapters/pi.js +25 -3
  161. package/dist/runner/beside.d.ts +9 -2
  162. package/dist/runner/beside.js +27 -9
  163. package/dist/runner/big-writes.js +1 -10
  164. package/dist/runner/claim-secrets.d.ts +27 -10
  165. package/dist/runner/claim-secrets.js +49 -22
  166. package/dist/runner/cli-run-spec.d.ts +6 -0
  167. package/dist/runner/cli-run-spec.js +97 -38
  168. package/dist/runner/computer-journal.d.ts +9 -1
  169. package/dist/runner/computer-journal.js +26 -0
  170. package/dist/runner/conformance/harness.js +1 -1
  171. package/dist/runner/feedback-round.js +3 -0
  172. package/dist/runner/harness-loops.d.ts +6 -5
  173. package/dist/runner/harness-loops.js +7 -7
  174. package/dist/runner/held.d.ts +24 -6
  175. package/dist/runner/journal-kinds.d.ts +5 -0
  176. package/dist/runner/journal-kinds.js +5 -0
  177. package/dist/runner/main.d.ts +11 -6
  178. package/dist/runner/main.js +19 -9
  179. package/dist/runner/mcp-claim.js +31 -3
  180. package/dist/runner/mcp-run.d.ts +9 -0
  181. package/dist/runner/mcp-run.js +11 -5
  182. package/dist/runner/model-route.d.ts +17 -0
  183. package/dist/runner/model-route.js +120 -2
  184. package/dist/runner/presence.d.ts +11 -1
  185. package/dist/runner/presence.js +7 -0
  186. package/dist/runner/reflect-hook.js +1 -1
  187. package/dist/runner/run-child-host.d.ts +22 -8
  188. package/dist/runner/run-child-host.js +128 -41
  189. package/dist/runner/run-child.js +5 -2
  190. package/dist/runner/runner.d.ts +17 -3
  191. package/dist/runner/runner.js +130 -34
  192. package/dist/runner/save-slots.js +2 -1
  193. package/dist/runner/store-port.d.ts +1 -1
  194. package/dist/runner/store-secrets.d.ts +6 -0
  195. package/dist/runner/store-secrets.js +49 -7
  196. package/dist/runner/subagent.d.ts +11 -0
  197. package/dist/runner/subagent.js +16 -38
  198. package/dist/runner/workflow-first.d.ts +35 -15
  199. package/dist/runner/workflow-first.js +38 -25
  200. package/dist/runner/workflow-spec.js +4 -3
  201. package/dist/runs-over-store.d.ts +15 -6
  202. package/dist/runs-over-store.js +33 -21
  203. package/dist/scrub-command.d.ts +73 -0
  204. package/dist/scrub-command.js +307 -0
  205. package/dist/secret-cut.d.ts +73 -0
  206. package/dist/secret-cut.js +291 -4
  207. package/dist/secret-rules.d.ts +143 -0
  208. package/dist/secret-rules.js +2564 -0
  209. package/dist/secrets.d.ts +7 -0
  210. package/dist/secrets.js +20 -0
  211. package/dist/server-keys.d.ts +20 -0
  212. package/dist/server-keys.js +25 -6
  213. package/dist/server.d.ts +65 -13
  214. package/dist/server.js +470 -157
  215. package/dist/skills/agentrun-serve/SKILL.md +4 -0
  216. package/dist/slots.d.ts +9 -0
  217. package/dist/slots.js +45 -0
  218. package/dist/store/index.d.ts +1 -1
  219. package/dist/store/index.js +1 -1
  220. package/dist/store/journal/storage.js +1 -1
  221. package/dist/store/postgres/migrations/0027_run_launch_census.sql +31 -0
  222. package/dist/store/postgres/migrations/0028_learning_ledger.sql +44 -0
  223. package/dist/store/schema.d.ts +23 -0
  224. package/dist/store/schema.js +58 -2
  225. package/dist/store/seal.d.ts +6 -1
  226. package/dist/store/seal.js +5 -3
  227. package/dist/store/sqlite/run-launch.d.ts +9 -1
  228. package/dist/store/sqlite/run-launch.js +24 -13
  229. package/dist/store/sqlite/run-patch.d.ts +12 -2
  230. package/dist/store/sqlite/run-patch.js +42 -5
  231. package/dist/store/sqlite/store.js +105 -12
  232. package/dist/store/store.d.ts +57 -2
  233. package/dist/store/store.js +20 -0
  234. package/dist/store-reads/learning.d.ts +84 -124
  235. package/dist/store-reads/learning.js +210 -274
  236. package/dist/store-view.d.ts +3 -0
  237. package/dist/store-view.js +3 -3
  238. package/dist/suggestions.js +3 -2
  239. package/dist/template-eval.d.ts +39 -9
  240. package/dist/template-eval.js +191 -60
  241. package/dist/template-import.js +6 -2
  242. package/dist/templates.d.ts +10 -2
  243. package/dist/templates.js +28 -8
  244. package/dist/timeline/labels.d.ts +6 -4
  245. package/dist/timeline/labels.js +18 -6
  246. package/dist/timeline/timeline.d.ts +5 -0
  247. package/dist/timeline/timeline.js +14 -8
  248. package/dist/timeline/util.js +1 -1
  249. package/dist/timeline/web-calls.d.ts +22 -7
  250. package/dist/timeline/web-calls.js +106 -35
  251. package/dist/tool-gate.d.ts +42 -3
  252. package/dist/tool-gate.js +66 -5
  253. package/dist/tool-keys-store.d.ts +2 -4
  254. package/dist/tool-keys-store.js +5 -21
  255. package/dist/tool-keys.d.ts +2 -2
  256. package/dist/tool-keys.js +2 -2
  257. package/dist/tool-list.js +1 -1
  258. package/dist/tool-plane.d.ts +2 -2
  259. package/dist/tool-plane.js +35 -33
  260. package/dist/tools.js +13 -7
  261. package/dist/trigger-targets.d.ts +4 -0
  262. package/dist/trigger-targets.js +9 -2
  263. package/dist/triggers.d.ts +67 -4
  264. package/dist/triggers.js +171 -22
  265. package/dist/until.d.ts +3 -0
  266. package/dist/until.js +11 -0
  267. package/dist/web-fake.d.ts +1 -3
  268. package/dist/web-fake.js +7 -18
  269. package/dist/web-fetch.d.ts +6 -72
  270. package/dist/web-fetch.js +11 -265
  271. package/dist/web-run.d.ts +31 -0
  272. package/dist/web-run.js +90 -0
  273. package/dist/web-save.d.ts +10 -13
  274. package/dist/web-save.js +13 -55
  275. package/dist/web-search.d.ts +9 -127
  276. package/dist/web-search.js +23 -259
  277. package/dist/wires.d.ts +13 -0
  278. package/dist/wires.js +11 -0
  279. package/dist/workflow-run.d.ts +5 -4
  280. package/dist/workflow-run.js +5 -4
  281. package/dist/workspace/attached-computers.d.ts +32 -9
  282. package/dist/workspace/attached-computers.js +77 -13
  283. package/dist/workspace/computer-deps.d.ts +8 -2
  284. package/dist/workspace/computer-deps.js +10 -3
  285. package/dist/workspace/computer-for-claim.d.ts +12 -1
  286. package/dist/workspace/computer-for-claim.js +83 -11
  287. package/dist/workspace/computer-kept.d.ts +3 -0
  288. package/dist/workspace/computer-kept.js +11 -2
  289. package/dist/workspace/index.d.ts +1 -1
  290. package/dist/workspace/index.js +1 -1
  291. package/dist/workspace/kind-skills.d.ts +4 -0
  292. package/dist/workspace/kind-skills.js +9 -0
  293. package/dist/workspace/paired-route.d.ts +91 -0
  294. package/dist/workspace/paired-route.js +153 -0
  295. package/dist/workspace/synced-folder.js +3 -4
  296. package/dist/wrapped.d.ts +20 -6
  297. package/dist/wrapped.js +66 -25
  298. package/package.json +17 -11
  299. package/skills/agentrun-serve/SKILL.md +4 -0
  300. package/templates/README.md +32 -10
  301. package/dist/console/assets/index-CQ3cJRzI.js +0 -746
  302. package/dist/console/assets/index-DKkaS3a0.css +0 -1
  303. package/dist/exa-keyless.d.ts +0 -34
  304. package/dist/exa-keyless.js +0 -118
  305. package/dist/firecrawl-keyless.d.ts +0 -41
  306. package/dist/firecrawl-keyless.js +0 -152
  307. package/dist/keyless-mcp.d.ts +0 -36
  308. package/dist/keyless-mcp.js +0 -127
  309. package/dist/text-urls.d.ts +0 -38
  310. package/dist/text-urls.js +0 -170
  311. package/dist/web-fetch-direct.d.ts +0 -119
  312. package/dist/web-fetch-direct.js +0 -190
package/dist/openapi.js CHANGED
@@ -13,6 +13,7 @@ import { EMAIL_SCOPES, PASSWORD_MAX, SCOPED_TOOLS, SEND_CAP } from "./email/name
13
13
  import { PAYLOAD_KEPT_BYTES } from "./trigger-adapter.js";
14
14
  import { TRIGGER_ADAPTERS } from "./trigger-adapters.js";
15
15
  import { CORRECTIONS_CAP } from "./learn/index.js";
16
+ import { API_KEY_NAME_MAX, API_KEY_PREFIX } from "./api-keys.js";
16
17
  import { ERROR_STATUS } from "./errors.js";
17
18
  import { COMPUTER_UNAVAILABLE_CODE } from "./computer-lost.js";
18
19
  import { MAX_NEEDS, NEED_NAME } from "./computer-needs.js";
@@ -23,6 +24,7 @@ import { HOLD_MAX_MINUTES, HOLD_MINUTES } from "./computer-held.js";
23
24
  import { CALL_MS, PROTOCOL_METHODS } from "./computer-channel.js";
24
25
  import { LAUNCH_LOST, SETUP_LOST } from "./files.js";
25
26
  import { HARNESS_ID_PATTERN, HARNESSES } from "./harness.js";
27
+ import { HARNESS_KEY_REENTER } from "./server-keys.js";
26
28
  import { LEARNING_LABEL, LEARNING_MODES, LEARNING_REASONS, LEARNING_STATES, RUN_LEARNING_USE } from "./learning.js";
27
29
  import { AUDIT_DEFAULTS, AUDIT_MAX, REPICK_MAX_CHARS_DEFAULT, REPICK_MAX_CHARS_MAX } from "./learning-setting.js";
28
30
  import { AFTER_STATES, CHEAPER_AFTER_RUNS, COST_CSV_COLUMNS, COST_WINDOW, COST_RUNS_DEFAULT, COST_RUNS_MAX, RUN_PATHS } from "./learning-cost.js";
@@ -56,9 +58,10 @@ import { ATTEMPTS_KEPT, MESSAGE_TYPES, WEBHOOK_EVENTS } from "./webhooks.js";
56
58
  import { SLACK_EVENTS, SLACK_HOST, SLACK_MESSAGE_TYPES } from "./slack.js";
57
59
  import { DEFAULT_SCHEME, SCHEME_NAMES, SIGNATURE_SCHEMES } from "./trigger-signatures.js";
58
60
  import { HOOK_BODY_MS } from "./push-handler.js";
59
- import { CATCHUP_WINDOW_S, DUE_KEPT, MAX_ACTIVE_RUNS, SEEN_KEPT, FAILURES_TO_PAUSE, FIRING_STATUSES, HISTORY_KEPT, MAX_EVERY_S, SOURCE_KINDS, TARGET_KINDS } from "./triggers.js";
61
+ import { CATCHUP_WINDOW_S, DUE_KEPT, MAX_ACTIVE_RUNS, SEEN_KEPT, FAILURES_TO_PAUSE, FIRING_STATUSES, HISTORY_KEPT, MAX_EVERY_S, RELEASE_WORDS_MAX, SOURCE_KINDS, TARGET_KINDS } from "./triggers.js";
60
62
  import { DEFINITION_FIELDS, EXTERNAL_NAME, MODEL_REF } from "./validate.js";
61
63
  import { CATEGORIES, COMPUTER_ENTRIES, GRADER_TYPES, MODEL_TIERS } from "./templates.js";
64
+ import { MARKETPLACE_ENV, MARKETPLACE_LIMITS, MARKETPLACE_RETRY_MS, MARKETPLACE_TTL_MS, MARKETPLACE_URL } from "./marketplace.js";
62
65
  import { EXPORT_NOTE_KINDS } from "./agent-package.js";
63
66
  import { MCP_SOURCES } from "./mcp-sources.js";
64
67
  import { NOT_SET_UP } from "./runnable.js";
@@ -69,6 +72,7 @@ import { tableTools } from "./tool-list.js";
69
72
  import { SECRET_META_SCHEMA } from "./secret-writes.js";
70
73
  import { LABEL_KEY, MAX_LABEL_VALUE, MAX_LABELS } from "./run-labels.js";
71
74
  import { COST_BASES } from "./runner/metrics.js";
75
+ import { PAST_RUNS } from "./runner/workflow-first.js";
72
76
  import { BASH_POLICIES } from "./bash-read-only.js";
73
77
  // The modules that own the computer and Archil key writes: loading the document loads their secret-write predicates
74
78
  // (secret-writes.ts registerSecretWrite), so every operation the document marks has its predicate wherever it is read.
@@ -92,6 +96,13 @@ const LABEL_PARAMETER = {
92
96
  schema: { type: "string" },
93
97
  "x-agentrun-serve": "runlabels/1",
94
98
  };
99
+ /** runsource/1: GET /runs' filter on where a run came from. */
100
+ const SOURCE_PARAMETER = {
101
+ name: "source", in: "query", required: false,
102
+ description: "Only runs imported from this source, a source's name as the run's `imported_from.source` holds it (`claude-code`, `codex`, ...), or `live` for the runs made here, not imported. A name no run holds lists none. Once per request; a second `source`, or one that does not read as a name, is 400.",
103
+ schema: { type: "string" },
104
+ "x-agentrun-serve": "runsource/1",
105
+ };
95
106
  /** Why each capability this server turns off answers 501, by the route's capability. */
96
107
  export const UNSUPPORTED = {
97
108
  quotes: "This server has no billing, so it gives no quotes.",
@@ -150,8 +161,8 @@ const WRAPPED = closed({
150
161
  hours: { type: "array", minItems: 24, maxItems: 24, items: COUNT, description: "Requests by local hour of the day." },
151
162
  weekdays: { type: "array", minItems: 7, maxItems: 7, items: COUNT, description: "Requests by local weekday, Sunday first." },
152
163
  active_ms: { ...COUNT, description: "Time at work: the gaps between a session's requests, each counted when under 15 minutes." },
153
- harnesses: { type: "array", items: closed({ harness: { type: "string" }, sessions: COUNT, requests: COUNT, tokens: COUNT }), description: "By the harness that runs what each source ran, most tokens first." },
154
- models: { type: "array", items: closed({ model: { type: "string", description: "`provider/model`, or `unknown` for a request that names none." }, requests: COUNT, tokens: COUNT, cost_usd: { type: "number", minimum: 0 } }), description: "By the request's model, most tokens first." },
164
+ harnesses: { type: "array", items: closed({ harness: { type: "string" }, sessions: COUNT, requests: COUNT, tokens: COUNT, sources: { type: "array", items: { type: "string" }, description: "The sources read for this harness, in the order of `sources`: several can share one. Each is a `source` of `sources` and of `imported`." } }), description: "By the harness that runs what each source ran, most tokens first." },
165
+ models: { type: "array", items: closed({ model: { type: "string", description: "`provider/model`, or `unknown` for a request that names none." }, requests: COUNT, tokens: COUNT, cost_usd: { type: "number", minimum: 0, description: "The list price of the model's requests that could be priced." }, unpriced_requests: { ...COUNT, description: "Of the model's requests, those `cost_usd` leaves out: all of them when no price was known for it." } }), description: "By the request's model, most tokens first." },
155
166
  sources: { type: "array", items: closed({ source: { type: "string" }, sessions: COUNT, requests: COUNT }), description: "By the tool the sessions were read from." },
156
167
  imported: { type: "array", items: closed({ source: { type: "string" }, runs: COUNT }), description: "The runs imported here in the year, by source (never `live`)." },
157
168
  unread_files: { ...COUNT, description: "Session files that could not be read (gone since listed, or not openable by this user), so the numbers are short by them. A count only: no path." },
@@ -495,7 +506,8 @@ const CHATGPT_SIGN_IN = {
495
506
  authorize_url: { type: "string", format: "uri", description: "With `pending`: the link that sign-in opens." },
496
507
  expires_at: { type: "string", format: "date-time", description: "With `pending`: when that sign-in stops waiting, as its start answered." },
497
508
  models: { type: "array", items: { type: "string" }, description: "With `signed_in`: the plan's models, read from OpenAI at the sign-in, each named `chatgpt/<model-id>` in a revision." },
498
- problem: { type: "string", description: "Why the last sign-in ended without signing in, in words a person acts on: a plan OpenAI gave no use of (\"This ChatGPT plan can't be used here: …\"), a workspace whose admin turned off open-source apps (\"Your ChatGPT workspace's admin has turned off open-source apps (External access → OSS → Use ChatGPT plan): …\"), another refusal at OpenAI's sign-in page or of the code (a Free plan's sign-in has ended in one of these, and the words say a Free plan may be the reason), an answer that could not be read, OpenAI out of reach, or a sign-in that could not be saved. Always fixed words, never OpenAI's code (anything on the server's machine can send its loopback callback one). Set once the browser's return or a pasted address got that far (OpenAI's tab has already said the sign-in completed), or when a sign-in waited out its 10 minutes (\"The sign-in timed out before OpenAI sent the code back: start it again.\"); the server's log line `event=chatgpt chatgpt=sign_in_failed reason=…` names it (OpenAI's status and error code, or `timed_out`; never a token or a code). Present while signed in too, when a later sign-in failed. Gone at the next start, sign-in or sign-out; a cancelled sign-in sets none." },
509
+ problem: { type: "string", description: "Why the last sign-in ended without signing in, in words a person acts on: a plan OpenAI gave no use of (\"This ChatGPT plan can't be used here: …\"), a workspace whose admin turned off open-source apps (\"Your ChatGPT workspace's admin has turned off open-source apps (External access → OSS → Use ChatGPT plan): …\"), another refusal at OpenAI's sign-in page or of the code (a Free plan's sign-in has ended in one of these, and the words say a Free plan may be the reason), an answer that could not be read, OpenAI out of reach, or a sign-in that could not be saved. Always fixed words, never OpenAI's code (anything on the server's machine can send its loopback callback one). Set once the browser's return or a pasted address got that far (OpenAI's tab has already said the sign-in completed), or when a sign-in waited out its 10 minutes (\"The sign-in timed out: OpenAI never sent the code back. If OpenAI's page showed an error instead of signing you in, your ChatGPT workspace's admin has likely turned off open-source apps …\", the likely cause first, since OpenAI shows that refusal on its own page and never sends the browser back); the server's log line `event=chatgpt chatgpt=sign_in_failed reason=…` names it (OpenAI's status and error code, or `timed_out`; never a token or a code). Present while signed in too, when a later sign-in failed. Gone at the next start, sign-in or sign-out; a cancelled sign-in sets none." },
510
+ hint: { type: "string", description: "With `pending`, from its first minute on while OpenAI has sent no code back: why it may be stuck, in fixed words (\"OpenAI hasn't sent the code back yet. If OpenAI's page showed an error instead of signing you in, your ChatGPT workspace's admin has likely turned off open-source apps (External access → OSS → Use ChatGPT plan): …\"). OpenAI shows that refusal on its own page and never sends the browser back, so the server can't tell it from a tab left open." },
499
511
  },
500
512
  };
501
513
  /** GET /settings/claude-login's answer (claude-login.ts ClaudeLoginView): what Claude Code's CLI says of its login, never
@@ -519,6 +531,7 @@ const CLAUDE_LOGIN = {
519
531
  properties: {
520
532
  folder: { type: "string", description: "This machine's own Claude Code login folder, as the CLI finds it for this server's user." },
521
533
  source: { enum: ["CLAUDE_CONFIG_DIR", "default"], description: "`CLAUDE_CONFIG_DIR`: the server's environment names the folder (an absolute path). `default`: it does not, so the folder is the CLI's default, `~/.claude`; a Claude Code that keeps its login in another folder is found only when this server is started with `CLAUDE_CONFIG_DIR` set to it." },
534
+ credentials: { type: "string", description: "Where this server's environment sets `CLAUDE_SECURESTORAGE_CONFIG_DIR` (an absolute path, or empty): its value. The CLI keeps the login's tokens there rather than in `folder` (empty: in `~/.claude`, and on macOS in the Keychain item with no suffix), and `place: machine` is asked, signed in and run with it, as the person's own Claude Code with that variable. Absent when the environment sets none (a relative one is not taken)." },
522
535
  },
523
536
  description: "This machine's own Claude Code login, the folder `place: machine` uses.",
524
537
  },
@@ -585,17 +598,24 @@ const KEY_ID = { name: "key_id", in: "path", required: true, description: "The t
585
598
  const HARNESS_KEYS_VIEW = closed({
586
599
  harnesses: {
587
600
  type: "array",
588
- description: "Each harness recipe billed to its vendor's plan that this server is started with (--harness-recipe), in the table's order. Empty when it names none.",
601
+ description: "Each harness recipe billed to its vendor's plan that this server is started with (--harness-recipe), in the table's order; then each id with keys kept whose recipe it no longer names, by id. Empty when there is neither.",
589
602
  items: closed({
590
603
  id: { type: "string", pattern: HARNESS_ID_PATTERN, description: "The harness's id, as a revision's `harness` names it." },
591
- label: { type: "string", description: "Its recipe's label." },
592
- keys: { type: "array", items: { $ref: "#/components/schemas/SecretMeta" }, description: "Each key its recipe runs on (its `keys`, in their order) as every secret's view says it: named harness:<harness>:<KEY>; source `console` once saved; changed_at when its value was last saved. Never a value." },
593
- ready: { type: "boolean", description: "Whether every one of `keys` is saved: then its runs run on them, a scheduled or triggered one too, ahead of its owner's own sign-in (--harness-sign-in)." },
604
+ label: { type: "string", description: "Its recipe's label; its id when the server no longer names its recipe." },
605
+ named: { type: "boolean", description: "Whether this server is started with its recipe. False: its keys are kept (sealed, still cut from what runs say) and no run gets them; DELETE removes each, and a PUT is 404." },
606
+ keys: { type: "array", items: { $ref: "#/components/schemas/SecretMeta" }, description: "Each key its recipe runs on (its `keys`, in their order; none when not named) as every secret's view says it: named harness:<harness>:<KEY>; set, with source `console`, once saved for this recipe file; changed_at when its value was last saved. Never a value." },
607
+ kept: { type: "array", items: { $ref: "#/components/schemas/SecretMeta" }, description: "Each key saved for this id that its recipe runs on no more, or every one when no recipe is named: no run gets it, and DELETE removes it." },
608
+ ready: { type: "boolean", description: "Whether every one of `keys` is saved for this recipe file: then its runs run on them, a scheduled or triggered one too, ahead of its owner's own sign-in (--harness-sign-in)." },
609
+ reenter: {
610
+ type: "array",
611
+ description: "Each of `keys` with a value kept that its runs do not get, and why: recipe_changed (saved for another recipe file of this id, so a recipe that changed never inherits it), seal_key_changed (sealed under another seal key), file_unreadable (damaged). Saving it again replaces it.",
612
+ items: closed({ name: { type: "string" }, why: { enum: [...HARNESS_KEY_REENTER] } }),
613
+ },
594
614
  }),
595
615
  },
596
616
  });
597
617
  const HARNESS_ID_PARAM = { name: "harness_id", in: "path", required: true, description: "The harness: one of GET /settings/harness-keys' ids.", schema: { type: "string" } };
598
- const HARNESS_KEY_PARAM = { name: "key", in: "path", required: true, description: "One of the harness's `keys`, by the name its recipe gives it.", schema: { type: "string" } };
618
+ const HARNESS_KEY_PARAM = { name: "key", in: "path", required: true, description: "One of the harness's `keys` (or, for a DELETE, its `kept`), by the name its recipe gives it.", schema: { type: "string" } };
599
619
  /** The InputIssue reasons a saved MCP server's refusals give that the contract's enum lacks (mcp-probe.ts). */
600
620
  const MCP_ISSUE_REASONS = ["redirect", "not_https", "too_many_tools", "tools_too_large", "reserved", "expired", "registration_unavailable"];
601
621
  /** Whether an MCP server's OAuth sign-in brings its own client, and the callback URL a hand-made one must name
@@ -675,6 +695,15 @@ const MCP_SERVER_VIEW = {
675
695
  listed_at: { type: "string", format: "date-time", description: "When its tools were last listed (a PUT or a refresh)." },
676
696
  updated_at: { type: "string", format: "date-time", description: "When it was last saved." },
677
697
  secret: MCP_SECRET_SHOWN,
698
+ composio_account: {
699
+ type: "object", additionalProperties: false, required: ["state", "checked_at"],
700
+ properties: {
701
+ state: { enum: ["connected", "pending", "expired", "none", "unknown"], description: "`connected`: an ACTIVE account of the server's Composio user under its auth config; `pending`: only one whose connect link is not finished; `expired`: only an expired one; `none`: no account (or only failed or inactive ones); `unknown`: Composio did not answer at the refresh." },
702
+ labels: { type: "array", items: { type: "string", maxLength: 120 }, maxItems: 10, description: "For `connected`: each connected account's own label, to tell which it is: its alias, else the name Composio shows for it, else the word id Composio gave it. Never its id, a token or the key." },
703
+ checked_at: { type: "string", format: "date-time", description: "When a refresh read it at Composio." },
704
+ },
705
+ description: "A Composio server's account, as its last refresh (POST .../refresh) read it at Composio. Absent until a refresh reads it, after a save over the server as another user, toolkit or auth config, and on a server with no account of its own: a per-run one (each run names its own), one of a toolkit that needs no sign-in, or one saved before its save recorded what it stands on.",
706
+ },
678
707
  },
679
708
  };
680
709
  const MCP_AUTH = {
@@ -838,6 +867,17 @@ const AGENT_TOOLS = {
838
867
  },
839
868
  "x-agentrun-serve": "providers/1",
840
869
  };
870
+ const API_KEY_ID = { name: "api_key_id", in: "path", required: true, description: "The key, as the list names it (`id`).", schema: { type: "string" } };
871
+ /** An API key as every read answers it (api-keys.ts): never its value, a prefix, a length or a hash. */
872
+ const API_KEY_FIELDS = {
873
+ id: { type: "string", format: "uuid" },
874
+ name: { type: "string", minLength: 1, maxLength: API_KEY_NAME_MAX, description: "What the key is for, as its maker wrote it." },
875
+ created_at: { type: "string", format: "date-time" },
876
+ last_used_at: { type: ["string", "null"], format: "date-time", description: "When a request last carried it; null for a key never used. Written to the store about once a minute, so after a restart it can read up to a minute early." },
877
+ secret: { ...ref("schemas/SecretMeta"), description: "The key's metadata, named `api-key:<id>`: set, made by this server at the owner's request (source console), and when. Never the value." },
878
+ };
879
+ const API_KEY = closed(API_KEY_FIELDS);
880
+ const API_KEY_VALUE = { type: "string", pattern: `^${API_KEY_PREFIX}[A-Za-z0-9_-]{43}$`, description: `The key, shown this once: \`${API_KEY_PREFIX}\` and 32 random bytes in base64url. An app sends it as \`Authorization: Bearer <key>\`; keep it in the app's secrets.` };
841
881
  const WEBHOOK_ID = { name: "webhook_id", in: "path", required: true, description: "The message, as its `webhook-id` names it.", schema: { type: "string" } };
842
882
  /** The outbound webhook's secret's metadata (secret-writes.ts SecretMeta): never its value. */
843
883
  const WEBHOOK_SECRET_META = { ...ref("schemas/SecretMeta"), description: "Its signing secret's metadata, named `webhook:outbound`: set, made by this server at the first save or a rotation (source console), and when; null for a webhook set before it was kept. Never the value." };
@@ -1066,7 +1106,7 @@ const COMPUTER_PROVIDER_GPU = closedWith({
1066
1106
  why: { type: "string", description: "Why a run on this server cannot have its GPUs: its GPU computers take no mount of this server's folder mode." },
1067
1107
  });
1068
1108
  /** `runs_refused` of a provider in Settings → Computers (computers.ts ProviderView; attached-computers.ts dialApartWords). */
1069
- const PROVIDER_RUNS_REFUSED = { type: ["string", "null"], description: "On a server whose runner runs in a process of its own (`--no-runner`; the image's default `server-and-runner`), why no run here can use this provider's computers, and the one-line fix: start the image with the server options alone, without `server-and-runner`. Said for a provider whose machines dial this server (Fly Machines and Cloudflare), whose sockets the server's process takes and its runner never reaches, unless a runner of its relays their dials now (it knows the server's public address, AGENTRUN_PUBLIC_URL, and the server relays each machine's socket to it); and for a paired computer, always. Its test (POST /computers/{provider}/test) fails in the same words. Null where this server's runs can use it." };
1109
+ const PROVIDER_RUNS_REFUSED = { type: ["string", "null"], description: "On a server whose runner runs in a process of its own (`--no-runner`; the image's default `server-and-runner`), why no run here can use this provider's computers, and the one-line fix: start the image with the server options alone, without `server-and-runner`. Said for a provider whose machines dial this server (Fly Machines and Cloudflare), whose sockets the server's process takes and its runner never reaches, unless a runner of its relays their dials now (it knows the server's public address, AGENTRUN_PUBLIC_URL, and the server relays each machine's socket to it). Its test (POST /computers/{provider}/test) fails in the same words. Null where this server's runs can use it." };
1070
1110
  /** A provider in Settings → Computers (computers.ts ProviderView). */
1071
1111
  const COMPUTER_PROVIDER = closedWith({
1072
1112
  id: { type: "string", description: "The provider's id, as an agent's `computer.provider` names it (PUT /computers/{provider}/keys)." },
@@ -1092,7 +1132,7 @@ const COMPUTER_PROVIDER = closedWith({
1092
1132
  },
1093
1133
  });
1094
1134
  /** `runs_refused` of a pairing code, the pair answer and a paired computer (attached-computers.ts RUNNER_APART_WORDS). */
1095
- const RUNS_REFUSED = { type: ["string", "null"], description: "On a server whose runner runs in a process of its own (`--no-runner`; the image's default `server-and-runner`), why no run here can use a paired computer, and the one-line fix: start the image with the server options alone, without `server-and-runner`. A computer still pairs and attaches. Null where this server's runs can use it." };
1135
+ const RUNS_REFUSED = { type: ["string", "null"], description: "On a server whose runner runs in a process of its own (`--no-runner`; the image's default `server-and-runner`), why no run here can use a paired computer, and the fix: give the runner AGENTRUN_PUBLIC_URL (this server's public address), so the server relays a paired computer's socket to the runner whose run holds it, or start the image with the server options alone, without `server-and-runner`. Said only while no runner relays; null once one does. A computer still pairs and attaches. Null where this server's runs can use it." };
1096
1136
  /** A paired computer in GET /computers' `paired` (computer-attach.ts PairedView). */
1097
1137
  const PAIRED_COMPUTER = closed({
1098
1138
  id: { type: "string", description: "Its id: an agent's `computer.provider` names it (`{kind: \"desktop\", provider: <id>}`), and DELETE /computers/{computer_id} removes it." },
@@ -1109,9 +1149,11 @@ const PAIRED_COMPUTER = closed({
1109
1149
  groups: { type: "array", items: { type: "string" }, description: "The capability groups its driver offers: its live hello's while it is attached, else its last hello's. A run uses only these." },
1110
1150
  features: { type: "object", additionalProperties: { oneOf: [{ const: true }, closed({ off: { type: "string", description: "Why it is off here, in words a person can act on." } })] }, description: "What its groups can and cannot do on it, by feature name (true, or off with why), as its driver says it: live while attached, else as paired." },
1111
1151
  driver: { type: "string", description: "Its driver's build: its live hello's while it is attached, else the one it last said." },
1112
- online: { type: "boolean", description: "Whether its driver is attached to this server now." },
1113
- held_by_run: { type: ["string", "null"], description: "The run that holds it now; null when none does." },
1152
+ online: { type: "boolean", description: "Whether its driver is attached now: to this server, or to a runner the server relays its socket to." },
1153
+ held_by_run: { type: ["string", "null"], description: "The run that holds it now, on this server or on a runner the server relays it to; null when none does." },
1114
1154
  held_until: { type: ["string", "null"], format: "date-time", description: "When the holding run's hold ends, released or not: the run's lifetime. Past it the run's connections close and the next run may claim it, and the computer stays attached. Null when no run holds it." },
1155
+ held_on: { type: ["string", "null"], description: "The runner whose run holds it, where the server relays its socket to a runner: the computer's dials go there while the run holds it, and come back to this server when the hold ends. Null when it is attached to this server." },
1156
+ hold_note: { type: ["string", "null"], description: "The server's note of why its last relay to a runner was refused or dropped (the runner restarted, or the run's runner is gone, and it comes back to this server at its next dial), or that it is attached nowhere and its driver must be opened, in words naming what to do. Null when nothing is wrong." },
1115
1157
  pairing: { type: "string", description: "The pairing (POST /computers/pairings' `id`) whose code paired it." },
1116
1158
  created_at: { type: "string", format: "date-time", description: "When it was paired." },
1117
1159
  seen_at: { type: ["string", "null"], format: "date-time", description: "When it last attached; null before its first." },
@@ -1206,7 +1248,7 @@ const RUN_COMPUTER = {
1206
1248
  ...closedWith({
1207
1249
  kind: { enum: ["sandbox", "desktop", "phone", "browser"] },
1208
1250
  provider: { type: "string" },
1209
- state: { enum: ["starting", "ready", "taken_over", "ended", "failed"], description: "`taken_over` while the owner holds the run's desktop or phone (POST /runs/{run_id}/computer/take-over); `failed` when the run could not have its computer (error code `computer_unavailable`)." },
1251
+ state: { enum: ["starting", "ready", "taken_over", "released", "ended", "failed"], description: "`taken_over` while the owner holds the run's desktop or phone (POST /runs/{run_id}/computer/take-over), or its browser (Take over in the browser's live view); `released` while the run waits on its person with its computer let go: stopped, or parked on a question or an approval with no desktop, phone or sandbox kept for its resume; the run's next turn starts a new one; `failed` when the run could not have its computer (error code `computer_unavailable`)." },
1210
1252
  }, {
1211
1253
  why: { type: "string", description: "With `failed`: the server's words, naming the setting to fill." },
1212
1254
  held: {
@@ -1320,12 +1362,12 @@ const TRIGGER_FIRING = closedWith({
1320
1362
  key: { type: "string", pattern: "^fir_[0-9a-f]{32}$", description: "The firing's key: from the trigger and its nominal time, or from the trigger and the Idempotency-Key of a run now. Its run is started under it, once." },
1321
1363
  by: firedByOf(TRIGGER_ADAPTERS),
1322
1364
  nominal_at: { ...DATE_TIME, description: "The time it fires for, to the second; a run now's is when it was asked." },
1323
- status: { enum: [...FIRING_STATUSES], description: `\`due\`: recorded, its run not started yet (a full server, or a launch hook that did not answer, answered 5xx or 429, keeps it due, with \`retry_at\`). \`started\`: its run is \`run_id\`. \`sent\`: a message_run firing's message reached \`run_id\`; or, on a server with the launch hook (AGENTRUN_LAUNCH_HOOK_URL), the host took the firing and started no run for it here (a run it starts with \`trigger_firing\`, up to \`start_by\`, makes the firing \`started\`). \`skipped\`: the trigger's last run was still active (working, or waiting on a person), or an earlier firing was still due; \`reason\` says which. \`failed\`: the run was refused, or the launch hook did not take the firing (\`hook_failed\`, its answer or its retries run out), with \`error\`; a trigger.failed webhook message says so. \`missed\`: times not fired while the server was down or its timer late (older than the catch-up window, or before the one that caught up), \`count\` of them from \`nominal_at\` on.` },
1365
+ status: { enum: [...FIRING_STATUSES], description: `\`due\`: recorded, its run not started yet (a full server, or a launch hook that did not answer, answered 5xx or 429, keeps it due, with \`retry_at\`). \`started\`: its run is \`run_id\`. \`sent\`: a message_run firing's message reached \`run_id\`; or, on a server with the launch hook (AGENTRUN_LAUNCH_HOOK_URL), the host took the firing and started no run for it here (a run it starts with \`trigger_firing\`, up to \`start_by\`, makes the firing \`started\`; a host that will start none releases it, POST /triggers/{trigger_id}/firings/{firing_id}/release, and it is \`failed\`). \`skipped\`: the trigger's last run was still active (working, or waiting on a person), or an earlier firing was still due; \`reason\` says which. \`failed\`: the run was refused, the launch hook did not take the firing (\`hook_failed\`, its answer or its retries run out), or its host took it and released it with no run (\`host_released\`, the host's words), with \`error\`; a trigger.failed webhook message says so, and it counts toward the failures in a row that turn the trigger off. \`missed\`: times not fired while the server was down or its timer late (older than the catch-up window, or before the one that caught up), \`count\` of them from \`nominal_at\` on.` },
1324
1366
  at: { ...DATE_TIME, description: "When it was recorded." },
1325
1367
  run_id: { type: ["string", "null"] },
1326
1368
  reason: { type: ["string", "null"] },
1327
1369
  error: { oneOf: [closed({ code: { type: "string" }, message: { type: "string" } }), { type: "null" }] },
1328
- }, { count: { type: "integer", minimum: 1, description: "On a `missed` firing: how many times it stands for, from `nominal_at` on; a cron line's are counted to 10000, and `reason` says \"or more\" past that." }, attempts: { type: "integer", minimum: 0 }, retry_at: { ...DATE_TIME, description: "On a `due` firing alone: when it is tried again." }, start_by: { ...DATE_TIME, description: "On a `sent` firing its launch hook's host took with no run: until when the host may still start that run with `trigger_firing`, 10 minutes after its 2xx (whenever the firing reached it: a catch-up, a firing that waited on `max_active_runs`, or one handed again after a restart). Not a retry: the server never hands the firing over again. Until then the firing holds its trigger's room as a run in progress: `max_active_runs` counts it, and the overlap check skips a later firing for it. A start that begins by then holds the room until its run is written: a `start_by` less than a minute away moves to a minute after that start began, and back if the start writes no run." }, catch_up: { const: true, description: "A time that fired late, within the trigger's catch-up window: the server was down, or its timer late." } });
1370
+ }, { count: { type: "integer", minimum: 1, description: "On a `missed` firing: how many times it stands for, from `nominal_at` on; a cron line's are counted to 10000, and `reason` says \"or more\" past that." }, attempts: { type: "integer", minimum: 0 }, retry_at: { ...DATE_TIME, description: "On a `due` firing alone: when it is tried again." }, start_by: { ...DATE_TIME, description: "On a `sent` firing its launch hook's host took with no run: until when the host may still start that run with `trigger_firing`, 10 minutes after its 2xx (whenever the firing reached it: a catch-up, a firing that waited on `max_active_runs`, or one handed again after a restart). Not a retry: the server never hands the firing over again. Until then the firing holds its trigger's room as a run in progress: `max_active_runs` counts it, and the overlap check skips a later firing for it. A start that begins by then holds the room until its run is written: a `start_by` less than a minute away moves to a minute after that start began, and back if the start writes no run. A host that will start no run releases the firing (POST /triggers/{trigger_id}/firings/{firing_id}/release), before or after `start_by`: it is `failed` at once and its room is free, so a firing waiting on it need not wait out `start_by`." }, catch_up: { const: true, description: "A time that fired late, within the trigger's catch-up window: the server was down, or its timer late." } });
1329
1371
  const TRIGGER_FIELDS = closed({
1330
1372
  id: { type: "string" },
1331
1373
  name: { type: "string", maxLength: 200 },
@@ -1353,6 +1395,7 @@ const TRIGGER_WRITE = {
1353
1395
  max_active_runs: { type: ["integer", "null"], minimum: 1, maximum: MAX_ACTIVE_RUNS, description: `For a \`start_run\` trigger of a pushed source (a webhook, with or without \`accept\`): each event starts its own run, never skipped behind the last, and this is the most of its runs active at once. A firing past it waits due and is tried again; past 20 due an event is 429 \`rate_limited\`. Null: a trigger with \`accept\` takes every run this server has room for, and one without keeps the overlap skip. A schedule or a \`message_run\` target is 422 with it set. A PATCH with null clears it.` },
1354
1396
  };
1355
1397
  const TRIGGER_ID = { name: "trigger_id", in: "path", required: true, schema: { type: "string" } };
1398
+ const FIRING_ID = { name: "firing_id", in: "path", required: true, description: "The firing's key, as the launch hook sent it (`firing_id`).", schema: { type: "string", pattern: "^fir_[0-9a-f]{32}$" } };
1356
1399
  /** A webhook trigger's minted secret's metadata (secret-writes.ts SecretMeta, trigger-secrets-shown.ts): never its value. */
1357
1400
  const TRIGGER_SECRET_META = { ...ref("schemas/SecretMeta"), description: "A webhook trigger's signing secret's metadata, named `trigger:<id>`: set, made by this server (source console), and when, where known (its create's and rotation's answers; a read says null). Never the value. Absent for a trigger that keeps none (a schedule's)." };
1358
1401
  /** A trigger as GET and the list read it: with its minted secret's metadata, where it has one. */
@@ -1414,6 +1457,22 @@ const SUGGESTIONS_LIST = closed({
1414
1457
  });
1415
1458
  /** templates/1: template packages, listed and applied (templates.ts; the format is templates/README.md). */
1416
1459
  const TEMPLATE_MARK = { "x-agentrun-serve": "templates/1" };
1460
+ const MARKETPLACE_MARK = { "x-agentrun-serve": "marketplace/1" };
1461
+ /** One template on the marketplace's list (marketplace.ts MarketplaceTemplate), with the package here that it is. */
1462
+ const MARKETPLACE_TEMPLATE = closedWith({
1463
+ name: { type: "string", pattern: "^[a-z0-9]+(?:-[a-z0-9]+)*$", maxLength: 64, description: "Its name on the marketplace: its page's last part, and its package's `name`." },
1464
+ title: { type: "string", minLength: 1, maxLength: 120, description: "Its display name there; its name when the list gives none." },
1465
+ tags: { type: "array", items: { type: "string", pattern: "^[a-z0-9-]{1,32}$" }, maxItems: 8, uniqueItems: true },
1466
+ needs: { type: "array", items: { type: "string", minLength: 1, maxLength: 200 }, maxItems: 16, description: "What it requires, in the marketplace's words (\"Requires GitHub, through the AgentRun GitHub App\"): display only." },
1467
+ page_url: { type: "string", format: "uri", description: "Its page on the marketplace, which installs it on a person's AgentRun." },
1468
+ }, {
1469
+ summary: { type: "string", maxLength: 300, description: "Its card's one line." },
1470
+ description: { type: "string", maxLength: 2000, description: "What it does, in full." },
1471
+ category: { enum: [...CATEGORIES], description: "What it is for, as the marketplace files it; left out for none or one this server does not know." },
1472
+ harness: { type: "array", items: { type: "string", pattern: HARNESS_ID_PATTERN }, maxItems: 8, uniqueItems: true, description: "Its package's harness preference list (agent.md `harness`), display only: empty for any harness. Left out when the list does not say." },
1473
+ source: { type: "string", description: "The package an install reads (POST /templates/import `source`), as the list names it, pinned to a commit (`github:<owner>/<repo>[/<path>]@<sha>`). Left out when the list names none: its `page_url` installs it." },
1474
+ here: { type: "string", description: "The id of the package on this server that this one is (GET /templates `id`): a bundled package, or one imported from its `source` (from its name, a bundled one first, when the list names no sources). Left out when it is not here." },
1475
+ });
1417
1476
  /** template-computer/1: a package's computer preference list, and what this server would pick of it. */
1418
1477
  const TEMPLATE_COMPUTER_MARK = { "x-agentrun-serve": "template-computer/1" };
1419
1478
  const NULLABLE_STRING = { type: ["string", "null"] };
@@ -1488,7 +1547,7 @@ const TEMPLATE = closed({
1488
1547
  parameters: { type: "object", description: "What apply takes in `parameters`, put where the package writes `${parameters.<name>}`: the package's `parameters`, compiled as `inputs` are, a closed JSON Schema object (no properties when it names none). Apply fills a blank one with its `default` and checks them as a run's input is checked." },
1489
1548
  input_schema: { type: ["object", "null"], description: "What each run of its agent takes as `input`: the package's `inputs`, compiled to the JSON Schema apply sets as the agent's `input_schema`. Null: the package names none, and a run takes `{content}`." },
1490
1549
  secrets: { type: "array", items: { type: "string" }, description: "The keys this server must have, by variable name (a saved key counts), before apply makes anything." },
1491
- budget: { type: ["object", "null"], additionalProperties: false, required: ["per_run_usd"], properties: { per_run_usd: { type: "number" }, max_requests: { type: "integer", minimum: 1, "x-agentrun-serve": "maxrequests/1" } }, description: "Each run's limits: per_run_usd, its spend cap (the agent's max_cost_usd), required of a package with triggers; max_requests, when given, the most requests on free models it makes (the agent's max_requests), under the server's own limit." },
1550
+ budget: { type: ["object", "null"], additionalProperties: false, required: ["per_run_usd"], properties: { per_run_usd: { type: "number" }, max_requests: { type: "integer", minimum: 1, "x-agentrun-serve": "maxrequests/1" } }, description: "Each run's limits: per_run_usd, its spend cap (the agent's max_cost_usd), required of a package with triggers unless each of them has its own target.max_cost_usd; max_requests, when given, the most requests on free models it makes (the agent's max_requests), under the server's own limit." },
1492
1551
  learning: { oneOf: [{ type: "boolean" }, { type: "object" }], description: "The agent's `learning` as apply sets it, as an agent definition takes it: true, false, or the loop's settings (kyb's `{agree_on: [\"verdict.decision\"]}`: its check and audit compare two answers on the verdict's decision alone)." },
1493
1552
  approvals_default: { enum: ["ask", "never"], description: "What the package recommends for the agent's approvals: `ask`, the agent asks its person before a tool runs; `never`, it runs unattended (a template whose job runs on triggers). Deny settings and pins hold either way: a pinned write can only go where its pin says." },
1494
1553
  triggers: { type: "array", items: { type: "object" }, description: "The triggers apply makes on its agent: POST /triggers bodies with no agent_id, placeholders unfilled. A trigger's `enabled` may be `${parameters.<name>}`, a boolean parameter with a default: apply makes it on or off by that value." },
@@ -1664,7 +1723,7 @@ const WRITE_DESCRIPTION = "As a person: one host commit on main in the agent's q
1664
1723
  /** GET /agents/{agent_id}/learning/cost (learning-cost.ts, store-reads/learning.ts agentCostOverStore). */
1665
1724
  const COST_USD = (description) => ({ type: ["number", "null"], minimum: 0, description: `${description} As booked (its float noise rounded off at 1e-12, the precision of a run's own cost): a decision's sub-micro-dollar cost is in it; null when unknown, never 0 for unknown.` });
1666
1725
  const COST_MEAN = (description) => ({ oneOf: [closed({ runs: { ...COUNT, minimum: 1, description: "How many runs the mean is over." }, mean_usd: { type: "number", minimum: 0, description: "Their mean, rounded to 1e-6." } }), { type: "null" }], description });
1667
- const COST_RUN = closed({
1726
+ const COST_RUN = closedWith({
1668
1727
  n: { type: ["integer", "null"], minimum: 1, description: "The run's place among the agent's runs that do a job (`agent`, `workflow` and `handed_back`), oldest first, as `bill.points` number them: 1 is its first. Null for a `replay`: it checks a revision and does no job." },
1669
1728
  run_id: { type: "string" },
1670
1729
  started_at: DATE_TIME,
@@ -1677,6 +1736,12 @@ const COST_RUN = closed({
1677
1736
  cost_upper_bound: { type: "boolean", description: "The run's stored cost is only a bound (its row's `costAtMostUsd`: a model request cut at its cap hold): `cost_usd` and `total_usd` are null, never a known cost. `summary` counts such a run as `at_most`, not `unknown`." },
1678
1737
  learning_usd: COST_USD("What learning cost for the run: its compile turn. 0 for a run that does not learn or was not asked one. An audit's shadow run of it is its learning too: null while that shadow is queued or running, never $0."),
1679
1738
  total_usd: COST_USD("The run's all-in cost, `cost_usd` and `learning_usd` together; null when either is."),
1739
+ }, {
1740
+ compile_usd: COST_USD("The compile turns the run's own session asked: its revision's spend, never its own (`bill.revisions`), or no run's when it kept no draft (`bill.unattributed_usd`). GET /runs/{id} `cost.compile_usd` is the same figure. 0 for a run asked none."),
1741
+ followup_usd: COST_USD("What the run's learning spent after its job answered besides its compile turns (a follow-up round's turns): a part of its GET /runs/{id} `cost.learning_usd`, the same figure there."),
1742
+ shadow_usd: COST_USD("Its audit shadow's cost (0 when none ran): a part of its GET /runs/{id} `cost.learning_usd`, the same figure there. Null while the shadow is queued or running."),
1743
+ share_usd: COST_USD("Its share of the learning spend of the revision that served it (`bill.revisions`): a part of its GET /runs/{id} `cost.learning_usd`, the same figure there. 0 for a run no revision served."),
1744
+ not_served: { enum: ["cost_stop", "cut", null], description: "Why a learned workflow did not serve the run alone, when one was there to: `cost_stop`, the money rule stopped it (its served runs cost as much as the agent by hand); `cut`, a restart cut the workflow's call and the run was handed back (`handed_back` at agent cost, counted in the summary's `hand_backs.cut`, never `back`). Null otherwise." },
1680
1745
  });
1681
1746
  const LEARNING_COST = closed({
1682
1747
  agent: { type: "string" },
@@ -1689,16 +1754,16 @@ const LEARNING_COST = closed({
1689
1754
  digest: { type: "string", description: "The version of it its newest run served first ran: the first 16 hex characters of its workflow.json's sha256. A new version starts its count from zero." },
1690
1755
  state: { enum: ["serving", "needs_revision"], description: `\`serving\`: it runs first on every run it fits. \`needs_revision\`: over its newest ${COST_WINDOW} priced runs served at this version, its mean all-in cost (\`served\`) is at or over the agent's cost by hand (\`by_hand\`), so it no longer runs first: the agent takes each run it would have served, and the stop asks for no new version. A new version (a new digest) runs first again.` },
1691
1756
  served: COST_MEAN(`The mean all-in cost (\`total_usd\`: the run's own cost, the workflow's nodes and, after a handback, the agent's work, with every learning round booked for it) of its newest ${COST_WINDOW} runs served first at this version whose all-in cost is known (a window, never how many runs it served: \`runs\` stops at ${COST_WINDOW}); null when none is.`),
1692
- by_hand: COST_MEAN("The agent's cost by hand: the mean all-in cost (`total_usd`) of its runs on the `agent` path whose all-in cost is known or, with none, of its runs before the workflow first ran; null when there are none: the workflow then keeps serving."),
1693
- unknown_cost_runs: { ...COUNT, description: "How many runs `served` and `by_hand` would have read have no known all-in cost: left out of their means, never read as 0." },
1757
+ by_hand: COST_MEAN(`The agent's cost by hand, as the money rule reads it at a run's launch: the mean of the job's own cost (\`cost_usd\`, learning left out) of its runs on the \`agent\` path (a run that does not learn among them) in a window, the agent's newest ${PAST_RUNS} runs on no named disk since its learning's reset, whose cost is known exactly; null when there are none: the workflow then keeps serving. The window, never every run: \`summary.before\` reads every run before the takeover, so the two differ.`),
1758
+ unknown_cost_runs: { ...COUNT, description: "How many runs `served` would have read have no known all-in cost, and `by_hand` no exact own cost: left out of their means, never read as 0." },
1694
1759
  }), description: "Each learned workflow that has run first on one of these runs, at its newest version, and where it stands against the money rule: it runs first while its cost a run stays under the agent's by hand. It does not catch a workflow that answers wrong with confidence." },
1695
1760
  summary: closed({
1696
1761
  takeover: { oneOf: [closed({ n: { type: "integer", minimum: 1 }, run_id: { type: "string" } }), { type: "null" }], description: "The first run a learned workflow served (`path` `workflow` or `handed_back`), numbered as `runs` number it. Null before one." },
1697
- before: COST_MEAN("The mean of the job's own cost (`cost_usd`, learning left out) over the `agent` runs before the takeover (all of them when there is none yet) whose cost is known exactly (never `cost_upper_bound`); null when there is none."),
1762
+ before: COST_MEAN("The mean of the job's own cost (`cost_usd`, learning left out) over the `agent` runs before the takeover (all of them when there is none yet) whose cost is known exactly (never `cost_upper_bound`); null when there is none. Over every run the series counts (`total_runs`), on any disk: the money rule's by-hand side (`workflows[].by_hand`) reads a window of them instead, so the two differ."),
1698
1763
  after: COST_MEAN("The mean all-in cost (`total_usd`, learning included) of the runs a learned workflow served from the takeover on (`path` `workflow` or `handed_back`; never a `replay`, which checks a revision and serves no one, nor an `agent` run) whose total is known exactly (never `cost_upper_bound`); null when there is none, and `after_state` says why."),
1699
1764
  after_state: { enum: [...AFTER_STATES], description: "Why `after` is what it is: `priced`, it is the mean of the served runs whose cost is known; `no_served_runs`, no learned workflow has taken over yet (replays are not served runs), so there is no after side; `cost_unknown`, runs were served but no served run's all-in cost is known exactly. A reader says these in words, never as a figure." },
1700
1765
  times_cheaper: { type: ["number", "null"], minimum: 0, description: `\`before\` over \`after\`, to a tenth, once \`after\` counts ${CHEAPER_AFTER_RUNS} runs or more and \`withheld\` is null; else null. Learning is left out of the before side and kept in the after side, so it never flatters learning.` },
1701
- hand_backs: { oneOf: [closed({ ran: COUNT, back: COUNT }), { type: "null" }], description: "Of the runs a learned workflow ran first on from the takeover on (`path` `workflow` or `handed_back`), how many (`ran`) and how many it handed back to the agent (`back`); null before a takeover." },
1766
+ hand_backs: { oneOf: [closed({ ran: COUNT, back: COUNT, cut: COUNT }), { type: "null" }], description: "Of the runs a learned workflow ran first on from the takeover on (`path` `workflow` or `handed_back`), how many (`ran`), how many it handed back to the agent itself (`back`: an escalate, a failed step, an answer cut by size or schema), and how many a restart cut mid-call (`cut`: the runner was lost, the next claim ended its call `interrupted` and handed the run back; still `handed_back` at agent cost, no judgment of the workflow's); null before a takeover." },
1702
1767
  withheld: { oneOf: [closed({ unknown: { ...COUNT, description: "Runs whose cost is unknown." }, at_most: { ...COUNT, description: "Runs whose cost is known only as at most (`cost_upper_bound`)." } }), { type: "null" }], description: "After a takeover, the runs `before` and `after` would read whose cost is not known exactly: while any is, `times_cheaper` is null, so the ratio is never over a partial set. Null when every one is known, and before a takeover." },
1703
1768
  replay: { oneOf: [closed({
1704
1769
  n: { ...COUNT, description: "The inputs its check ran on." },
@@ -2194,6 +2259,7 @@ const EXTENSIONS = {
2194
2259
  { name: "status", in: "query", required: false, description: "Only runs with this status.", schema: ref("schemas/RunStatus") },
2195
2260
  { name: "archived", in: "query", required: false, description: "true lists only archived runs; false, the default, the others.", schema: { type: "boolean" } },
2196
2261
  LABEL_PARAMETER,
2262
+ SOURCE_PARAMETER,
2197
2263
  ],
2198
2264
  responses: { "200": json(ref("schemas/RunList"), "One page of runs, newest first."), ...errors(400, 401, 429, 500) },
2199
2265
  },
@@ -2288,11 +2354,11 @@ const EXTENSIONS = {
2288
2354
  "/wrapped": {
2289
2355
  get: {
2290
2356
  operationId: "getWrapped", tags: ["runs"], summary: "A year of the work under this machine's session files",
2291
- description: "Reads the Claude Code, Codex, pi and other session files under the home of the machine this server runs on, and answers numbers and names only (no prompt, title, path or project). Everything is bucketed by each request's time in the server's local zone, so a session that spans New Year splits; a session counts for the year of its first request. Answered only by a server bound to loopback with no public URL: any other, and the API-only profile, is 403. The answer is kept for a minute.",
2357
+ description: "Reads the Claude Code, Codex, pi and other session files under the home of the machine this server runs on, and answers numbers and names only (no prompt, title, path or project). Everything is bucketed by each request's time in the server's local zone, so a session that spans New Year splits; a session counts for the year of its first request. Answered only by one owner's server on their own machine, reached at a loopback name: one bound past loopback, with a public URL, the API-only profile, more than one API token, an API key made in the console for an app, or a Postgres store is 403. The home is read on a worker thread; a read not done within 15 seconds is 503 `unavailable` with `retry_after_ms` while it goes on. The current year's answer is kept for a minute, an earlier year's until the server stops. A read that fails is kept for a minute too: each ask in it is 500 `internal`, the reason in the server's log, and the next ask after it reads again. A year after the current one is 400.",
2292
2358
  parameters: [
2293
2359
  { name: "year", in: "query", required: false, description: "A four-digit year, in the server's local zone. Default the current year.", schema: { type: "integer", minimum: 1000, maximum: 9999 } },
2294
2360
  ],
2295
- responses: { "200": json(WRAPPED, "The year, read now."), ...errors(400, 401, 403, 429, 500) },
2361
+ responses: { "200": json(WRAPPED, "The year, read now."), ...errors(400, 401, 403, 429, 500, 503) },
2296
2362
  "x-agentrun-serve": "wrapped/1",
2297
2363
  },
2298
2364
  },
@@ -2676,7 +2742,7 @@ const EXTENSIONS = {
2676
2742
  operationId: "deleteHarnessKey", tags: ["local"], summary: "Forget one key of a plan-billed harness recipe",
2677
2743
  // A removal has no body to mark a field in: the operation is marked whole, a secret write all the same.
2678
2744
  "x-agentrun-secret": true,
2679
- description: "Its runs no longer get it; the value stays sealed for the cut. A secret write: the owner's signed-in session alone (ownerSession), never the token, which is 403 forbidden in words.",
2745
+ description: "Its runs no longer get it; the value stays sealed for the cut. Takes a key its recipe runs on, or one kept for it (`kept`), also for an id whose recipe this server no longer names; 404 for an id it names no recipe of and keeps no key for. A secret write: the owner's signed-in session alone (ownerSession), never the token, which is 403 forbidden in words.",
2680
2746
  parameters: [HARNESS_ID_PARAM, HARNESS_KEY_PARAM],
2681
2747
  security: [{ ownerSession: [] }],
2682
2748
  responses: { "204": { description: "Forgotten." }, ...errors(401, 403, 404, 422, 429, 500) },
@@ -2939,10 +3005,10 @@ const EXTENSIONS = {
2939
3005
  },
2940
3006
  put: {
2941
3007
  operationId: "saveMcpServer", tags: ["local"], summary: "Preview a remote MCP server, then save it with the tools listed and its credential sealed",
2942
- description: `The credential is sealed under the server's seal key, bound to the server's name and its URL's origin, and kept in the data directory as ciphertext alone. 403 forbidden to the API token for a save that sends a credential's value, or over a saved server the token did not save or that holds a credential (one the owner saved stays the owner's, sealing a credential or not: its address, its credential and what the Composio preset made for it): the owner's signed-in session alone, and the refusal's \`details.console_url\` opens the console's form for it filled with the rest (no credential). 412 precondition_failed when a save that sends a new credential, or none, finds the server's credential changed while it listed its tools (another save, a sign-in or a removal landed), or the token's save finds the owner saved over its server meanwhile, or a save that keeps it finds the server at another address or holding another kind of credential by then (a Composio save over it moved it): nothing is written over it. A body with no credential keeps the sealed one while the type and the URL's origin stay the same; else it is 422. A body with no \`prices\` keeps the saved ones for the tools still listed at the same URL, so a save from any client never leaves a paid tool unmetered; \`prices: {}\` clears them. 422 too for a bad name, URL or auth, or a price that is not a finite number 0 or more or names a tool the server does not list. ${MCP_CONNECTS} Nothing is saved unless the listing succeeds. A save that moves a server the Composio preset made to another address makes it another service's server, and removes in the owner's Composio account what the preset made for it, as its delete does (the MCP server, then the connected account its connect link started and the auth config it made, unless another saved server uses them), with the key it was saved with, and answers \`composio\` saying so; 409 composio_in_use, naming them in \`details.triggers\`, while Composio triggers use it: delete them first. A save of a server the preset made lists its tools at once, then writes and cleans up one at a time with the preset's saves and the MCP servers' deletes, in its Composio project's turn.`,
3008
+ description: `The credential is sealed under the server's seal key, bound to the server's name and its URL's origin, and kept in the data directory as ciphertext alone. On an API-only server (AGENTRUN_API_ONLY=1) the token saves only a per_run server at an origin AGENTRUN_API_ONLY_MCP_ORIGINS lists, and any other body is 404 not_found (the serve README's API-only section). 403 forbidden to the API token for a save that sends a credential's value, or over a saved server the token did not save or that holds a credential (one the owner saved stays the owner's, sealing a credential or not: its address, its credential and what the Composio preset made for it): the owner's signed-in session alone, and the refusal's \`details.console_url\` opens the console's form for it filled with the rest (no credential). 412 precondition_failed when a save that sends a new credential, or none, finds the server's credential changed while it listed its tools (another save, a sign-in or a removal landed), or the token's save finds the owner saved over its server meanwhile, or a save that keeps it finds the server at another address or holding another kind of credential by then (a Composio save over it moved it): nothing is written over it. A body with no credential keeps the sealed one while the type and the URL's origin stay the same; else it is 422. A body with no \`prices\` keeps the saved ones for the tools still listed at the same URL, so a save from any client never leaves a paid tool unmetered; \`prices: {}\` clears them. 422 too for a bad name, URL or auth, or a price that is not a finite number 0 or more or names a tool the server does not list. ${MCP_CONNECTS} Nothing is saved unless the listing succeeds. A save that moves a server the Composio preset made to another address makes it another service's server, and removes in the owner's Composio account what the preset made for it, as its delete does (the MCP server, then the connected account its connect link started and the auth config it made, unless another saved server uses them), with the key it was saved with, and answers \`composio\` saying so; 409 composio_in_use, naming them in \`details.triggers\`, while Composio triggers use it: delete them first. A save of a server the preset made lists its tools at once, then writes and cleans up one at a time with the preset's saves and the MCP servers' deletes, in its Composio project's turn.`,
2943
3009
  parameters: [MCP_NAME],
2944
3010
  requestBody: { required: true, content: { "application/json": { schema: { type: "object", additionalProperties: false, required: ["url"], properties: { url: MCP_URL, auth: MCP_AUTH, prices: MCP_PRICES, ...MCP_TOOLKIT_BODY } } } } },
2945
- responses: { "200": json({ ...MCP_SERVER_VIEW, properties: { ...MCP_SERVER_VIEW.properties, composio: closed({ removed: { type: "boolean", description: "Nothing the save was to remove at Composio is left there." }, note: { type: "string", description: "What it removed at Composio, what it kept and why, and what is left, with the dashboard's address to remove that by hand." } }, "Present when the save moved a server the Composio preset made off Composio: what became of what the preset made there.") } }, "The server, as saved."), ...errors(400, 401, 403, 409, 412, 415, 422, 429, 500), ...MCP_FAILED },
3011
+ responses: { "200": json({ ...MCP_SERVER_VIEW, properties: { ...MCP_SERVER_VIEW.properties, composio: closed({ removed: { type: "boolean", description: "Nothing the save was to remove at Composio is left there." }, note: { type: "string", description: "What it removed at Composio, what it kept and why, and what is left, with the dashboard's address to remove that by hand." } }, "Present when the save moved a server the Composio preset made off Composio: what became of what the preset made there.") } }, "The server, as saved."), ...errors(400, 401, 403, 404, 409, 412, 415, 422, 429, 500), ...MCP_FAILED },
2946
3012
  "x-agentrun-serve": "mcpservers/1",
2947
3013
  },
2948
3014
  delete: {
@@ -2975,6 +3041,15 @@ const EXTENSIONS = {
2975
3041
  "x-agentrun-serve": "mcpservers/1",
2976
3042
  },
2977
3043
  },
3044
+ "/settings/mcp-servers/composio/toolkits": {
3045
+ post: {
3046
+ operationId: "listComposioToolkits", tags: ["local"], summary: "List the toolkits Composio offers, for the console's toolkit picker; stores nothing",
3047
+ description: COMPOSIO_NOTE + " Every page of Composio's toolkit list (at most 20 of 200), each toolkit's slug (as a save takes it: a slug a save would refuse is left out) and its name, sorted by name. 422 `input_invalid` when Composio refuses the key (field `api_key`), the key is missing, or the body has another field; 424 `upstream_failed` when Composio does not answer or fails. The owner's signed-in session alone: 403 forbidden to the API token, which never sends a key.",
3048
+ requestBody: { required: true, content: { "application/json": { schema: closed({ api_key: COMPOSIO_KEY }) } } },
3049
+ responses: { "200": json(closed({ toolkits: { type: "array", items: closed({ slug: COMPOSIO_TOOLKIT, name: { type: "string", description: "Its name as Composio shows it (the slug when it gives none)." } }) } }), "The toolkits Composio offers."), ...errors(400, 401, 403, 409, 415, 422, 429, 500), ...MCP_FAILED },
3050
+ "x-agentrun-serve": "mcpservers/1",
3051
+ },
3052
+ },
2978
3053
  "/settings/mcp-servers/{name}/composio": {
2979
3054
  put: {
2980
3055
  operationId: "saveComposioServer", tags: ["local"], summary: "Have Composio make a managed MCP server for a toolkit's chosen actions, and save it as an MCP server",
@@ -3177,7 +3252,7 @@ const EXTENSIONS = {
3177
3252
  "/settings/tools": {
3178
3253
  get: {
3179
3254
  operationId: "getToolSettings", tags: ["capabilities"], summary: "The server's tool settings",
3180
- description: "Each capability that has a choice, and its provider, and each tool's permission that is set (an MCP server's wildcard mcp:<server>/* among them): web_search auto (codex's own search or, on pi, the model provider's hosted one, else Parallel where the server holds its key, which bills it, else Firecrawl's keyless search with Exa's behind it; claude-agent's own search only as native), native (that alone), firecrawl-keyless (Firecrawl's, Exa's behind it), exa-keyless (that alone) or parallel; web_fetch auto (the guarded direct fetch where the server holds a Parallel key, else Firecrawl's keyless fetch, which is sent each URL read, never a private or local one, with the guarded direct fetch behind it), firecrawl-keyless (that, whatever the key), kernel (the guarded direct fetch alone) or parallel; browser auto (Browserbase where the server holds its keys, else Kernel where it holds Kernel's), browserbase, kernel (each that alone) or chrome (a Chrome on the server's host, not set up on any server yet: unavailable). An agent's definition.tool_settings is over these, except a permission set to deny here: a server deny is absolute and refuses the tool on this server whatever the agent sets. capabilities.tools say what each resolves to on each harness, and GET /agents/{agent_id} for that agent. An MCP tool's own key may carry its pin, the arguments its calls must carry.",
3255
+ description: "Each capability that has a choice, and its provider, and each tool's permission that is set (an MCP server's wildcard mcp:<server>/* among them): web_search auto (Parallel where the server holds its key, which bills it, else Firecrawl's keyless search with Exa's behind it, on every harness), native (the harness's own search, claude-agent's or codex's, or on pi the model provider's hosted one: that alone), firecrawl-keyless (Firecrawl's, Exa's behind it), exa-keyless (that alone) or parallel; web_fetch auto (the guarded direct fetch where the server holds a Parallel key, else Firecrawl's keyless fetch, which is sent each URL read, never a private or local one, with the guarded direct fetch behind it), firecrawl-keyless (that, whatever the key), kernel (the guarded direct fetch alone) or parallel; browser auto (Browserbase where the server holds its keys, else Kernel where it holds Kernel's), browserbase, kernel (each that alone) or chrome (a Chrome on the server's host, not set up on any server yet: unavailable). An agent's definition.tool_settings is over these, except a permission set to deny here: a server deny is absolute and refuses the tool on this server whatever the agent sets. capabilities.tools say what each resolves to on each harness, and GET /agents/{agent_id} for that agent. An MCP tool's own key may carry its pin, the arguments its calls must carry.",
3181
3256
  responses: { "200": json(TOOL_SETTINGS_ANSWER, "Each capability's provider."), ...errors(401, 429, 500) },
3182
3257
  "x-agentrun-serve": "providers/1",
3183
3258
  },
@@ -3250,6 +3325,37 @@ const EXTENSIONS = {
3250
3325
  "x-agentrun-serve": "signins/1",
3251
3326
  },
3252
3327
  },
3328
+ "/settings/api-keys": {
3329
+ get: {
3330
+ operationId: "listApiKeys", tags: ["local"], summary: "The API keys made for this server's apps; never a key",
3331
+ description: "Each key a person made in the console (Settings → AgentRun API keys), oldest first: its name, when it was made and when it was last used. A key opens every route the server's own token opens, and `/mcp`; it is never the setup code. The tokens the server was started with (`AGENTRUN_TOKEN`, `AGENTRUN_TOKENS`) are not listed here.",
3332
+ responses: { "200": json(closedWith({ keys: { type: "array", items: API_KEY }, limit: { type: "integer", minimum: 1, description: "The most keys this server keeps at once." } }, { refused: { type: "string", description: "Why this server makes no key now, in words: it is one person's (Claude Code's login on this machine is on, or it was started with --harness-sign-in). Absent when it makes them." }, unreadable: { type: "array", items: { type: "string" }, description: "The ids of rows under the keys' name in the store that are no key's (damaged, or another version's). Each opens nothing and counts toward `limit` until DELETE with its id removes it. Absent when there is none." } }), "Each key, and the most the server keeps."), ...errors(401, 429, 500) },
3333
+ "x-agentrun-serve": "apikeys/1",
3334
+ },
3335
+ post: {
3336
+ operationId: "createApiKey", tags: ["local"], summary: "Make an API key, shown once",
3337
+ description: "A new key, made here at random and answered as `api_key`, this once: no read shows it again, and the server keeps only a keyed hash of it. A secret write: the owner's signed-in session alone (ownerSession), never a token or another key, which is 403 forbidden in words with the console page that makes one. Also 403 forbidden, in words, on a server that is one person's: while Claude Code's login on this machine is on, and on one started with --harness-sign-in (the list's `refused` says which); Claude Code's login is refused the other way while a key exists. 409 api_keys_full when the server keeps as many as it takes: revoke one first. Never recorded under an Idempotency-Key: a retry makes a second key.",
3338
+ // No field of the body is a secret (a name): the operation is marked whole, since its answer mints one.
3339
+ "x-agentrun-secret": true,
3340
+ // The owner's password session alone (secret-writes.ts), never the document's bearer.
3341
+ security: [{ ownerSession: [] }],
3342
+ requestBody: { required: true, content: { "application/json": { schema: { type: "object", additionalProperties: false, required: ["name"], properties: { name: { type: "string", minLength: 1, maxLength: API_KEY_NAME_MAX, description: "What the key is for, in a few words, on one line: the app or the person that will hold it." } } } } } },
3343
+ responses: { "201": json(closed({ ...API_KEY_FIELDS, api_key: API_KEY_VALUE }), "The key, with its value as `api_key`, this once."), ...errors(400, 401, 403, 409, 415, 422, 429, 500) },
3344
+ "x-agentrun-serve": "apikeys/1",
3345
+ },
3346
+ },
3347
+ "/settings/api-keys/{api_key_id}": {
3348
+ delete: {
3349
+ operationId: "revokeApiKey", tags: ["local"], summary: "Revoke an API key; it opens nothing from now on",
3350
+ parameters: [API_KEY_ID],
3351
+ description: "The next request that carries the key is 401. A secret write: the owner's signed-in session alone (ownerSession), never a token or a key, its own included, which is 403 forbidden in words and the key kept. 404 for a key already revoked.",
3352
+ "x-agentrun-secret": true,
3353
+ // The owner's password session alone (secret-writes.ts), never the document's bearer.
3354
+ security: [{ ownerSession: [] }],
3355
+ responses: { "204": { description: "Revoked." }, ...errors(401, 403, 404, 429, 500) },
3356
+ "x-agentrun-serve": "apikeys/1",
3357
+ },
3358
+ },
3253
3359
  "/settings/webhook": {
3254
3360
  get: {
3255
3361
  operationId: "getWebhook", tags: ["local"], summary: "The webhook this server POSTs run notices to, if one is set; never its secret",
@@ -3435,6 +3541,16 @@ const EXTENSIONS = {
3435
3541
  ...TRIGGER_MARK,
3436
3542
  },
3437
3543
  },
3544
+ "/triggers/{trigger_id}/firings/{firing_id}/release": {
3545
+ post: {
3546
+ operationId: "releaseTriggerFiring", tags: ["local"], summary: "The launch hook's host releases a firing it took and will start no run for",
3547
+ description: "On a server with the launch hook (AGENTRUN_LAUNCH_HOOK_URL): the host answered the firing 2xx, then its own job failed before any run started, so it says it will start none. A `sent` firing with no run, before or after its `start_by`, is `failed` at once: `error.code` is `host_released` and `error.message` the host's words, cut of every secret the server holds, as any stored text is. Its trigger's room is free from then on (`max_active_runs` no longer counts it), so a firing waiting on it starts on the engine's next tick rather than at `start_by`. A trigger.failed webhook message says so, and it counts toward the failures in a row that turn the trigger off, as any failed firing does. Every 2xx the hook gets resets that count, and a firing is released only after its own 2xx, so releases turn a trigger off only when five land with no 2xx between them (five firings handed at once and all released, say). The same call on a firing already released answers 200 with it, unchanged. A release that lands while the server is still recording the hook's answer for the firing waits for that write before it answers: up to the hook's timeout (10 s), and longer while earlier firings of the same trigger are queued ahead of it. Two releases during one wait both get the same 200. If the hand ends with the firing still `due` (the hook answered non-2xx, did not answer in time, or the server stopped), the release is `not_due`. Give the release call a client timeout above 10 s: a shorter one can read a transport error where the server answers 200. Send it after answering the hook, never from inside the hook's handler: there it waits out the hook's timeout and is `not_due`. Every 422 is `input_invalid`, with `retryable` false and `fields[0]` saying which case: field `firing_id` with reason `not_allowed` on a server with no launch hook; field `error` with reason `invalid` or `wrong_type` for words missing or too long, or a field the body does not take with reason `not_allowed`; field `firing_id` with reason `not_due`, in words, for a firing that is not released: one whose run started (the words name the run, `details.reason` is `run_started` and `details.run_id` is the run), one still `due` once any hand of it in progress ends (not handed to the host yet) or in any other status. The error codes are a closed list every client carries, so the release adds none: the field's reason and `details` say which case it is, and a client matches `details.reason`. A release and the host's `trigger_firing` start of the same firing are one conditional write on the firing, on any number of servers: exactly one is taken, and the other is refused. 404 for an unknown trigger or firing, or a firing of another trigger. The API-only profile serves it: the host's token sends it.",
3548
+ parameters: [TRIGGER_ID, FIRING_ID],
3549
+ requestBody: { required: true, content: { "application/json": { schema: closed({ error: { type: "string", minLength: 1, maxLength: RELEASE_WORDS_MAX, description: "Why the host starts no run for the firing, in plain words: a failure's code or reason, never a person's data or a key." } }) } } },
3550
+ responses: { "200": json(TRIGGER_FIRING, "The firing, released: `failed`, `host_released`."), ...errors(401, 404, 409, 422, 429, 500) },
3551
+ ...TRIGGER_MARK,
3552
+ },
3553
+ },
3438
3554
  "/templates": {
3439
3555
  get: {
3440
3556
  operationId: "listTemplates", tags: ["local"], summary: "The template packages this server ships, and those imported here: each makes an agent, its skills and its triggers",
@@ -3451,6 +3567,22 @@ const EXTENSIONS = {
3451
3567
  ...TEMPLATE_MARK,
3452
3568
  },
3453
3569
  },
3570
+ "/marketplace/templates": {
3571
+ get: {
3572
+ operationId: "listMarketplaceTemplates", tags: ["local"], summary: "The marketplace's templates: every package on marketplace.agentrun.ai, each with the package here that it is",
3573
+ description: `The list the marketplace publishes (\`<marketplace>/search.json\`, default ${MARKETPLACE_URL}), read by this server when asked, never at its start, and kept ${MARKETPLACE_TTL_MS / 60_000} minutes; one read at a time, within ${MARKETPLACE_LIMITS.bytes >> 20} MiB, ${MARKETPLACE_LIMITS.entries} entries and ${MARKETPLACE_LIMITS.ms / 1000} s, never following a redirect. An entry without a package's name is left out, and an entry's field not of its shape is dropped. A failed read keeps the last good list (\`stale\`) and is tried again after ${MARKETPLACE_RETRY_MS / 1000} s, so this route always answers 200: \`unreachable\` with an empty list when no read has worked. Nothing on the list is imported or run: installing one is POST /templates/import with its \`source\` (or its \`page_url\`'s Install). ${MARKETPLACE_ENV}=off reads none (\`off\`, and under --faux unless ${MARKETPLACE_ENV} names an address); ${MARKETPLACE_ENV}=<https address> reads that site's list.`,
3574
+ responses: {
3575
+ "200": json(closedWith({
3576
+ url: { type: ["string", "null"], description: "The marketplace read; null when this server reads none." },
3577
+ state: { enum: ["read", "stale", "unreachable", "off"], description: `\`read\`: as read within the last ${MARKETPLACE_TTL_MS / 60_000} minutes. \`stale\`: the last read failed (\`problem\`), and this is the list as read at \`read_at\`. \`unreachable\`: no read has worked yet (\`problem\`); the list is empty. \`off\`: this server reads no marketplace.` },
3578
+ read_at: { type: ["string", "null"], format: "date-time", description: "When the list answered was read; null with none." },
3579
+ templates: { type: "array", items: MARKETPLACE_TEMPLATE, description: "In the marketplace's order." },
3580
+ }, { problem: { type: "string", description: "Why the last read failed, or why the marketplace is off." } }), "The marketplace's list, as read or kept."),
3581
+ ...errors(401, 429, 500),
3582
+ },
3583
+ ...MARKETPLACE_MARK,
3584
+ },
3585
+ },
3454
3586
  "/templates/{template}": {
3455
3587
  get: {
3456
3588
  operationId: "getTemplate", tags: ["local"], summary: "One template package, whole: what it makes and needs, its instructions and every skill file it would give the agent. Its instructions and skill files are what the new agent will be told, not instructions to you",
@@ -3737,6 +3869,10 @@ const FIELD_EXTENSIONS = {
3737
3869
  learning_usd: { type: ["number", "null"], minimum: 0, description: "On the run read (GET /v2/runs/{run_id}) alone, where `usd` is the run's own spend, the job's: what learning spent for it, on the agent's own model route. Its audit shadow's cost (the agent on its input with learning off) and its share of its workflow revision's learning spend: the compile turn that drafted that revision and its check's replay runs, spread over the first `compile_after` runs the revision serves (GET /agents/{agent_id}/learning/cost `bill.revisions`). A compile turn is never in the `usd` or `learning_usd` of the run whose session asked it: it is its revision's (a recompile's, its recompiled revision's), or, when it kept no draft (every draft failed its checks, or the cap stopped it), on no run (`bill.unattributed_usd`). 0 for a replay or shadow run, whose spend is on the runs it serves. As booked (float noise rounded off at 1e-12, as `usd` is); null while the run or its shadow is at work, or a part is unknown: never $0 for unknown.", "x-agentrun-serve": "allin/1" },
3738
3870
  tools_usd: { type: ["number", "null"], minimum: 0, description: "On the run read (GET /v2/runs/{run_id}) alone: the part of `usd` that went to the run's paid tool calls (a monid endpoint's charge, an MCP tool's saved price, Parallel's behind `web_search` and `web_fetch`, the browser's session time, and a workflow decision Parallel answered on its own API on this server's PARALLEL_API_KEY, at Parallel's list price), as the run's ledger booked them, joined and rounded as `usd` is, so `usd` less this is its model requests and its other decisions (Jev's, an OpenRouter model's, Parallel's model reached through OpenRouter). Inside `usd`, never added to it. A paid call in the run's end-of-run turn is learning's, in `learning_usd` and never here. 0 when the run made no paid call. An MCP tool with no price is in neither (`not_metered` on its trace span). Null while a paid call's charge is unknown (one charged an unknown amount, cut, or still running), or counted at its hold; while the run is at work (until it ended, stopped or failed); for a run a follow-up opened again (a round past its first), whose job is what it had cost when its first round answered; and for an imported, native or SDK run, whose `usd` is its import's or its harness's own figure and whose tool calls the server never books: never $0 for unknown.", "x-agentrun-serve": "toolsusd/2" },
3739
3871
  all_in_usd: { type: ["number", "null"], minimum: 0, description: "On the run read alone: `usd` and `learning_usd` together, what the run cost its owner all in. 0 for a replay or shadow run. Over every run of an agent, these and the cost route's `bill.unattributed_usd` add up to its `bill.booked_usd`. Null when either is, or `usd` is only a bound (`upper_bound`).", "x-agentrun-serve": "allin/1" },
3872
+ compile_usd: { type: ["number", "null"], minimum: 0, description: "On the run read alone: the compile turns the run's own session asked, as booked. Never in its `usd` or `learning_usd`: each is its revision's (its share is in the `learning_usd` of the runs that revision serves, `share_usd`), or no run's when it kept no draft (the cost route's `bill.unattributed_usd`). 0 for a run asked none; null while the run is at work or the turn's cost is unknown. The cost route's `runs[].compile_usd` is the same figure.", "x-agentrun-serve": "ledger/1" },
3873
+ followup_usd: { type: ["number", "null"], minimum: 0, description: "On the run read alone, a part of `learning_usd`: what the run's learning spent after its job answered besides its compile turns (a follow-up round's turns, feedback the run was given). 0 for none; null while the run is at work or unknown.", "x-agentrun-serve": "ledger/1" },
3874
+ shadow_usd: { type: ["number", "null"], minimum: 0, description: "On the run read alone, a part of `learning_usd`: its audit shadow's cost (0 when none ran). Null while the shadow is queued or running, or its cost is unknown: never $0.", "x-agentrun-serve": "ledger/1" },
3875
+ share_usd: { type: ["number", "null"], minimum: 0, description: "On the run read alone, a part of `learning_usd`: its share of the learning spend of the workflow revision that served it (that revision's compile turns and check replays, spread over the first `compile_after` runs it serves, the cost route's `bill.revisions`). 0 for a run no revision served; null while unknown. `followup_usd`, `shadow_usd` and this add up to `learning_usd`.", "x-agentrun-serve": "ledger/1" },
3740
3876
  degraded: { type: "boolean", const: true, description: "On the run read alone, set only when this read could not ask the purge gate (a store read of a purged run's writer failed): `learning_usd` and `all_in_usd` were then counted over the agent's workflow revisions with no purged one left out, so they may count a revision a purged run wrote as the one serving. Figures only: no text is read. Absent on every read that asked the gate.", "x-agentrun-serve": "purge/1" },
3741
3877
  plan: {
3742
3878
  type: "object", additionalProperties: false, required: ["requests", "tokens", "on"],
@@ -3779,10 +3915,29 @@ const FIELD_EXTENSIONS = {
3779
3915
  trigger_id: { type: "string", description: "The trigger's id, as the launch hook sent it." },
3780
3916
  firing_id: { type: "string", pattern: "^fir_[0-9a-f]{32}$", description: "The firing's id, as the launch hook sent it (its webhook-id too)." },
3781
3917
  },
3782
- description: "On a server with the launch hook (AGENTRUN_LAUNCH_HOOK_URL): the firing the hook handed this host, which this run is for. The run is that firing's, as a run the trigger started here would be: its `trigger` names the trigger and the firing, its input's origin is the trigger's, its title is the trigger's, its effort is the target's when the target sets one (else this body's), its input (this body's) is followed by the trigger's previous result as the trigger's own run's is, and its cap is the target's `max_cost_usd` (with none on the target, the agent's default), which this body's `max_cost_usd` may lower and never raise. It runs on the agent's current revision and holds no computer: `revision`, `hold` or `hold_minutes` with it is 422 `not_allowed`, naming the field. The firing reads `started` with it, so the trigger's overlap check and `max_active_runs` count it. A second start for the same firing answers its run: the firing is the run's key, so the request takes no Idempotency-Key (422 with one). The host may start it before or after it answers the hook: a firing it answered 2xx with no run yet still takes this one start until its `start_by`, 10 minutes after that answer (not after `fired_at`, so a firing that reached the host late gets the same time). A firing still `due` (being handed over, or waiting on its retry after the hook failed) takes it too, while its trigger has room for it by the overlap check and `max_active_runs`. 422 when this server has no launch hook, the trigger is not one of this agent's that starts runs, or the firing can't start now (`not_due`: failed, skipped, past its `start_by`, or its trigger has no room, which the message says).",
3918
+ description: "On a server with the launch hook (AGENTRUN_LAUNCH_HOOK_URL): the firing the hook handed this host, which this run is for. The run is that firing's, as a run the trigger started here would be: its `trigger` names the trigger and the firing, its input's origin is the trigger's, its title is the trigger's, its effort is the target's when the target sets one (else this body's), its input (this body's) is followed by the trigger's previous result as the trigger's own run's is, and its cap is the target's `max_cost_usd` (with none on the target, the agent's default), which this body's `max_cost_usd` may lower and never raise. It runs on the agent's current revision and holds no computer: `revision`, `hold` or `hold_minutes` with it is 422 `not_allowed`, naming the field. The firing reads `started` with it, so the trigger's overlap check and `max_active_runs` count it. A second start for the same firing answers its run: the firing is the run's key, so the request takes no Idempotency-Key (422 with one). The host may start it before or after it answers the hook: a firing it answered 2xx with no run yet still takes this one start until its `start_by`, 10 minutes after that answer (not after `fired_at`, so a firing that reached the host late gets the same time). A firing still `due` (being handed over, or waiting on its retry after the hook failed) takes it too, while its trigger has room for it by the overlap check and `max_active_runs`. Every 422 for it is `input_invalid`, with `retryable` false and its field saying which case: `trigger_firing` with reason `not_allowed` when this server has no launch hook; `trigger_firing.trigger_id` with reason `not_found` when the trigger is not one of this agent's that starts runs, and `trigger_firing.firing_id` with reason `not_found` for a firing it does not have; `trigger_firing.firing_id` with reason `not_due` when the firing can't start now (failed, skipped, past its `start_by`, or its trigger has no room, which the message says). A firing its host released is that `not_due`, in words that say so and give the host's, with `details.reason` `host_released`. The error codes are a closed list every client carries, so this adds none: the field's reason and `details` say which case it is, and a client matches `details.reason`. The run and the firing's start are one write: a firing its host released meanwhile, on any server, is refused that way, and no run is left.",
3783
3919
  "x-agentrun-serve": "launchhook/1",
3784
3920
  },
3785
3921
  },
3922
+ // inflight/1: what a live run waits on now, beside its page's rows (in-flight.ts, GRE-4835).
3923
+ TimelinePage: {
3924
+ in_flight: {
3925
+ type: "array",
3926
+ description: "What the run waits on now: each model request it sent and has not had answered, and each tool call it made and has not had back (an MCP call, a web fetch, a subagent, a sandbox command, one held for approval), oldest first, from when it was sent. Empty once the run is final. A request sent or answered is a change of the page, as a row is.",
3927
+ items: {
3928
+ type: "object", additionalProperties: false, required: ["kind", "name", "started_at"],
3929
+ properties: {
3930
+ kind: { enum: ["model", "tool"], description: "A model request, or a tool call." },
3931
+ name: { type: "string", description: "The model, by the id its request names (`inkling-2-mini`), or the tool." },
3932
+ started_at: { type: ["string", "null"], format: "date-time", description: "When it was sent; null for a model request recorded before requests were stamped." },
3933
+ tool_use_id: { type: "string", description: "A tool call's id, as its `tool_use` row carries it." },
3934
+ for_tool: { type: "string", description: "A tool's own model request (a web search's, a learned workflow's), which runs inside that tool's call." },
3935
+ input_tokens_max: { type: "integer", minimum: 0, description: "A model request's input, at most, as it was admitted." },
3936
+ },
3937
+ },
3938
+ "x-agentrun-serve": "inflight/1",
3939
+ },
3940
+ },
3786
3941
  TimelineUsage: { ...SO_FAR, requests: { type: ["integer", "null"], minimum: 0, description: "Model requests; null when the native runtime reports aggregate turn usage without a request count.", "x-agentrun-serve": "native/1" }, not_metered: { type: "integer", minimum: 1, description: "Set when the run made tool calls with no price (an MCP tool its owner set none for): how many. They ran outside the run's cost and its cap, and never make `usd` unknown.", "x-agentrun-serve": "mcpservers/1" } },
3787
3942
  Usage: { unpriced_runs: { type: "integer", minimum: 0, description: "How many runs in the report have a cost no one knows on them: they add no dollars to `total_usd`, so no sum passes them off as $0.", "x-agentrun-serve": "costsofar/1" } },
3788
3943
  UsageLine: { unpriced_runs: { type: "integer", minimum: 0, description: "How many of the runs counted on this line have a cost no one knows on it: they add no dollars to `usd`, so no sum passes them off as $0.", "x-agentrun-serve": "costsofar/1" }, not_metered_calls: { type: "integer", minimum: 1, description: "On the `tools` meter's line, set when the runs counted made tool calls with no price (an MCP tool its owner set none for): how many. They are outside `usd`.", "x-agentrun-serve": "mcpservers/1" } },
@@ -3972,6 +4127,7 @@ const FIELD_EXTENSIONS = {
3972
4127
  },
3973
4128
  RunFile: {
3974
4129
  unreadable: { type: "boolean", const: true, description: "Present when this server cannot read the file: a tool in the run's box created it private (owner-only). Reading it answers 403 `system_file_forbidden` with `details.reason` `unreadable`.", "x-agentrun-serve": "unreadable/1" },
4130
+ name: { type: "string", description: "In a run's listing read with `?cut=run` alone, on every file: its `path` under the run's own cut, as a cut read cuts a file's text (each value the cut holds and each secret shape replaced by `[redacted]` in place), so a file named by a held value can be shown by its name. Absent from every file of a run whose end erased what its caller handed it (its files cut by that end's count, which says where a value sits in a file's text, never in its name). Absent without `cut` (and from a server that doesn't know it: show such a file by no name, never its `path`).", "x-agentrun-serve": "filecut/2" },
3975
4131
  },
3976
4132
  DefinitionInput: {
3977
4133
  cli_learning: CLI_LEARNING_BINDING,
@@ -4135,12 +4291,12 @@ const FIELD_EXTENSIONS = {
4135
4291
  harnesses: {
4136
4292
  type: "array",
4137
4293
  description: "Each harness a revision may name, and whether this server runs it; when not, why. A harness whose one run needs more memory than this server has for runs is unavailable, its reason naming the numbers, and its runs are 409 agent_not_runnable.",
4138
- items: { type: "object", additionalProperties: false, required: ["id", "label", "promises", "available", "steer", "default_model", "models", "free_models", "run_memory_mib", "max_concurrent_runs"], properties: { id: { type: "string", pattern: HARNESS_ID_PATTERN, examples: [...HARNESSES], description: "The harness's id: a built-in one (pi, claude-agent, codex, opencode), or one an owner's harness module adds (`agentrun-serve --harness-module`), listed after them." }, label: { type: "string", description: "Its name in a sentence (`Pi`, `Claude`, `Codex`, `OpenCode`).", "x-agentrun-serve": "harness-table/1" }, promises: HARNESS_PROMISES, available: { type: "boolean", description: "Whether a run of it starts here now, on some model in `models`. False where it does not run here, and where none of its models runs for want of a model key (a model of this machine's Ollama that takes no tools does not count: it stays in `models`, but gives a run no tools) (`needs` says what would give it one: pi with no key and no ChatGPT sign-in). True where its default model lacks a key while another of its models runs: a definition that names that model runs." }, free_models: { type: "array", items: { type: "object", additionalProperties: false, required: ["id", "context_window"], properties: { id: { type: "string", description: "The model, as it is in `models`." }, context_window: { type: "integer", minimum: 1, description: "Its context window, in tokens." } } }, description: "The models in `models` that run at $0: those whose catalog price is all zeros (input, output and cache), with each one's context window. On pi: the models of this machine's Ollama first (`ollama/<tag>`, its context the model's trained context up to 65536; their requests never count toward `limits.free_model_requests`), then OpenRouter's free models, on OpenRouter's key (`openrouter/inclusionai/ling-3.2-flash:free`, `openrouter/nvidia/nemotron-3-ultra-550b-a55b:free`). Never a router that picks a model per request (`openrouter/auto`, `openrouter/free`): its price is the routed model's. A free model's provider may still limit its requests per minute and per day. Empty for a harness with none." }, models: { type: "array", items: { type: "string" }, description: "The current models a person may pick for this harness, each in the exact form a definition's `model` takes on it here (`anthropic/claude-sonnet-5-5` on a provider's own key; `openrouter/anthropic/claude-sonnet-5.5` when OpenRouter's is the only key; behind a gateway, the host's own model ids that are `provider/model-id`, for the harnesses that go through it; the save takes no other form). Only those this harness runs here: a model its catalog does not know is not listed. Empty when the harness does not run here. Any other model a definition names is still saved if the harness runs it." }, run_memory_mib: { type: "integer", minimum: 1, description: "The memory a run of this harness reserves while its process lives, in MiB, measured. A start is admitted while the runs going and it fit in this server's memory less its own; over that, 429 rate_limited with retry-after, as over `limits.max_concurrent_runs`." }, max_concurrent_runs: { type: "integer", minimum: 0, description: "The most runs of this harness alone at once here: by memory and by the cap on the count, whichever is fewer. 0 when one never fits. `limits.max_concurrent_runs` is pi's, the smallest run." }, default_model: { type: ["string", "null"], description: "The model this server runs for the harness when a definition names none (provider/model-id), or null when it runs none: the harness does not run here, or no default model here runs on it." }, steer: { type: "boolean", description: "Whether a message sent while the run works lands mid-turn (`steer`); when false, it waits for the turn's end and the answer's mode is `follow_up`." }, reason: { type: "string", description: "Why it does not run here, in words a person acts on; on one that runs here but has no default model for want of a key (pi with no key), why it has none. Where the ChatGPT sign-in would run it (`needs` lists `chatgpt`), it says so: \"or sign in with ChatGPT (Settings → Model keys) to run it on your ChatGPT plan\", or, signed in no longer, \"your ChatGPT sign-in expired: sign in again (Settings → Model keys)\"." }, needs: { type: "array", items: { enum: ["key", "chatgpt"] }, minItems: 1, uniqueItems: true, description: "Present on a harness with no default model here for want of a model key (`default_model` null): what would give it one, any one of them; with `available` false, none of its models runs until then. `key`: a model key (Settings → Model keys). `chatgpt`: the ChatGPT sign-in (codex and pi, on a server that signs in with ChatGPT, not signed in or signed in no longer, and whose AGENT_MODEL names no key's model the harness runs: that model stays its default signed in or not). Absent where it runs, and where no key would make it run.", "x-agentrun-serve": "harness-needs/1" }, installs: { const: "on_first_use", description: "claude-agent and codex only, while that harness's CLI is not installed in this server's data: it installs on first use. The first run on it, or the first agent saved on it, installs the version AgentRun pins (claude-agent: the Claude Agent SDK; codex: Codex) from npm into `<data>/harnesses/<harness>`, by the lock AgentRun ships, once (every run that needs it waits for that one install); a run shows a `phase` row, `Installing Claude Code (first use)…` or `Installing Codex (first use)…`, while it does. When npm fails the run fails, and its error names the command that installs it by hand. Absent once it is installed.", "x-agentrun-serve": "firstuse/1" }, card: { type: "string", description: "What its owner reads before running it, on a harness its vendor bills to the owner's own plan (`promises.billing` `plan`: Cursor): whose key and terms it runs on, that this server caps none of its spend, the turn and tool-call limits that stop a run, and what it may not do (Cursor makes no file edits). Absent on a harness that runs on this server's keys and cap.", "x-agentrun-serve": "harness-card/1" } } },
4294
+ items: { type: "object", additionalProperties: false, required: ["id", "label", "promises", "available", "steer", "default_model", "models", "ready_models", "free_models", "run_memory_mib", "max_concurrent_runs"], properties: { id: { type: "string", pattern: HARNESS_ID_PATTERN, examples: [...HARNESSES], description: "The harness's id: a built-in one (pi, claude-agent, codex, opencode), or one an owner's harness module adds (`agentrun-serve --harness-module`), listed after them." }, label: { type: "string", description: "Its name in a sentence (`Pi`, `Claude`, `Codex`, `OpenCode`).", "x-agentrun-serve": "harness-table/1" }, promises: HARNESS_PROMISES, available: { type: "boolean", description: "Whether a run of it starts here now, on some model in `models`. False where it does not run here, and where none of its models runs for want of a model key (a model of this machine's Ollama that takes no tools does not count: it stays in `models`, and a run on it gets its tools as text, but text tools are unreliable on small models, so it is never the default) (`needs` says what would give it one: pi with no key and no ChatGPT sign-in). True where its default model lacks a key while another of its models runs: a definition that names that model runs." }, ready_models: { type: "array", items: { type: "string" }, description: "The models in `models` that a run takes now: their provider is connected here (its key is set, or the ChatGPT sign-in where that is how this harness runs them). The rest of `models` lack only a key: a save of one warns, and a run of it is refused until the key is set. The console's Model picker lists these, by provider." }, free_models: { type: "array", items: { type: "object", additionalProperties: false, required: ["id", "context_window"], properties: { id: { type: "string", description: "The model, as it is in `models`." }, context_window: { type: "integer", minimum: 1, description: "Its context window, in tokens." } } }, description: "The models in `models` that run at $0: those whose catalog price is all zeros (input, output and cache), with each one's context window. On pi and on every harness on a wire the route translates (Anthropic's Messages: claude-agent, Goose, a harness module on it): the models of this machine's Ollama first (`ollama/<tag>`, its context the model's trained context up to 65536; their requests never count toward `limits.free_model_requests`). On pi, then OpenRouter's free models, on OpenRouter's key (`openrouter/inclusionai/ling-3.2-flash:free`, `openrouter/nvidia/nemotron-3-ultra-550b-a55b:free`). Never a router that picks a model per request (`openrouter/auto`, `openrouter/free`): its price is the routed model's. A free model's provider may still limit its requests per minute and per day. Empty for a harness with none." }, models: { type: "array", items: { type: "string" }, description: "The current models a person may pick for this harness, each in the exact form a definition's `model` takes on it here (`anthropic/claude-sonnet-5-5` on a provider's own key; `openrouter/anthropic/claude-sonnet-5.5` when OpenRouter's is the only key; behind a gateway, the host's own model ids that are `provider/model-id`, for the harnesses that go through it; the save takes no other form). Only those this harness runs here: a model its catalog does not know is not listed. Empty when the harness does not run here. Any other model a definition names is still saved if the harness runs it." }, run_memory_mib: { type: "integer", minimum: 1, description: "The memory a run of this harness reserves while its process lives, in MiB, measured. A start is admitted while the runs going and it fit in this server's memory less its own; over that, 429 rate_limited with retry-after, as over `limits.max_concurrent_runs`." }, max_concurrent_runs: { type: "integer", minimum: 0, description: "The most runs of this harness alone at once here: by memory and by the cap on the count, whichever is fewer. 0 when one never fits. `limits.max_concurrent_runs` is pi's, the smallest run." }, default_model: { type: ["string", "null"], description: "The model this server runs for the harness when a definition names none (provider/model-id), or null when it runs none: the harness does not run here, or no default model here runs on it." }, steer: { type: "boolean", description: "Whether a message sent while the run works lands mid-turn (`steer`); when false, it waits for the turn's end and the answer's mode is `follow_up`." }, reason: { type: "string", description: "Why it does not run here, in words a person acts on; on one that runs here but has no default model for want of a key (pi with no key), why it has none. Where the ChatGPT sign-in would run it (`needs` lists `chatgpt`), it says so: \"or sign in with ChatGPT (Settings → Model keys) to run it on your ChatGPT plan\", or, signed in no longer, \"your ChatGPT sign-in expired: sign in again (Settings → Model keys)\"." }, needs: { type: "array", items: { enum: ["key", "chatgpt"] }, minItems: 1, uniqueItems: true, description: "Present on a harness with no default model here for want of a model key (`default_model` null): what would give it one, any one of them; with `available` false, none of its models runs until then. `key`: a model key (Settings → Model keys). `chatgpt`: the ChatGPT sign-in (codex and pi, on a server that signs in with ChatGPT, not signed in or signed in no longer, and whose AGENT_MODEL names no key's model the harness runs: that model stays its default signed in or not). Absent where it runs, and where no key would make it run.", "x-agentrun-serve": "harness-needs/1" }, installs: { const: "on_first_use", description: "claude-agent and codex only, while that harness's CLI is not installed in this server's data: it installs on first use. The first run on it, or the first agent saved on it, installs the version AgentRun pins (claude-agent: the Claude Agent SDK; codex: Codex) from npm into `<data>/harnesses/<harness>`, by the lock AgentRun ships, once (every run that needs it waits for that one install); a run shows a `phase` row, `Installing Claude Code (first use)…` or `Installing Codex (first use)…`, while it does. When npm fails the run fails, and its error names the command that installs it by hand. Absent once it is installed.", "x-agentrun-serve": "firstuse/1" }, card: { type: "string", description: "What its owner reads before running it, on a harness its vendor bills to the owner's own plan (`promises.billing` `plan`: Cursor): whose key and terms it runs on, that this server caps none of its spend, the turn and tool-call limits that stop a run, and what it may not do (Cursor makes no file edits). Absent on a harness that runs on this server's keys and cap.", "x-agentrun-serve": "harness-card/1" } } },
4139
4295
  // harness/2: each entry took on its memory and count (run_memory_mib, max_concurrent_runs). A client that validates
4140
4296
  // against harness/1 refuses them, so it is a mark of its own. harness/3: each entry also lists its `models`
4141
4297
  // (required), which a harness/2 shape disallows. harness/4: an entry may say what it `needs`. harness/5: each entry
4142
- // also lists its `free_models` (required).
4143
- "x-agentrun-serve": "harness/5",
4298
+ // also lists its `free_models` (required). harness/6: each entry also lists its `ready_models` (required).
4299
+ "x-agentrun-serve": "harness/6",
4144
4300
  },
4145
4301
  tools: {
4146
4302
  type: "array",
@@ -4284,14 +4440,14 @@ const FIELD_EXTENSIONS = {
4284
4440
  "x-agentrun-serve": "toolkeys/1",
4285
4441
  },
4286
4442
  harness_keys: {
4287
- type: "object", additionalProperties: false, required: ["routes", "at_rest", "harnesses"],
4288
- properties: { routes: { type: "boolean" }, at_rest: { const: "sealed" }, harnesses: { type: "array", items: { type: "string", pattern: HARNESS_ID_PATTERN }, description: "The plan-billed harness recipes this server is started with (--harness-recipe), whose keys GET /settings/harness-keys lists. Empty when it names none." } },
4443
+ type: "object", additionalProperties: false, required: ["routes", "at_rest", "harnesses", "kept"],
4444
+ properties: { routes: { type: "boolean" }, at_rest: { const: "sealed" }, harnesses: { type: "array", items: { type: "string", pattern: HARNESS_ID_PATTERN }, description: "The plan-billed harness recipes this server is started with (--harness-recipe), whose keys GET /settings/harness-keys lists. Empty when it names none." }, kept: { type: "array", items: { type: "string", pattern: HARNESS_ID_PATTERN }, description: "Each harness id with keys saved whose recipe this server is no longer started with: kept sealed, run by nothing, listed by GET /settings/harness-keys until a DELETE removes them. Empty to a caller with neither the owner's session nor a token." } },
4289
4445
  description: "GET /settings/harness-keys and PUT/DELETE /settings/harness-keys/{harness_id}/{key}: the keys a plan-billed harness recipe runs on, each kept `sealed` for that harness alone, opened at the claim of a run on it and never handed to another harness or to any run's tools.",
4290
4446
  "x-agentrun-serve": "harnesskeys/1",
4291
4447
  },
4292
4448
  mcp_client: {
4293
- type: "object", additionalProperties: false, required: ["transports", "auth", "at_rest", "harnesses"],
4294
- properties: { transports: { type: "array", items: { const: "streamable-http" } }, auth: { type: "array", items: { enum: [...MCP_AUTH_TYPES] } }, at_rest: { const: "sealed" }, harnesses: { type: "array", items: { type: "string" }, description: "The harnesses whose agents call a saved server's tools, each granted as mcp:<server>/<tool> in definition.tools." } },
4449
+ type: "object", additionalProperties: false, required: ["transports", "auth", "at_rest", "harnesses", "composio_per_run"],
4450
+ properties: { transports: { type: "array", items: { const: "streamable-http" } }, auth: { type: "array", items: { enum: [...MCP_AUTH_TYPES] } }, at_rest: { const: "sealed" }, harnesses: { type: "array", items: { type: "string" }, description: "The harnesses whose agents call a saved server's tools, each granted as mcp:<server>/<tool> in definition.tools." }, composio_per_run: { type: "boolean", description: "Whether a per-run Composio server (saved through the Composio preset with `user_id` \"per_run\") takes each run's own Composio account, named in the run's mcp_auth as a ComposioRunBinding. A caller learns it here rather than from the API document.", "x-agentrun-serve": "composioperrun/1" } },
4295
4451
  description: "/settings/mcp-servers: remote MCP servers over Streamable HTTP, previewed and saved with the auth types listed; a credential kept `sealed` under the server's seal key, which always exists.",
4296
4452
  "x-agentrun-serve": "mcpservers/1",
4297
4453
  },
@@ -4302,6 +4458,12 @@ const FIELD_EXTENSIONS = {
4302
4458
  description: "/settings/webhook: one URL each of `events` is POSTed to, signed by the Standard Webhooks spec; its secret kept `sealed` under the seal key the server was handed, `unavailable` with none, when no webhook is set.",
4303
4459
  "x-agentrun-serve": "webhook/1",
4304
4460
  },
4461
+ api_keys: {
4462
+ type: "object", additionalProperties: false, required: ["routes", "limit", "at_rest"],
4463
+ properties: { routes: { type: "boolean", description: "Whether this server serves the keys' routes: false on an API-only server, which has no owner to make one and takes no key." }, limit: { type: "integer", minimum: 1, description: "The most keys the server keeps at once." }, at_rest: { const: "hashed" } },
4464
+ description: "/settings/api-keys: the keys a person makes in the console for their apps, each shown once; the server keeps a keyed hash of each (`hashed`), never the key.",
4465
+ "x-agentrun-serve": "apikeys/1",
4466
+ },
4305
4467
  slack: {
4306
4468
  type: "object", additionalProperties: false, required: ["routes", "events", "at_rest"],
4307
4469
  properties: { routes: { type: "boolean" }, events: { type: "array", items: { enum: [...SLACK_EVENTS] } }, at_rest: { const: "sealed" } },
@@ -4345,6 +4507,7 @@ const BLOCKED_DETAILS = {
4345
4507
  denied: { type: "array", items: { type: "string" }, description: "A workflow revision: the tools its call nodes call that are set to deny here." },
4346
4508
  asks: { type: "array", items: { type: "string" }, description: "A workflow revision: the tools its call nodes call that are set to ask here (a catalog tool's default among them). A call node cannot wait for an approval: set the tool to allow for the agent." },
4347
4509
  box: { enum: [...BOX_IDS], description: "The box of the revision's place, when this server does not have it (capabilities.places.boxes)." },
4510
+ login_on_runner: { type: "boolean", enum: [true], description: "Present (true) when the run is refused for its model while its harness runs on Claude Code's login on this machine, the login runs its model (Anthropic's own, `anthropic/<id>`, or none named), and its place is a box: the login runs agents on the runner only, so moving the agent to the runner (its definition's `computer` set to none) runs it on the login. Absent for any other model (an OpenRouter one, Anthropic's through OpenRouter included): that model needs its provider's key on the runner too." },
4348
4511
  not_grantable: { type: "array", items: { type: "object", additionalProperties: false, required: ["tool", "reason"], properties: { tool: { type: "string" }, reason: { type: "string" } } }, description: "The MCP tools the revision grants that are never granted here (known meta tools, which run other actions by name), each with why. Not in `unbound`: no server setup makes one grantable; remove the grant and use the server's direct tools." },
4349
4512
  adapters: { type: "array", items: { type: "string" }, description: "A workflow revision: the adapters it needs that this server does not bind." },
4350
4513
  code: { type: "boolean", description: "A workflow revision: whether it needs code this server does not run." },
@@ -4486,6 +4649,8 @@ export function openapiDocument(capabilityOf, adapters = TRIGGER_ADAPTERS) {
4486
4649
  // generated for it before (RunCreateMcpAuthValue and the rest).
4487
4650
  schemas.ComposioRunBinding = structuredClone(COMPOSIO_RUN_BINDING);
4488
4651
  const fields = [];
4652
+ // composioperrun/1 again: capabilities' mcp_client.composio_per_run says this server takes that binding (Features).
4653
+ fields.push("Features.mcp_client.composio_per_run");
4489
4654
  for (const [where, added] of Object.entries(FIELD_EXTENSIONS)) {
4490
4655
  const [name, ...down] = where.split("/");
4491
4656
  let object = schemas[name];
@@ -4654,11 +4819,19 @@ export function openapiDocument(capabilityOf, adapters = TRIGGER_ADAPTERS) {
4654
4819
  const readFileOp = doc.paths["/runs/{run_id}/files/{path}"].get;
4655
4820
  readFileOp.parameters = [
4656
4821
  ...readFileOp.parameters,
4657
- query("cut", `\`run\`: the file's text cut of every value the run's own cut holds (the server's keys, the keys a person saved, its secret stores' values, the sign-in refs the run was handed), each one and each secret shape replaced by \`[redacted]\` in place, as the run's timeline cuts its calls; the text is \`[redacted]\` whole when a value still shows in a form not cut in place. The cut holds this server's values, not every secret: a value handed to the run alone at its launch (a key of its own, an MCP server's headers) is not in it, and a secret of no known shape passes as written. Answered \`text/plain; charset=utf-8\` with \`x-agentrun-cut: run\` (a server that doesn't know \`cut\` answers the raw bytes, without it), the whole file (\`Range\` is not read). A file whose type is not text (text/*, JSON, NDJSON, or an extension the server doesn't type), or whose bytes are not UTF-8 or hold a NUL, is \`415 unsupported_media_type\`; one over ${RUN_FILE_CUT_MAX} bytes is \`413 payload_too_large\`; a run whose cut can't be read (the sign-in it was handed doesn't open) is \`403 forbidden\`. Without \`cut\`, the file's bytes as written.`, { type: "string", enum: ["run"] }),
4822
+ query("cut", `\`run\`: the file's text cut of every value the run's own cut holds (the server's keys, the keys a person saved, its secret stores' values, the sign-in refs the run was handed, and what its caller handed it: its own model key, tool keys and MCP servers' credentials), each one and each secret shape replaced by \`[redacted]\` in place, as the run's timeline cuts its calls; the text is \`[redacted]\` whole when a value still shows in a form not cut in place. The run's end erases what its caller handed it and counts where those values sat in each of its text files, never the values; from then a file is cut where that count says, while its bytes are the ones counted. A file the count cut in more than 256 places reads \`[redacted]\` whole. A file not counted as it is now (written or changed since the end, past the count's limits of 2,000 files, 64 MiB read and 512 KiB of count, or a run whose end made no count) is \`403 forbidden\`. That holds for good: once a run handed secrets has ended a turn, a file a later turn writes or changes is withheld from cut reads, whether or not that turn was handed secrets of its own (read it raw). A secret of no known shape passes as written. Answered \`text/plain; charset=utf-8\` with \`x-agentrun-cut: run\` (a server that doesn't know \`cut\` answers the raw bytes, without it), the whole file (\`Range\` is not read). A file whose type is not text (text/*, JSON, NDJSON, or an extension the server doesn't type), or whose bytes are not UTF-8 or hold a NUL, is \`415 unsupported_media_type\`; one over ${RUN_FILE_CUT_MAX} bytes is \`413 payload_too_large\`; a run whose cut can't be read (the sign-in it was handed, or what its caller handed it, doesn't open here) is \`403 forbidden\`. Without \`cut\`, the file's bytes as written.`, { type: "string", enum: ["run"] }),
4658
4823
  ];
4659
4824
  readFileOp.responses["413"] = ref("responses/PayloadTooLarge");
4660
4825
  readFileOp.responses["415"] = ref("responses/UnsupportedMediaType");
4661
4826
  readFile["x-agentrun-serve-changed"] = { ...readFile["x-agentrun-serve-changed"], parameters: "filecut/1" };
4827
+ // filecut/2: `?cut=run` on the listing names each file under the run's cut (RunFile.name), so a grader is told of every
4828
+ // file a run left, media included, without a path that holds a held value.
4829
+ const listFilesOp = doc.paths["/runs/{run_id}/files"].get;
4830
+ listFilesOp.parameters = [
4831
+ ...(listFilesOp.parameters ?? []),
4832
+ query("cut", "`run`: each file also has its `name`, its path under the run's own cut (each value the cut holds and each secret shape replaced by `[redacted]` in place, as a cut read cuts a file's text), whatever its type. A run whose end erased what its caller handed it lists no `name`. A run whose cut can't be read is `403 forbidden`, as without `cut`. A server that doesn't know `cut` lists no `name`.", { type: "string", enum: ["run"] }),
4833
+ ];
4834
+ listFilesOp["x-agentrun-serve-changed"] = { ...listFilesOp["x-agentrun-serve-changed"], parameters: "filecut/2" };
4662
4835
  // An agentic run's cancel is its end at once: the 202 reads `cancelled`, and no later end of its turn moves it.
4663
4836
  const cancel = doc.paths["/runs/{run_id}/cancel"].post;
4664
4837
  cancel.description = `${String(cancel.description).trimEnd()}\nHere an agentic run reads \`cancelled\` from the 202 on, \`final\` once it has stopped: a run's first terminal status is its last, so nothing its cut turn writes later (an answer, a cost over its cap) moves it. A workflow run reads \`cancelled\` once its workflow has stopped.\n`;