@parcha/agentrun-serve 0.1.0-beta.40 → 0.1.0-beta.42

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 (199) hide show
  1. package/CHANGELOG.md +130 -0
  2. package/NOTICE +2 -0
  3. package/README.md +149 -21
  4. package/dist/agent-rows.d.ts +1 -1
  5. package/dist/agents-store.js +3 -1
  6. package/dist/api-only.d.ts +3 -1
  7. package/dist/api-only.js +4 -2
  8. package/dist/api-token.d.ts +30 -0
  9. package/dist/api-token.js +89 -0
  10. package/dist/calendar/address.d.ts +49 -0
  11. package/dist/calendar/address.js +153 -0
  12. package/dist/calendar/fetch.d.ts +24 -0
  13. package/dist/calendar/fetch.js +146 -0
  14. package/dist/calendar/ics-faux.d.ts +39 -0
  15. package/dist/calendar/ics-faux.js +236 -0
  16. package/dist/calendar/labels.d.ts +3 -0
  17. package/dist/calendar/labels.js +61 -0
  18. package/dist/calendar/names.d.ts +52 -0
  19. package/dist/calendar/names.js +54 -0
  20. package/dist/calendar/parse.d.ts +108 -0
  21. package/dist/calendar/parse.js +625 -0
  22. package/dist/calendar/routes.d.ts +17 -0
  23. package/dist/calendar/routes.js +81 -0
  24. package/dist/calendar/tools.d.ts +23 -0
  25. package/dist/calendar/tools.js +124 -0
  26. package/dist/cli.js +22 -6
  27. package/dist/composio-made.d.ts +54 -0
  28. package/dist/composio-made.js +83 -0
  29. package/dist/composio-preset.d.ts +16 -8
  30. package/dist/composio-preset.js +106 -43
  31. package/dist/composio-triggers.d.ts +7 -2
  32. package/dist/composio-triggers.js +13 -7
  33. package/dist/computer-attach.d.ts +29 -11
  34. package/dist/computer-attach.js +141 -47
  35. package/dist/computer-keys.d.ts +4 -0
  36. package/dist/computer-keys.js +5 -0
  37. package/dist/computer-record.d.ts +55 -0
  38. package/dist/computer-record.js +315 -0
  39. package/dist/computer-setting.d.ts +1 -0
  40. package/dist/computer-setting.js +15 -2
  41. package/dist/computers.d.ts +11 -1
  42. package/dist/computers.js +23 -26
  43. package/dist/console/assets/{index-B8Zn1Iqn.css → index-C3gNPz58.css} +1 -1
  44. package/dist/console/assets/index-DYJ_wj27.js +711 -0
  45. package/dist/console/index.html +2 -2
  46. package/dist/decisions.js +9 -2
  47. package/dist/eval-feed.d.ts +26 -0
  48. package/dist/eval-feed.js +72 -0
  49. package/dist/eval-mailbox.d.ts +4 -1
  50. package/dist/eval-mailbox.js +11 -3
  51. package/dist/exa-keyless.d.ts +1 -1
  52. package/dist/exa-keyless.js +1 -1
  53. package/dist/feed/feed-faux.d.ts +62 -0
  54. package/dist/feed/feed-faux.js +123 -0
  55. package/dist/feed/fetch.d.ts +41 -0
  56. package/dist/feed/fetch.js +128 -0
  57. package/dist/feed/parse.d.ts +42 -0
  58. package/dist/feed/parse.js +291 -0
  59. package/dist/feed/pointer.d.ts +2 -0
  60. package/dist/feed/pointer.js +17 -0
  61. package/dist/file-types.js +1 -0
  62. package/dist/host-command.d.ts +3 -0
  63. package/dist/host-command.js +18 -0
  64. package/dist/host.d.ts +3 -0
  65. package/dist/host.js +3 -0
  66. package/dist/learn/check.d.ts +17 -1
  67. package/dist/learn/check.js +240 -5
  68. package/dist/learn/compile.d.ts +48 -27
  69. package/dist/learn/compile.js +134 -101
  70. package/dist/learn/promote.d.ts +61 -5
  71. package/dist/learn/promote.js +12 -2
  72. package/dist/learned-nodes.d.ts +21 -4
  73. package/dist/learned-nodes.js +21 -8
  74. package/dist/learned-workflow.d.ts +3 -3
  75. package/dist/learned-workflow.js +14 -5
  76. package/dist/learning-setting.d.ts +23 -0
  77. package/dist/learning-setting.js +51 -0
  78. package/dist/learning-words.d.ts +3 -0
  79. package/dist/learning-words.js +3 -0
  80. package/dist/learning.d.ts +3 -2
  81. package/dist/learning.js +5 -3
  82. package/dist/mcp-oauth.d.ts +23 -1
  83. package/dist/mcp-oauth.js +46 -5
  84. package/dist/mcp-pin-first.d.ts +4 -2
  85. package/dist/mcp-pin-first.js +4 -3
  86. package/dist/mcp-private-hosts.d.ts +13 -0
  87. package/dist/mcp-private-hosts.js +16 -0
  88. package/dist/mcp-servers-store.d.ts +58 -5
  89. package/dist/mcp-servers-store.js +136 -17
  90. package/dist/mcp.d.ts +2 -2
  91. package/dist/mcp.js +2 -2
  92. package/dist/observation/http.d.ts +4 -1
  93. package/dist/observation/http.js +5 -4
  94. package/dist/openapi.d.ts +1 -0
  95. package/dist/openapi.js +151 -21
  96. package/dist/print.d.ts +6 -3
  97. package/dist/print.js +4 -2
  98. package/dist/run-files.d.ts +6 -2
  99. package/dist/run-files.js +29 -7
  100. package/dist/run-labels.d.ts +23 -0
  101. package/dist/run-labels.js +79 -0
  102. package/dist/run-learning-served.d.ts +1 -1
  103. package/dist/run-reads-over-store.d.ts +5 -1
  104. package/dist/run-reads-over-store.js +8 -4
  105. package/dist/run-recordings.d.ts +20 -0
  106. package/dist/run-recordings.js +133 -0
  107. package/dist/run-secrets.js +12 -4
  108. package/dist/runner/adapter-loop.d.ts +1 -1
  109. package/dist/runner/adapter-loop.js +94 -16
  110. package/dist/runner/adapter-run-spec.d.ts +19 -0
  111. package/dist/runner/adapter-run-spec.js +57 -36
  112. package/dist/runner/beside.d.ts +6 -3
  113. package/dist/runner/beside.js +9 -7
  114. package/dist/runner/cli-run-spec.js +41 -32
  115. package/dist/runner/conformance/harness.js +69 -14
  116. package/dist/runner/conformance/subject.d.ts +4 -1
  117. package/dist/runner/feedback-round.d.ts +9 -25
  118. package/dist/runner/feedback-round.js +22 -40
  119. package/dist/runner/learning-end.d.ts +17 -7
  120. package/dist/runner/learning-end.js +79 -53
  121. package/dist/runner/main.d.ts +12 -1
  122. package/dist/runner/main.js +31 -4
  123. package/dist/runner/mcp-claim.d.ts +3 -0
  124. package/dist/runner/mcp-claim.js +1 -1
  125. package/dist/runner/mcp-run.d.ts +6 -2
  126. package/dist/runner/mcp-run.js +5 -3
  127. package/dist/runner/model-route.d.ts +4 -2
  128. package/dist/runner/model-route.js +8 -8
  129. package/dist/runner/promotion.d.ts +44 -4
  130. package/dist/runner/promotion.js +323 -21
  131. package/dist/runner/reflect-hook.d.ts +5 -0
  132. package/dist/runner/reflect-hook.js +22 -14
  133. package/dist/runner/store-secrets.js +3 -1
  134. package/dist/runner/workflow-first.d.ts +6 -11
  135. package/dist/runner/workflow-first.js +16 -20
  136. package/dist/runs-over-store.d.ts +1 -1
  137. package/dist/runs-over-store.js +5 -2
  138. package/dist/sdk/runs.d.ts +7 -1
  139. package/dist/sdk/runs.js +21 -7
  140. package/dist/secret-cut.js +3 -1
  141. package/dist/secrets.js +5 -3
  142. package/dist/server.d.ts +31 -5
  143. package/dist/server.js +240 -61
  144. package/dist/store/agent-body.d.ts +5 -3
  145. package/dist/store/agent-body.js +14 -10
  146. package/dist/store/dialect.d.ts +3 -0
  147. package/dist/store/dialect.js +1 -0
  148. package/dist/store/index.d.ts +1 -1
  149. package/dist/store/postgres/dialect.js +1 -0
  150. package/dist/store/postgres/migrations/0015_run_labels.sql +5 -0
  151. package/dist/store/postgres/migrations/0016_minted_tokens.sql +21 -0
  152. package/dist/store/schema.d.ts +9 -0
  153. package/dist/store/schema.js +26 -2
  154. package/dist/store/sqlite/connection.js +11 -3
  155. package/dist/store/sqlite/run-patch.d.ts +2 -1
  156. package/dist/store/sqlite/run-patch.js +3 -2
  157. package/dist/store/sqlite/store.js +64 -10
  158. package/dist/store/store.d.ts +38 -1
  159. package/dist/store-reads/journal.js +2 -1
  160. package/dist/store-reads/learning.d.ts +1 -1
  161. package/dist/store-reads/learning.js +6 -1
  162. package/dist/store-reads/loop.d.ts +1 -0
  163. package/dist/store-reads/loop.js +14 -4
  164. package/dist/store-reads/runs.d.ts +4 -3
  165. package/dist/store-reads/runs.js +3 -2
  166. package/dist/store-view.d.ts +5 -0
  167. package/dist/store-view.js +8 -2
  168. package/dist/template-eval.d.ts +11 -0
  169. package/dist/template-eval.js +177 -52
  170. package/dist/templates.d.ts +13 -1
  171. package/dist/templates.js +89 -18
  172. package/dist/timeline/computer.js +2 -1
  173. package/dist/timeline/origin.d.ts +1 -1
  174. package/dist/timeline/origin.js +2 -2
  175. package/dist/tool-list.js +1 -0
  176. package/dist/tools.d.ts +7 -0
  177. package/dist/tools.js +11 -0
  178. package/dist/trigger-adapter.d.ts +9 -4
  179. package/dist/trigger-adapters.js +2 -1
  180. package/dist/trigger-feed.d.ts +12 -0
  181. package/dist/trigger-feed.js +420 -0
  182. package/dist/triggers.d.ts +2 -1
  183. package/dist/triggers.js +23 -5
  184. package/dist/validate.js +7 -2
  185. package/dist/webhooks.js +9 -5
  186. package/dist/workspace/computer-deps.d.ts +5 -1
  187. package/dist/workspace/computer-deps.js +2 -2
  188. package/dist/workspace/computer-for-claim.d.ts +7 -0
  189. package/dist/workspace/computer-for-claim.js +12 -2
  190. package/dist/workspace/index.d.ts +1 -0
  191. package/dist/workspace/index.js +2 -0
  192. package/dist/workspace/paths.d.ts +4 -0
  193. package/dist/workspace/paths.js +9 -0
  194. package/dist/workspace/resolve-computer.d.ts +35 -4
  195. package/dist/workspace/resolve-computer.js +47 -9
  196. package/launcher/agentrun-serve +34 -22
  197. package/package.json +11 -9
  198. package/templates/README.md +38 -4
  199. package/dist/console/assets/index-Jbxjcmdp.js +0 -705
