Skip to content
This repository was archived by the owner on Oct 22, 2025. It is now read-only.

Commit 7ff83e6

Browse files
committed
chore: update sdk
1 parent 5a74e24 commit 7ff83e6

File tree

6 files changed

+72
-36
lines changed

6 files changed

+72
-36
lines changed

packages/core/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@
172172
"@hono/node-server": "^1.18.2",
173173
"@hono/node-ws": "^1.1.1",
174174
"@rivet-gg/actor-core": "^25.1.0",
175-
"@rivetkit/engine-runner": "https://pkg.pr.new/rivet-gg/engine/@rivetkit/engine-runner@472",
175+
"@rivetkit/engine-runner": "https://pkg.pr.new/rivet-gg/engine/@rivetkit/engine-runner@7f23f3a",
176176
"@types/invariant": "^2",
177177
"@types/node": "^22.13.1",
178178
"@types/ws": "^8",

packages/core/src/drivers/engine/actor-driver.ts

Lines changed: 12 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,9 @@ import type {
44
} from "@rivetkit/engine-runner";
55
import { Runner } from "@rivetkit/engine-runner";
66
import * as cbor from "cbor-x";
7-
import { WSContext, WSContextInit } from "hono/ws";
7+
import { WSContext } from "hono/ws";
88
import invariant from "invariant";
9-
import { ActionContext } from "@/actor/action";
10-
import { generateConnId, generateConnToken } from "@/actor/connection";
11-
import {
12-
CONN_DRIVER_GENERIC_HTTP,
13-
type GenericHttpDriverState,
14-
} from "@/actor/generic-conn-driver";
15-
import * as protoHttpAction from "@/actor/protocol/http/action";
16-
import { deserialize, EncodingSchema, serialize } from "@/actor/protocol/serde";
17-
import { ActorHandle } from "@/client/actor-handle";
9+
import { EncodingSchema } from "@/actor/protocol/serde";
1810
import type { Client } from "@/client/client";
1911
import {
2012
type ActorDriver,
@@ -27,10 +19,10 @@ import {
2719
} from "@/driver-helpers/mod";
2820
import type {
2921
ActorRouter,
30-
AnyActorInstance as CoreAnyActorInstance,
3122
RegistryConfig,
3223
RunConfig,
3324
UniversalWebSocket,
25+
UpgradeWebSocketArgs,
3426
} from "@/mod";
3527
import {
3628
createActorRouter,
@@ -51,7 +43,6 @@ import { logger } from "./log";
5143
interface ActorHandler {
5244
actor?: AnyActorInstance;
5345
actorStartPromise?: PromiseWithResolvers<void>;
54-
metadata: RunnerActorConfig["metadata"];
5546
genericConnGlobalState: GenericConnGlobalState;
5647
persistedData?: Uint8Array;
5748
}
@@ -93,6 +84,7 @@ export class EngineActorDriver implements ActorDriver {
9384
addresses: config.addresses,
9485
totalSlots: config.totalSlots,
9586
runnerName: config.runnerName,
87+
runnerKey: config.runnerKey,
9688
prepopulateActorNames: Object.keys(this.#registryConfig.use),
9789
onConnected: () => {
9890
if (hasDisconnected) {
@@ -201,13 +193,13 @@ export class EngineActorDriver implements ActorDriver {
201193
): Promise<void> {
202194
logger().debug("runner actor starting", {
203195
actorId,
204-
name: config.metadata.actor.name,
205-
keys: config.metadata.actor.keys,
196+
name: config.name,
197+
key: config.key,
206198
generation,
207199
});
208200

209201
// Deserialize input
210-
let input;
202+
let input: any;
211203
if (config.input) {
212204
input = cbor.decode(config.input);
213205
}
@@ -218,19 +210,19 @@ export class EngineActorDriver implements ActorDriver {
218210
handler = {
219211
genericConnGlobalState: new GenericConnGlobalState(),
220212
actorStartPromise: Promise.withResolvers(),
221-
metadata: config.metadata,
222213
persistedData: serializeEmptyPersistData(input),
223214
};
224215
this.#actors.set(actorId, handler);
225216
}
226217

227-
const name = config.metadata.actor.name as string;
228-
const key = deserializeActorKey(config.metadata.actor.keys[0]);
218+
const name = config.name as string;
219+
invariant(config.key, "actor should have a key");
220+
const key = deserializeActorKey(config.key);
229221

230222
// Create actor instance
231223
const definition = lookupInRegistry(
232224
this.#registryConfig,
233-
config.metadata.actor.name as string, // TODO: Remove cast
225+
config.name as string, // TODO: Remove cast
234226
);
235227
handler.actor = definition.instantiate();
236228

@@ -299,7 +291,7 @@ export class EngineActorDriver implements ActorDriver {
299291
// Fetch WS handler
300292
//
301293
// We store the promise since we need to add WebSocket event listeners immediately that will wait for the promise to resolve
302-
let wsHandlerPromise;
294+
let wsHandlerPromise: Promise<UpgradeWebSocketArgs>;
303295
if (url.pathname === PATH_CONNECT_WEBSOCKET) {
304296
wsHandlerPromise = handleWebSocketConnect(
305297
request,

packages/core/src/drivers/engine/config.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,10 @@ export const ConfigSchema = z
1515
runnerName: z
1616
.string()
1717
.default(getEnvUniversal("RIVET_RUNNER") ?? "rivetkit"),
18+
// TODO: Automatically attempt ot determine key by common env vars (e.g. k8s pod name)
19+
runnerKey: z
20+
.string()
21+
.default(getEnvUniversal("RIVET_RUNNER_KEY") ?? crypto.randomUUID()),
1822
totalSlots: z.number().default(100_000),
1923
addresses: z
2024
.record(
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
export const KEYS = {
2-
PERSIST_DATA: [Uint8Array.from([1, 1])],
2+
PERSIST_DATA: Uint8Array.from([1, 1]),
33
};

packages/core/tsup.config.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,4 @@ import defaultConfig from "../../tsup.base.ts";
33

44
export default defineConfig({
55
...defaultConfig,
6-
noExternal: ["@rivetkit/engine-runner", "@rivetkit/engine-runner-protocol"],
76
});

pnpm-lock.yaml

Lines changed: 54 additions & 13 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)