@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
|
@@ -38,8 +38,9 @@ exports.applyStageGate = applyStageGate;
|
|
|
38
38
|
exports.applyRoleStage = applyRoleStage;
|
|
39
39
|
exports.currentStage = currentStage;
|
|
40
40
|
exports.reviewPolicyOf = reviewPolicyOf;
|
|
41
|
+
exports.reviewBaseOf = reviewBaseOf;
|
|
41
42
|
exports.transitionRun = transitionRun;
|
|
42
|
-
// @implements A-SPEC-781, A-SPEC-781.1, A-SPEC-774.19, A-SPEC-781.2, A-SPEC-102.10
|
|
43
|
+
// @implements A-SPEC-781, A-SPEC-781.1, A-SPEC-774.19, A-SPEC-781.2, A-SPEC-102.10, A-SPEC-102.12, A-SPEC-102.14
|
|
43
44
|
/**
|
|
44
45
|
* @implements A-SPEC-781 — a run's SDLC stage is recorded state. Only the holder of the run's stop key (the
|
|
45
46
|
* orchestrator; the session inside the run never sees it) moves it, along the edges the project's machine declares,
|
|
@@ -70,6 +71,8 @@ function applyStageGate(out, ctx) {
|
|
|
70
71
|
const mode = (0, run_mode_1.runMode)(ctx.env, ctx.projectRoot, ctx.cwd, ctx.sessionId);
|
|
71
72
|
if (!mode.run || !mode.id)
|
|
72
73
|
return out;
|
|
74
|
+
// A-SPEC-102.32 — non-strict: a forged pointer makes the worktree its own main, where no run record is, so the stage
|
|
75
|
+
// gate is off for the run (the Limits); a pointer that cannot be opened throws to the hook
|
|
73
76
|
const main = (0, run_records_1.mainCheckoutOf)(ctx.projectRoot);
|
|
74
77
|
if (!(0, run_records_1.listRuns)(main).some((r) => r.run_id === mode.id))
|
|
75
78
|
return out;
|
|
@@ -86,6 +89,7 @@ function applyStageGate(out, ctx) {
|
|
|
86
89
|
if (action && denied.has(action)) {
|
|
87
90
|
return {
|
|
88
91
|
permissionDecision: 'deny',
|
|
92
|
+
refusal: 'stage.refused', // A-SPEC-245.24
|
|
89
93
|
permissionDecisionReason: `[Holmes-Kit] the run is in stage ${stage}, where ${action} is not allowed (${rel}) — the orchestrator moves the run with holmes-kit run transition`,
|
|
90
94
|
};
|
|
91
95
|
}
|
|
@@ -105,6 +109,8 @@ function applyRoleStage(out, ctx) {
|
|
|
105
109
|
const mode = (0, run_mode_1.runMode)(ctx.env, ctx.projectRoot, ctx.cwd, ctx.sessionId);
|
|
106
110
|
if (!mode.run || !mode.id)
|
|
107
111
|
return out;
|
|
112
|
+
// A-SPEC-102.32 — non-strict: as applyStageGate's, a forged pointer turns the role stage off; one that cannot be opened
|
|
113
|
+
// throws to the hook
|
|
108
114
|
const main = (0, run_records_1.mainCheckoutOf)(ctx.projectRoot);
|
|
109
115
|
if (!(0, run_records_1.listRuns)(main).some((r) => r.run_id === mode.id))
|
|
110
116
|
return out;
|
|
@@ -119,7 +125,7 @@ function applyRoleStage(out, ctx) {
|
|
|
119
125
|
const rel = path.relative(ctx.projectRoot, path.isAbsolute(t) ? t : path.resolve(base, t)).replace(/\\/g, '/');
|
|
120
126
|
const issue = (0, role_policy_1.roleCheck)((0, phase_1.classifyAction)(rel, undefined, opts) ?? 'WRITE_OTHER', identity, policy, { run: true, stage });
|
|
121
127
|
if (issue)
|
|
122
|
-
return { permissionDecision: 'deny', permissionDecisionReason: issue };
|
|
128
|
+
return { permissionDecision: 'deny', refusal: 'role.refused', permissionDecisionReason: issue }; // A-SPEC-245.24
|
|
123
129
|
}
|
|
124
130
|
return out;
|
|
125
131
|
}
|
|
@@ -140,6 +146,17 @@ function reviewPolicyOf(rec) {
|
|
|
140
146
|
const rounds = typeof r?.rounds === 'number' && Number.isInteger(r.rounds) && r.rounds >= 1 && r.rounds <= 20 ? r.rounds : undefined;
|
|
141
147
|
return { ...(rounds !== undefined ? { rounds } : {}), strict: r?.strict === true };
|
|
142
148
|
}
|
|
149
|
+
/**
|
|
150
|
+
* @implements A-SPEC-102.12 — the base every review gate of the run judges from: the task's review base declared at
|
|
151
|
+
* start, otherwise the run's own start HEAD; null when neither is recorded.
|
|
152
|
+
*/
|
|
153
|
+
function reviewBaseOf(rec) {
|
|
154
|
+
const r = rec;
|
|
155
|
+
const declared = r?.review?.base;
|
|
156
|
+
if (typeof declared === 'string' && /^[0-9a-f]{40,64}$/.test(declared))
|
|
157
|
+
return declared;
|
|
158
|
+
return typeof r?.base === 'string' && r.base !== '' ? r.base : null;
|
|
159
|
+
}
|
|
143
160
|
function transitionRun(main, runId, to, opts) {
|
|
144
161
|
const rec = (0, run_records_1.listRuns)(main).find((r) => r.run_id === runId);
|
|
145
162
|
if (!rec)
|
|
@@ -156,9 +173,10 @@ function transitionRun(main, runId, to, opts) {
|
|
|
156
173
|
return { ok: false, reason: `${from} → ${to} is not an allowed transition (from ${from}: ${(machine.transitions[from] ?? []).join(', ') || 'none'})` };
|
|
157
174
|
}
|
|
158
175
|
if (machine.reviewed.includes(to)) {
|
|
159
|
-
|
|
176
|
+
const reviewBase = reviewBaseOf(rec);
|
|
177
|
+
if (reviewBase === null)
|
|
160
178
|
return { ok: false, reason: `${to} needs a review of the run's range, and the run recorded no base at start` };
|
|
161
|
-
const range = (0, verdicts_1.resolveRange)(rec.worktree,
|
|
179
|
+
const range = (0, verdicts_1.resolveRange)(rec.worktree, reviewBase, 'HEAD');
|
|
162
180
|
if ('error' in range)
|
|
163
181
|
return { ok: false, reason: range.error };
|
|
164
182
|
// @implements A-SPEC-102.10 — the run's recorded policy: strict review, and a cap on failing rounds.
|
|
@@ -166,7 +184,9 @@ function transitionRun(main, runId, to, opts) {
|
|
|
166
184
|
const g = (0, verdicts_1.gateRange)(rec.worktree, range.base, range.head, { strict: policy.strict });
|
|
167
185
|
if (!g.ok) {
|
|
168
186
|
const capRounds = policy.rounds ?? null;
|
|
169
|
-
|
|
187
|
+
// @implements A-SPEC-102.14 — counted over the run's own lineage, under any recorded base.
|
|
188
|
+
// @implements A-SPEC-102.18 — and what the run amended or rewrote away (its record carries its authorship).
|
|
189
|
+
const failed = capRounds !== null ? (0, verdicts_1.failingRounds)(main, range.base, range.head, rec.worktree, { ...rec, run_id: runId }) : [];
|
|
170
190
|
if (capRounds !== null && failed.length >= capRounds) {
|
|
171
191
|
const findings = (failed[failed.length - 1].findings ?? []).slice(0, 50).map((f) => String(f).slice(0, 300));
|
|
172
192
|
(0, run_refusals_1.appendRunEvent)(main, runId, {
|
|
@@ -9,7 +9,7 @@ exports.judgeScope = judgeScope;
|
|
|
9
9
|
/**
|
|
10
10
|
* The de-amplified scope judgment — PURE (no fs, no git; the hook gathers, this decides).
|
|
11
11
|
*
|
|
12
|
-
* Field basis (2026-08-23,
|
|
12
|
+
* Field basis (2026-08-23, a consumer workspace): one test-class addition to an ALREADY-ANCHORED file cost
|
|
13
13
|
* >=3 human interventions, because the old model re-checked Files-to-Touch on every edit of an
|
|
14
14
|
* anchored file (double registration: the anchor said "this file belongs to X" and FtT had to
|
|
15
15
|
* say it again), while its matcher quietly widened every FILE token to the file's whole parent
|
|
@@ -250,6 +250,15 @@ const mentionsWiringUncached = (text) => {
|
|
|
250
250
|
if ([...(0, write_target_1.wiringFileNames)(), ...write_target_1.WIRING_DIR_NAMES].some((n) => re.test(n)))
|
|
251
251
|
return true;
|
|
252
252
|
}
|
|
253
|
+
// @implements A-SPEC-792.41 — a zsh group inside a word (`.m(c)p.json`, `.(mcp|x).json`) is a glob too; the split above
|
|
254
|
+
// cut the word at its parentheses, so the name never appeared whole.
|
|
255
|
+
for (const tok of t.split(/[\s;&<>'"`=]+/)) {
|
|
256
|
+
if (!/[^\s(|]\(|\)[^\s)|]/.test(tok) || tok.length > 256)
|
|
257
|
+
continue;
|
|
258
|
+
const re = (0, write_target_1.globPatternRe)(tok.split('/').pop() ?? tok, true);
|
|
259
|
+
if ([...(0, write_target_1.wiringFileNames)(), ...write_target_1.WIRING_DIR_NAMES].some((n) => re.test(n)))
|
|
260
|
+
return true;
|
|
261
|
+
}
|
|
253
262
|
return false;
|
|
254
263
|
};
|
|
255
264
|
const CALL_ROLES = new Map([
|
|
@@ -382,6 +391,15 @@ function harnessWiringActOf(root, base, segmentText, fullText, env = process.env
|
|
|
382
391
|
// A word made unknowable by `$(…)` or a variable is still refused when its last component is a
|
|
383
392
|
// wiring file name (`rm "$(git rev-parse --show-toplevel)/.agents/hooks.json"`, round 4).
|
|
384
393
|
const unknownByName = (w, dirs) => (w.text === '' ? null : byName(w, dirs));
|
|
394
|
+
// @implements A-SPEC-792.41 — a glob whose place is unknowable: its last component matched against the wiring names.
|
|
395
|
+
const globByName = (w) => {
|
|
396
|
+
const last = (0, linear_match_1.trimTrailing)(w.text, '/\\').split(/[/\\]/).pop()?.toLowerCase() ?? '';
|
|
397
|
+
if (last.length > 256)
|
|
398
|
+
return `${w.text.slice(-80)} (a glob too long to judge)`;
|
|
399
|
+
const re = (0, write_target_1.globPatternRe)(last, true);
|
|
400
|
+
const hit = [...(0, write_target_1.wiringFileNames)(), ...write_target_1.WIRING_DIR_NAMES].find((n) => re.test(n));
|
|
401
|
+
return hit === undefined ? null : `${w.text.length > 120 ? `…${w.text.slice(-80)}` : w.text} (a glob that can name ${hit})`;
|
|
402
|
+
};
|
|
385
403
|
// @implements A-SPEC-728 (rule 47) — a path that passed is not judged again within one judgement of a command (a loop judges
|
|
386
404
|
// its body once per word: 16 loops over 80 tar members at six directories took 10.6 s — measured), and one command judges at
|
|
387
405
|
// most PATHS_JUDGED_MAX distinct paths: past that it is refused as too large to judge, so the bound never makes a pass.
|
|
@@ -413,9 +431,12 @@ function harnessWiringActOf(root, base, segmentText, fullText, env = process.env
|
|
|
413
431
|
del: (w, recursive) => once(recursive ? 'R' : 'D', w, () => !w.known ? unknownByName(w, recursive) : w.text === '' ? null
|
|
414
432
|
: w.text.length > MAX_PATH ? byName(w, recursive)
|
|
415
433
|
: b !== null || absolute(w.text) ? (0, write_target_1.wiringDeletionKindOf)(root, b, w.text, env, home, recursive) : byName(w, recursive)),
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
434
|
+
// @implements A-SPEC-792.41 — a glob target is judged as a deletion's glob is: the shell expands it onto whatever
|
|
435
|
+
// exists, so `tee ~/.cl*ude/settings.json` wrote the user's settings (measured in bash and zsh). It returned null.
|
|
436
|
+
wr: (w) => once('W', w, () => !w.known ? (w.glob ? globByName(w) : unknownByName(w, false)) : w.text === '' ? null
|
|
437
|
+
: w.glob ? (w.text.length <= MAX_PATH && (b !== null || absolute(w.text)) ? (0, write_target_1.wiringDeletionKindOf)(root, b, w.text, env, home, true) : globByName(w))
|
|
438
|
+
: w.text.length > MAX_PATH ? byName(w, false)
|
|
439
|
+
: b !== null || absolute(w.text) ? (0, write_target_1.wiringWriteKindOf)(root, b ?? root, w.text, env, home) : byName(w, false)),
|
|
419
440
|
};
|
|
420
441
|
};
|
|
421
442
|
const { judgeable, del, wr } = at(base);
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The text the rule reads. Data goes only when the whole command was read with certainty and nothing in it runs text;
|
|
3
|
+
* otherwise `whole`: no splitter can be trusted on text not read with certainty, so all of it is judged, comments and
|
|
4
|
+
* bodies included, with `$'…'` made plain.
|
|
5
|
+
*/
|
|
6
|
+
export declare function commandText(raw: string): {
|
|
7
|
+
text: string;
|
|
8
|
+
whole: boolean;
|
|
9
|
+
};
|
|
10
|
+
/**
|
|
11
|
+
* A-SPEC-794.54 — `commandText` for a reader that has no bound of its own: past the length bound, or when the reader
|
|
12
|
+
* overflows, the whole text as written, comments and bodies included.
|
|
13
|
+
*/
|
|
14
|
+
export declare function readableText(raw: string): string;
|
|
15
|
+
export declare const KEYWORD: RegExp;
|
|
16
|
+
/** True when `cwd` is the project's store or inside it, judged against the project root (never a parent's name). */
|
|
17
|
+
export declare function cwdInStore(cwd: string | null | undefined, root: string | null | undefined): boolean;
|
|
18
|
+
/**
|
|
19
|
+
* What the rule judges. `whole`: no path analysis ran, so every clause reaches the rule and the command need not build any
|
|
20
|
+
* path. A-SPEC-794.42 — what the text holds differs: not read with certainty, as written with `$'…'` made plain; past the
|
|
21
|
+
* length bound or after an overflow, the raw text; past the stage bound, comments and bodies are gone. A-SPEC-794.45 — past
|
|
22
|
+
* the nesting bound an inner program counts as building a path, so a command with nothing removed goes on with
|
|
23
|
+
* `whole: false`; with a comment or a body beside its `eval` the data rule comes first and it is `whole: true`.
|
|
24
|
+
*/
|
|
25
|
+
export interface StoreBuilt {
|
|
26
|
+
text: string;
|
|
27
|
+
whole: boolean;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* The text the not-a-read rule judges when a store path is built while the command runs, or null when none is: the
|
|
31
|
+
* pipelines such a path can reach, followed through the names that carry it. `pipelines` is the classifier's splitter,
|
|
32
|
+
* which keeps a pipeline whole (null when a quote is left open: the command is then one pipeline).
|
|
33
|
+
*/
|
|
34
|
+
export declare function storePathBuiltJudgement(command: string, cwd: string | null | undefined, root: string | null | undefined, pipelines: (cmd: string) => string[] | null): StoreBuilt | null;
|
|
35
|
+
/** The text alone: what the predicate's own cases read. */
|
|
36
|
+
export declare const storePathBuiltText: (command: string, cwd: string | null | undefined, root: string | null | undefined, pipelines: (cmd: string) => string[] | null) => string | null;
|
|
37
|
+
/** The refusal: what was judged, and the next act. */
|
|
38
|
+
export declare const STORE_BUILT_REASON = "shell command can write a .ax governance path it builds while it runs, and is not recognisably read-only \u2014 write with literal paths (a protected .ax path asks for an approval), or read with one read command and literal paths";
|
|
39
|
+
/** A-SPEC-794.40 — the command need not build anything: nothing here says it does, and the way through comes first. */
|
|
40
|
+
export declare const STORE_WHOLE_REASON = "shell command names .ax or runs inside it, and could not be read with certainty (a construct or a here-document this gate does not read, text that may run, or a very long command), so it was judged whole and is not recognisably read-only \u2014 remove the .ax mention, or split the command into separate calls, and it is judged again; a write to a protected .ax path with literal paths asks for an approval";
|