package/dist/openapi.js CHANGED
@@ -37,6 +37,9 @@ import "./mcp-secret-writes.js";
37
37
  // The email account's routes (email/routes.ts), each marked x-agentrun-secret whole, registered with the one gate as it
38
38
  // loads: the view among them, so the API token never reads the account.
39
39
  import "./email/routes.js";
40
+ // The calendar's routes (calendar/routes.ts), each marked x-agentrun-secret whole, registered the same way: the view
41
+ // among them, so the API token never reads which calendar is saved.
42
+ import "./calendar/routes.js";
40
43
  import { MCP_SETTINGS_PAGE } from "./mcp-oauth.js";
41
44
  import { ATTEMPTS_KEPT, MESSAGE_TYPES, WEBHOOK_EVENTS } from "./webhooks.js";
42
45
  import { DEFAULT_SCHEME, SCHEME_NAMES, SIGNATURE_SCHEMES } from "./trigger-signatures.js";
@@ -51,13 +54,29 @@ import { APPROVAL_ROW, ARGS_PREVIEW_BYTES, MAX_PIN_ARGS, MAX_PIN_CHOICES, PERMIS
51
54
  import { BROWSER_VENDOR_IDS, DECISION_PROVIDER_KEYS, KIND_KEYS, MAX_PIN_TEXT, permissionsOf, PICKABLE, PROVIDERS } from "./tool-plane.js";
52
55
  import { tableTools } from "./tool-list.js";
53
56
  import { SECRET_META_SCHEMA } from "./secret-writes.js";
57
+ import { LABEL_KEY, MAX_LABEL_VALUE, MAX_LABELS } from "./run-labels.js";
54
58
  import { BASH_POLICIES } from "./bash-read-only.js";
55
59
  // The modules that own the computer and Archil key writes: loading the document loads their secret-write predicates
56
60
  // (secret-writes.ts registerSecretWrite), so every operation the document marks has its predicate wherever it is read.
57
61
  import "./computers.js";
58
62
  import { ARCHIL_KEY_NAMES } from "./archil-routes.js";
59
63
  import { ATTACH_HEARTBEAT_MS, ATTACH_IDLE_MS, ATTACH_SUBPROTOCOL, MAX_LINE_BYTES, PAIRING_CODE_PATTERN, PAIRING_CODE_TTL_MS, PROTOCOL_VERSION } from "@parcha/agentrun-computer";
60
- import { PAIR_TRIES_PER_MINUTE, PAIRED_NAME_MAX } from "./computer-attach.js";
64
+ import { DAEMON_FETCHES_PER_MINUTE, PAIR_TRIES_PER_MINUTE, PAIRED_NAME_MAX } from "./computer-attach.js";
65
+ /** runlabels/1: a run's labels, given at its start and served on every read of it (run-labels.ts). */
66
+ const RUN_LABELS = {
67
+ type: "object",
68
+ maxProperties: MAX_LABELS,
69
+ propertyNames: { pattern: LABEL_KEY.source },
70
+ additionalProperties: { type: "string", minLength: 1, maxLength: MAX_LABEL_VALUE },
71
+ "x-agentrun-serve": "runlabels/1",
72
+ };
73
+ /** runlabels/1: GET /runs' and GET /agents/{agent_id}/runs' filter on a run's labels. */
74
+ const LABEL_PARAMETER = {
75
+ name: "label", in: "query", required: false,
76
+ description: "Only runs holding this label: `<key>:<value>`, split at the first `:` (a key holds none). Once per request; a second `label`, or one that does not read as a label, is 400.",
77
+ schema: { type: "string" },
78
+ "x-agentrun-serve": "runlabels/1",
79
+ };
61
80
  /** Why each capability this server turns off answers 501, by the route's capability. */
62
81
  export const UNSUPPORTED = {
63
82
  quotes: "This server has no billing, so it gives no quotes.",
@@ -216,6 +235,20 @@ const EMAIL_ACCOUNT_BODY = {
216
235
  };
217
236
  /** One half of an email account test. */
218
237
  const MAIL_CHECK = closed({ ok: { type: "boolean" }, message: { type: "string", description: "In plain words: \"Signed in to <host>.\", with INBOX's count for IMAP, or why not." } });
238
+ /** GET and PUT /settings/calendar's answer (calendar/address.ts calendarView): the calendar, never its address. */
239
+ const CALENDAR_VIEW = closed({
240
+ configured: { type: "boolean", description: "A calendar is saved and its address opens with this server's seal key: calendar_events reads it." },
241
+ host: { type: ["string", "null"], description: "The host its address reads from (calendar.google.com), never the address." },
242
+ name: { type: ["string", "null"], description: "The calendar's own name (its X-WR-CALNAME), as the save read it; null when that read failed or it has none." },
243
+ time_zone: { type: ["string", "null"], description: "The calendar's own time zone (its X-WR-TIMEZONE, else the server's), as the save read it; null when that read failed." },
244
+ }, "The server's one calendar, never its iCal address.");
245
+ /** PUT /settings/calendar's and POST /settings/calendar/test's body: the calendar's iCal address. */
246
+ const CALENDAR_BODY = {
247
+ type: "object", additionalProperties: false,
248
+ properties: {
249
+ url: { type: "string", minLength: 1, maxLength: 2048, "x-agentrun-secret": true, description: "The calendar's secret iCal address (https://… or webcal://…, read as https://): Google Calendar's \"Secret address in iCal format\", Outlook's ICS link, iCloud's public calendar link. Sealed, never answered or shown again." },
250
+ },
251
+ };
219
252
  /** GET /settings/chatgpt's answer (chatgpt-plan.ts PlanView): the sign-in's state, never a token. */
220
253
  const CHATGPT_SIGN_IN = {
221
254
  type: "object", additionalProperties: false, required: ["state"],
@@ -972,7 +1005,7 @@ const TRIGGER_FIELDS = closed({
972
1005
  catchup_window_s: { type: "integer", minimum: 0, maximum: MAX_EVERY_S, description: `How late a missed time may still fire, once: of the times that came while the server was down (or its timer was late), the latest fires if it is this recent, under its own key, and the rest are one \`missed\` firing. 0: a missed time never fires. Default ${CATCHUP_WINDOW_S}.` },
973
1006
  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.` },
974
1007
  failures_in_a_row: { type: "integer", minimum: 0, description: `Failed firings since the last that started a run; at ${FAILURES_TO_PAUSE} the trigger turns itself off (\`disabled\`). Turned on again, it counts from 0.` },
975
- disabled: { oneOf: [closed({ at: DATE_TIME, reason: { const: "auto_paused" } }), closed({ at: DATE_TIME, reason: { const: "source_unreadable" }, detail: { type: "string", description: "Why the source no longer reads." } }), closed({ at: DATE_TIME, reason: { const: "agent_archived" }, detail: { type: "string", description: "The agent it runs as, archived." } }), closed({ at: DATE_TIME, reason: { const: "connection_lost" }, detail: { type: "string", description: "Which connection went (GitHub disconnected here, or the App's installation deleted or suspended on GitHub)." } }), closed({ at: DATE_TIME, reason: { const: "sign_in_refused" }, detail: { type: "string", description: "What to fix: the account in Settings → Email." } }), { type: "null" }], description: `Why it is off, when the server turned it off: \`agent_archived\`, the agent it runs as was archived (turning it on is 409 agent_archived until the agent is unarchived); \`auto_paused\`, ${FAILURES_TO_PAUSE} failed firings in a row; \`connection_lost\`, the connection it needs went (GitHub disconnected here, or the App's installation deleted or suspended on GitHub); \`sign_in_refused\`, an email trigger's mail server refused the sign-in 3 times in a row (fix the account in Settings → Email, then turn it on); \`source_unreadable\`, its cron line or zone no longer reads here (a newer cron library or time zone data refuses it) or its every_s is out of range (a hand edit of its row), found at a start or when it came due, and only this trigger is turned off. Null once it is on again, which for \`source_unreadable\` takes a new source.` },
1008
+ disabled: { oneOf: [closed({ at: DATE_TIME, reason: { const: "auto_paused" } }), closed({ at: DATE_TIME, reason: { const: "source_unreadable" }, detail: { type: "string", description: "Why the source no longer reads." } }), closed({ at: DATE_TIME, reason: { const: "agent_archived" }, detail: { type: "string", description: "The agent it runs as, archived." } }), closed({ at: DATE_TIME, reason: { const: "connection_lost" }, detail: { type: "string", description: "Which connection went (GitHub disconnected here, or the App's installation deleted or suspended on GitHub)." } }), closed({ at: DATE_TIME, reason: { const: "sign_in_refused" }, detail: { type: "string", description: "What to fix: the account in Settings → Email." } }), { type: "null" }], description: `Why it is off, when the server turned it off: \`agent_archived\`, the agent it runs as was archived (turning it on is 409 agent_archived until the agent is unarchived); \`auto_paused\`, ${FAILURES_TO_PAUSE} failed firings in a row; \`connection_lost\`, the connection it needs went (GitHub disconnected here, or the App's installation deleted or suspended on GitHub); \`sign_in_refused\`, an email trigger's mail server refused the sign-in 3 times in a row (fix the account in Settings → Email, then turn it on); \`source_unreadable\`, its cron line or zone no longer reads here (a newer cron library or time zone data refuses it) or its every_s is out of range (a hand edit of its row), found at a start or when it came due, and only this trigger is turned off, or every feed a feed trigger reads has stopped (a 410, or a 404 three checks running, each), which turning it on again reads from the start (edit its urls first). Null once it is on again, which for \`source_unreadable\` takes a new source.` },
976
1009
  next_at: { type: ["string", "null"], format: "date-time", description: "When it fires next; null while it is off." },
977
1010
  last_run_id: { type: ["string", "null"], description: "The run its last firing that started one started; while that run is active (working, or waiting on a person), each firing is skipped, unless its firings each start their own run (a webhook with `accept`, or a pushed trigger with `max_active_runs`). Null until one starts." },
978
1011
  created_at: DATE_TIME,
@@ -980,7 +1013,7 @@ const TRIGGER_FIELDS = closed({
980
1013
  last_firing: { oneOf: [TRIGGER_FIRING, { type: "null" }] },
981
1014
  }, "A trigger. A firing while its last run is active (working, or waiting on a person) is skipped, and recorded as a skipped firing with why: never queued, since a firing queued behind a run parked on a person would wait as long as the person does. A webhook trigger with `accept` is the exception: each event it takes starts its own run.");
982
1015
  /** A trigger's view: its fields, all there, and `hook_url`, a pushed source's alone. */
983
- const TRIGGER = { ...TRIGGER_FIELDS, properties: { ...TRIGGER_FIELDS.properties, last_check: { oneOf: [closed({ at: DATE_TIME, ok: { type: "boolean" }, message: { type: "string" } }), { type: "null" }], description: "A polled source's (an email's) last check of its mailbox: when, whether it read, and in words (\"Read INBOX: 2 messages new.\", or why not: a server that couldn't be reached is said here and tried at the next time). Null before its first; absent for any other source.", "x-agentrun-serve": "email/1" }, hook_url: { type: "string", description: "Where its sender posts, for a pushed source alone (absent for a schedule): a webhook's own hook, `/v2/hooks/{id}`, at this server's public URL (AGENTRUN_PUBLIC_URL) when it has one, else the path." } } };
1016
+ const TRIGGER = { ...TRIGGER_FIELDS, properties: { ...TRIGGER_FIELDS.properties, last_check: { oneOf: [closed({ at: DATE_TIME, ok: { type: "boolean" }, message: { type: "string" } }), { type: "null" }], description: "A polled source's (an email's or a feed's) last check of its mailbox or its feeds: when, whether it read, and in words (\"Read INBOX: 2 messages new.\", \"Read 2 feeds: 1 new.\", or why not: a server that couldn't be reached is said here and tried at the next time). Null before its first; absent for any other source.", "x-agentrun-serve": "email/1" }, hook_url: { type: "string", description: "Where its sender posts, for a pushed source alone (absent for a schedule): a webhook's own hook, `/v2/hooks/{id}`, at this server's public URL (AGENTRUN_PUBLIC_URL) when it has one, else the path." } } };
984
1017
  const TRIGGER_WRITE = {
985
1018
  name: { type: "string", minLength: 1, maxLength: 200, description: "Default the trigger's id." },
986
1019
  enabled: { type: "boolean", default: true, description: "Off, it fires nothing; on again, it goes on from now: the time it was off is skipped, never caught up." },
@@ -1148,7 +1181,7 @@ const GRADE_FIELDS = {
1148
1181
  path: { enum: [...RUN_PATHS], description: "The path the run took, read from its record when it was graded." },
1149
1182
  workflow: { ...NULL_STRING, description: "The learned workflow that served it, when one did." },
1150
1183
  workflow_digest: { ...NULL_STRING, description: "That workflow's digest (the first 16 hex of its workflow.json's sha256), when it was served first." },
1151
- feedback: { enum: [...FEEDBACK_ROUNDS, null], description: "What the grade asked of the run's learning, a round the run opened again on (no turn of the job's: its end-of-run turn alone, learning spend): `revise`, a wrong grade of a run its learned workflow answered alone, a revision ask for that workflow with the job, its answer and the grade's words; `look_back`, a run the agent finished graded with a `label`, a look-back on it. null: nothing more (a right grade of a run its workflow answered alone costs $0), or a run that does not learn or that can't be opened again. Kept with the grade once the round opened, so a later read still says it." },
1184
+ feedback: { enum: [...FEEDBACK_ROUNDS, null], description: "What the grade asked of the run's learning, a round the run opened again on (no turn of the job's: its end-of-run turn alone, learning spend): `look_back`, a run the agent finished graded with a `label`, a look-back on it. null: nothing more (a grade of a run its learned workflow answered alone, right or wrong, is kept and costs $0: the workflow's graded hold reads it), or a run that does not learn or that can't be opened again. Kept with the grade once the round opened, so a later read still says it." },
1152
1185
  };
1153
1186
  const RUN_LEARNING = {
1154
1187
  oneOf: [
@@ -1232,7 +1265,7 @@ const LEARNING_COST = closed({
1232
1265
  workflows: { type: "array", items: closed({
1233
1266
  workflow: { type: "string", description: "The learned workflow, by name." },
1234
1267
  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." },
1235
- 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; each run it would have served asks the agent for a new version, which runs first again.` },
1268
+ 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.` },
1236
1269
  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.`),
1237
1270
  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."),
1238
1271
  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." },
@@ -1284,6 +1317,7 @@ const REPLAY_SCORE = {
1284
1317
  handed_back: { ...COUNT, description: "How many of them it handed back; it answered `n` - `handed_back` alone. A revision that answered none alone is held: it would never serve." },
1285
1318
  };
1286
1319
  /** A replay's runs' outcomes, the one count of them: on its promotion record (`replay.outcomes`) and its read. */
1320
+ const SKIPPED_TOOLS = { type: "array", items: closed({ tool: { type: "string", description: "The tool's catalog name." }, inputs: { ...COUNT, description: "How many skipped inputs it stopped." }, no_read_only_hint: { type: "boolean", description: "An MCP tool its server lists with no `readOnlyHint` (and not `destructiveHint`): replay treats it as a write only because nothing says it reads. The hold's `reason` names these: if they only read, mark them read-only in the MCP server and the next replay runs them." } }), description: "The tools that stopped its skipped inputs, most inputs first." };
1287
1321
  const REPLAY_OUTCOMES = closed({
1288
1322
  answered: { ...COUNT, description: "Replay runs the workflow answered alone, as each run did (guards read record-only: one answered under a guard's threshold counts here, and the score hands it back)." },
1289
1323
  handed_back: { ...COUNT, description: "Replay runs it handed back on." },
@@ -1295,10 +1329,26 @@ const PROMOTION = closedWith({
1295
1329
  digest: { type: "string", description: "The revision the record decides: the first 16 hex of its workflow.json's sha256." },
1296
1330
  at: DATE_TIME,
1297
1331
  decided: { enum: ["promote", "hold", "replaying", "queued", "skipped"], description: "`promote`: it serves first on the runs it fits. `hold`: it does not; the champion (the revision promoted last) takes them, else the agent, until a new revision. `replaying`: its replay runs are at work; the champion serves meanwhile, else the agent. `queued`: it came while another revision replayed; one revision replays at a time and a running replay finishes, so it replays next, at the first run's claim once that replay is decided (the finished replay's verdict stands). `skipped`: a newer revision (`skipped_by`) came while it was queued; only the newest queued revision replays next, so it never replayed and never serves." },
1298
- source: { enum: ["replay", "dry_run", "refit", "graded"], description: `\`replay\`: decided on a replay of it on the agent's last ${REPLAY_INPUTS} graded inputs it fits, or those its owner asked for (POST .../revisions/{digest}/replays). \`dry_run\`: fewer than ${REPLAY_MIN} graded inputs, promoted on its passing dry run. \`refit\`: a threshold refit wrote this revision, decided on the rows it was fit on. \`graded\`: the graded runs it served fell more than ${PROMOTE_BAR * 100} points under the agent's accuracy by hand.` },
1332
+ source: { enum: ["check", "replay", "dry_run", "refit", "graded"], description: `\`check\`: decided by its one check, a replay of it on the inputs of the agent's last \`compile_after\` completed runs scored against the agent's own recorded answers (\`check\` holds the numbers); a revision's first claim starts it. \`replay\`: decided on a replay of it on the agent's last ${REPLAY_INPUTS} graded inputs it fits, or those its owner asked for (POST .../revisions/{digest}/replays). \`dry_run\`: fewer than ${REPLAY_MIN} graded inputs, promoted on its passing dry run. \`refit\`: a threshold refit wrote this revision, decided on the rows it was fit on. \`graded\`: the graded runs it served fell more than ${PROMOTE_BAR * 100} points under the agent's accuracy by hand.` },
1299
1333
  reason: { type: "string", description: "Why, in words, with the numbers." },
1300
1334
  }, {
1301
- replay: { ...closedWith(REPLAY_SCORE, { of: { type: "array", items: { type: "string" }, description: "The graded runs replayed." }, cost_usd: { type: ["number", "null"], minimum: 0, description: "What its replay runs cost together; null when one's cost is unknown." }, skipped_tools: { type: "array", items: closed({ tool: { type: "string", description: "The tool's catalog name." }, inputs: { ...COUNT, description: "How many skipped inputs it stopped." }, no_read_only_hint: { type: "boolean", description: "An MCP tool its server lists with no `readOnlyHint` (and not `destructiveHint`): replay treats it as a write only because nothing says it reads. The hold's `reason` names these: if they only read, mark them read-only in the MCP server and the next replay runs them." } }), description: "The tools that stopped its skipped inputs, most inputs first." }, outcomes: REPLAY_OUTCOMES }), description: "The numbers it was decided on. A replay runs each read live (through a cache seeded from the graded run's recorded calls) and answers each write from that recording, never sending one." },
1335
+ check: closedWith({
1336
+ compile_after: { type: "integer", minimum: 1, description: "The agent definition's `learning.compile_after` when the check began: how many of the agent's newest completed runs it read inputs from." },
1337
+ agree_min: { type: "number", minimum: 0, maximum: 1, description: "The bar on agreement: of the inputs it answered alone, the least share that must say what the agent's recorded answer said." },
1338
+ alone_min: { type: "number", minimum: 0, maximum: 1, description: "The bar on answering alone: the least share of the inputs it ran on that it must answer with no escalate and no failed step." },
1339
+ attempt: { enum: [1, 2], description: "1: the compile's first check. 2: the check of its one recompile, after the first held it; held again, it stops (`stopped`)." },
1340
+ }, {
1341
+ n: { ...COUNT, description: "The inputs it ran on (a replay stopped at a write is none; one never created, or not ended, by the check's deadline counts, as failed). 0 with nothing to run on: never promoted, it stops (`stopped`) and `reason` says why." },
1342
+ agreed: { ...COUNT, description: "How many of them it answered alone with the agent's recorded answer." },
1343
+ alone: { ...COUNT, description: "How many of them it answered alone. Promoted when `alone`/`n` >= `alone_min` and `agreed`/`alone` >= `agree_min`." },
1344
+ of: { type: "array", items: { type: "string" }, description: "The agent's runs whose inputs it ran on, newest first." },
1345
+ cost_usd: { type: ["number", "null"], minimum: 0, description: "What its replay runs cost together; null when one's cost is unknown." },
1346
+ outcomes: REPLAY_OUTCOMES,
1347
+ skipped_tools: SKIPPED_TOOLS,
1348
+ disagreements: { type: "array", items: closedWith({ run: { type: "string" }, input: { type: "string", description: "The run's input, as text or JSON, cut at 1200 characters." }, agent: NULL_STRING }, { draft: { type: "string", description: "What it answered instead." }, escalated: { type: "string", description: "Why it handed the input back." }, failed: { const: true, description: "A step failed on it, or its run was still at work past the check's deadline, or never created by then." } }), description: "On a hold: each input it did not agree on, which the agent's next run reads as data in its one recompile." },
1349
+ stopped: { const: true, description: "The recompile's check held it too, or there was nothing to check it on (no input of the agent's it takes, or every input skipped at a write: `n` 0, `reason` starting \"nothing to check it on\", which asks no recompile): nothing compiles again until a hold or its owner acts; the agent keeps the runs." },
1350
+ }),
1351
+ replay: { ...closedWith(REPLAY_SCORE, { of: { type: "array", items: { type: "string" }, description: "The graded runs replayed." }, cost_usd: { type: ["number", "null"], minimum: 0, description: "What its replay runs cost together; null when one's cost is unknown." }, skipped_tools: SKIPPED_TOOLS, outcomes: REPLAY_OUTCOMES }), description: "The numbers it was decided on. A replay runs each read live (through a cache seeded from the graded run's recorded calls) and answers each write from that recording, never sending one." },
1302
1352
  runs: { type: "array", items: { type: "string" }, description: "Its replay runs (path `replay`)." },
1303
1353
  inputs: { type: "array", items: { type: "string" }, description: "On a replaying record: the graded run each of `runs` replays, in the same order. Its runs are reserved before they are created; one not created a few minutes on is created by the next claim." },
1304
1354
  replay_id: { type: "string", description: "The replay's id, on its replaying record and the one that decided it: GET .../revisions/{digest}/replays/{replay_id} reads it, whether a run's claim or its owner started it." },
@@ -1352,9 +1402,9 @@ const LEARNING_EXTENSIONS = {
1352
1402
  "/runs/{run_id}/grade": {
1353
1403
  put: {
1354
1404
  operationId: "gradeRun", tags: ["runs"], summary: "Grade an ended run's answer: right or wrong, and the fields a right answer holds",
1355
- description: `A person's feedback or an eval's label on a run that ended, kept for its agent (one grade a run: a later one replaces it; the newest ${GRADES_KEPT} are kept). Promotion by replay reads them: a learned workflow's new revision serves first only after a replay on the agent's last ${REPLAY_INPUTS} graded inputs it fits is within ${PROMOTE_BAR * 100} points of the agent's own answers on them; with fewer than ${REPLAY_MIN}, on its passing dry run. With \`expected\`, a replay's answer is right when its JSON holds each of those fields; else when it says what the graded answer said. A replay run is never graded. The run's path never changes on a grade: a right grade of a run its learned workflow answered alone is kept and nothing more ($0); a wrong one opens the run again on a revision ask for that workflow; a run the agent finished, graded with a \`label\`, opens again on a look-back on it. Either round asks the agent no turn of the job's, only its end-of-run turn, and its spend is the run's learning (\`feedback\`).`,
1405
+ description: `A person's feedback or an eval's label on a run that ended, kept for its agent (one grade a run: a later one replaces it; the newest ${GRADES_KEPT} are kept). Promotion by replay reads them: a learned workflow's new revision serves first only after a replay on the agent's last ${REPLAY_INPUTS} graded inputs it fits is within ${PROMOTE_BAR * 100} points of the agent's own answers on them; with fewer than ${REPLAY_MIN}, on its passing dry run. With \`expected\`, a replay's answer is right when its JSON holds each of those fields; else when it says what the graded answer said. A replay run is never graded. The run's path never changes on a grade: a grade of a run its learned workflow answered alone, right or wrong, is kept and nothing more ($0; the workflow's graded hold reads it, and only a hold asks for its revision); a run the agent finished, graded with a \`label\`, opens again on a look-back on it. That round asks the agent no turn of the job's, only its end-of-run turn, and its spend is the run's learning (\`feedback\`).`,
1356
1406
  parameters: [ref("parameters/RunId")],
1357
- requestBody: { required: true, content: { "application/json": { schema: { type: "object", additionalProperties: false, required: ["correct"], properties: { correct: { type: "boolean" }, expected: { type: "object", description: "The fields a right answer's JSON holds." }, source: { enum: [...GRADE_SOURCES], default: "feedback" }, label: { type: "string", maxLength: LABEL_MAX, description: "The grade's words (a teacher's label, a reviewer's note): what the run's look-back or its workflow's revision ask reads." } } } } } },
1407
+ requestBody: { required: true, content: { "application/json": { schema: { type: "object", additionalProperties: false, required: ["correct"], properties: { correct: { type: "boolean" }, expected: { type: "object", description: "The fields a right answer's JSON holds." }, source: { enum: [...GRADE_SOURCES], default: "feedback" }, label: { type: "string", maxLength: LABEL_MAX, description: "The grade's words (a teacher's label, a reviewer's note): what the run's look-back reads." } } } } } },
1358
1408
  responses: { "200": json(GRADE, "The run's grade."), ...errors(400, 401, 404, 429, 500) },
1359
1409
  "x-agentrun-serve": "promotion/1",
1360
1410
  },
@@ -1366,6 +1416,7 @@ const LEARNING_EXTENSIONS = {
1366
1416
  parameters: [AGENT_ID],
1367
1417
  responses: { "200": json(closed({
1368
1418
  agent: { type: "string" },
1419
+ completed_runs: { ...COUNT, description: "The agent's completed runs of its own (never one a learned workflow answered alone, a replay, an imported or an archived run) toward its first compile, at most its definition's `learning.compile_after`." },
1369
1420
  compiles: { type: "array", items: closed({
1370
1421
  run_id: { type: "string", description: "The run whose end compiled it." },
1371
1422
  round: { type: "integer", minimum: 1, description: "The run's round that compiled it: 1 its first end, more for an end after a follow-up opened it again." },
@@ -1375,7 +1426,7 @@ const LEARNING_EXTENSIONS = {
1375
1426
  attempts: { type: "array", items: closed({ ok: { type: "boolean" }, errors: { type: "array", items: { type: "string" } } }), description: "Each attempt in order: whether its checks and dry run passed, and what they refused." },
1376
1427
  digest: { ...NULL_STRING, description: "The kept draft's digest; null when none passed." },
1377
1428
  promoted: { type: ["boolean", "null"], description: "Whether that revision was promoted, as its records say now: true promoted (or a refit of it was), false held or skipped, null queued, undecided or none passed. It may no longer serve: the promotions read's \`serving\` says which revision does." },
1378
- draft_errors: { type: "array", items: { type: "string" }, description: "A draft that never passed: its last errors. Empty when one passed." },
1429
+ draft_errors: { type: "array", items: { type: "string" }, description: "A draft that never passed: its last errors. A draft its check had nothing to run on (its promotion `check.stopped` with `n` 0): its record's reason, starting \"nothing to check it on\". Empty otherwise." },
1379
1430
  withheld: { type: "boolean", description: "The run's handed values can't be read here: its error texts are left out (the counts stand)." },
1380
1431
  }), description: "Newest first." },
1381
1432
  guards: { type: "array", items: closed({
@@ -1713,6 +1764,7 @@ const EXTENSIONS = {
1713
1764
  { name: "revision", in: "query", required: false, description: "Only runs of this revision.", schema: { type: "string" } },
1714
1765
  { name: "status", in: "query", required: false, description: "Only runs with this status.", schema: ref("schemas/RunStatus") },
1715
1766
  { name: "archived", in: "query", required: false, description: "true lists only archived runs; false, the default, the others.", schema: { type: "boolean" } },
1767
+ LABEL_PARAMETER,
1716
1768
  ],
1717
1769
  responses: { "200": json(ref("schemas/RunList"), "One page of runs, newest first."), ...errors(400, 401, 429, 500) },
1718
1770
  },
@@ -1980,11 +2032,21 @@ const EXTENSIONS = {
1980
2032
  "/computers/attach": {
1981
2033
  get: {
1982
2034
  operationId: "attachComputer", tags: ["local"], summary: "The attach socket: a paired computer's driver dials it (a WebSocket)",
1983
- description: `A WebSocket (spec/computer/attach.md). The driver dials it with \`Authorization: Bearer <its token>\` (POST /computers/pair) and the subprotocol \`${ATTACH_SUBPROTOCOL}\`. A token no paired computer has (unknown, or its computer removed) is 401 before the upgrade; another subprotocol is 426. Frames are text, one JSON-RPC message each, at most ${MAX_LINE_BYTES} bytes (a bigger one closes the socket with 1009, a binary frame with 1003). The server is the caller: it sends hello, and the computer is attached while its hello is what it paired as (else closed with 4400, or 4426 for another protocol version); then the server sends a run's calls. Each side pings every ${ATTACH_HEARTBEAT_MS / 1000} s, and one that hears nothing for ${ATTACH_IDLE_MS / 1000} s closes with 4408. The same computer dialing again replaces its older socket (4409); removing it closes the socket with 4401. A request with no upgrade is 400. One server process holds the socket, so a run uses a paired computer only on a runner in that process (the start's runner beside the server).`,
2035
+ description: `A WebSocket (spec/computer/attach.md). The driver dials it with \`Authorization: Bearer <its token>\` (POST /computers/pair) and the subprotocol \`${ATTACH_SUBPROTOCOL}\`. A hosted machine of a dial provider dials it the same way with the token its create minted (GET /computers/daemon), and its socket stands for that create's machine, whose hello must say the kind, os and arch it was made as (else 4400). A token no paired computer or hosted machine has good (unknown, its computer removed, its machine deleted or past its backstop) is 401 before the upgrade; another subprotocol is 426. Frames are text, one JSON-RPC message each, at most ${MAX_LINE_BYTES} bytes (a bigger one closes the socket with 1009, a binary frame with 1003). The server is the caller: it sends hello, and the computer is attached while its hello is what it paired as (else closed with 4400, or 4426 for another protocol version); then the server sends a run's calls. Each side pings every ${ATTACH_HEARTBEAT_MS / 1000} s, and one that hears nothing for ${ATTACH_IDLE_MS / 1000} s closes with 4408. The same computer dialing again replaces its older socket (4409); removing it closes the socket with 4401. A request with no upgrade is 400. One server process holds the socket, so a run uses a paired computer only on a runner in that process (the start's runner beside the server).`,
1984
2036
  responses: { "101": { description: "Switching to the attach WebSocket." }, ...errors(400, 401, 500) },
1985
2037
  ...ATTACH_MARK,
1986
2038
  },
1987
2039
  },
2040
+ "/computers/daemon": {
2041
+ get: {
2042
+ operationId: "getComputerDaemon", tags: ["local"], summary: "This server's computerd build, for a hosted machine that dials it (its minted token)",
2043
+ description: `A hosted machine of a provider whose host has no exec (a dial provider's) fetches its daemon here as it boots, with \`Authorization: Bearer <its token>\`: the token the machine's create minted, which its env holds (AGENTRUN_ATTACH_TOKEN). The answer is this server's own computerd build for \`arch\`, the same bytes a hosted provider uploads, whose SHA-256 the create put in the machine's env (AGENTRUN_DAEMON_SHA256) for the machine to check before it runs it. A token no machine has good (unknown, revoked at the machine's delete, or past its backstop) is 401; each machine's token gets ${DAEMON_FETCHES_PER_MINUTE} fetches a minute (429 past them, with Retry-After); an arch other than amd64 or arm64 is 422. The owner's token and session are not a machine's token: 401.`,
2044
+ security: [],
2045
+ parameters: [{ name: "arch", in: "query", required: true, description: "The machine's architecture.", schema: { type: "string", enum: ["amd64", "arm64"] } }],
2046
+ responses: { "200": { description: "The daemon's bytes.", content: { "application/octet-stream": { schema: { type: "string", contentMediaType: "application/octet-stream" } } } }, ...errors(401, 422, 429, 500, 503) },
2047
+ ...ATTACH_MARK,
2048
+ },
2049
+ },
1988
2050
  "/computers/{computer_id}": {
1989
2051
  delete: {
1990
2052
  operationId: "deleteComputer", tags: ["local"], summary: "Remove a paired computer: its token ends and its socket closes",
@@ -2115,6 +2177,44 @@ const EXTENSIONS = {
2115
2177
  "x-agentrun-serve": "email/1",
2116
2178
  },
2117
2179
  },
2180
+ "/settings/calendar": {
2181
+ get: {
2182
+ operationId: "getCalendar", tags: ["local"], summary: "This server's calendar: its host, name and time zone, never its address",
2183
+ description: "The one calendar calendar_events reads. The owner's signed-in session alone (ownerSession), never the token, which is 403 forbidden in words.",
2184
+ "x-agentrun-secret": true,
2185
+ security: [{ ownerSession: [] }],
2186
+ responses: { "200": json(CALENDAR_VIEW, "The calendar."), ...errors(401, 403, 429, 500) },
2187
+ "x-agentrun-serve": "calendar/1",
2188
+ },
2189
+ put: {
2190
+ operationId: "saveCalendar", tags: ["local"], summary: "Save this server's calendar, its iCal address sealed",
2191
+ description: "Replaces the calendar. The address is https (webcal:// is read as https://; plain http, another scheme, or a user and password in it is refused in words), sealed under the server's seal key, and in no answer, event, log line or run input. The calendar is read once for its own name and time zone; a read that fails saves the address all the same (name and time_zone null): POST /settings/calendar/test says why. 422 by field for a body that does not read. A secret write: the owner's signed-in session alone (ownerSession), never the token, which is 403 forbidden in words.",
2192
+ "x-agentrun-secret": true,
2193
+ security: [{ ownerSession: [] }],
2194
+ requestBody: { required: true, content: { "application/json": { schema: { ...CALENDAR_BODY, required: ["url"] } } } },
2195
+ responses: { "200": json(CALENDAR_VIEW, "Saved."), ...errors(400, 401, 403, 415, 422, 429, 500, 503) },
2196
+ "x-agentrun-serve": "calendar/1",
2197
+ },
2198
+ delete: {
2199
+ operationId: "deleteCalendar", tags: ["local"], summary: "Forget this server's calendar",
2200
+ description: "Removes the calendar and its sealed address. calendar_events then answers that no calendar is saved. A secret write: the owner's signed-in session alone (ownerSession), never the token, which is 403 forbidden in words.",
2201
+ "x-agentrun-secret": true,
2202
+ security: [{ ownerSession: [] }],
2203
+ responses: { "204": { description: "Forgotten." }, ...errors(401, 403, 429, 500) },
2204
+ "x-agentrun-serve": "calendar/1",
2205
+ },
2206
+ },
2207
+ "/settings/calendar/test": {
2208
+ post: {
2209
+ operationId: "testCalendar", tags: ["local"], summary: "Read the calendar and say what it holds",
2210
+ description: "Reads the saved calendar with an empty body, or the address in the body (saved nowhere), as calendar_events reads it (https only; a private address refused unless its host is allowed in Settings → MCP servers; 10 MB, 20 s, 5 redirects), and answers in words: \"Work: 214 events, time zone America/New_York, next: Standup, Mon Nov 17 09:30\" (its name, its events and series, its time zone, and its next event in the next 62 days), or why it couldn't be read, never the address. 422 for a body that does not read, or an empty body with no calendar saved. A secret write: the owner's signed-in session alone (ownerSession), never the token, which is 403 forbidden in words.",
2211
+ "x-agentrun-secret": true,
2212
+ security: [{ ownerSession: [] }],
2213
+ requestBody: { required: false, content: { "application/json": { schema: CALENDAR_BODY } } },
2214
+ responses: { "200": json(closed({ ok: { type: "boolean", description: "The calendar was read." }, message: { type: "string", description: "In plain words: what it holds, or why it couldn't be read." } }), "The test's answer."), ...errors(400, 401, 403, 415, 422, 429, 500) },
2215
+ "x-agentrun-serve": "calendar/1",
2216
+ },
2217
+ },
2118
2218
  "/settings/chatgpt": {
2119
2219
  get: {
2120
2220
  operationId: "getChatGPTSignIn", tags: ["local"], summary: "This server's ChatGPT sign-in: its state, who and which plan, never a token",
@@ -2206,19 +2306,19 @@ const EXTENSIONS = {
2206
2306
  },
2207
2307
  put: {
2208
2308
  operationId: "saveMcpServer", tags: ["local"], summary: "Preview a remote MCP server, then save it with the tools listed and its credential sealed",
2209
- 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 that would drop or change the credential the server holds (another \`auth.type\`, or none): the owner's signed-in session alone. 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): 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.`,
2309
+ 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 that would drop or change the credential the server holds (another \`auth.type\`, or none): the owner's signed-in session alone. 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 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.`,
2210
2310
  parameters: [MCP_NAME],
2211
2311
  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 } } } } },
2212
- responses: { "200": json(MCP_SERVER_VIEW, "The server, as saved."), ...errors(400, 401, 403, 409, 412, 415, 422, 429, 500), ...MCP_FAILED },
2312
+ 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 },
2213
2313
  "x-agentrun-serve": "mcpservers/1",
2214
2314
  },
2215
2315
  delete: {
2216
2316
  operationId: "deleteMcpServer", tags: ["local"], summary: "Forget a saved MCP server and its credential",
2217
- description: "409 composio_in_use, naming them in `details.triggers`, for a Composio server that Composio triggers still use: delete them first. A server the Composio preset made also has its MCP server deleted in the owner's Composio account, with the saved key, after the row is removed: the row is already gone while that delete waits on Composio. Composio's 404 means it is already gone; when Composio refuses or does not answer, or the saved key does not open, the answer is 200 with `composio.removed: false` and a note to remove it there. 403 forbidden to the API token when the server holds a credential: removing it drops a secret, the owner's signed-in session's alone. A server saved with none is the token's to remove. 412 precondition_failed when the server's credential changed between that check and the removal (a save or a sign-in landed): nothing is removed, and nothing is sent to Composio.",
2317
+ description: "409 composio_in_use, naming them in `details.triggers`, for a Composio server that Composio triggers still use: delete them first. A server the Composio preset made also has its MCP server deleted in the owner's Composio account, with the saved key, after the row is removed: the row is already gone while that delete waits on Composio. So does what its save made for it there that no other saved server uses: the connected account its connect link started (the link with it), and the auth config it made. What another saved server uses is kept, and goes with the last of them; what the save found there already (an auth config or an account the owner had) is never deleted. A preset's delete answers 200 with `composio`: `removed` true when nothing it was to remove is left, and `note`, what it removed, kept (and why) and left, in words. Composio's 404 means that one is already gone; when Composio refuses or does not answer, or the saved key does not open, `removed` is false and the note names what is left, to remove there. 403 forbidden to the API token when the server holds a credential: removing it drops a secret, the owner's signed-in session's alone. A server saved with none is the token's to remove. 412 precondition_failed when the server's credential changed between that check and the removal (a save or a sign-in landed): nothing is removed, and nothing is sent to Composio.",
2218
2318
  parameters: [MCP_NAME],
2219
2319
  responses: {
2220
- "204": { description: "Forgotten (and, for a Composio preset server, its Composio MCP server deleted, or already gone there)." },
2221
- "200": json(closed({ deleted: { type: "boolean", enum: [true] }, composio: closed({ removed: { type: "boolean", enum: [false] }, note: { type: "string", description: "What to do by hand: remove the server in Composio yourself, with the dashboard's address." } }) }), "Forgotten here, but the Composio MCP server a preset made could not be deleted (Composio refused or did not answer): it stays in the owner's Composio account until removed there. The row is gone either way."),
2320
+ "204": { description: "Forgotten: a server the Composio preset did not make." },
2321
+ "200": json(closed({ deleted: { type: "boolean", enum: [true] }, composio: closed({ removed: { type: "boolean", description: "Nothing the delete 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." } }) }), "Forgotten here, a Composio preset server: what its delete did in the owner's Composio account. The row is gone either way."),
2222
2322
  ...errors(401, 403, 404, 409, 412, 429, 500),
2223
2323
  },
2224
2324
  "x-agentrun-serve": "mcpservers/1",
@@ -2245,10 +2345,10 @@ const EXTENSIONS = {
2245
2345
  "/settings/mcp-servers/{name}/composio": {
2246
2346
  put: {
2247
2347
  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",
2248
- description: COMPOSIO_NOTE + " Makes (or reuses) a Composio-managed auth config for a toolkit that needs the person's account, makes a Composio MCP server allowing only `tools`, asks for its address (the helper actions that connect an account left off; its path ends in `/mcp`), and saves that address as the MCP server `name` through the one MCP save: the key is sealed as an `x-api-key` header, the tools listed, none priced (\"not metered\"). When the toolkit needs an account and `user_id` has no active one, `connect_url` is Composio's page to connect it; nothing here signs in. `user_id` defaults to `agentrun`. 422 for a bad name, key, toolkit or tools, a key or request Composio refuses (each says the step); 424 `upstream_failed` when Composio fails or the saved address does not list its tools. Nothing is saved unless every step succeeds. The owner's signed-in session alone: 403 forbidden to the API token.",
2348
+ description: COMPOSIO_NOTE + " Makes (or reuses) a Composio-managed auth config for a toolkit that needs the person's account, makes a Composio MCP server allowing only `tools`, asks for its address (the helper actions that connect an account left off; its path ends in `/mcp`), and saves that address as the MCP server `name` through the one MCP save: the key is sealed as an `x-api-key` header, the tools listed, none priced (\"not metered\"). When the toolkit needs an account and `user_id` has no active one, `connect_url` is Composio's page to connect it; nothing here signs in. `user_id` defaults to `agentrun`. 422 for a bad name, key, toolkit or tools, a key or request Composio refuses (each says the step); 424 `upstream_failed` when Composio fails or the saved address does not list its tools. Nothing is saved unless every step succeeds, and a save that fails removes in Composio what it made there (the MCP server, the connected account its connect link started, the auth config it made), never what it found; when Composio refuses that too, its error's message names what is left, with the dashboard's address (and a 422 on a field says it in \`details.composio\` as well). A save over a server the preset made removes, once it is saved, the MCP server that server's earlier save made, and what that save made and this one no longer stands on (the account of another `user_id`, the auth config of another toolkit), with the key it was made with, unless another saved server uses it (then it is that one's), and answers `composio` saying so, as a delete does. A save over a server as another `user_id` or auth config is 409 composio_in_use, naming them in `details.triggers`, while Composio triggers use it: delete them first; a save that leaves what they stand on alone goes through. Preset saves, the saves of the servers they made, and deletes of MCP servers run one at a time. The owner's signed-in session alone: 403 forbidden to the API token.",
2249
2349
  parameters: [MCP_NAME],
2250
2350
  requestBody: { required: true, content: { "application/json": { schema: closedWith({ api_key: COMPOSIO_KEY, toolkit: COMPOSIO_TOOLKIT, tools: { type: "array", minItems: 1, maxItems: 500, items: { type: "string", minLength: 1 }, description: "The slugs of the actions to grant, from the listing." } }, { user_id: { type: "string", pattern: "^[A-Za-z0-9._@-]{1,128}$", description: "The Composio user the actions run as; default `agentrun`." } }) } } },
2251
- responses: { "200": json(closedWith({ server: MCP_SERVER_VIEW }, { connect_url: { type: "string", format: "uri", description: "Present when the toolkit needs an account and the user has no active one: Composio's page to connect it." }, not_served: { type: "array", items: { type: "string" }, description: "Present when Composio's server leaves out some of `tools` (it can, for an action it was allowed): the slugs it doesn't list, which a run can't call." } }), "The server as saved, and where to connect the account when it must be."), ...errors(400, 401, 403, 409, 415, 422, 429, 500), ...MCP_FAILED },
2351
+ responses: { "200": json(closedWith({ server: MCP_SERVER_VIEW }, { connect_url: { type: "string", format: "uri", description: "Present when the toolkit needs an account and the user has no active one: Composio's page to connect it." }, not_served: { type: "array", items: { type: "string" }, description: "Present when Composio's server leaves out some of `tools` (it can, for an action it was allowed): the slugs it doesn't list, which a run can't call." }, 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 was over a server whose earlier save made something at Composio that this one no longer stands on: what became of it.") }), "The server as saved, and where to connect the account when it must be."), ...errors(400, 401, 403, 409, 415, 422, 429, 500), ...MCP_FAILED },
2252
2352
  "x-agentrun-serve": "mcpservers/1",
2253
2353
  },
2254
2354
  },
@@ -2683,6 +2783,7 @@ const RUN_FIELDS = {
2683
2783
  revision: { type: "string", description: "The id of the agent revision the run runs.", "x-agentrun-serve": "serve/1" },
2684
2784
  kind: { enum: ["agentic", "workflow"], description: "The revision's kind: an agentic run, or a workflow run.", "x-agentrun-serve": "serve/1" },
2685
2785
  archived_at: { type: ["string", "null"], description: "When the run, or its agent, was archived, while it is; else null.", "x-agentrun-serve": "serve/1" },
2786
+ labels: { ...RUN_LABELS, description: "The labels the run was started with (RunCreate.labels), as given; `{}` when none. Always sent by a server that keeps labels (`runlabels/1`); absent from an earlier one's answer." },
2686
2787
  };
2687
2788
  /** What a run waits on, one field for every kind, told apart by `kind`: a question it asked a person, or a tool call
2688
2789
  * that waits for approval. */
@@ -2823,6 +2924,7 @@ const FIELD_EXTENSIONS = {
2823
2924
  },
2824
2925
  RunCreate: {
2825
2926
  mcp_auth: { ...MCP_RUN_AUTH, description: `${MCP_RUN_AUTH.description} Each names a saved MCP server whose \`auth.type\` is per_run (422 at \`mcp_auth.<server>\` otherwise, no run made). Sealed into the run's launch for its life, read at each claim, and erased by the write that ends it; never in its saved body, its timeline, its view or an Idempotency-Key's fingerprint (a retry with a new credential answers the first request's run).` },
2927
+ labels: { ...RUN_LABELS, description: `The caller's own labels for the run: at most ${MAX_LABELS} keys, each 1 to 63 letters, digits, \`.\`, \`_\`, \`-\` or \`/\` starting with a letter or a digit; each value text of 1 to ${MAX_LABEL_VALUE} characters with no control character. Kept on the run as given, served on every read of it (\`labels\` on Run and RunSummary) and matched by GET /runs' \`label\`; set once, at the start. The server reads nothing else from them: put no secret in one. Another shape is 422 under \`labels\` or \`labels.<key>\`. Absent: none.` },
2826
2928
  workflow_first: {
2827
2929
  type: "boolean",
2828
2930
  description: "Whether a run of an agent that learns may start on one of its learned workflows. On (absent or true), a run whose input fits exactly one active learned workflow (its input schema has a required field, and the run's input passes it) runs that workflow first, with no turn of the agent's model: its answer is the run's answer, and if it hands the job back (it escalates, a step fails), the same run goes on with the agent, given what the workflow found. The run keeps which path it took: `workflow`, `handed_back` or `agent`. false: the agent takes the run from its first turn.",
@@ -2857,6 +2959,18 @@ const FIELD_EXTENSIONS = {
2857
2959
  description: "While a message the run took is still open (an agentic run, working or queued): when its turn last wrote anything, a request's start included; it holds still while a tool or a model request runs, and moves as the turn writes. Null once every message has had its turn, and on a workflow run.",
2858
2960
  "x-agentrun-serve": "turnend/1",
2859
2961
  },
2962
+ recordings: {
2963
+ type: "array",
2964
+ items: closed({
2965
+ path: { type: "string", description: "Where it is read: `GET /runs/{run_id}/files/{path}` with this path (`recordings/<computer>.mp4`), `video/mp4`, its byte ranges answered; `?download=1` for an attachment." },
2966
+ computer: { type: "string", description: "The computer it recorded: its id, as the file is named. A computer's later files (a resumed run's, a phone's frames that changed format) are `<computer>-2.mp4` and on." },
2967
+ seconds: { type: "number", minimum: 0, description: "How long it plays, to a tenth of a second, as far as it is written." },
2968
+ bytes: { type: "integer", minimum: 0, description: "Its size now." },
2969
+ finished: { type: "boolean", description: "false while it is still being written: it plays up to its last whole fragment. true once its recording stopped, and for every file once the run has ended and the file has stopped changing (a few seconds after the end)." },
2970
+ }, "One video of a computer's screen during the run (H.264 in fragmented MP4)."),
2971
+ description: "On the run read (and an archive's or unarchive's answer) alone, never in a list: the videos of the run's screen, where its agent's computer says `record: true` (a desktop or a phone), each computer's files in the order they were recorded; empty when nothing was recorded, and for a run whose words are withheld. Read from the files on the machine whose runner recorded them. The video shows everything on the screen: see the agent's `computer.record`.",
2972
+ "x-agentrun-serve": "runvideo/1",
2973
+ },
2860
2974
  input: {
2861
2975
  type: ["object", "null"],
2862
2976
  additionalProperties: true,
@@ -3041,13 +3155,18 @@ const FIELD_EXTENSIONS = {
3041
3155
  persistent: { type: "boolean", description: "Whether the agent keeps its own computer between runs: true makes one at its first run, detaches it (not deletes it) at each run's end, and attaches it again at the next, with what was on it; false or absent, a fresh computer for each run. Only where the provider keeps one for the kind and image (GET /computers: the provider's `persistent`), else 422 not_allowed; never one that mounts the run's folder. One run at a time: a run that finds the computer held by another run still going is refused at its start, naming that run. Archiving the agent, turning this off, or a setting on another provider or image deletes the computer (GET /agents/{agent_id}'s `own_computer` shows it)." },
3042
3156
  surface: { enum: ["code", "tools"], description: "How the agent drives a desktop or a phone. `code`: by `codemode` scripts alone, whose `tools.computer_observe`, `tools.computer_act` and `tools.computer_screenshot` are each a gated, recorded call of its own; the model is offered `codemode` and the hand-over (`computer_request_handoff`), not the step tools (a harness with its own code mode, Codex, is still handed them). `tools`: the step tools and the hand-over, listed; a `codemode` script calls them too. Absent, as `tools`. Only a desktop or a phone takes it (422 not_allowed on another kind)." },
3043
3157
  exec: { type: "boolean", description: "`false`: the agent gets no shell and starts no program on its desktop or phone. Its computer's `exec` and `processes` groups are taken out of what its tools and scripts see (no `computer.shell`, no `computer.processes`; a script that reaches for one is refused in words), no folder is mounted in the computer, and the run gets no `bash` or background tool, wherever its folder is. The run's own computer channel (`POST /runs/{run_id}/computer/call`, the owner's) keeps every group. `true` or absent: as the computer offers. Only a desktop or a phone takes it (422 not_allowed on another kind)." },
3158
+ record: { type: "boolean", description: "`true`: each run records a video of its desktop's or phone's screen (H.264, fragmented MP4, at most 10 frames a second and 1280 pixels on the long side, no audio) into its run folder's `recordings/`, beside `work/`, where the agent can neither read nor change it. The video shows everything on the screen, including whatever a person types while they take over and any secret that appears on screen; pixels can't be redacted the way the run's logs are. It records while the run holds the computer, with or without a viewer, pauses while the run is parked (a resumed run goes on in a new file) and stops at the computer's release, the run's end, or its cap (500 MB across the run's files, or 2 hours from its start or the run's resume), which the run's timeline says. A server without ffmpeg refuses it (422 not_allowed). `false` or absent: nothing is recorded. Only a desktop or a phone takes it (422 not_allowed on another kind)." },
3044
3159
  },
3045
- description: "The computer the revision's runs are given (Settings → Computers): its kind, the provider that serves it, the image it starts from, a sandbox's GPUs, whether the agent keeps it between runs, and, for a desktop or a phone, how the agent drives it and whether it may run programs on it. `place` is its v2 view where it can say it: `{kind: none}` is `place {mode: runner}`, `{kind: sandbox, provider: X}` is `place {mode: sandbox, box: X}`; a desktop, phone or browser computer leaves the run's folder on the runner, so its place reads runner. Writing either sets both, and both given must agree (422). Absent on a create, the server's default (as `place`); an edit that names neither keeps the agent's.",
3160
+ description: "The computer the revision's runs are given (Settings → Computers): its kind, the provider that serves it, the image it starts from, a sandbox's GPUs, whether the agent keeps it between runs, and, for a desktop or a phone, how the agent drives it, whether it may run programs on it and whether its runs record its screen. `place` is its v2 view where it can say it: `{kind: none}` is `place {mode: runner}`, `{kind: sandbox, provider: X}` is `place {mode: sandbox, box: X}`; a desktop, phone or browser computer leaves the run's folder on the runner, so its place reads runner. Writing either sets both, and both given must agree (422). Absent on a create, the server's default (as `place`); an edit that names neither keeps the agent's.",
3046
3161
  "x-agentrun-serve": "computer/1",
3047
3162
  },
3048
3163
  tool_settings: { ...AGENT_TOOL_SETTINGS, description: "The agent's own tool settings (web_search's, web_fetch's and browser's provider, any tool's permission, an MCP server's wildcard mcp:<server>/*, an MCP tool's pin, bash's policy), over the server's (GET /settings/tools), except a deny set on the server, which is absolute: the tool is refused on this server whatever this agent sets; absent, the server's. A pin is not over the server's: both hold. A grant in tools names the capability, never a provider.", "x-agentrun-serve": "providers/1" },
3049
3164
  approvals: { enum: ["ask", "never"], default: "ask", description: "Whether the agent's runs ask a person or run unattended. `ask`, the default: a tool set to ask parks the run for an approval, as its tool settings say. `never`: the agent runs unattended, and each tool that would ask is allowed instead, decided by the tool gate at each call, so a tool granted later and an MCP tool (`mcp:<server>/<tool>`, which asks by default) are covered on every harness. It never lifts a deny, whether set on this server or in the agent's own tool_settings, nor a pin, nor anything else the gate refuses before it decides between running and asking. A workflow's call node on a tool set to ask runs under `never`. Absent on a request: ask. An edit that leaves it out asks, so no edit makes an agent unattended by saying nothing. Every answer names it.", "x-agentrun-serve": "unattended/1" },
3050
- learning: { enum: [true, false, "notes"], default: false, description: "Whether an agentic revision's runs learn, and what: `true`, notes, skills and learned workflows; `\"notes\"`, notes and skills alone (a run is never given a learned workflow nor asked to draft one); `false`, nothing. A run that learns starts from what its agent has learned, its notes in its instructions under `# Learned` (each whole within the server's learning budget, else the index and the notes changed last, whole) and in `.learning/` in its working directory, and once it answers or fails is asked one more turn to add notes there, which are checked, graded and merged. Kept when a definition says so, true, false or `\"notes\"`; absent, off, and an answer shows none. An edit that leaves it out keeps the agent's. A workflow revision keeps none. On a server whose learning is off (`capabilities.features.learning`), no run learns, whatever this says.", "x-agentrun-serve": "learning/1" },
3165
+ learning: { oneOf: [{ enum: [true, false, "notes"] }, { type: "object", additionalProperties: false, properties: {
3166
+ compile_after: { type: "integer", minimum: 1, maximum: 200, default: 20, description: "The job compiles into a learned workflow once the agent has this many completed runs of its own." },
3167
+ agree_min: { type: "number", minimum: 0, maximum: 1, default: 0.8, description: "The draft's one check replays it on the inputs of those runs: promoted only when, of the inputs it answered alone, at least this share say what the agent's own recorded answer said." },
3168
+ alone_min: { type: "number", minimum: 0, maximum: 1, default: 0.7, description: "...and only when it answered at least this share of them alone (no escalate, no failed step). Under either bar it is recompiled once with the inputs it did not agree on, checked the same way, then promoted or stopped: nothing compiles again." },
3169
+ } }], default: false, description: "Whether an agentic revision's runs learn, and what: `true`, notes, skills and learned workflows; an object, the same with the loop's numbers set on it (`compile_after`, `agree_min`, `alone_min`, each optional: one left out is its default; `true` is every default); `\"notes\"`, notes and skills alone (a run is never given a learned workflow nor asked to draft one); `false`, nothing. A run that learns starts from what its agent has learned, its notes in its instructions under `# Learned` (each whole within the server's learning budget, else the index and the notes changed last, whole) and in `.learning/` in its working directory, and once it answers or fails is asked one more turn to add notes there, which are checked, graded and merged. Kept when a definition says so, true, false, `\"notes\"` or an object (its numbers in one order); a number out of range or an unknown key is a 422 `wrong_type`; absent, off, and an answer shows none. An edit that leaves it out keeps the agent's. A workflow revision keeps none. On a server whose learning is off (`capabilities.features.learning`), no run learns, whatever this says.", "x-agentrun-serve": "learning/1" },
3051
3170
  checkout: { enum: ["pull_request", "none"], description: "What the server checks out in each run's folder before its first turn, an agentic definition's alone. `pull_request`: the pull request the run's GitHub event names (a GitHub trigger's firing: its repository, number, head and base), at its head, detached, in `repo/`, with its base and their merge base fetched beside it (refs `pr/head`, `pr/base`, `pr/merge-base`). The fetch is the server's own, one command on the run's folder, with an installation token of the server's GitHub App narrowed to that repository and `contents: read`, which the agent never holds: it is never in the folder, the checkout's git config, its remote's URL, the agent's environment or the log. With no App, or one not installed there, the fetch is anonymous, which a public repository answers. The run's system prompt says what was checked out, or why nothing was (no pull request named, the fetch failed), so it can read the change another way, such as the GitHub MCP. The checkout is removed when the run's claim ends. An edit that leaves it out keeps the agent's; `none` clears it. A template sets it from its manifest's `checkout`.", "x-agentrun-serve": "checkout/1" },
3052
3171
  },
3053
3172
  AgentCreate: {
@@ -3548,6 +3667,11 @@ export function openapiDocument(capabilityOf, adapters = TRIGGER_ADAPTERS) {
3548
3667
  listAgents.parameters = [...listAgents.parameters, { name: "archived", in: "query", required: false, description: "true lists only archived agents; false, the default, the others.", schema: { type: "boolean" } }];
3549
3668
  listAgents["x-agentrun-serve-changed"] = { archived: "archivedparam/1" };
3550
3669
  changed.push("GET /agents");
3670
+ // GET /agents/{agent_id}/runs takes GET /runs' `label` filter too (server.ts runsPage, shared by both routes).
3671
+ const listAgentRuns = doc.paths["/agents/{agent_id}/runs"].get;
3672
+ listAgentRuns.parameters = [...listAgentRuns.parameters, LABEL_PARAMETER];
3673
+ listAgentRuns["x-agentrun-serve-changed"] = { ...listAgentRuns["x-agentrun-serve-changed"], label: "runlabels/1" };
3674
+ changed.push("GET /agents/{agent_id}/runs");
3551
3675
  // GET /agents/{agent_id} always sends the agent's `tools` (server.ts getAgent; [] before it has a revision), which the
3552
3676
  // agent in a list, a create or a save does not: its 200 is the contract's Agent with `tools` required.
3553
3677
  const getAgent = doc.paths["/agents/{agent_id}"].get;
@@ -3581,6 +3705,12 @@ export function openapiDocument(capabilityOf, adapters = TRIGGER_ADAPTERS) {
3581
3705
  files["x-agentrun-serve-changed"] = { description: "signins/1", ...(added ? { responses: "signins/1" } : {}) };
3582
3706
  changed.push(`GET ${path}`);
3583
3707
  }
3708
+ // runvideo/1: a run's screen recordings are read under recordings/, as video/mp4, their byte ranges answered.
3709
+ const readFile = doc.paths["/runs/{run_id}/files/{path}"].get;
3710
+ readFile.description = `${String(readFile.description).trimEnd()}\nHere a path under \`recordings/\` is one of the run's screen recordings (the run read's \`recordings\`, made where its agent's computer says \`record: true\`), never a file the run made: \`video/mp4\`, inline unless \`?download=1\`, read-only, to whoever may read the run's other files. A folder the run made named \`recordings\` is neither listed nor served. A recording still being written is served as it stands: a fragmented MP4 plays up to its last whole fragment. \`Range\` is honoured for every file (\`features.files.range\`): one byte range, \`206\` with \`Content-Range\`, so a \`<video>\` can seek; one that starts past the end is \`416 range_not_satisfiable\`.\n`;
3711
+ for (const code of ["200", "206"])
3712
+ readFile.responses[code].content = { "video/mp4": { schema: { type: "string", contentMediaType: "video/mp4" } }, ...readFile.responses[code].content };
3713
+ readFile["x-agentrun-serve-changed"] = { ...readFile["x-agentrun-serve-changed"], responses: "runvideo/1" };
3584
3714
  // An agentic run's cancel is its end at once: the 202 reads `cancelled`, and no later end of its turn moves it.
3585
3715
  const cancel = doc.paths["/runs/{run_id}/cancel"].post;
3586
3716
  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`;
@@ -3716,7 +3846,7 @@ export function openapiDocument(capabilityOf, adapters = TRIGGER_ADAPTERS) {
3716
3846
  }, {
3717
3847
  oauth: { ...MCP_SIGN_IN_CLIENT, description: "With `auth: oauth`, when the sign-in's discovery could be made." },
3718
3848
  }),
3719
- input_invalid: { type: "object", additionalProperties: false, properties: { oauth: { ...MCP_SIGN_IN_CLIENT, description: "With field `client_id`, reason `registration_unavailable` (POST .../oauth/start): as a preview's `details.oauth`, `registration` false." } } },
3849
+ input_invalid: { type: "object", additionalProperties: false, properties: { oauth: { ...MCP_SIGN_IN_CLIENT, description: "With field `client_id`, reason `registration_unavailable` (POST .../oauth/start): as a preview's `details.oauth`, `registration` false." }, composio: { type: "string", description: "A Composio preset save refused on a field (PUT .../composio) whose removal of what it made there Composio refused too: what is left there and where to remove it, in words, as its message ends." } } },
3720
3850
  upstream_failed: { type: "object", additionalProperties: false, properties: { status: { type: "integer", description: "The MCP server's HTTP status, when it answered one." } } },
3721
3851
  sign_in_held: { type: "object", additionalProperties: false, minProperties: 1, maxProperties: 1, properties: { held_by: { type: "string", description: "The run that holds the sign-in's save lease." }, handed_to: { type: "string", description: "A run still going that was handed the sign-in (signins/1)." } } },
3722
3852
  wrong_origin: closed({ open: { type: "string", format: "uri", description: "Where to open the console to sign in: the address the authorization server sends the browser back to." } }),
package/dist/print.d.ts CHANGED
@@ -1,9 +1,11 @@
1
- /** Where the token came from: made at this start (printed this once), kept in DIR/.token, or the environment's. */
2
- export type TokenSource = "made" | "file" | "env";
1
+ /** Where the token came from: made at this start (printed this once), kept in DIR/.token, the environment's
2
+ * (AGENTRUN_TOKEN), or the token list's alone (AGENTRUN_TOKENS). */
3
+ export type TokenSource = "made" | "file" | "env" | "list";
3
4
  /** The banner's lines. The token is printed only when this start made it; else where it is. `publicUrl` is the address
4
5
  * people open (AGENTRUN_PUBLIC_URL), which the base URL and the link use. With `accounts` the page is the owner's
5
6
  * password, so its link holds nothing; with none, the link holds this start's launch code (`launchCode`), never the
6
- * token. `apiOnly`: no console to open, so the line says what is served instead. `boxes`: which boxes are ready, in
7
+ * token. `tokenIds`: the ids of the tokens the server takes (api-token.ts), named when there is more than one or a list
8
+ * gave them, never a secret. `apiOnly`: no console to open, so the line says what is served instead. `boxes`: which boxes are ready, in
7
9
  * words (Serve's boxesLine), last. */
8
10
  export declare function banner(o: {
9
11
  url: string;
@@ -11,6 +13,7 @@ export declare function banner(o: {
11
13
  data: string;
12
14
  token: string;
13
15
  source: TokenSource;
16
+ tokenIds?: readonly string[];
14
17
  listen?: string;
15
18
  publicUrl?: string;
16
19
  accounts?: boolean;
package/dist/print.js CHANGED
@@ -4,15 +4,17 @@ import { join } from "node:path";
4
4
  /** The banner's lines. The token is printed only when this start made it; else where it is. `publicUrl` is the address
5
5
  * people open (AGENTRUN_PUBLIC_URL), which the base URL and the link use. With `accounts` the page is the owner's
6
6
  * password, so its link holds nothing; with none, the link holds this start's launch code (`launchCode`), never the
7
- * token. `apiOnly`: no console to open, so the line says what is served instead. `boxes`: which boxes are ready, in
7
+ * token. `tokenIds`: the ids of the tokens the server takes (api-token.ts), named when there is more than one or a list
8
+ * gave them, never a secret. `apiOnly`: no console to open, so the line says what is served instead. `boxes`: which boxes are ready, in
8
9
  * words (Serve's boxesLine), last. */
9
10
  export function banner(o) {
10
- const where = o.source === "env" ? "$AGENTRUN_TOKEN" : `<in ${join(o.data, ".token")}>`;
11
+ const where = o.source === "env" ? "$AGENTRUN_TOKEN" : o.source === "list" ? "<a secret in $AGENTRUN_TOKENS>" : `<in ${join(o.data, ".token")}>`;
11
12
  const key = o.source === "made" ? o.token : where;
12
13
  return [
13
14
  `agentrun-serve on ${o.baseUrl} (agent store in ${o.data}${o.listen ? `, listening on ${o.listen}` : ""})`,
14
15
  `AGENTRUN_BASE_URL=${o.publicUrl ? `${o.publicUrl}/v2` : o.baseUrl}`,
15
16
  `AGENTRUN_API_KEY=${key}`,
17
+ ...(o.tokenIds && (o.tokenIds.length > 1 || o.source === "list") ? [`API tokens taken (ids): ${o.tokenIds.join(", ")}`] : []),
16
18
  o.apiOnly
17
19
  ? "API only (AGENTRUN_API_ONLY=1): the run routes are served; the console, sign-in, setup, settings, MCP, triggers and hooks are refused."
18
20
  : o.accounts || o.launchCode === undefined ? `Open ${o.publicUrl ?? o.url}/` : `Open ${o.publicUrl ?? o.url}/?launch=${o.launchCode}`,
@@ -26,6 +26,10 @@ export declare function listFiles(workspace: Workspace, cap: number, { owned: is
26
26
  /** The listing entry at `rel`, a file's or a folder's, or undefined when there is none: not there, or a link (never
27
27
  * listed). */
28
28
  export declare function entryAt(workspace: Workspace, rel: string): Promise<Entry | undefined>;
29
- /** File `rel` of `workspace`, raw, in reads of SEND_CHUNK: its length from the listing, so HEAD reads no byte. `who`
30
- * names who makes a file private, in the words of a 403. */
29
+ /** The one byte range a Range header asks of a file of `size` bytes, first and last byte; undefined for the whole file (no
30
+ * Range, or one this server does not take: another unit, several ranges, or a last byte before the first);
31
+ * "unsatisfiable" when it starts past the file's end. */
32
+ export declare function rangeOf(header: string | undefined, size: number): [number, number] | "unsatisfiable" | undefined;
33
+ /** File `rel` of `workspace`, raw, in reads of SEND_CHUNK, whole or the one byte range its Range header asks (206): its
34
+ * length from the listing, so HEAD reads no byte. `who` names who makes a file private, in the words of a 403. */
31
35
  export declare function sendFile(req: IncomingMessage, res: ServerResponse, url: URL, workspace: Workspace, rel: string, who: string): Promise<void>;