rivetkit 2.1.4 → 2.1.6-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/browser/client.d.ts +593 -588
- package/dist/browser/client.js +215 -35
- package/dist/browser/client.js.map +1 -1
- package/dist/browser/inspector/client.js +109 -10
- package/dist/browser/inspector/client.js.map +1 -1
- package/dist/inspector.tar.gz +0 -0
- package/dist/tsup/actor/errors.cjs +2 -2
- package/dist/tsup/actor/errors.js +1 -1
- package/dist/tsup/{actor-router-consts-D29T1Z-K.d.cts → actor-router-consts-DU-1IdQj.d.cts} +1 -1
- package/dist/tsup/{actor-router-consts-D29T1Z-K.d.ts → actor-router-consts-DU-1IdQj.d.ts} +1 -1
- package/dist/tsup/chunk-2ELYUO6C.cjs +112 -0
- package/dist/tsup/chunk-2ELYUO6C.cjs.map +1 -0
- package/dist/tsup/chunk-2LY7RW3Y.cjs +2316 -0
- package/dist/tsup/chunk-2LY7RW3Y.cjs.map +1 -0
- package/dist/tsup/{chunk-L47L3ZWJ.cjs → chunk-6G7ZNM27.cjs} +11 -6
- package/dist/tsup/chunk-6G7ZNM27.cjs.map +1 -0
- package/dist/tsup/{chunk-LK36OGGO.cjs → chunk-A4KEUCB6.cjs} +84 -34
- package/dist/tsup/chunk-A4KEUCB6.cjs.map +1 -0
- package/dist/tsup/{chunk-7HTNH26M.js → chunk-AKUJ5OTO.js} +11 -6
- package/dist/tsup/chunk-AKUJ5OTO.js.map +1 -0
- package/dist/tsup/{chunk-ANKZ2FS6.js → chunk-C22JYHVT.js} +77 -27
- package/dist/tsup/chunk-C22JYHVT.js.map +1 -0
- package/dist/tsup/chunk-C4EB42ET.js +1459 -0
- package/dist/tsup/chunk-C4EB42ET.js.map +1 -0
- package/dist/tsup/chunk-CGGGBIDP.cjs +1459 -0
- package/dist/tsup/chunk-CGGGBIDP.cjs.map +1 -0
- package/dist/tsup/chunk-CMQPDBBR.cjs +1486 -0
- package/dist/tsup/chunk-CMQPDBBR.cjs.map +1 -0
- package/dist/tsup/{chunk-AQD4CBZ2.cjs → chunk-DH6UINWA.cjs} +4 -4
- package/dist/tsup/{chunk-AQD4CBZ2.cjs.map → chunk-DH6UINWA.cjs.map} +1 -1
- package/dist/tsup/chunk-DK46YYCJ.js +1486 -0
- package/dist/tsup/chunk-DK46YYCJ.js.map +1 -0
- package/dist/tsup/chunk-EGWXXBZV.js +2316 -0
- package/dist/tsup/chunk-EGWXXBZV.js.map +1 -0
- package/dist/tsup/{chunk-HBYEYBIC.js → chunk-EONWXYMN.js} +2 -2
- package/dist/tsup/{chunk-N4KRDJ56.js → chunk-GFGRBYO2.js} +35 -6
- package/dist/tsup/chunk-GFGRBYO2.js.map +1 -0
- package/dist/tsup/{chunk-TEUL4UYN.cjs → chunk-GUHXWPGB.cjs} +1515 -1479
- package/dist/tsup/chunk-GUHXWPGB.cjs.map +1 -0
- package/dist/tsup/{chunk-3B6PCYJB.cjs → chunk-HNE2AK6C.cjs} +2375 -3713
- package/dist/tsup/chunk-HNE2AK6C.cjs.map +1 -0
- package/dist/tsup/{chunk-5UEFNG7P.js → chunk-I5I6OALK.js} +2 -2
- package/dist/tsup/chunk-IHQAF2HV.cjs +23 -0
- package/dist/tsup/chunk-IHQAF2HV.cjs.map +1 -0
- package/dist/tsup/{chunk-UWAGLDT6.cjs → chunk-JJNZQDUN.cjs} +667 -2517
- package/dist/tsup/chunk-JJNZQDUN.cjs.map +1 -0
- package/dist/tsup/{chunk-M6H4XIF4.js → chunk-JJSPHLJN.js} +219 -287
- package/dist/tsup/chunk-JJSPHLJN.js.map +1 -0
- package/dist/tsup/chunk-JRKPV5NJ.js +481 -0
- package/dist/tsup/chunk-JRKPV5NJ.js.map +1 -0
- package/dist/tsup/{chunk-VKVNIQRQ.js → chunk-K7MVU5SI.js} +36 -41
- package/dist/tsup/chunk-K7MVU5SI.js.map +1 -0
- package/dist/tsup/{chunk-KJSYAUOM.js → chunk-MLK3GY6P.js} +43 -27
- package/dist/tsup/chunk-MLK3GY6P.js.map +1 -0
- package/dist/tsup/{chunk-4KSHPFXF.cjs → chunk-MPLMTJY5.cjs} +123 -23
- package/dist/tsup/chunk-MPLMTJY5.cjs.map +1 -0
- package/dist/tsup/{chunk-UDMRZR6A.js → chunk-PQWI44WD.js} +1755 -3093
- package/dist/tsup/chunk-PQWI44WD.js.map +1 -0
- package/dist/tsup/{chunk-SR3KQE7Q.cjs → chunk-SQFCIDCG.cjs} +35 -6
- package/dist/tsup/chunk-SQFCIDCG.cjs.map +1 -0
- package/dist/tsup/{chunk-3GTO6H3E.js → chunk-SVHJSM2E.js} +110 -24
- package/dist/tsup/chunk-SVHJSM2E.js.map +1 -0
- package/dist/tsup/chunk-T5KYKM6R.js +49 -0
- package/dist/tsup/chunk-T5KYKM6R.js.map +1 -0
- package/dist/tsup/{chunk-GXRVSSVD.cjs → chunk-TJ7DKW6F.cjs} +123 -37
- package/dist/tsup/chunk-TJ7DKW6F.cjs.map +1 -0
- package/dist/tsup/chunk-UQZRMTM3.js +23 -0
- package/dist/tsup/chunk-UQZRMTM3.js.map +1 -0
- package/dist/tsup/{chunk-QPADHLDU.cjs → chunk-V3JSZR5P.cjs} +3 -3
- package/dist/tsup/{chunk-QPADHLDU.cjs.map → chunk-V3JSZR5P.cjs.map} +1 -1
- package/dist/tsup/{chunk-HKOSZKKZ.cjs → chunk-VBR35EQF.cjs} +271 -339
- package/dist/tsup/chunk-VBR35EQF.cjs.map +1 -0
- package/dist/tsup/{chunk-DZXDUGLL.js → chunk-VWYO36X4.js} +117 -17
- package/dist/tsup/chunk-VWYO36X4.js.map +1 -0
- package/dist/tsup/{chunk-I6PL6QIY.js → chunk-WW27B6DM.js} +1452 -1416
- package/dist/tsup/chunk-WW27B6DM.js.map +1 -0
- package/dist/tsup/chunk-YAE3MEJM.cjs +49 -0
- package/dist/tsup/chunk-YAE3MEJM.cjs.map +1 -0
- package/dist/tsup/{chunk-KTWY3K6Z.js → chunk-YGYGANCA.js} +473 -2323
- package/dist/tsup/chunk-YGYGANCA.js.map +1 -0
- package/dist/tsup/chunk-YZJWZBY5.cjs +481 -0
- package/dist/tsup/chunk-YZJWZBY5.cjs.map +1 -0
- package/dist/tsup/{chunk-ZFY5J2EP.cjs → chunk-ZZLJ5TSM.cjs} +39 -44
- package/dist/tsup/chunk-ZZLJ5TSM.cjs.map +1 -0
- package/dist/tsup/client/mod.cjs +10 -7
- package/dist/tsup/client/mod.cjs.map +1 -1
- package/dist/tsup/client/mod.d.cts +6 -6
- package/dist/tsup/client/mod.d.ts +6 -6
- package/dist/tsup/client/mod.js +11 -8
- 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-Qj-zLJPc.d.ts → config-C2Wwnc69.d.ts} +142 -208
- package/dist/tsup/{config-BiNoIHRs.d.ts → config-DROwzBLT.d.cts} +82 -6
- package/dist/tsup/{config-BiNoIHRs.d.cts → config-DROwzBLT.d.ts} +82 -6
- package/dist/tsup/{config-iPj5l1bL.d.cts → config-ehT-_3BB.d.cts} +142 -208
- package/dist/tsup/{context-DzvH1PBK.d.cts → context-DGMJuAyc.d.ts} +16 -3
- package/dist/tsup/{context-CQCMuHND.d.ts → context-Dpp2RJbW.d.cts} +16 -3
- package/dist/tsup/db/drizzle/mod.cjs +3 -3
- package/dist/tsup/db/drizzle/mod.d.cts +1 -1
- package/dist/tsup/db/drizzle/mod.d.ts +1 -1
- package/dist/tsup/db/drizzle/mod.js +2 -2
- package/dist/tsup/db/mod.cjs +3 -3
- package/dist/tsup/db/mod.d.cts +1 -1
- package/dist/tsup/db/mod.d.ts +1 -1
- package/dist/tsup/db/mod.js +2 -2
- package/dist/tsup/{driver-Jo8v-kbU.d.ts → driver-CYZP9QYo.d.ts} +1 -1
- package/dist/tsup/{driver-iV8J-WMv.d.cts → driver-CoTFpipv.d.cts} +1 -1
- package/dist/tsup/driver-helpers/mod.cjs +7 -5
- package/dist/tsup/driver-helpers/mod.cjs.map +1 -1
- package/dist/tsup/driver-helpers/mod.d.cts +17 -18
- package/dist/tsup/driver-helpers/mod.d.ts +17 -18
- package/dist/tsup/driver-helpers/mod.js +11 -9
- package/dist/tsup/driver-test-suite/mod.cjs +1275 -228
- package/dist/tsup/driver-test-suite/mod.cjs.map +1 -1
- package/dist/tsup/driver-test-suite/mod.d.cts +6 -5
- package/dist/tsup/driver-test-suite/mod.d.ts +6 -5
- package/dist/tsup/driver-test-suite/mod.js +1581 -534
- package/dist/tsup/driver-test-suite/mod.js.map +1 -1
- package/dist/tsup/inspector/mod.cjs +4 -4
- package/dist/tsup/inspector/mod.js +3 -3
- package/dist/tsup/mod.cjs +15 -9
- package/dist/tsup/mod.cjs.map +1 -1
- package/dist/tsup/mod.d.cts +9 -9
- package/dist/tsup/mod.d.ts +9 -9
- package/dist/tsup/mod.js +19 -13
- package/dist/tsup/sandbox/client.cjs +28 -0
- package/dist/tsup/sandbox/client.cjs.map +1 -0
- package/dist/tsup/sandbox/client.d.cts +88 -0
- package/dist/tsup/sandbox/client.d.ts +88 -0
- package/dist/tsup/sandbox/client.js +28 -0
- package/dist/tsup/sandbox/client.js.map +1 -0
- package/dist/tsup/sandbox/index.cjs +761 -0
- package/dist/tsup/sandbox/index.cjs.map +1 -0
- package/dist/tsup/sandbox/index.d.cts +120 -0
- package/dist/tsup/sandbox/index.d.ts +120 -0
- package/dist/tsup/sandbox/index.js +761 -0
- package/dist/tsup/sandbox/index.js.map +1 -0
- package/dist/tsup/sandbox/providers/computesdk.cjs +3 -0
- package/dist/tsup/sandbox/providers/computesdk.cjs.map +1 -0
- package/dist/tsup/sandbox/providers/computesdk.d.cts +7 -0
- package/dist/tsup/sandbox/providers/computesdk.d.ts +7 -0
- package/dist/tsup/sandbox/providers/computesdk.js +3 -0
- package/dist/tsup/sandbox/providers/computesdk.js.map +1 -0
- package/dist/tsup/sandbox/providers/daytona.cjs +3 -0
- package/dist/tsup/sandbox/providers/daytona.cjs.map +1 -0
- package/dist/tsup/sandbox/providers/daytona.d.cts +1 -0
- package/dist/tsup/sandbox/providers/daytona.d.ts +1 -0
- package/dist/tsup/sandbox/providers/daytona.js +3 -0
- package/dist/tsup/sandbox/providers/daytona.js.map +1 -0
- package/dist/tsup/sandbox/providers/docker.cjs +3 -0
- package/dist/tsup/sandbox/providers/docker.cjs.map +1 -0
- package/dist/tsup/sandbox/providers/docker.d.cts +1 -0
- package/dist/tsup/sandbox/providers/docker.d.ts +1 -0
- package/dist/tsup/sandbox/providers/docker.js +3 -0
- package/dist/tsup/sandbox/providers/docker.js.map +1 -0
- package/dist/tsup/sandbox/providers/e2b.cjs +3 -0
- package/dist/tsup/sandbox/providers/e2b.cjs.map +1 -0
- package/dist/tsup/sandbox/providers/e2b.d.cts +1 -0
- package/dist/tsup/sandbox/providers/e2b.d.ts +1 -0
- package/dist/tsup/sandbox/providers/e2b.js +3 -0
- package/dist/tsup/sandbox/providers/e2b.js.map +1 -0
- package/dist/tsup/sandbox/providers/local.cjs +3 -0
- package/dist/tsup/sandbox/providers/local.cjs.map +1 -0
- package/dist/tsup/sandbox/providers/local.d.cts +1 -0
- package/dist/tsup/sandbox/providers/local.d.ts +1 -0
- package/dist/tsup/sandbox/providers/local.js +3 -0
- package/dist/tsup/sandbox/providers/local.js.map +1 -0
- package/dist/tsup/sandbox/providers/modal.cjs +3 -0
- package/dist/tsup/sandbox/providers/modal.cjs.map +1 -0
- package/dist/tsup/sandbox/providers/modal.d.cts +1 -0
- package/dist/tsup/sandbox/providers/modal.d.ts +1 -0
- package/dist/tsup/sandbox/providers/modal.js +3 -0
- package/dist/tsup/sandbox/providers/modal.js.map +1 -0
- package/dist/tsup/sandbox/providers/vercel.cjs +3 -0
- package/dist/tsup/sandbox/providers/vercel.cjs.map +1 -0
- package/dist/tsup/sandbox/providers/vercel.d.cts +1 -0
- package/dist/tsup/sandbox/providers/vercel.d.ts +1 -0
- package/dist/tsup/sandbox/providers/vercel.js +3 -0
- package/dist/tsup/sandbox/providers/vercel.js.map +1 -0
- package/dist/tsup/serve-test-suite/mod.cjs +451 -327
- package/dist/tsup/serve-test-suite/mod.cjs.map +1 -1
- package/dist/tsup/serve-test-suite/mod.js +362 -238
- package/dist/tsup/serve-test-suite/mod.js.map +1 -1
- package/dist/tsup/test/mod.cjs +17 -14
- package/dist/tsup/test/mod.cjs.map +1 -1
- package/dist/tsup/test/mod.d.cts +4 -4
- package/dist/tsup/test/mod.d.ts +4 -4
- package/dist/tsup/test/mod.js +14 -11
- package/dist/tsup/test/mod.js.map +1 -1
- package/dist/tsup/utils.cjs +3 -3
- package/dist/tsup/utils.js +2 -2
- package/dist/tsup/workflow/mod.cjs +6 -6
- package/dist/tsup/workflow/mod.d.cts +13 -9
- package/dist/tsup/workflow/mod.d.ts +13 -9
- package/dist/tsup/workflow/mod.js +5 -5
- package/package.json +113 -14
- package/src/actor/config.ts +94 -88
- package/src/actor/conn/drivers/websocket.ts +2 -1
- package/src/actor/contexts/base/actor.ts +27 -4
- package/src/actor/database.ts +6 -1
- package/src/actor/driver.ts +27 -8
- package/src/actor/errors.ts +10 -5
- package/src/actor/instance/connection-manager.ts +4 -3
- package/src/actor/instance/kv.ts +52 -9
- package/src/actor/instance/mod.ts +135 -84
- package/src/actor/instance/queue-manager.ts +2 -5
- package/src/actor/instance/queue.ts +31 -29
- package/src/actor/instance/state-manager.ts +7 -1
- package/src/actor/instance/traces-driver.ts +34 -36
- package/src/actor/metrics.ts +137 -0
- package/src/actor/protocol/old.ts +9 -12
- package/src/actor/router-websocket-endpoints.ts +12 -6
- package/src/actor/router.ts +46 -9
- package/src/actor/schema.ts +14 -22
- package/src/client/actor-common.ts +65 -0
- package/src/client/actor-conn.ts +71 -9
- package/src/client/actor-handle.ts +22 -5
- package/src/client/client.ts +32 -6
- package/src/client/config.ts +18 -21
- package/src/client/mod.ts +1 -0
- package/src/client/queue.ts +8 -6
- package/src/common/inline-websocket-adapter.ts +8 -2
- package/src/common/router.ts +1 -4
- package/src/common/utils.ts +2 -5
- package/src/db/config.ts +10 -5
- package/src/db/drizzle/mod.ts +51 -41
- package/src/db/mod.ts +54 -29
- package/src/db/shared.ts +42 -8
- package/src/driver-helpers/mod.ts +2 -1
- package/src/driver-helpers/sqlite-pool.ts +42 -0
- package/src/driver-helpers/utils.ts +0 -20
- package/src/driver-test-suite/mod.ts +11 -1
- package/src/driver-test-suite/tests/access-control.ts +19 -12
- package/src/driver-test-suite/tests/action-features.ts +20 -8
- package/src/driver-test-suite/tests/actor-conn.ts +94 -8
- package/src/driver-test-suite/tests/actor-db-kv-stats.ts +282 -0
- package/src/driver-test-suite/tests/actor-db-raw.ts +6 -2
- package/src/driver-test-suite/tests/actor-db.ts +101 -31
- package/src/driver-test-suite/tests/actor-inspector.ts +174 -32
- package/src/driver-test-suite/tests/actor-kv.ts +79 -33
- package/src/driver-test-suite/tests/actor-lifecycle.ts +4 -12
- package/src/driver-test-suite/tests/actor-queue.ts +125 -17
- package/src/driver-test-suite/tests/actor-run.ts +59 -55
- package/src/driver-test-suite/tests/actor-sandbox.ts +78 -0
- package/src/driver-test-suite/tests/actor-schedule.ts +1 -4
- package/src/driver-test-suite/tests/actor-sleep.ts +111 -0
- package/src/driver-test-suite/tests/actor-workflow.ts +387 -3
- package/src/driver-test-suite/tests/conn-error-serialization.ts +3 -1
- package/src/driver-test-suite/tests/raw-websocket.ts +5 -1
- package/src/drivers/default.ts +1 -3
- package/src/drivers/engine/actor-driver.ts +94 -21
- package/src/drivers/engine/config.ts +4 -12
- package/src/drivers/engine/mod.ts +1 -5
- package/src/drivers/file-system/actor.ts +43 -8
- package/src/drivers/file-system/global-state.ts +180 -64
- package/src/drivers/file-system/kv-limits.ts +1 -1
- package/src/drivers/file-system/sqlite-runtime.ts +13 -4
- package/src/engine-process/mod.ts +5 -1
- package/src/inspector/actor-inspector.ts +47 -21
- package/src/inspector/config.ts +1 -4
- package/src/inspector/mod.browser.ts +2 -2
- package/src/inspector/mod.ts +4 -1
- package/src/inspector/serve-ui.ts +0 -1
- package/src/inspector/workflow-history-json.ts +309 -0
- package/src/manager/gateway.ts +6 -2
- package/src/manager/router.ts +3 -3
- package/src/registry/config/index.ts +65 -12
- package/src/registry/config/runner.ts +19 -4
- package/src/registry/index.ts +42 -89
- package/src/sandbox/actor/db.ts +36 -0
- package/src/sandbox/actor/index.ts +476 -0
- package/src/sandbox/actor/session.ts +350 -0
- package/src/sandbox/actor.test.ts +36 -0
- package/src/sandbox/client.test.ts +484 -0
- package/src/sandbox/client.ts +707 -0
- package/src/sandbox/config.ts +151 -0
- package/src/sandbox/index.ts +41 -0
- package/src/sandbox/providers/computesdk.ts +1 -0
- package/src/sandbox/providers/daytona.ts +1 -0
- package/src/sandbox/providers/docker.ts +1 -0
- package/src/sandbox/providers/e2b.ts +1 -0
- package/src/sandbox/providers/local.ts +1 -0
- package/src/sandbox/providers/modal.ts +1 -0
- package/src/sandbox/providers/vercel.ts +1 -0
- package/src/sandbox/session-persist-driver.ts +180 -0
- package/src/sandbox/types.ts +138 -0
- package/src/serverless/configure.ts +5 -3
- package/src/serverless/router.test.ts +17 -9
- package/src/serverless/router.ts +20 -13
- package/src/test/mod.ts +3 -4
- package/src/utils/endpoint-parser.test.ts +6 -2
- package/src/utils/endpoint-parser.ts +6 -2
- package/src/utils/env-vars.ts +0 -2
- package/src/utils/node.ts +1 -1
- package/src/utils/serve.ts +10 -5
- package/src/utils.ts +6 -1
- package/src/workflow/constants.ts +1 -2
- package/src/workflow/context.ts +42 -9
- package/src/workflow/driver.ts +57 -23
- package/src/workflow/inspector.ts +7 -13
- package/src/workflow/mod.ts +91 -4
- package/dist/tsup/chunk-3B6PCYJB.cjs.map +0 -1
- package/dist/tsup/chunk-3GTO6H3E.js.map +0 -1
- package/dist/tsup/chunk-4KSHPFXF.cjs.map +0 -1
- package/dist/tsup/chunk-6LJAZ5R4.cjs +0 -96
- package/dist/tsup/chunk-6LJAZ5R4.cjs.map +0 -1
- package/dist/tsup/chunk-7HTNH26M.js.map +0 -1
- package/dist/tsup/chunk-ANKZ2FS6.js.map +0 -1
- package/dist/tsup/chunk-DZXDUGLL.js.map +0 -1
- package/dist/tsup/chunk-GXRVSSVD.cjs.map +0 -1
- package/dist/tsup/chunk-H5TSEPN4.cjs +0 -645
- package/dist/tsup/chunk-H5TSEPN4.cjs.map +0 -1
- package/dist/tsup/chunk-HKOSZKKZ.cjs.map +0 -1
- package/dist/tsup/chunk-I6PL6QIY.js.map +0 -1
- package/dist/tsup/chunk-KJSYAUOM.js.map +0 -1
- package/dist/tsup/chunk-KTWY3K6Z.js.map +0 -1
- package/dist/tsup/chunk-L47L3ZWJ.cjs.map +0 -1
- package/dist/tsup/chunk-LK36OGGO.cjs.map +0 -1
- package/dist/tsup/chunk-M6H4XIF4.js.map +0 -1
- package/dist/tsup/chunk-N4KRDJ56.js.map +0 -1
- package/dist/tsup/chunk-SR3KQE7Q.cjs.map +0 -1
- package/dist/tsup/chunk-TEFYRRAK.js +0 -645
- package/dist/tsup/chunk-TEFYRRAK.js.map +0 -1
- package/dist/tsup/chunk-TEUL4UYN.cjs.map +0 -1
- package/dist/tsup/chunk-UDMRZR6A.js.map +0 -1
- package/dist/tsup/chunk-UWAGLDT6.cjs.map +0 -1
- package/dist/tsup/chunk-VKVNIQRQ.js.map +0 -1
- package/dist/tsup/chunk-ZFY5J2EP.cjs.map +0 -1
- package/src/db/sqlite-vfs.ts +0 -12
- /package/dist/tsup/{chunk-HBYEYBIC.js.map → chunk-EONWXYMN.js.map} +0 -0
- /package/dist/tsup/{chunk-5UEFNG7P.js.map → chunk-I5I6OALK.js.map} +0 -0
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { z as z$1 } from 'zod/v4';
|
|
2
2
|
import { UniversalWebSocket } from '@rivetkit/virtual-websocket';
|
|
3
|
-
import { A as AnyDatabaseProvider, D as DatabaseProvider, a as RawDatabaseClient } from './config-
|
|
3
|
+
import { A as AnyDatabaseProvider, D as DatabaseProvider, a as RawDatabaseClient, b as ActorMetrics } from './config-DROwzBLT.cjs';
|
|
4
4
|
import { Traces, OtlpExportTraceServiceRequestJson, SpanHandle, SpanStatusInput } from '@rivetkit/traces';
|
|
5
5
|
import { Env, Context, Hono } from 'hono';
|
|
6
6
|
import { VersionedDataHandler } from 'vbare';
|
|
7
|
-
import { Logger } from 'pino';
|
|
8
7
|
import { GetUpgradeWebSocket } from './utils.cjs';
|
|
9
|
-
import {
|
|
8
|
+
import { StandardSchemaV1 } from '@standard-schema/spec';
|
|
9
|
+
import { ISqliteVfs } from '@rivetkit/sqlite-vfs';
|
|
10
10
|
import { BaseSQLiteDatabase } from 'drizzle-orm/sqlite-core';
|
|
11
11
|
import { z } from 'zod';
|
|
12
|
-
import {
|
|
12
|
+
import { Logger } from 'pino';
|
|
13
13
|
import * as nanoevents from 'nanoevents';
|
|
14
14
|
import { W as WorkflowHistory, k as QueueStatus } from './v3-DnYObHH3.cjs';
|
|
15
15
|
|
|
@@ -98,8 +98,18 @@ interface ActorDriver {
|
|
|
98
98
|
kvBatchGet(actorId: string, keys: Uint8Array[]): Promise<(Uint8Array | null)[]>;
|
|
99
99
|
/** Batch delete multiple keys. */
|
|
100
100
|
kvBatchDelete(actorId: string, keys: Uint8Array[]): Promise<void>;
|
|
101
|
+
/** Delete all keys in the half-open range [start, end). */
|
|
102
|
+
kvDeleteRange(actorId: string, start: Uint8Array, end: Uint8Array): Promise<void>;
|
|
101
103
|
/** List all keys with a given prefix. */
|
|
102
|
-
kvListPrefix(actorId: string, prefix: Uint8Array
|
|
104
|
+
kvListPrefix(actorId: string, prefix: Uint8Array, options?: {
|
|
105
|
+
reverse?: boolean;
|
|
106
|
+
limit?: number;
|
|
107
|
+
}): Promise<[Uint8Array, Uint8Array][]>;
|
|
108
|
+
/** List all keys in the half-open range [start, end). */
|
|
109
|
+
kvListRange(actorId: string, start: Uint8Array, end: Uint8Array, options?: {
|
|
110
|
+
reverse?: boolean;
|
|
111
|
+
limit?: number;
|
|
112
|
+
}): Promise<[Uint8Array, Uint8Array][]>;
|
|
103
113
|
/** ActorInstance ensure that only one instance of setAlarm is called in parallel at a time. */
|
|
104
114
|
setAlarm(actor: AnyActorInstance, timestamp: number): Promise<void>;
|
|
105
115
|
/**
|
|
@@ -118,13 +128,12 @@ interface ActorDriver {
|
|
|
118
128
|
* Creates a SQLite VFS instance for creating KV-backed databases.
|
|
119
129
|
* If not provided, the database provider will need an override.
|
|
120
130
|
*
|
|
121
|
-
*
|
|
122
|
-
* should return a new instance per call for actor-level isolation.
|
|
131
|
+
* Drivers may use the actorId for pool-based instance assignment.
|
|
123
132
|
*
|
|
124
133
|
* This is a method (not a property) so drivers can use dynamic imports,
|
|
125
134
|
* keeping the core driver tree-shakeable from @rivetkit/sqlite.
|
|
126
135
|
*/
|
|
127
|
-
createSqliteVfs?():
|
|
136
|
+
createSqliteVfs?(actorId: string): ISqliteVfs | Promise<ISqliteVfs>;
|
|
128
137
|
/**
|
|
129
138
|
* Requests the actor to go to sleep.
|
|
130
139
|
*
|
|
@@ -171,6 +180,10 @@ declare const RegistryConfigSchema: z.ZodPipe<z.ZodObject<{
|
|
|
171
180
|
autoStartActorDriver: z.ZodBoolean;
|
|
172
181
|
}, z.core.$strip>>;
|
|
173
182
|
storagePath: z.ZodPipe<z.ZodOptional<z.ZodString>, z.ZodTransform<string | undefined, string | undefined>>;
|
|
183
|
+
sqlitePool: z.ZodDefault<z.ZodOptional<z.ZodObject<{
|
|
184
|
+
actorsPerInstance: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
185
|
+
idleDestroyMs: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
186
|
+
}, z.core.$strip>>>;
|
|
174
187
|
maxIncomingMessageSize: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
175
188
|
maxOutgoingMessageSize: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
176
189
|
noWelcome: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
@@ -191,6 +204,7 @@ declare const RegistryConfigSchema: z.ZodPipe<z.ZodObject<{
|
|
|
191
204
|
namespace: z.ZodPipe<z.ZodOptional<z.ZodString>, z.ZodTransform<string | undefined, string | undefined>>;
|
|
192
205
|
headers: z.ZodDefault<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>>;
|
|
193
206
|
serveManager: z.ZodOptional<z.ZodBoolean>;
|
|
207
|
+
publicDir: z.ZodOptional<z.ZodString>;
|
|
194
208
|
managerBasePath: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
195
209
|
managerPort: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
196
210
|
managerHost: z.ZodOptional<z.ZodString>;
|
|
@@ -222,7 +236,7 @@ declare const RegistryConfigSchema: z.ZodPipe<z.ZodObject<{
|
|
|
222
236
|
runner: z.ZodDefault<z.ZodOptional<z.ZodObject<{
|
|
223
237
|
totalSlots: z.ZodDefault<z.ZodNumber>;
|
|
224
238
|
runnerName: z.ZodDefault<z.ZodString>;
|
|
225
|
-
runnerKey: z.
|
|
239
|
+
runnerKey: z.ZodOptional<z.ZodString>;
|
|
226
240
|
version: z.ZodDefault<z.ZodNumber>;
|
|
227
241
|
}, z.core.$strip>>>;
|
|
228
242
|
}, z.core.$strip>, z.ZodTransform<{
|
|
@@ -270,6 +284,10 @@ declare const RegistryConfigSchema: z.ZodPipe<z.ZodObject<{
|
|
|
270
284
|
enabled: boolean;
|
|
271
285
|
};
|
|
272
286
|
storagePath: string | undefined;
|
|
287
|
+
sqlitePool: {
|
|
288
|
+
actorsPerInstance: number;
|
|
289
|
+
idleDestroyMs: number;
|
|
290
|
+
};
|
|
273
291
|
maxIncomingMessageSize: number;
|
|
274
292
|
maxOutgoingMessageSize: number;
|
|
275
293
|
noWelcome: boolean;
|
|
@@ -283,8 +301,8 @@ declare const RegistryConfigSchema: z.ZodPipe<z.ZodObject<{
|
|
|
283
301
|
runner: {
|
|
284
302
|
totalSlots: number;
|
|
285
303
|
runnerName: string;
|
|
286
|
-
runnerKey: string | undefined;
|
|
287
304
|
version: number;
|
|
305
|
+
runnerKey?: string | undefined;
|
|
288
306
|
};
|
|
289
307
|
driver?: {
|
|
290
308
|
name: string;
|
|
@@ -293,6 +311,7 @@ declare const RegistryConfigSchema: z.ZodPipe<z.ZodObject<{
|
|
|
293
311
|
actor: ActorDriverBuilder;
|
|
294
312
|
autoStartActorDriver: boolean;
|
|
295
313
|
} | undefined;
|
|
314
|
+
publicDir?: string | undefined;
|
|
296
315
|
managerHost?: string | undefined;
|
|
297
316
|
}, {
|
|
298
317
|
use: Record<string, AnyActorDefinition>;
|
|
@@ -300,6 +319,10 @@ declare const RegistryConfigSchema: z.ZodPipe<z.ZodObject<{
|
|
|
300
319
|
enabled: boolean;
|
|
301
320
|
};
|
|
302
321
|
storagePath: string | undefined;
|
|
322
|
+
sqlitePool: {
|
|
323
|
+
actorsPerInstance: number;
|
|
324
|
+
idleDestroyMs: number;
|
|
325
|
+
};
|
|
303
326
|
maxIncomingMessageSize: number;
|
|
304
327
|
maxOutgoingMessageSize: number;
|
|
305
328
|
noWelcome: boolean;
|
|
@@ -341,8 +364,8 @@ declare const RegistryConfigSchema: z.ZodPipe<z.ZodObject<{
|
|
|
341
364
|
runner: {
|
|
342
365
|
totalSlots: number;
|
|
343
366
|
runnerName: string;
|
|
344
|
-
runnerKey: string | undefined;
|
|
345
367
|
version: number;
|
|
368
|
+
runnerKey?: string | undefined;
|
|
346
369
|
};
|
|
347
370
|
driver?: {
|
|
348
371
|
name: string;
|
|
@@ -352,6 +375,7 @@ declare const RegistryConfigSchema: z.ZodPipe<z.ZodObject<{
|
|
|
352
375
|
autoStartActorDriver: boolean;
|
|
353
376
|
} | undefined;
|
|
354
377
|
serveManager?: boolean | undefined;
|
|
378
|
+
publicDir?: string | undefined;
|
|
355
379
|
managerHost?: string | undefined;
|
|
356
380
|
}>>;
|
|
357
381
|
type RegistryConfig = z.infer<typeof RegistryConfigSchema>;
|
|
@@ -406,6 +430,10 @@ declare const DocRunnerConfigSchema: z.ZodObject<{
|
|
|
406
430
|
declare const DocRegistryConfigSchema: z.ZodObject<{
|
|
407
431
|
use: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
408
432
|
storagePath: z.ZodOptional<z.ZodString>;
|
|
433
|
+
sqlitePool: z.ZodOptional<z.ZodObject<{
|
|
434
|
+
actorsPerInstance: z.ZodOptional<z.ZodNumber>;
|
|
435
|
+
idleDestroyMs: z.ZodOptional<z.ZodNumber>;
|
|
436
|
+
}, z.core.$strip>>;
|
|
409
437
|
maxIncomingMessageSize: z.ZodOptional<z.ZodNumber>;
|
|
410
438
|
maxOutgoingMessageSize: z.ZodOptional<z.ZodNumber>;
|
|
411
439
|
noWelcome: z.ZodOptional<z.ZodBoolean>;
|
|
@@ -425,6 +453,7 @@ declare const DocRegistryConfigSchema: z.ZodObject<{
|
|
|
425
453
|
namespace: z.ZodOptional<z.ZodString>;
|
|
426
454
|
headers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
427
455
|
serveManager: z.ZodOptional<z.ZodBoolean>;
|
|
456
|
+
publicDir: z.ZodOptional<z.ZodString>;
|
|
428
457
|
managerBasePath: z.ZodOptional<z.ZodString>;
|
|
429
458
|
managerPort: z.ZodOptional<z.ZodNumber>;
|
|
430
459
|
inspector: z.ZodOptional<z.ZodObject<{
|
|
@@ -540,175 +569,10 @@ declare class CachedSerializer<TBare, TJson, T = TBare> {
|
|
|
540
569
|
serialize(encoding: Encoding): OutputData;
|
|
541
570
|
}
|
|
542
571
|
|
|
543
|
-
declare const LegacyRunnerConfigSchema: z$1.ZodDefault<z$1.ZodPipe<z$1.ZodObject<{
|
|
544
|
-
driver: z$1.ZodOptional<z$1.ZodObject<{
|
|
545
|
-
name: z$1.ZodString;
|
|
546
|
-
manager: z$1.ZodCustom<ManagerDriverBuilder, ManagerDriverBuilder>;
|
|
547
|
-
actor: z$1.ZodCustom<ActorDriverBuilder, ActorDriverBuilder>;
|
|
548
|
-
}, z$1.core.$strip>>;
|
|
549
|
-
maxIncomingMessageSize: z$1.ZodDefault<z$1.ZodOptional<z$1.ZodNumber>>;
|
|
550
|
-
maxOutgoingMessageSize: z$1.ZodDefault<z$1.ZodOptional<z$1.ZodNumber>>;
|
|
551
|
-
inspector: z$1.ZodDefault<z$1.ZodOptional<z$1.ZodObject<{
|
|
552
|
-
enabled: z$1.ZodDefault<z$1.ZodBoolean>;
|
|
553
|
-
token: z$1.ZodDefault<z$1.ZodOptional<z$1.ZodCustom<() => string, () => string>>>;
|
|
554
|
-
defaultEndpoint: z$1.ZodOptional<z$1.ZodString>;
|
|
555
|
-
}, z$1.core.$strip>>>;
|
|
556
|
-
disableDefaultServer: z$1.ZodDefault<z$1.ZodOptional<z$1.ZodBoolean>>;
|
|
557
|
-
defaultServerPort: z$1.ZodDefault<z$1.ZodNumber>;
|
|
558
|
-
runEngine: z$1.ZodDefault<z$1.ZodOptional<z$1.ZodBoolean>>;
|
|
559
|
-
runEngineVersion: z$1.ZodDefault<z$1.ZodOptional<z$1.ZodString>>;
|
|
560
|
-
overrideServerAddress: z$1.ZodOptional<z$1.ZodString>;
|
|
561
|
-
disableActorDriver: z$1.ZodDefault<z$1.ZodOptional<z$1.ZodBoolean>>;
|
|
562
|
-
runnerKind: z$1.ZodDefault<z$1.ZodOptional<z$1.ZodEnum<{
|
|
563
|
-
serverless: "serverless";
|
|
564
|
-
normal: "normal";
|
|
565
|
-
}>>>;
|
|
566
|
-
basePath: z$1.ZodDefault<z$1.ZodOptional<z$1.ZodString>>;
|
|
567
|
-
noWelcome: z$1.ZodDefault<z$1.ZodOptional<z$1.ZodBoolean>>;
|
|
568
|
-
logging: z$1.ZodDefault<z$1.ZodOptional<z$1.ZodObject<{
|
|
569
|
-
baseLogger: z$1.ZodOptional<z$1.ZodCustom<Logger, Logger>>;
|
|
570
|
-
level: z$1.ZodOptional<z$1.ZodEnum<{
|
|
571
|
-
error: "error";
|
|
572
|
-
trace: "trace";
|
|
573
|
-
fatal: "fatal";
|
|
574
|
-
warn: "warn";
|
|
575
|
-
info: "info";
|
|
576
|
-
debug: "debug";
|
|
577
|
-
silent: "silent";
|
|
578
|
-
}>>;
|
|
579
|
-
}, z$1.core.$strip>>>;
|
|
580
|
-
autoConfigureServerless: z$1.ZodOptional<z$1.ZodUnion<readonly [z$1.ZodBoolean, z$1.ZodObject<{
|
|
581
|
-
url: z$1.ZodOptional<z$1.ZodString>;
|
|
582
|
-
headers: z$1.ZodOptional<z$1.ZodRecord<z$1.ZodString, z$1.ZodString>>;
|
|
583
|
-
maxRunners: z$1.ZodOptional<z$1.ZodNumber>;
|
|
584
|
-
minRunners: z$1.ZodOptional<z$1.ZodNumber>;
|
|
585
|
-
requestLifespan: z$1.ZodOptional<z$1.ZodNumber>;
|
|
586
|
-
runnersMargin: z$1.ZodOptional<z$1.ZodNumber>;
|
|
587
|
-
slotsPerRunner: z$1.ZodOptional<z$1.ZodNumber>;
|
|
588
|
-
metadata: z$1.ZodOptional<z$1.ZodRecord<z$1.ZodString, z$1.ZodUnknown>>;
|
|
589
|
-
}, z$1.core.$strip>]>>;
|
|
590
|
-
endpoint: z$1.ZodPipe<z$1.ZodOptional<z$1.ZodString>, z$1.ZodTransform<string, string | undefined>>;
|
|
591
|
-
token: z$1.ZodPipe<z$1.ZodOptional<z$1.ZodString>, z$1.ZodTransform<string | undefined, string | undefined>>;
|
|
592
|
-
namespace: z$1.ZodPipe<z$1.ZodOptional<z$1.ZodString>, z$1.ZodTransform<string | undefined, string | undefined>>;
|
|
593
|
-
runnerName: z$1.ZodDefault<z$1.ZodString>;
|
|
594
|
-
encoding: z$1.ZodDefault<z$1.ZodEnum<{
|
|
595
|
-
json: "json";
|
|
596
|
-
cbor: "cbor";
|
|
597
|
-
bare: "bare";
|
|
598
|
-
}>>;
|
|
599
|
-
headers: z$1.ZodDefault<z$1.ZodOptional<z$1.ZodRecord<z$1.ZodString, z$1.ZodString>>>;
|
|
600
|
-
getUpgradeWebSocket: z$1.ZodOptional<z$1.ZodCustom<GetUpgradeWebSocket, GetUpgradeWebSocket>>;
|
|
601
|
-
disableMetadataLookup: z$1.ZodDefault<z$1.ZodOptional<z$1.ZodBoolean>>;
|
|
602
|
-
devtools: z$1.ZodDefault<z$1.ZodBoolean>;
|
|
603
|
-
runnerKey: z$1.ZodPipe<z$1.ZodOptional<z$1.ZodString>, z$1.ZodTransform<string | undefined, string | undefined>>;
|
|
604
|
-
totalSlots: z$1.ZodDefault<z$1.ZodNumber>;
|
|
605
|
-
}, z$1.core.$strip>, z$1.ZodTransform<{
|
|
606
|
-
runnerKey: string | undefined;
|
|
607
|
-
endpoint: string | undefined;
|
|
608
|
-
namespace: string;
|
|
609
|
-
token: string | undefined;
|
|
610
|
-
runnerName: string;
|
|
611
|
-
encoding: "json" | "cbor" | "bare";
|
|
612
|
-
headers: Record<string, string>;
|
|
613
|
-
disableMetadataLookup: boolean;
|
|
614
|
-
devtools: boolean;
|
|
615
|
-
getUpgradeWebSocket?: GetUpgradeWebSocket | undefined;
|
|
616
|
-
maxIncomingMessageSize: number;
|
|
617
|
-
maxOutgoingMessageSize: number;
|
|
618
|
-
inspector: {
|
|
619
|
-
enabled: boolean;
|
|
620
|
-
token: () => string;
|
|
621
|
-
defaultEndpoint?: string | undefined;
|
|
622
|
-
};
|
|
623
|
-
disableDefaultServer: boolean;
|
|
624
|
-
defaultServerPort: number;
|
|
625
|
-
runEngine: boolean;
|
|
626
|
-
runEngineVersion: string;
|
|
627
|
-
disableActorDriver: boolean;
|
|
628
|
-
runnerKind: "serverless" | "normal";
|
|
629
|
-
basePath: string;
|
|
630
|
-
noWelcome: boolean;
|
|
631
|
-
logging: {
|
|
632
|
-
baseLogger?: Logger | undefined;
|
|
633
|
-
level?: "error" | "trace" | "fatal" | "warn" | "info" | "debug" | "silent" | undefined;
|
|
634
|
-
};
|
|
635
|
-
totalSlots: number;
|
|
636
|
-
driver?: {
|
|
637
|
-
name: string;
|
|
638
|
-
manager: ManagerDriverBuilder;
|
|
639
|
-
actor: ActorDriverBuilder;
|
|
640
|
-
} | undefined;
|
|
641
|
-
overrideServerAddress?: string | undefined;
|
|
642
|
-
autoConfigureServerless?: boolean | {
|
|
643
|
-
url?: string | undefined;
|
|
644
|
-
headers?: Record<string, string> | undefined;
|
|
645
|
-
maxRunners?: number | undefined;
|
|
646
|
-
minRunners?: number | undefined;
|
|
647
|
-
requestLifespan?: number | undefined;
|
|
648
|
-
runnersMargin?: number | undefined;
|
|
649
|
-
slotsPerRunner?: number | undefined;
|
|
650
|
-
metadata?: Record<string, unknown> | undefined;
|
|
651
|
-
} | undefined;
|
|
652
|
-
}, {
|
|
653
|
-
maxIncomingMessageSize: number;
|
|
654
|
-
maxOutgoingMessageSize: number;
|
|
655
|
-
inspector: {
|
|
656
|
-
enabled: boolean;
|
|
657
|
-
token: () => string;
|
|
658
|
-
defaultEndpoint?: string | undefined;
|
|
659
|
-
};
|
|
660
|
-
disableDefaultServer: boolean;
|
|
661
|
-
defaultServerPort: number;
|
|
662
|
-
runEngine: boolean;
|
|
663
|
-
runEngineVersion: string;
|
|
664
|
-
disableActorDriver: boolean;
|
|
665
|
-
runnerKind: "serverless" | "normal";
|
|
666
|
-
basePath: string;
|
|
667
|
-
noWelcome: boolean;
|
|
668
|
-
logging: {
|
|
669
|
-
baseLogger?: Logger | undefined;
|
|
670
|
-
level?: "error" | "trace" | "fatal" | "warn" | "info" | "debug" | "silent" | undefined;
|
|
671
|
-
};
|
|
672
|
-
endpoint: string;
|
|
673
|
-
token: string | undefined;
|
|
674
|
-
namespace: string | undefined;
|
|
675
|
-
runnerName: string;
|
|
676
|
-
encoding: "json" | "cbor" | "bare";
|
|
677
|
-
headers: Record<string, string>;
|
|
678
|
-
disableMetadataLookup: boolean;
|
|
679
|
-
devtools: boolean;
|
|
680
|
-
runnerKey: string | undefined;
|
|
681
|
-
totalSlots: number;
|
|
682
|
-
driver?: {
|
|
683
|
-
name: string;
|
|
684
|
-
manager: ManagerDriverBuilder;
|
|
685
|
-
actor: ActorDriverBuilder;
|
|
686
|
-
} | undefined;
|
|
687
|
-
overrideServerAddress?: string | undefined;
|
|
688
|
-
autoConfigureServerless?: boolean | {
|
|
689
|
-
url?: string | undefined;
|
|
690
|
-
headers?: Record<string, string> | undefined;
|
|
691
|
-
maxRunners?: number | undefined;
|
|
692
|
-
minRunners?: number | undefined;
|
|
693
|
-
requestLifespan?: number | undefined;
|
|
694
|
-
runnersMargin?: number | undefined;
|
|
695
|
-
slotsPerRunner?: number | undefined;
|
|
696
|
-
metadata?: Record<string, unknown> | undefined;
|
|
697
|
-
} | undefined;
|
|
698
|
-
getUpgradeWebSocket?: GetUpgradeWebSocket | undefined;
|
|
699
|
-
}>>>;
|
|
700
|
-
type LegacyRunnerConfigInput = z$1.input<typeof LegacyRunnerConfigSchema>;
|
|
701
|
-
|
|
702
572
|
type FetchHandler = (request: Request, ...args: any) => Response | Promise<Response>;
|
|
703
573
|
interface ServerlessHandler {
|
|
704
574
|
fetch: FetchHandler;
|
|
705
575
|
}
|
|
706
|
-
interface LegacyStartServerOutput<A extends Registry<any>> {
|
|
707
|
-
/** Client to communicate with the actors. */
|
|
708
|
-
client: Client<A>;
|
|
709
|
-
/** Fetch handler to manually route requests to the Rivet manager API. */
|
|
710
|
-
fetch: FetchHandler;
|
|
711
|
-
}
|
|
712
576
|
declare class Registry<A extends RegistryActors> {
|
|
713
577
|
#private;
|
|
714
578
|
get config(): RegistryConfigInput<A>;
|
|
@@ -739,11 +603,22 @@ declare class Registry<A extends RegistryActors> {
|
|
|
739
603
|
*/
|
|
740
604
|
startRunner(): void;
|
|
741
605
|
/**
|
|
742
|
-
*
|
|
606
|
+
* Starts the server, serving both the actor API and static files.
|
|
743
607
|
*
|
|
744
|
-
*
|
|
608
|
+
* This is the simplest way to run RivetKit. It starts a local manager
|
|
609
|
+
* server, serves static files from the configured `publicDir` (default
|
|
610
|
+
* `"public"`), and starts the actor runner.
|
|
611
|
+
*
|
|
612
|
+
* When an endpoint is configured (via config or RIVET_ENDPOINT env var),
|
|
613
|
+
* operates in serverless mode connected to the remote engine instead.
|
|
614
|
+
*
|
|
615
|
+
* @example
|
|
616
|
+
* ```ts
|
|
617
|
+
* const registry = setup({ use: { counter } });
|
|
618
|
+
* registry.start();
|
|
619
|
+
* ```
|
|
745
620
|
*/
|
|
746
|
-
start(
|
|
621
|
+
start(): void;
|
|
747
622
|
}
|
|
748
623
|
declare function setup<A extends RegistryActors>(input: RegistryConfigInput<A>): Registry<A>;
|
|
749
624
|
|
|
@@ -786,6 +661,21 @@ type ActorQuery = z$1.infer<typeof ActorQuerySchema>;
|
|
|
786
661
|
*/
|
|
787
662
|
type CreateRequest = z$1.infer<typeof CreateRequestSchema>;
|
|
788
663
|
|
|
664
|
+
interface QueueSendWaitOptions {
|
|
665
|
+
wait: true;
|
|
666
|
+
timeout?: number;
|
|
667
|
+
signal?: AbortSignal;
|
|
668
|
+
}
|
|
669
|
+
interface QueueSendNoWaitOptions {
|
|
670
|
+
wait?: false;
|
|
671
|
+
timeout?: never;
|
|
672
|
+
signal?: AbortSignal;
|
|
673
|
+
}
|
|
674
|
+
interface QueueSendResult<TResponse = unknown> {
|
|
675
|
+
status: "completed" | "timedOut";
|
|
676
|
+
response?: TResponse;
|
|
677
|
+
}
|
|
678
|
+
|
|
789
679
|
/**
|
|
790
680
|
* Action function returned by Actor connections and handles.
|
|
791
681
|
*
|
|
@@ -802,6 +692,23 @@ type ActorActionFunction<Args extends Array<unknown> = unknown[], Response = unk
|
|
|
802
692
|
type ActorDefinitionActions<AD extends AnyActorDefinition> = AD extends ActorDefinition<any, any, any, any, any, any, any, any, infer R> ? {
|
|
803
693
|
[K in keyof R]: R[K] extends (...args: infer Args) => infer Return ? ActorActionFunction<Args, Return> : never;
|
|
804
694
|
} : never;
|
|
695
|
+
type ActorQueueSend<TQueues extends QueueSchemaConfig> = {
|
|
696
|
+
<K extends keyof TQueues & string>(name: K, body: InferSchemaMap<TQueues>[K], options: QueueSendWaitOptions): Promise<QueueSendResult<InferQueueCompleteMap<TQueues>[K]>>;
|
|
697
|
+
<K extends keyof TQueues & string>(name: K, body: InferSchemaMap<TQueues>[K], options?: QueueSendNoWaitOptions): Promise<void>;
|
|
698
|
+
(name: keyof TQueues extends never ? string : never, body: unknown, options: QueueSendWaitOptions): Promise<QueueSendResult>;
|
|
699
|
+
(name: keyof TQueues extends never ? string : never, body: unknown, options?: QueueSendNoWaitOptions): Promise<void>;
|
|
700
|
+
};
|
|
701
|
+
type ActorEventSubscribe<TEvents extends EventSchemaConfig> = {
|
|
702
|
+
<K extends keyof TEvents & string>(eventName: K, callback: (...args: InferEventArgs<InferSchemaMap<TEvents>[K]>) => void): () => void;
|
|
703
|
+
(eventName: keyof TEvents extends never ? string : never, callback: (...args: any[]) => void): () => void;
|
|
704
|
+
};
|
|
705
|
+
type ActorDefinitionQueueSend<AD extends AnyActorDefinition> = AD extends ActorDefinition<any, any, any, any, any, any, any, infer Q, any> ? Q extends QueueSchemaConfig ? {
|
|
706
|
+
send: ActorQueueSend<Q>;
|
|
707
|
+
} : never : never;
|
|
708
|
+
type ActorDefinitionEventSubscriptions<AD extends AnyActorDefinition> = AD extends ActorDefinition<any, any, any, any, any, any, infer E, any, any> ? E extends EventSchemaConfig ? {
|
|
709
|
+
on: ActorEventSubscribe<E>;
|
|
710
|
+
once: ActorEventSubscribe<E>;
|
|
711
|
+
} : never : never;
|
|
805
712
|
|
|
806
713
|
declare class ActorClientError extends Error {
|
|
807
714
|
}
|
|
@@ -824,21 +731,6 @@ declare class ActorConnDisposed extends ActorClientError {
|
|
|
824
731
|
constructor();
|
|
825
732
|
}
|
|
826
733
|
|
|
827
|
-
interface QueueSendWaitOptions {
|
|
828
|
-
wait: true;
|
|
829
|
-
timeout?: number;
|
|
830
|
-
signal?: AbortSignal;
|
|
831
|
-
}
|
|
832
|
-
interface QueueSendNoWaitOptions {
|
|
833
|
-
wait?: false;
|
|
834
|
-
timeout?: never;
|
|
835
|
-
signal?: AbortSignal;
|
|
836
|
-
}
|
|
837
|
-
interface QueueSendResult {
|
|
838
|
-
status: "completed" | "timedOut";
|
|
839
|
-
response?: unknown;
|
|
840
|
-
}
|
|
841
|
-
|
|
842
734
|
/**
|
|
843
735
|
* Connection status for an actor connection.
|
|
844
736
|
*
|
|
@@ -887,7 +779,7 @@ declare class ActorConnRaw {
|
|
|
887
779
|
*
|
|
888
780
|
* @protected
|
|
889
781
|
*/
|
|
890
|
-
constructor(client: ClientRaw, driver: ManagerDriver, params: unknown, encoding: Encoding, actorQuery: ActorQuery);
|
|
782
|
+
constructor(client: ClientRaw, driver: ManagerDriver, params: unknown, getParams: (() => Promise<unknown>) | undefined, encoding: Encoding, actorQuery: ActorQuery);
|
|
891
783
|
send(name: string, body: unknown, options: QueueSendWaitOptions): Promise<QueueSendResult>;
|
|
892
784
|
send(name: string, body: unknown, options?: QueueSendNoWaitOptions): Promise<void>;
|
|
893
785
|
/**
|
|
@@ -1002,7 +894,7 @@ declare class ActorConnRaw {
|
|
|
1002
894
|
* @template AD The actor class that this connection is for.
|
|
1003
895
|
* @see {@link ActorConnRaw}
|
|
1004
896
|
*/
|
|
1005
|
-
type ActorConn<AD extends AnyActorDefinition> = ActorConnRaw & ActorDefinitionActions<AD>;
|
|
897
|
+
type ActorConn<AD extends AnyActorDefinition> = Omit<ActorConnRaw, "send" | "on" | "once"> & ActorDefinitionQueueSend<AD> & ActorDefinitionEventSubscriptions<AD> & ActorDefinitionActions<AD>;
|
|
1006
898
|
|
|
1007
899
|
/**
|
|
1008
900
|
* Provides underlying functions for stateless {@link ActorHandle} for action calls.
|
|
@@ -1019,7 +911,7 @@ declare class ActorHandleRaw {
|
|
|
1019
911
|
*
|
|
1020
912
|
* @protected
|
|
1021
913
|
*/
|
|
1022
|
-
constructor(client: any, driver: ManagerDriver, params: unknown, encoding: Encoding, actorQuery: ActorQuery);
|
|
914
|
+
constructor(client: any, driver: ManagerDriver, params: unknown, getParams: (() => Promise<unknown>) | undefined, encoding: Encoding, actorQuery: ActorQuery);
|
|
1023
915
|
send(name: string, body: unknown, options: QueueSendWaitOptions): Promise<QueueSendResult>;
|
|
1024
916
|
send(name: string, body: unknown, options?: QueueSendNoWaitOptions): Promise<void>;
|
|
1025
917
|
/**
|
|
@@ -1075,10 +967,10 @@ declare class ActorHandleRaw {
|
|
|
1075
967
|
* @template AD The actor class that this handle is for.
|
|
1076
968
|
* @see {@link ActorHandleRaw}
|
|
1077
969
|
*/
|
|
1078
|
-
type ActorHandle<AD extends AnyActorDefinition> = Omit<ActorHandleRaw, "connect"> & {
|
|
970
|
+
type ActorHandle<AD extends AnyActorDefinition> = Omit<ActorHandleRaw, "connect" | "send"> & {
|
|
1079
971
|
connect(): ActorConn<AD>;
|
|
1080
972
|
resolve(): Promise<string>;
|
|
1081
|
-
} & ActorDefinitionActions<AD>;
|
|
973
|
+
} & ActorDefinitionQueueSend<AD> & ActorDefinitionActions<AD>;
|
|
1082
974
|
|
|
1083
975
|
/** Extract the actor registry from the registry definition. */
|
|
1084
976
|
type ExtractActorsFromRegistry<A extends Registry<any>> = A extends Registry<infer Actors> ? Actors : never;
|
|
@@ -1136,6 +1028,11 @@ interface ActorAccessor<AD extends AnyActorDefinition> {
|
|
|
1136
1028
|
interface QueryOptions {
|
|
1137
1029
|
/** Parameters to pass to the connection. */
|
|
1138
1030
|
params?: unknown;
|
|
1031
|
+
/**
|
|
1032
|
+
* Lazily resolves connection parameters for `.connect()` and `.webSocket()`.
|
|
1033
|
+
* This is called each time a new connection is opened.
|
|
1034
|
+
*/
|
|
1035
|
+
getParams?: () => Promise<unknown>;
|
|
1139
1036
|
/** Signal to abort the request. */
|
|
1140
1037
|
signal?: AbortSignal;
|
|
1141
1038
|
}
|
|
@@ -1303,6 +1200,8 @@ declare class ActorInspector {
|
|
|
1303
1200
|
executeAction(name: string, params: ArrayBuffer): Promise<ArrayBuffer>;
|
|
1304
1201
|
getStateJson(): unknown;
|
|
1305
1202
|
setStateJson(state: unknown): Promise<void>;
|
|
1203
|
+
getDatabaseSchemaJson(): Promise<unknown>;
|
|
1204
|
+
getDatabaseTableRowsJson(table: string, limit: number, offset: number): Promise<unknown[]>;
|
|
1306
1205
|
getConnectionsJson(): {
|
|
1307
1206
|
id: string;
|
|
1308
1207
|
details: unknown;
|
|
@@ -1352,6 +1251,8 @@ type KvValueOptions<T extends KvValueType = "text"> = {
|
|
|
1352
1251
|
};
|
|
1353
1252
|
type KvListOptions<T extends KvValueType = "text", K extends KvKeyType = "text"> = KvValueOptions<T> & {
|
|
1354
1253
|
keyType?: K;
|
|
1254
|
+
reverse?: boolean;
|
|
1255
|
+
limit?: number;
|
|
1355
1256
|
};
|
|
1356
1257
|
declare class ActorKv {
|
|
1357
1258
|
#private;
|
|
@@ -1380,11 +1281,19 @@ declare class ActorKv {
|
|
|
1380
1281
|
* Delete multiple keys.
|
|
1381
1282
|
*/
|
|
1382
1283
|
deleteBatch(keys: KvKey[]): Promise<void>;
|
|
1284
|
+
/**
|
|
1285
|
+
* Delete all keys in the half-open range [start, end).
|
|
1286
|
+
*/
|
|
1287
|
+
deleteRange(start: KvKey, end: KvKey): Promise<void>;
|
|
1383
1288
|
/**
|
|
1384
1289
|
* List all keys with a given prefix.
|
|
1385
1290
|
* Returns key-value pairs where keys have the user prefix removed.
|
|
1386
1291
|
*/
|
|
1387
1292
|
list<T extends KvValueType = "text", K extends KvKeyType = "text">(prefix: KvKeyTypeMap[K], options?: KvListOptions<T, K>): Promise<[KvKeyTypeMap[K], KvValueTypeMap[T]][]>;
|
|
1293
|
+
/**
|
|
1294
|
+
* List all key-value pairs in the half-open range [start, end).
|
|
1295
|
+
*/
|
|
1296
|
+
listRange<T extends KvValueType = "text", K extends KvKeyType = "text">(start: KvKeyTypeMap[K], end: KvKeyTypeMap[K], options?: KvListOptions<T, K>): Promise<[KvKeyTypeMap[K], KvValueTypeMap[T]][]>;
|
|
1388
1297
|
}
|
|
1389
1298
|
|
|
1390
1299
|
interface QueueMessage {
|
|
@@ -1572,7 +1481,7 @@ declare class ActorContext<TState, TConnParams, TConnState, TVars, TInput, TData
|
|
|
1572
1481
|
/**
|
|
1573
1482
|
* Returns the client for the given registry.
|
|
1574
1483
|
*/
|
|
1575
|
-
client<R extends Registry<any>>(): Client<R>;
|
|
1484
|
+
client<R extends Registry<any> = Registry<any>>(): Client<R>;
|
|
1576
1485
|
/**
|
|
1577
1486
|
* Gets the database.
|
|
1578
1487
|
*
|
|
@@ -1590,16 +1499,33 @@ declare class ActorContext<TState, TConnParams, TConnState, TVars, TInput, TData
|
|
|
1590
1499
|
saveState(opts: SaveStateOptions): Promise<void>;
|
|
1591
1500
|
/**
|
|
1592
1501
|
* Prevents the actor from sleeping until promise is complete.
|
|
1502
|
+
*
|
|
1503
|
+
* @deprecated Use `onSleep` for shutdown or flush work, or
|
|
1504
|
+
* `c.setPreventSleep(true)` while work is active if the actor must stay
|
|
1505
|
+
* awake until it finishes.
|
|
1593
1506
|
*/
|
|
1594
1507
|
waitUntil(promise: Promise<void>): void;
|
|
1595
1508
|
/**
|
|
1596
|
-
* Prevents the actor from sleeping
|
|
1509
|
+
* Prevents the actor from automatically sleeping until cleared.
|
|
1597
1510
|
*
|
|
1598
|
-
*
|
|
1599
|
-
|
|
1511
|
+
* @experimental
|
|
1512
|
+
*/
|
|
1513
|
+
setPreventSleep(prevent: boolean): void;
|
|
1514
|
+
/**
|
|
1515
|
+
* True when the actor is explicitly blocking automatic sleep.
|
|
1516
|
+
*
|
|
1517
|
+
* @experimental
|
|
1518
|
+
*/
|
|
1519
|
+
get preventSleep(): boolean;
|
|
1520
|
+
/**
|
|
1521
|
+
* Prevents the actor from sleeping while the given promise is running.
|
|
1600
1522
|
*
|
|
1601
1523
|
* Returns the resolved value and resets the sleep timer on completion.
|
|
1602
1524
|
* Errors are propagated to the caller.
|
|
1525
|
+
*
|
|
1526
|
+
* @deprecated Use `c.setPreventSleep(true)` while work is active, or move
|
|
1527
|
+
* shutdown and flush work to `onSleep` if it can wait until the actor is
|
|
1528
|
+
* sleeping.
|
|
1603
1529
|
*/
|
|
1604
1530
|
keepAwake<T>(promise: Promise<T>): Promise<T>;
|
|
1605
1531
|
/**
|
|
@@ -2068,6 +1994,7 @@ declare class ActorInstance<S, CP, CS, V, I, DB extends AnyDatabaseProvider, E e
|
|
|
2068
1994
|
get inspector(): ActorInspector;
|
|
2069
1995
|
get traces(): Traces<OtlpExportTraceServiceRequestJson>;
|
|
2070
1996
|
get inspectorToken(): string | undefined;
|
|
1997
|
+
get metrics(): ActorMetrics;
|
|
2071
1998
|
getCurrentTraceSpan(): SpanHandle | null;
|
|
2072
1999
|
startTraceSpan(name: string, attributes?: Record<string, unknown>): SpanHandle;
|
|
2073
2000
|
endTraceSpan(handle: SpanHandle, status?: SpanStatusInput): void;
|
|
@@ -2076,6 +2003,7 @@ declare class ActorInstance<S, CP, CS, V, I, DB extends AnyDatabaseProvider, E e
|
|
|
2076
2003
|
get conns(): Map<ConnId, Conn<S, CP, CS, V, I, DB, E, Q>>;
|
|
2077
2004
|
get schedule(): Schedule;
|
|
2078
2005
|
get abortSignal(): AbortSignal;
|
|
2006
|
+
get preventSleep(): boolean;
|
|
2079
2007
|
get actions(): string[];
|
|
2080
2008
|
get config(): ActorConfig<S, CP, CS, V, I, DB, E, Q>;
|
|
2081
2009
|
get persist(): PersistedActor<S, I>;
|
|
@@ -2128,6 +2056,7 @@ declare class ActorInstance<S, CP, CS, V, I, DB extends AnyDatabaseProvider, E e
|
|
|
2128
2056
|
* Errors are propagated to the caller.
|
|
2129
2057
|
*/
|
|
2130
2058
|
keepAwake<T>(promise: Promise<T>): Promise<T>;
|
|
2059
|
+
setPreventSleep(prevent: boolean): void;
|
|
2131
2060
|
beginQueueWait(): void;
|
|
2132
2061
|
endQueueWait(): void;
|
|
2133
2062
|
resetSleepTimer(): void;
|
|
@@ -2422,19 +2351,24 @@ interface BaseActorConfig<TState, TConnParams, TConnState, TVars, TInput, TDatab
|
|
|
2422
2351
|
* - Custom workflow logic
|
|
2423
2352
|
*
|
|
2424
2353
|
* **Important:** The actor may go to sleep at any time during the `run`
|
|
2425
|
-
* handler. Use `c.
|
|
2426
|
-
*
|
|
2354
|
+
* handler. Use `c.setPreventSleep(true)` while work is active, then clear
|
|
2355
|
+
* it with `c.setPreventSleep(false)` once the actor can sleep again.
|
|
2427
2356
|
*
|
|
2428
2357
|
* The handler receives an abort signal via `c.abortSignal` and a
|
|
2429
2358
|
* `c.aborted` alias for loop checks. Use these to gracefully exit.
|
|
2430
2359
|
*
|
|
2431
|
-
* If this handler exits
|
|
2360
|
+
* If this handler exits, the actor will follow the normal idle sleep timeout
|
|
2361
|
+
* once it becomes idle.
|
|
2362
|
+
* If this handler throws, the actor logs the error and then sleeps once it
|
|
2363
|
+
* becomes idle.
|
|
2364
|
+
* Call `c.destroy()` explicitly if a run handler should destroy the actor.
|
|
2365
|
+
*
|
|
2432
2366
|
* On shutdown, the actor waits for this handler to complete with a
|
|
2433
2367
|
* configurable timeout (options.runStopTimeout, default 15s).
|
|
2434
2368
|
*
|
|
2435
2369
|
* Can be either a function or a RunConfig object with optional name/icon metadata.
|
|
2436
2370
|
*
|
|
2437
|
-
* @returns Void or a Promise.
|
|
2371
|
+
* @returns Void or a Promise.
|
|
2438
2372
|
*/
|
|
2439
2373
|
run?: ((c: RunContext<TState, TConnParams, TConnState, TVars, TInput, TDatabase, TEvents, TQueues>) => void | Promise<void>) | RunConfig<TState, TConnParams, TConnState, TVars, TInput, TDatabase, TEvents, TQueues>;
|
|
2440
2374
|
/**
|
|
@@ -2602,4 +2536,4 @@ declare const DocActorConfigSchema: z$1.ZodObject<{
|
|
|
2602
2536
|
}, z$1.core.$strip>>;
|
|
2603
2537
|
}, z$1.core.$strip>;
|
|
2604
2538
|
|
|
2605
|
-
export {
|
|
2539
|
+
export { type ManagerDisplayInformation as $, type ActorDriverBuilder as A, type ExtractRegistryFromClient as B, type Client as C, type GetWithIdOptions as D, type Encoding as E, InternalError as F, type GetOptions as G, MalformedResponseMessage as H, type InferSchemaMap as I, ManagerError as J, type QueryOptions as K, type Region as L, type ManagerDriverBuilder as M, type RegistryConfig as N, type ManagerDriver as O, type ActorDriver as P, type QueueSchemaConfig as Q, Registry as R, type StatusChangeCallback as S, ActorInstance as T, type ActorOutput as U, type AnyActorInstance as V, type CreateInput as W, type GetForIdInput as X, type GetOrCreateWithKeyInput as Y, type GetWithKeyInput as Z, type ListActorsInput as _, type EventSchemaConfig as a, type TestConfig as a$, ActionContext as a0, BeforeConnectContext as a1, ActorContext as a2, type Actions as a3, type AnyConn as a4, type ActorConfigInput as a5, event as a6, queue as a7, type ActionContextOf as a8, type ActorConfig as a9, type DestroyContextOf as aA, DisconnectContext as aB, type DisconnectContextOf as aC, DocActorConfigSchema as aD, DocActorOptionsSchema as aE, DocConfigureRunnerPoolSchema as aF, DocInspectorConfigSchema as aG, DocRegistryConfigSchema as aH, DocRunnerConfigSchema as aI, DocServerlessConfigSchema as aJ, type FetchHandler as aK, type InspectorUnsubscribe as aL, RUN_FUNCTION_CONFIG_SYMBOL as aM, type RegistryActors as aN, type RegistryConfigInput as aO, RegistryConfigSchema as aP, RequestContext as aQ, type RequestContextOf as aR, type RunConfig as aS, RunConfigSchema as aT, type RunContextOf as aU, type RunInspectorConfig as aV, type ServerlessHandler as aW, SleepContext as aX, type SleepContextOf as aY, StateChangeContext as aZ, type StateChangeContextOf as a_, ActorConfigSchema as aa, type ActorContextOf as ab, type ActorKey as ac, ActorKv as ad, type ActorQuery as ae, type ActorTypes as af, ActorsSchema as ag, type AnyClient as ah, type AuthIntent as ai, BeforeActionResponseContext as aj, type BeforeActionResponseContextOf as ak, type BeforeConnectContextOf as al, Conn as am, ConnContext as an, type ConnContextOf as ao, ConnInitContext as ap, type ConnInitContextOf as aq, ConnectContext as ar, type ConnectContextOf as as, CreateConnStateContext as at, type CreateConnStateContextOf as au, CreateContext as av, type CreateContextOf as aw, CreateVarsContext as ax, type CreateVarsContextOf as ay, DestroyContext as az, RunContext as b, TestConfigSchema as b0, type Type as b1, WakeContext as b2, type WakeContextOf as b3, WebSocketContext as b4, type WebSocketContextOf as b5, type WorkflowInspectorConfig as b6, buildActorNames as b7, createClientWithDriver as b8, getRunFunction as b9, getRunInspectorConfig as ba, getRunMetadata as bb, lookupInRegistry as bc, setup as bd, test as be, type AnyActorDefinition as c, ActorDefinition as d, type QueueFilterName as e, type QueueNextOptions as f, type QueueResultMessageForName as g, type QueueNextBatchOptions as h, type InferDatabaseClient as i, type InferEventArgs as j, type ActorAccessor as k, type ActorActionFunction as l, ActorClientError as m, type ActorConn as n, ActorConnDisposed as o, ActorConnRaw as p, type ActorConnStatus as q, ActorError as r, type ActorHandle as s, ActorHandleRaw as t, ClientRaw as u, type ConnectionStateCallback as v, type CreateOptions as w, type CreateRequest as x, type EventUnsubscribe as y, type ExtractActorsFromRegistry as z };
|