@shardflux/cli 0.25.0 → 0.28.1

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 (93) hide show
  1. package/CHANGELOG.md +154 -1
  2. package/README.md +212 -36
  3. package/dist/account-commands.d.ts +2 -4
  4. package/dist/account-commands.js +2 -6
  5. package/dist/account-pool.d.ts +11 -1
  6. package/dist/account-pool.js +48 -0
  7. package/dist/agent-commands.js +4 -3
  8. package/dist/agent-git-commands.d.ts +1 -2
  9. package/dist/agent-git-commands.js +2 -21
  10. package/dist/agent-models.d.ts +31 -1
  11. package/dist/agent-models.js +27 -4
  12. package/dist/agent-setup.d.ts +4 -2
  13. package/dist/agent-setup.js +6 -4
  14. package/dist/agent-shell.d.ts +2 -0
  15. package/dist/agent-shell.js +5 -0
  16. package/dist/args.d.ts +1 -1
  17. package/dist/args.js +67 -12
  18. package/dist/board-args.js +8 -3
  19. package/dist/board-commands.d.ts +7 -3
  20. package/dist/board-commands.js +22 -12
  21. package/dist/brain-commands.d.ts +2 -0
  22. package/dist/brain-commands.js +78 -0
  23. package/dist/cli-proxy.d.ts +1 -13
  24. package/dist/cli-proxy.js +2 -27
  25. package/dist/client-settings.d.ts +2 -1
  26. package/dist/client-settings.js +14 -2
  27. package/dist/codex-cloud.d.ts +2 -0
  28. package/dist/codex-cloud.js +17 -12
  29. package/dist/commands.js +8 -0
  30. package/dist/conversation-commands.d.ts +5 -1
  31. package/dist/conversation-commands.js +58 -6
  32. package/dist/conversation-terminal.js +2 -2
  33. package/dist/desktop-linux.d.ts +12 -1
  34. package/dist/desktop-linux.js +47 -18
  35. package/dist/device-approvals.js +24 -2
  36. package/dist/device-bridge.d.ts +24 -4
  37. package/dist/device-bridge.js +181 -8
  38. package/dist/device-folders.d.ts +6 -1
  39. package/dist/device-folders.js +6 -2
  40. package/dist/device-helper.d.ts +8 -0
  41. package/dist/device-helper.js +71 -12
  42. package/dist/device-mode.d.ts +44 -0
  43. package/dist/device-mode.js +119 -0
  44. package/dist/drive-commands.d.ts +2 -2
  45. package/dist/drive-commands.js +1 -1
  46. package/dist/format.js +3 -0
  47. package/dist/forwarder-refresh.d.ts +15 -0
  48. package/dist/forwarder-refresh.js +32 -0
  49. package/dist/handler-loader.d.ts +3 -0
  50. package/dist/handler-loader.js +43 -0
  51. package/dist/handlers.js +4 -2
  52. package/dist/land.d.ts +10 -5
  53. package/dist/land.js +56 -9
  54. package/dist/linux-helper.js +1 -2
  55. package/dist/mac-app.d.ts +11 -0
  56. package/dist/mac-app.js +11 -0
  57. package/dist/machine-setup-guard.d.ts +9 -0
  58. package/dist/machine-setup-guard.js +22 -0
  59. package/dist/machine-setup.d.ts +1 -8
  60. package/dist/machine-setup.js +2 -22
  61. package/dist/main.js +19 -16
  62. package/dist/menubar.d.ts +18 -13
  63. package/dist/menubar.js +60 -50
  64. package/dist/orchestrator-args.d.ts +7 -0
  65. package/dist/orchestrator-args.js +64 -0
  66. package/dist/orchestrator-commands.d.ts +43 -0
  67. package/dist/orchestrator-commands.js +260 -0
  68. package/dist/person-scope.d.ts +20 -0
  69. package/dist/person-scope.js +61 -0
  70. package/dist/project-hub-seed.d.ts +20 -0
  71. package/dist/project-hub-seed.js +59 -0
  72. package/dist/registry.d.ts +1 -1
  73. package/dist/registry.js +2 -1
  74. package/dist/router-commands.d.ts +12 -21
  75. package/dist/router-commands.js +5 -59
  76. package/dist/startup-housekeeping.d.ts +5 -0
  77. package/dist/startup-housekeeping.js +30 -0
  78. package/dist/t3-launch.js +2 -2
  79. package/dist/t3-provider.js +4 -2
  80. package/dist/task-land-hub.py +16 -1
  81. package/dist/this-computer.d.ts +4 -2
  82. package/dist/this-computer.js +20 -2
  83. package/dist/thread-on-computer.js +2 -2
  84. package/dist/timing.js +3 -1
  85. package/dist/transcribe-commands.js +6 -2
  86. package/dist/update.js +4 -2
  87. package/dist/wait-status.d.ts +1 -1
  88. package/dist/wait-status.js +2 -0
  89. package/dist/worktree-twin-engine.d.ts +1 -1
  90. package/dist/worktree-twin-engine.js +10 -7
  91. package/dist/worktree-twin.d.ts +6 -0
  92. package/dist/worktree-twin.js +8 -1
  93. package/package.json +12 -6
package/README.md CHANGED
@@ -1,5 +1,7 @@
1
1
  # @shardflux/cli: `shard`
2
2
 
