rivetkit 0.0.0-active-actors-fix-active-count.253e406 → 0.0.0-bisect-sync-sqlite-1.910d1c7
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 +1286 -89
- package/dist/browser/client.js +1699 -704
- package/dist/browser/client.js.map +1 -1
- package/dist/browser/inspector/client.d.ts +252 -129
- package/dist/browser/inspector/client.js +2083 -236
- package/dist/browser/inspector/client.js.map +1 -1
- package/dist/tsup/actor/errors.cjs +8 -2
- package/dist/tsup/actor/errors.cjs.map +1 -1
- package/dist/tsup/actor/errors.d.cts +1 -1
- package/dist/tsup/actor/errors.d.ts +1 -1
- package/dist/tsup/actor/errors.js +7 -1
- package/dist/tsup/agent-os/index.cjs +3 -2289
- package/dist/tsup/agent-os/index.cjs.map +1 -1
- package/dist/tsup/agent-os/index.d.cts +1 -1813
- package/dist/tsup/agent-os/index.d.ts +1 -1813
- package/dist/tsup/agent-os/index.js +3 -2289
- package/dist/tsup/agent-os/index.js.map +1 -1
- package/dist/tsup/chunk-2JJU7IQ7.cjs +14 -0
- package/dist/tsup/chunk-2JJU7IQ7.cjs.map +1 -0
- package/dist/tsup/{chunk-DZJZLZ4R.js → chunk-2MXBZGUP.js} +2 -2
- package/dist/tsup/{chunk-L4FVS7GY.js → chunk-47IS5ZFI.js} +6 -6
- package/dist/tsup/chunk-47IS5ZFI.js.map +1 -0
- package/dist/tsup/{chunk-DXWOGCZY.js → chunk-5XWY5CBA.js} +70 -8
- package/dist/tsup/chunk-5XWY5CBA.js.map +1 -0
- package/dist/tsup/{chunk-OQEEZDIK.cjs → chunk-6XVNZKKP.cjs} +506 -31
- package/dist/tsup/chunk-6XVNZKKP.cjs.map +1 -0
- package/dist/tsup/{chunk-3YY5S6TV.js → chunk-A2CF6PFH.js} +20 -12
- package/dist/tsup/chunk-A2CF6PFH.js.map +1 -0
- package/dist/tsup/{chunk-WQ4HNA4W.cjs → chunk-AQJFKHBK.cjs} +276 -27
- package/dist/tsup/chunk-AQJFKHBK.cjs.map +1 -0
- package/dist/tsup/chunk-DPWLASMC.cjs +244 -0
- package/dist/tsup/chunk-DPWLASMC.cjs.map +1 -0
- package/dist/tsup/{chunk-VUF2YEF4.cjs → chunk-DYJOU3MF.cjs} +10 -10
- package/dist/tsup/chunk-DYJOU3MF.cjs.map +1 -0
- package/dist/tsup/{chunk-7WXCRV25.cjs → chunk-ELZ6MT3V.cjs} +18 -11
- package/dist/tsup/chunk-ELZ6MT3V.cjs.map +1 -0
- package/dist/tsup/chunk-HYIVSH5X.js +244 -0
- package/dist/tsup/chunk-HYIVSH5X.js.map +1 -0
- package/dist/tsup/{chunk-T6YVRM4K.js → chunk-IHEO5OT3.js} +275 -26
- package/dist/tsup/chunk-IHEO5OT3.js.map +1 -0
- package/dist/tsup/chunk-IWACVNN5.js +14 -0
- package/dist/tsup/chunk-IWACVNN5.js.map +1 -0
- package/dist/tsup/{chunk-PCBNKI2J.js → chunk-JTHHCZCZ.js} +24 -1
- package/dist/tsup/chunk-JTHHCZCZ.js.map +1 -0
- package/dist/tsup/{chunk-V4JUWAT6.js → chunk-K3AJOPSF.js} +498 -23
- package/dist/tsup/chunk-K3AJOPSF.js.map +1 -0
- package/dist/tsup/{chunk-2NDZ7JCR.cjs → chunk-KVFIONKQ.cjs} +25 -2
- package/dist/tsup/chunk-KVFIONKQ.cjs.map +1 -0
- package/dist/tsup/{chunk-QAZLM4WT.cjs → chunk-MGI2VVF6.cjs} +45 -9
- package/dist/tsup/chunk-MGI2VVF6.cjs.map +1 -0
- package/dist/tsup/{chunk-QNLGOTQP.js → chunk-NPHTIUUJ.js} +1291 -420
- package/dist/tsup/chunk-NPHTIUUJ.js.map +1 -0
- package/dist/tsup/{chunk-7GKQJFSB.cjs → chunk-POCSZXPQ.cjs} +72 -10
- package/dist/tsup/chunk-POCSZXPQ.cjs.map +1 -0
- package/dist/tsup/{chunk-LD5YASJU.cjs → chunk-RTWH3AX3.cjs} +19 -11
- package/dist/tsup/chunk-RTWH3AX3.cjs.map +1 -0
- package/dist/tsup/{chunk-ARRBQTAR.cjs → chunk-X76BM5JS.cjs} +1420 -549
- package/dist/tsup/chunk-X76BM5JS.cjs.map +1 -0
- package/dist/tsup/{chunk-AGBP757I.js → chunk-X7SYKFPM.js} +16 -9
- package/dist/tsup/chunk-X7SYKFPM.js.map +1 -0
- package/dist/tsup/{chunk-GKAMEBTZ.cjs → chunk-XLDJSZ3B.cjs} +3 -3
- package/dist/tsup/{chunk-GKAMEBTZ.cjs.map → chunk-XLDJSZ3B.cjs.map} +1 -1
- package/dist/tsup/{chunk-KIWH5H3K.js → chunk-ZOVJDAOW.js} +44 -8
- package/dist/tsup/chunk-ZOVJDAOW.js.map +1 -0
- package/dist/tsup/client/mod.cjs +8 -9
- package/dist/tsup/client/mod.cjs.map +1 -1
- package/dist/tsup/client/mod.d.cts +33 -7
- package/dist/tsup/client/mod.d.ts +33 -7
- package/dist/tsup/client/mod.js +7 -8
- package/dist/tsup/common/log.cjs +5 -3
- package/dist/tsup/common/log.cjs.map +1 -1
- package/dist/tsup/common/log.d.cts +5 -1
- package/dist/tsup/common/log.d.ts +5 -1
- package/dist/tsup/common/log.js +6 -4
- package/dist/tsup/common/websocket.cjs +4 -4
- package/dist/tsup/common/websocket.js +3 -3
- package/dist/tsup/{config-nlTlOKaE.d.cts → config-BMGUEKMZ.d.cts} +1252 -75
- package/dist/tsup/config-CBTr4IhE.d.cts +224 -0
- package/dist/tsup/config-CBTr4IhE.d.ts +224 -0
- package/dist/tsup/{config-D7ykAntK.d.ts → config-iBpXyITj.d.ts} +1252 -75
- package/dist/tsup/context-hyVakgnU.d.ts +136 -0
- package/dist/tsup/context-qfvLuF0P.d.cts +136 -0
- package/dist/tsup/db/drizzle.cjs +127 -67
- package/dist/tsup/db/drizzle.cjs.map +1 -1
- package/dist/tsup/db/drizzle.d.cts +8 -4
- package/dist/tsup/db/drizzle.d.ts +8 -4
- package/dist/tsup/db/drizzle.js +127 -67
- package/dist/tsup/db/drizzle.js.map +1 -1
- package/dist/tsup/db/mod.cjs +6 -124
- package/dist/tsup/db/mod.cjs.map +1 -1
- package/dist/tsup/db/mod.d.cts +12 -4
- package/dist/tsup/db/mod.d.ts +12 -4
- package/dist/tsup/db/mod.js +5 -123
- package/dist/tsup/db/mod.js.map +1 -1
- package/dist/tsup/dynamic/mod.cjs +24 -0
- package/dist/tsup/dynamic/mod.cjs.map +1 -0
- package/dist/tsup/dynamic/mod.d.cts +39 -0
- package/dist/tsup/dynamic/mod.d.ts +39 -0
- package/dist/tsup/dynamic/mod.js +24 -0
- package/dist/tsup/dynamic/mod.js.map +1 -0
- package/dist/tsup/inspector/mod.cjs +47 -12
- package/dist/tsup/inspector/mod.cjs.map +1 -1
- package/dist/tsup/inspector/mod.d.cts +26 -136
- package/dist/tsup/inspector/mod.d.ts +26 -136
- package/dist/tsup/inspector/mod.js +46 -11
- package/dist/tsup/inspector/mod.js.map +1 -1
- package/dist/tsup/inspector/workflow.cjs +21 -0
- package/dist/tsup/inspector/workflow.cjs.map +1 -0
- package/dist/tsup/inspector/workflow.d.cts +144 -0
- package/dist/tsup/inspector/workflow.d.ts +144 -0
- package/dist/tsup/inspector/workflow.js +21 -0
- package/dist/tsup/inspector/workflow.js.map +1 -0
- package/dist/tsup/inspector-tab/mod.cjs +162 -0
- package/dist/tsup/inspector-tab/mod.cjs.map +1 -0
- package/dist/tsup/inspector-tab/mod.d.cts +242 -0
- package/dist/tsup/inspector-tab/mod.d.ts +242 -0
- package/dist/tsup/inspector-tab/mod.js +162 -0
- package/dist/tsup/inspector-tab/mod.js.map +1 -0
- package/dist/tsup/mod.cjs +3527 -753
- package/dist/tsup/mod.cjs.map +1 -1
- package/dist/tsup/mod.d.cts +11 -7
- package/dist/tsup/mod.d.ts +11 -7
- package/dist/tsup/mod.js +3468 -694
- package/dist/tsup/mod.js.map +1 -1
- package/dist/tsup/test/mod.cjs +26 -21
- package/dist/tsup/test/mod.cjs.map +1 -1
- package/dist/tsup/test/mod.d.cts +7 -5
- package/dist/tsup/test/mod.d.ts +7 -5
- package/dist/tsup/test/mod.js +25 -20
- package/dist/tsup/test/mod.js.map +1 -1
- package/dist/tsup/unstable/migrations.cjs +101 -0
- package/dist/tsup/unstable/migrations.cjs.map +1 -0
- package/dist/tsup/unstable/migrations.d.cts +29 -0
- package/dist/tsup/unstable/migrations.d.ts +29 -0
- package/dist/tsup/unstable/migrations.js +101 -0
- package/dist/tsup/unstable/migrations.js.map +1 -0
- package/dist/tsup/{utils-DVekpm4I.d.ts → utils-3rsE0JvI.d.cts} +26 -2
- package/dist/tsup/{utils-DVekpm4I.d.cts → utils-3rsE0JvI.d.ts} +26 -2
- package/dist/tsup/utils-C1O-SklO.d.ts +162 -0
- package/dist/tsup/utils-C6b0aYUM.d.cts +162 -0
- package/dist/tsup/utils.cjs +7 -3
- package/dist/tsup/utils.cjs.map +1 -1
- package/dist/tsup/utils.d.cts +4 -147
- package/dist/tsup/utils.d.ts +4 -147
- package/dist/tsup/utils.js +6 -2
- package/dist/tsup/workflow/mod.cjs +557 -410
- package/dist/tsup/workflow/mod.cjs.map +1 -1
- package/dist/tsup/workflow/mod.d.cts +11 -9
- package/dist/tsup/workflow/mod.d.ts +11 -9
- package/dist/tsup/workflow/mod.js +551 -404
- package/dist/tsup/workflow/mod.js.map +1 -1
- package/package.json +67 -18
- package/src/actor/actions.ts +155 -0
- package/src/actor/config.ts +679 -101
- package/src/actor/contexts/index.ts +9 -2
- package/src/actor/definition.ts +75 -26
- package/src/actor/errors.ts +107 -8
- package/src/actor/keys.ts +87 -1
- package/src/actor/mod.ts +36 -20
- package/src/actor/schema.ts +6 -2
- package/src/actor/tracing.ts +28 -0
- package/src/agent-os/index.ts +5 -64
- package/src/client/actor-common.ts +84 -54
- package/src/client/actor-conn.ts +231 -68
- package/src/client/actor-handle.ts +283 -89
- package/src/client/actor-query.ts +13 -6
- package/src/client/auth.ts +37 -0
- package/src/client/client.ts +182 -21
- package/src/client/config.ts +28 -3
- package/src/client/errors.ts +15 -2
- package/src/client/lifecycle-errors.ts +63 -5
- package/src/client/mod.ts +10 -0
- package/src/client/outbound-telemetry.ts +66 -0
- package/src/client/query.ts +3 -1
- package/src/client/queue.ts +13 -3
- package/src/client/raw-utils.ts +59 -14
- package/src/client/resolve-gateway-target.ts +3 -1
- package/src/client/retry-budget.ts +81 -0
- package/src/client/token-provider.ts +93 -0
- package/src/client/utils.ts +22 -9
- package/src/common/actor-router-consts.ts +6 -0
- package/src/common/actor-telemetry-context.ts +19 -0
- package/src/common/actor-websocket.ts +3 -1
- package/src/common/bare/actor-persist/v1.ts +205 -163
- package/src/common/bare/actor-persist/v2.ts +265 -213
- package/src/common/bare/actor-persist/v3.ts +176 -172
- package/src/common/bare/actor-persist/v4.ts +254 -253
- package/src/common/bare/generated/inspector/v5.ts +1016 -0
- package/src/common/bare/generated/inspector/v6.ts +1367 -0
- package/src/common/bare/transport/v1.ts +694 -542
- package/src/common/client-protocol-versioned.ts +66 -64
- package/src/common/database/config.ts +175 -9
- package/src/common/database/mod.ts +262 -77
- package/src/common/database/native-database.ts +442 -20
- package/src/common/database/shared.ts +25 -0
- package/src/common/encoding.ts +278 -34
- package/src/common/engine.ts +28 -1
- package/src/common/eventsource.ts +1 -1
- package/src/common/fetch-like.ts +63 -0
- package/src/common/inline-websocket-adapter.ts +14 -13
- package/src/common/inspector-transport.ts +12 -2
- package/src/common/log.ts +15 -8
- package/src/common/otel-context.ts +99 -0
- package/src/common/router.ts +14 -18
- package/src/common/utils.ts +8 -169
- package/src/common/websocket-interface.ts +1 -1
- package/src/db/drizzle.ts +182 -80
- package/src/db/mod.ts +5 -1
- package/src/devtools-loader/index.ts +4 -7
- package/src/devtools-loader/serve-devtools.ts +26 -0
- package/src/dynamic/instance.ts +32 -0
- package/src/dynamic/internal.ts +50 -0
- package/src/dynamic/isolate-runtime.ts +64 -0
- package/src/dynamic/mod.ts +32 -0
- package/src/engine-api/actors.ts +15 -3
- package/src/engine-client/actor-http-client.ts +37 -22
- package/src/engine-client/actor-websocket-client.ts +37 -9
- package/src/engine-client/api-endpoints.ts +128 -5
- package/src/engine-client/api-utils.ts +2 -2
- package/src/engine-client/driver.ts +21 -16
- package/src/engine-client/mod.ts +280 -111
- package/src/engine-client/ws-proxy.ts +9 -4
- package/src/inspector/client.browser.ts +127 -15
- package/src/inspector/mod.ts +2 -4
- package/src/inspector/workflow.ts +61 -0
- package/src/inspector-tab/mod.ts +301 -0
- package/src/registry/config/envoy.ts +3 -20
- package/src/registry/config/index.ts +91 -74
- package/src/registry/index.ts +702 -80
- package/src/registry/napi-runtime.ts +643 -42
- package/src/registry/native-http.ts +225 -0
- package/src/registry/native-validation.ts +10 -12
- package/src/registry/native.ts +1881 -582
- package/src/registry/run-handler-coordinator.ts +219 -0
- package/src/registry/runtime.ts +441 -7
- package/src/registry/wasm-runtime.ts +516 -23
- package/src/registry/write-through-proxy.ts +141 -0
- package/src/serde.ts +2 -2
- package/src/serverless/configure.ts +18 -7
- package/src/test/mod.ts +2 -17
- package/src/test/ready.ts +22 -0
- package/src/unstable/migrations.ts +141 -0
- package/src/utils/endpoint-parser.ts +1 -1
- package/src/utils/env-vars.ts +50 -2
- package/src/utils/node.ts +44 -28
- package/src/utils/router.ts +1 -1
- package/src/utils.ts +4 -2
- package/src/workflow/context.ts +703 -242
- package/src/workflow/driver.ts +284 -125
- package/src/workflow/inspector.ts +24 -24
- package/src/workflow/mod.ts +76 -84
- package/dist/tsup/chunk-2NDZ7JCR.cjs.map +0 -1
- package/dist/tsup/chunk-3YY5S6TV.js.map +0 -1
- package/dist/tsup/chunk-6NT2LIFN.cjs +0 -268
- package/dist/tsup/chunk-6NT2LIFN.cjs.map +0 -1
- package/dist/tsup/chunk-7GKQJFSB.cjs.map +0 -1
- package/dist/tsup/chunk-7WXCRV25.cjs.map +0 -1
- package/dist/tsup/chunk-AGBP757I.js.map +0 -1
- package/dist/tsup/chunk-ARRBQTAR.cjs.map +0 -1
- package/dist/tsup/chunk-DXWOGCZY.js.map +0 -1
- package/dist/tsup/chunk-JGIPV3QU.js +0 -268
- package/dist/tsup/chunk-JGIPV3QU.js.map +0 -1
- package/dist/tsup/chunk-KIWH5H3K.js.map +0 -1
- package/dist/tsup/chunk-L4FVS7GY.js.map +0 -1
- package/dist/tsup/chunk-LD5YASJU.cjs.map +0 -1
- package/dist/tsup/chunk-OQEEZDIK.cjs.map +0 -1
- package/dist/tsup/chunk-PCBNKI2J.js.map +0 -1
- package/dist/tsup/chunk-QAZLM4WT.cjs.map +0 -1
- package/dist/tsup/chunk-QNLGOTQP.js.map +0 -1
- package/dist/tsup/chunk-T6YVRM4K.js.map +0 -1
- package/dist/tsup/chunk-V4JUWAT6.js.map +0 -1
- package/dist/tsup/chunk-VUF2YEF4.cjs.map +0 -1
- package/dist/tsup/chunk-WQ4HNA4W.cjs.map +0 -1
- package/dist/tsup/config-CxjGYf4K.d.cts +0 -121
- package/dist/tsup/config-CxjGYf4K.d.ts +0 -121
- package/dist/tsup/context-88opQsfZ.d.cts +0 -92
- package/dist/tsup/context-CVEG5zfg.d.ts +0 -92
- package/src/actor/driver.ts +0 -141
- package/src/actor/instance/mod.ts +0 -2492
- package/src/actor/keys.test.ts +0 -275
- package/src/actor/utils.test.ts +0 -48
- package/src/agent-os/actor/cron.ts +0 -84
- package/src/agent-os/actor/db.ts +0 -54
- package/src/agent-os/actor/filesystem.ts +0 -131
- package/src/agent-os/actor/index.ts +0 -265
- package/src/agent-os/actor/network.ts +0 -58
- package/src/agent-os/actor/preview.ts +0 -191
- package/src/agent-os/actor/process.ts +0 -177
- package/src/agent-os/actor/session.ts +0 -518
- package/src/agent-os/actor/shell.ts +0 -60
- package/src/agent-os/config.ts +0 -79
- package/src/agent-os/fs/database-vfs.ts +0 -624
- package/src/agent-os/types.ts +0 -148
- package/src/client/test.ts +0 -44
- package/src/common/database/mod.test.ts +0 -137
- package/src/common/database/native-database.test.ts +0 -211
- package/src/common/inline-websocket-adapter.test.ts +0 -51
- package/src/drivers/engine/actor-driver.ts +0 -2460
- package/src/registry/runtime.test.ts +0 -50
- package/src/utils/endpoint-parser.test.ts +0 -206
- package/src/utils/serve.ts +0 -217
- package/src/utils.test.ts +0 -34
- /package/dist/tsup/{chunk-DZJZLZ4R.js.map → chunk-2MXBZGUP.js.map} +0 -0
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
INTERNAL_ERROR_CODE,
|
|
3
3
|
INTERNAL_ERROR_DESCRIPTION,
|
|
4
|
-
RivetError
|
|
5
|
-
|
|
4
|
+
RivetError,
|
|
5
|
+
isCanonicalStructuredRivetError
|
|
6
|
+
} from "./chunk-ZOVJDAOW.js";
|
|
6
7
|
|
|
7
8
|
// src/utils/env-vars.ts
|
|
8
9
|
var getRivetEngine = () => getEnvUniversal("RIVET_ENGINE");
|
|
@@ -15,14 +16,48 @@ var getRivetTotalSlots = () => {
|
|
|
15
16
|
return value !== void 0 ? parseInt(value, 10) : void 0;
|
|
16
17
|
};
|
|
17
18
|
var getRivetRunEngine = () => getEnvUniversal("RIVET_RUN_ENGINE") === "1";
|
|
19
|
+
var getRivetRunEngineHost = () => getEnvUniversal("RIVET_RUN_ENGINE_HOST");
|
|
20
|
+
var getRivetRunEnginePort = () => {
|
|
21
|
+
const value = getEnvUniversal("RIVET_RUN_ENGINE_PORT");
|
|
22
|
+
return value !== void 0 ? parseInt(value, 10) : void 0;
|
|
23
|
+
};
|
|
18
24
|
var getRivetRunEngineVersion = () => getEnvUniversal("RIVET_RUN_ENGINE_VERSION");
|
|
25
|
+
var getRivetRunServices = () => {
|
|
26
|
+
const value = getEnvUniversal("RIVET_RUN_SERVICES");
|
|
27
|
+
return value === void 0 ? void 0 : value === "1";
|
|
28
|
+
};
|
|
19
29
|
var getRivetEnvoyVersion = () => {
|
|
20
|
-
const value = getEnvUniversal("RIVET_ENVOY_VERSION");
|
|
30
|
+
const value = getEnvUniversal("RIVET_NODE_VERSION") ?? getEnvUniversal("RIVET_ENVOY_VERSION");
|
|
21
31
|
return value !== void 0 ? parseInt(value, 10) : void 0;
|
|
22
32
|
};
|
|
23
33
|
var getRivetPublicEndpoint = () => getEnvUniversal("RIVET_PUBLIC_ENDPOINT");
|
|
24
34
|
var getRivetPublicToken = () => getEnvUniversal("RIVET_PUBLIC_TOKEN");
|
|
25
35
|
var getRivetkitRuntime = () => getEnvUniversal("RIVETKIT_RUNTIME");
|
|
36
|
+
var getRivetkitRuntimeMode = () => {
|
|
37
|
+
const value = getEnvUniversal("RIVETKIT_RUNTIME_MODE");
|
|
38
|
+
if (value === void 0 || value === "envoy") return "node";
|
|
39
|
+
if (value === "serverless") {
|
|
40
|
+
throw new Error("serverless is disabled in this version");
|
|
41
|
+
}
|
|
42
|
+
if (value === "node") return value;
|
|
43
|
+
throw new Error(
|
|
44
|
+
`RIVETKIT_RUNTIME_MODE env var must be "node" or "serverless"; got "${value}"`
|
|
45
|
+
);
|
|
46
|
+
};
|
|
47
|
+
var getRivetkitPublicDir = () => {
|
|
48
|
+
const value = getEnvUniversal("RIVETKIT_PUBLIC_DIR");
|
|
49
|
+
return value === void 0 || value === "" ? void 0 : value;
|
|
50
|
+
};
|
|
51
|
+
function parsePortEnv(raw) {
|
|
52
|
+
if (raw === void 0 || raw === "") return void 0;
|
|
53
|
+
const parsed = Number.parseInt(raw, 10);
|
|
54
|
+
if (!Number.isFinite(parsed) || parsed < 1 || parsed > 65535 || String(parsed) !== raw.trim()) {
|
|
55
|
+
throw new Error(
|
|
56
|
+
`RIVET_PORT env var must be an integer between 1 and 65535; got "${raw}"`
|
|
57
|
+
);
|
|
58
|
+
}
|
|
59
|
+
return parsed;
|
|
60
|
+
}
|
|
26
61
|
var getLogLevel = () => getEnvUniversal("RIVET_LOG_LEVEL") ?? getEnvUniversal("LOG_LEVEL");
|
|
27
62
|
var getLogTarget = () => getEnvUniversal("RIVET_LOG_TARGET") === "1";
|
|
28
63
|
var getLogTimestamp = () => getEnvUniversal("RIVET_LOG_TIMESTAMP") === "1";
|
|
@@ -36,9 +71,6 @@ var isDev = () => getNodeEnv() !== "production";
|
|
|
36
71
|
function assertUnreachable(x) {
|
|
37
72
|
throw new Error(`Unreachable case: ${x}`);
|
|
38
73
|
}
|
|
39
|
-
function isCanonicalStructuredRivetError(error) {
|
|
40
|
-
return error instanceof RivetError || typeof error === "object" && error !== null && "__type" in error && error.__type === "RivetError" && "group" in error && typeof error.group === "string" && "code" in error && typeof error.code === "string" && "message" in error && typeof error.message === "string";
|
|
41
|
-
}
|
|
42
74
|
function deconstructError(error, exposeInternalError = false) {
|
|
43
75
|
let statusCode;
|
|
44
76
|
let public_;
|
|
@@ -46,6 +78,7 @@ function deconstructError(error, exposeInternalError = false) {
|
|
|
46
78
|
let code;
|
|
47
79
|
let message;
|
|
48
80
|
let metadata;
|
|
81
|
+
let rayId;
|
|
49
82
|
let actor;
|
|
50
83
|
if (isCanonicalStructuredRivetError(error)) {
|
|
51
84
|
statusCode = typeof error.statusCode === "number" ? error.statusCode : error.public ? 400 : 500;
|
|
@@ -54,6 +87,7 @@ function deconstructError(error, exposeInternalError = false) {
|
|
|
54
87
|
code = error.code;
|
|
55
88
|
message = error.message;
|
|
56
89
|
metadata = error.metadata;
|
|
90
|
+
rayId = error.rayId;
|
|
57
91
|
actor = error.actor;
|
|
58
92
|
} else if (RivetError.isActorError(error) && error.public) {
|
|
59
93
|
statusCode = "statusCode" in error && error.statusCode ? error.statusCode : 400;
|
|
@@ -62,6 +96,7 @@ function deconstructError(error, exposeInternalError = false) {
|
|
|
62
96
|
code = error.code;
|
|
63
97
|
message = getErrorMessage(error);
|
|
64
98
|
metadata = error.metadata;
|
|
99
|
+
rayId = error.rayId;
|
|
65
100
|
actor = error.actor;
|
|
66
101
|
} else if (exposeInternalError) {
|
|
67
102
|
if (RivetError.isActorError(error)) {
|
|
@@ -71,6 +106,7 @@ function deconstructError(error, exposeInternalError = false) {
|
|
|
71
106
|
code = error.code;
|
|
72
107
|
message = getErrorMessage(error);
|
|
73
108
|
metadata = error.metadata;
|
|
109
|
+
rayId = error.rayId;
|
|
74
110
|
actor = error.actor;
|
|
75
111
|
} else {
|
|
76
112
|
statusCode = 500;
|
|
@@ -89,7 +125,7 @@ function deconstructError(error, exposeInternalError = false) {
|
|
|
89
125
|
actor = error.actor;
|
|
90
126
|
}
|
|
91
127
|
metadata = {
|
|
92
|
-
//url: `https://
|
|
128
|
+
//url: `https://dashboard.rivet.dev/projects/${actorMetadata.project.slug}/environments/${actorMetadata.environment.slug}/actors?actorId=${actorMetadata.actor.id}`,
|
|
93
129
|
};
|
|
94
130
|
}
|
|
95
131
|
return {
|
|
@@ -100,6 +136,7 @@ function deconstructError(error, exposeInternalError = false) {
|
|
|
100
136
|
code,
|
|
101
137
|
message,
|
|
102
138
|
metadata,
|
|
139
|
+
rayId,
|
|
103
140
|
actor
|
|
104
141
|
};
|
|
105
142
|
}
|
|
@@ -144,7 +181,7 @@ function noopNext() {
|
|
|
144
181
|
// package.json
|
|
145
182
|
var package_default = {
|
|
146
183
|
name: "rivetkit",
|
|
147
|
-
version: "0.0.0-
|
|
184
|
+
version: "0.0.0-bisect-sync-sqlite-1.910d1c7",
|
|
148
185
|
description: "Lightweight libraries for building stateful actors on edge platforms",
|
|
149
186
|
license: "Apache-2.0",
|
|
150
187
|
keywords: [
|
|
@@ -216,6 +253,26 @@ var package_default = {
|
|
|
216
253
|
default: "./dist/tsup/db/drizzle.cjs"
|
|
217
254
|
}
|
|
218
255
|
},
|
|
256
|
+
"./unstable/migrations": {
|
|
257
|
+
import: {
|
|
258
|
+
types: "./dist/tsup/unstable/migrations.d.ts",
|
|
259
|
+
default: "./dist/tsup/unstable/migrations.js"
|
|
260
|
+
},
|
|
261
|
+
require: {
|
|
262
|
+
types: "./dist/tsup/unstable/migrations.d.cts",
|
|
263
|
+
default: "./dist/tsup/unstable/migrations.cjs"
|
|
264
|
+
}
|
|
265
|
+
},
|
|
266
|
+
"./dynamic": {
|
|
267
|
+
import: {
|
|
268
|
+
types: "./dist/tsup/dynamic/mod.d.ts",
|
|
269
|
+
default: "./dist/tsup/dynamic/mod.js"
|
|
270
|
+
},
|
|
271
|
+
require: {
|
|
272
|
+
types: "./dist/tsup/dynamic/mod.d.cts",
|
|
273
|
+
default: "./dist/tsup/dynamic/mod.cjs"
|
|
274
|
+
}
|
|
275
|
+
},
|
|
219
276
|
"./client": {
|
|
220
277
|
import: {
|
|
221
278
|
browser: {
|
|
@@ -260,6 +317,26 @@ var package_default = {
|
|
|
260
317
|
default: "./dist/tsup/inspector/mod.cjs"
|
|
261
318
|
}
|
|
262
319
|
},
|
|
320
|
+
"./experimental/inspector/workflow": {
|
|
321
|
+
import: {
|
|
322
|
+
types: "./dist/tsup/inspector/workflow.d.ts",
|
|
323
|
+
default: "./dist/tsup/inspector/workflow.js"
|
|
324
|
+
},
|
|
325
|
+
require: {
|
|
326
|
+
types: "./dist/tsup/inspector/workflow.d.cts",
|
|
327
|
+
default: "./dist/tsup/inspector/workflow.cjs"
|
|
328
|
+
}
|
|
329
|
+
},
|
|
330
|
+
"./inspector-tab": {
|
|
331
|
+
import: {
|
|
332
|
+
types: "./dist/tsup/inspector-tab/mod.d.ts",
|
|
333
|
+
default: "./dist/tsup/inspector-tab/mod.js"
|
|
334
|
+
},
|
|
335
|
+
require: {
|
|
336
|
+
types: "./dist/tsup/inspector-tab/mod.d.cts",
|
|
337
|
+
default: "./dist/tsup/inspector-tab/mod.cjs"
|
|
338
|
+
}
|
|
339
|
+
},
|
|
263
340
|
"./inspector/client": {
|
|
264
341
|
import: {
|
|
265
342
|
types: "./dist/browser/inspector/client.d.ts",
|
|
@@ -295,7 +372,7 @@ var package_default = {
|
|
|
295
372
|
"./dist/tsup/chunk-*.cjs"
|
|
296
373
|
],
|
|
297
374
|
scripts: {
|
|
298
|
-
build: "tsup src/mod.ts src/client/mod.ts src/common/log.ts src/common/websocket.ts src/actor/errors.ts src/utils.ts src/workflow/mod.ts src/test/mod.ts src/inspector/mod.ts src/db/mod.ts src/db/drizzle.ts && tsup src/agent-os/index.ts --no-clean --out-dir dist/tsup/agent-os",
|
|
375
|
+
build: "tsup src/mod.ts src/client/mod.ts src/common/log.ts src/common/websocket.ts src/actor/errors.ts src/utils.ts src/workflow/mod.ts src/test/mod.ts src/inspector/mod.ts src/inspector/workflow.ts src/inspector-tab/mod.ts src/db/mod.ts src/db/drizzle.ts src/dynamic/mod.ts src/unstable/migrations.ts && tsup src/agent-os/index.ts --no-clean --out-dir dist/tsup/agent-os && node scripts/check-built-commonjs.mjs",
|
|
299
376
|
"build:browser": "tsup --config tsup.browser.config.ts",
|
|
300
377
|
"check-types": "tsc --noEmit",
|
|
301
378
|
lint: "biome check . && pnpm run check:test-skips && pnpm run check:wait-for-comments",
|
|
@@ -312,21 +389,20 @@ var package_default = {
|
|
|
312
389
|
"actor-config-schema-gen": "tsx scripts/actor-config-schema-gen.ts"
|
|
313
390
|
},
|
|
314
391
|
dependencies: {
|
|
315
|
-
"@rivet-dev/agent-os-core": "^0.1.1",
|
|
316
|
-
"@hono/node-server": "^1.18.2",
|
|
317
|
-
"@hono/node-ws": "^1.1.1",
|
|
318
392
|
"@hono/zod-openapi": "^1.1.5",
|
|
393
|
+
"@opentelemetry/api": "^1.1.0",
|
|
319
394
|
"@rivetkit/bare-ts": "^0.6.2",
|
|
395
|
+
"@rivetkit/engine-api-full": "workspace:*",
|
|
320
396
|
"@rivetkit/engine-cli": "workspace:*",
|
|
321
397
|
"@rivetkit/engine-envoy-protocol": "workspace:*",
|
|
398
|
+
"@rivetkit/on-change": "6.0.1",
|
|
322
399
|
"@rivetkit/rivetkit-napi": "workspace:*",
|
|
323
400
|
"@rivetkit/rivetkit-wasm": "workspace:*",
|
|
324
401
|
"@rivetkit/traces": "workspace:*",
|
|
325
402
|
"@rivetkit/virtual-websocket": "workspace:*",
|
|
326
403
|
"@rivetkit/workflow-engine": "workspace:*",
|
|
327
404
|
"cbor-x": "^1.6.0",
|
|
328
|
-
"drizzle-orm": "
|
|
329
|
-
"get-port": "^7.1.0",
|
|
405
|
+
"drizzle-orm": "catalog:",
|
|
330
406
|
hono: "^4.7.0",
|
|
331
407
|
invariant: "^2.2.4",
|
|
332
408
|
"p-retry": "^6.2.1",
|
|
@@ -336,14 +412,16 @@ var package_default = {
|
|
|
336
412
|
zod: "^4.1.0"
|
|
337
413
|
},
|
|
338
414
|
devDependencies: {
|
|
339
|
-
"@copilotkit/llmock": "^1.6.0",
|
|
340
|
-
"@rivet-dev/agent-os-common": "*",
|
|
341
|
-
"@rivet-dev/agent-os-pi": "^0.1.1",
|
|
342
415
|
"@biomejs/biome": "^2.3",
|
|
416
|
+
"@copilotkit/llmock": "^1.6.0",
|
|
417
|
+
"@hono/node-server": "^1.18.2",
|
|
418
|
+
"@hono/node-ws": "^1.1.1",
|
|
419
|
+
"@opentelemetry/sdk-trace-node": "2.11.0",
|
|
343
420
|
"@standard-schema/spec": "^1.0.0",
|
|
344
421
|
"@types/invariant": "^2",
|
|
345
422
|
"@types/node": "^22.13.1",
|
|
346
423
|
eventsource: "^4.0.0",
|
|
424
|
+
"get-port": "^7.1.0",
|
|
347
425
|
tsup: "^8.4.0",
|
|
348
426
|
tsx: "^4.19.4",
|
|
349
427
|
typescript: "^5.7.3",
|
|
@@ -351,6 +429,9 @@ var package_default = {
|
|
|
351
429
|
vitest: "^3.1.1",
|
|
352
430
|
ws: "^8.18.1"
|
|
353
431
|
},
|
|
432
|
+
optionalDependencies: {
|
|
433
|
+
"@rivet-dev/services": "^0.2.5"
|
|
434
|
+
},
|
|
354
435
|
peerDependencies: {
|
|
355
436
|
"drizzle-kit": "^0.31.2",
|
|
356
437
|
eventsource: "^4.0.0",
|
|
@@ -409,16 +490,14 @@ function configureBaseLogger(logger2) {
|
|
|
409
490
|
baseLogger = logger2;
|
|
410
491
|
loggerCache.clear();
|
|
411
492
|
}
|
|
412
|
-
function
|
|
413
|
-
|
|
414
|
-
configuredLogLevel = logLevel;
|
|
415
|
-
}
|
|
416
|
-
baseLogger = pino(
|
|
493
|
+
function makeDefaultLogger(logLevel) {
|
|
494
|
+
return pino(
|
|
417
495
|
{
|
|
418
496
|
level: getPinoLevel(logLevel),
|
|
419
497
|
messageKey: "msg",
|
|
420
498
|
// Do not include pid/hostname in output
|
|
421
499
|
base: {},
|
|
500
|
+
errorKey: "error",
|
|
422
501
|
// Keep the numeric level so the logfmt sink can match Pino's levels.
|
|
423
502
|
formatters: {
|
|
424
503
|
level(_label, number) {
|
|
@@ -429,6 +508,12 @@ function configureDefaultLogger(logLevel) {
|
|
|
429
508
|
},
|
|
430
509
|
createLogfmtDestination()
|
|
431
510
|
);
|
|
511
|
+
}
|
|
512
|
+
function configureDefaultLogger(logLevel) {
|
|
513
|
+
if (logLevel) {
|
|
514
|
+
configuredLogLevel = logLevel;
|
|
515
|
+
}
|
|
516
|
+
baseLogger = makeDefaultLogger(logLevel);
|
|
432
517
|
loggerCache.clear();
|
|
433
518
|
}
|
|
434
519
|
function getBaseLogger() {
|
|
@@ -524,6 +609,378 @@ function quoteLogfmtString(value) {
|
|
|
524
609
|
return `"${value.replace(/\\/g, "\\\\").replace(/"/g, '\\"').replace(/\n/g, "\\n")}"`;
|
|
525
610
|
}
|
|
526
611
|
|
|
612
|
+
// src/common/encoding.ts
|
|
613
|
+
import { z as z2 } from "zod/v4";
|
|
614
|
+
|
|
615
|
+
// src/serde.ts
|
|
616
|
+
import * as cbor from "cbor-x";
|
|
617
|
+
import invariant from "invariant";
|
|
618
|
+
function uint8ArrayToBase64(uint8Array) {
|
|
619
|
+
if (typeof Buffer !== "undefined") {
|
|
620
|
+
return Buffer.from(uint8Array).toString("base64");
|
|
621
|
+
}
|
|
622
|
+
let binary = "";
|
|
623
|
+
const len = uint8Array.byteLength;
|
|
624
|
+
for (let i = 0; i < len; i++) {
|
|
625
|
+
binary += String.fromCharCode(uint8Array[i]);
|
|
626
|
+
}
|
|
627
|
+
return btoa(binary);
|
|
628
|
+
}
|
|
629
|
+
function contentTypeForEncoding(encoding) {
|
|
630
|
+
if (encoding === "json") {
|
|
631
|
+
return "application/json";
|
|
632
|
+
} else if (encoding === "cbor" || encoding === "bare") {
|
|
633
|
+
return "application/octet-stream";
|
|
634
|
+
} else {
|
|
635
|
+
assertUnreachable(encoding);
|
|
636
|
+
}
|
|
637
|
+
}
|
|
638
|
+
function encodeCborCompat(value) {
|
|
639
|
+
return cbor.encode(encodeJsonCompatValue(value));
|
|
640
|
+
}
|
|
641
|
+
function decodeCborCompat(buffer) {
|
|
642
|
+
return reviveJsonCompatValue(cbor.decode(buffer));
|
|
643
|
+
}
|
|
644
|
+
function serializeWithEncoding(encoding, value, versionedDataHandler, version, zodSchema, toJson, toBare) {
|
|
645
|
+
if (encoding === "json") {
|
|
646
|
+
const jsonValue = toJson(value);
|
|
647
|
+
const validated = zodSchema.parse(jsonValue);
|
|
648
|
+
return jsonStringifyCompat(validated);
|
|
649
|
+
} else if (encoding === "cbor") {
|
|
650
|
+
const jsonValue = toJson(value);
|
|
651
|
+
const validated = zodSchema.parse(jsonValue);
|
|
652
|
+
return cbor.encode(validated);
|
|
653
|
+
} else if (encoding === "bare") {
|
|
654
|
+
if (!versionedDataHandler) {
|
|
655
|
+
throw new Error(
|
|
656
|
+
"VersionedDataHandler is required for 'bare' encoding"
|
|
657
|
+
);
|
|
658
|
+
}
|
|
659
|
+
if (version === void 0) {
|
|
660
|
+
throw new Error("version is required for 'bare' encoding");
|
|
661
|
+
}
|
|
662
|
+
const bareValue = toBare(value);
|
|
663
|
+
return versionedDataHandler.serializeWithEmbeddedVersion(
|
|
664
|
+
bareValue,
|
|
665
|
+
version
|
|
666
|
+
);
|
|
667
|
+
} else {
|
|
668
|
+
assertUnreachable(encoding);
|
|
669
|
+
}
|
|
670
|
+
}
|
|
671
|
+
function deserializeWithEncoding(encoding, buffer, versionedDataHandler, zodSchema, fromJson, fromBare) {
|
|
672
|
+
if (encoding === "json") {
|
|
673
|
+
let parsed;
|
|
674
|
+
if (typeof buffer === "string") {
|
|
675
|
+
parsed = jsonParseCompat(buffer);
|
|
676
|
+
} else {
|
|
677
|
+
const decoder = new TextDecoder("utf-8");
|
|
678
|
+
const jsonString = decoder.decode(buffer);
|
|
679
|
+
parsed = jsonParseCompat(jsonString);
|
|
680
|
+
}
|
|
681
|
+
const validated = zodSchema.parse(parsed);
|
|
682
|
+
return fromJson(validated);
|
|
683
|
+
} else if (encoding === "cbor") {
|
|
684
|
+
invariant(
|
|
685
|
+
typeof buffer !== "string",
|
|
686
|
+
"buffer cannot be string for cbor encoding"
|
|
687
|
+
);
|
|
688
|
+
const decoded = decodeCborCompat(buffer);
|
|
689
|
+
const validated = zodSchema.parse(decoded);
|
|
690
|
+
return fromJson(validated);
|
|
691
|
+
} else if (encoding === "bare") {
|
|
692
|
+
invariant(
|
|
693
|
+
typeof buffer !== "string",
|
|
694
|
+
"buffer cannot be string for bare encoding"
|
|
695
|
+
);
|
|
696
|
+
if (!versionedDataHandler) {
|
|
697
|
+
throw new Error(
|
|
698
|
+
"VersionedDataHandler is required for 'bare' encoding"
|
|
699
|
+
);
|
|
700
|
+
}
|
|
701
|
+
const bareValue = versionedDataHandler.deserializeWithEmbeddedVersion(buffer);
|
|
702
|
+
return fromBare(bareValue);
|
|
703
|
+
} else {
|
|
704
|
+
assertUnreachable(encoding);
|
|
705
|
+
}
|
|
706
|
+
}
|
|
707
|
+
|
|
708
|
+
// src/common/encoding.ts
|
|
709
|
+
var JSON_COMPAT_BIGINT = "$BigInt";
|
|
710
|
+
var JSON_COMPAT_ARRAY_BUFFER = "$ArrayBuffer";
|
|
711
|
+
var JSON_COMPAT_UINT8_ARRAY = "$Uint8Array";
|
|
712
|
+
var JSON_COMPAT_UNDEFINED = "$Undefined";
|
|
713
|
+
var JSON_COMPAT_SET = "$Set";
|
|
714
|
+
function isTypedArray(value) {
|
|
715
|
+
return value instanceof Uint8ClampedArray || value instanceof Uint16Array || value instanceof Uint32Array || value instanceof BigUint64Array || value instanceof Int8Array || value instanceof Int16Array || value instanceof Int32Array || value instanceof BigInt64Array || value instanceof Float32Array || value instanceof Float64Array;
|
|
716
|
+
}
|
|
717
|
+
function assertJsonCompatValue(value, path = "") {
|
|
718
|
+
var _a;
|
|
719
|
+
if (value === null || value === void 0 || typeof value === "string" || typeof value === "number" || typeof value === "boolean" || typeof value === "bigint") {
|
|
720
|
+
return;
|
|
721
|
+
}
|
|
722
|
+
if (typeof value === "function") {
|
|
723
|
+
throw new TypeError(
|
|
724
|
+
`Value at ${path || "root"} is a function and is not CBOR serializable`
|
|
725
|
+
);
|
|
726
|
+
}
|
|
727
|
+
if (typeof value === "symbol") {
|
|
728
|
+
throw new TypeError(
|
|
729
|
+
`Value at ${path || "root"} is a symbol and is not CBOR serializable`
|
|
730
|
+
);
|
|
731
|
+
}
|
|
732
|
+
if (value instanceof Date || value instanceof RegExp || value instanceof Error || value instanceof ArrayBuffer || value instanceof Uint8Array || isTypedArray(value)) {
|
|
733
|
+
return;
|
|
734
|
+
}
|
|
735
|
+
if (value instanceof WeakMap) {
|
|
736
|
+
throw new TypeError(
|
|
737
|
+
`Value at ${path || "root"} is a WeakMap and is not CBOR serializable`
|
|
738
|
+
);
|
|
739
|
+
}
|
|
740
|
+
if (value instanceof WeakSet) {
|
|
741
|
+
throw new TypeError(
|
|
742
|
+
`Value at ${path || "root"} is a WeakSet and is not CBOR serializable`
|
|
743
|
+
);
|
|
744
|
+
}
|
|
745
|
+
if (value instanceof WeakRef) {
|
|
746
|
+
throw new TypeError(
|
|
747
|
+
`Value at ${path || "root"} is a WeakRef and is not CBOR serializable`
|
|
748
|
+
);
|
|
749
|
+
}
|
|
750
|
+
if (value instanceof Promise) {
|
|
751
|
+
throw new TypeError(
|
|
752
|
+
`Value at ${path || "root"} is a Promise and is not CBOR serializable`
|
|
753
|
+
);
|
|
754
|
+
}
|
|
755
|
+
if (value instanceof Map) {
|
|
756
|
+
for (const [k, v] of value.entries()) {
|
|
757
|
+
assertJsonCompatValue(k, `${path || "root"}.key(${String(k)})`);
|
|
758
|
+
assertJsonCompatValue(v, `${path || "root"}.value(${String(k)})`);
|
|
759
|
+
}
|
|
760
|
+
return;
|
|
761
|
+
}
|
|
762
|
+
if (value instanceof Set) {
|
|
763
|
+
let index = 0;
|
|
764
|
+
for (const item of value.values()) {
|
|
765
|
+
assertJsonCompatValue(item, `${path || "root"}.set[${index}]`);
|
|
766
|
+
index++;
|
|
767
|
+
}
|
|
768
|
+
return;
|
|
769
|
+
}
|
|
770
|
+
if (Array.isArray(value)) {
|
|
771
|
+
for (let i = 0; i < value.length; i++) {
|
|
772
|
+
assertJsonCompatValue(value[i], `${path || "root"}[${i}]`);
|
|
773
|
+
}
|
|
774
|
+
return;
|
|
775
|
+
}
|
|
776
|
+
if (isPlainObject(value)) {
|
|
777
|
+
for (const key in value) {
|
|
778
|
+
assertJsonCompatValue(
|
|
779
|
+
value[key],
|
|
780
|
+
path ? `${path}.${key}` : key
|
|
781
|
+
);
|
|
782
|
+
}
|
|
783
|
+
return;
|
|
784
|
+
}
|
|
785
|
+
const typeName = typeof value === "object" && value !== null ? ((_a = value.constructor) == null ? void 0 : _a.name) ?? typeof value : typeof value;
|
|
786
|
+
throw new TypeError(
|
|
787
|
+
`Value at ${path || "root"} of type "${typeName}" is not CBOR serializable`
|
|
788
|
+
);
|
|
789
|
+
}
|
|
790
|
+
var EncodingSchema = z2.enum(["json", "cbor", "bare"]);
|
|
791
|
+
async function inputDataToBuffer(data) {
|
|
792
|
+
if (typeof data === "string") {
|
|
793
|
+
return data;
|
|
794
|
+
}
|
|
795
|
+
if (data instanceof Blob) {
|
|
796
|
+
return new Uint8Array(await data.arrayBuffer());
|
|
797
|
+
}
|
|
798
|
+
if (data instanceof Uint8Array) {
|
|
799
|
+
return data;
|
|
800
|
+
}
|
|
801
|
+
if (data instanceof ArrayBuffer || data instanceof SharedArrayBuffer) {
|
|
802
|
+
return new Uint8Array(data);
|
|
803
|
+
}
|
|
804
|
+
throw new Error("Malformed message");
|
|
805
|
+
}
|
|
806
|
+
function base64EncodeUint8Array(uint8Array) {
|
|
807
|
+
let binary = "";
|
|
808
|
+
for (const value of uint8Array) {
|
|
809
|
+
binary += String.fromCharCode(value);
|
|
810
|
+
}
|
|
811
|
+
return btoa(binary);
|
|
812
|
+
}
|
|
813
|
+
function base64EncodeArrayBuffer(arrayBuffer) {
|
|
814
|
+
return base64EncodeUint8Array(new Uint8Array(arrayBuffer));
|
|
815
|
+
}
|
|
816
|
+
function isPlainObject(value) {
|
|
817
|
+
if (value === null || typeof value !== "object") {
|
|
818
|
+
return false;
|
|
819
|
+
}
|
|
820
|
+
const proto = Object.getPrototypeOf(value);
|
|
821
|
+
return proto === Object.prototype || proto === null;
|
|
822
|
+
}
|
|
823
|
+
function encodeJsonCompatValue(input) {
|
|
824
|
+
var _a;
|
|
825
|
+
if (input === null) {
|
|
826
|
+
return input;
|
|
827
|
+
}
|
|
828
|
+
if (input === void 0) {
|
|
829
|
+
return [JSON_COMPAT_UNDEFINED, 0];
|
|
830
|
+
}
|
|
831
|
+
if (typeof input === "string" || typeof input === "number" || typeof input === "boolean") {
|
|
832
|
+
return input;
|
|
833
|
+
}
|
|
834
|
+
if (typeof input === "bigint") {
|
|
835
|
+
return [JSON_COMPAT_BIGINT, input.toString()];
|
|
836
|
+
}
|
|
837
|
+
if (input instanceof ArrayBuffer) {
|
|
838
|
+
return [JSON_COMPAT_ARRAY_BUFFER, base64EncodeArrayBuffer(input)];
|
|
839
|
+
}
|
|
840
|
+
if (input instanceof Uint8Array) {
|
|
841
|
+
return [JSON_COMPAT_UINT8_ARRAY, base64EncodeUint8Array(input)];
|
|
842
|
+
}
|
|
843
|
+
if (isTypedArray(input)) {
|
|
844
|
+
return input;
|
|
845
|
+
}
|
|
846
|
+
if (input instanceof Date || input instanceof RegExp || input instanceof Error) {
|
|
847
|
+
return input;
|
|
848
|
+
}
|
|
849
|
+
if (input instanceof Set) {
|
|
850
|
+
const encoded = [...input.values()].map(
|
|
851
|
+
(v) => encodeJsonCompatValue(v)
|
|
852
|
+
);
|
|
853
|
+
return [JSON_COMPAT_SET, encoded];
|
|
854
|
+
}
|
|
855
|
+
if (input instanceof Map) {
|
|
856
|
+
const encoded = /* @__PURE__ */ new Map();
|
|
857
|
+
for (const [k, v] of input.entries()) {
|
|
858
|
+
encoded.set(
|
|
859
|
+
encodeJsonCompatValue(k),
|
|
860
|
+
encodeJsonCompatValue(v)
|
|
861
|
+
);
|
|
862
|
+
}
|
|
863
|
+
return encoded;
|
|
864
|
+
}
|
|
865
|
+
if (Array.isArray(input)) {
|
|
866
|
+
const encoded = input.map(
|
|
867
|
+
(value) => encodeJsonCompatValue(value)
|
|
868
|
+
);
|
|
869
|
+
if (encoded.length === 2 && typeof encoded[0] === "string" && encoded[0].startsWith("$")) {
|
|
870
|
+
return [`$${encoded[0]}`, encoded[1]];
|
|
871
|
+
}
|
|
872
|
+
return encoded;
|
|
873
|
+
}
|
|
874
|
+
if (isPlainObject(input)) {
|
|
875
|
+
const encoded = {};
|
|
876
|
+
for (const [key, value] of Object.entries(input)) {
|
|
877
|
+
encoded[key] = encodeJsonCompatValue(value);
|
|
878
|
+
}
|
|
879
|
+
return encoded;
|
|
880
|
+
}
|
|
881
|
+
const typeName = typeof input === "object" && input !== null ? ((_a = input.constructor) == null ? void 0 : _a.name) ?? typeof input : typeof input;
|
|
882
|
+
throw new TypeError(`Value of type "${typeName}" is not CBOR serializable`);
|
|
883
|
+
}
|
|
884
|
+
function reviveJsonCompatValue(input, options = {}) {
|
|
885
|
+
if (typeof input === "bigint") {
|
|
886
|
+
if (options.coerceSafeIntegerBigInts && input >= BigInt(Number.MIN_SAFE_INTEGER) && input <= BigInt(Number.MAX_SAFE_INTEGER)) {
|
|
887
|
+
return Number(input);
|
|
888
|
+
}
|
|
889
|
+
return input;
|
|
890
|
+
}
|
|
891
|
+
if (input instanceof Map) {
|
|
892
|
+
const revived = /* @__PURE__ */ new Map();
|
|
893
|
+
for (const [k, v] of input.entries()) {
|
|
894
|
+
revived.set(
|
|
895
|
+
reviveJsonCompatValue(k, options),
|
|
896
|
+
reviveJsonCompatValue(v, options)
|
|
897
|
+
);
|
|
898
|
+
}
|
|
899
|
+
return revived;
|
|
900
|
+
}
|
|
901
|
+
if (Array.isArray(input)) {
|
|
902
|
+
if (input.length === 2 && typeof input[0] === "string" && input[0].startsWith("$")) {
|
|
903
|
+
if (input[0] === JSON_COMPAT_BIGINT) {
|
|
904
|
+
return BigInt(input[1]);
|
|
905
|
+
}
|
|
906
|
+
if (input[0] === JSON_COMPAT_ARRAY_BUFFER) {
|
|
907
|
+
return base64DecodeToArrayBuffer(input[1]);
|
|
908
|
+
}
|
|
909
|
+
if (input[0] === JSON_COMPAT_UINT8_ARRAY) {
|
|
910
|
+
return base64DecodeToUint8Array(input[1]);
|
|
911
|
+
}
|
|
912
|
+
if (input[0] === JSON_COMPAT_UNDEFINED) {
|
|
913
|
+
return void 0;
|
|
914
|
+
}
|
|
915
|
+
if (input[0] === JSON_COMPAT_SET) {
|
|
916
|
+
const items = input[1].map(
|
|
917
|
+
(v) => reviveJsonCompatValue(v, options)
|
|
918
|
+
);
|
|
919
|
+
return new Set(items);
|
|
920
|
+
}
|
|
921
|
+
if (input[0].startsWith("$$")) {
|
|
922
|
+
return [
|
|
923
|
+
input[0].substring(1),
|
|
924
|
+
reviveJsonCompatValue(input[1], options)
|
|
925
|
+
];
|
|
926
|
+
}
|
|
927
|
+
throw new Error(
|
|
928
|
+
`Unknown JSON encoding type: ${input[0]}. This may indicate corrupted data or a version mismatch.`
|
|
929
|
+
);
|
|
930
|
+
}
|
|
931
|
+
return input.map((value) => reviveJsonCompatValue(value, options));
|
|
932
|
+
}
|
|
933
|
+
if (isPlainObject(input)) {
|
|
934
|
+
const decoded = {};
|
|
935
|
+
for (const [key, value] of Object.entries(input)) {
|
|
936
|
+
decoded[key] = reviveJsonCompatValue(value, options);
|
|
937
|
+
}
|
|
938
|
+
return decoded;
|
|
939
|
+
}
|
|
940
|
+
return input;
|
|
941
|
+
}
|
|
942
|
+
function base64DecodeToUint8Array(base64) {
|
|
943
|
+
if (typeof Buffer !== "undefined") {
|
|
944
|
+
return new Uint8Array(Buffer.from(base64, "base64"));
|
|
945
|
+
}
|
|
946
|
+
const binary = atob(base64);
|
|
947
|
+
const bytes = new Uint8Array(binary.length);
|
|
948
|
+
for (let i = 0; i < binary.length; i++) {
|
|
949
|
+
bytes[i] = binary.charCodeAt(i);
|
|
950
|
+
}
|
|
951
|
+
return bytes;
|
|
952
|
+
}
|
|
953
|
+
function base64DecodeToArrayBuffer(base64) {
|
|
954
|
+
return base64DecodeToUint8Array(base64).buffer;
|
|
955
|
+
}
|
|
956
|
+
function jsonStringifyCompat(input, space) {
|
|
957
|
+
return JSON.stringify(
|
|
958
|
+
input,
|
|
959
|
+
(_key, value) => {
|
|
960
|
+
if (typeof value === "bigint") {
|
|
961
|
+
return [JSON_COMPAT_BIGINT, value.toString()];
|
|
962
|
+
}
|
|
963
|
+
if (value instanceof ArrayBuffer) {
|
|
964
|
+
return [
|
|
965
|
+
JSON_COMPAT_ARRAY_BUFFER,
|
|
966
|
+
base64EncodeArrayBuffer(value)
|
|
967
|
+
];
|
|
968
|
+
}
|
|
969
|
+
if (value instanceof Uint8Array) {
|
|
970
|
+
return [JSON_COMPAT_UINT8_ARRAY, base64EncodeUint8Array(value)];
|
|
971
|
+
}
|
|
972
|
+
if (Array.isArray(value) && value.length === 2 && typeof value[0] === "string" && value[0].startsWith("$")) {
|
|
973
|
+
return [`$${value[0]}`, value[1]];
|
|
974
|
+
}
|
|
975
|
+
return value;
|
|
976
|
+
},
|
|
977
|
+
space
|
|
978
|
+
);
|
|
979
|
+
}
|
|
980
|
+
function jsonParseCompat(input) {
|
|
981
|
+
return reviveJsonCompatValue(JSON.parse(input));
|
|
982
|
+
}
|
|
983
|
+
|
|
527
984
|
// src/utils.ts
|
|
528
985
|
function joinSignals(...signals) {
|
|
529
986
|
const validSignals = signals.filter(
|
|
@@ -748,6 +1205,17 @@ export {
|
|
|
748
1205
|
deconstructError,
|
|
749
1206
|
stringifyError,
|
|
750
1207
|
noopNext,
|
|
1208
|
+
uint8ArrayToBase64,
|
|
1209
|
+
contentTypeForEncoding,
|
|
1210
|
+
encodeCborCompat,
|
|
1211
|
+
decodeCborCompat,
|
|
1212
|
+
serializeWithEncoding,
|
|
1213
|
+
deserializeWithEncoding,
|
|
1214
|
+
assertJsonCompatValue,
|
|
1215
|
+
EncodingSchema,
|
|
1216
|
+
inputDataToBuffer,
|
|
1217
|
+
jsonStringifyCompat,
|
|
1218
|
+
jsonParseCompat,
|
|
751
1219
|
joinSignals,
|
|
752
1220
|
sleep,
|
|
753
1221
|
interval,
|
|
@@ -771,11 +1239,17 @@ export {
|
|
|
771
1239
|
getRivetPool,
|
|
772
1240
|
getRivetTotalSlots,
|
|
773
1241
|
getRivetRunEngine,
|
|
1242
|
+
getRivetRunEngineHost,
|
|
1243
|
+
getRivetRunEnginePort,
|
|
774
1244
|
getRivetRunEngineVersion,
|
|
1245
|
+
getRivetRunServices,
|
|
775
1246
|
getRivetEnvoyVersion,
|
|
776
1247
|
getRivetPublicEndpoint,
|
|
777
1248
|
getRivetPublicToken,
|
|
778
1249
|
getRivetkitRuntime,
|
|
1250
|
+
getRivetkitRuntimeMode,
|
|
1251
|
+
getRivetkitPublicDir,
|
|
1252
|
+
parsePortEnv,
|
|
779
1253
|
getLogMessage,
|
|
780
1254
|
getNodeEnv,
|
|
781
1255
|
getNextPhase,
|
|
@@ -784,8 +1258,9 @@ export {
|
|
|
784
1258
|
getPinoLevel,
|
|
785
1259
|
getIncludeTarget,
|
|
786
1260
|
configureBaseLogger,
|
|
1261
|
+
makeDefaultLogger,
|
|
787
1262
|
configureDefaultLogger,
|
|
788
1263
|
getBaseLogger,
|
|
789
1264
|
getLogger
|
|
790
1265
|
};
|
|
791
|
-
//# sourceMappingURL=chunk-
|
|
1266
|
+
//# sourceMappingURL=chunk-K3AJOPSF.js.map
|