harnery 0.35.0 → 0.37.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/commander.d.ts +30 -5
- package/dist/commander.d.ts.map +1 -1
- package/dist/commander.js +128 -96
- package/dist/commands/agents.d.ts +23 -3
- package/dist/commands/agents.d.ts.map +1 -1
- package/dist/commands/agents.js +464 -242
- package/dist/commands/artifacts.d.ts.map +1 -1
- package/dist/commands/artifacts.js +26 -1
- package/dist/commands/backup.d.ts.map +1 -1
- package/dist/commands/backup.js +10 -10
- package/dist/commands/browse-session.d.ts.map +1 -1
- package/dist/commands/browse-session.js +12 -0
- package/dist/commands/browse.d.ts +1 -1
- package/dist/commands/browse.d.ts.map +1 -1
- package/dist/commands/browse.js +16 -4
- package/dist/commands/conversations.d.ts +10 -0
- package/dist/commands/conversations.d.ts.map +1 -0
- package/dist/commands/conversations.js +201 -0
- package/dist/commands/deinit.d.ts.map +1 -1
- package/dist/commands/deinit.js +5 -0
- package/dist/commands/diagnostics.d.ts +4 -0
- package/dist/commands/diagnostics.d.ts.map +1 -0
- package/dist/commands/diagnostics.js +229 -0
- package/dist/commands/docs.d.ts.map +1 -1
- package/dist/commands/docs.js +13 -2
- package/dist/commands/doctor.d.ts +5 -0
- package/dist/commands/doctor.d.ts.map +1 -1
- package/dist/commands/doctor.js +51 -7
- package/dist/commands/fetch.js +6 -5
- package/dist/commands/files.d.ts +34 -0
- package/dist/commands/files.d.ts.map +1 -0
- package/dist/commands/files.js +166 -0
- package/dist/commands/governor.d.ts.map +1 -1
- package/dist/commands/governor.js +18 -12
- package/dist/commands/inbox.d.ts +5 -0
- package/dist/commands/inbox.d.ts.map +1 -0
- package/dist/commands/inbox.js +57 -0
- package/dist/commands/init.d.ts +4 -5
- package/dist/commands/init.d.ts.map +1 -1
- package/dist/commands/init.js +63 -13
- package/dist/commands/ledger-v3.d.ts.map +1 -1
- package/dist/commands/ledger-v3.js +417 -2
- package/dist/commands/logs.d.ts +4 -0
- package/dist/commands/logs.d.ts.map +1 -0
- package/dist/commands/logs.js +169 -0
- package/dist/commands/messages.d.ts +5 -0
- package/dist/commands/messages.d.ts.map +1 -0
- package/dist/commands/messages.js +45 -0
- package/dist/commands/outline.d.ts +1 -1
- package/dist/commands/outline.d.ts.map +1 -1
- package/dist/commands/outline.js +2 -2
- package/dist/commands/qa-run.d.ts +4 -0
- package/dist/commands/qa-run.d.ts.map +1 -0
- package/dist/commands/qa-run.js +141 -0
- package/dist/commands/read.d.ts +1 -1
- package/dist/commands/read.d.ts.map +1 -1
- package/dist/commands/read.js +2 -2
- package/dist/commands/resources.d.ts +4 -0
- package/dist/commands/resources.d.ts.map +1 -0
- package/dist/commands/resources.js +29 -0
- package/dist/commands/semantic.d.ts.map +1 -1
- package/dist/commands/semantic.js +54 -2
- package/dist/commands/storage.d.ts +4 -0
- package/dist/commands/storage.d.ts.map +1 -0
- package/dist/commands/storage.js +238 -0
- package/dist/commands/supervisor.d.ts +4 -0
- package/dist/commands/supervisor.d.ts.map +1 -0
- package/dist/commands/supervisor.js +101 -0
- package/dist/commands/tunnel.d.ts +5 -1
- package/dist/commands/tunnel.d.ts.map +1 -1
- package/dist/commands/tunnel.js +44 -31
- package/dist/commands/web.d.ts +3 -0
- package/dist/commands/web.d.ts.map +1 -1
- package/dist/commands/web.js +84 -7
- package/dist/commands/work.js +3 -3
- package/dist/commands/workflow.d.ts.map +1 -1
- package/dist/commands/workflow.js +17 -13
- package/dist/core/adapters/profiles.d.ts +1 -1
- package/dist/core/agents/cli.js +215 -41
- package/dist/core/agents/health.d.ts +17 -0
- package/dist/core/agents/health.d.ts.map +1 -0
- package/dist/core/agents/health.js +109 -0
- package/dist/core/agents/live-authority-v3.d.ts +47 -1
- package/dist/core/agents/live-authority-v3.d.ts.map +1 -1
- package/dist/core/agents/live-authority-v3.js +244 -10
- package/dist/core/agents/live-lifecycle-v3.js +6 -1
- package/dist/core/agents/live-observation-v3.d.ts.map +1 -1
- package/dist/core/agents/live-observation-v3.js +6 -1
- package/dist/core/agents/mailbox.d.ts +92 -0
- package/dist/core/agents/mailbox.d.ts.map +1 -0
- package/dist/core/agents/mailbox.js +325 -0
- package/dist/core/agents/reconcile-coordination-v3.d.ts +44 -0
- package/dist/core/agents/reconcile-coordination-v3.d.ts.map +1 -0
- package/dist/core/agents/reconcile-coordination-v3.js +58 -0
- package/dist/core/agents/render/prompt-context.d.ts +14 -3
- package/dist/core/agents/render/prompt-context.d.ts.map +1 -1
- package/dist/core/agents/render/prompt-context.js +54 -16
- package/dist/core/agents/render/session-context.d.ts +8 -0
- package/dist/core/agents/render/session-context.d.ts.map +1 -1
- package/dist/core/agents/render/session-context.js +34 -3
- package/dist/core/agents/rules/commit-conflict.d.ts.map +1 -1
- package/dist/core/agents/rules/commit-conflict.js +50 -1
- package/dist/core/agents/rules/stop-hook.d.ts +2 -0
- package/dist/core/agents/rules/stop-hook.d.ts.map +1 -1
- package/dist/core/agents/rules/stop-hook.js +93 -16
- package/dist/core/agents/rules/verdict.d.ts +1 -0
- package/dist/core/agents/rules/verdict.d.ts.map +1 -1
- package/dist/core/agents/session-events.d.ts.map +1 -1
- package/dist/core/agents/session-events.js +4 -0
- package/dist/core/agents/session-finalization-state-v3.js +1 -1
- package/dist/core/agents/session-finalizer-v3.js +9 -2
- package/dist/core/agents/state/activity-log.d.ts +3 -0
- package/dist/core/agents/state/activity-log.d.ts.map +1 -1
- package/dist/core/agents/state/activity-log.js +6 -3
- package/dist/core/agents/state/heartbeat-writer.d.ts +6 -0
- package/dist/core/agents/state/heartbeat-writer.d.ts.map +1 -1
- package/dist/core/agents/state/heartbeat-writer.js +18 -0
- package/dist/core/agents/state/live-coordination-view.d.ts +5 -7
- package/dist/core/agents/state/live-coordination-view.d.ts.map +1 -1
- package/dist/core/agents/state/live-coordination-view.js +15 -90
- package/dist/core/agents/state/live-coordination-writer.d.ts +12 -0
- package/dist/core/agents/state/live-coordination-writer.d.ts.map +1 -0
- package/dist/core/agents/state/live-coordination-writer.js +92 -0
- package/dist/core/artifacts/index.d.ts +47 -1
- package/dist/core/artifacts/index.d.ts.map +1 -1
- package/dist/core/artifacts/index.js +191 -6
- package/dist/core/config.d.ts +74 -4
- package/dist/core/config.d.ts.map +1 -1
- package/dist/core/config.js +141 -4
- package/dist/core/conversations/archive.d.ts +49 -0
- package/dist/core/conversations/archive.d.ts.map +1 -0
- package/dist/core/conversations/archive.js +136 -0
- package/dist/core/conversations/catalog.d.ts +10 -0
- package/dist/core/conversations/catalog.d.ts.map +1 -0
- package/dist/core/conversations/catalog.js +72 -0
- package/dist/core/conversations/context-pack.d.ts +6 -0
- package/dist/core/conversations/context-pack.d.ts.map +1 -0
- package/dist/core/conversations/context-pack.js +60 -0
- package/dist/core/conversations/contract.d.ts +155 -0
- package/dist/core/conversations/contract.d.ts.map +1 -0
- package/dist/core/conversations/contract.js +1 -0
- package/dist/core/conversations/evaluation.d.ts +16 -0
- package/dist/core/conversations/evaluation.d.ts.map +1 -0
- package/dist/core/conversations/evaluation.js +9 -0
- package/dist/core/conversations/index.d.ts +10 -0
- package/dist/core/conversations/index.d.ts.map +1 -0
- package/dist/core/conversations/index.js +9 -0
- package/dist/core/conversations/lifecycle.d.ts +28 -0
- package/dist/core/conversations/lifecycle.d.ts.map +1 -0
- package/dist/core/conversations/lifecycle.js +29 -0
- package/dist/core/conversations/normalize.d.ts +14 -0
- package/dist/core/conversations/normalize.d.ts.map +1 -0
- package/dist/core/conversations/normalize.js +82 -0
- package/dist/core/conversations/query.d.ts +8 -0
- package/dist/core/conversations/query.d.ts.map +1 -0
- package/dist/core/conversations/query.js +280 -0
- package/dist/core/conversations/search-index.d.ts +9 -0
- package/dist/core/conversations/search-index.d.ts.map +1 -0
- package/dist/core/conversations/search-index.js +29 -0
- package/dist/core/diagnostics/advice.d.ts +9 -0
- package/dist/core/diagnostics/advice.d.ts.map +1 -0
- package/dist/core/diagnostics/advice.js +112 -0
- package/dist/core/diagnostics/bundle.d.ts +35 -0
- package/dist/core/diagnostics/bundle.d.ts.map +1 -0
- package/dist/core/diagnostics/bundle.js +874 -0
- package/dist/core/diagnostics/comparison.d.ts +5 -0
- package/dist/core/diagnostics/comparison.d.ts.map +1 -0
- package/dist/core/diagnostics/comparison.js +444 -0
- package/dist/core/diagnostics/contract.d.ts +245 -0
- package/dist/core/diagnostics/contract.d.ts.map +1 -0
- package/dist/core/diagnostics/contract.js +18 -0
- package/dist/core/diagnostics/identity.d.ts +3 -0
- package/dist/core/diagnostics/identity.d.ts.map +1 -0
- package/dist/core/diagnostics/identity.js +10 -0
- package/dist/core/diagnostics/index.d.ts +8 -0
- package/dist/core/diagnostics/index.d.ts.map +1 -0
- package/dist/core/diagnostics/index.js +7 -0
- package/dist/core/diagnostics/replay.d.ts +8 -0
- package/dist/core/diagnostics/replay.d.ts.map +1 -0
- package/dist/core/diagnostics/replay.js +213 -0
- package/dist/core/diagnostics/sanitize.d.ts +9 -0
- package/dist/core/diagnostics/sanitize.d.ts.map +1 -0
- package/dist/core/diagnostics/sanitize.js +84 -0
- package/dist/core/events/legacy-storage/canary.d.ts +18 -0
- package/dist/core/events/legacy-storage/canary.d.ts.map +1 -0
- package/dist/core/events/legacy-storage/canary.js +150 -0
- package/dist/core/events/legacy-storage/compression.d.ts +13 -0
- package/dist/core/events/legacy-storage/compression.d.ts.map +1 -0
- package/dist/core/events/legacy-storage/compression.js +107 -0
- package/dist/core/events/legacy-storage/fence.d.ts +15 -0
- package/dist/core/events/legacy-storage/fence.d.ts.map +1 -0
- package/dist/core/events/legacy-storage/fence.js +115 -0
- package/dist/core/events/legacy-storage/index.d.ts +7 -0
- package/dist/core/events/legacy-storage/index.d.ts.map +1 -0
- package/dist/core/events/legacy-storage/index.js +6 -0
- package/dist/core/events/legacy-storage/inventory.d.ts +10 -0
- package/dist/core/events/legacy-storage/inventory.d.ts.map +1 -0
- package/dist/core/events/legacy-storage/inventory.js +40 -0
- package/dist/core/events/legacy-storage/manifest.d.ts +23 -0
- package/dist/core/events/legacy-storage/manifest.d.ts.map +1 -0
- package/dist/core/events/legacy-storage/manifest.js +108 -0
- package/dist/core/events/legacy-storage/reader.d.ts +15 -0
- package/dist/core/events/legacy-storage/reader.d.ts.map +1 -0
- package/dist/core/events/legacy-storage/reader.js +154 -0
- package/dist/core/events/v3/archive-retention.d.ts +33 -0
- package/dist/core/events/v3/archive-retention.d.ts.map +1 -0
- package/dist/core/events/v3/archive-retention.js +195 -0
- package/dist/core/events/v3/authority-outbox.d.ts +7 -2
- package/dist/core/events/v3/authority-outbox.d.ts.map +1 -1
- package/dist/core/events/v3/authority-outbox.js +16 -3
- package/dist/core/events/v3/base-contract.d.ts +81 -41
- package/dist/core/events/v3/base-contract.d.ts.map +1 -1
- package/dist/core/events/v3/base-contract.js +17 -7
- package/dist/core/events/v3/bootstrap.d.ts +39 -0
- package/dist/core/events/v3/bootstrap.d.ts.map +1 -1
- package/dist/core/events/v3/bootstrap.js +167 -3
- package/dist/core/events/v3/capabilities.d.ts +1 -1
- package/dist/core/events/v3/capabilities.d.ts.map +1 -1
- package/dist/core/events/v3/capabilities.js +4 -3
- package/dist/core/events/v3/control-witness.d.ts +44 -0
- package/dist/core/events/v3/control-witness.d.ts.map +1 -0
- package/dist/core/events/v3/control-witness.js +233 -0
- package/dist/core/events/v3/control-writer.d.ts +4 -0
- package/dist/core/events/v3/control-writer.d.ts.map +1 -0
- package/dist/core/events/v3/control-writer.js +16 -0
- package/dist/core/events/v3/control.d.ts +8 -2
- package/dist/core/events/v3/control.d.ts.map +1 -1
- package/dist/core/events/v3/control.js +46 -18
- package/dist/core/events/v3/coordination-transaction-recovery.d.ts +42 -0
- package/dist/core/events/v3/coordination-transaction-recovery.d.ts.map +1 -0
- package/dist/core/events/v3/coordination-transaction-recovery.js +342 -0
- package/dist/core/events/v3/coordination-view.d.ts.map +1 -1
- package/dist/core/events/v3/coordination-view.js +16 -1
- package/dist/core/events/v3/generated.d.ts +1 -1
- package/dist/core/events/v3/generated.js +1 -1
- package/dist/core/events/v3/index.d.ts +5 -2
- package/dist/core/events/v3/index.d.ts.map +1 -1
- package/dist/core/events/v3/index.js +4 -1
- package/dist/core/events/v3/live-route-observer.d.ts +31 -0
- package/dist/core/events/v3/live-route-observer.d.ts.map +1 -0
- package/dist/core/events/v3/live-route-observer.js +58 -0
- package/dist/core/events/v3/live-routing.d.ts +13 -21
- package/dist/core/events/v3/live-routing.d.ts.map +1 -1
- package/dist/core/events/v3/live-routing.js +46 -41
- package/dist/core/events/v3/producers/coordination-recorder.d.ts +11 -1
- package/dist/core/events/v3/producers/coordination-recorder.d.ts.map +1 -1
- package/dist/core/events/v3/producers/coordination-recorder.js +76 -10
- package/dist/core/events/v3/producers/diagnostic-summaries.d.ts +129 -0
- package/dist/core/events/v3/producers/diagnostic-summaries.d.ts.map +1 -0
- package/dist/core/events/v3/producers/diagnostic-summaries.js +499 -0
- package/dist/core/events/v3/producers/hook-base.d.ts +1 -1
- package/dist/core/events/v3/producers/hook-base.d.ts.map +1 -1
- package/dist/core/events/v3/producers/hook-base.js +14 -3
- package/dist/core/events/v3/producers/intake.d.ts +7 -0
- package/dist/core/events/v3/producers/intake.d.ts.map +1 -1
- package/dist/core/events/v3/producers/intake.js +26 -2
- package/dist/core/events/v3/producers/producer-state-observer.d.ts +8 -0
- package/dist/core/events/v3/producers/producer-state-observer.d.ts.map +1 -0
- package/dist/core/events/v3/producers/producer-state-observer.js +45 -0
- package/dist/core/events/v3/producers/recorder.d.ts +71 -1
- package/dist/core/events/v3/producers/recorder.d.ts.map +1 -1
- package/dist/core/events/v3/producers/recorder.js +441 -25
- package/dist/core/events/v3/reader.d.ts +51 -0
- package/dist/core/events/v3/reader.d.ts.map +1 -1
- package/dist/core/events/v3/reader.js +181 -1
- package/dist/core/events/v3/rotation-config.d.ts +9 -0
- package/dist/core/events/v3/rotation-config.d.ts.map +1 -0
- package/dist/core/events/v3/rotation-config.js +91 -0
- package/dist/core/events/v3/runtime-build.d.ts +11 -0
- package/dist/core/events/v3/runtime-build.d.ts.map +1 -0
- package/dist/core/events/v3/runtime-build.js +39 -0
- package/dist/core/events/v3/runtime-identity.d.ts +5 -0
- package/dist/core/events/v3/runtime-identity.d.ts.map +1 -0
- package/dist/core/events/v3/runtime-identity.js +18 -0
- package/dist/core/events/v3/runtime-telemetry-capabilities.d.ts +6 -5
- package/dist/core/events/v3/runtime-telemetry-capabilities.d.ts.map +1 -1
- package/dist/core/events/v3/runtime-telemetry-capabilities.js +1 -1
- package/dist/core/events/v3/support-storage/classify.d.ts +46 -0
- package/dist/core/events/v3/support-storage/classify.d.ts.map +1 -0
- package/dist/core/events/v3/support-storage/classify.js +149 -0
- package/dist/core/events/v3/support-storage/eligibility.d.ts +29 -0
- package/dist/core/events/v3/support-storage/eligibility.d.ts.map +1 -0
- package/dist/core/events/v3/support-storage/eligibility.js +35 -0
- package/dist/core/events/v3/support-storage/index.d.ts +10 -0
- package/dist/core/events/v3/support-storage/index.d.ts.map +1 -0
- package/dist/core/events/v3/support-storage/index.js +9 -0
- package/dist/core/events/v3/support-storage/inventory.d.ts +30 -0
- package/dist/core/events/v3/support-storage/inventory.d.ts.map +1 -0
- package/dist/core/events/v3/support-storage/inventory.js +94 -0
- package/dist/core/events/v3/support-storage/logical-authority.d.ts +14 -0
- package/dist/core/events/v3/support-storage/logical-authority.d.ts.map +1 -0
- package/dist/core/events/v3/support-storage/logical-authority.js +104 -0
- package/dist/core/events/v3/support-storage/maintenance.d.ts +98 -0
- package/dist/core/events/v3/support-storage/maintenance.d.ts.map +1 -0
- package/dist/core/events/v3/support-storage/maintenance.js +352 -0
- package/dist/core/events/v3/support-storage/pack-contract.d.ts +59 -0
- package/dist/core/events/v3/support-storage/pack-contract.d.ts.map +1 -0
- package/dist/core/events/v3/support-storage/pack-contract.js +249 -0
- package/dist/core/events/v3/support-storage/pack-reader.d.ts +34 -0
- package/dist/core/events/v3/support-storage/pack-reader.d.ts.map +1 -0
- package/dist/core/events/v3/support-storage/pack-reader.js +258 -0
- package/dist/core/events/v3/support-storage/pack-writer.d.ts +30 -0
- package/dist/core/events/v3/support-storage/pack-writer.d.ts.map +1 -0
- package/dist/core/events/v3/support-storage/pack-writer.js +268 -0
- package/dist/core/events/v3/support-storage/recovery.d.ts +15 -0
- package/dist/core/events/v3/support-storage/recovery.d.ts.map +1 -0
- package/dist/core/events/v3/support-storage/recovery.js +22 -0
- package/dist/core/events/v3/turn-telemetry.d.ts +14 -8
- package/dist/core/events/v3/turn-telemetry.d.ts.map +1 -1
- package/dist/core/events/v3/turn-telemetry.js +32 -2
- package/dist/core/events/v3/writer.d.ts +13 -1
- package/dist/core/events/v3/writer.d.ts.map +1 -1
- package/dist/core/events/v3/writer.js +126 -12
- package/dist/core/governor/plan-read.d.ts.map +1 -1
- package/dist/core/governor/plan-read.js +5 -21
- package/dist/core/governor/planning.js +6 -8
- package/dist/core/governor/service-read.d.ts +12 -0
- package/dist/core/governor/service-read.d.ts.map +1 -1
- package/dist/core/governor/service-read.js +266 -2
- package/dist/core/governor/service.d.ts +1 -0
- package/dist/core/governor/service.d.ts.map +1 -1
- package/dist/core/governor/service.js +53 -18
- package/dist/core/guard/evidence-v3.d.ts.map +1 -1
- package/dist/core/guard/evidence-v3.js +2 -0
- package/dist/core/hooks/adapter/events.d.ts.map +1 -1
- package/dist/core/hooks/adapter/events.js +1 -0
- package/dist/core/hooks/adapter/output.d.ts +12 -2
- package/dist/core/hooks/adapter/output.d.ts.map +1 -1
- package/dist/core/hooks/adapter/output.js +23 -5
- package/dist/core/hooks/adapter/runtime-telemetry.d.ts +27 -4
- package/dist/core/hooks/adapter/runtime-telemetry.d.ts.map +1 -1
- package/dist/core/hooks/adapter/runtime-telemetry.js +307 -6
- package/dist/core/hooks/cli.js +380 -207
- package/dist/core/hooks/effects/image-capture.d.ts +1 -1
- package/dist/core/hooks/effects/image-capture.d.ts.map +1 -1
- package/dist/core/hooks/effects/image-capture.js +4 -2
- package/dist/core/hooks/health.d.ts +59 -0
- package/dist/core/hooks/health.d.ts.map +1 -0
- package/dist/core/hooks/health.js +84 -0
- package/dist/core/hooks/remediation-cap.d.ts +8 -3
- package/dist/core/hooks/remediation-cap.d.ts.map +1 -1
- package/dist/core/hooks/remediation-cap.js +3 -11
- package/dist/core/hooks/resolve/coord-root.d.ts +22 -9
- package/dist/core/hooks/resolve/coord-root.d.ts.map +1 -1
- package/dist/core/hooks/resolve/coord-root.js +92 -11
- package/dist/core/hooks/resolve/owner.d.ts.map +1 -1
- package/dist/core/hooks/resolve/owner.js +5 -0
- package/dist/core/hooks/resolve/transcript.d.ts +8 -0
- package/dist/core/hooks/resolve/transcript.d.ts.map +1 -1
- package/dist/core/hooks/resolve/transcript.js +11 -0
- package/dist/core/inbox/contract.d.ts +64 -0
- package/dist/core/inbox/contract.d.ts.map +1 -0
- package/dist/core/inbox/contract.js +13 -0
- package/dist/core/inbox/index.d.ts +5 -0
- package/dist/core/inbox/index.d.ts.map +1 -0
- package/dist/core/inbox/index.js +4 -0
- package/dist/core/inbox/lifecycle.d.ts +22 -0
- package/dist/core/inbox/lifecycle.d.ts.map +1 -0
- package/dist/core/inbox/lifecycle.js +41 -0
- package/dist/core/inbox/service.d.ts +36 -0
- package/dist/core/inbox/service.d.ts.map +1 -0
- package/dist/core/inbox/service.js +210 -0
- package/dist/core/inbox/watcher.d.ts +7 -0
- package/dist/core/inbox/watcher.d.ts.map +1 -0
- package/dist/core/inbox/watcher.js +26 -0
- package/dist/core/presence/codec-digest.d.ts.map +1 -1
- package/dist/core/presence/codec-digest.js +14 -3
- package/dist/core/presence/relay-client.d.ts +1 -0
- package/dist/core/presence/relay-client.d.ts.map +1 -1
- package/dist/core/presence/relay-client.js +52 -8
- package/dist/core/resources/contract.d.ts +90 -0
- package/dist/core/resources/contract.d.ts.map +1 -0
- package/dist/core/resources/contract.js +2 -0
- package/dist/core/resources/index.d.ts +6 -0
- package/dist/core/resources/index.d.ts.map +1 -0
- package/dist/core/resources/index.js +5 -0
- package/dist/core/resources/sampler.d.ts +27 -0
- package/dist/core/resources/sampler.d.ts.map +1 -0
- package/dist/core/resources/sampler.js +357 -0
- package/dist/core/resources/service-status.d.ts +3 -0
- package/dist/core/resources/service-status.d.ts.map +1 -0
- package/dist/core/resources/service-status.js +48 -0
- package/dist/core/resources/service.d.ts +26 -0
- package/dist/core/resources/service.d.ts.map +1 -0
- package/dist/core/resources/service.js +292 -0
- package/dist/core/resources/storage.d.ts +13 -0
- package/dist/core/resources/storage.d.ts.map +1 -0
- package/dist/core/resources/storage.js +30 -0
- package/dist/core/semantic/adapters.d.ts +11 -8
- package/dist/core/semantic/adapters.d.ts.map +1 -1
- package/dist/core/semantic/adapters.js +169 -31
- package/dist/core/semantic/contract.d.ts +532 -48
- package/dist/core/semantic/contract.d.ts.map +1 -1
- package/dist/core/semantic/contract.js +104 -3
- package/dist/core/semantic/index.d.ts +7 -3
- package/dist/core/semantic/index.d.ts.map +1 -1
- package/dist/core/semantic/index.js +7 -3
- package/dist/core/semantic/once.d.ts +6 -1
- package/dist/core/semantic/once.d.ts.map +1 -1
- package/dist/core/semantic/once.js +80 -9
- package/dist/core/semantic/prompt.d.ts.map +1 -1
- package/dist/core/semantic/prompt.js +14 -1
- package/dist/core/semantic/review.d.ts +144 -0
- package/dist/core/semantic/review.d.ts.map +1 -0
- package/dist/core/semantic/review.js +544 -0
- package/dist/core/semantic/routes.d.ts +10 -0
- package/dist/core/semantic/routes.d.ts.map +1 -0
- package/dist/core/semantic/routes.js +21 -0
- package/dist/core/semantic/scheduler.d.ts +14 -3
- package/dist/core/semantic/scheduler.d.ts.map +1 -1
- package/dist/core/semantic/scheduler.js +30 -6
- package/dist/core/semantic/service-status.d.ts +20 -0
- package/dist/core/semantic/service-status.d.ts.map +1 -1
- package/dist/core/semantic/service-status.js +60 -4
- package/dist/core/semantic/service.d.ts +1 -0
- package/dist/core/semantic/service.d.ts.map +1 -1
- package/dist/core/semantic/service.js +104 -15
- package/dist/core/semantic/soak.d.ts +75 -0
- package/dist/core/semantic/soak.d.ts.map +1 -0
- package/dist/core/semantic/soak.js +476 -0
- package/dist/core/semantic/storage.d.ts +11 -1
- package/dist/core/semantic/storage.d.ts.map +1 -1
- package/dist/core/semantic/storage.js +4 -3
- package/dist/core/semantic/usage.d.ts +43 -0
- package/dist/core/semantic/usage.d.ts.map +1 -0
- package/dist/core/semantic/usage.js +193 -0
- package/dist/core/semantic/validate.d.ts +3 -1
- package/dist/core/semantic/validate.d.ts.map +1 -1
- package/dist/core/semantic/validate.js +34 -1
- package/dist/core/storage/atomic-json.d.ts +3 -0
- package/dist/core/storage/atomic-json.d.ts.map +1 -0
- package/dist/core/storage/atomic-json.js +15 -0
- package/dist/core/storage/buffer.d.ts +28 -0
- package/dist/core/storage/buffer.d.ts.map +1 -0
- package/dist/core/storage/buffer.js +101 -0
- package/dist/core/storage/builtins.d.ts +3 -0
- package/dist/core/storage/builtins.d.ts.map +1 -0
- package/dist/core/storage/builtins.js +722 -0
- package/dist/core/storage/catalog.d.ts +19 -0
- package/dist/core/storage/catalog.d.ts.map +1 -0
- package/dist/core/storage/catalog.js +365 -0
- package/dist/core/storage/config.d.ts +16 -0
- package/dist/core/storage/config.d.ts.map +1 -0
- package/dist/core/storage/config.js +311 -0
- package/dist/core/storage/contract.d.ts +275 -0
- package/dist/core/storage/contract.d.ts.map +1 -0
- package/dist/core/storage/contract.js +3 -0
- package/dist/core/storage/durable-history.d.ts +36 -0
- package/dist/core/storage/durable-history.d.ts.map +1 -0
- package/dist/core/storage/durable-history.js +606 -0
- package/dist/core/storage/health.d.ts +4 -0
- package/dist/core/storage/health.d.ts.map +1 -0
- package/dist/core/storage/health.js +65 -0
- package/dist/core/storage/index.d.ts +16 -0
- package/dist/core/storage/index.d.ts.map +1 -0
- package/dist/core/storage/index.js +15 -0
- package/dist/core/storage/inventory.d.ts +25 -0
- package/dist/core/storage/inventory.d.ts.map +1 -0
- package/dist/core/storage/inventory.js +666 -0
- package/dist/core/storage/jsonl.d.ts +52 -0
- package/dist/core/storage/jsonl.d.ts.map +1 -0
- package/dist/core/storage/jsonl.js +156 -0
- package/dist/core/storage/log-retention.d.ts +52 -0
- package/dist/core/storage/log-retention.d.ts.map +1 -0
- package/dist/core/storage/log-retention.js +419 -0
- package/dist/core/storage/logger.d.ts +84 -0
- package/dist/core/storage/logger.d.ts.map +1 -0
- package/dist/core/storage/logger.js +413 -0
- package/dist/core/storage/maintenance-providers.d.ts +26 -0
- package/dist/core/storage/maintenance-providers.d.ts.map +1 -0
- package/dist/core/storage/maintenance-providers.js +141 -0
- package/dist/core/storage/maintenance.d.ts +125 -0
- package/dist/core/storage/maintenance.d.ts.map +1 -0
- package/dist/core/storage/maintenance.js +609 -0
- package/dist/core/storage/metrics.d.ts +60 -0
- package/dist/core/storage/metrics.d.ts.map +1 -0
- package/dist/core/storage/metrics.js +134 -0
- package/dist/core/storage/policy.d.ts +7 -0
- package/dist/core/storage/policy.d.ts.map +1 -0
- package/dist/core/storage/policy.js +110 -0
- package/dist/core/storage/process-log.d.ts +38 -0
- package/dist/core/storage/process-log.d.ts.map +1 -0
- package/dist/core/storage/process-log.js +165 -0
- package/dist/core/storage/query.d.ts +48 -0
- package/dist/core/storage/query.d.ts.map +1 -0
- package/dist/core/storage/query.js +346 -0
- package/dist/core/storage/receipts.d.ts +23 -0
- package/dist/core/storage/receipts.d.ts.map +1 -0
- package/dist/core/storage/receipts.js +117 -0
- package/dist/core/storage/segments.d.ts +84 -0
- package/dist/core/storage/segments.d.ts.map +1 -0
- package/dist/core/storage/segments.js +542 -0
- package/dist/core/storage/sink-graph.d.ts +65 -0
- package/dist/core/storage/sink-graph.d.ts.map +1 -0
- package/dist/core/storage/sink-graph.js +213 -0
- package/dist/core/storage/storm-control.d.ts +23 -0
- package/dist/core/storage/storm-control.d.ts.map +1 -0
- package/dist/core/storage/storm-control.js +59 -0
- package/dist/core/supervisor/activity.d.ts +4 -0
- package/dist/core/supervisor/activity.d.ts.map +1 -0
- package/dist/core/supervisor/activity.js +141 -0
- package/dist/core/supervisor/contract.d.ts +268 -0
- package/dist/core/supervisor/contract.d.ts.map +1 -0
- package/dist/core/supervisor/contract.js +35 -0
- package/dist/core/supervisor/explanations.d.ts +4 -0
- package/dist/core/supervisor/explanations.d.ts.map +1 -0
- package/dist/core/supervisor/explanations.js +71 -0
- package/dist/core/supervisor/findings.d.ts +20 -0
- package/dist/core/supervisor/findings.d.ts.map +1 -0
- package/dist/core/supervisor/findings.js +399 -0
- package/dist/core/supervisor/history.d.ts +9 -0
- package/dist/core/supervisor/history.d.ts.map +1 -0
- package/dist/core/supervisor/history.js +46 -0
- package/dist/core/supervisor/hook-health-alerts.d.ts +14 -0
- package/dist/core/supervisor/hook-health-alerts.d.ts.map +1 -0
- package/dist/core/supervisor/hook-health-alerts.js +70 -0
- package/dist/core/supervisor/hook-health-storage.d.ts +5 -0
- package/dist/core/supervisor/hook-health-storage.d.ts.map +1 -0
- package/dist/core/supervisor/hook-health-storage.js +24 -0
- package/dist/core/supervisor/hook-health.d.ts +72 -0
- package/dist/core/supervisor/hook-health.d.ts.map +1 -0
- package/dist/core/supervisor/hook-health.js +203 -0
- package/dist/core/supervisor/hooks.d.ts +10 -0
- package/dist/core/supervisor/hooks.d.ts.map +1 -0
- package/dist/core/supervisor/hooks.js +28 -0
- package/dist/core/supervisor/index.d.ts +15 -0
- package/dist/core/supervisor/index.d.ts.map +1 -0
- package/dist/core/supervisor/index.js +14 -0
- package/dist/core/supervisor/log-feed.d.ts +9 -0
- package/dist/core/supervisor/log-feed.d.ts.map +1 -0
- package/dist/core/supervisor/log-feed.js +103 -0
- package/dist/core/supervisor/service.d.ts +29 -0
- package/dist/core/supervisor/service.d.ts.map +1 -0
- package/dist/core/supervisor/service.js +450 -0
- package/dist/core/supervisor/services.d.ts +11 -0
- package/dist/core/supervisor/services.d.ts.map +1 -0
- package/dist/core/supervisor/services.js +155 -0
- package/dist/core/supervisor/status.d.ts +3 -0
- package/dist/core/supervisor/status.d.ts.map +1 -0
- package/dist/core/supervisor/status.js +48 -0
- package/dist/core/supervisor/storage.d.ts +30 -0
- package/dist/core/supervisor/storage.d.ts.map +1 -0
- package/dist/core/supervisor/storage.js +73 -0
- package/dist/core/supervisor/timeline.d.ts +3 -0
- package/dist/core/supervisor/timeline.d.ts.map +1 -0
- package/dist/core/supervisor/timeline.js +87 -0
- package/dist/core/work/state.d.ts.map +1 -1
- package/dist/core/work/state.js +10 -14
- package/dist/core/workflow/admission.d.ts +23 -0
- package/dist/core/workflow/admission.d.ts.map +1 -0
- package/dist/core/workflow/admission.js +136 -0
- package/dist/core/workflow/engine.d.ts.map +1 -1
- package/dist/core/workflow/engine.js +77 -2
- package/dist/core/workflow/index.d.ts +3 -2
- package/dist/core/workflow/index.d.ts.map +1 -1
- package/dist/core/workflow/index.js +2 -1
- package/dist/core/workflow/live-session-v3.d.ts.map +1 -1
- package/dist/core/workflow/live-session-v3.js +2 -1
- package/dist/core/workflow/proof.d.ts +2 -1
- package/dist/core/workflow/proof.d.ts.map +1 -1
- package/dist/core/workflow/proof.js +39 -1
- package/dist/core/workflow/run-state.d.ts +3 -2
- package/dist/core/workflow/run-state.d.ts.map +1 -1
- package/dist/core/workflow/run-state.js +8 -1
- package/dist/core/workflow/types.d.ts +33 -1
- package/dist/core/workflow/types.d.ts.map +1 -1
- package/dist/core/workflow/types.js +2 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/lazy-commands.d.ts +26 -0
- package/dist/lazy-commands.d.ts.map +1 -0
- package/dist/lazy-commands.js +210 -0
- package/dist/lib/browser/client.d.ts +5 -0
- package/dist/lib/browser/client.d.ts.map +1 -1
- package/dist/lib/browser/client.js +1 -0
- package/dist/lib/browser/index.d.ts +2 -0
- package/dist/lib/browser/index.d.ts.map +1 -1
- package/dist/lib/browser/index.js +2 -0
- package/dist/lib/browser/qa-run-contracts.d.ts +173 -0
- package/dist/lib/browser/qa-run-contracts.d.ts.map +1 -0
- package/dist/lib/browser/qa-run-contracts.js +226 -0
- package/dist/lib/browser/qa-run.d.ts +51 -0
- package/dist/lib/browser/qa-run.d.ts.map +1 -0
- package/dist/lib/browser/qa-run.js +684 -0
- package/dist/lib/coord-root-id.d.ts +9 -0
- package/dist/lib/coord-root-id.d.ts.map +1 -0
- package/dist/lib/coord-root-id.js +17 -0
- package/dist/lib/docs-lint.d.ts +2 -0
- package/dist/lib/docs-lint.d.ts.map +1 -1
- package/dist/lib/docs-lint.js +45 -80
- package/dist/lib/docs-metadata-audit.d.ts +3 -0
- package/dist/lib/docs-metadata-audit.d.ts.map +1 -1
- package/dist/lib/docs-metadata-audit.js +13 -23
- package/dist/lib/docs-metadata-sync.d.ts +1 -0
- package/dist/lib/docs-metadata-sync.d.ts.map +1 -1
- package/dist/lib/docs-metadata-sync.js +28 -10
- package/dist/lib/docs-repository-view.d.ts +22 -0
- package/dist/lib/docs-repository-view.d.ts.map +1 -0
- package/dist/lib/docs-repository-view.js +185 -0
- package/dist/lib/http/client.d.ts +11 -5
- package/dist/lib/http/client.d.ts.map +1 -1
- package/dist/lib/http/client.js +22 -4
- package/dist/lib/http/index.d.ts +1 -1
- package/dist/lib/http/index.d.ts.map +1 -1
- package/dist/lib/http/index.js +1 -1
- package/dist/lib/indexer-exclusions.d.ts +27 -0
- package/dist/lib/indexer-exclusions.d.ts.map +1 -0
- package/dist/lib/indexer-exclusions.js +176 -0
- package/dist/lib/instructions/apply.d.ts +3 -1
- package/dist/lib/instructions/apply.d.ts.map +1 -1
- package/dist/lib/instructions/apply.js +74 -3
- package/dist/lib/instructions/templates.d.ts.map +1 -1
- package/dist/lib/instructions/templates.js +11 -0
- package/dist/lib/local-file-url.d.ts +9 -0
- package/dist/lib/local-file-url.d.ts.map +1 -0
- package/dist/lib/local-file-url.js +20 -0
- package/dist/lib/web-performance.d.ts +118 -0
- package/dist/lib/web-performance.d.ts.map +1 -0
- package/dist/lib/web-performance.js +192 -0
- package/package.json +40 -2
- package/schemas/config.schema.json +58 -0
- package/schemas/event-v3.schema.json +324 -112
- package/src/commander.ts +488 -95
- package/src/commands/agents.ts +617 -237
- package/src/commands/artifacts.ts +40 -2
- package/src/commands/backup.ts +18 -14
- package/src/commands/browse-session.ts +12 -0
- package/src/commands/browse.ts +21 -7
- package/src/commands/conversations.ts +279 -0
- package/src/commands/deinit.ts +6 -0
- package/src/commands/diagnostics.ts +271 -0
- package/src/commands/docs.ts +25 -6
- package/src/commands/doctor.ts +75 -9
- package/src/commands/fetch.ts +7 -6
- package/src/commands/files.ts +243 -0
- package/src/commands/governor.ts +21 -12
- package/src/commands/inbox.ts +61 -0
- package/src/commands/init.ts +78 -16
- package/src/commands/ledger-v3.ts +503 -1
- package/src/commands/logs.ts +224 -0
- package/src/commands/messages.ts +61 -0
- package/src/commands/outline.ts +6 -2
- package/src/commands/qa-run.ts +184 -0
- package/src/commands/read.ts +6 -2
- package/src/commands/resources.ts +38 -0
- package/src/commands/semantic.ts +66 -1
- package/src/commands/storage.ts +310 -0
- package/src/commands/supervisor.ts +141 -0
- package/src/commands/tunnel.ts +66 -52
- package/src/commands/web.ts +96 -7
- package/src/commands/work.ts +3 -3
- package/src/commands/workflow.ts +21 -13
- package/src/core/agents/cli.ts +265 -55
- package/src/core/agents/health.ts +142 -0
- package/src/core/agents/live-authority-v3.ts +341 -10
- package/src/core/agents/live-lifecycle-v3.ts +6 -1
- package/src/core/agents/live-observation-v3.ts +6 -1
- package/src/core/agents/mailbox.ts +373 -0
- package/src/core/agents/reconcile-coordination-v3.ts +77 -0
- package/src/core/agents/render/prompt-context.ts +66 -15
- package/src/core/agents/render/session-context.ts +37 -3
- package/src/core/agents/rules/commit-conflict.ts +58 -1
- package/src/core/agents/rules/stop-hook.ts +105 -20
- package/src/core/agents/rules/verdict.ts +1 -0
- package/src/core/agents/session-events.ts +4 -0
- package/src/core/agents/session-finalization-state-v3.ts +1 -1
- package/src/core/agents/session-finalizer-v3.ts +8 -2
- package/src/core/agents/state/activity-log.ts +7 -2
- package/src/core/agents/state/heartbeat-writer.ts +27 -0
- package/src/core/agents/state/live-coordination-view.ts +16 -105
- package/src/core/agents/state/live-coordination-writer.ts +141 -0
- package/src/core/artifacts/index.ts +260 -11
- package/src/core/config.ts +235 -5
- package/src/core/conversations/archive.ts +237 -0
- package/src/core/conversations/catalog.ts +79 -0
- package/src/core/conversations/context-pack.ts +72 -0
- package/src/core/conversations/contract.ts +178 -0
- package/src/core/conversations/evaluation.ts +30 -0
- package/src/core/conversations/index.ts +9 -0
- package/src/core/conversations/lifecycle.ts +63 -0
- package/src/core/conversations/normalize.ts +105 -0
- package/src/core/conversations/query.ts +318 -0
- package/src/core/conversations/search-index.ts +48 -0
- package/src/core/diagnostics/advice.ts +147 -0
- package/src/core/diagnostics/bundle.ts +1142 -0
- package/src/core/diagnostics/comparison.ts +565 -0
- package/src/core/diagnostics/contract.ts +311 -0
- package/src/core/diagnostics/identity.ts +11 -0
- package/src/core/diagnostics/index.ts +7 -0
- package/src/core/diagnostics/replay.ts +314 -0
- package/src/core/diagnostics/sanitize.ts +97 -0
- package/src/core/events/legacy-storage/canary.ts +177 -0
- package/src/core/events/legacy-storage/compression.ts +130 -0
- package/src/core/events/legacy-storage/fence.ts +129 -0
- package/src/core/events/legacy-storage/index.ts +6 -0
- package/src/core/events/legacy-storage/inventory.ts +51 -0
- package/src/core/events/legacy-storage/manifest.ts +136 -0
- package/src/core/events/legacy-storage/reader.ts +178 -0
- package/src/core/events/v3/archive-retention.ts +251 -0
- package/src/core/events/v3/authority-outbox.ts +22 -1
- package/src/core/events/v3/base-contract.ts +17 -7
- package/src/core/events/v3/bootstrap.ts +195 -2
- package/src/core/events/v3/capabilities.ts +5 -3
- package/src/core/events/v3/control-witness.ts +339 -0
- package/src/core/events/v3/control-writer.ts +16 -0
- package/src/core/events/v3/control.ts +54 -18
- package/src/core/events/v3/coordination-transaction-recovery.ts +477 -0
- package/src/core/events/v3/coordination-view.ts +17 -1
- package/src/core/events/v3/generated.ts +1 -1
- package/src/core/events/v3/index.ts +14 -2
- package/src/core/events/v3/live-route-observer.ts +80 -0
- package/src/core/events/v3/live-routing.ts +65 -46
- package/src/core/events/v3/producers/coordination-recorder.ts +95 -10
- package/src/core/events/v3/producers/diagnostic-summaries.ts +593 -0
- package/src/core/events/v3/producers/hook-base.ts +15 -3
- package/src/core/events/v3/producers/intake.ts +31 -2
- package/src/core/events/v3/producers/producer-state-observer.ts +52 -0
- package/src/core/events/v3/producers/recorder.ts +681 -34
- package/src/core/events/v3/reader.ts +243 -2
- package/src/core/events/v3/rotation-config.ts +98 -0
- package/src/core/events/v3/runtime-build.ts +41 -0
- package/src/core/events/v3/runtime-identity.ts +16 -0
- package/src/core/events/v3/runtime-telemetry-capabilities.ts +14 -8
- package/src/core/events/v3/support-storage/classify.ts +209 -0
- package/src/core/events/v3/support-storage/eligibility.ts +58 -0
- package/src/core/events/v3/support-storage/index.ts +9 -0
- package/src/core/events/v3/support-storage/inventory.ts +135 -0
- package/src/core/events/v3/support-storage/logical-authority.ts +117 -0
- package/src/core/events/v3/support-storage/maintenance.ts +501 -0
- package/src/core/events/v3/support-storage/pack-contract.ts +337 -0
- package/src/core/events/v3/support-storage/pack-reader.ts +346 -0
- package/src/core/events/v3/support-storage/pack-writer.ts +352 -0
- package/src/core/events/v3/support-storage/recovery.ts +43 -0
- package/src/core/events/v3/turn-telemetry.ts +58 -7
- package/src/core/events/v3/writer.ts +168 -16
- package/src/core/governor/plan-read.ts +5 -18
- package/src/core/governor/planning.ts +5 -8
- package/src/core/governor/service-read.ts +320 -2
- package/src/core/governor/service.ts +49 -22
- package/src/core/guard/evidence-v3.ts +1 -0
- package/src/core/hooks/adapter/events.ts +1 -0
- package/src/core/hooks/adapter/output.ts +23 -5
- package/src/core/hooks/adapter/runtime-telemetry.ts +408 -13
- package/src/core/hooks/cli.ts +404 -233
- package/src/core/hooks/effects/image-capture.ts +4 -1
- package/src/core/hooks/health.ts +146 -0
- package/src/core/hooks/remediation-cap.ts +12 -6
- package/src/core/hooks/resolve/coord-root.ts +91 -11
- package/src/core/hooks/resolve/owner.ts +4 -0
- package/src/core/hooks/resolve/transcript.ts +18 -0
- package/src/core/inbox/contract.ts +81 -0
- package/src/core/inbox/index.ts +4 -0
- package/src/core/inbox/lifecycle.ts +104 -0
- package/src/core/inbox/service.ts +305 -0
- package/src/core/inbox/watcher.ts +36 -0
- package/src/core/presence/codec-digest.ts +15 -9
- package/src/core/presence/relay-client.ts +55 -7
- package/src/core/resources/contract.ts +98 -0
- package/src/core/resources/index.ts +5 -0
- package/src/core/resources/sampler.ts +458 -0
- package/src/core/resources/service-status.ts +62 -0
- package/src/core/resources/service.ts +337 -0
- package/src/core/resources/storage.ts +44 -0
- package/src/core/semantic/adapters.ts +200 -41
- package/src/core/semantic/contract.ts +135 -3
- package/src/core/semantic/index.ts +76 -2
- package/src/core/semantic/once.ts +93 -7
- package/src/core/semantic/prompt.ts +13 -1
- package/src/core/semantic/review.ts +803 -0
- package/src/core/semantic/routes.ts +30 -0
- package/src/core/semantic/scheduler.ts +49 -5
- package/src/core/semantic/service-status.ts +99 -5
- package/src/core/semantic/service.ts +116 -15
- package/src/core/semantic/soak.ts +638 -0
- package/src/core/semantic/storage.ts +20 -6
- package/src/core/semantic/usage.ts +272 -0
- package/src/core/semantic/validate.ts +31 -0
- package/src/core/storage/atomic-json.ts +15 -0
- package/src/core/storage/buffer.ts +124 -0
- package/src/core/storage/builtins.ts +972 -0
- package/src/core/storage/catalog.ts +467 -0
- package/src/core/storage/config.ts +423 -0
- package/src/core/storage/contract.ts +342 -0
- package/src/core/storage/durable-history.ts +738 -0
- package/src/core/storage/health.ts +76 -0
- package/src/core/storage/index.ts +15 -0
- package/src/core/storage/inventory.ts +859 -0
- package/src/core/storage/jsonl.ts +213 -0
- package/src/core/storage/log-retention.ts +555 -0
- package/src/core/storage/logger.ts +548 -0
- package/src/core/storage/maintenance-providers.ts +200 -0
- package/src/core/storage/maintenance.ts +929 -0
- package/src/core/storage/metrics.ts +199 -0
- package/src/core/storage/policy.ts +141 -0
- package/src/core/storage/process-log.ts +203 -0
- package/src/core/storage/query.ts +418 -0
- package/src/core/storage/receipts.ts +162 -0
- package/src/core/storage/segments.ts +721 -0
- package/src/core/storage/sink-graph.ts +343 -0
- package/src/core/storage/storm-control.ts +91 -0
- package/src/core/supervisor/activity.ts +193 -0
- package/src/core/supervisor/contract.ts +312 -0
- package/src/core/supervisor/explanations.ts +104 -0
- package/src/core/supervisor/findings.ts +788 -0
- package/src/core/supervisor/history.ts +61 -0
- package/src/core/supervisor/hook-health-alerts.ts +108 -0
- package/src/core/supervisor/hook-health-storage.ts +25 -0
- package/src/core/supervisor/hook-health.ts +301 -0
- package/src/core/supervisor/hooks.ts +35 -0
- package/src/core/supervisor/index.ts +14 -0
- package/src/core/supervisor/log-feed.ts +131 -0
- package/src/core/supervisor/service.ts +511 -0
- package/src/core/supervisor/services.ts +203 -0
- package/src/core/supervisor/status.ts +59 -0
- package/src/core/supervisor/storage.ts +126 -0
- package/src/core/supervisor/timeline.ts +133 -0
- package/src/core/work/state.ts +12 -21
- package/src/core/workflow/admission.ts +215 -0
- package/src/core/workflow/engine.ts +93 -1
- package/src/core/workflow/index.ts +10 -0
- package/src/core/workflow/live-session-v3.ts +2 -4
- package/src/core/workflow/proof.ts +54 -1
- package/src/core/workflow/run-state.ts +13 -1
- package/src/core/workflow/types.ts +39 -1
- package/src/index.ts +2 -0
- package/src/lazy-commands.ts +294 -0
- package/src/lib/browser/client.ts +6 -0
- package/src/lib/browser/index.ts +29 -0
- package/src/lib/browser/qa-run-contracts.ts +380 -0
- package/src/lib/browser/qa-run.ts +784 -0
- package/src/lib/coord-root-id.ts +23 -0
- package/src/lib/docs-lint.ts +58 -77
- package/src/lib/docs-metadata-audit.ts +26 -21
- package/src/lib/docs-metadata-sync.ts +32 -9
- package/src/lib/docs-repository-view.ts +220 -0
- package/src/lib/http/client.ts +44 -8
- package/src/lib/http/index.ts +6 -1
- package/src/lib/indexer-exclusions.ts +173 -0
- package/src/lib/instructions/apply.ts +81 -2
- package/src/lib/instructions/templates.ts +11 -0
- package/src/lib/local-file-url.ts +31 -0
- package/src/lib/web-performance.ts +335 -0
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
const SENSITIVE_KEY =
|
|
2
|
+
/(?:authorization|cookie|credential|password|passwd|private[_-]?key|secret|session[_-]?token|access[_-]?token|refresh[_-]?token|api[_-]?key)/i;
|
|
3
|
+
const OMITTED_CONTENT_KEY =
|
|
4
|
+
/(?:^|[_-])(?:environment|env|prompt|prompts|tool[_-]?payload|tool[_-]?result|transcript|transcripts)(?:$|[_-])/i;
|
|
5
|
+
const HOME_PATH = /(?:[A-Za-z]:\\Users\\[^\\\s]+|\/home\/[^/\s]+|\/Users\/[^/\s]+)/g;
|
|
6
|
+
const BEARER_VALUE = /\bBearer\s+[A-Za-z0-9._~+/-]+=*/gi;
|
|
7
|
+
const URL_CREDENTIALS = /([a-z][a-z0-9+.-]*:\/\/)[^\s/@:]+:[^\s/@]+@/gi;
|
|
8
|
+
const PRIVATE_KEY = /-----BEGIN [A-Z ]*PRIVATE KEY-----[\s\S]*?-----END [A-Z ]*PRIVATE KEY-----/g;
|
|
9
|
+
const TOKENISH_VALUE = /\b(?:sk|pk|ghp|github_pat|xox[baprs])[-_][A-Za-z0-9_-]{16,}\b/g;
|
|
10
|
+
const AWS_ACCESS_KEY = /\bAKIA[A-Z0-9]{16,}\b/g;
|
|
11
|
+
const SENSITIVE_QUERY = /([?&](?:access_token|api_key|key|password|secret|token)=)[^&#\s]+/gi;
|
|
12
|
+
const SENSITIVE_ENV = /(\b[A-Z0-9_]*(?:API_KEY|PASSWORD|SECRET|TOKEN)=)[^\s]+/g;
|
|
13
|
+
const SENSITIVE_ARGUMENT = /(\B--?(?:access-token|api-key|password|secret|token)\s+)[^\s]+/gi;
|
|
14
|
+
|
|
15
|
+
export interface SanitizationStats {
|
|
16
|
+
sanitized_value_count: number;
|
|
17
|
+
omitted_value_count: number;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export function sanitizeDiagnosticValue(value: unknown): {
|
|
21
|
+
value: unknown;
|
|
22
|
+
stats: SanitizationStats;
|
|
23
|
+
} {
|
|
24
|
+
const stats: SanitizationStats = { sanitized_value_count: 0, omitted_value_count: 0 };
|
|
25
|
+
return { value: sanitize(value, stats, 0), stats };
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
function sanitize(value: unknown, stats: SanitizationStats, depth: number): unknown {
|
|
29
|
+
if (depth > 24) {
|
|
30
|
+
stats.omitted_value_count += 1;
|
|
31
|
+
return "[OMITTED:depth-limit]";
|
|
32
|
+
}
|
|
33
|
+
if (value === null || typeof value === "boolean" || typeof value === "number") return value;
|
|
34
|
+
if (typeof value === "string") return sanitizeString(value, stats);
|
|
35
|
+
if (Array.isArray(value)) {
|
|
36
|
+
const sliced = value.slice(0, 5_000);
|
|
37
|
+
const kept = sliced.map((item, index) => {
|
|
38
|
+
if (
|
|
39
|
+
typeof sliced[index - 1] === "string" &&
|
|
40
|
+
/^(?:--?)(?:access-token|api-key|password|secret|token)$/i.test(sliced[index - 1] as string)
|
|
41
|
+
) {
|
|
42
|
+
stats.sanitized_value_count += 1;
|
|
43
|
+
return "[REDACTED:argument]";
|
|
44
|
+
}
|
|
45
|
+
return sanitize(item, stats, depth + 1);
|
|
46
|
+
});
|
|
47
|
+
if (kept.length !== value.length) stats.omitted_value_count += value.length - kept.length;
|
|
48
|
+
return kept;
|
|
49
|
+
}
|
|
50
|
+
if (!value || typeof value !== "object") return String(value);
|
|
51
|
+
|
|
52
|
+
const result: Record<string, unknown> = {};
|
|
53
|
+
const entries = Object.entries(value);
|
|
54
|
+
const namedSensitiveField = entries.some(
|
|
55
|
+
([key, item]) => key === "name" && typeof item === "string" && SENSITIVE_KEY.test(item),
|
|
56
|
+
);
|
|
57
|
+
for (const [key, item] of entries) {
|
|
58
|
+
if (OMITTED_CONTENT_KEY.test(key)) {
|
|
59
|
+
result[key] = "[OMITTED:sensitive-content]";
|
|
60
|
+
stats.omitted_value_count += 1;
|
|
61
|
+
continue;
|
|
62
|
+
}
|
|
63
|
+
if (key === "value" && namedSensitiveField) {
|
|
64
|
+
result[key] = "[REDACTED:sensitive-field]";
|
|
65
|
+
stats.sanitized_value_count += 1;
|
|
66
|
+
continue;
|
|
67
|
+
}
|
|
68
|
+
if (SENSITIVE_KEY.test(key)) {
|
|
69
|
+
result[key] = "[REDACTED:sensitive-field]";
|
|
70
|
+
stats.sanitized_value_count += 1;
|
|
71
|
+
continue;
|
|
72
|
+
}
|
|
73
|
+
result[key] = sanitize(item, stats, depth + 1);
|
|
74
|
+
}
|
|
75
|
+
return result;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
function sanitizeString(value: string, stats: SanitizationStats): string {
|
|
79
|
+
let next = value;
|
|
80
|
+
const replacements: Array<[RegExp, string | ((...args: string[]) => string)]> = [
|
|
81
|
+
[PRIVATE_KEY, "[REDACTED:private-key]"],
|
|
82
|
+
[BEARER_VALUE, "Bearer [REDACTED:token]"],
|
|
83
|
+
[TOKENISH_VALUE, "[REDACTED:token]"],
|
|
84
|
+
[AWS_ACCESS_KEY, "[REDACTED:access-key]"],
|
|
85
|
+
[SENSITIVE_QUERY, "$1[REDACTED]"],
|
|
86
|
+
[SENSITIVE_ENV, "$1[REDACTED]"],
|
|
87
|
+
[SENSITIVE_ARGUMENT, "$1[REDACTED]"],
|
|
88
|
+
[URL_CREDENTIALS, (_match, scheme: string) => `${scheme}[REDACTED]@`],
|
|
89
|
+
[HOME_PATH, "[REDACTED:home]"],
|
|
90
|
+
];
|
|
91
|
+
for (const [pattern, replacement] of replacements) {
|
|
92
|
+
const replaced = next.replace(pattern, replacement as never);
|
|
93
|
+
if (replaced !== next) stats.sanitized_value_count += 1;
|
|
94
|
+
next = replaced;
|
|
95
|
+
}
|
|
96
|
+
return next;
|
|
97
|
+
}
|
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
import { createHash } from "node:crypto";
|
|
2
|
+
import { constants, createReadStream, createWriteStream } from "node:fs";
|
|
3
|
+
import { chmod, lstat, mkdir, open, rename, rm } from "node:fs/promises";
|
|
4
|
+
import { basename, join, resolve } from "node:path";
|
|
5
|
+
import { pipeline } from "node:stream/promises";
|
|
6
|
+
import { createGzip } from "node:zlib";
|
|
7
|
+
import { canonicalJsonV3 } from "../v3/canonical.ts";
|
|
8
|
+
import { verifyLegacyV1HardFence } from "./fence.ts";
|
|
9
|
+
import { type LegacyV1SegmentManifest, validateLegacyV1SegmentManifest } from "./manifest.ts";
|
|
10
|
+
import { streamLegacyV1Rows } from "./reader.ts";
|
|
11
|
+
|
|
12
|
+
export interface LegacyV1CanaryResult {
|
|
13
|
+
manifest: LegacyV1SegmentManifest;
|
|
14
|
+
manifest_path: string;
|
|
15
|
+
payload_path: string;
|
|
16
|
+
source_unchanged: true;
|
|
17
|
+
replacement_enabled: false;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
/** Shadow-compress one fenced legacy segment, then prove byte and row parity. */
|
|
21
|
+
export async function writeLegacyV1Canary(input: {
|
|
22
|
+
coord_root: string;
|
|
23
|
+
source_filename: string;
|
|
24
|
+
output_directory: string;
|
|
25
|
+
minimum_harnery_version: string;
|
|
26
|
+
created_at: string;
|
|
27
|
+
}): Promise<LegacyV1CanaryResult> {
|
|
28
|
+
await verifyLegacyV1HardFence(input.coord_root);
|
|
29
|
+
if (
|
|
30
|
+
!/^events.+\.ndjson$/.test(input.source_filename) ||
|
|
31
|
+
input.source_filename.includes("/") ||
|
|
32
|
+
input.source_filename.includes("\\")
|
|
33
|
+
) {
|
|
34
|
+
throw new Error("legacy_v1_canary_source_name_invalid");
|
|
35
|
+
}
|
|
36
|
+
const harnery = resolve(input.coord_root, ".harnery");
|
|
37
|
+
const source = join(harnery, input.source_filename);
|
|
38
|
+
const sourceStat = await lstat(source);
|
|
39
|
+
if (!sourceStat.isFile() || sourceStat.isSymbolicLink()) {
|
|
40
|
+
throw new Error("legacy_v1_canary_source_not_regular");
|
|
41
|
+
}
|
|
42
|
+
const sourceDigest = await hashFile(source);
|
|
43
|
+
const sourceFacts = await inspectRows(source);
|
|
44
|
+
const segmentId = `v1s_${createHash("sha256")
|
|
45
|
+
.update(`${input.source_filename}\0${sourceStat.size}\0${sourceDigest}`)
|
|
46
|
+
.digest("hex")
|
|
47
|
+
.slice(0, 32)}` as const;
|
|
48
|
+
const outputDirectory = resolve(input.output_directory);
|
|
49
|
+
await mkdir(outputDirectory, { recursive: true, mode: 0o700 });
|
|
50
|
+
await chmod(outputDirectory, 0o700);
|
|
51
|
+
const payloadPath = join(outputDirectory, `${segmentId}.ndjson.gz`);
|
|
52
|
+
const manifestPath = join(outputDirectory, `${segmentId}.manifest.json`);
|
|
53
|
+
const partialPayload = `${payloadPath}.partial`;
|
|
54
|
+
const partialManifest = `${manifestPath}.partial`;
|
|
55
|
+
await rejectExisting([payloadPath, manifestPath, partialPayload, partialManifest]);
|
|
56
|
+
try {
|
|
57
|
+
await pipeline(
|
|
58
|
+
createReadStream(source),
|
|
59
|
+
createGzip({ level: 9 }),
|
|
60
|
+
createWriteStream(partialPayload, { flags: "wx", mode: 0o600 }),
|
|
61
|
+
);
|
|
62
|
+
await rename(partialPayload, payloadPath);
|
|
63
|
+
const payloadStat = await lstat(payloadPath);
|
|
64
|
+
const manifest = validateLegacyV1SegmentManifest({
|
|
65
|
+
format: "harnery-legacy-v1-segment",
|
|
66
|
+
format_version: 1,
|
|
67
|
+
segment_id: segmentId,
|
|
68
|
+
source: {
|
|
69
|
+
filename: input.source_filename,
|
|
70
|
+
bytes: sourceStat.size,
|
|
71
|
+
digest: sourceDigest,
|
|
72
|
+
row_count: sourceFacts.rows,
|
|
73
|
+
minimum_recorded_at: sourceFacts.minimum,
|
|
74
|
+
maximum_recorded_at: sourceFacts.maximum,
|
|
75
|
+
},
|
|
76
|
+
payload: {
|
|
77
|
+
algorithm: "gzip",
|
|
78
|
+
path: basename(payloadPath),
|
|
79
|
+
bytes: payloadStat.size,
|
|
80
|
+
digest: await hashFile(payloadPath),
|
|
81
|
+
},
|
|
82
|
+
minimum_harnery_version: input.minimum_harnery_version,
|
|
83
|
+
created_at: input.created_at,
|
|
84
|
+
});
|
|
85
|
+
const handle = await open(
|
|
86
|
+
partialManifest,
|
|
87
|
+
constants.O_WRONLY | constants.O_CREAT | constants.O_EXCL,
|
|
88
|
+
0o600,
|
|
89
|
+
);
|
|
90
|
+
try {
|
|
91
|
+
await handle.writeFile(`${canonicalJsonV3(manifest)}\n`, "utf8");
|
|
92
|
+
await handle.sync();
|
|
93
|
+
} finally {
|
|
94
|
+
await handle.close();
|
|
95
|
+
}
|
|
96
|
+
await rename(partialManifest, manifestPath);
|
|
97
|
+
await proveRowParity(source, manifestPath);
|
|
98
|
+
const after = await lstat(source);
|
|
99
|
+
if (after.size !== sourceStat.size || (await hashFile(source)) !== sourceDigest) {
|
|
100
|
+
throw new Error("legacy_v1_canary_source_changed");
|
|
101
|
+
}
|
|
102
|
+
return {
|
|
103
|
+
manifest,
|
|
104
|
+
manifest_path: manifestPath,
|
|
105
|
+
payload_path: payloadPath,
|
|
106
|
+
source_unchanged: true,
|
|
107
|
+
replacement_enabled: false,
|
|
108
|
+
};
|
|
109
|
+
} catch (error) {
|
|
110
|
+
await rm(partialPayload, { force: true });
|
|
111
|
+
await rm(partialManifest, { force: true });
|
|
112
|
+
await rm(payloadPath, { force: true });
|
|
113
|
+
await rm(manifestPath, { force: true });
|
|
114
|
+
throw error;
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
export function activateLegacyV1CanaryReplacement(): never {
|
|
119
|
+
throw new Error("legacy_v1_replacement_activation_disabled");
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
async function inspectRows(
|
|
123
|
+
path: string,
|
|
124
|
+
): Promise<{ rows: number; minimum: string | null; maximum: string | null }> {
|
|
125
|
+
let rows = 0;
|
|
126
|
+
const timestamps: string[] = [];
|
|
127
|
+
for await (const row of streamLegacyV1Rows(path)) {
|
|
128
|
+
rows += 1;
|
|
129
|
+
const value = JSON.parse(row.bytes.toString("utf8")) as Record<string, unknown>;
|
|
130
|
+
const candidate =
|
|
131
|
+
typeof value.at === "string"
|
|
132
|
+
? value.at
|
|
133
|
+
: typeof value.timestamp === "string"
|
|
134
|
+
? value.timestamp
|
|
135
|
+
: value.time &&
|
|
136
|
+
typeof value.time === "object" &&
|
|
137
|
+
typeof (value.time as Record<string, unknown>).observed_at === "string"
|
|
138
|
+
? ((value.time as Record<string, unknown>).observed_at as string)
|
|
139
|
+
: undefined;
|
|
140
|
+
if (candidate && Number.isFinite(Date.parse(candidate)))
|
|
141
|
+
timestamps.push(new Date(candidate).toISOString());
|
|
142
|
+
}
|
|
143
|
+
timestamps.sort();
|
|
144
|
+
return { rows, minimum: timestamps[0] ?? null, maximum: timestamps.at(-1) ?? null };
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
async function proveRowParity(loose: string, manifest: string): Promise<void> {
|
|
148
|
+
const left = streamLegacyV1Rows(loose)[Symbol.asyncIterator]();
|
|
149
|
+
const right = streamLegacyV1Rows(manifest)[Symbol.asyncIterator]();
|
|
150
|
+
while (true) {
|
|
151
|
+
const [looseRow, packedRow] = await Promise.all([left.next(), right.next()]);
|
|
152
|
+
if (looseRow.done || packedRow.done) {
|
|
153
|
+
if (looseRow.done !== packedRow.done) throw new Error("legacy_v1_canary_row_count_mismatch");
|
|
154
|
+
break;
|
|
155
|
+
}
|
|
156
|
+
if (!looseRow.value.bytes.equals(packedRow.value.bytes)) {
|
|
157
|
+
throw new Error(`legacy_v1_canary_row_mismatch:${looseRow.value.row_number}`);
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
async function hashFile(path: string): Promise<`sha256:${string}`> {
|
|
163
|
+
const hash = createHash("sha256");
|
|
164
|
+
for await (const current of createReadStream(path)) hash.update(current as Buffer);
|
|
165
|
+
return `sha256:${hash.digest("hex")}`;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
async function rejectExisting(paths: string[]): Promise<void> {
|
|
169
|
+
for (const path of paths) {
|
|
170
|
+
try {
|
|
171
|
+
await lstat(path);
|
|
172
|
+
throw new Error("legacy_v1_canary_output_exists");
|
|
173
|
+
} catch (error) {
|
|
174
|
+
if ((error as NodeJS.ErrnoException).code !== "ENOENT") throw error;
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
}
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
/** Verified in-place compression for sealed, non-terminal legacy V1 shards. */
|
|
2
|
+
|
|
3
|
+
import { createReadStream, createWriteStream } from "node:fs";
|
|
4
|
+
import { chmod, lstat, rename, rm } from "node:fs/promises";
|
|
5
|
+
import { basename } from "node:path";
|
|
6
|
+
import { pipeline } from "node:stream/promises";
|
|
7
|
+
import { createGzip } from "node:zlib";
|
|
8
|
+
import { verifyLegacyV1HardFence } from "./fence.ts";
|
|
9
|
+
import { inventoryLegacyV1Segments } from "./inventory.ts";
|
|
10
|
+
import { streamLegacyV1Rows } from "./reader.ts";
|
|
11
|
+
|
|
12
|
+
export interface LegacyV1CompressionEntry {
|
|
13
|
+
filename: string;
|
|
14
|
+
path: string;
|
|
15
|
+
bytes_before: number;
|
|
16
|
+
bytes_after: number | null;
|
|
17
|
+
action: "keep" | "would-compress" | "compressed";
|
|
18
|
+
reason: string;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export async function compressSealedLegacyV1Segments(
|
|
22
|
+
coordRoot: string,
|
|
23
|
+
opts: { yes?: boolean } = {},
|
|
24
|
+
): Promise<LegacyV1CompressionEntry[]> {
|
|
25
|
+
const fence = await verifyLegacyV1HardFence(coordRoot);
|
|
26
|
+
const terminal = basename(fence.terminal_archive_path);
|
|
27
|
+
const inventory = await inventoryLegacyV1Segments(coordRoot);
|
|
28
|
+
const rows = inventory.map<LegacyV1CompressionEntry>((entry) => {
|
|
29
|
+
if (entry.filename === terminal) {
|
|
30
|
+
return {
|
|
31
|
+
filename: entry.filename,
|
|
32
|
+
path: entry.path,
|
|
33
|
+
bytes_before: entry.bytes,
|
|
34
|
+
bytes_after: null,
|
|
35
|
+
action: "keep",
|
|
36
|
+
reason: "terminal shard is bound by the V1 hard-fence digest",
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
if (entry.compressed) {
|
|
40
|
+
return {
|
|
41
|
+
filename: entry.filename,
|
|
42
|
+
path: entry.path,
|
|
43
|
+
bytes_before: entry.bytes,
|
|
44
|
+
bytes_after: entry.bytes,
|
|
45
|
+
action: "keep",
|
|
46
|
+
reason: "already compressed",
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
return {
|
|
50
|
+
filename: entry.filename,
|
|
51
|
+
path: entry.path,
|
|
52
|
+
bytes_before: entry.bytes,
|
|
53
|
+
bytes_after: null,
|
|
54
|
+
action: "would-compress",
|
|
55
|
+
reason: "sealed non-terminal V1 shard",
|
|
56
|
+
};
|
|
57
|
+
});
|
|
58
|
+
if (!opts.yes) return rows;
|
|
59
|
+
|
|
60
|
+
for (const row of rows) {
|
|
61
|
+
if (row.action !== "would-compress") continue;
|
|
62
|
+
const expected = inventory.find((entry) => entry.path === row.path)!;
|
|
63
|
+
const current = (await inventoryLegacyV1Segments(coordRoot)).find(
|
|
64
|
+
(entry) => entry.path === row.path,
|
|
65
|
+
);
|
|
66
|
+
if (
|
|
67
|
+
!current ||
|
|
68
|
+
current.bytes !== expected.bytes ||
|
|
69
|
+
current.digest !== expected.digest ||
|
|
70
|
+
current.compressed
|
|
71
|
+
) {
|
|
72
|
+
throw new Error(`legacy_v1_segment_changed_before_compression:${row.filename}`);
|
|
73
|
+
}
|
|
74
|
+
const sourceStat = await lstat(row.path);
|
|
75
|
+
const destination = `${row.path}.gz`;
|
|
76
|
+
const temporary = `${row.path}.partial-${process.pid}.gz`;
|
|
77
|
+
try {
|
|
78
|
+
try {
|
|
79
|
+
await lstat(destination);
|
|
80
|
+
throw new Error(`legacy_v1_compressed_destination_exists:${row.filename}`);
|
|
81
|
+
} catch (error) {
|
|
82
|
+
if ((error as NodeJS.ErrnoException).code !== "ENOENT") throw error;
|
|
83
|
+
}
|
|
84
|
+
await pipeline(
|
|
85
|
+
createReadStream(row.path),
|
|
86
|
+
createGzip({ level: 9 }),
|
|
87
|
+
createWriteStream(temporary, { flags: "wx", mode: 0o600 }),
|
|
88
|
+
);
|
|
89
|
+
await proveRowParity(row.path, temporary);
|
|
90
|
+
const unchanged = (await inventoryLegacyV1Segments(coordRoot)).find(
|
|
91
|
+
(entry) => entry.path === row.path,
|
|
92
|
+
);
|
|
93
|
+
if (
|
|
94
|
+
!unchanged ||
|
|
95
|
+
unchanged.bytes !== expected.bytes ||
|
|
96
|
+
unchanged.digest !== expected.digest
|
|
97
|
+
) {
|
|
98
|
+
throw new Error(`legacy_v1_segment_changed_during_compression:${row.filename}`);
|
|
99
|
+
}
|
|
100
|
+
await chmod(temporary, sourceStat.mode & 0o777);
|
|
101
|
+
await rename(temporary, destination);
|
|
102
|
+
await rm(row.path);
|
|
103
|
+
row.action = "compressed";
|
|
104
|
+
row.reason = "verified gzip replacement preserved every logical row";
|
|
105
|
+
row.bytes_after = (await lstat(destination)).size;
|
|
106
|
+
row.path = destination;
|
|
107
|
+
row.filename = basename(destination);
|
|
108
|
+
} catch (error) {
|
|
109
|
+
await rm(temporary, { force: true });
|
|
110
|
+
throw error;
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
return rows;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
async function proveRowParity(loose: string, compressed: string): Promise<void> {
|
|
117
|
+
const left = streamLegacyV1Rows(loose)[Symbol.asyncIterator]();
|
|
118
|
+
const right = streamLegacyV1Rows(compressed)[Symbol.asyncIterator]();
|
|
119
|
+
while (true) {
|
|
120
|
+
const [looseRow, packedRow] = await Promise.all([left.next(), right.next()]);
|
|
121
|
+
if (looseRow.done || packedRow.done) {
|
|
122
|
+
if (looseRow.done !== packedRow.done)
|
|
123
|
+
throw new Error("legacy_v1_compression_row_count_mismatch");
|
|
124
|
+
return;
|
|
125
|
+
}
|
|
126
|
+
if (!looseRow.value.bytes.equals(packedRow.value.bytes)) {
|
|
127
|
+
throw new Error(`legacy_v1_compression_row_mismatch:${looseRow.value.row_number}`);
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
}
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
import { createHash } from "node:crypto";
|
|
2
|
+
import { constants, createReadStream } from "node:fs";
|
|
3
|
+
import { lstat, open, readdir, realpath } from "node:fs/promises";
|
|
4
|
+
import { basename, join, relative, resolve } from "node:path";
|
|
5
|
+
import { canonicalJsonV3 } from "../v3/canonical.ts";
|
|
6
|
+
|
|
7
|
+
export interface LegacyV1HardFence {
|
|
8
|
+
manifest_version: 1;
|
|
9
|
+
kind: "v1_hard_path_fence";
|
|
10
|
+
terminal_archive: string;
|
|
11
|
+
terminal_digest: `sha256:${string}`;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export interface VerifiedLegacyV1HardFence {
|
|
15
|
+
fence_directory: string;
|
|
16
|
+
marker_path: string;
|
|
17
|
+
terminal_archive_path: string;
|
|
18
|
+
marker: LegacyV1HardFence;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
const MARKER = "V1-SEALED.json";
|
|
22
|
+
const LEGACY_ACTIVE_NAME = ["events", "ndjson"].join(".");
|
|
23
|
+
|
|
24
|
+
/** Verify the exact read-only V1 path fence and its terminal sealed segment. */
|
|
25
|
+
export async function verifyLegacyV1HardFence(
|
|
26
|
+
coordRoot: string,
|
|
27
|
+
): Promise<VerifiedLegacyV1HardFence> {
|
|
28
|
+
const root = resolve(coordRoot);
|
|
29
|
+
const harnery = join(root, ".harnery");
|
|
30
|
+
const harneryStat = await lstat(harnery);
|
|
31
|
+
if (!harneryStat.isDirectory() || harneryStat.isSymbolicLink()) {
|
|
32
|
+
throw new Error("legacy_v1_harnery_root_invalid");
|
|
33
|
+
}
|
|
34
|
+
const harneryReal = await realpath(harnery);
|
|
35
|
+
const fence = join(harnery, LEGACY_ACTIVE_NAME);
|
|
36
|
+
let fenceStat: Awaited<ReturnType<typeof lstat>>;
|
|
37
|
+
try {
|
|
38
|
+
fenceStat = await lstat(fence);
|
|
39
|
+
} catch (error) {
|
|
40
|
+
if ((error as NodeJS.ErrnoException).code === "ENOENT") {
|
|
41
|
+
throw new Error("legacy_v1_hard_fence_missing");
|
|
42
|
+
}
|
|
43
|
+
throw error;
|
|
44
|
+
}
|
|
45
|
+
if (!fenceStat.isDirectory() || fenceStat.isSymbolicLink()) {
|
|
46
|
+
throw new Error("legacy_v1_active_file_present_or_fence_invalid");
|
|
47
|
+
}
|
|
48
|
+
if ((fenceStat.mode & 0o222) !== 0) throw new Error("legacy_v1_hard_fence_is_writable");
|
|
49
|
+
const fenceReal = await realpath(fence);
|
|
50
|
+
if (relative(harneryReal, fenceReal).startsWith(".."))
|
|
51
|
+
throw new Error("legacy_v1_hard_fence_escape");
|
|
52
|
+
const names = (await readdir(fence)).sort();
|
|
53
|
+
if (names.length !== 1 || names[0] !== MARKER) throw new Error("legacy_v1_hard_fence_not_exact");
|
|
54
|
+
|
|
55
|
+
const markerPath = join(fence, MARKER);
|
|
56
|
+
const markerStat = await lstat(markerPath);
|
|
57
|
+
if (!markerStat.isFile() || markerStat.isSymbolicLink()) {
|
|
58
|
+
throw new Error("legacy_v1_hard_fence_marker_invalid");
|
|
59
|
+
}
|
|
60
|
+
if ((markerStat.mode & 0o222) !== 0) throw new Error("legacy_v1_hard_fence_marker_writable");
|
|
61
|
+
if (markerStat.size > 64 * 1024) throw new Error("legacy_v1_hard_fence_marker_too_large");
|
|
62
|
+
const markerText = await readFileNoFollow(markerPath);
|
|
63
|
+
const marker = validateFenceMarker(JSON.parse(markerText) as unknown);
|
|
64
|
+
if (markerText.trim() !== canonicalJsonV3(marker)) {
|
|
65
|
+
throw new Error("legacy_v1_hard_fence_marker_noncanonical");
|
|
66
|
+
}
|
|
67
|
+
const terminalName = marker.terminal_archive.replace(/^\.harnery\//, "");
|
|
68
|
+
if (!/^events-[0-9]{4}-[0-9]{2}-[0-9]{2}(?:\.[1-9][0-9]*)?\.ndjson$/.test(terminalName)) {
|
|
69
|
+
throw new Error("legacy_v1_terminal_archive_name_invalid");
|
|
70
|
+
}
|
|
71
|
+
const terminalPath = join(harnery, terminalName);
|
|
72
|
+
const terminalStat = await lstat(terminalPath);
|
|
73
|
+
if (!terminalStat.isFile() || terminalStat.isSymbolicLink()) {
|
|
74
|
+
throw new Error("legacy_v1_terminal_archive_invalid");
|
|
75
|
+
}
|
|
76
|
+
if ((await hashFile(terminalPath)) !== marker.terminal_digest) {
|
|
77
|
+
throw new Error("legacy_v1_terminal_archive_digest_mismatch");
|
|
78
|
+
}
|
|
79
|
+
return {
|
|
80
|
+
fence_directory: fence,
|
|
81
|
+
marker_path: markerPath,
|
|
82
|
+
terminal_archive_path: terminalPath,
|
|
83
|
+
marker,
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
function validateFenceMarker(value: unknown): LegacyV1HardFence {
|
|
88
|
+
if (!value || typeof value !== "object" || Array.isArray(value)) {
|
|
89
|
+
throw new Error("legacy_v1_hard_fence_marker_invalid");
|
|
90
|
+
}
|
|
91
|
+
const marker = value as Record<string, unknown>;
|
|
92
|
+
if (
|
|
93
|
+
Object.keys(marker).sort().join("\0") !==
|
|
94
|
+
["kind", "manifest_version", "terminal_archive", "terminal_digest"].sort().join("\0") ||
|
|
95
|
+
marker.manifest_version !== 1 ||
|
|
96
|
+
marker.kind !== "v1_hard_path_fence" ||
|
|
97
|
+
typeof marker.terminal_archive !== "string" ||
|
|
98
|
+
typeof marker.terminal_digest !== "string" ||
|
|
99
|
+
!/^sha256:[0-9a-f]{64}$/.test(marker.terminal_digest)
|
|
100
|
+
) {
|
|
101
|
+
throw new Error("legacy_v1_hard_fence_marker_invalid");
|
|
102
|
+
}
|
|
103
|
+
return marker as unknown as LegacyV1HardFence;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
async function readFileNoFollow(path: string): Promise<string> {
|
|
107
|
+
const handle = await open(path, constants.O_RDONLY | (constants.O_NOFOLLOW ?? 0));
|
|
108
|
+
try {
|
|
109
|
+
const stat = await handle.stat();
|
|
110
|
+
if (!stat.isFile()) throw new Error("legacy_v1_hard_fence_marker_invalid");
|
|
111
|
+
return handle.readFile("utf8");
|
|
112
|
+
} finally {
|
|
113
|
+
await handle.close();
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
async function hashFile(path: string): Promise<`sha256:${string}`> {
|
|
118
|
+
const hash = createHash("sha256");
|
|
119
|
+
const handle = await open(path, constants.O_RDONLY | (constants.O_NOFOLLOW ?? 0));
|
|
120
|
+
try {
|
|
121
|
+
const stat = await handle.stat();
|
|
122
|
+
if (!stat.isFile()) throw new Error(`legacy_v1_segment_not_regular:${basename(path)}`);
|
|
123
|
+
const stream = createReadStream(path, { fd: handle.fd, autoClose: false });
|
|
124
|
+
for await (const current of stream) hash.update(current as Buffer);
|
|
125
|
+
} finally {
|
|
126
|
+
await handle.close();
|
|
127
|
+
}
|
|
128
|
+
return `sha256:${hash.digest("hex")}`;
|
|
129
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { createHash } from "node:crypto";
|
|
2
|
+
import { createReadStream } from "node:fs";
|
|
3
|
+
import { lstat, readdir, realpath } from "node:fs/promises";
|
|
4
|
+
import { join, relative, resolve } from "node:path";
|
|
5
|
+
|
|
6
|
+
export interface LegacyV1SegmentInventoryEntry {
|
|
7
|
+
filename: string;
|
|
8
|
+
path: string;
|
|
9
|
+
bytes: number;
|
|
10
|
+
digest: `sha256:${string}`;
|
|
11
|
+
compressed: boolean;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
const LEGACY_ACTIVE_NAME = ["events", "ndjson"].join(".");
|
|
15
|
+
|
|
16
|
+
/** Enumerate all root events*.ndjson* frozen-history candidates, including manual variants. */
|
|
17
|
+
export async function inventoryLegacyV1Segments(
|
|
18
|
+
coordRoot: string,
|
|
19
|
+
): Promise<LegacyV1SegmentInventoryEntry[]> {
|
|
20
|
+
const harnery = resolve(coordRoot, ".harnery");
|
|
21
|
+
const stat = await lstat(harnery);
|
|
22
|
+
if (!stat.isDirectory() || stat.isSymbolicLink())
|
|
23
|
+
throw new Error("legacy_v1_inventory_root_invalid");
|
|
24
|
+
const rootReal = await realpath(harnery);
|
|
25
|
+
const result: LegacyV1SegmentInventoryEntry[] = [];
|
|
26
|
+
for (const name of (await readdir(harnery)).sort()) {
|
|
27
|
+
if (!/^events.*\.ndjson(?:\.gz)?$/.test(name) || name === LEGACY_ACTIVE_NAME) continue;
|
|
28
|
+
const path = join(harnery, name);
|
|
29
|
+
const entryStat = await lstat(path);
|
|
30
|
+
if (!entryStat.isFile() || entryStat.isSymbolicLink()) {
|
|
31
|
+
throw new Error(`legacy_v1_inventory_segment_invalid:${name}`);
|
|
32
|
+
}
|
|
33
|
+
const pathReal = await realpath(path);
|
|
34
|
+
if (relative(rootReal, pathReal).startsWith(".."))
|
|
35
|
+
throw new Error("legacy_v1_inventory_escape");
|
|
36
|
+
result.push({
|
|
37
|
+
filename: name,
|
|
38
|
+
path,
|
|
39
|
+
bytes: entryStat.size,
|
|
40
|
+
digest: await hashFile(path),
|
|
41
|
+
compressed: name.endsWith(".gz"),
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
return result;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
async function hashFile(path: string): Promise<`sha256:${string}`> {
|
|
48
|
+
const hash = createHash("sha256");
|
|
49
|
+
for await (const current of createReadStream(path)) hash.update(current as Buffer);
|
|
50
|
+
return `sha256:${hash.digest("hex")}`;
|
|
51
|
+
}
|