@shardflux/cli 0.6.1 → 0.6.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,7 +1,42 @@
1
1
  # Changelog
2
2
 
3
- Every command and option the README shows is available from the version named here. Below 1.0, a minor release may
4
- break compatibility; breaking changes are marked **Breaking**.
3
+ Every command and option the README shows is available from the version named here. Breaking changes ship in minor
4
+ releases and are marked **Breaking**.
5
+
6
+ ## 0.6.2
7
+
8
+ Needs `@shardflux/sdk` 0.11.1 or later.
9
+
10
+ ### The signup trial: when it ends, and it is never for sale
11
+
12
+ New organizations can start on a trial: 60 days at Developer limits, no card. The API gives the plan in force an end
13
+ (`plan.ends_at`) and the usage period of a trial its own window (`period.source` `grant`).
14
+
15
+ - `shard billing status` shows the end: `plan trial, ends 2026-11-29 14:03:00Z, then free (trial, catalog ...)`, and
16
+ on a trial the next step is `keep these limits after the trial: shard billing upgrade developer` (a subscription
17
+ outranks the trial and ends it). A design-partner plan shows its end the same way. Plans without an end read as
18
+ before.
19
+ - `shard billing plans` lists the public plans only: the trial and the design-partner plan are granted, never bought,
20
+ and are left out (also of the purchasable plans `billing upgrade` names). `--json` still prints the API's catalog.
21
+ - `shard usage`: a trial's period reads `<start> .. <end> (the trial; then free)`, and a used-up trial allowance
22
+ `yes (the trial ends; the organization is back on free)` instead of "new opens/resumes are refused".
23
+
24
+ ### Wording: help, hints and messages say what to do, without internals (no behaviour change)
25
+
26
+ - `shard feedback` goes to the Shardflux team: `Sent to the Shardflux team (feedback <id>). Thank you.`, and the help
27
+ asks agents to also pass on what their user asks for (a capability, an option or a smoother workflow) and their
28
+ ideas. The help examples are a `template_not_found` bug report and an idea; `--error-code` shows
29
+ `e.g. template_not_found`.
30
+ - `capacity_unavailable` hint: `nothing was started; run the same command again`. A wait that times out on a queued
31
+ start says `it stays queued server side until <deadline_at> and fails with capacity_unavailable if it has not
32
+ started by then`.
33
+ - `no_execution_host`: `the execution cannot be placed right now, also after retries with the same execution id;
34
+ nothing ran. Retry`. `host_capacity`: `the workspace cannot be woken right now and the call did not run; retry in a
35
+ few seconds`.
36
+ - `host_feature_unavailable`: `files search is not available for this workspace (retrying does not help); search with
37
+ a command instead: ...` (the same for `files patch` and other calls).
38
+ - An interrupted file-first `ws exec` says `(an execution runs to completion)`; `mode_not_available` drops "yet";
39
+ `--open` no longer says "best effort"; `templates init --help` no longer names an internal document.
5
40
 
6
41
  ## 0.6.1
7
42
 
@@ -19,9 +54,9 @@ range is still exit 2 before any request: `--when-idle must be between 0s and 1h
19
54
 
20
55
  Needs `@shardflux/sdk` 0.11.0 or later.
21
56
 
22
- ### A resume that restarted processes says so (cold boot, contracts §12)
57
+ ### A resume that restarted processes says so (cold boot)
23
58
 
24
- When the platform's VM runtime changed after a suspend and no host can restore the memory snapshot, the cell resumes
59
+ After a platform runtime change, the cell resumes
25
60
  the workspace by booting its saved disk (a cold boot), automatically, also when a command wakes it. Files are as of the
26
61
  suspend; every process was restarted.
27
62
 
@@ -87,7 +122,7 @@ cell had ended the session `failed_to_start` (`working directory "app" is not a
87
122
  `overage_paused` (a payment is past due: update the payment method, `shard billing portal --open`). The exit code
88
123
  stays 1.
89
124
 
90
- ### Suspend when idle (contracts §20.6)
125
+ ### Suspend when idle
91
126
 
92
127
  - `shard workspaces suspend <id|key> --when-idle <duration>` (30s to 1h): the workspace is suspended once it has been
93
128
  idle that long, counted from the later of its last work and the request (suspend when idle, for the end of an agent
@@ -95,11 +130,11 @@ cell had ended the session `failed_to_start` (`working directory "app" is not a
95
130
  `--cancel-when-idle` cancels it. `--json` prints `{workspace, operation, suspend_request}`.
96
131
  - `shard workspaces get` shows a pending request (`suspend when idle after N s idle, not before ...`).
97
132
 
98
- ## 0.5.0 (not yet published; npm `latest` is 0.4.1)
133
+ ## 0.5.0
99
134
 
100
135
  Needs `@shardflux/sdk` 0.9.0 or later.
101
136
 
102
- ### File search, patches and revisions (contracts §26)
137
+ ### File search, patches and revisions
103
138
 
104
139
  - `shard files search <id|key> <path> <pattern>`: content search under a directory (or in one file), printed
105
140
  grep-style (`path:line:column: text`, context lines as `path-line- text`). `--regex` (RE2), `-i`/`--ignore-case`,
@@ -115,20 +150,20 @@ Needs `@shardflux/sdk` 0.9.0 or later.
115
150
  - Hints for the new refusals: `revision_mismatch` (exit 1) names the current revision; `edit_not_found` and
116
151
  `edit_ambiguous` (exit 2, like any `validation_failed`) name the `--old` by position; `host_capacity` says to retry
117
152
  shortly (reads, searches and patches already retry it after `Retry-After`).
118
- - A workspace on a host that predates search and patches (contracts §26.7, while the fleet is upgraded): `files
153
+ - A workspace without search and patches: `files
119
154
  search` and `files patch` fail at once with 409 `conflict` `host_feature_unavailable` (exit 1, not retried, no
120
155
  wake), with a hint naming `details.feature` and another way to do it now (`shard ws exec <id|key> -- grep -rn ...`
121
- for a search; `files read` then `files write` for a patch); they work once the workspace runs on an upgraded host.
122
- Such a host returns no revisions (`files stat --revision` prints none).
156
+ for a search; `files read` then `files write` for a patch).
157
+ Such a workspace returns no revisions (`files stat --revision` prints none).
123
158
  - All three take `--timing`. `files patch` wakes a suspended workspace like `files write`; `files search` and
124
159
  `files stat` read its disk (below).
125
160
  - `files read|ls|stat|search` of a suspended workspace are answered from its disk without resuming it (the state at
126
161
  suspension), also on the first command after the suspend: every `shard` run fetches a new tool token, which the API
127
162
  refused for a suspended workspace, so these commands used to resume it. Needs `@shardflux/sdk` 0.9.0 and an API
128
- that issues tool tokens for suspended workspaces (contracts §26.4); with an older API they resume it as before.
163
+ that issues tool tokens for suspended workspaces; with an older API they resume it as before.
129
164
  Every other command still resumes it.
130
165
 
131
- ### File-first workspaces (contracts §29)
166
+ ### File-first workspaces
132
167
 
133
168
  - `shard workspaces open --mode processful|file-first` (`file_first` too): a file-first workspace is a versioned file
134
169
  tree with no VM between commands. It is ready at once, never suspended and always persistent. Without `--mode` a new
@@ -165,7 +200,7 @@ Needs `@shardflux/sdk` 0.9.0 or later.
165
200
  `host_restarted`, `tree_moved`, ...).
166
201
  - The error line names `execution_id=` when the error is about an execution.
167
202
 
168
- ### Waking a suspended workspace is one request (contracts §22.6)
203
+ ### Waking a suspended workspace is one request
169
204
 
170
205
  - Through `@shardflux/sdk` 0.9.0: a command on a suspended workspace (`ws exec`, `files ...`, `ws changes`) wakes it
171
206
  with one held resume that returns the running workspace and the CLI's tool token, then runs (refused call, resume,
@@ -173,10 +208,9 @@ Needs `@shardflux/sdk` 0.9.0 or later.
173
208
  - `--timing` shows the wake as one `request` phase `(held)`; a wake that runs out of time shows the hold, then the
174
209
  states it saw after it (`request 1.00 s (held) → queued …`).
175
210
  - `shard workspaces resume --wait` is one held request; its tool token is attributed to the CLI's agent label.
176
- ### The account plane (contracts §30)
211
+ ### The account plane
177
212
 
178
- Needs `@shardflux/sdk` 0.9.0 or later (`ShardfluxAccount`, `checkClientVersion`) and an API with CLI sessions
179
- (contracts §30).
213
+ Needs `@shardflux/sdk` 0.9.0 or later (`ShardfluxAccount`, `checkClientVersion`) and an API with CLI sessions.
180
214
 
181
215
  ### Everything the web app does, from a terminal (docs/progress/account-cli.md §5)
182
216
 
@@ -247,10 +281,10 @@ unchanged and still stores nothing.
247
281
  - The top help starts with the no-browser path and groups commands by the credential they use; `shard <group>`
248
282
  and `shard auth totp` (a sub-group) list their commands.
249
283
 
250
- ### Feedback straight to the founder (needs an API with POST /v1/feedback)
284
+ ### Feedback straight to the Shardflux team (needs an API with POST /v1/feedback)
251
285
 
252
286
  - `shard feedback [--category bug|confusing|missing|idea|praise|other] [--workspace W] [--request-id ID]
253
- [--error-code CODE] [--command TEXT] [--from-file F|-] <message...>` sends feedback to the Shardflux founder by
287
+ [--error-code CODE] [--command TEXT] [--from-file F|-] <message...>` sends feedback to the Shardflux team by
254
288
  email. The message is the remaining words (no quotes needed unless the shell needs them) or `--from-file` (`-`:
255
289
  standard input, for logs). It is checked before any request (1-8000 characters, a known category, the context
256
290
  bounds). The context carries `client: shard-cli/0.5.0` and, unless it is the default `cli`, the agent label as
@@ -260,8 +294,7 @@ unchanged and still stores nothing.
260
294
  continue or to email shardflux@heliosone.fi.
261
295
  - `shard --help` opens with a Feedback section, and `shard feedback --help` explains when to use each category: coding
262
296
  agents are asked to send short feedback while they work, the moment something fails, confuses or is missing, and to
263
- pass on (paraphrased, without private data) what their user is frustrated about or asked for that Shardflux could not
264
- do, telling the user they sent it.
297
+ pass on (paraphrased, without private data) what their user asks for, telling the user they sent it.
265
298
  - A failure ends with
266
299
  `feedback: shard feedback --category bug --request-id <id> --error-code <code> "<what you expected>"`; with `--json`
267
300
  the error object gains a sibling `"feedback"` field holding that command. Existing fields are unchanged. Not for
@@ -280,7 +313,7 @@ exports type-check without casts), and the CLI moves to it so `shardflux` instal
280
313
 
281
314
  Needs `@shardflux/sdk` 0.7.0 or later. New dependency: `yaml` (template.yaml).
282
315
 
283
- ### Template editor (contracts §24)
316
+ ### Template editor
284
317
 
285
318
  - `shard templates build <file> [--slug] [--display-name] [--description] [--publish] [--acknowledge PATH]... [--wait]
