@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.
- package/README.md +87 -8
- 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 -5
- package/dist/commands/app.js +229 -69
- package/dist/commands/app.js.map +1 -1
- package/dist/commands/auth.d.ts +70 -2
- package/dist/commands/auth.js +308 -33
- 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 +59 -7
- 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 +109 -1
- package/dist/commands/tool.js +635 -47
- package/dist/commands/tool.js.map +1 -1
- 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/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,244 @@
|
|
|
1
|
+
# Hosted tools
|
|
2
|
+
|
|
3
|
+
> A command-line tool published as a pack. Each call runs it in a fresh microVM with no network. Publish your own binary into your organization's namespace.
|
|
4
|
+
|
|
5
|
+
Source: https://docs.beta.b3os.org/actions/tools.md
|
|
6
|
+
|
|
7
|
+
A hosted tool is a pack whose actions are `vm` actions. The pack carries one archive of the tool's files. Each call claims a fresh microVM on the node, copies the archive and the call's input files into it, runs the tool's command with the request as JSON on stdin, reads one JSON answer and the output files, deletes the VM, and then answers. A VM is never reused, has no network, and belongs to the calling organization for the length of one call. You call a hosted tool like any action: `POST /v1/actions/call`, as an MCP tool, or as a routine step.
|
|
8
|
+
|
|
9
|
+
Note:
|
|
10
|
+
Hosted tools are a preview, on for every organization in the beta. Publishing your own tool is behind the preview flag `actions.tools_publish`, which only B3's organizations hold in the beta. `b3os tool init`, `dev`, `rm`, `yank` and `health` come with CLI 0.2.2, the **next** release.
|
|
11
|
+
|
|
12
|
+
## From a binary to a first call
|
|
13
|
+
|
|
14
|
+
You need a Linux x86-64 build of the program (a static one runs anywhere; a dynamic one only if the base template has its libraries) and a key that holds `actions:tools:publish` by name (`*` and `actions:*` do not grant it), `actions:write` and `actions:run`.
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
b3os tool init ./pandoc --from-binary ./pandoc-3.6/bin/pandoc \
|
|
18
|
+
--call 'convert: pandoc {doc:file} -t {to} -o {out:out.html}'
|
|
19
|
+
b3os tool publish ./pandoc
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
`init` writes the tool's directory. Each `--call` is one action: its key, a colon, then the command line, split into words the way a shell splits them, with nothing expanded and no shell ever run. On a terminal with no `--call`, it asks for them. In the command line:
|
|
23
|
+
|
|
24
|
+
| Token | Becomes |
|
|
25
|
+
|---|---|
|
|
26
|
+
| `{x}` | the string input `x`, as one argument |
|
|
27
|
+
| `{x:int}` | the integer input `x` |
|
|
28
|
+
| `{x:file}`, `{x:file=application/pdf}` | the path of the input file `x`, of that media type |
|
|
29
|
+
| `{out:<file>}` | the path `/out/<file>`, which the program writes; the output field is the name before its first dot (`out.html` is `out`) |
|
|
30
|
+
| `{{` and `}}` | a literal `{` and `}` |
|
|
31
|
+
|
|
32
|
+
Without an `{out:...}`, the program's stdout is the output `stdout`. A value is always one argument, even when it starts with `-`. `init` refuses a macOS (Mach-O) binary, an ELF for another machine (aarch64) and a 32-bit one, and says so in one line:
|
|
33
|
+
|
|
34
|
+
```text
|
|
35
|
+
wrote ./pandoc (1 action: convert); tool/bin/pandoc is x86-64 ELF, static
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
The directory it writes, in your organization's own namespace (`org.` and your organization's ID, read from your key):
|
|
39
|
+
|
|
40
|
+
| File | What it is |
|
|
41
|
+
|---|---|
|
|
42
|
+
| `b3pack.json` | the manifest: one `vm` action per `--call`, each input required |
|
|
43
|
+
| `tool/bin/pandoc` | your binary |
|
|
44
|
+
| `tool/bin/b3os-run` | the stock wrapper (Python standard library, no shell): it fills the command line from the call's input and runs the binary |
|
|
45
|
+
| `tool/calls.json` | the command lines the wrapper reads |
|
|
46
|
+
| `fixtures/convert.json` | the input of the first call; put a real input in it |
|
|
47
|
+
|
|
48
|
+
`publish` packs `tool/` into one archive (plain tar when the files come to 32 MiB or less, tar.gz above; `--format` chooses), checks the binaries, walks the archive as a node will, checks the schemas, publishes, waits until the node answers for the exact version, calls the first fixture once with an `Idempotency-Key`, and prints how to call it:
|
|
49
|
+
|
|
50
|
+
```text
|
|
51
|
+
archive <size> tar, <size> unpacked, 4 entries; start about <ms> ms (warm pool, measured 2026-11-13)
|
|
52
|
+
published org.org-01m5t68q1b590rj801nbzsqzkk/pandoc@1.0.0 (signed org.org-01m5t68q1b590rj801nbzsqzkk#g1)
|
|
53
|
+
callable on the node after <s> s; first call 200 in <ms> ms, cost $<usd>
|
|
54
|
+
pin org.org-01m5t68q1b590rj801nbzsqzkk/pandoc/convert@1.0.0
|
|
55
|
+
curl https://beta-api.b3os.org/v1/actions/call -H "Authorization: Bearer $B3OS_API_KEY" -H "Content-Type: application/json" -d '{"ref":"org.org-01m5t68q1b590rj801nbzsqzkk/pandoc/convert@1.0.0","input":{"doc":{"$bytes":"","name":"doc.bin"},"to":""}}'
|
|
56
|
+
mcp https://beta-api.b3os.org/mcp?packs=org.org-01m5t68q1b590rj801nbzsqzkk/pandoc
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
The start it prints is a prediction from the archive's size and format: a warm-pool claim plus the copy and the unpack that slice A measured on 2026-11-13 (1 vCPU, 512 MiB). Describe answers the same number as the action's `tool.start_estimate_ms`. `--json` prints every step with its `elapsed_ms`; `--no-call` skips the call.
|
|
60
|
+
|
|
61
|
+
## Iterate with dev versions
|
|
62
|
+
|
|
63
|
+
```bash
|
|
64
|
+
b3os tool dev ./pandoc --input '{"doc": {"$url": "https://example.com/readme.md"}, "to": "html"}'
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
`tool dev` publishes the directory as a dev version, `<x.y.z>-dev.<unix seconds>`, waits for the node, calls it once and prints the answer, or the error with the first 4 KiB of your tool's stderr. A dev version replaces the pack's earlier dev version, does not make the pack count toward the tools limit below and is not counted toward its versions, so you can run it as often as you like. Its archive counts toward the archives, and packs with nothing but a dev version are held to the tools limit on their own. No range and no `@<major>` selects a dev version; only its exact pin does.
|
|
68
|
+
|
|
69
|
+
## Your organization's tools
|
|
70
|
+
|
|
71
|
+
A tool in your `org.` namespace is yours alone: only your organization can describe it, call it, see it in the registry, the MCP list and the marketplace, and download its archive. Anyone else gets `404 pack_not_found`, as for a tool that does not exist. Your manifest is unsigned: the registry signs each version after every check, with your organization's own key (`kid` `org.<your org>#g1`), and a node loads it only for your organization. A manifest that carries a `signature` is refused.
|
|
72
|
+
|
|
73
|
+
| Per organization | Limit |
|
|
74
|
+
|---|---|
|
|
75
|
+
| Org-private tools | 10, and 10 more that have only a dev version (`actions.tools.private_tools`) |
|
|
76
|
+
| Versions per tool | 50, dev versions not counted (`actions.tools.versions_per_tool`) |
|
|
77
|
+
| Archives your versions name, and uploads of the last 24 hours that none names yet | 1 GiB (`actions.tools.archive_bytes`) |
|
|
78
|
+
|
|
79
|
+
Past one, the publish answers `422 limit_exceeded`. A version names only an archive your organization uploaded (or one another version of your namespace names): knowing an archive's sha256 and size is not enough, and any other is `422 pack_invalid`, "the archive sha256:... is not uploaded". `b3os tool publish` uploads it when the registry says you do not hold it yet. `b3os tool rm <pack>` deletes a tool with every version, and `b3os tool rm <pack>@<version>` one version: calls to it stop when the nodes next read the registry. `b3os tool yank <pack>@<version>` yanks a version instead: `@<major>` and ranges skip it, and the exact pin still resolves; `--undo` restores it. An org-private tool has no publisher price: it is billed compute and the per-call floor only.
|
|
80
|
+
|
|
81
|
+
Inside one major version, a new version keeps what a caller pinned to: a change to `tool.kind`, `tool.base`, `tool.size`, `tool.network`, `egress` or an action's price is `422 pack_invalid`, "... changed from ... to ...: that is a new major version (2.0.0)".
|
|
82
|
+
|
|
83
|
+
## The manifest
|
|
84
|
+
|
|
85
|
+
What a tool pack may declare in this version:
|
|
86
|
+
|
|
87
|
+
| Field | Accepted |
|
|
88
|
+
|---|---|
|
|
89
|
+
| `pack` | `<namespace>/<name>`: your organization's `org.` namespace, or one the registry's publisher list gives you |
|
|
90
|
+
| `engine` | a caret range that does not accept 1.0.0, such as `^1.1` |
|
|
91
|
+
| `tool.kind` | `cli` |
|
|
92
|
+
| `tool.base` | `{"name": "base"}`: Ubuntu 24.04 with Python 3.12, Node 24 and `jq` |
|
|
93
|
+
| `tool.size` | absent, or `{"vcpu": 1, "memoryMb": 512}`: 1 vCPU and 512 MiB |
|
|
94
|
+
| `tool.bundle.archive` | required: `sha256`, `bytes`, `format` (`tar` or `tar.gz`), `unpackedBytes`, `entries`; `b3os tool publish` fills them |
|
|
95
|
+
| `tool.runtime`, `tool.network` | absent, or `{"mode": "call"}` and `{"mode": "none"}` |
|
|
96
|
+
| `tool.errors` | your tool's own error codes, at most 32, each matching `^[a-z][a-z0-9_]{0,63}$`; the health view counts each |
|
|
97
|
+
| `tool.upstream`, `tool.notices` | the software the tool runs and did not write, and the notices file of the pack bundle |
|
|
98
|
+
| `impl` | `{"kind": "vm", "protocol": "json-stdio", "cmd": [...]}`, `cmd[0]` under `/tool/` |
|
|
99
|
+
| `execution.timeoutMs` | 100 to 60000, default 30000 |
|
|
100
|
+
| `execution.maxInputMb`, `maxOutputMb` | 1 to 64 each, default 16: the input file data and the output file data of one call |
|
|
101
|
+
| `execution.maxOutputFiles` | 1 to 16, default 4 |
|
|
102
|
+
| `effects.class` | `pure` |
|
|
103
|
+
| `x-b3os-file` | on a top-level property of `type: object`, `{"accept": [...]}` in the input schema and `{"produces": [...]}` in the output schema, at most 4 each way |
|
|
104
|
+
| `pricing` | `free`; or `per_call`, `per_second` or `per_input_mb` with `usd` and an optional `freeCalls` (0 to 10000), on the pack or an action. None in `org.` or `io.b3os` |
|
|
105
|
+
|
|
106
|
+
A tool pack has no `connections`, no `triggers` and no `egress`, and every action is `vm`. Outside `io.b3os`, each input and output schema is at most 65536 bytes, nests at most 32 deep, holds at most 64 `$ref` and at most 32 patterns (`pattern` members and `patternProperties` keys together); a `pattern` must not use look-around or a backreference, and `format: regex` is refused. A value this version does not take is refused with a sentence that names it (the b3pack publish checks 13 to 23 list them all).
|
|
107
|
+
|
|
108
|
+
The archive is plain ustar: files and directories only, each header's checksum right, two zero blocks at the end. A node refuses anything else at install, so a link, a PAX or GNU record or a sparse file in an archive you build yourself never runs. `b3os tool publish` writes such archives and walks them with the node's rules before it uploads one.
|
|
109
|
+
|
|
110
|
+
**Do not put a secret in a bundle.** Treat every file of the archive and the pack bundle as readable by B3OS's nodes: callers never reach the VM, but the archive goes to every node, and a tool has no network to use a secret with anyway.
|
|
111
|
+
|
|
112
|
+
## Call it
|
|
113
|
+
|
|
114
|
+
A file value is one of:
|
|
115
|
+
|
|
116
|
+
| Value | The node |
|
|
117
|
+
|---|---|
|
|
118
|
+
| `{"$bytes": "<base64>", "name": "<name>"}` | decodes it, inside the call's 1 MiB request body |
|
|
119
|
+
| `{"$url": "https://...", "name": "<name>"}` | fetches it before it claims a VM, through its egress guard: https on port 443 only, public addresses only, at most 3 redirects, no `Authorization` or cookie sent; the bytes are billed as `egress.bytes` to you. `name` is optional |
|
|
120
|
+
| `{"$file": "tfile_..."}` | reads a file of your project: an upload, or an output of an earlier call |
|
|
121
|
+
|
|
122
|
+
A name matches `^[A-Za-z0-9][A-Za-z0-9._-]{0,127}$`. Upload a file of up to 64 MiB with `POST /v1/actions/files?name=report.pdf` and the raw bytes as the body; the answer is a `tool_file` with its `id` and a link. Every file is kept 1 hour.
|
|
123
|
+
|
|
124
|
+
```bash
|
|
125
|
+
curl -sS https://beta-api.b3os.org/v1/actions/call \
|
|
126
|
+
-H "Authorization: Bearer $B3OS_API_KEY" \
|
|
127
|
+
-H "Content-Type: application/json" \
|
|
128
|
+
-d '{"ref": "org.org-01m5t68q1b590rj801nbzsqzkk/pandoc/convert@1", "input": {"doc": {"$url": "https://example.com/readme.md"}, "to": "html"}}'
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
The answer is an action result with `tier: "vm"`, the output, the call's `cost` in micro-USD (`compute`, `floor`, `price`, `total`), and the timing phases `validate`, `fetch` (with a `$url`), `start`, `copy`, `unpack`, `run`, `collect`, `delete` and `cost`. Each output file is a link:
|
|
132
|
+
|
|
133
|
+
```json
|
|
134
|
+
{
|
|
135
|
+
"$link": "https://usercontent.b3os.org/tf/tfile-01m9qm9s346q3d25vt4f5v37e3/out.html?node=n1&exp=1795186800&sig=...",
|
|
136
|
+
"file": "tfile_01m9qm9s346q3d25vt4f5v37e3",
|
|
137
|
+
"name": "out.html",
|
|
138
|
+
"contentType": "text/html",
|
|
139
|
+
"bytes": 18211,
|
|
140
|
+
"sha256": "8f434346648f6b96df89dda901c5176b10a6d83961dd3c1ac88b59b2dc327aa4",
|
|
141
|
+
"expiresAt": "2026-11-20T15:00:00.000Z"
|
|
142
|
+
}
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
The link is a bearer URL that works for 1 hour, with no key: anyone who has it can download the file, as a download (`Content-Disposition: attachment`), never a page. `GET /v1/actions/files/{file_id}` gives a fresh link while the file is kept, and `DELETE` removes it at once. Pass `{"$file": "tfile_..."}` to give an output to the next call without downloading it. As an MCP tool, each output file is also a `resource_link`. In a routine the action is a step:
|
|
146
|
+
|
|
147
|
+
```yaml
|
|
148
|
+
steps:
|
|
149
|
+
- id: convert
|
|
150
|
+
uses: org.org-01m5t68q1b590rj801nbzsqzkk/pandoc/convert@1
|
|
151
|
+
with:
|
|
152
|
+
doc: { $url: "https://example.com/readme.md" }
|
|
153
|
+
to: html
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
## The json-stdio contract
|
|
157
|
+
|
|
158
|
+
The node puts each input file at `/in/<field>/<name>`, makes `/out` and `/work`, and runs `cmd` with no shell, in `/work`, as the VM's user, with one JSON object on stdin:
|
|
159
|
+
|
|
160
|
+
```json
|
|
161
|
+
{
|
|
162
|
+
"action": "convert",
|
|
163
|
+
"input": {
|
|
164
|
+
"doc": { "path": "/in/doc/readme.md", "name": "readme.md", "bytes": 5120, "contentType": "application/octet-stream" },
|
|
165
|
+
"to": "html"
|
|
166
|
+
},
|
|
167
|
+
"limits": { "timeoutMs": 30000, "maxOutputBytes": 16777216, "maxOutputFiles": 4 },
|
|
168
|
+
"call": { "id": "req_01m77a0c8dkdq3w5x6y7z8a9bc" }
|
|
169
|
+
}
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
The tool writes its files directly under `/out` and, as its last line of stdout, exactly one of `{"output": {...}}`, where a file is `{"path": "/out/<name>"}`, and `{"error": {"code": "...", "message": "...", "retryable": false}}`. It exits 0 in both cases. The request names no organization, project or key, and the VM has none of the `B3OS_*` variables a sandbox has: a tool cannot tell who called it. stderr is never logged; a failed call of an org-private tool returns its first 4 KiB as `stderr`, since the caller is always its owner, and a listed tool's never does.
|
|
173
|
+
|
|
174
|
+
## Limits
|
|
175
|
+
|
|
176
|
+
| Limit | Value |
|
|
177
|
+
|---|---|
|
|
178
|
+
| Time of one call | the least of the caller's `timeout_ms`, the action's `timeoutMs` and 60 seconds; on `POST /v1/actions/call` a priced action refuses a lower `timeout_ms` with `400 invalid_request`, and a routine step's call runs to the action's own timeout |
|
|
179
|
+
| The VM | 1 vCPU and 512 MiB, the `base` template's disk, no network |
|
|
180
|
+
| The archive | 64 MiB packed; its manifest declares at most 512 MiB unpacked and 20,000 entries, and a node checks the archive against those numbers when it installs it |
|
|
181
|
+
| Input files | the action's `maxInputMb`, 16 MiB unless it says otherwise; a `$bytes` value also counts toward the call's 1 MiB request body |
|
|
182
|
+
| Output | stdout up to 1 MiB; output files up to the action's `maxOutputMb` and `maxOutputFiles`, 16 MiB and 4 unless it says otherwise |
|
|
183
|
+
| Files | 64 MiB each upload, kept 1 hour; 2 GiB kept at once per organization on a node (`actions.files_bytes`, `429 quota_exceeded`) |
|
|
184
|
+
| At once | 4 calls per organization, 8 per node |
|
|
185
|
+
| Starts | 120 a minute per organization, from every surface (HTTP, MCP, routines) |
|
|
186
|
+
| Publishers' prices | 20 USD a month per calling organization, counted on each node and kept across its restarts |
|
|
187
|
+
|
|
188
|
+
## Errors
|
|
189
|
+
|
|
190
|
+
| Code | Status | `reason` |
|
|
191
|
+
|---|---|---|
|
|
192
|
+
| [`tool_failed`](https://docs.beta.b3os.org/errors#tool_failed) | 502 | `unpack` (the archive did not unpack), `exit` (with `exit_code`, or the VM stopped answering while the command ran), `signal` (with `signal`), `protocol` (the last line of stdout is not one JSON answer), `tool_error` (the tool's own error: `tool_code`, `tool_message`, `retryable`), `output_invalid` (with `errors`), `output_file`, `output_too_large` (past `maxOutputMb` or `maxOutputFiles`) |
|
|
193
|
+
| [`tool_timed_out`](https://docs.beta.b3os.org/errors#tool_timed_out) | 504 | the tool's command did not finish in time |
|
|
194
|
+
| [`tool_unavailable`](https://docs.beta.b3os.org/errors#tool_unavailable) | 503 | `no_slot` (no VM, or the call's time ran out before its command could start), `copy`, `exec` (the run was refused before it reached the VM), `node_busy`, `file_store` (the node's file store is full), `blocks_unknown` (the node has not yet read the list of removed tools); nothing is billed; retry after `Retry-After` |
|
|
195
|
+
| [`action_input_invalid`](https://docs.beta.b3os.org/errors#action_input_invalid) | 422 | for a `$url`, at `/input/<field>`: `url_scheme` (not https on 443), `url_denied` (a private address, with `egress_reason`), `url_status` (not a 200, with `upstream_status`), `url_too_large` (past `maxInputMb`), `url_redirects` (more than 3), `url_timeout` |
|
|
196
|
+
| [`tool_blocked`](https://docs.beta.b3os.org/errors#tool_blocked) | 451 | B3OS has removed this tool, a version of it or its publisher: "B3OS has removed this tool (tblk_...). Questions: abuse@b3os.org". Not retryable |
|
|
197
|
+
|
|
198
|
+
A `$file` that is not your project's, or has expired, is `404 resource_not_found`, before any VM is claimed. Past a limit a call gets [`429 rate_limited`](https://docs.beta.b3os.org/errors#rate_limited), [`429 concurrency_limited`](https://docs.beta.b3os.org/errors#concurrency_limited) or [`429 quota_exceeded`](https://docs.beta.b3os.org/errors#quota_exceeded); a call a limit refuses fetches no `$url` and is charged nothing. Each of these, and every `503 tool_unavailable`, carries `Retry-After`: have your client wait that many seconds before it sends the call again. Every call is a fresh VM. A call that finished is charged even if your client had stopped waiting, so send an `Idempotency-Key` with a priced call: a retry with the same key gets the stored answer and is not charged again. A routine step's retry carries the step's key and gets the answer of the call its first attempt started.
|
|
199
|
+
|
|
200
|
+
A tool B3OS removes stops answering on every surface at each node's next read of the edge's list of removed tools, and stays removed through a node's restart. Its output files stop downloading (`451`) and are refused as another call's `$file`. A retry with the `Idempotency-Key` of a call made before the block gets the same `451`, not the stored answer of that call. Write to abuse@b3os.org with the block's ID.
|
|
201
|
+
|
|
202
|
+
## What a call costs
|
|
203
|
+
|
|
204
|
+
A hosted tool call is metered in four units, under the caller's own key:
|
|
205
|
+
|
|
206
|
+
| Unit | Counts |
|
|
207
|
+
|---|---|
|
|
208
|
+
| `actions.vcpu_ms` | the CPU the call's VM used |
|
|
209
|
+
| `actions.gib_ms` | its memory, GiB times milliseconds |
|
|
210
|
+
| `actions.tool_call` | one per call whose command ran: the per-call floor |
|
|
211
|
+
| `actions.publisher_microusd` | the publisher's price in micro-USD, once the tool answered, its output matched its schema and its output files were read |
|
|
212
|
+
|
|
213
|
+
The publisher's price follows its model: `per_call` charges `usd` once; `per_second` charges it in proportion to the time of the tool's own command (the `run` phase; the copy and the unpack never count); `per_input_mb` charges it in proportion to the call's input file bytes plus its stdin JSON (the rate is per MiB); both round up to the micro-USD. A pack's `freeCalls` are the calls each calling organization makes free of the price each UTC month, counted by each node (the beta runs one); compute and the floor are charged on those too. A failed call is charged compute and the floor, never the price; a call that failed before the command ran is charged nothing. A call whose output files your organization's `actions.files_bytes` refuses after the command ran is `429 quota_exceeded`, and is charged compute and the floor. A tool call writes no `actions.call` record. The other three units are priced as the [usage page](https://docs.beta.b3os.org/concepts/usage) says.
|
|
214
|
+
|
|
215
|
+
Describe shows what one call of a version costs all in once the node has run it: `tool.all_in`, the price, compute and the floor at the median of that version's recent calls on the node, with the basis it was taken from. The marketplace page shows the same figure.
|
|
216
|
+
|
|
217
|
+
## Health and earnings
|
|
218
|
+
|
|
219
|
+
`b3os tool health --namespace <namespace>` (or the Health table on your tool's marketplace page) shows, for each hour and version, the calls whose command ran, how many answered, failed and timed out, why they failed, your declared error codes (`undeclared` for any other), and the run time at the median and the 95th percentile:
|
|
220
|
+
|
|
221
|
+
```http
|
|
222
|
+
GET /v1/actions/publishers/{namespace}/health?pack=<pack>&hours=24
|
|
223
|
+
```
|
|
224
|
+
|
|
225
|
+
It names no caller and stores no message text, and `alert` flags an hour in which more than one call in twenty failed. Only the organization that owns the namespace reads it. The publisher of a priced listed tool reads what it earned for one month (calls, gross, B3OS's cut and net) with `b3os tool earnings --namespace com.example.tools`, which calls:
|
|
226
|
+
|
|
227
|
+
```http
|
|
228
|
+
GET /v1/actions/publishers/{namespace}/earnings
|
|
229
|
+
```
|
|
230
|
+
|
|
231
|
+
B3OS keeps nothing of a publisher's price until the earlier of 12 calendar months after its first priced call or 1,000 USD of sales, then 20%; the line says which rate is in force and why. A publisher sees daily totals per tool, never a customer or a call. Amounts are `accrued`: a record of what was sold. Nothing is paid out by B3OS's software in this version.
|
|
232
|
+
|
|
233
|
+
## A signed build
|
|
234
|
+
|
|
235
|
+
A namespace the registry's publisher list gives you is signed with its publisher key, not by the registry. Build it with the packs package, then publish the signed `dist/` as it is:
|
|
236
|
+
|
|
237
|
+
```bash
|
|
238
|
+
node packages/packs/src/cli/tool.ts build examples/tools/echo --kid com.example.tools#dev-2026-10
|
|
239
|
+
b3os tool publish examples/tools/echo
|
|
240
|
+
```
|
|
241
|
+
|
|
242
|
+
## Not there yet
|
|
243
|
+
|
|
244
|
+
Publishing by organizations outside B3, listing a tool for other organizations to call without B3OS signing its first version, the `code-interpreter`, `files` and `browser` bases, a network for a tool, sessions that keep a VM between calls, tools built from an image, and MCP servers as tools.
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
# Pack triggers
|
|
2
|
+
|
|
3
|
+
> The webhook, poll and schedule triggers packs provide, how a routine subscribes to one, and how B3OS verifies, deduplicates and delivers their events.
|
|
4
|
+
|
|
5
|
+
Source: https://docs.beta.b3os.org/actions/triggers.md
|
|
6
|
+
|
|
7
|
+
A pack trigger turns something that happens in another service into an event: a GitHub issue opened, a Stripe invoice paid, a new item since the last poll. Routines consume the events, each one starting a run.
|
|
8
|
+
|
|
9
|
+
## Kinds
|
|
10
|
+
|
|
11
|
+
| Kind | How events arrive |
|
|
12
|
+
|---|---|
|
|
13
|
+
| `webhook` | The service posts to a B3OS hook URL that the pack registers for you; B3OS verifies the signature, deduplicates and filters |
|
|
14
|
+
| `poll` | B3OS calls a pack action on an interval and keeps a cursor, so each item becomes one event |
|
|
15
|
+
| `schedule` | B3OS calls a pack action on a schedule and turns the result into an event |
|
|
16
|
+
|
|
17
|
+
`GET /v1/actions/triggers` lists the triggers packs provide, with each one's configuration schema and event schema:
|
|
18
|
+
|
|
19
|
+
**curl**
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
curl -s -G https://beta-api.b3os.org/v1/actions/triggers \
|
|
23
|
+
-H "Authorization: Bearer $B3OS_API_KEY" -d pack=io.b3os/github
|
|
24
|
+
```
|
|
25
|
+
**TypeScript**
|
|
26
|
+
|
|
27
|
+
```ts
|
|
28
|
+
import { B3OS } from "@b3os/sdk";
|
|
29
|
+
|
|
30
|
+
const b3os = new B3OS();
|
|
31
|
+
for await (const trigger of b3os.actions.listTriggers({ pack: "io.b3os/github" })) {
|
|
32
|
+
console.log(trigger.ref, trigger.kind, trigger.title);
|
|
33
|
+
}
|
|
34
|
+
```
|
|
35
|
+
**Python**
|
|
36
|
+
|
|
37
|
+
```python
|
|
38
|
+
from b3os import B3OS
|
|
39
|
+
|
|
40
|
+
b3os = B3OS()
|
|
41
|
+
for trigger in b3os.actions.list_triggers(pack="io.b3os/github").auto_paging_iter():
|
|
42
|
+
print(trigger["ref"], trigger["kind"], trigger["title"])
|
|
43
|
+
```
|
|
44
|
+
**MCP**
|
|
45
|
+
|
|
46
|
+
The MCP tools cover actions, not triggers: `actions_search` finds actions only (the API finds triggers with `GET /v1/actions/search?kind=trigger`). Subscribing is part of publishing a routine, which happens from code or the CLI.
|
|
47
|
+
|
|
48
|
+
## The catalog's triggers
|
|
49
|
+
|
|
50
|
+
The first-party catalog has 7 triggers. A poll trigger's interval is its pack manifest's `intervalMs` (version 1.0.0): the default, and the minimum in parentheses, in milliseconds. The first poll records what already exists and emits nothing; later polls emit only items they have not seen.
|
|
51
|
+
|
|
52
|
+
| Trigger | Kind | `with` | `connections` | Each event is |
|
|
53
|
+
|---|---|---|---|---|
|
|
54
|
+
| `io.b3os/github/repo-event@1` | webhook; B3OS creates the repository webhook with a generated secret and removes it with the subscription | `owner`, `repo` (required), `events` (default `issues`, `pull_request`, `push`) | `token`: a GitHub token that can manage webhooks (`admin:repo_hook`) | `type`, `action`, `repository`, `sender`, `delivery` and GitHub's full `payload` |
|
|
55
|
+
| `io.b3os/github/new-issue@1` | poll, `intervalMs` 120000 (60000); pull requests are skipped | `owner`, `repo` (required), `labels` | `token` | the issue: `number`, `title`, `state`, `html_url`, `author`, `labels` and more |
|
|
56
|
+
| `io.b3os/stripe/event@1` | poll of the events list, `intervalMs` 30000 (10000); creates no webhook endpoint in your account | `types` (required; `invoice.*` and `*` work) | `secret_key`: a restricted key with Events read access | the Stripe event: `id`, `type`, `created`, `livemode`, `api_version`, `data` |
|
|
57
|
+
| `io.b3os/stripe/webhook-event@1` | webhook to an endpoint you add in the Stripe Dashboard | `types`, `type_prefixes` | `webhook_secret`: an `api_key` connection holding the endpoint's signing secret (`whsec_...`); the publishing key needs `vault:run` | the same fields as `stripe/event` |
|
|
58
|
+
| `io.b3os/slack/event@1` | webhook from your own Slack app's Event Subscriptions | `event_types` | `webhook_secret`: an `api_key` connection holding the app's Signing Secret; the publishing key needs `vault:run` | `event_id`, `team_id`, `event_time`, `type`, `channel`, `user`, `text`, `ts` and Slack's `event` |
|
|
59
|
+
| `io.b3os/polymarket/new-market@1` | poll, `intervalMs` 60000 (15000) | `tag_id` | none | the market: `id`, `question`, `slug`, `outcomes`, `outcome_prices`, `volume`, `url` and more |
|
|
60
|
+
| `io.b3os/hacker-news/new-story@1` | poll, `intervalMs` 60000 (30000) | `query`, `type`, `min_points` | none | the item: `id`, `title`, `url`, `hn_url`, `author`, `points`, `comments`, `created_at` |
|
|
61
|
+
|
|
62
|
+
GitHub's `repo-event` registers its hook URL itself. Stripe's `webhook-event` and Slack's `event` do not: after you publish, read the subscription's `hook_id` and give the service `https://beta-api.b3os.org/v1/actions/hooks/<hook_id>` (the Stripe endpoint URL, or the Slack app's request URL; B3OS answers Slack's `url_verification` challenge). A pack connection key you leave out of `connections` resolves like a call's, to the project's newest connection for the pack and key without a `subject`; `webhook_secret` has no such default and must be bound. A trigger that uses a stored connection, a pack key such as `token` (named or found that way) or `webhook_secret`, needs `vault:run` on the key that publishes the routine, on top of `routines:write`, as a call needs it on top of `actions:run`. Without it the publish answers `403` [`forbidden`](https://docs.beta.b3os.org/errors#forbidden) with `reason: scope` and `required_scope: vault:run`, and the version is not published. Default keys have `vault:run`; a narrowed key must list it.
|
|
63
|
+
|
|
64
|
+
## Subscribe from a routine
|
|
65
|
+
|
|
66
|
+
Add a `type: action` trigger to a routine and publish it:
|
|
67
|
+
|
|
68
|
+
```yaml
|
|
69
|
+
name: triage-new-issues
|
|
70
|
+
triggers:
|
|
71
|
+
- type: action
|
|
72
|
+
id: new_issue
|
|
73
|
+
uses: io.b3os/github/new-issue@1
|
|
74
|
+
with:
|
|
75
|
+
owner: acme
|
|
76
|
+
repo: web
|
|
77
|
+
labels: [bug]
|
|
78
|
+
connections:
|
|
79
|
+
token: conn_01m5t6cbgdjs1ketgcqwa2sne8
|
|
80
|
+
steps:
|
|
81
|
+
- id: label
|
|
82
|
+
uses: infer/chat@1
|
|
83
|
+
with:
|
|
84
|
+
model: ${{ vars.model }}
|
|
85
|
+
messages:
|
|
86
|
+
- role: user
|
|
87
|
+
content: "Suggest one label for this issue: ${{ trigger.data.title }}"
|
|
88
|
+
vars:
|
|
89
|
+
model: b3os/your-chat-model
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
Publishing creates a **trigger subscription** (`tsub_`) for each action trigger. Each event that passes the trigger's `if` starts a run as the key that published the version, with the event in `trigger.data` (valid against the trigger's event schema) and its ID in `trigger.event_id`. Delivery is at least once, and a repeated event ID on the same subscription starts nothing. [Routine triggers](https://docs.beta.b3os.org/routines/triggers#pack-triggers) has every field.
|
|
93
|
+
|
|
94
|
+
## Subscriptions
|
|
95
|
+
|
|
96
|
+
Subscriptions are read-only. You change one by publishing the routine:
|
|
97
|
+
|
|
98
|
+
- a new version updates its subscriptions, and removes those of action triggers it no longer has;
|
|
99
|
+
- a rollback makes the earlier version's triggers current, adding, updating and removing subscriptions to match;
|
|
100
|
+
- deleting the routine removes all of them.
|
|
101
|
+
|
|
102
|
+
`GET /v1/actions/subscriptions` lists them, filterable by routine or pack:
|
|
103
|
+
|
|
104
|
+
**curl**
|
|
105
|
+
|
|
106
|
+
```bash
|
|
107
|
+
curl -s -G https://beta-api.b3os.org/v1/actions/subscriptions \
|
|
108
|
+
-H "Authorization: Bearer $B3OS_API_KEY" -d pack=io.b3os/github
|
|
109
|
+
```
|
|
110
|
+
**TypeScript**
|
|
111
|
+
|
|
112
|
+
```ts
|
|
113
|
+
for await (const sub of b3os.actions.listSubscriptions({ pack: "io.b3os/github" })) {
|
|
114
|
+
console.log(sub.id, sub.status, sub.last_event_at, sub.error?.detail);
|
|
115
|
+
}
|
|
116
|
+
```
|
|
117
|
+
**Python**
|
|
118
|
+
|
|
119
|
+
```python
|
|
120
|
+
for sub in b3os.actions.list_subscriptions(pack="io.b3os/github").auto_paging_iter():
|
|
121
|
+
print(sub["id"], sub["status"], sub["last_event_at"], sub["error"]["detail"] if sub["error"] else None)
|
|
122
|
+
```
|
|
123
|
+
**MCP**
|
|
124
|
+
|
|
125
|
+
No MCP tool reads subscriptions. Check them from code, or with `b3os api GET /v1/actions/subscriptions`.
|
|
126
|
+
|
|
127
|
+
`GET /v1/actions/subscriptions/{subscription_id}` shows one: the exact trigger version, its configuration and connections, its hook ID (webhook triggers), when the last event arrived, and its status. `active` subscriptions receive events. `paused` ones drop events while the routine's triggers are paused, for example because its publishing key was revoked. `failed` means subscribing at the service failed; `error` says why, and B3OS retries.
|
|
128
|
+
|
|
129
|
+
## Webhook verification
|
|
130
|
+
|
|
131
|
+
Webhook triggers receive deliveries at `POST /v1/actions/hooks/{hook_id}` and verify each one with the scheme the pack declares (GitHub, Stripe, Slack, Standard Webhooks, or a generic timestamped HMAC), comparing signatures in constant time over the raw body. Timestamped schemes refuse deliveries more than 300 seconds from the node's clock, with [`webhook_signature_invalid`](https://docs.beta.b3os.org/errors#webhook_signature_invalid) and reason `timestamp`, so a captured delivery cannot be replayed later. Inside the window a repeat is a duplicate: the dedupe key and the verified signature are remembered for 73 hours, up to 10,000 per subscription, so a replay with a new value in an unsigned header (GitHub's `X-GitHub-Delivery`) is caught too. GitHub signs no timestamp, so after those 73 hours such a replay is no longer refused. Services that send a verification handshake, such as Slack's `url_verification`, get the answer the pack defines.
|
|
132
|
+
|
|
133
|
+
GitHub's signature covers the body alone, so two deliveries with byte-identical bodies within those 73 hours are one event: the second is acknowledged as a duplicate. The other schemes sign a timestamp too, so identical bodies sent at different times stay distinct.
|
|
134
|
+
|
|
135
|
+
A paused subscription, a delivery the trigger's filter drops and an authentic delivery whose event does not match the trigger's schema are answered `202` and emit nothing. A delivery whose dedupe key, filter, handshake or event mapping fails answers `422` [`action_expression_error`](https://docs.beta.b3os.org/errors#action_expression_error).
|
|
136
|
+
|
|
137
|
+
## Hook URLs
|
|
138
|
+
|
|
139
|
+
A hook URL lives as long as its subscription. Once the routine drops the trigger, rolls back to a version without it, or is deleted, the URL answers `404` [`hook_not_found`](https://docs.beta.b3os.org/errors#hook_not_found), as does a hook ID that never existed.
|
|
140
|
+
|
|
141
|
+
The edge in front of the node limits and buffers deliveries:
|
|
142
|
+
|
|
143
|
+
| | Limit |
|
|
144
|
+
|---|---|
|
|
145
|
+
| Deliveries per hook | 1,200 a minute, queued or not; more answer `429` [`rate_limited`](https://docs.beta.b3os.org/errors#rate_limited) with `Retry-After` |
|
|
146
|
+
| Queue while the node is unreachable | 10,000 deliveries or 64 MiB per hook the node has confirmed (accepted a delivery for), 10 deliveries or 1 MiB for other hook IDs |
|
|
147
|
+
| How long a queued delivery is kept | 72 hours |
|
|
148
|
+
|
|
149
|
+
Queued deliveries are answered `202` with `x-b3os-queued: true` and replayed in order, each with the time the edge received it, which the provider's timestamp check then uses instead of the node's clock. The provider's signature is still required.
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
# Actions and triggers
|
|
2
|
+
|
|
3
|
+
> Connectors for agents and routines, with credentials kept in the vault and added at the egress proxy, typed tools and triggers that start runs.
|
|
4
|
+
|
|
5
|
+
Source: https://docs.beta.b3os.org/actions.md
|
|
6
|
+
|
|
7
|
+
Actions connect your agents and routines to the services they use: open a GitHub issue, query Linear, read a Stripe invoice, start a routine when a payment succeeds. Next to calling those APIs yourself:
|
|
8
|
+
|
|
9
|
+
- **Your credential never reaches the agent.** It stays in the [vault](https://docs.beta.b3os.org/vault) and is added at the egress proxy, only for the hosts the pack declares. The agent, the model and the pack's code see a connection ID, never the secret. A call without one answers with a link that adds it.
|
|
10
|
+
- **Triggers start routines.** Webhook, polling and schedule triggers start a [routine](https://docs.beta.b3os.org/routines) run when something happens in GitHub, Stripe, Slack and others, and every action is also a routine step.
|
|
11
|
+
- **Every action is a typed tool.** It has input and output schemas and an effect class (`read`, `write` or `irreversible`) that decides retries and MCP hints. Search answers `none` rather than an unrelated action, and never offers an irreversible one for a request that does not name its service.
|
|
12
|
+
|
|
13
|
+
Actions come in **packs**. A pack is a signed, versioned bundle of actions and triggers for one service, named `<namespace>/<name>` such as `io.b3os/github`. The market packs (Polymarket, Kalshi, Hyperliquid and others) are read-only market data. One action is one operation, called by reference:
|
|
14
|
+
|
|
15
|
+
```text
|
|
16
|
+
io.b3os/github/create-issue@1.0.0
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
Every action is also a valid MCP tool, with its input schema, output schema and an effect class.
|
|
20
|
+
|
|
21
|
+
## Search, describe, call
|
|
22
|
+
|
|
23
|
+
An agent needs three calls to use an action it has never seen:
|
|
24
|
+
|
|
25
|
+
1. **Search** with words: `GET /v1/actions/search?q=create a github issue` returns references ranked for agents.
|
|
26
|
+
2. **Describe** a reference: `GET /v1/actions/describe?ref=io.b3os/github/create-issue@1` returns its input and output schemas, its effect class and the connections it needs. A major version like `@1` resolves to the newest matching release.
|
|
27
|
+
3. **Call** it: `POST /v1/actions/call` validates the input, runs the action, validates the output and returns it.
|
|
28
|
+
|
|
29
|
+
[Calling actions](https://docs.beta.b3os.org/actions/call) walks through all three. Over MCP the same flow is three tools, `actions_search`, `actions_describe` and `actions_call`, so the whole catalog never crowds the tool list.
|
|
30
|
+
|
|
31
|
+
## Settings
|
|
32
|
+
|
|
33
|
+
| Setting | Default |
|
|
34
|
+
|---|---|
|
|
35
|
+
| [Call timeout](https://docs.beta.b3os.org/actions/settings#call-timeout): `timeout_ms` | the action's own, on its catalog page |
|
|
36
|
+
| [Connection](https://docs.beta.b3os.org/actions/settings#connection): `connections` | your project's newest connection for the key with no `subject` ([per field](https://docs.beta.b3os.org/actions/settings#connection)) |
|
|
37
|
+
|
|
38
|
+
[Action settings](https://docs.beta.b3os.org/actions/settings) has all 2, each with its values, what it changes and an example, and what is fixed in the beta.
|
|
39
|
+
|
|
40
|
+
## Credentials stay out of reach
|
|
41
|
+
|
|
42
|
+
An action that talks to a service needs your credential for it, stored as a [vault connection](https://docs.beta.b3os.org/vault). You never pass the secret in a call. The action's request leaves through the egress proxy on the node, which adds the credential there, and only for the hosts the pack declares. The action's code, your agent, the model and the logs never see it.
|
|
43
|
+
|
|
44
|
+
## How actions run
|
|
45
|
+
|
|
46
|
+
| Kind | Runs | Used for |
|
|
47
|
+
|---|---|---|
|
|
48
|
+
| Declarative HTTP | Inside the B3OS daemon: a request template, JSON Schema validation and response mapping, compiled when the pack is published | Most API integrations |
|
|
49
|
+
| JavaScript | In a separate runtime with no credentials and no B3OS identity; its outbound requests go through the egress proxy with a per-call capability | First-party packs that need code |
|
|
50
|
+
|
|
51
|
+
Templates and mappings are [CEL](https://docs.beta.b3os.org/routines/definitions#expressions) inside `${{ }}`, the same language routines use.
|
|
52
|
+
|
|
53
|
+
Each action has an **effect class**: `pure` (computes from its input), `read`, `write` or `irreversible`. B3OS retries only `pure` and `read` actions on its own, and MCP clients see matching hints, such as `readOnlyHint` for reads.
|
|
54
|
+
|
|
55
|
+
## Triggers
|
|
56
|
+
|
|
57
|
+
Packs can also provide triggers: webhooks from the service, polls with a cursor, or schedules. A routine subscribes to one with a `type: action` trigger, and each event starts a run. [Pack triggers](https://docs.beta.b3os.org/actions/triggers) lists the catalog's 7 triggers and how their deliveries are verified.
|
|
58
|
+
|
|
59
|
+
## The catalog
|
|
60
|
+
|
|
61
|
+
The catalog is curated: only B3OS publishes to it, and a person signs every version. Today it has 32 packs with 246 actions and 7 triggers (all at version 1.0.0). It holds packs whose credential belongs to you (your own API key, token or OAuth token) or that call public APIs without one, such as generic HTTP, GitHub, Slack, Linear, Notion, Jira, Discord, read-only Stripe, Google APIs with your own OAuth client, and read-only market data. It leaves out packs that would run on keys B3 pays for, route through residential proxies, or sign wallet transactions. The [pack catalog](https://docs.beta.b3os.org/actions/catalog) lists every pack with its actions, and `GET /v1/actions/packs` lists what your node serves.
|
|
62
|
+
|
|
63
|
+
Every pack version carries a content hash and an Ed25519 publisher signature, and the node verifies both against the registry before loading it. In the beta only B3OS publishes packs, and the key that signs them is held by a person: no automated agent, CI job or tool can publish a first-party version. See [packs](https://docs.beta.b3os.org/actions/packs).
|
|
64
|
+
|
|
65
|
+
<a href="https://beta.b3os.org/gallery/docs-site/shot-actions/2e8ba0c2ce06cf01.webp"><img src="https://beta.b3os.org/gallery/docs-site/shot-actions/2e8ba0c2ce06cf01.webp" srcset="https://beta.b3os.org/gallery/docs-site/shot-actions/9e00cf3c79ce9aa4.webp 640w, https://beta.b3os.org/gallery/docs-site/shot-actions/57aa7640e1e313a6.webp 1080w, https://beta.b3os.org/gallery/docs-site/shot-actions/2e8ba0c2ce06cf01.webp 2910w" sizes="(max-width: 640px) calc(100vw - 60px), 760px" alt="An action pack in the dashboard: image from the capture docs-site/shot-actions" width="2910" height="2038" loading="lazy" /></a>
|
|
66
|
+
|
|
67
|
+
<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-actions`.</sub>
|
|
68
|
+
|
|
69
|
+
## Billing and scopes
|
|
70
|
+
|
|
71
|
+
Each call bills one `actions.call` once the action ran, 300 calls a minute per organization in the beta. The beta is free within its limits; see [pricing](https://docs.beta.b3os.org/concepts/usage#pricing).
|
|
72
|
+
|
|
73
|
+
| Scope | For |
|
|
74
|
+
|---|---|
|
|
75
|
+
| `actions:run` | Call actions |
|
|
76
|
+
| `actions:read` | Search and describe actions; list packs, triggers and subscriptions |
|
|
77
|
+
| `actions:write` | Publish packs to the registry (first-party publishers only in the beta) |
|
|
78
|
+
|
|
79
|
+
Naming a connection in a call also needs `vault:run`.
|
|
80
|
+
|
|
81
|
+
- [Call actions](https://docs.beta.b3os.org/actions/call)
|
|
82
|
+
Search, describe and call, with connections.
|
|
83
|
+
- [Pack triggers](https://docs.beta.b3os.org/actions/triggers)
|
|
84
|
+
Start routine runs from events in other services.
|
|
85
|
+
- [Packs](https://docs.beta.b3os.org/actions/packs)
|
|
86
|
+
What a pack contains and how it is signed.
|
|
87
|
+
- [Limits and FAQ](https://docs.beta.b3os.org/actions/limits)
|
|
88
|
+
Caps and common questions.
|