@ricsam/r5d-worker 0.0.152 → 0.0.153
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 +1 -1
- package/dist/cjs/package.json +1 -1
- package/dist/mjs/internal-r5dctl.cjs +24122 -0
- package/dist/mjs/main.mjs +2 -2
- package/dist/mjs/package.json +1 -1
- package/dist/mjs/personal/cli-entrypoint.mjs +22 -6
- package/dist/mjs/personal/runtime.mjs +1 -1
- package/dist/types/personal/cli-entrypoint.d.ts +1 -0
- package/package.json +2 -3
package/dist/mjs/main.mjs
CHANGED
|
@@ -7,7 +7,7 @@ import { startManagerRpc } from "./runtime/releases/rpc-main.mjs";
|
|
|
7
7
|
import { ManagerRpcConfig } from "./runtime/releases/rpc-protocol.mjs";
|
|
8
8
|
const args = process.argv.slice(2);
|
|
9
9
|
if (args.includes("--version")) {
|
|
10
|
-
console.log(`r5d-worker ${true ? "0.0.
|
|
10
|
+
console.log(`r5d-worker ${true ? "0.0.153" : "development"}`);
|
|
11
11
|
} else if (!args.length || args.includes("--help")) {
|
|
12
12
|
console.log(
|
|
13
13
|
"Usage: r5d-worker start --label <label> [--root <dir>] [--base-url <url>] [--token <worker-token>]\n r5d-worker executor /absolute/private/config.json\n r5d-worker manager /absolute/private/config.json\n\nRun independently supervised durable runtime services. Provision configuration with r5dinfra."
|
|
@@ -15,7 +15,7 @@ if (args.includes("--version")) {
|
|
|
15
15
|
} else if (args[0] === "start") {
|
|
16
16
|
const runtime = await startPersonalWorker(
|
|
17
17
|
parsePersonalWorkerOptions(args.slice(1)),
|
|
18
|
-
true ? "0.0.
|
|
18
|
+
true ? "0.0.153" : "development"
|
|
19
19
|
);
|
|
20
20
|
console.log(`Worker connected: ${runtime.resourceId}`);
|
|
21
21
|
let closing = false;
|
package/dist/mjs/package.json
CHANGED
|
@@ -6,6 +6,16 @@ function packageMain(moduleUrl) {
|
|
|
6
6
|
const module = fileURLToPath(moduleUrl);
|
|
7
7
|
return path.join(path.dirname(module), path.extname(module) === ".cjs" ? "main.cjs" : "main.mjs");
|
|
8
8
|
}
|
|
9
|
+
function internalMain(moduleUrl) {
|
|
10
|
+
return path.join(path.dirname(fileURLToPath(moduleUrl)), "..", "internal-r5dctl.cjs");
|
|
11
|
+
}
|
|
12
|
+
async function inspectInternal(candidate) {
|
|
13
|
+
const entrypoint = await fs.realpath(candidate);
|
|
14
|
+
const stat = await fs.lstat(entrypoint);
|
|
15
|
+
if (!stat.isFile() || stat.nlink !== 1 || stat.mode & 2 || ![0, process.getuid?.()].includes(stat.uid))
|
|
16
|
+
throw new Error("Untrusted internal r5dctl entrypoint");
|
|
17
|
+
return entrypoint;
|
|
18
|
+
}
|
|
9
19
|
async function inspectPackage(candidate) {
|
|
10
20
|
const entrypoint = await fs.realpath(candidate);
|
|
11
21
|
const entrypointStat = await fs.lstat(entrypoint);
|
|
@@ -39,13 +49,19 @@ async function resolvePersonalCliEntrypoint(explicit, workerVersion, dependencie
|
|
|
39
49
|
source = "explicit";
|
|
40
50
|
candidate = explicit;
|
|
41
51
|
} else {
|
|
52
|
+
const bundled = dependencies.bundled ?? internalMain(import.meta.url);
|
|
42
53
|
try {
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
54
|
+
return { entrypoint: await inspectInternal(bundled), version: workerVersion, source: "bundled" };
|
|
55
|
+
} catch (error) {
|
|
56
|
+
if (error.code !== "ENOENT" || workerVersion !== "development") throw error;
|
|
57
|
+
try {
|
|
58
|
+
const resolvePackage = dependencies.resolvePackage ?? ((specifier) => import.meta.resolve(specifier));
|
|
59
|
+
candidate = packageMain(resolvePackage(`${PACKAGE_NAME}/cli`));
|
|
60
|
+
source = "bundled";
|
|
61
|
+
} catch {
|
|
62
|
+
source = "path";
|
|
63
|
+
candidate = (dependencies.which ?? Bun.which)("r5dctl");
|
|
64
|
+
}
|
|
49
65
|
}
|
|
50
66
|
}
|
|
51
67
|
if (!candidate) throw new Error("Install @ricsam/r5dctl before starting this worker");
|
|
@@ -105,7 +105,7 @@ async function openPersonalWorkerRuntime(options) {
|
|
|
105
105
|
let cliDirectory;
|
|
106
106
|
if (options.cliEntrypoint) {
|
|
107
107
|
const cli = await fs.realpath(options.cliEntrypoint), executable = await fs.realpath(process.execPath), stat = await fs.lstat(cli);
|
|
108
|
-
if (!stat.isFile() || stat.mode &
|
|
108
|
+
if (!stat.isFile() || stat.nlink !== 1 || stat.mode & 2 || ![0, process.getuid?.()].includes(stat.uid))
|
|
109
109
|
throw new Error("Untrusted installed r5dctl entrypoint");
|
|
110
110
|
cliDirectory = path.join(root, "bin");
|
|
111
111
|
privateDirectory(cliDirectory);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ricsam/r5d-worker",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.153",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./dist/mjs/main.mjs",
|
|
6
6
|
"module": "./dist/mjs/main.mjs",
|
|
@@ -21,8 +21,7 @@
|
|
|
21
21
|
"r5d-worker": "dist/mjs/main.mjs"
|
|
22
22
|
},
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@ricsam/r5d-api": "^0.0.
|
|
25
|
-
"@ricsam/r5dctl": "0.0.152",
|
|
24
|
+
"@ricsam/r5d-api": "^0.0.153",
|
|
26
25
|
"node-pty": "1.1.0",
|
|
27
26
|
"zod": "^4.1.13",
|
|
28
27
|
"picomatch": "^4.0.3"
|