@holmes-lab/holmes-kit 0.40.1 → 0.41.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.
Files changed (82) hide show
  1. package/CHANGELOG.md +78 -0
  2. package/README.md +11 -3
  3. package/dist/.build-id +1 -1
  4. package/dist/holmes/cli/approve-context.js +4 -3
  5. package/dist/holmes/cli/approve.js +22 -12
  6. package/dist/holmes/cli/autonomy.d.ts +21 -0
  7. package/dist/holmes/cli/autonomy.js +35 -5
  8. package/dist/holmes/cli/doctor.js +58 -6
  9. package/dist/holmes/cli/index.js +371 -250
  10. package/dist/holmes/cli/init.js +17 -6
  11. package/dist/holmes/cli/ledger-witness.d.ts +61 -0
  12. package/dist/holmes/cli/ledger-witness.js +212 -0
  13. package/dist/holmes/cli/playbook-skills.d.ts +3 -56
  14. package/dist/holmes/cli/playbook-skills.js +26 -349
  15. package/dist/holmes/config/config.d.ts +4 -0
  16. package/dist/holmes/config/config.js +10 -3
  17. package/dist/holmes/governance/approval-queue.d.ts +65 -1
  18. package/dist/holmes/governance/approval-queue.js +279 -9
  19. package/dist/holmes/governance/autonomous-shell.d.ts +13 -1
  20. package/dist/holmes/governance/autonomous-shell.js +157 -4
  21. package/dist/holmes/governance/autonomy.d.ts +209 -0
  22. package/dist/holmes/governance/autonomy.js +1127 -6
  23. package/dist/holmes/governance/install-manifest.d.ts +7 -4
  24. package/dist/holmes/governance/install-manifest.js +144 -14
  25. package/dist/holmes/governance/ledger-witness.d.ts +63 -0
  26. package/dist/holmes/governance/ledger-witness.js +296 -0
  27. package/dist/holmes/governance/provenance-chain.d.ts +8 -1
  28. package/dist/holmes/governance/provenance-chain.js +23 -4
  29. package/dist/holmes/governance/recorded-pairs.d.ts +4 -0
  30. package/dist/holmes/governance/recorded-pairs.js +25 -1
  31. package/dist/holmes/governance/session-context.d.ts +7 -0
  32. package/dist/holmes/governance/session-context.js +34 -6
  33. package/dist/holmes/guardrail/anchor-scope-text.d.ts +9 -0
  34. package/dist/holmes/guardrail/anchor-scope-text.js +7 -0
  35. package/dist/holmes/guardrail/command-traits.d.ts +102 -0
  36. package/dist/holmes/guardrail/command-traits.js +379 -0
  37. package/dist/holmes/guardrail/fixtures/manager-builtins.json +23 -0
  38. package/dist/holmes/guardrail/fixtures/npm-commands.json +7 -0
  39. package/dist/holmes/guardrail/outward-acts.d.ts +47 -0
  40. package/dist/holmes/guardrail/outward-acts.js +1102 -0
  41. package/dist/holmes/guardrail/refusal-codes.js +8 -1
  42. package/dist/holmes/guardrail/refusal-templates.d.ts +15 -0
  43. package/dist/holmes/guardrail/refusal-templates.js +71 -0
  44. package/dist/holmes/guardrail/risk-classifier.d.ts +22 -6
  45. package/dist/holmes/guardrail/risk-classifier.js +12 -118
  46. package/dist/holmes/guardrail/shell-lexer.d.ts +69 -0
  47. package/dist/holmes/guardrail/shell-lexer.js +567 -0
  48. package/dist/holmes/guardrail/write-target.js +7 -1
  49. package/dist/holmes/hooks/pre-tool-use.d.ts +60 -0
  50. package/dist/holmes/hooks/pre-tool-use.js +1423 -10
  51. package/dist/holmes/hooks/session-start.js +11 -1
  52. package/dist/holmes/hooks/stop.d.ts +7 -0
  53. package/dist/holmes/hooks/stop.js +39 -2
  54. package/dist/holmes/mcp/elicit-approval.d.ts +0 -21
  55. package/dist/holmes/mcp/elicit-approval.js +5 -2
  56. package/dist/holmes/mcp/handlers/approval-ask.js +3 -2
  57. package/dist/holmes/mcp/handlers/entity-integration.d.ts +1 -1
  58. package/dist/holmes/mcp/handlers/entity-integration.js +9 -6
  59. package/dist/holmes/mcp/handlers/entity-renumber.js +2 -1
  60. package/dist/holmes/mcp/handlers/entity-store.js +7 -2
  61. package/dist/holmes/mcp/handlers/operator-inspection.d.ts +2 -0
  62. package/dist/holmes/mcp/handlers/operator-inspection.js +25 -4
  63. package/dist/holmes/mcp/handlers/spec-approval.d.ts +3 -1
  64. package/dist/holmes/mcp/handlers/spec-approval.js +28 -10
  65. package/dist/holmes/mcp/handlers/spec-lifecycle.js +10 -7
  66. package/dist/holmes/mcp/handlers/test-execution.js +4 -2
  67. package/dist/holmes/mcp/handlers.d.ts +5 -5
  68. package/dist/holmes/mcp/handlers.js +2 -1
  69. package/dist/holmes/mcp/tool-schemas.js +4 -4
  70. package/dist/holmes/project/playbook-reference.d.ts +50 -0
  71. package/dist/holmes/project/playbook-reference.js +259 -0
  72. package/dist/holmes/project/playbook-skill-states.d.ts +94 -0
  73. package/dist/holmes/project/playbook-skill-states.js +396 -0
  74. package/dist/holmes/project/root.d.ts +9 -1
  75. package/dist/holmes/project/root.js +23 -2
  76. package/dist/holmes/project/running-package.d.ts +15 -0
  77. package/dist/holmes/project/running-package.js +87 -0
  78. package/dist/holmes/review/test-runner.d.ts +2 -0
  79. package/dist/holmes/review/test-runner.js +27 -10
  80. package/dist/holmes/spec/entity-integration-transaction.d.ts +19 -2
  81. package/dist/holmes/spec/entity-integration-transaction.js +68 -7
  82. package/package.json +5 -2
