@b3os/cli 0.2.0 → 0.2.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.
Files changed (217) hide show
  1. package/README.md +87 -7
  2. package/assets/b3os-run.py +137 -0
  3. package/assets/skill/b3os/SKILL.md +111 -0
  4. package/dist/commands/_agents.d.ts +14 -0
  5. package/dist/commands/_agents.js +33 -0
  6. package/dist/commands/_agents.js.map +1 -0
  7. package/dist/commands/_common.js +6 -2
  8. package/dist/commands/_common.js.map +1 -1
  9. package/dist/commands/_context.d.ts +49 -0
  10. package/dist/commands/_context.js +260 -0
  11. package/dist/commands/_context.js.map +1 -0
  12. package/dist/commands/_next.d.ts +39 -0
  13. package/dist/commands/_next.js +77 -0
  14. package/dist/commands/_next.js.map +1 -0
  15. package/dist/commands/agent.d.ts +42 -0
  16. package/dist/commands/agent.js +218 -0
  17. package/dist/commands/agent.js.map +1 -0
  18. package/dist/commands/app.d.ts +2 -0
  19. package/dist/commands/app.js +559 -54
  20. package/dist/commands/app.js.map +1 -1
  21. package/dist/commands/auth.d.ts +88 -2
  22. package/dist/commands/auth.js +354 -44
  23. package/dist/commands/auth.js.map +1 -1
  24. package/dist/commands/docs.d.ts +54 -0
  25. package/dist/commands/docs.js +202 -0
  26. package/dist/commands/docs.js.map +1 -0
  27. package/dist/commands/doctor.d.ts +23 -0
  28. package/dist/commands/doctor.js +313 -0
  29. package/dist/commands/doctor.js.map +1 -0
  30. package/dist/commands/init.d.ts +38 -1
  31. package/dist/commands/init.js +259 -60
  32. package/dist/commands/init.js.map +1 -1
  33. package/dist/commands/listen.d.ts +30 -0
  34. package/dist/commands/listen.js +194 -0
  35. package/dist/commands/listen.js.map +1 -0
  36. package/dist/commands/manifest.d.ts +13 -1
  37. package/dist/commands/manifest.js +81 -18
  38. package/dist/commands/manifest.js.map +1 -1
  39. package/dist/commands/mcp.d.ts +25 -2
  40. package/dist/commands/mcp.js +120 -11
  41. package/dist/commands/mcp.js.map +1 -1
  42. package/dist/commands/sandbox.d.ts +35 -6
  43. package/dist/commands/sandbox.js +208 -9
  44. package/dist/commands/sandbox.js.map +1 -1
  45. package/dist/commands/setup.d.ts +39 -0
  46. package/dist/commands/setup.js +203 -0
  47. package/dist/commands/setup.js.map +1 -0
  48. package/dist/commands/tool.d.ts +154 -0
  49. package/dist/commands/tool.js +785 -0
  50. package/dist/commands/tool.js.map +1 -0
  51. package/dist/config.d.ts +30 -6
  52. package/dist/config.js +39 -8
  53. package/dist/config.js.map +1 -1
  54. package/dist/ctx.d.ts +5 -45
  55. package/dist/ctx.js +25 -160
  56. package/dist/ctx.js.map +1 -1
  57. package/dist/docs/index.json +1 -0
  58. package/dist/docs/pages/actions/call.md +300 -0
  59. package/dist/docs/pages/actions/catalog/airtable.md +737 -0
  60. package/dist/docs/pages/actions/catalog/arxiv.md +166 -0
  61. package/dist/docs/pages/actions/catalog/chainalysis-sanctions.md +125 -0
  62. package/dist/docs/pages/actions/catalog/coingecko.md +1558 -0
  63. package/dist/docs/pages/actions/catalog/deps-dev.md +465 -0
  64. package/dist/docs/pages/actions/catalog/dexscreener.md +568 -0
  65. package/dist/docs/pages/actions/catalog/discord.md +784 -0
  66. package/dist/docs/pages/actions/catalog/finnhub.md +776 -0
  67. package/dist/docs/pages/actions/catalog/frankfurter.md +438 -0
  68. package/dist/docs/pages/actions/catalog/github.md +1853 -0
  69. package/dist/docs/pages/actions/catalog/gmail.md +575 -0
  70. package/dist/docs/pages/actions/catalog/google-calendar.md +654 -0
  71. package/dist/docs/pages/actions/catalog/google-drive.md +502 -0
  72. package/dist/docs/pages/actions/catalog/google-sheets.md +700 -0
  73. package/dist/docs/pages/actions/catalog/hacker-news.md +542 -0
  74. package/dist/docs/pages/actions/catalog/http.md +824 -0
  75. package/dist/docs/pages/actions/catalog/hyperliquid.md +942 -0
  76. package/dist/docs/pages/actions/catalog/jira.md +920 -0
  77. package/dist/docs/pages/actions/catalog/kalshi.md +917 -0
  78. package/dist/docs/pages/actions/catalog/linear.md +1030 -0
  79. package/dist/docs/pages/actions/catalog/markets.md +21 -0
  80. package/dist/docs/pages/actions/catalog/morpho.md +247 -0
  81. package/dist/docs/pages/actions/catalog/notion.md +1077 -0
  82. package/dist/docs/pages/actions/catalog/nws.md +485 -0
  83. package/dist/docs/pages/actions/catalog/open-meteo.md +559 -0
  84. package/dist/docs/pages/actions/catalog/polymarket.md +1523 -0
  85. package/dist/docs/pages/actions/catalog/pushbullet.md +220 -0
  86. package/dist/docs/pages/actions/catalog/resend.md +307 -0
  87. package/dist/docs/pages/actions/catalog/s3.md +513 -0
  88. package/dist/docs/pages/actions/catalog/sec-edgar.md +487 -0
  89. package/dist/docs/pages/actions/catalog/slack.md +2629 -0
  90. package/dist/docs/pages/actions/catalog/stripe.md +1405 -0
  91. package/dist/docs/pages/actions/catalog/wikipedia.md +379 -0
  92. package/dist/docs/pages/actions/catalog.md +46 -0
  93. package/dist/docs/pages/actions/limits.md +50 -0
  94. package/dist/docs/pages/actions/model-tools.md +225 -0
  95. package/dist/docs/pages/actions/packs.md +148 -0
  96. package/dist/docs/pages/actions/settings.md +69 -0
  97. package/dist/docs/pages/actions/tools.md +244 -0
  98. package/dist/docs/pages/actions/triggers.md +149 -0
  99. package/dist/docs/pages/actions.md +88 -0
  100. package/dist/docs/pages/compat/anthropic.md +168 -0
  101. package/dist/docs/pages/compat/e2b.md +194 -0
  102. package/dist/docs/pages/compat/firecrawl.md +138 -0
  103. package/dist/docs/pages/compat/openai.md +168 -0
  104. package/dist/docs/pages/concepts/auth.md +151 -0
  105. package/dist/docs/pages/concepts/beta.md +55 -0
  106. package/dist/docs/pages/concepts/glossary.md +71 -0
  107. package/dist/docs/pages/concepts/ids.md +98 -0
  108. package/dist/docs/pages/concepts/jobs.md +229 -0
  109. package/dist/docs/pages/concepts/latency.md +138 -0
  110. package/dist/docs/pages/concepts/limits.md +191 -0
  111. package/dist/docs/pages/concepts/stack.md +59 -0
  112. package/dist/docs/pages/concepts/timing.md +86 -0
  113. package/dist/docs/pages/concepts/usage.md +110 -0
  114. package/dist/docs/pages/design/b3os-yaml.md +370 -0
  115. package/dist/docs/pages/design/deploy-from-github.md +122 -0
  116. package/dist/docs/pages/design/observability.md +134 -0
  117. package/dist/docs/pages/errors.md +1824 -0
  118. package/dist/docs/pages/infer/chat.md +570 -0
  119. package/dist/docs/pages/infer/limits.md +55 -0
  120. package/dist/docs/pages/infer/messages.md +185 -0
  121. package/dist/docs/pages/infer/responses.md +173 -0
  122. package/dist/docs/pages/infer/settings.md +154 -0
  123. package/dist/docs/pages/infer/speech.md +323 -0
  124. package/dist/docs/pages/infer.md +154 -0
  125. package/dist/docs/pages/introduction.md +162 -0
  126. package/dist/docs/pages/platform/addresses.md +174 -0
  127. package/dist/docs/pages/platform/call-log.md +99 -0
  128. package/dist/docs/pages/platform/custom-domains.md +104 -0
  129. package/dist/docs/pages/platform/keys.md +79 -0
  130. package/dist/docs/pages/platform/limits.md +57 -0
  131. package/dist/docs/pages/platform/members.md +101 -0
  132. package/dist/docs/pages/platform/requests.md +116 -0
  133. package/dist/docs/pages/platform/settings.md +129 -0
  134. package/dist/docs/pages/platform/webhooks.md +68 -0
  135. package/dist/docs/pages/platform.md +67 -0
  136. package/dist/docs/pages/quickstart/mcp.md +94 -0
  137. package/dist/docs/pages/quickstart/sandbox-agent.md +205 -0
  138. package/dist/docs/pages/quickstart/scrape.md +134 -0
  139. package/dist/docs/pages/quickstart.md +45 -0
  140. package/dist/docs/pages/render/inspections.md +162 -0
  141. package/dist/docs/pages/render/limits.md +72 -0
  142. package/dist/docs/pages/render/screenshots.md +179 -0
  143. package/dist/docs/pages/render/settings.md +431 -0
  144. package/dist/docs/pages/render/styles.md +342 -0
  145. package/dist/docs/pages/render/videos.md +272 -0
  146. package/dist/docs/pages/render.md +118 -0
  147. package/dist/docs/pages/routines/callables.md +174 -0
  148. package/dist/docs/pages/routines/definitions.md +361 -0
  149. package/dist/docs/pages/routines/limits.md +117 -0
  150. package/dist/docs/pages/routines/runs.md +328 -0
  151. package/dist/docs/pages/routines/settings.md +104 -0
  152. package/dist/docs/pages/routines/triggers.md +339 -0
  153. package/dist/docs/pages/routines.md +216 -0
  154. package/dist/docs/pages/sandboxes/agents.md +217 -0
  155. package/dist/docs/pages/sandboxes/commands.md +272 -0
  156. package/dist/docs/pages/sandboxes/images.md +166 -0
  157. package/dist/docs/pages/sandboxes/limits.md +143 -0
  158. package/dist/docs/pages/sandboxes/ports.md +260 -0
  159. package/dist/docs/pages/sandboxes/settings.md +358 -0
  160. package/dist/docs/pages/sandboxes/snapshots.md +423 -0
  161. package/dist/docs/pages/sandboxes/swarms.md +146 -0
  162. package/dist/docs/pages/sandboxes/volumes.md +131 -0
  163. package/dist/docs/pages/sandboxes.md +231 -0
  164. package/dist/docs/pages/sdks/cli.md +121 -0
  165. package/dist/docs/pages/sdks/mcp.md +169 -0
  166. package/dist/docs/pages/sdks/python.md +146 -0
  167. package/dist/docs/pages/sdks/typescript.md +202 -0
  168. package/dist/docs/pages/sdks.md +282 -0
  169. package/dist/docs/pages/settings.md +33 -0
  170. package/dist/docs/pages/vault/limits.md +46 -0
  171. package/dist/docs/pages/vault.md +133 -0
  172. package/dist/docs/pages/vision/agent-browser.md +115 -0
  173. package/dist/docs/pages/vision/crawl.md +333 -0
  174. package/dist/docs/pages/vision/extract.md +152 -0
  175. package/dist/docs/pages/vision/fetcher.md +15 -0
  176. package/dist/docs/pages/vision/limits.md +79 -0
  177. package/dist/docs/pages/vision/profiles.md +111 -0
  178. package/dist/docs/pages/vision/proxy.md +131 -0
  179. package/dist/docs/pages/vision/scrape.md +356 -0
  180. package/dist/docs/pages/vision/sessions.md +311 -0
  181. package/dist/docs/pages/vision/settings.md +656 -0
  182. package/dist/docs/pages/vision.md +175 -0
  183. package/dist/errors.d.ts +129 -0
  184. package/dist/errors.js +326 -0
  185. package/dist/errors.js.map +1 -0
  186. package/dist/main.d.ts +1 -1
  187. package/dist/main.js +26 -13
  188. package/dist/main.js.map +1 -1
  189. package/dist/manifest/apply.d.ts +4 -0
  190. package/dist/manifest/apply.js +2 -0
  191. package/dist/manifest/apply.js.map +1 -1
  192. package/dist/manifest/domains.d.ts +50 -0
  193. package/dist/manifest/domains.js +159 -0
  194. package/dist/manifest/domains.js.map +1 -0
  195. package/dist/manifest/link.d.ts +20 -0
  196. package/dist/manifest/link.js +24 -0
  197. package/dist/manifest/link.js.map +1 -0
  198. package/dist/manifest/record.d.ts +1 -1
  199. package/dist/tool/archive.d.ts +33 -0
  200. package/dist/tool/archive.js +174 -0
  201. package/dist/tool/archive.js.map +1 -0
  202. package/dist/tool/calls.d.ts +46 -0
  203. package/dist/tool/calls.js +274 -0
  204. package/dist/tool/calls.js.map +1 -0
  205. package/dist/tool/checks.d.ts +21 -0
  206. package/dist/tool/checks.js +145 -0
  207. package/dist/tool/checks.js.map +1 -0
  208. package/dist/tool/elf.d.ts +19 -0
  209. package/dist/tool/elf.js +107 -0
  210. package/dist/tool/elf.js.map +1 -0
  211. package/dist/tool/predict.d.ts +8 -0
  212. package/dist/tool/predict.js +38 -0
  213. package/dist/tool/predict.js.map +1 -0
  214. package/dist/tool/ustar.d.ts +5 -0
  215. package/dist/tool/ustar.js +220 -0
  216. package/dist/tool/ustar.js.map +1 -0
  217. package/package.json +6 -5
