@holmes-lab/holmes-kit 0.39.0 → 0.40.1
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 +578 -6
- package/README.md +120 -41
- package/dist/.build-id +1 -1
- package/dist/holmes/admission/core/admission-policy.d.ts +37 -0
- package/dist/holmes/admission/core/admission-policy.js +147 -0
- package/dist/holmes/admission/core/bounded-reader.d.ts +56 -0
- package/dist/holmes/admission/core/bounded-reader.js +135 -0
- package/dist/holmes/admission/core/change-classifier.d.ts +34 -0
- package/dist/holmes/admission/core/change-classifier.js +278 -0
- package/dist/holmes/admission/core/config-loader.d.ts +30 -0
- package/dist/holmes/admission/core/config-loader.js +145 -0
- package/dist/holmes/admission/core/event-judgement.d.ts +37 -0
- package/dist/holmes/admission/core/event-judgement.js +251 -0
- package/dist/holmes/admission/core/path-rules.d.ts +35 -0
- package/dist/holmes/admission/core/path-rules.js +88 -0
- package/dist/holmes/admission/core/pin.d.ts +7 -0
- package/dist/holmes/admission/core/pin.js +29 -0
- package/dist/holmes/admission/core/ports.d.ts +48 -0
- package/dist/holmes/admission/core/ports.js +11 -0
- package/dist/holmes/admission/core/range-resolver.d.ts +32 -0
- package/dist/holmes/admission/core/range-resolver.js +51 -0
- package/dist/holmes/admission/core/self-containment.d.ts +1 -0
- package/dist/holmes/admission/core/self-containment.js +125 -0
- package/dist/holmes/admission/core/signature-source.d.ts +9 -0
- package/dist/holmes/admission/core/signature-source.js +4 -0
- package/dist/holmes/admission/core/transition-planner.d.ts +15 -0
- package/dist/holmes/admission/core/transition-planner.js +14 -0
- package/dist/holmes/admission/core/verdict.d.ts +38 -0
- package/dist/holmes/admission/core/verdict.js +17 -0
- package/dist/holmes/admission/core/wiring.d.ts +44 -0
- package/dist/holmes/admission/core/wiring.js +618 -0
- package/dist/holmes/admission/forge/git-object-port.d.ts +4 -0
- package/dist/holmes/admission/forge/git-object-port.js +132 -0
- package/dist/holmes/assoc/assoc-arm.d.ts +1 -1
- package/dist/holmes/assoc/assoc-arm.js +1 -1
- package/dist/holmes/cli/agents.d.ts +8 -0
- package/dist/holmes/cli/agents.js +9 -5
- package/dist/holmes/cli/approve-cli.d.ts +2 -0
- package/dist/holmes/cli/approve-cli.js +392 -0
- package/dist/holmes/cli/approve-ref.d.ts +13 -7
- package/dist/holmes/cli/approve-ref.js +30 -10
- package/dist/holmes/cli/approve-status.d.ts +26 -2
- package/dist/holmes/cli/approve-status.js +98 -18
- package/dist/holmes/cli/approve-watch.d.ts +5 -0
- package/dist/holmes/cli/approve-watch.js +10 -5
- package/dist/holmes/cli/approve.d.ts +49 -13
- package/dist/holmes/cli/approve.js +249 -67
- package/dist/holmes/cli/attest.js +2 -1
- package/dist/holmes/cli/autonomy.d.ts +4 -1
- package/dist/holmes/cli/autonomy.js +17 -10
- package/dist/holmes/cli/codex-oracle.d.ts +11 -0
- package/dist/holmes/cli/codex-oracle.js +5 -1
- package/dist/holmes/cli/codex-toml.d.ts +10 -0
- package/dist/holmes/cli/codex-toml.js +36 -2
- package/dist/holmes/cli/doctor-boundary.d.ts +76 -0
- package/dist/holmes/cli/doctor-boundary.js +308 -0
- package/dist/holmes/cli/doctor-locks.d.ts +15 -0
- package/dist/holmes/cli/doctor-locks.js +119 -0
- package/dist/holmes/cli/doctor.d.ts +2 -0
- package/dist/holmes/cli/doctor.js +34 -5
- package/dist/holmes/cli/flags.d.ts +23 -0
- package/dist/holmes/cli/flags.js +89 -0
- package/dist/holmes/cli/index.d.ts +5 -1
- package/dist/holmes/cli/index.js +226 -442
- package/dist/holmes/cli/init.js +33 -0
- package/dist/holmes/cli/interactive-prompt.d.ts +39 -2
- package/dist/holmes/cli/interactive-prompt.js +98 -16
- package/dist/holmes/cli/lock-recover.d.ts +5 -0
- package/dist/holmes/cli/lock-recover.js +126 -0
- package/dist/holmes/cli/mcp-processes.js +1 -1
- package/dist/holmes/cli/release-docs.js +1 -1
- package/dist/holmes/cli/run-exec.d.ts +141 -0
- package/dist/holmes/cli/run-exec.js +1435 -0
- package/dist/holmes/cli/run-provision.d.ts +3 -1
- package/dist/holmes/cli/run-provision.js +255 -44
- package/dist/holmes/cli/run-wiring.d.ts +69 -0
- package/dist/holmes/cli/run-wiring.js +270 -0
- package/dist/holmes/cli/run.d.ts +21 -0
- package/dist/holmes/cli/run.js +341 -92
- package/dist/holmes/cli/runtime-binding-approval.js +32 -19
- package/dist/holmes/cli/screen-safe.d.ts +3 -92
- package/dist/holmes/cli/screen-safe.js +18 -756
- package/dist/holmes/config/config.d.ts +19 -0
- package/dist/holmes/config/config.js +18 -3
- package/dist/holmes/cpg/foundation/language-matrix.js +2 -2
- package/dist/holmes/cpg/import-resolver.js +1 -1
- package/dist/holmes/governance/approval-decisions.d.ts +47 -0
- package/dist/holmes/governance/approval-decisions.js +29 -0
- package/dist/holmes/governance/approval-grants.d.ts +220 -1
- package/dist/holmes/governance/approval-grants.js +612 -33
- package/dist/holmes/governance/approval-queue.d.ts +26 -0
- package/dist/holmes/governance/approval-queue.js +109 -11
- package/dist/holmes/governance/approval-spend.d.ts +95 -0
- package/dist/holmes/governance/approval-spend.js +191 -0
- package/dist/holmes/governance/autonomous-shell.d.ts +61 -0
- package/dist/holmes/governance/autonomous-shell.js +332 -0
- package/dist/holmes/governance/autonomy.d.ts +12 -0
- package/dist/holmes/governance/autonomy.js +51 -15
- package/dist/holmes/governance/constitution.d.ts +5 -0
- package/dist/holmes/governance/constitution.js +32 -12
- package/dist/holmes/governance/full-autonomy.d.ts +10 -0
- package/dist/holmes/governance/full-autonomy.js +103 -7
- package/dist/holmes/governance/harness-catalog.d.ts +103 -0
- package/dist/holmes/governance/harness-catalog.js +348 -0
- package/dist/holmes/governance/human-channel.d.ts +38 -0
- package/dist/holmes/governance/human-channel.js +49 -0
- package/dist/holmes/governance/install-manifest.d.ts +22 -0
- package/dist/holmes/governance/install-manifest.js +160 -0
- package/dist/holmes/governance/ledger-rechain.js +2 -0
- package/dist/holmes/governance/ledger-store.conformance.d.ts +7 -1
- package/dist/holmes/governance/ledger-store.conformance.js +66 -0
- package/dist/holmes/governance/ledger-store.d.ts +88 -11
- package/dist/holmes/governance/ledger-store.js +186 -8
- package/dist/holmes/governance/provenance-chain.d.ts +16 -4
- package/dist/holmes/governance/provenance-chain.js +19 -4
- package/dist/holmes/governance/provenance-ledger.d.ts +6 -3
- package/dist/holmes/governance/provenance-ledger.js +53 -18
- package/dist/holmes/governance/push-gate-runner.d.ts +2 -0
- package/dist/holmes/governance/push-gate-runner.js +50 -9
- package/dist/holmes/governance/push-gate.d.ts +13 -2
- package/dist/holmes/governance/push-gate.js +106 -14
- package/dist/holmes/governance/recorded-pairs.d.ts +96 -0
- package/dist/holmes/governance/recorded-pairs.js +522 -0
- package/dist/holmes/governance/replica-id.d.ts +1 -1
- package/dist/holmes/governance/replica-id.js +1 -1
- package/dist/holmes/governance/spec-seam.d.ts +59 -0
- package/dist/holmes/governance/spec-seam.js +587 -0
- package/dist/holmes/governance/spend-kinds.d.ts +16 -0
- package/dist/holmes/governance/spend-kinds.js +18 -0
- package/dist/holmes/guardrail/advisory-line.d.ts +102 -0
- package/dist/holmes/guardrail/advisory-line.js +718 -0
- package/dist/holmes/guardrail/decision-ledger.d.ts +2 -1
- package/dist/holmes/guardrail/decision-ledger.js +2 -1
- package/dist/holmes/guardrail/impact-gate.d.ts +7 -0
- package/dist/holmes/guardrail/impact-gate.js +33 -6
- package/dist/holmes/guardrail/line-continuation.d.ts +8 -0
- package/dist/holmes/guardrail/line-continuation.js +39 -0
- package/dist/holmes/guardrail/operator-person.d.ts +28 -4
- package/dist/holmes/guardrail/operator-person.js +57 -11
- package/dist/holmes/guardrail/refusal-codes.d.ts +8 -3
- package/dist/holmes/guardrail/refusal-codes.js +64 -10
- package/dist/holmes/guardrail/risk-classifier.d.ts +15 -9
- package/dist/holmes/guardrail/risk-classifier.js +228 -16
- package/dist/holmes/guardrail/risk-gate.d.ts +2 -8
- package/dist/holmes/guardrail/risk-gate.js +7 -34
- package/dist/holmes/guardrail/risk-types.d.ts +10 -0
- package/dist/holmes/guardrail/run-plan-scope.js +3 -1
- package/dist/holmes/guardrail/run-refusals.js +24 -8
- package/dist/holmes/guardrail/run-stages.d.ts +5 -0
- package/dist/holmes/guardrail/run-stages.js +25 -5
- package/dist/holmes/guardrail/scope-judgment.js +1 -1
- package/dist/holmes/guardrail/shell-words.js +24 -3
- package/dist/holmes/guardrail/unresolved-write.d.ts +40 -0
- package/dist/holmes/guardrail/unresolved-write.js +556 -0
- package/dist/holmes/guardrail/write-target.d.ts +3 -0
- package/dist/holmes/guardrail/write-target.js +26 -5
- package/dist/holmes/hooks/pre-tool-use.d.ts +116 -1
- package/dist/holmes/hooks/pre-tool-use.js +1176 -170
- package/dist/holmes/hooks/rtm-refresh-child.d.ts +1 -1
- package/dist/holmes/hooks/rtm-refresh-child.js +1 -1
- package/dist/holmes/hooks/session-start.js +17 -1
- package/dist/holmes/hooks/stop.d.ts +23 -0
- package/dist/holmes/hooks/stop.js +86 -33
- package/dist/holmes/mcp/approval-adapters.js +3 -1
- package/dist/holmes/mcp/approval-commit.js +3 -2
- package/dist/holmes/mcp/approval-policy.d.ts +2 -1
- package/dist/holmes/mcp/approval-policy.js +3 -1
- package/dist/holmes/mcp/handlers/adoption.d.ts +1 -1
- package/dist/holmes/mcp/handlers/approval-ask.d.ts +3 -0
- package/dist/holmes/mcp/handlers/approval-ask.js +18 -7
- package/dist/holmes/mcp/handlers/entity-integration.d.ts +3 -3
- package/dist/holmes/mcp/handlers/entity-integration.js +29 -11
- package/dist/holmes/mcp/handlers/entity-renumber.d.ts +4 -4
- package/dist/holmes/mcp/handlers/entity-renumber.js +29 -11
- package/dist/holmes/mcp/handlers/entity-store.d.ts +2 -2
- package/dist/holmes/mcp/handlers/entity-store.js +133 -59
- package/dist/holmes/mcp/handlers/maintenance-analysis.d.ts +13 -0
- package/dist/holmes/mcp/handlers/maintenance-analysis.js +59 -2
- package/dist/holmes/mcp/handlers/operator-inspection.d.ts +9 -5
- package/dist/holmes/mcp/handlers/operator-inspection.js +79 -16
- package/dist/holmes/mcp/handlers/phase-queries.d.ts +1 -1
- package/dist/holmes/mcp/handlers/requirement-triage.d.ts +4 -4
- package/dist/holmes/mcp/handlers/review-evidence.d.ts +2 -2
- package/dist/holmes/mcp/handlers/review-evidence.js +35 -11
- package/dist/holmes/mcp/handlers/review-queries.d.ts +5 -0
- package/dist/holmes/mcp/handlers/review-queries.js +8 -1
- package/dist/holmes/mcp/handlers/review-verdict.d.ts +3 -0
- package/dist/holmes/mcp/handlers/review-verdict.js +10 -3
- package/dist/holmes/mcp/handlers/risk-assessment.d.ts +7 -2
- package/dist/holmes/mcp/handlers/risk-assessment.js +34 -12
- package/dist/holmes/mcp/handlers/runtime-binding-tool.d.ts +2 -2
- package/dist/holmes/mcp/handlers/slice-orchestration.d.ts +6 -1
- package/dist/holmes/mcp/handlers/slice-orchestration.js +14 -1
- package/dist/holmes/mcp/handlers/spec-approval.d.ts +15 -3
- package/dist/holmes/mcp/handlers/spec-approval.js +32 -5
- package/dist/holmes/mcp/handlers/spec-authoring.d.ts +2 -2
- package/dist/holmes/mcp/handlers/spec-authoring.js +19 -2
- package/dist/holmes/mcp/handlers/spec-lifecycle.d.ts +11 -38
- package/dist/holmes/mcp/handlers/spec-lifecycle.js +441 -94
- package/dist/holmes/mcp/handlers/spec-queries.d.ts +2 -2
- package/dist/holmes/mcp/handlers/taint-screening.d.ts +1 -1
- package/dist/holmes/mcp/handlers/taint-screening.js +2 -2
- package/dist/holmes/mcp/handlers/test-execution.d.ts +471 -4
- package/dist/holmes/mcp/handlers/test-execution.js +199 -21
- package/dist/holmes/mcp/handlers/workspace-queries.d.ts +2 -2
- package/dist/holmes/mcp/handlers.d.ts +557 -82
- package/dist/holmes/mcp/handlers.js +74 -23
- package/dist/holmes/mcp/harness-attestation.d.ts +78 -5
- package/dist/holmes/mcp/harness-attestation.js +325 -53
- package/dist/holmes/mcp/maintenance-analyze.d.ts +6 -1
- package/dist/holmes/mcp/maintenance-analyze.js +13 -11
- package/dist/holmes/mcp/maintenance-evidence.d.ts +9 -0
- package/dist/holmes/mcp/maintenance-evidence.js +35 -3
- package/dist/holmes/mcp/requirement-triage-evidence.js +22 -13
- package/dist/holmes/mcp/server-staleness.js +1 -1
- package/dist/holmes/mcp/server.js +9 -8
- package/dist/holmes/mcp/spec-id-guard.js +1 -1
- package/dist/holmes/mcp/tool-schemas.d.ts +13 -0
- package/dist/holmes/mcp/tool-schemas.js +42 -9
- package/dist/holmes/project/act-root.d.ts +19 -0
- package/dist/holmes/project/act-root.js +100 -0
- package/dist/holmes/project/baseline.d.ts +15 -2
- package/dist/holmes/project/baseline.js +14 -8
- package/dist/holmes/project/bounded-group.d.ts +47 -0
- package/dist/holmes/project/bounded-group.js +140 -0
- package/dist/holmes/project/bounded-io.d.ts +51 -2
- package/dist/holmes/project/bounded-io.js +140 -6
- package/dist/holmes/project/change-source.d.ts +4 -0
- package/dist/holmes/project/change-source.js +14 -6
- package/dist/holmes/project/instance-id.d.ts +10 -0
- package/dist/holmes/project/instance-id.js +233 -0
- package/dist/holmes/project/machine-identity.d.ts +25 -0
- package/dist/holmes/project/machine-identity.js +133 -0
- package/dist/holmes/project/owned-lock.d.ts +84 -0
- package/dist/holmes/project/owned-lock.js +263 -0
- package/dist/holmes/project/plain-lock-fs.d.ts +2 -0
- package/dist/holmes/project/plain-lock-fs.js +126 -0
- package/dist/holmes/project/request-lock.d.ts +85 -0
- package/dist/holmes/project/request-lock.js +459 -0
- package/dist/holmes/project/root.d.ts +12 -4
- package/dist/holmes/project/root.js +29 -8
- package/dist/holmes/project/run-records.d.ts +19 -0
- package/dist/holmes/project/run-records.js +94 -12
- package/dist/holmes/project/screen-text.d.ts +94 -0
- package/dist/holmes/project/screen-text.js +763 -0
- package/dist/holmes/project/spend-lock.d.ts +82 -0
- package/dist/holmes/project/spend-lock.js +413 -0
- package/dist/holmes/refresh/freshness-coordinator.d.ts +1 -1
- package/dist/holmes/refresh/freshness-coordinator.js +1 -1
- package/dist/holmes/review/condition-hunk-replay.js +4 -2
- package/dist/holmes/review/confidence-calibration.d.ts +1 -1
- package/dist/holmes/review/confidence-calibration.js +1 -1
- package/dist/holmes/review/content-verify.js +1 -1
- package/dist/holmes/review/evidence-mode.d.ts +21 -0
- package/dist/holmes/review/evidence-mode.js +33 -0
- package/dist/holmes/review/head-worktree.d.ts +55 -0
- package/dist/holmes/review/head-worktree.js +329 -0
- package/dist/holmes/review/hop-ablation.d.ts +4 -4
- package/dist/holmes/review/hop-ablation.js +5 -5
- package/dist/holmes/review/mrp.js +13 -3
- package/dist/holmes/review/point-in-time-replay.js +12 -3
- package/dist/holmes/review/rank-diagnosis.d.ts +2 -2
- package/dist/holmes/review/rank-diagnosis.js +1 -1
- package/dist/holmes/review/replay-corpus.d.ts +10 -4
- package/dist/holmes/review/replay-corpus.js +25 -9
- package/dist/holmes/review/requirement-triage.js +2 -2
- package/dist/holmes/review/run-provenance.d.ts +45 -0
- package/dist/holmes/review/run-provenance.js +314 -0
- package/dist/holmes/review/semantic-arm.d.ts +3 -3
- package/dist/holmes/review/semantic-arm.js +3 -3
- package/dist/holmes/review/test-evidence.d.ts +174 -0
- package/dist/holmes/review/test-evidence.js +330 -2
- package/dist/holmes/review/test-outcomes.js +3 -1
- package/dist/holmes/review/test-reports.d.ts +94 -0
- package/dist/holmes/review/test-reports.js +382 -0
- package/dist/holmes/review/test-runner.d.ts +180 -58
- package/dist/holmes/review/test-runner.js +560 -324
- package/dist/holmes/review/test-selection-breadth.js +2 -2
- package/dist/holmes/review/test-units.d.ts +159 -0
- package/dist/holmes/review/test-units.js +814 -0
- package/dist/holmes/review/verdicts.d.ts +105 -8
- package/dist/holmes/review/verdicts.js +640 -36
- package/dist/holmes/rtm/anchor-census.d.ts +9 -0
- package/dist/holmes/rtm/anchor-census.js +151 -0
- package/dist/holmes/rtm/anchor-ids.d.ts +25 -1
- package/dist/holmes/rtm/anchor-ids.js +45 -2
- package/dist/holmes/rtm/comment-ranges.d.ts +2 -0
- package/dist/holmes/rtm/comment-ranges.js +104 -0
- package/dist/holmes/rtm/counted-tests.d.ts +1 -0
- package/dist/holmes/rtm/counted-tests.js +63 -0
- package/dist/holmes/rtm/impact-advisory.d.ts +1 -1
- package/dist/holmes/rtm/known-defects.js +1 -1
- package/dist/holmes/rtm/localize.js +1 -1
- package/dist/holmes/rtm/taint-benchmark.d.ts +1 -1
- package/dist/holmes/rtm/taint-vocabulary.d.ts +1 -1
- package/dist/holmes/rtm/test-scope.d.ts +31 -0
- package/dist/holmes/rtm/test-scope.js +166 -5
- package/dist/holmes/rtm/trace-gaps.js +1 -1
- package/dist/holmes/runtime/dispatch.d.ts +10 -0
- package/dist/holmes/runtime/dispatch.js +12 -1
- package/dist/holmes/semantic/cloud-usage.d.ts +1 -1
- package/dist/holmes/semantic/cloud-usage.js +1 -1
- package/dist/holmes/semantic/unreadable-paths.d.ts +1 -1
- package/dist/holmes/semantic/unreadable-paths.js +1 -1
- package/dist/holmes/spec/approval-blockers.js +1 -1
- package/dist/holmes/spec/entity-store.d.ts +6 -1
- package/dist/holmes/spec/entity-store.js +16 -2
- package/dist/holmes/spec/entity-transaction.d.ts +7 -2
- package/dist/holmes/spec/entity-transaction.js +87 -170
- package/dist/holmes/spec/spec-store.d.ts +12 -6
- package/dist/holmes/spec/spec-store.js +4 -2
- package/dist/holmes/spec/spec-types.js +1 -1
- package/dist/holmes/spec/succession-guard.d.ts +56 -0
- package/dist/holmes/spec/succession-guard.js +187 -0
- package/dist/holmes/spec/succession.d.ts +70 -0
- package/dist/holmes/spec/succession.js +171 -0
- package/dist/holmes/spec/transition-policy.d.ts +2 -2
- package/docs/install-guide.md +9 -3
- package/docs/language-support.md +78 -0
- package/package.json +4 -3
- package/playbooks/author-slice/PLAYBOOK.md +1 -1
- package/playbooks/promote-slice/PLAYBOOK.md +5 -1
- package/playbooks/publish/PLAYBOOK.md +47 -34
- package/dist/holmes/review/manual-baseline.d.ts +0 -209
- package/dist/holmes/review/manual-baseline.js +0 -2847
|
@@ -0,0 +1,270 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.holmesMcpEntry = holmesMcpEntry;
|
|
37
|
+
exports.holmesHookScript = holmesHookScript;
|
|
38
|
+
exports.holmesGate = holmesGate;
|
|
39
|
+
exports.expectedWiring = expectedWiring;
|
|
40
|
+
exports.exactMcp = exactMcp;
|
|
41
|
+
exports.exactGate = exactGate;
|
|
42
|
+
exports.packageInside = packageInside;
|
|
43
|
+
exports.codexTrusts = codexTrusts;
|
|
44
|
+
// @implements A-SPEC-774.30, A-SPEC-774.32
|
|
45
|
+
/**
|
|
46
|
+
* What a worktree's wiring launches, judged by content. A "holmes" substring is not wiring: a settings.json holding
|
|
47
|
+
* only that word skipped provisioning and passed the gate check (measured by an orchestrator's review). An MCP entry is Holmes's when it runs
|
|
48
|
+
* an existing holmes-mcp.js inside a `@holmes-lab/holmes-kit` package (or an npx pinned to that package); a gate is
|
|
49
|
+
* Holmes's when a PreToolUse hook and a Stop hook each run an existing script inside such a package.
|
|
50
|
+
*/
|
|
51
|
+
const fs = __importStar(require("node:fs"));
|
|
52
|
+
const path = __importStar(require("node:path"));
|
|
53
|
+
const run_refusals_1 = require("../guardrail/run-refusals");
|
|
54
|
+
const MCP_SCRIPTS = new Set(['bin/holmes-mcp.js', 'dist/holmes/mcp/server.js']);
|
|
55
|
+
const isFile = (p) => { try {
|
|
56
|
+
return fs.statSync(p).isFile();
|
|
57
|
+
}
|
|
58
|
+
catch {
|
|
59
|
+
return false;
|
|
60
|
+
} };
|
|
61
|
+
const NPX_PIN = /^@holmes-lab\/holmes-kit@(\d+\.\d+\.\d+[0-9A-Za-z.+-]*)$/;
|
|
62
|
+
/** The holmes-kit package an MCP server entry launches, or why it launches none. */
|
|
63
|
+
function holmesMcpEntry(entry) {
|
|
64
|
+
if (!entry || typeof entry !== 'object' || Array.isArray(entry))
|
|
65
|
+
return { ok: false, detail: 'no holmes-kit server entry' };
|
|
66
|
+
const e = entry;
|
|
67
|
+
const args = Array.isArray(e.args) ? e.args.filter((a) => typeof a === 'string') : [];
|
|
68
|
+
if (e.command === 'node') {
|
|
69
|
+
const script = args[0];
|
|
70
|
+
if (script === undefined || !path.isAbsolute(script)) {
|
|
71
|
+
return { ok: false, detail: `the holmes-kit entry runs node ${script ?? '(no script)'}, not an absolute holmes-kit MCP script` };
|
|
72
|
+
}
|
|
73
|
+
if (!isFile(script))
|
|
74
|
+
return { ok: false, detail: `the holmes-kit entry runs ${script}, which does not exist` };
|
|
75
|
+
const pkg = (0, run_refusals_1.holmesPackageAbove)(script);
|
|
76
|
+
if (pkg === null)
|
|
77
|
+
return { ok: false, detail: `${script} is not inside a @holmes-lab/holmes-kit package` };
|
|
78
|
+
const rel = path.relative(pkg.root, script).replace(/\\/g, '/');
|
|
79
|
+
if (!MCP_SCRIPTS.has(rel))
|
|
80
|
+
return { ok: false, detail: `${script} is not holmes-kit's MCP entry (${[...MCP_SCRIPTS].join(' or ')})` };
|
|
81
|
+
return { ok: true, pkg, detail: `runs ${script} (holmes-kit ${pkg.version})` };
|
|
82
|
+
}
|
|
83
|
+
// The package's own `holmes-mcp` bin on PATH: Holmes's server, at a version run start cannot read.
|
|
84
|
+
if (typeof e.command === 'string' && /^holmes-mcp(?:\.cmd)?$/i.test(path.basename(e.command))) {
|
|
85
|
+
return { ok: true, pkg: { root: null, version: null }, detail: `runs the holmes-mcp bin on PATH (version unreadable)` };
|
|
86
|
+
}
|
|
87
|
+
if (e.command === 'npx') {
|
|
88
|
+
const pin = args.map((a) => NPX_PIN.exec(a)).find((m) => m !== null);
|
|
89
|
+
if (pin)
|
|
90
|
+
return { ok: true, pkg: { root: null, version: pin[1] }, detail: `runs npx @holmes-lab/holmes-kit@${pin[1]}` };
|
|
91
|
+
return { ok: false, detail: 'the holmes-kit entry runs npx without a pinned @holmes-lab/holmes-kit version' };
|
|
92
|
+
}
|
|
93
|
+
return { ok: false, detail: `the holmes-kit entry runs ${typeof e.command === 'string' ? e.command : '(no command)'}, which is no launch holmes-kit can identify` };
|
|
94
|
+
}
|
|
95
|
+
/** The holmes-kit package a hook command's script belongs to: its absolute, existing `.js` word. */
|
|
96
|
+
function holmesHookScript(command) {
|
|
97
|
+
const words = command.match(/"[^"]*"|'[^']*'|\S+/g) ?? [];
|
|
98
|
+
for (const w of words) {
|
|
99
|
+
const word = w.replace(/^["']|["']$/g, '');
|
|
100
|
+
if (!/\.js$/.test(word) || !path.isAbsolute(word) || !isFile(word))
|
|
101
|
+
continue;
|
|
102
|
+
const pkg = (0, run_refusals_1.holmesPackageAbove)(word);
|
|
103
|
+
if (pkg !== null)
|
|
104
|
+
return pkg;
|
|
105
|
+
}
|
|
106
|
+
return null;
|
|
107
|
+
}
|
|
108
|
+
/** Every hook `command` string under the key `event`, anywhere in a hooks document (Claude, Codex and agy shapes). */
|
|
109
|
+
function commandsUnder(doc, event) {
|
|
110
|
+
const out = [];
|
|
111
|
+
const collect = (v) => {
|
|
112
|
+
if (Array.isArray(v)) {
|
|
113
|
+
v.forEach(collect);
|
|
114
|
+
return;
|
|
115
|
+
}
|
|
116
|
+
if (v && typeof v === 'object') {
|
|
117
|
+
const o = v;
|
|
118
|
+
if (typeof o.command === 'string')
|
|
119
|
+
out.push(o.command);
|
|
120
|
+
Object.values(o).forEach(collect);
|
|
121
|
+
}
|
|
122
|
+
};
|
|
123
|
+
const find = (v) => {
|
|
124
|
+
if (Array.isArray(v)) {
|
|
125
|
+
v.forEach(find);
|
|
126
|
+
return;
|
|
127
|
+
}
|
|
128
|
+
if (v && typeof v === 'object') {
|
|
129
|
+
for (const [k, child] of Object.entries(v)) {
|
|
130
|
+
if (k === event)
|
|
131
|
+
collect(child);
|
|
132
|
+
else
|
|
133
|
+
find(child);
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
};
|
|
137
|
+
find(doc);
|
|
138
|
+
return out;
|
|
139
|
+
}
|
|
140
|
+
const parseJson = (text) => { if (text === null)
|
|
141
|
+
return null; try {
|
|
142
|
+
return JSON.parse(text);
|
|
143
|
+
}
|
|
144
|
+
catch {
|
|
145
|
+
return null;
|
|
146
|
+
} };
|
|
147
|
+
/** Whether the hooks documents carry a Holmes PreToolUse hook and a Holmes Stop hook; `files` name them in the detail. */
|
|
148
|
+
function holmesGate(docs) {
|
|
149
|
+
const found = { PreToolUse: null, Stop: null };
|
|
150
|
+
for (const d of docs) {
|
|
151
|
+
const doc = parseJson(d.text);
|
|
152
|
+
for (const event of ['PreToolUse', 'Stop']) {
|
|
153
|
+
if (found[event])
|
|
154
|
+
continue;
|
|
155
|
+
for (const c of commandsUnder(doc, event)) {
|
|
156
|
+
const pkg = holmesHookScript(c);
|
|
157
|
+
if (pkg) {
|
|
158
|
+
found[event] = { ...pkg, file: d.file };
|
|
159
|
+
break;
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
const missing = ['PreToolUse', 'Stop'].filter((e) => found[e] === null);
|
|
165
|
+
if (missing.length > 0) {
|
|
166
|
+
return { ok: false, detail: `no ${missing.join(' or ')} hook in ${docs.map((d) => d.file).join(', ')} runs a script inside a holmes-kit package` };
|
|
167
|
+
}
|
|
168
|
+
const pre = found.PreToolUse;
|
|
169
|
+
return { ok: true, pkg: { root: pre.root, version: pre.version }, detail: `PreToolUse and Stop run holmes-kit ${pre.version} (${pre.file})` };
|
|
170
|
+
}
|
|
171
|
+
/**
|
|
172
|
+
* @implements A-SPEC-774.32 — the wiring this CLI's package `pkg` builds. The checks pass only for exactly this: a
|
|
173
|
+
* content judgement that accepts "a script inside some holmes-kit package" was forged with echo wrappers, decoy keys,
|
|
174
|
+
* no-match matchers, unrelated scripts and a self-made package.json (review H1, measured).
|
|
175
|
+
*/
|
|
176
|
+
function expectedWiring(pkg) {
|
|
177
|
+
const { buildHookPlan } = require('./init');
|
|
178
|
+
const hp = buildHookPlan(pkg, '.*');
|
|
179
|
+
const mcpScript = path.join(pkg, 'bin', 'holmes-mcp.js');
|
|
180
|
+
const kernel = (s) => `node "${path.join(pkg, 'dist', 'holmes', 'hooks', s)}"`;
|
|
181
|
+
return {
|
|
182
|
+
claudeMcp: { command: 'node', args: [mcpScript], env: { HOLMES_SPECS: '.ax/specs' } },
|
|
183
|
+
codexMcp: { command: 'node', args: [mcpScript] },
|
|
184
|
+
claudeHooks: { pre: hp.preToolUseCommand, stop: hp.stopCommand, sessionStart: hp.sessionStartCommand },
|
|
185
|
+
codexHooks: { pre: kernel('pre-tool-use.js'), stop: kernel('stop.js') },
|
|
186
|
+
};
|
|
187
|
+
}
|
|
188
|
+
const canon = (v) => JSON.stringify(v, (_k, x) => (x && typeof x === 'object' && !Array.isArray(x)
|
|
189
|
+
? Object.fromEntries(Object.keys(x).sort().map((k) => [k, x[k]])) : x));
|
|
190
|
+
/** @implements A-SPEC-774.32 — an MCP entry equal to `want`, key for key. */
|
|
191
|
+
function exactMcp(entry, want, pkgVersion) {
|
|
192
|
+
if (entry === undefined || entry === null)
|
|
193
|
+
return { ok: false, detail: 'no holmes-kit server entry' };
|
|
194
|
+
if (canon(entry) !== canon(want))
|
|
195
|
+
return { ok: false, detail: `the holmes-kit entry is not the one this CLI writes (${canon(want).slice(0, 200)})` };
|
|
196
|
+
return { ok: true, pkg: { root: null, version: pkgVersion }, detail: 'the holmes-kit entry is the one this CLI writes' };
|
|
197
|
+
}
|
|
198
|
+
/**
|
|
199
|
+
* @implements A-SPEC-774.32 — a PreToolUse hook (matcher `.*` or none) and a Stop hook whose commands equal this CLI's,
|
|
200
|
+
* read only under `hooks.<Event>[*].hooks[*]`, the shape Claude and Codex load.
|
|
201
|
+
*/
|
|
202
|
+
function exactGate(docs, want) {
|
|
203
|
+
const has = (doc, event, command) => {
|
|
204
|
+
const groups = doc?.hooks?.[event];
|
|
205
|
+
if (!Array.isArray(groups))
|
|
206
|
+
return false;
|
|
207
|
+
return groups.some((g) => {
|
|
208
|
+
if (!g || typeof g !== 'object')
|
|
209
|
+
return false;
|
|
210
|
+
const matcher = g.matcher;
|
|
211
|
+
if (event === 'PreToolUse' && matcher !== undefined && matcher !== '.*')
|
|
212
|
+
return false;
|
|
213
|
+
const hooks = g.hooks;
|
|
214
|
+
return Array.isArray(hooks) && hooks.some((h) => h && typeof h === 'object'
|
|
215
|
+
&& h.type === 'command' && h.command === command);
|
|
216
|
+
});
|
|
217
|
+
};
|
|
218
|
+
const parsed = docs.map((d) => ({ file: d.file, doc: parseJson(d.text) }));
|
|
219
|
+
const pre = parsed.find((d) => has(d.doc, 'PreToolUse', want.pre));
|
|
220
|
+
const stop = parsed.find((d) => has(d.doc, 'Stop', want.stop));
|
|
221
|
+
const missing = [...(pre ? [] : ['PreToolUse']), ...(stop ? [] : ['Stop'])];
|
|
222
|
+
if (missing.length > 0) {
|
|
223
|
+
return { ok: false, detail: `no ${missing.join(' or ')} hook in ${docs.map((d) => d.file).join(', ')} is the one this CLI writes (${missing.includes('PreToolUse') ? want.pre : want.stop})` };
|
|
224
|
+
}
|
|
225
|
+
return { ok: true, pkg: { root: null, version: null }, detail: `PreToolUse and Stop are the hooks this CLI writes (${pre.file})` };
|
|
226
|
+
}
|
|
227
|
+
/** @implements A-SPEC-774.32 — whether `pkg` lies inside `worktree`, where the engine could rewrite it. */
|
|
228
|
+
function packageInside(pkg, worktree) {
|
|
229
|
+
const real = (p) => { try {
|
|
230
|
+
return fs.realpathSync(p);
|
|
231
|
+
}
|
|
232
|
+
catch {
|
|
233
|
+
return path.resolve(p);
|
|
234
|
+
} };
|
|
235
|
+
const rel = path.relative(real(worktree), real(pkg));
|
|
236
|
+
return rel === '' || (!rel.startsWith('..') && !path.isAbsolute(rel));
|
|
237
|
+
}
|
|
238
|
+
/** Whether a Codex user config marks one of `dirs` trusted. */
|
|
239
|
+
function codexTrusts(configText, dirs) {
|
|
240
|
+
if (configText === null)
|
|
241
|
+
return false;
|
|
242
|
+
const { parseCodexConfig } = require('./codex-toml');
|
|
243
|
+
const parsed = parseCodexConfig(configText);
|
|
244
|
+
if (!parsed.ok)
|
|
245
|
+
return false;
|
|
246
|
+
const projects = parsed.doc.projects;
|
|
247
|
+
if (!projects || typeof projects !== 'object')
|
|
248
|
+
return false;
|
|
249
|
+
const wanted = new Set();
|
|
250
|
+
for (const d of dirs) {
|
|
251
|
+
wanted.add(path.resolve(d));
|
|
252
|
+
try {
|
|
253
|
+
wanted.add(fs.realpathSync(d));
|
|
254
|
+
}
|
|
255
|
+
catch { /* the path itself */ }
|
|
256
|
+
}
|
|
257
|
+
for (const [key, value] of Object.entries(projects)) {
|
|
258
|
+
const level = value?.trust_level;
|
|
259
|
+
if (level !== 'trusted')
|
|
260
|
+
continue;
|
|
261
|
+
if (wanted.has(path.resolve(key)))
|
|
262
|
+
return true;
|
|
263
|
+
try {
|
|
264
|
+
if (wanted.has(fs.realpathSync(key)))
|
|
265
|
+
return true;
|
|
266
|
+
}
|
|
267
|
+
catch { /* a stale key */ }
|
|
268
|
+
}
|
|
269
|
+
return false;
|
|
270
|
+
}
|
package/dist/holmes/cli/run.d.ts
CHANGED
|
@@ -23,6 +23,10 @@ export interface RunOptions {
|
|
|
23
23
|
/** @implements A-SPEC-102.10 — the review policy: a cap on failing review rounds (1–20), and strict review. */
|
|
24
24
|
reviewRounds?: string;
|
|
25
25
|
strictReview?: boolean;
|
|
26
|
+
/** @implements A-SPEC-102.12 — the task's base, an ancestor of the worktree HEAD, that every review gate of the run judges from. */
|
|
27
|
+
reviewBase?: string;
|
|
28
|
+
/** @implements A-SPEC-774.52 — the starter's opt-in to an open network for an engine whose own sandbox is turned off. */
|
|
29
|
+
openNetwork?: boolean;
|
|
26
30
|
}
|
|
27
31
|
export interface RunDeps {
|
|
28
32
|
home?: string;
|
|
@@ -33,6 +37,12 @@ export interface RunDeps {
|
|
|
33
37
|
cliVersion?: string;
|
|
34
38
|
cliBuild?: string | null;
|
|
35
39
|
codexConfigPath?: string;
|
|
40
|
+
/** @implements A-SPEC-774.30 — the package run start provisions from and pins; this CLI's own unless a test injects one. */
|
|
41
|
+
packageRoot?: string;
|
|
42
|
+
/** @implements A-SPEC-774.37 — a test seam between the worktree check and provisioning, where a racing swap lands. */
|
|
43
|
+
beforeProvision?: () => void;
|
|
44
|
+
/** @implements A-SPEC-774.54 — how long run stop waits for a live run exec of the run (10 s unless a test shortens it). */
|
|
45
|
+
execWaitMs?: number;
|
|
36
46
|
}
|
|
37
47
|
/** @implements A-SPEC-780 — `hook_build`: the dist build id of the package the hook command runs from. */
|
|
38
48
|
export interface RunVersions {
|
|
@@ -42,6 +52,12 @@ export interface RunVersions {
|
|
|
42
52
|
hook: string | null;
|
|
43
53
|
hook_build: string | null;
|
|
44
54
|
}
|
|
55
|
+
/**
|
|
56
|
+
* @implements A-SPEC-102.14 — the environment of run start's git calls: no inherited `GIT_DIR`, `GIT_WORK_TREE`,
|
|
57
|
+
* `GIT_INDEX_FILE` or `GIT_COMMON_DIR` (each points git at another repository), and no replace objects (a
|
|
58
|
+
* `git replace --graft` fakes ancestry) — review L1, L3.
|
|
59
|
+
*/
|
|
60
|
+
export declare function runGitEnv(env?: NodeJS.ProcessEnv): NodeJS.ProcessEnv;
|
|
45
61
|
/** @implements A-SPEC-774.18 — the versions that would govern this run. Unknown is null, never a guess. */
|
|
46
62
|
export declare function runVersions(worktree: string, engine: Engine, deps: RunDeps): RunVersions;
|
|
47
63
|
/** @implements A-SPEC-774.24 — the version fields, in the order a refusal names them. */
|
|
@@ -66,5 +82,10 @@ type Io = {
|
|
|
66
82
|
stdout: (t: string) => void;
|
|
67
83
|
stderr: (t: string) => void;
|
|
68
84
|
};
|
|
85
|
+
/**
|
|
86
|
+
* @implements A-SPEC-774.48 — under run exec the engine's own sandbox is off: run exec is the sandbox, and a nested
|
|
87
|
+
* sandbox-exec cannot apply inside it (measured). Holmes owns these arguments; they go into sandboxed_command only.
|
|
88
|
+
*/
|
|
89
|
+
export declare const ENGINE_SANDBOX_OFF: Record<Engine, string[]>;
|
|
69
90
|
export declare function runRun(sub: string | undefined, opts: RunOptions, io: Io, deps?: RunDeps): number;
|
|
70
91
|
export {};
|