rivetkit 2.0.42 → 2.1.0-rc.1
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/{tsup/config-CLnylLYY.d.ts → browser/client.d.ts} +2127 -1910
- package/dist/browser/client.js +5182 -0
- package/dist/browser/client.js.map +1 -0
- package/dist/browser/inspector/client.d.ts +130 -0
- package/dist/browser/inspector/client.js +2854 -0
- package/dist/browser/inspector/client.js.map +1 -0
- package/dist/browser/v3-DnYObHH3.d.ts +279 -0
- package/dist/schemas/actor-inspector/v2.ts +796 -0
- package/dist/schemas/actor-inspector/v3.ts +899 -0
- package/dist/schemas/actor-persist/v4.ts +406 -0
- package/dist/schemas/client-protocol/v3.ts +554 -0
- package/dist/schemas/persist/v1.ts +781 -0
- package/dist/schemas/transport/v1.ts +697 -0
- package/dist/tsup/actor/errors.cjs +27 -3
- package/dist/tsup/actor/errors.cjs.map +1 -1
- package/dist/tsup/actor/errors.d.cts +37 -1
- package/dist/tsup/actor/errors.d.ts +37 -1
- package/dist/tsup/actor/errors.js +26 -1
- package/dist/tsup/{actor-router-consts-DzI2szci.d.cts → actor-router-consts-D29T1Z-K.d.cts} +1 -1
- package/dist/tsup/{actor-router-consts-DzI2szci.d.ts → actor-router-consts-D29T1Z-K.d.ts} +1 -1
- package/dist/tsup/chunk-424PT5DM.js +23 -0
- package/dist/tsup/chunk-424PT5DM.js.map +1 -0
- package/dist/tsup/{chunk-JDAD2YFA.js → chunk-5ESWDTHJ.js} +148 -273
- package/dist/tsup/chunk-5ESWDTHJ.js.map +1 -0
- package/dist/tsup/{chunk-FJ3KTN4V.js → chunk-6LIBPELE.js} +119 -11
- package/dist/tsup/chunk-6LIBPELE.js.map +1 -0
- package/dist/tsup/chunk-6LJAZ5R4.cjs +96 -0
- package/dist/tsup/chunk-6LJAZ5R4.cjs.map +1 -0
- package/dist/tsup/{chunk-LFVF5SCU.js → chunk-7HTNH26M.js} +126 -1
- package/dist/tsup/chunk-7HTNH26M.js.map +1 -0
- package/dist/tsup/chunk-7K4CYDGD.js +630 -0
- package/dist/tsup/chunk-7K4CYDGD.js.map +1 -0
- package/dist/tsup/{chunk-XXGJCOL6.js → chunk-A6YIZWTK.js} +2 -2
- package/dist/tsup/chunk-AIYEYMX5.cjs +630 -0
- package/dist/tsup/chunk-AIYEYMX5.cjs.map +1 -0
- package/dist/tsup/{chunk-Q6W7RJJP.js → chunk-DIGBC2VI.js} +211 -2316
- package/dist/tsup/chunk-DIGBC2VI.js.map +1 -0
- package/dist/tsup/{chunk-RZW2DNND.cjs → chunk-F6JYU5IK.cjs} +1957 -1039
- package/dist/tsup/chunk-F6JYU5IK.cjs.map +1 -0
- package/dist/tsup/chunk-HAZL2EPK.cjs +534 -0
- package/dist/tsup/chunk-HAZL2EPK.cjs.map +1 -0
- package/dist/tsup/chunk-HDQ2JUQT.cjs +23 -0
- package/dist/tsup/chunk-HDQ2JUQT.cjs.map +1 -0
- package/dist/tsup/chunk-HIDX4C5Y.cjs +1036 -0
- package/dist/tsup/chunk-HIDX4C5Y.cjs.map +1 -0
- package/dist/tsup/chunk-IVG73YCW.js +534 -0
- package/dist/tsup/chunk-IVG73YCW.js.map +1 -0
- package/dist/tsup/chunk-KJSYAUOM.js +96 -0
- package/dist/tsup/chunk-KJSYAUOM.js.map +1 -0
- package/dist/tsup/{chunk-2XQS746M.cjs → chunk-L47L3ZWJ.cjs} +127 -2
- package/dist/tsup/chunk-L47L3ZWJ.cjs.map +1 -0
- package/dist/tsup/{chunk-H4TB4X25.cjs → chunk-LW6KLR7A.cjs} +126 -18
- package/dist/tsup/chunk-LW6KLR7A.cjs.map +1 -0
- package/dist/tsup/chunk-LXUQ667X.js +2006 -0
- package/dist/tsup/chunk-LXUQ667X.js.map +1 -0
- package/dist/tsup/{chunk-GMAVRZSF.js → chunk-M2T62AZQ.js} +1790 -872
- package/dist/tsup/chunk-M2T62AZQ.js.map +1 -0
- package/dist/tsup/chunk-MZ37VV3P.js +5974 -0
- package/dist/tsup/chunk-MZ37VV3P.js.map +1 -0
- package/dist/tsup/chunk-N4KRDJ56.js +72 -0
- package/dist/tsup/chunk-N4KRDJ56.js.map +1 -0
- package/dist/tsup/chunk-NIYZDWMW.cjs +2006 -0
- package/dist/tsup/chunk-NIYZDWMW.cjs.map +1 -0
- package/dist/tsup/chunk-OMEPCQK2.js +649 -0
- package/dist/tsup/chunk-OMEPCQK2.js.map +1 -0
- package/dist/tsup/chunk-SR3KQE7Q.cjs +72 -0
- package/dist/tsup/chunk-SR3KQE7Q.cjs.map +1 -0
- package/dist/tsup/chunk-SSEP6DHP.cjs +2657 -0
- package/dist/tsup/chunk-SSEP6DHP.cjs.map +1 -0
- package/dist/tsup/chunk-T5YCUGVS.js +1036 -0
- package/dist/tsup/chunk-T5YCUGVS.js.map +1 -0
- package/dist/tsup/{chunk-EJVBH5VF.cjs → chunk-TPGXWFQT.cjs} +3 -3
- package/dist/tsup/{chunk-EJVBH5VF.cjs.map → chunk-TPGXWFQT.cjs.map} +1 -1
- package/dist/tsup/{chunk-X35U3YNX.cjs → chunk-TYLXNCA5.cjs} +214 -339
- package/dist/tsup/chunk-TYLXNCA5.cjs.map +1 -0
- package/dist/tsup/chunk-VKVNIQRQ.js +257 -0
- package/dist/tsup/chunk-VKVNIQRQ.js.map +1 -0
- package/dist/tsup/chunk-XWBAQO5H.cjs +649 -0
- package/dist/tsup/chunk-XWBAQO5H.cjs.map +1 -0
- package/dist/tsup/chunk-YQ4LDVD6.cjs +5974 -0
- package/dist/tsup/chunk-YQ4LDVD6.cjs.map +1 -0
- package/dist/tsup/chunk-ZFY5J2EP.cjs +257 -0
- package/dist/tsup/chunk-ZFY5J2EP.cjs.map +1 -0
- package/dist/tsup/client/mod.cjs +9 -10
- package/dist/tsup/client/mod.cjs.map +1 -1
- package/dist/tsup/client/mod.d.cts +11 -5
- package/dist/tsup/client/mod.d.ts +11 -5
- package/dist/tsup/client/mod.js +8 -8
- package/dist/tsup/common/log.cjs +4 -4
- package/dist/tsup/common/log.d.cts +2 -2
- package/dist/tsup/common/log.d.ts +2 -2
- package/dist/tsup/common/log.js +3 -2
- package/dist/tsup/common/websocket.cjs +5 -5
- package/dist/tsup/common/websocket.js +4 -3
- package/dist/tsup/config-BFqid9Gr.d.ts +2574 -0
- package/dist/tsup/config-BiNoIHRs.d.cts +80 -0
- package/dist/tsup/config-BiNoIHRs.d.ts +80 -0
- package/dist/tsup/{config-CZB2-W8x.d.cts → config-CAZphOS1.d.cts} +681 -355
- package/dist/tsup/db/drizzle/mod.cjs +49 -0
- package/dist/tsup/db/drizzle/mod.cjs.map +1 -0
- package/dist/tsup/db/drizzle/mod.d.cts +17 -0
- package/dist/tsup/db/drizzle/mod.d.ts +17 -0
- package/dist/tsup/db/drizzle/mod.js +49 -0
- package/dist/tsup/db/drizzle/mod.js.map +1 -0
- package/dist/tsup/db/mod.cjs +9 -0
- package/dist/tsup/db/mod.cjs.map +1 -0
- package/dist/tsup/db/mod.d.cts +9 -0
- package/dist/tsup/db/mod.d.ts +9 -0
- package/dist/tsup/db/mod.js +9 -0
- package/dist/tsup/db/mod.js.map +1 -0
- package/dist/tsup/{driver-D0QX9M11.d.ts → driver-Bxv62E2p.d.ts} +2 -2
- package/dist/tsup/{driver-q-zqG7fc.d.cts → driver-DYXwJR5D.d.cts} +2 -2
- package/dist/tsup/driver-helpers/mod.cjs +12 -6
- package/dist/tsup/driver-helpers/mod.cjs.map +1 -1
- package/dist/tsup/driver-helpers/mod.d.cts +12 -5
- package/dist/tsup/driver-helpers/mod.d.ts +12 -5
- package/dist/tsup/driver-helpers/mod.js +12 -5
- package/dist/tsup/driver-test-suite/mod.cjs +1370 -116
- package/dist/tsup/driver-test-suite/mod.cjs.map +1 -1
- package/dist/tsup/driver-test-suite/mod.d.cts +10 -4
- package/dist/tsup/driver-test-suite/mod.d.ts +10 -4
- package/dist/tsup/driver-test-suite/mod.js +2093 -838
- package/dist/tsup/driver-test-suite/mod.js.map +1 -1
- package/dist/tsup/inspector/mod.cjs +29 -3
- package/dist/tsup/inspector/mod.cjs.map +1 -1
- package/dist/tsup/inspector/mod.d.cts +124 -3
- package/dist/tsup/inspector/mod.d.ts +124 -3
- package/dist/tsup/inspector/mod.js +72 -45
- package/dist/tsup/keys-CydblqMh.d.cts +13 -0
- package/dist/tsup/keys-CydblqMh.d.ts +13 -0
- package/dist/tsup/mod.cjs +16 -10
- package/dist/tsup/mod.cjs.map +1 -1
- package/dist/tsup/mod.d.cts +26 -14
- package/dist/tsup/mod.d.ts +26 -14
- package/dist/tsup/mod.js +20 -13
- package/dist/tsup/serve-test-suite/mod.cjs +1165 -83
- package/dist/tsup/serve-test-suite/mod.cjs.map +1 -1
- package/dist/tsup/serve-test-suite/mod.js +1114 -29
- package/dist/tsup/serve-test-suite/mod.js.map +1 -1
- package/dist/tsup/test/mod.cjs +84 -11
- package/dist/tsup/test/mod.cjs.map +1 -1
- package/dist/tsup/test/mod.d.cts +10 -5
- package/dist/tsup/test/mod.d.ts +10 -5
- package/dist/tsup/test/mod.js +85 -11
- package/dist/tsup/test/mod.js.map +1 -1
- package/dist/tsup/utils.cjs +10 -4
- package/dist/tsup/utils.cjs.map +1 -1
- package/dist/tsup/utils.d.cts +72 -2
- package/dist/tsup/utils.d.ts +72 -2
- package/dist/tsup/utils.js +9 -2
- package/dist/tsup/v3-DnYObHH3.d.cts +279 -0
- package/dist/tsup/v3-DnYObHH3.d.ts +279 -0
- package/dist/tsup/workflow/mod.cjs +16 -0
- package/dist/tsup/workflow/mod.cjs.map +1 -0
- package/dist/tsup/workflow/mod.d.cts +83 -0
- package/dist/tsup/workflow/mod.d.ts +83 -0
- package/dist/tsup/workflow/mod.js +16 -0
- package/dist/tsup/workflow/mod.js.map +1 -0
- package/package.json +62 -5
- package/src/actor/config.ts +478 -68
- package/src/actor/conn/mod.ts +68 -16
- package/src/actor/conn/state-manager.ts +2 -2
- package/src/actor/contexts/action.ts +20 -12
- package/src/actor/contexts/base/actor.ts +137 -7
- package/src/actor/contexts/base/conn-init.ts +27 -7
- package/src/actor/contexts/base/conn.ts +27 -18
- package/src/actor/contexts/before-action-response.ts +9 -2
- package/src/actor/contexts/before-connect.ts +7 -2
- package/src/actor/contexts/connect.ts +9 -2
- package/src/actor/contexts/create-conn-state.ts +7 -2
- package/src/actor/contexts/create-vars.ts +16 -3
- package/src/actor/contexts/create.ts +16 -3
- package/src/actor/contexts/destroy.ts +9 -3
- package/src/actor/contexts/disconnect.ts +10 -4
- package/src/actor/contexts/index.ts +4 -3
- package/src/actor/contexts/request.ts +23 -6
- package/src/actor/contexts/run.ts +47 -0
- package/src/actor/contexts/sleep.ts +9 -3
- package/src/actor/contexts/state-change.ts +9 -3
- package/src/actor/contexts/wake.ts +9 -3
- package/src/actor/contexts/websocket.ts +23 -6
- package/src/actor/database.ts +8 -18
- package/src/actor/definition.ts +20 -6
- package/src/actor/driver.ts +32 -3
- package/src/actor/errors.ts +127 -0
- package/src/actor/instance/connection-manager.ts +183 -80
- package/src/actor/instance/event-manager.ts +26 -15
- package/src/actor/instance/keys.ts +117 -0
- package/src/actor/instance/mod.ts +784 -174
- package/src/actor/instance/queue-manager.ts +603 -0
- package/src/actor/instance/queue.ts +287 -0
- package/src/actor/instance/schedule-manager.ts +49 -7
- package/src/actor/instance/state-manager.ts +35 -11
- package/src/actor/instance/traces-driver.ts +128 -0
- package/src/actor/mod.ts +26 -2
- package/src/actor/protocol/old.ts +28 -13
- package/src/actor/protocol/serde.ts +1 -1
- package/src/actor/router-endpoints.ts +177 -21
- package/src/actor/router-websocket-endpoints.ts +18 -29
- package/src/actor/router.ts +177 -0
- package/src/actor/schema.ts +291 -0
- package/src/actor/utils.ts +40 -0
- package/src/client/actor-common.ts +1 -1
- package/src/client/actor-conn.ts +100 -33
- package/src/client/actor-handle.ts +61 -33
- package/src/client/client.ts +2 -4
- package/src/client/config.ts +1 -1
- package/src/client/mod.browser.ts +2 -0
- package/src/client/mod.ts +1 -4
- package/src/client/queue.ts +146 -0
- package/src/client/utils.ts +1 -1
- package/src/common/log.ts +1 -1
- package/src/common/utils.ts +3 -3
- package/src/db/config.ts +100 -0
- package/src/db/drizzle/mod.ts +226 -0
- package/src/db/drizzle/sqlite-core.ts +22 -0
- package/src/db/mod.ts +125 -0
- package/src/db/shared.ts +92 -0
- package/src/db/sqlite-vfs.ts +12 -0
- package/src/driver-helpers/mod.ts +1 -0
- package/src/driver-test-suite/mod.ts +69 -43
- package/src/driver-test-suite/tests/access-control.ts +218 -0
- package/src/driver-test-suite/tests/actor-db-raw.ts +73 -0
- package/src/driver-test-suite/tests/actor-db.ts +394 -0
- package/src/driver-test-suite/tests/actor-inspector.ts +259 -358
- package/src/driver-test-suite/tests/actor-kv.ts +41 -20
- package/src/driver-test-suite/tests/actor-queue.ts +324 -0
- package/src/driver-test-suite/tests/actor-run.ts +181 -0
- package/src/driver-test-suite/tests/actor-schedule.ts +5 -2
- package/src/driver-test-suite/tests/actor-sleep.ts +3 -3
- package/src/driver-test-suite/tests/actor-stateless.ts +70 -0
- package/src/driver-test-suite/tests/actor-workflow.ts +108 -0
- package/src/driver-test-suite/tests/manager-driver.ts +11 -0
- package/src/driver-test-suite/tests/raw-http-request-properties.ts +1 -1
- package/src/driver-test-suite/tests/raw-websocket.ts +12 -12
- package/src/drivers/default.ts +7 -2
- package/src/drivers/engine/actor-driver.ts +45 -37
- package/src/drivers/engine/config.ts +1 -1
- package/src/drivers/file-system/actor.ts +20 -2
- package/src/drivers/file-system/global-state.ts +569 -258
- package/src/drivers/file-system/kv-limits.ts +70 -0
- package/src/drivers/file-system/manager.ts +22 -6
- package/src/drivers/file-system/mod.ts +39 -16
- package/src/drivers/file-system/sqlite-runtime.ts +210 -0
- package/src/inspector/actor-inspector.ts +224 -102
- package/src/inspector/config.ts +1 -1
- package/src/inspector/handler.ts +102 -20
- package/src/inspector/mod.browser.ts +8 -0
- package/src/inspector/mod.ts +2 -0
- package/src/inspector/serve-ui.ts +40 -0
- package/src/inspector/transport.ts +18 -0
- package/src/inspector/utils.ts +5 -39
- package/src/manager/gateway.ts +1 -1
- package/src/manager/protocol/mod.ts +1 -1
- package/src/manager/protocol/query.ts +1 -1
- package/src/manager/router-schema.ts +1 -1
- package/src/manager/router.ts +38 -12
- package/src/manager-api/actors.ts +1 -1
- package/src/manager-api/common.ts +1 -1
- package/src/registry/config/driver.ts +1 -1
- package/src/registry/config/index.ts +212 -43
- package/src/registry/config/legacy-runner.ts +1 -1
- package/src/registry/config/runner.ts +1 -1
- package/src/registry/config/serverless.ts +1 -1
- package/src/registry/index.ts +7 -5
- package/src/remote-manager-driver/api-utils.ts +1 -1
- package/src/schemas/actor-inspector/mod.ts +1 -1
- package/src/schemas/actor-inspector/versioned.ts +195 -8
- package/src/schemas/actor-persist/versioned.ts +87 -7
- package/src/schemas/client-protocol/mod.ts +1 -1
- package/src/schemas/client-protocol/versioned.ts +127 -11
- package/src/schemas/client-protocol-zod/mod.ts +16 -1
- package/src/schemas/persist/mod.ts +1 -0
- package/src/schemas/transport/mod.ts +1 -0
- package/src/serde.ts +1 -1
- package/src/serve-test-suite/mod.ts +10 -9
- package/src/test/mod.ts +15 -56
- package/src/utils/endpoint-parser.test.ts +1 -1
- package/src/utils/endpoint-parser.ts +1 -1
- package/src/utils/env-vars.ts +12 -1
- package/src/utils/node.ts +15 -2
- package/src/utils.test.ts +34 -0
- package/src/utils.ts +140 -6
- package/src/workflow/constants.ts +2 -0
- package/src/workflow/context.ts +532 -0
- package/src/workflow/driver.ts +191 -0
- package/src/workflow/inspector.ts +268 -0
- package/src/workflow/mod.ts +122 -0
- package/dist/tsup/chunk-2IJTYN6K.cjs +0 -278
- package/dist/tsup/chunk-2IJTYN6K.cjs.map +0 -1
- package/dist/tsup/chunk-2XQS746M.cjs.map +0 -1
- package/dist/tsup/chunk-3VP5CSHV.cjs +0 -114
- package/dist/tsup/chunk-3VP5CSHV.cjs.map +0 -1
- package/dist/tsup/chunk-AQFSQMBG.js +0 -114
- package/dist/tsup/chunk-AQFSQMBG.js.map +0 -1
- package/dist/tsup/chunk-E6ZE2YEA.js +0 -664
- package/dist/tsup/chunk-E6ZE2YEA.js.map +0 -1
- package/dist/tsup/chunk-FJ3KTN4V.js.map +0 -1
- package/dist/tsup/chunk-GBENOENJ.cjs +0 -8
- package/dist/tsup/chunk-GBENOENJ.cjs.map +0 -1
- package/dist/tsup/chunk-GD7UXGOE.cjs +0 -4762
- package/dist/tsup/chunk-GD7UXGOE.cjs.map +0 -1
- package/dist/tsup/chunk-GMAVRZSF.js.map +0 -1
- package/dist/tsup/chunk-H4TB4X25.cjs.map +0 -1
- package/dist/tsup/chunk-JDAD2YFA.js.map +0 -1
- package/dist/tsup/chunk-KCOVZOPS.js +0 -1946
- package/dist/tsup/chunk-KCOVZOPS.js.map +0 -1
- package/dist/tsup/chunk-KDFWJKMJ.cjs +0 -664
- package/dist/tsup/chunk-KDFWJKMJ.cjs.map +0 -1
- package/dist/tsup/chunk-LFVF5SCU.js.map +0 -1
- package/dist/tsup/chunk-Q6W7RJJP.js.map +0 -1
- package/dist/tsup/chunk-RUW5CZ5Z.cjs +0 -1949
- package/dist/tsup/chunk-RUW5CZ5Z.cjs.map +0 -1
- package/dist/tsup/chunk-RZW2DNND.cjs.map +0 -1
- package/dist/tsup/chunk-TCOEBUUE.js +0 -278
- package/dist/tsup/chunk-TCOEBUUE.js.map +0 -1
- package/dist/tsup/chunk-X35U3YNX.cjs.map +0 -1
- package/dist/tsup/keys-Chhy4ylv.d.cts +0 -8
- package/dist/tsup/keys-Chhy4ylv.d.ts +0 -8
- package/dist/tsup/v1-Gq4avTK3.d.cts +0 -240
- package/dist/tsup/v1-Gq4avTK3.d.ts +0 -240
- /package/dist/tsup/{chunk-XXGJCOL6.js.map → chunk-A6YIZWTK.js.map} +0 -0
|
@@ -1,18 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
|
+
ActorDefinition,
|
|
2
3
|
createActorRouter,
|
|
3
4
|
createFileSystemOrMemoryDriver,
|
|
4
5
|
ensureDirectoryExists,
|
|
5
|
-
getNodeChildProcess,
|
|
6
|
-
getNodeCrypto,
|
|
7
|
-
getNodeFs,
|
|
8
|
-
getNodeFsSync,
|
|
9
|
-
getNodePath,
|
|
10
|
-
getNodeStream,
|
|
11
6
|
getStoragePath,
|
|
12
|
-
|
|
13
|
-
} from "./chunk-
|
|
7
|
+
lookupInRegistry
|
|
8
|
+
} from "./chunk-MZ37VV3P.js";
|
|
14
9
|
import {
|
|
15
|
-
ActorDefinition,
|
|
16
10
|
ClientConfigSchemaBase,
|
|
17
11
|
RemoteManagerDriver,
|
|
18
12
|
convertRegistryConfigToClientConfig,
|
|
@@ -20,16 +14,14 @@ import {
|
|
|
20
14
|
createClientWithDriver,
|
|
21
15
|
getDatacenters,
|
|
22
16
|
getEndpoint,
|
|
23
|
-
lookupInRegistry,
|
|
24
17
|
transformClientConfig,
|
|
25
18
|
updateRunnerConfig
|
|
26
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-DIGBC2VI.js";
|
|
27
20
|
import {
|
|
28
21
|
CONN_STATE_MANAGER_SYMBOL,
|
|
29
22
|
ENGINE_ENDPOINT,
|
|
30
23
|
ENGINE_PORT,
|
|
31
24
|
InspectorConfigSchema,
|
|
32
|
-
KEYS,
|
|
33
25
|
PATH_CONNECT,
|
|
34
26
|
PATH_INSPECTOR_CONNECT,
|
|
35
27
|
PATH_WEBSOCKET_BASE,
|
|
@@ -40,14 +32,27 @@ import {
|
|
|
40
32
|
createRouter,
|
|
41
33
|
deserializeActorKey,
|
|
42
34
|
getInitialActorKvState,
|
|
35
|
+
getNodeChildProcess,
|
|
36
|
+
getNodeCrypto,
|
|
37
|
+
getNodeFs,
|
|
38
|
+
getNodeFsSync,
|
|
39
|
+
getNodePath,
|
|
40
|
+
getNodeStream,
|
|
43
41
|
getValueLength,
|
|
44
42
|
handleHealthRequest,
|
|
45
43
|
handleMetadataRequest,
|
|
46
|
-
|
|
44
|
+
importNodeDependencies,
|
|
47
45
|
parseWebSocketProtocols,
|
|
48
46
|
routeWebSocket,
|
|
49
47
|
truncateRawWebSocketPathPrefix
|
|
50
|
-
} from "./chunk-
|
|
48
|
+
} from "./chunk-M2T62AZQ.js";
|
|
49
|
+
import {
|
|
50
|
+
ActorConfigSchema,
|
|
51
|
+
KEYS,
|
|
52
|
+
event,
|
|
53
|
+
loggerWithoutContext,
|
|
54
|
+
queue
|
|
55
|
+
} from "./chunk-T5YCUGVS.js";
|
|
51
56
|
import {
|
|
52
57
|
LogLevelSchema,
|
|
53
58
|
VERSION,
|
|
@@ -55,6 +60,7 @@ import {
|
|
|
55
60
|
configureDefaultLogger,
|
|
56
61
|
detectRuntime,
|
|
57
62
|
getLogger,
|
|
63
|
+
getNodeEnv,
|
|
58
64
|
getRivetRunEngine,
|
|
59
65
|
getRivetRunEngineVersion,
|
|
60
66
|
getRivetRunnerKey,
|
|
@@ -65,172 +71,21 @@ import {
|
|
|
65
71
|
promiseWithResolvers,
|
|
66
72
|
setLongTimeout,
|
|
67
73
|
stringifyError
|
|
68
|
-
} from "./chunk-
|
|
74
|
+
} from "./chunk-6LIBPELE.js";
|
|
69
75
|
import {
|
|
70
76
|
EndpointMismatch,
|
|
71
77
|
InvalidRequest,
|
|
72
78
|
NamespaceMismatch,
|
|
73
79
|
UserError
|
|
74
|
-
} from "./chunk-
|
|
75
|
-
|
|
76
|
-
// src/actor/config.ts
|
|
77
|
-
import { z } from "zod";
|
|
78
|
-
var zFunction = () => z.custom((val) => typeof val === "function");
|
|
79
|
-
var ActorConfigSchema = z.object({
|
|
80
|
-
onCreate: zFunction().optional(),
|
|
81
|
-
onDestroy: zFunction().optional(),
|
|
82
|
-
onWake: zFunction().optional(),
|
|
83
|
-
onSleep: zFunction().optional(),
|
|
84
|
-
onStateChange: zFunction().optional(),
|
|
85
|
-
onBeforeConnect: zFunction().optional(),
|
|
86
|
-
onConnect: zFunction().optional(),
|
|
87
|
-
onDisconnect: zFunction().optional(),
|
|
88
|
-
onBeforeActionResponse: zFunction().optional(),
|
|
89
|
-
onRequest: zFunction().optional(),
|
|
90
|
-
onWebSocket: zFunction().optional(),
|
|
91
|
-
actions: z.record(z.string(), zFunction()).default(() => ({})),
|
|
92
|
-
state: z.any().optional(),
|
|
93
|
-
createState: zFunction().optional(),
|
|
94
|
-
connState: z.any().optional(),
|
|
95
|
-
createConnState: zFunction().optional(),
|
|
96
|
-
vars: z.any().optional(),
|
|
97
|
-
db: z.any().optional(),
|
|
98
|
-
createVars: zFunction().optional(),
|
|
99
|
-
options: z.object({
|
|
100
|
-
createVarsTimeout: z.number().positive().default(5e3),
|
|
101
|
-
createConnStateTimeout: z.number().positive().default(5e3),
|
|
102
|
-
onConnectTimeout: z.number().positive().default(5e3),
|
|
103
|
-
// This must be less than ACTOR_STOP_THRESHOLD_MS
|
|
104
|
-
onSleepTimeout: z.number().positive().default(5e3),
|
|
105
|
-
onDestroyTimeout: z.number().positive().default(5e3),
|
|
106
|
-
stateSaveInterval: z.number().positive().default(1e4),
|
|
107
|
-
actionTimeout: z.number().positive().default(6e4),
|
|
108
|
-
// Max time to wait for waitUntil background promises during shutdown
|
|
109
|
-
waitUntilTimeout: z.number().positive().default(15e3),
|
|
110
|
-
connectionLivenessTimeout: z.number().positive().default(2500),
|
|
111
|
-
connectionLivenessInterval: z.number().positive().default(5e3),
|
|
112
|
-
noSleep: z.boolean().default(false),
|
|
113
|
-
sleepTimeout: z.number().positive().default(3e4),
|
|
114
|
-
/**
|
|
115
|
-
* Can hibernate WebSockets for onWebSocket.
|
|
116
|
-
*
|
|
117
|
-
* WebSockets using actions/events are hibernatable by default.
|
|
118
|
-
*
|
|
119
|
-
* @experimental
|
|
120
|
-
**/
|
|
121
|
-
canHibernateWebSocket: z.union([
|
|
122
|
-
z.boolean(),
|
|
123
|
-
zFunction()
|
|
124
|
-
]).default(false)
|
|
125
|
-
}).strict().prefault(() => ({}))
|
|
126
|
-
}).strict().refine(
|
|
127
|
-
(data) => !(data.state !== void 0 && data.createState !== void 0),
|
|
128
|
-
{
|
|
129
|
-
message: "Cannot define both 'state' and 'createState'",
|
|
130
|
-
path: ["state"]
|
|
131
|
-
}
|
|
132
|
-
).refine(
|
|
133
|
-
(data) => !(data.connState !== void 0 && data.createConnState !== void 0),
|
|
134
|
-
{
|
|
135
|
-
message: "Cannot define both 'connState' and 'createConnState'",
|
|
136
|
-
path: ["connState"]
|
|
137
|
-
}
|
|
138
|
-
).refine(
|
|
139
|
-
(data) => !(data.vars !== void 0 && data.createVars !== void 0),
|
|
140
|
-
{
|
|
141
|
-
message: "Cannot define both 'vars' and 'createVars'",
|
|
142
|
-
path: ["vars"]
|
|
143
|
-
}
|
|
144
|
-
);
|
|
145
|
-
var DocActorOptionsSchema = z.object({
|
|
146
|
-
createVarsTimeout: z.number().optional().describe("Timeout in ms for createVars handler. Default: 5000"),
|
|
147
|
-
createConnStateTimeout: z.number().optional().describe(
|
|
148
|
-
"Timeout in ms for createConnState handler. Default: 5000"
|
|
149
|
-
),
|
|
150
|
-
onConnectTimeout: z.number().optional().describe("Timeout in ms for onConnect handler. Default: 5000"),
|
|
151
|
-
onSleepTimeout: z.number().optional().describe(
|
|
152
|
-
"Timeout in ms for onSleep handler. Must be less than ACTOR_STOP_THRESHOLD_MS. Default: 5000"
|
|
153
|
-
),
|
|
154
|
-
onDestroyTimeout: z.number().optional().describe("Timeout in ms for onDestroy handler. Default: 5000"),
|
|
155
|
-
stateSaveInterval: z.number().optional().describe(
|
|
156
|
-
"Interval in ms between automatic state saves. Default: 10000"
|
|
157
|
-
),
|
|
158
|
-
actionTimeout: z.number().optional().describe("Timeout in ms for action handlers. Default: 60000"),
|
|
159
|
-
waitUntilTimeout: z.number().optional().describe(
|
|
160
|
-
"Max time in ms to wait for waitUntil background promises during shutdown. Default: 15000"
|
|
161
|
-
),
|
|
162
|
-
connectionLivenessTimeout: z.number().optional().describe(
|
|
163
|
-
"Timeout in ms for connection liveness checks. Default: 2500"
|
|
164
|
-
),
|
|
165
|
-
connectionLivenessInterval: z.number().optional().describe(
|
|
166
|
-
"Interval in ms between connection liveness checks. Default: 5000"
|
|
167
|
-
),
|
|
168
|
-
noSleep: z.boolean().optional().describe("If true, the actor will never sleep. Default: false"),
|
|
169
|
-
sleepTimeout: z.number().optional().describe(
|
|
170
|
-
"Time in ms of inactivity before the actor sleeps. Default: 30000"
|
|
171
|
-
),
|
|
172
|
-
canHibernateWebSocket: z.boolean().optional().describe(
|
|
173
|
-
"Whether WebSockets using onWebSocket can be hibernated. WebSockets using actions/events are hibernatable by default. Default: false"
|
|
174
|
-
)
|
|
175
|
-
}).describe("Actor options for timeouts and behavior configuration.");
|
|
176
|
-
var DocActorConfigSchema = z.object({
|
|
177
|
-
state: z.unknown().optional().describe(
|
|
178
|
-
"Initial state value for the actor. Cannot be used with createState."
|
|
179
|
-
),
|
|
180
|
-
createState: z.unknown().optional().describe(
|
|
181
|
-
"Function to create initial state. Receives context and input. Cannot be used with state."
|
|
182
|
-
),
|
|
183
|
-
connState: z.unknown().optional().describe(
|
|
184
|
-
"Initial connection state value. Cannot be used with createConnState."
|
|
185
|
-
),
|
|
186
|
-
createConnState: z.unknown().optional().describe(
|
|
187
|
-
"Function to create connection state. Receives context and connection params. Cannot be used with connState."
|
|
188
|
-
),
|
|
189
|
-
vars: z.unknown().optional().describe(
|
|
190
|
-
"Initial ephemeral variables value. Cannot be used with createVars."
|
|
191
|
-
),
|
|
192
|
-
createVars: z.unknown().optional().describe(
|
|
193
|
-
"Function to create ephemeral variables. Receives context and driver context. Cannot be used with vars."
|
|
194
|
-
),
|
|
195
|
-
db: z.unknown().optional().describe("Database provider instance for the actor."),
|
|
196
|
-
onCreate: z.unknown().optional().describe(
|
|
197
|
-
"Called when the actor is first initialized. Use to initialize state."
|
|
198
|
-
),
|
|
199
|
-
onDestroy: z.unknown().optional().describe("Called when the actor is destroyed."),
|
|
200
|
-
onWake: z.unknown().optional().describe(
|
|
201
|
-
"Called when the actor wakes up and is ready to receive connections and actions."
|
|
202
|
-
),
|
|
203
|
-
onSleep: z.unknown().optional().describe(
|
|
204
|
-
"Called when the actor is stopping or sleeping. Use to clean up resources."
|
|
205
|
-
),
|
|
206
|
-
onStateChange: z.unknown().optional().describe(
|
|
207
|
-
"Called when the actor's state changes. State changes within this hook won't trigger recursion."
|
|
208
|
-
),
|
|
209
|
-
onBeforeConnect: z.unknown().optional().describe(
|
|
210
|
-
"Called before a client connects. Throw an error to reject the connection."
|
|
211
|
-
),
|
|
212
|
-
onConnect: z.unknown().optional().describe("Called when a client successfully connects."),
|
|
213
|
-
onDisconnect: z.unknown().optional().describe("Called when a client disconnects."),
|
|
214
|
-
onBeforeActionResponse: z.unknown().optional().describe(
|
|
215
|
-
"Called before sending an action response. Use to transform output."
|
|
216
|
-
),
|
|
217
|
-
onRequest: z.unknown().optional().describe(
|
|
218
|
-
"Called for raw HTTP requests to /actors/{name}/http/* endpoints."
|
|
219
|
-
),
|
|
220
|
-
onWebSocket: z.unknown().optional().describe(
|
|
221
|
-
"Called for raw WebSocket connections to /actors/{name}/websocket/* endpoints."
|
|
222
|
-
),
|
|
223
|
-
actions: z.record(z.string(), z.unknown()).optional().describe(
|
|
224
|
-
"Map of action name to handler function. Defaults to an empty object."
|
|
225
|
-
),
|
|
226
|
-
options: DocActorOptionsSchema.optional()
|
|
227
|
-
}).describe("Actor configuration passed to the actor() function.");
|
|
80
|
+
} from "./chunk-7HTNH26M.js";
|
|
228
81
|
|
|
229
82
|
// src/actor/mod.ts
|
|
230
83
|
function actor(input) {
|
|
231
84
|
const config = ActorConfigSchema.parse(input);
|
|
232
85
|
return new ActorDefinition(config);
|
|
233
86
|
}
|
|
87
|
+
var event2 = event;
|
|
88
|
+
var queue2 = queue;
|
|
234
89
|
|
|
235
90
|
// src/drivers/engine/actor-driver.ts
|
|
236
91
|
import { idToStr, Runner } from "@rivetkit/engine-runner";
|
|
@@ -255,8 +110,8 @@ var EngineActorDriver = class {
|
|
|
255
110
|
#runner;
|
|
256
111
|
#actors = /* @__PURE__ */ new Map();
|
|
257
112
|
#actorRouter;
|
|
258
|
-
#runnerStarted = promiseWithResolvers();
|
|
259
|
-
#runnerStopped = promiseWithResolvers();
|
|
113
|
+
#runnerStarted = promiseWithResolvers((reason) => logger().warn({ msg: "unhandled runner started promise rejection", reason }));
|
|
114
|
+
#runnerStopped = promiseWithResolvers((reason) => logger().warn({ msg: "unhandled runner stopped promise rejection", reason }));
|
|
260
115
|
#isRunnerStopped = false;
|
|
261
116
|
// HACK: Track actor stop intent locally since the runner protocol doesn't
|
|
262
117
|
// pass the stop reason to onActorStop. This will be fixed when the runner
|
|
@@ -358,9 +213,7 @@ var EngineActorDriver = class {
|
|
|
358
213
|
}, delay);
|
|
359
214
|
this.#runner.setAlarm(actor2.id, timestamp);
|
|
360
215
|
}
|
|
361
|
-
|
|
362
|
-
return void 0;
|
|
363
|
-
}
|
|
216
|
+
// No database overrides - will use KV-backed implementation from rivetkit/db
|
|
364
217
|
// MARK: - Batch KV operations
|
|
365
218
|
async kvBatchPut(actorId, entries) {
|
|
366
219
|
await this.#runner.kvPut(actorId, entries);
|
|
@@ -468,6 +321,7 @@ var EngineActorDriver = class {
|
|
|
468
321
|
});
|
|
469
322
|
}
|
|
470
323
|
async #runnerOnActorStart(actorId, generation, actorConfig) {
|
|
324
|
+
var _a;
|
|
471
325
|
logger().debug({
|
|
472
326
|
msg: "runner actor starting",
|
|
473
327
|
actorId,
|
|
@@ -482,42 +336,52 @@ var EngineActorDriver = class {
|
|
|
482
336
|
let handler = this.#actors.get(actorId);
|
|
483
337
|
if (!handler) {
|
|
484
338
|
handler = {
|
|
485
|
-
actorStartPromise: promiseWithResolvers()
|
|
339
|
+
actorStartPromise: promiseWithResolvers((reason) => logger().warn({ msg: "unhandled actor start promise rejection", reason }))
|
|
486
340
|
};
|
|
487
341
|
this.#actors.set(actorId, handler);
|
|
488
342
|
}
|
|
489
343
|
const name = actorConfig.name;
|
|
490
344
|
invariant(actorConfig.key, "actor should have a key");
|
|
491
345
|
const key = deserializeActorKey(actorConfig.key);
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
346
|
+
try {
|
|
347
|
+
const [persistDataBuffer] = await this.#runner.kvGet(actorId, [
|
|
348
|
+
KEYS.PERSIST_DATA
|
|
349
|
+
]);
|
|
350
|
+
if (persistDataBuffer === null) {
|
|
351
|
+
const initialKvState = getInitialActorKvState(input);
|
|
352
|
+
await this.#runner.kvPut(actorId, initialKvState);
|
|
353
|
+
logger().debug({
|
|
354
|
+
msg: "initialized persist data for new actor",
|
|
355
|
+
actorId
|
|
356
|
+
});
|
|
357
|
+
} else {
|
|
358
|
+
logger().debug({
|
|
359
|
+
msg: "found existing persist data for actor",
|
|
360
|
+
actorId,
|
|
361
|
+
dataSize: persistDataBuffer.byteLength
|
|
362
|
+
});
|
|
363
|
+
}
|
|
364
|
+
const definition = lookupInRegistry(this.#config, actorConfig.name);
|
|
365
|
+
handler.actor = await definition.instantiate();
|
|
366
|
+
await handler.actor.start(
|
|
367
|
+
this,
|
|
368
|
+
this.#inlineClient,
|
|
505
369
|
actorId,
|
|
506
|
-
|
|
507
|
-
|
|
370
|
+
name,
|
|
371
|
+
key,
|
|
372
|
+
"unknown"
|
|
373
|
+
// TODO: Add regions
|
|
374
|
+
);
|
|
375
|
+
logger().debug({ msg: "runner actor started", actorId, name, key });
|
|
376
|
+
} catch (innerError) {
|
|
377
|
+
const error = new Error(
|
|
378
|
+
`Failed to start actor ${actorId}: ${innerError}`,
|
|
379
|
+
{ cause: innerError }
|
|
380
|
+
);
|
|
381
|
+
(_a = handler.actorStartPromise) == null ? void 0 : _a.reject(error);
|
|
382
|
+
handler.actorStartPromise = void 0;
|
|
383
|
+
throw error;
|
|
508
384
|
}
|
|
509
|
-
const definition = lookupInRegistry(this.#config, actorConfig.name);
|
|
510
|
-
handler.actor = definition.instantiate();
|
|
511
|
-
await handler.actor.start(
|
|
512
|
-
this,
|
|
513
|
-
this.#inlineClient,
|
|
514
|
-
actorId,
|
|
515
|
-
name,
|
|
516
|
-
key,
|
|
517
|
-
"unknown"
|
|
518
|
-
// TODO: Add regions
|
|
519
|
-
);
|
|
520
|
-
logger().debug({ msg: "runner actor started", actorId, name, key });
|
|
521
385
|
}
|
|
522
386
|
async #runnerOnActorStop(actorId, generation) {
|
|
523
387
|
logger().debug({ msg: "runner actor stopping", actorId, generation });
|
|
@@ -601,55 +465,55 @@ var EngineActorDriver = class {
|
|
|
601
465
|
if (isRestoringHibernatable) {
|
|
602
466
|
(_c = wsHandler.onRestore) == null ? void 0 : _c.call(wsHandler, wsContext);
|
|
603
467
|
}
|
|
604
|
-
websocket.addEventListener("open", (
|
|
605
|
-
wsHandler.onOpen(
|
|
468
|
+
websocket.addEventListener("open", (event3) => {
|
|
469
|
+
wsHandler.onOpen(event3, wsContext);
|
|
606
470
|
});
|
|
607
|
-
websocket.addEventListener("message", (
|
|
471
|
+
websocket.addEventListener("message", (event3) => {
|
|
608
472
|
var _a2, _b2;
|
|
609
473
|
logger().debug({
|
|
610
474
|
msg: "websocket message event listener triggered",
|
|
611
475
|
connId: conn == null ? void 0 : conn.id,
|
|
612
476
|
actorId: actor2 == null ? void 0 : actor2.id,
|
|
613
|
-
messageIndex:
|
|
477
|
+
messageIndex: event3.rivetMessageIndex,
|
|
614
478
|
hasWsHandler: !!wsHandler,
|
|
615
479
|
hasOnMessage: !!(wsHandler == null ? void 0 : wsHandler.onMessage),
|
|
616
480
|
actorIsStopping: actor2 == null ? void 0 : actor2.isStopping,
|
|
617
481
|
websocketType: (_a2 = websocket == null ? void 0 : websocket.constructor) == null ? void 0 : _a2.name,
|
|
618
482
|
wsUniqueId: websocket.__rivet_ws_id,
|
|
619
|
-
eventTargetWsId: (_b2 =
|
|
483
|
+
eventTargetWsId: (_b2 = event3.target) == null ? void 0 : _b2.__rivet_ws_id
|
|
620
484
|
});
|
|
621
485
|
if (actor2 == null ? void 0 : actor2.isStopping) {
|
|
622
486
|
logger().debug({
|
|
623
487
|
msg: "ignoring ws message, actor is stopping",
|
|
624
488
|
connId: conn == null ? void 0 : conn.id,
|
|
625
489
|
actorId: actor2 == null ? void 0 : actor2.id,
|
|
626
|
-
messageIndex:
|
|
490
|
+
messageIndex: event3.rivetMessageIndex
|
|
627
491
|
});
|
|
628
492
|
return;
|
|
629
493
|
}
|
|
630
494
|
logger().debug({
|
|
631
495
|
msg: "calling wsHandler.onMessage",
|
|
632
496
|
connId: conn == null ? void 0 : conn.id,
|
|
633
|
-
messageIndex:
|
|
497
|
+
messageIndex: event3.rivetMessageIndex
|
|
634
498
|
});
|
|
635
|
-
wsHandler.onMessage(
|
|
499
|
+
wsHandler.onMessage(event3, wsContext);
|
|
636
500
|
const hibernate = connStateManager == null ? void 0 : connStateManager.hibernatableData;
|
|
637
501
|
if (hibernate && conn && actor2) {
|
|
638
502
|
invariant(
|
|
639
|
-
typeof
|
|
503
|
+
typeof event3.rivetMessageIndex === "number",
|
|
640
504
|
"missing event.rivetMessageIndex"
|
|
641
505
|
);
|
|
642
506
|
const previousMsgIndex = hibernate.serverMessageIndex;
|
|
643
|
-
hibernate.serverMessageIndex =
|
|
507
|
+
hibernate.serverMessageIndex = event3.rivetMessageIndex;
|
|
644
508
|
logger().info({
|
|
645
509
|
msg: "persisting message index",
|
|
646
510
|
connId: conn.id,
|
|
647
511
|
previousMsgIndex,
|
|
648
|
-
newMsgIndex:
|
|
512
|
+
newMsgIndex: event3.rivetMessageIndex
|
|
649
513
|
});
|
|
650
514
|
const entry = this.#hwsMessageIndex.get(conn.id);
|
|
651
515
|
if (entry) {
|
|
652
|
-
const messageLength = getValueLength(
|
|
516
|
+
const messageLength = getValueLength(event3.data);
|
|
653
517
|
entry.bufferedMessageSize += messageLength;
|
|
654
518
|
if (entry.bufferedMessageSize >= CONN_BUFFERED_MESSAGE_SIZE_THRESHOLD) {
|
|
655
519
|
entry.bufferedMessageSize = 0;
|
|
@@ -669,11 +533,11 @@ var EngineActorDriver = class {
|
|
|
669
533
|
}
|
|
670
534
|
}
|
|
671
535
|
});
|
|
672
|
-
websocket.addEventListener("close", (
|
|
673
|
-
wsHandler.onClose(
|
|
536
|
+
websocket.addEventListener("close", (event3) => {
|
|
537
|
+
wsHandler.onClose(event3, wsContext);
|
|
674
538
|
});
|
|
675
|
-
websocket.addEventListener("error", (
|
|
676
|
-
wsHandler.onError(
|
|
539
|
+
websocket.addEventListener("error", (event3) => {
|
|
540
|
+
wsHandler.onError(event3, wsContext);
|
|
677
541
|
});
|
|
678
542
|
if (isRestoringHibernatable) {
|
|
679
543
|
logger().info({
|
|
@@ -847,12 +711,12 @@ var EngineActorDriver = class {
|
|
|
847
711
|
};
|
|
848
712
|
|
|
849
713
|
// src/drivers/engine/config.ts
|
|
850
|
-
import { z
|
|
714
|
+
import { z } from "zod/v4";
|
|
851
715
|
var EngineConfigSchemaBase = ClientConfigSchemaBase.extend({
|
|
852
716
|
/** Unique key for this runner. Runners connecting a given key will replace any other runner connected with the same key. */
|
|
853
|
-
runnerKey:
|
|
717
|
+
runnerKey: z.string().optional().transform((val) => val ?? getRivetRunnerKey()),
|
|
854
718
|
/** How many actors this runner can run. */
|
|
855
|
-
totalSlots:
|
|
719
|
+
totalSlots: z.number().default(1e5)
|
|
856
720
|
});
|
|
857
721
|
var EngineConfigSchemaTransformed = EngineConfigSchemaBase.transform(
|
|
858
722
|
(config, ctx) => transformEngineConfig(config, ctx)
|
|
@@ -888,43 +752,43 @@ function createEngineDriver() {
|
|
|
888
752
|
}
|
|
889
753
|
|
|
890
754
|
// src/registry/config/legacy-runner.ts
|
|
891
|
-
import { z as
|
|
892
|
-
var LegacyDriverConfigSchema =
|
|
755
|
+
import { z as z2 } from "zod/v4";
|
|
756
|
+
var LegacyDriverConfigSchema = z2.object({
|
|
893
757
|
/** Machine-readable name to identify this driver by. */
|
|
894
|
-
name:
|
|
895
|
-
manager:
|
|
896
|
-
actor:
|
|
758
|
+
name: z2.string(),
|
|
759
|
+
manager: z2.custom(),
|
|
760
|
+
actor: z2.custom()
|
|
897
761
|
});
|
|
898
|
-
var LegacyRunnerConfigSchemaUnmerged =
|
|
762
|
+
var LegacyRunnerConfigSchemaUnmerged = z2.object({
|
|
899
763
|
driver: LegacyDriverConfigSchema.optional(),
|
|
900
764
|
/** @experimental */
|
|
901
|
-
maxIncomingMessageSize:
|
|
765
|
+
maxIncomingMessageSize: z2.number().optional().default(65536),
|
|
902
766
|
/** @experimental */
|
|
903
|
-
maxOutgoingMessageSize:
|
|
767
|
+
maxOutgoingMessageSize: z2.number().optional().default(1048576),
|
|
904
768
|
/** @experimental */
|
|
905
769
|
inspector: InspectorConfigSchema,
|
|
906
770
|
/** @experimental */
|
|
907
|
-
disableDefaultServer:
|
|
771
|
+
disableDefaultServer: z2.boolean().optional().default(false),
|
|
908
772
|
/** @experimental */
|
|
909
|
-
defaultServerPort:
|
|
773
|
+
defaultServerPort: z2.number().default(6420),
|
|
910
774
|
/** @experimental */
|
|
911
|
-
runEngine:
|
|
775
|
+
runEngine: z2.boolean().optional().default(() => getRivetRunEngine()),
|
|
912
776
|
/** @experimental */
|
|
913
|
-
runEngineVersion:
|
|
777
|
+
runEngineVersion: z2.string().optional().default(() => getRivetRunEngineVersion() ?? VERSION),
|
|
914
778
|
/** @experimental */
|
|
915
|
-
overrideServerAddress:
|
|
779
|
+
overrideServerAddress: z2.string().optional(),
|
|
916
780
|
/** @experimental */
|
|
917
|
-
disableActorDriver:
|
|
781
|
+
disableActorDriver: z2.boolean().optional().default(false),
|
|
918
782
|
/**
|
|
919
783
|
* @experimental
|
|
920
784
|
*
|
|
921
785
|
* Whether to run runners normally or have them managed
|
|
922
786
|
* serverlessly (by the Rivet Engine for example).
|
|
923
787
|
*/
|
|
924
|
-
runnerKind:
|
|
788
|
+
runnerKind: z2.enum(["serverless", "normal"]).optional().default(
|
|
925
789
|
() => getRivetRunnerKind() === "serverless" ? "serverless" : "normal"
|
|
926
790
|
),
|
|
927
|
-
totalSlots:
|
|
791
|
+
totalSlots: z2.number().optional(),
|
|
928
792
|
/**
|
|
929
793
|
* @experimental
|
|
930
794
|
*
|
|
@@ -932,18 +796,18 @@ var LegacyRunnerConfigSchemaUnmerged = z3.object({
|
|
|
932
796
|
* For example, if the base path is `/api`, then the route `/actors` will be
|
|
933
797
|
* available at `/api/actors`.
|
|
934
798
|
*/
|
|
935
|
-
basePath:
|
|
799
|
+
basePath: z2.string().optional().default("/"),
|
|
936
800
|
/**
|
|
937
801
|
* @experimental
|
|
938
802
|
*
|
|
939
803
|
* Disable welcome message.
|
|
940
804
|
* */
|
|
941
|
-
noWelcome:
|
|
805
|
+
noWelcome: z2.boolean().optional().default(false),
|
|
942
806
|
/**
|
|
943
807
|
* @experimental
|
|
944
808
|
* */
|
|
945
|
-
logging:
|
|
946
|
-
baseLogger:
|
|
809
|
+
logging: z2.object({
|
|
810
|
+
baseLogger: z2.custom().optional(),
|
|
947
811
|
level: LogLevelSchema.optional()
|
|
948
812
|
}).optional().default(() => ({})),
|
|
949
813
|
/**
|
|
@@ -953,26 +817,26 @@ var LegacyRunnerConfigSchemaUnmerged = z3.object({
|
|
|
953
817
|
* Can only be used when runnerKind is "serverless".
|
|
954
818
|
* If true, uses default configuration. Can also provide custom configuration.
|
|
955
819
|
*/
|
|
956
|
-
autoConfigureServerless:
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
url:
|
|
960
|
-
headers:
|
|
961
|
-
maxRunners:
|
|
962
|
-
minRunners:
|
|
963
|
-
requestLifespan:
|
|
964
|
-
runnersMargin:
|
|
965
|
-
slotsPerRunner:
|
|
966
|
-
metadata:
|
|
820
|
+
autoConfigureServerless: z2.union([
|
|
821
|
+
z2.boolean(),
|
|
822
|
+
z2.object({
|
|
823
|
+
url: z2.string().optional(),
|
|
824
|
+
headers: z2.record(z2.string(), z2.string()).optional(),
|
|
825
|
+
maxRunners: z2.number().optional(),
|
|
826
|
+
minRunners: z2.number().optional(),
|
|
827
|
+
requestLifespan: z2.number().optional(),
|
|
828
|
+
runnersMargin: z2.number().optional(),
|
|
829
|
+
slotsPerRunner: z2.number().optional(),
|
|
830
|
+
metadata: z2.record(z2.string(), z2.unknown()).optional()
|
|
967
831
|
})
|
|
968
832
|
]).optional(),
|
|
969
833
|
// This is a function to allow for lazy configuration of upgradeWebSocket on the
|
|
970
834
|
// fly. This is required since the dependencies that upgradeWebSocket
|
|
971
835
|
// (specifically Node.js) can sometimes only be specified after the router is
|
|
972
836
|
// created or must be imported async using `await import(...)`
|
|
973
|
-
getUpgradeWebSocket:
|
|
837
|
+
getUpgradeWebSocket: z2.custom().optional(),
|
|
974
838
|
/** @experimental */
|
|
975
|
-
token:
|
|
839
|
+
token: z2.string().optional().transform((v) => v || getRivetToken())
|
|
976
840
|
}).merge(EngineConfigSchemaBase);
|
|
977
841
|
var LegacyRunnerConfigSchemaTransformed = LegacyRunnerConfigSchemaUnmerged.transform((config, ctx) => ({
|
|
978
842
|
...config,
|
|
@@ -1002,8 +866,13 @@ function chooseDefaultDriver(config) {
|
|
|
1002
866
|
});
|
|
1003
867
|
return createEngineDriver();
|
|
1004
868
|
}
|
|
1005
|
-
loggerWithoutContext().debug({
|
|
1006
|
-
|
|
869
|
+
loggerWithoutContext().debug({
|
|
870
|
+
msg: "using default file system driver",
|
|
871
|
+
storagePath: config.storagePath
|
|
872
|
+
});
|
|
873
|
+
return createFileSystemOrMemoryDriver(true, {
|
|
874
|
+
path: config.storagePath
|
|
875
|
+
});
|
|
1007
876
|
}
|
|
1008
877
|
|
|
1009
878
|
// src/engine-process/log.ts
|
|
@@ -1376,12 +1245,8 @@ async function waitForEngineHealth() {
|
|
|
1376
1245
|
import { createMiddleware } from "hono/factory";
|
|
1377
1246
|
function getInspectorUrl(config, managerPort) {
|
|
1378
1247
|
if (!config.inspector.enabled) return void 0;
|
|
1379
|
-
const
|
|
1380
|
-
|
|
1381
|
-
if (endpoint) {
|
|
1382
|
-
url.searchParams.set("u", endpoint);
|
|
1383
|
-
}
|
|
1384
|
-
return url.href;
|
|
1248
|
+
const base = config.inspector.defaultEndpoint ?? `http://127.0.0.1:${managerPort}`;
|
|
1249
|
+
return new URL("/ui/", base).href;
|
|
1385
1250
|
}
|
|
1386
1251
|
|
|
1387
1252
|
// src/serverless/log.ts
|
|
@@ -1579,19 +1444,19 @@ async function serveBun(config, managerPort, app) {
|
|
|
1579
1444
|
import invariant3 from "invariant";
|
|
1580
1445
|
|
|
1581
1446
|
// src/manager/router-schema.ts
|
|
1582
|
-
import { z as
|
|
1583
|
-
var ServerlessStartHeadersSchema =
|
|
1584
|
-
endpoint:
|
|
1447
|
+
import { z as z3 } from "zod/v4";
|
|
1448
|
+
var ServerlessStartHeadersSchema = z3.object({
|
|
1449
|
+
endpoint: z3.string({
|
|
1585
1450
|
error: "x-rivet-endpoint header is required"
|
|
1586
1451
|
}),
|
|
1587
|
-
token:
|
|
1588
|
-
totalSlots:
|
|
1452
|
+
token: z3.string({ error: "x-rivet-token header must be a string" }).optional(),
|
|
1453
|
+
totalSlots: z3.coerce.number({
|
|
1589
1454
|
error: "x-rivet-total-slots header must be a number"
|
|
1590
1455
|
}).int({ error: "x-rivet-total-slots header must be an integer" }).gte(1, { error: "x-rivet-total-slots header must be positive" }),
|
|
1591
|
-
runnerName:
|
|
1456
|
+
runnerName: z3.string({
|
|
1592
1457
|
error: "x-rivet-runner-name header is required"
|
|
1593
1458
|
}),
|
|
1594
|
-
namespace:
|
|
1459
|
+
namespace: z3.string({
|
|
1595
1460
|
error: "x-rivet-namespace-name header is required"
|
|
1596
1461
|
})
|
|
1597
1462
|
});
|
|
@@ -1771,6 +1636,7 @@ var Runtime = class _Runtime {
|
|
|
1771
1636
|
version: config.serverless.engineVersion
|
|
1772
1637
|
});
|
|
1773
1638
|
} else if (config.serveManager) {
|
|
1639
|
+
const configuredManagerPort = config.managerPort;
|
|
1774
1640
|
let upgradeWebSocket;
|
|
1775
1641
|
const getUpgradeWebSocket = () => upgradeWebSocket;
|
|
1776
1642
|
managerDriver.setGetUpgradeWebSocket(getUpgradeWebSocket);
|
|
@@ -1784,6 +1650,11 @@ var Runtime = class _Runtime {
|
|
|
1784
1650
|
msg: "serving manager",
|
|
1785
1651
|
port: managerPort
|
|
1786
1652
|
});
|
|
1653
|
+
if (config.publicEndpoint === `http://127.0.0.1:${configuredManagerPort}`) {
|
|
1654
|
+
config.publicEndpoint = `http://127.0.0.1:${managerPort}`;
|
|
1655
|
+
config.serverless.publicEndpoint = config.publicEndpoint;
|
|
1656
|
+
}
|
|
1657
|
+
config.managerPort = managerPort;
|
|
1787
1658
|
const out = await crossPlatformServe(
|
|
1788
1659
|
config,
|
|
1789
1660
|
managerPort,
|
|
@@ -1886,9 +1757,11 @@ var Registry = class {
|
|
|
1886
1757
|
#runtimePromise;
|
|
1887
1758
|
constructor(config) {
|
|
1888
1759
|
this.#config = config;
|
|
1889
|
-
|
|
1890
|
-
|
|
1891
|
-
|
|
1760
|
+
if (getNodeEnv() !== "test") {
|
|
1761
|
+
setTimeout(() => {
|
|
1762
|
+
this.#ensureRuntime();
|
|
1763
|
+
}, 0);
|
|
1764
|
+
}
|
|
1892
1765
|
}
|
|
1893
1766
|
/** Creates runtime if not already created. Idempotent. */
|
|
1894
1767
|
#ensureRuntime() {
|
|
@@ -1989,8 +1862,10 @@ function setup(input) {
|
|
|
1989
1862
|
|
|
1990
1863
|
export {
|
|
1991
1864
|
actor,
|
|
1865
|
+
event2 as event,
|
|
1866
|
+
queue2 as queue,
|
|
1992
1867
|
createEngineDriver,
|
|
1993
1868
|
Registry,
|
|
1994
1869
|
setup
|
|
1995
1870
|
};
|
|
1996
|
-
//# sourceMappingURL=chunk-
|
|
1871
|
+
//# sourceMappingURL=chunk-5ESWDTHJ.js.map
|