rivetkit 0.0.0-skip-ready-wait-flatten-client-options.1cae221 → 0.0.0-sqlite-uds.4e59a38
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/browser/client.d.ts +561 -89
- package/dist/browser/client.js +1063 -430
- package/dist/browser/client.js.map +1 -1
- package/dist/browser/inspector/client.d.ts +22 -2
- package/dist/browser/inspector/client.js +1036 -232
- package/dist/browser/inspector/client.js.map +1 -1
- package/dist/tsup/actor/errors.cjs +6 -2
- package/dist/tsup/actor/errors.cjs.map +1 -1
- package/dist/tsup/actor/errors.d.cts +1 -74
- package/dist/tsup/actor/errors.d.ts +1 -74
- package/dist/tsup/actor/errors.js +5 -1
- package/dist/tsup/agent-os/index.cjs +2218 -2082
- package/dist/tsup/agent-os/index.cjs.map +1 -1
- package/dist/tsup/agent-os/index.d.cts +556 -85
- package/dist/tsup/agent-os/index.d.ts +556 -85
- package/dist/tsup/agent-os/index.js +2220 -2084
- package/dist/tsup/agent-os/index.js.map +1 -1
- package/dist/tsup/{chunk-NFC5VU36.cjs → chunk-3GC3EP6D.cjs} +18 -10
- package/dist/tsup/chunk-3GC3EP6D.cjs.map +1 -0
- package/dist/tsup/{chunk-7MRGNVSR.js → chunk-3GLNEWGY.js} +78 -6
- package/dist/tsup/chunk-3GLNEWGY.js.map +1 -0
- package/dist/tsup/{chunk-V3QNBJ7N.cjs → chunk-4FC7TVS6.cjs} +35 -10
- package/dist/tsup/chunk-4FC7TVS6.cjs.map +1 -0
- package/dist/tsup/{chunk-POTPHU3P.cjs → chunk-62LSMTP2.cjs} +3 -3
- package/dist/tsup/{chunk-POTPHU3P.cjs.map → chunk-62LSMTP2.cjs.map} +1 -1
- package/dist/tsup/{chunk-OIKOPSXQ.js → chunk-7IVUT2JT.js} +12 -4
- package/dist/tsup/chunk-7IVUT2JT.js.map +1 -0
- package/dist/tsup/{chunk-22XU3BVY.cjs → chunk-GEYQLGXC.cjs} +925 -328
- package/dist/tsup/chunk-GEYQLGXC.cjs.map +1 -0
- package/dist/tsup/{chunk-D2TLG75Y.cjs → chunk-GMN45CQ6.cjs} +10 -10
- package/dist/tsup/chunk-GMN45CQ6.cjs.map +1 -0
- package/dist/tsup/{chunk-3BFYSYRU.js → chunk-HXUEHHJF.js} +3 -2
- package/dist/tsup/chunk-HXUEHHJF.js.map +1 -0
- package/dist/tsup/{chunk-IOYKCB6Y.cjs → chunk-I336PMWT.cjs} +44 -9
- package/dist/tsup/chunk-I336PMWT.cjs.map +1 -0
- package/dist/tsup/{chunk-RZEJJJKU.js → chunk-IB73AMGJ.js} +42 -7
- package/dist/tsup/chunk-IB73AMGJ.js.map +1 -0
- package/dist/tsup/{chunk-4ZIWB4CQ.js → chunk-ITWJ6Y7G.js} +2 -2
- package/dist/tsup/{chunk-PCBNKI2J.js → chunk-JZ7TWV65.js} +1 -1
- package/dist/tsup/chunk-JZ7TWV65.js.map +1 -0
- package/dist/tsup/{chunk-W54QCENI.js → chunk-KTNBYGRU.js} +134 -20
- package/dist/tsup/chunk-KTNBYGRU.js.map +1 -0
- package/dist/tsup/{chunk-AK57AL7S.cjs → chunk-OAPVVVTX.cjs} +79 -7
- package/dist/tsup/chunk-OAPVVVTX.cjs.map +1 -0
- package/dist/tsup/{chunk-TPBHXFB2.cjs → chunk-OUDV3ITX.cjs} +138 -24
- package/dist/tsup/chunk-OUDV3ITX.cjs.map +1 -0
- package/dist/tsup/{chunk-XNZR7UD2.cjs → chunk-PRXTIERO.cjs} +90 -65
- package/dist/tsup/chunk-PRXTIERO.cjs.map +1 -0
- package/dist/tsup/{chunk-LLD2D5LO.cjs → chunk-VE2X4KMG.cjs} +3 -2
- package/dist/tsup/chunk-VE2X4KMG.cjs.map +1 -0
- package/dist/tsup/{chunk-KSG2COSQ.js → chunk-WRZEVVLL.js} +6 -6
- package/dist/tsup/chunk-WRZEVVLL.js.map +1 -0
- package/dist/tsup/{chunk-LNMB25HW.js → chunk-XAIMHUPG.js} +780 -183
- package/dist/tsup/chunk-XAIMHUPG.js.map +1 -0
- package/dist/tsup/{chunk-D4TSTM6C.js → chunk-XZ62SWSC.js} +83 -58
- package/dist/tsup/chunk-XZ62SWSC.js.map +1 -0
- package/dist/tsup/{chunk-2NDZ7JCR.cjs → chunk-ZA7FLHKH.cjs} +1 -1
- package/dist/tsup/chunk-ZA7FLHKH.cjs.map +1 -0
- package/dist/tsup/{chunk-K34B3OVG.js → chunk-ZZ3WBRPD.js} +34 -9
- package/dist/tsup/chunk-ZZ3WBRPD.js.map +1 -0
- package/dist/tsup/client/mod.cjs +9 -9
- package/dist/tsup/client/mod.cjs.map +1 -1
- package/dist/tsup/client/mod.d.cts +8 -9
- package/dist/tsup/client/mod.d.ts +8 -9
- package/dist/tsup/client/mod.js +8 -8
- package/dist/tsup/common/log.cjs +5 -3
- package/dist/tsup/common/log.cjs.map +1 -1
- package/dist/tsup/common/log.d.cts +5 -1
- package/dist/tsup/common/log.d.ts +5 -1
- package/dist/tsup/common/log.js +6 -4
- package/dist/tsup/common/websocket.cjs +4 -4
- package/dist/tsup/common/websocket.js +3 -3
- package/dist/tsup/{config-CRdGwwbr.d.cts → config-CxG53eQo.d.cts} +577 -36
- package/dist/tsup/{config-kxXbtrJU.d.ts → config-DLOxy81E.d.cts} +5 -5
- package/dist/tsup/{config-kxXbtrJU.d.cts → config-DLOxy81E.d.ts} +5 -5
- package/dist/tsup/{config-DIpBWm5C.d.ts → config-Ds6DCRhV.d.ts} +577 -36
- package/dist/tsup/context-8KlcOYIs.d.cts +129 -0
- package/dist/tsup/context-Cfbm4QLr.d.ts +129 -0
- package/dist/tsup/db/drizzle.cjs +151 -79
- package/dist/tsup/db/drizzle.cjs.map +1 -1
- package/dist/tsup/db/drizzle.d.cts +2 -2
- package/dist/tsup/db/drizzle.d.ts +2 -2
- package/dist/tsup/db/drizzle.js +151 -79
- package/dist/tsup/db/drizzle.js.map +1 -1
- package/dist/tsup/db/mod.cjs +79 -24
- package/dist/tsup/db/mod.cjs.map +1 -1
- package/dist/tsup/db/mod.d.cts +2 -2
- package/dist/tsup/db/mod.d.ts +2 -2
- package/dist/tsup/db/mod.js +78 -23
- package/dist/tsup/db/mod.js.map +1 -1
- package/dist/tsup/dynamic/mod.cjs +24 -0
- package/dist/tsup/dynamic/mod.cjs.map +1 -0
- package/dist/tsup/dynamic/mod.d.cts +37 -0
- package/dist/tsup/dynamic/mod.d.ts +37 -0
- package/dist/tsup/dynamic/mod.js +24 -0
- package/dist/tsup/dynamic/mod.js.map +1 -0
- package/dist/tsup/inspector/mod.cjs +47 -12
- package/dist/tsup/inspector/mod.cjs.map +1 -1
- package/dist/tsup/inspector/mod.d.cts +37 -15
- package/dist/tsup/inspector/mod.d.ts +37 -15
- package/dist/tsup/inspector/mod.js +46 -11
- package/dist/tsup/inspector/mod.js.map +1 -1
- package/dist/tsup/inspector-tab/mod.cjs +162 -0
- package/dist/tsup/inspector-tab/mod.cjs.map +1 -0
- package/dist/tsup/inspector-tab/mod.d.cts +240 -0
- package/dist/tsup/inspector-tab/mod.d.ts +240 -0
- package/dist/tsup/inspector-tab/mod.js +162 -0
- package/dist/tsup/inspector-tab/mod.js.map +1 -0
- package/dist/tsup/mod.cjs +1078 -479
- package/dist/tsup/mod.cjs.map +1 -1
- package/dist/tsup/mod.d.cts +5 -6
- package/dist/tsup/mod.d.ts +5 -6
- package/dist/tsup/mod.js +996 -397
- package/dist/tsup/mod.js.map +1 -1
- package/dist/tsup/test/mod.cjs +21 -18
- package/dist/tsup/test/mod.cjs.map +1 -1
- package/dist/tsup/test/mod.d.cts +4 -5
- package/dist/tsup/test/mod.d.ts +4 -5
- package/dist/tsup/test/mod.js +18 -15
- package/dist/tsup/test/mod.js.map +1 -1
- package/dist/tsup/utils-CqDnC_PS.d.cts +104 -0
- package/dist/tsup/utils-CqDnC_PS.d.ts +104 -0
- package/dist/tsup/utils.cjs +3 -3
- package/dist/tsup/utils.d.cts +1 -1
- package/dist/tsup/utils.d.ts +1 -1
- package/dist/tsup/utils.js +2 -2
- package/dist/tsup/workflow/mod.cjs +386 -322
- package/dist/tsup/workflow/mod.cjs.map +1 -1
- package/dist/tsup/workflow/mod.d.cts +8 -9
- package/dist/tsup/workflow/mod.d.ts +8 -9
- package/dist/tsup/workflow/mod.js +363 -299
- package/dist/tsup/workflow/mod.js.map +1 -1
- package/package.json +35 -14
- package/src/actor/config.ts +188 -59
- package/src/actor/contexts/index.ts +7 -2
- package/src/actor/definition.ts +17 -19
- package/src/actor/driver.ts +3 -3
- package/src/actor/errors.ts +70 -7
- package/src/actor/instance/mod.ts +39 -56
- package/src/actor/keys.ts +2 -1
- package/src/actor/mod.ts +22 -20
- package/src/actor/schema.ts +2 -2
- package/src/agent-os/actor/index.ts +38 -18
- package/src/agent-os/actor/preview.ts +1 -2
- package/src/agent-os/actor/session.ts +2 -2
- package/src/agent-os/config.ts +1 -1
- package/src/agent-os/fs/database-vfs.ts +1 -1
- package/src/agent-os/index.ts +16 -15
- package/src/client/actor-common.ts +88 -62
- package/src/client/actor-conn.ts +58 -63
- package/src/client/actor-handle.ts +125 -71
- package/src/client/actor-query.ts +5 -5
- package/src/client/config.ts +3 -3
- package/src/client/errors.ts +2 -1
- package/src/client/lifecycle-errors.ts +2 -4
- package/src/client/query.ts +1 -1
- package/src/client/queue.ts +8 -3
- package/src/client/raw-utils.ts +10 -10
- package/src/client/resolve-gateway-target.ts +1 -1
- package/src/client/utils.ts +34 -10
- package/src/common/actor-router-consts.ts +7 -4
- package/src/common/actor-websocket.ts +3 -1
- package/src/common/bare/actor-persist/v1.ts +205 -163
- package/src/common/bare/actor-persist/v2.ts +265 -213
- package/src/common/bare/actor-persist/v3.ts +176 -172
- package/src/common/bare/actor-persist/v4.ts +254 -253
- package/src/common/bare/generated/client-protocol/v4.ts +599 -0
- package/src/common/bare/generated/inspector/v5.ts +1016 -0
- package/src/common/bare/transport/v1.ts +694 -542
- package/src/common/client-protocol-versioned.ts +176 -67
- package/src/common/client-protocol-zod.ts +7 -0
- package/src/common/client-protocol.ts +1 -1
- package/src/common/database/config.ts +16 -5
- package/src/common/database/mod.test.ts +83 -16
- package/src/common/database/mod.ts +86 -30
- package/src/common/database/native-database.test.ts +35 -22
- package/src/common/database/native-database.ts +26 -10
- package/src/common/database/shared.ts +1 -0
- package/src/common/encoding.ts +250 -16
- package/src/common/engine.ts +28 -1
- package/src/common/eventsource.ts +1 -1
- package/src/common/inline-websocket-adapter.ts +14 -13
- package/src/common/log.ts +15 -8
- package/src/common/router.ts +49 -23
- package/src/common/utils.ts +10 -202
- package/src/common/websocket-interface.ts +1 -1
- package/src/db/drizzle.ts +173 -96
- package/src/db/mod.ts +1 -1
- package/src/devtools-loader/index.ts +4 -7
- package/src/devtools-loader/serve-devtools.ts +26 -0
- package/src/drivers/engine/actor-driver.ts +76 -73
- package/src/dynamic/instance.ts +32 -0
- package/src/dynamic/internal.ts +50 -0
- package/src/dynamic/isolate-runtime.ts +66 -0
- package/src/dynamic/mod.ts +32 -0
- package/src/engine-client/actor-http-client.ts +6 -9
- package/src/engine-client/actor-websocket-client.ts +14 -13
- package/src/engine-client/api-endpoints.ts +51 -2
- package/src/engine-client/api-utils.ts +2 -2
- package/src/engine-client/driver.ts +3 -4
- package/src/engine-client/mod.ts +17 -10
- package/src/engine-client/ws-proxy.ts +9 -4
- package/src/inspector/client.browser.ts +66 -15
- package/src/inspector/mod.ts +2 -4
- package/src/inspector-tab/mod.ts +300 -0
- package/src/registry/config/envoy.ts +1 -2
- package/src/registry/config/index.ts +46 -20
- package/src/registry/index.ts +364 -87
- package/src/registry/napi-runtime.ts +97 -8
- package/src/registry/native-validation.ts +10 -12
- package/src/registry/native.ts +592 -343
- package/src/registry/process-metrics.ts +250 -0
- package/src/registry/runtime.ts +85 -6
- package/src/registry/wasm-runtime.ts +72 -3
- package/src/registry/write-through-proxy.ts +40 -0
- package/src/serde.ts +2 -2
- package/src/serverless/configure.ts +19 -8
- package/src/test/mod.ts +11 -8
- package/src/utils/crypto.ts +14 -0
- package/src/utils/endpoint-parser.ts +1 -1
- package/src/utils/env-vars.ts +37 -0
- package/src/utils/router.ts +1 -1
- package/src/utils.ts +1 -2
- package/src/workflow/context.ts +703 -240
- package/src/workflow/driver.ts +23 -12
- package/src/workflow/inspector.ts +12 -3
- package/src/workflow/mod.ts +37 -23
- package/dist/tsup/chunk-22XU3BVY.cjs.map +0 -1
- package/dist/tsup/chunk-2NDZ7JCR.cjs.map +0 -1
- package/dist/tsup/chunk-3BFYSYRU.js.map +0 -1
- package/dist/tsup/chunk-7MRGNVSR.js.map +0 -1
- package/dist/tsup/chunk-AK57AL7S.cjs.map +0 -1
- package/dist/tsup/chunk-D2TLG75Y.cjs.map +0 -1
- package/dist/tsup/chunk-D4TSTM6C.js.map +0 -1
- package/dist/tsup/chunk-IOYKCB6Y.cjs.map +0 -1
- package/dist/tsup/chunk-K34B3OVG.js.map +0 -1
- package/dist/tsup/chunk-KSG2COSQ.js.map +0 -1
- package/dist/tsup/chunk-LLD2D5LO.cjs.map +0 -1
- package/dist/tsup/chunk-LNMB25HW.js.map +0 -1
- package/dist/tsup/chunk-NFC5VU36.cjs.map +0 -1
- package/dist/tsup/chunk-OIKOPSXQ.js.map +0 -1
- package/dist/tsup/chunk-PCBNKI2J.js.map +0 -1
- package/dist/tsup/chunk-RZEJJJKU.js.map +0 -1
- package/dist/tsup/chunk-TPBHXFB2.cjs.map +0 -1
- package/dist/tsup/chunk-V3QNBJ7N.cjs.map +0 -1
- package/dist/tsup/chunk-W54QCENI.js.map +0 -1
- package/dist/tsup/chunk-XNZR7UD2.cjs.map +0 -1
- package/dist/tsup/context-B7G6sk7x.d.ts +0 -92
- package/dist/tsup/context-DzMRHkjC.d.cts +0 -92
- package/dist/tsup/utils-fwx3o3K9.d.cts +0 -18
- package/dist/tsup/utils-fwx3o3K9.d.ts +0 -18
- package/src/utils/serve.ts +0 -217
- /package/dist/tsup/{chunk-4ZIWB4CQ.js.map → chunk-ITWJ6Y7G.js.map} +0 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { AnyActorDefinition } from "@/actor/definition";
|
|
2
|
-
import type {
|
|
2
|
+
import type { ActorSpecifier } from "@/actor/errors";
|
|
3
3
|
import {
|
|
4
4
|
HEADER_CONN_PARAMS,
|
|
5
5
|
HEADER_ENCODING,
|
|
@@ -11,7 +11,6 @@ import {
|
|
|
11
11
|
HTTP_ACTION_RESPONSE_VERSIONED,
|
|
12
12
|
HTTP_RESPONSE_ERROR_VERSIONED,
|
|
13
13
|
} from "@/common/client-protocol-versioned";
|
|
14
|
-
import { AsyncMutex } from "@/common/database/shared";
|
|
15
14
|
import {
|
|
16
15
|
type HttpActionRequest as HttpActionRequestJson,
|
|
17
16
|
HttpActionRequestSchema,
|
|
@@ -20,16 +19,22 @@ import {
|
|
|
20
19
|
type HttpResponseError as HttpResponseErrorJson,
|
|
21
20
|
HttpResponseErrorSchema,
|
|
22
21
|
} from "@/common/client-protocol-zod";
|
|
22
|
+
import { AsyncMutex } from "@/common/database/shared";
|
|
23
|
+
import type { Encoding, JsonCompatValue } from "@/common/encoding";
|
|
23
24
|
import { deconstructError } from "@/common/utils";
|
|
24
25
|
import type { EngineControlClient } from "@/engine-client/driver";
|
|
25
|
-
import {
|
|
26
|
+
import {
|
|
27
|
+
decodeCborCompat,
|
|
28
|
+
deserializeWithEncoding,
|
|
29
|
+
encodeCborCompat,
|
|
30
|
+
} from "@/serde";
|
|
26
31
|
import { bufferToArrayBuffer } from "@/utils";
|
|
27
32
|
import type {
|
|
28
33
|
ActorActionOptions,
|
|
29
34
|
ActorConnectOptions,
|
|
30
35
|
ActorDefinitionActions,
|
|
31
|
-
ActorFetchInit,
|
|
32
36
|
ActorDefinitionQueueSend,
|
|
37
|
+
ActorFetchInit,
|
|
33
38
|
ActorGatewayOptions,
|
|
34
39
|
ActorWebSocketOptions,
|
|
35
40
|
} from "./actor-common";
|
|
@@ -139,8 +144,15 @@ export class ActorHandleRaw {
|
|
|
139
144
|
for (let attempt = 0; attempt < maxAttempts; attempt++) {
|
|
140
145
|
let actorId: string | undefined;
|
|
141
146
|
try {
|
|
142
|
-
const
|
|
143
|
-
|
|
147
|
+
const gatewayOptions = resolveActorGatewayOptions(
|
|
148
|
+
this.#gatewayOptions,
|
|
149
|
+
);
|
|
150
|
+
const target = await this.#resolveGatewayRequestTarget(
|
|
151
|
+
useQueryTarget,
|
|
152
|
+
gatewayOptions,
|
|
153
|
+
);
|
|
154
|
+
actorId =
|
|
155
|
+
"directId" in target ? target.directId : undefined;
|
|
144
156
|
|
|
145
157
|
return await createQueueSender({
|
|
146
158
|
encoding: this.#encoding,
|
|
@@ -149,19 +161,13 @@ export class ActorHandleRaw {
|
|
|
149
161
|
return await this.#driver.sendRequest(
|
|
150
162
|
target,
|
|
151
163
|
request,
|
|
152
|
-
|
|
153
|
-
this.#gatewayOptions,
|
|
154
|
-
),
|
|
164
|
+
gatewayOptions,
|
|
155
165
|
);
|
|
156
166
|
},
|
|
157
167
|
}).send(name, body, options as any);
|
|
158
168
|
} catch (err) {
|
|
159
|
-
const { group, code, message, metadata } =
|
|
160
|
-
err,
|
|
161
|
-
logger(),
|
|
162
|
-
{},
|
|
163
|
-
true,
|
|
164
|
-
);
|
|
169
|
+
const { group, code, message, metadata, actor } =
|
|
170
|
+
deconstructError(err, true);
|
|
165
171
|
|
|
166
172
|
if (
|
|
167
173
|
this.#shouldRetryQueueDispatchOverload(
|
|
@@ -204,19 +210,25 @@ export class ActorHandleRaw {
|
|
|
204
210
|
continue;
|
|
205
211
|
}
|
|
206
212
|
|
|
207
|
-
const invalidated = this.#invalidateResolvedActorId(
|
|
213
|
+
const invalidated = this.#invalidateResolvedActorId(
|
|
214
|
+
group,
|
|
215
|
+
code,
|
|
216
|
+
);
|
|
208
217
|
if (invalidated && attempt < maxAttempts - 1) {
|
|
209
218
|
useQueryTarget =
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
219
|
+
code === "starting" ||
|
|
220
|
+
code === "stopping" ||
|
|
221
|
+
code.startsWith("destroyed_");
|
|
213
222
|
if (useQueryTarget) {
|
|
214
223
|
await this.#waitForRetryWindow();
|
|
215
224
|
}
|
|
216
225
|
continue;
|
|
217
226
|
}
|
|
218
227
|
|
|
219
|
-
throw new ActorError(group, code, message,
|
|
228
|
+
throw new ActorError(group, code, message, {
|
|
229
|
+
metadata,
|
|
230
|
+
actor,
|
|
231
|
+
});
|
|
220
232
|
}
|
|
221
233
|
}
|
|
222
234
|
|
|
@@ -231,13 +243,12 @@ export class ActorHandleRaw {
|
|
|
231
243
|
* @template Args - The type of arguments to pass to the action function.
|
|
232
244
|
* @template Response - The type of the response returned by the action function.
|
|
233
245
|
*/
|
|
234
|
-
async action<
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
} & ActorActionOptions): Promise<Response> {
|
|
246
|
+
async action<Args extends Array<unknown> = unknown[], Response = unknown>(
|
|
247
|
+
opts: {
|
|
248
|
+
name: string;
|
|
249
|
+
args: Args;
|
|
250
|
+
} & ActorActionOptions,
|
|
251
|
+
): Promise<Response> {
|
|
241
252
|
if (
|
|
242
253
|
typeof opts === "string" ||
|
|
243
254
|
typeof opts !== "object" ||
|
|
@@ -256,10 +267,12 @@ export class ActorHandleRaw {
|
|
|
256
267
|
return await retryOnLifecycleBoundary(run, { signal: opts.signal });
|
|
257
268
|
}
|
|
258
269
|
|
|
259
|
-
async #sendActionNow(
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
270
|
+
async #sendActionNow(
|
|
271
|
+
opts: {
|
|
272
|
+
name: string;
|
|
273
|
+
args: unknown[];
|
|
274
|
+
} & ActorActionOptions,
|
|
275
|
+
): Promise<unknown> {
|
|
263
276
|
const maxAttempts = this.#getDynamicQueryMaxAttempts();
|
|
264
277
|
let useQueryTarget = false;
|
|
265
278
|
const gatewayOptions = resolveActorGatewayOptions(
|
|
@@ -270,7 +283,10 @@ export class ActorHandleRaw {
|
|
|
270
283
|
for (let attempt = 0; attempt < maxAttempts; attempt++) {
|
|
271
284
|
let actorId: string | undefined;
|
|
272
285
|
try {
|
|
273
|
-
const target = await this.#
|
|
286
|
+
const target = await this.#resolveGatewayRequestTarget(
|
|
287
|
+
useQueryTarget,
|
|
288
|
+
gatewayOptions,
|
|
289
|
+
);
|
|
274
290
|
actorId = "directId" in target ? target.directId : undefined;
|
|
275
291
|
|
|
276
292
|
logger().debug(
|
|
@@ -319,16 +335,20 @@ export class ActorHandleRaw {
|
|
|
319
335
|
requestVersion: CLIENT_PROTOCOL_CURRENT_VERSION,
|
|
320
336
|
requestVersionedDataHandler: HTTP_ACTION_REQUEST_VERSIONED,
|
|
321
337
|
responseVersion: CLIENT_PROTOCOL_CURRENT_VERSION,
|
|
322
|
-
responseVersionedDataHandler:
|
|
338
|
+
responseVersionedDataHandler:
|
|
339
|
+
HTTP_ACTION_RESPONSE_VERSIONED,
|
|
323
340
|
requestZodSchema: HttpActionRequestSchema,
|
|
324
341
|
responseZodSchema: HttpActionResponseSchema,
|
|
325
342
|
requestToJson: (args): HttpActionRequestJson => ({
|
|
326
343
|
args,
|
|
327
344
|
}),
|
|
328
345
|
requestToBare: (args): protocol.HttpActionRequest => ({
|
|
329
|
-
args: bufferToArrayBuffer(
|
|
346
|
+
args: bufferToArrayBuffer(
|
|
347
|
+
encodeCborCompat(args as JsonCompatValue),
|
|
348
|
+
),
|
|
330
349
|
}),
|
|
331
|
-
responseFromJson: (json): Response =>
|
|
350
|
+
responseFromJson: (json): Response =>
|
|
351
|
+
json.output as Response,
|
|
332
352
|
responseFromBare: (bare): Response =>
|
|
333
353
|
decodeCborCompat(new Uint8Array(bare.output)),
|
|
334
354
|
});
|
|
@@ -337,12 +357,8 @@ export class ActorHandleRaw {
|
|
|
337
357
|
}
|
|
338
358
|
return output;
|
|
339
359
|
} catch (err) {
|
|
340
|
-
const { group, code, message, metadata } =
|
|
341
|
-
err,
|
|
342
|
-
logger(),
|
|
343
|
-
{},
|
|
344
|
-
true,
|
|
345
|
-
);
|
|
360
|
+
const { group, code, message, metadata, actor } =
|
|
361
|
+
deconstructError(err, true);
|
|
346
362
|
|
|
347
363
|
if (
|
|
348
364
|
await this.#shouldRetrySchedulingError(
|
|
@@ -382,23 +398,28 @@ export class ActorHandleRaw {
|
|
|
382
398
|
"actor",
|
|
383
399
|
"not_found",
|
|
384
400
|
"The actor does not exist or was destroyed.",
|
|
385
|
-
metadata,
|
|
401
|
+
{ metadata, actor },
|
|
386
402
|
);
|
|
387
403
|
}
|
|
388
404
|
|
|
389
|
-
const invalidated = this.#invalidateResolvedActorId(
|
|
405
|
+
const invalidated = this.#invalidateResolvedActorId(
|
|
406
|
+
group,
|
|
407
|
+
code,
|
|
408
|
+
);
|
|
390
409
|
if (invalidated && attempt < maxAttempts - 1) {
|
|
391
410
|
if (
|
|
392
411
|
group === "actor" &&
|
|
393
412
|
(code === "starting" || code === "stopping")
|
|
394
413
|
) {
|
|
395
414
|
useQueryTarget = true;
|
|
396
|
-
await new Promise((resolve) =>
|
|
415
|
+
await new Promise((resolve) =>
|
|
416
|
+
setTimeout(resolve, 100),
|
|
417
|
+
);
|
|
397
418
|
}
|
|
398
419
|
continue;
|
|
399
420
|
}
|
|
400
421
|
|
|
401
|
-
throw new ActorError(group, code, message, metadata);
|
|
422
|
+
throw new ActorError(group, code, message, { metadata, actor });
|
|
402
423
|
}
|
|
403
424
|
}
|
|
404
425
|
|
|
@@ -561,6 +582,17 @@ export class ActorHandleRaw {
|
|
|
561
582
|
}
|
|
562
583
|
}
|
|
563
584
|
|
|
585
|
+
async #resolveGatewayRequestTarget(
|
|
586
|
+
useQueryTarget: boolean,
|
|
587
|
+
gatewayOptions: ActorGatewayOptions,
|
|
588
|
+
) {
|
|
589
|
+
if (gatewayOptions.skipReadyWait) {
|
|
590
|
+
return getGatewayTarget(this.#actorResolutionState);
|
|
591
|
+
}
|
|
592
|
+
|
|
593
|
+
return await this.#resolveActionTarget(useQueryTarget);
|
|
594
|
+
}
|
|
595
|
+
|
|
564
596
|
/**
|
|
565
597
|
* Establishes a persistent connection to the actor.
|
|
566
598
|
*
|
|
@@ -608,16 +640,21 @@ export class ActorHandleRaw {
|
|
|
608
640
|
) {
|
|
609
641
|
const maxAttempts = this.#getDynamicQueryMaxAttempts();
|
|
610
642
|
let useQueryTarget = false;
|
|
611
|
-
const {
|
|
643
|
+
const { skipReadyWait, ...requestInit } = init ?? {};
|
|
612
644
|
const gatewayOptions = resolveActorGatewayOptions(
|
|
613
645
|
this.#gatewayOptions,
|
|
614
|
-
{
|
|
646
|
+
{
|
|
647
|
+
skipReadyWait,
|
|
648
|
+
},
|
|
615
649
|
);
|
|
616
650
|
|
|
617
651
|
for (let attempt = 0; attempt < maxAttempts; attempt++) {
|
|
618
652
|
let actorId: string | undefined;
|
|
619
653
|
try {
|
|
620
|
-
const target = await this.#
|
|
654
|
+
const target = await this.#resolveGatewayRequestTarget(
|
|
655
|
+
useQueryTarget,
|
|
656
|
+
gatewayOptions,
|
|
657
|
+
);
|
|
621
658
|
actorId = "directId" in target ? target.directId : undefined;
|
|
622
659
|
const response = await rawHttpFetch(
|
|
623
660
|
this.#driver,
|
|
@@ -642,12 +679,8 @@ export class ActorHandleRaw {
|
|
|
642
679
|
}
|
|
643
680
|
return response;
|
|
644
681
|
} catch (err) {
|
|
645
|
-
const { group, code, message, metadata } =
|
|
646
|
-
err,
|
|
647
|
-
logger(),
|
|
648
|
-
{},
|
|
649
|
-
true,
|
|
650
|
-
);
|
|
682
|
+
const { group, code, message, metadata, actor } =
|
|
683
|
+
deconstructError(err, true);
|
|
651
684
|
|
|
652
685
|
if (
|
|
653
686
|
await this.#shouldRetrySchedulingError(
|
|
@@ -677,19 +710,22 @@ export class ActorHandleRaw {
|
|
|
677
710
|
continue;
|
|
678
711
|
}
|
|
679
712
|
|
|
680
|
-
const invalidated = this.#invalidateResolvedActorId(
|
|
713
|
+
const invalidated = this.#invalidateResolvedActorId(
|
|
714
|
+
group,
|
|
715
|
+
code,
|
|
716
|
+
);
|
|
681
717
|
if (invalidated && attempt < maxAttempts - 1) {
|
|
682
718
|
useQueryTarget =
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
719
|
+
code === "starting" ||
|
|
720
|
+
code === "stopping" ||
|
|
721
|
+
code.startsWith("destroyed_");
|
|
686
722
|
if (useQueryTarget) {
|
|
687
723
|
await this.#waitForRetryWindow();
|
|
688
724
|
}
|
|
689
725
|
continue;
|
|
690
726
|
}
|
|
691
727
|
|
|
692
|
-
throw new ActorError(group, code, message, metadata);
|
|
728
|
+
throw new ActorError(group, code, message, { metadata, actor });
|
|
693
729
|
}
|
|
694
730
|
}
|
|
695
731
|
|
|
@@ -701,13 +737,10 @@ export class ActorHandleRaw {
|
|
|
701
737
|
actorId: string | undefined,
|
|
702
738
|
attempt: number,
|
|
703
739
|
maxAttempts: number,
|
|
704
|
-
): Promise<
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
}
|
|
709
|
-
| null
|
|
710
|
-
> {
|
|
740
|
+
): Promise<{
|
|
741
|
+
useQueryTarget: boolean;
|
|
742
|
+
waitForRetryWindow: boolean;
|
|
743
|
+
} | null> {
|
|
711
744
|
if (response.ok || !isDynamicActorQuery(this.#actorResolutionState)) {
|
|
712
745
|
return null;
|
|
713
746
|
}
|
|
@@ -769,6 +802,7 @@ export class ActorHandleRaw {
|
|
|
769
802
|
code: string;
|
|
770
803
|
message: string;
|
|
771
804
|
metadata?: unknown;
|
|
805
|
+
actor?: ActorSpecifier;
|
|
772
806
|
} | null> {
|
|
773
807
|
if (response.ok) {
|
|
774
808
|
return null;
|
|
@@ -788,13 +822,22 @@ export class ActorHandleRaw {
|
|
|
788
822
|
code: string;
|
|
789
823
|
message: string;
|
|
790
824
|
metadata?: unknown;
|
|
825
|
+
actor?: ActorSpecifier;
|
|
791
826
|
}
|
|
792
827
|
>(
|
|
793
828
|
encoding,
|
|
794
829
|
new Uint8Array(await response.clone().arrayBuffer()),
|
|
795
830
|
HTTP_RESPONSE_ERROR_VERSIONED,
|
|
796
831
|
HttpResponseErrorSchema,
|
|
797
|
-
(json) =>
|
|
832
|
+
(json) => ({
|
|
833
|
+
...json,
|
|
834
|
+
actor: json.actor
|
|
835
|
+
? {
|
|
836
|
+
...json.actor,
|
|
837
|
+
generation: Number(json.actor.generation),
|
|
838
|
+
}
|
|
839
|
+
: undefined,
|
|
840
|
+
}),
|
|
798
841
|
(bare) => ({
|
|
799
842
|
group: bare.group,
|
|
800
843
|
code: bare.code,
|
|
@@ -802,6 +845,13 @@ export class ActorHandleRaw {
|
|
|
802
845
|
metadata: bare.metadata
|
|
803
846
|
? decodeCborCompat(new Uint8Array(bare.metadata))
|
|
804
847
|
: undefined,
|
|
848
|
+
actor: bare.actor
|
|
849
|
+
? {
|
|
850
|
+
actorId: bare.actor.actorId,
|
|
851
|
+
generation: Number(bare.actor.generation),
|
|
852
|
+
key: bare.actor.key ?? undefined,
|
|
853
|
+
}
|
|
854
|
+
: undefined,
|
|
805
855
|
}),
|
|
806
856
|
);
|
|
807
857
|
} catch {
|
|
@@ -822,9 +872,11 @@ export class ActorHandleRaw {
|
|
|
822
872
|
this.#gatewayOptions,
|
|
823
873
|
options,
|
|
824
874
|
);
|
|
825
|
-
const
|
|
826
|
-
|
|
827
|
-
|
|
875
|
+
const useQueryTarget = isDynamicActorQuery(this.#actorResolutionState);
|
|
876
|
+
const target = await this.#resolveGatewayRequestTarget(
|
|
877
|
+
useQueryTarget,
|
|
878
|
+
gatewayOptions,
|
|
879
|
+
);
|
|
828
880
|
return await rawWebSocket(
|
|
829
881
|
this.#driver,
|
|
830
882
|
target,
|
|
@@ -848,7 +900,9 @@ export class ActorHandleRaw {
|
|
|
848
900
|
return target.directId;
|
|
849
901
|
}
|
|
850
902
|
|
|
851
|
-
throw new Error(
|
|
903
|
+
throw new Error(
|
|
904
|
+
"dynamic actor resolution did not produce a direct actor id",
|
|
905
|
+
);
|
|
852
906
|
}
|
|
853
907
|
|
|
854
908
|
/**
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import * as errors from "@/actor/errors";
|
|
2
|
+
import type { ActorQuery } from "@/client/query";
|
|
2
3
|
import { stringifyError } from "@/common/utils";
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
import type {
|
|
5
|
+
EngineControlClient,
|
|
6
|
+
GatewayTarget,
|
|
6
7
|
} from "@/engine-client/driver";
|
|
7
|
-
import type
|
|
8
|
-
import { actorSchedulingError, type ActorSchedulingError } from "./errors";
|
|
8
|
+
import { type ActorSchedulingError, actorSchedulingError } from "./errors";
|
|
9
9
|
import { logger } from "./log";
|
|
10
10
|
|
|
11
11
|
/**
|
package/src/client/config.ts
CHANGED
|
@@ -72,10 +72,10 @@ export const ClientConfigSchemaBase = z.object({
|
|
|
72
72
|
|
|
73
73
|
gateway: z
|
|
74
74
|
.object({
|
|
75
|
-
|
|
75
|
+
skipReadyWait: z.boolean().optional().default(false),
|
|
76
76
|
})
|
|
77
77
|
.optional()
|
|
78
|
-
.default(() => ({
|
|
78
|
+
.default(() => ({ skipReadyWait: false })),
|
|
79
79
|
|
|
80
80
|
// See RunConfig.getUpgradeWebSocket
|
|
81
81
|
//
|
|
@@ -154,7 +154,7 @@ export function convertRegistryConfigToClientConfig(
|
|
|
154
154
|
namespace: config.namespace,
|
|
155
155
|
poolName: config.envoy.poolName,
|
|
156
156
|
headers: config.headers,
|
|
157
|
-
gateway: {
|
|
157
|
+
gateway: { skipReadyWait: false },
|
|
158
158
|
encoding: "bare",
|
|
159
159
|
getUpgradeWebSocket: undefined,
|
|
160
160
|
// We don't need health checks for internal clients
|
package/src/client/errors.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import {
|
|
2
|
+
type ActorSpecifier,
|
|
2
3
|
INTERNAL_ERROR_CODE,
|
|
3
4
|
RivetError,
|
|
4
5
|
type RivetErrorLike,
|
|
@@ -21,7 +22,7 @@ export class MalformedResponseMessage extends ActorClientError {
|
|
|
21
22
|
|
|
22
23
|
export { RivetError, RivetError as ActorError, UserError };
|
|
23
24
|
export type ActorSchedulingError = RivetError;
|
|
24
|
-
export type { RivetErrorLike };
|
|
25
|
+
export type { ActorSpecifier, RivetErrorLike };
|
|
25
26
|
|
|
26
27
|
export class HttpRequestError extends ActorClientError {
|
|
27
28
|
constructor(message: string, opts?: { cause?: unknown }) {
|
|
@@ -162,6 +162,7 @@ function classifyActorError(
|
|
|
162
162
|
function isRetryableGuardGatewayHttpError(code: string): boolean {
|
|
163
163
|
return (
|
|
164
164
|
code === "service_unavailable" ||
|
|
165
|
+
code === "actor_wake_retries_exceeded" ||
|
|
165
166
|
code === "actor_stopped_while_waiting" ||
|
|
166
167
|
code === "tunnel_request_aborted" ||
|
|
167
168
|
code === "tunnel_message_timeout" ||
|
|
@@ -299,10 +300,7 @@ export async function retryOnLifecycleBoundary<T>(
|
|
|
299
300
|
break;
|
|
300
301
|
}
|
|
301
302
|
|
|
302
|
-
const delayMs = Math.min(
|
|
303
|
-
initialDelayMs * 2 ** attempt,
|
|
304
|
-
maxDelayMs,
|
|
305
|
-
);
|
|
303
|
+
const delayMs = Math.min(initialDelayMs * 2 ** attempt, maxDelayMs);
|
|
306
304
|
await waitWithSignal(delayMs, opts?.signal);
|
|
307
305
|
}
|
|
308
306
|
}
|
package/src/client/query.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { z } from "zod/v4";
|
|
2
|
-
import { EncodingSchema } from "@/common/encoding";
|
|
3
2
|
import {
|
|
4
3
|
HEADER_ACTOR_ID,
|
|
5
4
|
HEADER_ACTOR_QUERY,
|
|
6
5
|
HEADER_CONN_PARAMS,
|
|
7
6
|
HEADER_ENCODING,
|
|
8
7
|
} from "@/common/actor-router-consts";
|
|
8
|
+
import { EncodingSchema } from "@/common/encoding";
|
|
9
9
|
|
|
10
10
|
// Maximum size of a key component in bytes
|
|
11
11
|
// Set to 128 bytes to allow for separators and escape characters in the full key
|
package/src/client/queue.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
1
|
+
import {
|
|
2
|
+
HEADER_CONN_PARAMS,
|
|
3
|
+
HEADER_ENCODING,
|
|
4
|
+
} from "@/common/actor-router-consts";
|
|
3
5
|
import type * as protocol from "@/common/client-protocol";
|
|
4
6
|
import {
|
|
5
7
|
CURRENT_VERSION as CLIENT_PROTOCOL_CURRENT_VERSION,
|
|
@@ -12,6 +14,7 @@ import {
|
|
|
12
14
|
type HttpQueueSendResponse as HttpQueueSendResponseJson,
|
|
13
15
|
HttpQueueSendResponseSchema,
|
|
14
16
|
} from "@/common/client-protocol-zod";
|
|
17
|
+
import type { Encoding, JsonCompatValue } from "@/common/encoding";
|
|
15
18
|
import { decodeCborCompat, encodeCborCompat } from "@/serde";
|
|
16
19
|
import { bufferToArrayBuffer } from "@/utils";
|
|
17
20
|
import { sendHttpRequest } from "./utils";
|
|
@@ -111,7 +114,9 @@ export function createQueueSender(
|
|
|
111
114
|
}),
|
|
112
115
|
requestToBare: (value): protocol.HttpQueueSendRequest => ({
|
|
113
116
|
name: value.name ?? name,
|
|
114
|
-
body: bufferToArrayBuffer(
|
|
117
|
+
body: bufferToArrayBuffer(
|
|
118
|
+
encodeCborCompat(value.body as JsonCompatValue),
|
|
119
|
+
),
|
|
115
120
|
wait: value.wait ?? false,
|
|
116
121
|
timeout:
|
|
117
122
|
value.timeout !== undefined ? BigInt(value.timeout) : null,
|
package/src/client/raw-utils.ts
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
|
-
import { PATH_WEBSOCKET_PREFIX } from "@/common/actor-router-consts";
|
|
2
|
-
import { deconstructError } from "@/common/utils";
|
|
3
1
|
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
2
|
+
HEADER_CONN_PARAMS,
|
|
3
|
+
PATH_WEBSOCKET_PREFIX,
|
|
4
|
+
} from "@/common/actor-router-consts";
|
|
5
|
+
import { deconstructError } from "@/common/utils";
|
|
6
|
+
import type {
|
|
7
|
+
EngineControlClient,
|
|
8
|
+
GatewayRequestOptions,
|
|
9
|
+
GatewayTarget,
|
|
7
10
|
} from "@/engine-client/driver";
|
|
8
|
-
import { HEADER_CONN_PARAMS } from "@/common/actor-router-consts";
|
|
9
11
|
import { ActorError } from "./errors";
|
|
10
12
|
import { logger } from "./log";
|
|
11
13
|
|
|
@@ -96,13 +98,11 @@ export async function rawHttpFetch(
|
|
|
96
98
|
return driver.sendRequest(target, proxyRequest, options);
|
|
97
99
|
} catch (err) {
|
|
98
100
|
// Standardize to ClientActorError instead of the native backend error
|
|
99
|
-
const { group, code, message, metadata } = deconstructError(
|
|
101
|
+
const { group, code, message, metadata, actor } = deconstructError(
|
|
100
102
|
err,
|
|
101
|
-
logger(),
|
|
102
|
-
{},
|
|
103
103
|
true,
|
|
104
104
|
);
|
|
105
|
-
throw new ActorError(group, code, message, metadata);
|
|
105
|
+
throw new ActorError(group, code, message, { metadata, actor });
|
|
106
106
|
}
|
|
107
107
|
}
|
|
108
108
|
|
package/src/client/utils.ts
CHANGED
|
@@ -1,19 +1,14 @@
|
|
|
1
1
|
import invariant from "invariant";
|
|
2
2
|
import type { VersionedDataHandler } from "vbare";
|
|
3
3
|
import type { z } from "zod/v4";
|
|
4
|
+
import { HTTP_RESPONSE_ERROR_VERSIONED } from "@/common/client-protocol-versioned";
|
|
5
|
+
import { HttpResponseErrorSchema } from "@/common/client-protocol-zod";
|
|
4
6
|
import type { Encoding } from "@/common/encoding";
|
|
5
7
|
import { assertUnreachable } from "@/common/utils";
|
|
6
|
-
import type { HttpResponseError } from "@/common/client-protocol";
|
|
7
|
-
import { HTTP_RESPONSE_ERROR_VERSIONED } from "@/common/client-protocol-versioned";
|
|
8
|
-
import {
|
|
9
|
-
type HttpResponseError as HttpResponseErrorJson,
|
|
10
|
-
HttpResponseErrorSchema,
|
|
11
|
-
} from "@/common/client-protocol-zod";
|
|
12
8
|
import {
|
|
13
9
|
contentTypeForEncoding,
|
|
14
10
|
decodeCborCompat,
|
|
15
11
|
deserializeWithEncoding,
|
|
16
|
-
encodingIsBinary,
|
|
17
12
|
serializeWithEncoding,
|
|
18
13
|
} from "@/serde";
|
|
19
14
|
import { httpUserAgent } from "@/utils";
|
|
@@ -186,8 +181,16 @@ export async function sendHttpRequest<
|
|
|
186
181
|
new Uint8Array(bufferResponse),
|
|
187
182
|
HTTP_RESPONSE_ERROR_VERSIONED,
|
|
188
183
|
HttpResponseErrorSchema,
|
|
189
|
-
// JSON:
|
|
190
|
-
(json):
|
|
184
|
+
// JSON/CBOR: normalize actor generation to the public number shape.
|
|
185
|
+
(json): any => ({
|
|
186
|
+
...json,
|
|
187
|
+
actor: json.actor
|
|
188
|
+
? {
|
|
189
|
+
...json.actor,
|
|
190
|
+
generation: Number(json.actor.generation),
|
|
191
|
+
}
|
|
192
|
+
: undefined,
|
|
193
|
+
}),
|
|
191
194
|
// BARE: decode ArrayBuffer metadata to unknown
|
|
192
195
|
(bare): any => ({
|
|
193
196
|
group: bare.group,
|
|
@@ -196,14 +199,35 @@ export async function sendHttpRequest<
|
|
|
196
199
|
metadata: bare.metadata
|
|
197
200
|
? decodeCborCompat(new Uint8Array(bare.metadata))
|
|
198
201
|
: undefined,
|
|
202
|
+
actor: bare.actor
|
|
203
|
+
? {
|
|
204
|
+
actorId: bare.actor.actorId,
|
|
205
|
+
generation: Number(bare.actor.generation),
|
|
206
|
+
key: bare.actor.key ?? undefined,
|
|
207
|
+
}
|
|
208
|
+
: undefined,
|
|
199
209
|
}),
|
|
200
210
|
);
|
|
201
211
|
|
|
212
|
+
logger().warn({
|
|
213
|
+
msg: "http error response",
|
|
214
|
+
group: responseData.group,
|
|
215
|
+
code: responseData.code,
|
|
216
|
+
message: responseData.message,
|
|
217
|
+
metadata: responseData.metadata,
|
|
218
|
+
actorId: responseData.actor?.actorId,
|
|
219
|
+
generation: responseData.actor?.generation,
|
|
220
|
+
actorKey: responseData.actor?.key,
|
|
221
|
+
});
|
|
222
|
+
|
|
202
223
|
throw new ActorError(
|
|
203
224
|
responseData.group,
|
|
204
225
|
responseData.code,
|
|
205
226
|
responseData.message,
|
|
206
|
-
|
|
227
|
+
{
|
|
228
|
+
metadata: responseData.metadata,
|
|
229
|
+
actor: responseData.actor,
|
|
230
|
+
},
|
|
207
231
|
);
|
|
208
232
|
} catch (error) {
|
|
209
233
|
// If it's already an ActorError, re-throw it
|
|
@@ -14,6 +14,8 @@ export const HEADER_ENCODING = "x-rivet-encoding";
|
|
|
14
14
|
export const HEADER_CONN_PARAMS = "x-rivet-conn-params";
|
|
15
15
|
|
|
16
16
|
export const HEADER_ACTOR_ID = "x-rivet-actor";
|
|
17
|
+
export const HEADER_ACTOR_GENERATION = "x-rivet-actor-generation";
|
|
18
|
+
export const HEADER_ACTOR_KEY = "x-rivet-actor-key";
|
|
17
19
|
|
|
18
20
|
export const HEADER_RIVET_TOKEN = "x-rivet-token";
|
|
19
21
|
|
|
@@ -21,8 +23,7 @@ export const HEADER_RIVET_TOKEN = "x-rivet-token";
|
|
|
21
23
|
export const HEADER_RIVET_TARGET = "x-rivet-target";
|
|
22
24
|
export const HEADER_RIVET_ACTOR = "x-rivet-actor";
|
|
23
25
|
export const HEADER_RIVET_NAMESPACE = "x-rivet-namespace";
|
|
24
|
-
export const
|
|
25
|
-
"x-rivet-bypass-connectable";
|
|
26
|
+
export const HEADER_RIVET_SKIP_READY_WAIT = "x-rivet-skip-ready-wait";
|
|
26
27
|
|
|
27
28
|
// MARK: WebSocket Protocol Prefixes
|
|
28
29
|
/** Some servers (such as node-ws & Cloudflare) require explicitly match a certain WebSocket protocol. This gives us a static protocol to match against. */
|
|
@@ -32,7 +33,7 @@ export const WS_PROTOCOL_ACTOR = "rivet_actor.";
|
|
|
32
33
|
export const WS_PROTOCOL_ENCODING = "rivet_encoding.";
|
|
33
34
|
export const WS_PROTOCOL_CONN_PARAMS = "rivet_conn_params.";
|
|
34
35
|
export const WS_PROTOCOL_TOKEN = "rivet_token.";
|
|
35
|
-
export const
|
|
36
|
+
export const WS_PROTOCOL_SKIP_READY_WAIT = "rivet_skip_ready_wait";
|
|
36
37
|
export const WS_PROTOCOL_TEST_ACK_HOOK = "rivet_test_ack_hook.";
|
|
37
38
|
|
|
38
39
|
// MARK: WebSocket Inline Test Protocol Prefixes
|
|
@@ -50,9 +51,11 @@ export const ALLOWED_PUBLIC_HEADERS = [
|
|
|
50
51
|
HEADER_ENCODING,
|
|
51
52
|
HEADER_CONN_PARAMS,
|
|
52
53
|
HEADER_ACTOR_ID,
|
|
54
|
+
HEADER_ACTOR_GENERATION,
|
|
55
|
+
HEADER_ACTOR_KEY,
|
|
53
56
|
HEADER_RIVET_TARGET,
|
|
54
57
|
HEADER_RIVET_ACTOR,
|
|
55
58
|
HEADER_RIVET_NAMESPACE,
|
|
56
59
|
HEADER_RIVET_TOKEN,
|
|
57
|
-
|
|
60
|
+
HEADER_RIVET_SKIP_READY_WAIT,
|
|
58
61
|
];
|