@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,164 +0,0 @@
|
|
|
1
|
-
import * as fs from "node:fs";
|
|
2
|
-
import * as os from "node:os";
|
|
3
|
-
import * as path from "node:path";
|
|
4
|
-
import { rejectMalformedSessionId } from "../../runtime/reject-malformed-session-id.js";
|
|
5
|
-
export function parseTranscript(jsonl) {
|
|
6
|
-
const events = [];
|
|
7
|
-
let startedAt = null;
|
|
8
|
-
let endedAt = null;
|
|
9
|
-
let cwd = null;
|
|
10
|
-
let malformedLines = 0;
|
|
11
|
-
for (const line of jsonl.split("\n")) {
|
|
12
|
-
if (!line.trim())
|
|
13
|
-
continue;
|
|
14
|
-
let raw;
|
|
15
|
-
try {
|
|
16
|
-
raw = JSON.parse(line);
|
|
17
|
-
}
|
|
18
|
-
catch {
|
|
19
|
-
malformedLines += 1;
|
|
20
|
-
continue;
|
|
21
|
-
}
|
|
22
|
-
const ts = typeof raw.timestamp === "string" ? raw.timestamp : null;
|
|
23
|
-
if (ts !== null) {
|
|
24
|
-
if (startedAt === null || ts < startedAt)
|
|
25
|
-
startedAt = ts;
|
|
26
|
-
if (endedAt === null || ts > endedAt)
|
|
27
|
-
endedAt = ts;
|
|
28
|
-
}
|
|
29
|
-
if (typeof raw.cwd === "string" && cwd === null)
|
|
30
|
-
cwd = raw.cwd;
|
|
31
|
-
const baseFields = {
|
|
32
|
-
...(typeof raw.uuid === "string" ? { uuid: raw.uuid } : {}),
|
|
33
|
-
...(typeof raw.parentUuid === "string" ? { parentUuid: raw.parentUuid } : {}),
|
|
34
|
-
...(typeof raw.cwd === "string" ? { cwd: raw.cwd } : {}),
|
|
35
|
-
};
|
|
36
|
-
const base = {
|
|
37
|
-
source: "transcript",
|
|
38
|
-
timestamp: ts,
|
|
39
|
-
...baseFields,
|
|
40
|
-
};
|
|
41
|
-
switch (raw.type) {
|
|
42
|
-
case "user": {
|
|
43
|
-
const content = raw.message?.content;
|
|
44
|
-
if (typeof content === "string") {
|
|
45
|
-
events.push({ ...base, kind: "user_prompt", data: { text: content } });
|
|
46
|
-
}
|
|
47
|
-
else if (Array.isArray(content)) {
|
|
48
|
-
for (const block of content) {
|
|
49
|
-
if (!block || typeof block !== "object")
|
|
50
|
-
continue;
|
|
51
|
-
const b = block;
|
|
52
|
-
if (b.type === "tool_result") {
|
|
53
|
-
events.push({
|
|
54
|
-
...base,
|
|
55
|
-
kind: "user_tool_result",
|
|
56
|
-
data: {
|
|
57
|
-
tool_use_id: b.tool_use_id,
|
|
58
|
-
is_error: b.is_error,
|
|
59
|
-
content: b.content,
|
|
60
|
-
},
|
|
61
|
-
});
|
|
62
|
-
}
|
|
63
|
-
else if (b.type === "text") {
|
|
64
|
-
events.push({
|
|
65
|
-
...base,
|
|
66
|
-
kind: "user_prompt",
|
|
67
|
-
data: { text: b.text },
|
|
68
|
-
});
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
break;
|
|
73
|
-
}
|
|
74
|
-
case "assistant": {
|
|
75
|
-
const content = raw.message?.content;
|
|
76
|
-
if (Array.isArray(content)) {
|
|
77
|
-
for (const block of content) {
|
|
78
|
-
if (!block || typeof block !== "object")
|
|
79
|
-
continue;
|
|
80
|
-
const b = block;
|
|
81
|
-
if (b.type === "text") {
|
|
82
|
-
events.push({
|
|
83
|
-
...base,
|
|
84
|
-
kind: "assistant_text",
|
|
85
|
-
data: { text: b.text },
|
|
86
|
-
});
|
|
87
|
-
}
|
|
88
|
-
else if (b.type === "thinking") {
|
|
89
|
-
events.push({
|
|
90
|
-
...base,
|
|
91
|
-
kind: "assistant_thinking",
|
|
92
|
-
data: { text: b.thinking ?? b.text },
|
|
93
|
-
});
|
|
94
|
-
}
|
|
95
|
-
else if (b.type === "tool_use") {
|
|
96
|
-
events.push({
|
|
97
|
-
...base,
|
|
98
|
-
kind: "assistant_tool_use",
|
|
99
|
-
data: { id: b.id, name: b.name, input: b.input },
|
|
100
|
-
});
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
break;
|
|
105
|
-
}
|
|
106
|
-
case "attachment": {
|
|
107
|
-
events.push({
|
|
108
|
-
...base,
|
|
109
|
-
kind: "attachment",
|
|
110
|
-
data: { attachment: raw.attachment },
|
|
111
|
-
});
|
|
112
|
-
break;
|
|
113
|
-
}
|
|
114
|
-
case "permission-mode": {
|
|
115
|
-
events.push({
|
|
116
|
-
...base,
|
|
117
|
-
kind: "permission_mode",
|
|
118
|
-
data: { mode: raw.permissionMode },
|
|
119
|
-
});
|
|
120
|
-
break;
|
|
121
|
-
}
|
|
122
|
-
case "file-history-snapshot": {
|
|
123
|
-
events.push({
|
|
124
|
-
...base,
|
|
125
|
-
kind: "file_history_snapshot",
|
|
126
|
-
data: {
|
|
127
|
-
messageId: raw.messageId,
|
|
128
|
-
isSnapshotUpdate: raw.isSnapshotUpdate,
|
|
129
|
-
snapshot: raw.snapshot,
|
|
130
|
-
},
|
|
131
|
-
});
|
|
132
|
-
break;
|
|
133
|
-
}
|
|
134
|
-
default:
|
|
135
|
-
// Ignore unknown record types; future Claude Code versions may add new ones.
|
|
136
|
-
break;
|
|
137
|
-
}
|
|
138
|
-
}
|
|
139
|
-
return { events, startedAt, endedAt, cwd, malformedLines };
|
|
140
|
-
}
|
|
141
|
-
export function locateTranscript(sessionId, opts = {}) {
|
|
142
|
-
rejectMalformedSessionId(sessionId);
|
|
143
|
-
const projectsRoot = opts.projectsRoot ?? path.join(opts.homeDir ?? os.homedir(), ".claude", "projects");
|
|
144
|
-
if (!fs.existsSync(projectsRoot))
|
|
145
|
-
return null;
|
|
146
|
-
let dirs;
|
|
147
|
-
try {
|
|
148
|
-
dirs = fs.readdirSync(projectsRoot);
|
|
149
|
-
}
|
|
150
|
-
catch {
|
|
151
|
-
return null;
|
|
152
|
-
}
|
|
153
|
-
for (const dir of dirs) {
|
|
154
|
-
const candidate = path.join(projectsRoot, dir, `${sessionId}.jsonl`);
|
|
155
|
-
if (fs.existsSync(candidate))
|
|
156
|
-
return candidate;
|
|
157
|
-
}
|
|
158
|
-
return null;
|
|
159
|
-
}
|
|
160
|
-
export function readTranscript(filePath) {
|
|
161
|
-
const raw = fs.readFileSync(filePath, "utf8");
|
|
162
|
-
return parseTranscript(raw);
|
|
163
|
-
}
|
|
164
|
-
//# sourceMappingURL=transcript.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"transcript.js","sourceRoot":"","sources":["../../../src/cli/session-export/transcript.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAClC,OAAO,EAAE,wBAAwB,EAAE,MAAM,8CAA8C,CAAC;AA4CxF,MAAM,UAAU,eAAe,CAAC,KAAa;IAC3C,MAAM,MAAM,GAAsB,EAAE,CAAC;IACrC,IAAI,SAAS,GAAkB,IA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AU,CAAC,YAAY,CAAC;QAAE,OAAO,IAAI,CAAC;IAC9C,IAAI,IAAc,CAAC;IACnB,IAAI,CAAC;QACH,IAAI,GAAG,EAAE,CAAC,WAAW,CAAC,YAAY,CAAC,CAAC;IACtC,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,IAAI,CAAC;IACd,CAAC;IACD,KAAK,MAAM,GAAG,IAAI,IAAI,EAAE,CAAC;QACvB,MAAM,SAAS,GAAG,IAAI,CAAC,IAAI,CAAC,YAAY,EAAE,GAAG,EAAE,GAAG,SAAS,QAAQ,CAAC,CAAC;QACrE,IAAI,EAAE,CAAC,UAAU,CAAC,SAAS,CAAC;YAAE,OAAO,SAAS,CAAC;IACjD,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC;AAED,MAAM,UAAU,cAAc,CAAC,QAAgB;IAC7C,MAAM,GAAG,GAAG,EAAE,CAAC,YAAY,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;IAC9C,OAAO,eAAe,CAAC,GAAG,CAAC,CAAC;AAC9B,CAAC"}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { type SessionSource, type SessionStartCwdOptions } from "./shared-options.js";
|
|
2
|
-
export type SessionStartBranchCheckOptions = SessionStartCwdOptions;
|
|
3
|
-
export interface SessionStartBranchCheckResult {
|
|
4
|
-
/** Always 0 — SessionStart hooks must never break the session loop. */
|
|
5
|
-
exitCode: number;
|
|
6
|
-
/** Whether the `branch:non-protected` ledger fact was written. */
|
|
7
|
-
wrote: boolean;
|
|
8
|
-
/** Resolved branch name ("" when detached or outside a repo). */
|
|
9
|
-
branch: string;
|
|
10
|
-
/** True when the resolved branch matched the protected list. */
|
|
11
|
-
protected: boolean;
|
|
12
|
-
/** Resolved session id. */
|
|
13
|
-
sessionId: string;
|
|
14
|
-
sessionSource: SessionSource;
|
|
15
|
-
/** Human-readable explanation of a non-write outcome (when applicable). */
|
|
16
|
-
reason?: string;
|
|
17
|
-
}
|
|
18
|
-
export declare function runSessionStartBranchCheck(opts?: SessionStartBranchCheckOptions): Promise<SessionStartBranchCheckResult>;
|
|
@@ -1,140 +0,0 @@
|
|
|
1
|
-
// `harness session-start branch-check` — SessionStart hook entrypoint
|
|
2
|
-
// for the `branch-protection` policy pack.
|
|
3
|
-
//
|
|
4
|
-
// Reads `.git/HEAD` for the cwd and, when the current branch is NOT in
|
|
5
|
-
// the operator's protected list, writes a `branch:non-protected:<branch>`
|
|
6
|
-
// fact to the evidence ledger so the pack's PreToolUse blocker has a
|
|
7
|
-
// fresh tag to satisfy its 5-minute freshness window.
|
|
8
|
-
//
|
|
9
|
-
// SessionStart contract: `blocking:false`. Every failure path (no git
|
|
10
|
-
// dir, manifest load fails, no grounding-mcp wired, ledger write
|
|
11
|
-
// fails) logs one line to stderr and exits 0. The only observable
|
|
12
|
-
// effect of a failure is that the blocker stays closed, which is the
|
|
13
|
-
// safe default: a session that can't prove it's NOT on a protected
|
|
14
|
-
// branch is treated as if it might be.
|
|
15
|
-
//
|
|
16
|
-
// Detached HEAD (`branch === ""`) is treated as PROTECTED: we can't
|
|
17
|
-
// audit-by-name what the agent might commit. The producer leaves the
|
|
18
|
-
// tag unwritten and stderr-notes the reason.
|
|
19
|
-
//
|
|
20
|
-
// Re-runnable on demand from the operator's `!` shell with no event
|
|
21
|
-
// JSON piped on stdin — same CLI verb, no SessionStart event needed.
|
|
22
|
-
import { addLedgerFact, resolveGitContext, } from "../../runtime/index.js";
|
|
23
|
-
import { resolveReadSessionId } from "../../runtime/session-id.js";
|
|
24
|
-
import { DEFAULT_PROTECTED_BRANCHES, isProtectedBranch, NON_PROTECTED_TAG_PREFIX, PACK_NAME, resolveProtectedBranches, } from "../../policy-packs/builtin/branch-protection-runtime.js";
|
|
25
|
-
import { loadManifest } from "../loader.js";
|
|
26
|
-
import { classifySessionSource, explicitSessionId, FALLBACK_SESSION, malformedEventReason, readSessionStartEvent, resolveEventCwd, } from "./shared-options.js";
|
|
27
|
-
const LEDGER_SOURCE = "harness-session-start-branch-check";
|
|
28
|
-
function findGroundingMcp(manifest) {
|
|
29
|
-
return manifest.tools.mcp.find((m) => m.name === "grounding-mcp") ?? null;
|
|
30
|
-
}
|
|
31
|
-
function mcpCommandList(server) {
|
|
32
|
-
return Array.isArray(server.command)
|
|
33
|
-
? server.command
|
|
34
|
-
: server.command.trim().split(/\s+/);
|
|
35
|
-
}
|
|
36
|
-
export async function runSessionStartBranchCheck(opts = {}) {
|
|
37
|
-
const stdin = opts.stdin ?? process.stdin;
|
|
38
|
-
const stderr = opts.stderr ?? process.stderr;
|
|
39
|
-
const note = (msg) => {
|
|
40
|
-
stderr.write(`harness session-start branch-check: ${msg}\n`);
|
|
41
|
-
};
|
|
42
|
-
const done = (wrote, branch, isProtected, sessionId, sessionSource, reason) => ({
|
|
43
|
-
exitCode: 0,
|
|
44
|
-
wrote,
|
|
45
|
-
branch,
|
|
46
|
-
protected: isProtected,
|
|
47
|
-
sessionId,
|
|
48
|
-
sessionSource,
|
|
49
|
-
...(reason !== undefined && { reason }),
|
|
50
|
-
});
|
|
51
|
-
let event;
|
|
52
|
-
try {
|
|
53
|
-
event = await readSessionStartEvent(stdin, {
|
|
54
|
-
onTimeout: note,
|
|
55
|
-
...(opts.stdinIdleTimeoutMs !== undefined && { idleTimeoutMs: opts.stdinIdleTimeoutMs }),
|
|
56
|
-
});
|
|
57
|
-
}
|
|
58
|
-
catch (err) {
|
|
59
|
-
const reason = malformedEventReason(err);
|
|
60
|
-
note(reason);
|
|
61
|
-
return done(false, "", false, FALLBACK_SESSION, "default", reason);
|
|
62
|
-
}
|
|
63
|
-
const cwd = resolveEventCwd(opts.cwd, event);
|
|
64
|
-
const { branch } = resolveGitContext(cwd);
|
|
65
|
-
// Load manifest to resolve the pack's protected_branches override.
|
|
66
|
-
// Fallback to defaults on any load failure (the producer's job is
|
|
67
|
-
// best-effort; an unresolvable manifest still permits a sane gate).
|
|
68
|
-
let manifest = null;
|
|
69
|
-
if (opts.manifest) {
|
|
70
|
-
manifest = opts.manifest;
|
|
71
|
-
}
|
|
72
|
-
else {
|
|
73
|
-
try {
|
|
74
|
-
manifest = loadManifest(opts).manifest;
|
|
75
|
-
}
|
|
76
|
-
catch (err) {
|
|
77
|
-
note(`manifest load failed: ${err.message}; falling back to default protected list`);
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
const pack = manifest?.policy_packs.find((p) => p.name === PACK_NAME);
|
|
81
|
-
const { branches: protectedList, warning: protectedWarning } = pack
|
|
82
|
-
? resolveProtectedBranches(pack)
|
|
83
|
-
: { branches: [...DEFAULT_PROTECTED_BRANCHES], warning: null };
|
|
84
|
-
if (protectedWarning)
|
|
85
|
-
note(protectedWarning);
|
|
86
|
-
// Resolve session id with the same precedence chain as
|
|
87
|
-
// session-start/preflight so the two producers stay symmetric.
|
|
88
|
-
const explicit = explicitSessionId(opts.session, event);
|
|
89
|
-
const resolveSession = opts.resolveSession ?? resolveReadSessionId;
|
|
90
|
-
const sessionId = resolveSession(explicit, {});
|
|
91
|
-
const sessionSource = classifySessionSource(opts.session, event, sessionId);
|
|
92
|
-
if (branch === "") {
|
|
93
|
-
const reason = `cwd is not on a named branch (detached HEAD or outside a git work tree); leaving the gate closed (treated as protected)`;
|
|
94
|
-
note(reason);
|
|
95
|
-
return done(false, "", true, sessionId, sessionSource, reason);
|
|
96
|
-
}
|
|
97
|
-
const isProtected = isProtectedBranch(branch, protectedList);
|
|
98
|
-
if (isProtected) {
|
|
99
|
-
const reason = `branch "${branch}" is in the protected list (${protectedList.join(", ")}); leaving the gate closed`;
|
|
100
|
-
note(reason);
|
|
101
|
-
return done(false, branch, true, sessionId, sessionSource, reason);
|
|
102
|
-
}
|
|
103
|
-
// Branch is non-protected: write the tag.
|
|
104
|
-
const content = `${NON_PROTECTED_TAG_PREFIX}:${branch}`;
|
|
105
|
-
let writeLedger = opts.writeLedger;
|
|
106
|
-
if (!writeLedger) {
|
|
107
|
-
if (!manifest) {
|
|
108
|
-
const reason = `manifest unavailable; cannot record ${content}`;
|
|
109
|
-
note(reason);
|
|
110
|
-
return done(false, branch, false, sessionId, sessionSource, reason);
|
|
111
|
-
}
|
|
112
|
-
const server = findGroundingMcp(manifest);
|
|
113
|
-
if (!server) {
|
|
114
|
-
const reason = `grounding-mcp not declared in manifest; cannot record ${content}`;
|
|
115
|
-
note(reason);
|
|
116
|
-
return done(false, branch, false, sessionId, sessionSource, reason);
|
|
117
|
-
}
|
|
118
|
-
const command = mcpCommandList(server);
|
|
119
|
-
const env = server.env ?? undefined;
|
|
120
|
-
const timeoutMs = opts.ledgerTimeoutMs ?? server.health?.timeout_ms ?? 5_000;
|
|
121
|
-
writeLedger = (args) => addLedgerFact({
|
|
122
|
-
mcpCommand: command,
|
|
123
|
-
...(env && { mcpEnv: env }),
|
|
124
|
-
timeoutMs,
|
|
125
|
-
...args,
|
|
126
|
-
});
|
|
127
|
-
}
|
|
128
|
-
const result = await writeLedger({ sessionId, content, source: LEDGER_SOURCE });
|
|
129
|
-
if (!result.ok) {
|
|
130
|
-
const reason = `ledger write failed: ${result.reason ?? "unknown error"}`;
|
|
131
|
-
note(reason);
|
|
132
|
-
return done(false, branch, false, sessionId, sessionSource, reason);
|
|
133
|
-
}
|
|
134
|
-
note(`recorded ${content} for session ${sessionId}`);
|
|
135
|
-
if (sessionSource === "default") {
|
|
136
|
-
note("WARNING: session resolved to the literal \"default\". The blocker queries the real Claude Code session id and will NOT see this tag. Pipe SessionStart event JSON on stdin, export $CLAUDE_SESSION_ID, or pass --session <id>.");
|
|
137
|
-
}
|
|
138
|
-
return done(true, branch, false, sessionId, sessionSource);
|
|
139
|
-
}
|
|
140
|
-
//# sourceMappingURL=branch-check.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"branch-check.js","sourceRoot":"","sources":["../../../src/cli/session-start/branch-check.ts"],"names":[],"mappings":"AAAA,sEAAsE;AACtE,2CAA2C;AAC3C,EAAE;AACF,uEAAuE;AACvE,0EAA0E;AAC1E,qEAAqE;A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C,MAAM,EAAE,UAAU,IAAI,KAAK,CAAC;QAC7E,WAAW,GAAG,CAAC,IAAI,EAAE,EAAE,CACrB,aAAa,CAAC;YACZ,UAAU,EAAE,OAAO;YACnB,GAAG,CAAC,GAAG,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC;YAC3B,SAAS;YACT,GAAG,IAAI;SACR,CAAC,CAAC;IACP,CAAC;IAED,MAAM,MAAM,GAAG,MAAM,WAAW,CAAC,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,EAAE,aAAa,EAAE,CAAC,CAAC;IAChF,IAAI,CAAC,MAAM,CAAC,EAAE,EAAE,CAAC;QACf,MAAM,MAAM,GAAG,wBAAwB,MAAM,CAAC,MAAM,IAAI,eAAe,EAAE,CAAC;QAC1E,IAAI,CAAC,MAAM,CAAC,CAAC;QACb,OAAO,IAAI,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,CAAC,CAAC;IACtE,CAAC;IACD,IAAI,CAAC,YAAY,OAAO,gBAAgB,SAAS,EAAE,CAAC,CAAC;IACrD,IAAI,aAAa,KAAK,SAAS,EAAE,CAAC;QAChC,IAAI,CACF,gOAAgO,CACjO,CAAC;IACJ,CAAC;IACD,OAAO,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,SAAS,EAAE,aAAa,CAAC,CAAC;AAC7D,CAAC"}
|
|
@@ -1,121 +0,0 @@
|
|
|
1
|
-
import type { Manifest } from "../../schema/index.js";
|
|
2
|
-
import { type SessionSource, type SessionStartCommonOptions } from "./shared-options.js";
|
|
3
|
-
export declare const PREFLIGHT_BIN = "preflight";
|
|
4
|
-
/** The slice of `preflight run --json` output this producer reads. */
|
|
5
|
-
export interface PreflightJson {
|
|
6
|
-
ready?: boolean;
|
|
7
|
-
confidence?: number;
|
|
8
|
-
checks?: Array<{
|
|
9
|
-
name?: string;
|
|
10
|
-
status?: string;
|
|
11
|
-
message?: string;
|
|
12
|
-
details?: string[];
|
|
13
|
-
}>;
|
|
14
|
-
}
|
|
15
|
-
export type RunPreflightResult = {
|
|
16
|
-
ok: true;
|
|
17
|
-
json: PreflightJson;
|
|
18
|
-
} | {
|
|
19
|
-
ok: false;
|
|
20
|
-
reason: string;
|
|
21
|
-
};
|
|
22
|
-
export interface SessionStartPreflightOptions extends SessionStartCommonOptions {
|
|
23
|
-
/** `preflight` subprocess timeout in ms. */
|
|
24
|
-
preflightTimeoutMs?: number;
|
|
25
|
-
/** Inject the preflight runner (tests). */
|
|
26
|
-
runPreflight?: (cwd: string, timeoutMs: number, setup: boolean) => Promise<RunPreflightResult>;
|
|
27
|
-
/**
|
|
28
|
-
* Inject the resolved manifest (tests). Scope is EXACTLY one call
|
|
29
|
-
* site: the `setupEnabled` resolution of
|
|
30
|
-
* `session_start_preflight.setup` (task 30183330), same seam shape as
|
|
31
|
-
* `harness explain-policy`'s own `manifest` option. The
|
|
32
|
-
* ledger-writer's own `loadManifest` call further down (used only
|
|
33
|
-
* when `writeLedger` is not injected) deliberately does NOT read this
|
|
34
|
-
* field, so injecting a manifest never suppresses that call's
|
|
35
|
-
* run-aborting failure path. A failure to resolve `setup` here (this
|
|
36
|
-
* field is absent AND `loadManifest(opts)` throws) degrades to
|
|
37
|
-
* `setup: false` (matches the sibling SessionStart companions' "not
|
|
38
|
-
* configured -> skip" contract) rather than aborting the entire
|
|
39
|
-
* preflight run over this one unrelated knob. Injecting this field
|
|
40
|
-
* also bypasses the cwd-derived project layer that resolution
|
|
41
|
-
* otherwise feeds through the loader (task c88461c1, see the
|
|
42
|
-
* `setupEnabled` block itself): an injected manifest already IS the
|
|
43
|
-
* merged result, so there is nothing left for a project layer to
|
|
44
|
-
* apply to.
|
|
45
|
-
*/
|
|
46
|
-
manifest?: Manifest;
|
|
47
|
-
/**
|
|
48
|
-
* Directory the not-ready diagnostic JSON is persisted to (task
|
|
49
|
-
* T-001). Test seam — production defaults to the dirname of the
|
|
50
|
-
* manifest path `resolvePaths()` resolves, plus `/logs`
|
|
51
|
-
* (`path.dirname(resolvePaths(opts).base)`, task 80f49922). That is
|
|
52
|
-
* normally `<home>/logs`, where `<home>` follows the usual precedence
|
|
53
|
-
* ($HARNESS_HOME, then `~/.harness/`, then the legacy `~/.claude/`
|
|
54
|
-
* fallback) — EXCEPT when `configPath` is injected without `homeDir`:
|
|
55
|
-
* `configPath` overrides the manifest path directly, so the log dir
|
|
56
|
-
* becomes `dirname(configPath)/logs` and does NOT route through
|
|
57
|
-
* home-dir resolution at all in that case. `resolvePaths()` throws
|
|
58
|
-
* unless `homeDir` or `configPath` is also injected (loader.ts:45-64).
|
|
59
|
-
* Always pass a tmp dir in tests so nothing ever touches the
|
|
60
|
-
* operator's real `~/.harness/logs/` (or the legacy `~/.claude/logs/`).
|
|
61
|
-
*/
|
|
62
|
-
logDir?: string;
|
|
63
|
-
/**
|
|
64
|
-
* Inject the `.pending-approval` writer. Opt-in: staging only happens
|
|
65
|
-
* when the caller explicitly passes a writer. The CLI entry points
|
|
66
|
-
* (`harness preflight` and `harness session-start preflight`) wire
|
|
67
|
-
* `writePendingApproval` from `runtime/pending-approval`, so operators
|
|
68
|
-
* get the bootstrap fix; library callers that import this function
|
|
69
|
-
* directly do not pollute the real `~/.claude/harness.generated/`
|
|
70
|
-
* unless they opt in. Hotfix for v0.21.0 which defaulted to ON and
|
|
71
|
-
* caused vitest runs to clobber the operator's pending-approval file
|
|
72
|
-
* via the `npm-test` preflight check (agent-tasks/<this hotfix>).
|
|
73
|
-
* Pass `null` to make the opt-out explicit; `undefined` (the default)
|
|
74
|
-
* is the same no-op.
|
|
75
|
-
*/
|
|
76
|
-
stagePendingApproval?: ((generatedDir: string, sessionId: string) => void) | null;
|
|
77
|
-
}
|
|
78
|
-
export interface SessionStartPreflightResult {
|
|
79
|
-
/** Always 0 — a SessionStart hook must never break the session loop. */
|
|
80
|
-
exitCode: number;
|
|
81
|
-
/** Whether the `preflight:` ledger fact was written. */
|
|
82
|
-
wrote: boolean;
|
|
83
|
-
/** Resolved repo name (the `${REPO}` a tag is namespaced by). */
|
|
84
|
-
repo: string;
|
|
85
|
-
/** Resolved branch (the `${BRANCH}` a tag is namespaced by; "" if detached). */
|
|
86
|
-
branch: string;
|
|
87
|
-
/**
|
|
88
|
-
* Which tier the session id came from. Surfaced so the CLI can
|
|
89
|
-
* loud-warn when the resolved id is the literal `"default"` (a tag
|
|
90
|
-
* recorded under that id will not satisfy any `preflight-before-*`
|
|
91
|
-
* gate, which queries by the real Claude Code session id).
|
|
92
|
-
*/
|
|
93
|
-
sessionSource: SessionSource;
|
|
94
|
-
/** Resolved session id. */
|
|
95
|
-
sessionId: string;
|
|
96
|
-
/** Human-readable explanation of a non-write outcome, for diagnostics. */
|
|
97
|
-
reason?: string;
|
|
98
|
-
}
|
|
99
|
-
/**
|
|
100
|
-
* Environment for the spawned `preflight` child: the parent env minus
|
|
101
|
-
* HARNESS_ALLOW_REAL_GENERATED_DIR. The launcher sets that flag so the
|
|
102
|
-
* real harness binary may fall back to the operator's home dir, but the
|
|
103
|
-
* preflight child runs the repo's own test suite (its `npm-test` check),
|
|
104
|
-
* and an inherited flag re-enables the implicit real-homedir fallback
|
|
105
|
-
* INSIDE those test processes. With non-empty operator state (e.g. a
|
|
106
|
-
* `harness pause` sentinel) that broke 110 tests and surfaced as a false
|
|
107
|
-
* `failing: npm-test`, keeping the preflight gate shut. Third incident
|
|
108
|
-
* of the operator-state-isolation class PR #199 pinned; the flag must
|
|
109
|
-
* stay scoped to the process the operator actually invoked.
|
|
110
|
-
*/
|
|
111
|
-
export declare function preflightChildEnv(parentEnv?: NodeJS.ProcessEnv): NodeJS.ProcessEnv;
|
|
112
|
-
/**
|
|
113
|
-
* Build the argv passed to the `preflight` child (task 30183330). Pure
|
|
114
|
-
* and exported so a test can pin the rendered command directly, with
|
|
115
|
-
* and without `setup`, instead of only exercising the injected
|
|
116
|
-
* `runPreflight` seam. `--setup` is inserted before the positional
|
|
117
|
-
* `cwd` argument, matching agent-preflight's own `preflight run
|
|
118
|
-
* [options] [repoPath]` usage.
|
|
119
|
-
*/
|
|
120
|
-
export declare function buildPreflightArgv(cwd: string, setup: boolean): string[];
|
|
121
|
-
export declare function runSessionStartPreflight(opts?: SessionStartPreflightOptions): Promise<SessionStartPreflightResult>;
|