pi-daddy 0.18.0 → 0.19.0
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/CHANGELOG.md +154 -0
- package/README.md +46 -2
- package/contracts/ledger/v2/README.md +59 -0
- package/contracts/ledger/v2/fixtures/capability-decision.json +95 -0
- package/contracts/ledger/v2/fixtures/check-receipt.json +40 -0
- package/contracts/ledger/v2/fixtures/child-lifecycle.json +42 -0
- package/contracts/ledger/v2/fixtures/workspace-lease.json +41 -0
- package/contracts/ledger/v2/ledger-event.schema.json +633 -0
- package/dist/approval-prompt.d.ts +2 -1
- package/dist/approval-prompt.d.ts.map +1 -1
- package/dist/approval-prompt.js +9 -0
- package/dist/approval-prompt.js.map +1 -1
- package/dist/approval.d.ts +4 -2
- package/dist/approval.d.ts.map +1 -1
- package/dist/approval.js +4 -0
- package/dist/approval.js.map +1 -1
- package/dist/capabilities.d.ts +105 -0
- package/dist/capabilities.d.ts.map +1 -1
- package/dist/capabilities.js +161 -3
- package/dist/capabilities.js.map +1 -1
- package/dist/catalog.d.ts +15 -1
- package/dist/catalog.d.ts.map +1 -1
- package/dist/catalog.js +54 -3
- package/dist/catalog.js.map +1 -1
- package/dist/check-runner.d.ts.map +1 -1
- package/dist/check-runner.js +5 -7
- package/dist/check-runner.js.map +1 -1
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +21 -1
- package/dist/cli.js.map +1 -1
- package/dist/definitions.d.ts.map +1 -1
- package/dist/definitions.js +7 -1
- package/dist/definitions.js.map +1 -1
- package/dist/delegate.d.ts.map +1 -1
- package/dist/delegate.js +32 -4
- package/dist/delegate.js.map +1 -1
- package/dist/delegation-approval.d.ts.map +1 -1
- package/dist/delegation-approval.js +37 -12
- package/dist/delegation-approval.js.map +1 -1
- package/dist/executor.d.ts +2 -1
- package/dist/executor.d.ts.map +1 -1
- package/dist/executor.js +1 -0
- package/dist/executor.js.map +1 -1
- package/dist/grant-env.d.ts +2 -0
- package/dist/grant-env.d.ts.map +1 -1
- package/dist/grant-env.js +26 -3
- package/dist/grant-env.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/init.d.ts +13 -1
- package/dist/init.d.ts.map +1 -1
- package/dist/init.js +35 -2
- package/dist/init.js.map +1 -1
- package/dist/lease-helper.d.ts +58 -0
- package/dist/lease-helper.d.ts.map +1 -0
- package/dist/lease-helper.js +94 -0
- package/dist/lease-helper.js.map +1 -0
- package/dist/lease-record.d.ts +15 -3
- package/dist/lease-record.d.ts.map +1 -1
- package/dist/lease-record.js.map +1 -1
- package/dist/ledger-events.d.ts +35 -14
- package/dist/ledger-events.d.ts.map +1 -1
- package/dist/ledger-events.js +41 -0
- package/dist/ledger-events.js.map +1 -1
- package/dist/ledger.d.ts +10 -5
- package/dist/ledger.d.ts.map +1 -1
- package/dist/ledger.js +13 -3
- package/dist/ledger.js.map +1 -1
- package/dist/propagation.d.ts +16 -0
- package/dist/propagation.d.ts.map +1 -1
- package/dist/propagation.js +22 -2
- package/dist/propagation.js.map +1 -1
- package/dist/refusals.d.ts +1 -1
- package/dist/refusals.d.ts.map +1 -1
- package/dist/refusals.js +2 -0
- package/dist/refusals.js.map +1 -1
- package/dist/resolve.d.ts +10 -0
- package/dist/resolve.d.ts.map +1 -1
- package/dist/resolve.js +33 -3
- package/dist/resolve.js.map +1 -1
- package/dist/routing-authority.d.ts +71 -0
- package/dist/routing-authority.d.ts.map +1 -0
- package/dist/routing-authority.js +100 -0
- package/dist/routing-authority.js.map +1 -0
- package/dist/skill-packages.d.ts +11 -5
- package/dist/skill-packages.d.ts.map +1 -1
- package/dist/skill-packages.js +20 -11
- package/dist/skill-packages.js.map +1 -1
- package/dist/workspace-lease.d.ts +15 -3
- package/dist/workspace-lease.d.ts.map +1 -1
- package/dist/workspace-lease.js +81 -24
- package/dist/workspace-lease.js.map +1 -1
- package/dist/workspace.d.ts +25 -0
- package/dist/workspace.d.ts.map +1 -1
- package/dist/workspace.js +142 -5
- package/dist/workspace.js.map +1 -1
- package/extensions/delegation.ts +7 -1
- package/extensions/grants-command.ts +11 -1
- package/extensions/grants.ts +6 -1
- package/extensions/init-command.ts +33 -2
- package/extensions/session-report.ts +13 -20
- package/extensions/session.ts +9 -1
- package/extensions/workspace-runtime.ts +34 -4
- package/package.json +8 -3
- package/src/approval-prompt.ts +2 -1
- package/src/approval.ts +4 -2
- package/src/capabilities.ts +173 -4
- package/src/catalog.ts +62 -4
- package/src/check-runner.ts +8 -8
- package/src/cli.ts +24 -1
- package/src/definitions.ts +7 -1
- package/src/delegate.ts +42 -4
- package/src/delegation-approval.ts +37 -12
- package/src/executor.ts +2 -1
- package/src/grant-env.ts +39 -7
- package/src/index.ts +1 -0
- package/src/init.ts +40 -2
- package/src/lease-helper.ts +97 -0
- package/src/lease-record.ts +15 -3
- package/src/ledger-events.ts +66 -22
- package/src/ledger.ts +30 -6
- package/src/propagation.ts +23 -2
- package/src/refusals.ts +2 -0
- package/src/resolve.ts +35 -3
- package/src/routing-authority.ts +121 -0
- package/src/skill-packages.ts +20 -13
- package/src/workspace-lease.ts +84 -24
- package/src/workspace.ts +179 -6
package/dist/skill-packages.d.ts
CHANGED
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
* `source`s; the only strings that may reach it are ones that survived a whitelist here.
|
|
26
26
|
*/
|
|
27
27
|
import { type SkillDefinition } from "./definitions.ts";
|
|
28
|
-
import {
|
|
28
|
+
import { isSafeCapability } from "./capabilities.ts";
|
|
29
29
|
export interface DiscoveredSkill {
|
|
30
30
|
definition: SkillDefinition;
|
|
31
31
|
/** The file verbatim. `init` copies it rather than regenerating it, so nothing is lost in a round trip. */
|
|
@@ -94,11 +94,17 @@ export declare function isSafeName(name: string): boolean;
|
|
|
94
94
|
* grants), which is right for the enforcement path — the catalog refuses what it does not know — and is
|
|
95
95
|
* exactly why the check has to be here, at the boundary that *generates* rather than the one that enforces.
|
|
96
96
|
*
|
|
97
|
-
* The grammar is the one `docs/SPEC.md` documents: `tool:<name>`, `skill:<name>`, `agent:<name>`,
|
|
98
|
-
* `ext:<pkg>/<tool>` where `<pkg>` may be npm-scoped. No wildcards — those are refused
|
|
99
|
-
* loudly, because "you tried to grant yourself everything" is a different fact from "that is
|
|
97
|
+
* The grammar is the one `docs/SPEC.md` documents: `tool:<name>`, `skill:<name>`, `agent:<name>`,
|
|
98
|
+
* `workspace:<id>`, and `ext:<pkg>/<tool>` where `<pkg>` may be npm-scoped. No wildcards — those are refused
|
|
99
|
+
* separately and loudly, because "you tried to grant yourself everything" is a different fact from "that is
|
|
100
|
+
* not a name".
|
|
101
|
+
*
|
|
102
|
+
* `workspace:` was absent until 2026-08-21, so the boundary that GENERATES grants could not emit the one
|
|
103
|
+
* capability ADR-0035's breaking change made mandatory: a package needing to route was reported as declaring
|
|
104
|
+
* something that "is not a name". A namespace has to be added here as well as to the enforcing path, and
|
|
105
|
+
* that is the whole lesson of the review this came out of.
|
|
100
106
|
*/
|
|
101
|
-
export
|
|
107
|
+
export { isSafeCapability };
|
|
102
108
|
/** Read one installed package, if it declares skills. `null` means "not a skill package", not an error. */
|
|
103
109
|
export declare function readSkillPackage(packageDir: string): Promise<SkillPackage | null>;
|
|
104
110
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"skill-packages.d.ts","sourceRoot":"","sources":["../src/skill-packages.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAKH,OAAO,EAA8C,KAAK,eAAe,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"skill-packages.d.ts","sourceRoot":"","sources":["../src/skill-packages.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAKH,OAAO,EAA8C,KAAK,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAGpG,OAAO,EAAE,gBAAgB,EAAE,MAAM,mBA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ir } from "node:os";
|
|
|
29
29
|
import { join, resolve, sep } from "node:path";
|
|
30
30
|
import { ceilingForDefinition, parseSkillDefinition } from "./definitions.js";
|
|
31
31
|
import { WILDCARD } from "./pi-tools.js";
|
|
32
|
-
import { AGENT_WILDCARD } from "./resolve.js";
|
|
32
|
+
import { AGENT_WILDCARD, WORKSPACE_WILDCARD } from "./resolve.js";
|
|
33
|
+
import { isSafeCapability } from "./capabilities.js";
|
|
33
34
|
/**
|
|
34
35
|
* May this definition's name be written into a capability id, a shell file and a path?
|
|
35
36
|
*
|
|
@@ -68,18 +69,26 @@ export function isSafeName(name) {
|
|
|
68
69
|
* grants), which is right for the enforcement path — the catalog refuses what it does not know — and is
|
|
69
70
|
* exactly why the check has to be here, at the boundary that *generates* rather than the one that enforces.
|
|
70
71
|
*
|
|
71
|
-
* The grammar is the one `docs/SPEC.md` documents: `tool:<name>`, `skill:<name>`, `agent:<name>`,
|
|
72
|
-
* `ext:<pkg>/<tool>` where `<pkg>` may be npm-scoped. No wildcards — those are refused
|
|
73
|
-
* loudly, because "you tried to grant yourself everything" is a different fact from "that is
|
|
72
|
+
* The grammar is the one `docs/SPEC.md` documents: `tool:<name>`, `skill:<name>`, `agent:<name>`,
|
|
73
|
+
* `workspace:<id>`, and `ext:<pkg>/<tool>` where `<pkg>` may be npm-scoped. No wildcards — those are refused
|
|
74
|
+
* separately and loudly, because "you tried to grant yourself everything" is a different fact from "that is
|
|
75
|
+
* not a name".
|
|
76
|
+
*
|
|
77
|
+
* `workspace:` was absent until 2026-08-21, so the boundary that GENERATES grants could not emit the one
|
|
78
|
+
* capability ADR-0035's breaking change made mandatory: a package needing to route was reported as declaring
|
|
79
|
+
* something that "is not a name". A namespace has to be added here as well as to the enforcing path, and
|
|
80
|
+
* that is the whole lesson of the review this came out of.
|
|
81
|
+
*/
|
|
82
|
+
// Imported as well as re-exported: a bare `export … from` does not bind the name in this module's scope, and
|
|
83
|
+
// `refusalFor` below calls it. Re-exported because this has been the import site since 0.13.0.
|
|
84
|
+
export { isSafeCapability };
|
|
85
|
+
/**
|
|
86
|
+
* The ids that confer authority over a whole namespace. A package declaring one is claiming it, not
|
|
87
|
+
* describing a need — so it is reported as a *wildcard claim* rather than as a malformed name, which is a
|
|
88
|
+
* different sentence to show an operator. `workspace:*` belongs here for the same reason `agent:*` does.
|
|
74
89
|
*/
|
|
75
|
-
export function isSafeCapability(id) {
|
|
76
|
-
const segment = "[A-Za-z0-9][A-Za-z0-9._-]*";
|
|
77
|
-
return (new RegExp(`^(tool|skill|agent):${segment}$`).test(id) ||
|
|
78
|
-
new RegExp(`^ext:(@${segment}/)?${segment}/${segment}$`).test(id));
|
|
79
|
-
}
|
|
80
|
-
/** The two ids that confer root authority. A package declaring one is claiming it, not describing a need. */
|
|
81
90
|
function wildcardsIn(capabilities) {
|
|
82
|
-
return capabilities.filter((c) => c === WILDCARD || c === AGENT_WILDCARD);
|
|
91
|
+
return capabilities.filter((c) => c === WILDCARD || c === AGENT_WILDCARD || c === WORKSPACE_WILDCARD);
|
|
83
92
|
}
|
|
84
93
|
/**
|
|
85
94
|
* Everything about one declared skill that would make it unsafe to scaffold. `null` when it is fine.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"skill-packages.js","sourceRoot":"","sources":["../src/skill-packages.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAEH,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC/D,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,WAAW,CAAC;AAC/C,OAAO,EAAE,oBAAoB,EAAE,oBAAoB,EAAwB,MAAM,kBAAkB,CAAC;AACpG,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,cAAc,EAAmB,MAAM,cAAc,CAAC;
|
|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G,CAAC;YAAE,SAAS,CAAC,2BAA2B;QAChE,IAAI,KAAK,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC;YAC1B,IAAI,CAAC;gBACH,KAAK,MAAM,MAAM,IAAI,CAAC,MAAM,OAAO,CAAC,IAAI,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE;oBAAE,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,KAAK,EAAE,MAAM,CAAC,CAAC,CAAC;YACvG,CAAC;YAAC,MAAM,CAAC;gBACP,SAAS;YACX,CAAC;QACH,CAAC;aAAM,CAAC;YACN,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC,CAAC;QAC/B,CAAC;IACH,CAAC;AACH,CAAC"}
|
|
@@ -4,9 +4,15 @@ import type { ValidatedWorkspace, WorkspaceAccess } from "./workspace.ts";
|
|
|
4
4
|
export declare const ENV_WORKSPACE_LEASE_DIR = "PI_GRANTS_WORKSPACE_LEASE_DIR";
|
|
5
5
|
export declare function defaultWorkspaceLeaseDir(env?: NodeJS.ProcessEnv): string;
|
|
6
6
|
/**
|
|
7
|
-
* The ledger outcome for a release.
|
|
8
|
-
*
|
|
9
|
-
*
|
|
7
|
+
* The ledger outcome for a release. Exported because call sites had their own copies and the check runner's
|
|
8
|
+
* asserted `released` unconditionally — reproducing in the evidence path the exact defect this union was
|
|
9
|
+
* added to expose (R-100/R-103).
|
|
10
|
+
*
|
|
11
|
+
* **It is NOT the only definition, and saying so here was wrong.** `extensions/workspace-runtime.ts` keeps a
|
|
12
|
+
* private copy with no `not-held` arm, and it is the one the whole delegation path uses — so releasing a
|
|
13
|
+
* *read* lease on a delegated child is still recorded `released`, a handover the kernel never performed.
|
|
14
|
+
* Measured; open as R-141; the sentence claiming a single definition survived two review passes because
|
|
15
|
+
* `test/workspace.test.ts` pins the `not-held` arm on THIS function, which no delegation path calls.
|
|
10
16
|
*/
|
|
11
17
|
export declare function leaseReleaseLedgerOutcome(outcome: LeaseReleaseOutcome | "retained", reason: string): "timeout" | "released" | "released-unrecorded" | "lost" | "retained" | "uncontended";
|
|
12
18
|
/**
|
|
@@ -22,6 +28,12 @@ export declare function acquireWorkspaceLease(input: {
|
|
|
22
28
|
signal?: AbortSignal;
|
|
23
29
|
flockCommand?: string;
|
|
24
30
|
acquisitionTimeoutMs?: number;
|
|
31
|
+
/**
|
|
32
|
+
* Bound on how long ONE `herdr tab close` attempt may take before it counts as failed (R-146). A hung
|
|
33
|
+
* herdr is not a failed herdr: without this the attempt never returns and the retry bound below is
|
|
34
|
+
* unreachable.
|
|
35
|
+
*/
|
|
36
|
+
herdrCloseTimeoutMs?: number;
|
|
25
37
|
/** Bound on the helper's `herdr tab close` retries before it releases the lock anyway (R-102). */
|
|
26
38
|
herdrCloseAttempts?: number;
|
|
27
39
|
}): Promise<WorkspaceLease>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"workspace-lease.d.ts","sourceRoot":"","sources":["../src/workspace-lease.ts"],"names":[],"mappings":"AACA,OAAO,EAKL,KAAK,mBAAmB,EACxB,KAAK,cAAc,EACpB,MAAM,mBAAmB,CAAC;AAC3B,YAAY,EAAE,mBAAmB,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAM7E,OAAO,KAAK,EAAE,kBAAkB,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"workspace-lease.d.ts","sourceRoot":"","sources":["../src/workspace-lease.ts"],"names":[],"mappings":"AACA,OAAO,EAKL,KAAK,mBAAmB,EACxB,KAAK,cAAc,EACpB,MAAM,mBAAmB,CAAC;AAC3B,YAAY,EAAE,mBAAmB,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAM7E,OAAO,KAAK,EAAE,kBAAkB,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAG1E,eAAO,MAAM,uBAAuB,kCAAkC,CAAC;AAEvE,wBAAgB,wBAAwB,CAAC,GAAG,GAAE,MAAM,CAAC,UAAwB,GAAG,MAAM,CAGrF;AAGD;;;;;;;;;;GAUG;AACH,wBAAgB,yBAAyB,CACvC,OAAO,EAAE,mBAAmB,GAAG,UAAU,EACzC,MAAM,EAAE,MAAM,GACb,SAAS,GAAG,UAAU,GAAG,qBAAqB,GAAG,MAAM,GAAG,UAAU,GAAG,aAAa,CAQtF;AAED;;;GAGG;AACH,wBAAgB,uBAAuB,CACrC,MAAM,EAAE,MAAM,GAAG,OAAO,EACxB,SAAS,EAAE,OAAO,GAAG,SAAS,GAC7B,UAAU,GAAG,aAAa,GAAG,WAAW,CAG1C;AAED,wBAAsB,qBAAqB,CAAC,KAAK,EAAE;IACjD,SAAS,EAAE,kBAAkB,CAAC;IAC9B,MAAM,EAAE,eAAe,CAAC;IACxB,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B;;;;OAIG;IACH,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,kGAAkG;IAClG,kBAAkB,CAAC,EAAE,MAAM,CAAC;CAC7B,GAAG,OAAO,CAAC,cAAc,CAAC,CA4R1B"}
|
package/dist/workspace-lease.js
CHANGED
|
@@ -5,32 +5,22 @@ import { mkdir, readFile, rename, writeFile } from "node:fs/promises";
|
|
|
5
5
|
import { homedir } from "node:os";
|
|
6
6
|
import { join } from "node:path";
|
|
7
7
|
import { GovernanceRefusal, refusal } from "./refusals.js";
|
|
8
|
+
import { assertCloseBounds, HELPER_SOURCE, LEASE_READY, unrefStream } from "./lease-helper.js";
|
|
8
9
|
export const ENV_WORKSPACE_LEASE_DIR = "PI_GRANTS_WORKSPACE_LEASE_DIR";
|
|
9
10
|
export function defaultWorkspaceLeaseDir(env = process.env) {
|
|
10
11
|
const agentDir = env.PI_CODING_AGENT_DIR ?? join(homedir(), ".pi", "agent");
|
|
11
12
|
return env[ENV_WORKSPACE_LEASE_DIR] ?? join(agentDir, "pi-daddy", "workspace-leases");
|
|
12
13
|
}
|
|
13
|
-
const LEASE_READY = "PI_DADDY_LEASE_READY";
|
|
14
|
-
// The lock holder also owns crash cleanup for the governed child. If the parent dies, stdin closes;
|
|
15
|
-
// the helper signals the attached process, or closes the herdr tab, before releasing flock. A raw
|
|
16
|
-
// descendant deliberately detached by bash remains ADR-0012's OS-containment boundary, not a lease
|
|
17
|
-
// guarantee. The process branch SIGTERMs, escalates to SIGKILL at +500ms, and releases at +750ms
|
|
18
|
-
// WITHOUT confirming death (R-101). The herdr branch retries `tab close` a BOUNDED number of times
|
|
19
|
-
// and then releases anyway, leaving a marker file: an unreleasable lock strands a worktree forever
|
|
20
|
-
// with no in-product recovery, which is strictly worse than a recorded failure to close (R-102).
|
|
21
|
-
const HELPER_SOURCE = `
|
|
22
|
-
import { execFile } from "node:child_process";
|
|
23
|
-
import { writeFileSync } from "node:fs";
|
|
24
|
-
let clean=false, target=null, buffered="";
|
|
25
|
-
process.stdout.write(${JSON.stringify(`${LEASE_READY}:`)}+process.pid+"\\n");
|
|
26
|
-
process.stdin.setEncoding("utf8");
|
|
27
|
-
process.stdin.on("data",chunk=>{buffered+=chunk;for(;;){const i=buffered.indexOf("\\n");if(i<0)break;const line=buffered.slice(0,i);buffered=buffered.slice(i+1);try{const value=JSON.parse(line);if(value.release)clean=true;else if(value.process_pid)target={process_pid:value.process_pid};else if(value.herdr_tab)target={herdr_tab:value.herdr_tab};}catch{}}});
|
|
28
|
-
process.stdin.on("end",()=>{if(clean||!target)return process.exit(0);if(target.process_pid){try{process.kill(target.process_pid,"SIGTERM")}catch{return process.exit(0)}setTimeout(()=>{try{process.kill(target.process_pid,"SIGKILL")}catch{}},500);return setTimeout(()=>process.exit(0),750);}let left=Number(process.env.PI_DADDY_LEASE_CLOSE_ATTEMPTS||10);const giveUp=()=>{try{if(process.env.PI_DADDY_LEASE_MARKER)writeFileSync(process.env.PI_DADDY_LEASE_MARKER,JSON.stringify({reason:"herdr-close-failed",herdr_tab:target.herdr_tab})+"\\n")}catch{}process.exit(0)};const close=()=>execFile("herdr",["tab","close",target.herdr_tab],error=>{if(!error)return process.exit(0);if(--left<=0)return giveUp();setTimeout(close,1000)});close();});
|
|
29
|
-
process.stdin.resume();`;
|
|
30
14
|
/**
|
|
31
|
-
* The ledger outcome for a release.
|
|
32
|
-
*
|
|
33
|
-
*
|
|
15
|
+
* The ledger outcome for a release. Exported because call sites had their own copies and the check runner's
|
|
16
|
+
* asserted `released` unconditionally — reproducing in the evidence path the exact defect this union was
|
|
17
|
+
* added to expose (R-100/R-103).
|
|
18
|
+
*
|
|
19
|
+
* **It is NOT the only definition, and saying so here was wrong.** `extensions/workspace-runtime.ts` keeps a
|
|
20
|
+
* private copy with no `not-held` arm, and it is the one the whole delegation path uses — so releasing a
|
|
21
|
+
* *read* lease on a delegated child is still recorded `released`, a handover the kernel never performed.
|
|
22
|
+
* Measured; open as R-141; the sentence claiming a single definition survived two review passes because
|
|
23
|
+
* `test/workspace.test.ts` pins the `not-held` arm on THIS function, which no delegation path calls.
|
|
34
24
|
*/
|
|
35
25
|
export function leaseReleaseLedgerOutcome(outcome, reason) {
|
|
36
26
|
if (outcome === "retained")
|
|
@@ -55,6 +45,8 @@ export function leaseAcquisitionOutcome(access, recovered) {
|
|
|
55
45
|
return recovered === true ? "recovered" : "acquired";
|
|
56
46
|
}
|
|
57
47
|
export async function acquireWorkspaceLease(input) {
|
|
48
|
+
// Before the read-lease return, so both paths are validated (R-152).
|
|
49
|
+
assertCloseBounds(input);
|
|
58
50
|
if (input.access === "read") {
|
|
59
51
|
return {
|
|
60
52
|
workspace: input.workspace,
|
|
@@ -63,7 +55,9 @@ export async function acquireWorkspaceLease(input) {
|
|
|
63
55
|
recovered: false,
|
|
64
56
|
attachProcess: () => { },
|
|
65
57
|
attachHerdrTab: () => { },
|
|
66
|
-
|
|
58
|
+
// A read lease took no kernel lock, so there is nothing to keep: `not-held` is the same answer
|
|
59
|
+
// `release()` gives, and it is the truth rather than a retention that never happened (R-152).
|
|
60
|
+
markRetained: async () => "not-held",
|
|
67
61
|
readCloseFailure: async () => null,
|
|
68
62
|
lost: new Promise(() => { }),
|
|
69
63
|
// No kernel lock was ever taken, so there is no handover to claim (R-105, release side).
|
|
@@ -81,7 +75,12 @@ export async function acquireWorkspaceLease(input) {
|
|
|
81
75
|
process.execPath, "--input-type=module", "-e", HELPER_SOURCE,
|
|
82
76
|
], {
|
|
83
77
|
stdio: ["pipe", "pipe", "pipe"],
|
|
84
|
-
env: {
|
|
78
|
+
env: {
|
|
79
|
+
...process.env,
|
|
80
|
+
PI_DADDY_LEASE_MARKER: paths.marker,
|
|
81
|
+
PI_DADDY_LEASE_CLOSE_ATTEMPTS: String(input.herdrCloseAttempts ?? 10),
|
|
82
|
+
PI_DADDY_LEASE_CLOSE_TIMEOUT_MS: String(input.herdrCloseTimeoutMs ?? 15_000),
|
|
83
|
+
},
|
|
85
84
|
// Own process group, for two reasons. It lets teardown kill `flock` AND the helper holding the lock
|
|
86
85
|
// file descriptor as one unit even before the helper has reported its pid (R-99), and it stops a
|
|
87
86
|
// stray group signal — a terminal Ctrl-C, a closed window — from releasing a live writer's lock as
|
|
@@ -208,12 +207,70 @@ export async function acquireWorkspaceLease(input) {
|
|
|
208
207
|
async markRetained(reason = "retained") {
|
|
209
208
|
// Deliberately does NOT touch the kernel lock or the helper: the pane may still be live. It only
|
|
210
209
|
// stops the record from looking like a crash.
|
|
210
|
+
//
|
|
211
|
+
// **Both guards below exist because the CALLER ledgers whatever this returns (R-152).**
|
|
212
|
+
//
|
|
213
|
+
// Already settled: `release()` checked `settled` and this did not, so a completed handover could be
|
|
214
|
+
// rewritten into `retained:…` and the memoized answer flipped with it — the mirror of the defect R-146
|
|
215
|
+
// fixed, reachable by the `try { … } finally { await lease.release() }` shape this API invites.
|
|
216
|
+
if (settled)
|
|
217
|
+
return settled;
|
|
218
|
+
// Already dead: the helper is gone and the kernel lock with it, so the fact is `lost`. Recording a
|
|
219
|
+
// retention here tells an operator a pane may still be live and tells the next owner nothing crashed —
|
|
220
|
+
// precisely the two facts R-103's outcome union was added to keep apart.
|
|
221
|
+
if (holder.exitCode !== null || holder.signalCode !== null)
|
|
222
|
+
return (settled = "lost");
|
|
211
223
|
const current = await readMetadata(paths.metadata);
|
|
224
|
+
let recorded = false;
|
|
212
225
|
if (current !== "malformed" && current?.token === token) {
|
|
213
|
-
await atomicMetadata(paths.metadata, {
|
|
226
|
+
recorded = await atomicMetadata(paths.metadata, {
|
|
214
227
|
...metadata, state: "released", released_at: new Date().toISOString(), release_reason: `retained:${reason}`,
|
|
215
|
-
}).
|
|
228
|
+
}).then(() => true, () => false);
|
|
216
229
|
}
|
|
230
|
+
/**
|
|
231
|
+
* **It must, however, let THIS process exit (R-146).** Leaving the helper alone is the decision;
|
|
232
|
+
* leaving the parent's three pipes and the child handle referenced was an accident, and it meant a
|
|
233
|
+
* retained lease wedged its own process forever — measured `exit=124` against `exit=0` for the same
|
|
234
|
+
* sequence ending in `release()`.
|
|
235
|
+
*
|
|
236
|
+
* **Which hosts it actually wedged, corrected after review.** `process.exit()` runs `exit` handlers and
|
|
237
|
+
* ignores pending handles, so this only bites a host that lets the loop drain: pi's **print** mode sets
|
|
238
|
+
* `process.exitCode` and returns (`dist/main.js`), and a library consumer — an ADR-0034 external
|
|
239
|
+
* controller calling this package directly — does the same. pi's interactive and rpc modes call
|
|
240
|
+
* `process.exit()` explicitly (`dist/modes/interactive/interactive-mode.js:3148`), so there the process
|
|
241
|
+
* still leaves and `pane-reaper`'s `process.once("exit")` sweep still runs. An earlier version of this
|
|
242
|
+
* comment claimed the sweep was lost generally and cited `src/cli.ts`, which has one subcommand
|
|
243
|
+
* (`init`) and can neither hold a lease nor open a pane.
|
|
244
|
+
*
|
|
245
|
+
* Unref rather than close, because the lock must outlive this call: when the parent does exit, the
|
|
246
|
+
* helper sees EOF and runs the path it was written for — bounded `herdr tab close` attempts, a marker
|
|
247
|
+
* file, then release anyway (R-102: an unreleasable lock strands a worktree with no in-product
|
|
248
|
+
* recovery, which is strictly worse than a recorded failure to close). Narrowed to this path on
|
|
249
|
+
* purpose: at spawn it would remove the accidental guarantee that a process cannot exit while a lease
|
|
250
|
+
* is still ACTIVE, which is a different decision and not this fix.
|
|
251
|
+
*/
|
|
252
|
+
/**
|
|
253
|
+
* **Terminal (R-146).** `releasing` stops a late `holder.close` being reported as a lost lease, and
|
|
254
|
+
* `settled` stops a later `release()` running the clean handshake — which it did: measured, it returned
|
|
255
|
+
* `released`, overwrote `retained:herdr-close-failed` with `completed`, and sent `{release:true}` so the
|
|
256
|
+
* helper exited `clean` and never attempted the close. The pane retention exists to protect was
|
|
257
|
+
* abandoned silently, and the ledger asserted a clean handover for a lease kept *because* a pane would
|
|
258
|
+
* not close. No in-tree caller does this — but `WorkspaceLease` is a public export and
|
|
259
|
+
* `try { … } finally { await lease.release() }` is the obvious shape for the external controllers this
|
|
260
|
+
* whole fix is for.
|
|
261
|
+
*/
|
|
262
|
+
releasing = true;
|
|
263
|
+
// **Settle only if the record was actually written.** An unwritable lease directory used to leave the
|
|
264
|
+
// record `state: "active"` while the ledger said `retained`, so the next owner reported a phantom
|
|
265
|
+
// `recovered: true` — and making retention terminal removed the later `release()` that would still have
|
|
266
|
+
// written the handover. Unsettled, that repair is available again; the residue is stated in R-152
|
|
267
|
+
// rather than implied, because nothing here can write a record to a directory that refuses writes.
|
|
268
|
+
if (recorded)
|
|
269
|
+
settled = "retained";
|
|
270
|
+
holder.unref();
|
|
271
|
+
unrefStream(holder.stdout);
|
|
272
|
+
unrefStream(holder.stderr);
|
|
273
|
+
return "retained";
|
|
217
274
|
},
|
|
218
275
|
async readCloseFailure() {
|
|
219
276
|
try {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"workspace-lease.js","sourceRoot":"","sources":["../src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AU,CAAC,WAAW,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;YAC3G,CAAC;YACD,4FAA4F;YAC5F,IAAI,MAAM,CAAC,QAAQ,KAAK,IAAI,IAAI,MAAM,CAAC,UAAU,KAAK,IAAI;gBAAE,QAAQ,EAAE,CAAC;YACvE,OAAO,CAAC,OAAO,GAAG,GAAG,CAAC,CAAC;QACzB,CAAC;KACF,CAAC;AACJ,CAAC"}
|
package/dist/workspace.d.ts
CHANGED
|
@@ -5,6 +5,17 @@ export interface WorkspaceRegistryFile {
|
|
|
5
5
|
workspaces: Record<string, {
|
|
6
6
|
path: string;
|
|
7
7
|
}>;
|
|
8
|
+
/**
|
|
9
|
+
* Where this was loaded from, carried so a refusal can NAME it.
|
|
10
|
+
*
|
|
11
|
+
* `docs/SPEC.md` claimed an unregistered id is refused "with `WORKSPACE_NOT_REGISTERED`, which names the
|
|
12
|
+
* file", and `catalog.ts` justified exempting the whole namespace from the unknown check on the strength of
|
|
13
|
+
* that — *"a second, weaker check here can only turn that precise refusal into a misleading one"*. The
|
|
14
|
+
* refusal named no file: the registry object had no idea where it came from. Carried on the object rather
|
|
15
|
+
* than passed per call so a caller cannot forget it. Optional because a hand-built literal (tests,
|
|
16
|
+
* `workspaceEntries` fixtures) has no source.
|
|
17
|
+
*/
|
|
18
|
+
source?: string;
|
|
8
19
|
}
|
|
9
20
|
export interface ValidatedWorkspace {
|
|
10
21
|
workspaceId: string;
|
|
@@ -13,6 +24,20 @@ export interface ValidatedWorkspace {
|
|
|
13
24
|
gitCommonDir: string;
|
|
14
25
|
}
|
|
15
26
|
export declare function loadWorkspaceRegistry(path: string): Promise<WorkspaceRegistryFile>;
|
|
27
|
+
/**
|
|
28
|
+
* The registered workspace ids, for `planInit` to scaffold and `/grants` to list. `[]` when there is no registry or it is broken.
|
|
29
|
+
*
|
|
30
|
+
* Fails SOFT, and only because nothing here is an authority: this decides which ids appear as COMMENTS in a
|
|
31
|
+
* generated file. `loadWorkspaceRegistry` throws a GovernanceRefusal naming the file, and that refusal is
|
|
32
|
+
* the operator's signal at the point of use, where routing genuinely depends on it. Swallowing it there
|
|
33
|
+
* would be unsafe; swallowing it here costs a suggestion. Same argument as `buildCatalog`'s.
|
|
34
|
+
*
|
|
35
|
+
* Lives here rather than in `init.ts` because it reads the filesystem, and `planInit` — the centrepiece of
|
|
36
|
+
* that module — documents itself as "Pure: no filesystem". It is a registry concern; this is where the
|
|
37
|
+
* registry lives. Moved when `init.ts` crossed the 400-line ceiling, which this project splits for rather
|
|
38
|
+
* than raising (`delegate.ts` at 413, `grants.ts` at 398).
|
|
39
|
+
*/
|
|
40
|
+
export declare function registeredWorkspaceIds(registryPath?: string | undefined): Promise<string[]>;
|
|
16
41
|
export declare function resolveWorkspace(registry: WorkspaceRegistryFile, workspaceId: string): Promise<ValidatedWorkspace>;
|
|
17
42
|
/**
|
|
18
43
|
* Canonicalize and validate the initial workspace against Git's registered worktree list.
|
package/dist/workspace.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"workspace.d.ts","sourceRoot":"","sources":["../src/workspace.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"workspace.d.ts","sourceRoot":"","sources":["../src/workspace.ts"],"names":[],"mappings":"AAaA,eAAO,MAAM,sBAAsB,iCAAiC,CAAC;AAGrE,MAAM,MAAM,eAAe,GAAG,MAAM,GAAG,OAAO,CAAC;AAE/C,MAAM,WAAW,qBAAqB;IACpC,OAAO,EAAE,CAAC,CAAC;IACX,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE;QAAE,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAC7C;;;;;;;;;OASG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,kBAAkB;IACjC,WAAW,EAAE,MAAM,CAAC;IACpB,wFAAwF;IACxF,IAAI,EAAE,MAAM,CAAC;IACb,YAAY,EAAE,MAAM,CAAC;CACtB;AAsBD,wBAAsB,qBAAqB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,qBAAqB,CAAC,CA+IxF;AAED;;;;;;;;;;;;GAYG;AACH,wBAAsB,sBAAsB,CAAC,YAAY,qBAAsC,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAOlH;AAED,wBAAsB,gBAAgB,CAAC,QAAQ,EAAE,qBAAqB,EAAE,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAaxH;AAED;;;GAGG;AACH,wBAAsB,2BAA2B,CAAC,KAAK,EAAE;IACvD,WAAW,EAAE,MAAM,CAAC;IACpB,cAAc,EAAE,MAAM,CAAC;IACvB,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAyC9B;AAED;;;;GAIG;AACH,OAAO,EACL,uBAAuB,EACvB,qBAAqB,EACrB,wBAAwB,EACxB,uBAAuB,EACvB,yBAAyB,EACzB,KAAK,mBAAmB,EACxB,KAAK,cAAc,GACpB,MAAM,sBAAsB,CAAC"}
|
package/dist/workspace.js
CHANGED
|
@@ -1,20 +1,116 @@
|
|
|
1
1
|
import { createHash, randomUUID } from "node:crypto";
|
|
2
2
|
import { execFile } from "node:child_process";
|
|
3
3
|
import { once } from "node:events";
|
|
4
|
-
import { mkdir, readFile, realpath, rename, stat, writeFile } from "node:fs/promises";
|
|
4
|
+
import { mkdir, open, readFile, realpath, rename, stat, writeFile } from "node:fs/promises";
|
|
5
|
+
import { constants } from "node:fs";
|
|
5
6
|
import { homedir } from "node:os";
|
|
6
7
|
import { isAbsolute, join } from "node:path";
|
|
7
8
|
import { promisify } from "node:util";
|
|
8
9
|
import { GovernanceRefusal, refusal } from "./refusals.js";
|
|
10
|
+
import { isSafeWorkspaceId, workspaceCapability } from "./capabilities.js";
|
|
9
11
|
const execFileAsync = promisify(execFile);
|
|
10
12
|
export const ENV_WORKSPACE_REGISTRY = "PI_GRANTS_WORKSPACE_REGISTRY";
|
|
13
|
+
/**
|
|
14
|
+
* How long a registry read may take before it is a refusal rather than a wait.
|
|
15
|
+
*
|
|
16
|
+
* **R-79's defect class, and this reader reintroduced it.** That entry records a probe that hung forever on
|
|
17
|
+
* a FIFO with "no timeout anywhere in the path". This function used a bare `readFile`, which was survivable
|
|
18
|
+
* while it ran only at spawn time — and stopped being survivable when 0.19.0 began reading the registry from
|
|
19
|
+
* `buildCatalog` and `registeredWorkspaceIds`, both awaited inside `session_start`. Measured on `52135ca`:
|
|
20
|
+
* `PI_GRANTS_WORKSPACE_REGISTRY` pointing at a FIFO blocked session start indefinitely, so the session never
|
|
21
|
+
* reached the `holding [...]` line, the executor probe, or any control after it — and `delegate` awaits the
|
|
22
|
+
* same promise, so delegation hung too. A blocking special file, an unresponsive network mount or a hostile
|
|
23
|
+
* `mkfifo` all reach it.
|
|
24
|
+
*
|
|
25
|
+
* Two seconds because this is an operator-authored local JSON file: any legitimate one is a single-digit
|
|
26
|
+
* millisecond read (measured: 8ms), so the bound is three orders of magnitude of headroom and still bounded.
|
|
27
|
+
*/
|
|
28
|
+
const REGISTRY_READ_TIMEOUT_MS = 2_000;
|
|
29
|
+
/** A registry is an operator-authored JSON file; anything approaching this is not one. */
|
|
30
|
+
const REGISTRY_MAX_BYTES = 1 << 20;
|
|
11
31
|
export async function loadWorkspaceRegistry(path) {
|
|
32
|
+
// **One handle, opened non-blocking, and every check made against THAT handle.** Three defects made this
|
|
33
|
+
// the shape rather than `stat`-then-`readFile`:
|
|
34
|
+
//
|
|
35
|
+
// - `AbortSignal.timeout` cannot rescue a FIFO: a signal is observed between chunks, while a FIFO blocks
|
|
36
|
+
// inside `open(2)` before any read begins. `O_NONBLOCK` makes the open itself return instead (measured:
|
|
37
|
+
// 1ms), which is what actually bounds this path. R-79's defect class, and R-136's.
|
|
38
|
+
// - `stat` by name followed by `readFile` by name is a TOCTOU: swapping a regular file for a FIFO between
|
|
39
|
+
// the two hung the loader indefinitely, and the attacker is any process at the same uid — precisely the
|
|
40
|
+
// actor the mode check below cannot exclude. Measured, 5 of 6 iterations completing in ~1ms and the
|
|
41
|
+
// sixth never returning. `fstat` on a held descriptor has no name to re-resolve.
|
|
42
|
+
// - a second reader (the ADR-0035 registry pin, since reverted to its own PR) reimplemented the guards and
|
|
43
|
+
// got them wrong. One reader is why that cannot happen again.
|
|
44
|
+
let handle;
|
|
45
|
+
try {
|
|
46
|
+
handle = await open(path, constants.O_RDONLY | constants.O_NONBLOCK);
|
|
47
|
+
}
|
|
48
|
+
catch (error) {
|
|
49
|
+
throw new GovernanceRefusal(refusal("WORKSPACE_NOT_REGISTERED", `workspace registry ${path} could not be opened (${String(error)})`, { registry_path: path }));
|
|
50
|
+
}
|
|
51
|
+
let raw;
|
|
52
|
+
try {
|
|
53
|
+
const info = await handle.stat();
|
|
54
|
+
if (!info.isFile()) {
|
|
55
|
+
throw new GovernanceRefusal(refusal("WORKSPACE_NOT_REGISTERED", `workspace registry ${path} is not a regular file — refusing to read it. A FIFO, device or socket ` +
|
|
56
|
+
`at ${ENV_WORKSPACE_REGISTRY} would block session start rather than fail, because opening one ` +
|
|
57
|
+
`waits for a writer that may never come.`, { registry_path: path }));
|
|
58
|
+
}
|
|
59
|
+
if (info.size > REGISTRY_MAX_BYTES) {
|
|
60
|
+
throw new GovernanceRefusal(refusal("WORKSPACE_NOT_REGISTERED", `workspace registry ${path} is ${info.size} bytes, over the ${REGISTRY_MAX_BYTES} limit — refusing ` +
|
|
61
|
+
`rather than reading it into memory at session start.`, { registry_path: path }));
|
|
62
|
+
}
|
|
63
|
+
// **Ownership and mode are NOT checked here, and that is a scope decision (R-137, ADR-0036).** A
|
|
64
|
+
// previous revision refused a registry not owned by this user or writable by others. Those guards are
|
|
65
|
+
// about *tamper resistance*, which is a different question from the one ADR-0035 raised, and they went in
|
|
66
|
+
// mid-review without an ADR — where they promptly acquired a false claim ("nobody ELSE may rewrite it":
|
|
67
|
+
// it inspects the file and never its parent directory, and `rename(2)` needs only directory write) and a
|
|
68
|
+
// false-positive refusal of `0664`, which `umask 002` produces for every file an operator creates.
|
|
69
|
+
//
|
|
70
|
+
// What IS checked above is what ADR-0035 made this reader's problem: it began reading the registry at
|
|
71
|
+
// SESSION START, so the read must be bounded and must not block. Integrity is R-137, open and measured.
|
|
72
|
+
// The deadline is checked BETWEEN chunks, which is all `AbortSignal.timeout` ever did on the previous
|
|
73
|
+
// implementation — review measured 74 of 200 one-MiB reads completing in full with `signal.aborted`
|
|
74
|
+
// already true, because a signal is never observed *inside* a libuv read request. An explicit check makes
|
|
75
|
+
// the bound as real as it can be in-process, and its limit is the same one honestly stated below: a
|
|
76
|
+
// stalled `open` or a single wedged read cannot be interrupted from here.
|
|
77
|
+
const deadline = Date.now() + REGISTRY_READ_TIMEOUT_MS;
|
|
78
|
+
const buffer = Buffer.allocUnsafe(REGISTRY_MAX_BYTES + 1);
|
|
79
|
+
let filled = 0;
|
|
80
|
+
while (filled < buffer.length) {
|
|
81
|
+
if (Date.now() > deadline) {
|
|
82
|
+
throw new GovernanceRefusal(refusal("WORKSPACE_NOT_REGISTERED", `workspace registry ${path} did not finish reading within ${REGISTRY_READ_TIMEOUT_MS}ms — ` +
|
|
83
|
+
`refusing rather than waiting, because session start awaits this read.`, { registry_path: path }));
|
|
84
|
+
}
|
|
85
|
+
const { bytesRead } = await handle.read(buffer, filled, buffer.length - filled, filled);
|
|
86
|
+
if (bytesRead === 0)
|
|
87
|
+
break;
|
|
88
|
+
filled += bytesRead;
|
|
89
|
+
}
|
|
90
|
+
if (filled > REGISTRY_MAX_BYTES) {
|
|
91
|
+
throw new GovernanceRefusal(refusal("WORKSPACE_NOT_REGISTERED", `workspace registry ${path} exceeded the ${REGISTRY_MAX_BYTES} limit while being read — it grew ` +
|
|
92
|
+
`after its size was checked. Refusing rather than allocating it.`, { registry_path: path }));
|
|
93
|
+
}
|
|
94
|
+
raw = buffer.subarray(0, filled).toString("utf8");
|
|
95
|
+
}
|
|
96
|
+
catch (error) {
|
|
97
|
+
if (error instanceof GovernanceRefusal)
|
|
98
|
+
throw error;
|
|
99
|
+
const timedOut = error instanceof Error && (error.name === "AbortError" || error.name === "TimeoutError");
|
|
100
|
+
throw new GovernanceRefusal(refusal("WORKSPACE_NOT_REGISTERED", timedOut
|
|
101
|
+
? `workspace registry ${path} did not return within ${REGISTRY_READ_TIMEOUT_MS}ms — refusing rather ` +
|
|
102
|
+
`than waiting, because session start awaits this read.`
|
|
103
|
+
: `workspace registry ${path} could not be read (${String(error)})`, { registry_path: path }));
|
|
104
|
+
}
|
|
105
|
+
finally {
|
|
106
|
+
await handle.close().catch(() => { });
|
|
107
|
+
}
|
|
12
108
|
let parsed;
|
|
13
109
|
try {
|
|
14
|
-
parsed = JSON.parse(
|
|
110
|
+
parsed = JSON.parse(raw);
|
|
15
111
|
}
|
|
16
112
|
catch (error) {
|
|
17
|
-
throw new GovernanceRefusal(refusal("WORKSPACE_NOT_REGISTERED", `workspace registry ${path}
|
|
113
|
+
throw new GovernanceRefusal(refusal("WORKSPACE_NOT_REGISTERED", `workspace registry ${path} is not valid JSON (${String(error)})`, { registry_path: path }));
|
|
18
114
|
}
|
|
19
115
|
const file = parsed;
|
|
20
116
|
if (file?.version !== 1 || !file.workspaces || typeof file.workspaces !== "object" || Array.isArray(file.workspaces)) {
|
|
@@ -24,13 +120,54 @@ export async function loadWorkspaceRegistry(path) {
|
|
|
24
120
|
if (!id || !value || typeof value.path !== "string" || !isAbsolute(value.path)) {
|
|
25
121
|
throw new GovernanceRefusal(refusal("WORKSPACE_NOT_REGISTERED", `workspace registry entry ${JSON.stringify(id)} must name an absolute path`, { registry_path: path, workspace_id: id }));
|
|
26
122
|
}
|
|
123
|
+
// ADR-0035 made a registry id the tail of a CAPABILITY id (`workspace:<id>`), so this file is an input
|
|
124
|
+
// to the grant grammar and has to obey it — the STRICT one. This shipped with the loose
|
|
125
|
+
// `isWellFormedCapability` blocklist, and review measured what that let through: an id of `*` minted
|
|
126
|
+
// `WORKSPACE_WILDCARD` (an operator naming one worktree held routing over all of them), an id with a
|
|
127
|
+
// space became two capabilities because `ceilingForDefinition` splits on `[\s,]+`, and quote/`$()` ids
|
|
128
|
+
// reached a generated file whose own instructions say to paste them into `PI_GRANTS_GRANT`. See
|
|
129
|
+
// `isSafeCapability`, which is now the one grammar for both channels into that file.
|
|
130
|
+
if (!isSafeWorkspaceId(id)) {
|
|
131
|
+
throw new GovernanceRefusal(refusal("GRANT_ID_MALFORMED", `workspace registry id ${JSON.stringify(id)} cannot be used: since ADR-0035 an id becomes the ` +
|
|
132
|
+
`capability ${JSON.stringify(workspaceCapability(id))}, and an id must match ` +
|
|
133
|
+
`[A-Za-z0-9][A-Za-z0-9._/-]* — slashes and dots are fine (a worktree named after its branch ` +
|
|
134
|
+
`works), but not spaces, quotes, commas, wildcards, shell metacharacters or non-ASCII, each of ` +
|
|
135
|
+
`which either splits into several capabilities or reaches a file you are told to source. ` +
|
|
136
|
+
`Rename it in ${path}.`, { registry_path: path, workspace_id: id }));
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
return { version: 1, workspaces: structuredClone(file.workspaces), source: path };
|
|
140
|
+
}
|
|
141
|
+
/**
|
|
142
|
+
* The registered workspace ids, for `planInit` to scaffold and `/grants` to list. `[]` when there is no registry or it is broken.
|
|
143
|
+
*
|
|
144
|
+
* Fails SOFT, and only because nothing here is an authority: this decides which ids appear as COMMENTS in a
|
|
145
|
+
* generated file. `loadWorkspaceRegistry` throws a GovernanceRefusal naming the file, and that refusal is
|
|
146
|
+
* the operator's signal at the point of use, where routing genuinely depends on it. Swallowing it there
|
|
147
|
+
* would be unsafe; swallowing it here costs a suggestion. Same argument as `buildCatalog`'s.
|
|
148
|
+
*
|
|
149
|
+
* Lives here rather than in `init.ts` because it reads the filesystem, and `planInit` — the centrepiece of
|
|
150
|
+
* that module — documents itself as "Pure: no filesystem". It is a registry concern; this is where the
|
|
151
|
+
* registry lives. Moved when `init.ts` crossed the 400-line ceiling, which this project splits for rather
|
|
152
|
+
* than raising (`delegate.ts` at 413, `grants.ts` at 398).
|
|
153
|
+
*/
|
|
154
|
+
export async function registeredWorkspaceIds(registryPath = process.env[ENV_WORKSPACE_REGISTRY]) {
|
|
155
|
+
if (!registryPath)
|
|
156
|
+
return [];
|
|
157
|
+
try {
|
|
158
|
+
return Object.keys((await loadWorkspaceRegistry(registryPath)).workspaces).sort();
|
|
159
|
+
}
|
|
160
|
+
catch {
|
|
161
|
+
return [];
|
|
27
162
|
}
|
|
28
|
-
return { version: 1, workspaces: structuredClone(file.workspaces) };
|
|
29
163
|
}
|
|
30
164
|
export async function resolveWorkspace(registry, workspaceId) {
|
|
31
165
|
const registered = Object.hasOwn(registry.workspaces, workspaceId) ? registry.workspaces[workspaceId] : undefined;
|
|
166
|
+
const known = Object.keys(registry.workspaces).sort();
|
|
32
167
|
if (!registered) {
|
|
33
|
-
throw new GovernanceRefusal(refusal("WORKSPACE_NOT_REGISTERED", `workspace ${JSON.stringify(workspaceId)} is not present in the operator-owned registry
|
|
168
|
+
throw new GovernanceRefusal(refusal("WORKSPACE_NOT_REGISTERED", `workspace ${JSON.stringify(workspaceId)} is not present in the operator-owned registry` +
|
|
169
|
+
(registry.source ? ` ${registry.source}` : "") +
|
|
170
|
+
(known.length > 0 ? ` — it lists: ${known.join(", ")}` : " — it lists nothing"), { workspace_id: workspaceId, ...(registry.source ? { registry_path: registry.source } : {}) }));
|
|
34
171
|
}
|
|
35
172
|
return validateRegisteredWorkspace({ workspaceId, registeredRoot: registered.path });
|
|
36
173
|
}
|