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
|
@@ -1,25 +1,38 @@
|
|
|
1
|
-
import { createHash } from "node:crypto";
|
|
2
1
|
import type { Adapter } from "../../adapter.ts";
|
|
3
2
|
import type { ParsedPayload } from "../../hooks/adapter/parse.ts";
|
|
3
|
+
import { refreshIncompatibleEventLedgerV3, rotateOversizedEventLedgerV3 } from "./bootstrap.ts";
|
|
4
|
+
import type { EventV3 } from "./contract.ts";
|
|
5
|
+
import { readEventV3ControlState } from "./control.ts";
|
|
6
|
+
import { repairEventV3ControlPair } from "./control-writer.ts";
|
|
4
7
|
import {
|
|
5
|
-
type
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
8
|
+
type LiveEventLedgerRouteV3,
|
|
9
|
+
liveEventLedgerRouteFromControlV3,
|
|
10
|
+
liveInstanceIdV3,
|
|
11
|
+
runtimeCapabilityProfileCurrentV3,
|
|
12
|
+
} from "./live-route-observer.ts";
|
|
9
13
|
import type { HookSignalV3 } from "./producers/hook.ts";
|
|
10
14
|
import type { TurnRitualEvidenceV3 } from "./producers/hook-base.ts";
|
|
11
|
-
import {
|
|
15
|
+
import {
|
|
16
|
+
type ReconcilePendingRuntimeContextV3Result,
|
|
17
|
+
type RecordHookSignalV3Result,
|
|
18
|
+
reconcilePendingRuntimeContextV3,
|
|
19
|
+
recordHookSignalV3,
|
|
20
|
+
} from "./producers/recorder.ts";
|
|
21
|
+
import { livePlatformV3 } from "./runtime-identity.ts";
|
|
22
|
+
|
|
23
|
+
export {
|
|
24
|
+
type LiveEventLedgerRouteV3,
|
|
25
|
+
liveInstanceIdV3,
|
|
26
|
+
nativeInstanceIdV3,
|
|
27
|
+
} from "./live-route-observer.ts";
|
|
28
|
+
export { liveEventV3BuildId, livePlatformV3 } from "./runtime-identity.ts";
|
|
12
29
|
|
|
13
30
|
export const LIVE_HOOK_V3_PRODUCER_ID = "prd_agent-hook" as const;
|
|
14
31
|
export const LIVE_COMMAND_V3_PRODUCER_ID = "prd_session-tee" as const;
|
|
15
32
|
|
|
16
|
-
export type LiveEventLedgerRouteV3 =
|
|
17
|
-
| { state: "v3"; mode: EventV3WriteMode; build_id: `build_${string}` }
|
|
18
|
-
| { state: "blocked"; reason: string };
|
|
19
|
-
|
|
20
33
|
/**
|
|
21
34
|
* Resolve the V3-only ledger route. A root without an initialized V3 control
|
|
22
|
-
* packet is blocked; no producer
|
|
35
|
+
* packet is blocked; no mutating producer may fall back to an older ledger.
|
|
23
36
|
* Manifest-first crashes are repaired from the immutable packet and every
|
|
24
37
|
* other invalid state closes the writer gate.
|
|
25
38
|
*/
|
|
@@ -27,36 +40,32 @@ export function resolveLiveEventLedgerRouteV3(coordRoot: string): LiveEventLedge
|
|
|
27
40
|
let control = readEventV3ControlState(coordRoot);
|
|
28
41
|
if (control.state === "closed") return { state: "blocked", reason: "v3_not_initialized" };
|
|
29
42
|
if (control.state === "repairable") control = repairEventV3ControlPair(coordRoot);
|
|
30
|
-
if (
|
|
31
|
-
|
|
43
|
+
if (
|
|
44
|
+
(control.state === "invalid" && control.reason === "genesis_schema_digest_incompatible") ||
|
|
45
|
+
((control.state === "candidate" || control.state === "active") &&
|
|
46
|
+
!runtimeCapabilityProfileCurrentV3(control))
|
|
47
|
+
) {
|
|
48
|
+
try {
|
|
49
|
+
control = refreshIncompatibleEventLedgerV3(coordRoot).control;
|
|
50
|
+
} catch (error) {
|
|
51
|
+
return {
|
|
52
|
+
state: "blocked",
|
|
53
|
+
reason: `runtime_refresh_failed:${error instanceof Error ? error.message : String(error)}`,
|
|
54
|
+
};
|
|
55
|
+
}
|
|
32
56
|
}
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
57
|
+
if (control.state === "active") {
|
|
58
|
+
// Bound the epoch every producer must re-validate: an oversized active
|
|
59
|
+
// segment rotates into the archive here, on the shared route boundary.
|
|
60
|
+
// Rotation failure never blocks recording; the current epoch stays live.
|
|
61
|
+
try {
|
|
62
|
+
const rotated = rotateOversizedEventLedgerV3(coordRoot);
|
|
63
|
+
if (rotated.state === "rotated" && rotated.control) control = rotated.control;
|
|
64
|
+
} catch {
|
|
65
|
+
// The oversized epoch keeps serving; the next route resolution retries.
|
|
66
|
+
}
|
|
36
67
|
}
|
|
37
|
-
return
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
export function liveEventV3BuildId(harneryCommit: string): `build_${string}` {
|
|
41
|
-
const exact = harneryCommit.normalize("NFC");
|
|
42
|
-
if (/^[a-zA-Z0-9._-]{1,120}$/.test(exact)) return `build_${exact}`;
|
|
43
|
-
return `build_${createHash("sha256").update(exact).digest("hex")}`;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
export function liveInstanceIdV3(instanceId: string): `inst_${string}` {
|
|
47
|
-
if (/^inst_[a-zA-Z0-9._-]{1,128}$/.test(instanceId)) return instanceId as `inst_${string}`;
|
|
48
|
-
if (/^[a-zA-Z0-9._-]{1,128}$/.test(instanceId)) return `inst_${instanceId}`;
|
|
49
|
-
return `inst_${createHash("sha256").update(instanceId.normalize("NFC")).digest("hex")}`;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
/**
|
|
53
|
-
* The adapter-native id a canonical `inst_*` id carries, for display and for
|
|
54
|
-
* joins against native-keyed records. Only the direct prefix form round-trips:
|
|
55
|
-
* a hashed id has no recoverable native form and is returned unchanged, so
|
|
56
|
-
* never treat this as a guaranteed inverse of `liveInstanceIdV3`.
|
|
57
|
-
*/
|
|
58
|
-
export function nativeInstanceIdV3(instanceId: string): string {
|
|
59
|
-
return instanceId.startsWith("inst_") ? instanceId.slice("inst_".length) : instanceId;
|
|
68
|
+
return liveEventLedgerRouteFromControlV3(control);
|
|
60
69
|
}
|
|
61
70
|
|
|
62
71
|
export function hookSignalV3(eventName: string): HookSignalV3 | undefined {
|
|
@@ -84,6 +93,20 @@ export function hookSignalV3(eventName: string): HookSignalV3 | undefined {
|
|
|
84
93
|
}
|
|
85
94
|
}
|
|
86
95
|
|
|
96
|
+
/**
|
|
97
|
+
* Tool lifecycle hooks may stop after publishing their event to the durable
|
|
98
|
+
* ready WAL. The next non-tool hook drains the causal batch into the active
|
|
99
|
+
* ledger, avoiding one global append-lease cycle for every tool boundary.
|
|
100
|
+
*/
|
|
101
|
+
export function liveHookSignalDefersDrainV3(eventName: string, override?: string): boolean {
|
|
102
|
+
if (override === "1") return true;
|
|
103
|
+
if (override === "0") return false;
|
|
104
|
+
const signal = hookSignalV3(eventName);
|
|
105
|
+
return (
|
|
106
|
+
signal === "pre-tool-use" || signal === "post-tool-use" || signal === "post-tool-use-failure"
|
|
107
|
+
);
|
|
108
|
+
}
|
|
109
|
+
|
|
87
110
|
export function recordLiveHookSignalV3(input: {
|
|
88
111
|
coordRoot: string;
|
|
89
112
|
route: Extract<LiveEventLedgerRouteV3, { state: "v3" }>;
|
|
@@ -104,11 +127,27 @@ export function recordLiveHookSignalV3(input: {
|
|
|
104
127
|
}): RecordHookSignalV3Result | { state: "ignored" } {
|
|
105
128
|
const signal = hookSignalV3(input.eventName);
|
|
106
129
|
if (!signal) return { state: "ignored" };
|
|
130
|
+
const nativeChild = input.payload?.subagent_id ?? input.payload?.agent_id;
|
|
131
|
+
const childOwnsSignal =
|
|
132
|
+
signal !== "sub-agent-start" &&
|
|
133
|
+
signal !== "sub-agent-stop" &&
|
|
134
|
+
nativeChild !== undefined &&
|
|
135
|
+
liveInstanceIdV3(input.instanceId) === liveInstanceIdV3(nativeChild);
|
|
136
|
+
const payload = input.payload
|
|
137
|
+
? childOwnsSignal
|
|
138
|
+
? {
|
|
139
|
+
...input.payload,
|
|
140
|
+
session_id: nativeChild,
|
|
141
|
+
conversation_id: undefined,
|
|
142
|
+
parent_session_id: input.payload.session_id ?? input.payload.conversation_id,
|
|
143
|
+
}
|
|
144
|
+
: input.payload
|
|
145
|
+
: { raw: {} };
|
|
107
146
|
return recordHookSignalV3({
|
|
108
147
|
coordRoot: input.coordRoot,
|
|
109
148
|
mode: input.route.mode,
|
|
110
149
|
signal,
|
|
111
|
-
payload
|
|
150
|
+
payload,
|
|
112
151
|
adapter: input.adapter,
|
|
113
152
|
instance_id: liveInstanceIdV3(input.instanceId),
|
|
114
153
|
run_id: input.run_id,
|
|
@@ -127,9 +166,107 @@ export function recordLiveHookSignalV3(input: {
|
|
|
127
166
|
});
|
|
128
167
|
}
|
|
129
168
|
|
|
130
|
-
export function
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
169
|
+
export function reconcileLivePendingRuntimeContextV3(input: {
|
|
170
|
+
coordRoot: string;
|
|
171
|
+
route: Extract<LiveEventLedgerRouteV3, { state: "v3" }>;
|
|
172
|
+
nativeSessionId: string;
|
|
173
|
+
finalAttempt?: boolean;
|
|
174
|
+
}): ReconcilePendingRuntimeContextV3Result {
|
|
175
|
+
return reconcilePendingRuntimeContextV3({
|
|
176
|
+
coordRoot: input.coordRoot,
|
|
177
|
+
mode: input.route.mode,
|
|
178
|
+
nativeSessionId: input.nativeSessionId,
|
|
179
|
+
producer_id: LIVE_HOOK_V3_PRODUCER_ID,
|
|
180
|
+
build_id: input.route.build_id,
|
|
181
|
+
platform: livePlatformV3(),
|
|
182
|
+
finalAttempt: input.finalAttempt,
|
|
183
|
+
});
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
/**
|
|
187
|
+
* Open the child generation named by a native SubagentStart event.
|
|
188
|
+
*
|
|
189
|
+
* The parent producer owns the delegation span and mints its child generation
|
|
190
|
+
* id. This second crash-safe session-start gives that exact generation its own
|
|
191
|
+
* producer authority, so later child tool hooks can resolve away from the
|
|
192
|
+
* parent session and the disposable heartbeat projection has a real source.
|
|
193
|
+
*/
|
|
194
|
+
export function recordLiveDelegatedChildSessionV3(input: {
|
|
195
|
+
coordRoot: string;
|
|
196
|
+
route: Extract<LiveEventLedgerRouteV3, { state: "v3" }>;
|
|
197
|
+
parentEvent: Extract<EventV3, { event_type: "agent.started" }>;
|
|
198
|
+
payload: ParsedPayload;
|
|
199
|
+
adapter: Adapter;
|
|
200
|
+
bridge?: "codex-wsl";
|
|
201
|
+
monotonic_ns?: string;
|
|
202
|
+
}): RecordHookSignalV3Result | { state: "ignored" } {
|
|
203
|
+
const nativeChild = input.payload.subagent_id ?? input.payload.agent_id;
|
|
204
|
+
if (!nativeChild) return { state: "ignored" };
|
|
205
|
+
const parentGeneration = (input.parentEvent.links as { parent_generation_id?: `gen_${string}` })
|
|
206
|
+
.parent_generation_id;
|
|
207
|
+
if (!parentGeneration) return { state: "ignored" };
|
|
208
|
+
const nativeParent = input.payload.session_id ?? input.payload.conversation_id;
|
|
209
|
+
const childPayload: ParsedPayload = {
|
|
210
|
+
session_id: nativeChild,
|
|
211
|
+
agent_id: nativeChild,
|
|
212
|
+
parent_session_id: nativeParent,
|
|
213
|
+
source: "startup",
|
|
214
|
+
model: input.payload.model,
|
|
215
|
+
cwd: input.payload.cwd,
|
|
216
|
+
raw: {
|
|
217
|
+
session_id: nativeChild,
|
|
218
|
+
agent_id: nativeChild,
|
|
219
|
+
...(nativeParent ? { parent_session_id: nativeParent } : {}),
|
|
220
|
+
...(input.payload.raw.agent_type ? { agent_type: input.payload.raw.agent_type } : {}),
|
|
221
|
+
},
|
|
222
|
+
};
|
|
223
|
+
const started = recordHookSignalV3({
|
|
224
|
+
coordRoot: input.coordRoot,
|
|
225
|
+
mode: input.route.mode,
|
|
226
|
+
signal: "session-start",
|
|
227
|
+
payload: childPayload,
|
|
228
|
+
adapter: input.adapter,
|
|
229
|
+
instance_id: liveInstanceIdV3(nativeChild),
|
|
230
|
+
producer_id: LIVE_HOOK_V3_PRODUCER_ID,
|
|
231
|
+
build_id: input.route.build_id,
|
|
232
|
+
platform: livePlatformV3(),
|
|
233
|
+
...(input.bridge ? { bridge: input.bridge } : {}),
|
|
234
|
+
monotonic_ns: input.monotonic_ns,
|
|
235
|
+
hook_name: "sub-agent-start-child-session",
|
|
236
|
+
delegated_child: {
|
|
237
|
+
generation_id: input.parentEvent.payload.child_generation_id as `gen_${string}`,
|
|
238
|
+
parent_generation_id: parentGeneration,
|
|
239
|
+
delegation_id: input.parentEvent.payload.delegation_id as `del_${string}`,
|
|
240
|
+
caused_by_event_id: input.parentEvent.event_id as `evt_${string}`,
|
|
241
|
+
},
|
|
242
|
+
});
|
|
243
|
+
if (started.state !== "recorded" && started.state !== "already_started") return started;
|
|
244
|
+
const childStartEventId = (
|
|
245
|
+
started.state === "recorded" ? started.event.event_id : started.event_id
|
|
246
|
+
) as `evt_${string}`;
|
|
247
|
+
recordHookSignalV3({
|
|
248
|
+
coordRoot: input.coordRoot,
|
|
249
|
+
mode: input.route.mode,
|
|
250
|
+
signal: "user-prompt-submit",
|
|
251
|
+
payload: {
|
|
252
|
+
...childPayload,
|
|
253
|
+
turn_id: `delegated:${nativeChild}`,
|
|
254
|
+
raw: { ...childPayload.raw, turn_id: `delegated:${nativeChild}` },
|
|
255
|
+
},
|
|
256
|
+
adapter: input.adapter,
|
|
257
|
+
instance_id: liveInstanceIdV3(nativeChild),
|
|
258
|
+
producer_id: LIVE_HOOK_V3_PRODUCER_ID,
|
|
259
|
+
build_id: input.route.build_id,
|
|
260
|
+
platform: livePlatformV3(),
|
|
261
|
+
...(input.bridge ? { bridge: input.bridge } : {}),
|
|
262
|
+
monotonic_ns: input.monotonic_ns,
|
|
263
|
+
hook_name: "sub-agent-start-child-turn",
|
|
264
|
+
delegated_child: {
|
|
265
|
+
generation_id: input.parentEvent.payload.child_generation_id as `gen_${string}`,
|
|
266
|
+
parent_generation_id: parentGeneration,
|
|
267
|
+
delegation_id: input.parentEvent.payload.delegation_id as `del_${string}`,
|
|
268
|
+
caused_by_event_id: childStartEventId,
|
|
269
|
+
},
|
|
270
|
+
});
|
|
271
|
+
return started;
|
|
135
272
|
}
|
|
@@ -141,6 +141,14 @@ export function recordCommandSignalV3(
|
|
|
141
141
|
if (state && !matchesHookState(state, hook, input, epochId)) {
|
|
142
142
|
throw new Error("V3 command producer state does not match the joined hook generation");
|
|
143
143
|
}
|
|
144
|
+
if (state && state.attestation_id !== hook.attestation_id) {
|
|
145
|
+
// A mid-generation re-attestation (session.attestation_changed) moves
|
|
146
|
+
// the hook's attestation id without opening a new generation or turn. A
|
|
147
|
+
// command span that straddles the change keeps its span, sequence, and
|
|
148
|
+
// dedupe state; later events ride the live attestation, the same
|
|
149
|
+
// in-place adoption the hook producer performs.
|
|
150
|
+
state.attestation_id = hook.attestation_id;
|
|
151
|
+
}
|
|
144
152
|
let recovered = false;
|
|
145
153
|
if (state?.pending) {
|
|
146
154
|
const pending = state.pending;
|
|
@@ -445,7 +453,8 @@ function matchesHookState(
|
|
|
445
453
|
state.session_id === hook.session_id &&
|
|
446
454
|
state.generation_id === hook.generation_id &&
|
|
447
455
|
state.turn_id === hook.current_turn_id &&
|
|
448
|
-
|
|
456
|
+
// attestation_id is deliberately absent: a re-attestation within the
|
|
457
|
+
// generation is a continuation, adopted by the caller, not a mismatch.
|
|
449
458
|
state.privacy_epoch_id === epochId
|
|
450
459
|
);
|
|
451
460
|
}
|
|
@@ -6,6 +6,7 @@ import {
|
|
|
6
6
|
fsyncSync,
|
|
7
7
|
mkdirSync,
|
|
8
8
|
openSync,
|
|
9
|
+
readdirSync,
|
|
9
10
|
readFileSync,
|
|
10
11
|
renameSync,
|
|
11
12
|
statSync,
|
|
@@ -13,7 +14,7 @@ import {
|
|
|
13
14
|
writeFileSync,
|
|
14
15
|
} from "node:fs";
|
|
15
16
|
import { hostname } from "node:os";
|
|
16
|
-
import { join, resolve } from "node:path";
|
|
17
|
+
import { basename, join, resolve } from "node:path";
|
|
17
18
|
import type { Adapter } from "../../../adapter.ts";
|
|
18
19
|
import { fsyncParentDirectory } from "../../../workflow/durable-record.ts";
|
|
19
20
|
import { acquireNoClobberLease } from "../../../workflow/workspaces/leases.ts";
|
|
@@ -21,6 +22,7 @@ import {
|
|
|
21
22
|
type AuthorityReceiptV3,
|
|
22
23
|
type AuthorityReconcilerV3,
|
|
23
24
|
type AuthorityTransactionV3,
|
|
25
|
+
authorityRecoveryIntentPathV3,
|
|
24
26
|
buildAuthorityTransactionV3,
|
|
25
27
|
publishAuthorityTransactionV3,
|
|
26
28
|
reconcileAuthorityTransactionV3,
|
|
@@ -38,7 +40,7 @@ import {
|
|
|
38
40
|
type CoordinationObservationBySignalV3,
|
|
39
41
|
normalizeCoordinationAuthorityV3,
|
|
40
42
|
} from "./coordination.ts";
|
|
41
|
-
import {
|
|
43
|
+
import { readJoinableHookProducerStateV3 } from "./recorder.ts";
|
|
42
44
|
|
|
43
45
|
const COORDINATION_STATE_FORMAT = "harnery-v3-coordination-producer" as const;
|
|
44
46
|
const COORDINATION_STATE_VERSION = 2 as const;
|
|
@@ -78,6 +80,11 @@ interface CoordinationRecorderStateV3 {
|
|
|
78
80
|
pending?: PendingCoordinationTransactionV3;
|
|
79
81
|
}
|
|
80
82
|
|
|
83
|
+
export interface PendingCoordinationTransactionV3Location {
|
|
84
|
+
producer_state_file: string;
|
|
85
|
+
transaction: AuthorityTransactionV3;
|
|
86
|
+
}
|
|
87
|
+
|
|
81
88
|
export interface RecordCoordinationAuthorityV3Input<
|
|
82
89
|
S extends CoordinationAuthoritySignalV3 = CoordinationAuthoritySignalV3,
|
|
83
90
|
> {
|
|
@@ -124,10 +131,11 @@ export function recordCoordinationAuthorityV3<S extends CoordinationAuthoritySig
|
|
|
124
131
|
): RecordCoordinationAuthorityV3Result {
|
|
125
132
|
const control = readEventV3ControlState(input.coordRoot);
|
|
126
133
|
if (control.state !== input.mode) return { state: "gate_closed", reason: control.state };
|
|
127
|
-
const hook =
|
|
134
|
+
const hook = readJoinableHookProducerStateV3(
|
|
128
135
|
input.coordRoot,
|
|
129
136
|
input.adapter,
|
|
130
137
|
input.native_actor_session_id,
|
|
138
|
+
input.actor_instance_id,
|
|
131
139
|
);
|
|
132
140
|
if (
|
|
133
141
|
!hook ||
|
|
@@ -140,6 +148,9 @@ export function recordCoordinationAuthorityV3<S extends CoordinationAuthoritySig
|
|
|
140
148
|
|
|
141
149
|
const rootId = control.genesis.event.scope.root_id as `root_${string}`;
|
|
142
150
|
const epochId = control.genesis.profile.privacy_key_epoch;
|
|
151
|
+
const epochFence = {
|
|
152
|
+
expectedGenesisId: control.genesis.event.payload.genesis_id as `gex_${string}`,
|
|
153
|
+
};
|
|
143
154
|
const rootContext = fingerprintContextV3(input.coordRoot, rootId, undefined, epochId);
|
|
144
155
|
const producerSource = normalizeNativeIdV3(
|
|
145
156
|
rootContext,
|
|
@@ -158,7 +169,28 @@ export function recordCoordinationAuthorityV3<S extends CoordinationAuthoritySig
|
|
|
158
169
|
if (state && !matchesHookState(state, hook, input, epochId)) {
|
|
159
170
|
throw new Error("V3 coordination producer state does not match the joined hook generation");
|
|
160
171
|
}
|
|
172
|
+
if (state && state.attestation_id !== hook.attestation_id) {
|
|
173
|
+
// A mid-generation re-attestation (session.attestation_changed) moves
|
|
174
|
+
// the hook's attestation id without opening a new generation. The
|
|
175
|
+
// producer keeps its one continuous sequence, clock, and observation
|
|
176
|
+
// dedupe for the generation and stamps later events with the live
|
|
177
|
+
// attestation — the same in-place adoption the hook producer performs.
|
|
178
|
+
// Refusing here would wedge the producer forever, since its state path
|
|
179
|
+
// is derived from the generation alone and can never be superseded.
|
|
180
|
+
state.attestation_id = hook.attestation_id;
|
|
181
|
+
}
|
|
161
182
|
if (state?.pending) {
|
|
183
|
+
if (
|
|
184
|
+
existsSync(
|
|
185
|
+
authorityRecoveryIntentPathV3(input.coordRoot, state.pending.transaction.transaction_id),
|
|
186
|
+
)
|
|
187
|
+
) {
|
|
188
|
+
return {
|
|
189
|
+
state: "pending_transaction",
|
|
190
|
+
transaction_id: state.pending.transaction.transaction_id,
|
|
191
|
+
mutation_kind: state.pending.transaction.mutation.kind,
|
|
192
|
+
};
|
|
193
|
+
}
|
|
162
194
|
if (state.pending.source_id !== sourceId) {
|
|
163
195
|
// A writer that died mid-commit leaves `pending` owned by an
|
|
164
196
|
// observation that will never retry (hook observations are one-shot).
|
|
@@ -169,11 +201,12 @@ export function recordCoordinationAuthorityV3<S extends CoordinationAuthoritySig
|
|
|
169
201
|
// still refuses rather than guessing at a conflicting mutation.
|
|
170
202
|
const stale = state.pending;
|
|
171
203
|
try {
|
|
172
|
-
publishAuthorityTransactionV3(input.coordRoot, stale.transaction);
|
|
204
|
+
publishAuthorityTransactionV3(input.coordRoot, stale.transaction, epochFence);
|
|
173
205
|
reconcileAuthorityTransactionV3(
|
|
174
206
|
input.coordRoot,
|
|
175
207
|
stale.transaction.transaction_id,
|
|
176
208
|
input.reconciler,
|
|
209
|
+
epochFence,
|
|
177
210
|
);
|
|
178
211
|
} catch {
|
|
179
212
|
return {
|
|
@@ -192,11 +225,12 @@ export function recordCoordinationAuthorityV3<S extends CoordinationAuthoritySig
|
|
|
192
225
|
publishCoordinationState(path, state);
|
|
193
226
|
} else {
|
|
194
227
|
const pending = state.pending;
|
|
195
|
-
publishAuthorityTransactionV3(input.coordRoot, pending.transaction);
|
|
228
|
+
publishAuthorityTransactionV3(input.coordRoot, pending.transaction, epochFence);
|
|
196
229
|
const receipt = reconcileAuthorityTransactionV3(
|
|
197
230
|
input.coordRoot,
|
|
198
231
|
pending.transaction.transaction_id,
|
|
199
232
|
input.reconciler,
|
|
233
|
+
epochFence,
|
|
200
234
|
);
|
|
201
235
|
const event = eventFromTransaction(pending.transaction);
|
|
202
236
|
applyCoordinationEvent(state, pending.source_id, pending.transaction, event);
|
|
@@ -296,11 +330,12 @@ export function recordCoordinationAuthorityV3<S extends CoordinationAuthoritySig
|
|
|
296
330
|
if (input.signal === "wait-ended" && waitId) delete state.open_waits[waitId];
|
|
297
331
|
state.pending = { source_id: sourceId, transaction };
|
|
298
332
|
publishCoordinationState(path, state);
|
|
299
|
-
publishAuthorityTransactionV3(input.coordRoot, transaction);
|
|
333
|
+
publishAuthorityTransactionV3(input.coordRoot, transaction, epochFence);
|
|
300
334
|
const receipt = reconcileAuthorityTransactionV3(
|
|
301
335
|
input.coordRoot,
|
|
302
336
|
transaction.transaction_id,
|
|
303
337
|
input.reconciler,
|
|
338
|
+
epochFence,
|
|
304
339
|
);
|
|
305
340
|
applyCoordinationEvent(state, sourceId, transaction, normalized.event);
|
|
306
341
|
state.pending = undefined;
|
|
@@ -311,9 +346,71 @@ export function recordCoordinationAuthorityV3<S extends CoordinationAuthoritySig
|
|
|
311
346
|
}
|
|
312
347
|
}
|
|
313
348
|
|
|
349
|
+
/** Locate the one private producer state that owns a pending authority transaction. */
|
|
350
|
+
export function findPendingCoordinationTransactionV3(
|
|
351
|
+
coordRoot: string,
|
|
352
|
+
transactionId: string,
|
|
353
|
+
): PendingCoordinationTransactionV3Location | null {
|
|
354
|
+
const directory = coordinationProducerDirectory(coordRoot);
|
|
355
|
+
if (!existsSync(directory)) return null;
|
|
356
|
+
const matches = readdirSync(directory)
|
|
357
|
+
.filter((name) => /^hid_[a-f0-9]{64}\.json$/.test(name))
|
|
358
|
+
.sort()
|
|
359
|
+
.flatMap((name) => {
|
|
360
|
+
const state = readCoordinationState(join(directory, name));
|
|
361
|
+
return state.pending?.transaction.transaction_id === transactionId
|
|
362
|
+
? [{ producer_state_file: name, transaction: state.pending.transaction }]
|
|
363
|
+
: [];
|
|
364
|
+
});
|
|
365
|
+
if (matches.length > 1) {
|
|
366
|
+
throw new Error("authority transaction is pending in more than one coordination producer");
|
|
367
|
+
}
|
|
368
|
+
return matches[0] ?? null;
|
|
369
|
+
}
|
|
370
|
+
|
|
371
|
+
/** Clear one transaction from its exact producer state after durable quarantine is established. */
|
|
372
|
+
export function withPendingCoordinationTransactionRecoveryV3<T>(
|
|
373
|
+
coordRoot: string,
|
|
374
|
+
producerStateFile: string,
|
|
375
|
+
transaction: AuthorityTransactionV3,
|
|
376
|
+
allowAlreadyCleared: boolean,
|
|
377
|
+
operation: (control: { clearPending: () => "cleared" | "already_cleared" }) => T,
|
|
378
|
+
): T {
|
|
379
|
+
if (!/^hid_[a-f0-9]{64}\.json$/.test(producerStateFile)) {
|
|
380
|
+
throw new Error("coordination producer state file is invalid");
|
|
381
|
+
}
|
|
382
|
+
const path = join(coordinationProducerDirectory(coordRoot), basename(producerStateFile));
|
|
383
|
+
if (!existsSync(path)) throw new Error("coordination producer state is missing");
|
|
384
|
+
const lease = acquireCoordinationLease(coordRoot, path);
|
|
385
|
+
try {
|
|
386
|
+
const state = readCoordinationState(path);
|
|
387
|
+
if (!state.pending && !allowAlreadyCleared) {
|
|
388
|
+
throw new Error("coordination producer no longer owns the pending transaction");
|
|
389
|
+
}
|
|
390
|
+
if (state.pending) {
|
|
391
|
+
if (
|
|
392
|
+
state.pending.transaction.transaction_id !== transaction.transaction_id ||
|
|
393
|
+
canonicalJsonV3(state.pending.transaction) !== canonicalJsonV3(transaction)
|
|
394
|
+
) {
|
|
395
|
+
throw new Error("coordination producer pending transaction changed during recovery");
|
|
396
|
+
}
|
|
397
|
+
}
|
|
398
|
+
return operation({
|
|
399
|
+
clearPending: () => {
|
|
400
|
+
if (!state.pending) return "already_cleared";
|
|
401
|
+
state.pending = undefined;
|
|
402
|
+
publishCoordinationState(path, state);
|
|
403
|
+
return "cleared";
|
|
404
|
+
},
|
|
405
|
+
});
|
|
406
|
+
} finally {
|
|
407
|
+
lease.release();
|
|
408
|
+
}
|
|
409
|
+
}
|
|
410
|
+
|
|
314
411
|
function newCoordinationState<S extends CoordinationAuthoritySignalV3>(
|
|
315
412
|
input: RecordCoordinationAuthorityV3Input<S>,
|
|
316
|
-
hook: NonNullable<ReturnType<typeof
|
|
413
|
+
hook: NonNullable<ReturnType<typeof readJoinableHookProducerStateV3>>,
|
|
317
414
|
epochId: `pep_${string}`,
|
|
318
415
|
): CoordinationRecorderStateV3 {
|
|
319
416
|
return {
|
|
@@ -340,7 +437,7 @@ function newCoordinationState<S extends CoordinationAuthoritySignalV3>(
|
|
|
340
437
|
|
|
341
438
|
function matchesHookState<S extends CoordinationAuthoritySignalV3>(
|
|
342
439
|
state: CoordinationRecorderStateV3,
|
|
343
|
-
hook: NonNullable<ReturnType<typeof
|
|
440
|
+
hook: NonNullable<ReturnType<typeof readJoinableHookProducerStateV3>>,
|
|
344
441
|
input: RecordCoordinationAuthorityV3Input<S>,
|
|
345
442
|
epochId: string,
|
|
346
443
|
): boolean {
|
|
@@ -349,7 +446,8 @@ function matchesHookState<S extends CoordinationAuthoritySignalV3>(
|
|
|
349
446
|
state.actor_instance_id === input.actor_instance_id &&
|
|
350
447
|
state.session_id === hook.session_id &&
|
|
351
448
|
state.generation_id === hook.generation_id &&
|
|
352
|
-
|
|
449
|
+
// attestation_id is deliberately absent: a re-attestation within the
|
|
450
|
+
// generation is a continuation, adopted by the caller, not a mismatch.
|
|
353
451
|
state.privacy_epoch_id === epochId &&
|
|
354
452
|
state.producer_id === input.producer_id &&
|
|
355
453
|
state.build_id === input.build_id &&
|
|
@@ -380,12 +478,11 @@ function eventFromTransaction(transaction: AuthorityTransactionV3): EventV3 {
|
|
|
380
478
|
}
|
|
381
479
|
|
|
382
480
|
function coordinationStatePath(coordRoot: string, producerSource: `hid_${string}`): string {
|
|
383
|
-
return join(
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
);
|
|
481
|
+
return join(coordinationProducerDirectory(coordRoot), `${producerSource}.json`);
|
|
482
|
+
}
|
|
483
|
+
|
|
484
|
+
function coordinationProducerDirectory(coordRoot: string): string {
|
|
485
|
+
return join(resolve(coordRoot), EVENT_V3_LEDGER_RELATIVE_ROOT, "private-producers/agent-coord");
|
|
389
486
|
}
|
|
390
487
|
|
|
391
488
|
function acquireCoordinationLease(coordRoot: string, statePath: string) {
|