harnery 0.33.0 → 0.34.1
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/dist/commander.d.ts.map +1 -1
- package/dist/commander.js +4 -0
- package/dist/commands/adapter.js +2 -2
- package/dist/commands/agents.d.ts +144 -1
- package/dist/commands/agents.d.ts.map +1 -1
- package/dist/commands/agents.js +1237 -590
- package/dist/commands/artifacts.d.ts.map +1 -1
- package/dist/commands/artifacts.js +7 -6
- package/dist/commands/backup.d.ts +1 -1
- package/dist/commands/backup.d.ts.map +1 -1
- package/dist/commands/backup.js +29 -16
- package/dist/commands/browse.d.ts.map +1 -1
- package/dist/commands/browse.js +234 -12
- package/dist/commands/checkpoint.d.ts.map +1 -1
- package/dist/commands/checkpoint.js +3 -2
- package/dist/commands/claude-desktop.d.ts +1 -1
- package/dist/commands/claude-desktop.d.ts.map +1 -1
- package/dist/commands/claude-desktop.js +3 -74
- package/dist/commands/context.js +1 -6
- package/dist/commands/decision.d.ts.map +1 -1
- package/dist/commands/decision.js +22 -38
- package/dist/commands/docs.d.ts.map +1 -1
- package/dist/commands/docs.js +91 -28
- package/dist/commands/doctor.js +10 -1
- package/dist/commands/events.d.ts +5 -0
- package/dist/commands/events.d.ts.map +1 -0
- package/dist/commands/events.js +189 -0
- package/dist/commands/governor.d.ts.map +1 -1
- package/dist/commands/governor.js +13 -4
- package/dist/commands/init.d.ts +9 -2
- package/dist/commands/init.d.ts.map +1 -1
- package/dist/commands/init.js +223 -51
- package/dist/commands/journal.d.ts.map +1 -1
- package/dist/commands/journal.js +4 -13
- package/dist/commands/ledger-v3.d.ts +5 -0
- package/dist/commands/ledger-v3.d.ts.map +1 -0
- package/dist/commands/ledger-v3.js +91 -0
- package/dist/commands/presence.d.ts.map +1 -1
- package/dist/commands/presence.js +11 -5
- package/dist/commands/sync.d.ts +1 -1
- package/dist/commands/sync.js +1 -1
- package/dist/commands/web.d.ts +6 -0
- package/dist/commands/web.d.ts.map +1 -1
- package/dist/commands/web.js +67 -7
- package/dist/commands/work.d.ts.map +1 -1
- package/dist/commands/work.js +22 -5
- package/dist/core/adapter.d.ts +5 -0
- package/dist/core/adapter.d.ts.map +1 -0
- package/dist/core/adapter.js +1 -0
- package/dist/core/adapters/attest.d.ts +5 -2
- package/dist/core/adapters/attest.d.ts.map +1 -1
- package/dist/core/adapters/attest.js +8 -3
- package/dist/core/adapters/profiles.d.ts +6 -6
- package/dist/core/adapters/profiles.d.ts.map +1 -1
- package/dist/core/adapters/profiles.js +4 -4
- package/dist/core/agents/canonical-emit.d.ts +17 -15
- package/dist/core/agents/canonical-emit.d.ts.map +1 -1
- package/dist/core/agents/canonical-emit.js +22 -22
- package/dist/core/agents/cli.js +207 -234
- package/dist/core/agents/codex-archive-v3.d.ts +14 -0
- package/dist/core/agents/codex-archive-v3.d.ts.map +1 -0
- package/dist/core/agents/codex-archive-v3.js +110 -0
- package/dist/core/agents/coord-client.d.ts +19 -81
- package/dist/core/agents/coord-client.d.ts.map +1 -1
- package/dist/core/agents/coord-client.js +65 -155
- package/dist/core/agents/finalization.d.ts +4 -1
- package/dist/core/agents/finalization.d.ts.map +1 -1
- package/dist/core/agents/finalization.js +89 -32
- package/dist/core/agents/index.d.ts +4 -5
- package/dist/core/agents/index.d.ts.map +1 -1
- package/dist/core/agents/index.js +4 -5
- package/dist/core/agents/live-authority-v3.d.ts +59 -0
- package/dist/core/agents/live-authority-v3.d.ts.map +1 -0
- package/dist/core/agents/live-authority-v3.js +233 -0
- package/dist/core/agents/live-lifecycle-v3.d.ts +20 -0
- package/dist/core/agents/live-lifecycle-v3.d.ts.map +1 -0
- package/dist/core/agents/live-lifecycle-v3.js +91 -0
- package/dist/core/agents/live-observation-v3.d.ts +25 -0
- package/dist/core/agents/live-observation-v3.d.ts.map +1 -0
- package/dist/core/agents/live-observation-v3.js +157 -0
- package/dist/core/agents/render/prompt-context.d.ts +4 -4
- package/dist/core/agents/render/prompt-context.d.ts.map +1 -1
- package/dist/core/agents/render/prompt-context.js +23 -58
- package/dist/core/agents/render/session-context.d.ts +1 -1
- package/dist/core/agents/render/session-context.d.ts.map +1 -1
- package/dist/core/agents/render/session-context.js +8 -32
- package/dist/core/agents/rules/claim-conflict.d.ts +3 -3
- package/dist/core/agents/rules/claim-conflict.d.ts.map +1 -1
- package/dist/core/agents/rules/claim-conflict.js +79 -127
- package/dist/core/agents/rules/commit-conflict.d.ts.map +1 -1
- package/dist/core/agents/rules/commit-conflict.js +3 -18
- package/dist/core/agents/rules/stop-hook.d.ts +9 -50
- package/dist/core/agents/rules/stop-hook.d.ts.map +1 -1
- package/dist/core/agents/rules/stop-hook.js +193 -236
- package/dist/core/agents/session-events.d.ts +5 -7
- package/dist/core/agents/session-events.d.ts.map +1 -1
- package/dist/core/agents/session-events.js +127 -95
- package/dist/core/agents/session-finalization-state-v3.d.ts +30 -0
- package/dist/core/agents/session-finalization-state-v3.d.ts.map +1 -0
- package/dist/core/agents/session-finalization-state-v3.js +40 -0
- package/dist/core/agents/session-finalizer-v3.d.ts +107 -0
- package/dist/core/agents/session-finalizer-v3.d.ts.map +1 -0
- package/dist/core/agents/session-finalizer-v3.js +734 -0
- package/dist/core/agents/session-name-display.d.ts +40 -0
- package/dist/core/agents/session-name-display.d.ts.map +1 -0
- package/dist/core/agents/session-name-display.js +119 -0
- package/dist/core/agents/state/activity-log.d.ts +3 -3
- package/dist/core/agents/state/activity-log.d.ts.map +1 -1
- package/dist/core/agents/state/activity-log.js +7 -16
- package/dist/core/agents/state/heartbeat-writer.d.ts +23 -55
- package/dist/core/agents/state/heartbeat-writer.d.ts.map +1 -1
- package/dist/core/agents/state/heartbeat-writer.js +56 -228
- package/dist/core/agents/state/live-coordination-view.d.ts +31 -0
- package/dist/core/agents/state/live-coordination-view.d.ts.map +1 -0
- package/dist/core/agents/state/live-coordination-view.js +209 -0
- package/dist/core/agents/state/session-state.d.ts +4 -3
- package/dist/core/agents/state/session-state.d.ts.map +1 -1
- package/dist/core/agents/state/session-state.js +18 -9
- package/dist/core/agents/state/stale-sweep.d.ts +1 -1
- package/dist/core/agents/state/stale-sweep.d.ts.map +1 -1
- package/dist/core/agents/state/stale-sweep.js +26 -15
- package/dist/core/artifacts/index.d.ts.map +1 -1
- package/dist/core/artifacts/index.js +5 -7
- package/dist/core/config.d.ts +33 -2
- package/dist/core/config.d.ts.map +1 -1
- package/dist/core/config.js +98 -2
- package/dist/core/context/index.d.ts +1 -4
- package/dist/core/context/index.d.ts.map +1 -1
- package/dist/core/context/index.js +9 -9
- package/dist/core/events/span-parent.d.ts +15 -0
- package/dist/core/events/span-parent.d.ts.map +1 -0
- package/dist/core/events/span-parent.js +34 -0
- package/dist/core/events/v3/advance.d.ts +14 -0
- package/dist/core/events/v3/advance.d.ts.map +1 -0
- package/dist/core/events/v3/advance.js +134 -0
- package/dist/core/events/v3/authority-outbox.d.ts +78 -0
- package/dist/core/events/v3/authority-outbox.d.ts.map +1 -0
- package/dist/core/events/v3/authority-outbox.js +399 -0
- package/dist/core/events/v3/base-builder.d.ts +20 -0
- package/dist/core/events/v3/base-builder.d.ts.map +1 -0
- package/dist/core/events/v3/base-builder.js +29 -0
- package/dist/core/events/v3/base-contract.d.ts +7576 -0
- package/dist/core/events/v3/base-contract.d.ts.map +1 -0
- package/dist/core/events/v3/base-contract.js +647 -0
- package/dist/core/events/v3/bootstrap.d.ts +34 -0
- package/dist/core/events/v3/bootstrap.d.ts.map +1 -0
- package/dist/core/events/v3/bootstrap.js +175 -0
- package/dist/core/events/v3/builder.d.ts +20 -0
- package/dist/core/events/v3/builder.d.ts.map +1 -0
- package/dist/core/events/v3/builder.js +28 -0
- package/dist/core/events/v3/canonical.d.ts +31 -0
- package/dist/core/events/v3/canonical.d.ts.map +1 -0
- package/dist/core/events/v3/canonical.js +100 -0
- package/dist/core/events/v3/capabilities.d.ts +31 -0
- package/dist/core/events/v3/capabilities.d.ts.map +1 -0
- package/dist/core/events/v3/capabilities.js +107 -0
- package/dist/core/events/v3/capability-drift.d.ts +22 -0
- package/dist/core/events/v3/capability-drift.d.ts.map +1 -0
- package/dist/core/events/v3/capability-drift.js +134 -0
- package/dist/core/events/v3/catalog.d.ts +38 -0
- package/dist/core/events/v3/catalog.d.ts.map +1 -0
- package/dist/core/events/v3/catalog.js +135 -0
- package/dist/core/events/v3/clock-order.d.ts +34 -0
- package/dist/core/events/v3/clock-order.d.ts.map +1 -0
- package/dist/core/events/v3/clock-order.js +35 -0
- package/dist/core/events/v3/contract.d.ts +171 -0
- package/dist/core/events/v3/contract.d.ts.map +1 -0
- package/dist/core/events/v3/contract.js +180 -0
- package/dist/core/events/v3/control.d.ts +111 -0
- package/dist/core/events/v3/control.d.ts.map +1 -0
- package/dist/core/events/v3/control.js +419 -0
- package/dist/core/events/v3/coordination-view.d.ts +69 -0
- package/dist/core/events/v3/coordination-view.d.ts.map +1 -0
- package/dist/core/events/v3/coordination-view.js +119 -0
- package/dist/core/events/v3/economics.d.ts +77 -0
- package/dist/core/events/v3/economics.d.ts.map +1 -0
- package/dist/core/events/v3/economics.js +274 -0
- package/dist/core/events/v3/finalization-view.d.ts +26 -0
- package/dist/core/events/v3/finalization-view.d.ts.map +1 -0
- package/dist/core/events/v3/finalization-view.js +37 -0
- package/dist/core/events/v3/fingerprint-keys.d.ts +25 -0
- package/dist/core/events/v3/fingerprint-keys.d.ts.map +1 -0
- package/dist/core/events/v3/fingerprint-keys.js +217 -0
- package/dist/core/events/v3/generated.d.ts +4 -0
- package/dist/core/events/v3/generated.d.ts.map +1 -0
- package/dist/core/events/v3/generated.js +47 -0
- package/dist/core/events/v3/ids.d.ts +9 -0
- package/dist/core/events/v3/ids.d.ts.map +1 -0
- package/dist/core/events/v3/ids.js +25 -0
- package/dist/core/events/v3/index.d.ts +35 -0
- package/dist/core/events/v3/index.d.ts.map +1 -0
- package/dist/core/events/v3/index.js +33 -0
- package/dist/core/events/v3/latency.d.ts +63 -0
- package/dist/core/events/v3/latency.d.ts.map +1 -0
- package/dist/core/events/v3/latency.js +412 -0
- package/dist/core/events/v3/live-feed.d.ts +45 -0
- package/dist/core/events/v3/live-feed.d.ts.map +1 -0
- package/dist/core/events/v3/live-feed.js +246 -0
- package/dist/core/events/v3/live-observation.d.ts +35 -0
- package/dist/core/events/v3/live-observation.d.ts.map +1 -0
- package/dist/core/events/v3/live-observation.js +1 -0
- package/dist/core/events/v3/live-routing.d.ts +57 -0
- package/dist/core/events/v3/live-routing.d.ts.map +1 -0
- package/dist/core/events/v3/live-routing.js +107 -0
- package/dist/core/events/v3/producers/command-recorder.d.ts +67 -0
- package/dist/core/events/v3/producers/command-recorder.d.ts.map +1 -0
- package/dist/core/events/v3/producers/command-recorder.js +477 -0
- package/dist/core/events/v3/producers/command.d.ts +50 -0
- package/dist/core/events/v3/producers/command.d.ts.map +1 -0
- package/dist/core/events/v3/producers/command.js +135 -0
- package/dist/core/events/v3/producers/coordination-recorder.d.ts +53 -0
- package/dist/core/events/v3/producers/coordination-recorder.d.ts.map +1 -0
- package/dist/core/events/v3/producers/coordination-recorder.js +376 -0
- package/dist/core/events/v3/producers/coordination.d.ts +90 -0
- package/dist/core/events/v3/producers/coordination.d.ts.map +1 -0
- package/dist/core/events/v3/producers/coordination.js +229 -0
- package/dist/core/events/v3/producers/hook-base.d.ts +54 -0
- package/dist/core/events/v3/producers/hook-base.d.ts.map +1 -0
- package/dist/core/events/v3/producers/hook-base.js +424 -0
- package/dist/core/events/v3/producers/hook.d.ts +29 -0
- package/dist/core/events/v3/producers/hook.d.ts.map +1 -0
- package/dist/core/events/v3/producers/hook.js +71 -0
- package/dist/core/events/v3/producers/intake.d.ts +65 -0
- package/dist/core/events/v3/producers/intake.d.ts.map +1 -0
- package/dist/core/events/v3/producers/intake.js +244 -0
- package/dist/core/events/v3/producers/recorder.d.ts +240 -0
- package/dist/core/events/v3/producers/recorder.d.ts.map +1 -0
- package/dist/core/events/v3/producers/recorder.js +2176 -0
- package/dist/core/events/v3/projection.d.ts +101 -0
- package/dist/core/events/v3/projection.d.ts.map +1 -0
- package/dist/core/events/v3/projection.js +479 -0
- package/dist/core/events/v3/reader.d.ts +75 -0
- package/dist/core/events/v3/reader.d.ts.map +1 -0
- package/dist/core/events/v3/reader.js +778 -0
- package/dist/core/events/v3/recovery-record.d.ts +47 -0
- package/dist/core/events/v3/recovery-record.d.ts.map +1 -0
- package/dist/core/events/v3/recovery-record.js +167 -0
- package/dist/core/events/v3/recovery.d.ts +22 -0
- package/dist/core/events/v3/recovery.d.ts.map +1 -0
- package/dist/core/events/v3/recovery.js +227 -0
- package/dist/core/events/v3/span-state.d.ts +52 -0
- package/dist/core/events/v3/span-state.d.ts.map +1 -0
- package/dist/core/events/v3/span-state.js +142 -0
- package/dist/core/events/v3/targets.d.ts +23 -0
- package/dist/core/events/v3/targets.d.ts.map +1 -0
- package/dist/core/events/v3/targets.js +134 -0
- package/dist/core/events/v3/turn-telemetry.d.ts +41 -0
- package/dist/core/events/v3/turn-telemetry.d.ts.map +1 -0
- package/dist/core/events/v3/turn-telemetry.js +168 -0
- package/dist/core/events/v3/validate.d.ts +9 -0
- package/dist/core/events/v3/validate.d.ts.map +1 -0
- package/dist/core/events/v3/validate.js +281 -0
- package/dist/core/events/v3/writer.d.ts +56 -0
- package/dist/core/events/v3/writer.d.ts.map +1 -0
- package/dist/core/events/v3/writer.js +335 -0
- package/dist/core/governor/index.d.ts +1 -1
- package/dist/core/governor/index.d.ts.map +1 -1
- package/dist/core/governor/index.js +1 -1
- package/dist/core/governor/plan-api.d.ts +2 -1
- package/dist/core/governor/plan-api.d.ts.map +1 -1
- package/dist/core/governor/plan-api.js +6 -3
- package/dist/core/governor/read.d.ts +1 -1
- package/dist/core/governor/read.d.ts.map +1 -1
- package/dist/core/governor/read.js +1 -1
- package/dist/core/governor/state.d.ts +9 -0
- package/dist/core/governor/state.d.ts.map +1 -1
- package/dist/core/governor/state.js +40 -3
- package/dist/core/guard/config.d.ts +5 -0
- package/dist/core/guard/config.d.ts.map +1 -0
- package/dist/core/guard/config.js +157 -0
- package/dist/core/guard/coordinator.d.ts +14 -0
- package/dist/core/guard/coordinator.d.ts.map +1 -0
- package/dist/core/guard/coordinator.js +173 -0
- package/dist/core/guard/evaluator.d.ts +4 -0
- package/dist/core/guard/evaluator.d.ts.map +1 -0
- package/dist/core/guard/evaluator.js +242 -0
- package/dist/core/guard/evidence-v3.d.ts +15 -0
- package/dist/core/guard/evidence-v3.d.ts.map +1 -0
- package/dist/core/guard/evidence-v3.js +171 -0
- package/dist/core/guard/index.d.ts +10 -0
- package/dist/core/guard/index.d.ts.map +1 -0
- package/dist/core/guard/index.js +6 -0
- package/dist/core/guard/live-source-v3.d.ts +40 -0
- package/dist/core/guard/live-source-v3.d.ts.map +1 -0
- package/dist/core/guard/live-source-v3.js +128 -0
- package/dist/core/guard/storage.d.ts +27 -0
- package/dist/core/guard/storage.d.ts.map +1 -0
- package/dist/core/guard/storage.js +140 -0
- package/dist/core/guard/types.d.ts +119 -0
- package/dist/core/guard/types.d.ts.map +1 -0
- package/dist/core/guard/types.js +1 -0
- package/dist/core/hooks/adapter/detect.d.ts +18 -1
- package/dist/core/hooks/adapter/detect.d.ts.map +1 -1
- package/dist/core/hooks/adapter/detect.js +29 -0
- package/dist/core/hooks/adapter/events.d.ts +7 -4
- package/dist/core/hooks/adapter/events.d.ts.map +1 -1
- package/dist/core/hooks/adapter/events.js +12 -4
- package/dist/core/hooks/adapter/output.d.ts +2 -2
- package/dist/core/hooks/adapter/output.d.ts.map +1 -1
- package/dist/core/hooks/adapter/parse.d.ts +7 -4
- package/dist/core/hooks/adapter/parse.d.ts.map +1 -1
- package/dist/core/hooks/adapter/parse.js +63 -25
- package/dist/core/hooks/adapter/wiring.d.ts +30 -4
- package/dist/core/hooks/adapter/wiring.d.ts.map +1 -1
- package/dist/core/hooks/adapter/wiring.js +89 -11
- package/dist/core/hooks/cli.d.ts +1 -1
- package/dist/core/hooks/cli.js +306 -444
- package/dist/core/hooks/effects/image-capture.d.ts +20 -34
- package/dist/core/hooks/effects/image-capture.d.ts.map +1 -1
- package/dist/core/hooks/effects/image-capture.js +212 -221
- package/dist/core/hooks/effects/index.d.ts +1 -9
- package/dist/core/hooks/effects/index.d.ts.map +1 -1
- package/dist/core/hooks/effects/index.js +1 -24
- package/dist/core/hooks/events/input-hash.d.ts +7 -0
- package/dist/core/hooks/events/input-hash.d.ts.map +1 -0
- package/dist/core/hooks/events/input-hash.js +43 -0
- package/dist/core/hooks/index.d.ts +4 -3
- package/dist/core/hooks/index.d.ts.map +1 -1
- package/dist/core/hooks/index.js +2 -3
- package/dist/core/hooks/resolve/coord-root.d.ts +1 -1
- package/dist/core/hooks/resolve/coord-root.js +1 -1
- package/dist/core/hooks/resolve/owner.d.ts +16 -15
- package/dist/core/hooks/resolve/owner.d.ts.map +1 -1
- package/dist/core/hooks/resolve/owner.js +51 -42
- package/dist/core/hooks/resolve/transcript.d.ts +33 -3
- package/dist/core/hooks/resolve/transcript.d.ts.map +1 -1
- package/dist/core/hooks/resolve/transcript.js +161 -14
- package/dist/core/hooks/session-name-presence.d.ts +9 -10
- package/dist/core/hooks/session-name-presence.d.ts.map +1 -1
- package/dist/core/hooks/session-name-presence.js +15 -15
- package/dist/core/hooks/unsafe-cross-shell.d.ts +1 -1
- package/dist/core/hooks/unsafe-cross-shell.d.ts.map +1 -1
- package/dist/core/journal/index.d.ts +2 -2
- package/dist/core/journal/index.d.ts.map +1 -1
- package/dist/core/journal/index.js +9 -22
- package/dist/core/presence/blob.d.ts +4 -3
- package/dist/core/presence/blob.d.ts.map +1 -1
- package/dist/core/presence/blob.js +45 -44
- package/dist/core/presence/codec-digest.d.ts +29 -0
- package/dist/core/presence/codec-digest.d.ts.map +1 -0
- package/dist/core/presence/codec-digest.js +170 -0
- package/dist/core/presence/relay-client.d.ts +1 -1
- package/dist/core/presence/relay-client.d.ts.map +1 -1
- package/dist/core/presence/relay-client.js +5 -5
- package/dist/core/work/index.d.ts +1 -1
- package/dist/core/work/index.d.ts.map +1 -1
- package/dist/core/work/index.js +1 -1
- package/dist/core/work/read.d.ts +1 -1
- package/dist/core/work/read.d.ts.map +1 -1
- package/dist/core/work/read.js +1 -1
- package/dist/core/work/runner.d.ts.map +1 -1
- package/dist/core/work/runner.js +6 -0
- package/dist/core/work/state.d.ts +9 -0
- package/dist/core/work/state.d.ts.map +1 -1
- package/dist/core/work/state.js +17 -3
- package/dist/core/workflow/engine.js +24 -25
- package/dist/core/workflow/live-session-v3.d.ts +19 -0
- package/dist/core/workflow/live-session-v3.d.ts.map +1 -0
- package/dist/core/workflow/live-session-v3.js +86 -0
- package/dist/core/workflow/scope-id.d.ts +3 -0
- package/dist/core/workflow/scope-id.d.ts.map +1 -0
- package/dist/core/workflow/scope-id.js +5 -0
- package/dist/core/workflow/workspaces/leases.d.ts +4 -0
- package/dist/core/workflow/workspaces/leases.d.ts.map +1 -1
- package/dist/core/workflow/workspaces/leases.js +53 -19
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/lib/browser/client.d.ts +41 -0
- package/dist/lib/browser/client.d.ts.map +1 -1
- package/dist/lib/browser/client.js +203 -0
- package/dist/lib/browser/critique.d.ts +28 -2
- package/dist/lib/browser/critique.d.ts.map +1 -1
- package/dist/lib/browser/critique.js +74 -18
- package/dist/lib/browser/geometry.d.ts +1 -1
- package/dist/lib/browser/geometry.d.ts.map +1 -1
- package/dist/lib/browser/geometry.js +130 -6
- package/dist/lib/browser/index.d.ts +3 -0
- package/dist/lib/browser/index.d.ts.map +1 -1
- package/dist/lib/browser/index.js +3 -0
- package/dist/lib/browser/qa-plan.d.ts +174 -0
- package/dist/lib/browser/qa-plan.d.ts.map +1 -0
- package/dist/lib/browser/qa-plan.js +321 -0
- package/dist/lib/browser/qa-reuse.d.ts +99 -0
- package/dist/lib/browser/qa-reuse.d.ts.map +1 -0
- package/dist/lib/browser/qa-reuse.js +222 -0
- package/dist/lib/browser/qa-snapshot.d.ts +64 -0
- package/dist/lib/browser/qa-snapshot.d.ts.map +1 -0
- package/dist/lib/browser/qa-snapshot.js +171 -0
- package/dist/lib/browser/runts.d.ts.map +1 -1
- package/dist/lib/browser/runts.js +22 -1
- package/dist/lib/browser/tiling.d.ts +71 -0
- package/dist/lib/browser/tiling.d.ts.map +1 -0
- package/dist/lib/browser/tiling.js +118 -0
- package/dist/lib/claude-desktop.d.ts +0 -47
- package/dist/lib/claude-desktop.d.ts.map +1 -1
- package/dist/lib/claude-desktop.js +1 -169
- package/dist/lib/context/index.d.ts +0 -3
- package/dist/lib/context/index.d.ts.map +1 -1
- package/dist/lib/context/index.js +20 -42
- package/dist/lib/council/index.d.ts +2 -2
- package/dist/lib/council/index.d.ts.map +1 -1
- package/dist/lib/council/index.js +9 -20
- package/dist/lib/docs-frontmatter.d.ts +1 -6
- package/dist/lib/docs-frontmatter.d.ts.map +1 -1
- package/dist/lib/docs-frontmatter.js +12 -78
- package/dist/lib/docs-index.d.ts +9 -0
- package/dist/lib/docs-index.d.ts.map +1 -1
- package/dist/lib/docs-index.js +32 -3
- package/dist/lib/docs-lint.d.ts.map +1 -1
- package/dist/lib/docs-lint.js +14 -30
- package/dist/lib/docs-metadata-audit.d.ts +19 -0
- package/dist/lib/docs-metadata-audit.d.ts.map +1 -0
- package/dist/lib/docs-metadata-audit.js +132 -0
- package/dist/lib/docs-metadata-managed.d.ts +23 -0
- package/dist/lib/docs-metadata-managed.d.ts.map +1 -0
- package/dist/lib/docs-metadata-managed.js +78 -0
- package/dist/lib/docs-metadata-sync.d.ts +20 -0
- package/dist/lib/docs-metadata-sync.d.ts.map +1 -0
- package/dist/lib/docs-metadata-sync.js +222 -0
- package/dist/lib/docs-metadata-v2-schema.d.ts +273 -0
- package/dist/lib/docs-metadata-v2-schema.d.ts.map +1 -0
- package/dist/lib/docs-metadata-v2-schema.js +134 -0
- package/dist/lib/docs-metadata-v2.d.ts +21 -0
- package/dist/lib/docs-metadata-v2.d.ts.map +1 -0
- package/dist/lib/docs-metadata-v2.js +424 -0
- package/dist/lib/docs-new.d.ts +11 -0
- package/dist/lib/docs-new.d.ts.map +1 -0
- package/dist/lib/docs-new.js +52 -0
- package/dist/lib/docs-sweep.d.ts.map +1 -1
- package/dist/lib/docs-sweep.js +45 -29
- package/dist/lib/headless/index.d.ts +98 -0
- package/dist/lib/headless/index.d.ts.map +1 -0
- package/dist/lib/headless/index.js +211 -0
- package/dist/lib/identities/assume.d.ts +4 -4
- package/dist/lib/identities/assume.d.ts.map +1 -1
- package/dist/lib/identities/assume.js +52 -68
- package/dist/lib/instructions/apply.d.ts +5 -4
- package/dist/lib/instructions/apply.d.ts.map +1 -1
- package/dist/lib/instructions/apply.js +32 -20
- package/dist/lib/instructions/bundle.d.ts +1 -1
- package/dist/lib/instructions/bundle.d.ts.map +1 -1
- package/dist/lib/instructions/bundle.js +1 -1
- package/dist/lib/instructions/splice.d.ts +0 -1
- package/dist/lib/instructions/splice.d.ts.map +1 -1
- package/dist/lib/instructions/splice.js +22 -6
- package/dist/lib/instructions/templates.d.ts +7 -5
- package/dist/lib/instructions/templates.d.ts.map +1 -1
- package/dist/lib/instructions/templates.js +79 -9
- package/package.json +26 -5
- package/schemas/config.schema.json +120 -2
- package/schemas/docs-metadata-v2.schema.json +441 -0
- package/schemas/event-v3.schema.json +24472 -0
- package/src/commander.ts +4 -0
- package/src/commands/adapter.ts +2 -2
- package/src/commands/agents.ts +1530 -593
- package/src/commands/artifacts.ts +7 -6
- package/src/commands/backup.ts +29 -21
- package/src/commands/browse.ts +349 -8
- package/src/commands/checkpoint.ts +4 -3
- package/src/commands/claude-desktop.ts +2 -101
- package/src/commands/context.ts +1 -6
- package/src/commands/decision.ts +27 -44
- package/src/commands/docs.ts +100 -33
- package/src/commands/doctor.ts +14 -1
- package/src/commands/events.ts +256 -0
- package/src/commands/governor.ts +18 -4
- package/src/commands/init.ts +253 -57
- package/src/commands/instructions.ts +1 -1
- package/src/commands/journal.ts +4 -13
- package/src/commands/ledger-v3.ts +111 -0
- package/src/commands/presence.ts +11 -10
- package/src/commands/sync.ts +1 -1
- package/src/commands/web.ts +67 -8
- package/src/commands/work.ts +28 -5
- package/src/core/adapter.ts +5 -0
- package/src/core/adapters/attest.ts +8 -3
- package/src/core/adapters/profiles.ts +4 -6
- package/src/core/agents/canonical-emit.ts +34 -25
- package/src/core/agents/cli.ts +236 -262
- package/src/core/agents/codex-archive-v3.ts +138 -0
- package/src/core/agents/coord-client.ts +75 -188
- package/src/core/agents/finalization.ts +120 -38
- package/src/core/agents/index.ts +4 -5
- package/src/core/agents/live-authority-v3.ts +375 -0
- package/src/core/agents/live-lifecycle-v3.ts +140 -0
- package/src/core/agents/live-observation-v3.ts +216 -0
- package/src/core/agents/render/prompt-context.ts +29 -60
- package/src/core/agents/render/session-context.ts +10 -31
- package/src/core/agents/rules/claim-conflict.ts +85 -126
- package/src/core/agents/rules/commit-conflict.ts +3 -14
- package/src/core/agents/rules/stop-hook.ts +239 -293
- package/src/core/agents/session-events.ts +137 -104
- package/src/core/agents/session-finalization-state-v3.ts +90 -0
- package/src/core/agents/session-finalizer-v3.ts +953 -0
- package/src/core/agents/session-name-display.ts +149 -0
- package/src/core/agents/state/activity-log.ts +6 -14
- package/src/core/agents/state/heartbeat-writer.ts +82 -277
- package/src/core/agents/state/live-coordination-view.ts +290 -0
- package/src/core/agents/state/session-state.ts +24 -12
- package/src/core/agents/state/stale-sweep.ts +40 -17
- package/src/core/artifacts/index.ts +4 -5
- package/src/core/config.ts +148 -3
- package/src/core/context/index.ts +9 -17
- package/src/core/events/span-parent.ts +46 -0
- package/src/core/events/v3/advance.ts +168 -0
- package/src/core/events/v3/authority-outbox.ts +548 -0
- package/src/core/events/v3/base-builder.ts +60 -0
- package/src/core/events/v3/base-contract.ts +882 -0
- package/src/core/events/v3/bootstrap.ts +226 -0
- package/src/core/events/v3/builder.ts +59 -0
- package/src/core/events/v3/canonical.ts +153 -0
- package/src/core/events/v3/capabilities.ts +171 -0
- package/src/core/events/v3/capability-drift.ts +177 -0
- package/src/core/events/v3/catalog.ts +202 -0
- package/src/core/events/v3/clock-order.ts +41 -0
- package/src/core/events/v3/contract.ts +365 -0
- package/src/core/events/v3/control.ts +576 -0
- package/src/core/events/v3/coordination-view.ts +193 -0
- package/src/core/events/v3/economics.ts +384 -0
- package/src/core/events/v3/finalization-view.ts +67 -0
- package/src/core/events/v3/fingerprint-keys.ts +260 -0
- package/src/core/events/v3/generated.ts +48 -0
- package/src/core/events/v3/ids.ts +33 -0
- package/src/core/events/v3/index.ts +322 -0
- package/src/core/events/v3/latency.ts +551 -0
- package/src/core/events/v3/live-feed.ts +319 -0
- package/src/core/events/v3/live-observation.ts +39 -0
- package/src/core/events/v3/live-routing.ts +135 -0
- package/src/core/events/v3/producers/command-recorder.ts +631 -0
- package/src/core/events/v3/producers/command.ts +201 -0
- package/src/core/events/v3/producers/coordination-recorder.ts +538 -0
- package/src/core/events/v3/producers/coordination.ts +355 -0
- package/src/core/events/v3/producers/hook-base.ts +578 -0
- package/src/core/events/v3/producers/hook.ts +119 -0
- package/src/core/events/v3/producers/intake.ts +319 -0
- package/src/core/events/v3/producers/recorder.ts +2805 -0
- package/src/core/events/v3/projection.ts +653 -0
- package/src/core/events/v3/reader.ts +1127 -0
- package/src/core/events/v3/recovery-record.ts +244 -0
- package/src/core/events/v3/recovery.ts +271 -0
- package/src/core/events/v3/span-state.ts +187 -0
- package/src/core/events/v3/targets.ts +182 -0
- package/src/core/events/v3/turn-telemetry.ts +259 -0
- package/src/core/events/v3/validate.ts +361 -0
- package/src/core/events/v3/writer.ts +419 -0
- package/src/core/governor/index.ts +3 -0
- package/src/core/governor/plan-api.ts +10 -2
- package/src/core/governor/read.ts +3 -0
- package/src/core/governor/state.ts +52 -5
- package/src/core/guard/config.ts +206 -0
- package/src/core/guard/coordinator.ts +227 -0
- package/src/core/guard/evaluator.ts +343 -0
- package/src/core/guard/evidence-v3.ts +227 -0
- package/src/core/guard/index.ts +35 -0
- package/src/core/guard/live-source-v3.ts +204 -0
- package/src/core/guard/storage.ts +188 -0
- package/src/core/guard/types.ts +152 -0
- package/src/core/hooks/adapter/detect.ts +28 -1
- package/src/core/hooks/adapter/events.ts +14 -6
- package/src/core/hooks/adapter/output.ts +7 -2
- package/src/core/hooks/adapter/parse.ts +80 -38
- package/src/core/hooks/adapter/wiring.ts +119 -13
- package/src/core/hooks/cli.ts +352 -466
- package/src/core/hooks/effects/image-capture.ts +228 -238
- package/src/core/hooks/effects/index.ts +1 -36
- package/src/core/hooks/events/input-hash.ts +47 -0
- package/src/core/hooks/index.ts +4 -11
- package/src/core/hooks/resolve/coord-root.ts +1 -1
- package/src/core/hooks/resolve/owner.ts +52 -45
- package/src/core/hooks/resolve/transcript.ts +171 -14
- package/src/core/hooks/session-name-presence.ts +14 -15
- package/src/core/hooks/unsafe-cross-shell.ts +1 -1
- package/src/core/journal/index.ts +15 -22
- package/src/core/presence/blob.ts +48 -41
- package/src/core/presence/codec-digest.ts +215 -0
- package/src/core/presence/relay-client.ts +5 -5
- package/src/core/work/index.ts +3 -0
- package/src/core/work/read.ts +3 -0
- package/src/core/work/runner.ts +6 -0
- package/src/core/work/state.ts +27 -3
- package/src/core/workflow/engine.ts +24 -24
- package/src/core/workflow/live-session-v3.ts +126 -0
- package/src/core/workflow/scope-id.ts +6 -0
- package/src/core/workflow/workspaces/leases.ts +56 -19
- package/src/index.ts +1 -1
- package/src/lib/browser/client.ts +230 -0
- package/src/lib/browser/critique.ts +104 -27
- package/src/lib/browser/geometry.ts +143 -14
- package/src/lib/browser/index.ts +34 -0
- package/src/lib/browser/qa-plan.ts +501 -0
- package/src/lib/browser/qa-reuse.ts +306 -0
- package/src/lib/browser/qa-snapshot.ts +223 -0
- package/src/lib/browser/runts.ts +27 -2
- package/src/lib/browser/tiling.ts +164 -0
- package/src/lib/claude-desktop.ts +1 -232
- package/src/lib/context/index.ts +22 -46
- package/src/lib/council/index.ts +9 -21
- package/src/lib/docs-frontmatter.ts +8 -79
- package/src/lib/docs-index.ts +33 -3
- package/src/lib/docs-lint.ts +15 -29
- package/src/lib/docs-metadata-audit.ts +166 -0
- package/src/lib/docs-metadata-managed.ts +83 -0
- package/src/lib/docs-metadata-sync.ts +262 -0
- package/src/lib/docs-metadata-v2-schema.ts +138 -0
- package/src/lib/docs-metadata-v2.ts +646 -0
- package/src/lib/docs-new.ts +63 -0
- package/src/lib/docs-sweep.ts +42 -28
- package/src/lib/headless/index.ts +287 -0
- package/src/lib/identities/assume.ts +67 -86
- package/src/lib/instructions/apply.ts +33 -20
- package/src/lib/instructions/bundle.ts +2 -2
- package/src/lib/instructions/splice.ts +21 -7
- package/src/lib/instructions/templates.ts +85 -13
- package/dist/core/agents/cli-emit.d.ts +0 -27
- package/dist/core/agents/cli-emit.d.ts.map +0 -1
- package/dist/core/agents/cli-emit.js +0 -57
- package/dist/core/agents/codex-replay.d.ts +0 -29
- package/dist/core/agents/codex-replay.d.ts.map +0 -1
- package/dist/core/agents/codex-replay.js +0 -138
- package/dist/core/agents/events/consume.d.ts +0 -82
- package/dist/core/agents/events/consume.d.ts.map +0 -1
- package/dist/core/agents/events/consume.js +0 -195
- package/dist/core/agents/events/emit.d.ts +0 -42
- package/dist/core/agents/events/emit.d.ts.map +0 -1
- package/dist/core/agents/events/emit.js +0 -75
- package/dist/core/agents/events/ulid.d.ts +0 -11
- package/dist/core/agents/events/ulid.d.ts.map +0 -1
- package/dist/core/agents/events/ulid.js +0 -47
- package/dist/core/agents/state/heartbeat-projector.d.ts +0 -76
- package/dist/core/agents/state/heartbeat-projector.d.ts.map +0 -1
- package/dist/core/agents/state/heartbeat-projector.js +0 -581
- package/dist/core/hooks/events/emit.d.ts +0 -31
- package/dist/core/hooks/events/emit.d.ts.map +0 -1
- package/dist/core/hooks/events/emit.js +0 -93
- package/dist/core/hooks/events/rotate.d.ts +0 -43
- package/dist/core/hooks/events/rotate.d.ts.map +0 -1
- package/dist/core/hooks/events/rotate.js +0 -142
- package/dist/core/hooks/events/schema.d.ts +0 -341
- package/dist/core/hooks/events/schema.d.ts.map +0 -1
- package/dist/core/hooks/events/schema.js +0 -12
- package/dist/core/hooks/events/ulid.d.ts +0 -10
- package/dist/core/hooks/events/ulid.d.ts.map +0 -1
- package/dist/core/hooks/events/ulid.js +0 -47
- package/dist/lib/docs-frontmatter-migrate.d.ts +0 -33
- package/dist/lib/docs-frontmatter-migrate.d.ts.map +0 -1
- package/dist/lib/docs-frontmatter-migrate.js +0 -364
- package/src/core/agents/cli-emit.ts +0 -64
- package/src/core/agents/codex-replay.ts +0 -163
- package/src/core/agents/events/consume.ts +0 -254
- package/src/core/agents/events/emit.ts +0 -115
- package/src/core/agents/events/ulid.ts +0 -51
- package/src/core/agents/state/heartbeat-projector.ts +0 -645
- package/src/core/hooks/events/emit.ts +0 -125
- package/src/core/hooks/events/rotate.ts +0 -151
- package/src/core/hooks/events/schema.ts +0 -582
- package/src/core/hooks/events/ulid.ts +0 -51
- package/src/lib/docs-frontmatter-migrate.ts +0 -427
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import { copyFileSync, existsSync, mkdtempSync, readdirSync, rmSync } from "node:fs";
|
|
2
|
+
import { createRequire } from "node:module";
|
|
3
|
+
import { homedir, tmpdir } from "node:os";
|
|
4
|
+
import { basename, join } from "node:path";
|
|
5
|
+
import { normalizeNativeIdV3 } from "../events/v3/canonical.js";
|
|
6
|
+
import { readEventV3ControlState } from "../events/v3/control.js";
|
|
7
|
+
import { fingerprintContextV3 } from "../events/v3/fingerprint-keys.js";
|
|
8
|
+
import { listHookProducerStateRecordsV3 } from "../events/v3/producers/recorder.js";
|
|
9
|
+
const require = createRequire(import.meta.url);
|
|
10
|
+
/** bun:sqlite is Bun-only. The web dashboard runs under Node and must be able
|
|
11
|
+
* to import this module without crashing; a missing engine returns no rows. */
|
|
12
|
+
function openReadonlyDatabase(path) {
|
|
13
|
+
try {
|
|
14
|
+
const { Database } = require("bun:sqlite");
|
|
15
|
+
return new Database(path, { readonly: true, strict: true });
|
|
16
|
+
}
|
|
17
|
+
catch {
|
|
18
|
+
return null;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Read only Codex's durable lifecycle columns. Conversation content, titles,
|
|
23
|
+
* working directories, and model metadata never leave the adapter database.
|
|
24
|
+
*/
|
|
25
|
+
export function readCodexArchiveObservationsV3(coordRoot, options = {}) {
|
|
26
|
+
const diagnostics = [];
|
|
27
|
+
const databasePath = options.databasePath ?? locateCodexStateDatabase();
|
|
28
|
+
if (!databasePath)
|
|
29
|
+
return { observations: [], diagnostics: ["codex_state_database_missing"] };
|
|
30
|
+
const control = readEventV3ControlState(coordRoot);
|
|
31
|
+
if (control.state !== "candidate" && control.state !== "active") {
|
|
32
|
+
return { observations: [], diagnostics: ["event_v3_control_unavailable"] };
|
|
33
|
+
}
|
|
34
|
+
const context = fingerprintContextV3(coordRoot, control.genesis.event.scope.root_id, undefined, control.genesis.profile.privacy_key_epoch);
|
|
35
|
+
const liveCodexStateIds = new Set(listHookProducerStateRecordsV3(coordRoot)
|
|
36
|
+
.filter(({ state }) => state.adapter === "codex")
|
|
37
|
+
.map(({ path }) => basename(path, ".json")));
|
|
38
|
+
const snapshotDir = mkdtempSync(join(tmpdir(), "harnery-codex-state-"));
|
|
39
|
+
const snapshotPath = join(snapshotDir, basename(databasePath));
|
|
40
|
+
try {
|
|
41
|
+
copyFileSync(databasePath, snapshotPath);
|
|
42
|
+
for (const suffix of ["-wal", "-shm"]) {
|
|
43
|
+
const source = `${databasePath}${suffix}`;
|
|
44
|
+
if (existsSync(source))
|
|
45
|
+
copyFileSync(source, `${snapshotPath}${suffix}`);
|
|
46
|
+
}
|
|
47
|
+
const db = openReadonlyDatabase(snapshotPath);
|
|
48
|
+
if (!db) {
|
|
49
|
+
diagnostics.push("codex_archive_sqlite_unavailable");
|
|
50
|
+
return { observations: [], diagnostics };
|
|
51
|
+
}
|
|
52
|
+
try {
|
|
53
|
+
const rows = db
|
|
54
|
+
.query("SELECT id, archived, archived_at, updated_at_ms FROM threads")
|
|
55
|
+
.all();
|
|
56
|
+
return {
|
|
57
|
+
observations: rows
|
|
58
|
+
.filter((row) => liveCodexStateIds.has(normalizeNativeIdV3(context, "codex.session", row.id)))
|
|
59
|
+
.map((row) => ({
|
|
60
|
+
adapter: "codex",
|
|
61
|
+
native_session_id: row.id,
|
|
62
|
+
archived: row.archived === 1,
|
|
63
|
+
observed_at: epochToIso(row.archived_at) ??
|
|
64
|
+
epochToIso(row.updated_at_ms) ??
|
|
65
|
+
options.observedAt ??
|
|
66
|
+
new Date().toISOString(),
|
|
67
|
+
})),
|
|
68
|
+
diagnostics,
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
finally {
|
|
72
|
+
db.close();
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
catch (error) {
|
|
76
|
+
diagnostics.push(`codex_archive_scan_failed:${error.message}`);
|
|
77
|
+
return { observations: [], diagnostics };
|
|
78
|
+
}
|
|
79
|
+
finally {
|
|
80
|
+
rmSync(snapshotDir, { recursive: true, force: true });
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
function locateCodexStateDatabase() {
|
|
84
|
+
const explicit = process.env.HARNERY_CODEX_STATE_DB?.trim();
|
|
85
|
+
if (explicit && existsSync(explicit))
|
|
86
|
+
return explicit;
|
|
87
|
+
for (const candidate of [
|
|
88
|
+
join(homedir(), ".codex", "state_5.sqlite"),
|
|
89
|
+
join(homedir(), ".codex", "sqlite", "state_5.sqlite"),
|
|
90
|
+
]) {
|
|
91
|
+
if (existsSync(candidate))
|
|
92
|
+
return candidate;
|
|
93
|
+
}
|
|
94
|
+
const usersRoot = "/mnt/c/Users";
|
|
95
|
+
if (!existsSync(usersRoot))
|
|
96
|
+
return null;
|
|
97
|
+
for (const user of readdirSync(usersRoot).sort()) {
|
|
98
|
+
const candidate = join(usersRoot, user, ".codex", "state_5.sqlite");
|
|
99
|
+
if (existsSync(candidate))
|
|
100
|
+
return candidate;
|
|
101
|
+
}
|
|
102
|
+
return null;
|
|
103
|
+
}
|
|
104
|
+
function epochToIso(value) {
|
|
105
|
+
if (value === null || !Number.isFinite(value) || value <= 0)
|
|
106
|
+
return null;
|
|
107
|
+
const milliseconds = value < 10_000_000_000 ? value * 1_000 : value;
|
|
108
|
+
const date = new Date(milliseconds);
|
|
109
|
+
return Number.isNaN(date.getTime()) ? null : date.toISOString();
|
|
110
|
+
}
|
|
@@ -21,47 +21,6 @@ export declare function assertSafeInstanceId(value: unknown): asserts value is s
|
|
|
21
21
|
* caller constructs a filename from a different untrusted source.
|
|
22
22
|
*/
|
|
23
23
|
export declare function resolveContainedFile(directory: string, fileName: string): string;
|
|
24
|
-
export interface Heartbeat {
|
|
25
|
-
instance_id: string;
|
|
26
|
-
name?: string;
|
|
27
|
-
kind?: string;
|
|
28
|
-
session_id: string;
|
|
29
|
-
agent_id: string;
|
|
30
|
-
model: string;
|
|
31
|
-
started_at: string;
|
|
32
|
-
last_heartbeat: string;
|
|
33
|
-
files_touched: string[];
|
|
34
|
-
agent_type?: string;
|
|
35
|
-
/** Most recent tool name stamped by the PostToolUse hook. Phase 1. */
|
|
36
|
-
last_tool?: string;
|
|
37
|
-
/** Short string identifying what the last tool acted on (file path, command head, URL). Phase 1. */
|
|
38
|
-
last_tool_target?: string;
|
|
39
|
-
/** Free-form task/intent string set via `harn agents set-task`. Phase 2. */
|
|
40
|
-
task?: string;
|
|
41
|
-
/** UTC ISO-8601 timestamp when task was last set/cleared. Used by adapters without Stop enforcement to compute staleness. 2026-05-24. */
|
|
42
|
-
task_updated_at?: string | null;
|
|
43
|
-
/** Current evidence-derived activity axis. */
|
|
44
|
-
activity?: "unknown" | "working" | "needs_input" | "idle";
|
|
45
|
-
activity_updated_at?: string;
|
|
46
|
-
activity_source?: string;
|
|
47
|
-
/** Explicit task lifecycle axis. */
|
|
48
|
-
task_state?: "active" | "blocked" | "done";
|
|
49
|
-
task_state_updated_at?: string;
|
|
50
|
-
task_state_reason?: string;
|
|
51
|
-
/** Session name built on the first non-empty set-task; its presence means "this session has been named". 2026-08-09. */
|
|
52
|
-
suggested_session_name?: string;
|
|
53
|
-
/** Stamped by turn.stop once the suggested name is seen in assistant reply text. 2026-08-09. */
|
|
54
|
-
session_name_seen_at?: string;
|
|
55
|
-
/** Which suggested name the latest sighting covered. */
|
|
56
|
-
session_name_seen_for?: string;
|
|
57
|
-
/** Auto-generated per-turn summary written by the Stop hook via Haiku. 2026-05-23. */
|
|
58
|
-
turn_summary?: string | null;
|
|
59
|
-
/** UTC ISO-8601 timestamp when turn_summary was last refreshed. */
|
|
60
|
-
turn_summary_updated_at?: string | null;
|
|
61
|
-
/** Hook client: `claude-code` (default) or `cursor`. Cursor Phase 1. */
|
|
62
|
-
platform?: string;
|
|
63
|
-
workflow_run_id?: string;
|
|
64
|
-
}
|
|
65
24
|
/**
|
|
66
25
|
* Resolve the monorepo root for coord-state purposes.
|
|
67
26
|
*
|
|
@@ -73,8 +32,8 @@ export declare function monorepoRoot(): string | null;
|
|
|
73
32
|
* THE coordination-root resolution. Every surface — the hooks, the CLI's reads,
|
|
74
33
|
* and the CLI's canonical emits — resolves through this one function, because a
|
|
75
34
|
* root the two layers disagree about is a root that silently breaks the
|
|
76
|
-
* end-of-turn rules: the hook evaluates `
|
|
77
|
-
* it reads, so an emit into a different
|
|
35
|
+
* end-of-turn rules: the hook evaluates `coord.status_observed` from the stream
|
|
36
|
+
* it reads, so an emit into a different V3 ledger root is invisible
|
|
78
37
|
* and rule 1/3 blocks a turn that did run `agents status`, with no sequence of
|
|
79
38
|
* CLI commands able to satisfy it.
|
|
80
39
|
*
|
|
@@ -108,7 +67,7 @@ export declare function nearestCoordRoot(start: string): string | null;
|
|
|
108
67
|
* Does this root's `.harnery/` already know the process asking?
|
|
109
68
|
*
|
|
110
69
|
* Two discriminators, both genuinely about *this* session: the adapter-exported
|
|
111
|
-
* session id matching
|
|
70
|
+
* session id matching live V3 producer state, and a pid-map row on our own ppid
|
|
112
71
|
* chain. Deliberately NOT the single-live-agent fallback that owner resolution
|
|
113
72
|
* ends with — a lone stranger in the wrong root is exactly how `whoami` came to
|
|
114
73
|
* report another agent's name and task as its own.
|
|
@@ -171,52 +130,31 @@ export declare function resolveOwnerByPidmap(root: string): {
|
|
|
171
130
|
owner: string | null;
|
|
172
131
|
source: "pidmap" | "pidmap_fallback" | "none";
|
|
173
132
|
};
|
|
133
|
+
/** Read normalized candidates from the first non-empty adapter session-id env var. */
|
|
174
134
|
/**
|
|
175
|
-
*
|
|
176
|
-
*
|
|
177
|
-
*
|
|
178
|
-
*
|
|
179
|
-
*
|
|
180
|
-
*
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
135
|
+
* First adapter/bridge-stamped session id from the environment, WITHOUT the
|
|
136
|
+
* live-heartbeat validation resolveOwnerBySessionEnv applies. A fresh session
|
|
137
|
+
* has no heartbeat until its first set-task, so heartbeat-validated resolution
|
|
138
|
+
* returns null there by design; commands that REGISTER a session (set-task)
|
|
139
|
+
* may use this id directly — it carries the same trust as an explicit
|
|
140
|
+
* `--session-id` argument, because the adapter or connector stamped it.
|
|
141
|
+
*/
|
|
142
|
+
export declare function sessionIdentityFromEnv(): string | null;
|
|
143
|
+
/**
|
|
144
|
+
* Resolve the owner by joining adapter session environment to the live V3
|
|
145
|
+
* hook-producer state. A missing, terminal, or ambiguous generation fails
|
|
146
|
+
* closed. The disposable cache is consulted only to recover the native
|
|
147
|
+
* instance label bound to an already-authoritative canonical instance.
|
|
184
148
|
*
|
|
185
149
|
* Exported for unit testing with an injectable root.
|
|
186
150
|
*/
|
|
187
151
|
export declare function resolveOwnerBySessionEnv(root: string): string | null;
|
|
188
152
|
/**
|
|
189
|
-
* Return the
|
|
190
|
-
* if there are zero or more than one.
|
|
191
|
-
* freshness window the rest of the agents surface applies (kept inline as a
|
|
192
|
-
* literal so this file stays node-builtins-only for vendored downstream use).
|
|
153
|
+
* Return the native instance label of the sole live V3 generation in this
|
|
154
|
+
* coord root, or null if there are zero or more than one.
|
|
193
155
|
*
|
|
194
156
|
* Exported for unit testing with an injectable root (the caller in
|
|
195
157
|
* `resolveOwnerWithSource` passes `monorepoRoot()`).
|
|
196
158
|
*/
|
|
197
159
|
export declare function resolveSingleActiveOwner(root: string): string | null;
|
|
198
|
-
/**
|
|
199
|
-
* Read and parse a heartbeat file. Returns null if the file is missing,
|
|
200
|
-
* unreadable, or contains malformed JSON. Does not throw.
|
|
201
|
-
*
|
|
202
|
-
* Phase 8 cleanup (2026-05-27): the v1/v2 dual-write bridge is gone; the
|
|
203
|
-
* projector writes additively-merged heartbeats directly to
|
|
204
|
-
* `.harnery/active/<id>.json` (the canonical location every reader expects).
|
|
205
|
-
*/
|
|
206
|
-
export declare function readHeartbeat(instanceId: string): Heartbeat | null;
|
|
207
|
-
/**
|
|
208
|
-
* Render the display form for an instance_id: `agent-<Name>` if the heartbeat
|
|
209
|
-
* carries a non-empty `.name`, else `agent-<8-char-hex-prefix>`.
|
|
210
|
-
*
|
|
211
|
-
* Hex fallback handles three cases cleanly:
|
|
212
|
-
* - heartbeat written before this feature shipped (no `name` field)
|
|
213
|
-
* - heartbeat pruned but instance_id still appears in older log lines
|
|
214
|
-
* - the narrow window between instance_id resolution and heartbeat read
|
|
215
|
-
*/
|
|
216
|
-
export declare function displayName(instanceId: string): string;
|
|
217
|
-
/**
|
|
218
|
-
* Convenience: resolve self via ppid walk, then render. Returns
|
|
219
|
-
* `agent-unknown` when the walk fails.
|
|
220
|
-
*/
|
|
221
|
-
export declare function selfDisplayName(): string;
|
|
222
160
|
//# sourceMappingURL=coord-client.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"coord-client.d.ts","sourceRoot":"","sources":["../../../src/core/agents/coord-client.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;
|
|
1
|
+
{"version":3,"file":"coord-client.d.ts","sourceRoot":"","sources":["../../../src/core/agents/coord-client.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAeH;;;;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;;;;;GAKG;AACH,wBAAgB,YAAY,IAAI,MAAM,GAAG,IAAI,CAE5C;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,GAAE,MAAsB,GAAG,MAAM,GAAG,IAAI,CA+B7E;AAED,iEAAiE;AACjE,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAE7D;AAeD;;;;;;;;GAQG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAGtD;AAiED,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,CA2CA;AAED;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,MAAM,GAAG;IAClD,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,MAAM,EAAE,QAAQ,GAAG,iBAAiB,GAAG,MAAM,CAAC;CAC/C,CAyBA;AAqBD,sFAAsF;AACtF;;;;;;;GAOG;AACH,wBAAgB,sBAAsB,IAAI,MAAM,GAAG,IAAI,CAEtD;AAuCD;;;;;;;GAOG;AACH,wBAAgB,wBAAwB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAYpE;AAED;;;;;;GAMG;AACH,wBAAgB,wBAAwB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAOpE"}
|
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
import { spawnSync } from "node:child_process";
|
|
10
10
|
import { existsSync, readdirSync, readFileSync } from "node:fs";
|
|
11
11
|
import { dirname, join, resolve, sep } from "node:path";
|
|
12
|
+
import { listHookProducerStateRecordsV3, readHookProducerStateV3, } from "../events/v3/producers/recorder.js";
|
|
12
13
|
// NOTE: kept dependency-free (node builtins only); this file is vendored verbatim into
|
|
13
14
|
// a downstream consumer, so it cannot import the coordEnv helper.
|
|
14
15
|
const MAX_INSTANCE_ID_LENGTH = 128;
|
|
@@ -63,8 +64,8 @@ export function monorepoRoot() {
|
|
|
63
64
|
* THE coordination-root resolution. Every surface — the hooks, the CLI's reads,
|
|
64
65
|
* and the CLI's canonical emits — resolves through this one function, because a
|
|
65
66
|
* root the two layers disagree about is a root that silently breaks the
|
|
66
|
-
* end-of-turn rules: the hook evaluates `
|
|
67
|
-
* it reads, so an emit into a different
|
|
67
|
+
* end-of-turn rules: the hook evaluates `coord.status_observed` from the stream
|
|
68
|
+
* it reads, so an emit into a different V3 ledger root is invisible
|
|
68
69
|
* and rule 1/3 blocks a turn that did run `agents status`, with no sequence of
|
|
69
70
|
* CLI commands able to satisfy it.
|
|
70
71
|
*
|
|
@@ -121,7 +122,7 @@ export function resolveCoordRoot(start = process.cwd()) {
|
|
|
121
122
|
if (gitRoots.length > 0)
|
|
122
123
|
return gitRoots[0];
|
|
123
124
|
// Nothing carries `.harnery/` yet. Hand back the enclosing checkout so a
|
|
124
|
-
// first run (`harn init`, agent-hook's session.
|
|
125
|
+
// first run (`harn init`, agent-hook's session.started) has somewhere to
|
|
125
126
|
// create it.
|
|
126
127
|
return gitToplevel(start);
|
|
127
128
|
}
|
|
@@ -147,7 +148,7 @@ function ancestorCoordRoots(start) {
|
|
|
147
148
|
* Does this root's `.harnery/` already know the process asking?
|
|
148
149
|
*
|
|
149
150
|
* Two discriminators, both genuinely about *this* session: the adapter-exported
|
|
150
|
-
* session id matching
|
|
151
|
+
* session id matching live V3 producer state, and a pid-map row on our own ppid
|
|
151
152
|
* chain. Deliberately NOT the single-live-agent fallback that owner resolution
|
|
152
153
|
* ends with — a lone stranger in the wrong root is exactly how `whoami` came to
|
|
153
154
|
* report another agent's name and task as its own.
|
|
@@ -193,7 +194,7 @@ function gitToplevel(start) {
|
|
|
193
194
|
return gitRevParse(start, "--show-toplevel");
|
|
194
195
|
}
|
|
195
196
|
function gitRevParse(cwd, flag) {
|
|
196
|
-
const key = `${cwd}
|
|
197
|
+
const key = `${cwd}\0${flag}`;
|
|
197
198
|
const cached = gitRevParseCache.get(key);
|
|
198
199
|
if (cached !== undefined)
|
|
199
200
|
return cached;
|
|
@@ -353,33 +354,36 @@ export function resolveOwner() {
|
|
|
353
354
|
* is propagating or the ppid-walk is the load-bearing path.
|
|
354
355
|
*/
|
|
355
356
|
export function resolveOwnerWithSource() {
|
|
357
|
+
const bridge = process.env.HARNERY_AGENT_COORD_BRIDGE?.trim();
|
|
356
358
|
const envOwner = process.env.HARNERY_AGENT_COORD_OWNER?.trim();
|
|
357
|
-
|
|
359
|
+
// A bridge-marked child must prove identity through a live V3 producer. An
|
|
360
|
+
// inherited owner override is only a string, so trusting it here would let a
|
|
361
|
+
// stale or foreign environment bypass the bridge's fail-closed contract.
|
|
362
|
+
if (envOwner && !bridge) {
|
|
358
363
|
return { owner: envOwner, source: "env" };
|
|
359
364
|
}
|
|
360
365
|
const root = monorepoRoot();
|
|
361
366
|
if (!root)
|
|
362
367
|
return { owner: null, source: "none" };
|
|
363
|
-
// Every supported adapter exports its session id into
|
|
364
|
-
//
|
|
365
|
-
// session id it was minted under. Matching the two names us outright, even
|
|
366
|
-
// with many live agents, so it goes ahead of the ppid walk rather than
|
|
367
|
-
// catching what the walk drops. Cursor needed this first because its
|
|
368
|
-
// Glass/Agents UI runs several chats under one node ancestor, making that row
|
|
369
|
-
// last-writer-wins; pid recycling generalises the same hazard to every
|
|
370
|
-
// adapter.
|
|
368
|
+
// Every supported adapter exports its native session id into subprocesses.
|
|
369
|
+
// Match it against the live V3 producer state, never a disposable cache.
|
|
371
370
|
if (shouldPreferSessionEnv()) {
|
|
372
371
|
const bySession = resolveOwnerBySessionEnv(root);
|
|
373
372
|
if (bySession) {
|
|
374
373
|
return { owner: bySession, source: "session_env" };
|
|
375
374
|
}
|
|
376
375
|
}
|
|
376
|
+
// Connector children cross process-tree boundaries where pid ancestry is
|
|
377
|
+
// not logical session identity. Once marked, a missing V3 generation is
|
|
378
|
+
// terminal: never guess through pid-map or singleton fallback.
|
|
379
|
+
if (bridge)
|
|
380
|
+
return { owner: null, source: "none" };
|
|
377
381
|
if (!existsSync(resolve(root, ".harnery", "pid-map")))
|
|
378
382
|
return { owner: null, source: "none" };
|
|
379
383
|
const byPidmap = resolveOwnerByPidmap(root);
|
|
380
384
|
if (byPidmap.owner)
|
|
381
385
|
return byPidmap;
|
|
382
|
-
// Last resort: if exactly one
|
|
386
|
+
// Last resort: if exactly one V3 generation is live in this coord root, it's
|
|
383
387
|
// unambiguously us — resolve to it. This is what lets the bare `agents
|
|
384
388
|
// status` / `set-task` the stop hook recommends work without a `--session-id`
|
|
385
389
|
// flag in the common single-agent case. With 0 or 2+ live agents it would be
|
|
@@ -442,6 +446,17 @@ const SESSION_ID_ENV_VARS = [
|
|
|
442
446
|
"CODEX_THREAD_ID",
|
|
443
447
|
];
|
|
444
448
|
/** Read normalized candidates from the first non-empty adapter session-id env var. */
|
|
449
|
+
/**
|
|
450
|
+
* First adapter/bridge-stamped session id from the environment, WITHOUT the
|
|
451
|
+
* live-heartbeat validation resolveOwnerBySessionEnv applies. A fresh session
|
|
452
|
+
* has no heartbeat until its first set-task, so heartbeat-validated resolution
|
|
453
|
+
* returns null there by design; commands that REGISTER a session (set-task)
|
|
454
|
+
* may use this id directly — it carries the same trust as an explicit
|
|
455
|
+
* `--session-id` argument, because the adapter or connector stamped it.
|
|
456
|
+
*/
|
|
457
|
+
export function sessionIdentityFromEnv() {
|
|
458
|
+
return sessionIdsFromEnv()[0] ?? null;
|
|
459
|
+
}
|
|
445
460
|
function sessionIdsFromEnv() {
|
|
446
461
|
for (const key of SESSION_ID_ENV_VARS) {
|
|
447
462
|
const v = process.env[key]?.trim();
|
|
@@ -471,22 +486,17 @@ function sessionIdFromEnv() {
|
|
|
471
486
|
* agent's name and file list.
|
|
472
487
|
*
|
|
473
488
|
* This only reorders the two. Session-env resolution still requires a live
|
|
474
|
-
*
|
|
489
|
+
* V3 producer carrying that session id, so when it does not match, the walk runs
|
|
475
490
|
* exactly as before.
|
|
476
491
|
*/
|
|
477
492
|
function shouldPreferSessionEnv() {
|
|
478
493
|
return sessionIdFromEnv() !== null;
|
|
479
494
|
}
|
|
480
495
|
/**
|
|
481
|
-
* Resolve the owner by
|
|
482
|
-
*
|
|
483
|
-
*
|
|
484
|
-
*
|
|
485
|
-
* fallback applies, so a stale heartbeat from a prior session of the same id
|
|
486
|
-
* doesn't resolve. When legacy Cursor Glass state contains both the canonical
|
|
487
|
-
* bare id and its raw `bc-` alias, candidate order wins first; ties prefer a
|
|
488
|
-
* named heartbeat, then the newest heartbeat, with instance id as a stable
|
|
489
|
-
* final tie-breaker. Filesystem enumeration order never decides identity.
|
|
496
|
+
* Resolve the owner by joining adapter session environment to the live V3
|
|
497
|
+
* hook-producer state. A missing, terminal, or ambiguous generation fails
|
|
498
|
+
* closed. The disposable cache is consulted only to recover the native
|
|
499
|
+
* instance label bound to an already-authoritative canonical instance.
|
|
490
500
|
*
|
|
491
501
|
* Exported for unit testing with an injectable root.
|
|
492
502
|
*/
|
|
@@ -494,152 +504,52 @@ export function resolveOwnerBySessionEnv(root) {
|
|
|
494
504
|
const sessionIds = sessionIdsFromEnv();
|
|
495
505
|
if (sessionIds.length === 0)
|
|
496
506
|
return null;
|
|
497
|
-
const
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
files = readdirSync(activeDir);
|
|
505
|
-
}
|
|
506
|
-
catch {
|
|
507
|
-
return null;
|
|
508
|
-
}
|
|
509
|
-
const matches = [];
|
|
510
|
-
for (const file of files) {
|
|
511
|
-
if (!file.endsWith(".json"))
|
|
512
|
-
continue;
|
|
513
|
-
try {
|
|
514
|
-
const parsed = JSON.parse(readFileSync(resolve(activeDir, file), "utf8"));
|
|
515
|
-
if (!parsed)
|
|
516
|
-
continue;
|
|
517
|
-
const sessionPreference = sessionIds.indexOf(parsed.session_id);
|
|
518
|
-
if (sessionPreference === -1)
|
|
519
|
-
continue;
|
|
520
|
-
if (typeof parsed.instance_id !== "string")
|
|
521
|
-
continue;
|
|
522
|
-
const ts = Date.parse(parsed.last_heartbeat);
|
|
523
|
-
if (!Number.isFinite(ts) || ts < cutoffMs)
|
|
524
|
-
continue;
|
|
525
|
-
matches.push({
|
|
526
|
-
instanceId: parsed.instance_id,
|
|
527
|
-
sessionPreference,
|
|
528
|
-
hasName: typeof parsed.name === "string" && parsed.name.trim().length > 0,
|
|
529
|
-
lastHeartbeatMs: ts,
|
|
530
|
-
});
|
|
531
|
-
}
|
|
532
|
-
catch {
|
|
533
|
-
// skip malformed
|
|
507
|
+
const adapters = adapterCandidatesFromEnv();
|
|
508
|
+
const matches = new Set();
|
|
509
|
+
for (const sessionId of sessionIds) {
|
|
510
|
+
for (const adapter of adapters) {
|
|
511
|
+
const state = readHookProducerStateV3(root, adapter, sessionId);
|
|
512
|
+
if (state && !state.terminal)
|
|
513
|
+
matches.add(nativeOwnerForV3Instance(root, state.instance_id));
|
|
534
514
|
}
|
|
535
515
|
}
|
|
536
|
-
matches.
|
|
537
|
-
Number(b.hasName) - Number(a.hasName) ||
|
|
538
|
-
b.lastHeartbeatMs - a.lastHeartbeatMs ||
|
|
539
|
-
a.instanceId.localeCompare(b.instanceId));
|
|
540
|
-
return matches[0]?.instanceId ?? null;
|
|
516
|
+
return matches.size === 1 ? [...matches][0] : null;
|
|
541
517
|
}
|
|
542
518
|
/**
|
|
543
|
-
* Return the
|
|
544
|
-
* if there are zero or more than one.
|
|
545
|
-
* freshness window the rest of the agents surface applies (kept inline as a
|
|
546
|
-
* literal so this file stays node-builtins-only for vendored downstream use).
|
|
519
|
+
* Return the native instance label of the sole live V3 generation in this
|
|
520
|
+
* coord root, or null if there are zero or more than one.
|
|
547
521
|
*
|
|
548
522
|
* Exported for unit testing with an injectable root (the caller in
|
|
549
523
|
* `resolveOwnerWithSource` passes `monorepoRoot()`).
|
|
550
524
|
*/
|
|
551
525
|
export function resolveSingleActiveOwner(root) {
|
|
552
|
-
const
|
|
553
|
-
|
|
554
|
-
return null;
|
|
555
|
-
const FRESHNESS_SECS = 600;
|
|
556
|
-
const cutoffMs = Date.now() - FRESHNESS_SECS * 1000;
|
|
557
|
-
const live = [];
|
|
558
|
-
let files;
|
|
559
|
-
try {
|
|
560
|
-
files = readdirSync(activeDir);
|
|
561
|
-
}
|
|
562
|
-
catch {
|
|
563
|
-
return null;
|
|
564
|
-
}
|
|
565
|
-
for (const file of files) {
|
|
566
|
-
if (!file.endsWith(".json"))
|
|
567
|
-
continue;
|
|
568
|
-
try {
|
|
569
|
-
const parsed = JSON.parse(readFileSync(resolve(activeDir, file), "utf8"));
|
|
570
|
-
if (!parsed || typeof parsed.instance_id !== "string")
|
|
571
|
-
continue;
|
|
572
|
-
const ts = Date.parse(parsed.last_heartbeat);
|
|
573
|
-
if (Number.isFinite(ts) && ts >= cutoffMs)
|
|
574
|
-
live.push(parsed.instance_id);
|
|
575
|
-
}
|
|
576
|
-
catch {
|
|
577
|
-
// skip malformed
|
|
578
|
-
}
|
|
579
|
-
if (live.length > 1)
|
|
580
|
-
return null; // ambiguous; bail early
|
|
581
|
-
}
|
|
582
|
-
return live.length === 1 ? live[0] : null;
|
|
526
|
+
const live = new Set(listHookProducerStateRecordsV3(root, { includeTerminal: false }).map(({ state }) => nativeOwnerForV3Instance(root, state.instance_id)));
|
|
527
|
+
return live.size === 1 ? [...live][0] : null;
|
|
583
528
|
}
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
* projector writes additively-merged heartbeats directly to
|
|
590
|
-
* `.harnery/active/<id>.json` (the canonical location every reader expects).
|
|
591
|
-
*/
|
|
592
|
-
export function readHeartbeat(instanceId) {
|
|
593
|
-
if (!isSafeInstanceId(instanceId))
|
|
594
|
-
return null;
|
|
595
|
-
const root = monorepoRoot();
|
|
596
|
-
if (!root)
|
|
597
|
-
return null;
|
|
598
|
-
const path = resolveContainedFile(resolve(root, ".harnery", "active"), `${instanceId}.json`);
|
|
599
|
-
return readJsonHeartbeatFile(path);
|
|
529
|
+
function adapterCandidatesFromEnv() {
|
|
530
|
+
const value = process.env.HARNERY_AGENT_COORD_PLATFORM?.trim();
|
|
531
|
+
if (value === "claude-code" || value === "codex" || value === "cursor")
|
|
532
|
+
return [value];
|
|
533
|
+
return ["claude-code", "codex", "cursor"];
|
|
600
534
|
}
|
|
601
|
-
function
|
|
602
|
-
|
|
603
|
-
return null;
|
|
535
|
+
function nativeOwnerForV3Instance(root, instanceId) {
|
|
536
|
+
const activeDir = resolve(root, ".harnery", "active");
|
|
604
537
|
try {
|
|
605
|
-
const
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
538
|
+
for (const file of readdirSync(activeDir)) {
|
|
539
|
+
if (!file.endsWith(".json"))
|
|
540
|
+
continue;
|
|
541
|
+
const parsed = JSON.parse(readFileSync(resolve(activeDir, file), "utf8"));
|
|
542
|
+
if (parsed.schema_version === 2 &&
|
|
543
|
+
parsed.v3_instance_id === instanceId &&
|
|
544
|
+
typeof parsed.instance_id === "string") {
|
|
545
|
+
return parsed.instance_id;
|
|
546
|
+
}
|
|
609
547
|
}
|
|
610
|
-
return null;
|
|
611
548
|
}
|
|
612
549
|
catch {
|
|
613
|
-
|
|
614
|
-
}
|
|
615
|
-
}
|
|
616
|
-
/**
|
|
617
|
-
* Render the display form for an instance_id: `agent-<Name>` if the heartbeat
|
|
618
|
-
* carries a non-empty `.name`, else `agent-<8-char-hex-prefix>`.
|
|
619
|
-
*
|
|
620
|
-
* Hex fallback handles three cases cleanly:
|
|
621
|
-
* - heartbeat written before this feature shipped (no `name` field)
|
|
622
|
-
* - heartbeat pruned but instance_id still appears in older log lines
|
|
623
|
-
* - the narrow window between instance_id resolution and heartbeat read
|
|
624
|
-
*/
|
|
625
|
-
export function displayName(instanceId) {
|
|
626
|
-
if (!instanceId)
|
|
627
|
-
return "agent-unknown";
|
|
628
|
-
const hb = readHeartbeat(instanceId);
|
|
629
|
-
if (hb && typeof hb.name === "string" && hb.name.length > 0) {
|
|
630
|
-
return `agent-${hb.name}`;
|
|
550
|
+
// The producer state remains authoritative; fall through to the canonical label.
|
|
631
551
|
}
|
|
632
|
-
return
|
|
633
|
-
}
|
|
634
|
-
/**
|
|
635
|
-
* Convenience: resolve self via ppid walk, then render. Returns
|
|
636
|
-
* `agent-unknown` when the walk fails.
|
|
637
|
-
*/
|
|
638
|
-
export function selfDisplayName() {
|
|
639
|
-
const owner = resolveOwner();
|
|
640
|
-
if (!owner)
|
|
641
|
-
return "agent-unknown";
|
|
642
|
-
return displayName(owner);
|
|
552
|
+
return instanceId.startsWith("inst_") ? instanceId.slice(5) : instanceId;
|
|
643
553
|
}
|
|
644
554
|
function readPpid(pid) {
|
|
645
555
|
// Linux/WSL fast path: /proc/<pid>/status carries `PPid:`.
|
|
@@ -11,6 +11,9 @@ export interface GitFinalizationResult {
|
|
|
11
11
|
claim_history_complete: boolean;
|
|
12
12
|
dirty_paths: string[];
|
|
13
13
|
unpushed_repos: string[];
|
|
14
|
+
behind_repos: string[];
|
|
15
|
+
stale_submodules: string[];
|
|
16
|
+
diverged_submodules: string[];
|
|
14
17
|
host_output_paths: string[];
|
|
15
18
|
unsupported_paths: UnsupportedFinalizationPath[];
|
|
16
19
|
unverifiable_paths: string[];
|
|
@@ -49,7 +52,7 @@ export interface SessionWriteClaims {
|
|
|
49
52
|
* a commit. Current heartbeat claims describe dirty ownership; this history is
|
|
50
53
|
* what keeps the touched repository in scope until its commits are pushed.
|
|
51
54
|
*/
|
|
52
|
-
export declare function readSessionWriteClaims(coordRoot: string, instanceId: string,
|
|
55
|
+
export declare function readSessionWriteClaims(coordRoot: string, instanceId: string, _sessionId: string): SessionWriteClaims;
|
|
53
56
|
/**
|
|
54
57
|
* Resolve one guarded write to the host's single supported end-turn
|
|
55
58
|
* disposition. Claim event data never grants authority: every call starts from
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"finalization.d.ts","sourceRoot":"","sources":["../../../src/core/agents/finalization.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAKH,OAAO,EAAE,KAAK,4BAA4B,EAA2B,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"finalization.d.ts","sourceRoot":"","sources":["../../../src/core/agents/finalization.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAKH,OAAO,EAAE,KAAK,4BAA4B,EAA2B,MAAM,cAAc,CAAC;AA2B1F,MAAM,WAAW,qBAAqB;IACpC,EAAE,EAAE,OAAO,CAAC;IACZ,sBAAsB,EAAE,OAAO,CAAC;IAChC,WAAW,EAAE,MAAM,EAAE,CAAC;IACtB,cAAc,EAAE,MAAM,EAAE,CAAC;IACzB,YAAY,EAAE,MAAM,EAAE,CAAC;IACvB,gBAAgB,EAAE,MAAM,EAAE,CAAC;IAC3B,mBAAmB,EAAE,MAAM,EAAE,CAAC;IAC9B,iBAAiB,EAAE,MAAM,EAAE,CAAC;IAC5B,iBAAiB,EAAE,2BAA2B,EAAE,CAAC;IACjD,kBAAkB,EAAE,MAAM,EAAE,CAAC;IAC7B,kBAAkB,EAAE,MAAM,EAAE,CAAC;IAC7B,aAAa,EAAE,MAAM,EAAE,CAAC;CACzB;AAED,MAAM,MAAM,6BAA6B,GACrC,4BAA4B,GAC5B,2BAA2B,GAC3B,8BAA8B,GAC9B,gCAAgC,GAChC,4BAA4B,GAC5B,oBAAoB,CAAC;AAEzB,MAAM,WAAW,2BAA2B;IAC1C,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,6BAA6B,CAAC;CACvC;AAED,MAAM,WAAW,2BAA2B;IAC1C,WAAW,EAAE,4BAA4B,CAAC;IAC1C,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,MAAM,yBAAyB,GACjC;IACE,KAAK,EAAE,IAAI,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,2BAA2B,CAAC;IACxC,aAAa,EAAE,MAAM,CAAC;IACtB,IAAI,CAAC,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC;CACvC,GACD;IACE,KAAK,EAAE,KAAK,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,6BAA6B,CAAC;CACvC,CAAC;AAEN,MAAM,WAAW,kBAAkB;IACjC,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,QAAQ,EAAE,OAAO,CAAC;CACnB;AAED;;;;GAIG;AACH,wBAAgB,sBAAsB,CACpC,SAAS,EAAE,MAAM,EACjB,UAAU,EAAE,MAAM,EAClB,UAAU,EAAE,MAAM,GACjB,kBAAkB,CASpB;AA+JD;;;;;GAKG;AACH,wBAAgB,8BAA8B,CAC5C,SAAS,EAAE,MAAM,EACjB,QAAQ,EAAE,MAAM,GACf,yBAAyB,CA2D3B;AAqID,4FAA4F;AAC5F,wBAAgB,oBAAoB,CAClC,SAAS,EAAE,MAAM,EACjB,SAAS,EAAE,SAAS,MAAM,EAAE,EAC5B,OAAO,GAAE;IAAE,oBAAoB,CAAC,EAAE,OAAO,CAAA;CAAO,GAC/C,qBAAqB,CA2FvB;AAED,wBAAgB,4BAA4B,CAAC,MAAM,EAAE,qBAAqB,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,CAgF/F;AAmBD,wBAAgB,kCAAkC,CAChD,QAAQ,EAAE,OAAO,CAAC,yBAAyB,EAAE;IAAE,KAAK,EAAE,KAAK,CAAA;CAAE,CAAC,EAC9D,GAAG,EAAE,MAAM,GACV,MAAM,CAQR"}
|