Skip to content

Commit 2afe212

Browse files
committed
fix(rivetkit): bind methods through createWriteThroughProxy
1 parent 833c55f commit 2afe212

16 files changed

Lines changed: 669 additions & 216 deletions

File tree

pnpm-lock.yaml

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

rivetkit-asyncapi/asyncapi.json

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,33 @@
123123
"type": "null"
124124
}
125125
]
126+
},
127+
"actor": {
128+
"type": "object",
129+
"properties": {
130+
"actorId": {
131+
"type": "string"
132+
},
133+
"generation": {
134+
"anyOf": [
135+
{
136+
"type": "number"
137+
},
138+
{
139+
"type": "integer",
140+
"format": "int64"
141+
}
142+
]
143+
},
144+
"key": {
145+
"type": "string"
146+
}
147+
},
148+
"required": [
149+
"actorId",
150+
"generation"
151+
],
152+
"additionalProperties": false
126153
}
127154
},
128155
"required": [
@@ -421,6 +448,33 @@
421448
"type": "null"
422449
}
423450
]
451+
},
452+
"actor": {
453+
"type": "object",
454+
"properties": {
455+
"actorId": {
456+
"type": "string"
457+
},
458+
"generation": {
459+
"anyOf": [
460+
{
461+
"type": "number"
462+
},
463+
{
464+
"type": "integer",
465+
"format": "int64"
466+
}
467+
]
468+
},
469+
"key": {
470+
"type": "string"
471+
}
472+
},
473+
"required": [
474+
"actorId",
475+
"generation"
476+
],
477+
"additionalProperties": false
424478
}
425479
},
426480
"required": [

rivetkit-typescript/packages/rivetkit/package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -168,13 +168,14 @@
168168
"actor-config-schema-gen": "tsx scripts/actor-config-schema-gen.ts"
169169
},
170170
"dependencies": {
171-
"@rivet-dev/agent-os-core": "^0.1.1",
172171
"@hono/node-server": "^1.18.2",
173172
"@hono/node-ws": "^1.1.1",
174173
"@hono/zod-openapi": "^1.1.5",
174+
"@rivet-dev/agent-os-core": "^0.1.1",
175175
"@rivetkit/bare-ts": "^0.6.2",
176176
"@rivetkit/engine-cli": "workspace:*",
177177
"@rivetkit/engine-envoy-protocol": "workspace:*",
178+
"@rivetkit/on-change": "6.0.1",
178179
"@rivetkit/rivetkit-napi": "workspace:*",
179180
"@rivetkit/rivetkit-wasm": "workspace:*",
180181
"@rivetkit/traces": "workspace:*",
@@ -192,10 +193,10 @@
192193
"zod": "^4.1.0"
193194
},
194195
"devDependencies": {
196+
"@biomejs/biome": "^2.3",
195197
"@copilotkit/llmock": "^1.6.0",
196198
"@rivet-dev/agent-os-common": "*",
197199
"@rivet-dev/agent-os-pi": "^0.1.1",
198-
"@biomejs/biome": "^2.3",
199200
"@standard-schema/spec": "^1.0.0",
200201
"@types/invariant": "^2",
201202
"@types/node": "^22.13.1",

rivetkit-typescript/packages/rivetkit/src/client/actor-conn.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ import {
2222
import { assertUnreachable, stringifyError } from "@/common/utils";
2323
import type { UniversalWebSocket } from "@/common/websocket-interface";
2424
import type { EngineControlClient } from "@/engine-client/driver";
25+
import type { JsonCompatValue } from "@/common/encoding";
2526
import {
2627
decodeCborCompat,
2728
deserializeWithEncoding,
@@ -1267,7 +1268,7 @@ export class ActorConnRaw {
12671268
name: msg.body.val.name,
12681269
args: bufferToArrayBuffer(
12691270
encodeCborCompat(
1270-
msg.body.val.args,
1271+
msg.body.val.args as JsonCompatValue,
12711272
),
12721273
),
12731274
},

rivetkit-typescript/packages/rivetkit/src/client/actor-handle.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ import {
2323
} from "@/common/client-protocol-zod";
2424
import { deconstructError } from "@/common/utils";
2525
import type { EngineControlClient } from "@/engine-client/driver";
26+
import type { JsonCompatValue } from "@/common/encoding";
2627
import { decodeCborCompat, deserializeWithEncoding, encodeCborCompat } from "@/serde";
2728
import { bufferToArrayBuffer } from "@/utils";
2829
import type {
@@ -332,7 +333,7 @@ export class ActorHandleRaw {
332333
args,
333334
}),
334335
requestToBare: (args): protocol.HttpActionRequest => ({
335-
args: bufferToArrayBuffer(encodeCborCompat(args)),
336+
args: bufferToArrayBuffer(encodeCborCompat(args as JsonCompatValue)),
336337
}),
337338
responseFromJson: (json): Response => json.output as Response,
338339
responseFromBare: (bare): Response =>

rivetkit-typescript/packages/rivetkit/src/client/queue.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import {
1212
type HttpQueueSendResponse as HttpQueueSendResponseJson,
1313
HttpQueueSendResponseSchema,
1414
} from "@/common/client-protocol-zod";
15+
import type { JsonCompatValue } from "@/common/encoding";
1516
import { decodeCborCompat, encodeCborCompat } from "@/serde";
1617
import { bufferToArrayBuffer } from "@/utils";
1718
import { sendHttpRequest } from "./utils";
@@ -111,7 +112,7 @@ export function createQueueSender(
111112
}),
112113
requestToBare: (value): protocol.HttpQueueSendRequest => ({
113114
name: value.name ?? name,
114-
body: bufferToArrayBuffer(encodeCborCompat(value.body)),
115+
body: bufferToArrayBuffer(encodeCborCompat(value.body as JsonCompatValue)),
115116
wait: value.wait ?? false,
116117
timeout:
117118
value.timeout !== undefined ? BigInt(value.timeout) : null,

0 commit comments

Comments
 (0)