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
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
export {
|
|
2
|
+
readGovernorPlan,
|
|
3
|
+
readGovernorPlanReviewReceipt,
|
|
4
|
+
readGovernorPlans,
|
|
5
|
+
} from "./plan-read.ts";
|
|
6
|
+
export {
|
|
7
|
+
GOVERNOR_PLAN_SCHEMA_VERSION,
|
|
8
|
+
type GovernorPlanEvent,
|
|
9
|
+
type GovernorPlanEventType,
|
|
10
|
+
type GovernorPlanHistory,
|
|
11
|
+
type GovernorPlanMilestone,
|
|
12
|
+
type GovernorPlanOutcome,
|
|
13
|
+
type GovernorPlanProposal,
|
|
14
|
+
type GovernorPlanRecord,
|
|
15
|
+
type GovernorPlanRequest,
|
|
16
|
+
type GovernorPlanReviewFinding,
|
|
17
|
+
type GovernorPlanReviewReceipt,
|
|
18
|
+
type GovernorPlanReviewReviewer,
|
|
19
|
+
type GovernorPlanReviewRound,
|
|
20
|
+
type GovernorPlanReviewStatus,
|
|
21
|
+
type GovernorPlanReviewSummary,
|
|
22
|
+
type GovernorPlanReviewVerdict,
|
|
23
|
+
type GovernorPlanStatus,
|
|
24
|
+
type GovernorPlanTemplate,
|
|
25
|
+
type GovernorPlanWorkSpec,
|
|
26
|
+
type GovernorReplanningPolicy,
|
|
27
|
+
MAX_GOVERNOR_PLAN_REVIEWERS,
|
|
28
|
+
MAX_GOVERNOR_PLAN_REVISION_ROUNDS,
|
|
29
|
+
} from "./plan-types.ts";
|
|
30
|
+
export type {
|
|
31
|
+
GovernorServiceConfig,
|
|
32
|
+
GovernorServiceGoalRuntime,
|
|
33
|
+
GovernorServiceGoalState,
|
|
34
|
+
GovernorServiceProcessState,
|
|
35
|
+
GovernorServiceRuntime,
|
|
36
|
+
GovernorServiceStatus,
|
|
37
|
+
GovernorServiceStatusRecord,
|
|
38
|
+
} from "./service.ts";
|
|
39
|
+
export {
|
|
40
|
+
governorServiceLogPath,
|
|
41
|
+
readGovernorServiceConfig,
|
|
42
|
+
readGovernorServiceRuntime,
|
|
43
|
+
readGovernorServiceStatus,
|
|
44
|
+
} from "./service-read.ts";
|
|
45
|
+
export {
|
|
46
|
+
assertGovernorId,
|
|
47
|
+
collectGovernorWork,
|
|
48
|
+
GOVERNOR_INTENT_SCHEMA_VERSION,
|
|
49
|
+
type GovernorAutomationPolicy,
|
|
50
|
+
type GovernorIntent,
|
|
51
|
+
type GovernorLimits,
|
|
52
|
+
type GovernorMission,
|
|
53
|
+
type GovernorNextAction,
|
|
54
|
+
type GovernorProjection,
|
|
55
|
+
type GovernorRecord,
|
|
56
|
+
type GovernorState,
|
|
57
|
+
listGovernors,
|
|
58
|
+
readGovernor,
|
|
59
|
+
} from "./state.ts";
|
|
@@ -6,16 +6,16 @@ import {
|
|
|
6
6
|
runWorkItem,
|
|
7
7
|
type WorkRecord,
|
|
8
8
|
} from "../work/index.ts";
|
|
9
|
-
import type {
|
|
10
|
-
import {
|
|
9
|
+
import type { GovernorPlanOutcome } from "./plan-types.ts";
|
|
10
|
+
import { runGovernorPlanner } from "./planning.ts";
|
|
11
11
|
import {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
type
|
|
15
|
-
|
|
12
|
+
acquireGovernorLease,
|
|
13
|
+
type GovernorProjection,
|
|
14
|
+
type GovernorRecord,
|
|
15
|
+
readGovernorIgnoringLease,
|
|
16
16
|
} from "./state.ts";
|
|
17
17
|
|
|
18
|
-
export type
|
|
18
|
+
export type GovernorStopReason =
|
|
19
19
|
| "succeeded"
|
|
20
20
|
| "awaiting_attention"
|
|
21
21
|
| "blocked"
|
|
@@ -23,7 +23,7 @@ export type SupervisorStopReason =
|
|
|
23
23
|
| "no_progress"
|
|
24
24
|
| "tick_complete";
|
|
25
25
|
|
|
26
|
-
export interface
|
|
26
|
+
export interface GovernorDispatchOutcome {
|
|
27
27
|
work_id: string;
|
|
28
28
|
action: "run" | "resume" | "retry";
|
|
29
29
|
status: "completed" | "parked" | "failed";
|
|
@@ -31,10 +31,10 @@ export interface SupervisorDispatchOutcome {
|
|
|
31
31
|
error?: string;
|
|
32
32
|
}
|
|
33
33
|
|
|
34
|
-
export interface
|
|
34
|
+
export interface GovernorRunReport {
|
|
35
35
|
goal_id: string;
|
|
36
36
|
mode: "tick" | "run";
|
|
37
|
-
stop_reason:
|
|
37
|
+
stop_reason: GovernorStopReason;
|
|
38
38
|
reason: string;
|
|
39
39
|
started_at: string;
|
|
40
40
|
ended_at: string;
|
|
@@ -43,12 +43,12 @@ export interface SupervisorRunReport {
|
|
|
43
43
|
dispatches: number;
|
|
44
44
|
acceptances: number;
|
|
45
45
|
replans: number;
|
|
46
|
-
outcomes:
|
|
47
|
-
plan_outcomes:
|
|
48
|
-
projection:
|
|
46
|
+
outcomes: GovernorDispatchOutcome[];
|
|
47
|
+
plan_outcomes: GovernorPlanOutcome[];
|
|
48
|
+
projection: GovernorProjection;
|
|
49
49
|
}
|
|
50
50
|
|
|
51
|
-
export interface
|
|
51
|
+
export interface RunGovernorInput {
|
|
52
52
|
coordRoot: string;
|
|
53
53
|
goalId: string;
|
|
54
54
|
mode?: "tick" | "run";
|
|
@@ -63,22 +63,22 @@ interface Candidate {
|
|
|
63
63
|
consumesAttempt: boolean;
|
|
64
64
|
}
|
|
65
65
|
|
|
66
|
-
export async function
|
|
66
|
+
export async function runGovernor(input: RunGovernorInput): Promise<GovernorRunReport> {
|
|
67
67
|
const coordRoot = resolve(input.coordRoot);
|
|
68
68
|
const mode = input.mode ?? "run";
|
|
69
|
-
const actor = input.actor?.trim() || `
|
|
69
|
+
const actor = input.actor?.trim() || `governor:${input.goalId}`;
|
|
70
70
|
const log = input.onLog ?? (() => undefined);
|
|
71
71
|
const startedAt = new Date().toISOString();
|
|
72
72
|
const startedMs = Date.now();
|
|
73
|
-
const release =
|
|
73
|
+
const release = acquireGovernorLease(coordRoot, input.goalId);
|
|
74
74
|
let cycles = 0;
|
|
75
75
|
let dispatches = 0;
|
|
76
76
|
let acceptances = 0;
|
|
77
77
|
let replans = 0;
|
|
78
|
-
const outcomes:
|
|
79
|
-
const planOutcomes:
|
|
78
|
+
const outcomes: GovernorDispatchOutcome[] = [];
|
|
79
|
+
const planOutcomes: GovernorPlanOutcome[] = [];
|
|
80
80
|
try {
|
|
81
|
-
const initial =
|
|
81
|
+
const initial = readGovernorIgnoringLease(coordRoot, input.goalId);
|
|
82
82
|
const cycleLimit = mode === "tick" ? 1 : initial.intent.limits.max_cycles;
|
|
83
83
|
const deadline = startedMs + initial.intent.limits.max_runtime_ms;
|
|
84
84
|
while (cycles < cycleLimit) {
|
|
@@ -92,7 +92,7 @@ export async function runSupervisor(input: RunSupervisorInput): Promise<Supervis
|
|
|
92
92
|
return report("succeeded", record.projection.reason, record);
|
|
93
93
|
}
|
|
94
94
|
if (Date.now() >= deadline) {
|
|
95
|
-
return report("budget_exhausted", "
|
|
95
|
+
return report("budget_exhausted", "governor wall-time limit reached", record);
|
|
96
96
|
}
|
|
97
97
|
|
|
98
98
|
const before = graphFingerprint(record);
|
|
@@ -105,7 +105,7 @@ export async function runSupervisor(input: RunSupervisorInput): Promise<Supervis
|
|
|
105
105
|
log(
|
|
106
106
|
`[${record.intent.title}] ${record.projection.next_action} at graph generation ${record.projection.plan_generation}`,
|
|
107
107
|
);
|
|
108
|
-
const plan = await
|
|
108
|
+
const plan = await runGovernorPlanner({
|
|
109
109
|
coordRoot,
|
|
110
110
|
record,
|
|
111
111
|
engine: input.engine,
|
|
@@ -135,7 +135,7 @@ export async function runSupervisor(input: RunSupervisorInput): Promise<Supervis
|
|
|
135
135
|
if (work.projection.state !== "in_review") continue;
|
|
136
136
|
acceptWorkItem(coordRoot, work.intent.id, {
|
|
137
137
|
actor,
|
|
138
|
-
reason: "passing proof accepted by frozen
|
|
138
|
+
reason: "passing proof accepted by frozen governor policy",
|
|
139
139
|
});
|
|
140
140
|
acceptances++;
|
|
141
141
|
changed = true;
|
|
@@ -175,7 +175,7 @@ export async function runSupervisor(input: RunSupervisorInput): Promise<Supervis
|
|
|
175
175
|
action: candidate.action,
|
|
176
176
|
status: "completed",
|
|
177
177
|
run_id: result.runId,
|
|
178
|
-
} satisfies
|
|
178
|
+
} satisfies GovernorDispatchOutcome;
|
|
179
179
|
} catch (error) {
|
|
180
180
|
const latest = reconcileWorkItem(coordRoot, candidate.record.intent.id, actor);
|
|
181
181
|
return {
|
|
@@ -184,7 +184,7 @@ export async function runSupervisor(input: RunSupervisorInput): Promise<Supervis
|
|
|
184
184
|
status: latest.projection.state === "awaiting_approval" ? "parked" : "failed",
|
|
185
185
|
run_id: latest.projection.latest_run_id,
|
|
186
186
|
error: boundedError((error as Error).message),
|
|
187
|
-
} satisfies
|
|
187
|
+
} satisfies GovernorDispatchOutcome;
|
|
188
188
|
}
|
|
189
189
|
}),
|
|
190
190
|
);
|
|
@@ -202,12 +202,12 @@ export async function runSupervisor(input: RunSupervisorInput): Promise<Supervis
|
|
|
202
202
|
before === after ? "no_progress" : "tick_complete",
|
|
203
203
|
before === after
|
|
204
204
|
? "the tick found no legal progress action"
|
|
205
|
-
: "one bounded
|
|
205
|
+
: "one bounded governor cycle completed",
|
|
206
206
|
record,
|
|
207
207
|
);
|
|
208
208
|
}
|
|
209
209
|
if (Date.now() >= deadline) {
|
|
210
|
-
return report("budget_exhausted", "
|
|
210
|
+
return report("budget_exhausted", "governor wall-time limit reached", record);
|
|
211
211
|
}
|
|
212
212
|
if (record.projection.state === "budget_exhausted") {
|
|
213
213
|
return report("budget_exhausted", record.projection.reason, record);
|
|
@@ -219,20 +219,20 @@ export async function runSupervisor(input: RunSupervisorInput): Promise<Supervis
|
|
|
219
219
|
return report(stopForProjection(record.projection), record.projection.reason, record);
|
|
220
220
|
}
|
|
221
221
|
if (before === after) {
|
|
222
|
-
return report("no_progress", "a
|
|
222
|
+
return report("no_progress", "a governor cycle produced no durable state change", record);
|
|
223
223
|
}
|
|
224
224
|
}
|
|
225
225
|
const final = refreshGraph(coordRoot, input.goalId, actor);
|
|
226
|
-
return report("budget_exhausted", `
|
|
226
|
+
return report("budget_exhausted", `governor cycle limit reached (${cycleLimit})`, final);
|
|
227
227
|
} finally {
|
|
228
228
|
release();
|
|
229
229
|
}
|
|
230
230
|
|
|
231
231
|
function report(
|
|
232
|
-
stopReason:
|
|
232
|
+
stopReason: GovernorStopReason,
|
|
233
233
|
reason: string,
|
|
234
|
-
record:
|
|
235
|
-
):
|
|
234
|
+
record: GovernorRecord,
|
|
235
|
+
): GovernorRunReport {
|
|
236
236
|
const endedAt = new Date().toISOString();
|
|
237
237
|
return {
|
|
238
238
|
goal_id: input.goalId,
|
|
@@ -253,13 +253,13 @@ export async function runSupervisor(input: RunSupervisorInput): Promise<Supervis
|
|
|
253
253
|
}
|
|
254
254
|
}
|
|
255
255
|
|
|
256
|
-
function refreshGraph(coordRoot: string, goalId: string, actor: string):
|
|
257
|
-
const before =
|
|
256
|
+
function refreshGraph(coordRoot: string, goalId: string, actor: string): GovernorRecord {
|
|
257
|
+
const before = readGovernorIgnoringLease(coordRoot, goalId);
|
|
258
258
|
for (const work of before.work) reconcileWorkItem(coordRoot, work.intent.id, actor);
|
|
259
|
-
return
|
|
259
|
+
return readGovernorIgnoringLease(coordRoot, goalId);
|
|
260
260
|
}
|
|
261
261
|
|
|
262
|
-
function selectCandidates(record:
|
|
262
|
+
function selectCandidates(record: GovernorRecord): Candidate[] {
|
|
263
263
|
const candidates: Candidate[] = [];
|
|
264
264
|
for (const work of record.work) {
|
|
265
265
|
if (work.projection.state === "ready") {
|
|
@@ -285,7 +285,7 @@ function selectCandidates(record: SupervisorRecord): Candidate[] {
|
|
|
285
285
|
return candidates;
|
|
286
286
|
}
|
|
287
287
|
|
|
288
|
-
function selectWithinAttemptBudget(record:
|
|
288
|
+
function selectWithinAttemptBudget(record: GovernorRecord, candidates: Candidate[]): Candidate[] {
|
|
289
289
|
let remaining = record.projection.attempts_remaining;
|
|
290
290
|
return candidates.filter((candidate) => {
|
|
291
291
|
if (!candidate.consumesAttempt) return true;
|
|
@@ -295,7 +295,7 @@ function selectWithinAttemptBudget(record: SupervisorRecord, candidates: Candida
|
|
|
295
295
|
});
|
|
296
296
|
}
|
|
297
297
|
|
|
298
|
-
function graphFingerprint(record:
|
|
298
|
+
function graphFingerprint(record: GovernorRecord): string {
|
|
299
299
|
return JSON.stringify([
|
|
300
300
|
record.projection.root_work_id,
|
|
301
301
|
record.projection.plan_generation,
|
|
@@ -310,7 +310,7 @@ function graphFingerprint(record: SupervisorRecord): string {
|
|
|
310
310
|
]);
|
|
311
311
|
}
|
|
312
312
|
|
|
313
|
-
function stopForProjection(projection:
|
|
313
|
+
function stopForProjection(projection: GovernorProjection): GovernorStopReason {
|
|
314
314
|
if (projection.state === "budget_exhausted") return "budget_exhausted";
|
|
315
315
|
if (projection.state === "blocked") return "blocked";
|
|
316
316
|
return "awaiting_attention";
|
|
@@ -2,21 +2,21 @@ import { existsSync, readFileSync, statSync } from "node:fs";
|
|
|
2
2
|
import { hostname } from "node:os";
|
|
3
3
|
import { join, resolve } from "node:path";
|
|
4
4
|
import type {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
5
|
+
GovernorServiceConfig,
|
|
6
|
+
GovernorServiceRuntime,
|
|
7
|
+
GovernorServiceStatus,
|
|
8
|
+
GovernorServiceStatusRecord,
|
|
9
9
|
} from "./service.ts";
|
|
10
10
|
|
|
11
11
|
const MAX_FILE_BYTES = 512 * 1024;
|
|
12
12
|
const MAX_GOALS = 100;
|
|
13
13
|
const FOREIGN_STATUS_STALE_MS = 30_000;
|
|
14
14
|
|
|
15
|
-
export function
|
|
15
|
+
export function readGovernorServiceConfig(coordRootRaw: string): GovernorServiceConfig {
|
|
16
16
|
const coordRoot = resolve(coordRootRaw);
|
|
17
|
-
const config = readBoundedJson<
|
|
17
|
+
const config = readBoundedJson<GovernorServiceConfig>(
|
|
18
18
|
join(serviceDir(coordRoot), "config.json"),
|
|
19
|
-
"
|
|
19
|
+
"governor service configuration",
|
|
20
20
|
);
|
|
21
21
|
if (
|
|
22
22
|
config.schema_version !== 1 ||
|
|
@@ -35,18 +35,18 @@ export function readSupervisorServiceConfig(coordRootRaw: string): SupervisorSer
|
|
|
35
35
|
typeof config.engine.subscription_only !== "boolean" ||
|
|
36
36
|
typeof config.engine.allow_api_billing !== "boolean"
|
|
37
37
|
) {
|
|
38
|
-
throw new Error("
|
|
38
|
+
throw new Error("governor service configuration has an unsupported schema");
|
|
39
39
|
}
|
|
40
40
|
return config;
|
|
41
41
|
}
|
|
42
42
|
|
|
43
|
-
export function
|
|
43
|
+
export function readGovernorServiceRuntime(
|
|
44
44
|
coordRootRaw: string,
|
|
45
|
-
):
|
|
45
|
+
): GovernorServiceRuntime | undefined {
|
|
46
46
|
const coordRoot = resolve(coordRootRaw);
|
|
47
47
|
const path = join(serviceDir(coordRoot), "runtime.json");
|
|
48
48
|
if (!existsSync(path)) return undefined;
|
|
49
|
-
const runtime = readBoundedJson<
|
|
49
|
+
const runtime = readBoundedJson<GovernorServiceRuntime>(path, "governor service runtime");
|
|
50
50
|
if (
|
|
51
51
|
runtime.schema_version !== 1 ||
|
|
52
52
|
!validTimestamp(runtime.config_created_at) ||
|
|
@@ -55,23 +55,23 @@ export function readSupervisorServiceRuntime(
|
|
|
55
55
|
typeof runtime.goals !== "object" ||
|
|
56
56
|
Array.isArray(runtime.goals)
|
|
57
57
|
) {
|
|
58
|
-
throw new Error("
|
|
58
|
+
throw new Error("governor service runtime has an unsupported schema");
|
|
59
59
|
}
|
|
60
60
|
return runtime;
|
|
61
61
|
}
|
|
62
62
|
|
|
63
|
-
export function
|
|
63
|
+
export function readGovernorServiceStatus(coordRootRaw: string): GovernorServiceStatus {
|
|
64
64
|
const coordRoot = resolve(coordRootRaw);
|
|
65
65
|
const record = readStatusRecord(coordRoot);
|
|
66
|
-
let config:
|
|
67
|
-
let runtime:
|
|
66
|
+
let config: GovernorServiceConfig | undefined;
|
|
67
|
+
let runtime: GovernorServiceRuntime | undefined;
|
|
68
68
|
try {
|
|
69
|
-
config =
|
|
69
|
+
config = readGovernorServiceConfig(coordRoot);
|
|
70
70
|
} catch {
|
|
71
71
|
// Unconfigured or corrupt service state is represented without throwing.
|
|
72
72
|
}
|
|
73
73
|
try {
|
|
74
|
-
runtime =
|
|
74
|
+
runtime = readGovernorServiceRuntime(coordRoot);
|
|
75
75
|
} catch {
|
|
76
76
|
// Runtime is recoverable and must not make the dashboard unreadable.
|
|
77
77
|
}
|
|
@@ -80,15 +80,15 @@ export function readSupervisorServiceStatus(coordRootRaw: string): SupervisorSer
|
|
|
80
80
|
return { running, stale: !running && record.state !== "stopped", record, config, runtime };
|
|
81
81
|
}
|
|
82
82
|
|
|
83
|
-
export function
|
|
83
|
+
export function governorServiceLogPath(coordRoot: string): string {
|
|
84
84
|
return join(serviceDir(resolve(coordRoot)), "service.log");
|
|
85
85
|
}
|
|
86
86
|
|
|
87
|
-
function readStatusRecord(coordRoot: string):
|
|
87
|
+
function readStatusRecord(coordRoot: string): GovernorServiceStatusRecord | undefined {
|
|
88
88
|
const path = join(serviceDir(coordRoot), "status.json");
|
|
89
89
|
if (!existsSync(path)) return undefined;
|
|
90
90
|
try {
|
|
91
|
-
const value = readBoundedJson<
|
|
91
|
+
const value = readBoundedJson<GovernorServiceStatusRecord>(path, "governor service status");
|
|
92
92
|
if (
|
|
93
93
|
value.schema_version !== 1 ||
|
|
94
94
|
!Number.isSafeInteger(value.pid) ||
|
|
@@ -106,7 +106,7 @@ function readStatusRecord(coordRoot: string): SupervisorServiceStatusRecord | un
|
|
|
106
106
|
}
|
|
107
107
|
}
|
|
108
108
|
|
|
109
|
-
function statusOwnerIsLive(record:
|
|
109
|
+
function statusOwnerIsLive(record: GovernorServiceStatusRecord): boolean {
|
|
110
110
|
if (record.state === "stopped") return false;
|
|
111
111
|
if (record.host === hostname()) {
|
|
112
112
|
try {
|
|
@@ -132,7 +132,7 @@ function readBoundedJson<T>(path: string, label: string): T {
|
|
|
132
132
|
}
|
|
133
133
|
|
|
134
134
|
function serviceDir(coordRoot: string): string {
|
|
135
|
-
return join(coordRoot, ".harnery", "
|
|
135
|
+
return join(coordRoot, ".harnery", "governor-service");
|
|
136
136
|
}
|
|
137
137
|
|
|
138
138
|
function positive(value: unknown): value is number {
|