Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,7 @@ Browse pre-built agents, tools, filesystems, and software packages at the [agent

| Package | apt Equivalent | Description | Source | Combined Size | Gzipped |
|---------|---------------|-------------|--------|---------------|---------|
| `@rivet-dev/agent-os-codedb` | codedb | codedb code intelligence CLI (reduced WASI fork) | zig | 228 KiB | 36.7 KiB |
| `@rivet-dev/agent-os-codex` | codex | OpenAI Codex integration (codex, codex-exec) | rust | - | - |
| `@rivet-dev/agent-os-coreutils` | coreutils | GNU coreutils: sh, cat, ls, cp, sort, and 80+ commands | rust | - | - |
| `@rivet-dev/agent-os-curl` | curl | curl HTTP client | c | - | - |
Expand Down
10 changes: 5 additions & 5 deletions packages/core/tests/duckdb-package.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { existsSync } from "node:fs";
import coreutils from "@rivet-dev/agent-os-coreutils";
import duckdb from "../../../registry/software/duckdb/dist/index.js";
import httpGet from "../../../registry/software/http-get/dist/index.js";
import { AgentOs } from "../src/index.js";
import { AgentOs } from "../dist/index.js";

const hasDuckdbPackage = existsSync(`${duckdb.commandDir}/duckdb`);
const hasHttpGetPackage = existsSync(`${httpGet.commandDir}/http_get`);
Expand Down Expand Up @@ -36,12 +36,12 @@ describe.skipIf(!hasDuckdbPackage || !hasHttpGetPackage || !hasCoreutilsPackage)
let result = await vm.exec(
`duckdb -csv /tmp/app.duckdb -c "CREATE TABLE items(id INTEGER, value INTEGER); INSERT INTO items VALUES (1, 10), (2, 20); UPDATE items SET value = value + 1 WHERE id = 2;"`,
);
expect(result.exitCode).toBe(0);
expect(result.exitCode, result.stderr || result.stdout).toBe(0);

result = await vm.exec(
`duckdb -csv /tmp/app.duckdb -c "SELECT id, value FROM items ORDER BY id;"`,
);
expect(result.exitCode).toBe(0);
expect(result.exitCode, result.stderr || result.stdout).toBe(0);
expect(result.stdout.trim()).toBe("id,value\n1,10\n2,21");
expect(await vm.exists("/tmp/app.duckdb")).toBe(true);
});
Expand Down Expand Up @@ -69,12 +69,12 @@ describe.skipIf(!hasDuckdbPackage || !hasHttpGetPackage || !hasCoreutilsPackage)
let result = await vm.exec(
`http_get ${address.port} /remote.csv /tmp/remote.csv`,
);
expect(result.exitCode).toBe(0);
expect(result.exitCode, result.stderr || result.stdout).toBe(0);

