durable-actors 0.2.4 → 0.2.5
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/cli/rust-runtime.js +3 -3
- package/dist/client/telemetry.js +1 -1
- package/dist/environment.d.ts.map +1 -1
- package/dist/environment.js +0 -8
- package/dist/environment.js.map +1 -1
- package/dist/host/actor-host.js +8 -8
- package/dist/localRuntime.js +2 -2
- package/dist/templates/actor/package.json +1 -1
- package/dist/templates/ai-chat/package.json +1 -1
- package/dist/templates/chat/package.json +1 -1
- package/dist/templates/documents/package.json +1 -1
- package/package.json +1 -1
package/dist/cli/rust-runtime.js
CHANGED
|
@@ -4,8 +4,8 @@ function runtimeEnvironment(executable) {
|
|
|
4
4
|
return {
|
|
5
5
|
...process.env,
|
|
6
6
|
PATH: `${path.dirname(executable)}${path.delimiter}${process.env.PATH ?? ""}`,
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
DURABLE_ACTORS_PROCESS_ROLE: process.env.DURABLE_ACTORS_PROCESS_ROLE ?? "control_plane",
|
|
8
|
+
DURABLE_ACTORS_PARENT_LIFETIME_STDIN: "1"
|
|
9
9
|
};
|
|
10
10
|
}
|
|
11
11
|
// This subprocess exists solely to run the native Rust control plane.
|
|
@@ -20,7 +20,7 @@ function startRustRuntime(command, args, env, parentLifetime, readiness = false)
|
|
|
20
20
|
const parentClosed = () => child.stdin?.end();
|
|
21
21
|
process.on("SIGINT", interrupt);
|
|
22
22
|
process.on("SIGTERM", terminate);
|
|
23
|
-
if (parentLifetime && process.env.
|
|
23
|
+
if (parentLifetime && process.env.DURABLE_ACTORS_PARENT_LIFETIME_STDIN) {
|
|
24
24
|
process.stdin.resume();
|
|
25
25
|
process.stdin.on("end", parentClosed);
|
|
26
26
|
}
|
package/dist/client/telemetry.js
CHANGED
|
@@ -16,7 +16,7 @@ class LatencyTimeline {
|
|
|
16
16
|
}
|
|
17
17
|
}
|
|
18
18
|
const stderrTelemetry = event => {
|
|
19
|
-
if (process.env.
|
|
19
|
+
if (process.env.DURABLE_ACTORS_TELEMETRY !== "0")
|
|
20
20
|
process.stderr.write(`${JSON.stringify(event)}\n`);
|
|
21
21
|
};
|
|
22
22
|
export { LatencyTimeline, stderrTelemetry };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"environment.d.ts","sourceRoot":"","sources":["../src/environment.ts"],"names":[],"mappings":"AAAA,wBAAgB,gBAAgB,CAAC,WAAW,EAAE,MAAM,CAAC,UAAU,GAAG,MAAM,CAAC,UAAU,
|
|
1
|
+
{"version":3,"file":"environment.d.ts","sourceRoot":"","sources":["../src/environment.ts"],"names":[],"mappings":"AAAA,wBAAgB,gBAAgB,CAAC,WAAW,EAAE,MAAM,CAAC,UAAU,GAAG,MAAM,CAAC,UAAU,CAQlF"}
|
package/dist/environment.js
CHANGED
|
@@ -1,18 +1,10 @@
|
|
|
1
1
|
export function actorEnvironment(environment) {
|
|
2
2
|
const resolved = { ...environment };
|
|
3
|
-
for (const [name, value] of Object.entries(environment)) {
|
|
4
|
-
if (name.startsWith("DURABLE_OBJECT_") && value !== undefined)
|
|
5
|
-
resolved[name.replace("DURABLE_OBJECT_", "DURABLE_ACTORS_")] ??= value;
|
|
6
|
-
}
|
|
7
3
|
const secret = resolved.DURABLE_ACTORS_SECRET ?? resolved.DURABLE_ACTORS_API_KEY;
|
|
8
4
|
if (secret !== undefined) {
|
|
9
5
|
resolved.DURABLE_ACTORS_SECRET = secret;
|
|
10
6
|
resolved.DURABLE_ACTORS_API_KEY = secret;
|
|
11
7
|
}
|
|
12
|
-
for (const [name, value] of Object.entries(resolved)) {
|
|
13
|
-
if (name.startsWith("DURABLE_ACTORS_") && value !== undefined)
|
|
14
|
-
resolved[name.replace("DURABLE_ACTORS_", "DURABLE_OBJECT_")] = value;
|
|
15
|
-
}
|
|
16
8
|
return resolved;
|
|
17
9
|
}
|
|
18
10
|
//# sourceMappingURL=environment.js.map
|
package/dist/environment.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"environment.js","sourceRoot":"","sources":["../src/environment.ts"],"names":[],"mappings":"AAAA,MAAM,UAAU,gBAAgB,CAAC,WAA8B;IAC3D,MAAM,QAAQ,GAAG,EAAE,GAAG,WAAW,EAAE,CAAA;IACnC,
|
|
1
|
+
{"version":3,"file":"environment.js","sourceRoot":"","sources":["../src/environment.ts"],"names":[],"mappings":"AAAA,MAAM,UAAU,gBAAgB,CAAC,WAA8B;IAC3D,MAAM,QAAQ,GAAG,EAAE,GAAG,WAAW,EAAE,CAAA;IACnC,MAAM,MAAM,GAAG,QAAQ,CAAC,qBAAqB,IAAI,QAAQ,CAAC,sBAAsB,CAAA;IAChF,IAAI,MAAM,KAAK,SAAS,EAAE,CAAC;QACvB,QAAQ,CAAC,qBAAqB,GAAG,MAAM,CAAA;QACvC,QAAQ,CAAC,sBAAsB,GAAG,MAAM,CAAA;IAC5C,CAAC;IACD,OAAO,QAAQ,CAAA;AACnB,CAAC"}
|
package/dist/host/actor-host.js
CHANGED
|
@@ -358,10 +358,10 @@ function parseHostSettings(environment) {
|
|
|
358
358
|
if (!result.success)
|
|
359
359
|
throw new ActorConfigurationError(`actor-host session settings are invalid: ${result.error.message}`);
|
|
360
360
|
return {
|
|
361
|
-
socketPath: result.data.
|
|
362
|
-
actorEntrypoint: result.data.
|
|
363
|
-
startupTimeoutMs: parseStartupTimeout(environment.
|
|
364
|
-
actorIdleTimeoutMs: parseActorIdleTimeout(environment.
|
|
361
|
+
socketPath: result.data.DURABLE_ACTORS_EXECUTOR_SOCKET,
|
|
362
|
+
actorEntrypoint: result.data.DURABLE_ACTORS_ENTRYPOINT,
|
|
363
|
+
startupTimeoutMs: parseStartupTimeout(environment.DURABLE_ACTORS_HOST_STARTUP_MS),
|
|
364
|
+
actorIdleTimeoutMs: parseActorIdleTimeout(environment.DURABLE_ACTORS_ACTOR_IDLE_TIMEOUT_SECONDS)
|
|
365
365
|
};
|
|
366
366
|
}
|
|
367
367
|
function parseStartupTimeout(value) {
|
|
@@ -369,7 +369,7 @@ function parseStartupTimeout(value) {
|
|
|
369
369
|
return DEFAULT_ACTOR_STARTUP_TIMEOUT_MS;
|
|
370
370
|
const parsed = Number(value);
|
|
371
371
|
if (!Number.isInteger(parsed) || parsed <= 0)
|
|
372
|
-
throw new ActorConfigurationError("
|
|
372
|
+
throw new ActorConfigurationError("DURABLE_ACTORS_HOST_STARTUP_MS must be a positive integer");
|
|
373
373
|
return parsed;
|
|
374
374
|
}
|
|
375
375
|
function parseActorIdleTimeout(value) {
|
|
@@ -377,15 +377,15 @@ function parseActorIdleTimeout(value) {
|
|
|
377
377
|
return DEFAULT_ACTOR_IDLE_TIMEOUT_MS;
|
|
378
378
|
const parsed = Number(value);
|
|
379
379
|
if (!Number.isInteger(parsed) || parsed <= 0 || parsed > MAX_ACTOR_IDLE_TIMEOUT_SECONDS) {
|
|
380
|
-
throw new ActorConfigurationError(`
|
|
380
|
+
throw new ActorConfigurationError(`DURABLE_ACTORS_ACTOR_IDLE_TIMEOUT_SECONDS must be an integer between 1 and ${MAX_ACTOR_IDLE_TIMEOUT_SECONDS}`);
|
|
381
381
|
}
|
|
382
382
|
return parsed * 1_000;
|
|
383
383
|
}
|
|
384
384
|
const DEFAULT_ACTOR_STARTUP_TIMEOUT_MS = 10_000;
|
|
385
385
|
const MAX_ACTOR_IDLE_TIMEOUT_SECONDS = 86_400;
|
|
386
386
|
const actorSessionSettingsSchema = z.object({
|
|
387
|
-
|
|
388
|
-
|
|
387
|
+
DURABLE_ACTORS_EXECUTOR_SOCKET: z.string().trim().min(1),
|
|
388
|
+
DURABLE_ACTORS_ENTRYPOINT: z.string().trim().min(1).optional()
|
|
389
389
|
});
|
|
390
390
|
const DEFAULT_ACTOR_ENTRYPOINT = "dist/actors.mjs";
|
|
391
391
|
export { ActorSession, connectSocket, parseHostSettings, prepareActorEntrypoint, resolveActorEntrypoint, runActorHost, serializeWithinBytes };
|
package/dist/localRuntime.js
CHANGED
|
@@ -50,8 +50,8 @@ function launch(executable, options) {
|
|
|
50
50
|
env: {
|
|
51
51
|
...actorEnvironment(process.env),
|
|
52
52
|
PATH: `${path.dirname(process.execPath)}${path.delimiter}${path.dirname(executable)}${path.delimiter}${process.env.PATH ?? ""}`,
|
|
53
|
-
|
|
54
|
-
|
|
53
|
+
DURABLE_ACTORS_PROCESS_ROLE: "control_plane",
|
|
54
|
+
DURABLE_ACTORS_PARENT_LIFETIME_STDIN: "1"
|
|
55
55
|
},
|
|
56
56
|
stdio: ["pipe", options.quiet ? "ignore" : "inherit", options.quiet ? "ignore" : "inherit", "pipe"]
|
|
57
57
|
});
|