@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.
- package/README.md +87 -7
- package/assets/b3os-run.py +137 -0
- package/assets/skill/b3os/SKILL.md +111 -0
- package/dist/commands/_agents.d.ts +14 -0
- package/dist/commands/_agents.js +33 -0
- package/dist/commands/_agents.js.map +1 -0
- package/dist/commands/_common.js +6 -2
- package/dist/commands/_common.js.map +1 -1
- package/dist/commands/_context.d.ts +49 -0
- package/dist/commands/_context.js +260 -0
- package/dist/commands/_context.js.map +1 -0
- package/dist/commands/_next.d.ts +39 -0
- package/dist/commands/_next.js +77 -0
- package/dist/commands/_next.js.map +1 -0
- package/dist/commands/agent.d.ts +42 -0
- package/dist/commands/agent.js +218 -0
- package/dist/commands/agent.js.map +1 -0
- package/dist/commands/app.d.ts +2 -0
- package/dist/commands/app.js +559 -54
- package/dist/commands/app.js.map +1 -1
- package/dist/commands/auth.d.ts +88 -2
- package/dist/commands/auth.js +354 -44
- package/dist/commands/auth.js.map +1 -1
- package/dist/commands/docs.d.ts +54 -0
- package/dist/commands/docs.js +202 -0
- package/dist/commands/docs.js.map +1 -0
- package/dist/commands/doctor.d.ts +23 -0
- package/dist/commands/doctor.js +313 -0
- package/dist/commands/doctor.js.map +1 -0
- package/dist/commands/init.d.ts +38 -1
- package/dist/commands/init.js +259 -60
- package/dist/commands/init.js.map +1 -1
- package/dist/commands/listen.d.ts +30 -0
- package/dist/commands/listen.js +194 -0
- package/dist/commands/listen.js.map +1 -0
- package/dist/commands/manifest.d.ts +13 -1
- package/dist/commands/manifest.js +81 -18
- package/dist/commands/manifest.js.map +1 -1
- package/dist/commands/mcp.d.ts +25 -2
- package/dist/commands/mcp.js +120 -11
- package/dist/commands/mcp.js.map +1 -1
- package/dist/commands/sandbox.d.ts +35 -6
- package/dist/commands/sandbox.js +208 -9
- package/dist/commands/sandbox.js.map +1 -1
- package/dist/commands/setup.d.ts +39 -0
- package/dist/commands/setup.js +203 -0
- package/dist/commands/setup.js.map +1 -0
- package/dist/commands/tool.d.ts +154 -0
- package/dist/commands/tool.js +785 -0
- package/dist/commands/tool.js.map +1 -0
- package/dist/config.d.ts +30 -6
- package/dist/config.js +39 -8
- package/dist/config.js.map +1 -1
- package/dist/ctx.d.ts +5 -45
- package/dist/ctx.js +25 -160
- package/dist/ctx.js.map +1 -1
- package/dist/docs/index.json +1 -0
- package/dist/docs/pages/actions/call.md +300 -0
- package/dist/docs/pages/actions/catalog/airtable.md +737 -0
- package/dist/docs/pages/actions/catalog/arxiv.md +166 -0
- package/dist/docs/pages/actions/catalog/chainalysis-sanctions.md +125 -0
- package/dist/docs/pages/actions/catalog/coingecko.md +1558 -0
- package/dist/docs/pages/actions/catalog/deps-dev.md +465 -0
- package/dist/docs/pages/actions/catalog/dexscreener.md +568 -0
- package/dist/docs/pages/actions/catalog/discord.md +784 -0
- package/dist/docs/pages/actions/catalog/finnhub.md +776 -0
- package/dist/docs/pages/actions/catalog/frankfurter.md +438 -0
- package/dist/docs/pages/actions/catalog/github.md +1853 -0
- package/dist/docs/pages/actions/catalog/gmail.md +575 -0
- package/dist/docs/pages/actions/catalog/google-calendar.md +654 -0
- package/dist/docs/pages/actions/catalog/google-drive.md +502 -0
- package/dist/docs/pages/actions/catalog/google-sheets.md +700 -0
- package/dist/docs/pages/actions/catalog/hacker-news.md +542 -0
- package/dist/docs/pages/actions/catalog/http.md +824 -0
- package/dist/docs/pages/actions/catalog/hyperliquid.md +942 -0
- package/dist/docs/pages/actions/catalog/jira.md +920 -0
- package/dist/docs/pages/actions/catalog/kalshi.md +917 -0
- package/dist/docs/pages/actions/catalog/linear.md +1030 -0
- package/dist/docs/pages/actions/catalog/markets.md +21 -0
- package/dist/docs/pages/actions/catalog/morpho.md +247 -0
- package/dist/docs/pages/actions/catalog/notion.md +1077 -0
- package/dist/docs/pages/actions/catalog/nws.md +485 -0
- package/dist/docs/pages/actions/catalog/open-meteo.md +559 -0
- package/dist/docs/pages/actions/catalog/polymarket.md +1523 -0
- package/dist/docs/pages/actions/catalog/pushbullet.md +220 -0
- package/dist/docs/pages/actions/catalog/resend.md +307 -0
- package/dist/docs/pages/actions/catalog/s3.md +513 -0
- package/dist/docs/pages/actions/catalog/sec-edgar.md +487 -0
- package/dist/docs/pages/actions/catalog/slack.md +2629 -0
- package/dist/docs/pages/actions/catalog/stripe.md +1405 -0
- package/dist/docs/pages/actions/catalog/wikipedia.md +379 -0
- package/dist/docs/pages/actions/catalog.md +46 -0
- package/dist/docs/pages/actions/limits.md +50 -0
- package/dist/docs/pages/actions/model-tools.md +225 -0
- package/dist/docs/pages/actions/packs.md +148 -0
- package/dist/docs/pages/actions/settings.md +69 -0
- package/dist/docs/pages/actions/tools.md +244 -0
- package/dist/docs/pages/actions/triggers.md +149 -0
- package/dist/docs/pages/actions.md +88 -0
- package/dist/docs/pages/compat/anthropic.md +168 -0
- package/dist/docs/pages/compat/e2b.md +194 -0
- package/dist/docs/pages/compat/firecrawl.md +138 -0
- package/dist/docs/pages/compat/openai.md +168 -0
- package/dist/docs/pages/concepts/auth.md +151 -0
- package/dist/docs/pages/concepts/beta.md +55 -0
- package/dist/docs/pages/concepts/glossary.md +71 -0
- package/dist/docs/pages/concepts/ids.md +98 -0
- package/dist/docs/pages/concepts/jobs.md +229 -0
- package/dist/docs/pages/concepts/latency.md +138 -0
- package/dist/docs/pages/concepts/limits.md +191 -0
- package/dist/docs/pages/concepts/stack.md +59 -0
- package/dist/docs/pages/concepts/timing.md +86 -0
- package/dist/docs/pages/concepts/usage.md +110 -0
- package/dist/docs/pages/design/b3os-yaml.md +370 -0
- package/dist/docs/pages/design/deploy-from-github.md +122 -0
- package/dist/docs/pages/design/observability.md +134 -0
- package/dist/docs/pages/errors.md +1824 -0
- package/dist/docs/pages/infer/chat.md +570 -0
- package/dist/docs/pages/infer/limits.md +55 -0
- package/dist/docs/pages/infer/messages.md +185 -0
- package/dist/docs/pages/infer/responses.md +173 -0
- package/dist/docs/pages/infer/settings.md +154 -0
- package/dist/docs/pages/infer/speech.md +323 -0
- package/dist/docs/pages/infer.md +154 -0
- package/dist/docs/pages/introduction.md +162 -0
- package/dist/docs/pages/platform/addresses.md +174 -0
- package/dist/docs/pages/platform/call-log.md +99 -0
- package/dist/docs/pages/platform/custom-domains.md +104 -0
- package/dist/docs/pages/platform/keys.md +79 -0
- package/dist/docs/pages/platform/limits.md +57 -0
- package/dist/docs/pages/platform/members.md +101 -0
- package/dist/docs/pages/platform/requests.md +116 -0
- package/dist/docs/pages/platform/settings.md +129 -0
- package/dist/docs/pages/platform/webhooks.md +68 -0
- package/dist/docs/pages/platform.md +67 -0
- package/dist/docs/pages/quickstart/mcp.md +94 -0
- package/dist/docs/pages/quickstart/sandbox-agent.md +205 -0
- package/dist/docs/pages/quickstart/scrape.md +134 -0
- package/dist/docs/pages/quickstart.md +45 -0
- package/dist/docs/pages/render/inspections.md +162 -0
- package/dist/docs/pages/render/limits.md +72 -0
- package/dist/docs/pages/render/screenshots.md +179 -0
- package/dist/docs/pages/render/settings.md +431 -0
- package/dist/docs/pages/render/styles.md +342 -0
- package/dist/docs/pages/render/videos.md +272 -0
- package/dist/docs/pages/render.md +118 -0
- package/dist/docs/pages/routines/callables.md +174 -0
- package/dist/docs/pages/routines/definitions.md +361 -0
- package/dist/docs/pages/routines/limits.md +117 -0
- package/dist/docs/pages/routines/runs.md +328 -0
- package/dist/docs/pages/routines/settings.md +104 -0
- package/dist/docs/pages/routines/triggers.md +339 -0
- package/dist/docs/pages/routines.md +216 -0
- package/dist/docs/pages/sandboxes/agents.md +217 -0
- package/dist/docs/pages/sandboxes/commands.md +272 -0
- package/dist/docs/pages/sandboxes/images.md +166 -0
- package/dist/docs/pages/sandboxes/limits.md +143 -0
- package/dist/docs/pages/sandboxes/ports.md +260 -0
- package/dist/docs/pages/sandboxes/settings.md +358 -0
- package/dist/docs/pages/sandboxes/snapshots.md +423 -0
- package/dist/docs/pages/sandboxes/swarms.md +146 -0
- package/dist/docs/pages/sandboxes/volumes.md +131 -0
- package/dist/docs/pages/sandboxes.md +231 -0
- package/dist/docs/pages/sdks/cli.md +121 -0
- package/dist/docs/pages/sdks/mcp.md +169 -0
- package/dist/docs/pages/sdks/python.md +146 -0
- package/dist/docs/pages/sdks/typescript.md +202 -0
- package/dist/docs/pages/sdks.md +282 -0
- package/dist/docs/pages/settings.md +33 -0
- package/dist/docs/pages/vault/limits.md +46 -0
- package/dist/docs/pages/vault.md +133 -0
- package/dist/docs/pages/vision/agent-browser.md +115 -0
- package/dist/docs/pages/vision/crawl.md +333 -0
- package/dist/docs/pages/vision/extract.md +152 -0
- package/dist/docs/pages/vision/fetcher.md +15 -0
- package/dist/docs/pages/vision/limits.md +79 -0
- package/dist/docs/pages/vision/profiles.md +111 -0
- package/dist/docs/pages/vision/proxy.md +131 -0
- package/dist/docs/pages/vision/scrape.md +356 -0
- package/dist/docs/pages/vision/sessions.md +311 -0
- package/dist/docs/pages/vision/settings.md +656 -0
- package/dist/docs/pages/vision.md +175 -0
- package/dist/errors.d.ts +129 -0
- package/dist/errors.js +326 -0
- package/dist/errors.js.map +1 -0
- package/dist/main.d.ts +1 -1
- package/dist/main.js +26 -13
- package/dist/main.js.map +1 -1
- package/dist/manifest/apply.d.ts +4 -0
- package/dist/manifest/apply.js +2 -0
- package/dist/manifest/apply.js.map +1 -1
- package/dist/manifest/domains.d.ts +50 -0
- package/dist/manifest/domains.js +159 -0
- package/dist/manifest/domains.js.map +1 -0
- package/dist/manifest/link.d.ts +20 -0
- package/dist/manifest/link.js +24 -0
- package/dist/manifest/link.js.map +1 -0
- package/dist/manifest/record.d.ts +1 -1
- package/dist/tool/archive.d.ts +33 -0
- package/dist/tool/archive.js +174 -0
- package/dist/tool/archive.js.map +1 -0
- package/dist/tool/calls.d.ts +46 -0
- package/dist/tool/calls.js +274 -0
- package/dist/tool/calls.js.map +1 -0
- package/dist/tool/checks.d.ts +21 -0
- package/dist/tool/checks.js +145 -0
- package/dist/tool/checks.js.map +1 -0
- package/dist/tool/elf.d.ts +19 -0
- package/dist/tool/elf.js +107 -0
- package/dist/tool/elf.js.map +1 -0
- package/dist/tool/predict.d.ts +8 -0
- package/dist/tool/predict.js +38 -0
- package/dist/tool/predict.js.map +1 -0
- package/dist/tool/ustar.d.ts +5 -0
- package/dist/tool/ustar.js +220 -0
- package/dist/tool/ustar.js.map +1 -0
- package/package.json +6 -5
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
# API keys
|
|
2
|
+
|
|
3
|
+
> Create API keys with only the scopes an agent needs, a spend cap and an expiry; rotate them, revoke them, and check what a key can do.
|
|
4
|
+
|
|
5
|
+
Source: https://docs.beta.b3os.org/platform/keys.md
|
|
6
|
+
|
|
7
|
+
Give each agent, service or CI job its own key, with only the scopes it needs. Creating keys needs `platform:write`, which the default key does not have: create the first such key in the dashboard.
|
|
8
|
+
|
|
9
|
+
## Create a key
|
|
10
|
+
|
|
11
|
+
**curl**
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
curl -s https://beta-api.b3os.org/v1/keys \
|
|
15
|
+
-H "Authorization: Bearer $B3OS_ADMIN_KEY" \
|
|
16
|
+
-H "Content-Type: application/json" \
|
|
17
|
+
-d '{"name": "research agent",
|
|
18
|
+
"scopes": ["vision:run", "sandboxes:write", "sandboxes:run", "infer:run"],
|
|
19
|
+
"spend_cap_usd": 20,
|
|
20
|
+
"expires_at": "2026-12-31T00:00:00Z"}'
|
|
21
|
+
```
|
|
22
|
+
**TypeScript**
|
|
23
|
+
|
|
24
|
+
```ts
|
|
25
|
+
import { B3OS } from "@b3os/sdk";
|
|
26
|
+
|
|
27
|
+
const admin = new B3OS({ apiKey: process.env.B3OS_ADMIN_KEY });
|
|
28
|
+
const key = await admin.keys.createKey({
|
|
29
|
+
name: "research agent",
|
|
30
|
+
scopes: ["vision:run", "sandboxes:write", "sandboxes:run", "infer:run"],
|
|
31
|
+
spend_cap_usd: 20,
|
|
32
|
+
expires_at: "2026-12-31T00:00:00Z",
|
|
33
|
+
});
|
|
34
|
+
console.log(key.secret); // shown once
|
|
35
|
+
```
|
|
36
|
+
**Python**
|
|
37
|
+
|
|
38
|
+
```python
|
|
39
|
+
import os
|
|
40
|
+
from b3os import B3OS
|
|
41
|
+
|
|
42
|
+
admin = B3OS(api_key=os.environ["B3OS_ADMIN_KEY"])
|
|
43
|
+
key = admin.keys.create_key({
|
|
44
|
+
"name": "research agent",
|
|
45
|
+
"scopes": ["vision:run", "sandboxes:write", "sandboxes:run", "infer:run"],
|
|
46
|
+
"spend_cap_usd": 20,
|
|
47
|
+
"expires_at": "2026-12-31T00:00:00Z",
|
|
48
|
+
})
|
|
49
|
+
print(key["secret"]) # shown once
|
|
50
|
+
```
|
|
51
|
+
**MCP**
|
|
52
|
+
|
|
53
|
+
Create keys from your own code, the dashboard or the CLI's `b3os keys`, not through an agent. Keep `platform:write` out of the keys your agents hold, so an agent can never mint itself a wider key.
|
|
54
|
+
|
|
55
|
+
The response includes `secret`, the only time it is returned, and `redacted`, the start and end of the secret for recognizing it later. Store the secret in your secret manager.
|
|
56
|
+
|
|
57
|
+
| Field | Meaning |
|
|
58
|
+
|---|---|
|
|
59
|
+
| `scopes` | Required. Scopes from the [catalog](https://docs.beta.b3os.org/concepts/auth#scopes), `<product>:*` or `*`; never more than the creating key holds |
|
|
60
|
+
| `spend_cap_usd` | Metered requests fail with `spend_cap_exceeded` once the key has spent this much in the billing period, so `0` refuses every metered call; `null` for no cap; never above the creating key's cap |
|
|
61
|
+
| `expires_at` | When the key stops working. A key that expires itself can create only keys that expire no later, so a CLI token cannot mint a key that outlives it |
|
|
62
|
+
| `project_id` | Another project in the same organization; your key's project by default |
|
|
63
|
+
|
|
64
|
+
Asking for scopes or a cap beyond your own fails with [`forbidden`](https://docs.beta.b3os.org/errors#forbidden), reason `scope_escalation`.
|
|
65
|
+
|
|
66
|
+
## Check a key
|
|
67
|
+
|
|
68
|
+
`GET /v1/keys/current` works with any valid credential and returns its kind, organization, project, scopes, spend cap and expiry. `GET /v1/keys` lists the organization's API keys and CLI tokens (filter by `project_id`, `status` or `kind`: `api_key` for `b3os_sk_` keys, `cli_token` for the `b3os_pat_` tokens of `b3os login`, whose `client_id` is `b3os-cli`), and `GET /v1/keys/{key_id}` shows one with its spend this period and its last use. Secrets are never returned after creation. Revoke a lost CLI token like any key.
|
|
69
|
+
|
|
70
|
+
## Change, rotate and revoke
|
|
71
|
+
|
|
72
|
+
- `PATCH /v1/keys/{key_id}` changes the name, spend cap, expiry or metadata. Scopes never change; create a new key instead. A caller with a cap or an expiry cannot set a larger cap or a later expiry than its own.
|
|
73
|
+
- To rotate, create a new key with the same scopes, deploy it, then revoke the old one. Services an application deployed with the old key keep running: they belong to the project, not to the key ([services belong to their project](https://docs.beta.b3os.org/concepts/auth#services-belong-to-their-project)). This holds for services deployed from GitHub or with CLI 0.2.2, the **next** release; a service deployed before services belonged to their project moves to it at its next deploy.
|
|
74
|
+
- `DELETE /v1/keys/{key_id}` revokes the key. Operations the API host answers itself refuse it at once, every other request within 10 seconds, and open streams authenticated by it close within a minute. Routines published with it pause their triggers until a new version is published with a valid key. Sandboxes it created stop, except the services it deployed, which belong to their project and keep running; the console's revoke dialog lists them and offers **Revoke and take down these**, and `b3os app down <app>` takes one down from a script. An expired key is treated the same way. A revoked key stays listed for audit. Changes made with `PATCH` take effect within the same 10 seconds.
|
|
75
|
+
- `DELETE /v1/keys/current` revokes the key or CLI token that sends it, the same way. It needs no scope, so a key without `platform:write` can retire itself. `b3os logout` calls it.
|
|
76
|
+
|
|
77
|
+
## Keys and sandboxes
|
|
78
|
+
|
|
79
|
+
Code in a sandbox never needs a key: it calls `http://127.0.0.1:7700` and runs with the scopes of the sandbox's grant, a subset of the key that created it. Do not put API keys in sandbox environment variables. See [agents in sandboxes](https://docs.beta.b3os.org/sandboxes/agents).
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
# Platform limits and FAQ
|
|
2
|
+
|
|
3
|
+
> Limits for keys, projects, CLI tokens, webhook secrets and the request log in the beta, and answers to common questions about the account side.
|
|
4
|
+
|
|
5
|
+
Source: https://docs.beta.b3os.org/platform/limits.md
|
|
6
|
+
|
|
7
|
+
## Limits
|
|
8
|
+
|
|
9
|
+
The organization-wide rate, concurrency and quota limits are on [limits](https://docs.beta.b3os.org/concepts/limits). These are the platform's own:
|
|
10
|
+
|
|
11
|
+
| Limit | Value |
|
|
12
|
+
|---|---|
|
|
13
|
+
| Active API keys per organization (`platform.keys.max`) | 1,000; revoked and expired keys and CLI tokens are not counted |
|
|
14
|
+
| Members per organization, pending invites included (`platform.members.max`) | 25 |
|
|
15
|
+
| Key and project `name` | 100 characters |
|
|
16
|
+
| `metadata` on any object | 16 pairs; keys up to 40 characters, values up to 500 characters |
|
|
17
|
+
| Request body for keys, projects and organizations | 16 KiB |
|
|
18
|
+
| CLI token from `b3os login` | 30 days |
|
|
19
|
+
| Email sign-in code | 6 digits, valid for 10 minutes |
|
|
20
|
+
| Webhook URL | 2,048 characters |
|
|
21
|
+
| Webhook secret rotation, `grace_s` | Up to 7 days; a day by default |
|
|
22
|
+
| Job webhook deliveries | Answer with a `2xx` within 10 seconds; failures are retried with backoff for 24 hours |
|
|
23
|
+
| Webhook delivery history | 7 days |
|
|
24
|
+
| Request log | 7 days |
|
|
25
|
+
| Idempotency keys | 24 hours, per project |
|
|
26
|
+
|
|
27
|
+
## Fixed in the beta
|
|
28
|
+
|
|
29
|
+
No request field changes these in the beta.
|
|
30
|
+
|
|
31
|
+
- [**Request log**](https://docs.beta.b3os.org/platform/settings#request-log): Kept 7 days. `GET /v1/requests` lists your requests from the last 7 days.
|
|
32
|
+
- [**Kept model calls**](https://docs.beta.b3os.org/platform/settings#kept-model-calls): Kept 7 days. A project that keeps model calls keeps each one 7 days on the node that served it; no setting keeps them longer.
|
|
33
|
+
- [**Size of a kept call**](https://docs.beta.b3os.org/platform/settings#size-of-a-kept-call): 256 KiB, 256 MiB a day. Each kept call holds at most 256 KiB of prompt and answer, and a project at most 256 MiB a UTC day; past either, the call keeps its metadata only.
|
|
34
|
+
|
|
35
|
+
## FAQ
|
|
36
|
+
|
|
37
|
+
**Why can my first key not create keys or read webhook secrets?**
|
|
38
|
+
|
|
39
|
+
The key you get when you redeem your invite has every product scope but not `platform:write`, `vault:write` or `*`. Create a key with `platform:write` in the [dashboard](https://beta.b3os.org/app), and keep it out of your agents' hands.
|
|
40
|
+
**Can I change a key's scopes?**
|
|
41
|
+
|
|
42
|
+
No. Scopes are fixed when the key is created. Create a key with the scopes you want, deploy it, then revoke the old one. `PATCH` changes only the name, spend cap, expiry and metadata.
|
|
43
|
+
**What happens when I revoke a key?**
|
|
44
|
+
|
|
45
|
+
Requests with it fail at once, and streams it opened close within a minute. Routines published with it pause their triggers until you publish a new version with a valid key. The revoked key stays listed for audit.
|
|
46
|
+
**Why does a call from my sandbox return 421 edge_only?**
|
|
47
|
+
|
|
48
|
+
Keys, usage, limits, organizations, projects and the pack registry are served at `https://beta-api.b3os.org` only, not on the node. Call them there with a key.
|
|
49
|
+
**Why is a request missing from GET /v1/requests?**
|
|
50
|
+
|
|
51
|
+
The list holds what the node served. Requests the edge answered by itself, such as key management or a request refused before it reached the node, are not listed; fetch them by their `x-request-id` with `GET /v1/requests/{request_id}`.
|
|
52
|
+
**Do two spellings of one URL share a webhook secret?**
|
|
53
|
+
|
|
54
|
+
Yes, when they differ only in the case of the scheme and host or in a default port: B3OS lowercases both and drops the port before it looks up the secret. Any other difference, such as a trailing slash or a query string, is a different URL with its own secret.
|
|
55
|
+
**Where do the dashboard's sign-in options come from?**
|
|
56
|
+
|
|
57
|
+
The dashboard signs you in with GitHub or with a 6-digit code sent by email, then keeps a session cookie. The CLI uses a device login instead, and code uses API keys. See [platform](https://docs.beta.b3os.org/platform#signing-in).
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
# Members and invites
|
|
2
|
+
|
|
3
|
+
> Invite people to an organization by email or by link, pick their role, see pending invites, and change, remove or leave members in the dashboard.
|
|
4
|
+
|
|
5
|
+
Source: https://docs.beta.b3os.org/platform/members.md
|
|
6
|
+
|
|
7
|
+
An organization's people sign in to the dashboard at `https://beta.b3os.org/app`. Owners and admins invite and manage them under **Settings > Members**. People manage people only from the dashboard: an API key or CLI token cannot invite, remove or change anyone.
|
|
8
|
+
|
|
9
|
+
## Roles
|
|
10
|
+
|
|
11
|
+
| Can | Owner | Admin | Member |
|
|
12
|
+
|---|---|---|---|
|
|
13
|
+
| Use every product | Yes | Yes | Yes |
|
|
14
|
+
| Create keys and projects | Yes | Yes | No |
|
|
15
|
+
| See members | Yes | Yes | Yes |
|
|
16
|
+
| See pending invites and activity | Yes | Yes | No |
|
|
17
|
+
| Invite | Any role | Admins and members | No |
|
|
18
|
+
| Resend an invite or make a new link | Any | Admin and member invites | No |
|
|
19
|
+
| Revoke an invite | Yes | Yes | No |
|
|
20
|
+
| Change a role | Any, owners included | Between admin and member, not an owner's | No |
|
|
21
|
+
| Remove a member | Anyone but the last owner | Admins and members | No |
|
|
22
|
+
| Leave | Unless the last owner | Yes | Yes |
|
|
23
|
+
|
|
24
|
+
An organization keeps at least one owner. Its only owner cannot be removed, demoted or leave (`409 last_owner`); make another member an owner first.
|
|
25
|
+
|
|
26
|
+
## Invite someone
|
|
27
|
+
|
|
28
|
+
1. Open **Settings > Members** and select **Invite**.
|
|
29
|
+
2. Choose **Email** and enter one or more addresses (up to 10 at a time, each its own invite), or choose **Link**.
|
|
30
|
+
3. Pick the role, then send the invites or create the link.
|
|
31
|
+
|
|
32
|
+
| | Email invite | Link invite |
|
|
33
|
+
|---|---|---|
|
|
34
|
+
| Who can accept | Someone signed in with that address, verified | Anyone who has the link |
|
|
35
|
+
| Roles | Owner, admin or member | Member only: invite admins and owners by email, or promote after they join |
|
|
36
|
+
| Lasts | 7 days | 3 days |
|
|
37
|
+
| Uses | Once | Once |
|
|
38
|
+
| Where the link is | In the email, from `login@b3os.org` | Shown once in the dashboard: copy it then |
|
|
39
|
+
|
|
40
|
+
Pending invites are listed under the members, expired ones included. **Resend** emails a new link and **New link** makes one for a link invite; either way the old link stops working and the invite lasts 7 or 3 days again. **Revoke** stops a link at once.
|
|
41
|
+
|
|
42
|
+
An address that is already a member, or already has a pending invite, is refused (`409 already_member`, `409 org_invite_exists`; resend that invite instead). The answer is the same whether the address has a B3OS account or not.
|
|
43
|
+
|
|
44
|
+
The email's subject names nobody: the organization and the person who invited are in the body, quoted, with anything that looks like a web address broken up so mail clients do not link it.
|
|
45
|
+
|
|
46
|
+
Limits: 25 members plus pending invites per organization (`platform.members.max`; ask to raise it), 30 invites an hour per person, 100 a day per organization, and invite emails to one address (plus-tags and Gmail dots count as the same address) at 5 a day from one organization and 20 a day from all of B3OS. Invite emails also count against the organization's own email budget (10 a minute, 100 a day) before the platform's, so one organization cannot hold up another's invites; an email that is refused or fails gives back what it counted.
|
|
47
|
+
|
|
48
|
+
## Accept an invite
|
|
49
|
+
|
|
50
|
+
1. Open the link from the email, or the one you were sent.
|
|
51
|
+
2. Select **Sign in to accept** and sign in with an email code or GitHub. A new address gets its account in the same step.
|
|
52
|
+
3. Select **Join**. The dashboard opens in the organization, with the role you were invited as.
|
|
53
|
+
|
|
54
|
+
An email invite needs the address it was sent to. Signed in with another one, the page says so and offers to sign out and switch; it never shows the invited address. If that address was not proven in the last 30 days (you signed in with GitHub, or last used an email code long ago), **Join** first emails a 6-digit code to it and asks for the code, here and under **Invites for you** alike. Pressing **Join** again within a minute of a code sends no other; after that minute, **Send a new code** sends one, which replaces the last. A code lasts 10 minutes and takes 5 tries, and one invite takes 10 tries a day across codes. An invite that was used, revoked or expired says to ask for a new one.
|
|
55
|
+
|
|
56
|
+
Invites to your own address also show under **Settings > Members** and on the first page after signing in, with **Join** and **Decline**, so you can accept one without the email.
|
|
57
|
+
|
|
58
|
+
The link carries its token after `#`, which a browser never sends to a server, so it does not appear in any request log. B3OS stores only a hash of it.
|
|
59
|
+
|
|
60
|
+
## Switch organizations
|
|
61
|
+
|
|
62
|
+
The project switcher at the top of the sidebar lists your other organizations under **Other organizations**; choosing one opens its first project. Keys, usage and everything else follow the organization you are in.
|
|
63
|
+
|
|
64
|
+
## Change a role, remove someone or leave
|
|
65
|
+
|
|
66
|
+
Owners and admins change roles with the select on each member's row, and remove someone from the row's menu. Your own row's menu has **Leave organization**.
|
|
67
|
+
|
|
68
|
+
When someone is removed or leaves:
|
|
69
|
+
|
|
70
|
+
- They lose the organization at once: their dashboard stops acting in it on its next request.
|
|
71
|
+
- Their CLI tokens for the organization are revoked, and a device login they approved but the CLI has not collected yet is refused. The CLI's exchange checks membership and role again, so such a login cannot become a token afterwards either.
|
|
72
|
+
- Pending invites they made are revoked, so a link they created cannot bring them back.
|
|
73
|
+
- The API keys they created in the organization are revoked, and so is every key made with one of those keys, however deep. Someone removing another person can untick **Also revoke the API keys they created**; the activity log then says how many were kept. Leaving always revokes your own. Revoked keys stay listed under **API keys**.
|
|
74
|
+
- Services those keys deployed keep running: they belong to their project, not to the key ([services belong to their project](https://docs.beta.b3os.org/concepts/auth#services-belong-to-their-project)). Routines and sandboxes a revoked key started behave as on any [key revoke](https://docs.beta.b3os.org/platform/keys#change-rotate-and-revoke).
|
|
75
|
+
|
|
76
|
+
What B3OS cannot take back, so check it yourself:
|
|
77
|
+
|
|
78
|
+
- A key they could see but did not make, such as a shared team key, is a secret B3OS cannot tie to them: rotate it.
|
|
79
|
+
- Repositories they linked keep deploying on push. If they can still push to one, unlink it or remove their access on GitHub. GitHub installations they connected stay with the organization.
|
|
80
|
+
- A stream that was already open (a terminal or log follow in the dashboard) is not cut at once; streams authenticated by a revoked key close within a minute.
|
|
81
|
+
|
|
82
|
+
Demoting someone to member is one change with its effects: their CLI tokens for the organization and approved device logins go (both carried admin scopes; `b3os login` again), as do the pending invites a member could not make. **Also revoke the API keys they created** is ticked by default, and the API does the same unless `revoke_api_keys` is `false`; kept keys keep the admin scopes they were made with. A change that is refused, or that someone else made a moment earlier, revokes nothing and records nothing.
|
|
83
|
+
|
|
84
|
+
## Activity
|
|
85
|
+
|
|
86
|
+
Owners and admins see the latest entries under **Settings > Members**: who invited, resent, revoked, accepted, declined, changed a role, removed or left. The full log is `GET /v1/orgs/{org_id}/audit` from the dashboard session.
|
|
87
|
+
|
|
88
|
+
## From the API
|
|
89
|
+
|
|
90
|
+
These operations are served at `https://beta.b3os.org` to the signed-in dashboard (session cookie and `x-b3os-csrf`):
|
|
91
|
+
|
|
92
|
+
| Operation | Call |
|
|
93
|
+
|---|---|
|
|
94
|
+
| List members | `GET /v1/orgs/{org_id}/members` (also with an API key that has `platform:read`) |
|
|
95
|
+
| Change a role | `PATCH /v1/orgs/{org_id}/members/{user_id}` with `role`, and `revoke_api_keys` for a demotion to member |
|
|
96
|
+
| Count what a removal revokes | `GET /v1/orgs/{org_id}/members/{user_id}/credentials` |
|
|
97
|
+
| Remove a member, or leave with your own id | `DELETE /v1/orgs/{org_id}/members/{user_id}` (`?keep_api_keys=true` only when removing someone else) |
|
|
98
|
+
| List, create, resend and revoke invites | `GET`, `POST /v1/orgs/{org_id}/invites`; `POST .../invites/{invite_id}/resend`; `DELETE .../invites/{invite_id}` |
|
|
99
|
+
| Look up, accept, list and decline invites to you | `POST /v1/auth/org-invites/lookup`, `POST /v1/auth/org-invites/accept`, `GET /v1/auth/org-invites`, `POST /v1/auth/org-invites/decline` |
|
|
100
|
+
|
|
101
|
+
Their errors are on [error codes](https://docs.beta.b3os.org/errors), under Platform: `member_not_found`, `last_owner`, `already_member`, `org_invite_exists`, `org_invite_not_found`, `org_invite_invalid`, `org_invite_expired`, `org_invite_wrong_account`, `org_invite_code_required` and `org_invite_code_invalid`. Activity entries are kept 365 days.
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
# Request log
|
|
2
|
+
|
|
3
|
+
> Look up any request by its ID to see where its time went, or list recent requests by product, status, key, source, trace, connection or sandbox, for 7 days.
|
|
4
|
+
|
|
5
|
+
Source: https://docs.beta.b3os.org/platform/requests.md
|
|
6
|
+
|
|
7
|
+
The node records every request it serves, whichever way it arrived: through the edge, from inside a sandbox, or from a tool on the node. One kind is left out: the dashboard's successful reads (a signed-in page refreshing its lists); the dashboard's writes, errors, streams and profile state exports are recorded. Each record has the request's status, size, duration and timing phases, and the edge adds its own phases under the same ID. Records are kept for 7 days. Every read of a kept model call's prompt and answer ([prompt logging](https://docs.beta.b3os.org/platform/call-log)) is recorded, the dashboard's too. Both calls need `platform:read`; [the calls from one sandbox](#calls-from-one-sandbox) need only `sandboxes:read`.
|
|
8
|
+
|
|
9
|
+
## Look up one request
|
|
10
|
+
|
|
11
|
+
Every response carries `x-request-id`, and every problem repeats it as `instance`:
|
|
12
|
+
|
|
13
|
+
**curl**
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
curl -s "https://beta-api.b3os.org/v1/requests/$REQUEST_ID" \
|
|
17
|
+
-H "Authorization: Bearer $B3OS_API_KEY"
|
|
18
|
+
```
|
|
19
|
+
**TypeScript**
|
|
20
|
+
|
|
21
|
+
```ts
|
|
22
|
+
const record = await b3os.requests.getRequest(requestId);
|
|
23
|
+
for (const phase of record.phases) console.log(phase.source, phase.name, phase.duration_ms);
|
|
24
|
+
```
|
|
25
|
+
**Python**
|
|
26
|
+
|
|
27
|
+
```python
|
|
28
|
+
record = b3os.requests.get_request(request_id)
|
|
29
|
+
for phase in record["phases"]:
|
|
30
|
+
print(phase["source"], phase["name"], phase["duration_ms"])
|
|
31
|
+
```
|
|
32
|
+
**MCP**
|
|
33
|
+
|
|
34
|
+
With the `platform` toolset (`--toolsets platform`, or `?toolsets=platform` on the remote URL), ask the agent where the time went in a request ID: `requests_get` reads the record with its phases and its error, and `requests_list` lists recent requests, filtered as the API filters them. Both need `platform:read`. See [MCP server](https://docs.beta.b3os.org/sdks/mcp#read-traces-requests-and-runs).
|
|
35
|
+
|
|
36
|
+
| Field | Meaning |
|
|
37
|
+
|---|---|
|
|
38
|
+
| `method`, `path`, `operation_id`, `product` | What was called; the path has no query string |
|
|
39
|
+
| `status_code`, `error_code` | The response status, and the problem's `code` when it failed |
|
|
40
|
+
| `org_id`, `project_id`, `key_id` | Who called. For calls from a sandbox, `key_id` is the key that created the sandbox. |
|
|
41
|
+
| `source` | What made the call: `api_key`, `cli_token` (the CLI's device login), `dashboard` (a signed-in session), `sandbox`, `routine`, `local` (a tool on the node's Unix socket) or `public` (a webhook to a public route, or a request refused before its credential was checked) |
|
|
42
|
+
| `node` | The node that served it; `null` when the edge answered by itself |
|
|
43
|
+
| `connection` | `edge`, `sandbox`, `uds` (the node's Unix socket) or `tcp` (the node's loopback port) |
|
|
44
|
+
| `sandbox_id` | The calling sandbox, for `sandbox` connections |
|
|
45
|
+
| `started_at`, `duration_ms` | Start time, and first request byte to last response byte, measured on the node (for streams, until the stream ended) |
|
|
46
|
+
| `request_bytes`, `response_bytes` | Body sizes |
|
|
47
|
+
| `phases` | The node's phases (`source: node`) and the edge's `edge_auth` and `edge_upstream` (`source: edge`), in order |
|
|
48
|
+
| `trace_id` | The W3C trace ID from the `traceparent` you sent |
|
|
49
|
+
| `user_agent` | The client's user agent |
|
|
50
|
+
| `action` | The pack action the request ran, or `null`: a `POST /v1/actions/call`, or one tool call of a sandbox's [MCP server](https://docs.beta.b3os.org/actions/model-tools) (`tool` set). `ref` (the exact version that ran), `pack`, `tool`, and the call's own `status_code` and `error_code`, since a tool call answers HTTP 200 either way |
|
|
51
|
+
|
|
52
|
+
For a request the edge answered itself, such as key management or a request refused before forwarding, the edge returns its own record: `node` is `null` and only edge phases appear.
|
|
53
|
+
|
|
54
|
+
The same record in the dashboard: filter the log, then open a call.
|
|
55
|
+
|
|
56
|
+
[Open the video](https://beta.b3os.org/gallery/docs-site/demo-requests/49e7cd878a3afda7.mp4) · [Transcript (WebVTT)](https://beta.b3os.org/gallery/docs-site/demo-requests/467d70eff8d9b496.vtt)
|
|
57
|
+
|
|
58
|
+
<details>
|
|
59
|
+
<summary>Transcript</summary>
|
|
60
|
+
|
|
61
|
+
`0:00` Every call made with this project shows up here.
|
|
62
|
+
|
|
63
|
+
`0:04` Filter by product to find one.
|
|
64
|
+
|
|
65
|
+
`0:06` Open one to see where its time went.
|
|
66
|
+
|
|
67
|
+
</details>
|
|
68
|
+
|
|
69
|
+
<sub>Captured 2026-11-15 from commit `2aac696d` on a GitHub Actions runner (colo MSP), one call, label `mock` (the dashboard in mock mode). Case `docs-site/demo-requests`.</sub>
|
|
70
|
+
|
|
71
|
+
## List recent requests
|
|
72
|
+
|
|
73
|
+
`GET /v1/requests` lists the node's records for your project, newest first:
|
|
74
|
+
|
|
75
|
+
```bash
|
|
76
|
+
curl -s -G https://beta-api.b3os.org/v1/requests \
|
|
77
|
+
-H "Authorization: Bearer $B3OS_API_KEY" \
|
|
78
|
+
-d product=vision -d status=5xx -d limit=50
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
| Filter | Example |
|
|
82
|
+
|---|---|
|
|
83
|
+
| `product` | `vision` |
|
|
84
|
+
| `operation_id` | `visionScrape` |
|
|
85
|
+
| `status` | `2xx`, `4xx` or `5xx` |
|
|
86
|
+
| `key_id` | `key_01m5t5csy2wt4e3er052chyf1x` |
|
|
87
|
+
| `source` | `cli_token`, or a list: `api_key,cli_token,sandbox,routine,local,public` is everything but the dashboard |
|
|
88
|
+
| `trace_id` | One chain of calls: every request sent with a `traceparent` of this trace ID |
|
|
89
|
+
| `connection` | `sandbox` |
|
|
90
|
+
| `sandbox_id` | All calls one sandbox made |
|
|
91
|
+
| `pack` | `io.b3os/wikipedia`: the calls that ran one of that pack's actions, as a tool or through `POST /v1/actions/call` |
|
|
92
|
+
| `since` | An RFC 3339 time |
|
|
93
|
+
|
|
94
|
+
Without `source` every source is listed. The dashboard's Requests page leaves `dashboard` out until you tick "Show dashboard changes", and a request's trace ID there links to the rest of its chain.
|
|
95
|
+
|
|
96
|
+
The SDKs send one `traceparent` per chain of calls on a handle, so a scrape, the render of its page and the sandbox exec that read it share a trace ID:
|
|
97
|
+
|
|
98
|
+
```bash
|
|
99
|
+
curl -s -G https://beta-api.b3os.org/v1/requests \
|
|
100
|
+
-H "Authorization: Bearer $B3OS_API_KEY" \
|
|
101
|
+
-d trace_id=4bf92f3577b34da6a3ce929d0e0e4736
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
The list holds what the node served. Requests the edge answered without forwarding are not listed; fetch those by ID. [Timing](https://docs.beta.b3os.org/concepts/timing) explains how to read the phases.
|
|
105
|
+
|
|
106
|
+
## Calls from one sandbox
|
|
107
|
+
|
|
108
|
+
`GET /v1/sandboxes/{sandbox_id}/requests` lists the calls code in one sandbox made to B3OS, such as a deployed service's model calls and scrapes. It needs only `sandboxes:read`, which a deploy key has, and returns that sandbox's records and no others. It takes the same paging and the `product`, `operation_id`, `status`, `trace_id`, `since` and `pack` filters; any other filter is `400 invalid_request`. Requests made to the sandbox's public ports are not listed.
|
|
109
|
+
|
|
110
|
+
```bash
|
|
111
|
+
curl -s -G "https://beta-api.b3os.org/v1/sandboxes/$SBX/requests" \
|
|
112
|
+
-H "Authorization: Bearer $B3OS_API_KEY" \
|
|
113
|
+
-d status=5xx
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
With CLI 0.2.0, `b3os app requests research-agent --failed` lists the failed calls of each service of a deployed application, `b3os app status` shows each running service's last call, and `b3os requests --sandbox-id sbx_…` reads one sandbox this way.
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
# Platform settings
|
|
2
|
+
|
|
3
|
+
> The settings of API keys, CLI logins and webhook secrets: scopes, spend caps, expiry and rotation, with defaults and examples.
|
|
4
|
+
|
|
5
|
+
Source: https://docs.beta.b3os.org/platform/settings.md
|
|
6
|
+
|
|
7
|
+
Keys, CLI logins and webhook signing secrets take a few settings of their own. A key's scopes and spend cap bound everything made with it, sandboxes' grants included.
|
|
8
|
+
|
|
9
|
+
| Setting | Default |
|
|
10
|
+
|---|---|
|
|
11
|
+
| [Key scopes](#key-scopes): `scopes` | every scope except `vision:profiles:export`, `vault:write` and `platform:write` |
|
|
12
|
+
| [Spend cap](#spend-cap): `spend_cap_usd` | none |
|
|
13
|
+
| [CLI login lifetime](#cli-login-lifetime): `expires_in_days` | 30 days |
|
|
14
|
+
| [CLI login scopes](#cli-login-scopes): `scopes` | what the CLI asked for, within your role |
|
|
15
|
+
| [Webhook secret overlap](#webhook-secret-overlap): `grace_s` | 86,400 s |
|
|
16
|
+
| [Prompt logging](#prompt-logging): `value` | `off` |
|
|
17
|
+
|
|
18
|
+
## Keys and logins
|
|
19
|
+
|
|
20
|
+
### Key scopes
|
|
21
|
+
|
|
22
|
+
What the key may call. Give an agent's key only the products it needs; `sandboxes:write`, `vault:*` and `platform:*` are granted only when named exactly.
|
|
23
|
+
|
|
24
|
+
- **Field:** `scopes` on [create key](https://docs.beta.b3os.org/api/post-v1-keys)
|
|
25
|
+
- **Default:** every scope except `vision:profiles:export`, `vault:write` and `platform:write`
|
|
26
|
+
- **Values:** scope names from [Scopes](https://docs.beta.b3os.org/platform#scopes), such as `vision:run` or `sandboxes:*`
|
|
27
|
+
- **Invalid value:** [`400 invalid_request`](https://docs.beta.b3os.org/errors#invalid_request)
|
|
28
|
+
- **Guide:** [Scopes](https://docs.beta.b3os.org/platform#scopes)
|
|
29
|
+
|
|
30
|
+
```json
|
|
31
|
+
{"name": "scraper", "scopes": ["vision:run", "vision:read"]}
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
b3os keys create --name scraper --scope vision:run,vision:read
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
### Spend cap
|
|
39
|
+
|
|
40
|
+
Stops the key's calls once they have spent this much. Sandboxes the key creates inherit it.
|
|
41
|
+
|
|
42
|
+
- **Field:** `spend_cap_usd` on [create key](https://docs.beta.b3os.org/api/post-v1-keys)
|
|
43
|
+
- **Default:** none
|
|
44
|
+
- **Values:** 0 USD or more
|
|
45
|
+
- **Invalid value:** [`400 invalid_request`](https://docs.beta.b3os.org/errors#invalid_request)
|
|
46
|
+
|
|
47
|
+
```json
|
|
48
|
+
{"name": "scraper", "scopes": ["vision:run"], "spend_cap_usd": 25}
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
```bash
|
|
52
|
+
b3os keys create --name scraper --scope vision:run --spend-cap-usd 25
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
### CLI login lifetime
|
|
56
|
+
|
|
57
|
+
How long the token from `b3os login` works. The approval page in the dashboard sends it; log in again for a new token, and `b3os logout` revokes the old one.
|
|
58
|
+
|
|
59
|
+
- **Field:** `expires_in_days` on the dashboard's CLI login approval
|
|
60
|
+
- **Default:** 30 days
|
|
61
|
+
- **Values:** 1 to 30 days
|
|
62
|
+
- **Invalid value:** [`400 invalid_request`](https://docs.beta.b3os.org/errors#invalid_request)
|
|
63
|
+
- **Guide:** [Signing in](https://docs.beta.b3os.org/platform#signing-in)
|
|
64
|
+
|
|
65
|
+
### CLI login scopes
|
|
66
|
+
|
|
67
|
+
What the token from `b3os login` may do. On the approval page, uncheck the scopes the CLI does not need.
|
|
68
|
+
|
|
69
|
+
- **Field:** `scopes` on the dashboard's CLI login approval
|
|
70
|
+
- **Default:** what the CLI asked for, within your role
|
|
71
|
+
- **Values:** scope names from [Scopes](https://docs.beta.b3os.org/platform#scopes)
|
|
72
|
+
- **Invalid value:** [`400 invalid_request`](https://docs.beta.b3os.org/errors#invalid_request)
|
|
73
|
+
- **Guide:** [Signing in](https://docs.beta.b3os.org/platform#signing-in)
|
|
74
|
+
|
|
75
|
+
### Webhook secret overlap
|
|
76
|
+
|
|
77
|
+
After a rotation, how long the old signing secret keeps signing beside the new one, so receivers can switch without dropping deliveries.
|
|
78
|
+
|
|
79
|
+
- **Field:** `grace_s` on [rotate the webhook secret](https://docs.beta.b3os.org/api/post-v1-webhooks-secret-rotate)
|
|
80
|
+
- **Default:** 86,400 s
|
|
81
|
+
- **Values:** 0 to 604,800 s
|
|
82
|
+
- **Invalid value:** [`400 invalid_request`](https://docs.beta.b3os.org/errors#invalid_request)
|
|
83
|
+
- **Guide:** [Webhooks](https://docs.beta.b3os.org/platform/webhooks)
|
|
84
|
+
|
|
85
|
+
```json
|
|
86
|
+
{"url": "https://example.com/hooks", "grace_s": 3600}
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
```bash
|
|
90
|
+
b3os webhooks rotate --url https://example.com/hooks --grace-s 3600
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
## Model calls
|
|
94
|
+
|
|
95
|
+
### Prompt logging
|
|
96
|
+
|
|
97
|
+
`model` keeps each chat completion, Responses and Messages call's prompt, tools and answer on the node for 7 days, with known key shapes removed. Set it per project (`settings:write`), per organization (owners and admins), in `b3os.yaml`, or turn it off for one request with `X-B3OS-Capture-Content: off`.
|
|
98
|
+
|
|
99
|
+
- **Field:** `value` on [set a project setting](https://docs.beta.b3os.org/api/put-v1-projects-project-id-settings-option-)
|
|
100
|
+
- **Default:** `off`
|
|
101
|
+
- **Values:** `off` or `model` for `platform.capture_content`; `errors` and `all` are reserved
|
|
102
|
+
- **Invalid value:** [`422 invalid_option`](https://docs.beta.b3os.org/errors#invalid_option), [`422 option_not_allowed`](https://docs.beta.b3os.org/errors#option_not_allowed)
|
|
103
|
+
- **Guide:** [Prompt logging](https://docs.beta.b3os.org/platform/call-log)
|
|
104
|
+
|
|
105
|
+
```json
|
|
106
|
+
{"value": "model"}
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
## Fixed in the beta
|
|
110
|
+
|
|
111
|
+
These work one way in the beta, and no request field changes them.
|
|
112
|
+
|
|
113
|
+
### Request log
|
|
114
|
+
|
|
115
|
+
**Kept 7 days.** `GET /v1/requests` lists your requests from the last 7 days.
|
|
116
|
+
|
|
117
|
+
- **Guide:** [Requests](https://docs.beta.b3os.org/platform/requests)
|
|
118
|
+
|
|
119
|
+
### Kept model calls
|
|
120
|
+
|
|
121
|
+
**Kept 7 days.** A project that keeps model calls keeps each one 7 days on the node that served it; no setting keeps them longer.
|
|
122
|
+
|
|
123
|
+
- **Guide:** [Prompt logging](https://docs.beta.b3os.org/platform/call-log)
|
|
124
|
+
|
|
125
|
+
### Size of a kept call
|
|
126
|
+
|
|
127
|
+
**256 KiB, 256 MiB a day.** Each kept call holds at most 256 KiB of prompt and answer, and a project at most 256 MiB a UTC day; past either, the call keeps its metadata only.
|
|
128
|
+
|
|
129
|
+
- **Guide:** [Prompt logging](https://docs.beta.b3os.org/platform/call-log)
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
# Webhooks
|
|
2
|
+
|
|
3
|
+
> Get the signing secret for a webhook URL, send a test delivery, read the delivery history, and rotate secrets without dropping events.
|
|
4
|
+
|
|
5
|
+
Source: https://docs.beta.b3os.org/platform/webhooks.md
|
|
6
|
+
|
|
7
|
+
Jobs (crawls, batches, videos, routine runs) post their events to the URL you pass in `webhook`. Each delivery is signed with a secret that belongs to that URL. [Jobs, streams and webhooks](https://docs.beta.b3os.org/concepts/jobs#webhooks) shows the payload and how to verify it; this page covers the secret and the history.
|
|
8
|
+
|
|
9
|
+
## Get the secret
|
|
10
|
+
|
|
11
|
+
**curl**
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
curl -s https://beta-api.b3os.org/v1/webhooks/secret \
|
|
15
|
+
-H "Authorization: Bearer $B3OS_API_KEY" \
|
|
16
|
+
-H "Content-Type: application/json" \
|
|
17
|
+
-d '{"url": "https://example.com/hooks/b3os"}'
|
|
18
|
+
```
|
|
19
|
+
**TypeScript**
|
|
20
|
+
|
|
21
|
+
```ts
|
|
22
|
+
// `secret` is a string only in the first answer for a URL (and after a rotation); store it then.
|
|
23
|
+
const { secret } = await b3os.webhooks.getSecret({ url: "https://example.com/hooks/b3os" });
|
|
24
|
+
```
|
|
25
|
+
**Python**
|
|
26
|
+
|
|
27
|
+
```python
|
|
28
|
+
# `secret` is a string only in the first answer for a URL (and after a rotation); store it then.
|
|
29
|
+
secret = b3os.webhooks.get_secret({"url": "https://example.com/hooks/b3os"})["secret"]
|
|
30
|
+
```
|
|
31
|
+
**MCP**
|
|
32
|
+
|
|
33
|
+
Webhook secrets belong in your receiver's configuration, not in an agent's context. Fetch them from code.
|
|
34
|
+
|
|
35
|
+
The first call for a URL creates its secret (`whsec_...`) and returns it, once. Later calls answer `secret: null` with `secret_hint`, the secret's last four characters, so you can tell which one you stored. Store the secret from the first answer; if it is lost, [rotate](#rotate-the-secret) it to get a new one. URLs are compared after lowercasing the scheme and host and dropping a default port, so `HTTPS://Example.com:443/hooks/b3os` and `https://example.com/hooks/b3os` share a secret. The call needs `platform:write`.
|
|
36
|
+
|
|
37
|
+
## Test the receiver
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
curl -s https://beta-api.b3os.org/v1/webhooks/test \
|
|
41
|
+
-H "Authorization: Bearer $B3OS_API_KEY" \
|
|
42
|
+
-H "Content-Type: application/json" \
|
|
43
|
+
-d '{"url": "https://example.com/hooks/b3os"}'
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
B3OS sends one signed `webhook.test` event now and returns the delivery with the outcome of that single attempt: `status`, `last_status_code` and `last_error`. Test deliveries are not retried.
|
|
47
|
+
|
|
48
|
+
## Delivery history
|
|
49
|
+
|
|
50
|
+
`GET /v1/webhooks/deliveries` lists the last 7 days of deliveries, newest first, with their attempts, last status code, last error and next attempt. Filter with `url`, `job_id` or `status` (`pending`, `retrying`, `succeeded`, `failed`). Each delivery's `id` is the event ID in its body.
|
|
51
|
+
|
|
52
|
+
Failed deliveries are retried with backoff for 24 hours. Answer with a 2xx status quickly and do the work afterwards; deliveries come from the node through the egress guard, so receivers on private or loopback addresses never get them.
|
|
53
|
+
|
|
54
|
+
## Rotate the secret
|
|
55
|
+
|
|
56
|
+
```bash
|
|
57
|
+
curl -s https://beta-api.b3os.org/v1/webhooks/secret/rotate \
|
|
58
|
+
-H "Authorization: Bearer $B3OS_API_KEY" \
|
|
59
|
+
-H "Content-Type: application/json" \
|
|
60
|
+
-d '{"url": "https://example.com/hooks/b3os", "grace_s": 86400}'
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
For `grace_s` seconds (a day by default, up to 7 days) every delivery carries two `v1` signatures, one per secret, and `previous_valid_until` says when the old one stops. Deploy the new secret to your receiver within that window; a receiver that accepts any matching `v1` keeps working throughout.
|
|
64
|
+
|
|
65
|
+
## Other webhooks
|
|
66
|
+
|
|
67
|
+
- Firecrawl-compatible jobs (crawls and batches through `/compat/firecrawl`) accept and validate `webhook` but do not deliver it yet in this beta: their payload and `X-Firecrawl-Signature` header are not built yet. Native vision jobs deliver. See [Firecrawl compatibility](https://docs.beta.b3os.org/compat/firecrawl).
|
|
68
|
+
- Webhooks into B3OS, which start routine runs, are a different thing: see [triggers](https://docs.beta.b3os.org/routines/triggers#webhooks).
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
# Platform
|
|
2
|
+
|
|
3
|
+
> The account side of B3OS beta, covering organizations, projects, keys, CLI login, usage, limits, webhook secrets and the per-request log.
|
|
4
|
+
|
|
5
|
+
Source: https://docs.beta.b3os.org/platform.md
|
|
6
|
+
|
|
7
|
+
Platform covers everything around the products: who can call them, what they used, and what happened on each request.
|
|
8
|
+
|
|
9
|
+
| You want | Call | Served by |
|
|
10
|
+
|---|---|---|
|
|
11
|
+
| Create, list, update and revoke API keys | [`/v1/keys`](https://docs.beta.b3os.org/platform/keys) | Edge |
|
|
12
|
+
| See who a credential is | `GET /v1/keys/current` | Edge |
|
|
13
|
+
| Usage totals and records | [`/v1/usage`](https://docs.beta.b3os.org/concepts/usage) | Edge |
|
|
14
|
+
| Your limits and current usage against them | [`GET /v1/limits`](https://docs.beta.b3os.org/concepts/limits) | Edge |
|
|
15
|
+
| Organizations, [members and invites](https://docs.beta.b3os.org/platform/members), projects | `/v1/orgs`, `/v1/projects` | Edge |
|
|
16
|
+
| Signing secrets and delivery history for job webhooks | [`/v1/webhooks`](https://docs.beta.b3os.org/platform/webhooks) | Node |
|
|
17
|
+
| The record of any request, with its timing phases | [`/v1/requests`](https://docs.beta.b3os.org/platform/requests) | Node |
|
|
18
|
+
|
|
19
|
+
Edge-served operations answer at `https://beta-api.b3os.org` only. From inside a sandbox they return [`421 edge_only`](https://docs.beta.b3os.org/errors#edge_only).
|
|
20
|
+
|
|
21
|
+
<a href="https://beta.b3os.org/gallery/docs-site/shot-overview/e32820117b7e8522.webp"><img src="https://beta.b3os.org/gallery/docs-site/shot-overview/e32820117b7e8522.webp" srcset="https://beta.b3os.org/gallery/docs-site/shot-overview/03d1744a64d0d7f4.webp 640w, https://beta.b3os.org/gallery/docs-site/shot-overview/82365e8f8567c83f.webp 1080w, https://beta.b3os.org/gallery/docs-site/shot-overview/e32820117b7e8522.webp 2910w" sizes="(max-width: 640px) calc(100vw - 60px), 760px" alt="The dashboard's overview: image from the capture docs-site/shot-overview" width="2910" height="2038" loading="lazy" /></a>
|
|
22
|
+
|
|
23
|
+
<sub>Captured 2026-11-15 from commit `2aac696d` on a GitHub Actions runner (colo MSP), one call, label `mock` (the dashboard in mock mode). Case `docs-site/shot-overview`.</sub>
|
|
24
|
+
|
|
25
|
+
## Organizations and projects
|
|
26
|
+
|
|
27
|
+
Your invite creates an organization with one project, named `default`, and a first key. Members have a role in the organization: `owner`, `admin` or `member`; members cannot manage keys, projects or people. Owners and admins invite people by email or by link and manage them in the dashboard: see [members and invites](https://docs.beta.b3os.org/platform/members). Every object you create belongs to one project, and every key to one project, so projects separate environments or customers. Create more with `POST /v1/projects` (`platform:write`). Organization settings are managed in the dashboard.
|
|
28
|
+
|
|
29
|
+
## Signing in
|
|
30
|
+
|
|
31
|
+
| Who | How |
|
|
32
|
+
|---|---|
|
|
33
|
+
| People, in the dashboard | GitHub or a 6-digit code sent by email, then a session cookie |
|
|
34
|
+
| The CLI | `b3os login`, a device login (RFC 8628) that issues a `b3os_pat_` token |
|
|
35
|
+
| Code | An API key, `b3os_sk_...` |
|
|
36
|
+
|
|
37
|
+
Email sign-in has rate limits per address and per network. Only the dashboard calls the sign-in endpoints, and [`POST /v1/auth/email/start`](https://docs.beta.b3os.org/api/post-v1-auth-email-start) lists the challenge and every limit.
|
|
38
|
+
|
|
39
|
+
The device login works from any terminal. The CLI shows a code and a link to `https://beta.b3os.org/app/device`; you approve it there for one organization and project, with scopes no wider than your own (you can uncheck some), and the CLI receives its token. A token lasts 30 days; `b3os logout` revokes it (CLI 0.1.3 and later).
|
|
40
|
+
|
|
41
|
+
## Settings
|
|
42
|
+
|
|
43
|
+
| Setting | Default |
|
|
44
|
+
|---|---|
|
|
45
|
+
| [Key scopes](https://docs.beta.b3os.org/platform/settings#key-scopes): `scopes` | every scope except `vision:profiles:export`, `vault:write` and `platform:write` |
|
|
46
|
+
| [Spend cap](https://docs.beta.b3os.org/platform/settings#spend-cap): `spend_cap_usd` | none |
|
|
47
|
+
| [Prompt logging](https://docs.beta.b3os.org/platform/settings#prompt-logging): `value` | `off` |
|
|
48
|
+
|
|
49
|
+
[Platform settings](https://docs.beta.b3os.org/platform/settings) has all 6, each with its values, what it changes and an example, and what is fixed in the beta.
|
|
50
|
+
|
|
51
|
+
## Scopes
|
|
52
|
+
|
|
53
|
+
| Scope | For |
|
|
54
|
+
|---|---|
|
|
55
|
+
| `platform:read` | Read keys, usage, requests, organizations, projects and webhook deliveries |
|
|
56
|
+
| `platform:write` | Create, update and revoke keys; manage projects; read and rotate webhook secrets |
|
|
57
|
+
|
|
58
|
+
A few operations need only a valid credential (`GET /v1/keys/current`, `GET /v1/limits`, `GET /v1/orgs`), and dashboard-only operations need a signed-in session.
|
|
59
|
+
|
|
60
|
+
- [API keys](https://docs.beta.b3os.org/platform/keys)
|
|
61
|
+
Create scoped, capped, expiring keys.
|
|
62
|
+
- [Webhooks](https://docs.beta.b3os.org/platform/webhooks)
|
|
63
|
+
Secrets, test deliveries and history.
|
|
64
|
+
- [Request log](https://docs.beta.b3os.org/platform/requests)
|
|
65
|
+
Every request with its phases.
|
|
66
|
+
- [Limits and FAQ](https://docs.beta.b3os.org/platform/limits)
|
|
67
|
+
Caps and common questions.
|