Skip to content
Merged
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
15 changes: 0 additions & 15 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,18 +22,6 @@ The `rivet.gg` domain is deprecated and should never be used in this codebase.
- Add a new versioned schema instead, then migrate `versioned.rs` and related compatibility code to bridge old versions forward.
- When bumping the protocol version, update `PROTOCOL_MK2_VERSION` in `engine/packages/runner-protocol/src/lib.rs` and `PROTOCOL_VERSION` in `rivetkit-typescript/packages/engine-runner/src/mod.ts` together. Both must match the latest schema version.

**Keep the KV API in sync between the runner protocol and the KV channel protocol.**

- The runner protocol (`engine/sdks/schemas/runner-protocol/`) and KV channel protocol (`engine/sdks/schemas/kv-channel-protocol/`) both expose KV operations. When adding, removing, or changing KV request/response types in one protocol, update the other to match.

**Keep KV channel protocol versions in sync.**

- When bumping the KV channel protocol version, update these two locations together:
- `engine/sdks/rust/kv-channel-protocol/src/lib.rs` (`PROTOCOL_VERSION`)
- `engine/sdks/rust/kv-channel-protocol/build.rs` (TypeScript `PROTOCOL_VERSION` in post-processing)
- All consumers (pegboard-kv-channel, sqlite-native, TS manager) get the version from the shared crate.
- The TypeScript SDK at `engine/sdks/typescript/kv-channel-protocol/src/index.ts` is auto-generated from the BARE schema during the Rust build. Do not edit it by hand.

## Commands

### Build Commands
Expand Down Expand Up @@ -274,9 +262,6 @@ let error_with_meta = ApiRateLimited { limit: 100, reset_at: 1234567890 }.build(
- If you need to add a dependency and can't find it in the Cargo.toml of the workspace, add it to the workspace dependencies in Cargo.toml (`[workspace.dependencies]`) and then add it to the package you need with `{dependency}.workspace = true`

**Native SQLite & KV Channel**
- Native SQLite (`rivetkit-typescript/packages/sqlite-native/`) is a napi-rs addon that statically links SQLite and uses a custom VFS backed by KV over a WebSocket KV channel. The WASM implementation (`@rivetkit/sqlite-vfs`) is the fallback.
- The KV channel (`engine/sdks/schemas/kv-channel-protocol/`) is independent of the runner protocol. It authenticates with `admin_token` (engine) or `config.token` (manager), not the runner key.
- The KV channel enforces single-writer locks per actor. Open/close are optimistic (no round-trip wait).
- The native VFS uses the same 4 KiB chunk layout and KV key encoding as the WASM VFS. Data is compatible between backends.
- **The native Rust VFS and the WASM TypeScript VFS must match 1:1.** This includes: KV key layout and encoding, chunk size, PRAGMA settings, VFS callback-to-KV-operation mapping, delete/truncate strategy (both must use `deleteRange`), and journal mode. When changing any VFS behavior in one implementation, update the other. The relevant files are:
- Native: `rivetkit-typescript/packages/sqlite-native/src/vfs.rs`, `kv.rs`
Expand Down
8 changes: 0 additions & 8 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ members = [
"engine/packages/pegboard-envoy",
"engine/packages/pegboard-gateway",
"engine/packages/pegboard-gateway2",
"engine/packages/pegboard-kv-channel",
"engine/packages/pegboard-outbound",
"engine/packages/pegboard-runner",
"engine/packages/pools",
Expand All @@ -53,7 +52,6 @@ members = [
"engine/sdks/rust/data",
"engine/sdks/rust/envoy-protocol",
"engine/sdks/rust/epoxy-protocol",
"engine/sdks/rust/kv-channel-protocol",
"engine/packages/runner-protocol",
"engine/sdks/rust/test-envoy",
"engine/sdks/typescript/test-envoy-native",
Expand Down Expand Up @@ -436,9 +434,6 @@ members = [
[workspace.dependencies.pegboard-gateway2]
path = "engine/packages/pegboard-gateway2"

[workspace.dependencies.pegboard-kv-channel]
path = "engine/packages/pegboard-kv-channel"

[workspace.dependencies.pegboard-outbound]
path = "engine/packages/pegboard-outbound"

Expand Down Expand Up @@ -506,9 +501,6 @@ members = [
[workspace.dependencies.epoxy-protocol]
path = "engine/sdks/rust/epoxy-protocol"

[workspace.dependencies.rivet-kv-channel-protocol]
path = "engine/sdks/rust/kv-channel-protocol"

[workspace.dependencies.rivet-envoy-protocol]
path = "engine/sdks/rust/envoy-protocol"

Expand Down
1 change: 0 additions & 1 deletion engine/packages/guard/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ once_cell.workspace = true
pegboard-envoy.workspace = true
pegboard-gateway.workspace = true
pegboard-gateway2.workspace = true
pegboard-kv-channel.workspace = true
pegboard-runner.workspace = true
pegboard.workspace = true
regex.workspace = true
Expand Down
58 changes: 0 additions & 58 deletions engine/packages/guard/src/routing/kv_channel.rs

This file was deleted.

16 changes: 0 additions & 16 deletions engine/packages/guard/src/routing/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ use crate::{errors, metrics, shared_state::SharedState};
pub mod actor_path;
mod api_public;
mod envoy;
mod kv_channel;
pub mod pegboard_gateway;
mod runner;
mod ws_health;
Expand All @@ -27,13 +26,9 @@ pub(crate) const WS_PROTOCOL_TOKEN: &str = "rivet_token.";
#[tracing::instrument(skip_all)]
pub fn create_routing_function(ctx: &StandaloneCtx, shared_state: SharedState) -> RoutingFn {
let ctx = ctx.clone();
let kv_channel_handler = Arc::new(pegboard_kv_channel::PegboardKvChannelCustomServe::new(
ctx.clone(),
));
Arc::new(move |req_ctx| {
let ctx = ctx.with_ray(req_ctx.ray_id(), req_ctx.req_id()).unwrap();
let shared_state = shared_state.clone();
let kv_channel_handler = kv_channel_handler.clone();
let hostname = req_ctx.hostname().to_string();
let path = req_ctx.path().to_string();

Expand Down Expand Up @@ -83,17 +78,6 @@ pub fn create_routing_function(ctx: &StandaloneCtx, shared_state: SharedState) -
return Ok(routing_output);
}

// Route KV channel
if let Some(routing_output) =
kv_channel::route_request_path_based(&ctx, req_ctx, &kv_channel_handler).await?
{
metrics::ROUTE_TOTAL
.with_label_values(&["kv_channel"])
.inc();

return Ok(routing_output);
}

// MARK: Header- & protocol-based routing (X-Rivet-Target)
// Determine target
let target = if req_ctx.is_websocket() {
Expand Down
35 changes: 0 additions & 35 deletions engine/packages/pegboard-kv-channel/Cargo.toml

This file was deleted.

Loading
Loading