@standardagents/cli 0.45.5 → 0.45.7

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
@@ -1,6 +1,29 @@
1
+ <p align="center">
2
+ <a href="https://standardagents.ai">
3
+ <picture>
4
+ <source media="(prefers-color-scheme: dark)" srcset="https://standardagents.ai/images/standard-agents-logo.svg">
5
+ <img src="https://standardagents.ai/images/standard-agents-logo-dark.svg" alt="Standard Agents" width="300">
6
+ </picture>
7
+ </a>
8
+ </p>
9
+
10
+ <p align="center">Standard Agents Builder is a TypeScript framework for building, testing, and running production AI agents.</p>
11
+
12
+ ```bash
13
+ npx @standardagents/cli@latest init
14
+ ```
15
+
16
+ <picture>
17
+ <source media="(prefers-color-scheme: dark)" srcset="https://standardagents.ai/images/take3/demo-run-start-dark.webp">
18
+ <img src="https://standardagents.ai/images/take3/demo-run-start-light.webp" alt="The Standard Agents Builder home screen, with threads, spend, and failures for each agent in a project">
19
+ </picture>
20
+
21
+ See the docs at [standardagents.ai](https://standardagents.ai). The full command reference follows.
22
+
1
23
  # @standardagents/cli
2
24
 
3
- CLI tool for Standard Agents setup and model discovery.
25
+ Command-line tool for Standard Agents Builder: project setup, sign-in,
26
+ deployment, and diagnostics. The command is `agents`.
4
27
 
5
28
  ## Installation
6
29
 
@@ -14,6 +37,30 @@ The CLI supports Node.js 22 (22.12 or newer) and Node.js 24. It checks the
14
37
  version at startup: an older Node.js stops with the version to install, and a
15
38
  newer untested release line prints a warning and continues.
16
39
 
40
+ ## Command Names
41
+
42
+ `agents` is the canonical command. This README, the CLI's help, and its
43
+ messages use that name, and it is the name to type after an install:
44
+
45
+ ```bash
46
+ npm install -g @standardagents/cli
47
+ agents --help
48
+ ```
49
+
50
+ Inside a project that depends on the package, run it through the package
51
+ manager, for example `pnpm exec agents <command>`.
52
+
53
+ The package installs two more names for the same program. Both behave exactly
54
+ like `agents`, and both identify themselves as `agents` in help and errors.
55
+
56
+ | Name | Policy |
57
+ |------|--------|
58
+ | `agents` | Canonical. Use it everywhere. |
59
+ | `cli` | Kept only so `npx @standardagents/cli` and `pnpm dlx @standardagents/cli` can find the program: both look for a binary named after the package. Deprecated as a command to type. A global install also puts this generic name on your `PATH`, where another tool's `cli` may take precedence; type `agents`. |
60
+ | `agentup` | Compatibility alias from earlier releases. It is kept so existing scripts keep working and is not used in documentation. Use `agents` in new scripts. |
61
+
62
+ A name is not removed without notice in the release notes.
63
+
17
64
  ## Usage
18
65
 
19
66
  ### Create And Connect A Project
@@ -30,7 +77,7 @@ one. The account supplies inference for your agents.
30
77
 
31
78
  This command will:
32
79
  - Print the sign-in URL, then open Standard Agents in your browser for login, billing, and platform repository setup
33
- - Show elapsed time and the session's remaining time while it waits. Press Ctrl-C to cancel; the pending sign-in session is cancelled on the platform
80
+ - Show the session's remaining time on one line while it waits. Press Ctrl-C to cancel; the pending sign-in session is cancelled on the platform
34
81
  - Clone the created platform-owned Artifact repository into the directory where you ran the command
35
82
  - Write `STANDARD_AGENTS_API_KEY`, `PLATFORM_ENDPOINT`, and `STANDARD_AGENTS_API_URL` to `.dev.vars`. It writes no admin password: your local instance signs in with your Standard Agents account
36
83
  - Configure a repo-local Git credential helper that mints short-lived Artifacts tokens through the Standard Agents platform
@@ -69,7 +116,7 @@ are running a packed or globally installed local CLI, also set
69
116
 
70
117
  ```bash
71
118
  STANDARDAGENTS_WORKSPACE=1 STANDARD_AGENTS_API_URL=https://platform.agentbuilder-platform.orb.local pnpm exec agents init
72
- STANDARDAGENTS_WORKSPACE=1 STANDARDAGENTS_WORKSPACE_ROOT=/path/to/agentbuilder STANDARD_AGENTS_API_URL=https://platform.agentbuilder-platform.orb.local cli init
119
+ STANDARDAGENTS_WORKSPACE=1 STANDARDAGENTS_WORKSPACE_ROOT=/path/to/agentbuilder STANDARD_AGENTS_API_URL=https://platform.agentbuilder-platform.orb.local agents init
73
120
  ```
74
121
 
75
122
  From the monorepo root, `pnpm onboarding:verify:local` runs both no-publish
@@ -97,7 +144,7 @@ Do not run manual npm publishes to test this flow.
97
144
  - `--package-manager <manager>` - Override package manager detection (`npm`, `pnpm`, `yarn`, or `bun`)
98
145
  - `--api-url <url>` - Platform API URL. See [Platform API URL](#platform-api-url) for the environment variables
99
146
 
100
- Set `STANDARD_AGENTS_BROWSER="Google Chrome"` or another macOS browser app name when you need the browser handoff to use a specific browser during local development. Set `STANDARD_AGENTS_BROWSER=none` for headless verification.
147
+ Set `STANDARD_AGENTS_BROWSER` to open the sign-in in a specific browser: an application name on macOS and Windows (`"Google Chrome"`), or a command on Linux (`firefox`). `init` and `login` read it. Set `STANDARD_AGENTS_BROWSER=none` for headless verification. When the browser cannot be opened, the command prints a warning in place of `Opening your browser`; open the printed sign-in URL yourself.
101
148
 
102
149
  ### Scaffold Project Structure
103
150
 
@@ -144,14 +191,56 @@ stage failed. `replaced` lists the guides that `--force` replaced.
144
191
  `agents support-files` accepts `--json` with the same shape and the stages
145
192
  `support-files` and `registry-pin`.
146
193
 
194
+ ### Scaffold A Chat Front End
195
+
196
+ ```bash
197
+ npx @standardagents/cli@latest init-chat my-chat
198
+ ```
199
+
200
+ Creates a standalone React chat application (Vite or Next.js) for a running
201
+ Standard Agents instance. In a terminal the command asks for the framework,
202
+ the instance URL, and the package manager, installs dependencies, starts the
203
+ dev server, and opens the browser.
204
+
205
+ Without a terminal the command never prompts, so a script or coding agent can
206
+ run it. Pass the project name, and either `--yes` or a flag for each value:
207
+
208
+ ```bash
209
+ npx @standardagents/cli@latest init-chat my-chat --yes
210
+ npx @standardagents/cli@latest init-chat my-chat \
211
+ --framework nextjs --instance-url http://localhost:5173 --package-manager pnpm
212
+ ```
213
+
214
+ A missing value exits 1 before anything is created, and the message names the
215
+ missing flag. Without a terminal the command installs dependencies, prints the
216
+ command that starts the dev server, and exits. It does not start the server
217
+ unless you pass `--dev`.
218
+
219
+ #### Options
220
+
221
+ - `-y, --yes` - Skip prompts and use the defaults: Vite, `http://localhost:5173`, and the detected package manager
222
+ - `--framework <framework>` - `vite` or `nextjs`. Any other value exits 1 and lists these two
223
+ - `--instance-url <url>` - URL of the Standard Agents instance the chat connects to
224
+ - `--package-manager <manager>` - `npm`, `pnpm`, `yarn`, or `bun`
225
+ - `--no-install` - Write the project without installing dependencies or starting the dev server
226
+ - `--dev` - Start the dev server in the foreground. This is the default in a terminal
227
+ - `--no-dev` - Do not start the dev server. This is the default without a terminal
228
+ - `--no-open` - Do not open the browser when the dev server starts
229
+
230
+ When the dev server exits with an error, the command exits with the same code.
231
+ Ctrl-C or SIGTERM stops the dev server and the processes it started.
232
+
147
233
  ### Credential Files
148
234
 
149
- The CLI writes credentials into two project files: `.dev.vars` and
150
- `.agents/bootstrap-session.json`. Before each write, it adds `.dev.vars` and
151
- `.agents` to your `.gitignore` when Git does not ignore them. When Git tracks
152
- one of these files, the command stops and prints the `git rm --cached` command
153
- that stops the tracking. `agents logout` still removes credentials from a
154
- tracked `.dev.vars`.
235
+ The CLI writes one credential into a project: the project API key, in
236
+ `.dev.vars`. Before each write, it adds `.dev.vars` and `.agents` to your
237
+ `.gitignore` when Git does not ignore them. When Git tracks `.dev.vars`, the
238
+ CLI writes no credential into it and prints the `git rm --cached` command that
239
+ stops the tracking. `agents logout` still removes credentials from a tracked
240
+ `.dev.vars`.
241
+
242
+ Your account sign-in is saved once for the machine, in the CLI configuration
243
+ directory. No project file holds an account session.
155
244
 
156
245
  ### Deploy From Git
157
246
 
@@ -174,9 +263,8 @@ local build or upload bundles.
174
263
  - When the platform answers the push with a `remote: Standard Agents:` notice,
175
264
  it stored the push and started no build. The command exits 4 when the notice
176
265
  asks for the terms, else 1.
177
- - Following a build uses your sign-in from `agents login` or
178
- `agents git-login`, or the project API key that `init` saved in
179
- `.dev.vars`. With neither, `deploy` says `Only the push was verified`,
266
+ - Following a build uses your sign-in from `agents login`, or the project API
267
+ key in `.dev.vars`. With neither, `deploy` says `Only the push was verified`,
180
268
  prints how to check the result, and exits 0.
181
269
  - A failed build prints the platform's error, the last 20 log lines, and the
182
270
  `builds logs` and `builds retry` commands.
@@ -245,8 +333,8 @@ Exit codes are the same for `deploy`, `builds`, `rollback`, and `redeploy`:
245
333
  | 0 | Done. For a wait: the commit was deployed (the build is `live`, or was live and is `superseded`). A plain `builds status` or `builds logs` read also exits 0 |
246
334
  | 1 | The build failed or was cancelled, no build started, or the platform refused the request |
247
335
  | 2 | The command line, the checkout, or the named build is not usable |
248
- | 3 | Not signed in, or the sign-in expired. Run `agents login` |
249
- | 4 | The platform refused a build until the terms are accepted (`error_code` `legal_acceptance_required`). A refused build that a retry later started is listed as `retried` and needs no action. The platform's message is printed, then `Run: npx @standardagents/cli terms accept` and the `builds retry` command that starts the waiting deploy |
336
+ | 3 | Not signed in, or the sign-in expired. Run `npx @standardagents/cli@latest login` |
337
+ | 4 | The platform refused a build until the terms are accepted (`error_code` `legal_acceptance_required`). A refused build that a retry later started is listed as `retried` and needs no action. The platform's message is printed, then `Run: npx @standardagents/cli@latest terms accept` and the `builds retry` command that starts the waiting deploy |
250
338
  | 5 | The time limit passed while the build was still in progress |
251
339
 
252
340
  With `--json`, a failure before any result prints
@@ -276,9 +364,9 @@ example, "Push again to deploy"), states that your acceptance is recorded, and
276
364
  exits with code 1. To start a waiting deploy later, run `agents builds retry`
277
365
  in its project.
278
366
 
279
- Both commands use your saved sign-in. Run `agents login` in your project, or
280
- `agents git-login` once per machine, before you use them. An API key cannot
281
- accept terms, because acceptance belongs to a person.
367
+ Both commands use your sign-in for this machine, so they work in any
368
+ directory. Run `npx @standardagents/cli@latest login` once before you use
369
+ them. An API key cannot accept terms, because acceptance belongs to a person.
282
370
 
283
371
  Without a terminal, `terms accept` records nothing and exits with code 2. It
284
372
  prints the two links, the acknowledgement sentence, and the command that
@@ -349,46 +437,115 @@ npx @standardagents/cli skill --agent claude
349
437
 
350
438
  ```bash
351
439
  npx @standardagents/cli@latest login
352
- npx @standardagents/cli@latest login --bootstrap <code>
353
- npx @standardagents/cli@latest git-login
440
+ npx @standardagents/cli@latest login --bootstrap-stdin # setup code on standard input
441
+ npx @standardagents/cli@latest whoami
354
442
  npx @standardagents/cli@latest logout
355
443
  ```
356
444
 
357
- `login` signs the current project in to your Standard Agents account. It opens
358
- the browser sign-in page and never creates a project. The setup command on a
359
- project's Overview page (`login --bootstrap <code>`) also fetches the project
360
- API key that account sign-in to the local instance needs.
361
-
362
- `git-login` signs Git in on this machine for Standard Agents repositories.
363
-
364
- Both commands print the sign-in URL, open your browser, and wait until you
445
+ `login` is the one sign-in command. It works in any directory and never
446
+ creates a project. It does three things:
447
+
448
+ 1. It saves one sign-in for this machine: an account session and a long-lived
449
+ account API key. `terms`, `builds`, `deploy`, `rollback`, `redeploy`, and
450
+ Git use it in every directory.
451
+ 2. It registers the Git credential helper for `git.standardagents.ai` and
452
+ `git.standardagentbuilder.com` in your global Git configuration.
453
+ `--no-config` skips this step.
454
+ 3. Inside a project that has no project API key, it saves that key in
455
+ `.dev.vars`. Account sign-in to the local instance needs it. `login` finds
456
+ the project from the Git remote of your checkout, or from the setup code on
457
+ the project's Overview page. An existing key is kept.
458
+
459
+ `login` takes the setup code three ways: `--bootstrap-stdin` reads it from
460
+ standard input, `--bootstrap-file <path>` reads it from a file, and
461
+ `--bootstrap <code>` takes it as an argument. Other users of the machine can
462
+ read an argument in the process list, so prefer the first two.
463
+
464
+ When `login` replaces a published default admin password, it saves the new
465
+ one as `SUPER_ADMIN_PASSWORD` in `.dev.vars` and does not print it.
466
+
467
+ On macOS `login` keeps the account session and the account API key in the
468
+ Keychain. On other platforms, when the Keychain is locked (for example over
469
+ SSH), or when you set `STANDARD_AGENTS_CREDENTIAL_STORE=file`, it keeps them
470
+ in `auth-state.json` in the CLI configuration directory, readable only by your
471
+ user. A sign-in that an earlier release saved in that file keeps working and
472
+ moves to the Keychain the next time you run `login`. Running `login` again
473
+ keeps the existing API key, or revokes the key of a different user or account
474
+ before it creates a new one, so one machine holds one active key.
475
+
476
+ `login` prints the sign-in URL, opens your browser, and waits until you
365
477
  approve the sign-in. Press Ctrl-C to cancel; the pending sign-in is cancelled
366
- on the platform too. Neither command asks for typed input.
478
+ on the platform too. The command never asks for typed input.
367
479
  `--no-open` prints the sign-in URL and waits without opening a browser on this
368
480
  machine, for sign-in from another device, a container, or a script.
369
481
  `STANDARD_AGENTS_BROWSER=none` has the same effect.
370
- Without a terminal, `login` and `git-login` exit with code 1 before they
371
- contact the platform unless you pass `--no-open` or `--bootstrap <code>`,
372
- which needs no browser.
373
-
374
- `logout` removes every stored credential: the Git login, the project session,
375
- and `STANDARD_AGENTS_API_KEY` in `.dev.vars`. It revokes the Git API key and
376
- the account session on the platform, which also signs you out of the
377
- dashboard. It then lists what still works. The project API key cannot be
378
- revoked from the CLI, and credentials set in your shell environment stay until
379
- you unset them. `logout` exits 1 when a credential on this machine still works
380
- or a revocation failed.
482
+ Without a terminal, `login` exits with code 1 before it contacts the platform
483
+ unless you pass `--no-open` or a setup code, which needs no browser.
484
+
485
+ `agents git-login` is an earlier name of `login`. It accepts the same flags
486
+ and does the same work.
487
+
488
+ Releases through 0.45.5 had a separate project sign-in that saved a session in
489
+ `.agents/bootstrap-session.json`. No command reads that file any more. If you
490
+ signed in only that way, run `login` once. `logout` deletes the old file.
491
+
492
+ `whoami` prints the user, the account, and the platform address of the saved
493
+ sign-in. It sends no request and never prints the session or the key.
494
+ `whoami --json` prints
495
+ `{ "ok": true, "endpoint", "account": { "id", "slug" }, "user": { "id", "email" }, "credential", "signed_in_at" }`.
496
+ `credential` is `api_key`, `session`, or `unreadable` when the Keychain does
497
+ not return the saved sign-in (for example in an SSH session).
498
+ When no sign-in is saved it exits with code 3 and prints
499
+ `{ "ok": false, "error": { "code": "NOT_SIGNED_IN", "message", "fix" } }`.
500
+
501
+ `logout` removes every stored credential: your sign-in for this machine,
502
+ `STANDARD_AGENTS_API_KEY` in `.dev.vars`, and a project session from an
503
+ earlier release. It revokes the project API key, the account API key of this
504
+ machine, and the account session on the platform, which also signs you out of
505
+ the dashboard. It then lists what still works. A platform with no route for a
506
+ key to revoke itself reports the project API key as still valid; revoke it
507
+ under API keys in the dashboard. Credentials set in your shell environment
508
+ stay until you unset them. `logout` exits 1 when a credential on this machine
509
+ still works or a revocation failed.
381
510
 
382
511
  `logout --json` prints only the result on stdout:
383
512
  `{ "ok", "removed": [...], "revoked": [...], "remaining": [{ "message", "blocking" }] }`.
384
513
  `ok` is `false` exactly when the exit code is 1.
385
514
 
515
+ ### Git Credential Helper Version
516
+
517
+ `login` and `init` register the credential helper as
518
+ `npx -y @standardagents/cli@<version> git-credential`, where `<version>` is the
519
+ CLI release that ran the command. Git runs the helper with your credentials on
520
+ every fetch and push, so it never starts a release that you did not run
521
+ yourself.
522
+
523
+ - To move the helper to a newer release, run that release's `login`
524
+ again. For a repository that `init` cloned, the helper is in the
525
+ repository's own Git configuration (`git config --local credential.helper`).
526
+ - `--helper-command <command>` and `STANDARD_AGENTS_GIT_HELPER` register a
527
+ command of your choice.
528
+ - A helper that a release through 0.45.5 registered as `@latest` keeps
529
+ working. It runs the newest published release on each Git operation until
530
+ you run `login` again.
531
+ - A build without a version, such as a source checkout, registers `@latest`.
532
+
533
+ The helper requests a read-only token for `git clone`, `git fetch`, `git pull`,
534
+ and `git ls-remote`, and a write token for every other command. It reads the
535
+ command from the `git` process that started it and falls back to a write
536
+ token. `STANDARD_AGENTS_GIT_TOKEN_SCOPE=write` forces the earlier behavior.
537
+
538
+ `login` sets `useHttpPath` for the two Standard Agents Git hosts only. It
539
+ removes the global `credential.useHttpPath` that earlier releases set when
540
+ your global Git configuration holds no other credential setting, and otherwise
541
+ prints the command that removes it.
542
+
386
543
  ### Platform API URL
387
544
 
388
- `init`, `login`, `git-login`, `logout`, `builds`, and the Git credential helper
545
+ `init`, `login`, `logout`, `builds`, `terms`, and the Git credential helper
389
546
  resolve the platform API URL in one order:
390
547
 
391
- 1. The command's flag (`--api-url` for `init`, `--endpoint` for the others)
548
+ 1. The command's flag: `--endpoint <url>` or `--api-url <url>`
392
549
  2. `STANDARD_AGENTS_API_URL`
393
550
  3. `PLATFORM_ENDPOINT`
394
551
  4. `STANDARD_AGENTS_PLATFORM_URL`
@@ -398,6 +555,26 @@ The Git credential helper and `builds` read the same three variables from your
398
555
  project's `.dev.vars` after the environment. `logout` revokes each credential
399
556
  at the platform that issued it.
400
557
 
558
+ `--endpoint` and `--api-url` are two names for one option. Every command that
559
+ takes a platform URL accepts both; `init --help` lists `--api-url` and the
560
+ other commands list `--endpoint`. With both on one command line, `--api-url`
561
+ is used.
562
+
563
+ The CLI sends your session or API key to this URL, so it must use HTTPS. Plain
564
+ HTTP is accepted only for this machine (`localhost`, `127.0.0.1`, `[::1]`).
565
+ For any other URL the command exits 1 before it sends a request and prints the
566
+ `https://` URL to use. A URL that contains a user name or password is refused
567
+ the same way. `diag --token` and the account key of `available-models` follow
568
+ the same rule.
569
+
570
+ A request that carries your session, API key, or setup code is never
571
+ redirected. When the platform answers with a redirect, the command stops and
572
+ names the host; check the platform URL.
573
+
574
+ Each request to the platform, an instance, or the model guide ends after 30
575
+ seconds without an answer (15 seconds per model guide address). The message
576
+ names the host and the command to run next.
577
+
401
578
  ### Read The Curated Current Models Guide
402
579
 
403
580
  ```bash
@@ -405,7 +582,9 @@ pnpm exec agents current-models
405
582
  ```
406
583
 
407
584
  This fetches the live markdown guide from the Standard Agents spec site and
408
- prints it to stdout.
585
+ prints it to stdout. It requests `https://standardagentspec.org/models.md`
586
+ first, and `https://standardagentspec.com/models.md` when that request fails.
587
+ `--url <url>` requests another address instead.
409
588
 
410
589
  ### List Available Models From A Provider
411
590
 
@@ -430,7 +609,8 @@ or the provider returns no models.
430
609
 
431
610
  The command walks every provider page until it has the full model list, then
432
611
  prints a markdown table containing the exact `model` strings to use in
433
- `defineModel({ model: ... })`.
612
+ `defineModel({ model: ... })`. `--json` prints the same list as one JSON
613
+ document.
434
614
 
435
615
  ### Pack And Unpack Agents
436
616
 
@@ -444,8 +624,224 @@ Run these from the project root. They use the Standard Agents Builder installed
444
624
 
445
625
  `pack` writes the package to `agents/packed/` and then removes the original files that only the packed agent uses. Files that another agent shares are kept. It lists the files before it removes them. Pass `--no-remove` to keep every original; `unpack` restores them from the package.
446
626
 
627
+ `list-packed --json` prints the packages as one JSON document.
628
+
447
629
  Without a terminal, or with `--no-interactive`, `pack` never prompts. When the project has several agents, name the one to pack; otherwise the command lists the agents and exits with code 1.
448
630
 
631
+ ### Diagnose A Running Instance
632
+
633
+ ```bash
634
+ agents diag instance # deployed version, watchdog budgets, config warnings
635
+ agents diag threads --stuck # recent threads with an unrecovered open request
636
+ agents diag thread <id> # one thread in detail
637
+ agents diag logs <thread> [logId] # request logs
638
+ agents diag tail <thread> # live log stream
639
+ agents diag revive <thread> # run a watchdog check now
640
+ ```
641
+
642
+ These commands read an instance, not the platform. Set
643
+ `STANDARD_AGENTS_INSTANCE_URL` and `STANDARD_AGENTS_INSTANCE_TOKEN`. The
644
+ `--endpoint <url>` and `--token <key>` flags take the same values, but other
645
+ users of the machine can read a token that is passed as an argument.
646
+
647
+ - A failed request prints the instance's error code, message and request ID.
648
+ - `diag threads` reports how many threads it could not read. Those threads are
649
+ listed as `UNKNOWN`. With `--stuck`, an unread thread could be the stuck one,
650
+ so the command lists each unread thread with its error and exits 1. Exit 0
651
+ means every thread was read; the stuck threads, if any, are the ones listed.
652
+ - `diag tail` exits 0 when the stream closes normally (close code 1000 or
653
+ 1005) and 1 when the socket fails or closes with any other code.
654
+
655
+ ### Every Command
656
+
657
+ The [CLI reference](https://docs.standardagents.ai/user-interfaces/cli) lists
658
+ every command and flag, the exit codes, the commands to run without a
659
+ terminal, where credentials are stored, and what to do when a build fails.
660
+
661
+ | Command | Purpose |
662
+ |---------|---------|
663
+ | `init` | Create a project on the platform, clone it, and start it locally |
664
+ | `login` | Sign in to your account on this machine. Inside a project, also save the project API key |
665
+ | `whoami` | Print the account this machine is signed in to. Exits 3 when not signed in |
666
+ | `logout` | Remove and revoke stored credentials |
667
+ | `git-credential` | The Git credential helper that `init` and `login` register. Git runs it; you do not need to |
668
+ | `scaffold` | Add Standard Agents to an existing Vite project |
669
+ | `support-files` | Write the local support files (`package.json` when missing, `.gitignore` entries, the registry setting) of a project repository that you cloned yourself. `init` runs this step for you |
670
+ | `init-chat` | Create a React chat front end (Vite or Next.js) for a running instance |
671
+ | `deploy` | Push the current branch and follow the platform build |
672
+ | `builds` | Read builds and build logs, and retry a failed build |
673
+ | `rollback` | Make an earlier production build live again |
674
+ | `redeploy` | Deploy the live production build again |
675
+ | `skill` | Install the coding skill for your coding agent |
676
+ | `current-models` | Print the current model guide |
677
+ | `available-models` | List the model IDs of one provider |
678
+ | `pack` | Pack an agent and its dependencies into a package |
679
+ | `unpack` | Copy a packed agent into editable files. Without a package name it lists the packages |
680
+ | `list-packed` | List the packed agents in the project |
681
+ | `diag` | Diagnose a running instance |
682
+ | `terms` | Read and accept the Standard Agents terms |
683
+
684
+ ## Machine-Readable Output
685
+
686
+ Errors and warnings from every command go to stderr. Status lines and results
687
+ go to stdout.
688
+
689
+ With `--json`, stdout holds exactly one JSON document and nothing else, and
690
+ status lines, warnings and errors go to stderr. `diag tail` is the one
691
+ exception: it prints one JSON frame per line.
692
+
693
+ This section describes `--json` for `available-models`, `list-packed`, and
694
+ every `diag` subcommand:
695
+
696
+ - A command that exits 0 prints its result document.
697
+ - A command that exits nonzero prints a document with an `error` member. The
698
+ document may also carry the result fields that were known when it failed.
699
+
700
+ Four groups of commands print their own documents, described with the
701
+ commands:
702
+
703
+ - `deploy`, `builds` and its subcommands, `rollback`, and `redeploy`: see
704
+ [Read, Retry, And Roll Back Builds](#read-retry-and-roll-back-builds). Their
705
+ documents carry `exit_code`, and a failure before any result prints
706
+ `{ "error": { "message", "fix", "exit_code" } }`.
707
+ - `scaffold` and `support-files`: see
708
+ [Scaffold Project Structure](#scaffold-project-structure). A failure is
709
+ `"ok": false`, with the cause in the failed stage's `message` and the next
710
+ command in `resume`.
711
+ - `logout` and `whoami`: see [Sign In And Out](#sign-in-and-out). A `logout` failure is
712
+ `"ok": false`, with the credentials that still work in `remaining`.
713
+ - `terms` and `terms accept`: see
714
+ [Read And Accept The Terms](#read-and-accept-the-terms).
715
+
716
+ ### Error object
717
+
718
+ ```json
719
+ {
720
+ "error": {
721
+ "code": "request_failed",
722
+ "message": "The same text the command prints on stderr.",
723
+ "hint": "The next command or step, when the command knows one.",
724
+ "status": 403,
725
+ "request_id": "0b9f6c1e-..."
726
+ }
727
+ }
728
+ ```
729
+
730
+ `code` and `message` are always present. `hint` is present when the command
731
+ knows the next step. `status` and `request_id` are present for a failed HTTP
732
+ request to an instance (`diag`).
733
+
734
+ Two codes come from the CLI itself, for any command: `usage_error` (an unknown
735
+ command or option, or a missing argument) and `command_failed` (a failure with
736
+ no more specific code). They are printed whenever `--json` is in the
737
+ arguments, including for a command that has no `--json` option.
738
+
739
+ ### Exit codes
740
+
741
+ | Code | Meaning |
742
+ | --- | --- |
743
+ | 0 | The command did what it reports. With `--json`, the document has no `error` member |
744
+ | 1 | The command failed, or could not verify its result. The cause is on stderr and, with `--json`, in `error` (`scaffold` and `support-files`: in the failed stage) |
745
+ | 2 to 5 | Used by `deploy`, `builds`, `rollback`, and `redeploy` (see [Read, Retry, And Roll Back Builds](#read-retry-and-roll-back-builds)), and codes 2 and 3 by `terms` (see [Read And Accept The Terms](#read-and-accept-the-terms)) |
746
+ | 130, 143 | `init` was interrupted by Ctrl-C (130) or SIGTERM (143) and cleaned up |
747
+
748
+ Command-specific cases of exit code 1: `logout` when a credential still works
749
+ or a revocation failed; `diag threads --stuck` when a thread could not be
750
+ read; `diag tail` when the stream closed abnormally.
751
+
752
+ ### `available-models --json`
753
+
754
+ ```json
755
+ {
756
+ "provider": {
757
+ "name": "openai",
758
+ "label": "OpenAI",
759
+ "source": "package",
760
+ "credential": "platform",
761
+ "platform_origin": "https://api.standardagents.ai"
762
+ },
763
+ "models": [
764
+ { "id": "gpt-5.4", "label": "GPT-5.4", "description": "", "context_length": 400000 }
765
+ ]
766
+ }
767
+ ```
768
+
769
+ - `models[].id` is the value for `defineModel({ model })`. `context_length` is
770
+ `null` when the provider does not report it.
771
+ - `provider.source` is `package` for an installed provider package and
772
+ `project` for a provider defined in `agents/providers/`.
773
+ - `provider.credential` is `own-key` (the provider's own key), `platform` (the
774
+ project's Standard Agents account key; `platform_origin` is then set), or
775
+ `definition` (a provider from `agents/providers/`; `file` is then set, and
776
+ `base_url` when the definition configures one).
777
+ - The document never contains a key.
778
+ - Error codes: `no_providers`, `unknown_provider`, `provider_not_installed`,
779
+ `provider_load_failed`, `missing_credentials`, `no_configured_provider`,
780
+ `ambiguous_provider`, `request_failed`, `no_models`, `insecure_endpoint` (the
781
+ account key would go to a platform URL that is neither HTTPS nor on this
782
+ machine).
783
+
784
+ ### `list-packed --json`
785
+
786
+ ```json
787
+ {
788
+ "packages": [
789
+ {
790
+ "package_id": "standardagent-my-agent",
791
+ "version": "1.0.0",
792
+ "source": "local",
793
+ "entry_agents": ["my_agent"],
794
+ "path": "agents/packed/standardagent-my-agent"
795
+ }
796
+ ]
797
+ }
798
+ ```
799
+
800
+ `packages` is empty when none are found. Error codes: `not_a_project` (no
801
+ `agents/` directory) and `packing_unavailable` (the Standard Agents Builder is
802
+ not installed in the project, or has no packing entry point).
803
+
804
+ ### `diag --json`
805
+
806
+ - `diag instance`, `diag thread`, `diag logs <thread> <logId>` and
807
+ `diag revive` print the instance's API response unchanged. `diag logs
808
+ <thread>` prints the array of logs.
809
+ - `diag threads` prints the scan:
810
+
811
+ ```json
812
+ {
813
+ "scanned": 25,
814
+ "unreadable": 1,
815
+ "threads": [
816
+ { "id": "050d96f1-...", "agent": "support", "health": "idle", "detail": "idle" }
817
+ ],
818
+ "unreadable_threads": [
819
+ {
820
+ "id": "7c1e22aa-...",
821
+ "agent": "support",
822
+ "error": { "code": "internal_error", "message": "GET /api/threads/7c1e22aa-.../diagnostics → HTTP 500: ...", "status": 500, "request_id": "..." }
823
+ }
824
+ ]
825
+ }
826
+ ```
827
+
828
+ `scanned` counts the threads that were checked and `unreadable` the ones
829
+ whose diagnostics could not be read. `health` is `stuck`, `running`,
830
+ `stopped`, `idle`, `terminated` or `unknown`. With `--stuck`, `threads`
831
+ holds only stuck threads, and an incomplete scan exits 1 with the error code
832
+ `incomplete_scan`. Earlier releases printed the `threads` array alone.
833
+ - `diag tail --json` prints each frame from the instance on its own line, as
834
+ the instance sent it (JSON Lines), and nothing else on stdout. A frame that
835
+ is not JSON is skipped with a note on stderr. A failure is reported on
836
+ stderr only, because stdout carries frames.
837
+ - Error codes: the instance's own code for a refused request (for example
838
+ `forbidden`), `request_failed` when the instance sent none, `unreachable`
839
+ when no connection was made, `timeout` when the instance did not answer
840
+ within 30 seconds, `insecure_endpoint` when a token would go to an instance
841
+ URL that is neither HTTPS nor on this machine, `redirect_refused` when the
842
+ instance answered a request that carried a token with a redirect, and
843
+ `diag_failed` otherwise.
844
+
449
845
  ## Manual Configuration
450
846
 
451
847
  For new projects, manual Cloudflare configuration is not required. Add
@@ -455,18 +851,16 @@ compatibility flags, and migrations automatically.
455
851
 
456
852
  ## TypeScript Types
457
853
 
458
- Standard Agents Builder generates project types when the dev server starts. For a focused
459
- type-generation pass, run:
854
+ The dev server generates the project's type files. It writes
855
+ `.agents/types.d.ts` and `.agents/virtual-module.d.ts` when it starts, and
856
+ again after each change under `agents/`:
460
857
 
461
858
  ```bash
462
- pnpm exec vite build
859
+ npm run dev
463
860
  ```
464
861
 
465
- This will update your `worker-configuration.d.ts` file with:
466
-
467
- ```typescript
468
- interface Env {
469
- AGENT_BUILDER_THREAD: DurableObjectNamespace<DurableThread>;
470
- AGENT_BUILDER: DurableObjectNamespace<DurableAgentBuilder>;
471
- }
472
- ```
862
+ Start the dev server once before you run the type checker in a new project;
863
+ the type checker reports missing type files until then. There is no separate
864
+ type-generation command. Do not run `vite build` for types: the `build` script
865
+ of a generated project stops with a message, because builds run on the
866
+ Standard Agents platform.