result = await vm.exec(
`duckdb -csv -c "SELECT SUM(value) AS total FROM read_csv_auto('/tmp/remote.csv');"`,
);
expect(result.exitCode).toBe(0);
expect(result.exitCode, result.stderr || result.stdout).toBe(0);
expect(result.stdout.trim()).toBe("total\n8");
} finally {
await closeServer(server);
Expand Down
4 changes: 2 additions & 2 deletions packages/registry-types/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ export interface WasmCommandPackage {
aptName: string;
/** Human-readable description. */
description: string;
/** Build source: "rust" or "c". */
source: "rust" | "c";
/** Build source: "rust", "c", or "zig". */
source: "rust" | "c" | "zig";
/** Commands provided by this package. */
commands: WasmCommandEntry[];
/** Absolute path to the directory containing WASM command binaries. */
Expand Down
3 changes: 3 additions & 0 deletions registry/CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ All published packages follow `@rivet-dev/agent-os-{apt-name}` where `{apt-name}
| (none) | @rivet-dev/agent-os-codex | codex, codex-exec |
| git | @rivet-dev/agent-os-git | git (planned) |
| make | @rivet-dev/agent-os-make | make (planned) |
| codedb | @rivet-dev/agent-os-codedb | codedb |

### Disabled packages (WASM binaries not built)

Expand All @@ -56,6 +57,8 @@ The following packages exist but **cannot be compiled** until a patched wasi-lib

To unblock: run `cd native && ./scripts/patch-wasi-libc.sh` to build the patched sysroot, then `cd .. && make build-wasm-c copy-wasm`.

`@rivet-dev/agent-os-codedb` is built from a repo-side Zig fork under `native/zig/codedb/`. It reuses upstream indexing/search code but only ships the single-shot CLI subcommands that work in WasmVM today: `tree`, `outline`, `find`, `search`, `word`, `deps`, and `read`. The upstream daemon, HTTP server, watcher loop, and MCP server still rely on threads, sockets, child-process spawning, and POSIX file locking, so they remain out of scope for the current WASI package.

### Meta-packages

| Package | Includes |
Expand Down
27 changes: 23 additions & 4 deletions registry/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,21 +8,24 @@ COMMANDS_DIR := $(NATIVE_DIR)/target/wasm32-wasip1/release/commands
MARKER_DIR := .build-markers
RUST_MARKER := $(MARKER_DIR)/rust-wasm-built
C_MARKER := $(MARKER_DIR)/c-wasm-built
ZIG_MARKER := $(MARKER_DIR)/zig-wasm-built
COPY_MARKER := $(MARKER_DIR)/wasm-copied
META_MARKER := $(MARKER_DIR)/meta-generated
TS_MARKER := $(MARKER_DIR)/ts-built

ZIG ?= zig

# Command packages (excludes _types and meta-packages)
CMD_PACKAGES := coreutils sed grep gawk findutils diffutils tar gzip \
curl http-get wget zip unzip jq ripgrep fd tree file sqlite3 duckdb yq codex git
curl http-get wget zip unzip jq ripgrep fd tree file sqlite3 duckdb yq codex git codedb

# Meta-packages
META_PACKAGES := common build-essential everything

# All publishable packages
ALL_PACKAGES := $(CMD_PACKAGES) $(META_PACKAGES)

.PHONY: all build-wasm build-wasm-rust build-wasm-c copy-wasm generate-meta build test \
.PHONY: all build-wasm build-wasm-rust build-wasm-c build-wasm-zig copy-wasm generate-meta build test \
publish publish-dry publish-force publish-clean clean rebuild

all: build
Expand All @@ -36,7 +39,7 @@ $(MARKER_DIR):
# ---------------------------------------------------------------------------
# Build WASM binaries from source (in native/)
# ---------------------------------------------------------------------------
build-wasm: build-wasm-rust build-wasm-c
build-wasm: build-wasm-rust build-wasm-c build-wasm-zig

build-wasm-rust: $(RUST_MARKER)
$(RUST_MARKER): $(MARKER_DIR)
Expand All @@ -51,11 +54,23 @@ $(C_MARKER): $(MARKER_DIR)
cd $(NATIVE_DIR)/c && make install COMMANDS_DIR=../target/wasm32-wasip1/release/commands
@touch $(C_MARKER)

build-wasm-zig: $(ZIG_MARKER)
$(ZIG_MARKER): $(MARKER_DIR)
@echo "=== Building Zig WASM commands ==="
@if command -v "$(ZIG)" >/dev/null 2>&1; then \
cd $(NATIVE_DIR)/zig/codedb && \
"$(ZIG)" build -Dtarget=wasm32-wasi -Doptimize=ReleaseSmall && \
cp -f zig-out/bin/codedb.wasm zig-out/bin/codedb; \
else \
echo " WARN: zig not found; skipping Zig builds"; \
fi
@touch $(ZIG_MARKER)

# ---------------------------------------------------------------------------
# Copy WASM binaries from native build output into per-package wasm/ dirs
# ---------------------------------------------------------------------------
copy-wasm: $(COPY_MARKER)
$(COPY_MARKER): $(RUST_MARKER) $(C_MARKER)
$(COPY_MARKER): $(RUST_MARKER) $(C_MARKER) $(ZIG_MARKER)
@echo "=== Copying WASM binaries to packages ==="

@# --- coreutils ---
Expand Down Expand Up @@ -186,6 +201,10 @@ $(COPY_MARKER): $(RUST_MARKER) $(C_MARKER)
@mkdir -p software/git/wasm
@[ -f "$(COMMANDS_DIR)/git" ] && cp -f "$(COMMANDS_DIR)/git" software/git/wasm/ || echo " WARN: git not found"

@# --- codedb (repo-side Zig fork) ---
@mkdir -p software/codedb/wasm
@[ -f "$(NATIVE_DIR)/zig/codedb/zig-out/bin/codedb" ] && cp -f "$(NATIVE_DIR)/zig/codedb/zig-out/bin/codedb" software/codedb/wasm/ || echo " WARN: codedb not found (needs Zig toolchain)"

@echo "=== Copy complete ==="
@touch $(COPY_MARKER)

Expand Down
3 changes: 3 additions & 0 deletions registry/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ Node.js agent and tool packages that are projected into the VM via the ModuleAcc

| Package | apt Equivalent | Description | Source | Combined Size | Gzipped |
|---------|---------------|-------------|--------|---------------|---------|
| `@rivet-dev/agent-os-codedb` | codedb | codedb code intelligence CLI (reduced WASI fork) | zig | - | - |
| `@rivet-dev/agent-os-codex` | codex | OpenAI Codex integration (codex, codex-exec) | rust | 274 KiB | 118 KiB |
| `@rivet-dev/agent-os-coreutils` | coreutils | GNU coreutils: sh, cat, ls, cp, sort, and 80+ commands | rust | 51.4 MiB | 23.5 MiB |
| `@rivet-dev/agent-os-curl` | curl | curl HTTP client | c | - | - |
Expand Down Expand Up @@ -93,6 +94,8 @@ make copy-wasm # Copy binaries into per-package wasm/ directories
make build # Build TypeScript (includes above steps)
```

`codedb` also has a repo-side Zig source tree under `native/zig/codedb/`. Rebuilding that package currently requires a Zig 0.15.x toolchain available as `zig`, or passing `ZIG=/path/to/zig` to `make`.

## Publishing

All packages use date-based versioning (`0.0.{YYMMDDHHmmss}`). Publishing skips unchanged packages via content hashing.
Expand Down
6 changes: 1 addition & 5 deletions registry/native/c/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -514,15 +514,11 @@ $(NATIVE_DIR)/unzip: programs/unzip.c $(ZLIB_SRCS) $(MINIZIP_UNZIP_SRCS)
$(NATIVE_CC) $(NATIVE_CFLAGS) $(ZIP_INCLUDES) -o $@ programs/unzip.c $(ZLIB_SRCS) $(MINIZIP_UNZIP_SRCS) -lz

# curl_test: links libcurl (HTTP/HTTPS build for WASM via host_net + host_tls)
# Curl still expects stable local/peer socket-name queries after connect, so
# keep its WASI compatibility shim but route curl's own references onto private
# wrapper symbols to avoid colliding with our patched sysroot exports.
CURL_SRCS := $(wildcard libs/curl/lib/*.c) $(wildcard libs/curl/lib/vauth/*.c) \
$(wildcard libs/curl/lib/vtls/*.c) $(wildcard libs/curl/lib/vquic/*.c) \
$(wildcard libs/curl/lib/vssh/*.c)
CURL_INCLUDES := -Ilibs/curl/include -Ilibs/curl/lib -include libs/curl/lib/curl_setup.h -include libs/curl/lib/curl_printf.h
CURL_LIB_DEFS := -DHAVE_CONFIG_H -DBUILDING_LIBCURL -D_WASI_EMULATED_SIGNAL -DHAVE_BASENAME -DHAVE_LIBGEN_H \
-Dgetsockname=curl_wasi_getsockname -Dgetpeername=curl_wasi_getpeername
CURL_LIB_DEFS := -DHAVE_CONFIG_H -DBUILDING_LIBCURL -D_WASI_EMULATED_SIGNAL -DHAVE_BASENAME -DHAVE_LIBGEN_H

$(BUILD_DIR)/curl: scripts/build-curl-upstream.sh $(CURL_UPSTREAM_OVERLAY_FILES) $(WASI_SDK_DIR)/bin/clang
@mkdir -p $(BUILD_DIR)
Expand Down
Loading