@@ -4,17 +4,9 @@ import type {
44} from "@rivetkit/engine-runner" ;
55import { Runner } from "@rivetkit/engine-runner" ;
66import * as cbor from "cbor-x" ;
7- import { WSContext , WSContextInit } from "hono/ws" ;
7+ import { WSContext } from "hono/ws" ;
88import 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" ;
1810import type { Client } from "@/client/client" ;
1911import {
2012 type ActorDriver ,
@@ -27,10 +19,10 @@ import {
2719} from "@/driver-helpers/mod" ;
2820import type {
2921 ActorRouter ,
30- AnyActorInstance as CoreAnyActorInstance ,
3122 RegistryConfig ,
3223 RunConfig ,
3324 UniversalWebSocket ,
25+ UpgradeWebSocketArgs ,
3426} from "@/mod" ;
3527import {
3628 createActorRouter ,
@@ -51,7 +43,6 @@ import { logger } from "./log";
5143interface 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 ,
0 commit comments