286
319
  [--timeout] [--timing]`: builds a template from template.yaml. Local `from` files and folders are uploaded (folders
@@ -308,13 +341,12 @@ Needs `@shardflux/sdk` 0.7.0 or later. New dependency: `yaml` (template.yaml).
308
341
 
309
342
  Needs `@shardflux/sdk` 0.6.2 or later.
310
343
 
311
- The API no longer lets a start (open, resume, fork) wait in `capacity_pending` forever: one that no host could admit
312
- 15 minutes after it began fails with `capacity_unavailable` (retryable; nothing was started, a suspended workspace
344
+ The API no longer lets a start (open, resume, fork) wait in `capacity_pending` forever: one still queued 15 minutes after it began fails with `capacity_unavailable` (retryable; nothing was started, a suspended workspace
313
345
  stays suspended).
314
346
 
315
347
  - A failed operation's error has `retryable` (the operation error's own flag): `retryable=true|false` in the error line,
316
348
  `"retryable"` in the `--json` error document, next to `details.error_code`. `details.reason` carries the operation
317
- error's reason (for `capacity_unavailable`, why no host fit, e.g. `no_ready_hosts`), printed after the message.
349
+ error's reason (for `capacity_unavailable`, e.g. `no_ready_hosts`), printed after the message.
318
350
  - A retryable failure gets a hint to retry later. Exit codes are unchanged (6 for any failed operation); `shard` does
319
351
  not retry.
320
352
  - A `--timeout` that ends while the start waits for capacity names the time it gives up (the SDK's message).
package/README.md CHANGED
@@ -8,8 +8,8 @@ invitations and keys, buy or change a plan, export data and delete an account. B
8
8
  [`@shardflux/sdk`](https://www.npmjs.com/package/@shardflux/sdk), so it gets the SDK's retries,
9
9
  idempotency keys, operation polling and tool-token handling.
10
10
 
11
- > **Early access.** Shardflux is in early access, and this CLI is below 1.0: commands and output
12
- > may still change in a minor release.
11
+ > **Compatibility.** The API is versioned (`/v1`). Breaking changes ship only in minor releases and are marked
12
+ > **Breaking** in the changelog.
13
13
 
14
14
  Requires Node.js 24 or later.
15
15
 
@@ -63,21 +63,20 @@ shard login # verify the key: organization, pr
63
63
 
64
64
  ## Feedback: agents, use this while you work
65
65
 
66
- **(0.5.0+)** `shard feedback` sends a message straight to the Shardflux founder, who reads every one. If you are a
66
+ **(0.5.0+)** `shard feedback` sends a message straight to the Shardflux team, who read every one. If you are a
67
67
  coding agent (Claude Code, Codex, Cursor, ...) driving `shard`, use it actively while you work, not once at the end.
68
68
  Send a short message the moment:
69
69
 
70
70
  - something fails unexpectedly (`--category bug`),
71
71
  - an error, doc, name or output is confusing (`--category confusing`),
72
72
  - a capability, option or template you need is missing (`--category missing`),
73
- - something is slow, or you needed a workaround,
74
- - your user complains or is frustrated about Shardflux or the workflow around it (slowness, cost or limits, confusing
75
- setup, a missing feature, a workaround): paraphrase it, with what they were trying to do,
76
- - your user asked for something Shardflux could not do, or made awkward.
73
+ - you needed a workaround,
74
+ - your user asks for a capability, an option or a smoother workflow: paraphrase it, with what they were trying to do,
75
+ - your user has an idea for how Shardflux could fit their work better.
77
76
 
78
77
  Short and frequent beats polished: what you ran, what happened, what you expected. No need to ask first, but tell your
79
78
  user you sent it. Leave out private data about the user and secrets or code they did not mean to share; paraphrase,
80
- never paste transcripts. Pass the request id and error code from the error so the founder can find the logs. A failed
79
+ never paste transcripts. Pass the request id and error code from the error so the team can find the logs. A failed
81
80
  `shard` command ends with a ready-made line to fill in:
82
81
 
83
82
  ```text
@@ -86,11 +85,11 @@ feedback: shard feedback --category bug --request-id req-2b9d4f6a8c0e4a1b3d5f7e9
86
85
  ```
87
86
 
88
87
  ```sh
89
- shard feedback --category bug --request-id req-5c7744b2bb5c457b86b76101 --error-code capacity_unavailable \
90
- "ws open failed twice in 10 min; expected a start within a minute"
91
- shard feedback --category confusing \
92
- "user was frustrated that ws open needs a template slug they had to look up; they expected a default"
93
- shard feedback --category missing no way to copy a file between two workspaces, piped files read into files write
88
+ shard feedback --category bug --request-id req-5c7744b2bb5c457b86b76101 --error-code template_not_found \
89
+ "ws open --template python-node failed; expected a suggestion of the closest slug"
90
+ shard feedback --category idea \
91
+ "user would like shard ws open to remember the last template they used"
92
+ shard feedback --category praise forking a workspace with its dev server still running is exactly what we needed
94
93
  npm test 2>&1 | tail -n 60 | shard feedback --category bug --workspace acme/demo --from-file -
95
94
  ```
96
95
 
@@ -131,7 +130,7 @@ terminal, `--json` on every command, secrets only on standard input, and documen
131
130
  authentication; valid 10 minutes). Without a terminal `shard` does not ask: the command fails with
132
131
  `step_up_required` (exit 4) and the hint names this command.
133
132
  7. **Feedback:** send `shard feedback` as you work, the moment something fails, confuses you or is
134
- missing, or your user is frustrated with Shardflux (see [Feedback](#feedback-agents-use-this-while-you-work)).
133
+ missing, or your user asks for an improvement (see [Feedback](#feedback-agents-use-this-while-you-work)).
135
134
 
136
135
  What stays human: reading the verification email, entering a card in Stripe Checkout, and the
137
136
  authenticator app's codes.
@@ -228,7 +227,7 @@ the workspace commands instead of printing it. Revoking the saved key also remov
228
227
 
229
228
  ```sh
230
229
  shard billing plans # public: no sign-in needed
231
- shard billing status # plan, billing state, period end, pending checkout
230
+ shard billing status # plan (a trial with its end), billing state, period end, pending checkout
232
231
  shard billing upgrade <plan> [--open] [--wait] [--timeout 15m]
233
232
  shard billing portal [--open] # plan changes, payment methods, invoices, cancellation
234
233
  shard billing invoices [--all]
@@ -241,12 +240,17 @@ shard billing overage off # turn it off (always allow
241
240
 
242
241
  `billing upgrade` checks the plan against the public catalog (an unknown one lists the purchasable
243
242
  plans), starts Stripe Checkout and prints its URL: a person pays there. `--open` also opens it in the
244
- default browser (`$BROWSER`, else `xdg-open`, `open` or `start`; best effort). The API activates the
243
+ default browser (`$BROWSER`, else `xdg-open`, `open` or `start`). The API activates the
245
244
  plan only when Stripe confirms the payment, so `--wait` polls until the subscription is active (exit
246
245
  0), the checkout expires or is canceled (exit 6), or `--timeout` runs out (exit 5; the checkout stays
247
246
  open). An organization that already has a subscription changes plans in the billing portal: the
248
247
  command prints the portal URL instead (exit 0).
249
248
 
249
+ On the signup trial (60 days at Developer limits, no card), `billing status` shows when it ends and
250
+ what follows (0.6.2+): `plan trial, ends 2026-11-29 14:03:00Z, then free (trial, catalog ...)`, then
251
+ `keep these limits after the trial: shard billing upgrade developer`. A subscription outranks the
252
+ trial and ends it. The trial is granted, never bought, so `billing plans` leaves it out.
253
+
250
254
  `billing overage` shows and changes opt-in overage (owners and billing members). With it on,
251
255
  workspaces keep opening and running past the CPU-hours and RAM GiB-hours allowances, and the usage
252
256
  past them is charged on the next invoice until the charges reach the spend cap. The cap is per
@@ -261,7 +265,7 @@ already charged this period (`spend_cap_below_charges`); a plan without overage
261
265
  ```text
262
266
  $ shard billing overage on --cap 9
263
267
  Acme: overage is on, spend cap $9.00 per billing period ($1.00 to $9.00, the plan price).
264
- Rates past the allowances: $0.04 per RAM GiB-hour, $0.12 per CPU-hour, charged on the next invoice (this period: shard usage).
268
+ Rates past the allowances: $0.03 per RAM GiB-hour, $0.12 per CPU-hour, charged on the next invoice (this period: shard usage).
265
269
  Saved (policy version 1).
266
270
  ```
267
271
 
@@ -369,9 +373,7 @@ shows the status; `shard version --check` asks now (`--json`: `{"cli", "sdk", "u
369
373
  | `login`, `whoami` | Show the principal behind the project key (`SHARDFLUX_API_KEY`, else the saved one). |
370
374
  | `version [--check]` | Print the CLI and SDK versions and the update status (`--check` asks the API now). |
371
375
  | `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+). |