3
+ Use `shard --help` or `shard <command> --help` to explore commands before signing in.
4
+
3
5
  For error codes, retry timing, and plan recovery, see the [error reference](https://docs.shardflux.dev/reference/errors).
4
6
 
5
7
  Historical template file lists: reads queue checksum-verified reconstruction when a cold list is absent from the SQL cache. TypeScript SDK 0.27.0+ / Python 0.23.0+ wait full Retry-After for retryable API 409 file_list_indexing on GET/HEAD within the admission timeout. Template objects and version history stay available.
@@ -30,6 +32,8 @@ T3 Connect (0.22.0+): `shard setup --inspect --t3-connect --org <id|slug>` signs
30
32
  project. Status and Connect use the same person and organization, including a saved session without an API key;
31
33
  an explicit selection keeps the default credentials and target status. An approved T3 sign-in is reused.
32
34
 
35
+ Filesystem recovery timing (0.28.0+): cold resume output identifies `guest_filesystem` in JSON and the restart notice. See the [workspace lifecycle](https://docs.shardflux.dev/concepts/lifecycle) for retained files and process restart semantics.
36
+
33
37
  ## Support and bug reports
34
38
 
35
39
  [Report a bug](https://github.com/shardfluxdev/community/issues/new?template=bug_report.yml) or
@@ -51,6 +55,8 @@ Both the task and project are required, and the task becomes the first user-auth
51
55
 
52
56
  ## Reverse tunnels (0.11.0+)
53
57
 
58
+ Reverse listener recovery (0.24.1+): the foreground tunnel replaces its helper automatically after replay is lost and accepts fresh connections. Keep the command running for callbacks; Ctrl-C closes it.
59
+
54
60
  Run a foreground TCP tunnel from a workspace to a service on this machine:
55
61
 
56
62
  ```sh
@@ -74,18 +80,24 @@ Linux (Ubuntu 24.04, x64 and arm64) and macOS are supported. On Linux, run `shar
74
80
  connect Claude, Codex or both (0.17.0+), then run `shard ./` in your project to attach Claude Code or Codex in place. Sign-in opens your browser;
75
81
  on a headless terminal, follow the displayed URL and device code. `--accept-terms` accepts the terms notice.
76
82
 
77
- In a desktop session, `shard` opens the Shardflux app for this (0.18.0+): guided sign-in, a top-bar panel for your
78
- conversations, a launcher on Alt+Shift+Space and Settings. It installs with the CLI (the optional
79
- `@shardflux/desktop-linux-x64` or `-arm64` package), appears in the app grid and starts at login;
80
- `shard menubar start|stop|status` and `--login on|off` manage it as on macOS.
83
+ In a desktop session, `shard` opens the Shardflux app (0.18.0+): guided sign-in, your conversations with their
84
+ computers, approvals for this computer, a launcher on Alt+Shift+Space and one Settings window. It lives in the tray
85
+ and the app grid and starts at login; `shard menubar start|stop|status` and `--login on|off` manage it as on macOS.
86
+
87
+ The Shardflux app (0.28.0+) is one desktop app on macOS and Linux: the menu bar or tray, onboarding, the launcher,
88
+ conversations with their computers, device approvals and one Settings window. `shard` installs it from the optional
89
+ `@shardflux/desktop-darwin-arm64` / `-x64` package on macOS (at `~/Applications/Shardflux.app`, in place of the menu
90
+ bar app, keeping its login item and privacy grants) and from `@shardflux/desktop-linux-x64` / `-arm64` on Linux (at
91
+ `~/.local/share/shardflux/desktop`), and `shard update` keeps it current.
81
92
 
82
93
  The Linux helper starts automatically after setup as `~/.config/systemd/user/shardflux-helper.service`
83
94
  and restarts after a CLI update. It keeps the live twin, `~/Shardflux` files and conversation history in sync.
84
- Use `shard device requests`, `shard device approve <id>` or `shard device deny <id>` for local approvals;
95
+ Use `shard device requests`, `shard device approve <id>` or `shard device deny <id>` for local approvals, and
96
+ `shard device approvals auto|read|ask` to choose whether your agents ask first (0.28.0+);
85
97
  desktop notifications point to pending requests. On systems without a systemd user session, the helper runs
86
98
  while your `shard` commands are open. `shard agents open` opens a terminal when launched outside one, using
87
- `$TERMINAL`, `x-terminal-emulator` or `gnome-terminal`, or prints the attach command. The Mac app adds a menu
88
- bar, launcher and Settings window.
99
+ `$TERMINAL`, `x-terminal-emulator` or `gnome-terminal`, or prints the attach command. On macOS the same app lives in
100
+ the menu bar.
89
101
 
90
102
  ```sh
91
103
  npm i -g shardflux
@@ -109,7 +121,7 @@ shard ./
109
121
 
110
122
  Choose Claude Code or Codex. Claude asks for one cloud sign-in per Shardflux account; Codex uses your copied login.
111
123
  Each `shard ./` starts its own conversation VM and opens your agent’s native terminal. Later turns stay in that
112
- VM; `shard ./ --resume` selects a saved project conversation. Native terminal and ACP sessions receive the conversation tools for their own conversation, so the agent can fork, ask for a review, and report to its parent (0.14.0+). You can open conversations in separate terminals at the same time; each stays in the project's local history. On macOS, `shard` opens the optional command center. On macOS the menu bar starts automatically the first
124
+ VM; `shard ./ --resume` selects a saved project conversation. Native terminal and ACP sessions receive the conversation tools for their own conversation, so the agent can fork, ask for a review, and report to its parent (0.14.0+). You can open conversations in separate terminals at the same time; each stays in the project's local history. On macOS, `shard` opens the optional command center. The Shardflux app starts automatically the first
113
125
  time `shard` runs, with launch at login enabled; `shard menubar stop` turns it off. See [Cloud agents](https://docs.shardflux.dev/guides/cloud-agents).
114
126
 
115
127
  T3 Code uses one **Shardflux** provider; choose a Claude Code or Codex model to start that agent in the cloud.
@@ -117,14 +129,14 @@ Model choices come from your cloud agent's session and use the same coding tools
117
129
  Project files synchronize before each message and before its completion (0.22.0+): review remote edits in T3’s
118
130
  Changes panel and checkpoints, and send local edits to the next turn. Conflicting versions are retained with
119
131
  a `.shard-conflict-<agent>` suffix. Sync runs between turns; an idle T3 thread needs no file watcher.
120
- The provider is registered automatically when T3 Code is installed, on macOS and on Linux from its .deb or AppImage
121
- (0.17.0+). Choose **Sign in** on its card in T3's provider settings: T3 runs `shard acp --login` in its own terminal,
132
+ At command startup, Shardflux checks for T3 Code and registers the provider automatically on macOS and on Linux
133
+ from its .deb or AppImage (0.17.0+). Choose **Sign in** on its card in T3's provider settings: T3 runs `shard acp --login` in its own terminal,
122
134
  which creates or signs in to your account (with this computer's Codex login, or your email) and connects Claude Code
123
135
  and Codex, skipping every step that is already done (0.15.0+). Editors that launch agents from the ACP registry
124
136
  run the same sign-in as `shard --login` (0.22.0+).
125
137
  With T3 Code 0.0.45, `shard agents new --in t3` adds the project as an SSH environment instead.
126
138
 
127
- ACP journal read reattachment uses bounded backoff through temporary lifecycle interruptions (0.23.0+). It keeps the saved sequence and never resubmits an uncertain turn.
139
+ ACP journal read reattachment uses bounded backoff through temporary lifecycle interruptions (0.23.0+). It keeps the saved sequence and never resubmits an uncertain turn. ACP input reattachment (0.25.0+) retains the native request identity and running turn while reconnecting.
128
140
 
129
141
  In CLI 0.22.0+, `shard setup --inspect` shows a stopped T3 Connect workspace link and its remedy without restarting
130
142
  the link or replacing your approved sign-in. `shard agents open t3` brings T3 Code up once the workspace is linked
@@ -155,12 +167,24 @@ shard conversations start --home --title "Plan the billing work"
155
167
  shard conversations send conv_6qz2dmu4kd3xa7v5l2hgmfnpjy "Here is the failing run" --file ci.log
156
168
  ```
157
169
 
158
- `--repo` and `--branch` choose the repository and the branch it starts from (default: the project's most recently
159
- active repository, from `main`, then `master`); `--app`, `--model` and `--effort` work as for `shard ./`. It prints the
170
+ `--repo` and `--branch` choose the repository and the branch it starts from (default: the project's only
171
+ repository, from `main`, then `master`; a project with several asks you to name one with `--repo`); `--app`, `--model` and `--effort` work as for `shard ./`. It prints the
160
172
  conversation's id, key and state; `shard agents open <id>` opens it. `--file` (repeatable, up to 20 files of 64 MiB
161
173
  each) puts each file in the conversation's computer before the message and prints where it landed; `--json` returns
162
174
  the stored paths.
163
175
 
176
+ A message reaches the agent at once: a working agent takes it into its running turn (Claude Code, Codex and Codex
177
+ Cloud), and an idle one starts its next turn with it. `--wait` (0.28.0+) says which:
178
+
179
+ ```sh
180
+ $ shard conversations send conv_6qz2dmu4kd3xa7v5l2hgmfnpjy "Use the staging database instead" --wait
181
+ Message sent (12).
182
+ Steered into the running turn.
183
+ ```
184
+
185
+ It prints `Started the next turn.` when the agent was idle; `--json` adds `delivery` (`state`, `delivered_at`,
186
+ `steered`).
187
+
164
188
  Choose the model and reasoning effort a new thread starts with (0.17.0+):
165
189
 
166
190
  ```sh
@@ -202,14 +226,14 @@ resolution before preserve-all can upload; a registration whose folder is gone h
202
226
  With CLI 0.24.0+, a move during a reply stops the local turn and continues the same reply in the cloud automatically, redoing the interrupted step. An agent calling `move_to_cloud` inside its own turn waits for that turn to finish. Uncommitted edits come along, and your working tree, index and branch stay as
203
227
  they are. The cloud work comes back to your checkout by itself, and typing in the local Claude Code copy shows one line
204
228
  that it continues in the cloud. Sessions from Claude Desktop's Code tab and the Codex app move the same way; in the
205
- macOS menu bar, a project's recent sessions have **Move to cloud** in their ⋯ menu, and with the Shardflux MCP server
229
+ Shardflux app's menu, a project's recent sessions under **On this Mac** (**On this computer** on Ubuntu) have
230
+ **Move to cloud**, and with the Shardflux MCP server
206
231
  you can ask the agent itself to continue in the cloud. A session is listed under every repository it worked in, also
207
232
  one that began in another folder such as Claude Desktop's scratch folder, and `--path <repository>` moves it from
208
233
  anywhere (0.22.0+).
209
234
 
210
- With menu bar 0.8.5+, a failed move stays at its session’s row with its reason on hover and **Retry move to cloud**
211
- in **⋯**. Retry or Refresh clears the previous failure. CLI 0.23.0+ records a matching stable Node.js path on macOS,
212
- and menu bar 0.8.5+ recovers Node.js after an upgrade removes the recorded binary.
235
+ In the Shardflux app, a failed move stays at its session’s row as **Couldn’t move**, with its reason on hover:
236
+ choose it to try again (**Retry move to cloud** in the row's menu). CLI 0.23.0+ records a matching stable Node.js path on macOS.
213
237
 
214
238
  Start a thread in T3 Code from the command line (0.17.0+):
215
239
 
@@ -229,6 +253,11 @@ conversation with `shard conversations send <id> "<answer>"` (0.23.0+ names it w
229
253
  with in claude.ai and the Claude app (default `☁`: "☁ Fix login bug · todo-app"); `shard settings` shows it with where
230
254
  conversations open.
231
255
 
256
+ Finished cloud work lands in your folder by itself: a conversation's commits come into the branch it started from, a
257
+ board task's result into your linked folder and the project's default branch. `shard settings --auto-land off`
258
+ (0.28.0+) keeps it in the cloud on this computer (`shard task land` and `shard conversations land` still land on
259
+ request); `--auto-land on` turns it back on. The Shardflux app's Settings → Projects changes the same switch.
260
+
232
261
  Terminal conversations open in the terminal you choose (0.22.0+):
233
262
 
234
263
  ```sh
@@ -251,7 +280,7 @@ shard conversations try <conversation>
251
280
 
252
281
  Your branch opens in `.shard/worktrees/<name>`, syncs both ways, and its dev servers appear at localhost.
253
282
  Ctrl-C stops local sync. Your main checkout stays available for your own work.
254
- Device tools ask for approval on your computer before preparing the conversation’s local worktree. With CLI 0.15.0 and menu bar 0.3.0, Review shows the exact command, file direction, paths or port mapping; access outside the conversation folder only offers Allow once. Live transcripts stay in
283
+ Device tools ask for approval on your computer before preparing the conversation’s local worktree. With CLI 0.15.0+, Review shows the exact command, file direction, paths or port mapping; access outside the conversation folder only offers Allow once. Live transcripts stay in
255
284
 
256
285
  From 0.25.0, an agent can also list a folder on your computer, make one of your projects from it, and move a file to or from anywhere on it by an absolute or `~/` path. Each asks first: **Allow once**, or **Always for this folder**, which covers that kind of request for that folder and everything inside it. `shard projects link <path> [--prompt <text>]` does the same from a terminal: the folder is prepared in the background, kept as this computer’s live copy, and `--prompt` starts a conversation there.
257
286
  `~/.config/shardflux/conversations/`; ended sessions enter Claude Code’s or Codex’s native history. Transcript files up to 64 MiB are supported (0.14.0+).
@@ -259,14 +288,14 @@ From 0.14.3, transcript copying runs independently of device approvals. Unknown
259
288
 
260
289
  Every conversation's committed files are on your computer too (with the helper running; macOS 0.16.0+, Linux 0.17.0+):
261
290
  `~/Shardflux/<repository>/<base branch>/<conversation>/` holds what each conversation changed or added, read-only,
262
- and updates when its branch moves. Large files are listed as `<file>.placeholder.txt`; download one with the menu
263
- bar's **Download** or:
291
+ and updates when its branch moves. Large files are listed as `<file>.placeholder.txt`; open one from the
292
+ conversation's computer in the Shardflux app and choose **Save to Downloads**, or:
264
293
 
265
294
  ```sh
266
295
  shard files pull hype-video out/hype.mp4
267
296
  ```
268
297
 
269
- Finished conversations land in your checkout by themselves (0.16.0+, with the menu bar app running). When a
298
+ Finished conversations land in your checkout by themselves (0.16.0+, with the Shardflux app running). When a
270
299
  conversation's turn ends with its work committed, the branch it started from moves to its commits and the changed
271
300
  files are written in place, next to your own uncommitted edits, which stay as they are (where both touched the same
272
301
  lines, your text is kept). `git status` keeps showing only your edits. A conversation started from a checkout with
@@ -278,6 +307,11 @@ shard conversations landing # auto (default), pr or off for this proj
278
307
  shard conversations landing backups # then: shard conversations landing restore <backup>
279
308
  ```
280
309
 
310
+ To land a finished conversation manually, run `shard conversations land <id> merge`. In a project with several
311
+ repositories it chooses a linked folder of that conversation's repository; the hub's default branch for another
312
+ repository stays where it is. `--path <folder>` chooses the destination explicitly. From 0.28.1, manual landing
313
+ uses the result’s own ready computer or the project reader, so deleting an unrelated thread does not interrupt it.
314
+
281
315
  For application workspace commands, `shard signup` creates an account and saves a project key, or set
282
316
  `SHARDFLUX_API_KEY` to a key from the console and run `shard login`. `shard --help` lists every command.
283
317
 
@@ -379,7 +413,7 @@ answer) or their product (it runs VMs for its customers through the API, SDK or
379
413
  Commands that wait for your user in the browser (sign-ins, `--ask`) take up to 10 minutes: run them with a long timeout
380
414
  or in the background.
381
415
 
382
- **Their product** (no agent sign-ins, menu bar or machine):
416
+ **Their product** (no agent sign-ins, Shardflux app or machine):
383
417
 
384
418
  2. `eval "$(shard env)"` exports `SHARDFLUX_API_KEY` for the SDKs, the MCP server and your product's server. Keep it in
385
419
  server-side secrets.
@@ -649,9 +683,11 @@ and the session renewals of step-up and password changes).
649
683
  ## Update
650
684
 
651
685
  `shard update` **(0.13.5+)** brings everything Shardflux installed on this computer up to date: shard itself
652
- (the `shardflux` package or `@shardflux/cli`), its SDK, the macOS menu bar app and a globally installed
686
+ (the `shardflux` package or `@shardflux/cli`), its SDK, the Shardflux app and a globally installed
653
687
  `@shardflux/mcp`. It runs one install of the latest versions with the package manager that installed shard (npm,
654
- pnpm, bun or Volta) and restarts the menu bar on its new app. The menu bar's **Update** button runs the same command.
688
+ pnpm, bun or Volta) and restarts the app on its new version; **Update now** in the app's Settings → Updates runs the
689
+ same command. After `npm i -g shardflux` the app moves to the new version by itself once no window is open and no
690
+ approval or move is in progress.
655
691
 
656
692
  ```sh
657
693
  shard update --check # what is behind, without installing
@@ -706,7 +742,10 @@ shows the status; `shard version --check` asks now (`--json`: `{"cli", "sdk", "u
706
742
  | `version [--check]` | Print the CLI and SDK versions and the update status (`--check` asks the API now). |
707
743
  | `usage [--org <id>] [--estimate \| --series \| --workspace <id\|key>] [--from T] [--to T] [--granularity hour\|day] [--meter M]` | Usage summary for the current period: plan, meters and allowances. `--estimate`: the bill so far and projected allowance use; `--series`: usage over time; `--workspace`: one workspace's usage over time (0.5.0+). The summary includes the [overage](#usage-and-overage) block (0.5.1+). |
708
744
  | `feedback [--yes] [--category C] [--workspace W] [--request-id ID] [--error-code CODE] [--command TEXT] [--from-file F\|-] <message...>` | Preview feedback; `--yes` sends after explicit user authorization (0.22.0+). See [Feedback](#feedback-preview-and-user-approval). |
709
- | `route [--task ID] [--org O] [--project P] <text...>`, `ask [--task ID] [--org O] [--project P] <question...>` | The board's input bar (0.25.0+): where a line of input goes (its project or your home; a task, a question or a steer, split per task), and a quick question about your work, answered as it is written. |
745
+ | `orchestrator say [--wait [--timeout D]] [--task ID\|--report ID\|--needs-you ID\|--input ID\|--conversation ID] <words...>`, `orchestrator list [--all]`, `orchestrator retry\|dismiss\|restore <input-id>` | Your orchestrator (0.28.0+): say something and every input is handled at once by its own thread; `--wait` prints its curated result. See [Your orchestrator](#your-orchestrator-0280). |
746
+ | `brain ls [prefix] [--org O] [--all] [--limit N] [--cursor C]`, `brain get <path> [--org O] [--sha256 HEX] [-o FILE]` | Your brain (0.28.0+): your orchestrator's answers, reports and notes, read from any device. See [Your brain](#your-brain-0280). |
747
+ | `route [--task ID] [--org O] [--project P] <text...>`, `ask [--task ID] [--org O] [--project P] <question...>` | Deprecated; use `shard orchestrator say`. The board's input bar (0.25.0+): where a line of input goes, and a quick question about your work. |
748
+ | `conversations archive\|unarchive\|seen <id...>` (`c archive`) | Your inbox, the same on every device (0.28.0+): archive conversations, bring them back, or mark them seen. `--json` prints `{data, skipped}`. See [Conversations](#conversations). |
710
749
  | `conversations delete <id> --yes` (`c delete`) | Delete a conversation everywhere at once (0.25.0+): its agent stops, its computer is deleted, and its messages, transcript and branch go with it. `--json` prints `{id, deleted, deleted_at, operation}`. See [Conversations](#conversations). |
711
750
  | `workspaces open <key> --template <slug> [--secret NAME]... [--input NAME=value]... [--input-file F] [--lifetime persistent\|session] [--mode processful\|file-first] [--cpu-millis N --memory-mib N --disk-gib N] [--allocation-mode fixed\|elastic] [--memory-held N] [--no-wait] [--timeout 5m] [--timing]` | Open by key. Creates the workspace on first use and reconnects or resumes it afterwards, never resetting it. Waits until it is ready (the template's start commands and services included) unless you pass `--no-wait`. `--secret` binds secret names (replacing the binding of an existing workspace). `--input` (0.4.0+) passes the template's text inputs (replacing those of an existing workspace); `--input-file` reads `NAME=value` lines or a JSON object. `--lifetime session`: the workspace is discarded when the session ends (`workspaces close` or the idle timeout), and the key then opens a new workspace. `--mode file-first` (0.5.0+) opens a [file-first workspace](#file-first-workspaces); the default is processful for a new key and the stored mode for an existing one. `--allocation-mode elastic` (0.8.0+): [elastic memory](#elastic-memory-080). |
712
751
  | `workspaces list [--state S] [--prefix P] [--lifetime persistent\|session\|any] [--purpose standard\|template_draft\|template_test\|any] [--include-deleted] [--all] [--limit N] [--cursor C]` | One page, or every page with `--all`. The next cursor is printed on stderr. By default only persistent standard workspaces are listed. A file-first workspace's state reads `running (file-first)` (0.5.0+). |
@@ -941,6 +980,7 @@ without waking it (the state at suspension); `files search` then notes it on std
941
980
  is still queued after 120000 ms`). The operation continues server side:
942
981
  `shard operations wait <id>` keeps waiting. Without either (0.16.0+), a resume queued for capacity is waited for
943
982
  until its deadline, its place shown on stderr (see [Start deadlines](#start-deadlines)).
983
+ - Admission queues (0.28.0+, SDK 0.29.0): an open keeps its body and Idempotency-Key while waiting, and stderr says `queued for admission; retrying in 2 s`. Each wait honors `Retry-After` within the SDK admission timeout (default 2 minutes).
944
984
  - A call refused while the workspace's host makes room to wake it (503 `host_capacity`) or while every workspace the
945
985
  plan lets work at once is busy (429 `quota_exceeded`) did not run: `shard` sends it again after each `Retry-After`,
946
986
  for up to 2 minutes (0.16.0+), and stderr says `waiting for room on the workspace's host (position 2)` once.
@@ -1024,7 +1064,8 @@ $ shard ws resize acme/demo --elastic --held 1024 # switch modes live
1024
1064
  Memory changes live, and disks grow online. A suspended workspace gets its new size when it resumes, before its first
1025
1065
  call. CPU changes live within the vCPUs the workspace booted with; a larger CPU size applies at the next start. Each
1026
1066
  resource says when it applies (`now`, `on resume` or `next start`), and the new caps are stored, so every later start
1027
- uses them. `--json` prints the result with `applies_at` per resource and the stored `caps`.
1067
+ uses them. `--json` prints the result with `applies_at` per resource and `caps`. A non-null `caps.disk_gib` is bounded
1068
+ by the admitted plan and template ceiling and the acknowledged disk size. `disk.requested_gib` retains the resize request.
1028
1069
 
1029
1070
  ## Burst execution (0.8.0+)
1030
1071
 
@@ -1506,8 +1547,8 @@ machine on its next use (0.20.0+).
1506
1547
  Skills, commands, agents, output styles, memories and `CLAUDE.md` / `AGENTS.md` lines that Claude or Codex saves in a
1507
1548
  cloud conversation come back to this computer by themselves, seconds after the turn ends, and into your saved
1508
1549
  machine too (0.20.0+). A file you changed here at the same time keeps your version, with the cloud's next to it
1509
- (`CLAUDE.cloud.md`); a deleted one goes to the Trash. Project memory follows the project both ways. The menu bar says
1510
- what arrived in one line, and `agent-config-return.jsonl` in the config directory lists every change.
1550
+ (`CLAUDE.cloud.md`); a deleted one goes to the Trash. Project memory follows the project both ways. The Shardflux app
1551
+ says what arrived in one line, and `agent-config-return.jsonl` in the config directory lists every change.
1511
1552
  `shard machine save --wait` and `shard template save --wait` return once the new version is ready (0.13.3+).
1512
1553
  A version larger than the plan's workspace disk names its size and the disk, with `retryable: false` and a hint: delete
1513
1554
  what the VM does not need, then save again, or move to a plan with a larger disk (`shard billing plans`); `--json`
@@ -1524,7 +1565,7 @@ see the [settings and billing reference](https://docs.shardflux.dev/limits#cloud
1524
1565
  Claude needs one cloud sign-in per account; Codex uses your copied login.
1525
1566
 
1526
1567
  Import project secrets from hsec, 1Password, Bitwarden or Keychain. Approve browser fills from the attached CLI or
1527
- menu bar; remember a selected login for unattended work with automatic relay renewal. Bound secret values are
1568
+ the Shardflux app; remember a selected login for unattended work with automatic relay renewal. Bound secret values are
1528
1569
  redacted from command output and saved logs.
1529
1570
 
1530
1571
  Imported secrets: stored encrypted with AWS KMS; only this project's workspaces can load it, and every load is logged.
@@ -1576,6 +1617,22 @@ Another member's personal account can be made active only by that member.
1576
1617
  another account in a cloud VM and `shard agents accounts remove claude:2` removes one. To remove someone else's active
1577
1618
  account, make another one active first; your own you can always remove. `--json` prints the API's account list.
1578
1619
 
1620
+ From 0.28.0, `shard agents models` shows the models each active account can use, as Claude and ChatGPT list them
1621
+ for that account (the same lists Claude Code and Codex fill their pickers with): effort levels with the default
1622
+ starred, the default model, and what the plan does not include.
1623
+
1624
+ ```text
1625
+ Claude · marc@example.com (active)
1626
+ claude-opus-5-5 Opus 5.5 low medium* high xhigh max (default)
1627
+ claude-fable-5-1 Fable 5.1 low medium high* xhigh max
1628
+ claude-sonnet-5-5 Sonnet 5.5 low medium* high xhigh max
1629
+ More models
1630
+ claude-haiku-4-5-20251001 Haiku 4.5 no effort levels
1631
+ ```
1632
+
1633
+ `--account claude:2` shows another account, `--all` every account, `--refresh` asks again (lists are kept for an
1634
+ hour), and `--json` prints the API's answer. Pass an id to `shard agents new --model` (with `--effort`).
1635
+
1579
1636
  ## Conversations
1580
1637
 
1581
1638
  From 0.14.0, `shard conversations list|get|send|wait|land|move` manages project conversations. `shard c` is the short form. Conversations retain their branch and transcript as their VM binding changes.
@@ -1623,6 +1680,24 @@ Conversation JSON includes `join_mode` and the worktree used by reviewers and wo
1623
1680
 
1624
1681
  `shard conversations resume <id>` continues a saved conversation in a fresh VM under the same identity (0.14.0+). `shard ./ --resume` uses this same path. `shard conversations reader <project-id>` opens a small read-only workspace for saved branches and transcripts; the Mac transcript mirror opens it automatically when no project VM is live. Adaptive idle reclaims the reader.
1625
1682
 
1683
+ Your inbox is the same on every device (0.28.0+): `shard conversations archive <id...>` archives conversations from
1684
+ your own inbox, `shard conversations unarchive <id...>` brings them back, and `shard conversations seen <id...>` records
1685
+ that you opened them now, so a result that finished before then is no longer new to you in the Shardflux app or any
1686
+ other client. Name one conversation or many in one command. Only your view changes: the conversations, their agents
1687
+ and computers carry on, and everyone else keeps their own inbox. `--json` prints the API's answer, `{data, skipped}`:
1688
+ the conversations with your `seen_at` and `dismissed_at`, and the ids not found. `shard c get --json` and
1689
+ `shard c list --json` carry the same two fields.
1690
+
1691
+ ```sh
1692
+ shard c archive conv_k3m5q7s2u4w6y3b5d7f2h4j6ln conv_a7k2m4q6s3t5v7x2z4b6d3f5h7
1693
+ # Archived conv_k3m5q7s2u4w6y3b5d7f2h4j6ln Fix login
1694
+ # Archived conv_a7k2m4q6s3t5v7x2z4b6d3f5h7 Upgrade the test runner
1695
+ shard c unarchive conv_a7k2m4q6s3t5v7x2z4b6d3f5h7
1696
+ # Unarchived conv_a7k2m4q6s3t5v7x2z4b6d3f5h7 Upgrade the test runner
1697
+ shard c seen conv_k3m5q7s2u4w6y3b5d7f2h4j6ln
1698
+ # Marked seen conv_k3m5q7s2u4w6y3b5d7f2h4j6ln Fix login
1699
+ ```
1700
+
1626
1701
  `shard conversations delete <id> --yes` (0.25.0+) deletes a conversation everywhere at once: its agent stops, its
1627
1702
  computer is deleted (a computer other conversations share stays for them), and its messages, transcript and branch go
1628
1703
  with it, on every device. From then on it leaves every list and reads not found; `shard c feed` shows it once as
@@ -1634,8 +1709,73 @@ shard c delete conv_k3m5q7s2u4w6y3b5d7f2h4j6ln --yes
1634
1709
  # Deleted: conv_k3m5q7s2u4w6y3b5d7f2h4j6ln
1635
1710
  ```
1636
1711
 
1712
+ ### Your orchestrator (0.28.0+)
1713
+
1714
+ `shard orchestrator say` passes your words to the API as one input, without cutting the final instruction.
1715
+
1716
+ Your orchestrator is your own agent on top of every project, on its own Shardflux computer and the same on every
1717
+ device. `shard orchestrator say` sends it your exact words and answers at once with the input and its place in line;
1718
+ every input is handled in parallel by its own thread, which answers it, puts tasks on the board, asks you something or
1719
+ adds it to an input in flight. `--wait` follows it and prints what it became:
1720
+
1721
+ ```sh
1722
+ shard orchestrator say --wait Lets check on our language model training progress
1723
+ # Training is 73% done, on pace to finish at 16:40
1724
+ # Moved
1725
+ # - Loss is down to 1.84: from 2.31 at step 5,000 (14:02)
1726
+ # - Checkpoint saved: at step 7,000
1727
+ # Still open
1728
+ # - Eval has not run: it starts after the last checkpoint
1729
+ # media: loss-curve.png (image, 1200×800, 84.0 KB)
1730
+ # Sources: train.log (~/code/lm-train/train.log), wandb.ai (https://wandb.ai/acme/lm)
1731
+ # Follow-ups: Check again in an hour
1732
+ shard orchestrator say --task task_h7g4d7tqyv2pz3a2npyo4rpgzq use postgres instead
1733
+ # in_q3vd5k2xbnwjm7e4rtyhcu6aio queued (1 in line)
1734
+ shard orchestrator list
1735
+ # in_q3vd5k2xbnwjm7e4rtyhcu6aio working use postgres instead
1736
+ # in_7wcx227ovjpei4u6i47llu7w4i done Lets check on our language model training progress Training is 73% done, on pace to finish at 16:40
1737
+ ```
1738
+
1739
+ The answer card is the verdict, then its points under the headings the orchestrator chose (a point's time in your
1740
+ local time; an answer written as plain facts prints its facts), then a media line for each picture, video or file it
1741
+ shows (an image with its width×height once measured). Each is a file on the project drive: `--json` has its
1742
+ `file.path` and `file.sha256`, and `shard drive get <path> --sha256 <sha256> -o <file>` saves it. `--task`, `--report`, `--needs-you`, `--input`
1743
+ and `--conversation` point at the row your words are about. `--wait` stops when the input is done (its answer card and
1744
+ the tasks it created), merged (the input it was added to), waiting
1745
+ (the line it waits on; a question names the `shard needs-you answer oq_… --text <answer>` that answers it) or failed
1746
+ (exit 6; `shard orchestrator retry <input-id>` sends it again); `--timeout` (default 10m) stops following with exit 5
1747
+ while the input goes on. `shard orchestrator list` shows your recent inputs newest first (`--all` adds the ones you
1748
+ dismissed with `shard orchestrator dismiss`); `shard orchestrator restore <input-id>` (0.28.0+) brings one back on every
1749
+ device. Signed in, they reach your orchestrator (`--org <id|slug>` when you belong
1750
+ to several); with `SHARDFLUX_API_KEY` set, the orchestrator of the person who created that key. `--json` prints the
1751
+ API's objects (`{input}`, `{inputs, cursor}`).
1752
+
1753
+ Device helper recovery (0.28.0+): projects register independently and report when a sign-in needs attention. A new
1754
+ sign-in on this computer (a new API key from `shard setup`, another account) gets this computer a new device id by
1755
+ itself and registers again at once. See the [error reference](https://docs.shardflux.dev/reference/errors) for recovery.
1756
+
1757
+ When your orchestrator needs your computer (the tail of `~/code/lm-train/train.log`, say), the device helper asks you
1758
+ first with the exact command and folder, **Allow once** or **Deny**, and runs it in your home folder or the `~/`
1759
+ folder it names (0.28.0+). Each of these commands asks; none runs under an Always grant, unless you let your agents
1760
+ run things without asking.
1761
+
1762
+ **Your agents on this computer (0.28.0+).** Choose once how this computer answers your own agents:
1763
+
1764
+ | `shard device approvals` | Your agents |
1765
+ |---|---|
1766
+ | `auto` | Allow everything: commands, files, ports and folders run without asking |
1767
+ | `read` | Allow reading: folder listings and files copied to a conversation run; anything that changes this computer asks |
1768
+ | `ask` | Ask every time |
1769
+
1770
+ The first request asks which you want (the Shardflux app's prompt, or one line from `shard` with both commands) and
1771
+ runs under your choice; the app's Settings and `shard device approvals` change it any time. A teammate's request
1772
+ always asks. `shard device approvals` lists what ran without asking (`--json` for `recent`).
1773
+
1637
1774
  ### Route input and ask about your work (0.25.0+)
1638
1775
 
1776
+ `shard route` and `shard ask` are deprecated (0.28.0); use `shard orchestrator say` (each prints a one-line notice on
1777
+ stderr).
1778
+
1639
1779
  `shard route` reads a line of input the way the board's input bar does: which project it belongs to (or your home),
1640
1780
  whether it is a new task, a question or a steer for an open task, and each task in your own words when it asks for
1641
1781
  several. `shard ask` answers a quick question about your work from the board, printing the answer as it is written.
@@ -1711,14 +1851,20 @@ shard projects sync list # selected projects and their state
1711
1851
  shard projects sync pause ~/code/web # stop preparing it (remove: forget it)
1712
1852
  ```
1713
1853
 
1714
- The device helper (started by the menu bar or the Linux app) prepares each selected project in a short-lived VM: it
1854
+ The device helper (started by the Shardflux app, and on Linux by its systemd service) prepares each selected project
1855
+ in a short-lived VM: it
1715
1856
  puts the project's current state in the project cache, and when its dependency files change, installs them and saves
1716
1857
  the project template. Conversations then start without sending the project, with dependencies installed. Only the
1717
- projects you add are prepared; onboarding and Settings → Projects in both desktop apps choose them too.
1858
+ projects you add are prepared; onboarding (**Sync projects**) and Settings → Projects in the Shardflux app choose them
1859
+ too.
1718
1860
 
1719
- ### Menu bar conversation shortcut (0.15.0+)
1861
+ ### Launcher (0.15.0+)
1720
1862
 
1721
- The macOS menu bar's **New conversation** action (menu bar 0.3.0+) opens the same launcher as **Option-Shift-Space**. It requires a task and project, remembers Claude/Codex, and invokes the commands below. Configure the hotkey in the macOS Settings window (⌘,), with conflict detection and a fallback.
1863
+ **New conversation** in the Shardflux app's menu opens the same launcher as **⌥⇧Space** (**Alt+Shift+Space** on
1864
+ Ubuntu; a GNOME keybinding on Wayland), in the project open in the app in front (app 0.9.0+). It starts the
1865
+ conversation where your conversations open (Settings → Agents → **Open conversations in**), with a card near the top
1866
+ of the screen that follows each start (**Show all N launches**); change the shortcut, **Detect my project** and the
1867
+ panel's position in Settings → Launcher. From a terminal:
1722
1868
 
1723
1869
  ```sh
1724
1870
  shard agents new --app claude --path ./ --prompt "Review the billing changes" --json
@@ -1772,7 +1918,9 @@ branch: `Landed in ~/code/best-todo · 3f2a1c9`.
1772
1918
  Later tasks to keep, oldest first. `shard needs-you answer <id>` answers any of them: `allow`, `always` (also adds the
1773
1919
  always-allow rule for the project; `--everywhere` for every project) or `deny` for a permission request, `--pick` for an
1774
1920
  agent's question in one, `--text` for a question, `land` (as `shard task land`), `keep` or `discard` for finished work, and `--keep <task-id>`
1775
- (or `keep`, `discard`) for Later tasks. The agent goes on as soon as you answer.
1921
+ (or `keep`, `discard`) for Later tasks. The agent goes on as soon as you answer. Your orchestrator's questions are
1922
+ `oq_…` items (`--text`), and what it asked your computer while it was offline waits as a `dev_…` item ("Waiting for
1923
+ your computer: list ~/code"): it runs when your computer is back, and `cancel` drops it (0.28.0+).
1776
1924
 
1777
1925
  **Approvals.** The approval mode answers your agents' permission requests before they reach you: `ask` sends every one
1778
1926
  to you, `routine` (the default) approves tests, builds, reads and installs, `trusted` approves everything except
@@ -1795,7 +1943,7 @@ Explicit `agents new --in terminal`, `--in t3`, and `--like` launches keep their
1795
1943
 
1796
1944
  Save progress (0.22.0+): Machine and template saves show source size and an estimated duration, then queued/build state and phase updates immediately. With `--json`, progress events go to stderr and the final stdout document includes `preflight` and `phases`. Failure and timeout output retain the latest counters and `details.last_progress`, with the build id and recovery action. If an older API cannot expose the build, JSON stderr emits `save_started` with the version/build id and leaves the phase unknown. Missing final host reports preserve the last observed progress.
1797
1945
 
1798
- Desktop launch cards (0.22.0+): the bundled desktop apps clear and close the launcher on submission, then show each pending start in a layered card stack near the top of the display. **Show all launches** expands individual statuses and recovery.
1946
+ Desktop launch cards (0.22.0+): the Shardflux app clears and closes the launcher on submission, then shows each pending start as a card near the top of the display. **Show all N launches** expands their statuses and recovery.
1799
1947
 
1800
1948
 
1801
1949
  ### Pending execution cancellation (0.23.0+)
@@ -1829,7 +1977,7 @@ shard c list --org acme --state needs_you
1829
1977
  shard c feed --org acme --json
1830
1978
  ```
1831
1979
 
1832
- `shard conversations list --all` reads every page, keeping the selected project, state and parent filters. `--json` returns `data` and `nextCursor`. Linux desktop 0.1.11+ reads all conversation and computer pages and shows the selected project key’s organization, usage, spend and connector status in Settings.
1980
+ `shard conversations list --all` reads every page, keeping the selected project, state and parent filters. `--json` returns `data` and `nextCursor`.
1833
1981
 
1834
1982
  ## Project drive (0.25.0+)
1835
1983
 
@@ -1866,6 +2014,32 @@ shard drive rm tasks/t_ab12/notes.md
1866
2014
  - The drive is the API key's project, or `--project <id>`. Signed in (`shard auth login`), `--project` takes any of
1867
2015
  your projects by id or slug, and without an API key the drive is your default project's.
1868
2016
 
2017
+ ## Your brain (0.28.0+)
2018
+
2019
+ `shard brain` reads your brain: your archive in an organization, kept by your orchestrator. Every answer it publishes is
2020
+ filed as `reports/<YYYY-MM-DD>/<folder>/report.md` with the answer's media next to it (image thumbnails under
2021
+ `.thumbs/`), with its own notes and files and an `index.md` of everything, newest first. Your orchestrator writes it;
2022
+ you read it from any device, with every computer asleep. Paths are relative to the brain's root, the names `~/brain`
2023
+ shows on your orchestrator's computer.
2024
+
2025
+ ```sh
2026
+ shard brain get index.md
2027
+ shard brain ls reports/2026-10-17/
2028
+ # SIZE SAVED TYPE PATH
2029
+ # 195.3 KB 2026-10-17 09:12:40Z image/png reports/2026-10-17/training-progress-ab12cd34/loss.png
2030
+ # 1.2 KB 2026-10-17 09:12:41Z text/markdown reports/2026-10-17/training-progress-ab12cd34/report.md
2031
+ shard brain get reports/2026-10-17/training-progress-ab12cd34/report.md
2032
+ shard brain get reports/2026-10-17/training-progress-ab12cd34/loss.png -o loss.png
2033
+ ```
2034
+
2035
+ - `ls [prefix]` lists the current files by path, 200 to a page (`--limit` up to 1000, `--cursor`, `--all`); `--json`
2036
+ returns `data` (each file with its `sha256`), `next_cursor` and the brain's `version`, which moves whenever anything
2037
+ in it changes.
2038
+ - `get` writes the bytes to standard output, or to a file with `-o`, once they match their SHA-256; `--sha256` reads
2039
+ exactly that version, and `--json` returns `content_base64` with `sha256`, `size` and `content_type`.
2040
+ - Signed in, it is your brain in your saved organization (`shard orgs use`), else your only one, or `--org <id|slug>`;
2041
+ with `SHARDFLUX_API_KEY` set, the brain of the person who created that key.
2042
+
1869
2043
  ## Model template (0.25.0+)
1870
2044
 
1871
2045
  `shard models` shows which harness, model and effort each role of a task runs with, from the Claude and Codex accounts
@@ -1910,3 +2084,5 @@ shard volumes detach --machine datasets
1910
2084
  ```
1911
2085
 
1912
2086
  Defaults mount in new and running conversations. Removal waits for current work to finish and preserves manual attachments. Add `--json` to read propagation results.
2087
+
2088
+ Bare `shard` in a coding-agent shell or without a TTY returns its setup guide using locally saved sign-in and API-key state.
@@ -1,5 +1,5 @@
1
- import { setupGuide } from './agent-setup.js';
2
- import type { Ctx, Handler } from './commands.js';
1
+ export { agentSetupGuide } from './agent-setup.js';
2
+ import type { Handler } from './commands.js';
3
3
  export declare const DEFAULT_API_URL = "https://api.shardflux.dev";
4
4
  /** What `shard setup` gave a key before 0.15.1: every tool but `computer`. Such a saved key is replaced with a full one. */
5
5
  export declare function outdatedDefaultKey(permissions: readonly string[]): boolean;
@@ -18,6 +18,4 @@ export declare function exportLine(shell: ShellKind, name: string, value: string
18
18
  export declare function parseTime(text: string, option: string, now?: number): string;
19
19
  /** A spend cap in dollars ("9", "9.5", "9.50", "$9") as minor units (cents); at most two decimals. */
20
20
  export declare function dollarsToMinor(text: string, what: string): number;
21
- /** The setup guide for this computer: whether a session and an API key are saved (no network call). */
22
- export declare function agentSetupGuide(ctx: Ctx): ReturnType<typeof setupGuide>;
23
21
  export declare const ACCOUNT_HANDLERS: Record<string, Handler>;
@@ -21,7 +21,8 @@ import { API_KEY_TOOL_PERMISSIONS, CheckoutTimeoutError, Shardflux, ShardfluxAcc
21
21
  import { CLI_VERSION, UUID, parseDuration, parsePositiveInt } from "./args.js";
22
22
  import { openUrl } from "./browser.js";
23
23
  import { defaultClientName, startDeviceAuthorization, waitForDeviceSession } from "./browser-login.js";
24
- import { setupGuide, setupGuideText } from "./agent-setup.js";
24
+ import { agentSetupGuide, setupGuideText } from "./agent-setup.js";
25
+ export { agentSetupGuide } from "./agent-setup.js";
25
26
  import { allOrgs, allProjects, byRef, choices, findOrg, gone, keyOrganizationWarning, keyScope, resolveOrg, resolveProject, staleDefaultOrg } from "./account-scope.js";
26
27
  import { readFileSync, rmSync } from 'node:fs';
27
28
  import { join } from 'node:path';
@@ -768,11 +769,6 @@ function wantsBrowser(ctx, values) {
768
769
  return true;
769
770
  return ctx.input.interactive && !ctx.json;
770
771
  }
771
- /** The setup guide for this computer: whether a session and an API key are saved (no network call). */
772
- export function agentSetupGuide(ctx) {
773
- const profile = ctx.store.profile(ctx.apiUrl);
774
- return setupGuide({ signedIn: ctx.sessionSource() !== null, email: profile.session?.user?.email ?? null, apiKey: profile.api_key !== undefined || Boolean(ctx.io.env.SHARDFLUX_API_KEY?.trim()) });
775
- }
776
772
  /**
777
773
  * After `orgs use` / `projects use` (0.20.2+): the defaults moved, but workspace, agent and usage commands use the API
778
774
  * key, which may act in another organization. Says so; on a terminal offers to make a key for the new default (a
@@ -6,7 +6,7 @@
6
6
  * With --json every write prints the updated `{accounts, pool}` block (the menu bar redraws from it), plus the account
7
7
  * it changed. Sign-ins run the provider's own login in a workspace, as `shard agents credentials login claude` does.
8
8
  */
9
- import type { AgentAccount, AgentAccountList, AgentAccountWindow } from '@shardflux/sdk';
9
+ import type { AgentAccount, AgentAccountList, AgentAccountModels, AgentAccountWindow } from '@shardflux/sdk';
10
10
  import type { Ctx, Handler } from './commands.js';
11
11
  /**
12
12
  * Codex names its windows primary and secondary; their length says which is the 5-hour and which the weekly one (a
@@ -31,6 +31,16 @@ export declare function formatAccounts(list: AgentAccountList, now: number): str
31
31
  export declare function formatUsage(list: AgentAccountList, now: number): string;
32
32
  /** Codex's device sign-in page, as Codex 0.160.0 prints it (test/fixtures/cloud-agents/codex-login-device-auth-0.160.0.json). */
33
33
  export declare function codexLoginUrls(output: string): string[];
34
+ /**
35
+ * `shard agents models` (0.27.0+): each account's models as its provider lists them for that account, the way Claude
36
+ * Code and Codex ask for their pickers. The default effort is starred; the harness's default model is marked.
37
+ */
38
+ export declare function formatModels(entries: Array<AgentAccountModels & {
39
+ label?: string;
40
+ active?: boolean;
41
+ }>, now: number): string;
42
+ /** `shard agents models` (no `shard models` alias: that one is the model template). */
43
+ export declare const AGENT_MODELS_HANDLERS: Record<string, Handler>;
34
44
  export declare const ACCOUNT_POOL_HANDLERS: Record<string, Handler>;
35
45
  /** The `accounts` block of `shard agents targets --json` (0.18.0+): the account list for the menu bar; null when it cannot be read. */
36
46
  export declare function targetsAccounts(ctx: Ctx): Promise<AgentAccountList | null>;
@@ -207,6 +207,54 @@ async function signIn(ctx, values, app) {
207
207
  await api.cancelSignIn(claim.sign_in_id).catch(() => undefined);
208
208
  }
209
209
  }
210
+ const REASONS = { disabled: 'turned off for this account', not_entitled: 'not included for this account', not_in_plan: 'not in this plan' };
211
+ /** "3m ago", "2h ago". */
212
+ const ago = (at, now) => { const m = Math.max(0, Math.round((now - Date.parse(at)) / 60_000)); return m < 60 ? `${m}m ago` : `${Math.round(m / 60)}h ago`; };
213
+ /**
214
+ * `shard agents models` (0.27.0+): each account's models as its provider lists them for that account, the way Claude
215
+ * Code and Codex ask for their pickers. The default effort is starred; the harness's default model is marked.
216
+ */
217
+ export function formatModels(entries, now) {
218
+ if (!entries.length)
219
+ return 'No Claude or ChatGPT/Codex account is signed in. Add one with shard agents accounts add claude|codex.\n';
220
+ const lines = [];
221
+ for (const e of entries) {
222
+ const freshness = e.source === 'builtin' ? 'the harness’s own list until the provider answers' : e.stale && e.fetched_at ? `as of ${ago(e.fetched_at, now)}` : '';
223
+ lines.push(`${PROVIDERS[e.provider]}${e.label ? ` · ${e.label}` : ''}${e.active ? ' (active)' : ''}${freshness ? ` · ${freshness}` : ''}`);
224
+ const width = Math.max(...e.models.map(m => m.id.length), 8) + 2, nameWidth = Math.max(...e.models.map(m => m.name.length), 4) + 2;
225
+ const row = (m) => ` ${m.id.padEnd(width)}${m.name.padEnd(nameWidth)}${m.available
226
+ ? `${m.efforts.map(x => x === m.default_effort ? `${x}*` : x).join(' ') || 'no effort levels'}${m.id === e.default_model ? ' (default)' : ''}`
227
+ : `unavailable: ${m.reason_text ?? (m.reason ? REASONS[m.reason] : 'not offered')}`}`;
228
+ const main = e.models.filter(m => m.section === 'main'), more = e.models.filter(m => m.section === 'more');
229
+ lines.push(...main.map(row));
230
+ if (more.length)
231
+ lines.push(' More models', ...more.map(row));
232
+ lines.push('');
233
+ }
234
+ lines.push('Start with one: shard agents new <claude|codex> --model <id> --effort <level> (* the model’s default effort).');
235
+ return `${lines.join('\n')}\n`;
236
+ }
237
+ /** `shard agents models` (no `shard models` alias: that one is the model template). */
238
+ export const AGENT_MODELS_HANDLERS = {
239
+ async 'agents models'(ctx, values) {
240
+ const api = ctx.cloud().agentAccounts;
241
+ const refresh = values.refresh === true;
242
+ if (values.account !== undefined) {
243
+ if (typeof values.account !== 'string' || !values.account.trim())
244
+ throw new UsageError('--account needs an account: its id, claude:<n>, codex:<n>, email or label.');
245
+ const account = findAccount(await api.list(), values.account.trim());
246
+ if (account.kind !== 'oauth')
247
+ throw new UsageError(`${name(account)} is an API key: it has no model list. Sign in with shard agents accounts add ${account.provider}.`);
248
+ const models = await api.models(account.id, { refresh });
249
+ out(ctx, formatModels([{ ...models, label: name(account), active: isActive(account) }], Date.now()), models);
250
+ return 0;
251
+ }
252
+ const all = await api.allModels({ provider: optionalProvider(values.provider), refresh });
253
+ const shown = values.all === true ? all.accounts : all.accounts.filter(a => a.active);
254
+ out(ctx, formatModels(shown, Date.now()), { accounts: shown });
255
+ return 0;
256
+ },
257
+ };
210
258
  export const ACCOUNT_POOL_HANDLERS = {
211
259
  async 'agents accounts'(ctx, values) {
212
260
  const list = await ctx.cloud().agentAccounts.list({ provider: optionalProvider(values.provider) });