@rivet-dev/agentos-toolchain 0.0.0-main.ab2ce7c
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 +76 -0
- package/bin/agentos-toolchain.mjs +7 -0
- package/dist/chunk-YTYFSDXW.js +1135 -0
- package/dist/cli.d.ts +1 -0
- package/dist/cli.js +182 -0
- package/dist/index.d.ts +202 -0
- package/dist/index.js +28 -0
- package/package.json +38 -0
package/README.md
ADDED
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
# @rivet-dev/agentos-toolchain
|
|
2
|
+
|
|
3
|
+
Build toolchain for **agentOS packages** — the only sanctioned way to turn an npm
|
|
4
|
+
package or a local script into a valid, self-contained agentOS package.
|
|
5
|
+
|
|
6
|
+
```bash
|
|
7
|
+
npx @rivet-dev/agentos-toolchain pack <npm-pkg | ./local-dir> [options]
|
|
8
|
+
```
|
|
9
|
+
|
|
10
|
+
## Why this lives in secure-exec
|
|
11
|
+
|
|
12
|
+
**Packaging is part of secure-exec's core behavior, so the tool that produces
|
|
13
|
+
packages lives here, next to the things it packages.** secure-exec owns the VM
|
|
14
|
+
runtime that *runs* packages — the kernel, the VFS, the `/opt/agentos` mount, the
|
|
15
|
+
`$PATH` command resolver, and the header/`binfmt` dispatch — and it owns the
|
|
16
|
+
package **definitions** themselves: the generic registry software (`registry/software/*`)
|
|
17
|
+
and the agent adapters (`registry/agent/*`). This toolchain is what builds those
|
|
18
|
+
definitions into the on-disk package format that the runtime resolves. Its
|
|
19
|
+
`header.ts` is the same `binfmt` table the sidecar enforces (`crates/sidecar`), so
|
|
20
|
+
keeping it in this repo keeps the producer and the consumer of the format in one
|
|
21
|
+
place.
|
|
22
|
+
|
|
23
|
+
agent-os (the product layer) only *consumes* finished packages via
|
|
24
|
+
`defineSoftware({ name, dir })`; it does not need to own the builder. The package
|
|
25
|
+
name stays `@rivet-dev/agentos-toolchain` so the documented `npx` entrypoint is
|
|
26
|
+
unchanged.
|
|
27
|
+
|
|
28
|
+
## `pack`
|
|
29
|
+
|
|
30
|
+
Produces `<out>/<name>/<version>/` — a package in the agentOS
|
|
31
|
+
[package format](https://agentos-sdk.dev/docs/architecture/packages-and-command-resolution):
|
|
32
|
+
|
|
33
|
+
The output is a **flat, self-contained package directory** — a plain npm dependency, no
|
|
34
|
+
agentOS-specific manifest and no symlinks:
|
|
35
|
+
|
|
36
|
+
```
|
|
37
|
+
<out>/ # the package dir itself (default ./<input-name>-package)
|
|
38
|
+
├── package.json # name, version, and the "bin" command map
|
|
39
|
+
└── node_modules/ # flat, self-contained dependency closure
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
Commands are declared in `package.json` `"bin"` (command → a **real entry file**), so the
|
|
43
|
+
package ships cleanly via npm. The runtime builds the `/opt/agentos/bin` symlinks itself when
|
|
44
|
+
it mounts the package — they are never part of the shipped artifact.
|
|
45
|
+
|
|
46
|
+
### Steps
|
|
47
|
+
|
|
48
|
+
1. **Isolate** — a clean temp dir (no host pnpm/workspace bleed-through).
|
|
49
|
+
2. **Install flat** — `npm install <pkg> --omit=dev` (full closure, hoisted, no scripts).
|
|
50
|
+
3. **Ensure `package.json`** — `name`/`version` from the package plus a `"bin"` map (each entry
|
|
51
|
+
gets a `#!` shebang). No `agentos-package.json` — `package.json` is the only metadata.
|
|
52
|
+
4. **Lay out flat** — `package.json` + `node_modules` written directly into `--out`.
|
|
53
|
+
5. **Verify** — every `bin` entry has a recognized header (`#!` shebang or `\0asm`); **reject**
|
|
54
|
+
native `.node` addons (they can't run in V8) — the error names `--prune-native` as the escape.
|
|
55
|
+
|
|
56
|
+
### Options
|
|
57
|
+
|
|
58
|
+
| Flag | Meaning |
|
|
59
|
+
|---|---|
|
|
60
|
+
| `--agent <command>` | mark a `bin` command as the package's ACP entrypoint |
|
|
61
|
+
| `--out <dir>` | output dir for the package itself (flat; default `./<input-name>-package`) |
|
|
62
|
+
| `--prune-native` | delete unreachable native `.node` addons from the flat closure instead of failing |
|
|
63
|
+
|
|
64
|
+
### Examples
|
|
65
|
+
|
|
66
|
+
```bash
|
|
67
|
+
# package a local CLI → ./my-tool-package/
|
|
68
|
+
npx @rivet-dev/agentos-toolchain pack ./my-tool
|
|
69
|
+
|
|
70
|
+
# an agent whose SDK closure carries unreachable native addons → ./pi-package/
|
|
71
|
+
npx @rivet-dev/agentos-toolchain pack @agentos-software/pi --agent pi-sdk-acp --prune-native
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
The package is consumed by an agentOS host as `defineSoftware({ name, dir })` — add
|
|
75
|
+
`agent: { acpEntrypoint: "<bin>" }` for an agent. The host projects it under `/opt/agentos`,
|
|
76
|
+
and `createSession(name)` launches the adapter via `/opt/agentos/bin/<bin>`.
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// Committed bin shim: pnpm links workspace bins at install time and silently
|
|
3
|
+
// skips missing targets, so pointing `bin` at generated dist/cli.js meant a
|
|
4
|
+
// fresh checkout never got the `agentos-toolchain` shim (CI: "agentos-toolchain:
|
|
5
|
+
// not found"). This file always exists; dist/cli.js is built before dependents
|
|
6
|
+
// run via turbo's ^build ordering.
|
|
7
|
+
await import("../dist/cli.js");
|