harnery 0.38.0 → 0.40.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/commands/agents.d.ts.map +1 -1
- package/dist/commands/agents.js +32 -8
- package/dist/commands/artifacts.d.ts.map +1 -1
- package/dist/commands/artifacts.js +97 -6
- package/dist/commands/backup.d.ts +16 -0
- package/dist/commands/backup.d.ts.map +1 -1
- package/dist/commands/backup.js +239 -33
- package/dist/commands/browse.d.ts +8 -0
- package/dist/commands/browse.d.ts.map +1 -1
- package/dist/commands/browse.js +466 -231
- package/dist/commands/diagnostics.d.ts.map +1 -1
- package/dist/commands/diagnostics.js +6 -3
- package/dist/commands/ledger-v3.d.ts.map +1 -1
- package/dist/commands/ledger-v3.js +20 -4
- package/dist/commands/qa-run.d.ts.map +1 -1
- package/dist/commands/qa-run.js +26 -3
- package/dist/commands/qa-status.d.ts.map +1 -1
- package/dist/commands/qa-status.js +7 -2
- package/dist/commands/resources.d.ts.map +1 -1
- package/dist/commands/resources.js +23 -3
- package/dist/commands/review-pack.d.ts.map +1 -1
- package/dist/commands/review-pack.js +98 -23
- package/dist/commands/tunnel.d.ts.map +1 -1
- package/dist/commands/tunnel.js +2 -2
- package/dist/core/adapters/profiles.d.ts +1 -1
- package/dist/core/agents/canonical-emit.d.ts +3 -2
- package/dist/core/agents/canonical-emit.d.ts.map +1 -1
- package/dist/core/agents/canonical-emit.js +2 -0
- package/dist/core/agents/cli.js +13 -6
- package/dist/core/agents/live-authority-v3.d.ts.map +1 -1
- package/dist/core/agents/live-authority-v3.js +5 -3
- package/dist/core/agents/live-lifecycle-v3.d.ts +2 -2
- package/dist/core/agents/live-lifecycle-v3.d.ts.map +1 -1
- package/dist/core/agents/render/prompt-context.d.ts +7 -5
- package/dist/core/agents/render/prompt-context.d.ts.map +1 -1
- package/dist/core/agents/render/prompt-context.js +63 -8
- package/dist/core/agents/session-finalizer-v3.d.ts +2 -2
- package/dist/core/agents/session-finalizer-v3.d.ts.map +1 -1
- package/dist/core/agents/state/live-coordination-view.d.ts +3 -3
- package/dist/core/agents/state/live-coordination-view.d.ts.map +1 -1
- package/dist/core/agents/state/live-coordination-view.js +2 -1
- package/dist/core/agents/state/names.d.ts +35 -2
- package/dist/core/agents/state/names.d.ts.map +1 -1
- package/dist/core/agents/state/names.js +80 -5
- package/dist/core/agents/state/stale-sweep.d.ts +2 -1
- package/dist/core/agents/state/stale-sweep.d.ts.map +1 -1
- package/dist/core/agents/state/stale-sweep.js +23 -6
- package/dist/core/agents/turn-elapsed.d.ts +51 -0
- package/dist/core/agents/turn-elapsed.d.ts.map +1 -0
- package/dist/core/agents/turn-elapsed.js +91 -0
- package/dist/core/artifacts/activity.d.ts +14 -0
- package/dist/core/artifacts/activity.d.ts.map +1 -0
- package/dist/core/artifacts/activity.js +52 -0
- package/dist/core/artifacts/delivery-card.d.ts +39 -0
- package/dist/core/artifacts/delivery-card.d.ts.map +1 -0
- package/dist/core/artifacts/delivery-card.js +282 -0
- package/dist/core/artifacts/index.d.ts +42 -7
- package/dist/core/artifacts/index.d.ts.map +1 -1
- package/dist/core/artifacts/index.js +288 -76
- package/dist/core/artifacts/mutation-lock.d.ts +2 -0
- package/dist/core/artifacts/mutation-lock.d.ts.map +1 -0
- package/dist/core/artifacts/mutation-lock.js +91 -0
- package/dist/core/backup/host-snapshot.d.ts +18 -0
- package/dist/core/backup/host-snapshot.d.ts.map +1 -0
- package/dist/core/backup/host-snapshot.js +64 -0
- package/dist/core/config.d.ts +20 -5
- package/dist/core/config.d.ts.map +1 -1
- package/dist/core/config.js +44 -10
- package/dist/core/diagnostics/advice.d.ts +38 -3
- package/dist/core/diagnostics/advice.d.ts.map +1 -1
- package/dist/core/diagnostics/advice.js +103 -99
- package/dist/core/diagnostics/bundle.d.ts.map +1 -1
- package/dist/core/diagnostics/bundle.js +111 -47
- package/dist/core/diagnostics/comparison.d.ts.map +1 -1
- package/dist/core/diagnostics/comparison.js +3 -2
- package/dist/core/diagnostics/contract.d.ts +15 -31
- package/dist/core/diagnostics/contract.d.ts.map +1 -1
- package/dist/core/diagnostics/contract.js +2 -5
- package/dist/core/diagnostics/index.d.ts +2 -0
- package/dist/core/diagnostics/index.d.ts.map +1 -1
- package/dist/core/diagnostics/index.js +2 -0
- package/dist/core/diagnostics/pressure-contract.d.ts +260 -0
- package/dist/core/diagnostics/pressure-contract.d.ts.map +1 -0
- package/dist/core/diagnostics/pressure-contract.js +70 -0
- package/dist/core/diagnostics/pressure.d.ts +25 -0
- package/dist/core/diagnostics/pressure.d.ts.map +1 -0
- package/dist/core/diagnostics/pressure.js +1138 -0
- package/dist/core/diagnostics/replay.d.ts.map +1 -1
- package/dist/core/diagnostics/replay.js +90 -10
- package/dist/core/events/v3/adapter-id.d.ts +6 -0
- package/dist/core/events/v3/adapter-id.d.ts.map +1 -0
- package/dist/core/events/v3/adapter-id.js +7 -0
- package/dist/core/events/v3/archive-retention.d.ts.map +1 -1
- package/dist/core/events/v3/archive-retention.js +3 -2
- package/dist/core/events/v3/bootstrap.d.ts +41 -4
- package/dist/core/events/v3/bootstrap.d.ts.map +1 -1
- package/dist/core/events/v3/bootstrap.js +120 -17
- package/dist/core/events/v3/capabilities.d.ts +16 -9
- package/dist/core/events/v3/capabilities.d.ts.map +1 -1
- package/dist/core/events/v3/capabilities.js +37 -2
- package/dist/core/events/v3/capability-drift.d.ts +2 -2
- package/dist/core/events/v3/capability-drift.d.ts.map +1 -1
- package/dist/core/events/v3/control-witness.d.ts +48 -5
- package/dist/core/events/v3/control-witness.d.ts.map +1 -1
- package/dist/core/events/v3/control-witness.js +91 -36
- package/dist/core/events/v3/control.d.ts.map +1 -1
- package/dist/core/events/v3/control.js +22 -2
- package/dist/core/events/v3/index.d.ts +2 -1
- package/dist/core/events/v3/index.d.ts.map +1 -1
- package/dist/core/events/v3/index.js +2 -1
- package/dist/core/events/v3/live-feed.d.ts +7 -1
- package/dist/core/events/v3/live-feed.d.ts.map +1 -1
- package/dist/core/events/v3/live-feed.js +21 -3
- package/dist/core/events/v3/live-routing.d.ts.map +1 -1
- package/dist/core/events/v3/live-routing.js +10 -2
- package/dist/core/events/v3/producers/command-recorder.d.ts +2 -2
- package/dist/core/events/v3/producers/command-recorder.d.ts.map +1 -1
- package/dist/core/events/v3/producers/command-recorder.js +2 -1
- package/dist/core/events/v3/producers/coordination-recorder.d.ts +2 -2
- package/dist/core/events/v3/producers/coordination-recorder.d.ts.map +1 -1
- package/dist/core/events/v3/producers/coordination-recorder.js +2 -1
- package/dist/core/events/v3/producers/hook-base.d.ts +2 -2
- package/dist/core/events/v3/producers/hook-base.d.ts.map +1 -1
- package/dist/core/events/v3/producers/hook-base.js +15 -5
- package/dist/core/events/v3/producers/hook.d.ts.map +1 -1
- package/dist/core/events/v3/producers/hook.js +17 -4
- package/dist/core/events/v3/producers/intake.d.ts +4 -4
- package/dist/core/events/v3/producers/intake.d.ts.map +1 -1
- package/dist/core/events/v3/producers/intake.js +3 -2
- package/dist/core/events/v3/producers/producer-state-observer.d.ts.map +1 -1
- package/dist/core/events/v3/producers/producer-state-observer.js +2 -1
- package/dist/core/events/v3/producers/recorder.d.ts +16 -5
- package/dist/core/events/v3/producers/recorder.d.ts.map +1 -1
- package/dist/core/events/v3/producers/recorder.js +31 -9
- package/dist/core/events/v3/reader.d.ts.map +1 -1
- package/dist/core/events/v3/reader.js +10 -13
- package/dist/core/events/v3/runtime-build.d.ts.map +1 -1
- package/dist/core/events/v3/runtime-build.js +3 -2
- package/dist/core/events/v3/runtime-telemetry-capabilities.d.ts +2 -2
- package/dist/core/events/v3/runtime-telemetry-capabilities.d.ts.map +1 -1
- package/dist/core/events/v3/turn-telemetry.d.ts +2 -2
- package/dist/core/events/v3/turn-telemetry.d.ts.map +1 -1
- package/dist/core/hooks/adapter/output.d.ts +16 -14
- package/dist/core/hooks/adapter/output.d.ts.map +1 -1
- package/dist/core/hooks/adapter/output.js +36 -38
- package/dist/core/hooks/backup-schedule.d.ts +34 -0
- package/dist/core/hooks/backup-schedule.d.ts.map +1 -0
- package/dist/core/hooks/backup-schedule.js +114 -0
- package/dist/core/hooks/cli.js +61 -18
- package/dist/core/hooks/codex-wsl-bridge.d.ts +2 -0
- package/dist/core/hooks/codex-wsl-bridge.d.ts.map +1 -1
- package/dist/core/hooks/codex-wsl-bridge.js +18 -4
- package/dist/core/hooks/index.d.ts +1 -0
- package/dist/core/hooks/index.d.ts.map +1 -1
- package/dist/core/hooks/index.js +1 -0
- package/dist/core/hooks/prompt-context/contract.d.ts +61 -0
- package/dist/core/hooks/prompt-context/contract.d.ts.map +1 -0
- package/dist/core/hooks/prompt-context/contract.js +102 -0
- package/dist/core/hooks/prompt-context/index.d.ts +5 -0
- package/dist/core/hooks/prompt-context/index.d.ts.map +1 -0
- package/dist/core/hooks/prompt-context/index.js +2 -0
- package/dist/core/hooks/prompt-context/runner.d.ts +24 -0
- package/dist/core/hooks/prompt-context/runner.d.ts.map +1 -0
- package/dist/core/hooks/prompt-context/runner.js +249 -0
- package/dist/core/qa-artifacts.d.ts +3 -0
- package/dist/core/qa-artifacts.d.ts.map +1 -1
- package/dist/core/qa-artifacts.js +25 -3
- package/dist/core/resources/contract.d.ts +69 -3
- package/dist/core/resources/contract.d.ts.map +1 -1
- package/dist/core/resources/contract.js +1 -1
- package/dist/core/resources/index.d.ts +1 -0
- package/dist/core/resources/index.d.ts.map +1 -1
- package/dist/core/resources/index.js +1 -0
- package/dist/core/resources/native.d.ts +36 -0
- package/dist/core/resources/native.d.ts.map +1 -0
- package/dist/core/resources/native.js +418 -0
- package/dist/core/resources/sampler.d.ts +2 -0
- package/dist/core/resources/sampler.d.ts.map +1 -1
- package/dist/core/resources/sampler.js +31 -1
- package/dist/core/resources/status.d.ts +61 -0
- package/dist/core/resources/status.d.ts.map +1 -0
- package/dist/core/resources/status.js +536 -0
- package/dist/core/resources/system.d.ts +27 -0
- package/dist/core/resources/system.d.ts.map +1 -0
- package/dist/core/resources/system.js +439 -0
- package/dist/core/semantic/contract.d.ts +13 -13
- package/dist/core/semantic/service.d.ts +2 -0
- package/dist/core/semantic/service.d.ts.map +1 -1
- package/dist/core/semantic/service.js +27 -4
- package/dist/core/storage/builtins.js +41 -0
- package/dist/core/supervisor/contract.d.ts +41 -3
- package/dist/core/supervisor/contract.d.ts.map +1 -1
- package/dist/core/supervisor/contract.js +3 -2
- package/dist/core/supervisor/findings.d.ts +3 -0
- package/dist/core/supervisor/findings.d.ts.map +1 -1
- package/dist/core/supervisor/findings.js +88 -0
- package/dist/core/supervisor/history.d.ts.map +1 -1
- package/dist/core/supervisor/history.js +14 -0
- package/dist/core/supervisor/ledger-state.d.ts +55 -0
- package/dist/core/supervisor/ledger-state.d.ts.map +1 -0
- package/dist/core/supervisor/ledger-state.js +0 -0
- package/dist/core/supervisor/service.d.ts.map +1 -1
- package/dist/core/supervisor/service.js +120 -7
- package/dist/core/supervisor/storage.d.ts +3 -1
- package/dist/core/supervisor/storage.d.ts.map +1 -1
- package/dist/core/supervisor/storage.js +4 -0
- package/dist/core/workflow/admission.d.ts +3 -0
- package/dist/core/workflow/admission.d.ts.map +1 -1
- package/dist/core/workflow/admission.js +28 -16
- package/dist/core/workflow/engine.js +2 -2
- package/dist/core/workflow/live-session-v3.d.ts.map +1 -1
- package/dist/core/workflow/live-session-v3.js +6 -1
- package/dist/core/workflow/proof.d.ts.map +1 -1
- package/dist/core/workflow/proof.js +4 -3
- package/dist/lib/browser/capture-fidelity.d.ts +7 -0
- package/dist/lib/browser/capture-fidelity.d.ts.map +1 -1
- package/dist/lib/browser/capture-fidelity.js +17 -0
- package/dist/lib/browser/client.d.ts +9 -0
- package/dist/lib/browser/client.d.ts.map +1 -1
- package/dist/lib/browser/client.js +85 -37
- package/dist/lib/browser/index.d.ts +3 -1
- package/dist/lib/browser/index.d.ts.map +1 -1
- package/dist/lib/browser/index.js +2 -1
- package/dist/lib/browser/page-review-budget.d.ts +13 -0
- package/dist/lib/browser/page-review-budget.d.ts.map +1 -0
- package/dist/lib/browser/page-review-budget.js +251 -0
- package/dist/lib/browser/page-review-contracts.d.ts +127 -0
- package/dist/lib/browser/page-review-contracts.d.ts.map +1 -0
- package/dist/lib/browser/page-review-contracts.js +5 -0
- package/dist/lib/browser/page-review-evidence.d.ts +48 -0
- package/dist/lib/browser/page-review-evidence.d.ts.map +1 -0
- package/dist/lib/browser/page-review-evidence.js +340 -0
- package/dist/lib/browser/page-review-judge.d.ts +1 -1
- package/dist/lib/browser/page-review-judge.d.ts.map +1 -1
- package/dist/lib/browser/page-review-judge.js +46 -38
- package/dist/lib/browser/page-review-pack.d.ts +44 -22
- package/dist/lib/browser/page-review-pack.d.ts.map +1 -1
- package/dist/lib/browser/page-review-pack.js +116 -36
- package/dist/lib/browser/page-review-source.d.ts +12 -0
- package/dist/lib/browser/page-review-source.d.ts.map +1 -0
- package/dist/lib/browser/page-review-source.js +22 -0
- package/dist/lib/browser/qa-run-contracts.d.ts +35 -9
- package/dist/lib/browser/qa-run-contracts.d.ts.map +1 -1
- package/dist/lib/browser/qa-run-contracts.js +48 -14
- package/dist/lib/browser/qa-run.d.ts.map +1 -1
- package/dist/lib/browser/qa-run.js +215 -68
- package/dist/lib/browser/qa-snapshot.d.ts +6 -0
- package/dist/lib/browser/qa-snapshot.d.ts.map +1 -1
- package/dist/lib/browser/qa-snapshot.js +259 -48
- package/dist/lib/browser/review-capture-transaction.d.ts +13 -0
- package/dist/lib/browser/review-capture-transaction.d.ts.map +1 -0
- package/dist/lib/browser/review-capture-transaction.js +79 -0
- package/dist/lib/browser/standalone-html.d.ts.map +1 -1
- package/dist/lib/browser/standalone-html.js +4 -2
- package/dist/lib/browser/thumbnail-association.d.ts +34 -0
- package/dist/lib/browser/thumbnail-association.d.ts.map +1 -0
- package/dist/lib/browser/thumbnail-association.js +158 -0
- package/dist/lib/browser/tiling.d.ts +30 -0
- package/dist/lib/browser/tiling.d.ts.map +1 -1
- package/dist/lib/browser/tiling.js +38 -0
- package/dist/lib/docs-metadata-managed.d.ts.map +1 -1
- package/dist/lib/docs-metadata-managed.js +4 -1
- package/dist/lib/identities/assume.d.ts.map +1 -1
- package/dist/lib/identities/assume.js +7 -1
- package/dist/lib/instructions/templates.d.ts.map +1 -1
- package/dist/lib/instructions/templates.js +1 -0
- package/dist/lib/local-file-url.d.ts +12 -0
- package/dist/lib/local-file-url.d.ts.map +1 -1
- package/dist/lib/local-file-url.js +16 -2
- package/dist/lib/tunnel/state.d.ts +19 -4
- package/dist/lib/tunnel/state.d.ts.map +1 -1
- package/dist/lib/tunnel/state.js +53 -13
- package/package.json +7 -4
- package/schemas/config.schema.json +69 -2
- package/src/commands/agents.ts +42 -9
- package/src/commands/artifacts.ts +130 -6
- package/src/commands/backup.ts +287 -34
- package/src/commands/browse.ts +564 -267
- package/src/commands/diagnostics.ts +6 -3
- package/src/commands/ledger-v3.ts +20 -3
- package/src/commands/qa-run.ts +37 -3
- package/src/commands/qa-status.ts +11 -2
- package/src/commands/resources.ts +23 -3
- package/src/commands/review-pack.ts +165 -62
- package/src/commands/tunnel.ts +2 -1
- package/src/core/agents/canonical-emit.ts +4 -2
- package/src/core/agents/cli.ts +14 -6
- package/src/core/agents/live-authority-v3.ts +7 -3
- package/src/core/agents/live-lifecycle-v3.ts +2 -2
- package/src/core/agents/render/prompt-context.ts +68 -14
- package/src/core/agents/session-finalizer-v3.ts +2 -2
- package/src/core/agents/state/live-coordination-view.ts +4 -4
- package/src/core/agents/state/names.ts +92 -7
- package/src/core/agents/state/stale-sweep.ts +22 -8
- package/src/core/agents/turn-elapsed.ts +135 -0
- package/src/core/artifacts/activity.ts +71 -0
- package/src/core/artifacts/delivery-card.ts +375 -0
- package/src/core/artifacts/index.ts +385 -91
- package/src/core/artifacts/mutation-lock.ts +106 -0
- package/src/core/backup/host-snapshot.ts +76 -0
- package/src/core/config.ts +66 -13
- package/src/core/diagnostics/advice.ts +148 -120
- package/src/core/diagnostics/bundle.ts +138 -52
- package/src/core/diagnostics/comparison.ts +6 -2
- package/src/core/diagnostics/contract.ts +39 -42
- package/src/core/diagnostics/index.ts +2 -0
- package/src/core/diagnostics/pressure-contract.ts +294 -0
- package/src/core/diagnostics/pressure.ts +1361 -0
- package/src/core/diagnostics/replay.ts +116 -11
- package/src/core/events/v3/adapter-id.ts +12 -0
- package/src/core/events/v3/archive-retention.ts +3 -6
- package/src/core/events/v3/bootstrap.ts +163 -16
- package/src/core/events/v3/capabilities.ts +75 -25
- package/src/core/events/v3/capability-drift.ts +2 -2
- package/src/core/events/v3/control-witness.ts +172 -41
- package/src/core/events/v3/control.ts +34 -2
- package/src/core/events/v3/index.ts +3 -0
- package/src/core/events/v3/live-feed.ts +23 -5
- package/src/core/events/v3/live-routing.ts +14 -2
- package/src/core/events/v3/producers/command-recorder.ts +4 -4
- package/src/core/events/v3/producers/coordination-recorder.ts +4 -4
- package/src/core/events/v3/producers/hook-base.ts +21 -16
- package/src/core/events/v3/producers/hook.ts +21 -4
- package/src/core/events/v3/producers/intake.ts +6 -6
- package/src/core/events/v3/producers/producer-state-observer.ts +2 -1
- package/src/core/events/v3/producers/recorder.ts +50 -21
- package/src/core/events/v3/reader.ts +14 -13
- package/src/core/events/v3/runtime-build.ts +3 -2
- package/src/core/events/v3/runtime-telemetry-capabilities.ts +3 -3
- package/src/core/events/v3/turn-telemetry.ts +4 -4
- package/src/core/hooks/adapter/output.ts +50 -36
- package/src/core/hooks/backup-schedule.ts +147 -0
- package/src/core/hooks/cli.ts +65 -14
- package/src/core/hooks/codex-wsl-bridge.ts +21 -5
- package/src/core/hooks/index.ts +1 -0
- package/src/core/hooks/prompt-context/contract.ts +177 -0
- package/src/core/hooks/prompt-context/index.ts +22 -0
- package/src/core/hooks/prompt-context/runner.ts +303 -0
- package/src/core/qa-artifacts.ts +29 -3
- package/src/core/resources/contract.ts +76 -3
- package/src/core/resources/index.ts +1 -0
- package/src/core/resources/native.ts +481 -0
- package/src/core/resources/sampler.ts +46 -1
- package/src/core/resources/status.ts +717 -0
- package/src/core/resources/system.ts +530 -0
- package/src/core/semantic/service.ts +37 -3
- package/src/core/storage/builtins.ts +41 -0
- package/src/core/supervisor/contract.ts +45 -3
- package/src/core/supervisor/findings.ts +159 -0
- package/src/core/supervisor/history.ts +15 -0
- package/src/core/supervisor/ledger-state.ts +0 -0
- package/src/core/supervisor/service.ts +133 -5
- package/src/core/supervisor/storage.ts +7 -0
- package/src/core/workflow/admission.ts +33 -17
- package/src/core/workflow/engine.ts +2 -2
- package/src/core/workflow/live-session-v3.ts +6 -8
- package/src/core/workflow/proof.ts +4 -3
- package/src/lib/browser/capture-fidelity.ts +23 -0
- package/src/lib/browser/client.ts +96 -44
- package/src/lib/browser/index.ts +15 -1
- package/src/lib/browser/page-review-budget.ts +309 -0
- package/src/lib/browser/page-review-contracts.ts +129 -0
- package/src/lib/browser/page-review-evidence.ts +465 -0
- package/src/lib/browser/page-review-judge.ts +56 -40
- package/src/lib/browser/page-review-pack.ts +181 -43
- package/src/lib/browser/page-review-source.ts +30 -0
- package/src/lib/browser/qa-run-contracts.ts +62 -18
- package/src/lib/browser/qa-run.ts +259 -71
- package/src/lib/browser/qa-snapshot.ts +289 -48
- package/src/lib/browser/review-capture-transaction.ts +106 -0
- package/src/lib/browser/standalone-html.ts +4 -2
- package/src/lib/browser/thumbnail-association.ts +190 -0
- package/src/lib/browser/tiling.ts +63 -0
- package/src/lib/docs-metadata-managed.ts +4 -1
- package/src/lib/identities/assume.ts +12 -4
- package/src/lib/instructions/templates.ts +1 -0
- package/src/lib/local-file-url.ts +17 -2
- package/src/lib/tunnel/state.ts +70 -13
|
@@ -15,10 +15,10 @@ import {
|
|
|
15
15
|
} from "node:fs";
|
|
16
16
|
import { hostname } from "node:os";
|
|
17
17
|
import { join, resolve } from "node:path";
|
|
18
|
-
import type { Adapter } from "../../../adapter.ts";
|
|
19
18
|
import { fsyncParentDirectory } from "../../../workflow/durable-record.ts";
|
|
20
19
|
import { acquireNoClobberLease } from "../../../workflow/workspaces/leases.ts";
|
|
21
20
|
import { selectCommandParentSpan } from "../../span-parent.ts";
|
|
21
|
+
import { EVENT_ADAPTER_IDS_V3, type EventAdapterIdV3 } from "../adapter-id.ts";
|
|
22
22
|
import { buildEventV3 } from "../builder.ts";
|
|
23
23
|
import { normalizeNativeIdV3 } from "../canonical.ts";
|
|
24
24
|
import { markObservedClockRegressionV3 } from "../clock-order.ts";
|
|
@@ -59,7 +59,7 @@ interface PendingCommandEventV3 {
|
|
|
59
59
|
interface CommandRecorderStateV3 {
|
|
60
60
|
format: typeof COMMAND_STATE_FORMAT;
|
|
61
61
|
format_version: typeof COMMAND_STATE_VERSION;
|
|
62
|
-
adapter:
|
|
62
|
+
adapter: EventAdapterIdV3;
|
|
63
63
|
instance_id: `inst_${string}`;
|
|
64
64
|
session_id: `sid_${string}`;
|
|
65
65
|
generation_id: `gen_${string}`;
|
|
@@ -86,7 +86,7 @@ export interface RecordCommandSignalV3Input {
|
|
|
86
86
|
mode: EventV3WriteMode;
|
|
87
87
|
signal: CommandSignalV3;
|
|
88
88
|
observation: CommandObservationV3;
|
|
89
|
-
adapter:
|
|
89
|
+
adapter: EventAdapterIdV3;
|
|
90
90
|
instance_id: `inst_${string}`;
|
|
91
91
|
producer_id: `prd_${string}`;
|
|
92
92
|
build_id: `build_${string}`;
|
|
@@ -576,7 +576,7 @@ function readCommandState(path: string): CommandRecorderStateV3 {
|
|
|
576
576
|
Object.keys(state).some((key) => !allowed.has(key)) ||
|
|
577
577
|
state.format !== COMMAND_STATE_FORMAT ||
|
|
578
578
|
state.format_version !== COMMAND_STATE_VERSION ||
|
|
579
|
-
!
|
|
579
|
+
!(EVENT_ADAPTER_IDS_V3 as readonly string[]).includes(state.adapter) ||
|
|
580
580
|
!/^inst_[a-zA-Z0-9._-]{1,128}$/.test(state.instance_id) ||
|
|
581
581
|
!/^sid_[a-f0-9]{64}$/.test(state.session_id) ||
|
|
582
582
|
!/^gen_[0-9a-f-]{36}$/.test(state.generation_id) ||
|
|
@@ -15,9 +15,9 @@ import {
|
|
|
15
15
|
} from "node:fs";
|
|
16
16
|
import { hostname } from "node:os";
|
|
17
17
|
import { basename, join, resolve } from "node:path";
|
|
18
|
-
import type { Adapter } from "../../../adapter.ts";
|
|
19
18
|
import { fsyncParentDirectory } from "../../../workflow/durable-record.ts";
|
|
20
19
|
import { acquireNoClobberLease } from "../../../workflow/workspaces/leases.ts";
|
|
20
|
+
import { EVENT_ADAPTER_IDS_V3, type EventAdapterIdV3 } from "../adapter-id.ts";
|
|
21
21
|
import {
|
|
22
22
|
type AuthorityReceiptV3,
|
|
23
23
|
type AuthorityReconcilerV3,
|
|
@@ -60,7 +60,7 @@ interface PendingCoordinationTransactionV3 {
|
|
|
60
60
|
interface CoordinationRecorderStateV3 {
|
|
61
61
|
format: typeof COORDINATION_STATE_FORMAT;
|
|
62
62
|
format_version: typeof COORDINATION_STATE_VERSION;
|
|
63
|
-
adapter:
|
|
63
|
+
adapter: EventAdapterIdV3;
|
|
64
64
|
actor_instance_id: `inst_${string}`;
|
|
65
65
|
session_id: `sid_${string}`;
|
|
66
66
|
generation_id: `gen_${string}`;
|
|
@@ -92,7 +92,7 @@ export interface RecordCoordinationAuthorityV3Input<
|
|
|
92
92
|
mode: EventV3WriteMode;
|
|
93
93
|
signal: S;
|
|
94
94
|
observation: CoordinationObservationBySignalV3[S];
|
|
95
|
-
adapter:
|
|
95
|
+
adapter: EventAdapterIdV3;
|
|
96
96
|
native_actor_session_id: string;
|
|
97
97
|
actor_instance_id: `inst_${string}`;
|
|
98
98
|
subject_instance_id: `inst_${string}`;
|
|
@@ -562,7 +562,7 @@ function readCoordinationState(path: string): CoordinationRecorderStateV3 {
|
|
|
562
562
|
Object.keys(state).some((key) => !allowed.has(key)) ||
|
|
563
563
|
state.format !== COORDINATION_STATE_FORMAT ||
|
|
564
564
|
state.format_version !== COORDINATION_STATE_VERSION ||
|
|
565
|
-
!
|
|
565
|
+
!(EVENT_ADAPTER_IDS_V3 as readonly string[]).includes(state.adapter) ||
|
|
566
566
|
!/^inst_[a-zA-Z0-9._-]{1,128}$/.test(state.actor_instance_id) ||
|
|
567
567
|
!/^sid_[a-f0-9]{64}$/.test(state.session_id) ||
|
|
568
568
|
!/^gen_[0-9a-f-]{36}$/.test(state.generation_id) ||
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import type { Adapter } from "../../../adapter.ts";
|
|
2
1
|
import type { ParsedPayload } from "../../../hooks/adapter/parse.ts";
|
|
2
|
+
import type { EventAdapterIdV3 } from "../adapter-id.ts";
|
|
3
3
|
import { buildEventV3Base } from "../base-builder.ts";
|
|
4
4
|
import type { EventV3Base, RuntimeAttestationV3Base } from "../base-contract.ts";
|
|
5
5
|
import { type FingerprintContextV3, fingerprintV3, normalizeNativeIdV3 } from "../canonical.ts";
|
|
6
6
|
import {
|
|
7
|
+
adapterDurationSupportV3,
|
|
7
8
|
adapterSignalSupportV3,
|
|
8
9
|
adapterTurnWaitCountSupportV3,
|
|
9
10
|
type CursorExecutionModeV3,
|
|
@@ -33,7 +34,7 @@ export type HookSignalV3Base =
|
|
|
33
34
|
|
|
34
35
|
export interface HookProducerContextV3Base {
|
|
35
36
|
coordRoot: string;
|
|
36
|
-
adapter:
|
|
37
|
+
adapter: EventAdapterIdV3;
|
|
37
38
|
adapterVersion?: string;
|
|
38
39
|
harnessVersion?: string;
|
|
39
40
|
root_id: `root_${string}`;
|
|
@@ -191,7 +192,13 @@ export function normalizeHookEventV3Base(
|
|
|
191
192
|
attestation: "native",
|
|
192
193
|
confidence: "exact",
|
|
193
194
|
}
|
|
194
|
-
:
|
|
195
|
+
: adapterSignalSupportV3(context.adapter, "model_identity") === "unsupported"
|
|
196
|
+
? { state: "unsupported", capability: "model_identity" }
|
|
197
|
+
: {
|
|
198
|
+
state: "expected_but_missing",
|
|
199
|
+
capability: "model_identity",
|
|
200
|
+
reason: "not_reported",
|
|
201
|
+
},
|
|
195
202
|
tuning: tuningObservation(context, payload),
|
|
196
203
|
telemetry: context.runtime_telemetry ?? initialTelemetryCapabilities(context),
|
|
197
204
|
capability_profile: context.capability_profile,
|
|
@@ -263,11 +270,10 @@ export function normalizeHookEventV3Base(
|
|
|
263
270
|
links: { caused_by: causedBy },
|
|
264
271
|
payload: {
|
|
265
272
|
outcome: signal === "stop" ? "succeeded" : "failed",
|
|
266
|
-
duration_ms:
|
|
267
|
-
context.
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
),
|
|
273
|
+
duration_ms:
|
|
274
|
+
adapterDurationSupportV3(context.adapter, "turn_duration") === "unsupported"
|
|
275
|
+
? { state: "unsupported", capability: "turn_duration" }
|
|
276
|
+
: measuredOrMissing(context.duration_ms, "turn_duration", "turn_timing_not_supplied"),
|
|
271
277
|
tool_call_count:
|
|
272
278
|
context.tool_call_count_support === "unsupported"
|
|
273
279
|
? { state: "unsupported", capability: "turn_tool_call_count" }
|
|
@@ -338,11 +344,10 @@ export function normalizeHookEventV3Base(
|
|
|
338
344
|
payload: {
|
|
339
345
|
tool: { namespace: context.adapter, name: safeToolName(payload.tool_name) },
|
|
340
346
|
outcome: signal === "post-tool-use" ? "succeeded" : "failed",
|
|
341
|
-
duration_ms:
|
|
342
|
-
context.
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
),
|
|
347
|
+
duration_ms:
|
|
348
|
+
adapterDurationSupportV3(context.adapter, "tool_duration") === "unsupported"
|
|
349
|
+
? { state: "unsupported", capability: "tool_duration" }
|
|
350
|
+
: measuredOrMissing(context.duration_ms, "tool_duration", "span_timing_not_supplied"),
|
|
346
351
|
result: {
|
|
347
352
|
storage: "omitted",
|
|
348
353
|
media_type:
|
|
@@ -447,7 +452,7 @@ export function normalizeHookEventV3Base(
|
|
|
447
452
|
}
|
|
448
453
|
|
|
449
454
|
function turnRitualObservation(
|
|
450
|
-
adapter:
|
|
455
|
+
adapter: EventAdapterIdV3,
|
|
451
456
|
evidence: TurnRitualEvidenceV3,
|
|
452
457
|
): TurnRitualObservationV3 {
|
|
453
458
|
if (adapter === "cursor") {
|
|
@@ -655,10 +660,10 @@ function observedIdentity(id: string, version: string | undefined) {
|
|
|
655
660
|
};
|
|
656
661
|
}
|
|
657
662
|
|
|
658
|
-
function providerFor(adapter:
|
|
663
|
+
function providerFor(adapter: EventAdapterIdV3): string {
|
|
659
664
|
if (adapter === "claude-code") return "anthropic";
|
|
660
665
|
if (adapter === "codex") return "openai";
|
|
661
|
-
return
|
|
666
|
+
return adapter;
|
|
662
667
|
}
|
|
663
668
|
|
|
664
669
|
function safeModelId(value: string): string {
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { ParsedPayload } from "../../../hooks/adapter/parse.ts";
|
|
2
2
|
import type { EventV3Base } from "../base-contract.ts";
|
|
3
|
+
import { adapterDurationSupportV3, adapterSignalSupportV3 } from "../capabilities.ts";
|
|
3
4
|
import type { EventOfTypeV3, EventTypeV3, SpanSummaryV3 } from "../contract.ts";
|
|
4
5
|
import { EVENT_V3_CONTRACT_MAJOR, EVENT_V3_CONTRACT_NAME } from "../contract.ts";
|
|
5
6
|
import { EVENT_V3_SCHEMA_DIGEST } from "../generated.ts";
|
|
@@ -95,9 +96,22 @@ function terminalPayload(
|
|
|
95
96
|
context: HookProducerContextV3,
|
|
96
97
|
): object {
|
|
97
98
|
if (!TERMINAL_EVENT_TYPES.has(eventType)) return basePayload;
|
|
98
|
-
const
|
|
99
|
+
const sourceSpan = context.terminal_span as SpanSummaryV3;
|
|
100
|
+
const durationCapability =
|
|
101
|
+
eventType === "turn.completed"
|
|
102
|
+
? "turn_duration"
|
|
103
|
+
: eventType === "tool.completed"
|
|
104
|
+
? "tool_duration"
|
|
105
|
+
: undefined;
|
|
106
|
+
const duration =
|
|
107
|
+
durationCapability &&
|
|
108
|
+
adapterDurationSupportV3(context.adapter, durationCapability) === "unsupported"
|
|
109
|
+
? { state: "unsupported" as const, capability: durationCapability }
|
|
110
|
+
: sourceSpan.duration_ms;
|
|
111
|
+
const span =
|
|
112
|
+
duration === sourceSpan.duration_ms ? sourceSpan : { ...sourceSpan, duration_ms: duration };
|
|
99
113
|
if (eventType === "tool.completed") {
|
|
100
|
-
return { ...basePayload, duration_ms:
|
|
114
|
+
return { ...basePayload, duration_ms: duration, span };
|
|
101
115
|
}
|
|
102
116
|
if (eventType !== "turn.completed") return { ...basePayload, span };
|
|
103
117
|
|
|
@@ -110,10 +124,13 @@ function terminalPayload(
|
|
|
110
124
|
);
|
|
111
125
|
return {
|
|
112
126
|
...basePayload,
|
|
113
|
-
duration_ms:
|
|
127
|
+
duration_ms: duration,
|
|
114
128
|
span,
|
|
115
129
|
usage: telemetry.usage,
|
|
116
130
|
inference: telemetry.inference,
|
|
117
|
-
harness:
|
|
131
|
+
harness:
|
|
132
|
+
adapterSignalSupportV3(context.adapter, "harness_timing") === "unsupported"
|
|
133
|
+
? { state: "unsupported", capability: "harness_timing" }
|
|
134
|
+
: harnessObservationV3(context.harness_timing ?? emptyHarnessTimingV3()),
|
|
118
135
|
};
|
|
119
136
|
}
|
|
@@ -13,9 +13,9 @@ import {
|
|
|
13
13
|
writeFileSync,
|
|
14
14
|
} from "node:fs";
|
|
15
15
|
import { dirname, join, resolve } from "node:path";
|
|
16
|
-
import type { Adapter } from "../../../adapter.ts";
|
|
17
16
|
import type { ParsedPayload } from "../../../hooks/adapter/parse.ts";
|
|
18
17
|
import { fsyncParentDirectory } from "../../../workflow/durable-record.ts";
|
|
18
|
+
import { EVENT_ADAPTER_IDS_V3, type EventAdapterIdV3 } from "../adapter-id.ts";
|
|
19
19
|
import type { EventV3WriteMode } from "../control.ts";
|
|
20
20
|
import { EVENT_V3_LEDGER_RELATIVE_ROOT } from "../writer.ts";
|
|
21
21
|
import {
|
|
@@ -90,7 +90,7 @@ export interface HookIntakeRecordV3 {
|
|
|
90
90
|
mode: EventV3WriteMode;
|
|
91
91
|
signal: HookSignalV3;
|
|
92
92
|
payload: ParsedPayload;
|
|
93
|
-
adapter:
|
|
93
|
+
adapter: EventAdapterIdV3;
|
|
94
94
|
instance_id: `inst_${string}`;
|
|
95
95
|
producer_id: `prd_${string}`;
|
|
96
96
|
build_id: `build_${string}`;
|
|
@@ -113,7 +113,7 @@ export interface HookIntakeRecordV3 {
|
|
|
113
113
|
}
|
|
114
114
|
|
|
115
115
|
export interface HookIntakeGroupV3 {
|
|
116
|
-
adapter:
|
|
116
|
+
adapter: EventAdapterIdV3;
|
|
117
117
|
session_hash: `hid_${string}`;
|
|
118
118
|
directory: string;
|
|
119
119
|
}
|
|
@@ -135,7 +135,7 @@ function diagnosticsRoot(coordRoot: string): string {
|
|
|
135
135
|
|
|
136
136
|
export function hookIntakeGroupDirV3(
|
|
137
137
|
coordRoot: string,
|
|
138
|
-
adapter:
|
|
138
|
+
adapter: EventAdapterIdV3,
|
|
139
139
|
sessionHash: `hid_${string}`,
|
|
140
140
|
): string {
|
|
141
141
|
return join(intakeRoot(coordRoot), adapter, sessionHash);
|
|
@@ -187,7 +187,7 @@ export function listHookIntakeGroupsV3(coordRoot: string): HookIntakeGroupV3[] {
|
|
|
187
187
|
const root = intakeRoot(coordRoot);
|
|
188
188
|
if (!existsSync(root)) return [];
|
|
189
189
|
const groups: HookIntakeGroupV3[] = [];
|
|
190
|
-
for (const adapter of
|
|
190
|
+
for (const adapter of EVENT_ADAPTER_IDS_V3) {
|
|
191
191
|
const adapterDir = join(root, adapter);
|
|
192
192
|
if (!existsSync(adapterDir)) continue;
|
|
193
193
|
const metadata = lstatSync(adapterDir);
|
|
@@ -254,7 +254,7 @@ function readIntakeRecord(path: string): HookIntakeRecordV3 | undefined {
|
|
|
254
254
|
!HOOK_SIGNALS.has(record.signal) ||
|
|
255
255
|
!record.payload ||
|
|
256
256
|
typeof record.payload !== "object" ||
|
|
257
|
-
!
|
|
257
|
+
!(EVENT_ADAPTER_IDS_V3 as readonly string[]).includes(record.adapter) ||
|
|
258
258
|
!/^inst_[a-zA-Z0-9._-]{1,128}$/.test(record.instance_id) ||
|
|
259
259
|
!/^prd_[a-zA-Z0-9._-]{1,64}$/.test(record.producer_id) ||
|
|
260
260
|
!/^build_[a-zA-Z0-9._-]{1,127}$/.test(record.build_id) ||
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { existsSync, lstatSync, readdirSync, readFileSync } from "node:fs";
|
|
2
2
|
import { join, resolve } from "node:path";
|
|
3
|
+
import { EVENT_ADAPTER_IDS_V3 } from "../adapter-id.ts";
|
|
3
4
|
import { readEventV3ControlState } from "../control.ts";
|
|
4
5
|
import { EVENT_V3_LEDGER_RELATIVE_ROOT } from "../reader.ts";
|
|
5
6
|
|
|
@@ -16,7 +17,7 @@ export function listHookProducerStateSummariesV3(coordRoot: string): HookProduce
|
|
|
16
17
|
const producerRoot = join(resolve(coordRoot), EVENT_V3_LEDGER_RELATIVE_ROOT, "private-producers");
|
|
17
18
|
if (!existsSync(producerRoot)) return [];
|
|
18
19
|
const summaries: HookProducerStateSummaryV3[] = [];
|
|
19
|
-
for (const adapter of
|
|
20
|
+
for (const adapter of EVENT_ADAPTER_IDS_V3) {
|
|
20
21
|
const directory = join(producerRoot, adapter);
|
|
21
22
|
if (!existsSync(directory)) continue;
|
|
22
23
|
const directoryMetadata = lstatSync(directory);
|
|
@@ -15,7 +15,6 @@ import {
|
|
|
15
15
|
} from "node:fs";
|
|
16
16
|
import { hostname } from "node:os";
|
|
17
17
|
import { basename, join, resolve } from "node:path";
|
|
18
|
-
import type { Adapter } from "../../../adapter.ts";
|
|
19
18
|
import { extractBashCommand, type ParsedPayload } from "../../../hooks/adapter/parse.ts";
|
|
20
19
|
import {
|
|
21
20
|
discoverCodexSessionTranscript,
|
|
@@ -26,6 +25,7 @@ import {
|
|
|
26
25
|
} from "../../../hooks/adapter/runtime-telemetry.ts";
|
|
27
26
|
import { fsyncParentDirectory } from "../../../workflow/durable-record.ts";
|
|
28
27
|
import { acquireNoClobberLease } from "../../../workflow/workspaces/leases.ts";
|
|
28
|
+
import { EVENT_ADAPTER_IDS_V3, type EventAdapterIdV3 } from "../adapter-id.ts";
|
|
29
29
|
import type { RuntimeAttestationV3Base } from "../base-contract.ts";
|
|
30
30
|
import { buildEventV3 } from "../builder.ts";
|
|
31
31
|
import { canonicalJsonV3, fingerprintV3, normalizeNativeIdV3 } from "../canonical.ts";
|
|
@@ -108,7 +108,12 @@ const APPROVED_END_RUNTIME_CONTEXT_RETRY_DELAYS_MS = [0, 250, 250] as const;
|
|
|
108
108
|
* Kept in code, outside the digested capability profiles, so tuning recovery
|
|
109
109
|
* never changes an adapter capability digest (ADR 0078).
|
|
110
110
|
*/
|
|
111
|
-
const RECOVERY_ENABLED_ADAPTERS: ReadonlySet<
|
|
111
|
+
const RECOVERY_ENABLED_ADAPTERS: ReadonlySet<string> = new Set([
|
|
112
|
+
"claude-code",
|
|
113
|
+
"codex",
|
|
114
|
+
"cursor",
|
|
115
|
+
"openclaw",
|
|
116
|
+
]);
|
|
112
117
|
|
|
113
118
|
interface SpanStateV3 extends OpenSpanStateV3 {
|
|
114
119
|
source_id: `hid_${string}`;
|
|
@@ -187,7 +192,7 @@ interface DelegationStateV3 extends OpenSpanStateV3 {
|
|
|
187
192
|
export interface HookProducerStateV3 {
|
|
188
193
|
format: typeof STATE_FORMAT;
|
|
189
194
|
format_version: typeof STATE_VERSION;
|
|
190
|
-
adapter:
|
|
195
|
+
adapter: EventAdapterIdV3;
|
|
191
196
|
instance_id: `inst_${string}`;
|
|
192
197
|
session_id: `sid_${string}`;
|
|
193
198
|
generation_id: `gen_${string}`;
|
|
@@ -263,7 +268,7 @@ export interface RecordHookSignalV3Input {
|
|
|
263
268
|
mode: EventV3WriteMode;
|
|
264
269
|
signal: HookSignalV3;
|
|
265
270
|
payload: ParsedPayload;
|
|
266
|
-
adapter:
|
|
271
|
+
adapter: EventAdapterIdV3;
|
|
267
272
|
instance_id: `inst_${string}`;
|
|
268
273
|
run_id?: `run_${string}`;
|
|
269
274
|
workflow_id?: `wf_${string}`;
|
|
@@ -290,6 +295,13 @@ export interface RecordHookSignalV3Input {
|
|
|
290
295
|
/** Optional roots and read budgets for runtime telemetry adapters. */
|
|
291
296
|
runtimeTelemetryOptions?: RuntimeTelemetryOptions;
|
|
292
297
|
writerOptions?: WriteEventV3Options;
|
|
298
|
+
/**
|
|
299
|
+
* Skip the crash-recovery intake file when the caller already owns a
|
|
300
|
+
* bounded, drainable queue. This prevents raw hook payloads from touching
|
|
301
|
+
* disk before normalization. The default remains the durable spool used by
|
|
302
|
+
* interactive harness hooks.
|
|
303
|
+
*/
|
|
304
|
+
intake?: "durable" | "memory_only";
|
|
293
305
|
}
|
|
294
306
|
|
|
295
307
|
export type RecordHookSignalV3Result =
|
|
@@ -308,6 +320,8 @@ export type RecordHookSignalV3Result =
|
|
|
308
320
|
}
|
|
309
321
|
/** Durably queued in the intake spool; a lease holder or drain hook records it. */
|
|
310
322
|
| { state: "spooled" }
|
|
323
|
+
/** Memory-only delivery could not acquire the producer lease and was dropped. */
|
|
324
|
+
| { state: "busy" }
|
|
311
325
|
| { state: "recorded"; event: EventV3; durability: WriteEventV3Result; recovered: boolean };
|
|
312
326
|
|
|
313
327
|
export type ApprovedSessionEndReasonV3 =
|
|
@@ -387,6 +401,16 @@ export function recordHookSignalV3(input: RecordHookSignalV3Input): RecordHookSi
|
|
|
387
401
|
const rootFingerprintContext = fingerprintContextV3(input.coordRoot, rootId, undefined, epochId);
|
|
388
402
|
const sessionHash = sessionHashForSignal(input, rootFingerprintContext);
|
|
389
403
|
const path = producerStatePath(input.coordRoot, input.adapter, sessionHash);
|
|
404
|
+
if (input.intake === "memory_only") {
|
|
405
|
+
const lease = acquireStateLeaseWithRetry(input.coordRoot, path, STATE_LEASE_RETRY_ATTEMPTS);
|
|
406
|
+
if (!lease) return { state: "busy" };
|
|
407
|
+
try {
|
|
408
|
+
drainSessionIntakeLocked(input.coordRoot, control, input.adapter, sessionHash, path);
|
|
409
|
+
return processHookSignalLocked(control, input, sessionHash, path);
|
|
410
|
+
} finally {
|
|
411
|
+
lease.release();
|
|
412
|
+
}
|
|
413
|
+
}
|
|
390
414
|
const spoolPath = appendHookIntakeRecordV3(input.coordRoot, sessionHash, intakeRecord(input));
|
|
391
415
|
const lease = acquireStateLeaseWithRetry(input.coordRoot, path, STATE_LEASE_RETRY_ATTEMPTS);
|
|
392
416
|
if (!lease) return { state: "spooled" };
|
|
@@ -404,7 +428,7 @@ export function recordHookSignalV3(input: RecordHookSignalV3Input): RecordHookSi
|
|
|
404
428
|
|
|
405
429
|
function hookSignalGate(
|
|
406
430
|
control: OpenHookControlStateV3,
|
|
407
|
-
adapter:
|
|
431
|
+
adapter: EventAdapterIdV3,
|
|
408
432
|
signal: HookSignalV3,
|
|
409
433
|
): RecordHookSignalV3Result | undefined {
|
|
410
434
|
const expectedCapabilityDigest = `sha256:${adapterCapabilityProfileDigestV3(adapter).slice(4)}`;
|
|
@@ -531,7 +555,7 @@ interface OwnIntakeRecordV3 {
|
|
|
531
555
|
function drainSessionIntakeLocked(
|
|
532
556
|
coordRoot: string,
|
|
533
557
|
control: OpenHookControlStateV3,
|
|
534
|
-
adapter:
|
|
558
|
+
adapter: EventAdapterIdV3,
|
|
535
559
|
sessionHash: `hid_${string}`,
|
|
536
560
|
statePath: string,
|
|
537
561
|
own?: OwnIntakeRecordV3,
|
|
@@ -2128,6 +2152,10 @@ function maybeCommitActiveRuntimeContextObservation(
|
|
|
2128
2152
|
publishProducerState(input.coordRoot, path, state);
|
|
2129
2153
|
return;
|
|
2130
2154
|
}
|
|
2155
|
+
if (input.adapter === "openclaw") {
|
|
2156
|
+
publishProducerState(input.coordRoot, path, state);
|
|
2157
|
+
return;
|
|
2158
|
+
}
|
|
2131
2159
|
|
|
2132
2160
|
const transcriptPath = runtimeTranscriptPath(input, state);
|
|
2133
2161
|
if (!transcriptPath && input.adapter !== "cursor") {
|
|
@@ -2472,6 +2500,7 @@ function turnTelemetryForTerminal(
|
|
|
2472
2500
|
): TurnTelemetryV3 {
|
|
2473
2501
|
const native = extractTurnTelemetryV3(input.adapter, input.payload.raw, observedAt);
|
|
2474
2502
|
if (native.context.state === "observed") return native;
|
|
2503
|
+
if (input.adapter === "openclaw") return native;
|
|
2475
2504
|
if (input.adapter === "cursor" && state.cursor_mode === "cloud") {
|
|
2476
2505
|
return {
|
|
2477
2506
|
...native,
|
|
@@ -2848,10 +2877,10 @@ function commitRuntimeAttestationChange(
|
|
|
2848
2877
|
commitEventLocked(input, state, path, event);
|
|
2849
2878
|
}
|
|
2850
2879
|
|
|
2851
|
-
function modelProviderFor(adapter:
|
|
2880
|
+
function modelProviderFor(adapter: EventAdapterIdV3): string {
|
|
2852
2881
|
if (adapter === "claude-code") return "anthropic";
|
|
2853
2882
|
if (adapter === "codex") return "openai";
|
|
2854
|
-
return
|
|
2883
|
+
return adapter;
|
|
2855
2884
|
}
|
|
2856
2885
|
|
|
2857
2886
|
function recordRuntimeTelemetryTiming(state: HookProducerStateV3, durationMs: number): void {
|
|
@@ -3436,7 +3465,7 @@ export function listHookProducerStateRecordsV3(
|
|
|
3436
3465
|
const producerRoot = join(resolve(coordRoot), EVENT_V3_LEDGER_RELATIVE_ROOT, "private-producers");
|
|
3437
3466
|
if (!existsSync(producerRoot)) return [];
|
|
3438
3467
|
const records: HookProducerStateRecordV3[] = [];
|
|
3439
|
-
for (const adapter of
|
|
3468
|
+
for (const adapter of EVENT_ADAPTER_IDS_V3) {
|
|
3440
3469
|
const directory = join(producerRoot, adapter);
|
|
3441
3470
|
if (!existsSync(directory)) continue;
|
|
3442
3471
|
const metadata = lstatSync(directory);
|
|
@@ -3588,7 +3617,7 @@ function listArchivedHookProducerStatesV3(
|
|
|
3588
3617
|
const producerRoot = join(resolve(archivedEpoch), "private-producers");
|
|
3589
3618
|
if (!existsSync(producerRoot)) return [];
|
|
3590
3619
|
const records: Array<{ sessionHash: `hid_${string}`; state: HookProducerStateV3 }> = [];
|
|
3591
|
-
for (const adapter of
|
|
3620
|
+
for (const adapter of EVENT_ADAPTER_IDS_V3) {
|
|
3592
3621
|
const directory = join(producerRoot, adapter);
|
|
3593
3622
|
if (!existsSync(directory)) continue;
|
|
3594
3623
|
const metadata = lstatSync(directory);
|
|
@@ -3644,7 +3673,7 @@ function hookSignalCapability(signal: HookSignalV3): AdapterSignalV3 {
|
|
|
3644
3673
|
|
|
3645
3674
|
export function readHookProducerStateV3(
|
|
3646
3675
|
coordRoot: string,
|
|
3647
|
-
adapter:
|
|
3676
|
+
adapter: EventAdapterIdV3,
|
|
3648
3677
|
nativeSessionId: string,
|
|
3649
3678
|
): HookProducerStateV3 | undefined {
|
|
3650
3679
|
const control = readEventV3ControlState(coordRoot);
|
|
@@ -3761,12 +3790,12 @@ export function readTerminalHookProducerStateV3(
|
|
|
3761
3790
|
nativeSessionId: string,
|
|
3762
3791
|
instanceId: `inst_${string}`,
|
|
3763
3792
|
): HookProducerStateV3 | undefined {
|
|
3764
|
-
const matches = (
|
|
3765
|
-
|
|
3766
|
-
|
|
3767
|
-
|
|
3768
|
-
|
|
3769
|
-
|
|
3793
|
+
const matches = EVENT_ADAPTER_IDS_V3.map((adapter) =>
|
|
3794
|
+
readHookProducerStateV3(coordRoot, adapter, nativeSessionId),
|
|
3795
|
+
).filter(
|
|
3796
|
+
(state): state is HookProducerStateV3 =>
|
|
3797
|
+
state?.terminal === true && state.instance_id === instanceId,
|
|
3798
|
+
);
|
|
3770
3799
|
return matches.length === 1 ? matches[0] : undefined;
|
|
3771
3800
|
}
|
|
3772
3801
|
|
|
@@ -3779,7 +3808,7 @@ export function readHookProducerStateByInstanceV3(
|
|
|
3779
3808
|
const producerRoot = join(resolve(coordRoot), EVENT_V3_LEDGER_RELATIVE_ROOT, "private-producers");
|
|
3780
3809
|
if (!existsSync(producerRoot)) return undefined;
|
|
3781
3810
|
const matches: HookProducerStateV3[] = [];
|
|
3782
|
-
for (const adapter of
|
|
3811
|
+
for (const adapter of EVENT_ADAPTER_IDS_V3) {
|
|
3783
3812
|
const directory = join(producerRoot, adapter);
|
|
3784
3813
|
if (!existsSync(directory)) continue;
|
|
3785
3814
|
const metadata = lstatSync(directory);
|
|
@@ -3807,7 +3836,7 @@ export function readHookProducerStateByInstanceV3(
|
|
|
3807
3836
|
*/
|
|
3808
3837
|
export function readJoinableHookProducerStateV3(
|
|
3809
3838
|
coordRoot: string,
|
|
3810
|
-
adapter:
|
|
3839
|
+
adapter: EventAdapterIdV3,
|
|
3811
3840
|
nativeSessionId: string,
|
|
3812
3841
|
instanceId: `inst_${string}`,
|
|
3813
3842
|
): HookProducerStateV3 | undefined {
|
|
@@ -4171,7 +4200,7 @@ function safeTokenOrUndefined(value: unknown): string | undefined {
|
|
|
4171
4200
|
|
|
4172
4201
|
function producerStatePath(
|
|
4173
4202
|
coordRoot: string,
|
|
4174
|
-
adapter:
|
|
4203
|
+
adapter: EventAdapterIdV3,
|
|
4175
4204
|
sessionHash: `hid_${string}`,
|
|
4176
4205
|
): string {
|
|
4177
4206
|
return join(
|
|
@@ -4335,7 +4364,7 @@ function readProducerState(path: string): HookProducerStateV3 {
|
|
|
4335
4364
|
Object.keys(state).some((key) => !allowedKeys.has(key)) ||
|
|
4336
4365
|
state.format !== STATE_FORMAT ||
|
|
4337
4366
|
state.format_version !== STATE_VERSION ||
|
|
4338
|
-
!
|
|
4367
|
+
!(EVENT_ADAPTER_IDS_V3 as readonly string[]).includes(state.adapter) ||
|
|
4339
4368
|
(state.cursor_mode !== undefined &&
|
|
4340
4369
|
!["local", "cloud", "unknown"].includes(state.cursor_mode)) ||
|
|
4341
4370
|
!/^inst_[a-zA-Z0-9._-]{1,128}$/.test(state.instance_id) ||
|
|
@@ -480,18 +480,12 @@ export function readLedgerV3Since(
|
|
|
480
480
|
cursor?: LedgerCursorV3,
|
|
481
481
|
options: ReadLedgerV3Options = {},
|
|
482
482
|
): ReadLedgerV3SinceResult {
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
events: diagnostics.length === 0 ? read.events : [],
|
|
490
|
-
diagnostics,
|
|
491
|
-
complete: diagnostics.length === 0,
|
|
492
|
-
bytes: discovered.bytes,
|
|
493
|
-
failed_epochs: recovery.receipts,
|
|
494
|
-
};
|
|
483
|
+
// Read through the validated snapshot cache that readLedgerV3 keeps, so a caller that
|
|
484
|
+
// polls the tail pays for the bytes appended since its last call, not for the whole
|
|
485
|
+
// authority. Until 2026-09-06 this rediscovered and revalidated every frame on every
|
|
486
|
+
// call: a 24.5 MB active segment cost about 0.5 s to return zero new events, and the
|
|
487
|
+
// semantic service asked once a second for three days (3.2 cores on an idle host).
|
|
488
|
+
return sliceLedgerReadSinceV3(readLedgerV3(coordRoot, options), cursor);
|
|
495
489
|
}
|
|
496
490
|
|
|
497
491
|
function discoverRecoveryReceiptsV3(coordRoot: string): {
|
|
@@ -740,7 +734,14 @@ export function readLedgerFramesV3Since(
|
|
|
740
734
|
cursor?: LedgerCursorV3,
|
|
741
735
|
options: ReadLedgerV3Options = {},
|
|
742
736
|
): ReadLedgerV3SinceResult {
|
|
743
|
-
|
|
737
|
+
return sliceLedgerReadSinceV3(readLedgerFramesV3(frames, options), cursor);
|
|
738
|
+
}
|
|
739
|
+
|
|
740
|
+
/** Apply a resume cursor to a validated read: the events after it, plus the next cursor. */
|
|
741
|
+
function sliceLedgerReadSinceV3(
|
|
742
|
+
read: ReadLedgerV3Result,
|
|
743
|
+
cursor?: LedgerCursorV3,
|
|
744
|
+
): ReadLedgerV3SinceResult {
|
|
744
745
|
if (!read.genesis_id || !read.complete) {
|
|
745
746
|
return { ...read, events: [], cursor, reset_required: Boolean(cursor) };
|
|
746
747
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { spawnSync } from "node:child_process";
|
|
2
2
|
import { existsSync, readFileSync } from "node:fs";
|
|
3
|
-
import { resolve } from "node:path";
|
|
3
|
+
import { dirname, resolve } from "node:path";
|
|
4
|
+
import { fileURLToPath } from "node:url";
|
|
4
5
|
|
|
5
6
|
export { liveEventV3BuildId, livePlatformV3 } from "./runtime-identity.ts";
|
|
6
7
|
|
|
@@ -37,5 +38,5 @@ export function currentHarneryRuntimeBuild(): string {
|
|
|
37
38
|
}
|
|
38
39
|
|
|
39
40
|
export function harneryPackageRoot(): string {
|
|
40
|
-
return resolve(import.meta.
|
|
41
|
+
return resolve(dirname(fileURLToPath(import.meta.url)), "../../../..");
|
|
41
42
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { EventAdapterIdV3 } from "./adapter-id.ts";
|
|
2
2
|
import {
|
|
3
3
|
adapterSignalSupportV3,
|
|
4
4
|
type CapabilitySupportV3,
|
|
@@ -47,7 +47,7 @@ export type RuntimeContextCapabilityEvidenceV3 =
|
|
|
47
47
|
| { state: "unsupported" };
|
|
48
48
|
|
|
49
49
|
export interface RuntimeTelemetryCapabilityEvidenceV3 {
|
|
50
|
-
adapter:
|
|
50
|
+
adapter: EventAdapterIdV3;
|
|
51
51
|
cursor_mode?: CursorExecutionModeV3;
|
|
52
52
|
context: RuntimeContextCapabilityEvidenceV3;
|
|
53
53
|
canonical_turn_boundaries: boolean;
|
|
@@ -102,7 +102,7 @@ function contextCapability(
|
|
|
102
102
|
}
|
|
103
103
|
|
|
104
104
|
function waitSpanCapability(
|
|
105
|
-
adapter:
|
|
105
|
+
adapter: EventAdapterIdV3,
|
|
106
106
|
cursorMode: CursorExecutionModeV3 | undefined,
|
|
107
107
|
): RuntimeTelemetryCapabilityObservationV3 {
|
|
108
108
|
if (adapter === "cursor" && cursorMode === "cloud") {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { EventAdapterIdV3 } from "./adapter-id.ts";
|
|
2
2
|
import {
|
|
3
3
|
type AdapterSignalV3,
|
|
4
4
|
adapterSignalSupportV3,
|
|
@@ -66,7 +66,7 @@ export interface HarnessTimingAccumulatorV3 {
|
|
|
66
66
|
|
|
67
67
|
/** Extract only telemetry explicitly reported by a hook/status payload. */
|
|
68
68
|
export function extractTurnTelemetryV3(
|
|
69
|
-
adapter:
|
|
69
|
+
adapter: EventAdapterIdV3,
|
|
70
70
|
payload: Record<string, unknown>,
|
|
71
71
|
observedAt = new Date().toISOString(),
|
|
72
72
|
support: TurnTelemetryCapabilitySupportV3 = {},
|
|
@@ -162,7 +162,7 @@ export function extractTurnTelemetryV3(
|
|
|
162
162
|
}
|
|
163
163
|
|
|
164
164
|
function contextObservation(
|
|
165
|
-
adapter:
|
|
165
|
+
adapter: EventAdapterIdV3,
|
|
166
166
|
usedTokens: number | undefined,
|
|
167
167
|
limitTokens: number | undefined,
|
|
168
168
|
usedPercent: number | undefined,
|
|
@@ -269,7 +269,7 @@ export function harnessObservationV3(
|
|
|
269
269
|
}
|
|
270
270
|
|
|
271
271
|
function missing(
|
|
272
|
-
adapter:
|
|
272
|
+
adapter: EventAdapterIdV3,
|
|
273
273
|
signal: "model_usage" | "inference_timing" | "context_usage",
|
|
274
274
|
override: CapabilitySupportV3 | undefined,
|
|
275
275
|
) {
|