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
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* subprocess.
|
|
4
4
|
*
|
|
5
5
|
* Contract notes (LIVE-VERIFIED 2026-07-16 against codex-cli 0.144.5: flags
|
|
6
|
-
* present, schema-gated triage + text stages round-trip via `--
|
|
6
|
+
* present, schema-gated triage + text stages round-trip via `--adapter codex`):
|
|
7
7
|
* - `codex exec "<prompt>"` is the non-interactive mode.
|
|
8
8
|
* - The final assistant message is captured via `--output-last-message <file>`
|
|
9
9
|
* (a temp file), which is far more drift-tolerant than parsing the
|
|
@@ -20,22 +20,22 @@ import { existsSync, readFileSync, rmSync } from "node:fs";
|
|
|
20
20
|
import { tmpdir } from "node:os";
|
|
21
21
|
import { join } from "node:path";
|
|
22
22
|
import { exec } from "../../lib/exec.ts";
|
|
23
|
-
import {
|
|
24
|
-
import type {
|
|
23
|
+
import { builtinAdapterProfile, validateAdapterEffort } from "../adapters/profiles.ts";
|
|
24
|
+
import type { AdapterInvocation, AdapterRawResult } from "../adapters/types.ts";
|
|
25
|
+
import { notFoundError } from "./adapters.ts";
|
|
25
26
|
import { buildChildEnv } from "./child-env.ts";
|
|
26
|
-
import { notFoundError } from "./harnesses.ts";
|
|
27
27
|
import { resolveSandboxProjection } from "./sandbox-projection.ts";
|
|
28
28
|
import { isUpstreamFailureText, vendorFailureText } from "./spawn-failure.ts";
|
|
29
29
|
import type { Spawner, SpawnRequest, SpawnResult } from "./types.ts";
|
|
30
30
|
|
|
31
|
-
export function buildCodexInvocation(req: SpawnRequest, resultFile?: string):
|
|
32
|
-
|
|
31
|
+
export function buildCodexInvocation(req: SpawnRequest, resultFile?: string): AdapterInvocation {
|
|
32
|
+
validateAdapterEffort("codex", req.effort);
|
|
33
33
|
if (!resultFile) throw new Error("codex adapter requires a final-message result file");
|
|
34
34
|
// Default stays workspace-write so an unprojected request is unchanged.
|
|
35
35
|
const projection = req.filesystemPolicy
|
|
36
36
|
? resolveSandboxProjection(
|
|
37
37
|
"codex",
|
|
38
|
-
|
|
38
|
+
builtinAdapterProfile("codex")?.sandboxProjection,
|
|
39
39
|
req.filesystemPolicy,
|
|
40
40
|
)
|
|
41
41
|
: undefined;
|
|
@@ -60,7 +60,7 @@ export function buildCodexInvocation(req: SpawnRequest, resultFile?: string): Ha
|
|
|
60
60
|
return { argv, resultFile };
|
|
61
61
|
}
|
|
62
62
|
|
|
63
|
-
export function normalizeCodexResult(raw:
|
|
63
|
+
export function normalizeCodexResult(raw: AdapterRawResult): SpawnResult {
|
|
64
64
|
if (raw.timedOut) {
|
|
65
65
|
return {
|
|
66
66
|
ok: false,
|
|
@@ -110,7 +110,7 @@ export const codexSpawner: Spawner = async (req: SpawnRequest): Promise<SpawnRes
|
|
|
110
110
|
);
|
|
111
111
|
|
|
112
112
|
try {
|
|
113
|
-
let invocation:
|
|
113
|
+
let invocation: AdapterInvocation;
|
|
114
114
|
try {
|
|
115
115
|
invocation = buildCodexInvocation(req, outFile);
|
|
116
116
|
} catch (error) {
|
|
@@ -118,7 +118,10 @@ export const codexSpawner: Spawner = async (req: SpawnRequest): Promise<SpawnRes
|
|
|
118
118
|
}
|
|
119
119
|
const r = await exec(invocation.argv, {
|
|
120
120
|
cwd: req.cwd,
|
|
121
|
-
env: buildChildEnv(req.runId, {
|
|
121
|
+
env: buildChildEnv(req.runId, {
|
|
122
|
+
subscriptionOnly: req.subscriptionOnly,
|
|
123
|
+
agentId: req.agentId,
|
|
124
|
+
}),
|
|
122
125
|
timeout: req.timeoutMs,
|
|
123
126
|
});
|
|
124
127
|
return normalizeCodexResult({
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
*
|
|
5
5
|
* Contract notes (LIVE-VERIFIED 2026-07-17 against cursor-agent
|
|
6
6
|
* 2026.07.16-899851b: schema-gated triage + text stages round-trip via
|
|
7
|
-
* `--
|
|
7
|
+
* `--adapter cursor`, session_id parses from the envelope):
|
|
8
8
|
* - `cursor-agent -p "<prompt>" --output-format json` prints a single result
|
|
9
9
|
* envelope modeled on Claude Code's (`{type: "result", is_error, result,
|
|
10
10
|
* session_id, …}`).
|
|
@@ -20,10 +20,10 @@
|
|
|
20
20
|
*/
|
|
21
21
|
|
|
22
22
|
import { exec } from "../../lib/exec.ts";
|
|
23
|
-
import {
|
|
24
|
-
import type {
|
|
23
|
+
import { builtinAdapterProfile, validateAdapterEffort } from "../adapters/profiles.ts";
|
|
24
|
+
import type { AdapterInvocation, AdapterRawResult } from "../adapters/types.ts";
|
|
25
|
+
import { notFoundError } from "./adapters.ts";
|
|
25
26
|
import { buildChildEnv } from "./child-env.ts";
|
|
26
|
-
import { notFoundError } from "./harnesses.ts";
|
|
27
27
|
import { resolveSandboxProjection } from "./sandbox-projection.ts";
|
|
28
28
|
import { isUpstreamFailureText, vendorFailureText } from "./spawn-failure.ts";
|
|
29
29
|
import type { Spawner, SpawnRequest, SpawnResult } from "./types.ts";
|
|
@@ -53,13 +53,13 @@ export function parseCursorOutput(stdout: string): {
|
|
|
53
53
|
}
|
|
54
54
|
}
|
|
55
55
|
|
|
56
|
-
export function buildCursorInvocation(req: SpawnRequest):
|
|
57
|
-
|
|
56
|
+
export function buildCursorInvocation(req: SpawnRequest): AdapterInvocation {
|
|
57
|
+
validateAdapterEffort("cursor", req.effort);
|
|
58
58
|
if (req.filesystemPolicy) {
|
|
59
59
|
// Declared unrepresentable: refuse rather than drop it silently (ADR 0039).
|
|
60
60
|
resolveSandboxProjection(
|
|
61
61
|
"cursor",
|
|
62
|
-
|
|
62
|
+
builtinAdapterProfile("cursor")?.sandboxProjection,
|
|
63
63
|
req.filesystemPolicy,
|
|
64
64
|
);
|
|
65
65
|
}
|
|
@@ -73,7 +73,7 @@ export function buildCursorInvocation(req: SpawnRequest): HarnessInvocation {
|
|
|
73
73
|
return { argv };
|
|
74
74
|
}
|
|
75
75
|
|
|
76
|
-
export function normalizeCursorResult(raw:
|
|
76
|
+
export function normalizeCursorResult(raw: AdapterRawResult): SpawnResult {
|
|
77
77
|
if (raw.timedOut) {
|
|
78
78
|
return {
|
|
79
79
|
ok: false,
|
|
@@ -130,7 +130,7 @@ export function normalizeCursorResult(raw: HarnessRawResult): SpawnResult {
|
|
|
130
130
|
|
|
131
131
|
export const cursorSpawner: Spawner = async (req: SpawnRequest): Promise<SpawnResult> => {
|
|
132
132
|
const t0 = Date.now();
|
|
133
|
-
let invocation:
|
|
133
|
+
let invocation: AdapterInvocation;
|
|
134
134
|
try {
|
|
135
135
|
invocation = buildCursorInvocation(req);
|
|
136
136
|
} catch (error) {
|
|
@@ -139,7 +139,10 @@ export const cursorSpawner: Spawner = async (req: SpawnRequest): Promise<SpawnRe
|
|
|
139
139
|
|
|
140
140
|
const r = await exec(invocation.argv, {
|
|
141
141
|
cwd: req.cwd,
|
|
142
|
-
env: buildChildEnv(req.runId, {
|
|
142
|
+
env: buildChildEnv(req.runId, {
|
|
143
|
+
subscriptionOnly: req.subscriptionOnly,
|
|
144
|
+
agentId: req.agentId,
|
|
145
|
+
}),
|
|
143
146
|
timeout: req.timeoutMs,
|
|
144
147
|
});
|
|
145
148
|
return normalizeCursorResult({ ...r, durationMs: Date.now() - t0 });
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Shared failure-text extraction for the
|
|
2
|
+
* Shared failure-text extraction for the adapter spawn adapters.
|
|
3
3
|
*
|
|
4
4
|
* A vendor CLI prints its banner, resolved config, and startup warnings first,
|
|
5
5
|
* and the reason it actually failed last. Every adapter used to keep the FIRST
|
|
@@ -29,7 +29,7 @@ export function normalizeWorkflowSpecialists(
|
|
|
29
29
|
`workflow specialist ${id} instructions`,
|
|
30
30
|
MAX_INSTRUCTIONS,
|
|
31
31
|
),
|
|
32
|
-
|
|
32
|
+
adapter: optional(profile.adapter, `workflow specialist ${id} adapter`),
|
|
33
33
|
model: optional(profile.model, `workflow specialist ${id} model`),
|
|
34
34
|
effort: optional(profile.effort, `workflow specialist ${id} effort`),
|
|
35
35
|
maxAttempts: positiveOptional(
|
|
@@ -64,7 +64,7 @@ export function resolveSpecialistAssignment(
|
|
|
64
64
|
prompt: `${profile.instructions}\n\nAssignment:\n${prompt}`,
|
|
65
65
|
opts: {
|
|
66
66
|
specialist: opts.specialist,
|
|
67
|
-
|
|
67
|
+
adapter: opts.adapter ?? profile.adapter,
|
|
68
68
|
model: opts.model ?? profile.model,
|
|
69
69
|
effort: opts.effort ?? profile.effort,
|
|
70
70
|
maxAttempts: opts.maxAttempts ?? profile.maxAttempts,
|
|
@@ -3,27 +3,27 @@ import { dirname, join, resolve } from "node:path";
|
|
|
3
3
|
import { fsyncParentDirectory, stableDigest } from "./durable-record.ts";
|
|
4
4
|
|
|
5
5
|
// Limit for the JSON record body. The trailing newline delimiter is outside the
|
|
6
|
-
// record and is not counted by readers after splitting
|
|
7
|
-
export const
|
|
6
|
+
// record and is not counted by readers after splitting transcript lines.
|
|
7
|
+
export const WORKFLOW_TRANSCRIPT_EVENT_BYTES = 16 * 1024;
|
|
8
8
|
|
|
9
9
|
/** Key under which a shrunk record names the fields it had to drop. */
|
|
10
|
-
export const
|
|
10
|
+
export const WORKFLOW_TRANSCRIPT_OMITTED = "omitted_fields";
|
|
11
11
|
|
|
12
12
|
const RUN_ID = /^[A-Za-z0-9][A-Za-z0-9._-]{0,199}$/;
|
|
13
13
|
|
|
14
|
-
export interface
|
|
14
|
+
export interface WorkflowTranscriptOmission {
|
|
15
15
|
field: string;
|
|
16
16
|
bytes: number;
|
|
17
17
|
sha256: string;
|
|
18
18
|
}
|
|
19
19
|
|
|
20
|
-
export function
|
|
20
|
+
export function workflowTranscriptPath(coordRoot: string, runId: string): string {
|
|
21
21
|
if (!RUN_ID.test(runId)) throw new Error(`invalid workflow run id ${JSON.stringify(runId)}`);
|
|
22
|
-
return join(resolve(coordRoot), ".harnery", "workflows", runId, "
|
|
22
|
+
return join(resolve(coordRoot), ".harnery", "workflows", runId, "transcript.jsonl");
|
|
23
23
|
}
|
|
24
24
|
|
|
25
25
|
/**
|
|
26
|
-
* Append one
|
|
26
|
+
* Append one transcript record, always.
|
|
27
27
|
*
|
|
28
28
|
* A record that would exceed what a reader accepts has its largest fields
|
|
29
29
|
* replaced by a digest and a byte count until it fits, and it names what it
|
|
@@ -35,14 +35,14 @@ export function workflowJournalPath(coordRoot: string, runId: string): string {
|
|
|
35
35
|
* this limit by construction. Losing detail from a record is recoverable.
|
|
36
36
|
* Losing the run that was writing it is not.
|
|
37
37
|
*/
|
|
38
|
-
export function
|
|
38
|
+
export function appendWorkflowTranscriptEvent(
|
|
39
39
|
coordRoot: string,
|
|
40
40
|
runId: string,
|
|
41
41
|
event: string,
|
|
42
42
|
data: Record<string, unknown>,
|
|
43
43
|
): void {
|
|
44
|
-
const path =
|
|
45
|
-
const record =
|
|
44
|
+
const path = workflowTranscriptPath(coordRoot, runId);
|
|
45
|
+
const record = fitWorkflowTranscriptRecord(
|
|
46
46
|
{ schema_version: 1, run_id: runId, ts: new Date().toISOString(), event },
|
|
47
47
|
data,
|
|
48
48
|
);
|
|
@@ -64,16 +64,16 @@ export function appendWorkflowJournalEvent(
|
|
|
64
64
|
* The envelope is never dropped, so a record keeps its run id, timestamp, and
|
|
65
65
|
* event name however much detail it loses. Exported for tests.
|
|
66
66
|
*/
|
|
67
|
-
export function
|
|
67
|
+
export function fitWorkflowTranscriptRecord(
|
|
68
68
|
envelope: Record<string, unknown>,
|
|
69
69
|
data: Record<string, unknown>,
|
|
70
70
|
): Record<string, unknown> {
|
|
71
71
|
const candidate = { ...envelope, ...data };
|
|
72
|
-
if (Buffer.byteLength(JSON.stringify(candidate)) <=
|
|
72
|
+
if (Buffer.byteLength(JSON.stringify(candidate)) <= WORKFLOW_TRANSCRIPT_EVENT_BYTES) {
|
|
73
73
|
return candidate;
|
|
74
74
|
}
|
|
75
75
|
const kept: Record<string, unknown> = { ...data };
|
|
76
|
-
const omitted:
|
|
76
|
+
const omitted: WorkflowTranscriptOmission[] = [];
|
|
77
77
|
const bySize = Object.keys(data)
|
|
78
78
|
.map((field) => ({ field, bytes: Buffer.byteLength(JSON.stringify(data[field]) ?? "") }))
|
|
79
79
|
.sort((a, b) => b.bytes - a.bytes);
|
|
@@ -81,10 +81,10 @@ export function fitWorkflowJournalRecord(
|
|
|
81
81
|
for (const { field, bytes } of bySize) {
|
|
82
82
|
omitted.push({ field, bytes, sha256: stableDigest(data[field]) });
|
|
83
83
|
delete kept[field];
|
|
84
|
-
const next = { ...envelope, ...kept, [
|
|
85
|
-
if (Buffer.byteLength(JSON.stringify(next)) <=
|
|
84
|
+
const next = { ...envelope, ...kept, [WORKFLOW_TRANSCRIPT_OMITTED]: omitted };
|
|
85
|
+
if (Buffer.byteLength(JSON.stringify(next)) <= WORKFLOW_TRANSCRIPT_EVENT_BYTES) return next;
|
|
86
86
|
}
|
|
87
87
|
// Every field dropped and still over: the omission list is itself the excess.
|
|
88
88
|
// Keep the envelope and a count so the record stays parseable and honest.
|
|
89
|
-
return { ...envelope, [
|
|
89
|
+
return { ...envelope, [WORKFLOW_TRANSCRIPT_OMITTED]: omitted.length };
|
|
90
90
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Workflow engine contracts. A workflow is a small throwaway JS script with
|
|
3
|
-
* bounded, schema-gated stages that fan work out to headless
|
|
3
|
+
* bounded, schema-gated stages that fan work out to headless adapter-CLI
|
|
4
4
|
* subagents; the SCRIPT (deterministic code), not any model, decides routing
|
|
5
5
|
* between stages, and the run always terminates when the script returns.
|
|
6
6
|
*
|
|
@@ -28,7 +28,18 @@ export const WORKFLOW_PROOF_SCHEMA_VERSION = 1 as const;
|
|
|
28
28
|
export const WORKFLOW_WORK_CONTEXT_SCHEMA_VERSION = 1 as const;
|
|
29
29
|
export const WORKFLOW_ATTEMPT_CONTEXT_SCHEMA_VERSION = 1 as const;
|
|
30
30
|
|
|
31
|
-
|
|
31
|
+
/** The evidence vocabulary, as a value so the runtime validator and the
|
|
32
|
+
* pre-flight source scan cannot drift from the type or from each other. */
|
|
33
|
+
export const EVIDENCE_KINDS = [
|
|
34
|
+
"test",
|
|
35
|
+
"command",
|
|
36
|
+
"artifact",
|
|
37
|
+
"change",
|
|
38
|
+
"review",
|
|
39
|
+
"observation",
|
|
40
|
+
] as const;
|
|
41
|
+
|
|
42
|
+
export type EvidenceKind = (typeof EVIDENCE_KINDS)[number];
|
|
32
43
|
export type EvidenceStatus = "passed" | "failed" | "observed" | "unknown";
|
|
33
44
|
export type EvidenceSource = "workflow" | "engine";
|
|
34
45
|
export type AcceptanceStatus = "satisfied" | "unsatisfied" | "unknown";
|
|
@@ -90,7 +101,7 @@ export interface WorkflowAgentProof {
|
|
|
90
101
|
label: string;
|
|
91
102
|
stage?: string;
|
|
92
103
|
specialist?: string;
|
|
93
|
-
|
|
104
|
+
adapter: AdapterName;
|
|
94
105
|
model?: string;
|
|
95
106
|
status: "succeeded" | "failed" | "cached";
|
|
96
107
|
attempts: number;
|
|
@@ -131,16 +142,16 @@ export interface WorkflowRepoEvidence {
|
|
|
131
142
|
};
|
|
132
143
|
}
|
|
133
144
|
|
|
134
|
-
/** Bounded pointer to the live attestation backing a
|
|
145
|
+
/** Bounded pointer to the live attestation backing a adapter's claims
|
|
135
146
|
* (ADR 0038). Structural facts only: no prompt text, no host paths. */
|
|
136
|
-
export interface
|
|
147
|
+
export interface AdapterAttestationCitation {
|
|
137
148
|
binary_version: string;
|
|
138
149
|
observed_at: string;
|
|
139
150
|
record_digest: string;
|
|
140
151
|
}
|
|
141
152
|
|
|
142
|
-
export interface
|
|
143
|
-
|
|
153
|
+
export interface AdapterEvidenceCoverage {
|
|
154
|
+
adapter: AdapterName;
|
|
144
155
|
tool_evidence: {
|
|
145
156
|
support: "supported" | "partial" | "unsupported" | "unknown";
|
|
146
157
|
note?: string;
|
|
@@ -150,10 +161,10 @@ export interface HarnessEvidenceCoverage {
|
|
|
150
161
|
session_ids: number;
|
|
151
162
|
costs: number;
|
|
152
163
|
};
|
|
153
|
-
/** What backs this
|
|
164
|
+
/** What backs this adapter's capability claims (ADR 0038). Absent when the
|
|
154
165
|
* host recorded no live attestation, which is the common case and is not by
|
|
155
166
|
* itself a proof unknown. */
|
|
156
|
-
attestation?:
|
|
167
|
+
attestation?: AdapterAttestationCitation;
|
|
157
168
|
}
|
|
158
169
|
|
|
159
170
|
export interface WorkflowSandboxProjectionEvidence {
|
|
@@ -166,12 +177,12 @@ export interface WorkflowSandboxProjectionEvidence {
|
|
|
166
177
|
export interface WorkflowProofUnknown {
|
|
167
178
|
code:
|
|
168
179
|
| "tool_evidence_unavailable"
|
|
169
|
-
| "
|
|
180
|
+
| "adapter_capability_unregistered"
|
|
170
181
|
| "agent_cost_unreported"
|
|
171
182
|
| "agent_session_unreported"
|
|
172
183
|
| "repository_drift_incomplete";
|
|
173
184
|
message: string;
|
|
174
|
-
|
|
185
|
+
adapter?: AdapterName;
|
|
175
186
|
agent_id?: string;
|
|
176
187
|
}
|
|
177
188
|
|
|
@@ -192,11 +203,16 @@ export interface WorkflowProof {
|
|
|
192
203
|
error?: string;
|
|
193
204
|
result?: ResultDigest;
|
|
194
205
|
/** Set on a failed run that was uninformative about the work (ADR 0046):
|
|
195
|
-
* environment or
|
|
196
|
-
* produced a result;
|
|
197
|
-
*
|
|
198
|
-
*
|
|
199
|
-
|
|
206
|
+
* environment, upstream, or decision. The first two are derived from the
|
|
207
|
+
* agents' classes when no agent produced a result; `decision` is declared by
|
|
208
|
+
* the script through ctx.blocked(). Absent ⇒ the attempt is charged as
|
|
209
|
+
* before. The durable work projection reads this to decide charging,
|
|
210
|
+
* stopping, and the uncharged-attempt bound. */
|
|
211
|
+
class?: RunFailureClass;
|
|
212
|
+
/** Docket id of the decision this run stopped on. Only ever set alongside
|
|
213
|
+
* class "decision", and only when the script named one. Carried so the work
|
|
214
|
+
* projection can point a human at the exact question rather than at prose. */
|
|
215
|
+
decision_id?: string;
|
|
200
216
|
};
|
|
201
217
|
acceptance: {
|
|
202
218
|
criteria: AcceptanceResult[];
|
|
@@ -212,11 +228,11 @@ export interface WorkflowProof {
|
|
|
212
228
|
* Absent means no projection was applied, which is the default. Present means
|
|
213
229
|
* the run can be audited for exactly what its children could write. */
|
|
214
230
|
sandbox_projection?: WorkflowSandboxProjectionEvidence;
|
|
215
|
-
|
|
231
|
+
adapters: AdapterEvidenceCoverage[];
|
|
216
232
|
unknowns: WorkflowProofUnknown[];
|
|
217
233
|
integrity: {
|
|
218
|
-
|
|
219
|
-
path: "
|
|
234
|
+
transcript: {
|
|
235
|
+
path: "transcript.jsonl";
|
|
220
236
|
sha256: string;
|
|
221
237
|
bytes: number;
|
|
222
238
|
};
|
|
@@ -239,8 +255,8 @@ export interface WorkflowPolicyProof {
|
|
|
239
255
|
};
|
|
240
256
|
}
|
|
241
257
|
|
|
242
|
-
export interface
|
|
243
|
-
toolEvidence:
|
|
258
|
+
export interface AdapterEvidenceCapability {
|
|
259
|
+
toolEvidence: AdapterEvidenceCoverage["tool_evidence"];
|
|
244
260
|
}
|
|
245
261
|
|
|
246
262
|
/** JSON-schema *subset* accepted by stage gates (see validate.ts). */
|
|
@@ -272,36 +288,36 @@ export interface AgentOpts {
|
|
|
272
288
|
* validate; the engine retries with the validation error appended, up to
|
|
273
289
|
* `maxAttempts`. Without it, `agent()` resolves to the raw reply text. */
|
|
274
290
|
schema?: StageSchema;
|
|
275
|
-
/** Model slug passed through to the
|
|
291
|
+
/** Model slug passed through to the adapter CLI (default: the CLI's default). */
|
|
276
292
|
model?: string;
|
|
277
|
-
/** Reasoning effort mapped through the selected
|
|
293
|
+
/** Reasoning effort mapped through the selected adapter profile. Unsupported
|
|
278
294
|
* values fail before the vendor process starts. */
|
|
279
295
|
effort?: string;
|
|
280
296
|
/** Attempt ceiling for the schema-retry loop (default 2). */
|
|
281
297
|
maxAttempts?: number;
|
|
282
298
|
/** Subprocess timeout ms (default 300_000). */
|
|
283
299
|
timeoutMs?: number;
|
|
284
|
-
/**
|
|
300
|
+
/** Adapter-turn ceiling for the child (default 25; use 1 for pure
|
|
285
301
|
* classification stages — cheaper and faster). */
|
|
286
302
|
maxTurns?: number;
|
|
287
|
-
/** Display label in the
|
|
303
|
+
/** Display label in the transcript (default: prompt head). */
|
|
288
304
|
label?: string;
|
|
289
|
-
/** Which
|
|
290
|
-
* Mixed-
|
|
305
|
+
/** Which adapter runs this agent (default: the run's default adapter).
|
|
306
|
+
* Mixed-adapter workflows are legal: triage on one CLI, deep work on
|
|
291
307
|
* another. */
|
|
292
|
-
|
|
308
|
+
adapter?: AdapterName;
|
|
293
309
|
}
|
|
294
310
|
|
|
295
311
|
/** Open registry key. The built-in catalog currently contains Claude Code,
|
|
296
312
|
* Codex, and Cursor; consumers may register another adapter without widening
|
|
297
313
|
* a package-owned union first. */
|
|
298
|
-
export type
|
|
314
|
+
export type AdapterName = string;
|
|
299
315
|
|
|
300
|
-
/** Durable role defaults supplied by a goal
|
|
316
|
+
/** Durable role defaults supplied by a goal governor or embedding host.
|
|
301
317
|
* Profiles are frozen into a workflow run manifest before the first spawn. */
|
|
302
318
|
export interface WorkflowSpecialistProfile {
|
|
303
319
|
instructions: string;
|
|
304
|
-
|
|
320
|
+
adapter?: AdapterName;
|
|
305
321
|
model?: string;
|
|
306
322
|
effort?: string;
|
|
307
323
|
maxAttempts?: number;
|
|
@@ -322,12 +338,30 @@ export interface WorkflowSpecialistProfile {
|
|
|
322
338
|
*/
|
|
323
339
|
export type SpawnFailureClass = "environment" | "upstream";
|
|
324
340
|
|
|
341
|
+
/**
|
|
342
|
+
* Why a failed run was uninformative about the work. A superset of
|
|
343
|
+
* {@link SpawnFailureClass}: a spawn can fail for reasons outside the work, and
|
|
344
|
+
* so can the script itself.
|
|
345
|
+
*
|
|
346
|
+
* - `decision`: the script reached a correct conclusion and that conclusion is
|
|
347
|
+
* that a human must rule before the work can proceed. Nothing about the work
|
|
348
|
+
* was wrong, so the attempt is uncharged; nothing about a retry can help,
|
|
349
|
+
* because the blocker is a person, so the item stops and names the decision.
|
|
350
|
+
*
|
|
351
|
+
* This class exists because without it a correct refusal and a botched attempt
|
|
352
|
+
* are the same outcome to the engine. Automatic retry then re-issues work an
|
|
353
|
+
* agent already answered correctly, once per attempt budget, and the answer is
|
|
354
|
+
* identical every time — the loop cannot converge, because the thing it is
|
|
355
|
+
* waiting for is a person who was never told.
|
|
356
|
+
*/
|
|
357
|
+
export type RunFailureClass = SpawnFailureClass | "decision";
|
|
358
|
+
|
|
325
359
|
/** What a spawn adapter returns for one subagent run. */
|
|
326
360
|
export interface SpawnResult {
|
|
327
361
|
ok: boolean;
|
|
328
362
|
/** The model's final reply text (envelope-unwrapped). */
|
|
329
363
|
text: string;
|
|
330
|
-
/** Child
|
|
364
|
+
/** Child adapter session id when the envelope carries one. */
|
|
331
365
|
sessionId?: string;
|
|
332
366
|
costUsd?: number;
|
|
333
367
|
durationMs: number;
|
|
@@ -348,6 +382,10 @@ export interface SpawnRequest {
|
|
|
348
382
|
/** Run id, stamped into the child env (HARNERY_WORKFLOW_RUN_ID) so the
|
|
349
383
|
* coord layer can associate child sessions with their workflow run. */
|
|
350
384
|
runId?: string;
|
|
385
|
+
/** Transcript agent id (`a1`, `a2`, …), stamped into the child env
|
|
386
|
+
* (HARNERY_WORKFLOW_AGENT_ID) so in-flight child activity attributes to one
|
|
387
|
+
* agent row rather than only to the run. */
|
|
388
|
+
agentId?: string;
|
|
351
389
|
/** Scrub all API-key vars from the child env so it can only authenticate
|
|
352
390
|
* via its stored (subscription) login. See billing.ts. */
|
|
353
391
|
subscriptionOnly?: boolean;
|
|
@@ -397,14 +435,33 @@ export interface WorkflowContext {
|
|
|
397
435
|
agent: (prompt: string, opts?: AgentOpts) => Promise<unknown>;
|
|
398
436
|
/** Run thunks with bounded concurrency; a rejected thunk resolves to null. */
|
|
399
437
|
parallel: <T>(thunks: Array<() => Promise<T>>) => Promise<Array<T | null>>;
|
|
400
|
-
/** Declare the current stage (
|
|
438
|
+
/** Declare the current stage (transcript + progress grouping). */
|
|
401
439
|
stage: (title: string) => void;
|
|
402
|
-
/** Narrate progress (stderr +
|
|
440
|
+
/** Narrate progress (stderr + transcript). */
|
|
403
441
|
log: (message: string) => void;
|
|
404
442
|
/** Attach a bounded, sourced receipt to the run and optional acceptance criteria. */
|
|
405
443
|
evidence: (input: WorkflowEvidenceInput) => string;
|
|
406
444
|
/** Authorize one host-mediated external mutation before performing it. */
|
|
407
445
|
authorize: (input: ExternalMutationRequest) => Promise<PolicyDecision>;
|
|
446
|
+
/** Stop the run because a human must rule before the work can proceed.
|
|
447
|
+
*
|
|
448
|
+
* This is not a failure and must not be used as one. Reach for it only when
|
|
449
|
+
* the script determined something *correct* — that the question in front of
|
|
450
|
+
* it belongs to a person. The run ends uncharged and the work item stops
|
|
451
|
+
* naming the decision, so no automatic retry re-issues work that was already
|
|
452
|
+
* answered correctly. A plain `throw` means the opposite: the work failed and
|
|
453
|
+
* a retry might do better. */
|
|
454
|
+
blocked: (input: BlockedInput) => never;
|
|
455
|
+
}
|
|
456
|
+
|
|
457
|
+
/** Why a run stopped on a human. */
|
|
458
|
+
export interface BlockedInput {
|
|
459
|
+
/** What a human has to settle, in one sentence. Shown verbatim to the
|
|
460
|
+
* operator as the work item's reason, so write it for them, not for a log. */
|
|
461
|
+
reason: string;
|
|
462
|
+
/** Docket id of the decision to resolve. Strongly preferred: without it the
|
|
463
|
+
* operator gets prose and has to go find the question themselves. */
|
|
464
|
+
decision?: string;
|
|
408
465
|
}
|
|
409
466
|
|
|
410
467
|
export interface WorkflowMeta {
|
|
@@ -469,18 +526,18 @@ export interface WorkflowOperatorFinding {
|
|
|
469
526
|
}
|
|
470
527
|
|
|
471
528
|
export interface EngineOpts {
|
|
472
|
-
/** Repo root whose .harnery/ receives the run
|
|
529
|
+
/** Repo root whose .harnery/ receives the run transcript. */
|
|
473
530
|
coordRoot: string;
|
|
474
|
-
/** Spawner registry keyed by
|
|
475
|
-
* entry and names it in `
|
|
476
|
-
spawners: Readonly<Record<
|
|
477
|
-
/**
|
|
478
|
-
|
|
531
|
+
/** Spawner registry keyed by adapter. A single-adapter caller registers one
|
|
532
|
+
* entry and names it in `defaultAdapter`. */
|
|
533
|
+
spawners: Readonly<Record<AdapterName, Spawner | undefined>>;
|
|
534
|
+
/** Adapter used when an agent() call doesn't name one (default "claude-code"). */
|
|
535
|
+
defaultAdapter?: AdapterName;
|
|
479
536
|
/** Named specialist roles available to agent(..., { specialist }). */
|
|
480
537
|
specialists?: Readonly<Record<string, WorkflowSpecialistProfile>>;
|
|
481
|
-
/** Resume: run id of a prior run whose
|
|
538
|
+
/** Resume: run id of a prior run whose transcript supplies cached results.
|
|
482
539
|
* agent() calls whose (stage, prompt, model, maxTurns, schema) key matches a
|
|
483
|
-
* completed prior agent return the
|
|
540
|
+
* completed prior agent return the transcripted result without spawning. */
|
|
484
541
|
resumeFrom?: string;
|
|
485
542
|
/** Continue a parked run in its original directory after its durable
|
|
486
543
|
* approval has been resolved. The frozen run manifest supplies execution
|
|
@@ -505,7 +562,7 @@ export interface EngineOpts {
|
|
|
505
562
|
/** Progress sink (default: process.stderr). */
|
|
506
563
|
onLog?: (line: string) => void;
|
|
507
564
|
/** Guarantee subscription billing: API-key vars are scrubbed from every
|
|
508
|
-
* child env, and a
|
|
565
|
+
* child env, and a adapter whose stored login is provably absent fails
|
|
509
566
|
* loud before spawning. */
|
|
510
567
|
subscriptionOnly?: boolean;
|
|
511
568
|
/** Permit the api-key-override billing state (an exported API key silently
|
|
@@ -517,10 +574,10 @@ export interface EngineOpts {
|
|
|
517
574
|
probeBilling?: BillingProber;
|
|
518
575
|
/** Capability claims used to state whether adapter-native tool evidence was
|
|
519
576
|
* available. Missing claims remain unknown. */
|
|
520
|
-
|
|
521
|
-
/** Live attestations backing each
|
|
577
|
+
adapterEvidence?: Readonly<Record<AdapterName, AdapterEvidenceCapability | undefined>>;
|
|
578
|
+
/** Live attestations backing each adapter's claims (ADR 0038). Read once by
|
|
522
579
|
* the host and injected, so the engine performs no capability lookups. */
|
|
523
|
-
|
|
580
|
+
adapterAttestations?: Readonly<Record<AdapterName, AdapterAttestationCitation | undefined>>;
|
|
524
581
|
/** Filesystem policy projected into every child's own vendor sandbox
|
|
525
582
|
* (ADR 0039). Validated against the workspace binding before the first spawn,
|
|
526
583
|
* and recorded in proof. Absent leaves every adapter invocation unchanged. */
|
|
@@ -551,7 +608,7 @@ export interface EngineOpts {
|
|
|
551
608
|
approvalAddressee?: string;
|
|
552
609
|
/** Execution boundary created by the host (default shared). */
|
|
553
610
|
isolation?: PolicyIsolation;
|
|
554
|
-
/** Network state of spawned
|
|
611
|
+
/** Network state of spawned adapter subprocesses (default unknown). */
|
|
555
612
|
networkAccess?: PolicyNetworkAccess;
|
|
556
613
|
/** Explicit provider and host-owned roots. Omit for shared or declaration-only execution. */
|
|
557
614
|
workspace?: {
|
|
@@ -567,19 +624,19 @@ export interface RunReport {
|
|
|
567
624
|
/** What the script's default export returned. */
|
|
568
625
|
result: unknown;
|
|
569
626
|
agentsSpawned: number;
|
|
570
|
-
/** agent() calls satisfied from the resumeFrom
|
|
627
|
+
/** agent() calls satisfied from the resumeFrom transcript without spawning. */
|
|
571
628
|
agentsCached: number;
|
|
572
629
|
costUsd: number;
|
|
573
630
|
durationMs: number;
|
|
574
|
-
|
|
631
|
+
transcriptPath: string;
|
|
575
632
|
proofPath: string;
|
|
576
633
|
acceptance: AcceptanceSummary;
|
|
577
634
|
/** Estimated tokens of repo instructions (CLAUDE.md/AGENTS.md at the child
|
|
578
635
|
* cwd) that EVERY child cache-writes on spawn — the fixed per-child context
|
|
579
636
|
* overhead a fan-out multiplies. bytes/4 heuristic; 0 when no such file. */
|
|
580
637
|
contextTokensPerChildEstimate: number;
|
|
581
|
-
/** Billing mode per
|
|
582
|
-
billing: Array<{
|
|
638
|
+
/** Billing mode per adapter actually used this run (probed on first use). */
|
|
639
|
+
billing: Array<{ adapter: AdapterName; mode: BillingMode }>;
|
|
583
640
|
/** Policy verdict totals when the host supplied a policy. */
|
|
584
641
|
policy?: WorkflowPolicyProof["summary"];
|
|
585
642
|
/** Isolated workspace binding when this run requested a provider capability. */
|
|
@@ -114,7 +114,7 @@ export function validateAgainstSchema(value: unknown, schema: StageSchema, path
|
|
|
114
114
|
/**
|
|
115
115
|
* Parse one schema-gated JSON value.
|
|
116
116
|
*
|
|
117
|
-
* Exact JSON and a whole fenced value remain the normal paths. Some
|
|
117
|
+
* Exact JSON and a whole fenced value remain the normal paths. Some adapters
|
|
118
118
|
* prepend a short narration despite an explicit JSON-only contract. Accept
|
|
119
119
|
* that drift only when the reply contains exactly one unambiguous top-level
|
|
120
120
|
* object or array, the value reaches the end of the reply, and JSON.parse
|
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
} from "../../work/state.ts";
|
|
6
6
|
import { readWorkflowRunManifest } from "../run-state.ts";
|
|
7
7
|
import {
|
|
8
|
-
|
|
8
|
+
appendWorkflowTranscriptEvent,
|
|
9
9
|
readWorkflowSupplement,
|
|
10
10
|
stableDigest,
|
|
11
11
|
writeWorkflowSupplement,
|
|
@@ -72,7 +72,7 @@ export async function cancelWorkspace(
|
|
|
72
72
|
reason: result.reason,
|
|
73
73
|
};
|
|
74
74
|
writeWorkflowSupplement(input.coordRoot, input.runId, "cancellation/outcome.json", receipt);
|
|
75
|
-
|
|
75
|
+
appendWorkflowTranscriptEvent(input.coordRoot, input.runId, "workspace.cancel", {
|
|
76
76
|
binding_id: binding.binding_id,
|
|
77
77
|
provider_id: binding.provider.id,
|
|
78
78
|
receipt_id: receipt.receipt_id,
|
|
@@ -5,7 +5,7 @@ import { acquireNoClobberLease } from "./leases.ts";
|
|
|
5
5
|
import { containsPath } from "./paths.ts";
|
|
6
6
|
import {
|
|
7
7
|
appendCleanupAttempt,
|
|
8
|
-
|
|
8
|
+
appendWorkflowTranscriptEvent,
|
|
9
9
|
readCleanupAttempts,
|
|
10
10
|
readWorkflowSupplement,
|
|
11
11
|
stableDigest,
|
|
@@ -112,7 +112,7 @@ async function cleanupWorkspaceUnderLease(
|
|
|
112
112
|
reason: result.reason,
|
|
113
113
|
recorded_at: result.recorded_at,
|
|
114
114
|
});
|
|
115
|
-
|
|
115
|
+
appendWorkflowTranscriptEvent(input.coordRoot, input.runId, "workspace.cleanup", {
|
|
116
116
|
binding_id: binding.binding_id,
|
|
117
117
|
provider_id: binding.provider.id,
|
|
118
118
|
operation_id: intent.operation_id,
|