rivetkit 2.0.2 → 2.0.4-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/README.md +3 -5
- package/dist/browser/client.d.ts +2485 -0
- 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/inspector.tar.gz +0 -0
- package/dist/schemas/actor-inspector/v1.ts +784 -0
- package/dist/schemas/actor-inspector/v2.ts +796 -0
- package/dist/schemas/actor-inspector/v3.ts +899 -0
- package/dist/schemas/actor-persist/v1.ts +225 -0
- package/dist/schemas/actor-persist/v2.ts +268 -0
- package/dist/schemas/actor-persist/v3.ts +280 -0
- package/dist/schemas/actor-persist/v4.ts +406 -0
- package/dist/schemas/client-protocol/v1.ts +441 -0
- package/dist/schemas/client-protocol/v2.ts +438 -0
- package/dist/schemas/client-protocol/v3.ts +554 -0
- package/dist/schemas/file-system-driver/v1.ts +108 -0
- package/dist/schemas/file-system-driver/v2.ts +142 -0
- package/dist/schemas/file-system-driver/v3.ts +167 -0
- package/dist/schemas/persist/v1.ts +781 -0
- package/dist/schemas/transport/v1.ts +697 -0
- package/dist/tsup/actor/errors.cjs +106 -0
- package/dist/tsup/actor/errors.cjs.map +1 -0
- package/dist/tsup/actor/errors.d.cts +188 -0
- package/dist/tsup/actor/errors.d.ts +188 -0
- package/dist/tsup/actor/errors.js +106 -0
- package/dist/tsup/actor/errors.js.map +1 -0
- package/dist/tsup/actor-router-consts-D29T1Z-K.d.cts +24 -0
- package/dist/tsup/actor-router-consts-D29T1Z-K.d.ts +24 -0
- package/dist/tsup/chunk-325TLXJT.js +1060 -0
- package/dist/tsup/chunk-325TLXJT.js.map +1 -0
- package/dist/tsup/chunk-424PT5DM.js +23 -0
- package/dist/tsup/chunk-424PT5DM.js.map +1 -0
- package/dist/tsup/chunk-4JVIG3SS.cjs +6289 -0
- package/dist/tsup/chunk-4JVIG3SS.cjs.map +1 -0
- package/dist/tsup/chunk-6LJAZ5R4.cjs +96 -0
- package/dist/tsup/chunk-6LJAZ5R4.cjs.map +1 -0
- package/dist/tsup/chunk-6XU3FMCB.cjs +534 -0
- package/dist/tsup/chunk-6XU3FMCB.cjs.map +1 -0
- package/dist/tsup/chunk-7HTNH26M.js +509 -0
- package/dist/tsup/chunk-7HTNH26M.js.map +1 -0
- package/dist/tsup/chunk-AUVH72RE.cjs +5977 -0
- package/dist/tsup/chunk-AUVH72RE.cjs.map +1 -0
- package/dist/tsup/chunk-D4BYUPNQ.js +645 -0
- package/dist/tsup/chunk-D4BYUPNQ.js.map +1 -0
- package/dist/tsup/chunk-HDQ2JUQT.cjs +23 -0
- package/dist/tsup/chunk-HDQ2JUQT.cjs.map +1 -0
- package/dist/tsup/chunk-HHXX2VRM.js +6289 -0
- package/dist/tsup/chunk-HHXX2VRM.js.map +1 -0
- package/dist/tsup/chunk-JEAEA2PB.js +49 -0
- package/dist/tsup/chunk-JEAEA2PB.js.map +1 -0
- package/dist/tsup/chunk-JYSEG3VF.cjs +642 -0
- package/dist/tsup/chunk-JYSEG3VF.cjs.map +1 -0
- package/dist/tsup/chunk-K6DGYILQ.js +2657 -0
- package/dist/tsup/chunk-K6DGYILQ.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-L47L3ZWJ.cjs +509 -0
- package/dist/tsup/chunk-L47L3ZWJ.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-MXNPAB5W.js +5977 -0
- package/dist/tsup/chunk-MXNPAB5W.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-PQZHDKRW.cjs +1060 -0
- package/dist/tsup/chunk-PQZHDKRW.cjs.map +1 -0
- package/dist/tsup/chunk-PVOE6BU7.cjs +1050 -0
- package/dist/tsup/chunk-PVOE6BU7.cjs.map +1 -0
- package/dist/tsup/chunk-Q4UD2GA4.cjs +1810 -0
- package/dist/tsup/chunk-Q4UD2GA4.cjs.map +1 -0
- package/dist/tsup/chunk-QUD664YZ.js +1810 -0
- package/dist/tsup/chunk-QUD664YZ.js.map +1 -0
- package/dist/tsup/chunk-RTOCTWME.js +1050 -0
- package/dist/tsup/chunk-RTOCTWME.js.map +1 -0
- package/dist/tsup/chunk-SAZZ4SB2.cjs +2657 -0
- package/dist/tsup/chunk-SAZZ4SB2.cjs.map +1 -0
- package/dist/tsup/chunk-SR3KQE7Q.cjs +72 -0
- package/dist/tsup/chunk-SR3KQE7Q.cjs.map +1 -0
- package/dist/tsup/chunk-V2GHLYC6.cjs +49 -0
- package/dist/tsup/chunk-V2GHLYC6.cjs.map +1 -0
- package/dist/tsup/chunk-V3WG7XTW.cjs +645 -0
- package/dist/tsup/chunk-V3WG7XTW.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-WMPW7JYC.js +642 -0
- package/dist/tsup/chunk-WMPW7JYC.js.map +1 -0
- package/dist/tsup/chunk-Z7HNQ2WF.js +534 -0
- package/dist/tsup/chunk-Z7HNQ2WF.js.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 +33 -0
- package/dist/tsup/client/mod.cjs.map +1 -0
- package/dist/tsup/client/mod.d.cts +64 -0
- package/dist/tsup/client/mod.d.ts +64 -0
- package/dist/tsup/client/mod.js +33 -0
- package/dist/tsup/client/mod.js.map +1 -0
- package/dist/tsup/common/log.cjs +21 -0
- package/dist/tsup/common/log.cjs.map +1 -0
- package/dist/tsup/common/log.d.cts +34 -0
- package/dist/tsup/common/log.d.ts +34 -0
- package/dist/tsup/common/log.js +21 -0
- package/dist/tsup/common/log.js.map +1 -0
- package/dist/tsup/common/websocket.cjs +10 -0
- package/dist/tsup/common/websocket.cjs.map +1 -0
- package/dist/tsup/common/websocket.d.cts +3 -0
- package/dist/tsup/common/websocket.d.ts +3 -0
- package/dist/tsup/common/websocket.js +10 -0
- package/dist/tsup/common/websocket.js.map +1 -0
- package/dist/tsup/config-BiNoIHRs.d.cts +80 -0
- package/dist/tsup/config-BiNoIHRs.d.ts +80 -0
- package/dist/tsup/config-P3XujgRr.d.ts +2594 -0
- package/dist/tsup/config-_gfywqqI.d.cts +2594 -0
- package/dist/tsup/context-Bxd8Cx4H.d.cts +75 -0
- package/dist/tsup/context-uNA4TRn3.d.ts +75 -0
- 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-BcLvZcKl.d.cts +13 -0
- package/dist/tsup/driver-CPGHKXyh.d.ts +13 -0
- package/dist/tsup/driver-helpers/mod.cjs +53 -0
- package/dist/tsup/driver-helpers/mod.cjs.map +1 -0
- package/dist/tsup/driver-helpers/mod.d.cts +47 -0
- package/dist/tsup/driver-helpers/mod.d.ts +47 -0
- package/dist/tsup/driver-helpers/mod.js +53 -0
- package/dist/tsup/driver-helpers/mod.js.map +1 -0
- package/dist/tsup/driver-test-suite/mod.cjs +4974 -0
- package/dist/tsup/driver-test-suite/mod.cjs.map +1 -0
- package/dist/tsup/driver-test-suite/mod.d.cts +73 -0
- package/dist/tsup/driver-test-suite/mod.d.ts +73 -0
- package/dist/tsup/driver-test-suite/mod.js +4974 -0
- package/dist/tsup/driver-test-suite/mod.js.map +1 -0
- package/dist/tsup/inspector/mod.cjs +164 -0
- package/dist/tsup/inspector/mod.cjs.map +1 -0
- package/dist/tsup/inspector/mod.d.cts +130 -0
- package/dist/tsup/inspector/mod.d.ts +130 -0
- package/dist/tsup/inspector/mod.js +164 -0
- package/dist/tsup/inspector/mod.js.map +1 -0
- package/dist/tsup/keys-CydblqMh.d.cts +13 -0
- package/dist/tsup/keys-CydblqMh.d.ts +13 -0
- package/dist/tsup/mod.cjs +82 -0
- package/dist/tsup/mod.cjs.map +1 -0
- package/dist/tsup/mod.d.cts +126 -0
- package/dist/tsup/mod.d.ts +126 -0
- package/dist/tsup/mod.js +82 -0
- package/dist/tsup/mod.js.map +1 -0
- package/dist/tsup/serve-test-suite/mod.cjs +2601 -0
- package/dist/tsup/serve-test-suite/mod.cjs.map +1 -0
- package/dist/tsup/serve-test-suite/mod.d.cts +9 -0
- package/dist/tsup/serve-test-suite/mod.d.ts +9 -0
- package/dist/tsup/serve-test-suite/mod.js +2601 -0
- package/dist/tsup/serve-test-suite/mod.js.map +1 -0
- package/dist/tsup/test/mod.cjs +90 -0
- package/dist/tsup/test/mod.cjs.map +1 -0
- package/dist/tsup/test/mod.d.cts +26 -0
- package/dist/tsup/test/mod.d.ts +26 -0
- package/dist/tsup/test/mod.js +90 -0
- package/dist/tsup/test/mod.js.map +1 -0
- package/dist/tsup/utils-fwx3o3K9.d.cts +18 -0
- package/dist/tsup/utils-fwx3o3K9.d.ts +18 -0
- package/dist/tsup/utils.cjs +43 -0
- package/dist/tsup/utils.cjs.map +1 -0
- package/dist/tsup/utils.d.cts +148 -0
- package/dist/tsup/utils.d.ts +148 -0
- package/dist/tsup/utils.js +43 -0
- package/dist/tsup/utils.js.map +1 -0
- 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 +25 -0
- package/dist/tsup/workflow/mod.d.ts +25 -0
- package/dist/tsup/workflow/mod.js +16 -0
- package/dist/tsup/workflow/mod.js.map +1 -0
- package/package.json +293 -5
- package/src/actor/config.ts +1221 -0
- package/src/actor/conn/driver.ts +61 -0
- package/src/actor/conn/drivers/http.ts +17 -0
- package/src/actor/conn/drivers/raw-request.ts +24 -0
- package/src/actor/conn/drivers/raw-websocket.ts +65 -0
- package/src/actor/conn/drivers/websocket.ts +144 -0
- package/src/actor/conn/mod.ts +288 -0
- package/src/actor/conn/persisted.ts +81 -0
- package/src/actor/conn/state-manager.ts +196 -0
- package/src/actor/contexts/action.ts +47 -0
- package/src/actor/contexts/base/actor.ts +347 -0
- package/src/actor/contexts/base/conn-init.ts +68 -0
- package/src/actor/contexts/base/conn.ts +73 -0
- package/src/actor/contexts/before-action-response.ts +42 -0
- package/src/actor/contexts/before-connect.ts +31 -0
- package/src/actor/contexts/connect.ts +42 -0
- package/src/actor/contexts/create-conn-state.ts +32 -0
- package/src/actor/contexts/create-vars.ts +39 -0
- package/src/actor/contexts/create.ts +39 -0
- package/src/actor/contexts/destroy.ts +42 -0
- package/src/actor/contexts/disconnect.ts +43 -0
- package/src/actor/contexts/index.ts +33 -0
- package/src/actor/contexts/request.ts +80 -0
- package/src/actor/contexts/run.ts +47 -0
- package/src/actor/contexts/sleep.ts +42 -0
- package/src/actor/contexts/state-change.ts +42 -0
- package/src/actor/contexts/wake.ts +42 -0
- package/src/actor/contexts/websocket.ts +80 -0
- package/src/actor/database.ts +13 -0
- package/src/actor/definition.ts +64 -0
- package/src/actor/driver.ts +114 -0
- package/src/actor/errors.ts +556 -0
- package/src/actor/instance/connection-manager.ts +574 -0
- package/src/actor/instance/event-manager.ts +314 -0
- package/src/actor/instance/keys.ts +146 -0
- package/src/actor/instance/kv.ts +241 -0
- package/src/actor/instance/mod.ts +1658 -0
- package/src/actor/instance/persisted.ts +67 -0
- package/src/actor/instance/queue-manager.ts +603 -0
- package/src/actor/instance/queue.ts +345 -0
- package/src/actor/instance/schedule-manager.ts +392 -0
- package/src/actor/instance/state-manager.ts +542 -0
- package/src/actor/instance/traces-driver.ts +128 -0
- package/src/actor/keys.test.ts +275 -0
- package/src/actor/keys.ts +89 -0
- package/src/actor/log.ts +6 -0
- package/src/actor/mod.ts +110 -0
- package/src/actor/protocol/old.ts +416 -0
- package/src/actor/protocol/serde.ts +222 -0
- package/src/actor/router-endpoints.ts +400 -0
- package/src/actor/router-websocket-endpoints.test.ts +54 -0
- package/src/actor/router-websocket-endpoints.ts +405 -0
- package/src/actor/router.ts +380 -0
- package/src/actor/schedule.ts +17 -0
- package/src/actor/schema.ts +291 -0
- package/src/actor/utils.test.ts +48 -0
- package/src/actor/utils.ts +158 -0
- package/src/client/actor-common.ts +32 -0
- package/src/client/actor-conn.ts +1262 -0
- package/src/client/actor-handle.ts +344 -0
- package/src/client/actor-query.ts +112 -0
- package/src/client/client.ts +558 -0
- package/src/client/config.ts +151 -0
- package/src/client/errors.ts +76 -0
- package/src/client/log.ts +5 -0
- package/src/client/mod.browser.ts +2 -0
- package/src/client/mod.ts +70 -0
- package/src/client/queue.ts +146 -0
- package/src/client/raw-utils.ts +149 -0
- package/src/client/test.ts +44 -0
- package/src/client/utils.ts +252 -0
- package/src/common/actor-router-consts.ts +59 -0
- package/src/common/cors.ts +57 -0
- package/src/common/eventsource-interface.ts +47 -0
- package/src/common/eventsource.ts +44 -0
- package/src/common/inline-websocket-adapter.ts +154 -0
- package/src/common/log-levels.ts +27 -0
- package/src/common/log.ts +229 -0
- package/src/common/logfmt.ts +221 -0
- package/src/common/network.ts +2 -0
- package/src/common/router.ts +174 -0
- package/src/common/utils.ts +339 -0
- package/src/common/websocket-interface.ts +7 -0
- package/src/common/websocket.ts +43 -0
- 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/devtools-loader/index.ts +33 -0
- package/src/devtools-loader/log.ts +5 -0
- package/src/driver-helpers/mod.ts +33 -0
- package/src/driver-helpers/utils.ts +54 -0
- package/src/driver-test-suite/log.ts +5 -0
- package/src/driver-test-suite/mod.ts +293 -0
- package/src/driver-test-suite/test-inline-client-driver.ts +307 -0
- package/src/driver-test-suite/tests/access-control.ts +218 -0
- package/src/driver-test-suite/tests/action-features.ts +203 -0
- package/src/driver-test-suite/tests/actor-conn-hibernation.ts +152 -0
- package/src/driver-test-suite/tests/actor-conn-state.ts +300 -0
- package/src/driver-test-suite/tests/actor-conn.ts +596 -0
- package/src/driver-test-suite/tests/actor-db-raw.ts +73 -0
- package/src/driver-test-suite/tests/actor-db.ts +477 -0
- package/src/driver-test-suite/tests/actor-destroy.ts +294 -0
- package/src/driver-test-suite/tests/actor-driver.ts +18 -0
- package/src/driver-test-suite/tests/actor-error-handling.ts +150 -0
- package/src/driver-test-suite/tests/actor-handle.ts +312 -0
- package/src/driver-test-suite/tests/actor-inline-client.ts +163 -0
- package/src/driver-test-suite/tests/actor-inspector.ts +264 -0
- package/src/driver-test-suite/tests/actor-kv.ts +65 -0
- package/src/driver-test-suite/tests/actor-metadata.ts +116 -0
- package/src/driver-test-suite/tests/actor-onstatechange.ts +95 -0
- package/src/driver-test-suite/tests/actor-queue.ts +325 -0
- package/src/driver-test-suite/tests/actor-run.ts +181 -0
- package/src/driver-test-suite/tests/actor-schedule.ts +97 -0
- package/src/driver-test-suite/tests/actor-sleep.ts +415 -0
- package/src/driver-test-suite/tests/actor-state.ts +54 -0
- package/src/driver-test-suite/tests/actor-stateless.ts +70 -0
- package/src/driver-test-suite/tests/actor-vars.ts +97 -0
- package/src/driver-test-suite/tests/actor-workflow.ts +118 -0
- package/src/driver-test-suite/tests/manager-driver.ts +388 -0
- package/src/driver-test-suite/tests/raw-http-direct-registry.ts +227 -0
- package/src/driver-test-suite/tests/raw-http-request-properties.ts +454 -0
- package/src/driver-test-suite/tests/raw-http.ts +359 -0
- package/src/driver-test-suite/tests/raw-websocket-direct-registry.ts +393 -0
- package/src/driver-test-suite/tests/raw-websocket.ts +513 -0
- package/src/driver-test-suite/tests/request-access.ts +240 -0
- package/src/driver-test-suite/utils.ts +80 -0
- package/src/drivers/default.ts +38 -0
- package/src/drivers/engine/actor-driver.ts +1027 -0
- package/src/drivers/engine/config.ts +43 -0
- package/src/drivers/engine/log.ts +5 -0
- package/src/drivers/engine/mod.ts +36 -0
- package/src/drivers/file-system/actor.ts +102 -0
- package/src/drivers/file-system/global-state.ts +1445 -0
- package/src/drivers/file-system/kv-limits.ts +70 -0
- package/src/drivers/file-system/log.ts +5 -0
- package/src/drivers/file-system/manager.ts +300 -0
- package/src/drivers/file-system/mod.ts +78 -0
- package/src/drivers/file-system/sqlite-runtime.ts +210 -0
- package/src/drivers/file-system/utils.ts +125 -0
- package/src/engine-process/constants.ts +2 -0
- package/src/engine-process/log.ts +5 -0
- package/src/engine-process/mod.ts +464 -0
- package/src/globals.d.ts +35 -0
- package/src/inspector/actor-inspector.ts +352 -0
- package/src/inspector/config.ts +49 -0
- package/src/inspector/handler.ts +273 -0
- package/src/inspector/log.ts +5 -0
- package/src/inspector/mod.browser.ts +8 -0
- package/src/inspector/mod.ts +4 -0
- package/src/inspector/serve-ui.ts +40 -0
- package/src/inspector/transport.ts +18 -0
- package/src/inspector/utils.ts +32 -0
- package/src/manager/driver.ts +106 -0
- package/src/manager/gateway.ts +668 -0
- package/src/manager/log.ts +5 -0
- package/src/manager/mod.ts +2 -0
- package/src/manager/protocol/mod.ts +22 -0
- package/src/manager/protocol/query.ts +85 -0
- package/src/manager/router-schema.ts +22 -0
- package/src/manager/router.ts +660 -0
- package/src/manager-api/actors.ts +83 -0
- package/src/manager-api/common.ts +4 -0
- package/src/mod.ts +24 -0
- package/src/registry/config/driver.ts +21 -0
- package/src/registry/config/index.ts +510 -0
- package/src/registry/config/legacy-runner.ts +157 -0
- package/src/registry/config/runner.ts +21 -0
- package/src/registry/config/serverless.ts +94 -0
- package/src/registry/index.ts +194 -0
- package/src/registry/log.ts +5 -0
- package/src/remote-manager-driver/actor-http-client.ts +84 -0
- package/src/remote-manager-driver/actor-websocket-client.ts +81 -0
- package/src/remote-manager-driver/api-endpoints.ts +159 -0
- package/src/remote-manager-driver/api-utils.ts +69 -0
- package/src/remote-manager-driver/log.ts +5 -0
- package/src/remote-manager-driver/metadata.ts +64 -0
- package/src/remote-manager-driver/mod.ts +414 -0
- package/src/remote-manager-driver/ws-proxy.ts +189 -0
- package/src/schemas/actor-inspector/mod.ts +1 -0
- package/src/schemas/actor-inspector/versioned.ts +233 -0
- package/src/schemas/actor-persist/mod.ts +1 -0
- package/src/schemas/actor-persist/versioned.ts +217 -0
- package/src/schemas/client-protocol/mod.ts +1 -0
- package/src/schemas/client-protocol/versioned.ts +330 -0
- package/src/schemas/client-protocol-zod/mod.ts +118 -0
- package/src/schemas/file-system-driver/mod.ts +1 -0
- package/src/schemas/file-system-driver/versioned.ts +135 -0
- package/src/schemas/persist/mod.ts +1 -0
- package/src/schemas/transport/mod.ts +1 -0
- package/src/serde.ts +138 -0
- package/src/serve-test-suite/mod.ts +148 -0
- package/src/serverless/configure.ts +82 -0
- package/src/serverless/log.ts +5 -0
- package/src/serverless/router.test.ts +299 -0
- package/src/serverless/router.ts +215 -0
- package/src/test/log.ts +5 -0
- package/src/test/mod.ts +99 -0
- package/src/utils/crypto.ts +24 -0
- package/src/utils/endpoint-parser.test.ts +202 -0
- package/src/utils/endpoint-parser.ts +124 -0
- package/src/utils/env-vars.ts +78 -0
- package/src/utils/node.ts +178 -0
- package/src/utils/router.ts +83 -0
- package/src/utils/serve.ts +212 -0
- package/src/utils.test.ts +34 -0
- package/src/utils.ts +437 -0
- package/src/workflow/constants.ts +2 -0
- package/src/workflow/context.ts +597 -0
- package/src/workflow/driver.ts +194 -0
- package/src/workflow/inspector.ts +268 -0
- package/src/workflow/mod.ts +128 -0
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { z } from "zod/v4";
|
|
2
|
+
import { RivetIdSchema } from "./common";
|
|
3
|
+
|
|
4
|
+
export const ActorSchema = z.object({
|
|
5
|
+
actor_id: RivetIdSchema,
|
|
6
|
+
name: z.string(),
|
|
7
|
+
key: z.string(),
|
|
8
|
+
namespace_id: RivetIdSchema,
|
|
9
|
+
runner_name_selector: z.string(),
|
|
10
|
+
create_ts: z.number(),
|
|
11
|
+
connectable_ts: z.number().nullable().optional(),
|
|
12
|
+
destroy_ts: z.number().nullable().optional(),
|
|
13
|
+
sleep_ts: z.number().nullable().optional(),
|
|
14
|
+
start_ts: z.number().nullable().optional(),
|
|
15
|
+
error: z.unknown().nullable().optional(),
|
|
16
|
+
});
|
|
17
|
+
export type Actor = z.infer<typeof ActorSchema>;
|
|
18
|
+
|
|
19
|
+
export const ActorNameSchema = z.object({
|
|
20
|
+
metadata: z.record(z.string(), z.unknown()),
|
|
21
|
+
});
|
|
22
|
+
export type ActorName = z.infer<typeof ActorNameSchema>;
|
|
23
|
+
|
|
24
|
+
// MARK: GET /actors
|
|
25
|
+
export const ActorsListResponseSchema = z.object({
|
|
26
|
+
actors: z.array(ActorSchema),
|
|
27
|
+
});
|
|
28
|
+
export type ActorsListResponse = z.infer<typeof ActorsListResponseSchema>;
|
|
29
|
+
|
|
30
|
+
// MARK: POST /actors
|
|
31
|
+
export const ActorsCreateRequestSchema = z.object({
|
|
32
|
+
datacenter: z.string().optional(),
|
|
33
|
+
name: z.string(),
|
|
34
|
+
runner_name_selector: z.string(),
|
|
35
|
+
crash_policy: z.string(),
|
|
36
|
+
key: z.string().nullable().optional(),
|
|
37
|
+
input: z.string().nullable().optional(),
|
|
38
|
+
});
|
|
39
|
+
export type ActorsCreateRequest = z.infer<typeof ActorsCreateRequestSchema>;
|
|
40
|
+
|
|
41
|
+
export const ActorsCreateResponseSchema = z.object({
|
|
42
|
+
actor: ActorSchema,
|
|
43
|
+
});
|
|
44
|
+
export type ActorsCreateResponse = z.infer<typeof ActorsCreateResponseSchema>;
|
|
45
|
+
|
|
46
|
+
// MARK: PUT /actors
|
|
47
|
+
export const ActorsGetOrCreateRequestSchema = z.object({
|
|
48
|
+
datacenter: z.string().optional(),
|
|
49
|
+
name: z.string(),
|
|
50
|
+
key: z.string(),
|
|
51
|
+
runner_name_selector: z.string(),
|
|
52
|
+
crash_policy: z.string(),
|
|
53
|
+
input: z.string().nullable().optional(),
|
|
54
|
+
});
|
|
55
|
+
export type ActorsGetOrCreateRequest = z.infer<
|
|
56
|
+
typeof ActorsGetOrCreateRequestSchema
|
|
57
|
+
>;
|
|
58
|
+
|
|
59
|
+
export const ActorsGetOrCreateResponseSchema = z.object({
|
|
60
|
+
actor: ActorSchema,
|
|
61
|
+
created: z.boolean(),
|
|
62
|
+
});
|
|
63
|
+
export type ActorsGetOrCreateResponse = z.infer<
|
|
64
|
+
typeof ActorsGetOrCreateResponseSchema
|
|
65
|
+
>;
|
|
66
|
+
|
|
67
|
+
// MARK: DELETE /actors/{}
|
|
68
|
+
export const ActorsDeleteResponseSchema = z.object({});
|
|
69
|
+
export type ActorsDeleteResponse = z.infer<typeof ActorsDeleteResponseSchema>;
|
|
70
|
+
|
|
71
|
+
// MARK: GET /actors/names
|
|
72
|
+
export const ActorsListNamesResponseSchema = z.object({
|
|
73
|
+
names: z.record(z.string(), ActorNameSchema),
|
|
74
|
+
});
|
|
75
|
+
export type ActorsListNamesResponse = z.infer<
|
|
76
|
+
typeof ActorsListNamesResponseSchema
|
|
77
|
+
>;
|
|
78
|
+
|
|
79
|
+
// MARK: GET /actors/{actor_id}/kv/keys/{key}
|
|
80
|
+
export const ActorsKvGetResponseSchema = z.object({
|
|
81
|
+
value: z.string().nullable(),
|
|
82
|
+
});
|
|
83
|
+
export type ActorsKvGetResponse = z.infer<typeof ActorsKvGetResponseSchema>;
|
package/src/mod.ts
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export * from "@/actor/mod";
|
|
2
|
+
export type * from "@/actor/contexts";
|
|
3
|
+
export type {
|
|
4
|
+
WorkflowBranchContextOf,
|
|
5
|
+
WorkflowContextOf,
|
|
6
|
+
WorkflowLoopContextOf,
|
|
7
|
+
WorkflowStepContextOf,
|
|
8
|
+
} from "@/workflow/context";
|
|
9
|
+
export {
|
|
10
|
+
type AnyClient,
|
|
11
|
+
type Client,
|
|
12
|
+
createClientWithDriver,
|
|
13
|
+
} from "@/client/client";
|
|
14
|
+
export { InlineWebSocketAdapter } from "@/common/inline-websocket-adapter";
|
|
15
|
+
export { noopNext } from "@/common/utils";
|
|
16
|
+
export { createEngineDriver } from "@/drivers/engine/mod";
|
|
17
|
+
export {
|
|
18
|
+
createFileSystemDriver,
|
|
19
|
+
createMemoryDriver,
|
|
20
|
+
} from "@/drivers/file-system/mod";
|
|
21
|
+
export type { ActorQuery } from "@/manager/protocol/query";
|
|
22
|
+
export * from "@/registry";
|
|
23
|
+
export * from "@/registry/config";
|
|
24
|
+
export { toUint8Array } from "@/utils";
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { z } from "zod/v4";
|
|
2
|
+
import { ActorDriverBuilder } from "@/actor/driver";
|
|
3
|
+
import { ManagerDriverBuilder } from "@/manager/driver";
|
|
4
|
+
|
|
5
|
+
export const DriverConfigSchema = z.object({
|
|
6
|
+
/** Machine-readable name to identify this driver by. */
|
|
7
|
+
name: z.string(),
|
|
8
|
+
displayName: z.string(),
|
|
9
|
+
manager: z.custom<ManagerDriverBuilder>(),
|
|
10
|
+
actor: z.custom<ActorDriverBuilder>(),
|
|
11
|
+
/**
|
|
12
|
+
* Start actor driver immediately or if this is started separately.
|
|
13
|
+
*
|
|
14
|
+
* For example:
|
|
15
|
+
* - Engine driver needs this to start immediately since this starts the Runner that connects to the engine
|
|
16
|
+
* - Cloudflare Workers should not start it automatically, since the actor only runs in the DO
|
|
17
|
+
* */
|
|
18
|
+
autoStartActorDriver: z.boolean(),
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
export type DriverConfig = z.infer<typeof DriverConfigSchema>;
|
|
@@ -0,0 +1,510 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { getRunMetadata } from "@/actor/config";
|
|
3
|
+
import type { ActorDefinition, AnyActorDefinition } from "@/actor/definition";
|
|
4
|
+
import { type Logger, LogLevelSchema } from "@/common/log";
|
|
5
|
+
import { ENGINE_ENDPOINT } from "@/engine-process/constants";
|
|
6
|
+
import { InspectorConfigSchema } from "@/inspector/config";
|
|
7
|
+
import { DeepReadonly } from "@/utils";
|
|
8
|
+
import { tryParseEndpoint } from "@/utils/endpoint-parser";
|
|
9
|
+
import {
|
|
10
|
+
getRivetEndpoint,
|
|
11
|
+
getRivetEngine,
|
|
12
|
+
getRivetkitStoragePath,
|
|
13
|
+
getRivetNamespace,
|
|
14
|
+
getRivetToken,
|
|
15
|
+
isDev,
|
|
16
|
+
} from "@/utils/env-vars";
|
|
17
|
+
import { type DriverConfig, DriverConfigSchema } from "./driver";
|
|
18
|
+
import { RunnerConfigSchema } from "./runner";
|
|
19
|
+
import { ServerlessConfigSchema } from "./serverless";
|
|
20
|
+
|
|
21
|
+
export { DriverConfigSchema, type DriverConfig };
|
|
22
|
+
|
|
23
|
+
export const ActorsSchema = z.record(
|
|
24
|
+
z.string(),
|
|
25
|
+
z.custom<ActorDefinition<any, any, any, any, any, any, any, any, any>>(),
|
|
26
|
+
);
|
|
27
|
+
export type RegistryActors = z.infer<typeof ActorsSchema>;
|
|
28
|
+
|
|
29
|
+
export const TestConfigSchema = z.object({ enabled: z.boolean() });
|
|
30
|
+
export type TestConfig = z.infer<typeof TestConfigSchema>;
|
|
31
|
+
|
|
32
|
+
// TODO: Add sane defaults for NODE_ENV=development
|
|
33
|
+
export const RegistryConfigSchema = z
|
|
34
|
+
.object({
|
|
35
|
+
// MARK: Actors
|
|
36
|
+
use: z.record(z.string(), z.custom<AnyActorDefinition>()),
|
|
37
|
+
|
|
38
|
+
// TODO: Find a better way of passing around the test config
|
|
39
|
+
/**
|
|
40
|
+
* Test configuration.
|
|
41
|
+
*
|
|
42
|
+
* DO NOT MANUALLY ENABLE. THIS IS USED INTERNALLY.
|
|
43
|
+
* @internal
|
|
44
|
+
**/
|
|
45
|
+
test: TestConfigSchema.optional().default({ enabled: false }),
|
|
46
|
+
|
|
47
|
+
// MARK: Driver
|
|
48
|
+
driver: DriverConfigSchema.optional(),
|
|
49
|
+
/**
|
|
50
|
+
* Storage path for RivetKit file-system state when using the default driver.
|
|
51
|
+
*
|
|
52
|
+
* If not set, RivetKit uses the platform default data location.
|
|
53
|
+
*
|
|
54
|
+
* Can also be set via RIVETKIT_STORAGE_PATH.
|
|
55
|
+
*/
|
|
56
|
+
storagePath: z
|
|
57
|
+
.string()
|
|
58
|
+
.optional()
|
|
59
|
+
.transform((val) => val ?? getRivetkitStoragePath()),
|
|
60
|
+
|
|
61
|
+
// MARK: Networking
|
|
62
|
+
/** @experimental */
|
|
63
|
+
maxIncomingMessageSize: z.number().optional().default(65_536),
|
|
64
|
+
|
|
65
|
+
/** @experimental */
|
|
66
|
+
maxOutgoingMessageSize: z.number().optional().default(1_048_576),
|
|
67
|
+
|
|
68
|
+
// MARK: Runtime
|
|
69
|
+
/**
|
|
70
|
+
* @experimental
|
|
71
|
+
*
|
|
72
|
+
* Disable welcome message.
|
|
73
|
+
* */
|
|
74
|
+
noWelcome: z.boolean().optional().default(false),
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* @experimental
|
|
78
|
+
* */
|
|
79
|
+
logging: z
|
|
80
|
+
.object({
|
|
81
|
+
baseLogger: z.custom<Logger>().optional(),
|
|
82
|
+
level: LogLevelSchema.optional(),
|
|
83
|
+
})
|
|
84
|
+
.optional()
|
|
85
|
+
.default(() => ({})),
|
|
86
|
+
|
|
87
|
+
// MARK: Routing
|
|
88
|
+
// // This is a function to allow for lazy configuration of upgradeWebSocket on the
|
|
89
|
+
// // fly. This is required since the dependencies that upgradeWebSocket
|
|
90
|
+
// // (specifically Node.js) can sometimes only be specified after the router is
|
|
91
|
+
// // created or must be imported async using `await import(...)`
|
|
92
|
+
// getUpgradeWebSocket: z.custom<GetUpgradeWebSocket>().optional(),
|
|
93
|
+
|
|
94
|
+
// MARK: Runner Configuration
|
|
95
|
+
/**
|
|
96
|
+
* Endpoint to connect to for Rivet Engine.
|
|
97
|
+
*
|
|
98
|
+
* Supports URL auth syntax for namespace and token:
|
|
99
|
+
* - `https://namespace:token@api.rivet.dev`
|
|
100
|
+
* - `https://namespace@api.rivet.dev`
|
|
101
|
+
*
|
|
102
|
+
* Can also be set via RIVET_ENDPOINT environment variables.
|
|
103
|
+
*/
|
|
104
|
+
endpoint: z
|
|
105
|
+
.string()
|
|
106
|
+
.optional()
|
|
107
|
+
.transform((val) => val ?? getRivetEngine() ?? getRivetEndpoint()),
|
|
108
|
+
token: z
|
|
109
|
+
.string()
|
|
110
|
+
.optional()
|
|
111
|
+
.transform((val) => val ?? getRivetToken()),
|
|
112
|
+
namespace: z
|
|
113
|
+
.string()
|
|
114
|
+
.optional()
|
|
115
|
+
.transform((val) => val ?? getRivetNamespace()),
|
|
116
|
+
headers: z.record(z.string(), z.string()).optional().default({}),
|
|
117
|
+
|
|
118
|
+
// MARK: Client
|
|
119
|
+
// TODO:
|
|
120
|
+
// client: ClientConfigSchema.optional(),
|
|
121
|
+
|
|
122
|
+
// MARK: Manager
|
|
123
|
+
/**
|
|
124
|
+
* Whether to start the local manager server.
|
|
125
|
+
* Auto-determined based on endpoint and NODE_ENV if not specified.
|
|
126
|
+
*/
|
|
127
|
+
serveManager: z.boolean().optional(),
|
|
128
|
+
/**
|
|
129
|
+
* @experimental
|
|
130
|
+
*
|
|
131
|
+
* Base path for the manager API. This is used to prefix all routes.
|
|
132
|
+
* For example, if the base path is `/foo`, then the route `/actors`
|
|
133
|
+
* will be available at `/foo/actors`.
|
|
134
|
+
*/
|
|
135
|
+
managerBasePath: z.string().optional().default("/"),
|
|
136
|
+
/**
|
|
137
|
+
* @experimental
|
|
138
|
+
*
|
|
139
|
+
* What port to run the manager on.
|
|
140
|
+
*/
|
|
141
|
+
managerPort: z.number().optional().default(6420),
|
|
142
|
+
/**
|
|
143
|
+
* @experimental
|
|
144
|
+
*
|
|
145
|
+
* What host to bind the manager server to.
|
|
146
|
+
*/
|
|
147
|
+
managerHost: z.string().optional(),
|
|
148
|
+
|
|
149
|
+
/** @experimental */
|
|
150
|
+
inspector: InspectorConfigSchema,
|
|
151
|
+
|
|
152
|
+
// MARK: Runtime-specific
|
|
153
|
+
serverless: ServerlessConfigSchema.optional().default(() =>
|
|
154
|
+
ServerlessConfigSchema.parse({}),
|
|
155
|
+
),
|
|
156
|
+
runner: RunnerConfigSchema.optional().default(() =>
|
|
157
|
+
RunnerConfigSchema.parse({}),
|
|
158
|
+
),
|
|
159
|
+
})
|
|
160
|
+
.transform((config, ctx) => {
|
|
161
|
+
const isDevEnv = isDev();
|
|
162
|
+
|
|
163
|
+
// Parse endpoint string (env var fallback is applied via transform above)
|
|
164
|
+
const parsedEndpoint = config.endpoint
|
|
165
|
+
? tryParseEndpoint(ctx, {
|
|
166
|
+
endpoint: config.endpoint,
|
|
167
|
+
path: ["endpoint"],
|
|
168
|
+
namespace: config.namespace,
|
|
169
|
+
token: config.token,
|
|
170
|
+
})
|
|
171
|
+
: undefined;
|
|
172
|
+
|
|
173
|
+
if (parsedEndpoint && config.serveManager) {
|
|
174
|
+
ctx.addIssue({
|
|
175
|
+
code: "custom",
|
|
176
|
+
message: "cannot specify both endpoint and serveManager",
|
|
177
|
+
});
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
// Can't spawn engine AND connect to remote endpoint
|
|
181
|
+
if (config.serverless.spawnEngine && parsedEndpoint) {
|
|
182
|
+
ctx.addIssue({
|
|
183
|
+
code: "custom",
|
|
184
|
+
message: "cannot specify both spawnEngine and endpoint",
|
|
185
|
+
});
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
// configureRunnerPool requires an engine (via endpoint or spawnEngine)
|
|
189
|
+
if (
|
|
190
|
+
config.serverless.configureRunnerPool &&
|
|
191
|
+
!parsedEndpoint &&
|
|
192
|
+
!config.serverless.spawnEngine
|
|
193
|
+
) {
|
|
194
|
+
ctx.addIssue({
|
|
195
|
+
code: "custom",
|
|
196
|
+
message:
|
|
197
|
+
"configureRunnerPool requires either endpoint or spawnEngine",
|
|
198
|
+
});
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
// Flatten the endpoint and apply defaults for namespace/token
|
|
202
|
+
// If spawnEngine is enabled, set endpoint to the engine endpoint
|
|
203
|
+
const endpoint = config.serverless.spawnEngine
|
|
204
|
+
? ENGINE_ENDPOINT
|
|
205
|
+
: parsedEndpoint?.endpoint;
|
|
206
|
+
// Namespace priority: parsed from endpoint URL > config value (includes env var) > "default"
|
|
207
|
+
const namespace =
|
|
208
|
+
parsedEndpoint?.namespace ?? config.namespace ?? "default";
|
|
209
|
+
// Token priority: parsed from endpoint URL > config value (includes env var)
|
|
210
|
+
const token = parsedEndpoint?.token ?? config.token;
|
|
211
|
+
|
|
212
|
+
// Parse publicEndpoint string (env var fallback is applied via transform in serverless schema)
|
|
213
|
+
const parsedPublicEndpoint = config.serverless.publicEndpoint
|
|
214
|
+
? tryParseEndpoint(ctx, {
|
|
215
|
+
endpoint: config.serverless.publicEndpoint,
|
|
216
|
+
path: ["serverless", "publicEndpoint"],
|
|
217
|
+
})
|
|
218
|
+
: undefined;
|
|
219
|
+
|
|
220
|
+
// Validate that publicEndpoint namespace matches backend namespace if specified
|
|
221
|
+
if (
|
|
222
|
+
parsedPublicEndpoint?.namespace &&
|
|
223
|
+
parsedPublicEndpoint.namespace !== namespace
|
|
224
|
+
) {
|
|
225
|
+
ctx.addIssue({
|
|
226
|
+
code: "custom",
|
|
227
|
+
message: `publicEndpoint namespace "${parsedPublicEndpoint.namespace}" must match backend namespace "${namespace}"`,
|
|
228
|
+
path: ["serverless", "publicEndpoint"],
|
|
229
|
+
});
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
// Determine serveManager: default to true in dev mode without endpoint, false otherwise
|
|
233
|
+
const serveManager = config.serveManager ?? (isDevEnv && !endpoint);
|
|
234
|
+
|
|
235
|
+
// In dev mode, fall back to 127.0.0.1 if serving manager
|
|
236
|
+
const publicEndpoint =
|
|
237
|
+
parsedPublicEndpoint?.endpoint ??
|
|
238
|
+
(isDevEnv && (serveManager || config.serverless.spawnEngine)
|
|
239
|
+
? `http://127.0.0.1:${config.managerPort}`
|
|
240
|
+
: undefined);
|
|
241
|
+
// We extract publicNamespace to validate that it matches the backend
|
|
242
|
+
// namespace (see validation above), not for functional use.
|
|
243
|
+
const publicNamespace = parsedPublicEndpoint?.namespace;
|
|
244
|
+
const publicToken =
|
|
245
|
+
parsedPublicEndpoint?.token ?? config.serverless.publicToken;
|
|
246
|
+
|
|
247
|
+
// If endpoint is set or spawning engine, we'll use engine driver - disable manager inspector
|
|
248
|
+
const willUseEngine = !!endpoint || config.serverless.spawnEngine;
|
|
249
|
+
const inspector = willUseEngine
|
|
250
|
+
? {
|
|
251
|
+
...config.inspector,
|
|
252
|
+
enabled: { manager: false, actor: true },
|
|
253
|
+
}
|
|
254
|
+
: config.inspector;
|
|
255
|
+
|
|
256
|
+
return {
|
|
257
|
+
...config,
|
|
258
|
+
endpoint,
|
|
259
|
+
namespace,
|
|
260
|
+
token,
|
|
261
|
+
serveManager,
|
|
262
|
+
publicEndpoint,
|
|
263
|
+
publicNamespace,
|
|
264
|
+
publicToken,
|
|
265
|
+
inspector,
|
|
266
|
+
serverless: {
|
|
267
|
+
...config.serverless,
|
|
268
|
+
publicEndpoint,
|
|
269
|
+
},
|
|
270
|
+
};
|
|
271
|
+
});
|
|
272
|
+
|
|
273
|
+
export type RegistryConfig = z.infer<typeof RegistryConfigSchema>;
|
|
274
|
+
export type RegistryConfigInput<A extends RegistryActors> = Omit<
|
|
275
|
+
z.input<typeof RegistryConfigSchema>,
|
|
276
|
+
"use"
|
|
277
|
+
> & { use: A };
|
|
278
|
+
|
|
279
|
+
export function buildActorNames(
|
|
280
|
+
config: RegistryConfig,
|
|
281
|
+
): Record<string, { metadata: Record<string, unknown> }> {
|
|
282
|
+
return Object.fromEntries(
|
|
283
|
+
Object.keys(config.use).map((actorName) => {
|
|
284
|
+
const definition = config.use[actorName];
|
|
285
|
+
const options = definition.config.options ?? {};
|
|
286
|
+
const runMeta = getRunMetadata(definition.config.run);
|
|
287
|
+
const metadata: Record<string, unknown> = {};
|
|
288
|
+
// Actor options take precedence over run metadata
|
|
289
|
+
metadata.icon = options.icon ?? runMeta.icon;
|
|
290
|
+
metadata.name = options.name ?? runMeta.name;
|
|
291
|
+
// Remove undefined values
|
|
292
|
+
if (!metadata.icon) delete metadata.icon;
|
|
293
|
+
if (!metadata.name) delete metadata.name;
|
|
294
|
+
return [actorName, { metadata }];
|
|
295
|
+
}),
|
|
296
|
+
);
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
// MARK: Documentation Schemas
|
|
300
|
+
// These schemas are JSON-serializable versions used for documentation generation.
|
|
301
|
+
// They exclude runtime-only fields (transforms, custom types, Logger instances).
|
|
302
|
+
|
|
303
|
+
export const DocInspectorConfigSchema = z
|
|
304
|
+
.object({
|
|
305
|
+
enabled: z
|
|
306
|
+
.boolean()
|
|
307
|
+
.optional()
|
|
308
|
+
.describe(
|
|
309
|
+
"Whether to enable the Rivet Inspector. Defaults to true in development mode.",
|
|
310
|
+
),
|
|
311
|
+
token: z
|
|
312
|
+
.string()
|
|
313
|
+
.optional()
|
|
314
|
+
.describe("Token used to access the Inspector."),
|
|
315
|
+
defaultEndpoint: z
|
|
316
|
+
.string()
|
|
317
|
+
.optional()
|
|
318
|
+
.describe(
|
|
319
|
+
"Default RivetKit server endpoint for Rivet Inspector to connect to.",
|
|
320
|
+
),
|
|
321
|
+
})
|
|
322
|
+
.optional()
|
|
323
|
+
.describe("Inspector configuration for debugging and development.");
|
|
324
|
+
|
|
325
|
+
export const DocConfigureRunnerPoolSchema = z
|
|
326
|
+
.object({
|
|
327
|
+
name: z.string().optional().describe("Name of the runner pool."),
|
|
328
|
+
url: z
|
|
329
|
+
.string()
|
|
330
|
+
.describe("URL of the serverless platform to configure runners."),
|
|
331
|
+
headers: z
|
|
332
|
+
.record(z.string(), z.string())
|
|
333
|
+
.optional()
|
|
334
|
+
.describe(
|
|
335
|
+
"Headers to include in requests to the serverless platform.",
|
|
336
|
+
),
|
|
337
|
+
maxRunners: z
|
|
338
|
+
.number()
|
|
339
|
+
.optional()
|
|
340
|
+
.describe("Maximum number of runners in the pool."),
|
|
341
|
+
minRunners: z
|
|
342
|
+
.number()
|
|
343
|
+
.optional()
|
|
344
|
+
.describe("Minimum number of runners to keep warm."),
|
|
345
|
+
requestLifespan: z
|
|
346
|
+
.number()
|
|
347
|
+
.optional()
|
|
348
|
+
.describe("Maximum lifespan of a request in milliseconds."),
|
|
349
|
+
runnersMargin: z
|
|
350
|
+
.number()
|
|
351
|
+
.optional()
|
|
352
|
+
.describe("Buffer margin for scaling runners."),
|
|
353
|
+
slotsPerRunner: z
|
|
354
|
+
.number()
|
|
355
|
+
.optional()
|
|
356
|
+
.describe("Number of actor slots per runner."),
|
|
357
|
+
metadata: z
|
|
358
|
+
.record(z.string(), z.unknown())
|
|
359
|
+
.optional()
|
|
360
|
+
.describe(
|
|
361
|
+
"Additional metadata to pass to the serverless platform.",
|
|
362
|
+
),
|
|
363
|
+
metadataPollInterval: z
|
|
364
|
+
.number()
|
|
365
|
+
.optional()
|
|
366
|
+
.describe(
|
|
367
|
+
"Interval in milliseconds between metadata polls from the engine. Defaults to 10000 milliseconds (10 seconds).",
|
|
368
|
+
),
|
|
369
|
+
})
|
|
370
|
+
.optional();
|
|
371
|
+
|
|
372
|
+
export const DocServerlessConfigSchema = z
|
|
373
|
+
.object({
|
|
374
|
+
spawnEngine: z
|
|
375
|
+
.boolean()
|
|
376
|
+
.optional()
|
|
377
|
+
.describe(
|
|
378
|
+
"Downloads and starts the full Rust engine process. Auto-enabled in development mode when no endpoint is provided. Default: false",
|
|
379
|
+
),
|
|
380
|
+
engineVersion: z
|
|
381
|
+
.string()
|
|
382
|
+
.optional()
|
|
383
|
+
.describe(
|
|
384
|
+
"Version of the engine to download. Defaults to the current RivetKit version.",
|
|
385
|
+
),
|
|
386
|
+
configureRunnerPool: DocConfigureRunnerPoolSchema.describe(
|
|
387
|
+
"Automatically configure serverless runners in the engine.",
|
|
388
|
+
),
|
|
389
|
+
basePath: z
|
|
390
|
+
.string()
|
|
391
|
+
.optional()
|
|
392
|
+
.describe(
|
|
393
|
+
"Base path for serverless API routes. Default: '/api/rivet'",
|
|
394
|
+
),
|
|
395
|
+
publicEndpoint: z
|
|
396
|
+
.string()
|
|
397
|
+
.optional()
|
|
398
|
+
.describe(
|
|
399
|
+
"The endpoint that clients should connect to. Supports URL auth syntax: https://namespace:token@api.rivet.dev",
|
|
400
|
+
),
|
|
401
|
+
publicToken: z
|
|
402
|
+
.string()
|
|
403
|
+
.optional()
|
|
404
|
+
.describe(
|
|
405
|
+
"Token that clients should use when connecting via the public endpoint.",
|
|
406
|
+
),
|
|
407
|
+
})
|
|
408
|
+
.describe("Configuration for serverless deployment mode.");
|
|
409
|
+
|
|
410
|
+
export const DocRunnerConfigSchema = z
|
|
411
|
+
.object({
|
|
412
|
+
totalSlots: z
|
|
413
|
+
.number()
|
|
414
|
+
.optional()
|
|
415
|
+
.describe("Total number of actor slots available. Default: 100000"),
|
|
416
|
+
runnerName: z
|
|
417
|
+
.string()
|
|
418
|
+
.optional()
|
|
419
|
+
.describe("Name of this runner. Default: 'default'"),
|
|
420
|
+
runnerKey: z
|
|
421
|
+
.string()
|
|
422
|
+
.optional()
|
|
423
|
+
.describe("Authentication key for the runner."),
|
|
424
|
+
version: z
|
|
425
|
+
.number()
|
|
426
|
+
.optional()
|
|
427
|
+
.describe("Version number of this runner. Default: 1"),
|
|
428
|
+
})
|
|
429
|
+
.describe("Configuration for runner mode.");
|
|
430
|
+
|
|
431
|
+
export const DocRegistryConfigSchema = z
|
|
432
|
+
.object({
|
|
433
|
+
use: z
|
|
434
|
+
.record(z.string(), z.unknown())
|
|
435
|
+
.describe(
|
|
436
|
+
"Actor definitions. Keys are actor names, values are actor definitions.",
|
|
437
|
+
),
|
|
438
|
+
storagePath: z
|
|
439
|
+
.string()
|
|
440
|
+
.optional()
|
|
441
|
+
.describe(
|
|
442
|
+
"Storage path for RivetKit file-system state when using the default driver. Can also be set via RIVETKIT_STORAGE_PATH.",
|
|
443
|
+
),
|
|
444
|
+
maxIncomingMessageSize: z
|
|
445
|
+
.number()
|
|
446
|
+
.optional()
|
|
447
|
+
.describe(
|
|
448
|
+
"Maximum size of incoming WebSocket messages in bytes. Default: 65536",
|
|
449
|
+
),
|
|
450
|
+
maxOutgoingMessageSize: z
|
|
451
|
+
.number()
|
|
452
|
+
.optional()
|
|
453
|
+
.describe(
|
|
454
|
+
"Maximum size of outgoing WebSocket messages in bytes. Default: 1048576",
|
|
455
|
+
),
|
|
456
|
+
noWelcome: z
|
|
457
|
+
.boolean()
|
|
458
|
+
.optional()
|
|
459
|
+
.describe("Disable the welcome message on startup. Default: false"),
|
|
460
|
+
logging: z
|
|
461
|
+
.object({
|
|
462
|
+
level: LogLevelSchema.optional().describe(
|
|
463
|
+
"Log level for RivetKit. Default: 'warn'",
|
|
464
|
+
),
|
|
465
|
+
})
|
|
466
|
+
.optional()
|
|
467
|
+
.describe("Logging configuration."),
|
|
468
|
+
endpoint: z
|
|
469
|
+
.string()
|
|
470
|
+
.optional()
|
|
471
|
+
.describe(
|
|
472
|
+
"Endpoint URL to connect to Rivet Engine. Supports URL auth syntax: https://namespace:token@api.rivet.dev. Can also be set via RIVET_ENDPOINT environment variable.",
|
|
473
|
+
),
|
|
474
|
+
token: z
|
|
475
|
+
.string()
|
|
476
|
+
.optional()
|
|
477
|
+
.describe(
|
|
478
|
+
"Authentication token for Rivet Engine. Can also be set via RIVET_TOKEN environment variable.",
|
|
479
|
+
),
|
|
480
|
+
namespace: z
|
|
481
|
+
.string()
|
|
482
|
+
.optional()
|
|
483
|
+
.describe(
|
|
484
|
+
"Namespace to use. Default: 'default'. Can also be set via RIVET_NAMESPACE environment variable.",
|
|
485
|
+
),
|
|
486
|
+
headers: z
|
|
487
|
+
.record(z.string(), z.string())
|
|
488
|
+
.optional()
|
|
489
|
+
.describe(
|
|
490
|
+
"Additional headers to include in requests to Rivet Engine.",
|
|
491
|
+
),
|
|
492
|
+
serveManager: z
|
|
493
|
+
.boolean()
|
|
494
|
+
.optional()
|
|
495
|
+
.describe(
|
|
496
|
+
"Whether to start the local manager server. Auto-determined based on endpoint and NODE_ENV if not specified.",
|
|
497
|
+
),
|
|
498
|
+
managerBasePath: z
|
|
499
|
+
.string()
|
|
500
|
+
.optional()
|
|
501
|
+
.describe("Base path for the manager API. Default: '/'"),
|
|
502
|
+
managerPort: z
|
|
503
|
+
.number()
|
|
504
|
+
.optional()
|
|
505
|
+
.describe("Port to run the manager on. Default: 6420"),
|
|
506
|
+
inspector: DocInspectorConfigSchema,
|
|
507
|
+
serverless: DocServerlessConfigSchema.optional(),
|
|
508
|
+
runner: DocRunnerConfigSchema.optional(),
|
|
509
|
+
})
|
|
510
|
+
.describe("RivetKit registry configuration.");
|