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,141 @@
|
|
|
1
|
+
import { mkdirSync, renameSync, writeFileSync } from "node:fs";
|
|
2
|
+
import { dirname, join } from "node:path";
|
|
3
|
+
import type { Adapter } from "../../adapter.ts";
|
|
4
|
+
import {
|
|
5
|
+
readCoordinationViewV3,
|
|
6
|
+
requireAuthoritySafeCoordinationViewV3,
|
|
7
|
+
} from "../../events/v3/coordination-view.ts";
|
|
8
|
+
import { liveInstanceIdV3, resolveLiveEventLedgerRouteV3 } from "../../events/v3/live-routing.ts";
|
|
9
|
+
import { type Heartbeat, readHeartbeat } from "./heartbeat-reader.ts";
|
|
10
|
+
import {
|
|
11
|
+
isAdapterV3,
|
|
12
|
+
isCurrentV3HeartbeatCache,
|
|
13
|
+
observedAdapterV3,
|
|
14
|
+
projectHeartbeatV3,
|
|
15
|
+
type V3HeartbeatMaterialization,
|
|
16
|
+
} from "./live-coordination-view.ts";
|
|
17
|
+
import { resolveName } from "./names.ts";
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Ensure the current V3 generation has a mutation target. The resulting file
|
|
21
|
+
* is explicitly generation-bound and disposable: V3 remains the source of
|
|
22
|
+
* truth, while the cache gives the crash-safe authority outbox an atomic local
|
|
23
|
+
* state to reconcile.
|
|
24
|
+
*/
|
|
25
|
+
export function ensureLiveCoordinationHeartbeat(
|
|
26
|
+
coordRoot: string,
|
|
27
|
+
nativeInstanceId: string,
|
|
28
|
+
nativeSessionId: string,
|
|
29
|
+
_adapter: Adapter,
|
|
30
|
+
model?: string,
|
|
31
|
+
): Heartbeat | null {
|
|
32
|
+
return materializeLiveCoordinationHeartbeat(
|
|
33
|
+
coordRoot,
|
|
34
|
+
nativeInstanceId,
|
|
35
|
+
nativeSessionId,
|
|
36
|
+
_adapter,
|
|
37
|
+
model,
|
|
38
|
+
false,
|
|
39
|
+
);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/** Rebuild a disposable cache from V3 even when its generation markers look current. */
|
|
43
|
+
export function repairLiveCoordinationHeartbeat(
|
|
44
|
+
coordRoot: string,
|
|
45
|
+
nativeInstanceId: string,
|
|
46
|
+
nativeSessionId: string,
|
|
47
|
+
adapter: Adapter,
|
|
48
|
+
model?: string,
|
|
49
|
+
): Heartbeat | null {
|
|
50
|
+
return materializeLiveCoordinationHeartbeat(
|
|
51
|
+
coordRoot,
|
|
52
|
+
nativeInstanceId,
|
|
53
|
+
nativeSessionId,
|
|
54
|
+
adapter,
|
|
55
|
+
model,
|
|
56
|
+
true,
|
|
57
|
+
);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
function materializeLiveCoordinationHeartbeat(
|
|
61
|
+
coordRoot: string,
|
|
62
|
+
nativeInstanceId: string,
|
|
63
|
+
nativeSessionId: string,
|
|
64
|
+
_adapter: Adapter,
|
|
65
|
+
model: string | undefined,
|
|
66
|
+
force: boolean,
|
|
67
|
+
): Heartbeat | null {
|
|
68
|
+
const route = resolveLiveEventLedgerRouteV3(coordRoot);
|
|
69
|
+
if (route.state === "blocked") throw new Error(`event_v3_coordination_view:${route.reason}`);
|
|
70
|
+
const view = requireAuthoritySafeCoordinationViewV3(readCoordinationViewV3(coordRoot));
|
|
71
|
+
const generation = view.instances[liveInstanceIdV3(nativeInstanceId)];
|
|
72
|
+
if (!generation?.authority_eligible) return null;
|
|
73
|
+
const generationAdapter = observedAdapterV3(generation);
|
|
74
|
+
if (!isAdapterV3(generationAdapter)) {
|
|
75
|
+
throw new Error("event_v3_coordination_view:adapter_not_observed");
|
|
76
|
+
}
|
|
77
|
+
const current = readHeartbeat(coordRoot, nativeInstanceId);
|
|
78
|
+
if (
|
|
79
|
+
!force &&
|
|
80
|
+
isCurrentV3HeartbeatCache(current, generation) &&
|
|
81
|
+
current.platform === generationAdapter
|
|
82
|
+
) {
|
|
83
|
+
return current;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
const resolved = resolveName(coordRoot, nativeInstanceId, nativeSessionId);
|
|
87
|
+
const projected = projectHeartbeatV3(coordRoot, generation, undefined, nativeInstanceId);
|
|
88
|
+
// A generation reopen (resume, mid-flight onboarding) discards the stale
|
|
89
|
+
// cache, but the adapter tab it names is unchanged: same native session,
|
|
90
|
+
// same agent identity. Rebuilding without the naming evidence re-mints a
|
|
91
|
+
// fresh suggested name on the next set-task, so a multi-day session
|
|
92
|
+
// accumulates titles it is asked to display over and over. Carry the
|
|
93
|
+
// naming evidence across generations; everything else re-projects from V3.
|
|
94
|
+
// Same native session id means the same adapter tab; drop the carry only
|
|
95
|
+
// when the durable identity observably changed (a reassumed name would make
|
|
96
|
+
// the old "Agent <name> - …" block wrong for the new owner).
|
|
97
|
+
const identityUnchanged = !resolved?.name || !current?.name || resolved.name === current.name;
|
|
98
|
+
const carriedNaming =
|
|
99
|
+
current && current.session_id === nativeSessionId && identityUnchanged
|
|
100
|
+
? {
|
|
101
|
+
...(current.suggested_session_name
|
|
102
|
+
? { suggested_session_name: current.suggested_session_name }
|
|
103
|
+
: {}),
|
|
104
|
+
...(current.session_name_seen_for
|
|
105
|
+
? { session_name_seen_for: current.session_name_seen_for }
|
|
106
|
+
: {}),
|
|
107
|
+
...(current.session_name_seen_at
|
|
108
|
+
? { session_name_seen_at: current.session_name_seen_at }
|
|
109
|
+
: {}),
|
|
110
|
+
}
|
|
111
|
+
: {};
|
|
112
|
+
const materialized: V3HeartbeatMaterialization = {
|
|
113
|
+
...projected,
|
|
114
|
+
...carriedNaming,
|
|
115
|
+
schema_version: 2,
|
|
116
|
+
instance_id: nativeInstanceId,
|
|
117
|
+
session_id: nativeSessionId,
|
|
118
|
+
name: resolved?.name ?? "",
|
|
119
|
+
kind: resolved?.kind ?? projected.kind,
|
|
120
|
+
agent_id: resolved?.agent_id ?? (resolved?.kind === "subagent" ? nativeInstanceId : ""),
|
|
121
|
+
model: projected.model ?? model ?? "",
|
|
122
|
+
platform: generationAdapter,
|
|
123
|
+
v3_instance_id: generation.instance_id as `inst_${string}`,
|
|
124
|
+
v3_generation_id: generation.generation_id as `gen_${string}`,
|
|
125
|
+
v3_projection_event_id: generation.last_event_id,
|
|
126
|
+
v3_task_state: generation.task_state === "set" ? "set" : "cleared",
|
|
127
|
+
};
|
|
128
|
+
writeHeartbeatCache(coordRoot, nativeInstanceId, materialized);
|
|
129
|
+
return materialized;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
function writeHeartbeatCache(coordRoot: string, instanceId: string, heartbeat: Heartbeat): void {
|
|
133
|
+
if (!/^[a-zA-Z0-9._-]{1,128}$/.test(instanceId)) {
|
|
134
|
+
throw new Error("instance_id is unsafe for heartbeat materialization");
|
|
135
|
+
}
|
|
136
|
+
const path = join(coordRoot, ".harnery", "active", `${instanceId}.json`);
|
|
137
|
+
mkdirSync(dirname(path), { recursive: true });
|
|
138
|
+
const temporary = `${path}.tmp.${process.pid}`;
|
|
139
|
+
writeFileSync(temporary, JSON.stringify(heartbeat, null, 2), "utf8");
|
|
140
|
+
renameSync(temporary, path);
|
|
141
|
+
}
|
|
@@ -23,7 +23,13 @@ import {
|
|
|
23
23
|
} from "node:fs";
|
|
24
24
|
import { basename, dirname, isAbsolute, join, relative, resolve, sep } from "node:path";
|
|
25
25
|
import { readLiveCoordinationRow } from "../agents/state/live-coordination-view.ts";
|
|
26
|
-
import {
|
|
26
|
+
import {
|
|
27
|
+
artifactAutoCleanEnabled,
|
|
28
|
+
artifactAutoCleanIntervalHours,
|
|
29
|
+
artifactDefaultRetentionDays,
|
|
30
|
+
artifactMaxBytes,
|
|
31
|
+
artifactMaxUnitBytes,
|
|
32
|
+
} from "../config.ts";
|
|
27
33
|
import { ARTIFACT_MANIFEST, ARTIFACT_SCHEMA_VERSION, ARTIFACTS_DIR } from "./constants.ts";
|
|
28
34
|
|
|
29
35
|
export { ARTIFACT_MANIFEST, ARTIFACT_SCHEMA_VERSION, ARTIFACTS_DIR } from "./constants.ts";
|
|
@@ -48,12 +54,15 @@ export interface ArtifactManifestV1 {
|
|
|
48
54
|
};
|
|
49
55
|
released_at?: string;
|
|
50
56
|
released_by?: ArtifactActor;
|
|
57
|
+
oversize_acknowledged?: boolean;
|
|
51
58
|
}
|
|
52
59
|
|
|
53
60
|
export type ArtifactClassification =
|
|
54
61
|
| "managed-active"
|
|
55
62
|
| "managed-current"
|
|
56
63
|
| "managed-expired"
|
|
64
|
+
| "managed-oversize"
|
|
65
|
+
| "managed-over-budget"
|
|
57
66
|
| "managed-tracked"
|
|
58
67
|
| "invalid-manifest"
|
|
59
68
|
| "unmanaged"
|
|
@@ -74,6 +83,7 @@ export interface ArtifactInventoryEntry {
|
|
|
74
83
|
last_modified_at: string | null;
|
|
75
84
|
expires_at: string | null;
|
|
76
85
|
owner_instance_id: string | null;
|
|
86
|
+
oversize_acknowledged: boolean;
|
|
77
87
|
}
|
|
78
88
|
|
|
79
89
|
export interface ArtifactCreateInput {
|
|
@@ -83,6 +93,7 @@ export interface ArtifactCreateInput {
|
|
|
83
93
|
actor?: ArtifactActor;
|
|
84
94
|
now?: Date;
|
|
85
95
|
id?: string;
|
|
96
|
+
big?: boolean;
|
|
86
97
|
}
|
|
87
98
|
|
|
88
99
|
export interface ArtifactMutationInput {
|
|
@@ -90,6 +101,15 @@ export interface ArtifactMutationInput {
|
|
|
90
101
|
now?: Date;
|
|
91
102
|
}
|
|
92
103
|
|
|
104
|
+
export interface ArtifactAdoptionResult {
|
|
105
|
+
candidates: Array<{ path: string; name: string; bytes: number; kind: "file" | "directory" }>;
|
|
106
|
+
candidate_bytes: number;
|
|
107
|
+
requires_big: boolean;
|
|
108
|
+
adopted_artifact_id: string | null;
|
|
109
|
+
adopted_path: string | null;
|
|
110
|
+
adopted_directories: number;
|
|
111
|
+
}
|
|
112
|
+
|
|
93
113
|
interface ParsedManifest {
|
|
94
114
|
ok: true;
|
|
95
115
|
manifest: ArtifactManifestV1;
|
|
@@ -141,6 +161,7 @@ export function createArtifact(
|
|
|
141
161
|
retention: {
|
|
142
162
|
expires_at: addDays(now, retentionDays).toISOString(),
|
|
143
163
|
},
|
|
164
|
+
...(input.big ? { oversize_acknowledged: true } : {}),
|
|
144
165
|
};
|
|
145
166
|
atomicWriteManifest(path, manifest);
|
|
146
167
|
return { path, manifest };
|
|
@@ -173,7 +194,7 @@ export function inventoryArtifacts(
|
|
|
173
194
|
for (const name of names) {
|
|
174
195
|
rows.push(classifyArtifactPath(repoRoot, join(root, name), now, freshnessSeconds));
|
|
175
196
|
}
|
|
176
|
-
return rows;
|
|
197
|
+
return applyArtifactBudgets(repoRoot, rows);
|
|
177
198
|
}
|
|
178
199
|
|
|
179
200
|
export function showArtifact(
|
|
@@ -182,12 +203,8 @@ export function showArtifact(
|
|
|
182
203
|
opts: { now?: Date; freshnessSeconds?: number } = {},
|
|
183
204
|
): { entry: ArtifactInventoryEntry; manifest: ArtifactManifestV1 } {
|
|
184
205
|
const path = resolveArtifactRef(repoRoot, ref);
|
|
185
|
-
const entry =
|
|
186
|
-
|
|
187
|
-
path,
|
|
188
|
-
opts.now ?? new Date(),
|
|
189
|
-
opts.freshnessSeconds ?? 600,
|
|
190
|
-
);
|
|
206
|
+
const entry = inventoryArtifacts(repoRoot, opts).find((row) => row.path === path);
|
|
207
|
+
if (!entry) throw new Error(`artifact "${ref}" was not found`);
|
|
191
208
|
const parsed = readManifest(path);
|
|
192
209
|
if (!parsed.ok) throw new Error(parsed.reason);
|
|
193
210
|
return { entry, manifest: parsed.manifest };
|
|
@@ -239,6 +256,108 @@ export function releaseArtifact(
|
|
|
239
256
|
return manifest;
|
|
240
257
|
}
|
|
241
258
|
|
|
259
|
+
/** Adopt untracked loose files and legacy directories without changing directory paths. */
|
|
260
|
+
export function adoptUnmanagedArtifactFiles(
|
|
261
|
+
repoRoot: string,
|
|
262
|
+
input: {
|
|
263
|
+
yes?: boolean;
|
|
264
|
+
big?: boolean;
|
|
265
|
+
purpose: string;
|
|
266
|
+
retentionDays: number;
|
|
267
|
+
actor?: ArtifactActor;
|
|
268
|
+
now?: Date;
|
|
269
|
+
},
|
|
270
|
+
): ArtifactAdoptionResult {
|
|
271
|
+
const now = input.now ?? new Date();
|
|
272
|
+
const candidates: ArtifactAdoptionResult["candidates"] = [];
|
|
273
|
+
for (const row of inventoryArtifacts(repoRoot, { now })) {
|
|
274
|
+
if (row.classification !== "unmanaged") continue;
|
|
275
|
+
try {
|
|
276
|
+
const stat = lstatSync(row.path);
|
|
277
|
+
if (stat.isSymbolicLink() || containsTrackedPath(repoRoot, row.path)) continue;
|
|
278
|
+
if (stat.isFile()) {
|
|
279
|
+
candidates.push({ path: row.path, name: row.name, bytes: stat.size, kind: "file" });
|
|
280
|
+
continue;
|
|
281
|
+
}
|
|
282
|
+
if (stat.isDirectory() && !existsSync(join(row.path, ARTIFACT_MANIFEST))) {
|
|
283
|
+
const bytes = safeTreeSize(row.path);
|
|
284
|
+
if (bytes !== null && normalizeSlug(row.name)) {
|
|
285
|
+
candidates.push({ path: row.path, name: row.name, bytes, kind: "directory" });
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
} catch {
|
|
289
|
+
// A racing or unreadable entry stays unmanaged.
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
const candidateBytes = candidates.reduce((sum, row) => sum + row.bytes, 0);
|
|
293
|
+
const fileBytes = candidates.reduce((sum, row) => sum + (row.kind === "file" ? row.bytes : 0), 0);
|
|
294
|
+
const maxUnitBytes = artifactMaxUnitBytes(repoRoot);
|
|
295
|
+
const requiresBig =
|
|
296
|
+
fileBytes > maxUnitBytes ||
|
|
297
|
+
candidates.some((row) => row.kind === "directory" && row.bytes > maxUnitBytes);
|
|
298
|
+
const preview: ArtifactAdoptionResult = {
|
|
299
|
+
candidates,
|
|
300
|
+
candidate_bytes: candidateBytes,
|
|
301
|
+
requires_big: requiresBig,
|
|
302
|
+
adopted_artifact_id: null,
|
|
303
|
+
adopted_path: null,
|
|
304
|
+
adopted_directories: 0,
|
|
305
|
+
};
|
|
306
|
+
if (!input.yes || candidates.length === 0) return preview;
|
|
307
|
+
if (requiresBig && !input.big) {
|
|
308
|
+
throw new Error("unmanaged adoption exceeds the per-bundle ceiling; repeat with --big");
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
// Revalidate every exact source before creating a destination. A changed,
|
|
312
|
+
// tracked, linked, or non-regular entry aborts the whole adoption.
|
|
313
|
+
for (const candidate of candidates) {
|
|
314
|
+
const stat = lstatSync(candidate.path);
|
|
315
|
+
const bytes = stat.isDirectory() ? safeTreeSize(candidate.path) : stat.size;
|
|
316
|
+
if (
|
|
317
|
+
stat.isSymbolicLink() ||
|
|
318
|
+
bytes !== candidate.bytes ||
|
|
319
|
+
containsTrackedPath(repoRoot, candidate.path)
|
|
320
|
+
) {
|
|
321
|
+
throw new Error(`unmanaged entry changed before adoption: ${candidate.name}`);
|
|
322
|
+
}
|
|
323
|
+
if (candidate.kind === "file" ? !stat.isFile() : !stat.isDirectory()) {
|
|
324
|
+
throw new Error(`unmanaged entry changed before adoption: ${candidate.name}`);
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
const files = candidates.filter((candidate) => candidate.kind === "file");
|
|
328
|
+
const created = files.length
|
|
329
|
+
? createArtifact(repoRoot, {
|
|
330
|
+
slug: "adopted-unmanaged",
|
|
331
|
+
purpose: input.purpose,
|
|
332
|
+
retentionDays: input.retentionDays,
|
|
333
|
+
actor: input.actor,
|
|
334
|
+
now,
|
|
335
|
+
big: input.big,
|
|
336
|
+
})
|
|
337
|
+
: null;
|
|
338
|
+
for (const candidate of files) renameSync(candidate.path, join(created!.path, candidate.name));
|
|
339
|
+
const retentionDays = positiveDays(input.retentionDays);
|
|
340
|
+
const directories = candidates.filter((candidate) => candidate.kind === "directory");
|
|
341
|
+
for (const candidate of directories) {
|
|
342
|
+
atomicWriteManifest(candidate.path, {
|
|
343
|
+
schema_version: ARTIFACT_SCHEMA_VERSION,
|
|
344
|
+
artifact_id: randomUUID(),
|
|
345
|
+
slug: normalizeSlug(candidate.name),
|
|
346
|
+
purpose: `${input.purpose}: ${candidate.name}`,
|
|
347
|
+
created_at: now.toISOString(),
|
|
348
|
+
created_by: input.actor,
|
|
349
|
+
retention: { expires_at: addDays(now, retentionDays).toISOString() },
|
|
350
|
+
...(input.big ? { oversize_acknowledged: true } : {}),
|
|
351
|
+
});
|
|
352
|
+
}
|
|
353
|
+
return {
|
|
354
|
+
...preview,
|
|
355
|
+
adopted_artifact_id: created?.manifest.artifact_id ?? null,
|
|
356
|
+
adopted_path: created?.path ?? null,
|
|
357
|
+
adopted_directories: directories.length,
|
|
358
|
+
};
|
|
359
|
+
}
|
|
360
|
+
|
|
242
361
|
export function cleanArtifacts(
|
|
243
362
|
repoRoot: string,
|
|
244
363
|
opts: { yes?: boolean; now?: Date; freshnessSeconds?: number } = {},
|
|
@@ -249,11 +368,24 @@ export function cleanArtifacts(
|
|
|
249
368
|
if (!opts.yes) return rows;
|
|
250
369
|
|
|
251
370
|
return rows.map((entry) => {
|
|
252
|
-
if (entry.
|
|
371
|
+
if (entry.action !== "would-delete") return entry;
|
|
253
372
|
// Reclassify immediately before removal. A renewal, release-state change,
|
|
254
373
|
// heartbeat, symlink swap, or tracked file added since inventory must win.
|
|
255
|
-
const current =
|
|
256
|
-
|
|
374
|
+
const current = inventoryArtifacts(repoRoot, { now, freshnessSeconds }).find(
|
|
375
|
+
(row) => row.path === entry.path,
|
|
376
|
+
);
|
|
377
|
+
if (!current) {
|
|
378
|
+
return { ...entry, classification: "unknown", reason: "entry disappeared", action: "keep" };
|
|
379
|
+
}
|
|
380
|
+
if (
|
|
381
|
+
current.action !== "would-delete" ||
|
|
382
|
+
current.artifact_id !== entry.artifact_id ||
|
|
383
|
+
current.bytes !== entry.bytes ||
|
|
384
|
+
current.last_modified_at !== entry.last_modified_at ||
|
|
385
|
+
current.expires_at !== entry.expires_at
|
|
386
|
+
) {
|
|
387
|
+
return current;
|
|
388
|
+
}
|
|
257
389
|
try {
|
|
258
390
|
const top = lstatSync(current.path);
|
|
259
391
|
if (!top.isDirectory() || top.isSymbolicLink()) {
|
|
@@ -277,6 +409,65 @@ export function cleanArtifacts(
|
|
|
277
409
|
});
|
|
278
410
|
}
|
|
279
411
|
|
|
412
|
+
/** Sibling of the artifacts root so the stamp never appears in the inventory scan. */
|
|
413
|
+
const AUTO_CLEAN_STAMP = ".harnery/artifacts-auto-clean.json";
|
|
414
|
+
|
|
415
|
+
export interface ArtifactAutoCleanResult {
|
|
416
|
+
ran: boolean;
|
|
417
|
+
reason: "swept" | "disabled" | "fresh" | "no-root";
|
|
418
|
+
deleted: number;
|
|
419
|
+
bytes: number;
|
|
420
|
+
}
|
|
421
|
+
|
|
422
|
+
/**
|
|
423
|
+
* Throttled expired-artifact sweep, fired as a SessionStart effect.
|
|
424
|
+
*
|
|
425
|
+
* Retention was previously enforced only when someone remembered to run
|
|
426
|
+
* `artifacts clean --yes`, so expired workspaces accumulated indefinitely on
|
|
427
|
+
* busy hosts. This runs the exact same guarded deletion (only
|
|
428
|
+
* `managed-expired` entries, each re-classified immediately before removal;
|
|
429
|
+
* unmanaged and legacy directories are never touched) at most once per
|
|
430
|
+
* interval (default 24h), claim-first via a stamp file so concurrent session
|
|
431
|
+
* starts do not double-sweep. Disable with `artifacts.auto_clean: false` or
|
|
432
|
+
* `HARNERY_ARTIFACT_AUTO_CLEAN=0`.
|
|
433
|
+
*/
|
|
434
|
+
export function autoCleanArtifacts(
|
|
435
|
+
repoRoot: string,
|
|
436
|
+
opts: { now?: Date } = {},
|
|
437
|
+
): ArtifactAutoCleanResult {
|
|
438
|
+
const now = opts.now ?? new Date();
|
|
439
|
+
assertValidDate(now, "now");
|
|
440
|
+
if (!existsSync(artifactsRoot(repoRoot))) {
|
|
441
|
+
return { ran: false, reason: "no-root", deleted: 0, bytes: 0 };
|
|
442
|
+
}
|
|
443
|
+
if (!artifactAutoCleanEnabled(repoRoot)) {
|
|
444
|
+
return { ran: false, reason: "disabled", deleted: 0, bytes: 0 };
|
|
445
|
+
}
|
|
446
|
+
const stampPath = join(resolve(repoRoot), AUTO_CLEAN_STAMP);
|
|
447
|
+
const intervalMs = artifactAutoCleanIntervalHours() * 60 * 60 * 1000;
|
|
448
|
+
try {
|
|
449
|
+
const stamp = JSON.parse(readFileSync(stampPath, "utf8")) as { last_run_at?: string };
|
|
450
|
+
const last = Date.parse(stamp.last_run_at ?? "");
|
|
451
|
+
if (Number.isFinite(last) && now.getTime() - last < intervalMs) {
|
|
452
|
+
return { ran: false, reason: "fresh", deleted: 0, bytes: 0 };
|
|
453
|
+
}
|
|
454
|
+
} catch {
|
|
455
|
+
// Missing or unreadable stamp: sweep now and write a fresh one.
|
|
456
|
+
}
|
|
457
|
+
// Claim first: a crash mid-sweep costs one skipped interval, while claiming
|
|
458
|
+
// after would let two concurrent session starts both walk the store.
|
|
459
|
+
writeFileSync(stampPath, `${JSON.stringify({ last_run_at: now.toISOString() }, null, 2)}\n`);
|
|
460
|
+
const rows = cleanArtifacts(repoRoot, { yes: true, now });
|
|
461
|
+
const deletedRows = rows.filter((row) => row.action === "deleted");
|
|
462
|
+
const deleted = deletedRows.length;
|
|
463
|
+
const bytes = deletedRows.reduce((sum, row) => sum + (row.bytes ?? 0), 0);
|
|
464
|
+
writeFileSync(
|
|
465
|
+
stampPath,
|
|
466
|
+
`${JSON.stringify({ last_run_at: now.toISOString(), deleted, bytes }, null, 2)}\n`,
|
|
467
|
+
);
|
|
468
|
+
return { ran: true, reason: "swept", deleted, bytes };
|
|
469
|
+
}
|
|
470
|
+
|
|
280
471
|
export function resolveArtifactRef(repoRoot: string, ref: string): string {
|
|
281
472
|
const root = artifactsRoot(repoRoot);
|
|
282
473
|
const candidate = isAbsolute(ref) ? resolve(ref) : resolve(root, ref);
|
|
@@ -341,6 +532,7 @@ function classifyArtifactPath(
|
|
|
341
532
|
last_modified_at: new Date(effectiveLastModifiedMs).toISOString(),
|
|
342
533
|
expires_at: effectiveExpiresAt,
|
|
343
534
|
owner_instance_id: manifest.created_by?.instance_id ?? null,
|
|
535
|
+
oversize_acknowledged: manifest.oversize_acknowledged === true,
|
|
344
536
|
});
|
|
345
537
|
|
|
346
538
|
if (base.bytes === null || lastModifiedMs === null) {
|
|
@@ -387,6 +579,59 @@ function classifyArtifactPath(
|
|
|
387
579
|
};
|
|
388
580
|
}
|
|
389
581
|
|
|
582
|
+
function applyArtifactBudgets(
|
|
583
|
+
repoRoot: string,
|
|
584
|
+
inputRows: ArtifactInventoryEntry[],
|
|
585
|
+
): ArtifactInventoryEntry[] {
|
|
586
|
+
const maxUnitBytes = artifactMaxUnitBytes(repoRoot);
|
|
587
|
+
const maxBytes = artifactMaxBytes(repoRoot);
|
|
588
|
+
const rows = inputRows.map((row) => ({ ...row }));
|
|
589
|
+
|
|
590
|
+
for (const row of rows) {
|
|
591
|
+
if (
|
|
592
|
+
row.classification === "managed-current" &&
|
|
593
|
+
row.bytes !== null &&
|
|
594
|
+
row.bytes > maxUnitBytes &&
|
|
595
|
+
!row.oversize_acknowledged
|
|
596
|
+
) {
|
|
597
|
+
row.classification = "managed-oversize";
|
|
598
|
+
row.reason = `bundle uses ${row.bytes} bytes, above the ${maxUnitBytes}-byte ceiling without --big`;
|
|
599
|
+
row.action = "would-delete";
|
|
600
|
+
}
|
|
601
|
+
}
|
|
602
|
+
|
|
603
|
+
const managedBytes = rows.reduce(
|
|
604
|
+
(sum, row) => sum + (row.artifact_id && row.bytes !== null ? row.bytes : 0),
|
|
605
|
+
0,
|
|
606
|
+
);
|
|
607
|
+
let retainedBytes =
|
|
608
|
+
managedBytes -
|
|
609
|
+
rows.reduce(
|
|
610
|
+
(sum, row) => sum + (row.action === "would-delete" && row.bytes !== null ? row.bytes : 0),
|
|
611
|
+
0,
|
|
612
|
+
);
|
|
613
|
+
if (retainedBytes <= maxBytes) return rows;
|
|
614
|
+
|
|
615
|
+
const candidates = rows
|
|
616
|
+
.filter(
|
|
617
|
+
(row) =>
|
|
618
|
+
row.classification === "managed-current" && row.action === "keep" && row.bytes !== null,
|
|
619
|
+
)
|
|
620
|
+
.sort((left, right) =>
|
|
621
|
+
`${left.expires_at ?? ""}\0${left.created_at ?? ""}\0${left.name}`.localeCompare(
|
|
622
|
+
`${right.expires_at ?? ""}\0${right.created_at ?? ""}\0${right.name}`,
|
|
623
|
+
),
|
|
624
|
+
);
|
|
625
|
+
for (const row of candidates) {
|
|
626
|
+
if (retainedBytes <= maxBytes) break;
|
|
627
|
+
row.classification = "managed-over-budget";
|
|
628
|
+
row.reason = `repository artifact budget is ${maxBytes} bytes; earliest-expiring inactive bundles are removed first`;
|
|
629
|
+
row.action = "would-delete";
|
|
630
|
+
retainedBytes -= row.bytes ?? 0;
|
|
631
|
+
}
|
|
632
|
+
return rows;
|
|
633
|
+
}
|
|
634
|
+
|
|
390
635
|
function readManifest(path: string): ParsedManifest | ManifestError {
|
|
391
636
|
const manifestPath = join(path, ARTIFACT_MANIFEST);
|
|
392
637
|
if (!existsSync(manifestPath)) {
|
|
@@ -432,6 +677,9 @@ function readManifest(path: string): ParsedManifest | ManifestError {
|
|
|
432
677
|
if (m.released_by !== undefined && !validActor(m.released_by)) {
|
|
433
678
|
return { ok: false, reason: "invalid released_by" };
|
|
434
679
|
}
|
|
680
|
+
if (m.oversize_acknowledged !== undefined && typeof m.oversize_acknowledged !== "boolean") {
|
|
681
|
+
return { ok: false, reason: "invalid oversize_acknowledged" };
|
|
682
|
+
}
|
|
435
683
|
return { ok: true, manifest: m as ArtifactManifestV1 };
|
|
436
684
|
}
|
|
437
685
|
|
|
@@ -541,6 +789,7 @@ function rowFor(
|
|
|
541
789
|
last_modified_at: null,
|
|
542
790
|
expires_at: null,
|
|
543
791
|
owner_instance_id: null,
|
|
792
|
+
oversize_acknowledged: false,
|
|
544
793
|
};
|
|
545
794
|
}
|
|
546
795
|
|