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
|
@@ -94,10 +94,13 @@ export function recordImageArtifactsV3(
|
|
|
94
94
|
coordRoot: string,
|
|
95
95
|
sourceEvent: EventV3,
|
|
96
96
|
artifacts: readonly CapturedImageArtifact[],
|
|
97
|
+
expectedGenesisId?: `gex_${string}`,
|
|
97
98
|
): void {
|
|
98
99
|
if (!("generation_id" in sourceEvent.scope) || !sourceEvent.attestation_id) return;
|
|
99
100
|
for (const artifact of artifacts) {
|
|
100
|
-
writeEventV3(coordRoot, buildImageArtifactEventV3(sourceEvent, artifact)
|
|
101
|
+
writeEventV3(coordRoot, buildImageArtifactEventV3(sourceEvent, artifact), {
|
|
102
|
+
...(expectedGenesisId ? { expectedGenesisId } : {}),
|
|
103
|
+
});
|
|
101
104
|
}
|
|
102
105
|
}
|
|
103
106
|
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
import type { Adapter } from "../adapter.ts";
|
|
2
|
+
import { processLogger } from "../storage/logger.ts";
|
|
3
|
+
|
|
4
|
+
export const HOOK_HEALTH_EVENT = "agent_hook.completed" as const;
|
|
5
|
+
export const HOOK_HEALTH_RECEIPT_VERSION = 1 as const;
|
|
6
|
+
export const HOOK_HEALTH_ERROR_PHASE_LIMIT = 8;
|
|
7
|
+
|
|
8
|
+
export type HookHealthOutcome = "completed" | "skipped" | "degraded" | "faulted";
|
|
9
|
+
|
|
10
|
+
export interface HookHealthState {
|
|
11
|
+
readonly started_at_ms: number;
|
|
12
|
+
readonly started_rss_bytes: number;
|
|
13
|
+
readonly event_name: string | null;
|
|
14
|
+
readonly adapter: Adapter | null;
|
|
15
|
+
readonly payload_bytes: number;
|
|
16
|
+
coord_root: string | null;
|
|
17
|
+
owner_id?: string;
|
|
18
|
+
skipped_reason?: string;
|
|
19
|
+
v3_state?: string;
|
|
20
|
+
error_phases: string[];
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export interface HookHealthReceipt {
|
|
24
|
+
receipt_version: typeof HOOK_HEALTH_RECEIPT_VERSION;
|
|
25
|
+
hook_name: string;
|
|
26
|
+
adapter: Adapter | "unknown";
|
|
27
|
+
outcome: HookHealthOutcome;
|
|
28
|
+
exit_contract: "always-zero";
|
|
29
|
+
exit_code: 0;
|
|
30
|
+
duration_ms: number;
|
|
31
|
+
payload_bytes: number;
|
|
32
|
+
pid: number;
|
|
33
|
+
rss_start_bytes: number;
|
|
34
|
+
rss_end_bytes: number;
|
|
35
|
+
rss_delta_bytes: number;
|
|
36
|
+
retry_worker: boolean;
|
|
37
|
+
error_count: number;
|
|
38
|
+
error_phases: readonly string[];
|
|
39
|
+
owner_id?: string;
|
|
40
|
+
skipped_reason?: string;
|
|
41
|
+
v3_state?: string;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export function beginHookHealth(input: {
|
|
45
|
+
started_at_ms: number;
|
|
46
|
+
started_rss_bytes: number;
|
|
47
|
+
event_name: string | null;
|
|
48
|
+
adapter: Adapter | null;
|
|
49
|
+
payload_bytes: number;
|
|
50
|
+
}): HookHealthState {
|
|
51
|
+
return {
|
|
52
|
+
...input,
|
|
53
|
+
coord_root: null,
|
|
54
|
+
error_phases: [],
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
export function observeHookDebug(
|
|
59
|
+
state: HookHealthState | undefined,
|
|
60
|
+
entry: Readonly<Record<string, unknown>>,
|
|
61
|
+
): void {
|
|
62
|
+
if (!state) return;
|
|
63
|
+
const skipped = safeToken(entry.skipped);
|
|
64
|
+
if (skipped) state.skipped_reason = skipped;
|
|
65
|
+
const v3State = safeToken(entry.event_v3_state);
|
|
66
|
+
if (v3State) state.v3_state = v3State;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
export function observeHookError(state: HookHealthState | undefined, phase: unknown): void {
|
|
70
|
+
if (!state || state.error_phases.length >= HOOK_HEALTH_ERROR_PHASE_LIMIT) return;
|
|
71
|
+
state.error_phases.push(safeToken(phase) ?? "unknown");
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
export function finalizeHookHealth(
|
|
75
|
+
state: HookHealthState,
|
|
76
|
+
input: {
|
|
77
|
+
finished_at_ms: number;
|
|
78
|
+
finished_rss_bytes: number;
|
|
79
|
+
pid: number;
|
|
80
|
+
faulted?: boolean;
|
|
81
|
+
},
|
|
82
|
+
): HookHealthReceipt {
|
|
83
|
+
const duration = Math.max(0, Math.floor(input.finished_at_ms - state.started_at_ms));
|
|
84
|
+
const rssStart = boundedInteger(state.started_rss_bytes);
|
|
85
|
+
const rssEnd = boundedInteger(input.finished_rss_bytes);
|
|
86
|
+
const hookName = safeToken(state.event_name) ?? "unknown";
|
|
87
|
+
return {
|
|
88
|
+
receipt_version: HOOK_HEALTH_RECEIPT_VERSION,
|
|
89
|
+
hook_name: hookName,
|
|
90
|
+
adapter: state.adapter ?? "unknown",
|
|
91
|
+
outcome: input.faulted
|
|
92
|
+
? "faulted"
|
|
93
|
+
: state.error_phases.length > 0
|
|
94
|
+
? "degraded"
|
|
95
|
+
: state.skipped_reason
|
|
96
|
+
? "skipped"
|
|
97
|
+
: "completed",
|
|
98
|
+
exit_contract: "always-zero",
|
|
99
|
+
exit_code: 0,
|
|
100
|
+
duration_ms: duration,
|
|
101
|
+
payload_bytes: boundedInteger(state.payload_bytes),
|
|
102
|
+
pid: boundedInteger(input.pid),
|
|
103
|
+
rss_start_bytes: rssStart,
|
|
104
|
+
rss_end_bytes: rssEnd,
|
|
105
|
+
rss_delta_bytes: rssEnd - rssStart,
|
|
106
|
+
retry_worker: hookName === "runtime-context-retry",
|
|
107
|
+
error_count: state.error_phases.length,
|
|
108
|
+
error_phases: [...state.error_phases],
|
|
109
|
+
...(state.owner_id ? { owner_id: state.owner_id } : {}),
|
|
110
|
+
...(state.skipped_reason ? { skipped_reason: state.skipped_reason } : {}),
|
|
111
|
+
...(state.v3_state ? { v3_state: state.v3_state } : {}),
|
|
112
|
+
};
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
export function writeHookHealthCompletion(
|
|
116
|
+
state: HookHealthState | undefined,
|
|
117
|
+
input: {
|
|
118
|
+
finished_at_ms: number;
|
|
119
|
+
finished_rss_bytes: number;
|
|
120
|
+
pid: number;
|
|
121
|
+
faulted?: boolean;
|
|
122
|
+
},
|
|
123
|
+
): HookHealthReceipt | undefined {
|
|
124
|
+
if (!state?.coord_root) return undefined;
|
|
125
|
+
const receipt = finalizeHookHealth(state, input);
|
|
126
|
+
try {
|
|
127
|
+
processLogger(state.coord_root, "agent-hook").info(HOOK_HEALTH_EVENT, { ...receipt });
|
|
128
|
+
} catch {
|
|
129
|
+
// Hook health is observer-only. Logging can never change adapter behavior.
|
|
130
|
+
}
|
|
131
|
+
return receipt;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
function safeToken(value: unknown): string | undefined {
|
|
135
|
+
if (typeof value !== "string") return undefined;
|
|
136
|
+
const normalized = value
|
|
137
|
+
.trim()
|
|
138
|
+
.slice(0, 128)
|
|
139
|
+
.replace(/[^a-zA-Z0-9._:/+-]+/g, "-");
|
|
140
|
+
return /^[a-zA-Z0-9]/.test(normalized) ? normalized : undefined;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
function boundedInteger(value: number): number {
|
|
144
|
+
if (!Number.isFinite(value)) return 0;
|
|
145
|
+
return Math.max(0, Math.min(Number.MAX_SAFE_INTEGER, Math.floor(value)));
|
|
146
|
+
}
|
|
@@ -36,14 +36,20 @@ function counterPath(sessionId: string): string {
|
|
|
36
36
|
*
|
|
37
37
|
* Call only when the Stop verdict blocked. `continuation` is the adapter's
|
|
38
38
|
* "this stop follows a stop-hook block" flag; false starts a fresh cycle.
|
|
39
|
-
* Returns
|
|
40
|
-
* the caller should allow the stop instead of
|
|
39
|
+
* Returns the retained block count and whether this cycle has already been
|
|
40
|
+
* blocked `cap` times, meaning the caller should allow the stop instead of
|
|
41
|
+
* blocking again.
|
|
41
42
|
*/
|
|
42
|
-
export
|
|
43
|
+
export interface RemediationBlockRecord {
|
|
44
|
+
count: number;
|
|
45
|
+
exceeded: boolean;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export function recordRemediationBlock(
|
|
43
49
|
sessionId: string,
|
|
44
50
|
continuation: boolean,
|
|
45
51
|
cap = DEFAULT_STOP_REMEDIATION_CAP,
|
|
46
|
-
):
|
|
52
|
+
): RemediationBlockRecord {
|
|
47
53
|
const path = counterPath(sessionId);
|
|
48
54
|
let count = 1;
|
|
49
55
|
if (continuation) {
|
|
@@ -62,9 +68,9 @@ export function remediationCapExceeded(
|
|
|
62
68
|
writeFileSync(path, String(count), "utf8");
|
|
63
69
|
} catch {
|
|
64
70
|
// Counter IO must never turn into a block or a crash; fail open (no cap).
|
|
65
|
-
return false;
|
|
71
|
+
return { count, exceeded: false };
|
|
66
72
|
}
|
|
67
|
-
return count > cap;
|
|
73
|
+
return { count, exceeded: count > cap };
|
|
68
74
|
}
|
|
69
75
|
|
|
70
76
|
/** Clear the cycle counter after an allowed stop. */
|
|
@@ -1,14 +1,16 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { spawnSync } from "node:child_process";
|
|
2
|
+
import { existsSync } from "node:fs";
|
|
3
|
+
import { dirname, join, resolve } from "node:path";
|
|
2
4
|
|
|
3
5
|
/**
|
|
4
|
-
*
|
|
6
|
+
* Resolve the coordination root from path evidence only.
|
|
5
7
|
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
8
|
+
* This path-only resolver deliberately does not inspect live producer state.
|
|
9
|
+
* Code that reads or writes coordination authority must use
|
|
10
|
+
* `resolveCoordRoot()` from `agents/coord-client.ts`, which disambiguates
|
|
11
|
+
* nested coordination roots through the registered session. Keeping the two
|
|
12
|
+
* responsibilities separate lets configuration and other path-only consumers
|
|
13
|
+
* avoid loading the event recorder and its contract graph.
|
|
12
14
|
*
|
|
13
15
|
* Resolution precedence (see `resolveCoordRoot` for the full rationale):
|
|
14
16
|
* 1. HARNERY_COORD_ROOT_OVERRIDE — explicit pin (tests, git hooks).
|
|
@@ -17,9 +19,87 @@ import { resolveCoordRoot } from "../../agents/coord-client.ts";
|
|
|
17
19
|
* submodules that may carry a `.harnery/` of their own (or none at all,
|
|
18
20
|
* e.g. a journal dir under /tmp). The session's coordination home is the
|
|
19
21
|
* project the adapter opened, not wherever the shell happens to sit.
|
|
20
|
-
* 3. The
|
|
21
|
-
* 4.
|
|
22
|
+
* 3. The nearest enclosing `.harnery/`.
|
|
23
|
+
* 4. A git-derived root when no `.harnery/` exists yet.
|
|
22
24
|
*/
|
|
23
25
|
export function findCoordRoot(start: string = process.cwd()): string | null {
|
|
24
|
-
|
|
26
|
+
const rootOverride = process.env.HARNERY_COORD_ROOT_OVERRIDE;
|
|
27
|
+
if (rootOverride) return rootOverride;
|
|
28
|
+
|
|
29
|
+
const projectDir = process.env.CLAUDE_PROJECT_DIR;
|
|
30
|
+
if (projectDir) {
|
|
31
|
+
const fromProject = nearestCoordRoot(projectDir);
|
|
32
|
+
if (fromProject) return fromProject;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
const nearest = nearestCoordRoot(start);
|
|
36
|
+
if (nearest) return nearest;
|
|
37
|
+
return gitCoordRoots(start)[0] ?? gitToplevel(start);
|
|
25
38
|
}
|
|
39
|
+
|
|
40
|
+
/** Nearest enclosing directory carrying `.harnery/`, or null. */
|
|
41
|
+
export function nearestCoordRoot(start: string): string | null {
|
|
42
|
+
return ancestorCoordRoots(start)[0] ?? null;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/** Every enclosing directory carrying `.harnery/`, nearest first. */
|
|
46
|
+
export function ancestorCoordRoots(start: string): string[] {
|
|
47
|
+
const found: string[] = [];
|
|
48
|
+
let dir = resolve(start);
|
|
49
|
+
while (true) {
|
|
50
|
+
if (existsSync(join(dir, ".harnery"))) found.push(dir);
|
|
51
|
+
const parent = dirname(dir);
|
|
52
|
+
if (parent === dir) break;
|
|
53
|
+
dir = parent;
|
|
54
|
+
}
|
|
55
|
+
return found;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* Git-derived roots carrying `.harnery/`, in superproject-first order.
|
|
60
|
+
*
|
|
61
|
+
* Spawns use `start` as cwd so a call about another checkout cannot inherit
|
|
62
|
+
* this process's repository. The common-dir fallback recovers a superproject
|
|
63
|
+
* from a submodule worktree, where Git reports no direct superproject path.
|
|
64
|
+
*/
|
|
65
|
+
export function gitCoordRoots(start: string): string[] {
|
|
66
|
+
const roots: string[] = [];
|
|
67
|
+
const push = (value: string | null) => {
|
|
68
|
+
if (value && existsSync(join(value, ".harnery")) && !roots.includes(value)) roots.push(value);
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
push(gitRevParse(start, "--show-superproject-working-tree"));
|
|
72
|
+
const common = gitRevParse(start, "--git-common-dir");
|
|
73
|
+
if (common) {
|
|
74
|
+
const index = common.indexOf("/.git/modules/");
|
|
75
|
+
if (index !== -1) push(common.substring(0, index));
|
|
76
|
+
}
|
|
77
|
+
push(gitToplevel(start));
|
|
78
|
+
return roots;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
export function gitToplevel(start: string): string | null {
|
|
82
|
+
return gitRevParse(start, "--show-toplevel");
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
function gitRevParse(start: string, flag: string): string | null {
|
|
86
|
+
const key = `${start}\0${flag}`;
|
|
87
|
+
const cached = gitRevParseCache.get(key);
|
|
88
|
+
if (cached !== undefined) return cached;
|
|
89
|
+
let value: string | null = null;
|
|
90
|
+
try {
|
|
91
|
+
// A stale adapter project directory may no longer exist. Treat spawn
|
|
92
|
+
// failure as no path evidence instead of turning discovery into an error.
|
|
93
|
+
const result = spawnSync("git", ["rev-parse", flag], {
|
|
94
|
+
cwd: start,
|
|
95
|
+
encoding: "utf8",
|
|
96
|
+
});
|
|
97
|
+
if (result.status === 0) value = result.stdout.trim() || null;
|
|
98
|
+
} catch {
|
|
99
|
+
value = null;
|
|
100
|
+
}
|
|
101
|
+
gitRevParseCache.set(key, value);
|
|
102
|
+
return value;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
const gitRevParseCache = new Map<string, string | null>();
|
|
@@ -45,6 +45,10 @@ export function resolveOwner(opts: {
|
|
|
45
45
|
};
|
|
46
46
|
const childId = value("subagent_id") ?? value("agent_id");
|
|
47
47
|
const sessionId = value("session_id") ?? value("conversation_id");
|
|
48
|
+
// A payload with one unambiguous session identity needs no projection
|
|
49
|
+
// lookup. Live-authority tie-breaking matters only when the adapter also
|
|
50
|
+
// supplies a child candidate that could be stale or belong to the parent.
|
|
51
|
+
if (sessionId && !childId) return { instance_id: sessionId, source: "payload" };
|
|
48
52
|
const child = childId ? readLiveCoordinationRow(opts.coordRoot, childId) : null;
|
|
49
53
|
const session = sessionId ? readLiveCoordinationRow(opts.coordRoot, sessionId) : null;
|
|
50
54
|
|
|
@@ -3,6 +3,8 @@ import { basename, dirname, join } from "node:path";
|
|
|
3
3
|
|
|
4
4
|
import { toolResponseMintedSessionName } from "../../agents/session-name-display.ts";
|
|
5
5
|
|
|
6
|
+
export const ASSISTANT_STATUS_BOX_PREFIX = "┌─ agent-";
|
|
7
|
+
|
|
6
8
|
/**
|
|
7
9
|
* Scan a CC-style JSONL transcript for the `┌─ agent-` status-box prefix in
|
|
8
10
|
* the most-recent assistant turn. Used by `turn.completed` events to populate
|
|
@@ -76,6 +78,22 @@ export function scanAssistantTextIncludes(
|
|
|
76
78
|
return false;
|
|
77
79
|
}
|
|
78
80
|
|
|
81
|
+
/**
|
|
82
|
+
* Strict status-box evidence shared by turn telemetry and the Stop-time
|
|
83
|
+
* continuation fallback. Both inputs are assistant-only surfaces: the JSONL
|
|
84
|
+
* scanner rejects tool_result rows, while lastAssistantMessage comes directly
|
|
85
|
+
* from the adapter's completed assistant response.
|
|
86
|
+
*/
|
|
87
|
+
export function scanAssistantStatusBoxPresent(
|
|
88
|
+
transcriptPath: string | undefined,
|
|
89
|
+
lastAssistantMessage: string | undefined,
|
|
90
|
+
): boolean {
|
|
91
|
+
return (
|
|
92
|
+
scanAssistantTextIncludes(transcriptPath, ASSISTANT_STATUS_BOX_PREFIX) ||
|
|
93
|
+
lastAssistantMessage?.includes(ASSISTANT_STATUS_BOX_PREFIX) === true
|
|
94
|
+
);
|
|
95
|
+
}
|
|
96
|
+
|
|
79
97
|
/** Most recent user-visible assistant text across Claude Code and Codex JSONL. */
|
|
80
98
|
export function scanLatestAssistantText(transcriptPath: string | undefined): string | undefined {
|
|
81
99
|
const readablePath = resolveTranscriptPath(transcriptPath);
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
export const HARNERY_INBOX_RECORD_SCHEMA = "harnery.inbox-record/v1" as const;
|
|
2
|
+
export const HARNERY_INBOX_STATUS_SCHEMA = "harnery.inbox-status/v1" as const;
|
|
3
|
+
|
|
4
|
+
export interface HarneryInboxLimits {
|
|
5
|
+
max_message_body_bytes: number;
|
|
6
|
+
max_pending_count: number;
|
|
7
|
+
max_pending_bytes: number;
|
|
8
|
+
max_history_bytes: number;
|
|
9
|
+
max_history_records: number;
|
|
10
|
+
warning_pressure_ratio: number;
|
|
11
|
+
max_surface_count: number;
|
|
12
|
+
max_surface_bytes: number;
|
|
13
|
+
max_surface_tokens: number;
|
|
14
|
+
surfaced_grace_ms: number;
|
|
15
|
+
terminal_grace_ms: number;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export interface HarneryInboxMessageRecordV1 {
|
|
19
|
+
schema: typeof HARNERY_INBOX_RECORD_SCHEMA;
|
|
20
|
+
kind: "message";
|
|
21
|
+
message_id: string;
|
|
22
|
+
sender_instance_id: string;
|
|
23
|
+
sender_display_name: string;
|
|
24
|
+
recipient_instance_id: string;
|
|
25
|
+
recipient_display_name: string;
|
|
26
|
+
created_at: string;
|
|
27
|
+
body: string;
|
|
28
|
+
body_bytes: number;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export interface HarneryInboxSurfacedRecordV1 {
|
|
32
|
+
schema: typeof HARNERY_INBOX_RECORD_SCHEMA;
|
|
33
|
+
kind: "surfaced";
|
|
34
|
+
message_id: string;
|
|
35
|
+
surfaced_at: string;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export type HarneryInboxRecordV1 = HarneryInboxMessageRecordV1 | HarneryInboxSurfacedRecordV1;
|
|
39
|
+
|
|
40
|
+
export interface HarneryInboxStatusV1 {
|
|
41
|
+
schema: typeof HARNERY_INBOX_STATUS_SCHEMA;
|
|
42
|
+
recipient_instance_id: string;
|
|
43
|
+
pending_count: number;
|
|
44
|
+
pending_bytes: number;
|
|
45
|
+
total_history_bytes: number;
|
|
46
|
+
oldest_pending_at?: string;
|
|
47
|
+
pressure: "normal" | "warning" | "exhausted";
|
|
48
|
+
last_surface_at?: string;
|
|
49
|
+
last_compaction_at?: string;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export type HarneryInboxCapacityReason =
|
|
53
|
+
| "message_body_limit"
|
|
54
|
+
| "pending_count_limit"
|
|
55
|
+
| "pending_bytes_limit"
|
|
56
|
+
| "history_bytes_limit";
|
|
57
|
+
|
|
58
|
+
export class HarneryInboxCapacityError extends Error {
|
|
59
|
+
constructor(
|
|
60
|
+
readonly reason_code: HarneryInboxCapacityReason,
|
|
61
|
+
readonly current: number,
|
|
62
|
+
readonly limit: number,
|
|
63
|
+
) {
|
|
64
|
+
super(
|
|
65
|
+
`inbox capacity ${reason_code}: ${current}/${limit}; use a managed artifact for larger payloads`,
|
|
66
|
+
);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
export interface HarneryInboxSurfaceBudget {
|
|
71
|
+
max_count: number;
|
|
72
|
+
max_bytes: number;
|
|
73
|
+
max_tokens: number;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
export interface HarneryInboxSurfaceResult {
|
|
77
|
+
emitted: readonly HarneryInboxMessageRecordV1[];
|
|
78
|
+
remaining_pending_count: number;
|
|
79
|
+
remaining_pending_bytes: number;
|
|
80
|
+
repeated_after_crash_possible: true;
|
|
81
|
+
}
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import type { HarneryInboxLimits, HarneryInboxRecordV1 } from "./contract.ts";
|
|
2
|
+
import { project } from "./service.ts";
|
|
3
|
+
|
|
4
|
+
export const HARNERY_INBOX_COMPACTION_PLAN_SCHEMA = "harnery.inbox-compaction-plan/v1" as const;
|
|
5
|
+
|
|
6
|
+
export type HarneryRecipientLifecycle = "active" | "resumable" | "terminal";
|
|
7
|
+
|
|
8
|
+
export interface HarneryInboxCompactionPlan {
|
|
9
|
+
schema: typeof HARNERY_INBOX_COMPACTION_PLAN_SCHEMA;
|
|
10
|
+
recipient_instance_id: string;
|
|
11
|
+
action: "none" | "compact-surfaced" | "prune-terminal";
|
|
12
|
+
reason_code:
|
|
13
|
+
| "pending_protected"
|
|
14
|
+
| "active_recipient"
|
|
15
|
+
| "surfaced_grace"
|
|
16
|
+
| "terminal_grace"
|
|
17
|
+
| "eligible";
|
|
18
|
+
remove_record_count: number;
|
|
19
|
+
retained_record_count: number;
|
|
20
|
+
protected_pending_count: number;
|
|
21
|
+
dry_run: true;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export function planInboxCompaction(input: {
|
|
25
|
+
recipient_instance_id: string;
|
|
26
|
+
records: readonly HarneryInboxRecordV1[];
|
|
27
|
+
lifecycle: HarneryRecipientLifecycle;
|
|
28
|
+
terminal_at?: string;
|
|
29
|
+
now: Date;
|
|
30
|
+
limits: HarneryInboxLimits;
|
|
31
|
+
}): HarneryInboxCompactionPlan {
|
|
32
|
+
const projection = project(input.records);
|
|
33
|
+
const surfacedAt = new Map<string, number>();
|
|
34
|
+
for (const record of input.records) {
|
|
35
|
+
if (record.kind === "surfaced")
|
|
36
|
+
surfacedAt.set(record.message_id, Date.parse(record.surfaced_at));
|
|
37
|
+
}
|
|
38
|
+
const compactableIds = new Set(
|
|
39
|
+
[...surfacedAt]
|
|
40
|
+
.filter(([, timestamp]) => input.now.getTime() - timestamp >= input.limits.surfaced_grace_ms)
|
|
41
|
+
.map(([id]) => id),
|
|
42
|
+
);
|
|
43
|
+
const compactableRecords = input.records.filter((record) =>
|
|
44
|
+
compactableIds.has(record.message_id),
|
|
45
|
+
).length;
|
|
46
|
+
if (input.lifecycle === "terminal") {
|
|
47
|
+
if (projection.pending.length > 0) {
|
|
48
|
+
return plan(
|
|
49
|
+
input,
|
|
50
|
+
"none",
|
|
51
|
+
"pending_protected",
|
|
52
|
+
0,
|
|
53
|
+
input.records.length,
|
|
54
|
+
projection.pending.length,
|
|
55
|
+
);
|
|
56
|
+
}
|
|
57
|
+
const terminalAt = input.terminal_at ? Date.parse(input.terminal_at) : Number.NaN;
|
|
58
|
+
if (
|
|
59
|
+
!Number.isFinite(terminalAt) ||
|
|
60
|
+
input.now.getTime() - terminalAt < input.limits.terminal_grace_ms
|
|
61
|
+
) {
|
|
62
|
+
return plan(input, "none", "terminal_grace", 0, input.records.length, 0);
|
|
63
|
+
}
|
|
64
|
+
return plan(input, "prune-terminal", "eligible", input.records.length, 0, 0);
|
|
65
|
+
}
|
|
66
|
+
if (compactableRecords === 0) {
|
|
67
|
+
return plan(
|
|
68
|
+
input,
|
|
69
|
+
"none",
|
|
70
|
+
surfacedAt.size > 0 ? "surfaced_grace" : "active_recipient",
|
|
71
|
+
0,
|
|
72
|
+
input.records.length,
|
|
73
|
+
projection.pending.length,
|
|
74
|
+
);
|
|
75
|
+
}
|
|
76
|
+
return plan(
|
|
77
|
+
input,
|
|
78
|
+
"compact-surfaced",
|
|
79
|
+
"eligible",
|
|
80
|
+
compactableRecords,
|
|
81
|
+
input.records.length - compactableRecords,
|
|
82
|
+
projection.pending.length,
|
|
83
|
+
);
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
function plan(
|
|
87
|
+
input: { recipient_instance_id: string },
|
|
88
|
+
action: HarneryInboxCompactionPlan["action"],
|
|
89
|
+
reason_code: HarneryInboxCompactionPlan["reason_code"],
|
|
90
|
+
remove_record_count: number,
|
|
91
|
+
retained_record_count: number,
|
|
92
|
+
protected_pending_count: number,
|
|
93
|
+
): HarneryInboxCompactionPlan {
|
|
94
|
+
return {
|
|
95
|
+
schema: HARNERY_INBOX_COMPACTION_PLAN_SCHEMA,
|
|
96
|
+
recipient_instance_id: input.recipient_instance_id,
|
|
97
|
+
action,
|
|
98
|
+
reason_code,
|
|
99
|
+
remove_record_count,
|
|
100
|
+
retained_record_count,
|
|
101
|
+
protected_pending_count,
|
|
102
|
+
dry_run: true,
|
|
103
|
+
};
|
|
104
|
+
}
|