rivetkit 2.3.12-rc.1 → 2.3.12-rc.3
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 +4 -0
- package/dist/browser/client.js +116 -60
- package/dist/browser/client.js.map +1 -1
- package/dist/browser/inspector/client.js +1 -1
- package/dist/browser/inspector/client.js.map +1 -1
- package/dist/tsup/actor/errors.cjs +2 -2
- package/dist/tsup/actor/errors.d.cts +1 -1
- package/dist/tsup/actor/errors.d.ts +1 -1
- package/dist/tsup/actor/errors.js +1 -1
- package/dist/tsup/agent-os/index.cjs +2 -2
- package/dist/tsup/agent-os/index.cjs.map +1 -1
- package/dist/tsup/agent-os/index.d.cts +4 -0
- package/dist/tsup/agent-os/index.d.ts +4 -0
- package/dist/tsup/agent-os/index.js +2 -2
- package/dist/tsup/agent-os/index.js.map +1 -1
- package/dist/tsup/{chunk-MT33DKU4.js → chunk-34Q4YVCX.js} +2 -2
- package/dist/tsup/{chunk-T4MKKCRF.cjs → chunk-4ESGNS3Z.cjs} +15 -10
- package/dist/tsup/chunk-4ESGNS3Z.cjs.map +1 -0
- package/dist/tsup/{chunk-VJ4KLJO5.cjs → chunk-EQKSWDIH.cjs} +3 -3
- package/dist/tsup/{chunk-VJ4KLJO5.cjs.map → chunk-EQKSWDIH.cjs.map} +1 -1
- package/dist/tsup/{chunk-BZX4LYYD.cjs → chunk-IJWTHKH6.cjs} +3 -3
- package/dist/tsup/{chunk-BZX4LYYD.cjs.map → chunk-IJWTHKH6.cjs.map} +1 -1
- package/dist/tsup/{chunk-ZZ3WBRPD.js → chunk-IXBD7BXC.js} +15 -4
- package/dist/tsup/chunk-IXBD7BXC.js.map +1 -0
- package/dist/tsup/{chunk-ZTPFJOBX.js → chunk-NHI5L7C7.js} +3 -3
- package/dist/tsup/{chunk-CMZBDX6Z.cjs → chunk-O6H3BUN4.cjs} +3 -3
- package/dist/tsup/{chunk-CMZBDX6Z.cjs.map → chunk-O6H3BUN4.cjs.map} +1 -1
- package/dist/tsup/{chunk-HVHDZDM2.js → chunk-OLGQYFUW.js} +8 -3
- package/dist/tsup/chunk-OLGQYFUW.js.map +1 -0
- package/dist/tsup/{chunk-BEPAAID2.cjs → chunk-OX6WVQE6.cjs} +10 -10
- package/dist/tsup/{chunk-BEPAAID2.cjs.map → chunk-OX6WVQE6.cjs.map} +1 -1
- package/dist/tsup/{chunk-KRPA4UOE.js → chunk-PSXMESQJ.js} +2 -2
- package/dist/tsup/{chunk-6ETWXXAZ.cjs → chunk-PZBWSCQR.cjs} +262 -213
- package/dist/tsup/chunk-PZBWSCQR.cjs.map +1 -0
- package/dist/tsup/{chunk-2D5PNV5A.cjs → chunk-QLOBB27M.cjs} +4 -4
- package/dist/tsup/{chunk-2D5PNV5A.cjs.map → chunk-QLOBB27M.cjs.map} +1 -1
- package/dist/tsup/{chunk-4FC7TVS6.cjs → chunk-SPJORZMM.cjs} +15 -4
- package/dist/tsup/chunk-SPJORZMM.cjs.map +1 -0
- package/dist/tsup/{chunk-DIHAXOB7.cjs → chunk-UBB32UOG.cjs} +7 -7
- package/dist/tsup/{chunk-DIHAXOB7.cjs.map → chunk-UBB32UOG.cjs.map} +1 -1
- package/dist/tsup/{chunk-OZWVDFCA.js → chunk-UN5JNDBT.js} +4 -4
- package/dist/tsup/{chunk-5UYNV4W6.js → chunk-WVFTFWJL.js} +2 -2
- package/dist/tsup/{chunk-JHHAMABO.js → chunk-XI4MEUUI.js} +2 -2
- package/dist/tsup/{chunk-A5BZEQOG.js → chunk-YYIDQBBM.js} +110 -61
- package/dist/tsup/chunk-YYIDQBBM.js.map +1 -0
- package/dist/tsup/client/mod.cjs +6 -6
- package/dist/tsup/client/mod.d.cts +5 -5
- package/dist/tsup/client/mod.d.ts +5 -5
- package/dist/tsup/client/mod.js +5 -5
- package/dist/tsup/common/log.cjs +3 -3
- package/dist/tsup/common/log.js +2 -2
- package/dist/tsup/common/websocket.cjs +4 -4
- package/dist/tsup/common/websocket.js +3 -3
- package/dist/tsup/{config-DTGoWdkG.d.cts → config-BXSV17G7.d.cts} +2 -2
- package/dist/tsup/{config-C4OSv0QP.d.ts → config-Bi1r6gI7.d.ts} +2 -2
- package/dist/tsup/{context-C6cvDNyk.d.cts → context-4fJemY0D.d.cts} +1 -1
- package/dist/tsup/{context-CMygeBxS.d.ts → context-D4sNYboo.d.ts} +1 -1
- package/dist/tsup/db/drizzle.cjs +3 -3
- package/dist/tsup/db/drizzle.js +2 -2
- package/dist/tsup/db/mod.cjs +4 -4
- package/dist/tsup/db/mod.js +3 -3
- package/dist/tsup/dynamic/mod.d.cts +3 -3
- package/dist/tsup/dynamic/mod.d.ts +3 -3
- package/dist/tsup/inspector/mod.cjs +6 -6
- package/dist/tsup/inspector/mod.js +5 -5
- package/dist/tsup/inspector/workflow.cjs +5 -5
- package/dist/tsup/inspector/workflow.js +4 -4
- package/dist/tsup/inspector-tab/mod.d.cts +4 -4
- package/dist/tsup/inspector-tab/mod.d.ts +4 -4
- package/dist/tsup/mod.cjs +111 -110
- package/dist/tsup/mod.cjs.map +1 -1
- package/dist/tsup/mod.d.cts +5 -5
- package/dist/tsup/mod.d.ts +5 -5
- package/dist/tsup/mod.js +8 -7
- package/dist/tsup/mod.js.map +1 -1
- package/dist/tsup/test/mod.cjs +7 -7
- package/dist/tsup/test/mod.d.cts +3 -3
- package/dist/tsup/test/mod.d.ts +3 -3
- package/dist/tsup/test/mod.js +5 -5
- package/dist/tsup/{utils-DQDCphrl.d.cts → utils-Bbz-3411.d.cts} +1 -1
- package/dist/tsup/{utils-CV0akuDD.d.ts → utils-BqdWVlzm.d.ts} +1 -1
- package/dist/tsup/{utils-CqDnC_PS.d.cts → utils-vvJQyygr.d.cts} +5 -0
- package/dist/tsup/{utils-CqDnC_PS.d.ts → utils-vvJQyygr.d.ts} +5 -0
- package/dist/tsup/utils.cjs +3 -3
- package/dist/tsup/utils.d.cts +2 -2
- package/dist/tsup/utils.d.ts +2 -2
- package/dist/tsup/utils.js +2 -2
- package/dist/tsup/workflow/mod.cjs +11 -11
- package/dist/tsup/workflow/mod.d.cts +5 -5
- package/dist/tsup/workflow/mod.d.ts +5 -5
- package/dist/tsup/workflow/mod.js +5 -5
- package/package.json +8 -8
- package/src/actor/errors.ts +29 -2
- package/src/client/actor-conn.ts +5 -4
- package/src/client/actor-handle.ts +47 -19
- package/src/client/actor-query.ts +8 -1
- package/src/client/errors.ts +2 -1
- package/src/client/raw-utils.ts +3 -5
- package/src/client/utils.ts +2 -0
- package/src/common/utils.ts +6 -0
- package/src/engine-client/mod.ts +51 -20
- package/src/registry/native.ts +1 -0
- package/dist/tsup/chunk-4FC7TVS6.cjs.map +0 -1
- package/dist/tsup/chunk-6ETWXXAZ.cjs.map +0 -1
- package/dist/tsup/chunk-A5BZEQOG.js.map +0 -1
- package/dist/tsup/chunk-HVHDZDM2.js.map +0 -1
- package/dist/tsup/chunk-T4MKKCRF.cjs.map +0 -1
- package/dist/tsup/chunk-ZZ3WBRPD.js.map +0 -1
- /package/dist/tsup/{chunk-MT33DKU4.js.map → chunk-34Q4YVCX.js.map} +0 -0
- /package/dist/tsup/{chunk-ZTPFJOBX.js.map → chunk-NHI5L7C7.js.map} +0 -0
- /package/dist/tsup/{chunk-KRPA4UOE.js.map → chunk-PSXMESQJ.js.map} +0 -0
- /package/dist/tsup/{chunk-OZWVDFCA.js.map → chunk-UN5JNDBT.js.map} +0 -0
- /package/dist/tsup/{chunk-5UYNV4W6.js.map → chunk-WVFTFWJL.js.map} +0 -0
- /package/dist/tsup/{chunk-JHHAMABO.js.map → chunk-XI4MEUUI.js.map} +0 -0
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
import {
|
|
9
9
|
importWebSocket,
|
|
10
10
|
logger
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-XI4MEUUI.js";
|
|
12
12
|
import {
|
|
13
13
|
EncodingSchema,
|
|
14
14
|
assertUnreachable,
|
|
@@ -35,13 +35,13 @@ import {
|
|
|
35
35
|
serializeWithEncoding,
|
|
36
36
|
stringifyError,
|
|
37
37
|
uint8ArrayToBase64
|
|
38
|
-
} from "./chunk-
|
|
38
|
+
} from "./chunk-OLGQYFUW.js";
|
|
39
39
|
import {
|
|
40
40
|
INTERNAL_ERROR_CODE,
|
|
41
41
|
RivetError,
|
|
42
42
|
actorNotFound,
|
|
43
43
|
invalidRequest
|
|
44
|
-
} from "./chunk-
|
|
44
|
+
} from "./chunk-IXBD7BXC.js";
|
|
45
45
|
|
|
46
46
|
// src/common/actor-router-consts.ts
|
|
47
47
|
var PATH_CONNECT = "/connect";
|
|
@@ -108,12 +108,12 @@ var ActorConnDisposed = class extends ActorClientError {
|
|
|
108
108
|
function isSchedulingError(group, code) {
|
|
109
109
|
return group === "guard" && (code === "actor_ready_timeout" || code === "actor_runner_failed");
|
|
110
110
|
}
|
|
111
|
-
function actorSchedulingError(group, code, actorId, details) {
|
|
111
|
+
function actorSchedulingError(group, code, actorId, details, rayId) {
|
|
112
112
|
return new RivetError(
|
|
113
113
|
group,
|
|
114
114
|
code,
|
|
115
115
|
`Actor failed to start (${actorId}): ${JSON.stringify(details)}`,
|
|
116
|
-
{ metadata: { actorId, details } }
|
|
116
|
+
{ metadata: { actorId, details }, rayId }
|
|
117
117
|
);
|
|
118
118
|
}
|
|
119
119
|
function internalClientError(message, opts) {
|
|
@@ -2121,7 +2121,7 @@ function getGatewayTarget(state) {
|
|
|
2121
2121
|
function isStaleResolvedActorError(group, code) {
|
|
2122
2122
|
return group === "actor" && (code === "not_found" || code === "starting" || code === "stopping" || code === "not_configured" || code === "dropped_reply" || code.startsWith("destroyed_"));
|
|
2123
2123
|
}
|
|
2124
|
-
async function checkForSchedulingError(group, code, actorId, query, driver) {
|
|
2124
|
+
async function checkForSchedulingError(group, code, actorId, query, driver, rayId) {
|
|
2125
2125
|
const name = getActorNameFromQuery(query);
|
|
2126
2126
|
try {
|
|
2127
2127
|
const actor = await driver.getForId({ name, actorId });
|
|
@@ -2131,7 +2131,13 @@ async function checkForSchedulingError(group, code, actorId, query, driver) {
|
|
|
2131
2131
|
actorId,
|
|
2132
2132
|
error: actor.error
|
|
2133
2133
|
});
|
|
2134
|
-
return actorSchedulingError(
|
|
2134
|
+
return actorSchedulingError(
|
|
2135
|
+
group,
|
|
2136
|
+
code,
|
|
2137
|
+
actorId,
|
|
2138
|
+
actor.error,
|
|
2139
|
+
rayId
|
|
2140
|
+
);
|
|
2135
2141
|
}
|
|
2136
2142
|
} catch (err) {
|
|
2137
2143
|
logger().warn({
|
|
@@ -2453,6 +2459,7 @@ async function sendHttpRequest(opts) {
|
|
|
2453
2459
|
code: responseData.code,
|
|
2454
2460
|
message: responseData.message,
|
|
2455
2461
|
metadata: responseData.metadata,
|
|
2462
|
+
rayId,
|
|
2456
2463
|
actorId: (_a = responseData.actor) == null ? void 0 : _a.actorId,
|
|
2457
2464
|
generation: (_b = responseData.actor) == null ? void 0 : _b.generation,
|
|
2458
2465
|
actorKey: (_c = responseData.actor) == null ? void 0 : _c.key
|
|
@@ -2463,6 +2470,7 @@ async function sendHttpRequest(opts) {
|
|
|
2463
2470
|
responseData.message,
|
|
2464
2471
|
{
|
|
2465
2472
|
metadata: responseData.metadata,
|
|
2473
|
+
rayId: rayId ?? void 0,
|
|
2466
2474
|
actor: responseData.actor
|
|
2467
2475
|
}
|
|
2468
2476
|
);
|
|
@@ -2648,11 +2656,8 @@ async function rawHttpFetch(driver, target, params, input, init, options = {}) {
|
|
|
2648
2656
|
});
|
|
2649
2657
|
return driver.sendRequest(target, proxyRequest, options);
|
|
2650
2658
|
} catch (err) {
|
|
2651
|
-
const { group, code, message, metadata, actor } = deconstructError(
|
|
2652
|
-
|
|
2653
|
-
true
|
|
2654
|
-
);
|
|
2655
|
-
throw new RivetError(group, code, message, { metadata, actor });
|
|
2659
|
+
const { group, code, message, metadata, rayId, actor } = deconstructError(err, true);
|
|
2660
|
+
throw new RivetError(group, code, message, { metadata, rayId, actor });
|
|
2656
2661
|
}
|
|
2657
2662
|
}
|
|
2658
2663
|
async function rawWebSocket(driver, target, params, path, _protocols, options = {}) {
|
|
@@ -2771,7 +2776,7 @@ var ActorHandleRaw = class {
|
|
|
2771
2776
|
async #sendQueueMessage(name, body, options) {
|
|
2772
2777
|
return await this.#queueSendMutex.run(async () => {
|
|
2773
2778
|
const maxAttempts = this.#getDynamicQueryMaxAttempts();
|
|
2774
|
-
let useQueryTarget =
|
|
2779
|
+
let useQueryTarget = isDynamicActorQuery(this.#actorResolutionState);
|
|
2775
2780
|
for (let attempt = 0; attempt < maxAttempts; attempt++) {
|
|
2776
2781
|
let actorId;
|
|
2777
2782
|
try {
|
|
@@ -2795,7 +2800,7 @@ var ActorHandleRaw = class {
|
|
|
2795
2800
|
}
|
|
2796
2801
|
}).send(name, body, options);
|
|
2797
2802
|
} catch (err) {
|
|
2798
|
-
const { group, code, message, metadata, actor } = deconstructError(err, true);
|
|
2803
|
+
const { group, code, message, metadata, rayId, actor } = deconstructError(err, true);
|
|
2799
2804
|
if (this.#shouldRetryQueueDispatchOverload(
|
|
2800
2805
|
group,
|
|
2801
2806
|
code,
|
|
@@ -2811,7 +2816,8 @@ var ActorHandleRaw = class {
|
|
|
2811
2816
|
code,
|
|
2812
2817
|
actorId,
|
|
2813
2818
|
attempt,
|
|
2814
|
-
maxAttempts
|
|
2819
|
+
maxAttempts,
|
|
2820
|
+
rayId
|
|
2815
2821
|
)) {
|
|
2816
2822
|
useQueryTarget = true;
|
|
2817
2823
|
await this.#waitForRetryWindow();
|
|
@@ -2833,14 +2839,16 @@ var ActorHandleRaw = class {
|
|
|
2833
2839
|
code
|
|
2834
2840
|
);
|
|
2835
2841
|
if (invalidated && attempt < maxAttempts - 1) {
|
|
2836
|
-
|
|
2837
|
-
|
|
2842
|
+
const waitForReady = code === "starting" || code === "stopping" || code.startsWith("destroyed_");
|
|
2843
|
+
useQueryTarget = useQueryTarget || waitForReady;
|
|
2844
|
+
if (waitForReady) {
|
|
2838
2845
|
await this.#waitForRetryWindow();
|
|
2839
2846
|
}
|
|
2840
2847
|
continue;
|
|
2841
2848
|
}
|
|
2842
2849
|
throw new RivetError(group, code, message, {
|
|
2843
2850
|
metadata,
|
|
2851
|
+
rayId,
|
|
2844
2852
|
actor
|
|
2845
2853
|
});
|
|
2846
2854
|
}
|
|
@@ -2869,7 +2877,7 @@ var ActorHandleRaw = class {
|
|
|
2869
2877
|
}
|
|
2870
2878
|
async #sendActionNow(opts) {
|
|
2871
2879
|
const maxAttempts = this.#getDynamicQueryMaxAttempts();
|
|
2872
|
-
let useQueryTarget =
|
|
2880
|
+
let useQueryTarget = isDynamicActorQuery(this.#actorResolutionState);
|
|
2873
2881
|
const gatewayOptions = resolveActorGatewayOptions(
|
|
2874
2882
|
this.#gatewayOptions,
|
|
2875
2883
|
opts
|
|
@@ -2934,13 +2942,14 @@ var ActorHandleRaw = class {
|
|
|
2934
2942
|
}
|
|
2935
2943
|
return output;
|
|
2936
2944
|
} catch (err) {
|
|
2937
|
-
const { group, code, message, metadata, actor } = deconstructError(err, true);
|
|
2945
|
+
const { group, code, message, metadata, rayId, actor } = deconstructError(err, true);
|
|
2938
2946
|
if (await this.#shouldRetrySchedulingError(
|
|
2939
2947
|
group,
|
|
2940
2948
|
code,
|
|
2941
2949
|
actorId,
|
|
2942
2950
|
attempt,
|
|
2943
|
-
maxAttempts
|
|
2951
|
+
maxAttempts,
|
|
2952
|
+
rayId
|
|
2944
2953
|
)) {
|
|
2945
2954
|
useQueryTarget = true;
|
|
2946
2955
|
await this.#waitForRetryWindow();
|
|
@@ -2962,7 +2971,7 @@ var ActorHandleRaw = class {
|
|
|
2962
2971
|
"actor",
|
|
2963
2972
|
"not_found",
|
|
2964
2973
|
"The actor does not exist or was destroyed.",
|
|
2965
|
-
{ metadata, actor }
|
|
2974
|
+
{ metadata, rayId, actor }
|
|
2966
2975
|
);
|
|
2967
2976
|
}
|
|
2968
2977
|
const invalidated = this.#invalidateResolvedActorId(
|
|
@@ -2978,7 +2987,11 @@ var ActorHandleRaw = class {
|
|
|
2978
2987
|
}
|
|
2979
2988
|
continue;
|
|
2980
2989
|
}
|
|
2981
|
-
throw new RivetError(group, code, message, {
|
|
2990
|
+
throw new RivetError(group, code, message, {
|
|
2991
|
+
metadata,
|
|
2992
|
+
rayId,
|
|
2993
|
+
actor
|
|
2994
|
+
});
|
|
2982
2995
|
}
|
|
2983
2996
|
}
|
|
2984
2997
|
throw new Error("unreachable action retry state");
|
|
@@ -3020,7 +3033,7 @@ var ActorHandleRaw = class {
|
|
|
3020
3033
|
this.#resolvedActorId = void 0;
|
|
3021
3034
|
this.#resolvingActorId = void 0;
|
|
3022
3035
|
}
|
|
3023
|
-
async #shouldRetrySchedulingError(group, code, actorId, attempt, maxAttempts) {
|
|
3036
|
+
async #shouldRetrySchedulingError(group, code, actorId, attempt, maxAttempts, rayId) {
|
|
3024
3037
|
if (!isDynamicActorQuery(this.#actorResolutionState) || !isSchedulingError(group, code) || attempt >= maxAttempts - 1) {
|
|
3025
3038
|
return false;
|
|
3026
3039
|
}
|
|
@@ -3030,7 +3043,8 @@ var ActorHandleRaw = class {
|
|
|
3030
3043
|
code,
|
|
3031
3044
|
actorId,
|
|
3032
3045
|
this.#actorResolutionState,
|
|
3033
|
-
this.#driver
|
|
3046
|
+
this.#driver,
|
|
3047
|
+
rayId
|
|
3034
3048
|
);
|
|
3035
3049
|
if (schedulingError) {
|
|
3036
3050
|
throw schedulingError;
|
|
@@ -3112,7 +3126,7 @@ var ActorHandleRaw = class {
|
|
|
3112
3126
|
}
|
|
3113
3127
|
async #fetchWithResolvedActor(input, init) {
|
|
3114
3128
|
const maxAttempts = this.#getDynamicQueryMaxAttempts();
|
|
3115
|
-
let useQueryTarget =
|
|
3129
|
+
let useQueryTarget = isDynamicActorQuery(this.#actorResolutionState);
|
|
3116
3130
|
const { skipReadyWait, ...requestInit } = init ?? {};
|
|
3117
3131
|
const gatewayOptions = resolveActorGatewayOptions(
|
|
3118
3132
|
this.#gatewayOptions,
|
|
@@ -3151,13 +3165,14 @@ var ActorHandleRaw = class {
|
|
|
3151
3165
|
}
|
|
3152
3166
|
return response;
|
|
3153
3167
|
} catch (err) {
|
|
3154
|
-
const { group, code, message, metadata, actor } = deconstructError(err, true);
|
|
3168
|
+
const { group, code, message, metadata, rayId, actor } = deconstructError(err, true);
|
|
3155
3169
|
if (await this.#shouldRetrySchedulingError(
|
|
3156
3170
|
group,
|
|
3157
3171
|
code,
|
|
3158
3172
|
actorId,
|
|
3159
3173
|
attempt,
|
|
3160
|
-
maxAttempts
|
|
3174
|
+
maxAttempts,
|
|
3175
|
+
rayId
|
|
3161
3176
|
)) {
|
|
3162
3177
|
useQueryTarget = true;
|
|
3163
3178
|
await this.#waitForRetryWindow();
|
|
@@ -3179,13 +3194,18 @@ var ActorHandleRaw = class {
|
|
|
3179
3194
|
code
|
|
3180
3195
|
);
|
|
3181
3196
|
if (invalidated && attempt < maxAttempts - 1) {
|
|
3182
|
-
|
|
3183
|
-
|
|
3197
|
+
const waitForReady = code === "starting" || code === "stopping" || code.startsWith("destroyed_");
|
|
3198
|
+
useQueryTarget = useQueryTarget || waitForReady;
|
|
3199
|
+
if (waitForReady) {
|
|
3184
3200
|
await this.#waitForRetryWindow();
|
|
3185
3201
|
}
|
|
3186
3202
|
continue;
|
|
3187
3203
|
}
|
|
3188
|
-
throw new RivetError(group, code, message, {
|
|
3204
|
+
throw new RivetError(group, code, message, {
|
|
3205
|
+
metadata,
|
|
3206
|
+
rayId,
|
|
3207
|
+
actor
|
|
3208
|
+
});
|
|
3189
3209
|
}
|
|
3190
3210
|
}
|
|
3191
3211
|
throw new Error("unreachable fetch retry state");
|
|
@@ -3198,13 +3218,14 @@ var ActorHandleRaw = class {
|
|
|
3198
3218
|
if (!error) {
|
|
3199
3219
|
return null;
|
|
3200
3220
|
}
|
|
3201
|
-
const { group, code } = error;
|
|
3221
|
+
const { group, code, rayId } = error;
|
|
3202
3222
|
if (await this.#shouldRetrySchedulingError(
|
|
3203
3223
|
group,
|
|
3204
3224
|
code,
|
|
3205
3225
|
actorId,
|
|
3206
3226
|
attempt,
|
|
3207
|
-
maxAttempts
|
|
3227
|
+
maxAttempts,
|
|
3228
|
+
rayId
|
|
3208
3229
|
)) {
|
|
3209
3230
|
return {
|
|
3210
3231
|
useQueryTarget: true,
|
|
@@ -3225,10 +3246,10 @@ var ActorHandleRaw = class {
|
|
|
3225
3246
|
}
|
|
3226
3247
|
const invalidated = this.#invalidateResolvedActorId(group, code);
|
|
3227
3248
|
if (invalidated && attempt < maxAttempts - 1) {
|
|
3228
|
-
const
|
|
3249
|
+
const waitForReady = code === "starting" || code === "stopping" || code.startsWith("destroyed_");
|
|
3229
3250
|
return {
|
|
3230
|
-
useQueryTarget,
|
|
3231
|
-
waitForRetryWindow:
|
|
3251
|
+
useQueryTarget: true,
|
|
3252
|
+
waitForRetryWindow: waitForReady
|
|
3232
3253
|
};
|
|
3233
3254
|
}
|
|
3234
3255
|
return null;
|
|
@@ -3240,7 +3261,7 @@ var ActorHandleRaw = class {
|
|
|
3240
3261
|
const contentType = response.headers.get("content-type");
|
|
3241
3262
|
const encoding = (contentType == null ? void 0 : contentType.includes("application/json")) ? "json" : this.#encoding;
|
|
3242
3263
|
try {
|
|
3243
|
-
|
|
3264
|
+
const error = deserializeWithEncoding(
|
|
3244
3265
|
encoding,
|
|
3245
3266
|
new Uint8Array(await response.clone().arrayBuffer()),
|
|
3246
3267
|
HTTP_RESPONSE_ERROR_VERSIONED,
|
|
@@ -3264,6 +3285,10 @@ var ActorHandleRaw = class {
|
|
|
3264
3285
|
} : void 0
|
|
3265
3286
|
})
|
|
3266
3287
|
);
|
|
3288
|
+
return {
|
|
3289
|
+
...error,
|
|
3290
|
+
rayId: response.headers.get("x-rivet-ray-id") ?? void 0
|
|
3291
|
+
};
|
|
3267
3292
|
} catch {
|
|
3268
3293
|
return null;
|
|
3269
3294
|
}
|
|
@@ -3327,7 +3352,9 @@ var ActorHandleRaw = class {
|
|
|
3327
3352
|
"actor",
|
|
3328
3353
|
"reload_failed",
|
|
3329
3354
|
`reload failed with status ${response.status}: ${body}`,
|
|
3330
|
-
{
|
|
3355
|
+
{
|
|
3356
|
+
rayId: response.headers.get("x-rivet-ray-id") ?? void 0
|
|
3357
|
+
}
|
|
3331
3358
|
);
|
|
3332
3359
|
}
|
|
3333
3360
|
}
|
|
@@ -4185,7 +4212,7 @@ var ActorConnRaw = class {
|
|
|
4185
4212
|
const reason = closeEvent.reason || "";
|
|
4186
4213
|
const parsed = parseWebSocketCloseReason(reason);
|
|
4187
4214
|
if (parsed) {
|
|
4188
|
-
const { group, code } = parsed;
|
|
4215
|
+
const { group, code, rayId } = parsed;
|
|
4189
4216
|
if (this.#shouldReconnectForStaleActor(group, code)) {
|
|
4190
4217
|
this.#clearResolvedActorIdentity();
|
|
4191
4218
|
(_a = this.#onOpenPromise) == null ? void 0 : _a.reject(
|
|
@@ -4193,7 +4220,7 @@ var ActorConnRaw = class {
|
|
|
4193
4220
|
group,
|
|
4194
4221
|
code,
|
|
4195
4222
|
`Connection closed: ${reason}`,
|
|
4196
|
-
|
|
4223
|
+
{ rayId }
|
|
4197
4224
|
)
|
|
4198
4225
|
);
|
|
4199
4226
|
return;
|
|
@@ -4204,7 +4231,8 @@ var ActorConnRaw = class {
|
|
|
4204
4231
|
code,
|
|
4205
4232
|
this.#actorId,
|
|
4206
4233
|
this.#actorResolutionState,
|
|
4207
|
-
this.#driver
|
|
4234
|
+
this.#driver,
|
|
4235
|
+
rayId
|
|
4208
4236
|
);
|
|
4209
4237
|
if (schedulingError) {
|
|
4210
4238
|
error = schedulingError;
|
|
@@ -4213,7 +4241,7 @@ var ActorConnRaw = class {
|
|
|
4213
4241
|
group,
|
|
4214
4242
|
code,
|
|
4215
4243
|
`Connection closed: ${reason}`,
|
|
4216
|
-
|
|
4244
|
+
{ rayId }
|
|
4217
4245
|
);
|
|
4218
4246
|
}
|
|
4219
4247
|
} else {
|
|
@@ -4221,7 +4249,7 @@ var ActorConnRaw = class {
|
|
|
4221
4249
|
group,
|
|
4222
4250
|
code,
|
|
4223
4251
|
`Connection closed: ${reason}`,
|
|
4224
|
-
|
|
4252
|
+
{ rayId }
|
|
4225
4253
|
);
|
|
4226
4254
|
}
|
|
4227
4255
|
this.#invalidateActorIfStale(group, code);
|
|
@@ -5630,24 +5658,45 @@ var RemoteEngineControlClient = class {
|
|
|
5630
5658
|
name,
|
|
5631
5659
|
key
|
|
5632
5660
|
});
|
|
5633
|
-
|
|
5634
|
-
|
|
5635
|
-
|
|
5636
|
-
|
|
5637
|
-
|
|
5638
|
-
|
|
5639
|
-
|
|
5640
|
-
|
|
5641
|
-
|
|
5642
|
-
|
|
5643
|
-
|
|
5644
|
-
|
|
5645
|
-
|
|
5646
|
-
|
|
5647
|
-
|
|
5648
|
-
|
|
5649
|
-
|
|
5650
|
-
|
|
5661
|
+
try {
|
|
5662
|
+
const { actor, created } = await getOrCreateActor(this.#config, {
|
|
5663
|
+
datacenter: region,
|
|
5664
|
+
name,
|
|
5665
|
+
key: serializeActorKey(key),
|
|
5666
|
+
runner_name_selector: poolName ?? this.#config.poolName,
|
|
5667
|
+
input: actorInput ? uint8ArrayToBase64(
|
|
5668
|
+
encodeCborCompat(actorInput)
|
|
5669
|
+
) : void 0,
|
|
5670
|
+
crash_policy: crashPolicy ?? "sleep"
|
|
5671
|
+
});
|
|
5672
|
+
logger2().info({
|
|
5673
|
+
msg: "getOrCreateWithKey: actor ready",
|
|
5674
|
+
actorId: actor.actor_id,
|
|
5675
|
+
name,
|
|
5676
|
+
key,
|
|
5677
|
+
created
|
|
5678
|
+
});
|
|
5679
|
+
return apiActorToOutput(actor);
|
|
5680
|
+
} catch (error) {
|
|
5681
|
+
if (error instanceof RivetError && error.group === "actor" && error.code === "key_reserved_in_different_datacenter") {
|
|
5682
|
+
logger2().warn({
|
|
5683
|
+
msg: "getOrCreateWithKey: key reserved in different datacenter, retrying as get",
|
|
5684
|
+
name,
|
|
5685
|
+
key
|
|
5686
|
+
});
|
|
5687
|
+
const response = await getActorByKey(this.#config, name, key);
|
|
5688
|
+
const existing = response.actors[0];
|
|
5689
|
+
if (!existing) throw error;
|
|
5690
|
+
logger2().info({
|
|
5691
|
+
msg: "getOrCreateWithKey: resolved existing actor via get",
|
|
5692
|
+
actorId: existing.actor_id,
|
|
5693
|
+
name,
|
|
5694
|
+
key
|
|
5695
|
+
});
|
|
5696
|
+
return apiActorToOutput(existing);
|
|
5697
|
+
}
|
|
5698
|
+
throw error;
|
|
5699
|
+
}
|
|
5651
5700
|
}
|
|
5652
5701
|
async createActor({
|
|
5653
5702
|
name,
|
|
@@ -5866,4 +5915,4 @@ export {
|
|
|
5866
5915
|
updateRunnerConfig,
|
|
5867
5916
|
RemoteEngineControlClient
|
|
5868
5917
|
};
|
|
5869
|
-
//# sourceMappingURL=chunk-
|
|
5918
|
+
//# sourceMappingURL=chunk-YYIDQBBM.js.map
|