@ricsam/r5d-worker 0.0.158 → 0.0.160
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/cjs/package.json +1 -1
- package/dist/mjs/internal-r5dctl.cjs +1 -1
- package/dist/mjs/main.mjs +2 -2
- package/dist/mjs/package.json +1 -1
- package/dist/mjs/personal/runtime.mjs +0 -1
- package/dist/mjs/runtime/workspace/authority.mjs +2 -22
- package/dist/mjs/runtime/workspace/contracts.mjs +0 -21
- package/dist/mjs/runtime/workspace/files.mjs +13 -33
- package/dist/types/runtime/workspace/contracts.d.ts +0 -1
- package/dist/types/runtime/workspace/files.d.ts +0 -1
- package/package.json +2 -2
package/dist/cjs/package.json
CHANGED
|
@@ -20605,7 +20605,7 @@ function resolveEntrypointPath(entrypoint) {
|
|
|
20605
20605
|
}
|
|
20606
20606
|
}
|
|
20607
20607
|
function getR5dctlVersion() {
|
|
20608
|
-
if (true) return "0.0.
|
|
20608
|
+
if (true) return "0.0.160";
|
|
20609
20609
|
const entrypoint = process.argv[1] ? resolveEntrypointPath(process.argv[1]) : null;
|
|
20610
20610
|
let current = entrypoint ? import_node_path2.default.dirname(entrypoint) : process.cwd();
|
|
20611
20611
|
for (let index = 0; index < 12; index += 1) {
|
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.160" : "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.160" : "development"
|
|
19
19
|
);
|
|
20
20
|
console.log(`Worker connected: ${runtime.resourceId}`);
|
|
21
21
|
let closing = false;
|
package/dist/mjs/package.json
CHANGED
|
@@ -9,8 +9,7 @@ import { ExecutorError, isDefiniteStartRejection, ShellPayload } from "../protoc
|
|
|
9
9
|
import {
|
|
10
10
|
ApprovedWorkbench,
|
|
11
11
|
WorkspaceConfig,
|
|
12
|
-
WorkspaceError
|
|
13
|
-
DEFAULT_WORKSPACE_IGNORE
|
|
12
|
+
WorkspaceError
|
|
14
13
|
} from "./contracts.mjs";
|
|
15
14
|
import { SessionArtifactStore, SessionArtifactChunk, RESERVED_ARTIFACT_ENV } from "./artifacts.mjs";
|
|
16
15
|
import { WorkspaceFileWrite, WorkspaceFileWriteLookup } from "./file-write.mjs";
|
|
@@ -27,8 +26,7 @@ import {
|
|
|
27
26
|
selectedTree,
|
|
28
27
|
sha256,
|
|
29
28
|
snapshotTree,
|
|
30
|
-
sourceBytes
|
|
31
|
-
verifyIgnore
|
|
29
|
+
sourceBytes
|
|
32
30
|
} from "./files.mjs";
|
|
33
31
|
const GITHUB_CREDENTIAL_HELPER = '!f() { if [ "$1" = get ] && [ -n "$R5D_GIT_CREDENTIAL" ]; then git credential-store --file="$R5D_GIT_CREDENTIAL" get; else return 0; fi; }; f';
|
|
34
32
|
class WorkspaceAuthority {
|
|
@@ -554,7 +552,6 @@ class WorkspaceAuthority {
|
|
|
554
552
|
const staged = path.join(b.directory, `hydrate-${randomUUID()}`);
|
|
555
553
|
await fs.mkdir(staged, { mode: 448 });
|
|
556
554
|
await materializeTree(b.repo, staged, entries, 128 * 1024 * 1024, "Hydrated tree exceeds limit");
|
|
557
|
-
await verifyIgnore(b.repo, staged);
|
|
558
555
|
const latest = await storage.read({
|
|
559
556
|
method: "repository.get",
|
|
560
557
|
repositoryId: b.config.repositoryId,
|
|
@@ -767,14 +764,12 @@ class WorkspaceAuthority {
|
|
|
767
764
|
branch: b.config.branch
|
|
768
765
|
});
|
|
769
766
|
if (existing.head) throw new WorkspaceError("conflict", "Canonical branch already has a head; hydrate instead");
|
|
770
|
-
await fs.writeFile(path.join(b.config.cwd, ".gitignore"), DEFAULT_WORKSPACE_IGNORE, { mode: 384, flag: "wx" });
|
|
771
767
|
await fs.writeFile(path.join(b.config.cwd, "README.md"), readme, { mode: 384, flag: "wx" });
|
|
772
768
|
b.state.initialized = true;
|
|
773
769
|
b.state.blocked = null;
|
|
774
770
|
await this.save(b);
|
|
775
771
|
const result = await this.publishIdle(b, identity);
|
|
776
772
|
if (this.linkedWorkbench(b)) {
|
|
777
|
-
await fs.unlink(path.join(b.config.cwd, ".gitignore"));
|
|
778
773
|
await fs.unlink(path.join(b.config.cwd, "README.md"));
|
|
779
774
|
}
|
|
780
775
|
await this.installGitPolicy(b, result.head);
|
|
@@ -1037,21 +1032,6 @@ class WorkspaceAuthority {
|
|
|
1037
1032
|
const staged = path.join(b.directory, `import-${randomUUID()}`);
|
|
1038
1033
|
await fs.mkdir(staged, { mode: 448 });
|
|
1039
1034
|
await materializeTree(b.repo, staged, entries, STORAGE_LIMITS.blobBytes, "Imported tree exceeds limit");
|
|
1040
|
-
const ignore = path.join(staged, ".gitignore");
|
|
1041
|
-
try {
|
|
1042
|
-
await verifyIgnore(b.repo, staged);
|
|
1043
|
-
} catch (error) {
|
|
1044
|
-
if (!(error instanceof WorkspaceError) && error.code !== "ENOENT") throw error;
|
|
1045
|
-
const oldIgnore = await fs.readFile(ignore, "utf8").catch((error2) => {
|
|
1046
|
-
if (error2.code === "ENOENT") return "";
|
|
1047
|
-
throw error2;
|
|
1048
|
-
});
|
|
1049
|
-
await fs.writeFile(ignore, `${oldIgnore}
|
|
1050
|
-
${DEFAULT_WORKSPACE_IGNORE}`, { mode: 384 });
|
|
1051
|
-
await verifyIgnore(b.repo, staged);
|
|
1052
|
-
}
|
|
1053
|
-
const tree = await snapshotTree(b.repo, staged, head);
|
|
1054
|
-
if (tree !== (await git(b.repo, ["rev-parse", `${head}^{tree}`])).toString().trim()) head = (await git(b.repo, ["commit-tree", tree, "-p", head], "Configure workspace exclusions\n")).toString().trim();
|
|
1055
1035
|
const storage = await this.storage(b, identity), operationId = `product-${sha256(id).slice(0, 48)}`;
|
|
1056
1036
|
let existing;
|
|
1057
1037
|
try {
|
|
@@ -36,29 +36,8 @@ class WorkspaceError extends Error {
|
|
|
36
36
|
code;
|
|
37
37
|
rejectedBeforeAdmission;
|
|
38
38
|
}
|
|
39
|
-
const DEFAULT_WORKSPACE_IGNORE = `# Required destination workbench exclusions; keep these rules effective.
|
|
40
|
-
.env
|
|
41
|
-
.env.*
|
|
42
|
-
!.env.example
|
|
43
|
-
node_modules/
|
|
44
|
-
.r5d/
|
|
45
|
-
.r5d-next/
|
|
46
|
-
.ssh/
|
|
47
|
-
.kube/
|
|
48
|
-
secrets/
|
|
49
|
-
credentials/
|
|
50
|
-
.next/
|
|
51
|
-
dist/
|
|
52
|
-
build/
|
|
53
|
-
coverage/
|
|
54
|
-
.cache/
|
|
55
|
-
.bun/
|
|
56
|
-
*.pem
|
|
57
|
-
*.key
|
|
58
|
-
`;
|
|
59
39
|
export {
|
|
60
40
|
ApprovedWorkbench,
|
|
61
|
-
DEFAULT_WORKSPACE_IGNORE,
|
|
62
41
|
WorkspaceConfig,
|
|
63
42
|
WorkspaceError
|
|
64
43
|
};
|
|
@@ -253,36 +253,19 @@ async function materializeTree(repo, destination, entries, limit, message) {
|
|
|
253
253
|
await fs.writeFile(target, bytes, { mode: entry.mode === "100755" ? 448 : 384, flag: "wx" });
|
|
254
254
|
}
|
|
255
255
|
}
|
|
256
|
-
async function verifyIgnore(repo, cwd) {
|
|
257
|
-
try {
|
|
258
|
-
await readRegular(path.join(cwd, ".gitignore"), 64 * 1024);
|
|
259
|
-
} catch (error) {
|
|
260
|
-
if (error.code === "ENOENT")
|
|
261
|
-
throw new WorkspaceError("ignore_policy", "Restore an effective .gitignore before publishing source");
|
|
262
|
-
throw error;
|
|
263
|
-
}
|
|
264
|
-
const probes = [
|
|
265
|
-
".env",
|
|
266
|
-
".env.local",
|
|
267
|
-
"node_modules/probe",
|
|
268
|
-
".r5d/probe",
|
|
269
|
-
".r5d-next/probe",
|
|
270
|
-
".ssh/probe",
|
|
271
|
-
".kube/probe",
|
|
272
|
-
"secrets/probe",
|
|
273
|
-
"credentials/probe",
|
|
274
|
-
".next/probe",
|
|
275
|
-
"dist/probe",
|
|
276
|
-
"coverage/probe",
|
|
277
|
-
".cache/probe",
|
|
278
|
-
"probe.pem",
|
|
279
|
-
"probe.key"
|
|
280
|
-
];
|
|
281
|
-
const ignored = (await git(repo, [`--work-tree=${cwd}`, "check-ignore", "--no-index", "-z", "--stdin"], probes.join("\0") + "\0")).toString().split("\0").filter(Boolean);
|
|
282
|
-
if (ignored.length !== probes.length || probes.some((p) => !ignored.includes(p)))
|
|
283
|
-
throw new WorkspaceError("ignore_policy", "Restore effective .gitignore rules for secrets, dependency, cache and runtime roots");
|
|
284
|
-
}
|
|
285
256
|
async function snapshotTree(repo, cwd, canonicalHead, maxBytes = 128 * 1024 * 1024) {
|
|
257
|
+
const exposedRootDependencies = await git(repo, [
|
|
258
|
+
`--work-tree=${cwd}`,
|
|
259
|
+
"ls-files",
|
|
260
|
+
"--others",
|
|
261
|
+
"--exclude-standard",
|
|
262
|
+
"--directory",
|
|
263
|
+
"-z",
|
|
264
|
+
"--",
|
|
265
|
+
":(glob)**/node_modules/**"
|
|
266
|
+
]);
|
|
267
|
+
if (exposedRootDependencies.length)
|
|
268
|
+
throw new WorkspaceError("too_large", "An unignored dependency tree exceeds the automatic publication limit");
|
|
286
269
|
const metadata = path.join(cwd, ".git");
|
|
287
270
|
let workbenchIndex = null;
|
|
288
271
|
if (await fs.lstat(metadata).then(
|
|
@@ -419,8 +402,6 @@ async function snapshotTree(repo, cwd, canonicalHead, maxBytes = 128 * 1024 * 10
|
|
|
419
402
|
const oid = (await git(repo, ["hash-object", "-w", "--stdin", "--no-filters"], bytes)).toString().trim();
|
|
420
403
|
records.push({ file, value: `${st.mode & 73 ? "100755" : "100644"} ${oid} ${file}\0` });
|
|
421
404
|
}
|
|
422
|
-
if (!files.includes(".gitignore")) throw new WorkspaceError("ignore_policy", "The .gitignore policy itself must be published");
|
|
423
|
-
await verifyIgnore(repo, cwd);
|
|
424
405
|
await git(repo, ["update-index", "-z", "--index-info"], records.sort((a, b) => a.file.localeCompare(b.file)).map((record) => record.value).join(""));
|
|
425
406
|
return (await git(repo, ["write-tree"])).toString().trim();
|
|
426
407
|
}
|
|
@@ -437,6 +418,5 @@ export {
|
|
|
437
418
|
sha256,
|
|
438
419
|
snapshotTree,
|
|
439
420
|
sourceBytes,
|
|
440
|
-
sourcePath
|
|
441
|
-
verifyIgnore
|
|
421
|
+
sourcePath
|
|
442
422
|
};
|
|
@@ -87,4 +87,3 @@ export type WorkspaceState = {
|
|
|
87
87
|
completedAt?: string;
|
|
88
88
|
}>;
|
|
89
89
|
};
|
|
90
|
-
export declare const DEFAULT_WORKSPACE_IGNORE = "# Required destination workbench exclusions; keep these rules effective.\n.env\n.env.*\n!.env.example\nnode_modules/\n.r5d/\n.r5d-next/\n.ssh/\n.kube/\nsecrets/\ncredentials/\n.next/\ndist/\nbuild/\ncoverage/\n.cache/\n.bun/\n*.pem\n*.key\n";
|
|
@@ -25,5 +25,4 @@ export type TreeEntry = {
|
|
|
25
25
|
};
|
|
26
26
|
export declare function selectedTree(repo: string, commit: string): Promise<TreeEntry[]>;
|
|
27
27
|
export declare function materializeTree(repo: string, destination: string, entries: TreeEntry[], limit: number, message: string): Promise<void>;
|
|
28
|
-
export declare function verifyIgnore(repo: string, cwd: string): Promise<void>;
|
|
29
28
|
export declare function snapshotTree(repo: string, cwd: string, canonicalHead?: string | null, maxBytes?: number): Promise<string>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ricsam/r5d-worker",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.160",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./dist/mjs/main.mjs",
|
|
6
6
|
"module": "./dist/mjs/main.mjs",
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
"r5d-worker": "dist/mjs/main.mjs"
|
|
22
22
|
},
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@ricsam/r5d-api": "^0.0.
|
|
24
|
+
"@ricsam/r5d-api": "^0.0.160",
|
|
25
25
|
"node-pty": "1.1.0",
|
|
26
26
|
"zod": "^4.1.13",
|
|
27
27
|
"picomatch": "^4.0.3"
|