harnery 0.33.0 → 0.34.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.map +1 -1
- package/dist/commander.js +4 -0
- package/dist/commands/adapter.js +2 -2
- package/dist/commands/agents.d.ts +144 -1
- package/dist/commands/agents.d.ts.map +1 -1
- package/dist/commands/agents.js +1220 -588
- package/dist/commands/artifacts.d.ts.map +1 -1
- package/dist/commands/artifacts.js +7 -6
- package/dist/commands/backup.d.ts +1 -1
- package/dist/commands/backup.d.ts.map +1 -1
- package/dist/commands/backup.js +29 -16
- package/dist/commands/browse.d.ts.map +1 -1
- package/dist/commands/browse.js +234 -12
- package/dist/commands/checkpoint.d.ts.map +1 -1
- package/dist/commands/checkpoint.js +3 -2
- package/dist/commands/claude-desktop.d.ts +1 -1
- package/dist/commands/claude-desktop.d.ts.map +1 -1
- package/dist/commands/claude-desktop.js +3 -74
- package/dist/commands/context.js +1 -6
- package/dist/commands/decision.d.ts.map +1 -1
- package/dist/commands/decision.js +22 -38
- package/dist/commands/docs.d.ts.map +1 -1
- package/dist/commands/docs.js +91 -28
- package/dist/commands/doctor.js +10 -1
- package/dist/commands/events.d.ts +5 -0
- package/dist/commands/events.d.ts.map +1 -0
- package/dist/commands/events.js +189 -0
- package/dist/commands/governor.d.ts.map +1 -1
- package/dist/commands/governor.js +13 -4
- package/dist/commands/init.d.ts +9 -2
- package/dist/commands/init.d.ts.map +1 -1
- package/dist/commands/init.js +223 -51
- package/dist/commands/journal.d.ts.map +1 -1
- package/dist/commands/journal.js +4 -13
- package/dist/commands/ledger-v3.d.ts +5 -0
- package/dist/commands/ledger-v3.d.ts.map +1 -0
- package/dist/commands/ledger-v3.js +91 -0
- package/dist/commands/presence.d.ts.map +1 -1
- package/dist/commands/presence.js +11 -5
- package/dist/commands/sync.d.ts +1 -1
- package/dist/commands/sync.js +1 -1
- package/dist/commands/web.d.ts +6 -0
- package/dist/commands/web.d.ts.map +1 -1
- package/dist/commands/web.js +67 -7
- package/dist/commands/work.d.ts.map +1 -1
- package/dist/commands/work.js +22 -5
- package/dist/core/adapter.d.ts +5 -0
- package/dist/core/adapter.d.ts.map +1 -0
- package/dist/core/adapter.js +1 -0
- package/dist/core/adapters/attest.d.ts +5 -2
- package/dist/core/adapters/attest.d.ts.map +1 -1
- package/dist/core/adapters/attest.js +8 -3
- package/dist/core/adapters/profiles.d.ts +6 -6
- package/dist/core/adapters/profiles.d.ts.map +1 -1
- package/dist/core/adapters/profiles.js +4 -4
- package/dist/core/agents/canonical-emit.d.ts +17 -15
- package/dist/core/agents/canonical-emit.d.ts.map +1 -1
- package/dist/core/agents/canonical-emit.js +22 -22
- package/dist/core/agents/cli.js +207 -234
- package/dist/core/agents/codex-archive-v3.d.ts +14 -0
- package/dist/core/agents/codex-archive-v3.d.ts.map +1 -0
- package/dist/core/agents/codex-archive-v3.js +110 -0
- package/dist/core/agents/coord-client.d.ts +19 -81
- package/dist/core/agents/coord-client.d.ts.map +1 -1
- package/dist/core/agents/coord-client.js +65 -155
- package/dist/core/agents/finalization.d.ts +4 -1
- package/dist/core/agents/finalization.d.ts.map +1 -1
- package/dist/core/agents/finalization.js +89 -32
- package/dist/core/agents/index.d.ts +4 -5
- package/dist/core/agents/index.d.ts.map +1 -1
- package/dist/core/agents/index.js +4 -5
- package/dist/core/agents/live-authority-v3.d.ts +59 -0
- package/dist/core/agents/live-authority-v3.d.ts.map +1 -0
- package/dist/core/agents/live-authority-v3.js +233 -0
- package/dist/core/agents/live-lifecycle-v3.d.ts +20 -0
- package/dist/core/agents/live-lifecycle-v3.d.ts.map +1 -0
- package/dist/core/agents/live-lifecycle-v3.js +91 -0
- package/dist/core/agents/live-observation-v3.d.ts +25 -0
- package/dist/core/agents/live-observation-v3.d.ts.map +1 -0
- package/dist/core/agents/live-observation-v3.js +157 -0
- package/dist/core/agents/render/prompt-context.d.ts +4 -4
- package/dist/core/agents/render/prompt-context.d.ts.map +1 -1
- package/dist/core/agents/render/prompt-context.js +23 -58
- package/dist/core/agents/render/session-context.d.ts +1 -1
- package/dist/core/agents/render/session-context.d.ts.map +1 -1
- package/dist/core/agents/render/session-context.js +8 -32
- package/dist/core/agents/rules/claim-conflict.d.ts +3 -3
- package/dist/core/agents/rules/claim-conflict.d.ts.map +1 -1
- package/dist/core/agents/rules/claim-conflict.js +79 -127
- package/dist/core/agents/rules/commit-conflict.d.ts.map +1 -1
- package/dist/core/agents/rules/commit-conflict.js +3 -18
- package/dist/core/agents/rules/stop-hook.d.ts +9 -50
- package/dist/core/agents/rules/stop-hook.d.ts.map +1 -1
- package/dist/core/agents/rules/stop-hook.js +193 -236
- package/dist/core/agents/session-events.d.ts +5 -7
- package/dist/core/agents/session-events.d.ts.map +1 -1
- package/dist/core/agents/session-events.js +127 -95
- package/dist/core/agents/session-finalization-state-v3.d.ts +30 -0
- package/dist/core/agents/session-finalization-state-v3.d.ts.map +1 -0
- package/dist/core/agents/session-finalization-state-v3.js +40 -0
- package/dist/core/agents/session-finalizer-v3.d.ts +107 -0
- package/dist/core/agents/session-finalizer-v3.d.ts.map +1 -0
- package/dist/core/agents/session-finalizer-v3.js +734 -0
- package/dist/core/agents/session-name-display.d.ts +40 -0
- package/dist/core/agents/session-name-display.d.ts.map +1 -0
- package/dist/core/agents/session-name-display.js +119 -0
- package/dist/core/agents/state/activity-log.d.ts +3 -3
- package/dist/core/agents/state/activity-log.d.ts.map +1 -1
- package/dist/core/agents/state/activity-log.js +7 -16
- package/dist/core/agents/state/heartbeat-writer.d.ts +23 -55
- package/dist/core/agents/state/heartbeat-writer.d.ts.map +1 -1
- package/dist/core/agents/state/heartbeat-writer.js +56 -228
- package/dist/core/agents/state/live-coordination-view.d.ts +31 -0
- package/dist/core/agents/state/live-coordination-view.d.ts.map +1 -0
- package/dist/core/agents/state/live-coordination-view.js +209 -0
- package/dist/core/agents/state/session-state.d.ts +4 -3
- package/dist/core/agents/state/session-state.d.ts.map +1 -1
- package/dist/core/agents/state/session-state.js +18 -9
- package/dist/core/agents/state/stale-sweep.d.ts +1 -1
- package/dist/core/agents/state/stale-sweep.d.ts.map +1 -1
- package/dist/core/agents/state/stale-sweep.js +26 -15
- package/dist/core/artifacts/index.d.ts.map +1 -1
- package/dist/core/artifacts/index.js +5 -7
- package/dist/core/config.d.ts +33 -2
- package/dist/core/config.d.ts.map +1 -1
- package/dist/core/config.js +98 -2
- package/dist/core/context/index.d.ts +1 -4
- package/dist/core/context/index.d.ts.map +1 -1
- package/dist/core/context/index.js +9 -9
- package/dist/core/events/span-parent.d.ts +15 -0
- package/dist/core/events/span-parent.d.ts.map +1 -0
- package/dist/core/events/span-parent.js +34 -0
- package/dist/core/events/v3/advance.d.ts +14 -0
- package/dist/core/events/v3/advance.d.ts.map +1 -0
- package/dist/core/events/v3/advance.js +134 -0
- package/dist/core/events/v3/authority-outbox.d.ts +78 -0
- package/dist/core/events/v3/authority-outbox.d.ts.map +1 -0
- package/dist/core/events/v3/authority-outbox.js +399 -0
- package/dist/core/events/v3/base-builder.d.ts +20 -0
- package/dist/core/events/v3/base-builder.d.ts.map +1 -0
- package/dist/core/events/v3/base-builder.js +29 -0
- package/dist/core/events/v3/base-contract.d.ts +7576 -0
- package/dist/core/events/v3/base-contract.d.ts.map +1 -0
- package/dist/core/events/v3/base-contract.js +647 -0
- package/dist/core/events/v3/bootstrap.d.ts +34 -0
- package/dist/core/events/v3/bootstrap.d.ts.map +1 -0
- package/dist/core/events/v3/bootstrap.js +175 -0
- package/dist/core/events/v3/builder.d.ts +20 -0
- package/dist/core/events/v3/builder.d.ts.map +1 -0
- package/dist/core/events/v3/builder.js +28 -0
- package/dist/core/events/v3/canonical.d.ts +31 -0
- package/dist/core/events/v3/canonical.d.ts.map +1 -0
- package/dist/core/events/v3/canonical.js +100 -0
- package/dist/core/events/v3/capabilities.d.ts +31 -0
- package/dist/core/events/v3/capabilities.d.ts.map +1 -0
- package/dist/core/events/v3/capabilities.js +107 -0
- package/dist/core/events/v3/capability-drift.d.ts +22 -0
- package/dist/core/events/v3/capability-drift.d.ts.map +1 -0
- package/dist/core/events/v3/capability-drift.js +134 -0
- package/dist/core/events/v3/catalog.d.ts +38 -0
- package/dist/core/events/v3/catalog.d.ts.map +1 -0
- package/dist/core/events/v3/catalog.js +135 -0
- package/dist/core/events/v3/clock-order.d.ts +34 -0
- package/dist/core/events/v3/clock-order.d.ts.map +1 -0
- package/dist/core/events/v3/clock-order.js +35 -0
- package/dist/core/events/v3/contract.d.ts +171 -0
- package/dist/core/events/v3/contract.d.ts.map +1 -0
- package/dist/core/events/v3/contract.js +180 -0
- package/dist/core/events/v3/control.d.ts +111 -0
- package/dist/core/events/v3/control.d.ts.map +1 -0
- package/dist/core/events/v3/control.js +419 -0
- package/dist/core/events/v3/coordination-view.d.ts +69 -0
- package/dist/core/events/v3/coordination-view.d.ts.map +1 -0
- package/dist/core/events/v3/coordination-view.js +119 -0
- package/dist/core/events/v3/economics.d.ts +77 -0
- package/dist/core/events/v3/economics.d.ts.map +1 -0
- package/dist/core/events/v3/economics.js +274 -0
- package/dist/core/events/v3/finalization-view.d.ts +26 -0
- package/dist/core/events/v3/finalization-view.d.ts.map +1 -0
- package/dist/core/events/v3/finalization-view.js +37 -0
- package/dist/core/events/v3/fingerprint-keys.d.ts +25 -0
- package/dist/core/events/v3/fingerprint-keys.d.ts.map +1 -0
- package/dist/core/events/v3/fingerprint-keys.js +217 -0
- package/dist/core/events/v3/generated.d.ts +4 -0
- package/dist/core/events/v3/generated.d.ts.map +1 -0
- package/dist/core/events/v3/generated.js +47 -0
- package/dist/core/events/v3/ids.d.ts +9 -0
- package/dist/core/events/v3/ids.d.ts.map +1 -0
- package/dist/core/events/v3/ids.js +25 -0
- package/dist/core/events/v3/index.d.ts +35 -0
- package/dist/core/events/v3/index.d.ts.map +1 -0
- package/dist/core/events/v3/index.js +33 -0
- package/dist/core/events/v3/latency.d.ts +63 -0
- package/dist/core/events/v3/latency.d.ts.map +1 -0
- package/dist/core/events/v3/latency.js +412 -0
- package/dist/core/events/v3/live-feed.d.ts +45 -0
- package/dist/core/events/v3/live-feed.d.ts.map +1 -0
- package/dist/core/events/v3/live-feed.js +246 -0
- package/dist/core/events/v3/live-observation.d.ts +35 -0
- package/dist/core/events/v3/live-observation.d.ts.map +1 -0
- package/dist/core/events/v3/live-observation.js +1 -0
- package/dist/core/events/v3/live-routing.d.ts +57 -0
- package/dist/core/events/v3/live-routing.d.ts.map +1 -0
- package/dist/core/events/v3/live-routing.js +107 -0
- package/dist/core/events/v3/producers/command-recorder.d.ts +67 -0
- package/dist/core/events/v3/producers/command-recorder.d.ts.map +1 -0
- package/dist/core/events/v3/producers/command-recorder.js +477 -0
- package/dist/core/events/v3/producers/command.d.ts +50 -0
- package/dist/core/events/v3/producers/command.d.ts.map +1 -0
- package/dist/core/events/v3/producers/command.js +135 -0
- package/dist/core/events/v3/producers/coordination-recorder.d.ts +53 -0
- package/dist/core/events/v3/producers/coordination-recorder.d.ts.map +1 -0
- package/dist/core/events/v3/producers/coordination-recorder.js +376 -0
- package/dist/core/events/v3/producers/coordination.d.ts +90 -0
- package/dist/core/events/v3/producers/coordination.d.ts.map +1 -0
- package/dist/core/events/v3/producers/coordination.js +229 -0
- package/dist/core/events/v3/producers/hook-base.d.ts +54 -0
- package/dist/core/events/v3/producers/hook-base.d.ts.map +1 -0
- package/dist/core/events/v3/producers/hook-base.js +424 -0
- package/dist/core/events/v3/producers/hook.d.ts +29 -0
- package/dist/core/events/v3/producers/hook.d.ts.map +1 -0
- package/dist/core/events/v3/producers/hook.js +71 -0
- package/dist/core/events/v3/producers/intake.d.ts +65 -0
- package/dist/core/events/v3/producers/intake.d.ts.map +1 -0
- package/dist/core/events/v3/producers/intake.js +244 -0
- package/dist/core/events/v3/producers/recorder.d.ts +240 -0
- package/dist/core/events/v3/producers/recorder.d.ts.map +1 -0
- package/dist/core/events/v3/producers/recorder.js +2176 -0
- package/dist/core/events/v3/projection.d.ts +101 -0
- package/dist/core/events/v3/projection.d.ts.map +1 -0
- package/dist/core/events/v3/projection.js +479 -0
- package/dist/core/events/v3/reader.d.ts +75 -0
- package/dist/core/events/v3/reader.d.ts.map +1 -0
- package/dist/core/events/v3/reader.js +778 -0
- package/dist/core/events/v3/recovery-record.d.ts +47 -0
- package/dist/core/events/v3/recovery-record.d.ts.map +1 -0
- package/dist/core/events/v3/recovery-record.js +167 -0
- package/dist/core/events/v3/recovery.d.ts +22 -0
- package/dist/core/events/v3/recovery.d.ts.map +1 -0
- package/dist/core/events/v3/recovery.js +227 -0
- package/dist/core/events/v3/span-state.d.ts +52 -0
- package/dist/core/events/v3/span-state.d.ts.map +1 -0
- package/dist/core/events/v3/span-state.js +142 -0
- package/dist/core/events/v3/targets.d.ts +23 -0
- package/dist/core/events/v3/targets.d.ts.map +1 -0
- package/dist/core/events/v3/targets.js +134 -0
- package/dist/core/events/v3/turn-telemetry.d.ts +41 -0
- package/dist/core/events/v3/turn-telemetry.d.ts.map +1 -0
- package/dist/core/events/v3/turn-telemetry.js +168 -0
- package/dist/core/events/v3/validate.d.ts +9 -0
- package/dist/core/events/v3/validate.d.ts.map +1 -0
- package/dist/core/events/v3/validate.js +281 -0
- package/dist/core/events/v3/writer.d.ts +56 -0
- package/dist/core/events/v3/writer.d.ts.map +1 -0
- package/dist/core/events/v3/writer.js +335 -0
- package/dist/core/governor/index.d.ts +1 -1
- package/dist/core/governor/index.d.ts.map +1 -1
- package/dist/core/governor/index.js +1 -1
- package/dist/core/governor/plan-api.d.ts +2 -1
- package/dist/core/governor/plan-api.d.ts.map +1 -1
- package/dist/core/governor/plan-api.js +6 -3
- package/dist/core/governor/read.d.ts +1 -1
- package/dist/core/governor/read.d.ts.map +1 -1
- package/dist/core/governor/read.js +1 -1
- package/dist/core/governor/state.d.ts +9 -0
- package/dist/core/governor/state.d.ts.map +1 -1
- package/dist/core/governor/state.js +40 -3
- package/dist/core/guard/config.d.ts +5 -0
- package/dist/core/guard/config.d.ts.map +1 -0
- package/dist/core/guard/config.js +157 -0
- package/dist/core/guard/coordinator.d.ts +14 -0
- package/dist/core/guard/coordinator.d.ts.map +1 -0
- package/dist/core/guard/coordinator.js +173 -0
- package/dist/core/guard/evaluator.d.ts +4 -0
- package/dist/core/guard/evaluator.d.ts.map +1 -0
- package/dist/core/guard/evaluator.js +242 -0
- package/dist/core/guard/evidence-v3.d.ts +15 -0
- package/dist/core/guard/evidence-v3.d.ts.map +1 -0
- package/dist/core/guard/evidence-v3.js +171 -0
- package/dist/core/guard/index.d.ts +10 -0
- package/dist/core/guard/index.d.ts.map +1 -0
- package/dist/core/guard/index.js +6 -0
- package/dist/core/guard/live-source-v3.d.ts +40 -0
- package/dist/core/guard/live-source-v3.d.ts.map +1 -0
- package/dist/core/guard/live-source-v3.js +128 -0
- package/dist/core/guard/storage.d.ts +27 -0
- package/dist/core/guard/storage.d.ts.map +1 -0
- package/dist/core/guard/storage.js +140 -0
- package/dist/core/guard/types.d.ts +119 -0
- package/dist/core/guard/types.d.ts.map +1 -0
- package/dist/core/guard/types.js +1 -0
- package/dist/core/hooks/adapter/detect.d.ts +18 -1
- package/dist/core/hooks/adapter/detect.d.ts.map +1 -1
- package/dist/core/hooks/adapter/detect.js +29 -0
- package/dist/core/hooks/adapter/events.d.ts +7 -4
- package/dist/core/hooks/adapter/events.d.ts.map +1 -1
- package/dist/core/hooks/adapter/events.js +12 -4
- package/dist/core/hooks/adapter/output.d.ts +2 -2
- package/dist/core/hooks/adapter/output.d.ts.map +1 -1
- package/dist/core/hooks/adapter/parse.d.ts +7 -4
- package/dist/core/hooks/adapter/parse.d.ts.map +1 -1
- package/dist/core/hooks/adapter/parse.js +63 -25
- package/dist/core/hooks/adapter/wiring.d.ts +30 -4
- package/dist/core/hooks/adapter/wiring.d.ts.map +1 -1
- package/dist/core/hooks/adapter/wiring.js +89 -11
- package/dist/core/hooks/cli.d.ts +1 -1
- package/dist/core/hooks/cli.js +305 -444
- package/dist/core/hooks/effects/image-capture.d.ts +20 -34
- package/dist/core/hooks/effects/image-capture.d.ts.map +1 -1
- package/dist/core/hooks/effects/image-capture.js +212 -221
- package/dist/core/hooks/effects/index.d.ts +1 -9
- package/dist/core/hooks/effects/index.d.ts.map +1 -1
- package/dist/core/hooks/effects/index.js +1 -24
- package/dist/core/hooks/events/input-hash.d.ts +7 -0
- package/dist/core/hooks/events/input-hash.d.ts.map +1 -0
- package/dist/core/hooks/events/input-hash.js +43 -0
- package/dist/core/hooks/index.d.ts +4 -3
- package/dist/core/hooks/index.d.ts.map +1 -1
- package/dist/core/hooks/index.js +2 -3
- package/dist/core/hooks/resolve/coord-root.d.ts +1 -1
- package/dist/core/hooks/resolve/coord-root.js +1 -1
- package/dist/core/hooks/resolve/owner.d.ts +16 -15
- package/dist/core/hooks/resolve/owner.d.ts.map +1 -1
- package/dist/core/hooks/resolve/owner.js +51 -42
- package/dist/core/hooks/resolve/transcript.d.ts +33 -3
- package/dist/core/hooks/resolve/transcript.d.ts.map +1 -1
- package/dist/core/hooks/resolve/transcript.js +155 -14
- package/dist/core/hooks/session-name-presence.d.ts +9 -10
- package/dist/core/hooks/session-name-presence.d.ts.map +1 -1
- package/dist/core/hooks/session-name-presence.js +15 -15
- package/dist/core/hooks/unsafe-cross-shell.d.ts +1 -1
- package/dist/core/hooks/unsafe-cross-shell.d.ts.map +1 -1
- package/dist/core/journal/index.d.ts +2 -2
- package/dist/core/journal/index.d.ts.map +1 -1
- package/dist/core/journal/index.js +9 -22
- package/dist/core/presence/blob.d.ts +4 -3
- package/dist/core/presence/blob.d.ts.map +1 -1
- package/dist/core/presence/blob.js +45 -44
- package/dist/core/presence/codec-digest.d.ts +29 -0
- package/dist/core/presence/codec-digest.d.ts.map +1 -0
- package/dist/core/presence/codec-digest.js +170 -0
- package/dist/core/presence/relay-client.d.ts +1 -1
- package/dist/core/presence/relay-client.d.ts.map +1 -1
- package/dist/core/presence/relay-client.js +5 -5
- package/dist/core/work/index.d.ts +1 -1
- package/dist/core/work/index.d.ts.map +1 -1
- package/dist/core/work/index.js +1 -1
- package/dist/core/work/read.d.ts +1 -1
- package/dist/core/work/read.d.ts.map +1 -1
- package/dist/core/work/read.js +1 -1
- package/dist/core/work/runner.d.ts.map +1 -1
- package/dist/core/work/runner.js +6 -0
- package/dist/core/work/state.d.ts +9 -0
- package/dist/core/work/state.d.ts.map +1 -1
- package/dist/core/work/state.js +17 -3
- package/dist/core/workflow/engine.js +24 -25
- package/dist/core/workflow/live-session-v3.d.ts +19 -0
- package/dist/core/workflow/live-session-v3.d.ts.map +1 -0
- package/dist/core/workflow/live-session-v3.js +86 -0
- package/dist/core/workflow/scope-id.d.ts +3 -0
- package/dist/core/workflow/scope-id.d.ts.map +1 -0
- package/dist/core/workflow/scope-id.js +5 -0
- package/dist/core/workflow/workspaces/leases.d.ts +4 -0
- package/dist/core/workflow/workspaces/leases.d.ts.map +1 -1
- package/dist/core/workflow/workspaces/leases.js +53 -19
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/lib/browser/client.d.ts +41 -0
- package/dist/lib/browser/client.d.ts.map +1 -1
- package/dist/lib/browser/client.js +203 -0
- package/dist/lib/browser/critique.d.ts +28 -2
- package/dist/lib/browser/critique.d.ts.map +1 -1
- package/dist/lib/browser/critique.js +74 -18
- package/dist/lib/browser/geometry.d.ts +1 -1
- package/dist/lib/browser/geometry.d.ts.map +1 -1
- package/dist/lib/browser/geometry.js +130 -6
- package/dist/lib/browser/index.d.ts +3 -0
- package/dist/lib/browser/index.d.ts.map +1 -1
- package/dist/lib/browser/index.js +3 -0
- package/dist/lib/browser/qa-plan.d.ts +174 -0
- package/dist/lib/browser/qa-plan.d.ts.map +1 -0
- package/dist/lib/browser/qa-plan.js +321 -0
- package/dist/lib/browser/qa-reuse.d.ts +99 -0
- package/dist/lib/browser/qa-reuse.d.ts.map +1 -0
- package/dist/lib/browser/qa-reuse.js +222 -0
- package/dist/lib/browser/qa-snapshot.d.ts +64 -0
- package/dist/lib/browser/qa-snapshot.d.ts.map +1 -0
- package/dist/lib/browser/qa-snapshot.js +171 -0
- package/dist/lib/browser/runts.d.ts.map +1 -1
- package/dist/lib/browser/runts.js +22 -1
- package/dist/lib/browser/tiling.d.ts +71 -0
- package/dist/lib/browser/tiling.d.ts.map +1 -0
- package/dist/lib/browser/tiling.js +118 -0
- package/dist/lib/claude-desktop.d.ts +0 -47
- package/dist/lib/claude-desktop.d.ts.map +1 -1
- package/dist/lib/claude-desktop.js +1 -169
- package/dist/lib/context/index.d.ts +0 -3
- package/dist/lib/context/index.d.ts.map +1 -1
- package/dist/lib/context/index.js +20 -42
- package/dist/lib/council/index.d.ts +2 -2
- package/dist/lib/council/index.d.ts.map +1 -1
- package/dist/lib/council/index.js +9 -20
- package/dist/lib/docs-frontmatter.d.ts +1 -6
- package/dist/lib/docs-frontmatter.d.ts.map +1 -1
- package/dist/lib/docs-frontmatter.js +12 -78
- package/dist/lib/docs-index.d.ts +9 -0
- package/dist/lib/docs-index.d.ts.map +1 -1
- package/dist/lib/docs-index.js +32 -3
- package/dist/lib/docs-lint.d.ts.map +1 -1
- package/dist/lib/docs-lint.js +14 -30
- package/dist/lib/docs-metadata-audit.d.ts +19 -0
- package/dist/lib/docs-metadata-audit.d.ts.map +1 -0
- package/dist/lib/docs-metadata-audit.js +132 -0
- package/dist/lib/docs-metadata-managed.d.ts +23 -0
- package/dist/lib/docs-metadata-managed.d.ts.map +1 -0
- package/dist/lib/docs-metadata-managed.js +78 -0
- package/dist/lib/docs-metadata-sync.d.ts +20 -0
- package/dist/lib/docs-metadata-sync.d.ts.map +1 -0
- package/dist/lib/docs-metadata-sync.js +222 -0
- package/dist/lib/docs-metadata-v2-schema.d.ts +273 -0
- package/dist/lib/docs-metadata-v2-schema.d.ts.map +1 -0
- package/dist/lib/docs-metadata-v2-schema.js +134 -0
- package/dist/lib/docs-metadata-v2.d.ts +21 -0
- package/dist/lib/docs-metadata-v2.d.ts.map +1 -0
- package/dist/lib/docs-metadata-v2.js +424 -0
- package/dist/lib/docs-new.d.ts +11 -0
- package/dist/lib/docs-new.d.ts.map +1 -0
- package/dist/lib/docs-new.js +52 -0
- package/dist/lib/docs-sweep.d.ts.map +1 -1
- package/dist/lib/docs-sweep.js +45 -29
- package/dist/lib/headless/index.d.ts +98 -0
- package/dist/lib/headless/index.d.ts.map +1 -0
- package/dist/lib/headless/index.js +211 -0
- package/dist/lib/identities/assume.d.ts +4 -4
- package/dist/lib/identities/assume.d.ts.map +1 -1
- package/dist/lib/identities/assume.js +52 -68
- package/dist/lib/instructions/apply.d.ts +5 -4
- package/dist/lib/instructions/apply.d.ts.map +1 -1
- package/dist/lib/instructions/apply.js +32 -20
- package/dist/lib/instructions/bundle.d.ts +1 -1
- package/dist/lib/instructions/bundle.d.ts.map +1 -1
- package/dist/lib/instructions/bundle.js +1 -1
- package/dist/lib/instructions/splice.d.ts +0 -1
- package/dist/lib/instructions/splice.d.ts.map +1 -1
- package/dist/lib/instructions/splice.js +22 -6
- package/dist/lib/instructions/templates.d.ts +7 -5
- package/dist/lib/instructions/templates.d.ts.map +1 -1
- package/dist/lib/instructions/templates.js +79 -9
- package/package.json +26 -5
- package/schemas/config.schema.json +120 -2
- package/schemas/docs-metadata-v2.schema.json +441 -0
- package/schemas/event-v3.schema.json +24472 -0
- package/src/commander.ts +4 -0
- package/src/commands/adapter.ts +2 -2
- package/src/commands/agents.ts +1512 -592
- package/src/commands/artifacts.ts +7 -6
- package/src/commands/backup.ts +29 -21
- package/src/commands/browse.ts +349 -8
- package/src/commands/checkpoint.ts +4 -3
- package/src/commands/claude-desktop.ts +2 -101
- package/src/commands/context.ts +1 -6
- package/src/commands/decision.ts +27 -44
- package/src/commands/docs.ts +100 -33
- package/src/commands/doctor.ts +14 -1
- package/src/commands/events.ts +256 -0
- package/src/commands/governor.ts +18 -4
- package/src/commands/init.ts +253 -57
- package/src/commands/instructions.ts +1 -1
- package/src/commands/journal.ts +4 -13
- package/src/commands/ledger-v3.ts +111 -0
- package/src/commands/presence.ts +11 -10
- package/src/commands/sync.ts +1 -1
- package/src/commands/web.ts +67 -8
- package/src/commands/work.ts +28 -5
- package/src/core/adapter.ts +5 -0
- package/src/core/adapters/attest.ts +8 -3
- package/src/core/adapters/profiles.ts +4 -6
- package/src/core/agents/canonical-emit.ts +34 -25
- package/src/core/agents/cli.ts +236 -262
- package/src/core/agents/codex-archive-v3.ts +138 -0
- package/src/core/agents/coord-client.ts +75 -188
- package/src/core/agents/finalization.ts +120 -38
- package/src/core/agents/index.ts +4 -5
- package/src/core/agents/live-authority-v3.ts +375 -0
- package/src/core/agents/live-lifecycle-v3.ts +140 -0
- package/src/core/agents/live-observation-v3.ts +216 -0
- package/src/core/agents/render/prompt-context.ts +29 -60
- package/src/core/agents/render/session-context.ts +10 -31
- package/src/core/agents/rules/claim-conflict.ts +85 -126
- package/src/core/agents/rules/commit-conflict.ts +3 -14
- package/src/core/agents/rules/stop-hook.ts +239 -293
- package/src/core/agents/session-events.ts +137 -104
- package/src/core/agents/session-finalization-state-v3.ts +90 -0
- package/src/core/agents/session-finalizer-v3.ts +953 -0
- package/src/core/agents/session-name-display.ts +149 -0
- package/src/core/agents/state/activity-log.ts +6 -14
- package/src/core/agents/state/heartbeat-writer.ts +82 -277
- package/src/core/agents/state/live-coordination-view.ts +290 -0
- package/src/core/agents/state/session-state.ts +24 -12
- package/src/core/agents/state/stale-sweep.ts +40 -17
- package/src/core/artifacts/index.ts +4 -5
- package/src/core/config.ts +148 -3
- package/src/core/context/index.ts +9 -17
- package/src/core/events/span-parent.ts +46 -0
- package/src/core/events/v3/advance.ts +168 -0
- package/src/core/events/v3/authority-outbox.ts +548 -0
- package/src/core/events/v3/base-builder.ts +60 -0
- package/src/core/events/v3/base-contract.ts +882 -0
- package/src/core/events/v3/bootstrap.ts +226 -0
- package/src/core/events/v3/builder.ts +59 -0
- package/src/core/events/v3/canonical.ts +153 -0
- package/src/core/events/v3/capabilities.ts +171 -0
- package/src/core/events/v3/capability-drift.ts +177 -0
- package/src/core/events/v3/catalog.ts +202 -0
- package/src/core/events/v3/clock-order.ts +41 -0
- package/src/core/events/v3/contract.ts +365 -0
- package/src/core/events/v3/control.ts +576 -0
- package/src/core/events/v3/coordination-view.ts +193 -0
- package/src/core/events/v3/economics.ts +384 -0
- package/src/core/events/v3/finalization-view.ts +67 -0
- package/src/core/events/v3/fingerprint-keys.ts +260 -0
- package/src/core/events/v3/generated.ts +48 -0
- package/src/core/events/v3/ids.ts +33 -0
- package/src/core/events/v3/index.ts +322 -0
- package/src/core/events/v3/latency.ts +551 -0
- package/src/core/events/v3/live-feed.ts +319 -0
- package/src/core/events/v3/live-observation.ts +39 -0
- package/src/core/events/v3/live-routing.ts +135 -0
- package/src/core/events/v3/producers/command-recorder.ts +631 -0
- package/src/core/events/v3/producers/command.ts +201 -0
- package/src/core/events/v3/producers/coordination-recorder.ts +538 -0
- package/src/core/events/v3/producers/coordination.ts +355 -0
- package/src/core/events/v3/producers/hook-base.ts +578 -0
- package/src/core/events/v3/producers/hook.ts +119 -0
- package/src/core/events/v3/producers/intake.ts +319 -0
- package/src/core/events/v3/producers/recorder.ts +2805 -0
- package/src/core/events/v3/projection.ts +653 -0
- package/src/core/events/v3/reader.ts +1127 -0
- package/src/core/events/v3/recovery-record.ts +244 -0
- package/src/core/events/v3/recovery.ts +271 -0
- package/src/core/events/v3/span-state.ts +187 -0
- package/src/core/events/v3/targets.ts +182 -0
- package/src/core/events/v3/turn-telemetry.ts +259 -0
- package/src/core/events/v3/validate.ts +361 -0
- package/src/core/events/v3/writer.ts +419 -0
- package/src/core/governor/index.ts +3 -0
- package/src/core/governor/plan-api.ts +10 -2
- package/src/core/governor/read.ts +3 -0
- package/src/core/governor/state.ts +52 -5
- package/src/core/guard/config.ts +206 -0
- package/src/core/guard/coordinator.ts +227 -0
- package/src/core/guard/evaluator.ts +343 -0
- package/src/core/guard/evidence-v3.ts +227 -0
- package/src/core/guard/index.ts +35 -0
- package/src/core/guard/live-source-v3.ts +204 -0
- package/src/core/guard/storage.ts +188 -0
- package/src/core/guard/types.ts +152 -0
- package/src/core/hooks/adapter/detect.ts +28 -1
- package/src/core/hooks/adapter/events.ts +14 -6
- package/src/core/hooks/adapter/output.ts +7 -2
- package/src/core/hooks/adapter/parse.ts +80 -38
- package/src/core/hooks/adapter/wiring.ts +119 -13
- package/src/core/hooks/cli.ts +351 -466
- package/src/core/hooks/effects/image-capture.ts +228 -238
- package/src/core/hooks/effects/index.ts +1 -36
- package/src/core/hooks/events/input-hash.ts +47 -0
- package/src/core/hooks/index.ts +4 -11
- package/src/core/hooks/resolve/coord-root.ts +1 -1
- package/src/core/hooks/resolve/owner.ts +52 -45
- package/src/core/hooks/resolve/transcript.ts +165 -14
- package/src/core/hooks/session-name-presence.ts +14 -15
- package/src/core/hooks/unsafe-cross-shell.ts +1 -1
- package/src/core/journal/index.ts +15 -22
- package/src/core/presence/blob.ts +48 -41
- package/src/core/presence/codec-digest.ts +215 -0
- package/src/core/presence/relay-client.ts +5 -5
- package/src/core/work/index.ts +3 -0
- package/src/core/work/read.ts +3 -0
- package/src/core/work/runner.ts +6 -0
- package/src/core/work/state.ts +27 -3
- package/src/core/workflow/engine.ts +24 -24
- package/src/core/workflow/live-session-v3.ts +126 -0
- package/src/core/workflow/scope-id.ts +6 -0
- package/src/core/workflow/workspaces/leases.ts +56 -19
- package/src/index.ts +1 -1
- package/src/lib/browser/client.ts +230 -0
- package/src/lib/browser/critique.ts +104 -27
- package/src/lib/browser/geometry.ts +143 -14
- package/src/lib/browser/index.ts +34 -0
- package/src/lib/browser/qa-plan.ts +501 -0
- package/src/lib/browser/qa-reuse.ts +306 -0
- package/src/lib/browser/qa-snapshot.ts +223 -0
- package/src/lib/browser/runts.ts +27 -2
- package/src/lib/browser/tiling.ts +164 -0
- package/src/lib/claude-desktop.ts +1 -232
- package/src/lib/context/index.ts +22 -46
- package/src/lib/council/index.ts +9 -21
- package/src/lib/docs-frontmatter.ts +8 -79
- package/src/lib/docs-index.ts +33 -3
- package/src/lib/docs-lint.ts +15 -29
- package/src/lib/docs-metadata-audit.ts +166 -0
- package/src/lib/docs-metadata-managed.ts +83 -0
- package/src/lib/docs-metadata-sync.ts +262 -0
- package/src/lib/docs-metadata-v2-schema.ts +138 -0
- package/src/lib/docs-metadata-v2.ts +646 -0
- package/src/lib/docs-new.ts +63 -0
- package/src/lib/docs-sweep.ts +42 -28
- package/src/lib/headless/index.ts +287 -0
- package/src/lib/identities/assume.ts +67 -86
- package/src/lib/instructions/apply.ts +33 -20
- package/src/lib/instructions/bundle.ts +2 -2
- package/src/lib/instructions/splice.ts +21 -7
- package/src/lib/instructions/templates.ts +85 -13
- package/dist/core/agents/cli-emit.d.ts +0 -27
- package/dist/core/agents/cli-emit.d.ts.map +0 -1
- package/dist/core/agents/cli-emit.js +0 -57
- package/dist/core/agents/codex-replay.d.ts +0 -29
- package/dist/core/agents/codex-replay.d.ts.map +0 -1
- package/dist/core/agents/codex-replay.js +0 -138
- package/dist/core/agents/events/consume.d.ts +0 -82
- package/dist/core/agents/events/consume.d.ts.map +0 -1
- package/dist/core/agents/events/consume.js +0 -195
- package/dist/core/agents/events/emit.d.ts +0 -42
- package/dist/core/agents/events/emit.d.ts.map +0 -1
- package/dist/core/agents/events/emit.js +0 -75
- package/dist/core/agents/events/ulid.d.ts +0 -11
- package/dist/core/agents/events/ulid.d.ts.map +0 -1
- package/dist/core/agents/events/ulid.js +0 -47
- package/dist/core/agents/state/heartbeat-projector.d.ts +0 -76
- package/dist/core/agents/state/heartbeat-projector.d.ts.map +0 -1
- package/dist/core/agents/state/heartbeat-projector.js +0 -581
- package/dist/core/hooks/events/emit.d.ts +0 -31
- package/dist/core/hooks/events/emit.d.ts.map +0 -1
- package/dist/core/hooks/events/emit.js +0 -93
- package/dist/core/hooks/events/rotate.d.ts +0 -43
- package/dist/core/hooks/events/rotate.d.ts.map +0 -1
- package/dist/core/hooks/events/rotate.js +0 -142
- package/dist/core/hooks/events/schema.d.ts +0 -341
- package/dist/core/hooks/events/schema.d.ts.map +0 -1
- package/dist/core/hooks/events/schema.js +0 -12
- package/dist/core/hooks/events/ulid.d.ts +0 -10
- package/dist/core/hooks/events/ulid.d.ts.map +0 -1
- package/dist/core/hooks/events/ulid.js +0 -47
- package/dist/lib/docs-frontmatter-migrate.d.ts +0 -33
- package/dist/lib/docs-frontmatter-migrate.d.ts.map +0 -1
- package/dist/lib/docs-frontmatter-migrate.js +0 -364
- package/src/core/agents/cli-emit.ts +0 -64
- package/src/core/agents/codex-replay.ts +0 -163
- package/src/core/agents/events/consume.ts +0 -254
- package/src/core/agents/events/emit.ts +0 -115
- package/src/core/agents/events/ulid.ts +0 -51
- package/src/core/agents/state/heartbeat-projector.ts +0 -645
- package/src/core/hooks/events/emit.ts +0 -125
- package/src/core/hooks/events/rotate.ts +0 -151
- package/src/core/hooks/events/schema.ts +0 -582
- package/src/core/hooks/events/ulid.ts +0 -51
- package/src/lib/docs-frontmatter-migrate.ts +0 -427
|
@@ -0,0 +1,424 @@
|
|
|
1
|
+
import { buildEventV3Base } from "../base-builder.js";
|
|
2
|
+
import { fingerprintV3, normalizeNativeIdV3 } from "../canonical.js";
|
|
3
|
+
import { adapterSignalSupportV3, adapterTurnWaitCountSupportV3 } from "../capabilities.js";
|
|
4
|
+
import { eventIdV3 } from "../ids.js";
|
|
5
|
+
import { exactToolInputFingerprintV3, extractTargetsV3 } from "../targets.js";
|
|
6
|
+
/** Normalize one already-parsed hook payload directly into V3Base without retaining its raw fields. */
|
|
7
|
+
export function normalizeHookEventV3Base(signal, payload, context) {
|
|
8
|
+
const eventId = context.event_id ?? eventIdV3();
|
|
9
|
+
const sessionNative = payload.session_id ?? payload.conversation_id ?? payload.agent_id ?? context.instance_id;
|
|
10
|
+
const sessionId = asSessionId(normalizeNativeIdV3(context.fingerprintContext, `${context.adapter}.session`, sessionNative));
|
|
11
|
+
const turnNative = payload.turn_id ?? context.turn_native_id ?? `${sessionNative}:${context.sequence}`;
|
|
12
|
+
// A native payload turn id normally outranks the producer-state stamp: a
|
|
13
|
+
// lost or late user-prompt-submit hook must not mis-attribute this event to
|
|
14
|
+
// a stale turn (ADR 0078 turn attribution). Turn terminals are different:
|
|
15
|
+
// Cursor can mint a new generation_id for Stop, so the producer's open turn
|
|
16
|
+
// is the authoritative correlation target when one exists.
|
|
17
|
+
const terminalTurnId = signal === "stop" || signal === "stop-failure" ? context.turn_id : undefined;
|
|
18
|
+
const turnId = terminalTurnId
|
|
19
|
+
? terminalTurnId
|
|
20
|
+
: payload.turn_id
|
|
21
|
+
? asTurnId(normalizeNativeIdV3(context.fingerprintContext, `${context.adapter}.turn`, payload.turn_id))
|
|
22
|
+
: (context.turn_id ??
|
|
23
|
+
asTurnId(normalizeNativeIdV3(context.fingerprintContext, `${context.adapter}.turn`, turnNative)));
|
|
24
|
+
const generationScope = {
|
|
25
|
+
root_id: context.root_id,
|
|
26
|
+
instance_id: context.instance_id,
|
|
27
|
+
session_id: sessionId,
|
|
28
|
+
generation_id: context.generation_id,
|
|
29
|
+
...(context.run_id ? { run_id: context.run_id } : {}),
|
|
30
|
+
...(context.workflow_id ? { workflow_id: context.workflow_id } : {}),
|
|
31
|
+
...(context.workflow_agent_id ? { workflow_agent_id: context.workflow_agent_id } : {}),
|
|
32
|
+
};
|
|
33
|
+
const turnScope = { ...generationScope, turn_id: turnId };
|
|
34
|
+
const producer = {
|
|
35
|
+
producer_id: context.producer_id,
|
|
36
|
+
boot_id: context.boot_id,
|
|
37
|
+
sequence: context.sequence,
|
|
38
|
+
component: "agent-hook",
|
|
39
|
+
build_id: context.build_id,
|
|
40
|
+
platform: context.platform,
|
|
41
|
+
...(context.bridge ? { bridge: context.bridge } : {}),
|
|
42
|
+
};
|
|
43
|
+
const provenance = {
|
|
44
|
+
source_event: `${context.adapter}.${signal}`,
|
|
45
|
+
attestation: "native",
|
|
46
|
+
confidence: "exact",
|
|
47
|
+
...(payload.tool_use_id
|
|
48
|
+
? {
|
|
49
|
+
source_record_id: asSourceId(normalizeNativeIdV3(context.fingerprintContext, `${context.adapter}.source-record`, payload.tool_use_id)),
|
|
50
|
+
}
|
|
51
|
+
: {}),
|
|
52
|
+
attribution: {
|
|
53
|
+
method: "native_payload",
|
|
54
|
+
state: "verified",
|
|
55
|
+
subject_instance_id: context.instance_id,
|
|
56
|
+
},
|
|
57
|
+
};
|
|
58
|
+
const common = {
|
|
59
|
+
event_id: eventId,
|
|
60
|
+
producer,
|
|
61
|
+
attestation_id: context.attestation_id,
|
|
62
|
+
provenance,
|
|
63
|
+
observed_at: context.observed_at,
|
|
64
|
+
recorded_at: context.recorded_at,
|
|
65
|
+
monotonic_ns: context.monotonic_ns,
|
|
66
|
+
clock_id: context.clock_id,
|
|
67
|
+
};
|
|
68
|
+
const causedBy = context.caused_by ?? [];
|
|
69
|
+
switch (signal) {
|
|
70
|
+
case "session-start": {
|
|
71
|
+
const runtimeAttestation = {
|
|
72
|
+
attestation_id: context.attestation_id,
|
|
73
|
+
generation_id: context.generation_id,
|
|
74
|
+
adapter: observedIdentity(context.adapter, context.adapterVersion),
|
|
75
|
+
harness: observedIdentity(context.adapter, context.harnessVersion),
|
|
76
|
+
model: payload.model
|
|
77
|
+
? {
|
|
78
|
+
state: "observed",
|
|
79
|
+
value: { provider: providerFor(context.adapter), id: safeModelId(payload.model) },
|
|
80
|
+
attestation: "native",
|
|
81
|
+
confidence: "exact",
|
|
82
|
+
}
|
|
83
|
+
: { state: "expected_but_missing", capability: "model_identity", reason: "not_reported" },
|
|
84
|
+
capability_profile: context.capability_profile,
|
|
85
|
+
declared_by_event_id: eventId,
|
|
86
|
+
};
|
|
87
|
+
return buildEventV3Base("session.started", {
|
|
88
|
+
...common,
|
|
89
|
+
scope: generationScope,
|
|
90
|
+
links: { caused_by: causedBy },
|
|
91
|
+
payload: {
|
|
92
|
+
runtime_attestation: runtimeAttestation,
|
|
93
|
+
resume: payload.source === "resume"
|
|
94
|
+
? { state: "unknown", reason: "prior_generation_not_bound" }
|
|
95
|
+
: { state: "not_applicable" },
|
|
96
|
+
},
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
case "session-end":
|
|
100
|
+
return buildEventV3Base("session.ended", {
|
|
101
|
+
...common,
|
|
102
|
+
scope: generationScope,
|
|
103
|
+
links: { caused_by: causedBy },
|
|
104
|
+
payload: {
|
|
105
|
+
outcome: payload.clean_exit === true
|
|
106
|
+
? "succeeded"
|
|
107
|
+
: payload.clean_exit === false
|
|
108
|
+
? "failed"
|
|
109
|
+
: "unknown",
|
|
110
|
+
authority: "native",
|
|
111
|
+
reason: payload.clean_exit === true
|
|
112
|
+
? "native_clean_exit"
|
|
113
|
+
: payload.clean_exit === false
|
|
114
|
+
? "native_unclean_exit"
|
|
115
|
+
: "native_exit_outcome_unknown",
|
|
116
|
+
completeness: { state: "unknown", reason: "terminal_signal_coverage_unmeasured" },
|
|
117
|
+
},
|
|
118
|
+
});
|
|
119
|
+
case "user-prompt-submit": {
|
|
120
|
+
const prompt = payload.prompt ?? "";
|
|
121
|
+
return buildEventV3Base("turn.started", {
|
|
122
|
+
...common,
|
|
123
|
+
scope: turnScope,
|
|
124
|
+
links: { caused_by: causedBy },
|
|
125
|
+
payload: {
|
|
126
|
+
input: {
|
|
127
|
+
storage: "omitted",
|
|
128
|
+
media_type: "text/plain",
|
|
129
|
+
bytes: Buffer.byteLength(prompt, "utf8"),
|
|
130
|
+
fingerprint: fingerprintV3(context.fingerprintContext, "user-prompt", prompt),
|
|
131
|
+
},
|
|
132
|
+
intent_kind: "unknown",
|
|
133
|
+
...(context.stop_remediation ? { stop_remediation: true } : {}),
|
|
134
|
+
},
|
|
135
|
+
});
|
|
136
|
+
}
|
|
137
|
+
case "stop":
|
|
138
|
+
case "stop-failure":
|
|
139
|
+
return buildEventV3Base("turn.completed", {
|
|
140
|
+
...common,
|
|
141
|
+
scope: turnScope,
|
|
142
|
+
links: { caused_by: causedBy },
|
|
143
|
+
payload: {
|
|
144
|
+
outcome: signal === "stop" ? "succeeded" : "failed",
|
|
145
|
+
duration_ms: measuredOrMissing(context.duration_ms, "turn_duration", "turn_timing_not_supplied"),
|
|
146
|
+
tool_call_count: context.tool_call_count_support === "unsupported"
|
|
147
|
+
? { state: "unsupported", capability: "turn_tool_call_count" }
|
|
148
|
+
: measuredOrMissing(context.tool_call_count, "turn_tool_call_count", context.tool_call_count_missing_reason ?? "turn_aggregate_not_supplied"),
|
|
149
|
+
wait_count: adapterTurnWaitCountSupportV3(context.adapter) === "unsupported"
|
|
150
|
+
? { state: "unsupported", capability: "turn_wait_count" }
|
|
151
|
+
: measuredOrMissing(undefined, "turn_wait_count", "turn_wait_aggregate_not_supplied"),
|
|
152
|
+
response: context.response_bytes === undefined
|
|
153
|
+
? { state: "unsupported", capability: "turn_response_descriptor" }
|
|
154
|
+
: {
|
|
155
|
+
state: "observed",
|
|
156
|
+
value: {
|
|
157
|
+
storage: "omitted",
|
|
158
|
+
media_type: "text/plain",
|
|
159
|
+
bytes: context.response_bytes,
|
|
160
|
+
},
|
|
161
|
+
attestation: "derived",
|
|
162
|
+
confidence: "exact",
|
|
163
|
+
},
|
|
164
|
+
...(context.turn_ritual
|
|
165
|
+
? { ritual: turnRitualObservation(context.adapter, context.turn_ritual) }
|
|
166
|
+
: {}),
|
|
167
|
+
},
|
|
168
|
+
});
|
|
169
|
+
case "pre-tool-use": {
|
|
170
|
+
if (!payload.tool_name || !context.span_id)
|
|
171
|
+
return null;
|
|
172
|
+
const toolInput = payload.tool_input ?? null;
|
|
173
|
+
return buildEventV3Base("tool.requested", {
|
|
174
|
+
...common,
|
|
175
|
+
scope: turnScope,
|
|
176
|
+
links: { caused_by: causedBy, span_id: context.span_id },
|
|
177
|
+
payload: {
|
|
178
|
+
tool: { namespace: context.adapter, name: safeToolName(payload.tool_name) },
|
|
179
|
+
input: {
|
|
180
|
+
storage: "omitted",
|
|
181
|
+
media_type: "application/json",
|
|
182
|
+
bytes: byteLengthOfUnknown(toolInput),
|
|
183
|
+
},
|
|
184
|
+
exact_input: exactToolInputFingerprintV3(context.fingerprintContext, context.adapter, payload.tool_name, toolInput),
|
|
185
|
+
targets: extractTargetsV3({
|
|
186
|
+
coordRoot: context.coordRoot,
|
|
187
|
+
toolNamespace: context.adapter,
|
|
188
|
+
toolName: payload.tool_name,
|
|
189
|
+
toolInput,
|
|
190
|
+
fingerprintContext: context.fingerprintContext,
|
|
191
|
+
}),
|
|
192
|
+
},
|
|
193
|
+
});
|
|
194
|
+
}
|
|
195
|
+
case "post-tool-use":
|
|
196
|
+
case "post-tool-use-failure": {
|
|
197
|
+
if (!payload.tool_name || !context.span_id)
|
|
198
|
+
return null;
|
|
199
|
+
return buildEventV3Base("tool.completed", {
|
|
200
|
+
...common,
|
|
201
|
+
scope: turnScope,
|
|
202
|
+
links: { caused_by: causedBy, span_id: context.span_id },
|
|
203
|
+
payload: {
|
|
204
|
+
tool: { namespace: context.adapter, name: safeToolName(payload.tool_name) },
|
|
205
|
+
outcome: signal === "post-tool-use" ? "succeeded" : "failed",
|
|
206
|
+
duration_ms: measuredOrMissing(context.duration_ms, "tool_duration", "span_timing_not_supplied"),
|
|
207
|
+
result: {
|
|
208
|
+
storage: "omitted",
|
|
209
|
+
media_type: typeof payload.tool_response === "string" ? "text/plain" : "application/json",
|
|
210
|
+
bytes: byteLengthOfUnknown(payload.tool_response ?? null),
|
|
211
|
+
},
|
|
212
|
+
...(signal === "post-tool-use-failure"
|
|
213
|
+
? { error: { class: "adapter_tool_failure" } }
|
|
214
|
+
: {}),
|
|
215
|
+
},
|
|
216
|
+
});
|
|
217
|
+
}
|
|
218
|
+
case "permission-request": {
|
|
219
|
+
const waitNative = payload.tool_use_id ?? `${sessionNative}:${context.sequence}`;
|
|
220
|
+
const waitId = normalizeNativeIdV3(context.fingerprintContext, `${context.adapter}.wait`, waitNative);
|
|
221
|
+
return buildEventV3Base("wait.started", {
|
|
222
|
+
...common,
|
|
223
|
+
scope: turnScope,
|
|
224
|
+
links: { caused_by: causedBy },
|
|
225
|
+
payload: { wait_id: waitId, kind: "permission" },
|
|
226
|
+
});
|
|
227
|
+
}
|
|
228
|
+
case "sub-agent-start": {
|
|
229
|
+
if (!context.delegation_id || !context.child_generation_id)
|
|
230
|
+
return null;
|
|
231
|
+
return buildEventV3Base("agent.started", {
|
|
232
|
+
...common,
|
|
233
|
+
scope: generationScope,
|
|
234
|
+
links: {
|
|
235
|
+
caused_by: causedBy,
|
|
236
|
+
delegation_id: context.delegation_id,
|
|
237
|
+
parent_generation_id: context.generation_id,
|
|
238
|
+
},
|
|
239
|
+
payload: {
|
|
240
|
+
delegation_id: context.delegation_id,
|
|
241
|
+
child_generation_id: context.child_generation_id,
|
|
242
|
+
role: safeToken(context.agent_role ?? "agent", "agent"),
|
|
243
|
+
},
|
|
244
|
+
});
|
|
245
|
+
}
|
|
246
|
+
case "sub-agent-stop": {
|
|
247
|
+
if (!context.delegation_id || !context.child_generation_id)
|
|
248
|
+
return null;
|
|
249
|
+
return buildEventV3Base("agent.completed", {
|
|
250
|
+
...common,
|
|
251
|
+
scope: generationScope,
|
|
252
|
+
links: {
|
|
253
|
+
caused_by: causedBy,
|
|
254
|
+
delegation_id: context.delegation_id,
|
|
255
|
+
parent_generation_id: context.generation_id,
|
|
256
|
+
},
|
|
257
|
+
payload: {
|
|
258
|
+
delegation_id: context.delegation_id,
|
|
259
|
+
child_generation_id: context.child_generation_id,
|
|
260
|
+
outcome: payload.exit_status === "ok"
|
|
261
|
+
? "succeeded"
|
|
262
|
+
: payload.exit_status === "interrupted"
|
|
263
|
+
? "interrupted"
|
|
264
|
+
: payload.exit_status
|
|
265
|
+
? "failed"
|
|
266
|
+
: "unknown",
|
|
267
|
+
},
|
|
268
|
+
});
|
|
269
|
+
}
|
|
270
|
+
case "pre-compact":
|
|
271
|
+
return buildEventV3Base("context.compaction_started", {
|
|
272
|
+
...common,
|
|
273
|
+
scope: generationScope,
|
|
274
|
+
links: { caused_by: causedBy },
|
|
275
|
+
payload: {
|
|
276
|
+
before: contextMeasurement(inputContextMeasurement(payload, "before"), context, "pre_compaction"),
|
|
277
|
+
method: `${context.adapter.replaceAll("-", "_")}_hook`,
|
|
278
|
+
},
|
|
279
|
+
});
|
|
280
|
+
case "post-compact":
|
|
281
|
+
return buildEventV3Base("context.compaction_completed", {
|
|
282
|
+
...common,
|
|
283
|
+
scope: generationScope,
|
|
284
|
+
links: { caused_by: causedBy },
|
|
285
|
+
payload: {
|
|
286
|
+
outcome: "succeeded",
|
|
287
|
+
before: contextMeasurement(inputContextMeasurement(payload, "before"), context, "pre_compaction"),
|
|
288
|
+
after: contextMeasurement(inputContextMeasurement(payload, "after"), context, "post_compaction"),
|
|
289
|
+
},
|
|
290
|
+
});
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
function turnRitualObservation(adapter, evidence) {
|
|
294
|
+
if (adapter === "cursor") {
|
|
295
|
+
const unsupported = { state: "unsupported", capability: "assistant_reply_text" };
|
|
296
|
+
return {
|
|
297
|
+
status_box_present: unsupported,
|
|
298
|
+
status_box_present_strict: unsupported,
|
|
299
|
+
session_name: unsupported,
|
|
300
|
+
};
|
|
301
|
+
}
|
|
302
|
+
const observed = (value) => ({
|
|
303
|
+
state: "observed",
|
|
304
|
+
value,
|
|
305
|
+
attestation: "derived",
|
|
306
|
+
confidence: "exact",
|
|
307
|
+
});
|
|
308
|
+
return {
|
|
309
|
+
status_box_present: observed(evidence.status_box_present),
|
|
310
|
+
status_box_present_strict: observed(evidence.status_box_present_strict),
|
|
311
|
+
session_name: observed({
|
|
312
|
+
required: evidence.session_name_required,
|
|
313
|
+
present: evidence.session_name_present,
|
|
314
|
+
}),
|
|
315
|
+
};
|
|
316
|
+
}
|
|
317
|
+
function inputContextMeasurement(payload, phase) {
|
|
318
|
+
const metadata = plainRecord(payload.raw.compact_metadata);
|
|
319
|
+
const usedKeys = phase === "before"
|
|
320
|
+
? ["pre_tokens", "pre_compact_tokens", "used_tokens"]
|
|
321
|
+
: ["post_tokens", "post_compact_tokens", "used_tokens"];
|
|
322
|
+
const limitKeys = [
|
|
323
|
+
"context_window_size",
|
|
324
|
+
"context_window_tokens",
|
|
325
|
+
"window_tokens",
|
|
326
|
+
"limit_tokens",
|
|
327
|
+
];
|
|
328
|
+
return {
|
|
329
|
+
used: firstNumber(payload.raw, metadata, usedKeys),
|
|
330
|
+
limit: firstNumber(payload.raw, metadata, limitKeys),
|
|
331
|
+
};
|
|
332
|
+
}
|
|
333
|
+
function contextMeasurement(measurement, context, capability) {
|
|
334
|
+
if (adapterSignalSupportV3(context.adapter, capability) === "unsupported") {
|
|
335
|
+
return { state: "unsupported", capability };
|
|
336
|
+
}
|
|
337
|
+
if (measurement.used === undefined || measurement.limit === undefined || measurement.limit < 1) {
|
|
338
|
+
return {
|
|
339
|
+
state: "expected_but_missing",
|
|
340
|
+
capability,
|
|
341
|
+
reason: "context_measurement_incomplete",
|
|
342
|
+
};
|
|
343
|
+
}
|
|
344
|
+
return {
|
|
345
|
+
state: "observed",
|
|
346
|
+
value: {
|
|
347
|
+
used_tokens: Math.floor(measurement.used),
|
|
348
|
+
limit_tokens: Math.floor(measurement.limit),
|
|
349
|
+
remaining_tokens: Math.max(0, Math.floor(measurement.limit - measurement.used)),
|
|
350
|
+
measured_at: context.observed_at ?? context.recorded_at ?? new Date().toISOString(),
|
|
351
|
+
method: `${context.adapter.replaceAll("-", "_")}_hook`,
|
|
352
|
+
},
|
|
353
|
+
attestation: "native",
|
|
354
|
+
confidence: "exact",
|
|
355
|
+
};
|
|
356
|
+
}
|
|
357
|
+
function firstNumber(primary, secondary, keys) {
|
|
358
|
+
for (const key of keys) {
|
|
359
|
+
for (const source of [primary, secondary]) {
|
|
360
|
+
const value = source?.[key];
|
|
361
|
+
if (typeof value === "number" && Number.isFinite(value) && value >= 0)
|
|
362
|
+
return value;
|
|
363
|
+
}
|
|
364
|
+
}
|
|
365
|
+
return undefined;
|
|
366
|
+
}
|
|
367
|
+
function plainRecord(value) {
|
|
368
|
+
if (!value || typeof value !== "object" || Array.isArray(value))
|
|
369
|
+
return undefined;
|
|
370
|
+
const prototype = Object.getPrototypeOf(value);
|
|
371
|
+
return prototype === Object.prototype || prototype === null
|
|
372
|
+
? value
|
|
373
|
+
: undefined;
|
|
374
|
+
}
|
|
375
|
+
function observedIdentity(id, version) {
|
|
376
|
+
return {
|
|
377
|
+
state: "observed",
|
|
378
|
+
value: { id, ...(version ? { version } : {}) },
|
|
379
|
+
attestation: "native",
|
|
380
|
+
confidence: "exact",
|
|
381
|
+
};
|
|
382
|
+
}
|
|
383
|
+
function providerFor(adapter) {
|
|
384
|
+
if (adapter === "claude-code")
|
|
385
|
+
return "anthropic";
|
|
386
|
+
if (adapter === "codex")
|
|
387
|
+
return "openai";
|
|
388
|
+
return "cursor";
|
|
389
|
+
}
|
|
390
|
+
function safeModelId(value) {
|
|
391
|
+
return safeToken(value, "unknown-model");
|
|
392
|
+
}
|
|
393
|
+
function safeToolName(value) {
|
|
394
|
+
return safeToken(value, "unknown-tool");
|
|
395
|
+
}
|
|
396
|
+
function safeToken(value, fallback) {
|
|
397
|
+
const normalized = value
|
|
398
|
+
.normalize("NFC")
|
|
399
|
+
.replace(/[^a-zA-Z0-9._:/+-]/g, "_")
|
|
400
|
+
.slice(0, 128);
|
|
401
|
+
return /^[a-zA-Z0-9]/.test(normalized) ? normalized : fallback;
|
|
402
|
+
}
|
|
403
|
+
function byteLengthOfUnknown(value) {
|
|
404
|
+
try {
|
|
405
|
+
return Buffer.byteLength(JSON.stringify(value) ?? "null", "utf8");
|
|
406
|
+
}
|
|
407
|
+
catch {
|
|
408
|
+
return 0;
|
|
409
|
+
}
|
|
410
|
+
}
|
|
411
|
+
function measuredOrMissing(value, capability, reason) {
|
|
412
|
+
return value === undefined
|
|
413
|
+
? { state: "expected_but_missing", capability, reason }
|
|
414
|
+
: { state: "observed", value, attestation: "derived", confidence: "exact" };
|
|
415
|
+
}
|
|
416
|
+
function asSessionId(value) {
|
|
417
|
+
return `sid_${value.slice(4)}`;
|
|
418
|
+
}
|
|
419
|
+
function asTurnId(value) {
|
|
420
|
+
return `tid_${value.slice(4)}`;
|
|
421
|
+
}
|
|
422
|
+
function asSourceId(value) {
|
|
423
|
+
return value;
|
|
424
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { ParsedPayload } from "../../../hooks/adapter/parse.js";
|
|
2
|
+
import type { EventV3Base } from "../base-contract.js";
|
|
3
|
+
import type { EventOfTypeV3, EventTypeV3, SpanSummaryV3 } from "../contract.js";
|
|
4
|
+
import { type HarnessTimingAccumulatorV3, type TurnTelemetryV3 } from "../turn-telemetry.js";
|
|
5
|
+
import { type HookProducerContextV3Base, type HookSignalV3Base } from "./hook-base.js";
|
|
6
|
+
export interface HookProducerContextV3 extends HookProducerContextV3Base {
|
|
7
|
+
/** Required for terminal events; captured when the corresponding span opens. */
|
|
8
|
+
terminal_span?: SpanSummaryV3;
|
|
9
|
+
/** Required by V3 delegation starts so the child span is anchored in its parent tree. */
|
|
10
|
+
parent_span_id?: `span_${string}`;
|
|
11
|
+
/** Optional recorder aggregate. An empty aggregate remains explicit missing evidence. */
|
|
12
|
+
harness_timing?: HarnessTimingAccumulatorV3;
|
|
13
|
+
/** Test/replay override for already-extracted telemetry. */
|
|
14
|
+
turn_telemetry?: TurnTelemetryV3;
|
|
15
|
+
}
|
|
16
|
+
export type HookSignalV3 = HookSignalV3Base;
|
|
17
|
+
export type HookEventV3 = EventOfTypeV3<EventTypeV3>;
|
|
18
|
+
/**
|
|
19
|
+
* Normalize one hook payload to the V3 contract.
|
|
20
|
+
*
|
|
21
|
+
* The V3 base normalizer owns privacy and scope. This adapter adds contract
|
|
22
|
+
* identity, self-contained terminal spans, and economics. Returning null for an incomplete terminal prevents a producer
|
|
23
|
+
* from writing a structurally valid-looking event without its load-bearing
|
|
24
|
+
* self-contained span.
|
|
25
|
+
*/
|
|
26
|
+
export declare function normalizeHookEventV3(signal: HookSignalV3Base, payload: ParsedPayload, context: HookProducerContextV3): HookEventV3 | null;
|
|
27
|
+
/** Upgrade recorder-synthesized hook events, including resolving wait terminals. */
|
|
28
|
+
export declare function upgradeHookEventV3(base: EventV3Base, source: ParsedPayload, context: HookProducerContextV3): HookEventV3 | null;
|
|
29
|
+
//# sourceMappingURL=hook.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hook.d.ts","sourceRoot":"","sources":["../../../../../src/core/events/v3/producers/hook.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iCAAiC,CAAC;AACrE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,KAAK,EAAE,aAAa,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAGhF,OAAO,EAGL,KAAK,0BAA0B,EAE/B,KAAK,eAAe,EACrB,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EACL,KAAK,yBAAyB,EAC9B,KAAK,gBAAgB,EAEtB,MAAM,gBAAgB,CAAC;AAExB,MAAM,WAAW,qBAAsB,SAAQ,yBAAyB;IACtE,gFAAgF;IAChF,aAAa,CAAC,EAAE,aAAa,CAAC;IAC9B,yFAAyF;IACzF,cAAc,CAAC,EAAE,QAAQ,MAAM,EAAE,CAAC;IAClC,yFAAyF;IACzF,cAAc,CAAC,EAAE,0BAA0B,CAAC;IAC5C,4DAA4D;IAC5D,cAAc,CAAC,EAAE,eAAe,CAAC;CAClC;AAED,MAAM,MAAM,YAAY,GAAG,gBAAgB,CAAC;AAU5C,MAAM,MAAM,WAAW,GAAG,aAAa,CAAC,WAAW,CAAC,CAAC;AAErD;;;;;;;GAOG;AACH,wBAAgB,oBAAoB,CAClC,MAAM,EAAE,gBAAgB,EACxB,OAAO,EAAE,aAAa,EACtB,OAAO,EAAE,qBAAqB,GAC7B,WAAW,GAAG,IAAI,CAIpB;AAED,oFAAoF;AACpF,wBAAgB,kBAAkB,CAChC,IAAI,EAAE,WAAW,EACjB,MAAM,EAAE,aAAa,EACrB,OAAO,EAAE,qBAAqB,GAC7B,WAAW,GAAG,IAAI,CAuBpB"}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { EVENT_V3_CONTRACT_MAJOR, EVENT_V3_CONTRACT_NAME } from "../contract.js";
|
|
2
|
+
import { EVENT_V3_SCHEMA_DIGEST } from "../generated.js";
|
|
3
|
+
import { emptyHarnessTimingV3, extractTurnTelemetryV3, harnessObservationV3, } from "../turn-telemetry.js";
|
|
4
|
+
import { assertEventV3 } from "../validate.js";
|
|
5
|
+
import { normalizeHookEventV3Base, } from "./hook-base.js";
|
|
6
|
+
const TERMINAL_EVENT_TYPES = new Set([
|
|
7
|
+
"session.ended",
|
|
8
|
+
"turn.completed",
|
|
9
|
+
"tool.completed",
|
|
10
|
+
"agent.completed",
|
|
11
|
+
"wait.ended",
|
|
12
|
+
]);
|
|
13
|
+
/**
|
|
14
|
+
* Normalize one hook payload to the V3 contract.
|
|
15
|
+
*
|
|
16
|
+
* The V3 base normalizer owns privacy and scope. This adapter adds contract
|
|
17
|
+
* identity, self-contained terminal spans, and economics. Returning null for an incomplete terminal prevents a producer
|
|
18
|
+
* from writing a structurally valid-looking event without its load-bearing
|
|
19
|
+
* self-contained span.
|
|
20
|
+
*/
|
|
21
|
+
export function normalizeHookEventV3(signal, payload, context) {
|
|
22
|
+
const base = normalizeHookEventV3Base(signal, payload, context);
|
|
23
|
+
if (!base)
|
|
24
|
+
return null;
|
|
25
|
+
return upgradeHookEventV3(base, payload, context);
|
|
26
|
+
}
|
|
27
|
+
/** Upgrade recorder-synthesized hook events, including resolving wait terminals. */
|
|
28
|
+
export function upgradeHookEventV3(base, source, context) {
|
|
29
|
+
if (TERMINAL_EVENT_TYPES.has(base.event_type) && !context.terminal_span)
|
|
30
|
+
return null;
|
|
31
|
+
if (base.event_type === "agent.started" && (!context.span_id || !context.parent_span_id)) {
|
|
32
|
+
return null;
|
|
33
|
+
}
|
|
34
|
+
const event = {
|
|
35
|
+
...base,
|
|
36
|
+
contract: {
|
|
37
|
+
name: EVENT_V3_CONTRACT_NAME,
|
|
38
|
+
major: EVENT_V3_CONTRACT_MAJOR,
|
|
39
|
+
schema_digest: EVENT_V3_SCHEMA_DIGEST,
|
|
40
|
+
},
|
|
41
|
+
event_type: base.event_type,
|
|
42
|
+
links: {
|
|
43
|
+
...base.links,
|
|
44
|
+
...(context.span_id ? { span_id: context.span_id } : {}),
|
|
45
|
+
...(context.parent_span_id ? { parent_span_id: context.parent_span_id } : {}),
|
|
46
|
+
},
|
|
47
|
+
payload: terminalPayload(base.event_type, base.payload, source, context),
|
|
48
|
+
};
|
|
49
|
+
assertEventV3(event);
|
|
50
|
+
return event;
|
|
51
|
+
}
|
|
52
|
+
function terminalPayload(eventType, basePayload, source, context) {
|
|
53
|
+
if (!TERMINAL_EVENT_TYPES.has(eventType))
|
|
54
|
+
return basePayload;
|
|
55
|
+
const span = context.terminal_span;
|
|
56
|
+
if (eventType === "tool.completed") {
|
|
57
|
+
return { ...basePayload, duration_ms: span.duration_ms, span };
|
|
58
|
+
}
|
|
59
|
+
if (eventType !== "turn.completed")
|
|
60
|
+
return { ...basePayload, span };
|
|
61
|
+
const telemetry = context.turn_telemetry ??
|
|
62
|
+
extractTurnTelemetryV3(context.adapter, source.raw, context.observed_at ?? context.recorded_at ?? new Date().toISOString());
|
|
63
|
+
return {
|
|
64
|
+
...basePayload,
|
|
65
|
+
duration_ms: span.duration_ms,
|
|
66
|
+
span,
|
|
67
|
+
usage: telemetry.usage,
|
|
68
|
+
inference: telemetry.inference,
|
|
69
|
+
harness: harnessObservationV3(context.harness_timing ?? emptyHarnessTimingV3()),
|
|
70
|
+
};
|
|
71
|
+
}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import type { Adapter } from "../../../adapter.js";
|
|
2
|
+
import type { ParsedPayload } from "../../../hooks/adapter/parse.js";
|
|
3
|
+
import type { EventV3WriteMode } from "../control.js";
|
|
4
|
+
import type { HookSignalV3 } from "./hook.js";
|
|
5
|
+
import type { TurnRitualEvidenceV3 } from "./hook-base.js";
|
|
6
|
+
/**
|
|
7
|
+
* Durable intake spool for hook signals, plus the producer diagnostics spool.
|
|
8
|
+
*
|
|
9
|
+
* A hook process appends its parsed signal here BEFORE reading or validating
|
|
10
|
+
* any producer state, so a lost lease, a crash, or a state-format mismatch can
|
|
11
|
+
* never destroy a delivered signal. Whichever process holds that session's
|
|
12
|
+
* producer-state lease drains the spool in append order and deletes each
|
|
13
|
+
* record only after its outcome is durably published. Intake records hold raw
|
|
14
|
+
* payloads transiently under owner-only permissions; anything that cannot
|
|
15
|
+
* become a ledger event is preserved in the diagnostics spool with raw content
|
|
16
|
+
* fields reduced to byte counts and digests.
|
|
17
|
+
*/
|
|
18
|
+
declare const INTAKE_FORMAT: "harnery-v3-hook-intake";
|
|
19
|
+
declare const INTAKE_VERSION: 1;
|
|
20
|
+
export interface HookIntakeRecordV3 {
|
|
21
|
+
format: typeof INTAKE_FORMAT;
|
|
22
|
+
format_version: typeof INTAKE_VERSION;
|
|
23
|
+
mode: EventV3WriteMode;
|
|
24
|
+
signal: HookSignalV3;
|
|
25
|
+
payload: ParsedPayload;
|
|
26
|
+
adapter: Adapter;
|
|
27
|
+
instance_id: `inst_${string}`;
|
|
28
|
+
producer_id: `prd_${string}`;
|
|
29
|
+
build_id: `build_${string}`;
|
|
30
|
+
platform: "linux" | "windows" | "macos" | "unknown";
|
|
31
|
+
bridge?: "codex-wsl";
|
|
32
|
+
adapterVersion?: string;
|
|
33
|
+
harnessVersion?: string;
|
|
34
|
+
monotonic_ns?: string;
|
|
35
|
+
observed_at?: string;
|
|
36
|
+
hook_name?: string;
|
|
37
|
+
hook_duration_ms?: number;
|
|
38
|
+
stop_remediation?: boolean;
|
|
39
|
+
turn_ritual?: TurnRitualEvidenceV3;
|
|
40
|
+
}
|
|
41
|
+
export interface HookIntakeGroupV3 {
|
|
42
|
+
adapter: Adapter;
|
|
43
|
+
session_hash: `hid_${string}`;
|
|
44
|
+
directory: string;
|
|
45
|
+
}
|
|
46
|
+
export interface HookIntakeEntryV3 {
|
|
47
|
+
path: string;
|
|
48
|
+
name: string;
|
|
49
|
+
/** Undefined when the file is unreadable or fails shape validation. */
|
|
50
|
+
record: HookIntakeRecordV3 | undefined;
|
|
51
|
+
}
|
|
52
|
+
export declare function hookIntakeGroupDirV3(coordRoot: string, adapter: Adapter, sessionHash: `hid_${string}`): string;
|
|
53
|
+
export declare function appendHookIntakeRecordV3(coordRoot: string, sessionHash: `hid_${string}`, record: HookIntakeRecordV3): string;
|
|
54
|
+
export declare function listHookIntakeGroupsV3(coordRoot: string): HookIntakeGroupV3[];
|
|
55
|
+
export declare function listHookIntakeRecordsV3(directory: string): HookIntakeEntryV3[];
|
|
56
|
+
export declare function removeIntakeRecordV3(path: string): void;
|
|
57
|
+
/**
|
|
58
|
+
* Preserve a signal that could not become a ledger event. Raw content fields
|
|
59
|
+
* are reduced to byte counts and digests so the diagnostics spool never holds
|
|
60
|
+
* prompt, tool input, or tool output bodies (invariant: delivered evidence is
|
|
61
|
+
* never silently destroyed, and never re-exposed either).
|
|
62
|
+
*/
|
|
63
|
+
export declare function writeProducerDiagnosticV3(coordRoot: string, category: string, record: Record<string, unknown>): string | undefined;
|
|
64
|
+
export {};
|
|
65
|
+
//# sourceMappingURL=intake.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"intake.d.ts","sourceRoot":"","sources":["../../../../../src/core/events/v3/producers/intake.ts"],"names":[],"mappings":"AAeA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iCAAiC,CAAC;AAErE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAEtD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAC9C,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AAE3D;;;;;;;;;;;GAWG;AAEH,QAAA,MAAM,aAAa,EAAG,wBAAiC,CAAC;AACxD,QAAA,MAAM,cAAc,EAAG,CAAU,CAAC;AAwClC,MAAM,WAAW,kBAAkB;IACjC,MAAM,EAAE,OAAO,aAAa,CAAC;IAC7B,cAAc,EAAE,OAAO,cAAc,CAAC;IACtC,IAAI,EAAE,gBAAgB,CAAC;IACvB,MAAM,EAAE,YAAY,CAAC;IACrB,OAAO,EAAE,aAAa,CAAC;IACvB,OAAO,EAAE,OAAO,CAAC;IACjB,WAAW,EAAE,QAAQ,MAAM,EAAE,CAAC;IAC9B,WAAW,EAAE,OAAO,MAAM,EAAE,CAAC;IAC7B,QAAQ,EAAE,SAAS,MAAM,EAAE,CAAC;IAC5B,QAAQ,EAAE,OAAO,GAAG,SAAS,GAAG,OAAO,GAAG,SAAS,CAAC;IACpD,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,WAAW,CAAC,EAAE,oBAAoB,CAAC;CACpC;AAED,MAAM,WAAW,iBAAiB;IAChC,OAAO,EAAE,OAAO,CAAC;IACjB,YAAY,EAAE,OAAO,MAAM,EAAE,CAAC;IAC9B,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,uEAAuE;IACvE,MAAM,EAAE,kBAAkB,GAAG,SAAS,CAAC;CACxC;AAUD,wBAAgB,oBAAoB,CAClC,SAAS,EAAE,MAAM,EACjB,OAAO,EAAE,OAAO,EAChB,WAAW,EAAE,OAAO,MAAM,EAAE,GAC3B,MAAM,CAER;AA+BD,wBAAgB,wBAAwB,CACtC,SAAS,EAAE,MAAM,EACjB,WAAW,EAAE,OAAO,MAAM,EAAE,EAC5B,MAAM,EAAE,kBAAkB,GACzB,MAAM,CAOR;AAED,wBAAgB,sBAAsB,CAAC,SAAS,EAAE,MAAM,GAAG,iBAAiB,EAAE,CAsB7E;AAED,wBAAgB,uBAAuB,CAAC,SAAS,EAAE,MAAM,GAAG,iBAAiB,EAAE,CAc9E;AAED,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAGvD;AAsDD;;;;;GAKG;AACH,wBAAgB,yBAAyB,CACvC,SAAS,EAAE,MAAM,EACjB,QAAQ,EAAE,MAAM,EAChB,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAC9B,MAAM,GAAG,SAAS,CAiBpB"}
|