@lannguyensi/harness 0.63.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 +90 -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 -338
- 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 -705
- 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 -378
- 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 +15 -2607
- 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 -243
- 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/register-gate-group.d.ts +5 -0
- 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 +5 -0
- package/dist/cli/register-operator-lifecycle.js +20 -0
- package/dist/cli/register-operator-lifecycle.js.map +1 -0
- 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-setup-group.d.ts +5 -0
- 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.d.ts +5 -0
- package/dist/cli/remove/register.js +25 -0
- package/dist/cli/remove/register.js.map +1 -0
- 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.d.ts +5 -0
- package/dist/cli/uninstall/register.js +171 -0
- package/dist/cli/uninstall/register.js.map +1 -0
- 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 -443
- package/dist/cli/delegate/index.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/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 -46
- package/dist/cli/dry-run.js +0 -250
- package/dist/cli/dry-run.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 -20
- package/dist/cli/explain-action.js +0 -27
- package/dist/cli/explain-action.js.map +0 -1
- package/dist/cli/explain-policy.d.ts +0 -135
- package/dist/cli/explain-policy.js +0 -266
- 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 -337
- 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 -1020
- 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 -108
- 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/resolve-env.d.ts +0 -32
- package/dist/cli/resolve-env.js +0 -47
- 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 -26
- package/dist/cli/test-risk.js +0 -34
- 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 -618
- 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 -93
- 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 -620
- package/dist/policy-packs/builtin/understanding-before-execution/persisted-reports.js +0 -1047
- 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 -1074
- 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 -494
- package/dist/runtime/intercept.js +0 -1313
- 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 -103
- package/dist/runtime/task-providers/agent-tasks.js +0 -245
- 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,98 +0,0 @@
|
|
|
1
|
-
// Advisory check (task 24abdecb): warn (never error) when the operator's
|
|
2
|
-
// process environment carries `UNDERSTANDING_GATE_MODE` and it diverges
|
|
3
|
-
// from `policy_packs[understanding-before-execution].config.mode`.
|
|
4
|
-
//
|
|
5
|
-
// Context (Batch 11 verification round, reviewer finding on task
|
|
6
|
-
// 5d73d78d): after that fix, `resolveModeFromConfig` (config-only, no env
|
|
7
|
-
// read) drives every GENERATION-path artefact — `harness apply`'s
|
|
8
|
-
// settings.json / instructions.md, and `resolveBuiltinDefaultConfig` in
|
|
9
|
-
// `../../policy-packs/registry.ts` (consumed by this doctor's own
|
|
10
|
-
// UX-drift comparison). Only the LIVE runtime path — `resolveMode` in
|
|
11
|
-
// `approve/understanding.ts`'s stdin-report gap-fill, and the Codex
|
|
12
|
-
// `UserPromptSubmit` injector — still reads `UNDERSTANDING_GATE_MODE`
|
|
13
|
-
// (Env > config.mode > default), by design: it is the documented one-off
|
|
14
|
-
// override mechanism, mirroring `@lannguyensi/understanding-gate`'s own
|
|
15
|
-
// "env wins because operators set it consciously" rule (see `MODE_ENV`'s
|
|
16
|
-
// doc comment in `understanding-before-execution.ts`).
|
|
17
|
-
//
|
|
18
|
-
// The gap this check closes: an operator who carries the variable in
|
|
19
|
-
// their shell profile (rather than a one-off inline override) silently
|
|
20
|
-
// downgrades enforcement relative to what `harness.yaml` declares, with
|
|
21
|
-
// no signal anywhere that generation and the live path have diverged.
|
|
22
|
-
// Live-verified: `harness approve understanding` accepted a
|
|
23
|
-
// `fast_confirm`-shaped report against a `grill_me`-configured manifest
|
|
24
|
-
// with no warning. The divergence is agent-unreachable (it only bites at
|
|
25
|
-
// approve time, run from the operator's own shell), so `harness doctor`
|
|
26
|
-
// — which already reads `process.env` for env-dependent checks, e.g.
|
|
27
|
-
// `checkNpmBinPath` (`npm-bin-path.ts`) and the dead-settings.json-block
|
|
28
|
-
// lookup (`claude-mcp.ts`) — is the right place to surface it.
|
|
29
|
-
//
|
|
30
|
-
// Deliberately advisory, never an error: the env override is a
|
|
31
|
-
// legitimate, documented escape hatch, not a misconfiguration. The gap is
|
|
32
|
-
// visibility (the operator may not remember the variable is still
|
|
33
|
-
// exported), not validity.
|
|
34
|
-
import { isMode, MODE_ENV, PACK_NAME as UNDERSTANDING_PACK_NAME, resolveModeFromConfig, } from "../../policy-packs/builtin/understanding-before-execution.js";
|
|
35
|
-
/**
|
|
36
|
-
* Pure: manifest + env in, a divergence report out (or `undefined` when
|
|
37
|
-
* there is nothing to flag). Only fires when:
|
|
38
|
-
* - the `understanding-before-execution` pack is declared AND enabled
|
|
39
|
-
* (a pack that never runs has no live mode for the env to diverge
|
|
40
|
-
* from — mirrors the enabled-gate other doctor sections use, e.g.
|
|
41
|
-
* `buildGrounding`'s `groundingServer` lookup in `index.ts`);
|
|
42
|
-
* - `UNDERSTANDING_GATE_MODE` is set to a non-empty value AND, once
|
|
43
|
-
* trimmed/lower-cased the same way `resolveMode` normalises it,
|
|
44
|
-
* resolves to a recognised {@link Mode}. An env value the live
|
|
45
|
-
* runtime would itself reject (unset, empty, or unrecognised) cannot
|
|
46
|
-
* diverge from anything — the live resolver falls back to
|
|
47
|
-
* `config.mode` in that case too, so there is no enforcement gap to
|
|
48
|
-
* warn about.
|
|
49
|
-
* - the normalised env mode differs from the resolved `config.mode`.
|
|
50
|
-
*/
|
|
51
|
-
/**
|
|
52
|
-
* Shared gate for the understanding-gate doctor sub-checks that only
|
|
53
|
-
* make sense when the pack is actually live: this divergence advisory,
|
|
54
|
-
* and (ADR docs/decisions/2026-08-27-ug-auto-mode-approval.md slice 1,
|
|
55
|
-
* agent-tasks 74b4b17d) the auto-approval listing and settings-drift
|
|
56
|
-
* checks. Declared-but-disabled counts as not enabled, mirroring the
|
|
57
|
-
* `p.enabled !== false` gate `checkUnderstandingModeEnvDivergence` uses
|
|
58
|
-
* inline below.
|
|
59
|
-
*/
|
|
60
|
-
export function findEnabledUnderstandingPack(manifest) {
|
|
61
|
-
return manifest.policy_packs.find((p) => p.name === UNDERSTANDING_PACK_NAME && p.enabled !== false);
|
|
62
|
-
}
|
|
63
|
-
export function isUnderstandingPackEnabled(manifest) {
|
|
64
|
-
return findEnabledUnderstandingPack(manifest) !== undefined;
|
|
65
|
-
}
|
|
66
|
-
export function checkUnderstandingModeEnvDivergence(manifest, env) {
|
|
67
|
-
const pack = findEnabledUnderstandingPack(manifest);
|
|
68
|
-
if (!pack)
|
|
69
|
-
return undefined;
|
|
70
|
-
const envRaw = env[MODE_ENV];
|
|
71
|
-
if (envRaw === undefined || envRaw === "")
|
|
72
|
-
return undefined;
|
|
73
|
-
const normalizedEnv = envRaw.trim().toLowerCase();
|
|
74
|
-
if (!isMode(normalizedEnv))
|
|
75
|
-
return undefined;
|
|
76
|
-
const { mode: configMode, warning: configWarning } = resolveModeFromConfig(pack);
|
|
77
|
-
if (normalizedEnv === configMode)
|
|
78
|
-
return undefined;
|
|
79
|
-
// `configMode` is the RESOLVED (effective) value, not necessarily what's
|
|
80
|
-
// literally written in harness.yaml: when `resolveModeFromConfig` itself
|
|
81
|
-
// had to fall back (an unset or unrecognised `config.mode`, signalled by
|
|
82
|
-
// a non-null `configWarning`), attributing it to "(from harness.yaml)"
|
|
83
|
-
// would be a false verbatim claim. Drop the parenthetical in that case;
|
|
84
|
-
// the value is still the correct effective mode, just not YAML-sourced.
|
|
85
|
-
const attribution = configWarning ? "" : " (from harness.yaml)";
|
|
86
|
-
return {
|
|
87
|
-
envMode: normalizedEnv,
|
|
88
|
-
configMode,
|
|
89
|
-
message: `${MODE_ENV}=${normalizedEnv} diverges from config.mode=${configMode}`,
|
|
90
|
-
detail: [
|
|
91
|
-
"live runtime consumers (`harness approve understanding`'s stdin-report gap-fill, the " +
|
|
92
|
-
`Codex UserPromptSubmit injector) read the env, so enforcement is effectively "${normalizedEnv}"`,
|
|
93
|
-
`effective config.mode=${configMode}${attribution}`,
|
|
94
|
-
`if this is not a deliberate one-off override, unset ${MODE_ENV} in your shell profile`,
|
|
95
|
-
],
|
|
96
|
-
};
|
|
97
|
-
}
|
|
98
|
-
//# sourceMappingURL=understanding-mode-env.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"understanding-mode-env.js","sourceRoot":"","sources":["../../../src/cli/doctor/understanding-mode-env.ts"],"names":[],"mappings":"AAAA,yEAAyE;AACzE,wEAAwE;AACxE,mEAAmE;AACnE,EAAE;AACF,iEAAiE;AACjE,0EAA0E;AAC1E,kEAAkE;AAClE,wEAAwE;AACxE,kEAAkE;AAClE,sEAAsE;AACtE,oEAAoE;AACpE,sEAAsE;AACtE,yEAAyE;AACzE,wEAAwE;AACxE,yEAAyE;AACzE,uDAAuD;AACvD,EAAE;AACF,qEAAqE;AACrE,uEAAuE;AACvE,wEAAwE;AACxE,sEAAsE;AACtE,4DAA4D;AAC5D,wEAAwE;AACxE,yEAAyE;AACzE,wEAAwE;AACxE,qEAAqE;AACrE,yEAAyE;AACzE,+DAA+D;AAC/D,EAAE;AACF,+DAA+D;AAC/D,0EAA0E;AAC1E,kEAAkE;AAClE,2BAA2B;AAE3B,OAAO,EACL,MAAM,EACN,QAAQ,EACR,SAAS,IAAI,uBAAuB,EACpC,qBAAqB,GAEtB,MAAM,8DAA8D,CAAC;AAyBtE;;;;;;;;;;;;;;;GAeG;AACH;;;;;;;;GAQG;AACH,MAAM,U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FAAiF,aAAa,GAAG;YACnG,yBAAyB,UAAU,GAAG,WAAW,EAAE;YACnD,uDAAuD,QAAQ,wBAAwB;SACxF;KACF,CAAC;AACJ,CAAC"}
|
package/dist/cli/dry-run.d.ts
DELETED
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import { type ExtractBuiltins } from "../policies/index.js";
|
|
2
|
-
import type { Policy } from "../schema/index.js";
|
|
3
|
-
import { type LoaderOptions } from "./loader.js";
|
|
4
|
-
export interface DryRunOptions extends LoaderOptions {
|
|
5
|
-
json?: boolean;
|
|
6
|
-
/** Tool name to simulate; required for `PreToolUse` matching. */
|
|
7
|
-
tool?: string;
|
|
8
|
-
/** JSON string for `tool_input`. Parsed once and threaded into the extract context. */
|
|
9
|
-
toolArgs?: string;
|
|
10
|
-
/** Override builtins (tests). */
|
|
11
|
-
builtins?: Partial<ExtractBuiltins>;
|
|
12
|
-
}
|
|
13
|
-
export interface DryRunHookHit {
|
|
14
|
-
event: string;
|
|
15
|
-
name: string;
|
|
16
|
-
}
|
|
17
|
-
export interface DryRunPolicyHit {
|
|
18
|
-
name: string;
|
|
19
|
-
ledgerQuery: string;
|
|
20
|
-
requires: Policy["requires"];
|
|
21
|
-
enforcement: Policy["enforcement"];
|
|
22
|
-
triggerEvent: string;
|
|
23
|
-
}
|
|
24
|
-
export interface DryRunPolicyCouldHit {
|
|
25
|
-
name: string;
|
|
26
|
-
triggerEvent: string;
|
|
27
|
-
reason: string;
|
|
28
|
-
}
|
|
29
|
-
export interface DryRunMemoryDir {
|
|
30
|
-
path: string;
|
|
31
|
-
scope: string;
|
|
32
|
-
}
|
|
33
|
-
export interface DryRunReport {
|
|
34
|
-
prompt: string;
|
|
35
|
-
tool: string | null;
|
|
36
|
-
toolArgs: unknown;
|
|
37
|
-
hooks: DryRunHookHit[];
|
|
38
|
-
matchingPolicies: DryRunPolicyHit[];
|
|
39
|
-
couldMatchPolicies: DryRunPolicyCouldHit[];
|
|
40
|
-
memoryDirectories: DryRunMemoryDir[];
|
|
41
|
-
}
|
|
42
|
-
export interface DryRunResult {
|
|
43
|
-
output: string;
|
|
44
|
-
report: DryRunReport;
|
|
45
|
-
}
|
|
46
|
-
export declare function dryRun(prompt: string, opts?: DryRunOptions): DryRunResult;
|
package/dist/cli/dry-run.js
DELETED
|
@@ -1,250 +0,0 @@
|
|
|
1
|
-
import { stringify as stringifyYaml } from "yaml";
|
|
2
|
-
import { evaluateExtract, firstInputMatchMismatch, substituteTemplate, } from "../policies/index.js";
|
|
3
|
-
import { normalizeCommand, normalizeCommandAmpAware, normalizeCommandQuoteAware, } from "../runtime/command-normalize.js";
|
|
4
|
-
import { resolveGitContext } from "../runtime/git-context.js";
|
|
5
|
-
import { emptyIdentifierGuard } from "../runtime/intercept.js";
|
|
6
|
-
import { EX_USAGE, HarnessExitError } from "./exit-codes.js";
|
|
7
|
-
import { loadManifest } from "./loader.js";
|
|
8
|
-
const PROMPT_EVENTS = new Set(["UserPromptSubmit", "SessionStart"]);
|
|
9
|
-
function builtinsFor(opts, tool) {
|
|
10
|
-
const fromOpts = opts.builtins ?? {};
|
|
11
|
-
// Derive REPO / BRANCH from the cwd so the prediction matches what the
|
|
12
|
-
// intercept engine resolves at runtime; an explicit builtins override
|
|
13
|
-
// (tests, or a deliberate caller) still wins.
|
|
14
|
-
const cwd = fromOpts.CWD ?? process.cwd();
|
|
15
|
-
const gitContext = resolveGitContext(cwd);
|
|
16
|
-
return {
|
|
17
|
-
SESSION_ID: fromOpts.SESSION_ID ?? "dry-run",
|
|
18
|
-
REPO: fromOpts.REPO ?? gitContext.repo,
|
|
19
|
-
BRANCH: fromOpts.BRANCH ?? gitContext.branch,
|
|
20
|
-
TOOL_NAME: fromOpts.TOOL_NAME ?? (tool ?? ""),
|
|
21
|
-
CWD: cwd,
|
|
22
|
-
};
|
|
23
|
-
}
|
|
24
|
-
function policyMatchesPrompt(policy, prompt) {
|
|
25
|
-
if (!PROMPT_EVENTS.has(policy.trigger.event))
|
|
26
|
-
return false;
|
|
27
|
-
if (policy.trigger.match !== undefined) {
|
|
28
|
-
return prompt.includes(policy.trigger.match);
|
|
29
|
-
}
|
|
30
|
-
return true;
|
|
31
|
-
}
|
|
32
|
-
function policyMatchesTool(policy, tool, toolInput) {
|
|
33
|
-
if (policy.trigger.event !== "PreToolUse") {
|
|
34
|
-
return { matched: false, reason: `trigger event is ${policy.trigger.event}, not PreToolUse` };
|
|
35
|
-
}
|
|
36
|
-
if (policy.trigger.match !== undefined && !tool.includes(policy.trigger.match)) {
|
|
37
|
-
return {
|
|
38
|
-
matched: false,
|
|
39
|
-
reason: `--tool "${tool}" does not contain trigger.match "${policy.trigger.match}"`,
|
|
40
|
-
};
|
|
41
|
-
}
|
|
42
|
-
// `input_match` (task 2699b476): the SAME predicate `policyMatchesEvent`
|
|
43
|
-
// ANDs onto the tool-name match (`firstInputMatchMismatch`, called on
|
|
44
|
-
// the same single-object `toolArgs` context both sides build for a
|
|
45
|
-
// single-envelope input), so dry-run predicts
|
|
46
|
-
// `mcp__agent-tasks__task_finish` with `{"autoMerge": true}` as gated
|
|
47
|
-
// and the same verb without it as unmatched, exactly as the runtime
|
|
48
|
-
// decides. Leaving this arm out would reintroduce the debug-verb
|
|
49
|
-
// contradiction the bash_match arms below already document once for
|
|
50
|
-
// their own family: dry-run reporting "no policy matches" for a call
|
|
51
|
-
// `policy intercept` blocks. Parity holds only for what dry-run can
|
|
52
|
-
// express: `--input` is always a single JSON object, so it cannot
|
|
53
|
-
// reproduce the runtime's mixed tool_input/raw_input envelope
|
|
54
|
-
// (review round 1, task 2699b476 round 2): that arm is
|
|
55
|
-
// intercept-only by construction, not a gap in this mirror.
|
|
56
|
-
// This parity, and the mixed-envelope caveat, are recorded in
|
|
57
|
-
// docs/okf/debug-verb-selection.md's trigger-matching parity paragraph.
|
|
58
|
-
if (policy.trigger.input_match !== undefined) {
|
|
59
|
-
const mismatch = firstInputMatchMismatch(policy.trigger.input_match, {
|
|
60
|
-
toolArgs: toolInput,
|
|
61
|
-
});
|
|
62
|
-
if (mismatch !== null) {
|
|
63
|
-
return {
|
|
64
|
-
matched: false,
|
|
65
|
-
reason: mismatch.missing
|
|
66
|
-
? `trigger.input_match needs ${mismatch.expression} in tool_input ` +
|
|
67
|
-
`(expected ${JSON.stringify(mismatch.expected)})`
|
|
68
|
-
: `trigger.input_match ${mismatch.expression} is ` +
|
|
69
|
-
`${JSON.stringify(mismatch.actual)}, not ${JSON.stringify(mismatch.expected)}`,
|
|
70
|
-
};
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
if (policy.trigger.bash_match !== undefined) {
|
|
74
|
-
const args = toolInput;
|
|
75
|
-
if (!args || typeof args.command !== "string") {
|
|
76
|
-
return {
|
|
77
|
-
matched: false,
|
|
78
|
-
reason: "trigger.bash_match needs tool_input.command",
|
|
79
|
-
};
|
|
80
|
-
}
|
|
81
|
-
let re;
|
|
82
|
-
try {
|
|
83
|
-
re = new RegExp(policy.trigger.bash_match);
|
|
84
|
-
}
|
|
85
|
-
catch {
|
|
86
|
-
return { matched: false, reason: `trigger.bash_match is not a valid regex` };
|
|
87
|
-
}
|
|
88
|
-
// Raw-OR-normalised-OR-amp-normalised-OR-quote-normalised, mirroring
|
|
89
|
-
// `policyMatchesEvent`'s real evaluation path exactly (third arm added
|
|
90
|
-
// task aabbad63; fourth arm added task f561e44c): dry-run used to test
|
|
91
|
-
// only the RAW command, so it predicted `env -C /tmp git status` as NOT
|
|
92
|
-
// matching `preflight-before-investigation` while `policy intercept`
|
|
93
|
-
// actually blocks it — a debug verb contradicting the runtime it exists
|
|
94
|
-
// to predict (its own comment above and docs/okf/debug-verb-selection.md
|
|
95
|
-
// both assert parity). Leaving out the amp-aware third arm here would
|
|
96
|
-
// reintroduce that SAME class of contradiction for the bare-`&` family
|
|
97
|
-
// (`A=x&env -C /tmp git status`, `echo hi & nice git status`): `policy
|
|
98
|
-
// intercept` now blocks those via `normalizeCommandAmpAware`, so dry-run
|
|
99
|
-
// must try it too. The REPO/BRANCH half of this file (`builtinsFor`,
|
|
100
|
-
// cwd-only) stays in parity with the runtime, which is also cwd-only for
|
|
101
|
-
// `${REPO}`/`${BRANCH}` — see `src/cli/policy/intercept.ts`'s comment
|
|
102
|
-
// above `cwdGitContext` for why a per-command target directory is
|
|
103
|
-
// deliberately not consulted.
|
|
104
|
-
//
|
|
105
|
-
// FOURTH ARM (task f561e44c, closes the cf3dff51 follow-up): task
|
|
106
|
-
// cf3dff51 wired `normalizeCommandQuoteAware` (a quote-aware BOUNDARY_RE
|
|
107
|
-
// segmenter closing `VAR='a; b' git push origin master` and its
|
|
108
|
-
// `|`/`&&`/`(`/newline siblings — task 13e55484's pinned gap) as
|
|
109
|
-
// `policyMatchesEvent`'s FOURTH arm, but deliberately left this function
|
|
110
|
-
// untouched (scope was narrowed to `src/runtime/intercept.ts` alone),
|
|
111
|
-
// reintroducing EXACTLY the parity contradiction this comment's first
|
|
112
|
-
// sentence describes, for that one family. Closed here by adding the
|
|
113
|
-
// same fourth OR-arm, literally duplicated rather than extracted to a
|
|
114
|
-
// shared helper — mirroring the amp-aware arm's own literal-duplication
|
|
115
|
-
// shape immediately above (no shared-helper precedent exists yet for
|
|
116
|
-
// this OR-chain to follow instead).
|
|
117
|
-
if (!re.test(args.command) &&
|
|
118
|
-
!re.test(normalizeCommand(args.command).normalized) &&
|
|
119
|
-
!re.test(normalizeCommandAmpAware(args.command).normalized) &&
|
|
120
|
-
!re.test(normalizeCommandQuoteAware(args.command).normalized)) {
|
|
121
|
-
return {
|
|
122
|
-
matched: false,
|
|
123
|
-
reason: `bash_match "${policy.trigger.bash_match}" did not match`,
|
|
124
|
-
};
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
return { matched: true };
|
|
128
|
-
}
|
|
129
|
-
function buildHookHits(manifest, tool) {
|
|
130
|
-
const hits = [];
|
|
131
|
-
for (const hook of manifest.hooks) {
|
|
132
|
-
if (PROMPT_EVENTS.has(hook.event)) {
|
|
133
|
-
hits.push({ event: hook.event, name: hook.name });
|
|
134
|
-
continue;
|
|
135
|
-
}
|
|
136
|
-
if (tool !== null && hook.event === "PreToolUse") {
|
|
137
|
-
hits.push({ event: hook.event, name: hook.name });
|
|
138
|
-
}
|
|
139
|
-
}
|
|
140
|
-
return hits;
|
|
141
|
-
}
|
|
142
|
-
function staticLedgerQuery(policy, ctx, builtins) {
|
|
143
|
-
if (policy.requires === undefined) {
|
|
144
|
-
// operator_only: true (task 2cc73f55): no requires.ledger_tag to
|
|
145
|
-
// substitute — the policy never queries the ledger at all.
|
|
146
|
-
return "(operator-only: no ledger query — unconditional deny)";
|
|
147
|
-
}
|
|
148
|
-
const extract = evaluateExtract(policy.trigger.extract ?? {}, ctx, builtins);
|
|
149
|
-
// Same guard as the runtime: an empty ${REPO} / ${BRANCH} never renders
|
|
150
|
-
// a blank tag (`preflight:`); show the hint the agent would get instead.
|
|
151
|
-
const emptyGuard = emptyIdentifierGuard(policy.requires.ledger_tag, extract.values);
|
|
152
|
-
if (emptyGuard !== null) {
|
|
153
|
-
return `(no ledger query: ${emptyGuard.message})`;
|
|
154
|
-
}
|
|
155
|
-
const sub = substituteTemplate(policy.requires.ledger_tag, extract.values);
|
|
156
|
-
return sub.result;
|
|
157
|
-
}
|
|
158
|
-
function formatYaml(report) {
|
|
159
|
-
// Hide raw `null` from YAML output for the no-tool case.
|
|
160
|
-
const visible = {
|
|
161
|
-
prompt: report.prompt,
|
|
162
|
-
...(report.tool !== null && { tool: report.tool }),
|
|
163
|
-
...(report.tool !== null && report.toolArgs !== undefined && {
|
|
164
|
-
toolArgs: report.toolArgs,
|
|
165
|
-
}),
|
|
166
|
-
"Hooks that would fire": report.hooks.length === 0 ? "(none)" : report.hooks,
|
|
167
|
-
"Policies that match": report.matchingPolicies.length === 0 ? "(none)" : report.matchingPolicies,
|
|
168
|
-
"Policies that COULD match (need --tool)": report.couldMatchPolicies.length === 0 ? "(none)" : report.couldMatchPolicies,
|
|
169
|
-
"Memories that would route": report.memoryDirectories.length === 0 ? "(none)" : report.memoryDirectories,
|
|
170
|
-
};
|
|
171
|
-
return stringifyYaml(visible, { lineWidth: 0 });
|
|
172
|
-
}
|
|
173
|
-
export function dryRun(prompt, opts = {}) {
|
|
174
|
-
const { manifest } = loadManifest(opts);
|
|
175
|
-
const tool = opts.tool ?? null;
|
|
176
|
-
let toolArgs = undefined;
|
|
177
|
-
if (opts.toolArgs !== undefined) {
|
|
178
|
-
try {
|
|
179
|
-
toolArgs = JSON.parse(opts.toolArgs);
|
|
180
|
-
}
|
|
181
|
-
catch (err) {
|
|
182
|
-
throw new HarnessExitError(`--tool-args: ${err.message}`, EX_USAGE);
|
|
183
|
-
}
|
|
184
|
-
}
|
|
185
|
-
const builtins = builtinsFor(opts, tool);
|
|
186
|
-
const ctx = {
|
|
187
|
-
toolArgs,
|
|
188
|
-
event: { hook_event_name: tool ? "PreToolUse" : "UserPromptSubmit", tool_name: tool, prompt },
|
|
189
|
-
session: { id: builtins.SESSION_ID },
|
|
190
|
-
git: {},
|
|
191
|
-
};
|
|
192
|
-
const hooks = buildHookHits(manifest, tool);
|
|
193
|
-
const matching = [];
|
|
194
|
-
const couldMatch = [];
|
|
195
|
-
for (const policy of manifest.policies) {
|
|
196
|
-
if (PROMPT_EVENTS.has(policy.trigger.event)) {
|
|
197
|
-
if (policyMatchesPrompt(policy, prompt)) {
|
|
198
|
-
matching.push({
|
|
199
|
-
name: policy.name,
|
|
200
|
-
ledgerQuery: staticLedgerQuery(policy, ctx, builtins),
|
|
201
|
-
requires: policy.requires,
|
|
202
|
-
enforcement: policy.enforcement,
|
|
203
|
-
triggerEvent: policy.trigger.event,
|
|
204
|
-
});
|
|
205
|
-
}
|
|
206
|
-
continue;
|
|
207
|
-
}
|
|
208
|
-
// PreToolUse and friends.
|
|
209
|
-
if (tool === null) {
|
|
210
|
-
couldMatch.push({
|
|
211
|
-
name: policy.name,
|
|
212
|
-
triggerEvent: policy.trigger.event,
|
|
213
|
-
reason: "no --tool supplied; dry-run can only statically match prompt-style events",
|
|
214
|
-
});
|
|
215
|
-
continue;
|
|
216
|
-
}
|
|
217
|
-
const verdict = policyMatchesTool(policy, tool, toolArgs);
|
|
218
|
-
if (verdict.matched) {
|
|
219
|
-
matching.push({
|
|
220
|
-
name: policy.name,
|
|
221
|
-
ledgerQuery: staticLedgerQuery(policy, ctx, builtins),
|
|
222
|
-
requires: policy.requires,
|
|
223
|
-
enforcement: policy.enforcement,
|
|
224
|
-
triggerEvent: policy.trigger.event,
|
|
225
|
-
});
|
|
226
|
-
}
|
|
227
|
-
else {
|
|
228
|
-
couldMatch.push({
|
|
229
|
-
name: policy.name,
|
|
230
|
-
triggerEvent: policy.trigger.event,
|
|
231
|
-
reason: verdict.reason,
|
|
232
|
-
});
|
|
233
|
-
}
|
|
234
|
-
}
|
|
235
|
-
const memoryDirectories = manifest.memory.directories.map((d) => ({ path: d.path, scope: d.scope }));
|
|
236
|
-
const report = {
|
|
237
|
-
prompt,
|
|
238
|
-
tool,
|
|
239
|
-
toolArgs,
|
|
240
|
-
hooks,
|
|
241
|
-
matchingPolicies: matching,
|
|
242
|
-
couldMatchPolicies: couldMatch,
|
|
243
|
-
memoryDirectories,
|
|
244
|
-
};
|
|
245
|
-
const output = opts.json
|
|
246
|
-
? `${JSON.stringify(report, null, 2)}\n`
|
|
247
|
-
: formatYaml(report);
|
|
248
|
-
return { output, report };
|
|
249
|
-
}
|
|
250
|
-
//# sourceMappingURL=dry-run.js.map
|
package/dist/cli/dry-run.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"dry-run.js","sourceRoot":"","sources":["../../src/cli/dry-run.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,IAAI,aAAa,EAAE,MAAM,MAAM,CAAC;AAClD,OAAO,EACL,eAAe,EACf,uBAAuB,EACvB,kBAAkB,GAGnB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EACL,gBAAgB,EAChB,wBAAwB,EACxB,0BAA0B,GAC3B,MAAM,iC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IAAI,CAAC;gBACd,IAAI,EAAE,MAAM,CAAC,IAAI;gBACjB,YAAY,EAAE,MAAM,CAAC,OAAO,CAAC,KAAK;gBAClC,MAAM,EAAE,OAAO,CAAC,MAAM;aACvB,CAAC,CAAC;QACL,CAAC;IACH,CAAC;IAED,MAAM,iBAAiB,GAAsB,QAAQ,CAAC,MAAM,CAAC,WAAW,CAAC,GAAG,CAC1E,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC,KAAK,EAAE,CAAC,CAC1C,CAAC;IAEF,MAAM,MAAM,GAAiB;QAC3B,MAAM;QACN,IAAI;QACJ,QAAQ;QACR,KAAK;QACL,gBAAgB,EAAE,QAAQ;QAC1B,kBAAkB,EAAE,UAAU;QAC9B,iBAAiB;KAClB,CAAC;IAEF,MAAM,MAAM,GAAG,IAAI,CAAC,IAAI;QACtB,CAAC,CAAC,GAAG,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,IAAI;QACxC,CAAC,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC;IACvB,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC;AAC5B,CAAC"}
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { type ActionEnvelope, type GitRepoContext, type ToolEvent } from "../runtime/index.js";
|
|
2
|
-
/** Injectable seams so callers (and tests) can make resolution deterministic. */
|
|
3
|
-
export interface EventInputSeams {
|
|
4
|
-
/** Override the envelope timestamp. */
|
|
5
|
-
now?: Date;
|
|
6
|
-
/** Override the resolved host name. */
|
|
7
|
-
host?: string;
|
|
8
|
-
/** Override the resolved OS user. */
|
|
9
|
-
user?: string;
|
|
10
|
-
/** Override git-context resolution. */
|
|
11
|
-
resolveGit?: (cwd: string) => GitRepoContext;
|
|
12
|
-
/** Override the cwd fallback used when the event omits `cwd`. */
|
|
13
|
-
cwdFallback?: string;
|
|
14
|
-
}
|
|
15
|
-
export interface LoadedEvent {
|
|
16
|
-
event: ToolEvent;
|
|
17
|
-
envelope: ActionEnvelope;
|
|
18
|
-
}
|
|
19
|
-
/**
|
|
20
|
-
* Read a tool-event JSON file and build its Action Envelope.
|
|
21
|
-
*
|
|
22
|
-
* Throws `HarnessExitError(EX_NOINPUT)` when the file is missing, is not
|
|
23
|
-
* valid JSON, or does not decode to a JSON object. A well-formed but
|
|
24
|
-
* sparse event (e.g. `{}`) is accepted: the envelope builder fills
|
|
25
|
-
* absent fields with empty values rather than throwing. `verb` only
|
|
26
|
-
* prefixes the error messages so the operator sees which command failed.
|
|
27
|
-
*/
|
|
28
|
-
export declare function loadEventEnvelope(eventPath: string, seams?: EventInputSeams, verb?: string): LoadedEvent;
|
package/dist/cli/event-input.js
DELETED
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
// Shared tool-event input handling for the Risk Gate verbs that take a
|
|
2
|
-
// tool-event JSON file: `harness explain-action`, `harness test-risk`,
|
|
3
|
-
// `harness resolve-env`, and `harness explain-policy`.
|
|
4
|
-
//
|
|
5
|
-
// Each applies the same not-found / malformed / non-object guards,
|
|
6
|
-
// resolves the same ambient `EnvelopeContext` (git, host, user, now),
|
|
7
|
-
// and builds the Action Envelope. This module is that shared front end
|
|
8
|
-
// so every verb stays byte-identical in how it reads and normalizes
|
|
9
|
-
// its input.
|
|
10
|
-
import * as fs from "node:fs";
|
|
11
|
-
import * as os from "node:os";
|
|
12
|
-
import { buildActionEnvelope, resolveGitContext, } from "../runtime/index.js";
|
|
13
|
-
import { EX_NOINPUT, HarnessExitError } from "./exit-codes.js";
|
|
14
|
-
function safeUser() {
|
|
15
|
-
try {
|
|
16
|
-
return os.userInfo().username;
|
|
17
|
-
}
|
|
18
|
-
catch {
|
|
19
|
-
return "";
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
function safeHost() {
|
|
23
|
-
try {
|
|
24
|
-
return os.hostname();
|
|
25
|
-
}
|
|
26
|
-
catch {
|
|
27
|
-
return "";
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
/**
|
|
31
|
-
* Read a tool-event JSON file and build its Action Envelope.
|
|
32
|
-
*
|
|
33
|
-
* Throws `HarnessExitError(EX_NOINPUT)` when the file is missing, is not
|
|
34
|
-
* valid JSON, or does not decode to a JSON object. A well-formed but
|
|
35
|
-
* sparse event (e.g. `{}`) is accepted: the envelope builder fills
|
|
36
|
-
* absent fields with empty values rather than throwing. `verb` only
|
|
37
|
-
* prefixes the error messages so the operator sees which command failed.
|
|
38
|
-
*/
|
|
39
|
-
export function loadEventEnvelope(eventPath, seams = {}, verb = "explain-action") {
|
|
40
|
-
let raw;
|
|
41
|
-
try {
|
|
42
|
-
raw = fs.readFileSync(eventPath, "utf8");
|
|
43
|
-
}
|
|
44
|
-
catch {
|
|
45
|
-
throw new HarnessExitError(`${verb}: event file not found or unreadable: ${eventPath}`, EX_NOINPUT);
|
|
46
|
-
}
|
|
47
|
-
let parsed;
|
|
48
|
-
try {
|
|
49
|
-
parsed = JSON.parse(raw);
|
|
50
|
-
}
|
|
51
|
-
catch (err) {
|
|
52
|
-
throw new HarnessExitError(`${verb}: malformed event JSON in ${eventPath}: ${err.message}`, EX_NOINPUT);
|
|
53
|
-
}
|
|
54
|
-
if (typeof parsed !== "object" || parsed === null || Array.isArray(parsed)) {
|
|
55
|
-
const got = parsed === null ? "null" : Array.isArray(parsed) ? "array" : typeof parsed;
|
|
56
|
-
throw new HarnessExitError(`${verb}: event JSON must be an object, got ${got}`, EX_NOINPUT);
|
|
57
|
-
}
|
|
58
|
-
const event = parsed;
|
|
59
|
-
const fallbackCwd = seams.cwdFallback ?? process.cwd();
|
|
60
|
-
const cwd = typeof event.cwd === "string" && event.cwd.length > 0
|
|
61
|
-
? event.cwd
|
|
62
|
-
: fallbackCwd;
|
|
63
|
-
const resolveGit = seams.resolveGit ?? resolveGitContext;
|
|
64
|
-
const envelope = buildActionEnvelope(event, {
|
|
65
|
-
cwd,
|
|
66
|
-
git: resolveGit(cwd),
|
|
67
|
-
user: seams.user ?? safeUser(),
|
|
68
|
-
host: seams.host ?? safeHost(),
|
|
69
|
-
now: seams.now ?? new Date(),
|
|
70
|
-
});
|
|
71
|
-
return { event, envelope };
|
|
72
|
-
}
|
|
73
|
-
//# sourceMappingURL=event-input.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"event-input.js","sourceRoot":"","sources":["../../src/cli/event-input.ts"],"names":[],"mappings":"AAAA,uEAAuE;AACvE,uEAAuE;AACvE,uDAAuD;AACvD,EAAE;AACF,mEAAmE;AACnE,sEAAsE;AACtE,uEAAuE;AACvE,oEAAoE;AACpE,aAAa;AAEb,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,EACL,mBAAmB,EACnB,iBAAiB,GAIlB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,UAAU,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAqB/D,SAAS,QAAQ;IACf,IAAI,CAAC;QACH,OAAO,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC;IAChC,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,EAAE,CAAC;IACZ,CAAC;AACH,CAAC;AAED,SAAS,QAAQ;IACf,IAAI,CAAC;QACH,OAAO,EAAE,CAAC,QAAQ,EAAE,CAAC;IACvB,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,EAAE,CAAC;IACZ,CAAC;AACH,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,UAAU,iBAAiB,CAC/B,SAAiB,EACjB,QAAyB,EAAE,EAC3B,IAAI,GAAG,gBAAgB;IAEvB,IAAI,GAAW,CAAC;IAChB,IAAI,CAAC;QACH,GAAG,GAAG,EAAE,CAAC,YAAY,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC;IAC3C,CAAC;IAAC,MAAM,CAAC;QACP,M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KAAK,CAAC,IAAI,IAAI,QAAQ,EAAE;QAC9B,IAAI,EAAE,KAAK,CAAC,IAAI,IAAI,QAAQ,EAAE;QAC9B,GAAG,EAAE,KAAK,CAAC,GAAG,IAAI,IAAI,IAAI,EAAE;KAC7B,CAAC,CAAC;IAEH,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,CAAC;AAC7B,CAAC"}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import type { ActionEnvelope } from "../runtime/index.js";
|
|
2
|
-
import { type EventInputSeams } from "./event-input.js";
|
|
3
|
-
export interface ExplainActionOptions extends EventInputSeams {
|
|
4
|
-
/** Path to the tool-event JSON file. */
|
|
5
|
-
eventPath: string;
|
|
6
|
-
/** Emit JSON instead of YAML. */
|
|
7
|
-
json?: boolean;
|
|
8
|
-
}
|
|
9
|
-
export interface ExplainActionResult {
|
|
10
|
-
output: string;
|
|
11
|
-
envelope: ActionEnvelope;
|
|
12
|
-
}
|
|
13
|
-
/**
|
|
14
|
-
* Build and render the Action Envelope for a tool-event JSON file.
|
|
15
|
-
*
|
|
16
|
-
* Throws `HarnessExitError(EX_NOINPUT)` when the file is missing, is not
|
|
17
|
-
* valid JSON, or does not decode to a JSON object (see
|
|
18
|
-
* `loadEventEnvelope`). A well-formed but sparse event is accepted.
|
|
19
|
-
*/
|
|
20
|
-
export declare function explainAction(opts: ExplainActionOptions): ExplainActionResult;
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
// Phase 7 #2 — `harness explain-action` CLI entrypoint.
|
|
2
|
-
//
|
|
3
|
-
// Debug verb for the Risk Gate. Reads a tool-event JSON file (the
|
|
4
|
-
// Claude Code PreToolUse hook payload shape), builds the Action
|
|
5
|
-
// Envelope, and prints it. This is the inspection surface for the
|
|
6
|
-
// envelope normalization that Phase 7 #3-#5 build the classifier,
|
|
7
|
-
// resolver, and policy evaluator on top of.
|
|
8
|
-
//
|
|
9
|
-
// File read, JSON guards, and envelope build live in the shared
|
|
10
|
-
// `event-input` front end; this module only renders the result.
|
|
11
|
-
import { stringify as stringifyYaml } from "yaml";
|
|
12
|
-
import { loadEventEnvelope } from "./event-input.js";
|
|
13
|
-
/**
|
|
14
|
-
* Build and render the Action Envelope for a tool-event JSON file.
|
|
15
|
-
*
|
|
16
|
-
* Throws `HarnessExitError(EX_NOINPUT)` when the file is missing, is not
|
|
17
|
-
* valid JSON, or does not decode to a JSON object (see
|
|
18
|
-
* `loadEventEnvelope`). A well-formed but sparse event is accepted.
|
|
19
|
-
*/
|
|
20
|
-
export function explainAction(opts) {
|
|
21
|
-
const { envelope } = loadEventEnvelope(opts.eventPath, opts, "explain-action");
|
|
22
|
-
const output = opts.json
|
|
23
|
-
? `${JSON.stringify(envelope, null, 2)}\n`
|
|
24
|
-
: stringifyYaml(envelope, { lineWidth: 0 });
|
|
25
|
-
return { output, envelope };
|
|
26
|
-
}
|
|
27
|
-
//# sourceMappingURL=explain-action.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"explain-action.js","sourceRoot":"","sources":["../../src/cli/explain-action.ts"],"names":[],"mappings":"AAAA,wDAAwD;AACxD,EAAE;AACF,kEAAkE;AAClE,gEAAgE;AAChE,kEAAkE;AAClE,kEAAkE;AAClE,4CAA4C;AAC5C,EAAE;AACF,gEAAgE;AAChE,gEAAgE;AAEhE,OAAO,EAAE,SAAS,IAAI,aAAa,EAAE,MAAM,MAAM,CAAC;AAElD,OAAO,EAAE,iBAAiB,EAAwB,MAAM,kBAAkB,CAAC;AAc3E;;;;;;GAMG;AACH,MAAM,UAAU,aAAa,CAAC,IAA0B;IACtD,MAAM,EAAE,QAAQ,EAAE,GAAG,iBAAiB,CAAC,IAAI,CAAC,SAAS,EAAE,IAAI,EAAE,gBAAgB,CAAC,CAAC;IAC/E,MAAM,MAAM,GAAG,IAAI,CAAC,IAAI;QACtB,CAAC,CAAC,GAAG,IAAI,CAAC,SAAS,CAAC,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC,IAAI;QAC1C,CAAC,CAAC,aAAa,CAAC,QAAQ,EAAE,EAAE,SAAS,EAAE,CAAC,EAAE,CAAC,CAAC;IAC9C,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC;AAC9B,CAAC"}
|