@@ -59,7 +59,7 @@ exports.redJestTail = redJestTail;
59
59
  exports.summarizeJestJson = summarizeJestJson;
60
60
  // @implements A-SPEC-102.1, A-SPEC-128.4, A-SPEC-128.5, A-SPEC-128.6, A-SPEC-128.7, A-SPEC-128.8, A-SPEC-128.9, A-SPEC-128.10, A-SPEC-128.11, A-SPEC-128.12, A-SPEC-128.13
61
61
  // @implements A-SPEC-647
62
- // @implements A-SPEC-734, A-SPEC-466.1, A-SPEC-466.2, A-SPEC-466.3, A-SPEC-466.4, A-SPEC-466.5, A-SPEC-466.6
62
+ // @implements A-SPEC-734, A-SPEC-466.1, A-SPEC-466.2, A-SPEC-466.3, A-SPEC-466.4, A-SPEC-466.5, A-SPEC-466.6, A-SPEC-794.119
63
63
  const node_child_process_1 = require("node:child_process");
64
64
  const bounded_group_1 = require("../project/bounded-group");
65
65
  const fs = __importStar(require("node:fs"));
@@ -97,6 +97,15 @@ let STOPPED = null;
97
97
  */
98
98
  /** @implements A-SPEC-466.6 — the bound of the run in progress; `runTestScope` sets it from timeoutMinutes. */
99
99
  let RUN_BUDGET_MS = exports.RUNNER_TIMEOUT_MS;
