harnery 0.29.0 → 0.31.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/README.md +4 -4
- package/dist/commander.d.ts +8 -0
- package/dist/commander.d.ts.map +1 -1
- package/dist/commander.js +14 -13
- package/dist/commands/adapter.d.ts +12 -0
- package/dist/commands/adapter.d.ts.map +1 -0
- package/dist/commands/{harness.js → adapter.js} +35 -35
- package/dist/commands/agents.d.ts +3 -2
- package/dist/commands/agents.d.ts.map +1 -1
- package/dist/commands/agents.js +61 -60
- package/dist/commands/artifacts.d.ts +4 -0
- package/dist/commands/artifacts.d.ts.map +1 -0
- package/dist/commands/artifacts.js +143 -0
- package/dist/commands/backup.d.ts +1 -1
- package/dist/commands/backup.d.ts.map +1 -1
- package/dist/commands/backup.js +5 -2
- package/dist/commands/browse.d.ts.map +1 -1
- package/dist/commands/browse.js +310 -7
- package/dist/commands/checkpoint.d.ts +12 -0
- package/dist/commands/checkpoint.d.ts.map +1 -0
- package/dist/commands/checkpoint.js +162 -0
- package/dist/commands/context.d.ts +2 -2
- package/dist/commands/context.d.ts.map +1 -1
- package/dist/commands/context.js +3 -151
- package/dist/commands/decision.d.ts.map +1 -1
- package/dist/commands/decision.js +31 -7
- package/dist/commands/deinit.d.ts +2 -2
- package/dist/commands/deinit.js +15 -15
- package/dist/commands/doctor.js +23 -23
- package/dist/commands/governor.d.ts +4 -0
- package/dist/commands/governor.d.ts.map +1 -0
- package/dist/commands/{supervisor.js → governor.js} +133 -108
- package/dist/commands/init.d.ts +12 -12
- package/dist/commands/init.d.ts.map +1 -1
- package/dist/commands/init.js +44 -30
- package/dist/commands/{session.d.ts → journal.d.ts} +2 -2
- package/dist/commands/journal.d.ts.map +1 -0
- package/dist/commands/{scratch.js → journal.js} +47 -47
- package/dist/commands/policy.js +1 -1
- package/dist/commands/presence.js +2 -2
- package/dist/commands/sync.d.ts +1 -1
- package/dist/commands/sync.js +3 -3
- package/dist/commands/tunnel.d.ts +16 -0
- package/dist/commands/tunnel.d.ts.map +1 -1
- package/dist/commands/tunnel.js +193 -23
- package/dist/commands/web-fetch.js +1 -1
- package/dist/commands/web.d.ts +19 -0
- package/dist/commands/web.d.ts.map +1 -1
- package/dist/commands/web.js +51 -0
- package/dist/commands/work.d.ts +2 -1
- package/dist/commands/work.d.ts.map +1 -1
- package/dist/commands/work.js +55 -25
- package/dist/commands/workflow.d.ts.map +1 -1
- package/dist/commands/workflow.js +35 -28
- package/dist/core/{harnesses → adapters}/attest-projection.d.ts +2 -2
- package/dist/core/adapters/attest-projection.d.ts.map +1 -0
- package/dist/core/{harnesses → adapters}/attest.d.ts +16 -16
- package/dist/core/adapters/attest.d.ts.map +1 -0
- package/dist/core/{harnesses → adapters}/attest.js +9 -9
- package/dist/core/{harnesses → adapters}/attestation.d.ts +16 -16
- package/dist/core/adapters/attestation.d.ts.map +1 -0
- package/dist/core/{harnesses → adapters}/attestation.js +20 -20
- package/dist/core/{harnesses → adapters}/bench.d.ts +12 -12
- package/dist/core/adapters/bench.d.ts.map +1 -0
- package/dist/core/{harnesses → adapters}/bench.js +12 -12
- package/dist/core/adapters/index.d.ts +13 -0
- package/dist/core/adapters/index.d.ts.map +1 -0
- package/dist/core/adapters/index.js +6 -0
- package/dist/core/{harnesses → adapters}/profiles.d.ts +11 -11
- package/dist/core/adapters/profiles.d.ts.map +1 -0
- package/dist/core/{harnesses → adapters}/profiles.js +11 -11
- package/dist/core/adapters/registry.d.ts +15 -0
- package/dist/core/adapters/registry.d.ts.map +1 -0
- package/dist/core/{harnesses → adapters}/registry.js +11 -11
- package/dist/core/{harnesses → adapters}/types.d.ts +28 -23
- package/dist/core/adapters/types.d.ts.map +1 -0
- package/dist/core/{harnesses → adapters}/types.js +1 -1
- package/dist/core/agents/canonical-emit.d.ts +4 -4
- package/dist/core/agents/canonical-emit.js +5 -5
- package/dist/core/agents/cli-emit.js +1 -1
- package/dist/core/agents/cli.js +30 -26
- package/dist/core/agents/codex-replay.d.ts +1 -1
- package/dist/core/agents/codex-replay.js +6 -6
- package/dist/core/agents/coord-client.d.ts +21 -2
- package/dist/core/agents/coord-client.d.ts.map +1 -1
- package/dist/core/agents/coord-client.js +122 -27
- package/dist/core/agents/events/consume.d.ts +1 -1
- package/dist/core/agents/events/emit.d.ts +5 -6
- package/dist/core/agents/events/emit.d.ts.map +1 -1
- package/dist/core/agents/events/emit.js +2 -2
- package/dist/core/agents/render/prompt-context.d.ts +21 -9
- package/dist/core/agents/render/prompt-context.d.ts.map +1 -1
- package/dist/core/agents/render/prompt-context.js +82 -30
- package/dist/core/agents/render/session-context.d.ts +1 -1
- package/dist/core/agents/render/session-context.js +5 -5
- package/dist/core/agents/rules/claim-conflict.d.ts +2 -6
- package/dist/core/agents/rules/claim-conflict.d.ts.map +1 -1
- package/dist/core/agents/rules/claim-conflict.js +1 -1
- package/dist/core/agents/rules/commit-conflict.js +98 -22
- package/dist/core/agents/rules/stop-hook.d.ts +9 -9
- package/dist/core/agents/rules/stop-hook.d.ts.map +1 -1
- package/dist/core/agents/rules/stop-hook.js +23 -5
- package/dist/core/agents/rules/verdict.d.ts +14 -0
- package/dist/core/agents/rules/verdict.d.ts.map +1 -0
- package/dist/core/agents/rules/verdict.js +1 -0
- package/dist/core/agents/session-events.js +3 -3
- package/dist/core/agents/state/council.d.ts +1 -1
- package/dist/core/agents/state/council.js +1 -1
- package/dist/core/agents/state/heartbeat-projector.d.ts +3 -2
- package/dist/core/agents/state/heartbeat-projector.d.ts.map +1 -1
- package/dist/core/agents/state/heartbeat-projector.js +14 -10
- package/dist/core/agents/state/heartbeat-writer.d.ts +1 -1
- package/dist/core/agents/state/heartbeat-writer.js +12 -12
- package/dist/core/agents/state/{scratch.d.ts → journal.d.ts} +7 -7
- package/dist/core/agents/state/{scratch.d.ts.map → journal.d.ts.map} +1 -1
- package/dist/core/agents/state/{scratch.js → journal.js} +12 -12
- package/dist/core/agents/state/pidmap.d.ts +28 -4
- package/dist/core/agents/state/pidmap.d.ts.map +1 -1
- package/dist/core/agents/state/pidmap.js +130 -15
- package/dist/core/agents/state/proc-start.d.ts +95 -0
- package/dist/core/agents/state/proc-start.d.ts.map +1 -0
- package/dist/core/agents/state/proc-start.js +199 -0
- package/dist/core/agents/state/shell-mutation.d.ts +1 -1
- package/dist/core/agents/state/shell-mutation.js +1 -1
- package/dist/core/agents/state/stale-sweep.js +7 -7
- package/dist/core/artifacts/index.d.ts +86 -0
- package/dist/core/artifacts/index.d.ts.map +1 -0
- package/dist/core/artifacts/index.js +421 -0
- package/dist/core/config.d.ts +9 -2
- package/dist/core/config.d.ts.map +1 -1
- package/dist/core/config.js +26 -2
- package/dist/core/context/index.d.ts +12 -12
- package/dist/core/context/index.js +10 -10
- package/dist/core/governor/adapter-spread.d.ts +52 -0
- package/dist/core/governor/adapter-spread.d.ts.map +1 -0
- package/dist/core/governor/adapter-spread.js +52 -0
- package/dist/core/governor/index.d.ts +7 -0
- package/dist/core/governor/index.d.ts.map +1 -0
- package/dist/core/governor/index.js +6 -0
- package/dist/core/governor/plan-api.d.ts +38 -0
- package/dist/core/governor/plan-api.d.ts.map +1 -0
- package/dist/core/governor/plan-api.js +83 -0
- package/dist/core/governor/plan-read.d.ts +5 -0
- package/dist/core/governor/plan-read.d.ts.map +1 -0
- package/dist/core/{supervisor → governor}/plan-read.js +71 -51
- package/dist/core/governor/plan-types.d.ts +181 -0
- package/dist/core/governor/plan-types.d.ts.map +1 -0
- package/dist/core/{supervisor → governor}/plan-types.js +4 -4
- package/dist/core/governor/planning.d.ts +48 -0
- package/dist/core/governor/planning.d.ts.map +1 -0
- package/dist/core/{supervisor → governor}/planning.js +143 -94
- package/dist/core/governor/read.d.ts +6 -0
- package/dist/core/governor/read.d.ts.map +1 -0
- package/dist/core/governor/read.js +4 -0
- package/dist/core/governor/runner.d.ts +37 -0
- package/dist/core/governor/runner.d.ts.map +1 -0
- package/dist/core/{supervisor → governor}/runner.js +15 -15
- package/dist/core/governor/service-read.d.ts +6 -0
- package/dist/core/governor/service-read.d.ts.map +1 -0
- package/dist/core/{supervisor → governor}/service-read.js +12 -12
- package/dist/core/governor/service.d.ts +114 -0
- package/dist/core/governor/service.d.ts.map +1 -0
- package/dist/core/{supervisor → governor}/service.js +57 -57
- package/dist/core/governor/state.d.ts +116 -0
- package/dist/core/governor/state.d.ts.map +1 -0
- package/dist/core/{supervisor → governor}/state.js +290 -116
- package/dist/core/hooks/adapter/detect.d.ts +9 -0
- package/dist/core/hooks/{harness → adapter}/detect.d.ts.map +1 -1
- package/dist/core/hooks/{harness → adapter}/detect.js +8 -8
- package/dist/core/hooks/{harness → adapter}/events.d.ts +15 -14
- package/dist/core/hooks/adapter/events.d.ts.map +1 -0
- package/dist/core/hooks/{harness → adapter}/events.js +5 -5
- package/dist/core/hooks/{harness → adapter}/output.d.ts +20 -14
- package/dist/core/hooks/adapter/output.d.ts.map +1 -0
- package/dist/core/hooks/{harness → adapter}/output.js +30 -22
- package/dist/core/hooks/{harness → adapter}/parse.d.ts +5 -5
- package/dist/core/hooks/{harness → adapter}/parse.d.ts.map +1 -1
- package/dist/core/hooks/{harness → adapter}/parse.js +4 -4
- package/dist/core/hooks/{harness → adapter}/wiring.d.ts +15 -15
- package/dist/core/hooks/{harness → adapter}/wiring.d.ts.map +1 -1
- package/dist/core/hooks/{harness → adapter}/wiring.js +13 -13
- package/dist/core/hooks/cli.d.ts +3 -3
- package/dist/core/hooks/cli.js +175 -151
- package/dist/core/hooks/effects/image-capture.d.ts +5 -5
- package/dist/core/hooks/effects/image-capture.d.ts.map +1 -1
- package/dist/core/hooks/effects/image-capture.js +3 -3
- package/dist/core/hooks/effects/index.d.ts +12 -12
- package/dist/core/hooks/effects/index.d.ts.map +1 -1
- package/dist/core/hooks/effects/index.js +17 -17
- package/dist/core/hooks/events/emit.d.ts +2 -2
- package/dist/core/hooks/events/emit.d.ts.map +1 -1
- package/dist/core/hooks/events/emit.js +1 -1
- package/dist/core/hooks/events/rotate.js +1 -1
- package/dist/core/hooks/events/schema.d.ts +13 -5
- package/dist/core/hooks/events/schema.d.ts.map +1 -1
- package/dist/core/hooks/guard-path.d.ts +2 -2
- package/dist/core/hooks/guard-path.js +2 -2
- package/dist/core/hooks/index.d.ts +1 -1
- package/dist/core/hooks/index.d.ts.map +1 -1
- package/dist/core/hooks/resolve/anchor.d.ts +14 -5
- package/dist/core/hooks/resolve/anchor.d.ts.map +1 -1
- package/dist/core/hooks/resolve/anchor.js +64 -7
- package/dist/core/hooks/resolve/coord-root.d.ts +3 -3
- package/dist/core/hooks/resolve/coord-root.js +4 -4
- package/dist/core/hooks/resolve/intent.js +1 -1
- package/dist/core/hooks/resolve/owner.d.ts +1 -1
- package/dist/core/hooks/resolve/owner.d.ts.map +1 -1
- package/dist/core/hooks/resolve/owner.js +11 -5
- package/dist/core/{scratch → journal}/index.d.ts +25 -25
- package/dist/core/{scratch → journal}/index.d.ts.map +1 -1
- package/dist/core/{scratch → journal}/index.js +38 -38
- package/dist/core/policy/evaluate.d.ts +1 -1
- package/dist/core/policy/evaluate.d.ts.map +1 -1
- package/dist/core/policy/evaluate.js +7 -7
- package/dist/core/policy/types.d.ts +3 -3
- package/dist/core/policy/types.d.ts.map +1 -1
- package/dist/core/work/runner.d.ts.map +1 -1
- package/dist/core/work/runner.js +11 -2
- package/dist/core/work/state.d.ts +28 -3
- package/dist/core/work/state.d.ts.map +1 -1
- package/dist/core/work/state.js +148 -16
- package/dist/core/workflow/adapters.d.ts +17 -0
- package/dist/core/workflow/adapters.d.ts.map +1 -0
- package/dist/core/workflow/adapters.js +21 -0
- package/dist/core/workflow/approvals.js +6 -6
- package/dist/core/workflow/billing.d.ts +9 -9
- package/dist/core/workflow/billing.js +9 -9
- package/dist/core/workflow/child-env.d.ts +10 -2
- package/dist/core/workflow/child-env.d.ts.map +1 -1
- package/dist/core/workflow/child-env.js +12 -4
- package/dist/core/workflow/engine.d.ts +15 -5
- package/dist/core/workflow/engine.d.ts.map +1 -1
- package/dist/core/workflow/engine.js +151 -83
- package/dist/core/workflow/evidence-preflight.d.ts +24 -0
- package/dist/core/workflow/evidence-preflight.d.ts.map +1 -0
- package/dist/core/workflow/evidence-preflight.js +134 -0
- package/dist/core/workflow/index.d.ts +3 -2
- package/dist/core/workflow/index.d.ts.map +1 -1
- package/dist/core/workflow/index.js +2 -1
- package/dist/core/workflow/proof.d.ts +28 -5
- package/dist/core/workflow/proof.d.ts.map +1 -1
- package/dist/core/workflow/proof.js +77 -34
- package/dist/core/workflow/run-state.d.ts +1 -1
- package/dist/core/workflow/run-state.js +7 -7
- package/dist/core/workflow/sandbox-projection.d.ts +6 -6
- package/dist/core/workflow/sandbox-projection.d.ts.map +1 -1
- package/dist/core/workflow/sandbox-projection.js +11 -11
- package/dist/core/workflow/spawn-claude.d.ts +3 -3
- package/dist/core/workflow/spawn-claude.d.ts.map +1 -1
- package/dist/core/workflow/spawn-claude.js +28 -8
- package/dist/core/workflow/spawn-codex.d.ts +4 -4
- package/dist/core/workflow/spawn-codex.d.ts.map +1 -1
- package/dist/core/workflow/spawn-codex.js +26 -8
- package/dist/core/workflow/spawn-cursor.d.ts +4 -4
- package/dist/core/workflow/spawn-cursor.d.ts.map +1 -1
- package/dist/core/workflow/spawn-cursor.js +27 -8
- package/dist/core/workflow/spawn-failure.d.ts +15 -1
- package/dist/core/workflow/spawn-failure.d.ts.map +1 -1
- package/dist/core/workflow/spawn-failure.js +35 -1
- package/dist/core/workflow/specialists.js +2 -2
- package/dist/core/workflow/{journal.d.ts → transcript.d.ts} +8 -8
- package/dist/core/workflow/transcript.d.ts.map +1 -0
- package/dist/core/workflow/{journal.js → transcript.js} +14 -14
- package/dist/core/workflow/types.d.ts +119 -46
- package/dist/core/workflow/types.d.ts.map +1 -1
- package/dist/core/workflow/types.js +11 -1
- package/dist/core/workflow/validate.d.ts +1 -1
- package/dist/core/workflow/validate.js +1 -1
- package/dist/core/workflow/workspaces/cancellation.js +2 -2
- package/dist/core/workflow/workspaces/cleanup.js +2 -2
- package/dist/core/workflow/workspaces/execution.js +6 -6
- package/dist/core/workflow/workspaces/inspect.js +9 -9
- package/dist/core/workflow/workspaces/integration.js +14 -14
- package/dist/core/workflow/workspaces/lifecycle.d.ts +1 -1
- package/dist/core/workflow/workspaces/lifecycle.d.ts.map +1 -1
- package/dist/core/workflow/workspaces/lifecycle.js +9 -9
- package/dist/core/workflow/workspaces/local-git.d.ts.map +1 -1
- package/dist/core/workflow/workspaces/local-git.js +39 -5
- package/dist/core/workflow/workspaces/recovery.js +3 -3
- package/dist/core/workflow/workspaces/state.d.ts +1 -1
- package/dist/core/workflow/workspaces/state.d.ts.map +1 -1
- package/dist/core/workflow/workspaces/state.js +3 -3
- package/dist/core/workflow/workspaces/types.d.ts +1 -1
- package/dist/core/workflow/workspaces/types.d.ts.map +1 -1
- package/dist/lib/browser/asserts.d.ts +28 -0
- package/dist/lib/browser/asserts.d.ts.map +1 -0
- package/dist/lib/browser/asserts.js +152 -0
- package/dist/lib/browser/client.d.ts +49 -0
- package/dist/lib/browser/client.d.ts.map +1 -1
- package/dist/lib/browser/client.js +155 -14
- package/dist/lib/browser/content-checks.d.ts +108 -0
- package/dist/lib/browser/content-checks.d.ts.map +1 -0
- package/dist/lib/browser/content-checks.js +474 -0
- package/dist/lib/browser/critique.d.ts +91 -0
- package/dist/lib/browser/critique.d.ts.map +1 -0
- package/dist/lib/browser/critique.js +167 -0
- package/dist/lib/browser/geometry.d.ts +32 -0
- package/dist/lib/browser/geometry.d.ts.map +1 -1
- package/dist/lib/browser/geometry.js +244 -1
- package/dist/lib/browser/index.d.ts +4 -1
- package/dist/lib/browser/index.d.ts.map +1 -1
- package/dist/lib/browser/index.js +2 -0
- package/dist/lib/claude-desktop.d.ts.map +1 -1
- package/dist/lib/claude-desktop.js +4 -1
- package/dist/lib/council/index.d.ts +6 -6
- package/dist/lib/council/index.d.ts.map +1 -1
- package/dist/lib/council/index.js +8 -8
- package/dist/lib/exec.d.ts +7 -0
- package/dist/lib/exec.d.ts.map +1 -1
- package/dist/lib/exec.js +6 -3
- package/dist/lib/identities/assume.d.ts +2 -2
- package/dist/lib/identities/assume.js +7 -7
- package/dist/lib/instructions/apply.d.ts +3 -3
- package/dist/lib/instructions/apply.d.ts.map +1 -1
- package/dist/lib/instructions/apply.js +75 -27
- package/dist/lib/instructions/host-addendum.d.ts +54 -0
- package/dist/lib/instructions/host-addendum.d.ts.map +1 -0
- package/dist/lib/instructions/host-addendum.js +107 -0
- package/dist/lib/instructions/templates.d.ts +10 -3
- package/dist/lib/instructions/templates.d.ts.map +1 -1
- package/dist/lib/instructions/templates.js +41 -12
- package/dist/lib/machine.d.ts +2 -2
- package/dist/lib/machine.js +2 -2
- package/package.json +26 -21
- package/schemas/config.schema.json +26 -1
- package/src/commander.ts +22 -13
- package/src/commands/{harness.ts → adapter.ts} +46 -46
- package/src/commands/agents.ts +71 -64
- package/src/commands/artifacts.ts +168 -0
- package/src/commands/backup.ts +47 -33
- package/src/commands/browse.ts +438 -2
- package/src/commands/checkpoint.ts +196 -0
- package/src/commands/context.ts +3 -176
- package/src/commands/decision.ts +41 -7
- package/src/commands/deinit.ts +16 -16
- package/src/commands/doctor.ts +28 -28
- package/src/commands/{supervisor.ts → governor.ts} +184 -154
- package/src/commands/init.ts +50 -34
- package/src/commands/{scratch.ts → journal.ts} +60 -60
- package/src/commands/policy.ts +1 -1
- package/src/commands/presence.ts +2 -2
- package/src/commands/sync.ts +3 -3
- package/src/commands/tunnel.ts +237 -34
- package/src/commands/web-fetch.ts +1 -1
- package/src/commands/web.ts +56 -1
- package/src/commands/work.ts +72 -38
- package/src/commands/workflow.ts +43 -34
- package/src/core/{harnesses → adapters}/attest-projection.ts +2 -2
- package/src/core/{harnesses → adapters}/attest.ts +27 -27
- package/src/core/{harnesses → adapters}/attestation.ts +41 -41
- package/src/core/{harnesses → adapters}/bench.ts +34 -43
- package/src/core/adapters/index.ts +56 -0
- package/src/core/{harnesses → adapters}/profiles.ts +16 -16
- package/src/core/{harnesses → adapters}/registry.ts +23 -23
- package/src/core/{harnesses → adapters}/types.ts +28 -23
- package/src/core/agents/canonical-emit.ts +6 -6
- package/src/core/agents/cli-emit.ts +1 -1
- package/src/core/agents/cli.ts +30 -28
- package/src/core/agents/codex-replay.ts +6 -6
- package/src/core/agents/coord-client.ts +119 -28
- package/src/core/agents/events/consume.ts +1 -1
- package/src/core/agents/events/emit.ts +7 -6
- package/src/core/agents/render/prompt-context.ts +107 -31
- package/src/core/agents/render/session-context.ts +6 -6
- package/src/core/agents/rules/claim-conflict.ts +4 -7
- package/src/core/agents/rules/commit-conflict.ts +103 -22
- package/src/core/agents/rules/stop-hook.ts +33 -17
- package/src/core/agents/rules/verdict.ts +13 -0
- package/src/core/agents/session-events.ts +4 -4
- package/src/core/agents/state/council.ts +1 -1
- package/src/core/agents/state/heartbeat-projector.ts +16 -12
- package/src/core/agents/state/heartbeat-writer.ts +12 -12
- package/src/core/agents/state/{scratch.ts → journal.ts} +12 -12
- package/src/core/agents/state/pidmap.ts +130 -15
- package/src/core/agents/state/proc-start.ts +208 -0
- package/src/core/agents/state/shell-mutation.ts +1 -1
- package/src/core/agents/state/stale-sweep.ts +7 -7
- package/src/core/artifacts/index.ts +557 -0
- package/src/core/config.ts +30 -2
- package/src/core/context/index.ts +15 -15
- package/src/core/governor/adapter-spread.ts +82 -0
- package/src/core/governor/index.ts +91 -0
- package/src/core/governor/plan-api.ts +115 -0
- package/src/core/{supervisor → governor}/plan-read.ts +120 -96
- package/src/core/{supervisor → governor}/plan-types.ts +64 -50
- package/src/core/{supervisor → governor}/planning.ts +240 -188
- package/src/core/governor/read.ts +59 -0
- package/src/core/{supervisor → governor}/runner.ts +39 -39
- package/src/core/{supervisor → governor}/service-read.ts +22 -22
- package/src/core/{supervisor → governor}/service.ts +117 -119
- package/src/core/{supervisor → governor}/state.ts +389 -174
- package/src/core/hooks/adapter/detect.ts +30 -0
- package/src/core/hooks/{harness → adapter}/events.ts +16 -14
- package/src/core/hooks/{harness → adapter}/output.ts +31 -23
- package/src/core/hooks/{harness → adapter}/parse.ts +5 -5
- package/src/core/hooks/{harness → adapter}/wiring.ts +21 -21
- package/src/core/hooks/cli.ts +185 -162
- package/src/core/hooks/effects/image-capture.ts +6 -6
- package/src/core/hooks/effects/index.ts +17 -17
- package/src/core/hooks/events/emit.ts +3 -3
- package/src/core/hooks/events/rotate.ts +1 -1
- package/src/core/hooks/events/schema.ts +15 -7
- package/src/core/hooks/guard-path.ts +2 -2
- package/src/core/hooks/index.ts +1 -1
- package/src/core/hooks/resolve/anchor.ts +63 -8
- package/src/core/hooks/resolve/coord-root.ts +4 -4
- package/src/core/hooks/resolve/intent.ts +1 -1
- package/src/core/hooks/resolve/owner.ts +11 -5
- package/src/core/{scratch → journal}/index.ts +53 -53
- package/src/core/policy/evaluate.ts +8 -8
- package/src/core/policy/types.ts +3 -3
- package/src/core/work/runner.ts +11 -2
- package/src/core/work/state.ts +185 -21
- package/src/core/workflow/adapters.ts +33 -0
- package/src/core/workflow/approvals.ts +7 -7
- package/src/core/workflow/billing.ts +12 -12
- package/src/core/workflow/child-env.ts +13 -4
- package/src/core/workflow/engine.ts +166 -90
- package/src/core/workflow/evidence-preflight.ts +165 -0
- package/src/core/workflow/index.ts +6 -3
- package/src/core/workflow/proof.ts +94 -48
- package/src/core/workflow/run-state.ts +7 -7
- package/src/core/workflow/sandbox-projection.ts +16 -16
- package/src/core/workflow/spawn-claude.ts +34 -12
- package/src/core/workflow/spawn-codex.ts +30 -12
- package/src/core/workflow/spawn-cursor.ts +31 -12
- package/src/core/workflow/spawn-failure.ts +41 -1
- package/src/core/workflow/specialists.ts +2 -2
- package/src/core/workflow/{journal.ts → transcript.ts} +16 -16
- package/src/core/workflow/types.ts +130 -46
- package/src/core/workflow/validate.ts +1 -1
- package/src/core/workflow/workspaces/cancellation.ts +2 -2
- package/src/core/workflow/workspaces/cleanup.ts +2 -2
- package/src/core/workflow/workspaces/execution.ts +6 -6
- package/src/core/workflow/workspaces/inspect.ts +14 -11
- package/src/core/workflow/workspaces/integration.ts +18 -14
- package/src/core/workflow/workspaces/lifecycle.ts +10 -10
- package/src/core/workflow/workspaces/local-git.ts +47 -5
- package/src/core/workflow/workspaces/recovery.ts +3 -3
- package/src/core/workflow/workspaces/state.ts +4 -3
- package/src/core/workflow/workspaces/types.ts +1 -1
- package/src/lib/browser/asserts.ts +177 -0
- package/src/lib/browser/client.ts +189 -14
- package/src/lib/browser/content-checks.ts +571 -0
- package/src/lib/browser/critique.ts +231 -0
- package/src/lib/browser/geometry.ts +297 -1
- package/src/lib/browser/index.ts +34 -0
- package/src/lib/claude-desktop.ts +4 -1
- package/src/lib/council/index.ts +9 -9
- package/src/lib/exec.ts +13 -3
- package/src/lib/identities/assume.ts +7 -7
- package/src/lib/instructions/apply.ts +87 -25
- package/src/lib/instructions/host-addendum.ts +126 -0
- package/src/lib/instructions/templates.ts +44 -15
- package/src/lib/machine.ts +2 -2
- package/dist/commands/harness.d.ts +0 -12
- package/dist/commands/harness.d.ts.map +0 -1
- package/dist/commands/scratch.d.ts +0 -4
- package/dist/commands/scratch.d.ts.map +0 -1
- package/dist/commands/session.d.ts.map +0 -1
- package/dist/commands/session.js +0 -162
- package/dist/commands/supervisor.d.ts +0 -4
- package/dist/commands/supervisor.d.ts.map +0 -1
- package/dist/core/harnesses/attest-projection.d.ts.map +0 -1
- package/dist/core/harnesses/attest.d.ts.map +0 -1
- package/dist/core/harnesses/attestation.d.ts.map +0 -1
- package/dist/core/harnesses/bench.d.ts.map +0 -1
- package/dist/core/harnesses/index.d.ts +0 -13
- package/dist/core/harnesses/index.d.ts.map +0 -1
- package/dist/core/harnesses/index.js +0 -6
- package/dist/core/harnesses/profiles.d.ts.map +0 -1
- package/dist/core/harnesses/registry.d.ts +0 -15
- package/dist/core/harnesses/registry.d.ts.map +0 -1
- package/dist/core/harnesses/types.d.ts.map +0 -1
- package/dist/core/hooks/harness/detect.d.ts +0 -9
- package/dist/core/hooks/harness/events.d.ts.map +0 -1
- package/dist/core/hooks/harness/output.d.ts.map +0 -1
- package/dist/core/supervisor/index.d.ts +0 -7
- package/dist/core/supervisor/index.d.ts.map +0 -1
- package/dist/core/supervisor/index.js +0 -6
- package/dist/core/supervisor/plan-api.d.ts +0 -23
- package/dist/core/supervisor/plan-api.d.ts.map +0 -1
- package/dist/core/supervisor/plan-api.js +0 -50
- package/dist/core/supervisor/plan-read.d.ts +0 -5
- package/dist/core/supervisor/plan-read.d.ts.map +0 -1
- package/dist/core/supervisor/plan-types.d.ts +0 -170
- package/dist/core/supervisor/plan-types.d.ts.map +0 -1
- package/dist/core/supervisor/planning.d.ts +0 -33
- package/dist/core/supervisor/planning.d.ts.map +0 -1
- package/dist/core/supervisor/read.d.ts +0 -6
- package/dist/core/supervisor/read.d.ts.map +0 -1
- package/dist/core/supervisor/read.js +0 -4
- package/dist/core/supervisor/runner.d.ts +0 -37
- package/dist/core/supervisor/runner.d.ts.map +0 -1
- package/dist/core/supervisor/service-read.d.ts +0 -6
- package/dist/core/supervisor/service-read.d.ts.map +0 -1
- package/dist/core/supervisor/service.d.ts +0 -114
- package/dist/core/supervisor/service.d.ts.map +0 -1
- package/dist/core/supervisor/state.d.ts +0 -95
- package/dist/core/supervisor/state.d.ts.map +0 -1
- package/dist/core/workflow/harnesses.d.ts +0 -17
- package/dist/core/workflow/harnesses.d.ts.map +0 -1
- package/dist/core/workflow/harnesses.js +0 -21
- package/dist/core/workflow/journal.d.ts.map +0 -1
- package/src/commands/session.ts +0 -187
- package/src/core/harnesses/index.ts +0 -56
- package/src/core/hooks/harness/detect.ts +0 -30
- package/src/core/supervisor/index.ts +0 -89
- package/src/core/supervisor/plan-api.ts +0 -73
- package/src/core/supervisor/read.ts +0 -59
- package/src/core/workflow/harnesses.ts +0 -33
- /package/dist/core/{harnesses → adapters}/attest-projection.js +0 -0
package/dist/commands/context.js
CHANGED
|
@@ -1,15 +1,13 @@
|
|
|
1
|
-
import { monorepoRoot, readHeartbeat, resolveOwner } from "../core/agents/index.js";
|
|
2
|
-
import { checkpointContext, readContextState, readLatestCapsule, } from "../core/context/index.js";
|
|
3
1
|
import { buildContext, DEFAULT_SECTIONS, OPT_IN_SECTIONS, } from "../lib/context/index.js";
|
|
4
2
|
/**
|
|
5
|
-
* `harn context`: one-shot orientation snapshot.
|
|
3
|
+
* `harn agents context`: one-shot orientation snapshot.
|
|
6
4
|
*
|
|
7
5
|
* Aggregates self / time / repo / commits / submodules / peers (default) plus
|
|
8
6
|
* opt-in services. Useful at session start, post-compaction, or before
|
|
9
7
|
* dispatching subagents. Fail-open per section.
|
|
10
8
|
*/
|
|
11
|
-
export function registerContextCommand(
|
|
12
|
-
|
|
9
|
+
export function registerContextCommand(parent, emit, context) {
|
|
10
|
+
parent
|
|
13
11
|
.command("context")
|
|
14
12
|
.description(`One-shot orientation snapshot: self, repo, submodules, peers, recent commits. Default sections: ${DEFAULT_SECTIONS.join(" / ")}. Opt-in: ${OPT_IN_SECTIONS.join(" / ")}.`)
|
|
15
13
|
.option("--section <name>", `Limit to specific sections (comma-list or repeated; valid: ${[...DEFAULT_SECTIONS, ...OPT_IN_SECTIONS].join(", ")})`, collectSections, [])
|
|
@@ -39,152 +37,6 @@ export function registerContextCommand(program, emit, context) {
|
|
|
39
37
|
process.exit(1);
|
|
40
38
|
}
|
|
41
39
|
});
|
|
42
|
-
command
|
|
43
|
-
.command("status")
|
|
44
|
-
.description("Show context-continuity phase, generation, and latest telemetry")
|
|
45
|
-
.option("--session <id>", "Session id (defaults to the current agent heartbeat)")
|
|
46
|
-
.option("--instance <id>", "Agent instance id (defaults to the current owner)")
|
|
47
|
-
.option("--json", "Structured JSON output")
|
|
48
|
-
.action((opts) => {
|
|
49
|
-
try {
|
|
50
|
-
const json = opts.json || Boolean(command.opts().json);
|
|
51
|
-
const identity = resolveContinuityIdentity(context, opts);
|
|
52
|
-
const state = readContextState(identity.coordRoot, identity.sessionId);
|
|
53
|
-
if (json) {
|
|
54
|
-
emit.config({ format: "json" });
|
|
55
|
-
emit.data({ state, identity });
|
|
56
|
-
return;
|
|
57
|
-
}
|
|
58
|
-
if (!state) {
|
|
59
|
-
emit.text(`No context continuity state for session ${identity.sessionId}.\n`);
|
|
60
|
-
return;
|
|
61
|
-
}
|
|
62
|
-
const sample = state.latest_context;
|
|
63
|
-
const usage = sample
|
|
64
|
-
? `${sample.used_tokens ?? "?"}/${sample.window_tokens ?? "?"} tokens${sample.used_percent === undefined ? "" : ` (${sample.used_percent}%)`}`
|
|
65
|
-
: "not reported by harness";
|
|
66
|
-
emit.text(`${[
|
|
67
|
-
`Session: ${state.session_id}`,
|
|
68
|
-
`Phase: ${state.phase}`,
|
|
69
|
-
`Generation: ${state.generation}`,
|
|
70
|
-
`Telemetry: ${usage}`,
|
|
71
|
-
`Capsule: ${state.latest_capsule ?? "none"}`,
|
|
72
|
-
state.degraded_reason ? `Degraded: ${state.degraded_reason}` : "",
|
|
73
|
-
]
|
|
74
|
-
.filter(Boolean)
|
|
75
|
-
.join("\n")}\n`);
|
|
76
|
-
}
|
|
77
|
-
catch (err) {
|
|
78
|
-
emitCommandError(emit, "context_status_failed", err);
|
|
79
|
-
}
|
|
80
|
-
});
|
|
81
|
-
command
|
|
82
|
-
.command("checkpoint")
|
|
83
|
-
.description("Create a durable context-continuity capsule for the current work")
|
|
84
|
-
.option("--session <id>", "Session id (defaults to the current agent heartbeat)")
|
|
85
|
-
.option("--instance <id>", "Agent instance id (defaults to the current owner)")
|
|
86
|
-
.option("--harness <id>", "claude-code, codex, or cursor (inferred from heartbeat)")
|
|
87
|
-
.option("--reason <reason>", "manual, pressure, pre_compact, or session_end", "manual")
|
|
88
|
-
.option("--note <text>", "Short continuation note for the recovered agent")
|
|
89
|
-
.option("--json", "Structured JSON output")
|
|
90
|
-
.action((opts) => {
|
|
91
|
-
try {
|
|
92
|
-
const json = opts.json || Boolean(command.opts().json);
|
|
93
|
-
const reason = parseCheckpointReason(opts.reason);
|
|
94
|
-
const identity = resolveContinuityIdentity(context, opts);
|
|
95
|
-
if (!identity.harness) {
|
|
96
|
-
throw new Error("could not infer the harness; pass --harness claude-code|codex|cursor");
|
|
97
|
-
}
|
|
98
|
-
const result = checkpointContext(identity.coordRoot, {
|
|
99
|
-
sessionId: identity.sessionId,
|
|
100
|
-
instanceId: identity.instanceId,
|
|
101
|
-
harness: identity.harness,
|
|
102
|
-
cwd: context?.repoRoot ?? process.cwd(),
|
|
103
|
-
reason,
|
|
104
|
-
continuationNote: opts.note,
|
|
105
|
-
});
|
|
106
|
-
const output = {
|
|
107
|
-
capsule_id: result.capsule.capsule_id,
|
|
108
|
-
generation: result.capsule.generation,
|
|
109
|
-
path: result.state.latest_capsule,
|
|
110
|
-
phase: result.state.phase,
|
|
111
|
-
reused: result.reused,
|
|
112
|
-
};
|
|
113
|
-
if (json) {
|
|
114
|
-
emit.config({ format: "json" });
|
|
115
|
-
emit.data(output);
|
|
116
|
-
return;
|
|
117
|
-
}
|
|
118
|
-
emit.text(`Checkpointed context generation ${output.generation}: ${output.path ?? result.path}\n`);
|
|
119
|
-
}
|
|
120
|
-
catch (err) {
|
|
121
|
-
emitCommandError(emit, "context_checkpoint_failed", err);
|
|
122
|
-
}
|
|
123
|
-
});
|
|
124
|
-
command
|
|
125
|
-
.command("show")
|
|
126
|
-
.description("Show the latest durable context-continuity capsule")
|
|
127
|
-
.option("--session <id>", "Session id (defaults to the current agent heartbeat)")
|
|
128
|
-
.option("--instance <id>", "Agent instance id (defaults to the current owner)")
|
|
129
|
-
.option("--json", "Structured JSON output")
|
|
130
|
-
.action((opts) => {
|
|
131
|
-
try {
|
|
132
|
-
const json = opts.json || Boolean(command.opts().json);
|
|
133
|
-
const identity = resolveContinuityIdentity(context, opts);
|
|
134
|
-
const capsule = readLatestCapsule(identity.coordRoot, identity.sessionId);
|
|
135
|
-
if (!capsule) {
|
|
136
|
-
throw new Error(`no context capsule exists for session ${identity.sessionId}`);
|
|
137
|
-
}
|
|
138
|
-
if (json)
|
|
139
|
-
emit.config({ format: "json" });
|
|
140
|
-
emit.data(capsule);
|
|
141
|
-
}
|
|
142
|
-
catch (err) {
|
|
143
|
-
emitCommandError(emit, "context_show_failed", err);
|
|
144
|
-
}
|
|
145
|
-
});
|
|
146
|
-
}
|
|
147
|
-
function resolveContinuityIdentity(context, opts) {
|
|
148
|
-
const coordRoot = context?.resolveCoordRoot?.() ?? context?.repoRoot ?? monorepoRoot();
|
|
149
|
-
if (!coordRoot)
|
|
150
|
-
throw new Error("could not resolve a project containing .harnery/");
|
|
151
|
-
const instanceId = opts.instance ?? resolveOwner();
|
|
152
|
-
if (!instanceId) {
|
|
153
|
-
throw new Error("could not resolve the current agent; pass --instance and --session");
|
|
154
|
-
}
|
|
155
|
-
const heartbeat = readHeartbeat(instanceId);
|
|
156
|
-
const sessionId = opts.session ?? heartbeat?.session_id ?? instanceId;
|
|
157
|
-
const harness = opts.harness
|
|
158
|
-
? parseHarness(opts.harness)
|
|
159
|
-
: harnessFromPlatform(heartbeat?.platform);
|
|
160
|
-
return { coordRoot, instanceId, sessionId, harness };
|
|
161
|
-
}
|
|
162
|
-
function harnessFromPlatform(platform) {
|
|
163
|
-
if (platform === "claude_code" || platform === "claude-code")
|
|
164
|
-
return "claude-code";
|
|
165
|
-
if (platform === "cursor")
|
|
166
|
-
return "cursor";
|
|
167
|
-
if (platform === "codex")
|
|
168
|
-
return "codex";
|
|
169
|
-
return null;
|
|
170
|
-
}
|
|
171
|
-
function parseHarness(value) {
|
|
172
|
-
if (value === "claude-code" || value === "codex" || value === "cursor")
|
|
173
|
-
return value;
|
|
174
|
-
throw new Error(`invalid harness "${value}"; expected claude-code, codex, or cursor`);
|
|
175
|
-
}
|
|
176
|
-
function parseCheckpointReason(value) {
|
|
177
|
-
if (value === "manual" ||
|
|
178
|
-
value === "pressure" ||
|
|
179
|
-
value === "pre_compact" ||
|
|
180
|
-
value === "session_end") {
|
|
181
|
-
return value;
|
|
182
|
-
}
|
|
183
|
-
throw new Error(`invalid reason "${value}"; expected manual, pressure, pre_compact, or session_end`);
|
|
184
|
-
}
|
|
185
|
-
function emitCommandError(emit, code, err) {
|
|
186
|
-
emit.error({ code, message: err instanceof Error ? err.message : String(err) });
|
|
187
|
-
emit.setExitCode(1);
|
|
188
40
|
}
|
|
189
41
|
function collectSections(value, prev) {
|
|
190
42
|
const all = [...DEFAULT_SECTIONS, ...OPT_IN_SECTIONS];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"decision.d.ts","sourceRoot":"","sources":["../../src/commands/decision.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AA6CnD,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,WAAW,GAAG,IAAI,
|
|
1
|
+
{"version":3,"file":"decision.d.ts","sourceRoot":"","sources":["../../src/commands/decision.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AA6CnD,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,WAAW,GAAG,IAAI,CAsTtF"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { existsSync, readFileSync } from "node:fs";
|
|
2
|
-
import { emitCanonical, monorepoRoot,
|
|
2
|
+
import { emitCanonical, monorepoRoot, normalizeAdapter, readHeartbeat, resolveOwner, } from "../core/agents/index.js";
|
|
3
3
|
import { resolveBinName } from "../core/config.js";
|
|
4
4
|
import { archiveDecision, claimDecision, DECISION_STAKES, fileDecision, isStakes, isStatus, isTier, isVerdict, listDecisions, reopenDecision, resolveDecision, reviewDecision, searchDecisions, showDecision, supersedeDecision, triageDecision, wontfixDecision, } from "../lib/decision/index.js";
|
|
5
5
|
/**
|
|
@@ -72,23 +72,39 @@ export function registerDecisionCommand(program, emitParam) {
|
|
|
72
72
|
.option("--stakes <small|medium|high>", "Filter by stakes")
|
|
73
73
|
.option("--open", "Only non-terminal decisions (the live queue)")
|
|
74
74
|
.option("--archived", "Include archived (graduated/terminal) decisions")
|
|
75
|
+
.option("--waiting", "Only what a human still has to rule on: tier 2, unresolved. Oldest-first within stakes.")
|
|
75
76
|
.action((opts) => {
|
|
76
77
|
const coordRoot = coordRootOrExit();
|
|
77
78
|
const status = opts.status ? parseStatus(opts.status) : undefined;
|
|
78
79
|
const tier = opts.tier !== undefined ? parseTier(opts.tier) : undefined;
|
|
79
80
|
const stakes = opts.stakes ? parseStakes(opts.stakes) : undefined;
|
|
80
|
-
|
|
81
|
+
if (opts.waiting && tier !== undefined && tier !== 2) {
|
|
82
|
+
return fail("bad_request", "--waiting is tier 2 by definition; drop --tier or pass --tier 2");
|
|
83
|
+
}
|
|
84
|
+
let rows = listDecisions(coordRoot, {
|
|
81
85
|
status,
|
|
82
|
-
tier,
|
|
86
|
+
tier: opts.waiting ? 2 : tier,
|
|
83
87
|
stakes,
|
|
84
|
-
|
|
85
|
-
|
|
88
|
+
// --waiting implies the live queue: an archived or resolved decision is
|
|
89
|
+
// not waiting on anyone.
|
|
90
|
+
openOnly: opts.open || opts.waiting,
|
|
91
|
+
includeArchived: opts.waiting ? false : opts.archived,
|
|
86
92
|
}).map(summarize);
|
|
93
|
+
if (opts.waiting) {
|
|
94
|
+
rows = rows.filter((r) => !r.resolved).sort(byStakesThenAge);
|
|
95
|
+
}
|
|
87
96
|
emit.data({
|
|
88
97
|
rows,
|
|
89
98
|
meta: {
|
|
90
99
|
total: rows.length,
|
|
91
|
-
filter: {
|
|
100
|
+
filter: {
|
|
101
|
+
status,
|
|
102
|
+
tier: opts.waiting ? 2 : tier,
|
|
103
|
+
stakes,
|
|
104
|
+
open: !!(opts.open || opts.waiting),
|
|
105
|
+
archived: opts.waiting ? false : !!opts.archived,
|
|
106
|
+
waiting: !!opts.waiting,
|
|
107
|
+
},
|
|
92
108
|
},
|
|
93
109
|
});
|
|
94
110
|
});
|
|
@@ -319,6 +335,14 @@ function collect(value, previous) {
|
|
|
319
335
|
return previous.concat([value]);
|
|
320
336
|
}
|
|
321
337
|
/** Compact row for list/search output — the full manifest is available via `show`. */
|
|
338
|
+
const WAITING_STAKES_RANK = { high: 3, medium: 2, small: 1 };
|
|
339
|
+
/** Highest stakes first, longest-open breaking ties. Stakes leads because it is
|
|
340
|
+
* the filer's own triage signal; age breaks ties so a question nobody has
|
|
341
|
+
* answered in three weeks does not sit behind an equally-weighted fresh one. */
|
|
342
|
+
function byStakesThenAge(a, b) {
|
|
343
|
+
const rank = (WAITING_STAKES_RANK[String(b.stakes)] ?? 1) - (WAITING_STAKES_RANK[String(a.stakes)] ?? 1);
|
|
344
|
+
return rank !== 0 ? rank : String(a.filed_at ?? "").localeCompare(String(b.filed_at ?? ""));
|
|
345
|
+
}
|
|
322
346
|
function summarize(m) {
|
|
323
347
|
return {
|
|
324
348
|
decision_id: m.decision_id,
|
|
@@ -348,7 +372,7 @@ function emitDecisionEvent(type, data) {
|
|
|
348
372
|
type,
|
|
349
373
|
owner,
|
|
350
374
|
session: hb?.session_id ?? owner,
|
|
351
|
-
|
|
375
|
+
adapter: normalizeAdapter(hb?.platform),
|
|
352
376
|
data,
|
|
353
377
|
});
|
|
354
378
|
}
|
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
* `harn deinit`: reverse what `harn init` wired into a project.
|
|
3
3
|
*
|
|
4
4
|
* `init` makes two kinds of change outside the harnery package:
|
|
5
|
-
* 1. Merges `agent-hook` entries into the
|
|
5
|
+
* 1. Merges `agent-hook` entries into the adapter settings file
|
|
6
6
|
* (Claude Code `.claude/settings.json`, Cursor `.cursor/hooks.json`, or
|
|
7
7
|
* Codex `.codex/hooks.json`).
|
|
8
8
|
* 2. Creates the `.harnery/` coord root (runtime state: events, councils,
|
|
9
|
-
* identities,
|
|
9
|
+
* identities, journal) and stamps the host bin name into
|
|
10
10
|
* `.harnery/config.jsonc`.
|
|
11
11
|
*
|
|
12
12
|
* `deinit` undoes (1) by default: it removes only harnery's hook entries from
|
package/dist/commands/deinit.js
CHANGED
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
* `harn deinit`: reverse what `harn init` wired into a project.
|
|
3
3
|
*
|
|
4
4
|
* `init` makes two kinds of change outside the harnery package:
|
|
5
|
-
* 1. Merges `agent-hook` entries into the
|
|
5
|
+
* 1. Merges `agent-hook` entries into the adapter settings file
|
|
6
6
|
* (Claude Code `.claude/settings.json`, Cursor `.cursor/hooks.json`, or
|
|
7
7
|
* Codex `.codex/hooks.json`).
|
|
8
8
|
* 2. Creates the `.harnery/` coord root (runtime state: events, councils,
|
|
9
|
-
* identities,
|
|
9
|
+
* identities, journal) and stamps the host bin name into
|
|
10
10
|
* `.harnery/config.jsonc`.
|
|
11
11
|
*
|
|
12
12
|
* `deinit` undoes (1) by default: it removes only harnery's hook entries from
|
|
@@ -30,7 +30,7 @@ import { existsSync, readFileSync, rmSync, writeFileSync } from "node:fs";
|
|
|
30
30
|
import { relative, resolve } from "node:path";
|
|
31
31
|
import { createInterface } from "node:readline";
|
|
32
32
|
import { DEFAULT_BIN_NAME } from "../core/config.js";
|
|
33
|
-
import {
|
|
33
|
+
import { ADAPTER_SPECS } from "../core/hooks/adapter/events.js";
|
|
34
34
|
import { removeInstructions } from "../lib/instructions/apply.js";
|
|
35
35
|
import { unwireHooks } from "./init.js";
|
|
36
36
|
export function registerDeinitCommand(program, emit, binName) {
|
|
@@ -41,19 +41,19 @@ export function registerDeinitCommand(program, emit, binName) {
|
|
|
41
41
|
const standalone = !binName || binName === DEFAULT_BIN_NAME;
|
|
42
42
|
program
|
|
43
43
|
.command("deinit")
|
|
44
|
-
.description("Reverse `harn init`: remove harnery's hook entries from the
|
|
44
|
+
.description("Reverse `harn init`: remove harnery's hook entries from the adapter " +
|
|
45
45
|
"settings file (keeps any others). Pass --purge-state to also delete the " +
|
|
46
46
|
".harnery/ coord root (on a terminal it asks first). Idempotent; use " +
|
|
47
47
|
"--dry-run to preview.")
|
|
48
|
-
.option("--
|
|
48
|
+
.option("--adapter <id>", "claude-code | cursor | codex", "claude-code")
|
|
49
49
|
.option("--dry-run", "Show what would change without writing")
|
|
50
50
|
.option("--project-root <path>", "Project root (default: git toplevel, else cwd)")
|
|
51
51
|
.option("--purge-state", "Also delete the .harnery/ coord root (runtime state, destructive)")
|
|
52
52
|
.action(async (opts) => {
|
|
53
|
-
const
|
|
54
|
-
const spec =
|
|
53
|
+
const adapter = opts.adapter;
|
|
54
|
+
const spec = ADAPTER_SPECS[adapter];
|
|
55
55
|
if (!spec) {
|
|
56
|
-
emit.text(`Unknown
|
|
56
|
+
emit.text(`Unknown adapter '${opts.adapter}'. Expected: claude-code | cursor | codex.`);
|
|
57
57
|
emit.setExitCode(1);
|
|
58
58
|
return;
|
|
59
59
|
}
|
|
@@ -73,7 +73,7 @@ export function registerDeinitCommand(program, emit, binName) {
|
|
|
73
73
|
})) {
|
|
74
74
|
purgeState = await confirmDeleteState(coordDir);
|
|
75
75
|
}
|
|
76
|
-
// ── 1. unwire
|
|
76
|
+
// ── 1. unwire adapter hooks ────────────────────────────────────────────
|
|
77
77
|
const settingsPath = resolve(projectRoot, spec.settingsFile);
|
|
78
78
|
if (!existsSync(settingsPath)) {
|
|
79
79
|
actions.push(`· ${rel(projectRoot, settingsPath)} doesn't exist; no hooks to remove`);
|
|
@@ -93,7 +93,7 @@ export function registerDeinitCommand(program, emit, binName) {
|
|
|
93
93
|
if (removed === 0) {
|
|
94
94
|
actions.push(`· no harnery hooks found in ${rel(projectRoot, settingsPath)}`);
|
|
95
95
|
}
|
|
96
|
-
else if (
|
|
96
|
+
else if (adapterOnly(settings)) {
|
|
97
97
|
// Nothing left but what init itself put there (no hooks, at most a
|
|
98
98
|
// version key), so remove the file rather than leave an empty shell.
|
|
99
99
|
if (dryRun) {
|
|
@@ -115,7 +115,7 @@ export function registerDeinitCommand(program, emit, binName) {
|
|
|
115
115
|
}
|
|
116
116
|
}
|
|
117
117
|
// ── 1b. agent-facing instructions block + skills ───────────────────────
|
|
118
|
-
const removed = removeInstructions(projectRoot, {
|
|
118
|
+
const removed = removeInstructions(projectRoot, { adapter, dryRun });
|
|
119
119
|
actions.push(...removed.actions, ...removed.warnings.map((w) => `! ${w}`));
|
|
120
120
|
// ── 2. coord root (opt-in; destructive) ────────────────────────────────
|
|
121
121
|
if (purgeState) {
|
|
@@ -123,7 +123,7 @@ export function registerDeinitCommand(program, emit, binName) {
|
|
|
123
123
|
actions.push("· .harnery/ doesn't exist; nothing to purge");
|
|
124
124
|
}
|
|
125
125
|
else if (dryRun) {
|
|
126
|
-
actions.push("+ would delete .harnery/ and all coord state (events, councils,
|
|
126
|
+
actions.push("+ would delete .harnery/ and all coord state (events, councils, journal)");
|
|
127
127
|
}
|
|
128
128
|
else {
|
|
129
129
|
rmSync(coordDir, { recursive: true, force: true });
|
|
@@ -160,7 +160,7 @@ export function engineRemovalHint() {
|
|
|
160
160
|
/** Mirror scripts/teardown.sh's wording: explain what .harnery/ holds, then ask. */
|
|
161
161
|
function confirmDeleteState(coordDir) {
|
|
162
162
|
process.stdout.write("\nharnery saved this project's coordination history in .harnery/\n" +
|
|
163
|
-
"(its event log, councils, agent identities, and
|
|
163
|
+
"(its event log, councils, agent identities, and journals):\n" +
|
|
164
164
|
` ${coordDir}\n` +
|
|
165
165
|
"Unwiring leaves that in place. Deleting it can't be undone.\n");
|
|
166
166
|
return confirm("Delete this project's harnery history too? [y/N]");
|
|
@@ -176,7 +176,7 @@ function confirm(question) {
|
|
|
176
176
|
});
|
|
177
177
|
}
|
|
178
178
|
/** True when an unwired settings object holds nothing but (optionally) `version`. */
|
|
179
|
-
function
|
|
179
|
+
function adapterOnly(settings) {
|
|
180
180
|
const keys = Object.keys(settings);
|
|
181
181
|
return keys.length === 0 || (keys.length === 1 && keys[0] === "version");
|
|
182
182
|
}
|
|
@@ -184,7 +184,7 @@ function render(projectRoot, dryRun, actions, hint) {
|
|
|
184
184
|
const head = dryRun ? "harn deinit (dry run): no changes written" : "harn deinit";
|
|
185
185
|
const tail = dryRun
|
|
186
186
|
? "\nRe-run without --dry-run to apply."
|
|
187
|
-
: "\nDone. harnery hooks are unwired; restart your
|
|
187
|
+
: "\nDone. harnery hooks are unwired; restart your adapter session to drop them.";
|
|
188
188
|
const hintBlock = hint ? `\n\n${hint}` : "";
|
|
189
189
|
return `${head}\n root: ${projectRoot}\n${actions.map((a) => ` ${a}`).join("\n")}${tail}${hintBlock}`;
|
|
190
190
|
}
|
package/dist/commands/doctor.js
CHANGED
|
@@ -14,11 +14,11 @@ import { spawnSync } from "node:child_process";
|
|
|
14
14
|
import { existsSync } from "node:fs";
|
|
15
15
|
import os from "node:os";
|
|
16
16
|
import path from "node:path";
|
|
17
|
+
import { BUILTIN_ADAPTER_IDS } from "../core/adapters/index.js";
|
|
17
18
|
import { resolveBinName, ripgrepAutoInstall } from "../core/config.js";
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
19
|
+
import { loadAdapterWiring } from "../core/hooks/adapter/wiring.js";
|
|
20
|
+
import { ADAPTER_BINARIES, ADAPTER_INSTALL_HINTS, ADAPTER_LOGIN_HINTS, } from "../core/workflow/adapters.js";
|
|
20
21
|
import { probeBilling } from "../core/workflow/billing.js";
|
|
21
|
-
import { HARNESS_BINARIES, HARNESS_INSTALL_HINTS, HARNESS_LOGIN_HINTS, } from "../core/workflow/harnesses.js";
|
|
22
22
|
import { findRg, installRg, managedRgPath, rgInstallSupported } from "../lib/tools/ripgrep.js";
|
|
23
23
|
export function registerDoctorCommand(program, emit) {
|
|
24
24
|
program
|
|
@@ -71,8 +71,8 @@ export function runChecks() {
|
|
|
71
71
|
checkBun(),
|
|
72
72
|
checkRipgrep(),
|
|
73
73
|
checkHarneryDir(),
|
|
74
|
-
|
|
75
|
-
...
|
|
74
|
+
checkAdapterHooks(),
|
|
75
|
+
...BUILTIN_ADAPTER_IDS.map(checkWorkflowAdapter),
|
|
76
76
|
checkRestic(),
|
|
77
77
|
checkRclone(),
|
|
78
78
|
checkPlaywright(),
|
|
@@ -120,29 +120,29 @@ function whichVersion(bin, args = ["--version"]) {
|
|
|
120
120
|
return { ok: true, out };
|
|
121
121
|
}
|
|
122
122
|
/**
|
|
123
|
-
* One workflow spawn target: is the
|
|
123
|
+
* One workflow spawn target: is the adapter CLI installed, and how will its
|
|
124
124
|
* headless children bill (subscription login vs API key — see billing.ts)?
|
|
125
|
-
* Missing is a warn, not a fail: workflows degrade to the
|
|
125
|
+
* Missing is a warn, not a fail: workflows degrade to the adapters you have.
|
|
126
126
|
*/
|
|
127
|
-
function
|
|
128
|
-
const bin =
|
|
129
|
-
const name = `workflow:${
|
|
127
|
+
function checkWorkflowAdapter(adapter) {
|
|
128
|
+
const bin = ADAPTER_BINARIES[adapter];
|
|
129
|
+
const name = `workflow:${adapter}`;
|
|
130
130
|
const r = whichVersion(bin);
|
|
131
131
|
if (!r.ok) {
|
|
132
132
|
return {
|
|
133
133
|
name,
|
|
134
134
|
severity: "warn",
|
|
135
|
-
detail: `${bin} missing (workflow --
|
|
136
|
-
hint: `${
|
|
135
|
+
detail: `${bin} missing (workflow --adapter ${adapter} unavailable)`,
|
|
136
|
+
hint: `${ADAPTER_INSTALL_HINTS[adapter]} then: ${ADAPTER_LOGIN_HINTS[adapter]}`,
|
|
137
137
|
};
|
|
138
138
|
}
|
|
139
|
-
const probe = probeBilling(
|
|
139
|
+
const probe = probeBilling(adapter);
|
|
140
140
|
if (probe.login === "absent" && !probe.apiKeyPresent) {
|
|
141
141
|
return {
|
|
142
142
|
name,
|
|
143
143
|
severity: "warn",
|
|
144
144
|
detail: `${r.out} — installed, but no stored login or API key detected`,
|
|
145
|
-
hint:
|
|
145
|
+
hint: ADAPTER_LOGIN_HINTS[adapter],
|
|
146
146
|
};
|
|
147
147
|
}
|
|
148
148
|
const billing = probe.mode === "subscription"
|
|
@@ -282,21 +282,21 @@ function checkHarneryDir() {
|
|
|
282
282
|
};
|
|
283
283
|
}
|
|
284
284
|
/**
|
|
285
|
-
* Compare the project's wired
|
|
285
|
+
* Compare the project's wired adapter hooks against ADAPTER_SPECS. Catches the
|
|
286
286
|
* post-upgrade case where a harnery release added (or renamed) a hook event but
|
|
287
|
-
* the consumer's settings file hasn't been re-wired. Only fires for a
|
|
287
|
+
* the consumer's settings file hasn't been re-wired. Only fires for a adapter
|
|
288
288
|
* the project has opted into (≥1 harnery hook already wired) — see
|
|
289
|
-
*
|
|
289
|
+
* loadAdapterWiring — so a bare settings file never false-warns. The remedy is
|
|
290
290
|
* always the same: re-run `<bin> init` (idempotent, additive).
|
|
291
291
|
*/
|
|
292
|
-
function
|
|
292
|
+
function checkAdapterHooks() {
|
|
293
293
|
const root = findCoordProjectRoot();
|
|
294
294
|
if (!root) {
|
|
295
|
-
return { name: "
|
|
295
|
+
return { name: "adapter hooks", severity: "ok", detail: "n/a (no .harnery/ above cwd)" };
|
|
296
296
|
}
|
|
297
|
-
const drift =
|
|
297
|
+
const drift = loadAdapterWiring(root);
|
|
298
298
|
if (drift.length === 0) {
|
|
299
|
-
return { name: "
|
|
299
|
+
return { name: "adapter hooks", severity: "ok", detail: "wired + current" };
|
|
300
300
|
}
|
|
301
301
|
const bin = resolveBinName(root);
|
|
302
302
|
const parts = drift.map((d) => {
|
|
@@ -318,9 +318,9 @@ function checkHarnessHooks() {
|
|
|
318
318
|
});
|
|
319
319
|
const needsManualRepair = drift.some((d) => d.parseError || d.invalidTopLevelKeys.length > 0 || d.invalidEventKeys.length > 0);
|
|
320
320
|
const hint = needsManualRepair
|
|
321
|
-
? `repair the invalid
|
|
321
|
+
? `repair the invalid adapter settings, then run \`${bin} init\` to migrate harnery hooks`
|
|
322
322
|
: `run \`${bin} init\` to migrate the hook set (idempotent)`;
|
|
323
|
-
return { name: "
|
|
323
|
+
return { name: "adapter hooks", severity: "warn", detail: parts.join(" | "), hint };
|
|
324
324
|
}
|
|
325
325
|
function macOrLinux(mac, linux) {
|
|
326
326
|
return os.platform() === "darwin" ? mac : linux;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"governor.d.ts","sourceRoot":"","sources":["../../src/commands/governor.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AA6EnD,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,WAAW,GAAG,IAAI,CAmHjF"}
|