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,343 @@
|
|
|
1
|
+
export type HarnerySinkEdgeKind = "primary" | "diagnostic" | "fallback";
|
|
2
|
+
export type HarnerySinkRecordOrigin = "structured-log" | "raw-process" | "cli-emission";
|
|
3
|
+
export type HarneryCapturedStream = "stdout" | "stderr";
|
|
4
|
+
|
|
5
|
+
export interface HarnerySinkRecord<T = unknown> {
|
|
6
|
+
origin: HarnerySinkRecordOrigin;
|
|
7
|
+
payload: T;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export interface HarnerySinkDelivery<T = unknown> extends HarnerySinkRecord<T> {
|
|
11
|
+
entry_sink_id: string;
|
|
12
|
+
sink_id: string;
|
|
13
|
+
route: "entry" | HarnerySinkEdgeKind;
|
|
14
|
+
source_sink_id?: string;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export interface HarnerySink {
|
|
18
|
+
id: string;
|
|
19
|
+
deliver(delivery: HarnerySinkDelivery): void | Promise<void>;
|
|
20
|
+
emits_stream?: HarneryCapturedStream;
|
|
21
|
+
captures?: {
|
|
22
|
+
origin: HarneryCapturedStream | "cli-emission";
|
|
23
|
+
origin_sink_id?: string;
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export interface HarnerySinkEdge {
|
|
28
|
+
from: string;
|
|
29
|
+
to: string;
|
|
30
|
+
kind: HarnerySinkEdgeKind;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export type HarnerySinkGraphErrorCode =
|
|
34
|
+
| "duplicate_sink"
|
|
35
|
+
| "invalid_sink"
|
|
36
|
+
| "unknown_sink"
|
|
37
|
+
| "duplicate_edge"
|
|
38
|
+
| "self_edge"
|
|
39
|
+
| "cycle"
|
|
40
|
+
| "cli_emission_capture"
|
|
41
|
+
| "capture_origin_invalid"
|
|
42
|
+
| "capture_loop"
|
|
43
|
+
| "fanout_limit"
|
|
44
|
+
| "graph_limit";
|
|
45
|
+
|
|
46
|
+
export class HarnerySinkGraphError extends Error {
|
|
47
|
+
constructor(
|
|
48
|
+
readonly code: HarnerySinkGraphErrorCode,
|
|
49
|
+
message: string,
|
|
50
|
+
) {
|
|
51
|
+
super(message);
|
|
52
|
+
this.name = "HarnerySinkGraphError";
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
export type HarnerySinkDeliveryFailureCode = "sink_delivery_failed" | "delivery_budget_exhausted";
|
|
57
|
+
|
|
58
|
+
export class HarnerySinkDeliveryError extends Error {
|
|
59
|
+
constructor(
|
|
60
|
+
readonly code: HarnerySinkDeliveryFailureCode,
|
|
61
|
+
readonly sink_id: string,
|
|
62
|
+
message: string,
|
|
63
|
+
readonly cause?: unknown,
|
|
64
|
+
) {
|
|
65
|
+
super(message);
|
|
66
|
+
this.name = "HarnerySinkDeliveryError";
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
export interface HarnerySinkDeliveryFailure {
|
|
71
|
+
code: HarnerySinkDeliveryFailureCode;
|
|
72
|
+
sink_id: string;
|
|
73
|
+
route: HarnerySinkDelivery["route"];
|
|
74
|
+
error: HarnerySinkDeliveryError;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
export interface HarnerySinkDeliveryResult {
|
|
78
|
+
attempted: number;
|
|
79
|
+
delivered: readonly string[];
|
|
80
|
+
failures: readonly HarnerySinkDeliveryFailure[];
|
|
81
|
+
truncated: boolean;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
export interface HarnerySinkGraphOptions {
|
|
85
|
+
max_sinks?: number;
|
|
86
|
+
max_edges?: number;
|
|
87
|
+
max_fanout?: number;
|
|
88
|
+
max_deliveries?: number;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
interface QueuedDelivery {
|
|
92
|
+
sink_id: string;
|
|
93
|
+
route: HarnerySinkDelivery["route"];
|
|
94
|
+
source_sink_id?: string;
|
|
95
|
+
record: HarnerySinkRecord;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
const ID = /^[a-z][a-z0-9._-]{0,63}$/;
|
|
99
|
+
|
|
100
|
+
export class HarnerySinkGraph {
|
|
101
|
+
readonly sinks: readonly Readonly<HarnerySink>[];
|
|
102
|
+
readonly edges: readonly Readonly<HarnerySinkEdge>[];
|
|
103
|
+
readonly #byId: ReadonlyMap<string, Readonly<HarnerySink>>;
|
|
104
|
+
readonly #outgoing: ReadonlyMap<string, readonly Readonly<HarnerySinkEdge>[]>;
|
|
105
|
+
readonly #maxDeliveries: number;
|
|
106
|
+
|
|
107
|
+
constructor(
|
|
108
|
+
sinks: readonly HarnerySink[],
|
|
109
|
+
edges: readonly HarnerySinkEdge[],
|
|
110
|
+
options: HarnerySinkGraphOptions = {},
|
|
111
|
+
) {
|
|
112
|
+
const limits = {
|
|
113
|
+
max_sinks: positive(options.max_sinks ?? 32, "max_sinks"),
|
|
114
|
+
max_edges: positive(options.max_edges ?? 128, "max_edges"),
|
|
115
|
+
max_fanout: positive(options.max_fanout ?? 8, "max_fanout"),
|
|
116
|
+
max_deliveries: positive(options.max_deliveries ?? 64, "max_deliveries"),
|
|
117
|
+
};
|
|
118
|
+
if (sinks.length > limits.max_sinks || edges.length > limits.max_edges) {
|
|
119
|
+
throw new HarnerySinkGraphError("graph_limit", "sink graph exceeds its construction limit");
|
|
120
|
+
}
|
|
121
|
+
const sinkCopies = sinks.map((sink) => Object.freeze({ ...sink }));
|
|
122
|
+
const byId = new Map<string, Readonly<HarnerySink>>();
|
|
123
|
+
for (const sink of sinkCopies) {
|
|
124
|
+
if (!ID.test(sink.id) || typeof sink.deliver !== "function") {
|
|
125
|
+
throw new HarnerySinkGraphError("invalid_sink", `invalid sink: ${sink.id}`);
|
|
126
|
+
}
|
|
127
|
+
if (byId.has(sink.id)) {
|
|
128
|
+
throw new HarnerySinkGraphError("duplicate_sink", `duplicate sink: ${sink.id}`);
|
|
129
|
+
}
|
|
130
|
+
if (sink.captures?.origin === "cli-emission") {
|
|
131
|
+
throw new HarnerySinkGraphError(
|
|
132
|
+
"cli_emission_capture",
|
|
133
|
+
`sink ${sink.id} cannot capture CLI emission`,
|
|
134
|
+
);
|
|
135
|
+
}
|
|
136
|
+
byId.set(sink.id, sink);
|
|
137
|
+
}
|
|
138
|
+
const edgeCopies = edges.map((edge) => Object.freeze({ ...edge }));
|
|
139
|
+
const outgoing = new Map<string, readonly Readonly<HarnerySinkEdge>[]>();
|
|
140
|
+
const edgeKeys = new Set<string>();
|
|
141
|
+
for (const edge of edgeCopies) {
|
|
142
|
+
if (!byId.has(edge.from) || !byId.has(edge.to)) {
|
|
143
|
+
throw new HarnerySinkGraphError(
|
|
144
|
+
"unknown_sink",
|
|
145
|
+
`sink edge references an unknown sink: ${edge.from}->${edge.to}`,
|
|
146
|
+
);
|
|
147
|
+
}
|
|
148
|
+
if (edge.from === edge.to) {
|
|
149
|
+
throw new HarnerySinkGraphError(
|
|
150
|
+
"self_edge",
|
|
151
|
+
`sink ${edge.from} cannot route ${edge.kind} delivery through itself`,
|
|
152
|
+
);
|
|
153
|
+
}
|
|
154
|
+
if (!new Set<HarnerySinkEdgeKind>(["primary", "diagnostic", "fallback"]).has(edge.kind)) {
|
|
155
|
+
throw new HarnerySinkGraphError("invalid_sink", `invalid sink edge kind: ${edge.kind}`);
|
|
156
|
+
}
|
|
157
|
+
const key = `${edge.from}\0${edge.to}\0${edge.kind}`;
|
|
158
|
+
if (edgeKeys.has(key)) {
|
|
159
|
+
throw new HarnerySinkGraphError(
|
|
160
|
+
"duplicate_edge",
|
|
161
|
+
`duplicate sink edge: ${edge.from}->${edge.to}`,
|
|
162
|
+
);
|
|
163
|
+
}
|
|
164
|
+
edgeKeys.add(key);
|
|
165
|
+
const next = [...(outgoing.get(edge.from) ?? []), edge];
|
|
166
|
+
if (next.length > limits.max_fanout) {
|
|
167
|
+
throw new HarnerySinkGraphError("fanout_limit", `sink ${edge.from} exceeds fan-out limit`);
|
|
168
|
+
}
|
|
169
|
+
outgoing.set(edge.from, Object.freeze(next));
|
|
170
|
+
}
|
|
171
|
+
rejectCycles(byId, outgoing);
|
|
172
|
+
rejectCaptureLoops(byId, outgoing);
|
|
173
|
+
this.sinks = Object.freeze(sinkCopies);
|
|
174
|
+
this.edges = Object.freeze(edgeCopies);
|
|
175
|
+
this.#byId = byId;
|
|
176
|
+
this.#outgoing = outgoing;
|
|
177
|
+
this.#maxDeliveries = limits.max_deliveries;
|
|
178
|
+
Object.freeze(this);
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
async deliver(
|
|
182
|
+
entrySinkId: string,
|
|
183
|
+
record: HarnerySinkRecord,
|
|
184
|
+
): Promise<HarnerySinkDeliveryResult> {
|
|
185
|
+
if (!this.#byId.has(entrySinkId)) {
|
|
186
|
+
throw new HarnerySinkGraphError("unknown_sink", `unknown entry sink: ${entrySinkId}`);
|
|
187
|
+
}
|
|
188
|
+
if (record.origin === "cli-emission") {
|
|
189
|
+
throw new HarnerySinkGraphError(
|
|
190
|
+
"cli_emission_capture",
|
|
191
|
+
"CLI emission is not a structured sink record",
|
|
192
|
+
);
|
|
193
|
+
}
|
|
194
|
+
const queue: QueuedDelivery[] = [{ sink_id: entrySinkId, route: "entry", record }];
|
|
195
|
+
const visited = new Set<string>();
|
|
196
|
+
const delivered: string[] = [];
|
|
197
|
+
const failures: HarnerySinkDeliveryFailure[] = [];
|
|
198
|
+
let attempted = 0;
|
|
199
|
+
let truncated = false;
|
|
200
|
+
while (queue.length > 0) {
|
|
201
|
+
const next = queue.shift()!;
|
|
202
|
+
const visitKey = `${next.sink_id}\0${next.route}`;
|
|
203
|
+
if (visited.has(visitKey)) continue;
|
|
204
|
+
if (attempted >= this.#maxDeliveries) {
|
|
205
|
+
truncated = true;
|
|
206
|
+
failures.push(deliveryFailure("delivery_budget_exhausted", next, undefined));
|
|
207
|
+
break;
|
|
208
|
+
}
|
|
209
|
+
visited.add(visitKey);
|
|
210
|
+
attempted += 1;
|
|
211
|
+
const sink = this.#byId.get(next.sink_id)!;
|
|
212
|
+
try {
|
|
213
|
+
await sink.deliver({
|
|
214
|
+
...next.record,
|
|
215
|
+
entry_sink_id: entrySinkId,
|
|
216
|
+
sink_id: next.sink_id,
|
|
217
|
+
route: next.route,
|
|
218
|
+
...(next.source_sink_id ? { source_sink_id: next.source_sink_id } : {}),
|
|
219
|
+
});
|
|
220
|
+
delivered.push(next.sink_id);
|
|
221
|
+
if (next.route === "entry" || next.route === "primary") {
|
|
222
|
+
enqueueEdges(queue, this.#outgoing.get(next.sink_id), "primary", next.record);
|
|
223
|
+
}
|
|
224
|
+
} catch (error) {
|
|
225
|
+
const failure = deliveryFailure("sink_delivery_failed", next, error);
|
|
226
|
+
failures.push(failure);
|
|
227
|
+
// Recovery lanes are terminal. Their failures remain typed return data
|
|
228
|
+
// and never emit another diagnostic through this graph.
|
|
229
|
+
if (next.route === "entry" || next.route === "primary") {
|
|
230
|
+
enqueueEdges(queue, this.#outgoing.get(next.sink_id), "diagnostic", {
|
|
231
|
+
origin: "structured-log",
|
|
232
|
+
payload: failure,
|
|
233
|
+
});
|
|
234
|
+
enqueueEdges(queue, this.#outgoing.get(next.sink_id), "fallback", next.record);
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
return Object.freeze({
|
|
239
|
+
attempted,
|
|
240
|
+
delivered: Object.freeze(delivered),
|
|
241
|
+
failures: Object.freeze(failures),
|
|
242
|
+
truncated,
|
|
243
|
+
});
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
function enqueueEdges(
|
|
248
|
+
queue: QueuedDelivery[],
|
|
249
|
+
edges: readonly Readonly<HarnerySinkEdge>[] | undefined,
|
|
250
|
+
kind: HarnerySinkEdgeKind,
|
|
251
|
+
record: HarnerySinkRecord,
|
|
252
|
+
): void {
|
|
253
|
+
for (const edge of edges ?? []) {
|
|
254
|
+
if (edge.kind !== kind) continue;
|
|
255
|
+
queue.push({ sink_id: edge.to, route: kind, source_sink_id: edge.from, record });
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
function deliveryFailure(
|
|
260
|
+
code: HarnerySinkDeliveryFailureCode,
|
|
261
|
+
delivery: QueuedDelivery,
|
|
262
|
+
cause: unknown,
|
|
263
|
+
): HarnerySinkDeliveryFailure {
|
|
264
|
+
const error = new HarnerySinkDeliveryError(
|
|
265
|
+
code,
|
|
266
|
+
delivery.sink_id,
|
|
267
|
+
code === "sink_delivery_failed"
|
|
268
|
+
? `sink delivery failed: ${delivery.sink_id}`
|
|
269
|
+
: `sink delivery budget exhausted before ${delivery.sink_id}`,
|
|
270
|
+
cause,
|
|
271
|
+
);
|
|
272
|
+
return Object.freeze({ code, sink_id: delivery.sink_id, route: delivery.route, error });
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
function rejectCycles(
|
|
276
|
+
sinks: ReadonlyMap<string, Readonly<HarnerySink>>,
|
|
277
|
+
outgoing: ReadonlyMap<string, readonly Readonly<HarnerySinkEdge>[]>,
|
|
278
|
+
): void {
|
|
279
|
+
const visiting = new Set<string>();
|
|
280
|
+
const visited = new Set<string>();
|
|
281
|
+
const visit = (id: string) => {
|
|
282
|
+
if (visiting.has(id)) throw new HarnerySinkGraphError("cycle", `sink graph cycle at ${id}`);
|
|
283
|
+
if (visited.has(id)) return;
|
|
284
|
+
visiting.add(id);
|
|
285
|
+
for (const edge of outgoing.get(id) ?? []) visit(edge.to);
|
|
286
|
+
visiting.delete(id);
|
|
287
|
+
visited.add(id);
|
|
288
|
+
};
|
|
289
|
+
for (const id of sinks.keys()) visit(id);
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
function rejectCaptureLoops(
|
|
293
|
+
sinks: ReadonlyMap<string, Readonly<HarnerySink>>,
|
|
294
|
+
outgoing: ReadonlyMap<string, readonly Readonly<HarnerySinkEdge>[]>,
|
|
295
|
+
): void {
|
|
296
|
+
for (const sink of sinks.values()) {
|
|
297
|
+
const capture = sink.captures;
|
|
298
|
+
if (!capture || capture.origin === "cli-emission") continue;
|
|
299
|
+
if (!capture.origin_sink_id) {
|
|
300
|
+
throw new HarnerySinkGraphError(
|
|
301
|
+
"capture_origin_invalid",
|
|
302
|
+
`capturing sink ${sink.id} must name its origin sink`,
|
|
303
|
+
);
|
|
304
|
+
}
|
|
305
|
+
const origin = sinks.get(capture.origin_sink_id);
|
|
306
|
+
if (!origin || origin.emits_stream !== capture.origin) {
|
|
307
|
+
throw new HarnerySinkGraphError(
|
|
308
|
+
"capture_origin_invalid",
|
|
309
|
+
`capturing sink ${sink.id} has an invalid ${capture.origin} origin`,
|
|
310
|
+
);
|
|
311
|
+
}
|
|
312
|
+
if (sink.id === origin.id || reachable(sink.id, origin.id, outgoing)) {
|
|
313
|
+
throw new HarnerySinkGraphError(
|
|
314
|
+
"capture_loop",
|
|
315
|
+
`captured ${capture.origin} from ${origin.id} routes back through ${sink.id}`,
|
|
316
|
+
);
|
|
317
|
+
}
|
|
318
|
+
}
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
function reachable(
|
|
322
|
+
from: string,
|
|
323
|
+
target: string,
|
|
324
|
+
outgoing: ReadonlyMap<string, readonly Readonly<HarnerySinkEdge>[]>,
|
|
325
|
+
): boolean {
|
|
326
|
+
const pending = [from];
|
|
327
|
+
const seen = new Set<string>();
|
|
328
|
+
while (pending.length > 0) {
|
|
329
|
+
const current = pending.pop()!;
|
|
330
|
+
if (current === target) return true;
|
|
331
|
+
if (seen.has(current)) continue;
|
|
332
|
+
seen.add(current);
|
|
333
|
+
for (const edge of outgoing.get(current) ?? []) pending.push(edge.to);
|
|
334
|
+
}
|
|
335
|
+
return false;
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
function positive(value: number, name: string): number {
|
|
339
|
+
if (!Number.isSafeInteger(value) || value <= 0) {
|
|
340
|
+
throw new HarnerySinkGraphError("graph_limit", `${name} must be a positive safe integer`);
|
|
341
|
+
}
|
|
342
|
+
return value;
|
|
343
|
+
}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { createHash } from "node:crypto";
|
|
2
|
+
import type { HarneryLogLevel } from "./contract.ts";
|
|
3
|
+
|
|
4
|
+
export interface HarneryStormSummary {
|
|
5
|
+
key: string;
|
|
6
|
+
count: number;
|
|
7
|
+
represented_bytes: number;
|
|
8
|
+
first_emitted_at: string;
|
|
9
|
+
last_emitted_at: string;
|
|
10
|
+
exemplar_digests: readonly string[];
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export interface ProcessStormControllerOptions {
|
|
14
|
+
enabled: boolean;
|
|
15
|
+
window_ms: number;
|
|
16
|
+
max_exemplars: number;
|
|
17
|
+
burst?: number;
|
|
18
|
+
now?: () => number;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
interface Bucket {
|
|
22
|
+
started: number;
|
|
23
|
+
admitted: number;
|
|
24
|
+
dropped: number;
|
|
25
|
+
representedBytes: number;
|
|
26
|
+
first: string;
|
|
27
|
+
last: string;
|
|
28
|
+
exemplars: string[];
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export class ProcessStormController {
|
|
32
|
+
readonly #options: Required<ProcessStormControllerOptions>;
|
|
33
|
+
readonly #buckets = new Map<string, Bucket>();
|
|
34
|
+
|
|
35
|
+
constructor(options: ProcessStormControllerOptions) {
|
|
36
|
+
this.#options = { ...options, burst: options.burst ?? 100, now: options.now ?? Date.now };
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
admit(key: string, level: HarneryLogLevel, bytes: number): boolean {
|
|
40
|
+
if (!this.#options.enabled || level === "error" || level === "fatal") return true;
|
|
41
|
+
const now = this.#options.now();
|
|
42
|
+
let bucket = this.#buckets.get(key);
|
|
43
|
+
if (!bucket || now - bucket.started >= this.#options.window_ms) {
|
|
44
|
+
bucket = {
|
|
45
|
+
started: now,
|
|
46
|
+
admitted: 0,
|
|
47
|
+
dropped: 0,
|
|
48
|
+
representedBytes: 0,
|
|
49
|
+
first: new Date(now).toISOString(),
|
|
50
|
+
last: new Date(now).toISOString(),
|
|
51
|
+
exemplars: [],
|
|
52
|
+
};
|
|
53
|
+
this.#buckets.set(key, bucket);
|
|
54
|
+
}
|
|
55
|
+
if (bucket.admitted < this.#options.burst) {
|
|
56
|
+
bucket.admitted += 1;
|
|
57
|
+
return true;
|
|
58
|
+
}
|
|
59
|
+
bucket.dropped += 1;
|
|
60
|
+
bucket.representedBytes += bytes;
|
|
61
|
+
bucket.last = new Date(now).toISOString();
|
|
62
|
+
const digest = createHash("sha256").update(`${key}:${bytes}`).digest("hex").slice(0, 16);
|
|
63
|
+
if (
|
|
64
|
+
bucket.exemplars.length < this.#options.max_exemplars &&
|
|
65
|
+
!bucket.exemplars.includes(digest)
|
|
66
|
+
) {
|
|
67
|
+
bucket.exemplars.push(digest);
|
|
68
|
+
}
|
|
69
|
+
return false;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
drainSummaries(force = false): HarneryStormSummary[] {
|
|
73
|
+
const now = this.#options.now();
|
|
74
|
+
const summaries: HarneryStormSummary[] = [];
|
|
75
|
+
for (const [key, bucket] of this.#buckets) {
|
|
76
|
+
if (!force && now - bucket.started < this.#options.window_ms) continue;
|
|
77
|
+
if (bucket.dropped > 0) {
|
|
78
|
+
summaries.push({
|
|
79
|
+
key,
|
|
80
|
+
count: bucket.dropped,
|
|
81
|
+
represented_bytes: bucket.representedBytes,
|
|
82
|
+
first_emitted_at: bucket.first,
|
|
83
|
+
last_emitted_at: bucket.last,
|
|
84
|
+
exemplar_digests: bucket.exemplars,
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
this.#buckets.delete(key);
|
|
88
|
+
}
|
|
89
|
+
return summaries;
|
|
90
|
+
}
|
|
91
|
+
}
|
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
import { createHash } from "node:crypto";
|
|
2
|
+
import { existsSync, lstatSync, readdirSync, readFileSync } from "node:fs";
|
|
3
|
+
import { join, resolve } from "node:path";
|
|
4
|
+
import {
|
|
5
|
+
SUPERVISOR_ACTIVITY_SCHEMA_VERSION,
|
|
6
|
+
SUPERVISOR_DIAGNOSTIC_LIMITS,
|
|
7
|
+
SUPERVISOR_FINDING_POLICY,
|
|
8
|
+
type SupervisorActivitySnapshot,
|
|
9
|
+
type SupervisorDeclaredActivity,
|
|
10
|
+
type SupervisorSourceReference,
|
|
11
|
+
} from "./contract.ts";
|
|
12
|
+
|
|
13
|
+
interface ActivityCache {
|
|
14
|
+
schema_version?: number;
|
|
15
|
+
instance_id?: string;
|
|
16
|
+
session_id?: string;
|
|
17
|
+
activity?: string;
|
|
18
|
+
task_state?: string;
|
|
19
|
+
last_heartbeat?: string;
|
|
20
|
+
v3_instance_id?: string;
|
|
21
|
+
v3_generation_id?: string;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
interface CandidateFile {
|
|
25
|
+
name: string;
|
|
26
|
+
path: string;
|
|
27
|
+
bytes: number;
|
|
28
|
+
mtimeMs: number;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/** Read a bounded, generation-bound activity projection without loading Event Ledger V3. */
|
|
32
|
+
export function collectSupervisorActivitySnapshot(
|
|
33
|
+
coordRoot: string,
|
|
34
|
+
now = new Date(),
|
|
35
|
+
): SupervisorActivitySnapshot {
|
|
36
|
+
const observedAt = now.toISOString();
|
|
37
|
+
const directory = join(resolve(coordRoot), ".harnery", "active");
|
|
38
|
+
if (!existsSync(directory)) return unavailable(observedAt, "activity-projection-missing");
|
|
39
|
+
|
|
40
|
+
const candidates: CandidateFile[] = [];
|
|
41
|
+
let rejected = 0;
|
|
42
|
+
try {
|
|
43
|
+
for (const entry of readdirSync(directory)) {
|
|
44
|
+
if (!/^[A-Za-z0-9_-]{1,128}\.json$/.test(entry)) {
|
|
45
|
+
rejected += 1;
|
|
46
|
+
continue;
|
|
47
|
+
}
|
|
48
|
+
const path = join(directory, entry);
|
|
49
|
+
const stat = lstatSync(path);
|
|
50
|
+
if (
|
|
51
|
+
stat.isSymbolicLink() ||
|
|
52
|
+
!stat.isFile() ||
|
|
53
|
+
stat.size < 2 ||
|
|
54
|
+
stat.size > SUPERVISOR_FINDING_POLICY.max_activity_file_bytes
|
|
55
|
+
) {
|
|
56
|
+
rejected += 1;
|
|
57
|
+
continue;
|
|
58
|
+
}
|
|
59
|
+
candidates.push({ name: entry.slice(0, -5), path, bytes: stat.size, mtimeMs: stat.mtimeMs });
|
|
60
|
+
}
|
|
61
|
+
} catch {
|
|
62
|
+
return unavailable(observedAt, "activity-projection-read-failed", "error");
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
candidates.sort(
|
|
66
|
+
(left, right) => right.mtimeMs - left.mtimeMs || left.name.localeCompare(right.name),
|
|
67
|
+
);
|
|
68
|
+
const entries: SupervisorDeclaredActivity[] = [];
|
|
69
|
+
let totalBytes = 0;
|
|
70
|
+
let stale = 0;
|
|
71
|
+
for (const candidate of candidates) {
|
|
72
|
+
if (
|
|
73
|
+
entries.length >= SUPERVISOR_DIAGNOSTIC_LIMITS.max_activity_entries ||
|
|
74
|
+
totalBytes + candidate.bytes > SUPERVISOR_FINDING_POLICY.max_activity_total_bytes
|
|
75
|
+
) {
|
|
76
|
+
rejected += 1;
|
|
77
|
+
continue;
|
|
78
|
+
}
|
|
79
|
+
totalBytes += candidate.bytes;
|
|
80
|
+
let cache: ActivityCache;
|
|
81
|
+
try {
|
|
82
|
+
cache = JSON.parse(readFileSync(candidate.path, "utf8")) as ActivityCache;
|
|
83
|
+
} catch {
|
|
84
|
+
rejected += 1;
|
|
85
|
+
continue;
|
|
86
|
+
}
|
|
87
|
+
if (!validCache(cache, candidate.name)) {
|
|
88
|
+
rejected += 1;
|
|
89
|
+
continue;
|
|
90
|
+
}
|
|
91
|
+
const age = now.getTime() - Date.parse(cache.last_heartbeat!);
|
|
92
|
+
if (
|
|
93
|
+
!Number.isFinite(age) ||
|
|
94
|
+
age < -30_000 ||
|
|
95
|
+
age > SUPERVISOR_FINDING_POLICY.activity_freshness_ms
|
|
96
|
+
) {
|
|
97
|
+
stale += 1;
|
|
98
|
+
continue;
|
|
99
|
+
}
|
|
100
|
+
entries.push(activityEntry(cache as Required<ActivityCache>));
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
const state = rejected > 0 ? "partial" : "supported";
|
|
104
|
+
return {
|
|
105
|
+
schema_version: SUPERVISOR_ACTIVITY_SCHEMA_VERSION,
|
|
106
|
+
observed_at: observedAt,
|
|
107
|
+
max_entries: SUPERVISOR_DIAGNOSTIC_LIMITS.max_activity_entries,
|
|
108
|
+
entries: entries.sort((left, right) => left.scope_id.localeCompare(right.scope_id)),
|
|
109
|
+
omitted_entry_count: rejected + stale,
|
|
110
|
+
capability: {
|
|
111
|
+
source_kind: "coordination.activity-projection",
|
|
112
|
+
state,
|
|
113
|
+
...(state === "partial" ? { reason_code: "bounded-cache-rejection" } : {}),
|
|
114
|
+
...(rejected + stale > 0
|
|
115
|
+
? { detail: `${rejected} invalid or over-budget and ${stale} stale activity rows omitted.` }
|
|
116
|
+
: {}),
|
|
117
|
+
},
|
|
118
|
+
};
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
function validCache(cache: ActivityCache, fileId: string): boolean {
|
|
122
|
+
return (
|
|
123
|
+
cache.schema_version === 2 &&
|
|
124
|
+
cache.instance_id === fileId &&
|
|
125
|
+
typeof cache.session_id === "string" &&
|
|
126
|
+
cache.session_id.length > 0 &&
|
|
127
|
+
isActivity(cache.activity) &&
|
|
128
|
+
isTaskState(cache.task_state) &&
|
|
129
|
+
typeof cache.last_heartbeat === "string" &&
|
|
130
|
+
typeof cache.v3_instance_id === "string" &&
|
|
131
|
+
cache.v3_instance_id.startsWith("inst_") &&
|
|
132
|
+
typeof cache.v3_generation_id === "string" &&
|
|
133
|
+
cache.v3_generation_id.startsWith("gen_")
|
|
134
|
+
);
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
function activityEntry(cache: Required<ActivityCache>): SupervisorDeclaredActivity {
|
|
138
|
+
const source = activitySource(cache);
|
|
139
|
+
return {
|
|
140
|
+
scope_kind: "agent",
|
|
141
|
+
scope_id: cache.instance_id,
|
|
142
|
+
session_id: cache.session_id,
|
|
143
|
+
declared_activity: cache.activity as SupervisorDeclaredActivity["declared_activity"],
|
|
144
|
+
task_state: cache.task_state as SupervisorDeclaredActivity["task_state"],
|
|
145
|
+
observed_at: cache.last_heartbeat,
|
|
146
|
+
source,
|
|
147
|
+
};
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
function activitySource(cache: Required<ActivityCache>): SupervisorSourceReference {
|
|
151
|
+
const sourceId = `${cache.v3_instance_id}:${cache.v3_generation_id}`;
|
|
152
|
+
return {
|
|
153
|
+
id: `src_${digest(`coordination.activity-projection\u0000${sourceId}\u0000${cache.last_heartbeat}`).slice(0, 24)}`,
|
|
154
|
+
source_kind: "coordination.activity-projection",
|
|
155
|
+
source_id: sourceId,
|
|
156
|
+
observed_at: cache.last_heartbeat,
|
|
157
|
+
schema_version: SUPERVISOR_ACTIVITY_SCHEMA_VERSION,
|
|
158
|
+
capability: "supported",
|
|
159
|
+
};
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
function unavailable(
|
|
163
|
+
observedAt: string,
|
|
164
|
+
reasonCode: string,
|
|
165
|
+
state: "unsupported" | "error" = "unsupported",
|
|
166
|
+
): SupervisorActivitySnapshot {
|
|
167
|
+
return {
|
|
168
|
+
schema_version: SUPERVISOR_ACTIVITY_SCHEMA_VERSION,
|
|
169
|
+
observed_at: observedAt,
|
|
170
|
+
max_entries: SUPERVISOR_DIAGNOSTIC_LIMITS.max_activity_entries,
|
|
171
|
+
entries: [],
|
|
172
|
+
omitted_entry_count: 0,
|
|
173
|
+
capability: {
|
|
174
|
+
source_kind: "coordination.activity-projection",
|
|
175
|
+
state,
|
|
176
|
+
reason_code: reasonCode,
|
|
177
|
+
},
|
|
178
|
+
};
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
function isActivity(
|
|
182
|
+
value: string | undefined,
|
|
183
|
+
): value is SupervisorDeclaredActivity["declared_activity"] {
|
|
184
|
+
return value === "working" || value === "needs_input" || value === "idle" || value === "unknown";
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
function isTaskState(value: string | undefined): value is SupervisorDeclaredActivity["task_state"] {
|
|
188
|
+
return value === "active" || value === "blocked" || value === "done";
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
function digest(value: string): string {
|
|
192
|
+
return createHash("sha256").update(value).digest("hex");
|
|
193
|
+
}
|