@holmes-lab/holmes-kit 0.35.17 → 0.35.19

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 (35) hide show
  1. package/CHANGELOG.md +73 -0
  2. package/README.md +4 -2
  3. package/dist/.build-id +1 -1
  4. package/dist/holmes/cli/approve-status.d.ts +4 -1
  5. package/dist/holmes/cli/approve-status.js +10 -0
  6. package/dist/holmes/cli/approve-watch.js +4 -0
  7. package/dist/holmes/cli/approve.d.ts +9 -2
  8. package/dist/holmes/cli/approve.js +33 -9
  9. package/dist/holmes/cli/autonomy.d.ts +13 -6
  10. package/dist/holmes/cli/autonomy.js +105 -16
  11. package/dist/holmes/cli/doctor.js +21 -3
  12. package/dist/holmes/cli/index.js +33 -9
  13. package/dist/holmes/cli/init.js +3 -1
  14. package/dist/holmes/cli/interactive-prompt.d.ts +5 -0
  15. package/dist/holmes/cli/interactive-prompt.js +12 -4
  16. package/dist/holmes/cli/runtime-binding.d.ts +23 -1
  17. package/dist/holmes/cli/runtime-binding.js +117 -5
  18. package/dist/holmes/governance/approval-queue.d.ts +7 -1
  19. package/dist/holmes/governance/approval-queue.js +34 -3
  20. package/dist/holmes/governance/autonomy.d.ts +0 -2
  21. package/dist/holmes/governance/autonomy.js +27 -5
  22. package/dist/holmes/governance/delegation.d.ts +40 -0
  23. package/dist/holmes/governance/delegation.js +151 -0
  24. package/dist/holmes/guardrail/write-target.d.ts +10 -0
  25. package/dist/holmes/guardrail/write-target.js +82 -0
  26. package/dist/holmes/hooks/pre-tool-use.d.ts +3 -1
  27. package/dist/holmes/hooks/pre-tool-use.js +22 -4
  28. package/dist/holmes/hooks/stop-timing.d.ts +12 -0
  29. package/dist/holmes/hooks/stop-timing.js +22 -0
  30. package/dist/holmes/hooks/stop.js +28 -0
  31. package/dist/holmes/mcp/handlers/spec-approval.d.ts +1 -1
  32. package/dist/holmes/mcp/handlers/spec-approval.js +21 -2
  33. package/dist/holmes/mcp/handlers.d.ts +5 -5
  34. package/dist/holmes/runtime/dispatch.js +28 -3
  35. package/package.json +1 -1
@@ -121,16 +121,32 @@ async function runDispatch(opts) {
121
121
  process.exitCode = 0;
122
122
  return;
123
123
  }
124
+ // @implements A-SPEC-769.2 — where the budget went (X1, 2026-10-12: a Stop hook of 11.3 s at load 5 was refused with
125
+ // "deadline exceeded" and nothing said whether the input wait, the selection or the child used the 18 s). Each phase
126
+ // is closed when it ends, whether or not it succeeded, so the refusal can print it.
127
+ let phaseInput;
128
+ let phaseSelection;
129
+ let phaseChild;
130
+ const budgetText = String(opts.hookBudgetMs ?? hook_process_1.HOOK_BUDGET_MS);
124
131
  try {
125
132
  if (!['claude', 'codex', 'antigravity'].includes(opts.harness) || !['mcp', 'pre-tool-use', 'stop'].includes(opts.entry))
126
133
  throw new Error('Invalid runtime dispatcher entry or harness');
127
134
  const hookBudget = (0, hook_process_1.boundedHookBudget)(opts.hookBudgetMs, hook_process_1.HOOK_BUDGET_MS);
128
135
  const cleanupBudget = (0, hook_process_1.boundedHookBudget)(opts.cleanupBudgetMs, hook_process_1.HOOK_CLEANUP_MS);
129
- const input = opts.entry === 'mcp' ? undefined : await hookInput(hookBudget);
136
+ let input;
137
+ if (opts.entry !== 'mcp') {
138
+ try {
139
+ input = await hookInput(hookBudget);
140
+ }
141
+ finally {
142
+ phaseInput = Math.round(performance.now() - started);
143
+ }
144
+ }
130
145
  const hints = input ? hintsFromInput(input) : [];
131
146
  if (process.env.CLAUDE_PROJECT_DIR)
132
147
  hints.push(process.env.CLAUDE_PROJECT_DIR);
133
148
  const selection = (0, binding_1.selectRuntime)((0, binding_1.readRuntimeRegistry)(opts.registryPath), { cwd: process.cwd(), workspaceHints: hints, specsHint: process.env.HOLMES_SPECS });
149
+ phaseSelection = Math.round(performance.now() - started) - (phaseInput ?? 0);
134
150
  selectedBuild = selection.buildId;
135
151
  selectedPackage = selection.packageRoot;
136
152
  selectedWorkspace = selection.workspaceRoot;
@@ -157,7 +173,14 @@ async function runDispatch(opts) {
157
173
  detached: input !== undefined && process.platform !== 'win32', windowsHide: true,
158
174
  });
159
175
  if (input) {
160
- const result = await (0, hook_process_1.runHookChild)(child, input, remaining, cleanupBudget);
176
+ const childStarted = performance.now();
177
+ let result;
178
+ try {
179
+ result = await (0, hook_process_1.runHookChild)(child, input, remaining, cleanupBudget);
180
+ }
181
+ finally {
182
+ phaseChild = Math.round(performance.now() - childStarted);
183
+ }
161
184
  if (result.signal) {
162
185
  process.kill(process.pid, result.signal);
163
186
  return;
@@ -181,7 +204,9 @@ async function runDispatch(opts) {
181
204
  const shellWord = (word) => process.platform === 'win32' ? JSON.stringify(word) : `'${word.replace(/'/g, `'\\''`)}'`;
182
205
  const cli = selectedPackage ? `${shellWord(process.execPath)} ${shellWord(path.join(selectedPackage, 'bin/holmes-kit.js'))}` : 'holmes-kit';
183
206
  const recovery = opts.entry === 'mcp' ? '' : ` [${opts.harness}/${opts.entry}${selectedBuild ? ` build ${selectedBuild}` : ''}]. Diagnose with ${cli} runtime-binding status --workspace ${shellWord(selectedWorkspace)} --registry ${shellWord(opts.registryPath)} and ${cli} doctor --target ${shellWord(selectedWorkspace)} --registry ${shellWord(opts.registryPath)}. Repair the selected runtime through the approved installation workflow, then retry the original operation. Pending governance findings remain unresolved.`;
184
- const reason = `[Holmes-Kit] Runtime dispatch refused: ${error.message}${recovery}`;
207
+ const phases = opts.entry === 'mcp' ? ''
208
+ : `; phases (ms of ${budgetText}): input ${phaseInput ?? '-'}, selection ${phaseSelection ?? '-'}, hook child ${phaseChild ?? '-'}`;
209
+ const reason = `[Holmes-Kit] Runtime dispatch refused: ${error.message}${phases}${recovery}`;
185
210
  process.stderr.write(`${reason}\n`);
186
211
  // A partially loaded entry may have opened handles; exitCode alone would
187
212
  // leave a failed transport alive indefinitely.
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.17",
4
+ "version": "0.35.19",
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",