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,9 +1,9 @@
|
|
|
1
1
|
import type { EnvoyConfig } from "@rivetkit/rivetkit-native/wrapper";
|
|
2
2
|
import {
|
|
3
|
-
type HibernatingWebSocketMetadata,
|
|
4
3
|
type EnvoyHandle,
|
|
4
|
+
type HibernatingWebSocketMetadata,
|
|
5
5
|
openDatabaseFromEnvoy,
|
|
6
|
-
protocol,
|
|
6
|
+
type protocol,
|
|
7
7
|
startEnvoySync,
|
|
8
8
|
} from "@rivetkit/rivetkit-native/wrapper";
|
|
9
9
|
import * as cbor from "cbor-x";
|
|
@@ -11,17 +11,19 @@ import type { Context as HonoContext } from "hono";
|
|
|
11
11
|
import { streamSSE } from "hono/streaming";
|
|
12
12
|
import { WSContext, type WSContextInit } from "hono/ws";
|
|
13
13
|
import invariant from "invariant";
|
|
14
|
-
import {
|
|
14
|
+
import { CONN_STATE_MANAGER_SYMBOL } from "@/actor/conn/mod";
|
|
15
15
|
import { isStaticActorDefinition, lookupInRegistry } from "@/actor/definition";
|
|
16
|
+
import type { ActorDriver } from "@/actor/driver";
|
|
17
|
+
import { KEYS } from "@/actor/instance/keys";
|
|
18
|
+
import type { AnyActorInstance } from "@/actor/instance/mod";
|
|
16
19
|
import {
|
|
17
|
-
isStaticActorInstance,
|
|
18
20
|
type AnyStaticActorInstance,
|
|
21
|
+
isStaticActorInstance,
|
|
19
22
|
} from "@/actor/instance/mod";
|
|
20
|
-
import { KEYS } from "@/actor/instance/keys";
|
|
21
23
|
import {
|
|
22
|
-
type PreloadMap,
|
|
23
24
|
compareBytes,
|
|
24
25
|
createPreloadMap,
|
|
26
|
+
type PreloadMap,
|
|
25
27
|
} from "@/actor/instance/preload-map";
|
|
26
28
|
import { deserializeActorKey } from "@/actor/keys";
|
|
27
29
|
import type { Encoding } from "@/actor/protocol/serde";
|
|
@@ -41,6 +43,10 @@ import {
|
|
|
41
43
|
} from "@/common/actor-router-consts";
|
|
42
44
|
import { getLogger } from "@/common/log";
|
|
43
45
|
import { deconstructError } from "@/common/utils";
|
|
46
|
+
import type {
|
|
47
|
+
RivetMessageEvent,
|
|
48
|
+
UniversalWebSocket,
|
|
49
|
+
} from "@/common/websocket-interface";
|
|
44
50
|
import {
|
|
45
51
|
buildHibernatableWebSocketAckStateTestResponse,
|
|
46
52
|
type IndexedWebSocketPayload,
|
|
@@ -49,21 +55,19 @@ import {
|
|
|
49
55
|
setHibernatableWebSocketAckTestHooks,
|
|
50
56
|
unregisterRemoteHibernatableWebSocketAckHooks,
|
|
51
57
|
} from "@/common/websocket-test-hooks";
|
|
52
|
-
import type {
|
|
53
|
-
RivetMessageEvent,
|
|
54
|
-
UniversalWebSocket,
|
|
55
|
-
} from "@/common/websocket-interface";
|
|
56
|
-
import type { ActorDriver } from "@/actor/driver";
|
|
57
|
-
import type { AnyActorInstance } from "@/actor/instance/mod";
|
|
58
58
|
import {
|
|
59
|
-
|
|
59
|
+
type JsNativeDatabaseLike,
|
|
60
|
+
wrapJsNativeDatabase,
|
|
61
|
+
} from "@/db/native-database";
|
|
62
|
+
import {
|
|
60
63
|
type EngineControlClient,
|
|
64
|
+
getInitialActorKvState,
|
|
61
65
|
} from "@/driver-helpers/mod";
|
|
62
66
|
import { DynamicActorInstance } from "@/dynamic/instance";
|
|
63
|
-
import { DynamicActorIsolateRuntime } from "@/dynamic/isolate-runtime";
|
|
64
67
|
import { isDynamicActorDefinition } from "@/dynamic/internal";
|
|
65
|
-
import {
|
|
68
|
+
import { DynamicActorIsolateRuntime } from "@/dynamic/isolate-runtime";
|
|
66
69
|
import { getEndpoint } from "@/engine-client/api-utils";
|
|
70
|
+
import { buildActorNames, type RegistryConfig } from "@/registry/config";
|
|
67
71
|
import {
|
|
68
72
|
type LongTimeoutHandle,
|
|
69
73
|
promiseWithResolvers,
|
|
@@ -71,14 +75,10 @@ import {
|
|
|
71
75
|
stringifyError,
|
|
72
76
|
VERSION,
|
|
73
77
|
} from "@/utils";
|
|
74
|
-
import {
|
|
75
|
-
wrapJsNativeDatabase,
|
|
76
|
-
type JsNativeDatabaseLike,
|
|
77
|
-
} from "@/db/native-database";
|
|
78
78
|
import { logger } from "./log";
|
|
79
79
|
|
|
80
80
|
const ENVOY_SSE_PING_INTERVAL = 1000;
|
|
81
|
-
const
|
|
81
|
+
const FALLBACK_ENVOY_STOP_WAIT_MS = 15_000;
|
|
82
82
|
const INITIAL_SLEEP_TIMEOUT_MS = 250;
|
|
83
83
|
const REMOTE_ACK_HOOK_QUERY_PARAM = "__rivetkitAckHook";
|
|
84
84
|
|
|
@@ -88,13 +88,13 @@ const REMOTE_ACK_HOOK_QUERY_PARAM = "__rivetkitAckHook";
|
|
|
88
88
|
//
|
|
89
89
|
// See engine/packages/pegboard-gateway/src/shared_state.rs
|
|
90
90
|
// (HWS_MESSAGE_ACK_TIMEOUT)
|
|
91
|
-
const
|
|
91
|
+
const _CONN_MESSAGE_ACK_DEADLINE = 5_000;
|
|
92
92
|
|
|
93
93
|
// Force saveState when cumulative message size reaches this threshold (0.5 MB)
|
|
94
94
|
//
|
|
95
95
|
// See engine/packages/pegboard-gateway/src/shared_state.rs
|
|
96
96
|
// (HWS_MAX_PENDING_MSGS_SIZE_PER_REQ)
|
|
97
|
-
const
|
|
97
|
+
const _CONN_BUFFERED_MESSAGE_SIZE_THRESHOLD = 500_000;
|
|
98
98
|
|
|
99
99
|
interface ActorHandler {
|
|
100
100
|
actor?: AnyActorInstance;
|
|
@@ -144,7 +144,6 @@ export type DriverContext = {};
|
|
|
144
144
|
|
|
145
145
|
export class EngineActorDriver implements ActorDriver {
|
|
146
146
|
#config: RegistryConfig;
|
|
147
|
-
#engineClient: EngineControlClient;
|
|
148
147
|
#inlineClient: Client<any>;
|
|
149
148
|
#envoy: EnvoyHandle;
|
|
150
149
|
#actors: Map<string, ActorHandler> = new Map();
|
|
@@ -161,15 +160,6 @@ export class EngineActorDriver implements ActorDriver {
|
|
|
161
160
|
string,
|
|
162
161
|
HibernatableRunnerWebSocketBinding
|
|
163
162
|
>();
|
|
164
|
-
#hwsMessageIndex = new Map<
|
|
165
|
-
string,
|
|
166
|
-
{
|
|
167
|
-
serverMessageIndex: number;
|
|
168
|
-
bufferedMessageSize: number;
|
|
169
|
-
pendingAckFromMessageIndex: boolean;
|
|
170
|
-
pendingAckFromBufferSize: boolean;
|
|
171
|
-
}
|
|
172
|
-
>();
|
|
173
163
|
#actorRouter: ActorRouter;
|
|
174
164
|
|
|
175
165
|
#envoyStarted: PromiseWithResolvers<void> = promiseWithResolvers((reason) =>
|
|
@@ -284,7 +274,7 @@ export class EngineActorDriver implements ActorDriver {
|
|
|
284
274
|
logger().debug({
|
|
285
275
|
msg: "actor crash cleanup errored",
|
|
286
276
|
actorId,
|
|
287
|
-
|
|
277
|
+
error: stringifyError(err),
|
|
288
278
|
});
|
|
289
279
|
}
|
|
290
280
|
}
|
|
@@ -376,8 +366,7 @@ export class EngineActorDriver implements ActorDriver {
|
|
|
376
366
|
requestId: ArrayBuffer,
|
|
377
367
|
): void {
|
|
378
368
|
const key = this.#hibernatableWebSocketAckKey(gatewayId, requestId);
|
|
379
|
-
const binding =
|
|
380
|
-
this.#hibernatableRunnerWebSocketBindings.get(key);
|
|
369
|
+
const binding = this.#hibernatableRunnerWebSocketBindings.get(key);
|
|
381
370
|
if (!binding) {
|
|
382
371
|
return;
|
|
383
372
|
}
|
|
@@ -397,8 +386,7 @@ export class EngineActorDriver implements ActorDriver {
|
|
|
397
386
|
requestId: ArrayBuffer,
|
|
398
387
|
): void {
|
|
399
388
|
const key = this.#hibernatableWebSocketAckKey(gatewayId, requestId);
|
|
400
|
-
const binding =
|
|
401
|
-
this.#hibernatableRunnerWebSocketBindings.get(key);
|
|
389
|
+
const binding = this.#hibernatableRunnerWebSocketBindings.get(key);
|
|
402
390
|
binding?.detach?.();
|
|
403
391
|
this.#hibernatableRunnerWebSocketBindings.delete(key);
|
|
404
392
|
}
|
|
@@ -585,7 +573,7 @@ export class EngineActorDriver implements ActorDriver {
|
|
|
585
573
|
return handler;
|
|
586
574
|
}
|
|
587
575
|
|
|
588
|
-
getContext(
|
|
576
|
+
getContext(_actorId: string): DriverContext {
|
|
589
577
|
return {};
|
|
590
578
|
}
|
|
591
579
|
|
|
@@ -847,6 +835,7 @@ export class EngineActorDriver implements ActorDriver {
|
|
|
847
835
|
return;
|
|
848
836
|
}
|
|
849
837
|
this.#isShuttingDown = true;
|
|
838
|
+
const envoyStopWaitMs = this.#envoyStopWaitMs();
|
|
850
839
|
|
|
851
840
|
logger().info({ msg: "stopping engine actor driver", immediate });
|
|
852
841
|
if (!immediate) {
|
|
@@ -861,7 +850,7 @@ export class EngineActorDriver implements ActorDriver {
|
|
|
861
850
|
this.startSleep(actorId);
|
|
862
851
|
}
|
|
863
852
|
|
|
864
|
-
const actorSleepDeadline = Date.now() +
|
|
853
|
+
const actorSleepDeadline = Date.now() + envoyStopWaitMs;
|
|
865
854
|
while (this.#actors.size > 0 && Date.now() < actorSleepDeadline) {
|
|
866
855
|
await new Promise((resolve) => setTimeout(resolve, 50));
|
|
867
856
|
}
|
|
@@ -870,7 +859,7 @@ export class EngineActorDriver implements ActorDriver {
|
|
|
870
859
|
logger().warn({
|
|
871
860
|
msg: "timed out waiting for actors to stop before envoy drain",
|
|
872
861
|
remainingActors: this.#actors.size,
|
|
873
|
-
waitMs:
|
|
862
|
+
waitMs: envoyStopWaitMs,
|
|
874
863
|
});
|
|
875
864
|
// Snapshot so concurrent removals from `stopActor` do not
|
|
876
865
|
// invalidate the iterator.
|
|
@@ -912,13 +901,13 @@ export class EngineActorDriver implements ActorDriver {
|
|
|
912
901
|
const stopped = await Promise.race([
|
|
913
902
|
this.#envoyStopped.promise.then(() => true),
|
|
914
903
|
new Promise<false>((resolve) =>
|
|
915
|
-
setTimeout(() => resolve(false),
|
|
904
|
+
setTimeout(() => resolve(false), envoyStopWaitMs),
|
|
916
905
|
),
|
|
917
906
|
]);
|
|
918
907
|
if (!stopped) {
|
|
919
908
|
logger().warn({
|
|
920
909
|
msg: "timed out waiting for envoy shutdown",
|
|
921
|
-
waitMs:
|
|
910
|
+
waitMs: envoyStopWaitMs,
|
|
922
911
|
});
|
|
923
912
|
}
|
|
924
913
|
|
|
@@ -929,6 +918,16 @@ export class EngineActorDriver implements ActorDriver {
|
|
|
929
918
|
await this.#envoy.started();
|
|
930
919
|
}
|
|
931
920
|
|
|
921
|
+
#envoyStopWaitMs(): number {
|
|
922
|
+
const actorStopThreshold = Number(
|
|
923
|
+
this.#envoy.getProtocolMetadata()?.actorStopThreshold,
|
|
924
|
+
);
|
|
925
|
+
if (Number.isFinite(actorStopThreshold) && actorStopThreshold > 0) {
|
|
926
|
+
return actorStopThreshold;
|
|
927
|
+
}
|
|
928
|
+
return FALLBACK_ENVOY_STOP_WAIT_MS;
|
|
929
|
+
}
|
|
930
|
+
|
|
932
931
|
async #bindHibernatableConnectSocket(
|
|
933
932
|
binding: HibernatableConnectBinding,
|
|
934
933
|
isRestoringHibernatable: boolean,
|
|
@@ -1129,7 +1128,10 @@ export class EngineActorDriver implements ActorDriver {
|
|
|
1129
1128
|
actorId: binding.actorId,
|
|
1130
1129
|
error: stringifyError(error),
|
|
1131
1130
|
});
|
|
1132
|
-
binding.websocket.close(
|
|
1131
|
+
binding.websocket.close(
|
|
1132
|
+
1011,
|
|
1133
|
+
"dynamic.websocket_forward_failed",
|
|
1134
|
+
);
|
|
1133
1135
|
});
|
|
1134
1136
|
};
|
|
1135
1137
|
const onClose = (event: CloseEvent) => {
|
|
@@ -1259,7 +1261,10 @@ export class EngineActorDriver implements ActorDriver {
|
|
|
1259
1261
|
msg: "dynamic runtime websocket binding is missing after restore",
|
|
1260
1262
|
actorId: binding.actorId,
|
|
1261
1263
|
});
|
|
1262
|
-
binding.websocket.close(
|
|
1264
|
+
binding.websocket.close(
|
|
1265
|
+
1011,
|
|
1266
|
+
"dynamic.websocket_forward_failed",
|
|
1267
|
+
);
|
|
1263
1268
|
return;
|
|
1264
1269
|
}
|
|
1265
1270
|
|
|
@@ -1275,7 +1280,10 @@ export class EngineActorDriver implements ActorDriver {
|
|
|
1275
1280
|
actorId: binding.actorId,
|
|
1276
1281
|
error: stringifyError(error),
|
|
1277
1282
|
});
|
|
1278
|
-
binding.websocket.close(
|
|
1283
|
+
binding.websocket.close(
|
|
1284
|
+
1011,
|
|
1285
|
+
"dynamic.websocket_forward_failed",
|
|
1286
|
+
);
|
|
1279
1287
|
});
|
|
1280
1288
|
};
|
|
1281
1289
|
const onClose = (event: CloseEvent) => {
|
|
@@ -1346,7 +1354,7 @@ export class EngineActorDriver implements ActorDriver {
|
|
|
1346
1354
|
logger().warn({
|
|
1347
1355
|
msg: "failed to rebind dynamic hibernatable runner websocket",
|
|
1348
1356
|
actorId,
|
|
1349
|
-
|
|
1357
|
+
error: stringifyError(result.reason),
|
|
1350
1358
|
});
|
|
1351
1359
|
}
|
|
1352
1360
|
}
|
|
@@ -1369,7 +1377,7 @@ export class EngineActorDriver implements ActorDriver {
|
|
|
1369
1377
|
logger().warn({
|
|
1370
1378
|
msg: "failed to rebind hibernatable connect socket",
|
|
1371
1379
|
actorId,
|
|
1372
|
-
|
|
1380
|
+
error: stringifyError(result.reason),
|
|
1373
1381
|
});
|
|
1374
1382
|
}
|
|
1375
1383
|
}
|
|
@@ -1629,7 +1637,7 @@ export class EngineActorDriver implements ActorDriver {
|
|
|
1629
1637
|
logger().warn({
|
|
1630
1638
|
msg: "failed to restore dynamic hibernating requests after actor start",
|
|
1631
1639
|
actorId,
|
|
1632
|
-
|
|
1640
|
+
error: stringifyError(error),
|
|
1633
1641
|
});
|
|
1634
1642
|
}
|
|
1635
1643
|
} else if (isStaticActorDefinition(definition)) {
|
|
@@ -1696,7 +1704,7 @@ export class EngineActorDriver implements ActorDriver {
|
|
|
1696
1704
|
logger().debug({
|
|
1697
1705
|
msg: "failed to dispose dynamic runtime after actor start failure",
|
|
1698
1706
|
actorId,
|
|
1699
|
-
|
|
1707
|
+
error: stringifyError(disposeError),
|
|
1700
1708
|
});
|
|
1701
1709
|
}
|
|
1702
1710
|
this.#dynamicRuntimes.delete(actorId);
|
|
@@ -1719,7 +1727,7 @@ export class EngineActorDriver implements ActorDriver {
|
|
|
1719
1727
|
actorId,
|
|
1720
1728
|
name,
|
|
1721
1729
|
key,
|
|
1722
|
-
|
|
1730
|
+
error: stringifyError(error),
|
|
1723
1731
|
});
|
|
1724
1732
|
|
|
1725
1733
|
try {
|
|
@@ -1728,7 +1736,7 @@ export class EngineActorDriver implements ActorDriver {
|
|
|
1728
1736
|
logger().debug({
|
|
1729
1737
|
msg: "failed to stop actor after start failure",
|
|
1730
1738
|
actorId,
|
|
1731
|
-
|
|
1739
|
+
error: stringifyError(stopError),
|
|
1732
1740
|
});
|
|
1733
1741
|
}
|
|
1734
1742
|
}
|
|
@@ -1775,7 +1783,7 @@ export class EngineActorDriver implements ActorDriver {
|
|
|
1775
1783
|
logger().debug({
|
|
1776
1784
|
msg: "actor start failed during stop, cleaning up handler",
|
|
1777
1785
|
actorId,
|
|
1778
|
-
|
|
1786
|
+
error: stringifyError(err),
|
|
1779
1787
|
});
|
|
1780
1788
|
}
|
|
1781
1789
|
}
|
|
@@ -1793,7 +1801,7 @@ export class EngineActorDriver implements ActorDriver {
|
|
|
1793
1801
|
} catch (err) {
|
|
1794
1802
|
logger().error({
|
|
1795
1803
|
msg: "error in onStop, proceeding with removing actor",
|
|
1796
|
-
|
|
1804
|
+
error: stringifyError(err),
|
|
1797
1805
|
});
|
|
1798
1806
|
}
|
|
1799
1807
|
}
|
|
@@ -1978,8 +1986,11 @@ export class EngineActorDriver implements ActorDriver {
|
|
|
1978
1986
|
isHibernatable,
|
|
1979
1987
|
isRestoringHibernatable,
|
|
1980
1988
|
);
|
|
1981
|
-
} catch (
|
|
1982
|
-
logger().error({
|
|
1989
|
+
} catch (error) {
|
|
1990
|
+
logger().error({
|
|
1991
|
+
msg: "building websocket handlers errored",
|
|
1992
|
+
error,
|
|
1993
|
+
});
|
|
1983
1994
|
websocketRaw.close(1011, "ws.route_error");
|
|
1984
1995
|
return;
|
|
1985
1996
|
}
|
|
@@ -1994,7 +2005,7 @@ export class EngineActorDriver implements ActorDriver {
|
|
|
1994
2005
|
// Get connection and actor from wsHandler (may be undefined for inspector endpoint)
|
|
1995
2006
|
const conn = wsHandler.conn;
|
|
1996
2007
|
const actor = wsHandler.actor;
|
|
1997
|
-
const
|
|
2008
|
+
const _connStateManager = conn?.[CONN_STATE_MANAGER_SYMBOL];
|
|
1998
2009
|
|
|
1999
2010
|
// Bind event listeners to Hono WebSocket handlers
|
|
2000
2011
|
//
|
|
@@ -2033,16 +2044,15 @@ export class EngineActorDriver implements ActorDriver {
|
|
|
2033
2044
|
|
|
2034
2045
|
const currentActor = this.#actors.get(actorId)?.actor;
|
|
2035
2046
|
const actorForDispatch =
|
|
2036
|
-
currentActor &&
|
|
2037
|
-
isStaticActorInstance(currentActor)
|
|
2047
|
+
currentActor && isStaticActorInstance(currentActor)
|
|
2038
2048
|
? currentActor
|
|
2039
2049
|
: actor;
|
|
2040
2050
|
const connForDispatch =
|
|
2041
2051
|
isHibernatable && actorForDispatch
|
|
2042
|
-
? actorForDispatch.connectionManager.findHibernatableConn(
|
|
2052
|
+
? (actorForDispatch.connectionManager.findHibernatableConn(
|
|
2043
2053
|
gatewayIdBuf,
|
|
2044
2054
|
requestIdBuf,
|
|
2045
|
-
) ?? conn
|
|
2055
|
+
) ?? conn)
|
|
2046
2056
|
: conn;
|
|
2047
2057
|
|
|
2048
2058
|
if (actorForDispatch?.isStopping) {
|
|
@@ -2052,7 +2062,10 @@ export class EngineActorDriver implements ActorDriver {
|
|
|
2052
2062
|
actorId: actorForDispatch?.id,
|
|
2053
2063
|
messageIndex: event.rivetMessageIndex,
|
|
2054
2064
|
});
|
|
2055
|
-
if (
|
|
2065
|
+
if (
|
|
2066
|
+
!isRawWebSocketPath &&
|
|
2067
|
+
websocket.readyState !== websocket.CLOSED
|
|
2068
|
+
) {
|
|
2056
2069
|
websocket.close(1011, "actor.stopping");
|
|
2057
2070
|
}
|
|
2058
2071
|
return;
|
|
@@ -2190,12 +2203,7 @@ export class EngineActorDriver implements ActorDriver {
|
|
|
2190
2203
|
isRestoringHibernatable,
|
|
2191
2204
|
);
|
|
2192
2205
|
} catch (error) {
|
|
2193
|
-
const { group, code } = deconstructError(
|
|
2194
|
-
error,
|
|
2195
|
-
logger(),
|
|
2196
|
-
{},
|
|
2197
|
-
false,
|
|
2198
|
-
);
|
|
2206
|
+
const { group, code } = deconstructError(error, false);
|
|
2199
2207
|
logger().error({
|
|
2200
2208
|
msg: "failed to bind dynamic hibernatable websocket",
|
|
2201
2209
|
actorId,
|
|
@@ -2233,12 +2241,7 @@ export class EngineActorDriver implements ActorDriver {
|
|
|
2233
2241
|
},
|
|
2234
2242
|
);
|
|
2235
2243
|
} catch (error) {
|
|
2236
|
-
const { group, code } = deconstructError(
|
|
2237
|
-
error,
|
|
2238
|
-
logger(),
|
|
2239
|
-
{},
|
|
2240
|
-
false,
|
|
2241
|
-
);
|
|
2244
|
+
const { group, code } = deconstructError(error, false);
|
|
2242
2245
|
logger().error({
|
|
2243
2246
|
msg: "failed to open dynamic websocket",
|
|
2244
2247
|
actorId,
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { DynamicActorIsolateRuntime } from "./isolate-runtime";
|
|
2
|
+
|
|
3
|
+
export class DynamicActorInstance {
|
|
4
|
+
constructor(
|
|
5
|
+
public readonly id: string,
|
|
6
|
+
private readonly runtime: DynamicActorIsolateRuntime,
|
|
7
|
+
) {}
|
|
8
|
+
|
|
9
|
+
get isStopping(): boolean {
|
|
10
|
+
return this.runtime.isStopping;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
async onStop(mode: "sleep" | "destroy"): Promise<void> {
|
|
14
|
+
await this.runtime.stop(mode);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
async onAlarm(): Promise<void> {
|
|
18
|
+
await this.runtime.onAlarm();
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
async cleanupPersistedConnections(reason?: string): Promise<number> {
|
|
22
|
+
return await this.runtime.cleanupPersistedConnections(reason);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
async getHibernatingWebSockets() {
|
|
26
|
+
return await this.runtime.getHibernatingWebSockets();
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
getHibernatingWebSocketMetadata() {
|
|
30
|
+
return this.runtime.getHibernatingWebSocketMetadata();
|
|
31
|
+
}
|
|
32
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
AnyActorDefinition,
|
|
3
|
+
BaseActorDefinition,
|
|
4
|
+
} from "@/actor/definition";
|
|
5
|
+
|
|
6
|
+
export const DYNAMIC_ACTOR_DEFINITION_SYMBOL = Symbol.for(
|
|
7
|
+
"rivetkit.dynamic_actor_definition",
|
|
8
|
+
);
|
|
9
|
+
|
|
10
|
+
export interface DynamicActorSource {
|
|
11
|
+
source: string;
|
|
12
|
+
nodeProcess?: {
|
|
13
|
+
memoryLimit?: number;
|
|
14
|
+
cpuTimeLimitMs?: number;
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export interface DynamicActorLoadContext {
|
|
19
|
+
key: string[];
|
|
20
|
+
client(): Promise<any>;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export type DynamicActorLoader = (
|
|
24
|
+
c: DynamicActorLoadContext,
|
|
25
|
+
) => DynamicActorSource | Promise<DynamicActorSource>;
|
|
26
|
+
|
|
27
|
+
export interface DynamicActorDefinition extends AnyActorDefinition {
|
|
28
|
+
readonly [DYNAMIC_ACTOR_DEFINITION_SYMBOL]: true;
|
|
29
|
+
readonly loader: DynamicActorLoader;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export function isDynamicActorDefinition(
|
|
33
|
+
definition: BaseActorDefinition<
|
|
34
|
+
any,
|
|
35
|
+
any,
|
|
36
|
+
any,
|
|
37
|
+
any,
|
|
38
|
+
any,
|
|
39
|
+
any,
|
|
40
|
+
any,
|
|
41
|
+
any,
|
|
42
|
+
any
|
|
43
|
+
>,
|
|
44
|
+
): definition is DynamicActorDefinition {
|
|
45
|
+
return (
|
|
46
|
+
(definition as Partial<DynamicActorDefinition>)[
|
|
47
|
+
DYNAMIC_ACTOR_DEFINITION_SYMBOL
|
|
48
|
+
] === true
|
|
49
|
+
);
|
|
50
|
+
}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import type { ActorDriver } from "@/actor/driver";
|
|
2
|
+
import type { Client } from "@/client/client";
|
|
3
|
+
import type { RegistryConfig } from "@/registry/config";
|
|
4
|
+
import type { DynamicActorLoader } from "./internal";
|
|
5
|
+
|
|
6
|
+
export interface DynamicActorIsolateRuntimeConfig {
|
|
7
|
+
actorId: string;
|
|
8
|
+
actorName: string;
|
|
9
|
+
actorKey: string[];
|
|
10
|
+
input: unknown;
|
|
11
|
+
region: string;
|
|
12
|
+
loader: DynamicActorLoader;
|
|
13
|
+
actorDriver: ActorDriver;
|
|
14
|
+
inlineClient: Client<any>;
|
|
15
|
+
test: RegistryConfig["test"];
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export interface DynamicHibernatingWebSocketMetadata {
|
|
19
|
+
gatewayId: ArrayBuffer;
|
|
20
|
+
requestId: ArrayBuffer;
|
|
21
|
+
serverMessageIndex: number;
|
|
22
|
+
clientMessageIndex: number;
|
|
23
|
+
path: string;
|
|
24
|
+
headers: Record<string, string>;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export class DynamicActorIsolateRuntime {
|
|
28
|
+
#isStopping = false;
|
|
29
|
+
|
|
30
|
+
constructor(private readonly config: DynamicActorIsolateRuntimeConfig) {}
|
|
31
|
+
|
|
32
|
+
get isStopping(): boolean {
|
|
33
|
+
return this.#isStopping;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
async start(): Promise<void> {
|
|
37
|
+
await this.config.loader({
|
|
38
|
+
key: this.config.actorKey,
|
|
39
|
+
client: async () => this.config.inlineClient,
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
async stop(_mode: "sleep" | "destroy"): Promise<void> {
|
|
44
|
+
this.#isStopping = true;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
async dispose(): Promise<void> {
|
|
48
|
+
this.#isStopping = true;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
async onAlarm(): Promise<void> {}
|
|
52
|
+
|
|
53
|
+
async cleanupPersistedConnections(_reason?: string): Promise<number> {
|
|
54
|
+
return 0;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
async getHibernatingWebSockets(): Promise<
|
|
58
|
+
DynamicHibernatingWebSocketMetadata[]
|
|
59
|
+
> {
|
|
60
|
+
return [];
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
getHibernatingWebSocketMetadata(): DynamicHibernatingWebSocketMetadata[] {
|
|
64
|
+
return [];
|
|
65
|
+
}
|
|
66
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { ActorConfigSchema } from "@/actor/config";
|
|
2
|
+
import type { AnyActorDefinition } from "@/actor/definition";
|
|
3
|
+
import {
|
|
4
|
+
DYNAMIC_ACTOR_DEFINITION_SYMBOL,
|
|
5
|
+
type DynamicActorDefinition,
|
|
6
|
+
type DynamicActorLoader,
|
|
7
|
+
} from "./internal";
|
|
8
|
+
|
|
9
|
+
export interface DynamicActorConfig {
|
|
10
|
+
load: DynamicActorLoader;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export function dynamicActor(
|
|
14
|
+
input: DynamicActorConfig,
|
|
15
|
+
): DynamicActorDefinition {
|
|
16
|
+
const config = ActorConfigSchema.parse({
|
|
17
|
+
actions: {},
|
|
18
|
+
}) as unknown as AnyActorDefinition["config"];
|
|
19
|
+
|
|
20
|
+
return {
|
|
21
|
+
[DYNAMIC_ACTOR_DEFINITION_SYMBOL]: true,
|
|
22
|
+
config,
|
|
23
|
+
loader: input.load,
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export type {
|
|
28
|
+
DynamicActorDefinition,
|
|
29
|
+
DynamicActorLoadContext,
|
|
30
|
+
DynamicActorLoader,
|
|
31
|
+
DynamicActorSource,
|
|
32
|
+
} from "./internal";
|
|
@@ -1,14 +1,11 @@
|
|
|
1
1
|
import type { ClientConfig } from "@/client/config";
|
|
2
2
|
import {
|
|
3
3
|
HEADER_RIVET_ACTOR,
|
|
4
|
-
|
|
4
|
+
HEADER_RIVET_SKIP_READY_WAIT,
|
|
5
5
|
HEADER_RIVET_TARGET,
|
|
6
6
|
HEADER_RIVET_TOKEN,
|
|
7
7
|
} from "@/common/actor-router-consts";
|
|
8
|
-
import {
|
|
9
|
-
shouldBypassConnectable,
|
|
10
|
-
type GatewayRequestOptions,
|
|
11
|
-
} from "./driver";
|
|
8
|
+
import { type GatewayRequestOptions, shouldSkipReadyWait } from "./driver";
|
|
12
9
|
|
|
13
10
|
export interface HttpGatewayRequestOptions extends GatewayRequestOptions {
|
|
14
11
|
directActorId?: string;
|
|
@@ -37,9 +34,9 @@ export async function sendHttpRequestToGateway(
|
|
|
37
34
|
bodyToSend = reqBody;
|
|
38
35
|
|
|
39
36
|
// If this is a streaming request, we need to convert the headers
|
|
40
|
-
// for the basic array buffer
|
|
37
|
+
// for the basic array buffer.
|
|
41
38
|
guardHeaders.delete("transfer-encoding");
|
|
42
|
-
guardHeaders.
|
|
39
|
+
guardHeaders.delete("content-length");
|
|
43
40
|
}
|
|
44
41
|
}
|
|
45
42
|
|
|
@@ -82,8 +79,8 @@ function buildGuardHeaders(
|
|
|
82
79
|
headers.set(HEADER_RIVET_TARGET, "actor");
|
|
83
80
|
headers.set(HEADER_RIVET_ACTOR, options.directActorId);
|
|
84
81
|
}
|
|
85
|
-
if (
|
|
86
|
-
headers.set(
|
|
82
|
+
if (shouldSkipReadyWait(options)) {
|
|
83
|
+
headers.set(HEADER_RIVET_SKIP_READY_WAIT, "1");
|
|
87
84
|
}
|
|
88
85
|
return headers;
|
|
89
86
|
}
|