100
+ /**
101
+ * @implements A-SPEC-794.119 — the tree the run in progress executes in, held for the run as its budget is (`runTestScope`
102
+ * sets it from `projectRoot`). Every test child takes `testEnv()`: CLAUDE_PROJECT_DIR, where the server carries it, names
103
+ * this tree. Undefined: the environment is cleaned as before.
104
+ */
105
+ let RUN_PROJECT_ROOT;
106
+ function testEnv() {
107
+ return (0, root_1.cleanTestEnv)(process.env, RUN_PROJECT_ROOT === undefined ? {} : { projectDir: RUN_PROJECT_ROOT });
108
+ }
100
109
  function runBounded(cmd, args, opts, timeoutMs = RUN_BUDGET_MS) {
101
110
  // @implements A-SPEC-734.4 — the group's whole lifetime lives in bounded-group: a watch shim ends it when this process
102
111
  // goes, and the call ends it on the bound, an overflow or a signal, or when members outlive a normal exit
@@ -243,7 +252,7 @@ const unreadable = (what, out, workers) => ({ passed: false, tail: `runner outpu
243
252
  function jestConfigReason(cmd, pre, cwd) {
244
253
  let out;
245
254
  try {
246
- out = runBounded(cmd, [...pre, '--showConfig'], { cwd, encoding: 'utf8', stdio: ['ignore', 'pipe', 'pipe'], maxBuffer: RUNNER_MAX_BUFFER, env: (0, root_1.cleanTestEnv)() });
255
+ out = runBounded(cmd, [...pre, '--showConfig'], { cwd, encoding: 'utf8', stdio: ['ignore', 'pipe', 'pipe'], maxBuffer: RUNNER_MAX_BUFFER, env: testEnv() });
247
256
  }
248
257
  catch (e) {
249
258
  const err = e;
@@ -303,7 +312,7 @@ function runJestWith(files, mode, cwd, opts, reportFile) {
303
312
  }
304
313
  function jestRun(cmd, args, cwd, mode, reportFile, applied) {
305
314
  try {
306
- const raw = runBounded(cmd, args, { cwd, encoding: 'utf8', stdio: ['ignore', 'pipe', 'pipe'], maxBuffer: RUNNER_MAX_BUFFER, env: (0, root_1.cleanTestEnv)() });
315
+ const raw = runBounded(cmd, args, { cwd, encoding: 'utf8', stdio: ['ignore', 'pipe', 'pipe'], maxBuffer: RUNNER_MAX_BUFFER, env: testEnv() });
307
316
  const out = mode === 'full' ? (0, test_reports_1.readJestReport)(reportFile, raw) : raw;
308
317
  if (out === null)
309
318
  return unreadable('jest --json', raw, applied);
@@ -386,7 +395,7 @@ function runPytest(files, mode, cwd, ignore = [], pythonFrom, run) {
386
395
  const python = (0, python_env_1.pythonFor)(pythonFrom && fs.existsSync(pythonFrom) ? pythonFrom : cwd, { env: process.env, exists: fs.existsSync, platform: process.platform });
387
396
  // @implements A-SPEC-128.14, A-SPEC-128.15, A-SPEC-128.16 — in HEAD's worktree: the pinned configuration and its confcutdir,
388
397
  // the environment asked where HEAD's names resolve (refused before any test), and the loaded-module record
389
- const prov = run ? (0, run_provenance_1.pytestRunProvenance)(dir, run, rootdir, python, (0, root_1.cleanTestEnv)(), (c, a, o) => runBounded(c, a, { ...o, encoding: 'utf8', stdio: ['ignore', 'pipe', 'pipe'], maxBuffer: RUNNER_MAX_BUFFER })) : null;
398
+ const prov = run ? (0, run_provenance_1.pytestRunProvenance)(dir, run, rootdir, python, testEnv(), (c, a, o) => runBounded(c, a, { ...o, encoding: 'utf8', stdio: ['ignore', 'pipe', 'pipe'], maxBuffer: RUNNER_MAX_BUFFER })) : null;
390
399
  if (prov?.refused) {
391
400
  fs.rmSync(dir, { recursive: true, force: true });
392
401
  return { passed: false, tail: prov.refused, executed: {}, outcomes: {}, testsRun: 0, environment: true };
@@ -437,7 +446,7 @@ function runPytest(files, mode, cwd, ignore = [], pythonFrom, run) {
437
446
  // @implements A-SPEC-651.1 — launch from the canonical spelling: pytest keys its JUnit `file`
438
447
  // attribute relative to its rootdir, and an 8.3 invocation dir made that key climb out of the
439
448
  // project (`../../…/tests/test_calc.py`, measured 2026-09-14 on Windows).
440
- const out = runBounded(python, args, { cwd: fs.existsSync(cwd) ? (0, root_1.canonicalPath)(cwd) : cwd, encoding: 'utf8', stdio: ['ignore', 'pipe', 'pipe'], maxBuffer: RUNNER_MAX_BUFFER, env: prov ? prov.env((0, root_1.cleanTestEnv)()) : (0, root_1.cleanTestEnv)() });
449
+ const out = runBounded(python, args, { cwd: fs.existsSync(cwd) ? (0, root_1.canonicalPath)(cwd) : cwd, encoding: 'utf8', stdio: ['ignore', 'pipe', 'pipe'], maxBuffer: RUNNER_MAX_BUFFER, env: prov ? prov.env(testEnv()) : testEnv() });
441
450
  const executed = read();
442
451
  // @implements A-SPEC-128.13 — T1: exit 0 is not green when the JUnit report holds a failure or an error
443
452
  const outcomes = readOutcomes(true);
@@ -497,7 +506,7 @@ function runCargo(files, _mode, cwd, opts) {
497
506
  let out = '';
498
507
  let ok = true;
499
508
  try {
500
- out = runBounded('cargo', ['test'], { cwd, encoding: 'utf8', stdio: ['ignore', 'pipe', 'pipe'], maxBuffer: RUNNER_MAX_BUFFER, env: (0, root_1.cleanTestEnv)() });
509
+ out = runBounded('cargo', ['test'], { cwd, encoding: 'utf8', stdio: ['ignore', 'pipe', 'pipe'], maxBuffer: RUNNER_MAX_BUFFER, env: testEnv() });
501
510
  }
502
511
  catch (e) {
503
512
  const err = e;
@@ -591,7 +600,7 @@ function runGradle(files, _mode, cwd, opts) {
591
600
  }
592
601
  let ok = true;
593
602
  try {
594
- runBounded(cmd, args, { cwd, encoding: 'utf8', stdio: ['ignore', 'pipe', 'pipe'], maxBuffer: RUNNER_MAX_BUFFER, env: (0, root_1.cleanTestEnv)() });
603
+ runBounded(cmd, args, { cwd, encoding: 'utf8', stdio: ['ignore', 'pipe', 'pipe'], maxBuffer: RUNNER_MAX_BUFFER, env: testEnv() });
595
604
  }
596
605
  catch (e) {
597
606
  // @implements A-SPEC-128.10 — R4: the build tool itself missing is the environment, not the tests
@@ -626,7 +635,7 @@ function runDotnet(files, _mode, cwd, opts) {
626
635
  const report = path.join(dir, 'junit.xml');
627
636
  let ok = true;
628
637
  try {
629
- runBounded('dotnet', ['test', '--logger', `junit;LogFilePath=${report}`], { cwd, encoding: 'utf8', stdio: ['ignore', 'pipe', 'pipe'], maxBuffer: RUNNER_MAX_BUFFER, env: (0, root_1.cleanTestEnv)() });
638
+ runBounded('dotnet', ['test', '--logger', `junit;LogFilePath=${report}`], { cwd, encoding: 'utf8', stdio: ['ignore', 'pipe', 'pipe'], maxBuffer: RUNNER_MAX_BUFFER, env: testEnv() });
630
639
  }
631
640
  catch {
632
641
  ok = false;
@@ -651,7 +660,7 @@ function runDotnet(files, _mode, cwd, opts) {
651
660
  * `unsupported`, never a pass. `opts.goPresent` overrides the probe for testing.
652
661
  */
653
662
  function runGo(files, mode, cwd, opts) {
654
- const goEnv = { ...(0, root_1.cleanTestEnv)(), ...(opts?.env ?? {}) };
663
+ const goEnv = { ...testEnv(), ...(opts?.env ?? {}) };
655
664
  const present = opts?.goPresent ?? (() => {
656
665
  try {
657
666
  (0, node_child_process_1.execFileSync)('go', ['version'], { cwd, stdio: 'ignore', timeout: PROBE_TIMEOUT_MS });
@@ -768,7 +777,15 @@ function runGo(files, mode, cwd, opts) {
768
777
  * gate that ran part of its scope has verified less than it reports.
769
778
  */
770
779
  function runTestScope(scope, cwd, opts = {}) {
771
- return withRunBudget(opts.timeoutMinutes, () => runScopeWithinBudget(scope, cwd, opts));
780
+ // @implements A-SPEC-794.119 — held for this run only, put back after (a nested or later run is not given this tree)
781
+ const prevRoot = RUN_PROJECT_ROOT;
782
+ RUN_PROJECT_ROOT = opts.projectRoot;
783
+ try {
784
+ return withRunBudget(opts.timeoutMinutes, () => runScopeWithinBudget(scope, cwd, opts));
785
+ }
786
+ finally {
787
+ RUN_PROJECT_ROOT = prevRoot;
788
+ }
772
789
  }
773
790
  /** @implements A-SPEC-466.6 — each runner child started inside `fn` takes the budget; the default comes back after. */
774
791
  function withRunBudget(timeoutMinutes, fn) {
@@ -2,6 +2,22 @@ import { EntityByteChange, entityLockOwner } from './entity-transaction';
2
2
  import { EntityGitDocuments, EntityGitMergedSources } from './entity-integration';
3
3
  import { entitySourcePublicationOwner } from './entity-renumber-transaction';
4
4
  import { EntityRenumberEntry } from './entity-renumber';
5
+ import type { SpecTransition } from '../governance/approval-queue';
6
+ type TransitionStep = {
7
+ phase: string;
8
+ specId?: string;
9
+ change?: {
10
+ locator?: string;
11
+ after?: string | null;
12
+ };
13
+ };
14
+ /**
15
+ * @implements A-SPEC-794.92 (M-1) — an un-seal step whose document is later published as `outdated` is a retirement,
16
+ * not an un-seal: it needs spec-retire authority and records spec-retired, as spec_retire does outside an integration.
17
+ */
18
+ export declare function retiredSpecIds(plan: {
19
+ steps: ReadonlyArray<TransitionStep>;
20
+ }): Set<string>;
5
21
  export interface EntityIntegrationTransitions {
6
22
  unseal: Array<{
7
23
  entityId: string;
@@ -108,7 +124,7 @@ export interface EntityIntegrationPlan {
108
124
  export declare function validateEntityIntegrationPlan(value: unknown): EntityIntegrationPlan;
109
125
  export declare function entityIntegrationTarget(plan: EntityIntegrationPlan): string;
110
126
  /** Internal execution core; the public adapter supplies current authority and durable audit. */
111
- export declare function applyEntityIntegration(root: string, inspected: unknown, authorize: (specId?: string) => void, audit: (plan: EntityIntegrationPlan, verifyOnly?: boolean, renumbered?: NonNullable<EntityIntegrationCandidate['renumbered']>) => void, beforePublish?: (plan: EntityIntegrationPlan, index: number) => void): Promise<{
127
+ export declare function applyEntityIntegration(root: string, inspected: unknown, authorize: (specId?: string, transition?: SpecTransition) => void, audit: (plan: EntityIntegrationPlan, verifyOnly?: boolean, renumbered?: NonNullable<EntityIntegrationCandidate['renumbered']>) => void, beforePublish?: (plan: EntityIntegrationPlan, index: number) => void): Promise<{
112
128
  ok: true;
113
129
  state: 'completed';
114
130
  operationId: string;
@@ -130,7 +146,7 @@ export declare function abandonEntityIntegration(root: string, inspected: unknow
130
146
  untouched: string[];
131
147
  preserved: string[];
132
148
  }>;
133
- export declare function recoverEntityIntegration(root: string, inspected: EntityIntegrationRecoveryInspection, authorize: (specId?: string) => void, audit: (plan: EntityIntegrationPlan, verifyOnly?: boolean) => void, beforePublish?: (plan: EntityIntegrationPlan, index: number) => void): Promise<{
149
+ export declare function recoverEntityIntegration(root: string, inspected: EntityIntegrationRecoveryInspection, authorize: (specId?: string, transition?: SpecTransition) => void, audit: (plan: EntityIntegrationPlan, verifyOnly?: boolean) => void, beforePublish?: (plan: EntityIntegrationPlan, index: number) => void): Promise<{
134
150
  ok: true;
135
151
  state: 'completed';
136
152
  operationId: string;
@@ -177,3 +193,4 @@ export declare function planEntityIntegrationCandidate(root: string, revisions:
177
193
  left: string;
178
194
  right: string;
179
195
  }, storeLocator: string): Promise<EntityIntegrationCandidate>;
196
+ export {};
@@ -33,6 +33,7 @@ var __importStar = (this && this.__importStar) || (function () {
33
33
  };
34
34
  })();
35
35
  Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.retiredSpecIds = retiredSpecIds;
36
37
  exports.prepareEntityIntegrationTransitions = prepareEntityIntegrationTransitions;
37
38
  exports.validateEntityIntegrationPlan = validateEntityIntegrationPlan;
38
39
  exports.entityIntegrationTarget = entityIntegrationTarget;
@@ -47,7 +48,7 @@ exports.prepareEntityIntegrationPlan = prepareEntityIntegrationPlan;
47
48
  exports.reviewEntityIntegration = reviewEntityIntegration;
48
49
  exports.compileEntityIntegrationSteps = compileEntityIntegrationSteps;
49
50
  exports.planEntityIntegrationCandidate = planEntityIntegrationCandidate;
50
- // @implements A-SPEC-629
51
+ // @implements A-SPEC-629, A-SPEC-794.90, A-SPEC-794.92, A-SPEC-794.95
51
52
  // @implements A-SPEC-645
52
53
  // @implements A-SPEC-641
53
54
  // @implements A-SPEC-640
@@ -72,6 +73,64 @@ const spec_digest_1 = require("./spec-digest");
72
73
  const transition_policy_1 = require("./transition-policy");
73
74
  const node_crypto_1 = require("node:crypto");
74
75
  const workspace_identity_1 = require("../project/workspace-identity");
76
+ /**
77
+ * @implements A-SPEC-794.92 (M-1) — an un-seal step whose document is later published as `outdated` is a retirement,
78
+ * not an un-seal: it needs spec-retire authority and records spec-retired, as spec_retire does outside an integration.
79
+ */
80
+ function retiredSpecIds(plan) {
81
+ const out = new Set();
82
+ // A-SPEC-794.95 (A-M3) — judged by the spec, not the locator: a later document step is the spec's when it names the
83
+ // spec, sits at the un-sealed locator, or parses to the spec's id. Published as outdated → retired; the un-sealed
84
+ // document deleted and no document of the spec published again → retired (a deletion withdraws the seal as well)
85
+ const parsed = (after) => {
86
+ try {
87
+ const s = (0, spec_parser_1.parseSpec)(Buffer.from(after, 'base64').toString('utf8'));
88
+ return { id: s.id, status: s.status };
89
+ }
90
+ catch {
91
+ return null;
92
+ }
93
+ };
94
+ plan.steps.forEach((step, i) => {
95
+ if (step.phase !== 'unseal' || !step.specId || !step.change?.locator)
96
+ return;
97
+ const id = step.specId, locator = step.change.locator;
98
+ let deleted = false, published = null;
99
+ for (const s of plan.steps.slice(i + 1)) {
100
+ if (s.phase !== 'document' || !s.change)
101
+ continue;
102
+ const after = s.change.after;
103
+ if (typeof after !== 'string') {
104
+ if (s.change.locator === locator || s.specId === id)
105
+ deleted = true;
106
+ continue;
107
+ }
108
+ const p = parsed(after);
109
+ if (s.specId === id || s.change.locator === locator || p?.id === id)
110
+ published = p?.status ?? 'unreadable';
111
+ }
112
+ if (published === 'outdated' || (published === null && deleted))
113
+ out.add(id);
114
+ });
115
+ return out;
116
+ }
117
+ /** @implements A-SPEC-794.90 — each spec step's (id, transition): an un-seal step un-seals, an approval step seals. */
118
+ function stepTransitions(plan) {
119
+ const seen = new Set();
120
+ const out = [];
121
+ const retired = retiredSpecIds(plan);
122
+ for (const step of plan.steps) {
123
+ if (!step.specId)
124
+ continue;
125
+ const t = step.phase === 'unseal' ? (retired.has(step.specId) ? 'retire' : 'unseal') : 'seal';
126
+ const key = `${step.specId}\u0000${t}`;
127
+ if (!seen.has(key)) {
128
+ seen.add(key);
129
+ out.push([step.specId, t]);
130
+ }
131
+ }
132
+ return out.sort((a, b) => (a[0] + a[1]).localeCompare(b[0] + b[1]));
133
+ }
75
134
  /** Produces document transitions only; authority and durable application belong to the executor. */
76
135
  function prepareEntityIntegrationTransitions(current, desired, readFile) {
77
136
  const graph = (entries) => {
@@ -256,9 +315,10 @@ async function applyEntityIntegration(root, inspected, authorize, audit, beforeP
256
315
  if (integrationRead(root, '.ax/state/entity-completed/' + plan.operationId + '/journal.json'))
257
316
  throw new entity_transaction_1.EntityStoreError('recovery-required', 'This operation already has a completion receipt; verify it through recovery.');
258
317
  const program = JSON.stringify(plan), journal = JSON.stringify({ schema: 'holmes-entity-integration-journal/1', plan, storeOwner, sourceOwner });
259
- const progress = integrationProgress(root, plan), targets = [...new Set(plan.steps.flatMap(step => step.specId ? [step.specId] : []))].sort();
260
- const authority = () => { authorize(); for (const id of targets)
261
- authorize(id); };
318
+ const progress = integrationProgress(root, plan);
319
+ // A-SPEC-794.90 — each step's own kind before publication: an un-seal step asks spec-unseal here, not only in the audit
320
+ const authority = () => { authorize(); for (const [id, transition] of stepTransitions(plan))
321
+ authorize(id, transition); };
262
322
  let persisted = false;
263
323
  const verify = () => {
264
324
  if (JSON.stringify(plan) !== program)
@@ -359,9 +419,10 @@ async function recoverEntityIntegration(root, inspected, authorize, audit, befor
359
419
  const plan = observed.plan, program = JSON.stringify(plan), directory = '.ax/state/entity-transactions/' + plan.operationId, journalFile = directory + '/journal.json';
360
420
  const journalBytes = integrationRead(root, journalFile);
361
421
  const journal = JSON.parse(journalBytes.toString('utf8'));
362
- const targets = observed.completionVersion ? [] : [...new Set(plan.steps.flatMap(step => step.specId ? [step.specId] : []))].sort();
363
- const authority = () => { authorize(); for (const id of targets)
364
- authorize(id); };
422
+ // A-SPEC-794.90 — each step's own kind, as in apply
423
+ const steps = observed.completionVersion ? [] : stepTransitions(plan);
424
+ const authority = () => { authorize(); for (const [id, transition] of steps)
425
+ authorize(id, transition); };
365
426
  const identity = () => {
366
427
  const current = (0, workspace_identity_1.workspaceIdentity)(root);
367
428
  if (current.state !== 'registered' || current.workspaceId !== plan.workspaceId)
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "//": "@implements A-SPEC-209, A-SPEC-794.58",
3
3
  "name": "@holmes-lab/holmes-kit",
4
- "version": "0.40.1",
4
+ "version": "0.41.0",
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",
@@ -61,8 +61,11 @@
61
61
  "**/src/**/*.test.ts"
62
62
  ],
63
63
  "testTimeout": 30000,
64
+ "globalSetup": "<rootDir>/src/holmes/test-support/repo-artifacts-global.ts",
65
+ "globalTeardown": "<rootDir>/src/holmes/test-support/repo-artifacts-global.ts",
64
66
  "setupFilesAfterEnv": [
65
- "<rootDir>/src/holmes/test-support/jest-timeouts-setup.ts"
67
+ "<rootDir>/src/holmes/test-support/jest-timeouts-setup.ts",
68
+ "<rootDir>/src/holmes/test-support/own-repo-judge-setup.ts"
66
69
  ],
67
70
  "maxWorkers": "50%",
68
71
  "roots": [