harnery 0.30.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.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 +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 +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 +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/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/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 +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 +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 +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 +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 +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/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/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/commands/agents.ts
CHANGED
|
@@ -27,13 +27,13 @@ import {
|
|
|
27
27
|
import { homedir, tmpdir } from "node:os";
|
|
28
28
|
import { basename, join, resolve } from "node:path";
|
|
29
29
|
import type { Command } from "commander";
|
|
30
|
-
import type { EmitContext } from "../commander.ts";
|
|
30
|
+
import type { EmitContext, HarneryProgramContext } from "../commander.ts";
|
|
31
31
|
import { readStreamTailBounded } from "../core/agents/events/consume.ts";
|
|
32
32
|
import {
|
|
33
33
|
emitCanonical,
|
|
34
34
|
type Heartbeat,
|
|
35
35
|
monorepoRoot,
|
|
36
|
-
|
|
36
|
+
normalizeAdapter,
|
|
37
37
|
readHeartbeat,
|
|
38
38
|
resolveOwner,
|
|
39
39
|
resolveOwnerBySessionEnv,
|
|
@@ -41,6 +41,7 @@ import {
|
|
|
41
41
|
} from "../core/agents/index.ts";
|
|
42
42
|
import { coordFreshnessSeconds, resolveBinName } from "../core/config.ts";
|
|
43
43
|
import { type RemoteMachine, readRemoteMachines } from "../core/presence/index.ts";
|
|
44
|
+
import { registerContextCommand } from "./context.ts";
|
|
44
45
|
|
|
45
46
|
/** Cap for CLI scans of the unbounded event ledger (`trace` / `health`). Well
|
|
46
47
|
* under V8's ~512MB max string length so a `readFileSync` of the whole file can
|
|
@@ -48,7 +49,7 @@ import { type RemoteMachine, readRemoteMachines } from "../core/presence/index.t
|
|
|
48
49
|
const STREAM_SCAN_CAP_BYTES = 128 * 1024 * 1024; // 128 MiB
|
|
49
50
|
|
|
50
51
|
import { parsePsChainLine } from "../core/hooks/resolve/anchor.ts";
|
|
51
|
-
import { appendEntry, resolveOwnerByName } from "../core/
|
|
52
|
+
import { appendEntry, resolveOwnerByName } from "../core/journal/index.ts";
|
|
52
53
|
import {
|
|
53
54
|
buildCouncilId,
|
|
54
55
|
buildInviteMarkdown,
|
|
@@ -145,11 +146,19 @@ interface Row {
|
|
|
145
146
|
|
|
146
147
|
let emit: EmitContext;
|
|
147
148
|
|
|
148
|
-
export function registerAgentsCommand(
|
|
149
|
+
export function registerAgentsCommand(
|
|
150
|
+
program: Command,
|
|
151
|
+
emitParam: EmitContext,
|
|
152
|
+
programContext?: HarneryProgramContext,
|
|
153
|
+
): void {
|
|
149
154
|
emit = emitParam;
|
|
150
155
|
const cmd = program
|
|
151
156
|
.command("agents")
|
|
152
|
-
.description(
|
|
157
|
+
.description(
|
|
158
|
+
"The live agent sessions in this project: who is running now, what they hold, and their coordination state (whoami / list / status / health).",
|
|
159
|
+
);
|
|
160
|
+
|
|
161
|
+
registerContextCommand(cmd, emitParam, programContext);
|
|
153
162
|
|
|
154
163
|
cmd
|
|
155
164
|
.command("whoami")
|
|
@@ -187,7 +196,7 @@ export function registerAgentsCommand(program: Command, emitParam: EmitContext):
|
|
|
187
196
|
.command("suggest-name [description...]")
|
|
188
197
|
.description(
|
|
189
198
|
'Reprint a session name ("Agent <you> - <description>") for the operator to set as their ' +
|
|
190
|
-
"
|
|
199
|
+
"adapter tab title. With no arg, derives it from your current task. The primary naming path " +
|
|
191
200
|
"is set-task (it suggests a name on the first focus declaration); reach for this to reprint " +
|
|
192
201
|
"or re-suggest after a topic pivot. Read-only.",
|
|
193
202
|
)
|
|
@@ -273,7 +282,7 @@ export function registerAgentsCommand(program: Command, emitParam: EmitContext):
|
|
|
273
282
|
cmd
|
|
274
283
|
.command("ping <name> <message...>")
|
|
275
284
|
.description(
|
|
276
|
-
"Append a 'handoff' entry to a peer agent's
|
|
285
|
+
"Append a 'handoff' entry to a peer agent's journal. Body prefixed with " +
|
|
277
286
|
"`from agent-<me>:`. Use to leave actionable coordination notes for peers " +
|
|
278
287
|
"currently holding files you need.",
|
|
279
288
|
)
|
|
@@ -344,9 +353,9 @@ export function registerAgentsCommand(program: Command, emitParam: EmitContext):
|
|
|
344
353
|
});
|
|
345
354
|
|
|
346
355
|
cmd
|
|
347
|
-
.command("
|
|
356
|
+
.command("adapter-probe <id>")
|
|
348
357
|
.description(
|
|
349
|
-
"
|
|
358
|
+
"Adapter wiring probe: ppid chain, comm names, pid-map anchor, sample payload paths. " +
|
|
350
359
|
"With --replay-samples, also replays every checked-in sample payload against the live " +
|
|
351
360
|
"adapter in an isolated sandbox to catch adapter / payload-shape drift. " +
|
|
352
361
|
"Complements heal-events (drift telemetry). Id: claude_code | cursor.",
|
|
@@ -354,7 +363,7 @@ export function registerAgentsCommand(program: Command, emitParam: EmitContext):
|
|
|
354
363
|
.option("--json", "JSON envelope output")
|
|
355
364
|
.option(
|
|
356
365
|
"--replay-samples",
|
|
357
|
-
"Replay docs/api/<
|
|
366
|
+
"Replay docs/api/<adapter>-hooks/samples/*.json against the live adapter in an isolated sandbox. " +
|
|
358
367
|
"Exits non-zero if any sample crashes the adapter.",
|
|
359
368
|
)
|
|
360
369
|
.option(
|
|
@@ -362,7 +371,7 @@ export function registerAgentsCommand(program: Command, emitParam: EmitContext):
|
|
|
362
371
|
"Replay only the named sample file (basename match). Implies --replay-samples.",
|
|
363
372
|
)
|
|
364
373
|
.action((id: string, opts: { json?: boolean; replaySamples?: boolean; sample?: string }) => {
|
|
365
|
-
|
|
374
|
+
runAdapterProbe(id, opts);
|
|
366
375
|
});
|
|
367
376
|
|
|
368
377
|
cmd
|
|
@@ -395,8 +404,6 @@ export function registerAgentsCommand(program: Command, emitParam: EmitContext):
|
|
|
395
404
|
runHeal(opts);
|
|
396
405
|
},
|
|
397
406
|
);
|
|
398
|
-
|
|
399
|
-
registerCouncilCommands(cmd);
|
|
400
407
|
registerIdentityCommands(cmd);
|
|
401
408
|
}
|
|
402
409
|
|
|
@@ -551,7 +558,7 @@ function runIdentityAssume(target: string, opts: { json?: boolean; sessionId?: s
|
|
|
551
558
|
}
|
|
552
559
|
}
|
|
553
560
|
|
|
554
|
-
function registerCouncilCommands(parent: Command): void {
|
|
561
|
+
export function registerCouncilCommands(parent: Command): void {
|
|
555
562
|
const council = parent
|
|
556
563
|
.command("council")
|
|
557
564
|
.description(
|
|
@@ -685,7 +692,7 @@ function registerCouncilCommands(parent: Command): void {
|
|
|
685
692
|
"(or omit [steward]) to drop the field and revert to the default " +
|
|
686
693
|
"(the convener). Refuses to mutate archived councils. By default, " +
|
|
687
694
|
"rejects names not in the known-agents list (active heartbeats + " +
|
|
688
|
-
"
|
|
695
|
+
"journals archived in the last 30 days); pass --allow-unknown " +
|
|
689
696
|
"to bypass when bootstrapping.",
|
|
690
697
|
)
|
|
691
698
|
.option("--clear", "Clear the steward field, reverting to created_by default")
|
|
@@ -711,7 +718,7 @@ function registerCouncilCommands(parent: Command): void {
|
|
|
711
718
|
"Pass either --message <inline> or --file <path>. Writes to " +
|
|
712
719
|
".harnery/councils/<id>/round-<N>/<agent-Name>.md. Pass --as <member> " +
|
|
713
720
|
"to contribute under a council seat name that differs from the running " +
|
|
714
|
-
"agent's heartbeat name (useful for cross-
|
|
721
|
+
"agent's heartbeat name (useful for cross-adapter councils where each " +
|
|
715
722
|
"reviewer has a different auto-generated session name).",
|
|
716
723
|
)
|
|
717
724
|
.option("--message <text>", "Inline contribution text (caps at 4KB)")
|
|
@@ -1339,7 +1346,7 @@ function ensureCursorSession(root: string): void {
|
|
|
1339
1346
|
is_background_agent: false,
|
|
1340
1347
|
});
|
|
1341
1348
|
|
|
1342
|
-
spawnSync("bash", [agentHook, "session-start", "--
|
|
1349
|
+
spawnSync("bash", [agentHook, "session-start", "--adapter", "cursor"], {
|
|
1343
1350
|
input: payload,
|
|
1344
1351
|
cwd: root,
|
|
1345
1352
|
encoding: "utf8",
|
|
@@ -1443,12 +1450,12 @@ function runSetTask(task: string, opts?: { sessionId?: string }): void {
|
|
|
1443
1450
|
type: "state.task_set",
|
|
1444
1451
|
owner: myOwner,
|
|
1445
1452
|
session: hb?.session_id ?? myOwner,
|
|
1446
|
-
|
|
1453
|
+
adapter: normalizeAdapter(hb?.platform),
|
|
1447
1454
|
data: { task, cleared: !task || task.length === 0 },
|
|
1448
1455
|
});
|
|
1449
1456
|
|
|
1450
1457
|
// On the first focus declaration of a session, surface a suggested session
|
|
1451
|
-
// name for the operator to set as their
|
|
1458
|
+
// name for the operator to set as their adapter tab title. Read the result
|
|
1452
1459
|
// (`suggested_session_name`) and reproduce it in a fenced code block so the
|
|
1453
1460
|
// UI's Copy button hands over the exact string. null on every later call.
|
|
1454
1461
|
const built =
|
|
@@ -1593,7 +1600,7 @@ function runStatus(opts: { json?: boolean; sessionId?: string }): void {
|
|
|
1593
1600
|
type: "state.status_checked",
|
|
1594
1601
|
owner: myOwner,
|
|
1595
1602
|
session: hb.session_id ?? myOwner,
|
|
1596
|
-
|
|
1603
|
+
adapter: normalizeAdapter(hb.platform),
|
|
1597
1604
|
data: {
|
|
1598
1605
|
format: opts.json ? "json" : "box",
|
|
1599
1606
|
agent_count: 0, // computed below, not yet available here; Phase 5 verdict reads owner-scope only
|
|
@@ -2039,7 +2046,7 @@ interface CanonicalEvent {
|
|
|
2039
2046
|
event_type: string;
|
|
2040
2047
|
ts: string;
|
|
2041
2048
|
instance_id?: string;
|
|
2042
|
-
|
|
2049
|
+
adapter?: string;
|
|
2043
2050
|
data?: Record<string, unknown>;
|
|
2044
2051
|
}
|
|
2045
2052
|
|
|
@@ -2073,12 +2080,12 @@ function readCanonicalEventsInWindow(root: string, cutoffMs: number): CanonicalE
|
|
|
2073
2080
|
return out;
|
|
2074
2081
|
}
|
|
2075
2082
|
|
|
2076
|
-
/**
|
|
2083
|
+
/** adapter ("claude-code") → legacy platform label ("claude_code") so the
|
|
2077
2084
|
* existing formatPlatformLabel rendering keeps working unchanged. */
|
|
2078
|
-
function
|
|
2079
|
-
if (
|
|
2080
|
-
if (
|
|
2081
|
-
if (
|
|
2085
|
+
function adapterToPlatform(adapter: string | undefined): string {
|
|
2086
|
+
if (adapter === "claude-code") return "claude_code";
|
|
2087
|
+
if (adapter === "cursor") return "cursor";
|
|
2088
|
+
if (adapter === "codex") return "codex";
|
|
2082
2089
|
return "claude_code";
|
|
2083
2090
|
}
|
|
2084
2091
|
|
|
@@ -2100,7 +2107,7 @@ function canonicalToHealEvent(ev: CanonicalEvent, nameById: Map<string, string>)
|
|
|
2100
2107
|
agent,
|
|
2101
2108
|
kind,
|
|
2102
2109
|
reason,
|
|
2103
|
-
platform:
|
|
2110
|
+
platform: adapterToPlatform(ev.adapter),
|
|
2104
2111
|
};
|
|
2105
2112
|
if (kind === "pidmap" && data.pid !== undefined && data.pid !== null) {
|
|
2106
2113
|
out.pid = String(data.pid);
|
|
@@ -2982,17 +2989,17 @@ interface SampleReplayResult {
|
|
|
2982
2989
|
message?: string;
|
|
2983
2990
|
}
|
|
2984
2991
|
|
|
2985
|
-
function
|
|
2992
|
+
function runAdapterProbe(
|
|
2986
2993
|
id: string,
|
|
2987
2994
|
opts: { json?: boolean; replaySamples?: boolean; sample?: string },
|
|
2988
2995
|
): void {
|
|
2989
2996
|
if (opts.json) emit.config({ format: "json" });
|
|
2990
2997
|
|
|
2991
|
-
const
|
|
2992
|
-
if (
|
|
2998
|
+
const adapter = id.trim();
|
|
2999
|
+
if (adapter !== "claude_code" && adapter !== "cursor") {
|
|
2993
3000
|
emit.error({
|
|
2994
|
-
code: "
|
|
2995
|
-
message: "
|
|
3001
|
+
code: "bad_adapter",
|
|
3002
|
+
message: "adapter id must be claude_code or cursor",
|
|
2996
3003
|
});
|
|
2997
3004
|
process.exit(1);
|
|
2998
3005
|
}
|
|
@@ -3007,16 +3014,16 @@ function runHarnessProbe(
|
|
|
3007
3014
|
}
|
|
3008
3015
|
|
|
3009
3016
|
const subagentDir =
|
|
3010
|
-
|
|
3017
|
+
adapter === "cursor" ? ".harnery/.cursor-subagent-map" : `.harnery/.subagent-map/${adapter}`;
|
|
3011
3018
|
const sampleDir =
|
|
3012
|
-
|
|
3019
|
+
adapter === "cursor" ? "docs/api/cursor-hooks/samples" : "docs/api/claude-code-hooks/samples";
|
|
3013
3020
|
const dispatchEntry =
|
|
3014
|
-
|
|
3015
|
-
? "harnery/bin/agent-hook session-start --
|
|
3016
|
-
: "harnery/bin/agent-hook session-start --
|
|
3021
|
+
adapter === "cursor"
|
|
3022
|
+
? "harnery/bin/agent-hook session-start --adapter cursor"
|
|
3023
|
+
: "harnery/bin/agent-hook session-start --adapter claude-code";
|
|
3017
3024
|
|
|
3018
3025
|
// TS-native probe. The owner + anchor-pid resolution it reports lives in
|
|
3019
|
-
// `
|
|
3026
|
+
// `findAdapterAnchorPid` (core/hooks/cli.ts, the /proc walk mirrored below)
|
|
3020
3027
|
// and `resolveOwner` here, so the probe reports exactly what the live hot
|
|
3021
3028
|
// path resolves.
|
|
3022
3029
|
const anchorTokens = new Set(["claude", "claude-code", "cursor", "codex"]);
|
|
@@ -3054,7 +3061,7 @@ function runHarnessProbe(
|
|
|
3054
3061
|
}
|
|
3055
3062
|
|
|
3056
3063
|
const data: Record<string, unknown> = {
|
|
3057
|
-
|
|
3064
|
+
adapter,
|
|
3058
3065
|
anchor_pid: anchorPid,
|
|
3059
3066
|
hook_pid: String(process.pid),
|
|
3060
3067
|
resolved_owner: resolveOwner() ?? "",
|
|
@@ -3062,14 +3069,14 @@ function runHarnessProbe(
|
|
|
3062
3069
|
subagent_map_dir: subagentDir,
|
|
3063
3070
|
sample_ref: sampleDir,
|
|
3064
3071
|
dispatch_entry: dispatchEntry,
|
|
3065
|
-
note: "heal-events counts drift;
|
|
3072
|
+
note: "heal-events counts drift; adapter-probe answers wiring",
|
|
3066
3073
|
};
|
|
3067
3074
|
|
|
3068
3075
|
const wantReplay = opts.replaySamples || !!opts.sample;
|
|
3069
3076
|
let samples: SampleReplayResult[] = [];
|
|
3070
3077
|
let replayExitCode = 0;
|
|
3071
3078
|
if (wantReplay) {
|
|
3072
|
-
const result =
|
|
3079
|
+
const result = replayAdapterSamples(adapter, root, sampleDir, opts.sample);
|
|
3073
3080
|
samples = result.samples;
|
|
3074
3081
|
replayExitCode = result.exitCode;
|
|
3075
3082
|
data.samples = samples;
|
|
@@ -3079,7 +3086,7 @@ function runHarnessProbe(
|
|
|
3079
3086
|
emit.data(data);
|
|
3080
3087
|
if (process.stdout.isTTY && !opts.json) {
|
|
3081
3088
|
const lines = [
|
|
3082
|
-
`
|
|
3089
|
+
`Adapter probe: ${adapter}`,
|
|
3083
3090
|
` anchor_pid: ${String(data.anchor_pid) || "(empty, expected in sandbox/non-IDE)"}`,
|
|
3084
3091
|
` hook_pid: ${String(data.hook_pid)}`,
|
|
3085
3092
|
` resolved_owner: ${String(data.resolved_owner) || "(none)"}`,
|
|
@@ -3125,11 +3132,11 @@ function runHarnessProbe(
|
|
|
3125
3132
|
}
|
|
3126
3133
|
|
|
3127
3134
|
/**
|
|
3128
|
-
* Replay every JSON fixture in <root>/<sampleDir> against the live
|
|
3135
|
+
* Replay every JSON fixture in <root>/<sampleDir> against the live adapter
|
|
3129
3136
|
* dispatcher in an isolated sandbox.
|
|
3130
3137
|
*
|
|
3131
3138
|
* Sandbox isolation strategy:
|
|
3132
|
-
* - mkdtempSync(tmpdir(), "harn-
|
|
3139
|
+
* - mkdtempSync(tmpdir(), "harn-adapter-probe-") creates a non-git tmp dir.
|
|
3133
3140
|
* - The dispatcher's coord-root resolution falls back to
|
|
3134
3141
|
* `HARNERY_COORD_ROOT_OVERRIDE` when git rev-parse fails. We set it to the sandbox.
|
|
3135
3142
|
* - We rewrite the payload's `cwd` field (Cursor cds to it) to the sandbox,
|
|
@@ -3141,8 +3148,8 @@ function runHarnessProbe(
|
|
|
3141
3148
|
* payload with `.hook_event_name`. Event name resolution falls back to the
|
|
3142
3149
|
* filename (without `.json`) when neither field exists.
|
|
3143
3150
|
*/
|
|
3144
|
-
function
|
|
3145
|
-
|
|
3151
|
+
function replayAdapterSamples(
|
|
3152
|
+
adapter: string,
|
|
3146
3153
|
root: string,
|
|
3147
3154
|
relativeSampleDir: string,
|
|
3148
3155
|
filter?: string,
|
|
@@ -3174,7 +3181,7 @@ function replayHarnessSamples(
|
|
|
3174
3181
|
}
|
|
3175
3182
|
|
|
3176
3183
|
// agent-hook is the single entry point. Replay sample payloads against it,
|
|
3177
|
-
// mapping the
|
|
3184
|
+
// mapping the adapter-native hook_event_name to the agent-hook CLI subcommand.
|
|
3178
3185
|
const agentHook = resolve(root, "harnery/bin/agent-hook");
|
|
3179
3186
|
if (!existsSync(agentHook)) {
|
|
3180
3187
|
return {
|
|
@@ -3212,9 +3219,9 @@ function replayHarnessSamples(
|
|
|
3212
3219
|
stopFailure: "stop-failure",
|
|
3213
3220
|
StopFailure: "stop-failure",
|
|
3214
3221
|
};
|
|
3215
|
-
const
|
|
3222
|
+
const adapterFlag = adapter === "claude_code" ? "claude-code" : adapter;
|
|
3216
3223
|
|
|
3217
|
-
const sandbox = mkdtempSync(join(tmpdir(), "harn-
|
|
3224
|
+
const sandbox = mkdtempSync(join(tmpdir(), "harn-adapter-probe-"));
|
|
3218
3225
|
const results: SampleReplayResult[] = [];
|
|
3219
3226
|
|
|
3220
3227
|
try {
|
|
@@ -3255,7 +3262,7 @@ function replayHarnessSamples(
|
|
|
3255
3262
|
}
|
|
3256
3263
|
|
|
3257
3264
|
const subcommand = EVENT_SUBCOMMAND[event] ?? event;
|
|
3258
|
-
const dispatch = spawnSync("bash", [agentHook, subcommand, "--
|
|
3265
|
+
const dispatch = spawnSync("bash", [agentHook, subcommand, "--adapter", adapterFlag], {
|
|
3259
3266
|
cwd: sandbox,
|
|
3260
3267
|
encoding: "utf8",
|
|
3261
3268
|
input: JSON.stringify(payloadObj),
|
|
@@ -3263,8 +3270,8 @@ function replayHarnessSamples(
|
|
|
3263
3270
|
env: {
|
|
3264
3271
|
...process.env,
|
|
3265
3272
|
HARNERY_COORD_ROOT_OVERRIDE: sandbox,
|
|
3266
|
-
|
|
3267
|
-
HARNERY_AGENT_COORD_PLATFORM:
|
|
3273
|
+
HARNERY_AGENT_COORD_ADAPTER: adapter,
|
|
3274
|
+
HARNERY_AGENT_COORD_PLATFORM: adapter,
|
|
3268
3275
|
HARNERY_AGENT_COORD_OFF: "0",
|
|
3269
3276
|
},
|
|
3270
3277
|
});
|
|
@@ -3405,8 +3412,8 @@ function runPing(name: string, message: string, opts: { json?: boolean }): void
|
|
|
3405
3412
|
peer_instance_id: peerOwner,
|
|
3406
3413
|
from: fromName,
|
|
3407
3414
|
body,
|
|
3408
|
-
|
|
3409
|
-
|
|
3415
|
+
journal_path: doc.path,
|
|
3416
|
+
journal_bytes: doc.bytes,
|
|
3410
3417
|
};
|
|
3411
3418
|
|
|
3412
3419
|
if (opts.json) {
|
|
@@ -3663,7 +3670,7 @@ function emitCouncilStateEvent(
|
|
|
3663
3670
|
type,
|
|
3664
3671
|
owner: myOwner,
|
|
3665
3672
|
session: hb?.session_id ?? myOwner,
|
|
3666
|
-
|
|
3673
|
+
adapter: normalizeAdapter(hb?.platform),
|
|
3667
3674
|
data: { council_id: manifest.council_id, ...extraData },
|
|
3668
3675
|
});
|
|
3669
3676
|
}
|
|
@@ -3787,7 +3794,7 @@ function runCouncilCreate(
|
|
|
3787
3794
|
type: "council.open",
|
|
3788
3795
|
owner: myOwner,
|
|
3789
3796
|
session: myHbForEmit?.session_id ?? myOwner,
|
|
3790
|
-
|
|
3797
|
+
adapter: normalizeAdapter(myHbForEmit?.platform),
|
|
3791
3798
|
data: {
|
|
3792
3799
|
council_id: councilId,
|
|
3793
3800
|
topic: trimmedObjective,
|
|
@@ -3797,7 +3804,7 @@ function runCouncilCreate(
|
|
|
3797
3804
|
});
|
|
3798
3805
|
}
|
|
3799
3806
|
|
|
3800
|
-
// Best-effort: ping each currently-active member's
|
|
3807
|
+
// Best-effort: ping each currently-active member's journal with a
|
|
3801
3808
|
// handoff entry pointing them at the council. Members not currently active
|
|
3802
3809
|
// get nothing here; the Phase 2 SessionStart adapter will surface the
|
|
3803
3810
|
// invite on their next session.
|
|
@@ -4269,7 +4276,7 @@ function runCouncilSetSteward(
|
|
|
4269
4276
|
const known_names = known.map((a) => a.name).join(", ") || "(none)";
|
|
4270
4277
|
emit.error({
|
|
4271
4278
|
code: "steward_not_known",
|
|
4272
|
-
message: `'${steward}' is not a known agent (active heartbeats +
|
|
4279
|
+
message: `'${steward}' is not a known agent (active heartbeats + journals archived in the last 30 days). Pass --allow-unknown to bootstrap. Known: ${known_names}`,
|
|
4273
4280
|
});
|
|
4274
4281
|
process.exit(1);
|
|
4275
4282
|
}
|
|
@@ -4304,7 +4311,7 @@ function runCouncilSetSteward(
|
|
|
4304
4311
|
}
|
|
4305
4312
|
}
|
|
4306
4313
|
|
|
4307
|
-
/** Build a markdown
|
|
4314
|
+
/** Build a markdown journal of every round's contributions on disk. */
|
|
4308
4315
|
function buildTranscript(manifest: CouncilManifest): {
|
|
4309
4316
|
markdown: string;
|
|
4310
4317
|
rounds: Array<{ round: number; contributions: number }>;
|
|
@@ -4382,7 +4389,7 @@ function runCouncilContribute(
|
|
|
4382
4389
|
|
|
4383
4390
|
// Resolve the contributor name. Two paths:
|
|
4384
4391
|
// 1. --as <member> override: caller explicitly names the council seat. Used
|
|
4385
|
-
// for cross-
|
|
4392
|
+
// for cross-adapter councils where each reviewer agent has a different
|
|
4386
4393
|
// auto-generated session name from a different name pool; they can
|
|
4387
4394
|
// contribute under a fixed seat name without renaming the session.
|
|
4388
4395
|
// 2. Heartbeat-derived (default): resolve owner via ppid walk + read the
|
|
@@ -4576,7 +4583,7 @@ function runCouncilPrompt(
|
|
|
4576
4583
|
}
|
|
4577
4584
|
|
|
4578
4585
|
// Resolve caller identity (steward authority check). Same --as override
|
|
4579
|
-
// shape as `contribute` for cross-
|
|
4586
|
+
// shape as `contribute` for cross-adapter scripting.
|
|
4580
4587
|
let callerName: string;
|
|
4581
4588
|
let actualName: string | null = null;
|
|
4582
4589
|
if (opts.as) {
|
|
@@ -4798,7 +4805,7 @@ function runCouncilAdvance(id: string, opts: { force?: boolean; json?: boolean }
|
|
|
4798
4805
|
* Shared advance helper used by both `advance` and auto-advance from
|
|
4799
4806
|
* `contribute`. Increments current_round, flips round_status back to open,
|
|
4800
4807
|
* creates the new round directory, writes the manifest, and pings each
|
|
4801
|
-
* member's
|
|
4808
|
+
* member's journal with the advance notification.
|
|
4802
4809
|
*/
|
|
4803
4810
|
function advanceCouncil(manifest: CouncilManifest, force: boolean): CouncilManifest {
|
|
4804
4811
|
const nextRound = manifest.current_round + 1;
|
|
@@ -4812,7 +4819,7 @@ function advanceCouncil(manifest: CouncilManifest, force: boolean): CouncilManif
|
|
|
4812
4819
|
if (rd && !existsSync(rd)) mkdirSync(rd, { recursive: true });
|
|
4813
4820
|
writeManifest(next);
|
|
4814
4821
|
|
|
4815
|
-
// Ping each member's
|
|
4822
|
+
// Ping each member's journal with the advance notification.
|
|
4816
4823
|
// (Convener already knows; we skip pinging them if they convened it from
|
|
4817
4824
|
// their own session.)
|
|
4818
4825
|
const myOwner = resolveOwner();
|
|
@@ -4829,7 +4836,7 @@ function advanceCouncil(manifest: CouncilManifest, force: boolean): CouncilManif
|
|
|
4829
4836
|
`from council advance (${manifest.council_id}): round ${nextRound} is now open${force ? " (advanced with --force; some round-N members dropped)" : ""}. Run 'harn agents council show ${manifest.council_id}' to read prior round + 'harn agents council contribute ${manifest.council_id}' to weigh in.`,
|
|
4830
4837
|
);
|
|
4831
4838
|
} catch {
|
|
4832
|
-
/* best-effort; member
|
|
4839
|
+
/* best-effort; member journal may not exist yet */
|
|
4833
4840
|
}
|
|
4834
4841
|
}
|
|
4835
4842
|
return next;
|
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
import type { Command } from "commander";
|
|
2
|
+
import type { EmitContext, HarneryProgramContext } from "../commander.ts";
|
|
3
|
+
import { monorepoRoot, readHeartbeat, resolveOwner } from "../core/agents/index.ts";
|
|
4
|
+
import {
|
|
5
|
+
type ArtifactActor,
|
|
6
|
+
cleanArtifacts,
|
|
7
|
+
createArtifact,
|
|
8
|
+
inventoryArtifacts,
|
|
9
|
+
releaseArtifact,
|
|
10
|
+
renewArtifact,
|
|
11
|
+
showArtifact,
|
|
12
|
+
} from "../core/artifacts/index.ts";
|
|
13
|
+
import { artifactDefaultRetentionDays, coordFreshnessSeconds } from "../core/config.ts";
|
|
14
|
+
|
|
15
|
+
export function registerArtifactsCommand(
|
|
16
|
+
program: Command,
|
|
17
|
+
emit: EmitContext,
|
|
18
|
+
context?: HarneryProgramContext,
|
|
19
|
+
): void {
|
|
20
|
+
const root = program
|
|
21
|
+
.command("artifacts")
|
|
22
|
+
.alias("artifact")
|
|
23
|
+
.description("Manage repository-local working artifacts under .harnery/artifacts/");
|
|
24
|
+
|
|
25
|
+
root
|
|
26
|
+
.command("create <slug>")
|
|
27
|
+
.description("Create one managed artifact workspace and print its path.")
|
|
28
|
+
.requiredOption("--purpose <text>", "What the files are for")
|
|
29
|
+
.option("--days <n>", "Retention in days (default from artifacts.default_retention_days)")
|
|
30
|
+
.action((slug: string, opts: { purpose: string; days?: string }) => {
|
|
31
|
+
run(emit, () => {
|
|
32
|
+
const repoRoot = requireRepoRoot(context);
|
|
33
|
+
const actor = currentActor();
|
|
34
|
+
const retentionDays = opts.days
|
|
35
|
+
? parseDays(opts.days)
|
|
36
|
+
: artifactDefaultRetentionDays(repoRoot);
|
|
37
|
+
const created = createArtifact(repoRoot, {
|
|
38
|
+
slug,
|
|
39
|
+
purpose: opts.purpose,
|
|
40
|
+
retentionDays,
|
|
41
|
+
actor,
|
|
42
|
+
});
|
|
43
|
+
emit.data({
|
|
44
|
+
path: created.path,
|
|
45
|
+
artifact_id: created.manifest.artifact_id,
|
|
46
|
+
expires_at: created.manifest.retention.expires_at,
|
|
47
|
+
owner_instance_id: actor?.instance_id ?? null,
|
|
48
|
+
});
|
|
49
|
+
});
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
root
|
|
53
|
+
.command("list")
|
|
54
|
+
.description("Inventory every artifact workspace with its cleanup classification.")
|
|
55
|
+
.action(() => {
|
|
56
|
+
run(emit, () => {
|
|
57
|
+
const repoRoot = requireRepoRoot(context);
|
|
58
|
+
const rows = inventoryArtifacts(repoRoot, {
|
|
59
|
+
freshnessSeconds: coordFreshnessSeconds(repoRoot),
|
|
60
|
+
});
|
|
61
|
+
emit.data({ rows, meta: summarize(rows) });
|
|
62
|
+
});
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
root
|
|
66
|
+
.command("show <ref>")
|
|
67
|
+
.description("Show one artifact by id, directory name, or direct-child path.")
|
|
68
|
+
.action((ref: string) => {
|
|
69
|
+
run(emit, () => {
|
|
70
|
+
const repoRoot = requireRepoRoot(context);
|
|
71
|
+
emit.data(
|
|
72
|
+
showArtifact(repoRoot, ref, {
|
|
73
|
+
freshnessSeconds: coordFreshnessSeconds(repoRoot),
|
|
74
|
+
}),
|
|
75
|
+
);
|
|
76
|
+
});
|
|
77
|
+
});
|
|
78
|
+
|
|
79
|
+
root
|
|
80
|
+
.command("renew <ref>")
|
|
81
|
+
.description("Set a new retention window. Renewal does not mark the artifact active.")
|
|
82
|
+
.requiredOption("--days <n>", "Days from now")
|
|
83
|
+
.requiredOption("--reason <text>", "Why the extra retention is needed")
|
|
84
|
+
.action((ref: string, opts: { days: string; reason: string }) => {
|
|
85
|
+
run(emit, () => {
|
|
86
|
+
const repoRoot = requireRepoRoot(context);
|
|
87
|
+
const manifest = renewArtifact(repoRoot, ref, parseDays(opts.days), opts.reason, {
|
|
88
|
+
actor: currentActor(),
|
|
89
|
+
});
|
|
90
|
+
emit.data(manifest);
|
|
91
|
+
});
|
|
92
|
+
});
|
|
93
|
+
|
|
94
|
+
root
|
|
95
|
+
.command("release <ref>")
|
|
96
|
+
.description("Release active-owner protection without shortening retention.")
|
|
97
|
+
.action((ref: string) => {
|
|
98
|
+
run(emit, () => {
|
|
99
|
+
const repoRoot = requireRepoRoot(context);
|
|
100
|
+
emit.data(releaseArtifact(repoRoot, ref, { actor: currentActor() }));
|
|
101
|
+
});
|
|
102
|
+
});
|
|
103
|
+
|
|
104
|
+
root
|
|
105
|
+
.command("clean")
|
|
106
|
+
.description("Preview expired artifact deletion; pass --yes to delete.")
|
|
107
|
+
.option("--yes", "Permanently delete entries classified managed-expired")
|
|
108
|
+
.action((opts: { yes?: boolean }) => {
|
|
109
|
+
run(emit, () => {
|
|
110
|
+
const repoRoot = requireRepoRoot(context);
|
|
111
|
+
const rows = cleanArtifacts(repoRoot, {
|
|
112
|
+
yes: opts.yes,
|
|
113
|
+
freshnessSeconds: coordFreshnessSeconds(repoRoot),
|
|
114
|
+
});
|
|
115
|
+
emit.data({ rows, meta: summarize(rows) });
|
|
116
|
+
});
|
|
117
|
+
});
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
function currentActor(): ArtifactActor | undefined {
|
|
121
|
+
const instanceId = resolveOwner();
|
|
122
|
+
if (!instanceId) return undefined;
|
|
123
|
+
const hb = readHeartbeat(instanceId);
|
|
124
|
+
return {
|
|
125
|
+
instance_id: instanceId,
|
|
126
|
+
session_id: hb?.session_id,
|
|
127
|
+
name: hb?.name,
|
|
128
|
+
};
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
function requireRepoRoot(context?: HarneryProgramContext): string {
|
|
132
|
+
const root = context?.repoRoot ?? monorepoRoot();
|
|
133
|
+
if (!root) throw new Error("not inside a Git repository");
|
|
134
|
+
return root;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
function parseDays(value: string): number {
|
|
138
|
+
const parsed = Number(value);
|
|
139
|
+
if (!Number.isInteger(parsed) || parsed <= 0 || parsed > 3650) {
|
|
140
|
+
throw new Error("--days must be between 1 and 3650");
|
|
141
|
+
}
|
|
142
|
+
return parsed;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
function summarize(rows: { classification: string; action: string }[]): Record<string, unknown> {
|
|
146
|
+
const classifications: Record<string, number> = {};
|
|
147
|
+
for (const row of rows) {
|
|
148
|
+
classifications[row.classification] = (classifications[row.classification] ?? 0) + 1;
|
|
149
|
+
}
|
|
150
|
+
return {
|
|
151
|
+
total: rows.length,
|
|
152
|
+
classifications,
|
|
153
|
+
would_delete: rows.filter((row) => row.action === "would-delete").length,
|
|
154
|
+
deleted: rows.filter((row) => row.action === "deleted").length,
|
|
155
|
+
};
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
function run(emit: EmitContext, fn: () => void): void {
|
|
159
|
+
try {
|
|
160
|
+
fn();
|
|
161
|
+
} catch (error) {
|
|
162
|
+
emit.error({
|
|
163
|
+
code: "artifact_failed",
|
|
164
|
+
message: error instanceof Error ? error.message : String(error),
|
|
165
|
+
});
|
|
166
|
+
emit.setExitCode(1);
|
|
167
|
+
}
|
|
168
|
+
}
|