harnery 0.32.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/README.md +2 -0
- package/dist/commander.d.ts.map +1 -1
- package/dist/commander.js +7 -1
- 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 +1408 -565
- 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 +2 -2
- package/dist/commands/claude-desktop.d.ts.map +1 -1
- package/dist/commands/claude-desktop.js +2 -2
- 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.d.ts +4 -2
- package/dist/commands/doctor.d.ts.map +1 -1
- package/dist/commands/doctor.js +55 -7
- 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 +10 -2
- package/dist/commands/init.d.ts.map +1 -1
- package/dist/commands/init.js +233 -51
- package/dist/commands/instructions.d.ts +4 -0
- package/dist/commands/instructions.d.ts.map +1 -0
- package/dist/commands/instructions.js +100 -0
- 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 +15 -6
- 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 +27 -25
- package/dist/core/agents/cli.js +212 -235
- 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 -70
- 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 +5 -5
- package/dist/core/agents/index.d.ts.map +1 -1
- package/dist/core/agents/index.js +5 -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 +10 -4
- package/dist/core/agents/render/prompt-context.d.ts.map +1 -1
- package/dist/core/agents/render/prompt-context.js +61 -55
- 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 +15 -33
- 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 +29 -46
- package/dist/core/agents/state/heartbeat-writer.d.ts.map +1 -1
- package/dist/core/agents/state/heartbeat-writer.js +59 -199
- 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 +45 -0
- package/dist/core/agents/state/session-state.d.ts.map +1 -0
- package/dist/core/agents/state/session-state.js +90 -0
- 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 +13 -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 +64 -24
- 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 +345 -400
- package/dist/core/hooks/codex-authorization.d.ts +30 -0
- package/dist/core/hooks/codex-authorization.d.ts.map +1 -0
- package/dist/core/hooks/codex-authorization.js +199 -0
- 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 +8 -3
- package/dist/core/presence/blob.d.ts.map +1 -1
- package/dist/core/presence/blob.js +54 -41
- 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/index.js +15 -1
- 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/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 +33 -0
- package/dist/lib/instructions/bundle.d.ts.map +1 -0
- package/dist/lib/instructions/bundle.js +149 -0
- 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 +27 -6
- 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 +7 -1
- package/src/commands/adapter.ts +2 -2
- package/src/commands/agents.ts +1737 -570
- 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 +7 -5
- 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 +73 -8
- package/src/commands/events.ts +256 -0
- package/src/commands/governor.ts +18 -4
- package/src/commands/init.ts +264 -57
- package/src/commands/instructions.ts +129 -0
- package/src/commands/journal.ts +4 -13
- package/src/commands/ledger-v3.ts +111 -0
- package/src/commands/presence.ts +18 -11
- 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 +39 -28
- package/src/core/agents/cli.ts +242 -263
- package/src/core/agents/codex-archive-v3.ts +138 -0
- package/src/core/agents/coord-client.ts +75 -177
- package/src/core/agents/finalization.ts +120 -38
- package/src/core/agents/index.ts +5 -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 +89 -55
- package/src/core/agents/render/session-context.ts +23 -32
- 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 +98 -242
- package/src/core/agents/state/live-coordination-view.ts +290 -0
- package/src/core/agents/state/session-state.ts +143 -0
- 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 +15 -6
- package/src/core/hooks/adapter/output.ts +7 -2
- package/src/core/hooks/adapter/parse.ts +81 -36
- package/src/core/hooks/adapter/wiring.ts +119 -13
- package/src/core/hooks/cli.ts +398 -422
- package/src/core/hooks/codex-authorization.ts +253 -0
- 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 +63 -38
- package/src/core/presence/codec-digest.ts +215 -0
- package/src/core/presence/index.ts +18 -1
- 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/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 +199 -0
- 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 -65
- package/dist/core/agents/state/heartbeat-projector.d.ts.map +0 -1
- package/dist/core/agents/state/heartbeat-projector.js +0 -527
- 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 -312
- 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 -582
- 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 -538
- package/src/core/hooks/events/ulid.ts +0 -51
- package/src/lib/docs-frontmatter-migrate.ts +0 -427
|
@@ -0,0 +1,226 @@
|
|
|
1
|
+
import { spawnSync } from "node:child_process";
|
|
2
|
+
import { createHash } from "node:crypto";
|
|
3
|
+
import {
|
|
4
|
+
chmodSync,
|
|
5
|
+
closeSync,
|
|
6
|
+
existsSync,
|
|
7
|
+
fsyncSync,
|
|
8
|
+
mkdirSync,
|
|
9
|
+
openSync,
|
|
10
|
+
readFileSync,
|
|
11
|
+
renameSync,
|
|
12
|
+
writeFileSync,
|
|
13
|
+
} from "node:fs";
|
|
14
|
+
import { dirname, join, resolve } from "node:path";
|
|
15
|
+
import { fsyncParentDirectory } from "../../workflow/durable-record.ts";
|
|
16
|
+
import { canonicalJsonV3, sha256V3 } from "./canonical.ts";
|
|
17
|
+
import { ADAPTER_CAPABILITY_PROFILES_V3 } from "./capabilities.ts";
|
|
18
|
+
import {
|
|
19
|
+
buildActivationManifestV3,
|
|
20
|
+
buildCandidateGenesisManifestV3,
|
|
21
|
+
type CandidateGenesisManifestV3,
|
|
22
|
+
EVENT_V3_ACTIVATION_MANIFEST,
|
|
23
|
+
EVENT_V3_GENESIS_MANIFEST,
|
|
24
|
+
type EventV3ControlState,
|
|
25
|
+
readEventV3ControlState,
|
|
26
|
+
repairEventV3ControlPair,
|
|
27
|
+
} from "./control.ts";
|
|
28
|
+
import { loadOrCreateFingerprintKeyStoreV3 } from "./fingerprint-keys.ts";
|
|
29
|
+
import { EVENT_V3_SCHEMA_DIGEST } from "./generated.ts";
|
|
30
|
+
import { liveEventV3BuildId, livePlatformV3 } from "./live-routing.ts";
|
|
31
|
+
|
|
32
|
+
export interface InitializeEventLedgerV3Input {
|
|
33
|
+
coordRoot: string;
|
|
34
|
+
harneryBuild: string;
|
|
35
|
+
hostBuild: string;
|
|
36
|
+
configDigest: `sha256:${string}`;
|
|
37
|
+
approvalRecordId: string;
|
|
38
|
+
forceNewEpoch?: boolean;
|
|
39
|
+
resumeCandidate?: boolean;
|
|
40
|
+
now?: () => Date;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export interface InitializeEventLedgerV3Result {
|
|
44
|
+
state: "active";
|
|
45
|
+
initialized: boolean;
|
|
46
|
+
archived_epoch?: string;
|
|
47
|
+
control: Extract<EventV3ControlState, { state: "active" }>;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Ensure programmatic Harnery entry points have the same universal V3
|
|
52
|
+
* boundary as `harn init`. Only a genuinely absent control pair is created;
|
|
53
|
+
* candidate, damaged, or incompatible state still fails closed.
|
|
54
|
+
*/
|
|
55
|
+
export function ensureEventLedgerV3(
|
|
56
|
+
coordRoot: string,
|
|
57
|
+
approvalRecordId = "harnery-runtime-v3-universal",
|
|
58
|
+
): Extract<EventV3ControlState, { state: "active" }> {
|
|
59
|
+
const root = resolve(coordRoot);
|
|
60
|
+
const current = readEventV3ControlState(root);
|
|
61
|
+
if (current.state === "active") return current;
|
|
62
|
+
if (current.state !== "closed") {
|
|
63
|
+
throw new Error(`event_v3_control_unavailable:${current.state}`);
|
|
64
|
+
}
|
|
65
|
+
const configPath = join(root, ".harnery", "config.jsonc");
|
|
66
|
+
return initializeEventLedgerV3({
|
|
67
|
+
coordRoot: root,
|
|
68
|
+
harneryBuild: repositoryBuild(rootOfHarnery()),
|
|
69
|
+
hostBuild: repositoryBuild(root),
|
|
70
|
+
configDigest: sha256V3(existsSync(configPath) ? readFileSync(configPath) : Buffer.from("{}\n")),
|
|
71
|
+
approvalRecordId,
|
|
72
|
+
}).control;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* Ensure a root has one current V3 epoch. An incompatible or explicitly
|
|
77
|
+
* replaced epoch is moved intact to the V3 archive before the new control
|
|
78
|
+
* pair is published. No historical ledger bytes are rewritten or deleted.
|
|
79
|
+
*/
|
|
80
|
+
export function initializeEventLedgerV3(
|
|
81
|
+
input: InitializeEventLedgerV3Input,
|
|
82
|
+
): InitializeEventLedgerV3Result {
|
|
83
|
+
const root = resolve(input.coordRoot);
|
|
84
|
+
let current = readEventV3ControlState(root);
|
|
85
|
+
if (input.resumeCandidate && current.state === "repairable") {
|
|
86
|
+
current = repairEventV3ControlPair(root);
|
|
87
|
+
}
|
|
88
|
+
if (!input.forceNewEpoch && current.state === "active") {
|
|
89
|
+
return { state: "active", initialized: false, control: current };
|
|
90
|
+
}
|
|
91
|
+
if (!input.forceNewEpoch && input.resumeCandidate && current.state === "candidate") {
|
|
92
|
+
return activateCandidateEpoch(root, current.genesis, input.approvalRecordId);
|
|
93
|
+
}
|
|
94
|
+
if (!input.forceNewEpoch && current.state === "candidate") {
|
|
95
|
+
throw new Error("event_v3_candidate_requires_explicit_activation_or_epoch_replacement");
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
const now = input.now ?? (() => new Date());
|
|
99
|
+
const createdAt = now().toISOString();
|
|
100
|
+
const archivedEpoch = archiveCurrentEpoch(root, createdAt);
|
|
101
|
+
const keys = loadOrCreateFingerprintKeyStoreV3(root, now);
|
|
102
|
+
const harneryBuild = safeBuild(input.harneryBuild);
|
|
103
|
+
const hostBuild = safeBuild(input.hostBuild);
|
|
104
|
+
const producerId = "prd_harnery-init" as const;
|
|
105
|
+
const bootId =
|
|
106
|
+
`boot_${createHash("sha256").update(`${root}\0${createdAt}`).digest("hex")}` as const;
|
|
107
|
+
const buildId = liveEventV3BuildId(harneryBuild);
|
|
108
|
+
const rootId = `root_${createHash("sha256").update(root).digest("hex")}` as const;
|
|
109
|
+
const instanceId =
|
|
110
|
+
`inst_init_${createHash("sha256").update(`${root}\0${createdAt}`).digest("hex")}` as const;
|
|
111
|
+
const capabilityDigests = Object.values(ADAPTER_CAPABILITY_PROFILES_V3)
|
|
112
|
+
.map((profile) => sha256V3(canonicalJsonV3(profile)))
|
|
113
|
+
.sort();
|
|
114
|
+
const candidate = buildCandidateGenesisManifestV3({
|
|
115
|
+
profile: {
|
|
116
|
+
initial_schema_digest: EVENT_V3_SCHEMA_DIGEST,
|
|
117
|
+
contract_source_digest: EVENT_V3_SCHEMA_DIGEST,
|
|
118
|
+
harnery_commit: harneryBuild,
|
|
119
|
+
host_repository_commit: hostBuild,
|
|
120
|
+
producer_build_ids: [buildId],
|
|
121
|
+
adapter_capability_profile_digests: capabilityDigests,
|
|
122
|
+
config_digest: input.configDigest,
|
|
123
|
+
canonicalizer_version: "harnery-jcs-nfc-v1",
|
|
124
|
+
fingerprint_version: "hmac-sha256-v1",
|
|
125
|
+
privacy_key_epoch: keys.active_epoch_id,
|
|
126
|
+
candidate_created_at: createdAt,
|
|
127
|
+
},
|
|
128
|
+
root_id: rootId,
|
|
129
|
+
instance_id: instanceId,
|
|
130
|
+
producer: {
|
|
131
|
+
producer_id: producerId,
|
|
132
|
+
boot_id: bootId,
|
|
133
|
+
sequence: 1,
|
|
134
|
+
build_id: buildId,
|
|
135
|
+
platform: livePlatformV3(),
|
|
136
|
+
},
|
|
137
|
+
});
|
|
138
|
+
publishControlFile(join(root, EVENT_V3_GENESIS_MANIFEST), candidate);
|
|
139
|
+
const candidateState = repairEventV3ControlPair(root);
|
|
140
|
+
if (candidateState.state !== "candidate") {
|
|
141
|
+
throw new Error(`event_v3_candidate_initialization_failed:${candidateState.state}`);
|
|
142
|
+
}
|
|
143
|
+
const activated = activateCandidateEpoch(root, candidate, input.approvalRecordId);
|
|
144
|
+
return {
|
|
145
|
+
...activated,
|
|
146
|
+
...(archivedEpoch ? { archived_epoch: archivedEpoch } : {}),
|
|
147
|
+
};
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
function activateCandidateEpoch(
|
|
151
|
+
root: string,
|
|
152
|
+
candidate: CandidateGenesisManifestV3,
|
|
153
|
+
approvalRecordId: string,
|
|
154
|
+
): InitializeEventLedgerV3Result {
|
|
155
|
+
const producer = candidate.event.producer;
|
|
156
|
+
const activation = buildActivationManifestV3({
|
|
157
|
+
candidate,
|
|
158
|
+
approval_record_id: approvalRecordId,
|
|
159
|
+
activation_approved_at: candidate.profile.candidate_created_at,
|
|
160
|
+
producer: {
|
|
161
|
+
producer_id: producer.producer_id as `prd_${string}`,
|
|
162
|
+
boot_id: producer.boot_id as `boot_${string}`,
|
|
163
|
+
sequence: producer.sequence + 1,
|
|
164
|
+
build_id: producer.build_id as `build_${string}`,
|
|
165
|
+
platform: producer.platform,
|
|
166
|
+
...(producer.bridge ? { bridge: producer.bridge } : {}),
|
|
167
|
+
},
|
|
168
|
+
});
|
|
169
|
+
publishControlFile(join(root, EVENT_V3_ACTIVATION_MANIFEST), activation);
|
|
170
|
+
const active = repairEventV3ControlPair(root);
|
|
171
|
+
if (active.state !== "active") {
|
|
172
|
+
throw new Error(`event_v3_activation_failed:${active.state}`);
|
|
173
|
+
}
|
|
174
|
+
return { state: "active", initialized: true, control: active };
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
function archiveCurrentEpoch(root: string, createdAt: string): string | undefined {
|
|
178
|
+
const current = join(root, ".harnery", "ledgers", "v3");
|
|
179
|
+
if (!existsSync(current)) return undefined;
|
|
180
|
+
const archives = join(root, ".harnery", "ledgers", "v3-archives");
|
|
181
|
+
mkdirSync(archives, { recursive: true, mode: 0o700 });
|
|
182
|
+
const stamp = createdAt.replace(/[^0-9]/g, "");
|
|
183
|
+
let target = join(archives, `epoch-${stamp}`);
|
|
184
|
+
let suffix = 0;
|
|
185
|
+
while (existsSync(target)) target = join(archives, `epoch-${stamp}-${++suffix}`);
|
|
186
|
+
renameSync(current, target);
|
|
187
|
+
fsyncParentDirectory(target);
|
|
188
|
+
return target;
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
function publishControlFile(path: string, value: unknown): void {
|
|
192
|
+
mkdirSync(dirname(path), { recursive: true, mode: 0o700 });
|
|
193
|
+
const temp = `${path}.tmp.${process.pid}`;
|
|
194
|
+
const fd = openSync(temp, "wx", 0o600);
|
|
195
|
+
try {
|
|
196
|
+
writeFileSync(fd, `${canonicalJsonV3(value)}\n`, "utf8");
|
|
197
|
+
fsyncSync(fd);
|
|
198
|
+
} finally {
|
|
199
|
+
closeSync(fd);
|
|
200
|
+
}
|
|
201
|
+
chmodSync(temp, 0o600);
|
|
202
|
+
renameSync(temp, path);
|
|
203
|
+
fsyncParentDirectory(path);
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
function safeBuild(value: string): string {
|
|
207
|
+
const normalized = value.normalize("NFC").trim();
|
|
208
|
+
if (/^[a-zA-Z0-9._-]{1,120}$/.test(normalized)) return normalized;
|
|
209
|
+
return createHash("sha256")
|
|
210
|
+
.update(normalized || "unknown")
|
|
211
|
+
.digest("hex");
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
function rootOfHarnery(): string {
|
|
215
|
+
return resolve(import.meta.dir, "../../../..");
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
function repositoryBuild(root: string): string {
|
|
219
|
+
const result = spawnSync("git", ["-C", root, "rev-parse", "HEAD"], {
|
|
220
|
+
encoding: "utf8",
|
|
221
|
+
timeout: 5000,
|
|
222
|
+
});
|
|
223
|
+
const commit = result.status === 0 ? result.stdout.trim() : "";
|
|
224
|
+
if (/^[0-9a-f]{40,64}$/.test(commit)) return commit;
|
|
225
|
+
return createHash("sha256").update(resolve(root)).digest("hex");
|
|
226
|
+
}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import type { EventOfTypeV3, EventPayloadV3, EventTypeV3 } from "./contract.ts";
|
|
2
|
+
import { EVENT_V3_CONTRACT_MAJOR, EVENT_V3_CONTRACT_NAME } from "./contract.ts";
|
|
3
|
+
import { EVENT_V3_SCHEMA_DIGEST } from "./generated.ts";
|
|
4
|
+
import { clockIdV3, eventIdV3 } from "./ids.ts";
|
|
5
|
+
|
|
6
|
+
type EventWithoutDiscriminator<T extends EventTypeV3> = Omit<
|
|
7
|
+
EventOfTypeV3<T>,
|
|
8
|
+
"attestation_id" | "contract" | "event_id" | "event_type" | "payload" | "time"
|
|
9
|
+
>;
|
|
10
|
+
|
|
11
|
+
type RootEventTypeV3 =
|
|
12
|
+
| "ledger.genesis"
|
|
13
|
+
| "ledger.activated"
|
|
14
|
+
| "ledger.schema_advanced"
|
|
15
|
+
| "ledger.comparability_advanced";
|
|
16
|
+
|
|
17
|
+
type AttestationInputV3<T extends EventTypeV3> = T extends RootEventTypeV3
|
|
18
|
+
? { attestation_id?: never }
|
|
19
|
+
: { attestation_id: `att_${string}` };
|
|
20
|
+
|
|
21
|
+
export type BuildEventV3Input<T extends EventTypeV3> = EventWithoutDiscriminator<T> &
|
|
22
|
+
AttestationInputV3<T> & {
|
|
23
|
+
payload: EventPayloadV3<T>;
|
|
24
|
+
event_id?: `evt_${string}`;
|
|
25
|
+
observed_at?: string;
|
|
26
|
+
recorded_at?: string;
|
|
27
|
+
monotonic_ns?: string;
|
|
28
|
+
clock_id?: `clk_${string}`;
|
|
29
|
+
skew?: "normal" | "regressed" | "unknown";
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
export function buildEventV3<T extends EventTypeV3>(
|
|
33
|
+
eventType: T,
|
|
34
|
+
input: BuildEventV3Input<T>,
|
|
35
|
+
): EventOfTypeV3<T> {
|
|
36
|
+
const now = input.recorded_at ?? new Date().toISOString();
|
|
37
|
+
return {
|
|
38
|
+
contract: {
|
|
39
|
+
name: EVENT_V3_CONTRACT_NAME,
|
|
40
|
+
major: EVENT_V3_CONTRACT_MAJOR,
|
|
41
|
+
schema_digest: EVENT_V3_SCHEMA_DIGEST,
|
|
42
|
+
},
|
|
43
|
+
event_id: input.event_id ?? eventIdV3(),
|
|
44
|
+
event_type: eventType,
|
|
45
|
+
time: {
|
|
46
|
+
observed_at: input.observed_at ?? now,
|
|
47
|
+
recorded_at: now,
|
|
48
|
+
...(input.monotonic_ns ? { monotonic_ns: input.monotonic_ns } : {}),
|
|
49
|
+
clock_id: input.clock_id ?? clockIdV3(),
|
|
50
|
+
skew: input.skew ?? "unknown",
|
|
51
|
+
},
|
|
52
|
+
producer: input.producer,
|
|
53
|
+
scope: input.scope,
|
|
54
|
+
...(input.attestation_id ? { attestation_id: input.attestation_id } : {}),
|
|
55
|
+
links: input.links,
|
|
56
|
+
provenance: input.provenance,
|
|
57
|
+
payload: input.payload,
|
|
58
|
+
} as EventOfTypeV3<T>;
|
|
59
|
+
}
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
import { createHash, createHmac, hkdfSync } from "node:crypto";
|
|
2
|
+
|
|
3
|
+
export const EVENT_V3_CANONICALIZER = "harnery-jcs-nfc-v1" as const;
|
|
4
|
+
|
|
5
|
+
export type JsonPrimitive = null | boolean | number | string;
|
|
6
|
+
export type JsonValue = JsonPrimitive | JsonValue[] | { [key: string]: JsonValue };
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Canonical JSON used for V3 contract digests, event bytes, and fingerprints.
|
|
10
|
+
*
|
|
11
|
+
* It follows RFC 8785's ECMAScript number and string serialization, adds the
|
|
12
|
+
* V3 NFC rule for keys and values, and rejects values that JSON would silently
|
|
13
|
+
* erase or reinterpret. Object keys are serialized directly instead of via an
|
|
14
|
+
* intermediate object so integer-looking keys remain in lexical order.
|
|
15
|
+
*/
|
|
16
|
+
export function canonicalJsonV3(value: unknown): string {
|
|
17
|
+
return serialize(value, new Set<object>());
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export function sha256V3(value: string | Uint8Array): `sha256:${string}` {
|
|
21
|
+
return `sha256:${createHash("sha256").update(value).digest("hex")}`;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export interface FingerprintV3 {
|
|
25
|
+
algorithm: "hmac-sha256";
|
|
26
|
+
canonicalizer: typeof EVENT_V3_CANONICALIZER;
|
|
27
|
+
key_epoch: `pep_${string}`;
|
|
28
|
+
scope: "generation" | "root";
|
|
29
|
+
digest: `sha256:${string}`;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export interface FingerprintContextV3 {
|
|
33
|
+
epochId: `pep_${string}`;
|
|
34
|
+
epochKey: Uint8Array;
|
|
35
|
+
rootId: `root_${string}`;
|
|
36
|
+
generationId?: `gen_${string}`;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export function fingerprintV3(
|
|
40
|
+
context: FingerprintContextV3,
|
|
41
|
+
domain: string,
|
|
42
|
+
value: unknown,
|
|
43
|
+
scope: "generation" | "root" = "generation",
|
|
44
|
+
): FingerprintV3 {
|
|
45
|
+
assertDomain(domain);
|
|
46
|
+
const rootKey = Buffer.from(
|
|
47
|
+
hkdfSync(
|
|
48
|
+
"sha256",
|
|
49
|
+
context.epochKey,
|
|
50
|
+
Buffer.from(context.epochId, "utf8"),
|
|
51
|
+
Buffer.from(`harnery:v3:root\0${context.rootId}`, "utf8"),
|
|
52
|
+
32,
|
|
53
|
+
),
|
|
54
|
+
);
|
|
55
|
+
let comparisonKey = rootKey;
|
|
56
|
+
if (scope === "generation") {
|
|
57
|
+
if (!context.generationId) {
|
|
58
|
+
throw new Error("generation-scoped fingerprint requires a generation ID");
|
|
59
|
+
}
|
|
60
|
+
comparisonKey = Buffer.from(
|
|
61
|
+
hkdfSync(
|
|
62
|
+
"sha256",
|
|
63
|
+
rootKey,
|
|
64
|
+
Buffer.from(context.generationId, "utf8"),
|
|
65
|
+
Buffer.from("harnery:v3:generation", "utf8"),
|
|
66
|
+
32,
|
|
67
|
+
),
|
|
68
|
+
);
|
|
69
|
+
}
|
|
70
|
+
const digest = createHmac("sha256", comparisonKey)
|
|
71
|
+
.update(`harnery:v3:${domain}\0`, "utf8")
|
|
72
|
+
.update(canonicalJsonV3(value), "utf8")
|
|
73
|
+
.digest("hex");
|
|
74
|
+
return {
|
|
75
|
+
algorithm: "hmac-sha256",
|
|
76
|
+
canonicalizer: EVENT_V3_CANONICALIZER,
|
|
77
|
+
key_epoch: context.epochId,
|
|
78
|
+
scope,
|
|
79
|
+
digest: `sha256:${digest}`,
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
export function normalizeNativeIdV3(
|
|
84
|
+
context: FingerprintContextV3,
|
|
85
|
+
namespace: string,
|
|
86
|
+
nativeId: string,
|
|
87
|
+
): `hid_${string}` {
|
|
88
|
+
if (!/^[a-z][a-z0-9._-]{0,63}$/.test(namespace)) {
|
|
89
|
+
throw new Error("native ID namespace is invalid");
|
|
90
|
+
}
|
|
91
|
+
const rootKey = Buffer.from(
|
|
92
|
+
hkdfSync(
|
|
93
|
+
"sha256",
|
|
94
|
+
context.epochKey,
|
|
95
|
+
Buffer.from(context.epochId, "utf8"),
|
|
96
|
+
Buffer.from(`harnery:v3:root\0${context.rootId}`, "utf8"),
|
|
97
|
+
32,
|
|
98
|
+
),
|
|
99
|
+
);
|
|
100
|
+
const digest = createHmac("sha256", rootKey)
|
|
101
|
+
.update(`harnery:v3:native-id\0${namespace}\0`, "utf8")
|
|
102
|
+
.update(nativeId.normalize("NFC"), "utf8")
|
|
103
|
+
.digest("hex");
|
|
104
|
+
return `hid_${digest}`;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
function serialize(value: unknown, ancestors: Set<object>): string {
|
|
108
|
+
if (value === null) return "null";
|
|
109
|
+
if (typeof value === "boolean") return value ? "true" : "false";
|
|
110
|
+
if (typeof value === "string") return JSON.stringify(value.normalize("NFC"));
|
|
111
|
+
if (typeof value === "number") {
|
|
112
|
+
if (!Number.isFinite(value)) throw new Error("canonical JSON rejects non-finite numbers");
|
|
113
|
+
return JSON.stringify(Object.is(value, -0) ? 0 : value);
|
|
114
|
+
}
|
|
115
|
+
if (typeof value !== "object") {
|
|
116
|
+
throw new Error(`canonical JSON rejects ${typeof value}`);
|
|
117
|
+
}
|
|
118
|
+
if (ancestors.has(value)) throw new Error("canonical JSON rejects cycles");
|
|
119
|
+
ancestors.add(value);
|
|
120
|
+
try {
|
|
121
|
+
if (Array.isArray(value)) {
|
|
122
|
+
return `[${value.map((item) => serialize(item, ancestors)).join(",")}]`;
|
|
123
|
+
}
|
|
124
|
+
const prototype = Object.getPrototypeOf(value);
|
|
125
|
+
if (prototype !== Object.prototype && prototype !== null) {
|
|
126
|
+
throw new Error("canonical JSON accepts only plain objects");
|
|
127
|
+
}
|
|
128
|
+
const normalized = new Map<string, unknown>();
|
|
129
|
+
for (const [key, item] of Object.entries(value as Record<string, unknown>)) {
|
|
130
|
+
const normalizedKey = key.normalize("NFC");
|
|
131
|
+
if (normalized.has(normalizedKey)) {
|
|
132
|
+
throw new Error("canonical JSON key collision after Unicode normalization");
|
|
133
|
+
}
|
|
134
|
+
normalized.set(normalizedKey, item);
|
|
135
|
+
}
|
|
136
|
+
const keys = [...normalized.keys()].sort(compareUtf16);
|
|
137
|
+
return `{${keys
|
|
138
|
+
.map((key) => `${JSON.stringify(key)}:${serialize(normalized.get(key), ancestors)}`)
|
|
139
|
+
.join(",")}}`;
|
|
140
|
+
} finally {
|
|
141
|
+
ancestors.delete(value);
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
function compareUtf16(left: string, right: string): number {
|
|
146
|
+
return left < right ? -1 : left > right ? 1 : 0;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
function assertDomain(domain: string): void {
|
|
150
|
+
if (!/^[a-z][a-z0-9._-]{0,63}$/.test(domain)) {
|
|
151
|
+
throw new Error("fingerprint domain is invalid");
|
|
152
|
+
}
|
|
153
|
+
}
|
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
import type { Adapter } from "../../adapter.ts";
|
|
2
|
+
import { canonicalJsonV3, sha256V3 } from "./canonical.ts";
|
|
3
|
+
|
|
4
|
+
export type CapabilitySupportV3 = "native" | "derived" | "conditional" | "unsupported";
|
|
5
|
+
|
|
6
|
+
export type CursorExecutionModeV3 = "local" | "cloud" | "unknown";
|
|
7
|
+
|
|
8
|
+
export type AdapterWaitKindV3 =
|
|
9
|
+
| "permission"
|
|
10
|
+
| "needs_input"
|
|
11
|
+
| "decision"
|
|
12
|
+
| "approval"
|
|
13
|
+
| "scheduled"
|
|
14
|
+
| "rate_limit"
|
|
15
|
+
| "unknown";
|
|
16
|
+
|
|
17
|
+
export type BaseAdapterSignalV3 =
|
|
18
|
+
| "session_start"
|
|
19
|
+
| "session_end"
|
|
20
|
+
| "prompt"
|
|
21
|
+
| "turn_id"
|
|
22
|
+
| "turn_completion"
|
|
23
|
+
| "tool_request"
|
|
24
|
+
| "tool_result"
|
|
25
|
+
| "tool_failure"
|
|
26
|
+
| "tool_call_id"
|
|
27
|
+
| "tool_duration"
|
|
28
|
+
| "permission"
|
|
29
|
+
| "subagent"
|
|
30
|
+
| "shell"
|
|
31
|
+
| "pre_compaction"
|
|
32
|
+
| "post_compaction"
|
|
33
|
+
| "context_usage"
|
|
34
|
+
| "model_identity";
|
|
35
|
+
|
|
36
|
+
export type AdapterSignalV3 =
|
|
37
|
+
| BaseAdapterSignalV3
|
|
38
|
+
| "model_usage"
|
|
39
|
+
| "inference_timing"
|
|
40
|
+
| "harness_timing"
|
|
41
|
+
| "capability_drift";
|
|
42
|
+
|
|
43
|
+
export interface AdapterCapabilityProfileV3 {
|
|
44
|
+
format: "harnery-v3-adapter-capabilities";
|
|
45
|
+
format_version: 1;
|
|
46
|
+
adapter: Adapter;
|
|
47
|
+
signals: Record<AdapterSignalV3, CapabilitySupportV3>;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
const SHARED_SIGNAL_SUPPORT = {
|
|
51
|
+
session_start: "native",
|
|
52
|
+
prompt: "native",
|
|
53
|
+
turn_completion: "native",
|
|
54
|
+
tool_request: "native",
|
|
55
|
+
tool_result: "native",
|
|
56
|
+
tool_failure: "native",
|
|
57
|
+
tool_call_id: "native",
|
|
58
|
+
tool_duration: "derived",
|
|
59
|
+
subagent: "native",
|
|
60
|
+
shell: "native",
|
|
61
|
+
pre_compaction: "native",
|
|
62
|
+
model_identity: "conditional",
|
|
63
|
+
} as const;
|
|
64
|
+
|
|
65
|
+
const BASE_SIGNAL_SUPPORT: Record<Adapter, Record<BaseAdapterSignalV3, CapabilitySupportV3>> = {
|
|
66
|
+
"claude-code": {
|
|
67
|
+
...SHARED_SIGNAL_SUPPORT,
|
|
68
|
+
session_end: "native",
|
|
69
|
+
turn_id: "conditional",
|
|
70
|
+
permission: "native",
|
|
71
|
+
post_compaction: "native",
|
|
72
|
+
context_usage: "unsupported",
|
|
73
|
+
},
|
|
74
|
+
codex: {
|
|
75
|
+
...SHARED_SIGNAL_SUPPORT,
|
|
76
|
+
session_end: "native",
|
|
77
|
+
turn_id: "native",
|
|
78
|
+
permission: "native",
|
|
79
|
+
post_compaction: "native",
|
|
80
|
+
context_usage: "unsupported",
|
|
81
|
+
},
|
|
82
|
+
cursor: {
|
|
83
|
+
...SHARED_SIGNAL_SUPPORT,
|
|
84
|
+
session_end: "native",
|
|
85
|
+
turn_id: "unsupported",
|
|
86
|
+
tool_request: "conditional",
|
|
87
|
+
tool_result: "conditional",
|
|
88
|
+
tool_failure: "conditional",
|
|
89
|
+
tool_call_id: "conditional",
|
|
90
|
+
tool_duration: "conditional",
|
|
91
|
+
shell: "conditional",
|
|
92
|
+
permission: "conditional",
|
|
93
|
+
post_compaction: "unsupported",
|
|
94
|
+
context_usage: "unsupported",
|
|
95
|
+
},
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
function profile(
|
|
99
|
+
adapter: Adapter,
|
|
100
|
+
economics: Pick<Record<AdapterSignalV3, CapabilitySupportV3>, "model_usage" | "inference_timing">,
|
|
101
|
+
): AdapterCapabilityProfileV3 {
|
|
102
|
+
return {
|
|
103
|
+
format: "harnery-v3-adapter-capabilities",
|
|
104
|
+
format_version: 1,
|
|
105
|
+
adapter,
|
|
106
|
+
signals: {
|
|
107
|
+
...BASE_SIGNAL_SUPPORT[adapter],
|
|
108
|
+
...economics,
|
|
109
|
+
harness_timing: "derived",
|
|
110
|
+
capability_drift: "derived",
|
|
111
|
+
},
|
|
112
|
+
};
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
export const ADAPTER_CAPABILITY_PROFILES_V3: Record<Adapter, AdapterCapabilityProfileV3> = {
|
|
116
|
+
"claude-code": profile("claude-code", {
|
|
117
|
+
model_usage: "conditional",
|
|
118
|
+
inference_timing: "unsupported",
|
|
119
|
+
}),
|
|
120
|
+
codex: profile("codex", {
|
|
121
|
+
model_usage: "conditional",
|
|
122
|
+
inference_timing: "unsupported",
|
|
123
|
+
}),
|
|
124
|
+
cursor: profile("cursor", {
|
|
125
|
+
model_usage: "unsupported",
|
|
126
|
+
inference_timing: "unsupported",
|
|
127
|
+
}),
|
|
128
|
+
};
|
|
129
|
+
|
|
130
|
+
export function adapterCapabilityProfileV3(adapter: Adapter): AdapterCapabilityProfileV3 {
|
|
131
|
+
return ADAPTER_CAPABILITY_PROFILES_V3[adapter];
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
export function adapterCapabilityProfileDigestV3(adapter: Adapter): `cap_${string}` {
|
|
135
|
+
return `cap_${sha256V3(canonicalJsonV3(adapterCapabilityProfileV3(adapter))).slice(7)}`;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
export function adapterSignalSupportV3(
|
|
139
|
+
adapter: Adapter,
|
|
140
|
+
signal: AdapterSignalV3,
|
|
141
|
+
): CapabilitySupportV3 {
|
|
142
|
+
return adapterCapabilityProfileV3(adapter).signals[signal];
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
/**
|
|
146
|
+
* Adapter hooks only expose permission waits today. Other wait kinds can be
|
|
147
|
+
* authored by coordination producers, but they are not observable from an
|
|
148
|
+
* adapter's native turn channel.
|
|
149
|
+
*/
|
|
150
|
+
export function adapterWaitKindSupportV3(
|
|
151
|
+
adapter: Adapter,
|
|
152
|
+
kind: AdapterWaitKindV3,
|
|
153
|
+
): CapabilitySupportV3 {
|
|
154
|
+
return kind === "permission" ? adapterSignalSupportV3(adapter, "permission") : "unsupported";
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
/** No current adapter supplies an independent completed-turn wait aggregate. */
|
|
158
|
+
export function adapterTurnWaitCountSupportV3(_adapter: Adapter): CapabilitySupportV3 {
|
|
159
|
+
return "unsupported";
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
/**
|
|
163
|
+
* Local Cursor sessions expose the generic tool channel. Cloud/private-worker
|
|
164
|
+
* sessions cannot guarantee whole-turn delivery because hooks may start only
|
|
165
|
+
* after the execution environment becomes writable.
|
|
166
|
+
*/
|
|
167
|
+
export function cursorToolChannelSupportV3(mode: CursorExecutionModeV3): CapabilitySupportV3 {
|
|
168
|
+
if (mode === "local") return "native";
|
|
169
|
+
if (mode === "cloud") return "unsupported";
|
|
170
|
+
return "conditional";
|
|
171
|
+
}
|