harnery 0.34.1 → 0.36.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/commander.d.ts +30 -5
- package/dist/commander.d.ts.map +1 -1
- package/dist/commander.js +124 -94
- package/dist/commands/agents.d.ts +37 -6
- package/dist/commands/agents.d.ts.map +1 -1
- package/dist/commands/agents.js +466 -371
- package/dist/commands/backup.d.ts.map +1 -1
- package/dist/commands/backup.js +10 -10
- package/dist/commands/browse-session.d.ts.map +1 -1
- package/dist/commands/browse-session.js +12 -0
- package/dist/commands/browse.d.ts +1 -1
- package/dist/commands/browse.d.ts.map +1 -1
- package/dist/commands/browse.js +31 -6
- package/dist/commands/conversations.d.ts +10 -0
- package/dist/commands/conversations.d.ts.map +1 -0
- package/dist/commands/conversations.js +201 -0
- package/dist/commands/decision.d.ts.map +1 -1
- package/dist/commands/decision.js +2 -2
- package/dist/commands/deinit.d.ts.map +1 -1
- package/dist/commands/deinit.js +5 -0
- package/dist/commands/docs.d.ts.map +1 -1
- package/dist/commands/docs.js +13 -2
- package/dist/commands/doctor.d.ts +5 -0
- package/dist/commands/doctor.d.ts.map +1 -1
- package/dist/commands/doctor.js +51 -7
- package/dist/commands/events.d.ts.map +1 -1
- package/dist/commands/events.js +18 -1
- package/dist/commands/fetch.js +6 -5
- package/dist/commands/files.d.ts +22 -0
- package/dist/commands/files.d.ts.map +1 -0
- package/dist/commands/files.js +113 -0
- package/dist/commands/governor.js +14 -12
- package/dist/commands/inbox.d.ts +5 -0
- package/dist/commands/inbox.d.ts.map +1 -0
- package/dist/commands/inbox.js +57 -0
- package/dist/commands/init.d.ts +4 -5
- package/dist/commands/init.d.ts.map +1 -1
- package/dist/commands/init.js +63 -13
- package/dist/commands/ledger-v3.d.ts.map +1 -1
- package/dist/commands/ledger-v3.js +347 -1
- package/dist/commands/logs.d.ts +4 -0
- package/dist/commands/logs.d.ts.map +1 -0
- package/dist/commands/logs.js +169 -0
- package/dist/commands/messages.d.ts +5 -0
- package/dist/commands/messages.d.ts.map +1 -0
- package/dist/commands/messages.js +45 -0
- package/dist/commands/outline.d.ts +1 -1
- package/dist/commands/outline.d.ts.map +1 -1
- package/dist/commands/outline.js +2 -2
- package/dist/commands/presence.d.ts.map +1 -1
- package/dist/commands/presence.js +2 -2
- package/dist/commands/read.d.ts +1 -1
- package/dist/commands/read.d.ts.map +1 -1
- package/dist/commands/read.js +2 -2
- package/dist/commands/semantic.d.ts +4 -0
- package/dist/commands/semantic.d.ts.map +1 -0
- package/dist/commands/semantic.js +199 -0
- package/dist/commands/storage.d.ts +4 -0
- package/dist/commands/storage.d.ts.map +1 -0
- package/dist/commands/storage.js +238 -0
- package/dist/commands/tunnel.d.ts +5 -1
- package/dist/commands/tunnel.d.ts.map +1 -1
- package/dist/commands/tunnel.js +44 -31
- package/dist/commands/web.d.ts +3 -0
- package/dist/commands/web.d.ts.map +1 -1
- package/dist/commands/web.js +84 -7
- package/dist/commands/work.js +3 -3
- package/dist/commands/workflow.js +13 -13
- package/dist/core/adapters/profiles.d.ts +1 -1
- package/dist/core/agents/canonical-emit.d.ts +3 -0
- package/dist/core/agents/canonical-emit.d.ts.map +1 -1
- package/dist/core/agents/canonical-emit.js +12 -0
- package/dist/core/agents/claim-path.d.ts +11 -0
- package/dist/core/agents/claim-path.d.ts.map +1 -0
- package/dist/core/agents/claim-path.js +22 -0
- package/dist/core/agents/cli.js +209 -39
- package/dist/core/agents/coord-client.d.ts +29 -3
- package/dist/core/agents/coord-client.d.ts.map +1 -1
- package/dist/core/agents/coord-client.js +88 -9
- package/dist/core/agents/live-authority-v3.d.ts +47 -1
- package/dist/core/agents/live-authority-v3.d.ts.map +1 -1
- package/dist/core/agents/live-authority-v3.js +245 -13
- package/dist/core/agents/live-lifecycle-v3.js +9 -4
- package/dist/core/agents/live-observation-v3.d.ts.map +1 -1
- package/dist/core/agents/live-observation-v3.js +8 -3
- package/dist/core/agents/render/prompt-context.d.ts +9 -3
- package/dist/core/agents/render/prompt-context.d.ts.map +1 -1
- package/dist/core/agents/render/prompt-context.js +36 -17
- package/dist/core/agents/rules/stop-hook.d.ts +2 -0
- package/dist/core/agents/rules/stop-hook.d.ts.map +1 -1
- package/dist/core/agents/rules/stop-hook.js +115 -22
- package/dist/core/agents/rules/verdict.d.ts +1 -0
- package/dist/core/agents/rules/verdict.d.ts.map +1 -1
- package/dist/core/agents/session-events.d.ts.map +1 -1
- package/dist/core/agents/session-events.js +4 -0
- package/dist/core/agents/session-finalization-state-v3.js +1 -1
- package/dist/core/agents/session-finalizer-v3.js +5 -1
- package/dist/core/agents/session-name-display.d.ts +1 -0
- package/dist/core/agents/session-name-display.d.ts.map +1 -1
- package/dist/core/agents/session-name-display.js +8 -1
- package/dist/core/agents/state/activity-log.d.ts +3 -0
- package/dist/core/agents/state/activity-log.d.ts.map +1 -1
- package/dist/core/agents/state/activity-log.js +6 -3
- package/dist/core/agents/state/heartbeat-reader.d.ts +46 -0
- package/dist/core/agents/state/heartbeat-reader.d.ts.map +1 -0
- package/dist/core/agents/state/heartbeat-reader.js +25 -0
- package/dist/core/agents/state/heartbeat-writer.d.ts +9 -48
- package/dist/core/agents/state/heartbeat-writer.d.ts.map +1 -1
- package/dist/core/agents/state/heartbeat-writer.js +34 -34
- package/dist/core/agents/state/live-coordination-view.d.ts +6 -8
- package/dist/core/agents/state/live-coordination-view.d.ts.map +1 -1
- package/dist/core/agents/state/live-coordination-view.js +16 -67
- package/dist/core/agents/state/live-coordination-writer.d.ts +12 -0
- package/dist/core/agents/state/live-coordination-writer.d.ts.map +1 -0
- package/dist/core/agents/state/live-coordination-writer.js +92 -0
- package/dist/core/agents/state/names.d.ts +9 -1
- package/dist/core/agents/state/names.d.ts.map +1 -1
- package/dist/core/agents/state/names.js +190 -182
- package/dist/core/agents/state/stale-sweep.d.ts.map +1 -1
- package/dist/core/agents/state/stale-sweep.js +23 -5
- package/dist/core/artifacts/constants.d.ts +5 -0
- package/dist/core/artifacts/constants.d.ts.map +1 -0
- package/dist/core/artifacts/constants.js +4 -0
- package/dist/core/artifacts/index.d.ts +24 -3
- package/dist/core/artifacts/index.d.ts.map +1 -1
- package/dist/core/artifacts/index.js +96 -8
- package/dist/core/config.d.ts +62 -4
- package/dist/core/config.d.ts.map +1 -1
- package/dist/core/config.js +98 -4
- package/dist/core/conversations/archive.d.ts +49 -0
- package/dist/core/conversations/archive.d.ts.map +1 -0
- package/dist/core/conversations/archive.js +136 -0
- package/dist/core/conversations/catalog.d.ts +10 -0
- package/dist/core/conversations/catalog.d.ts.map +1 -0
- package/dist/core/conversations/catalog.js +72 -0
- package/dist/core/conversations/context-pack.d.ts +6 -0
- package/dist/core/conversations/context-pack.d.ts.map +1 -0
- package/dist/core/conversations/context-pack.js +60 -0
- package/dist/core/conversations/contract.d.ts +155 -0
- package/dist/core/conversations/contract.d.ts.map +1 -0
- package/dist/core/conversations/contract.js +1 -0
- package/dist/core/conversations/evaluation.d.ts +16 -0
- package/dist/core/conversations/evaluation.d.ts.map +1 -0
- package/dist/core/conversations/evaluation.js +9 -0
- package/dist/core/conversations/index.d.ts +10 -0
- package/dist/core/conversations/index.d.ts.map +1 -0
- package/dist/core/conversations/index.js +9 -0
- package/dist/core/conversations/lifecycle.d.ts +28 -0
- package/dist/core/conversations/lifecycle.d.ts.map +1 -0
- package/dist/core/conversations/lifecycle.js +29 -0
- package/dist/core/conversations/normalize.d.ts +14 -0
- package/dist/core/conversations/normalize.d.ts.map +1 -0
- package/dist/core/conversations/normalize.js +82 -0
- package/dist/core/conversations/query.d.ts +8 -0
- package/dist/core/conversations/query.d.ts.map +1 -0
- package/dist/core/conversations/query.js +280 -0
- package/dist/core/conversations/search-index.d.ts +9 -0
- package/dist/core/conversations/search-index.d.ts.map +1 -0
- package/dist/core/conversations/search-index.js +29 -0
- package/dist/core/events/legacy-storage/canary.d.ts +18 -0
- package/dist/core/events/legacy-storage/canary.d.ts.map +1 -0
- package/dist/core/events/legacy-storage/canary.js +150 -0
- package/dist/core/events/legacy-storage/fence.d.ts +15 -0
- package/dist/core/events/legacy-storage/fence.d.ts.map +1 -0
- package/dist/core/events/legacy-storage/fence.js +115 -0
- package/dist/core/events/legacy-storage/index.d.ts +6 -0
- package/dist/core/events/legacy-storage/index.d.ts.map +1 -0
- package/dist/core/events/legacy-storage/index.js +5 -0
- package/dist/core/events/legacy-storage/inventory.d.ts +10 -0
- package/dist/core/events/legacy-storage/inventory.d.ts.map +1 -0
- package/dist/core/events/legacy-storage/inventory.js +40 -0
- package/dist/core/events/legacy-storage/manifest.d.ts +23 -0
- package/dist/core/events/legacy-storage/manifest.d.ts.map +1 -0
- package/dist/core/events/legacy-storage/manifest.js +108 -0
- package/dist/core/events/legacy-storage/reader.d.ts +15 -0
- package/dist/core/events/legacy-storage/reader.d.ts.map +1 -0
- package/dist/core/events/legacy-storage/reader.js +154 -0
- package/dist/core/events/v3/authority-outbox.d.ts +7 -2
- package/dist/core/events/v3/authority-outbox.d.ts.map +1 -1
- package/dist/core/events/v3/authority-outbox.js +16 -3
- package/dist/core/events/v3/base-contract.d.ts +851 -16
- package/dist/core/events/v3/base-contract.d.ts.map +1 -1
- package/dist/core/events/v3/base-contract.js +50 -7
- package/dist/core/events/v3/bootstrap.d.ts +39 -0
- package/dist/core/events/v3/bootstrap.d.ts.map +1 -1
- package/dist/core/events/v3/bootstrap.js +167 -3
- package/dist/core/events/v3/capabilities.d.ts +11 -0
- package/dist/core/events/v3/capabilities.d.ts.map +1 -1
- package/dist/core/events/v3/capabilities.js +26 -3
- package/dist/core/events/v3/control-witness.d.ts +44 -0
- package/dist/core/events/v3/control-witness.d.ts.map +1 -0
- package/dist/core/events/v3/control-witness.js +233 -0
- package/dist/core/events/v3/control-writer.d.ts +4 -0
- package/dist/core/events/v3/control-writer.d.ts.map +1 -0
- package/dist/core/events/v3/control-writer.js +16 -0
- package/dist/core/events/v3/control.d.ts +8 -2
- package/dist/core/events/v3/control.d.ts.map +1 -1
- package/dist/core/events/v3/control.js +46 -18
- package/dist/core/events/v3/coordination-transaction-recovery.d.ts +42 -0
- package/dist/core/events/v3/coordination-transaction-recovery.d.ts.map +1 -0
- package/dist/core/events/v3/coordination-transaction-recovery.js +342 -0
- package/dist/core/events/v3/coordination-view.d.ts.map +1 -1
- package/dist/core/events/v3/coordination-view.js +16 -1
- package/dist/core/events/v3/generated.d.ts +1 -1
- package/dist/core/events/v3/generated.js +1 -1
- package/dist/core/events/v3/index.d.ts +8 -5
- package/dist/core/events/v3/index.d.ts.map +1 -1
- package/dist/core/events/v3/index.js +7 -4
- package/dist/core/events/v3/latency.d.ts +31 -1
- package/dist/core/events/v3/latency.d.ts.map +1 -1
- package/dist/core/events/v3/latency.js +127 -3
- package/dist/core/events/v3/live-route-observer.d.ts +31 -0
- package/dist/core/events/v3/live-route-observer.d.ts.map +1 -0
- package/dist/core/events/v3/live-route-observer.js +58 -0
- package/dist/core/events/v3/live-routing.d.ts +42 -20
- package/dist/core/events/v3/live-routing.d.ts.map +1 -1
- package/dist/core/events/v3/live-routing.js +153 -41
- package/dist/core/events/v3/producers/command-recorder.d.ts.map +1 -1
- package/dist/core/events/v3/producers/command-recorder.js +10 -1
- package/dist/core/events/v3/producers/coordination-recorder.d.ts +11 -1
- package/dist/core/events/v3/producers/coordination-recorder.d.ts.map +1 -1
- package/dist/core/events/v3/producers/coordination-recorder.js +90 -13
- package/dist/core/events/v3/producers/diagnostic-summaries.d.ts +129 -0
- package/dist/core/events/v3/producers/diagnostic-summaries.d.ts.map +1 -0
- package/dist/core/events/v3/producers/diagnostic-summaries.js +499 -0
- package/dist/core/events/v3/producers/hook-base.d.ts +17 -1
- package/dist/core/events/v3/producers/hook-base.d.ts.map +1 -1
- package/dist/core/events/v3/producers/hook-base.js +83 -2
- package/dist/core/events/v3/producers/intake.d.ts +13 -0
- package/dist/core/events/v3/producers/intake.d.ts.map +1 -1
- package/dist/core/events/v3/producers/intake.js +36 -2
- package/dist/core/events/v3/producers/producer-state-observer.d.ts +8 -0
- package/dist/core/events/v3/producers/producer-state-observer.d.ts.map +1 -0
- package/dist/core/events/v3/producers/producer-state-observer.js +45 -0
- package/dist/core/events/v3/producers/recorder.d.ts +117 -1
- package/dist/core/events/v3/producers/recorder.d.ts.map +1 -1
- package/dist/core/events/v3/producers/recorder.js +992 -27
- package/dist/core/events/v3/reader.d.ts +51 -0
- package/dist/core/events/v3/reader.d.ts.map +1 -1
- package/dist/core/events/v3/reader.js +181 -1
- package/dist/core/events/v3/rotation-config.d.ts +9 -0
- package/dist/core/events/v3/rotation-config.d.ts.map +1 -0
- package/dist/core/events/v3/rotation-config.js +91 -0
- package/dist/core/events/v3/runtime-build.d.ts +11 -0
- package/dist/core/events/v3/runtime-build.d.ts.map +1 -0
- package/dist/core/events/v3/runtime-build.js +39 -0
- package/dist/core/events/v3/runtime-identity.d.ts +5 -0
- package/dist/core/events/v3/runtime-identity.d.ts.map +1 -0
- package/dist/core/events/v3/runtime-identity.js +18 -0
- package/dist/core/events/v3/runtime-telemetry-capabilities.d.ts +52 -0
- package/dist/core/events/v3/runtime-telemetry-capabilities.d.ts.map +1 -0
- package/dist/core/events/v3/runtime-telemetry-capabilities.js +54 -0
- package/dist/core/events/v3/support-storage/classify.d.ts +46 -0
- package/dist/core/events/v3/support-storage/classify.d.ts.map +1 -0
- package/dist/core/events/v3/support-storage/classify.js +149 -0
- package/dist/core/events/v3/support-storage/eligibility.d.ts +29 -0
- package/dist/core/events/v3/support-storage/eligibility.d.ts.map +1 -0
- package/dist/core/events/v3/support-storage/eligibility.js +35 -0
- package/dist/core/events/v3/support-storage/index.d.ts +10 -0
- package/dist/core/events/v3/support-storage/index.d.ts.map +1 -0
- package/dist/core/events/v3/support-storage/index.js +9 -0
- package/dist/core/events/v3/support-storage/inventory.d.ts +30 -0
- package/dist/core/events/v3/support-storage/inventory.d.ts.map +1 -0
- package/dist/core/events/v3/support-storage/inventory.js +94 -0
- package/dist/core/events/v3/support-storage/logical-authority.d.ts +14 -0
- package/dist/core/events/v3/support-storage/logical-authority.d.ts.map +1 -0
- package/dist/core/events/v3/support-storage/logical-authority.js +104 -0
- package/dist/core/events/v3/support-storage/maintenance.d.ts +98 -0
- package/dist/core/events/v3/support-storage/maintenance.d.ts.map +1 -0
- package/dist/core/events/v3/support-storage/maintenance.js +352 -0
- package/dist/core/events/v3/support-storage/pack-contract.d.ts +59 -0
- package/dist/core/events/v3/support-storage/pack-contract.d.ts.map +1 -0
- package/dist/core/events/v3/support-storage/pack-contract.js +249 -0
- package/dist/core/events/v3/support-storage/pack-reader.d.ts +34 -0
- package/dist/core/events/v3/support-storage/pack-reader.d.ts.map +1 -0
- package/dist/core/events/v3/support-storage/pack-reader.js +258 -0
- package/dist/core/events/v3/support-storage/pack-writer.d.ts +30 -0
- package/dist/core/events/v3/support-storage/pack-writer.d.ts.map +1 -0
- package/dist/core/events/v3/support-storage/pack-writer.js +268 -0
- package/dist/core/events/v3/support-storage/recovery.d.ts +15 -0
- package/dist/core/events/v3/support-storage/recovery.d.ts.map +1 -0
- package/dist/core/events/v3/support-storage/recovery.js +22 -0
- package/dist/core/events/v3/turn-telemetry.d.ts +21 -6
- package/dist/core/events/v3/turn-telemetry.d.ts.map +1 -1
- package/dist/core/events/v3/turn-telemetry.js +32 -2
- package/dist/core/events/v3/writer.d.ts +13 -1
- package/dist/core/events/v3/writer.d.ts.map +1 -1
- package/dist/core/events/v3/writer.js +126 -12
- package/dist/core/governor/plan-read.d.ts.map +1 -1
- package/dist/core/governor/plan-read.js +5 -21
- package/dist/core/governor/planning.js +6 -8
- package/dist/core/governor/service-read.d.ts +12 -0
- package/dist/core/governor/service-read.d.ts.map +1 -1
- package/dist/core/governor/service-read.js +266 -2
- package/dist/core/governor/service.d.ts +1 -0
- package/dist/core/governor/service.d.ts.map +1 -1
- package/dist/core/governor/service.js +53 -18
- package/dist/core/guard/evidence-v3.d.ts.map +1 -1
- package/dist/core/guard/evidence-v3.js +2 -0
- package/dist/core/hooks/adapter/events.d.ts.map +1 -1
- package/dist/core/hooks/adapter/events.js +1 -0
- package/dist/core/hooks/adapter/output.d.ts +4 -2
- package/dist/core/hooks/adapter/output.d.ts.map +1 -1
- package/dist/core/hooks/adapter/output.js +13 -5
- package/dist/core/hooks/adapter/parse.d.ts +3 -0
- package/dist/core/hooks/adapter/parse.d.ts.map +1 -1
- package/dist/core/hooks/adapter/parse.js +14 -0
- package/dist/core/hooks/adapter/runtime-telemetry.d.ts +142 -0
- package/dist/core/hooks/adapter/runtime-telemetry.d.ts.map +1 -0
- package/dist/core/hooks/adapter/runtime-telemetry.js +869 -0
- package/dist/core/hooks/cli.js +318 -61
- package/dist/core/hooks/effects/image-capture.d.ts +1 -1
- package/dist/core/hooks/effects/image-capture.d.ts.map +1 -1
- package/dist/core/hooks/effects/image-capture.js +4 -2
- package/dist/core/hooks/remediation-cap.d.ts +39 -0
- package/dist/core/hooks/remediation-cap.d.ts.map +1 -0
- package/dist/core/hooks/remediation-cap.js +63 -0
- package/dist/core/hooks/resolve/coord-root.d.ts +22 -9
- package/dist/core/hooks/resolve/coord-root.d.ts.map +1 -1
- package/dist/core/hooks/resolve/coord-root.js +92 -11
- package/dist/core/hooks/resolve/owner.d.ts.map +1 -1
- package/dist/core/hooks/resolve/owner.js +5 -0
- package/dist/core/hooks/resolve/transcript.d.ts +33 -9
- package/dist/core/hooks/resolve/transcript.d.ts.map +1 -1
- package/dist/core/hooks/resolve/transcript.js +33 -10
- package/dist/core/inbox/contract.d.ts +64 -0
- package/dist/core/inbox/contract.d.ts.map +1 -0
- package/dist/core/inbox/contract.js +13 -0
- package/dist/core/inbox/index.d.ts +5 -0
- package/dist/core/inbox/index.d.ts.map +1 -0
- package/dist/core/inbox/index.js +4 -0
- package/dist/core/inbox/lifecycle.d.ts +22 -0
- package/dist/core/inbox/lifecycle.d.ts.map +1 -0
- package/dist/core/inbox/lifecycle.js +41 -0
- package/dist/core/inbox/service.d.ts +36 -0
- package/dist/core/inbox/service.d.ts.map +1 -0
- package/dist/core/inbox/service.js +210 -0
- package/dist/core/inbox/watcher.d.ts +7 -0
- package/dist/core/inbox/watcher.d.ts.map +1 -0
- package/dist/core/inbox/watcher.js +26 -0
- package/dist/core/presence/codec-digest.d.ts.map +1 -1
- package/dist/core/presence/codec-digest.js +14 -3
- package/dist/core/presence/relay-client.d.ts +1 -0
- package/dist/core/presence/relay-client.d.ts.map +1 -1
- package/dist/core/presence/relay-client.js +52 -8
- package/dist/core/semantic/adapters.d.ts +37 -0
- package/dist/core/semantic/adapters.d.ts.map +1 -0
- package/dist/core/semantic/adapters.js +360 -0
- package/dist/core/semantic/contract.d.ts +1072 -0
- package/dist/core/semantic/contract.d.ts.map +1 -0
- package/dist/core/semantic/contract.js +331 -0
- package/dist/core/semantic/evidence.d.ts +11 -0
- package/dist/core/semantic/evidence.d.ts.map +1 -0
- package/dist/core/semantic/evidence.js +262 -0
- package/dist/core/semantic/index.d.ts +14 -0
- package/dist/core/semantic/index.d.ts.map +1 -0
- package/dist/core/semantic/index.js +13 -0
- package/dist/core/semantic/once.d.ts +38 -0
- package/dist/core/semantic/once.d.ts.map +1 -0
- package/dist/core/semantic/once.js +364 -0
- package/dist/core/semantic/prompt.d.ts +12 -0
- package/dist/core/semantic/prompt.d.ts.map +1 -0
- package/dist/core/semantic/prompt.js +83 -0
- package/dist/core/semantic/review.d.ts +144 -0
- package/dist/core/semantic/review.d.ts.map +1 -0
- package/dist/core/semantic/review.js +544 -0
- package/dist/core/semantic/routes.d.ts +10 -0
- package/dist/core/semantic/routes.d.ts.map +1 -0
- package/dist/core/semantic/routes.js +21 -0
- package/dist/core/semantic/scheduler.d.ts +27 -0
- package/dist/core/semantic/scheduler.d.ts.map +1 -0
- package/dist/core/semantic/scheduler.js +91 -0
- package/dist/core/semantic/service-status.d.ts +51 -0
- package/dist/core/semantic/service-status.d.ts.map +1 -0
- package/dist/core/semantic/service-status.js +140 -0
- package/dist/core/semantic/service.d.ts +52 -0
- package/dist/core/semantic/service.d.ts.map +1 -0
- package/dist/core/semantic/service.js +559 -0
- package/dist/core/semantic/soak.d.ts +75 -0
- package/dist/core/semantic/soak.d.ts.map +1 -0
- package/dist/core/semantic/soak.js +476 -0
- package/dist/core/semantic/storage.d.ts +81 -0
- package/dist/core/semantic/storage.d.ts.map +1 -0
- package/dist/core/semantic/storage.js +180 -0
- package/dist/core/semantic/usage.d.ts +43 -0
- package/dist/core/semantic/usage.d.ts.map +1 -0
- package/dist/core/semantic/usage.js +193 -0
- package/dist/core/semantic/validate.d.ts +18 -0
- package/dist/core/semantic/validate.d.ts.map +1 -0
- package/dist/core/semantic/validate.js +207 -0
- package/dist/core/storage/buffer.d.ts +28 -0
- package/dist/core/storage/buffer.d.ts.map +1 -0
- package/dist/core/storage/buffer.js +101 -0
- package/dist/core/storage/builtins.d.ts +3 -0
- package/dist/core/storage/builtins.d.ts.map +1 -0
- package/dist/core/storage/builtins.js +683 -0
- package/dist/core/storage/catalog.d.ts +19 -0
- package/dist/core/storage/catalog.d.ts.map +1 -0
- package/dist/core/storage/catalog.js +365 -0
- package/dist/core/storage/config.d.ts +16 -0
- package/dist/core/storage/config.d.ts.map +1 -0
- package/dist/core/storage/config.js +311 -0
- package/dist/core/storage/contract.d.ts +275 -0
- package/dist/core/storage/contract.d.ts.map +1 -0
- package/dist/core/storage/contract.js +3 -0
- package/dist/core/storage/durable-history.d.ts +36 -0
- package/dist/core/storage/durable-history.d.ts.map +1 -0
- package/dist/core/storage/durable-history.js +606 -0
- package/dist/core/storage/health.d.ts +4 -0
- package/dist/core/storage/health.d.ts.map +1 -0
- package/dist/core/storage/health.js +65 -0
- package/dist/core/storage/index.d.ts +16 -0
- package/dist/core/storage/index.d.ts.map +1 -0
- package/dist/core/storage/index.js +15 -0
- package/dist/core/storage/inventory.d.ts +25 -0
- package/dist/core/storage/inventory.d.ts.map +1 -0
- package/dist/core/storage/inventory.js +666 -0
- package/dist/core/storage/jsonl.d.ts +52 -0
- package/dist/core/storage/jsonl.d.ts.map +1 -0
- package/dist/core/storage/jsonl.js +156 -0
- package/dist/core/storage/log-retention.d.ts +52 -0
- package/dist/core/storage/log-retention.d.ts.map +1 -0
- package/dist/core/storage/log-retention.js +419 -0
- package/dist/core/storage/logger.d.ts +82 -0
- package/dist/core/storage/logger.d.ts.map +1 -0
- package/dist/core/storage/logger.js +411 -0
- package/dist/core/storage/maintenance-providers.d.ts +26 -0
- package/dist/core/storage/maintenance-providers.d.ts.map +1 -0
- package/dist/core/storage/maintenance-providers.js +141 -0
- package/dist/core/storage/maintenance.d.ts +125 -0
- package/dist/core/storage/maintenance.d.ts.map +1 -0
- package/dist/core/storage/maintenance.js +609 -0
- package/dist/core/storage/metrics.d.ts +60 -0
- package/dist/core/storage/metrics.d.ts.map +1 -0
- package/dist/core/storage/metrics.js +134 -0
- package/dist/core/storage/policy.d.ts +7 -0
- package/dist/core/storage/policy.d.ts.map +1 -0
- package/dist/core/storage/policy.js +110 -0
- package/dist/core/storage/process-log.d.ts +38 -0
- package/dist/core/storage/process-log.d.ts.map +1 -0
- package/dist/core/storage/process-log.js +165 -0
- package/dist/core/storage/query.d.ts +34 -0
- package/dist/core/storage/query.d.ts.map +1 -0
- package/dist/core/storage/query.js +295 -0
- package/dist/core/storage/receipts.d.ts +23 -0
- package/dist/core/storage/receipts.d.ts.map +1 -0
- package/dist/core/storage/receipts.js +117 -0
- package/dist/core/storage/segments.d.ts +84 -0
- package/dist/core/storage/segments.d.ts.map +1 -0
- package/dist/core/storage/segments.js +542 -0
- package/dist/core/storage/sink-graph.d.ts +65 -0
- package/dist/core/storage/sink-graph.d.ts.map +1 -0
- package/dist/core/storage/sink-graph.js +213 -0
- package/dist/core/storage/storm-control.d.ts +23 -0
- package/dist/core/storage/storm-control.d.ts.map +1 -0
- package/dist/core/storage/storm-control.js +59 -0
- package/dist/core/work/state.d.ts.map +1 -1
- package/dist/core/work/state.js +10 -14
- package/dist/core/workflow/live-session-v3.d.ts.map +1 -1
- package/dist/core/workflow/live-session-v3.js +2 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/lazy-commands.d.ts +26 -0
- package/dist/lazy-commands.d.ts.map +1 -0
- package/dist/lazy-commands.js +210 -0
- package/dist/lib/browser/client.d.ts +11 -0
- package/dist/lib/browser/client.d.ts.map +1 -1
- package/dist/lib/browser/client.js +13 -0
- package/dist/lib/browser/index.d.ts +1 -0
- package/dist/lib/browser/index.d.ts.map +1 -1
- package/dist/lib/browser/standalone-html.d.ts +25 -0
- package/dist/lib/browser/standalone-html.d.ts.map +1 -0
- package/dist/lib/browser/standalone-html.js +284 -0
- package/dist/lib/docs-lint.d.ts +2 -0
- package/dist/lib/docs-lint.d.ts.map +1 -1
- package/dist/lib/docs-lint.js +45 -80
- package/dist/lib/docs-metadata-audit.d.ts +3 -0
- package/dist/lib/docs-metadata-audit.d.ts.map +1 -1
- package/dist/lib/docs-metadata-audit.js +13 -23
- package/dist/lib/docs-metadata-sync.d.ts +1 -0
- package/dist/lib/docs-metadata-sync.d.ts.map +1 -1
- package/dist/lib/docs-metadata-sync.js +28 -10
- package/dist/lib/docs-repository-view.d.ts +22 -0
- package/dist/lib/docs-repository-view.d.ts.map +1 -0
- package/dist/lib/docs-repository-view.js +185 -0
- package/dist/lib/http/client.d.ts +11 -5
- package/dist/lib/http/client.d.ts.map +1 -1
- package/dist/lib/http/client.js +22 -4
- package/dist/lib/http/index.d.ts +1 -1
- package/dist/lib/http/index.d.ts.map +1 -1
- package/dist/lib/http/index.js +1 -1
- package/dist/lib/indexer-exclusions.d.ts +27 -0
- package/dist/lib/indexer-exclusions.d.ts.map +1 -0
- package/dist/lib/indexer-exclusions.js +176 -0
- package/dist/lib/instructions/apply.d.ts.map +1 -1
- package/dist/lib/instructions/apply.js +1 -0
- package/dist/lib/instructions/templates.d.ts +2 -0
- package/dist/lib/instructions/templates.d.ts.map +1 -1
- package/dist/lib/instructions/templates.js +149 -4
- package/dist/lib/local-file-url.d.ts +9 -0
- package/dist/lib/local-file-url.d.ts.map +1 -0
- package/dist/lib/local-file-url.js +20 -0
- package/dist/lib/web-performance.d.ts +118 -0
- package/dist/lib/web-performance.d.ts.map +1 -0
- package/dist/lib/web-performance.js +192 -0
- package/package.json +34 -2
- package/schemas/config.schema.json +58 -0
- package/schemas/event-v3.schema.json +3073 -581
- package/src/commander.ts +462 -93
- package/src/commands/agents.ts +617 -355
- package/src/commands/backup.ts +18 -14
- package/src/commands/browse-session.ts +12 -0
- package/src/commands/browse.ts +31 -9
- package/src/commands/conversations.ts +279 -0
- package/src/commands/decision.ts +8 -2
- package/src/commands/deinit.ts +6 -0
- package/src/commands/docs.ts +25 -6
- package/src/commands/doctor.ts +75 -9
- package/src/commands/events.ts +21 -1
- package/src/commands/fetch.ts +7 -6
- package/src/commands/files.ts +143 -0
- package/src/commands/governor.ts +13 -12
- package/src/commands/inbox.ts +61 -0
- package/src/commands/init.ts +78 -16
- package/src/commands/ledger-v3.ts +421 -1
- package/src/commands/logs.ts +224 -0
- package/src/commands/messages.ts +61 -0
- package/src/commands/outline.ts +6 -2
- package/src/commands/presence.ts +7 -2
- package/src/commands/read.ts +6 -2
- package/src/commands/semantic.ts +244 -0
- package/src/commands/storage.ts +310 -0
- package/src/commands/tunnel.ts +66 -52
- package/src/commands/web.ts +92 -7
- package/src/commands/work.ts +3 -3
- package/src/commands/workflow.ts +13 -13
- package/src/core/agents/canonical-emit.ts +15 -0
- package/src/core/agents/claim-path.ts +23 -0
- package/src/core/agents/cli.ts +259 -53
- package/src/core/agents/coord-client.ts +92 -8
- package/src/core/agents/live-authority-v3.ts +342 -14
- package/src/core/agents/live-lifecycle-v3.ts +14 -4
- package/src/core/agents/live-observation-v3.ts +13 -3
- package/src/core/agents/render/prompt-context.ts +40 -16
- package/src/core/agents/rules/stop-hook.ts +129 -25
- package/src/core/agents/rules/verdict.ts +1 -0
- package/src/core/agents/session-events.ts +4 -0
- package/src/core/agents/session-finalization-state-v3.ts +1 -1
- package/src/core/agents/session-finalizer-v3.ts +4 -1
- package/src/core/agents/session-name-display.ts +9 -1
- package/src/core/agents/state/activity-log.ts +7 -2
- package/src/core/agents/state/heartbeat-reader.ts +69 -0
- package/src/core/agents/state/heartbeat-writer.ts +47 -84
- package/src/core/agents/state/live-coordination-view.ts +17 -81
- package/src/core/agents/state/live-coordination-writer.ts +141 -0
- package/src/core/agents/state/names.ts +190 -182
- package/src/core/agents/state/stale-sweep.ts +25 -5
- package/src/core/artifacts/constants.ts +4 -0
- package/src/core/artifacts/index.ts +113 -8
- package/src/core/config.ts +126 -5
- package/src/core/conversations/archive.ts +237 -0
- package/src/core/conversations/catalog.ts +79 -0
- package/src/core/conversations/context-pack.ts +72 -0
- package/src/core/conversations/contract.ts +178 -0
- package/src/core/conversations/evaluation.ts +30 -0
- package/src/core/conversations/index.ts +9 -0
- package/src/core/conversations/lifecycle.ts +63 -0
- package/src/core/conversations/normalize.ts +105 -0
- package/src/core/conversations/query.ts +318 -0
- package/src/core/conversations/search-index.ts +48 -0
- package/src/core/events/legacy-storage/canary.ts +177 -0
- package/src/core/events/legacy-storage/fence.ts +129 -0
- package/src/core/events/legacy-storage/index.ts +5 -0
- package/src/core/events/legacy-storage/inventory.ts +51 -0
- package/src/core/events/legacy-storage/manifest.ts +136 -0
- package/src/core/events/legacy-storage/reader.ts +178 -0
- package/src/core/events/v3/authority-outbox.ts +22 -1
- package/src/core/events/v3/base-contract.ts +56 -7
- package/src/core/events/v3/bootstrap.ts +195 -2
- package/src/core/events/v3/capabilities.ts +37 -3
- package/src/core/events/v3/control-witness.ts +339 -0
- package/src/core/events/v3/control-writer.ts +16 -0
- package/src/core/events/v3/control.ts +54 -18
- package/src/core/events/v3/coordination-transaction-recovery.ts +477 -0
- package/src/core/events/v3/coordination-view.ts +17 -1
- package/src/core/events/v3/generated.ts +1 -1
- package/src/core/events/v3/index.ts +26 -2
- package/src/core/events/v3/latency.ts +213 -2
- package/src/core/events/v3/live-route-observer.ts +80 -0
- package/src/core/events/v3/live-routing.ts +182 -45
- package/src/core/events/v3/producers/command-recorder.ts +10 -1
- package/src/core/events/v3/producers/coordination-recorder.ts +112 -15
- package/src/core/events/v3/producers/diagnostic-summaries.ts +593 -0
- package/src/core/events/v3/producers/hook-base.ts +116 -2
- package/src/core/events/v3/producers/intake.ts +48 -2
- package/src/core/events/v3/producers/producer-state-observer.ts +52 -0
- package/src/core/events/v3/producers/recorder.ts +1403 -30
- package/src/core/events/v3/reader.ts +243 -2
- package/src/core/events/v3/rotation-config.ts +98 -0
- package/src/core/events/v3/runtime-build.ts +41 -0
- package/src/core/events/v3/runtime-identity.ts +16 -0
- package/src/core/events/v3/runtime-telemetry-capabilities.ts +143 -0
- package/src/core/events/v3/support-storage/classify.ts +209 -0
- package/src/core/events/v3/support-storage/eligibility.ts +58 -0
- package/src/core/events/v3/support-storage/index.ts +9 -0
- package/src/core/events/v3/support-storage/inventory.ts +135 -0
- package/src/core/events/v3/support-storage/logical-authority.ts +117 -0
- package/src/core/events/v3/support-storage/maintenance.ts +501 -0
- package/src/core/events/v3/support-storage/pack-contract.ts +337 -0
- package/src/core/events/v3/support-storage/pack-reader.ts +346 -0
- package/src/core/events/v3/support-storage/pack-writer.ts +352 -0
- package/src/core/events/v3/support-storage/recovery.ts +43 -0
- package/src/core/events/v3/turn-telemetry.ts +66 -5
- package/src/core/events/v3/writer.ts +168 -16
- package/src/core/governor/plan-read.ts +5 -18
- package/src/core/governor/planning.ts +5 -8
- package/src/core/governor/service-read.ts +320 -2
- package/src/core/governor/service.ts +49 -22
- package/src/core/guard/evidence-v3.ts +1 -0
- package/src/core/hooks/adapter/events.ts +1 -0
- package/src/core/hooks/adapter/output.ts +12 -5
- package/src/core/hooks/adapter/parse.ts +16 -0
- package/src/core/hooks/adapter/runtime-telemetry.ts +1200 -0
- package/src/core/hooks/cli.ts +342 -64
- package/src/core/hooks/effects/image-capture.ts +4 -1
- package/src/core/hooks/remediation-cap.ts +83 -0
- package/src/core/hooks/resolve/coord-root.ts +91 -11
- package/src/core/hooks/resolve/owner.ts +4 -0
- package/src/core/hooks/resolve/transcript.ts +55 -11
- package/src/core/inbox/contract.ts +81 -0
- package/src/core/inbox/index.ts +4 -0
- package/src/core/inbox/lifecycle.ts +104 -0
- package/src/core/inbox/service.ts +305 -0
- package/src/core/inbox/watcher.ts +36 -0
- package/src/core/presence/codec-digest.ts +15 -9
- package/src/core/presence/relay-client.ts +55 -7
- package/src/core/semantic/adapters.ts +452 -0
- package/src/core/semantic/contract.ts +430 -0
- package/src/core/semantic/evidence.ts +336 -0
- package/src/core/semantic/index.ts +201 -0
- package/src/core/semantic/once.ts +496 -0
- package/src/core/semantic/prompt.ts +96 -0
- package/src/core/semantic/review.ts +803 -0
- package/src/core/semantic/routes.ts +30 -0
- package/src/core/semantic/scheduler.ts +151 -0
- package/src/core/semantic/service-status.ts +212 -0
- package/src/core/semantic/service.ts +681 -0
- package/src/core/semantic/soak.ts +638 -0
- package/src/core/semantic/storage.ts +300 -0
- package/src/core/semantic/usage.ts +272 -0
- package/src/core/semantic/validate.ts +243 -0
- package/src/core/storage/buffer.ts +124 -0
- package/src/core/storage/builtins.ts +916 -0
- package/src/core/storage/catalog.ts +467 -0
- package/src/core/storage/config.ts +423 -0
- package/src/core/storage/contract.ts +342 -0
- package/src/core/storage/durable-history.ts +738 -0
- package/src/core/storage/health.ts +76 -0
- package/src/core/storage/index.ts +15 -0
- package/src/core/storage/inventory.ts +859 -0
- package/src/core/storage/jsonl.ts +213 -0
- package/src/core/storage/log-retention.ts +555 -0
- package/src/core/storage/logger.ts +546 -0
- package/src/core/storage/maintenance-providers.ts +200 -0
- package/src/core/storage/maintenance.ts +929 -0
- package/src/core/storage/metrics.ts +199 -0
- package/src/core/storage/policy.ts +141 -0
- package/src/core/storage/process-log.ts +203 -0
- package/src/core/storage/query.ts +360 -0
- package/src/core/storage/receipts.ts +162 -0
- package/src/core/storage/segments.ts +721 -0
- package/src/core/storage/sink-graph.ts +343 -0
- package/src/core/storage/storm-control.ts +91 -0
- package/src/core/work/state.ts +12 -21
- package/src/core/workflow/live-session-v3.ts +2 -4
- package/src/index.ts +2 -0
- package/src/lazy-commands.ts +294 -0
- package/src/lib/browser/client.ts +21 -0
- package/src/lib/browser/index.ts +4 -0
- package/src/lib/browser/standalone-html.ts +312 -0
- package/src/lib/docs-lint.ts +58 -77
- package/src/lib/docs-metadata-audit.ts +26 -21
- package/src/lib/docs-metadata-sync.ts +32 -9
- package/src/lib/docs-repository-view.ts +220 -0
- package/src/lib/http/client.ts +44 -8
- package/src/lib/http/index.ts +6 -1
- package/src/lib/indexer-exclusions.ts +173 -0
- package/src/lib/instructions/apply.ts +1 -0
- package/src/lib/instructions/templates.ts +154 -4
- package/src/lib/local-file-url.ts +31 -0
- package/src/lib/web-performance.ts +335 -0
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import type { HarneryConversationProvider } from "./contract.ts";
|
|
2
|
+
|
|
3
|
+
export class HarneryConversationCatalog {
|
|
4
|
+
readonly #providers: ReadonlyMap<string, HarneryConversationProvider>;
|
|
5
|
+
|
|
6
|
+
constructor(providers: readonly HarneryConversationProvider[]) {
|
|
7
|
+
const entries = new Map<string, HarneryConversationProvider>();
|
|
8
|
+
for (const provider of providers) {
|
|
9
|
+
const id = provider.capabilities.provider_id;
|
|
10
|
+
if (!/^[a-z][a-z0-9-]{1,63}$/.test(id))
|
|
11
|
+
throw new Error(`invalid conversation provider id: ${id}`);
|
|
12
|
+
if (entries.has(id)) throw new Error(`duplicate conversation provider: ${id}`);
|
|
13
|
+
if (provider.capabilities.roles.some((role) => role !== "user" && role !== "assistant")) {
|
|
14
|
+
throw new Error(`provider ${id} exposes an excluded role`);
|
|
15
|
+
}
|
|
16
|
+
entries.set(id, Object.freeze(provider));
|
|
17
|
+
}
|
|
18
|
+
this.#providers = entries;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
get(id: string): HarneryConversationProvider | undefined {
|
|
22
|
+
return this.#providers.get(id);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
require(id: string): HarneryConversationProvider {
|
|
26
|
+
const provider = this.get(id);
|
|
27
|
+
if (!provider) throw new Error(`unknown conversation provider: ${id}`);
|
|
28
|
+
return provider;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
list(): readonly HarneryConversationProvider[] {
|
|
32
|
+
return [...this.#providers.values()].sort((left, right) =>
|
|
33
|
+
left.capabilities.provider_id.localeCompare(right.capabilities.provider_id),
|
|
34
|
+
);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export function unavailableAdapterProviders(): readonly HarneryConversationProvider[] {
|
|
39
|
+
return ["claude-code", "codex", "cursor"].map((providerId) => ({
|
|
40
|
+
capabilities: {
|
|
41
|
+
provider_id: providerId,
|
|
42
|
+
roles: ["user", "assistant"] as const,
|
|
43
|
+
can_list: false,
|
|
44
|
+
can_stream_source: false,
|
|
45
|
+
can_replay_archive: false,
|
|
46
|
+
default_completeness: "unavailable" as const,
|
|
47
|
+
default_omissions: [
|
|
48
|
+
"adapter-native source reader is not registered by this host",
|
|
49
|
+
"system, developer, tool, reasoning, command, and attachment bodies are excluded",
|
|
50
|
+
],
|
|
51
|
+
retention_behavior: "adapter-owned and unavailable to portable core",
|
|
52
|
+
},
|
|
53
|
+
async list() {
|
|
54
|
+
return [];
|
|
55
|
+
},
|
|
56
|
+
async snapshot(projectScopeId: string, conversationId: string) {
|
|
57
|
+
return {
|
|
58
|
+
snapshot_id: `${providerId}:unavailable:${conversationId}`,
|
|
59
|
+
provider_id: providerId,
|
|
60
|
+
project_scope_id: projectScopeId,
|
|
61
|
+
conversation_id: conversationId,
|
|
62
|
+
observed_at: new Date().toISOString(),
|
|
63
|
+
completeness: "unavailable" as const,
|
|
64
|
+
omissions: ["adapter-native source unavailable"],
|
|
65
|
+
};
|
|
66
|
+
},
|
|
67
|
+
stream() {
|
|
68
|
+
return {
|
|
69
|
+
[Symbol.asyncIterator]() {
|
|
70
|
+
return {
|
|
71
|
+
async next(): Promise<IteratorResult<never>> {
|
|
72
|
+
throw new Error(`conversation provider unavailable: ${providerId}`);
|
|
73
|
+
},
|
|
74
|
+
};
|
|
75
|
+
},
|
|
76
|
+
};
|
|
77
|
+
},
|
|
78
|
+
}));
|
|
79
|
+
}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import type { HarneryConversationContextPack, HarneryConversationQueryResult } from "./contract.ts";
|
|
2
|
+
|
|
3
|
+
export function buildConversationContextPack(
|
|
4
|
+
result: HarneryConversationQueryResult,
|
|
5
|
+
budget: { max_tokens: number; max_bytes: number },
|
|
6
|
+
): HarneryConversationContextPack {
|
|
7
|
+
if (
|
|
8
|
+
!Number.isSafeInteger(budget.max_tokens) ||
|
|
9
|
+
budget.max_tokens <= 0 ||
|
|
10
|
+
!Number.isSafeInteger(budget.max_bytes) ||
|
|
11
|
+
budget.max_bytes <= 0
|
|
12
|
+
) {
|
|
13
|
+
throw new Error("invalid conversation context budget");
|
|
14
|
+
}
|
|
15
|
+
const ordered = new Map(
|
|
16
|
+
result.hits
|
|
17
|
+
.flatMap((hit) => [...hit.neighbors, hit.record])
|
|
18
|
+
.sort(
|
|
19
|
+
(left, right) =>
|
|
20
|
+
left.provider_id.localeCompare(right.provider_id) ||
|
|
21
|
+
left.conversation_id.localeCompare(right.conversation_id) ||
|
|
22
|
+
left.sequence - right.sequence,
|
|
23
|
+
)
|
|
24
|
+
.map((record) => [record.record_id, record]),
|
|
25
|
+
);
|
|
26
|
+
const excerpts: HarneryConversationContextPack["excerpts"][number][] = [];
|
|
27
|
+
let bytes = 0;
|
|
28
|
+
let tokens = 0;
|
|
29
|
+
let truncated = result.truncated;
|
|
30
|
+
for (const record of ordered.values()) {
|
|
31
|
+
const recordBytes = Buffer.byteLength(record.content);
|
|
32
|
+
const recordTokens = Math.ceil(recordBytes / 4);
|
|
33
|
+
if (bytes + recordBytes > budget.max_bytes || tokens + recordTokens > budget.max_tokens) {
|
|
34
|
+
truncated = true;
|
|
35
|
+
break;
|
|
36
|
+
}
|
|
37
|
+
excerpts.push({
|
|
38
|
+
citation: {
|
|
39
|
+
record_id: record.record_id,
|
|
40
|
+
provider_id: record.provider_id,
|
|
41
|
+
conversation_id: record.conversation_id,
|
|
42
|
+
role: record.role,
|
|
43
|
+
occurred_at: record.occurred_at,
|
|
44
|
+
native_conversation_id: record.source.native_conversation_id,
|
|
45
|
+
...(record.source.native_record_id
|
|
46
|
+
? { native_record_id: record.source.native_record_id }
|
|
47
|
+
: {}),
|
|
48
|
+
content_digest: record.content_digest,
|
|
49
|
+
},
|
|
50
|
+
content: record.content,
|
|
51
|
+
sequence: record.sequence,
|
|
52
|
+
});
|
|
53
|
+
bytes += recordBytes;
|
|
54
|
+
tokens += recordTokens;
|
|
55
|
+
}
|
|
56
|
+
return {
|
|
57
|
+
schema: "harnery.conversation-context-pack/v1",
|
|
58
|
+
boundary: "untrusted-historical-data",
|
|
59
|
+
automatic_injection: false,
|
|
60
|
+
project_scope_id: result.request.project_scope_id,
|
|
61
|
+
excerpts,
|
|
62
|
+
completeness: result.snapshots.map((snapshot) => ({
|
|
63
|
+
provider_id: snapshot.provider_id,
|
|
64
|
+
conversation_id: snapshot.conversation_id,
|
|
65
|
+
completeness: snapshot.completeness,
|
|
66
|
+
omissions: snapshot.omissions,
|
|
67
|
+
})),
|
|
68
|
+
bytes,
|
|
69
|
+
estimated_tokens: tokens,
|
|
70
|
+
truncated,
|
|
71
|
+
};
|
|
72
|
+
}
|
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
export type HarneryConversationRole = "user" | "assistant";
|
|
2
|
+
export type HarneryConversationCompleteness = "complete" | "partial" | "unavailable";
|
|
3
|
+
export type HarneryConversationAccessMode = "off" | "source" | "archive";
|
|
4
|
+
export type HarneryConversationArchiveAuthorityMode = "shadow" | "cutover" | "rollback";
|
|
5
|
+
|
|
6
|
+
export interface HarneryConversationProviderCapabilities {
|
|
7
|
+
provider_id: string;
|
|
8
|
+
roles: readonly HarneryConversationRole[];
|
|
9
|
+
can_list: boolean;
|
|
10
|
+
can_stream_source: boolean;
|
|
11
|
+
can_replay_archive: boolean;
|
|
12
|
+
default_completeness: HarneryConversationCompleteness;
|
|
13
|
+
default_omissions: readonly string[];
|
|
14
|
+
retention_behavior: string;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export interface HarneryConversationSourceSnapshot {
|
|
18
|
+
snapshot_id: string;
|
|
19
|
+
provider_id: string;
|
|
20
|
+
project_scope_id: string;
|
|
21
|
+
conversation_id: string;
|
|
22
|
+
checkpoint?: string;
|
|
23
|
+
observed_at: string;
|
|
24
|
+
completeness: HarneryConversationCompleteness;
|
|
25
|
+
omissions: readonly string[];
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export interface HarneryConversationRecordV1 {
|
|
29
|
+
schema: "harnery.conversation-record/v1";
|
|
30
|
+
record_id: string;
|
|
31
|
+
provider_id: string;
|
|
32
|
+
project_scope_id: string;
|
|
33
|
+
conversation_id: string;
|
|
34
|
+
source_snapshot_id: string;
|
|
35
|
+
session_id?: string;
|
|
36
|
+
turn_id?: string;
|
|
37
|
+
source: {
|
|
38
|
+
native_conversation_id: string;
|
|
39
|
+
native_record_id?: string;
|
|
40
|
+
native_sequence?: number;
|
|
41
|
+
source_digest?: `sha256:${string}`;
|
|
42
|
+
};
|
|
43
|
+
sequence: number;
|
|
44
|
+
occurred_at: string;
|
|
45
|
+
captured_at: string;
|
|
46
|
+
role: HarneryConversationRole;
|
|
47
|
+
content: string;
|
|
48
|
+
content_bytes: number;
|
|
49
|
+
content_digest: `sha256:${string}`;
|
|
50
|
+
redactions: readonly {
|
|
51
|
+
kind: string;
|
|
52
|
+
replacement: string;
|
|
53
|
+
stored_start: number;
|
|
54
|
+
stored_end: number;
|
|
55
|
+
source_bytes_removed: number;
|
|
56
|
+
}[];
|
|
57
|
+
attachment_refs: readonly string[];
|
|
58
|
+
sensitivity: "private";
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
export interface HarneryConversationSummary {
|
|
62
|
+
provider_id: string;
|
|
63
|
+
project_scope_id: string;
|
|
64
|
+
conversation_id: string;
|
|
65
|
+
snapshot_id: string;
|
|
66
|
+
completeness: HarneryConversationCompleteness;
|
|
67
|
+
omissions: readonly string[];
|
|
68
|
+
record_count?: number;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
export interface HarneryConversationCitation {
|
|
72
|
+
record_id: string;
|
|
73
|
+
provider_id: string;
|
|
74
|
+
conversation_id: string;
|
|
75
|
+
role: HarneryConversationRole;
|
|
76
|
+
occurred_at: string;
|
|
77
|
+
native_conversation_id: string;
|
|
78
|
+
native_record_id?: string;
|
|
79
|
+
content_digest: `sha256:${string}`;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
export interface HarneryConversationQueryRequest {
|
|
83
|
+
text?: string;
|
|
84
|
+
regex?: string;
|
|
85
|
+
provider_id?: string;
|
|
86
|
+
role?: HarneryConversationRole;
|
|
87
|
+
since?: string;
|
|
88
|
+
until?: string;
|
|
89
|
+
project_scope_id: string;
|
|
90
|
+
session_id?: string;
|
|
91
|
+
conversation_id?: string;
|
|
92
|
+
record_id?: string;
|
|
93
|
+
limit: number;
|
|
94
|
+
context_before?: number;
|
|
95
|
+
context_after?: number;
|
|
96
|
+
budgets: HarneryConversationQueryBudgets;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
export interface HarneryConversationQueryBudgets {
|
|
100
|
+
max_source_records: number;
|
|
101
|
+
max_decoded_bytes: number;
|
|
102
|
+
max_matches: number;
|
|
103
|
+
max_wall_ms: number;
|
|
104
|
+
max_regex_chars: number;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
export interface HarneryConversationQueryHit {
|
|
108
|
+
record: HarneryConversationRecordV1;
|
|
109
|
+
citation: HarneryConversationCitation;
|
|
110
|
+
neighbors: readonly HarneryConversationRecordV1[];
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
export interface HarneryConversationQueryResult {
|
|
114
|
+
schema: "harnery.conversation-query/v1";
|
|
115
|
+
request: HarneryConversationQueryRequest;
|
|
116
|
+
hits: readonly HarneryConversationQueryHit[];
|
|
117
|
+
scanned_records: number;
|
|
118
|
+
decoded_bytes: number;
|
|
119
|
+
truncated: boolean;
|
|
120
|
+
truncation_reason?: "record_budget" | "byte_budget" | "match_budget" | "wall_budget";
|
|
121
|
+
snapshots: readonly HarneryConversationSourceSnapshot[];
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
export interface HarneryConversationContextPack {
|
|
125
|
+
schema: "harnery.conversation-context-pack/v1";
|
|
126
|
+
boundary: "untrusted-historical-data";
|
|
127
|
+
automatic_injection: false;
|
|
128
|
+
project_scope_id: string;
|
|
129
|
+
excerpts: readonly {
|
|
130
|
+
citation: HarneryConversationCitation;
|
|
131
|
+
content: string;
|
|
132
|
+
sequence: number;
|
|
133
|
+
}[];
|
|
134
|
+
completeness: readonly {
|
|
135
|
+
provider_id: string;
|
|
136
|
+
conversation_id: string;
|
|
137
|
+
completeness: HarneryConversationCompleteness;
|
|
138
|
+
omissions: readonly string[];
|
|
139
|
+
}[];
|
|
140
|
+
bytes: number;
|
|
141
|
+
estimated_tokens: number;
|
|
142
|
+
truncated: boolean;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
export interface HarneryNativeConversationRecord {
|
|
146
|
+
native_conversation_id: string;
|
|
147
|
+
native_record_id?: string;
|
|
148
|
+
native_sequence?: number;
|
|
149
|
+
role: string;
|
|
150
|
+
occurred_at: string;
|
|
151
|
+
content: string;
|
|
152
|
+
session_id?: string;
|
|
153
|
+
turn_id?: string;
|
|
154
|
+
attachment_refs?: readonly string[];
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
export interface HarneryConversationProviderReadOptions {
|
|
158
|
+
/** Providers should stop pending I/O promptly when the query wall budget expires. */
|
|
159
|
+
signal?: AbortSignal;
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
export interface HarneryConversationProvider {
|
|
163
|
+
capabilities: HarneryConversationProviderCapabilities;
|
|
164
|
+
list(
|
|
165
|
+
projectScopeId: string,
|
|
166
|
+
options?: HarneryConversationProviderReadOptions,
|
|
167
|
+
): Promise<readonly HarneryConversationSummary[]>;
|
|
168
|
+
snapshot(
|
|
169
|
+
projectScopeId: string,
|
|
170
|
+
conversationId: string,
|
|
171
|
+
options?: HarneryConversationProviderReadOptions,
|
|
172
|
+
): Promise<HarneryConversationSourceSnapshot>;
|
|
173
|
+
stream(
|
|
174
|
+
projectScopeId: string,
|
|
175
|
+
conversationId: string,
|
|
176
|
+
options?: HarneryConversationProviderReadOptions,
|
|
177
|
+
): AsyncIterable<HarneryNativeConversationRecord>;
|
|
178
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
export interface HarneryConversationEvaluationResult {
|
|
2
|
+
fixture_count: number;
|
|
3
|
+
citation_accuracy: number;
|
|
4
|
+
privacy_failures: number;
|
|
5
|
+
instruction_following_from_history: number;
|
|
6
|
+
recall: number;
|
|
7
|
+
precision: number;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export interface HarneryConversationEvaluationThresholds {
|
|
11
|
+
min_fixture_count: number;
|
|
12
|
+
min_citation_accuracy: number;
|
|
13
|
+
min_recall: number;
|
|
14
|
+
min_precision: number;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export function automaticConversationInjectionEnabled(
|
|
18
|
+
result: HarneryConversationEvaluationResult | undefined,
|
|
19
|
+
thresholds: HarneryConversationEvaluationThresholds,
|
|
20
|
+
): boolean {
|
|
21
|
+
return Boolean(
|
|
22
|
+
result &&
|
|
23
|
+
result.fixture_count >= thresholds.min_fixture_count &&
|
|
24
|
+
result.citation_accuracy >= thresholds.min_citation_accuracy &&
|
|
25
|
+
result.recall >= thresholds.min_recall &&
|
|
26
|
+
result.precision >= thresholds.min_precision &&
|
|
27
|
+
result.privacy_failures === 0 &&
|
|
28
|
+
result.instruction_following_from_history === 0,
|
|
29
|
+
);
|
|
30
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export * from "./archive.ts";
|
|
2
|
+
export * from "./catalog.ts";
|
|
3
|
+
export * from "./context-pack.ts";
|
|
4
|
+
export * from "./contract.ts";
|
|
5
|
+
export * from "./evaluation.ts";
|
|
6
|
+
export * from "./lifecycle.ts";
|
|
7
|
+
export * from "./normalize.ts";
|
|
8
|
+
export * from "./query.ts";
|
|
9
|
+
export * from "./search-index.ts";
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { randomUUID } from "node:crypto";
|
|
2
|
+
import type { HarneryConversationRecordV1 } from "./contract.ts";
|
|
3
|
+
|
|
4
|
+
export const HARNERY_CONVERSATION_PURGE_PLAN_SCHEMA = "harnery.conversation-purge-plan/v1" as const;
|
|
5
|
+
|
|
6
|
+
export interface HarneryConversationPurgePlan {
|
|
7
|
+
schema: typeof HARNERY_CONVERSATION_PURGE_PLAN_SCHEMA;
|
|
8
|
+
transaction_id: string;
|
|
9
|
+
project_scope_id: string;
|
|
10
|
+
conversation_id?: string;
|
|
11
|
+
before?: string;
|
|
12
|
+
record_ids: readonly string[];
|
|
13
|
+
record_digests: readonly string[];
|
|
14
|
+
remove_bytes: number;
|
|
15
|
+
retained_record_count: number;
|
|
16
|
+
external_source_state: "adapter-owned-copy-may-remain";
|
|
17
|
+
dry_run: true;
|
|
18
|
+
executable: false;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export function planConversationPurge(input: {
|
|
22
|
+
records: readonly HarneryConversationRecordV1[];
|
|
23
|
+
project_scope_id: string;
|
|
24
|
+
conversation_id?: string;
|
|
25
|
+
before?: string;
|
|
26
|
+
transaction_id?: string;
|
|
27
|
+
}): HarneryConversationPurgePlan {
|
|
28
|
+
const selected = input.records.filter(
|
|
29
|
+
(record) =>
|
|
30
|
+
record.project_scope_id === input.project_scope_id &&
|
|
31
|
+
(!input.conversation_id || record.conversation_id === input.conversation_id) &&
|
|
32
|
+
(!input.before || record.occurred_at < new Date(input.before).toISOString()),
|
|
33
|
+
);
|
|
34
|
+
return {
|
|
35
|
+
schema: HARNERY_CONVERSATION_PURGE_PLAN_SCHEMA,
|
|
36
|
+
transaction_id: input.transaction_id ?? `cpurge_${randomUUID()}`,
|
|
37
|
+
project_scope_id: input.project_scope_id,
|
|
38
|
+
...(input.conversation_id ? { conversation_id: input.conversation_id } : {}),
|
|
39
|
+
...(input.before ? { before: new Date(input.before).toISOString() } : {}),
|
|
40
|
+
record_ids: selected.map(({ record_id }) => record_id).sort(),
|
|
41
|
+
record_digests: selected.map(({ content_digest }) => content_digest).sort(),
|
|
42
|
+
remove_bytes: selected.reduce((sum, record) => sum + record.content_bytes, 0),
|
|
43
|
+
retained_record_count: input.records.length - selected.length,
|
|
44
|
+
external_source_state: "adapter-owned-copy-may-remain",
|
|
45
|
+
dry_run: true,
|
|
46
|
+
executable: false,
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export function validatePurgeExecutionRequest(
|
|
51
|
+
plan: HarneryConversationPurgePlan,
|
|
52
|
+
transactionId: string | undefined,
|
|
53
|
+
yes: boolean,
|
|
54
|
+
): {
|
|
55
|
+
accepted: false;
|
|
56
|
+
reason_code: "confirmation_required" | "transaction_mismatch" | "execution_disabled";
|
|
57
|
+
} {
|
|
58
|
+
if (!yes) return { accepted: false, reason_code: "confirmation_required" };
|
|
59
|
+
if (transactionId !== plan.transaction_id) {
|
|
60
|
+
return { accepted: false, reason_code: "transaction_mismatch" };
|
|
61
|
+
}
|
|
62
|
+
return { accepted: false, reason_code: "execution_disabled" };
|
|
63
|
+
}
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import { createHash } from "node:crypto";
|
|
2
|
+
import type {
|
|
3
|
+
HarneryConversationProviderCapabilities,
|
|
4
|
+
HarneryConversationRecordV1,
|
|
5
|
+
HarneryConversationSourceSnapshot,
|
|
6
|
+
HarneryNativeConversationRecord,
|
|
7
|
+
} from "./contract.ts";
|
|
8
|
+
|
|
9
|
+
export interface NormalizeConversationResult {
|
|
10
|
+
record?: HarneryConversationRecordV1;
|
|
11
|
+
omission?: string;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export function normalizeConversationRecord(input: {
|
|
15
|
+
capabilities: HarneryConversationProviderCapabilities;
|
|
16
|
+
snapshot: HarneryConversationSourceSnapshot;
|
|
17
|
+
native: HarneryNativeConversationRecord;
|
|
18
|
+
captured_at: string;
|
|
19
|
+
sequence: number;
|
|
20
|
+
}): NormalizeConversationResult {
|
|
21
|
+
if (input.native.role !== "user" && input.native.role !== "assistant") {
|
|
22
|
+
return { omission: `excluded_role:${input.native.role}` };
|
|
23
|
+
}
|
|
24
|
+
if (!input.capabilities.roles.includes(input.native.role)) {
|
|
25
|
+
return { omission: `unsupported_role:${input.native.role}` };
|
|
26
|
+
}
|
|
27
|
+
const sourceContent = input.native.content;
|
|
28
|
+
const sourceDigest = digest(sourceContent);
|
|
29
|
+
const redacted = redact(sourceContent);
|
|
30
|
+
const content = redacted.content;
|
|
31
|
+
const contentDigest = digest(content);
|
|
32
|
+
const nativeLocator = [
|
|
33
|
+
input.capabilities.provider_id,
|
|
34
|
+
input.native.native_conversation_id,
|
|
35
|
+
input.native.native_record_id ?? "",
|
|
36
|
+
String(input.native.native_sequence ?? ""),
|
|
37
|
+
input.native.role,
|
|
38
|
+
input.native.occurred_at,
|
|
39
|
+
sourceDigest,
|
|
40
|
+
].join("\0");
|
|
41
|
+
return {
|
|
42
|
+
record: {
|
|
43
|
+
schema: "harnery.conversation-record/v1",
|
|
44
|
+
record_id: `cr_${digest(nativeLocator).slice("sha256:".length, 38)}`,
|
|
45
|
+
provider_id: input.capabilities.provider_id,
|
|
46
|
+
project_scope_id: input.snapshot.project_scope_id,
|
|
47
|
+
conversation_id: input.snapshot.conversation_id,
|
|
48
|
+
source_snapshot_id: input.snapshot.snapshot_id,
|
|
49
|
+
...(input.native.session_id ? { session_id: input.native.session_id } : {}),
|
|
50
|
+
...(input.native.turn_id ? { turn_id: input.native.turn_id } : {}),
|
|
51
|
+
source: {
|
|
52
|
+
native_conversation_id: input.native.native_conversation_id,
|
|
53
|
+
...(input.native.native_record_id
|
|
54
|
+
? { native_record_id: input.native.native_record_id }
|
|
55
|
+
: {}),
|
|
56
|
+
...(input.native.native_sequence !== undefined
|
|
57
|
+
? { native_sequence: input.native.native_sequence }
|
|
58
|
+
: {}),
|
|
59
|
+
source_digest: sourceDigest,
|
|
60
|
+
},
|
|
61
|
+
sequence: input.sequence,
|
|
62
|
+
occurred_at: new Date(input.native.occurred_at).toISOString(),
|
|
63
|
+
captured_at: new Date(input.captured_at).toISOString(),
|
|
64
|
+
role: input.native.role,
|
|
65
|
+
content,
|
|
66
|
+
content_bytes: Buffer.byteLength(content),
|
|
67
|
+
content_digest: contentDigest,
|
|
68
|
+
redactions: redacted.redactions,
|
|
69
|
+
attachment_refs: [...(input.native.attachment_refs ?? [])],
|
|
70
|
+
sensitivity: "private",
|
|
71
|
+
},
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
function redact(content: string): {
|
|
76
|
+
content: string;
|
|
77
|
+
redactions: HarneryConversationRecordV1["redactions"];
|
|
78
|
+
} {
|
|
79
|
+
const pattern = /\b(?:sk|key|token|secret)[-_][a-zA-Z0-9_-]{8,}\b/giu;
|
|
80
|
+
const redactions: HarneryConversationRecordV1["redactions"][number][] = [];
|
|
81
|
+
let stored = "";
|
|
82
|
+
let sourceOffset = 0;
|
|
83
|
+
for (const match of content.matchAll(pattern)) {
|
|
84
|
+
const start = match.index;
|
|
85
|
+
const value = match[0];
|
|
86
|
+
stored += content.slice(sourceOffset, start);
|
|
87
|
+
const replacement = "[REDACTED:secret]";
|
|
88
|
+
const storedStart = stored.length;
|
|
89
|
+
stored += replacement;
|
|
90
|
+
redactions.push({
|
|
91
|
+
kind: "secret",
|
|
92
|
+
replacement,
|
|
93
|
+
stored_start: storedStart,
|
|
94
|
+
stored_end: storedStart + replacement.length,
|
|
95
|
+
source_bytes_removed: Buffer.byteLength(value),
|
|
96
|
+
});
|
|
97
|
+
sourceOffset = start + value.length;
|
|
98
|
+
}
|
|
99
|
+
stored += content.slice(sourceOffset);
|
|
100
|
+
return { content: stored, redactions };
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
export function digest(value: string | Buffer): `sha256:${string}` {
|
|
104
|
+
return `sha256:${createHash("sha256").update(value).digest("hex")}`;
|
|
105
|
+
}
|