@parcha/agentrun 0.4.1 → 0.4.2

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.
package/README.md CHANGED
@@ -39,7 +39,10 @@ Every other command is the server's API, from a second terminal: `npx @parcha/ag
39
39
  `--data` on its own: the server writes its address and where its token is to `DIR/.server.json` once it listens. For
40
40
  another server, set `AGENTRUN_BASE_URL` and `AGENTRUN_API_KEY`. The response's JSON goes to stdout and an error's to
41
41
  stderr; the exit code is 0 when it worked, 1 when the server refused, 2 for bad usage, 3 when the server cannot be
42
- reached and 4 for a missing or refused token. The token is never a flag and never printed.
42
+ reached, 4 for a missing or refused token and 5 when the server does not offer the command here (a 501,
43
+ `unsupported_here`, its error saying why). The token is never a flag and never printed. A list command (`agents list`,
44
+ `runs list` and every other that takes `--cursor`) prints one page; `--all` follows `next_cursor` and prints every page
45
+ as one list.
43
46
 
44
47
  `runs wait RUN_ID` waits until the run ends or waits on a person and prints it; `runs start AGENT_ID ... --wait` starts
45
48
  a run and does the same. Its exit code says how it stopped: 0 completed, 1 failed or cancelled, 8 it waits on a person
package/bin/agentrun.mjs CHANGED
@@ -1,9 +1,16 @@
1
1
  #!/usr/bin/env node
2
2
  // npx @parcha/agentrun: AgentRun Server on this machine with one command. Node first, in syntax any Node reads, so an old one
3
- // gets one plain line rather than a parse error; the repository's own rule (scripts/check-node.mjs).
3
+ // gets one plain line rather than a parse error; the repository's own rule (scripts/check-node.mjs). The floor is read from
4
+ // this package's own engines field (">=MAJOR.MINOR.PATCH"), so the line never names another version than npm's.
5
+ import { readFileSync } from "node:fs";
6
+
7
+ const engines = JSON.parse(readFileSync(new URL("../package.json", import.meta.url), "utf8")).engines.node;
8
+ const floor = /^>=(\d+)\.(\d+)\.\d+$/.exec(engines);
9
+ if (!floor) throw new Error(`this package's engines.node is ${JSON.stringify(engines)}, not ">=MAJOR.MINOR.PATCH"`);
10
+ const [needMajor, needMinor] = [Number(floor[1]), Number(floor[2])];
4
11
  const [major, minor] = process.versions.node.split(".").map(Number);
5
- if (major < 22 || (major === 22 && minor < 19) || major === 23 || (major === 24 && minor < 2)) {
6
- console.error(`AgentRun needs Node.js 22.19 or newer on 22, or 24.2 or newer; you have v${process.versions.node}.`);
12
+ if (major < needMajor || (major === needMajor && minor < needMinor)) {
13
+ console.error(`AgentRun needs Node.js ${needMajor}.${needMinor} or newer; you have v${process.versions.node}.`);
7
14
  process.exit(1);
8
15
  }
9
16
  import("../lib/start.mjs").then(({ main }) => main(process.argv.slice(2))).then((code) => { process.exitCode = code; });
package/lib/cli.mjs CHANGED
@@ -8,8 +8,8 @@ import { homedir } from "node:os";
8
8
  import { join, resolve } from "node:path";
9
9
  import { parseArgs } from "node:util";
10
10
  import { COMMANDS, SECRET_ROUTES } from "./commands.generated.mjs";
11
- import { FLAGS, REQUEST_MS, WAIT, followTimeline, timerMs, waitRun } from "./follow.mjs";
12
- import { SECRETS, guarded } from "./login.mjs";
11
+ import { ALL, FLAGS, MAX_PAGES, REQUEST_MS, WAIT, followTimeline, timerMs, waitRun } from "./follow.mjs";
12
+ import { SECRETS, guarded, refusalExit } from "./login.mjs";
13
13
  import { SKILL_INSTALL } from "./skill.mjs";
14
14
  import { TEMPLATE_EVAL, TEMPLATE_VALIDATE } from "./template.mjs";
15
15
 
@@ -63,8 +63,9 @@ const HELP = () => {
63
63
  "Keys and other secrets are set in the console, signed in: the token can't write one, so no command does.",
64
64
  "Output: the response's JSON on stdout, a file's bytes as they are; an error's on stderr. Exit codes: 0 ok, 1 the",
65
65
  "server refused, 2 bad usage (a bad base URL among it), 3 the server cannot be reached, 4 no token, the token was",
66
- "refused, or the config file, the server's record or its token file was refused. runs wait and runs start --wait",
67
- "print the run once it ends or waits on a person: 0 completed, 1 failed, cancelled or --timeout passed (it goes on),",
66
+ "refused, or the config file, the server's record or its token file was refused, 5 the server does not offer the",
67
+ "command here (501, unsupported_here; the error says why). runs wait and runs start --wait print the run once it",
68
+ "ends or waits on a person: 0 completed, 1 failed, cancelled or --timeout passed (it goes on),",
68
69
  "8 it waits on a person (a question, its spend cap, a stopped turn, a paused workflow). runs timeline --follow prints",
69
70
  "the timeline's pages as they come, one JSON object per line, until the run ends: 0 completed, 1 failed or cancelled.",
70
71
  ].join("\n");
@@ -85,6 +86,7 @@ function commandHelp(entry) {
85
86
  const value = f.type === "boolean" ? "" : ` ${f.enum ? f.enum.join("|") : f.type.toUpperCase()}`;
86
87
  return [`--${flag(f.name)}${value}`, `${f.required ? "(required) " : ""}${f.description}`];
87
88
  });
