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
|
@@ -2,43 +2,46 @@ import { existsSync, readFileSync } from "node:fs";
|
|
|
2
2
|
import { dirname, isAbsolute, resolve } from "node:path";
|
|
3
3
|
import type { Command } from "commander";
|
|
4
4
|
import type { EmitContext } from "../commander.ts";
|
|
5
|
-
import { workflowSubscriptionOnly } from "../core/config.ts";
|
|
6
5
|
import {
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
adapterProofInputs,
|
|
7
|
+
createBuiltinAdapterRegistry,
|
|
9
8
|
probeBinaryVersion,
|
|
10
|
-
|
|
9
|
+
readAttestation,
|
|
10
|
+
} from "../core/adapters/index.ts";
|
|
11
|
+
import { workflowSubscriptionOnly } from "../core/config.ts";
|
|
12
|
+
import { inspectAdapterSpread } from "../core/governor/adapter-spread.ts";
|
|
13
|
+
import {
|
|
14
|
+
approveGovernorPlan,
|
|
15
|
+
type CreateGovernorMissionInput,
|
|
16
|
+
type CreateGovernorReplanningInput,
|
|
17
|
+
configureGovernorService,
|
|
18
|
+
createGovernor,
|
|
19
|
+
type GovernorPlanOutcome,
|
|
20
|
+
type GovernorPlanRecord,
|
|
21
|
+
type GovernorRecord,
|
|
22
|
+
type GovernorRunReport,
|
|
23
|
+
type GovernorServiceConfig,
|
|
24
|
+
type GovernorServiceStatus,
|
|
25
|
+
governorServiceLogPath,
|
|
26
|
+
listGovernors,
|
|
27
|
+
readGovernor,
|
|
28
|
+
readGovernorPlan,
|
|
29
|
+
readGovernorServiceConfig,
|
|
30
|
+
readGovernorServiceStatus,
|
|
31
|
+
rejectGovernorPlan,
|
|
32
|
+
requestGovernorServiceStop,
|
|
33
|
+
retryGovernorPlan,
|
|
34
|
+
runGovernor,
|
|
35
|
+
runGovernorServiceDaemon,
|
|
36
|
+
spawnGovernorService,
|
|
37
|
+
} from "../core/governor/index.ts";
|
|
11
38
|
import { findCoordRoot } from "../core/hooks/resolve/coord-root.ts";
|
|
12
39
|
import type { PolicyIsolation } from "../core/policy/index.ts";
|
|
13
40
|
import { loadPolicyFile } from "../core/policy/index.ts";
|
|
14
|
-
import {
|
|
15
|
-
approveSupervisorPlan,
|
|
16
|
-
type CreateSupervisorMissionInput,
|
|
17
|
-
type CreateSupervisorReplanningInput,
|
|
18
|
-
configureSupervisorService,
|
|
19
|
-
createSupervisor,
|
|
20
|
-
listSupervisors,
|
|
21
|
-
readSupervisor,
|
|
22
|
-
readSupervisorPlan,
|
|
23
|
-
readSupervisorServiceConfig,
|
|
24
|
-
readSupervisorServiceStatus,
|
|
25
|
-
rejectSupervisorPlan,
|
|
26
|
-
requestSupervisorServiceStop,
|
|
27
|
-
retrySupervisorPlan,
|
|
28
|
-
runSupervisor,
|
|
29
|
-
runSupervisorServiceDaemon,
|
|
30
|
-
type SupervisorPlanOutcome,
|
|
31
|
-
type SupervisorPlanRecord,
|
|
32
|
-
type SupervisorRecord,
|
|
33
|
-
type SupervisorRunReport,
|
|
34
|
-
type SupervisorServiceConfig,
|
|
35
|
-
type SupervisorServiceStatus,
|
|
36
|
-
spawnSupervisorService,
|
|
37
|
-
supervisorServiceLogPath,
|
|
38
|
-
} from "../core/supervisor/index.ts";
|
|
39
41
|
import type { WorkflowSpecialistProfile } from "../core/workflow/index.ts";
|
|
40
42
|
|
|
41
43
|
interface CreateOpts {
|
|
44
|
+
allowSingleAdapter?: boolean;
|
|
42
45
|
team: string;
|
|
43
46
|
id?: string;
|
|
44
47
|
title?: string;
|
|
@@ -57,7 +60,7 @@ interface CreateOpts {
|
|
|
57
60
|
}
|
|
58
61
|
|
|
59
62
|
interface RunOpts {
|
|
60
|
-
|
|
63
|
+
adapter?: string;
|
|
61
64
|
cwd?: string;
|
|
62
65
|
subscriptionOnly?: boolean;
|
|
63
66
|
allowApiBilling?: boolean;
|
|
@@ -75,13 +78,13 @@ interface ServiceOpts extends RunOpts {
|
|
|
75
78
|
errorBackoffMaxMs?: string;
|
|
76
79
|
}
|
|
77
80
|
|
|
78
|
-
export function
|
|
79
|
-
const registry =
|
|
80
|
-
const
|
|
81
|
-
.command("
|
|
81
|
+
export function registerGovernorCommand(program: Command, emit: EmitContext): void {
|
|
82
|
+
const registry = createBuiltinAdapterRegistry();
|
|
83
|
+
const governor = program
|
|
84
|
+
.command("governor")
|
|
82
85
|
.description("Run a bounded specialist team over a durable-work dependency graph.");
|
|
83
86
|
|
|
84
|
-
|
|
87
|
+
governor
|
|
85
88
|
.command("create [root-work-id]")
|
|
86
89
|
.description("Freeze an existing-root goal or an objective-first bounded mission.")
|
|
87
90
|
.requiredOption("--team <file>", "JSON object mapping specialist ids to profiles")
|
|
@@ -93,24 +96,43 @@ export function registerSupervisorCommand(program: Command, emit: EmitContext):
|
|
|
93
96
|
.option("--max-total-attempts <n>", "Graph-wide attempt ceiling (default 100)")
|
|
94
97
|
.option("--max-agents-per-work <n>", "Child-agent ceiling per work item (default 20)")
|
|
95
98
|
.option("--agent-concurrency <n>", "Child concurrency per work item (default 4)")
|
|
96
|
-
.option("--accept-passing-proof", "Allow the
|
|
99
|
+
.option("--accept-passing-proof", "Allow the governor to explicitly accept passing proof")
|
|
97
100
|
.option("--no-resume-approved", "Stop after an approval instead of resuming its parked run")
|
|
98
101
|
.option("--retry-blocked", "Allow bounded retry of blocked work")
|
|
102
|
+
.option(
|
|
103
|
+
"--allow-single-adapter",
|
|
104
|
+
"Freeze a team even though every specialist lands on one adapter under subscription auth",
|
|
105
|
+
)
|
|
99
106
|
.option("--replanning <file>", "Frozen planner policy and allowed workflow-template catalog")
|
|
100
107
|
.option("--mission <file>", "Frozen objective, acceptance criteria, and milestone bound")
|
|
101
|
-
.option("--json", "Emit the complete
|
|
108
|
+
.option("--json", "Emit the complete governor record as JSON")
|
|
102
109
|
.action((rootWorkId: string | undefined, opts: CreateOpts) => {
|
|
103
|
-
|
|
110
|
+
withGovernorRoot(emit, (coordRoot) => {
|
|
104
111
|
const specialists = readTeamFile(opts.team);
|
|
105
112
|
for (const [id, profile] of Object.entries(specialists)) {
|
|
106
|
-
if (profile.
|
|
113
|
+
if (profile.adapter && !registry.get(profile.adapter)) {
|
|
107
114
|
throw new Error(
|
|
108
|
-
`specialist ${id} names unknown
|
|
115
|
+
`specialist ${id} names unknown adapter ${JSON.stringify(profile.adapter)}`,
|
|
109
116
|
);
|
|
110
117
|
}
|
|
111
118
|
}
|
|
112
|
-
|
|
113
|
-
|
|
119
|
+
if (!opts.allowSingleAdapter) {
|
|
120
|
+
// Refuse a team that would put every child on one subscription seat
|
|
121
|
+
// while other adapters sit attested and idle. Checked here rather than
|
|
122
|
+
// at run time because the intent freezes on create with no amend path:
|
|
123
|
+
// catching it later means recreating the goal.
|
|
124
|
+
const spread = inspectAdapterSpread({
|
|
125
|
+
specialists,
|
|
126
|
+
defaultAdapter: "claude-code",
|
|
127
|
+
reachable: registry.ids().filter((id) => readAttestation(id) !== null),
|
|
128
|
+
subscriptionOnly: workflowSubscriptionOnly(coordRoot),
|
|
129
|
+
});
|
|
130
|
+
if (spread.concentrated) {
|
|
131
|
+
throw new Error(`refusing to freeze a single-adapter team: ${spread.reason}`);
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
emitGovernor(
|
|
135
|
+
createGovernor({
|
|
114
136
|
coordRoot,
|
|
115
137
|
rootWorkId,
|
|
116
138
|
specialists,
|
|
@@ -139,42 +161,42 @@ export function registerSupervisorCommand(program: Command, emit: EmitContext):
|
|
|
139
161
|
});
|
|
140
162
|
});
|
|
141
163
|
|
|
142
|
-
|
|
164
|
+
governor
|
|
143
165
|
.command("list")
|
|
144
166
|
.description("List durable goals and their derived next action.")
|
|
145
|
-
.option("--json", "Emit complete
|
|
167
|
+
.option("--json", "Emit complete governor records as JSON")
|
|
146
168
|
.action((opts: { json?: boolean }) => {
|
|
147
|
-
|
|
148
|
-
const records =
|
|
169
|
+
withGovernorRoot(emit, (coordRoot) => {
|
|
170
|
+
const records = listGovernors(coordRoot);
|
|
149
171
|
if (opts.json) {
|
|
150
172
|
emit.config({ format: "json" });
|
|
151
173
|
emit.data(records);
|
|
152
174
|
} else if (records.length === 0) {
|
|
153
|
-
emit.text("no durable
|
|
175
|
+
emit.text("no durable governors\n");
|
|
154
176
|
} else {
|
|
155
|
-
emit.text(`${records.map(
|
|
177
|
+
emit.text(`${records.map(renderGovernorRow).join("\n")}\n`);
|
|
156
178
|
}
|
|
157
179
|
});
|
|
158
180
|
});
|
|
159
181
|
|
|
160
|
-
|
|
182
|
+
governor
|
|
161
183
|
.command("show <goal-id>")
|
|
162
184
|
.description("Show one goal, frozen team, bounds, graph state, and next action.")
|
|
163
|
-
.option("--json", "Emit the complete
|
|
185
|
+
.option("--json", "Emit the complete governor record as JSON")
|
|
164
186
|
.action((goalId: string, opts: { json?: boolean }) => {
|
|
165
|
-
|
|
166
|
-
|
|
187
|
+
withGovernorRoot(emit, (coordRoot) => {
|
|
188
|
+
emitGovernor(readGovernor(coordRoot, goalId), opts.json, emit, true);
|
|
167
189
|
});
|
|
168
190
|
});
|
|
169
191
|
|
|
170
|
-
registerPlanCommand(
|
|
171
|
-
registerServiceCommand(
|
|
172
|
-
registerRunCommand(
|
|
173
|
-
registerRunCommand(
|
|
192
|
+
registerPlanCommand(governor, emit);
|
|
193
|
+
registerServiceCommand(governor, registry, emit);
|
|
194
|
+
registerRunCommand(governor, "tick", registry, emit);
|
|
195
|
+
registerRunCommand(governor, "run", registry, emit);
|
|
174
196
|
}
|
|
175
197
|
|
|
176
|
-
function registerPlanCommand(
|
|
177
|
-
const plan =
|
|
198
|
+
function registerPlanCommand(governor: Command, emit: EmitContext): void {
|
|
199
|
+
const plan = governor
|
|
178
200
|
.command("plan")
|
|
179
201
|
.description("Inspect and resolve bounded planner proposals for a durable goal.");
|
|
180
202
|
|
|
@@ -183,13 +205,13 @@ function registerPlanCommand(supervisor: Command, emit: EmitContext): void {
|
|
|
183
205
|
.description("List append-only replanning attempts for one goal.")
|
|
184
206
|
.option("--json", "Emit complete plan records as JSON")
|
|
185
207
|
.action((goalId: string, opts: { json?: boolean }) => {
|
|
186
|
-
|
|
187
|
-
const plans =
|
|
208
|
+
withGovernorRoot(emit, (coordRoot) => {
|
|
209
|
+
const plans = readGovernor(coordRoot, goalId).plans;
|
|
188
210
|
if (opts.json) {
|
|
189
211
|
emit.config({ format: "json" });
|
|
190
212
|
emit.data(plans);
|
|
191
213
|
} else if (plans.length === 0) {
|
|
192
|
-
emit.text(`
|
|
214
|
+
emit.text(`governor ${goalId} has no replanning attempts\n`);
|
|
193
215
|
} else {
|
|
194
216
|
emit.text(`${plans.map(renderPlanRow).join("\n")}\n`);
|
|
195
217
|
}
|
|
@@ -201,8 +223,8 @@ function registerPlanCommand(supervisor: Command, emit: EmitContext): void {
|
|
|
201
223
|
.description("Show one planner request, schema-gated proposal, and audit events.")
|
|
202
224
|
.option("--json", "Emit the complete plan record as JSON")
|
|
203
225
|
.action((goalId: string, planId: string, opts: { json?: boolean }) => {
|
|
204
|
-
|
|
205
|
-
emitPlan(
|
|
226
|
+
withGovernorRoot(emit, (coordRoot) => {
|
|
227
|
+
emitPlan(readGovernorPlan(coordRoot, goalId, planId), opts.json, emit);
|
|
206
228
|
});
|
|
207
229
|
});
|
|
208
230
|
|
|
@@ -218,9 +240,9 @@ function registerPlanCommand(supervisor: Command, emit: EmitContext): void {
|
|
|
218
240
|
planId: string,
|
|
219
241
|
opts: { actor?: string; reason?: string; json?: boolean },
|
|
220
242
|
) => {
|
|
221
|
-
|
|
243
|
+
withGovernorRoot(emit, (coordRoot) => {
|
|
222
244
|
emitPlanOutcome(
|
|
223
|
-
|
|
245
|
+
approveGovernorPlan({
|
|
224
246
|
coordRoot,
|
|
225
247
|
goalId,
|
|
226
248
|
planId,
|
|
@@ -246,9 +268,9 @@ function registerPlanCommand(supervisor: Command, emit: EmitContext): void {
|
|
|
246
268
|
planId: string,
|
|
247
269
|
opts: { actor?: string; reason: string; json?: boolean },
|
|
248
270
|
) => {
|
|
249
|
-
|
|
271
|
+
withGovernorRoot(emit, (coordRoot) => {
|
|
250
272
|
emitPlanOutcome(
|
|
251
|
-
|
|
273
|
+
rejectGovernorPlan({
|
|
252
274
|
coordRoot,
|
|
253
275
|
goalId,
|
|
254
276
|
planId,
|
|
@@ -274,9 +296,9 @@ function registerPlanCommand(supervisor: Command, emit: EmitContext): void {
|
|
|
274
296
|
planId: string,
|
|
275
297
|
opts: { actor?: string; reason: string; json?: boolean },
|
|
276
298
|
) => {
|
|
277
|
-
|
|
299
|
+
withGovernorRoot(emit, (coordRoot) => {
|
|
278
300
|
emitPlanOutcome(
|
|
279
|
-
|
|
301
|
+
retryGovernorPlan({
|
|
280
302
|
coordRoot,
|
|
281
303
|
goalId,
|
|
282
304
|
planId,
|
|
@@ -292,24 +314,24 @@ function registerPlanCommand(supervisor: Command, emit: EmitContext): void {
|
|
|
292
314
|
}
|
|
293
315
|
|
|
294
316
|
function registerServiceCommand(
|
|
295
|
-
|
|
296
|
-
registry: ReturnType<typeof
|
|
317
|
+
governor: Command,
|
|
318
|
+
registry: ReturnType<typeof createBuiltinAdapterRegistry>,
|
|
297
319
|
emit: EmitContext,
|
|
298
320
|
): void {
|
|
299
|
-
const service =
|
|
321
|
+
const service = governor
|
|
300
322
|
.command("service")
|
|
301
323
|
.description("Run explicitly enrolled durable goals in a restartable background service.");
|
|
302
324
|
|
|
303
325
|
addServiceOptions(
|
|
304
326
|
service
|
|
305
327
|
.command("start [goal-ids...]")
|
|
306
|
-
.description("Configure and start the detached per-repository
|
|
328
|
+
.description("Configure and start the detached per-repository governor service."),
|
|
307
329
|
)
|
|
308
330
|
.option("--json", "Emit complete service status as JSON")
|
|
309
331
|
.action(async (goalIds: string[], opts: ServiceOpts) => {
|
|
310
|
-
await
|
|
332
|
+
await withGovernorRootAsync(emit, async (coordRoot) => {
|
|
311
333
|
prepareServiceConfig(coordRoot, goalIds, opts, registry);
|
|
312
|
-
const status = await
|
|
334
|
+
const status = await spawnGovernorService(coordRoot);
|
|
313
335
|
emitServiceStatus(status, opts.json, emit);
|
|
314
336
|
});
|
|
315
337
|
});
|
|
@@ -321,9 +343,9 @@ function registerServiceCommand(
|
|
|
321
343
|
)
|
|
322
344
|
.option("--json", "Emit terminal service status as JSON")
|
|
323
345
|
.action(async (goalIds: string[], opts: ServiceOpts) => {
|
|
324
|
-
await
|
|
346
|
+
await withGovernorRootAsync(emit, async (coordRoot) => {
|
|
325
347
|
const config = prepareServiceConfig(coordRoot, goalIds, opts, registry);
|
|
326
|
-
const status = await
|
|
348
|
+
const status = await runGovernorServiceDaemon({
|
|
327
349
|
coordRoot,
|
|
328
350
|
engine: serviceEngine(config, registry),
|
|
329
351
|
onLog: opts.json ? undefined : (line) => emit.text(`${line}\n`),
|
|
@@ -340,8 +362,8 @@ function registerServiceCommand(
|
|
|
340
362
|
.description("Show service liveness, heartbeat, enrolled goals, and durable wake state.")
|
|
341
363
|
.option("--json", "Emit complete service status as JSON")
|
|
342
364
|
.action((opts: { json?: boolean }) => {
|
|
343
|
-
|
|
344
|
-
emitServiceStatus(
|
|
365
|
+
withGovernorRoot(emit, (coordRoot) => {
|
|
366
|
+
emitServiceStatus(readGovernorServiceStatus(coordRoot), opts.json, emit);
|
|
345
367
|
});
|
|
346
368
|
});
|
|
347
369
|
|
|
@@ -350,12 +372,12 @@ function registerServiceCommand(
|
|
|
350
372
|
.description("Request a graceful stop; an active goal tick is allowed to finish safely.")
|
|
351
373
|
.option("--json", "Emit complete service status as JSON")
|
|
352
374
|
.action(async (opts: { json?: boolean }) => {
|
|
353
|
-
await
|
|
354
|
-
let status =
|
|
375
|
+
await withGovernorRootAsync(emit, async (coordRoot) => {
|
|
376
|
+
let status = requestGovernorServiceStop(coordRoot);
|
|
355
377
|
const deadline = Date.now() + 5_000;
|
|
356
378
|
while (status.running && Date.now() < deadline) {
|
|
357
379
|
await delay(50);
|
|
358
|
-
status =
|
|
380
|
+
status = readGovernorServiceStatus(coordRoot);
|
|
359
381
|
}
|
|
360
382
|
emitServiceStatus(status, opts.json, emit);
|
|
361
383
|
});
|
|
@@ -366,12 +388,12 @@ function registerServiceCommand(
|
|
|
366
388
|
.description("Show the tail of the private background-service log.")
|
|
367
389
|
.option("--lines <n>", "Number of lines to show (default 50)", "50")
|
|
368
390
|
.action((opts: { lines: string }) => {
|
|
369
|
-
|
|
391
|
+
withGovernorRoot(emit, (coordRoot) => {
|
|
370
392
|
const lines = integer(opts.lines) ?? 50;
|
|
371
393
|
if (lines > 10_000) throw new Error("service log lines must not exceed 10000");
|
|
372
|
-
const path =
|
|
394
|
+
const path = governorServiceLogPath(coordRoot);
|
|
373
395
|
if (!existsSync(path)) {
|
|
374
|
-
emit.text("no
|
|
396
|
+
emit.text("no governor service log\n");
|
|
375
397
|
return;
|
|
376
398
|
}
|
|
377
399
|
const selected = readFileSync(path, "utf8")
|
|
@@ -386,9 +408,9 @@ function registerServiceCommand(
|
|
|
386
408
|
.command("daemon", { hidden: true })
|
|
387
409
|
.description("Internal detached service entrypoint.")
|
|
388
410
|
.action(async () => {
|
|
389
|
-
await
|
|
390
|
-
const config =
|
|
391
|
-
await
|
|
411
|
+
await withGovernorRootAsync(emit, async (coordRoot) => {
|
|
412
|
+
const config = readGovernorServiceConfig(coordRoot);
|
|
413
|
+
await runGovernorServiceDaemon({
|
|
392
414
|
coordRoot,
|
|
393
415
|
engine: serviceEngine(config, registry),
|
|
394
416
|
onLog: (line) => emit.text(`${line}\n`),
|
|
@@ -403,9 +425,9 @@ function addServiceOptions(command: Command): Command {
|
|
|
403
425
|
.option("--heartbeat-interval-ms <n>", "Heartbeat interval (default 2000)")
|
|
404
426
|
.option("--error-backoff-base-ms <n>", "Initial service-error backoff (default 2000)")
|
|
405
427
|
.option("--error-backoff-max-ms <n>", "Maximum service-error backoff (default 300000)")
|
|
406
|
-
.option("--
|
|
428
|
+
.option("--adapter <name>", "Fallback adapter for agent calls without a specialist")
|
|
407
429
|
.option("--cwd <dir>", "Working directory for child agents")
|
|
408
|
-
.option("--subscription-only", "Require stored
|
|
430
|
+
.option("--subscription-only", "Require stored adapter-login billing")
|
|
409
431
|
.option("--allow-api-billing", "Permit API-key override billing")
|
|
410
432
|
.option("--policy <file>", "Host policy JSON/JSONC")
|
|
411
433
|
.option("--isolation <mode>", "shared | worktree | sandbox | remote")
|
|
@@ -416,19 +438,19 @@ function prepareServiceConfig(
|
|
|
416
438
|
coordRoot: string,
|
|
417
439
|
goalIds: string[],
|
|
418
440
|
opts: ServiceOpts,
|
|
419
|
-
registry: ReturnType<typeof
|
|
420
|
-
):
|
|
441
|
+
registry: ReturnType<typeof createBuiltinAdapterRegistry>,
|
|
442
|
+
): GovernorServiceConfig {
|
|
421
443
|
if (goalIds.length === 0) {
|
|
422
444
|
if (hasServiceConfigOverrides(opts)) {
|
|
423
|
-
throw new Error("goal ids are required when changing
|
|
445
|
+
throw new Error("goal ids are required when changing governor service options");
|
|
424
446
|
}
|
|
425
|
-
return
|
|
447
|
+
return readGovernorServiceConfig(coordRoot);
|
|
426
448
|
}
|
|
427
|
-
if (opts.
|
|
428
|
-
throw new Error(`unknown
|
|
449
|
+
if (opts.adapter && !registry.get(opts.adapter)) {
|
|
450
|
+
throw new Error(`unknown adapter ${JSON.stringify(opts.adapter)}`);
|
|
429
451
|
}
|
|
430
452
|
const policy = opts.policy ? loadPolicyFile(opts.policy) : undefined;
|
|
431
|
-
return
|
|
453
|
+
return configureGovernorService({
|
|
432
454
|
coordRoot,
|
|
433
455
|
goalIds,
|
|
434
456
|
wakeIntervalMs: integer(opts.wakeIntervalMs),
|
|
@@ -436,7 +458,7 @@ function prepareServiceConfig(
|
|
|
436
458
|
errorBackoffBaseMs: integer(opts.errorBackoffBaseMs),
|
|
437
459
|
errorBackoffMaxMs: integer(opts.errorBackoffMaxMs),
|
|
438
460
|
engine: {
|
|
439
|
-
|
|
461
|
+
default_adapter: opts.adapter,
|
|
440
462
|
cwd: opts.cwd,
|
|
441
463
|
subscription_only:
|
|
442
464
|
opts.subscriptionOnly === true ? true : workflowSubscriptionOnly(coordRoot),
|
|
@@ -454,7 +476,7 @@ function hasServiceConfigOverrides(opts: ServiceOpts): boolean {
|
|
|
454
476
|
opts.heartbeatIntervalMs ||
|
|
455
477
|
opts.errorBackoffBaseMs ||
|
|
456
478
|
opts.errorBackoffMaxMs ||
|
|
457
|
-
opts.
|
|
479
|
+
opts.adapter ||
|
|
458
480
|
opts.cwd ||
|
|
459
481
|
opts.subscriptionOnly ||
|
|
460
482
|
opts.allowApiBilling ||
|
|
@@ -465,16 +487,16 @@ function hasServiceConfigOverrides(opts: ServiceOpts): boolean {
|
|
|
465
487
|
}
|
|
466
488
|
|
|
467
489
|
function serviceEngine(
|
|
468
|
-
config:
|
|
469
|
-
registry: ReturnType<typeof
|
|
490
|
+
config: GovernorServiceConfig,
|
|
491
|
+
registry: ReturnType<typeof createBuiltinAdapterRegistry>,
|
|
470
492
|
) {
|
|
471
493
|
return {
|
|
472
494
|
spawners: registry.spawners(),
|
|
473
|
-
|
|
495
|
+
defaultAdapter: config.engine.default_adapter,
|
|
474
496
|
cwd: config.engine.cwd,
|
|
475
497
|
subscriptionOnly: config.engine.subscription_only,
|
|
476
498
|
allowApiBilling: config.engine.allow_api_billing,
|
|
477
|
-
...
|
|
499
|
+
...adapterProofInputs(
|
|
478
500
|
registry.list().map((adapter) => adapter.profile),
|
|
479
501
|
{ versionProbe: probeBinaryVersion },
|
|
480
502
|
),
|
|
@@ -487,7 +509,7 @@ function serviceEngine(
|
|
|
487
509
|
}
|
|
488
510
|
|
|
489
511
|
function emitServiceStatus(
|
|
490
|
-
status:
|
|
512
|
+
status: GovernorServiceStatus,
|
|
491
513
|
json: boolean | undefined,
|
|
492
514
|
emit: EmitContext,
|
|
493
515
|
): void {
|
|
@@ -497,7 +519,7 @@ function emitServiceStatus(
|
|
|
497
519
|
return;
|
|
498
520
|
}
|
|
499
521
|
if (!status.config && !status.record) {
|
|
500
|
-
emit.text("
|
|
522
|
+
emit.text("governor service: unconfigured\n");
|
|
501
523
|
return;
|
|
502
524
|
}
|
|
503
525
|
const state = status.running
|
|
@@ -506,7 +528,7 @@ function emitServiceStatus(
|
|
|
506
528
|
? "stale"
|
|
507
529
|
: "stopped";
|
|
508
530
|
const lines = [
|
|
509
|
-
`
|
|
531
|
+
`governor service: ${state}`,
|
|
510
532
|
`goals: ${status.config?.goal_ids.join(", ") || "none"}`,
|
|
511
533
|
];
|
|
512
534
|
if (status.record) {
|
|
@@ -527,33 +549,33 @@ function emitServiceStatus(
|
|
|
527
549
|
}
|
|
528
550
|
|
|
529
551
|
function registerRunCommand(
|
|
530
|
-
|
|
552
|
+
governor: Command,
|
|
531
553
|
mode: "tick" | "run",
|
|
532
|
-
registry: ReturnType<typeof
|
|
554
|
+
registry: ReturnType<typeof createBuiltinAdapterRegistry>,
|
|
533
555
|
emit: EmitContext,
|
|
534
556
|
): void {
|
|
535
|
-
|
|
557
|
+
governor
|
|
536
558
|
.command(`${mode} <goal-id>`)
|
|
537
559
|
.description(
|
|
538
560
|
mode === "tick"
|
|
539
561
|
? "Perform at most one bounded scheduling cycle."
|
|
540
562
|
: "Run bounded cycles until success, attention, no progress, or budget exhaustion.",
|
|
541
563
|
)
|
|
542
|
-
.option("--
|
|
564
|
+
.option("--adapter <name>", "Fallback adapter for agent calls without a specialist")
|
|
543
565
|
.option("--cwd <dir>", "Working directory for child agents")
|
|
544
|
-
.option("--subscription-only", "Require stored
|
|
566
|
+
.option("--subscription-only", "Require stored adapter-login billing")
|
|
545
567
|
.option("--allow-api-billing", "Permit API-key override billing")
|
|
546
568
|
.option("--policy <file>", "Host policy JSON/JSONC")
|
|
547
569
|
.option("--isolation <mode>", "shared | worktree | sandbox | remote")
|
|
548
570
|
.option("--approval-to <address>", "Address durable ASK requests")
|
|
549
|
-
.option("--actor <name>", "Actor recorded on
|
|
571
|
+
.option("--actor <name>", "Actor recorded on governor work decisions")
|
|
550
572
|
.option("--json", "Emit the complete run report as JSON")
|
|
551
573
|
.action(async (goalId: string, opts: RunOpts) => {
|
|
552
|
-
await
|
|
553
|
-
if (opts.
|
|
554
|
-
throw new Error(`unknown
|
|
574
|
+
await withGovernorRootAsync(emit, async (coordRoot) => {
|
|
575
|
+
if (opts.adapter && !registry.get(opts.adapter)) {
|
|
576
|
+
throw new Error(`unknown adapter ${JSON.stringify(opts.adapter)}`);
|
|
555
577
|
}
|
|
556
|
-
const report = await
|
|
578
|
+
const report = await runGovernor({
|
|
557
579
|
coordRoot,
|
|
558
580
|
goalId,
|
|
559
581
|
mode,
|
|
@@ -561,12 +583,12 @@ function registerRunCommand(
|
|
|
561
583
|
onLog: opts.json ? undefined : (line) => emit.text(`${line}\n`),
|
|
562
584
|
engine: {
|
|
563
585
|
spawners: registry.spawners(),
|
|
564
|
-
|
|
586
|
+
defaultAdapter: opts.adapter,
|
|
565
587
|
cwd: opts.cwd,
|
|
566
588
|
subscriptionOnly:
|
|
567
589
|
opts.subscriptionOnly === true ? true : workflowSubscriptionOnly(coordRoot),
|
|
568
590
|
allowApiBilling: opts.allowApiBilling,
|
|
569
|
-
...
|
|
591
|
+
...adapterProofInputs(
|
|
570
592
|
registry.list().map((adapter) => adapter.profile),
|
|
571
593
|
{ versionProbe: probeBinaryVersion },
|
|
572
594
|
),
|
|
@@ -577,7 +599,7 @@ function registerRunCommand(
|
|
|
577
599
|
networkAccess: "enabled",
|
|
578
600
|
},
|
|
579
601
|
});
|
|
580
|
-
|
|
602
|
+
emitGovernorReport(report, opts.json, emit);
|
|
581
603
|
});
|
|
582
604
|
});
|
|
583
605
|
}
|
|
@@ -588,47 +610,47 @@ function readTeamFile(path: string): Record<string, WorkflowSpecialistProfile> {
|
|
|
588
610
|
try {
|
|
589
611
|
value = JSON.parse(readFileSync(absolute, "utf8"));
|
|
590
612
|
} catch (error) {
|
|
591
|
-
throw new Error(`cannot read
|
|
613
|
+
throw new Error(`cannot read governor team at ${absolute}: ${(error as Error).message}`);
|
|
592
614
|
}
|
|
593
615
|
if (!value || typeof value !== "object" || Array.isArray(value)) {
|
|
594
|
-
throw new Error("
|
|
616
|
+
throw new Error("governor team must be a JSON object keyed by specialist id");
|
|
595
617
|
}
|
|
596
618
|
return value as Record<string, WorkflowSpecialistProfile>;
|
|
597
619
|
}
|
|
598
620
|
|
|
599
|
-
function readReplanningFile(path: string):
|
|
621
|
+
function readReplanningFile(path: string): CreateGovernorReplanningInput {
|
|
600
622
|
const absolute = resolve(path);
|
|
601
623
|
let value: unknown;
|
|
602
624
|
try {
|
|
603
625
|
value = JSON.parse(readFileSync(absolute, "utf8"));
|
|
604
626
|
} catch (error) {
|
|
605
627
|
throw new Error(
|
|
606
|
-
`cannot read
|
|
628
|
+
`cannot read governor replanning policy at ${absolute}: ${(error as Error).message}`,
|
|
607
629
|
);
|
|
608
630
|
}
|
|
609
631
|
if (!value || typeof value !== "object" || Array.isArray(value)) {
|
|
610
|
-
throw new Error("
|
|
632
|
+
throw new Error("governor replanning policy must be a JSON object");
|
|
611
633
|
}
|
|
612
634
|
const config = value as Record<string, unknown>;
|
|
613
635
|
if (typeof config.planner_specialist !== "string") {
|
|
614
|
-
throw new Error("
|
|
636
|
+
throw new Error("governor replanning planner_specialist must be a string");
|
|
615
637
|
}
|
|
616
638
|
if (
|
|
617
639
|
!config.templates ||
|
|
618
640
|
typeof config.templates !== "object" ||
|
|
619
641
|
Array.isArray(config.templates)
|
|
620
642
|
) {
|
|
621
|
-
throw new Error("
|
|
643
|
+
throw new Error("governor replanning templates must be an object");
|
|
622
644
|
}
|
|
623
645
|
const base = dirname(absolute);
|
|
624
646
|
const templates = Object.fromEntries(
|
|
625
647
|
Object.entries(config.templates as Record<string, unknown>).map(([id, raw]) => {
|
|
626
648
|
if (!raw || typeof raw !== "object" || Array.isArray(raw)) {
|
|
627
|
-
throw new Error(`
|
|
649
|
+
throw new Error(`governor replanning template ${id} must be an object`);
|
|
628
650
|
}
|
|
629
651
|
const template = raw as Record<string, unknown>;
|
|
630
652
|
if (typeof template.workflow !== "string") {
|
|
631
|
-
throw new Error(`
|
|
653
|
+
throw new Error(`governor replanning template ${id} workflow must be a string`);
|
|
632
654
|
}
|
|
633
655
|
return [
|
|
634
656
|
id,
|
|
@@ -657,19 +679,17 @@ function readReplanningFile(path: string): CreateSupervisorReplanningInput {
|
|
|
657
679
|
};
|
|
658
680
|
}
|
|
659
681
|
|
|
660
|
-
function readReplanningReview(raw: unknown):
|
|
682
|
+
function readReplanningReview(raw: unknown): CreateGovernorReplanningInput["review"] | undefined {
|
|
661
683
|
if (raw === undefined) return undefined;
|
|
662
684
|
if (!raw || typeof raw !== "object" || Array.isArray(raw)) {
|
|
663
|
-
throw new Error("
|
|
685
|
+
throw new Error("governor replanning review must be a JSON object");
|
|
664
686
|
}
|
|
665
687
|
const review = raw as Record<string, unknown>;
|
|
666
688
|
if (
|
|
667
689
|
!Array.isArray(review.reviewer_specialists) ||
|
|
668
690
|
review.reviewer_specialists.some((item) => typeof item !== "string")
|
|
669
691
|
) {
|
|
670
|
-
throw new Error(
|
|
671
|
-
"supervisor replanning review reviewer_specialists must be an array of strings",
|
|
672
|
-
);
|
|
692
|
+
throw new Error("governor replanning review reviewer_specialists must be an array of strings");
|
|
673
693
|
}
|
|
674
694
|
return {
|
|
675
695
|
reviewerSpecialists: review.reviewer_specialists as string[],
|
|
@@ -679,26 +699,26 @@ function readReplanningReview(raw: unknown): CreateSupervisorReplanningInput["re
|
|
|
679
699
|
};
|
|
680
700
|
}
|
|
681
701
|
|
|
682
|
-
function readMissionFile(path: string):
|
|
702
|
+
function readMissionFile(path: string): CreateGovernorMissionInput {
|
|
683
703
|
const absolute = resolve(path);
|
|
684
704
|
let value: unknown;
|
|
685
705
|
try {
|
|
686
706
|
value = JSON.parse(readFileSync(absolute, "utf8"));
|
|
687
707
|
} catch (error) {
|
|
688
|
-
throw new Error(`cannot read
|
|
708
|
+
throw new Error(`cannot read governor mission at ${absolute}: ${(error as Error).message}`);
|
|
689
709
|
}
|
|
690
710
|
if (!value || typeof value !== "object" || Array.isArray(value)) {
|
|
691
|
-
throw new Error("
|
|
711
|
+
throw new Error("governor mission must be a JSON object");
|
|
692
712
|
}
|
|
693
713
|
const config = value as Record<string, unknown>;
|
|
694
714
|
if (typeof config.objective !== "string") {
|
|
695
|
-
throw new Error("
|
|
715
|
+
throw new Error("governor mission objective must be a string");
|
|
696
716
|
}
|
|
697
717
|
if (
|
|
698
718
|
!Array.isArray(config.acceptance) ||
|
|
699
719
|
config.acceptance.some((item) => typeof item !== "string")
|
|
700
720
|
) {
|
|
701
|
-
throw new Error("
|
|
721
|
+
throw new Error("governor mission acceptance must be an array of strings");
|
|
702
722
|
}
|
|
703
723
|
return {
|
|
704
724
|
objective: config.objective,
|
|
@@ -707,8 +727,8 @@ function readMissionFile(path: string): CreateSupervisorMissionInput {
|
|
|
707
727
|
};
|
|
708
728
|
}
|
|
709
729
|
|
|
710
|
-
function
|
|
711
|
-
record:
|
|
730
|
+
function emitGovernor(
|
|
731
|
+
record: GovernorRecord,
|
|
712
732
|
json: boolean | undefined,
|
|
713
733
|
emit: EmitContext,
|
|
714
734
|
detail = false,
|
|
@@ -719,7 +739,7 @@ function emitSupervisor(
|
|
|
719
739
|
return;
|
|
720
740
|
}
|
|
721
741
|
if (!detail) {
|
|
722
|
-
emit.text(`${
|
|
742
|
+
emit.text(`${renderGovernorRow(record)}\n`);
|
|
723
743
|
return;
|
|
724
744
|
}
|
|
725
745
|
const projection = record.projection;
|
|
@@ -751,6 +771,11 @@ function emitSupervisor(
|
|
|
751
771
|
if (projection.attention_plan_id) {
|
|
752
772
|
lines.push(`attention plan: ${projection.attention_plan_id}`);
|
|
753
773
|
}
|
|
774
|
+
if (projection.replan_consumption && projection.replan_consumption.planner_no_proposal > 0) {
|
|
775
|
+
lines.push(
|
|
776
|
+
`replan consumption: planner no-proposal=${projection.replan_consumption.planner_no_proposal}, reviewer rejection=${projection.replan_consumption.reviewer_rejection}`,
|
|
777
|
+
);
|
|
778
|
+
}
|
|
754
779
|
}
|
|
755
780
|
if (record.intent.mission) {
|
|
756
781
|
lines.push(`mission: ${record.intent.mission.objective}`);
|
|
@@ -765,8 +790,8 @@ function emitSupervisor(
|
|
|
765
790
|
emit.text(`${lines.join("\n")}\n`);
|
|
766
791
|
}
|
|
767
792
|
|
|
768
|
-
function
|
|
769
|
-
report:
|
|
793
|
+
function emitGovernorReport(
|
|
794
|
+
report: GovernorRunReport,
|
|
770
795
|
json: boolean | undefined,
|
|
771
796
|
emit: EmitContext,
|
|
772
797
|
): void {
|
|
@@ -776,7 +801,7 @@ function emitSupervisorReport(
|
|
|
776
801
|
return;
|
|
777
802
|
}
|
|
778
803
|
emit.text(
|
|
779
|
-
`
|
|
804
|
+
`governor ${report.goal_id}: ${report.stop_reason}\n` +
|
|
780
805
|
`reason: ${report.reason}\n` +
|
|
781
806
|
`cycles: ${report.cycles}; dispatches: ${report.dispatches}; acceptances: ${report.acceptances}\n` +
|
|
782
807
|
`replans: ${report.replans}\n` +
|
|
@@ -784,9 +809,14 @@ function emitSupervisorReport(
|
|
|
784
809
|
);
|
|
785
810
|
}
|
|
786
811
|
|
|
787
|
-
function
|
|
812
|
+
function renderGovernorRow(record: GovernorRecord): string {
|
|
788
813
|
const projection = record.projection;
|
|
789
|
-
|
|
814
|
+
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}`;
|
|
815
|
+
const consumption = projection.replan_consumption;
|
|
816
|
+
if (consumption && consumption.planner_no_proposal > 0) {
|
|
817
|
+
return `${row} [planner no-proposal x${consumption.planner_no_proposal}]`;
|
|
818
|
+
}
|
|
819
|
+
return row;
|
|
790
820
|
}
|
|
791
821
|
|
|
792
822
|
function integer(value: string | undefined): number | undefined {
|
|
@@ -818,7 +848,7 @@ function jsonBoolean(value: unknown, field: string): boolean | undefined {
|
|
|
818
848
|
return value;
|
|
819
849
|
}
|
|
820
850
|
|
|
821
|
-
function emitPlan(plan:
|
|
851
|
+
function emitPlan(plan: GovernorPlanRecord, json: boolean | undefined, emit: EmitContext): void {
|
|
822
852
|
if (json) {
|
|
823
853
|
emit.config({ format: "json" });
|
|
824
854
|
emit.data(plan);
|
|
@@ -852,7 +882,7 @@ function emitPlan(plan: SupervisorPlanRecord, json: boolean | undefined, emit: E
|
|
|
852
882
|
}
|
|
853
883
|
|
|
854
884
|
function emitPlanOutcome(
|
|
855
|
-
outcome:
|
|
885
|
+
outcome: GovernorPlanOutcome,
|
|
856
886
|
json: boolean | undefined,
|
|
857
887
|
emit: EmitContext,
|
|
858
888
|
): void {
|
|
@@ -862,13 +892,13 @@ function emitPlanOutcome(
|
|
|
862
892
|
return;
|
|
863
893
|
}
|
|
864
894
|
emit.text(
|
|
865
|
-
`
|
|
895
|
+
`governor plan ${outcome.plan_id}: ${outcome.status}\n` +
|
|
866
896
|
`${outcome.reason ? `reason: ${outcome.reason}\n` : ""}` +
|
|
867
897
|
`${outcome.root_work_id ? `root: ${outcome.root_work_id}\n` : ""}`,
|
|
868
898
|
);
|
|
869
899
|
}
|
|
870
900
|
|
|
871
|
-
function renderPlanRow(plan:
|
|
901
|
+
function renderPlanRow(plan: GovernorPlanRecord): string {
|
|
872
902
|
const review = plan.review ? ` review:${plan.review.status}` : "";
|
|
873
903
|
return `${plan.request.id} ${plan.status.padEnd(18)} ${plan.request.prior_root_work_id}${review}`;
|
|
874
904
|
}
|
|
@@ -877,7 +907,7 @@ function delay(ms: number): Promise<void> {
|
|
|
877
907
|
return new Promise((resolveDelay) => setTimeout(resolveDelay, ms));
|
|
878
908
|
}
|
|
879
909
|
|
|
880
|
-
function
|
|
910
|
+
function withGovernorRoot(emit: EmitContext, fn: (coordRoot: string) => void): void {
|
|
881
911
|
const coordRoot = findCoordRoot();
|
|
882
912
|
if (!coordRoot) {
|
|
883
913
|
emit.error({
|
|
@@ -890,12 +920,12 @@ function withSupervisorRoot(emit: EmitContext, fn: (coordRoot: string) => void):
|
|
|
890
920
|
try {
|
|
891
921
|
fn(coordRoot);
|
|
892
922
|
} catch (error) {
|
|
893
|
-
emit.error({ code: "
|
|
923
|
+
emit.error({ code: "governor_failed", message: (error as Error).message });
|
|
894
924
|
emit.setExitCode(1);
|
|
895
925
|
}
|
|
896
926
|
}
|
|
897
927
|
|
|
898
|
-
async function
|
|
928
|
+
async function withGovernorRootAsync(
|
|
899
929
|
emit: EmitContext,
|
|
900
930
|
fn: (coordRoot: string) => Promise<void>,
|
|
901
931
|
): Promise<void> {
|
|
@@ -911,7 +941,7 @@ async function withSupervisorRootAsync(
|
|
|
911
941
|
try {
|
|
912
942
|
await fn(coordRoot);
|
|
913
943
|
} catch (error) {
|
|
914
|
-
emit.error({ code: "
|
|
944
|
+
emit.error({ code: "governor_failed", message: (error as Error).message });
|
|
915
945
|
emit.setExitCode(1);
|
|
916
946
|
}
|
|
917
947
|
}
|