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,666 @@
|
|
|
1
|
+
import { lstat as defaultLstat, opendir as defaultOpendir, realpath as defaultRealpath, } from "node:fs/promises";
|
|
2
|
+
import { isAbsolute, join, relative, resolve, sep } from "node:path";
|
|
3
|
+
import { HARNERY_STORAGE_INVENTORY_SCHEMA, } from "./contract.js";
|
|
4
|
+
import { inspectStructuredLogRetention } from "./log-retention.js";
|
|
5
|
+
const MAX_CONCURRENCY = 16;
|
|
6
|
+
/**
|
|
7
|
+
* Inventory registered storage with metadata-only, depth-first traversal.
|
|
8
|
+
* The complete `.harnery` root is scanned once; outside it, only explicit
|
|
9
|
+
* registered filesystem roots are visited.
|
|
10
|
+
*/
|
|
11
|
+
export async function inventoryStorage(catalog, options = {}) {
|
|
12
|
+
const coordStorageRoot = resolve(catalog.context.coord_root, ".harnery");
|
|
13
|
+
const capturedAt = (options.now ?? (() => new Date()))();
|
|
14
|
+
const state = {
|
|
15
|
+
catalog,
|
|
16
|
+
coordStorageRoot,
|
|
17
|
+
families: new Map(catalog.families.map((family) => [
|
|
18
|
+
family.id,
|
|
19
|
+
{
|
|
20
|
+
family,
|
|
21
|
+
roots: family.resolved_roots.map((root, index) => ({
|
|
22
|
+
root,
|
|
23
|
+
index,
|
|
24
|
+
base_present: false,
|
|
25
|
+
matched: false,
|
|
26
|
+
totals: emptyTotals(),
|
|
27
|
+
reasons: new Set(),
|
|
28
|
+
})),
|
|
29
|
+
totals: emptyTotals(),
|
|
30
|
+
reasons: new Set(),
|
|
31
|
+
},
|
|
32
|
+
])),
|
|
33
|
+
totals: emptyTotals(),
|
|
34
|
+
coordinationRootTotals: emptyTotals(),
|
|
35
|
+
externalRootTotals: emptyTotals(),
|
|
36
|
+
issues: new Map(),
|
|
37
|
+
allocatedBytes: options.allocatedBytes ?? allocatedBytes,
|
|
38
|
+
fs: {
|
|
39
|
+
lstat: options.fs?.lstat ?? defaultLstat,
|
|
40
|
+
opendir: options.fs?.opendir ?? defaultOpendir,
|
|
41
|
+
realpath: options.fs?.realpath ?? defaultRealpath,
|
|
42
|
+
},
|
|
43
|
+
};
|
|
44
|
+
await inspectRegisteredRoots(state);
|
|
45
|
+
await scanBoundary(state, coordStorageRoot, true);
|
|
46
|
+
for (const boundary of externalBoundaries(state)) {
|
|
47
|
+
await scanBoundary(state, boundary, false);
|
|
48
|
+
}
|
|
49
|
+
return {
|
|
50
|
+
schema: HARNERY_STORAGE_INVENTORY_SCHEMA,
|
|
51
|
+
captured_at: capturedAt.toISOString(),
|
|
52
|
+
privacy: { content_read: false, path_mode: "aggregate-labels" },
|
|
53
|
+
scan: {
|
|
54
|
+
mode: "streaming-lstat",
|
|
55
|
+
max_concurrency: MAX_CONCURRENCY,
|
|
56
|
+
project_filesystem_scope: ".harnery-and-registered-external-roots",
|
|
57
|
+
},
|
|
58
|
+
filter: {},
|
|
59
|
+
filesystem_totals: observedTotals(state.totals),
|
|
60
|
+
scope_totals: {
|
|
61
|
+
coordination_root: observedTotals(state.coordinationRootTotals),
|
|
62
|
+
registered_external_roots: observedTotals(state.externalRootTotals),
|
|
63
|
+
},
|
|
64
|
+
families: [...state.families.values()]
|
|
65
|
+
.map((family) => familyInventory(catalog, family, capturedAt))
|
|
66
|
+
.sort((left, right) => left.family_id.localeCompare(right.family_id)),
|
|
67
|
+
issues: issueRows(state.issues),
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
export function filterStorageInventory(report, filter) {
|
|
71
|
+
return {
|
|
72
|
+
...report,
|
|
73
|
+
filter: {
|
|
74
|
+
...(filter.family_id ? { family_id: filter.family_id } : {}),
|
|
75
|
+
...(filter.storage_class ? { storage_class: filter.storage_class } : {}),
|
|
76
|
+
},
|
|
77
|
+
families: report.families.filter((family) => (!filter.family_id || family.family_id === filter.family_id) &&
|
|
78
|
+
(!filter.storage_class || family.storage_class === filter.storage_class)),
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
function emptyTotals() {
|
|
82
|
+
return {
|
|
83
|
+
regular_files: 0,
|
|
84
|
+
logical_bytes: 0,
|
|
85
|
+
allocated_bytes: 0,
|
|
86
|
+
allocated_available: true,
|
|
87
|
+
allocated_identities: new Set(),
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
async function inspectRegisteredRoots(state) {
|
|
91
|
+
for (const family of state.families.values()) {
|
|
92
|
+
if (family.family.provider.inventory === "delegated") {
|
|
93
|
+
family.reasons.add("delegated_inventory_unavailable");
|
|
94
|
+
for (const root of family.roots)
|
|
95
|
+
root.reasons.add("delegated_inventory_unavailable");
|
|
96
|
+
continue;
|
|
97
|
+
}
|
|
98
|
+
for (const root of family.roots) {
|
|
99
|
+
let metadata;
|
|
100
|
+
try {
|
|
101
|
+
metadata = await state.fs.lstat(root.root.path);
|
|
102
|
+
}
|
|
103
|
+
catch (error) {
|
|
104
|
+
if (isMissing(error))
|
|
105
|
+
root.reasons.add("root_dormant");
|
|
106
|
+
else
|
|
107
|
+
root.reasons.add("unreadable_path");
|
|
108
|
+
continue;
|
|
109
|
+
}
|
|
110
|
+
if (metadata.isSymbolicLink()) {
|
|
111
|
+
root.reasons.add("symlink_rejected");
|
|
112
|
+
continue;
|
|
113
|
+
}
|
|
114
|
+
const expectedDirectory = root.root.kind === "directory";
|
|
115
|
+
if ((expectedDirectory && !metadata.isDirectory()) ||
|
|
116
|
+
(!expectedDirectory && !metadata.isFile())) {
|
|
117
|
+
root.reasons.add("wrong_root_type");
|
|
118
|
+
continue;
|
|
119
|
+
}
|
|
120
|
+
root.base_present = true;
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
function externalBoundaries(state) {
|
|
125
|
+
const boundaries = new Set();
|
|
126
|
+
for (const family of state.families.values()) {
|
|
127
|
+
if (family.family.provider.inventory !== "filesystem")
|
|
128
|
+
continue;
|
|
129
|
+
for (const { root } of family.roots) {
|
|
130
|
+
if (!within(state.coordStorageRoot, root.path))
|
|
131
|
+
boundaries.add(resolve(root.path));
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
const ordered = [...boundaries].sort((left, right) => left.length - right.length || left.localeCompare(right));
|
|
135
|
+
const collapsed = [];
|
|
136
|
+
for (const boundary of ordered) {
|
|
137
|
+
if (!collapsed.some((parent) => within(parent, boundary)))
|
|
138
|
+
collapsed.push(boundary);
|
|
139
|
+
}
|
|
140
|
+
return collapsed;
|
|
141
|
+
}
|
|
142
|
+
async function scanBoundary(state, boundary, completeCoordinationRoot) {
|
|
143
|
+
let metadata;
|
|
144
|
+
try {
|
|
145
|
+
metadata = await state.fs.lstat(boundary);
|
|
146
|
+
}
|
|
147
|
+
catch (error) {
|
|
148
|
+
if (!isMissing(error))
|
|
149
|
+
recordIssue(state, "unreadable_path");
|
|
150
|
+
return;
|
|
151
|
+
}
|
|
152
|
+
if (metadata.isSymbolicLink()) {
|
|
153
|
+
recordBoundaryIssue(state, boundary, "symlink_rejected", completeCoordinationRoot);
|
|
154
|
+
return;
|
|
155
|
+
}
|
|
156
|
+
if (!metadata.isFile() && !metadata.isDirectory()) {
|
|
157
|
+
recordBoundaryIssue(state, boundary, "special_file_rejected", completeCoordinationRoot);
|
|
158
|
+
return;
|
|
159
|
+
}
|
|
160
|
+
let safeRoot;
|
|
161
|
+
try {
|
|
162
|
+
safeRoot = await state.fs.realpath(boundary);
|
|
163
|
+
}
|
|
164
|
+
catch {
|
|
165
|
+
recordBoundaryIssue(state, boundary, "unreadable_path", completeCoordinationRoot);
|
|
166
|
+
return;
|
|
167
|
+
}
|
|
168
|
+
let targetMetadata;
|
|
169
|
+
try {
|
|
170
|
+
targetMetadata = await state.fs.lstat(safeRoot);
|
|
171
|
+
}
|
|
172
|
+
catch {
|
|
173
|
+
recordBoundaryIssue(state, boundary, "unreadable_path", completeCoordinationRoot);
|
|
174
|
+
return;
|
|
175
|
+
}
|
|
176
|
+
if (!sameIdentity(metadata, targetMetadata) ||
|
|
177
|
+
metadata.isDirectory() !== targetMetadata.isDirectory() ||
|
|
178
|
+
metadata.isFile() !== targetMetadata.isFile()) {
|
|
179
|
+
recordBoundaryIssue(state, boundary, "symlink_rejected", completeCoordinationRoot);
|
|
180
|
+
return;
|
|
181
|
+
}
|
|
182
|
+
if (metadata.isFile()) {
|
|
183
|
+
await recordRegularFile(state, safeRoot, boundary, metadata, completeCoordinationRoot, safeRoot);
|
|
184
|
+
return;
|
|
185
|
+
}
|
|
186
|
+
await scanDirectoryTree(state, safeRoot, boundary, metadata, completeCoordinationRoot);
|
|
187
|
+
}
|
|
188
|
+
async function scanDirectoryTree(state, safeRoot, logicalRoot, rootMetadata, completeCoordinationRoot) {
|
|
189
|
+
const queue = [
|
|
190
|
+
{
|
|
191
|
+
physical: safeRoot,
|
|
192
|
+
logical: logicalRoot,
|
|
193
|
+
expectedIdentity: fileIdentity(rootMetadata),
|
|
194
|
+
},
|
|
195
|
+
];
|
|
196
|
+
for (let index = 0; index < queue.length; index += 1) {
|
|
197
|
+
const current = queue[index];
|
|
198
|
+
const children = await scanDirectory(state, current.physical, current.logical, current.expectedIdentity, safeRoot, completeCoordinationRoot);
|
|
199
|
+
queue.push(...children);
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
async function scanDirectory(state, directoryPath, logicalDirectoryPath, expectedIdentity, safeRoot, completeCoordinationRoot) {
|
|
203
|
+
let metadata;
|
|
204
|
+
try {
|
|
205
|
+
metadata = await state.fs.lstat(directoryPath);
|
|
206
|
+
}
|
|
207
|
+
catch {
|
|
208
|
+
recordPathIssue(state, logicalDirectoryPath, "unreadable_path", completeCoordinationRoot);
|
|
209
|
+
return [];
|
|
210
|
+
}
|
|
211
|
+
if (metadata.isSymbolicLink()) {
|
|
212
|
+
recordPathIssue(state, logicalDirectoryPath, "symlink_rejected", completeCoordinationRoot);
|
|
213
|
+
return [];
|
|
214
|
+
}
|
|
215
|
+
if (expectedIdentity && !matchesIdentity(metadata, expectedIdentity)) {
|
|
216
|
+
recordPathIssue(state, logicalDirectoryPath, "symlink_rejected", completeCoordinationRoot);
|
|
217
|
+
return [];
|
|
218
|
+
}
|
|
219
|
+
if (!metadata.isDirectory()) {
|
|
220
|
+
recordPathIssue(state, logicalDirectoryPath, "wrong_root_type", completeCoordinationRoot);
|
|
221
|
+
return [];
|
|
222
|
+
}
|
|
223
|
+
let canonical;
|
|
224
|
+
try {
|
|
225
|
+
canonical = await state.fs.realpath(directoryPath);
|
|
226
|
+
}
|
|
227
|
+
catch {
|
|
228
|
+
recordPathIssue(state, logicalDirectoryPath, "unreadable_path", completeCoordinationRoot);
|
|
229
|
+
return [];
|
|
230
|
+
}
|
|
231
|
+
if (!within(safeRoot, canonical)) {
|
|
232
|
+
recordPathIssue(state, logicalDirectoryPath, "symlink_rejected", completeCoordinationRoot);
|
|
233
|
+
return [];
|
|
234
|
+
}
|
|
235
|
+
let canonicalMetadata;
|
|
236
|
+
try {
|
|
237
|
+
canonicalMetadata = await state.fs.lstat(canonical);
|
|
238
|
+
}
|
|
239
|
+
catch {
|
|
240
|
+
recordPathIssue(state, logicalDirectoryPath, "unreadable_path", completeCoordinationRoot);
|
|
241
|
+
return [];
|
|
242
|
+
}
|
|
243
|
+
if (!canonicalMetadata.isDirectory() || !sameIdentity(metadata, canonicalMetadata)) {
|
|
244
|
+
recordPathIssue(state, logicalDirectoryPath, "symlink_rejected", completeCoordinationRoot);
|
|
245
|
+
return [];
|
|
246
|
+
}
|
|
247
|
+
let directory;
|
|
248
|
+
try {
|
|
249
|
+
directory = await state.fs.opendir(canonical);
|
|
250
|
+
}
|
|
251
|
+
catch {
|
|
252
|
+
recordPathIssue(state, logicalDirectoryPath, "unreadable_path", completeCoordinationRoot);
|
|
253
|
+
return [];
|
|
254
|
+
}
|
|
255
|
+
try {
|
|
256
|
+
const [revalidatedPath, revalidatedCanonical] = await Promise.all([
|
|
257
|
+
state.fs.lstat(directoryPath),
|
|
258
|
+
state.fs.lstat(canonical),
|
|
259
|
+
]);
|
|
260
|
+
if (revalidatedPath.isSymbolicLink() ||
|
|
261
|
+
!sameIdentity(metadata, revalidatedPath) ||
|
|
262
|
+
!sameIdentity(metadata, revalidatedCanonical)) {
|
|
263
|
+
await closeRejectedDirectory(directory);
|
|
264
|
+
recordPathIssue(state, logicalDirectoryPath, "symlink_rejected", completeCoordinationRoot);
|
|
265
|
+
return [];
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
catch {
|
|
269
|
+
await closeRejectedDirectory(directory);
|
|
270
|
+
recordPathIssue(state, logicalDirectoryPath, "unreadable_path", completeCoordinationRoot);
|
|
271
|
+
return [];
|
|
272
|
+
}
|
|
273
|
+
const childDirectories = [];
|
|
274
|
+
let batch = [];
|
|
275
|
+
for await (const entry of directory) {
|
|
276
|
+
batch.push({
|
|
277
|
+
physical: join(canonical, entry.name),
|
|
278
|
+
logical: join(logicalDirectoryPath, entry.name),
|
|
279
|
+
});
|
|
280
|
+
if (batch.length === MAX_CONCURRENCY) {
|
|
281
|
+
childDirectories.push(...(await scanEntryBatch(state, batch, safeRoot, completeCoordinationRoot)));
|
|
282
|
+
batch = [];
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
if (batch.length > 0) {
|
|
286
|
+
childDirectories.push(...(await scanEntryBatch(state, batch, safeRoot, completeCoordinationRoot)));
|
|
287
|
+
}
|
|
288
|
+
return childDirectories;
|
|
289
|
+
}
|
|
290
|
+
async function scanEntryBatch(state, paths, safeRoot, completeCoordinationRoot) {
|
|
291
|
+
const children = await Promise.all(paths.map((path) => scanEntry(state, path, safeRoot, completeCoordinationRoot)));
|
|
292
|
+
return children.filter((path) => path !== undefined);
|
|
293
|
+
}
|
|
294
|
+
async function scanEntry(state, path, safeRoot, completeCoordinationRoot) {
|
|
295
|
+
let child;
|
|
296
|
+
try {
|
|
297
|
+
child = await state.fs.lstat(path.physical);
|
|
298
|
+
}
|
|
299
|
+
catch {
|
|
300
|
+
recordPathIssue(state, path.logical, "unreadable_path", completeCoordinationRoot);
|
|
301
|
+
return undefined;
|
|
302
|
+
}
|
|
303
|
+
if (child.isSymbolicLink()) {
|
|
304
|
+
if (!allowsSymbolicLinkSkip(state, path.logical)) {
|
|
305
|
+
recordPathIssue(state, path.logical, "symlink_rejected", completeCoordinationRoot);
|
|
306
|
+
}
|
|
307
|
+
}
|
|
308
|
+
else if (child.isDirectory()) {
|
|
309
|
+
return { ...path, expectedIdentity: fileIdentity(child) };
|
|
310
|
+
}
|
|
311
|
+
else if (child.isFile()) {
|
|
312
|
+
await recordRegularFile(state, path.physical, path.logical, child, completeCoordinationRoot, safeRoot);
|
|
313
|
+
}
|
|
314
|
+
else {
|
|
315
|
+
recordPathIssue(state, path.logical, "special_file_rejected", completeCoordinationRoot);
|
|
316
|
+
}
|
|
317
|
+
return undefined;
|
|
318
|
+
}
|
|
319
|
+
async function closeRejectedDirectory(directory) {
|
|
320
|
+
try {
|
|
321
|
+
await directory.close();
|
|
322
|
+
}
|
|
323
|
+
catch {
|
|
324
|
+
// Rejection remains fail-closed even when the platform already closed it.
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
function sameIdentity(left, right) {
|
|
328
|
+
return left.dev === right.dev && left.ino === right.ino;
|
|
329
|
+
}
|
|
330
|
+
function fileIdentity(stats) {
|
|
331
|
+
return { dev: stats.dev, ino: stats.ino };
|
|
332
|
+
}
|
|
333
|
+
function matchesIdentity(stats, identity) {
|
|
334
|
+
return stats.dev === identity.dev && stats.ino === identity.ino;
|
|
335
|
+
}
|
|
336
|
+
async function recordRegularFile(state, physicalPath, logicalPath, metadata, completeCoordinationRoot, safeRoot) {
|
|
337
|
+
let canonical;
|
|
338
|
+
let canonicalMetadata;
|
|
339
|
+
try {
|
|
340
|
+
canonical = await state.fs.realpath(physicalPath);
|
|
341
|
+
canonicalMetadata = await state.fs.lstat(canonical);
|
|
342
|
+
}
|
|
343
|
+
catch {
|
|
344
|
+
recordPathIssue(state, logicalPath, "unreadable_path", completeCoordinationRoot);
|
|
345
|
+
return;
|
|
346
|
+
}
|
|
347
|
+
if (!within(safeRoot, canonical) || !sameIdentity(metadata, canonicalMetadata)) {
|
|
348
|
+
recordPathIssue(state, logicalPath, "symlink_rejected", completeCoordinationRoot);
|
|
349
|
+
return;
|
|
350
|
+
}
|
|
351
|
+
const matches = filesystemMatches(state, logicalPath);
|
|
352
|
+
if (!completeCoordinationRoot && matches.length === 0)
|
|
353
|
+
return;
|
|
354
|
+
const hardLinkAmbiguous = metadata.nlink > 1 && !allowsHardLink(state, logicalPath);
|
|
355
|
+
if (hardLinkAmbiguous)
|
|
356
|
+
recordIssue(state, "hard_link_ambiguous");
|
|
357
|
+
const allocatedCandidate = state.allocatedBytes(metadata);
|
|
358
|
+
const allocated = allocatedCandidate !== undefined &&
|
|
359
|
+
Number.isSafeInteger(allocatedCandidate) &&
|
|
360
|
+
allocatedCandidate >= 0
|
|
361
|
+
? allocatedCandidate
|
|
362
|
+
: undefined;
|
|
363
|
+
const allocationIdentity = metadata.nlink > 1 ? fileIdentity(metadata) : undefined;
|
|
364
|
+
addFile(state.totals, metadata.size, allocated, allocationIdentity);
|
|
365
|
+
addFile(completeCoordinationRoot ? state.coordinationRootTotals : state.externalRootTotals, metadata.size, allocated, allocationIdentity);
|
|
366
|
+
if (allocated === undefined)
|
|
367
|
+
recordIssue(state, "allocated_bytes_unavailable");
|
|
368
|
+
if (matches.length === 0) {
|
|
369
|
+
const exclusion = state.catalog.exclusions.some(({ root }) => rootMatches(root, logicalPath));
|
|
370
|
+
recordIssue(state, exclusion ? "host_exclusion" : "unregistered_path");
|
|
371
|
+
return;
|
|
372
|
+
}
|
|
373
|
+
if (matches.length > 1) {
|
|
374
|
+
recordIssue(state, "overlapping_registration");
|
|
375
|
+
for (const match of matches)
|
|
376
|
+
match.reasons.add("overlapping_registration");
|
|
377
|
+
return;
|
|
378
|
+
}
|
|
379
|
+
const family = matches[0];
|
|
380
|
+
const roots = family.roots.filter(({ root }) => rootMatches(root, logicalPath));
|
|
381
|
+
if (roots.length !== 1) {
|
|
382
|
+
recordIssue(state, "overlapping_registration");
|
|
383
|
+
family.reasons.add("overlapping_registration");
|
|
384
|
+
return;
|
|
385
|
+
}
|
|
386
|
+
addFile(family.totals, metadata.size, allocated, allocationIdentity);
|
|
387
|
+
family.roots[roots[0].index].matched = true;
|
|
388
|
+
addFile(family.roots[roots[0].index].totals, metadata.size, allocated, allocationIdentity);
|
|
389
|
+
if (hardLinkAmbiguous) {
|
|
390
|
+
family.reasons.add("hard_link_ambiguous");
|
|
391
|
+
family.roots[roots[0].index].reasons.add("hard_link_ambiguous");
|
|
392
|
+
}
|
|
393
|
+
if (allocated === undefined) {
|
|
394
|
+
family.reasons.add("allocated_bytes_unavailable");
|
|
395
|
+
family.roots[roots[0].index].reasons.add("allocated_bytes_unavailable");
|
|
396
|
+
}
|
|
397
|
+
}
|
|
398
|
+
function recordPathIssue(state, path, reason, completeCoordinationRoot) {
|
|
399
|
+
const matches = filesystemMatches(state, path);
|
|
400
|
+
if (!completeCoordinationRoot && matches.length === 0)
|
|
401
|
+
return;
|
|
402
|
+
recordIssue(state, reason);
|
|
403
|
+
if (matches.length === 0 && completeCoordinationRoot)
|
|
404
|
+
recordIssue(state, "unregistered_path");
|
|
405
|
+
for (const family of matches) {
|
|
406
|
+
family.reasons.add(reason);
|
|
407
|
+
for (const root of family.roots.filter(({ root }) => rootMatches(root, path))) {
|
|
408
|
+
root.reasons.add(reason);
|
|
409
|
+
}
|
|
410
|
+
}
|
|
411
|
+
}
|
|
412
|
+
function recordBoundaryIssue(state, path, reason, completeCoordinationRoot) {
|
|
413
|
+
const resolved = resolve(path);
|
|
414
|
+
const matches = [...state.families.values()].filter((family) => family.family.provider.inventory === "filesystem" &&
|
|
415
|
+
family.roots.some(({ root }) => resolve(root.path) === resolved));
|
|
416
|
+
recordIssue(state, reason);
|
|
417
|
+
if (matches.length === 0 && completeCoordinationRoot)
|
|
418
|
+
recordIssue(state, "unregistered_path");
|
|
419
|
+
for (const family of matches) {
|
|
420
|
+
family.reasons.add(reason);
|
|
421
|
+
for (const root of family.roots.filter(({ root }) => resolve(root.path) === resolved)) {
|
|
422
|
+
root.reasons.add(reason);
|
|
423
|
+
}
|
|
424
|
+
}
|
|
425
|
+
}
|
|
426
|
+
function filesystemMatches(state, path) {
|
|
427
|
+
return state.catalog
|
|
428
|
+
.familiesForPath(path)
|
|
429
|
+
.filter((family) => family.provider.inventory === "filesystem")
|
|
430
|
+
.map((family) => state.families.get(family.id));
|
|
431
|
+
}
|
|
432
|
+
function addFile(totals, logicalBytes, allocated, allocationIdentity) {
|
|
433
|
+
totals.regular_files += 1;
|
|
434
|
+
totals.logical_bytes += logicalBytes;
|
|
435
|
+
if (allocated === undefined || !Number.isSafeInteger(allocated) || allocated < 0) {
|
|
436
|
+
totals.allocated_available = false;
|
|
437
|
+
}
|
|
438
|
+
else {
|
|
439
|
+
const key = allocationIdentity
|
|
440
|
+
? `${allocationIdentity.dev}:${allocationIdentity.ino}`
|
|
441
|
+
: undefined;
|
|
442
|
+
if (key === undefined || !totals.allocated_identities.has(key)) {
|
|
443
|
+
if (key !== undefined)
|
|
444
|
+
totals.allocated_identities.add(key);
|
|
445
|
+
totals.allocated_bytes += allocated;
|
|
446
|
+
}
|
|
447
|
+
}
|
|
448
|
+
}
|
|
449
|
+
function allowsSymbolicLinkSkip(state, path) {
|
|
450
|
+
return matchingRoot(state, path)?.root.link_handling?.symbolic_links === "skip";
|
|
451
|
+
}
|
|
452
|
+
function allowsHardLink(state, path) {
|
|
453
|
+
return matchingRoot(state, path)?.root.link_handling?.hard_links === "allow";
|
|
454
|
+
}
|
|
455
|
+
function matchingRoot(state, path) {
|
|
456
|
+
const families = filesystemMatches(state, path);
|
|
457
|
+
if (families.length !== 1)
|
|
458
|
+
return undefined;
|
|
459
|
+
const roots = families[0].roots.filter(({ root }) => rootMatches(root, path));
|
|
460
|
+
if (roots.length !== 1)
|
|
461
|
+
return undefined;
|
|
462
|
+
return roots[0];
|
|
463
|
+
}
|
|
464
|
+
function allocatedBytes(stats) {
|
|
465
|
+
if (typeof stats.blocks !== "number" || !Number.isSafeInteger(stats.blocks))
|
|
466
|
+
return undefined;
|
|
467
|
+
const bytes = stats.blocks * 512;
|
|
468
|
+
return Number.isSafeInteger(bytes) ? bytes : undefined;
|
|
469
|
+
}
|
|
470
|
+
function recordIssue(state, reason) {
|
|
471
|
+
state.issues.set(reason, (state.issues.get(reason) ?? 0) + 1);
|
|
472
|
+
}
|
|
473
|
+
function familyInventory(catalog, accumulator, capturedAt) {
|
|
474
|
+
const delegated = accumulator.family.provider.inventory === "delegated";
|
|
475
|
+
const roots = accumulator.roots.map((root) => rootInventory(catalog, accumulator, root));
|
|
476
|
+
const rootStates = new Set(roots.map(({ state }) => state));
|
|
477
|
+
const reasons = new Set(accumulator.reasons);
|
|
478
|
+
for (const root of roots)
|
|
479
|
+
for (const reason of root.reason_codes)
|
|
480
|
+
reasons.add(reason);
|
|
481
|
+
let state;
|
|
482
|
+
if (delegated)
|
|
483
|
+
state = "delegated";
|
|
484
|
+
else if (rootStates.has("unavailable") && rootStates.size === 1)
|
|
485
|
+
state = "unavailable";
|
|
486
|
+
else if (rootStates.has("unavailable") || rootStates.has("partial"))
|
|
487
|
+
state = "partial";
|
|
488
|
+
else if (rootStates.has("present") && rootStates.has("dormant"))
|
|
489
|
+
state = "partial";
|
|
490
|
+
else if (rootStates.has("present"))
|
|
491
|
+
state = "present";
|
|
492
|
+
else
|
|
493
|
+
state = "dormant";
|
|
494
|
+
if (state === "dormant" || rootStates.has("dormant"))
|
|
495
|
+
reasons.add("root_dormant");
|
|
496
|
+
return {
|
|
497
|
+
family_id: accumulator.family.id,
|
|
498
|
+
source: accumulator.family.source,
|
|
499
|
+
storage_class: accumulator.family.storage_class,
|
|
500
|
+
policy_version: accumulator.family.policy.policy_version,
|
|
501
|
+
provider_id: accumulator.family.provider.provider_id,
|
|
502
|
+
inventory: accumulator.family.provider.inventory,
|
|
503
|
+
maintenance: maintenance(accumulator.family, state, reasons),
|
|
504
|
+
state,
|
|
505
|
+
reason_codes: [...reasons].sort(),
|
|
506
|
+
totals: delegated
|
|
507
|
+
? unavailableTotals("delegated_inventory_unavailable")
|
|
508
|
+
: observedTotals(accumulator.totals),
|
|
509
|
+
roots,
|
|
510
|
+
...(isLogFamily(accumulator.family)
|
|
511
|
+
? { log_storage: logStorageStatus(accumulator.family, capturedAt) }
|
|
512
|
+
: {}),
|
|
513
|
+
};
|
|
514
|
+
}
|
|
515
|
+
function logStorageStatus(family, now) {
|
|
516
|
+
const inspection = inspectStructuredLogRetention(family, now);
|
|
517
|
+
const effective = family.effective_log_retention;
|
|
518
|
+
return {
|
|
519
|
+
effective_policy: effective
|
|
520
|
+
? {
|
|
521
|
+
state: effective.state,
|
|
522
|
+
max_bytes: effective.max_bytes,
|
|
523
|
+
max_age_days: effective.max_age_days,
|
|
524
|
+
max_age_ms: effective.max_age_ms,
|
|
525
|
+
fingerprint: effective.effective_policy_fingerprint,
|
|
526
|
+
provenance: effective.provenance,
|
|
527
|
+
diagnostics: effective.diagnostics,
|
|
528
|
+
}
|
|
529
|
+
: null,
|
|
530
|
+
usage: inspection.usage,
|
|
531
|
+
pressure: inspection.pressure,
|
|
532
|
+
retention: inspection.retention,
|
|
533
|
+
};
|
|
534
|
+
}
|
|
535
|
+
function isLogFamily(family) {
|
|
536
|
+
return family.storage_class === "operational-log" || family.storage_class === "debug-log";
|
|
537
|
+
}
|
|
538
|
+
function rootInventory(catalog, family, root) {
|
|
539
|
+
const delegated = family.family.provider.inventory === "delegated";
|
|
540
|
+
const reasons = new Set(root.reasons);
|
|
541
|
+
let state;
|
|
542
|
+
if (delegated)
|
|
543
|
+
state = "delegated";
|
|
544
|
+
else if (reasons.has("unreadable_path") || reasons.has("wrong_root_type"))
|
|
545
|
+
state = "unavailable";
|
|
546
|
+
else if (reasons.has("symlink_rejected"))
|
|
547
|
+
state = "unavailable";
|
|
548
|
+
else if (root.matched || (root.base_present && root.root.match === "subtree"))
|
|
549
|
+
state = "present";
|
|
550
|
+
else if (root.base_present && root.root.match === "exact" && root.root.kind === "directory") {
|
|
551
|
+
state = "present";
|
|
552
|
+
}
|
|
553
|
+
else {
|
|
554
|
+
state = "dormant";
|
|
555
|
+
reasons.add("root_dormant");
|
|
556
|
+
}
|
|
557
|
+
return {
|
|
558
|
+
root_index: root.index,
|
|
559
|
+
root_label: rootLabel(catalog, family.family.id, root),
|
|
560
|
+
ownership: root.root.ownership ?? "harnery",
|
|
561
|
+
state,
|
|
562
|
+
reason_codes: [...reasons].sort(),
|
|
563
|
+
totals: delegated
|
|
564
|
+
? unavailableTotals("delegated_inventory_unavailable")
|
|
565
|
+
: observedTotals(root.totals),
|
|
566
|
+
};
|
|
567
|
+
}
|
|
568
|
+
function rootLabel(catalog, familyId, root) {
|
|
569
|
+
const rel = relative(catalog.context.coord_root, root.root.path);
|
|
570
|
+
if (rel === "")
|
|
571
|
+
return ".";
|
|
572
|
+
if (!rel.startsWith("..") && !isAbsolute(rel))
|
|
573
|
+
return rel.split(sep).join("/");
|
|
574
|
+
return `<external:${familyId}:${root.index + 1}>`;
|
|
575
|
+
}
|
|
576
|
+
function maintenance(family, state, reasons) {
|
|
577
|
+
if (family.provider.maintenance === "delegated") {
|
|
578
|
+
return { state: "delegated", reason_code: "maintenance_delegated" };
|
|
579
|
+
}
|
|
580
|
+
if (family.provider.maintenance === "none") {
|
|
581
|
+
return { state: "ineligible", reason_code: "maintenance_not_registered" };
|
|
582
|
+
}
|
|
583
|
+
if (family.policy.retention.status !== "active") {
|
|
584
|
+
return { state: "ineligible", reason_code: "maintenance_policy_inactive" };
|
|
585
|
+
}
|
|
586
|
+
if (state !== "present" || reasons.has("allocated_bytes_unavailable")) {
|
|
587
|
+
return { state: "ineligible", reason_code: "provider_unavailable" };
|
|
588
|
+
}
|
|
589
|
+
if ([...reasons].some((reason) => [
|
|
590
|
+
"host_exclusion",
|
|
591
|
+
"hard_link_ambiguous",
|
|
592
|
+
"overlapping_registration",
|
|
593
|
+
"special_file_rejected",
|
|
594
|
+
"symlink_rejected",
|
|
595
|
+
"unreadable_path",
|
|
596
|
+
"unregistered_path",
|
|
597
|
+
"wrong_root_type",
|
|
598
|
+
].includes(reason))) {
|
|
599
|
+
return { state: "ineligible", reason_code: "provider_unavailable" };
|
|
600
|
+
}
|
|
601
|
+
return { state: "eligible" };
|
|
602
|
+
}
|
|
603
|
+
function observedTotals(totals) {
|
|
604
|
+
return {
|
|
605
|
+
regular_files: observed("files", totals.regular_files),
|
|
606
|
+
logical_bytes: observed("bytes", totals.logical_bytes),
|
|
607
|
+
allocated_bytes: totals.allocated_available
|
|
608
|
+
? observed("bytes", totals.allocated_bytes)
|
|
609
|
+
: unavailable("bytes", "allocated_bytes_unavailable"),
|
|
610
|
+
};
|
|
611
|
+
}
|
|
612
|
+
function unavailableTotals(reason) {
|
|
613
|
+
return {
|
|
614
|
+
regular_files: unavailable("files", reason),
|
|
615
|
+
logical_bytes: unavailable("bytes", reason),
|
|
616
|
+
allocated_bytes: unavailable("bytes", reason),
|
|
617
|
+
};
|
|
618
|
+
}
|
|
619
|
+
function observed(unit, value) {
|
|
620
|
+
return { state: "observed", unit, value };
|
|
621
|
+
}
|
|
622
|
+
function unavailable(unit, reason_code) {
|
|
623
|
+
return { state: "unavailable", unit, reason_code };
|
|
624
|
+
}
|
|
625
|
+
function issueRows(issues) {
|
|
626
|
+
return [...issues.entries()]
|
|
627
|
+
.map(([reason_code, count]) => ({ reason_code, count, maintenance_eligible: false }))
|
|
628
|
+
.sort((left, right) => left.reason_code.localeCompare(right.reason_code));
|
|
629
|
+
}
|
|
630
|
+
function rootMatches(root, candidate) {
|
|
631
|
+
const path = resolve(candidate);
|
|
632
|
+
if (root.match === "exact")
|
|
633
|
+
return resolve(root.path) === path;
|
|
634
|
+
const remainder = relative(root.path, path).split(sep).join("/");
|
|
635
|
+
if (remainder === "" || remainder.startsWith("..") || isAbsolute(remainder))
|
|
636
|
+
return false;
|
|
637
|
+
if (root.match === "subtree")
|
|
638
|
+
return true;
|
|
639
|
+
return root.include.some((pattern) => globRegex(pattern).test(remainder));
|
|
640
|
+
}
|
|
641
|
+
function globRegex(pattern) {
|
|
642
|
+
let source = "^";
|
|
643
|
+
for (let index = 0; index < pattern.length; index += 1) {
|
|
644
|
+
const character = pattern[index];
|
|
645
|
+
if (character === "*") {
|
|
646
|
+
if (pattern[index + 1] === "*") {
|
|
647
|
+
source += ".*";
|
|
648
|
+
index += 1;
|
|
649
|
+
}
|
|
650
|
+
else
|
|
651
|
+
source += "[^/]*";
|
|
652
|
+
}
|
|
653
|
+
else if (character === "?")
|
|
654
|
+
source += "[^/]";
|
|
655
|
+
else
|
|
656
|
+
source += character.replace(/[|\\{}()[\]^$+?.]/g, "\\$&");
|
|
657
|
+
}
|
|
658
|
+
return new RegExp(`${source}$`);
|
|
659
|
+
}
|
|
660
|
+
function within(root, candidate) {
|
|
661
|
+
const remainder = relative(resolve(root), resolve(candidate));
|
|
662
|
+
return remainder === "" || (!remainder.startsWith("..") && !isAbsolute(remainder));
|
|
663
|
+
}
|
|
664
|
+
function isMissing(error) {
|
|
665
|
+
return error?.code === "ENOENT";
|
|
666
|
+
}
|