89
+ if (ALL.listing(entry)) flags.push(ALL.help);
88
90
  if (entry.hasBody) {
89
91
  flags.push([BODY, entry.secretBody ? "the body, from stdin or a file only: it holds a secret" : "the body, inline, from a file or from stdin; flags win over a JSON body's fields"]);
90
92
  flags.push(["--body-type TYPE", `the body's type: ${entry.bodyTypes.join(", ")} (default ${defaultType(entry.bodyTypes)}); any other than JSON is sent as given`]);
@@ -265,14 +267,34 @@ function clientOf(target, io) {
265
267
  // Only the cause's code: a fetch error's message can quote a header, the token's among them.
266
268
  unreachable: (error) => new Exit(3, target.unreachable ?? `Cannot reach the server at ${target.base} (${error?.cause?.code ?? error?.name}); ${START}.`),
267
269
  refused(response, bytes) {
270
+ // A 501 is no refusal: the server does not offer the operation here. Its error's JSON says so, with the capability
271
+ // that is off when it names one; exit 5.
272
+ if (response.status === 501) return io.stderr.write(`${JSON.stringify(unsupported(bytes))}\n`), refusalExit(501);
268
273
  io.stderr.write(bytes.length ? bytes : `${response.status} ${response.statusText}`);
269
274
  if (!bytes.length || bytes.at(-1) !== 10) io.stderr.write("\n");
270
- return response.status === 401 || response.status === 403 ? 4 : 1;
275
+ return refusalExit(response.status);
271
276
  },
272
277
  print: (value) => io.stdout.write(`${io.stdout.isTTY ? JSON.stringify(value, null, 2) : JSON.stringify(value)}\n`),
273
278
  };
274
279
  }
275
280
 
281
+ /** A 501's error as this CLI prints it: the server's error object (when its body is one) with its status, its code
282
+ * unsupported_here unless it names another, and its message, which says why; a body with no message gets one of this
283
+ * CLI's own, naming the capability that is off when the error names one. */
284
+ function unsupported(bytes) {
285
+ let error = {};
286
+ try {
287
+ const parsed = JSON.parse(bytes.toString("utf8"))?.error;
288
+ if (parsed && typeof parsed === "object" && !Array.isArray(parsed)) error = parsed;
289
+ } catch {
290
+ // not JSON: no error object to keep
291
+ }
292
+ const capability = typeof error.capability === "string" && /^[\w.-]+$/.test(error.capability) ? error.capability : undefined;
293
+ const code = typeof error.code === "string" ? error.code : "unsupported_here";
294
+ const message = typeof error.message === "string" && error.message.trim() ? error.message : `The server does not offer this here${capability ? `: ${capability} is off` : ""}.`;
295
+ return { error: { ...error, code, status: 501, message } };
296
+ }
297
+
276
298
  /** One request: `{ response, bytes }`, `{ code }` once it was refused (its error on stderr), or `{ late: true }` once
277
299
  * `signal`, when given, ended it first. */
