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,23 @@
|
|
|
1
|
+
import { createHash } from "node:crypto";
|
|
2
|
+
import { realpathSync } from "node:fs";
|
|
3
|
+
import { DEFAULT_WEB_PORT } from "./local-file-url.ts";
|
|
4
|
+
|
|
5
|
+
/** Local-only endpoint used to prove that a dashboard serves the caller's repo. */
|
|
6
|
+
export const COORD_ROOT_ID_PATH = "/api/coord-root";
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Opaque identity for a canonical coordination root. The path stays local;
|
|
10
|
+
* only its digest crosses the dashboard boundary.
|
|
11
|
+
*/
|
|
12
|
+
export function coordRootId(root: string): string {
|
|
13
|
+
const canonical = realpathSync(root);
|
|
14
|
+
return `sha256:${createHash("sha256").update(canonical).digest("hex")}`;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export function localCoordRootIdUrl(
|
|
18
|
+
port: number | string = DEFAULT_WEB_PORT,
|
|
19
|
+
protocol = "http:",
|
|
20
|
+
): string {
|
|
21
|
+
const portPart = String(port) === "" ? "" : `:${port}`;
|
|
22
|
+
return `${protocol}//127.0.0.1${portPart}${COORD_ROOT_ID_PATH}`;
|
|
23
|
+
}
|
package/src/lib/docs-lint.ts
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { existsSync as __existsSyncForDocs } from "node:fs";
|
|
2
2
|
import { resolve as __resolveForDocs } from "node:path";
|
|
3
3
|
import { hasYamlStatus } from "./docs-frontmatter.ts";
|
|
4
|
-
import {
|
|
5
|
-
|
|
4
|
+
import {
|
|
5
|
+
auditDocsMetadataRepository,
|
|
6
|
+
initDocsMetadataAuditContext,
|
|
7
|
+
} from "./docs-metadata-audit.ts";
|
|
6
8
|
|
|
7
9
|
// Module-level docs context, initialized by initDocsContext() before any
|
|
8
10
|
// other function in this file is called. Consumers pass repo metadata
|
|
@@ -34,8 +36,13 @@ function isSubmoduleInitialized(name: string): boolean {
|
|
|
34
36
|
return __existsSyncForDocs(__resolveForDocs(REPO_ROOT, name, ".git"));
|
|
35
37
|
}
|
|
36
38
|
|
|
37
|
-
import {
|
|
39
|
+
import { readFileSync } from "node:fs";
|
|
38
40
|
import { basename, join } from "node:path";
|
|
41
|
+
import {
|
|
42
|
+
createDocsRepositoryView,
|
|
43
|
+
type DocsRepositorySource,
|
|
44
|
+
type DocsRepositoryView,
|
|
45
|
+
} from "./docs-repository-view.ts";
|
|
39
46
|
|
|
40
47
|
/**
|
|
41
48
|
* Documentation linter. Enforces the docs directory-layout + naming contract.
|
|
@@ -58,6 +65,7 @@ export interface Violation {
|
|
|
58
65
|
export interface LintOpts {
|
|
59
66
|
fast?: boolean;
|
|
60
67
|
repo?: string; // limit to one submodule or "." for parent
|
|
68
|
+
source?: DocsRepositorySource;
|
|
61
69
|
}
|
|
62
70
|
|
|
63
71
|
/** Files allowed at a submodule root level. Includes:
|
|
@@ -145,15 +153,9 @@ function getTargetRepos(opts: LintOpts): { name: string; path: string; isSubmodu
|
|
|
145
153
|
return all;
|
|
146
154
|
}
|
|
147
155
|
|
|
148
|
-
/**
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
*/
|
|
152
|
-
async function findMarkdownFiles(root: string): Promise<string[]> {
|
|
153
|
-
const result = await sh('git ls-files --cached "**/*.md" "*.md"', { cwd: root });
|
|
154
|
-
if (result.exitCode !== 0 || !result.stdout) return [];
|
|
155
|
-
return result.stdout
|
|
156
|
-
.split("\n")
|
|
156
|
+
/** Select tracked Markdown from the coherent repository view. */
|
|
157
|
+
function findMarkdownFiles(view: DocsRepositoryView): string[] {
|
|
158
|
+
return view.trackedPaths
|
|
157
159
|
.filter((f) => f.endsWith(".md"))
|
|
158
160
|
.filter(
|
|
159
161
|
(f) =>
|
|
@@ -164,19 +166,9 @@ async function findMarkdownFiles(root: string): Promise<string[]> {
|
|
|
164
166
|
);
|
|
165
167
|
}
|
|
166
168
|
|
|
167
|
-
/** Read first N lines of a file for header inspection */
|
|
168
|
-
function readHead(path: string, lines = 20): string {
|
|
169
|
-
try {
|
|
170
|
-
const content = readFileSync(path, "utf8");
|
|
171
|
-
return content.split("\n").slice(0, lines).join("\n");
|
|
172
|
-
} catch {
|
|
173
|
-
return "";
|
|
174
|
-
}
|
|
175
|
-
}
|
|
176
|
-
|
|
177
169
|
/** Detect whether a file declares itself an intentional monolith */
|
|
178
|
-
function isDeclaredMonolith(
|
|
179
|
-
const head =
|
|
170
|
+
function isDeclaredMonolith(content: string): boolean {
|
|
171
|
+
const head = content.split("\n").slice(0, 10).join("\n");
|
|
180
172
|
return /INTENTIONAL-MONOLITH/i.test(head);
|
|
181
173
|
}
|
|
182
174
|
|
|
@@ -192,10 +184,14 @@ export function hasStatusHeader(path: string): boolean {
|
|
|
192
184
|
// --- Individual checks ---
|
|
193
185
|
|
|
194
186
|
/** Entry tier files exist at the repo root */
|
|
195
|
-
function checkEntryTier(
|
|
187
|
+
function checkEntryTier(
|
|
188
|
+
repoName: string,
|
|
189
|
+
view: DocsRepositoryView,
|
|
190
|
+
isSubmodule: boolean,
|
|
191
|
+
): Violation[] {
|
|
196
192
|
const violations: Violation[] = [];
|
|
197
193
|
// README.md is required for any repo
|
|
198
|
-
if (!
|
|
194
|
+
if (!view.has("README.md")) {
|
|
199
195
|
violations.push({
|
|
200
196
|
severity: "error",
|
|
201
197
|
repo: repoName,
|
|
@@ -205,7 +201,7 @@ function checkEntryTier(repoName: string, repoPath: string, isSubmodule: boolean
|
|
|
205
201
|
});
|
|
206
202
|
}
|
|
207
203
|
// CLAUDE.md required for submodules (primary LLM context)
|
|
208
|
-
if (isSubmodule && !
|
|
204
|
+
if (isSubmodule && !view.has("CLAUDE.md")) {
|
|
209
205
|
violations.push({
|
|
210
206
|
severity: "error",
|
|
211
207
|
repo: repoName,
|
|
@@ -218,14 +214,9 @@ function checkEntryTier(repoName: string, repoPath: string, isSubmodule: boolean
|
|
|
218
214
|
}
|
|
219
215
|
|
|
220
216
|
/** No forbidden root-level files */
|
|
221
|
-
function checkRootAllowlist(repoName: string,
|
|
217
|
+
function checkRootAllowlist(repoName: string, view: DocsRepositoryView): Violation[] {
|
|
222
218
|
const violations: Violation[] = [];
|
|
223
|
-
|
|
224
|
-
try {
|
|
225
|
-
entries = readdirSync(repoPath);
|
|
226
|
-
} catch {
|
|
227
|
-
return violations;
|
|
228
|
-
}
|
|
219
|
+
const entries = view.directFileNames(".");
|
|
229
220
|
for (const entry of entries) {
|
|
230
221
|
if (!entry.endsWith(".md")) continue;
|
|
231
222
|
if (ROOT_FILE_ALLOWLIST.has(entry)) continue;
|
|
@@ -257,27 +248,13 @@ function checkRootAllowlist(repoName: string, repoPath: string): Violation[] {
|
|
|
257
248
|
* a no-op unless the host supplies `docsRootAllowlist`. Parent-repo only:
|
|
258
249
|
* submodule `docs/` roots have their own entry tiers, not this one.
|
|
259
250
|
*/
|
|
260
|
-
function checkDocsRootAllowlist(repoName: string,
|
|
251
|
+
function checkDocsRootAllowlist(repoName: string, view: DocsRepositoryView): Violation[] {
|
|
261
252
|
const violations: Violation[] = [];
|
|
262
253
|
if (DOCS_ROOT_ALLOWLIST.length === 0) return violations; // opt-in
|
|
263
254
|
if (repoName !== "(root)") return violations; // parent repo only
|
|
264
255
|
const allow = new Set(DOCS_ROOT_ALLOWLIST);
|
|
265
|
-
const
|
|
266
|
-
let entries: string[];
|
|
267
|
-
try {
|
|
268
|
-
entries = readdirSync(docsDir);
|
|
269
|
-
} catch {
|
|
270
|
-
return violations; // no docs/ dir — nothing to check
|
|
271
|
-
}
|
|
256
|
+
const entries = view.directFileNames("docs");
|
|
272
257
|
for (const entry of entries) {
|
|
273
|
-
// Subdirs are the intended home for topic docs; only loose files matter.
|
|
274
|
-
let isFile: boolean;
|
|
275
|
-
try {
|
|
276
|
-
isFile = statSync(join(docsDir, entry)).isFile();
|
|
277
|
-
} catch {
|
|
278
|
-
continue;
|
|
279
|
-
}
|
|
280
|
-
if (!isFile) continue;
|
|
281
258
|
if (!(entry.endsWith(".md") || entry.endsWith(".json"))) continue;
|
|
282
259
|
if (allow.has(entry)) continue;
|
|
283
260
|
violations.push({
|
|
@@ -383,13 +360,14 @@ function checkChangelogNames(repoName: string, _repoPath: string, files: string[
|
|
|
383
360
|
}
|
|
384
361
|
|
|
385
362
|
/** Intentional monoliths >30KB need a declaration banner */
|
|
386
|
-
function checkMonolithDeclaration(
|
|
363
|
+
async function checkMonolithDeclaration(
|
|
387
364
|
repoName: string,
|
|
388
|
-
|
|
365
|
+
view: DocsRepositoryView,
|
|
389
366
|
files: string[],
|
|
390
|
-
): Violation[] {
|
|
367
|
+
): Promise<Violation[]> {
|
|
391
368
|
const violations: Violation[] = [];
|
|
392
369
|
const SIZE_THRESHOLD = 30 * 1024;
|
|
370
|
+
const candidatePaths: string[] = [];
|
|
393
371
|
for (const rel of files) {
|
|
394
372
|
// Only flag top-level docs/ files, not per-repo entry tier (LLM-BRIEFING
|
|
395
373
|
// files are monoliths by convention, no banner needed).
|
|
@@ -399,15 +377,17 @@ function checkMonolithDeclaration(
|
|
|
399
377
|
if (rel.startsWith("docs/audits/")) continue;
|
|
400
378
|
if (rel.startsWith("docs/issues/")) continue;
|
|
401
379
|
if (rel.startsWith("docs/changelogs/")) continue;
|
|
402
|
-
const
|
|
403
|
-
|
|
404
|
-
try {
|
|
405
|
-
size = statSync(full).size;
|
|
406
|
-
} catch {
|
|
407
|
-
continue;
|
|
408
|
-
}
|
|
380
|
+
const size = await view.byteLength(rel);
|
|
381
|
+
if (size === null) continue;
|
|
409
382
|
if (size < SIZE_THRESHOLD) continue;
|
|
410
|
-
|
|
383
|
+
candidatePaths.push(rel);
|
|
384
|
+
}
|
|
385
|
+
const texts = await view.readTexts(candidatePaths);
|
|
386
|
+
for (const rel of candidatePaths) {
|
|
387
|
+
const content = texts.get(rel);
|
|
388
|
+
if (content === undefined || isDeclaredMonolith(content)) continue;
|
|
389
|
+
const size = await view.byteLength(rel);
|
|
390
|
+
if (size === null) continue;
|
|
411
391
|
violations.push({
|
|
412
392
|
severity: "warning",
|
|
413
393
|
repo: repoName,
|
|
@@ -426,30 +406,31 @@ export async function runLint(opts: LintOpts): Promise<Violation[]> {
|
|
|
426
406
|
const repos = getTargetRepos(opts);
|
|
427
407
|
|
|
428
408
|
for (const { name, path, isSubmodule } of repos) {
|
|
429
|
-
|
|
430
|
-
violations.push(...
|
|
431
|
-
violations.push(...
|
|
409
|
+
const view = await createDocsRepositoryView(path, opts.source ?? "worktree");
|
|
410
|
+
violations.push(...checkEntryTier(name, view, isSubmodule));
|
|
411
|
+
violations.push(...checkRootAllowlist(name, view));
|
|
412
|
+
violations.push(...checkDocsRootAllowlist(name, view));
|
|
432
413
|
|
|
433
|
-
const files =
|
|
414
|
+
const files = findMarkdownFiles(view);
|
|
434
415
|
violations.push(...checkNamingConvention(name, path, files));
|
|
435
416
|
violations.push(...checkDatedDirs(name, path, files));
|
|
436
417
|
violations.push(...checkChangelogNames(name, path, files));
|
|
437
418
|
|
|
438
419
|
if (!opts.fast) {
|
|
439
|
-
violations.push(...checkMonolithDeclaration(name,
|
|
420
|
+
violations.push(...(await checkMonolithDeclaration(name, view, files)));
|
|
440
421
|
}
|
|
441
|
-
}
|
|
442
422
|
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
423
|
+
const metadataRows = await auditDocsMetadataRepository(name, view);
|
|
424
|
+
for (const row of metadataRows) {
|
|
425
|
+
for (const issue of row.issues.filter((entry) => entry.severity === "error")) {
|
|
426
|
+
violations.push({
|
|
427
|
+
severity: "error",
|
|
428
|
+
repo: row.repo,
|
|
429
|
+
path: row.path,
|
|
430
|
+
rule: `metadata-v2:${issue.code}`,
|
|
431
|
+
message: issue.field ? `${issue.field}: ${issue.message}` : issue.message,
|
|
432
|
+
});
|
|
433
|
+
}
|
|
453
434
|
}
|
|
454
435
|
}
|
|
455
436
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { existsSync
|
|
1
|
+
import { existsSync } from "node:fs";
|
|
2
2
|
import { join, relative, resolve } from "node:path";
|
|
3
3
|
import { parseFrontmatter } from "./docs-frontmatter.ts";
|
|
4
4
|
import { isManagedDocsMetadataFile, managedDocsMetadataType } from "./docs-metadata-managed.ts";
|
|
@@ -9,7 +9,11 @@ import {
|
|
|
9
9
|
isDocsMetadataV2,
|
|
10
10
|
validateDocsMetadataV2,
|
|
11
11
|
} from "./docs-metadata-v2.ts";
|
|
12
|
-
import {
|
|
12
|
+
import {
|
|
13
|
+
createDocsRepositoryView,
|
|
14
|
+
type DocsRepositorySource,
|
|
15
|
+
type DocsRepositoryView,
|
|
16
|
+
} from "./docs-repository-view.ts";
|
|
13
17
|
|
|
14
18
|
let REPO_ROOT = "";
|
|
15
19
|
let SUBMODULES: readonly string[] = [];
|
|
@@ -24,6 +28,7 @@ export function initDocsMetadataAuditContext(opts: {
|
|
|
24
28
|
|
|
25
29
|
export interface DocsMetadataAuditOpts {
|
|
26
30
|
repo?: string;
|
|
31
|
+
source?: DocsRepositorySource;
|
|
27
32
|
}
|
|
28
33
|
|
|
29
34
|
export type DocsMetadataAuditState = "valid" | "invalid" | "legacy" | "missing";
|
|
@@ -40,20 +45,12 @@ function isInitializedRepo(path: string): boolean {
|
|
|
40
45
|
return existsSync(join(path, ".git"));
|
|
41
46
|
}
|
|
42
47
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
.filter((path) => path.endsWith(".md"));
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
function auditFile(repoName: string, repoPath: string, path: string): DocsMetadataAuditRow | null {
|
|
53
|
-
let content: string;
|
|
54
|
-
try {
|
|
55
|
-
content = readFileSync(join(repoPath, path), "utf8");
|
|
56
|
-
} catch {
|
|
48
|
+
function auditFile(
|
|
49
|
+
repoName: string,
|
|
50
|
+
path: string,
|
|
51
|
+
content: string | undefined,
|
|
52
|
+
): DocsMetadataAuditRow | null {
|
|
53
|
+
if (content === undefined) {
|
|
57
54
|
return {
|
|
58
55
|
repo: repoName,
|
|
59
56
|
path: join(repoName === "(root)" ? "" : repoName, path),
|
|
@@ -105,6 +102,17 @@ function auditFile(repoName: string, repoPath: string, path: string): DocsMetada
|
|
|
105
102
|
};
|
|
106
103
|
}
|
|
107
104
|
|
|
105
|
+
export async function auditDocsMetadataRepository(
|
|
106
|
+
repoName: string,
|
|
107
|
+
view: DocsRepositoryView,
|
|
108
|
+
): Promise<DocsMetadataAuditRow[]> {
|
|
109
|
+
const files = view.trackedPaths.filter((path) => path.endsWith(".md"));
|
|
110
|
+
const texts = await view.readTexts(files);
|
|
111
|
+
return files
|
|
112
|
+
.map((path) => auditFile(repoName, path, texts.get(path)))
|
|
113
|
+
.filter((row): row is DocsMetadataAuditRow => row !== null);
|
|
114
|
+
}
|
|
115
|
+
|
|
108
116
|
export async function runDocsMetadataAudit(
|
|
109
117
|
opts: DocsMetadataAuditOpts,
|
|
110
118
|
): Promise<DocsMetadataAuditRow[]> {
|
|
@@ -120,11 +128,8 @@ export async function runDocsMetadataAudit(
|
|
|
120
128
|
|
|
121
129
|
const rows: DocsMetadataAuditRow[] = [];
|
|
122
130
|
for (const target of selected) {
|
|
123
|
-
const
|
|
124
|
-
|
|
125
|
-
const row = auditFile(target.name, target.path, path);
|
|
126
|
-
if (row) rows.push(row);
|
|
127
|
-
}
|
|
131
|
+
const view = await createDocsRepositoryView(target.path, opts.source ?? "worktree");
|
|
132
|
+
rows.push(...(await auditDocsMetadataRepository(target.name, view)));
|
|
128
133
|
}
|
|
129
134
|
|
|
130
135
|
return rows.sort((a, b) => a.path.localeCompare(b.path));
|
|
@@ -4,6 +4,7 @@ import { dump as dumpYaml, JSON_SCHEMA } from "js-yaml";
|
|
|
4
4
|
import { parseFrontmatter } from "./docs-frontmatter.ts";
|
|
5
5
|
import { managedDocsMetadataType } from "./docs-metadata-managed.ts";
|
|
6
6
|
import { isDocsMetadataV2, validateDocsMetadataV2 } from "./docs-metadata-v2.ts";
|
|
7
|
+
import { createDocsRepositoryView } from "./docs-repository-view.ts";
|
|
7
8
|
import { sh } from "./exec.ts";
|
|
8
9
|
|
|
9
10
|
let REPO_ROOT = "";
|
|
@@ -21,6 +22,7 @@ export interface DocsMetadataSyncOpts {
|
|
|
21
22
|
repo?: string;
|
|
22
23
|
files?: string[];
|
|
23
24
|
check?: boolean;
|
|
25
|
+
cached?: boolean;
|
|
24
26
|
reviewed?: boolean;
|
|
25
27
|
now?: string;
|
|
26
28
|
}
|
|
@@ -49,15 +51,27 @@ function targets(repo?: string): Target[] {
|
|
|
49
51
|
return selected;
|
|
50
52
|
}
|
|
51
53
|
|
|
52
|
-
async function
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
cwd: target.path,
|
|
56
|
-
});
|
|
57
|
-
if (result.exitCode !== 0) throw new Error(result.stderr || "git diff failed");
|
|
54
|
+
async function gitMarkdownPaths(target: Target, command: string): Promise<string[]> {
|
|
55
|
+
const result = await sh(command, { cwd: target.path });
|
|
56
|
+
if (result.exitCode !== 0) throw new Error(result.stderr || `${command} failed`);
|
|
58
57
|
return result.stdout.split("\n").filter(Boolean);
|
|
59
58
|
}
|
|
60
59
|
|
|
60
|
+
async function changedFiles(target: Target, explicit: string[], check: boolean): Promise<string[]> {
|
|
61
|
+
if (explicit.length > 0) return explicit;
|
|
62
|
+
const staged = await gitMarkdownPaths(
|
|
63
|
+
target,
|
|
64
|
+
"git diff --cached --name-only --diff-filter=ACMR -- '*.md'",
|
|
65
|
+
);
|
|
66
|
+
if (check) return staged;
|
|
67
|
+
|
|
68
|
+
const [unstaged, untracked] = await Promise.all([
|
|
69
|
+
gitMarkdownPaths(target, "git diff --name-only --diff-filter=ACMR -- '*.md'"),
|
|
70
|
+
gitMarkdownPaths(target, "git ls-files --others --exclude-standard -- '*.md'"),
|
|
71
|
+
]);
|
|
72
|
+
return [...new Set([...staged, ...unstaged, ...untracked])];
|
|
73
|
+
}
|
|
74
|
+
|
|
61
75
|
async function headContent(target: Target, path: string): Promise<string | null> {
|
|
62
76
|
const result = await sh(`git show HEAD:${JSON.stringify(path)}`, { cwd: target.path });
|
|
63
77
|
return result.exitCode === 0 ? result.stdout : null;
|
|
@@ -107,13 +121,22 @@ function addDays(value: string, days: number): string {
|
|
|
107
121
|
export async function runDocsMetadataSync(
|
|
108
122
|
opts: DocsMetadataSyncOpts,
|
|
109
123
|
): Promise<DocsMetadataSyncRow[]> {
|
|
124
|
+
if (opts.cached && !opts.check) {
|
|
125
|
+
throw new Error("--cached requires --check because Git index validation is read-only");
|
|
126
|
+
}
|
|
110
127
|
const now = opts.now ?? new Date().toISOString().replace(/\.\d{3}Z$/, "Z");
|
|
111
128
|
const rows: DocsMetadataSyncRow[] = [];
|
|
112
129
|
for (const target of targets(opts.repo)) {
|
|
113
|
-
|
|
130
|
+
const paths = await changedFiles(target, opts.files ?? [], opts.check ?? false);
|
|
131
|
+
const cachedView = opts.cached ? await createDocsRepositoryView(target.path, "index") : null;
|
|
132
|
+
const cachedTexts = cachedView ? await cachedView.readTexts(paths) : null;
|
|
133
|
+
for (const path of paths) {
|
|
114
134
|
const full = join(target.path, path);
|
|
115
|
-
if (!existsSync(full)) continue;
|
|
116
|
-
const currentText = readFileSync(full, "utf8");
|
|
135
|
+
if (cachedView ? !cachedView.has(path) : !existsSync(full)) continue;
|
|
136
|
+
const currentText = cachedView ? cachedTexts?.get(path) : readFileSync(full, "utf8");
|
|
137
|
+
if (currentText === undefined) {
|
|
138
|
+
throw new Error(`Git index content could not be read for ${path}`);
|
|
139
|
+
}
|
|
117
140
|
const current = parseFrontmatter(currentText);
|
|
118
141
|
if (!managedDocsMetadataType(path, current.data, current.raw !== null)) continue;
|
|
119
142
|
if (!isDocsMetadataV2(current.data)) {
|
|
@@ -0,0 +1,220 @@
|
|
|
1
|
+
import { spawn } from "node:child_process";
|
|
2
|
+
import { existsSync, readdirSync, readFileSync, statSync } from "node:fs";
|
|
3
|
+
import { basename, dirname, join } from "node:path";
|
|
4
|
+
import { exec } from "./exec.ts";
|
|
5
|
+
|
|
6
|
+
export type DocsRepositorySource = "worktree" | "index";
|
|
7
|
+
|
|
8
|
+
interface IndexEntry {
|
|
9
|
+
oid: string;
|
|
10
|
+
stage: number;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* One coherent repository view for documentation commands.
|
|
15
|
+
*
|
|
16
|
+
* Worktree mode preserves the interactive commands' existing behavior. Index
|
|
17
|
+
* mode reads both path membership and file bytes through Git, so a pre-commit
|
|
18
|
+
* hook validates the exact index Git handed to it. During a path-scoped commit,
|
|
19
|
+
* Git exposes its temporary partial-commit index through GIT_INDEX_FILE; the
|
|
20
|
+
* view deliberately inherits that environment instead of rediscovering the
|
|
21
|
+
* shared working tree.
|
|
22
|
+
*/
|
|
23
|
+
export interface DocsRepositoryView {
|
|
24
|
+
readonly root: string;
|
|
25
|
+
readonly source: DocsRepositorySource;
|
|
26
|
+
readonly trackedPaths: readonly string[];
|
|
27
|
+
has(path: string): boolean;
|
|
28
|
+
directFileNames(directory: string): string[];
|
|
29
|
+
readTexts(paths: readonly string[]): Promise<Map<string, string>>;
|
|
30
|
+
byteLength(path: string): Promise<number | null>;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
function normalize(path: string): string {
|
|
34
|
+
return path.replaceAll("\\", "/").replace(/^\.\//, "");
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
function trackedPathList(stdout: string): string[] {
|
|
38
|
+
return stdout.split("\0").map(normalize).filter(Boolean);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
async function worktreePaths(root: string): Promise<string[]> {
|
|
42
|
+
const result = await exec(["git", "ls-files", "--cached", "-z"], { cwd: root, trim: false });
|
|
43
|
+
if (result.exitCode !== 0) {
|
|
44
|
+
// Worktree lint historically supports non-repository fixtures and simply
|
|
45
|
+
// has no tracked-file checks to run there. Index mode remains strict.
|
|
46
|
+
return [];
|
|
47
|
+
}
|
|
48
|
+
return trackedPathList(result.stdout);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
async function indexEntries(root: string): Promise<Map<string, IndexEntry>> {
|
|
52
|
+
const result = await exec(["git", "ls-files", "--cached", "--stage", "-z"], {
|
|
53
|
+
cwd: root,
|
|
54
|
+
trim: false,
|
|
55
|
+
});
|
|
56
|
+
if (result.exitCode !== 0) {
|
|
57
|
+
throw new Error(result.stderr || "git ls-files --stage failed");
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
const entries = new Map<string, IndexEntry>();
|
|
61
|
+
for (const record of result.stdout.split("\0").filter(Boolean)) {
|
|
62
|
+
const tab = record.indexOf("\t");
|
|
63
|
+
if (tab === -1) throw new Error(`invalid git ls-files --stage record: ${record}`);
|
|
64
|
+
const [mode, oid, stageText] = record.slice(0, tab).split(" ");
|
|
65
|
+
const path = normalize(record.slice(tab + 1));
|
|
66
|
+
const stage = Number.parseInt(stageText ?? "", 10);
|
|
67
|
+
if (!mode || !oid || !Number.isInteger(stage)) {
|
|
68
|
+
throw new Error(`invalid git ls-files --stage record for ${path}`);
|
|
69
|
+
}
|
|
70
|
+
if (stage !== 0) {
|
|
71
|
+
throw new Error(`cannot validate an index with unmerged entry: ${path}`);
|
|
72
|
+
}
|
|
73
|
+
entries.set(path, { oid, stage });
|
|
74
|
+
}
|
|
75
|
+
return entries;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
function parseBatch(stdout: Buffer, requested: readonly string[]): Map<string, Buffer> {
|
|
79
|
+
const blobs = new Map<string, Buffer>();
|
|
80
|
+
let offset = 0;
|
|
81
|
+
for (const oid of requested) {
|
|
82
|
+
const newline = stdout.indexOf(0x0a, offset);
|
|
83
|
+
if (newline === -1) throw new Error(`git cat-file omitted the header for ${oid}`);
|
|
84
|
+
const header = stdout.subarray(offset, newline).toString("utf8");
|
|
85
|
+
offset = newline + 1;
|
|
86
|
+
const [reportedOid, type, sizeText] = header.split(" ");
|
|
87
|
+
const size = Number.parseInt(sizeText ?? "", 10);
|
|
88
|
+
if (reportedOid !== oid || type !== "blob" || !Number.isInteger(size) || size < 0) {
|
|
89
|
+
throw new Error(`git cat-file returned an invalid blob header for ${oid}: ${header}`);
|
|
90
|
+
}
|
|
91
|
+
const end = offset + size;
|
|
92
|
+
if (end > stdout.length) throw new Error(`git cat-file truncated blob ${oid}`);
|
|
93
|
+
blobs.set(oid, stdout.subarray(offset, end));
|
|
94
|
+
offset = end;
|
|
95
|
+
if (stdout[offset] !== 0x0a) throw new Error(`git cat-file omitted the separator for ${oid}`);
|
|
96
|
+
offset += 1;
|
|
97
|
+
}
|
|
98
|
+
return blobs;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
function readIndexBlobs(root: string, oids: readonly string[]): Promise<Map<string, Buffer>> {
|
|
102
|
+
const unique = [...new Set(oids)];
|
|
103
|
+
if (unique.length === 0) return Promise.resolve(new Map());
|
|
104
|
+
|
|
105
|
+
return new Promise((resolveResult, rejectResult) => {
|
|
106
|
+
const process = spawn("git", ["cat-file", "--batch"], {
|
|
107
|
+
cwd: root,
|
|
108
|
+
env: { ...globalThis.process.env },
|
|
109
|
+
stdio: ["pipe", "pipe", "pipe"],
|
|
110
|
+
});
|
|
111
|
+
const stdout: Buffer[] = [];
|
|
112
|
+
const stderr: Buffer[] = [];
|
|
113
|
+
const timer = setTimeout(() => process.kill(), 30_000);
|
|
114
|
+
process.stdout.on("data", (chunk: Buffer) => stdout.push(chunk));
|
|
115
|
+
process.stderr.on("data", (chunk: Buffer) => stderr.push(chunk));
|
|
116
|
+
process.on("error", (error) => {
|
|
117
|
+
clearTimeout(timer);
|
|
118
|
+
rejectResult(error);
|
|
119
|
+
});
|
|
120
|
+
process.on("close", (code) => {
|
|
121
|
+
clearTimeout(timer);
|
|
122
|
+
if (code !== 0) {
|
|
123
|
+
rejectResult(
|
|
124
|
+
new Error(Buffer.concat(stderr).toString("utf8").trim() || "git cat-file failed"),
|
|
125
|
+
);
|
|
126
|
+
return;
|
|
127
|
+
}
|
|
128
|
+
try {
|
|
129
|
+
resolveResult(parseBatch(Buffer.concat(stdout), unique));
|
|
130
|
+
} catch (error) {
|
|
131
|
+
rejectResult(error);
|
|
132
|
+
}
|
|
133
|
+
});
|
|
134
|
+
process.stdin.end(`${unique.join("\n")}\n`);
|
|
135
|
+
});
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
function directIndexFiles(paths: readonly string[], directory: string): string[] {
|
|
139
|
+
const normalizedDirectory = normalize(directory).replace(/\/$/, "");
|
|
140
|
+
return paths
|
|
141
|
+
.filter((path) => normalize(dirname(path)) === normalizedDirectory)
|
|
142
|
+
.map((path) => basename(path));
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
export async function createDocsRepositoryView(
|
|
146
|
+
root: string,
|
|
147
|
+
source: DocsRepositorySource = "worktree",
|
|
148
|
+
): Promise<DocsRepositoryView> {
|
|
149
|
+
if (source === "worktree") {
|
|
150
|
+
const trackedPaths = await worktreePaths(root);
|
|
151
|
+
return {
|
|
152
|
+
root,
|
|
153
|
+
source,
|
|
154
|
+
trackedPaths,
|
|
155
|
+
has: (path) => existsSync(join(root, path)),
|
|
156
|
+
directFileNames: (directory) => {
|
|
157
|
+
try {
|
|
158
|
+
return readdirSync(join(root, directory)).filter((entry) => {
|
|
159
|
+
try {
|
|
160
|
+
return statSync(join(root, directory, entry)).isFile();
|
|
161
|
+
} catch {
|
|
162
|
+
return false;
|
|
163
|
+
}
|
|
164
|
+
});
|
|
165
|
+
} catch {
|
|
166
|
+
return [];
|
|
167
|
+
}
|
|
168
|
+
},
|
|
169
|
+
readTexts: async (paths) => {
|
|
170
|
+
const texts = new Map<string, string>();
|
|
171
|
+
for (const path of paths) {
|
|
172
|
+
try {
|
|
173
|
+
texts.set(path, readFileSync(join(root, path), "utf8"));
|
|
174
|
+
} catch {
|
|
175
|
+
// The caller decides whether a missing tracked path is a finding.
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
return texts;
|
|
179
|
+
},
|
|
180
|
+
byteLength: async (path) => {
|
|
181
|
+
try {
|
|
182
|
+
return statSync(join(root, path)).size;
|
|
183
|
+
} catch {
|
|
184
|
+
return null;
|
|
185
|
+
}
|
|
186
|
+
},
|
|
187
|
+
};
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
const entries = await indexEntries(root);
|
|
191
|
+
const trackedPaths = [...entries.keys()];
|
|
192
|
+
const textCache = new Map<string, string>();
|
|
193
|
+
const loadTexts = async (paths: readonly string[]): Promise<Map<string, string>> => {
|
|
194
|
+
const wanted = [...new Set(paths.map(normalize))].filter((path) => entries.has(path));
|
|
195
|
+
const missing = wanted.filter((path) => !textCache.has(path));
|
|
196
|
+
const oids = missing.map((path) => entries.get(path)!.oid);
|
|
197
|
+
const blobs = await readIndexBlobs(root, oids);
|
|
198
|
+
for (const path of missing) {
|
|
199
|
+
const blob = blobs.get(entries.get(path)!.oid);
|
|
200
|
+
if (blob) textCache.set(path, blob.toString("utf8"));
|
|
201
|
+
}
|
|
202
|
+
return new Map(
|
|
203
|
+
wanted.flatMap((path) => (textCache.has(path) ? [[path, textCache.get(path)!]] : [])),
|
|
204
|
+
);
|
|
205
|
+
};
|
|
206
|
+
|
|
207
|
+
return {
|
|
208
|
+
root,
|
|
209
|
+
source,
|
|
210
|
+
trackedPaths,
|
|
211
|
+
has: (path) => entries.has(normalize(path)),
|
|
212
|
+
directFileNames: (directory) => directIndexFiles(trackedPaths, directory),
|
|
213
|
+
readTexts: loadTexts,
|
|
214
|
+
byteLength: async (path) => {
|
|
215
|
+
const normalized = normalize(path);
|
|
216
|
+
const text = (await loadTexts([normalized])).get(normalized);
|
|
217
|
+
return text === undefined ? null : Buffer.byteLength(text, "utf8");
|
|
218
|
+
},
|
|
219
|
+
};
|
|
220
|
+
}
|