@holmes-lab/holmes-kit 0.35.22 → 0.35.23

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 CHANGED
@@ -7,6 +7,26 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
  <!-- @implements A-SPEC-209 -->
8
8
  ## [Unreleased]
9
9
 
10
+ ## [0.35.23] - 2026-10-17
11
+
12
+ Upgrading: run `holmes-kit runtime-binding setup` again so the hooks run this build. A binding whose workspace was
13
+ emptied or deleted can now be removed: run `holmes-kit runtime-binding remove --workspace <path>` from a governed
14
+ workspace and grant the request it queues there; with several dead bindings, remove them one at a time.
15
+
16
+ ### Fixed
17
+
18
+ - **`runtime-binding remove` works on a workspace that is no longer a governed project** (A-SPEC-752.14). Removing a
19
+ workspace whose `.ax` was deleted failed with "Cannot queue governance-wiring approval: no-project", and a workspace
20
+ whose directory was gone could not be named at all — a dead binding could only be deleted from the operator registry
21
+ by hand. For a workspace without `.ax` the approval is now queued, granted and consumed in the governed workspace the
22
+ operator runs `remove` from (the request still names the removed workspace); with none, remove is refused and nothing
23
+ is written — no `.ax` is planted in the removed workspace any more (A-SPEC-752.15).
24
+ - **One vanished binding no longer blocks the removal of another** (A-SPEC-752.15, 752.16, 752.17). Remove sets aside
25
+ every binding whose workspace directory is gone, validates the rest as before, and writes the set-aside ones back
26
+ unchanged, so each dead binding can be removed in turn; their receipt rows stay with them. A vanished binding is
27
+ matched by resolved path, duplicate spellings of one root are refused, and a remove that matches nothing of its own
28
+ says "Nothing registered".
29
+
10
30
  ## [0.35.22] - 2026-10-16
11
31
 