372
-
373
- | `feedback [--category C] [--workspace W] [--request-id ID] [--error-code CODE] [--command TEXT] [--from-file F\|-] <message...>` | Send feedback straight to the Shardflux founder (0.5.0+). See [Feedback](#feedback-agents-use-this-while-you-work). |
374
- | `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+). |
376
+ | `feedback [--category C] [--workspace W] [--request-id ID] [--error-code CODE] [--command TEXT] [--from-file F\|-] <message...>` | Send feedback straight to the Shardflux team (0.5.0+). See [Feedback](#feedback-agents-use-this-while-you-work). |
375
377
  | `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] [--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. |
376
378
  | `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+). |
377
379
  | `workspaces get <id\|key>` | One workspace (deleted ones included), with the startup of its template's start commands and services (0.4.0+): a failed step shows its exit code, reason and output tail. Its mode, and a file-first workspace's tree revision (0.5.0+). |
@@ -504,8 +506,8 @@ A /home/user/app/out.txt
504
506
 
505
507
  - **Exit code**: the command's own once it ran to its end: 124 if it timed out (`--timeout`), 128+N if a signal N
506
508
  killed it. An execution that `failed` (it could not run the command, e.g. `exec_failed_to_start`) or was `lost`
507
- (its host stopped answering, e.g. `lease_expired`) published nothing and exits 6. The error names the reason and
508
- says `retryable=true|false`; running it again needs a new `--execution-id`.
509
+ (see `details.reason`) published nothing and exits 6. The error names the reason and says `retryable=true|false`;
510
+ running it again needs a new `--execution-id`.
509
511
  - **Output** is printed when the command ended, not streamed: stdout and stderr byte for byte, also when they are not
510
512
  UTF-8. `--output-limit <bytes>` keeps at most that much of each (default 1 MiB, at most 16 MiB). A cut stream is
511
513
  noted on stderr.
@@ -521,13 +523,13 @@ A /home/user/app/out.txt
521
523
  with a letter or digit; default a fresh `ex-<uuid>`). The same id with the same command returns the recorded result
522
524
  (`replayed`) instead of running it twice, so a script can repeat the call safely; the same id with another command
523
525
  is refused (`execution_id_reused`). `shard` re-sends the request with the same id after a dropped connection and
524
- after `no_execution_host` (no host had room; `Retry-After`, at most 5 times), and waits within `--wake-timeout` while
525
- another execution holds the workspace (`execution_in_progress`).
526
- - **Ctrl-C**: an execution cannot be canceled. Ctrl-C stops waiting (exit 130) and prints the command that fetches the
527
- result later:
526
+ after `no_execution_host` (the execution cannot be placed right now; `Retry-After`, at most 5 times), and waits
527
+ within `--wake-timeout` while another execution holds the workspace (`execution_in_progress`).
528
+ - **Ctrl-C**: an execution runs to completion. Ctrl-C stops waiting (exit 130) and prints the command that fetches
529
+ the result later:
528
530
 
529
531
  ```text
530
- error: Interrupted; execution build-42 keeps running server side if it started (an execution cannot be canceled). [code=interrupted execution_id=build-42]
532
+ error: Interrupted; execution build-42 keeps running server side if it started (an execution runs to completion). [code=interrupted execution_id=build-42]
531
533
  hint: fetch its result later with: shard executions get acme/agent-7 build-42
532
534
  ```
533
535
  - **`shard executions get <id|key> <execution-id> [--wait D]`** (also `shard ws executions get`): prints the output and
@@ -537,9 +539,9 @@ A /home/user/app/out.txt
537
539
  without sending them (`not_supported_for_mode`, exit 1, with a hint). Only paths under `/home/user` exist
538
540
  (`outside_tree_root`). `--mode file-first` with `--lifetime session` is a usage error (exit 2), and so are
539
541
  `--execution-id`, `--output-limit` and `--if-revision` on a processful workspace.
540
- - **Opening**: reopening a key with the other mode is `mode_mismatch` (exit 1); a deployment that does not offer
541
- file-first workspaces yet answers `mode_not_available` (exit 2); a template version without layered disks
542
- `layout_unsupported` (exit 1). Each comes with a hint.
542
+ - **Opening**: reopening a key with the other mode is `mode_mismatch` (exit 1); an account without file-first
543
+ workspaces gets `mode_not_available` (exit 2); a template version without layered disks `layout_unsupported`
544
+ (exit 1). Each comes with a hint.
543
545
 
544
546
  ### Tree revisions
545
547
 
@@ -566,7 +568,7 @@ API is waited for as before).
566
568
 
567
569
  A file-first workspace (0.5.0+) is never suspended, so none of this applies to it.
568
570
 
569
- `files read|ls|stat|search` of a suspended workspace whose disk a host still holds are answered from that disk
571
+ `files read|ls|stat|search` of a suspended workspace are answered from its saved disk
570
572
  without waking it (the state at suspension); `files search` then notes it on stderr (`served_from: "disk"` with
571
573
  `--json`).
572
574
 
@@ -575,13 +577,15 @@ without waking it (the state at suspension); `files search` then notes it on std
575
577
  is still queued after 120000 ms`). The operation continues server side:
576
578
  `shard operations wait <id>` keeps waiting.
577
579
  - A resume or open that fails exits 6.
580
+ - `--no-wake` (or `SHARDFLUX_NO_WAKE=1`) turns this off. A workspace that is not running is then
581
+ refused at once (exit 1, `workspace_not_running`).
578
582
 
579
- **A resume can restart processes (0.6.0+).** A resume normally restores memory and running processes. When the
580
- platform's VM runtime changed after the suspend and no host can restore that memory snapshot, the resume boots the
581
- workspace's saved disk instead (a cold boot), automatically, also when a command wakes the workspace. The command
582
- still runs, and the files are as of the suspend, but every process was restarted, as after a reboot: start dev
583
- servers and background jobs again. `shard` then prints one line on stderr after the output (also with `--json`,
584
- except on a failure, whose stderr is only the error document), whether or not you pass `--timing`:
583
+ **Detecting a cold resume (0.6.0+).** A resume restores memory and running processes. After a platform runtime
584
+ update, a resume can boot from the saved disk instead of restoring memory (a cold boot), also when a command wakes the
585
+ workspace; check `memory_restored`. The command still runs with the files as of the suspend, and processes start
586
+ fresh, as after a reboot: start dev servers and background jobs again. `shard` then prints one line on stderr after
587
+ the output (also with `--json`, except on a failure, whose stderr is only the error document), whether or not you
588
+ pass `--timing`:
585
589
 
586
590
  ```text
587
591
  note: workspace 01a0e5a8-3edd-74ba-b489-d62b8925e342 resumed from its saved disk; running processes were restarted (runtime_changed)
@@ -603,7 +607,6 @@ shard ws suspend acme/demo --cancel-when-idle
603
607
  ```
604
608
 
605
609
  - `--when-idle 0` (0.6.1+) suspends the workspace as soon as it is idle (a few seconds after its last work).
606
-
607
610
  - The idle time counts from the later of the workspace's last work and the request.
608
611
  - A command still running, an attached stream or a keepalive postpones the suspend until the duration after it ends.
609
612
  - The next tool call on the workspace (the next turn) or a resume cancels the request. Repeating replaces it.
@@ -613,22 +616,20 @@ shard ws suspend acme/demo --cancel-when-idle
613
616
  workspace that is not running is refused with `conflict` (`not_running`, exit 1), and a file-first workspace (never
614
617
  suspended) with `not_supported_for_mode` (exit 1).
615
618
 
616
- ## Starts that wait for capacity
619
+ ## Start deadlines
617
620
 
618
- An open, resume or fork that no host can admit yet waits in `capacity_pending` for at most 15
619
- minutes. If `--timeout` ends first, the timeout error names the time it gives up. A start still
620
- pending then fails with `capacity_unavailable`: nothing was started, and a suspended
621
- workspace stays suspended. `shard` exits 6 as for any failed operation, and the error says
622
- `retryable=true` (with `--json`, `"retryable": true`) with a hint to retry later:
621
+ A queued open, resume or fork (`capacity_pending`) has a deadline 15 minutes after it was created.
622
+ If `--timeout` ends first, the timeout error names the deadline. A start still pending at the
623
+ deadline fails with `capacity_unavailable`: nothing was started, and a suspended workspace stays
624
+ suspended. `shard` exits 6 as for any failed operation, and the error says `retryable=true` (with
625
+ `--json`, `"retryable": true`) with a hint to retry:
623
626
 
624
627
  ```text
625
628
  error: Operation 01a0df37-b3a9-7a14-a3e7-11395c349c39 (open) failed: capacity_unavailable (no_ready_hosts) [code=operation_failed operation_id=01a0df37-b3a9-7a14-a3e7-11395c349c39 retryable=true]
626
- hint: no host could admit it before its deadline; nothing was started. Retry later.
629
+ hint: nothing was started; run the same command again
627
630
  ```
628
631
 
629
- `shard` does not retry it for you. A definitive failure has `retryable=false`.
630
- - `--no-wake` (or `SHARDFLUX_NO_WAKE=1`) turns this off. A workspace that is not running is then
631
- refused at once (exit 1, `workspace_not_running`).
632
+ A definitive failure has `retryable=false`.
632
633
 
633
634
  ## Usage and overage
634
635
 
@@ -640,11 +641,11 @@ amount:
640
641
  ```text
641
642
  overage accruing (usage past the allowances is charged on the next invoice)
642
643
  spend cap $9.00 (at most $9.00, the plan price)
643
- overage charges $3.00 of $9.00 (33.33%), $6.00 left; billed on the next invoice
644
+ overage charges $2.40 of $9.00 (26.67%), $6.60 left; billed on the next invoice
644
645
  cap reached 2026-09-29 15:02:46Z (projected at this period's average use)
645
646
 
646
647
  OVERAGE UNIT PAST ALLOWANCE BILLED RATE AMOUNT
647
- ram_gib_hours gib_hours 70 60 $0.04 $2.40
648
+ ram_gib_hours gib_hours 70 60 $0.03 $1.80
648
649
  cpu_hours hours 5 5 $0.12 $0.60
649
650
  ```
650
651
 
@@ -665,19 +666,18 @@ names `details.reason`, and a hint says what to do (0.5.0+):
665
666
  `--timing` (0.3.0+) says where the time of an open or a wait went. After the call, `shard` prints the lifecycle
666
667
  timing that [`@shardflux/sdk`](https://www.npmjs.com/package/@shardflux/sdk) measured (its `formatTiming()`) on
667
668
  stderr. It is printed when the call fails, times out or is interrupted too, before the error, and the exit code does
668
- not change. A slow open reads, for example:
669
+ not change. A resume reads, for example:
669
670
 
670
671
  ```text
671
- $ shard ws open acme/demo --template python-node-browser --timing
672
- Workspace acme/demo (01a0e5a8-3edd-74ba-b489-d62b8925e342) is ready.
673
- ...
674
- open 34.18 s, succeeded (workspace 01a0e5a8-3edd-74ba-b489-d62b8925e342, operation 01a0e5a8-3ef0-7ecb-975e-dff2d5ca6e33)
675
- client: request 20.01 s (held) → capacity_pending 13.52 s (no_ready_host) → running 0.59 s → view 42 ms ∥ token 61 ms
676
- server: queued 33.40 s, ran 0.62 s, total 34.02 s; start warm, boot to ready 79 ms
677
- outside the server: 0.16 s
672
+ $ shard ws resume acme/demo --wait --timing
673
+ Resuming acme/demo (01a0ead6-92e5-7d19-ab7a-f565bf4676cb): operation 01a0ead6-bd61-737a-ae88-66e2d01a6e25 resume succeeded
674
+ resume 413 ms, succeeded (workspace 01a0ead6-92e5-7d19-ab7a-f565bf4676cb, operation 01a0ead6-bd61-737a-ae88-66e2d01a6e25)
675
+ client: request 218 ms → queued 195 ms
676
+ server: queued 51 ms, ran 290 ms, total 341 ms; resume from local_cache, boot to ready 211 ms, host disk 0 ms, load 6 ms, ready 62 ms, total 211 ms, after_restore 36 ms
677
+ outside the server: 72 ms
678
678
  ```
679
679
 
680
- Here the time went to waiting for a host with capacity; the network and the VM start were fast.
680
+ This resume brought the workspace back from its host's local cache, memory and running processes included, in 341 ms on the server and 413 ms end to end.
681
681
 
682
682
  - **client**: phases on your clock. `request` is the API call; `(held)` means the API held it until the workspace
683
683
  was ready, up to 20 s at a time. Then come the operation states seen while waiting, with the server's reason, and
@@ -708,7 +708,7 @@ With `--json`, stdout carries the timing as a `timing` field of the command's JS
708
708
  not say), `boot_to_ready_ms`, ...) and `outside_server_ms`. It is `null` when the command made no lifecycle call. On a failure the error document on stderr
709
709
  carries it: `{"error": {...}, "timing": {...}}`.
710
710
 
711
- `shard` does not stream progress while it waits. For live events, use the SDK's `onProgress`.
711
+ For live progress events, use the SDK's `onProgress`.
712
712
 
713
713
  ## Secrets
