harnery 0.29.0 → 0.31.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -4
- package/dist/commander.d.ts +8 -0
- package/dist/commander.d.ts.map +1 -1
- package/dist/commander.js +14 -13
- package/dist/commands/adapter.d.ts +12 -0
- package/dist/commands/adapter.d.ts.map +1 -0
- package/dist/commands/{harness.js → adapter.js} +35 -35
- package/dist/commands/agents.d.ts +3 -2
- package/dist/commands/agents.d.ts.map +1 -1
- package/dist/commands/agents.js +61 -60
- package/dist/commands/artifacts.d.ts +4 -0
- package/dist/commands/artifacts.d.ts.map +1 -0
- package/dist/commands/artifacts.js +143 -0
- package/dist/commands/backup.d.ts +1 -1
- package/dist/commands/backup.d.ts.map +1 -1
- package/dist/commands/backup.js +5 -2
- package/dist/commands/browse.d.ts.map +1 -1
- package/dist/commands/browse.js +310 -7
- package/dist/commands/checkpoint.d.ts +12 -0
- package/dist/commands/checkpoint.d.ts.map +1 -0
- package/dist/commands/checkpoint.js +162 -0
- package/dist/commands/context.d.ts +2 -2
- package/dist/commands/context.d.ts.map +1 -1
- package/dist/commands/context.js +3 -151
- package/dist/commands/decision.d.ts.map +1 -1
- package/dist/commands/decision.js +31 -7
- package/dist/commands/deinit.d.ts +2 -2
- package/dist/commands/deinit.js +15 -15
- package/dist/commands/doctor.js +23 -23
- package/dist/commands/governor.d.ts +4 -0
- package/dist/commands/governor.d.ts.map +1 -0
- package/dist/commands/{supervisor.js → governor.js} +133 -108
- package/dist/commands/init.d.ts +12 -12
- package/dist/commands/init.d.ts.map +1 -1
- package/dist/commands/init.js +44 -30
- package/dist/commands/{session.d.ts → journal.d.ts} +2 -2
- package/dist/commands/journal.d.ts.map +1 -0
- package/dist/commands/{scratch.js → journal.js} +47 -47
- package/dist/commands/policy.js +1 -1
- package/dist/commands/presence.js +2 -2
- package/dist/commands/sync.d.ts +1 -1
- package/dist/commands/sync.js +3 -3
- package/dist/commands/tunnel.d.ts +16 -0
- package/dist/commands/tunnel.d.ts.map +1 -1
- package/dist/commands/tunnel.js +193 -23
- package/dist/commands/web-fetch.js +1 -1
- package/dist/commands/web.d.ts +19 -0
- package/dist/commands/web.d.ts.map +1 -1
- package/dist/commands/web.js +51 -0
- package/dist/commands/work.d.ts +2 -1
- package/dist/commands/work.d.ts.map +1 -1
- package/dist/commands/work.js +55 -25
- package/dist/commands/workflow.d.ts.map +1 -1
- package/dist/commands/workflow.js +35 -28
- package/dist/core/{harnesses → adapters}/attest-projection.d.ts +2 -2
- package/dist/core/adapters/attest-projection.d.ts.map +1 -0
- package/dist/core/{harnesses → adapters}/attest.d.ts +16 -16
- package/dist/core/adapters/attest.d.ts.map +1 -0
- package/dist/core/{harnesses → adapters}/attest.js +9 -9
- package/dist/core/{harnesses → adapters}/attestation.d.ts +16 -16
- package/dist/core/adapters/attestation.d.ts.map +1 -0
- package/dist/core/{harnesses → adapters}/attestation.js +20 -20
- package/dist/core/{harnesses → adapters}/bench.d.ts +12 -12
- package/dist/core/adapters/bench.d.ts.map +1 -0
- package/dist/core/{harnesses → adapters}/bench.js +12 -12
- package/dist/core/adapters/index.d.ts +13 -0
- package/dist/core/adapters/index.d.ts.map +1 -0
- package/dist/core/adapters/index.js +6 -0
- package/dist/core/{harnesses → adapters}/profiles.d.ts +11 -11
- package/dist/core/adapters/profiles.d.ts.map +1 -0
- package/dist/core/{harnesses → adapters}/profiles.js +11 -11
- package/dist/core/adapters/registry.d.ts +15 -0
- package/dist/core/adapters/registry.d.ts.map +1 -0
- package/dist/core/{harnesses → adapters}/registry.js +11 -11
- package/dist/core/{harnesses → adapters}/types.d.ts +28 -23
- package/dist/core/adapters/types.d.ts.map +1 -0
- package/dist/core/{harnesses → adapters}/types.js +1 -1
- package/dist/core/agents/canonical-emit.d.ts +4 -4
- package/dist/core/agents/canonical-emit.js +5 -5
- package/dist/core/agents/cli-emit.js +1 -1
- package/dist/core/agents/cli.js +30 -26
- package/dist/core/agents/codex-replay.d.ts +1 -1
- package/dist/core/agents/codex-replay.js +6 -6
- package/dist/core/agents/coord-client.d.ts +21 -2
- package/dist/core/agents/coord-client.d.ts.map +1 -1
- package/dist/core/agents/coord-client.js +122 -27
- package/dist/core/agents/events/consume.d.ts +1 -1
- package/dist/core/agents/events/emit.d.ts +5 -6
- package/dist/core/agents/events/emit.d.ts.map +1 -1
- package/dist/core/agents/events/emit.js +2 -2
- package/dist/core/agents/render/prompt-context.d.ts +21 -9
- package/dist/core/agents/render/prompt-context.d.ts.map +1 -1
- package/dist/core/agents/render/prompt-context.js +82 -30
- package/dist/core/agents/render/session-context.d.ts +1 -1
- package/dist/core/agents/render/session-context.js +5 -5
- package/dist/core/agents/rules/claim-conflict.d.ts +2 -6
- package/dist/core/agents/rules/claim-conflict.d.ts.map +1 -1
- package/dist/core/agents/rules/claim-conflict.js +1 -1
- package/dist/core/agents/rules/commit-conflict.js +98 -22
- package/dist/core/agents/rules/stop-hook.d.ts +9 -9
- package/dist/core/agents/rules/stop-hook.d.ts.map +1 -1
- package/dist/core/agents/rules/stop-hook.js +23 -5
- package/dist/core/agents/rules/verdict.d.ts +14 -0
- package/dist/core/agents/rules/verdict.d.ts.map +1 -0
- package/dist/core/agents/rules/verdict.js +1 -0
- package/dist/core/agents/session-events.js +3 -3
- package/dist/core/agents/state/council.d.ts +1 -1
- package/dist/core/agents/state/council.js +1 -1
- package/dist/core/agents/state/heartbeat-projector.d.ts +3 -2
- package/dist/core/agents/state/heartbeat-projector.d.ts.map +1 -1
- package/dist/core/agents/state/heartbeat-projector.js +14 -10
- package/dist/core/agents/state/heartbeat-writer.d.ts +1 -1
- package/dist/core/agents/state/heartbeat-writer.js +12 -12
- package/dist/core/agents/state/{scratch.d.ts → journal.d.ts} +7 -7
- package/dist/core/agents/state/{scratch.d.ts.map → journal.d.ts.map} +1 -1
- package/dist/core/agents/state/{scratch.js → journal.js} +12 -12
- package/dist/core/agents/state/pidmap.d.ts +28 -4
- package/dist/core/agents/state/pidmap.d.ts.map +1 -1
- package/dist/core/agents/state/pidmap.js +130 -15
- package/dist/core/agents/state/proc-start.d.ts +95 -0
- package/dist/core/agents/state/proc-start.d.ts.map +1 -0
- package/dist/core/agents/state/proc-start.js +199 -0
- package/dist/core/agents/state/shell-mutation.d.ts +1 -1
- package/dist/core/agents/state/shell-mutation.js +1 -1
- package/dist/core/agents/state/stale-sweep.js +7 -7
- package/dist/core/artifacts/index.d.ts +86 -0
- package/dist/core/artifacts/index.d.ts.map +1 -0
- package/dist/core/artifacts/index.js +421 -0
- package/dist/core/config.d.ts +9 -2
- package/dist/core/config.d.ts.map +1 -1
- package/dist/core/config.js +26 -2
- package/dist/core/context/index.d.ts +12 -12
- package/dist/core/context/index.js +10 -10
- package/dist/core/governor/adapter-spread.d.ts +52 -0
- package/dist/core/governor/adapter-spread.d.ts.map +1 -0
- package/dist/core/governor/adapter-spread.js +52 -0
- package/dist/core/governor/index.d.ts +7 -0
- package/dist/core/governor/index.d.ts.map +1 -0
- package/dist/core/governor/index.js +6 -0
- package/dist/core/governor/plan-api.d.ts +38 -0
- package/dist/core/governor/plan-api.d.ts.map +1 -0
- package/dist/core/governor/plan-api.js +83 -0
- package/dist/core/governor/plan-read.d.ts +5 -0
- package/dist/core/governor/plan-read.d.ts.map +1 -0
- package/dist/core/{supervisor → governor}/plan-read.js +71 -51
- package/dist/core/governor/plan-types.d.ts +181 -0
- package/dist/core/governor/plan-types.d.ts.map +1 -0
- package/dist/core/{supervisor → governor}/plan-types.js +4 -4
- package/dist/core/governor/planning.d.ts +48 -0
- package/dist/core/governor/planning.d.ts.map +1 -0
- package/dist/core/{supervisor → governor}/planning.js +143 -94
- package/dist/core/governor/read.d.ts +6 -0
- package/dist/core/governor/read.d.ts.map +1 -0
- package/dist/core/governor/read.js +4 -0
- package/dist/core/governor/runner.d.ts +37 -0
- package/dist/core/governor/runner.d.ts.map +1 -0
- package/dist/core/{supervisor → governor}/runner.js +15 -15
- package/dist/core/governor/service-read.d.ts +6 -0
- package/dist/core/governor/service-read.d.ts.map +1 -0
- package/dist/core/{supervisor → governor}/service-read.js +12 -12
- package/dist/core/governor/service.d.ts +114 -0
- package/dist/core/governor/service.d.ts.map +1 -0
- package/dist/core/{supervisor → governor}/service.js +57 -57
- package/dist/core/governor/state.d.ts +116 -0
- package/dist/core/governor/state.d.ts.map +1 -0
- package/dist/core/{supervisor → governor}/state.js +290 -116
- package/dist/core/hooks/adapter/detect.d.ts +9 -0
- package/dist/core/hooks/{harness → adapter}/detect.d.ts.map +1 -1
- package/dist/core/hooks/{harness → adapter}/detect.js +8 -8
- package/dist/core/hooks/{harness → adapter}/events.d.ts +15 -14
- package/dist/core/hooks/adapter/events.d.ts.map +1 -0
- package/dist/core/hooks/{harness → adapter}/events.js +5 -5
- package/dist/core/hooks/{harness → adapter}/output.d.ts +20 -14
- package/dist/core/hooks/adapter/output.d.ts.map +1 -0
- package/dist/core/hooks/{harness → adapter}/output.js +30 -22
- package/dist/core/hooks/{harness → adapter}/parse.d.ts +5 -5
- package/dist/core/hooks/{harness → adapter}/parse.d.ts.map +1 -1
- package/dist/core/hooks/{harness → adapter}/parse.js +4 -4
- package/dist/core/hooks/{harness → adapter}/wiring.d.ts +15 -15
- package/dist/core/hooks/{harness → adapter}/wiring.d.ts.map +1 -1
- package/dist/core/hooks/{harness → adapter}/wiring.js +13 -13
- package/dist/core/hooks/cli.d.ts +3 -3
- package/dist/core/hooks/cli.js +175 -151
- package/dist/core/hooks/effects/image-capture.d.ts +5 -5
- package/dist/core/hooks/effects/image-capture.d.ts.map +1 -1
- package/dist/core/hooks/effects/image-capture.js +3 -3
- package/dist/core/hooks/effects/index.d.ts +12 -12
- package/dist/core/hooks/effects/index.d.ts.map +1 -1
- package/dist/core/hooks/effects/index.js +17 -17
- package/dist/core/hooks/events/emit.d.ts +2 -2
- package/dist/core/hooks/events/emit.d.ts.map +1 -1
- package/dist/core/hooks/events/emit.js +1 -1
- package/dist/core/hooks/events/rotate.js +1 -1
- package/dist/core/hooks/events/schema.d.ts +13 -5
- package/dist/core/hooks/events/schema.d.ts.map +1 -1
- package/dist/core/hooks/guard-path.d.ts +2 -2
- package/dist/core/hooks/guard-path.js +2 -2
- package/dist/core/hooks/index.d.ts +1 -1
- package/dist/core/hooks/index.d.ts.map +1 -1
- package/dist/core/hooks/resolve/anchor.d.ts +14 -5
- package/dist/core/hooks/resolve/anchor.d.ts.map +1 -1
- package/dist/core/hooks/resolve/anchor.js +64 -7
- package/dist/core/hooks/resolve/coord-root.d.ts +3 -3
- package/dist/core/hooks/resolve/coord-root.js +4 -4
- package/dist/core/hooks/resolve/intent.js +1 -1
- package/dist/core/hooks/resolve/owner.d.ts +1 -1
- package/dist/core/hooks/resolve/owner.d.ts.map +1 -1
- package/dist/core/hooks/resolve/owner.js +11 -5
- package/dist/core/{scratch → journal}/index.d.ts +25 -25
- package/dist/core/{scratch → journal}/index.d.ts.map +1 -1
- package/dist/core/{scratch → journal}/index.js +38 -38
- package/dist/core/policy/evaluate.d.ts +1 -1
- package/dist/core/policy/evaluate.d.ts.map +1 -1
- package/dist/core/policy/evaluate.js +7 -7
- package/dist/core/policy/types.d.ts +3 -3
- package/dist/core/policy/types.d.ts.map +1 -1
- package/dist/core/work/runner.d.ts.map +1 -1
- package/dist/core/work/runner.js +11 -2
- package/dist/core/work/state.d.ts +28 -3
- package/dist/core/work/state.d.ts.map +1 -1
- package/dist/core/work/state.js +148 -16
- package/dist/core/workflow/adapters.d.ts +17 -0
- package/dist/core/workflow/adapters.d.ts.map +1 -0
- package/dist/core/workflow/adapters.js +21 -0
- package/dist/core/workflow/approvals.js +6 -6
- package/dist/core/workflow/billing.d.ts +9 -9
- package/dist/core/workflow/billing.js +9 -9
- package/dist/core/workflow/child-env.d.ts +10 -2
- package/dist/core/workflow/child-env.d.ts.map +1 -1
- package/dist/core/workflow/child-env.js +12 -4
- package/dist/core/workflow/engine.d.ts +15 -5
- package/dist/core/workflow/engine.d.ts.map +1 -1
- package/dist/core/workflow/engine.js +151 -83
- package/dist/core/workflow/evidence-preflight.d.ts +24 -0
- package/dist/core/workflow/evidence-preflight.d.ts.map +1 -0
- package/dist/core/workflow/evidence-preflight.js +134 -0
- package/dist/core/workflow/index.d.ts +3 -2
- package/dist/core/workflow/index.d.ts.map +1 -1
- package/dist/core/workflow/index.js +2 -1
- package/dist/core/workflow/proof.d.ts +28 -5
- package/dist/core/workflow/proof.d.ts.map +1 -1
- package/dist/core/workflow/proof.js +77 -34
- package/dist/core/workflow/run-state.d.ts +1 -1
- package/dist/core/workflow/run-state.js +7 -7
- package/dist/core/workflow/sandbox-projection.d.ts +6 -6
- package/dist/core/workflow/sandbox-projection.d.ts.map +1 -1
- package/dist/core/workflow/sandbox-projection.js +11 -11
- package/dist/core/workflow/spawn-claude.d.ts +3 -3
- package/dist/core/workflow/spawn-claude.d.ts.map +1 -1
- package/dist/core/workflow/spawn-claude.js +28 -8
- package/dist/core/workflow/spawn-codex.d.ts +4 -4
- package/dist/core/workflow/spawn-codex.d.ts.map +1 -1
- package/dist/core/workflow/spawn-codex.js +26 -8
- package/dist/core/workflow/spawn-cursor.d.ts +4 -4
- package/dist/core/workflow/spawn-cursor.d.ts.map +1 -1
- package/dist/core/workflow/spawn-cursor.js +27 -8
- package/dist/core/workflow/spawn-failure.d.ts +15 -1
- package/dist/core/workflow/spawn-failure.d.ts.map +1 -1
- package/dist/core/workflow/spawn-failure.js +35 -1
- package/dist/core/workflow/specialists.js +2 -2
- package/dist/core/workflow/{journal.d.ts → transcript.d.ts} +8 -8
- package/dist/core/workflow/transcript.d.ts.map +1 -0
- package/dist/core/workflow/{journal.js → transcript.js} +14 -14
- package/dist/core/workflow/types.d.ts +119 -46
- package/dist/core/workflow/types.d.ts.map +1 -1
- package/dist/core/workflow/types.js +11 -1
- package/dist/core/workflow/validate.d.ts +1 -1
- package/dist/core/workflow/validate.js +1 -1
- package/dist/core/workflow/workspaces/cancellation.js +2 -2
- package/dist/core/workflow/workspaces/cleanup.js +2 -2
- package/dist/core/workflow/workspaces/execution.js +6 -6
- package/dist/core/workflow/workspaces/inspect.js +9 -9
- package/dist/core/workflow/workspaces/integration.js +14 -14
- package/dist/core/workflow/workspaces/lifecycle.d.ts +1 -1
- package/dist/core/workflow/workspaces/lifecycle.d.ts.map +1 -1
- package/dist/core/workflow/workspaces/lifecycle.js +9 -9
- package/dist/core/workflow/workspaces/local-git.d.ts.map +1 -1
- package/dist/core/workflow/workspaces/local-git.js +39 -5
- package/dist/core/workflow/workspaces/recovery.js +3 -3
- package/dist/core/workflow/workspaces/state.d.ts +1 -1
- package/dist/core/workflow/workspaces/state.d.ts.map +1 -1
- package/dist/core/workflow/workspaces/state.js +3 -3
- package/dist/core/workflow/workspaces/types.d.ts +1 -1
- package/dist/core/workflow/workspaces/types.d.ts.map +1 -1
- package/dist/lib/browser/asserts.d.ts +28 -0
- package/dist/lib/browser/asserts.d.ts.map +1 -0
- package/dist/lib/browser/asserts.js +152 -0
- package/dist/lib/browser/client.d.ts +49 -0
- package/dist/lib/browser/client.d.ts.map +1 -1
- package/dist/lib/browser/client.js +155 -14
- package/dist/lib/browser/content-checks.d.ts +108 -0
- package/dist/lib/browser/content-checks.d.ts.map +1 -0
- package/dist/lib/browser/content-checks.js +474 -0
- package/dist/lib/browser/critique.d.ts +91 -0
- package/dist/lib/browser/critique.d.ts.map +1 -0
- package/dist/lib/browser/critique.js +167 -0
- package/dist/lib/browser/geometry.d.ts +32 -0
- package/dist/lib/browser/geometry.d.ts.map +1 -1
- package/dist/lib/browser/geometry.js +244 -1
- package/dist/lib/browser/index.d.ts +4 -1
- package/dist/lib/browser/index.d.ts.map +1 -1
- package/dist/lib/browser/index.js +2 -0
- package/dist/lib/claude-desktop.d.ts.map +1 -1
- package/dist/lib/claude-desktop.js +4 -1
- package/dist/lib/council/index.d.ts +6 -6
- package/dist/lib/council/index.d.ts.map +1 -1
- package/dist/lib/council/index.js +8 -8
- package/dist/lib/exec.d.ts +7 -0
- package/dist/lib/exec.d.ts.map +1 -1
- package/dist/lib/exec.js +6 -3
- package/dist/lib/identities/assume.d.ts +2 -2
- package/dist/lib/identities/assume.js +7 -7
- package/dist/lib/instructions/apply.d.ts +3 -3
- package/dist/lib/instructions/apply.d.ts.map +1 -1
- package/dist/lib/instructions/apply.js +75 -27
- package/dist/lib/instructions/host-addendum.d.ts +54 -0
- package/dist/lib/instructions/host-addendum.d.ts.map +1 -0
- package/dist/lib/instructions/host-addendum.js +107 -0
- package/dist/lib/instructions/templates.d.ts +10 -3
- package/dist/lib/instructions/templates.d.ts.map +1 -1
- package/dist/lib/instructions/templates.js +41 -12
- package/dist/lib/machine.d.ts +2 -2
- package/dist/lib/machine.js +2 -2
- package/package.json +26 -21
- package/schemas/config.schema.json +26 -1
- package/src/commander.ts +22 -13
- package/src/commands/{harness.ts → adapter.ts} +46 -46
- package/src/commands/agents.ts +71 -64
- package/src/commands/artifacts.ts +168 -0
- package/src/commands/backup.ts +47 -33
- package/src/commands/browse.ts +438 -2
- package/src/commands/checkpoint.ts +196 -0
- package/src/commands/context.ts +3 -176
- package/src/commands/decision.ts +41 -7
- package/src/commands/deinit.ts +16 -16
- package/src/commands/doctor.ts +28 -28
- package/src/commands/{supervisor.ts → governor.ts} +184 -154
- package/src/commands/init.ts +50 -34
- package/src/commands/{scratch.ts → journal.ts} +60 -60
- package/src/commands/policy.ts +1 -1
- package/src/commands/presence.ts +2 -2
- package/src/commands/sync.ts +3 -3
- package/src/commands/tunnel.ts +237 -34
- package/src/commands/web-fetch.ts +1 -1
- package/src/commands/web.ts +56 -1
- package/src/commands/work.ts +72 -38
- package/src/commands/workflow.ts +43 -34
- package/src/core/{harnesses → adapters}/attest-projection.ts +2 -2
- package/src/core/{harnesses → adapters}/attest.ts +27 -27
- package/src/core/{harnesses → adapters}/attestation.ts +41 -41
- package/src/core/{harnesses → adapters}/bench.ts +34 -43
- package/src/core/adapters/index.ts +56 -0
- package/src/core/{harnesses → adapters}/profiles.ts +16 -16
- package/src/core/{harnesses → adapters}/registry.ts +23 -23
- package/src/core/{harnesses → adapters}/types.ts +28 -23
- package/src/core/agents/canonical-emit.ts +6 -6
- package/src/core/agents/cli-emit.ts +1 -1
- package/src/core/agents/cli.ts +30 -28
- package/src/core/agents/codex-replay.ts +6 -6
- package/src/core/agents/coord-client.ts +119 -28
- package/src/core/agents/events/consume.ts +1 -1
- package/src/core/agents/events/emit.ts +7 -6
- package/src/core/agents/render/prompt-context.ts +107 -31
- package/src/core/agents/render/session-context.ts +6 -6
- package/src/core/agents/rules/claim-conflict.ts +4 -7
- package/src/core/agents/rules/commit-conflict.ts +103 -22
- package/src/core/agents/rules/stop-hook.ts +33 -17
- package/src/core/agents/rules/verdict.ts +13 -0
- package/src/core/agents/session-events.ts +4 -4
- package/src/core/agents/state/council.ts +1 -1
- package/src/core/agents/state/heartbeat-projector.ts +16 -12
- package/src/core/agents/state/heartbeat-writer.ts +12 -12
- package/src/core/agents/state/{scratch.ts → journal.ts} +12 -12
- package/src/core/agents/state/pidmap.ts +130 -15
- package/src/core/agents/state/proc-start.ts +208 -0
- package/src/core/agents/state/shell-mutation.ts +1 -1
- package/src/core/agents/state/stale-sweep.ts +7 -7
- package/src/core/artifacts/index.ts +557 -0
- package/src/core/config.ts +30 -2
- package/src/core/context/index.ts +15 -15
- package/src/core/governor/adapter-spread.ts +82 -0
- package/src/core/governor/index.ts +91 -0
- package/src/core/governor/plan-api.ts +115 -0
- package/src/core/{supervisor → governor}/plan-read.ts +120 -96
- package/src/core/{supervisor → governor}/plan-types.ts +64 -50
- package/src/core/{supervisor → governor}/planning.ts +240 -188
- package/src/core/governor/read.ts +59 -0
- package/src/core/{supervisor → governor}/runner.ts +39 -39
- package/src/core/{supervisor → governor}/service-read.ts +22 -22
- package/src/core/{supervisor → governor}/service.ts +117 -119
- package/src/core/{supervisor → governor}/state.ts +389 -174
- package/src/core/hooks/adapter/detect.ts +30 -0
- package/src/core/hooks/{harness → adapter}/events.ts +16 -14
- package/src/core/hooks/{harness → adapter}/output.ts +31 -23
- package/src/core/hooks/{harness → adapter}/parse.ts +5 -5
- package/src/core/hooks/{harness → adapter}/wiring.ts +21 -21
- package/src/core/hooks/cli.ts +185 -162
- package/src/core/hooks/effects/image-capture.ts +6 -6
- package/src/core/hooks/effects/index.ts +17 -17
- package/src/core/hooks/events/emit.ts +3 -3
- package/src/core/hooks/events/rotate.ts +1 -1
- package/src/core/hooks/events/schema.ts +15 -7
- package/src/core/hooks/guard-path.ts +2 -2
- package/src/core/hooks/index.ts +1 -1
- package/src/core/hooks/resolve/anchor.ts +63 -8
- package/src/core/hooks/resolve/coord-root.ts +4 -4
- package/src/core/hooks/resolve/intent.ts +1 -1
- package/src/core/hooks/resolve/owner.ts +11 -5
- package/src/core/{scratch → journal}/index.ts +53 -53
- package/src/core/policy/evaluate.ts +8 -8
- package/src/core/policy/types.ts +3 -3
- package/src/core/work/runner.ts +11 -2
- package/src/core/work/state.ts +185 -21
- package/src/core/workflow/adapters.ts +33 -0
- package/src/core/workflow/approvals.ts +7 -7
- package/src/core/workflow/billing.ts +12 -12
- package/src/core/workflow/child-env.ts +13 -4
- package/src/core/workflow/engine.ts +166 -90
- package/src/core/workflow/evidence-preflight.ts +165 -0
- package/src/core/workflow/index.ts +6 -3
- package/src/core/workflow/proof.ts +94 -48
- package/src/core/workflow/run-state.ts +7 -7
- package/src/core/workflow/sandbox-projection.ts +16 -16
- package/src/core/workflow/spawn-claude.ts +34 -12
- package/src/core/workflow/spawn-codex.ts +30 -12
- package/src/core/workflow/spawn-cursor.ts +31 -12
- package/src/core/workflow/spawn-failure.ts +41 -1
- package/src/core/workflow/specialists.ts +2 -2
- package/src/core/workflow/{journal.ts → transcript.ts} +16 -16
- package/src/core/workflow/types.ts +130 -46
- package/src/core/workflow/validate.ts +1 -1
- package/src/core/workflow/workspaces/cancellation.ts +2 -2
- package/src/core/workflow/workspaces/cleanup.ts +2 -2
- package/src/core/workflow/workspaces/execution.ts +6 -6
- package/src/core/workflow/workspaces/inspect.ts +14 -11
- package/src/core/workflow/workspaces/integration.ts +18 -14
- package/src/core/workflow/workspaces/lifecycle.ts +10 -10
- package/src/core/workflow/workspaces/local-git.ts +47 -5
- package/src/core/workflow/workspaces/recovery.ts +3 -3
- package/src/core/workflow/workspaces/state.ts +4 -3
- package/src/core/workflow/workspaces/types.ts +1 -1
- package/src/lib/browser/asserts.ts +177 -0
- package/src/lib/browser/client.ts +189 -14
- package/src/lib/browser/content-checks.ts +571 -0
- package/src/lib/browser/critique.ts +231 -0
- package/src/lib/browser/geometry.ts +297 -1
- package/src/lib/browser/index.ts +34 -0
- package/src/lib/claude-desktop.ts +4 -1
- package/src/lib/council/index.ts +9 -9
- package/src/lib/exec.ts +13 -3
- package/src/lib/identities/assume.ts +7 -7
- package/src/lib/instructions/apply.ts +87 -25
- package/src/lib/instructions/host-addendum.ts +126 -0
- package/src/lib/instructions/templates.ts +44 -15
- package/src/lib/machine.ts +2 -2
- package/dist/commands/harness.d.ts +0 -12
- package/dist/commands/harness.d.ts.map +0 -1
- package/dist/commands/scratch.d.ts +0 -4
- package/dist/commands/scratch.d.ts.map +0 -1
- package/dist/commands/session.d.ts.map +0 -1
- package/dist/commands/session.js +0 -162
- package/dist/commands/supervisor.d.ts +0 -4
- package/dist/commands/supervisor.d.ts.map +0 -1
- package/dist/core/harnesses/attest-projection.d.ts.map +0 -1
- package/dist/core/harnesses/attest.d.ts.map +0 -1
- package/dist/core/harnesses/attestation.d.ts.map +0 -1
- package/dist/core/harnesses/bench.d.ts.map +0 -1
- package/dist/core/harnesses/index.d.ts +0 -13
- package/dist/core/harnesses/index.d.ts.map +0 -1
- package/dist/core/harnesses/index.js +0 -6
- package/dist/core/harnesses/profiles.d.ts.map +0 -1
- package/dist/core/harnesses/registry.d.ts +0 -15
- package/dist/core/harnesses/registry.d.ts.map +0 -1
- package/dist/core/harnesses/types.d.ts.map +0 -1
- package/dist/core/hooks/harness/detect.d.ts +0 -9
- package/dist/core/hooks/harness/events.d.ts.map +0 -1
- package/dist/core/hooks/harness/output.d.ts.map +0 -1
- package/dist/core/supervisor/index.d.ts +0 -7
- package/dist/core/supervisor/index.d.ts.map +0 -1
- package/dist/core/supervisor/index.js +0 -6
- package/dist/core/supervisor/plan-api.d.ts +0 -23
- package/dist/core/supervisor/plan-api.d.ts.map +0 -1
- package/dist/core/supervisor/plan-api.js +0 -50
- package/dist/core/supervisor/plan-read.d.ts +0 -5
- package/dist/core/supervisor/plan-read.d.ts.map +0 -1
- package/dist/core/supervisor/plan-types.d.ts +0 -170
- package/dist/core/supervisor/plan-types.d.ts.map +0 -1
- package/dist/core/supervisor/planning.d.ts +0 -33
- package/dist/core/supervisor/planning.d.ts.map +0 -1
- package/dist/core/supervisor/read.d.ts +0 -6
- package/dist/core/supervisor/read.d.ts.map +0 -1
- package/dist/core/supervisor/read.js +0 -4
- package/dist/core/supervisor/runner.d.ts +0 -37
- package/dist/core/supervisor/runner.d.ts.map +0 -1
- package/dist/core/supervisor/service-read.d.ts +0 -6
- package/dist/core/supervisor/service-read.d.ts.map +0 -1
- package/dist/core/supervisor/service.d.ts +0 -114
- package/dist/core/supervisor/service.d.ts.map +0 -1
- package/dist/core/supervisor/state.d.ts +0 -95
- package/dist/core/supervisor/state.d.ts.map +0 -1
- package/dist/core/workflow/harnesses.d.ts +0 -17
- package/dist/core/workflow/harnesses.d.ts.map +0 -1
- package/dist/core/workflow/harnesses.js +0 -21
- package/dist/core/workflow/journal.d.ts.map +0 -1
- package/src/commands/session.ts +0 -187
- package/src/core/harnesses/index.ts +0 -56
- package/src/core/hooks/harness/detect.ts +0 -30
- package/src/core/supervisor/index.ts +0 -89
- package/src/core/supervisor/plan-api.ts +0 -73
- package/src/core/supervisor/read.ts +0 -59
- package/src/core/workflow/harnesses.ts +0 -33
- /package/dist/core/{harnesses → adapters}/attest-projection.js +0 -0
package/dist/core/agents/cli.js
CHANGED
|
@@ -162,12 +162,12 @@ async function emitClaimRelease(root, owner, hb, path, reason) {
|
|
|
162
162
|
const { emit } = await import("./events/emit.js");
|
|
163
163
|
const canonical = path.startsWith(`${root}/`) ? path.slice(root.length + 1) : path;
|
|
164
164
|
const platform = hb.platform;
|
|
165
|
-
const
|
|
165
|
+
const adapter = platform === "cursor" ? "cursor" : platform === "codex" ? "codex" : "claude-code";
|
|
166
166
|
emit(root, {
|
|
167
167
|
event_type: "claim.release",
|
|
168
168
|
instance_id: owner,
|
|
169
169
|
session_id: hb.session_id ?? owner,
|
|
170
|
-
|
|
170
|
+
adapter,
|
|
171
171
|
source: "agent-coord",
|
|
172
172
|
data: { path: canonical, reason },
|
|
173
173
|
});
|
|
@@ -262,16 +262,16 @@ async function handleStateAction(root, action, rest) {
|
|
|
262
262
|
return 0;
|
|
263
263
|
}
|
|
264
264
|
case "heal-heartbeat": {
|
|
265
|
-
//
|
|
265
|
+
// adapter arrives as a `--adapter=<h>` flag (not positional) so the live
|
|
266
266
|
// tool.pre_use heal and the manual `harn agents heal` path (which pass
|
|
267
267
|
// different positional counts) can both supply it without arg-order
|
|
268
268
|
// fragility. Positionals (sessionId, model) stay as-is once flags are
|
|
269
269
|
// filtered out.
|
|
270
|
-
const
|
|
270
|
+
const adapter = args.find((a) => a.startsWith("--adapter="))?.slice("--adapter=".length);
|
|
271
271
|
const positional = args.filter((a) => !a.startsWith("--"));
|
|
272
272
|
const sessionId = positional[0];
|
|
273
273
|
const model = positional[1];
|
|
274
|
-
const hb = writer.healHeartbeat(root, owner, sessionId, model,
|
|
274
|
+
const hb = writer.healHeartbeat(root, owner, sessionId, model, adapter);
|
|
275
275
|
process.stdout.write(`${JSON.stringify({ instance_id: owner, recreated: !!hb })}\n`);
|
|
276
276
|
return hb ? 0 : 1;
|
|
277
277
|
}
|
|
@@ -293,45 +293,45 @@ async function handleStateAction(root, action, rest) {
|
|
|
293
293
|
return 2;
|
|
294
294
|
}
|
|
295
295
|
}
|
|
296
|
-
async function
|
|
297
|
-
const
|
|
298
|
-
if (action === "append-
|
|
296
|
+
async function handleJournalAction(root, action, rest) {
|
|
297
|
+
const journal = await import("./state/journal.js");
|
|
298
|
+
if (action === "append-journal") {
|
|
299
299
|
const [owner, category, ...bodyParts] = rest;
|
|
300
300
|
const body = bodyParts.join(" ");
|
|
301
301
|
if (!owner || !category || !body) {
|
|
302
|
-
process.stderr.write("agent-coord append-
|
|
302
|
+
process.stderr.write("agent-coord append-journal <instance_id> <category> <body>\n");
|
|
303
303
|
return 2;
|
|
304
304
|
}
|
|
305
|
-
const result =
|
|
305
|
+
const result = journal.appendJournal(root, owner, category, body);
|
|
306
306
|
if (!result.ok) {
|
|
307
|
-
process.stderr.write(`agent-coord append-
|
|
307
|
+
process.stderr.write(`agent-coord append-journal: ${result.reason}\n`);
|
|
308
308
|
return 1;
|
|
309
309
|
}
|
|
310
310
|
process.stdout.write(`${JSON.stringify({ instance_id: owner, category, path: result.path })}\n`);
|
|
311
311
|
return 0;
|
|
312
312
|
}
|
|
313
|
-
if (action === "edit-
|
|
313
|
+
if (action === "edit-journal") {
|
|
314
314
|
const [owner, newBodyFile, ...summaryParts] = rest;
|
|
315
315
|
const summary = summaryParts.join(" ");
|
|
316
316
|
if (!owner || !newBodyFile) {
|
|
317
|
-
process.stderr.write("agent-coord edit-
|
|
317
|
+
process.stderr.write("agent-coord edit-journal <instance_id> <new-body-file> [<summary>]\n");
|
|
318
318
|
return 2;
|
|
319
319
|
}
|
|
320
320
|
if (!existsSync(newBodyFile)) {
|
|
321
|
-
process.stderr.write(`agent-coord edit-
|
|
321
|
+
process.stderr.write(`agent-coord edit-journal: file not found: ${newBodyFile}\n`);
|
|
322
322
|
return 2;
|
|
323
323
|
}
|
|
324
324
|
const { readFileSync } = await import("node:fs");
|
|
325
325
|
const newBody = readFileSync(newBodyFile, "utf8");
|
|
326
|
-
const result =
|
|
326
|
+
const result = journal.editJournal(root, owner, newBody, summary);
|
|
327
327
|
if (!result.ok) {
|
|
328
|
-
process.stderr.write(`agent-coord edit-
|
|
328
|
+
process.stderr.write(`agent-coord edit-journal: ${result.reason}\n`);
|
|
329
329
|
return 1;
|
|
330
330
|
}
|
|
331
331
|
process.stdout.write(`${JSON.stringify({ instance_id: owner, path: result.path, archive_path: result.archivePath })}\n`);
|
|
332
332
|
return 0;
|
|
333
333
|
}
|
|
334
|
-
process.stderr.write(`agent-coord: unknown
|
|
334
|
+
process.stderr.write(`agent-coord: unknown journal action ${action}\n`);
|
|
335
335
|
return 2;
|
|
336
336
|
}
|
|
337
337
|
async function handleCouncilAction(root, action, rest) {
|
|
@@ -522,7 +522,7 @@ async function handleShellMutationClaimLog(root, rest) {
|
|
|
522
522
|
// in a log file; now a canonical decision.warn so the
|
|
523
523
|
// signal survives in events.ndjson. (The blocking claim-conflict path is
|
|
524
524
|
// separate: claim.conflict / verdict, and unaffected.)
|
|
525
|
-
const
|
|
525
|
+
const adapter = platform === "cursor" ? "cursor" : platform === "codex" ? "codex" : "claude-code";
|
|
526
526
|
const hb = owner ? readHeartbeat(root, owner) : null;
|
|
527
527
|
for (const p of paths) {
|
|
528
528
|
try {
|
|
@@ -530,7 +530,7 @@ async function handleShellMutationClaimLog(root, rest) {
|
|
|
530
530
|
event_type: "decision.warn",
|
|
531
531
|
instance_id: owner ?? "unknown",
|
|
532
532
|
session_id: hb?.session_id ?? owner ?? "unknown",
|
|
533
|
-
|
|
533
|
+
adapter,
|
|
534
534
|
data: {
|
|
535
535
|
rule: "shell_mutation_candidate",
|
|
536
536
|
reason: `path=${p} cmd=${truncated} platform=${platform}`,
|
|
@@ -568,9 +568,11 @@ async function handlePromptContext(root, rest) {
|
|
|
568
568
|
const instanceId = args.instance;
|
|
569
569
|
const sessionId = args.session ?? instanceId;
|
|
570
570
|
const agentName = args.name;
|
|
571
|
+
const sessionNameNudge = args["session-name-nudge"] === "true";
|
|
571
572
|
const taskNudge = args["task-nudge"] === "true";
|
|
573
|
+
const statusFooterNudge = args["status-footer-nudge"] === "true";
|
|
572
574
|
if (!instanceId) {
|
|
573
|
-
process.stderr.write("agent-coord prompt-context --instance <id> [--session <id>] [--name <agent-name>] [--task-nudge]\n");
|
|
575
|
+
process.stderr.write("agent-coord prompt-context --instance <id> [--session <id>] [--name <agent-name>] [--session-name-nudge] [--task-nudge] [--status-footer-nudge]\n");
|
|
574
576
|
return 2;
|
|
575
577
|
}
|
|
576
578
|
const { renderPromptContext } = await import("./render/prompt-context.js");
|
|
@@ -579,7 +581,9 @@ async function handlePromptContext(root, rest) {
|
|
|
579
581
|
instanceId,
|
|
580
582
|
sessionId: sessionId,
|
|
581
583
|
agentName,
|
|
584
|
+
sessionNameNudge,
|
|
582
585
|
taskNudge,
|
|
586
|
+
statusFooterNudge,
|
|
583
587
|
});
|
|
584
588
|
process.stdout.write(text);
|
|
585
589
|
return 0;
|
|
@@ -689,10 +693,10 @@ async function handleEmitEvent(root, rest) {
|
|
|
689
693
|
const eventType = args.type;
|
|
690
694
|
const instanceId = args.owner;
|
|
691
695
|
const sessionId = args.session;
|
|
692
|
-
const
|
|
696
|
+
const adapter = args.adapter;
|
|
693
697
|
const dataJson = args["data-json"] ?? "{}";
|
|
694
|
-
if (!eventType || !instanceId || !sessionId || !
|
|
695
|
-
process.stderr.write("agent-coord emit-event --type <T> --owner <id> --session <id> --
|
|
698
|
+
if (!eventType || !instanceId || !sessionId || !adapter) {
|
|
699
|
+
process.stderr.write("agent-coord emit-event --type <T> --owner <id> --session <id> --adapter <h> [--data-json '<json>']\n");
|
|
696
700
|
return 2;
|
|
697
701
|
}
|
|
698
702
|
let data;
|
|
@@ -714,7 +718,7 @@ async function handleEmitEvent(root, rest) {
|
|
|
714
718
|
event_type: eventType,
|
|
715
719
|
instance_id: instanceId,
|
|
716
720
|
session_id: sessionId,
|
|
717
|
-
|
|
721
|
+
adapter,
|
|
718
722
|
turn_id: args["turn-id"],
|
|
719
723
|
parent_session_id: args["parent-session-id"],
|
|
720
724
|
parent_turn_id: args["parent-turn-id"],
|
|
@@ -751,8 +755,8 @@ async function main() {
|
|
|
751
755
|
subcommand === "stamp-tool-activity") {
|
|
752
756
|
return handleStateAction(root, subcommand, rest);
|
|
753
757
|
}
|
|
754
|
-
if (subcommand === "append-
|
|
755
|
-
return
|
|
758
|
+
if (subcommand === "append-journal" || subcommand === "edit-journal") {
|
|
759
|
+
return handleJournalAction(root, subcommand, rest);
|
|
756
760
|
}
|
|
757
761
|
if (subcommand === "council-advance" ||
|
|
758
762
|
subcommand === "council-close" ||
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* Production codex sessions emit canonical events from each `harn` invocation
|
|
5
5
|
* via the in-process session-tee middleware (which calls `agent-coord
|
|
6
6
|
* emit-event` for state.task_set / state.status_checked). But the codex
|
|
7
|
-
*
|
|
7
|
+
* adapter itself doesn't wire agent-hook on preToolUse, so user_prompt.submit
|
|
8
8
|
* + tool.pre_use + turn.stop aren't emitted live.
|
|
9
9
|
*
|
|
10
10
|
* This module parses the Codex JSONL transcript at stop time and emits the
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* Production codex sessions emit canonical events from each `harn` invocation
|
|
5
5
|
* via the in-process session-tee middleware (which calls `agent-coord
|
|
6
6
|
* emit-event` for state.task_set / state.status_checked). But the codex
|
|
7
|
-
*
|
|
7
|
+
* adapter itself doesn't wire agent-hook on preToolUse, so user_prompt.submit
|
|
8
8
|
* + tool.pre_use + turn.stop aren't emitted live.
|
|
9
9
|
*
|
|
10
10
|
* This module parses the Codex JSONL transcript at stop time and emits the
|
|
@@ -49,7 +49,7 @@ export function replayCodexJsonl(opts) {
|
|
|
49
49
|
event_type: "user_prompt.submit",
|
|
50
50
|
instance_id: instanceId,
|
|
51
51
|
session_id: sessionId,
|
|
52
|
-
|
|
52
|
+
adapter: "codex",
|
|
53
53
|
ts,
|
|
54
54
|
data: {
|
|
55
55
|
prompt_text: clamp(entry.payload.message ?? "", 4000),
|
|
@@ -75,7 +75,7 @@ export function replayCodexJsonl(opts) {
|
|
|
75
75
|
event_type: "tool.pre_use",
|
|
76
76
|
instance_id: instanceId,
|
|
77
77
|
session_id: sessionId,
|
|
78
|
-
|
|
78
|
+
adapter: "codex",
|
|
79
79
|
ts,
|
|
80
80
|
data: {
|
|
81
81
|
tool_name: name === "exec_command" ? "Bash" : name,
|
|
@@ -94,7 +94,7 @@ export function replayCodexJsonl(opts) {
|
|
|
94
94
|
event_type: "state.status_checked",
|
|
95
95
|
instance_id: instanceId,
|
|
96
96
|
session_id: sessionId,
|
|
97
|
-
|
|
97
|
+
adapter: "codex",
|
|
98
98
|
ts,
|
|
99
99
|
data: { source: "codex-replay" },
|
|
100
100
|
});
|
|
@@ -105,7 +105,7 @@ export function replayCodexJsonl(opts) {
|
|
|
105
105
|
event_type: "state.task_set",
|
|
106
106
|
instance_id: instanceId,
|
|
107
107
|
session_id: sessionId,
|
|
108
|
-
|
|
108
|
+
adapter: "codex",
|
|
109
109
|
ts,
|
|
110
110
|
data: { source: "codex-replay" },
|
|
111
111
|
});
|
|
@@ -121,7 +121,7 @@ export function replayCodexJsonl(opts) {
|
|
|
121
121
|
event_type: "turn.stop",
|
|
122
122
|
instance_id: instanceId,
|
|
123
123
|
session_id: sessionId,
|
|
124
|
-
|
|
124
|
+
adapter: "codex",
|
|
125
125
|
data: {
|
|
126
126
|
status_box_present: boxPresent,
|
|
127
127
|
tool_call_count: -1,
|
|
@@ -38,7 +38,7 @@ export interface Heartbeat {
|
|
|
38
38
|
last_tool_target?: string;
|
|
39
39
|
/** Free-form task/intent string set via `harn agents set-task`. Phase 2. */
|
|
40
40
|
task?: string;
|
|
41
|
-
/** UTC ISO-8601 timestamp when task was last set/cleared. Used by
|
|
41
|
+
/** UTC ISO-8601 timestamp when task was last set/cleared. Used by adapters without Stop enforcement to compute staleness. 2026-05-24. */
|
|
42
42
|
task_updated_at?: string | null;
|
|
43
43
|
/** Auto-generated per-turn summary written by the Stop hook via Haiku. 2026-05-23. */
|
|
44
44
|
turn_summary?: string | null;
|
|
@@ -62,6 +62,25 @@ export declare function monorepoRoot(): string | null;
|
|
|
62
62
|
export declare function parsePidmapRowOwner(row: string): string;
|
|
63
63
|
/** Parse platform from a pid-map row; legacy rows default to `claude_code`. */
|
|
64
64
|
export declare function parsePidmapRowPlatform(row: string): string;
|
|
65
|
+
/** Parse the start token from a pid-map row; rows written before it carry none. */
|
|
66
|
+
export declare function parsePidmapRowStartToken(row: string): string | undefined;
|
|
67
|
+
/**
|
|
68
|
+
* Is the process now holding `pid` the one this row was written for?
|
|
69
|
+
*
|
|
70
|
+
* A pid is a number the OS re-issues, and quickly: a `pid_max` of 99999 against
|
|
71
|
+
* ~100 new processes a second recycles the whole space about every quarter
|
|
72
|
+
* hour. Believing a row past that point resolves this session to whichever
|
|
73
|
+
* agent last held the number — which is what made `whoami` report a stranger's
|
|
74
|
+
* name and files. The start token settles it, since two processes may share a
|
|
75
|
+
* pid but never a pid and a start instant.
|
|
76
|
+
*
|
|
77
|
+
* Deliberately inlined rather than imported from `state/proc-start.ts`: this
|
|
78
|
+
* file is vendored verbatim into a downstream consumer and stays on node
|
|
79
|
+
* builtins only. The token is a wire format shared with that module and with
|
|
80
|
+
* the host's commit guard, so the copies must agree byte for byte; exported so
|
|
81
|
+
* a test can hold this one against `processStartToken` and fail on drift.
|
|
82
|
+
*/
|
|
83
|
+
export declare function pidStartToken(pid: number): string | null;
|
|
65
84
|
/**
|
|
66
85
|
* Walk up the ppid chain looking for a pid-map entry. Returns
|
|
67
86
|
* the resolved instance_id or null.
|
|
@@ -87,7 +106,7 @@ export declare function resolveOwnerWithSource(): {
|
|
|
87
106
|
source: "env" | "pidmap" | "pidmap_fallback" | "session_env" | "active_singleton" | "none";
|
|
88
107
|
};
|
|
89
108
|
/**
|
|
90
|
-
* Resolve the owner by matching the
|
|
109
|
+
* Resolve the owner by matching the adapter session-id env var against the
|
|
91
110
|
* `session_id` of a live heartbeat in this coord root. Returns the matching
|
|
92
111
|
* `instance_id`, or null if there's no session-id env var or no live heartbeat
|
|
93
112
|
* carries it. "Live" reuses the same 10-minute freshness window the singleton
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"coord-client.d.ts","sourceRoot":"","sources":["../../../src/core/agents/coord-client.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAWH;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,MAAM,CAWhE;AAED,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAAC,KAAK,IAAI,MAAM,CAI5E;AAED;;;;;;GAMG;AACH,wBAAgB,oBAAoB,CAAC,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,CAOhF;AAED,MAAM,WAAW,SAAS;IACxB,WAAW,EAAE,MAAM,CAAC;IACpB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,EAAE,MAAM,CAAC;IACnB,cAAc,EAAE,MAAM,CAAC;IACvB,aAAa,EAAE,MAAM,EAAE,CAAC;IACxB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,sEAAsE;IACtE,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,oGAAoG;IACpG,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,4EAA4E;IAC5E,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,
|
|
1
|
+
{"version":3,"file":"coord-client.d.ts","sourceRoot":"","sources":["../../../src/core/agents/coord-client.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAWH;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,MAAM,CAWhE;AAED,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAAC,KAAK,IAAI,MAAM,CAI5E;AAED;;;;;;GAMG;AACH,wBAAgB,oBAAoB,CAAC,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,CAOhF;AAED,MAAM,WAAW,SAAS;IACxB,WAAW,EAAE,MAAM,CAAC;IACpB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,EAAE,MAAM,CAAC;IACnB,cAAc,EAAE,MAAM,CAAC;IACvB,aAAa,EAAE,MAAM,EAAE,CAAC;IACxB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,sEAAsE;IACtE,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,oGAAoG;IACpG,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,4EAA4E;IAC5E,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,yIAAyI;IACzI,eAAe,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAChC,sFAAsF;IACtF,YAAY,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,mEAAmE;IACnE,uBAAuB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACxC,wEAAwE;IACxE,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED;;;;;;;;;GASG;AACH,wBAAgB,YAAY,IAAI,MAAM,GAAG,IAAI,CA0C5C;AAED,qEAAqE;AACrE,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAIvD;AAED,+EAA+E;AAC/E,wBAAgB,sBAAsB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAG1D;AAED,mFAAmF;AACnF,wBAAgB,wBAAwB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAExE;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,aAAa,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CA2CxD;AAgCD;;;;;;;;;;;GAWG;AACH,wBAAgB,YAAY,IAAI,MAAM,GAAG,IAAI,CAE5C;AAED;;;;;;GAMG;AACH,wBAAgB,sBAAsB,IAAI;IACxC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,MAAM,EAAE,KAAK,GAAG,QAAQ,GAAG,iBAAiB,GAAG,aAAa,GAAG,kBAAkB,GAAG,MAAM,CAAC;CAC5F,CA2DA;AA0DD;;;;;;;;;GASG;AACH,wBAAgB,wBAAwB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CA2BpE;AAED;;;;;;;;GAQG;AACH,wBAAgB,wBAAwB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAyBpE;AAED;;;;;;;GAOG;AACH,wBAAgB,aAAa,CAAC,UAAU,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI,CAMlE;AAgBD;;;;;;;;GAQG;AACH,wBAAgB,WAAW,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,CAOtD;AAED;;;GAGG;AACH,wBAAgB,eAAe,IAAI,MAAM,CAIxC"}
|
|
@@ -107,9 +107,97 @@ export function parsePidmapRowOwner(row) {
|
|
|
107
107
|
}
|
|
108
108
|
/** Parse platform from a pid-map row; legacy rows default to `claude_code`. */
|
|
109
109
|
export function parsePidmapRowPlatform(row) {
|
|
110
|
-
const
|
|
111
|
-
|
|
112
|
-
|
|
110
|
+
const platform = row.trim().split("\t")[1]?.trim();
|
|
111
|
+
return platform || "claude_code";
|
|
112
|
+
}
|
|
113
|
+
/** Parse the start token from a pid-map row; rows written before it carry none. */
|
|
114
|
+
export function parsePidmapRowStartToken(row) {
|
|
115
|
+
return row.trim().split("\t")[2]?.trim() || undefined;
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* Is the process now holding `pid` the one this row was written for?
|
|
119
|
+
*
|
|
120
|
+
* A pid is a number the OS re-issues, and quickly: a `pid_max` of 99999 against
|
|
121
|
+
* ~100 new processes a second recycles the whole space about every quarter
|
|
122
|
+
* hour. Believing a row past that point resolves this session to whichever
|
|
123
|
+
* agent last held the number — which is what made `whoami` report a stranger's
|
|
124
|
+
* name and files. The start token settles it, since two processes may share a
|
|
125
|
+
* pid but never a pid and a start instant.
|
|
126
|
+
*
|
|
127
|
+
* Deliberately inlined rather than imported from `state/proc-start.ts`: this
|
|
128
|
+
* file is vendored verbatim into a downstream consumer and stays on node
|
|
129
|
+
* builtins only. The token is a wire format shared with that module and with
|
|
130
|
+
* the host's commit guard, so the copies must agree byte for byte; exported so
|
|
131
|
+
* a test can hold this one against `processStartToken` and fail on drift.
|
|
132
|
+
*/
|
|
133
|
+
export function pidStartToken(pid) {
|
|
134
|
+
const forced = process.env.HARNERY_PID_PROBE;
|
|
135
|
+
const useProcfs = forced === "procfs" || (forced !== "ps" && existsSync("/proc/self/stat"));
|
|
136
|
+
// One machine, one probe. Falling back to the other on a read failure would
|
|
137
|
+
// answer in the wrong dialect and read as a recycled pid.
|
|
138
|
+
if (useProcfs) {
|
|
139
|
+
try {
|
|
140
|
+
const stat = readFileSync(`/proc/${pid}/stat`, "utf8");
|
|
141
|
+
const afterComm = stat.slice(stat.lastIndexOf(") ") + 2);
|
|
142
|
+
// Fields after comm, 0-based: 0 is state (field 3), starttime (22) is 19.
|
|
143
|
+
const ticks = afterComm.split(" ")[19];
|
|
144
|
+
if (!ticks || !/^\d+$/.test(ticks))
|
|
145
|
+
return null;
|
|
146
|
+
// Ticks count from boot, so they repeat across reboots; the boot id scopes
|
|
147
|
+
// them. Rows written before it carry ticks alone and still compare.
|
|
148
|
+
let boot = "";
|
|
149
|
+
try {
|
|
150
|
+
const raw = readFileSync("/proc/sys/kernel/random/boot_id", "utf8")
|
|
151
|
+
.trim()
|
|
152
|
+
.replace(/-/g, "");
|
|
153
|
+
if (/^[0-9a-f]{8,}$/.test(raw))
|
|
154
|
+
boot = `${raw.slice(0, 8)}.`;
|
|
155
|
+
}
|
|
156
|
+
catch {
|
|
157
|
+
/* unnamed boot: fall back to the tick-only shape */
|
|
158
|
+
}
|
|
159
|
+
return `l${boot}${ticks}`;
|
|
160
|
+
}
|
|
161
|
+
catch {
|
|
162
|
+
return null;
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
try {
|
|
166
|
+
// TZ and locale are pinned because `ps` renders the date through them, and
|
|
167
|
+
// two callers with different environments must not disagree about one
|
|
168
|
+
// process.
|
|
169
|
+
const out = spawnSync("ps", ["-o", "lstart=", "-p", String(pid)], {
|
|
170
|
+
encoding: "utf8",
|
|
171
|
+
timeout: 2000,
|
|
172
|
+
env: { ...process.env, TZ: "UTC", LC_ALL: "C" },
|
|
173
|
+
});
|
|
174
|
+
if (out.status !== 0)
|
|
175
|
+
return null;
|
|
176
|
+
const lstart = (out.stdout ?? "").split("\n")[0]?.trim().replace(/\s+/g, " ");
|
|
177
|
+
return lstart ? `p${lstart}` : null;
|
|
178
|
+
}
|
|
179
|
+
catch {
|
|
180
|
+
return null;
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
function pidWasRecycled(pid, row) {
|
|
184
|
+
const recorded = parsePidmapRowStartToken(row);
|
|
185
|
+
if (!recorded)
|
|
186
|
+
return false; // pre-token row: unverifiable, behave as before
|
|
187
|
+
const current = pidStartToken(pid);
|
|
188
|
+
if (!current)
|
|
189
|
+
return false;
|
|
190
|
+
if (current === recorded)
|
|
191
|
+
return false;
|
|
192
|
+
// A row predating the boot segment recorded ticks alone; compare it on what
|
|
193
|
+
// it recorded rather than pruning every live row on the first upgraded run.
|
|
194
|
+
if (recorded[0] === "l" &&
|
|
195
|
+
current[0] === "l" &&
|
|
196
|
+
recorded.includes(".") !== current.includes(".")) {
|
|
197
|
+
const ticks = (t) => (t.includes(".") ? t.slice(t.indexOf(".") + 1) : t.slice(1));
|
|
198
|
+
return ticks(recorded) !== ticks(current);
|
|
199
|
+
}
|
|
200
|
+
return true;
|
|
113
201
|
}
|
|
114
202
|
function readPidmapRow(pidmapDir, pid) {
|
|
115
203
|
const candidate = resolve(pidmapDir, String(pid));
|
|
@@ -153,9 +241,14 @@ export function resolveOwnerWithSource() {
|
|
|
153
241
|
const root = monorepoRoot();
|
|
154
242
|
if (!root)
|
|
155
243
|
return { owner: null, source: "none" };
|
|
156
|
-
//
|
|
157
|
-
//
|
|
158
|
-
//
|
|
244
|
+
// Every supported adapter exports its session id into the env of the
|
|
245
|
+
// subprocess it spawns for a tool call, and each heartbeat records the
|
|
246
|
+
// session id it was minted under. Matching the two names us outright, even
|
|
247
|
+
// with many live agents, so it goes ahead of the ppid walk rather than
|
|
248
|
+
// catching what the walk drops. Cursor needed this first because its
|
|
249
|
+
// Glass/Agents UI runs several chats under one node ancestor, making that row
|
|
250
|
+
// last-writer-wins; pid recycling generalises the same hazard to every
|
|
251
|
+
// adapter.
|
|
159
252
|
if (shouldPreferSessionEnv()) {
|
|
160
253
|
const bySession = resolveOwnerBySessionEnv(root);
|
|
161
254
|
if (bySession) {
|
|
@@ -172,7 +265,7 @@ export function resolveOwnerWithSource() {
|
|
|
172
265
|
if (pid === null)
|
|
173
266
|
break;
|
|
174
267
|
const row = readPidmapRow(pidmapDir, pid);
|
|
175
|
-
if (row) {
|
|
268
|
+
if (row && !pidWasRecycled(pid, row)) {
|
|
176
269
|
const rowOwner = parsePidmapRowOwner(row);
|
|
177
270
|
const rowPlat = parsePidmapRowPlatform(row);
|
|
178
271
|
if (rowPlat === prefer) {
|
|
@@ -186,17 +279,6 @@ export function resolveOwnerWithSource() {
|
|
|
186
279
|
if (fallbackOwner) {
|
|
187
280
|
return { owner: fallbackOwner, source: "pidmap_fallback" };
|
|
188
281
|
}
|
|
189
|
-
// The ppid walk found nothing (e.g. a Bash-tool subshell whose process tree
|
|
190
|
-
// doesn't climb back to the harness anchor). Before guessing, try the
|
|
191
|
-
// harness-provided session id from the environment: every supported harness
|
|
192
|
-
// exports its session id into the tool subprocess env, and each heartbeat
|
|
193
|
-
// records the `session_id` it was minted under. Matching the two resolves us
|
|
194
|
-
// unambiguously even with multiple live agents, which is the case the
|
|
195
|
-
// singleton fallback below cannot handle.
|
|
196
|
-
const bySession = resolveOwnerBySessionEnv(root);
|
|
197
|
-
if (bySession) {
|
|
198
|
-
return { owner: bySession, source: "session_env" };
|
|
199
|
-
}
|
|
200
282
|
// Last resort: if exactly one agent is live in this coord root, it's
|
|
201
283
|
// unambiguously us — resolve to it. This is what lets the bare `agents
|
|
202
284
|
// status` / `set-task` the stop hook recommends work without a `--session-id`
|
|
@@ -209,8 +291,8 @@ export function resolveOwnerWithSource() {
|
|
|
209
291
|
return { owner: null, source: "none" };
|
|
210
292
|
}
|
|
211
293
|
/**
|
|
212
|
-
*
|
|
213
|
-
* supported
|
|
294
|
+
* Adapter-exported session-id environment variables, in precedence order. Each
|
|
295
|
+
* supported adapter propagates its session id into the env of the subprocess it
|
|
214
296
|
* spawns for a tool call (Claude Code's Bash tool, Cursor's terminal, Codex's
|
|
215
297
|
* shell). A coord CLI invoked as such a tool can therefore recover its own
|
|
216
298
|
* identity from the env even when the ppid walk misses.
|
|
@@ -225,7 +307,7 @@ const SESSION_ID_ENV_VARS = [
|
|
|
225
307
|
"CURSOR_CONVERSATION_ID",
|
|
226
308
|
"CODEX_SESSION_ID",
|
|
227
309
|
];
|
|
228
|
-
/** Read normalized candidates from the first non-empty
|
|
310
|
+
/** Read normalized candidates from the first non-empty adapter session-id env var. */
|
|
229
311
|
function sessionIdsFromEnv() {
|
|
230
312
|
for (const key of SESSION_ID_ENV_VARS) {
|
|
231
313
|
const v = process.env[key]?.trim();
|
|
@@ -238,18 +320,31 @@ function sessionIdsFromEnv() {
|
|
|
238
320
|
}
|
|
239
321
|
return [];
|
|
240
322
|
}
|
|
241
|
-
/** Read the first non-empty
|
|
323
|
+
/** Read the first non-empty adapter session-id env var, or null. */
|
|
242
324
|
function sessionIdFromEnv() {
|
|
243
325
|
return sessionIdsFromEnv()[0] ?? null;
|
|
244
326
|
}
|
|
327
|
+
/**
|
|
328
|
+
* Should the adapter-exported session id be consulted before the ppid walk?
|
|
329
|
+
*
|
|
330
|
+
* Yes, whenever one is exported. The env var is the adapter stating its own
|
|
331
|
+
* identity; the walk is a guess over a namespace the OS recycles. On a box with
|
|
332
|
+
* `pid_max` of 99999 and ~100 pids allocated per second the whole pid space
|
|
333
|
+
* turns over about every quarter hour, so a row written before that can name a
|
|
334
|
+
* pid some unrelated process now holds. Pruning cannot save the walk here:
|
|
335
|
+
* it removes rows whose pid is dead, and a recycled pid is alive. Letting a
|
|
336
|
+
* guess outrank a statement of fact is what made `agents whoami` report another
|
|
337
|
+
* agent's name and file list.
|
|
338
|
+
*
|
|
339
|
+
* This only reorders the two. Session-env resolution still requires a live
|
|
340
|
+
* heartbeat carrying that session id, so when it does not match, the walk runs
|
|
341
|
+
* exactly as before.
|
|
342
|
+
*/
|
|
245
343
|
function shouldPreferSessionEnv() {
|
|
246
|
-
|
|
247
|
-
return false;
|
|
248
|
-
const platform = process.env.HARNERY_AGENT_COORD_PLATFORM?.trim();
|
|
249
|
-
return process.env.CURSOR_AGENT === "1" || platform === "cursor";
|
|
344
|
+
return sessionIdFromEnv() !== null;
|
|
250
345
|
}
|
|
251
346
|
/**
|
|
252
|
-
* Resolve the owner by matching the
|
|
347
|
+
* Resolve the owner by matching the adapter session-id env var against the
|
|
253
348
|
* `session_id` of a live heartbeat in this coord root. Returns the matching
|
|
254
349
|
* `instance_id`, or null if there's no session-id env var or no live heartbeat
|
|
255
350
|
* carries it. "Live" reuses the same 10-minute freshness window the singleton
|
|
@@ -5,12 +5,12 @@
|
|
|
5
5
|
* event/schema types).
|
|
6
6
|
*
|
|
7
7
|
* Phase 4: agent-coord uses this from CLI handlers (state.task_set,
|
|
8
|
-
* state.status_checked, state.
|
|
8
|
+
* state.status_checked, state.journal_append, council.*, decision.*,
|
|
9
9
|
* presence.*).
|
|
10
10
|
*/
|
|
11
11
|
declare const SCHEMA_VERSION: 1;
|
|
12
|
-
export type
|
|
13
|
-
|
|
12
|
+
export type { Adapter, Source } from "../../hooks/events/schema.js";
|
|
13
|
+
import type { Adapter, Source } from "../../hooks/events/schema.js";
|
|
14
14
|
export interface Envelope {
|
|
15
15
|
schema_version: typeof SCHEMA_VERSION;
|
|
16
16
|
event_id: string;
|
|
@@ -21,7 +21,7 @@ export interface Envelope {
|
|
|
21
21
|
parent_session_id?: string;
|
|
22
22
|
turn_id?: string;
|
|
23
23
|
parent_turn_id?: string;
|
|
24
|
-
|
|
24
|
+
adapter: Adapter;
|
|
25
25
|
source: Source;
|
|
26
26
|
data: Record<string, unknown>;
|
|
27
27
|
}
|
|
@@ -29,7 +29,7 @@ export interface EmitInput {
|
|
|
29
29
|
event_type: string;
|
|
30
30
|
instance_id: string;
|
|
31
31
|
session_id: string;
|
|
32
|
-
|
|
32
|
+
adapter: Adapter;
|
|
33
33
|
source?: Source;
|
|
34
34
|
parent_session_id?: string;
|
|
35
35
|
turn_id?: string;
|
|
@@ -39,5 +39,4 @@ export interface EmitInput {
|
|
|
39
39
|
}
|
|
40
40
|
export declare function buildEnvelope(input: EmitInput): Envelope;
|
|
41
41
|
export declare function emit(coordRoot: string, input: EmitInput): Envelope;
|
|
42
|
-
export {};
|
|
43
42
|
//# sourceMappingURL=emit.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"emit.d.ts","sourceRoot":"","sources":["../../../../src/core/agents/events/emit.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAOH,QAAA,MAAM,cAAc,EAAG,CAAU,CAAC;AAKlC,
|
|
1
|
+
{"version":3,"file":"emit.d.ts","sourceRoot":"","sources":["../../../../src/core/agents/events/emit.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAOH,QAAA,MAAM,cAAc,EAAG,CAAU,CAAC;AAKlC,YAAY,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,8BAA8B,CAAC;AAEpE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,8BAA8B,CAAC;AAEpE,MAAM,WAAW,QAAQ;IACvB,cAAc,EAAE,OAAO,cAAc,CAAC;IACtC,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;IACnB,EAAE,EAAE,MAAM,CAAC;IACX,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,MAAM,CAAC;IACnB,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,OAAO,EAAE,OAAO,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAC/B;AAED,MAAM,WAAW,SAAS;IACxB,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,OAAO,CAAC;IACjB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAC/B;AAED,wBAAgB,aAAa,CAAC,KAAK,EAAE,SAAS,GAAG,QAAQ,CAexD;AAED,wBAAgB,IAAI,CAAC,SAAS,EAAE,MAAM,EAAE,KAAK,EAAE,SAAS,GAAG,QAAQ,CA4BlE"}
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* event/schema types).
|
|
6
6
|
*
|
|
7
7
|
* Phase 4: agent-coord uses this from CLI handlers (state.task_set,
|
|
8
|
-
* state.status_checked, state.
|
|
8
|
+
* state.status_checked, state.journal_append, council.*, decision.*,
|
|
9
9
|
* presence.*).
|
|
10
10
|
*/
|
|
11
11
|
import { appendFileSync, closeSync, mkdirSync, openSync } from "node:fs";
|
|
@@ -27,7 +27,7 @@ export function buildEnvelope(input) {
|
|
|
27
27
|
parent_session_id: input.parent_session_id,
|
|
28
28
|
turn_id: input.turn_id,
|
|
29
29
|
parent_turn_id: input.parent_turn_id,
|
|
30
|
-
|
|
30
|
+
adapter: input.adapter,
|
|
31
31
|
source: input.source ?? "agent-coord",
|
|
32
32
|
data: input.data,
|
|
33
33
|
};
|
|
@@ -1,19 +1,25 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* UserPromptSubmit UX renderer. Combines the peer-refresh dedup, the
|
|
3
|
-
* council-pending hash-dedup,
|
|
3
|
+
* council-pending hash-dedup, the cross-adapter first-session naming nudge,
|
|
4
|
+
* the Cursor/Codex set-task staleness nudge, and the Codex status-footer
|
|
5
|
+
* reminder.
|
|
4
6
|
* agent-hook's user_prompt.submit post-emit handler calls this
|
|
5
|
-
* and forwards the result as the
|
|
7
|
+
* and forwards the result as the adapter-shaped additionalContext payload.
|
|
6
8
|
*
|
|
7
|
-
*
|
|
9
|
+
* Four subsections combined into one additionalContext payload:
|
|
8
10
|
* 1. Peer table: semantically-relevant peer fields hashed; only re-emits
|
|
9
11
|
* when peers change (name + instance_id + session_id + kind + started_at
|
|
10
12
|
* + sorted(files_touched) + platform, sorted by instance_id).
|
|
11
13
|
* 2. Council pending: pending open-council IDs hashed; re-emits when the
|
|
12
14
|
* ID set changes.
|
|
13
|
-
* 3.
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
15
|
+
* 3. Focus nudge. Before the first set-task in a human-facing session, tells
|
|
16
|
+
* every adapter to reproduce set-task's suggested session name in a fenced
|
|
17
|
+
* code block. Cursor/Codex additionally get the existing unset/stale-task
|
|
18
|
+
* reminder because their Stop hooks do not enforce task declarations as
|
|
19
|
+
* reliably as Claude Code's.
|
|
20
|
+
* 4. Codex status footer: a non-deduplicated reminder to put the live status
|
|
21
|
+
* box after the substantive answer. Stop stays observe-only, so missing the
|
|
22
|
+
* footer can never trigger a replacement response.
|
|
17
23
|
*
|
|
18
24
|
* Hash files live at:
|
|
19
25
|
* .harnery/.last-peer-hash.<instance_id>
|
|
@@ -27,9 +33,15 @@ export interface PromptContextOpts {
|
|
|
27
33
|
instanceId: string;
|
|
28
34
|
sessionId: string;
|
|
29
35
|
agentName?: string;
|
|
30
|
-
/** When true,
|
|
31
|
-
*
|
|
36
|
+
/** When true, remind a human-facing session to print the session name before
|
|
37
|
+
* its first set-task. UserPromptSubmit enables this for every adapter. */
|
|
38
|
+
sessionNameNudge?: boolean;
|
|
39
|
+
/** When true, run the unset/stale-task check after the first set-task.
|
|
40
|
+
* Cursor/Codex use this; Claude Code has Stop-hook transcript enforcement. */
|
|
32
41
|
taskNudge?: boolean;
|
|
42
|
+
/** When true, append the non-deduplicated Codex status-footer reminder.
|
|
43
|
+
* The caller enables this only for human-facing Codex sessions. */
|
|
44
|
+
statusFooterNudge?: boolean;
|
|
33
45
|
}
|
|
34
46
|
/**
|
|
35
47
|
* Build the combined UserPromptSubmit additionalContext string. Returns "" when
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prompt-context.d.ts","sourceRoot":"","sources":["../../../../src/core/agents/render/prompt-context.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"prompt-context.d.ts","sourceRoot":"","sources":["../../../../src/core/agents/render/prompt-context.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAoCH,MAAM,WAAW,iBAAiB;IAChC,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;8EAC0E;IAC1E,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B;kFAC8E;IAC9E,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB;uEACmE;IACnE,iBAAiB,CAAC,EAAE,OAAO,CAAC;CAC7B;AAED;;;;;;;GAOG;AACH,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,iBAAiB,GAAG,MAAM,CA0CnE"}
|