12
32
  Upgrading: run `holmes-kit runtime-binding setup` again so the hooks run this build, then `holmes-kit doctor`. A `codex
package/README.md CHANGED
@@ -9,8 +9,8 @@
9
9
  <!-- holmes-kit:attest:begin -->
10
10
  ![traced files](.ax/badges/traced.svg)
11
11
 
12
- **440/442** source files (99.5%) trace to an approved spec · **803/866** approved A-SPECs (92.7%) are anchored from code.
13
- Measured at `bc705710c89e` (specs `sha256:9ddf0c3d9cee`) — reproduce with `holmes-kit attest`.
12
+ **440/442** source files (99.5%) trace to an approved spec · **807/870** approved A-SPECs (92.7%) are anchored from code.
13
+ Measured at `3fe5cc250195` (specs `sha256:974cd643361c`) — reproduce with `holmes-kit attest`.
14
14
  <!-- holmes-kit:attest:end -->
15
15
 
16
16
  ---
package/dist/.build-id CHANGED
@@ -1 +1 @@
1
- 8dd234f5-mvb0beqr
1
+ 87aa7994-mvb6lrt9
@@ -364,7 +364,8 @@ async function main(argv) {
364
364
  registryPath: typeof flags.registry === 'string' ? flags.registry : defaultRuntimeRegistry(),
365
365
  packageRoot: typeof flags.package === 'string' ? flags.package : undefined,
366
366
  releasePackageRoot: typeof flags['release-package'] === 'string' ? flags['release-package'] : undefined, dryRun: flags['dry-run'] === true, approval: readApproval(),
367
- activateHooks: typeof activate === 'string' ? (activate === 'all' ? ['claude', 'codex', 'antigravity'] : activate.split(',')) : undefined });
367
+ activateHooks: typeof activate === 'string' ? (activate === 'all' ? ['claude', 'codex', 'antigravity'] : activate.split(',')) : undefined,
368
+ approvalRoot: process.cwd() }); // A-SPEC-752.14
368
369
  process.stdout.write(`${JSON.stringify(report, null, 2)}\n`);
369
370
  return 0;
370
371
  }
@@ -4,4 +4,9 @@ export declare function runtimePlanDigest(identity: unknown, changes: {
4
4
  before: string | null;
5
5
  after: string;
6
6
  }[]): string;
7
- export declare function applyApprovedRuntimePlan(root: string, subject: string, envApproval: Approval | undefined, check: () => void, apply: () => void): void;
7
+ /**
8
+ * @implements A-SPEC-752.14 — `approvalRoot` is the governed workspace whose queue, grants and ledger hold the decision;
9
+ * it differs from `root` only for the remove of a workspace that is no longer a governed project. The request target
10
+ * still names `root`, so the operator's list shows what the plan is about.
11
+ */
12
+ export declare function applyApprovedRuntimePlan(root: string, subject: string, envApproval: Approval | undefined, check: () => void, apply: () => void, approvalRoot?: string): void;
@@ -35,7 +35,7 @@ var __importStar = (this && this.__importStar) || (function () {
35
35
  Object.defineProperty(exports, "__esModule", { value: true });
36
36
  exports.runtimePlanDigest = runtimePlanDigest;
37
37
  exports.applyApprovedRuntimePlan = applyApprovedRuntimePlan;
38
- // @implements A-SPEC-752
38
+ // @implements A-SPEC-752, A-SPEC-752.14
39
39
  const path = __importStar(require("node:path"));
40
40
  const node_crypto_1 = require("node:crypto");
41
41
  const risk_gate_1 = require("../guardrail/risk-gate");
@@ -50,8 +50,13 @@ function runtimePlanDigest(identity, changes) {
50
50
  .sort((a, b) => a.path < b.path ? -1 : a.path > b.path ? 1 : 0);
51
51
  return `sha256:${hash(JSON.stringify({ identity, files }))}`;
52
52
  }
53
- function applyApprovedRuntimePlan(root, subject, envApproval, check, apply) {
54
- const ledgerDir = path.join(root, '.ax/ledger');
53
+ /**
54
+ * @implements A-SPEC-752.14 — `approvalRoot` is the governed workspace whose queue, grants and ledger hold the decision;
55
+ * it differs from `root` only for the remove of a workspace that is no longer a governed project. The request target
56
+ * still names `root`, so the operator's list shows what the plan is about.
57
+ */
58
+ function applyApprovedRuntimePlan(root, subject, envApproval, check, apply, approvalRoot = root) {
59
+ const ledgerDir = path.join(approvalRoot, '.ax/ledger');
55
60
  const ledger = new ledger_store_1.FileLedgerStore(ledgerDir);
56
61
  // Official grants use request ids as nonces. A new plan, or retry after an attempted
57
62
  // application, needs a distinct request identity; revoking never erases spent history.
@@ -66,18 +71,18 @@ function applyApprovedRuntimePlan(root, subject, envApproval, check, apply) {
66
71
  const now = new Date().toISOString();
67
72
  if (envApproval && (0, risk_gate_1.approvalCovers)(envApproval, { kind: action.kind, target: root }, now))
68
73
  return { approval: envApproval, source: 'env' };
69
- const refused = new Set((0, approval_grants_1.refusedGrantReasons)(root, action, now).map((r) => r.nonce));
70
- const approval = (0, approval_grants_1.readGrants)(root).grants.find((g) => g.subject === subject
74
+ const refused = new Set((0, approval_grants_1.refusedGrantReasons)(approvalRoot, action, now).map((r) => r.nonce));
75
+ const approval = (0, approval_grants_1.readGrants)(approvalRoot).grants.find((g) => g.subject === subject
71
76
  && !refused.has(g.nonce) && (0, risk_gate_1.approvalCovers)(g, action, now));
72
77
  return approval ? { approval, source: 'grant' } : undefined;
73
78
  };
74
79
  const request = () => {
75
- const result = (0, approval_queue_1.enqueueApprovalRequestDetailed)(root, { ...action, risk: 'high',
80
+ const result = (0, approval_queue_1.enqueueApprovalRequestDetailed)(approvalRoot, { ...action, risk: 'high',
76
81
  why: `Review runtime-binding --dry-run for plan ${subject}; approve this exact wiring plan and retry the same command. Native trust is separate.` });
77
82
  const id = (0, approval_queue_1.approvalRequestId)(action.kind, target);
78
83
  if (result.reason !== 'written' && result.reason !== 'duplicate')
79
84
  throw new Error(`Cannot queue governance-wiring approval: ${result.reason}; nothing installed`);
80
- throw new Error(`governance-wiring approval required for plan ${subject}; request ${id}. In this workspace run holmes-kit approve --list, then holmes-kit approve --grant ${id} and retry the same runtime-binding command. If an old decision remains, revoke it and retry to request the current plan.`);
85
+ throw new Error(`governance-wiring approval required for plan ${subject}; request ${id}. In ${approvalRoot === root ? 'this workspace' : `the workspace ${approvalRoot}`} run holmes-kit approve --list, then holmes-kit approve --grant ${id} and retry the same runtime-binding command. If an old decision remains, revoke it and retry to request the current plan.`);
81
86
  };
82
87
  check();
83
88
  if (!resolve())
@@ -97,6 +102,6 @@ function applyApprovedRuntimePlan(root, subject, envApproval, check, apply) {
97
102
  }
98
103
  apply();
99
104
  if (resolved.source === 'grant' && nonce)
100
- (0, approval_grants_1.consumeGrantFile)(root, nonce);
105
+ (0, approval_grants_1.consumeGrantFile)(approvalRoot, nonce);
101
106
  });
102
107
  }
@@ -1,4 +1,4 @@
1
- import type { RuntimeHarness, RuntimeEntry } from '../runtime/binding';
1
+ import type { RuntimeHarness, RuntimeEntry, RuntimeSelection } from '../runtime/binding';
2
2
  import type { Approval } from '../guardrail/risk-gate';
3
3
  export declare const defaultRuntimeRegistry: () => string;
4
4
  export interface RuntimeBindingOptions {
@@ -14,6 +14,8 @@ export interface RuntimeBindingOptions {
14
14
  activateHooks?: string[];
15
15
  /** @implements A-SPEC-752.10 — the digest a reviewer was shown; a plan that computes to another one is not applied. */
16
16
  expectedPlanDigest?: string;
17
+ /** @implements A-SPEC-752.14 — where the operator runs remove (CLI: cwd); holds the approval of a workspace without `.ax`. */
18
+ approvalRoot?: string;
17
19
  }
18
20
  export declare function runtimeHookCommand(registryPath: string, harness: RuntimeHarness, entry: RuntimeEntry): string;
19
21
  /**
@@ -50,7 +52,7 @@ export declare function codexDuplicateRoutes(codexHome: string, workspace: strin
50
52
  export declare function runtimeBindingStatus(registryPath: string, workspace: string, opts?: {
51
53
  codexHome?: string;
52
54
  }): {
53
- selection: import("../runtime/binding").RuntimeSelection;
55
+ selection: RuntimeSelection;
54
56
  conflicts: string[];
55
57
  drift: {
56
58
  path: string;
@@ -42,7 +42,7 @@ exports.codexDuplicateRoutes = codexDuplicateRoutes;
42
42
  exports.runtimeBindingStatus = runtimeBindingStatus;
43
43
  exports.runRuntimeBinding = runRuntimeBinding;
44
44
  exports.trackedWorkspacePaths = trackedWorkspacePaths;
45
- // @implements A-SPEC-769.10, A-SPEC-752.11, A-SPEC-752.12, A-SPEC-752.13, A-SPEC-752.10, A-SPEC-752.9, A-SPEC-751.5, A-SPEC-751.6, A-SPEC-751, A-SPEC-752, A-SPEC-752.7, A-SPEC-752.8
45
+ // @implements A-SPEC-769.10, A-SPEC-752.11, A-SPEC-752.12, A-SPEC-752.13, A-SPEC-752.14, A-SPEC-752.15, A-SPEC-752.16, A-SPEC-752.17, A-SPEC-752.10, A-SPEC-752.9, A-SPEC-751.5, A-SPEC-751.6, A-SPEC-751, A-SPEC-752, A-SPEC-752.7, A-SPEC-752.8
46
46
  const fs = __importStar(require("node:fs"));
47
47
  const os = __importStar(require("node:os"));
48
48
  const path = __importStar(require("node:path"));
@@ -310,14 +310,50 @@ function runRuntimeBinding(opts) {
310
310
  if (['binding.js', 'dispatch.js', 'hook-process.js', 'installation.json'].includes(path.basename(opts.registryPath))
311
311
  || /^(?:claude|codex|antigravity)-(?:mcp|pre-tool-use|stop|session-start)\.js$/.test(path.basename(opts.registryPath)))
312
312
  throw new Error('Registry filename conflicts with an installed runtime file');
313
- const root = (0, binding_1.workspaceRoot)(opts.workspace);
314
- if ((0, binding_1.canonicalDirectory)(opts.workspace) !== root)
313
+ // @implements A-SPEC-752.14 — a remove may name a workspace whose directory is gone (measured: G0GnMK); its root is
314
+ // resolved without the directory, and the remove proceeds only for what the registry or the receipt still records.
315
+ const vanished = opts.operation === 'remove' && path.isAbsolute(opts.workspace) && !fs.existsSync(opts.workspace);
316
+ const root = vanished ? canonicalFuture(opts.workspace) : (0, binding_1.workspaceRoot)(opts.workspace);
317
+ if (!vanished && (0, binding_1.canonicalDirectory)(opts.workspace) !== root)
315
318
  throw new Error('Register the workspace root, not a subdirectory');
316
319
  const destination = canonicalFuture(opts.registryPath);
317
320
  if (destination !== opts.registryPath || (0, binding_1.inside)(root, destination))
318
321
  throw new Error('Operator registry must be canonical and outside the workspace');
319
322
  const before = readOptional(opts.registryPath);
320
- const previous = before === null ? null : (0, binding_1.readRuntimeRegistry)(opts.registryPath);
323
+ // @implements A-SPEC-752.14, A-SPEC-752.15, A-SPEC-752.16 — a vanished binding fails registry validation (its directory
324
+ // cannot be canonicalised), so remove sets aside the removed workspace's binding and every binding whose WORKSPACE is
325
+ // gone, validates the rest as before, and writes the vanished others back unchanged: it unbinds only what the operator
326
+ // named. The written registry obeys the schema's limits (count, no duplicate roots).
327
+ let vanishedBound = false;
328
+ let previous = null;
329
+ let keptVanished = [];
330
+ let setAside = [];
331
+ if (before !== null && opts.operation === 'remove') {
332
+ try {
333
+ const raw = JSON.parse(before);
334
+ const all = Array.isArray(raw?.bindings) ? raw.bindings : [];
335
+ const gone = (b) => typeof b?.workspaceRoot === 'string' && typeof b?.packageRoot === 'string'
336
+ && path.isAbsolute(b.workspaceRoot) && path.isAbsolute(b.packageRoot) && !fs.existsSync(b.workspaceRoot);
337
+ // A-SPEC-752.17: a hand-edited spelling (`w/`, `x/../w`) of a root is the same root.
338
+ const resolved = (b) => typeof b?.workspaceRoot === 'string' && path.isAbsolute(b.workspaceRoot) ? path.resolve(b.workspaceRoot) : b?.workspaceRoot;
339
+ vanishedBound = all.some((b) => resolved(b) === root);
340
+ const kept = all.filter((b) => resolved(b) !== root);
341
+ if (kept.length > 1000)
342
+ throw new Error('Invalid runtime registry schema');
343
+ if (new Set(kept.map(resolved)).size !== kept.length)
344
+ throw new Error('Duplicate runtime binding');
345
+ setAside = kept.filter(gone);
346
+ // In the registry's own order: a living binding as validation spells it, a vanished one exactly as it was.
347
+ if (setAside.length)
348
+ keptVanished = kept.map((b) => gone(b) ? b : { workspaceRoot: b?.workspaceRoot, packageRoot: b?.packageRoot });
349
+ previous = (0, binding_1.validateRegistry)({ ...raw, bindings: Array.isArray(raw?.bindings) ? kept.filter((b) => !gone(b)) : raw?.bindings });
350
+ }
351
+ catch (e) {
352
+ throw new Error(`Cannot use runtime registry ${opts.registryPath}: ${e.message}. Repair runtime-binding setup.`);
353
+ }
354
+ }
355
+ else if (before !== null)
356
+ previous = (0, binding_1.readRuntimeRegistry)(opts.registryPath);
321
357
  if (opts.operation === 'setup' && (!opts.packageRoot || !opts.releasePackageRoot))
322
358
  throw new Error('setup requires --package and --release-package');
323
359
  if (opts.operation === 'remove' && !previous)
@@ -328,15 +364,18 @@ function runRuntimeBinding(opts) {
328
364
  bindings: [...(previous?.bindings ?? []).filter((b) => b.workspaceRoot !== root), { workspaceRoot: root, packageRoot: (0, binding_1.canonicalDirectory)(opts.packageRoot) }],
329
365
  } : { ...previous, bindings: previous.bindings.filter((b) => b.workspaceRoot !== root) };
330
366
  (0, binding_1.validateRegistry)(next);
331
- for (const binding of next.bindings) {
367
+ for (const binding of [...next.bindings, ...setAside]) {
332
368
  if ((0, binding_1.inside)(binding.workspaceRoot, destination) || (0, binding_1.inside)(binding.packageRoot, destination))
333
369
  throw new Error('Operator registry must be outside registered checkouts');
334
370
  }
335
371
  if ((0, binding_1.inside)(next.releasePackageRoot, destination))
336
372
  throw new Error('Operator registry must be outside the release package');
337
373
  const releaseBuild = (0, binding_1.verifyRuntime)(next.releasePackageRoot);
338
- const selection = (0, binding_1.selectRuntime)(next, { cwd: root });
339
- const after = `${JSON.stringify(next, null, 2)}\n`;
374
+ // A vanished workspace is no longer bound after the remove: it selects the release runtime, without probing the directory.
375
+ const selection = vanished
376
+ ? { mode: 'release', workspaceRoot: root, packageRoot: next.releasePackageRoot, buildId: releaseBuild, specsRoot: path.join(root, '.ax', 'specs') }
377
+ : (0, binding_1.selectRuntime)(next, { cwd: root });
378
+ const after = `${JSON.stringify(keptVanished.length ? { ...next, bindings: keptVanished } : next, null, 2)}\n`;
340
379
  const planned = new Map();
341
380
  const conflicts = [];
342
381
  const add = (file, content) => {
@@ -778,10 +817,16 @@ function runRuntimeBinding(opts) {
778
817
  recorded.set(c.path, { path: c.path, digest: digest(wiringViewOf(c.path, c.after)) });
779
818
  // @implements A-SPEC-752.11 — the receipt forgets a removed workspace: its rows and its identity.
780
819
  if (opts.operation === 'remove') {
820
+ // A-SPEC-752.17: a row owned by a binding nested inside the root is that binding's, not the root's.
821
+ const keptInside = [...next.bindings, ...setAside].filter((b) => (0, binding_1.inside)(root, path.resolve(b.workspaceRoot)));
822
+ if (vanished && !vanishedBound && runtimeIdentities[root] === undefined
823
+ && ![...recorded.keys()].some((p) => (0, binding_1.inside)(root, p) && !keptInside.some((b) => (0, binding_1.inside)(path.resolve(b.workspaceRoot), p))))
824
+ throw new Error(`Nothing registered for ${root}; nothing written`);
781
825
  // @implements A-SPEC-752.12, A-SPEC-752.13 — a row inside a workspace that stays bound AND is nested inside the
782
826
  // removed root is that workspace's; a remaining parent of the removed root does not keep the removed root's rows.
783
827
  for (const p of [...recorded.keys()]) {
784
- if ((0, binding_1.inside)(root, p) && !next.bindings.some((b) => (0, binding_1.inside)(root, b.workspaceRoot) && (0, binding_1.inside)(b.workspaceRoot, p)))
828
+ // A-SPEC-752.16: a set-aside binding stays in the written registry, so it stays bound here too.
829
+ if ((0, binding_1.inside)(root, p) && ![...next.bindings, ...setAside].some((b) => (0, binding_1.inside)(root, b.workspaceRoot) && (0, binding_1.inside)(b.workspaceRoot, p)))
785
830
  recorded.delete(p);
786
831
  }
787
832
  delete runtimeIdentities[root];
@@ -812,6 +857,21 @@ function runRuntimeBinding(opts) {
812
857
  throw new Error('Runtime build changed since preview');
813
858
  };
814
859
  check();
860
+ // @implements A-SPEC-752.14 — a workspace without `.ax` has no approval queue or ledger: its remove is approved in the
861
+ // governed workspace the operator runs it from (measured: pilot64's emptied H0 refused with "no-project").
862
+ let approvalRoot = root;
863
+ if (opts.operation === 'remove' && !fs.existsSync(path.join(root, '.ax'))) {
864
+ let governed = null;
865
+ try {
866
+ const at = opts.approvalRoot === undefined ? null : (0, binding_1.workspaceRoot)(opts.approvalRoot);
867
+ if (at !== null && at !== root && fs.existsSync(path.join(at, '.ax')))
868
+ governed = at;
869
+ }
870
+ catch { /* an unresolvable approval root is no governed workspace */ }
871
+ if (governed === null)
872
+ throw new Error(`${root} is no longer a governed project (no .ax); run runtime-binding remove from a governed workspace — its approval queue takes the request; nothing written`);
873
+ approvalRoot = governed;
874
+ }
815
875
  if (changes.length > 0)
816
876
  (0, runtime_binding_approval_1.applyApprovedRuntimePlan)(root, planDigest, opts.approval, check, () => {
817
877
  let written = 0;
@@ -838,7 +898,7 @@ function runRuntimeBinding(opts) {
838
898
  catch (e) {
839
899
  throw new Error(`Runtime setup incomplete after ${written} file(s): ${e.message}; run status and preview setup again`);
840
900
  }
841
- });
901
+ }, approvalRoot);
842
902
  }
843
903
  // @implements A-SPEC-752.7 — outside the plan digest: what git tracks is not part of the reviewed wiring plan.
844
904
  const trackedChanges = trackedWorkspacePaths(root, changes.map((c) => c.path));
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "//": "@implements A-SPEC-209",
3
3
  "name": "@holmes-lab/holmes-kit",
4
- "version": "0.35.22",
4
+ "version": "0.35.23",
5
5
  "description": "Holmes-Kit — deterministic Agentic Software Engineering (ASE) harness with causal traceability (spec chain + D-CPG + RTM + phase guardrail)",
6
6
  "main": "dist/holmes/mcp/server.js",
7
7
  "types": "dist/holmes/mcp/server.d.ts",