@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,51 +0,0 @@
|
|
|
1
|
-
import { type Mode } from "../../policy-packs/builtin/understanding-before-execution.js";
|
|
2
|
-
import type { Manifest } from "../../schema/index.js";
|
|
3
|
-
import type { PolicyPack } from "../../schema/policy-packs.js";
|
|
4
|
-
export interface UnderstandingModeEnvDivergence {
|
|
5
|
-
/** `UNDERSTANDING_GATE_MODE`, normalised (trim + lowercase, mirrors `resolveMode`'s own normalisation). */
|
|
6
|
-
envMode: Mode;
|
|
7
|
-
/** `policy_packs[understanding-before-execution].config.mode`, resolved via the config-only (GENERATION-path) resolver. */
|
|
8
|
-
configMode: Mode;
|
|
9
|
-
/**
|
|
10
|
-
* Short headline, rendered as the `⚠` line itself. Mirrors the
|
|
11
|
-
* npm-global-bin-off-PATH advisory's rendering idiom (`format.ts`'s
|
|
12
|
-
* Environment section): a one-line headline plus indented {@link detail}
|
|
13
|
-
* lines underneath, instead of one long sentence crammed onto the `⚠`
|
|
14
|
-
* line.
|
|
15
|
-
*/
|
|
16
|
-
message: string;
|
|
17
|
-
/**
|
|
18
|
-
* 2-3 indented lines rendered directly under {@link message} by
|
|
19
|
-
* `format.ts`. Carries the explanation and remediation the old
|
|
20
|
-
* single-line `message` used to carry inline.
|
|
21
|
-
*/
|
|
22
|
-
detail: string[];
|
|
23
|
-
}
|
|
24
|
-
/**
|
|
25
|
-
* Pure: manifest + env in, a divergence report out (or `undefined` when
|
|
26
|
-
* there is nothing to flag). Only fires when:
|
|
27
|
-
* - the `understanding-before-execution` pack is declared AND enabled
|
|
28
|
-
* (a pack that never runs has no live mode for the env to diverge
|
|
29
|
-
* from — mirrors the enabled-gate other doctor sections use, e.g.
|
|
30
|
-
* `buildGrounding`'s `groundingServer` lookup in `index.ts`);
|
|
31
|
-
* - `UNDERSTANDING_GATE_MODE` is set to a non-empty value AND, once
|
|
32
|
-
* trimmed/lower-cased the same way `resolveMode` normalises it,
|
|
33
|
-
* resolves to a recognised {@link Mode}. An env value the live
|
|
34
|
-
* runtime would itself reject (unset, empty, or unrecognised) cannot
|
|
35
|
-
* diverge from anything — the live resolver falls back to
|
|
36
|
-
* `config.mode` in that case too, so there is no enforcement gap to
|
|
37
|
-
* warn about.
|
|
38
|
-
* - the normalised env mode differs from the resolved `config.mode`.
|
|
39
|
-
*/
|
|
40
|
-
/**
|
|
41
|
-
* Shared gate for the understanding-gate doctor sub-checks that only
|
|
42
|
-
* make sense when the pack is actually live: this divergence advisory,
|
|
43
|
-
* and (ADR docs/decisions/2026-08-27-ug-auto-mode-approval.md slice 1,
|
|
44
|
-
* agent-tasks 74b4b17d) the auto-approval listing and settings-drift
|
|
45
|
-
* checks. Declared-but-disabled counts as not enabled, mirroring the
|
|
46
|
-
* `p.enabled !== false` gate `checkUnderstandingModeEnvDivergence` uses
|
|
47
|
-
* inline below.
|
|
48
|
-
*/
|
|
49
|
-
export declare function findEnabledUnderstandingPack(manifest: Manifest): PolicyPack | undefined;
|
|
50
|
-
export declare function isUnderstandingPackEnabled(manifest: Manifest): boolean;
|
|
51
|
-
export declare function checkUnderstandingModeEnvDivergence(manifest: Manifest, env: NodeJS.ProcessEnv): UnderstandingModeEnvDivergence | undefined;
|
|
@@ -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,UAAU,4BAA4B,CAAC,QAAkB;IAC7D,OAAO,QAAQ,CAAC,YAAY,CAAC,IAAI,CAC/B,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,uBAAuB,IAAI,CAAC,CAAC,OAAO,KAAK,KAAK,CACjE,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,0BAA0B,CAAC,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y } 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
|
-
/**
|
|
20
|
-
* The cwd-context demand (unchanged shape; kept for `--json` consumers).
|
|
21
|
-
* For a command that names other repositories see `ledgerQueries`.
|
|
22
|
-
*/
|
|
23
|
-
ledgerQuery: string;
|
|
24
|
-
/**
|
|
25
|
-
* Every demand the runtime would make for this policy: the cwd context
|
|
26
|
-
* plus one per distinct repository a trigger-satisfying command segment
|
|
27
|
-
* names (additive, bounded by `MAX_ATTRIBUTED_CONTEXTS`). A single entry
|
|
28
|
-
* for a policy without per-repo builtins; one bounded-case text instead
|
|
29
|
-
* of tags when the command names too many distinct targets.
|
|
30
|
-
*/
|
|
31
|
-
ledgerQueries: string[];
|
|
32
|
-
requires: Policy["requires"];
|
|
33
|
-
enforcement: Policy["enforcement"];
|
|
34
|
-
triggerEvent: string;
|
|
35
|
-
}
|
|
36
|
-
export interface DryRunPolicyCouldHit {
|
|
37
|
-
name: string;
|
|
38
|
-
triggerEvent: string;
|
|
39
|
-
reason: string;
|
|
40
|
-
}
|
|
41
|
-
export interface DryRunMemoryDir {
|
|
42
|
-
path: string;
|
|
43
|
-
scope: string;
|
|
44
|
-
}
|
|
45
|
-
export interface DryRunReport {
|
|
46
|
-
prompt: string;
|
|
47
|
-
tool: string | null;
|
|
48
|
-
toolArgs: unknown;
|
|
49
|
-
hooks: DryRunHookHit[];
|
|
50
|
-
matchingPolicies: DryRunPolicyHit[];
|
|
51
|
-
couldMatchPolicies: DryRunPolicyCouldHit[];
|
|
52
|
-
memoryDirectories: DryRunMemoryDir[];
|
|
53
|
-
}
|
|
54
|
-
export interface DryRunResult {
|
|
55
|
-
output: string;
|
|
56
|
-
report: DryRunReport;
|
|
57
|
-
}
|
|
58
|
-
export declare function dryRun(prompt: string, opts?: DryRunOptions): DryRunResult;
|
package/dist/cli/dry-run.js
DELETED
|
@@ -1,283 +0,0 @@
|
|
|
1
|
-
import { stringify as stringifyYaml } from "yaml";
|
|
2
|
-
import { evaluateExtract, firstInputMatchMismatch, substituteTemplate, } from "../policies/index.js";
|
|
3
|
-
import { normalizeCommand, normalizeCommandAmpAware, normalizeCommandQuoteAware, segmentViewOf, } from "../runtime/command-normalize.js";
|
|
4
|
-
import { resolveGitContext } from "../runtime/git-context.js";
|
|
5
|
-
import { emptyIdentifierGuard, MAX_ATTRIBUTED_CONTEXTS, resolveAttributedContexts, usesPerRepoBuiltins, } 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, gitContext) {
|
|
10
|
-
const fromOpts = opts.builtins ?? {};
|
|
11
|
-
// The cwd-context REPO / BRANCH, derived from the cwd the same way the
|
|
12
|
-
// intercept engine does; an explicit builtins override (tests, or a
|
|
13
|
-
// deliberate caller) still wins. Targets a command names beyond the cwd
|
|
14
|
-
// are added per policy by `ledgerQueriesFor`, through the runtime's own
|
|
15
|
-
// `resolveAttributedContexts`.
|
|
16
|
-
const cwd = fromOpts.CWD ?? process.cwd();
|
|
17
|
-
return {
|
|
18
|
-
SESSION_ID: fromOpts.SESSION_ID ?? "dry-run",
|
|
19
|
-
REPO: fromOpts.REPO ?? gitContext.repo,
|
|
20
|
-
BRANCH: fromOpts.BRANCH ?? gitContext.branch,
|
|
21
|
-
TOOL_NAME: fromOpts.TOOL_NAME ?? (tool ?? ""),
|
|
22
|
-
CWD: cwd,
|
|
23
|
-
};
|
|
24
|
-
}
|
|
25
|
-
function policyMatchesPrompt(policy, prompt) {
|
|
26
|
-
if (!PROMPT_EVENTS.has(policy.trigger.event))
|
|
27
|
-
return false;
|
|
28
|
-
if (policy.trigger.match !== undefined) {
|
|
29
|
-
return prompt.includes(policy.trigger.match);
|
|
30
|
-
}
|
|
31
|
-
return true;
|
|
32
|
-
}
|
|
33
|
-
function policyMatchesTool(policy, tool, toolInput) {
|
|
34
|
-
if (policy.trigger.event !== "PreToolUse") {
|
|
35
|
-
return { matched: false, reason: `trigger event is ${policy.trigger.event}, not PreToolUse` };
|
|
36
|
-
}
|
|
37
|
-
if (policy.trigger.match !== undefined && !tool.includes(policy.trigger.match)) {
|
|
38
|
-
return {
|
|
39
|
-
matched: false,
|
|
40
|
-
reason: `--tool "${tool}" does not contain trigger.match "${policy.trigger.match}"`,
|
|
41
|
-
};
|
|
42
|
-
}
|
|
43
|
-
// `input_match` (task 2699b476): the SAME predicate `policyMatchesEvent`
|
|
44
|
-
// ANDs onto the tool-name match (`firstInputMatchMismatch`, called on
|
|
45
|
-
// the same single-object `toolArgs` context both sides build for a
|
|
46
|
-
// single-envelope input), so dry-run predicts
|
|
47
|
-
// `mcp__agent-tasks__task_finish` with `{"autoMerge": true}` as gated
|
|
48
|
-
// and the same verb without it as unmatched, exactly as the runtime
|
|
49
|
-
// decides. Leaving this arm out would reintroduce the debug-verb
|
|
50
|
-
// contradiction the bash_match arms below already document once for
|
|
51
|
-
// their own family: dry-run reporting "no policy matches" for a call
|
|
52
|
-
// `policy intercept` blocks. Parity holds only for what dry-run can
|
|
53
|
-
// express: `--input` is always a single JSON object, so it cannot
|
|
54
|
-
// reproduce the runtime's mixed tool_input/raw_input envelope
|
|
55
|
-
// (review round 1, task 2699b476 round 2): that arm is
|
|
56
|
-
// intercept-only by construction, not a gap in this mirror.
|
|
57
|
-
// This parity, and the mixed-envelope caveat, are recorded in
|
|
58
|
-
// docs/okf/debug-verb-selection.md's trigger-matching parity paragraph.
|
|
59
|
-
if (policy.trigger.input_match !== undefined) {
|
|
60
|
-
const mismatch = firstInputMatchMismatch(policy.trigger.input_match, {
|
|
61
|
-
toolArgs: toolInput,
|
|
62
|
-
});
|
|
63
|
-
if (mismatch !== null) {
|
|
64
|
-
return {
|
|
65
|
-
matched: false,
|
|
66
|
-
reason: mismatch.missing
|
|
67
|
-
? `trigger.input_match needs ${mismatch.expression} in tool_input ` +
|
|
68
|
-
`(expected ${JSON.stringify(mismatch.expected)})`
|
|
69
|
-
: `trigger.input_match ${mismatch.expression} is ` +
|
|
70
|
-
`${JSON.stringify(mismatch.actual)}, not ${JSON.stringify(mismatch.expected)}`,
|
|
71
|
-
};
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
if (policy.trigger.bash_match !== undefined) {
|
|
75
|
-
const args = toolInput;
|
|
76
|
-
if (!args || typeof args.command !== "string") {
|
|
77
|
-
return {
|
|
78
|
-
matched: false,
|
|
79
|
-
reason: "trigger.bash_match needs tool_input.command",
|
|
80
|
-
};
|
|
81
|
-
}
|
|
82
|
-
let re;
|
|
83
|
-
try {
|
|
84
|
-
re = new RegExp(policy.trigger.bash_match);
|
|
85
|
-
}
|
|
86
|
-
catch {
|
|
87
|
-
return { matched: false, reason: `trigger.bash_match is not a valid regex` };
|
|
88
|
-
}
|
|
89
|
-
// Raw-OR-normalised-OR-amp-normalised-OR-quote-normalised, mirroring
|
|
90
|
-
// `policyMatchesEvent`'s real evaluation path exactly (third arm added
|
|
91
|
-
// task aabbad63; fourth arm added task f561e44c): dry-run used to test
|
|
92
|
-
// only the RAW command, so it predicted `env -C /tmp git status` as NOT
|
|
93
|
-
// matching `preflight-before-investigation` while `policy intercept`
|
|
94
|
-
// actually blocks it — a debug verb contradicting the runtime it exists
|
|
95
|
-
// to predict (its own comment above and docs/okf/debug-verb-selection.md
|
|
96
|
-
// both assert parity). Leaving out the amp-aware third arm here would
|
|
97
|
-
// reintroduce that SAME class of contradiction for the bare-`&` family
|
|
98
|
-
// (`A=x&env -C /tmp git status`, `echo hi & nice git status`): `policy
|
|
99
|
-
// intercept` now blocks those via `normalizeCommandAmpAware`, so dry-run
|
|
100
|
-
// must try it too. The REPO/BRANCH half of this file (`ledgerQueriesFor`)
|
|
101
|
-
// reuses the runtime's own per-repo attribution
|
|
102
|
-
// (`resolveAttributedContexts`), so a command naming another repository
|
|
103
|
-
// predicts the same additive demands `policy intercept` makes.
|
|
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
|
-
/**
|
|
159
|
-
* Predict every ledger demand for a matched policy. A policy whose
|
|
160
|
-
* `requires:` uses `${REPO}`/`${BRANCH}`/`at_head` is resolved through the
|
|
161
|
-
* runtime's own `resolveAttributedContexts` (no copy of the attribution
|
|
162
|
-
* loop), so the cwd context plus each distinct repository a trigger-
|
|
163
|
-
* satisfying segment names yield one demand each, and the runtime's bound
|
|
164
|
-
* yields one ambiguity text instead of a tag list.
|
|
165
|
-
*/
|
|
166
|
-
function ledgerQueriesFor(policy, ctx, builtins, attribution) {
|
|
167
|
-
if (!usesPerRepoBuiltins(policy))
|
|
168
|
-
return [staticLedgerQuery(policy, ctx, builtins)];
|
|
169
|
-
const result = resolveAttributedContexts(policy, attribution.segments, builtins, attribution.cwdHeadSha, attribution.gitContextMemo, attribution.insideRepositoryMemo, attribution.repoOverridden, attribution.branchOverridden, ctx);
|
|
170
|
-
if (result.kind === "bounded") {
|
|
171
|
-
return [
|
|
172
|
-
`(bounded: ambiguous: this command names at least ${result.distinctCount} distinct ` +
|
|
173
|
-
`repository targets for this policy, exceeding the ${MAX_ATTRIBUTED_CONTEXTS}-context ` +
|
|
174
|
-
`bound; no context queried)`,
|
|
175
|
-
];
|
|
176
|
-
}
|
|
177
|
-
return result.contexts.map((c) => staticLedgerQuery(policy, ctx, c.builtins));
|
|
178
|
-
}
|
|
179
|
-
function policyHit(policy, ctx, builtins, attribution) {
|
|
180
|
-
const ledgerQueries = ledgerQueriesFor(policy, ctx, builtins, attribution);
|
|
181
|
-
return {
|
|
182
|
-
name: policy.name,
|
|
183
|
-
// ledgerQuery keeps the cwd-context value for --json consumers; the runtime
|
|
184
|
-
// may omit that demand (cwd outside every repository, or the bounded case),
|
|
185
|
-
// see ledgerQueries.
|
|
186
|
-
ledgerQuery: staticLedgerQuery(policy, ctx, builtins),
|
|
187
|
-
ledgerQueries,
|
|
188
|
-
requires: policy.requires,
|
|
189
|
-
enforcement: policy.enforcement,
|
|
190
|
-
triggerEvent: policy.trigger.event,
|
|
191
|
-
};
|
|
192
|
-
}
|
|
193
|
-
function formatYaml(report) {
|
|
194
|
-
// Hide raw `null` from YAML output for the no-tool case.
|
|
195
|
-
const visible = {
|
|
196
|
-
prompt: report.prompt,
|
|
197
|
-
...(report.tool !== null && { tool: report.tool }),
|
|
198
|
-
...(report.tool !== null && report.toolArgs !== undefined && {
|
|
199
|
-
toolArgs: report.toolArgs,
|
|
200
|
-
}),
|
|
201
|
-
"Hooks that would fire": report.hooks.length === 0 ? "(none)" : report.hooks,
|
|
202
|
-
"Policies that match": report.matchingPolicies.length === 0 ? "(none)" : report.matchingPolicies,
|
|
203
|
-
"Policies that COULD match (need --tool)": report.couldMatchPolicies.length === 0 ? "(none)" : report.couldMatchPolicies,
|
|
204
|
-
"Memories that would route": report.memoryDirectories.length === 0 ? "(none)" : report.memoryDirectories,
|
|
205
|
-
};
|
|
206
|
-
return stringifyYaml(visible, { lineWidth: 0 });
|
|
207
|
-
}
|
|
208
|
-
export function dryRun(prompt, opts = {}) {
|
|
209
|
-
const { manifest } = loadManifest(opts);
|
|
210
|
-
const tool = opts.tool ?? null;
|
|
211
|
-
let toolArgs = undefined;
|
|
212
|
-
if (opts.toolArgs !== undefined) {
|
|
213
|
-
try {
|
|
214
|
-
toolArgs = JSON.parse(opts.toolArgs);
|
|
215
|
-
}
|
|
216
|
-
catch (err) {
|
|
217
|
-
throw new HarnessExitError(`--tool-args: ${err.message}`, EX_USAGE);
|
|
218
|
-
}
|
|
219
|
-
}
|
|
220
|
-
const cwdGitContext = resolveGitContext(opts.builtins?.CWD ?? process.cwd());
|
|
221
|
-
const builtins = builtinsFor(opts, tool, cwdGitContext);
|
|
222
|
-
const ctx = {
|
|
223
|
-
toolArgs,
|
|
224
|
-
event: { hook_event_name: tool ? "PreToolUse" : "UserPromptSubmit", tool_name: tool, prompt },
|
|
225
|
-
session: { id: builtins.SESSION_ID },
|
|
226
|
-
git: {},
|
|
227
|
-
};
|
|
228
|
-
const command = toolArgs?.command;
|
|
229
|
-
const attribution = {
|
|
230
|
-
segments: tool !== null && typeof command === "string" ? (segmentViewOf(command) ?? []) : [],
|
|
231
|
-
cwdHeadSha: cwdGitContext.sha.length > 0 ? cwdGitContext.sha : undefined,
|
|
232
|
-
gitContextMemo: new Map(),
|
|
233
|
-
insideRepositoryMemo: new Map(),
|
|
234
|
-
repoOverridden: opts.builtins?.REPO !== undefined,
|
|
235
|
-
branchOverridden: opts.builtins?.BRANCH !== undefined,
|
|
236
|
-
};
|
|
237
|
-
const hooks = buildHookHits(manifest, tool);
|
|
238
|
-
const matching = [];
|
|
239
|
-
const couldMatch = [];
|
|
240
|
-
for (const policy of manifest.policies) {
|
|
241
|
-
if (PROMPT_EVENTS.has(policy.trigger.event)) {
|
|
242
|
-
if (policyMatchesPrompt(policy, prompt)) {
|
|
243
|
-
matching.push(policyHit(policy, ctx, builtins, attribution));
|
|
244
|
-
}
|
|
245
|
-
continue;
|
|
246
|
-
}
|
|
247
|
-
// PreToolUse and friends.
|
|
248
|
-
if (tool === null) {
|
|
249
|
-
couldMatch.push({
|
|
250
|
-
name: policy.name,
|
|
251
|
-
triggerEvent: policy.trigger.event,
|
|
252
|
-
reason: "no --tool supplied; dry-run can only statically match prompt-style events",
|
|
253
|
-
});
|
|
254
|
-
continue;
|
|
255
|
-
}
|
|
256
|
-
const verdict = policyMatchesTool(policy, tool, toolArgs);
|
|
257
|
-
if (verdict.matched) {
|
|
258
|
-
matching.push(policyHit(policy, ctx, builtins, attribution));
|
|
259
|
-
}
|
|
260
|
-
else {
|
|
261
|
-
couldMatch.push({
|
|
262
|
-
name: policy.name,
|
|
263
|
-
triggerEvent: policy.trigger.event,
|
|
264
|
-
reason: verdict.reason,
|
|
265
|
-
});
|
|
266
|
-
}
|
|
267
|
-
}
|
|
268
|
-
const memoryDirectories = manifest.memory.directories.map((d) => ({ path: d.path, scope: d.scope }));
|
|
269
|
-
const report = {
|
|
270
|
-
prompt,
|
|
271
|
-
tool,
|
|
272
|
-
toolArgs,
|
|
273
|
-
hooks,
|
|
274
|
-
matchingPolicies: matching,
|
|
275
|
-
couldMatchPolicies: couldMatch,
|
|
276
|
-
memoryDirectories,
|
|
277
|
-
};
|
|
278
|
-
const output = opts.json
|
|
279
|
-
? `${JSON.stringify(report, null, 2)}\n`
|
|
280
|
-
: formatYaml(report);
|
|
281
|
-
return { output, report };
|
|
282
|
-
}
|
|
283
|
-
//# 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,EAC1B,aAAa,GAEd,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAAE,iBAAiB,EAAuB,MAAM,2BAA2B,CAAC;AACnF,OAAO,EACL,oBAAoB,EACpB,uBAAuB,EACvB,yBAAyB,EACzB,mBAAmB,GACpB,MAAM,yBAAyB,CAAC;AAEjC,OAAO,EAAE,QAAQ,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAC7D,OAAO,EAAE,YAAY,EAAsB,MAAM,aAAa,CAAC;AA+D/D,MAAM,aAAa,GAAG,IAAI,GAAG,CAAC,CAAC,kBAAkB,EAAE,cAAc,CAAC,CAAC,CAAC;AAEpE,SAAS,WAAW,CAClB,IAAmB,EACnB,IAAmB,EACnB,UAA0B;IAE1B,MAAM,QAAQ,GAAG,IAAI,CAAC,QAAQ,IAAI,EAAE,CAAC;IACrC,uEAAuE;IACvE,oEAAoE;IACpE,wEAAwE;IACxE,wEAAwE;IACxE,+BAA+B;IAC/B,MAAM,GAAG,GAAG,QAAQ,CAAC,GAAG,IAAI,OAAO,CAAC,GAAG,EAAE,CAAC;IAC1C,OAAO;QACL,UAAU,EAAE,QAAQ,CAAC,UAAU,IAAI,SAAS;QAC5C,IAAI,EAAE,QAAQ,CAAC,IAAI,IAAI,UAAU,CAAC,IAAI;QACtC,MAAM,EAAE,QAAQ,CAAC,MAAM,IAAI,UAAU,CAAC,MAAM;QAC5C,SAAS,EAAE,QAAQ,C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BAAgB,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,35 +0,0 @@
|
|
|
1
|
-
import { type ActionEnvelope } from "../runtime/index.js";
|
|
2
|
-
import type { Manifest } from "../schema/index.js";
|
|
3
|
-
import type { LoadedEvent } from "./event-input.js";
|
|
4
|
-
import { type BashPrefixEnrichment } from "./policy/risk-envelope-enrichment.js";
|
|
5
|
-
/** Injectable env and kube seams (tests); ambient values otherwise. */
|
|
6
|
-
export interface EnrichmentSeams {
|
|
7
|
-
/** Env vars the inline assignments merge over; defaults to `process.env`. */
|
|
8
|
-
env?: Record<string, string | undefined>;
|
|
9
|
-
/** Kube context; when either kube seam is set `~/.kube/config` is not read. */
|
|
10
|
-
kubeContext?: string;
|
|
11
|
-
/** Kube namespace; see `kubeContext`. */
|
|
12
|
-
kubeNamespace?: string;
|
|
13
|
-
}
|
|
14
|
-
export interface EnrichedEvent {
|
|
15
|
-
/** The envelope after the `cd` merge and the branch-switch upgrade. */
|
|
16
|
-
envelope: ActionEnvelope;
|
|
17
|
-
enrichment: BashPrefixEnrichment;
|
|
18
|
-
kube: {
|
|
19
|
-
context: string;
|
|
20
|
-
namespace: string;
|
|
21
|
-
};
|
|
22
|
-
}
|
|
23
|
-
/**
|
|
24
|
-
* Kube seams resolve together: if either is injected, skip the
|
|
25
|
-
* `~/.kube/config` read entirely (same contract `resolve-env` always had).
|
|
26
|
-
*/
|
|
27
|
-
export declare function resolveKubeSeams(seams: EnrichmentSeams): {
|
|
28
|
-
context: string;
|
|
29
|
-
namespace: string;
|
|
30
|
-
};
|
|
31
|
-
/**
|
|
32
|
-
* Run the hook's Bash-prefix enrichment over a loaded event and rebuild
|
|
33
|
-
* the envelope when the enrichment moved the git context.
|
|
34
|
-
*/
|
|
35
|
-
export declare function enrichLoadedEvent(loaded: LoadedEvent, manifest: Manifest, seams: EnrichmentSeams): EnrichedEvent;
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
// Shared "enrich a loaded tool event like the hook does" front end for the
|
|
2
|
-
// Risk Gate debug verbs that read an event file and predict a verdict:
|
|
3
|
-
// `harness explain-policy`, `harness resolve-env`, `harness test-risk` and
|
|
4
|
-
// `harness explain-action` (task 8b891e83).
|
|
5
|
-
//
|
|
6
|
-
// `harness policy intercept` resolves its envelope and environment through
|
|
7
|
-
// `resolveBashPrefixEnrichment` (inline `VAR=value`, leading `cd`, leading
|
|
8
|
-
// `git switch|checkout`). Every verb that predicts the gate must read the
|
|
9
|
-
// same enriched inputs, or an operator's prediction disagrees with the
|
|
10
|
-
// gate (`DATABASE_URL=...prod... psql ...` resolved `unknown` in the debug
|
|
11
|
-
// verbs and `production` in the hook). This module is the one place the
|
|
12
|
-
// verbs call that helper; it reads no ledger or evidence and imports
|
|
13
|
-
// nothing from `policies/`.
|
|
14
|
-
import { buildActionEnvelope, resolveKubeContext, } from "../runtime/index.js";
|
|
15
|
-
import { resolveBashPrefixEnrichment, } from "./policy/risk-envelope-enrichment.js";
|
|
16
|
-
/**
|
|
17
|
-
* Kube seams resolve together: if either is injected, skip the
|
|
18
|
-
* `~/.kube/config` read entirely (same contract `resolve-env` always had).
|
|
19
|
-
*/
|
|
20
|
-
export function resolveKubeSeams(seams) {
|
|
21
|
-
return seams.kubeContext !== undefined || seams.kubeNamespace !== undefined
|
|
22
|
-
? { context: seams.kubeContext ?? "", namespace: seams.kubeNamespace ?? "" }
|
|
23
|
-
: resolveKubeContext();
|
|
24
|
-
}
|
|
25
|
-
/**
|
|
26
|
-
* Run the hook's Bash-prefix enrichment over a loaded event and rebuild
|
|
27
|
-
* the envelope when the enrichment moved the git context.
|
|
28
|
-
*/
|
|
29
|
-
export function enrichLoadedEvent(loaded, manifest, seams) {
|
|
30
|
-
const { event, envelope: baseEnvelope } = loaded;
|
|
31
|
-
const kube = resolveKubeSeams(seams);
|
|
32
|
-
const enrichment = resolveBashPrefixEnrichment({
|
|
33
|
-
event,
|
|
34
|
-
manifest,
|
|
35
|
-
cwd: baseEnvelope.runtime.cwd,
|
|
36
|
-
cwdGitContext: {
|
|
37
|
-
repo: baseEnvelope.session.repo,
|
|
38
|
-
branch: baseEnvelope.session.branch,
|
|
39
|
-
sha: "",
|
|
40
|
-
},
|
|
41
|
-
env: seams.env ?? process.env,
|
|
42
|
-
kubeContext: kube.context,
|
|
43
|
-
kubeNamespace: kube.namespace,
|
|
44
|
-
user: baseEnvelope.runtime.user,
|
|
45
|
-
host: baseEnvelope.runtime.host,
|
|
46
|
-
now: new Date(baseEnvelope.timestamp),
|
|
47
|
-
});
|
|
48
|
-
const envelope = enrichment.git.repo === baseEnvelope.session.repo &&
|
|
49
|
-
enrichment.git.branch === baseEnvelope.session.branch
|
|
50
|
-
? baseEnvelope
|
|
51
|
-
: buildActionEnvelope(event, {
|
|
52
|
-
cwd: baseEnvelope.runtime.cwd,
|
|
53
|
-
git: enrichment.git,
|
|
54
|
-
user: baseEnvelope.runtime.user,
|
|
55
|
-
host: baseEnvelope.runtime.host,
|
|
56
|
-
now: new Date(baseEnvelope.timestamp),
|
|
57
|
-
});
|
|
58
|
-
return { envelope, enrichment, kube };
|
|
59
|
-
}
|
|
60
|
-
//# sourceMappingURL=enriched-event.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"enriched-event.js","sourceRoot":"","sources":["../../src/cli/enriched-event.ts"],"names":[],"mappings":"AAAA,2EAA2E;AAC3E,uEAAuE;AACvE,2EAA2E;AAC3E,4CAA4C;AAC5C,EAAE;AACF,2EAA2E;AAC3E,2EAA2E;AAC3E,0EAA0E;AA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AC,YAAY,CAAC,SAAS,CAAC;KACtC,CAAC,CAAC;IACH,MAAM,QAAQ,GACZ,UAAU,CAAC,GAAG,CAAC,IAAI,KAAK,YAAY,CAAC,OAAO,CAAC,IAAI;QACjD,UAAU,CAAC,GAAG,CAAC,MAAM,KAAK,YAAY,CAAC,OAAO,CAAC,MAAM;QACnD,CAAC,CAAC,YAAY;QACd,CAAC,CAAC,mBAAmB,CAAC,KAAK,EAAE;YACzB,GAAG,EAAE,YAAY,CAAC,OAAO,CAAC,GAAG;YAC7B,GAAG,EAAE,UAAU,CAAC,GAAG;YACnB,IAAI,EAAE,YAAY,CAAC,OAAO,CAAC,IAAI;YAC/B,IAAI,EAAE,YAAY,CAAC,OAAO,CAAC,IAAI;YAC/B,GAAG,EAAE,IAAI,IAAI,CAAC,YAAY,CAAC,SAAS,CAAC;SACtC,CAAC,CAAC;IACT,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,IAAI,EAAE,CAAC;AACxC,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;
|