harnery 0.34.1 → 0.36.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 +124 -94
- package/dist/commands/agents.d.ts +37 -6
- package/dist/commands/agents.d.ts.map +1 -1
- package/dist/commands/agents.js +466 -371
- 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 +31 -6
- 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/decision.d.ts.map +1 -1
- package/dist/commands/decision.js +2 -2
- package/dist/commands/deinit.d.ts.map +1 -1
- package/dist/commands/deinit.js +5 -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/events.d.ts.map +1 -1
- package/dist/commands/events.js +18 -1
- package/dist/commands/fetch.js +6 -5
- package/dist/commands/files.d.ts +22 -0
- package/dist/commands/files.d.ts.map +1 -0
- package/dist/commands/files.js +113 -0
- package/dist/commands/governor.js +14 -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 +347 -1
- 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/presence.d.ts.map +1 -1
- package/dist/commands/presence.js +2 -2
- 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/semantic.d.ts +4 -0
- package/dist/commands/semantic.d.ts.map +1 -0
- package/dist/commands/semantic.js +199 -0
- 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/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.js +13 -13
- package/dist/core/adapters/profiles.d.ts +1 -1
- package/dist/core/agents/canonical-emit.d.ts +3 -0
- package/dist/core/agents/canonical-emit.d.ts.map +1 -1
- package/dist/core/agents/canonical-emit.js +12 -0
- package/dist/core/agents/claim-path.d.ts +11 -0
- package/dist/core/agents/claim-path.d.ts.map +1 -0
- package/dist/core/agents/claim-path.js +22 -0
- package/dist/core/agents/cli.js +209 -39
- package/dist/core/agents/coord-client.d.ts +29 -3
- package/dist/core/agents/coord-client.d.ts.map +1 -1
- package/dist/core/agents/coord-client.js +88 -9
- 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 +245 -13
- package/dist/core/agents/live-lifecycle-v3.js +9 -4
- package/dist/core/agents/live-observation-v3.d.ts.map +1 -1
- package/dist/core/agents/live-observation-v3.js +8 -3
- package/dist/core/agents/render/prompt-context.d.ts +9 -3
- package/dist/core/agents/render/prompt-context.d.ts.map +1 -1
- package/dist/core/agents/render/prompt-context.js +36 -17
- 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 +115 -22
- 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 +5 -1
- package/dist/core/agents/session-name-display.d.ts +1 -0
- package/dist/core/agents/session-name-display.d.ts.map +1 -1
- package/dist/core/agents/session-name-display.js +8 -1
- 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-reader.d.ts +46 -0
- package/dist/core/agents/state/heartbeat-reader.d.ts.map +1 -0
- package/dist/core/agents/state/heartbeat-reader.js +25 -0
- package/dist/core/agents/state/heartbeat-writer.d.ts +9 -48
- package/dist/core/agents/state/heartbeat-writer.d.ts.map +1 -1
- package/dist/core/agents/state/heartbeat-writer.js +34 -34
- package/dist/core/agents/state/live-coordination-view.d.ts +6 -8
- package/dist/core/agents/state/live-coordination-view.d.ts.map +1 -1
- package/dist/core/agents/state/live-coordination-view.js +16 -67
- 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/agents/state/names.d.ts +9 -1
- package/dist/core/agents/state/names.d.ts.map +1 -1
- package/dist/core/agents/state/names.js +190 -182
- package/dist/core/agents/state/stale-sweep.d.ts.map +1 -1
- package/dist/core/agents/state/stale-sweep.js +23 -5
- package/dist/core/artifacts/constants.d.ts +5 -0
- package/dist/core/artifacts/constants.d.ts.map +1 -0
- package/dist/core/artifacts/constants.js +4 -0
- package/dist/core/artifacts/index.d.ts +24 -3
- package/dist/core/artifacts/index.d.ts.map +1 -1
- package/dist/core/artifacts/index.js +96 -8
- package/dist/core/config.d.ts +62 -4
- package/dist/core/config.d.ts.map +1 -1
- package/dist/core/config.js +98 -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/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/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 +6 -0
- package/dist/core/events/legacy-storage/index.d.ts.map +1 -0
- package/dist/core/events/legacy-storage/index.js +5 -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/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 +851 -16
- package/dist/core/events/v3/base-contract.d.ts.map +1 -1
- package/dist/core/events/v3/base-contract.js +50 -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 +11 -0
- package/dist/core/events/v3/capabilities.d.ts.map +1 -1
- package/dist/core/events/v3/capabilities.js +26 -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 +8 -5
- package/dist/core/events/v3/index.d.ts.map +1 -1
- package/dist/core/events/v3/index.js +7 -4
- package/dist/core/events/v3/latency.d.ts +31 -1
- package/dist/core/events/v3/latency.d.ts.map +1 -1
- package/dist/core/events/v3/latency.js +127 -3
- 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 +42 -20
- package/dist/core/events/v3/live-routing.d.ts.map +1 -1
- package/dist/core/events/v3/live-routing.js +153 -41
- package/dist/core/events/v3/producers/command-recorder.d.ts.map +1 -1
- package/dist/core/events/v3/producers/command-recorder.js +10 -1
- 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 +90 -13
- 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 +17 -1
- package/dist/core/events/v3/producers/hook-base.d.ts.map +1 -1
- package/dist/core/events/v3/producers/hook-base.js +83 -2
- package/dist/core/events/v3/producers/intake.d.ts +13 -0
- package/dist/core/events/v3/producers/intake.d.ts.map +1 -1
- package/dist/core/events/v3/producers/intake.js +36 -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 +117 -1
- package/dist/core/events/v3/producers/recorder.d.ts.map +1 -1
- package/dist/core/events/v3/producers/recorder.js +992 -27
- 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 +52 -0
- package/dist/core/events/v3/runtime-telemetry-capabilities.d.ts.map +1 -0
- package/dist/core/events/v3/runtime-telemetry-capabilities.js +54 -0
- 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 +21 -6
- 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 +4 -2
- package/dist/core/hooks/adapter/output.d.ts.map +1 -1
- package/dist/core/hooks/adapter/output.js +13 -5
- package/dist/core/hooks/adapter/parse.d.ts +3 -0
- package/dist/core/hooks/adapter/parse.d.ts.map +1 -1
- package/dist/core/hooks/adapter/parse.js +14 -0
- package/dist/core/hooks/adapter/runtime-telemetry.d.ts +142 -0
- package/dist/core/hooks/adapter/runtime-telemetry.d.ts.map +1 -0
- package/dist/core/hooks/adapter/runtime-telemetry.js +869 -0
- package/dist/core/hooks/cli.js +318 -61
- 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/remediation-cap.d.ts +39 -0
- package/dist/core/hooks/remediation-cap.d.ts.map +1 -0
- package/dist/core/hooks/remediation-cap.js +63 -0
- 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 +33 -9
- package/dist/core/hooks/resolve/transcript.d.ts.map +1 -1
- package/dist/core/hooks/resolve/transcript.js +33 -10
- 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/semantic/adapters.d.ts +37 -0
- package/dist/core/semantic/adapters.d.ts.map +1 -0
- package/dist/core/semantic/adapters.js +360 -0
- package/dist/core/semantic/contract.d.ts +1072 -0
- package/dist/core/semantic/contract.d.ts.map +1 -0
- package/dist/core/semantic/contract.js +331 -0
- package/dist/core/semantic/evidence.d.ts +11 -0
- package/dist/core/semantic/evidence.d.ts.map +1 -0
- package/dist/core/semantic/evidence.js +262 -0
- package/dist/core/semantic/index.d.ts +14 -0
- package/dist/core/semantic/index.d.ts.map +1 -0
- package/dist/core/semantic/index.js +13 -0
- package/dist/core/semantic/once.d.ts +38 -0
- package/dist/core/semantic/once.d.ts.map +1 -0
- package/dist/core/semantic/once.js +364 -0
- package/dist/core/semantic/prompt.d.ts +12 -0
- package/dist/core/semantic/prompt.d.ts.map +1 -0
- package/dist/core/semantic/prompt.js +83 -0
- 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 +27 -0
- package/dist/core/semantic/scheduler.d.ts.map +1 -0
- package/dist/core/semantic/scheduler.js +91 -0
- package/dist/core/semantic/service-status.d.ts +51 -0
- package/dist/core/semantic/service-status.d.ts.map +1 -0
- package/dist/core/semantic/service-status.js +140 -0
- package/dist/core/semantic/service.d.ts +52 -0
- package/dist/core/semantic/service.d.ts.map +1 -0
- package/dist/core/semantic/service.js +559 -0
- 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 +81 -0
- package/dist/core/semantic/storage.d.ts.map +1 -0
- package/dist/core/semantic/storage.js +180 -0
- 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 +18 -0
- package/dist/core/semantic/validate.d.ts.map +1 -0
- package/dist/core/semantic/validate.js +207 -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 +683 -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 +82 -0
- package/dist/core/storage/logger.d.ts.map +1 -0
- package/dist/core/storage/logger.js +411 -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 +34 -0
- package/dist/core/storage/query.d.ts.map +1 -0
- package/dist/core/storage/query.js +295 -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/work/state.d.ts.map +1 -1
- package/dist/core/work/state.js +10 -14
- package/dist/core/workflow/live-session-v3.d.ts.map +1 -1
- package/dist/core/workflow/live-session-v3.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 +11 -0
- package/dist/lib/browser/client.d.ts.map +1 -1
- package/dist/lib/browser/client.js +13 -0
- package/dist/lib/browser/index.d.ts +1 -0
- package/dist/lib/browser/index.d.ts.map +1 -1
- package/dist/lib/browser/standalone-html.d.ts +25 -0
- package/dist/lib/browser/standalone-html.d.ts.map +1 -0
- package/dist/lib/browser/standalone-html.js +284 -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.map +1 -1
- package/dist/lib/instructions/apply.js +1 -0
- package/dist/lib/instructions/templates.d.ts +2 -0
- package/dist/lib/instructions/templates.d.ts.map +1 -1
- package/dist/lib/instructions/templates.js +149 -4
- 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 +34 -2
- package/schemas/config.schema.json +58 -0
- package/schemas/event-v3.schema.json +3073 -581
- package/src/commander.ts +462 -93
- package/src/commands/agents.ts +617 -355
- package/src/commands/backup.ts +18 -14
- package/src/commands/browse-session.ts +12 -0
- package/src/commands/browse.ts +31 -9
- package/src/commands/conversations.ts +279 -0
- package/src/commands/decision.ts +8 -2
- package/src/commands/deinit.ts +6 -0
- package/src/commands/docs.ts +25 -6
- package/src/commands/doctor.ts +75 -9
- package/src/commands/events.ts +21 -1
- package/src/commands/fetch.ts +7 -6
- package/src/commands/files.ts +143 -0
- package/src/commands/governor.ts +13 -12
- package/src/commands/inbox.ts +61 -0
- package/src/commands/init.ts +78 -16
- package/src/commands/ledger-v3.ts +421 -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/presence.ts +7 -2
- package/src/commands/read.ts +6 -2
- package/src/commands/semantic.ts +244 -0
- package/src/commands/storage.ts +310 -0
- package/src/commands/tunnel.ts +66 -52
- package/src/commands/web.ts +92 -7
- package/src/commands/work.ts +3 -3
- package/src/commands/workflow.ts +13 -13
- package/src/core/agents/canonical-emit.ts +15 -0
- package/src/core/agents/claim-path.ts +23 -0
- package/src/core/agents/cli.ts +259 -53
- package/src/core/agents/coord-client.ts +92 -8
- package/src/core/agents/live-authority-v3.ts +342 -14
- package/src/core/agents/live-lifecycle-v3.ts +14 -4
- package/src/core/agents/live-observation-v3.ts +13 -3
- package/src/core/agents/render/prompt-context.ts +40 -16
- package/src/core/agents/rules/stop-hook.ts +129 -25
- 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 +4 -1
- package/src/core/agents/session-name-display.ts +9 -1
- package/src/core/agents/state/activity-log.ts +7 -2
- package/src/core/agents/state/heartbeat-reader.ts +69 -0
- package/src/core/agents/state/heartbeat-writer.ts +47 -84
- package/src/core/agents/state/live-coordination-view.ts +17 -81
- package/src/core/agents/state/live-coordination-writer.ts +141 -0
- package/src/core/agents/state/names.ts +190 -182
- package/src/core/agents/state/stale-sweep.ts +25 -5
- package/src/core/artifacts/constants.ts +4 -0
- package/src/core/artifacts/index.ts +113 -8
- package/src/core/config.ts +126 -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/events/legacy-storage/canary.ts +177 -0
- package/src/core/events/legacy-storage/fence.ts +129 -0
- package/src/core/events/legacy-storage/index.ts +5 -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/authority-outbox.ts +22 -1
- package/src/core/events/v3/base-contract.ts +56 -7
- package/src/core/events/v3/bootstrap.ts +195 -2
- package/src/core/events/v3/capabilities.ts +37 -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 +26 -2
- package/src/core/events/v3/latency.ts +213 -2
- package/src/core/events/v3/live-route-observer.ts +80 -0
- package/src/core/events/v3/live-routing.ts +182 -45
- package/src/core/events/v3/producers/command-recorder.ts +10 -1
- package/src/core/events/v3/producers/coordination-recorder.ts +112 -15
- package/src/core/events/v3/producers/diagnostic-summaries.ts +593 -0
- package/src/core/events/v3/producers/hook-base.ts +116 -2
- package/src/core/events/v3/producers/intake.ts +48 -2
- package/src/core/events/v3/producers/producer-state-observer.ts +52 -0
- package/src/core/events/v3/producers/recorder.ts +1403 -30
- 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 +143 -0
- 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 +66 -5
- 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 +12 -5
- package/src/core/hooks/adapter/parse.ts +16 -0
- package/src/core/hooks/adapter/runtime-telemetry.ts +1200 -0
- package/src/core/hooks/cli.ts +342 -64
- package/src/core/hooks/effects/image-capture.ts +4 -1
- package/src/core/hooks/remediation-cap.ts +83 -0
- 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 +55 -11
- 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/semantic/adapters.ts +452 -0
- package/src/core/semantic/contract.ts +430 -0
- package/src/core/semantic/evidence.ts +336 -0
- package/src/core/semantic/index.ts +201 -0
- package/src/core/semantic/once.ts +496 -0
- package/src/core/semantic/prompt.ts +96 -0
- package/src/core/semantic/review.ts +803 -0
- package/src/core/semantic/routes.ts +30 -0
- package/src/core/semantic/scheduler.ts +151 -0
- package/src/core/semantic/service-status.ts +212 -0
- package/src/core/semantic/service.ts +681 -0
- package/src/core/semantic/soak.ts +638 -0
- package/src/core/semantic/storage.ts +300 -0
- package/src/core/semantic/usage.ts +272 -0
- package/src/core/semantic/validate.ts +243 -0
- package/src/core/storage/buffer.ts +124 -0
- package/src/core/storage/builtins.ts +916 -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 +546 -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 +360 -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/work/state.ts +12 -21
- package/src/core/workflow/live-session-v3.ts +2 -4
- package/src/index.ts +2 -0
- package/src/lazy-commands.ts +294 -0
- package/src/lib/browser/client.ts +21 -0
- package/src/lib/browser/index.ts +4 -0
- package/src/lib/browser/standalone-html.ts +312 -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 +1 -0
- package/src/lib/instructions/templates.ts +154 -4
- package/src/lib/local-file-url.ts +31 -0
- package/src/lib/web-performance.ts +335 -0
|
@@ -186,7 +186,7 @@ export function digestEventV3AuthorityDirectoryV3(root: string): `sha256:${strin
|
|
|
186
186
|
return `sha256:${createHash("sha256").update(canonicalJsonV3(files)).digest("hex")}`;
|
|
187
187
|
}
|
|
188
188
|
|
|
189
|
-
interface PendingAdvance {
|
|
189
|
+
export interface PendingAdvance {
|
|
190
190
|
event_id: string;
|
|
191
191
|
next_schema_digest: string;
|
|
192
192
|
position: LedgerFrameV3["position"];
|
|
@@ -228,6 +228,29 @@ interface LedgerStorageVersionV3 {
|
|
|
228
228
|
};
|
|
229
229
|
}
|
|
230
230
|
|
|
231
|
+
export interface EventV3AuthorityStorageVersionV3 {
|
|
232
|
+
fingerprint: `sha256:${string}`;
|
|
233
|
+
stable_fingerprint: `sha256:${string}`;
|
|
234
|
+
active_bytes: number;
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
export interface EventV3AppendValidationCheckpointV3 {
|
|
238
|
+
format: "harnery-event-v3-append-validation-checkpoint";
|
|
239
|
+
format_version: 1;
|
|
240
|
+
reader_build: string;
|
|
241
|
+
accepted_schema_digests: string[];
|
|
242
|
+
seen_event_ids: string[];
|
|
243
|
+
producer_sequences: Array<[string, number]>;
|
|
244
|
+
attestation_ids: string[];
|
|
245
|
+
clocks: Array<[string, number, string?]>;
|
|
246
|
+
event_count: number;
|
|
247
|
+
genesis_id?: string;
|
|
248
|
+
active_schema_digest?: string;
|
|
249
|
+
pending?: PendingAdvance;
|
|
250
|
+
active_segment_ordinal: number;
|
|
251
|
+
validated_active_bytes: number;
|
|
252
|
+
}
|
|
253
|
+
|
|
231
254
|
interface LedgerValidationStateV3 {
|
|
232
255
|
diagnostics: LedgerDiagnosticV3[];
|
|
233
256
|
events: PositionedEventV3[];
|
|
@@ -238,6 +261,7 @@ interface LedgerValidationStateV3 {
|
|
|
238
261
|
producer_sequences: Map<string, number>;
|
|
239
262
|
attestations: Set<string>;
|
|
240
263
|
clocks: Map<string, { observed_at_ms: number; monotonic_ns?: bigint }>;
|
|
264
|
+
event_count: number;
|
|
241
265
|
first_position?: LedgerFrameV3["position"];
|
|
242
266
|
genesis_id?: string;
|
|
243
267
|
active_schema_digest?: string;
|
|
@@ -255,6 +279,10 @@ const MAX_CACHED_LEDGER_READS = 4;
|
|
|
255
279
|
const ledgerReadCacheV3 = new Map<string, CachedLedgerReadV3>();
|
|
256
280
|
|
|
257
281
|
export const EVENT_V3_LEDGER_RELATIVE_ROOT = ".harnery/ledgers/v3" as const;
|
|
282
|
+
export const EVENT_V3_CONTROL_WITNESS_RELATIVE_PATH =
|
|
283
|
+
`${EVENT_V3_LEDGER_RELATIVE_ROOT}/control-state-witness.json` as const;
|
|
284
|
+
export const EVENT_V3_CONTROL_CHECKPOINT_RELATIVE_PATH =
|
|
285
|
+
`${EVENT_V3_LEDGER_RELATIVE_ROOT}/control-state-validation.json` as const;
|
|
258
286
|
|
|
259
287
|
export function eventV3Paths(coordRoot: string) {
|
|
260
288
|
const root = join(resolve(coordRoot), EVENT_V3_LEDGER_RELATIVE_ROOT);
|
|
@@ -271,6 +299,128 @@ export function eventV3ActiveWatchPath(coordRoot: string): string {
|
|
|
271
299
|
return eventV3Paths(coordRoot).active;
|
|
272
300
|
}
|
|
273
301
|
|
|
302
|
+
/** Stable auxiliary control-cache target; canonical event reads remain inside this module. */
|
|
303
|
+
export function eventV3ControlWitnessPathV3(coordRoot: string): string {
|
|
304
|
+
return join(eventV3Paths(coordRoot).root, "control-state-witness.json");
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
/** Stable auxiliary validator-checkpoint target owned by the control witness. */
|
|
308
|
+
export function eventV3ControlCheckpointPathV3(coordRoot: string): string {
|
|
309
|
+
return join(eventV3Paths(coordRoot).root, "control-state-validation.json");
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
/**
|
|
313
|
+
* Content-independent identity for the complete filesystem authority.
|
|
314
|
+
*
|
|
315
|
+
* The control witness authenticates this value after a complete validation.
|
|
316
|
+
* Any append, rewrite, inode replacement, catalog change, sealed-segment
|
|
317
|
+
* change, or recovery-record change produces a different fingerprint and
|
|
318
|
+
* sends the control reader back through the canonical full validation path.
|
|
319
|
+
*/
|
|
320
|
+
export function eventV3AuthorityStorageVersionV3(
|
|
321
|
+
coordRoot: string,
|
|
322
|
+
): EventV3AuthorityStorageVersionV3 {
|
|
323
|
+
const storage = ledgerStorageVersionV3(coordRoot);
|
|
324
|
+
return {
|
|
325
|
+
fingerprint: sha256V3(storage.fingerprint),
|
|
326
|
+
stable_fingerprint: sha256V3(storage.stable_fingerprint),
|
|
327
|
+
active_bytes: storage.active?.size ?? 0,
|
|
328
|
+
};
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
/** Serialize the validator tail produced by the current complete cached read. */
|
|
332
|
+
export function readEventV3AppendValidationCheckpointV3(
|
|
333
|
+
coordRoot: string,
|
|
334
|
+
): EventV3AppendValidationCheckpointV3 | undefined {
|
|
335
|
+
const options: ReadLedgerV3Options = {};
|
|
336
|
+
const result = readLedgerV3(coordRoot, options);
|
|
337
|
+
if (!result.complete) return undefined;
|
|
338
|
+
const cached = ledgerReadCacheV3.get(ledgerReadCacheKeyV3(coordRoot, options));
|
|
339
|
+
if (!cached?.active || !cached.result.complete) return undefined;
|
|
340
|
+
return checkpointFromValidationStateV3(cached.validation_state, cached.active);
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
/**
|
|
344
|
+
* Validate only the bytes appended after an authenticated checkpoint.
|
|
345
|
+
* Unsupported or semantically invalid transitions return undefined so the
|
|
346
|
+
* control reader falls back to a complete canonical validation.
|
|
347
|
+
*/
|
|
348
|
+
export function advanceEventV3AppendValidationCheckpointV3(
|
|
349
|
+
coordRoot: string,
|
|
350
|
+
checkpoint: EventV3AppendValidationCheckpointV3,
|
|
351
|
+
): EventV3AppendValidationCheckpointV3 | undefined {
|
|
352
|
+
const parsed = parseEventV3AppendValidationCheckpointV3(checkpoint);
|
|
353
|
+
if (!parsed) return undefined;
|
|
354
|
+
const storage = ledgerStorageVersionV3(coordRoot);
|
|
355
|
+
if (!storage.active || storage.active.size <= parsed.validated_active_bytes) return undefined;
|
|
356
|
+
const appended = readActiveRangeV3(
|
|
357
|
+
storage.active.path,
|
|
358
|
+
parsed.validated_active_bytes,
|
|
359
|
+
storage.active.size,
|
|
360
|
+
parsed.active_segment_ordinal,
|
|
361
|
+
);
|
|
362
|
+
if (!appended || appended.diagnostics.length > 0) return undefined;
|
|
363
|
+
const state = validationStateFromCheckpointV3(parsed);
|
|
364
|
+
validateLedgerFramesIntoStateV3(appended.frames, state);
|
|
365
|
+
if (state.diagnostics.length > 0) return undefined;
|
|
366
|
+
return checkpointFromValidationStateV3(state, {
|
|
367
|
+
bytes: storage.active.size,
|
|
368
|
+
path: storage.active.path,
|
|
369
|
+
segment_ordinal: parsed.active_segment_ordinal,
|
|
370
|
+
});
|
|
371
|
+
}
|
|
372
|
+
|
|
373
|
+
/** Parse an untrusted persisted checkpoint without weakening the writer fence. */
|
|
374
|
+
export function parseEventV3AppendValidationCheckpointV3(
|
|
375
|
+
value: unknown,
|
|
376
|
+
): EventV3AppendValidationCheckpointV3 | undefined {
|
|
377
|
+
if (!value || typeof value !== "object" || Array.isArray(value)) return undefined;
|
|
378
|
+
const checkpoint = value as Partial<EventV3AppendValidationCheckpointV3>;
|
|
379
|
+
if (
|
|
380
|
+
checkpoint.format !== "harnery-event-v3-append-validation-checkpoint" ||
|
|
381
|
+
checkpoint.format_version !== 1 ||
|
|
382
|
+
typeof checkpoint.reader_build !== "string" ||
|
|
383
|
+
!Array.isArray(checkpoint.accepted_schema_digests) ||
|
|
384
|
+
!checkpoint.accepted_schema_digests.every((item) => typeof item === "string") ||
|
|
385
|
+
!Array.isArray(checkpoint.seen_event_ids) ||
|
|
386
|
+
!checkpoint.seen_event_ids.every((item) => typeof item === "string") ||
|
|
387
|
+
!Array.isArray(checkpoint.producer_sequences) ||
|
|
388
|
+
!checkpoint.producer_sequences.every(
|
|
389
|
+
(item) =>
|
|
390
|
+
Array.isArray(item) &&
|
|
391
|
+
item.length === 2 &&
|
|
392
|
+
typeof item[0] === "string" &&
|
|
393
|
+
Number.isSafeInteger(item[1]) &&
|
|
394
|
+
item[1] > 0,
|
|
395
|
+
) ||
|
|
396
|
+
!Array.isArray(checkpoint.attestation_ids) ||
|
|
397
|
+
!checkpoint.attestation_ids.every((item) => typeof item === "string") ||
|
|
398
|
+
!Array.isArray(checkpoint.clocks) ||
|
|
399
|
+
!checkpoint.clocks.every(
|
|
400
|
+
(item) =>
|
|
401
|
+
Array.isArray(item) &&
|
|
402
|
+
(item.length === 2 || item.length === 3) &&
|
|
403
|
+
typeof item[0] === "string" &&
|
|
404
|
+
typeof item[1] === "number" &&
|
|
405
|
+
Number.isFinite(item[1]) &&
|
|
406
|
+
(item[2] === undefined || (typeof item[2] === "string" && /^\d+$/.test(item[2]))),
|
|
407
|
+
) ||
|
|
408
|
+
!Number.isSafeInteger(checkpoint.event_count) ||
|
|
409
|
+
(checkpoint.event_count ?? -1) < 0 ||
|
|
410
|
+
!Number.isSafeInteger(checkpoint.active_segment_ordinal) ||
|
|
411
|
+
(checkpoint.active_segment_ordinal ?? 0) < 1 ||
|
|
412
|
+
!Number.isSafeInteger(checkpoint.validated_active_bytes) ||
|
|
413
|
+
(checkpoint.validated_active_bytes ?? -1) < 0 ||
|
|
414
|
+
(checkpoint.genesis_id !== undefined && typeof checkpoint.genesis_id !== "string") ||
|
|
415
|
+
(checkpoint.active_schema_digest !== undefined &&
|
|
416
|
+
typeof checkpoint.active_schema_digest !== "string") ||
|
|
417
|
+
!validPendingAdvanceV3(checkpoint.pending)
|
|
418
|
+
) {
|
|
419
|
+
return undefined;
|
|
420
|
+
}
|
|
421
|
+
return checkpoint as EventV3AppendValidationCheckpointV3;
|
|
422
|
+
}
|
|
423
|
+
|
|
274
424
|
/** Read the complete V3 ledger through catalog-bound filesystem discovery. */
|
|
275
425
|
export function readLedgerV3(
|
|
276
426
|
coordRoot: string,
|
|
@@ -384,6 +534,7 @@ function validateLedgerFramesV3(
|
|
|
384
534
|
producer_sequences: new Map(),
|
|
385
535
|
attestations: new Set(),
|
|
386
536
|
clocks: new Map(),
|
|
537
|
+
event_count: 0,
|
|
387
538
|
};
|
|
388
539
|
validateLedgerFramesIntoStateV3(frames, state);
|
|
389
540
|
return { result: finishLedgerValidationV3(state, options, ledgerFramesBytesV3(frames)), state };
|
|
@@ -456,7 +607,7 @@ function validateLedgerFramesIntoStateV3(
|
|
|
456
607
|
diagnostics.push(diagnostic("multiple_genesis", frame, shape.event_id));
|
|
457
608
|
continue;
|
|
458
609
|
}
|
|
459
|
-
if (
|
|
610
|
+
if (state.event_count !== 0)
|
|
460
611
|
diagnostics.push(diagnostic("genesis_not_first", frame, shape.event_id));
|
|
461
612
|
const payload = shape.payload;
|
|
462
613
|
state.genesis_id = string(payload.genesis_id);
|
|
@@ -524,6 +675,7 @@ function validateLedgerFramesIntoStateV3(
|
|
|
524
675
|
}
|
|
525
676
|
|
|
526
677
|
events.push({ event, position: frame.position });
|
|
678
|
+
state.event_count += 1;
|
|
527
679
|
}
|
|
528
680
|
}
|
|
529
681
|
|
|
@@ -816,6 +968,95 @@ function isolateValidationStateV3(state: LedgerValidationStateV3): LedgerValidat
|
|
|
816
968
|
};
|
|
817
969
|
}
|
|
818
970
|
|
|
971
|
+
function checkpointFromValidationStateV3(
|
|
972
|
+
state: LedgerValidationStateV3,
|
|
973
|
+
active: NonNullable<DiscoveredFramesV3["active"]>,
|
|
974
|
+
): EventV3AppendValidationCheckpointV3 {
|
|
975
|
+
return {
|
|
976
|
+
format: "harnery-event-v3-append-validation-checkpoint",
|
|
977
|
+
format_version: 1,
|
|
978
|
+
reader_build: state.reader_build,
|
|
979
|
+
accepted_schema_digests: [...state.accepted].sort(),
|
|
980
|
+
seen_event_ids: [...state.seen_ids.keys()].sort(),
|
|
981
|
+
producer_sequences: [...state.producer_sequences.entries()].sort(([left], [right]) =>
|
|
982
|
+
left.localeCompare(right),
|
|
983
|
+
),
|
|
984
|
+
attestation_ids: [...state.attestations].sort(),
|
|
985
|
+
clocks: [...state.clocks.entries()]
|
|
986
|
+
.sort(([left], [right]) => left.localeCompare(right))
|
|
987
|
+
.map(([clockId, clock]): [string, number, string?] =>
|
|
988
|
+
clock.monotonic_ns !== undefined
|
|
989
|
+
? [clockId, clock.observed_at_ms, clock.monotonic_ns.toString()]
|
|
990
|
+
: [clockId, clock.observed_at_ms],
|
|
991
|
+
),
|
|
992
|
+
event_count: state.event_count,
|
|
993
|
+
...(state.genesis_id ? { genesis_id: state.genesis_id } : {}),
|
|
994
|
+
...(state.active_schema_digest ? { active_schema_digest: state.active_schema_digest } : {}),
|
|
995
|
+
...(state.pending
|
|
996
|
+
? {
|
|
997
|
+
pending: {
|
|
998
|
+
...state.pending,
|
|
999
|
+
position: { ...state.pending.position },
|
|
1000
|
+
},
|
|
1001
|
+
}
|
|
1002
|
+
: {}),
|
|
1003
|
+
active_segment_ordinal: active.segment_ordinal,
|
|
1004
|
+
validated_active_bytes: active.bytes,
|
|
1005
|
+
};
|
|
1006
|
+
}
|
|
1007
|
+
|
|
1008
|
+
function validationStateFromCheckpointV3(
|
|
1009
|
+
checkpoint: EventV3AppendValidationCheckpointV3,
|
|
1010
|
+
): LedgerValidationStateV3 {
|
|
1011
|
+
return {
|
|
1012
|
+
diagnostics: [],
|
|
1013
|
+
events: [],
|
|
1014
|
+
advances: [],
|
|
1015
|
+
accepted: new Set(checkpoint.accepted_schema_digests),
|
|
1016
|
+
reader_build: checkpoint.reader_build,
|
|
1017
|
+
seen_ids: new Map(checkpoint.seen_event_ids.map((eventId) => [eventId, ""])),
|
|
1018
|
+
producer_sequences: new Map(checkpoint.producer_sequences),
|
|
1019
|
+
attestations: new Set(checkpoint.attestation_ids),
|
|
1020
|
+
clocks: new Map(
|
|
1021
|
+
checkpoint.clocks.map(([clockId, observedAtMs, monotonicNs]) => [
|
|
1022
|
+
clockId,
|
|
1023
|
+
{
|
|
1024
|
+
observed_at_ms: observedAtMs,
|
|
1025
|
+
...(monotonicNs !== undefined ? { monotonic_ns: BigInt(monotonicNs) } : {}),
|
|
1026
|
+
},
|
|
1027
|
+
]),
|
|
1028
|
+
),
|
|
1029
|
+
event_count: checkpoint.event_count,
|
|
1030
|
+
...(checkpoint.genesis_id ? { genesis_id: checkpoint.genesis_id } : {}),
|
|
1031
|
+
...(checkpoint.active_schema_digest
|
|
1032
|
+
? { active_schema_digest: checkpoint.active_schema_digest }
|
|
1033
|
+
: {}),
|
|
1034
|
+
...(checkpoint.pending
|
|
1035
|
+
? {
|
|
1036
|
+
pending: {
|
|
1037
|
+
...checkpoint.pending,
|
|
1038
|
+
position: { ...checkpoint.pending.position },
|
|
1039
|
+
},
|
|
1040
|
+
}
|
|
1041
|
+
: {}),
|
|
1042
|
+
};
|
|
1043
|
+
}
|
|
1044
|
+
|
|
1045
|
+
function validPendingAdvanceV3(value: unknown): boolean {
|
|
1046
|
+
if (value === undefined) return true;
|
|
1047
|
+
if (!value || typeof value !== "object" || Array.isArray(value)) return false;
|
|
1048
|
+
const pending = value as Partial<PendingAdvance>;
|
|
1049
|
+
return (
|
|
1050
|
+
typeof pending.event_id === "string" &&
|
|
1051
|
+
typeof pending.next_schema_digest === "string" &&
|
|
1052
|
+
Boolean(pending.position) &&
|
|
1053
|
+
Number.isSafeInteger(pending.position?.segment_ordinal) &&
|
|
1054
|
+
Number.isSafeInteger(pending.position?.byte_offset) &&
|
|
1055
|
+
(pending.position?.segment_ordinal ?? 0) > 0 &&
|
|
1056
|
+
(pending.position?.byte_offset ?? -1) >= 0
|
|
1057
|
+
);
|
|
1058
|
+
}
|
|
1059
|
+
|
|
819
1060
|
function readActiveRangeV3(
|
|
820
1061
|
path: string,
|
|
821
1062
|
start: number,
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import { readFileSync } from "node:fs";
|
|
2
|
+
import { homedir } from "node:os";
|
|
3
|
+
import { join } from "node:path";
|
|
4
|
+
|
|
5
|
+
/** Default active-segment size that triggers automatic V3 epoch rotation. */
|
|
6
|
+
export const DEFAULT_EVENT_LEDGER_ROTATE_ACTIVE_BYTES = 32 * 1024 * 1024;
|
|
7
|
+
|
|
8
|
+
interface EventLedgerConfigFile {
|
|
9
|
+
events?: { rotate_active_bytes?: unknown };
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
/** Strip JSONC comments without treating comment-like text inside strings as syntax. */
|
|
13
|
+
function stripJsonComments(input: string): string {
|
|
14
|
+
let out = "";
|
|
15
|
+
let index = 0;
|
|
16
|
+
let inString = false;
|
|
17
|
+
while (index < input.length) {
|
|
18
|
+
const character = input[index];
|
|
19
|
+
if (inString) {
|
|
20
|
+
out += character;
|
|
21
|
+
if (character === "\\" && index + 1 < input.length) {
|
|
22
|
+
out += input[index + 1];
|
|
23
|
+
index += 2;
|
|
24
|
+
continue;
|
|
25
|
+
}
|
|
26
|
+
if (character === '"') inString = false;
|
|
27
|
+
index++;
|
|
28
|
+
continue;
|
|
29
|
+
}
|
|
30
|
+
if (character === '"') {
|
|
31
|
+
inString = true;
|
|
32
|
+
out += character;
|
|
33
|
+
index++;
|
|
34
|
+
continue;
|
|
35
|
+
}
|
|
36
|
+
if (character === "/" && input[index + 1] === "/") {
|
|
37
|
+
while (index < input.length && input[index] !== "\n") index++;
|
|
38
|
+
continue;
|
|
39
|
+
}
|
|
40
|
+
if (character === "/" && input[index + 1] === "*") {
|
|
41
|
+
index += 2;
|
|
42
|
+
while (index < input.length && !(input[index] === "*" && input[index + 1] === "/")) {
|
|
43
|
+
index++;
|
|
44
|
+
}
|
|
45
|
+
index += 2;
|
|
46
|
+
continue;
|
|
47
|
+
}
|
|
48
|
+
out += character;
|
|
49
|
+
index++;
|
|
50
|
+
}
|
|
51
|
+
return out;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
function readConfig(path: string): EventLedgerConfigFile {
|
|
55
|
+
try {
|
|
56
|
+
const parsed = JSON.parse(stripJsonComments(readFileSync(path, "utf8"))) as unknown;
|
|
57
|
+
if (parsed && typeof parsed === "object") return parsed as EventLedgerConfigFile;
|
|
58
|
+
} catch {
|
|
59
|
+
// Missing or malformed config falls through to the next precedence layer.
|
|
60
|
+
}
|
|
61
|
+
return {};
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
function configuredThreshold(config: EventLedgerConfigFile): {
|
|
65
|
+
present: boolean;
|
|
66
|
+
value: unknown;
|
|
67
|
+
} {
|
|
68
|
+
const events = config.events;
|
|
69
|
+
if (!events || typeof events !== "object") return { present: false, value: undefined };
|
|
70
|
+
return {
|
|
71
|
+
present: Object.hasOwn(events, "rotate_active_bytes"),
|
|
72
|
+
value: events.rotate_active_bytes,
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* Resolve the active-segment byte threshold without importing the host CLI's
|
|
78
|
+
* configuration layer. Event V3 is vendored into clients as a closed runtime,
|
|
79
|
+
* so this leaf reads only process state and JSONC files.
|
|
80
|
+
*/
|
|
81
|
+
export function resolveEventLedgerRotateActiveBytesV3(coordRoot: string | null): number {
|
|
82
|
+
const env = process.env.HARNERY_EVENT_V3_ROTATE_ACTIVE_BYTES;
|
|
83
|
+
if (env !== undefined) {
|
|
84
|
+
const parsed = Number.parseInt(env, 10);
|
|
85
|
+
if (Number.isFinite(parsed)) return parsed;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
if (coordRoot) {
|
|
89
|
+
const project = configuredThreshold(readConfig(join(coordRoot, ".harnery", "config.jsonc")));
|
|
90
|
+
const xdg = process.env.XDG_CONFIG_HOME;
|
|
91
|
+
const userBase = xdg?.trim() ? xdg : join(homedir(), ".config");
|
|
92
|
+
const user = configuredThreshold(readConfig(join(userBase, "harnery", "config.jsonc")));
|
|
93
|
+
const configured = project.present ? project.value : user.value;
|
|
94
|
+
if (typeof configured === "number" && Number.isSafeInteger(configured)) return configured;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
return DEFAULT_EVENT_LEDGER_ROTATE_ACTIVE_BYTES;
|
|
98
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { spawnSync } from "node:child_process";
|
|
2
|
+
import { existsSync, readFileSync } from "node:fs";
|
|
3
|
+
import { resolve } from "node:path";
|
|
4
|
+
|
|
5
|
+
export { liveEventV3BuildId, livePlatformV3 } from "./runtime-identity.ts";
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Identify the code running this producer.
|
|
9
|
+
*
|
|
10
|
+
* Source checkouts use the exact Git commit. Published packages use their
|
|
11
|
+
* package version, which changes at the installation boundary without tying
|
|
12
|
+
* the authority profile to a machine-specific install path.
|
|
13
|
+
*/
|
|
14
|
+
export function currentHarneryRuntimeBuild(): string {
|
|
15
|
+
const root = harneryPackageRoot();
|
|
16
|
+
if (existsSync(resolve(root, ".git"))) {
|
|
17
|
+
const result = spawnSync("git", ["-C", root, "rev-parse", "HEAD"], {
|
|
18
|
+
encoding: "utf8",
|
|
19
|
+
timeout: 5_000,
|
|
20
|
+
});
|
|
21
|
+
const commit = result.status === 0 ? result.stdout.trim() : "";
|
|
22
|
+
if (/^[0-9a-f]{40,64}$/.test(commit)) return commit;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
const packagePath = resolve(root, "package.json");
|
|
26
|
+
if (existsSync(packagePath)) {
|
|
27
|
+
try {
|
|
28
|
+
const value = JSON.parse(readFileSync(packagePath, "utf8")) as { version?: unknown };
|
|
29
|
+
if (typeof value.version === "string" && /^[0-9A-Za-z._+-]{1,100}$/.test(value.version)) {
|
|
30
|
+
return `npm-${value.version}`;
|
|
31
|
+
}
|
|
32
|
+
} catch {
|
|
33
|
+
// A malformed package manifest falls through to a stable source digest.
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
throw new Error("harnery_runtime_build_unavailable");
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export function harneryPackageRoot(): string {
|
|
40
|
+
return resolve(import.meta.dir, "../../../..");
|
|
41
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { createHash } from "node:crypto";
|
|
2
|
+
|
|
3
|
+
/** Stable producer build id bound into one V3 epoch. */
|
|
4
|
+
export function liveEventV3BuildId(harneryBuild: string): `build_${string}` {
|
|
5
|
+
const exact = harneryBuild.normalize("NFC");
|
|
6
|
+
if (/^[a-zA-Z0-9._-]{1,120}$/.test(exact)) return `build_${exact}`;
|
|
7
|
+
return `build_${createHash("sha256").update(exact).digest("hex")}`;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
/** Platform recorded by runtime-owned V3 producers. */
|
|
11
|
+
export function livePlatformV3(): "linux" | "windows" | "macos" | "unknown" {
|
|
12
|
+
if (process.platform === "linux") return "linux";
|
|
13
|
+
if (process.platform === "win32") return "windows";
|
|
14
|
+
if (process.platform === "darwin") return "macos";
|
|
15
|
+
return "unknown";
|
|
16
|
+
}
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
import type { Adapter } from "../../adapter.ts";
|
|
2
|
+
import {
|
|
3
|
+
adapterSignalSupportV3,
|
|
4
|
+
type CapabilitySupportV3,
|
|
5
|
+
type CursorExecutionModeV3,
|
|
6
|
+
} from "./capabilities.ts";
|
|
7
|
+
|
|
8
|
+
export type RuntimeTelemetryChannelV3 =
|
|
9
|
+
| "context_usage"
|
|
10
|
+
| "wait_spans"
|
|
11
|
+
| "wait_completeness"
|
|
12
|
+
| "response_latency"
|
|
13
|
+
| "inference_timing";
|
|
14
|
+
|
|
15
|
+
export type RuntimeTelemetryCompletenessV3 =
|
|
16
|
+
| "exact"
|
|
17
|
+
| "inferred"
|
|
18
|
+
| "percentage_only"
|
|
19
|
+
| "lower_bound"
|
|
20
|
+
| "unknown";
|
|
21
|
+
|
|
22
|
+
export interface RuntimeTelemetryCapabilityValueV3 {
|
|
23
|
+
support: Exclude<CapabilitySupportV3, "unsupported">;
|
|
24
|
+
source: string;
|
|
25
|
+
completeness: RuntimeTelemetryCompletenessV3;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export type RuntimeTelemetryCapabilityObservationV3 =
|
|
29
|
+
| {
|
|
30
|
+
state: "observed";
|
|
31
|
+
value: RuntimeTelemetryCapabilityValueV3;
|
|
32
|
+
attestation: "native" | "derived" | "inferred";
|
|
33
|
+
confidence: "exact" | "high" | "medium" | "low";
|
|
34
|
+
}
|
|
35
|
+
| { state: "expected_but_missing"; capability: string; reason: string }
|
|
36
|
+
| { state: "unsupported"; capability: string };
|
|
37
|
+
|
|
38
|
+
export type RuntimeContextCapabilityEvidenceV3 =
|
|
39
|
+
| {
|
|
40
|
+
state: "observed";
|
|
41
|
+
source: string;
|
|
42
|
+
attestation: "native" | "derived" | "inferred";
|
|
43
|
+
confidence: "exact" | "high" | "medium" | "low";
|
|
44
|
+
completeness?: "exact" | "inferred" | "percentage_only";
|
|
45
|
+
}
|
|
46
|
+
| { state: "partial"; reason: string }
|
|
47
|
+
| { state: "unsupported" };
|
|
48
|
+
|
|
49
|
+
export interface RuntimeTelemetryCapabilityEvidenceV3 {
|
|
50
|
+
adapter: Adapter;
|
|
51
|
+
cursor_mode?: CursorExecutionModeV3;
|
|
52
|
+
context: RuntimeContextCapabilityEvidenceV3;
|
|
53
|
+
canonical_turn_boundaries: boolean;
|
|
54
|
+
independent_wait_completeness?: boolean;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
export type RuntimeTelemetryCapabilitiesV3 = Record<
|
|
58
|
+
RuntimeTelemetryChannelV3,
|
|
59
|
+
RuntimeTelemetryCapabilityObservationV3
|
|
60
|
+
>;
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* Resolve the telemetry support that one runtime session can actually prove.
|
|
64
|
+
*
|
|
65
|
+
* This is deliberately separate from AdapterCapabilityProfileV3. The static
|
|
66
|
+
* profile gates the event contract; this projection describes effective
|
|
67
|
+
* session evidence without moving a genesis-approved digest when a local
|
|
68
|
+
* source is missing, late, or unreadable.
|
|
69
|
+
*/
|
|
70
|
+
export function effectiveRuntimeTelemetryCapabilitiesV3(
|
|
71
|
+
evidence: RuntimeTelemetryCapabilityEvidenceV3,
|
|
72
|
+
): RuntimeTelemetryCapabilitiesV3 {
|
|
73
|
+
return {
|
|
74
|
+
context_usage: contextCapability(evidence.context),
|
|
75
|
+
wait_spans: waitSpanCapability(evidence.adapter, evidence.cursor_mode),
|
|
76
|
+
wait_completeness: evidence.independent_wait_completeness
|
|
77
|
+
? observed("native", "runtime.wait_aggregate", "exact", "native", "exact")
|
|
78
|
+
: unsupported("wait_turn_completeness"),
|
|
79
|
+
response_latency: evidence.canonical_turn_boundaries
|
|
80
|
+
? observed("derived", "canonical.event_clocks", "exact", "derived", "exact")
|
|
81
|
+
: missing("response_latency", "turn_boundaries_not_delivered"),
|
|
82
|
+
inference_timing: unsupported("provider_inference_timing"),
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
function contextCapability(
|
|
87
|
+
evidence: RuntimeContextCapabilityEvidenceV3,
|
|
88
|
+
): RuntimeTelemetryCapabilityObservationV3 {
|
|
89
|
+
if (evidence.state === "observed") {
|
|
90
|
+
return observed(
|
|
91
|
+
evidence.attestation === "native" ? "native" : "derived",
|
|
92
|
+
evidence.source,
|
|
93
|
+
evidence.completeness ?? (evidence.attestation === "inferred" ? "inferred" : "exact"),
|
|
94
|
+
evidence.attestation,
|
|
95
|
+
evidence.confidence,
|
|
96
|
+
);
|
|
97
|
+
}
|
|
98
|
+
if (evidence.state === "partial") {
|
|
99
|
+
return missing("context_usage", evidence.reason);
|
|
100
|
+
}
|
|
101
|
+
return unsupported("context_usage");
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
function waitSpanCapability(
|
|
105
|
+
adapter: Adapter,
|
|
106
|
+
cursorMode: CursorExecutionModeV3 | undefined,
|
|
107
|
+
): RuntimeTelemetryCapabilityObservationV3 {
|
|
108
|
+
if (adapter === "cursor" && cursorMode === "cloud") {
|
|
109
|
+
return unsupported("wait_span_delivery");
|
|
110
|
+
}
|
|
111
|
+
const support = adapterSignalSupportV3(adapter, "permission");
|
|
112
|
+
if (support === "unsupported") return unsupported("wait_span_delivery");
|
|
113
|
+
return observed(
|
|
114
|
+
support,
|
|
115
|
+
adapter === "cursor" ? "cursor.permission_hooks" : `${adapter}.permission_hooks`,
|
|
116
|
+
"lower_bound",
|
|
117
|
+
support === "native" ? "native" : "derived",
|
|
118
|
+
support === "native" ? "exact" : "high",
|
|
119
|
+
);
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
function observed(
|
|
123
|
+
support: Exclude<CapabilitySupportV3, "unsupported">,
|
|
124
|
+
source: string,
|
|
125
|
+
completeness: RuntimeTelemetryCompletenessV3,
|
|
126
|
+
attestation: "native" | "derived" | "inferred",
|
|
127
|
+
confidence: "exact" | "high" | "medium" | "low",
|
|
128
|
+
): RuntimeTelemetryCapabilityObservationV3 {
|
|
129
|
+
return {
|
|
130
|
+
state: "observed",
|
|
131
|
+
value: { support, source, completeness },
|
|
132
|
+
attestation,
|
|
133
|
+
confidence,
|
|
134
|
+
};
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
function missing(capability: string, reason: string): RuntimeTelemetryCapabilityObservationV3 {
|
|
138
|
+
return { state: "expected_but_missing", capability, reason };
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
function unsupported(capability: string): RuntimeTelemetryCapabilityObservationV3 {
|
|
142
|
+
return { state: "unsupported", capability };
|
|
143
|
+
}
|