@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
@@ -0,0 +1,175 @@
1
+ # Vision
2
+
3
+ > Turn web pages into Markdown, map and crawl sites, and drive dedicated browsers over CDP, from browser pools that are already running on the node.
4
+
5
+ Source: https://docs.beta.b3os.org/vision.md
6
+
7
+ Vision turns web pages into Markdown and other formats, maps and crawls sites, and gives your agent its own browser to drive. The browsers are already running when your request arrives.
8
+
9
+ Measured on the B3OS node, from the [benchmark board](https://docs.beta.b3os.org/benchmarks#headline-results). Each figure links its raw data; the board has the conditions.
10
+
11
+ - **Under 0.11 ms**: Cached page, returned as markdown (100 KB page, p50 timed by the server, 2026-11-02). [Raw data](https://beta.b3os.org/raw/bench/bench/results/20261102T082836Z-w4q-idle/vision-cache-hit/vision.cache_hit.gap-100ms.result.json)
12
+ - **3.06 ms**: Added to the origin's own response by a fetch-tier scrape, markdown included (100 KB HTML page, p50 timed by the server, 2026-11-02). [Raw data](https://beta.b3os.org/raw/bench/bench/results/20261102T082836Z-w4q-idle/vision-t1-fetch/vision.t1_fetch.b2b-c1.result.json)
13
+ - **Under 2 ms**: Live browser session from the warm pool (session pool of 2, p50 timed by the server, 2026-11-02). [Raw data](https://beta.b3os.org/raw/bench/bench/results/20261102T082836Z-w4q-idle/vision-session-claim/vision.session_claim.gap-100ms.result.json)
14
+ - **0.001 ms**: Warm browser claimed for a scrape, 8 at once (bursts of 8 browser-tier scrapes against a pool of 8, p50 timed by the server, 2026-11-02). [Raw data](https://beta.b3os.org/raw/bench/bench/results/20261102T082836Z-w4q-idle/vision-pool-claim/vision.pool_claim.burst-8.result.json)
15
+ - **Under 0.01 ms**: Added per action in a live browser session (full Chrome session, p50 timed by the server, 2026-11-03). [Raw data](https://beta.b3os.org/raw/bench/vision/results/20261103T085241Z-act-lock/act-click-gap100-chrome.json)
16
+
17
+ ## What to call
18
+
19
+ | You want | Call | Bills |
20
+ |---|---|---|
21
+ | One page as Markdown, HTML, text, links, metadata or a screenshot | [`POST /v1/vision/scrape`](https://docs.beta.b3os.org/vision/scrape), or `GET /v1/vision/r/<url>` for a one-line read (Markdown by default) | One `vision.page` |
22
+ | A site's URLs, from its sitemaps and links | [`POST /v1/vision/map`](https://docs.beta.b3os.org/vision/crawl#map-a-site) | One `vision.page` |
23
+ | Up to 1,000 URLs you already have | [`POST /v1/vision/batches`](https://docs.beta.b3os.org/vision/crawl#scrape-a-list-of-urls) | One `vision.page` per page |
24
+ | A site, following its links | [`POST /v1/vision/crawls`](https://docs.beta.b3os.org/vision/crawl#crawl-a-site) | One `vision.page` per page |
25
+ | Pages about a topic when you have no URL | [`POST /v1/vision/search`](https://docs.beta.b3os.org/vision/crawl#search-the-web), with `scrape` for each result's page | One `vision.page` per search with results, plus one per scraped result |
26
+ | A browser your agent drives, with clicks, forms and CDP | [Sessions](https://docs.beta.b3os.org/vision/sessions) | `vision.browser_ms` while open |
27
+ | To stay signed in across sessions and scrapes | [Profiles](https://docs.beta.b3os.org/vision/profiles) | Nothing |
28
+
29
+ Only pages you get are metered. A scrape that fails on an upstream error, a timeout, a refused destination or a failed extraction records no `vision.page`, and batches and crawls count only the pages that succeeded. A wall (`page_state` `blocked` or `captcha`) is free too and comes back without its content: only `page_state`, `status_code`, `final_url` and `content_withheld: true`. Set `walls: "bill"` to get its content for one `vision.page`. A scrape with `actions` is metered whatever comes back. The beta is free. Each organization has a monthly page allowance (`vision.pages.monthly`, in `GET /v1/limits`); once it's used up, scrapes answer `429 quota_exceeded` until the next UTC month. See [pricing](https://docs.beta.b3os.org/concepts/usage#pricing).
30
+
31
+ ## Settings
32
+
33
+ | Setting | Default |
34
+ |---|---|
35
+ | [Engine](https://docs.beta.b3os.org/vision/settings#engine): `engine` | `auto` |
36
+ | [Browser](https://docs.beta.b3os.org/vision/settings#browser): `browser` | `headless-shell` (scrape), `chrome` (session) |
37
+ | [Scrape timeout](https://docs.beta.b3os.org/vision/settings#scrape-timeout): `timeout_ms` | 30,000 ms |
38
+ | [Locale](https://docs.beta.b3os.org/vision/settings#locale): `locale` | `en-US` |
39
+ | [Cache age](https://docs.beta.b3os.org/vision/settings#cache-age): `max_age_ms` | 172,800,000 ms (2 days) |
40
+
41
+ [Vision settings](https://docs.beta.b3os.org/vision/settings) has all 37, each with its values, what it changes and an example, and what is fixed in the beta.
42
+
43
+ ## How a scrape is served
44
+
45
+ A scrape has three ways to get a page, and `engine: "auto"`, the default, takes the cheapest one that works:
46
+
47
+ 1. **Cache.** A copy no older than `max_age_ms` (two days by default) answers at once.
48
+ 2. **Fetch.** A plain HTTP request, with the page converted to Markdown in Rust inside the B3OS daemon.
49
+ 3. **Browser.** A warm Chrome page from a pool of pre-created contexts, used when the page needs JavaScript to show its content, when the fetch came back thin or mostly script, and when the fetch failed in a way a browser may not ([choose the engine](https://docs.beta.b3os.org/vision/scrape#choose-the-engine)).
50
+
51
+ `engine: "fetch"` never starts a browser. `engine: "browser"` always renders, and browser actions, screenshots and profiles imply it. The response's `tier` says which one served the page; each bills the same single `vision.page`.
52
+
53
+ When the browser serves an `auto` scrape, `tier_reason` says why the fetch tier did not: `needs_js`, `empty_page`, `thin_page`, `fetch_failed`, `challenged` when the site answered the fetch tier with a bot challenge, or `host_prefers_browser` when most of the host's recent pages needed a browser, though a URL the fetch tier served as a static page within the hour still starts there. After a 403 bot challenge the fetch tier asks once more as the [B3OS fetcher](https://docs.beta.b3os.org/vision/fetcher), and `fetch_identity` says which one read the page.
54
+
55
+ One scrape as recorded: a pinned copy of the docs page [Scrape a page](https://docs.beta.b3os.org/vision/scrape), with formats `markdown` and `screenshot`. The screenshot is the page as the browser drew it. The Markdown leaves out the header, sidebars, footer and tab labels, keeps each code sample as a fenced block tagged with its language, and keeps the table's row headers.
56
+
57
+ **Response 200**
58
+
59
+ ```json
60
+ {
61
+ "object": "scrape",
62
+ "url": "https://beta.b3os.org/fixtures/vision/docs-page.html",
63
+ "final_url": "https://beta.b3os.org/fixtures/vision/docs-page",
64
+ "status_code": 200,
65
+ "content_type": "text/html",
66
+ "tier": "browser",
67
+ "cache": {
68
+ "state": "miss",
69
+ "age_s": 0
70
+ },
71
+ "markdown": "# Scrape a page\n\nFetch one URL and get it back as Markdown, HTML, text, links, metadata or a screenshot, in one synchronous call.\n\n## Scrape one page\n\nSend the URL and the formats you want. The response arrives when the page is done, within `timeout_ms` (30 seconds by default).\n\n```shell\ncurl -s https://beta-api.b3os.org/v1/vision/scrape \\\n -H \"Authorization: Bearer $B3OS_API_KEY\" \\\n -H \"Content…",
72
+ "screenshot": {
73
+ "format": "jpeg",
74
+ "width": 1280,
75
+ "height": 800,
76
+ "data_base64": "https://beta.b3os.org/gallery/vision/scrape-docs-fixture/c2984e3a80f92ba1.jpg"
77
+ },
78
+ "metadata": {
79
+ "title": "Scrape a page · B3OS docs",
80
+ "description": "Fetch one URL as Markdown, HTML, text, links, metadata or a screenshot.",
81
+ "language": "en",
82
+ "canonical_url": "https://docs.beta.b3os.org/vision/scrape",
83
+ "robots": "noindex"
84
+ },
85
+ "page_state": {
86
+ "state": "ok"
87
+ },
88
+ "warnings": [],
89
+ "timing": {
90
+ "acquire_ms": 0.01,
91
+ "admit_ms": 0.084,
92
+ "claim_ms": 0.007,
93
+ "extract_ms": 2.255,
94
+ "nav_dcl_ms": 105.8,
95
+ "nav_load_ms": 137.245,
96
+ "nav_response_ms": 54.109,
97
+ "navigate_ms": 238.051,
98
+ "queue_ms": 0.001,
99
+ "read_ms": 6.235,
100
+ "screenshot_ms": 27.993,
101
+ "setup_ms": 1.594,
102
+ "total_ms": 276.564
103
+ }
104
+ }
105
+ ```
106
+
107
+ **Request**
108
+
109
+ ```bash
110
+ curl -s -X POST 'https://beta-api.b3os.org/v1/vision/scrape' \
111
+ -H "Authorization: Bearer $B3OS_API_KEY" \
112
+ -H 'Content-Type: application/json' \
113
+ -d '{"url":"https://beta.b3os.org/fixtures/vision/docs-page.html","formats":["markdown","screenshot"],"max_age_ms":0}'
114
+ ```
115
+
116
+ **Server-Timing**
117
+
118
+ ```http
119
+ server-timing: edge_auth;dur=0.000, edge_upstream;dur=287.000, admit;dur=0.084, queue;dur=0.001, claim;dur=0.007, acquire;dur=0.010, setup;dur=1.594, navigate;dur=238.051, nav_response;dur=54.109, nav_dcl;dur=105.800, nav_load;dur=137.245, read;dur=6.235, screenshot;dur=27.993, extract;dur=2.255, total;dur=276.697
120
+ x-request-id: req_01m6y0bb7pw8xtt660bhn07nbx
121
+ ```
122
+
123
+ <img src="https://beta.b3os.org/gallery/vision/scrape-docs-fixture/c2984e3a80f92ba1.jpg" alt="The jpeg the call returned (vision/scrape-docs-fixture)" width="1280" height="800" loading="lazy" />
124
+
125
+ <sub>Captured 2026-11-08 from commit `48c174d9` on the host the node runs on (colo PDX), warm: median of 5 calls after 3 warm-up calls, label `fixture` (recorded against a pinned fixture); long values abridged. Case `vision/scrape-docs-fixture`.</sub>
126
+
127
+ ## The cache
128
+
129
+ A page enters the shared cache only when the request had no custom headers or cookies, no profile, session or browser actions, the default location, and the page set no cookies, by a response or by a script. A page that set cookies is cached for your organization only; a request with custom headers, a profile or actions bypasses the cache. `cache.state` in the response is `hit`, `miss` (fetched and stored) or `bypass` (fetched and not shared), and `cache.age_s` is the copy's age. Cached pages are kept for two days. Set `max_age_ms: 0` to always fetch, or `store_in_cache: false` to keep a result out.
130
+
131
+ ## Browsers
132
+
133
+ Two kinds of browser serve vision, and they never mix:
134
+
135
+ - **The scrape pool** serves scrapes, batches and crawls that need JavaScript. Its browsers are driven only by B3OS; nobody connects to them over CDP.
136
+ - **Session browsers** are whole browser processes, one per session with its own profile directory, claimed from a warm pool, and one never serves two organizations. Your agent drives one with batched actions or any CDP client, through a proxy that exposes only that session's pages. A scrape with a `profile` also gets a browser of its own, which counts toward `vision.sessions.concurrent` while it runs.
137
+
138
+ Chrome runs with its own sandbox: its renderers run in their own user and PID namespaces under seccomp. The browsers of a pool share one OS user and one network namespace, so that sandbox is what keeps a compromised page away from the other browsers, and a production node refuses sessions and profile scrapes (`503 product_unavailable`) if it does not work. Browsers in microVMs of their own are planned. The [beta contract](https://docs.beta.b3os.org/concepts/beta#isolation) has the details.
139
+
140
+ Sessions run full Chrome and the scrape pool runs chrome-headless-shell, unless a request sets [`browser`](https://docs.beta.b3os.org/vision/scrape#choose-the-engine) to `chrome` or `headless-shell`; a scrape that asks for full Chrome gets a browser of its own. Both present a current Chrome user agent and client hints without `HeadlessChrome`, `navigator.webdriver` false, and the time zone and locale of the node's egress location (America/Los_Angeles and en-US) unless the request sets its own. Full Chrome also has `window.chrome` and plugins, which chrome-headless-shell lacks. Sessions and pages in a browser of their own have WebGL, rendered on the CPU by SwiftShader. Pages in the scrape pool have no WebGL: a pool browser renders pages of several organizations at once, and Chrome rates SwiftShader unsafe for untrusted content. Set `browser: "chrome"` for a page that needs WebGL. All their traffic goes through the egress guard.
141
+
142
+ ## Rules vision follows
143
+
144
+ - **robots.txt and Content Signals** are not consulted unless the request sets `respect_robots: true` (scrape, batch and crawl page options, map, crawl; `X-B3OS-Respect-Robots` on `r/{url}`). With it, a URL they disallow fails with [`robots_disallowed`](https://docs.beta.b3os.org/errors#robots_disallowed) and a crawl skips it.
145
+ - **Blocks are reported.** Pages render in a regular Chrome. When a site refuses the request or shows a challenge, the result says so in `status_code`, `page_state` and `egress`. With `proxy: "auto"`, a page the node's address got as a wall is requested once more from a residential address. That gets around the site's IP-based block, and the result reports the node's wall in `egress.first`. Vision does not solve CAPTCHAs. See [Proxies](https://docs.beta.b3os.org/vision/proxy).
146
+ - **Politeness.** Crawl and batch pages to one host are spaced node-wide, across organizations, with at most 2 in flight to the host for one organization and 2 for all organizations together; a crawl's `delay_ms` (or robots.txt's Crawl-delay with `respect_robots`) can widen the gap. A 429 or 503 from a host pauses its job pages for the response's `Retry-After`. The node's operator can block a target domain; requests to it fail with [`egress_denied`](https://docs.beta.b3os.org/errors#egress_denied), reason `operator`, and nothing is sent.
147
+ - **Egress.** Every fetch and navigation goes through the egress guard, so a URL that resolves to a private, loopback or metadata address fails with [`egress_denied`](https://docs.beta.b3os.org/errors#egress_denied).
148
+ - **Ads and trackers** are blocked by default in scrapes (`block_ads`), and images, media and fonts are not downloaded unless you ask for a screenshot.
149
+
150
+ ## Scopes
151
+
152
+ | Scope | For |
153
+ |---|---|
154
+ | `vision:run` | Scrape, map, crawl, batch scrape, and drive sessions (`act`, CDP) |
155
+ | `vision:write` | Create and close sessions; create, change and delete profiles; export a profile's state |
156
+ | `vision:read` | List and read sessions, profiles, crawls and batches |
157
+
158
+ ## Third-party notices
159
+
160
+ Vision reads PDFs with [pdfium](https://pdfium.googlesource.com/pdfium/), the PDF engine of Chrome (BSD-3-Clause), as the prebuilt library from [pdfium-binaries](https://github.com/bblanchon/pdfium-binaries) (MIT). pdfium bundles libraries under their own permissive licences, among them FreeType, HarfBuzz, ICU, libjpeg-turbo, OpenJPEG, Little CMS, libpng and zlib, and their licence texts are installed beside it on every node.
161
+
162
+ The PDF reader is based in part on the work of the FreeType Team ([freetype.org](https://freetype.org)).
163
+
164
+ ## Guides
165
+
166
+ - [Scrape a page](https://docs.beta.b3os.org/vision/scrape)
167
+ Formats, main content, browser actions, screenshots and the cache.
168
+ - [Search, map, batch and crawl](https://docs.beta.b3os.org/vision/crawl)
169
+ Search the web, or many pages as one job, with events and webhooks.
170
+ - [Browser sessions](https://docs.beta.b3os.org/vision/sessions)
171
+ A dedicated browser: batched actions or Playwright and Puppeteer over CDP.
172
+ - [Profiles](https://docs.beta.b3os.org/vision/profiles)
173
+ Saved cookies and storage, so agents start signed in.
174
+
175
+ [Limits and FAQ](https://docs.beta.b3os.org/vision/limits) lists the caps and the common questions. Firecrawl users can keep their SDK: see [Firecrawl compatibility](https://docs.beta.b3os.org/compat/firecrawl).
@@ -0,0 +1,129 @@
1
+ /** The version of the error object's added fields. A field is never removed or retyped without a new version. */
2
+ export declare const ERROR_SCHEMA = "b3os.error/1";
3
+ /**
4
+ * Exit codes. Stable: scripts may rely on them, and the numbers are the ones 0.2.1 published. packages/cli/README.md
5
+ * "Exit codes" documents each one, and the docs site's table is generated from it (docs-site/scripts/sync.mjs checks
6
+ * the two agree). A new meaning gets a new number; a number is never reused.
7
+ */
8
+ export declare const EXIT: {
9
+ readonly OK: 0;
10
+ readonly ERROR: 1;
11
+ readonly USAGE: 2;
12
+ readonly AUTH: 3;
13
+ readonly NOT_FOUND: 4;
14
+ readonly INVALID: 5;
15
+ readonly LIMITED: 6;
16
+ readonly SERVER: 7;
17
+ readonly TIMEOUT: 8;
18
+ readonly CONNECTION: 9;
19
+ readonly FAILED: 10;
20
+ readonly INTERRUPTED: 130;
21
+ };
22
+ /** Who takes a step: the agent (or script) running the CLI, or the person it works for. */
23
+ export type StepActor = "agent" | "human";
24
+ /**
25
+ * One step to take next. The same shape in errors and in success JSON (`login --no-wait`, `init`, `doctor`).
26
+ * `why` is always the CLI's own words. `open` is only ever an https URL on a b3os.org host.
27
+ */
28
+ export type NextStep = {
29
+ run: readonly string[];
30
+ why: string;
31
+ who: StepActor;
32
+ } | {
33
+ open: string;
34
+ why: string;
35
+ who: "human";
36
+ };
37
+ /** A command to run next: `runStep(["b3os", "login"], "sign in")`. */
38
+ export declare function runStep(argv: readonly string[], why: string, who?: StepActor): NextStep;
39
+ /** A page a person opens, or undefined when `url` is not an https URL on b3os.org or one of its subdomains. */
40
+ export declare function openStep(url: string, why: string): NextStep | undefined;
41
+ /** Whether `url` is https on b3os.org or a subdomain of it: the only pages a next step may send someone to. */
42
+ export declare function isB3osUrl(url: string): boolean;
43
+ /** A command line as a person would type it: words with spaces or shell characters in single quotes. */
44
+ export declare function shellJoin(argv: readonly string[]): string;
45
+ /** The human lines for steps: `Next: b3os login (sign in)`, one per step. */
46
+ export declare function nextLines(steps: readonly NextStep[]): string[];
47
+ /** What `--json` prints on stderr for an error: `{"error": ErrorBody}` on one line. */
48
+ export interface ErrorBody {
49
+ /** Stable, snake_case: the API's catalog code (`sandbox_not_found`) or the CLI's own (`usage`, `file_error`). */
50
+ code: string;
51
+ /** An API error's: its HTTP status, problem title and type, request id and validation items. */
52
+ status?: number | null;
53
+ title?: string;
54
+ /** The API's own sentence for an API error; the CLI's for one it words itself. */
55
+ detail?: string;
56
+ type?: string;
57
+ request_id?: string | null;
58
+ errors?: unknown[];
59
+ job?: unknown;
60
+ /** A sentence on what to do, in the CLI's words. */
61
+ hint?: string;
62
+ /** Added in b3os.error/1. */
63
+ schema: typeof ERROR_SCHEMA;
64
+ /** The CLI's own words for what went wrong. Never text from the API or a remote program. */
65
+ message: string;
66
+ /** Steps to take, in the CLI's own words. */
67
+ next: NextStep[];
68
+ /** True when running the same command again, unchanged, may work and cannot repeat an effect. */
69
+ retryable: boolean;
70
+ /** True when a person has to act first: sign in, approve, add credits, grant a scope, say yes. */
71
+ user_action_required: boolean;
72
+ /** Facts the CLI adds for its own errors (the file, the id, the fixes it names). */
73
+ data?: Record<string, unknown>;
74
+ }
75
+ export interface CliErrorOptions {
76
+ code: string;
77
+ exit: number;
78
+ hint?: string;
79
+ next?: readonly (NextStep | undefined)[];
80
+ retryable?: boolean;
81
+ userActionRequired?: boolean;
82
+ data?: Record<string, unknown>;
83
+ }
84
+ /**
85
+ * An error the CLI words itself. `message` is the CLI's own sentence (printed as `detail` too, as 0.2.1 did).
86
+ */
87
+ export declare class CliError extends Error {
88
+ readonly code: string;
89
+ readonly exit: number;
90
+ readonly hint: string | undefined;
91
+ readonly next: NextStep[];
92
+ readonly retryable: boolean;
93
+ readonly userActionRequired: boolean;
94
+ readonly data: Record<string, unknown> | undefined;
95
+ constructor(message: string, o: CliErrorOptions);
96
+ }
97
+ /** A command line the CLI cannot run as typed (exit 2). */
98
+ export declare class UsageError extends CliError {
99
+ constructor(message: string, hint?: string, next?: readonly (NextStep | undefined)[]);
100
+ }
101
+ /** An option the command does not take. main.ts adds the step to the command's help, as it knows the name. */
102
+ export declare class OptionError extends UsageError {
103
+ }
104
+ /**
105
+ * A confirmation that no terminal could ask for and no --yes gave: exit 2, as in 0.2.1, with the code
106
+ * `confirmation_required` and `user_action_required` so an agent asks its person before it adds --yes.
107
+ */
108
+ export declare function confirmationRequired(question: string): CliError;
109
+ /**
110
+ * A file the user named could not be opened (`routine publish missing.yaml`, `--input @x.json`, `--out dir/x`):
111
+ * a usage error naming the file in plain words, exit 2, in place of Node's `ENOENT: no such file or directory,
112
+ * open '...'`. Anything else is returned as it is.
113
+ */
114
+ export declare function fileError(e: unknown): unknown;
115
+ /** Returns `e` with a sentence on what to do (`hint: …`). The error, its code and its exit code stay the API's. */
116
+ export declare function withHint(e: unknown, hint: string): unknown;
117
+ /** Returns `e` with steps to take next. The error, its code and its exit code stay the API's. */
118
+ export declare function withNext(e: unknown, ...steps: readonly (NextStep | undefined)[]): unknown;
119
+ /** Whether `e` already carries a hint. */
120
+ export declare function hasHint(e: unknown): boolean;
121
+ /** The exit code of any error: the CLI's own, or an API (or SDK) error's by its code, then its status. */
122
+ export declare function exitCodeFor(e: unknown): number;
123
+ /** Any error as the object --json prints under `error`. */
124
+ export declare function describeError(e: unknown): ErrorBody;
125
+ /**
126
+ * The error as printed: `{"error": {...}}` on one line with --json; otherwise plain lines a person (or an agent)
127
+ * reads. Both come from describeError, so they cannot disagree.
128
+ */
129
+ export declare function renderError(e: unknown, json: boolean): string;
package/dist/errors.js ADDED
@@ -0,0 +1,326 @@
1
+ // The CLI's one error contract (B3-7255; the DX roadmap's decision 7), for every command. Everything in it is
2
+ // additive to 0.2.1, so a script written against 0.2.1 behaves the same:
3
+ //
4
+ // - Exit codes from one table (EXIT), as published: the same numbers and meanings for every command.
5
+ // - With --json, an error is one JSON line on stderr, `{"error": {...}}`, with the fields 0.2.1 printed (`code`,
6
+ // `status`, `title`, `detail`, `type`, `request_id`, `errors`, `hint`) and, beside them, `schema`, the CLI's own
7
+ // `message`, the steps to take (`next`), whether a rerun can work (`retryable`) and whether a person must act first
8
+ // (`user_action_required`). `message`, `next` and `hint` are only ever the CLI's own words: the API's text stays
9
+ // in `title`, `detail` and `errors`, as before.
10
+ // - Without --json, the same error as plain lines (`error: …`, `hint: …`, `Next: <command> (<why>)`), with no
11
+ // colour and no terminal codes, so a log or an agent reads it as a person does.
12
+ // - A next step never suggests a flag that skips a safety check (no force flag). A step that needs a person's yes
13
+ // says so (`who: "human"`, or `user_action_required`).
14
+ import { B3OSError, ERROR_CATALOG } from "@b3os/sdk";
15
+ /** The version of the error object's added fields. A field is never removed or retyped without a new version. */
16
+ export const ERROR_SCHEMA = "b3os.error/1";
17
+ /**
18
+ * Exit codes. Stable: scripts may rely on them, and the numbers are the ones 0.2.1 published. packages/cli/README.md
19
+ * "Exit codes" documents each one, and the docs site's table is generated from it (docs-site/scripts/sync.mjs checks
20
+ * the two agree). A new meaning gets a new number; a number is never reused.
21
+ */
22
+ export const EXIT = {
23
+ OK: 0,
24
+ ERROR: 1,
25
+ USAGE: 2,
26
+ AUTH: 3,
27
+ NOT_FOUND: 4,
28
+ INVALID: 5,
29
+ LIMITED: 6,
30
+ SERVER: 7,
31
+ TIMEOUT: 8,
32
+ CONNECTION: 9,
33
+ FAILED: 10,
34
+ INTERRUPTED: 130,
35
+ };
36
+ /** A command to run next: `runStep(["b3os", "login"], "sign in")`. */
37
+ export function runStep(argv, why, who = "agent") {
38
+ if (argv.length === 0)
39
+ throw new Error("runStep: an empty command");
40
+ return { run: [...argv], why, who };
41
+ }
42
+ /** A page a person opens, or undefined when `url` is not an https URL on b3os.org or one of its subdomains. */
43
+ export function openStep(url, why) {
44
+ return isB3osUrl(url) ? { open: url, why, who: "human" } : undefined;
45
+ }
46
+ /** Whether `url` is https on b3os.org or a subdomain of it: the only pages a next step may send someone to. */
47
+ export function isB3osUrl(url) {
48
+ let u;
49
+ try {
50
+ u = new URL(url);
51
+ }
52
+ catch {
53
+ return false;
54
+ }
55
+ const host = u.hostname.toLowerCase();
56
+ return u.protocol === "https:" && !u.username && !u.password && (host === "b3os.org" || host.endsWith(".b3os.org"));
57
+ }
58
+ /** A command line as a person would type it: words with spaces or shell characters in single quotes. */
59
+ export function shellJoin(argv) {
60
+ return argv.map((a) => (/^[A-Za-z0-9_@%+=:,./<>[\]-]+$/.test(a) ? a : `'${a.replaceAll("'", `'\\''`)}'`)).join(" ");
61
+ }
62
+ /** The human lines for steps: `Next: b3os login (sign in)`, one per step. */
63
+ export function nextLines(steps) {
64
+ return steps.map((s) => {
65
+ const what = "run" in s ? shellJoin(s.run) : `open ${s.open}`;
66
+ const who = s.who === "human" && "run" in s ? "; a person does this" : "";
67
+ return `Next: ${what} (${s.why}${who})`;
68
+ });
69
+ }
70
+ /**
71
+ * An error the CLI words itself. `message` is the CLI's own sentence (printed as `detail` too, as 0.2.1 did).
72
+ */
73
+ export class CliError extends Error {
74
+ code;
75
+ exit;
76
+ hint;
77
+ next;
78
+ retryable;
79
+ userActionRequired;
80
+ data;
81
+ constructor(message, o) {
82
+ super(message);
83
+ this.name = "CliError";
84
+ this.code = o.code;
85
+ this.exit = o.exit;
86
+ this.hint = o.hint;
87
+ this.next = (o.next ?? []).filter((s) => s !== undefined);
88
+ this.userActionRequired = o.userActionRequired ?? false;
89
+ this.retryable = (o.retryable ?? false) && !this.userActionRequired;
90
+ this.data = o.data;
91
+ }
92
+ }
93
+ /** A command line the CLI cannot run as typed (exit 2). */
94
+ export class UsageError extends CliError {
95
+ constructor(message, hint, next) {
96
+ super(message, { code: "usage", exit: EXIT.USAGE, hint, next });
97
+ this.name = "UsageError";
98
+ }
99
+ }
100
+ /** An option the command does not take. main.ts adds the step to the command's help, as it knows the name. */
101
+ export class OptionError extends UsageError {
102
+ }
103
+ /**
104
+ * A confirmation that no terminal could ask for and no --yes gave: exit 2, as in 0.2.1, with the code
105
+ * `confirmation_required` and `user_action_required` so an agent asks its person before it adds --yes.
106
+ */
107
+ export function confirmationRequired(question) {
108
+ return new CliError(`${question} Refusing without a terminal; pass --yes to confirm.`, {
109
+ code: "confirmation_required",
110
+ exit: EXIT.USAGE,
111
+ userActionRequired: true,
112
+ });
113
+ }
114
+ /** What a file error means, for the line the CLI prints. */
115
+ const FILE_ERRORS = {
116
+ ENOENT: "no such file",
117
+ EACCES: "permission denied",
118
+ EPERM: "permission denied",
119
+ EISDIR: "it is a folder",
120
+ ENOTDIR: "a part of the path is not a folder",
121
+ };
122
+ /**
123
+ * A file the user named could not be opened (`routine publish missing.yaml`, `--input @x.json`, `--out dir/x`):
124
+ * a usage error naming the file in plain words, exit 2, in place of Node's `ENOENT: no such file or directory,
125
+ * open '...'`. Anything else is returned as it is.
126
+ */
127
+ export function fileError(e) {
128
+ const x = e;
129
+ // A program that could not start (spawn ENOENT) is not a file the user named.
130
+ if (!(e instanceof Error) || typeof x?.code !== "string" || String(x.syscall ?? "").startsWith("spawn"))
131
+ return e;
132
+ // Reading a folder fails on the read, which carries no path.
133
+ if (x.code === "EISDIR" && typeof x.path !== "string")
134
+ return new CliError("a folder was named where a file goes", { code: "file_error", exit: EXIT.USAGE });
135
+ const why = FILE_ERRORS[x.code];
136
+ if (!why || typeof x.path !== "string")
137
+ return e;
138
+ return new CliError(`can't open ${x.path}: ${why}`, { code: "file_error", exit: EXIT.USAGE });
139
+ }
140
+ // ---------------------------------------------------------------- API errors
141
+ /** A next step and hint for an API error a command expects, keyed by the error itself (withHint, withNext). */
142
+ const HINTS = new WeakMap();
143
+ const NEXTS = new WeakMap();
144
+ /** Returns `e` with a sentence on what to do (`hint: …`). The error, its code and its exit code stay the API's. */
145
+ export function withHint(e, hint) {
146
+ if (typeof e === "object" && e !== null)
147
+ HINTS.set(e, hint);
148
+ return e;
149
+ }
150
+ /** Returns `e` with steps to take next. The error, its code and its exit code stay the API's. */
151
+ export function withNext(e, ...steps) {
152
+ if (typeof e === "object" && e !== null)
153
+ NEXTS.set(e, [...(NEXTS.get(e) ?? []), ...steps.filter((s) => s !== undefined)]);
154
+ return e;
155
+ }
156
+ /** Whether `e` already carries a hint. */
157
+ export function hasHint(e) {
158
+ return typeof e === "object" && e !== null && HINTS.has(e);
159
+ }
160
+ /** The exit code of any error: the CLI's own, or an API (or SDK) error's by its code, then its status. */
161
+ export function exitCodeFor(e) {
162
+ if (e instanceof CliError)
163
+ return e.exit;
164
+ if (!(e instanceof B3OSError))
165
+ return EXIT.ERROR;
166
+ if (e.name === "B3OSJobError")
167
+ return EXIT.FAILED;
168
+ switch (e.code) {
169
+ // Also the SDK's own answer when it has no key to send (no HTTP status).
170
+ case "unauthorized":
171
+ return EXIT.AUTH;
172
+ case "timeout":
173
+ return EXIT.TIMEOUT;
174
+ case "connection_error":
175
+ return EXIT.CONNECTION;
176
+ case "aborted":
177
+ return EXIT.INTERRUPTED;
178
+ // b3os login: the device code was denied in the dashboard or expired (RFC 8628 §3.5 answers them as 400).
179
+ case "access_denied":
180
+ case "expired_token":
181
+ return EXIT.AUTH;
182
+ default:
183
+ break;
184
+ }
185
+ const s = e.status ?? 0;
186
+ if (s === 401 || s === 403)
187
+ return EXIT.AUTH;
188
+ if (s === 404)
189
+ return EXIT.NOT_FOUND;
190
+ if (s === 402 || s === 429)
191
+ return EXIT.LIMITED;
192
+ if (s === 504)
193
+ return EXIT.TIMEOUT;
194
+ if (s >= 500)
195
+ return EXIT.SERVER;
196
+ if (s >= 400)
197
+ return EXIT.INVALID;
198
+ return EXIT.ERROR;
199
+ }
200
+ /** Codes from the API that a person has to act on before a rerun can work, beyond 401s and 403s. */
201
+ const NEEDS_A_PERSON = new Set([
202
+ "credits_exhausted",
203
+ "spend_cap_exceeded",
204
+ "connection_required",
205
+ "turnstile_required",
206
+ "org_invite_code_required",
207
+ "invite_code_invalid",
208
+ "feature_not_enabled",
209
+ "access_denied",
210
+ "expired_token",
211
+ ]);
212
+ /**
213
+ * Failures after which the request may already have done its work (a create that answered 500, a call whose answer
214
+ * never came). The catalog calls some of them retryable, but a rerun of a create could make a second one, so the
215
+ * CLI says false and leaves the choice to the caller, who knows whether the call was a read.
216
+ */
217
+ const MAY_HAVE_RUN = new Set([
218
+ "internal",
219
+ "connection_error",
220
+ "timeout",
221
+ "stream_interrupted",
222
+ "invalid_response",
223
+ "idempotency_outcome_unknown",
224
+ ]);
225
+ /** SDK codes for failures with no HTTP answer, and the CLI's words for them. */
226
+ const CLIENT_WORDS = {
227
+ connection_error: "could not reach the API",
228
+ timeout: "timed out waiting for the API",
229
+ aborted: "interrupted",
230
+ invalid_response: "the API's answer could not be read",
231
+ stream_interrupted: "the stream from the API broke off",
232
+ unsupported_transport: "this transport is not supported here",
233
+ process_exited: "the process in the sandbox exited first",
234
+ };
235
+ /** The CLI's words for an API error's class, by exit code, when the SDK's catalog does not know the code. */
236
+ const EXIT_WORDS = {
237
+ [EXIT.AUTH]: "the API refused the credential",
238
+ [EXIT.NOT_FOUND]: "not found",
239
+ [EXIT.INVALID]: "the API refused the request",
240
+ [EXIT.LIMITED]: "rate limited, or out of quota or credits",
241
+ [EXIT.SERVER]: "the API failed",
242
+ [EXIT.TIMEOUT]: "timed out",
243
+ [EXIT.CONNECTION]: "could not reach the API",
244
+ [EXIT.FAILED]: "the job failed",
245
+ [EXIT.INTERRUPTED]: "interrupted",
246
+ };
247
+ const CODE = /^[a-z][a-z0-9_]{0,63}$/;
248
+ function apiBody(e) {
249
+ const exit = exitCodeFor(e);
250
+ const known = CODE.test(e.code);
251
+ // The SDK's bundled catalog title (`Sandbox not found`) is the SDK's own text; the server's title stays in `title`.
252
+ const words = (known ? ERROR_CATALOG[e.code]?.[2] : undefined) ??
253
+ CLIENT_WORDS[e.code] ??
254
+ EXIT_WORDS[exit] ??
255
+ "the request failed";
256
+ const where = [known ? e.code : null, e.status ? `HTTP ${e.status}` : null].filter(Boolean).join(", ");
257
+ const user = e.status === 401 || e.status === 403 || e.code === "unauthorized" || NEEDS_A_PERSON.has(e.code);
258
+ const hint = HINTS.get(e);
259
+ return {
260
+ code: e.code,
261
+ status: e.status,
262
+ title: e.title,
263
+ detail: e.detail,
264
+ type: e.type,
265
+ request_id: e.requestId,
266
+ ...(e.errors.length ? { errors: e.errors } : {}),
267
+ ...(e.job !== undefined ? { job: e.job } : {}),
268
+ ...(hint ? { hint } : {}),
269
+ schema: ERROR_SCHEMA,
270
+ message: `${words.charAt(0).toUpperCase()}${words.slice(1)}${where ? ` (${where})` : ""}`,
271
+ next: NEXTS.get(e) ?? [],
272
+ retryable: e.retryable && !user && !MAY_HAVE_RUN.has(e.code),
273
+ user_action_required: user,
274
+ };
275
+ }
276
+ /** Any error as the object --json prints under `error`. */
277
+ export function describeError(e) {
278
+ if (e instanceof B3OSError)
279
+ return apiBody(e);
280
+ if (e instanceof CliError) {
281
+ const hint = e.hint ?? HINTS.get(e);
282
+ return {
283
+ code: e.code,
284
+ detail: e.message,
285
+ ...(hint ? { hint } : {}),
286
+ schema: ERROR_SCHEMA,
287
+ message: e.message,
288
+ next: [...e.next, ...(NEXTS.get(e) ?? [])],
289
+ retryable: e.retryable,
290
+ user_action_required: e.userActionRequired,
291
+ ...(e.data && Object.keys(e.data).length ? { data: e.data } : {}),
292
+ };
293
+ }
294
+ // Not one the CLI words (a bug, or a library's error): its text may come from anywhere, so it stays in `detail`.
295
+ return {
296
+ code: "error",
297
+ detail: String(e?.message ?? e),
298
+ schema: ERROR_SCHEMA,
299
+ message: "the command failed",
300
+ next: [],
301
+ retryable: false,
302
+ user_action_required: false,
303
+ };
304
+ }
305
+ /**
306
+ * The error as printed: `{"error": {...}}` on one line with --json; otherwise plain lines a person (or an agent)
307
+ * reads. Both come from describeError, so they cannot disagree.
308
+ */
309
+ export function renderError(e, json) {
310
+ const d = describeError(e);
311
+ if (json)
312
+ return JSON.stringify({ error: d });
313
+ const lines = [];
314
+ if (e instanceof B3OSError) {
315
+ lines.push(`error: ${e.message}`);
316
+ for (const it of e.errors)
317
+ lines.push(` ${it.pointer}: ${it.detail}`);
318
+ }
319
+ else
320
+ lines.push(`error: ${d.detail ?? d.message}`);
321
+ if (d.hint)
322
+ lines.push(`hint: ${d.hint}`);
323
+ lines.push(...nextLines(d.next));
324
+ return lines.join("\n");
325
+ }
326
+ //# sourceMappingURL=errors.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.js","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA,8GAA8G;AAC9G,yEAAyE;AACzE,EAAE;AACF,qGAAqG;AACrG,iHAAiH;AACjH,mHAAmH;AACnH,sHAAsH;AACtH,mHAAmH;AACnH,kDAAkD;AAClD,+GAA+G;AAC/G,kFAAkF;AAClF,kHAAkH;AAClH,yDAAyD;AAEzD,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAErD,iHAAiH;AACjH,MAAM,CAAC,MAAM,YAAY,GAAG,cAAc,CAAC;AAE3C;;;;GAIG;AACH,MAAM,CAAC,MAAM,IAAI,GAAG;IAClB,EAAE,EAAE,CAAC;IACL,KAAK,EAAE,CAAC;IACR,KAAK,EAAE,CAAC;IACR,IAAI,EAAE,CAAC;IACP,SAAS,EAAE,CAAC;IACZ,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