@rivetkit/engine-runner 2.0.29 → 2.0.31
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/mod.cjs +7 -5
- package/dist/mod.cjs.map +1 -1
- package/dist/mod.js +7 -5
- package/dist/mod.js.map +1 -1
- package/package.json +2 -2
- package/src/actor.ts +4 -4
- package/src/mod.ts +5 -4
- package/src/stringify.ts +3 -3
- package/src/tunnel.ts +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rivetkit/engine-runner",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.31",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"files": [
|
|
6
6
|
"dist",
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
"uuid": "^12.0.0",
|
|
22
22
|
"pino": "^9.9.5",
|
|
23
23
|
"ws": "^8.18.3",
|
|
24
|
-
"@rivetkit/engine-runner-protocol": "2.0.
|
|
24
|
+
"@rivetkit/engine-runner-protocol": "2.0.31"
|
|
25
25
|
},
|
|
26
26
|
"devDependencies": {
|
|
27
27
|
"@types/node": "^22.18.1",
|
package/src/actor.ts
CHANGED
|
@@ -85,8 +85,8 @@ export class RunnerActor {
|
|
|
85
85
|
gatewayId,
|
|
86
86
|
requestId,
|
|
87
87
|
request: {
|
|
88
|
-
resolve: () => {
|
|
89
|
-
reject: () => {
|
|
88
|
+
resolve: () => {},
|
|
89
|
+
reject: () => {},
|
|
90
90
|
actorId: this.actorId,
|
|
91
91
|
gatewayId: gatewayId,
|
|
92
92
|
requestId: requestId,
|
|
@@ -122,8 +122,8 @@ export class RunnerActor {
|
|
|
122
122
|
gatewayId,
|
|
123
123
|
requestId,
|
|
124
124
|
request: {
|
|
125
|
-
resolve: () => {
|
|
126
|
-
reject: () => {
|
|
125
|
+
resolve: () => {},
|
|
126
|
+
reject: () => {},
|
|
127
127
|
actorId: this.actorId,
|
|
128
128
|
gatewayId: gatewayId,
|
|
129
129
|
requestId: requestId,
|
package/src/mod.ts
CHANGED
|
@@ -991,7 +991,8 @@ export class Runner {
|
|
|
991
991
|
commandWrapper.checkpoint.actorId,
|
|
992
992
|
commandWrapper.checkpoint.generation,
|
|
993
993
|
);
|
|
994
|
-
if (actor)
|
|
994
|
+
if (actor)
|
|
995
|
+
actor.lastCommandIdx = commandWrapper.checkpoint.index;
|
|
995
996
|
} else if (commandWrapper.inner.tag === "CommandStopActor") {
|
|
996
997
|
// Spawn background promise
|
|
997
998
|
this.#handleCommandStopActor(commandWrapper).catch((err) => {
|
|
@@ -1008,13 +1009,13 @@ export class Runner {
|
|
|
1008
1009
|
}
|
|
1009
1010
|
|
|
1010
1011
|
#handleAckEvents(ack: protocol.ToClientAckEvents) {
|
|
1011
|
-
|
|
1012
|
+
const originalTotalEvents = Array.from(this.#actors).reduce(
|
|
1012
1013
|
(s, [_, actor]) => s + actor.eventHistory.length,
|
|
1013
1014
|
0,
|
|
1014
1015
|
);
|
|
1015
1016
|
|
|
1016
1017
|
for (const [_, actor] of this.#actors) {
|
|
1017
|
-
|
|
1018
|
+
const checkpoint = ack.lastEventCheckpoints.find(
|
|
1018
1019
|
(x) => x.actorId == actor.actorId,
|
|
1019
1020
|
);
|
|
1020
1021
|
|
|
@@ -1046,7 +1047,7 @@ export class Runner {
|
|
|
1046
1047
|
|
|
1047
1048
|
actor.recordEvent(eventWrapper);
|
|
1048
1049
|
|
|
1049
|
-
|
|
1050
|
+
const totalEvents = Array.from(this.#actors).reduce(
|
|
1050
1051
|
(s, [_, actor]) => s + actor.eventHistory.length,
|
|
1051
1052
|
0,
|
|
1052
1053
|
);
|
package/src/stringify.ts
CHANGED
|
@@ -115,8 +115,7 @@ export function stringifyToClientTunnelMessageKind(
|
|
|
115
115
|
export function stringifyCommand(command: protocol.Command): string {
|
|
116
116
|
switch (command.tag) {
|
|
117
117
|
case "CommandStartActor": {
|
|
118
|
-
const { config, hibernatingRequests } =
|
|
119
|
-
command.val;
|
|
118
|
+
const { config, hibernatingRequests } = command.val;
|
|
120
119
|
const keyStr = config.key === null ? "null" : `"${config.key}"`;
|
|
121
120
|
const inputStr =
|
|
122
121
|
config.input === null
|
|
@@ -253,9 +252,10 @@ export function stringifyToClient(message: protocol.ToClient): string {
|
|
|
253
252
|
const metadataStr = `{runnerLostThreshold: ${stringifyBigInt(metadata.runnerLostThreshold)}}`;
|
|
254
253
|
return `ToClientInit{runnerId: "${runnerId}", metadata: ${metadataStr}}`;
|
|
255
254
|
}
|
|
256
|
-
case "ToClientPing":
|
|
255
|
+
case "ToClientPing": {
|
|
257
256
|
const { ts } = message.val;
|
|
258
257
|
return `ToClientPing{ts: ${stringifyBigInt(ts)}}`;
|
|
258
|
+
}
|
|
259
259
|
case "ToClientCommands": {
|
|
260
260
|
const commands = message.val;
|
|
261
261
|
return `ToClientCommands{count: ${commands.length}, commands: [${commands.map((c) => stringifyCommandWrapper(c)).join(", ")}]}`;
|
package/src/tunnel.ts
CHANGED
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
stringify as uuidstringify,
|
|
11
11
|
v4 as uuidv4,
|
|
12
12
|
} from "uuid";
|
|
13
|
-
import {
|
|
13
|
+
import { type Runner, type RunnerActor, RunnerShutdownError } from "./mod";
|
|
14
14
|
import {
|
|
15
15
|
stringifyToClientTunnelMessageKind,
|
|
16
16
|
stringifyToServerTunnelMessageKind,
|