package/README.md CHANGED
@@ -10,6 +10,39 @@ and subcommands (`--lifetime`, `routine deploy`, ...) still work.
10
10
 
11
11
  Install `@b3os/cli` to get the `b3os` executable, or run a command with `npx -y @b3os/cli@0.2 <command>`.
12
12
 
13
+ ## Set up a machine and its agents
14
+
15
+ ```sh
16
+ npx -y @b3os/cli@0.2 init
17
+ ```
18
+
19
+ `init` runs five steps, each safe to run again (a step already in place says "already set"):
20
+
21
+ 1. **mcp**: the b3os MCP server in Claude Code, Cursor and Codex (those found, or `--client claude,codex`). The
22
+ entry holds no secret, so it comes first.
23
+ 2. **skill**: the B3OS skill in `~/.claude/skills/b3os` (Claude Code) and `~/.agents/skills/b3os` (Codex). A
24
+ b3os skill that b3os did not write, or that was edited, is left as it is. `--no-skill` skips it.
25
+ 3. **context**: a short, marked B3OS block (a command index, the output rules, how to check a result) in the
26
+ project's `AGENTS.md`, and in its `CLAUDE.md` when one there or above stops Claude Code reading `AGENTS.md`. It
27
+ is offered, not forced: on a terminal `init` asks; without one it writes the block only with `--yes`.
28
+ `--no-context` skips it. A later `init` replaces the block whole and leaves the rest of the file alone.
29
+ 4. **credential**: the key in use (`--api-key`, `B3OS_API_KEY`, the stored login), else the device login. On a
30
+ terminal it waits for the approval; without one, or in a coding agent's shell, it starts the login and exits 0
31
+ with the link and `b3os login --resume` as the next step (`--wait` to wait anyway, `--no-login` to skip it).
32
+ 5. **ping**: one authenticated call, with the first-call and warm times.
33
+
34
+ `--json` prints one summary: `{ok, status: ready|action_required|failed, steps: [{step, status, detail, ...}],
35
+ next}`.
36
+
37
+ `b3os setup agents` is init's agent half without the login (no network): the MCP entries, the skill and the
38
+ context block. It prints a plan and changes nothing without `--yes` (on a terminal it asks). `--project` also
39
+ writes the project's own files for everyone who works in it: `.mcp.json`, `.cursor/mcp.json`,
40
+ `.codex/config.toml`, the skill in `.claude/skills` and `.agents/skills`, and `.codex/rules/b3os.rules`. The rules
41
+ let `b3os` commands run outside Codex's sandbox, where they reach the network, and make Codex ask the person first
42
+ for `apply`, `keys`, `logout`, `app down` and the `rm` commands. Codex reads a project's `.codex` files once the
43
+ project is trusted. Check the rules with
44
+ `codex execpolicy check --pretty --rules .codex/rules/b3os.rules -- b3os whoami`.
45
+
13
46
  ```sh
14
47
  npm install --global @b3os/cli@0.2
15
48
  b3os login # device login; stores a CLI token
@@ -31,12 +64,27 @@ operations go. Inside a B3OS sandbox node operations use `B3OS_API_URL`. On a no
31
64
  when `B3OS_SOCKET` is set, or when no key and no base URL are configured; over the socket the command acts as the
32
65
  principal your uid maps to, not as a key's (see the SDK README for the routing rules).
33
66
 
34
- `b3os login` runs the RFC 8628 device flow: it prints the dashboard URL and the code to confirm (and opens a browser
35
- when there is a terminal), then polls until you approve. A poll that fails on the way (lost connection, timeout,
36
- 5xx) is repeated, up to five in a row; a denied or expired code ends the login (exit 3). The token is never printed.
37
- `--scope vision:run,sandboxes:*` asks for fewer scopes. The token lasts 30 days. `b3os logout` revokes it on the
38
- server and removes the file; if the server cannot be reached, it keeps the file, so you can run it again, and exits
39
- non-zero. `--local` only removes the file, and the token works until it expires.
67
+ `b3os login` runs the RFC 8628 device flow. The beta is invite-only: a new account enters an invite code after
68
+ signing in, and login says so before it starts. On a terminal it prints the dashboard URL and the code to confirm
69
+ (and opens a browser), then polls until you approve. A poll that fails on the way (lost connection, timeout, 5xx) is
70
+ repeated, up to five in a row; a denied or expired code ends the login (exit 3). The token is never printed.
71
+ `--scope vision:run,sandboxes:*` asks for fewer scopes. The token lasts 30 days.
72
+
73
+ Without a terminal, or in a coding agent's shell (Claude Code, Codex), login never waits: it acts as `--no-wait`.
74
+
75
+ ```sh
76
+ b3os login --no-wait --json # {status, verification_url, user_code, expires_at, next}; exits 0
77
+ b3os login --resume # after a person approved it: stores the token (waits up to --timeout-s, 90 s)
78
+ printf %s "$KEY" | b3os login --with-key # store an API key from stdin, checked first
79
+ ```
80
+
81
+ `--resume` exits 8 when the wait ends first; the code stays valid until `expires_at`, so run it again. `--wait`
82
+ makes a login without a terminal wait anyway. `--with-key` stores the key in the same file, where the CLI, the MCP
83
+ server and the SDKs find it; it never takes the key from the command line.
84
+
85
+ `b3os logout` revokes the token on the server and removes the file; if the server cannot be reached, it keeps the
86
+ file, so you can run it again, and exits non-zero. `--local` only removes the file, and the token works until it
87
+ expires. A key stored with `--with-key` is only removed, never revoked: it was made elsewhere.
40
88
 
41
89
  A routine you publish while signed in runs as the token, and its triggers pause when the token is revoked or
42
90
  expires; a key you create while signed in cannot outlive it. Publish routines and make CI keys with an API key from
@@ -47,7 +95,10 @@ routines that run as it and asks before it revokes the token (`--yes` without a
47
95
 
48
96
  | Command | What it does |
49
97
  |---|---|
50
- | `login`, `logout`, `whoami` | device login, revoke and remove the stored token, show the credential in use |
98
+ | `docs [PAGE]`, `docs search WORDS` | the docs, bundled with the CLI (they match its version): every page by area, one page as Markdown (`--out FILE`), or the pages that match, with their lines; no network or login |
99
+ | `doctor [--offline]` | checks this machine's setup (the CLI against npm's latest, the credential, whether the API answers from here, the MCP entries, the skill, the context block, a coding agent's sandbox) and gives the command that fixes each problem; no login, never prompts, exit 0 when the checks ran (`--json`: `checks[].status`, `checks[].next`) |
100
+ | `setup agents [--project]` | the MCP entries, the B3OS skill, the context block and (with `--project`) Codex rules, without a login |
101
+ | `login`, `logout`, `whoami` | device login (`--no-wait`, `--resume`, `--with-key`), revoke and remove the stored token, show the credential in use |
51
102
  | `keys ls\|create\|get\|update\|revoke` | API keys and CLI tokens (`ls --kind api_key\|cli_token`; `create --name ci --scope vision:run,sandboxes:*` prints the secret once; signed in with `b3os login`, `--expires-at` defaults to the CLI token's expiry and may not be later; `--spend-cap-usd`, `--project-id`) |
52
103
  | `scrape <url>` | `vision.scrape`; `--format markdown\|html\|raw_html\|text\|links\|json`, `--all-content`, `--engine`, `--wait-for-ms`, `--max-age-ms` or `--no-cache`, `--header K=V`, `--respect-robots` (check robots.txt first; off by default, decision D10), `--out` |
53
104
  | `scrape <url> <url> …` | one batch job with the same options: waits and prints each page as Markdown (`--max-concurrency N`, `--out FILE` JSON lines, `--no-wait` prints the `batch_` id) |
@@ -80,6 +131,7 @@ routines that run as it and asks before it revokes the token (`--yes` without a
80
131
  | `requests [ls\|get <req_id>]` | your request log with timing (`--status 2xx\|4xx\|5xx`, `--product`, `--operation-id`, `--sandbox-id`, `--since`) |
81
132
  | `webhooks secret\|rotate\|test\|deliveries --url URL` | webhook signing secrets (printed once on stdout), rotation with a grace period, a signed test delivery |
82
133
  | `action search\|describe\|call` | marketplace actions (`call io.b3os/github/create-issue@1 --input @issue.json`) |
134
+ | `tool init\|dev\|publish\|rm\|yank\|health\|earnings` | hosted tools (a preview; publishing needs the flag `actions.tools_publish` and a key with `actions:tools:publish`, named exactly, and `actions:write`): `init <dir> --from-binary <path> --call '<key>: <command line>'` writes a tool around a Linux x86-64 binary in your organization's `org.` namespace (`{x}`, `{x:int}`, `{x:file}` inputs, `{out:<file>}` outputs); `publish [dir]` packs, checks, publishes, waits for the node, calls the first fixture and prints the pins, a curl line and the MCP URL (a signed `<dir>/dist/` from `node packages/packs/src/cli/tool.ts build` is uploaded as it is; `--format tar\|tar.gz`, `--no-call`); `dev [dir] --input JSON` publishes a dev version and calls it once, with the tool's stderr on failure; `rm <pack>[@<version>]`, `yank <pack>@<version> [--undo]`; `health --namespace NS [--pack P] [--hours N]` per hour; `earnings --namespace NS --period YYYY-MM` the month's earnings line with B3OS's rate and why |
83
135
  | `mcp install --client claude\|cursor\|codex` | adds the B3OS MCP server to the client (below) |
84
136
  | `mcp serve [--packs a,b] [--routines a,b\|all] [--toolsets a,b]` | the stdio MCP server in this process |
85
137
  | `mcp tools [--toolsets a,b]` | the tools the server lists (the shared table both MCP servers serve) |
@@ -111,6 +163,34 @@ routines that run as it and asks before it revokes the token (`--yes` without a
111
163
  line plus validation items, or with `--json` a `{"error": {code, status, title, detail, type, request_id, errors}}`
112
164
  object.
113
165
 
166
+ ## Errors
167
+
168
+ Errors go to stderr. Without `--json` they are plain lines with no colour or terminal codes, and a step to take next
169
+ when there is one:
170
+
171
+ ```
172
+ $ b3os sandbx ls
173
+ error: unknown command "sandbx". Did you mean b3os sandbox?
174
+ Next: b3os sandbox ls (the closest command to "sandbx")
175
+ Next: b3os --help (lists the commands)
176
+ ```
177
+
178
+ With `--json` an error is one line, `{"error": {...}}`. It keeps every field 0.2.1 printed (`code`, `status`,
179
+ `title`, `detail`, `type`, `request_id`, `errors`, `hint`) and adds, from schema `b3os.error/1`:
180
+
181
+ | Field | Meaning |
182
+ |---|---|
183
+ | `schema` | `b3os.error/1`; an added field is never removed or retyped without a new version |
184
+ | `message` | the CLI's own words for what went wrong; never text from the API or a remote program |
185
+ | `next` | steps to take: `{"run": [argv], "why", "who"}` or `{"open": "https://….b3os.org/…", "why", "who": "human"}`; `who` is `agent` unless a person must do it |
186
+ | `retryable` | true when running the same command again, unchanged, may work and cannot repeat an effect (429 and the 503s the catalog marks; never a 500 or a lost answer) |
187
+ | `user_action_required` | true when a person has to act first: sign in, approve, add credits, grant a scope, say yes |
188
+ | `data` | facts the CLI adds to its own errors |
189
+
190
+ `message`, `next` and `hint` are only ever the CLI's own text; the API's stays in `title`, `detail` and `errors`. A
191
+ next step never suggests a flag that skips a safety check. A confirmation without a terminal fails with the code
192
+ `confirmation_required` and `user_action_required: true` (exit 2, as before): ask the person, then pass `--yes`.
193
+
114
194
  ## MCP install
115
195
 
116
196
  `b3os mcp install --client claude|cursor|codex [--scope user|project] [--packs github,slack] [--routines daily-digest|all] [--toolsets routines]`
@@ -0,0 +1,137 @@
1
+ #!/usr/bin/python3 -I
2
+ # b3os-run: the stock wrapper of a hosted tool made with `b3os tool init --from-binary` (packages/cli, slice B).
3
+ #
4
+ # The node runs it in the tool's VM as `/tool/bin/b3os-run <action key>` with the json-stdio request on stdin
5
+ # (packages/spec/schemas/README.md, "Hosted tools: the json-stdio call"). It reads /tool/calls.json, which init
6
+ # wrote from --call, fills the action's argv template from the request's input, runs the tool's binary with no
7
+ # shell, and writes one JSON answer as its last line of stdout:
8
+ #
9
+ # {x} the string input x, as one argument
10
+ # {x:int} the integer input x
11
+ # {x:file} the path of the input file x (/in/x/<name>); {x:file=application/pdf} names its media type
12
+ # {out:<file>} the path /out/<file>, which the binary writes: the output field named after the file
13
+ # {{ and }} a literal { and }
14
+ #
15
+ # Without an {out:...} in the template, the binary's stdout is the output `stdout`. A binary that exits non-zero
16
+ # makes the wrapper exit with the same status (a signal, the same signal), its stderr passed through: the node
17
+ # answers 502 tool_failed (exit or signal) and, for an org-private tool, returns the first 4 KiB of stderr. The
18
+ # wrapper's own error codes are bad_input, output_missing and stdout_too_large (the manifest's tool.errors).
19
+ #
20
+ # Python standard library only; no shell is ever started. B3OS_RUN_OUT replaces /out for a test outside a VM (the
21
+ # VM has no B3OS_* variables).
22
+
23
+ import json
24
+ import os
25
+ import re
26
+ import signal
27
+ import subprocess
28
+ import sys
29
+
30
+ TOKEN = re.compile(
31
+ r"\{\{|\}\}"
32
+ r"|\{out:([A-Za-z0-9][A-Za-z0-9._-]{0,127})\}"
33
+ r"|\{([A-Za-z_][A-Za-z0-9_]{0,63})(?::(int|file(?:=[^{}]+)?))?\}"
34
+ )
35
+ # The node reads at most 1 MiB of stdout; the answer line stays under it.
36
+ ANSWER_MAX = 1024 * 1024 - 1
37
+
38
+
39
+ def answer(obj):
40
+ line = json.dumps(obj, ensure_ascii=False, separators=(",", ":"))
41
+ sys.stdout.write(line + "\n")
42
+ sys.stdout.flush()
43
+
44
+
45
+ def refuse(code, message):
46
+ answer({"error": {"code": code, "message": message, "retryable": False}})
47
+ sys.exit(0)
48
+
49
+
50
+ def field_of(name):
51
+ """The output field an {out:<file>} fills: the file name before its first dot, as a field name."""
52
+ stem = re.sub(r"[^A-Za-z0-9_]", "_", name.split(".", 1)[0]) or "file"
53
+ return stem if re.match(r"[A-Za-z_]", stem) else "f_" + stem
54
+
55
+
56
+ def fill(word, given, out_dir, outputs):
57
+ def one(m):
58
+ whole = m.group(0)
59
+ if whole == "{{":
60
+ return "{"
61
+ if whole == "}}":
62
+ return "}"
63
+ if m.group(1) is not None:
64
+ outputs[field_of(m.group(1))] = m.group(1)
65
+ return os.path.join(out_dir, m.group(1))
66
+ name, kind = m.group(2), m.group(3) or "string"
67
+ if name not in given:
68
+ refuse("bad_input", "input." + name + " is missing")
69
+ v = given[name]
70
+ if kind == "int":
71
+ if isinstance(v, bool) or not isinstance(v, int):
72
+ refuse("bad_input", "input." + name + " is not an integer")
73
+ return str(v)
74
+ if kind.startswith("file"):
75
+ if not isinstance(v, dict) or not isinstance(v.get("path"), str):
76
+ refuse("bad_input", "input." + name + " is not a file")
77
+ return v["path"]
78
+ if not isinstance(v, str):
79
+ refuse("bad_input", "input." + name + " is not a string")
80
+ return v
81
+
82
+ text = TOKEN.sub(one, word)
83
+ if "\0" in text:
84
+ refuse("bad_input", "an argument holds a NUL character")
85
+ return text
86
+
87
+
88
+ def main():
89
+ if len(sys.argv) != 2:
90
+ sys.stderr.write("usage: b3os-run <action key> (the json-stdio request on stdin)\n")
91
+ sys.exit(2)
92
+ key = sys.argv[1]
93
+ root = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
94
+ with open(os.path.join(root, "calls.json"), encoding="utf-8") as f:
95
+ spec = json.load(f)
96
+ template = spec.get("calls", {}).get(key)
97
+ if not isinstance(template, list):
98
+ refuse("bad_input", "this tool has no action " + key)
99
+ request = json.load(sys.stdin)
100
+ given = request.get("input") or {}
101
+ out_dir = os.environ.get("B3OS_RUN_OUT", "/out")
102
+ outputs = {}
103
+ argv = [os.path.join(root, spec["bin"])]
104
+ argv += [fill(w, given, out_dir, outputs) for w in template]
105
+ sys.stderr.flush()
106
+ p = subprocess.run(argv, stdin=subprocess.DEVNULL, stdout=subprocess.PIPE, check=False)
107
+ if p.returncode < 0:
108
+ sig = -p.returncode
109
+ try:
110
+ signal.signal(sig, signal.SIG_DFL)
111
+ except (OSError, ValueError):
112
+ pass # SIGKILL and SIGSTOP keep their default anyway
113
+ os.kill(os.getpid(), sig)
114
+ sys.exit(128 + sig)
115
+ if p.returncode != 0:
116
+ sys.exit(p.returncode)
117
+ if outputs:
118
+ result = {}
119
+ for field, name in outputs.items():
120
+ path = os.path.join(out_dir, name)
121
+ if not os.path.isfile(path):
122
+ refuse("output_missing", os.path.basename(spec["bin"]) + " wrote no " + path)
123
+ result[field] = {"path": path}
124
+ else:
125
+ result = {"stdout": p.stdout.decode("utf-8", errors="replace")}
126
+ line = json.dumps({"output": result}, ensure_ascii=False, separators=(",", ":"))
127
+ if len(line.encode("utf-8")) > ANSWER_MAX:
128
+ refuse(
129
+ "stdout_too_large",
130
+ "stdout is " + str(len(p.stdout)) + " bytes, more than one answer holds; write it to a file with {out:<file>}",
131
+ )
132
+ sys.stdout.write(line + "\n")
133
+ sys.stdout.flush()
134
+
135
+
136
+ if __name__ == "__main__":
137
+ main()
@@ -0,0 +1,111 @@
1
+ ---
2
+ name: b3os
3
+ description: "Use B3OS beta from an agent: scrape and crawl web pages, take screenshots and render videos, run code in sandboxes, run durable routines, call third-party APIs through signed action packs and call the node's models, over REST, the TypeScript or Python SDK, the CLI or MCP. Use it when a task needs a browser, a sandbox, a schedule or a third-party API and B3OS_API_KEY is set or can be created."
4
+ ---
5
+
6
+ # B3OS beta
7
+
8
+ B3OS runs browsers, render, sandboxes, routines, actions and inference on the node that serves the model. Docs: https://docs.beta.b3os.org. API: https://beta-api.b3os.org.
9
+
10
+ ## Set up
11
+
12
+ 1. Run `npx -y @b3os/cli@0.2 init` in the project. It adds the B3OS MCP server to Claude Code, Cursor and Codex, installs this skill, offers a short B3OS block for the project's AGENTS.md, then signs in. Each step is safe to run again; `--json` prints one summary with each step's status and the next steps.
13
+ 2. The sign-in never waits on a person: without a terminal, `init` (like `b3os login`) prints a link and a code and exits. Show the person the link (`verification_url` with `--json`); after they approve it, run `b3os login --resume`. The beta is invite-only: a new account needs an invite code (https://beta.b3os.org/app). If the CLI says `--no-wait` or `--resume` is unknown, it is 0.2.1: ask the person to run `npx -y @b3os/cli@0.2 login` in their own terminal.
14
+ 3. If the person gives you an API key instead, store it with `printf %s "$KEY" | b3os login --with-key`, where the CLI, the MCP server and the SDKs find it, or set `B3OS_API_KEY` in the agent's environment. A key for an agent should have only the scopes it needs and an expiry (https://docs.beta.b3os.org/platform/keys.md). Never pass a key on a command line or write it into a committed file.
15
+ 4. Check: `b3os whoami --json` names the organization, the project and the scopes.
16
+
17
+ ## CLI
18
+
19
+ Run `b3os`, or `npx -y @b3os/cli@0.2 <command>` where it is not installed. B3OS is newer than your training data: read `b3os <command> --help` instead of guessing a flag.
20
+
21
+ - The docs, offline and matching the CLI's version: `b3os docs search WORDS`, then `b3os docs PAGE` (`--out FILE` saves it).
22
+ - Read a page: `b3os scrape URL > page.md` (Markdown on stdout). Many pages of a site: `b3os crawl URL --limit 20 --out pages.jsonl`.
23
+ - Screenshot: `b3os screenshot URL --out shot.png` (`--full-page`, `--width W --height H`).
24
+ - Sandbox: `ID=$(b3os sandbox create)`, then `b3os sandbox exec "$ID" -- python3 -c 'print(1)'`, and `b3os sandbox rm "$ID" --yes` when done. A command that fails inside exits 10 (`--exit-code` passes its own code through).
25
+ - Deploy an app: write `b3os.yaml`, then `b3os manifest validate`, `b3os apply --dry-run` and `b3os apply --yes`; `b3os app status --json` gives its address and `b3os app logs` its output.
26
+ - Routines: `b3os routine publish flow.yaml`, then `b3os routine run NAME`.
27
+ - Third-party APIs: `b3os action search "create issue"`, `b3os action describe REF`, `b3os action call REF --input @input.json`.
28
+ - Models: `b3os infer models`, `b3os infer chat "PROMPT"`.
29
+
30
+ Rules for agents:
31
+
32
+ - `--json` gives machine-readable stdout. An error is one JSON object on stderr. Exit codes: 0 ok, 2 usage, 3 auth, 4 not found, 5 invalid or conflict, 6 rate limited or out of credits, 7 server, 8 timeout, 9 connection, 10 job or remote command failed.
33
+ - Write large output to files (`--out FILE`, or `> file`) and read only the part you need.
34
+ - Nothing prompts without a terminal: a destructive command needs `--yes`.
35
+ - Check a result before you report success: look at the screenshot, read the scrape, check the exit code, fetch the deployed address.
36
+ - Remove what you made and no longer need: `b3os sandbox rm ID --yes`, `b3os app down APP --yes`.
37
+
38
+ ## MCP
39
+
40
+ - Remote: `https://beta-api.b3os.org/mcp`, stateless Streamable HTTP, with the key as a bearer token (for Claude Code: `claude mcp add --transport http b3os https://beta-api.b3os.org/mcp --header 'Authorization: Bearer ${B3OS_API_KEY}'`, which keeps the key out of the config file).
41
+ - Local: `npx -y @b3os/mcp@0.2` over stdio, reading `B3OS_API_KEY`, else the stored `b3os login`.
42
+ - Tool names start with the product they call (`vision_scrape`, `render_screenshot`, `sandbox_exec`); https://docs.beta.b3os.org/sdks/mcp.md lists them.
43
+
44
+ ## Which product
45
+
46
+ - A web page's content, links or structured data: vision (`POST /v1/vision/scrape`, crawl and map for many pages).
47
+ - A screenshot or a video of a page: render.
48
+ - Running code, a shell or a dev server: sandboxes.
49
+ - Work on a schedule, on a webhook or across many steps that must survive restarts: routines.
50
+ - A third-party API (GitHub, Slack, Stripe and others) with a stored connection: actions.
51
+ - A model call next to the tools: infer (OpenAI-compatible chat).
52
+
53
+ ## Read more
54
+
55
+ - https://beta.b3os.org/llms.txt: the index of the files below.
56
+ - https://beta.b3os.org/llms-start.txt: Start: introduction, quickstarts and concepts (10 pages).
57
+ - https://beta.b3os.org/llms-vision.txt: Vision: scrape, crawl, sessions and profiles (13 pages).
58
+ - https://beta.b3os.org/llms-render.txt: Render: screenshots and videos (7 pages).
59
+ - https://beta.b3os.org/llms-sandboxes.txt: Sandboxes: microVMs for code (12 pages).
60
+ - https://beta.b3os.org/llms-routines.txt: Routines: durable workflows (7 pages).
61
+ - https://beta.b3os.org/llms-actions.txt: Actions and triggers: third-party APIs (42 pages).
62
+ - https://beta.b3os.org/llms-infer.txt: Infer: the node's models (9 pages).
63
+ - https://beta.b3os.org/llms-vault.txt: Vault: stored connections (2 pages).
64
+ - https://beta.b3os.org/llms-platform.txt: Platform: keys, webhooks, requests, limits and errors (18 pages).
65
+ - https://beta.b3os.org/llms-sdks.txt: SDKs: TypeScript, Python, CLI and MCP (5 pages).
66
+ - https://beta.b3os.org/llms-api-vision.txt: every vision API operation.
67
+ - https://beta.b3os.org/llms-api-render.txt: every render API operation.
68
+ - https://beta.b3os.org/llms-api-sandboxes.txt: every sandboxes API operation.
69
+ - https://beta.b3os.org/llms-api-images.txt: every images API operation.
70
+ - https://beta.b3os.org/llms-api-agents.txt: every agents API operation.
71
+ - https://beta.b3os.org/llms-api-routines.txt: every routines API operation.
72
+ - https://beta.b3os.org/llms-api-listeners.txt: every listeners API operation.
73
+ - https://beta.b3os.org/llms-api-actions.txt: every actions API operation.
74
+ - https://beta.b3os.org/llms-api-vault.txt: every vault API operation.
75
+ - https://beta.b3os.org/llms-api-infer.txt: every infer API operation.
76
+ - https://beta.b3os.org/llms-api-platform.txt: every platform API operation.
77
+ - https://beta.b3os.org/llms-api-compat-e2b.txt: every compat-e2b API operation.
78
+ - https://beta-api.b3os.org/openapi.json: the OpenAPI document.
79
+
80
+ ## Recipes
81
+
82
+ - Agents with tools:
83
+ - [Render a page, read it, act on what it read](https://docs.beta.b3os.org/cookbook/render-read-act.md): From a sandbox: render captures a pricing page, the node's model reads the image and names a control, and vision presses it and reads the new price.
84
+ - [A sandboxed agent drives a browser](https://docs.beta.b3os.org/cookbook/sandbox-agent-browser.md): Code in a sandbox opens a browser session and lets the node's model read and click a page until it answers, every turn timed next to the model.
85
+ - [A sandboxed agent calls the model and a tool](https://docs.beta.b3os.org/cookbook/sandbox-agent-weather.md): Code in a sandbox granted infer:run and actions:run calls the model and the Open-Meteo action with no key, timed from inside the sandbox.
86
+ - [Fork a sandbox and let a model try three fixes](https://docs.beta.b3os.org/cookbook/sandbox-fork-best-of-n-fixes.md): A sandbox with failing tests forks into three copies; each asks the node's model for a fix at its own temperature and runs the tests on it.
87
+ - [A model writes code, a sandbox runs its tests](https://docs.beta.b3os.org/cookbook/sandbox-model-writes-tested-code.md): A sandbox with infer:run and no internet asks the node's model for a function, runs the tests on it and sends failures back, at most three times.
88
+ - [Screenshot a page an agent built in a sandbox](https://docs.beta.b3os.org/cookbook/sandbox-preview-screenshot.md): The model writes an HTML page, a sandbox with no network serves it on a declared port, and render captures the sandbox's preview URL.
89
+ - [A sandboxed agent answers out loud](https://docs.beta.b3os.org/cookbook/sandbox-voice-agent.md): Code in a sandbox lets the node's model read a page through vision and speaks its answer from the first sentence, timed from the question to the first audio.
90
+ - Videos and images:
91
+ - [A prediction market's week as an image](https://docs.beta.b3os.org/cookbook/market-brief-card.md): Two Polymarket actions read an open bitcoin market and its week of prices, the model writes one sentence, and render draws the card from HTML.
92
+ - [A narrated app tour, scripted from what vision saw](https://docs.beta.b3os.org/cookbook/narrated-page-tour.md): Vision tries a page's tabs, buttons and links, the model scripts beats from what they showed, and render records the tour with a voice and captions.
93
+ - [Record a server running in a sandbox](https://docs.beta.b3os.org/cookbook/sandbox-port-video.md): A sandbox serves a page and a /run endpoint on a declared port, and render records it through the preview URL while the button runs commands in the VM.
94
+ - [Scrape a page, then screenshot its links](https://docs.beta.b3os.org/cookbook/scrape-to-screenshots.md): vision returns the demo board's links; render captures each linked page in a styled browser frame. One key, two products, no glue service.
95
+ - [Transform a file where it lives](https://docs.beta.b3os.org/cookbook/transform-file-in-place.md): Derive a file where it already is: four encodings from one render capture, Pillow in a code-interpreter sandbox, and a routine step on that sandbox.
96
+ - Data pipelines:
97
+ - [Forecasts charted in a sandbox, framed by render](https://docs.beta.b3os.org/cookbook/forecast-chart-card.md): An Open-Meteo action reads 72 hours for three places, pandas and matplotlib chart them in a sandbox with no network, and render frames the card in a laptop.
98
+ - [A Hacker News story as audio](https://docs.beta.b3os.org/cookbook/news-audio-brief.md): An action reads a pinned Hacker News story, vision reads the page it links, the model writes three sentences and the node's speech model reads them out.
99
+ - [A routine that scrapes, briefs and screenshots](https://docs.beta.b3os.org/cookbook/routine-page-brief.md): One routine runs vision/scrape@1, infer/chat@1 and render/screenshot@1 on the node: a one-sentence brief and a styled screenshot, no glue code.
100
+ - Monitor and alert:
101
+ - [Daily page digest to Slack](https://docs.beta.b3os.org/cookbook/cron-scrape-slack.md): A routine on a daily cron scrapes a page, writes a three-bullet digest with b3os/qwen3.5-9b and posts it to Slack.
102
+ - [A signed webhook starts a scrape and a brief](https://docs.beta.b3os.org/cookbook/signed-webhook-brief.md): A routine with a b3os webhook trigger scrapes the URL a signed delivery names and briefs it; a repeat starts nothing and a wrong signature gets 401.
103
+ - CI and dev workflows:
104
+ - [Run an outside PR's tests with no network](https://docs.beta.b3os.org/cookbook/untrusted-pr-tests.md): Fetch an outside PR into a sandbox, install from npm only, run its tests with egress denied, check its dependencies with deps.dev and get a note.
105
+ - Approvals:
106
+ - [Approve, then screenshot](https://docs.beta.b3os.org/cookbook/approve-then-screenshot.md): A routine scrapes a page, waits for a person's approval as a signal, and only then takes a screenshot of it.
107
+ - [Approve from Slack with buttons](https://docs.beta.b3os.org/cookbook/slack-approval-buttons.md): A routine posts a screenshot to Slack with Approve and Reject buttons and continues when a person presses one, with no API key and no Slack request URL.
108
+
109
+ ## The docs in numbers
110
+
111
+ The docs navigation has 153 pages (Start 27, Products 96, Cookbook 21, Integrations 3, API Reference 1, SDKs 5) and the API reference 381 generated operation pages.
@@ -0,0 +1,14 @@
1
+ export type AgentName = "claude-code" | "codex" | string;
2
+ export interface AgentEnv {
3
+ /** The agent whose shell this is, or null when none is detected. */
4
+ agent: AgentName | null;
5
+ /** Codex says its sandbox has no network (CODEX_SANDBOX_NETWORK_DISABLED=1). */
6
+ networkDisabled: boolean;
7
+ }
8
+ /** The agent running this process, read from `env`. */
9
+ export declare function detectAgent(env?: NodeJS.ProcessEnv): AgentEnv;
10
+ /**
11
+ * True when nobody can answer a prompt or watch a wait: no terminal, or a coding agent's shell (Codex may give its
12
+ * commands a pseudo-terminal, so a TTY alone does not mean a person is there).
13
+ */
14
+ export declare function cannotWait(isTTY: boolean, env?: NodeJS.ProcessEnv): boolean;
@@ -0,0 +1,33 @@
1
+ // Which coding agent runs this process, from the variables each one sets in the commands it starts. Used to decide
2
+ // that a step must not wait on a person (login, init), and by doctor to say where it runs.
3
+ //
4
+ // Sources (read 2026-11-26):
5
+ // - Claude Code: https://code.claude.com/docs/en/env-vars.md. CLAUDECODE=1 is set in every subprocess Claude Code
6
+ // spawns and also in IDE extensions' integrated terminals, where a person types; CLAUDE_CODE_CHILD_SESSION=1 only
7
+ // in processes Claude Code itself starts (its Bash tool, hooks). So only the second one means "an agent runs this".
8
+ // - Codex: CODEX_SANDBOX (the sandbox kind, e.g. "seatbelt"), CODEX_THREAD_ID, CODEX_CI, and
9
+ // CODEX_SANDBOX_NETWORK_DISABLED=1 when its sandbox has no network (@vercel/detect-agent's list, from Codex's own
10
+ // source).
11
+ // - AI_AGENT=<name>: the generic override other tools read. Claude Code sets it too (claude-code_<version>_agent).
12
+ const set = (v) => v !== undefined && v !== "" && v !== "0" && v.toLowerCase() !== "false";
13
+ /** The agent running this process, read from `env`. */
14
+ export function detectAgent(env = process.env) {
15
+ const networkDisabled = env.CODEX_SANDBOX_NETWORK_DISABLED === "1";
16
+ let agent = null;
17
+ if (set(env.CLAUDE_CODE_CHILD_SESSION))
18
+ agent = "claude-code";
19
+ else if (set(env.CODEX_SANDBOX) || set(env.CODEX_THREAD_ID) || set(env.CODEX_CI) || networkDisabled)
20
+ agent = "codex";
21
+ // Claude Code sets AI_AGENT to its name, version and kind (claude-code_2-1-332_agent): keep the name.
22
+ else if (set(env.AI_AGENT))
23
+ agent = String(env.AI_AGENT).trim().toLowerCase().split(/[_\s]/)[0] || null;
24
+ return { agent, networkDisabled };
25
+ }
26
+ /**
27
+ * True when nobody can answer a prompt or watch a wait: no terminal, or a coding agent's shell (Codex may give its
28
+ * commands a pseudo-terminal, so a TTY alone does not mean a person is there).
29
+ */
30
+ export function cannotWait(isTTY, env = process.env) {
31
+ return !isTTY || detectAgent(env).agent !== null;
32
+ }
33
+ //# sourceMappingURL=_agents.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"_agents.js","sourceRoot":"","sources":["../../src/commands/_agents.ts"],"names":[],"mappings":"AAAA,mHAAmH;AACnH,2FAA2F;AAC3F,EAAE;AACF,6BAA6B;AAC7B,kHAAkH;AAClH,oHAAoH;AACpH,sHAAsH;AACtH,6FAA6F;AAC7F,oHAAoH;AACpH,aAAa;AACb,mHAAmH;AAWnH,MAAM,GAAG,GAAG,CAAC,CAAqB,EAAE,EAAE,CAAC,CAAC,KAAK,SAAS,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,CAAC,WAAW,EAAE,KAAK,OAAO,CAAC;AAE/G,uDAAuD;AACvD,MAAM,UAAU,WAAW,CAAC,MAAyB,OAAO,CAAC,GAAG;IAC9D,MAAM,eAAe,GAAG,GAAG,CAAC,8BAA8B,KAAK,GAAG,CAAC;IACnE,IAAI,KAAK,GAAqB,IAAI,CAAC;IACnC,IAAI,GAAG,CAAC,GAAG,CAAC,yBAAyB,CAAC;QAAE,KAAK,GAAG,aAAa,CAAC;SACzD,IAAI,GAAG,CAAC,GAAG,CAAC,aAAa,CAAC,IAAI,GAAG,CAAC,GAAG,CAAC,eAAe,CAAC,IAAI,GAAG,CAAC,GAAG,CAAC,QAAQ,CAAC,IAAI,eAAe;QAAE,KAAK,GAAG,OAAO,CAAC;IACrH,sGAAsG;SACjG,IAAI,GAAG,CAAC,GAAG,CAAC,QAAQ,CAAC;QAAE,KAAK,GAAG,MAAM,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC;IACxG,OAAO,EAAE,KAAK,EAAE,eAAe,EAAE,CAAC;AACpC,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,UAAU,CAAC,KAAc,EAAE,MAAyB,OAAO,CAAC,GAAG;IAC7E,OAAO,CAAC,KAAK,IAAI,WAAW,CAAC,GAAG,CAAC,CAAC,KAAK,KAAK,IAAI,CAAC;AACnD,CAAC"}
@@ -1,7 +1,7 @@
1
1
  // Helpers the command modules share (platform-dx). Not a command: main.ts never lists a file whose name starts
2
2
  // with an underscore.
3
3
  import { readFileSync } from "node:fs";
4
- import { EXIT, jsonFlag, UsageError } from "../ctx.js";
4
+ import { EXIT, jsonFlag, runStep, UsageError } from "../ctx.js";
5
5
  import { orList, suggest } from "../suggest.js";
6
6
  /**
7
7
  * A list of scopes, written one way everywhere (`--scope vision:run,sandboxes:*`): commas, and spaces too for the
@@ -114,7 +114,11 @@ export function usageOf(text, sub) {
114
114
  */
115
115
  export function unknownSub(group, sub, known) {
116
116
  const near = suggest(sub, typeof known === "string" ? subcommands(known) : known);
117
- return new UsageError(`unknown ${group} command "${sub}"${near.length ? `. Did you mean ${orList(near)}?` : ""}`, `b3os ${group} --help lists its commands`);
117
+ const words = group.split(" ");
118
+ return new UsageError(`unknown ${group} command "${sub}"${near.length ? `. Did you mean ${orList(near)}?` : ""}`, undefined, [
119
+ ...near.map((n) => runStep(["b3os", ...words, n, "--help"], `how to use ${group} ${n}`)),
120
+ runStep(["b3os", ...words, "--help"], "lists its commands"),
121
+ ]);
118
122
  }
119
123
  const IMAGE_EXTENSIONS = { webp: "webp", png: "png", jpg: "jpeg", jpeg: "jpeg" };
120
124
  const IMAGE_NAMES = { webp: "WebP", png: "PNG", jpeg: "JPEG" };
@@ -1 +1 @@
1
- {"version":3,"file":"_common.js","sourceRoot":"","sources":["../../src/commands/_common.ts"],"names":[],"mappings":"AAAA,+GAA+G;AAC/G,sBAAsB;AAEtB,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAEvC,OAAO,EAAY,IAAI,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AACjE,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAEhD;;;GAGG;AACH,MAAM,UAAU,SAAS,CAAC,CAAU,EAAE,IAAY;IAChD,IAAI,CAAC,KAAK,SAAS;QAAE,OAAO,SAAS,CAAC;IACtC,MAAM,IAAI,GAAG,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;IACpG,IAAI,CAAC,IAAI,CAAC,MAAM;QAAE,MAAM,IAAI,UAAU,CAAC,GAAG,IAAI,4CAA4C,CAAC,CAAC;IAC5F,OAAO,CAAC,GAAG,IAAI,GAAG,CAA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C,KAAK,SAAS;QAAE,OAAO,SAAS,CAAC;IACtC,IAAI,CAAE,YAAmC,CAAC,QAAQ,CAAC,CAAC,CAAC;QACnD,MAAM,IAAI,UAAU,CAAC,eAAe,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,MAAM,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;IACrF,OAAO,CAAc,CAAC;AACxB,CAAC"}
@@ -0,0 +1,49 @@
1
+ import type { Ctx } from "../ctx.ts";
2
+ export type AgentClient = "claude" | "codex";
3
+ /** The B3OS skill as this package ships it (generated from docs-site by docs-site/scripts/agent-files.mjs). */
4
+ export declare function skillText(): string;
5
+ /** The b3os skill folder of one agent, at user or project scope. */
6
+ export declare function skillDir(agent: AgentClient, scope: "user" | "project", project?: string): string;
7
+ export interface FileResult {
8
+ status: "done" | "already set" | "skipped";
9
+ path: string;
10
+ detail: string;
11
+ }
12
+ /**
13
+ * Writes the skill into `dir` unless it is there already. A SKILL.md that b3os did not write, or that was edited
14
+ * since, is left as it is. With `dryRun`, says what it would do and writes nothing.
15
+ */
16
+ export declare function installSkill(dir: string, o?: {
17
+ dryRun?: boolean;
18
+ }): FileResult;
19
+ /** The block's format version: a later CLI replaces any version's block whole. */
20
+ export declare const BLOCK_VERSION = 1;
21
+ /** Codex keeps 32 KiB of AGENTS.md for the user's own text too: the block stays small. */
22
+ export declare const BLOCK_MAX_LINES = 60;
23
+ /** The managed block: what B3OS is, a command index, the output rules and how to check a result. */
24
+ export declare function contextBlock(): string;
25
+ /** `text` with the block in place of any earlier one, or appended after a blank line. */
26
+ export declare function upsertBlock(text: string, block: string): string;
27
+ /**
28
+ * The project folder for the block: the git repository's top folder, else the working directory. Null for the
29
+ * home folder or the root, where a context file would apply to every project.
30
+ */
31
+ export declare function projectDir(cwd?: string, given?: string): string | null;
32
+ /**
33
+ * The context files the block goes into: AGENTS.md (Codex, and Claude Code when no CLAUDE.md is in the project or
34
+ * above it), plus the project's CLAUDE.md when one there or above stops Claude Code reading AGENTS.md and the
35
+ * project's own CLAUDE.md does not import it.
36
+ */
37
+ export declare function contextFiles(project: string): string[];
38
+ /** Writes the block into each file (creating AGENTS.md or CLAUDE.md when missing). With `dryRun`, writes nothing. */
39
+ export declare function writeContext(files: string[], o?: {
40
+ dryRun?: boolean;
41
+ }): FileResult[];
42
+ /** True when every file already holds this block. */
43
+ export declare function contextInPlace(files: string[]): boolean;
44
+ /** A yes/no question on the terminal (asked on stderr, so stdout stays data), yes by default. */
45
+ export declare function askYes(ctx: Ctx, question: string): Promise<boolean>;
46
+ /** The skill in `dir`: missing, this CLI's copy, an older copy b3os wrote, or someone else's (or edited). */
47
+ export declare function skillState(dir: string): "missing" | "current" | "older" | "other";
48
+ /** The block in one context file: missing, this CLI's block, or another version's. */
49
+ export declare function blockState(path: string): "missing" | "current" | "older";