278
300
  async function request(client, { method, path, headers, body, type, signal }) {
@@ -303,6 +325,38 @@ async function send(client, req) {
303
325
  return 0;
304
326
  }
305
327
 
328
+ /** `--all`: every page of a list, each array of each page in one list, the first page's other fields kept, next_cursor null.
329
+ * A cursor the server answers twice, or a next page past MAX_PAGES, ends it, exit 1, and prints nothing: a server that
330
+ * keeps answering a cursor never keeps it reading. A page refused is that refusal's exit code. */
331
+ async function listAll(client, req, entry) {
332
+ const at = new URL(req.path, "http://host");
333
+ const name = `agentrun ${entry.command.join(" ")} --all`;
334
+ const lists = new Map();
335
+ // The cursors read so far, a --cursor it started from among them.
336
+ const cursors = new Set(at.searchParams.has("cursor") ? [at.searchParams.get("cursor")] : []);
337
+ let first;
338
+ for (let page = 1; ; page++) {
339
+ if (page > MAX_PAGES) return client.io.stderr.write(`${name}: the server still had a next page after ${MAX_PAGES}; stopped there and printed nothing. Narrow the list with its filters, or page it with --cursor.\n`), 1;
340
+ const got = await request(client, { ...req, path: `${at.pathname}${at.search}` });
341
+ if (got.code !== undefined) return got.code;
342
+ const value = JSON_TYPE.test(got.response.headers.get("content-type") ?? "") ? jsonOf(got.bytes)?.value : undefined;
343
+ if (value === null || typeof value !== "object" || Array.isArray(value)) return client.io.stderr.write(`${name}: page ${page} is not a JSON object; printed nothing.\n`), 1;
344
+ first ??= value;
345
+ for (const [key, items] of Object.entries(value)) {
346
+ if (!Array.isArray(items)) continue;
347
+ if (!lists.has(key)) lists.set(key, []);
348
+ for (const item of items) lists.get(key).push(item);
349
+ }
350
+ const next = value.next_cursor;
351
+ if (next === null || next === undefined) break;
352
+ if (typeof next !== "string" || next === "" || cursors.has(next)) return client.io.stderr.write(`${name}: the server answered the same next_cursor twice, or one that is not a cursor; stopped and printed nothing.\n`), 1;
353
+ cursors.add(next);
354
+ at.searchParams.set("cursor", next);
355
+ }
356
+ client.print({ ...first, ...Object.fromEntries(lists), next_cursor: null });
357
+ return 0;
358
+ }
359
+
306
360
  /** `--timeout SECONDS` in milliseconds. */
307
361
  function timeoutOf(value) {
308
362
  if (value === undefined) return undefined;
@@ -377,6 +431,7 @@ async function command(entry, argv, env, io) {
377
431
  for (const f of [...entry.query, ...entry.headers, ...entry.bodyFlags]) options[flag(f.name)] = { type: f.type === "boolean" ? "boolean" : "string" };
378
432
  if (entry.hasBody) Object.assign(options, { body: { type: "string" }, "body-type": { type: "string" } });
379
433
  Object.assign(options, FLAGS[entry.operationId]?.options);
434
+ if (ALL.listing(entry)) options.all = { type: "boolean" };
380
435
  const { values, positionals } = parse(argv, options);
381
436
  if (values.help) return io.stdout.write(`${commandHelp(entry)}\n`), 0;
382
437
  const args = positionals.slice(entry.command.length);
@@ -428,6 +483,7 @@ async function command(entry, argv, env, io) {
428
483
  const client = entry.secretBody || landed ? guarded(clientOf, target, io, body, (entry.secretBody ? entry : landed).publicFields) : clientOf(target, io);
429
484
  const req = { method: entry.method, path: `${path}${search}`, headers, body, type, raw: entry.raw };
430
485
  if (values.follow) return followTimeline(client, req.path, headers);
486
+ if (values.all) return listAll(client, req, entry);
431
487
  if (!values.wait) return send(client, req);
432
488
  // The start is bounded as the wait is: by --timeout, which the wait then has what is left of, else as one of the
433
489
  // wait's requests is.
@@ -1,5 +1,5 @@
1
1
  // Generated by scripts/generate-clients.mjs from the server's OpenAPI document. Do not edit: run node scripts/generate-clients.mjs.
2
- // SHA-256 of what the table is made of (operationsOf in scripts/generate-clients.mjs): e6a39ba1ef14ca4138503e3dd9e66e9bebd6d9beb91fad5fbfec0a38296841d8
2
+ // SHA-256 of what the table is made of (operationsOf in scripts/generate-clients.mjs): 4ec85cda12e38aff6e89445ee59072bbeaf7374aed0b3a63910194668c50f3a0
3
3
  export const COMMANDS = [
4
4
  {
5
5
  "command": [
@@ -726,35 +726,6 @@ export const COMMANDS = [
726
726
  "raw": true,
727
727
  "summary": "Edit a note (If-Match) or create one (If-None-Match: *)"
728
728
  },
729
- {
730
- "command": [
731
- "local",
732
- "connect-git-hub"
733
- ],
734
- "operationId": "connectGitHub",
735
- "method": "POST",
736
- "path": "/integrations/github/connect",
737
- "pathParams": [],
738
- "multiSegment": [],
739
- "query": [],
740
- "headers": [],
741
- "bodyFlags": [
742
- {
743
- "name": "org",
744
- "type": "string",
745
- "required": false,
746
- "description": "The GitHub organization to make the App under; absent, the signed-in GitHub user."
747
- }
748
- ],
749
- "hasBody": true,
750
- "bodyRequired": false,
751
- "bodyTypes": [
752
- "application/json"
753
- ],
754
- "secretBody": false,
755
- "raw": false,
756
- "summary": "Start Connect GitHub: the app-manifest form the console posts to GitHub"
757
- },
758
729
  {
759
730
  "command": [
760
731
  "local",
@@ -835,78 +806,6 @@ export const COMMANDS = [
835
806
  "raw": false,
836
807
  "summary": "Whether run folders are on an Archil disk (Mode 2), its settings, and whether its keys are saved"
837
808
  },
838
- {
839
- "command": [
840
- "local",
841
- "git-hub-callback"
842
- ],
843
- "operationId": "gitHubCallback",
844
- "method": "GET",
845
- "path": "/integrations/github/callback",
846
- "pathParams": [],
847
- "multiSegment": [],
848
- "query": [
849
- {
850
- "name": "code",
851
- "type": "string",
852
- "required": false,
853
- "description": ""
854
- },
855
- {
856
- "name": "state",
857
- "type": "string",
858
- "required": false,
859
- "description": ""
860
- }
861
- ],
862
- "headers": [],
863
- "bodyFlags": [],
864
- "hasBody": false,
865
- "bodyRequired": false,
866
- "bodyTypes": [],
867
- "secretBody": false,
868
- "raw": false,
869
- "summary": "Where GitHub sends the owner's browser back with the new App's code"
870
- },
871
- {
872
- "command": [
873
- "local",
874
- "git-hub-installed"
875
- ],
876
- "operationId": "gitHubInstalled",
877
- "method": "GET",
878
- "path": "/integrations/github/installed",
879
- "pathParams": [],
880
- "multiSegment": [],
881
- "query": [
882
- {
883
- "name": "installation_id",
884
- "type": "string",
885
- "required": false,
886
- "description": ""
887
- },
888
- {
889
- "name": "setup_action",
890
- "type": "string",
891
- "required": false,
892
- "description": ""
893
- },
894
- {
895
- "name": "state",
896
- "type": "string",
897
- "required": false,
898
- "description": ""
899
- }
900
- ],
901
- "headers": [],
902
- "bodyFlags": [],
903
- "hasBody": false,
904
- "bodyRequired": false,
905
- "bodyTypes": [],
906
- "secretBody": false,
907
- "raw": false,
908
- "summary": "Where GitHub sends the browser once the App is installed"
909
- },
910
809
  {
911
810
  "command": [
912
811
  "local",
@@ -927,28 +826,6 @@ export const COMMANDS = [
927
826
  "raw": false,
928
827
  "summary": "Settings → Computers: the kinds of computer this server offers, each provider and whether its keys are saved"
929
828
  },
930
- {
931
- "command": [
932
- "local",
933
- "receive-hook-github"
934
- ],
935
- "operationId": "receiveHook_github",
936
- "method": "POST",
937
- "path": "/hooks/github",
938
- "pathParams": [],
939
- "multiSegment": [],
940
- "query": [],
941
- "headers": [],
942
- "bodyFlags": [],
943
- "hasBody": true,
944
- "bodyRequired": true,
945
- "bodyTypes": [
946
- "*/*"
947
- ],
948
- "secretBody": false,
949
- "raw": false,
950
- "summary": "Fire a GitHub trigger: a request it checks, no token"
951
- },
952
829
  {
953
830
  "command": [
954
831
  "local",
package/lib/follow.mjs CHANGED
@@ -33,6 +33,14 @@ export const FLAGS = {
33
33
  },
34
34
  };
35
35
 
36
+ /** The most pages `--all` reads: past it, a server that keeps answering a next_cursor ends the command, exit 1. */
37
+ export const MAX_PAGES = 1000;
38
+ /** `--all`, on every list command (a GET whose query takes a cursor, its answer a page with next_cursor), and its help. */
39
+ export const ALL = {
40
+ listing: (entry) => entry.method === "GET" && entry.query.some((q) => q.name === "cursor"),
41
+ help: ["--all", `every page: follows next_cursor and prints one list, its next_cursor null; stops past ${MAX_PAGES} pages, exit 1`],
42
+ };
43
+
36
44
  /** The one command with no route of its own. */
37
45
  export const WAIT = {
38
46
  command: ["runs", "wait"],
@@ -109,7 +117,7 @@ function settle(client, run, id) {
109
117
  const go = `then \`agentrun runs wait ${id}\``;
110
118
  const why = run.status === "paused" ? `is paused: resume it with \`agentrun runs resume ${id}\``
111
119
  : run.pending?.kind === "question" ? `asked a question: answer it with \`agentrun runs message ${id} --content TEXT\``
112
- : run.pending?.kind === "budget" ? `stopped at its spend cap: raise it with \`agentrun runs raise-cap ${id} --max-cost-usd ${Number.isFinite(run.pending.suggested_cap_usd) ? run.pending.suggested_cap_usd : "N"}\``
120
+ : run.pending?.kind === "budget" ? `is paused at its spend cap: raise it with \`agentrun runs raise-cap ${id} --max-cost-usd ${Number.isFinite(run.pending.suggested_cap_usd) ? run.pending.suggested_cap_usd : "N"}\``
113
121
  : run.pending?.kind ? `waits on a person (${run.pending.kind})`
114
122
  : `was stopped by a person: send it a message with \`agentrun runs message ${id} --content TEXT\``;
115
123
  client.io.stderr.write(`Run ${id} ${why}, ${go}.\n`);
package/lib/login.mjs CHANGED
@@ -74,6 +74,10 @@ function secretsOf(body, publicFields = []) {
74
74
  return found;
75
75
  }
76
76
 
77
+ /** A refusal's exit code: 4 for the token refused (401, 403), 5 for an operation the server does not offer here (501),
78
+ * 1 for any other. */
79
+ export const refusalExit = (status) => (status === 401 || status === 403 ? 4 : status === 501 ? 5 : 1);
80
+
77
81
  /** A client for a request that carries a secret: a refusal prints the status, the error's code when it is one, and a
78
82
  * message of this CLI's own, never the server's answer, which could quote the secret. What it does print has every
79
83
  * copy of `secrets` cut: `scrub`, which cli.mjs's send applies to a JSON answer's value before it prints it, and to a
@@ -92,8 +96,9 @@ function secretClient(clientOf, target, io, secrets) {
92
96
  code = undefined;
93
97
  }
94
98
  const named = typeof code === "string" && /^[a-z_]+$/.test(code) ? ` ${code}` : "";
95
- client.io.stderr.write(`The server refused it: ${response.status}${named}. Its answer is not shown, since it could quote the secret sent.\n`);
96
- return response.status === 401 || response.status === 403 ? 4 : 1;
99
+ const what = response.status === 501 ? "The server does not offer it here" : "The server refused it";
100
+ client.io.stderr.write(`${what}: ${response.status}${named}. Its answer is not shown, since it could quote the secret sent.\n`);
101
+ return refusalExit(response.status);
97
102
  },
98
103
  };
99
104
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@parcha/agentrun",
3
- "version": "0.4.1",
3
+ "version": "0.4.2",
4
4
  "description": "AgentRun, the open-source platform that supercharges your agents (self-improvement, durable execution and a control plane on top of your favorite agent harness), on this machine with one command: npx @parcha/agentrun",
5
5
  "type": "module",
6
6
  "license": "Apache-2.0",
@@ -16,7 +16,7 @@
16
16
  "NOTICE"
17
17
  ],
18
18
  "dependencies": {
19
- "@parcha/agentrun-serve": "0.1.0-beta.33"
19
+ "@parcha/agentrun-serve": "0.1.0-beta.34"
20
20
  },
21
21
  "scripts": {
22
22
  "test": "node --test 'test/*.test.mjs'"
@@ -3,12 +3,14 @@ name: agentrun-cli
3
3
  description: Drive an AgentRun server from a shell with the agentrun CLI. Make an agent from a definition file, start a run with a spend cap and wait for it, answer a run that asks a question, read the files it wrote and what it cost, save tool keys, and call any other route of the server. Use when asked to run or manage AgentRun agents from the terminal or a script, or for anything the server's MCP tools do not cover (files, tool keys, triggers, webhooks, revisions, learning).
4
4
  ---
5
5
  <!-- Generated by scripts/generate-clients.mjs from the server's OpenAPI document and its skill template. Do not edit: run node scripts/generate-clients.mjs. -->
6
- <!-- SHA-256 of what the command table is made of (operationsOf in scripts/generate-clients.mjs): e6a39ba1ef14ca4138503e3dd9e66e9bebd6d9beb91fad5fbfec0a38296841d8 -->
6
+ <!-- SHA-256 of what the command table is made of (operationsOf in scripts/generate-clients.mjs): 4ec85cda12e38aff6e89445ee59072bbeaf7374aed0b3a63910194668c50f3a0 -->
7
7
 
8
8
  # AgentRun CLI
9
9
 
10
10
  `agentrun` drives an AgentRun server (the open platform's server for agents) through its API. It is the command `npm install -g @parcha/agentrun` puts on the PATH; without it, write `npx @parcha/agentrun` in its place. Each command prints the server's JSON answer on stdout, one line when piped, and an error's JSON on stderr. `agentrun help` lists the commands, `agentrun GROUP COMMAND --help` gives one's flags, and [references/commands.md](references/commands.md) has every command with its flags and route.
11
11
 
12
+ A list command (`agentrun agents list`, `agentrun runs list` and the others with `--cursor`) prints one page, with the `next_cursor` to pass as `--cursor` for the next; `--all` reads every page and prints them as one list, its `next_cursor` null.
13
+
12
14
  ## The server and the token
13
15
 
14
16
  The first of these that is set wins:
@@ -80,13 +82,13 @@ agentrun runs get "$run" > out.json && node -p 'JSON.stringify(require("./out.js
80
82
 
81
83
  ### 5. Raise a cap or approve a call
82
84
 
83
- A run stopped at its spend cap, or waiting for a tool call to be approved, exits 8 with `pending.kind` `budget` or `approval` in out.json.
85
+ A run paused at its spend cap, or waiting for a tool call to be approved, exits 8 with `pending.kind` `budget` or `approval` in out.json.
84
86
 
85
87
  A cap too small for the task stops the run before a request it cannot pay for. With `--cap-mode strict` no request is sent that the cap cannot cover; under the default, `expected`, a request that misses the cache can go over by at most the run's `cost.overshoot_bound_usd`:
86
88
 
87
89
  ```sh
88
90
  agentrun runs start notes --max-cost-usd 0.05 --cap-mode strict --body '{"input": {"content": "Write moon.md with everything known about the Moon."}}' --wait > out.json
89
- # exit 8 once it stops at its cap: out.json has pending.kind budget, with cap_usd, spent_usd and suggested_cap_usd; 0 if the cap was enough
91
+ # exit 8 once it pauses at its cap: out.json has pending.kind budget, with cap_usd, spent_usd and suggested_cap_usd; 0 if the cap was enough
90
92
  ```
91
93
 
92
94
  Only the person who set the cap raises it: ask them for the new cap (`pending.suggested_cap_usd` is one that lets it go on). Then the run goes on from where it stopped:
@@ -107,6 +109,7 @@ A tool call waiting for approval (`pending.kind` `approval`) is answered by the
107
109
  - 2: bad usage, nothing sent: a bad flag or argument, or a base URL that is not http or https or has a query, a fragment, a user or a password.
108
110
  - 3: the server cannot be reached.
109
111
  - 4: no token, the token was refused, or the config file, the local server's record or its token file was refused (open to others, or not what it should hold).
112
+ - 5: the server does not offer the command here: a 501, `unsupported_here`, its error saying why (a capability this server has off, say).
110
113
  - 8: the run waits on a person: a question, its spend cap, a stopped turn, or a paused workflow. stderr says what to run next.
111
114
 
112
115
  ## From a program
@@ -119,7 +122,7 @@ Two clients call the same API from code, with the same server and token. `@parch
119
122
  - `agentrun files`: create, delete, get, list, upload
120
123
  - `agentrun home`: delete, list, read, write
121
124
  - `agentrun learning`: get, log, notes, read, retire, write
122
- - `agentrun local`: connect-git-hub, delete-workspace-archil, disconnect-git-hub, get-git-hub-connection, get-workspace-archil, git-hub-callback, git-hub-installed, list-computers, receive-hook-github, test-computer, test-workspace-archil
125
+ - `agentrun local`: delete-workspace-archil, disconnect-git-hub, get-git-hub-connection, get-workspace-archil, list-computers, test-computer, test-workspace-archil
123
126
  - `agentrun login`: Check a server's token, read from stdin, and keep it with the server's address in the config file
124
127
  - `agentrun logout`: Remove the config file login wrote, its address and token
125
128
  - `agentrun mcp-servers`: delete, get, list, oauth-client, private-hosts, refresh
@@ -1,7 +1,7 @@
1
1
  # agentrun commands
2
2
 
3
3
  <!-- Generated by scripts/generate-clients.mjs from the server's OpenAPI document. Do not edit: run node scripts/generate-clients.mjs. -->
4
- <!-- SHA-256 of what the command table is made of (operationsOf in scripts/generate-clients.mjs): e6a39ba1ef14ca4138503e3dd9e66e9bebd6d9beb91fad5fbfec0a38296841d8 -->
4
+ <!-- SHA-256 of what the command table is made of (operationsOf in scripts/generate-clients.mjs): 4ec85cda12e38aff6e89445ee59072bbeaf7374aed0b3a63910194668c50f3a0 -->
5
5
 
6
6
  Every command of the agentrun CLI, by group. Arguments in capitals are positional; every command also takes `--base-url URL`, `--data DIR` and `--help`. A body field with one value (a string, number or boolean) is a flag of its own, and `--body` gives the whole body. A positional argument is refused when it is or holds a `.` or `..` path segment; a file's PATH keeps its slashes, and no segment of it may be empty.
7
7
 
@@ -45,6 +45,7 @@ Route: `GET /agents`.
45
45
  - `--limit INTEGER` (integer)
46
46
  - `--cursor STRING` (string): `next_cursor` from the previous page.
47
47
  - `--archived` (boolean): true lists only archived agents; false, the default, the others.
48
+ - `--all` (boolean, this CLI's own): every page: follows next_cursor and prints one list, its next_cursor null; stops past 1000 pages, exit 1
48
49
 
49
50
  ### `agentrun agents runs AGENT_ID`
50
51
 
@@ -55,6 +56,7 @@ Route: `GET /agents/{agent_id}/runs`.
55
56
  - `--limit INTEGER` (integer)
56
57
  - `--cursor STRING` (string): `next_cursor` from the previous page.
57
58
  - `--status queued|working|paused|input_required|completed|failed|cancelled` (string, one of these): Only runs with this status.
59
+ - `--all` (boolean, this CLI's own): every page: follows next_cursor and prints one list, its next_cursor null; stops past 1000 pages, exit 1
58
60
 
59
61
  ### `agentrun agents unarchive AGENT_ID`
60
62
 
@@ -108,6 +110,7 @@ Route: `GET /files`.
108
110
 
109
111
  - `--limit INTEGER` (integer)
110
112
  - `--cursor STRING` (string): `next_cursor` from the previous page.
113
+ - `--all` (boolean, this CLI's own): every page: follows next_cursor and prints one list, its next_cursor null; stops past 1000 pages, exit 1
111
114
 
112
115
  ### `agentrun files upload FILE_ID`
113
116
 
@@ -165,6 +168,7 @@ Route: `GET /agents/{agent_id}/learning/log`.
165
168
 
166
169
  - `--cursor STRING` (string): `next_cursor` from the previous page: opaque.
167
170
  - `--limit INTEGER` (integer): At most 200.
171
+ - `--all` (boolean, this CLI's own): every page: follows next_cursor and prints one list, its next_cursor null; stops past 1000 pages, exit 1
168
172
 
169
173
  ### `agentrun learning notes AGENT_ID`
170
174
 
@@ -175,6 +179,7 @@ Route: `GET /agents/{agent_id}/learning/notes`.
175
179
  - `--cursor STRING` (string): `next_cursor` from the previous page: opaque, read at the commit the first page was.
176
180
  - `--limit INTEGER` (integer): At most 200.
177
181
  - `--status active|superseded|retired|pending` (string, one of these): Only notes with this status.
182
+ - `--all` (boolean, this CLI's own): every page: follows next_cursor and prints one list, its next_cursor null; stops past 1000 pages, exit 1
178
183
 
179
184
  ### `agentrun learning read AGENT_ID FILE`
180
185
 
@@ -204,16 +209,6 @@ Route: `PUT /agents/{agent_id}/learning/files/{file}`. It prints the answer's by
204
209
 
205
210
  ## local
206
211
 
207
- ### `agentrun local connect-git-hub`
208
-
209
- Start Connect GitHub: the app-manifest form the console posts to GitHub.
210
-
211
- Route: `POST /integrations/github/connect`.
212
-
213
- - `--org STRING` (string): The GitHub organization to make the App under; absent, the signed-in GitHub user.
214
- - `--body JSON|@FILE|-` (application/json): The whole body: inline, from a file or from stdin. The flags above win over a JSON body's fields.
215
- - `--body-type TYPE` (string): The body's type, one of application/json; any other than JSON is sent as given.
216
-
217
212
  ### `agentrun local delete-workspace-archil`
218
213
 
219
214
  Turn Mode 2 off: run folders on this server's own disk.
@@ -238,40 +233,12 @@ Whether run folders are on an Archil disk (Mode 2), its settings, and whether it
238
233
 
239
234
  Route: `GET /workspace/archil`.
240
235
 
241
- ### `agentrun local git-hub-callback`
242
-
243
- Where GitHub sends the owner's browser back with the new App's code.
244
-
245
- Route: `GET /integrations/github/callback`.
246
-
247
- - `--code STRING` (string)
248
- - `--state STRING` (string)
249
-
250
- ### `agentrun local git-hub-installed`
251
-
252
- Where GitHub sends the browser once the App is installed.
253
-
254
- Route: `GET /integrations/github/installed`.
255
-
256
- - `--installation-id STRING` (string)
257
- - `--setup-action STRING` (string)
258
- - `--state STRING` (string)
259
-
260
236
  ### `agentrun local list-computers`
261
237
 
262
238
  Settings → Computers: the kinds of computer this server offers, each provider and whether its keys are saved.
263
239
 
264
240
  Route: `GET /computers`.
265
241
 
266
- ### `agentrun local receive-hook-github`
267
-
268
- Fire a GitHub trigger: a request it checks, no token.
269
-
270
- Route: `POST /hooks/github`.
271
-
272
- - `--body JSON|@FILE|-` (*/*, required): The whole body: inline, from a file or from stdin. The flags above win over a JSON body's fields.
273
- - `--body-type TYPE` (string): The body's type, one of */*; any other than JSON is sent as given.
274
-
275
242
  ### `agentrun local test-computer PROVIDER`
276
243
 
277
244
  Test a computer provider's account with its saved keys.
@@ -350,6 +317,7 @@ Route: `GET /agents/{agent_id}/revisions`.
350
317
 
351
318
  - `--limit INTEGER` (integer)
352
319
  - `--cursor STRING` (string): `next_cursor` from the previous page.
320
+ - `--all` (boolean, this CLI's own): every page: follows next_cursor and prints one list, its next_cursor null; stops past 1000 pages, exit 1
353
321
 
354
322
  ### `agentrun revisions set-current AGENT_ID`
355
323
 
@@ -442,6 +410,7 @@ Route: `GET /runs`.
442
410
  - `--revision STRING` (string): Only runs of this revision.
443
411
  - `--status queued|working|paused|input_required|completed|failed|cancelled` (string, one of these): Only runs with this status.
444
412
  - `--archived` (boolean): true lists only archived runs; false, the default, the others.
413
+ - `--all` (boolean, this CLI's own): every page: follows next_cursor and prints one list, its next_cursor null; stops past 1000 pages, exit 1
445
414
 
446
415
  ### `agentrun runs message RUN_ID`
447
416