harnery 0.35.0 → 0.37.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/commander.d.ts +30 -5
- package/dist/commander.d.ts.map +1 -1
- package/dist/commander.js +128 -96
- package/dist/commands/agents.d.ts +23 -3
- package/dist/commands/agents.d.ts.map +1 -1
- package/dist/commands/agents.js +464 -242
- package/dist/commands/artifacts.d.ts.map +1 -1
- package/dist/commands/artifacts.js +26 -1
- package/dist/commands/backup.d.ts.map +1 -1
- package/dist/commands/backup.js +10 -10
- package/dist/commands/browse-session.d.ts.map +1 -1
- package/dist/commands/browse-session.js +12 -0
- package/dist/commands/browse.d.ts +1 -1
- package/dist/commands/browse.d.ts.map +1 -1
- package/dist/commands/browse.js +16 -4
- package/dist/commands/conversations.d.ts +10 -0
- package/dist/commands/conversations.d.ts.map +1 -0
- package/dist/commands/conversations.js +201 -0
- package/dist/commands/deinit.d.ts.map +1 -1
- package/dist/commands/deinit.js +5 -0
- package/dist/commands/diagnostics.d.ts +4 -0
- package/dist/commands/diagnostics.d.ts.map +1 -0
- package/dist/commands/diagnostics.js +229 -0
- package/dist/commands/docs.d.ts.map +1 -1
- package/dist/commands/docs.js +13 -2
- package/dist/commands/doctor.d.ts +5 -0
- package/dist/commands/doctor.d.ts.map +1 -1
- package/dist/commands/doctor.js +51 -7
- package/dist/commands/fetch.js +6 -5
- package/dist/commands/files.d.ts +34 -0
- package/dist/commands/files.d.ts.map +1 -0
- package/dist/commands/files.js +166 -0
- package/dist/commands/governor.d.ts.map +1 -1
- package/dist/commands/governor.js +18 -12
- package/dist/commands/inbox.d.ts +5 -0
- package/dist/commands/inbox.d.ts.map +1 -0
- package/dist/commands/inbox.js +57 -0
- package/dist/commands/init.d.ts +4 -5
- package/dist/commands/init.d.ts.map +1 -1
- package/dist/commands/init.js +63 -13
- package/dist/commands/ledger-v3.d.ts.map +1 -1
- package/dist/commands/ledger-v3.js +417 -2
- package/dist/commands/logs.d.ts +4 -0
- package/dist/commands/logs.d.ts.map +1 -0
- package/dist/commands/logs.js +169 -0
- package/dist/commands/messages.d.ts +5 -0
- package/dist/commands/messages.d.ts.map +1 -0
- package/dist/commands/messages.js +45 -0
- package/dist/commands/outline.d.ts +1 -1
- package/dist/commands/outline.d.ts.map +1 -1
- package/dist/commands/outline.js +2 -2
- package/dist/commands/qa-run.d.ts +4 -0
- package/dist/commands/qa-run.d.ts.map +1 -0
- package/dist/commands/qa-run.js +141 -0
- package/dist/commands/read.d.ts +1 -1
- package/dist/commands/read.d.ts.map +1 -1
- package/dist/commands/read.js +2 -2
- package/dist/commands/resources.d.ts +4 -0
- package/dist/commands/resources.d.ts.map +1 -0
- package/dist/commands/resources.js +29 -0
- package/dist/commands/semantic.d.ts.map +1 -1
- package/dist/commands/semantic.js +54 -2
- package/dist/commands/storage.d.ts +4 -0
- package/dist/commands/storage.d.ts.map +1 -0
- package/dist/commands/storage.js +238 -0
- package/dist/commands/supervisor.d.ts +4 -0
- package/dist/commands/supervisor.d.ts.map +1 -0
- package/dist/commands/supervisor.js +101 -0
- package/dist/commands/tunnel.d.ts +5 -1
- package/dist/commands/tunnel.d.ts.map +1 -1
- package/dist/commands/tunnel.js +44 -31
- package/dist/commands/web.d.ts +3 -0
- package/dist/commands/web.d.ts.map +1 -1
- package/dist/commands/web.js +84 -7
- package/dist/commands/work.js +3 -3
- package/dist/commands/workflow.d.ts.map +1 -1
- package/dist/commands/workflow.js +17 -13
- package/dist/core/adapters/profiles.d.ts +1 -1
- package/dist/core/agents/cli.js +215 -41
- package/dist/core/agents/health.d.ts +17 -0
- package/dist/core/agents/health.d.ts.map +1 -0
- package/dist/core/agents/health.js +109 -0
- package/dist/core/agents/live-authority-v3.d.ts +47 -1
- package/dist/core/agents/live-authority-v3.d.ts.map +1 -1
- package/dist/core/agents/live-authority-v3.js +244 -10
- package/dist/core/agents/live-lifecycle-v3.js +6 -1
- package/dist/core/agents/live-observation-v3.d.ts.map +1 -1
- package/dist/core/agents/live-observation-v3.js +6 -1
- package/dist/core/agents/mailbox.d.ts +92 -0
- package/dist/core/agents/mailbox.d.ts.map +1 -0
- package/dist/core/agents/mailbox.js +325 -0
- package/dist/core/agents/reconcile-coordination-v3.d.ts +44 -0
- package/dist/core/agents/reconcile-coordination-v3.d.ts.map +1 -0
- package/dist/core/agents/reconcile-coordination-v3.js +58 -0
- package/dist/core/agents/render/prompt-context.d.ts +14 -3
- package/dist/core/agents/render/prompt-context.d.ts.map +1 -1
- package/dist/core/agents/render/prompt-context.js +54 -16
- package/dist/core/agents/render/session-context.d.ts +8 -0
- package/dist/core/agents/render/session-context.d.ts.map +1 -1
- package/dist/core/agents/render/session-context.js +34 -3
- package/dist/core/agents/rules/commit-conflict.d.ts.map +1 -1
- package/dist/core/agents/rules/commit-conflict.js +50 -1
- package/dist/core/agents/rules/stop-hook.d.ts +2 -0
- package/dist/core/agents/rules/stop-hook.d.ts.map +1 -1
- package/dist/core/agents/rules/stop-hook.js +93 -16
- package/dist/core/agents/rules/verdict.d.ts +1 -0
- package/dist/core/agents/rules/verdict.d.ts.map +1 -1
- package/dist/core/agents/session-events.d.ts.map +1 -1
- package/dist/core/agents/session-events.js +4 -0
- package/dist/core/agents/session-finalization-state-v3.js +1 -1
- package/dist/core/agents/session-finalizer-v3.js +9 -2
- package/dist/core/agents/state/activity-log.d.ts +3 -0
- package/dist/core/agents/state/activity-log.d.ts.map +1 -1
- package/dist/core/agents/state/activity-log.js +6 -3
- package/dist/core/agents/state/heartbeat-writer.d.ts +6 -0
- package/dist/core/agents/state/heartbeat-writer.d.ts.map +1 -1
- package/dist/core/agents/state/heartbeat-writer.js +18 -0
- package/dist/core/agents/state/live-coordination-view.d.ts +5 -7
- package/dist/core/agents/state/live-coordination-view.d.ts.map +1 -1
- package/dist/core/agents/state/live-coordination-view.js +15 -90
- package/dist/core/agents/state/live-coordination-writer.d.ts +12 -0
- package/dist/core/agents/state/live-coordination-writer.d.ts.map +1 -0
- package/dist/core/agents/state/live-coordination-writer.js +92 -0
- package/dist/core/artifacts/index.d.ts +47 -1
- package/dist/core/artifacts/index.d.ts.map +1 -1
- package/dist/core/artifacts/index.js +191 -6
- package/dist/core/config.d.ts +74 -4
- package/dist/core/config.d.ts.map +1 -1
- package/dist/core/config.js +141 -4
- package/dist/core/conversations/archive.d.ts +49 -0
- package/dist/core/conversations/archive.d.ts.map +1 -0
- package/dist/core/conversations/archive.js +136 -0
- package/dist/core/conversations/catalog.d.ts +10 -0
- package/dist/core/conversations/catalog.d.ts.map +1 -0
- package/dist/core/conversations/catalog.js +72 -0
- package/dist/core/conversations/context-pack.d.ts +6 -0
- package/dist/core/conversations/context-pack.d.ts.map +1 -0
- package/dist/core/conversations/context-pack.js +60 -0
- package/dist/core/conversations/contract.d.ts +155 -0
- package/dist/core/conversations/contract.d.ts.map +1 -0
- package/dist/core/conversations/contract.js +1 -0
- package/dist/core/conversations/evaluation.d.ts +16 -0
- package/dist/core/conversations/evaluation.d.ts.map +1 -0
- package/dist/core/conversations/evaluation.js +9 -0
- package/dist/core/conversations/index.d.ts +10 -0
- package/dist/core/conversations/index.d.ts.map +1 -0
- package/dist/core/conversations/index.js +9 -0
- package/dist/core/conversations/lifecycle.d.ts +28 -0
- package/dist/core/conversations/lifecycle.d.ts.map +1 -0
- package/dist/core/conversations/lifecycle.js +29 -0
- package/dist/core/conversations/normalize.d.ts +14 -0
- package/dist/core/conversations/normalize.d.ts.map +1 -0
- package/dist/core/conversations/normalize.js +82 -0
- package/dist/core/conversations/query.d.ts +8 -0
- package/dist/core/conversations/query.d.ts.map +1 -0
- package/dist/core/conversations/query.js +280 -0
- package/dist/core/conversations/search-index.d.ts +9 -0
- package/dist/core/conversations/search-index.d.ts.map +1 -0
- package/dist/core/conversations/search-index.js +29 -0
- package/dist/core/diagnostics/advice.d.ts +9 -0
- package/dist/core/diagnostics/advice.d.ts.map +1 -0
- package/dist/core/diagnostics/advice.js +112 -0
- package/dist/core/diagnostics/bundle.d.ts +35 -0
- package/dist/core/diagnostics/bundle.d.ts.map +1 -0
- package/dist/core/diagnostics/bundle.js +874 -0
- package/dist/core/diagnostics/comparison.d.ts +5 -0
- package/dist/core/diagnostics/comparison.d.ts.map +1 -0
- package/dist/core/diagnostics/comparison.js +444 -0
- package/dist/core/diagnostics/contract.d.ts +245 -0
- package/dist/core/diagnostics/contract.d.ts.map +1 -0
- package/dist/core/diagnostics/contract.js +18 -0
- package/dist/core/diagnostics/identity.d.ts +3 -0
- package/dist/core/diagnostics/identity.d.ts.map +1 -0
- package/dist/core/diagnostics/identity.js +10 -0
- package/dist/core/diagnostics/index.d.ts +8 -0
- package/dist/core/diagnostics/index.d.ts.map +1 -0
- package/dist/core/diagnostics/index.js +7 -0
- package/dist/core/diagnostics/replay.d.ts +8 -0
- package/dist/core/diagnostics/replay.d.ts.map +1 -0
- package/dist/core/diagnostics/replay.js +213 -0
- package/dist/core/diagnostics/sanitize.d.ts +9 -0
- package/dist/core/diagnostics/sanitize.d.ts.map +1 -0
- package/dist/core/diagnostics/sanitize.js +84 -0
- package/dist/core/events/legacy-storage/canary.d.ts +18 -0
- package/dist/core/events/legacy-storage/canary.d.ts.map +1 -0
- package/dist/core/events/legacy-storage/canary.js +150 -0
- package/dist/core/events/legacy-storage/compression.d.ts +13 -0
- package/dist/core/events/legacy-storage/compression.d.ts.map +1 -0
- package/dist/core/events/legacy-storage/compression.js +107 -0
- package/dist/core/events/legacy-storage/fence.d.ts +15 -0
- package/dist/core/events/legacy-storage/fence.d.ts.map +1 -0
- package/dist/core/events/legacy-storage/fence.js +115 -0
- package/dist/core/events/legacy-storage/index.d.ts +7 -0
- package/dist/core/events/legacy-storage/index.d.ts.map +1 -0
- package/dist/core/events/legacy-storage/index.js +6 -0
- package/dist/core/events/legacy-storage/inventory.d.ts +10 -0
- package/dist/core/events/legacy-storage/inventory.d.ts.map +1 -0
- package/dist/core/events/legacy-storage/inventory.js +40 -0
- package/dist/core/events/legacy-storage/manifest.d.ts +23 -0
- package/dist/core/events/legacy-storage/manifest.d.ts.map +1 -0
- package/dist/core/events/legacy-storage/manifest.js +108 -0
- package/dist/core/events/legacy-storage/reader.d.ts +15 -0
- package/dist/core/events/legacy-storage/reader.d.ts.map +1 -0
- package/dist/core/events/legacy-storage/reader.js +154 -0
- package/dist/core/events/v3/archive-retention.d.ts +33 -0
- package/dist/core/events/v3/archive-retention.d.ts.map +1 -0
- package/dist/core/events/v3/archive-retention.js +195 -0
- package/dist/core/events/v3/authority-outbox.d.ts +7 -2
- package/dist/core/events/v3/authority-outbox.d.ts.map +1 -1
- package/dist/core/events/v3/authority-outbox.js +16 -3
- package/dist/core/events/v3/base-contract.d.ts +81 -41
- package/dist/core/events/v3/base-contract.d.ts.map +1 -1
- package/dist/core/events/v3/base-contract.js +17 -7
- package/dist/core/events/v3/bootstrap.d.ts +39 -0
- package/dist/core/events/v3/bootstrap.d.ts.map +1 -1
- package/dist/core/events/v3/bootstrap.js +167 -3
- package/dist/core/events/v3/capabilities.d.ts +1 -1
- package/dist/core/events/v3/capabilities.d.ts.map +1 -1
- package/dist/core/events/v3/capabilities.js +4 -3
- package/dist/core/events/v3/control-witness.d.ts +44 -0
- package/dist/core/events/v3/control-witness.d.ts.map +1 -0
- package/dist/core/events/v3/control-witness.js +233 -0
- package/dist/core/events/v3/control-writer.d.ts +4 -0
- package/dist/core/events/v3/control-writer.d.ts.map +1 -0
- package/dist/core/events/v3/control-writer.js +16 -0
- package/dist/core/events/v3/control.d.ts +8 -2
- package/dist/core/events/v3/control.d.ts.map +1 -1
- package/dist/core/events/v3/control.js +46 -18
- package/dist/core/events/v3/coordination-transaction-recovery.d.ts +42 -0
- package/dist/core/events/v3/coordination-transaction-recovery.d.ts.map +1 -0
- package/dist/core/events/v3/coordination-transaction-recovery.js +342 -0
- package/dist/core/events/v3/coordination-view.d.ts.map +1 -1
- package/dist/core/events/v3/coordination-view.js +16 -1
- package/dist/core/events/v3/generated.d.ts +1 -1
- package/dist/core/events/v3/generated.js +1 -1
- package/dist/core/events/v3/index.d.ts +5 -2
- package/dist/core/events/v3/index.d.ts.map +1 -1
- package/dist/core/events/v3/index.js +4 -1
- package/dist/core/events/v3/live-route-observer.d.ts +31 -0
- package/dist/core/events/v3/live-route-observer.d.ts.map +1 -0
- package/dist/core/events/v3/live-route-observer.js +58 -0
- package/dist/core/events/v3/live-routing.d.ts +13 -21
- package/dist/core/events/v3/live-routing.d.ts.map +1 -1
- package/dist/core/events/v3/live-routing.js +46 -41
- package/dist/core/events/v3/producers/coordination-recorder.d.ts +11 -1
- package/dist/core/events/v3/producers/coordination-recorder.d.ts.map +1 -1
- package/dist/core/events/v3/producers/coordination-recorder.js +76 -10
- package/dist/core/events/v3/producers/diagnostic-summaries.d.ts +129 -0
- package/dist/core/events/v3/producers/diagnostic-summaries.d.ts.map +1 -0
- package/dist/core/events/v3/producers/diagnostic-summaries.js +499 -0
- package/dist/core/events/v3/producers/hook-base.d.ts +1 -1
- package/dist/core/events/v3/producers/hook-base.d.ts.map +1 -1
- package/dist/core/events/v3/producers/hook-base.js +14 -3
- package/dist/core/events/v3/producers/intake.d.ts +7 -0
- package/dist/core/events/v3/producers/intake.d.ts.map +1 -1
- package/dist/core/events/v3/producers/intake.js +26 -2
- package/dist/core/events/v3/producers/producer-state-observer.d.ts +8 -0
- package/dist/core/events/v3/producers/producer-state-observer.d.ts.map +1 -0
- package/dist/core/events/v3/producers/producer-state-observer.js +45 -0
- package/dist/core/events/v3/producers/recorder.d.ts +71 -1
- package/dist/core/events/v3/producers/recorder.d.ts.map +1 -1
- package/dist/core/events/v3/producers/recorder.js +441 -25
- package/dist/core/events/v3/reader.d.ts +51 -0
- package/dist/core/events/v3/reader.d.ts.map +1 -1
- package/dist/core/events/v3/reader.js +181 -1
- package/dist/core/events/v3/rotation-config.d.ts +9 -0
- package/dist/core/events/v3/rotation-config.d.ts.map +1 -0
- package/dist/core/events/v3/rotation-config.js +91 -0
- package/dist/core/events/v3/runtime-build.d.ts +11 -0
- package/dist/core/events/v3/runtime-build.d.ts.map +1 -0
- package/dist/core/events/v3/runtime-build.js +39 -0
- package/dist/core/events/v3/runtime-identity.d.ts +5 -0
- package/dist/core/events/v3/runtime-identity.d.ts.map +1 -0
- package/dist/core/events/v3/runtime-identity.js +18 -0
- package/dist/core/events/v3/runtime-telemetry-capabilities.d.ts +6 -5
- package/dist/core/events/v3/runtime-telemetry-capabilities.d.ts.map +1 -1
- package/dist/core/events/v3/runtime-telemetry-capabilities.js +1 -1
- package/dist/core/events/v3/support-storage/classify.d.ts +46 -0
- package/dist/core/events/v3/support-storage/classify.d.ts.map +1 -0
- package/dist/core/events/v3/support-storage/classify.js +149 -0
- package/dist/core/events/v3/support-storage/eligibility.d.ts +29 -0
- package/dist/core/events/v3/support-storage/eligibility.d.ts.map +1 -0
- package/dist/core/events/v3/support-storage/eligibility.js +35 -0
- package/dist/core/events/v3/support-storage/index.d.ts +10 -0
- package/dist/core/events/v3/support-storage/index.d.ts.map +1 -0
- package/dist/core/events/v3/support-storage/index.js +9 -0
- package/dist/core/events/v3/support-storage/inventory.d.ts +30 -0
- package/dist/core/events/v3/support-storage/inventory.d.ts.map +1 -0
- package/dist/core/events/v3/support-storage/inventory.js +94 -0
- package/dist/core/events/v3/support-storage/logical-authority.d.ts +14 -0
- package/dist/core/events/v3/support-storage/logical-authority.d.ts.map +1 -0
- package/dist/core/events/v3/support-storage/logical-authority.js +104 -0
- package/dist/core/events/v3/support-storage/maintenance.d.ts +98 -0
- package/dist/core/events/v3/support-storage/maintenance.d.ts.map +1 -0
- package/dist/core/events/v3/support-storage/maintenance.js +352 -0
- package/dist/core/events/v3/support-storage/pack-contract.d.ts +59 -0
- package/dist/core/events/v3/support-storage/pack-contract.d.ts.map +1 -0
- package/dist/core/events/v3/support-storage/pack-contract.js +249 -0
- package/dist/core/events/v3/support-storage/pack-reader.d.ts +34 -0
- package/dist/core/events/v3/support-storage/pack-reader.d.ts.map +1 -0
- package/dist/core/events/v3/support-storage/pack-reader.js +258 -0
- package/dist/core/events/v3/support-storage/pack-writer.d.ts +30 -0
- package/dist/core/events/v3/support-storage/pack-writer.d.ts.map +1 -0
- package/dist/core/events/v3/support-storage/pack-writer.js +268 -0
- package/dist/core/events/v3/support-storage/recovery.d.ts +15 -0
- package/dist/core/events/v3/support-storage/recovery.d.ts.map +1 -0
- package/dist/core/events/v3/support-storage/recovery.js +22 -0
- package/dist/core/events/v3/turn-telemetry.d.ts +14 -8
- package/dist/core/events/v3/turn-telemetry.d.ts.map +1 -1
- package/dist/core/events/v3/turn-telemetry.js +32 -2
- package/dist/core/events/v3/writer.d.ts +13 -1
- package/dist/core/events/v3/writer.d.ts.map +1 -1
- package/dist/core/events/v3/writer.js +126 -12
- package/dist/core/governor/plan-read.d.ts.map +1 -1
- package/dist/core/governor/plan-read.js +5 -21
- package/dist/core/governor/planning.js +6 -8
- package/dist/core/governor/service-read.d.ts +12 -0
- package/dist/core/governor/service-read.d.ts.map +1 -1
- package/dist/core/governor/service-read.js +266 -2
- package/dist/core/governor/service.d.ts +1 -0
- package/dist/core/governor/service.d.ts.map +1 -1
- package/dist/core/governor/service.js +53 -18
- package/dist/core/guard/evidence-v3.d.ts.map +1 -1
- package/dist/core/guard/evidence-v3.js +2 -0
- package/dist/core/hooks/adapter/events.d.ts.map +1 -1
- package/dist/core/hooks/adapter/events.js +1 -0
- package/dist/core/hooks/adapter/output.d.ts +12 -2
- package/dist/core/hooks/adapter/output.d.ts.map +1 -1
- package/dist/core/hooks/adapter/output.js +23 -5
- package/dist/core/hooks/adapter/runtime-telemetry.d.ts +27 -4
- package/dist/core/hooks/adapter/runtime-telemetry.d.ts.map +1 -1
- package/dist/core/hooks/adapter/runtime-telemetry.js +307 -6
- package/dist/core/hooks/cli.js +380 -207
- package/dist/core/hooks/effects/image-capture.d.ts +1 -1
- package/dist/core/hooks/effects/image-capture.d.ts.map +1 -1
- package/dist/core/hooks/effects/image-capture.js +4 -2
- package/dist/core/hooks/health.d.ts +59 -0
- package/dist/core/hooks/health.d.ts.map +1 -0
- package/dist/core/hooks/health.js +84 -0
- package/dist/core/hooks/remediation-cap.d.ts +8 -3
- package/dist/core/hooks/remediation-cap.d.ts.map +1 -1
- package/dist/core/hooks/remediation-cap.js +3 -11
- package/dist/core/hooks/resolve/coord-root.d.ts +22 -9
- package/dist/core/hooks/resolve/coord-root.d.ts.map +1 -1
- package/dist/core/hooks/resolve/coord-root.js +92 -11
- package/dist/core/hooks/resolve/owner.d.ts.map +1 -1
- package/dist/core/hooks/resolve/owner.js +5 -0
- package/dist/core/hooks/resolve/transcript.d.ts +8 -0
- package/dist/core/hooks/resolve/transcript.d.ts.map +1 -1
- package/dist/core/hooks/resolve/transcript.js +11 -0
- package/dist/core/inbox/contract.d.ts +64 -0
- package/dist/core/inbox/contract.d.ts.map +1 -0
- package/dist/core/inbox/contract.js +13 -0
- package/dist/core/inbox/index.d.ts +5 -0
- package/dist/core/inbox/index.d.ts.map +1 -0
- package/dist/core/inbox/index.js +4 -0
- package/dist/core/inbox/lifecycle.d.ts +22 -0
- package/dist/core/inbox/lifecycle.d.ts.map +1 -0
- package/dist/core/inbox/lifecycle.js +41 -0
- package/dist/core/inbox/service.d.ts +36 -0
- package/dist/core/inbox/service.d.ts.map +1 -0
- package/dist/core/inbox/service.js +210 -0
- package/dist/core/inbox/watcher.d.ts +7 -0
- package/dist/core/inbox/watcher.d.ts.map +1 -0
- package/dist/core/inbox/watcher.js +26 -0
- package/dist/core/presence/codec-digest.d.ts.map +1 -1
- package/dist/core/presence/codec-digest.js +14 -3
- package/dist/core/presence/relay-client.d.ts +1 -0
- package/dist/core/presence/relay-client.d.ts.map +1 -1
- package/dist/core/presence/relay-client.js +52 -8
- package/dist/core/resources/contract.d.ts +90 -0
- package/dist/core/resources/contract.d.ts.map +1 -0
- package/dist/core/resources/contract.js +2 -0
- package/dist/core/resources/index.d.ts +6 -0
- package/dist/core/resources/index.d.ts.map +1 -0
- package/dist/core/resources/index.js +5 -0
- package/dist/core/resources/sampler.d.ts +27 -0
- package/dist/core/resources/sampler.d.ts.map +1 -0
- package/dist/core/resources/sampler.js +357 -0
- package/dist/core/resources/service-status.d.ts +3 -0
- package/dist/core/resources/service-status.d.ts.map +1 -0
- package/dist/core/resources/service-status.js +48 -0
- package/dist/core/resources/service.d.ts +26 -0
- package/dist/core/resources/service.d.ts.map +1 -0
- package/dist/core/resources/service.js +292 -0
- package/dist/core/resources/storage.d.ts +13 -0
- package/dist/core/resources/storage.d.ts.map +1 -0
- package/dist/core/resources/storage.js +30 -0
- package/dist/core/semantic/adapters.d.ts +11 -8
- package/dist/core/semantic/adapters.d.ts.map +1 -1
- package/dist/core/semantic/adapters.js +169 -31
- package/dist/core/semantic/contract.d.ts +532 -48
- package/dist/core/semantic/contract.d.ts.map +1 -1
- package/dist/core/semantic/contract.js +104 -3
- package/dist/core/semantic/index.d.ts +7 -3
- package/dist/core/semantic/index.d.ts.map +1 -1
- package/dist/core/semantic/index.js +7 -3
- package/dist/core/semantic/once.d.ts +6 -1
- package/dist/core/semantic/once.d.ts.map +1 -1
- package/dist/core/semantic/once.js +80 -9
- package/dist/core/semantic/prompt.d.ts.map +1 -1
- package/dist/core/semantic/prompt.js +14 -1
- package/dist/core/semantic/review.d.ts +144 -0
- package/dist/core/semantic/review.d.ts.map +1 -0
- package/dist/core/semantic/review.js +544 -0
- package/dist/core/semantic/routes.d.ts +10 -0
- package/dist/core/semantic/routes.d.ts.map +1 -0
- package/dist/core/semantic/routes.js +21 -0
- package/dist/core/semantic/scheduler.d.ts +14 -3
- package/dist/core/semantic/scheduler.d.ts.map +1 -1
- package/dist/core/semantic/scheduler.js +30 -6
- package/dist/core/semantic/service-status.d.ts +20 -0
- package/dist/core/semantic/service-status.d.ts.map +1 -1
- package/dist/core/semantic/service-status.js +60 -4
- package/dist/core/semantic/service.d.ts +1 -0
- package/dist/core/semantic/service.d.ts.map +1 -1
- package/dist/core/semantic/service.js +104 -15
- package/dist/core/semantic/soak.d.ts +75 -0
- package/dist/core/semantic/soak.d.ts.map +1 -0
- package/dist/core/semantic/soak.js +476 -0
- package/dist/core/semantic/storage.d.ts +11 -1
- package/dist/core/semantic/storage.d.ts.map +1 -1
- package/dist/core/semantic/storage.js +4 -3
- package/dist/core/semantic/usage.d.ts +43 -0
- package/dist/core/semantic/usage.d.ts.map +1 -0
- package/dist/core/semantic/usage.js +193 -0
- package/dist/core/semantic/validate.d.ts +3 -1
- package/dist/core/semantic/validate.d.ts.map +1 -1
- package/dist/core/semantic/validate.js +34 -1
- package/dist/core/storage/atomic-json.d.ts +3 -0
- package/dist/core/storage/atomic-json.d.ts.map +1 -0
- package/dist/core/storage/atomic-json.js +15 -0
- package/dist/core/storage/buffer.d.ts +28 -0
- package/dist/core/storage/buffer.d.ts.map +1 -0
- package/dist/core/storage/buffer.js +101 -0
- package/dist/core/storage/builtins.d.ts +3 -0
- package/dist/core/storage/builtins.d.ts.map +1 -0
- package/dist/core/storage/builtins.js +722 -0
- package/dist/core/storage/catalog.d.ts +19 -0
- package/dist/core/storage/catalog.d.ts.map +1 -0
- package/dist/core/storage/catalog.js +365 -0
- package/dist/core/storage/config.d.ts +16 -0
- package/dist/core/storage/config.d.ts.map +1 -0
- package/dist/core/storage/config.js +311 -0
- package/dist/core/storage/contract.d.ts +275 -0
- package/dist/core/storage/contract.d.ts.map +1 -0
- package/dist/core/storage/contract.js +3 -0
- package/dist/core/storage/durable-history.d.ts +36 -0
- package/dist/core/storage/durable-history.d.ts.map +1 -0
- package/dist/core/storage/durable-history.js +606 -0
- package/dist/core/storage/health.d.ts +4 -0
- package/dist/core/storage/health.d.ts.map +1 -0
- package/dist/core/storage/health.js +65 -0
- package/dist/core/storage/index.d.ts +16 -0
- package/dist/core/storage/index.d.ts.map +1 -0
- package/dist/core/storage/index.js +15 -0
- package/dist/core/storage/inventory.d.ts +25 -0
- package/dist/core/storage/inventory.d.ts.map +1 -0
- package/dist/core/storage/inventory.js +666 -0
- package/dist/core/storage/jsonl.d.ts +52 -0
- package/dist/core/storage/jsonl.d.ts.map +1 -0
- package/dist/core/storage/jsonl.js +156 -0
- package/dist/core/storage/log-retention.d.ts +52 -0
- package/dist/core/storage/log-retention.d.ts.map +1 -0
- package/dist/core/storage/log-retention.js +419 -0
- package/dist/core/storage/logger.d.ts +84 -0
- package/dist/core/storage/logger.d.ts.map +1 -0
- package/dist/core/storage/logger.js +413 -0
- package/dist/core/storage/maintenance-providers.d.ts +26 -0
- package/dist/core/storage/maintenance-providers.d.ts.map +1 -0
- package/dist/core/storage/maintenance-providers.js +141 -0
- package/dist/core/storage/maintenance.d.ts +125 -0
- package/dist/core/storage/maintenance.d.ts.map +1 -0
- package/dist/core/storage/maintenance.js +609 -0
- package/dist/core/storage/metrics.d.ts +60 -0
- package/dist/core/storage/metrics.d.ts.map +1 -0
- package/dist/core/storage/metrics.js +134 -0
- package/dist/core/storage/policy.d.ts +7 -0
- package/dist/core/storage/policy.d.ts.map +1 -0
- package/dist/core/storage/policy.js +110 -0
- package/dist/core/storage/process-log.d.ts +38 -0
- package/dist/core/storage/process-log.d.ts.map +1 -0
- package/dist/core/storage/process-log.js +165 -0
- package/dist/core/storage/query.d.ts +48 -0
- package/dist/core/storage/query.d.ts.map +1 -0
- package/dist/core/storage/query.js +346 -0
- package/dist/core/storage/receipts.d.ts +23 -0
- package/dist/core/storage/receipts.d.ts.map +1 -0
- package/dist/core/storage/receipts.js +117 -0
- package/dist/core/storage/segments.d.ts +84 -0
- package/dist/core/storage/segments.d.ts.map +1 -0
- package/dist/core/storage/segments.js +542 -0
- package/dist/core/storage/sink-graph.d.ts +65 -0
- package/dist/core/storage/sink-graph.d.ts.map +1 -0
- package/dist/core/storage/sink-graph.js +213 -0
- package/dist/core/storage/storm-control.d.ts +23 -0
- package/dist/core/storage/storm-control.d.ts.map +1 -0
- package/dist/core/storage/storm-control.js +59 -0
- package/dist/core/supervisor/activity.d.ts +4 -0
- package/dist/core/supervisor/activity.d.ts.map +1 -0
- package/dist/core/supervisor/activity.js +141 -0
- package/dist/core/supervisor/contract.d.ts +268 -0
- package/dist/core/supervisor/contract.d.ts.map +1 -0
- package/dist/core/supervisor/contract.js +35 -0
- package/dist/core/supervisor/explanations.d.ts +4 -0
- package/dist/core/supervisor/explanations.d.ts.map +1 -0
- package/dist/core/supervisor/explanations.js +71 -0
- package/dist/core/supervisor/findings.d.ts +20 -0
- package/dist/core/supervisor/findings.d.ts.map +1 -0
- package/dist/core/supervisor/findings.js +399 -0
- package/dist/core/supervisor/history.d.ts +9 -0
- package/dist/core/supervisor/history.d.ts.map +1 -0
- package/dist/core/supervisor/history.js +46 -0
- package/dist/core/supervisor/hook-health-alerts.d.ts +14 -0
- package/dist/core/supervisor/hook-health-alerts.d.ts.map +1 -0
- package/dist/core/supervisor/hook-health-alerts.js +70 -0
- package/dist/core/supervisor/hook-health-storage.d.ts +5 -0
- package/dist/core/supervisor/hook-health-storage.d.ts.map +1 -0
- package/dist/core/supervisor/hook-health-storage.js +24 -0
- package/dist/core/supervisor/hook-health.d.ts +72 -0
- package/dist/core/supervisor/hook-health.d.ts.map +1 -0
- package/dist/core/supervisor/hook-health.js +203 -0
- package/dist/core/supervisor/hooks.d.ts +10 -0
- package/dist/core/supervisor/hooks.d.ts.map +1 -0
- package/dist/core/supervisor/hooks.js +28 -0
- package/dist/core/supervisor/index.d.ts +15 -0
- package/dist/core/supervisor/index.d.ts.map +1 -0
- package/dist/core/supervisor/index.js +14 -0
- package/dist/core/supervisor/log-feed.d.ts +9 -0
- package/dist/core/supervisor/log-feed.d.ts.map +1 -0
- package/dist/core/supervisor/log-feed.js +103 -0
- package/dist/core/supervisor/service.d.ts +29 -0
- package/dist/core/supervisor/service.d.ts.map +1 -0
- package/dist/core/supervisor/service.js +450 -0
- package/dist/core/supervisor/services.d.ts +11 -0
- package/dist/core/supervisor/services.d.ts.map +1 -0
- package/dist/core/supervisor/services.js +155 -0
- package/dist/core/supervisor/status.d.ts +3 -0
- package/dist/core/supervisor/status.d.ts.map +1 -0
- package/dist/core/supervisor/status.js +48 -0
- package/dist/core/supervisor/storage.d.ts +30 -0
- package/dist/core/supervisor/storage.d.ts.map +1 -0
- package/dist/core/supervisor/storage.js +73 -0
- package/dist/core/supervisor/timeline.d.ts +3 -0
- package/dist/core/supervisor/timeline.d.ts.map +1 -0
- package/dist/core/supervisor/timeline.js +87 -0
- package/dist/core/work/state.d.ts.map +1 -1
- package/dist/core/work/state.js +10 -14
- package/dist/core/workflow/admission.d.ts +23 -0
- package/dist/core/workflow/admission.d.ts.map +1 -0
- package/dist/core/workflow/admission.js +136 -0
- package/dist/core/workflow/engine.d.ts.map +1 -1
- package/dist/core/workflow/engine.js +77 -2
- package/dist/core/workflow/index.d.ts +3 -2
- package/dist/core/workflow/index.d.ts.map +1 -1
- package/dist/core/workflow/index.js +2 -1
- package/dist/core/workflow/live-session-v3.d.ts.map +1 -1
- package/dist/core/workflow/live-session-v3.js +2 -1
- package/dist/core/workflow/proof.d.ts +2 -1
- package/dist/core/workflow/proof.d.ts.map +1 -1
- package/dist/core/workflow/proof.js +39 -1
- package/dist/core/workflow/run-state.d.ts +3 -2
- package/dist/core/workflow/run-state.d.ts.map +1 -1
- package/dist/core/workflow/run-state.js +8 -1
- package/dist/core/workflow/types.d.ts +33 -1
- package/dist/core/workflow/types.d.ts.map +1 -1
- package/dist/core/workflow/types.js +2 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/lazy-commands.d.ts +26 -0
- package/dist/lazy-commands.d.ts.map +1 -0
- package/dist/lazy-commands.js +210 -0
- package/dist/lib/browser/client.d.ts +5 -0
- package/dist/lib/browser/client.d.ts.map +1 -1
- package/dist/lib/browser/client.js +1 -0
- package/dist/lib/browser/index.d.ts +2 -0
- package/dist/lib/browser/index.d.ts.map +1 -1
- package/dist/lib/browser/index.js +2 -0
- package/dist/lib/browser/qa-run-contracts.d.ts +173 -0
- package/dist/lib/browser/qa-run-contracts.d.ts.map +1 -0
- package/dist/lib/browser/qa-run-contracts.js +226 -0
- package/dist/lib/browser/qa-run.d.ts +51 -0
- package/dist/lib/browser/qa-run.d.ts.map +1 -0
- package/dist/lib/browser/qa-run.js +684 -0
- package/dist/lib/coord-root-id.d.ts +9 -0
- package/dist/lib/coord-root-id.d.ts.map +1 -0
- package/dist/lib/coord-root-id.js +17 -0
- package/dist/lib/docs-lint.d.ts +2 -0
- package/dist/lib/docs-lint.d.ts.map +1 -1
- package/dist/lib/docs-lint.js +45 -80
- package/dist/lib/docs-metadata-audit.d.ts +3 -0
- package/dist/lib/docs-metadata-audit.d.ts.map +1 -1
- package/dist/lib/docs-metadata-audit.js +13 -23
- package/dist/lib/docs-metadata-sync.d.ts +1 -0
- package/dist/lib/docs-metadata-sync.d.ts.map +1 -1
- package/dist/lib/docs-metadata-sync.js +28 -10
- package/dist/lib/docs-repository-view.d.ts +22 -0
- package/dist/lib/docs-repository-view.d.ts.map +1 -0
- package/dist/lib/docs-repository-view.js +185 -0
- package/dist/lib/http/client.d.ts +11 -5
- package/dist/lib/http/client.d.ts.map +1 -1
- package/dist/lib/http/client.js +22 -4
- package/dist/lib/http/index.d.ts +1 -1
- package/dist/lib/http/index.d.ts.map +1 -1
- package/dist/lib/http/index.js +1 -1
- package/dist/lib/indexer-exclusions.d.ts +27 -0
- package/dist/lib/indexer-exclusions.d.ts.map +1 -0
- package/dist/lib/indexer-exclusions.js +176 -0
- package/dist/lib/instructions/apply.d.ts +3 -1
- package/dist/lib/instructions/apply.d.ts.map +1 -1
- package/dist/lib/instructions/apply.js +74 -3
- package/dist/lib/instructions/templates.d.ts.map +1 -1
- package/dist/lib/instructions/templates.js +11 -0
- package/dist/lib/local-file-url.d.ts +9 -0
- package/dist/lib/local-file-url.d.ts.map +1 -0
- package/dist/lib/local-file-url.js +20 -0
- package/dist/lib/web-performance.d.ts +118 -0
- package/dist/lib/web-performance.d.ts.map +1 -0
- package/dist/lib/web-performance.js +192 -0
- package/package.json +40 -2
- package/schemas/config.schema.json +58 -0
- package/schemas/event-v3.schema.json +324 -112
- package/src/commander.ts +488 -95
- package/src/commands/agents.ts +617 -237
- package/src/commands/artifacts.ts +40 -2
- package/src/commands/backup.ts +18 -14
- package/src/commands/browse-session.ts +12 -0
- package/src/commands/browse.ts +21 -7
- package/src/commands/conversations.ts +279 -0
- package/src/commands/deinit.ts +6 -0
- package/src/commands/diagnostics.ts +271 -0
- package/src/commands/docs.ts +25 -6
- package/src/commands/doctor.ts +75 -9
- package/src/commands/fetch.ts +7 -6
- package/src/commands/files.ts +243 -0
- package/src/commands/governor.ts +21 -12
- package/src/commands/inbox.ts +61 -0
- package/src/commands/init.ts +78 -16
- package/src/commands/ledger-v3.ts +503 -1
- package/src/commands/logs.ts +224 -0
- package/src/commands/messages.ts +61 -0
- package/src/commands/outline.ts +6 -2
- package/src/commands/qa-run.ts +184 -0
- package/src/commands/read.ts +6 -2
- package/src/commands/resources.ts +38 -0
- package/src/commands/semantic.ts +66 -1
- package/src/commands/storage.ts +310 -0
- package/src/commands/supervisor.ts +141 -0
- package/src/commands/tunnel.ts +66 -52
- package/src/commands/web.ts +96 -7
- package/src/commands/work.ts +3 -3
- package/src/commands/workflow.ts +21 -13
- package/src/core/agents/cli.ts +265 -55
- package/src/core/agents/health.ts +142 -0
- package/src/core/agents/live-authority-v3.ts +341 -10
- package/src/core/agents/live-lifecycle-v3.ts +6 -1
- package/src/core/agents/live-observation-v3.ts +6 -1
- package/src/core/agents/mailbox.ts +373 -0
- package/src/core/agents/reconcile-coordination-v3.ts +77 -0
- package/src/core/agents/render/prompt-context.ts +66 -15
- package/src/core/agents/render/session-context.ts +37 -3
- package/src/core/agents/rules/commit-conflict.ts +58 -1
- package/src/core/agents/rules/stop-hook.ts +105 -20
- package/src/core/agents/rules/verdict.ts +1 -0
- package/src/core/agents/session-events.ts +4 -0
- package/src/core/agents/session-finalization-state-v3.ts +1 -1
- package/src/core/agents/session-finalizer-v3.ts +8 -2
- package/src/core/agents/state/activity-log.ts +7 -2
- package/src/core/agents/state/heartbeat-writer.ts +27 -0
- package/src/core/agents/state/live-coordination-view.ts +16 -105
- package/src/core/agents/state/live-coordination-writer.ts +141 -0
- package/src/core/artifacts/index.ts +260 -11
- package/src/core/config.ts +235 -5
- package/src/core/conversations/archive.ts +237 -0
- package/src/core/conversations/catalog.ts +79 -0
- package/src/core/conversations/context-pack.ts +72 -0
- package/src/core/conversations/contract.ts +178 -0
- package/src/core/conversations/evaluation.ts +30 -0
- package/src/core/conversations/index.ts +9 -0
- package/src/core/conversations/lifecycle.ts +63 -0
- package/src/core/conversations/normalize.ts +105 -0
- package/src/core/conversations/query.ts +318 -0
- package/src/core/conversations/search-index.ts +48 -0
- package/src/core/diagnostics/advice.ts +147 -0
- package/src/core/diagnostics/bundle.ts +1142 -0
- package/src/core/diagnostics/comparison.ts +565 -0
- package/src/core/diagnostics/contract.ts +311 -0
- package/src/core/diagnostics/identity.ts +11 -0
- package/src/core/diagnostics/index.ts +7 -0
- package/src/core/diagnostics/replay.ts +314 -0
- package/src/core/diagnostics/sanitize.ts +97 -0
- package/src/core/events/legacy-storage/canary.ts +177 -0
- package/src/core/events/legacy-storage/compression.ts +130 -0
- package/src/core/events/legacy-storage/fence.ts +129 -0
- package/src/core/events/legacy-storage/index.ts +6 -0
- package/src/core/events/legacy-storage/inventory.ts +51 -0
- package/src/core/events/legacy-storage/manifest.ts +136 -0
- package/src/core/events/legacy-storage/reader.ts +178 -0
- package/src/core/events/v3/archive-retention.ts +251 -0
- package/src/core/events/v3/authority-outbox.ts +22 -1
- package/src/core/events/v3/base-contract.ts +17 -7
- package/src/core/events/v3/bootstrap.ts +195 -2
- package/src/core/events/v3/capabilities.ts +5 -3
- package/src/core/events/v3/control-witness.ts +339 -0
- package/src/core/events/v3/control-writer.ts +16 -0
- package/src/core/events/v3/control.ts +54 -18
- package/src/core/events/v3/coordination-transaction-recovery.ts +477 -0
- package/src/core/events/v3/coordination-view.ts +17 -1
- package/src/core/events/v3/generated.ts +1 -1
- package/src/core/events/v3/index.ts +14 -2
- package/src/core/events/v3/live-route-observer.ts +80 -0
- package/src/core/events/v3/live-routing.ts +65 -46
- package/src/core/events/v3/producers/coordination-recorder.ts +95 -10
- package/src/core/events/v3/producers/diagnostic-summaries.ts +593 -0
- package/src/core/events/v3/producers/hook-base.ts +15 -3
- package/src/core/events/v3/producers/intake.ts +31 -2
- package/src/core/events/v3/producers/producer-state-observer.ts +52 -0
- package/src/core/events/v3/producers/recorder.ts +681 -34
- package/src/core/events/v3/reader.ts +243 -2
- package/src/core/events/v3/rotation-config.ts +98 -0
- package/src/core/events/v3/runtime-build.ts +41 -0
- package/src/core/events/v3/runtime-identity.ts +16 -0
- package/src/core/events/v3/runtime-telemetry-capabilities.ts +14 -8
- package/src/core/events/v3/support-storage/classify.ts +209 -0
- package/src/core/events/v3/support-storage/eligibility.ts +58 -0
- package/src/core/events/v3/support-storage/index.ts +9 -0
- package/src/core/events/v3/support-storage/inventory.ts +135 -0
- package/src/core/events/v3/support-storage/logical-authority.ts +117 -0
- package/src/core/events/v3/support-storage/maintenance.ts +501 -0
- package/src/core/events/v3/support-storage/pack-contract.ts +337 -0
- package/src/core/events/v3/support-storage/pack-reader.ts +346 -0
- package/src/core/events/v3/support-storage/pack-writer.ts +352 -0
- package/src/core/events/v3/support-storage/recovery.ts +43 -0
- package/src/core/events/v3/turn-telemetry.ts +58 -7
- package/src/core/events/v3/writer.ts +168 -16
- package/src/core/governor/plan-read.ts +5 -18
- package/src/core/governor/planning.ts +5 -8
- package/src/core/governor/service-read.ts +320 -2
- package/src/core/governor/service.ts +49 -22
- package/src/core/guard/evidence-v3.ts +1 -0
- package/src/core/hooks/adapter/events.ts +1 -0
- package/src/core/hooks/adapter/output.ts +23 -5
- package/src/core/hooks/adapter/runtime-telemetry.ts +408 -13
- package/src/core/hooks/cli.ts +404 -233
- package/src/core/hooks/effects/image-capture.ts +4 -1
- package/src/core/hooks/health.ts +146 -0
- package/src/core/hooks/remediation-cap.ts +12 -6
- package/src/core/hooks/resolve/coord-root.ts +91 -11
- package/src/core/hooks/resolve/owner.ts +4 -0
- package/src/core/hooks/resolve/transcript.ts +18 -0
- package/src/core/inbox/contract.ts +81 -0
- package/src/core/inbox/index.ts +4 -0
- package/src/core/inbox/lifecycle.ts +104 -0
- package/src/core/inbox/service.ts +305 -0
- package/src/core/inbox/watcher.ts +36 -0
- package/src/core/presence/codec-digest.ts +15 -9
- package/src/core/presence/relay-client.ts +55 -7
- package/src/core/resources/contract.ts +98 -0
- package/src/core/resources/index.ts +5 -0
- package/src/core/resources/sampler.ts +458 -0
- package/src/core/resources/service-status.ts +62 -0
- package/src/core/resources/service.ts +337 -0
- package/src/core/resources/storage.ts +44 -0
- package/src/core/semantic/adapters.ts +200 -41
- package/src/core/semantic/contract.ts +135 -3
- package/src/core/semantic/index.ts +76 -2
- package/src/core/semantic/once.ts +93 -7
- package/src/core/semantic/prompt.ts +13 -1
- package/src/core/semantic/review.ts +803 -0
- package/src/core/semantic/routes.ts +30 -0
- package/src/core/semantic/scheduler.ts +49 -5
- package/src/core/semantic/service-status.ts +99 -5
- package/src/core/semantic/service.ts +116 -15
- package/src/core/semantic/soak.ts +638 -0
- package/src/core/semantic/storage.ts +20 -6
- package/src/core/semantic/usage.ts +272 -0
- package/src/core/semantic/validate.ts +31 -0
- package/src/core/storage/atomic-json.ts +15 -0
- package/src/core/storage/buffer.ts +124 -0
- package/src/core/storage/builtins.ts +972 -0
- package/src/core/storage/catalog.ts +467 -0
- package/src/core/storage/config.ts +423 -0
- package/src/core/storage/contract.ts +342 -0
- package/src/core/storage/durable-history.ts +738 -0
- package/src/core/storage/health.ts +76 -0
- package/src/core/storage/index.ts +15 -0
- package/src/core/storage/inventory.ts +859 -0
- package/src/core/storage/jsonl.ts +213 -0
- package/src/core/storage/log-retention.ts +555 -0
- package/src/core/storage/logger.ts +548 -0
- package/src/core/storage/maintenance-providers.ts +200 -0
- package/src/core/storage/maintenance.ts +929 -0
- package/src/core/storage/metrics.ts +199 -0
- package/src/core/storage/policy.ts +141 -0
- package/src/core/storage/process-log.ts +203 -0
- package/src/core/storage/query.ts +418 -0
- package/src/core/storage/receipts.ts +162 -0
- package/src/core/storage/segments.ts +721 -0
- package/src/core/storage/sink-graph.ts +343 -0
- package/src/core/storage/storm-control.ts +91 -0
- package/src/core/supervisor/activity.ts +193 -0
- package/src/core/supervisor/contract.ts +312 -0
- package/src/core/supervisor/explanations.ts +104 -0
- package/src/core/supervisor/findings.ts +788 -0
- package/src/core/supervisor/history.ts +61 -0
- package/src/core/supervisor/hook-health-alerts.ts +108 -0
- package/src/core/supervisor/hook-health-storage.ts +25 -0
- package/src/core/supervisor/hook-health.ts +301 -0
- package/src/core/supervisor/hooks.ts +35 -0
- package/src/core/supervisor/index.ts +14 -0
- package/src/core/supervisor/log-feed.ts +131 -0
- package/src/core/supervisor/service.ts +511 -0
- package/src/core/supervisor/services.ts +203 -0
- package/src/core/supervisor/status.ts +59 -0
- package/src/core/supervisor/storage.ts +126 -0
- package/src/core/supervisor/timeline.ts +133 -0
- package/src/core/work/state.ts +12 -21
- package/src/core/workflow/admission.ts +215 -0
- package/src/core/workflow/engine.ts +93 -1
- package/src/core/workflow/index.ts +10 -0
- package/src/core/workflow/live-session-v3.ts +2 -4
- package/src/core/workflow/proof.ts +54 -1
- package/src/core/workflow/run-state.ts +13 -1
- package/src/core/workflow/types.ts +39 -1
- package/src/index.ts +2 -0
- package/src/lazy-commands.ts +294 -0
- package/src/lib/browser/client.ts +6 -0
- package/src/lib/browser/index.ts +29 -0
- package/src/lib/browser/qa-run-contracts.ts +380 -0
- package/src/lib/browser/qa-run.ts +784 -0
- package/src/lib/coord-root-id.ts +23 -0
- package/src/lib/docs-lint.ts +58 -77
- package/src/lib/docs-metadata-audit.ts +26 -21
- package/src/lib/docs-metadata-sync.ts +32 -9
- package/src/lib/docs-repository-view.ts +220 -0
- package/src/lib/http/client.ts +44 -8
- package/src/lib/http/index.ts +6 -1
- package/src/lib/indexer-exclusions.ts +173 -0
- package/src/lib/instructions/apply.ts +81 -2
- package/src/lib/instructions/templates.ts +11 -0
- package/src/lib/local-file-url.ts +31 -0
- package/src/lib/web-performance.ts +335 -0
|
@@ -31,6 +31,10 @@ const CLOSED_TURN_MEMORY_CAP = 16;
|
|
|
31
31
|
const SPAN_SOFT_WATERMARK = 128;
|
|
32
32
|
const PENDING_RUNTIME_CONTEXT_CAP = 4;
|
|
33
33
|
const RUNTIME_CONTEXT_RETRY_LIMIT = 2;
|
|
34
|
+
/** Active turns pay for at most one bounded adapter telemetry read per interval. */
|
|
35
|
+
const ACTIVE_RUNTIME_CONTEXT_PROBE_INTERVAL_MS = 15_000;
|
|
36
|
+
/** Codex can flush the terminal row just after Stop; keep this grace bounded and off other hooks. */
|
|
37
|
+
const STOP_RUNTIME_CONTEXT_RETRY_DELAYS_MS = [75, 175];
|
|
34
38
|
/** Finalization is off the interactive hook path; briefly cover Codex's delayed transcript flush. */
|
|
35
39
|
const APPROVED_END_RUNTIME_CONTEXT_RETRY_DELAYS_MS = [0, 250, 250];
|
|
36
40
|
/**
|
|
@@ -283,8 +287,23 @@ function processHookSignalLocked(control, input, sessionHash, path) {
|
|
|
283
287
|
: control.activation.event.event_id;
|
|
284
288
|
const rootFingerprintContext = fingerprintContextV3(input.coordRoot, rootId, undefined, epochId);
|
|
285
289
|
const sessionId = `sid_${sessionHash.slice(4)}`;
|
|
290
|
+
const genesisId = control.genesis.event.payload.genesis_id;
|
|
291
|
+
// Every write below carries the epoch fence: an event produced for this
|
|
292
|
+
// epoch is refused (or quarantined from the spool) once the epoch has been
|
|
293
|
+
// replaced, instead of poisoning the successor's authority.
|
|
294
|
+
input = {
|
|
295
|
+
...input,
|
|
296
|
+
writerOptions: { ...input.writerOptions, expectedGenesisId: genesisId },
|
|
297
|
+
};
|
|
286
298
|
try {
|
|
287
299
|
let state = existsSync(path) ? readProducerState(path) : undefined;
|
|
300
|
+
if (state && state.epoch_genesis_id !== genesisId) {
|
|
301
|
+
// A producer state from a replaced epoch (or one that predates the
|
|
302
|
+
// field) is never adopted: its boot sequences and causal links only
|
|
303
|
+
// validate inside the epoch that recorded them. The session re-onboards
|
|
304
|
+
// below exactly as it does after an automatic epoch refresh.
|
|
305
|
+
state = undefined;
|
|
306
|
+
}
|
|
288
307
|
if (state &&
|
|
289
308
|
(state.adapter !== input.adapter ||
|
|
290
309
|
state.session_id !== sessionId ||
|
|
@@ -307,7 +326,7 @@ function processHookSignalLocked(control, input, sessionHash, path) {
|
|
|
307
326
|
const pendingSource = state.pending.source_id;
|
|
308
327
|
const incomingSource = sourceIdForSignal(input, rootFingerprintContext);
|
|
309
328
|
const pendingEvent = state.pending.event;
|
|
310
|
-
const durability = writeEventV3(input.coordRoot, pendingEvent);
|
|
329
|
+
const durability = writeEventV3(input.coordRoot, pendingEvent, input.writerOptions);
|
|
311
330
|
applyCommittedEvent(state, pendingEvent);
|
|
312
331
|
state.pending = undefined;
|
|
313
332
|
publishProducerState(path, state);
|
|
@@ -321,10 +340,11 @@ function processHookSignalLocked(control, input, sessionHash, path) {
|
|
|
321
340
|
if (state && !state.terminal && state.started_event_id) {
|
|
322
341
|
return { state: "already_started", event_id: state.started_event_id };
|
|
323
342
|
}
|
|
324
|
-
if (input.session_start_derivation && !state?.terminal)
|
|
343
|
+
if ((input.session_start_derivation === "approved_lifecycle_reopen" && !state?.terminal) ||
|
|
344
|
+
(input.session_start_derivation === "validated_current_session_heal" && state?.terminal)) {
|
|
325
345
|
return { state: "missing_session_start" };
|
|
326
346
|
}
|
|
327
|
-
state = newProducerState(input, sessionId, epochId, boundaryEventId);
|
|
347
|
+
state = newProducerState(input, sessionId, epochId, boundaryEventId, genesisId);
|
|
328
348
|
}
|
|
329
349
|
else if (!state || state.terminal) {
|
|
330
350
|
// Mid-flight onboarding (ADR 0078): a live session with no producer
|
|
@@ -350,7 +370,7 @@ function processHookSignalLocked(control, input, sessionHash, path) {
|
|
|
350
370
|
});
|
|
351
371
|
return { state: "missing_session_start" };
|
|
352
372
|
}
|
|
353
|
-
state = newProducerState(input, sessionId, epochId, boundaryEventId);
|
|
373
|
+
state = newProducerState(input, sessionId, epochId, boundaryEventId, genesisId);
|
|
354
374
|
const cursorPromptBootstrap = isCursorPromptBootstrap(input);
|
|
355
375
|
const onboarding = buildMidFlightSessionStart(input, state, rootId, cursorPromptBootstrap);
|
|
356
376
|
commitEventLocked(input, state, path, onboarding);
|
|
@@ -360,6 +380,7 @@ function processHookSignalLocked(control, input, sessionHash, path) {
|
|
|
360
380
|
instance_id: input.instance_id,
|
|
361
381
|
signal: input.signal,
|
|
362
382
|
session_hash: sessionHash,
|
|
383
|
+
...(input.adapter === "codex" ? codexMidFlightDiagnosticContext(input.payload) : {}),
|
|
363
384
|
});
|
|
364
385
|
}
|
|
365
386
|
}
|
|
@@ -446,6 +467,49 @@ function processHookSignalLocked(control, input, sessionHash, path) {
|
|
|
446
467
|
// Sample once for the native event and every span it opens or closes so
|
|
447
468
|
// their self-contained timing cannot drift by a millisecond.
|
|
448
469
|
const eventClock = signalClock(input);
|
|
470
|
+
if (input.signal === "after-agent-response") {
|
|
471
|
+
if (input.adapter !== "cursor" ||
|
|
472
|
+
!state.current_turn_id ||
|
|
473
|
+
!state.current_turn_span ||
|
|
474
|
+
!input.turn_ritual) {
|
|
475
|
+
writeProducerDiagnosticV3(input.coordRoot, "cursor_response_ritual_unbound", {
|
|
476
|
+
adapter: input.adapter,
|
|
477
|
+
instance_id: input.instance_id,
|
|
478
|
+
generation_id: state.generation_id,
|
|
479
|
+
signal: input.signal,
|
|
480
|
+
reason: !state.current_turn_id
|
|
481
|
+
? "no_open_turn"
|
|
482
|
+
: !state.current_turn_span
|
|
483
|
+
? "no_open_turn_span"
|
|
484
|
+
: "ritual_observation_missing",
|
|
485
|
+
});
|
|
486
|
+
publishProducerState(path, state);
|
|
487
|
+
return { state: "ignored" };
|
|
488
|
+
}
|
|
489
|
+
const observation = {
|
|
490
|
+
turn_id: state.current_turn_id,
|
|
491
|
+
...(input.payload.turn_id ? { native_turn_id: input.payload.turn_id } : {}),
|
|
492
|
+
observed_at: eventClock.observed_at,
|
|
493
|
+
status_box_present: input.turn_ritual.status_box_present,
|
|
494
|
+
status_box_present_strict: input.turn_ritual.status_box_present_strict,
|
|
495
|
+
};
|
|
496
|
+
state.cursor_response_ritual = observation;
|
|
497
|
+
publishProducerState(path, state);
|
|
498
|
+
writeProducerDiagnosticV3(input.coordRoot, "cursor_response_ritual_observed", {
|
|
499
|
+
instance_id: state.instance_id,
|
|
500
|
+
generation_id: state.generation_id,
|
|
501
|
+
turn_id: observation.turn_id,
|
|
502
|
+
...(observation.native_turn_id ? { native_turn_id: observation.native_turn_id } : {}),
|
|
503
|
+
response_observed_at: observation.observed_at,
|
|
504
|
+
status_box_present_strict: observation.status_box_present_strict,
|
|
505
|
+
});
|
|
506
|
+
return {
|
|
507
|
+
state: "observed",
|
|
508
|
+
generation_id: state.generation_id,
|
|
509
|
+
turn_id: observation.turn_id,
|
|
510
|
+
observed_at: observation.observed_at,
|
|
511
|
+
};
|
|
512
|
+
}
|
|
449
513
|
if (input.signal === "user-prompt-submit" && !state.current_turn_span) {
|
|
450
514
|
state.current_turn_span = openSpanStateV3({
|
|
451
515
|
span_id: spanIdV3(),
|
|
@@ -664,6 +728,36 @@ function processHookSignalLocked(control, input, sessionHash, path) {
|
|
|
664
728
|
// Before the signal's own event: the tool call or turn that carries the
|
|
665
729
|
// new effort already ran under it, so it must ride the new attestation.
|
|
666
730
|
maybeAttestTuningChange(input, state, path, rootId);
|
|
731
|
+
const cursorResponseRitual = input.adapter === "cursor" &&
|
|
732
|
+
(input.signal === "stop" || input.signal === "stop-failure") &&
|
|
733
|
+
state.current_turn_id &&
|
|
734
|
+
state.cursor_response_ritual?.turn_id === state.current_turn_id
|
|
735
|
+
? state.cursor_response_ritual
|
|
736
|
+
: undefined;
|
|
737
|
+
const terminalTurnRitual = input.adapter === "cursor" && (input.signal === "stop" || input.signal === "stop-failure")
|
|
738
|
+
? cursorResponseRitual
|
|
739
|
+
? {
|
|
740
|
+
status_box_present: cursorResponseRitual.status_box_present,
|
|
741
|
+
status_box_present_strict: cursorResponseRitual.status_box_present_strict,
|
|
742
|
+
session_name_required: false,
|
|
743
|
+
session_name_present: false,
|
|
744
|
+
}
|
|
745
|
+
: undefined
|
|
746
|
+
: input.turn_ritual;
|
|
747
|
+
if (cursorResponseRitual) {
|
|
748
|
+
writeProducerDiagnosticV3(input.coordRoot, "cursor_response_ritual_consumed", {
|
|
749
|
+
instance_id: state.instance_id,
|
|
750
|
+
generation_id: state.generation_id,
|
|
751
|
+
turn_id: cursorResponseRitual.turn_id,
|
|
752
|
+
...(cursorResponseRitual.native_turn_id
|
|
753
|
+
? { response_native_turn_id: cursorResponseRitual.native_turn_id }
|
|
754
|
+
: {}),
|
|
755
|
+
...(input.payload.turn_id ? { stop_native_turn_id: input.payload.turn_id } : {}),
|
|
756
|
+
response_observed_at: cursorResponseRitual.observed_at,
|
|
757
|
+
stop_observed_at: eventClock.observed_at,
|
|
758
|
+
status_box_present_strict: cursorResponseRitual.status_box_present_strict,
|
|
759
|
+
});
|
|
760
|
+
}
|
|
667
761
|
const event = normalizeHookEventV3(input.signal, eventInput.payload, {
|
|
668
762
|
coordRoot: input.coordRoot,
|
|
669
763
|
adapter: input.adapter,
|
|
@@ -721,7 +815,7 @@ function processHookSignalLocked(control, input, sessionHash, path) {
|
|
|
721
815
|
child_generation_id: delegation?.child_generation_id,
|
|
722
816
|
agent_role: delegation?.role,
|
|
723
817
|
stop_remediation: input.stop_remediation,
|
|
724
|
-
turn_ritual:
|
|
818
|
+
turn_ritual: terminalTurnRitual,
|
|
725
819
|
});
|
|
726
820
|
if (!event)
|
|
727
821
|
return { state: "ignored" };
|
|
@@ -764,11 +858,15 @@ function processHookSignalLocked(control, input, sessionHash, path) {
|
|
|
764
858
|
assertEventV3(event);
|
|
765
859
|
}
|
|
766
860
|
if (input.signal === "session-start" &&
|
|
767
|
-
input.session_start_derivation
|
|
861
|
+
input.session_start_derivation &&
|
|
768
862
|
event.event_type === "session.started") {
|
|
863
|
+
const lifecycleReopen = input.session_start_derivation === "approved_lifecycle_reopen";
|
|
864
|
+
const reason = lifecycleReopen
|
|
865
|
+
? "approved_lifecycle_reopen"
|
|
866
|
+
: "validated_current_session_heal";
|
|
769
867
|
event.provenance = {
|
|
770
868
|
...event.provenance,
|
|
771
|
-
source_event: `${input.adapter}.
|
|
869
|
+
source_event: `${input.adapter}.${reason.replaceAll("_", "-")}`,
|
|
772
870
|
attestation: "derived",
|
|
773
871
|
confidence: "high",
|
|
774
872
|
attribution: {
|
|
@@ -779,7 +877,7 @@ function processHookSignalLocked(control, input, sessionHash, path) {
|
|
|
779
877
|
};
|
|
780
878
|
event.payload.resume = {
|
|
781
879
|
state: "unknown",
|
|
782
|
-
reason
|
|
880
|
+
reason,
|
|
783
881
|
};
|
|
784
882
|
assertEventV3(event);
|
|
785
883
|
}
|
|
@@ -788,7 +886,13 @@ function processHookSignalLocked(control, input, sessionHash, path) {
|
|
|
788
886
|
span.open_event_id = event.event_id;
|
|
789
887
|
stampSpanTurn(span, event, eventInput, state);
|
|
790
888
|
}
|
|
889
|
+
// A turn terminal clears current_native_turn_id when it commits. Retain the
|
|
890
|
+
// native identity long enough to seed a delayed context retry afterward.
|
|
891
|
+
const nativeTurnIdForContext = input.payload.turn_id ?? state.current_native_turn_id;
|
|
791
892
|
const durability = commitEventLocked(input, state, path, event, sourceId);
|
|
893
|
+
if (event.event_type === "context.compaction_started" && input.signal === "pre-compact") {
|
|
894
|
+
maybeCommitNativeHookContextObservation(input, state, path, rootId, fingerprintContext, event);
|
|
895
|
+
}
|
|
792
896
|
if (event.event_type === "tool.requested" && sourceId) {
|
|
793
897
|
const explicitWait = explicitNativeWait(input);
|
|
794
898
|
if (explicitWait) {
|
|
@@ -802,9 +906,12 @@ function processHookSignalLocked(control, input, sessionHash, path) {
|
|
|
802
906
|
if (progressKind) {
|
|
803
907
|
commitProgressObservation(input, state, path, rootId, event, progressKind);
|
|
804
908
|
}
|
|
909
|
+
if (event.event_type === "tool.completed" && input.signal === "post-tool-use") {
|
|
910
|
+
maybeCommitActiveRuntimeContextObservation(input, state, path, rootId, fingerprintContext, event);
|
|
911
|
+
}
|
|
805
912
|
if (turnTelemetry) {
|
|
806
913
|
const contextTarget = turnContextTarget(event);
|
|
807
|
-
queuePendingRuntimeContext(input, state, contextTarget, turnTelemetry.context);
|
|
914
|
+
queuePendingRuntimeContext(input, state, contextTarget, turnTelemetry.context, nativeTurnIdForContext);
|
|
808
915
|
commitTurnContextObservation(input, state, path, rootId, fingerprintContext, contextTarget, turnTelemetry.context, turnTelemetry.context_provenance);
|
|
809
916
|
}
|
|
810
917
|
if (event.event_type === "session.ended") {
|
|
@@ -1167,6 +1274,25 @@ function commitEventLocked(input, state, path, event, sourceId) {
|
|
|
1167
1274
|
function commitTurnContextObservation(input, state, path, rootId, fingerprintContext, target, measurement, contextProvenance, observedAt) {
|
|
1168
1275
|
if (!target)
|
|
1169
1276
|
return;
|
|
1277
|
+
commitContextObservation(input, state, path, rootId, fingerprintContext, {
|
|
1278
|
+
caused_by_event_id: target.terminal_event_id,
|
|
1279
|
+
observed_at: observedAt ?? target.terminal_observed_at,
|
|
1280
|
+
turn_id: target.turn_id,
|
|
1281
|
+
...(target.run_id ? { run_id: target.run_id } : {}),
|
|
1282
|
+
...(target.workflow_id ? { workflow_id: target.workflow_id } : {}),
|
|
1283
|
+
...(target.workflow_agent_id ? { workflow_agent_id: target.workflow_agent_id } : {}),
|
|
1284
|
+
}, measurement, contextProvenance);
|
|
1285
|
+
}
|
|
1286
|
+
function commitContextObservation(input, state, path, rootId, fingerprintContext, target, measurement, contextProvenance) {
|
|
1287
|
+
if (measurement.state === "observed" &&
|
|
1288
|
+
contextProvenance?.source_witness &&
|
|
1289
|
+
state.last_context_source_witness === contextProvenance.source_witness) {
|
|
1290
|
+
publishProducerState(path, state);
|
|
1291
|
+
return;
|
|
1292
|
+
}
|
|
1293
|
+
if (measurement.state === "observed" && contextProvenance?.source_witness) {
|
|
1294
|
+
state.last_context_source_witness = contextProvenance.source_witness;
|
|
1295
|
+
}
|
|
1170
1296
|
const event = buildEventV3("context.observed", {
|
|
1171
1297
|
producer: {
|
|
1172
1298
|
producer_id: input.producer_id,
|
|
@@ -1188,7 +1314,7 @@ function commitTurnContextObservation(input, state, path, rootId, fingerprintCon
|
|
|
1188
1314
|
...(target.workflow_agent_id ? { workflow_agent_id: target.workflow_agent_id } : {}),
|
|
1189
1315
|
},
|
|
1190
1316
|
attestation_id: state.attestation_id,
|
|
1191
|
-
links: { caused_by: [target.
|
|
1317
|
+
links: { caused_by: [target.caused_by_event_id] },
|
|
1192
1318
|
provenance: {
|
|
1193
1319
|
source_event: safeRole([
|
|
1194
1320
|
contextProvenance?.source_event ?? `${input.adapter}.turn-context`,
|
|
@@ -1209,10 +1335,10 @@ function commitTurnContextObservation(input, state, path, rootId, fingerprintCon
|
|
|
1209
1335
|
subject_instance_id: state.instance_id,
|
|
1210
1336
|
},
|
|
1211
1337
|
},
|
|
1212
|
-
// The source sample may precede
|
|
1213
|
-
//
|
|
1214
|
-
//
|
|
1215
|
-
observed_at:
|
|
1338
|
+
// The source sample may precede the hook boundary that admits it.
|
|
1339
|
+
// measurement.measured_at preserves the sample clock without creating a
|
|
1340
|
+
// causal wall-clock regression in the producer event chain.
|
|
1341
|
+
observed_at: target.observed_at,
|
|
1216
1342
|
monotonic_ns: orderedEventMonotonic(state, input.monotonic_ns),
|
|
1217
1343
|
clock_id: state.clock_id,
|
|
1218
1344
|
payload: {
|
|
@@ -1222,6 +1348,113 @@ function commitTurnContextObservation(input, state, path, rootId, fingerprintCon
|
|
|
1222
1348
|
commitEventLocked(input, state, path, event);
|
|
1223
1349
|
maybeAttestContextCapabilityChange(input, state, path, rootId, measurement, contextProvenance);
|
|
1224
1350
|
}
|
|
1351
|
+
/**
|
|
1352
|
+
* Admit fresh adapter-native or bounded runtime context while a turn is open.
|
|
1353
|
+
* Tool completions are safe sampling boundaries. Persistent owner-only cadence
|
|
1354
|
+
* state prevents short-lived hook processes from reading on every request,
|
|
1355
|
+
* and the source witness prevents duplicate public events.
|
|
1356
|
+
*/
|
|
1357
|
+
function maybeCommitActiveRuntimeContextObservation(input, state, path, rootId, fingerprintContext, sourceEvent) {
|
|
1358
|
+
if (input.signal !== "post-tool-use" || state.terminal || !state.current_turn_id) {
|
|
1359
|
+
return;
|
|
1360
|
+
}
|
|
1361
|
+
const nativeSessionId = input.payload.session_id ?? input.payload.conversation_id;
|
|
1362
|
+
const nativeTurnId = input.payload.turn_id ?? state.current_native_turn_id;
|
|
1363
|
+
if (!nativeSessionId || (!nativeTurnId && input.adapter !== "cursor"))
|
|
1364
|
+
return;
|
|
1365
|
+
const now = Date.now();
|
|
1366
|
+
const configuredInterval = input.runtimeTelemetryOptions?.activeContextProbeIntervalMs;
|
|
1367
|
+
const intervalMs = configuredInterval !== undefined && Number.isFinite(configuredInterval)
|
|
1368
|
+
? Math.max(0, Math.floor(configuredInterval))
|
|
1369
|
+
: ACTIVE_RUNTIME_CONTEXT_PROBE_INTERVAL_MS;
|
|
1370
|
+
const prior = state.active_runtime_context_probe;
|
|
1371
|
+
const priorAttempt = prior ? Date.parse(prior.attempted_at) : Number.NaN;
|
|
1372
|
+
if (prior?.turn_id === state.current_turn_id &&
|
|
1373
|
+
prior.boundary === "tool_completed" &&
|
|
1374
|
+
Number.isFinite(priorAttempt) &&
|
|
1375
|
+
now - priorAttempt >= 0 &&
|
|
1376
|
+
now - priorAttempt < intervalMs) {
|
|
1377
|
+
return;
|
|
1378
|
+
}
|
|
1379
|
+
state.active_runtime_context_probe = {
|
|
1380
|
+
turn_id: state.current_turn_id,
|
|
1381
|
+
attempted_at: new Date(now).toISOString(),
|
|
1382
|
+
boundary: "tool_completed",
|
|
1383
|
+
};
|
|
1384
|
+
const native = extractTurnTelemetryV3(input.adapter, input.payload.raw, sourceEvent.time.observed_at).context;
|
|
1385
|
+
if (native.state === "observed") {
|
|
1386
|
+
commitActiveContextObservation(input, state, path, rootId, fingerprintContext, sourceEvent, native, nativeContextProvenance(input, state, native));
|
|
1387
|
+
return;
|
|
1388
|
+
}
|
|
1389
|
+
if (input.adapter === "cursor" && state.cursor_mode === "cloud") {
|
|
1390
|
+
publishProducerState(path, state);
|
|
1391
|
+
return;
|
|
1392
|
+
}
|
|
1393
|
+
const transcriptPath = runtimeTranscriptPath(input, state);
|
|
1394
|
+
if (!transcriptPath && input.adapter !== "cursor") {
|
|
1395
|
+
publishProducerState(path, state);
|
|
1396
|
+
return;
|
|
1397
|
+
}
|
|
1398
|
+
const runtime = readRuntimeContextTelemetry({
|
|
1399
|
+
adapter: input.adapter,
|
|
1400
|
+
session_id: nativeSessionId,
|
|
1401
|
+
...(nativeTurnId ? { turn_id: nativeTurnId } : {}),
|
|
1402
|
+
...(state.current_turn_span?.opened_at
|
|
1403
|
+
? { turn_started_at: state.current_turn_span.opened_at }
|
|
1404
|
+
: {}),
|
|
1405
|
+
transcript_path: transcriptPath,
|
|
1406
|
+
observed_at: sourceEvent.time.observed_at,
|
|
1407
|
+
mode: "active_turn",
|
|
1408
|
+
}, input.runtimeTelemetryOptions);
|
|
1409
|
+
if (runtime.bytes_read > 0)
|
|
1410
|
+
recordRuntimeTelemetryTiming(state, runtime.io_duration_ms);
|
|
1411
|
+
if (runtime.state !== "observed") {
|
|
1412
|
+
publishProducerState(path, state);
|
|
1413
|
+
return;
|
|
1414
|
+
}
|
|
1415
|
+
commitActiveContextObservation(input, state, path, rootId, fingerprintContext, sourceEvent, runtimeContextObservation(runtime), {
|
|
1416
|
+
source_event: runtime.source_event,
|
|
1417
|
+
source_witness: runtime.source_witness,
|
|
1418
|
+
...(input.adapterVersion ? { runtime_version: input.adapterVersion } : {}),
|
|
1419
|
+
attestation: runtime.attestation,
|
|
1420
|
+
confidence: runtime.confidence,
|
|
1421
|
+
});
|
|
1422
|
+
}
|
|
1423
|
+
function commitActiveContextObservation(input, state, path, rootId, fingerprintContext, sourceEvent, measurement, provenance) {
|
|
1424
|
+
if (!state.current_turn_id)
|
|
1425
|
+
return;
|
|
1426
|
+
const scope = sourceEvent.scope;
|
|
1427
|
+
commitContextObservation(input, state, path, rootId, fingerprintContext, {
|
|
1428
|
+
caused_by_event_id: sourceEvent.event_id,
|
|
1429
|
+
observed_at: sourceEvent.time.observed_at,
|
|
1430
|
+
turn_id: state.current_turn_id,
|
|
1431
|
+
...(scope.run_id ? { run_id: scope.run_id } : {}),
|
|
1432
|
+
...(scope.workflow_id ? { workflow_id: scope.workflow_id } : {}),
|
|
1433
|
+
...(scope.workflow_agent_id ? { workflow_agent_id: scope.workflow_agent_id } : {}),
|
|
1434
|
+
}, measurement, provenance);
|
|
1435
|
+
}
|
|
1436
|
+
function nativeContextProvenance(input, state, measurement) {
|
|
1437
|
+
const { measured_at: _measuredAt, ...stableValue } = measurement.value;
|
|
1438
|
+
const witness = canonicalJsonV3({
|
|
1439
|
+
adapter: input.adapter,
|
|
1440
|
+
session_id: state.session_id,
|
|
1441
|
+
turn_id: state.current_turn_id,
|
|
1442
|
+
value: stableValue,
|
|
1443
|
+
});
|
|
1444
|
+
return {
|
|
1445
|
+
source_event: `${input.adapter}.native_context`,
|
|
1446
|
+
source_witness: createHash("sha256").update(witness).digest("hex"),
|
|
1447
|
+
...(input.adapterVersion ? { runtime_version: input.adapterVersion } : {}),
|
|
1448
|
+
attestation: measurement.attestation,
|
|
1449
|
+
confidence: measurement.confidence,
|
|
1450
|
+
};
|
|
1451
|
+
}
|
|
1452
|
+
function maybeCommitNativeHookContextObservation(input, state, path, rootId, fingerprintContext, sourceEvent) {
|
|
1453
|
+
const measurement = extractTurnTelemetryV3(input.adapter, input.payload.raw, sourceEvent.time.observed_at).context;
|
|
1454
|
+
if (measurement.state !== "observed")
|
|
1455
|
+
return;
|
|
1456
|
+
commitActiveContextObservation(input, state, path, rootId, fingerprintContext, sourceEvent, measurement, nativeContextProvenance(input, state, measurement));
|
|
1457
|
+
}
|
|
1225
1458
|
function maybeAttestContextCapabilityChange(input, state, path, rootId, measurement, provenance) {
|
|
1226
1459
|
const context = measurement.state === "observed"
|
|
1227
1460
|
? {
|
|
@@ -1229,6 +1462,11 @@ function maybeAttestContextCapabilityChange(input, state, path, rootId, measurem
|
|
|
1229
1462
|
source: provenance?.source_event ?? `${input.adapter}.turn_context`,
|
|
1230
1463
|
attestation: provenance?.attestation ?? measurement.attestation,
|
|
1231
1464
|
confidence: provenance?.confidence ?? measurement.confidence,
|
|
1465
|
+
completeness: "used_percent" in measurement.value
|
|
1466
|
+
? "percentage_only"
|
|
1467
|
+
: (provenance?.attestation ?? measurement.attestation) === "inferred"
|
|
1468
|
+
? "inferred"
|
|
1469
|
+
: "exact",
|
|
1232
1470
|
}
|
|
1233
1471
|
: measurement.state === "expected_but_missing"
|
|
1234
1472
|
? { state: "partial", reason: measurement.reason }
|
|
@@ -1268,7 +1506,7 @@ function turnContextTarget(turnTerminal) {
|
|
|
1268
1506
|
...(scope.workflow_agent_id ? { workflow_agent_id: scope.workflow_agent_id } : {}),
|
|
1269
1507
|
};
|
|
1270
1508
|
}
|
|
1271
|
-
function queuePendingRuntimeContext(input, state, target, measurement) {
|
|
1509
|
+
function queuePendingRuntimeContext(input, state, target, measurement, nativeTurnId) {
|
|
1272
1510
|
if (input.adapter !== "codex" ||
|
|
1273
1511
|
!target ||
|
|
1274
1512
|
measurement.state !== "expected_but_missing" ||
|
|
@@ -1276,7 +1514,6 @@ function queuePendingRuntimeContext(input, state, target, measurement) {
|
|
|
1276
1514
|
return;
|
|
1277
1515
|
}
|
|
1278
1516
|
const nativeSessionId = input.payload.session_id ?? input.payload.conversation_id;
|
|
1279
|
-
const nativeTurnId = input.payload.turn_id;
|
|
1280
1517
|
if (!nativeSessionId || !nativeTurnId)
|
|
1281
1518
|
return;
|
|
1282
1519
|
const pending = {
|
|
@@ -1376,17 +1613,37 @@ function retryableRuntimeContextReason(reason) {
|
|
|
1376
1613
|
}
|
|
1377
1614
|
function turnTelemetryForTerminal(input, state, observedAt) {
|
|
1378
1615
|
const native = extractTurnTelemetryV3(input.adapter, input.payload.raw, observedAt);
|
|
1379
|
-
if (native.context.state === "observed"
|
|
1616
|
+
if (native.context.state === "observed")
|
|
1380
1617
|
return native;
|
|
1381
|
-
|
|
1618
|
+
if (input.adapter === "cursor" && state.cursor_mode === "cloud") {
|
|
1619
|
+
return {
|
|
1620
|
+
...native,
|
|
1621
|
+
context: { state: "unsupported", capability: "context_usage" },
|
|
1622
|
+
};
|
|
1623
|
+
}
|
|
1624
|
+
const request = {
|
|
1382
1625
|
adapter: input.adapter,
|
|
1383
1626
|
session_id: input.payload.session_id ?? input.payload.conversation_id,
|
|
1384
1627
|
turn_id: input.payload.turn_id ?? state.current_native_turn_id,
|
|
1385
1628
|
transcript_path: runtimeTranscriptPath(input, state),
|
|
1629
|
+
observed_at: observedAt,
|
|
1386
1630
|
mode: "turn",
|
|
1387
|
-
}
|
|
1631
|
+
};
|
|
1632
|
+
let runtime = readRuntimeContextTelemetry(request, input.runtimeTelemetryOptions);
|
|
1388
1633
|
if (runtime.bytes_read > 0)
|
|
1389
1634
|
recordRuntimeTelemetryTiming(state, runtime.io_duration_ms);
|
|
1635
|
+
if (input.adapter === "codex" &&
|
|
1636
|
+
runtime.state === "partial" &&
|
|
1637
|
+
retryableRuntimeContextReason(runtime.reason)) {
|
|
1638
|
+
for (const delayMs of STOP_RUNTIME_CONTEXT_RETRY_DELAYS_MS) {
|
|
1639
|
+
sleepSync(delayMs);
|
|
1640
|
+
runtime = readRuntimeContextTelemetry(request, input.runtimeTelemetryOptions);
|
|
1641
|
+
if (runtime.bytes_read > 0)
|
|
1642
|
+
recordRuntimeTelemetryTiming(state, runtime.io_duration_ms);
|
|
1643
|
+
if (runtime.state !== "partial" || !retryableRuntimeContextReason(runtime.reason))
|
|
1644
|
+
break;
|
|
1645
|
+
}
|
|
1646
|
+
}
|
|
1390
1647
|
if (runtime.state === "unsupported")
|
|
1391
1648
|
return native;
|
|
1392
1649
|
return {
|
|
@@ -1396,8 +1653,8 @@ function turnTelemetryForTerminal(input, state, observedAt) {
|
|
|
1396
1653
|
source_event: runtime.state === "observed" ? runtime.source_event : `${input.adapter}.runtime_context`,
|
|
1397
1654
|
...(runtime.state === "observed" ? { source_witness: runtime.source_witness } : {}),
|
|
1398
1655
|
...(input.adapterVersion ? { runtime_version: input.adapterVersion } : {}),
|
|
1399
|
-
attestation: "derived",
|
|
1400
|
-
confidence: runtime.state === "observed" ?
|
|
1656
|
+
attestation: runtime.state === "observed" ? runtime.attestation : "derived",
|
|
1657
|
+
confidence: runtime.state === "observed" ? runtime.confidence : "high",
|
|
1401
1658
|
},
|
|
1402
1659
|
};
|
|
1403
1660
|
}
|
|
@@ -1433,6 +1690,19 @@ function runtimeTranscriptPath(input, state) {
|
|
|
1433
1690
|
}
|
|
1434
1691
|
function runtimeContextObservation(runtime) {
|
|
1435
1692
|
if (runtime.state === "observed") {
|
|
1693
|
+
if ("used_percent" in runtime) {
|
|
1694
|
+
return {
|
|
1695
|
+
state: "observed",
|
|
1696
|
+
value: {
|
|
1697
|
+
used_percent: runtime.used_percent,
|
|
1698
|
+
remaining_percent: Math.max(0, 100 - runtime.used_percent),
|
|
1699
|
+
measured_at: runtime.measured_at,
|
|
1700
|
+
method: runtime.method,
|
|
1701
|
+
},
|
|
1702
|
+
attestation: runtime.attestation,
|
|
1703
|
+
confidence: runtime.confidence,
|
|
1704
|
+
};
|
|
1705
|
+
}
|
|
1436
1706
|
return {
|
|
1437
1707
|
state: "observed",
|
|
1438
1708
|
value: {
|
|
@@ -1442,8 +1712,8 @@ function runtimeContextObservation(runtime) {
|
|
|
1442
1712
|
measured_at: runtime.measured_at,
|
|
1443
1713
|
method: runtime.method,
|
|
1444
1714
|
},
|
|
1445
|
-
attestation:
|
|
1446
|
-
confidence:
|
|
1715
|
+
attestation: runtime.attestation,
|
|
1716
|
+
confidence: runtime.confidence,
|
|
1447
1717
|
};
|
|
1448
1718
|
}
|
|
1449
1719
|
return {
|
|
@@ -1888,6 +2158,34 @@ function isCursorPromptBootstrap(input) {
|
|
|
1888
2158
|
(input.payload.conversation_id !== undefined || input.payload.session_id !== undefined) &&
|
|
1889
2159
|
input.payload.turn_id !== undefined);
|
|
1890
2160
|
}
|
|
2161
|
+
/** Privacy-safe environment and recovery provenance for Codex mid-flight
|
|
2162
|
+
* onboarding. WSLENV values are never recorded, only normalized variable
|
|
2163
|
+
* names, and the native session identifier itself remains fingerprinted. */
|
|
2164
|
+
export function codexMidFlightDiagnosticContext(payload, env = process.env) {
|
|
2165
|
+
const wslenv = env.WSLENV?.trim() ?? "";
|
|
2166
|
+
const wslenvNames = [
|
|
2167
|
+
...new Set(wslenv
|
|
2168
|
+
.split(":")
|
|
2169
|
+
.map((entry) => entry.split("/", 1)[0]?.trim() ?? "")
|
|
2170
|
+
.filter((name) => /^[A-Za-z_][A-Za-z0-9_]*$/.test(name))),
|
|
2171
|
+
]
|
|
2172
|
+
.sort()
|
|
2173
|
+
.join(":")
|
|
2174
|
+
.slice(0, 512);
|
|
2175
|
+
const identityRecoverySource = payload.session_id
|
|
2176
|
+
? "native_session_id"
|
|
2177
|
+
: payload.conversation_id
|
|
2178
|
+
? "native_conversation_id"
|
|
2179
|
+
: payload.agent_id
|
|
2180
|
+
? "native_agent_id"
|
|
2181
|
+
: "unavailable";
|
|
2182
|
+
return {
|
|
2183
|
+
thread_id_present: Boolean(env.CODEX_THREAD_ID?.trim()),
|
|
2184
|
+
wslenv_present: wslenv.length > 0,
|
|
2185
|
+
wslenv_names: wslenvNames,
|
|
2186
|
+
identity_recovery_source: identityRecoverySource,
|
|
2187
|
+
};
|
|
2188
|
+
}
|
|
1891
2189
|
function suppressClosedSpanSignal(input, sessionHash, category) {
|
|
1892
2190
|
writeProducerDiagnosticV3(input.coordRoot, category, {
|
|
1893
2191
|
adapter: input.adapter,
|
|
@@ -1909,6 +2207,13 @@ export function recordApprovedSessionEndV3(input) {
|
|
|
1909
2207
|
if (control.state !== input.mode) {
|
|
1910
2208
|
return { state: "gate_closed", reason: control.state };
|
|
1911
2209
|
}
|
|
2210
|
+
input = {
|
|
2211
|
+
...input,
|
|
2212
|
+
writerOptions: {
|
|
2213
|
+
...input.writerOptions,
|
|
2214
|
+
expectedGenesisId: control.genesis.event.payload.genesis_id,
|
|
2215
|
+
},
|
|
2216
|
+
};
|
|
1912
2217
|
const matches = listHookProducerStateRecordsV3(input.coordRoot, { includeTerminal: true }).filter(({ state }) => state.instance_id === input.instance_id && state.generation_id === input.generation_id);
|
|
1913
2218
|
if (matches.length !== 1) {
|
|
1914
2219
|
return {
|
|
@@ -2035,6 +2340,13 @@ export function salvageOpenSpansV3(input) {
|
|
|
2035
2340
|
if (control.state !== input.mode) {
|
|
2036
2341
|
return { state: "gate_closed", reason: control.state };
|
|
2037
2342
|
}
|
|
2343
|
+
input = {
|
|
2344
|
+
...input,
|
|
2345
|
+
writerOptions: {
|
|
2346
|
+
...input.writerOptions,
|
|
2347
|
+
expectedGenesisId: control.genesis.event.payload.genesis_id,
|
|
2348
|
+
},
|
|
2349
|
+
};
|
|
2038
2350
|
const matches = listHookProducerStateRecordsV3(input.coordRoot).filter(({ state }) => state.instance_id === input.instance_id && state.generation_id === input.generation_id);
|
|
2039
2351
|
if (matches.length !== 1) {
|
|
2040
2352
|
return {
|
|
@@ -2121,6 +2433,10 @@ export function listHookProducerStateRecordsV3(coordRoot, options = {}) {
|
|
|
2121
2433
|
for (const name of readdirSync(directory).filter((entry) => /^hid_[a-f0-9]{64}\.json$/.test(entry))) {
|
|
2122
2434
|
const path = join(directory, name);
|
|
2123
2435
|
const state = readProducerState(path);
|
|
2436
|
+
// Skip authorities left behind by a replaced epoch: their sequences and
|
|
2437
|
+
// causal links belong to the archived ledger, not this one.
|
|
2438
|
+
if (state.epoch_genesis_id !== control.genesis.event.payload.genesis_id)
|
|
2439
|
+
continue;
|
|
2124
2440
|
if (!options.includeTerminal && state.terminal)
|
|
2125
2441
|
continue;
|
|
2126
2442
|
records.push({ path, modified_at_ms: lstatSync(path).mtimeMs, state });
|
|
@@ -2137,6 +2453,8 @@ function hookSignalCapability(signal) {
|
|
|
2137
2453
|
return "session_end";
|
|
2138
2454
|
case "user-prompt-submit":
|
|
2139
2455
|
return "prompt";
|
|
2456
|
+
case "after-agent-response":
|
|
2457
|
+
return "assistant_reply_text";
|
|
2140
2458
|
case "stop":
|
|
2141
2459
|
case "stop-failure":
|
|
2142
2460
|
return "turn_completion";
|
|
@@ -2165,7 +2483,66 @@ export function readHookProducerStateV3(coordRoot, adapter, nativeSessionId) {
|
|
|
2165
2483
|
const context = fingerprintContextV3(coordRoot, rootId, undefined, control.genesis.profile.privacy_key_epoch);
|
|
2166
2484
|
const sessionHash = normalizeNativeIdV3(context, `${adapter}.session`, nativeSessionId);
|
|
2167
2485
|
const path = producerStatePath(coordRoot, adapter, sessionHash);
|
|
2168
|
-
|
|
2486
|
+
if (!existsSync(path))
|
|
2487
|
+
return undefined;
|
|
2488
|
+
const state = readProducerState(path);
|
|
2489
|
+
// A state left behind by a replaced epoch is not this epoch's authority.
|
|
2490
|
+
return state.epoch_genesis_id === control.genesis.event.payload.genesis_id ? state : undefined;
|
|
2491
|
+
}
|
|
2492
|
+
/**
|
|
2493
|
+
* Retry one Codex session's owner-only context join without replaying its Stop
|
|
2494
|
+
* signal. Codex appends `task_complete` only after the synchronous Stop hook
|
|
2495
|
+
* exits, so this is invoked by a bounded detached worker after that exit.
|
|
2496
|
+
*/
|
|
2497
|
+
export function reconcilePendingRuntimeContextV3(input) {
|
|
2498
|
+
const control = readEventV3ControlState(input.coordRoot);
|
|
2499
|
+
if (control.state !== input.mode)
|
|
2500
|
+
return { state: "gate_closed" };
|
|
2501
|
+
if (control.state !== "candidate" && control.state !== "active") {
|
|
2502
|
+
return { state: "gate_closed" };
|
|
2503
|
+
}
|
|
2504
|
+
const rootId = control.genesis.event.scope.root_id;
|
|
2505
|
+
const rootContext = fingerprintContextV3(input.coordRoot, rootId, undefined, control.genesis.profile.privacy_key_epoch);
|
|
2506
|
+
const sessionHash = normalizeNativeIdV3(rootContext, "codex.session", input.nativeSessionId);
|
|
2507
|
+
const path = producerStatePath(input.coordRoot, "codex", sessionHash);
|
|
2508
|
+
if (!existsSync(path))
|
|
2509
|
+
return { state: "missing" };
|
|
2510
|
+
const lease = acquireStateLeaseWithRetry(input.coordRoot, path, STATE_LEASE_RETRY_ATTEMPTS);
|
|
2511
|
+
if (!lease)
|
|
2512
|
+
return { state: "busy" };
|
|
2513
|
+
try {
|
|
2514
|
+
const state = readProducerState(path);
|
|
2515
|
+
if (state.epoch_genesis_id !== control.genesis.event.payload.genesis_id) {
|
|
2516
|
+
// The pending contexts belong to a replaced epoch; its archive already
|
|
2517
|
+
// holds everything this producer durably recorded.
|
|
2518
|
+
return { state: "missing" };
|
|
2519
|
+
}
|
|
2520
|
+
if (state.adapter !== "codex" || !state.pending_runtime_contexts?.length) {
|
|
2521
|
+
return { state: "not_pending" };
|
|
2522
|
+
}
|
|
2523
|
+
const context = fingerprintContextV3(input.coordRoot, rootId, state.generation_id, state.privacy_epoch_id);
|
|
2524
|
+
reconcilePendingRuntimeContexts({
|
|
2525
|
+
coordRoot: input.coordRoot,
|
|
2526
|
+
mode: input.mode,
|
|
2527
|
+
signal: "stop",
|
|
2528
|
+
payload: { raw: {}, session_id: input.nativeSessionId },
|
|
2529
|
+
adapter: "codex",
|
|
2530
|
+
instance_id: state.instance_id,
|
|
2531
|
+
producer_id: input.producer_id,
|
|
2532
|
+
build_id: input.build_id,
|
|
2533
|
+
platform: input.platform,
|
|
2534
|
+
observed_at: new Date().toISOString(),
|
|
2535
|
+
runtimeTelemetryOptions: input.runtimeTelemetryOptions,
|
|
2536
|
+
writerOptions: {
|
|
2537
|
+
...input.writerOptions,
|
|
2538
|
+
expectedGenesisId: control.genesis.event.payload.genesis_id,
|
|
2539
|
+
},
|
|
2540
|
+
}, state, path, rootId, context, { deferRetryLimit: true, finalAttempt: input.finalAttempt });
|
|
2541
|
+
return state.pending_runtime_contexts?.length ? { state: "pending" } : { state: "settled" };
|
|
2542
|
+
}
|
|
2543
|
+
finally {
|
|
2544
|
+
lease.release();
|
|
2545
|
+
}
|
|
2169
2546
|
}
|
|
2170
2547
|
/** Resolve one terminal producer only when native session and instance identity agree. */
|
|
2171
2548
|
export function readTerminalHookProducerStateV3(coordRoot, nativeSessionId, instanceId) {
|
|
@@ -2192,6 +2569,8 @@ export function readHookProducerStateByInstanceV3(coordRoot, instanceId) {
|
|
|
2192
2569
|
}
|
|
2193
2570
|
for (const name of readdirSync(directory).filter((entry) => /^hid_[a-f0-9]{64}\.json$/.test(entry))) {
|
|
2194
2571
|
const state = readProducerState(join(directory, name));
|
|
2572
|
+
if (state.epoch_genesis_id !== control.genesis.event.payload.genesis_id)
|
|
2573
|
+
continue;
|
|
2195
2574
|
if (state.instance_id === instanceId && !state.terminal)
|
|
2196
2575
|
matches.push(state);
|
|
2197
2576
|
}
|
|
@@ -2213,7 +2592,7 @@ export function readJoinableHookProducerStateV3(coordRoot, adapter, nativeSessio
|
|
|
2213
2592
|
const byInstance = readHookProducerStateByInstanceV3(coordRoot, instanceId);
|
|
2214
2593
|
return byInstance?.adapter === adapter && !byInstance.terminal ? byInstance : undefined;
|
|
2215
2594
|
}
|
|
2216
|
-
function newProducerState(input, sessionId, epochId, boundaryEventId) {
|
|
2595
|
+
function newProducerState(input, sessionId, epochId, boundaryEventId, genesisId) {
|
|
2217
2596
|
const bootId = `boot_${randomUUID()}`;
|
|
2218
2597
|
return {
|
|
2219
2598
|
format: STATE_FORMAT,
|
|
@@ -2226,6 +2605,7 @@ function newProducerState(input, sessionId, epochId, boundaryEventId) {
|
|
|
2226
2605
|
capability_profile: adapterCapabilityProfileDigestV3(input.adapter),
|
|
2227
2606
|
cursor_mode: input.adapter === "cursor" ? (input.payload.cursor_mode ?? "unknown") : undefined,
|
|
2228
2607
|
privacy_epoch_id: epochId,
|
|
2608
|
+
epoch_genesis_id: genesisId,
|
|
2229
2609
|
boot_id: bootId,
|
|
2230
2610
|
clock_id: clockIdV3(),
|
|
2231
2611
|
next_sequence: 1,
|
|
@@ -2236,6 +2616,7 @@ function newProducerState(input, sessionId, epochId, boundaryEventId) {
|
|
|
2236
2616
|
boot_id: bootId,
|
|
2237
2617
|
clock: signalClock(input),
|
|
2238
2618
|
}),
|
|
2619
|
+
session_start_derivation: input.session_start_derivation,
|
|
2239
2620
|
terminal: false,
|
|
2240
2621
|
spans: [],
|
|
2241
2622
|
delegations: [],
|
|
@@ -2267,6 +2648,8 @@ function applyCommittedEvent(state, event) {
|
|
|
2267
2648
|
if (event.event_type === "turn.started") {
|
|
2268
2649
|
const nextTurnId = event.scope.turn_id;
|
|
2269
2650
|
state.current_turn_id = nextTurnId;
|
|
2651
|
+
state.cursor_response_ritual = undefined;
|
|
2652
|
+
state.session_start_derivation = undefined;
|
|
2270
2653
|
if (state.tool_call_count_turn_id !== nextTurnId) {
|
|
2271
2654
|
state.tool_call_count = 0;
|
|
2272
2655
|
state.tool_call_count_turn_id = nextTurnId;
|
|
@@ -2343,6 +2726,7 @@ function applyCommittedEvent(state, event) {
|
|
|
2343
2726
|
}
|
|
2344
2727
|
state.current_turn_id = undefined;
|
|
2345
2728
|
state.current_native_turn_id = undefined;
|
|
2729
|
+
state.cursor_response_ritual = undefined;
|
|
2346
2730
|
state.current_turn_span = undefined;
|
|
2347
2731
|
state.tool_call_count = 0;
|
|
2348
2732
|
state.tool_call_count_turn_id = undefined;
|
|
@@ -2581,6 +2965,7 @@ function readProducerState(path) {
|
|
|
2581
2965
|
if (state.adapter === "cursor")
|
|
2582
2966
|
state.cursor_mode ??= "unknown";
|
|
2583
2967
|
const allowedKeys = new Set([
|
|
2968
|
+
"active_runtime_context_probe",
|
|
2584
2969
|
"adapter",
|
|
2585
2970
|
"attestation_id",
|
|
2586
2971
|
"boot_id",
|
|
@@ -2592,7 +2977,9 @@ function readProducerState(path) {
|
|
|
2592
2977
|
"current_native_turn_id",
|
|
2593
2978
|
"current_turn_span",
|
|
2594
2979
|
"cursor_mode",
|
|
2980
|
+
"cursor_response_ritual",
|
|
2595
2981
|
"delegations",
|
|
2982
|
+
"epoch_genesis_id",
|
|
2596
2983
|
"format",
|
|
2597
2984
|
"format_version",
|
|
2598
2985
|
"generation_id",
|
|
@@ -2602,6 +2989,7 @@ function readProducerState(path) {
|
|
|
2602
2989
|
"last_attested_telemetry",
|
|
2603
2990
|
"last_attested_tuning",
|
|
2604
2991
|
"last_attested_tuning_observation",
|
|
2992
|
+
"last_context_source_witness",
|
|
2605
2993
|
"tuning_probe_turn_id",
|
|
2606
2994
|
"last_event_id",
|
|
2607
2995
|
"last_monotonic_ns",
|
|
@@ -2612,6 +3000,7 @@ function readProducerState(path) {
|
|
|
2612
3000
|
"runtime_transcript_path",
|
|
2613
3001
|
"privacy_epoch_id",
|
|
2614
3002
|
"session_id",
|
|
3003
|
+
"session_start_derivation",
|
|
2615
3004
|
"session_span",
|
|
2616
3005
|
"spans",
|
|
2617
3006
|
"started_event_id",
|
|
@@ -2634,6 +3023,7 @@ function readProducerState(path) {
|
|
|
2634
3023
|
!/^att_[0-9a-f-]{36}$/.test(state.attestation_id) ||
|
|
2635
3024
|
!/^cap_[a-f0-9]{64}$/.test(state.capability_profile) ||
|
|
2636
3025
|
!/^pep_[a-zA-Z0-9._-]+$/.test(state.privacy_epoch_id) ||
|
|
3026
|
+
(state.epoch_genesis_id !== undefined && !/^gex_[0-9a-f-]{36}$/.test(state.epoch_genesis_id)) ||
|
|
2637
3027
|
!/^boot_[a-zA-Z0-9._-]+$/.test(state.boot_id) ||
|
|
2638
3028
|
!/^clk_[0-9a-f-]{36}$/.test(state.clock_id) ||
|
|
2639
3029
|
!Number.isSafeInteger(state.next_sequence) ||
|
|
@@ -2692,16 +3082,32 @@ function readProducerState(path) {
|
|
|
2692
3082
|
(typeof state.current_native_turn_id !== "string" ||
|
|
2693
3083
|
state.current_native_turn_id.length === 0 ||
|
|
2694
3084
|
state.current_native_turn_id.length > 512)) ||
|
|
3085
|
+
(state.cursor_response_ritual !== undefined &&
|
|
3086
|
+
(!/^tid_[a-f0-9]{64}$/.test(state.cursor_response_ritual.turn_id) ||
|
|
3087
|
+
(state.cursor_response_ritual.native_turn_id !== undefined &&
|
|
3088
|
+
(typeof state.cursor_response_ritual.native_turn_id !== "string" ||
|
|
3089
|
+
state.cursor_response_ritual.native_turn_id.length === 0 ||
|
|
3090
|
+
state.cursor_response_ritual.native_turn_id.length > 512)) ||
|
|
3091
|
+
!Number.isFinite(Date.parse(state.cursor_response_ritual.observed_at)) ||
|
|
3092
|
+
typeof state.cursor_response_ritual.status_box_present !== "boolean" ||
|
|
3093
|
+
typeof state.cursor_response_ritual.status_box_present_strict !== "boolean")) ||
|
|
2695
3094
|
(state.last_event_id !== undefined && !/^evt_[0-9a-f-]{36}$/.test(state.last_event_id)) ||
|
|
2696
3095
|
(state.last_monotonic_ns !== undefined && !/^\d+$/.test(state.last_monotonic_ns)) ||
|
|
2697
3096
|
(state.last_observed_at !== undefined &&
|
|
2698
3097
|
!Number.isFinite(Date.parse(state.last_observed_at))) ||
|
|
2699
3098
|
(state.started_event_id !== undefined && !/^evt_[0-9a-f-]{36}$/.test(state.started_event_id)) ||
|
|
3099
|
+
(state.session_start_derivation !== undefined &&
|
|
3100
|
+
state.session_start_derivation !== "approved_lifecycle_reopen" &&
|
|
3101
|
+
state.session_start_derivation !== "validated_current_session_heal") ||
|
|
2700
3102
|
(state.pending_runtime_contexts !== undefined &&
|
|
2701
3103
|
(!Array.isArray(state.pending_runtime_contexts) ||
|
|
2702
3104
|
state.pending_runtime_contexts.length === 0 ||
|
|
2703
3105
|
state.pending_runtime_contexts.length > PENDING_RUNTIME_CONTEXT_CAP ||
|
|
2704
3106
|
state.pending_runtime_contexts.some((pending) => !validPendingRuntimeContext(pending)))) ||
|
|
3107
|
+
(state.active_runtime_context_probe !== undefined &&
|
|
3108
|
+
!validActiveRuntimeContextProbe(state.active_runtime_context_probe)) ||
|
|
3109
|
+
(state.last_context_source_witness !== undefined &&
|
|
3110
|
+
!/^[a-f0-9]{64}$/.test(state.last_context_source_witness)) ||
|
|
2705
3111
|
(state.runtime_transcript_path !== undefined &&
|
|
2706
3112
|
(typeof state.runtime_transcript_path !== "string" ||
|
|
2707
3113
|
state.runtime_transcript_path.length === 0 ||
|
|
@@ -2799,6 +3205,16 @@ function validPendingRuntimeContext(value) {
|
|
|
2799
3205
|
pending.attempts >= 0 &&
|
|
2800
3206
|
pending.attempts < RUNTIME_CONTEXT_RETRY_LIMIT);
|
|
2801
3207
|
}
|
|
3208
|
+
function validActiveRuntimeContextProbe(value) {
|
|
3209
|
+
if (!value || typeof value !== "object" || Array.isArray(value))
|
|
3210
|
+
return false;
|
|
3211
|
+
const probe = value;
|
|
3212
|
+
return (typeof probe.turn_id === "string" &&
|
|
3213
|
+
/^tid_[a-f0-9]{64}$/.test(probe.turn_id) &&
|
|
3214
|
+
typeof probe.attempted_at === "string" &&
|
|
3215
|
+
Number.isFinite(Date.parse(probe.attempted_at)) &&
|
|
3216
|
+
(probe.boundary === undefined || probe.boundary === "tool_completed"));
|
|
3217
|
+
}
|
|
2802
3218
|
function pidIsAlive(pid) {
|
|
2803
3219
|
if (!Number.isSafeInteger(pid) || pid < 1)
|
|
2804
3220
|
return false;
|