@b3os/cli 0.2.1 → 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 (214) hide show
  1. package/README.md +87 -8
  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 -5
  19. package/dist/commands/app.js +229 -69
  20. package/dist/commands/app.js.map +1 -1
  21. package/dist/commands/auth.d.ts +70 -2
  22. package/dist/commands/auth.js +308 -33
  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 +59 -7
  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 +109 -1
  49. package/dist/commands/tool.js +635 -47
  50. package/dist/commands/tool.js.map +1 -1
  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/domains.d.ts +50 -0
  190. package/dist/manifest/domains.js +159 -0
  191. package/dist/manifest/domains.js.map +1 -0
  192. package/dist/manifest/link.d.ts +20 -0
  193. package/dist/manifest/link.js +24 -0
  194. package/dist/manifest/link.js.map +1 -0
  195. package/dist/manifest/record.d.ts +1 -1
  196. package/dist/tool/archive.d.ts +33 -0
  197. package/dist/tool/archive.js +174 -0
  198. package/dist/tool/archive.js.map +1 -0
  199. package/dist/tool/calls.d.ts +46 -0
  200. package/dist/tool/calls.js +274 -0
  201. package/dist/tool/calls.js.map +1 -0
  202. package/dist/tool/checks.d.ts +21 -0
  203. package/dist/tool/checks.js +145 -0
  204. package/dist/tool/checks.js.map +1 -0
  205. package/dist/tool/elf.d.ts +19 -0
  206. package/dist/tool/elf.js +107 -0
  207. package/dist/tool/elf.js.map +1 -0
  208. package/dist/tool/predict.d.ts +8 -0
  209. package/dist/tool/predict.js +38 -0
  210. package/dist/tool/predict.js.map +1 -0
  211. package/dist/tool/ustar.d.ts +5 -0
  212. package/dist/tool/ustar.js +220 -0
  213. package/dist/tool/ustar.js.map +1 -0
  214. package/package.json +6 -5
