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,352 @@
|
|
|
1
|
+
import { createHash } from "node:crypto";
|
|
2
|
+
import { constants, createReadStream } from "node:fs";
|
|
3
|
+
import { chmod, lstat, mkdir, open, readdir, readFile, realpath } from "node:fs/promises";
|
|
4
|
+
import { join, relative, resolve } from "node:path";
|
|
5
|
+
import { canonicalJsonV3 } from "../canonical.js";
|
|
6
|
+
import { digestEventV3LogicalAuthority } from "./logical-authority.js";
|
|
7
|
+
import { assertEventV3SupportPackAuthority, logicalEntriesDigestV3 } from "./pack-contract.js";
|
|
8
|
+
import { verifyEventV3SupportPack } from "./pack-reader.js";
|
|
9
|
+
import { writeEventV3SupportPack } from "./pack-writer.js";
|
|
10
|
+
/** Freeze a content-free exact source set. No pack is written and no source is changed. */
|
|
11
|
+
export async function planEventV3SupportTransaction(input) {
|
|
12
|
+
if (input.entries.length === 0)
|
|
13
|
+
throw new Error("event_v3_support_transaction_empty");
|
|
14
|
+
if (input.entries.some((entry) => entry.disposition !== "pack-eligible")) {
|
|
15
|
+
throw new Error("event_v3_support_transaction_contains_ineligible_source");
|
|
16
|
+
}
|
|
17
|
+
const verificationMode = input.authority_state === "archived" ? "archive-logical-authority" : "active-frozen-files";
|
|
18
|
+
if (verificationMode === "archive-logical-authority" && !input.source_authority_digest) {
|
|
19
|
+
throw new Error("event_v3_support_transaction_archive_digest_required");
|
|
20
|
+
}
|
|
21
|
+
if (verificationMode === "active-frozen-files" && input.source_authority_digest) {
|
|
22
|
+
throw new Error("event_v3_support_transaction_active_digest_forbidden");
|
|
23
|
+
}
|
|
24
|
+
const authorityRoot = await safeAuthorityRoot(input.authority_root);
|
|
25
|
+
const sources = input.entries
|
|
26
|
+
.map((entry) => ({
|
|
27
|
+
relative_path: entry.relative_path,
|
|
28
|
+
bytes: entry.bytes,
|
|
29
|
+
digest: entry.digest,
|
|
30
|
+
family: entry.family,
|
|
31
|
+
...(entry.observed.recorded_at ? { recorded_at: entry.observed.recorded_at } : {}),
|
|
32
|
+
}))
|
|
33
|
+
.sort((left, right) => left.relative_path.localeCompare(right.relative_path));
|
|
34
|
+
const transactionId = `vst_${createHash("sha256")
|
|
35
|
+
.update(canonicalJsonV3({
|
|
36
|
+
authority_root: authorityRoot,
|
|
37
|
+
root_id: input.root_id,
|
|
38
|
+
genesis_id: input.genesis_id,
|
|
39
|
+
verification_mode: verificationMode,
|
|
40
|
+
source_authority_digest: input.source_authority_digest ?? null,
|
|
41
|
+
sources,
|
|
42
|
+
catalog_version: input.catalog_version,
|
|
43
|
+
policy_version: input.policy_version,
|
|
44
|
+
}))
|
|
45
|
+
.digest("hex")
|
|
46
|
+
.slice(0, 32)}`;
|
|
47
|
+
const transaction = {
|
|
48
|
+
format: "harnery-event-v3-support-maintenance",
|
|
49
|
+
format_version: 1,
|
|
50
|
+
transaction_id: transactionId,
|
|
51
|
+
sequence: 1,
|
|
52
|
+
state: "planned",
|
|
53
|
+
created_at: input.now,
|
|
54
|
+
updated_at: input.now,
|
|
55
|
+
catalog_version: input.catalog_version,
|
|
56
|
+
policy_version: input.policy_version,
|
|
57
|
+
authority: {
|
|
58
|
+
root: authorityRoot,
|
|
59
|
+
root_id: input.root_id,
|
|
60
|
+
genesis_id: input.genesis_id,
|
|
61
|
+
state: input.authority_state,
|
|
62
|
+
verification_mode: verificationMode,
|
|
63
|
+
...(input.source_authority_digest
|
|
64
|
+
? { source_authority_digest: input.source_authority_digest }
|
|
65
|
+
: {}),
|
|
66
|
+
},
|
|
67
|
+
sources,
|
|
68
|
+
};
|
|
69
|
+
const directory = transactionDirectory(input.transaction_root, transactionId);
|
|
70
|
+
try {
|
|
71
|
+
await mkdir(directory, { recursive: false, mode: 0o700 });
|
|
72
|
+
}
|
|
73
|
+
catch (error) {
|
|
74
|
+
if (error.code !== "EEXIST")
|
|
75
|
+
throw error;
|
|
76
|
+
const existing = await readEventV3SupportTransaction(input.transaction_root, transactionId);
|
|
77
|
+
if (canonicalTransactionIdentity(existing) !== canonicalTransactionIdentity(transaction)) {
|
|
78
|
+
throw new Error("event_v3_support_transaction_id_conflict");
|
|
79
|
+
}
|
|
80
|
+
return existing;
|
|
81
|
+
}
|
|
82
|
+
await chmod(directory, 0o700);
|
|
83
|
+
await publishState(directory, transaction);
|
|
84
|
+
return transaction;
|
|
85
|
+
}
|
|
86
|
+
export async function writeEventV3SupportTransactionShadow(input) {
|
|
87
|
+
const transaction = await readEventV3SupportTransaction(input.transaction_root, exactTransactionId(input.transaction_id));
|
|
88
|
+
if (transaction.state !== "planned")
|
|
89
|
+
throw new Error("event_v3_support_shadow_state_invalid");
|
|
90
|
+
await assertFrozenSources(transaction);
|
|
91
|
+
const directory = transactionDirectory(input.transaction_root, transaction.transaction_id);
|
|
92
|
+
const shadowDirectory = join(directory, "shadow");
|
|
93
|
+
const written = await writeEventV3SupportPack({
|
|
94
|
+
authority_root: transaction.authority.root,
|
|
95
|
+
output_directory: shadowDirectory,
|
|
96
|
+
root_id: transaction.authority.root_id,
|
|
97
|
+
genesis_id: transaction.authority.genesis_id,
|
|
98
|
+
verification_mode: transaction.authority.verification_mode,
|
|
99
|
+
...(transaction.authority.source_authority_digest
|
|
100
|
+
? { source_authority_digest: transaction.authority.source_authority_digest }
|
|
101
|
+
: {}),
|
|
102
|
+
sources: transaction.sources.map((source) => ({
|
|
103
|
+
relative_path: source.relative_path,
|
|
104
|
+
family: source.family,
|
|
105
|
+
...(source.recorded_at ? { recorded_at: source.recorded_at } : {}),
|
|
106
|
+
...(source.diagnostic_category ? { diagnostic_category: source.diagnostic_category } : {}),
|
|
107
|
+
...(source.diagnostic_reason ? { diagnostic_reason: source.diagnostic_reason } : {}),
|
|
108
|
+
expected_bytes: source.bytes,
|
|
109
|
+
expected_digest: source.digest,
|
|
110
|
+
})),
|
|
111
|
+
minimum_harnery_version: input.minimum_harnery_version,
|
|
112
|
+
created_at: transaction.created_at,
|
|
113
|
+
});
|
|
114
|
+
return transition(transaction, input.transaction_root, "shadow-written", input.now, {
|
|
115
|
+
shadow: {
|
|
116
|
+
manifest_path: relative(directory, written.manifest_path).replaceAll("\\", "/"),
|
|
117
|
+
payload_path: relative(directory, written.payload_path).replaceAll("\\", "/"),
|
|
118
|
+
pack_id: written.manifest.pack_id,
|
|
119
|
+
},
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
export async function verifyEventV3SupportTransactionShadow(input) {
|
|
123
|
+
const transaction = await readEventV3SupportTransaction(input.transaction_root, exactTransactionId(input.transaction_id));
|
|
124
|
+
if (transaction.state !== "shadow-written") {
|
|
125
|
+
throw new Error("event_v3_support_shadow_verify_state_invalid");
|
|
126
|
+
}
|
|
127
|
+
if (transaction.authority.genesis_id !== input.expected_current_genesis_id) {
|
|
128
|
+
throw new Error("event_v3_support_transaction_genesis_mismatch");
|
|
129
|
+
}
|
|
130
|
+
if (!transaction.shadow)
|
|
131
|
+
throw new Error("event_v3_support_shadow_missing");
|
|
132
|
+
await assertFrozenSources(transaction);
|
|
133
|
+
const directory = transactionDirectory(input.transaction_root, transaction.transaction_id);
|
|
134
|
+
const manifestPath = containedTransactionPath(directory, transaction.shadow.manifest_path);
|
|
135
|
+
const validated = await verifyEventV3SupportPack(manifestPath);
|
|
136
|
+
assertEventV3SupportPackAuthority(validated.manifest, {
|
|
137
|
+
root_id: transaction.authority.root_id,
|
|
138
|
+
genesis_id: transaction.authority.genesis_id,
|
|
139
|
+
verification_mode: transaction.authority.verification_mode,
|
|
140
|
+
});
|
|
141
|
+
const plannedSourceDigest = logicalEntriesDigestV3(transaction.sources.map(({ relative_path, bytes, digest }) => ({
|
|
142
|
+
path: relative_path,
|
|
143
|
+
bytes,
|
|
144
|
+
digest,
|
|
145
|
+
})));
|
|
146
|
+
if (validated.entries !== transaction.sources.length ||
|
|
147
|
+
validated.manifest.entries.logical_entries_digest !== plannedSourceDigest ||
|
|
148
|
+
validated.manifest.authority.source_files_digest !== plannedSourceDigest) {
|
|
149
|
+
throw new Error("event_v3_support_shadow_authority_mismatch");
|
|
150
|
+
}
|
|
151
|
+
if (validated.manifest.authority.source_authority_digest !==
|
|
152
|
+
transaction.authority.source_authority_digest) {
|
|
153
|
+
throw new Error("event_v3_support_shadow_source_authority_mismatch");
|
|
154
|
+
}
|
|
155
|
+
if (transaction.authority.verification_mode === "archive-logical-authority") {
|
|
156
|
+
const currentDigest = await digestEventV3LogicalAuthority(transaction.authority.root);
|
|
157
|
+
if (currentDigest !== transaction.authority.source_authority_digest) {
|
|
158
|
+
throw new Error("event_v3_support_shadow_archive_digest_mismatch");
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
return transition(transaction, input.transaction_root, "shadow-verified", input.now);
|
|
162
|
+
}
|
|
163
|
+
/** Record exact authorization only. Publication and source removal remain disabled. */
|
|
164
|
+
export async function authorizeEventV3SupportReplacement(input) {
|
|
165
|
+
const transactionId = exactTransactionId(input.transaction_id);
|
|
166
|
+
if (!input.yes)
|
|
167
|
+
throw new Error("event_v3_support_replacement_yes_required");
|
|
168
|
+
if (exactTransactionId(input.exact_transaction_id) !== transactionId) {
|
|
169
|
+
throw new Error("event_v3_support_replacement_exact_transaction_mismatch");
|
|
170
|
+
}
|
|
171
|
+
const transaction = await readEventV3SupportTransaction(input.transaction_root, transactionId);
|
|
172
|
+
if (transaction.state !== "shadow-verified") {
|
|
173
|
+
throw new Error("event_v3_support_replacement_not_shadow_verified");
|
|
174
|
+
}
|
|
175
|
+
return transition(transaction, input.transaction_root, "replacement-ready", input.now, {
|
|
176
|
+
authorization: { exact_transaction_id: transactionId, authorized_at: input.now },
|
|
177
|
+
});
|
|
178
|
+
}
|
|
179
|
+
/** Produce the canary replacement plan without publishing a pack or deleting a source. */
|
|
180
|
+
export async function planEventV3SupportReplacement(input) {
|
|
181
|
+
const transaction = await readEventV3SupportTransaction(input.transaction_root, exactTransactionId(input.transaction_id));
|
|
182
|
+
if (transaction.state !== "replacement-ready" || !transaction.shadow) {
|
|
183
|
+
throw new Error("event_v3_support_replacement_not_ready");
|
|
184
|
+
}
|
|
185
|
+
const finalRoot = join(transaction.authority.root, "support-packs");
|
|
186
|
+
return {
|
|
187
|
+
transaction_id: transaction.transaction_id,
|
|
188
|
+
enabled: false,
|
|
189
|
+
final_manifest_path: join(finalRoot, `${transaction.shadow.pack_id}.manifest.json`),
|
|
190
|
+
final_payload_path: join(finalRoot, `${transaction.shadow.pack_id}.ndjson.gz`),
|
|
191
|
+
frozen_source_paths: transaction.sources.map(({ relative_path }) => relative_path),
|
|
192
|
+
reason: "event_v3_support_replacement_activation_disabled",
|
|
193
|
+
};
|
|
194
|
+
}
|
|
195
|
+
export function activateEventV3SupportReplacement() {
|
|
196
|
+
throw new Error("event_v3_support_replacement_activation_disabled");
|
|
197
|
+
}
|
|
198
|
+
export async function recoverEventV3SupportTransaction(input) {
|
|
199
|
+
const transaction = await readEventV3SupportTransaction(input.transaction_root, exactTransactionId(input.transaction_id));
|
|
200
|
+
if (transaction.authority.genesis_id !== input.expected_current_genesis_id) {
|
|
201
|
+
throw new Error("event_v3_support_transaction_genesis_mismatch");
|
|
202
|
+
}
|
|
203
|
+
await assertFrozenSources(transaction);
|
|
204
|
+
if (transaction.state === "planned")
|
|
205
|
+
return { action: "write-shadow" };
|
|
206
|
+
if (transaction.state === "shadow-written") {
|
|
207
|
+
if (!transaction.shadow)
|
|
208
|
+
throw new Error("event_v3_support_shadow_missing");
|
|
209
|
+
const directory = transactionDirectory(input.transaction_root, transaction.transaction_id);
|
|
210
|
+
await verifyEventV3SupportPack(containedTransactionPath(directory, transaction.shadow.manifest_path));
|
|
211
|
+
return { action: "verify-shadow" };
|
|
212
|
+
}
|
|
213
|
+
if (transaction.state === "shadow-verified")
|
|
214
|
+
return { action: "await-authorization" };
|
|
215
|
+
return { action: "activation-disabled" };
|
|
216
|
+
}
|
|
217
|
+
export async function readEventV3SupportTransaction(transactionRoot, transactionId) {
|
|
218
|
+
const id = exactTransactionId(transactionId);
|
|
219
|
+
const directory = transactionDirectory(transactionRoot, id);
|
|
220
|
+
const directoryStat = await lstat(directory);
|
|
221
|
+
if (!directoryStat.isDirectory() || directoryStat.isSymbolicLink()) {
|
|
222
|
+
throw new Error("event_v3_support_transaction_directory_invalid");
|
|
223
|
+
}
|
|
224
|
+
const names = (await readdir(directory))
|
|
225
|
+
.filter((name) => /^state-\d{6}\.json$/.test(name))
|
|
226
|
+
.sort();
|
|
227
|
+
if (names.length === 0)
|
|
228
|
+
throw new Error("event_v3_support_transaction_state_missing");
|
|
229
|
+
let prior;
|
|
230
|
+
for (const [index, name] of names.entries()) {
|
|
231
|
+
const current = validateTransaction(JSON.parse(await readFile(join(directory, name), "utf8")));
|
|
232
|
+
if (current.transaction_id !== id || current.sequence !== index + 1) {
|
|
233
|
+
throw new Error("event_v3_support_transaction_sequence_invalid");
|
|
234
|
+
}
|
|
235
|
+
if (prior && !validTransition(prior.state, current.state)) {
|
|
236
|
+
throw new Error("event_v3_support_transaction_transition_invalid");
|
|
237
|
+
}
|
|
238
|
+
prior = current;
|
|
239
|
+
}
|
|
240
|
+
return prior;
|
|
241
|
+
}
|
|
242
|
+
async function assertFrozenSources(transaction) {
|
|
243
|
+
const authorityReal = await realpath(transaction.authority.root);
|
|
244
|
+
for (const source of transaction.sources) {
|
|
245
|
+
const path = resolve(transaction.authority.root, ...source.relative_path.split("/"));
|
|
246
|
+
const sourceReal = await realpath(path);
|
|
247
|
+
if (relative(authorityReal, sourceReal).startsWith("..")) {
|
|
248
|
+
throw new Error("event_v3_support_frozen_source_escape");
|
|
249
|
+
}
|
|
250
|
+
const stat = await lstat(path);
|
|
251
|
+
if (!stat.isFile() || stat.isSymbolicLink()) {
|
|
252
|
+
throw new Error("event_v3_support_frozen_source_not_regular");
|
|
253
|
+
}
|
|
254
|
+
const digest = await hashFile(path);
|
|
255
|
+
if (stat.size !== source.bytes || digest !== source.digest) {
|
|
256
|
+
throw new Error(`event_v3_support_frozen_source_mismatch:${source.relative_path}`);
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
async function transition(transaction, transactionRoot, state, now, extension = {}) {
|
|
261
|
+
if (!validTransition(transaction.state, state)) {
|
|
262
|
+
throw new Error("event_v3_support_transaction_transition_invalid");
|
|
263
|
+
}
|
|
264
|
+
const next = validateTransaction({
|
|
265
|
+
...transaction,
|
|
266
|
+
...extension,
|
|
267
|
+
sequence: transaction.sequence + 1,
|
|
268
|
+
state,
|
|
269
|
+
updated_at: now,
|
|
270
|
+
});
|
|
271
|
+
await publishState(transactionDirectory(transactionRoot, transaction.transaction_id), next);
|
|
272
|
+
return next;
|
|
273
|
+
}
|
|
274
|
+
function validTransition(from, to) {
|
|
275
|
+
const order = [
|
|
276
|
+
"planned",
|
|
277
|
+
"shadow-written",
|
|
278
|
+
"shadow-verified",
|
|
279
|
+
"replacement-ready",
|
|
280
|
+
"replacement-active",
|
|
281
|
+
"committed",
|
|
282
|
+
];
|
|
283
|
+
return order.indexOf(to) === order.indexOf(from) + 1;
|
|
284
|
+
}
|
|
285
|
+
async function publishState(directory, transaction) {
|
|
286
|
+
const path = join(directory, `state-${String(transaction.sequence).padStart(6, "0")}.json`);
|
|
287
|
+
const handle = await open(path, constants.O_WRONLY | constants.O_CREAT | constants.O_EXCL, 0o600);
|
|
288
|
+
try {
|
|
289
|
+
await handle.writeFile(`${canonicalJsonV3(transaction)}\n`, "utf8");
|
|
290
|
+
await handle.sync();
|
|
291
|
+
}
|
|
292
|
+
finally {
|
|
293
|
+
await handle.close();
|
|
294
|
+
}
|
|
295
|
+
}
|
|
296
|
+
function transactionDirectory(root, id) {
|
|
297
|
+
return join(resolve(root), exactTransactionId(id));
|
|
298
|
+
}
|
|
299
|
+
function exactTransactionId(value) {
|
|
300
|
+
if (!/^vst_[0-9a-f]{32}$/.test(value))
|
|
301
|
+
throw new Error("event_v3_support_transaction_id_invalid");
|
|
302
|
+
return value;
|
|
303
|
+
}
|
|
304
|
+
function containedTransactionPath(directory, relativePath) {
|
|
305
|
+
if (relativePath.includes("\\") || relativePath.split("/").includes("..")) {
|
|
306
|
+
throw new Error("event_v3_support_transaction_path_invalid");
|
|
307
|
+
}
|
|
308
|
+
const path = resolve(directory, ...relativePath.split("/"));
|
|
309
|
+
if (relative(directory, path).startsWith("..")) {
|
|
310
|
+
throw new Error("event_v3_support_transaction_path_escape");
|
|
311
|
+
}
|
|
312
|
+
return path;
|
|
313
|
+
}
|
|
314
|
+
async function safeAuthorityRoot(root) {
|
|
315
|
+
const path = resolve(root);
|
|
316
|
+
const stat = await lstat(path);
|
|
317
|
+
if (!stat.isDirectory() || stat.isSymbolicLink()) {
|
|
318
|
+
throw new Error("event_v3_support_transaction_authority_invalid");
|
|
319
|
+
}
|
|
320
|
+
return realpath(path);
|
|
321
|
+
}
|
|
322
|
+
function validateTransaction(value) {
|
|
323
|
+
if (!value || typeof value !== "object" || Array.isArray(value)) {
|
|
324
|
+
throw new Error("event_v3_support_transaction_invalid");
|
|
325
|
+
}
|
|
326
|
+
const transaction = value;
|
|
327
|
+
if (transaction.format !== "harnery-event-v3-support-maintenance" ||
|
|
328
|
+
transaction.format_version !== 1 ||
|
|
329
|
+
!/^vst_[0-9a-f]{32}$/.test(transaction.transaction_id) ||
|
|
330
|
+
!Number.isSafeInteger(transaction.sequence) ||
|
|
331
|
+
transaction.sequence < 1 ||
|
|
332
|
+
!Array.isArray(transaction.sources) ||
|
|
333
|
+
transaction.sources.length === 0) {
|
|
334
|
+
throw new Error("event_v3_support_transaction_invalid");
|
|
335
|
+
}
|
|
336
|
+
return transaction;
|
|
337
|
+
}
|
|
338
|
+
function canonicalTransactionIdentity(transaction) {
|
|
339
|
+
return canonicalJsonV3({
|
|
340
|
+
transaction_id: transaction.transaction_id,
|
|
341
|
+
catalog_version: transaction.catalog_version,
|
|
342
|
+
policy_version: transaction.policy_version,
|
|
343
|
+
authority: transaction.authority,
|
|
344
|
+
sources: transaction.sources,
|
|
345
|
+
});
|
|
346
|
+
}
|
|
347
|
+
async function hashFile(path) {
|
|
348
|
+
const hash = createHash("sha256");
|
|
349
|
+
for await (const current of createReadStream(path))
|
|
350
|
+
hash.update(current);
|
|
351
|
+
return `sha256:${hash.digest("hex")}`;
|
|
352
|
+
}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
export declare const EVENT_V3_SUPPORT_PACK_FORMAT: "harnery-event-v3-support-pack";
|
|
2
|
+
export declare const EVENT_V3_SUPPORT_PACK_VERSION: 1;
|
|
3
|
+
export declare const EVENT_V3_SUPPORT_FAMILIES: readonly ["diagnostic", "session-tee", "authority-ready", "authority-committed", "authority-residue"];
|
|
4
|
+
export type EventV3SupportFamily = (typeof EVENT_V3_SUPPORT_FAMILIES)[number];
|
|
5
|
+
export type EventV3SupportVerificationMode = "archive-logical-authority" | "active-frozen-files";
|
|
6
|
+
export interface EventV3SupportPackRecord {
|
|
7
|
+
path: string;
|
|
8
|
+
bytes: number;
|
|
9
|
+
digest: `sha256:${string}`;
|
|
10
|
+
content_base64: string;
|
|
11
|
+
}
|
|
12
|
+
export interface EventV3SupportPackManifest {
|
|
13
|
+
format: typeof EVENT_V3_SUPPORT_PACK_FORMAT;
|
|
14
|
+
format_version: typeof EVENT_V3_SUPPORT_PACK_VERSION;
|
|
15
|
+
pack_id: `vsp_${string}`;
|
|
16
|
+
authority: {
|
|
17
|
+
root_id: string;
|
|
18
|
+
genesis_id: string;
|
|
19
|
+
verification_mode: EventV3SupportVerificationMode;
|
|
20
|
+
source_authority_digest?: `sha256:${string}`;
|
|
21
|
+
source_files_digest: `sha256:${string}`;
|
|
22
|
+
};
|
|
23
|
+
scope: {
|
|
24
|
+
families: EventV3SupportFamily[];
|
|
25
|
+
minimum_recorded_at: string | null;
|
|
26
|
+
maximum_recorded_at: string | null;
|
|
27
|
+
};
|
|
28
|
+
entries: {
|
|
29
|
+
count: number;
|
|
30
|
+
uncompressed_bytes: number;
|
|
31
|
+
logical_entries_digest: `sha256:${string}`;
|
|
32
|
+
by_family: Record<EventV3SupportFamily, number>;
|
|
33
|
+
by_diagnostic_category: Record<string, number>;
|
|
34
|
+
by_diagnostic_reason: Record<string, number>;
|
|
35
|
+
};
|
|
36
|
+
payload: {
|
|
37
|
+
algorithm: "gzip";
|
|
38
|
+
path: string;
|
|
39
|
+
bytes: number;
|
|
40
|
+
digest: `sha256:${string}`;
|
|
41
|
+
};
|
|
42
|
+
minimum_harnery_version: string;
|
|
43
|
+
created_at: string;
|
|
44
|
+
}
|
|
45
|
+
export interface EventV3LogicalAuthorityEntry {
|
|
46
|
+
path: string;
|
|
47
|
+
bytes: number;
|
|
48
|
+
digest: `sha256:${string}`;
|
|
49
|
+
}
|
|
50
|
+
export declare function normalizeEventV3SupportPath(value: string): string;
|
|
51
|
+
export declare function logicalEntriesDigestV3(entries: readonly EventV3LogicalAuthorityEntry[]): `sha256:${string}`;
|
|
52
|
+
export declare function validateEventV3SupportPackRecord(value: unknown): EventV3SupportPackRecord;
|
|
53
|
+
export declare function validateEventV3SupportPackManifest(value: unknown): EventV3SupportPackManifest;
|
|
54
|
+
export declare function assertEventV3SupportPackAuthority(manifest: EventV3SupportPackManifest, expected: {
|
|
55
|
+
root_id: string;
|
|
56
|
+
genesis_id: string;
|
|
57
|
+
verification_mode?: EventV3SupportVerificationMode;
|
|
58
|
+
}): void;
|
|
59
|
+
//# sourceMappingURL=pack-contract.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pack-contract.d.ts","sourceRoot":"","sources":["../../../../../src/core/events/v3/support-storage/pack-contract.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,4BAA4B,EAAG,+BAAwC,CAAC;AACrF,eAAO,MAAM,6BAA6B,EAAG,CAAU,CAAC;AAExD,eAAO,MAAM,yBAAyB,uGAM5B,CAAC;AAEX,MAAM,MAAM,oBAAoB,GAAG,CAAC,OAAO,yBAAyB,CAAC,CAAC,MAAM,CAAC,CAAC;AAC9E,MAAM,MAAM,8BAA8B,GAAG,2BAA2B,GAAG,qBAAqB,CAAC;AAEjG,MAAM,WAAW,wBAAwB;IACvC,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,UAAU,MAAM,EAAE,CAAC;IAC3B,cAAc,EAAE,MAAM,CAAC;CACxB;AAED,MAAM,WAAW,0BAA0B;IACzC,MAAM,EAAE,OAAO,4BAA4B,CAAC;IAC5C,cAAc,EAAE,OAAO,6BAA6B,CAAC;IACrD,OAAO,EAAE,OAAO,MAAM,EAAE,CAAC;IACzB,SAAS,EAAE;QACT,OAAO,EAAE,MAAM,CAAC;QAChB,UAAU,EAAE,MAAM,CAAC;QACnB,iBAAiB,EAAE,8BAA8B,CAAC;QAClD,uBAAuB,CAAC,EAAE,UAAU,MAAM,EAAE,CAAC;QAC7C,mBAAmB,EAAE,UAAU,MAAM,EAAE,CAAC;KACzC,CAAC;IACF,KAAK,EAAE;QACL,QAAQ,EAAE,oBAAoB,EAAE,CAAC;QACjC,mBAAmB,EAAE,MAAM,GAAG,IAAI,CAAC;QACnC,mBAAmB,EAAE,MAAM,GAAG,IAAI,CAAC;KACpC,CAAC;IACF,OAAO,EAAE;QACP,KAAK,EAAE,MAAM,CAAC;QACd,kBAAkB,EAAE,MAAM,CAAC;QAC3B,sBAAsB,EAAE,UAAU,MAAM,EAAE,CAAC;QAC3C,SAAS,EAAE,MAAM,CAAC,oBAAoB,EAAE,MAAM,CAAC,CAAC;QAChD,sBAAsB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;QAC/C,oBAAoB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;KAC9C,CAAC;IACF,OAAO,EAAE;QACP,SAAS,EAAE,MAAM,CAAC;QAClB,IAAI,EAAE,MAAM,CAAC;QACb,KAAK,EAAE,MAAM,CAAC;QACd,MAAM,EAAE,UAAU,MAAM,EAAE,CAAC;KAC5B,CAAC;IACF,uBAAuB,EAAE,MAAM,CAAC;IAChC,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,4BAA4B;IAC3C,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,UAAU,MAAM,EAAE,CAAC;CAC5B;AAMD,wBAAgB,2BAA2B,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAkBjE;AAED,wBAAgB,sBAAsB,CACpC,OAAO,EAAE,SAAS,4BAA4B,EAAE,GAC/C,UAAU,MAAM,EAAE,CAGpB;AAED,wBAAgB,gCAAgC,CAAC,KAAK,EAAE,OAAO,GAAG,wBAAwB,CAWzF;AAED,wBAAgB,kCAAkC,CAAC,KAAK,EAAE,OAAO,GAAG,0BAA0B,CAyH7F;AAED,wBAAgB,iCAAiC,CAC/C,QAAQ,EAAE,0BAA0B,EACpC,QAAQ,EAAE;IACR,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,MAAM,CAAC;IACnB,iBAAiB,CAAC,EAAE,8BAA8B,CAAC;CACpD,GACA,IAAI,CAaN"}
|
|
@@ -0,0 +1,249 @@
|
|
|
1
|
+
import { createHash } from "node:crypto";
|
|
2
|
+
import { posix } from "node:path";
|
|
3
|
+
import { canonicalJsonV3 } from "../canonical.js";
|
|
4
|
+
export const EVENT_V3_SUPPORT_PACK_FORMAT = "harnery-event-v3-support-pack";
|
|
5
|
+
export const EVENT_V3_SUPPORT_PACK_VERSION = 1;
|
|
6
|
+
export const EVENT_V3_SUPPORT_FAMILIES = [
|
|
7
|
+
"diagnostic",
|
|
8
|
+
"session-tee",
|
|
9
|
+
"authority-ready",
|
|
10
|
+
"authority-committed",
|
|
11
|
+
"authority-residue",
|
|
12
|
+
];
|
|
13
|
+
const DIGEST = /^sha256:[0-9a-f]{64}$/;
|
|
14
|
+
const PACK_ID = /^vsp_[0-9a-f]{32}$/;
|
|
15
|
+
const VERSION = /^\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?$/;
|
|
16
|
+
export function normalizeEventV3SupportPath(value) {
|
|
17
|
+
if (value.length === 0 ||
|
|
18
|
+
value.includes("\\") ||
|
|
19
|
+
value.includes("\0") ||
|
|
20
|
+
value.startsWith("/") ||
|
|
21
|
+
/^[A-Za-z]:/.test(value)) {
|
|
22
|
+
throw new Error("event_v3_support_path_is_unsafe");
|
|
23
|
+
}
|
|
24
|
+
const normalized = posix.normalize(value);
|
|
25
|
+
if (normalized !== value || value === "." || value.split("/").includes("..")) {
|
|
26
|
+
throw new Error("event_v3_support_path_is_noncanonical");
|
|
27
|
+
}
|
|
28
|
+
if (value === "support-packs" || value.startsWith("support-packs/")) {
|
|
29
|
+
throw new Error("event_v3_support_path_uses_reserved_subtree");
|
|
30
|
+
}
|
|
31
|
+
return value;
|
|
32
|
+
}
|
|
33
|
+
export function logicalEntriesDigestV3(entries) {
|
|
34
|
+
const sorted = [...entries].sort((left, right) => left.path.localeCompare(right.path));
|
|
35
|
+
return `sha256:${createHash("sha256").update(canonicalJsonV3(sorted)).digest("hex")}`;
|
|
36
|
+
}
|
|
37
|
+
export function validateEventV3SupportPackRecord(value) {
|
|
38
|
+
const record = object(value, "event_v3_support_record_invalid");
|
|
39
|
+
exactKeys(record, ["path", "bytes", "digest", "content_base64"]);
|
|
40
|
+
const path = normalizeEventV3SupportPath(string(record.path));
|
|
41
|
+
const bytes = nonnegativeInteger(record.bytes);
|
|
42
|
+
const digest = sha256(record.digest);
|
|
43
|
+
const content = string(record.content_base64);
|
|
44
|
+
if (!/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(content)) {
|
|
45
|
+
throw new Error("event_v3_support_record_base64_invalid");
|
|
46
|
+
}
|
|
47
|
+
return { path, bytes, digest, content_base64: content };
|
|
48
|
+
}
|
|
49
|
+
export function validateEventV3SupportPackManifest(value) {
|
|
50
|
+
const manifest = object(value, "event_v3_support_manifest_invalid");
|
|
51
|
+
exactKeys(manifest, [
|
|
52
|
+
"format",
|
|
53
|
+
"format_version",
|
|
54
|
+
"pack_id",
|
|
55
|
+
"authority",
|
|
56
|
+
"scope",
|
|
57
|
+
"entries",
|
|
58
|
+
"payload",
|
|
59
|
+
"minimum_harnery_version",
|
|
60
|
+
"created_at",
|
|
61
|
+
]);
|
|
62
|
+
if (manifest.format !== EVENT_V3_SUPPORT_PACK_FORMAT || manifest.format_version !== 1) {
|
|
63
|
+
throw new Error("event_v3_support_manifest_version_unsupported");
|
|
64
|
+
}
|
|
65
|
+
const packId = string(manifest.pack_id);
|
|
66
|
+
if (!PACK_ID.test(packId))
|
|
67
|
+
throw new Error("event_v3_support_pack_id_invalid");
|
|
68
|
+
const authority = object(manifest.authority, "event_v3_support_authority_invalid");
|
|
69
|
+
const authorityKeys = ["root_id", "genesis_id", "verification_mode", "source_files_digest"];
|
|
70
|
+
if (authority.source_authority_digest !== undefined)
|
|
71
|
+
authorityKeys.push("source_authority_digest");
|
|
72
|
+
exactKeys(authority, authorityKeys);
|
|
73
|
+
const verificationMode = string(authority.verification_mode);
|
|
74
|
+
if (verificationMode !== "archive-logical-authority" &&
|
|
75
|
+
verificationMode !== "active-frozen-files") {
|
|
76
|
+
throw new Error("event_v3_support_verification_mode_invalid");
|
|
77
|
+
}
|
|
78
|
+
const sourceAuthorityDigest = optionalSha256(authority.source_authority_digest);
|
|
79
|
+
if (verificationMode === "archive-logical-authority" && !sourceAuthorityDigest) {
|
|
80
|
+
throw new Error("event_v3_support_archive_digest_required");
|
|
81
|
+
}
|
|
82
|
+
if (verificationMode === "active-frozen-files" && sourceAuthorityDigest) {
|
|
83
|
+
throw new Error("event_v3_support_active_authority_digest_forbidden");
|
|
84
|
+
}
|
|
85
|
+
const scope = object(manifest.scope, "event_v3_support_scope_invalid");
|
|
86
|
+
exactKeys(scope, ["families", "minimum_recorded_at", "maximum_recorded_at"]);
|
|
87
|
+
if (!Array.isArray(scope.families) || scope.families.length === 0) {
|
|
88
|
+
throw new Error("event_v3_support_scope_families_invalid");
|
|
89
|
+
}
|
|
90
|
+
const families = [...new Set(scope.families.map(family))].sort();
|
|
91
|
+
if (families.length !== scope.families.length) {
|
|
92
|
+
throw new Error("event_v3_support_scope_family_duplicate");
|
|
93
|
+
}
|
|
94
|
+
const minimumRecordedAt = nullableTimestamp(scope.minimum_recorded_at);
|
|
95
|
+
const maximumRecordedAt = nullableTimestamp(scope.maximum_recorded_at);
|
|
96
|
+
if ((minimumRecordedAt === null) !== (maximumRecordedAt === null)) {
|
|
97
|
+
throw new Error("event_v3_support_scope_time_range_incomplete");
|
|
98
|
+
}
|
|
99
|
+
if (minimumRecordedAt && maximumRecordedAt && minimumRecordedAt > maximumRecordedAt) {
|
|
100
|
+
throw new Error("event_v3_support_scope_time_range_invalid");
|
|
101
|
+
}
|
|
102
|
+
const entries = object(manifest.entries, "event_v3_support_entries_invalid");
|
|
103
|
+
exactKeys(entries, [
|
|
104
|
+
"count",
|
|
105
|
+
"uncompressed_bytes",
|
|
106
|
+
"logical_entries_digest",
|
|
107
|
+
"by_family",
|
|
108
|
+
"by_diagnostic_category",
|
|
109
|
+
"by_diagnostic_reason",
|
|
110
|
+
]);
|
|
111
|
+
const count = nonnegativeInteger(entries.count);
|
|
112
|
+
if (count === 0)
|
|
113
|
+
throw new Error("event_v3_support_pack_empty");
|
|
114
|
+
const byFamily = familyRollup(entries.by_family);
|
|
115
|
+
if (Object.values(byFamily).reduce((sum, current) => sum + current, 0) !== count) {
|
|
116
|
+
throw new Error("event_v3_support_family_rollup_mismatch");
|
|
117
|
+
}
|
|
118
|
+
for (const key of EVENT_V3_SUPPORT_FAMILIES) {
|
|
119
|
+
if (byFamily[key] > 0 && !families.includes(key)) {
|
|
120
|
+
throw new Error("event_v3_support_scope_rollup_mismatch");
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
const payload = object(manifest.payload, "event_v3_support_payload_invalid");
|
|
124
|
+
exactKeys(payload, ["algorithm", "path", "bytes", "digest"]);
|
|
125
|
+
if (payload.algorithm !== "gzip")
|
|
126
|
+
throw new Error("event_v3_support_algorithm_unsupported");
|
|
127
|
+
const payloadPath = string(payload.path);
|
|
128
|
+
if (payloadPath !== `${packId}.ndjson.gz`) {
|
|
129
|
+
throw new Error("event_v3_support_payload_path_mismatch");
|
|
130
|
+
}
|
|
131
|
+
const minimumVersion = string(manifest.minimum_harnery_version);
|
|
132
|
+
if (!VERSION.test(minimumVersion))
|
|
133
|
+
throw new Error("event_v3_support_minimum_version_invalid");
|
|
134
|
+
return {
|
|
135
|
+
format: EVENT_V3_SUPPORT_PACK_FORMAT,
|
|
136
|
+
format_version: 1,
|
|
137
|
+
pack_id: packId,
|
|
138
|
+
authority: {
|
|
139
|
+
root_id: nonemptyString(authority.root_id),
|
|
140
|
+
genesis_id: nonemptyString(authority.genesis_id),
|
|
141
|
+
verification_mode: verificationMode,
|
|
142
|
+
...(sourceAuthorityDigest ? { source_authority_digest: sourceAuthorityDigest } : {}),
|
|
143
|
+
source_files_digest: sha256(authority.source_files_digest),
|
|
144
|
+
},
|
|
145
|
+
scope: {
|
|
146
|
+
families,
|
|
147
|
+
minimum_recorded_at: minimumRecordedAt,
|
|
148
|
+
maximum_recorded_at: maximumRecordedAt,
|
|
149
|
+
},
|
|
150
|
+
entries: {
|
|
151
|
+
count,
|
|
152
|
+
uncompressed_bytes: nonnegativeInteger(entries.uncompressed_bytes),
|
|
153
|
+
logical_entries_digest: sha256(entries.logical_entries_digest),
|
|
154
|
+
by_family: byFamily,
|
|
155
|
+
by_diagnostic_category: stringRollup(entries.by_diagnostic_category),
|
|
156
|
+
by_diagnostic_reason: stringRollup(entries.by_diagnostic_reason),
|
|
157
|
+
},
|
|
158
|
+
payload: {
|
|
159
|
+
algorithm: "gzip",
|
|
160
|
+
path: payloadPath,
|
|
161
|
+
bytes: nonnegativeInteger(payload.bytes),
|
|
162
|
+
digest: sha256(payload.digest),
|
|
163
|
+
},
|
|
164
|
+
minimum_harnery_version: minimumVersion,
|
|
165
|
+
created_at: timestamp(manifest.created_at),
|
|
166
|
+
};
|
|
167
|
+
}
|
|
168
|
+
export function assertEventV3SupportPackAuthority(manifest, expected) {
|
|
169
|
+
if (manifest.authority.root_id !== expected.root_id) {
|
|
170
|
+
throw new Error("event_v3_support_pack_wrong_root_authority");
|
|
171
|
+
}
|
|
172
|
+
if (manifest.authority.genesis_id !== expected.genesis_id) {
|
|
173
|
+
throw new Error("event_v3_support_pack_wrong_genesis_authority");
|
|
174
|
+
}
|
|
175
|
+
if (expected.verification_mode !== undefined &&
|
|
176
|
+
manifest.authority.verification_mode !== expected.verification_mode) {
|
|
177
|
+
throw new Error("event_v3_support_pack_wrong_verification_mode");
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
function object(value, code) {
|
|
181
|
+
if (!value || typeof value !== "object" || Array.isArray(value))
|
|
182
|
+
throw new Error(code);
|
|
183
|
+
return value;
|
|
184
|
+
}
|
|
185
|
+
function exactKeys(value, expected) {
|
|
186
|
+
if (Object.keys(value).sort().join("\0") !== [...expected].sort().join("\0")) {
|
|
187
|
+
throw new Error("event_v3_support_schema_unknown_field");
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
function string(value) {
|
|
191
|
+
if (typeof value !== "string")
|
|
192
|
+
throw new Error("event_v3_support_string_invalid");
|
|
193
|
+
return value;
|
|
194
|
+
}
|
|
195
|
+
function nonemptyString(value) {
|
|
196
|
+
const result = string(value);
|
|
197
|
+
if (result.length === 0 || result.length > 256)
|
|
198
|
+
throw new Error("event_v3_support_id_invalid");
|
|
199
|
+
return result;
|
|
200
|
+
}
|
|
201
|
+
function nonnegativeInteger(value) {
|
|
202
|
+
if (!Number.isSafeInteger(value) || value < 0) {
|
|
203
|
+
throw new Error("event_v3_support_integer_invalid");
|
|
204
|
+
}
|
|
205
|
+
return value;
|
|
206
|
+
}
|
|
207
|
+
function sha256(value) {
|
|
208
|
+
const result = string(value);
|
|
209
|
+
if (!DIGEST.test(result))
|
|
210
|
+
throw new Error("event_v3_support_digest_invalid");
|
|
211
|
+
return result;
|
|
212
|
+
}
|
|
213
|
+
function optionalSha256(value) {
|
|
214
|
+
return value === undefined ? undefined : sha256(value);
|
|
215
|
+
}
|
|
216
|
+
function family(value) {
|
|
217
|
+
const result = string(value);
|
|
218
|
+
if (!EVENT_V3_SUPPORT_FAMILIES.includes(result)) {
|
|
219
|
+
throw new Error("event_v3_support_family_unknown");
|
|
220
|
+
}
|
|
221
|
+
return result;
|
|
222
|
+
}
|
|
223
|
+
function timestamp(value) {
|
|
224
|
+
const result = string(value);
|
|
225
|
+
if (!/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d\.\d{3}Z$/.test(result) ||
|
|
226
|
+
!Number.isFinite(Date.parse(result))) {
|
|
227
|
+
throw new Error("event_v3_support_timestamp_invalid");
|
|
228
|
+
}
|
|
229
|
+
return result;
|
|
230
|
+
}
|
|
231
|
+
function nullableTimestamp(value) {
|
|
232
|
+
return value === null ? null : timestamp(value);
|
|
233
|
+
}
|
|
234
|
+
function familyRollup(value) {
|
|
235
|
+
const rollup = object(value, "event_v3_support_family_rollup_invalid");
|
|
236
|
+
exactKeys(rollup, [...EVENT_V3_SUPPORT_FAMILIES]);
|
|
237
|
+
return Object.fromEntries(EVENT_V3_SUPPORT_FAMILIES.map((key) => [key, nonnegativeInteger(rollup[key])]));
|
|
238
|
+
}
|
|
239
|
+
function stringRollup(value) {
|
|
240
|
+
const rollup = object(value, "event_v3_support_rollup_invalid");
|
|
241
|
+
const result = {};
|
|
242
|
+
for (const [key, current] of Object.entries(rollup).sort(([left], [right]) => left.localeCompare(right))) {
|
|
243
|
+
if (!/^[a-z0-9][a-z0-9_.-]{0,127}$/.test(key)) {
|
|
244
|
+
throw new Error("event_v3_support_rollup_key_invalid");
|
|
245
|
+
}
|
|
246
|
+
result[key] = nonnegativeInteger(current);
|
|
247
|
+
}
|
|
248
|
+
return result;
|
|
249
|
+
}
|