714
714
 
@@ -787,16 +787,15 @@ printf %s "$NEW_KEY" | shard secrets rotate OPENAI_API_KEY
787
787
  | 2 | usage error: bad arguments, or input the API rejected as `validation_failed` |
788
788
  | 3 | not found: workspace, operation or route |
789
789
  | 4 | authentication or authorization: missing, malformed, revoked or insufficient key or session; `step_up_required` (run `shard auth step-up`), `mfa_required` (a sign-in waiting for its code), `email_unverified`, `invalid_credentials` |
790
- | 5 | timeout: waiting gave up (`--timeout`, or `--wake-timeout` while waking a workspace); the operation continues server side (`shard operations wait <id>`), a start waiting for capacity for at most 15 minutes. `executions get` (0.5.0+): the execution is still queued or running. `billing upgrade --wait` (0.5.0+): nobody paid in time (the checkout stays open) |
791
- | 6 | the awaited operation ended `failed` or `canceled` (also a resume or open that failed while waking a workspace). `retryable=true` in the error means it may succeed later (`capacity_unavailable`). Also a file-first execution that ended `failed` or `lost` (0.5.0+): nothing was published. `exec` (0.5.1+): the command could not start (`exec_failed_to_start`). `billing upgrade --wait` (0.5.0+): the checkout expired or was canceled (`checkout_ended`) |
792
- | 130 | interrupted (Ctrl-C). Waits stop at once, and exec sends a cancel to the session. A file-first execution cannot be canceled: it keeps running, and the error names the `shard executions get` command for its result. |
790
+ | 5 | timeout: waiting gave up (`--timeout`, or `--wake-timeout` while waking a workspace); the operation continues server side (`shard operations wait <id>`), up to a queued start's 15-minute deadline. `executions get` (0.5.0+): the execution is still queued or running. `billing upgrade --wait` (0.5.0+): nobody paid in time (the checkout stays open) |
791
+ | 6 | the awaited operation ended `failed` or `canceled` (also a resume or open that failed while waking a workspace). `retryable=true` in the error means a retry can succeed (`capacity_unavailable`). Also a file-first execution that ended `failed` or `lost` (0.5.0+): nothing was published. `exec` (0.5.1+): the command could not start (`exec_failed_to_start`). `billing upgrade --wait` (0.5.0+): the checkout expired or was canceled (`checkout_ended`) |
792
+ | 130 | interrupted (Ctrl-C). Waits stop at once, and exec sends a cancel to the session. A file-first execution runs to completion, and the error names the `shard executions get` command for its result. |
793
793
  | exec, executions get | the command's own code: 124 if it timed out, 128+N if killed by signal N. Failures before the command ran use the codes above; use `--json` to tell them apart. |
794
794
 
795
795
  ## HTTP connections
796
796
 
797
- `shard` opens a fresh HTTP connection for every request (`Connection: close`). On some Node.js
798
- releases a request sent on a reused keep-alive connection can stall until the request timeout.
799
- Set `SHARDFLUX_HTTP_KEEPALIVE=1` to reuse connections instead.
797
+ By default every request uses a fresh connection (`Connection: close`); `SHARDFLUX_HTTP_KEEPALIVE=1` reuses
798
+ connections.
800
799
 
801
800
  ## License
802
801
 
@@ -16,7 +16,7 @@ const PAGE = {
16
16
  limit: { type: 'string', value: '<n>', description: 'Page size.' },
17
17
  cursor: { type: 'string', value: '<cursor>', description: 'Continue from a previous page.' },
18
18
  };
