harnery 0.35.0 → 0.36.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/dist/commander.d.ts +30 -5
- package/dist/commander.d.ts.map +1 -1
- package/dist/commander.js +124 -96
- package/dist/commands/agents.d.ts +23 -3
- package/dist/commands/agents.d.ts.map +1 -1
- package/dist/commands/agents.js +379 -198
- package/dist/commands/backup.d.ts.map +1 -1
- package/dist/commands/backup.js +10 -10
- package/dist/commands/browse-session.d.ts.map +1 -1
- package/dist/commands/browse-session.js +12 -0
- package/dist/commands/browse.d.ts +1 -1
- package/dist/commands/browse.d.ts.map +1 -1
- package/dist/commands/browse.js +5 -4
- package/dist/commands/conversations.d.ts +10 -0
- package/dist/commands/conversations.d.ts.map +1 -0
- package/dist/commands/conversations.js +201 -0
- package/dist/commands/deinit.d.ts.map +1 -1
- package/dist/commands/deinit.js +5 -0
- package/dist/commands/docs.d.ts.map +1 -1
- package/dist/commands/docs.js +13 -2
- package/dist/commands/doctor.d.ts +5 -0
- package/dist/commands/doctor.d.ts.map +1 -1
- package/dist/commands/doctor.js +51 -7
- package/dist/commands/fetch.js +6 -5
- package/dist/commands/files.d.ts +22 -0
- package/dist/commands/files.d.ts.map +1 -0
- package/dist/commands/files.js +113 -0
- package/dist/commands/governor.js +14 -12
- package/dist/commands/inbox.d.ts +5 -0
- package/dist/commands/inbox.d.ts.map +1 -0
- package/dist/commands/inbox.js +57 -0
- package/dist/commands/init.d.ts +4 -5
- package/dist/commands/init.d.ts.map +1 -1
- package/dist/commands/init.js +63 -13
- package/dist/commands/ledger-v3.d.ts.map +1 -1
- package/dist/commands/ledger-v3.js +347 -1
- package/dist/commands/logs.d.ts +4 -0
- package/dist/commands/logs.d.ts.map +1 -0
- package/dist/commands/logs.js +169 -0
- package/dist/commands/messages.d.ts +5 -0
- package/dist/commands/messages.d.ts.map +1 -0
- package/dist/commands/messages.js +45 -0
- package/dist/commands/outline.d.ts +1 -1
- package/dist/commands/outline.d.ts.map +1 -1
- package/dist/commands/outline.js +2 -2
- package/dist/commands/read.d.ts +1 -1
- package/dist/commands/read.d.ts.map +1 -1
- package/dist/commands/read.js +2 -2
- package/dist/commands/semantic.d.ts.map +1 -1
- package/dist/commands/semantic.js +54 -2
- package/dist/commands/storage.d.ts +4 -0
- package/dist/commands/storage.d.ts.map +1 -0
- package/dist/commands/storage.js +238 -0
- package/dist/commands/tunnel.d.ts +5 -1
- package/dist/commands/tunnel.d.ts.map +1 -1
- package/dist/commands/tunnel.js +44 -31
- package/dist/commands/web.d.ts +3 -0
- package/dist/commands/web.d.ts.map +1 -1
- package/dist/commands/web.js +67 -7
- package/dist/commands/work.js +3 -3
- package/dist/commands/workflow.js +13 -13
- package/dist/core/adapters/profiles.d.ts +1 -1
- package/dist/core/agents/cli.js +209 -39
- package/dist/core/agents/live-authority-v3.d.ts +47 -1
- package/dist/core/agents/live-authority-v3.d.ts.map +1 -1
- package/dist/core/agents/live-authority-v3.js +244 -10
- package/dist/core/agents/live-lifecycle-v3.js +6 -1
- package/dist/core/agents/live-observation-v3.d.ts.map +1 -1
- package/dist/core/agents/live-observation-v3.js +6 -1
- package/dist/core/agents/render/prompt-context.d.ts +9 -3
- package/dist/core/agents/render/prompt-context.d.ts.map +1 -1
- package/dist/core/agents/render/prompt-context.js +24 -7
- package/dist/core/agents/rules/stop-hook.d.ts +2 -0
- package/dist/core/agents/rules/stop-hook.d.ts.map +1 -1
- package/dist/core/agents/rules/stop-hook.js +94 -13
- package/dist/core/agents/rules/verdict.d.ts +1 -0
- package/dist/core/agents/rules/verdict.d.ts.map +1 -1
- package/dist/core/agents/session-events.d.ts.map +1 -1
- package/dist/core/agents/session-events.js +4 -0
- package/dist/core/agents/session-finalization-state-v3.js +1 -1
- package/dist/core/agents/session-finalizer-v3.js +5 -1
- package/dist/core/agents/state/activity-log.d.ts +3 -0
- package/dist/core/agents/state/activity-log.d.ts.map +1 -1
- package/dist/core/agents/state/activity-log.js +6 -3
- package/dist/core/agents/state/heartbeat-writer.d.ts +6 -0
- package/dist/core/agents/state/heartbeat-writer.d.ts.map +1 -1
- package/dist/core/agents/state/heartbeat-writer.js +18 -0
- package/dist/core/agents/state/live-coordination-view.d.ts +5 -7
- package/dist/core/agents/state/live-coordination-view.d.ts.map +1 -1
- package/dist/core/agents/state/live-coordination-view.js +15 -90
- package/dist/core/agents/state/live-coordination-writer.d.ts +12 -0
- package/dist/core/agents/state/live-coordination-writer.d.ts.map +1 -0
- package/dist/core/agents/state/live-coordination-writer.js +92 -0
- package/dist/core/artifacts/index.d.ts +21 -0
- package/dist/core/artifacts/index.d.ts.map +1 -1
- package/dist/core/artifacts/index.js +46 -1
- package/dist/core/config.d.ts +62 -4
- package/dist/core/config.d.ts.map +1 -1
- package/dist/core/config.js +98 -4
- package/dist/core/conversations/archive.d.ts +49 -0
- package/dist/core/conversations/archive.d.ts.map +1 -0
- package/dist/core/conversations/archive.js +136 -0
- package/dist/core/conversations/catalog.d.ts +10 -0
- package/dist/core/conversations/catalog.d.ts.map +1 -0
- package/dist/core/conversations/catalog.js +72 -0
- package/dist/core/conversations/context-pack.d.ts +6 -0
- package/dist/core/conversations/context-pack.d.ts.map +1 -0
- package/dist/core/conversations/context-pack.js +60 -0
- package/dist/core/conversations/contract.d.ts +155 -0
- package/dist/core/conversations/contract.d.ts.map +1 -0
- package/dist/core/conversations/contract.js +1 -0
- package/dist/core/conversations/evaluation.d.ts +16 -0
- package/dist/core/conversations/evaluation.d.ts.map +1 -0
- package/dist/core/conversations/evaluation.js +9 -0
- package/dist/core/conversations/index.d.ts +10 -0
- package/dist/core/conversations/index.d.ts.map +1 -0
- package/dist/core/conversations/index.js +9 -0
- package/dist/core/conversations/lifecycle.d.ts +28 -0
- package/dist/core/conversations/lifecycle.d.ts.map +1 -0
- package/dist/core/conversations/lifecycle.js +29 -0
- package/dist/core/conversations/normalize.d.ts +14 -0
- package/dist/core/conversations/normalize.d.ts.map +1 -0
- package/dist/core/conversations/normalize.js +82 -0
- package/dist/core/conversations/query.d.ts +8 -0
- package/dist/core/conversations/query.d.ts.map +1 -0
- package/dist/core/conversations/query.js +280 -0
- package/dist/core/conversations/search-index.d.ts +9 -0
- package/dist/core/conversations/search-index.d.ts.map +1 -0
- package/dist/core/conversations/search-index.js +29 -0
- package/dist/core/events/legacy-storage/canary.d.ts +18 -0
- package/dist/core/events/legacy-storage/canary.d.ts.map +1 -0
- package/dist/core/events/legacy-storage/canary.js +150 -0
- package/dist/core/events/legacy-storage/fence.d.ts +15 -0
- package/dist/core/events/legacy-storage/fence.d.ts.map +1 -0
- package/dist/core/events/legacy-storage/fence.js +115 -0
- package/dist/core/events/legacy-storage/index.d.ts +6 -0
- package/dist/core/events/legacy-storage/index.d.ts.map +1 -0
- package/dist/core/events/legacy-storage/index.js +5 -0
- package/dist/core/events/legacy-storage/inventory.d.ts +10 -0
- package/dist/core/events/legacy-storage/inventory.d.ts.map +1 -0
- package/dist/core/events/legacy-storage/inventory.js +40 -0
- package/dist/core/events/legacy-storage/manifest.d.ts +23 -0
- package/dist/core/events/legacy-storage/manifest.d.ts.map +1 -0
- package/dist/core/events/legacy-storage/manifest.js +108 -0
- package/dist/core/events/legacy-storage/reader.d.ts +15 -0
- package/dist/core/events/legacy-storage/reader.d.ts.map +1 -0
- package/dist/core/events/legacy-storage/reader.js +154 -0
- package/dist/core/events/v3/authority-outbox.d.ts +7 -2
- package/dist/core/events/v3/authority-outbox.d.ts.map +1 -1
- package/dist/core/events/v3/authority-outbox.js +16 -3
- package/dist/core/events/v3/base-contract.d.ts +81 -41
- package/dist/core/events/v3/base-contract.d.ts.map +1 -1
- package/dist/core/events/v3/base-contract.js +17 -7
- package/dist/core/events/v3/bootstrap.d.ts +39 -0
- package/dist/core/events/v3/bootstrap.d.ts.map +1 -1
- package/dist/core/events/v3/bootstrap.js +167 -3
- package/dist/core/events/v3/capabilities.js +3 -3
- package/dist/core/events/v3/control-witness.d.ts +44 -0
- package/dist/core/events/v3/control-witness.d.ts.map +1 -0
- package/dist/core/events/v3/control-witness.js +233 -0
- package/dist/core/events/v3/control-writer.d.ts +4 -0
- package/dist/core/events/v3/control-writer.d.ts.map +1 -0
- package/dist/core/events/v3/control-writer.js +16 -0
- package/dist/core/events/v3/control.d.ts +8 -2
- package/dist/core/events/v3/control.d.ts.map +1 -1
- package/dist/core/events/v3/control.js +46 -18
- package/dist/core/events/v3/coordination-transaction-recovery.d.ts +42 -0
- package/dist/core/events/v3/coordination-transaction-recovery.d.ts.map +1 -0
- package/dist/core/events/v3/coordination-transaction-recovery.js +342 -0
- package/dist/core/events/v3/coordination-view.d.ts.map +1 -1
- package/dist/core/events/v3/coordination-view.js +16 -1
- package/dist/core/events/v3/generated.d.ts +1 -1
- package/dist/core/events/v3/generated.js +1 -1
- package/dist/core/events/v3/index.d.ts +4 -2
- package/dist/core/events/v3/index.d.ts.map +1 -1
- package/dist/core/events/v3/index.js +3 -1
- package/dist/core/events/v3/live-route-observer.d.ts +31 -0
- package/dist/core/events/v3/live-route-observer.d.ts.map +1 -0
- package/dist/core/events/v3/live-route-observer.js +58 -0
- package/dist/core/events/v3/live-routing.d.ts +13 -21
- package/dist/core/events/v3/live-routing.d.ts.map +1 -1
- package/dist/core/events/v3/live-routing.js +45 -41
- package/dist/core/events/v3/producers/coordination-recorder.d.ts +11 -1
- package/dist/core/events/v3/producers/coordination-recorder.d.ts.map +1 -1
- package/dist/core/events/v3/producers/coordination-recorder.js +76 -10
- package/dist/core/events/v3/producers/diagnostic-summaries.d.ts +129 -0
- package/dist/core/events/v3/producers/diagnostic-summaries.d.ts.map +1 -0
- package/dist/core/events/v3/producers/diagnostic-summaries.js +499 -0
- package/dist/core/events/v3/producers/hook-base.js +1 -1
- package/dist/core/events/v3/producers/intake.d.ts +7 -0
- package/dist/core/events/v3/producers/intake.d.ts.map +1 -1
- package/dist/core/events/v3/producers/intake.js +25 -2
- package/dist/core/events/v3/producers/producer-state-observer.d.ts +8 -0
- package/dist/core/events/v3/producers/producer-state-observer.d.ts.map +1 -0
- package/dist/core/events/v3/producers/producer-state-observer.js +45 -0
- package/dist/core/events/v3/producers/recorder.d.ts +55 -1
- package/dist/core/events/v3/producers/recorder.d.ts.map +1 -1
- package/dist/core/events/v3/producers/recorder.js +353 -24
- package/dist/core/events/v3/reader.d.ts +51 -0
- package/dist/core/events/v3/reader.d.ts.map +1 -1
- package/dist/core/events/v3/reader.js +181 -1
- package/dist/core/events/v3/rotation-config.d.ts +9 -0
- package/dist/core/events/v3/rotation-config.d.ts.map +1 -0
- package/dist/core/events/v3/rotation-config.js +91 -0
- package/dist/core/events/v3/runtime-build.d.ts +11 -0
- package/dist/core/events/v3/runtime-build.d.ts.map +1 -0
- package/dist/core/events/v3/runtime-build.js +39 -0
- package/dist/core/events/v3/runtime-identity.d.ts +5 -0
- package/dist/core/events/v3/runtime-identity.d.ts.map +1 -0
- package/dist/core/events/v3/runtime-identity.js +18 -0
- package/dist/core/events/v3/runtime-telemetry-capabilities.d.ts +6 -5
- package/dist/core/events/v3/runtime-telemetry-capabilities.d.ts.map +1 -1
- package/dist/core/events/v3/runtime-telemetry-capabilities.js +1 -1
- package/dist/core/events/v3/support-storage/classify.d.ts +46 -0
- package/dist/core/events/v3/support-storage/classify.d.ts.map +1 -0
- package/dist/core/events/v3/support-storage/classify.js +149 -0
- package/dist/core/events/v3/support-storage/eligibility.d.ts +29 -0
- package/dist/core/events/v3/support-storage/eligibility.d.ts.map +1 -0
- package/dist/core/events/v3/support-storage/eligibility.js +35 -0
- package/dist/core/events/v3/support-storage/index.d.ts +10 -0
- package/dist/core/events/v3/support-storage/index.d.ts.map +1 -0
- package/dist/core/events/v3/support-storage/index.js +9 -0
- package/dist/core/events/v3/support-storage/inventory.d.ts +30 -0
- package/dist/core/events/v3/support-storage/inventory.d.ts.map +1 -0
- package/dist/core/events/v3/support-storage/inventory.js +94 -0
- package/dist/core/events/v3/support-storage/logical-authority.d.ts +14 -0
- package/dist/core/events/v3/support-storage/logical-authority.d.ts.map +1 -0
- package/dist/core/events/v3/support-storage/logical-authority.js +104 -0
- package/dist/core/events/v3/support-storage/maintenance.d.ts +98 -0
- package/dist/core/events/v3/support-storage/maintenance.d.ts.map +1 -0
- package/dist/core/events/v3/support-storage/maintenance.js +352 -0
- package/dist/core/events/v3/support-storage/pack-contract.d.ts +59 -0
- package/dist/core/events/v3/support-storage/pack-contract.d.ts.map +1 -0
- package/dist/core/events/v3/support-storage/pack-contract.js +249 -0
- package/dist/core/events/v3/support-storage/pack-reader.d.ts +34 -0
- package/dist/core/events/v3/support-storage/pack-reader.d.ts.map +1 -0
- package/dist/core/events/v3/support-storage/pack-reader.js +258 -0
- package/dist/core/events/v3/support-storage/pack-writer.d.ts +30 -0
- package/dist/core/events/v3/support-storage/pack-writer.d.ts.map +1 -0
- package/dist/core/events/v3/support-storage/pack-writer.js +268 -0
- package/dist/core/events/v3/support-storage/recovery.d.ts +15 -0
- package/dist/core/events/v3/support-storage/recovery.d.ts.map +1 -0
- package/dist/core/events/v3/support-storage/recovery.js +22 -0
- package/dist/core/events/v3/turn-telemetry.d.ts +14 -8
- package/dist/core/events/v3/turn-telemetry.d.ts.map +1 -1
- package/dist/core/events/v3/turn-telemetry.js +32 -2
- package/dist/core/events/v3/writer.d.ts +13 -1
- package/dist/core/events/v3/writer.d.ts.map +1 -1
- package/dist/core/events/v3/writer.js +126 -12
- package/dist/core/governor/plan-read.d.ts.map +1 -1
- package/dist/core/governor/plan-read.js +5 -21
- package/dist/core/governor/planning.js +6 -8
- package/dist/core/governor/service-read.d.ts +12 -0
- package/dist/core/governor/service-read.d.ts.map +1 -1
- package/dist/core/governor/service-read.js +266 -2
- package/dist/core/governor/service.d.ts +1 -0
- package/dist/core/governor/service.d.ts.map +1 -1
- package/dist/core/governor/service.js +53 -18
- package/dist/core/guard/evidence-v3.d.ts.map +1 -1
- package/dist/core/guard/evidence-v3.js +2 -0
- package/dist/core/hooks/adapter/events.d.ts.map +1 -1
- package/dist/core/hooks/adapter/events.js +1 -0
- package/dist/core/hooks/adapter/output.d.ts +4 -2
- package/dist/core/hooks/adapter/output.d.ts.map +1 -1
- package/dist/core/hooks/adapter/output.js +13 -5
- package/dist/core/hooks/adapter/runtime-telemetry.d.ts +27 -4
- package/dist/core/hooks/adapter/runtime-telemetry.d.ts.map +1 -1
- package/dist/core/hooks/adapter/runtime-telemetry.js +307 -6
- package/dist/core/hooks/cli.js +212 -30
- package/dist/core/hooks/effects/image-capture.d.ts +1 -1
- package/dist/core/hooks/effects/image-capture.d.ts.map +1 -1
- package/dist/core/hooks/effects/image-capture.js +4 -2
- package/dist/core/hooks/remediation-cap.d.ts +8 -3
- package/dist/core/hooks/remediation-cap.d.ts.map +1 -1
- package/dist/core/hooks/remediation-cap.js +3 -11
- package/dist/core/hooks/resolve/coord-root.d.ts +22 -9
- package/dist/core/hooks/resolve/coord-root.d.ts.map +1 -1
- package/dist/core/hooks/resolve/coord-root.js +92 -11
- package/dist/core/hooks/resolve/owner.d.ts.map +1 -1
- package/dist/core/hooks/resolve/owner.js +5 -0
- package/dist/core/hooks/resolve/transcript.d.ts +8 -0
- package/dist/core/hooks/resolve/transcript.d.ts.map +1 -1
- package/dist/core/hooks/resolve/transcript.js +11 -0
- package/dist/core/inbox/contract.d.ts +64 -0
- package/dist/core/inbox/contract.d.ts.map +1 -0
- package/dist/core/inbox/contract.js +13 -0
- package/dist/core/inbox/index.d.ts +5 -0
- package/dist/core/inbox/index.d.ts.map +1 -0
- package/dist/core/inbox/index.js +4 -0
- package/dist/core/inbox/lifecycle.d.ts +22 -0
- package/dist/core/inbox/lifecycle.d.ts.map +1 -0
- package/dist/core/inbox/lifecycle.js +41 -0
- package/dist/core/inbox/service.d.ts +36 -0
- package/dist/core/inbox/service.d.ts.map +1 -0
- package/dist/core/inbox/service.js +210 -0
- package/dist/core/inbox/watcher.d.ts +7 -0
- package/dist/core/inbox/watcher.d.ts.map +1 -0
- package/dist/core/inbox/watcher.js +26 -0
- package/dist/core/presence/codec-digest.d.ts.map +1 -1
- package/dist/core/presence/codec-digest.js +14 -3
- package/dist/core/presence/relay-client.d.ts +1 -0
- package/dist/core/presence/relay-client.d.ts.map +1 -1
- package/dist/core/presence/relay-client.js +52 -8
- package/dist/core/semantic/adapters.d.ts +11 -8
- package/dist/core/semantic/adapters.d.ts.map +1 -1
- package/dist/core/semantic/adapters.js +169 -31
- package/dist/core/semantic/contract.d.ts +532 -48
- package/dist/core/semantic/contract.d.ts.map +1 -1
- package/dist/core/semantic/contract.js +104 -3
- package/dist/core/semantic/index.d.ts +7 -3
- package/dist/core/semantic/index.d.ts.map +1 -1
- package/dist/core/semantic/index.js +7 -3
- package/dist/core/semantic/once.d.ts +6 -1
- package/dist/core/semantic/once.d.ts.map +1 -1
- package/dist/core/semantic/once.js +80 -9
- package/dist/core/semantic/prompt.d.ts.map +1 -1
- package/dist/core/semantic/prompt.js +14 -1
- package/dist/core/semantic/review.d.ts +144 -0
- package/dist/core/semantic/review.d.ts.map +1 -0
- package/dist/core/semantic/review.js +544 -0
- package/dist/core/semantic/routes.d.ts +10 -0
- package/dist/core/semantic/routes.d.ts.map +1 -0
- package/dist/core/semantic/routes.js +21 -0
- package/dist/core/semantic/scheduler.d.ts +14 -3
- package/dist/core/semantic/scheduler.d.ts.map +1 -1
- package/dist/core/semantic/scheduler.js +30 -6
- package/dist/core/semantic/service-status.d.ts +20 -0
- package/dist/core/semantic/service-status.d.ts.map +1 -1
- package/dist/core/semantic/service-status.js +60 -4
- package/dist/core/semantic/service.d.ts +1 -0
- package/dist/core/semantic/service.d.ts.map +1 -1
- package/dist/core/semantic/service.js +104 -15
- package/dist/core/semantic/soak.d.ts +75 -0
- package/dist/core/semantic/soak.d.ts.map +1 -0
- package/dist/core/semantic/soak.js +476 -0
- package/dist/core/semantic/storage.d.ts +11 -1
- package/dist/core/semantic/storage.d.ts.map +1 -1
- package/dist/core/semantic/storage.js +4 -3
- package/dist/core/semantic/usage.d.ts +43 -0
- package/dist/core/semantic/usage.d.ts.map +1 -0
- package/dist/core/semantic/usage.js +193 -0
- package/dist/core/semantic/validate.d.ts +3 -1
- package/dist/core/semantic/validate.d.ts.map +1 -1
- package/dist/core/semantic/validate.js +34 -1
- package/dist/core/storage/buffer.d.ts +28 -0
- package/dist/core/storage/buffer.d.ts.map +1 -0
- package/dist/core/storage/buffer.js +101 -0
- package/dist/core/storage/builtins.d.ts +3 -0
- package/dist/core/storage/builtins.d.ts.map +1 -0
- package/dist/core/storage/builtins.js +683 -0
- package/dist/core/storage/catalog.d.ts +19 -0
- package/dist/core/storage/catalog.d.ts.map +1 -0
- package/dist/core/storage/catalog.js +365 -0
- package/dist/core/storage/config.d.ts +16 -0
- package/dist/core/storage/config.d.ts.map +1 -0
- package/dist/core/storage/config.js +311 -0
- package/dist/core/storage/contract.d.ts +275 -0
- package/dist/core/storage/contract.d.ts.map +1 -0
- package/dist/core/storage/contract.js +3 -0
- package/dist/core/storage/durable-history.d.ts +36 -0
- package/dist/core/storage/durable-history.d.ts.map +1 -0
- package/dist/core/storage/durable-history.js +606 -0
- package/dist/core/storage/health.d.ts +4 -0
- package/dist/core/storage/health.d.ts.map +1 -0
- package/dist/core/storage/health.js +65 -0
- package/dist/core/storage/index.d.ts +16 -0
- package/dist/core/storage/index.d.ts.map +1 -0
- package/dist/core/storage/index.js +15 -0
- package/dist/core/storage/inventory.d.ts +25 -0
- package/dist/core/storage/inventory.d.ts.map +1 -0
- package/dist/core/storage/inventory.js +666 -0
- package/dist/core/storage/jsonl.d.ts +52 -0
- package/dist/core/storage/jsonl.d.ts.map +1 -0
- package/dist/core/storage/jsonl.js +156 -0
- package/dist/core/storage/log-retention.d.ts +52 -0
- package/dist/core/storage/log-retention.d.ts.map +1 -0
- package/dist/core/storage/log-retention.js +419 -0
- package/dist/core/storage/logger.d.ts +82 -0
- package/dist/core/storage/logger.d.ts.map +1 -0
- package/dist/core/storage/logger.js +411 -0
- package/dist/core/storage/maintenance-providers.d.ts +26 -0
- package/dist/core/storage/maintenance-providers.d.ts.map +1 -0
- package/dist/core/storage/maintenance-providers.js +141 -0
- package/dist/core/storage/maintenance.d.ts +125 -0
- package/dist/core/storage/maintenance.d.ts.map +1 -0
- package/dist/core/storage/maintenance.js +609 -0
- package/dist/core/storage/metrics.d.ts +60 -0
- package/dist/core/storage/metrics.d.ts.map +1 -0
- package/dist/core/storage/metrics.js +134 -0
- package/dist/core/storage/policy.d.ts +7 -0
- package/dist/core/storage/policy.d.ts.map +1 -0
- package/dist/core/storage/policy.js +110 -0
- package/dist/core/storage/process-log.d.ts +38 -0
- package/dist/core/storage/process-log.d.ts.map +1 -0
- package/dist/core/storage/process-log.js +165 -0
- package/dist/core/storage/query.d.ts +34 -0
- package/dist/core/storage/query.d.ts.map +1 -0
- package/dist/core/storage/query.js +295 -0
- package/dist/core/storage/receipts.d.ts +23 -0
- package/dist/core/storage/receipts.d.ts.map +1 -0
- package/dist/core/storage/receipts.js +117 -0
- package/dist/core/storage/segments.d.ts +84 -0
- package/dist/core/storage/segments.d.ts.map +1 -0
- package/dist/core/storage/segments.js +542 -0
- package/dist/core/storage/sink-graph.d.ts +65 -0
- package/dist/core/storage/sink-graph.d.ts.map +1 -0
- package/dist/core/storage/sink-graph.js +213 -0
- package/dist/core/storage/storm-control.d.ts +23 -0
- package/dist/core/storage/storm-control.d.ts.map +1 -0
- package/dist/core/storage/storm-control.js +59 -0
- package/dist/core/work/state.d.ts.map +1 -1
- package/dist/core/work/state.js +10 -14
- package/dist/core/workflow/live-session-v3.d.ts.map +1 -1
- package/dist/core/workflow/live-session-v3.js +2 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/lazy-commands.d.ts +26 -0
- package/dist/lazy-commands.d.ts.map +1 -0
- package/dist/lazy-commands.js +210 -0
- package/dist/lib/docs-lint.d.ts +2 -0
- package/dist/lib/docs-lint.d.ts.map +1 -1
- package/dist/lib/docs-lint.js +45 -80
- package/dist/lib/docs-metadata-audit.d.ts +3 -0
- package/dist/lib/docs-metadata-audit.d.ts.map +1 -1
- package/dist/lib/docs-metadata-audit.js +13 -23
- package/dist/lib/docs-metadata-sync.d.ts +1 -0
- package/dist/lib/docs-metadata-sync.d.ts.map +1 -1
- package/dist/lib/docs-metadata-sync.js +28 -10
- package/dist/lib/docs-repository-view.d.ts +22 -0
- package/dist/lib/docs-repository-view.d.ts.map +1 -0
- package/dist/lib/docs-repository-view.js +185 -0
- package/dist/lib/http/client.d.ts +11 -5
- package/dist/lib/http/client.d.ts.map +1 -1
- package/dist/lib/http/client.js +22 -4
- package/dist/lib/http/index.d.ts +1 -1
- package/dist/lib/http/index.d.ts.map +1 -1
- package/dist/lib/http/index.js +1 -1
- package/dist/lib/indexer-exclusions.d.ts +27 -0
- package/dist/lib/indexer-exclusions.d.ts.map +1 -0
- package/dist/lib/indexer-exclusions.js +176 -0
- package/dist/lib/instructions/templates.d.ts.map +1 -1
- package/dist/lib/instructions/templates.js +5 -0
- package/dist/lib/local-file-url.d.ts +9 -0
- package/dist/lib/local-file-url.d.ts.map +1 -0
- package/dist/lib/local-file-url.js +20 -0
- package/dist/lib/web-performance.d.ts +118 -0
- package/dist/lib/web-performance.d.ts.map +1 -0
- package/dist/lib/web-performance.js +192 -0
- package/package.json +29 -2
- package/schemas/config.schema.json +58 -0
- package/schemas/event-v3.schema.json +324 -112
- package/src/commander.ts +462 -95
- package/src/commands/agents.ts +517 -190
- package/src/commands/backup.ts +18 -14
- package/src/commands/browse-session.ts +12 -0
- package/src/commands/browse.ts +6 -7
- package/src/commands/conversations.ts +279 -0
- package/src/commands/deinit.ts +6 -0
- package/src/commands/docs.ts +25 -6
- package/src/commands/doctor.ts +75 -9
- package/src/commands/fetch.ts +7 -6
- package/src/commands/files.ts +143 -0
- package/src/commands/governor.ts +13 -12
- package/src/commands/inbox.ts +61 -0
- package/src/commands/init.ts +78 -16
- package/src/commands/ledger-v3.ts +421 -1
- package/src/commands/logs.ts +224 -0
- package/src/commands/messages.ts +61 -0
- package/src/commands/outline.ts +6 -2
- package/src/commands/read.ts +6 -2
- package/src/commands/semantic.ts +66 -1
- package/src/commands/storage.ts +310 -0
- package/src/commands/tunnel.ts +66 -52
- package/src/commands/web.ts +77 -7
- package/src/commands/work.ts +3 -3
- package/src/commands/workflow.ts +13 -13
- package/src/core/agents/cli.ts +259 -53
- package/src/core/agents/live-authority-v3.ts +341 -10
- package/src/core/agents/live-lifecycle-v3.ts +6 -1
- package/src/core/agents/live-observation-v3.ts +6 -1
- package/src/core/agents/render/prompt-context.ts +27 -6
- package/src/core/agents/rules/stop-hook.ts +107 -16
- package/src/core/agents/rules/verdict.ts +1 -0
- package/src/core/agents/session-events.ts +4 -0
- package/src/core/agents/session-finalization-state-v3.ts +1 -1
- package/src/core/agents/session-finalizer-v3.ts +4 -1
- package/src/core/agents/state/activity-log.ts +7 -2
- package/src/core/agents/state/heartbeat-writer.ts +27 -0
- package/src/core/agents/state/live-coordination-view.ts +16 -105
- package/src/core/agents/state/live-coordination-writer.ts +141 -0
- package/src/core/artifacts/index.ts +64 -1
- package/src/core/config.ts +126 -5
- package/src/core/conversations/archive.ts +237 -0
- package/src/core/conversations/catalog.ts +79 -0
- package/src/core/conversations/context-pack.ts +72 -0
- package/src/core/conversations/contract.ts +178 -0
- package/src/core/conversations/evaluation.ts +30 -0
- package/src/core/conversations/index.ts +9 -0
- package/src/core/conversations/lifecycle.ts +63 -0
- package/src/core/conversations/normalize.ts +105 -0
- package/src/core/conversations/query.ts +318 -0
- package/src/core/conversations/search-index.ts +48 -0
- package/src/core/events/legacy-storage/canary.ts +177 -0
- package/src/core/events/legacy-storage/fence.ts +129 -0
- package/src/core/events/legacy-storage/index.ts +5 -0
- package/src/core/events/legacy-storage/inventory.ts +51 -0
- package/src/core/events/legacy-storage/manifest.ts +136 -0
- package/src/core/events/legacy-storage/reader.ts +178 -0
- package/src/core/events/v3/authority-outbox.ts +22 -1
- package/src/core/events/v3/base-contract.ts +17 -7
- package/src/core/events/v3/bootstrap.ts +195 -2
- package/src/core/events/v3/capabilities.ts +3 -3
- package/src/core/events/v3/control-witness.ts +339 -0
- package/src/core/events/v3/control-writer.ts +16 -0
- package/src/core/events/v3/control.ts +54 -18
- package/src/core/events/v3/coordination-transaction-recovery.ts +477 -0
- package/src/core/events/v3/coordination-view.ts +17 -1
- package/src/core/events/v3/generated.ts +1 -1
- package/src/core/events/v3/index.ts +5 -2
- package/src/core/events/v3/live-route-observer.ts +80 -0
- package/src/core/events/v3/live-routing.ts +64 -46
- package/src/core/events/v3/producers/coordination-recorder.ts +95 -10
- package/src/core/events/v3/producers/diagnostic-summaries.ts +593 -0
- package/src/core/events/v3/producers/hook-base.ts +1 -1
- package/src/core/events/v3/producers/intake.ts +30 -2
- package/src/core/events/v3/producers/producer-state-observer.ts +52 -0
- package/src/core/events/v3/producers/recorder.ts +571 -33
- package/src/core/events/v3/reader.ts +243 -2
- package/src/core/events/v3/rotation-config.ts +98 -0
- package/src/core/events/v3/runtime-build.ts +41 -0
- package/src/core/events/v3/runtime-identity.ts +16 -0
- package/src/core/events/v3/runtime-telemetry-capabilities.ts +14 -8
- package/src/core/events/v3/support-storage/classify.ts +209 -0
- package/src/core/events/v3/support-storage/eligibility.ts +58 -0
- package/src/core/events/v3/support-storage/index.ts +9 -0
- package/src/core/events/v3/support-storage/inventory.ts +135 -0
- package/src/core/events/v3/support-storage/logical-authority.ts +117 -0
- package/src/core/events/v3/support-storage/maintenance.ts +501 -0
- package/src/core/events/v3/support-storage/pack-contract.ts +337 -0
- package/src/core/events/v3/support-storage/pack-reader.ts +346 -0
- package/src/core/events/v3/support-storage/pack-writer.ts +352 -0
- package/src/core/events/v3/support-storage/recovery.ts +43 -0
- package/src/core/events/v3/turn-telemetry.ts +58 -7
- package/src/core/events/v3/writer.ts +168 -16
- package/src/core/governor/plan-read.ts +5 -18
- package/src/core/governor/planning.ts +5 -8
- package/src/core/governor/service-read.ts +320 -2
- package/src/core/governor/service.ts +49 -22
- package/src/core/guard/evidence-v3.ts +1 -0
- package/src/core/hooks/adapter/events.ts +1 -0
- package/src/core/hooks/adapter/output.ts +12 -5
- package/src/core/hooks/adapter/runtime-telemetry.ts +408 -13
- package/src/core/hooks/cli.ts +226 -32
- package/src/core/hooks/effects/image-capture.ts +4 -1
- package/src/core/hooks/remediation-cap.ts +12 -6
- package/src/core/hooks/resolve/coord-root.ts +91 -11
- package/src/core/hooks/resolve/owner.ts +4 -0
- package/src/core/hooks/resolve/transcript.ts +18 -0
- package/src/core/inbox/contract.ts +81 -0
- package/src/core/inbox/index.ts +4 -0
- package/src/core/inbox/lifecycle.ts +104 -0
- package/src/core/inbox/service.ts +305 -0
- package/src/core/inbox/watcher.ts +36 -0
- package/src/core/presence/codec-digest.ts +15 -9
- package/src/core/presence/relay-client.ts +55 -7
- package/src/core/semantic/adapters.ts +200 -41
- package/src/core/semantic/contract.ts +135 -3
- package/src/core/semantic/index.ts +76 -2
- package/src/core/semantic/once.ts +93 -7
- package/src/core/semantic/prompt.ts +13 -1
- package/src/core/semantic/review.ts +803 -0
- package/src/core/semantic/routes.ts +30 -0
- package/src/core/semantic/scheduler.ts +49 -5
- package/src/core/semantic/service-status.ts +99 -5
- package/src/core/semantic/service.ts +116 -15
- package/src/core/semantic/soak.ts +638 -0
- package/src/core/semantic/storage.ts +20 -6
- package/src/core/semantic/usage.ts +272 -0
- package/src/core/semantic/validate.ts +31 -0
- package/src/core/storage/buffer.ts +124 -0
- package/src/core/storage/builtins.ts +916 -0
- package/src/core/storage/catalog.ts +467 -0
- package/src/core/storage/config.ts +423 -0
- package/src/core/storage/contract.ts +342 -0
- package/src/core/storage/durable-history.ts +738 -0
- package/src/core/storage/health.ts +76 -0
- package/src/core/storage/index.ts +15 -0
- package/src/core/storage/inventory.ts +859 -0
- package/src/core/storage/jsonl.ts +213 -0
- package/src/core/storage/log-retention.ts +555 -0
- package/src/core/storage/logger.ts +546 -0
- package/src/core/storage/maintenance-providers.ts +200 -0
- package/src/core/storage/maintenance.ts +929 -0
- package/src/core/storage/metrics.ts +199 -0
- package/src/core/storage/policy.ts +141 -0
- package/src/core/storage/process-log.ts +203 -0
- package/src/core/storage/query.ts +360 -0
- package/src/core/storage/receipts.ts +162 -0
- package/src/core/storage/segments.ts +721 -0
- package/src/core/storage/sink-graph.ts +343 -0
- package/src/core/storage/storm-control.ts +91 -0
- package/src/core/work/state.ts +12 -21
- package/src/core/workflow/live-session-v3.ts +2 -4
- package/src/index.ts +2 -0
- package/src/lazy-commands.ts +294 -0
- package/src/lib/docs-lint.ts +58 -77
- package/src/lib/docs-metadata-audit.ts +26 -21
- package/src/lib/docs-metadata-sync.ts +32 -9
- package/src/lib/docs-repository-view.ts +220 -0
- package/src/lib/http/client.ts +44 -8
- package/src/lib/http/index.ts +6 -1
- package/src/lib/indexer-exclusions.ts +173 -0
- package/src/lib/instructions/templates.ts +5 -0
- package/src/lib/local-file-url.ts +31 -0
- package/src/lib/web-performance.ts +335 -0
package/dist/core/hooks/cli.js
CHANGED
|
@@ -16,24 +16,28 @@
|
|
|
16
16
|
* `.harnery/debug/agent-hook.errors.ndjson` for audit but never break the
|
|
17
17
|
* adapter flow.
|
|
18
18
|
*/
|
|
19
|
-
import { spawnSync } from "node:child_process";
|
|
19
|
+
import { spawn, spawnSync } from "node:child_process";
|
|
20
20
|
import { appendFileSync, existsSync, mkdirSync, readFileSync } from "node:fs";
|
|
21
21
|
import { dirname, join } from "node:path";
|
|
22
22
|
import { coordEnv } from "../../lib/env.js";
|
|
23
23
|
import { buildInstructionBundle } from "../../lib/instructions/bundle.js";
|
|
24
24
|
import { coordBinPath } from "../agents/coord-bin.js";
|
|
25
|
+
import { resolveCoordRoot } from "../agents/coord-client.js";
|
|
25
26
|
import { classifyWriteClaimFinalization, formatWriteClaimFinalizationDenial, } from "../agents/finalization.js";
|
|
27
|
+
import { restoreLiveCoordinationStateAfterEpochV3 } from "../agents/live-authority-v3.js";
|
|
26
28
|
import { evaluateStopHook, STOP_REMEDIATION_MARKER } from "../agents/rules/stop-hook.js";
|
|
27
29
|
import { assistantTextStartsWithSessionNameBlock, isSessionNameRemediationCommand, sessionNameDisplayInstruction, sessionNameDisplayPending, sessionNameDisplayRecoveryInstruction, toolResponseMintedSessionName, } from "../agents/session-name-display.js";
|
|
28
|
-
import { stampSessionNameSeen } from "../agents/state/heartbeat-writer.js";
|
|
29
|
-
import {
|
|
30
|
+
import { readHeartbeat, stampSessionNameSeen } from "../agents/state/heartbeat-writer.js";
|
|
31
|
+
import { readLiveCoordinationRow } from "../agents/state/live-coordination-view.js";
|
|
32
|
+
import { ensureLiveCoordinationHeartbeat } from "../agents/state/live-coordination-writer.js";
|
|
30
33
|
import { writePidmapRow } from "../agents/state/pidmap.js";
|
|
31
34
|
import { agentsRequireGitFinalization, resolveBinName } from "../config.js";
|
|
32
35
|
import { checkpointContext, completeContextRecovery, extractContextSample, markContextCompactionCompleted, prepareContextRecovery, readContextState, recordContextSample, } from "../context/index.js";
|
|
33
36
|
import { tryWriteLiveDisplayV3 } from "../events/v3/live-feed.js";
|
|
34
|
-
import { liveHookSignalDefersDrainV3, recordLiveDelegatedChildSessionV3, recordLiveHookSignalV3, resolveLiveEventLedgerRouteV3, } from "../events/v3/live-routing.js";
|
|
37
|
+
import { liveHookSignalDefersDrainV3, reconcileLivePendingRuntimeContextV3, recordLiveDelegatedChildSessionV3, recordLiveHookSignalV3, resolveLiveEventLedgerRouteV3, } from "../events/v3/live-routing.js";
|
|
35
38
|
import { captureSpanClockV3 } from "../events/v3/span-state.js";
|
|
36
|
-
import { fetchPresence } from "../presence/index.js";
|
|
39
|
+
import { ensureRelayDaemon, fetchPresence, publishPresence } from "../presence/index.js";
|
|
40
|
+
import { closeProcessLoggers, legacyLogFields, processLogger } from "../storage/logger.js";
|
|
37
41
|
import { stableScopeId } from "../workflow/scope-id.js";
|
|
38
42
|
import { detectAdapter, shouldSkipHookAdapter } from "./adapter/detect.js";
|
|
39
43
|
import { extractBashCommand, extractToolDescription, normalizeEventName, parsePayload, } from "./adapter/parse.js";
|
|
@@ -43,10 +47,9 @@ import { captureImages, detectPresence, imageJanitor, journalArchive, journalJan
|
|
|
43
47
|
import { toolInputHash, toolTargetHash } from "./events/input-hash.js";
|
|
44
48
|
import { canonicalize } from "./guard-path.js";
|
|
45
49
|
import { adapterPidFromEnv, parsePsChainLine, selectAnchorPid } from "./resolve/anchor.js";
|
|
46
|
-
import { findCoordRoot } from "./resolve/coord-root.js";
|
|
47
50
|
import { extractIntentComment, resolveIntent } from "./resolve/intent.js";
|
|
48
51
|
import { resolveOwner } from "./resolve/owner.js";
|
|
49
|
-
import { inspectSessionNameDisplayImmediately,
|
|
52
|
+
import { inspectSessionNameDisplayImmediately, scanAssistantStatusBoxPresent, scanSessionNameDisplayedImmediately, scanStatusBoxPresent, scanTranscriptRuntime, } from "./resolve/transcript.js";
|
|
50
53
|
import { sessionNamePresence } from "./session-name-presence.js";
|
|
51
54
|
import { unsafeCrossShellReason } from "./unsafe-cross-shell.js";
|
|
52
55
|
function parseArgv(argv) {
|
|
@@ -68,6 +71,10 @@ function parseArgv(argv) {
|
|
|
68
71
|
}
|
|
69
72
|
return out;
|
|
70
73
|
}
|
|
74
|
+
function extraArg(extra, name) {
|
|
75
|
+
const index = extra.indexOf(name);
|
|
76
|
+
return index >= 0 ? extra[index + 1] : undefined;
|
|
77
|
+
}
|
|
71
78
|
async function readStdin() {
|
|
72
79
|
if (process.stdin.isTTY)
|
|
73
80
|
return "";
|
|
@@ -93,6 +100,15 @@ function childEnv(coordRoot) {
|
|
|
93
100
|
return { ...process.env, HARNERY_COORD_ROOT_OVERRIDE: coordRoot };
|
|
94
101
|
}
|
|
95
102
|
function appendDebug(coordRoot, entry) {
|
|
103
|
+
if (coordEnv("SHARED_LOGS") !== "0") {
|
|
104
|
+
try {
|
|
105
|
+
processLogger(coordRoot, "agent-hook").debug("agent_hook.diagnostic", legacyLogFields(entry));
|
|
106
|
+
return;
|
|
107
|
+
}
|
|
108
|
+
catch {
|
|
109
|
+
/* fall through to the rollback writer */
|
|
110
|
+
}
|
|
111
|
+
}
|
|
96
112
|
const path = join(coordRoot, ".harnery", "debug", "agent-hook.ndjson");
|
|
97
113
|
try {
|
|
98
114
|
mkdirSync(dirname(path), { recursive: true });
|
|
@@ -105,6 +121,15 @@ function appendDebug(coordRoot, entry) {
|
|
|
105
121
|
function logError(coordRoot, err, context) {
|
|
106
122
|
if (!coordRoot)
|
|
107
123
|
return;
|
|
124
|
+
if (coordEnv("SHARED_LOGS") !== "0") {
|
|
125
|
+
try {
|
|
126
|
+
processLogger(coordRoot, "agent-hook").error("agent_hook.error", legacyLogFields(context), err);
|
|
127
|
+
return;
|
|
128
|
+
}
|
|
129
|
+
catch {
|
|
130
|
+
/* fall through to the rollback writer */
|
|
131
|
+
}
|
|
132
|
+
}
|
|
108
133
|
const path = join(coordRoot, ".harnery", "debug", "agent-hook.errors.ndjson");
|
|
109
134
|
try {
|
|
110
135
|
mkdirSync(dirname(path), { recursive: true });
|
|
@@ -304,8 +329,7 @@ function buildEventData(eventType, ctx) {
|
|
|
304
329
|
// assistant text only (same window, same scanner as the session-name
|
|
305
330
|
// detection). The Stop verdict enforces this field; the loose field is
|
|
306
331
|
// retained as diagnostic telemetry for the measured detector divergence.
|
|
307
|
-
status_box_present_strict:
|
|
308
|
-
lastAssistantMessage.includes("┌─ agent-"),
|
|
332
|
+
status_box_present_strict: scanAssistantStatusBoxPresent(p?.transcript_path, lastAssistantMessage),
|
|
309
333
|
// Whether the session's suggested name is satisfied as of this turn,
|
|
310
334
|
// and which name that refers to. Reported on every stop while a name
|
|
311
335
|
// exists (the stop-hook.session_name verdict reads it per turn); the
|
|
@@ -454,7 +478,7 @@ async function main() {
|
|
|
454
478
|
// `--adapter cursor` dispatch of the same payload carries the session.
|
|
455
479
|
if (shouldSkipHookAdapter(adapter, raw)) {
|
|
456
480
|
if (coordEnv("AGENT_COORD_OFF") !== "1") {
|
|
457
|
-
const coordRoot =
|
|
481
|
+
const coordRoot = resolveCoordRoot(process.cwd());
|
|
458
482
|
if (coordRoot) {
|
|
459
483
|
appendDebug(coordRoot, {
|
|
460
484
|
ts: new Date().toISOString(),
|
|
@@ -478,7 +502,7 @@ async function main() {
|
|
|
478
502
|
if (adapter === "claude-code" && eventName) {
|
|
479
503
|
const s = soundForEvent(eventName);
|
|
480
504
|
if (s) {
|
|
481
|
-
const repoRoot =
|
|
505
|
+
const repoRoot = resolveCoordRoot(process.cwd());
|
|
482
506
|
if (repoRoot) {
|
|
483
507
|
let sid = "";
|
|
484
508
|
let stopContinuation = false;
|
|
@@ -505,9 +529,12 @@ async function main() {
|
|
|
505
529
|
// bypass during incident triage.
|
|
506
530
|
if (coordEnv("AGENT_COORD_OFF") === "1")
|
|
507
531
|
return 0;
|
|
508
|
-
const coordRoot =
|
|
532
|
+
const coordRoot = resolveCoordRoot(process.cwd());
|
|
509
533
|
if (!coordRoot)
|
|
510
534
|
return 0;
|
|
535
|
+
if (eventName === "runtime-context-retry") {
|
|
536
|
+
return runRuntimeContextRetryWorker(coordRoot, adapter, extra);
|
|
537
|
+
}
|
|
511
538
|
const ledgerRoute = resolveLiveEventLedgerRouteV3(coordRoot);
|
|
512
539
|
// Always log a breadcrumb, useful when an event_type maps to null or owner
|
|
513
540
|
// resolution fails. Stays cheap (one append) and self-prunes via repo log
|
|
@@ -526,6 +553,30 @@ async function main() {
|
|
|
526
553
|
appendDebug(coordRoot, { ...debugBase, skipped: "missing-event-or-adapter" });
|
|
527
554
|
return 0;
|
|
528
555
|
}
|
|
556
|
+
// Cursor's preToolUse `agent_message` is only the current narration before
|
|
557
|
+
// that tool. It is not a transcript and therefore cannot prove that an
|
|
558
|
+
// earlier assistant response omitted the required session-name block.
|
|
559
|
+
// afterAgentResponse is the one native boundary that carries the completed
|
|
560
|
+
// assistant text, so stamp a positive sighting here without retaining or
|
|
561
|
+
// emitting the response body into V3.
|
|
562
|
+
if (adapter === "cursor" && eventName === "after-agent-response") {
|
|
563
|
+
const payload = parsePayload(raw, adapter);
|
|
564
|
+
const owner = resolveOwner({ payload: payload?.raw ?? null, coordRoot });
|
|
565
|
+
if (!owner) {
|
|
566
|
+
appendDebug(coordRoot, { ...debugBase, skipped: "no-owner-resolved" });
|
|
567
|
+
return 0;
|
|
568
|
+
}
|
|
569
|
+
const name = sessionNameDisplayPending(readLiveCoordinationRow(coordRoot, owner.instance_id));
|
|
570
|
+
const text = typeof payload?.raw.text === "string" ? payload.raw.text : "";
|
|
571
|
+
if (name && assistantTextStartsWithSessionNameBlock(text, name)) {
|
|
572
|
+
stampSessionNameSeen(coordRoot, owner.instance_id, name);
|
|
573
|
+
appendDebug(coordRoot, { ...debugBase, effect: "session-name-display-stamped" });
|
|
574
|
+
}
|
|
575
|
+
else {
|
|
576
|
+
appendDebug(coordRoot, { ...debugBase, skipped: "no-session-name-sighting" });
|
|
577
|
+
}
|
|
578
|
+
return 0;
|
|
579
|
+
}
|
|
529
580
|
const norm = normalizeEventName(eventName);
|
|
530
581
|
if (!norm) {
|
|
531
582
|
appendDebug(coordRoot, { ...debugBase, skipped: "non-canonical-event" });
|
|
@@ -545,6 +596,7 @@ async function main() {
|
|
|
545
596
|
return 0;
|
|
546
597
|
}
|
|
547
598
|
const sessionId = payload?.session_id ?? payload?.conversation_id ?? owner.instance_id;
|
|
599
|
+
const priorCoordination = readHeartbeat(coordRoot, owner.instance_id);
|
|
548
600
|
const data = buildEventData(norm.event_type, {
|
|
549
601
|
coordRoot,
|
|
550
602
|
payload,
|
|
@@ -609,6 +661,24 @@ async function main() {
|
|
|
609
661
|
...(turnRitual ? { turn_ritual: turnRitual } : {}),
|
|
610
662
|
...(deferV3Drain ? { defer_drain: true } : {}),
|
|
611
663
|
});
|
|
664
|
+
const recordedGenerationId = v3Result && "event" in v3Result && "generation_id" in v3Result.event.scope
|
|
665
|
+
? v3Result.event.scope.generation_id
|
|
666
|
+
: undefined;
|
|
667
|
+
if (v3Result?.state === "recorded" || v3Result?.state === "already_started") {
|
|
668
|
+
try {
|
|
669
|
+
restoreLiveCoordinationStateAfterEpochV3({
|
|
670
|
+
coordRoot,
|
|
671
|
+
owner: owner.instance_id,
|
|
672
|
+
nativeSessionId: sessionId,
|
|
673
|
+
adapter,
|
|
674
|
+
prior: priorCoordination,
|
|
675
|
+
currentGenerationId: recordedGenerationId,
|
|
676
|
+
});
|
|
677
|
+
}
|
|
678
|
+
catch (error) {
|
|
679
|
+
logError(coordRoot, error, { phase: "epoch-coordination-restore" });
|
|
680
|
+
}
|
|
681
|
+
}
|
|
612
682
|
const v3EventId = v3Result && "event" in v3Result
|
|
613
683
|
? v3Result.event.event_id
|
|
614
684
|
: v3Result && "event_id" in v3Result
|
|
@@ -642,7 +712,7 @@ async function main() {
|
|
|
642
712
|
}
|
|
643
713
|
if (v3Result?.state === "recorded" && capturedImages.length > 0) {
|
|
644
714
|
try {
|
|
645
|
-
recordImageArtifactsV3(coordRoot, v3Result.event, capturedImages);
|
|
715
|
+
recordImageArtifactsV3(coordRoot, v3Result.event, capturedImages, ledgerRoute.genesis_id);
|
|
646
716
|
}
|
|
647
717
|
catch (err) {
|
|
648
718
|
logError(coordRoot, err, { phase: "image-artifact-observation" });
|
|
@@ -733,6 +803,35 @@ async function main() {
|
|
|
733
803
|
if (adapter === "claude-code")
|
|
734
804
|
journalJanitor(coordRoot);
|
|
735
805
|
imageJanitor(coordRoot);
|
|
806
|
+
// Session start is the only caller of the artifact janitor and the storage
|
|
807
|
+
// maintenance pass, so both load here instead of on every tool call.
|
|
808
|
+
const { autoCleanArtifacts } = await import("../artifacts/index.js");
|
|
809
|
+
const { createAutomaticMaintenanceComposition, runAutomaticMaintenancePass } = await import("../storage/maintenance-providers.js");
|
|
810
|
+
// Effect: throttled daily sweep of expired artifact workspaces (guarded,
|
|
811
|
+
// managed-expired only; see autoCleanArtifacts). Best-effort like every
|
|
812
|
+
// janitor here: a failure logs and never blocks session start.
|
|
813
|
+
try {
|
|
814
|
+
autoCleanArtifacts(coordRoot);
|
|
815
|
+
}
|
|
816
|
+
catch (err) {
|
|
817
|
+
logError(coordRoot, err, { phase: "artifact-auto-clean" });
|
|
818
|
+
}
|
|
819
|
+
// Plan one bounded, claim-first global slice from cached pressure only.
|
|
820
|
+
// Existing owner janitors above remain the only active executors until
|
|
821
|
+
// each provider receives a separate production activation.
|
|
822
|
+
try {
|
|
823
|
+
await runAutomaticMaintenancePass(createAutomaticMaintenanceComposition(coordRoot, {
|
|
824
|
+
journal: () => {
|
|
825
|
+
if (adapter === "claude-code")
|
|
826
|
+
journalJanitor(coordRoot);
|
|
827
|
+
},
|
|
828
|
+
images: () => imageJanitor(coordRoot),
|
|
829
|
+
artifacts: () => autoCleanArtifacts(coordRoot),
|
|
830
|
+
}));
|
|
831
|
+
}
|
|
832
|
+
catch (err) {
|
|
833
|
+
logError(coordRoot, err, { phase: "storage-maintenance-auto" });
|
|
834
|
+
}
|
|
736
835
|
let recovery = null;
|
|
737
836
|
if (payload?.source === "compact") {
|
|
738
837
|
try {
|
|
@@ -759,10 +858,13 @@ async function main() {
|
|
|
759
858
|
catch (err) {
|
|
760
859
|
logError(coordRoot, err, { phase: "session-start-systemMessage" });
|
|
761
860
|
}
|
|
762
|
-
//
|
|
763
|
-
// disposable heartbeat cache.
|
|
861
|
+
// Cross-machine presence is derived from the authority-safe V3 projection,
|
|
862
|
+
// not the disposable heartbeat cache. Announce this session, pull peers,
|
|
863
|
+
// and keep the optional live relay connected.
|
|
764
864
|
try {
|
|
865
|
+
publishPresence(coordRoot);
|
|
765
866
|
fetchPresence(coordRoot);
|
|
867
|
+
ensureRelayDaemon(coordRoot);
|
|
766
868
|
}
|
|
767
869
|
catch (err) {
|
|
768
870
|
logError(coordRoot, err, { phase: "session-start-presence" });
|
|
@@ -783,6 +885,14 @@ async function main() {
|
|
|
783
885
|
journalArchive(coordRoot, owner.instance_id);
|
|
784
886
|
runSessionSyncExtension(coordRoot, true);
|
|
785
887
|
}
|
|
888
|
+
// Publish the post-cleanup V3 projection so remote machines see this
|
|
889
|
+
// session disappear without waiting for the stale window.
|
|
890
|
+
try {
|
|
891
|
+
publishPresence(coordRoot);
|
|
892
|
+
}
|
|
893
|
+
catch (err) {
|
|
894
|
+
logError(coordRoot, err, { phase: "session-end-presence" });
|
|
895
|
+
}
|
|
786
896
|
}
|
|
787
897
|
// Phase 8: SubagentStart: the child generation was opened above from the
|
|
788
898
|
// native delegation identity. Refresh its disposable projection, log the
|
|
@@ -885,6 +995,16 @@ async function main() {
|
|
|
885
995
|
if (adapter === "claude-code") {
|
|
886
996
|
runSessionSyncExtension(coordRoot, false);
|
|
887
997
|
}
|
|
998
|
+
// Publish after the canonical turn event has landed so the blob carries
|
|
999
|
+
// current task, activity, and claim state. Re-ensure the relay here because
|
|
1000
|
+
// its daemon intentionally exits when a machine has no live sessions.
|
|
1001
|
+
try {
|
|
1002
|
+
publishPresence(coordRoot);
|
|
1003
|
+
ensureRelayDaemon(coordRoot);
|
|
1004
|
+
}
|
|
1005
|
+
catch (err) {
|
|
1006
|
+
logError(coordRoot, err, { phase: "stop-presence" });
|
|
1007
|
+
}
|
|
888
1008
|
// Stop verdict (V3 ritual + task/status gate). Direct in-process call: the
|
|
889
1009
|
// rule lives in Harnery. agent-hook already emitted this turn.completed
|
|
890
1010
|
// with privacy-safe ritual observations, so the evidence is in the stream.
|
|
@@ -893,6 +1013,8 @@ async function main() {
|
|
|
893
1013
|
instance_id: owner.instance_id,
|
|
894
1014
|
session_id: sessionId,
|
|
895
1015
|
adapter,
|
|
1016
|
+
stop_hook_active: payload?.stop_hook_active === true,
|
|
1017
|
+
status_box_present_strict: data.status_box_present_strict === true,
|
|
896
1018
|
bypass: coordEnv("AGENT_COORD_BYPASS_STOP") === "1",
|
|
897
1019
|
workflow_child: coordEnv("WORKFLOW_CHILD") === "1",
|
|
898
1020
|
});
|
|
@@ -902,13 +1024,16 @@ async function main() {
|
|
|
902
1024
|
// `cap` consecutive blocked stops in one cycle, allow the stop instead
|
|
903
1025
|
// of bouncing the model forever. Cycle boundaries come from the
|
|
904
1026
|
// adapter's continuation flag, so adapters without one are unaffected.
|
|
905
|
-
const {
|
|
906
|
-
|
|
1027
|
+
const { recordRemediationBlock } = await import("./remediation-cap.js");
|
|
1028
|
+
const remediation = recordRemediationBlock(sessionId, payload?.stop_hook_active === true);
|
|
1029
|
+
if (remediation.exceeded) {
|
|
907
1030
|
appendDebug(coordRoot, {
|
|
908
1031
|
...debugBase,
|
|
909
1032
|
skipped: "stop-remediation-cap-exhausted",
|
|
910
1033
|
blocked_rule: verdict.rule,
|
|
1034
|
+
blocked_count: remediation.count,
|
|
911
1035
|
session_id: sessionId,
|
|
1036
|
+
remediation_cycle_anchor: verdict.remediation_cycle_anchor,
|
|
912
1037
|
});
|
|
913
1038
|
}
|
|
914
1039
|
else {
|
|
@@ -937,6 +1062,8 @@ async function main() {
|
|
|
937
1062
|
catch (err) {
|
|
938
1063
|
logError(coordRoot, err, { phase: "stop-explicit-session-finalization" });
|
|
939
1064
|
}
|
|
1065
|
+
if (adapter === "codex")
|
|
1066
|
+
scheduleCodexRuntimeContextRetry(coordRoot, sessionId);
|
|
940
1067
|
}
|
|
941
1068
|
// Phase 7: PreToolUse: heartbeat + pid-map self-heal on every tool call.
|
|
942
1069
|
// Adapter-agnostic: both writes have the same shape regardless of who fired.
|
|
@@ -964,10 +1091,13 @@ async function main() {
|
|
|
964
1091
|
// runs before a name exists; every later tool waits until the exact block
|
|
965
1092
|
// is the first assistant text after the mint result. Cursor supplies
|
|
966
1093
|
// agent_message directly; Claude Code and Codex are resolved from their
|
|
967
|
-
// JSONL transcripts.
|
|
968
|
-
//
|
|
1094
|
+
// JSONL transcripts. Cursor's current narration can provide positive
|
|
1095
|
+
// evidence, but cannot disprove an earlier response; afterAgentResponse
|
|
1096
|
+
// stamps that durable sighting. Later commentary must not erase an
|
|
1097
|
+
// already-correct display, and unavailable evidence must not deadlock
|
|
1098
|
+
// every tool.
|
|
969
1099
|
try {
|
|
970
|
-
const displayAllowed = await enforcePendingSessionNameDisplay(coordRoot, owner.instance_id, adapter, payload);
|
|
1100
|
+
const displayAllowed = await enforcePendingSessionNameDisplay(coordRoot, owner.instance_id, adapter, payload, generationBoundHeartbeat(readHeartbeat(coordRoot, owner.instance_id), recordedGenerationId));
|
|
971
1101
|
if (!displayAllowed)
|
|
972
1102
|
return 0;
|
|
973
1103
|
}
|
|
@@ -1037,8 +1167,45 @@ async function main() {
|
|
|
1037
1167
|
}
|
|
1038
1168
|
return 0;
|
|
1039
1169
|
}
|
|
1040
|
-
|
|
1041
|
-
const
|
|
1170
|
+
function scheduleCodexRuntimeContextRetry(coordRoot, nativeSessionId) {
|
|
1171
|
+
const modulePath = process.argv[1];
|
|
1172
|
+
if (!modulePath)
|
|
1173
|
+
return;
|
|
1174
|
+
try {
|
|
1175
|
+
const child = spawn(process.execPath, [modulePath, "runtime-context-retry", "--adapter", "codex", "--session-id", nativeSessionId], {
|
|
1176
|
+
cwd: coordRoot,
|
|
1177
|
+
detached: true,
|
|
1178
|
+
stdio: "ignore",
|
|
1179
|
+
env: childEnv(coordRoot),
|
|
1180
|
+
});
|
|
1181
|
+
child.unref();
|
|
1182
|
+
}
|
|
1183
|
+
catch (err) {
|
|
1184
|
+
logError(coordRoot, err, { phase: "runtime-context-retry-spawn" });
|
|
1185
|
+
}
|
|
1186
|
+
}
|
|
1187
|
+
async function runRuntimeContextRetryWorker(coordRoot, adapter, extra) {
|
|
1188
|
+
const nativeSessionId = extraArg(extra, "--session-id");
|
|
1189
|
+
if (adapter !== "codex" || !nativeSessionId)
|
|
1190
|
+
return 0;
|
|
1191
|
+
for (const [index, delayMs] of [400, 1_000].entries()) {
|
|
1192
|
+
await new Promise((resolve) => setTimeout(resolve, delayMs));
|
|
1193
|
+
const route = resolveLiveEventLedgerRouteV3(coordRoot);
|
|
1194
|
+
if (route.state !== "v3")
|
|
1195
|
+
return 0;
|
|
1196
|
+
const result = reconcileLivePendingRuntimeContextV3({
|
|
1197
|
+
coordRoot,
|
|
1198
|
+
route,
|
|
1199
|
+
nativeSessionId,
|
|
1200
|
+
finalAttempt: index === 1,
|
|
1201
|
+
});
|
|
1202
|
+
if (result.state !== "pending" && result.state !== "busy")
|
|
1203
|
+
return 0;
|
|
1204
|
+
}
|
|
1205
|
+
return 0;
|
|
1206
|
+
}
|
|
1207
|
+
async function enforcePendingSessionNameDisplay(coordRoot, instanceId, adapter, payload, coordination) {
|
|
1208
|
+
const name = sessionNameDisplayPending(coordination);
|
|
1042
1209
|
if (!name)
|
|
1043
1210
|
return true;
|
|
1044
1211
|
const command = extractBashCommand(payload?.tool_name, payload?.tool_input);
|
|
@@ -1048,7 +1215,7 @@ async function enforcePendingSessionNameDisplay(coordRoot, instanceId, adapter,
|
|
|
1048
1215
|
? {
|
|
1049
1216
|
state: assistantTextStartsWithSessionNameBlock(payload.agent_message, name)
|
|
1050
1217
|
? "present"
|
|
1051
|
-
: "
|
|
1218
|
+
: "unavailable",
|
|
1052
1219
|
}
|
|
1053
1220
|
: inspectSessionNameDisplayImmediately(
|
|
1054
1221
|
// Codex hook payloads omit transcript_path on every event, which
|
|
@@ -1075,6 +1242,9 @@ async function enforcePendingSessionNameDisplay(coordRoot, instanceId, adapter,
|
|
|
1075
1242
|
emitDeny(adapter, sessionNameDisplayRecoveryInstruction(name, resolveBinName(coordRoot)));
|
|
1076
1243
|
return false;
|
|
1077
1244
|
}
|
|
1245
|
+
function generationBoundHeartbeat(heartbeat, generationId) {
|
|
1246
|
+
return generationId && heartbeat?.v3_generation_id === generationId ? heartbeat : null;
|
|
1247
|
+
}
|
|
1078
1248
|
async function runPreToolUseGuard(coordRoot, instanceId, sessionId, data, adapter) {
|
|
1079
1249
|
const toolName = data.tool_name ?? "";
|
|
1080
1250
|
const rawTargets = collectGuardTargets(toolName, data);
|
|
@@ -1397,17 +1567,25 @@ async function emitUserPromptSubmitSystemMessage(coordRoot, instanceId, sessionI
|
|
|
1397
1567
|
// Every human-facing adapter gets the first-session naming reminder from
|
|
1398
1568
|
// the shared hook path. Cursor + Codex additionally get ongoing set-task
|
|
1399
1569
|
// staleness nudges; Claude Code enforces those via its Stop transcript.
|
|
1570
|
+
// Codex also gets the optional project-owned prompt reminder. Claude Code
|
|
1571
|
+
// already has native output-style reminders, so duplicating it would add
|
|
1572
|
+
// noise. Cursor's current beforeSubmitPrompt output can allow or block but
|
|
1573
|
+
// cannot inject model context; an Always Apply rule is its durable carrier.
|
|
1574
|
+
// Only the boolean route travels through argv, never the host's text.
|
|
1575
|
+
if (adapter === "codex")
|
|
1576
|
+
args.push("--host-prompt-reminder");
|
|
1400
1577
|
// Codex gets a fresh status-footer reminder on every prompt. Its Stop hook
|
|
1401
1578
|
// stays observe-only, so missing the footer never replaces the answer.
|
|
1402
|
-
// Claude Code
|
|
1403
|
-
//
|
|
1404
|
-
//
|
|
1579
|
+
// Claude Code gets a fresh per-turn ritual reminder: satisfying the
|
|
1580
|
+
// contract up front is far cheaper than the bounce-and-retry the Stop hook
|
|
1581
|
+
// otherwise forces. Cursor's beforeSubmitPrompt cannot inject context, so
|
|
1582
|
+
// its Stop follow-up remains the supported enforcement channel.
|
|
1405
1583
|
args.push("--session-name-nudge");
|
|
1406
1584
|
if (adapter === "cursor" || adapter === "codex")
|
|
1407
1585
|
args.push("--task-nudge");
|
|
1408
1586
|
if (adapter === "codex")
|
|
1409
1587
|
args.push("--status-footer-nudge");
|
|
1410
|
-
if (adapter === "claude-code"
|
|
1588
|
+
if (adapter === "claude-code")
|
|
1411
1589
|
args.push("--turn-ritual-nudge", adapter);
|
|
1412
1590
|
const result = spawnSync(agentCoordBin, args, { encoding: "utf8", timeout: 3000 });
|
|
1413
1591
|
if (result.status === 0 && result.stdout)
|
|
@@ -1543,11 +1721,15 @@ function completeRecoveryInjection(coordRoot, instanceId, sessionId, recovery) {
|
|
|
1543
1721
|
void recovery;
|
|
1544
1722
|
}
|
|
1545
1723
|
main()
|
|
1546
|
-
.then((code) =>
|
|
1547
|
-
|
|
1548
|
-
|
|
1724
|
+
.then(async (code) => {
|
|
1725
|
+
await closeProcessLoggers();
|
|
1726
|
+
process.exit(code);
|
|
1727
|
+
})
|
|
1728
|
+
.catch(async (err) => {
|
|
1729
|
+
logError(resolveCoordRoot(process.cwd()), err, {
|
|
1549
1730
|
argv: process.argv.slice(2),
|
|
1550
1731
|
pid: process.pid,
|
|
1551
1732
|
});
|
|
1733
|
+
await closeProcessLoggers();
|
|
1552
1734
|
process.exit(0);
|
|
1553
1735
|
});
|
|
@@ -22,7 +22,7 @@ export declare function captureImages(coordRoot: string, eventType: "tool.reques
|
|
|
22
22
|
* Each observation uses a one-event producer boot, which preserves independent
|
|
23
23
|
* producer sequence continuity while the ledger writer serializes appends.
|
|
24
24
|
*/
|
|
25
|
-
export declare function recordImageArtifactsV3(coordRoot: string, sourceEvent: EventV3, artifacts: readonly CapturedImageArtifact[]): void;
|
|
25
|
+
export declare function recordImageArtifactsV3(coordRoot: string, sourceEvent: EventV3, artifacts: readonly CapturedImageArtifact[], expectedGenesisId?: `gex_${string}`): void;
|
|
26
26
|
export declare function buildImageArtifactEventV3(sourceEvent: EventV3, artifact: CapturedImageArtifact): EventV3;
|
|
27
27
|
/** Prune the bounded blob store by age and total size, oldest first. */
|
|
28
28
|
export declare function imageJanitor(coordRoot: string): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"image-capture.d.ts","sourceRoot":"","sources":["../../../../src/core/hooks/effects/image-capture.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAeH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,6BAA6B,CAAC;AAE3D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAgBzD,MAAM,WAAW,qBAAqB;IACpC,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,QAAQ,GAAG,UAAU,CAAC;IAC5B,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB;AAQD,mFAAmF;AACnF,wBAAgB,aAAa,CAC3B,SAAS,EAAE,MAAM,EACjB,SAAS,EAAE,gBAAgB,GAAG,gBAAgB,EAC9C,OAAO,EAAE,aAAa,GAAG,IAAI,GAC5B,qBAAqB,EAAE,CA0BzB;AAED;;;;GAIG;AACH,wBAAgB,sBAAsB,CACpC,SAAS,EAAE,MAAM,EACjB,WAAW,EAAE,OAAO,EACpB,SAAS,EAAE,SAAS,qBAAqB,EAAE,
|
|
1
|
+
{"version":3,"file":"image-capture.d.ts","sourceRoot":"","sources":["../../../../src/core/hooks/effects/image-capture.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAeH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,6BAA6B,CAAC;AAE3D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAgBzD,MAAM,WAAW,qBAAqB;IACpC,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,QAAQ,GAAG,UAAU,CAAC;IAC5B,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB;AAQD,mFAAmF;AACnF,wBAAgB,aAAa,CAC3B,SAAS,EAAE,MAAM,EACjB,SAAS,EAAE,gBAAgB,GAAG,gBAAgB,EAC9C,OAAO,EAAE,aAAa,GAAG,IAAI,GAC5B,qBAAqB,EAAE,CA0BzB;AAED;;;;GAIG;AACH,wBAAgB,sBAAsB,CACpC,SAAS,EAAE,MAAM,EACjB,WAAW,EAAE,OAAO,EACpB,SAAS,EAAE,SAAS,qBAAqB,EAAE,EAC3C,iBAAiB,CAAC,EAAE,OAAO,MAAM,EAAE,GAClC,IAAI,CAON;AAED,wBAAgB,yBAAyB,CACvC,WAAW,EAAE,OAAO,EACpB,QAAQ,EAAE,qBAAqB,GAC9B,OAAO,CA4CT;AAED,wEAAwE;AACxE,wBAAgB,YAAY,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,CA0CpD"}
|
|
@@ -58,11 +58,13 @@ export function captureImages(coordRoot, eventType, payload) {
|
|
|
58
58
|
* Each observation uses a one-event producer boot, which preserves independent
|
|
59
59
|
* producer sequence continuity while the ledger writer serializes appends.
|
|
60
60
|
*/
|
|
61
|
-
export function recordImageArtifactsV3(coordRoot, sourceEvent, artifacts) {
|
|
61
|
+
export function recordImageArtifactsV3(coordRoot, sourceEvent, artifacts, expectedGenesisId) {
|
|
62
62
|
if (!("generation_id" in sourceEvent.scope) || !sourceEvent.attestation_id)
|
|
63
63
|
return;
|
|
64
64
|
for (const artifact of artifacts) {
|
|
65
|
-
writeEventV3(coordRoot, buildImageArtifactEventV3(sourceEvent, artifact)
|
|
65
|
+
writeEventV3(coordRoot, buildImageArtifactEventV3(sourceEvent, artifact), {
|
|
66
|
+
...(expectedGenesisId ? { expectedGenesisId } : {}),
|
|
67
|
+
});
|
|
66
68
|
}
|
|
67
69
|
}
|
|
68
70
|
export function buildImageArtifactEventV3(sourceEvent, artifact) {
|
|
@@ -25,10 +25,15 @@ export declare const DEFAULT_STOP_REMEDIATION_CAP = 5;
|
|
|
25
25
|
*
|
|
26
26
|
* Call only when the Stop verdict blocked. `continuation` is the adapter's
|
|
27
27
|
* "this stop follows a stop-hook block" flag; false starts a fresh cycle.
|
|
28
|
-
* Returns
|
|
29
|
-
* the caller should allow the stop instead of
|
|
28
|
+
* Returns the retained block count and whether this cycle has already been
|
|
29
|
+
* blocked `cap` times, meaning the caller should allow the stop instead of
|
|
30
|
+
* blocking again.
|
|
30
31
|
*/
|
|
31
|
-
export
|
|
32
|
+
export interface RemediationBlockRecord {
|
|
33
|
+
count: number;
|
|
34
|
+
exceeded: boolean;
|
|
35
|
+
}
|
|
36
|
+
export declare function recordRemediationBlock(sessionId: string, continuation: boolean, cap?: number): RemediationBlockRecord;
|
|
32
37
|
/** Clear the cycle counter after an allowed stop. */
|
|
33
38
|
export declare function clearRemediationCount(sessionId: string): void;
|
|
34
39
|
//# sourceMappingURL=remediation-cap.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"remediation-cap.d.ts","sourceRoot":"","sources":["../../../src/core/hooks/remediation-cap.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAMH,eAAO,MAAM,4BAA4B,IAAI,CAAC;AAO9C
|
|
1
|
+
{"version":3,"file":"remediation-cap.d.ts","sourceRoot":"","sources":["../../../src/core/hooks/remediation-cap.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAMH,eAAO,MAAM,4BAA4B,IAAI,CAAC;AAO9C;;;;;;;;GAQG;AACH,MAAM,WAAW,sBAAsB;IACrC,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,OAAO,CAAC;CACnB;AAED,wBAAgB,sBAAsB,CACpC,SAAS,EAAE,MAAM,EACjB,YAAY,EAAE,OAAO,EACrB,GAAG,SAA+B,GACjC,sBAAsB,CAsBxB;AAED,qDAAqD;AACrD,wBAAgB,qBAAqB,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,CAM7D"}
|
|
@@ -27,15 +27,7 @@ function counterPath(sessionId) {
|
|
|
27
27
|
const key = (sessionId || "default").replace(/[^A-Za-z0-9_-]/g, "_");
|
|
28
28
|
return join(os.tmpdir(), `harnery-stop-remediation-${key}.count`);
|
|
29
29
|
}
|
|
30
|
-
|
|
31
|
-
* Record one blocked stop and report whether the cap is exhausted.
|
|
32
|
-
*
|
|
33
|
-
* Call only when the Stop verdict blocked. `continuation` is the adapter's
|
|
34
|
-
* "this stop follows a stop-hook block" flag; false starts a fresh cycle.
|
|
35
|
-
* Returns true when this cycle has already been blocked `cap` times, meaning
|
|
36
|
-
* the caller should allow the stop instead of blocking again.
|
|
37
|
-
*/
|
|
38
|
-
export function remediationCapExceeded(sessionId, continuation, cap = DEFAULT_STOP_REMEDIATION_CAP) {
|
|
30
|
+
export function recordRemediationBlock(sessionId, continuation, cap = DEFAULT_STOP_REMEDIATION_CAP) {
|
|
39
31
|
const path = counterPath(sessionId);
|
|
40
32
|
let count = 1;
|
|
41
33
|
if (continuation) {
|
|
@@ -56,9 +48,9 @@ export function remediationCapExceeded(sessionId, continuation, cap = DEFAULT_ST
|
|
|
56
48
|
}
|
|
57
49
|
catch {
|
|
58
50
|
// Counter IO must never turn into a block or a crash; fail open (no cap).
|
|
59
|
-
return false;
|
|
51
|
+
return { count, exceeded: false };
|
|
60
52
|
}
|
|
61
|
-
return count > cap;
|
|
53
|
+
return { count, exceeded: count > cap };
|
|
62
54
|
}
|
|
63
55
|
/** Clear the cycle counter after an allowed stop. */
|
|
64
56
|
export function clearRemediationCount(sessionId) {
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* Resolve the coordination root from path evidence only.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
4
|
+
* This path-only resolver deliberately does not inspect live producer state.
|
|
5
|
+
* Code that reads or writes coordination authority must use
|
|
6
|
+
* `resolveCoordRoot()` from `agents/coord-client.ts`, which disambiguates
|
|
7
|
+
* nested coordination roots through the registered session. Keeping the two
|
|
8
|
+
* responsibilities separate lets configuration and other path-only consumers
|
|
9
|
+
* avoid loading the event recorder and its contract graph.
|
|
10
10
|
*
|
|
11
11
|
* Resolution precedence (see `resolveCoordRoot` for the full rationale):
|
|
12
12
|
* 1. HARNERY_COORD_ROOT_OVERRIDE — explicit pin (tests, git hooks).
|
|
@@ -15,8 +15,21 @@
|
|
|
15
15
|
* submodules that may carry a `.harnery/` of their own (or none at all,
|
|
16
16
|
* e.g. a journal dir under /tmp). The session's coordination home is the
|
|
17
17
|
* project the adapter opened, not wherever the shell happens to sit.
|
|
18
|
-
* 3. The
|
|
19
|
-
* 4.
|
|
18
|
+
* 3. The nearest enclosing `.harnery/`.
|
|
19
|
+
* 4. A git-derived root when no `.harnery/` exists yet.
|
|
20
20
|
*/
|
|
21
21
|
export declare function findCoordRoot(start?: string): string | null;
|
|
22
|
+
/** Nearest enclosing directory carrying `.harnery/`, or null. */
|
|
23
|
+
export declare function nearestCoordRoot(start: string): string | null;
|
|
24
|
+
/** Every enclosing directory carrying `.harnery/`, nearest first. */
|
|
25
|
+
export declare function ancestorCoordRoots(start: string): string[];
|
|
26
|
+
/**
|
|
27
|
+
* Git-derived roots carrying `.harnery/`, in superproject-first order.
|
|
28
|
+
*
|
|
29
|
+
* Spawns use `start` as cwd so a call about another checkout cannot inherit
|
|
30
|
+
* this process's repository. The common-dir fallback recovers a superproject
|
|
31
|
+
* from a submodule worktree, where Git reports no direct superproject path.
|
|
32
|
+
*/
|
|
33
|
+
export declare function gitCoordRoots(start: string): string[];
|
|
34
|
+
export declare function gitToplevel(start: string): string | null;
|
|
22
35
|
//# sourceMappingURL=coord-root.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"coord-root.d.ts","sourceRoot":"","sources":["../../../../src/core/hooks/resolve/coord-root.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"coord-root.d.ts","sourceRoot":"","sources":["../../../../src/core/hooks/resolve/coord-root.ts"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,aAAa,CAAC,KAAK,GAAE,MAAsB,GAAG,MAAM,GAAG,IAAI,CAa1E;AAED,iEAAiE;AACjE,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAE7D;AAED,qEAAqE;AACrE,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,CAU1D;AAED;;;;;;GAMG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,CAcrD;AAED,wBAAgB,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAExD"}
|