@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,358 @@
1
+ # Sandbox settings
2
+
3
+ > Every sandbox setting: size, lifetime, egress, the API grant, commands and port URLs, with defaults, values and examples, and what is fixed.
4
+
5
+ Source: https://docs.beta.b3os.org/sandboxes/settings.md
6
+
7
+ Set these when you create the sandbox, or on the call that uses them (a command, a fork, a port URL). A sandbox keeps its size for life; change the size by creating another. [Sandboxes](https://docs.beta.b3os.org/sandboxes#create-a-sandbox) shows a create with the common ones.
8
+
9
+ | Setting | Default |
10
+ |---|---|
11
+ | [Template](#template): `template` | `base` |
12
+ | [CPUs](#cpus): `vcpu` | the template's `defaults.vcpu` (1 for `base`) |
13
+ | [Memory](#memory): `memory_mib` | the template's `defaults.memory_mib` (512 MiB for `base`) |
14
+ | [Disk](#disk): `disk_gib` | the template's (4 GiB for `base`) |
15
+ | [Lifetime](#lifetime): `timeout_s` | 300 s |
16
+ | [At the timeout](#at-the-timeout): `on_idle` | `stop` |
17
+ | [Owner](#owner): `owner` | `key` |
18
+ | [Forkable](#forkable): `forkable` | `false` |
19
+ | [Fork count](#fork-count): `count` | 1 |
20
+ | [Chrome reset on restore and fork](#chrome-reset-on-restore-and-fork): `clone_reset` | the node's: `full` on the beta node ([per field](#chrome-reset-on-restore-and-fork)) |
21
+ | [Egress](#egress): `egress.mode` | `public` |
22
+ | [API grant](#api-grant): `api.scopes` | none: code inside can call nothing ([per field](#api-grant)) |
23
+ | [Port URL lifetime](#port-url-lifetime): `ttl_s` | 600 s |
24
+ | [Command timeout](#command-timeout): `timeout_ms` | 30,000 ms; none in the background ([per field](#command-timeout)) |
25
+ | [Working directory](#working-directory): `cwd` | `/workspace` |
26
+ | [Run as](#run-as): `user` | `user` |
27
+ | [Background](#background): `background` | `false` |
28
+ | [Restart in place](#restart-in-place): `restart` | none: not supervised |
29
+ | [Code language](#code-language): `language` | `python` |
30
+
31
+ ## Size and template
32
+
33
+ ### Template
34
+
35
+ What the sandbox starts with: its disk, its tools and its default size. `run_code` needs `code-interpreter`. Ignored when `snapshot` is set.
36
+
37
+ - **Field:** `template` on [create](https://docs.beta.b3os.org/api/post-v1-sandboxes)
38
+ - **Default:** `base`
39
+ - **Values:** a template name (`base`, `code-interpreter`, `agent`) or a `tpl_` ID, from `GET /v1/sandboxes/templates`
40
+ - **Invalid value:** [`400 invalid_request`](https://docs.beta.b3os.org/errors#invalid_request)
41
+ - **Guide:** [Templates](https://docs.beta.b3os.org/sandboxes#templates)
42
+
43
+ ```json
44
+ {"template": "code-interpreter"}
45
+ ```
46
+
47
+ ```bash
48
+ b3os sandbox create --template code-interpreter
49
+ ```
50
+
51
+ ### CPUs
52
+
53
+ Virtual CPUs. The template's default size comes from a pool of microVMs started ahead of time; any other size is restored on demand, which is slower, and the first create at a new size also builds a snapshot for it.
54
+
55
+ - **Field:** `vcpu` on [create](https://docs.beta.b3os.org/api/post-v1-sandboxes)
56
+ - **Default:** the template's `defaults.vcpu` (1 for `base`)
57
+ - **Values:** 1 or more; at most your plan's `sandboxes.vcpu_max` (2 in the beta)
58
+ - **Invalid value:** [`400 invalid_request`](https://docs.beta.b3os.org/errors#invalid_request), [`422 limit_exceeded`](https://docs.beta.b3os.org/errors#limit_exceeded), [`429 rate_limited`](https://docs.beta.b3os.org/errors#rate_limited)
59
+ - **Guide:** [Sizes](https://docs.beta.b3os.org/sandboxes#sizes)
60
+
61
+ ```json
62
+ {"template": "base", "vcpu": 2}
63
+ ```
64
+
65
+ ```bash
66
+ b3os sandbox create --vcpu 2
67
+ ```
68
+
69
+ ### Memory
70
+
71
+ Memory, rounded up to 128 MiB or the next multiple of 256 MiB: a request for 600 runs with 768. The sandbox's `memory_mib` says what it got, and memory bills at that size.
72
+
73
+ - **Field:** `memory_mib` on [create](https://docs.beta.b3os.org/api/post-v1-sandboxes)
74
+ - **Default:** the template's `defaults.memory_mib` (512 MiB for `base`)
75
+ - **Values:** 128 MiB or more; at most your plan's `sandboxes.memory_max` (4,096 MiB in the beta)
76
+ - **Invalid value:** [`400 invalid_request`](https://docs.beta.b3os.org/errors#invalid_request), [`422 limit_exceeded`](https://docs.beta.b3os.org/errors#limit_exceeded)
77
+
78
+ ```json
79
+ {"template": "base", "memory_mib": 2048}
80
+ ```
81
+
82
+ ```bash
83
+ b3os sandbox create --memory-mib 2048
84
+ ```
85
+
86
+ ### Disk
87
+
88
+ The sandbox's disk size.
89
+
90
+ - **Field:** `disk_gib` on [create](https://docs.beta.b3os.org/api/post-v1-sandboxes)
91
+ - **Default:** the template's (4 GiB for `base`)
92
+ - **Values:** 1 GiB or more; at most the template's own disk, since disks do not grow in the beta
93
+ - **Invalid value:** [`400 invalid_request`](https://docs.beta.b3os.org/errors#invalid_request), [`422 limit_exceeded`](https://docs.beta.b3os.org/errors#limit_exceeded)
94
+
95
+ ```json
96
+ {"template": "base", "disk_gib": 4}
97
+ ```
98
+
99
+ ```bash
100
+ b3os sandbox create --disk-gib 4
101
+ ```
102
+
103
+ ## Lifetime
104
+
105
+ ### Lifetime
106
+
107
+ Seconds the sandbox runs from creation. A forgotten sandbox bills until then, so keep it short and extend it while you work: `POST …/timeout` on the sandbox sets a new lifetime from now, within the same bounds.
108
+
109
+ - **Field:** `timeout_s` on [create](https://docs.beta.b3os.org/api/post-v1-sandboxes)
110
+ - **Default:** 300 s
111
+ - **Values:** 10 to 86,400 s; capped by your plan's `sandboxes.timeout_max` (3,600 s in the beta)
112
+ - **Invalid value:** [`400 invalid_request`](https://docs.beta.b3os.org/errors#invalid_request), [`422 limit_exceeded`](https://docs.beta.b3os.org/errors#limit_exceeded)
113
+ - **Guide:** [Lifecycle](https://docs.beta.b3os.org/sandboxes#lifecycle)
114
+
115
+ ```json
116
+ {"template": "base", "timeout_s": 900}
117
+ ```
118
+
119
+ ```bash
120
+ b3os sandbox create --timeout-s 900
121
+ ```
122
+
123
+ ### At the timeout
124
+
125
+ What happens at `expires_at`. `stop` destroys the sandbox. `pause` keeps it, so a resume after extending the timeout continues where it was; a paused sandbox is kept for an hour. It acts at `expires_at`, not when the sandbox is idle, so the SDKs and CLI 0.1.3 call it `on_timeout`.
126
+
127
+ - **Field:** `on_idle` on [create](https://docs.beta.b3os.org/api/post-v1-sandboxes)
128
+ - **Default:** `stop`
129
+ - **Values:** `stop` or `pause`
130
+ - **Invalid value:** [`400 invalid_request`](https://docs.beta.b3os.org/errors#invalid_request)
131
+ - **Guide:** [Pause and resume](https://docs.beta.b3os.org/sandboxes/snapshots#pause-and-resume)
132
+
133
+ ```json
134
+ {"template": "base", "on_idle": "pause"}
135
+ ```
136
+
137
+ ```bash
138
+ b3os sandbox create --on-timeout pause
139
+ ```
140
+
141
+ ### Owner
142
+
143
+ Who the sandbox belongs to. With `key` it stops when the key that created it is revoked or expires, and its calls count toward that key's spend cap. With `project` it is a service of an application: it keeps running whatever happens to that key, within its grant, its organization's credits and its own spend cap, until it is deleted or taken down. `project` needs `metadata."b3os.app"` and a caller outside a sandbox; the deploy engine sets it for every service.
144
+
145
+ - **Field:** `owner` on [create](https://docs.beta.b3os.org/api/post-v1-sandboxes)
146
+ - **Default:** `key`
147
+ - **Values:** `key` or `project`
148
+ - **Invalid value:** [`400 invalid_request`](https://docs.beta.b3os.org/errors#invalid_request), [`403 forbidden`](https://docs.beta.b3os.org/errors#forbidden)
149
+ - **Guide:** [Services belong to their project](https://docs.beta.b3os.org/concepts/auth#services-belong-to-their-project)
150
+
151
+ ```json
152
+ {"template": "base", "owner": "project", "metadata": {"b3os.app": "researcher"}}
153
+ ```
154
+
155
+ ### Forkable
156
+
157
+ Tracks the memory the sandbox changes, so it can be forked into up to 10 children. Forkable sandboxes come from a smaller pool, so set it only when you will fork.
158
+
159
+ - **Field:** `forkable` on [create](https://docs.beta.b3os.org/api/post-v1-sandboxes)
160
+ - **Default:** `false`
161
+ - **Values:** `true` or `false`
162
+ - **Invalid value:** [`400 invalid_request`](https://docs.beta.b3os.org/errors#invalid_request)
163
+ - **Guide:** [Fork](https://docs.beta.b3os.org/sandboxes/snapshots#fork)
164
+
165
+ ```json
166
+ {"template": "base", "forkable": true}
167
+ ```
168
+
169
+ ### Fork count
170
+
171
+ How many children one fork call makes, each starting where the source was.
172
+
173
+ - **Field:** `count` on [fork](https://docs.beta.b3os.org/api/post-v1-sandboxes-sandbox-id-fork)
174
+ - **Default:** 1
175
+ - **Values:** 1 to 10
176
+ - **Invalid value:** [`400 invalid_request`](https://docs.beta.b3os.org/errors#invalid_request)
177
+
178
+ ```json
179
+ {"count": 4}
180
+ ```
181
+
182
+ ### Chrome reset on restore and fork
183
+
184
+ What happens to the `browser` template's Chrome in a sandbox restored from your snapshot (a create with `snapshot`) or forked. `full` replaces its renderers and network service when the sandbox starts, so `Math.random`, `crypto.getRandomValues` and WebSocket keys are fresh, and closes the tabs that were open at the snapshot. `none` keeps Chrome as the snapshot had it, its random state shared with the source. A create from a template ignores it, and it covers no other process. The `browser` template is not on the beta yet; where the node's image of it predates the reset, `full` is refused with `409 guest_outdated`.
185
+
186
+ - **Field:** `clone_reset` on [create](https://docs.beta.b3os.org/api/post-v1-sandboxes) and [fork](https://docs.beta.b3os.org/api/post-v1-sandboxes-sandbox-id-fork)
187
+ - **Default:** the node's: `full` on the beta node (create), the node's: `full` on the beta node, not the source's (fork)
188
+ - **Values:** `full` or `none`
189
+ - **Invalid value:** [`400 invalid_request`](https://docs.beta.b3os.org/errors#invalid_request), [`422 option_not_allowed`](https://docs.beta.b3os.org/errors#option_not_allowed)
190
+ - **Guide:** [Random state on restore and fork](https://docs.beta.b3os.org/sandboxes/snapshots#random-state-on-restore-and-fork)
191
+
192
+ ```json
193
+ {"count": 2, "clone_reset": "none"}
194
+ ```
195
+
196
+ ## Network and access
197
+
198
+ ### Egress
199
+
200
+ Where the sandbox's traffic may go. `public` reaches any public address, `allowlist` only the hosts in `egress.allow`, and `deny` nothing. Private, loopback and metadata addresses are refused under every mode. A caller outside the sandbox can change it later; code inside cannot.
201
+
202
+ - **Field:** `egress.mode` on [create](https://docs.beta.b3os.org/api/post-v1-sandboxes)
203
+ - **Default:** `public`
204
+ - **Values:** `public`, `allowlist` or `deny`
205
+ - **Invalid value:** [`400 invalid_request`](https://docs.beta.b3os.org/errors#invalid_request)
206
+ - **Guide:** [Networking](https://docs.beta.b3os.org/sandboxes#networking)
207
+
208
+ ```json
209
+ {"template": "base", "egress": {"mode": "allowlist", "allow": ["github.com", "*.githubusercontent.com"]}}
210
+ ```
211
+
212
+ ### API grant
213
+
214
+ What code inside the sandbox may call on B3OS at `http://127.0.0.1:7700`, with no key: a subset of your own scopes, and an optional spend cap. With `infer:run` the environment also points the OpenAI and Anthropic SDKs at the node's models.
215
+
216
+ - **Field:** `api.scopes` and `api.spend_cap_usd` on [create](https://docs.beta.b3os.org/api/post-v1-sandboxes)
217
+ - **Default:** none: code inside can call nothing (`api.scopes`), the creating key's own cap (`api.spend_cap_usd`)
218
+ - **Values:** scope names from [Scopes](https://docs.beta.b3os.org/platform#scopes), within your own (`api.scopes`); 0 USD or more (`api.spend_cap_usd`)
219
+ - **Invalid value:** [`400 invalid_request`](https://docs.beta.b3os.org/errors#invalid_request)
220
+ - **Guide:** [Agents in sandboxes](https://docs.beta.b3os.org/sandboxes/agents)
221
+
222
+ ```json
223
+ {"template": "base", "api": {"scopes": ["vision:run", "infer:run"]}}
224
+ ```
225
+
226
+ ```bash
227
+ b3os sandbox create --api-scope vision:run,infer:run
228
+ ```
229
+
230
+ ### Port URL lifetime
231
+
232
+ How long a URL minted for a private port works. Public ports ignore it; their URL's token lasts 7 days.
233
+
234
+ - **Field:** `ttl_s` on [port URL](https://docs.beta.b3os.org/api/post-v1-sandboxes-sandbox-id-ports-port-url)
235
+ - **Default:** 600 s
236
+ - **Values:** 60 to 86,400 s
237
+ - **Invalid value:** [`400 invalid_request`](https://docs.beta.b3os.org/errors#invalid_request)
238
+ - **Guide:** [Private ports](https://docs.beta.b3os.org/sandboxes/ports#private-ports)
239
+
240
+ ```json
241
+ {"ttl_s": 3600}
242
+ ```
243
+
244
+ ```bash
245
+ b3os sandbox port-url sbx_01example 8080 --ttl-s 3600
246
+ ```
247
+
248
+ ## Commands
249
+
250
+ ### Command timeout
251
+
252
+ Kills the command after this long.
253
+
254
+ - **Field:** `timeout_ms` on [exec](https://docs.beta.b3os.org/api/post-v1-sandboxes-sandbox-id-exec) and [run code](https://docs.beta.b3os.org/api/post-v1-sandboxes-sandbox-id-run-code)
255
+ - **Default:** 30,000 ms; none in the background (exec), 30,000 ms (run code)
256
+ - **Values:** 1 to 3,600,000 ms; an exec waits at most 60,000 ms unless its output is streamed or it runs in the background (exec); 1 to 60,000 ms (run code)
257
+ - **Invalid value:** [`400 invalid_request`](https://docs.beta.b3os.org/errors#invalid_request)
258
+
259
+ ```json
260
+ {"cmd": "make test", "timeout_ms": 60000}
261
+ ```
262
+
263
+ ```bash
264
+ b3os sandbox exec sbx_01example --timeout-ms 60000 -- make test
265
+ ```
266
+
267
+ ### Working directory
268
+
269
+ Where the command runs.
270
+
271
+ - **Field:** `cwd` on [exec](https://docs.beta.b3os.org/api/post-v1-sandboxes-sandbox-id-exec)
272
+ - **Default:** `/workspace`
273
+ - **Values:** an absolute path inside the sandbox
274
+ - **Invalid value:** [`400 invalid_request`](https://docs.beta.b3os.org/errors#invalid_request)
275
+
276
+ ```json
277
+ {"cmd": "ls", "cwd": "/tmp"}
278
+ ```
279
+
280
+ ```bash
281
+ b3os sandbox exec sbx_01example --cwd /tmp -- ls
282
+ ```
283
+
284
+ ### Run as
285
+
286
+ The user the command runs as. `root` can install system packages.
287
+
288
+ - **Field:** `user` on [exec](https://docs.beta.b3os.org/api/post-v1-sandboxes-sandbox-id-exec)
289
+ - **Default:** `user`
290
+ - **Values:** `user` or `root`
291
+ - **Invalid value:** [`400 invalid_request`](https://docs.beta.b3os.org/errors#invalid_request)
292
+
293
+ ```json
294
+ {"cmd": "apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y -o Dpkg::Options::=--force-confold ffmpeg", "user": "root"}
295
+ ```
296
+
297
+ ```bash
298
+ b3os sandbox exec sbx_01example --root -- 'apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y -o Dpkg::Options::=--force-confold ffmpeg'
299
+ ```
300
+
301
+ ### Background
302
+
303
+ Returns at once with the process ID; read the output from the logs stream.
304
+
305
+ - **Field:** `background` on [exec](https://docs.beta.b3os.org/api/post-v1-sandboxes-sandbox-id-exec)
306
+ - **Default:** `false`
307
+ - **Values:** `true` or `false`
308
+ - **Invalid value:** [`400 invalid_request`](https://docs.beta.b3os.org/errors#invalid_request)
309
+
310
+ ```json
311
+ {"cmd": "python3 -m http.server 8080", "background": true}
312
+ ```
313
+
314
+ ```bash
315
+ b3os sandbox exec sbx_01example --background -- python3 -m http.server 8080
316
+ ```
317
+
318
+ ### Restart in place
319
+
320
+ With `background`: the node starts the command again in the same sandbox when it exits (`on-failure`: after a non-zero code or a signal; `always`: after any exit), at once and then after 1, 2, 4 … up to 60 s. Five exits in 5 minutes show `crash_loop` in the sandbox's `supervised`. A kill through the API stops it for good.
321
+
322
+ - **Field:** `restart` on [exec](https://docs.beta.b3os.org/api/post-v1-sandboxes-sandbox-id-exec)
323
+ - **Default:** none: not supervised
324
+ - **Values:** `on-failure` or `always`
325
+ - **Invalid value:** [`400 invalid_request`](https://docs.beta.b3os.org/errors#invalid_request)
326
+
327
+ ```json
328
+ {"cmd": "python3 -m http.server 8080", "background": true, "restart": "always"}
329
+ ```
330
+
331
+ ### Code language
332
+
333
+ The kernel `run_code` sends the code to, in the `code-interpreter` template.
334
+
335
+ - **Field:** `language` on [run code](https://docs.beta.b3os.org/api/post-v1-sandboxes-sandbox-id-run-code)
336
+ - **Default:** `python`
337
+ - **Values:** `python` or `javascript`
338
+ - **Invalid value:** [`400 invalid_request`](https://docs.beta.b3os.org/errors#invalid_request)
339
+
340
+ ```json
341
+ {"code": "1 + 1", "language": "javascript"}
342
+ ```
343
+
344
+ ## Fixed in the beta
345
+
346
+ These work one way in the beta, and no request field changes them.
347
+
348
+ ### Paused sandboxes
349
+
350
+ **Kept 1 hour.** A sandbox paused by `on_idle: pause` is stopped an hour after it paused. Snapshots are kept 7 days.
351
+
352
+ ### The model variable
353
+
354
+ **Set with infer:run.** A sandbox whose grant includes `infer:run` gets `B3OS_MODEL`, the node's default model, beside `OPENAI_BASE_URL` and `ANTHROPIC_BASE_URL` pointing at the node. A value you set in `env` wins. The node sets the model, and no request field changes it.
355
+
356
+ ### Connections per sandbox
357
+
358
+ **512 open, 64 DNS lookups.** A sandbox may have 512 outbound connections open and 64 DNS queries in flight. More connections are refused; more queries are answered `SERVFAIL` at once.