@lannguyensi/harness 0.64.0 → 1.0.0
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 +64 -0
- package/README.md +46 -42
- package/dist/cli/add/index.js +17 -21
- package/dist/cli/add/index.js.map +1 -1
- package/dist/cli/adopt/derive.d.ts +2 -2
- package/dist/cli/adopt/derive.js +2 -19
- package/dist/cli/adopt/derive.js.map +1 -1
- package/dist/cli/adopt/index.d.ts +1 -1
- package/dist/cli/adopt/index.js +1 -12
- package/dist/cli/adopt/index.js.map +1 -1
- package/dist/cli/apply/apply.d.ts +20 -35
- package/dist/cli/apply/apply.js +61 -136
- package/dist/cli/apply/apply.js.map +1 -1
- package/dist/cli/apply/generate-codex-config.js +10 -58
- package/dist/cli/apply/generate-codex-config.js.map +1 -1
- package/dist/cli/apply/generate-memory-index.js +1 -2
- package/dist/cli/apply/generate-memory-index.js.map +1 -1
- package/dist/cli/apply/generate-opencode-config.d.ts +2 -10
- package/dist/cli/apply/generate-opencode-config.js +74 -113
- package/dist/cli/apply/generate-opencode-config.js.map +1 -1
- package/dist/cli/apply/generate-settings.d.ts +11 -64
- package/dist/cli/apply/generate-settings.js +27 -132
- package/dist/cli/apply/generate-settings.js.map +1 -1
- package/dist/cli/apply/index.d.ts +1 -1
- package/dist/cli/apply/index.js +1 -1
- package/dist/cli/apply/index.js.map +1 -1
- package/dist/cli/apply/install-codex-config.d.ts +153 -1
- package/dist/cli/apply/install-codex-config.js +445 -70
- package/dist/cli/apply/install-codex-config.js.map +1 -1
- package/dist/cli/apply/next-steps.d.ts +7 -0
- package/dist/cli/apply/next-steps.js +13 -1
- package/dist/cli/apply/next-steps.js.map +1 -1
- package/dist/cli/bounded-stdin.d.ts +0 -23
- package/dist/cli/bounded-stdin.js +2 -49
- package/dist/cli/bounded-stdin.js.map +1 -1
- package/dist/cli/describe.d.ts +1 -1
- package/dist/cli/describe.js +0 -3
- package/dist/cli/describe.js.map +1 -1
- package/dist/cli/diff/engine.d.ts +0 -11
- package/dist/cli/diff/engine.js +1 -17
- package/dist/cli/diff/engine.js.map +1 -1
- package/dist/cli/diff/index.js +14 -25
- package/dist/cli/diff/index.js.map +1 -1
- package/dist/cli/doctor/claude-mcp.d.ts +4 -19
- package/dist/cli/doctor/claude-mcp.js +11 -22
- package/dist/cli/doctor/claude-mcp.js.map +1 -1
- package/dist/cli/doctor/codex.d.ts +12 -14
- package/dist/cli/doctor/codex.js +31 -144
- package/dist/cli/doctor/codex.js.map +1 -1
- package/dist/cli/doctor/format.js +23 -345
- package/dist/cli/doctor/format.js.map +1 -1
- package/dist/cli/doctor/hook-liveness.d.ts +56 -0
- package/dist/cli/doctor/hook-liveness.js +455 -0
- package/dist/cli/doctor/hook-liveness.js.map +1 -0
- package/dist/cli/doctor/index.d.ts +13 -87
- package/dist/cli/doctor/index.js +57 -713
- package/dist/cli/doctor/index.js.map +1 -1
- package/dist/cli/doctor/opencode.d.ts +2 -1
- package/dist/cli/doctor/opencode.js.map +1 -1
- package/dist/cli/doctor/types.d.ts +21 -387
- package/dist/cli/doctor/types.js.map +1 -1
- package/dist/cli/drain-stdio.d.ts +31 -0
- package/dist/cli/drain-stdio.js +76 -0
- package/dist/cli/drain-stdio.js.map +1 -0
- package/dist/cli/export.d.ts +3 -1
- package/dist/cli/export.js +7 -16
- package/dist/cli/export.js.map +1 -1
- package/dist/cli/gate/codex-disable.d.ts +29 -0
- package/dist/cli/gate/codex-disable.js +195 -0
- package/dist/cli/gate/codex-disable.js.map +1 -0
- package/dist/cli/gate/codex-enable.d.ts +41 -0
- package/dist/cli/gate/codex-enable.js +127 -0
- package/dist/cli/gate/codex-enable.js.map +1 -0
- package/dist/cli/gate/codex-snapshot.d.ts +208 -0
- package/dist/cli/gate/codex-snapshot.js +402 -0
- package/dist/cli/gate/codex-snapshot.js.map +1 -0
- package/dist/cli/gate/disable.d.ts +9 -0
- package/dist/cli/gate/disable.js +263 -28
- package/dist/cli/gate/disable.js.map +1 -1
- package/dist/cli/gate/enable.d.ts +26 -6
- package/dist/cli/gate/enable.js +152 -80
- package/dist/cli/gate/enable.js.map +1 -1
- package/dist/cli/gate/link-chain.d.ts +53 -0
- package/dist/cli/gate/link-chain.js +122 -0
- package/dist/cli/gate/link-chain.js.map +1 -0
- package/dist/cli/gate/snapshot.d.ts +289 -12
- package/dist/cli/gate/snapshot.js +481 -22
- package/dist/cli/gate/snapshot.js.map +1 -1
- package/dist/cli/index.d.ts +0 -9
- package/dist/cli/index.js +9 -2131
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/init/composer.d.ts +3 -6
- package/dist/cli/init/composer.js +6 -370
- package/dist/cli/init/composer.js.map +1 -1
- package/dist/cli/init/dependencies.d.ts +1 -2
- package/dist/cli/init/dependencies.js +4 -80
- package/dist/cli/init/dependencies.js.map +1 -1
- package/dist/cli/init/detect.js +5 -4
- package/dist/cli/init/detect.js.map +1 -1
- package/dist/cli/init/interactive.d.ts +1 -23
- package/dist/cli/init/interactive.js +33 -247
- package/dist/cli/init/interactive.js.map +1 -1
- package/dist/cli/init/profiles.d.ts +2 -2
- package/dist/cli/init/profiles.js +51 -245
- package/dist/cli/init/profiles.js.map +1 -1
- package/dist/cli/init/templates.d.ts +2 -37
- package/dist/cli/init/templates.js +25 -1237
- package/dist/cli/init/templates.js.map +1 -1
- package/dist/cli/list.d.ts +1 -1
- package/dist/cli/list.js +1 -38
- package/dist/cli/list.js.map +1 -1
- package/dist/cli/loader.d.ts +15 -1
- package/dist/cli/loader.js +56 -39
- package/dist/cli/loader.js.map +1 -1
- package/dist/cli/main.js +7 -2
- package/dist/cli/main.js.map +1 -1
- package/dist/cli/migrate-home/index.js +2 -2
- package/dist/cli/migrate-home/index.js.map +1 -1
- package/dist/cli/pack/add.js +1 -1
- package/dist/cli/pack/add.js.map +1 -1
- package/dist/cli/pack/hook-bootstrap.d.ts +5 -164
- package/dist/cli/pack/hook-bootstrap.js +15 -291
- package/dist/cli/pack/hook-bootstrap.js.map +1 -1
- package/dist/cli/pack/hook-branch-protection.d.ts +28 -21
- package/dist/cli/pack/hook-branch-protection.js +365 -340
- package/dist/cli/pack/hook-branch-protection.js.map +1 -1
- package/dist/cli/pack/index.d.ts +0 -1
- package/dist/cli/pack/index.js +0 -1
- package/dist/cli/pack/index.js.map +1 -1
- package/dist/cli/pack/list.js +1 -6
- package/dist/cli/pack/list.js.map +1 -1
- package/dist/cli/pack/mutate.d.ts +7 -9
- package/dist/cli/pack/mutate.js +6 -9
- package/dist/cli/pack/mutate.js.map +1 -1
- package/dist/cli/pack/reseed.d.ts +2 -2
- package/dist/cli/pack/reseed.js +16 -22
- package/dist/cli/pack/reseed.js.map +1 -1
- package/dist/cli/{delegate/register.d.ts → register-gate-group.d.ts} +1 -1
- package/dist/cli/register-gate-group.js +348 -0
- package/dist/cli/register-gate-group.js.map +1 -0
- package/dist/cli/register-inspect-group.d.ts +6 -0
- package/dist/cli/register-inspect-group.js +189 -0
- package/dist/cli/register-inspect-group.js.map +1 -0
- package/dist/cli/register-operator-lifecycle.d.ts +1 -1
- package/dist/cli/register-operator-lifecycle.js +3 -100
- package/dist/cli/register-operator-lifecycle.js.map +1 -1
- package/dist/cli/register-pack-group.d.ts +5 -0
- package/dist/cli/register-pack-group.js +134 -0
- package/dist/cli/register-pack-group.js.map +1 -0
- package/dist/cli/{register-audit-group.d.ts → register-setup-group.d.ts} +1 -1
- package/dist/cli/register-setup-group.js +495 -0
- package/dist/cli/register-setup-group.js.map +1 -0
- package/dist/cli/remove/index.d.ts +0 -14
- package/dist/cli/remove/index.js +2 -115
- package/dist/cli/remove/index.js.map +1 -1
- package/dist/cli/remove/mutate.d.ts +0 -2
- package/dist/cli/remove/mutate.js +1 -19
- package/dist/cli/remove/mutate.js.map +1 -1
- package/dist/cli/remove/register.js +2 -19
- package/dist/cli/remove/register.js.map +1 -1
- package/dist/cli/shell-quote.d.ts +7 -0
- package/dist/cli/shell-quote.js +17 -0
- package/dist/cli/shell-quote.js.map +1 -0
- package/dist/cli/uninstall/index.d.ts +4 -2
- package/dist/cli/uninstall/index.js +15 -7
- package/dist/cli/uninstall/index.js.map +1 -1
- package/dist/cli/uninstall/register.js +6 -4
- package/dist/cli/uninstall/register.js.map +1 -1
- package/dist/cli/uninstall/snapshot.d.ts +15 -0
- package/dist/cli/uninstall/snapshot.js +38 -0
- package/dist/cli/uninstall/snapshot.js.map +1 -1
- package/dist/cli/validate/checks.d.ts +0 -77
- package/dist/cli/validate/checks.js +3 -1049
- package/dist/cli/validate/checks.js.map +1 -1
- package/dist/cli/validate/index.js +19 -15
- package/dist/cli/validate/index.js.map +1 -1
- package/dist/index.d.ts +0 -3
- package/dist/index.js +0 -3
- package/dist/index.js.map +1 -1
- package/dist/io/claude-mcp.d.ts +1 -1
- package/dist/io/claude-mcp.js +27 -14
- package/dist/io/claude-mcp.js.map +1 -1
- package/dist/io/harness-lock.js +2 -2
- package/dist/io/harness-lock.js.map +1 -1
- package/dist/io/lock.d.ts +0 -26
- package/dist/io/lock.js +10 -27
- package/dist/io/lock.js.map +1 -1
- package/dist/io/merge-settings.js +6 -4
- package/dist/io/merge-settings.js.map +1 -1
- package/dist/io/project-name.d.ts +22 -39
- package/dist/io/project-name.js +25 -42
- package/dist/io/project-name.js.map +1 -1
- package/dist/io/read-regular-file.d.ts +103 -40
- package/dist/io/read-regular-file.js +196 -35
- package/dist/io/read-regular-file.js.map +1 -1
- package/dist/io/restart-hints.js +3 -6
- package/dist/io/restart-hints.js.map +1 -1
- package/dist/io/version-compare.d.ts +1 -3
- package/dist/io/version-compare.js +1 -3
- package/dist/io/version-compare.js.map +1 -1
- package/dist/io/write-regular-file.d.ts +30 -0
- package/dist/io/write-regular-file.js +85 -0
- package/dist/io/write-regular-file.js.map +1 -0
- package/dist/overrides/index.d.ts +1 -0
- package/dist/overrides/index.js +1 -0
- package/dist/overrides/index.js.map +1 -1
- package/dist/overrides/merge-layers.d.ts +43 -0
- package/dist/overrides/merge-layers.js +76 -0
- package/dist/overrides/merge-layers.js.map +1 -0
- package/dist/overrides/merge.d.ts +16 -0
- package/dist/overrides/merge.js +21 -8
- package/dist/overrides/merge.js.map +1 -1
- package/dist/policy-packs/builtin/branch-protection-runtime.d.ts +4 -69
- package/dist/policy-packs/builtin/branch-protection-runtime.js +12 -84
- package/dist/policy-packs/builtin/branch-protection-runtime.js.map +1 -1
- package/dist/policy-packs/builtin/branch-protection.d.ts +7 -30
- package/dist/policy-packs/builtin/branch-protection.js +56 -89
- package/dist/policy-packs/builtin/branch-protection.js.map +1 -1
- package/dist/policy-packs/config-check.d.ts +7 -5
- package/dist/policy-packs/config-check.js +2 -2
- package/dist/policy-packs/config-check.js.map +1 -1
- package/dist/policy-packs/expand.d.ts +1 -3
- package/dist/policy-packs/expand.js +5 -42
- package/dist/policy-packs/expand.js.map +1 -1
- package/dist/policy-packs/index.d.ts +3 -3
- package/dist/policy-packs/index.js +2 -2
- package/dist/policy-packs/index.js.map +1 -1
- package/dist/policy-packs/registry.d.ts +9 -38
- package/dist/policy-packs/registry.js +5 -65
- package/dist/policy-packs/registry.js.map +1 -1
- package/dist/policy-packs/runtime.d.ts +0 -4
- package/dist/policy-packs/runtime.js +9 -22
- package/dist/policy-packs/runtime.js.map +1 -1
- package/dist/policy-packs/types.d.ts +0 -19
- package/dist/policy-packs/ux-compare.d.ts +1 -11
- package/dist/policy-packs/ux-compare.js +6 -42
- package/dist/policy-packs/ux-compare.js.map +1 -1
- package/dist/policy-packs/ux-drift-check.d.ts +5 -5
- package/dist/policy-packs/ux-drift-check.js +17 -22
- package/dist/policy-packs/ux-drift-check.js.map +1 -1
- package/dist/policy-packs/version-check.d.ts +5 -26
- package/dist/policy-packs/version-check.js +19 -74
- package/dist/policy-packs/version-check.js.map +1 -1
- package/dist/probes/memory.d.ts +1 -1
- package/dist/probes/memory.js +1 -1
- package/dist/probes/memory.js.map +1 -1
- package/dist/runtime/agent-facing.d.ts +9 -0
- package/dist/runtime/agent-facing.js +28 -14
- package/dist/runtime/agent-facing.js.map +1 -1
- package/dist/runtime/bounded-text.d.ts +15 -0
- package/dist/runtime/bounded-text.js +27 -0
- package/dist/runtime/bounded-text.js.map +1 -0
- package/dist/runtime/git-branch.d.ts +125 -0
- package/dist/runtime/git-branch.js +381 -0
- package/dist/runtime/git-branch.js.map +1 -0
- package/dist/runtime/hermetic-spawn-guard.d.ts +2 -2
- package/dist/runtime/hermetic-spawn-guard.js +24 -34
- package/dist/runtime/hermetic-spawn-guard.js.map +1 -1
- package/dist/runtime/home-dir.js +3 -2
- package/dist/runtime/home-dir.js.map +1 -1
- package/dist/runtime/tool-name-aliases.d.ts +0 -6
- package/dist/runtime/tool-name-aliases.js +5 -18
- package/dist/runtime/tool-name-aliases.js.map +1 -1
- package/dist/schema/grounding.d.ts +7 -54
- package/dist/schema/grounding.js +10 -12
- package/dist/schema/grounding.js.map +1 -1
- package/dist/schema/hooks.d.ts +39 -136
- package/dist/schema/hooks.js +3 -6
- package/dist/schema/hooks.js.map +1 -1
- package/dist/schema/index.d.ts +114 -3828
- package/dist/schema/index.js +41 -80
- package/dist/schema/index.js.map +1 -1
- package/dist/schema/memory.d.ts +54 -131
- package/dist/schema/memory.js +2 -2
- package/dist/schema/memory.js.map +1 -1
- package/dist/schema/policy-packs.d.ts +3 -45
- package/dist/schema/policy-packs.js +7 -13
- package/dist/schema/policy-packs.js.map +1 -1
- package/dist/schema/policy-ux.d.ts +7 -0
- package/dist/schema/policy-ux.js +18 -0
- package/dist/schema/policy-ux.js.map +1 -0
- package/dist/schema/removed-keys.d.ts +185 -0
- package/dist/schema/removed-keys.js +531 -0
- package/dist/schema/removed-keys.js.map +1 -0
- package/dist/schema/tools.d.ts +30 -268
- package/dist/schema/tools.js +4 -4
- package/dist/schema/tools.js.map +1 -1
- package/package.json +5 -16
- package/dist/cli/approve/branch-protection.d.ts +0 -69
- package/dist/cli/approve/branch-protection.js +0 -144
- package/dist/cli/approve/branch-protection.js.map +0 -1
- package/dist/cli/approve/risk.d.ts +0 -112
- package/dist/cli/approve/risk.js +0 -197
- package/dist/cli/approve/risk.js.map +0 -1
- package/dist/cli/approve/stdin-report.d.ts +0 -57
- package/dist/cli/approve/stdin-report.js +0 -145
- package/dist/cli/approve/stdin-report.js.map +0 -1
- package/dist/cli/approve/understanding.d.ts +0 -410
- package/dist/cli/approve/understanding.js +0 -996
- package/dist/cli/approve/understanding.js.map +0 -1
- package/dist/cli/audit.d.ts +0 -80
- package/dist/cli/audit.js +0 -252
- package/dist/cli/audit.js.map +0 -1
- package/dist/cli/delegate/index.d.ts +0 -76
- package/dist/cli/delegate/index.js +0 -444
- package/dist/cli/delegate/index.js.map +0 -1
- package/dist/cli/delegate/register.js +0 -90
- package/dist/cli/delegate/register.js.map +0 -1
- package/dist/cli/doctor/auto-approve-mode.d.ts +0 -37
- package/dist/cli/doctor/auto-approve-mode.js +0 -80
- package/dist/cli/doctor/auto-approve-mode.js.map +0 -1
- package/dist/cli/doctor/bypass-without-auto-approve.d.ts +0 -38
- package/dist/cli/doctor/bypass-without-auto-approve.js +0 -95
- package/dist/cli/doctor/bypass-without-auto-approve.js.map +0 -1
- package/dist/cli/doctor/codex-config-drift.d.ts +0 -28
- package/dist/cli/doctor/codex-config-drift.js +0 -240
- package/dist/cli/doctor/codex-config-drift.js.map +0 -1
- package/dist/cli/doctor/expire-on-tool-match.d.ts +0 -15
- package/dist/cli/doctor/expire-on-tool-match.js +0 -58
- package/dist/cli/doctor/expire-on-tool-match.js.map +0 -1
- package/dist/cli/doctor/rogue-ledger.d.ts +0 -53
- package/dist/cli/doctor/rogue-ledger.js +0 -153
- package/dist/cli/doctor/rogue-ledger.js.map +0 -1
- package/dist/cli/doctor/session-start-preflight-setup-version.d.ts +0 -83
- package/dist/cli/doctor/session-start-preflight-setup-version.js +0 -114
- package/dist/cli/doctor/session-start-preflight-setup-version.js.map +0 -1
- package/dist/cli/doctor/settings-drift.d.ts +0 -25
- package/dist/cli/doctor/settings-drift.js +0 -213
- package/dist/cli/doctor/settings-drift.js.map +0 -1
- package/dist/cli/doctor/toolchain-parity.d.ts +0 -63
- package/dist/cli/doctor/toolchain-parity.js +0 -154
- package/dist/cli/doctor/toolchain-parity.js.map +0 -1
- package/dist/cli/doctor/ug-auto-approvals.d.ts +0 -40
- package/dist/cli/doctor/ug-auto-approvals.js +0 -91
- package/dist/cli/doctor/ug-auto-approvals.js.map +0 -1
- package/dist/cli/doctor/ug-delegations.d.ts +0 -26
- package/dist/cli/doctor/ug-delegations.js +0 -121
- package/dist/cli/doctor/ug-delegations.js.map +0 -1
- package/dist/cli/doctor/ug-inflight.d.ts +0 -35
- package/dist/cli/doctor/ug-inflight.js +0 -57
- package/dist/cli/doctor/ug-inflight.js.map +0 -1
- package/dist/cli/doctor/understanding-mode-env.d.ts +0 -51
- package/dist/cli/doctor/understanding-mode-env.js +0 -98
- package/dist/cli/doctor/understanding-mode-env.js.map +0 -1
- package/dist/cli/dry-run.d.ts +0 -58
- package/dist/cli/dry-run.js +0 -283
- package/dist/cli/dry-run.js.map +0 -1
- package/dist/cli/enriched-event.d.ts +0 -35
- package/dist/cli/enriched-event.js +0 -60
- package/dist/cli/enriched-event.js.map +0 -1
- package/dist/cli/event-input.d.ts +0 -28
- package/dist/cli/event-input.js +0 -73
- package/dist/cli/event-input.js.map +0 -1
- package/dist/cli/explain-action.d.ts +0 -25
- package/dist/cli/explain-action.js +0 -57
- package/dist/cli/explain-action.js.map +0 -1
- package/dist/cli/explain-policy.d.ts +0 -147
- package/dist/cli/explain-policy.js +0 -248
- package/dist/cli/explain-policy.js.map +0 -1
- package/dist/cli/explain.d.ts +0 -31
- package/dist/cli/explain.js +0 -159
- package/dist/cli/explain.js.map +0 -1
- package/dist/cli/gc/index.d.ts +0 -63
- package/dist/cli/gc/index.js +0 -566
- package/dist/cli/gc/index.js.map +0 -1
- package/dist/cli/pack/approve-escape.d.ts +0 -19
- package/dist/cli/pack/approve-escape.js +0 -190
- package/dist/cli/pack/approve-escape.js.map +0 -1
- package/dist/cli/pack/auto-approve-path.d.ts +0 -146
- package/dist/cli/pack/auto-approve-path.js +0 -462
- package/dist/cli/pack/auto-approve-path.js.map +0 -1
- package/dist/cli/pack/hook-codex-post-tool-use.d.ts +0 -25
- package/dist/cli/pack/hook-codex-post-tool-use.js +0 -160
- package/dist/cli/pack/hook-codex-post-tool-use.js.map +0 -1
- package/dist/cli/pack/hook-codex-pre-tool-use.d.ts +0 -48
- package/dist/cli/pack/hook-codex-pre-tool-use.js +0 -474
- package/dist/cli/pack/hook-codex-pre-tool-use.js.map +0 -1
- package/dist/cli/pack/hook-codex-stop.d.ts +0 -35
- package/dist/cli/pack/hook-codex-stop.js +0 -329
- package/dist/cli/pack/hook-codex-stop.js.map +0 -1
- package/dist/cli/pack/hook-codex-user-prompt-submit.d.ts +0 -24
- package/dist/cli/pack/hook-codex-user-prompt-submit.js +0 -93
- package/dist/cli/pack/hook-codex-user-prompt-submit.js.map +0 -1
- package/dist/cli/pack/hook-post-merge-gate-record.d.ts +0 -37
- package/dist/cli/pack/hook-post-merge-gate-record.js +0 -190
- package/dist/cli/pack/hook-post-merge-gate-record.js.map +0 -1
- package/dist/cli/pack/hook-post-merge-gate.d.ts +0 -34
- package/dist/cli/pack/hook-post-merge-gate.js +0 -277
- package/dist/cli/pack/hook-post-merge-gate.js.map +0 -1
- package/dist/cli/pack/hook-post-tool-use.d.ts +0 -45
- package/dist/cli/pack/hook-post-tool-use.js +0 -137
- package/dist/cli/pack/hook-post-tool-use.js.map +0 -1
- package/dist/cli/pack/hook-pre-tool-use.d.ts +0 -92
- package/dist/cli/pack/hook-pre-tool-use.js +0 -1328
- package/dist/cli/pack/hook-pre-tool-use.js.map +0 -1
- package/dist/cli/pack/hook-runtime-reality.d.ts +0 -63
- package/dist/cli/pack/hook-runtime-reality.js +0 -210
- package/dist/cli/pack/hook-runtime-reality.js.map +0 -1
- package/dist/cli/pack/hook-solution-acceptance-writeguard.d.ts +0 -32
- package/dist/cli/pack/hook-solution-acceptance-writeguard.js +0 -438
- package/dist/cli/pack/hook-solution-acceptance-writeguard.js.map +0 -1
- package/dist/cli/pack/hook-solution-acceptance.d.ts +0 -157
- package/dist/cli/pack/hook-solution-acceptance.js +0 -530
- package/dist/cli/pack/hook-solution-acceptance.js.map +0 -1
- package/dist/cli/pack/hook-stay-in-scope.d.ts +0 -37
- package/dist/cli/pack/hook-stay-in-scope.js +0 -128
- package/dist/cli/pack/hook-stay-in-scope.js.map +0 -1
- package/dist/cli/pack/hook-subagent-start.d.ts +0 -23
- package/dist/cli/pack/hook-subagent-start.js +0 -88
- package/dist/cli/pack/hook-subagent-start.js.map +0 -1
- package/dist/cli/pack/hook-subagent-stop.d.ts +0 -19
- package/dist/cli/pack/hook-subagent-stop.js +0 -41
- package/dist/cli/pack/hook-subagent-stop.js.map +0 -1
- package/dist/cli/pack/hook-track-active-claim.d.ts +0 -27
- package/dist/cli/pack/hook-track-active-claim.js +0 -275
- package/dist/cli/pack/hook-track-active-claim.js.map +0 -1
- package/dist/cli/pack/transcript-report-scan.d.ts +0 -71
- package/dist/cli/pack/transcript-report-scan.js +0 -359
- package/dist/cli/pack/transcript-report-scan.js.map +0 -1
- package/dist/cli/pack/understanding-report-schema-hint.d.ts +0 -26
- package/dist/cli/pack/understanding-report-schema-hint.js +0 -120
- package/dist/cli/pack/understanding-report-schema-hint.js.map +0 -1
- package/dist/cli/pack/upgrade.d.ts +0 -32
- package/dist/cli/pack/upgrade.js +0 -273
- package/dist/cli/pack/upgrade.js.map +0 -1
- package/dist/cli/pause/index.d.ts +0 -113
- package/dist/cli/pause/index.js +0 -251
- package/dist/cli/pause/index.js.map +0 -1
- package/dist/cli/pause-check.d.ts +0 -22
- package/dist/cli/pause-check.js +0 -54
- package/dist/cli/pause-check.js.map +0 -1
- package/dist/cli/policy/intercept.d.ts +0 -233
- package/dist/cli/policy/intercept.js +0 -1022
- package/dist/cli/policy/intercept.js.map +0 -1
- package/dist/cli/policy/risk-envelope-enrichment.d.ts +0 -40
- package/dist/cli/policy/risk-envelope-enrichment.js +0 -110
- package/dist/cli/policy/risk-envelope-enrichment.js.map +0 -1
- package/dist/cli/record/index.d.ts +0 -81
- package/dist/cli/record/index.js +0 -348
- package/dist/cli/record/index.js.map +0 -1
- package/dist/cli/register-audit-group.js +0 -91
- package/dist/cli/register-audit-group.js.map +0 -1
- package/dist/cli/resolve-env.d.ts +0 -32
- package/dist/cli/resolve-env.js +0 -46
- package/dist/cli/resolve-env.js.map +0 -1
- package/dist/cli/session-export/index.d.ts +0 -46
- package/dist/cli/session-export/index.js +0 -169
- package/dist/cli/session-export/index.js.map +0 -1
- package/dist/cli/session-export/redact.d.ts +0 -22
- package/dist/cli/session-export/redact.js +0 -47
- package/dist/cli/session-export/redact.js.map +0 -1
- package/dist/cli/session-export/transcript.d.ts +0 -24
- package/dist/cli/session-export/transcript.js +0 -164
- package/dist/cli/session-export/transcript.js.map +0 -1
- package/dist/cli/session-start/branch-check.d.ts +0 -18
- package/dist/cli/session-start/branch-check.js +0 -140
- package/dist/cli/session-start/branch-check.js.map +0 -1
- package/dist/cli/session-start/index.d.ts +0 -121
- package/dist/cli/session-start/index.js +0 -591
- package/dist/cli/session-start/index.js.map +0 -1
- package/dist/cli/session-start/shared-options.d.ts +0 -103
- package/dist/cli/session-start/shared-options.js +0 -107
- package/dist/cli/session-start/shared-options.js.map +0 -1
- package/dist/cli/session-start/stale-base-check.d.ts +0 -46
- package/dist/cli/session-start/stale-base-check.js +0 -352
- package/dist/cli/session-start/stale-base-check.js.map +0 -1
- package/dist/cli/session-start/toolchain-parity.d.ts +0 -267
- package/dist/cli/session-start/toolchain-parity.js +0 -797
- package/dist/cli/session-start/toolchain-parity.js.map +0 -1
- package/dist/cli/smoke/assertions.d.ts +0 -46
- package/dist/cli/smoke/assertions.js +0 -170
- package/dist/cli/smoke/assertions.js.map +0 -1
- package/dist/cli/smoke/index.d.ts +0 -76
- package/dist/cli/smoke/index.js +0 -245
- package/dist/cli/smoke/index.js.map +0 -1
- package/dist/cli/smoke/runner.d.ts +0 -55
- package/dist/cli/smoke/runner.js +0 -134
- package/dist/cli/smoke/runner.js.map +0 -1
- package/dist/cli/smoke/stream-parser.d.ts +0 -65
- package/dist/cli/smoke/stream-parser.js +0 -115
- package/dist/cli/smoke/stream-parser.js.map +0 -1
- package/dist/cli/test-risk.d.ts +0 -27
- package/dist/cli/test-risk.js +0 -38
- package/dist/cli/test-risk.js.map +0 -1
- package/dist/io/display-path.d.ts +0 -11
- package/dist/io/display-path.js +0 -29
- package/dist/io/display-path.js.map +0 -1
- package/dist/io/duration.d.ts +0 -5
- package/dist/io/duration.js +0 -50
- package/dist/io/duration.js.map +0 -1
- package/dist/io/extract.d.ts +0 -79
- package/dist/io/extract.js +0 -226
- package/dist/io/extract.js.map +0 -1
- package/dist/io/ledger-record.d.ts +0 -83
- package/dist/io/ledger-record.js +0 -301
- package/dist/io/ledger-record.js.map +0 -1
- package/dist/io/read-json-dir-entries.d.ts +0 -36
- package/dist/io/read-json-dir-entries.js +0 -48
- package/dist/io/read-json-dir-entries.js.map +0 -1
- package/dist/io/safe-json-parse.d.ts +0 -5
- package/dist/io/safe-json-parse.js +0 -21
- package/dist/io/safe-json-parse.js.map +0 -1
- package/dist/policies/index.d.ts +0 -5
- package/dist/policies/index.js +0 -6
- package/dist/policies/index.js.map +0 -1
- package/dist/policies/ledger-client.d.ts +0 -113
- package/dist/policies/ledger-client.js +0 -500
- package/dist/policies/ledger-client.js.map +0 -1
- package/dist/policies/producers.d.ts +0 -12
- package/dist/policies/producers.js +0 -61
- package/dist/policies/producers.js.map +0 -1
- package/dist/policies/requires.d.ts +0 -75
- package/dist/policies/requires.js +0 -240
- package/dist/policies/requires.js.map +0 -1
- package/dist/policies/timestamp.d.ts +0 -14
- package/dist/policies/timestamp.js +0 -36
- package/dist/policies/timestamp.js.map +0 -1
- package/dist/policy-packs/builtin/permission-profiles.d.ts +0 -11
- package/dist/policy-packs/builtin/permission-profiles.js +0 -74
- package/dist/policy-packs/builtin/permission-profiles.js.map +0 -1
- package/dist/policy-packs/builtin/post-merge-gate-runtime.d.ts +0 -286
- package/dist/policy-packs/builtin/post-merge-gate-runtime.js +0 -397
- package/dist/policy-packs/builtin/post-merge-gate-runtime.js.map +0 -1
- package/dist/policy-packs/builtin/post-merge-gate.d.ts +0 -56
- package/dist/policy-packs/builtin/post-merge-gate.js +0 -347
- package/dist/policy-packs/builtin/post-merge-gate.js.map +0 -1
- package/dist/policy-packs/builtin/solution-acceptance-reconnect.d.ts +0 -50
- package/dist/policy-packs/builtin/solution-acceptance-reconnect.js +0 -151
- package/dist/policy-packs/builtin/solution-acceptance-reconnect.js.map +0 -1
- package/dist/policy-packs/builtin/solution-acceptance-runtime.d.ts +0 -323
- package/dist/policy-packs/builtin/solution-acceptance-runtime.js +0 -672
- package/dist/policy-packs/builtin/solution-acceptance-runtime.js.map +0 -1
- package/dist/policy-packs/builtin/solution-acceptance.d.ts +0 -45
- package/dist/policy-packs/builtin/solution-acceptance.js +0 -226
- package/dist/policy-packs/builtin/solution-acceptance.js.map +0 -1
- package/dist/policy-packs/builtin/understanding-before-execution/active-claim.d.ts +0 -25
- package/dist/policy-packs/builtin/understanding-before-execution/active-claim.js +0 -94
- package/dist/policy-packs/builtin/understanding-before-execution/active-claim.js.map +0 -1
- package/dist/policy-packs/builtin/understanding-before-execution/auto-approve-default.d.ts +0 -35
- package/dist/policy-packs/builtin/understanding-before-execution/auto-approve-default.js +0 -86
- package/dist/policy-packs/builtin/understanding-before-execution/auto-approve-default.js.map +0 -1
- package/dist/policy-packs/builtin/understanding-before-execution/auto-approve.d.ts +0 -210
- package/dist/policy-packs/builtin/understanding-before-execution/auto-approve.js +0 -361
- package/dist/policy-packs/builtin/understanding-before-execution/auto-approve.js.map +0 -1
- package/dist/policy-packs/builtin/understanding-before-execution/delegation-markers.d.ts +0 -304
- package/dist/policy-packs/builtin/understanding-before-execution/delegation-markers.js +0 -734
- package/dist/policy-packs/builtin/understanding-before-execution/delegation-markers.js.map +0 -1
- package/dist/policy-packs/builtin/understanding-before-execution/expiry-reason.d.ts +0 -36
- package/dist/policy-packs/builtin/understanding-before-execution/expiry-reason.js +0 -73
- package/dist/policy-packs/builtin/understanding-before-execution/expiry-reason.js.map +0 -1
- package/dist/policy-packs/builtin/understanding-before-execution/index.d.ts +0 -19
- package/dist/policy-packs/builtin/understanding-before-execution/index.js +0 -83
- package/dist/policy-packs/builtin/understanding-before-execution/index.js.map +0 -1
- package/dist/policy-packs/builtin/understanding-before-execution/inflight-records.d.ts +0 -135
- package/dist/policy-packs/builtin/understanding-before-execution/inflight-records.js +0 -643
- package/dist/policy-packs/builtin/understanding-before-execution/inflight-records.js.map +0 -1
- package/dist/policy-packs/builtin/understanding-before-execution/ledger.d.ts +0 -25
- package/dist/policy-packs/builtin/understanding-before-execution/ledger.js +0 -56
- package/dist/policy-packs/builtin/understanding-before-execution/ledger.js.map +0 -1
- package/dist/policy-packs/builtin/understanding-before-execution/lifecycle.d.ts +0 -20
- package/dist/policy-packs/builtin/understanding-before-execution/lifecycle.js +0 -106
- package/dist/policy-packs/builtin/understanding-before-execution/lifecycle.js.map +0 -1
- package/dist/policy-packs/builtin/understanding-before-execution/markers.d.ts +0 -126
- package/dist/policy-packs/builtin/understanding-before-execution/markers.js +0 -245
- package/dist/policy-packs/builtin/understanding-before-execution/markers.js.map +0 -1
- package/dist/policy-packs/builtin/understanding-before-execution/measured-permission-modes.d.ts +0 -29
- package/dist/policy-packs/builtin/understanding-before-execution/measured-permission-modes.js +0 -82
- package/dist/policy-packs/builtin/understanding-before-execution/measured-permission-modes.js.map +0 -1
- package/dist/policy-packs/builtin/understanding-before-execution/permission-mode-observations.d.ts +0 -71
- package/dist/policy-packs/builtin/understanding-before-execution/permission-mode-observations.js +0 -175
- package/dist/policy-packs/builtin/understanding-before-execution/permission-mode-observations.js.map +0 -1
- package/dist/policy-packs/builtin/understanding-before-execution/persisted-reports.d.ts +0 -625
- package/dist/policy-packs/builtin/understanding-before-execution/persisted-reports.js +0 -1076
- package/dist/policy-packs/builtin/understanding-before-execution/persisted-reports.js.map +0 -1
- package/dist/policy-packs/builtin/understanding-before-execution/post-tool-use-boundary.d.ts +0 -128
- package/dist/policy-packs/builtin/understanding-before-execution/post-tool-use-boundary.js +0 -213
- package/dist/policy-packs/builtin/understanding-before-execution/post-tool-use-boundary.js.map +0 -1
- package/dist/policy-packs/builtin/understanding-before-execution/stay-in-scope-config.d.ts +0 -129
- package/dist/policy-packs/builtin/understanding-before-execution/stay-in-scope-config.js +0 -166
- package/dist/policy-packs/builtin/understanding-before-execution/stay-in-scope-config.js.map +0 -1
- package/dist/policy-packs/builtin/understanding-before-execution/task-markers.d.ts +0 -164
- package/dist/policy-packs/builtin/understanding-before-execution/task-markers.js +0 -275
- package/dist/policy-packs/builtin/understanding-before-execution/task-markers.js.map +0 -1
- package/dist/policy-packs/builtin/understanding-before-execution-runtime.d.ts +0 -1
- package/dist/policy-packs/builtin/understanding-before-execution-runtime.js +0 -10
- package/dist/policy-packs/builtin/understanding-before-execution-runtime.js.map +0 -1
- package/dist/policy-packs/builtin/understanding-before-execution.d.ts +0 -526
- package/dist/policy-packs/builtin/understanding-before-execution.js +0 -1078
- package/dist/policy-packs/builtin/understanding-before-execution.js.map +0 -1
- package/dist/policy-packs/permission-translator.d.ts +0 -9
- package/dist/policy-packs/permission-translator.js +0 -76
- package/dist/policy-packs/permission-translator.js.map +0 -1
- package/dist/runtime/action-envelope.d.ts +0 -64
- package/dist/runtime/action-envelope.js +0 -46
- package/dist/runtime/action-envelope.js.map +0 -1
- package/dist/runtime/approval-signing.d.ts +0 -111
- package/dist/runtime/approval-signing.js +0 -384
- package/dist/runtime/approval-signing.js.map +0 -1
- package/dist/runtime/bash-match-facts.d.ts +0 -60
- package/dist/runtime/bash-match-facts.js +0 -196
- package/dist/runtime/bash-match-facts.js.map +0 -1
- package/dist/runtime/bash-match-registry.d.ts +0 -112
- package/dist/runtime/bash-match-registry.js +0 -406
- package/dist/runtime/bash-match-registry.js.map +0 -1
- package/dist/runtime/bash-prefix-parse.d.ts +0 -31
- package/dist/runtime/bash-prefix-parse.js +0 -576
- package/dist/runtime/bash-prefix-parse.js.map +0 -1
- package/dist/runtime/command-normalize.d.ts +0 -658
- package/dist/runtime/command-normalize.js +0 -2410
- package/dist/runtime/command-normalize.js.map +0 -1
- package/dist/runtime/deletion-target-resolve.d.ts +0 -28
- package/dist/runtime/deletion-target-resolve.js +0 -1078
- package/dist/runtime/deletion-target-resolve.js.map +0 -1
- package/dist/runtime/destructive-shell-floor.d.ts +0 -19
- package/dist/runtime/destructive-shell-floor.js +0 -611
- package/dist/runtime/destructive-shell-floor.js.map +0 -1
- package/dist/runtime/environment-resolver.d.ts +0 -36
- package/dist/runtime/environment-resolver.js +0 -138
- package/dist/runtime/environment-resolver.js.map +0 -1
- package/dist/runtime/git-context.d.ts +0 -201
- package/dist/runtime/git-context.js +0 -422
- package/dist/runtime/git-context.js.map +0 -1
- package/dist/runtime/index.d.ts +0 -12
- package/dist/runtime/index.js +0 -13
- package/dist/runtime/index.js.map +0 -1
- package/dist/runtime/intercept.d.ts +0 -623
- package/dist/runtime/intercept.js +0 -1384
- package/dist/runtime/intercept.js.map +0 -1
- package/dist/runtime/kube-context.d.ts +0 -16
- package/dist/runtime/kube-context.js +0 -63
- package/dist/runtime/kube-context.js.map +0 -1
- package/dist/runtime/kubectl-target-parse.d.ts +0 -31
- package/dist/runtime/kubectl-target-parse.js +0 -249
- package/dist/runtime/kubectl-target-parse.js.map +0 -1
- package/dist/runtime/ledger-add.d.ts +0 -16
- package/dist/runtime/ledger-add.js +0 -150
- package/dist/runtime/ledger-add.js.map +0 -1
- package/dist/runtime/ledger-writer.d.ts +0 -27
- package/dist/runtime/ledger-writer.js +0 -46
- package/dist/runtime/ledger-writer.js.map +0 -1
- package/dist/runtime/pause-sentinel.d.ts +0 -60
- package/dist/runtime/pause-sentinel.js +0 -156
- package/dist/runtime/pause-sentinel.js.map +0 -1
- package/dist/runtime/pending-approval.d.ts +0 -23
- package/dist/runtime/pending-approval.js +0 -67
- package/dist/runtime/pending-approval.js.map +0 -1
- package/dist/runtime/read-only-bash.d.ts +0 -141
- package/dist/runtime/read-only-bash.js +0 -2204
- package/dist/runtime/read-only-bash.js.map +0 -1
- package/dist/runtime/recovery-git-commit.d.ts +0 -22
- package/dist/runtime/recovery-git-commit.js +0 -284
- package/dist/runtime/recovery-git-commit.js.map +0 -1
- package/dist/runtime/reject-malformed-session-id.d.ts +0 -8
- package/dist/runtime/reject-malformed-session-id.js +0 -16
- package/dist/runtime/reject-malformed-session-id.js.map +0 -1
- package/dist/runtime/risk-classifier.d.ts +0 -38
- package/dist/runtime/risk-classifier.js +0 -311
- package/dist/runtime/risk-classifier.js.map +0 -1
- package/dist/runtime/session-id.d.ts +0 -113
- package/dist/runtime/session-id.js +0 -193
- package/dist/runtime/session-id.js.map +0 -1
- package/dist/runtime/shell-word.d.ts +0 -62
- package/dist/runtime/shell-word.js +0 -410
- package/dist/runtime/shell-word.js.map +0 -1
- package/dist/runtime/task-providers/agent-tasks.d.ts +0 -105
- package/dist/runtime/task-providers/agent-tasks.js +0 -247
- package/dist/runtime/task-providers/agent-tasks.js.map +0 -1
- package/dist/runtime/when-eval.d.ts +0 -62
- package/dist/runtime/when-eval.js +0 -212
- package/dist/runtime/when-eval.js.map +0 -1
- package/dist/runtime/workflow-policies.d.ts +0 -207
- package/dist/runtime/workflow-policies.js +0 -596
- package/dist/runtime/workflow-policies.js.map +0 -1
- package/dist/schema/audit.d.ts +0 -71
- package/dist/schema/audit.js +0 -32
- package/dist/schema/audit.js.map +0 -1
- package/dist/schema/doctor.d.ts +0 -25
- package/dist/schema/doctor.js +0 -23
- package/dist/schema/doctor.js.map +0 -1
- package/dist/schema/environments.d.ts +0 -215
- package/dist/schema/environments.js +0 -101
- package/dist/schema/environments.js.map +0 -1
- package/dist/schema/extract.d.ts +0 -9
- package/dist/schema/extract.js +0 -86
- package/dist/schema/extract.js.map +0 -1
- package/dist/schema/permission-profiles.d.ts +0 -2292
- package/dist/schema/permission-profiles.js +0 -60
- package/dist/schema/permission-profiles.js.map +0 -1
- package/dist/schema/policies.d.ts +0 -974
- package/dist/schema/policies.js +0 -298
- package/dist/schema/policies.js.map +0 -1
- package/dist/schema/requires.d.ts +0 -131
- package/dist/schema/requires.js +0 -88
- package/dist/schema/requires.js.map +0 -1
- package/dist/schema/risk.d.ts +0 -144
- package/dist/schema/risk.js +0 -194
- package/dist/schema/risk.js.map +0 -1
- package/dist/schema/session-start-preflight.d.ts +0 -10
- package/dist/schema/session-start-preflight.js +0 -106
- package/dist/schema/session-start-preflight.js.map +0 -1
- package/dist/schema/stale-base-check.d.ts +0 -18
- package/dist/schema/stale-base-check.js +0 -37
- package/dist/schema/stale-base-check.js.map +0 -1
- package/dist/schema/toolchain-parity.d.ts +0 -21
- package/dist/schema/toolchain-parity.js +0 -48
- package/dist/schema/toolchain-parity.js.map +0 -1
- package/dist/schema/workflows.d.ts +0 -519
- package/dist/schema/workflows.js +0 -81
- package/dist/schema/workflows.js.map +0 -1
- package/scripts/runtime-reality-docker-probe.mjs +0 -71
|
@@ -1,384 +0,0 @@
|
|
|
1
|
-
// harness/f9485cc7 — HMAC signing for Understanding Gate / branch-protection
|
|
2
|
-
// approval markers.
|
|
3
|
-
//
|
|
4
|
-
// BACKGROUND: the marker at `harness.generated/.approvals/<id>` is the
|
|
5
|
-
// canonical "operator said go" signal (agent-tasks/88ca4bb3). Its integrity
|
|
6
|
-
// has rested entirely on an UNENFORCED invariant: "no configured MCP exposes
|
|
7
|
-
// a filesystem-write primitive" (understanding-before-execution.md
|
|
8
|
-
// "Approval state"). Edit / Write / Bash are gated by the same PreToolUse
|
|
9
|
-
// hook this marker satisfies, so today the agent has no path to WRITE the
|
|
10
|
-
// marker file. But nothing technical stops a future MCP tool with local
|
|
11
|
-
// file-write from silently reopening that hole: its tool name would not
|
|
12
|
-
// match the pack's `Edit|Write|Bash` blocker matcher, so a write through it
|
|
13
|
-
// would land un-gated. Before this module, the marker's contract was
|
|
14
|
-
// "existence is enough" (see the removed `checkApprovalMarker` comment) —
|
|
15
|
-
// exactly the shape a forger only needs a bare filesystem-write for. This
|
|
16
|
-
// module makes forging also require the operator-side HMAC key, so a marker
|
|
17
|
-
// planted through any write-primitive the blocker does not enumerate still
|
|
18
|
-
// fails the gate unless it carries a valid signature.
|
|
19
|
-
//
|
|
20
|
-
// HONEST TRUST MODEL (read this before assuming more than it delivers):
|
|
21
|
-
//
|
|
22
|
-
// - This does NOT create a read boundary. The `understanding-before-
|
|
23
|
-
// execution` PreToolUse blocker matches tool names `Edit|Write|Bash`
|
|
24
|
-
// only — it does not gate `Read`, and no permission profile in this
|
|
25
|
-
// repo scopes `Read` away from any path (see
|
|
26
|
-
// `src/policy-packs/permission-translator.ts`: `read` maps to
|
|
27
|
-
// `["Read", "Glob", "Grep"]` with `allow:true` in every v1 profile).
|
|
28
|
-
// So ANY file on local disk — including the signing key, wherever it
|
|
29
|
-
// lives — is readable by the ordinary, always-available `Read` tool,
|
|
30
|
-
// approved or not. Storing the key outside `harness.generated/` would
|
|
31
|
-
// not change this; the write barrier is per-tool-name, not per-path.
|
|
32
|
-
// - The residual this leaves: an agent (or anything running as the same
|
|
33
|
-
// OS user) that can (a) read arbitrary local files — true today, by
|
|
34
|
-
// design, via `Read` — AND (b) write to `harness.generated/.approvals/`
|
|
35
|
-
// through some primitive NOT covered by the `Edit|Write|Bash` blocker
|
|
36
|
-
// matcher, CAN forge a validly-signed marker: it reads the key with
|
|
37
|
-
// Read, computes the HMAC itself, and writes the result through the
|
|
38
|
-
// uncovered write path. Signing does not close this combined case; it
|
|
39
|
-
// closes the narrower (and, before this, the ONLY defended) case where
|
|
40
|
-
// the forger has a write primitive but no matching ability to also
|
|
41
|
-
// recompute a valid signature for it (e.g. a narrow single-purpose
|
|
42
|
-
// write channel, or a human/script that copies bytes without reading
|
|
43
|
-
// back the operator's key file), and it makes ANY forgery attempt one
|
|
44
|
-
// step more expensive and forensically visible (a key read is a
|
|
45
|
-
// distinguishable event; a bare unsigned-JSON write no longer is).
|
|
46
|
-
// - SECOND MINTING PATH (agent-tasks/74b4b17d, ADR
|
|
47
|
-
// docs/decisions/2026-08-27-ug-auto-mode-approval.md): the residual
|
|
48
|
-
// above was a CONJUNCTION, read the key AND write through an
|
|
49
|
-
// uncovered primitive. Since the `auto_approve` opt-in of the
|
|
50
|
-
// `understanding-before-execution` pack, the PreToolUse hook itself
|
|
51
|
-
// can write a validly signed session marker (`approvedBy:
|
|
52
|
-
// auto-mode:<harness>:<mode>`) when the payload's `permission_mode`
|
|
53
|
-
// is allowlisted and a strict-session `pending` report exists. Any
|
|
54
|
-
// process that can invoke `harness pack hook pre-tool-use` with a
|
|
55
|
-
// stdin payload and `CLAUDE_CODE_SESSION_ID` of its choosing therefore
|
|
56
|
-
// obtains a signed marker for that session id WITHOUT reading the
|
|
57
|
-
// key: the residual is now a DISJUNCTION, read the key, OR make the
|
|
58
|
-
// hook sign for you. Reach, honestly: pre-approval the oracle is
|
|
59
|
-
// unreachable (invoking it is a Bash call, and `pack` is not on the
|
|
60
|
-
// read-only allowlist in `src/runtime/read-only-bash.ts`), so this
|
|
61
|
-
// is not an escalation over the post-approval write class, which can
|
|
62
|
-
// already forge by the key-read route; it is a cheaper and less
|
|
63
|
-
// forensically visible post-approval route (no key read to notice),
|
|
64
|
-
// and it is why the auto path never creates the key (explicit
|
|
65
|
-
// key-exists precheck before the shared write path), consumes the
|
|
66
|
-
// report it used, declines on a forged marker, and applies only
|
|
67
|
-
// after every existing exemption branch has declined. The pack's
|
|
68
|
-
// doctor listing of `auto-mode:` markers is the audit surface for it.
|
|
69
|
-
// - THIRD SIGNED ARTIFACT KIND (agent-tasks/37ad0b05, ADR
|
|
70
|
-
// docs/decisions/2026-08-27-ug-auto-mode-approval.md, slice 3): a
|
|
71
|
-
// DELEGATION is a third kind of thing this module signs, alongside
|
|
72
|
-
// the approval marker and the branch-protection marker, and it is
|
|
73
|
-
// not an approval, it is a pre-authorization a parent session
|
|
74
|
-
// issues for a `claude -p` child before the child's own report even
|
|
75
|
-
// exists. It is written to its own directory,
|
|
76
|
-
// `<generatedDir>/.delegations/`, never `.approvals/`, under
|
|
77
|
-
// markerId `delegation-<child-sid>` (`delegation-markers.ts`), so a
|
|
78
|
-
// copy of one into the other directory fails signature verification
|
|
79
|
-
// on markerId mismatch in both directions. Every binding (parent
|
|
80
|
-
// session, cwd, task, expiry, and, in the fallback shape, the
|
|
81
|
-
// launcher-supplied report's path) is packed into the signed
|
|
82
|
-
// `approvedBy` string rather than a new signed field, for the same
|
|
83
|
-
// no-migration reason the auto-marker's source lives there too. On
|
|
84
|
-
// a delegation, unlike on an approval marker, `reportContentHash`
|
|
85
|
-
// does NOT mean "the persisted report the operator approved", it
|
|
86
|
-
// means, when present at all, the sha256 of the launcher-supplied
|
|
87
|
-
// report FILE the parent wrote at spawn time (a file that need
|
|
88
|
-
// never become a persisted report byte-for-byte). A reader that
|
|
89
|
-
// consumes `reportContentHash` has to branch on the artifact kind
|
|
90
|
-
// (`.approvals/` vs. `.delegations/`, or the markerId prefix)
|
|
91
|
-
// before deciding what the hash refers to; treating the two
|
|
92
|
-
// uniformly would misread one of them. `harness delegate` is
|
|
93
|
-
// therefore a SECOND CLI writer into the signing scheme, beside the
|
|
94
|
-
// `harness approve` verbs: same key, same HMAC primitive, a
|
|
95
|
-
// different markerId namespace and a different meaning for one of
|
|
96
|
-
// the four signed fields.
|
|
97
|
-
// - Given the agent and operator share one OS user account on this
|
|
98
|
-
// machine, this is deliberately pragmatic defense-in-depth, not a hard
|
|
99
|
-
// authorization boundary. It is documented here in full rather than
|
|
100
|
-
// oversold.
|
|
101
|
-
//
|
|
102
|
-
// KEY STORAGE: `<generatedDir>/.approval-signing.key` — a raw 32-byte
|
|
103
|
-
// secret, mode 0600, generated lazily on first use (by `harness approve
|
|
104
|
-
// understanding` / `harness approve branch-protection`, or by `harness
|
|
105
|
-
// init` — see src/cli/init/index.ts; NEVER by the PreToolUse hook's auto
|
|
106
|
-
// path, which prechecks that the key exists and blocks when it does not). Colocated with `harness.generated/`
|
|
107
|
-
// (not a separate home-dir path) so:
|
|
108
|
-
// - it inherits the SAME test-isolation guarantee every marker/report
|
|
109
|
-
// path already has (every call site here already threads an explicit,
|
|
110
|
-
// test-injectable `generatedDir` — no new parameter, no new way to
|
|
111
|
-
// leak into a real `~/.harness/` during a test run);
|
|
112
|
-
// - it is gitignored by the SAME existing convention as the rest of
|
|
113
|
-
// `harness.generated/` (docs/ARCHITECTURE.md: "harness.generated/ ...
|
|
114
|
-
// is .gitignore'd", unlike `harness.yaml` itself, which operators
|
|
115
|
-
// often check into a dotfiles repo) — a home-dir-anchored path could
|
|
116
|
-
// land inside a version-controlled directory when the operator
|
|
117
|
-
// resolves `harness.yaml` via `--config` into a repo tree; this can't;
|
|
118
|
-
// - `harness apply` never wipes it (apply only ever writes its own known
|
|
119
|
-
// files under `harness.generated/`; unknown siblings survive
|
|
120
|
-
// byte-for-byte — the same guarantee `.approvals/` and
|
|
121
|
-
// `.pending-approval` already rely on).
|
|
122
|
-
// `harness uninstall` DOES remove it (it rm -rf's the whole
|
|
123
|
-
// `generatedDir`) — a deliberate, rare, operator-initiated teardown, so
|
|
124
|
-
// losing the key (and therefore invalidating every marker it signed) is
|
|
125
|
-
// an acceptable side effect, not a silent regression.
|
|
126
|
-
//
|
|
127
|
-
// ROTATION: delete `<generatedDir>/.approval-signing.key` (or call
|
|
128
|
-
// `rotateSigningKey`). The next `writeApprovalMarker` /
|
|
129
|
-
// `writeBranchProtectionMarker` / any signature check lazily regenerates
|
|
130
|
-
// it. Every marker signed under the OLD key immediately fails verification
|
|
131
|
-
// (forged:true) and the gate demands re-approval — this is the intended,
|
|
132
|
-
// documented blast radius of a rotation, not a bug.
|
|
133
|
-
//
|
|
134
|
-
// BACK-COMPAT: strict, no migration window. A marker written before this
|
|
135
|
-
// feature shipped (or hand-written without the key) carries no `signature`
|
|
136
|
-
// field and is REJECTED (see `verifyMarkerSignature`), exactly like a
|
|
137
|
-
// forgery. Operator impact: upgrading harness on a machine with a live,
|
|
138
|
-
// previously-approved session invalidates that approval; the operator runs
|
|
139
|
-
// `harness approve understanding` (and/or `harness approve
|
|
140
|
-
// branch-protection`) once more. Chosen over a grace-period migration
|
|
141
|
-
// because a migration window is, by construction, a window where the
|
|
142
|
-
// exact vulnerability this task closes (an unsigned marker satisfies the
|
|
143
|
-
// gate) still holds.
|
|
144
|
-
import * as crypto from "node:crypto";
|
|
145
|
-
import * as fs from "node:fs";
|
|
146
|
-
import * as path from "node:path";
|
|
147
|
-
/** Versioned algorithm tag, so a future re-key scheme can reject mismatches explicitly rather than guess. */
|
|
148
|
-
export const SIGNING_ALG = "hmac-sha256-v1";
|
|
149
|
-
/** Basename of the signing-key file, a sibling of `.approvals/` under `generatedDir`. */
|
|
150
|
-
export const SIGNING_KEY_BASENAME = ".approval-signing.key";
|
|
151
|
-
const KEY_BYTES = 32;
|
|
152
|
-
/** Filesystem path of the signing key for a given `generatedDir`. */
|
|
153
|
-
export function signingKeyPathFor(generatedDir) {
|
|
154
|
-
return path.join(generatedDir, SIGNING_KEY_BASENAME);
|
|
155
|
-
}
|
|
156
|
-
/**
|
|
157
|
-
* Read the signing key, generating one (0600, `crypto.randomBytes(32)`) on
|
|
158
|
-
* first use. Race-safe-ish: a concurrent create loses the `wx` (exclusive
|
|
159
|
-
* create) race and falls back to reading whatever the winner wrote, rather
|
|
160
|
-
* than throwing or clobbering it. A key file shorter than `KEY_BYTES`
|
|
161
|
-
* (truncated / corrupted) is treated as absent and regenerated, since a
|
|
162
|
-
* short key would only weaken every future signature.
|
|
163
|
-
*/
|
|
164
|
-
export function getOrCreateSigningKey(generatedDir) {
|
|
165
|
-
const filePath = signingKeyPathFor(generatedDir);
|
|
166
|
-
fs.mkdirSync(generatedDir, { recursive: true });
|
|
167
|
-
let fileExisted = false;
|
|
168
|
-
try {
|
|
169
|
-
const existing = fs.readFileSync(filePath);
|
|
170
|
-
fileExisted = true;
|
|
171
|
-
if (existing.length >= KEY_BYTES) {
|
|
172
|
-
return { key: existing, filePath, created: false };
|
|
173
|
-
}
|
|
174
|
-
// Falls through: truncated/corrupt key file, regenerate below. `flag:
|
|
175
|
-
// "w"` (not "wx") is used below precisely BECAUSE the file already
|
|
176
|
-
// exists here — an exclusive create would collide with it and, on
|
|
177
|
-
// EEXIST, re-read the SAME truncated bytes back, silently failing to
|
|
178
|
-
// ever repair a corrupt key.
|
|
179
|
-
}
|
|
180
|
-
catch (err) {
|
|
181
|
-
if (err.code !== "ENOENT")
|
|
182
|
-
throw err;
|
|
183
|
-
}
|
|
184
|
-
const fresh = crypto.randomBytes(KEY_BYTES);
|
|
185
|
-
if (fileExisted) {
|
|
186
|
-
// Known-corrupt/truncated file: overwrite unconditionally. No
|
|
187
|
-
// meaningful create-race to defend against — the file is already
|
|
188
|
-
// known bad, so unconditionally replacing it can only improve on
|
|
189
|
-
// the previous (unusable) contents.
|
|
190
|
-
fs.writeFileSync(filePath, fresh, { mode: 0o600 });
|
|
191
|
-
try {
|
|
192
|
-
fs.chmodSync(filePath, 0o600);
|
|
193
|
-
}
|
|
194
|
-
catch {
|
|
195
|
-
/* best-effort */
|
|
196
|
-
}
|
|
197
|
-
return { key: fresh, filePath, created: true };
|
|
198
|
-
}
|
|
199
|
-
try {
|
|
200
|
-
fs.writeFileSync(filePath, fresh, { mode: 0o600, flag: "wx" });
|
|
201
|
-
return { key: fresh, filePath, created: true };
|
|
202
|
-
}
|
|
203
|
-
catch (err) {
|
|
204
|
-
if (err.code === "EEXIST") {
|
|
205
|
-
// Lost the create race to a concurrent caller; use what they wrote.
|
|
206
|
-
return { key: fs.readFileSync(filePath), filePath, created: false };
|
|
207
|
-
}
|
|
208
|
-
throw err;
|
|
209
|
-
}
|
|
210
|
-
}
|
|
211
|
-
/**
|
|
212
|
-
* Force a fresh key, overwriting any existing one. Every marker signed
|
|
213
|
-
* under the old key stops verifying immediately (see module doc). Not
|
|
214
|
-
* currently wired to a CLI verb (documented as "delete the file" for v1);
|
|
215
|
-
* exported so a future `harness approve rotate-key`-style verb, or a test,
|
|
216
|
-
* can call it directly without re-deriving the path convention.
|
|
217
|
-
*/
|
|
218
|
-
export function rotateSigningKey(generatedDir) {
|
|
219
|
-
const filePath = signingKeyPathFor(generatedDir);
|
|
220
|
-
fs.mkdirSync(generatedDir, { recursive: true });
|
|
221
|
-
const fresh = crypto.randomBytes(KEY_BYTES);
|
|
222
|
-
fs.writeFileSync(filePath, fresh, { mode: 0o600 });
|
|
223
|
-
try {
|
|
224
|
-
fs.chmodSync(filePath, 0o600);
|
|
225
|
-
}
|
|
226
|
-
catch {
|
|
227
|
-
/* best-effort on platforms where chmod is a no-op (e.g. some Windows fs) */
|
|
228
|
-
}
|
|
229
|
-
return { key: fresh, filePath, created: true };
|
|
230
|
-
}
|
|
231
|
-
/**
|
|
232
|
-
* Non-creating existence probe for the signing key: `true` only when
|
|
233
|
-
* `<generatedDir>/.approval-signing.key` is a regular file carrying at
|
|
234
|
-
* least `KEY_BYTES` bytes. Never creates, repairs, or rotates anything.
|
|
235
|
-
*
|
|
236
|
-
* Why this exists as a separate export instead of "just call
|
|
237
|
-
* `getOrCreateSigningKey` and see" (ADR
|
|
238
|
-
* docs/decisions/2026-08-27-ug-auto-mode-approval.md, threat model (b)
|
|
239
|
-
* item 5): key CREATION is an operator-side act (`harness init` /
|
|
240
|
-
* `harness approve`). The PreToolUse hook's auto-approval path
|
|
241
|
-
* (agent-tasks/74b4b17d) must refuse to mint a marker on a machine that
|
|
242
|
-
* has no key, but the shared write path it uses (`writeApprovalMarker`
|
|
243
|
-
* -> `signMarker` -> `getOrCreateSigningKey`) treats a missing key as a
|
|
244
|
-
* case to REPAIR: it generates one on ENOENT and signs with it. So the
|
|
245
|
-
* auto path calls this first and blocks when it returns `false`.
|
|
246
|
-
*
|
|
247
|
-
* A truncated / short key file counts as absent here for the same
|
|
248
|
-
* reason: `getOrCreateSigningKey` would overwrite it with a fresh key,
|
|
249
|
-
* which is the same operator-side act this probe exists to keep the
|
|
250
|
-
* hook out of.
|
|
251
|
-
*/
|
|
252
|
-
export function signingKeyExists(generatedDir) {
|
|
253
|
-
try {
|
|
254
|
-
const stat = fs.statSync(signingKeyPathFor(generatedDir));
|
|
255
|
-
return stat.isFile() && stat.size >= KEY_BYTES;
|
|
256
|
-
}
|
|
257
|
-
catch {
|
|
258
|
-
return false;
|
|
259
|
-
}
|
|
260
|
-
}
|
|
261
|
-
/** sha256 hex digest of a string, used to bind a marker to a persisted report's content. */
|
|
262
|
-
export function sha256Hex(content) {
|
|
263
|
-
return crypto.createHash("sha256").update(content, "utf8").digest("hex");
|
|
264
|
-
}
|
|
265
|
-
function canonicalPayload(markerId, approvedAt, approvedBy, reportContentHash, claimTaskId) {
|
|
266
|
-
// Fixed key order + JSON string-escaping makes this injective: there is
|
|
267
|
-
// no (markerId, approvedAt, approvedBy, reportContentHash) tuple that
|
|
268
|
-
// collides with a different tuple's encoding, unlike naive delimiter
|
|
269
|
-
// concatenation (e.g. "a"+"bc" vs "ab"+"c").
|
|
270
|
-
//
|
|
271
|
-
// `claimTaskId` (task 5018c0c4) is the optional fifth field: the
|
|
272
|
-
// active-claim task id a session approval marker was granted for, or
|
|
273
|
-
// `null` for "no claim held". A marker that carries no binding (every
|
|
274
|
-
// task, delegation, in-flight and verdict marker, and a session marker
|
|
275
|
-
// written by an older release) signs and verifies over exactly the
|
|
276
|
-
// same bytes as before (the first branch below): no `SIGNING_ALG`
|
|
277
|
-
// bump, no migration. A present binding
|
|
278
|
-
// (string or `null`) is inside the signed bytes, so it cannot be added,
|
|
279
|
-
// dropped or changed without failing verification.
|
|
280
|
-
if (claimTaskId === undefined) {
|
|
281
|
-
return JSON.stringify({ markerId, approvedAt, approvedBy, reportContentHash });
|
|
282
|
-
}
|
|
283
|
-
return JSON.stringify({ markerId, approvedAt, approvedBy, reportContentHash, claimTaskId });
|
|
284
|
-
}
|
|
285
|
-
/**
|
|
286
|
-
* Sign a marker's fields for `markerId` (the marker's lookup key — a raw
|
|
287
|
-
* sessionId for the understanding-gate session marker, `task-<id>` for a
|
|
288
|
-
* task-scoped marker, `branch-protection-<sessionId>` for the
|
|
289
|
-
* branch-protection twin). Binding `markerId` into the signed payload is
|
|
290
|
-
* what stops a validly-signed marker from being copied/renamed onto a
|
|
291
|
-
* DIFFERENT id and still verifying — verification always recomputes the
|
|
292
|
-
* HMAC using the id the caller is checking, not one read back out of the
|
|
293
|
-
* marker body.
|
|
294
|
-
*/
|
|
295
|
-
export function signMarker(generatedDir, markerId, marker) {
|
|
296
|
-
const { key } = getOrCreateSigningKey(generatedDir);
|
|
297
|
-
const reportContentHash = marker.reportContentHash ?? null;
|
|
298
|
-
const signature = crypto
|
|
299
|
-
.createHmac("sha256", key)
|
|
300
|
-
.update(canonicalPayload(markerId, marker.approvedAt, marker.approvedBy, reportContentHash, marker.claimTaskId))
|
|
301
|
-
.digest("hex");
|
|
302
|
-
return {
|
|
303
|
-
approvedAt: marker.approvedAt,
|
|
304
|
-
approvedBy: marker.approvedBy,
|
|
305
|
-
reportContentHash,
|
|
306
|
-
...(marker.claimTaskId !== undefined ? { claimTaskId: marker.claimTaskId } : {}),
|
|
307
|
-
alg: SIGNING_ALG,
|
|
308
|
-
signature,
|
|
309
|
-
};
|
|
310
|
-
}
|
|
311
|
-
/**
|
|
312
|
-
* Verify a parsed marker JSON body against `markerId`. Never throws: any
|
|
313
|
-
* failure to obtain the signing key (permission error, disk issue) is
|
|
314
|
-
* treated as a verification failure, not an exception — the gate-side
|
|
315
|
-
* caller must fail closed (not approved) rather than crash the hook
|
|
316
|
-
* process, which the surrounding PreToolUse blocker would otherwise turn
|
|
317
|
-
* into an uncontrolled failure mode. That specific failure mode is tagged
|
|
318
|
-
* `kind: "key-unavailable"` so the caller can tell "we couldn't even check"
|
|
319
|
-
* apart from "we checked and it's invalid".
|
|
320
|
-
*/
|
|
321
|
-
export function verifyMarkerSignature(generatedDir, markerId, payload) {
|
|
322
|
-
const approvedAt = payload["approvedAt"];
|
|
323
|
-
const approvedBy = payload["approvedBy"];
|
|
324
|
-
const signature = payload["signature"];
|
|
325
|
-
const alg = payload["alg"];
|
|
326
|
-
if (typeof approvedAt !== "string" || approvedAt.length === 0) {
|
|
327
|
-
return { ok: false, reason: "missing approvedAt" };
|
|
328
|
-
}
|
|
329
|
-
if (typeof approvedBy !== "string" || approvedBy.length === 0) {
|
|
330
|
-
return { ok: false, reason: "missing approvedBy" };
|
|
331
|
-
}
|
|
332
|
-
if (typeof signature !== "string" || signature.length === 0) {
|
|
333
|
-
return {
|
|
334
|
-
ok: false,
|
|
335
|
-
reason: "missing signature (legacy pre-signing marker, or forged file)",
|
|
336
|
-
};
|
|
337
|
-
}
|
|
338
|
-
if (alg !== SIGNING_ALG) {
|
|
339
|
-
return { ok: false, reason: `unrecognized or missing alg (got ${JSON.stringify(alg)})` };
|
|
340
|
-
}
|
|
341
|
-
const reportContentHash = typeof payload["reportContentHash"] === "string"
|
|
342
|
-
? payload["reportContentHash"]
|
|
343
|
-
: null;
|
|
344
|
-
// Optional claim binding (task 5018c0c4): absent means "no binding"
|
|
345
|
-
// (verified over the pre-binding bytes); present must be a non-empty
|
|
346
|
-
// string or `null`, anything else is a malformed marker.
|
|
347
|
-
let claimTaskId;
|
|
348
|
-
if (Object.prototype.hasOwnProperty.call(payload, "claimTaskId")) {
|
|
349
|
-
const raw = payload["claimTaskId"];
|
|
350
|
-
if (raw === null || (typeof raw === "string" && raw.length > 0)) {
|
|
351
|
-
claimTaskId = raw;
|
|
352
|
-
}
|
|
353
|
-
else {
|
|
354
|
-
return { ok: false, reason: "malformed claimTaskId (expected a non-empty string or null)" };
|
|
355
|
-
}
|
|
356
|
-
}
|
|
357
|
-
let key;
|
|
358
|
-
try {
|
|
359
|
-
({ key } = getOrCreateSigningKey(generatedDir));
|
|
360
|
-
}
|
|
361
|
-
catch (err) {
|
|
362
|
-
return {
|
|
363
|
-
ok: false,
|
|
364
|
-
reason: `signing key unavailable (${err instanceof Error ? err.message : String(err)})`,
|
|
365
|
-
kind: "key-unavailable",
|
|
366
|
-
};
|
|
367
|
-
}
|
|
368
|
-
const expected = crypto
|
|
369
|
-
.createHmac("sha256", key)
|
|
370
|
-
.update(canonicalPayload(markerId, approvedAt, approvedBy, reportContentHash, claimTaskId))
|
|
371
|
-
.digest();
|
|
372
|
-
// No try/catch around Buffer.from(signature, "hex"): unlike JSON.parse,
|
|
373
|
-
// Buffer.from with a "hex" encoding never throws on malformed input — it
|
|
374
|
-
// silently stops decoding at the first invalid pair and returns whatever
|
|
375
|
-
// it managed to decode so far (review LOW 3). The length-mismatch check
|
|
376
|
-
// below is what actually rejects a truncated/malformed decode; relying on
|
|
377
|
-
// an exception here would have been dead code.
|
|
378
|
-
const actual = Buffer.from(signature, "hex");
|
|
379
|
-
if (actual.length !== expected.length || !crypto.timingSafeEqual(actual, expected)) {
|
|
380
|
-
return { ok: false, reason: "signature verification failed (tampered or forged)" };
|
|
381
|
-
}
|
|
382
|
-
return { ok: true };
|
|
383
|
-
}
|
|
384
|
-
//# sourceMappingURL=approval-signing.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"approval-signing.js","sourceRoot":"","sources":["../../src/runtime/approval-signing.ts"],"names":[],"mappings":"AAAA,6EAA6E;AAC7E,oBAAoB;AACpB,EAAE;AACF,uEAAuE;AACvE,4EAA4E;AAC5E,6EAA6E;AAC7E,mEAAmE;AACnE,0EAA0E;AAC1E,0EAA0E;AAC1E,wEAAwE;AACxE,wEAAwE;AACxE,4EAA4E;AAC5E,qEAAqE;AACrE,0EAA0E;AAC1E,0EAA0E;AAC1E,4EAA4E;AAC5E,2EAA2E;AAC3E,sDAAsD;AACtD,EAAE;AACF,wEAAwE;AACxE,EAAE;AACF,uEAAuE;AACvE,yEAAyE;AACzE,wEAAwE;AACxE,iDAAiD;AACjD,kEAAkE;AAClE,yEAAyE;AACzE,yEAAyE;AACzE,yEAAyE;AACzE,0EAA0E;AAC1E,yEAAyE;AACzE,0E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,CAAC,MAAM,IAAI,CAAC,MAAM,CAAC,eAAe,CAAC,MAAM,EAAE,QAAQ,CAAC,EAAE,CAAC;QACnF,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,oDAAoD,EAAE,CAAC;IACrF,CAAC;IACD,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,CAAC;AACtB,CAAC"}
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
import type { Policy } from "../schema/index.js";
|
|
2
|
-
/** How a classified head token relates to the engine's own coverage. */
|
|
3
|
-
export type HeadTokenClass = "git" | "non-git-set" | "documented-uncovered";
|
|
4
|
-
export interface HeadTokenFact {
|
|
5
|
-
readonly token: string;
|
|
6
|
-
readonly class: HeadTokenClass;
|
|
7
|
-
}
|
|
8
|
-
/** Exposed for callers that need the full "genuinely not covered today" list (see `bash-match-registry.ts`). */
|
|
9
|
-
export declare const DOCUMENTED_UNCOVERED_HEAD_TOKENS: ReadonlySet<string>;
|
|
10
|
-
export interface PolicyBashMatchFact {
|
|
11
|
-
readonly policyName: string;
|
|
12
|
-
readonly pattern: string;
|
|
13
|
-
readonly headTokens: readonly HeadTokenFact[];
|
|
14
|
-
readonly verbs: readonly string[];
|
|
15
|
-
}
|
|
16
|
-
export interface BashMatchFacts {
|
|
17
|
-
/** Every FULL_TEMPLATE policy name that declares a `bash_match` trigger, verified live. */
|
|
18
|
-
readonly policyNames: readonly string[];
|
|
19
|
-
/** Per-policy detail, in the same order as `policyNames`. */
|
|
20
|
-
readonly policies: readonly PolicyBashMatchFact[];
|
|
21
|
-
/** Every distinct head token gated by ANY `bash_match` policy, flattened. */
|
|
22
|
-
readonly gatedHeadTokens: ReadonlySet<string>;
|
|
23
|
-
/** The classification of a gated head token, or `undefined` if `token` is not gated by any shipped policy at all. */
|
|
24
|
-
classify(token: string): HeadTokenClass | undefined;
|
|
25
|
-
}
|
|
26
|
-
/** Minimal shape this module needs from a policy — decoupled from the full zod-inferred `Policy` so fixtures can be built without constructing an entire manifest. */
|
|
27
|
-
export interface BashMatchPolicyLike {
|
|
28
|
-
readonly name: string;
|
|
29
|
-
readonly trigger: {
|
|
30
|
-
readonly bash_match?: string | undefined;
|
|
31
|
-
};
|
|
32
|
-
}
|
|
33
|
-
/**
|
|
34
|
-
* Compute verified-fresh `BashMatchFacts` from a LIVE list of parsed
|
|
35
|
-
* policies. Call with `parseManifest(parseYaml(FULL_TEMPLATE)).policies`
|
|
36
|
-
* to get the shipped ground truth (never hand-copy the patterns).
|
|
37
|
-
*
|
|
38
|
-
* Throws descriptively — the caller should let this propagate as a
|
|
39
|
-
* failing test, not swallow it — when:
|
|
40
|
-
* 1. The exact SET of policy names carrying a `bash_match` trigger in
|
|
41
|
-
* the live `policies` differs from the curated map's key set
|
|
42
|
-
* (a policy was added, removed, or renamed).
|
|
43
|
-
* 2. A curated head token or verb is no longer present as a standalone
|
|
44
|
-
* word (`\bTOKEN\b`) in its policy's live pattern (renamed/removed
|
|
45
|
-
* within an otherwise still-existing policy).
|
|
46
|
-
*/
|
|
47
|
-
export declare function extractBashMatchFacts(policies: readonly (BashMatchPolicyLike | Policy)[]): BashMatchFacts;
|
|
48
|
-
/**
|
|
49
|
-
* "Is `token` gated by ANY shipped `bash_match` policy?", the one-call
|
|
50
|
-
* question both incidents got wrong. Real caller (task 209e6dc4 redesign):
|
|
51
|
-
* `bash-match-registry.ts`'s `checkRegisteredSets`, via its
|
|
52
|
-
* `isLegitimatelyCoverable` helper, a source-based probe over the live
|
|
53
|
-
* gated-head-token vocabulary (and `PLAUSIBLE_NON_GATED_HEAD_TOKENS`),
|
|
54
|
-
* never a per-declared-`member` walk; the registration surface no longer
|
|
55
|
-
* has a `members` field to walk. Takes only the `gatedHeadTokens` slice of
|
|
56
|
-
* `BashMatchFacts` (not the full shape) so a caller holding the same
|
|
57
|
-
* narrowed `Pick` `checkRegisteredSets` accepts can call this directly
|
|
58
|
-
* without widening its own parameter type.
|
|
59
|
-
*/
|
|
60
|
-
export declare function isHeadTokenGated(facts: Pick<BashMatchFacts, "gatedHeadTokens">, token: string): boolean;
|
|
@@ -1,196 +0,0 @@
|
|
|
1
|
-
// Live facts about FULL_TEMPLATE's shipped `bash_match` policies (task
|
|
2
|
-
// `074acf5d`, run `2026-07-28-manifest-facts-drift-guard`).
|
|
3
|
-
//
|
|
4
|
-
// WHY THIS MODULE EXISTS: two consecutive runs shipped/attempted a defect
|
|
5
|
-
// of the exact same CLASS, one day and one file apart.
|
|
6
|
-
// - Run `432db3d3` (merged 2026-07-27), HIGH: `NON_GIT_HEAD_TOKENS`
|
|
7
|
-
// (`command-normalize.ts`) covered 4 of the 8 head tokens a shipped
|
|
8
|
-
// `bash_match` policy actually gates. Closed by
|
|
9
|
-
// `tests/runtime/bash-match-head-token-drift.test.ts`, but scoped to
|
|
10
|
-
// that one set in that one file.
|
|
11
|
-
// - Run `dbc6d303` (halted 2026-07-28), CRITICAL: a NEW module's
|
|
12
|
-
// `INERT_CONSUMER_HEADS` contained `harness` — itself the gated head
|
|
13
|
-
// token of `deny-kill-switch-bypass`. The prior day's guard
|
|
14
|
-
// structurally could not see it: it only ever compared ONE named set
|
|
15
|
-
// (`NON_GIT_HEAD_TOKENS`) against the manifest, never a set someone
|
|
16
|
-
// adds tomorrow.
|
|
17
|
-
// This module answers, ONE call, read live (never hand-copied): "which
|
|
18
|
-
// policies declare a `bash_match`, which head token(s) each anchors on,
|
|
19
|
-
// which verbs, and is token X gated by ANY of them?" — the question both
|
|
20
|
-
// incidents got wrong. `src/runtime/bash-match-registry.ts` builds the
|
|
21
|
-
// generalised, EVERY-registered-set guard on top of the facts this module
|
|
22
|
-
// produces.
|
|
23
|
-
//
|
|
24
|
-
// DESIGN: literal head-token extraction straight out of an arbitrary
|
|
25
|
-
// regex string is fragile (alternations, nested groups, nothing
|
|
26
|
-
// guarantees a token is even a bare word) — the same reasoning the
|
|
27
|
-
// migrated guard's own header carried. A CURATED classification map is
|
|
28
|
-
// used instead, but it is never trusted blind: `extractBashMatchFacts`
|
|
29
|
-
// verifies it against the LIVE policies passed in (call it with
|
|
30
|
-
// `parseManifest(parseYaml(FULL_TEMPLATE)).policies` to get the shipped
|
|
31
|
-
// ground truth) and THROWS descriptively the moment the curated map and
|
|
32
|
-
// the live manifest disagree — a policy added/removed/renamed, or a
|
|
33
|
-
// classified token no longer present in its policy's live pattern. A
|
|
34
|
-
// caller that gets a `BashMatchFacts` back without an exception is
|
|
35
|
-
// holding verified-fresh facts, not a stale copy.
|
|
36
|
-
//
|
|
37
|
-
// LAYERING: this module takes policies as a plain parameter and does not
|
|
38
|
-
// import `FULL_TEMPLATE` itself (that lives in `src/cli/init/templates.ts`,
|
|
39
|
-
// the `cli` layer — `.dependency-cruiser.cjs`'s `runtime-no-upward-imports`
|
|
40
|
-
// rule forbids `runtime/` importing `cli/`). The live wiring (parsing
|
|
41
|
-
// FULL_TEMPLATE and calling this module) happens in test code, which the
|
|
42
|
-
// boundary check does not scan.
|
|
43
|
-
//
|
|
44
|
-
// WHY src/runtime/, NOT tests/ (F8, fix round): this module and
|
|
45
|
-
// `bash-match-registry.ts` are a single shared source of truth that TWO
|
|
46
|
-
// independent test files (`bash-match-head-token-drift.test.ts`,
|
|
47
|
-
// `bash-match-registry.test.ts`) import symmetrically — a module peer
|
|
48
|
-
// test files both depend on belongs beside the engine code it inspects,
|
|
49
|
-
// not inside the test tree that merely happens to hold its only callers
|
|
50
|
-
// today.
|
|
51
|
-
/**
|
|
52
|
-
* The curated ground truth, verified fresh against FULL_TEMPLATE's live
|
|
53
|
-
* policies by `extractBashMatchFacts` every time it runs — see the module
|
|
54
|
-
* header. Keyed by policy name.
|
|
55
|
-
*
|
|
56
|
-
* "documented-uncovered" tokens (fix round 2, finding F1 on the migrated
|
|
57
|
-
* guard — see `command-normalize.ts`'s "SHIPPED BUT NOT COVERED"
|
|
58
|
-
* paragraph for why each is genuinely out of reach today, not merely
|
|
59
|
-
* unimplemented): `env`, `unset`, `tee`, `cp`.
|
|
60
|
-
*/
|
|
61
|
-
const CURATED_BASH_MATCH_FACTS = {
|
|
62
|
-
"review-before-merge-bash": {
|
|
63
|
-
headTokens: [{ token: "gh", class: "non-git-set" }],
|
|
64
|
-
verbs: ["merge"],
|
|
65
|
-
},
|
|
66
|
-
"dogfood-before-release": {
|
|
67
|
-
headTokens: [
|
|
68
|
-
{ token: "npm", class: "non-git-set" },
|
|
69
|
-
{ token: "git", class: "git" },
|
|
70
|
-
],
|
|
71
|
-
verbs: ["publish", "tag"],
|
|
72
|
-
},
|
|
73
|
-
"preflight-before-investigation": {
|
|
74
|
-
headTokens: [{ token: "git", class: "git" }],
|
|
75
|
-
verbs: ["status", "log", "diff", "branch"],
|
|
76
|
-
},
|
|
77
|
-
"review-subagent-before-pr-create-bash": {
|
|
78
|
-
headTokens: [{ token: "gh", class: "non-git-set" }],
|
|
79
|
-
verbs: ["create"],
|
|
80
|
-
},
|
|
81
|
-
"preflight-before-push": {
|
|
82
|
-
headTokens: [{ token: "git", class: "git" }],
|
|
83
|
-
verbs: ["push"],
|
|
84
|
-
},
|
|
85
|
-
"deny-kill-switch-bypass": {
|
|
86
|
-
headTokens: [{ token: "harness", class: "non-git-set" }],
|
|
87
|
-
verbs: ["pause", "resume", "gate", "disable", "enable"],
|
|
88
|
-
},
|
|
89
|
-
"deny-session-env-strip": {
|
|
90
|
-
headTokens: [
|
|
91
|
-
{ token: "env", class: "documented-uncovered" },
|
|
92
|
-
{ token: "unset", class: "documented-uncovered" },
|
|
93
|
-
],
|
|
94
|
-
// Headless trigger alternatives (the bare `<SESSION_VAR>=` form) and
|
|
95
|
-
// multiple independent alternations make a flat verb list misleading
|
|
96
|
-
// rather than merely incomplete — left empty rather than overclaim.
|
|
97
|
-
verbs: [],
|
|
98
|
-
},
|
|
99
|
-
"deny-pause-sentinel-forgery": {
|
|
100
|
-
headTokens: [
|
|
101
|
-
{ token: "tee", class: "documented-uncovered" },
|
|
102
|
-
{ token: "cp", class: "documented-uncovered" },
|
|
103
|
-
],
|
|
104
|
-
// No separate "verb" beyond the head tokens themselves here.
|
|
105
|
-
verbs: [],
|
|
106
|
-
},
|
|
107
|
-
};
|
|
108
|
-
/**
|
|
109
|
-
* `documented-uncovered` head tokens are collected from the curated map
|
|
110
|
-
* itself (single source of truth) rather than hand-copied a second time.
|
|
111
|
-
*/
|
|
112
|
-
function documentedUncoveredTokens() {
|
|
113
|
-
const out = new Set();
|
|
114
|
-
for (const fact of Object.values(CURATED_BASH_MATCH_FACTS)) {
|
|
115
|
-
for (const h of fact.headTokens) {
|
|
116
|
-
if (h.class === "documented-uncovered")
|
|
117
|
-
out.add(h.token);
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
return out;
|
|
121
|
-
}
|
|
122
|
-
/** Exposed for callers that need the full "genuinely not covered today" list (see `bash-match-registry.ts`). */
|
|
123
|
-
export const DOCUMENTED_UNCOVERED_HEAD_TOKENS = documentedUncoveredTokens();
|
|
124
|
-
/**
|
|
125
|
-
* Compute verified-fresh `BashMatchFacts` from a LIVE list of parsed
|
|
126
|
-
* policies. Call with `parseManifest(parseYaml(FULL_TEMPLATE)).policies`
|
|
127
|
-
* to get the shipped ground truth (never hand-copy the patterns).
|
|
128
|
-
*
|
|
129
|
-
* Throws descriptively — the caller should let this propagate as a
|
|
130
|
-
* failing test, not swallow it — when:
|
|
131
|
-
* 1. The exact SET of policy names carrying a `bash_match` trigger in
|
|
132
|
-
* the live `policies` differs from the curated map's key set
|
|
133
|
-
* (a policy was added, removed, or renamed).
|
|
134
|
-
* 2. A curated head token or verb is no longer present as a standalone
|
|
135
|
-
* word (`\bTOKEN\b`) in its policy's live pattern (renamed/removed
|
|
136
|
-
* within an otherwise still-existing policy).
|
|
137
|
-
*/
|
|
138
|
-
export function extractBashMatchFacts(policies) {
|
|
139
|
-
const live = policies.filter((p) => p.trigger.bash_match !== undefined);
|
|
140
|
-
const actualNames = [...live.map((p) => p.name)].sort();
|
|
141
|
-
const curatedNames = Object.keys(CURATED_BASH_MATCH_FACTS).sort();
|
|
142
|
-
if (JSON.stringify(actualNames) !== JSON.stringify(curatedNames)) {
|
|
143
|
-
throw new Error(`bash_match facts drift: the live policies declaring a bash_match trigger (${JSON.stringify(actualNames)}) no longer match CURATED_BASH_MATCH_FACTS's classified set (${JSON.stringify(curatedNames)}) in src/runtime/bash-match-facts.ts. A policy was added, removed, or renamed — update the curated map consciously.`);
|
|
144
|
-
}
|
|
145
|
-
const byName = new Map(live.map((p) => [p.name, p]));
|
|
146
|
-
const gatedHeadTokens = new Set();
|
|
147
|
-
const classification = new Map();
|
|
148
|
-
const policyFacts = [];
|
|
149
|
-
for (const policyName of curatedNames) {
|
|
150
|
-
const curated = CURATED_BASH_MATCH_FACTS[policyName];
|
|
151
|
-
const policy = byName.get(policyName);
|
|
152
|
-
const pattern = policy.trigger.bash_match;
|
|
153
|
-
for (const { token, class: cls } of curated.headTokens) {
|
|
154
|
-
assertStandaloneWord(pattern, token, policyName);
|
|
155
|
-
gatedHeadTokens.add(token);
|
|
156
|
-
classification.set(token, cls);
|
|
157
|
-
}
|
|
158
|
-
for (const verb of curated.verbs) {
|
|
159
|
-
assertStandaloneWord(pattern, verb, policyName);
|
|
160
|
-
}
|
|
161
|
-
policyFacts.push({
|
|
162
|
-
policyName,
|
|
163
|
-
pattern,
|
|
164
|
-
headTokens: curated.headTokens,
|
|
165
|
-
verbs: curated.verbs,
|
|
166
|
-
});
|
|
167
|
-
}
|
|
168
|
-
return {
|
|
169
|
-
policyNames: actualNames,
|
|
170
|
-
policies: policyFacts,
|
|
171
|
-
gatedHeadTokens,
|
|
172
|
-
classify: (token) => classification.get(token),
|
|
173
|
-
};
|
|
174
|
-
}
|
|
175
|
-
function assertStandaloneWord(pattern, word, policyName) {
|
|
176
|
-
const standaloneWordRe = new RegExp(`\\b${word}\\b`);
|
|
177
|
-
if (!standaloneWordRe.test(pattern)) {
|
|
178
|
-
throw new Error(`bash_match facts drift: policy "${policyName}"'s live bash_match pattern no longer contains the classified word "${word}" as a standalone word (pattern: ${pattern}). It was renamed or removed — update CURATED_BASH_MATCH_FACTS in src/runtime/bash-match-facts.ts.`);
|
|
179
|
-
}
|
|
180
|
-
}
|
|
181
|
-
/**
|
|
182
|
-
* "Is `token` gated by ANY shipped `bash_match` policy?", the one-call
|
|
183
|
-
* question both incidents got wrong. Real caller (task 209e6dc4 redesign):
|
|
184
|
-
* `bash-match-registry.ts`'s `checkRegisteredSets`, via its
|
|
185
|
-
* `isLegitimatelyCoverable` helper, a source-based probe over the live
|
|
186
|
-
* gated-head-token vocabulary (and `PLAUSIBLE_NON_GATED_HEAD_TOKENS`),
|
|
187
|
-
* never a per-declared-`member` walk; the registration surface no longer
|
|
188
|
-
* has a `members` field to walk. Takes only the `gatedHeadTokens` slice of
|
|
189
|
-
* `BashMatchFacts` (not the full shape) so a caller holding the same
|
|
190
|
-
* narrowed `Pick` `checkRegisteredSets` accepts can call this directly
|
|
191
|
-
* without widening its own parameter type.
|
|
192
|
-
*/
|
|
193
|
-
export function isHeadTokenGated(facts, token) {
|
|
194
|
-
return facts.gatedHeadTokens.has(token);
|
|
195
|
-
}
|
|
196
|
-
//# sourceMappingURL=bash-match-facts.js.map
|