@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
|
@@ -35,20 +35,43 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
35
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
36
|
exports.keyHash = exports.newRunId = exports.runsDir = void 0;
|
|
37
37
|
exports.mainCheckoutOf = mainCheckoutOf;
|
|
38
|
+
exports.checkoutOf = checkoutOf;
|
|
38
39
|
exports.writeRun = writeRun;
|
|
39
40
|
exports.listRuns = listRuns;
|
|
40
41
|
exports.removeRun = removeRun;
|
|
41
|
-
// @implements A-SPEC-774.17
|
|
42
|
+
// @implements A-SPEC-774.17, A-SPEC-102.29, A-SPEC-102.30, A-SPEC-102.31, A-SPEC-102.32, A-SPEC-102.33
|
|
42
43
|
// The run records A-SPEC-774.9's runMode reads: `.ax/state/runs/<run_id>.json` in the main checkout. Written by
|
|
43
44
|
// `holmes-kit run start`, removed by `run stop` with the stop key — a session inside the run never sees the key.
|
|
44
45
|
const crypto = __importStar(require("node:crypto"));
|
|
45
46
|
const fs = __importStar(require("node:fs"));
|
|
46
47
|
const path = __importStar(require("node:path"));
|
|
48
|
+
const bounded_io_1 = require("./bounded-io");
|
|
47
49
|
const RUN_ID_RE = /^run-\d{14}-[0-9a-f]{8}$/;
|
|
48
50
|
const runsDir = (main) => path.join(main, '.ax', 'state', 'runs');
|
|
49
51
|
exports.runsDir = runsDir;
|
|
50
52
|
/** The main checkout behind `dir`: a linked worktree's `.git` pointer leads to the common git directory's parent. */
|
|
51
53
|
function mainCheckoutOf(dir) {
|
|
54
|
+
return checkoutOf(dir).main;
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* The checkout holding `dir` (`top`, the first directory upward with a `.git` entry; `dir` itself when none) and its
|
|
58
|
+
* main checkout. @implements A-SPEC-102.29 — the commondir is read only as a regular file of at most 4 KiB (a FIFO held
|
|
59
|
+
* the read open). @implements A-SPEC-102.30 (item 8) — the `.git` pointer and the commondir are each read on one
|
|
60
|
+
* descriptor, non-blocking and checked by fstat. `strict` (the harness catalog's root): a pointer or a commondir that
|
|
61
|
+
* exists but cannot be read so throws, naming the path. @implements A-SPEC-102.32 — non-strict (the runs' reading) is
|
|
62
|
+
* that of before 102.30, and it is not "not a worktree" in every case: a pointer it cannot open throws (EACCES), a
|
|
63
|
+
* pointer it reads but cannot follow, or a commondir it cannot read (a link), answers the worktree as its own main.
|
|
64
|
+
* Neither reading tells a forged checkout from a real one (the Limits of A-SPEC-102.32 name eight forms).
|
|
65
|
+
* @implements A-SPEC-102.33 — and a pointer `gitdir: <any directory>/.git` with no commondir makes that directory, the
|
|
66
|
+
* one the agent chose, the main checkout: its runs, config and ledgers are read and written (the reading of before
|
|
67
|
+
* 102.30; the fix waits for the owner's decision 1-c).
|
|
68
|
+
*/
|
|
69
|
+
function checkoutOf(dir, opts = {}) {
|
|
70
|
+
const strict = opts.strict === true;
|
|
71
|
+
// @implements A-SPEC-102.31 — strict: what cannot be a checkout's .git throws, naming the path; non-strict (the runs'
|
|
72
|
+
// callers: run-exec, run, run-stages, run-refusals, run-plan-scope, stop, verdicts, push-gate-runner; each says what a
|
|
73
|
+
// forged or unreadable pointer does there, A-SPEC-102.32) keeps its reading of before 102.30
|
|
74
|
+
const refuse = (where, why) => { throw new Error(`${where}: ${why}`); };
|
|
52
75
|
let cur = path.resolve(dir);
|
|
53
76
|
for (;;) {
|
|
54
77
|
const dotGit = path.join(cur, '.git');
|
|
@@ -59,26 +82,85 @@ function mainCheckoutOf(dir) {
|
|
|
59
82
|
catch {
|
|
60
83
|
st = null;
|
|
61
84
|
}
|
|
62
|
-
if (st?.isDirectory())
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
85
|
+
if (st?.isDirectory()) {
|
|
86
|
+
// an empty directory in place of a worktree pointer read as a main checkout (A, B)
|
|
87
|
+
if (strict && !fs.existsSync(path.join(dotGit, 'HEAD')))
|
|
88
|
+
refuse(dotGit, 'a .git directory with no HEAD');
|
|
89
|
+
return { top: cur, main: cur };
|
|
90
|
+
}
|
|
91
|
+
if (st !== null && !st.isFile()) {
|
|
92
|
+
if (strict)
|
|
93
|
+
refuse(dotGit, 'neither a directory nor a regular file'); // a FIFO, a socket, a device
|
|
94
|
+
}
|
|
95
|
+
else if (st?.isFile()) {
|
|
96
|
+
// non-strict reads the pointer as before 102.30 (a link followed, no bound): its callers took no throw from it
|
|
97
|
+
const text = strict ? (0, bounded_io_1.readSmallRegularTextSync)(dotGit, 4096) : fs.readFileSync(dotGit, 'utf8');
|
|
98
|
+
const m = /^gitdir:\s*(.+)$/m.exec(text);
|
|
99
|
+
if (!m) {
|
|
100
|
+
if (strict)
|
|
101
|
+
refuse(dotGit, 'no gitdir line');
|
|
102
|
+
return { top: cur, main: cur };
|
|
103
|
+
}
|
|
68
104
|
const gitdir = path.resolve(cur, m[1].trim());
|
|
69
|
-
|
|
105
|
+
if (strict) {
|
|
106
|
+
let ok = false;
|
|
107
|
+
try {
|
|
108
|
+
ok = fs.statSync(gitdir).isDirectory();
|
|
109
|
+
}
|
|
110
|
+
catch {
|
|
111
|
+
ok = false;
|
|
112
|
+
}
|
|
113
|
+
if (!ok)
|
|
114
|
+
refuse(dotGit, `its gitdir ${gitdir} is not a directory`);
|
|
115
|
+
}
|
|
116
|
+
let common = null;
|
|
117
|
+
const cd = path.join(gitdir, 'commondir');
|
|
70
118
|
try {
|
|
71
|
-
common = path.resolve(gitdir,
|
|
119
|
+
common = path.resolve(gitdir, (0, bounded_io_1.readSmallRegularTextSync)(cd, 4096).trim());
|
|
120
|
+
}
|
|
121
|
+
catch (e) {
|
|
122
|
+
// no commondir: a submodule's gitdir, not a worktree; anything else is a commondir that cannot be trusted
|
|
123
|
+
if (strict && e.code !== 'ENOENT')
|
|
124
|
+
refuse(cd, e.message);
|
|
72
125
|
}
|
|
73
|
-
|
|
74
|
-
|
|
126
|
+
// @implements A-SPEC-102.32 — no commondir: the gitdir is its own common, as before 102.31, so a pointer naming the
|
|
127
|
+
// main checkout's `.git` reads that checkout (102.31 read the worktree as its own main: B, a regression). The back
|
|
128
|
+
// reference is an entry's, so only a commondir asks for it
|
|
129
|
+
if (common !== null && strict)
|
|
130
|
+
backReference(dotGit, gitdir, common);
|
|
131
|
+
const own = common ?? gitdir;
|
|
132
|
+
return { top: cur, main: path.basename(own) === '.git' ? path.dirname(own) : cur };
|
|
75
133
|
}
|
|
76
134
|
const up = path.dirname(cur);
|
|
77
135
|
if (up === cur)
|
|
78
|
-
return path.resolve(dir);
|
|
136
|
+
return { top: path.resolve(dir), main: path.resolve(dir) };
|
|
79
137
|
cur = up;
|
|
80
138
|
}
|
|
81
139
|
}
|
|
140
|
+
/**
|
|
141
|
+
* @implements A-SPEC-102.31 — a worktree's entry points back at it: the gitdir is `<common>/worktrees/<id>` and its
|
|
142
|
+
* `gitdir` file names this `.git`. A redirect to a fake gitdir passed as "not a worktree" (A, B). A whole repository
|
|
143
|
+
* forged with a matching entry still passes: named in the Limits.
|
|
144
|
+
*/
|
|
145
|
+
function backReference(dotGit, gitdir, common) {
|
|
146
|
+
const same = (a, b) => { try {
|
|
147
|
+
return fs.realpathSync(a) === fs.realpathSync(b);
|
|
148
|
+
}
|
|
149
|
+
catch {
|
|
150
|
+
return false;
|
|
151
|
+
} };
|
|
152
|
+
if (!same(path.dirname(gitdir), path.join(common, 'worktrees')))
|
|
153
|
+
throw new Error(`${dotGit}: its gitdir ${gitdir} is not an entry of ${path.join(common, 'worktrees')}`);
|
|
154
|
+
let named;
|
|
155
|
+
try {
|
|
156
|
+
named = (0, bounded_io_1.readSmallRegularTextSync)(path.join(gitdir, 'gitdir'), 4096).trim();
|
|
157
|
+
}
|
|
158
|
+
catch (e) {
|
|
159
|
+
throw new Error(`${path.join(gitdir, 'gitdir')}: ${e.message}`);
|
|
160
|
+
}
|
|
161
|
+
if (!same(path.resolve(gitdir, named), dotGit))
|
|
162
|
+
throw new Error(`${dotGit}: its worktree entry points at ${named}`);
|
|
163
|
+
}
|
|
82
164
|
const newRunId = (now, rand) => `run-${now.toISOString().replace(/[-:T]/g, '').slice(0, 14)}-${rand().slice(0, 8)}`;
|
|
83
165
|
exports.newRunId = newRunId;
|
|
84
166
|
const keyHash = (key) => crypto.createHash('sha256').update(key).digest('hex');
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* One terminal row's worth of SUBJECT, with the template's own cells already subtracted: an 80
|
|
3
|
+
* column row, minus the widest template prefix on this screen (`\u2713 \uc2b9\uc778 \u2014 `, nine columns)
|
|
4
|
+
* and the kind cell (16) and its space, leaves 52. Every line the decision surface prints is bounded by it, so a queue of any size stays a
|
|
5
|
+
* screen the operator can read top to bottom — the property the batch confirmation depends on
|
|
6
|
+
* (round-5: the field was bounded and the LINE was not, so a bounded field still wrapped).
|
|
7
|
+
*/
|
|
8
|
+
/** The terminal this screen promises to fit. The floor no terminal goes below. */
|
|
9
|
+
export declare const ROW_MAX = 80;
|
|
10
|
+
export declare const ROW_COLS = 50;
|
|
11
|
+
/**
|
|
12
|
+
* The `kind` cell. Round-7: at 16 the truncation NOTICE (`… (200자 잘림)`, fifteen columns) consumed
|
|
13
|
+
* the entire budget, so a non-ASCII kind rendered ZERO columns of the operator's text — the category
|
|
14
|
+
* of authority being granted, unreadable, in the list AND the item header AND the confirmation AND
|
|
15
|
+
* every decision echo. That is the round-5 lesson ("a bound met by showing nothing is the
|
|
16
|
+
* concealment this module exists to prevent") reached through a budget nobody re-checked. Twenty
|
|
17
|
+
* columns plus the short notice form below leaves real text on the line.
|
|
18
|
+
*/
|
|
19
|
+
export declare const KIND_COLS = 20;
|
|
20
|
+
/**
|
|
21
|
+
* Did rendering this value into `max` columns hide any of it?
|
|
22
|
+
*
|
|
23
|
+
* Round-8: this used to be a REGEX OVER THE RENDERED TEXT, and the data can end with any string it
|
|
24
|
+
* likes — a target ending `… (5자 잘림)` was reported as clipped when nothing had been clipped, so
|
|
25
|
+
* `[A]` refused to batch it and told the operator, falsely, that it did not fit on a row. An agent
|
|
26
|
+
* could disable batch approval for a whole session by choosing its own suffix. The renderer knows
|
|
27
|
+
* the answer; nobody should have to parse it back out of the output.
|
|
28
|
+
*/
|
|
29
|
+
export declare function isClipped(value: string, max?: number): boolean;
|
|
30
|
+
/**
|
|
31
|
+
* How many terminal COLUMNS a string occupies. Round-5 measured why a code-point budget is not a
|
|
32
|
+
* screen budget: a 200-code-point line of markers rendered 302 columns — four wrapped rows at 80 —
|
|
33
|
+
* because `⟪`, `⟫` and every Hangul character in `자 제거` are East Asian WIDE (two columns each).
|
|
34
|
+
* The budget exists to bound SCREEN SPACE, so it must be counted in the unit the screen uses.
|
|
35
|
+
*/
|
|
36
|
+
export declare function displayWidth(s: string): number;
|
|
37
|
+
/**
|
|
38
|
+
* One line, no control bytes, bounded in terminal COLUMNS — for a field the template puts on a line
|
|
39
|
+
* of its own. `max` is a column budget, not a character count (round-5): the caller is buying screen
|
|
40
|
+
* space, and on this screen a character can cost one column or two.
|
|
41
|
+
*
|
|
42
|
+
* The budget is spent on the OPERATOR'S text: the source is clipped first so escape spam cannot
|
|
43
|
+
* evict the real command (round-3), and the sanitised result is clipped again so markers cannot
|
|
44
|
+
* inflate the output (round-4). The truncation notice is appended AFTER sanitising, so no sequence
|
|
45
|
+
* sitting at the clip boundary can swallow it (round-4).
|
|
46
|
+
*/
|
|
47
|
+
export declare function flattenField(s: string, max?: number): string;
|
|
48
|
+
/**
|
|
49
|
+
* A-SPEC-262.1 §13 —
|
|
50
|
+
* The form agent-controlled text takes on a DECISION ROW: only characters whose width is fixed by
|
|
51
|
+
* the standard, everything else as an ASCII escape.
|
|
52
|
+
*
|
|
53
|
+
* Eight adversarial rounds found the same shape of defect eight times — a character whose width the
|
|
54
|
+
* code guessed (Ambiguous, combining, zero-width), or whose cursor effect it did not model (TAB,
|
|
55
|
+
* ESC), or whose position let the data choose a line boundary (alignment, folding). None of them can
|
|
56
|
+
* occur here, because none of those characters survive to the row: a control byte is not stripped
|
|
57
|
+
* and counted, it is SHOWN as `\u001b`. Nothing is removed, so nothing is hidden — which also
|
|
58
|
+
* retires the removal marker, its forgery guard and its size accounting from this path entirely.
|
|
59
|
+
*
|
|
60
|
+
* What passes through: printable ASCII (one column each) and East_Asian_Width W or F (two columns
|
|
61
|
+
* each, fixed by the standard). Korean and CJK commands therefore stay readable on the screen the
|
|
62
|
+
* operator decides from — the requirement that made this a hybrid rather than a full escaping.
|
|
63
|
+
* A backslash is doubled first, so data can never spell an escape the renderer did not write.
|
|
64
|
+
*/
|
|
65
|
+
export declare function rowLiteral(s: string): string;
|
|
66
|
+
/**
|
|
67
|
+
* A-SPEC-262.1 §13 —
|
|
68
|
+
* A decision row's field: the row literal, cut to `max` columns, with what it could not show stated.
|
|
69
|
+
*/
|
|
70
|
+
export declare function rowField(value: string, max?: number): string;
|
|
71
|
+
export declare function wrapColumns(s: string, cols?: number, indent?: string): string;
|
|
72
|
+
export declare function stripControl(s: string): string;
|
|
73
|
+
/**
|
|
74
|
+
* Clip on a CODE POINT boundary. Round-1: slicing UTF-16 units cut a surrogate pair in half and the
|
|
75
|
+
* last visible character of a clipped command rendered as a replacement glyph — on a screen whose
|
|
76
|
+
* whole job is showing the subject verbatim.
|
|
77
|
+
*/
|
|
78
|
+
export declare function clipCodePoints(s: string, max: number): string;
|
|
79
|
+
/**
|
|
80
|
+
* Quote a value that is about to appear inside a COPY-PASTEABLE command line.
|
|
81
|
+
*
|
|
82
|
+
* Round-2: the non-TTY hint (A-SPEC-260) fills the real queue id into three `holmes-kit approve …`
|
|
83
|
+
* lines whose whole purpose is being pasted into a shell — and the id is agent-controlled. Flattening
|
|
84
|
+
* stops it forging lines, but a flattened `… | sh` still PIPES when pasted. POSIX single quotes make
|
|
85
|
+
* any byte inert; a literal quote is closed, escaped and reopened.
|
|
86
|
+
*/
|
|
87
|
+
export declare function shellQuote(s: string): string;
|
|
88
|
+
/**
|
|
89
|
+
* A reference for a pasteable command line: left ALONE when it is already inert (the shape a real
|
|
90
|
+
* queue id has), quoted only when it is not. Round-2 wanted every pasted byte harmless; quoting
|
|
91
|
+
* unconditionally would also have rewritten the A-SPEC-260 hint that ships today, so the blast
|
|
92
|
+
* radius is kept to the case that needs it — a normal session's screen is byte-for-byte unchanged.
|
|
93
|
+
*/
|
|
94
|
+
export declare function safeRef(s: string): string;
|