@remnic/core 10.0.85 → 10.0.86
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/access-admin-ops-surface.js +72 -71
- package/dist/access-authorization-probe.js +73 -72
- package/dist/access-boundary.d.ts.map +1 -1
- package/dist/access-boundary.js +72 -71
- package/dist/access-cli.js +157 -155
- package/dist/access-cli.js.map +1 -1
- package/dist/access-errors.d.ts +14 -0
- package/dist/access-errors.d.ts.map +1 -1
- package/dist/access-errors.js +5 -1
- package/dist/access-extraction-force-flush.js +72 -71
- package/dist/access-http-briefing.js +73 -72
- package/dist/access-http-query.js +74 -73
- package/dist/access-http.d.ts +12 -0
- package/dist/access-http.d.ts.map +1 -1
- package/dist/access-http.js +95 -94
- package/dist/access-identity-continuity-surface.js +72 -71
- package/dist/access-lcm-surface.js +72 -71
- package/dist/access-mcp.d.ts.map +1 -1
- package/dist/access-mcp.js +82 -81
- package/dist/access-memory-search-fanout.js +2 -2
- package/dist/access-namespace-preflight.js +72 -71
- package/dist/access-observe-write-category.js +10 -9
- package/dist/access-observe-write-surface.js +72 -71
- package/dist/access-offline-manifest.js +8 -8
- package/dist/access-operations-batch.js +73 -72
- package/dist/access-operations.js +80 -79
- package/dist/access-recall-concurrency.js +72 -71
- package/dist/access-recall-diagnostics.js +2 -2
- package/dist/access-recall-response.js +72 -71
- package/dist/access-recall-surface.js +72 -71
- package/dist/access-schema.d.ts.map +1 -1
- package/dist/access-schema.js +9 -8
- package/dist/access-service.d.ts +3 -3
- package/dist/access-service.d.ts.map +1 -1
- package/dist/access-service.js +72 -71
- package/dist/access-surface-catalog.js +74 -73
- package/dist/access-surface-catalog.js.map +1 -1
- package/dist/access-token-capabilities.js +2 -2
- package/dist/active-recall.js +32 -32
- package/dist/adapters/index.js +7 -7
- package/dist/adapters/registry.js +3 -3
- package/dist/briefing-deadline.d.ts +2 -2
- package/dist/briefing-deadline.d.ts.map +1 -1
- package/dist/briefing-deadline.js +1 -1
- package/dist/briefing.js +23 -23
- package/dist/buffer-admission.d.ts +22 -0
- package/dist/buffer-admission.d.ts.map +1 -0
- package/dist/buffer-admission.js +13 -0
- package/dist/buffer-eviction.d.ts +4 -5
- package/dist/buffer-eviction.d.ts.map +1 -1
- package/dist/buffer-eviction.js +1 -1
- package/dist/buffer-turn-helpers.d.ts +7 -0
- package/dist/buffer-turn-helpers.d.ts.map +1 -1
- package/dist/buffer-turn-helpers.js +9 -1
- package/dist/buffer-types.d.ts +24 -1
- package/dist/buffer-types.d.ts.map +1 -1
- package/dist/buffer.d.ts +17 -18
- package/dist/buffer.d.ts.map +1 -1
- package/dist/buffer.js +12 -8
- package/dist/calibration.js +2 -2
- package/dist/{capsule-crypto-GWVG7LGC.js → capsule-crypto-7FJQINUR.js} +2 -2
- package/dist/capsule-crypto-7FJQINUR.js.map +1 -0
- package/dist/capsule-import-gate.d.ts +11 -0
- package/dist/capsule-import-gate.d.ts.map +1 -0
- package/dist/capsule-import-gate.js +12 -0
- package/dist/capsule-import-gate.js.map +1 -0
- package/dist/causal-behavior.js +2 -2
- package/dist/causal-chain.js +2 -2
- package/dist/causal-consolidation.js +25 -25
- package/dist/causal-retrieval.js +2 -2
- package/dist/causal-trajectory.js +1 -1
- package/dist/{chunk-73YVMZ7D.js → chunk-2G4TV2ML.js} +11 -11
- package/dist/{chunk-BMIM6ESC.js → chunk-2JG2NI7C.js} +38 -38
- package/dist/{chunk-IR4C3DP2.js → chunk-2K3AUDH7.js} +2 -2
- package/dist/{chunk-6KFFRMPQ.js → chunk-2N4OUSIA.js} +2 -2
- package/dist/{chunk-OWHERGF2.js → chunk-2NLLXCJG.js} +2 -2
- package/dist/{chunk-44FQCC5D.js → chunk-2NUDHVYM.js} +2 -2
- package/dist/{chunk-FK4WC6VK.js → chunk-2U4LMSEX.js} +3 -3
- package/dist/{chunk-LT3CMO65.js → chunk-2XOFVTTT.js} +2 -2
- package/dist/{chunk-I6ORDT54.js → chunk-32CA7B6L.js} +2 -2
- package/dist/{chunk-TQVECGUQ.js → chunk-32YX7EJ3.js} +3 -3
- package/dist/{chunk-H4D5YURJ.js → chunk-3CTKEXXF.js} +120 -118
- package/dist/{chunk-H4D5YURJ.js.map → chunk-3CTKEXXF.js.map} +1 -1
- package/dist/{chunk-HLWXCDUQ.js → chunk-3DAWHP5K.js} +5 -5
- package/dist/{chunk-GBOYOL5L.js → chunk-3PJEDHLD.js} +2 -2
- package/dist/{chunk-ZWTHVUT5.js → chunk-3UZ2VMKD.js} +2 -2
- package/dist/{chunk-2XYDL2FG.js → chunk-3Y5X6YFH.js} +2 -2
- package/dist/{chunk-23B4HLWG.js → chunk-4GMI5HFH.js} +9 -9
- package/dist/{chunk-AP3TSV6S.js → chunk-4LCVA2LW.js} +3 -3
- package/dist/{chunk-MZCGHPIJ.js → chunk-4X7HQKAG.js} +2 -2
- package/dist/{chunk-YNBMBL4C.js → chunk-4XYAWK5H.js} +2 -2
- package/dist/{chunk-2JAT4S7N.js → chunk-5SOSQTVE.js} +2 -2
- package/dist/{chunk-G3T6YMBO.js → chunk-64S6X4IU.js} +7 -7
- package/dist/{chunk-NIV7RPWQ.js → chunk-6BCWFCDG.js} +7 -7
- package/dist/{chunk-V27FK6D6.js → chunk-6XTUZKCZ.js} +2 -2
- package/dist/{chunk-KASJJGRG.js → chunk-6ZELOK6O.js} +3 -8
- package/dist/chunk-6ZELOK6O.js.map +1 -0
- package/dist/{chunk-2ASEDFOA.js → chunk-73UZZFJC.js} +3 -3
- package/dist/{chunk-UHPHH74F.js → chunk-77PDJ4OE.js} +3 -3
- package/dist/{chunk-BATPQNRG.js → chunk-7GSL4LBG.js} +2 -2
- package/dist/{chunk-B6SPPYGJ.js → chunk-7IWRLYFJ.js} +2 -2
- package/dist/{chunk-BUKK5SWA.js → chunk-7LCGFUMB.js} +4 -4
- package/dist/{chunk-ZXF3O7P4.js → chunk-ARRTLPRC.js} +2 -2
- package/dist/{chunk-S5CQI2KF.js → chunk-B3GKQ6DU.js} +2 -2
- package/dist/{chunk-2URKYLMK.js → chunk-B56LORLY.js} +2 -2
- package/dist/{chunk-4IWEPQEV.js → chunk-BIVKPQ6Q.js} +2 -2
- package/dist/{chunk-DM4RRTN7.js → chunk-BLSHFIR6.js} +7 -6
- package/dist/chunk-BLSHFIR6.js.map +1 -0
- package/dist/{chunk-4DPLCYEK.js → chunk-C2HORX76.js} +3 -3
- package/dist/{chunk-ELWI2R6H.js → chunk-CC4V7HNP.js} +22 -22
- package/dist/{chunk-LGEH473S.js → chunk-CJCTKL6Y.js} +9 -1
- package/dist/chunk-CJCTKL6Y.js.map +1 -0
- package/dist/{chunk-WFDWLWDK.js → chunk-CN7Q3T2J.js} +4 -4
- package/dist/{chunk-GJVGFKOU.js → chunk-CYCEROPR.js} +3 -3
- package/dist/{chunk-CCU7URRP.js → chunk-D5EV6Y2L.js} +3 -3
- package/dist/{chunk-N6II66E5.js → chunk-DT7SNJH6.js} +3 -3
- package/dist/{chunk-FRM4UTDR.js → chunk-DZ7DPDVW.js} +8 -6
- package/dist/chunk-DZ7DPDVW.js.map +1 -0
- package/dist/{chunk-MVOJDLXS.js → chunk-EA2LA5RI.js} +2 -2
- package/dist/{chunk-WBN66HPI.js → chunk-ELHJK7LM.js} +6 -6
- package/dist/{chunk-GKYIRTNX.js → chunk-EQ4U73UH.js} +45 -14
- package/dist/chunk-EQ4U73UH.js.map +1 -0
- package/dist/{chunk-ONN2E5QD.js → chunk-EUBDYOLD.js} +6 -6
- package/dist/{chunk-YNDLCWXS.js → chunk-EZ25VE3G.js} +4 -4
- package/dist/{chunk-3LHPTBWG.js → chunk-F74G4KIH.js} +2 -2
- package/dist/{chunk-X7REO4CH.js → chunk-FF3EFLUT.js} +7 -5
- package/dist/chunk-FF3EFLUT.js.map +1 -0
- package/dist/chunk-FKBGK3NC.js +62 -0
- package/dist/chunk-FKBGK3NC.js.map +1 -0
- package/dist/{chunk-X2KO4FK5.js → chunk-FNFURZBZ.js} +5 -5
- package/dist/chunk-FNFURZBZ.js.map +1 -0
- package/dist/{chunk-MYCCO6AA.js → chunk-G54BOKZ6.js} +2 -2
- package/dist/{chunk-JFH6JAGY.js → chunk-G67EUQAB.js} +5 -5
- package/dist/{chunk-TV65NR7L.js → chunk-GULUWOA5.js} +2 -2
- package/dist/{chunk-6DANGCMO.js → chunk-HFUKXOUW.js} +2 -2
- package/dist/{chunk-Y3IYKNBY.js → chunk-HLN2HOXX.js} +2 -2
- package/dist/{chunk-Y43X3E24.js → chunk-IBDWYRDR.js} +3 -3
- package/dist/{chunk-XSFQN7TP.js → chunk-IBGU6AN6.js} +15 -14
- package/dist/chunk-IBGU6AN6.js.map +1 -0
- package/dist/{chunk-AJG2TAMR.js → chunk-IEEV27BC.js} +2 -2
- package/dist/{chunk-FZPDRCOB.js → chunk-IJ3OEECW.js} +4 -4
- package/dist/{chunk-D6THW7PA.js → chunk-IPD5GC7C.js} +2 -2
- package/dist/{chunk-VCVEMQJK.js → chunk-JM2YZKCQ.js} +2 -2
- package/dist/{chunk-H34INI3P.js → chunk-KVSOEVAF.js} +34 -11
- package/dist/chunk-KVSOEVAF.js.map +1 -0
- package/dist/chunk-M3BEJJNV.js +31 -0
- package/dist/chunk-M3BEJJNV.js.map +1 -0
- package/dist/{chunk-OSTFDWZJ.js → chunk-NIVKG3DS.js} +4 -4
- package/dist/{chunk-VZELUMKK.js → chunk-NQP4ZYGG.js} +2 -2
- package/dist/{chunk-3ODZLCHC.js → chunk-NT7F7WJQ.js} +2 -2
- package/dist/{chunk-YO2JEX2Z.js → chunk-OGBQMY46.js} +2 -2
- package/dist/{chunk-O55AGDTI.js → chunk-OL553AWT.js} +10 -10
- package/dist/{chunk-CLVILSBR.js → chunk-OZNBZJ3S.js} +22 -22
- package/dist/{chunk-RNGDKFY2.js → chunk-P452SEKO.js} +2 -2
- package/dist/{chunk-JX3E4XCW.js → chunk-PDOOUXCS.js} +2 -2
- package/dist/{chunk-V45TEVDA.js → chunk-PKZ274PI.js} +3 -3
- package/dist/{chunk-MNYQVYJ4.js → chunk-QD5R6U5J.js} +2 -2
- package/dist/{chunk-DI5ET2IE.js → chunk-QEZ3DW5O.js} +9 -9
- package/dist/{chunk-WYPCJK6K.js → chunk-QKERFEJS.js} +2 -2
- package/dist/{chunk-BLMTOIBK.js → chunk-QKES7GU6.js} +2 -2
- package/dist/{chunk-PCQWKMOL.js → chunk-QNSZYTSG.js} +2 -2
- package/dist/{chunk-433EXTC4.js → chunk-ROGO7FRA.js} +5 -4
- package/dist/{chunk-433EXTC4.js.map → chunk-ROGO7FRA.js.map} +1 -1
- package/dist/{chunk-MHSBOEH7.js → chunk-ROKDHO74.js} +2 -2
- package/dist/{chunk-BLGQUZFB.js → chunk-RWGRSKN5.js} +7 -5
- package/dist/chunk-RWGRSKN5.js.map +1 -0
- package/dist/{chunk-3VU2FDTU.js → chunk-SYKJBS7S.js} +10 -10
- package/dist/{chunk-5BE3FLKL.js → chunk-TAUHAP5J.js} +4 -4
- package/dist/{chunk-QCP75JGO.js → chunk-TFA6HPOA.js} +5 -5
- package/dist/{chunk-SGHV6LZ7.js → chunk-TQ4SCPGQ.js} +67 -51
- package/dist/chunk-TQ4SCPGQ.js.map +1 -0
- package/dist/{chunk-E7V5AK7I.js → chunk-TRMZHGIX.js} +8 -8
- package/dist/{chunk-WBDIZWJQ.js → chunk-TSS3D7ZY.js} +2 -2
- package/dist/{chunk-HVFX2N2G.js → chunk-UAUV3BWS.js} +65 -83
- package/dist/chunk-UAUV3BWS.js.map +1 -0
- package/dist/{chunk-OMYRPMQC.js → chunk-US7KPQA5.js} +2 -2
- package/dist/{chunk-KHZVAISH.js → chunk-UWRHHRDK.js} +2 -2
- package/dist/{chunk-WLNWFHX3.js → chunk-UXXK523X.js} +40 -2
- package/dist/{chunk-WLNWFHX3.js.map → chunk-UXXK523X.js.map} +1 -1
- package/dist/{chunk-SDESKFKT.js → chunk-UYHDMCY2.js} +2 -2
- package/dist/{chunk-YAAKVTZA.js → chunk-VKILERSL.js} +2 -2
- package/dist/{chunk-2TGIKMMZ.js → chunk-WXDTOE6F.js} +2 -2
- package/dist/{chunk-UVYI6VIX.js → chunk-X7Y7WX73.js} +1 -1
- package/dist/{chunk-P225W4RQ.js → chunk-XU37EJTW.js} +22 -22
- package/dist/chunk-XU37EJTW.js.map +1 -0
- package/dist/{chunk-QA3Y2O6H.js → chunk-YAVIBVCU.js} +2 -2
- package/dist/{chunk-CMRHXPLQ.js → chunk-YL4UKMD7.js} +117 -51
- package/dist/chunk-YL4UKMD7.js.map +1 -0
- package/dist/{chunk-GYNRNKMW.js → chunk-YMJRLT7S.js} +28 -8
- package/dist/chunk-YMJRLT7S.js.map +1 -0
- package/dist/{chunk-E5QEF3JO.js → chunk-YRZPBN46.js} +3 -3
- package/dist/{chunk-FMFCQRDM.js → chunk-ZANNIXXE.js} +3 -3
- package/dist/{chunk-3KGCHTTK.js → chunk-ZBFLV657.js} +3 -3
- package/dist/{chunk-VEFGHRKV.js → chunk-ZOJUWVAU.js} +1 -1
- package/dist/cli.js +117 -116
- package/dist/coding/export-okf-codegraph.js +21 -21
- package/dist/coding/pre-action-gate.js +2 -2
- package/dist/compounding/engine.js +23 -23
- package/dist/config.js +32 -32
- package/dist/connectors/codex-materialize-runner.js +22 -22
- package/dist/connectors/index.js +26 -26
- package/dist/convergence-refresh.js +24 -24
- package/dist/conversation-index/backend.js +2 -2
- package/dist/corpus-watermark.js +26 -26
- package/dist/dashboard-runtime.js +2 -2
- package/dist/deep-recall-config.js +2 -2
- package/dist/deep-recall-http-glue.js +11 -11
- package/dist/entity-retrieval.js +23 -23
- package/dist/explicit-capture.js +1 -1
- package/dist/external-wiki-access.js +73 -72
- package/dist/extraction-quote-grounding.d.ts +5 -1
- package/dist/extraction-quote-grounding.d.ts.map +1 -1
- package/dist/extraction-quote-grounding.js +1 -1
- package/dist/extraction-source-grounding-rules.d.ts +3 -1
- package/dist/extraction-source-grounding-rules.d.ts.map +1 -1
- package/dist/extraction-source-grounding-rules.js +2 -2
- package/dist/extraction-source-grounding.d.ts +1 -1
- package/dist/extraction-source-grounding.d.ts.map +1 -1
- package/dist/extraction-source-grounding.js +3 -3
- package/dist/extraction.d.ts.map +1 -1
- package/dist/extraction.js +40 -40
- package/dist/harmonic-retrieval.js +22 -22
- package/dist/index.js +196 -194
- package/dist/lcm/index.js +3 -3
- package/dist/local-llm.js +2 -2
- package/dist/location/index.js +25 -25
- package/dist/maintenance/memory-governance.js +22 -22
- package/dist/maintenance/rebuild-memory-lifecycle-ledger.js +22 -22
- package/dist/maintenance/rebuild-memory-projection-runner.js +24 -24
- package/dist/maintenance/rebuild-memory-projection.js +23 -23
- package/dist/memory-browse-http-glue.js +2 -2
- package/dist/memory-browse-operations.js +73 -72
- package/dist/memory-browse.js +5 -5
- package/dist/namespaces/migrate.js +23 -23
- package/dist/namespaces/search.d.ts +1 -0
- package/dist/namespaces/search.d.ts.map +1 -1
- package/dist/namespaces/search.js +10 -8
- package/dist/namespaces/storage.js +22 -22
- package/dist/offline-sync-changeset-generations.js +3 -3
- package/dist/offline-sync-embedding-generation.js +2 -2
- package/dist/offline-sync-impression-drain.js +2 -2
- package/dist/offline-sync-snapshot-stream.js +6 -6
- package/dist/offline-sync.js +5 -5
- package/dist/operator-doctor-corpus.js +29 -29
- package/dist/operator-doctor-replica.js +4 -4
- package/dist/operator-toolkit.js +44 -44
- package/dist/orchestration/backlog-scheduler.js +158 -156
- package/dist/orchestration/backlog-scheduler.js.map +1 -1
- package/dist/orchestration/buffer-drain-runner.js +158 -156
- package/dist/orchestration/maintenance.js +36 -36
- package/dist/orchestration/turn-ingestion.d.ts +2 -9
- package/dist/orchestration/turn-ingestion.d.ts.map +1 -1
- package/dist/orchestrator.js +159 -157
- package/dist/qmd.js +4 -4
- package/dist/recall-navigation-http-glue.js +2 -2
- package/dist/recall-navigation-operations.js +73 -72
- package/dist/recall-navigation.js +72 -71
- package/dist/recall-state-view-admission.js +5 -5
- package/dist/recall-why-service.js +5 -5
- package/dist/replica-divergence.js +3 -3
- package/dist/resume-bundles.js +33 -33
- package/dist/search/factory.js +7 -7
- package/dist/search/index.js +11 -11
- package/dist/semantic-consolidation.js +23 -23
- package/dist/semantic-rule-promotion.js +22 -22
- package/dist/semantic-rule-verifier.js +22 -22
- package/dist/source-agent-qualifier.d.ts +2 -0
- package/dist/source-agent-qualifier.d.ts.map +1 -1
- package/dist/source-agent-qualifier.js +33 -33
- package/dist/standup/build.js +23 -23
- package/dist/storage/buffer-drain-claims.js +2 -2
- package/dist/storage/buffer-session-files.js +2 -2
- package/dist/storage.js +23 -23
- package/dist/summarizer.js +3 -3
- package/dist/support-passport/index.js +75 -74
- package/dist/tokens.js +3 -3
- package/dist/transfer/backup.js +2 -2
- package/dist/transfer/capsule-export.js +2 -2
- package/dist/transfer/capsule-import.js +2 -2
- package/dist/transfer/export-okf.js +22 -22
- package/dist/verified-recall.js +22 -22
- package/dist/who-knows-cli.js +24 -24
- package/dist/who-knows.js +23 -23
- package/package.json +2 -2
- package/src/access-boundary.ts +15 -0
- package/src/access-errors.ts +22 -0
- package/src/access-fleet-wide-work-peer.test.ts +236 -0
- package/src/access-http-peer-fleet-wide.test.ts +192 -0
- package/src/access-http.test.ts +249 -4
- package/src/access-http.ts +114 -39
- package/src/access-mcp.test.ts +64 -0
- package/src/access-mcp.ts +17 -7
- package/src/access-observe-replay-durability.test.ts +40 -4
- package/src/access-operations-batch.ts +23 -12
- package/src/access-proto-injection.test.ts +340 -0
- package/src/access-schema.ts +31 -5
- package/src/access-service-capsule-import.test.ts +235 -0
- package/src/access-service.ts +6 -45
- package/src/briefing-deadline.ts +5 -4
- package/src/buffer-admission.ts +45 -0
- package/src/buffer-eviction-backpressure.test.ts +211 -0
- package/src/buffer-eviction.ts +8 -14
- package/src/buffer-incremental-persistence.test.ts +25 -37
- package/src/buffer-session.test.ts +32 -16
- package/src/buffer-turn-helpers.ts +41 -0
- package/src/buffer-types.ts +28 -1
- package/src/buffer.ts +77 -85
- package/src/capsule-import-gate.ts +109 -0
- package/src/extraction-quote-grounding.test.ts +76 -0
- package/src/extraction-quote-grounding.ts +49 -13
- package/src/extraction-source-grounding-rules.ts +6 -1
- package/src/extraction-source-grounding.ts +2 -0
- package/src/extraction.ts +3 -4
- package/src/namespaces/search.test.ts +141 -1
- package/src/namespaces/search.ts +39 -9
- package/src/orchestration/turn-ingestion.ts +38 -39
- package/src/recall-navigation-operations.ts +9 -2
- package/src/source-agent-qualifier.ts +3 -0
- package/dist/chunk-BLGQUZFB.js.map +0 -1
- package/dist/chunk-CMRHXPLQ.js.map +0 -1
- package/dist/chunk-DM4RRTN7.js.map +0 -1
- package/dist/chunk-FRM4UTDR.js.map +0 -1
- package/dist/chunk-GKYIRTNX.js.map +0 -1
- package/dist/chunk-GYNRNKMW.js.map +0 -1
- package/dist/chunk-H34INI3P.js.map +0 -1
- package/dist/chunk-HVFX2N2G.js.map +0 -1
- package/dist/chunk-KASJJGRG.js.map +0 -1
- package/dist/chunk-LGEH473S.js.map +0 -1
- package/dist/chunk-P225W4RQ.js.map +0 -1
- package/dist/chunk-SGHV6LZ7.js.map +0 -1
- package/dist/chunk-X2KO4FK5.js.map +0 -1
- package/dist/chunk-X7REO4CH.js.map +0 -1
- package/dist/chunk-XSFQN7TP.js.map +0 -1
- /package/dist/{capsule-crypto-GWVG7LGC.js.map → buffer-admission.js.map} +0 -0
- /package/dist/{chunk-73YVMZ7D.js.map → chunk-2G4TV2ML.js.map} +0 -0
- /package/dist/{chunk-BMIM6ESC.js.map → chunk-2JG2NI7C.js.map} +0 -0
- /package/dist/{chunk-IR4C3DP2.js.map → chunk-2K3AUDH7.js.map} +0 -0
- /package/dist/{chunk-6KFFRMPQ.js.map → chunk-2N4OUSIA.js.map} +0 -0
- /package/dist/{chunk-OWHERGF2.js.map → chunk-2NLLXCJG.js.map} +0 -0
- /package/dist/{chunk-44FQCC5D.js.map → chunk-2NUDHVYM.js.map} +0 -0
- /package/dist/{chunk-FK4WC6VK.js.map → chunk-2U4LMSEX.js.map} +0 -0
- /package/dist/{chunk-LT3CMO65.js.map → chunk-2XOFVTTT.js.map} +0 -0
- /package/dist/{chunk-I6ORDT54.js.map → chunk-32CA7B6L.js.map} +0 -0
- /package/dist/{chunk-TQVECGUQ.js.map → chunk-32YX7EJ3.js.map} +0 -0
- /package/dist/{chunk-HLWXCDUQ.js.map → chunk-3DAWHP5K.js.map} +0 -0
- /package/dist/{chunk-GBOYOL5L.js.map → chunk-3PJEDHLD.js.map} +0 -0
- /package/dist/{chunk-ZWTHVUT5.js.map → chunk-3UZ2VMKD.js.map} +0 -0
- /package/dist/{chunk-2XYDL2FG.js.map → chunk-3Y5X6YFH.js.map} +0 -0
- /package/dist/{chunk-23B4HLWG.js.map → chunk-4GMI5HFH.js.map} +0 -0
- /package/dist/{chunk-AP3TSV6S.js.map → chunk-4LCVA2LW.js.map} +0 -0
- /package/dist/{chunk-MZCGHPIJ.js.map → chunk-4X7HQKAG.js.map} +0 -0
- /package/dist/{chunk-YNBMBL4C.js.map → chunk-4XYAWK5H.js.map} +0 -0
- /package/dist/{chunk-2JAT4S7N.js.map → chunk-5SOSQTVE.js.map} +0 -0
- /package/dist/{chunk-G3T6YMBO.js.map → chunk-64S6X4IU.js.map} +0 -0
- /package/dist/{chunk-NIV7RPWQ.js.map → chunk-6BCWFCDG.js.map} +0 -0
- /package/dist/{chunk-V27FK6D6.js.map → chunk-6XTUZKCZ.js.map} +0 -0
- /package/dist/{chunk-2ASEDFOA.js.map → chunk-73UZZFJC.js.map} +0 -0
- /package/dist/{chunk-UHPHH74F.js.map → chunk-77PDJ4OE.js.map} +0 -0
- /package/dist/{chunk-BATPQNRG.js.map → chunk-7GSL4LBG.js.map} +0 -0
- /package/dist/{chunk-B6SPPYGJ.js.map → chunk-7IWRLYFJ.js.map} +0 -0
- /package/dist/{chunk-BUKK5SWA.js.map → chunk-7LCGFUMB.js.map} +0 -0
- /package/dist/{chunk-ZXF3O7P4.js.map → chunk-ARRTLPRC.js.map} +0 -0
- /package/dist/{chunk-S5CQI2KF.js.map → chunk-B3GKQ6DU.js.map} +0 -0
- /package/dist/{chunk-2URKYLMK.js.map → chunk-B56LORLY.js.map} +0 -0
- /package/dist/{chunk-4IWEPQEV.js.map → chunk-BIVKPQ6Q.js.map} +0 -0
- /package/dist/{chunk-4DPLCYEK.js.map → chunk-C2HORX76.js.map} +0 -0
- /package/dist/{chunk-ELWI2R6H.js.map → chunk-CC4V7HNP.js.map} +0 -0
- /package/dist/{chunk-WFDWLWDK.js.map → chunk-CN7Q3T2J.js.map} +0 -0
- /package/dist/{chunk-GJVGFKOU.js.map → chunk-CYCEROPR.js.map} +0 -0
- /package/dist/{chunk-CCU7URRP.js.map → chunk-D5EV6Y2L.js.map} +0 -0
- /package/dist/{chunk-N6II66E5.js.map → chunk-DT7SNJH6.js.map} +0 -0
- /package/dist/{chunk-MVOJDLXS.js.map → chunk-EA2LA5RI.js.map} +0 -0
- /package/dist/{chunk-WBN66HPI.js.map → chunk-ELHJK7LM.js.map} +0 -0
- /package/dist/{chunk-ONN2E5QD.js.map → chunk-EUBDYOLD.js.map} +0 -0
- /package/dist/{chunk-YNDLCWXS.js.map → chunk-EZ25VE3G.js.map} +0 -0
- /package/dist/{chunk-3LHPTBWG.js.map → chunk-F74G4KIH.js.map} +0 -0
- /package/dist/{chunk-MYCCO6AA.js.map → chunk-G54BOKZ6.js.map} +0 -0
- /package/dist/{chunk-JFH6JAGY.js.map → chunk-G67EUQAB.js.map} +0 -0
- /package/dist/{chunk-TV65NR7L.js.map → chunk-GULUWOA5.js.map} +0 -0
- /package/dist/{chunk-6DANGCMO.js.map → chunk-HFUKXOUW.js.map} +0 -0
- /package/dist/{chunk-Y3IYKNBY.js.map → chunk-HLN2HOXX.js.map} +0 -0
- /package/dist/{chunk-Y43X3E24.js.map → chunk-IBDWYRDR.js.map} +0 -0
- /package/dist/{chunk-AJG2TAMR.js.map → chunk-IEEV27BC.js.map} +0 -0
- /package/dist/{chunk-FZPDRCOB.js.map → chunk-IJ3OEECW.js.map} +0 -0
- /package/dist/{chunk-D6THW7PA.js.map → chunk-IPD5GC7C.js.map} +0 -0
- /package/dist/{chunk-VCVEMQJK.js.map → chunk-JM2YZKCQ.js.map} +0 -0
- /package/dist/{chunk-OSTFDWZJ.js.map → chunk-NIVKG3DS.js.map} +0 -0
- /package/dist/{chunk-VZELUMKK.js.map → chunk-NQP4ZYGG.js.map} +0 -0
- /package/dist/{chunk-3ODZLCHC.js.map → chunk-NT7F7WJQ.js.map} +0 -0
- /package/dist/{chunk-YO2JEX2Z.js.map → chunk-OGBQMY46.js.map} +0 -0
- /package/dist/{chunk-O55AGDTI.js.map → chunk-OL553AWT.js.map} +0 -0
- /package/dist/{chunk-CLVILSBR.js.map → chunk-OZNBZJ3S.js.map} +0 -0
- /package/dist/{chunk-RNGDKFY2.js.map → chunk-P452SEKO.js.map} +0 -0
- /package/dist/{chunk-JX3E4XCW.js.map → chunk-PDOOUXCS.js.map} +0 -0
- /package/dist/{chunk-V45TEVDA.js.map → chunk-PKZ274PI.js.map} +0 -0
- /package/dist/{chunk-MNYQVYJ4.js.map → chunk-QD5R6U5J.js.map} +0 -0
- /package/dist/{chunk-DI5ET2IE.js.map → chunk-QEZ3DW5O.js.map} +0 -0
- /package/dist/{chunk-WYPCJK6K.js.map → chunk-QKERFEJS.js.map} +0 -0
- /package/dist/{chunk-BLMTOIBK.js.map → chunk-QKES7GU6.js.map} +0 -0
- /package/dist/{chunk-PCQWKMOL.js.map → chunk-QNSZYTSG.js.map} +0 -0
- /package/dist/{chunk-MHSBOEH7.js.map → chunk-ROKDHO74.js.map} +0 -0
- /package/dist/{chunk-3VU2FDTU.js.map → chunk-SYKJBS7S.js.map} +0 -0
- /package/dist/{chunk-5BE3FLKL.js.map → chunk-TAUHAP5J.js.map} +0 -0
- /package/dist/{chunk-QCP75JGO.js.map → chunk-TFA6HPOA.js.map} +0 -0
- /package/dist/{chunk-E7V5AK7I.js.map → chunk-TRMZHGIX.js.map} +0 -0
- /package/dist/{chunk-WBDIZWJQ.js.map → chunk-TSS3D7ZY.js.map} +0 -0
- /package/dist/{chunk-OMYRPMQC.js.map → chunk-US7KPQA5.js.map} +0 -0
- /package/dist/{chunk-KHZVAISH.js.map → chunk-UWRHHRDK.js.map} +0 -0
- /package/dist/{chunk-SDESKFKT.js.map → chunk-UYHDMCY2.js.map} +0 -0
- /package/dist/{chunk-YAAKVTZA.js.map → chunk-VKILERSL.js.map} +0 -0
- /package/dist/{chunk-2TGIKMMZ.js.map → chunk-WXDTOE6F.js.map} +0 -0
- /package/dist/{chunk-UVYI6VIX.js.map → chunk-X7Y7WX73.js.map} +0 -0
- /package/dist/{chunk-QA3Y2O6H.js.map → chunk-YAVIBVCU.js.map} +0 -0
- /package/dist/{chunk-E5QEF3JO.js.map → chunk-YRZPBN46.js.map} +0 -0
- /package/dist/{chunk-FMFCQRDM.js.map → chunk-ZANNIXXE.js.map} +0 -0
- /package/dist/{chunk-3KGCHTTK.js.map → chunk-ZBFLV657.js.map} +0 -0
- /package/dist/{chunk-VEFGHRKV.js.map → chunk-ZOJUWVAU.js.map} +0 -0
|
@@ -2,7 +2,7 @@ import {
|
|
|
2
2
|
SupportPassportError,
|
|
3
3
|
SupportPassportOwnerCreateGrantRequestSchema,
|
|
4
4
|
getOperation
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-UAUV3BWS.js";
|
|
6
6
|
|
|
7
7
|
// src/support-passport/access-http.ts
|
|
8
8
|
var OWNER_ROOT = "/engram/v1/support-passport";
|
|
@@ -137,4 +137,4 @@ export {
|
|
|
137
137
|
SUPPORT_PASSPORT_OWNER_HTTP_ROUTES,
|
|
138
138
|
handleSupportPassportOwnerHttp
|
|
139
139
|
};
|
|
140
|
-
//# sourceMappingURL=chunk-
|
|
140
|
+
//# sourceMappingURL=chunk-US7KPQA5.js.map
|
|
@@ -14,7 +14,7 @@ import {
|
|
|
14
14
|
} from "./chunk-PWPIERBM.js";
|
|
15
15
|
import {
|
|
16
16
|
iterateOfflineSyncSnapshotFileRecords
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-OZNBZJ3S.js";
|
|
18
18
|
|
|
19
19
|
// src/access-offline-manifest.ts
|
|
20
20
|
import * as nodePath from "path";
|
|
@@ -250,4 +250,4 @@ export {
|
|
|
250
250
|
retainExcludedClassifications,
|
|
251
251
|
createOfflineSyncManifestStream
|
|
252
252
|
};
|
|
253
|
-
//# sourceMappingURL=chunk-
|
|
253
|
+
//# sourceMappingURL=chunk-UWRHHRDK.js.map
|
|
@@ -241,6 +241,40 @@ function probeWithTimeout(inflight, timeoutMs) {
|
|
|
241
241
|
if (timer) clearTimeout(timer);
|
|
242
242
|
});
|
|
243
243
|
}
|
|
244
|
+
var isAcceptedTurn = (t) => t.acceptedCapture === true || t.writeNamespaceOverride !== void 0;
|
|
245
|
+
function entryActivityAt(entry) {
|
|
246
|
+
const lastTurnAt = entry.turns.reduce((latest, turn) => {
|
|
247
|
+
const parsed = Date.parse(turn.timestamp);
|
|
248
|
+
return Number.isFinite(parsed) ? Math.max(latest, parsed) : latest;
|
|
249
|
+
}, -1);
|
|
250
|
+
const lastExtractionAt = entry.lastExtractionAt === null ? Number.NaN : Date.parse(entry.lastExtractionAt);
|
|
251
|
+
return Math.max(
|
|
252
|
+
lastTurnAt,
|
|
253
|
+
Number.isFinite(lastExtractionAt) ? lastExtractionAt : -1
|
|
254
|
+
);
|
|
255
|
+
}
|
|
256
|
+
function entryHoldsAcceptedCapture(entry) {
|
|
257
|
+
return (entry?.turns ?? []).some(isAcceptedTurn) || (entry?.retainedTurns ?? []).some(isAcceptedTurn);
|
|
258
|
+
}
|
|
259
|
+
function normalizeBufferState(state) {
|
|
260
|
+
const entries = Object.assign(
|
|
261
|
+
/* @__PURE__ */ Object.create(null),
|
|
262
|
+
state.entries ?? {}
|
|
263
|
+
);
|
|
264
|
+
if (!entries.default) {
|
|
265
|
+
entries.default = {
|
|
266
|
+
turns: Array.isArray(state.turns) ? [...state.turns] : [],
|
|
267
|
+
lastExtractionAt: state.lastExtractionAt ?? null,
|
|
268
|
+
extractionCount: state.extractionCount ?? 0
|
|
269
|
+
};
|
|
270
|
+
}
|
|
271
|
+
return {
|
|
272
|
+
turns: entries.default.turns,
|
|
273
|
+
lastExtractionAt: entries.default.lastExtractionAt,
|
|
274
|
+
extractionCount: entries.default.extractionCount,
|
|
275
|
+
entries
|
|
276
|
+
};
|
|
277
|
+
}
|
|
244
278
|
|
|
245
279
|
export {
|
|
246
280
|
describeError,
|
|
@@ -259,6 +293,10 @@ export {
|
|
|
259
293
|
liveTurnsFromExtractionSnapshot,
|
|
260
294
|
matchingQueuedExtractionPrefixLength,
|
|
261
295
|
ProbeTimeoutError,
|
|
262
|
-
probeWithTimeout
|
|
296
|
+
probeWithTimeout,
|
|
297
|
+
isAcceptedTurn,
|
|
298
|
+
entryActivityAt,
|
|
299
|
+
entryHoldsAcceptedCapture,
|
|
300
|
+
normalizeBufferState
|
|
263
301
|
};
|
|
264
|
-
//# sourceMappingURL=chunk-
|
|
302
|
+
//# sourceMappingURL=chunk-UXXK523X.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/buffer-turn-helpers.ts"],"sourcesContent":["import type { BufferEntryState, BufferState, BufferTurn } from \"./types.js\";\n\n/** Extracted identities retain whether they came from active or retained turns. */\nexport interface DrainedTurnSets {\n turns: BufferTurn[];\n retainedTurns: BufferTurn[];\n}\n\nexport interface BufferTurnOwner {\n /**\n * Server-resolved principal that owns this session at the authenticated\n * observe/write boundary. Persisted with the buffered turn so lifecycle\n * flushes do not have to infer ownership from a client-chosen session key.\n */\n sessionOwnerPrincipal?: string;\n}\n\nexport interface AmbientCaptureProvenance {\n /**\n * True when this turn's content came from an always-on ambient capture\n * device (a wearable recorder, a room microphone) and may therefore carry\n * speech the user never authored: TV, podcasts, music, overheard\n * conversation (issue #2294). Set by the ingesting subsystem, never from\n * tool arguments — extraction reads it to warn the model about media audio\n * and to clamp high-impact personal facts to the speculative tier.\n */\n ambientCapture?: boolean;\n}\n\nexport function describeError(err: unknown): string {\n if (err instanceof Error) return err.message;\n if (err === null) return \"null\";\n if (err === undefined) return \"undefined\";\n if (typeof err === \"string\") return err;\n try {\n return JSON.stringify(err);\n } catch {\n return String(err);\n }\n}\n\nexport function copyBufferTurn(turn: BufferTurn): BufferTurn {\n const copy: BufferTurn = {\n role: turn.role,\n content: turn.content,\n timestamp: turn.timestamp,\n };\n if (typeof turn.sessionKey === \"string\") copy.sessionKey = turn.sessionKey;\n if (typeof turn.logicalSessionKey === \"string\") {\n copy.logicalSessionKey = turn.logicalSessionKey;\n }\n if (turn.providerThreadId === null || typeof turn.providerThreadId === \"string\") {\n copy.providerThreadId = turn.providerThreadId;\n }\n if (typeof turn.sessionOwnerPrincipal === \"string\") {\n copy.sessionOwnerPrincipal = turn.sessionOwnerPrincipal;\n }\n if (typeof turn.turnFingerprint === \"string\") {\n copy.turnFingerprint = turn.turnFingerprint;\n }\n if (typeof turn.persistProcessedFingerprint === \"boolean\") {\n copy.persistProcessedFingerprint = turn.persistProcessedFingerprint;\n }\n if (typeof turn.sourceConnector === \"string\") {\n copy.sourceConnector = turn.sourceConnector;\n }\n if (turn.originRole === \"user\" || turn.originRole === \"assistant\" || turn.originRole === \"tool\") {\n copy.originRole = turn.originRole;\n }\n if (typeof turn.ambientCapture === \"boolean\") {\n copy.ambientCapture = turn.ambientCapture;\n }\n if (turn.sourceValidAt !== undefined) {\n copy.sourceValidAt = turn.sourceValidAt;\n }\n if (turn.parts !== undefined) {\n copy.parts = turn.parts;\n }\n if (turn.rawContent !== undefined) {\n copy.rawContent = turn.rawContent;\n }\n if (turn.sourceFormat !== undefined) {\n copy.sourceFormat = turn.sourceFormat;\n }\n // #3251 scope pins: strings copy by value; the plan object is an immutable\n // config-derived identity passed by reference.\n if (turn.writeNamespaceOverride !== undefined) {\n copy.writeNamespaceOverride = turn.writeNamespaceOverride;\n }\n if (turn.principalOverride !== undefined) {\n copy.principalOverride = turn.principalOverride;\n }\n if (turn.scopeProfileWritePlan !== undefined) {\n copy.scopeProfileWritePlan = turn.scopeProfileWritePlan;\n }\n if (turn.acceptedCapture === true) {\n copy.acceptedCapture = true;\n }\n const ctx = turn.codingContext;\n if (ctx) {\n // All four fields are identity inputs (branchScope uses branch) — copy\n // explicitly as-is; never a spread of external input.\n copy.codingContext = {\n projectId: ctx.projectId,\n branch: ctx.branch,\n rootPath: ctx.rootPath,\n defaultBranch: ctx.defaultBranch,\n };\n }\n return copy;\n}\n\n/**\n * Remove the turns that a drain already extracted (`drained`) from `turns`.\n * Identity-based (role/content/timestamp/session/...): the same comparison\n * the buffer uses to match live turns, so a stale owner can subtract exactly\n * what the drain took and keep everything else.\n */\nexport function subtractBufferTurns(turns: readonly BufferTurn[], drained: readonly BufferTurn[]): BufferTurn[] {\n if (drained.length === 0) return [...turns];\n const kept = [...turns];\n for (const gone of drained) {\n const at = kept.findIndex((live) => bufferTurnsEqual(live, gone));\n if (at >= 0) kept.splice(at, 1);\n }\n return kept;\n}\n\n/** Per-key pending counts over the IN-MEMORY buffer state (counts only — no\n * turn payloads). The claim store's answer stays authoritative for claimed\n * keys; callers must filter through `BufferDrainClaims.isClaimed` before\n * treating a count here as work. */\nexport interface BufferEntryCounts {\n turns: number;\n retainedTurns: number;\n}\n\nexport function bufferEntryCounts(state: BufferState): Map<string, BufferEntryCounts> {\n const out = new Map<string, BufferEntryCounts>();\n const entries = state.entries;\n if (!entries) return out;\n for (const [key, entry] of Object.entries(entries)) {\n out.set(key, { turns: entry.turns.length, retainedTurns: entry.retainedTurns?.length ?? 0 });\n }\n return out;\n}\n\nexport function bufferTurnsEqual(left: BufferTurn | undefined, right: BufferTurn): boolean {\n if (!left) return false;\n return (\n left.role === right.role &&\n left.content === right.content &&\n left.timestamp === right.timestamp &&\n left.sessionKey === right.sessionKey &&\n left.sessionOwnerPrincipal === right.sessionOwnerPrincipal &&\n left.logicalSessionKey === right.logicalSessionKey &&\n left.providerThreadId === right.providerThreadId &&\n left.turnFingerprint === right.turnFingerprint &&\n left.persistProcessedFingerprint === right.persistProcessedFingerprint &&\n left.sourceConnector === right.sourceConnector &&\n left.originRole === right.originRole &&\n left.ambientCapture === right.ambientCapture &&\n left.sourceValidAt === right.sourceValidAt &&\n left.acceptedCapture === right.acceptedCapture &&\n left.codingContext?.projectId === right.codingContext?.projectId &&\n left.codingContext?.rootPath === right.codingContext?.rootPath &&\n left.codingContext?.branch === right.codingContext?.branch &&\n left.codingContext?.defaultBranch === right.codingContext?.defaultBranch &&\n // #3251 scope pins compare by identity triple, not deep plan equality: a\n // restart-rehydrated plan must still match the pin it was accepted under.\n left.writeNamespaceOverride === right.writeNamespaceOverride &&\n left.principalOverride === right.principalOverride &&\n scopeProfilePlanIdentity(left.scopeProfileWritePlan) ===\n scopeProfilePlanIdentity(right.scopeProfileWritePlan)\n );\n}\n\n/**\n * Canonical identity key for a turn, injective over `bufferTurnsEqual`\n * equality classes. Every compared field is a primitive (or the #3251 plan\n * identity string), so set-membership replaces pairwise comparison and turn\n * merges run O(n + m) instead of O(n × m). JSON.stringify of a string is\n * injective (it escapes control characters), and the raw `\\u0001` sentinels\n * distinguish undefined from null — a distinction `===` makes and plain\n * stringification would lose.\n */\nexport function bufferTurnIdentityKey(turn: BufferTurn): string {\n const opt = (value: string | null | undefined): string =>\n value === undefined ? \"\\u0001undefined\" : value === null ? \"\\u0001null\" : JSON.stringify(value);\n const optFlag = (value: boolean | undefined): string =>\n value === undefined ? \"\\u0001undefined\" : String(value);\n const ctx = turn.codingContext;\n return JSON.stringify([\n turn.role,\n turn.content,\n turn.timestamp,\n opt(turn.sessionKey),\n opt(turn.sessionOwnerPrincipal),\n opt(turn.logicalSessionKey),\n turn.providerThreadId === undefined ? \"\\u0001undefined\" : turn.providerThreadId === null ? \"\\u0001null\" : JSON.stringify(turn.providerThreadId),\n opt(turn.turnFingerprint),\n optFlag(turn.persistProcessedFingerprint),\n opt(turn.sourceConnector),\n opt(turn.originRole),\n optFlag(turn.ambientCapture),\n opt(turn.sourceValidAt),\n optFlag(turn.acceptedCapture),\n opt(ctx?.projectId),\n opt(ctx?.rootPath),\n opt(ctx?.branch),\n opt(ctx?.defaultBranch),\n opt(turn.writeNamespaceOverride),\n opt(turn.principalOverride),\n opt(turn.scopeProfileWritePlan ? scopeProfilePlanIdentity(turn.scopeProfileWritePlan) : undefined),\n ]);\n}\n\n/**\n * Identity-dedupe `incoming` turns into `existing` (same contract as the\n * claim-merge `mergeTurns`): identical turns are dropped — the EXISTING\n * entry is kept — genuinely-new turns append in arrival order, and\n * duplicates within `incoming` collapse to their first occurrence. O(n + m)\n * via `bufferTurnIdentityKey` membership instead of pairwise equality.\n */\nexport function mergeBufferTurnsByIdentity(\n existing: readonly BufferTurn[],\n incoming: readonly BufferTurn[],\n): BufferTurn[] {\n const merged = [...existing];\n const seen = new Set(merged.map(bufferTurnIdentityKey));\n for (const turn of incoming) {\n const key = bufferTurnIdentityKey(turn);\n if (seen.has(key)) continue;\n seen.add(key);\n merged.push(turn);\n }\n return merged;\n}\n\n/** Replace only the processed snapshot; callers without one retain legacy whole-slot semantics. */\nexport function selectRetainedDeferredTurns(\n existing: readonly BufferTurn[],\n turns: BufferTurn[],\n max: number,\n originalTurns?: readonly BufferTurn[],\n): BufferTurn[] {\n const others = originalTurns === undefined ? [] : existing.filter(\n (turn) => !originalTurns.some((original) => bufferTurnsEqual(turn, original)),\n );\n if (!Array.isArray(turns) || max <= 0) return others;\n return [...others, ...turns.slice(-max).map(copyBufferTurn)];\n}\n\nexport function hasPinnedCaptureScope(turn: BufferTurn): boolean {\n return turn.acceptedCapture === true ||\n turn.writeNamespaceOverride !== undefined ||\n turn.scopeProfileWritePlan !== undefined;\n}\n\n/** Stable identity string for a pinned scope-profile plan (#3251). */\nexport function scopeProfilePlanIdentity(\n plan: BufferTurn[\"scopeProfileWritePlan\"],\n): string {\n if (!plan) return \"\";\n return `${plan.profileId}\\u0000${plan.writeLayer}\\u0000${plan.writeNamespace}`;\n}\n\nexport interface ExtractionScopeGroup {\n writeNamespaceOverride?: string;\n principalOverride?: string;\n scopeProfileWritePlan?: BufferTurn[\"scopeProfileWritePlan\"];\n codingContext?: BufferTurn[\"codingContext\"];\n turns: BufferTurn[];\n}\n\n/**\n * Partition extraction turns by their durable scope pins (#3251). Turns\n * captured under different namespaces / principals / scope profiles /\n * project bindings must never be extracted together — each group runs its\n * own extraction under its own scope. Native (unpinned) turns form their own\n * group and keep today's single-store routing.\n */\nexport function groupTurnsByExtractionScope(turns: BufferTurn[]): ExtractionScopeGroup[] {\n const groups = new Map<string, ExtractionScopeGroup>();\n for (const turn of turns) {\n const key = [\n turn.writeNamespaceOverride ?? \"\",\n turn.principalOverride ?? \"\",\n scopeProfilePlanIdentity(turn.scopeProfileWritePlan),\n // Accepted captures are deliberately accepted content: they must never\n // share a scope group with ordinary turns, or a group-level capture\n // policy (the explicit-mode gate, the planless-accepted null pin) is\n // applied to ordinary conversation turns because `.some(acceptedCapture)`\n // only looked at the merged group.\n turn.acceptedCapture === true ? \"accepted\" : \"\",\n turn.codingContext?.projectId ?? \"\",\n turn.codingContext?.rootPath ?? \"\",\n turn.codingContext?.branch ?? \"\",\n turn.codingContext?.defaultBranch ?? \"\",\n ].join(\"\\u0000\");\n const group = groups.get(key);\n if (group) {\n group.turns.push(turn);\n } else {\n const created: ExtractionScopeGroup = { turns: [turn] };\n if (turn.writeNamespaceOverride !== undefined) created.writeNamespaceOverride = turn.writeNamespaceOverride;\n if (turn.principalOverride !== undefined) created.principalOverride = turn.principalOverride;\n if (turn.scopeProfileWritePlan !== undefined) created.scopeProfileWritePlan = turn.scopeProfileWritePlan;\n if (turn.codingContext !== undefined) created.codingContext = turn.codingContext;\n groups.set(key, created);\n }\n }\n return [...groups.values()];\n}\n\nexport function bufferTurnArraysEqual(\n left: readonly BufferTurn[],\n right: readonly BufferTurn[],\n): boolean {\n return left.length === right.length && left.every((turn, index) => bufferTurnsEqual(turn, right[index]));\n}\n\nexport function bufferTurnArrayIsSuffixOfSnapshot(\n liveTurns: readonly BufferTurn[],\n snapshot: readonly BufferTurn[],\n): boolean {\n if (liveTurns.length === 0 || liveTurns.length > snapshot.length) {\n return false;\n }\n const offset = snapshot.length - liveTurns.length;\n return liveTurns.every((turn, index) => bufferTurnsEqual(turn, snapshot[offset + index]));\n}\n\nexport function liveTurnsFromExtractionSnapshot(\n entry: BufferEntryState,\n extractedTurns: readonly BufferTurn[],\n): readonly BufferTurn[] {\n const retainedTurns = entry.retainedTurns ?? [];\n if (\n retainedTurns.length > 0 &&\n extractedTurns.length >= retainedTurns.length &&\n retainedTurns.every((turn, index) => bufferTurnsEqual(extractedTurns[index], turn))\n ) {\n const withoutRetainedPrefix = extractedTurns.slice(retainedTurns.length);\n if (withoutRetainedPrefix.length > 0 && matchingPrefixLength(entry.turns, withoutRetainedPrefix) > 0) {\n return withoutRetainedPrefix;\n }\n }\n return extractedTurns;\n}\n\nfunction matchingPrefixLength(\n liveTurns: readonly BufferTurn[],\n extractedTurns: readonly BufferTurn[],\n): number {\n let index = 0;\n while (\n index < liveTurns.length &&\n index < extractedTurns.length &&\n bufferTurnsEqual(liveTurns[index], extractedTurns[index])\n ) {\n index += 1;\n }\n return index;\n}\n\nexport function matchingQueuedExtractionPrefixLength(\n liveTurns: readonly BufferTurn[],\n extractedTurns: readonly BufferTurn[],\n): number {\n let bestMatchedCount = 0;\n for (let start = 0; start < extractedTurns.length; start += 1) {\n const matchedCount = matchingPrefixLength(liveTurns, extractedTurns.slice(start));\n if (matchedCount > bestMatchedCount) {\n bestMatchedCount = matchedCount;\n if (bestMatchedCount === liveTurns.length) break;\n }\n }\n return bestMatchedCount;\n}\n\nexport class ProbeTimeoutError extends Error {\n constructor(timeoutMs: number) {\n super(`probe exceeded ${timeoutMs}ms`);\n this.name = \"ProbeTimeoutError\";\n }\n}\n\nexport function probeWithTimeout<T>(inflight: Promise<T>, timeoutMs: number): Promise<T> {\n let timer: NodeJS.Timeout | null = null;\n const timeout = new Promise<T>((_, reject) => {\n timer = setTimeout(() => reject(new ProbeTimeoutError(timeoutMs)), timeoutMs);\n if (typeof (timer as NodeJS.Timeout).unref === \"function\") {\n (timer as NodeJS.Timeout).unref();\n }\n });\n return Promise.race([inflight, timeout]).finally(() => {\n if (timer) clearTimeout(timer);\n });\n}\n"],"mappings":";AA6BO,SAAS,cAAc,KAAsB;AAClD,MAAI,eAAe,MAAO,QAAO,IAAI;AACrC,MAAI,QAAQ,KAAM,QAAO;AACzB,MAAI,QAAQ,OAAW,QAAO;AAC9B,MAAI,OAAO,QAAQ,SAAU,QAAO;AACpC,MAAI;AACF,WAAO,KAAK,UAAU,GAAG;AAAA,EAC3B,QAAQ;AACN,WAAO,OAAO,GAAG;AAAA,EACnB;AACF;AAEO,SAAS,eAAe,MAA8B;AAC3D,QAAM,OAAmB;AAAA,IACvB,MAAM,KAAK;AAAA,IACX,SAAS,KAAK;AAAA,IACd,WAAW,KAAK;AAAA,EAClB;AACA,MAAI,OAAO,KAAK,eAAe,SAAU,MAAK,aAAa,KAAK;AAChE,MAAI,OAAO,KAAK,sBAAsB,UAAU;AAC9C,SAAK,oBAAoB,KAAK;AAAA,EAChC;AACA,MAAI,KAAK,qBAAqB,QAAQ,OAAO,KAAK,qBAAqB,UAAU;AAC/E,SAAK,mBAAmB,KAAK;AAAA,EAC/B;AACA,MAAI,OAAO,KAAK,0BAA0B,UAAU;AAClD,SAAK,wBAAwB,KAAK;AAAA,EACpC;AACA,MAAI,OAAO,KAAK,oBAAoB,UAAU;AAC5C,SAAK,kBAAkB,KAAK;AAAA,EAC9B;AACA,MAAI,OAAO,KAAK,gCAAgC,WAAW;AACzD,SAAK,8BAA8B,KAAK;AAAA,EAC1C;AACA,MAAI,OAAO,KAAK,oBAAoB,UAAU;AAC5C,SAAK,kBAAkB,KAAK;AAAA,EAC9B;AACA,MAAI,KAAK,eAAe,UAAU,KAAK,eAAe,eAAe,KAAK,eAAe,QAAQ;AAC/F,SAAK,aAAa,KAAK;AAAA,EACzB;AACA,MAAI,OAAO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;AACF;AAEO,SAAS,iBAAoB,UAAsB,WAA+B;AACvF,MAAI,QAA+B;AACnC,QAAM,UAAU,IAAI,QAAW,CAAC,GAAG,WAAW;AAC5C,YAAQ,WAAW,MAAM,OAAO,IAAI,kBAAkB,SAAS,CAAC,GAAG,SAAS;AAC5E,QAAI,OAAQ,MAAyB,UAAU,YAAY;AACzD,MAAC,MAAyB,MAAM;AAAA,IAClC;AAAA,EACF,CAAC;AACD,SAAO,QAAQ,KAAK,CAAC,UAAU,OAAO,CAAC,EAAE,QAAQ,MAAM;AACrD,QAAI,MAAO,cAAa,KAAK;AAAA,EAC/B,CAAC;AACH;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../src/buffer-turn-helpers.ts"],"sourcesContent":["import type { BufferEntryState, BufferState, BufferTurn } from \"./types.js\";\n\n/** Extracted identities retain whether they came from active or retained turns. */\nexport interface DrainedTurnSets {\n turns: BufferTurn[];\n retainedTurns: BufferTurn[];\n}\n\nexport interface BufferTurnOwner {\n /**\n * Server-resolved principal that owns this session at the authenticated\n * observe/write boundary. Persisted with the buffered turn so lifecycle\n * flushes do not have to infer ownership from a client-chosen session key.\n */\n sessionOwnerPrincipal?: string;\n}\n\nexport interface AmbientCaptureProvenance {\n /**\n * True when this turn's content came from an always-on ambient capture\n * device (a wearable recorder, a room microphone) and may therefore carry\n * speech the user never authored: TV, podcasts, music, overheard\n * conversation (issue #2294). Set by the ingesting subsystem, never from\n * tool arguments — extraction reads it to warn the model about media audio\n * and to clamp high-impact personal facts to the speculative tier.\n */\n ambientCapture?: boolean;\n}\n\nexport function describeError(err: unknown): string {\n if (err instanceof Error) return err.message;\n if (err === null) return \"null\";\n if (err === undefined) return \"undefined\";\n if (typeof err === \"string\") return err;\n try {\n return JSON.stringify(err);\n } catch {\n return String(err);\n }\n}\n\nexport function copyBufferTurn(turn: BufferTurn): BufferTurn {\n const copy: BufferTurn = {\n role: turn.role,\n content: turn.content,\n timestamp: turn.timestamp,\n };\n if (typeof turn.sessionKey === \"string\") copy.sessionKey = turn.sessionKey;\n if (typeof turn.logicalSessionKey === \"string\") {\n copy.logicalSessionKey = turn.logicalSessionKey;\n }\n if (turn.providerThreadId === null || typeof turn.providerThreadId === \"string\") {\n copy.providerThreadId = turn.providerThreadId;\n }\n if (typeof turn.sessionOwnerPrincipal === \"string\") {\n copy.sessionOwnerPrincipal = turn.sessionOwnerPrincipal;\n }\n if (typeof turn.turnFingerprint === \"string\") {\n copy.turnFingerprint = turn.turnFingerprint;\n }\n if (typeof turn.persistProcessedFingerprint === \"boolean\") {\n copy.persistProcessedFingerprint = turn.persistProcessedFingerprint;\n }\n if (typeof turn.sourceConnector === \"string\") {\n copy.sourceConnector = turn.sourceConnector;\n }\n if (turn.originRole === \"user\" || turn.originRole === \"assistant\" || turn.originRole === \"tool\") {\n copy.originRole = turn.originRole;\n }\n if (typeof turn.ambientCapture === \"boolean\") {\n copy.ambientCapture = turn.ambientCapture;\n }\n if (turn.sourceValidAt !== undefined) {\n copy.sourceValidAt = turn.sourceValidAt;\n }\n if (turn.parts !== undefined) {\n copy.parts = turn.parts;\n }\n if (turn.rawContent !== undefined) {\n copy.rawContent = turn.rawContent;\n }\n if (turn.sourceFormat !== undefined) {\n copy.sourceFormat = turn.sourceFormat;\n }\n // #3251 scope pins: strings copy by value; the plan object is an immutable\n // config-derived identity passed by reference.\n if (turn.writeNamespaceOverride !== undefined) {\n copy.writeNamespaceOverride = turn.writeNamespaceOverride;\n }\n if (turn.principalOverride !== undefined) {\n copy.principalOverride = turn.principalOverride;\n }\n if (turn.scopeProfileWritePlan !== undefined) {\n copy.scopeProfileWritePlan = turn.scopeProfileWritePlan;\n }\n if (turn.acceptedCapture === true) {\n copy.acceptedCapture = true;\n }\n const ctx = turn.codingContext;\n if (ctx) {\n // All four fields are identity inputs (branchScope uses branch) — copy\n // explicitly as-is; never a spread of external input.\n copy.codingContext = {\n projectId: ctx.projectId,\n branch: ctx.branch,\n rootPath: ctx.rootPath,\n defaultBranch: ctx.defaultBranch,\n };\n }\n return copy;\n}\n\n/**\n * Remove the turns that a drain already extracted (`drained`) from `turns`.\n * Identity-based (role/content/timestamp/session/...): the same comparison\n * the buffer uses to match live turns, so a stale owner can subtract exactly\n * what the drain took and keep everything else.\n */\nexport function subtractBufferTurns(turns: readonly BufferTurn[], drained: readonly BufferTurn[]): BufferTurn[] {\n if (drained.length === 0) return [...turns];\n const kept = [...turns];\n for (const gone of drained) {\n const at = kept.findIndex((live) => bufferTurnsEqual(live, gone));\n if (at >= 0) kept.splice(at, 1);\n }\n return kept;\n}\n\n/** Per-key pending counts over the IN-MEMORY buffer state (counts only — no\n * turn payloads). The claim store's answer stays authoritative for claimed\n * keys; callers must filter through `BufferDrainClaims.isClaimed` before\n * treating a count here as work. */\nexport interface BufferEntryCounts {\n turns: number;\n retainedTurns: number;\n}\n\nexport function bufferEntryCounts(state: BufferState): Map<string, BufferEntryCounts> {\n const out = new Map<string, BufferEntryCounts>();\n const entries = state.entries;\n if (!entries) return out;\n for (const [key, entry] of Object.entries(entries)) {\n out.set(key, { turns: entry.turns.length, retainedTurns: entry.retainedTurns?.length ?? 0 });\n }\n return out;\n}\n\nexport function bufferTurnsEqual(left: BufferTurn | undefined, right: BufferTurn): boolean {\n if (!left) return false;\n return (\n left.role === right.role &&\n left.content === right.content &&\n left.timestamp === right.timestamp &&\n left.sessionKey === right.sessionKey &&\n left.sessionOwnerPrincipal === right.sessionOwnerPrincipal &&\n left.logicalSessionKey === right.logicalSessionKey &&\n left.providerThreadId === right.providerThreadId &&\n left.turnFingerprint === right.turnFingerprint &&\n left.persistProcessedFingerprint === right.persistProcessedFingerprint &&\n left.sourceConnector === right.sourceConnector &&\n left.originRole === right.originRole &&\n left.ambientCapture === right.ambientCapture &&\n left.sourceValidAt === right.sourceValidAt &&\n left.acceptedCapture === right.acceptedCapture &&\n left.codingContext?.projectId === right.codingContext?.projectId &&\n left.codingContext?.rootPath === right.codingContext?.rootPath &&\n left.codingContext?.branch === right.codingContext?.branch &&\n left.codingContext?.defaultBranch === right.codingContext?.defaultBranch &&\n // #3251 scope pins compare by identity triple, not deep plan equality: a\n // restart-rehydrated plan must still match the pin it was accepted under.\n left.writeNamespaceOverride === right.writeNamespaceOverride &&\n left.principalOverride === right.principalOverride &&\n scopeProfilePlanIdentity(left.scopeProfileWritePlan) ===\n scopeProfilePlanIdentity(right.scopeProfileWritePlan)\n );\n}\n\n/**\n * Canonical identity key for a turn, injective over `bufferTurnsEqual`\n * equality classes. Every compared field is a primitive (or the #3251 plan\n * identity string), so set-membership replaces pairwise comparison and turn\n * merges run O(n + m) instead of O(n × m). JSON.stringify of a string is\n * injective (it escapes control characters), and the raw `\\u0001` sentinels\n * distinguish undefined from null — a distinction `===` makes and plain\n * stringification would lose.\n */\nexport function bufferTurnIdentityKey(turn: BufferTurn): string {\n const opt = (value: string | null | undefined): string =>\n value === undefined ? \"\\u0001undefined\" : value === null ? \"\\u0001null\" : JSON.stringify(value);\n const optFlag = (value: boolean | undefined): string =>\n value === undefined ? \"\\u0001undefined\" : String(value);\n const ctx = turn.codingContext;\n return JSON.stringify([\n turn.role,\n turn.content,\n turn.timestamp,\n opt(turn.sessionKey),\n opt(turn.sessionOwnerPrincipal),\n opt(turn.logicalSessionKey),\n turn.providerThreadId === undefined ? \"\\u0001undefined\" : turn.providerThreadId === null ? \"\\u0001null\" : JSON.stringify(turn.providerThreadId),\n opt(turn.turnFingerprint),\n optFlag(turn.persistProcessedFingerprint),\n opt(turn.sourceConnector),\n opt(turn.originRole),\n optFlag(turn.ambientCapture),\n opt(turn.sourceValidAt),\n optFlag(turn.acceptedCapture),\n opt(ctx?.projectId),\n opt(ctx?.rootPath),\n opt(ctx?.branch),\n opt(ctx?.defaultBranch),\n opt(turn.writeNamespaceOverride),\n opt(turn.principalOverride),\n opt(turn.scopeProfileWritePlan ? scopeProfilePlanIdentity(turn.scopeProfileWritePlan) : undefined),\n ]);\n}\n\n/**\n * Identity-dedupe `incoming` turns into `existing` (same contract as the\n * claim-merge `mergeTurns`): identical turns are dropped — the EXISTING\n * entry is kept — genuinely-new turns append in arrival order, and\n * duplicates within `incoming` collapse to their first occurrence. O(n + m)\n * via `bufferTurnIdentityKey` membership instead of pairwise equality.\n */\nexport function mergeBufferTurnsByIdentity(\n existing: readonly BufferTurn[],\n incoming: readonly BufferTurn[],\n): BufferTurn[] {\n const merged = [...existing];\n const seen = new Set(merged.map(bufferTurnIdentityKey));\n for (const turn of incoming) {\n const key = bufferTurnIdentityKey(turn);\n if (seen.has(key)) continue;\n seen.add(key);\n merged.push(turn);\n }\n return merged;\n}\n\n/** Replace only the processed snapshot; callers without one retain legacy whole-slot semantics. */\nexport function selectRetainedDeferredTurns(\n existing: readonly BufferTurn[],\n turns: BufferTurn[],\n max: number,\n originalTurns?: readonly BufferTurn[],\n): BufferTurn[] {\n const others = originalTurns === undefined ? [] : existing.filter(\n (turn) => !originalTurns.some((original) => bufferTurnsEqual(turn, original)),\n );\n if (!Array.isArray(turns) || max <= 0) return others;\n return [...others, ...turns.slice(-max).map(copyBufferTurn)];\n}\n\nexport function hasPinnedCaptureScope(turn: BufferTurn): boolean {\n return turn.acceptedCapture === true ||\n turn.writeNamespaceOverride !== undefined ||\n turn.scopeProfileWritePlan !== undefined;\n}\n\n/** Stable identity string for a pinned scope-profile plan (#3251). */\nexport function scopeProfilePlanIdentity(\n plan: BufferTurn[\"scopeProfileWritePlan\"],\n): string {\n if (!plan) return \"\";\n return `${plan.profileId}\\u0000${plan.writeLayer}\\u0000${plan.writeNamespace}`;\n}\n\nexport interface ExtractionScopeGroup {\n writeNamespaceOverride?: string;\n principalOverride?: string;\n scopeProfileWritePlan?: BufferTurn[\"scopeProfileWritePlan\"];\n codingContext?: BufferTurn[\"codingContext\"];\n turns: BufferTurn[];\n}\n\n/**\n * Partition extraction turns by their durable scope pins (#3251). Turns\n * captured under different namespaces / principals / scope profiles /\n * project bindings must never be extracted together — each group runs its\n * own extraction under its own scope. Native (unpinned) turns form their own\n * group and keep today's single-store routing.\n */\nexport function groupTurnsByExtractionScope(turns: BufferTurn[]): ExtractionScopeGroup[] {\n const groups = new Map<string, ExtractionScopeGroup>();\n for (const turn of turns) {\n const key = [\n turn.writeNamespaceOverride ?? \"\",\n turn.principalOverride ?? \"\",\n scopeProfilePlanIdentity(turn.scopeProfileWritePlan),\n // Accepted captures are deliberately accepted content: they must never\n // share a scope group with ordinary turns, or a group-level capture\n // policy (the explicit-mode gate, the planless-accepted null pin) is\n // applied to ordinary conversation turns because `.some(acceptedCapture)`\n // only looked at the merged group.\n turn.acceptedCapture === true ? \"accepted\" : \"\",\n turn.codingContext?.projectId ?? \"\",\n turn.codingContext?.rootPath ?? \"\",\n turn.codingContext?.branch ?? \"\",\n turn.codingContext?.defaultBranch ?? \"\",\n ].join(\"\\u0000\");\n const group = groups.get(key);\n if (group) {\n group.turns.push(turn);\n } else {\n const created: ExtractionScopeGroup = { turns: [turn] };\n if (turn.writeNamespaceOverride !== undefined) created.writeNamespaceOverride = turn.writeNamespaceOverride;\n if (turn.principalOverride !== undefined) created.principalOverride = turn.principalOverride;\n if (turn.scopeProfileWritePlan !== undefined) created.scopeProfileWritePlan = turn.scopeProfileWritePlan;\n if (turn.codingContext !== undefined) created.codingContext = turn.codingContext;\n groups.set(key, created);\n }\n }\n return [...groups.values()];\n}\n\nexport function bufferTurnArraysEqual(\n left: readonly BufferTurn[],\n right: readonly BufferTurn[],\n): boolean {\n return left.length === right.length && left.every((turn, index) => bufferTurnsEqual(turn, right[index]));\n}\n\nexport function bufferTurnArrayIsSuffixOfSnapshot(\n liveTurns: readonly BufferTurn[],\n snapshot: readonly BufferTurn[],\n): boolean {\n if (liveTurns.length === 0 || liveTurns.length > snapshot.length) {\n return false;\n }\n const offset = snapshot.length - liveTurns.length;\n return liveTurns.every((turn, index) => bufferTurnsEqual(turn, snapshot[offset + index]));\n}\n\nexport function liveTurnsFromExtractionSnapshot(\n entry: BufferEntryState,\n extractedTurns: readonly BufferTurn[],\n): readonly BufferTurn[] {\n const retainedTurns = entry.retainedTurns ?? [];\n if (\n retainedTurns.length > 0 &&\n extractedTurns.length >= retainedTurns.length &&\n retainedTurns.every((turn, index) => bufferTurnsEqual(extractedTurns[index], turn))\n ) {\n const withoutRetainedPrefix = extractedTurns.slice(retainedTurns.length);\n if (withoutRetainedPrefix.length > 0 && matchingPrefixLength(entry.turns, withoutRetainedPrefix) > 0) {\n return withoutRetainedPrefix;\n }\n }\n return extractedTurns;\n}\n\nfunction matchingPrefixLength(\n liveTurns: readonly BufferTurn[],\n extractedTurns: readonly BufferTurn[],\n): number {\n let index = 0;\n while (\n index < liveTurns.length &&\n index < extractedTurns.length &&\n bufferTurnsEqual(liveTurns[index], extractedTurns[index])\n ) {\n index += 1;\n }\n return index;\n}\n\nexport function matchingQueuedExtractionPrefixLength(\n liveTurns: readonly BufferTurn[],\n extractedTurns: readonly BufferTurn[],\n): number {\n let bestMatchedCount = 0;\n for (let start = 0; start < extractedTurns.length; start += 1) {\n const matchedCount = matchingPrefixLength(liveTurns, extractedTurns.slice(start));\n if (matchedCount > bestMatchedCount) {\n bestMatchedCount = matchedCount;\n if (bestMatchedCount === liveTurns.length) break;\n }\n }\n return bestMatchedCount;\n}\n\nexport class ProbeTimeoutError extends Error {\n constructor(timeoutMs: number) {\n super(`probe exceeded ${timeoutMs}ms`);\n this.name = \"ProbeTimeoutError\";\n }\n}\n\nexport function probeWithTimeout<T>(inflight: Promise<T>, timeoutMs: number): Promise<T> {\n let timer: NodeJS.Timeout | null = null;\n const timeout = new Promise<T>((_, reject) => {\n timer = setTimeout(() => reject(new ProbeTimeoutError(timeoutMs)), timeoutMs);\n if (typeof (timer as NodeJS.Timeout).unref === \"function\") {\n (timer as NodeJS.Timeout).unref();\n }\n });\n return Promise.race([inflight, timeout]).finally(() => {\n if (timer) clearTimeout(timer);\n });\n}\n\nexport const isAcceptedTurn = (t: { acceptedCapture?: boolean; writeNamespaceOverride?: string }): boolean =>\n t.acceptedCapture === true || t.writeNamespaceOverride !== undefined;\n\nexport function entryActivityAt(entry: BufferEntryState): number {\n const lastTurnAt = entry.turns.reduce((latest, turn) => {\n const parsed = Date.parse(turn.timestamp);\n return Number.isFinite(parsed) ? Math.max(latest, parsed) : latest;\n }, -1);\n const lastExtractionAt =\n entry.lastExtractionAt === null ? Number.NaN : Date.parse(entry.lastExtractionAt);\n return Math.max(\n lastTurnAt,\n Number.isFinite(lastExtractionAt) ? lastExtractionAt : -1,\n );\n}\n\nexport function entryHoldsAcceptedCapture(entry: BufferEntryState | undefined): boolean {\n return (entry?.turns ?? []).some(isAcceptedTurn) || (entry?.retainedTurns ?? []).some(isAcceptedTurn);\n}\n\nexport function normalizeBufferState(state: BufferState): BufferState {\n // SAFETY: persisted-state contract — entries, when present, is a record of BufferEntryState.\n const entries = Object.assign(\n Object.create(null),\n state.entries ?? {},\n ) as NonNullable<BufferState[\"entries\"]>;\n if (!entries.default) {\n entries.default = {\n turns: Array.isArray(state.turns) ? [...state.turns] : [],\n lastExtractionAt: state.lastExtractionAt ?? null,\n extractionCount: state.extractionCount ?? 0,\n };\n }\n return {\n turns: entries.default.turns,\n lastExtractionAt: entries.default.lastExtractionAt,\n extractionCount: entries.default.extractionCount,\n entries,\n };\n}\n"],"mappings":";AA6BO,SAAS,cAAc,KAAsB;AAClD,MAAI,eAAe,MAAO,QAAO,IAAI;AACrC,MAAI,QAAQ,KAAM,QAAO;AACzB,MAAI,QAAQ,OAAW,QAAO;AAC9B,MAAI,OAAO,QAAQ,SAAU,QAAO;AACpC,MAAI;AACF,WAAO,KAAK,UAAU,GAAG;AAAA,EAC3B,QAAQ;AACN,WAAO,OAAO,GAAG;AAAA,EACnB;AACF;AAEO,SAAS,eAAe,MAA8B;AAC3D,QAAM,OAAmB;AAAA,IACvB,MAAM,KAAK;AAAA,IACX,SAAS,KAAK;AAAA,IACd,WAAW,KAAK;AAAA,EAClB;AACA,MAAI,OAAO,KAAK,eAAe,SAAU,MAAK,aAAa,KAAK;AAChE,MAAI,OAAO,KAAK,sBAAsB,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;AAAA,EAC9D,GAAG,EAAE;AACL,QAAM,mBACJ,MAAM,qBAAqB,OAAO,OAAO,MAAM,KAAK,MAAM,MAAM,gBAAgB;AAClF,SAAO,KAAK;AAAA,IACV;AAAA,IACA,OAAO,SAAS,gBAAgB,IAAI,mBAAmB;AAAA,EACzD;AACF;AAEO,SAAS,0BAA0B,OAA8C;AACtF,UAAQ,OAAO,SAAS,CAAC,GAAG,KAAK,cAAc,MAAM,OAAO,iBAAiB,CAAC,GAAG,KAAK,cAAc;AACtG;AAEO,SAAS,qBAAqB,OAAiC;AAEpE,QAAM,UAAU,OAAO;AAAA,IACrB,uBAAO,OAAO,IAAI;AAAA,IAClB,MAAM,WAAW,CAAC;AAAA,EACpB;AACA,MAAI,CAAC,QAAQ,SAAS;AACpB,YAAQ,UAAU;AAAA,MAChB,OAAO,MAAM,QAAQ,MAAM,KAAK,IAAI,CAAC,GAAG,MAAM,KAAK,IAAI,CAAC;AAAA,MACxD,kBAAkB,MAAM,oBAAoB;AAAA,MAC5C,iBAAiB,MAAM,mBAAmB;AAAA,IAC5C;AAAA,EACF;AACA,SAAO;AAAA,IACL,OAAO,QAAQ,QAAQ;AAAA,IACvB,kBAAkB,QAAQ,QAAQ;AAAA,IAClC,iBAAiB,QAAQ,QAAQ;AAAA,IACjC;AAAA,EACF;AACF;","names":[]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
EngramAccessInputError
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-CJCTKL6Y.js";
|
|
4
4
|
|
|
5
5
|
// src/memory-browse-http-glue.ts
|
|
6
6
|
function optStr(value) {
|
|
@@ -51,4 +51,4 @@ async function maybeRespondMemoryBrowse(req, res, pathname, method, enforceToken
|
|
|
51
51
|
export {
|
|
52
52
|
maybeRespondMemoryBrowse
|
|
53
53
|
};
|
|
54
|
-
//# sourceMappingURL=chunk-
|
|
54
|
+
//# sourceMappingURL=chunk-UYHDMCY2.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
rebuildMemoryProjection,
|
|
3
3
|
watchProjectionRebuildParent
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-DT7SNJH6.js";
|
|
5
5
|
import {
|
|
6
6
|
initLogger,
|
|
7
7
|
log
|
|
@@ -77,4 +77,4 @@ if (invokedAsRunner) {
|
|
|
77
77
|
export {
|
|
78
78
|
PROJECTION_REBUILD_RUNNER_FLAG
|
|
79
79
|
};
|
|
80
|
-
//# sourceMappingURL=chunk-
|
|
80
|
+
//# sourceMappingURL=chunk-VKILERSL.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
EngramAccessInputError
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-CJCTKL6Y.js";
|
|
4
4
|
|
|
5
5
|
// src/recall-navigation-http-glue.ts
|
|
6
6
|
var VALID_RELATIONS = [
|
|
@@ -95,4 +95,4 @@ async function maybeRespondRecallNavigation(req, res, pathname, method, enforceT
|
|
|
95
95
|
export {
|
|
96
96
|
maybeRespondRecallNavigation
|
|
97
97
|
};
|
|
98
|
-
//# sourceMappingURL=chunk-
|
|
98
|
+
//# sourceMappingURL=chunk-WXDTOE6F.js.map
|
|
@@ -21,16 +21,16 @@ import {
|
|
|
21
21
|
defineOperation,
|
|
22
22
|
parseNamespacePreflightWriteOp,
|
|
23
23
|
resolveAuthorizedNamespaceWritablePreflight
|
|
24
|
-
} from "./chunk-
|
|
24
|
+
} from "./chunk-UAUV3BWS.js";
|
|
25
25
|
import {
|
|
26
26
|
parseSharedWriteOutputControls
|
|
27
27
|
} from "./chunk-IFBSZGW3.js";
|
|
28
28
|
import {
|
|
29
29
|
validateBriefingFormat
|
|
30
|
-
} from "./chunk-
|
|
30
|
+
} from "./chunk-CYCEROPR.js";
|
|
31
31
|
import {
|
|
32
32
|
parseDeepRecallMaxSteps
|
|
33
|
-
} from "./chunk-
|
|
33
|
+
} from "./chunk-IEEV27BC.js";
|
|
34
34
|
import {
|
|
35
35
|
runContradictionScan
|
|
36
36
|
} from "./chunk-P4JED3ZL.js";
|
|
@@ -44,11 +44,11 @@ import {
|
|
|
44
44
|
recallRequestSchema,
|
|
45
45
|
retainedCategoryAlias,
|
|
46
46
|
suggestionSubmitRequestSchema
|
|
47
|
-
} from "./chunk-
|
|
47
|
+
} from "./chunk-YMJRLT7S.js";
|
|
48
48
|
import {
|
|
49
49
|
enforceNamespaceAllowList,
|
|
50
50
|
tokenCapabilityStore
|
|
51
|
-
} from "./chunk-
|
|
51
|
+
} from "./chunk-OGBQMY46.js";
|
|
52
52
|
import {
|
|
53
53
|
resolvePrincipal
|
|
54
54
|
} from "./chunk-ESG6ITGP.js";
|
|
@@ -60,8 +60,9 @@ import {
|
|
|
60
60
|
} from "./chunk-6KH5NLQS.js";
|
|
61
61
|
import {
|
|
62
62
|
EngramAccessForbiddenError,
|
|
63
|
-
EngramAccessInputError
|
|
64
|
-
|
|
63
|
+
EngramAccessInputError,
|
|
64
|
+
rejectReservedArgumentKey
|
|
65
|
+
} from "./chunk-CJCTKL6Y.js";
|
|
65
66
|
|
|
66
67
|
// src/access-operations-batch.ts
|
|
67
68
|
import { randomUUID } from "crypto";
|
|
@@ -69,8 +70,9 @@ import { z } from "zod";
|
|
|
69
70
|
function stripNulls(data) {
|
|
70
71
|
if (data !== null && typeof data === "object" && !Array.isArray(data)) {
|
|
71
72
|
const obj = data;
|
|
72
|
-
const cleaned =
|
|
73
|
+
const cleaned = /* @__PURE__ */ Object.create(null);
|
|
73
74
|
for (const [key, value] of Object.entries(obj)) {
|
|
75
|
+
rejectReservedArgumentKey(key);
|
|
74
76
|
if (value !== null) cleaned[key] = value;
|
|
75
77
|
}
|
|
76
78
|
return cleaned;
|
|
@@ -82,8 +84,9 @@ function strictSchema(shape) {
|
|
|
82
84
|
}
|
|
83
85
|
function stripNullsExcept(data, preserve) {
|
|
84
86
|
if (data !== null && typeof data === "object" && !Array.isArray(data)) {
|
|
85
|
-
const cleaned =
|
|
87
|
+
const cleaned = /* @__PURE__ */ Object.create(null);
|
|
86
88
|
for (const [key, value] of Object.entries(data)) {
|
|
89
|
+
rejectReservedArgumentKey(key);
|
|
87
90
|
if (value !== null || preserve.includes(key)) cleaned[key] = value;
|
|
88
91
|
}
|
|
89
92
|
return cleaned;
|
|
@@ -397,9 +400,9 @@ defineOperation({ name: "continuity_loop_review", description: "Review loop.", s
|
|
|
397
400
|
defineOperation({ name: "identity_anchor_get", description: "Get identity anchor.", schema: strictSchema({ namespace: S.str }), handler: async (input, ctx) => ({ result: await ctx.service.identityAnchorGet({ namespace: optStr(input.namespace), principal: ctx.authenticatedPrincipal }) }) });
|
|
398
401
|
defineOperation({ name: "identity_anchor_update", description: "Update identity anchor.", schema: strictSchema({ namespace: S.str, identityTraits: S.str, communicationPreferences: S.str, operatingPrinciples: S.str, continuityNotes: S.str }), handler: async (input, ctx) => ({ result: await ctx.service.identityAnchorUpdate({ namespace: optStr(input.namespace), principal: ctx.authenticatedPrincipal, identityTraits: optStr(input.identityTraits), communicationPreferences: optStr(input.communicationPreferences), operatingPrinciples: optStr(input.operatingPrinciples), continuityNotes: optStr(input.continuityNotes) }) }) });
|
|
399
402
|
defineOperation({ name: "memory_identity", description: "Memory identity.", schema: strictSchema({ namespace: S.str }), handler: async (input, ctx) => ({ result: await ctx.service.memoryIdentity({ namespace: optStr(input.namespace), principal: ctx.authenticatedPrincipal }) }) });
|
|
400
|
-
defineOperation({ name: "work_task", description: "Manage work task.", schema: strictSchema({ action: S.str, id: S.str, title: S.str, description: S.str, status: S.str, priority: S.str, owner: S.str, assignee: S.str, projectId: S.str, tags: S.strArr, dueAt: S.str }), handler: async (input, ctx) => ({ result: await ctx.service.workTask({ action: optStr(input.action) ?? "list", id: optStr(input.id), title: optStr(input.title), description: optStr(input.description), status: optStr(input.status), priority: optStr(input.priority), owner: optStr(input.owner), assignee: optStr(input.assignee), projectId: optStr(input.projectId), tags: optStrArr(input.tags), dueAt: optStr(input.dueAt) }) }) });
|
|
401
|
-
defineOperation({ name: "work_project", description: "Manage work project.", schema: strictSchema({ action: S.str, id: S.str, name: S.str, description: S.str, status: S.str, owner: S.str, tags: S.strArr, taskId: S.str, projectId: S.str }), handler: async (input, ctx) => ({ result: await ctx.service.workProject({ action: optStr(input.action) ?? "list", id: optStr(input.id), name: optStr(input.name), description: optStr(input.description), status: optStr(input.status), owner: optStr(input.owner), tags: optStrArr(input.tags), taskId: optStr(input.taskId), projectId: optStr(input.projectId) }) }) });
|
|
402
|
-
defineOperation({ name: "work_board", description: "Manage work board.", schema: strictSchema({ action: S.str, projectId: S.str, snapshotJson: S.str, linkToMemory: S.bool }), handler: async (input, ctx) => ({ result: await ctx.service.workBoard({ action: optStr(input.action) ?? "export_markdown", projectId: optStr(input.projectId) ?? "", snapshotJson: optStr(input.snapshotJson) ?? "", linkToMemory: input.linkToMemory === true }) }) });
|
|
403
|
+
defineOperation({ name: "work_task", description: "Manage work task.", fleetWide: true, schema: strictSchema({ action: S.str, id: S.str, title: S.str, description: S.str, status: S.str, priority: S.str, owner: S.str, assignee: S.str, projectId: S.str, tags: S.strArr, dueAt: S.str }), handler: async (input, ctx) => ({ result: await ctx.service.workTask({ action: optStr(input.action) ?? "list", id: optStr(input.id), title: optStr(input.title), description: optStr(input.description), status: optStr(input.status), priority: optStr(input.priority), owner: optStr(input.owner), assignee: optStr(input.assignee), projectId: optStr(input.projectId), tags: optStrArr(input.tags), dueAt: optStr(input.dueAt) }) }) });
|
|
404
|
+
defineOperation({ name: "work_project", description: "Manage work project.", fleetWide: true, schema: strictSchema({ action: S.str, id: S.str, name: S.str, description: S.str, status: S.str, owner: S.str, tags: S.strArr, taskId: S.str, projectId: S.str }), handler: async (input, ctx) => ({ result: await ctx.service.workProject({ action: optStr(input.action) ?? "list", id: optStr(input.id), name: optStr(input.name), description: optStr(input.description), status: optStr(input.status), owner: optStr(input.owner), tags: optStrArr(input.tags), taskId: optStr(input.taskId), projectId: optStr(input.projectId) }) }) });
|
|
405
|
+
defineOperation({ name: "work_board", description: "Manage work board.", fleetWide: true, schema: strictSchema({ action: S.str, projectId: S.str, snapshotJson: S.str, linkToMemory: S.bool }), handler: async (input, ctx) => ({ result: await ctx.service.workBoard({ action: optStr(input.action) ?? "export_markdown", projectId: optStr(input.projectId) ?? "", snapshotJson: optStr(input.snapshotJson) ?? "", linkToMemory: input.linkToMemory === true }) }) });
|
|
403
406
|
defineOperation({
|
|
404
407
|
name: "shared_context_write_output",
|
|
405
408
|
description: "Write shared output.",
|
|
@@ -529,31 +532,28 @@ defineOperation({ name: "profiling_report", description: "Profiling report.", sc
|
|
|
529
532
|
return { result: await ctx.service.profilingReport({ format: optStr(input.format), limit: optNum(input.limit) }) };
|
|
530
533
|
} });
|
|
531
534
|
defineOperation({ name: "live_connectors_run", description: "Run connectors.", fleetWide: true, schema: strictSchema({ force: S.bool }), handler: async (input, ctx) => ({ result: await ctx.service.liveConnectorsRun({ authenticatedPrincipal: ctx.authenticatedPrincipal, force: input.force === true }, ctx.authenticatedPrincipal) }) });
|
|
532
|
-
defineOperation({ name: "peer_list", description: "List peers.", schema: strictSchema({}), handler: async (_i, ctx) => ({ result: await ctx.service.peerList() }) });
|
|
533
|
-
defineOperation({ name: "peer_get", description: "Get peer.", schema: strictSchema({ id: S.str }), handler: async (input, ctx) => {
|
|
535
|
+
defineOperation({ name: "peer_list", description: "List peers.", fleetWide: true, schema: strictSchema({}), handler: async (_i, ctx) => ({ result: await ctx.service.peerList() }) });
|
|
536
|
+
defineOperation({ name: "peer_get", description: "Get peer.", fleetWide: true, schema: strictSchema({ id: S.str }), handler: async (input, ctx) => {
|
|
534
537
|
const id = defStr(input.id, "");
|
|
535
538
|
if (!id) throw new EngramAccessInputError("peer_get: id is required");
|
|
536
539
|
return { result: await ctx.service.peerGet(id) };
|
|
537
540
|
} });
|
|
538
|
-
defineOperation({ name: "peer_set", description: "Set peer.", schema: strictSchema({ id: S.str, kind: S.str, displayName: S.str, notes: S.str }), handler: async (input, ctx) => {
|
|
541
|
+
defineOperation({ name: "peer_set", description: "Set peer.", fleetWide: true, schema: strictSchema({ id: S.str, kind: S.str, displayName: S.str, notes: S.str }), handler: async (input, ctx) => {
|
|
539
542
|
const id = defStr(input.id, "");
|
|
540
543
|
if (!id) throw new EngramAccessInputError("peer_set: id is required");
|
|
541
|
-
if (input.kind !== void 0 && typeof input.kind !== "string") throw new EngramAccessInputError("peer_set: kind must be a string when provided");
|
|
542
|
-
if (input.displayName !== void 0 && typeof input.displayName !== "string") throw new EngramAccessInputError("peer_set: displayName must be a string when provided");
|
|
543
|
-
if (input.notes !== void 0 && typeof input.notes !== "string") throw new EngramAccessInputError("peer_set: notes must be a string when provided");
|
|
544
544
|
return { result: await ctx.service.peerSet({ id, kind: optStr(input.kind), displayName: optStr(input.displayName), notes: optStr(input.notes) }) };
|
|
545
545
|
} });
|
|
546
|
-
defineOperation({ name: "peer_delete", description: "Delete peer.", schema: strictSchema({ id: S.str }), handler: async (input, ctx) => {
|
|
546
|
+
defineOperation({ name: "peer_delete", description: "Delete peer.", fleetWide: true, schema: strictSchema({ id: S.str }), handler: async (input, ctx) => {
|
|
547
547
|
const id = defStr(input.id, "");
|
|
548
548
|
if (!id) throw new EngramAccessInputError("peer_delete: id is required");
|
|
549
549
|
return { result: await ctx.service.peerDelete(id) };
|
|
550
550
|
} });
|
|
551
|
-
defineOperation({ name: "peer_profile_get", description: "Get peer profile.", schema: strictSchema({ id: S.str }), handler: async (input, ctx) => {
|
|
551
|
+
defineOperation({ name: "peer_profile_get", description: "Get peer profile.", fleetWide: true, schema: strictSchema({ id: S.str }), handler: async (input, ctx) => {
|
|
552
552
|
const id = defStr(input.id, "");
|
|
553
553
|
if (!id) throw new EngramAccessInputError("peer_profile_get: id is required");
|
|
554
554
|
return { result: await ctx.service.peerProfileGet(id) };
|
|
555
555
|
} });
|
|
556
|
-
defineOperation({ name: "peer_forget", description: "Forget peer.", schema: strictSchema({ id: S.str, confirm: S.str }), handler: async (input, ctx) => {
|
|
556
|
+
defineOperation({ name: "peer_forget", description: "Forget peer.", fleetWide: true, schema: strictSchema({ id: S.str, confirm: S.str }), handler: async (input, ctx) => {
|
|
557
557
|
const id = defStr(input.id, "");
|
|
558
558
|
if (!id) throw new EngramAccessInputError("peer_forget: id is required");
|
|
559
559
|
const c = optStr(input.confirm) ?? "";
|
|
@@ -618,4 +618,4 @@ defineOperation({ name: "graph_events", description: "SSE graph events.", schema
|
|
|
618
618
|
defineOperation({ name: "chat_message", description: "Chat message.", schema: strictSchema({ message: S.str, chatSessionId: S.str }), handler: async (_i, _ctx) => ({ result: { ok: true } }) });
|
|
619
619
|
defineOperation({ name: "chat_events", description: "SSE chat events.", schema: strictSchema({}), handler: async (_i, _ctx) => ({ result: { stream: "sse" } }) });
|
|
620
620
|
defineOperation({ name: "adapters_status", description: "Adapter registry metadata (issue #1850 round 5). Marker op: the HTTP transport builds the response from its own adapterRegistry, but the op still must be registered so it appears in listRegisteredOperations and enforceTokenOp can gate it for scoped tokens.", schema: strictSchema({}), handler: async (_i, _ctx) => ({ result: { ok: true } }) });
|
|
621
|
-
//# sourceMappingURL=chunk-
|
|
621
|
+
//# sourceMappingURL=chunk-XU37EJTW.js.map
|