@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
|
@@ -33,8 +33,9 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
33
33
|
};
|
|
34
34
|
})();
|
|
35
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.workingTreeChanges = workingTreeChanges;
|
|
36
37
|
exports.createMaintenanceAnalysisHandlers = createMaintenanceAnalysisHandlers;
|
|
37
|
-
// @implements A-SPEC-476.1, A-SPEC-745, A-SPEC-469.1,A-SPEC-469.2, A-SPEC-741, A-SPEC-741.1, A-SPEC-612, A-SPEC-100.2, A-SPEC-128, A-SPEC-189, A-SPEC-267, A-SPEC-268, A-SPEC-269, A-SPEC-277, A-SPEC-283, A-SPEC-290, A-SPEC-292, A-SPEC-293, A-SPEC-378, A-SPEC-388, A-SPEC-418, A-SPEC-478, A-SPEC-571.2, A-SPEC-573.4, A-SPEC-578.5, A-SPEC-734, A-SPEC-278.3
|
|
38
|
+
// @implements A-SPEC-476.1, A-SPEC-745, A-SPEC-469.1,A-SPEC-469.2, A-SPEC-741, A-SPEC-741.1, A-SPEC-612, A-SPEC-100.2, A-SPEC-128, A-SPEC-189, A-SPEC-267, A-SPEC-268, A-SPEC-269, A-SPEC-277, A-SPEC-283, A-SPEC-290, A-SPEC-292, A-SPEC-293, A-SPEC-378, A-SPEC-388, A-SPEC-418, A-SPEC-478, A-SPEC-571.2, A-SPEC-573.4, A-SPEC-578.5, A-SPEC-734, A-SPEC-278.3, A-SPEC-293.1, A-SPEC-333.8, A-SPEC-333.9
|
|
38
39
|
const fs = __importStar(require("node:fs"));
|
|
39
40
|
const path = __importStar(require("node:path"));
|
|
40
41
|
const node_child_process_1 = require("node:child_process");
|
|
@@ -60,6 +61,47 @@ const maintenance_analyze_1 = require("../maintenance-analyze");
|
|
|
60
61
|
const maintenance_evidence_1 = require("../maintenance-evidence");
|
|
61
62
|
const defuse_bound_1 = require("../defuse-bound");
|
|
62
63
|
const bounded_io_1 = require("../../project/bounded-io");
|
|
64
|
+
/** At most this many paths from the working tree's own diff (A-SPEC-293.1). */
|
|
65
|
+
const ARCHITECTURE_BASIS_MAX = 2000;
|
|
66
|
+
/** The two git children together finish within this (A-SPEC-333.8). */
|
|
67
|
+
const ARCHITECTURE_BASIS_DEADLINE_MS = 5000;
|
|
68
|
+
/**
|
|
69
|
+
* @implements A-SPEC-293.1 — the working tree's changes against HEAD, tracked and untracked, bounded; undefined when there
|
|
70
|
+
* are none or git cannot say (the caller then keeps the axis disclosed as not assessed).
|
|
71
|
+
* @implements A-SPEC-333.8 — both lists are relative to the analysed root (`--relative`, as `ls-files` already is), so a
|
|
72
|
+
* change elsewhere in the repository is not this analysis's; both children run inert under one deadline; governing
|
|
73
|
+
* documents are taken first, and a cut list says so.
|
|
74
|
+
* @implements A-SPEC-333.9 — a timeout here is the analysis's own deadline, not the root's slowness: it is not recorded,
|
|
75
|
+
* so it blocks no later git call for this root.
|
|
76
|
+
*/
|
|
77
|
+
function workingTreeChanges(root, deadlineMs = ARCHITECTURE_BASIS_DEADLINE_MS) {
|
|
78
|
+
const started = Date.now();
|
|
79
|
+
const run = (args) => {
|
|
80
|
+
const left = deadlineMs - (Date.now() - started);
|
|
81
|
+
if (left <= 0)
|
|
82
|
+
return undefined;
|
|
83
|
+
const r = (0, bounded_io_1.gitOnce)(root, args, 'worktree', { timeout: left, env: (0, bounded_io_1.inertGitConfig)((0, root_1.cleanSubprocessEnv)()), record: false });
|
|
84
|
+
return r.status === 0 && !r.error ? r.stdout : undefined;
|
|
85
|
+
};
|
|
86
|
+
const tracked = run(['diff', '--name-only', '-z', '--relative', 'HEAD']);
|
|
87
|
+
const untracked = tracked === undefined ? undefined : run(['ls-files', '--others', '--exclude-standard', '-z']);
|
|
88
|
+
if (tracked === undefined || untracked === undefined)
|
|
89
|
+
return undefined;
|
|
90
|
+
const all = new Set();
|
|
91
|
+
for (const f of `${tracked}\0${untracked}`.split('\0')) {
|
|
92
|
+
// the governance store's runtime state (evidence, ledgers, caches) is not a change: an analysis persisted a moment
|
|
93
|
+
// ago must not change the next one. Its documents (.ax/decisions, .ax/specs) are kept: they are the axis.
|
|
94
|
+
if (f === '' || (f.startsWith('.ax/') && !f.startsWith('.ax/decisions/') && !f.startsWith('.ax/specs/')))
|
|
95
|
+
continue;
|
|
96
|
+
all.add(f);
|
|
97
|
+
}
|
|
98
|
+
if (all.size === 0)
|
|
99
|
+
return undefined;
|
|
100
|
+
const governing = (0, test_scope_1.architectureGoverningFiles)([...all]);
|
|
101
|
+
const rest = [...all].filter((f) => !governing.includes(f));
|
|
102
|
+
const files = [...governing, ...rest].slice(0, ARCHITECTURE_BASIS_MAX);
|
|
103
|
+
return { files, truncated: all.size > files.length };
|
|
104
|
+
}
|
|
63
105
|
/** @implements A-SPEC-759 — at most this many changed files have their HEAD text read for the missing-new-file finding. */
|
|
64
106
|
const MISSING_NEW_FILES_PRIOR_READS = 50;
|
|
65
107
|
function createMaintenanceAnalysisHandlers(context) {
|
|
@@ -82,6 +124,11 @@ function createMaintenanceAnalysisHandlers(context) {
|
|
|
82
124
|
head = (0, node_child_process_1.execFileSync)('git', ['-C', root, 'rev-parse', 'HEAD'], { maxBuffer: bounded_io_1.GIT_MAX_BUFFER, timeout: 5000, encoding: 'utf8', env: (0, root_1.cleanSubprocessEnv)(), stdio: ['ignore', 'pipe', 'pipe'] }).trim();
|
|
83
125
|
}
|
|
84
126
|
catch { /* non-git */ }
|
|
127
|
+
// @implements A-SPEC-293.1 — no list from the caller: the working tree's own diff assesses the architecture axis
|
|
128
|
+
// (and nothing else). A clean or non-git tree passes nothing, so the axis stays disclosed as not assessed.
|
|
129
|
+
const basis = a.changedFiles === undefined && head !== '' ? workingTreeChanges(root) : undefined;
|
|
130
|
+
const architectureBasis = basis?.files;
|
|
131
|
+
const changedFilesSource = a.changedFiles !== undefined ? 'caller' : architectureBasis ? 'git-diff-default' : 'none';
|
|
85
132
|
const unsupportedLanguages = new Set();
|
|
86
133
|
// @implements A-SPEC-741 — the paths too, so the analysis can tell an unreadable file that may
|
|
87
134
|
// be this request's target from one that is unrelated. Bounded: a vendored tree must not grow it.
|
|
@@ -124,6 +171,7 @@ function createMaintenanceAnalysisHandlers(context) {
|
|
|
124
171
|
specFingerprint: `count:${specs.length}/fp:${detail.specs ?? 'unknown'}`,
|
|
125
172
|
},
|
|
126
173
|
changedFiles: a.changedFiles,
|
|
174
|
+
...(architectureBasis ? { architectureBasis } : {}),
|
|
127
175
|
// @implements A-SPEC-290 — the stored run record. Freshness is judged inside the analysis
|
|
128
176
|
// against its own basis, so a record from another commit is reported as stale rather than
|
|
129
177
|
// quietly used.
|
|
@@ -346,6 +394,14 @@ function createMaintenanceAnalysisHandlers(context) {
|
|
|
346
394
|
const blind = context.specStoreBlindReason(root, specs.length);
|
|
347
395
|
if (blind !== null)
|
|
348
396
|
result.unknowns = [blind, ...result.unknowns];
|
|
397
|
+
result.changedFilesSource = changedFilesSource;
|
|
398
|
+
// @implements A-SPEC-333.8 — what the default basis is, and is not, said where the answer is read
|
|
399
|
+
if (basis) {
|
|
400
|
+
result.unknowns = [...result.unknowns,
|
|
401
|
+
"The architecture axis was assessed from the working tree's diff against HEAD under this root; it holds no file the request has yet to change, so pass changedFiles to assess those."];
|
|
402
|
+
if (basis.truncated)
|
|
403
|
+
result.unknowns.push(`The architecture basis was cut at ${ARCHITECTURE_BASIS_MAX} working-tree files (decision and C-SPEC documents first); files past the cut were not assessed.`);
|
|
404
|
+
}
|
|
349
405
|
if (a.persist) {
|
|
350
406
|
// @implements A-SPEC-277 — record WHAT WAS ANALYSED, not just which paths. HEAD cannot see
|
|
351
407
|
// an uncommitted edit to the analysed file; a content digest can.
|
|
@@ -360,7 +416,8 @@ function createMaintenanceAnalysisHandlers(context) {
|
|
|
360
416
|
// product actually predicted.
|
|
361
417
|
result.persistedTo = (0, maintenance_evidence_1.writeArtifact)(path.join(root, maintenance_evidence_1.EVIDENCE_DIR), (0, maintenance_evidence_1.artifactFrom)(analysis, new Date().toISOString(), fileDigests,
|
|
362
418
|
// @implements A-SPEC-278.3 — the request and the caller's changed files travel with the prediction.
|
|
363
|
-
|
|
419
|
+
// A-SPEC-293.1 — the default diff is never recorded as the caller's list (the gate reads that as "named")
|
|
420
|
+
{ request: a.request, changedFiles: a.changedFiles, changedFilesSource }));
|
|
364
421
|
}
|
|
365
422
|
// @implements A-SPEC-578.5 — the response, and only the response, is bounded. Measured
|
|
366
423
|
// 2026-09-09: the full shape is 187,174 characters (~47k tokens) and the harness refuses
|
|
@@ -6,9 +6,13 @@ import type { ApprovalStatus } from '../../spec/approval-status';
|
|
|
6
6
|
export interface ApprovalRequestState {
|
|
7
7
|
id: string;
|
|
8
8
|
/** @implements A-SPEC-779.3 — `withdrawn`: the run that filed it closed it; no operator decided it. */
|
|
9
|
-
|
|
9
|
+
/** @implements A-SPEC-794.33 — `unusable`: granted, unspent and unexpired, but no grant file is left to cover the act. */
|
|
10
|
+
/** @implements A-SPEC-794.35 — `claimed`: an act holds the grant now. */
|
|
11
|
+
state: 'pending' | 'held' | 'granted' | 'unusable' | 'claimed' | 'expired' | 'consumed' | 'denied' | 'revoked' | 'withdrawn';
|
|
10
12
|
question?: string;
|
|
11
13
|
reason?: string;
|
|
14
|
+
/** @implements A-SPEC-245.9 (1b-6) — for a live grant: "single use, until <time>" or "single use, no time limit". */
|
|
15
|
+
validity?: string;
|
|
12
16
|
ts?: string;
|
|
13
17
|
}
|
|
14
18
|
/**
|
|
@@ -106,7 +110,7 @@ export declare function createOperatorInspectionHandlers(context: OperatorInspec
|
|
|
106
110
|
blockers: string[];
|
|
107
111
|
resealBlockers: string[];
|
|
108
112
|
ok: boolean;
|
|
109
|
-
reason?: undefined;
|
|
113
|
+
readonly reason?: undefined;
|
|
110
114
|
}>;
|
|
111
115
|
/**
|
|
112
116
|
* @implements A-SPEC-538.3
|
|
@@ -126,7 +130,7 @@ export declare function createOperatorInspectionHandlers(context: OperatorInspec
|
|
|
126
130
|
} | {
|
|
127
131
|
ok: boolean;
|
|
128
132
|
events: import("../../governance/ledger-timeline").TimelineEntry[];
|
|
129
|
-
reason?: undefined;
|
|
133
|
+
readonly reason?: undefined;
|
|
130
134
|
}>;
|
|
131
135
|
/**
|
|
132
136
|
* @implements A-SPEC-642
|
|
@@ -179,7 +183,7 @@ export declare function createOperatorInspectionHandlers(context: OperatorInspec
|
|
|
179
183
|
ts: string;
|
|
180
184
|
}[];
|
|
181
185
|
remaining: string[];
|
|
182
|
-
reason?: undefined;
|
|
186
|
+
readonly reason?: undefined;
|
|
183
187
|
pending?: undefined;
|
|
184
188
|
code?: undefined;
|
|
185
189
|
}>;
|
|
@@ -217,6 +221,6 @@ export declare function createOperatorInspectionHandlers(context: OperatorInspec
|
|
|
217
221
|
retiredCount: number;
|
|
218
222
|
findingsScanned: boolean;
|
|
219
223
|
};
|
|
220
|
-
reason?: undefined;
|
|
224
|
+
readonly reason?: undefined;
|
|
221
225
|
}>;
|
|
222
226
|
};
|
|
@@ -36,8 +36,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
36
36
|
exports.approvalRequestOf = approvalRequestOf;
|
|
37
37
|
exports.nextActionOf = nextActionOf;
|
|
38
38
|
exports.createOperatorInspectionHandlers = createOperatorInspectionHandlers;
|
|
39
|
-
// @implements A-SPEC-605, A-SPEC-605.1, A-SPEC-779.3
|
|
40
|
-
// @implements A-SPEC-642
|
|
39
|
+
// @implements A-SPEC-605, A-SPEC-605.1, A-SPEC-779.3, A-SPEC-245.17, A-SPEC-794.33, A-SPEC-794.34, A-SPEC-794.35, A-SPEC-794.37, A-SPEC-794.40, A-SPEC-794.41, A-SPEC-794.42, A-SPEC-794.44
|
|
40
|
+
// @implements A-SPEC-642, A-SPEC-245.9, A-SPEC-245.15
|
|
41
41
|
// @implements A-SPEC-631
|
|
42
42
|
// @implements A-SPEC-768
|
|
43
43
|
const fs = __importStar(require("node:fs"));
|
|
@@ -49,6 +49,7 @@ const ledger_timeline_1 = require("../../governance/ledger-timeline");
|
|
|
49
49
|
const provenance_ledger_1 = require("../../governance/provenance-ledger");
|
|
50
50
|
const provenance_chain_1 = require("../../governance/provenance-chain");
|
|
51
51
|
const approval_grants_1 = require("../../governance/approval-grants");
|
|
52
|
+
const approve_1 = require("../../cli/approve");
|
|
52
53
|
const approval_queue_1 = require("../../governance/approval-queue");
|
|
53
54
|
/**
|
|
54
55
|
* @implements A-SPEC-768
|
|
@@ -72,8 +73,26 @@ function approvalRequestOf(root, specId) {
|
|
|
72
73
|
const d = q.decisions[id];
|
|
73
74
|
if (!d)
|
|
74
75
|
return undefined;
|
|
75
|
-
|
|
76
|
-
|
|
76
|
+
// @implements A-SPEC-245.9 (1b-6) — a live grant is reported with its use count and expiry
|
|
77
|
+
if (d.event === 'granted') {
|
|
78
|
+
// @implements A-SPEC-794.35 — one judgement with --status and --list: what `resolveApproval` says of the act now
|
|
79
|
+
// (A-M2: an expired, other-target or other-workspace file read `granted` here while it covered nothing)
|
|
80
|
+
// @implements A-SPEC-245.17 (item 4) — a grant past its expiry (or with an empty one) is expired, not granted
|
|
81
|
+
// @implements A-SPEC-245.18 (5c) — an expiry that is not a date is expired too: `grantedStateOf`, the one order (794.37)
|
|
82
|
+
const grant = (0, approval_grants_1.requestGrantState)(root, id, { kind: 'spec-approve', target: specId }, new Date().toISOString());
|
|
83
|
+
const state = (0, approval_grants_1.grantedStateOf)({ covers: grant.state === 'covers', claimed: grant.state === 'claimed', ...(d.consumedTs ? { consumedTs: d.consumedTs } : {}), ...(d.expires !== undefined ? { expires: d.expires } : {}) }, Date.now());
|
|
84
|
+
if (state === 'live')
|
|
85
|
+
return { id, state: 'granted', validity: (0, approve_1.grantValidityText)(d.expires), ts: d.ts };
|
|
86
|
+
if (state === 'claimed')
|
|
87
|
+
return { id, state: 'claimed', ts: d.ts };
|
|
88
|
+
if (state === 'consumed')
|
|
89
|
+
return { id, state: 'consumed', ts: d.consumedTs };
|
|
90
|
+
if (state === 'expired')
|
|
91
|
+
return { id, state: 'expired', ts: d.expires || d.ts };
|
|
92
|
+
// @implements A-SPEC-794.33, A-SPEC-794.34 — a granted row no grant covers is unusable: "call spec_approve now" sent
|
|
93
|
+
// the agent into a refusal (a removed file, a dangling link, a file that does not parse)
|
|
94
|
+
return { id, state: 'unusable', ts: d.ts, ...(grant.state === 'none' && grant.staleClaim ? { reason: 'a process that ended left its claim on this grant; holmes-kit doctor names it' } : {}) };
|
|
95
|
+
}
|
|
77
96
|
return { id, state: d.event, ...(d.reason ? { reason: d.reason } : {}), ts: d.ts };
|
|
78
97
|
}
|
|
79
98
|
catch {
|
|
@@ -93,8 +112,13 @@ function nextActionOf(described, request) {
|
|
|
93
112
|
case 'denied': return `denied — ${request.reason ?? 'no reason recorded'}. Do not re-request the same act; report it to the user.`;
|
|
94
113
|
case 'revoked': return `revoked — ${request.reason ?? 'no reason recorded'}. Do not re-request the same act; report it to the user.`;
|
|
95
114
|
// @implements A-SPEC-779.3
|
|
96
|
-
case 'withdrawn': return `withdrawn by
|
|
97
|
-
case 'granted': return
|
|
115
|
+
case 'withdrawn': return `withdrawn by whoever filed it, a run or a session's MCP server — ${request.reason ?? 'no reason recorded'}. If the seal is still needed, spec_approve files a new request.`;
|
|
116
|
+
case 'granted': return `granted (${request.validity ?? 'single use'}) — call spec_approve now; the grant seals it once.`;
|
|
117
|
+
// @implements A-SPEC-794.33
|
|
118
|
+
case 'unusable': return `granted, but the grant covers nothing now (${request.reason ?? 'its file is missing, unreadable, expired or bound elsewhere'}) — call spec_approve to file a new request and wait for the decision.`;
|
|
119
|
+
// @implements A-SPEC-794.35
|
|
120
|
+
case 'claimed': return 'granted, and an act holds the grant now — do not call spec_approve again; call approval_status after that act ends.';
|
|
121
|
+
case 'expired': return `expired — the grant ended unused (${request.ts ?? 'no time recorded'}); it covers nothing. Call spec_approve to file a new request and wait for the decision.`;
|
|
98
122
|
case 'consumed': return 'the grant was consumed but this spec is not sealed — call spec_approve again, and report its refusal to the user if it refuses.';
|
|
99
123
|
case 'pending': return "pending the operator's decision — wait, then call approval_status again; when sealed is true, retry spec_approve immediately.";
|
|
100
124
|
default: break;
|
|
@@ -115,6 +139,9 @@ function createOperatorInspectionHandlers(context) {
|
|
|
115
139
|
*/
|
|
116
140
|
async approval_status(a) {
|
|
117
141
|
context.assertStoreReachable('approval_status', a.root); // @implements A-SPEC-419
|
|
142
|
+
// @implements A-SPEC-794.41 — a request id is the wrong key, and "not found" read as "no such request" (D11)
|
|
143
|
+
if (/^req-/.test(a.id))
|
|
144
|
+
return { ok: false, reason: `${a.id} is a request id: approval_status takes a spec id (a request a session's MCP server filed for a spec shows under approval_status <spec id>) and cannot see a request a hook filed — for one a refusal named, call approval_ask with its id` }; // A-SPEC-794.44 — no typed command (A-SPEC-792.1)
|
|
118
145
|
const all = await context.listSpecs();
|
|
119
146
|
if (all.filter((s) => s.id === a.id).length > 1) {
|
|
120
147
|
return {
|
|
@@ -361,7 +388,11 @@ function createOperatorInspectionHandlers(context) {
|
|
|
361
388
|
const dir = path.join(dest.root, '.ax', 'ledger');
|
|
362
389
|
const store = new ledger_store_1.FileLedgerStore(dir);
|
|
363
390
|
const pending = store.doubleSpends();
|
|
364
|
-
|
|
391
|
+
// @implements A-SPEC-245.17 (6a) — every pending entry of the nonce (a double spend and the revocation it overran)
|
|
392
|
+
// is closed by one row naming all their events, so one reconcile (one approval) settles the nonce
|
|
393
|
+
const entries = pending.filter((d) => d.nonce === nonce);
|
|
394
|
+
const match = entries.length === 0 ? undefined
|
|
395
|
+
: { ...entries[0], events: [...new Map(entries.flatMap((d) => d.events).map((e) => [`${e.replicaId ?? ''}\0${e.hash}`, e])).values()] };
|
|
365
396
|
if (!match) {
|
|
366
397
|
return { ok: true, reconciled: false, nonce, pending: pending.map((d) => d.nonce),
|
|
367
398
|
reason: pending.length === 0 ? 'the merged ledger holds no unreconciled double-spend' : `${nonce} is not an unreconciled double-spend; pending: ${pending.map((d) => d.nonce).join(', ')}` };
|
|
@@ -385,15 +416,47 @@ function createOperatorInspectionHandlers(context) {
|
|
|
385
416
|
if (chainBreaks.length > 0) {
|
|
386
417
|
return { ok: false, code: 'audit-conflict', reason: 'ledger_reconcile cannot extend a broken chain: ' + chainBreaks.map((b) => `${b.replicaId ?? 'legacy'}: ${b.detail ?? 'broken'}`).join('; ') };
|
|
387
418
|
}
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
419
|
+
// @implements A-SPEC-245.3 — the grant is claimed for the append it authorizes and committed after it
|
|
420
|
+
const claim = resolved.source === 'grant' && resolved.approval.nonce ? (0, approval_grants_1.claimGrant)(resolved.root ?? dest.root, String(resolved.approval.nonce)) : undefined;
|
|
421
|
+
if (claim === null)
|
|
422
|
+
return { ok: false, code: 'grant-in-use', reason: `the approval grant for reconciling ${nonce} is in use by another act — nothing was appended; retry, or ask for a new approval` };
|
|
423
|
+
let spent = false;
|
|
424
|
+
try {
|
|
425
|
+
// @implements A-SPEC-245.9 (1b-1), N9 — the grant's spend row, once across replicas, then the reconcile row
|
|
426
|
+
if (claim) {
|
|
427
|
+
(0, approval_grants_1.spendGrantApprovals)(resolved.root ?? dest.root, [resolved.approval], `ledger-reconcile ${nonce}`);
|
|
428
|
+
spent = true;
|
|
429
|
+
}
|
|
430
|
+
store.append({
|
|
431
|
+
ts: now, actor: resolved.approval.actor, kind: provenance_ledger_1.DOUBLE_SPEND_RECONCILED,
|
|
432
|
+
summary: `reconciled cross-replica double-spend of ${nonce}: ${match.events.length} consumptions on ${replicas.join(', ')}`.slice(0, 200),
|
|
433
|
+
inputs: [nonce, ...match.events.map((e) => 'event:' + e.hash), ...replicas.map((r) => 'replica:' + r)],
|
|
434
|
+
rationale: typeof a.rationale === 'string' && a.rationale.trim() !== '' ? a.rationale.trim() : resolved.approval.rationale,
|
|
435
|
+
authorization: (0, provenance_chain_1.authorizationRef)(resolved.approval.actor, resolved.approval.token),
|
|
436
|
+
});
|
|
437
|
+
}
|
|
438
|
+
catch (e) {
|
|
439
|
+
// @implements A-SPEC-245.15 (item 2) — a failed append after the spend commits the claim: the grant is used
|
|
440
|
+
if (spent) {
|
|
441
|
+
try {
|
|
442
|
+
claim?.commit();
|
|
443
|
+
}
|
|
444
|
+
catch (c) {
|
|
445
|
+
process.stderr.write(`[Holmes-Kit] ${c.message}\n`);
|
|
446
|
+
}
|
|
447
|
+
}
|
|
448
|
+
else
|
|
449
|
+
claim?.release();
|
|
450
|
+
if (e instanceof approval_grants_1.GrantSpendRefusal)
|
|
451
|
+
return { ok: false, code: 'grant-spend-refused', reason: `${nonce} was not reconciled: ${e.message}` };
|
|
452
|
+
throw e;
|
|
453
|
+
}
|
|
454
|
+
try {
|
|
455
|
+
claim?.commit();
|
|
456
|
+
}
|
|
457
|
+
catch (e) {
|
|
458
|
+
process.stderr.write(`[Holmes-Kit] ${e.message}\n`);
|
|
459
|
+
}
|
|
397
460
|
return { ok: true, reconciled: true, nonce, events: match.events, remaining: store.doubleSpends().map((d) => d.nonce) };
|
|
398
461
|
},
|
|
399
462
|
// @implements A-SPEC-545.3 — "show me the RTM dashboard" launches (idempotently) the server the
|
|
@@ -45,7 +45,7 @@ export declare function createRequirementTriageHandlers(context: RequirementTria
|
|
|
45
45
|
suppressed?: true | undefined;
|
|
46
46
|
availability: string;
|
|
47
47
|
missingLineages?: string[] | undefined;
|
|
48
|
-
tier: "
|
|
48
|
+
tier: "none" | "local" | "cloud";
|
|
49
49
|
covered: number;
|
|
50
50
|
total: number;
|
|
51
51
|
unlineaged: number;
|
|
@@ -105,7 +105,7 @@ export declare function createRequirementTriageHandlers(context: RequirementTria
|
|
|
105
105
|
suppressed?: true | undefined;
|
|
106
106
|
availability: string;
|
|
107
107
|
missingLineages?: string[] | undefined;
|
|
108
|
-
tier: "
|
|
108
|
+
tier: "none" | "local" | "cloud";
|
|
109
109
|
covered: number;
|
|
110
110
|
total: number;
|
|
111
111
|
unlineaged: number;
|
|
@@ -187,7 +187,7 @@ export declare function createRequirementTriageHandlers(context: RequirementTria
|
|
|
187
187
|
suppressed?: true | undefined;
|
|
188
188
|
availability: string;
|
|
189
189
|
missingLineages?: string[] | undefined;
|
|
190
|
-
tier: "
|
|
190
|
+
tier: "none" | "local" | "cloud";
|
|
191
191
|
covered: number;
|
|
192
192
|
total: number;
|
|
193
193
|
unlineaged: number;
|
|
@@ -253,7 +253,7 @@ export declare function createRequirementTriageHandlers(context: RequirementTria
|
|
|
253
253
|
suppressed?: true | undefined;
|
|
254
254
|
availability: string;
|
|
255
255
|
missingLineages?: string[] | undefined;
|
|
256
|
-
tier: "
|
|
256
|
+
tier: "none" | "local" | "cloud";
|
|
257
257
|
covered: number;
|
|
258
258
|
total: number;
|
|
259
259
|
unlineaged: number;
|
|
@@ -68,7 +68,7 @@ export declare function createReviewEvidenceHandlers(context: ReviewEvidenceCont
|
|
|
68
68
|
};
|
|
69
69
|
reviewNeeded: ReviewNeeded[];
|
|
70
70
|
ok?: undefined;
|
|
71
|
-
reason?: undefined;
|
|
71
|
+
readonly reason?: undefined;
|
|
72
72
|
} | {
|
|
73
73
|
reviewNeeded: Array<{
|
|
74
74
|
spec: string;
|
|
@@ -85,6 +85,6 @@ export declare function createReviewEvidenceHandlers(context: ReviewEvidenceCont
|
|
|
85
85
|
minor: number;
|
|
86
86
|
};
|
|
87
87
|
ok?: undefined;
|
|
88
|
-
reason?: undefined;
|
|
88
|
+
readonly reason?: undefined;
|
|
89
89
|
}>;
|
|
90
90
|
};
|
|
@@ -35,13 +35,14 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
35
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
36
|
exports.summarizeReviewNeeded = summarizeReviewNeeded;
|
|
37
37
|
exports.createReviewEvidenceHandlers = createReviewEvidenceHandlers;
|
|
38
|
-
// @implements A-SPEC-718.1, A-SPEC-718.2, A-SPEC-718, A-SPEC-746, A-SPEC-617, A-SPEC-100.2, A-SPEC-102.1, A-SPEC-133, A-SPEC-135, A-SPEC-141, A-SPEC-157, A-SPEC-160, A-SPEC-189, A-SPEC-191, A-SPEC-244, A-SPEC-245, A-SPEC-263.1, A-SPEC-497.1, A-SPEC-732
|
|
38
|
+
// @implements A-SPEC-718.1, A-SPEC-718.2, A-SPEC-718, A-SPEC-746, A-SPEC-617, A-SPEC-100.2, A-SPEC-102.1, A-SPEC-133, A-SPEC-135, A-SPEC-141, A-SPEC-157, A-SPEC-160, A-SPEC-189, A-SPEC-191, A-SPEC-244, A-SPEC-245, A-SPEC-263.1, A-SPEC-497.1, A-SPEC-732, A-SPEC-245.9
|
|
39
39
|
const path = __importStar(require("node:path"));
|
|
40
40
|
const findings_1 = require("../../review/findings");
|
|
41
41
|
const review_targets_1 = require("../../review/review-targets");
|
|
42
42
|
const elicit_approval_1 = require("../elicit-approval");
|
|
43
43
|
const basis_1 = require("../basis");
|
|
44
44
|
const ledger_store_1 = require("../../governance/ledger-store");
|
|
45
|
+
const approval_spend_1 = require("../../governance/approval-spend");
|
|
45
46
|
const ledger_lock_1 = require("../../governance/ledger-lock");
|
|
46
47
|
const approval_grants_1 = require("../../governance/approval-grants");
|
|
47
48
|
const provenance_chain_1 = require("../../governance/provenance-chain");
|
|
@@ -255,7 +256,7 @@ function createReviewEvidenceHandlers(context) {
|
|
|
255
256
|
// harm class the env nonce fixed in its round-4; collected now, spent only once the
|
|
256
257
|
// whole batch has validated (directly before the append, like the nonce block).
|
|
257
258
|
if (rrResolved.source === 'grant' && rrResolved.root && rrResolved.approval.nonce) {
|
|
258
|
-
grantConsumptions.push({ root: rrResolved.root, nonce: rrResolved.approval.nonce });
|
|
259
|
+
grantConsumptions.push({ root: rrResolved.root, nonce: rrResolved.approval.nonce, approval: rrResolved.approval });
|
|
259
260
|
}
|
|
260
261
|
liftedCriticals.push(f.id);
|
|
261
262
|
// The nonce block below enforces single-use on the ENV approval — so it must key on the
|
|
@@ -337,14 +338,22 @@ function createReviewEvidenceHandlers(context) {
|
|
|
337
338
|
if (ledgerFile === null) {
|
|
338
339
|
throw context.refusal('review_record: 단일 사용 승인(nonce)을 기록할 프로젝트 원장을 확정할 수 없습니다 — 1회성을 보장할 수 없어 거부합니다');
|
|
339
340
|
}
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
341
|
+
// @implements A-SPEC-245.9 (1b-1) — spent through spendApprovals under the workspace spend lock
|
|
342
|
+
let spent;
|
|
343
|
+
try {
|
|
344
|
+
spent = (0, approval_spend_1.spendApprovals)((0, approval_spend_1.projectRootOfChain)(ledgerFile), [{
|
|
345
|
+
nonce: String(approval.nonce), actor: approval.actor,
|
|
346
|
+
summary: `consumed single-use approval for: review-resolve ${envLiftedCriticals.join(', ')}`.slice(0, 200),
|
|
347
|
+
rationale: approval.rationale, authorization: (0, provenance_chain_1.authorizationRef)(approval.actor, approval.token),
|
|
348
|
+
}], {});
|
|
349
|
+
}
|
|
350
|
+
catch {
|
|
351
|
+
spent = 'error';
|
|
352
|
+
}
|
|
353
|
+
if (spent === 'error' || spent.ok === false) {
|
|
354
|
+
throw context.refusal(spent !== 'error' && spent.reason === 'spent'
|
|
355
|
+
? `review_record: 단일 사용 승인(nonce)이 이미 소비되었습니다 — 재사용은 거부됩니다. 새 승인을 발급받으십시오`
|
|
356
|
+
: `review_record: ${(0, approval_spend_1.spendRefusalReason)(spent)}`);
|
|
348
357
|
}
|
|
349
358
|
}
|
|
350
359
|
}
|
|
@@ -353,8 +362,23 @@ function createReviewEvidenceHandlers(context) {
|
|
|
353
362
|
// burned the grant with nothing recorded — the exact harm the round-2 deferral was written
|
|
354
363
|
// to fix, reintroduced through the env throw path). Only the append itself follows, and it
|
|
355
364
|
// fails loudly.
|
|
365
|
+
// @implements A-SPEC-245.9 (1b-1) — each grant's row once across replicas under the spend lock, then its file
|
|
366
|
+
// (one call per workspace root, so every grant of the batch is spent or none is)
|
|
367
|
+
const grantRoots = new Map();
|
|
368
|
+
for (const g of grantConsumptions)
|
|
369
|
+
grantRoots.set(g.root, [...(grantRoots.get(g.root) ?? []), g.approval]);
|
|
370
|
+
for (const [root, approvals] of grantRoots) {
|
|
371
|
+
try {
|
|
372
|
+
(0, approval_grants_1.spendGrantApprovals)(root, approvals, `review-resolve ${liftedCriticals.join(', ')}`);
|
|
373
|
+
}
|
|
374
|
+
catch (e) {
|
|
375
|
+
if (e instanceof approval_grants_1.GrantSpendRefusal)
|
|
376
|
+
throw context.refusal(`review_record: ${e.message}`);
|
|
377
|
+
throw e;
|
|
378
|
+
}
|
|
379
|
+
}
|
|
356
380
|
for (const g of grantConsumptions)
|
|
357
|
-
(0, approval_grants_1.
|
|
381
|
+
(0, approval_grants_1.spendGrants)(g.root, [g.nonce]); // A-SPEC-245.2
|
|
358
382
|
// @implements A-SPEC-157 — the server's OWN observation, not anything the caller sent.
|
|
359
383
|
// @implements A-SPEC-160 — the ONLY caller that reads the on-disk build, so the divergence
|
|
360
384
|
// marker can be sealed. Append INSIDE the same lock as the guard (round-6 TOCTOU).
|
|
@@ -60,6 +60,11 @@ export declare function createReviewQueryHandlers(context: ReviewQueryContext):
|
|
|
60
60
|
since?: string;
|
|
61
61
|
budget?: number;
|
|
62
62
|
}): Promise<{
|
|
63
|
+
testCountDiagnostics?: {
|
|
64
|
+
file: string;
|
|
65
|
+
aspecs: string[];
|
|
66
|
+
reason: string;
|
|
67
|
+
}[] | undefined;
|
|
63
68
|
scopeFallback?: "full" | undefined;
|
|
64
69
|
package: import("../../review/package").ReviewPackage;
|
|
65
70
|
unscannedChangedFiles: string[];
|
|
@@ -69,7 +69,14 @@ function createReviewQueryHandlers(context) {
|
|
|
69
69
|
// did NOT ingest, computed from the same changedFiles/scanned already
|
|
70
70
|
// derived above — no new git/scan calls.
|
|
71
71
|
const { unscanned: unscannedChangedFiles } = (0, coverage_1.partitionChangedFiles)(changedFiles, scanned.map((f) => f.sourcePath));
|
|
72
|
-
|
|
72
|
+
// @implements A-SPEC-750.2 — the anchored test files ART-4 reads as empty, and why
|
|
73
|
+
const testCountDiagnostics = (() => { try {
|
|
74
|
+
return (0, test_scope_1.zeroCountDiagnostics)(root);
|
|
75
|
+
}
|
|
76
|
+
catch {
|
|
77
|
+
return undefined;
|
|
78
|
+
} })();
|
|
79
|
+
return { package: pkg, unscannedChangedFiles, changeSource, ...(scopeFallback ? { scopeFallback } : {}), ...(testCountDiagnostics ? { testCountDiagnostics } : {}) };
|
|
73
80
|
}
|
|
74
81
|
finally {
|
|
75
82
|
g.close(); // release native SQLite handle even if assembly throws
|
|
@@ -6,7 +6,10 @@ export interface ReviewVerdictContext {
|
|
|
6
6
|
attestation: () => {
|
|
7
7
|
attested: boolean;
|
|
8
8
|
reason?: string;
|
|
9
|
+
harness?: string;
|
|
9
10
|
};
|
|
11
|
+
/** @implements A-SPEC-792.22 — the one form gate: a refusal reason, or null. */
|
|
12
|
+
formGate: () => string | null;
|
|
10
13
|
env: () => NodeJS.ProcessEnv;
|
|
11
14
|
}
|
|
12
15
|
export declare function createReviewVerdictHandlers(context: ReviewVerdictContext): {
|
|
@@ -11,6 +11,7 @@ exports.createReviewVerdictHandlers = createReviewVerdictHandlers;
|
|
|
11
11
|
const elicit_approval_1 = require("../elicit-approval");
|
|
12
12
|
const verdicts_1 = require("../../review/verdicts");
|
|
13
13
|
const approval_ask_1 = require("./approval-ask");
|
|
14
|
+
const human_channel_1 = require("../../governance/human-channel");
|
|
14
15
|
/** interpretElicitResult's reasons: a client's automatic decline and a question are not a verdict. */
|
|
15
16
|
const AUTOMATIC_DECLINE = 'the session client declined the approval form';
|
|
16
17
|
const QUESTION = '질문: ';
|
|
@@ -34,8 +35,14 @@ function createReviewVerdictHandlers(context) {
|
|
|
34
35
|
return refuse(`this session cannot show an approval form (${attestation.reason ?? 'not launched by a harness'})`);
|
|
35
36
|
if (!context.elicit)
|
|
36
37
|
return refuse('this session cannot show an approval form (the client did not advertise forms)');
|
|
37
|
-
|
|
38
|
-
|
|
38
|
+
// @implements A-SPEC-792.22 — the one form gate, and a name is not enough: the attested harness must be claude too
|
|
39
|
+
const gated = context.formGate();
|
|
40
|
+
if (gated !== null)
|
|
41
|
+
return refuse(gated);
|
|
42
|
+
const harness = attestation.harness;
|
|
43
|
+
if (!approval_ask_1.FORM_WAITS_FOR_PERSON.has(client) || (harness !== undefined && harness !== 'claude')) {
|
|
44
|
+
return refuse(`a review verdict in the form is not yet measured for ${client}${harness !== undefined ? ` (attested as ${harness})` : ''} (it might answer forms by itself)`);
|
|
45
|
+
}
|
|
39
46
|
const range = (0, verdicts_1.resolveRange)(root, a.base, a.head);
|
|
40
47
|
if ('error' in range)
|
|
41
48
|
return { ok: false, reason: range.error };
|
|
@@ -59,7 +66,7 @@ function createReviewVerdictHandlers(context) {
|
|
|
59
66
|
const r = (0, verdicts_1.recordVerdict)(root, {
|
|
60
67
|
base: range.base, head: range.head, verdict: granted ? 'pass' : 'fail',
|
|
61
68
|
findings: granted ? [] : [reason ?? 'failed in the session form'],
|
|
62
|
-
}, { env, cwd: root, interactive: false, answeredBy:
|
|
69
|
+
}, { env, cwd: root, interactive: false, answeredBy: (0, human_channel_1.humanChannelActor)('elicitation', harness ?? 'unattested') }); // @implements A-SPEC-792.25
|
|
63
70
|
if (!r.ok)
|
|
64
71
|
return { ok: false, reason: r.reason };
|
|
65
72
|
return { ok: true, decision: r.record.verdict, independent: r.record.independent, base: range.base, head: range.head };
|
|
@@ -9,7 +9,7 @@ export interface RiskAssessmentContext {
|
|
|
9
9
|
boundNonceLedger(): string | null;
|
|
10
10
|
}
|
|
11
11
|
export declare function createRiskAssessmentHandlers(context: RiskAssessmentContext): {
|
|
12
|
-
risk_check(
|
|
12
|
+
risk_check(raw: {
|
|
13
13
|
root?: string;
|
|
14
14
|
action: RiskAction;
|
|
15
15
|
approval?: Approval;
|
|
@@ -20,6 +20,11 @@ export declare function createRiskAssessmentHandlers(context: RiskAssessmentCont
|
|
|
20
20
|
rationale?: string;
|
|
21
21
|
}): Promise<{
|
|
22
22
|
assessment: import("../../guardrail/risk-types").RiskAssessment;
|
|
23
|
-
gate:
|
|
23
|
+
gate: {
|
|
24
|
+
blocked: boolean;
|
|
25
|
+
level: import("../../guardrail/risk-types").RiskLevel;
|
|
26
|
+
requiresApproval: boolean;
|
|
27
|
+
reasons: string[];
|
|
28
|
+
};
|
|
24
29
|
}>;
|
|
25
30
|
};
|