harnery 0.29.0 → 0.31.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -4
- package/dist/commander.d.ts +8 -0
- package/dist/commander.d.ts.map +1 -1
- package/dist/commander.js +14 -13
- package/dist/commands/adapter.d.ts +12 -0
- package/dist/commands/adapter.d.ts.map +1 -0
- package/dist/commands/{harness.js → adapter.js} +35 -35
- package/dist/commands/agents.d.ts +3 -2
- package/dist/commands/agents.d.ts.map +1 -1
- package/dist/commands/agents.js +61 -60
- package/dist/commands/artifacts.d.ts +4 -0
- package/dist/commands/artifacts.d.ts.map +1 -0
- package/dist/commands/artifacts.js +143 -0
- package/dist/commands/backup.d.ts +1 -1
- package/dist/commands/backup.d.ts.map +1 -1
- package/dist/commands/backup.js +5 -2
- package/dist/commands/browse.d.ts.map +1 -1
- package/dist/commands/browse.js +310 -7
- package/dist/commands/checkpoint.d.ts +12 -0
- package/dist/commands/checkpoint.d.ts.map +1 -0
- package/dist/commands/checkpoint.js +162 -0
- package/dist/commands/context.d.ts +2 -2
- package/dist/commands/context.d.ts.map +1 -1
- package/dist/commands/context.js +3 -151
- package/dist/commands/decision.d.ts.map +1 -1
- package/dist/commands/decision.js +31 -7
- package/dist/commands/deinit.d.ts +2 -2
- package/dist/commands/deinit.js +15 -15
- package/dist/commands/doctor.js +23 -23
- package/dist/commands/governor.d.ts +4 -0
- package/dist/commands/governor.d.ts.map +1 -0
- package/dist/commands/{supervisor.js → governor.js} +133 -108
- package/dist/commands/init.d.ts +12 -12
- package/dist/commands/init.d.ts.map +1 -1
- package/dist/commands/init.js +44 -30
- package/dist/commands/{session.d.ts → journal.d.ts} +2 -2
- package/dist/commands/journal.d.ts.map +1 -0
- package/dist/commands/{scratch.js → journal.js} +47 -47
- package/dist/commands/policy.js +1 -1
- package/dist/commands/presence.js +2 -2
- package/dist/commands/sync.d.ts +1 -1
- package/dist/commands/sync.js +3 -3
- package/dist/commands/tunnel.d.ts +16 -0
- package/dist/commands/tunnel.d.ts.map +1 -1
- package/dist/commands/tunnel.js +193 -23
- package/dist/commands/web-fetch.js +1 -1
- package/dist/commands/web.d.ts +19 -0
- package/dist/commands/web.d.ts.map +1 -1
- package/dist/commands/web.js +51 -0
- package/dist/commands/work.d.ts +2 -1
- package/dist/commands/work.d.ts.map +1 -1
- package/dist/commands/work.js +55 -25
- package/dist/commands/workflow.d.ts.map +1 -1
- package/dist/commands/workflow.js +35 -28
- package/dist/core/{harnesses → adapters}/attest-projection.d.ts +2 -2
- package/dist/core/adapters/attest-projection.d.ts.map +1 -0
- package/dist/core/{harnesses → adapters}/attest.d.ts +16 -16
- package/dist/core/adapters/attest.d.ts.map +1 -0
- package/dist/core/{harnesses → adapters}/attest.js +9 -9
- package/dist/core/{harnesses → adapters}/attestation.d.ts +16 -16
- package/dist/core/adapters/attestation.d.ts.map +1 -0
- package/dist/core/{harnesses → adapters}/attestation.js +20 -20
- package/dist/core/{harnesses → adapters}/bench.d.ts +12 -12
- package/dist/core/adapters/bench.d.ts.map +1 -0
- package/dist/core/{harnesses → adapters}/bench.js +12 -12
- package/dist/core/adapters/index.d.ts +13 -0
- package/dist/core/adapters/index.d.ts.map +1 -0
- package/dist/core/adapters/index.js +6 -0
- package/dist/core/{harnesses → adapters}/profiles.d.ts +11 -11
- package/dist/core/adapters/profiles.d.ts.map +1 -0
- package/dist/core/{harnesses → adapters}/profiles.js +11 -11
- package/dist/core/adapters/registry.d.ts +15 -0
- package/dist/core/adapters/registry.d.ts.map +1 -0
- package/dist/core/{harnesses → adapters}/registry.js +11 -11
- package/dist/core/{harnesses → adapters}/types.d.ts +28 -23
- package/dist/core/adapters/types.d.ts.map +1 -0
- package/dist/core/{harnesses → adapters}/types.js +1 -1
- package/dist/core/agents/canonical-emit.d.ts +4 -4
- package/dist/core/agents/canonical-emit.js +5 -5
- package/dist/core/agents/cli-emit.js +1 -1
- package/dist/core/agents/cli.js +30 -26
- package/dist/core/agents/codex-replay.d.ts +1 -1
- package/dist/core/agents/codex-replay.js +6 -6
- package/dist/core/agents/coord-client.d.ts +21 -2
- package/dist/core/agents/coord-client.d.ts.map +1 -1
- package/dist/core/agents/coord-client.js +122 -27
- package/dist/core/agents/events/consume.d.ts +1 -1
- package/dist/core/agents/events/emit.d.ts +5 -6
- package/dist/core/agents/events/emit.d.ts.map +1 -1
- package/dist/core/agents/events/emit.js +2 -2
- package/dist/core/agents/render/prompt-context.d.ts +21 -9
- package/dist/core/agents/render/prompt-context.d.ts.map +1 -1
- package/dist/core/agents/render/prompt-context.js +82 -30
- package/dist/core/agents/render/session-context.d.ts +1 -1
- package/dist/core/agents/render/session-context.js +5 -5
- package/dist/core/agents/rules/claim-conflict.d.ts +2 -6
- package/dist/core/agents/rules/claim-conflict.d.ts.map +1 -1
- package/dist/core/agents/rules/claim-conflict.js +1 -1
- package/dist/core/agents/rules/commit-conflict.js +98 -22
- package/dist/core/agents/rules/stop-hook.d.ts +9 -9
- package/dist/core/agents/rules/stop-hook.d.ts.map +1 -1
- package/dist/core/agents/rules/stop-hook.js +23 -5
- package/dist/core/agents/rules/verdict.d.ts +14 -0
- package/dist/core/agents/rules/verdict.d.ts.map +1 -0
- package/dist/core/agents/rules/verdict.js +1 -0
- package/dist/core/agents/session-events.js +3 -3
- package/dist/core/agents/state/council.d.ts +1 -1
- package/dist/core/agents/state/council.js +1 -1
- package/dist/core/agents/state/heartbeat-projector.d.ts +3 -2
- package/dist/core/agents/state/heartbeat-projector.d.ts.map +1 -1
- package/dist/core/agents/state/heartbeat-projector.js +14 -10
- package/dist/core/agents/state/heartbeat-writer.d.ts +1 -1
- package/dist/core/agents/state/heartbeat-writer.js +12 -12
- package/dist/core/agents/state/{scratch.d.ts → journal.d.ts} +7 -7
- package/dist/core/agents/state/{scratch.d.ts.map → journal.d.ts.map} +1 -1
- package/dist/core/agents/state/{scratch.js → journal.js} +12 -12
- package/dist/core/agents/state/pidmap.d.ts +28 -4
- package/dist/core/agents/state/pidmap.d.ts.map +1 -1
- package/dist/core/agents/state/pidmap.js +130 -15
- package/dist/core/agents/state/proc-start.d.ts +95 -0
- package/dist/core/agents/state/proc-start.d.ts.map +1 -0
- package/dist/core/agents/state/proc-start.js +199 -0
- package/dist/core/agents/state/shell-mutation.d.ts +1 -1
- package/dist/core/agents/state/shell-mutation.js +1 -1
- package/dist/core/agents/state/stale-sweep.js +7 -7
- package/dist/core/artifacts/index.d.ts +86 -0
- package/dist/core/artifacts/index.d.ts.map +1 -0
- package/dist/core/artifacts/index.js +421 -0
- package/dist/core/config.d.ts +9 -2
- package/dist/core/config.d.ts.map +1 -1
- package/dist/core/config.js +26 -2
- package/dist/core/context/index.d.ts +12 -12
- package/dist/core/context/index.js +10 -10
- package/dist/core/governor/adapter-spread.d.ts +52 -0
- package/dist/core/governor/adapter-spread.d.ts.map +1 -0
- package/dist/core/governor/adapter-spread.js +52 -0
- package/dist/core/governor/index.d.ts +7 -0
- package/dist/core/governor/index.d.ts.map +1 -0
- package/dist/core/governor/index.js +6 -0
- package/dist/core/governor/plan-api.d.ts +38 -0
- package/dist/core/governor/plan-api.d.ts.map +1 -0
- package/dist/core/governor/plan-api.js +83 -0
- package/dist/core/governor/plan-read.d.ts +5 -0
- package/dist/core/governor/plan-read.d.ts.map +1 -0
- package/dist/core/{supervisor → governor}/plan-read.js +71 -51
- package/dist/core/governor/plan-types.d.ts +181 -0
- package/dist/core/governor/plan-types.d.ts.map +1 -0
- package/dist/core/{supervisor → governor}/plan-types.js +4 -4
- package/dist/core/governor/planning.d.ts +48 -0
- package/dist/core/governor/planning.d.ts.map +1 -0
- package/dist/core/{supervisor → governor}/planning.js +143 -94
- package/dist/core/governor/read.d.ts +6 -0
- package/dist/core/governor/read.d.ts.map +1 -0
- package/dist/core/governor/read.js +4 -0
- package/dist/core/governor/runner.d.ts +37 -0
- package/dist/core/governor/runner.d.ts.map +1 -0
- package/dist/core/{supervisor → governor}/runner.js +15 -15
- package/dist/core/governor/service-read.d.ts +6 -0
- package/dist/core/governor/service-read.d.ts.map +1 -0
- package/dist/core/{supervisor → governor}/service-read.js +12 -12
- package/dist/core/governor/service.d.ts +114 -0
- package/dist/core/governor/service.d.ts.map +1 -0
- package/dist/core/{supervisor → governor}/service.js +57 -57
- package/dist/core/governor/state.d.ts +116 -0
- package/dist/core/governor/state.d.ts.map +1 -0
- package/dist/core/{supervisor → governor}/state.js +290 -116
- package/dist/core/hooks/adapter/detect.d.ts +9 -0
- package/dist/core/hooks/{harness → adapter}/detect.d.ts.map +1 -1
- package/dist/core/hooks/{harness → adapter}/detect.js +8 -8
- package/dist/core/hooks/{harness → adapter}/events.d.ts +15 -14
- package/dist/core/hooks/adapter/events.d.ts.map +1 -0
- package/dist/core/hooks/{harness → adapter}/events.js +5 -5
- package/dist/core/hooks/{harness → adapter}/output.d.ts +20 -14
- package/dist/core/hooks/adapter/output.d.ts.map +1 -0
- package/dist/core/hooks/{harness → adapter}/output.js +30 -22
- package/dist/core/hooks/{harness → adapter}/parse.d.ts +5 -5
- package/dist/core/hooks/{harness → adapter}/parse.d.ts.map +1 -1
- package/dist/core/hooks/{harness → adapter}/parse.js +4 -4
- package/dist/core/hooks/{harness → adapter}/wiring.d.ts +15 -15
- package/dist/core/hooks/{harness → adapter}/wiring.d.ts.map +1 -1
- package/dist/core/hooks/{harness → adapter}/wiring.js +13 -13
- package/dist/core/hooks/cli.d.ts +3 -3
- package/dist/core/hooks/cli.js +175 -151
- package/dist/core/hooks/effects/image-capture.d.ts +5 -5
- package/dist/core/hooks/effects/image-capture.d.ts.map +1 -1
- package/dist/core/hooks/effects/image-capture.js +3 -3
- package/dist/core/hooks/effects/index.d.ts +12 -12
- package/dist/core/hooks/effects/index.d.ts.map +1 -1
- package/dist/core/hooks/effects/index.js +17 -17
- package/dist/core/hooks/events/emit.d.ts +2 -2
- package/dist/core/hooks/events/emit.d.ts.map +1 -1
- package/dist/core/hooks/events/emit.js +1 -1
- package/dist/core/hooks/events/rotate.js +1 -1
- package/dist/core/hooks/events/schema.d.ts +13 -5
- package/dist/core/hooks/events/schema.d.ts.map +1 -1
- package/dist/core/hooks/guard-path.d.ts +2 -2
- package/dist/core/hooks/guard-path.js +2 -2
- package/dist/core/hooks/index.d.ts +1 -1
- package/dist/core/hooks/index.d.ts.map +1 -1
- package/dist/core/hooks/resolve/anchor.d.ts +14 -5
- package/dist/core/hooks/resolve/anchor.d.ts.map +1 -1
- package/dist/core/hooks/resolve/anchor.js +64 -7
- package/dist/core/hooks/resolve/coord-root.d.ts +3 -3
- package/dist/core/hooks/resolve/coord-root.js +4 -4
- package/dist/core/hooks/resolve/intent.js +1 -1
- package/dist/core/hooks/resolve/owner.d.ts +1 -1
- package/dist/core/hooks/resolve/owner.d.ts.map +1 -1
- package/dist/core/hooks/resolve/owner.js +11 -5
- package/dist/core/{scratch → journal}/index.d.ts +25 -25
- package/dist/core/{scratch → journal}/index.d.ts.map +1 -1
- package/dist/core/{scratch → journal}/index.js +38 -38
- package/dist/core/policy/evaluate.d.ts +1 -1
- package/dist/core/policy/evaluate.d.ts.map +1 -1
- package/dist/core/policy/evaluate.js +7 -7
- package/dist/core/policy/types.d.ts +3 -3
- package/dist/core/policy/types.d.ts.map +1 -1
- package/dist/core/work/runner.d.ts.map +1 -1
- package/dist/core/work/runner.js +11 -2
- package/dist/core/work/state.d.ts +28 -3
- package/dist/core/work/state.d.ts.map +1 -1
- package/dist/core/work/state.js +148 -16
- package/dist/core/workflow/adapters.d.ts +17 -0
- package/dist/core/workflow/adapters.d.ts.map +1 -0
- package/dist/core/workflow/adapters.js +21 -0
- package/dist/core/workflow/approvals.js +6 -6
- package/dist/core/workflow/billing.d.ts +9 -9
- package/dist/core/workflow/billing.js +9 -9
- package/dist/core/workflow/child-env.d.ts +10 -2
- package/dist/core/workflow/child-env.d.ts.map +1 -1
- package/dist/core/workflow/child-env.js +12 -4
- package/dist/core/workflow/engine.d.ts +15 -5
- package/dist/core/workflow/engine.d.ts.map +1 -1
- package/dist/core/workflow/engine.js +151 -83
- package/dist/core/workflow/evidence-preflight.d.ts +24 -0
- package/dist/core/workflow/evidence-preflight.d.ts.map +1 -0
- package/dist/core/workflow/evidence-preflight.js +134 -0
- package/dist/core/workflow/index.d.ts +3 -2
- package/dist/core/workflow/index.d.ts.map +1 -1
- package/dist/core/workflow/index.js +2 -1
- package/dist/core/workflow/proof.d.ts +28 -5
- package/dist/core/workflow/proof.d.ts.map +1 -1
- package/dist/core/workflow/proof.js +77 -34
- package/dist/core/workflow/run-state.d.ts +1 -1
- package/dist/core/workflow/run-state.js +7 -7
- package/dist/core/workflow/sandbox-projection.d.ts +6 -6
- package/dist/core/workflow/sandbox-projection.d.ts.map +1 -1
- package/dist/core/workflow/sandbox-projection.js +11 -11
- package/dist/core/workflow/spawn-claude.d.ts +3 -3
- package/dist/core/workflow/spawn-claude.d.ts.map +1 -1
- package/dist/core/workflow/spawn-claude.js +28 -8
- package/dist/core/workflow/spawn-codex.d.ts +4 -4
- package/dist/core/workflow/spawn-codex.d.ts.map +1 -1
- package/dist/core/workflow/spawn-codex.js +26 -8
- package/dist/core/workflow/spawn-cursor.d.ts +4 -4
- package/dist/core/workflow/spawn-cursor.d.ts.map +1 -1
- package/dist/core/workflow/spawn-cursor.js +27 -8
- package/dist/core/workflow/spawn-failure.d.ts +15 -1
- package/dist/core/workflow/spawn-failure.d.ts.map +1 -1
- package/dist/core/workflow/spawn-failure.js +35 -1
- package/dist/core/workflow/specialists.js +2 -2
- package/dist/core/workflow/{journal.d.ts → transcript.d.ts} +8 -8
- package/dist/core/workflow/transcript.d.ts.map +1 -0
- package/dist/core/workflow/{journal.js → transcript.js} +14 -14
- package/dist/core/workflow/types.d.ts +119 -46
- package/dist/core/workflow/types.d.ts.map +1 -1
- package/dist/core/workflow/types.js +11 -1
- package/dist/core/workflow/validate.d.ts +1 -1
- package/dist/core/workflow/validate.js +1 -1
- package/dist/core/workflow/workspaces/cancellation.js +2 -2
- package/dist/core/workflow/workspaces/cleanup.js +2 -2
- package/dist/core/workflow/workspaces/execution.js +6 -6
- package/dist/core/workflow/workspaces/inspect.js +9 -9
- package/dist/core/workflow/workspaces/integration.js +14 -14
- package/dist/core/workflow/workspaces/lifecycle.d.ts +1 -1
- package/dist/core/workflow/workspaces/lifecycle.d.ts.map +1 -1
- package/dist/core/workflow/workspaces/lifecycle.js +9 -9
- package/dist/core/workflow/workspaces/local-git.d.ts.map +1 -1
- package/dist/core/workflow/workspaces/local-git.js +39 -5
- package/dist/core/workflow/workspaces/recovery.js +3 -3
- package/dist/core/workflow/workspaces/state.d.ts +1 -1
- package/dist/core/workflow/workspaces/state.d.ts.map +1 -1
- package/dist/core/workflow/workspaces/state.js +3 -3
- package/dist/core/workflow/workspaces/types.d.ts +1 -1
- package/dist/core/workflow/workspaces/types.d.ts.map +1 -1
- package/dist/lib/browser/asserts.d.ts +28 -0
- package/dist/lib/browser/asserts.d.ts.map +1 -0
- package/dist/lib/browser/asserts.js +152 -0
- package/dist/lib/browser/client.d.ts +49 -0
- package/dist/lib/browser/client.d.ts.map +1 -1
- package/dist/lib/browser/client.js +155 -14
- package/dist/lib/browser/content-checks.d.ts +108 -0
- package/dist/lib/browser/content-checks.d.ts.map +1 -0
- package/dist/lib/browser/content-checks.js +474 -0
- package/dist/lib/browser/critique.d.ts +91 -0
- package/dist/lib/browser/critique.d.ts.map +1 -0
- package/dist/lib/browser/critique.js +167 -0
- package/dist/lib/browser/geometry.d.ts +32 -0
- package/dist/lib/browser/geometry.d.ts.map +1 -1
- package/dist/lib/browser/geometry.js +244 -1
- package/dist/lib/browser/index.d.ts +4 -1
- package/dist/lib/browser/index.d.ts.map +1 -1
- package/dist/lib/browser/index.js +2 -0
- package/dist/lib/claude-desktop.d.ts.map +1 -1
- package/dist/lib/claude-desktop.js +4 -1
- package/dist/lib/council/index.d.ts +6 -6
- package/dist/lib/council/index.d.ts.map +1 -1
- package/dist/lib/council/index.js +8 -8
- package/dist/lib/exec.d.ts +7 -0
- package/dist/lib/exec.d.ts.map +1 -1
- package/dist/lib/exec.js +6 -3
- package/dist/lib/identities/assume.d.ts +2 -2
- package/dist/lib/identities/assume.js +7 -7
- package/dist/lib/instructions/apply.d.ts +3 -3
- package/dist/lib/instructions/apply.d.ts.map +1 -1
- package/dist/lib/instructions/apply.js +75 -27
- package/dist/lib/instructions/host-addendum.d.ts +54 -0
- package/dist/lib/instructions/host-addendum.d.ts.map +1 -0
- package/dist/lib/instructions/host-addendum.js +107 -0
- package/dist/lib/instructions/templates.d.ts +10 -3
- package/dist/lib/instructions/templates.d.ts.map +1 -1
- package/dist/lib/instructions/templates.js +41 -12
- package/dist/lib/machine.d.ts +2 -2
- package/dist/lib/machine.js +2 -2
- package/package.json +26 -21
- package/schemas/config.schema.json +26 -1
- package/src/commander.ts +22 -13
- package/src/commands/{harness.ts → adapter.ts} +46 -46
- package/src/commands/agents.ts +71 -64
- package/src/commands/artifacts.ts +168 -0
- package/src/commands/backup.ts +47 -33
- package/src/commands/browse.ts +438 -2
- package/src/commands/checkpoint.ts +196 -0
- package/src/commands/context.ts +3 -176
- package/src/commands/decision.ts +41 -7
- package/src/commands/deinit.ts +16 -16
- package/src/commands/doctor.ts +28 -28
- package/src/commands/{supervisor.ts → governor.ts} +184 -154
- package/src/commands/init.ts +50 -34
- package/src/commands/{scratch.ts → journal.ts} +60 -60
- package/src/commands/policy.ts +1 -1
- package/src/commands/presence.ts +2 -2
- package/src/commands/sync.ts +3 -3
- package/src/commands/tunnel.ts +237 -34
- package/src/commands/web-fetch.ts +1 -1
- package/src/commands/web.ts +56 -1
- package/src/commands/work.ts +72 -38
- package/src/commands/workflow.ts +43 -34
- package/src/core/{harnesses → adapters}/attest-projection.ts +2 -2
- package/src/core/{harnesses → adapters}/attest.ts +27 -27
- package/src/core/{harnesses → adapters}/attestation.ts +41 -41
- package/src/core/{harnesses → adapters}/bench.ts +34 -43
- package/src/core/adapters/index.ts +56 -0
- package/src/core/{harnesses → adapters}/profiles.ts +16 -16
- package/src/core/{harnesses → adapters}/registry.ts +23 -23
- package/src/core/{harnesses → adapters}/types.ts +28 -23
- package/src/core/agents/canonical-emit.ts +6 -6
- package/src/core/agents/cli-emit.ts +1 -1
- package/src/core/agents/cli.ts +30 -28
- package/src/core/agents/codex-replay.ts +6 -6
- package/src/core/agents/coord-client.ts +119 -28
- package/src/core/agents/events/consume.ts +1 -1
- package/src/core/agents/events/emit.ts +7 -6
- package/src/core/agents/render/prompt-context.ts +107 -31
- package/src/core/agents/render/session-context.ts +6 -6
- package/src/core/agents/rules/claim-conflict.ts +4 -7
- package/src/core/agents/rules/commit-conflict.ts +103 -22
- package/src/core/agents/rules/stop-hook.ts +33 -17
- package/src/core/agents/rules/verdict.ts +13 -0
- package/src/core/agents/session-events.ts +4 -4
- package/src/core/agents/state/council.ts +1 -1
- package/src/core/agents/state/heartbeat-projector.ts +16 -12
- package/src/core/agents/state/heartbeat-writer.ts +12 -12
- package/src/core/agents/state/{scratch.ts → journal.ts} +12 -12
- package/src/core/agents/state/pidmap.ts +130 -15
- package/src/core/agents/state/proc-start.ts +208 -0
- package/src/core/agents/state/shell-mutation.ts +1 -1
- package/src/core/agents/state/stale-sweep.ts +7 -7
- package/src/core/artifacts/index.ts +557 -0
- package/src/core/config.ts +30 -2
- package/src/core/context/index.ts +15 -15
- package/src/core/governor/adapter-spread.ts +82 -0
- package/src/core/governor/index.ts +91 -0
- package/src/core/governor/plan-api.ts +115 -0
- package/src/core/{supervisor → governor}/plan-read.ts +120 -96
- package/src/core/{supervisor → governor}/plan-types.ts +64 -50
- package/src/core/{supervisor → governor}/planning.ts +240 -188
- package/src/core/governor/read.ts +59 -0
- package/src/core/{supervisor → governor}/runner.ts +39 -39
- package/src/core/{supervisor → governor}/service-read.ts +22 -22
- package/src/core/{supervisor → governor}/service.ts +117 -119
- package/src/core/{supervisor → governor}/state.ts +389 -174
- package/src/core/hooks/adapter/detect.ts +30 -0
- package/src/core/hooks/{harness → adapter}/events.ts +16 -14
- package/src/core/hooks/{harness → adapter}/output.ts +31 -23
- package/src/core/hooks/{harness → adapter}/parse.ts +5 -5
- package/src/core/hooks/{harness → adapter}/wiring.ts +21 -21
- package/src/core/hooks/cli.ts +185 -162
- package/src/core/hooks/effects/image-capture.ts +6 -6
- package/src/core/hooks/effects/index.ts +17 -17
- package/src/core/hooks/events/emit.ts +3 -3
- package/src/core/hooks/events/rotate.ts +1 -1
- package/src/core/hooks/events/schema.ts +15 -7
- package/src/core/hooks/guard-path.ts +2 -2
- package/src/core/hooks/index.ts +1 -1
- package/src/core/hooks/resolve/anchor.ts +63 -8
- package/src/core/hooks/resolve/coord-root.ts +4 -4
- package/src/core/hooks/resolve/intent.ts +1 -1
- package/src/core/hooks/resolve/owner.ts +11 -5
- package/src/core/{scratch → journal}/index.ts +53 -53
- package/src/core/policy/evaluate.ts +8 -8
- package/src/core/policy/types.ts +3 -3
- package/src/core/work/runner.ts +11 -2
- package/src/core/work/state.ts +185 -21
- package/src/core/workflow/adapters.ts +33 -0
- package/src/core/workflow/approvals.ts +7 -7
- package/src/core/workflow/billing.ts +12 -12
- package/src/core/workflow/child-env.ts +13 -4
- package/src/core/workflow/engine.ts +166 -90
- package/src/core/workflow/evidence-preflight.ts +165 -0
- package/src/core/workflow/index.ts +6 -3
- package/src/core/workflow/proof.ts +94 -48
- package/src/core/workflow/run-state.ts +7 -7
- package/src/core/workflow/sandbox-projection.ts +16 -16
- package/src/core/workflow/spawn-claude.ts +34 -12
- package/src/core/workflow/spawn-codex.ts +30 -12
- package/src/core/workflow/spawn-cursor.ts +31 -12
- package/src/core/workflow/spawn-failure.ts +41 -1
- package/src/core/workflow/specialists.ts +2 -2
- package/src/core/workflow/{journal.ts → transcript.ts} +16 -16
- package/src/core/workflow/types.ts +130 -46
- package/src/core/workflow/validate.ts +1 -1
- package/src/core/workflow/workspaces/cancellation.ts +2 -2
- package/src/core/workflow/workspaces/cleanup.ts +2 -2
- package/src/core/workflow/workspaces/execution.ts +6 -6
- package/src/core/workflow/workspaces/inspect.ts +14 -11
- package/src/core/workflow/workspaces/integration.ts +18 -14
- package/src/core/workflow/workspaces/lifecycle.ts +10 -10
- package/src/core/workflow/workspaces/local-git.ts +47 -5
- package/src/core/workflow/workspaces/recovery.ts +3 -3
- package/src/core/workflow/workspaces/state.ts +4 -3
- package/src/core/workflow/workspaces/types.ts +1 -1
- package/src/lib/browser/asserts.ts +177 -0
- package/src/lib/browser/client.ts +189 -14
- package/src/lib/browser/content-checks.ts +571 -0
- package/src/lib/browser/critique.ts +231 -0
- package/src/lib/browser/geometry.ts +297 -1
- package/src/lib/browser/index.ts +34 -0
- package/src/lib/claude-desktop.ts +4 -1
- package/src/lib/council/index.ts +9 -9
- package/src/lib/exec.ts +13 -3
- package/src/lib/identities/assume.ts +7 -7
- package/src/lib/instructions/apply.ts +87 -25
- package/src/lib/instructions/host-addendum.ts +126 -0
- package/src/lib/instructions/templates.ts +44 -15
- package/src/lib/machine.ts +2 -2
- package/dist/commands/harness.d.ts +0 -12
- package/dist/commands/harness.d.ts.map +0 -1
- package/dist/commands/scratch.d.ts +0 -4
- package/dist/commands/scratch.d.ts.map +0 -1
- package/dist/commands/session.d.ts.map +0 -1
- package/dist/commands/session.js +0 -162
- package/dist/commands/supervisor.d.ts +0 -4
- package/dist/commands/supervisor.d.ts.map +0 -1
- package/dist/core/harnesses/attest-projection.d.ts.map +0 -1
- package/dist/core/harnesses/attest.d.ts.map +0 -1
- package/dist/core/harnesses/attestation.d.ts.map +0 -1
- package/dist/core/harnesses/bench.d.ts.map +0 -1
- package/dist/core/harnesses/index.d.ts +0 -13
- package/dist/core/harnesses/index.d.ts.map +0 -1
- package/dist/core/harnesses/index.js +0 -6
- package/dist/core/harnesses/profiles.d.ts.map +0 -1
- package/dist/core/harnesses/registry.d.ts +0 -15
- package/dist/core/harnesses/registry.d.ts.map +0 -1
- package/dist/core/harnesses/types.d.ts.map +0 -1
- package/dist/core/hooks/harness/detect.d.ts +0 -9
- package/dist/core/hooks/harness/events.d.ts.map +0 -1
- package/dist/core/hooks/harness/output.d.ts.map +0 -1
- package/dist/core/supervisor/index.d.ts +0 -7
- package/dist/core/supervisor/index.d.ts.map +0 -1
- package/dist/core/supervisor/index.js +0 -6
- package/dist/core/supervisor/plan-api.d.ts +0 -23
- package/dist/core/supervisor/plan-api.d.ts.map +0 -1
- package/dist/core/supervisor/plan-api.js +0 -50
- package/dist/core/supervisor/plan-read.d.ts +0 -5
- package/dist/core/supervisor/plan-read.d.ts.map +0 -1
- package/dist/core/supervisor/plan-types.d.ts +0 -170
- package/dist/core/supervisor/plan-types.d.ts.map +0 -1
- package/dist/core/supervisor/planning.d.ts +0 -33
- package/dist/core/supervisor/planning.d.ts.map +0 -1
- package/dist/core/supervisor/read.d.ts +0 -6
- package/dist/core/supervisor/read.d.ts.map +0 -1
- package/dist/core/supervisor/read.js +0 -4
- package/dist/core/supervisor/runner.d.ts +0 -37
- package/dist/core/supervisor/runner.d.ts.map +0 -1
- package/dist/core/supervisor/service-read.d.ts +0 -6
- package/dist/core/supervisor/service-read.d.ts.map +0 -1
- package/dist/core/supervisor/service.d.ts +0 -114
- package/dist/core/supervisor/service.d.ts.map +0 -1
- package/dist/core/supervisor/state.d.ts +0 -95
- package/dist/core/supervisor/state.d.ts.map +0 -1
- package/dist/core/workflow/harnesses.d.ts +0 -17
- package/dist/core/workflow/harnesses.d.ts.map +0 -1
- package/dist/core/workflow/harnesses.js +0 -21
- package/dist/core/workflow/journal.d.ts.map +0 -1
- package/src/commands/session.ts +0 -187
- package/src/core/harnesses/index.ts +0 -56
- package/src/core/hooks/harness/detect.ts +0 -30
- package/src/core/supervisor/index.ts +0 -89
- package/src/core/supervisor/plan-api.ts +0 -73
- package/src/core/supervisor/read.ts +0 -59
- package/src/core/workflow/harnesses.ts +0 -33
- /package/dist/core/{harnesses → adapters}/attest-projection.js +0 -0
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
import { existsSync, readFileSync } from "node:fs";
|
|
2
2
|
import { dirname, isAbsolute, resolve } from "node:path";
|
|
3
|
+
import { adapterProofInputs, createBuiltinAdapterRegistry, probeBinaryVersion, readAttestation, } from "../core/adapters/index.js";
|
|
3
4
|
import { workflowSubscriptionOnly } from "../core/config.js";
|
|
4
|
-
import {
|
|
5
|
+
import { inspectAdapterSpread } from "../core/governor/adapter-spread.js";
|
|
6
|
+
import { approveGovernorPlan, configureGovernorService, createGovernor, governorServiceLogPath, listGovernors, readGovernor, readGovernorPlan, readGovernorServiceConfig, readGovernorServiceStatus, rejectGovernorPlan, requestGovernorServiceStop, retryGovernorPlan, runGovernor, runGovernorServiceDaemon, spawnGovernorService, } from "../core/governor/index.js";
|
|
5
7
|
import { findCoordRoot } from "../core/hooks/resolve/coord-root.js";
|
|
6
8
|
import { loadPolicyFile } from "../core/policy/index.js";
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
const
|
|
10
|
-
|
|
11
|
-
.command("supervisor")
|
|
9
|
+
export function registerGovernorCommand(program, emit) {
|
|
10
|
+
const registry = createBuiltinAdapterRegistry();
|
|
11
|
+
const governor = program
|
|
12
|
+
.command("governor")
|
|
12
13
|
.description("Run a bounded specialist team over a durable-work dependency graph.");
|
|
13
|
-
|
|
14
|
+
governor
|
|
14
15
|
.command("create [root-work-id]")
|
|
15
16
|
.description("Freeze an existing-root goal or an objective-first bounded mission.")
|
|
16
17
|
.requiredOption("--team <file>", "JSON object mapping specialist ids to profiles")
|
|
@@ -22,21 +23,37 @@ export function registerSupervisorCommand(program, emit) {
|
|
|
22
23
|
.option("--max-total-attempts <n>", "Graph-wide attempt ceiling (default 100)")
|
|
23
24
|
.option("--max-agents-per-work <n>", "Child-agent ceiling per work item (default 20)")
|
|
24
25
|
.option("--agent-concurrency <n>", "Child concurrency per work item (default 4)")
|
|
25
|
-
.option("--accept-passing-proof", "Allow the
|
|
26
|
+
.option("--accept-passing-proof", "Allow the governor to explicitly accept passing proof")
|
|
26
27
|
.option("--no-resume-approved", "Stop after an approval instead of resuming its parked run")
|
|
27
28
|
.option("--retry-blocked", "Allow bounded retry of blocked work")
|
|
29
|
+
.option("--allow-single-adapter", "Freeze a team even though every specialist lands on one adapter under subscription auth")
|
|
28
30
|
.option("--replanning <file>", "Frozen planner policy and allowed workflow-template catalog")
|
|
29
31
|
.option("--mission <file>", "Frozen objective, acceptance criteria, and milestone bound")
|
|
30
|
-
.option("--json", "Emit the complete
|
|
32
|
+
.option("--json", "Emit the complete governor record as JSON")
|
|
31
33
|
.action((rootWorkId, opts) => {
|
|
32
|
-
|
|
34
|
+
withGovernorRoot(emit, (coordRoot) => {
|
|
33
35
|
const specialists = readTeamFile(opts.team);
|
|
34
36
|
for (const [id, profile] of Object.entries(specialists)) {
|
|
35
|
-
if (profile.
|
|
36
|
-
throw new Error(`specialist ${id} names unknown
|
|
37
|
+
if (profile.adapter && !registry.get(profile.adapter)) {
|
|
38
|
+
throw new Error(`specialist ${id} names unknown adapter ${JSON.stringify(profile.adapter)}`);
|
|
37
39
|
}
|
|
38
40
|
}
|
|
39
|
-
|
|
41
|
+
if (!opts.allowSingleAdapter) {
|
|
42
|
+
// Refuse a team that would put every child on one subscription seat
|
|
43
|
+
// while other adapters sit attested and idle. Checked here rather than
|
|
44
|
+
// at run time because the intent freezes on create with no amend path:
|
|
45
|
+
// catching it later means recreating the goal.
|
|
46
|
+
const spread = inspectAdapterSpread({
|
|
47
|
+
specialists,
|
|
48
|
+
defaultAdapter: "claude-code",
|
|
49
|
+
reachable: registry.ids().filter((id) => readAttestation(id) !== null),
|
|
50
|
+
subscriptionOnly: workflowSubscriptionOnly(coordRoot),
|
|
51
|
+
});
|
|
52
|
+
if (spread.concentrated) {
|
|
53
|
+
throw new Error(`refusing to freeze a single-adapter team: ${spread.reason}`);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
emitGovernor(createGovernor({
|
|
40
57
|
coordRoot,
|
|
41
58
|
rootWorkId,
|
|
42
59
|
specialists,
|
|
@@ -60,41 +77,41 @@ export function registerSupervisorCommand(program, emit) {
|
|
|
60
77
|
}), opts.json, emit, true);
|
|
61
78
|
});
|
|
62
79
|
});
|
|
63
|
-
|
|
80
|
+
governor
|
|
64
81
|
.command("list")
|
|
65
82
|
.description("List durable goals and their derived next action.")
|
|
66
|
-
.option("--json", "Emit complete
|
|
83
|
+
.option("--json", "Emit complete governor records as JSON")
|
|
67
84
|
.action((opts) => {
|
|
68
|
-
|
|
69
|
-
const records =
|
|
85
|
+
withGovernorRoot(emit, (coordRoot) => {
|
|
86
|
+
const records = listGovernors(coordRoot);
|
|
70
87
|
if (opts.json) {
|
|
71
88
|
emit.config({ format: "json" });
|
|
72
89
|
emit.data(records);
|
|
73
90
|
}
|
|
74
91
|
else if (records.length === 0) {
|
|
75
|
-
emit.text("no durable
|
|
92
|
+
emit.text("no durable governors\n");
|
|
76
93
|
}
|
|
77
94
|
else {
|
|
78
|
-
emit.text(`${records.map(
|
|
95
|
+
emit.text(`${records.map(renderGovernorRow).join("\n")}\n`);
|
|
79
96
|
}
|
|
80
97
|
});
|
|
81
98
|
});
|
|
82
|
-
|
|
99
|
+
governor
|
|
83
100
|
.command("show <goal-id>")
|
|
84
101
|
.description("Show one goal, frozen team, bounds, graph state, and next action.")
|
|
85
|
-
.option("--json", "Emit the complete
|
|
102
|
+
.option("--json", "Emit the complete governor record as JSON")
|
|
86
103
|
.action((goalId, opts) => {
|
|
87
|
-
|
|
88
|
-
|
|
104
|
+
withGovernorRoot(emit, (coordRoot) => {
|
|
105
|
+
emitGovernor(readGovernor(coordRoot, goalId), opts.json, emit, true);
|
|
89
106
|
});
|
|
90
107
|
});
|
|
91
|
-
registerPlanCommand(
|
|
92
|
-
registerServiceCommand(
|
|
93
|
-
registerRunCommand(
|
|
94
|
-
registerRunCommand(
|
|
108
|
+
registerPlanCommand(governor, emit);
|
|
109
|
+
registerServiceCommand(governor, registry, emit);
|
|
110
|
+
registerRunCommand(governor, "tick", registry, emit);
|
|
111
|
+
registerRunCommand(governor, "run", registry, emit);
|
|
95
112
|
}
|
|
96
|
-
function registerPlanCommand(
|
|
97
|
-
const plan =
|
|
113
|
+
function registerPlanCommand(governor, emit) {
|
|
114
|
+
const plan = governor
|
|
98
115
|
.command("plan")
|
|
99
116
|
.description("Inspect and resolve bounded planner proposals for a durable goal.");
|
|
100
117
|
plan
|
|
@@ -102,14 +119,14 @@ function registerPlanCommand(supervisor, emit) {
|
|
|
102
119
|
.description("List append-only replanning attempts for one goal.")
|
|
103
120
|
.option("--json", "Emit complete plan records as JSON")
|
|
104
121
|
.action((goalId, opts) => {
|
|
105
|
-
|
|
106
|
-
const plans =
|
|
122
|
+
withGovernorRoot(emit, (coordRoot) => {
|
|
123
|
+
const plans = readGovernor(coordRoot, goalId).plans;
|
|
107
124
|
if (opts.json) {
|
|
108
125
|
emit.config({ format: "json" });
|
|
109
126
|
emit.data(plans);
|
|
110
127
|
}
|
|
111
128
|
else if (plans.length === 0) {
|
|
112
|
-
emit.text(`
|
|
129
|
+
emit.text(`governor ${goalId} has no replanning attempts\n`);
|
|
113
130
|
}
|
|
114
131
|
else {
|
|
115
132
|
emit.text(`${plans.map(renderPlanRow).join("\n")}\n`);
|
|
@@ -121,8 +138,8 @@ function registerPlanCommand(supervisor, emit) {
|
|
|
121
138
|
.description("Show one planner request, schema-gated proposal, and audit events.")
|
|
122
139
|
.option("--json", "Emit the complete plan record as JSON")
|
|
123
140
|
.action((goalId, planId, opts) => {
|
|
124
|
-
|
|
125
|
-
emitPlan(
|
|
141
|
+
withGovernorRoot(emit, (coordRoot) => {
|
|
142
|
+
emitPlan(readGovernorPlan(coordRoot, goalId, planId), opts.json, emit);
|
|
126
143
|
});
|
|
127
144
|
});
|
|
128
145
|
plan
|
|
@@ -132,8 +149,8 @@ function registerPlanCommand(supervisor, emit) {
|
|
|
132
149
|
.option("--reason <text>", "Reason for approval")
|
|
133
150
|
.option("--json", "Emit the plan outcome as JSON")
|
|
134
151
|
.action((goalId, planId, opts) => {
|
|
135
|
-
|
|
136
|
-
emitPlanOutcome(
|
|
152
|
+
withGovernorRoot(emit, (coordRoot) => {
|
|
153
|
+
emitPlanOutcome(approveGovernorPlan({
|
|
137
154
|
coordRoot,
|
|
138
155
|
goalId,
|
|
139
156
|
planId,
|
|
@@ -149,8 +166,8 @@ function registerPlanCommand(supervisor, emit) {
|
|
|
149
166
|
.option("--actor <name>", "Actor recorded on the plan decision")
|
|
150
167
|
.option("--json", "Emit the plan outcome as JSON")
|
|
151
168
|
.action((goalId, planId, opts) => {
|
|
152
|
-
|
|
153
|
-
emitPlanOutcome(
|
|
169
|
+
withGovernorRoot(emit, (coordRoot) => {
|
|
170
|
+
emitPlanOutcome(rejectGovernorPlan({
|
|
154
171
|
coordRoot,
|
|
155
172
|
goalId,
|
|
156
173
|
planId,
|
|
@@ -166,8 +183,8 @@ function registerPlanCommand(supervisor, emit) {
|
|
|
166
183
|
.option("--actor <name>", "Actor recorded on the retry request")
|
|
167
184
|
.option("--json", "Emit the plan outcome as JSON")
|
|
168
185
|
.action((goalId, planId, opts) => {
|
|
169
|
-
|
|
170
|
-
emitPlanOutcome(
|
|
186
|
+
withGovernorRoot(emit, (coordRoot) => {
|
|
187
|
+
emitPlanOutcome(retryGovernorPlan({
|
|
171
188
|
coordRoot,
|
|
172
189
|
goalId,
|
|
173
190
|
planId,
|
|
@@ -177,18 +194,18 @@ function registerPlanCommand(supervisor, emit) {
|
|
|
177
194
|
});
|
|
178
195
|
});
|
|
179
196
|
}
|
|
180
|
-
function registerServiceCommand(
|
|
181
|
-
const service =
|
|
197
|
+
function registerServiceCommand(governor, registry, emit) {
|
|
198
|
+
const service = governor
|
|
182
199
|
.command("service")
|
|
183
200
|
.description("Run explicitly enrolled durable goals in a restartable background service.");
|
|
184
201
|
addServiceOptions(service
|
|
185
202
|
.command("start [goal-ids...]")
|
|
186
|
-
.description("Configure and start the detached per-repository
|
|
203
|
+
.description("Configure and start the detached per-repository governor service."))
|
|
187
204
|
.option("--json", "Emit complete service status as JSON")
|
|
188
205
|
.action(async (goalIds, opts) => {
|
|
189
|
-
await
|
|
206
|
+
await withGovernorRootAsync(emit, async (coordRoot) => {
|
|
190
207
|
prepareServiceConfig(coordRoot, goalIds, opts, registry);
|
|
191
|
-
const status = await
|
|
208
|
+
const status = await spawnGovernorService(coordRoot);
|
|
192
209
|
emitServiceStatus(status, opts.json, emit);
|
|
193
210
|
});
|
|
194
211
|
});
|
|
@@ -197,9 +214,9 @@ function registerServiceCommand(supervisor, registry, emit) {
|
|
|
197
214
|
.description("Run the persistent service loop in the foreground for a process manager."))
|
|
198
215
|
.option("--json", "Emit terminal service status as JSON")
|
|
199
216
|
.action(async (goalIds, opts) => {
|
|
200
|
-
await
|
|
217
|
+
await withGovernorRootAsync(emit, async (coordRoot) => {
|
|
201
218
|
const config = prepareServiceConfig(coordRoot, goalIds, opts, registry);
|
|
202
|
-
const status = await
|
|
219
|
+
const status = await runGovernorServiceDaemon({
|
|
203
220
|
coordRoot,
|
|
204
221
|
engine: serviceEngine(config, registry),
|
|
205
222
|
onLog: opts.json ? undefined : (line) => emit.text(`${line}\n`),
|
|
@@ -215,8 +232,8 @@ function registerServiceCommand(supervisor, registry, emit) {
|
|
|
215
232
|
.description("Show service liveness, heartbeat, enrolled goals, and durable wake state.")
|
|
216
233
|
.option("--json", "Emit complete service status as JSON")
|
|
217
234
|
.action((opts) => {
|
|
218
|
-
|
|
219
|
-
emitServiceStatus(
|
|
235
|
+
withGovernorRoot(emit, (coordRoot) => {
|
|
236
|
+
emitServiceStatus(readGovernorServiceStatus(coordRoot), opts.json, emit);
|
|
220
237
|
});
|
|
221
238
|
});
|
|
222
239
|
service
|
|
@@ -224,12 +241,12 @@ function registerServiceCommand(supervisor, registry, emit) {
|
|
|
224
241
|
.description("Request a graceful stop; an active goal tick is allowed to finish safely.")
|
|
225
242
|
.option("--json", "Emit complete service status as JSON")
|
|
226
243
|
.action(async (opts) => {
|
|
227
|
-
await
|
|
228
|
-
let status =
|
|
244
|
+
await withGovernorRootAsync(emit, async (coordRoot) => {
|
|
245
|
+
let status = requestGovernorServiceStop(coordRoot);
|
|
229
246
|
const deadline = Date.now() + 5_000;
|
|
230
247
|
while (status.running && Date.now() < deadline) {
|
|
231
248
|
await delay(50);
|
|
232
|
-
status =
|
|
249
|
+
status = readGovernorServiceStatus(coordRoot);
|
|
233
250
|
}
|
|
234
251
|
emitServiceStatus(status, opts.json, emit);
|
|
235
252
|
});
|
|
@@ -239,13 +256,13 @@ function registerServiceCommand(supervisor, registry, emit) {
|
|
|
239
256
|
.description("Show the tail of the private background-service log.")
|
|
240
257
|
.option("--lines <n>", "Number of lines to show (default 50)", "50")
|
|
241
258
|
.action((opts) => {
|
|
242
|
-
|
|
259
|
+
withGovernorRoot(emit, (coordRoot) => {
|
|
243
260
|
const lines = integer(opts.lines) ?? 50;
|
|
244
261
|
if (lines > 10_000)
|
|
245
262
|
throw new Error("service log lines must not exceed 10000");
|
|
246
|
-
const path =
|
|
263
|
+
const path = governorServiceLogPath(coordRoot);
|
|
247
264
|
if (!existsSync(path)) {
|
|
248
|
-
emit.text("no
|
|
265
|
+
emit.text("no governor service log\n");
|
|
249
266
|
return;
|
|
250
267
|
}
|
|
251
268
|
const selected = readFileSync(path, "utf8")
|
|
@@ -259,9 +276,9 @@ function registerServiceCommand(supervisor, registry, emit) {
|
|
|
259
276
|
.command("daemon", { hidden: true })
|
|
260
277
|
.description("Internal detached service entrypoint.")
|
|
261
278
|
.action(async () => {
|
|
262
|
-
await
|
|
263
|
-
const config =
|
|
264
|
-
await
|
|
279
|
+
await withGovernorRootAsync(emit, async (coordRoot) => {
|
|
280
|
+
const config = readGovernorServiceConfig(coordRoot);
|
|
281
|
+
await runGovernorServiceDaemon({
|
|
265
282
|
coordRoot,
|
|
266
283
|
engine: serviceEngine(config, registry),
|
|
267
284
|
onLog: (line) => emit.text(`${line}\n`),
|
|
@@ -275,9 +292,9 @@ function addServiceOptions(command) {
|
|
|
275
292
|
.option("--heartbeat-interval-ms <n>", "Heartbeat interval (default 2000)")
|
|
276
293
|
.option("--error-backoff-base-ms <n>", "Initial service-error backoff (default 2000)")
|
|
277
294
|
.option("--error-backoff-max-ms <n>", "Maximum service-error backoff (default 300000)")
|
|
278
|
-
.option("--
|
|
295
|
+
.option("--adapter <name>", "Fallback adapter for agent calls without a specialist")
|
|
279
296
|
.option("--cwd <dir>", "Working directory for child agents")
|
|
280
|
-
.option("--subscription-only", "Require stored
|
|
297
|
+
.option("--subscription-only", "Require stored adapter-login billing")
|
|
281
298
|
.option("--allow-api-billing", "Permit API-key override billing")
|
|
282
299
|
.option("--policy <file>", "Host policy JSON/JSONC")
|
|
283
300
|
.option("--isolation <mode>", "shared | worktree | sandbox | remote")
|
|
@@ -286,15 +303,15 @@ function addServiceOptions(command) {
|
|
|
286
303
|
function prepareServiceConfig(coordRoot, goalIds, opts, registry) {
|
|
287
304
|
if (goalIds.length === 0) {
|
|
288
305
|
if (hasServiceConfigOverrides(opts)) {
|
|
289
|
-
throw new Error("goal ids are required when changing
|
|
306
|
+
throw new Error("goal ids are required when changing governor service options");
|
|
290
307
|
}
|
|
291
|
-
return
|
|
308
|
+
return readGovernorServiceConfig(coordRoot);
|
|
292
309
|
}
|
|
293
|
-
if (opts.
|
|
294
|
-
throw new Error(`unknown
|
|
310
|
+
if (opts.adapter && !registry.get(opts.adapter)) {
|
|
311
|
+
throw new Error(`unknown adapter ${JSON.stringify(opts.adapter)}`);
|
|
295
312
|
}
|
|
296
313
|
const policy = opts.policy ? loadPolicyFile(opts.policy) : undefined;
|
|
297
|
-
return
|
|
314
|
+
return configureGovernorService({
|
|
298
315
|
coordRoot,
|
|
299
316
|
goalIds,
|
|
300
317
|
wakeIntervalMs: integer(opts.wakeIntervalMs),
|
|
@@ -302,7 +319,7 @@ function prepareServiceConfig(coordRoot, goalIds, opts, registry) {
|
|
|
302
319
|
errorBackoffBaseMs: integer(opts.errorBackoffBaseMs),
|
|
303
320
|
errorBackoffMaxMs: integer(opts.errorBackoffMaxMs),
|
|
304
321
|
engine: {
|
|
305
|
-
|
|
322
|
+
default_adapter: opts.adapter,
|
|
306
323
|
cwd: opts.cwd,
|
|
307
324
|
subscription_only: opts.subscriptionOnly === true ? true : workflowSubscriptionOnly(coordRoot),
|
|
308
325
|
allow_api_billing: opts.allowApiBilling,
|
|
@@ -317,7 +334,7 @@ function hasServiceConfigOverrides(opts) {
|
|
|
317
334
|
opts.heartbeatIntervalMs ||
|
|
318
335
|
opts.errorBackoffBaseMs ||
|
|
319
336
|
opts.errorBackoffMaxMs ||
|
|
320
|
-
opts.
|
|
337
|
+
opts.adapter ||
|
|
321
338
|
opts.cwd ||
|
|
322
339
|
opts.subscriptionOnly ||
|
|
323
340
|
opts.allowApiBilling ||
|
|
@@ -328,11 +345,11 @@ function hasServiceConfigOverrides(opts) {
|
|
|
328
345
|
function serviceEngine(config, registry) {
|
|
329
346
|
return {
|
|
330
347
|
spawners: registry.spawners(),
|
|
331
|
-
|
|
348
|
+
defaultAdapter: config.engine.default_adapter,
|
|
332
349
|
cwd: config.engine.cwd,
|
|
333
350
|
subscriptionOnly: config.engine.subscription_only,
|
|
334
351
|
allowApiBilling: config.engine.allow_api_billing,
|
|
335
|
-
...
|
|
352
|
+
...adapterProofInputs(registry.list().map((adapter) => adapter.profile), { versionProbe: probeBinaryVersion }),
|
|
336
353
|
policy: config.engine.policy,
|
|
337
354
|
approvalMode: "park",
|
|
338
355
|
approvalAddressee: config.engine.approval_addressee,
|
|
@@ -347,7 +364,7 @@ function emitServiceStatus(status, json, emit) {
|
|
|
347
364
|
return;
|
|
348
365
|
}
|
|
349
366
|
if (!status.config && !status.record) {
|
|
350
|
-
emit.text("
|
|
367
|
+
emit.text("governor service: unconfigured\n");
|
|
351
368
|
return;
|
|
352
369
|
}
|
|
353
370
|
const state = status.running
|
|
@@ -356,7 +373,7 @@ function emitServiceStatus(status, json, emit) {
|
|
|
356
373
|
? "stale"
|
|
357
374
|
: "stopped";
|
|
358
375
|
const lines = [
|
|
359
|
-
`
|
|
376
|
+
`governor service: ${state}`,
|
|
360
377
|
`goals: ${status.config?.goal_ids.join(", ") || "none"}`,
|
|
361
378
|
];
|
|
362
379
|
if (status.record) {
|
|
@@ -376,27 +393,27 @@ function emitServiceStatus(status, json, emit) {
|
|
|
376
393
|
}
|
|
377
394
|
emit.text(`${lines.join("\n")}\n`);
|
|
378
395
|
}
|
|
379
|
-
function registerRunCommand(
|
|
380
|
-
|
|
396
|
+
function registerRunCommand(governor, mode, registry, emit) {
|
|
397
|
+
governor
|
|
381
398
|
.command(`${mode} <goal-id>`)
|
|
382
399
|
.description(mode === "tick"
|
|
383
400
|
? "Perform at most one bounded scheduling cycle."
|
|
384
401
|
: "Run bounded cycles until success, attention, no progress, or budget exhaustion.")
|
|
385
|
-
.option("--
|
|
402
|
+
.option("--adapter <name>", "Fallback adapter for agent calls without a specialist")
|
|
386
403
|
.option("--cwd <dir>", "Working directory for child agents")
|
|
387
|
-
.option("--subscription-only", "Require stored
|
|
404
|
+
.option("--subscription-only", "Require stored adapter-login billing")
|
|
388
405
|
.option("--allow-api-billing", "Permit API-key override billing")
|
|
389
406
|
.option("--policy <file>", "Host policy JSON/JSONC")
|
|
390
407
|
.option("--isolation <mode>", "shared | worktree | sandbox | remote")
|
|
391
408
|
.option("--approval-to <address>", "Address durable ASK requests")
|
|
392
|
-
.option("--actor <name>", "Actor recorded on
|
|
409
|
+
.option("--actor <name>", "Actor recorded on governor work decisions")
|
|
393
410
|
.option("--json", "Emit the complete run report as JSON")
|
|
394
411
|
.action(async (goalId, opts) => {
|
|
395
|
-
await
|
|
396
|
-
if (opts.
|
|
397
|
-
throw new Error(`unknown
|
|
412
|
+
await withGovernorRootAsync(emit, async (coordRoot) => {
|
|
413
|
+
if (opts.adapter && !registry.get(opts.adapter)) {
|
|
414
|
+
throw new Error(`unknown adapter ${JSON.stringify(opts.adapter)}`);
|
|
398
415
|
}
|
|
399
|
-
const report = await
|
|
416
|
+
const report = await runGovernor({
|
|
400
417
|
coordRoot,
|
|
401
418
|
goalId,
|
|
402
419
|
mode,
|
|
@@ -404,11 +421,11 @@ function registerRunCommand(supervisor, mode, registry, emit) {
|
|
|
404
421
|
onLog: opts.json ? undefined : (line) => emit.text(`${line}\n`),
|
|
405
422
|
engine: {
|
|
406
423
|
spawners: registry.spawners(),
|
|
407
|
-
|
|
424
|
+
defaultAdapter: opts.adapter,
|
|
408
425
|
cwd: opts.cwd,
|
|
409
426
|
subscriptionOnly: opts.subscriptionOnly === true ? true : workflowSubscriptionOnly(coordRoot),
|
|
410
427
|
allowApiBilling: opts.allowApiBilling,
|
|
411
|
-
...
|
|
428
|
+
...adapterProofInputs(registry.list().map((adapter) => adapter.profile), { versionProbe: probeBinaryVersion }),
|
|
412
429
|
policy: opts.policy ? loadPolicyFile(opts.policy) : undefined,
|
|
413
430
|
approvalMode: "park",
|
|
414
431
|
approvalAddressee: opts.approvalTo,
|
|
@@ -416,7 +433,7 @@ function registerRunCommand(supervisor, mode, registry, emit) {
|
|
|
416
433
|
networkAccess: "enabled",
|
|
417
434
|
},
|
|
418
435
|
});
|
|
419
|
-
|
|
436
|
+
emitGovernorReport(report, opts.json, emit);
|
|
420
437
|
});
|
|
421
438
|
});
|
|
422
439
|
}
|
|
@@ -427,10 +444,10 @@ function readTeamFile(path) {
|
|
|
427
444
|
value = JSON.parse(readFileSync(absolute, "utf8"));
|
|
428
445
|
}
|
|
429
446
|
catch (error) {
|
|
430
|
-
throw new Error(`cannot read
|
|
447
|
+
throw new Error(`cannot read governor team at ${absolute}: ${error.message}`);
|
|
431
448
|
}
|
|
432
449
|
if (!value || typeof value !== "object" || Array.isArray(value)) {
|
|
433
|
-
throw new Error("
|
|
450
|
+
throw new Error("governor team must be a JSON object keyed by specialist id");
|
|
434
451
|
}
|
|
435
452
|
return value;
|
|
436
453
|
}
|
|
@@ -441,28 +458,28 @@ function readReplanningFile(path) {
|
|
|
441
458
|
value = JSON.parse(readFileSync(absolute, "utf8"));
|
|
442
459
|
}
|
|
443
460
|
catch (error) {
|
|
444
|
-
throw new Error(`cannot read
|
|
461
|
+
throw new Error(`cannot read governor replanning policy at ${absolute}: ${error.message}`);
|
|
445
462
|
}
|
|
446
463
|
if (!value || typeof value !== "object" || Array.isArray(value)) {
|
|
447
|
-
throw new Error("
|
|
464
|
+
throw new Error("governor replanning policy must be a JSON object");
|
|
448
465
|
}
|
|
449
466
|
const config = value;
|
|
450
467
|
if (typeof config.planner_specialist !== "string") {
|
|
451
|
-
throw new Error("
|
|
468
|
+
throw new Error("governor replanning planner_specialist must be a string");
|
|
452
469
|
}
|
|
453
470
|
if (!config.templates ||
|
|
454
471
|
typeof config.templates !== "object" ||
|
|
455
472
|
Array.isArray(config.templates)) {
|
|
456
|
-
throw new Error("
|
|
473
|
+
throw new Error("governor replanning templates must be an object");
|
|
457
474
|
}
|
|
458
475
|
const base = dirname(absolute);
|
|
459
476
|
const templates = Object.fromEntries(Object.entries(config.templates).map(([id, raw]) => {
|
|
460
477
|
if (!raw || typeof raw !== "object" || Array.isArray(raw)) {
|
|
461
|
-
throw new Error(`
|
|
478
|
+
throw new Error(`governor replanning template ${id} must be an object`);
|
|
462
479
|
}
|
|
463
480
|
const template = raw;
|
|
464
481
|
if (typeof template.workflow !== "string") {
|
|
465
|
-
throw new Error(`
|
|
482
|
+
throw new Error(`governor replanning template ${id} workflow must be a string`);
|
|
466
483
|
}
|
|
467
484
|
return [
|
|
468
485
|
id,
|
|
@@ -490,12 +507,12 @@ function readReplanningReview(raw) {
|
|
|
490
507
|
if (raw === undefined)
|
|
491
508
|
return undefined;
|
|
492
509
|
if (!raw || typeof raw !== "object" || Array.isArray(raw)) {
|
|
493
|
-
throw new Error("
|
|
510
|
+
throw new Error("governor replanning review must be a JSON object");
|
|
494
511
|
}
|
|
495
512
|
const review = raw;
|
|
496
513
|
if (!Array.isArray(review.reviewer_specialists) ||
|
|
497
514
|
review.reviewer_specialists.some((item) => typeof item !== "string")) {
|
|
498
|
-
throw new Error("
|
|
515
|
+
throw new Error("governor replanning review reviewer_specialists must be an array of strings");
|
|
499
516
|
}
|
|
500
517
|
return {
|
|
501
518
|
reviewerSpecialists: review.reviewer_specialists,
|
|
@@ -510,18 +527,18 @@ function readMissionFile(path) {
|
|
|
510
527
|
value = JSON.parse(readFileSync(absolute, "utf8"));
|
|
511
528
|
}
|
|
512
529
|
catch (error) {
|
|
513
|
-
throw new Error(`cannot read
|
|
530
|
+
throw new Error(`cannot read governor mission at ${absolute}: ${error.message}`);
|
|
514
531
|
}
|
|
515
532
|
if (!value || typeof value !== "object" || Array.isArray(value)) {
|
|
516
|
-
throw new Error("
|
|
533
|
+
throw new Error("governor mission must be a JSON object");
|
|
517
534
|
}
|
|
518
535
|
const config = value;
|
|
519
536
|
if (typeof config.objective !== "string") {
|
|
520
|
-
throw new Error("
|
|
537
|
+
throw new Error("governor mission objective must be a string");
|
|
521
538
|
}
|
|
522
539
|
if (!Array.isArray(config.acceptance) ||
|
|
523
540
|
config.acceptance.some((item) => typeof item !== "string")) {
|
|
524
|
-
throw new Error("
|
|
541
|
+
throw new Error("governor mission acceptance must be an array of strings");
|
|
525
542
|
}
|
|
526
543
|
return {
|
|
527
544
|
objective: config.objective,
|
|
@@ -529,14 +546,14 @@ function readMissionFile(path) {
|
|
|
529
546
|
maxMilestones: jsonInteger(config.max_milestones, "mission max_milestones"),
|
|
530
547
|
};
|
|
531
548
|
}
|
|
532
|
-
function
|
|
549
|
+
function emitGovernor(record, json, emit, detail = false) {
|
|
533
550
|
if (json) {
|
|
534
551
|
emit.config({ format: "json" });
|
|
535
552
|
emit.data(record);
|
|
536
553
|
return;
|
|
537
554
|
}
|
|
538
555
|
if (!detail) {
|
|
539
|
-
emit.text(`${
|
|
556
|
+
emit.text(`${renderGovernorRow(record)}\n`);
|
|
540
557
|
return;
|
|
541
558
|
}
|
|
542
559
|
const projection = record.projection;
|
|
@@ -565,6 +582,9 @@ function emitSupervisor(record, json, emit, detail = false) {
|
|
|
565
582
|
if (projection.attention_plan_id) {
|
|
566
583
|
lines.push(`attention plan: ${projection.attention_plan_id}`);
|
|
567
584
|
}
|
|
585
|
+
if (projection.replan_consumption && projection.replan_consumption.planner_no_proposal > 0) {
|
|
586
|
+
lines.push(`replan consumption: planner no-proposal=${projection.replan_consumption.planner_no_proposal}, reviewer rejection=${projection.replan_consumption.reviewer_rejection}`);
|
|
587
|
+
}
|
|
568
588
|
}
|
|
569
589
|
if (record.intent.mission) {
|
|
570
590
|
lines.push(`mission: ${record.intent.mission.objective}`);
|
|
@@ -576,21 +596,26 @@ function emitSupervisor(record, json, emit, detail = false) {
|
|
|
576
596
|
}
|
|
577
597
|
emit.text(`${lines.join("\n")}\n`);
|
|
578
598
|
}
|
|
579
|
-
function
|
|
599
|
+
function emitGovernorReport(report, json, emit) {
|
|
580
600
|
if (json) {
|
|
581
601
|
emit.config({ format: "json" });
|
|
582
602
|
emit.data(report);
|
|
583
603
|
return;
|
|
584
604
|
}
|
|
585
|
-
emit.text(`
|
|
605
|
+
emit.text(`governor ${report.goal_id}: ${report.stop_reason}\n` +
|
|
586
606
|
`reason: ${report.reason}\n` +
|
|
587
607
|
`cycles: ${report.cycles}; dispatches: ${report.dispatches}; acceptances: ${report.acceptances}\n` +
|
|
588
608
|
`replans: ${report.replans}\n` +
|
|
589
609
|
`state: ${report.projection.state}; next: ${report.projection.next_action}\n`);
|
|
590
610
|
}
|
|
591
|
-
function
|
|
611
|
+
function renderGovernorRow(record) {
|
|
592
612
|
const projection = record.projection;
|
|
593
|
-
|
|
613
|
+
const row = `${record.intent.id} ${projection.state.padEnd(20)} ${projection.attempts_used}/${record.intent.limits.max_total_attempts} ${projection.next_action.padEnd(18)} ${record.intent.title}`;
|
|
614
|
+
const consumption = projection.replan_consumption;
|
|
615
|
+
if (consumption && consumption.planner_no_proposal > 0) {
|
|
616
|
+
return `${row} [planner no-proposal x${consumption.planner_no_proposal}]`;
|
|
617
|
+
}
|
|
618
|
+
return row;
|
|
594
619
|
}
|
|
595
620
|
function integer(value) {
|
|
596
621
|
if (value === undefined)
|
|
@@ -660,7 +685,7 @@ function emitPlanOutcome(outcome, json, emit) {
|
|
|
660
685
|
emit.data(outcome);
|
|
661
686
|
return;
|
|
662
687
|
}
|
|
663
|
-
emit.text(`
|
|
688
|
+
emit.text(`governor plan ${outcome.plan_id}: ${outcome.status}\n` +
|
|
664
689
|
`${outcome.reason ? `reason: ${outcome.reason}\n` : ""}` +
|
|
665
690
|
`${outcome.root_work_id ? `root: ${outcome.root_work_id}\n` : ""}`);
|
|
666
691
|
}
|
|
@@ -671,7 +696,7 @@ function renderPlanRow(plan) {
|
|
|
671
696
|
function delay(ms) {
|
|
672
697
|
return new Promise((resolveDelay) => setTimeout(resolveDelay, ms));
|
|
673
698
|
}
|
|
674
|
-
function
|
|
699
|
+
function withGovernorRoot(emit, fn) {
|
|
675
700
|
const coordRoot = findCoordRoot();
|
|
676
701
|
if (!coordRoot) {
|
|
677
702
|
emit.error({
|
|
@@ -685,11 +710,11 @@ function withSupervisorRoot(emit, fn) {
|
|
|
685
710
|
fn(coordRoot);
|
|
686
711
|
}
|
|
687
712
|
catch (error) {
|
|
688
|
-
emit.error({ code: "
|
|
713
|
+
emit.error({ code: "governor_failed", message: error.message });
|
|
689
714
|
emit.setExitCode(1);
|
|
690
715
|
}
|
|
691
716
|
}
|
|
692
|
-
async function
|
|
717
|
+
async function withGovernorRootAsync(emit, fn) {
|
|
693
718
|
const coordRoot = findCoordRoot();
|
|
694
719
|
if (!coordRoot) {
|
|
695
720
|
emit.error({
|
|
@@ -703,7 +728,7 @@ async function withSupervisorRootAsync(emit, fn) {
|
|
|
703
728
|
await fn(coordRoot);
|
|
704
729
|
}
|
|
705
730
|
catch (error) {
|
|
706
|
-
emit.error({ code: "
|
|
731
|
+
emit.error({ code: "governor_failed", message: error.message });
|
|
707
732
|
emit.setExitCode(1);
|
|
708
733
|
}
|
|
709
734
|
}
|