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
|
@@ -1,16 +1,11 @@
|
|
|
1
1
|
import { spawnSync } from "node:child_process";
|
|
2
|
-
import {
|
|
2
|
+
import { ADAPTER_SPECS } from "../hooks/adapter/events.ts";
|
|
3
3
|
import type { SpawnRequest, SpawnResult } from "../workflow/types.ts";
|
|
4
|
-
import type {
|
|
4
|
+
import type { AdapterAttestation, AttestableDimension } from "./attestation.ts";
|
|
5
5
|
import { isAttestationCurrent, readAttestation } from "./attestation.ts";
|
|
6
|
-
import type {
|
|
7
|
-
import type {
|
|
8
|
-
|
|
9
|
-
HarnessAdapter,
|
|
10
|
-
HarnessCapabilityDimension,
|
|
11
|
-
HarnessId,
|
|
12
|
-
} from "./types.ts";
|
|
13
|
-
import { HARNESS_CAPABILITY_DIMENSIONS } from "./types.ts";
|
|
6
|
+
import type { AdapterRegistry } from "./registry.ts";
|
|
7
|
+
import type { Adapter, AdapterCapabilityDimension, AdapterId, CapabilitySupport } from "./types.ts";
|
|
8
|
+
import { ADAPTER_CAPABILITY_DIMENSIONS } from "./types.ts";
|
|
14
9
|
|
|
15
10
|
export type BenchVerdict =
|
|
16
11
|
| "supported"
|
|
@@ -21,7 +16,7 @@ export type BenchVerdict =
|
|
|
21
16
|
| "skipped"
|
|
22
17
|
| "drift";
|
|
23
18
|
|
|
24
|
-
export type BenchDimension = "registration" | "binary" | "contract" |
|
|
19
|
+
export type BenchDimension = "registration" | "binary" | "contract" | AdapterCapabilityDimension;
|
|
25
20
|
|
|
26
21
|
/** How a result was established (ADR 0037). Orthogonal to the verdict: this
|
|
27
22
|
* answers "how do we know", not "what is true".
|
|
@@ -33,7 +28,7 @@ export type BenchDimension = "registration" | "binary" | "contract" | HarnessCap
|
|
|
33
28
|
export type BenchBasis = "adapter" | "attested" | "declared";
|
|
34
29
|
|
|
35
30
|
export interface BenchResult {
|
|
36
|
-
|
|
31
|
+
adapter: AdapterId;
|
|
37
32
|
dimension: BenchDimension;
|
|
38
33
|
declared: CapabilitySupport | "not_applicable";
|
|
39
34
|
observed: BenchVerdict;
|
|
@@ -42,10 +37,10 @@ export interface BenchResult {
|
|
|
42
37
|
note?: string;
|
|
43
38
|
}
|
|
44
39
|
|
|
45
|
-
export interface
|
|
40
|
+
export interface AdapterBenchReport {
|
|
46
41
|
generatedAt: string;
|
|
47
42
|
mode: "offline";
|
|
48
|
-
|
|
43
|
+
adapters: AdapterId[];
|
|
49
44
|
results: BenchResult[];
|
|
50
45
|
summary: Record<BenchVerdict, number>;
|
|
51
46
|
/** Result counts per basis, so a caller can tell a clean report from an
|
|
@@ -55,16 +50,16 @@ export interface HarnessBenchReport {
|
|
|
55
50
|
skipped: boolean;
|
|
56
51
|
}
|
|
57
52
|
|
|
58
|
-
export interface
|
|
59
|
-
|
|
60
|
-
dimensions?: readonly
|
|
53
|
+
export interface AdapterBenchOptions {
|
|
54
|
+
adapters?: readonly string[];
|
|
55
|
+
dimensions?: readonly AdapterCapabilityDimension[];
|
|
61
56
|
/** Test seam and alternate host probe. A null version means unavailable. */
|
|
62
57
|
versionProbe?: (binary: string) => string | null;
|
|
63
58
|
/** Where to look for live attestations (ADR 0038). Defaults to the coord
|
|
64
59
|
* root. Reading them never runs a model turn. */
|
|
65
60
|
coordRoot?: string;
|
|
66
61
|
/** Test seam. Defaults to reading the attestation store. */
|
|
67
|
-
attestationReader?: (
|
|
62
|
+
attestationReader?: (adapter: AdapterId) => AdapterAttestation | null;
|
|
68
63
|
/** Only cite attestations recorded under this billing mode. Omitted means
|
|
69
64
|
* any mode is acceptable for reporting purposes. */
|
|
70
65
|
subscriptionOnly?: boolean;
|
|
@@ -90,12 +85,12 @@ const EMPTY_BASIS_SUMMARY: Record<BenchBasis, number> = {
|
|
|
90
85
|
* version and the current declaration. A stale one is ignored rather than
|
|
91
86
|
* trusted, so an upgraded vendor CLI silently drops back to adapter basis. */
|
|
92
87
|
function loadAttestation(
|
|
93
|
-
id:
|
|
88
|
+
id: AdapterId,
|
|
94
89
|
version: string | null,
|
|
95
|
-
adapter:
|
|
96
|
-
opts:
|
|
97
|
-
):
|
|
98
|
-
let record:
|
|
90
|
+
adapter: Adapter,
|
|
91
|
+
opts: AdapterBenchOptions,
|
|
92
|
+
): AdapterAttestation | null {
|
|
93
|
+
let record: AdapterAttestation | null = null;
|
|
99
94
|
try {
|
|
100
95
|
record = opts.attestationReader
|
|
101
96
|
? opts.attestationReader(id)
|
|
@@ -118,21 +113,21 @@ function versionToken(value: string | null | undefined): string | null {
|
|
|
118
113
|
return match ? match[0].toLowerCase() : null;
|
|
119
114
|
}
|
|
120
115
|
|
|
121
|
-
export function
|
|
122
|
-
registry:
|
|
123
|
-
opts:
|
|
124
|
-
):
|
|
125
|
-
const ids = opts.
|
|
116
|
+
export function runAdapterBench(
|
|
117
|
+
registry: AdapterRegistry,
|
|
118
|
+
opts: AdapterBenchOptions = {},
|
|
119
|
+
): AdapterBenchReport {
|
|
120
|
+
const ids = opts.adapters?.length ? [...opts.adapters] : registry.ids();
|
|
126
121
|
const dimensions = opts.dimensions?.length
|
|
127
122
|
? [...new Set(opts.dimensions)]
|
|
128
|
-
: [...
|
|
123
|
+
: [...ADAPTER_CAPABILITY_DIMENSIONS];
|
|
129
124
|
const versionProbe = opts.versionProbe ?? probeBinaryVersion;
|
|
130
125
|
const results: BenchResult[] = [];
|
|
131
126
|
|
|
132
127
|
for (const id of ids) {
|
|
133
128
|
const adapter = registry.require(id);
|
|
134
129
|
results.push({
|
|
135
|
-
|
|
130
|
+
adapter: id,
|
|
136
131
|
dimension: "registration",
|
|
137
132
|
declared: "supported",
|
|
138
133
|
observed: "supported",
|
|
@@ -143,7 +138,7 @@ export function runHarnessBench(
|
|
|
143
138
|
|
|
144
139
|
const version = versionProbe(adapter.profile.binary);
|
|
145
140
|
results.push({
|
|
146
|
-
|
|
141
|
+
adapter: id,
|
|
147
142
|
dimension: "binary",
|
|
148
143
|
declared: "supported",
|
|
149
144
|
observed: version ? "supported" : "skipped",
|
|
@@ -166,7 +161,7 @@ export function runHarnessBench(
|
|
|
166
161
|
? { observed: live, basis: "attested" }
|
|
167
162
|
: observations[dimension];
|
|
168
163
|
results.push({
|
|
169
|
-
|
|
164
|
+
adapter: id,
|
|
170
165
|
dimension,
|
|
171
166
|
declared: claim.support,
|
|
172
167
|
observed,
|
|
@@ -186,7 +181,7 @@ export function runHarnessBench(
|
|
|
186
181
|
return {
|
|
187
182
|
generatedAt: new Date().toISOString(),
|
|
188
183
|
mode: "offline",
|
|
189
|
-
|
|
184
|
+
adapters: ids,
|
|
190
185
|
results,
|
|
191
186
|
summary,
|
|
192
187
|
basisSummary,
|
|
@@ -203,13 +198,9 @@ export function runHarnessBench(
|
|
|
203
198
|
* broken, but the declaration is no longer backed by an observation. An
|
|
204
199
|
* unrecorded or unparseable declared version stays `unknown` rather than being
|
|
205
200
|
* inferred from the installed one. */
|
|
206
|
-
function contractResult(
|
|
207
|
-
id: HarnessId,
|
|
208
|
-
adapter: HarnessAdapter,
|
|
209
|
-
version: string | null,
|
|
210
|
-
): BenchResult {
|
|
201
|
+
function contractResult(id: AdapterId, adapter: Adapter, version: string | null): BenchResult {
|
|
211
202
|
const recorded = adapter.profile.verified;
|
|
212
|
-
const base = {
|
|
203
|
+
const base = { adapter: id, dimension: "contract" as const, declared: "supported" as const };
|
|
213
204
|
|
|
214
205
|
if (!version) {
|
|
215
206
|
return {
|
|
@@ -265,8 +256,8 @@ function fromAdapter(observed: BenchVerdict): DimensionObservation {
|
|
|
265
256
|
const NOT_CHECKED: DimensionObservation = { observed: "unknown", basis: "declared" };
|
|
266
257
|
|
|
267
258
|
function observeAdapter(
|
|
268
|
-
adapter:
|
|
269
|
-
): Record<
|
|
259
|
+
adapter: Adapter,
|
|
260
|
+
): Record<AdapterCapabilityDimension, DimensionObservation> {
|
|
270
261
|
const profile = adapter.profile;
|
|
271
262
|
const effort = profile.effortValues[0];
|
|
272
263
|
const request: SpawnRequest = {
|
|
@@ -312,8 +303,8 @@ function observeAdapter(
|
|
|
312
303
|
const sessionObserved = normalized?.sessionId !== undefined ? "supported" : "unsupported";
|
|
313
304
|
const costObserved = normalized?.costUsd !== undefined ? "supported" : "unsupported";
|
|
314
305
|
const hookSpec =
|
|
315
|
-
adapter.profile.id in
|
|
316
|
-
?
|
|
306
|
+
adapter.profile.id in ADAPTER_SPECS
|
|
307
|
+
? ADAPTER_SPECS[adapter.profile.id as keyof typeof ADAPTER_SPECS]
|
|
317
308
|
: undefined;
|
|
318
309
|
const hookSubcommands = new Set(hookSpec?.events.map((event) => event.subcommand) ?? []);
|
|
319
310
|
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
export type { Spawner, SpawnRequest, SpawnResult } from "../workflow/types.ts";
|
|
2
|
+
export type {
|
|
3
|
+
AdapterAttestationReport,
|
|
4
|
+
AdapterAttestationResult,
|
|
5
|
+
AttestationOutcome,
|
|
6
|
+
RunAdapterAttestationOptions,
|
|
7
|
+
} from "./attest.ts";
|
|
8
|
+
export { ATTESTATION_PROMPT, runAdapterAttestation } from "./attest.ts";
|
|
9
|
+
export type {
|
|
10
|
+
AdapterAttestation,
|
|
11
|
+
AttestableDimension,
|
|
12
|
+
AttestationStoreOptions,
|
|
13
|
+
} from "./attestation.ts";
|
|
14
|
+
export {
|
|
15
|
+
ATTESTABLE_DIMENSIONS,
|
|
16
|
+
ATTESTATION_SCHEMA_VERSION,
|
|
17
|
+
adapterProofInputs,
|
|
18
|
+
attestationsDir,
|
|
19
|
+
isAttestationCurrent,
|
|
20
|
+
listAttestations,
|
|
21
|
+
profileDigest,
|
|
22
|
+
readAttestation,
|
|
23
|
+
validateAttestation,
|
|
24
|
+
writeAttestation,
|
|
25
|
+
} from "./attestation.ts";
|
|
26
|
+
export type {
|
|
27
|
+
AdapterBenchOptions,
|
|
28
|
+
AdapterBenchReport,
|
|
29
|
+
BenchBasis,
|
|
30
|
+
BenchDimension,
|
|
31
|
+
BenchResult,
|
|
32
|
+
BenchVerdict,
|
|
33
|
+
} from "./bench.ts";
|
|
34
|
+
export { probeBinaryVersion, runAdapterBench } from "./bench.ts";
|
|
35
|
+
export type { BuiltinAdapterId } from "./profiles.ts";
|
|
36
|
+
export {
|
|
37
|
+
BUILTIN_ADAPTER_IDS,
|
|
38
|
+
BUILTIN_ADAPTER_PROFILES,
|
|
39
|
+
builtinAdapterProfile,
|
|
40
|
+
isBuiltinAdapter,
|
|
41
|
+
validateAdapterEffort,
|
|
42
|
+
} from "./profiles.ts";
|
|
43
|
+
export { AdapterRegistry, createBuiltinAdapterRegistry } from "./registry.ts";
|
|
44
|
+
export type {
|
|
45
|
+
Adapter,
|
|
46
|
+
AdapterBenchFixture,
|
|
47
|
+
AdapterCapabilities,
|
|
48
|
+
AdapterCapabilityDimension,
|
|
49
|
+
AdapterId,
|
|
50
|
+
AdapterInvocation,
|
|
51
|
+
AdapterProfile,
|
|
52
|
+
AdapterRawResult,
|
|
53
|
+
CapabilityClaim,
|
|
54
|
+
CapabilitySupport,
|
|
55
|
+
} from "./types.ts";
|
|
56
|
+
export { ADAPTER_CAPABILITY_DIMENSIONS } from "./types.ts";
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { AdapterCapabilities, AdapterProfile, CapabilityClaim } from "./types.ts";
|
|
2
2
|
|
|
3
3
|
const supported = (note?: string): CapabilityClaim => ({ support: "supported", note });
|
|
4
4
|
const unsupported = (note?: string): CapabilityClaim => ({ support: "unsupported", note });
|
|
5
5
|
const partial = (note: string): CapabilityClaim => ({ support: "partial", note });
|
|
6
6
|
const unknown = (note: string): CapabilityClaim => ({ support: "unknown", note });
|
|
7
7
|
|
|
8
|
-
function capabilities(overrides: Partial<
|
|
8
|
+
function capabilities(overrides: Partial<AdapterCapabilities>): AdapterCapabilities {
|
|
9
9
|
return {
|
|
10
10
|
invocation: supported("Headless CLI subprocess."),
|
|
11
11
|
modelSelection: supported("Explicit model flag is mapped by the adapter."),
|
|
@@ -25,14 +25,14 @@ function capabilities(overrides: Partial<HarnessCapabilities>): HarnessCapabilit
|
|
|
25
25
|
contextTelemetry: unknown("The workflow adapter does not expose live context usage."),
|
|
26
26
|
preCompactionSignal: unknown("No compaction lifecycle probe has certified this adapter."),
|
|
27
27
|
postCompactionSignal: unknown("No compaction lifecycle probe has certified this adapter."),
|
|
28
|
-
compaction: unsupported("Harnery does not initiate native
|
|
28
|
+
compaction: unsupported("Harnery does not initiate native adapter compaction."),
|
|
29
29
|
...overrides,
|
|
30
30
|
};
|
|
31
31
|
}
|
|
32
32
|
|
|
33
|
-
/** The one built-in profile catalog. Adding a fourth
|
|
33
|
+
/** The one built-in profile catalog. Adding a fourth adapter starts here; CLI
|
|
34
34
|
* choices, doctor metadata, workflow dispatch, and the bench derive from it. */
|
|
35
|
-
export const
|
|
35
|
+
export const BUILTIN_ADAPTER_PROFILES = {
|
|
36
36
|
"claude-code": {
|
|
37
37
|
id: "claude-code",
|
|
38
38
|
displayName: "Claude Code",
|
|
@@ -123,26 +123,26 @@ export const BUILTIN_HARNESS_PROFILES = {
|
|
|
123
123
|
),
|
|
124
124
|
}),
|
|
125
125
|
},
|
|
126
|
-
} as const satisfies Record<string,
|
|
126
|
+
} as const satisfies Record<string, AdapterProfile>;
|
|
127
127
|
|
|
128
|
-
export type
|
|
128
|
+
export type BuiltinAdapterId = keyof typeof BUILTIN_ADAPTER_PROFILES;
|
|
129
129
|
|
|
130
|
-
export const
|
|
131
|
-
Object.keys(
|
|
130
|
+
export const BUILTIN_ADAPTER_IDS = Object.freeze(
|
|
131
|
+
Object.keys(BUILTIN_ADAPTER_PROFILES) as BuiltinAdapterId[],
|
|
132
132
|
);
|
|
133
133
|
|
|
134
|
-
export function
|
|
135
|
-
return Object.hasOwn(
|
|
134
|
+
export function isBuiltinAdapter(id: string): id is BuiltinAdapterId {
|
|
135
|
+
return Object.hasOwn(BUILTIN_ADAPTER_PROFILES, id);
|
|
136
136
|
}
|
|
137
137
|
|
|
138
|
-
export function
|
|
139
|
-
return
|
|
138
|
+
export function builtinAdapterProfile(id: string): AdapterProfile | undefined {
|
|
139
|
+
return isBuiltinAdapter(id) ? BUILTIN_ADAPTER_PROFILES[id] : undefined;
|
|
140
140
|
}
|
|
141
141
|
|
|
142
|
-
export function
|
|
142
|
+
export function validateAdapterEffort(id: string, effort: string | undefined): void {
|
|
143
143
|
if (!effort) return;
|
|
144
|
-
const profile =
|
|
145
|
-
if (!profile) throw new Error(`unknown
|
|
144
|
+
const profile = builtinAdapterProfile(id);
|
|
145
|
+
if (!profile) throw new Error(`unknown adapter ${JSON.stringify(id)}`);
|
|
146
146
|
if (!profile.effortValues.includes(effort)) {
|
|
147
147
|
const supportedValues = profile.effortValues.length ? profile.effortValues.join(", ") : "none";
|
|
148
148
|
throw new Error(
|
|
@@ -14,15 +14,15 @@ import {
|
|
|
14
14
|
normalizeCursorResult,
|
|
15
15
|
} from "../workflow/spawn-cursor.ts";
|
|
16
16
|
import {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
type
|
|
17
|
+
BUILTIN_ADAPTER_IDS,
|
|
18
|
+
BUILTIN_ADAPTER_PROFILES,
|
|
19
|
+
type BuiltinAdapterId,
|
|
20
20
|
} from "./profiles.ts";
|
|
21
|
-
import type {
|
|
21
|
+
import type { Adapter, AdapterId } from "./types.ts";
|
|
22
22
|
|
|
23
|
-
const BUILTIN_ADAPTERS: Record<
|
|
23
|
+
const BUILTIN_ADAPTERS: Record<BuiltinAdapterId, Adapter> = {
|
|
24
24
|
"claude-code": {
|
|
25
|
-
profile:
|
|
25
|
+
profile: BUILTIN_ADAPTER_PROFILES["claude-code"],
|
|
26
26
|
spawn: claudeCodeSpawner,
|
|
27
27
|
buildInvocation: buildClaudeInvocation,
|
|
28
28
|
normalizeResult: normalizeClaudeResult,
|
|
@@ -47,7 +47,7 @@ const BUILTIN_ADAPTERS: Record<BuiltinHarnessId, HarnessAdapter> = {
|
|
|
47
47
|
},
|
|
48
48
|
},
|
|
49
49
|
codex: {
|
|
50
|
-
profile:
|
|
50
|
+
profile: BUILTIN_ADAPTER_PROFILES.codex,
|
|
51
51
|
spawn: codexSpawner,
|
|
52
52
|
buildInvocation: buildCodexInvocation,
|
|
53
53
|
normalizeResult: normalizeCodexResult,
|
|
@@ -63,7 +63,7 @@ const BUILTIN_ADAPTERS: Record<BuiltinHarnessId, HarnessAdapter> = {
|
|
|
63
63
|
},
|
|
64
64
|
},
|
|
65
65
|
cursor: {
|
|
66
|
-
profile:
|
|
66
|
+
profile: BUILTIN_ADAPTER_PROFILES.cursor,
|
|
67
67
|
spawn: cursorSpawner,
|
|
68
68
|
buildInvocation: buildCursorInvocation,
|
|
69
69
|
normalizeResult: normalizeCursorResult,
|
|
@@ -89,52 +89,52 @@ const BUILTIN_ADAPTERS: Record<BuiltinHarnessId, HarnessAdapter> = {
|
|
|
89
89
|
|
|
90
90
|
/** Mutable registry for embedders, initialized empty unless adapters are
|
|
91
91
|
* provided. Duplicate ids fail loud instead of silently replacing behavior. */
|
|
92
|
-
export class
|
|
93
|
-
readonly #adapters = new Map<
|
|
92
|
+
export class AdapterRegistry {
|
|
93
|
+
readonly #adapters = new Map<AdapterId, Adapter>();
|
|
94
94
|
|
|
95
|
-
constructor(adapters: Iterable<
|
|
95
|
+
constructor(adapters: Iterable<Adapter> = []) {
|
|
96
96
|
for (const adapter of adapters) this.register(adapter);
|
|
97
97
|
}
|
|
98
98
|
|
|
99
|
-
register(adapter:
|
|
99
|
+
register(adapter: Adapter): this {
|
|
100
100
|
const id = adapter.profile.id.trim();
|
|
101
|
-
if (!id) throw new Error("
|
|
101
|
+
if (!id) throw new Error("adapter adapter id cannot be empty");
|
|
102
102
|
if (this.#adapters.has(id))
|
|
103
|
-
throw new Error(`
|
|
103
|
+
throw new Error(`adapter adapter ${JSON.stringify(id)} is already registered`);
|
|
104
104
|
if (adapter.profile.binary.trim() === "") {
|
|
105
|
-
throw new Error(`
|
|
105
|
+
throw new Error(`adapter adapter ${JSON.stringify(id)} has no binary`);
|
|
106
106
|
}
|
|
107
107
|
this.#adapters.set(id, adapter);
|
|
108
108
|
return this;
|
|
109
109
|
}
|
|
110
110
|
|
|
111
|
-
get(id:
|
|
111
|
+
get(id: AdapterId): Adapter | undefined {
|
|
112
112
|
return this.#adapters.get(id);
|
|
113
113
|
}
|
|
114
114
|
|
|
115
|
-
require(id:
|
|
115
|
+
require(id: AdapterId): Adapter {
|
|
116
116
|
const adapter = this.get(id);
|
|
117
117
|
if (!adapter) {
|
|
118
118
|
throw new Error(
|
|
119
|
-
`unknown
|
|
119
|
+
`unknown adapter ${JSON.stringify(id)} (registered: ${this.ids().join(", ") || "none"})`,
|
|
120
120
|
);
|
|
121
121
|
}
|
|
122
122
|
return adapter;
|
|
123
123
|
}
|
|
124
124
|
|
|
125
|
-
list():
|
|
125
|
+
list(): Adapter[] {
|
|
126
126
|
return Array.from(this.#adapters.values());
|
|
127
127
|
}
|
|
128
128
|
|
|
129
|
-
ids():
|
|
129
|
+
ids(): AdapterId[] {
|
|
130
130
|
return Array.from(this.#adapters.keys());
|
|
131
131
|
}
|
|
132
132
|
|
|
133
|
-
spawners(): Record<
|
|
133
|
+
spawners(): Record<AdapterId, Adapter["spawn"]> {
|
|
134
134
|
return Object.fromEntries(this.list().map((adapter) => [adapter.profile.id, adapter.spawn]));
|
|
135
135
|
}
|
|
136
136
|
}
|
|
137
137
|
|
|
138
|
-
export function
|
|
139
|
-
return new
|
|
138
|
+
export function createBuiltinAdapterRegistry(): AdapterRegistry {
|
|
139
|
+
return new AdapterRegistry(BUILTIN_ADAPTER_IDS.map((id) => BUILTIN_ADAPTERS[id]));
|
|
140
140
|
}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import type { Spawner, SpawnRequest, SpawnResult } from "../workflow/types.ts";
|
|
2
2
|
|
|
3
|
-
/** Open
|
|
3
|
+
/** Open adapter identifier. Built-ins are registered at runtime rather than
|
|
4
4
|
* repeated through closed unions in every consumer. */
|
|
5
|
-
export type
|
|
5
|
+
export type AdapterId = string;
|
|
6
6
|
|
|
7
7
|
export type CapabilitySupport = "supported" | "partial" | "unsupported" | "unknown";
|
|
8
8
|
|
|
9
|
-
export const
|
|
9
|
+
export const ADAPTER_CAPABILITY_DIMENSIONS = [
|
|
10
10
|
"invocation",
|
|
11
11
|
"modelSelection",
|
|
12
12
|
"effortSelection",
|
|
@@ -28,7 +28,7 @@ export const HARNESS_CAPABILITY_DIMENSIONS = [
|
|
|
28
28
|
"compaction",
|
|
29
29
|
] as const;
|
|
30
30
|
|
|
31
|
-
export type
|
|
31
|
+
export type AdapterCapabilityDimension = (typeof ADAPTER_CAPABILITY_DIMENSIONS)[number];
|
|
32
32
|
|
|
33
33
|
export interface CapabilityClaim {
|
|
34
34
|
support: CapabilitySupport;
|
|
@@ -37,21 +37,21 @@ export interface CapabilityClaim {
|
|
|
37
37
|
note?: string;
|
|
38
38
|
}
|
|
39
39
|
|
|
40
|
-
export type
|
|
40
|
+
export type AdapterCapabilities = Record<AdapterCapabilityDimension, CapabilityClaim>;
|
|
41
41
|
|
|
42
|
-
/** What one
|
|
43
|
-
* (ADR 0039). `null` means the
|
|
44
|
-
* fact about the
|
|
42
|
+
/** What one adapter can represent of a filesystem-policy projection
|
|
43
|
+
* (ADR 0039). `null` means the adapter does not distinguish that, which is a
|
|
44
|
+
* fact about the adapter rather than something to paper over: a projection the
|
|
45
45
|
* adapter would silently drop must be refused instead. */
|
|
46
|
-
export interface
|
|
46
|
+
export interface AdapterSandboxProjection {
|
|
47
47
|
/** Native representation per canonical mode, or null when unrepresentable. */
|
|
48
48
|
modes: Record<"read-only" | "workspace-write", string | null>;
|
|
49
|
-
/** Whether the
|
|
49
|
+
/** Whether the adapter accepts an explicit writable-root set. */
|
|
50
50
|
writableRoots: boolean;
|
|
51
51
|
}
|
|
52
52
|
|
|
53
|
-
export interface
|
|
54
|
-
id:
|
|
53
|
+
export interface AdapterProfile {
|
|
54
|
+
id: AdapterId;
|
|
55
55
|
displayName: string;
|
|
56
56
|
binary: string;
|
|
57
57
|
installHint: string;
|
|
@@ -61,23 +61,23 @@ export interface HarnessProfile {
|
|
|
61
61
|
authModel: "own-auth";
|
|
62
62
|
modelFamily: "claude" | "gpt" | "multi";
|
|
63
63
|
effortValues: readonly string[];
|
|
64
|
-
capabilities:
|
|
64
|
+
capabilities: AdapterCapabilities;
|
|
65
65
|
/** The last real vendor CLI contract used to validate this declaration. */
|
|
66
66
|
verified?: { date: string; version: string };
|
|
67
67
|
/** How this adapter projects host filesystem policy into the vendor's own
|
|
68
68
|
* sandbox (ADR 0039). Absent means it cannot project any of it. */
|
|
69
|
-
sandboxProjection?:
|
|
69
|
+
sandboxProjection?: AdapterSandboxProjection;
|
|
70
70
|
}
|
|
71
71
|
|
|
72
72
|
/** Fully planned child invocation. `resultFile` is used by adapters such as
|
|
73
73
|
* Codex that deliver the authoritative final answer out-of-band. */
|
|
74
|
-
export interface
|
|
74
|
+
export interface AdapterInvocation {
|
|
75
75
|
argv: string[];
|
|
76
76
|
resultFile?: string;
|
|
77
77
|
}
|
|
78
78
|
|
|
79
79
|
/** Vendor subprocess material passed through an adapter's normalizer. */
|
|
80
|
-
export interface
|
|
80
|
+
export interface AdapterRawResult {
|
|
81
81
|
stdout: string;
|
|
82
82
|
stderr: string;
|
|
83
83
|
exitCode: number;
|
|
@@ -95,8 +95,8 @@ export interface HarnessRawResult {
|
|
|
95
95
|
spawnErrno?: string;
|
|
96
96
|
}
|
|
97
97
|
|
|
98
|
-
export interface
|
|
99
|
-
raw:
|
|
98
|
+
export interface AdapterBenchFixture {
|
|
99
|
+
raw: AdapterRawResult;
|
|
100
100
|
expected: Pick<SpawnResult, "ok" | "text"> & {
|
|
101
101
|
sessionId?: string;
|
|
102
102
|
costUsd?: number;
|
|
@@ -106,10 +106,10 @@ export interface HarnessBenchFixture {
|
|
|
106
106
|
/** One registered executable adapter. The same planner and normalizer power
|
|
107
107
|
* production workflow runs and the offline conformance bench, preventing the
|
|
108
108
|
* bench from testing a parallel mock implementation. */
|
|
109
|
-
export interface
|
|
110
|
-
profile:
|
|
109
|
+
export interface Adapter {
|
|
110
|
+
profile: AdapterProfile;
|
|
111
111
|
spawn: Spawner;
|
|
112
|
-
buildInvocation: (request: SpawnRequest, resultFile?: string) =>
|
|
113
|
-
normalizeResult: (raw:
|
|
114
|
-
fixture:
|
|
112
|
+
buildInvocation: (request: SpawnRequest, resultFile?: string) => AdapterInvocation;
|
|
113
|
+
normalizeResult: (raw: AdapterRawResult) => SpawnResult;
|
|
114
|
+
fixture: AdapterBenchFixture;
|
|
115
115
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Emit canonical events by spawning `agent-coord emit-event`. Used by every
|
|
3
|
-
* `agents …` / `
|
|
3
|
+
* `agents …` / `journal` / `presence` write that has a canonical state event.
|
|
4
4
|
*
|
|
5
5
|
* Soft-fails: never throws into the caller. A failed emit logs to stderr
|
|
6
6
|
* (visible to operators in their terminal) but never breaks the CLI flow.
|
|
@@ -18,7 +18,7 @@ export interface CanonicalEmitInput {
|
|
|
18
18
|
type: string;
|
|
19
19
|
owner: string;
|
|
20
20
|
session: string;
|
|
21
|
-
|
|
21
|
+
adapter: "claude-code" | "cursor" | "codex";
|
|
22
22
|
data: Record<string, unknown>;
|
|
23
23
|
turnId?: string;
|
|
24
24
|
parentSessionId?: string;
|
|
@@ -68,8 +68,8 @@ export function emitCanonical(input: CanonicalEmitInput): void {
|
|
|
68
68
|
input.owner,
|
|
69
69
|
"--session",
|
|
70
70
|
input.session,
|
|
71
|
-
"--
|
|
72
|
-
input.
|
|
71
|
+
"--adapter",
|
|
72
|
+
input.adapter,
|
|
73
73
|
"--data-json",
|
|
74
74
|
JSON.stringify(input.data),
|
|
75
75
|
];
|
|
@@ -96,9 +96,9 @@ export function emitCanonical(input: CanonicalEmitInput): void {
|
|
|
96
96
|
|
|
97
97
|
/**
|
|
98
98
|
* Normalize the heartbeat's `platform` field (which uses snake_case
|
|
99
|
-
* `claude_code`) to the canonical kebab-case
|
|
99
|
+
* `claude_code`) to the canonical kebab-case Adapter type.
|
|
100
100
|
*/
|
|
101
|
-
export function
|
|
101
|
+
export function normalizeAdapter(platform: string | undefined): "claude-code" | "cursor" | "codex" {
|
|
102
102
|
if (platform === "cursor") return "cursor";
|
|
103
103
|
if (platform === "codex") return "codex";
|
|
104
104
|
return "claude-code";
|
|
@@ -47,7 +47,7 @@ export function emitAndProject(
|
|
|
47
47
|
parent_session_id: envelope.parent_session_id,
|
|
48
48
|
turn_id: envelope.turn_id,
|
|
49
49
|
parent_turn_id: envelope.parent_turn_id,
|
|
50
|
-
|
|
50
|
+
adapter: envelope.adapter,
|
|
51
51
|
source: envelope.source,
|
|
52
52
|
data: envelope.data,
|
|
53
53
|
},
|