@ricsam/r5d-worker 0.0.185 → 0.0.187
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/runtime/executor.mjs +1 -1
- package/dist/mjs/runtime/releases/grants.mjs +8 -2
- package/dist/mjs/runtime/workspace/outer.mjs +4 -3
- package/dist/types/runtime/releases/grants.d.ts +1 -1
- package/dist/types/runtime/workspace/outer.d.ts +10 -5
- 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.187";
|
|
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.187" : "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>] [--initial-sync merge|reset]\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.187" : "development"
|
|
19
19
|
);
|
|
20
20
|
console.log(`Worker connected: ${runtime.resourceId}`);
|
|
21
21
|
let closing = false;
|
package/dist/mjs/package.json
CHANGED
|
@@ -173,7 +173,7 @@ class HostExecutor {
|
|
|
173
173
|
const request = ExecutorRequest.parse(input);
|
|
174
174
|
const principal = this.authenticate(request);
|
|
175
175
|
const command = request.command;
|
|
176
|
-
if (command.method === "adapter.register") return this.adapters.register(principal, command.grant, this.hello);
|
|
176
|
+
if (command.method === "adapter.register") return this.adapters.register(principal, command.grant, this.hello, this.authority()?.fence.ownerId);
|
|
177
177
|
if (command.method === "adapter.retire") return this.adapters.retire(principal, command.principalId, this.authority()?.fence.ownerId);
|
|
178
178
|
if (command.method === "status")
|
|
179
179
|
return {
|
|
@@ -8,6 +8,7 @@ import {
|
|
|
8
8
|
EXECUTOR_CAPABILITY
|
|
9
9
|
} from "../protocol.mjs";
|
|
10
10
|
const digest = (value) => createHash("sha256").update(canonicalJson(value)).digest("hex");
|
|
11
|
+
const withoutArtifact = ({ artifactDigest: _, ...rest }) => rest;
|
|
11
12
|
class AdapterGrantRegistry {
|
|
12
13
|
constructor(db, config) {
|
|
13
14
|
this.db = db;
|
|
@@ -48,7 +49,7 @@ class AdapterGrantRegistry {
|
|
|
48
49
|
};
|
|
49
50
|
});
|
|
50
51
|
}
|
|
51
|
-
register(controller, input, keeperHello) {
|
|
52
|
+
register(controller, input, keeperHello, authoritativeOwner) {
|
|
52
53
|
if (controller.role !== "controller") throw new ExecutorError("forbidden");
|
|
53
54
|
const grant = AdapterGrant.parse(input), p = grant.principal;
|
|
54
55
|
if (grant.installationId !== this.config.installationId || grant.workerId !== this.config.workerId)
|
|
@@ -64,8 +65,13 @@ class AdapterGrantRegistry {
|
|
|
64
65
|
throw new ExecutorError("grant_scope_exceeded");
|
|
65
66
|
const hash = digest(grant), rows = this.rows(), old = rows.find((row) => row.id === p.id);
|
|
66
67
|
if (old) {
|
|
67
|
-
if (old.digest !== hash) throw new ExecutorError("grant_identity_conflict");
|
|
68
68
|
if (old.state === "retired") throw new ExecutorError("adapter_retired");
|
|
69
|
+
if (old.digest !== hash) {
|
|
70
|
+
const prior = AdapterGrant.parse(JSON.parse(old.grant_json));
|
|
71
|
+
if (p.ownerId !== authoritativeOwner || canonicalJson(withoutArtifact(prior)) !== canonicalJson(withoutArtifact(grant)))
|
|
72
|
+
throw new ExecutorError("grant_identity_conflict");
|
|
73
|
+
this.db.query("UPDATE adapter_grants SET grant_json=?, digest=? WHERE id=?").run(canonicalJson(grant), hash, p.id);
|
|
74
|
+
}
|
|
69
75
|
return this.list().find((r) => r.principalId === p.id);
|
|
70
76
|
}
|
|
71
77
|
if (this.config.principals.some((s) => s.id === p.id || s.ownerId === p.ownerId) || rows.some((row) => {
|
|
@@ -178,18 +178,19 @@ class OuterRepository {
|
|
|
178
178
|
throw new OuterSnapshotRefusal(
|
|
179
179
|
"too_large",
|
|
180
180
|
`Unexplained workspace content exceeds the ${limit}-byte automatic publication limit`,
|
|
181
|
-
attribute(unexplainedPaths)
|
|
181
|
+
attribute(unexplainedPaths),
|
|
182
|
+
true
|
|
182
183
|
);
|
|
183
184
|
}
|
|
184
185
|
for (const file of unexplainedPaths) {
|
|
185
186
|
const bytes = await readRegular(path.join(this.workTree, file)).catch((error) => {
|
|
186
|
-
if (error instanceof WorkspaceError) throw new OuterSnapshotRefusal(error.code, error.message, [file]);
|
|
187
|
+
if (error instanceof WorkspaceError) throw new OuterSnapshotRefusal(error.code, error.message, [file], true);
|
|
187
188
|
throw error;
|
|
188
189
|
});
|
|
189
190
|
try {
|
|
190
191
|
sourceBytes(bytes, file);
|
|
191
192
|
} catch (error) {
|
|
192
|
-
if (error instanceof WorkspaceError) throw new OuterSnapshotRefusal(error.code, error.message, [file]);
|
|
193
|
+
if (error instanceof WorkspaceError) throw new OuterSnapshotRefusal(error.code, error.message, [file], true);
|
|
193
194
|
throw error;
|
|
194
195
|
}
|
|
195
196
|
}
|
|
@@ -11,6 +11,6 @@ export declare class AdapterGrantRegistry {
|
|
|
11
11
|
find(id: string): AdapterGrant | undefined;
|
|
12
12
|
hasOwner(owner: string): boolean;
|
|
13
13
|
list(): AdapterRegistration[];
|
|
14
|
-
register(controller: Principal, input: AdapterGrant, keeperHello: RuntimeHello): AdapterRegistration;
|
|
14
|
+
register(controller: Principal, input: AdapterGrant, keeperHello: RuntimeHello, authoritativeOwner?: string): AdapterRegistration;
|
|
15
15
|
retire(controller: Principal, id: string, authoritativeOwner?: string): AdapterRegistration;
|
|
16
16
|
}
|
|
@@ -44,12 +44,17 @@ export type OuterTreeEntry = {
|
|
|
44
44
|
mode: string;
|
|
45
45
|
oid: string;
|
|
46
46
|
};
|
|
47
|
-
/** A refusal that names the paths responsible, for the incident evidence.
|
|
48
|
-
|
|
47
|
+
/** A refusal that names the paths responsible, for the incident evidence.
|
|
48
|
+
*
|
|
49
|
+
* `definite` means the outcome is settled: either nothing happened, or what
|
|
49
50
|
* happened (conflict markers written, state saved) is fully recorded in the
|
|
50
|
-
* durable outer state and re-running the same command refuses the same way.
|
|
51
|
-
*
|
|
52
|
-
*
|
|
51
|
+
* durable outer state and re-running the same command refuses the same way. It
|
|
52
|
+
* travels as the relay's `rejectedBeforeAdmission`, so a caller receives a
|
|
53
|
+
* typed error instead of an uncertain outcome that blocks its run. Every
|
|
54
|
+
* refusal raised while measuring the workspace qualifies, since it is thrown
|
|
55
|
+
* before anything is staged, committed or published; leaving them uncertain
|
|
56
|
+
* turned "your workspace is too large" into `action_unknown` for the caller
|
|
57
|
+
* (stage 2026-09-18 run 27). */
|
|
53
58
|
export declare class OuterSnapshotRefusal extends WorkspaceError {
|
|
54
59
|
readonly paths: string[];
|
|
55
60
|
constructor(code: string, message: string, paths: string[], definite?: boolean);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ricsam/r5d-worker",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.187",
|
|
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.187",
|
|
25
25
|
"node-pty": "1.1.0",
|
|
26
26
|
"zod": "^4.1.13",
|
|
27
27
|
"picomatch": "^4.0.3"
|