harnery 0.35.0 → 0.37.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 +128 -96
- package/dist/commands/agents.d.ts +23 -3
- package/dist/commands/agents.d.ts.map +1 -1
- package/dist/commands/agents.js +464 -242
- package/dist/commands/artifacts.d.ts.map +1 -1
- package/dist/commands/artifacts.js +26 -1
- 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 +16 -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/diagnostics.d.ts +4 -0
- package/dist/commands/diagnostics.d.ts.map +1 -0
- package/dist/commands/diagnostics.js +229 -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 +34 -0
- package/dist/commands/files.d.ts.map +1 -0
- package/dist/commands/files.js +166 -0
- package/dist/commands/governor.d.ts.map +1 -1
- package/dist/commands/governor.js +18 -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 +417 -2
- 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/qa-run.d.ts +4 -0
- package/dist/commands/qa-run.d.ts.map +1 -0
- package/dist/commands/qa-run.js +141 -0
- 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/resources.d.ts +4 -0
- package/dist/commands/resources.d.ts.map +1 -0
- package/dist/commands/resources.js +29 -0
- 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/supervisor.d.ts +4 -0
- package/dist/commands/supervisor.d.ts.map +1 -0
- package/dist/commands/supervisor.js +101 -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 +84 -7
- package/dist/commands/work.js +3 -3
- package/dist/commands/workflow.d.ts.map +1 -1
- package/dist/commands/workflow.js +17 -13
- package/dist/core/adapters/profiles.d.ts +1 -1
- package/dist/core/agents/cli.js +215 -41
- package/dist/core/agents/health.d.ts +17 -0
- package/dist/core/agents/health.d.ts.map +1 -0
- package/dist/core/agents/health.js +109 -0
- 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/mailbox.d.ts +92 -0
- package/dist/core/agents/mailbox.d.ts.map +1 -0
- package/dist/core/agents/mailbox.js +325 -0
- package/dist/core/agents/reconcile-coordination-v3.d.ts +44 -0
- package/dist/core/agents/reconcile-coordination-v3.d.ts.map +1 -0
- package/dist/core/agents/reconcile-coordination-v3.js +58 -0
- package/dist/core/agents/render/prompt-context.d.ts +14 -3
- package/dist/core/agents/render/prompt-context.d.ts.map +1 -1
- package/dist/core/agents/render/prompt-context.js +54 -16
- package/dist/core/agents/render/session-context.d.ts +8 -0
- package/dist/core/agents/render/session-context.d.ts.map +1 -1
- package/dist/core/agents/render/session-context.js +34 -3
- package/dist/core/agents/rules/commit-conflict.d.ts.map +1 -1
- package/dist/core/agents/rules/commit-conflict.js +50 -1
- 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 +93 -16
- 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 +9 -2
- 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 +47 -1
- package/dist/core/artifacts/index.d.ts.map +1 -1
- package/dist/core/artifacts/index.js +191 -6
- package/dist/core/config.d.ts +74 -4
- package/dist/core/config.d.ts.map +1 -1
- package/dist/core/config.js +141 -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/diagnostics/advice.d.ts +9 -0
- package/dist/core/diagnostics/advice.d.ts.map +1 -0
- package/dist/core/diagnostics/advice.js +112 -0
- package/dist/core/diagnostics/bundle.d.ts +35 -0
- package/dist/core/diagnostics/bundle.d.ts.map +1 -0
- package/dist/core/diagnostics/bundle.js +874 -0
- package/dist/core/diagnostics/comparison.d.ts +5 -0
- package/dist/core/diagnostics/comparison.d.ts.map +1 -0
- package/dist/core/diagnostics/comparison.js +444 -0
- package/dist/core/diagnostics/contract.d.ts +245 -0
- package/dist/core/diagnostics/contract.d.ts.map +1 -0
- package/dist/core/diagnostics/contract.js +18 -0
- package/dist/core/diagnostics/identity.d.ts +3 -0
- package/dist/core/diagnostics/identity.d.ts.map +1 -0
- package/dist/core/diagnostics/identity.js +10 -0
- package/dist/core/diagnostics/index.d.ts +8 -0
- package/dist/core/diagnostics/index.d.ts.map +1 -0
- package/dist/core/diagnostics/index.js +7 -0
- package/dist/core/diagnostics/replay.d.ts +8 -0
- package/dist/core/diagnostics/replay.d.ts.map +1 -0
- package/dist/core/diagnostics/replay.js +213 -0
- package/dist/core/diagnostics/sanitize.d.ts +9 -0
- package/dist/core/diagnostics/sanitize.d.ts.map +1 -0
- package/dist/core/diagnostics/sanitize.js +84 -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/compression.d.ts +13 -0
- package/dist/core/events/legacy-storage/compression.d.ts.map +1 -0
- package/dist/core/events/legacy-storage/compression.js +107 -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 +7 -0
- package/dist/core/events/legacy-storage/index.d.ts.map +1 -0
- package/dist/core/events/legacy-storage/index.js +6 -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/archive-retention.d.ts +33 -0
- package/dist/core/events/v3/archive-retention.d.ts.map +1 -0
- package/dist/core/events/v3/archive-retention.js +195 -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.d.ts +1 -1
- package/dist/core/events/v3/capabilities.d.ts.map +1 -1
- package/dist/core/events/v3/capabilities.js +4 -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 +5 -2
- package/dist/core/events/v3/index.d.ts.map +1 -1
- package/dist/core/events/v3/index.js +4 -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 +46 -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.d.ts +1 -1
- package/dist/core/events/v3/producers/hook-base.d.ts.map +1 -1
- package/dist/core/events/v3/producers/hook-base.js +14 -3
- 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 +26 -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 +71 -1
- package/dist/core/events/v3/producers/recorder.d.ts.map +1 -1
- package/dist/core/events/v3/producers/recorder.js +441 -25
- 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 +12 -2
- package/dist/core/hooks/adapter/output.d.ts.map +1 -1
- package/dist/core/hooks/adapter/output.js +23 -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 +380 -207
- 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/health.d.ts +59 -0
- package/dist/core/hooks/health.d.ts.map +1 -0
- package/dist/core/hooks/health.js +84 -0
- 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/resources/contract.d.ts +90 -0
- package/dist/core/resources/contract.d.ts.map +1 -0
- package/dist/core/resources/contract.js +2 -0
- package/dist/core/resources/index.d.ts +6 -0
- package/dist/core/resources/index.d.ts.map +1 -0
- package/dist/core/resources/index.js +5 -0
- package/dist/core/resources/sampler.d.ts +27 -0
- package/dist/core/resources/sampler.d.ts.map +1 -0
- package/dist/core/resources/sampler.js +357 -0
- package/dist/core/resources/service-status.d.ts +3 -0
- package/dist/core/resources/service-status.d.ts.map +1 -0
- package/dist/core/resources/service-status.js +48 -0
- package/dist/core/resources/service.d.ts +26 -0
- package/dist/core/resources/service.d.ts.map +1 -0
- package/dist/core/resources/service.js +292 -0
- package/dist/core/resources/storage.d.ts +13 -0
- package/dist/core/resources/storage.d.ts.map +1 -0
- package/dist/core/resources/storage.js +30 -0
- 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/atomic-json.d.ts +3 -0
- package/dist/core/storage/atomic-json.d.ts.map +1 -0
- package/dist/core/storage/atomic-json.js +15 -0
- 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 +722 -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 +84 -0
- package/dist/core/storage/logger.d.ts.map +1 -0
- package/dist/core/storage/logger.js +413 -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 +48 -0
- package/dist/core/storage/query.d.ts.map +1 -0
- package/dist/core/storage/query.js +346 -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/supervisor/activity.d.ts +4 -0
- package/dist/core/supervisor/activity.d.ts.map +1 -0
- package/dist/core/supervisor/activity.js +141 -0
- package/dist/core/supervisor/contract.d.ts +268 -0
- package/dist/core/supervisor/contract.d.ts.map +1 -0
- package/dist/core/supervisor/contract.js +35 -0
- package/dist/core/supervisor/explanations.d.ts +4 -0
- package/dist/core/supervisor/explanations.d.ts.map +1 -0
- package/dist/core/supervisor/explanations.js +71 -0
- package/dist/core/supervisor/findings.d.ts +20 -0
- package/dist/core/supervisor/findings.d.ts.map +1 -0
- package/dist/core/supervisor/findings.js +399 -0
- package/dist/core/supervisor/history.d.ts +9 -0
- package/dist/core/supervisor/history.d.ts.map +1 -0
- package/dist/core/supervisor/history.js +46 -0
- package/dist/core/supervisor/hook-health-alerts.d.ts +14 -0
- package/dist/core/supervisor/hook-health-alerts.d.ts.map +1 -0
- package/dist/core/supervisor/hook-health-alerts.js +70 -0
- package/dist/core/supervisor/hook-health-storage.d.ts +5 -0
- package/dist/core/supervisor/hook-health-storage.d.ts.map +1 -0
- package/dist/core/supervisor/hook-health-storage.js +24 -0
- package/dist/core/supervisor/hook-health.d.ts +72 -0
- package/dist/core/supervisor/hook-health.d.ts.map +1 -0
- package/dist/core/supervisor/hook-health.js +203 -0
- package/dist/core/supervisor/hooks.d.ts +10 -0
- package/dist/core/supervisor/hooks.d.ts.map +1 -0
- package/dist/core/supervisor/hooks.js +28 -0
- package/dist/core/supervisor/index.d.ts +15 -0
- package/dist/core/supervisor/index.d.ts.map +1 -0
- package/dist/core/supervisor/index.js +14 -0
- package/dist/core/supervisor/log-feed.d.ts +9 -0
- package/dist/core/supervisor/log-feed.d.ts.map +1 -0
- package/dist/core/supervisor/log-feed.js +103 -0
- package/dist/core/supervisor/service.d.ts +29 -0
- package/dist/core/supervisor/service.d.ts.map +1 -0
- package/dist/core/supervisor/service.js +450 -0
- package/dist/core/supervisor/services.d.ts +11 -0
- package/dist/core/supervisor/services.d.ts.map +1 -0
- package/dist/core/supervisor/services.js +155 -0
- package/dist/core/supervisor/status.d.ts +3 -0
- package/dist/core/supervisor/status.d.ts.map +1 -0
- package/dist/core/supervisor/status.js +48 -0
- package/dist/core/supervisor/storage.d.ts +30 -0
- package/dist/core/supervisor/storage.d.ts.map +1 -0
- package/dist/core/supervisor/storage.js +73 -0
- package/dist/core/supervisor/timeline.d.ts +3 -0
- package/dist/core/supervisor/timeline.d.ts.map +1 -0
- package/dist/core/supervisor/timeline.js +87 -0
- package/dist/core/work/state.d.ts.map +1 -1
- package/dist/core/work/state.js +10 -14
- package/dist/core/workflow/admission.d.ts +23 -0
- package/dist/core/workflow/admission.d.ts.map +1 -0
- package/dist/core/workflow/admission.js +136 -0
- package/dist/core/workflow/engine.d.ts.map +1 -1
- package/dist/core/workflow/engine.js +77 -2
- package/dist/core/workflow/index.d.ts +3 -2
- package/dist/core/workflow/index.d.ts.map +1 -1
- package/dist/core/workflow/index.js +2 -1
- package/dist/core/workflow/live-session-v3.d.ts.map +1 -1
- package/dist/core/workflow/live-session-v3.js +2 -1
- package/dist/core/workflow/proof.d.ts +2 -1
- package/dist/core/workflow/proof.d.ts.map +1 -1
- package/dist/core/workflow/proof.js +39 -1
- package/dist/core/workflow/run-state.d.ts +3 -2
- package/dist/core/workflow/run-state.d.ts.map +1 -1
- package/dist/core/workflow/run-state.js +8 -1
- package/dist/core/workflow/types.d.ts +33 -1
- package/dist/core/workflow/types.d.ts.map +1 -1
- package/dist/core/workflow/types.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/browser/client.d.ts +5 -0
- package/dist/lib/browser/client.d.ts.map +1 -1
- package/dist/lib/browser/client.js +1 -0
- package/dist/lib/browser/index.d.ts +2 -0
- package/dist/lib/browser/index.d.ts.map +1 -1
- package/dist/lib/browser/index.js +2 -0
- package/dist/lib/browser/qa-run-contracts.d.ts +173 -0
- package/dist/lib/browser/qa-run-contracts.d.ts.map +1 -0
- package/dist/lib/browser/qa-run-contracts.js +226 -0
- package/dist/lib/browser/qa-run.d.ts +51 -0
- package/dist/lib/browser/qa-run.d.ts.map +1 -0
- package/dist/lib/browser/qa-run.js +684 -0
- package/dist/lib/coord-root-id.d.ts +9 -0
- package/dist/lib/coord-root-id.d.ts.map +1 -0
- package/dist/lib/coord-root-id.js +17 -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/apply.d.ts +3 -1
- package/dist/lib/instructions/apply.d.ts.map +1 -1
- package/dist/lib/instructions/apply.js +74 -3
- package/dist/lib/instructions/templates.d.ts.map +1 -1
- package/dist/lib/instructions/templates.js +11 -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 +40 -2
- package/schemas/config.schema.json +58 -0
- package/schemas/event-v3.schema.json +324 -112
- package/src/commander.ts +488 -95
- package/src/commands/agents.ts +617 -237
- package/src/commands/artifacts.ts +40 -2
- package/src/commands/backup.ts +18 -14
- package/src/commands/browse-session.ts +12 -0
- package/src/commands/browse.ts +21 -7
- package/src/commands/conversations.ts +279 -0
- package/src/commands/deinit.ts +6 -0
- package/src/commands/diagnostics.ts +271 -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 +243 -0
- package/src/commands/governor.ts +21 -12
- package/src/commands/inbox.ts +61 -0
- package/src/commands/init.ts +78 -16
- package/src/commands/ledger-v3.ts +503 -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/qa-run.ts +184 -0
- package/src/commands/read.ts +6 -2
- package/src/commands/resources.ts +38 -0
- package/src/commands/semantic.ts +66 -1
- package/src/commands/storage.ts +310 -0
- package/src/commands/supervisor.ts +141 -0
- package/src/commands/tunnel.ts +66 -52
- package/src/commands/web.ts +96 -7
- package/src/commands/work.ts +3 -3
- package/src/commands/workflow.ts +21 -13
- package/src/core/agents/cli.ts +265 -55
- package/src/core/agents/health.ts +142 -0
- 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/mailbox.ts +373 -0
- package/src/core/agents/reconcile-coordination-v3.ts +77 -0
- package/src/core/agents/render/prompt-context.ts +66 -15
- package/src/core/agents/render/session-context.ts +37 -3
- package/src/core/agents/rules/commit-conflict.ts +58 -1
- package/src/core/agents/rules/stop-hook.ts +105 -20
- 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 +8 -2
- 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 +260 -11
- package/src/core/config.ts +235 -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/diagnostics/advice.ts +147 -0
- package/src/core/diagnostics/bundle.ts +1142 -0
- package/src/core/diagnostics/comparison.ts +565 -0
- package/src/core/diagnostics/contract.ts +311 -0
- package/src/core/diagnostics/identity.ts +11 -0
- package/src/core/diagnostics/index.ts +7 -0
- package/src/core/diagnostics/replay.ts +314 -0
- package/src/core/diagnostics/sanitize.ts +97 -0
- package/src/core/events/legacy-storage/canary.ts +177 -0
- package/src/core/events/legacy-storage/compression.ts +130 -0
- package/src/core/events/legacy-storage/fence.ts +129 -0
- package/src/core/events/legacy-storage/index.ts +6 -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/archive-retention.ts +251 -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 +5 -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 +14 -2
- package/src/core/events/v3/live-route-observer.ts +80 -0
- package/src/core/events/v3/live-routing.ts +65 -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 +15 -3
- package/src/core/events/v3/producers/intake.ts +31 -2
- package/src/core/events/v3/producers/producer-state-observer.ts +52 -0
- package/src/core/events/v3/producers/recorder.ts +681 -34
- 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 +23 -5
- package/src/core/hooks/adapter/runtime-telemetry.ts +408 -13
- package/src/core/hooks/cli.ts +404 -233
- package/src/core/hooks/effects/image-capture.ts +4 -1
- package/src/core/hooks/health.ts +146 -0
- 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/resources/contract.ts +98 -0
- package/src/core/resources/index.ts +5 -0
- package/src/core/resources/sampler.ts +458 -0
- package/src/core/resources/service-status.ts +62 -0
- package/src/core/resources/service.ts +337 -0
- package/src/core/resources/storage.ts +44 -0
- 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/atomic-json.ts +15 -0
- package/src/core/storage/buffer.ts +124 -0
- package/src/core/storage/builtins.ts +972 -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 +548 -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 +418 -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/supervisor/activity.ts +193 -0
- package/src/core/supervisor/contract.ts +312 -0
- package/src/core/supervisor/explanations.ts +104 -0
- package/src/core/supervisor/findings.ts +788 -0
- package/src/core/supervisor/history.ts +61 -0
- package/src/core/supervisor/hook-health-alerts.ts +108 -0
- package/src/core/supervisor/hook-health-storage.ts +25 -0
- package/src/core/supervisor/hook-health.ts +301 -0
- package/src/core/supervisor/hooks.ts +35 -0
- package/src/core/supervisor/index.ts +14 -0
- package/src/core/supervisor/log-feed.ts +131 -0
- package/src/core/supervisor/service.ts +511 -0
- package/src/core/supervisor/services.ts +203 -0
- package/src/core/supervisor/status.ts +59 -0
- package/src/core/supervisor/storage.ts +126 -0
- package/src/core/supervisor/timeline.ts +133 -0
- package/src/core/work/state.ts +12 -21
- package/src/core/workflow/admission.ts +215 -0
- package/src/core/workflow/engine.ts +93 -1
- package/src/core/workflow/index.ts +10 -0
- package/src/core/workflow/live-session-v3.ts +2 -4
- package/src/core/workflow/proof.ts +54 -1
- package/src/core/workflow/run-state.ts +13 -1
- package/src/core/workflow/types.ts +39 -1
- package/src/index.ts +2 -0
- package/src/lazy-commands.ts +294 -0
- package/src/lib/browser/client.ts +6 -0
- package/src/lib/browser/index.ts +29 -0
- package/src/lib/browser/qa-run-contracts.ts +380 -0
- package/src/lib/browser/qa-run.ts +784 -0
- package/src/lib/coord-root-id.ts +23 -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/apply.ts +81 -2
- package/src/lib/instructions/templates.ts +11 -0
- package/src/lib/local-file-url.ts +31 -0
- package/src/lib/web-performance.ts +335 -0
|
@@ -0,0 +1,373 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Name-addressed durable mailbox.
|
|
3
|
+
*
|
|
4
|
+
* Peer messaging used to require a live recipient: the sender resolved a name
|
|
5
|
+
* to a running instance and wrote into that instance's journal. Two failures
|
|
6
|
+
* followed from that. A message to a name whose session had ended was refused
|
|
7
|
+
* outright, so the sender spent a long sequence of discovery calls looking for
|
|
8
|
+
* somewhere else to put it. A message to a live peer was accepted but never
|
|
9
|
+
* shown to them, because nothing surfaces another session's journal.
|
|
10
|
+
*
|
|
11
|
+
* This module addresses the durable persona name instead of the instance, so a
|
|
12
|
+
* message can be queued before its recipient exists. Delivery happens on the
|
|
13
|
+
* recipient's side: their next SessionStart or prompt drains the queue, shows
|
|
14
|
+
* the messages, and records them in their journal.
|
|
15
|
+
*
|
|
16
|
+
* Storage: `.harnery/mailbox/<slug>.jsonl`, one JSON record per line, appended
|
|
17
|
+
* by senders and removed by an atomic claim on the recipient's side. Delivered
|
|
18
|
+
* records are appended to `.harnery/mailbox/delivered/<slug>.jsonl` for audit.
|
|
19
|
+
*
|
|
20
|
+
* Related but distinct: `core/inbox` is an instance-keyed transport with a
|
|
21
|
+
* storage-framework service behind it. This mailbox is name-keyed, file-only,
|
|
22
|
+
* and follows the same shape as council manifests and journals.
|
|
23
|
+
*/
|
|
24
|
+
|
|
25
|
+
import { randomUUID } from "node:crypto";
|
|
26
|
+
import {
|
|
27
|
+
appendFileSync,
|
|
28
|
+
existsSync,
|
|
29
|
+
mkdirSync,
|
|
30
|
+
readdirSync,
|
|
31
|
+
readFileSync,
|
|
32
|
+
renameSync,
|
|
33
|
+
statSync,
|
|
34
|
+
unlinkSync,
|
|
35
|
+
writeFileSync,
|
|
36
|
+
} from "node:fs";
|
|
37
|
+
import { join, resolve } from "node:path";
|
|
38
|
+
|
|
39
|
+
import { lookupByName } from "../../lib/identities/index.ts";
|
|
40
|
+
import { resolveBinName } from "../config.ts";
|
|
41
|
+
import { readLiveCoordinationRows } from "./state/live-coordination-view.ts";
|
|
42
|
+
import { COORD_NAMES } from "./state/names.ts";
|
|
43
|
+
|
|
44
|
+
export const MAILBOX_MESSAGE_SCHEMA = "harnery.mailbox-message/v1" as const;
|
|
45
|
+
|
|
46
|
+
/** Per-message body ceiling. Larger payloads belong in a managed artifact, with
|
|
47
|
+
* the path sent as the message. */
|
|
48
|
+
export const MAX_BODY_BYTES = 4000;
|
|
49
|
+
/** Pending messages held for one name before senders are refused. */
|
|
50
|
+
export const MAX_PENDING = 25;
|
|
51
|
+
/** Delivered-archive ceiling; the file is truncated from the head past this. */
|
|
52
|
+
const MAX_DELIVERED_BYTES = 256 * 1024;
|
|
53
|
+
|
|
54
|
+
export interface MailboxMessageV1 {
|
|
55
|
+
schema: typeof MAILBOX_MESSAGE_SCHEMA;
|
|
56
|
+
message_id: string;
|
|
57
|
+
/** Bare display name the sender addressed (registry casing when known). */
|
|
58
|
+
to_name: string;
|
|
59
|
+
from_name: string;
|
|
60
|
+
from_instance_id: string;
|
|
61
|
+
created_at: string;
|
|
62
|
+
body: string;
|
|
63
|
+
/** True when the sender already appended this to a live recipient's journal,
|
|
64
|
+
* so the drain surfaces it without writing a duplicate entry. */
|
|
65
|
+
journaled: boolean;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
export type MailboxCapacityReason = "body_limit" | "pending_limit";
|
|
69
|
+
|
|
70
|
+
export class MailboxCapacityError extends Error {
|
|
71
|
+
constructor(
|
|
72
|
+
readonly reason_code: MailboxCapacityReason,
|
|
73
|
+
readonly current: number,
|
|
74
|
+
readonly limit: number,
|
|
75
|
+
) {
|
|
76
|
+
super(
|
|
77
|
+
`mailbox capacity ${reason_code}: ${current}/${limit}; write the payload to a managed artifact and send its path instead`,
|
|
78
|
+
);
|
|
79
|
+
this.name = "MailboxCapacityError";
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
/** Strip an `agent-` prefix and normalize to the registry's bare form. */
|
|
84
|
+
export function bareAgentName(raw: string): string {
|
|
85
|
+
const trimmed = raw.trim();
|
|
86
|
+
return trimmed.toLowerCase().startsWith("agent-") ? trimmed.slice("agent-".length) : trimmed;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
/** Filesystem-safe slug for a name. Rejects anything that could escape the
|
|
90
|
+
* mailbox directory rather than sanitizing it into a different agent's file. */
|
|
91
|
+
function slugFor(name: string): string {
|
|
92
|
+
const bare = bareAgentName(name).toLowerCase();
|
|
93
|
+
if (!/^[a-z0-9][a-z0-9._-]*$/.test(bare)) {
|
|
94
|
+
throw new Error(`invalid agent name for mailbox addressing: ${JSON.stringify(name)}`);
|
|
95
|
+
}
|
|
96
|
+
return bare;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
export function mailboxDir(coordRoot: string): string {
|
|
100
|
+
return resolve(coordRoot, ".harnery", "mailbox");
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
export function mailboxPath(coordRoot: string, name: string): string {
|
|
104
|
+
return join(mailboxDir(coordRoot), `${slugFor(name)}.jsonl`);
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
function deliveredPath(coordRoot: string, name: string): string {
|
|
108
|
+
return join(mailboxDir(coordRoot), "delivered", `${slugFor(name)}.jsonl`);
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
function parseLines(content: string): MailboxMessageV1[] {
|
|
112
|
+
const out: MailboxMessageV1[] = [];
|
|
113
|
+
for (const line of content.split("\n")) {
|
|
114
|
+
const trimmed = line.trim();
|
|
115
|
+
if (!trimmed) continue;
|
|
116
|
+
try {
|
|
117
|
+
const parsed = JSON.parse(trimmed) as MailboxMessageV1;
|
|
118
|
+
if (parsed?.schema === MAILBOX_MESSAGE_SCHEMA) out.push(parsed);
|
|
119
|
+
} catch {
|
|
120
|
+
/* skip a torn line rather than losing the whole mailbox */
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
return out;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
/** Every name a message may be addressed to: live sessions, the durable
|
|
127
|
+
* identity registry, and the built-in name pool. A name outside all three is a
|
|
128
|
+
* typo, and queueing it would silently swallow the message. */
|
|
129
|
+
export function isAddressableName(coordRoot: string, name: string): boolean {
|
|
130
|
+
const bare = bareAgentName(name).toLowerCase();
|
|
131
|
+
if (!bare) return false;
|
|
132
|
+
if (COORD_NAMES.some((n) => n.toLowerCase() === bare)) return true;
|
|
133
|
+
if (lookupByName(bare, coordRoot)) return true;
|
|
134
|
+
try {
|
|
135
|
+
return readLiveCoordinationRows(coordRoot).some((r) => (r.name ?? "").toLowerCase() === bare);
|
|
136
|
+
} catch {
|
|
137
|
+
return false;
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
/** Names close enough to a miss to be worth suggesting (prefix or one edit). */
|
|
142
|
+
export function suggestNames(coordRoot: string, name: string, limit = 5): string[] {
|
|
143
|
+
const bare = bareAgentName(name).toLowerCase();
|
|
144
|
+
const known = new Set<string>(COORD_NAMES);
|
|
145
|
+
try {
|
|
146
|
+
for (const row of readLiveCoordinationRows(coordRoot)) if (row.name) known.add(row.name);
|
|
147
|
+
} catch {
|
|
148
|
+
/* live rows are advisory here */
|
|
149
|
+
}
|
|
150
|
+
const scored: Array<{ name: string; distance: number }> = [];
|
|
151
|
+
for (const candidate of known) {
|
|
152
|
+
const lower = candidate.toLowerCase();
|
|
153
|
+
if (lower.startsWith(bare.slice(0, 2)) || editDistance(lower, bare) <= 2) {
|
|
154
|
+
scored.push({ name: candidate, distance: editDistance(lower, bare) });
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
scored.sort((a, b) => a.distance - b.distance || a.name.localeCompare(b.name));
|
|
158
|
+
return scored.slice(0, limit).map((s) => s.name);
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
function editDistance(a: string, b: string): number {
|
|
162
|
+
const rows = a.length + 1;
|
|
163
|
+
const cols = b.length + 1;
|
|
164
|
+
let prev = Array.from({ length: cols }, (_, i) => i);
|
|
165
|
+
for (let i = 1; i < rows; i++) {
|
|
166
|
+
const curr = [i, ...Array.from({ length: cols - 1 }, () => 0)];
|
|
167
|
+
for (let j = 1; j < cols; j++) {
|
|
168
|
+
const cost = a[i - 1] === b[j - 1] ? 0 : 1;
|
|
169
|
+
curr[j] = Math.min(curr[j - 1]! + 1, prev[j]! + 1, prev[j - 1]! + cost);
|
|
170
|
+
}
|
|
171
|
+
prev = curr;
|
|
172
|
+
}
|
|
173
|
+
return prev[cols - 1]!;
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
export interface QueueInput {
|
|
177
|
+
coordRoot: string;
|
|
178
|
+
toName: string;
|
|
179
|
+
fromName: string;
|
|
180
|
+
fromInstanceId: string;
|
|
181
|
+
body: string;
|
|
182
|
+
journaled?: boolean;
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
export interface QueueResult {
|
|
186
|
+
message: MailboxMessageV1;
|
|
187
|
+
path: string;
|
|
188
|
+
pending: number;
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
/**
|
|
192
|
+
* Append one message to a name's mailbox. Throws `MailboxCapacityError` when
|
|
193
|
+
* the body or the pending queue is over its ceiling; the caller turns that into
|
|
194
|
+
* an actionable CLI error.
|
|
195
|
+
*/
|
|
196
|
+
export function queueMailboxMessage(input: QueueInput): QueueResult {
|
|
197
|
+
const body = input.body.trim();
|
|
198
|
+
const bodyBytes = Buffer.byteLength(body, "utf8");
|
|
199
|
+
if (bodyBytes > MAX_BODY_BYTES) {
|
|
200
|
+
throw new MailboxCapacityError("body_limit", bodyBytes, MAX_BODY_BYTES);
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
const path = mailboxPath(input.coordRoot, input.toName);
|
|
204
|
+
mkdirSync(mailboxDir(input.coordRoot), { recursive: true });
|
|
205
|
+
const existing = existsSync(path) ? parseLines(readFileSync(path, "utf8")) : [];
|
|
206
|
+
if (existing.length >= MAX_PENDING) {
|
|
207
|
+
throw new MailboxCapacityError("pending_limit", existing.length, MAX_PENDING);
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
// Preserve registry casing when the persona is known, so the recipient sees
|
|
211
|
+
// their own name spelled the way it is everywhere else.
|
|
212
|
+
const identity = lookupByName(input.toName, input.coordRoot);
|
|
213
|
+
const message: MailboxMessageV1 = {
|
|
214
|
+
schema: MAILBOX_MESSAGE_SCHEMA,
|
|
215
|
+
message_id: randomUUID(),
|
|
216
|
+
to_name: identity?.name ?? bareAgentName(input.toName),
|
|
217
|
+
from_name: input.fromName,
|
|
218
|
+
from_instance_id: input.fromInstanceId,
|
|
219
|
+
created_at: new Date().toISOString(),
|
|
220
|
+
body,
|
|
221
|
+
journaled: input.journaled ?? false,
|
|
222
|
+
};
|
|
223
|
+
appendFileSync(path, `${JSON.stringify(message)}\n`, "utf8");
|
|
224
|
+
return { message, path, pending: existing.length + 1 };
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
/** Pending messages for a name, without claiming them. */
|
|
228
|
+
export function peekMailbox(coordRoot: string, name: string): MailboxMessageV1[] {
|
|
229
|
+
let path: string;
|
|
230
|
+
try {
|
|
231
|
+
path = mailboxPath(coordRoot, name);
|
|
232
|
+
} catch {
|
|
233
|
+
return [];
|
|
234
|
+
}
|
|
235
|
+
if (!existsSync(path)) return [];
|
|
236
|
+
try {
|
|
237
|
+
return parseLines(readFileSync(path, "utf8"));
|
|
238
|
+
} catch {
|
|
239
|
+
return [];
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
/**
|
|
244
|
+
* Claim and return every pending message for a name.
|
|
245
|
+
*
|
|
246
|
+
* The claim is an atomic rename, so two sessions sharing a name cannot deliver
|
|
247
|
+
* the same message twice: whichever rename wins owns the batch. Claimed records
|
|
248
|
+
* are appended to the delivered archive before the claim file is removed, so a
|
|
249
|
+
* crash between the two leaves an auditable copy rather than a silent loss.
|
|
250
|
+
*/
|
|
251
|
+
export function drainMailbox(coordRoot: string, name: string): MailboxMessageV1[] {
|
|
252
|
+
let path: string;
|
|
253
|
+
try {
|
|
254
|
+
path = mailboxPath(coordRoot, name);
|
|
255
|
+
} catch {
|
|
256
|
+
return [];
|
|
257
|
+
}
|
|
258
|
+
// Heal first: a claim file left by a crashed reader may hold the only copy of
|
|
259
|
+
// a message for this very name, and sweeping after the existence check would
|
|
260
|
+
// skip it whenever the live queue is empty.
|
|
261
|
+
sweepStaleClaims(coordRoot);
|
|
262
|
+
if (!existsSync(path)) return [];
|
|
263
|
+
|
|
264
|
+
const claim = `${path}.claim-${process.pid}-${Date.now()}`;
|
|
265
|
+
try {
|
|
266
|
+
renameSync(path, claim);
|
|
267
|
+
} catch {
|
|
268
|
+
// Another reader claimed it first, or the file vanished. Either way there
|
|
269
|
+
// is nothing for this caller to deliver.
|
|
270
|
+
return [];
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
let messages: MailboxMessageV1[] = [];
|
|
274
|
+
try {
|
|
275
|
+
messages = parseLines(readFileSync(claim, "utf8"));
|
|
276
|
+
} catch {
|
|
277
|
+
messages = [];
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
if (messages.length > 0) {
|
|
281
|
+
try {
|
|
282
|
+
const archive = deliveredPath(coordRoot, name);
|
|
283
|
+
mkdirSync(join(mailboxDir(coordRoot), "delivered"), { recursive: true });
|
|
284
|
+
const deliveredAt = new Date().toISOString();
|
|
285
|
+
appendFileSync(
|
|
286
|
+
archive,
|
|
287
|
+
`${messages.map((m) => JSON.stringify({ ...m, delivered_at: deliveredAt })).join("\n")}\n`,
|
|
288
|
+
"utf8",
|
|
289
|
+
);
|
|
290
|
+
trimArchive(archive);
|
|
291
|
+
} catch {
|
|
292
|
+
/* audit copy is best-effort; never block delivery on it */
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
try {
|
|
297
|
+
unlinkSync(claim);
|
|
298
|
+
} catch {
|
|
299
|
+
/* a leftover claim is re-queued by the next drain's sweep */
|
|
300
|
+
}
|
|
301
|
+
return messages;
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
/** Re-queue any claim file left behind by a crashed reader (older than 5 min),
|
|
305
|
+
* so a killed session cannot strand a message. Runs at the head of every drain. */
|
|
306
|
+
function sweepStaleClaims(coordRoot: string): void {
|
|
307
|
+
const dir = mailboxDir(coordRoot);
|
|
308
|
+
if (!existsSync(dir)) return;
|
|
309
|
+
const cutoff = Date.now() - 5 * 60_000;
|
|
310
|
+
try {
|
|
311
|
+
for (const file of readdirSync(dir)) {
|
|
312
|
+
const marker = file.indexOf(".jsonl.claim-");
|
|
313
|
+
if (marker === -1) continue;
|
|
314
|
+
const full = join(dir, file);
|
|
315
|
+
let mtime: number;
|
|
316
|
+
try {
|
|
317
|
+
mtime = statSync(full).mtimeMs;
|
|
318
|
+
} catch {
|
|
319
|
+
continue;
|
|
320
|
+
}
|
|
321
|
+
if (mtime > cutoff) continue;
|
|
322
|
+
const owner = join(dir, `${file.slice(0, marker)}.jsonl`);
|
|
323
|
+
try {
|
|
324
|
+
const content = readFileSync(full, "utf8");
|
|
325
|
+
if (content.trim())
|
|
326
|
+
appendFileSync(owner, content.endsWith("\n") ? content : `${content}\n`);
|
|
327
|
+
unlinkSync(full);
|
|
328
|
+
} catch {
|
|
329
|
+
/* skip; next sweep retries */
|
|
330
|
+
}
|
|
331
|
+
}
|
|
332
|
+
} catch {
|
|
333
|
+
/* directory read is best-effort */
|
|
334
|
+
}
|
|
335
|
+
}
|
|
336
|
+
|
|
337
|
+
function trimArchive(path: string): void {
|
|
338
|
+
try {
|
|
339
|
+
if (statSync(path).size <= MAX_DELIVERED_BYTES) return;
|
|
340
|
+
const lines = readFileSync(path, "utf8").split("\n").filter(Boolean);
|
|
341
|
+
const keep = lines.slice(Math.floor(lines.length / 2));
|
|
342
|
+
writeFileSync(path, `${keep.join("\n")}\n`, "utf8");
|
|
343
|
+
} catch {
|
|
344
|
+
/* trimming is housekeeping, never load-bearing */
|
|
345
|
+
}
|
|
346
|
+
}
|
|
347
|
+
|
|
348
|
+
/** Render a drained batch as the context block a recipient reads. */
|
|
349
|
+
export function formatMailboxDelivery(
|
|
350
|
+
coordRoot: string,
|
|
351
|
+
messages: readonly MailboxMessageV1[],
|
|
352
|
+
): string {
|
|
353
|
+
if (messages.length === 0) return "";
|
|
354
|
+
const bin = resolveBinName(coordRoot);
|
|
355
|
+
const header =
|
|
356
|
+
messages.length === 1
|
|
357
|
+
? `Message from a peer agent (delivered now, recorded in your journal):`
|
|
358
|
+
: `${messages.length} messages from peer agents (delivered now, recorded in your journal):`;
|
|
359
|
+
const body = messages
|
|
360
|
+
.map((m) => {
|
|
361
|
+
const when = m.created_at.replace("T", " ").replace(/\.\d+Z$/, "Z");
|
|
362
|
+
return ` from agent-${m.from_name} (${when}):\n${indent(m.body)}`;
|
|
363
|
+
})
|
|
364
|
+
.join("\n\n");
|
|
365
|
+
return `${header}\n\n${body}\n\nReply with \`${bin} agents ping ${messages[0]!.from_name} "<your reply>"\`; it reaches them whether or not their session is still running.`;
|
|
366
|
+
}
|
|
367
|
+
|
|
368
|
+
function indent(text: string): string {
|
|
369
|
+
return text
|
|
370
|
+
.split("\n")
|
|
371
|
+
.map((line) => ` ${line}`)
|
|
372
|
+
.join("\n");
|
|
373
|
+
}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The canonical supervisor reconcile pass.
|
|
3
|
+
*
|
|
4
|
+
* Two things have to happen together, in this order:
|
|
5
|
+
*
|
|
6
|
+
* 1. `staleSweep` prunes the disposable coordination cache under
|
|
7
|
+
* `.harnery/active` (plus orphaned pid-map and `.last-peer-hash` files)
|
|
8
|
+
* and leaves a durable lifecycle observation for every deletion.
|
|
9
|
+
* 2. `reconcileSessionFinalizationV3` turns those observations, along with
|
|
10
|
+
* archive/idle/run/host signals, into session finalization requests.
|
|
11
|
+
*
|
|
12
|
+
* Running the sweep first is what makes a single pass self-contained: the
|
|
13
|
+
* `lifecycle.sweep_observed` rows it writes are visible to the finalizer in
|
|
14
|
+
* the same pass, so a stale session is both reaped and finalized without
|
|
15
|
+
* waiting for a later invocation.
|
|
16
|
+
*
|
|
17
|
+
* ADR 0077 already specified that `agents reconcile` and session start
|
|
18
|
+
* discover stale-sweep in the same pass. Both entry points had drifted to
|
|
19
|
+
* calling only the finalizer, so the sweep never ran outside its own
|
|
20
|
+
* subcommand. This module is the single composition both now share; adding a
|
|
21
|
+
* caller means calling this, not re-composing the two halves.
|
|
22
|
+
*/
|
|
23
|
+
|
|
24
|
+
import {
|
|
25
|
+
type ReconcileSessionFinalizationOptionsV3,
|
|
26
|
+
type ReconcileSessionFinalizationResultV3,
|
|
27
|
+
reconcileSessionFinalizationV3,
|
|
28
|
+
} from "./session-finalizer-v3.ts";
|
|
29
|
+
import { staleSweep } from "./state/stale-sweep.ts";
|
|
30
|
+
|
|
31
|
+
export interface ReconcileCoordinationResultV3 extends ReconcileSessionFinalizationResultV3 {
|
|
32
|
+
/** Heartbeat cache files deleted from `.harnery/active` by the sweep. */
|
|
33
|
+
swept_heartbeats: number;
|
|
34
|
+
/** Orphaned `.harnery/pid-map` entries deleted by the sweep. */
|
|
35
|
+
swept_pidmaps: number;
|
|
36
|
+
/** Dead-owner `.last-peer-hash.*` files deleted by the sweep. */
|
|
37
|
+
swept_peer_hashes: number;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Sweep the disposable coordination cache, then reconcile session
|
|
42
|
+
* finalization, and report both sets of counts.
|
|
43
|
+
*
|
|
44
|
+
* The sweep owns its own safety contract (configured coordination freshness
|
|
45
|
+
* for valid rows, an additional stale-mtime gate for malformed or missing
|
|
46
|
+
* timestamps, and a durable audit record before any deletion, failing closed
|
|
47
|
+
* when neither can be written). Nothing here loosens it, and a sweep failure
|
|
48
|
+
* never blocks finalization: the cache is a projection that heals on the
|
|
49
|
+
* owning agent's next tool call, while the V3 ledger is authoritative.
|
|
50
|
+
*/
|
|
51
|
+
export function reconcileCoordinationV3(
|
|
52
|
+
coordRoot: string,
|
|
53
|
+
options: ReconcileSessionFinalizationOptionsV3 = {},
|
|
54
|
+
): ReconcileCoordinationResultV3 {
|
|
55
|
+
let sweptHeartbeats = 0;
|
|
56
|
+
let sweptPidmaps = 0;
|
|
57
|
+
let sweptPeerHashes = 0;
|
|
58
|
+
const sweepDiagnostics: string[] = [];
|
|
59
|
+
try {
|
|
60
|
+
const sweep = staleSweep(coordRoot);
|
|
61
|
+
sweptHeartbeats = sweep.heartbeatsRemoved.length;
|
|
62
|
+
sweptPidmaps = sweep.pidmapsRemoved;
|
|
63
|
+
sweptPeerHashes = sweep.peerHashesRemoved;
|
|
64
|
+
} catch (error) {
|
|
65
|
+
sweepDiagnostics.push(
|
|
66
|
+
`stale_sweep_failed:${error instanceof Error ? error.message : String(error)}`,
|
|
67
|
+
);
|
|
68
|
+
}
|
|
69
|
+
const result = reconcileSessionFinalizationV3(coordRoot, options);
|
|
70
|
+
return {
|
|
71
|
+
...result,
|
|
72
|
+
diagnostics: [...sweepDiagnostics, ...result.diagnostics],
|
|
73
|
+
swept_heartbeats: sweptHeartbeats,
|
|
74
|
+
swept_pidmaps: sweptPidmaps,
|
|
75
|
+
swept_peer_hashes: sweptPeerHashes,
|
|
76
|
+
};
|
|
77
|
+
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* UserPromptSubmit UX renderer. Combines the peer-refresh dedup, the
|
|
3
3
|
* council-pending hash-dedup, the cross-adapter first-session naming nudge,
|
|
4
|
-
* the Cursor/Codex set-task staleness nudge,
|
|
5
|
-
* reminder.
|
|
4
|
+
* the Cursor/Codex set-task staleness nudge, a host-configured prompt reminder,
|
|
5
|
+
* and the Codex status-footer reminder.
|
|
6
6
|
* agent-hook's turn.started post-emit handler calls this
|
|
7
7
|
* and forwards the result as the adapter-shaped additionalContext payload.
|
|
8
8
|
*
|
|
@@ -18,7 +18,10 @@
|
|
|
18
18
|
* Cursor/Codex additionally get the existing unset/stale-task reminder
|
|
19
19
|
* because their Stop hooks do not enforce task declarations as reliably
|
|
20
20
|
* as Claude Code's.
|
|
21
|
-
* 4.
|
|
21
|
+
* 4. Host prompt reminder: a project-owned, non-deduplicated line for
|
|
22
|
+
* adapters whose prompt hook can inject context and which lack a native
|
|
23
|
+
* reminder mechanism. Hook routing decides which adapters enable it.
|
|
24
|
+
* 5. Codex status footer: a non-deduplicated reminder to put the live status
|
|
22
25
|
* box after the substantive answer. Stop stays observe-only, so missing the
|
|
23
26
|
* footer can never trigger a replacement response.
|
|
24
27
|
*
|
|
@@ -43,15 +46,18 @@ import {
|
|
|
43
46
|
import { join } from "node:path";
|
|
44
47
|
|
|
45
48
|
import { coordEnv } from "../../../lib/env.ts";
|
|
46
|
-
import {
|
|
49
|
+
import type { Adapter } from "../../adapter.ts";
|
|
50
|
+
import { endOfTurnStatusCommand, hostPromptReminder, resolveBinName } from "../../config.ts";
|
|
51
|
+
import { canReceiveContext } from "../../hooks/adapter/output.ts";
|
|
47
52
|
import { type RemoteMachine, readRemoteMachines } from "../../presence/index.ts";
|
|
53
|
+
import { drainMailbox, formatMailboxDelivery } from "../mailbox.ts";
|
|
48
54
|
import { sessionNameDisplayBlock, sessionNameDisplayPending } from "../session-name-display.ts";
|
|
49
55
|
import {
|
|
50
56
|
readLiveCoordinationRow,
|
|
51
57
|
readLiveCoordinationRows,
|
|
52
58
|
} from "../state/live-coordination-view.ts";
|
|
53
59
|
import type { AgentActivity, TaskState } from "../state/session-state.ts";
|
|
54
|
-
import { formatPendingCouncils } from "./session-context.ts";
|
|
60
|
+
import { formatPendingCouncils, recordDeliveredMessages } from "./session-context.ts";
|
|
55
61
|
|
|
56
62
|
interface HeartbeatRow {
|
|
57
63
|
instance_id?: string;
|
|
@@ -83,9 +89,17 @@ export interface PromptContextOpts {
|
|
|
83
89
|
/** When true, run the unset/stale-task check after the first set-task.
|
|
84
90
|
* Cursor/Codex use this; Claude Code has Stop-hook transcript enforcement. */
|
|
85
91
|
taskNudge?: boolean;
|
|
92
|
+
/** When true, append the project-configured prompt reminder without hash
|
|
93
|
+
* deduplication. The caller enables this only on supported adapter routes. */
|
|
94
|
+
hostPromptReminder?: boolean;
|
|
86
95
|
/** When true, append the non-deduplicated Codex status-footer reminder.
|
|
87
96
|
* The caller enables this only for human-facing Codex sessions. */
|
|
88
97
|
statusFooterNudge?: boolean;
|
|
98
|
+
/** Adapter id this prompt is being rendered for. Gates the mailbox drain:
|
|
99
|
+
* an adapter that cannot receive UserPromptSubmit context must not consume
|
|
100
|
+
* messages here, or they are removed from the queue and never shown. When
|
|
101
|
+
* omitted, delivery is attempted (the default route can receive). */
|
|
102
|
+
adapter?: string;
|
|
89
103
|
/** Adapter id whose Stop hook ENFORCES the end-of-turn ritual (task_set +
|
|
90
104
|
* status check). When set, append a fresh per-prompt reminder of that
|
|
91
105
|
* contract so the model satisfies it before ending the turn instead of
|
|
@@ -110,22 +124,46 @@ export function renderPromptContext(opts: PromptContextOpts): string {
|
|
|
110
124
|
agentName,
|
|
111
125
|
sessionNameNudge,
|
|
112
126
|
taskNudge,
|
|
127
|
+
hostPromptReminder: promptReminderEnabled,
|
|
113
128
|
statusFooterNudge,
|
|
114
129
|
turnRitualNudge,
|
|
130
|
+
adapter,
|
|
115
131
|
} = opts;
|
|
116
132
|
const sections: string[] = [];
|
|
117
133
|
|
|
118
|
-
//
|
|
134
|
+
// The hook route does not pass --name, so resolve it from the heartbeat.
|
|
135
|
+
// Every name-addressed section below (messages, councils) is silently
|
|
136
|
+
// skipped without it.
|
|
137
|
+
const resolvedName = agentName ?? readLiveCoordinationRow(coordRoot, instanceId)?.name;
|
|
138
|
+
|
|
139
|
+
// 1. Peer messages. Drained first and never deduped: a message is delivered
|
|
140
|
+
// exactly once, and it is the one section here that carries new information
|
|
141
|
+
// from another agent rather than a reminder.
|
|
142
|
+
//
|
|
143
|
+
// Draining is gated on the adapter being able to receive this event's
|
|
144
|
+
// context. Cursor cannot, so draining there would empty the queue into output
|
|
145
|
+
// that is discarded; those sessions get their messages at SessionStart, which
|
|
146
|
+
// Cursor does deliver.
|
|
147
|
+
const canDeliverHere = !adapter || canReceiveContext(adapter as Adapter, "UserPromptSubmit");
|
|
148
|
+
if (resolvedName && canDeliverHere) {
|
|
149
|
+
const delivered = drainMailbox(coordRoot, resolvedName);
|
|
150
|
+
if (delivered.length > 0) {
|
|
151
|
+
recordDeliveredMessages(instanceId, delivered);
|
|
152
|
+
sections.push(formatMailboxDelivery(coordRoot, delivered));
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
// 2. Peer table with hash dedup.
|
|
119
157
|
const peerTable = computePeerTableIfChanged(coordRoot, instanceId, sessionId);
|
|
120
158
|
if (peerTable) sections.push(peerTable);
|
|
121
159
|
|
|
122
|
-
//
|
|
123
|
-
if (
|
|
124
|
-
const councilMsg = computeCouncilPendingIfChanged(coordRoot, instanceId,
|
|
160
|
+
// 3. Council pending with hash dedup.
|
|
161
|
+
if (resolvedName) {
|
|
162
|
+
const councilMsg = computeCouncilPendingIfChanged(coordRoot, instanceId, resolvedName);
|
|
125
163
|
if (councilMsg) sections.push(councilMsg);
|
|
126
164
|
}
|
|
127
165
|
|
|
128
|
-
//
|
|
166
|
+
// 4. First-session naming for every adapter, plus unset/stale-task reminders
|
|
129
167
|
// for Cursor/Codex. One state machine avoids a second generic "task unset"
|
|
130
168
|
// reminder immediately after the first-session reminder has been deduped.
|
|
131
169
|
if (sessionNameNudge || taskNudge) {
|
|
@@ -136,7 +174,15 @@ export function renderPromptContext(opts: PromptContextOpts): string {
|
|
|
136
174
|
if (nudgeMsg) sections.push(nudgeMsg);
|
|
137
175
|
}
|
|
138
176
|
|
|
139
|
-
//
|
|
177
|
+
// 5. A supported adapter gets the host reminder on every prompt. The text is
|
|
178
|
+
// intentionally not hash-deduped or persisted into runtime state: freshness
|
|
179
|
+
// is the feature, and the project config remains its only durable copy.
|
|
180
|
+
if (promptReminderEnabled) {
|
|
181
|
+
const reminder = renderHostPromptReminder(coordRoot, instanceId);
|
|
182
|
+
if (reminder) sections.push(reminder);
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
// 6. Codex gets this on every prompt. It is intentionally not hash-deduped:
|
|
140
186
|
// the reminder must be fresh in the model's context when it writes the reply.
|
|
141
187
|
// Missing it is harmless because Codex Stop enforcement remains observe-only.
|
|
142
188
|
if (statusFooterNudge) {
|
|
@@ -144,7 +190,7 @@ export function renderPromptContext(opts: PromptContextOpts): string {
|
|
|
144
190
|
if (statusMsg) sections.push(statusMsg);
|
|
145
191
|
}
|
|
146
192
|
|
|
147
|
-
//
|
|
193
|
+
// 7. Adapters whose Stop hook ENFORCES the turn ritual get a fresh reminder
|
|
148
194
|
// on every prompt. Reminding before the reply is drafted is far cheaper than
|
|
149
195
|
// the bounce-and-retry the Stop hook otherwise forces: enforcement-only
|
|
150
196
|
// compliance was measured missing on a double-digit share of turns. Not
|
|
@@ -157,6 +203,12 @@ export function renderPromptContext(opts: PromptContextOpts): string {
|
|
|
157
203
|
return sections.join("\n\n");
|
|
158
204
|
}
|
|
159
205
|
|
|
206
|
+
function renderHostPromptReminder(coordRoot: string, selfInstanceId: string): string {
|
|
207
|
+
const hb = readLiveCoordinationRow(coordRoot, selfInstanceId);
|
|
208
|
+
if (!hb || hb.kind === "subagent" || hb.kind === "transient" || hb.workflow_run_id) return "";
|
|
209
|
+
return hostPromptReminder(coordRoot) ?? "";
|
|
210
|
+
}
|
|
211
|
+
|
|
160
212
|
function renderTurnRitualReminder(
|
|
161
213
|
coordRoot: string,
|
|
162
214
|
selfInstanceId: string,
|
|
@@ -167,10 +219,9 @@ function renderTurnRitualReminder(
|
|
|
167
219
|
|
|
168
220
|
const bin = resolveBinName(coordRoot);
|
|
169
221
|
const statusCommand = endOfTurnStatusCommand(coordRoot);
|
|
170
|
-
// Claude Code
|
|
171
|
-
// shows the box inline on its own, so it is never asked for a second copy.
|
|
222
|
+
// Claude Code and Cursor can both enforce completed assistant reply text.
|
|
172
223
|
const paste =
|
|
173
|
-
adapter === "claude-code"
|
|
224
|
+
adapter === "claude-code" || adapter === "cursor"
|
|
174
225
|
? " and paste its output verbatim in a fenced code block at the end of your reply"
|
|
175
226
|
: "";
|
|
176
227
|
return (
|
|
@@ -12,7 +12,9 @@ import { existsSync, readdirSync, readFileSync, statSync } from "node:fs";
|
|
|
12
12
|
import { join } from "node:path";
|
|
13
13
|
import { resolveBinName, resolveHooksSetupHint } from "../../config.ts";
|
|
14
14
|
import { harneryVersion, loadAdapterWiring } from "../../hooks/adapter/wiring.ts";
|
|
15
|
+
import { appendEntry } from "../../journal/index.ts";
|
|
15
16
|
import { readRemoteMachines } from "../../presence/index.ts";
|
|
17
|
+
import { drainMailbox, formatMailboxDelivery, type MailboxMessageV1 } from "../mailbox.ts";
|
|
16
18
|
import { readLiveCoordinationRows } from "../state/live-coordination-view.ts";
|
|
17
19
|
import { readForkParent } from "../state/names.ts";
|
|
18
20
|
import type { AgentActivity, TaskState } from "../state/session-state.ts";
|
|
@@ -82,13 +84,24 @@ export function renderSessionContext(opts: RenderOpts): string {
|
|
|
82
84
|
);
|
|
83
85
|
}
|
|
84
86
|
|
|
85
|
-
// 3.
|
|
87
|
+
// 3. Peer messages queued for this name while no session held it. Draining
|
|
88
|
+
// here is what makes `agents ping` safe to use on a dormant agent: the sender
|
|
89
|
+
// never has to know whether the recipient is running.
|
|
90
|
+
if (agentName) {
|
|
91
|
+
const delivered = drainMailbox(coordRoot, agentName);
|
|
92
|
+
if (delivered.length > 0) {
|
|
93
|
+
recordDeliveredMessages(instanceId, delivered);
|
|
94
|
+
messages.push(formatMailboxDelivery(coordRoot, delivered));
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
// 4. Council invites
|
|
86
99
|
if (agentName) {
|
|
87
100
|
const councilMsg = formatPendingCouncils(coordRoot, agentName);
|
|
88
101
|
if (councilMsg) messages.push(councilMsg);
|
|
89
102
|
}
|
|
90
103
|
|
|
91
|
-
//
|
|
104
|
+
// 5. Commit-guard wiring check
|
|
92
105
|
const wiringIssues = checkWiring(coordRoot);
|
|
93
106
|
if (wiringIssues.length > 0) {
|
|
94
107
|
const hint = resolveHooksSetupHint(coordRoot);
|
|
@@ -99,7 +112,7 @@ export function renderSessionContext(opts: RenderOpts): string {
|
|
|
99
112
|
messages.push(wiringSummary);
|
|
100
113
|
}
|
|
101
114
|
|
|
102
|
-
//
|
|
115
|
+
// 6. Adapter-hook drift: a harnery upgrade changed the hook set, but this
|
|
103
116
|
// project's settings file hasn't been re-wired. Only fires for a adapter the
|
|
104
117
|
// project already opted into (≥1 hook wired), so it never nags a project that
|
|
105
118
|
// simply has a settings file. Remedy is always `<bin> init` (idempotent).
|
|
@@ -125,6 +138,27 @@ export function renderSessionContext(opts: RenderOpts): string {
|
|
|
125
138
|
return messages.join("\n\n");
|
|
126
139
|
}
|
|
127
140
|
|
|
141
|
+
/**
|
|
142
|
+
* Write delivered peer messages into the recipient's own journal, so they
|
|
143
|
+
* survive context compaction the way any other coordination breadcrumb does.
|
|
144
|
+
* A message the sender already journaled (the recipient was live when it was
|
|
145
|
+
* sent) is skipped to avoid a duplicate entry.
|
|
146
|
+
*/
|
|
147
|
+
export function recordDeliveredMessages(
|
|
148
|
+
instanceId: string,
|
|
149
|
+
messages: readonly MailboxMessageV1[],
|
|
150
|
+
): void {
|
|
151
|
+
for (const m of messages) {
|
|
152
|
+
if (m.journaled) continue;
|
|
153
|
+
try {
|
|
154
|
+
appendEntry(instanceId, "handoff", `from agent-${m.from_name}: ${m.body}`);
|
|
155
|
+
} catch {
|
|
156
|
+
// A journal write failure must never cost the delivery itself; the
|
|
157
|
+
// message is already in the rendered context the model reads.
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
|
|
128
162
|
/** One-line-per-agent view of sessions on other machines (presence refs). */
|
|
129
163
|
function formatRemoteMachines(coordRoot: string): string {
|
|
130
164
|
try {
|