@@ -0,0 +1,168 @@
1
+ # OpenAI and Anthropic compatibility
2
+
3
+ > Use the OpenAI and Anthropic SDKs with the models served on the B3OS node by changing the base URL; supported endpoints, extensions and differences.
4
+
5
+ Source: https://docs.beta.b3os.org/compat/openai.md
6
+
7
+ `/v1/infer` speaks the OpenAI wire format, so the OpenAI SDKs work with the base URL changed:
8
+
9
+ | Where your code runs | Base URL | Key |
10
+ |---|---|---|
11
+ | Anywhere | `https://beta-api.b3os.org/v1/infer` | Your B3OS key |
12
+ | Inside a B3OS sandbox | `http://127.0.0.1:7700/v1/infer` | Not checked; pass any string |
13
+
14
+ Pick a chat model from the node's list (the list also holds the speech model, so filter on `b3os.kind`):
15
+
16
+ ```bash
17
+ export B3OS_MODEL=$(curl -s https://beta-api.b3os.org/v1/infer/models \
18
+ -H "Authorization: Bearer $B3OS_API_KEY" | jq -r '[.data[] | select(.b3os.kind == "chat")][0].id')
19
+ ```
20
+
21
+ The list as production returns it:
22
+
23
+ **Response 200**
24
+
25
+ ```json
26
+ {
27
+ "data": [
28
+ {
29
+ "b3os": {
30
+ "context_length": 32768,
31
+ "default_max_tokens": 4096,
32
+ "image_input": true,
33
+ "json_schema": true,
34
+ "kind": "chat",
35
+ "limits": {
36
+ "rpm": 600,
37
+ "tpm": 2000000
38
+ },
39
+ "max_request_bytes": 10485760,
40
+ "quantization": "fp8",
41
+ "tools": true
42
+ },
43
+ "created": 1772197106,
44
+ "id": "b3os/qwen3.5-9b",
45
+ "object": "model",
46
+ "owned_by": "b3os"
47
+ },
48
+ {
49
+ "b3os": {
50
+ "context_length": null,
51
+ "default_max_tokens": null,
52
+ "image_input": false,
53
+ "json_schema": false,
54
+ "kind": "speech",
55
+ "limits": {
56
+ "rpm": 300,
57
+ "tpm": null
58
+ },
59
+ "max_request_bytes": 65536,
60
+ "quantization": null,
61
+ "tools": false
62
+ },
63
+ "created": 0,
64
+ "id": "kokoro-82m",
65
+ "object": "model",
66
+ "owned_by": "b3os"
67
+ }
68
+ ],
69
+ "object": "list"
70
+ }
71
+ ```
72
+
73
+ **Request**
74
+
75
+ ```bash
76
+ curl -s 'https://beta-api.b3os.org/v1/infer/models' \
77
+ -H "Authorization: Bearer $B3OS_API_KEY"
78
+ ```
79
+
80
+ **Server-Timing**
81
+
82
+ ```http
83
+ server-timing: edge_auth;dur=0.000, edge_upstream;dur=10.000, total;dur=0.239
84
+ x-request-id: req_01m6aqb40crpkkap8c5tya54wh
85
+ ```
86
+
87
+ <sub>Captured 2026-11-01 from commit `7d802c58` on the host the node runs on, one call, label `live-recorded` (recorded from production). Case `infer/models-list`.</sub>
88
+
89
+ **TypeScript**
90
+
91
+ ```ts
92
+ import OpenAI from "openai";
93
+
94
+ const client = new OpenAI({
95
+ apiKey: process.env.B3OS_API_KEY,
96
+ baseURL: "https://beta-api.b3os.org/v1/infer",
97
+ });
98
+ const completion = await client.chat.completions.create({
99
+ model: process.env.B3OS_MODEL!,
100
+ messages: [{ role: "user", content: "Name one river in Oregon." }],
101
+ });
102
+ console.log(completion.choices[0].message.content);
103
+ ```
104
+ **Python**
105
+
106
+ ```python
107
+ import os
108
+ from openai import OpenAI
109
+
110
+ client = OpenAI(
111
+ api_key=os.environ["B3OS_API_KEY"],
112
+ base_url="https://beta-api.b3os.org/v1/infer",
113
+ )
114
+ completion = client.chat.completions.create(
115
+ model=os.environ["B3OS_MODEL"],
116
+ messages=[{"role": "user", "content": "Name one river in Oregon."}],
117
+ )
118
+ print(completion.choices[0].message.content)
119
+ ```
120
+ **curl**
121
+
122
+ ```bash
123
+ curl -s https://beta-api.b3os.org/v1/infer/chat/completions \
124
+ -H "Authorization: Bearer $B3OS_API_KEY" \
125
+ -H "Content-Type: application/json" \
126
+ -d "{\"model\": \"$B3OS_MODEL\", \"messages\": [{\"role\": \"user\", \"content\": \"Name one river in Oregon.\"}]}"
127
+ ```
128
+
129
+ [Infer](https://docs.beta.b3os.org/infer) describes the models the node serves.
130
+
131
+ ## Endpoints
132
+
133
+ | Endpoint | Status |
134
+ |---|---|
135
+ | `POST /chat/completions` | Served: text and, on models with image input, images; tools and tool choice; `response_format` with JSON Schema; sampling parameters; streaming with `stream_options.include_usage` |
136
+ | `GET /models`, `GET /models/{model}` | Served, with a `b3os` object per model |
137
+ | `POST /responses` | Served, stateless: send the whole conversation as `input` items each turn. `previous_response_id`, `conversation`, `background` and the tools OpenAI runs (web search, file search, computer use, code interpreter, MCP, image generation, shell) are refused; function tools, structured output and the Responses event stream work, so the OpenAI Agents SDK runs with only the base URL changed |
138
+ | `POST /audio/speech` | Served, `stream_format` `audio` and `sse` included, plus the `timestamps: "word"` extension |
139
+ | `POST /embeddings` | Planned. The route exists, but the beta node serves no embedding model yet, so every request answers `404 model_not_available` |
140
+
141
+ `GET /v1/infer/audio/voices`, which lists the voices of each speech model, is a B3OS endpoint and uses B3OS lists and [problem errors](https://docs.beta.b3os.org/errors).
142
+
143
+ ## Differences from OpenAI
144
+
145
+ - **No silent fallback.** A model the node does not serve fails with `model_not_available`. Chat completions also take `"route": "gateway"` to send such a request to the B3IQ gateway, but the beta node has no gateway route configured yet (no gateway key or model list), so there that request fails with `model_not_available` too. `Server-Timing` reports the route each request took as `infer_route`.
146
+ - **One choice.** `n` must be 1.
147
+ - **The request is closed.** Chat completions take these OpenAI parameters: `model`, `messages`, `tools`, `tool_choice`, `parallel_tool_calls`, `response_format`, `temperature`, `top_p`, `max_tokens`, `max_completion_tokens`, `stop`, `seed`, `n`, `presence_penalty`, `frequency_penalty`, `logprobs`, `top_logprobs`, `user`, `stream`, `stream_options` and `reasoning_effort` (with budgets: [Reasoning](https://docs.beta.b3os.org/infer/chat#reasoning)). On top of those the node takes the B3OS `route` and the runtime extensions `top_k`, `min_p`, `repetition_penalty`, `logit_bias` and `chat_template_kwargs` (only `enable_thinking`). `metadata`, `store`, `service_tier`, `prompt_cache_key`, `prompt_cache_retention`, `safety_identifier` and `verbosity` are accepted and ignored (a `prompt_cache_key` never changes which requests share a cache). Any other parameter, or a value the model's runtime refuses, returns `400 unsupported_parameter` with `param` naming it. That includes vLLM's `cache_salt`: the node sets it from your organization on every request, so cached prompt prefixes are shared only within your organization.
148
+ - **Extensions live in a `b3os` object.** Responses carry `b3os: {route, node}`, and each model in the list carries `b3os` with its kind, context length, quantization, support for tools, JSON Schema output and image input, the largest request it accepts, and your token and request limits for it. OpenAI SDKs ignore the field.
149
+ - **Word timestamps.** `POST /audio/speech` with `"timestamps": "word"` returns JSON with base64 audio and the start and end of each word, instead of audio bytes. Voices are the node's own (`af_heart` and the others `GET /v1/infer/audio/voices` lists). OpenAI's voice names resolve to them, so `voice: "alloy"` works: see [OpenAI voice names](https://docs.beta.b3os.org/infer/speech#openai-voice-names). The `x-b3os-voice` response header names the voice that spoke.
150
+ - **Streamed speech is asked for.** OpenAI streams speech whether or not a request sets `stream_format`; the node streams it when the request sets `stream_format` (`audio` or `sse`, as OpenAI defines them) and otherwise answers with the whole clip. `speech.audio.done` carries no `usage` (speech bills characters), and word timings stream only with `sse`. See [Stream](https://docs.beta.b3os.org/infer/speech#stream).
151
+ - **Errors** use OpenAI's shape, `{"error": {"message", "type", "code", "param"}}`, with the B3OS code in `error.code`. See [infer errors](https://docs.beta.b3os.org/errors#infer).
152
+
153
+ Tokens are metered as `infer.input_tokens` and `infer.output_tokens` (characters as `infer.audio_chars` for speech) and are free in the beta, within each model's tokens and requests per minute ([Infer limits](https://docs.beta.b3os.org/infer/limits)).
154
+
155
+ ## Anthropic Messages
156
+
157
+ The Anthropic SDKs work against the same model with the base URL `https://beta-api.b3os.org/v1/infer` and your B3OS key as the auth token (or as `x-api-key`). [Anthropic compatibility](https://docs.beta.b3os.org/compat/anthropic) has the setup and every field the node supports, ignores or refuses; [Messages](https://docs.beta.b3os.org/infer/messages) shows streaming, tools and thinking.
158
+
159
+ ```json
160
+ {
161
+ "model": "b3os/qwen3.5-9b",
162
+ "messages": [{ "role": "user", "content": "Name one river in Oregon." }]
163
+ }
164
+ ```
165
+
166
+ [Try it in the playground](https://beta.b3os.org/app/playground?op=inferCreateChatCompletion&body=eyJtb2RlbCI6ImIzb3MvcXdlbjMuNS05YiIsIm1lc3NhZ2VzIjpbeyJyb2xlIjoidXNlciIsImNvbnRlbnQiOiJOYW1lIG9uZSByaXZlciBpbiBPcmVnb24uIn1dfQ)
167
+
168
+ <sub>Opens the dashboard playground with this request filled in (`POST /v1/infer/chat/completions`). The link carries no key.</sub>
@@ -0,0 +1,151 @@
1
+ # Keys, scopes and principals
2
+
3
+ > How B3OS authenticates requests, what each scope allows, and how sandboxes, routines and streams get their own narrower identities.
4
+
5
+ Source: https://docs.beta.b3os.org/concepts/auth.md
6
+
7
+ Every request runs as a **principal**: an identity inside one organization and one project, with a set of scopes. Which principal depends on how the request arrived.
8
+
9
+ | Principal | How it authenticates | Typical use |
10
+ |---|---|---|
11
+ | API key | `Authorization: Bearer b3os_sk_...` | Your servers, agents and CI |
12
+ | CLI token | `Authorization: Bearer b3os_pat_...` from `b3os login` | The CLI, acting for one user |
13
+ | Dashboard session | The `__Host-b3os_session` cookie plus an `x-b3os-csrf` header on writes | The dashboard at `beta.b3os.org` |
14
+ | Sandbox | Nothing: the node knows which sandbox is calling | Code inside a sandbox calling `http://127.0.0.1:7700` |
15
+
16
+ To see which principal a credential maps to, call `GET /v1/keys/current`:
17
+
18
+ ```bash
19
+ curl -s https://beta-api.b3os.org/v1/keys/current -H "Authorization: Bearer $B3OS_API_KEY"
20
+ ```
21
+
22
+ ## API keys
23
+
24
+ A key belongs to one project. It has scopes, an optional spend cap in USD and an optional expiry. The secret is shown once, when the key is created; B3OS stores only its SHA-256 hash. Keys look like `b3os_sk_` followed by 32 base32 characters and a CRC-32 checksum. The fixed prefix and checksum let secret scanners recognize a leaked key; B3OS is not yet registered with a scanning partner program such as GitHub's, so a leak is not reported to us automatically.
25
+
26
+ Create keys in the dashboard or with [`POST /v1/keys`](https://docs.beta.b3os.org/api/post-v1-keys). A new key can never have more scopes or a higher spend cap than the key that creates it; asking for more fails with [`forbidden`](https://docs.beta.b3os.org/errors#forbidden) and reason `scope_escalation`. Scopes cannot change after creation; create another key instead. [`DELETE /v1/keys/{key_id}`](https://docs.beta.b3os.org/api/delete-v1-keys-key-id-) revokes a key: every request refuses it within 10 seconds, and open streams authenticated by it close within a minute.
27
+
28
+ The first key, created when you redeem your invite, gets these scopes:
29
+
30
+ `vision:read`, `vision:write`, `vision:run`, `vision:profiles:use`, `render:read`, `render:write`, `render:run`, `sandboxes:read`, `sandboxes:write`, `sandboxes:run`, `agents:read`, `agents:write`, `agents:run`, `routines:read`, `routines:write`, `routines:run`, `listeners:read`, `listeners:write`, `actions:read`, `actions:write`, `actions:run`, `infer:read`, `infer:write`, `infer:run`, `vault:read`, `vault:run`, `platform:read`
31
+
32
+ It never gets `*`, `vault:write` or `platform:write`. Create a key with those in the dashboard when you need them.
33
+
34
+ ## Scopes
35
+
36
+ Scopes are `<product>:read`, `<product>:write` and `<product>:run`. They never imply each other: `write` does not include `read`.
37
+
38
+ - `read` lists and reads objects and their event streams.
39
+ - `write` creates, changes and deletes persistent objects.
40
+ - `run` does work that costs compute: a scrape, a command, a render, a run, an action call, a model call.
41
+
42
+ `vault:run` means using a stored connection. A request that names a connection needs `vault:run` on top of the operation's own scope. Putting a connection's secret into a sandbox's or an agent's `secrets`, where code in the VM reads it, also needs `vault:connections:reveal`, which no default key, `*` or `vault:*` holds.
43
+
44
+ | Scope | Allows |
45
+ |---|---|
46
+ | `vision:read` | List and read browser sessions, profiles, crawls and batch scrapes. |
47
+ | `vision:write` | Create and close browser sessions; create, update and delete profiles. |
48
+ | `vision:run` | Scrape, map, crawl, batch scrape and extract; drive sessions (act, CDP). |
49
+ | `vision:profiles:use` | Load a stored profile into a browser session, a scrape or a render capture on the node. The state is not exported, but scripts in a page the profile is loaded into read what the page's own scripts can, such as `document.cookie` and `localStorage`. |
50
+ | `vision:profiles:export` | Read a profile's state (cookies and storage) out of the node, through the profile's state route or a session's CDP socket. Granted only when named exactly, never through `*` or `vision:*`; in the dashboard, owners and admins hold it. |
51
+ | `render:read` | List and read screenshots, videos and artifacts. |
52
+ | `render:write` | Delete screenshots and videos. |
53
+ | `render:run` | Take screenshots; record videos; read, restyle and cancel the videos the same sandbox or key created. |
54
+ | `sandboxes:read` | List and read sandbox, snapshot, template and image metadata. |
55
+ | `sandboxes:write` | Create, delete, pause, resume, snapshot and extend sandboxes; delete snapshots; import and delete images. |
56
+ | `sandboxes:run` | Exec, run code, read and write files, open PTYs, read logs and manage processes inside sandboxes. |
57
+ | `agents:read` | List and read agents, their instances and lifecycle events, and agent sessions, and stream sessions' events. |
58
+ | `agents:write` | Create, update and delete agents (definitions), and delete instances. A sandbox's grant holds it only when it names it exactly, so a harness can change its own memory and disk but not its definition. |
59
+ | `agents:run` | Send messages to instances (which makes and wakes them), get or create an instance, put one to sleep, and cancel agent sessions. |
60
+ | `routines:read` | List and read routines, versions, runs and run events. |
61
+ | `routines:write` | Create, publish, roll back and delete routines; validate and import definitions. |
62
+ | `routines:run` | Start, signal and cancel routine runs. |
63
+ | `listeners:read` | List and read listeners, their event history and their live event stream. |
64
+ | `listeners:write` | Create, change, pause, resume and delete listeners; send events to push listeners; test listeners and redeliver their events. |
65
+ | `actions:read` | Search packs, actions and triggers; read their definitions. |
66
+ | `actions:write` | Publish packs to the registry (first-party publishers only in the beta). A pack with a tool block also needs `actions:tools:publish`. |
67
+ | `actions:run` | Call actions. |
68
+ | `actions:tools:publish` | Publish hosted tools: upload an archive and a pack with a tool block. Granted only when named exactly, never through `*` or `actions:*`; in the dashboard, owners and admins hold it. |
69
+ | `infer:read` | List models and voices. |
70
+ | `infer:write` | Reserved; no operation requires it yet. |
71
+ | `infer:run` | Chat completions, embeddings and speech. |
72
+ | `vault:read` | List and read connection metadata (secret values are never returned). |
73
+ | `vault:write` | Create, update and delete connections. |
74
+ | `vault:run` | Use stored connections in action calls and routine steps, where B3OS adds the credential at the egress proxy and code never reads it. |
75
+ | `vault:connections:reveal` | Put a stored connection's secret into a sandbox's or an agent's `secrets`, where it is an environment variable every process in the VM can read and send anywhere the egress policy allows. Needs `vault:run` too; refused for a connection bound to `hosts` (a pack credential), which stays proxy-only. Each use writes a `connection.revealed` vault audit event. Granted only when named exactly, never through `*` or `vault:*`, and never a default key scope; in the dashboard, owners and admins hold it. |
76
+ | `platform:read` | Read keys, usage, requests, organizations, projects, webhook deliveries and the metadata of kept model calls. |
77
+ | `platform:write` | Create, update and revoke keys; manage projects; read and rotate webhook secrets; delete kept model calls; change any project's settings. |
78
+ | `platform:content:read` | Read the prompts and answers of kept model calls (`GET /v1/llm-calls/{request_id}/content`), which a project keeps only when its `platform.capture_content` setting is on. Granted only when named exactly, never through `*` or `platform:*`; in the dashboard, owners and admins hold it. |
79
+ | `settings:write` | Set and unset the settings of the credential's own project (`PUT` and `DELETE /v1/projects/{project_id}/settings/{option}`), nothing else. Not a default key scope; `b3os apply` needs it for a file with `settings:`. |
80
+
81
+ `<product>:*` grants every scope of one product and `*` grants all of them. Each operation in the [API reference](https://docs.beta.b3os.org/api/overview) lists the one scope it needs. A call that uses another product runs as you and never with a broader scope, so it also needs that product's scope: vision's `json` format and render's video narration need `infer:run`. A few operations use a pseudo-scope instead:
82
+
83
+ | Pseudo-scope | Meaning |
84
+ |---|---|
85
+ | `public` | No credentials (device login, inbound webhooks verified by signature, usercontent routes verified by their node signature). |
86
+ | `authenticated` | Any valid principal, whatever its scopes (for example reading its own limits). |
87
+ | `session` | A signed-in dashboard session only; API keys and tokens are rejected (`403 forbidden`, reason `session_required`). |
88
+ | `node` | A B3OS node's Ed25519 request signature (internal node-to-edge endpoints only; never customers). |
89
+
90
+ ## Organizations and projects
91
+
92
+ An organization holds projects; a project holds keys and every object you create (sandboxes, routines, profiles, connections). B3OS checks on every request that the object belongs to the caller's organization and project. A key from one organization can never read another's objects, and an object outside your project answers [`404`](https://docs.beta.b3os.org/errors#resource_not_found), never `403`, so its existence does not leak.
93
+
94
+ ## Sandboxes get their own principal
95
+
96
+ Code inside a sandbox calls `http://127.0.0.1:7700` and sends no credential; anything it sends is discarded. Its calls run as a **child principal** created with the sandbox from the key that created it. The child has no B3OS access until you grant it in the `api` field when you create the sandbox:
97
+
98
+ ```json
99
+ {
100
+ "template": "agent",
101
+ "api": {
102
+ "scopes": ["infer:run", "vision:run"],
103
+ "spend_cap_usd": 5,
104
+ "connections": ["conn_01m5t6cbgdjs1ketgcqwa2sne8"]
105
+ }
106
+ }
107
+ ```
108
+
109
+ - `scopes` must be a subset of the creating key's. `*` and `<product>:*` expand to the scopes you hold, except the explicit-only scopes below.
110
+ - `spend_cap_usd` stops the sandbox's own API calls at that spend. `null`, the default, means the creating key's cap applies. A cap above the creator's is refused with `403 forbidden`, reason `scope_escalation`, so caps never grow from one sandbox to the next.
111
+ - `connections` lists the vault connections the sandbox's action calls may use.
112
+ - `actions` (`{"allow": ["io.b3os/wikipedia/*@1.0.1"]}`) limits the sandbox to those pack actions, at those versions; any other call answers `403 action_not_allowed`. Without it the sandbox has its creator's rule, which for a key is none. A deployed service's rule is the packs its b3os.yaml uses, and they are its model's tools at `B3OS_MCP_URL` ([Your model's tools](https://docs.beta.b3os.org/actions/model-tools)).
113
+
114
+ A grant gets these scopes only when it names them exactly, never through `*` or `<product>:*`:
115
+
116
+ `sandboxes:write`, `agents:write`, `vault:read`, `vault:write`, `vault:run`, `vault:connections:reveal`, `platform:read`, `platform:write`, `vision:profiles:export`, `actions:tools:publish`, `platform:content:read`, `settings:write`
117
+
118
+ The grant is revoked when the sandbox stops. [Agents in sandboxes](https://docs.beta.b3os.org/sandboxes/agents) has the details.
119
+
120
+ ## Services belong to their project
121
+
122
+ A sandbox acts as the key that created it, so it stops when that key is revoked or expires (`stop_reason: revoked`), and its calls count toward that key's spend cap. That is right for an agent's sandbox, which should live no longer than its credential.
123
+
124
+ A service of an application is created with `owner: "project"` instead (`b3os apply` from CLI 0.2.2, the **next** release, and deploys from GitHub). It acts as its project within its grant's scopes and connections, and holds no key, so a key's expiry or revoke never stops it. The key that created it is kept as `created_by_key`. Its spend cap:
125
+
126
+ - with `spend_cap_usd` in its grant, that cap, its own: its usage carries no key, your organization pays for it, and no key's `spent_usd` counts it.
127
+ - without one, the creating key's cap, shared with everything else that key runs: its usage counts toward the key's `spent_usd`, and the key's cap stops it, also after the key is revoked or expires.
128
+
129
+ Both count the whole billing month and hold across restarts of the node. Its organization's suspension, its credits, a take down and B3 also stop it. Only an outside caller can create one (an API key, a CLI token or the console; not a sandbox's own credential, not a routine run), and only with `metadata."b3os.app"`, so every such service is listed under its application with its Take down.
130
+
131
+ What a service's own code starts with its credential (a create or a fork) belongs to the service: `parent` names its creator and `root` the service, it holds no key either, and it ends when the service ends (`stop_reason: revoked`), whatever its own timeout. A take down therefore reaches everything a service started. `GET /v1/sandboxes?root=<service id>` lists them. Revoking a key in the console lists the services it deployed, with how many sandboxes each started, and offers to take their applications down in the same step. [Sandboxes](https://docs.beta.b3os.org/api/post-v1-sandboxes) has the fields.
132
+
133
+ ## Routines run as their publisher
134
+
135
+ A routine version runs as the key that published it, with that key's scopes copied at publish time. If the key is revoked or expires, the routine's triggers pause until a new version is published with a valid key. See [routines](https://docs.beta.b3os.org/routines).
136
+
137
+ ## Stream tickets
138
+
139
+ Browsers cannot set an `Authorization` header on a `WebSocket` or an `EventSource`. For the three streams a browser opens directly (a sandbox terminal, a sandbox's logs and a browser session's CDP socket), get a ticket with your normal credential and open the stream within 30 seconds:
140
+
141
+ ```bash
142
+ curl -s -X POST https://beta-api.b3os.org/v1/sandboxes/$SBX/ticket \
143
+ -H "Authorization: Bearer $B3OS_API_KEY"
144
+ # {"ticket": "tkt_...", "object": "stream_ticket", "resource": "/v1/sandboxes/sbx_...", "expires_in_s": 30}
145
+ ```
146
+
147
+ Pass it as `?ticket=tkt_...` or as the WebSocket subprotocol pair `b3os.v1, b3os.ticket.tkt_...`. A ticket works once, only for streams under its `resource`, and runs the stream with the scopes of whoever requested it. B3OS never accepts a bearer token in a URL.
148
+
149
+ ## How the edge reaches the node
150
+
151
+ Your key never leaves the edge at `beta-api.b3os.org`. For each request it forwards, the edge mints a single-use node token that lives 60 seconds and names your organization, project, key and scopes. It is authenticated with HMAC-SHA256 under a key that only the edge and the receiving node hold, a different key for every node (until 2026-11-17 nodes also accept the edge's Ed25519 signature). The node checks the tag, that the token is for that node, the expiry and that the token was not used before, then runs the request as that principal.
@@ -0,0 +1,55 @@
1
+ # Beta contract
2
+
3
+ > What B3OS beta promises and what it does not, from availability and durability to data retention, isolation and how changes are announced.
4
+
5
+ Source: https://docs.beta.b3os.org/concepts/beta.md
6
+
7
+ B3OS beta is a working product on a small footprint. These are the terms it runs on.
8
+
9
+ ## Availability
10
+
11
+ - **Best effort, one site.** The beta runs on one node at one site in Eugene, Oregon, without an availability SLA.
12
+ - **Invite-only.** New organizations are admitted by invite code, against capacity B3OS has measured it can serve.
13
+ - **Status.** The [status page](https://beta.b3os.org/status) shows the node and each product.
14
+ - **When the node is down,** the API answers [`503 node_unavailable`](https://docs.beta.b3os.org/errors#node_unavailable) with `Retry-After`. Inbound webhooks for routines and pack triggers are stored durably at the edge, answered `202` with `x-b3os-queued: true`, and replayed in order when the node is back. The edge signs the time it received each one, so a provider's timestamp check still passes on a delivery that waited out an outage.
15
+ - **Missed schedules.** Every cron and interval trigger declares what to do with occurrences missed while the node was down or the routine paused: skip them, run only the latest, or run them all in order. See [triggers](https://docs.beta.b3os.org/routines/triggers).
16
+
17
+ ## Durability
18
+
19
+ Routine runs at `standard` or `strict` durability, and the stored responses of idempotent requests with effects, are recorded in a journal on the node's disk. They survive process crashes and restarts; they do not survive the loss of the node itself. Usage records reach the disk at least once a second, so a crash can lose the last second of usage.
20
+
21
+ Sandboxes keep running when the node's B3OS service restarts: the service that starts next takes over every running and paused sandbox ([lifecycle](https://docs.beta.b3os.org/sandboxes#lifecycle)). A reboot of the node itself ends them as `failed`, and their memory and disk are gone. Snapshots are kept.
22
+
23
+ Choose a routine's durability per run: `ephemeral` keeps no journal while it runs (a crash loses a run in flight) and stores only the run's summary once it ends, not its steps or events; `standard` makes each effect durable before the steps after it run; `strict` records both the intent and the result of every effect step. See [routines](https://docs.beta.b3os.org/routines).
24
+
25
+ ## Changes
26
+
27
+ The API is version 0.1. Breaking changes are announced 14 days ahead with a dated `B3OS-Version` header. The [changelog](https://docs.beta.b3os.org/changelog) records every change.
28
+
29
+ A few operations are in the published contract but planned for later in the beta, so the node does not serve them yet. Today those are `/v1/infer/embeddings` and `/v1/infer/rerank`: the beta node runs no embedding or rerank model, so every model answers [`404 model_not_available`](https://docs.beta.b3os.org/errors#model_not_available).
30
+
31
+ ## Retention
32
+
33
+ | Data | Kept |
34
+ |---|---|
35
+ | Vision cache | 2 days |
36
+ | Render artifacts (screenshots, videos, captions) | 7 days |
37
+ | Sandbox snapshots | 7 days |
38
+ | Crawl, batch and browser session records | 7 days after they end |
39
+ | Request log | 7 days |
40
+ | Webhook delivery history | 7 days |
41
+ | Routine run history (an `ephemeral` run: its summary only) | 30 days |
42
+
43
+ Some operations let you choose a shorter or longer period per request where it makes sense; the API reference says where.
44
+
45
+ ## Isolation
46
+
47
+ - **Tenancy.** Every object belongs to one organization and project, and every request is checked against them. An object outside your project answers `404`.
48
+ - **Sandboxes** are Firecracker microVMs, each restored with fresh kernel entropy, a new machine ID and the current time. Processes that were running in the template, snapshot or fork source a sandbox comes from, yours or B3OS's (Chrome, in the `browser` template), come back with their memory, so every sandbox made from it starts their random generators in the same state, apart from what B3OS reseeds in the code kernel; start such processes after the restore, or restart them ([what a restore or fork keeps](https://docs.beta.b3os.org/sandboxes/snapshots#what-a-restore-or-fork-keeps)).
49
+ - **Browser sessions** get a browser process of their own each, with its own profile directory, and one browser never serves two organizations; profiles load only into sessions of their own organization. Chrome runs with its own sandbox: its renderers run in their own user and PID namespaces under seccomp, which the node's AppArmor profile allows. Every browser of a pool still runs as the same OS user in one network namespace, so Chrome's sandbox is what keeps a compromised renderer away from the other browsers. The browser launcher checks that the sandbox works when it starts, and a production node refuses sessions and profile scrapes with `503 product_unavailable` when it does not. Browsers in microVMs of their own are planned. The shared scrape pool runs only scrapes B3OS drives; nobody connects to it over CDP.
50
+ - **Egress.** Every outbound request you can steer goes through the egress guard, which refuses loopback, private networks, the node's own addresses and cloud metadata.
51
+ - **Your bytes on `usercontent.b3os.org`.** Render artifacts and sandbox previews are served from a separate host with no cookies in either direction, and artifacts always carry `Content-Security-Policy: sandbox`. In v0.1 every port preview shares that one origin, so a page in one preview can send requests to another preview URL it knows. Keep secrets out of previews; per-port hostnames are planned.
52
+
53
+ ## Acceptable use
54
+
55
+ Use of the beta is subject to B3OS's acceptable-use policy. Vision consults `robots.txt` and Content Signals when a request sets `respect_robots: true`, and a crawl spaces its requests to any one host.
@@ -0,0 +1,71 @@
1
+ # Glossary
2
+
3
+ > The terms these docs use for B3OS objects, identities and measurements, with the two kinds of action always told apart.
4
+
5
+ Source: https://docs.beta.b3os.org/concepts/glossary.md
6
+
7
+ **Action.** Two different things, always qualified in these docs:
8
+ - A **marketplace action** is one operation of a [pack](https://docs.beta.b3os.org/actions/packs), such as `io.b3os/github/create-issue@1.0.0`, called with [`POST /v1/actions/call`](https://docs.beta.b3os.org/actions/call).
9
+ - A **browser action** is one step of a vision session's `act` call or a render script: `navigate`, `click`, `type` and the rest.
10
+
11
+ **Allowance.** A per-organization amount over a calendar month, such as `vision.pages.monthly`. Past it the product answers `429 quota_exceeded` until the period ends.
12
+
13
+ **Artifact.** A file render produces (an image, an MP4, a GIF, a poster, captions), served from `usercontent.b3os.org` through a signed URL and kept for 7 days. IDs start with `art_`.
14
+
15
+ **Beat.** One unit of a render video script: what the narrator says and the browser actions that happen while it is said.
16
+
17
+ **Callable.** What a routine step `uses`: a product (`vision/scrape@1`), a core step (`core/http@1`), another routine, or a marketplace action.
18
+
19
+ **Connection.** A credential stored in the [vault](https://docs.beta.b3os.org/vault), with an ID starting `conn_`. B3OS injects it into outbound requests at the egress proxy, only for the hosts it is bound to, so the credential never reaches your code or a model.
20
+
21
+ **Dev baseline.** A measurement taken on the beta node during development without the benchmark lock. Dev baselines explain design choices. They are floors, not product results.
22
+
23
+ **Durability.** How much of a routine run is written to disk: `ephemeral` (nothing while it runs, and only the run's summary once it ends), `standard` (each effect durable before later steps run) or `strict` (the intent and the result of every effect step).
24
+
25
+ **Edge.** The Cloudflare Worker at `beta-api.b3os.org` that checks keys, scopes and limits, answers account operations itself and forwards everything else to the node.
26
+
27
+ **Effect class.** How an action or step touches the world: `pure` (computes from its input), `read`, `write` or `irreversible`. It decides what B3OS retries on its own (only `pure` and `read`) and the hints an MCP client sees.
28
+
29
+ **Egress guard.** The check every outbound request you can steer passes through. It resolves the address once, connects to exactly that address, and refuses loopback, private networks, the node's own addresses and cloud metadata.
30
+
31
+ **Grant.** The `api` field of a sandbox: the scopes, spend cap and connections that code inside the sandbox may use.
32
+
33
+ **Hook.** The inbound webhook URL of a routine trigger or a pack trigger subscription. Its ID (`hk_`) is unguessable, and every delivery must carry a valid signature.
34
+
35
+ **Job.** A long-running operation (crawl, batch scrape, video, routine run, extraction) with one shared contract for waiting, streaming, webhooks and cancel. See [jobs](https://docs.beta.b3os.org/concepts/jobs).
36
+
37
+ **Node.** A B3IQ machine running `b3osd`, the B3OS daemon. The beta has one node, `n1`.
38
+
39
+ **Pack.** A versioned bundle of marketplace actions and triggers, described by a signed `b3pack.json` and named `<namespace>/<name>`, such as `io.b3os/github`. See [packs](https://docs.beta.b3os.org/actions/packs) and the [catalog](https://docs.beta.b3os.org/actions/catalog).
40
+
41
+ **Pool miss.** A request that found no pre-warmed browser, context or microVM ready in its pool and had to make one, which is slower. Published pool targets state the miss rate and the misses' p50 and p99 beside the hits.
42
+
43
+ **Principal.** The identity a request runs as: an API key, a CLI token, a dashboard session or a sandbox. Every principal belongs to one organization and one project.
44
+
45
+ **Profile.** Saved browser cookies and storage (`prof_`) that vision sessions and scrapes load so an agent starts signed in.
46
+
47
+ **Provenance.** Where a published number comes from: `measured` by B3OS with raw data, or `vendor`, `independent`, `competitor-run` or `affiliated`. Every number also states its vantage and side.
48
+
49
+ **Routine.** A durable workflow (`rtn_`). Publishing it creates an immutable **version** (`ver_`); each execution is a **run** (`run_`) made of **steps**.
50
+
51
+ **Scope.** A permission such as `vision:run`. See [keys, scopes and principals](https://docs.beta.b3os.org/concepts/auth).
52
+
53
+ **Session.** In vision, a **browser session** (`brs_`): one dedicated browser, claimed from a warm pool. In the dashboard, a **sign-in session** held in a cookie. These docs say which.
54
+
55
+ **Signal.** A named message sent to a running routine, completing a step that waits for it.
56
+
57
+ **Size class.** A sandbox size a template keeps a pool of restored microVMs for. Today that is the template's default size and any other size the node is set up for; templates will list theirs as `size_classes`. Other sizes are restored on demand.
58
+
59
+ **Snapshot.** A saved copy of a sandbox's memory and disk (`snap_`) that new sandboxes restore from. A **template** (`tpl_`), such as `base` or `agent`, is the snapshot a fresh sandbox starts from.
60
+
61
+ **Stream ticket.** A single-use, 30-second credential (`tkt_`) that opens one WebSocket or event stream from a browser, which cannot send an `Authorization` header.
62
+
63
+ **Tier.** What served a scrape: `cache`, `fetch` (plain HTTP) or `browser` (Chrome).
64
+
65
+ **Trigger.** What starts a routine run besides the API: a cron schedule, an interval, a webhook, or a pack trigger. A pack trigger becomes a **trigger subscription** (`tsub_`) when the routine version is published.
66
+
67
+ **usercontent.** The host `usercontent.b3os.org`, which serves only bytes you control (render artifacts and sandbox port previews), never with cookies.
68
+
69
+ **Vantage.** Where a measurement was taken from: `same-host`, `same-region`, or `cross-region from` a named place.
70
+
71
+ **Warm pool.** A set of browsers, browser contexts or restored microVM slots prepared before any request, so a request claims one instead of starting one.
@@ -0,0 +1,98 @@
1
+ # IDs and object shapes
2
+
3
+ > How B3OS IDs are built, which prefix belongs to which object, and the fields every object, list and credential shares.
4
+
5
+ Source: https://docs.beta.b3os.org/concepts/ids.md
6
+
7
+ Every object B3OS creates has an ID made of a prefix, an underscore and a ULID in lowercase Crockford base32: `sbx_01m5t68q1b590rj801nbzsqzkk`. The prefix tells you the object type at a glance, and IDs created later sort later.
8
+
9
+ ## Prefixes
10
+
11
+ | Prefix | Object | Product |
12
+ |---|---|---|
13
+ | `brs_` | `browser_session` | vision |
14
+ | `prof_` | `profile` | vision |
15
+ | `crawl_` | `crawl` | vision |
16
+ | `batch_` | `batch_scrape` | vision |
17
+ | `shot_` | `screenshot` | render |
18
+ | `vid_` | `video` | render |
19
+ | `art_` | `artifact` | render |
20
+ | `ins_` | `inspection` | render |
21
+ | `shr_` | `video_share` (secret) | render |
22
+ | `als_` | `video_alias` | render |
23
+ | `sbx_` | `sandbox` | sandboxes |
24
+ | `snap_` | `snapshot` | sandboxes |
25
+ | `tpl_` | `template` | sandboxes |
26
+ | `vol_` | `volume` | sandboxes |
27
+ | `swm_` | `swarm` | sandboxes |
28
+ | `img_` | `image` | images |
29
+ | `agt_` | `agent` | agents |
30
+ | `inst_` | `agent_instance` | agents |
31
+ | `ses_` | `agent_session` | agents |
32
+ | `rtn_` | `routine` | routines |
33
+ | `ver_` | `routine_version` | routines |
34
+ | `run_` | `routine_run` | routines |
35
+ | `hk_` | `hook` (secret) | routines |
36
+ | `conn_` | `connection` | vault |
37
+ | `tsub_` | `trigger_subscription` | actions |
38
+ | `lsn_` | `listener` | listeners |
39
+ | `tfile_` | `tool_file` | actions |
40
+ | `tblk_` | `tool_block` | actions |
41
+ | `clink_` | `connect_link` | vault |
42
+ | `org_` | `organization` | platform |
43
+ | `prj_` | `project` | platform |
44
+ | `key_` | `api_key` | platform |
45
+ | `req_` | `request` | platform |
46
+ | `use_` | `usage_record` | platform |
47
+ | `job_` | `job` | platform |
48
+ | `tkt_` | `stream_ticket` (secret) | platform |
49
+ | `evt_` | `event` | platform |
50
+ | `usr_` | `user` | platform |
51
+ | `dep_` | `deploy` | platform |
52
+ | `evr_` | `eval_run` | platform |
53
+ | `alt_` | `alert` | platform |
54
+ | `chg_` | `app_change` | platform |
55
+ | `inv_` | `org_invite` | platform |
56
+ | `aud_` | `audit_entry` | platform |
57
+
58
+ IDs marked secret (`hk_` hooks and `tkt_` stream tickets) carry no timestamp and cannot be guessed, because holding one grants something: a hook ID is the URL a provider posts to, and a ticket opens a stream. Treat them like passwords.
59
+
60
+ Packs and actions have names instead of IDs: a pack is `<namespace>/<name>` such as `io.b3os/github`, and an action is `<namespace>/<name>/<action>@<version>` such as `io.b3os/github/create-issue@1.2.0`. The namespace is a reverse-DNS name with at least one dot.
61
+
62
+ ## Host-safe form
63
+
64
+ DNS labels and some URL paths cannot hold an underscore, so B3OS writes the same ID with a hyphen where it needs to: `sbx-01m5t68q1b590rj801nbzsqzkk`. A sandbox's `host_id` field and the paths of port previews and artifact URLs on `usercontent.b3os.org` use this form. API paths always take the underscore form.
65
+
66
+ ## Credentials
67
+
68
+ | Prefix | Kind | Format |
69
+ |---|---|---|
70
+ | `b3os_sk_` | api key | API key. 32 lowercase RFC 4648 base32 characters (160 bits), then `_` and the CRC-32 (IEEE) of everything before that underscore as 8 lowercase hex digits. The fixed prefix and checksum let secret scanners find leaked keys; B3OS is not registered with a scanning partner program yet. |
71
+ | `b3os_pat_` | cli token | CLI token from the device login, same layout as API keys. |
72
+ | `b3os_nt_` | node token | Edge-to-node token, `b3os_nt_<b64url(payload)>.<b64url(ed25519 signature)>`, 60-second TTL. Never issued to customers. |
73
+ | `whsec_` | webhook secret | Webhook signing secret for one endpoint URL. |
74
+ | `pt1.` | port token | Sandbox port preview token, `pt1.<node>.<exp>.<b64url(ed25519 signature)>`, carried in the path of `usercontent.b3os.org/sbx/<sandbox host id>/<port>/<token>/` URLs. Signed by the node key over `"b3os-port-v1\n" + node + "\n" + sandbox_id + "\n" + port + "\n" + exp` (openapi/sandboxes.yaml, `sandboxesProxyPortGet`). Anyone holding it reaches the port until `exp`. |
75
+
76
+ The checksum lets a client or a secret scanner reject a mistyped or made-up key without a network call.
77
+
78
+ ## Fields every object shares
79
+
80
+ | Field | Meaning |
81
+ |---|---|
82
+ | `id` | The prefixed ID. |
83
+ | `object` | The type name, such as `sandbox`, `browser_session` or `routine_run`. |
84
+ | `created_at` | RFC 3339 timestamp in UTC. |
85
+ | `metadata` | Up to 16 string pairs you attach for your own use. Keys are 1 to 40 characters of `A-Z a-z 0-9 _ . : -`; values are at most 500 characters. B3OS never reads them. |
86
+ | `status` | Present on objects with a lifecycle, such as sandboxes, sessions and jobs. |
87
+
88
+ Deleting returns `{"id": "...", "object": "...", "deleted": true}`, except for objects whose final state matters: deleting a sandbox or closing a browser session returns the final object with its usage, and revoking a key returns the revoked key, which stays listed for audit.
89
+
90
+ ## Lists
91
+
92
+ Every list takes `?limit=` (1 to 100) and `?cursor=`, and returns:
93
+
94
+ ```json
95
+ { "object": "list", "data": [ ... ], "next_cursor": "..." }
96
+ ```
97
+
98
+ Pass `next_cursor` back as `cursor` for the next page. It is `null` on the last page. Cursors are opaque; do not build them yourself.