19
- const OPEN = { open: { type: 'boolean', description: 'Also open the page in the default browser (best effort; the URL is printed either way).' } };
19
+ const OPEN = { open: { type: 'boolean', description: 'Also open the page in the default browser (the URL is printed either way).' } };
20
20
  const AUDIT_FILTERS = {
21
21
  source: { type: 'string', value: '<app|cell_tool>', description: 'API events (app) or workspace tool calls (cell_tool).' },
22
22
  'actor-type': { type: 'string', value: '<type>', description: 'user, api_key, system, operator or anonymous.' },
@@ -18,7 +18,7 @@ import { UUID, parseDuration, parsePositiveInt } from "./args.js";
18
18
  import { openUrl } from "./browser.js";
19
19
  import { fileExists, oneOf, out, parseSlugVersion, principal, readInput, resolveWorkspace, str, strs, waitTimeout } from "./commands.js";
20
20
  import { AuthConfigError, CheckoutEndedError, InterruptedError, MfaPendingError, NotFoundError, UsageError } from "./errors.js";
21
- import { apiKeyTable, attachmentTable, auditTable, authSessionTable, billingStatusText, dataExportText, egressVersionTable, invitationTable, invoiceTable, kv, memberTable, money, orgTable, overagePolicyText, planTable, projectEgressText, projectTable, table, time, toolsText, volumeDetail, volumeTable, workspaceEgressText, WORKSPACE_HEADERS, workspaceRow, } from "./format.js";
21
+ import { apiKeyTable, attachmentTable, auditTable, authSessionTable, billingStatusText, dataExportText, egressVersionTable, invitationTable, invoiceTable, isGrantPlan, kv, memberTable, money, orgTable, overagePolicyText, planTable, projectEgressText, projectTable, table, time, toolsText, volumeDetail, volumeTable, workspaceEgressText, WORKSPACE_HEADERS, workspaceRow, } from "./format.js";
22
22
  export const DEFAULT_API_URL = 'https://api.shardflux.dev';
23
23
  const TOTP = /^\d{6}$/;
24
24
  const ROLES = ['owner', 'admin', 'member', 'billing'];
@@ -418,7 +418,7 @@ export function dollarsToMinor(text, what) {
418
418
  return Number(m[1]) * 100 + Number((m[2] ?? '').padEnd(2, '0'));
419
419
  }
420
420
  function purchasablePlans(catalog) {
421
- return catalog.plans.filter((p) => p.prices.some((x) => x.purchasable)).map((p) => p.plan_key);
421
+ return catalog.plans.filter((p) => !isGrantPlan(p) && p.prices.some((x) => x.purchasable)).map((p) => p.plan_key);
422
422
  }
423
423
  function priceText(catalog, planKey) {
424
424
  const plan = catalog.plans.find((p) => p.plan_key === planKey);
@@ -1280,7 +1280,14 @@ export const ACCOUNT_HANDLERS = {
1280
1280
  const account = ctx.account();
1281
1281
  const org = await resolveOrg(ctx, account, values);
1282
1282
  const s = await account.billing.subscription(org.id);
1283
- const next = s.subscription ? 'manage it: shard billing portal' : s.purchase_available ? 'buy a plan: shard billing plans, then shard billing upgrade <plan>' : '';
1283
+ // The trial has Developer limits: Developer keeps them (a subscription outranks the trial and ends it).
1284
+ const next = s.subscription
1285
+ ? 'manage it: shard billing portal'
1286
+ : s.purchase_available
1287
+ ? s.plan?.plan_key === 'trial'
1288
+ ? 'keep these limits after the trial: shard billing upgrade developer'
1289
+ : 'buy a plan: shard billing plans, then shard billing upgrade <plan>'
1290
+ : '';
1284
1291
  out(ctx, `${billingStatusText(s, org)}${next ? `${next}\n` : ''}`, s);
1285
1292
  return 0;
1286
1293
  },
package/dist/args.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export declare const CLI_VERSION = "0.6.1";
1
+ export declare const CLI_VERSION = "0.6.2";
2
2
  export interface OptionSpec {
3
3
  type: 'string' | 'boolean';
4
4
  short?: string;
package/dist/args.js CHANGED
@@ -12,7 +12,7 @@
12
12
  import { parseArgs } from 'node:util';
13
13
  import { ACCOUNT_COMMANDS } from "./account-args.js";
14
14
  import { UsageError } from "./errors.js";
15
- export const CLI_VERSION = '0.6.1';
15
+ export const CLI_VERSION = '0.6.2';
16
16
  export const GLOBAL_OPTIONS = {
17
17
  'api-url': { type: 'string', value: '<url>', description: 'API base URL (default $SHARDFLUX_API_URL, else https://api.shardflux.dev).' },
18
18
  json: { type: 'boolean', description: 'Print machine-readable JSON on stdout (errors as JSON on stderr).' },
@@ -38,7 +38,7 @@ const TIMING = {
38
38
  const WAKE_TIMING = {
39
39
  timing: { type: 'boolean', description: 'Print where the time went when the command had to wake the workspace (stderr; with --json a "timing" field, null without a wake).' },
40
40
  };
41
- /** `--if-revision` (0.5.0) of the mutating files commands: the tree revision a file-first write applies to (contracts §29.8). */
41
+ /** `--if-revision` (0.5.0) of the mutating files commands: the tree revision a file-first write applies to. */
42
42
  const IF_REVISION = {
43
43
  'if-revision': {
44
44
  type: 'string',
@@ -58,7 +58,7 @@ const PAGE = {
58
58
  limit: { type: 'string', value: '<n>', description: 'Page size.' },
59
59
  cursor: { type: 'string', value: '<cursor>', description: 'Continue from a previous page.' },
60
60
  };
61
- /** Options of a version produced by save-as-template or a draft publish (contracts §19.8). */
61
+ /** Options of a version produced by save-as-template or a draft publish. */
62
62
  const SAVE = {
63
63
  description: { type: 'string', value: '<text>', description: 'Version description (default: the source version’s).' },
64
64
  'default-lifetime': { type: 'string', value: '<persistent|session>', description: 'Default lifetime of workspaces opened from the new version.' },
@@ -68,7 +68,7 @@ const SAVE = {
68
68
  wait: { type: 'boolean', description: 'Wait until the build is published and registered (or fails).' },
69
69
  timeout: { type: 'string', value: '<duration>', description: 'Give up waiting after this long (default 30m). The build continues server side.' },
70
70
  };
71
- /** Open-time text inputs of a template version (0.4.0; contracts §24.3). */
71
+ /** Open-time text inputs of a template version (0.4.0). */
72
72
  const INPUTS = {
73
73
  input: {
74
74
  type: 'string',
@@ -93,12 +93,12 @@ const FEEDBACK_HELP = [
93
93
  * MCP server's send_feedback tool. It has to make an agent actually send feedback while it works.
94
94
  */
95
95
  const FEEDBACK_WHY = [
96
- 'Sends your message straight to the Shardflux founder, who reads every one. Agents: use it actively while you work,',
96
+ 'Sends your message straight to the Shardflux team, who read every one. Agents: use it actively while you work,',
97
97
  'not once at the end. Send a short note the moment:',
98
98
  '- something fails unexpectedly, an error or doc is unclear, an option is missing, or you needed a workaround;',
99
- '- your user complains or is frustrated about Shardflux or the workflow around it (slowness, cost or limits,',
100
- ' confusing setup, a missing feature, a workaround): paraphrase it, with what they were trying to do;',
101
- '- your user asked for something Shardflux could not do, or made awkward.',
99
+ '- your user asks for a capability, an option or a smoother workflow: paraphrase it, with what they were trying',
100
+ ' to do;',
101
+ '- your user has an idea for how Shardflux could fit their work better.',
102
102
  'Short and frequent beats polished; include the request id and error code (a failed shard command prints a',
103
103
  'ready-made "feedback:" line to fill in). No need to ask first, but tell your user you sent it. Leave out private',
104
104
  'data about the user and secrets or code they did not mean to share; paraphrase, never paste transcripts.',
@@ -138,7 +138,7 @@ const KEY_COMMANDS = [
138
138
  },
139
139
  {
140
140
  path: ['feedback'],
141
- summary: 'Tell the Shardflux founder what failed, confused you or is missing (agents: as you work)',
141
+ summary: 'Tell the Shardflux team what failed, confused you or is missing (agents: as you work)',
142
142
  description: [
143
143
  ...FEEDBACK_WHY,
144
144
  '',
@@ -154,15 +154,14 @@ const KEY_COMMANDS = [
154
154
  options: {
155
155
  category: { type: 'string', value: '<bug|confusing|missing|idea|praise|other>', description: 'Kind of feedback (default other; see Categories).' },
156
156
  workspace: { type: 'string', value: '<id|key>', description: 'The workspace it is about.' },
157
- 'request-id': { type: 'string', value: '<id>', description: 'request_id from the error, so the founder can find the logs.' },
158
- 'error-code': { type: 'string', value: '<code>', description: 'The error code you saw, e.g. capacity_unavailable.' },
157
+ 'request-id': { type: 'string', value: '<id>', description: 'request_id from the error, so the team can find the logs.' },
158
+ 'error-code': { type: 'string', value: '<code>', description: 'The error code you saw, e.g. template_not_found.' },
159
159
  command: { type: 'string', value: '<text>', description: 'What you ran, e.g. "shard ws exec acme/demo -- npm test".' },
160
160
  'from-file': { type: 'string', value: '<file|->', description: 'Read the message from this file, or - for standard input (long reports, logs); instead of <message...>.' },
161
161
  },
162
162
  examples: [
163
- 'shard feedback --category bug --request-id req-5c7744b2bb5c457b86b76101 --error-code capacity_unavailable "ws open failed twice in 10 min; expected a start within a minute"',
164
- 'shard feedback --category confusing --command "shard ws exec acme/demo -- npm test" exit 137 with no message, took a while to see it was the memory cap',
165
- 'shard feedback --category missing no way to copy a file between two workspaces, piped files read into files write instead',
163
+ 'shard feedback --category bug --request-id req-5c7744b2bb5c457b86b76101 --error-code template_not_found "ws open --template python-node failed; expected a suggestion of the closest slug"',
164
+ 'shard feedback --category idea "user would like shard ws open to remember the last template they used"',
166
165
  'npm test 2>&1 | tail -n 60 | shard feedback --category bug --workspace acme/demo --from-file -',
167
166
  ],
168
167
  },
@@ -241,7 +240,7 @@ const KEY_COMMANDS = [
241
240
  {
242
241
  path: ['workspaces', 'exec'],
243
242
  summary: 'Run a command in a workspace; prints its output and exits with its exit code',
244
- description: 'Runs argv directly (no shell; use `-- bash -lc "..."` for shell syntax). Processful workspaces: output is streamed as it arrives and resumes from byte offsets after dropped connections; Ctrl-C stops waiting and cancels the command. File-first workspaces: the command runs as an execution in a fresh VM on the latest tree revision; its output is printed when it ended, and the files it changed under /home/user become the next tree revision (-v lists them). An execution cannot be canceled: Ctrl-C stops waiting and names the command that fetches its result later. A failed or lost execution (nothing published) exits 6, as does a command that could not start (a --cwd that is not a directory, a program not on PATH), with the workspace’s reason.',
243
+ description: 'Runs argv directly (no shell; use `-- bash -lc "..."` for shell syntax). Processful workspaces: output is streamed as it arrives and resumes from byte offsets after dropped connections; Ctrl-C stops waiting and cancels the command. File-first workspaces: the command runs as an execution in a fresh VM on the latest tree revision; its output is printed when it ended, and the files it changed under /home/user become the next tree revision (-v lists them). An execution runs to completion: Ctrl-C stops waiting and names the command that fetches its result later. A failed or lost execution (nothing published) exits 6, as does a command that could not start (a --cwd that is not a directory, a program not on PATH), with the workspace’s reason.',
245
244
  positionals: [REF, { name: 'command', required: true, variadic: true }],
246
245
  options: {
247
246
  cwd: { type: 'string', value: '<dir>', description: 'Working directory, an absolute path (default /home/user; under /home/user on a file-first workspace). A relative path is refused (invalid_cwd).' },
@@ -519,7 +518,7 @@ const KEY_COMMANDS = [
519
518
  {
520
519
  path: ['templates', 'init'],
521
520
  summary: 'Write a template.yaml that starts from a base template',
522
- description: 'The file is the recipe v2 document (contracts §24.1): languages, packages, files (local "from" paths are uploaded by "shard templates build"), build steps, and the settings a workspace gets when it opens (env, inputs, start commands, services, defaults). Edit it, then build it.',
521
+ description: 'The file is the recipe v2 document: languages, packages, files (local "from" paths are uploaded by "shard templates build"), build steps, and the settings a workspace gets when it opens (env, inputs, start commands, services, defaults). Edit it, then build it.',
523
522
  positionals: [],
524
523
  options: {
525
524
  base: { type: 'string', value: '<slug[@version]>', description: 'Base template (required), e.g. ubuntu-24.04; without @version, the version open resolves to now.' },
@@ -1058,8 +1057,8 @@ export function topHelp() {
1058
1057
  '',
1059
1058
  'Feedback: shard feedback [options] <message...>',
1060
1059
  ...FEEDBACK_WHY.map((l) => ` ${l}`),
1061
- ' shard feedback --category bug --request-id req-5c7744b2bb5c457b86b76101 "ws open waited 40 s in capacity_pending; expected under 5 s"',
1062
- ' shard feedback --category confusing "user was frustrated that ws open needs a template slug they had to look up; they expected a default"',
1060
+ ' shard feedback --category bug --request-id req-5c7744b2bb5c457b86b76101 --error-code template_not_found "ws open --template python-node failed; expected a suggestion of the closest slug"',
1061
+ ' shard feedback --category idea "user would like shard ws open to remember the last template they used"',
1063
1062
  '',
1064
1063
  'Start here (everything the web app does, from a terminal; a person only opens the emailed link and pays in Checkout):',
1065
1064
  ` printf '%s\\n' "$PASSWORD" | shard auth register --email you@example.com`,
package/dist/browser.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * `--open` (0.5.0+): opens a URL in the default browser, best effort. The URL is always printed as well, so a
2
+ * `--open` (0.5.0+): opens a URL in the default browser when it can. The URL is always printed as well, so a
3
3
  * failure to open changes nothing: no error, no exit code. $BROWSER (a program run with the URL as its only argument)
4
4
  * wins; otherwise `open` (macOS), `rundll32 url.dll,FileProtocolHandler` (Windows) or `xdg-open` (elsewhere).
5
5
  */
@@ -70,13 +70,13 @@ export type Handler = (ctx: Ctx, values: Values, positionals: string[]) => Promi
70
70
  export declare const str: (v: Values[string]) => string | undefined;
71
71
  export declare const strs: (v: Values[string]) => string[];
72
72
  export declare function out(ctx: Ctx, human: string, machine: unknown): void;
73
- /** `--when-idle <duration>`: whole seconds from 0 (as soon as it is idle; 0.6.1) to 3600 (the API's after_seconds bounds, contracts §20.6). */
73
+ /** `--when-idle <duration>`: whole seconds from 0 (as soon as it is idle; 0.6.1) to 3600 (the API's after_seconds bounds). */
74
74
  export declare function whenIdleSeconds(text: string): number;
75
75
  export declare function waitTimeout(values: Values): number;
76
76
  /**
77
77
  * `<id|key>`: a UUID is tried as an id first; anything else (or an unknown UUID) as an exact workspace key, across every
78
78
  * lifetime and purpose (sessions, drafts and test instances are hidden from the default list), preferring the live
79
- * workspace over tombstones of ended sessions that had the same key (contracts §19.11).
79
+ * workspace over tombstones of ended sessions that had the same key.
80
80
  */
81
81
  export declare function resolveWorkspace(ctx: Ctx, ref: string): Promise<Workspace>;
82
82
  export declare function oneOf<T extends string>(values: Values, option: string, allowed: readonly T[]): T | undefined;
package/dist/commands.js CHANGED
@@ -30,10 +30,10 @@ export const str = (v) => (typeof v === 'string' ? v : undefined);
30
30
  const cellOf = (ctx, ws) => ws.cell({ agentLabel: ctx.agentLabel, transitionTimeoutMs: ctx.wakeTimeoutMs, ...(ctx.wake ? {} : { wake: null }) });
31
31
  export const strs = (v) => (Array.isArray(v) ? v : typeof v === 'string' ? [v] : []);
32
32
  const MAX_SECRET_VALUE_BYTES = 65_536;
33
- /** `files patch --content-file`: a patch request is at most 7 MiB (contracts §26.2); larger files go through `files write`. */
33
+ /** `files patch --content-file`: a patch request is at most 7 MiB; larger files go through `files write`. */
34
34
  const MAX_PATCH_CONTENT = 7 * 1024 * 1024;
35
35
  const STOPPED_AT = { max_matches: '--max matches', budget: 'its 10 s budget', max_bytes: '4 MiB of results' };
36
- /** A file revision (SHA-256 of the content) or `absent` (contracts §26.2). */
36
+ /** A file revision (SHA-256 of the content) or `absent`. */
37
37
  const REVISION = /^([0-9a-f]{64}|absent)$/;
38
38
  const TOOLS = ['exec', 'files', 'pty', 'process', 'git', 'browser'];
39
39
  function secretNames(names, option) {
@@ -66,7 +66,7 @@ function caps(values) {
66
66
  c.disk_gib = parsePositiveInt(disk, 'disk-gib', 1_000_000);
67
67
  return Object.keys(c).length ? c : undefined;
68
68
  }
69
- /** `--when-idle <duration>`: whole seconds from 0 (as soon as it is idle; 0.6.1) to 3600 (the API's after_seconds bounds, contracts §20.6). */
69
+ /** `--when-idle <duration>`: whole seconds from 0 (as soon as it is idle; 0.6.1) to 3600 (the API's after_seconds bounds). */
70
70
  export function whenIdleSeconds(text) {
71
71
  if (/^0+(?:\.0+)?(?:ms|s|m|h)?$/.test(text.trim()))
72
72
  return 0;
@@ -85,7 +85,7 @@ export function waitTimeout(values) {
85
85
  /**
86
86
  * `<id|key>`: a UUID is tried as an id first; anything else (or an unknown UUID) as an exact workspace key, across every
87
87
  * lifetime and purpose (sessions, drafts and test instances are hidden from the default list), preferring the live
88
- * workspace over tombstones of ended sessions that had the same key (contracts §19.11).
88
+ * workspace over tombstones of ended sessions that had the same key.
89
89
  */
90
90
  export async function resolveWorkspace(ctx, ref) {
91
91
  const cloud = ctx.cloud();
@@ -192,7 +192,7 @@ export function parseSlugVersion(text, what) {
192
192
  }
193
193
  const INPUT_NAME = /^[A-Za-z_][A-Za-z0-9_]{0,127}$/;
194
194
  /**
195
- * Open-time text inputs (contracts §24.3) from --input-file (NAME=value lines with # comments, or a JSON object of
195
+ * Open-time text inputs from --input-file (NAME=value lines with # comments, or a JSON object of
196
196
  * strings), then each --input NAME=value (a later one wins). Undefined when neither option is given.
197
197
  */
198
198
  async function inputsFrom(ctx, values) {
@@ -417,7 +417,7 @@ export function execExitCode(r) {
417
417
  async function bestEffortCancel(cell, sessionId) {
418
418
  await Promise.race([cell.exec.cancel(sessionId).catch(() => undefined), new Promise((r) => setTimeout(r, 3_000).unref())]);
419
419
  }
420
- // ---- File-first workspaces (0.5.0; contracts §29) ----------------------------------------------------------------------
420
+ // ---- File-first workspaces (0.5.0) ----------------------------------------------------------------------
421
421
  const MODES = { processful: 'processful', 'file-first': 'file_first', file_first: 'file_first' };
422
422
  /** `--mode processful|file-first` (`file_first` too). */
423
423
  function modeFlag(values) {
@@ -452,7 +452,7 @@ function treeRevisionAfter(ws, cell) {
452
452
  return cell.treeRevision ?? ws.treeRevision;
453
453
  }
454
454
  /**
455
- * A lifecycle call a file-first workspace does not have (contracts §29.7: suspend, resume, fork, reset,
455
+ * A lifecycle call a file-first workspace does not have (suspend, resume, fork, reset,
456
456
  * save-as-template), refused before any request as the SDK's workspace handle does: NotSupportedForModeError, printed
457
457
  * with its hint like the API's own refusal.
458
458
  */
@@ -519,7 +519,7 @@ export const KEY_HANDLERS = {
519
519
  out(ctx, `shard ${CLI_VERSION} (@shardflux/sdk ${SDK_VERSION})\n${line}`, { cli: CLI_VERSION, sdk: SDK_VERSION, update });
520
520
  return 0;
521
521
  },
522
- // Feedback (0.5.0+): POST /v1/feedback, emailed to the founder. Validated here first so a bad call costs no request.
522
+ // Feedback (0.5.0+): POST /v1/feedback, emailed to the Shardflux team. Validated here first so a bad call costs no request.
523
523
  async feedback(ctx, values, words) {
524
524
  const category = oneOf(values, 'category', FEEDBACK_CATEGORIES);
525
525
  const context = feedbackContext(ctx, values);
@@ -527,7 +527,7 @@ export const KEY_HANDLERS = {
527
527
  const r = await feedbackSender(ctx).sendFeedback({ message, ...(category ? { category } : {}), context });
528
528
  const human = r.duplicate
529
529
  ? `Already received: the same message was sent in the last 24 hours (feedback ${r.id}); not emailed again.\n`
530
- : `Sent to the Shardflux founder (feedback ${r.id}). Thank you.\n`;
530
+ : `Sent to the Shardflux team (feedback ${r.id}). Thank you.\n`;
531
531
  out(ctx, human, { id: r.id, received_at: r.receivedAt, duplicate: r.duplicate });
532
532
  return 0;
533
533
  },
@@ -661,7 +661,7 @@ export const KEY_HANDLERS = {
661
661
  const cell = cellOf(ctx, ws);
662
662
  const cwd = str(values.cwd);
663
663
  if (ws.mode === 'file_first') {
664
- // An execution (contracts §29.8): answered when the command ended. The id is ours, so Ctrl-C can name it.
664
+ // An execution: answered when the command ended. The id is ours, so Ctrl-C can name it.
665
665
  const id = executionId ?? newExecutionId();
666
666
  let r;
667
667
  try {
@@ -677,7 +677,7 @@ export const KEY_HANDLERS = {
677
677
  }
678
678
  catch (err) {
679
679
  if (ctx.signal.aborted) {
680
- throw new InterruptedError(`Interrupted; execution ${id} keeps running server side if it started (an execution cannot be canceled).`, undefined, {
680
+ throw new InterruptedError(`Interrupted; execution ${id} keeps running server side if it started (an execution runs to completion).`, undefined, {
681
681
  executionId: id,
682
682
  hint: `fetch its result later with: shard executions get ${ref} ${id}`,
683
683
  });
@@ -876,7 +876,7 @@ export const KEY_HANDLERS = {
876
876
  return 0;
877
877
  },
878
878
  async 'workspaces resume'(ctx, values, [ref]) {
879
- // With --wait the resume is held until the workspace runs (contracts §22.6); its tool token is the CLI's label.
879
+ // With --wait the resume is held until the workspace runs; its tool token is the CLI's label.
880
880
  return lifecycle(ctx, values, ref, 'Resuming', (ws, o) => ctx.cloud().workspaces.resume(ws.id, { ...o, agentLabel: ctx.agentLabel }), ['resume', 'Resume']);
881
881
  },
882
882
  async 'workspaces delete'(ctx, values, [ref]) {
package/dist/errors.d.ts CHANGED
@@ -48,7 +48,7 @@ export declare class CheckoutEndedError extends Error {
48
48
  }
49
49
  /**
50
50
  * The user pressed Ctrl-C; `operationId` is set when a server-side operation keeps running, `executionId` when a
51
- * file-first execution does (it cannot be canceled), with `hint` naming the command that fetches its result.
51
+ * file-first execution does (an execution runs to completion), with `hint` naming the command that fetches its result.
52
52
  */
53
53
  export declare class InterruptedError extends Error {
54
54
  name: string;
@@ -60,7 +60,7 @@ export declare class InterruptedError extends Error {
60
60
  hint?: string;
61
61
  });
62
62
  }
63
- /** A file-first execution that ended `failed` or `lost` (contracts §29.8): nothing was published. */
63
+ /** A file-first execution that ended `failed` or `lost`: nothing was published. */
64
64
  export declare class ExecutionFailedError extends Error {
65
65
  name: string;
66
66
  readonly result: ExecutionResult;
package/dist/errors.js CHANGED
@@ -59,7 +59,7 @@ export class CheckoutEndedError extends Error {
59
59
  }
60
60
  /**
61
61
  * The user pressed Ctrl-C; `operationId` is set when a server-side operation keeps running, `executionId` when a
62
- * file-first execution does (it cannot be canceled), with `hint` naming the command that fetches its result.
62
+ * file-first execution does (an execution runs to completion), with `hint` naming the command that fetches its result.
63
63
  */
64
64
  export class InterruptedError extends Error {
65
65
  name = 'InterruptedError';
@@ -73,7 +73,7 @@ export class InterruptedError extends Error {
73
73
  this.hint = more.hint;
74
74
  }
75
75
  }
76
- /** A file-first execution that ended `failed` or `lost` (contracts §29.8): nothing was published. */
76
+ /** A file-first execution that ended `failed` or `lost`: nothing was published. */
77
77
  export class ExecutionFailedError extends Error {
78
78
  name = 'ExecutionFailedError';
79
79
  result;
@@ -147,7 +147,7 @@ export function describeError(err) {
147
147
  const details = { ...(err.errorCode ? { error_code: err.errorCode } : {}), ...(typeof reason === 'string' ? { reason } : {}) };
148
148
  return { code: 'operation_failed', message: err.message, operation_id: err.operationId, retryable: err.retryable, ...(Object.keys(details).length ? { details } : {}), operation: err.operation };
149
149
  }
150
- // File-first executions (0.5.0; contracts §29.8): failed or lost like a failed operation (details.reason says why;
150
+ // File-first executions (0.5.0): failed or lost like a failed operation (details.reason says why;
151
151
  // retryable: a new execution id may succeed), still running like a wait that gave up.
152
152
  if (err instanceof ExecutionFailedError) {
153
153
  const e = err.result.error;
package/dist/format.d.ts CHANGED
@@ -22,13 +22,13 @@ export declare function workspaceRow(w: WorkspaceView): string[];
22
22
  export declare function workspaceTable(ws: readonly WorkspaceView[]): string;
23
23
  export declare function isReady(w: WorkspaceView): boolean;
24
24
  /**
25
- * The startup of a workspace's template version (contracts §24.4) in one line: state, trigger, and for a failure the
25
+ * The startup of a workspace's template version in one line: state, trigger, and for a failure the
26
26
  * step or service, exit code and reason. Null when the version has no start commands or services.
27
27
  */
28
28
  export declare function startupText(s: WorkspaceView['startup'] | undefined): string | null;
29
29
  /** The failed step's output tail, indented, after the detail block (empty otherwise). */
30
30
  export declare function startupTail(s: WorkspaceView['startup'] | undefined): string;
31
- /** A pending suspend-when-idle request in one line (0.5.1; contracts §20.6). */
31
+ /** A pending suspend-when-idle request in one line (0.5.1). */
32
32
  export declare function suspendRequestText(r: SuspendRequest): string;
33
33
  /** `shard ws suspend --when-idle`: the recorded request, or the suspend already in progress. */
34
34
  export declare function suspendWhenIdleText(w: {
@@ -63,8 +63,8 @@ export declare function capMoney(minor: unknown, currency: string): string;
63
63
  */
64
64
  export declare function usageText(summary: unknown): string;
65
65
  /**
66
- * The `shard feedback` command a failed command suggests (0.5.0+), with the error's request id and code so the founder
67
- * can find the logs (a failed operation's or execution's own error code, e.g. capacity_unavailable); the agent fills in
66
+ * The `shard feedback` command a failed command suggests (0.5.0+), with the error's request id and code so the team
67
+ * can find the logs (a failed operation's or execution's own error code, e.g. template_not_found); the agent fills in
68
68
  * the text.
69
69
  */
70
70
  export declare function feedbackCommand(e: ErrorInfo): string;
@@ -90,7 +90,7 @@ export declare function languageTable(l: TemplateLanguages): string;
90
90
  export declare function packageTable(page: TemplatePackagePage): string;
91
91
  /** A template: identity, what open resolves to, its versions, and the open version's settings. */
92
92
  export declare function templateDetailText(t: TemplateDetail): string;
93
- /** A version's settings (contracts §24.3), one line per part. */
93
+ /** A version's settings, one line per part. */
94
94
  export declare function settingsText(s: TemplateSettings): string;
95
95
  /** How many changed paths the human output lists before "... N more" (--json lists every one the result has). */
96
96
  export declare const MAX_CHANGED_SHOWN = 100;
@@ -133,6 +133,17 @@ export declare function usageSeriesText(series: unknown): string;
133
133
  /** The period estimate (GET .../usage/estimate): the bill so far and where each allowance is heading. */
134
134
  export declare function usageEstimateText(estimate: unknown): string;
135
135
  export declare function money(amountMinor: number, currency: string): string;
136
+ export declare function isGrantPlan(plan: {
137
+ plan_key: string;
138
+ grant_days?: unknown;
139
+ }): boolean;
140
+ /** The plan in force with the grant's end (`ends_at`, 0.6.2+), which the SDK's generated types add with the API change. */
141
+ type PlanInForce = NonNullable<BillingSubscription['plan']> & {
142
+ ends_at?: string | null;
143
+ };
144
+ /** "trial, ends 2026-11-29 14:03:00Z, then free (trial, catalog live-v7)"; a plan without an end as before. */
145
+ export declare function planInForceText(plan: PlanInForce | null): string;
146
+ /** The public plans: granted plans (the trial, design partners) are never listed or offered. */
136
147
  export declare function planTable(catalog: BillingCatalog): string;
137
148
  export declare function billingStatusText(s: BillingSubscription, org: Pick<Organization, 'name' | 'slug'>): string;
138
149
  export declare function invoiceTable(rows: readonly BillingInvoicePage['data'][number][]): string;
@@ -149,3 +160,4 @@ export declare function egressVersionTable(rows: readonly EgressPolicyVersion[])
149
160
  * cap and its bounds, the rates, and the next step. `saved` adds the version the change was saved as.
150
161
  */
151
162
  export declare function overagePolicyText(p: SpendPolicy, orgName: string, saved?: boolean): string;
163
+ export {};
package/dist/format.js CHANGED
@@ -85,7 +85,7 @@ function originText(o) {
85
85
  }
86
86
  }
87
87
  /**
88
- * The startup of a workspace's template version (contracts §24.4) in one line: state, trigger, and for a failure the
88
+ * The startup of a workspace's template version in one line: state, trigger, and for a failure the
89
89
  * step or service, exit code and reason. Null when the version has no start commands or services.
90
90
  */
91
91
  export function startupText(s) {
@@ -107,7 +107,7 @@ export function startupTail(s) {
107
107
  const lines = s.output_tail.replace(/\n$/, '').split('\n');
108
108
  return `startup output (last ${Buffer.byteLength(s.output_tail)} bytes):\n${lines.map((l) => ` | ${l}`).join('\n')}\n`;
109
109
  }
110
- /** A pending suspend-when-idle request in one line (0.5.1; contracts §20.6). */
110
+ /** A pending suspend-when-idle request in one line (0.5.1). */
111
111
  export function suspendRequestText(r) {
112
112
  return `${r.after_seconds === 0 ? 'as soon as idle' : `after ${r.after_seconds} s idle`}, not before ${time(r.not_before)} (requested ${time(r.requested_at)})`;
113
113
  }
@@ -132,7 +132,7 @@ export function workspaceDetail(w) {
132
132
  ['state', `${w.observed_state} (desired ${w.desired_state})`],
133
133
  ['ready', isReady(w) ? 'yes' : 'no'],
134
134
  ['template', `${w.template.slug} v${w.template.version} (${w.template.version_id})`],
135
- // The mode (0.5.0; contracts §29) when the API reports it; a file-first workspace's state is its tree revision.
135
+ // The mode (0.5.0) when the API reports it; a file-first workspace's state is its tree revision.
136
136
  ...(w.mode !== undefined ? [['mode', modeText(w.mode)]] : []),
137
137
  ...(w.mode === 'file_first' ? [['tree revision', String(w.tree_revision)]] : []),
138
138
  ['cell', w.cell_id ? `${w.cell_id} ${w.cell_endpoint ?? '(endpoint unresolved)'}` : '-'],
@@ -317,8 +317,12 @@ export function usageText(summary) {
317
317
  const head = [];
318
318
  if (isObject(s.plan))
319
319
  head.push(['plan', `${scalar(s.plan.plan_key)}${s.plan.catalog_version !== undefined ? ` (catalog ${scalar(s.plan.catalog_version)})` : ''}`]);
320
- if (isObject(s.period))
321
- head.push(['period', `${time(scalar(s.period.start))} .. ${time(scalar(s.period.end))}`]);
320
+ if (isObject(s.period)) {
321
+ // A plan grant's own window (source `grant`, 0.6.2+): the trial's 60 days rather than the calendar month.
322
+ const trial = isObject(s.plan) && s.plan.plan_key === 'trial';
323
+ const grant = s.period.source === 'grant' ? (trial ? ' (the trial; then free)' : ' (the plan grant; it ends then)') : '';
324
+ head.push(['period', `${time(scalar(s.period.start))} .. ${time(scalar(s.period.end))}${grant}`]);
325
+ }
322
326
  const m = isObject(s.measurement) ? s.measurement : s;
323
327
  if (m.measured_through !== undefined)
324
328
  head.push(['measured through', time(m.measured_through)]);
@@ -326,7 +330,8 @@ export function usageText(summary) {
326
330
  head.push(['estimate', scalar(s.measurement.estimate_status)]);
327
331
  if (typeof s.allowance_exhausted === 'boolean') {
328
332
  const reason = typeof s.exhausted_reason === 'string' ? `${s.exhausted_reason}: ` : '';
329
- head.push(['allowance exhausted', s.allowance_exhausted ? `yes (${reason}new opens/resumes are refused)` : 'no']);
333
+ const trialEnded = isObject(s.plan) && s.plan.plan_key === 'trial';
334
+ head.push(['allowance exhausted', s.allowance_exhausted ? (trialEnded ? `yes (${reason}the trial ends; the organization is back on free)` : `yes (${reason}new opens/resumes are refused)`) : 'no']);
330
335
  }
331
336
  for (const [k, v] of Object.entries(s))
332
337
  if (!USAGE_KNOWN.has(k) && (typeof v !== 'object' || v === null))
@@ -363,8 +368,8 @@ export function usageText(summary) {
363
368
  /** Request ids and error codes pasted unquoted into the suggested command must be shell-inert. */
364
369
  const SHELL_SAFE = /^[A-Za-z0-9._:-]{1,200}$/;
365
370
  /**
366
- * The `shard feedback` command a failed command suggests (0.5.0+), with the error's request id and code so the founder
367
- * can find the logs (a failed operation's or execution's own error code, e.g. capacity_unavailable); the agent fills in
371
+ * The `shard feedback` command a failed command suggests (0.5.0+), with the error's request id and code so the team
372
+ * can find the logs (a failed operation's or execution's own error code, e.g. template_not_found); the agent fills in
368
373
  * the text.
369
374
  */
370
375
  export function feedbackCommand(e) {
@@ -402,7 +407,7 @@ export function errorText(e, hint, feedback) {
402
407
  : '';
403
408
  return `error: ${e.message}${reason} [${meta.join(' ')}]\n${issues}${hint ? `hint: ${hint}\n` : ''}${feedback ? `feedback: ${feedback}\n` : ''}`;
404
409
  }
405
- // ---- Templates v2 (contracts §19) ---------------------------------------------------------------
410
+ // ---- Templates v2 ---------------------------------------------------------------
406
411
  export function templateTable(rows) {
407
412
  return table(['SLUG', 'OWNER', 'OPEN VERSION', 'LAYOUTS', 'FILES', 'DRAFT', 'ARCHIVED'], rows.map((t) => {
408
413
  const v = t.open_version;
@@ -514,7 +519,7 @@ export function templateDetailText(t) {
514
519
  : 'No versions.\n';
515
520
  return `${head}\n${versions}${open?.settings ? `\nsettings of v${open.version}:\n${settingsText(open.settings)}` : ''}`;
516
521
  }
517
- /** A version's settings (contracts §24.3), one line per part. */
522
+ /** A version's settings, one line per part. */
518
523
  export function settingsText(s) {
519
524
  const inputs = Object.entries(s.inputs).map(([n, i]) => `${n} (${i.kind}${i.required ? ', required' : ''}${i.default !== null ? `, default ${JSON.stringify(i.default)}` : ''})`);
520
525
  const d = s.defaults;
@@ -528,7 +533,7 @@ export function settingsText(s) {
528
533
  ['egress', egress],
529
534
  ]).replace(/^/gm, ' ');
530
535
  }
531
- // ---- File-first executions (0.5.0; contracts §29.8) ----------------------------------------------------------------------
536
+ // ---- File-first executions (0.5.0) ----------------------------------------------------------------------
532
537
  const CHANGE_LETTER = { added: 'A', modified: 'M', deleted: 'D' };
533
538
  /** How many changed paths the human output lists before "... N more" (--json lists every one the result has). */
534
539
  export const MAX_CHANGED_SHOWN = 100;
@@ -730,8 +735,25 @@ export function money(amountMinor, currency) {
730
735
  const c = currency.toLowerCase();
731
736
  return `${zeroDecimal.has(c) ? String(amountMinor) : (amountMinor / 100).toFixed(2)} ${c.toUpperCase()}`;
732
737
  }
738
+ /**
739
+ * Plans that are only ever granted, never bought: the signup trial and the design-partner plan (0.6.2+). The API's
740
+ * catalog marks them with `grant_days`; the keys cover an API that lists them without it.
741
+ */
742
+ const GRANT_PLANS = new Set(['trial', 'partner']);
743
+ export function isGrantPlan(plan) {
744
+ return GRANT_PLANS.has(plan.plan_key) || (typeof plan.grant_days === 'number' && plan.grant_days > 0);
745
+ }
746
+ /** "trial, ends 2026-11-29 14:03:00Z, then free (trial, catalog live-v7)"; a plan without an end as before. */
747
+ export function planInForceText(plan) {
748
+ if (!plan)
749
+ return '-';
750
+ const endsAt = typeof plan.ends_at === 'string' && plan.ends_at !== '' ? plan.ends_at : null;
751
+ const ends = endsAt ? `, ends ${time(endsAt)}${plan.plan_key === 'trial' ? ', then free' : ''}` : '';
752
+ return `${plan.plan_key}${ends} (${plan.source}, catalog ${plan.catalog_version})`;
753
+ }
754
+ /** The public plans: granted plans (the trial, design partners) are never listed or offered. */
733
755
  export function planTable(catalog) {
734
- const rows = catalog.plans.map((p) => {
756
+ const rows = catalog.plans.filter((p) => !isGrantPlan(p)).map((p) => {
735
757
  const prices = p.prices.length ? p.prices.map((x) => `${money(x.amount_minor, x.currency)}/${x.interval}`).join(', ') : 'free';
736
758
  const buy = p.prices.some((x) => x.purchasable) ? 'yes' : '-';
737
759
  return [p.plan_key, p.name, prices, buy];
@@ -743,7 +765,7 @@ export function billingStatusText(s, org) {
743
765
  const pending = s.pending_checkout;
744
766
  return kv([
745
767
  ['organization', `${org.name} (${org.slug})`],
746
- ['plan', s.plan ? `${s.plan.plan_key} (${s.plan.source}, catalog ${s.plan.catalog_version})` : '-'],
768
+ ['plan', planInForceText(s.plan)],
747
769
  ['billing state', s.billing_state],
748
770
  ['subscription', sub ? `${sub.status}${sub.plan_key ? ` ${sub.plan_key}` : ''}${sub.cancel_at_period_end ? ', cancels at period end' : ''}` : 'none'],
749
771
  ['period end', sub ? time(sub.current_period_end) : '-'],
package/dist/http.d.ts CHANGED
@@ -1,14 +1,7 @@
1
1
  /**
2
- * The fetch given to the SDK: the runtime's fetch with `Connection: close` on
3
- * every request (API and cell gateway).
4
- *
5
- * Why: Node 26.7's bundled undici (8.9.0) intermittently stalls a request
6
- * sent on a reused keep-alive connection until an unrelated timer fires (up to
7
- * ~30 s, the SDK's request timeout, after which the SDK retries). Reproduced
8
- * with bare fetch against both node:http and Fastify servers; Node 22 (undici
9
- * 6.28) and `Connection: close` do not stall. A fresh connection per request
10
- * costs one TCP/TLS handshake, which is negligible for these call rates.
11
- * Set SHARDFLUX_HTTP_KEEPALIVE=1 to use the runtime's keep-alive pooling.
2
+ * The fetch given to the SDK: the runtime's fetch (API and cell gateway). By
3
+ * default every request uses a fresh connection (`Connection: close`);
4
+ * SHARDFLUX_HTTP_KEEPALIVE=1 reuses connections.
12
5
  *
13
6
  * `signal` (the CLI's Ctrl-C) is attached to held requests (`Prefer: wait=N`,
14
7
  * held by the server for up to 20 s). The SDK passes the caller's signal to its
package/dist/http.js CHANGED
@@ -1,14 +1,7 @@
1
1
  /**
2
- * The fetch given to the SDK: the runtime's fetch with `Connection: close` on
3
- * every request (API and cell gateway).
4
- *
5
- * Why: Node 26.7's bundled undici (8.9.0) intermittently stalls a request
6
- * sent on a reused keep-alive connection until an unrelated timer fires (up to
7
- * ~30 s, the SDK's request timeout, after which the SDK retries). Reproduced
8
- * with bare fetch against both node:http and Fastify servers; Node 22 (undici
9
- * 6.28) and `Connection: close` do not stall. A fresh connection per request
10
- * costs one TCP/TLS handshake, which is negligible for these call rates.
11
- * Set SHARDFLUX_HTTP_KEEPALIVE=1 to use the runtime's keep-alive pooling.
2
+ * The fetch given to the SDK: the runtime's fetch (API and cell gateway). By
3
+ * default every request uses a fresh connection (`Connection: close`);
4
+ * SHARDFLUX_HTTP_KEEPALIVE=1 reuses connections.
12
5
  *
13
6
  * `signal` (the CLI's Ctrl-C) is attached to held requests (`Prefer: wait=N`,
14
7
  * held by the server for up to 20 s). The SDK passes the caller's signal to its
@@ -16,6 +9,7 @@
16
9
  * sends its POST without one), so Ctrl-C would otherwise wait the hold out.
17
10
  */
18
11
  export function makeFetch(env, base = fetch, signal) {
12
+ // Why a fresh connection by default (Node 26 keep-alive measurements): docs/progress/startup-latency.md.
19
13
  const keepAlive = env.SHARDFLUX_HTTP_KEEPALIVE === '1';
20
14
  return (input, init) => {
21
15
  const headers = new Headers(init?.headers);
package/dist/main.js CHANGED
@@ -47,7 +47,7 @@ function hintFor(info, cred, file) {
47
47
  if (info.code === 'timeout' && info.operation_id)
48
48
  return `the operation continues server side; keep waiting with: shard operations wait ${info.operation_id}`;
49
49
  if (info.code === 'operation_failed' && info.retryable) {
50
- return info.details?.error_code === 'capacity_unavailable' ? 'no host could admit it before its deadline; nothing was started. Retry later.' : 'the operation may succeed if you retry it later.';
50
+ return info.details?.error_code === 'capacity_unavailable' ? 'nothing was started; run the same command again' : 'the operation may succeed if you retry it later.';
51
51
  }
52
52
  if (info.code === 'interrupted' && info.operation_id)
53
53
  return `keep waiting with: shard operations wait ${info.operation_id}`;
@@ -79,7 +79,7 @@ function hintFor(info, cred, file) {
79
79
  const policyHint = spendPolicyHint(info);
80
80
  if (policyHint)
81
81
  return policyHint;
82
- // File patches (contracts §26.2): what to do about each refusal. details.index is the 0-based edit (--old) index.
82
+ // File patches: what to do about each refusal. details.index is the 0-based edit (--old) index.
83
83
  const reason = info.details?.reason;
84
84
  const index = typeof info.details?.index === 'number' ? ` #${info.details.index + 1}` : '';
85
85
  if (reason === 'revision_mismatch') {
@@ -93,7 +93,7 @@ function hintFor(info, cred, file) {
93
93
  if (reason === 'edit_not_text')
94
94
  return 'the file is not UTF-8 text; use files write for binary data';
95
95
  if (reason === 'host_capacity')
96
- return 'the workspace’s host has no room to run it right now; retry in a few seconds';
96
+ return 'the workspace cannot be woken right now and the call did not run; retry in a few seconds';
97
97
  if (reason === 'host_feature_unavailable')
98
98
  return hostFeatureHint(info.details?.feature);
99
99
  // A processful command that could not start (0.5.1): what to change, from the workspace's reason.
@@ -167,17 +167,15 @@ function spendPolicyHint(info) {
167
167
  }
168
168
  }
169
169
  /**
170
- * 409 conflict host_feature_unavailable (contracts §26.7; 0.5.0): the workspace runs on a host agent that predates the
171
- * call. Not retryable: it lasts until the workspace runs on an upgraded host (minutes to hours), so the hint names
172
- * another way to do it now.
170
+ * 409 conflict host_feature_unavailable (0.5.0): the call is not available for this workspace. Not retryable, so the
171
+ * hint names the fallback that works now.
173
172
  */
174
173
  function hostFeatureHint(feature) {
175
- const later = 'it will once the workspace runs on an upgraded host (retrying now does not help)';
176
174
  if (feature === 'file_search')
177
- return `the workspace’s host does not support files search yet; ${later}. Search with a command instead: shard ws exec <id|key> -- grep -rn <pattern> <path>`;
175
+ return 'files search is not available for this workspace (retrying does not help); search with a command instead: shard ws exec <id|key> -- grep -rn <pattern> <path>';
178
176
  if (feature === 'file_patch')
179
- return `the workspace’s host does not support files patch yet; ${later}. Rewrite the file instead: shard files read <id|key> <path> --out F, edit F, then shard files write <id|key> <path> --from F`;
180
- return `the workspace’s host does not support this call yet; ${later}`;
177
+ return 'files patch is not available for this workspace (retrying does not help); rewrite the file instead: shard files read <id|key> <path> --out F, edit F, then shard files write <id|key> <path> --from F';
178
+ return 'this call is not available for this workspace (retrying does not help)';
181
179
  }
182
180
  /** What an execution that ended failed or lost ran into (error.details.reason), where the reason alone says little. */
183
181
  const EXECUTION_CAUSES = {
@@ -186,10 +184,10 @@ const EXECUTION_CAUSES = {
186
184
  host_unreachable: 'its host stopped answering',
187
185
  host_restarted: 'its host restarted',
188
186
  tree_moved: 'the tree changed while it ran',
189
- no_execution_host: 'no host had room to run it',
187
+ no_execution_host: 'the execution could not be placed',
190
188
  workspace_deleted: 'the workspace was deleted',
191
189
  };
192
- /** Hints for file-first workspaces (0.5.0; contracts §29.7, §29.8): the mode refusals, tree revisions and executions. */
190
+ /** Hints for file-first workspaces (0.5.0): the mode refusals, tree revisions and executions. */
193
191
  function fileFirstHint(info) {
194
192
  const d = info.details ?? {};
195
193
  const reason = d.reason;
@@ -211,7 +209,7 @@ function fileFirstHint(info) {
211
209
  return `this key already belongs to a ${has} workspace and a workspace’s mode never changes; use another key for a ${wants} workspace (or reopen this one without --mode)`;
212
210
  }
213
211
  case 'mode_not_available':
214
- return 'this deployment does not offer file-first workspaces yet; leave out --mode file-first to open a processful workspace';
212
+ return 'this deployment does not offer file-first workspaces; leave out --mode file-first to open a processful workspace';
215
213
  case 'layout_unsupported':
216
214
  return d.mode === 'file_first' ? 'file-first workspaces run on layered template versions only; open a template version whose disk layouts include layered (shard templates get <slug> lists them)' : undefined;
217
215
  case 'tree_revision_mismatch': {
@@ -229,7 +227,7 @@ function fileFirstHint(info) {
229
227
  case 'execution_id_reused':
230
228
  return 'this --execution-id was already used for a different request (the same id with the same request returns its recorded result); pass a new --execution-id';
231
229
  case 'no_execution_host':
232
- return 'no host had room to run the execution, also after retries with the same execution id; nothing ran. Retry later';
230
+ return 'the execution cannot be placed right now, also after retries with the same execution id; nothing ran. Retry';
233
231
  default:
234
232
  return undefined;
235
233
  }
@@ -271,7 +269,7 @@ function nudges(info, command) {
271
269
  const reason = reasonOf(info);
272
270
  return !NO_NUDGE_CODES.has(info.code) && !(reason !== undefined && NO_NUDGE_REASONS.has(reason));
273
271
  }
274
- /** `shard feedback` could not send: how to fix it, and the way to still reach the founder. */
272
+ /** `shard feedback` could not send: how to fix it, and the way to still reach the Shardflux team. */
275
273
  function feedbackHint(info, credentialHint) {
276
274
  if (info.code === 'usage')
277
275
  return 'run "shard feedback --help"';
@@ -1,5 +1,5 @@
1
1
  /**
2
- * template.yaml text (contracts §24.1: the recipe v2 document in YAML; only clients parse YAML): the starter file of
2
+ * template.yaml text (the recipe v2 document in YAML; only clients parse YAML): the starter file of
3
3
  * `shard templates init` and the export of a version (`shard templates export`), written like the dashboard's
4
4
  * Template file section (keys in the recipe's order, long scripts as block literals, no line folding).
5
5
  */
@@ -1,5 +1,5 @@
1
1
  /**
2
- * `shard` tells its user when it is outdated or no longer supported (0.5.0+; contracts §30.4). The API's
2
+ * `shard` tells its user when it is outdated or no longer supported (0.5.0+). The API's
3
3
  * GET /v1/client-versions names the latest published version of every client and the oldest one it still serves.
4
4
  *
5
5
  * - At most one request per 24 hours per API URL and package: the answer is cached in
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shardflux/cli",
3
- "version": "0.6.1",
3
+ "version": "0.6.2",
4
4
  "type": "module",
5
5
  "description": "shard: the Shardflux command line. Create an account, sign in, set up keys and billing, then open, run commands in, move files to, suspend, resume and fork persistent agent workspaces.",
6
6
  "license": "Apache-2.0",
@@ -44,7 +44,7 @@
44
44
  },
45
45
  "dependencies": {
46
46
  "yaml": "2.9.1",
47
- "@shardflux/sdk": "^0.11.0"
47
+ "@shardflux/sdk": "^0.11.1"
48
48
  },
49
49
  "devDependencies": {
50
50
  "@eslint/js": "10.0.1",