harnery 0.30.0 → 0.31.1
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 +185 -74
- 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/grep.d.ts +1 -1
- package/dist/commands/grep.d.ts.map +1 -1
- package/dist/commands/grep.js +19 -2
- 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 +213 -27
- 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.map +1 -1
- package/dist/commands/work.js +38 -22
- 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 +23 -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 +9 -14
- package/dist/core/agents/canonical-emit.d.ts.map +1 -1
- package/dist/core/agents/canonical-emit.js +15 -44
- 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-bin.d.ts +33 -0
- package/dist/core/agents/coord-bin.d.ts.map +1 -0
- package/dist/core/agents/coord-bin.js +89 -0
- package/dist/core/agents/coord-client.d.ts +78 -8
- package/dist/core/agents/coord-client.d.ts.map +1 -1
- package/dist/core/agents/coord-client.js +303 -75
- 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/paths.d.ts +5 -2
- package/dist/core/agents/paths.d.ts.map +1 -1
- package/dist/core/agents/paths.js +7 -13
- 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 +66 -52
- package/dist/core/{supervisor → governor}/plan-types.d.ts +57 -56
- 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 +125 -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 +228 -108
- 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 +187 -162
- 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 +19 -19
- 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 +16 -11
- package/dist/core/hooks/resolve/coord-root.d.ts.map +1 -1
- package/dist/core/hooks/resolve/coord-root.js +18 -43
- 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/state.d.ts +12 -4
- package/dist/core/work/state.d.ts.map +1 -1
- package/dist/core/work/state.js +50 -17
- 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 +138 -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 +1 -1
- package/dist/core/workflow/index.d.ts.map +1 -1
- package/dist/core/workflow/proof.d.ts +11 -5
- package/dist/core/workflow/proof.d.ts.map +1 -1
- package/dist/core/workflow/proof.js +45 -36
- 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 +9 -6
- 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 +9 -6
- 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 +9 -6
- package/dist/core/workflow/spawn-failure.d.ts +1 -1
- package/dist/core/workflow/spawn-failure.js +1 -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 +98 -51
- 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/context/index.js +9 -2
- 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/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 +200 -78
- 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/grep.ts +19 -2
- 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 +256 -38
- package/src/commands/web-fetch.ts +1 -1
- package/src/commands/web.ts +56 -1
- package/src/commands/work.ts +50 -35
- 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 +23 -23
- package/src/core/agents/canonical-emit.ts +16 -43
- 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-bin.ts +92 -0
- package/src/core/agents/coord-client.ts +302 -78
- package/src/core/agents/events/consume.ts +1 -1
- package/src/core/agents/events/emit.ts +7 -6
- package/src/core/agents/paths.ts +7 -11
- 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 +112 -97
- package/src/core/{supervisor → governor}/plan-types.ts +59 -56
- package/src/core/{supervisor → governor}/planning.ts +223 -192
- 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 +325 -167
- 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 +197 -173
- package/src/core/hooks/effects/image-capture.ts +6 -6
- package/src/core/hooks/effects/index.ts +19 -19
- 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 +18 -40
- 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/state.ts +65 -23
- 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 +155 -90
- package/src/core/workflow/evidence-preflight.ts +165 -0
- package/src/core/workflow/index.ts +3 -3
- package/src/core/workflow/proof.ts +60 -50
- 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 +13 -10
- package/src/core/workflow/spawn-codex.ts +13 -10
- package/src/core/workflow/spawn-cursor.ts +13 -10
- package/src/core/workflow/spawn-failure.ts +1 -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 +108 -51
- 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/context/index.ts +11 -1
- package/src/lib/council/index.ts +9 -9
- 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.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/src/core/agents/cli.ts
CHANGED
|
@@ -182,13 +182,13 @@ async function emitClaimRelease(
|
|
|
182
182
|
const { emit } = await import("./events/emit.ts");
|
|
183
183
|
const canonical = path.startsWith(`${root}/`) ? path.slice(root.length + 1) : path;
|
|
184
184
|
const platform = hb.platform;
|
|
185
|
-
const
|
|
185
|
+
const adapter =
|
|
186
186
|
platform === "cursor" ? "cursor" : platform === "codex" ? "codex" : "claude-code";
|
|
187
187
|
emit(root, {
|
|
188
188
|
event_type: "claim.release",
|
|
189
189
|
instance_id: owner,
|
|
190
190
|
session_id: hb.session_id ?? owner,
|
|
191
|
-
|
|
191
|
+
adapter,
|
|
192
192
|
source: "agent-coord",
|
|
193
193
|
data: { path: canonical, reason },
|
|
194
194
|
});
|
|
@@ -291,16 +291,16 @@ async function handleStateAction(root: string, action: string, rest: string[]):
|
|
|
291
291
|
return 0;
|
|
292
292
|
}
|
|
293
293
|
case "heal-heartbeat": {
|
|
294
|
-
//
|
|
294
|
+
// adapter arrives as a `--adapter=<h>` flag (not positional) so the live
|
|
295
295
|
// tool.pre_use heal and the manual `harn agents heal` path (which pass
|
|
296
296
|
// different positional counts) can both supply it without arg-order
|
|
297
297
|
// fragility. Positionals (sessionId, model) stay as-is once flags are
|
|
298
298
|
// filtered out.
|
|
299
|
-
const
|
|
299
|
+
const adapter = args.find((a) => a.startsWith("--adapter="))?.slice("--adapter=".length);
|
|
300
300
|
const positional = args.filter((a) => !a.startsWith("--"));
|
|
301
301
|
const sessionId = positional[0];
|
|
302
302
|
const model = positional[1];
|
|
303
|
-
const hb = writer.healHeartbeat(root, owner, sessionId, model,
|
|
303
|
+
const hb = writer.healHeartbeat(root, owner, sessionId, model, adapter);
|
|
304
304
|
process.stdout.write(`${JSON.stringify({ instance_id: owner, recreated: !!hb })}\n`);
|
|
305
305
|
return hb ? 0 : 1;
|
|
306
306
|
}
|
|
@@ -324,19 +324,19 @@ async function handleStateAction(root: string, action: string, rest: string[]):
|
|
|
324
324
|
}
|
|
325
325
|
}
|
|
326
326
|
|
|
327
|
-
async function
|
|
328
|
-
const
|
|
327
|
+
async function handleJournalAction(root: string, action: string, rest: string[]): Promise<number> {
|
|
328
|
+
const journal = await import("./state/journal.ts");
|
|
329
329
|
|
|
330
|
-
if (action === "append-
|
|
330
|
+
if (action === "append-journal") {
|
|
331
331
|
const [owner, category, ...bodyParts] = rest;
|
|
332
332
|
const body = bodyParts.join(" ");
|
|
333
333
|
if (!owner || !category || !body) {
|
|
334
|
-
process.stderr.write("agent-coord append-
|
|
334
|
+
process.stderr.write("agent-coord append-journal <instance_id> <category> <body>\n");
|
|
335
335
|
return 2;
|
|
336
336
|
}
|
|
337
|
-
const result =
|
|
337
|
+
const result = journal.appendJournal(root, owner, category, body);
|
|
338
338
|
if (!result.ok) {
|
|
339
|
-
process.stderr.write(`agent-coord append-
|
|
339
|
+
process.stderr.write(`agent-coord append-journal: ${result.reason}\n`);
|
|
340
340
|
return 1;
|
|
341
341
|
}
|
|
342
342
|
process.stdout.write(
|
|
@@ -345,24 +345,22 @@ async function handleScratchAction(root: string, action: string, rest: string[])
|
|
|
345
345
|
return 0;
|
|
346
346
|
}
|
|
347
347
|
|
|
348
|
-
if (action === "edit-
|
|
348
|
+
if (action === "edit-journal") {
|
|
349
349
|
const [owner, newBodyFile, ...summaryParts] = rest;
|
|
350
350
|
const summary = summaryParts.join(" ");
|
|
351
351
|
if (!owner || !newBodyFile) {
|
|
352
|
-
process.stderr.write(
|
|
353
|
-
"agent-coord edit-scratchpad <instance_id> <new-body-file> [<summary>]\n",
|
|
354
|
-
);
|
|
352
|
+
process.stderr.write("agent-coord edit-journal <instance_id> <new-body-file> [<summary>]\n");
|
|
355
353
|
return 2;
|
|
356
354
|
}
|
|
357
355
|
if (!existsSync(newBodyFile)) {
|
|
358
|
-
process.stderr.write(`agent-coord edit-
|
|
356
|
+
process.stderr.write(`agent-coord edit-journal: file not found: ${newBodyFile}\n`);
|
|
359
357
|
return 2;
|
|
360
358
|
}
|
|
361
359
|
const { readFileSync } = await import("node:fs");
|
|
362
360
|
const newBody = readFileSync(newBodyFile, "utf8");
|
|
363
|
-
const result =
|
|
361
|
+
const result = journal.editJournal(root, owner, newBody, summary);
|
|
364
362
|
if (!result.ok) {
|
|
365
|
-
process.stderr.write(`agent-coord edit-
|
|
363
|
+
process.stderr.write(`agent-coord edit-journal: ${result.reason}\n`);
|
|
366
364
|
return 1;
|
|
367
365
|
}
|
|
368
366
|
process.stdout.write(
|
|
@@ -371,7 +369,7 @@ async function handleScratchAction(root: string, action: string, rest: string[])
|
|
|
371
369
|
return 0;
|
|
372
370
|
}
|
|
373
371
|
|
|
374
|
-
process.stderr.write(`agent-coord: unknown
|
|
372
|
+
process.stderr.write(`agent-coord: unknown journal action ${action}\n`);
|
|
375
373
|
return 2;
|
|
376
374
|
}
|
|
377
375
|
|
|
@@ -566,7 +564,7 @@ async function handleShellMutationClaimLog(root: string, rest: string[]): Promis
|
|
|
566
564
|
// in a log file; now a canonical decision.warn so the
|
|
567
565
|
// signal survives in events.ndjson. (The blocking claim-conflict path is
|
|
568
566
|
// separate: claim.conflict / verdict, and unaffected.)
|
|
569
|
-
const
|
|
567
|
+
const adapter = platform === "cursor" ? "cursor" : platform === "codex" ? "codex" : "claude-code";
|
|
570
568
|
const hb = owner ? readHeartbeat(root, owner) : null;
|
|
571
569
|
for (const p of paths) {
|
|
572
570
|
try {
|
|
@@ -574,7 +572,7 @@ async function handleShellMutationClaimLog(root: string, rest: string[]): Promis
|
|
|
574
572
|
event_type: "decision.warn",
|
|
575
573
|
instance_id: owner ?? "unknown",
|
|
576
574
|
session_id: hb?.session_id ?? owner ?? "unknown",
|
|
577
|
-
|
|
575
|
+
adapter,
|
|
578
576
|
data: {
|
|
579
577
|
rule: "shell_mutation_candidate",
|
|
580
578
|
reason: `path=${p} cmd=${truncated} platform=${platform}`,
|
|
@@ -612,10 +610,12 @@ async function handlePromptContext(root: string, rest: string[]): Promise<number
|
|
|
612
610
|
const instanceId = args.instance;
|
|
613
611
|
const sessionId = args.session ?? instanceId;
|
|
614
612
|
const agentName = args.name;
|
|
613
|
+
const sessionNameNudge = args["session-name-nudge"] === "true";
|
|
615
614
|
const taskNudge = args["task-nudge"] === "true";
|
|
615
|
+
const statusFooterNudge = args["status-footer-nudge"] === "true";
|
|
616
616
|
if (!instanceId) {
|
|
617
617
|
process.stderr.write(
|
|
618
|
-
"agent-coord prompt-context --instance <id> [--session <id>] [--name <agent-name>] [--task-nudge]\n",
|
|
618
|
+
"agent-coord prompt-context --instance <id> [--session <id>] [--name <agent-name>] [--session-name-nudge] [--task-nudge] [--status-footer-nudge]\n",
|
|
619
619
|
);
|
|
620
620
|
return 2;
|
|
621
621
|
}
|
|
@@ -625,7 +625,9 @@ async function handlePromptContext(root: string, rest: string[]): Promise<number
|
|
|
625
625
|
instanceId,
|
|
626
626
|
sessionId: sessionId!,
|
|
627
627
|
agentName,
|
|
628
|
+
sessionNameNudge,
|
|
628
629
|
taskNudge,
|
|
630
|
+
statusFooterNudge,
|
|
629
631
|
});
|
|
630
632
|
process.stdout.write(text);
|
|
631
633
|
return 0;
|
|
@@ -743,12 +745,12 @@ async function handleEmitEvent(root: string, rest: string[]): Promise<number> {
|
|
|
743
745
|
const eventType = args.type;
|
|
744
746
|
const instanceId = args.owner;
|
|
745
747
|
const sessionId = args.session;
|
|
746
|
-
const
|
|
748
|
+
const adapter = args.adapter as "claude-code" | "cursor" | "codex" | undefined;
|
|
747
749
|
const dataJson = args["data-json"] ?? "{}";
|
|
748
750
|
|
|
749
|
-
if (!eventType || !instanceId || !sessionId || !
|
|
751
|
+
if (!eventType || !instanceId || !sessionId || !adapter) {
|
|
750
752
|
process.stderr.write(
|
|
751
|
-
"agent-coord emit-event --type <T> --owner <id> --session <id> --
|
|
753
|
+
"agent-coord emit-event --type <T> --owner <id> --session <id> --adapter <h> [--data-json '<json>']\n",
|
|
752
754
|
);
|
|
753
755
|
return 2;
|
|
754
756
|
}
|
|
@@ -774,7 +776,7 @@ async function handleEmitEvent(root: string, rest: string[]): Promise<number> {
|
|
|
774
776
|
event_type: eventType,
|
|
775
777
|
instance_id: instanceId,
|
|
776
778
|
session_id: sessionId,
|
|
777
|
-
|
|
779
|
+
adapter,
|
|
778
780
|
turn_id: args["turn-id"],
|
|
779
781
|
parent_session_id: args["parent-session-id"],
|
|
780
782
|
parent_turn_id: args["parent-turn-id"],
|
|
@@ -822,8 +824,8 @@ async function main(): Promise<number> {
|
|
|
822
824
|
return handleStateAction(root, subcommand, rest);
|
|
823
825
|
}
|
|
824
826
|
|
|
825
|
-
if (subcommand === "append-
|
|
826
|
-
return
|
|
827
|
+
if (subcommand === "append-journal" || subcommand === "edit-journal") {
|
|
828
|
+
return handleJournalAction(root, subcommand, rest);
|
|
827
829
|
}
|
|
828
830
|
|
|
829
831
|
if (
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* Production codex sessions emit canonical events from each `harn` invocation
|
|
5
5
|
* via the in-process session-tee middleware (which calls `agent-coord
|
|
6
6
|
* emit-event` for state.task_set / state.status_checked). But the codex
|
|
7
|
-
*
|
|
7
|
+
* adapter itself doesn't wire agent-hook on preToolUse, so user_prompt.submit
|
|
8
8
|
* + tool.pre_use + turn.stop aren't emitted live.
|
|
9
9
|
*
|
|
10
10
|
* This module parses the Codex JSONL transcript at stop time and emits the
|
|
@@ -71,7 +71,7 @@ export function replayCodexJsonl(opts: CodexReplayOpts): { emitted: number } {
|
|
|
71
71
|
event_type: "user_prompt.submit",
|
|
72
72
|
instance_id: instanceId,
|
|
73
73
|
session_id: sessionId,
|
|
74
|
-
|
|
74
|
+
adapter: "codex",
|
|
75
75
|
ts,
|
|
76
76
|
data: {
|
|
77
77
|
prompt_text: clamp(entry.payload.message ?? "", 4000),
|
|
@@ -97,7 +97,7 @@ export function replayCodexJsonl(opts: CodexReplayOpts): { emitted: number } {
|
|
|
97
97
|
event_type: "tool.pre_use",
|
|
98
98
|
instance_id: instanceId,
|
|
99
99
|
session_id: sessionId,
|
|
100
|
-
|
|
100
|
+
adapter: "codex",
|
|
101
101
|
ts,
|
|
102
102
|
data: {
|
|
103
103
|
tool_name: name === "exec_command" ? "Bash" : name,
|
|
@@ -117,7 +117,7 @@ export function replayCodexJsonl(opts: CodexReplayOpts): { emitted: number } {
|
|
|
117
117
|
event_type: "state.status_checked",
|
|
118
118
|
instance_id: instanceId,
|
|
119
119
|
session_id: sessionId,
|
|
120
|
-
|
|
120
|
+
adapter: "codex",
|
|
121
121
|
ts,
|
|
122
122
|
data: { source: "codex-replay" },
|
|
123
123
|
});
|
|
@@ -128,7 +128,7 @@ export function replayCodexJsonl(opts: CodexReplayOpts): { emitted: number } {
|
|
|
128
128
|
event_type: "state.task_set",
|
|
129
129
|
instance_id: instanceId,
|
|
130
130
|
session_id: sessionId,
|
|
131
|
-
|
|
131
|
+
adapter: "codex",
|
|
132
132
|
ts,
|
|
133
133
|
data: { source: "codex-replay" },
|
|
134
134
|
});
|
|
@@ -145,7 +145,7 @@ export function replayCodexJsonl(opts: CodexReplayOpts): { emitted: number } {
|
|
|
145
145
|
event_type: "turn.stop",
|
|
146
146
|
instance_id: instanceId,
|
|
147
147
|
session_id: sessionId,
|
|
148
|
-
|
|
148
|
+
adapter: "codex",
|
|
149
149
|
data: {
|
|
150
150
|
status_box_present: boxPresent,
|
|
151
151
|
tool_call_count: -1,
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Locate harnery's own bundled coordination binaries (`agent-coord`,
|
|
3
|
+
* `agent-hook`, `harn`).
|
|
4
|
+
*
|
|
5
|
+
* Every coord-helper spawn used to build its path as
|
|
6
|
+
* `<coordRoot>/harnery/bin/<name>`, which only exists in one host layout: a
|
|
7
|
+
* superproject carrying harnery as a submodule at `harnery/`. That assumption
|
|
8
|
+
* was load-bearing in the worst way — because the path missed whenever the
|
|
9
|
+
* resolved root was anything else, root resolution itself was bent toward the
|
|
10
|
+
* git superproject to keep the spawns working, which is what split the CLI's
|
|
11
|
+
* root from the hook's and blocked end-of-turn rule 1/3. The same missing path
|
|
12
|
+
* also surfaced as a crash rather than an error: `spawnSync` on a nonexistent
|
|
13
|
+
* binary reports `status: null` and `stderr: null`, so a caller checking
|
|
14
|
+
* `status !== 0` then reading `stderr.trim()` threw "null is not an object".
|
|
15
|
+
*
|
|
16
|
+
* The binaries ship inside the harnery package, so the package is what knows
|
|
17
|
+
* where they are. Resolution walks up from this module to the package root,
|
|
18
|
+
* which covers every install shape: `src/` under Bun, `dist/` on Node, and
|
|
19
|
+
* `node_modules/harnery/`. The layout-specific paths remain as fallbacks so a
|
|
20
|
+
* host whose harnery copy is not the one executing (a vendored tree, a shim)
|
|
21
|
+
* still resolves.
|
|
22
|
+
*/
|
|
23
|
+
|
|
24
|
+
import { existsSync } from "node:fs";
|
|
25
|
+
import { dirname, join, resolve } from "node:path";
|
|
26
|
+
import { fileURLToPath } from "node:url";
|
|
27
|
+
import { coordEnv } from "../../lib/env.ts";
|
|
28
|
+
|
|
29
|
+
export type CoordBinName = "agent-coord" | "agent-hook" | "harn";
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Absolute path to one of harnery's bundled binaries, or null when no candidate
|
|
33
|
+
* exists on disk. Callers must handle null — a missing helper is a real state
|
|
34
|
+
* (a partially installed package) and silently spawning a nonexistent path is
|
|
35
|
+
* what produced the null-deref crash above.
|
|
36
|
+
*/
|
|
37
|
+
export function coordBinPath(name: CoordBinName, coordRoot?: string | null): string | null {
|
|
38
|
+
for (const candidate of coordBinCandidates(name, coordRoot)) {
|
|
39
|
+
if (existsSync(candidate)) return candidate;
|
|
40
|
+
}
|
|
41
|
+
return null;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/** Candidate paths for `name`, in resolution order. Exported for tests. */
|
|
45
|
+
export function coordBinCandidates(name: CoordBinName, coordRoot?: string | null): string[] {
|
|
46
|
+
const candidates: string[] = [];
|
|
47
|
+
const push = (value: string | null | undefined) => {
|
|
48
|
+
if (value && !candidates.includes(value)) candidates.push(value);
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
// Explicit pin, for a host that relocates the binaries.
|
|
52
|
+
const pinned = coordEnv("BIN_DIR");
|
|
53
|
+
if (pinned) push(join(pinned, name));
|
|
54
|
+
|
|
55
|
+
// The package this code is executing from.
|
|
56
|
+
const pkgRoot = packageRoot(name);
|
|
57
|
+
if (pkgRoot) push(join(pkgRoot, "bin", name));
|
|
58
|
+
|
|
59
|
+
if (coordRoot) {
|
|
60
|
+
// Host layouts, in decreasing specificity: harnery as a submodule, as an
|
|
61
|
+
// installed dependency, or the coord root being harnery's own checkout.
|
|
62
|
+
push(resolve(coordRoot, "harnery", "bin", name));
|
|
63
|
+
push(resolve(coordRoot, "node_modules", "harnery", "bin", name));
|
|
64
|
+
push(resolve(coordRoot, "bin", name));
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
return candidates;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* Walk up from this module to the directory holding `bin/<name>`.
|
|
72
|
+
*
|
|
73
|
+
* The walk keys on the binary itself rather than on `package.json`, because
|
|
74
|
+
* both `src/core/agents/` and the built `dist/core/agents/` sit under the same
|
|
75
|
+
* package root and only the binary's presence proves we found the right level.
|
|
76
|
+
*/
|
|
77
|
+
function packageRoot(name: CoordBinName): string | null {
|
|
78
|
+
let dir: string;
|
|
79
|
+
try {
|
|
80
|
+
dir = dirname(fileURLToPath(import.meta.url));
|
|
81
|
+
} catch {
|
|
82
|
+
// No import.meta (a CJS transpile); the coordRoot fallbacks still apply.
|
|
83
|
+
return null;
|
|
84
|
+
}
|
|
85
|
+
for (let hop = 0; hop < 8; hop++) {
|
|
86
|
+
if (existsSync(join(dir, "bin", name))) return dir;
|
|
87
|
+
const parent = dirname(dir);
|
|
88
|
+
if (parent === dir) break;
|
|
89
|
+
dir = parent;
|
|
90
|
+
}
|
|
91
|
+
return null;
|
|
92
|
+
}
|