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
package/src/core/config.ts
CHANGED
|
@@ -7,8 +7,9 @@
|
|
|
7
7
|
* 2. `<project-root>/.harnery/config.jsonc` — project override (authoritative)
|
|
8
8
|
*
|
|
9
9
|
* Fields owned here: `binName` (host CLI name for agent-facing strings),
|
|
10
|
-
* `hooksSetupHint`, `agents`, `tools`, `workflow`, `skills`, `presence`, plus the tunable
|
|
11
|
-
* `coord` (heartbeat freshness), `
|
|
10
|
+
* `hooksSetupHint`, `agents`, `instructions`, `tools`, `workflow`, `skills`, `presence`, plus the tunable
|
|
11
|
+
* `coord` (heartbeat freshness), `logs` (structured-log storage budgets),
|
|
12
|
+
* `artifacts` (working-file retention),
|
|
12
13
|
* `backup` (restic repo/password/prune policy), `sync` (rclone
|
|
13
14
|
* remote/prefix), and `web` (dashboard port) sections. The `files` deny/override section
|
|
14
15
|
* is parsed separately by `web/lib/files.ts`.
|
|
@@ -22,16 +23,21 @@ import { readFileSync, statSync } from "node:fs";
|
|
|
22
23
|
import { homedir } from "node:os";
|
|
23
24
|
import { join } from "node:path";
|
|
24
25
|
import { coordEnv } from "../lib/env.ts";
|
|
26
|
+
import { DEFAULT_WEB_PORT } from "../lib/local-file-url.ts";
|
|
27
|
+
import { resolveEventLedgerRotateActiveBytesV3 } from "./events/v3/rotation-config.ts";
|
|
25
28
|
import { findCoordRoot } from "./hooks/resolve/coord-root.ts";
|
|
26
29
|
|
|
30
|
+
export { DEFAULT_WEB_PORT } from "../lib/local-file-url.ts";
|
|
31
|
+
export { DEFAULT_EVENT_LEDGER_ROTATE_ACTIVE_BYTES } from "./events/v3/rotation-config.ts";
|
|
32
|
+
|
|
27
33
|
/** The standalone CLI's bin name: the resolution floor when nothing else is set. */
|
|
28
34
|
export const DEFAULT_BIN_NAME = "harn";
|
|
29
35
|
|
|
30
36
|
/** Heartbeat-freshness default (seconds): the sweep window when nothing overrides it. */
|
|
31
37
|
export const DEFAULT_FRESHNESS_SECS = 600;
|
|
32
38
|
|
|
33
|
-
/**
|
|
34
|
-
export const
|
|
39
|
+
/** Keep a fresh host reminder bounded to one short prompt-context line. */
|
|
40
|
+
export const MAX_HOST_PROMPT_REMINDER_CHARS = 500;
|
|
35
41
|
|
|
36
42
|
export interface SessionFinalizationConfig {
|
|
37
43
|
archiveGraceSeconds: number;
|
|
@@ -76,6 +82,11 @@ interface HarneryConfig {
|
|
|
76
82
|
requireGitFinalization?: boolean;
|
|
77
83
|
finalizationRoots?: AgentFinalizationRoot[];
|
|
78
84
|
};
|
|
85
|
+
/** Host-owned agent instruction settings. */
|
|
86
|
+
instructions?: {
|
|
87
|
+
hostAddendumFile?: unknown;
|
|
88
|
+
promptReminder?: unknown;
|
|
89
|
+
};
|
|
79
90
|
/**
|
|
80
91
|
* Managed-tool provisioning consent. `{ ripgrep: { autoInstall: true } }`
|
|
81
92
|
* lets `grep` download the pinned, checksum-verified ripgrep into the
|
|
@@ -118,11 +129,31 @@ interface HarneryConfig {
|
|
|
118
129
|
reconcile_interval_seconds?: number;
|
|
119
130
|
};
|
|
120
131
|
};
|
|
132
|
+
/** Strictly validated structured-log storage overrides. */
|
|
133
|
+
logs?: { storage?: unknown };
|
|
134
|
+
/**
|
|
135
|
+
* Universal event-ledger V3 tunables. `rotate_active_bytes` is the active
|
|
136
|
+
* segment size at which the epoch is archived and replaced automatically
|
|
137
|
+
* (default 32 MiB; `0` disables rotation). Read via
|
|
138
|
+
* `eventLedgerRotateActiveBytes()`.
|
|
139
|
+
*/
|
|
140
|
+
events?: {
|
|
141
|
+
rotate_active_bytes?: number;
|
|
142
|
+
archive_max_bytes?: number;
|
|
143
|
+
archive_max_age_days?: number;
|
|
144
|
+
archive_keep_min?: number;
|
|
145
|
+
archive_auto_clean?: boolean;
|
|
146
|
+
};
|
|
121
147
|
/**
|
|
122
148
|
* Managed working-artifact defaults. `default_retention_days` is the
|
|
123
149
|
* create-time TTL when the caller does not pass `artifacts create --days`.
|
|
124
150
|
*/
|
|
125
|
-
artifacts?: {
|
|
151
|
+
artifacts?: {
|
|
152
|
+
default_retention_days?: number;
|
|
153
|
+
auto_clean?: boolean;
|
|
154
|
+
max_bytes?: number;
|
|
155
|
+
max_unit_bytes?: number;
|
|
156
|
+
};
|
|
126
157
|
/**
|
|
127
158
|
* `harn backup` (restic) defaults: `repo` path/URL, `password_file`, and the
|
|
128
159
|
* `keep_daily`/`keep_weekly`/`keep_monthly` prune policy. Read via `backupConfig()`.
|
|
@@ -232,6 +263,40 @@ export interface CoordRunQualityConfigSource {
|
|
|
232
263
|
digest_seed: unknown;
|
|
233
264
|
}
|
|
234
265
|
|
|
266
|
+
export interface LogStorageConfigLayerSource {
|
|
267
|
+
layer: "user" | "project";
|
|
268
|
+
value: unknown;
|
|
269
|
+
invalid: boolean;
|
|
270
|
+
/** Stable file signature for bounded diagnostics without retaining values. */
|
|
271
|
+
signature: string | null;
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
export interface LogStorageConfigSource {
|
|
275
|
+
layers: readonly [LogStorageConfigLayerSource, LogStorageConfigLayerSource];
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
/**
|
|
279
|
+
* Raw user and project `logs.storage` layers with their origin intact.
|
|
280
|
+
*
|
|
281
|
+
* Storage retention validates these as one fail-closed unit. It cannot use the
|
|
282
|
+
* ordinary merged reader because commands must explain whether each effective
|
|
283
|
+
* scalar came from a user class, user family, project class, or project family.
|
|
284
|
+
*/
|
|
285
|
+
export function logStorageConfigSource(root: string): LogStorageConfigSource {
|
|
286
|
+
const projectPath = join(root, ".harnery", "config.jsonc");
|
|
287
|
+
const user = parseConfigLayer(userConfigPath());
|
|
288
|
+
const project = parseConfigLayer(projectPath);
|
|
289
|
+
const layer = (source: ReturnType<typeof parseConfigLayer>): LogStorageConfigLayerSource => ({
|
|
290
|
+
layer: source.path_kind,
|
|
291
|
+
value: source.config.logs?.storage,
|
|
292
|
+
invalid: source.invalid,
|
|
293
|
+
signature: source.signature,
|
|
294
|
+
});
|
|
295
|
+
return {
|
|
296
|
+
layers: [layer(user), layer(project)],
|
|
297
|
+
};
|
|
298
|
+
}
|
|
299
|
+
|
|
235
300
|
/**
|
|
236
301
|
* Effective user-plus-project `coord.run_quality` value with parse diagnostics.
|
|
237
302
|
* The ordinary config reader stays fail-soft; this one lets the guard visibly
|
|
@@ -387,6 +452,28 @@ export function resolveHooksSetupHint(coordRoot?: string | null): string | null
|
|
|
387
452
|
return typeof hint === "string" && hint.trim() ? hint.trim() : null;
|
|
388
453
|
}
|
|
389
454
|
|
|
455
|
+
/**
|
|
456
|
+
* One project-owned reminder that a supported prompt hook can place immediately
|
|
457
|
+
* before a model response. The value is deliberately project-only: host policy
|
|
458
|
+
* must not follow the user-global config into unrelated repositories. It is
|
|
459
|
+
* emitted directly from config and never copied into coordination state.
|
|
460
|
+
*
|
|
461
|
+
* The reminder must be one non-empty line of at most 500 characters. Invalid
|
|
462
|
+
* values fail closed to no reminder so a malformed optional setting cannot
|
|
463
|
+
* break the prompt hook.
|
|
464
|
+
*/
|
|
465
|
+
export function hostPromptReminder(coordRoot?: string | null): string | null {
|
|
466
|
+
const root = coordRoot ?? findCoordRoot();
|
|
467
|
+
if (!root) return null;
|
|
468
|
+
const value = readProjectConfig(root).instructions?.promptReminder;
|
|
469
|
+
if (typeof value !== "string") return null;
|
|
470
|
+
const reminder = value.trim();
|
|
471
|
+
if (!reminder || reminder.length > MAX_HOST_PROMPT_REMINDER_CHARS || /[\r\n]/.test(reminder)) {
|
|
472
|
+
return null;
|
|
473
|
+
}
|
|
474
|
+
return reminder;
|
|
475
|
+
}
|
|
476
|
+
|
|
390
477
|
/**
|
|
391
478
|
* Whether the host requires the guarded Git check at the end of tool-using
|
|
392
479
|
* turns. Default false: Harnery exposes `agents status --end-turn` as a capability
|
|
@@ -531,6 +618,66 @@ export function coordFreshnessSeconds(coordRoot?: string | null): number {
|
|
|
531
618
|
return DEFAULT_FRESHNESS_SECS;
|
|
532
619
|
}
|
|
533
620
|
|
|
621
|
+
/**
|
|
622
|
+
* Active-segment byte size at which the V3 event ledger rotates to a fresh
|
|
623
|
+
* epoch. Every reader validates the complete epoch, so an unbounded active
|
|
624
|
+
* segment makes each cold read (one per hook process) scale with all history.
|
|
625
|
+
* Precedence:
|
|
626
|
+
* 1. `HARNERY_EVENT_V3_ROTATE_ACTIVE_BYTES` env
|
|
627
|
+
* 2. `.harnery/config.jsonc` `events.rotate_active_bytes`
|
|
628
|
+
* 3. 33554432 (32 MiB)
|
|
629
|
+
* `0` (or a negative value) disables automatic rotation.
|
|
630
|
+
*/
|
|
631
|
+
export function eventLedgerRotateActiveBytes(coordRoot?: string | null): number {
|
|
632
|
+
const root = coordRoot ?? findCoordRoot();
|
|
633
|
+
return resolveEventLedgerRotateActiveBytesV3(root);
|
|
634
|
+
}
|
|
635
|
+
|
|
636
|
+
const DEFAULT_EVENT_ARCHIVE_MAX_BYTES = 1024 * 1024 * 1024;
|
|
637
|
+
const DEFAULT_EVENT_ARCHIVE_MAX_AGE_DAYS = 7;
|
|
638
|
+
const DEFAULT_EVENT_ARCHIVE_KEEP_MIN = 2;
|
|
639
|
+
|
|
640
|
+
export interface EventLedgerArchivePolicy {
|
|
641
|
+
maxBytes: number;
|
|
642
|
+
maxAgeDays: number;
|
|
643
|
+
keepMin: number;
|
|
644
|
+
autoClean: boolean;
|
|
645
|
+
}
|
|
646
|
+
|
|
647
|
+
/** Bounded retention for closed V3 epochs under `ledgers/v3-archives`. */
|
|
648
|
+
export function eventLedgerArchivePolicy(coordRoot?: string | null): EventLedgerArchivePolicy {
|
|
649
|
+
const root = coordRoot ?? findCoordRoot();
|
|
650
|
+
const configured = root ? readConfig(root).events : undefined;
|
|
651
|
+
return {
|
|
652
|
+
maxBytes: integerSetting(
|
|
653
|
+
coordEnv("EVENT_V3_ARCHIVE_MAX_BYTES"),
|
|
654
|
+
configured?.archive_max_bytes,
|
|
655
|
+
64 * 1024 * 1024,
|
|
656
|
+
1024 * 1024 * 1024 * 1024,
|
|
657
|
+
DEFAULT_EVENT_ARCHIVE_MAX_BYTES,
|
|
658
|
+
),
|
|
659
|
+
maxAgeDays: integerSetting(
|
|
660
|
+
coordEnv("EVENT_V3_ARCHIVE_MAX_AGE_DAYS"),
|
|
661
|
+
configured?.archive_max_age_days,
|
|
662
|
+
1,
|
|
663
|
+
3650,
|
|
664
|
+
DEFAULT_EVENT_ARCHIVE_MAX_AGE_DAYS,
|
|
665
|
+
),
|
|
666
|
+
keepMin: integerSetting(
|
|
667
|
+
coordEnv("EVENT_V3_ARCHIVE_KEEP_MIN"),
|
|
668
|
+
configured?.archive_keep_min,
|
|
669
|
+
1,
|
|
670
|
+
1000,
|
|
671
|
+
DEFAULT_EVENT_ARCHIVE_KEEP_MIN,
|
|
672
|
+
),
|
|
673
|
+
autoClean: booleanSetting(
|
|
674
|
+
coordEnv("EVENT_V3_ARCHIVE_AUTO_CLEAN"),
|
|
675
|
+
configured?.archive_auto_clean,
|
|
676
|
+
true,
|
|
677
|
+
),
|
|
678
|
+
};
|
|
679
|
+
}
|
|
680
|
+
|
|
534
681
|
function parseWebPort(value: unknown, source: string): number {
|
|
535
682
|
const port = typeof value === "number" ? value : Number(value);
|
|
536
683
|
if (!Number.isInteger(port) || port < 1024 || port > 65535) {
|
|
@@ -612,6 +759,89 @@ export function artifactDefaultRetentionDays(coordRoot?: string | null): number
|
|
|
612
759
|
: 3;
|
|
613
760
|
}
|
|
614
761
|
|
|
762
|
+
const DEFAULT_ARTIFACT_MAX_BYTES = 20 * 1024 * 1024 * 1024;
|
|
763
|
+
const DEFAULT_ARTIFACT_MAX_UNIT_BYTES = 1024 * 1024 * 1024;
|
|
764
|
+
|
|
765
|
+
/** Soft repository budget for managed working artifacts. */
|
|
766
|
+
export function artifactMaxBytes(coordRoot?: string | null): number {
|
|
767
|
+
const root = coordRoot ?? findCoordRoot();
|
|
768
|
+
return integerSetting(
|
|
769
|
+
coordEnv("ARTIFACT_MAX_BYTES"),
|
|
770
|
+
root ? readConfig(root).artifacts?.max_bytes : undefined,
|
|
771
|
+
64 * 1024 * 1024,
|
|
772
|
+
1024 * 1024 * 1024 * 1024,
|
|
773
|
+
DEFAULT_ARTIFACT_MAX_BYTES,
|
|
774
|
+
);
|
|
775
|
+
}
|
|
776
|
+
|
|
777
|
+
/** Size at which one bundle requires an explicit `artifacts create --big` acknowledgement. */
|
|
778
|
+
export function artifactMaxUnitBytes(coordRoot?: string | null): number {
|
|
779
|
+
const root = coordRoot ?? findCoordRoot();
|
|
780
|
+
return integerSetting(
|
|
781
|
+
coordEnv("ARTIFACT_MAX_UNIT_BYTES"),
|
|
782
|
+
root ? readConfig(root).artifacts?.max_unit_bytes : undefined,
|
|
783
|
+
16 * 1024 * 1024,
|
|
784
|
+
1024 * 1024 * 1024 * 1024,
|
|
785
|
+
DEFAULT_ARTIFACT_MAX_UNIT_BYTES,
|
|
786
|
+
);
|
|
787
|
+
}
|
|
788
|
+
|
|
789
|
+
/**
|
|
790
|
+
* Whether the daily SessionStart sweep of expired artifact workspaces runs.
|
|
791
|
+
* Precedence: `HARNERY_ARTIFACT_AUTO_CLEAN` (0/false disables) ->
|
|
792
|
+
* `artifacts.auto_clean` -> enabled. The sweep only ever deletes
|
|
793
|
+
* `managed-expired` entries via the same guarded classifier as
|
|
794
|
+
* `artifacts clean --yes`.
|
|
795
|
+
*/
|
|
796
|
+
export function artifactAutoCleanEnabled(coordRoot?: string | null): boolean {
|
|
797
|
+
const env = coordEnv("ARTIFACT_AUTO_CLEAN");
|
|
798
|
+
if (env !== undefined) return !(env === "0" || env.toLowerCase() === "false");
|
|
799
|
+
const root = coordRoot ?? findCoordRoot();
|
|
800
|
+
if (!root) return true;
|
|
801
|
+
return readConfig(root).artifacts?.auto_clean !== false;
|
|
802
|
+
}
|
|
803
|
+
|
|
804
|
+
/**
|
|
805
|
+
* Sweep cadence in hours. Env-only (`HARNERY_ARTIFACT_AUTO_CLEAN_INTERVAL_HOURS`,
|
|
806
|
+
* mainly for tests): the cadence is an implementation detail, not policy, and
|
|
807
|
+
* retention itself is quantized in whole days, so the 24h default is not a
|
|
808
|
+
* config surface.
|
|
809
|
+
*/
|
|
810
|
+
export function artifactAutoCleanIntervalHours(): number {
|
|
811
|
+
const env = coordEnv("ARTIFACT_AUTO_CLEAN_INTERVAL_HOURS");
|
|
812
|
+
if (env !== undefined) {
|
|
813
|
+
const n = Number(env);
|
|
814
|
+
if (Number.isFinite(n) && n > 0 && n <= 24 * 365) return n;
|
|
815
|
+
}
|
|
816
|
+
return 24;
|
|
817
|
+
}
|
|
818
|
+
|
|
819
|
+
function integerSetting(
|
|
820
|
+
envValue: string | undefined,
|
|
821
|
+
configured: unknown,
|
|
822
|
+
minimum: number,
|
|
823
|
+
maximum: number,
|
|
824
|
+
fallback: number,
|
|
825
|
+
): number {
|
|
826
|
+
for (const value of [envValue, configured]) {
|
|
827
|
+
const parsed = typeof value === "number" ? value : Number(value);
|
|
828
|
+
if (Number.isSafeInteger(parsed) && parsed >= minimum && parsed <= maximum) return parsed;
|
|
829
|
+
}
|
|
830
|
+
return fallback;
|
|
831
|
+
}
|
|
832
|
+
|
|
833
|
+
function booleanSetting(
|
|
834
|
+
envValue: string | undefined,
|
|
835
|
+
configured: unknown,
|
|
836
|
+
fallback: boolean,
|
|
837
|
+
): boolean {
|
|
838
|
+
if (envValue !== undefined) {
|
|
839
|
+
if (envValue === "1" || envValue.toLowerCase() === "true") return true;
|
|
840
|
+
if (envValue === "0" || envValue.toLowerCase() === "false") return false;
|
|
841
|
+
}
|
|
842
|
+
return typeof configured === "boolean" ? configured : fallback;
|
|
843
|
+
}
|
|
844
|
+
|
|
615
845
|
/** Resolved `harn backup` defaults (restic repo/password + prune policy). */
|
|
616
846
|
export interface BackupConfig {
|
|
617
847
|
repo: string;
|
|
@@ -0,0 +1,237 @@
|
|
|
1
|
+
import { mkdirSync, readFileSync, renameSync, rmSync, writeFileSync } from "node:fs";
|
|
2
|
+
import { join, resolve } from "node:path";
|
|
3
|
+
import {
|
|
4
|
+
appendDurableHistoryRecord,
|
|
5
|
+
type DurableHistoryFaultBoundary,
|
|
6
|
+
readDurableHistorySync,
|
|
7
|
+
} from "../storage/durable-history.ts";
|
|
8
|
+
import type {
|
|
9
|
+
HarneryConversationAccessMode,
|
|
10
|
+
HarneryConversationArchiveAuthorityMode,
|
|
11
|
+
HarneryConversationProvider,
|
|
12
|
+
HarneryConversationRecordV1,
|
|
13
|
+
HarneryConversationSourceSnapshot,
|
|
14
|
+
} from "./contract.ts";
|
|
15
|
+
import { digest, normalizeConversationRecord } from "./normalize.ts";
|
|
16
|
+
|
|
17
|
+
export const HARNERY_CONVERSATION_MANIFEST_SCHEMA = "harnery.conversation-manifest/v1" as const;
|
|
18
|
+
|
|
19
|
+
export interface HarneryConversationArchiveManifest {
|
|
20
|
+
schema: typeof HARNERY_CONVERSATION_MANIFEST_SCHEMA;
|
|
21
|
+
policy_version: "conversation-archive-v1";
|
|
22
|
+
provider_id: string;
|
|
23
|
+
project_scope_id: string;
|
|
24
|
+
conversation_id: string;
|
|
25
|
+
source_snapshot_id: string;
|
|
26
|
+
completeness: HarneryConversationSourceSnapshot["completeness"];
|
|
27
|
+
omissions: readonly string[];
|
|
28
|
+
record_count: number;
|
|
29
|
+
logical_bytes: number;
|
|
30
|
+
first_occurred_at?: string;
|
|
31
|
+
last_occurred_at?: string;
|
|
32
|
+
record_set_digest: `sha256:${string}`;
|
|
33
|
+
authority_mode: HarneryConversationArchiveAuthorityMode;
|
|
34
|
+
updated_at: string;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export interface CaptureConversationOptions {
|
|
38
|
+
coord_root: string;
|
|
39
|
+
project_scope_id: string;
|
|
40
|
+
conversation_id: string;
|
|
41
|
+
access_mode: HarneryConversationAccessMode;
|
|
42
|
+
authority_mode: HarneryConversationArchiveAuthorityMode;
|
|
43
|
+
now?: () => Date;
|
|
44
|
+
fault?: (
|
|
45
|
+
boundary:
|
|
46
|
+
| DurableHistoryFaultBoundary
|
|
47
|
+
| "after_record_append"
|
|
48
|
+
| "before_manifest_publish"
|
|
49
|
+
| "after_manifest_publish",
|
|
50
|
+
) => void;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export interface CaptureConversationResult {
|
|
54
|
+
state: "disabled" | "source-only" | "captured";
|
|
55
|
+
accepted: number;
|
|
56
|
+
duplicates: number;
|
|
57
|
+
omissions: readonly string[];
|
|
58
|
+
manifest?: HarneryConversationArchiveManifest;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
export async function captureProviderConversation(
|
|
62
|
+
provider: HarneryConversationProvider,
|
|
63
|
+
options: CaptureConversationOptions,
|
|
64
|
+
): Promise<CaptureConversationResult> {
|
|
65
|
+
if (options.access_mode === "off") return result("disabled");
|
|
66
|
+
if (options.access_mode === "source") return result("source-only");
|
|
67
|
+
const objectDir = conversationArchiveDir(
|
|
68
|
+
options.coord_root,
|
|
69
|
+
provider.capabilities.provider_id,
|
|
70
|
+
options.conversation_id,
|
|
71
|
+
);
|
|
72
|
+
mkdirSync(objectDir, { recursive: true, mode: 0o700 });
|
|
73
|
+
const lease = join(objectDir, ".capture.lease");
|
|
74
|
+
try {
|
|
75
|
+
mkdirSync(lease, { mode: 0o700 });
|
|
76
|
+
} catch {
|
|
77
|
+
throw new Error(`conversation capture lease busy: ${options.conversation_id}`);
|
|
78
|
+
}
|
|
79
|
+
try {
|
|
80
|
+
const snapshot = await provider.snapshot(options.project_scope_id, options.conversation_id);
|
|
81
|
+
const existing = readConversationArchive(objectDir);
|
|
82
|
+
const seen = new Map(existing.map((record) => [record.record_id, record.content_digest]));
|
|
83
|
+
let accepted = 0;
|
|
84
|
+
let duplicates = 0;
|
|
85
|
+
const omissions = new Set(snapshot.omissions);
|
|
86
|
+
let sequence = existing.at(-1)?.sequence ?? 0;
|
|
87
|
+
for await (const native of provider.stream(options.project_scope_id, options.conversation_id)) {
|
|
88
|
+
const normalized = normalizeConversationRecord({
|
|
89
|
+
capabilities: provider.capabilities,
|
|
90
|
+
snapshot,
|
|
91
|
+
native,
|
|
92
|
+
captured_at: (options.now?.() ?? new Date()).toISOString(),
|
|
93
|
+
sequence: sequence + 1,
|
|
94
|
+
});
|
|
95
|
+
if (!normalized.record) {
|
|
96
|
+
omissions.add(normalized.omission ?? "record_excluded");
|
|
97
|
+
continue;
|
|
98
|
+
}
|
|
99
|
+
const prior = seen.get(normalized.record.record_id);
|
|
100
|
+
if (prior) {
|
|
101
|
+
if (prior !== normalized.record.content_digest) {
|
|
102
|
+
throw new Error(`conversation record collision: ${normalized.record.record_id}`);
|
|
103
|
+
}
|
|
104
|
+
duplicates += 1;
|
|
105
|
+
continue;
|
|
106
|
+
}
|
|
107
|
+
sequence += 1;
|
|
108
|
+
normalized.record.sequence = sequence;
|
|
109
|
+
appendDurableHistoryRecord(objectDir, normalized.record, {
|
|
110
|
+
max_record_bytes: 1_048_576,
|
|
111
|
+
max_segment_bytes: 8_388_608,
|
|
112
|
+
fault: options.fault,
|
|
113
|
+
});
|
|
114
|
+
options.fault?.("after_record_append");
|
|
115
|
+
seen.set(normalized.record.record_id, normalized.record.content_digest);
|
|
116
|
+
accepted += 1;
|
|
117
|
+
}
|
|
118
|
+
const records = readConversationArchive(objectDir);
|
|
119
|
+
const manifest = manifestFor(
|
|
120
|
+
records,
|
|
121
|
+
{ ...snapshot, omissions: [...omissions].sort() },
|
|
122
|
+
options.authority_mode,
|
|
123
|
+
options.now?.() ?? new Date(),
|
|
124
|
+
);
|
|
125
|
+
options.fault?.("before_manifest_publish");
|
|
126
|
+
publishManifest(objectDir, manifest);
|
|
127
|
+
options.fault?.("after_manifest_publish");
|
|
128
|
+
return { state: "captured", accepted, duplicates, omissions: [...omissions].sort(), manifest };
|
|
129
|
+
} finally {
|
|
130
|
+
rmSync(lease, { recursive: true, force: true });
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
export function readConversationArchive(
|
|
135
|
+
objectDirOrCoordRoot: string,
|
|
136
|
+
providerId?: string,
|
|
137
|
+
conversationId?: string,
|
|
138
|
+
): HarneryConversationRecordV1[] {
|
|
139
|
+
const objectDir =
|
|
140
|
+
providerId && conversationId
|
|
141
|
+
? conversationArchiveDir(objectDirOrCoordRoot, providerId, conversationId)
|
|
142
|
+
: objectDirOrCoordRoot;
|
|
143
|
+
return readDurableHistorySync<HarneryConversationRecordV1>(objectDir, {
|
|
144
|
+
max_record_bytes: 1_048_576,
|
|
145
|
+
max_records: 1_000_000,
|
|
146
|
+
});
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
export function reconcileConversationArchive(input: {
|
|
150
|
+
coord_root: string;
|
|
151
|
+
provider_id: string;
|
|
152
|
+
conversation_id: string;
|
|
153
|
+
snapshot: HarneryConversationSourceSnapshot;
|
|
154
|
+
authority_mode: HarneryConversationArchiveAuthorityMode;
|
|
155
|
+
now: Date;
|
|
156
|
+
}): HarneryConversationArchiveManifest {
|
|
157
|
+
const objectDir = conversationArchiveDir(
|
|
158
|
+
input.coord_root,
|
|
159
|
+
input.provider_id,
|
|
160
|
+
input.conversation_id,
|
|
161
|
+
);
|
|
162
|
+
const manifest = manifestFor(
|
|
163
|
+
readConversationArchive(objectDir),
|
|
164
|
+
input.snapshot,
|
|
165
|
+
input.authority_mode,
|
|
166
|
+
input.now,
|
|
167
|
+
);
|
|
168
|
+
publishManifest(objectDir, manifest);
|
|
169
|
+
return manifest;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
export function loadConversationManifest(
|
|
173
|
+
coordRoot: string,
|
|
174
|
+
providerId: string,
|
|
175
|
+
conversationId: string,
|
|
176
|
+
): HarneryConversationArchiveManifest | undefined {
|
|
177
|
+
const path = join(conversationArchiveDir(coordRoot, providerId, conversationId), "manifest.json");
|
|
178
|
+
try {
|
|
179
|
+
const parsed = JSON.parse(readFileSync(path, "utf8")) as HarneryConversationArchiveManifest;
|
|
180
|
+
if (parsed.schema !== HARNERY_CONVERSATION_MANIFEST_SCHEMA) throw new Error("unknown schema");
|
|
181
|
+
return parsed;
|
|
182
|
+
} catch (error) {
|
|
183
|
+
if ((error as NodeJS.ErrnoException).code === "ENOENT") return undefined;
|
|
184
|
+
throw new Error(`conversation manifest invalid: ${(error as Error).message}`);
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
export function conversationArchiveDir(
|
|
189
|
+
coordRoot: string,
|
|
190
|
+
providerId: string,
|
|
191
|
+
conversationId: string,
|
|
192
|
+
): string {
|
|
193
|
+
const provider = opaque(providerId);
|
|
194
|
+
const conversation = digest(`${providerId}\0${conversationId}`).slice("sha256:".length, 38);
|
|
195
|
+
return join(resolve(coordRoot), ".harnery", "conversations", provider, conversation);
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
function manifestFor(
|
|
199
|
+
records: readonly HarneryConversationRecordV1[],
|
|
200
|
+
snapshot: HarneryConversationSourceSnapshot,
|
|
201
|
+
authorityMode: HarneryConversationArchiveAuthorityMode,
|
|
202
|
+
now: Date,
|
|
203
|
+
): HarneryConversationArchiveManifest {
|
|
204
|
+
return {
|
|
205
|
+
schema: HARNERY_CONVERSATION_MANIFEST_SCHEMA,
|
|
206
|
+
policy_version: "conversation-archive-v1",
|
|
207
|
+
provider_id: snapshot.provider_id,
|
|
208
|
+
project_scope_id: snapshot.project_scope_id,
|
|
209
|
+
conversation_id: snapshot.conversation_id,
|
|
210
|
+
source_snapshot_id: snapshot.snapshot_id,
|
|
211
|
+
completeness: snapshot.completeness,
|
|
212
|
+
omissions: [...snapshot.omissions],
|
|
213
|
+
record_count: records.length,
|
|
214
|
+
logical_bytes: records.reduce((sum, record) => sum + record.content_bytes, 0),
|
|
215
|
+
...(records[0] ? { first_occurred_at: records[0].occurred_at } : {}),
|
|
216
|
+
...(records.at(-1) ? { last_occurred_at: records.at(-1)!.occurred_at } : {}),
|
|
217
|
+
record_set_digest: digest(records.map((record) => record.record_id).join("\n")),
|
|
218
|
+
authority_mode: authorityMode,
|
|
219
|
+
updated_at: now.toISOString(),
|
|
220
|
+
};
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
function publishManifest(objectDir: string, manifest: HarneryConversationArchiveManifest): void {
|
|
224
|
+
const path = join(objectDir, "manifest.json");
|
|
225
|
+
const temp = `${path}.tmp-${process.pid}`;
|
|
226
|
+
writeFileSync(temp, `${JSON.stringify(manifest, null, 2)}\n`, { mode: 0o600 });
|
|
227
|
+
renameSync(temp, path);
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
function opaque(value: string): string {
|
|
231
|
+
if (!/^[a-z][a-z0-9-]{1,63}$/.test(value)) throw new Error(`invalid provider id: ${value}`);
|
|
232
|
+
return value;
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
function result(state: "disabled" | "source-only"): CaptureConversationResult {
|
|
236
|
+
return { state, accepted: 0, duplicates: 0, omissions: [] };
|
|
237
|
+
}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import type { HarneryConversationProvider } from "./contract.ts";
|
|
2
|
+
|
|
3
|
+
export class HarneryConversationCatalog {
|
|
4
|
+
readonly #providers: ReadonlyMap<string, HarneryConversationProvider>;
|
|
5
|
+
|
|
6
|
+
constructor(providers: readonly HarneryConversationProvider[]) {
|
|
7
|
+
const entries = new Map<string, HarneryConversationProvider>();
|
|
8
|
+
for (const provider of providers) {
|
|
9
|
+
const id = provider.capabilities.provider_id;
|
|
10
|
+
if (!/^[a-z][a-z0-9-]{1,63}$/.test(id))
|
|
11
|
+
throw new Error(`invalid conversation provider id: ${id}`);
|
|
12
|
+
if (entries.has(id)) throw new Error(`duplicate conversation provider: ${id}`);
|
|
13
|
+
if (provider.capabilities.roles.some((role) => role !== "user" && role !== "assistant")) {
|
|
14
|
+
throw new Error(`provider ${id} exposes an excluded role`);
|
|
15
|
+
}
|
|
16
|
+
entries.set(id, Object.freeze(provider));
|
|
17
|
+
}
|
|
18
|
+
this.#providers = entries;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
get(id: string): HarneryConversationProvider | undefined {
|
|
22
|
+
return this.#providers.get(id);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
require(id: string): HarneryConversationProvider {
|
|
26
|
+
const provider = this.get(id);
|
|
27
|
+
if (!provider) throw new Error(`unknown conversation provider: ${id}`);
|
|
28
|
+
return provider;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
list(): readonly HarneryConversationProvider[] {
|
|
32
|
+
return [...this.#providers.values()].sort((left, right) =>
|
|
33
|
+
left.capabilities.provider_id.localeCompare(right.capabilities.provider_id),
|
|
34
|
+
);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export function unavailableAdapterProviders(): readonly HarneryConversationProvider[] {
|
|
39
|
+
return ["claude-code", "codex", "cursor"].map((providerId) => ({
|
|
40
|
+
capabilities: {
|
|
41
|
+
provider_id: providerId,
|
|
42
|
+
roles: ["user", "assistant"] as const,
|
|
43
|
+
can_list: false,
|
|
44
|
+
can_stream_source: false,
|
|
45
|
+
can_replay_archive: false,
|
|
46
|
+
default_completeness: "unavailable" as const,
|
|
47
|
+
default_omissions: [
|
|
48
|
+
"adapter-native source reader is not registered by this host",
|
|
49
|
+
"system, developer, tool, reasoning, command, and attachment bodies are excluded",
|
|
50
|
+
],
|
|
51
|
+
retention_behavior: "adapter-owned and unavailable to portable core",
|
|
52
|
+
},
|
|
53
|
+
async list() {
|
|
54
|
+
return [];
|
|
55
|
+
},
|
|
56
|
+
async snapshot(projectScopeId: string, conversationId: string) {
|
|
57
|
+
return {
|
|
58
|
+
snapshot_id: `${providerId}:unavailable:${conversationId}`,
|
|
59
|
+
provider_id: providerId,
|
|
60
|
+
project_scope_id: projectScopeId,
|
|
61
|
+
conversation_id: conversationId,
|
|
62
|
+
observed_at: new Date().toISOString(),
|
|
63
|
+
completeness: "unavailable" as const,
|
|
64
|
+
omissions: ["adapter-native source unavailable"],
|
|
65
|
+
};
|
|
66
|
+
},
|
|
67
|
+
stream() {
|
|
68
|
+
return {
|
|
69
|
+
[Symbol.asyncIterator]() {
|
|
70
|
+
return {
|
|
71
|
+
async next(): Promise<IteratorResult<never>> {
|
|
72
|
+
throw new Error(`conversation provider unavailable: ${providerId}`);
|
|
73
|
+
},
|
|
74
|
+
};
|
|
75
|
+
},
|
|
76
|
+
};
|
|
77
|
+
},
|
|
78
|
+
}));
|
|
79
|
+
}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import type { HarneryConversationContextPack, HarneryConversationQueryResult } from "./contract.ts";
|
|
2
|
+
|
|
3
|
+
export function buildConversationContextPack(
|
|
4
|
+
result: HarneryConversationQueryResult,
|
|
5
|
+
budget: { max_tokens: number; max_bytes: number },
|
|
6
|
+
): HarneryConversationContextPack {
|
|
7
|
+
if (
|
|
8
|
+
!Number.isSafeInteger(budget.max_tokens) ||
|
|
9
|
+
budget.max_tokens <= 0 ||
|
|
10
|
+
!Number.isSafeInteger(budget.max_bytes) ||
|
|
11
|
+
budget.max_bytes <= 0
|
|
12
|
+
) {
|
|
13
|
+
throw new Error("invalid conversation context budget");
|
|
14
|
+
}
|
|
15
|
+
const ordered = new Map(
|
|
16
|
+
result.hits
|
|
17
|
+
.flatMap((hit) => [...hit.neighbors, hit.record])
|
|
18
|
+
.sort(
|
|
19
|
+
(left, right) =>
|
|
20
|
+
left.provider_id.localeCompare(right.provider_id) ||
|
|
21
|
+
left.conversation_id.localeCompare(right.conversation_id) ||
|
|
22
|
+
left.sequence - right.sequence,
|
|
23
|
+
)
|
|
24
|
+
.map((record) => [record.record_id, record]),
|
|
25
|
+
);
|
|
26
|
+
const excerpts: HarneryConversationContextPack["excerpts"][number][] = [];
|
|
27
|
+
let bytes = 0;
|
|
28
|
+
let tokens = 0;
|
|
29
|
+
let truncated = result.truncated;
|
|
30
|
+
for (const record of ordered.values()) {
|
|
31
|
+
const recordBytes = Buffer.byteLength(record.content);
|
|
32
|
+
const recordTokens = Math.ceil(recordBytes / 4);
|
|
33
|
+
if (bytes + recordBytes > budget.max_bytes || tokens + recordTokens > budget.max_tokens) {
|
|
34
|
+
truncated = true;
|
|
35
|
+
break;
|
|
36
|
+
}
|
|
37
|
+
excerpts.push({
|
|
38
|
+
citation: {
|
|
39
|
+
record_id: record.record_id,
|
|
40
|
+
provider_id: record.provider_id,
|
|
41
|
+
conversation_id: record.conversation_id,
|
|
42
|
+
role: record.role,
|
|
43
|
+
occurred_at: record.occurred_at,
|
|
44
|
+
native_conversation_id: record.source.native_conversation_id,
|
|
45
|
+
...(record.source.native_record_id
|
|
46
|
+
? { native_record_id: record.source.native_record_id }
|
|
47
|
+
: {}),
|
|
48
|
+
content_digest: record.content_digest,
|
|
49
|
+
},
|
|
50
|
+
content: record.content,
|
|
51
|
+
sequence: record.sequence,
|
|
52
|
+
});
|
|
53
|
+
bytes += recordBytes;
|
|
54
|
+
tokens += recordTokens;
|
|
55
|
+
}
|
|
56
|
+
return {
|
|
57
|
+
schema: "harnery.conversation-context-pack/v1",
|
|
58
|
+
boundary: "untrusted-historical-data",
|
|
59
|
+
automatic_injection: false,
|
|
60
|
+
project_scope_id: result.request.project_scope_id,
|
|
61
|
+
excerpts,
|
|
62
|
+
completeness: result.snapshots.map((snapshot) => ({
|
|
63
|
+
provider_id: snapshot.provider_id,
|
|
64
|
+
conversation_id: snapshot.conversation_id,
|
|
65
|
+
completeness: snapshot.completeness,
|
|
66
|
+
omissions: snapshot.omissions,
|
|
67
|
+
})),
|
|
68
|
+
bytes,
|
|
69
|
+
estimated_tokens: tokens,
|
|
70
|
+
truncated,
|
|
71
|
+
};
|
|
72
|
+
}
|