rivetkit 0.0.0-sqlite-profiling-compat.4a9a623 → 0.0.0-sqlite-sync-3-0-0-release.14341d0
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 +1317 -765
- package/dist/browser/client.js +1433 -692
- package/dist/browser/client.js.map +1 -1
- package/dist/browser/inspector/client.d.ts +252 -129
- package/dist/browser/inspector/client.js +2042 -228
- package/dist/browser/inspector/client.js.map +1 -1
- package/dist/tsup/actor/errors.cjs +6 -2
- package/dist/tsup/actor/errors.cjs.map +1 -1
- package/dist/tsup/actor/errors.d.cts +1 -1
- package/dist/tsup/actor/errors.d.ts +1 -1
- package/dist/tsup/actor/errors.js +5 -1
- package/dist/tsup/agent-os/index.cjs +3 -2367
- package/dist/tsup/agent-os/index.cjs.map +1 -1
- package/dist/tsup/agent-os/index.d.cts +1 -2277
- package/dist/tsup/agent-os/index.d.ts +1 -2277
- package/dist/tsup/agent-os/index.js +3 -2367
- package/dist/tsup/agent-os/index.js.map +1 -1
- package/dist/tsup/{chunk-AGDY6TKH.js → chunk-2EQ2WCO7.js} +1054 -364
- package/dist/tsup/chunk-2EQ2WCO7.js.map +1 -0
- package/dist/tsup/{chunk-7QKCGUTJ.cjs → chunk-4H2LT2WB.cjs} +444 -29
- package/dist/tsup/chunk-4H2LT2WB.cjs.map +1 -0
- package/dist/tsup/{chunk-XIX5DOZN.js → chunk-6FEYCVZC.js} +196 -20
- package/dist/tsup/chunk-6FEYCVZC.js.map +1 -0
- package/dist/tsup/{chunk-QAVN4QNO.cjs → chunk-6WYQ3NJI.cjs} +7 -7
- package/dist/tsup/chunk-6WYQ3NJI.cjs.map +1 -0
- package/dist/tsup/{chunk-75UE45DE.js → chunk-6ZJX3KXW.js} +436 -21
- package/dist/tsup/chunk-6ZJX3KXW.js.map +1 -0
- package/dist/tsup/{chunk-HXUEHHJF.js → chunk-A2CF6PFH.js} +19 -11
- package/dist/tsup/chunk-A2CF6PFH.js.map +1 -0
- package/dist/tsup/{chunk-RIT7N3TX.js → chunk-AIGW2SKA.js} +50 -3
- package/dist/tsup/chunk-AIGW2SKA.js.map +1 -0
- package/dist/tsup/{chunk-3MHDOUD7.cjs → chunk-HDVZ6YZG.cjs} +197 -21
- package/dist/tsup/chunk-HDVZ6YZG.cjs.map +1 -0
- package/dist/tsup/{chunk-2CICCOBL.cjs → chunk-HU4F7H3F.cjs} +52 -5
- package/dist/tsup/chunk-HU4F7H3F.cjs.map +1 -0
- package/dist/tsup/{chunk-4PX3ZKJR.js → chunk-JNJEWQZL.js} +3 -3
- package/dist/tsup/chunk-JNJEWQZL.js.map +1 -0
- package/dist/tsup/{chunk-JZ7TWV65.js → chunk-JTHHCZCZ.js} +24 -1
- package/dist/tsup/chunk-JTHHCZCZ.js.map +1 -0
- package/dist/tsup/{chunk-ZA7FLHKH.cjs → chunk-KVFIONKQ.cjs} +25 -2
- package/dist/tsup/chunk-KVFIONKQ.cjs.map +1 -0
- package/dist/tsup/{chunk-4FC7TVS6.cjs → chunk-MGI2VVF6.cjs} +39 -7
- package/dist/tsup/chunk-MGI2VVF6.cjs.map +1 -0
- package/dist/tsup/{chunk-NHUTYWKU.cjs → chunk-NE5CUQRN.cjs} +1173 -483
- package/dist/tsup/chunk-NE5CUQRN.cjs.map +1 -0
- package/dist/tsup/{chunk-IICIOTML.js → chunk-OX5MX7TO.js} +2 -2
- package/dist/tsup/{chunk-ND567FR5.cjs → chunk-PSIBTOAR.cjs} +3 -3
- package/dist/tsup/chunk-PSIBTOAR.cjs.map +1 -0
- package/dist/tsup/chunk-PW6FYEIV.cjs +14 -0
- package/dist/tsup/chunk-PW6FYEIV.cjs.map +1 -0
- package/dist/tsup/{chunk-VE2X4KMG.cjs → chunk-RTWH3AX3.cjs} +18 -10
- package/dist/tsup/chunk-RTWH3AX3.cjs.map +1 -0
- package/dist/tsup/chunk-SLICBKAU.js +14 -0
- package/dist/tsup/chunk-SLICBKAU.js.map +1 -0
- package/dist/tsup/{chunk-XFYEVYHG.js → chunk-WCVYMFWJ.js} +16 -9
- package/dist/tsup/chunk-WCVYMFWJ.js.map +1 -0
- package/dist/tsup/chunk-WX3JS4XU.cjs +243 -0
- package/dist/tsup/chunk-WX3JS4XU.cjs.map +1 -0
- package/dist/tsup/chunk-X32L7FDD.js +243 -0
- package/dist/tsup/chunk-X32L7FDD.js.map +1 -0
- package/dist/tsup/{chunk-2WMYYG4R.cjs → chunk-XAY2HIZN.cjs} +18 -11
- package/dist/tsup/chunk-XAY2HIZN.cjs.map +1 -0
- package/dist/tsup/{chunk-ZZ3WBRPD.js → chunk-ZOVJDAOW.js} +38 -6
- 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 +32 -6
- package/dist/tsup/client/mod.d.ts +32 -6
- 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.cjs.map +1 -1
- package/dist/tsup/common/websocket.js +3 -3
- package/dist/tsup/{config-BR1Nn0QQ.d.ts → config-B4erdavw.d.ts} +571 -65
- package/dist/tsup/{config-B0LNDrLY.d.ts → config-BfG1qpYz.d.cts} +80 -14
- package/dist/tsup/{config-B0LNDrLY.d.cts → config-BfG1qpYz.d.ts} +80 -14
- package/dist/tsup/{config-tCvkwzyN.d.cts → config-DK144OAw.d.cts} +571 -65
- package/dist/tsup/{context-oc9zhA3x.d.ts → context-Cvnf3BRe.d.cts} +3 -2
- package/dist/tsup/{context-D4WDwf9m.d.cts → context-Oxi6YWcG.d.ts} +3 -2
- 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 -126
- package/dist/tsup/db/mod.cjs.map +1 -1
- package/dist/tsup/db/mod.d.cts +8 -4
- package/dist/tsup/db/mod.d.ts +8 -4
- package/dist/tsup/db/mod.js +5 -125
- package/dist/tsup/db/mod.js.map +1 -1
- package/dist/tsup/dynamic/mod.cjs +2 -2
- package/dist/tsup/dynamic/mod.cjs.map +1 -1
- package/dist/tsup/dynamic/mod.d.cts +6 -4
- package/dist/tsup/dynamic/mod.d.ts +6 -4
- package/dist/tsup/dynamic/mod.js +1 -1
- 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 +2 -13
- package/dist/tsup/inspector-tab/mod.cjs.map +1 -1
- package/dist/tsup/inspector-tab/mod.d.cts +9 -17
- package/dist/tsup/inspector-tab/mod.d.ts +9 -17
- package/dist/tsup/inspector-tab/mod.js +1 -12
- package/dist/tsup/inspector-tab/mod.js.map +1 -1
- package/dist/tsup/mod.cjs +2728 -611
- package/dist/tsup/mod.cjs.map +1 -1
- package/dist/tsup/mod.d.cts +9 -7
- package/dist/tsup/mod.d.ts +9 -7
- package/dist/tsup/mod.js +2645 -528
- package/dist/tsup/mod.js.map +1 -1
- package/dist/tsup/test/mod.cjs +19 -17
- package/dist/tsup/test/mod.cjs.map +1 -1
- package/dist/tsup/test/mod.d.cts +6 -4
- package/dist/tsup/test/mod.d.ts +6 -4
- package/dist/tsup/test/mod.js +18 -16
- 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-CqDnC_PS.d.cts → utils-3rsE0JvI.d.cts} +25 -2
- package/dist/tsup/{utils-CqDnC_PS.d.ts → utils-3rsE0JvI.d.ts} +25 -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 +260 -200
- package/dist/tsup/workflow/mod.cjs.map +1 -1
- package/dist/tsup/workflow/mod.d.cts +8 -6
- package/dist/tsup/workflow/mod.d.ts +8 -6
- package/dist/tsup/workflow/mod.js +249 -189
- package/dist/tsup/workflow/mod.js.map +1 -1
- package/package.json +34 -14
- package/src/actor/actions.ts +155 -0
- package/src/actor/config.ts +403 -43
- package/src/actor/definition.ts +26 -7
- package/src/actor/errors.ts +87 -5
- package/src/actor/keys.ts +86 -0
- package/src/actor/mod.ts +15 -1
- package/src/actor/tracing.ts +28 -0
- package/src/agent-os/index.ts +5 -65
- package/src/client/actor-common.ts +8 -15
- package/src/client/actor-conn.ts +178 -25
- package/src/client/actor-handle.ts +180 -42
- package/src/client/actor-query.ts +8 -1
- package/src/client/auth.ts +37 -0
- package/src/client/client.ts +89 -21
- package/src/client/config.ts +27 -2
- package/src/client/errors.ts +2 -1
- package/src/client/lifecycle-errors.ts +29 -1
- package/src/client/mod.ts +9 -0
- package/src/client/outbound-telemetry.ts +66 -0
- package/src/client/query.ts +2 -0
- package/src/client/queue.ts +3 -0
- package/src/client/raw-utils.ts +37 -8
- package/src/client/resolve-gateway-target.ts +2 -0
- package/src/client/retry-budget.ts +78 -0
- package/src/client/token-provider.ts +93 -0
- package/src/client/utils.ts +16 -2
- package/src/common/actor-router-consts.ts +5 -0
- package/src/common/actor-telemetry-context.ts +19 -0
- package/src/common/bare/generated/actor-runtime-socket-protocol/v1.ts +848 -0
- 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 +36 -0
- package/src/common/database/config.ts +108 -15
- package/src/common/database/mod.ts +247 -76
- package/src/common/database/native-database.ts +433 -23
- package/src/common/database/shared.ts +24 -0
- package/src/common/encoding.ts +31 -21
- package/src/common/fetch-like.ts +63 -0
- package/src/common/inspector-transport.ts +12 -2
- package/src/common/log.ts +14 -8
- package/src/common/otel-context.ts +99 -0
- package/src/common/router.ts +1 -1
- package/src/common/utils.ts +7 -19
- package/src/db/drizzle.ts +182 -80
- package/src/db/mod.ts +2 -0
- package/src/dynamic/isolate-runtime.ts +0 -2
- package/src/engine-api/actors.ts +3 -3
- package/src/engine-client/actor-http-client.ts +29 -20
- package/src/engine-client/actor-websocket-client.ts +6 -3
- package/src/engine-client/api-endpoints.ts +72 -14
- package/src/engine-client/driver.ts +8 -15
- package/src/engine-client/mod.ts +248 -112
- package/src/inspector/client.browser.ts +134 -16
- package/src/inspector/mod.ts +1 -1
- package/src/inspector/workflow.ts +61 -0
- package/src/inspector-tab/mod.ts +1 -15
- package/src/registry/config/envoy.ts +2 -18
- package/src/registry/config/index.ts +54 -61
- package/src/registry/index.ts +324 -21
- package/src/registry/napi-runtime.ts +583 -39
- package/src/registry/native-http.ts +225 -0
- package/src/registry/native.ts +1365 -414
- package/src/registry/run-handler-coordinator.ts +219 -0
- package/src/registry/runtime.ts +372 -7
- package/src/registry/wasm-runtime.ts +490 -21
- package/src/registry/write-through-proxy.ts +101 -0
- package/src/test/mod.ts +1 -19
- package/src/test/ready.ts +22 -0
- package/src/unstable/migrations.ts +141 -0
- package/src/utils/env-vars.ts +15 -6
- package/src/utils/node.ts +44 -28
- package/src/utils.ts +3 -0
- package/src/workflow/context.ts +9 -27
- package/src/workflow/driver.ts +253 -116
- package/src/workflow/inspector.ts +23 -24
- package/src/workflow/mod.ts +50 -72
- package/dist/tsup/chunk-2CICCOBL.cjs.map +0 -1
- package/dist/tsup/chunk-2WMYYG4R.cjs.map +0 -1
- package/dist/tsup/chunk-3MHDOUD7.cjs.map +0 -1
- package/dist/tsup/chunk-4FC7TVS6.cjs.map +0 -1
- package/dist/tsup/chunk-4PX3ZKJR.js.map +0 -1
- package/dist/tsup/chunk-75UE45DE.js.map +0 -1
- package/dist/tsup/chunk-7QKCGUTJ.cjs.map +0 -1
- package/dist/tsup/chunk-AGDY6TKH.js.map +0 -1
- package/dist/tsup/chunk-HXUEHHJF.js.map +0 -1
- package/dist/tsup/chunk-JZ7TWV65.js.map +0 -1
- package/dist/tsup/chunk-ND567FR5.cjs.map +0 -1
- package/dist/tsup/chunk-NHUTYWKU.cjs.map +0 -1
- package/dist/tsup/chunk-QAVN4QNO.cjs.map +0 -1
- package/dist/tsup/chunk-RIT7N3TX.js.map +0 -1
- package/dist/tsup/chunk-RV5MAFDT.cjs +0 -382
- package/dist/tsup/chunk-RV5MAFDT.cjs.map +0 -1
- package/dist/tsup/chunk-VE2X4KMG.cjs.map +0 -1
- package/dist/tsup/chunk-XFYEVYHG.js.map +0 -1
- package/dist/tsup/chunk-XHGDS3DZ.js +0 -382
- package/dist/tsup/chunk-XHGDS3DZ.js.map +0 -1
- package/dist/tsup/chunk-XIX5DOZN.js.map +0 -1
- package/dist/tsup/chunk-ZA7FLHKH.cjs.map +0 -1
- package/dist/tsup/chunk-ZZ3WBRPD.js.map +0 -1
- package/src/actor/driver.ts +0 -141
- package/src/actor/instance/mod.ts +0 -2484
- 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 -285
- package/src/agent-os/actor/network.ts +0 -58
- package/src/agent-os/actor/preview.ts +0 -190
- 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 -2473
- package/src/registry/process-metrics.ts +0 -250
- package/src/registry/runtime.test.ts +0 -50
- package/src/utils/endpoint-parser.test.ts +0 -206
- package/src/utils.test.ts +0 -34
- /package/dist/tsup/{chunk-IICIOTML.js.map → chunk-OX5MX7TO.js.map} +0 -0
package/src/registry/runtime.ts
CHANGED
|
@@ -1,8 +1,13 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { WorkflowSpan } from "@/actor/config";
|
|
2
|
+
import type {
|
|
3
|
+
ActorInvocationSpanContext,
|
|
4
|
+
ActorInvocationTraceContext,
|
|
5
|
+
} from "@/common/actor-telemetry-context";
|
|
2
6
|
import type {
|
|
3
7
|
SqliteNativeMetrics,
|
|
4
8
|
SqliteProfilingOptions,
|
|
5
9
|
} from "@/common/database/config";
|
|
10
|
+
import { stringifyError } from "@/common/utils";
|
|
6
11
|
import type { RegistryConfig } from "./config";
|
|
7
12
|
import { logger } from "./log";
|
|
8
13
|
|
|
@@ -18,6 +23,8 @@ export type ActorContextHandle = OpaqueHandle<"actorContext">;
|
|
|
18
23
|
export type ConnHandle = OpaqueHandle<"conn">;
|
|
19
24
|
export type WebSocketHandle = OpaqueHandle<"webSocket">;
|
|
20
25
|
export type CancellationTokenHandle = OpaqueHandle<"cancellationToken">;
|
|
26
|
+
export type ActorStateTransactionHandle = OpaqueHandle<"actorStateTransaction">;
|
|
27
|
+
export type SqliteTransactionHandle = OpaqueHandle<"sqliteTransaction">;
|
|
21
28
|
|
|
22
29
|
export type RuntimeBytes = Uint8Array;
|
|
23
30
|
|
|
@@ -27,6 +34,35 @@ export interface RuntimeActorKeySegment {
|
|
|
27
34
|
numberValue?: number;
|
|
28
35
|
}
|
|
29
36
|
|
|
37
|
+
/** Resolves correlation at operation time so retained clients cannot freeze stale context. */
|
|
38
|
+
export type CurrentActorInvocation = () =>
|
|
39
|
+
| ActorInvocationTraceContext
|
|
40
|
+
| undefined;
|
|
41
|
+
|
|
42
|
+
/** One open call from an actor out to another actor. */
|
|
43
|
+
export interface RuntimeOutboundCall {
|
|
44
|
+
/**
|
|
45
|
+
* W3C context of the call's own span, to send to the callee so it parents to
|
|
46
|
+
* the call. Absent when tracing is disabled.
|
|
47
|
+
*/
|
|
48
|
+
readonly span?: ActorInvocationSpanContext;
|
|
49
|
+
/**
|
|
50
|
+
* Records the call's outcome. `error` is the failure encoded the way the
|
|
51
|
+
* bridge encodes errors, so a structured error keeps its group and code.
|
|
52
|
+
*/
|
|
53
|
+
finish(error?: string): void;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Opens the span covering one call out to another actor, or returns `undefined`
|
|
58
|
+
* outside an invocation or on a runtime without invocation telemetry. Callers
|
|
59
|
+
* send their own context when it returns nothing.
|
|
60
|
+
*/
|
|
61
|
+
export type StartCallSpan = (
|
|
62
|
+
actorName: string,
|
|
63
|
+
actionName: string,
|
|
64
|
+
) => RuntimeOutboundCall | undefined;
|
|
65
|
+
|
|
30
66
|
export interface RuntimeHttpRequest {
|
|
31
67
|
method: string;
|
|
32
68
|
uri: string;
|
|
@@ -38,6 +74,14 @@ export interface RuntimeHttpResponse {
|
|
|
38
74
|
status?: number;
|
|
39
75
|
headers?: Record<string, string>;
|
|
40
76
|
body?: RuntimeBytes;
|
|
77
|
+
stream?: boolean;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
export interface RuntimeHttpResponseBodyStream {
|
|
81
|
+
cancelled(): Promise<void>;
|
|
82
|
+
write(chunk: Uint8Array): Promise<void>;
|
|
83
|
+
end(): Promise<void>;
|
|
84
|
+
error(message: string): Promise<void>;
|
|
41
85
|
}
|
|
42
86
|
|
|
43
87
|
export interface RuntimeStateDeltaPayload {
|
|
@@ -49,6 +93,11 @@ export interface RuntimeStateDeltaPayload {
|
|
|
49
93
|
connHibernationRemoved: string[];
|
|
50
94
|
}
|
|
51
95
|
|
|
96
|
+
export interface RuntimeWorkflowKvWrite {
|
|
97
|
+
key: RuntimeBytes;
|
|
98
|
+
value: RuntimeBytes;
|
|
99
|
+
}
|
|
100
|
+
|
|
52
101
|
export interface RuntimeRequestSaveOpts {
|
|
53
102
|
immediate?: boolean;
|
|
54
103
|
maxWaitMs?: number;
|
|
@@ -83,6 +132,50 @@ export interface RuntimeQueueSendResult {
|
|
|
83
132
|
response?: RuntimeBytes;
|
|
84
133
|
}
|
|
85
134
|
|
|
135
|
+
export interface RuntimeScheduledEventInfo {
|
|
136
|
+
id: string;
|
|
137
|
+
action: string;
|
|
138
|
+
args: RuntimeBytes;
|
|
139
|
+
runAt: number;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
export interface RuntimeCronJobInfo {
|
|
143
|
+
name: string;
|
|
144
|
+
kind: "cron" | "every";
|
|
145
|
+
action: string;
|
|
146
|
+
args: RuntimeBytes;
|
|
147
|
+
nextRunAt: number;
|
|
148
|
+
lastRunAt?: number;
|
|
149
|
+
expression?: string;
|
|
150
|
+
timezone?: string;
|
|
151
|
+
intervalMs?: number;
|
|
152
|
+
maxHistory: number;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
export interface RuntimeScheduleErrorInfo {
|
|
156
|
+
group: string;
|
|
157
|
+
code: string;
|
|
158
|
+
message: string;
|
|
159
|
+
metadata?: unknown;
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
export interface RuntimeCronFire {
|
|
163
|
+
action: string;
|
|
164
|
+
scheduledAt: number;
|
|
165
|
+
firedAt: number;
|
|
166
|
+
finishedAt?: number;
|
|
167
|
+
result: "running" | "ok" | "error" | "skipped";
|
|
168
|
+
error?: RuntimeScheduleErrorInfo;
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
export interface RuntimeScheduledFireInfo {
|
|
172
|
+
kind: "at" | "cron" | "every";
|
|
173
|
+
id: string;
|
|
174
|
+
name?: string;
|
|
175
|
+
scheduledAt: number;
|
|
176
|
+
firedAt: number;
|
|
177
|
+
}
|
|
178
|
+
|
|
86
179
|
export interface RuntimeQueueNextBatchOptions {
|
|
87
180
|
names?: string[];
|
|
88
181
|
count?: number;
|
|
@@ -155,6 +248,10 @@ export type RuntimeSqlBindParam =
|
|
|
155
248
|
|
|
156
249
|
export type RuntimeSqlBindParams = RuntimeSqlBindParam[] | null;
|
|
157
250
|
|
|
251
|
+
export interface RuntimeActorRuntimeSocketEndpointInfo {
|
|
252
|
+
path: string;
|
|
253
|
+
}
|
|
254
|
+
|
|
158
255
|
export interface RuntimeSqlQueryResult {
|
|
159
256
|
columns: string[];
|
|
160
257
|
rows: unknown[][];
|
|
@@ -167,6 +264,11 @@ export interface RuntimeSqlExecuteResult extends RuntimeSqlQueryResult {
|
|
|
167
264
|
lastInsertRowId?: number | null;
|
|
168
265
|
}
|
|
169
266
|
|
|
267
|
+
export interface RuntimeSqlBatchStatement {
|
|
268
|
+
sql: string;
|
|
269
|
+
params?: RuntimeSqlBindParams;
|
|
270
|
+
}
|
|
271
|
+
|
|
170
272
|
export function normalizeRuntimeSqlExecuteResult(
|
|
171
273
|
result: RuntimeSqlQueryResult & {
|
|
172
274
|
changes: number;
|
|
@@ -182,10 +284,18 @@ export interface RuntimeSqlRunResult {
|
|
|
182
284
|
|
|
183
285
|
export interface RuntimeSqlDatabase {
|
|
184
286
|
exec(sql: string): Promise<RuntimeSqlExecResult>;
|
|
287
|
+
execSync(sql: string): RuntimeSqlExecResult;
|
|
185
288
|
execute(
|
|
186
289
|
sql: string,
|
|
187
290
|
params?: RuntimeSqlBindParams,
|
|
188
291
|
): Promise<RuntimeSqlExecuteResult>;
|
|
292
|
+
executeSync(
|
|
293
|
+
sql: string,
|
|
294
|
+
params?: RuntimeSqlBindParams,
|
|
295
|
+
): RuntimeSqlExecuteResult;
|
|
296
|
+
executeBatch(
|
|
297
|
+
statements: RuntimeSqlBatchStatement[],
|
|
298
|
+
): Promise<RuntimeSqlExecuteResult[]>;
|
|
189
299
|
query(
|
|
190
300
|
sql: string,
|
|
191
301
|
params?: RuntimeSqlBindParams,
|
|
@@ -194,18 +304,55 @@ export interface RuntimeSqlDatabase {
|
|
|
194
304
|
sql: string,
|
|
195
305
|
params?: RuntimeSqlBindParams,
|
|
196
306
|
): Promise<RuntimeSqlRunResult>;
|
|
307
|
+
beginTransaction(
|
|
308
|
+
timeoutMs?: number,
|
|
309
|
+
name?: string,
|
|
310
|
+
): Promise<RuntimeSqlTransactionDatabase>;
|
|
311
|
+
beginTransactionSync(
|
|
312
|
+
timeoutMs?: number,
|
|
313
|
+
name?: string,
|
|
314
|
+
): RuntimeSqlTransactionDatabase;
|
|
197
315
|
metrics?(): SqliteNativeMetrics | null;
|
|
198
316
|
takeLastKvError?(): string | null;
|
|
317
|
+
open(): Promise<void>;
|
|
318
|
+
commitTicket(): number;
|
|
319
|
+
whenDurable(ticket: number): Promise<void>;
|
|
199
320
|
close(): Promise<void>;
|
|
200
321
|
}
|
|
201
322
|
|
|
323
|
+
export interface RuntimeSqlTransactionDatabase {
|
|
324
|
+
exec(sql: string): Promise<RuntimeSqlExecResult>;
|
|
325
|
+
execSync(sql: string): RuntimeSqlExecResult;
|
|
326
|
+
execute(
|
|
327
|
+
sql: string,
|
|
328
|
+
params?: RuntimeSqlBindParams,
|
|
329
|
+
): Promise<RuntimeSqlExecuteResult>;
|
|
330
|
+
executeSync(
|
|
331
|
+
sql: string,
|
|
332
|
+
params?: RuntimeSqlBindParams,
|
|
333
|
+
): RuntimeSqlExecuteResult;
|
|
334
|
+
commit(): Promise<void>;
|
|
335
|
+
commitSync(): void;
|
|
336
|
+
rollback(): Promise<void>;
|
|
337
|
+
rollbackSync(): void;
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
/** Sample rates for the traces an actor starts, in the shape core takes. */
|
|
341
|
+
export interface RuntimeActorTracingConfig {
|
|
342
|
+
sampler?: number;
|
|
343
|
+
/** Keyed by flattened, dot-separated action name. */
|
|
344
|
+
actions?: Record<string, number>;
|
|
345
|
+
}
|
|
346
|
+
|
|
202
347
|
export interface RuntimeActorConfig {
|
|
203
348
|
name?: string;
|
|
204
349
|
icon?: string;
|
|
205
350
|
hasDatabase?: boolean;
|
|
206
351
|
remoteSqlite?: boolean;
|
|
207
|
-
|
|
352
|
+
sqliteDeferredCommits?: boolean;
|
|
208
353
|
sqliteProfiling?: SqliteProfilingOptions;
|
|
354
|
+
tracing?: RuntimeActorTracingConfig;
|
|
355
|
+
enableActorRuntimeSocket?: boolean;
|
|
209
356
|
hasState?: boolean;
|
|
210
357
|
canHibernateWebsocket?: boolean;
|
|
211
358
|
stateSaveIntervalMs?: number;
|
|
@@ -226,6 +373,7 @@ export interface RuntimeActorConfig {
|
|
|
226
373
|
connectionLivenessTimeoutMs?: number;
|
|
227
374
|
connectionLivenessIntervalMs?: number;
|
|
228
375
|
maxQueueSize?: number;
|
|
376
|
+
maxSchedules?: number;
|
|
229
377
|
maxQueueMessageSize?: number;
|
|
230
378
|
maxIncomingMessageSize?: number;
|
|
231
379
|
maxOutgoingMessageSize?: number;
|
|
@@ -257,6 +405,10 @@ export interface RuntimeServeConfig {
|
|
|
257
405
|
namespace: string;
|
|
258
406
|
poolName: string;
|
|
259
407
|
engineBinaryPath?: string;
|
|
408
|
+
startServices?: boolean;
|
|
409
|
+
servicesBinaryPath?: string;
|
|
410
|
+
/** Whether config resolution selected a managed local development engine. */
|
|
411
|
+
engineSpawn?: boolean;
|
|
260
412
|
engineHost?: string;
|
|
261
413
|
enginePort?: number;
|
|
262
414
|
handleInspectorHttpInRuntime?: boolean;
|
|
@@ -274,6 +426,7 @@ export interface RuntimeListenerConfig {
|
|
|
274
426
|
port: number;
|
|
275
427
|
host?: string;
|
|
276
428
|
publicDir?: string;
|
|
429
|
+
application?: RuntimeApplicationFetch;
|
|
277
430
|
}
|
|
278
431
|
|
|
279
432
|
export interface RuntimeServerlessRequest {
|
|
@@ -283,6 +436,27 @@ export interface RuntimeServerlessRequest {
|
|
|
283
436
|
body: RuntimeBytes;
|
|
284
437
|
}
|
|
285
438
|
|
|
439
|
+
export interface RuntimeApplicationRequest extends RuntimeServerlessRequest {
|
|
440
|
+
cancelToken?: CancellationTokenHandle;
|
|
441
|
+
}
|
|
442
|
+
|
|
443
|
+
export interface RuntimeApplicationResponse {
|
|
444
|
+
status: number;
|
|
445
|
+
headers: Record<string, string>;
|
|
446
|
+
body?: RuntimeBytes;
|
|
447
|
+
stream?: boolean;
|
|
448
|
+
}
|
|
449
|
+
|
|
450
|
+
export type RuntimeApplicationFetch = (
|
|
451
|
+
request: RuntimeApplicationRequest,
|
|
452
|
+
responseBodyStream?: RuntimeHttpResponseBodyStream,
|
|
453
|
+
) => Promise<RuntimeApplicationResponse>;
|
|
454
|
+
|
|
455
|
+
export interface RuntimeApplicationListenerConfig
|
|
456
|
+
extends RuntimeListenerConfig {
|
|
457
|
+
application: RuntimeApplicationFetch;
|
|
458
|
+
}
|
|
459
|
+
|
|
286
460
|
export interface RuntimeServerlessResponseHead {
|
|
287
461
|
status: number;
|
|
288
462
|
headers: Record<string, string>;
|
|
@@ -340,7 +514,9 @@ export interface CoreRuntime {
|
|
|
340
514
|
registry: RegistryHandle,
|
|
341
515
|
config: RuntimeServeConfig,
|
|
342
516
|
): Promise<void>;
|
|
517
|
+
waitRegistryReady(registry: RegistryHandle): Promise<void>;
|
|
343
518
|
shutdownRegistry(registry: RegistryHandle): Promise<void>;
|
|
519
|
+
shutdownTelemetry?(): Promise<void>;
|
|
344
520
|
registryActorStopThresholdMs?(
|
|
345
521
|
registry: RegistryHandle,
|
|
346
522
|
): Promise<number | undefined>;
|
|
@@ -356,6 +532,11 @@ export interface CoreRuntime {
|
|
|
356
532
|
listener: RuntimeListenerConfig,
|
|
357
533
|
config: RuntimeServeConfig,
|
|
358
534
|
): Promise<void>;
|
|
535
|
+
serveApplicationListener(
|
|
536
|
+
registry: RegistryHandle,
|
|
537
|
+
listener: RuntimeApplicationListenerConfig,
|
|
538
|
+
config: RuntimeServeConfig,
|
|
539
|
+
): Promise<void>;
|
|
359
540
|
registryHealth?(
|
|
360
541
|
registry: RegistryHandle,
|
|
361
542
|
): Promise<RuntimeRegistryRouteResponse>;
|
|
@@ -373,10 +554,15 @@ export interface CoreRuntime {
|
|
|
373
554
|
createCancellationToken(): CancellationTokenHandle;
|
|
374
555
|
cancellationTokenAborted(token: CancellationTokenHandle): boolean;
|
|
375
556
|
cancelCancellationToken(token: CancellationTokenHandle): void;
|
|
557
|
+
/**
|
|
558
|
+
* Calls `callback` once when `token` is cancelled. Returns a release
|
|
559
|
+
* function that drops the registration without calling `callback`; call it
|
|
560
|
+
* once cancellation no longer matters so the native listener is freed.
|
|
561
|
+
*/
|
|
376
562
|
onCancellationTokenCancelled(
|
|
377
563
|
token: CancellationTokenHandle,
|
|
378
564
|
callback: (...args: unknown[]) => unknown,
|
|
379
|
-
): void;
|
|
565
|
+
): () => void;
|
|
380
566
|
|
|
381
567
|
actorState(ctx: ActorContextHandle): RuntimeBytes;
|
|
382
568
|
actorBeginOnStateChange(ctx: ActorContextHandle): void;
|
|
@@ -385,6 +571,10 @@ export interface CoreRuntime {
|
|
|
385
571
|
ctx: ActorContextHandle,
|
|
386
572
|
timestampMs?: number | undefined | null,
|
|
387
573
|
): void;
|
|
574
|
+
actorSetRunWakeAt(
|
|
575
|
+
ctx: ActorContextHandle,
|
|
576
|
+
timestampMs?: number | undefined | null,
|
|
577
|
+
): Promise<void>;
|
|
388
578
|
actorRequestSave(
|
|
389
579
|
ctx: ActorContextHandle,
|
|
390
580
|
opts?: RuntimeRequestSaveOpts | undefined | null,
|
|
@@ -415,7 +605,42 @@ export interface CoreRuntime {
|
|
|
415
605
|
ctx: ActorContextHandle,
|
|
416
606
|
payload: RuntimeStateDeltaPayload,
|
|
417
607
|
): Promise<void>;
|
|
608
|
+
actorSaveStateAndWorkflowBatch(
|
|
609
|
+
ctx: ActorContextHandle,
|
|
610
|
+
writes: RuntimeWorkflowKvWrite[],
|
|
611
|
+
): Promise<void>;
|
|
418
612
|
actorId(ctx: ActorContextHandle): string;
|
|
613
|
+
/**
|
|
614
|
+
* Runs one actor callback with `ctx` as the current invocation: operations
|
|
615
|
+
* on retained handles for the same actor resolve to it, and its Core span
|
|
616
|
+
* is the active OpenTelemetry span for the duration of `run`. Only actions,
|
|
617
|
+
* raw requests, and queue dispatch run this way; other callbacks have no
|
|
618
|
+
* invocation span.
|
|
619
|
+
*/
|
|
620
|
+
runWithActorInvocationContext<T>(ctx: ActorContextHandle, run: () => T): T;
|
|
621
|
+
/**
|
|
622
|
+
* Correlation of the invocation currently executing for this actor, or
|
|
623
|
+
* `undefined` outside an invocation or after it finished. A sampled-out
|
|
624
|
+
* invocation can still expose valid span context for propagation.
|
|
625
|
+
*/
|
|
626
|
+
actorInvocationTraceContext(
|
|
627
|
+
ctx: ActorContextHandle,
|
|
628
|
+
): ActorInvocationTraceContext | undefined;
|
|
629
|
+
/**
|
|
630
|
+
* Opens the span covering one call this actor makes to another actor. See
|
|
631
|
+
* `StartCallSpan` for when this returns nothing.
|
|
632
|
+
*/
|
|
633
|
+
startCallSpan(
|
|
634
|
+
ctx: ActorContextHandle,
|
|
635
|
+
actorName: string,
|
|
636
|
+
actionName: string,
|
|
637
|
+
): RuntimeOutboundCall | undefined;
|
|
638
|
+
/** Backs `ActorRun.startWorkflowSpan`. */
|
|
639
|
+
startWorkflowSpan(ctx: ActorContextHandle): Promise<WorkflowSpan>;
|
|
640
|
+
/** Backs `ActorRun.runOutsideWorkflowSpan`. */
|
|
641
|
+
runOutsideActorInvocationContext<T>(run: () => T): T;
|
|
642
|
+
/** Identity of the invocation the caller runs in, usable as a cache key. */
|
|
643
|
+
currentInvocationScope(): object | undefined;
|
|
419
644
|
actorName(ctx: ActorContextHandle): string;
|
|
420
645
|
actorKey(ctx: ActorContextHandle): RuntimeActorKeySegment[];
|
|
421
646
|
actorRegion(ctx: ActorContextHandle): string;
|
|
@@ -491,11 +716,76 @@ export interface CoreRuntime {
|
|
|
491
716
|
ctx: ActorContextHandle,
|
|
492
717
|
sql: string,
|
|
493
718
|
): Promise<RuntimeSqlExecResult>;
|
|
719
|
+
actorSqlExecSync(
|
|
720
|
+
ctx: ActorContextHandle,
|
|
721
|
+
sql: string,
|
|
722
|
+
): RuntimeSqlExecResult;
|
|
494
723
|
actorSqlExecute(
|
|
495
724
|
ctx: ActorContextHandle,
|
|
496
725
|
sql: string,
|
|
497
726
|
params?: RuntimeSqlBindParams,
|
|
498
727
|
): Promise<RuntimeSqlExecuteResult>;
|
|
728
|
+
actorSqlExecuteSync(
|
|
729
|
+
ctx: ActorContextHandle,
|
|
730
|
+
sql: string,
|
|
731
|
+
params?: RuntimeSqlBindParams,
|
|
732
|
+
): RuntimeSqlExecuteResult;
|
|
733
|
+
actorSqlExecuteBatch(
|
|
734
|
+
ctx: ActorContextHandle,
|
|
735
|
+
statements: RuntimeSqlBatchStatement[],
|
|
736
|
+
): Promise<RuntimeSqlExecuteResult[]>;
|
|
737
|
+
actorSqlBeginTransaction(
|
|
738
|
+
ctx: ActorContextHandle,
|
|
739
|
+
timeoutMs?: number,
|
|
740
|
+
name?: string,
|
|
741
|
+
): Promise<SqliteTransactionHandle>;
|
|
742
|
+
actorSqlBeginTransactionSync(
|
|
743
|
+
ctx: ActorContextHandle,
|
|
744
|
+
timeoutMs?: number,
|
|
745
|
+
name?: string,
|
|
746
|
+
): SqliteTransactionHandle;
|
|
747
|
+
actorSqlTransactionExec(
|
|
748
|
+
transaction: SqliteTransactionHandle,
|
|
749
|
+
sql: string,
|
|
750
|
+
): Promise<RuntimeSqlExecResult>;
|
|
751
|
+
actorSqlTransactionExecSync(
|
|
752
|
+
transaction: SqliteTransactionHandle,
|
|
753
|
+
sql: string,
|
|
754
|
+
): RuntimeSqlExecResult;
|
|
755
|
+
actorSqlTransactionExecute(
|
|
756
|
+
transaction: SqliteTransactionHandle,
|
|
757
|
+
sql: string,
|
|
758
|
+
params?: RuntimeSqlBindParams,
|
|
759
|
+
): Promise<RuntimeSqlExecuteResult>;
|
|
760
|
+
actorSqlTransactionExecuteSync(
|
|
761
|
+
transaction: SqliteTransactionHandle,
|
|
762
|
+
sql: string,
|
|
763
|
+
params?: RuntimeSqlBindParams,
|
|
764
|
+
): RuntimeSqlExecuteResult;
|
|
765
|
+
actorSqlTransactionCommit(
|
|
766
|
+
transaction: SqliteTransactionHandle,
|
|
767
|
+
): Promise<void>;
|
|
768
|
+
actorSqlTransactionCommitSync(transaction: SqliteTransactionHandle): void;
|
|
769
|
+
actorSqlTransactionRollback(
|
|
770
|
+
transaction: SqliteTransactionHandle,
|
|
771
|
+
): Promise<void>;
|
|
772
|
+
actorSqlTransactionRollbackSync(transaction: SqliteTransactionHandle): void;
|
|
773
|
+
actorBeginStateTransaction(
|
|
774
|
+
ctx: ActorContextHandle,
|
|
775
|
+
timeoutMs?: number,
|
|
776
|
+
): Promise<ActorStateTransactionHandle>;
|
|
777
|
+
actorStateTransactionExecute(
|
|
778
|
+
transaction: ActorStateTransactionHandle,
|
|
779
|
+
sql: string,
|
|
780
|
+
params?: RuntimeSqlBindParams,
|
|
781
|
+
): Promise<RuntimeSqlExecuteResult>;
|
|
782
|
+
actorStateTransactionCommit(
|
|
783
|
+
transaction: ActorStateTransactionHandle,
|
|
784
|
+
payload: RuntimeStateDeltaPayload,
|
|
785
|
+
): Promise<void>;
|
|
786
|
+
actorStateTransactionRollback(
|
|
787
|
+
transaction: ActorStateTransactionHandle,
|
|
788
|
+
): Promise<void>;
|
|
499
789
|
actorSqlQuery(
|
|
500
790
|
ctx: ActorContextHandle,
|
|
501
791
|
sql: string,
|
|
@@ -508,7 +798,17 @@ export interface CoreRuntime {
|
|
|
508
798
|
): Promise<RuntimeSqlRunResult>;
|
|
509
799
|
actorSqlMetrics(ctx: ActorContextHandle): SqliteNativeMetrics | null;
|
|
510
800
|
actorSqlTakeLastKvError(ctx: ActorContextHandle): string | null;
|
|
801
|
+
/** Opens the actor database so later synchronous calls never fetch its first pages. */
|
|
802
|
+
actorSqlOpen(ctx: ActorContextHandle): Promise<void>;
|
|
803
|
+
/** Returns the ticket of the latest local commit. */
|
|
804
|
+
actorSqlCommitTicket(ctx: ActorContextHandle): number;
|
|
805
|
+
/** Resolves once the commit `ticket` names and every earlier commit are durable. */
|
|
806
|
+
actorSqlWhenDurable(ctx: ActorContextHandle, ticket: number): Promise<void>;
|
|
807
|
+
actorSqlAbortGeneration(ctx: ActorContextHandle, reason: string): void;
|
|
511
808
|
actorSqlClose(ctx: ActorContextHandle): Promise<void>;
|
|
809
|
+
actorRuntimeSocketProvision(
|
|
810
|
+
ctx: ActorContextHandle,
|
|
811
|
+
): Promise<RuntimeActorRuntimeSocketEndpointInfo>;
|
|
512
812
|
|
|
513
813
|
actorQueueSend(
|
|
514
814
|
ctx: ActorContextHandle,
|
|
@@ -532,6 +832,12 @@ export interface CoreRuntime {
|
|
|
532
832
|
options?: RuntimeQueueWaitOptions | undefined | null,
|
|
533
833
|
signal?: CancellationTokenHandle | undefined | null,
|
|
534
834
|
): Promise<void>;
|
|
835
|
+
actorQueueCompletePersisted(
|
|
836
|
+
ctx: ActorContextHandle,
|
|
837
|
+
messageId: bigint,
|
|
838
|
+
expectedName: string,
|
|
839
|
+
response?: RuntimeBytes | undefined | null,
|
|
840
|
+
): Promise<boolean>;
|
|
535
841
|
actorQueueEnqueueAndWait(
|
|
536
842
|
ctx: ActorContextHandle,
|
|
537
843
|
name: string,
|
|
@@ -547,19 +853,56 @@ export interface CoreRuntime {
|
|
|
547
853
|
actorQueueInspectMessages(
|
|
548
854
|
ctx: ActorContextHandle,
|
|
549
855
|
): Promise<RuntimeQueueInspectMessage[]>;
|
|
856
|
+
actorQueueReset(ctx: ActorContextHandle): Promise<void>;
|
|
550
857
|
|
|
551
858
|
actorScheduleAfter(
|
|
552
859
|
ctx: ActorContextHandle,
|
|
553
860
|
durationMs: number,
|
|
554
861
|
actionName: string,
|
|
555
862
|
args: RuntimeBytes,
|
|
556
|
-
):
|
|
863
|
+
): Promise<string>;
|
|
557
864
|
actorScheduleAt(
|
|
558
865
|
ctx: ActorContextHandle,
|
|
559
866
|
timestampMs: number,
|
|
560
867
|
actionName: string,
|
|
561
868
|
args: RuntimeBytes,
|
|
562
|
-
):
|
|
869
|
+
): Promise<string>;
|
|
870
|
+
actorScheduleCancel(ctx: ActorContextHandle, id: string): Promise<boolean>;
|
|
871
|
+
actorScheduleGet(
|
|
872
|
+
ctx: ActorContextHandle,
|
|
873
|
+
id: string,
|
|
874
|
+
): Promise<RuntimeScheduledEventInfo | undefined>;
|
|
875
|
+
actorScheduleList(
|
|
876
|
+
ctx: ActorContextHandle,
|
|
877
|
+
): Promise<RuntimeScheduledEventInfo[]>;
|
|
878
|
+
actorCronSet(
|
|
879
|
+
ctx: ActorContextHandle,
|
|
880
|
+
name: string,
|
|
881
|
+
expression: string,
|
|
882
|
+
timezone: string | undefined,
|
|
883
|
+
actionName: string,
|
|
884
|
+
args: RuntimeBytes,
|
|
885
|
+
maxHistory: number | undefined,
|
|
886
|
+
): Promise<void>;
|
|
887
|
+
actorCronEvery(
|
|
888
|
+
ctx: ActorContextHandle,
|
|
889
|
+
name: string,
|
|
890
|
+
intervalMs: number,
|
|
891
|
+
actionName: string,
|
|
892
|
+
args: RuntimeBytes,
|
|
893
|
+
maxHistory: number | undefined,
|
|
894
|
+
): Promise<void>;
|
|
895
|
+
actorCronGet(
|
|
896
|
+
ctx: ActorContextHandle,
|
|
897
|
+
name: string,
|
|
898
|
+
): Promise<RuntimeCronJobInfo | undefined>;
|
|
899
|
+
actorCronList(ctx: ActorContextHandle): Promise<RuntimeCronJobInfo[]>;
|
|
900
|
+
actorCronDelete(ctx: ActorContextHandle, name: string): Promise<boolean>;
|
|
901
|
+
actorCronHistory(
|
|
902
|
+
ctx: ActorContextHandle,
|
|
903
|
+
name: string,
|
|
904
|
+
limit: number | undefined,
|
|
905
|
+
): Promise<RuntimeCronFire[]>;
|
|
563
906
|
|
|
564
907
|
connId(conn: ConnHandle): string;
|
|
565
908
|
connParams(conn: ConnHandle): RuntimeBytes;
|
|
@@ -592,21 +935,31 @@ export interface RuntimeBundle {
|
|
|
592
935
|
runtime: CoreRuntime;
|
|
593
936
|
}
|
|
594
937
|
|
|
938
|
+
export function servicesBinaryUnavailable(cause: unknown): Error {
|
|
939
|
+
return new Error(
|
|
940
|
+
"services.binary_unavailable: Install @rivet-dev/services yourself to run local Services, or set RIVET_SERVICES_BINARY to its executable path.",
|
|
941
|
+
{ cause },
|
|
942
|
+
);
|
|
943
|
+
}
|
|
944
|
+
|
|
595
945
|
export async function buildServeConfig(
|
|
596
946
|
config: RegistryConfig,
|
|
597
947
|
loadEnginePath: () => Promise<string>,
|
|
598
948
|
version: string,
|
|
949
|
+
loadServicesPath: () => Promise<string>,
|
|
599
950
|
): Promise<RuntimeServeConfig> {
|
|
600
951
|
if (!config.endpoint) {
|
|
601
952
|
throw new Error("registry endpoint is required");
|
|
602
953
|
}
|
|
603
954
|
|
|
604
955
|
const serveConfig: RuntimeServeConfig = {
|
|
605
|
-
version: config.
|
|
956
|
+
version: config.node.version,
|
|
606
957
|
endpoint: config.endpoint,
|
|
958
|
+
engineSpawn: config.engineSpawn,
|
|
607
959
|
token: config.token,
|
|
608
960
|
namespace: config.namespace,
|
|
609
|
-
poolName: config.
|
|
961
|
+
poolName: config.node.poolName,
|
|
962
|
+
startServices: config.startServices,
|
|
610
963
|
handleInspectorHttpInRuntime: true,
|
|
611
964
|
serverlessBasePath: config.serverless.basePath,
|
|
612
965
|
serverlessPackageVersion: version,
|
|
@@ -634,6 +987,18 @@ export async function buildServeConfig(
|
|
|
634
987
|
error: stringifyError(error),
|
|
635
988
|
});
|
|
636
989
|
}
|
|
990
|
+
if (config.startServices) {
|
|
991
|
+
const servicesBinary = process.env.RIVET_SERVICES_BINARY;
|
|
992
|
+
if (servicesBinary) {
|
|
993
|
+
serveConfig.servicesBinaryPath = servicesBinary;
|
|
994
|
+
} else {
|
|
995
|
+
try {
|
|
996
|
+
serveConfig.servicesBinaryPath = await loadServicesPath();
|
|
997
|
+
} catch (error) {
|
|
998
|
+
throw servicesBinaryUnavailable(error);
|
|
999
|
+
}
|
|
1000
|
+
}
|
|
1001
|
+
}
|
|
637
1002
|
serveConfig.engineHost = config.engineHost;
|
|
638
1003
|
serveConfig.enginePort = config.enginePort;
|
|
639
1004
|
if (config.test?.enabled) {
|