@remnic/core 10.0.12 → 10.0.14
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 +97 -95
- package/dist/access-authorization-probe.js +98 -96
- package/dist/access-boundary.js +97 -95
- package/dist/access-cli.js +201 -198
- package/dist/access-cli.js.map +1 -1
- package/dist/access-extraction-force-flush.js +97 -95
- package/dist/access-http-briefing.js +98 -96
- package/dist/access-http-query.js +99 -97
- package/dist/access-http.js +121 -119
- package/dist/access-idempotency.js +3 -2
- package/dist/access-identity-continuity-surface.js +97 -95
- package/dist/access-lcm-surface.js +97 -95
- package/dist/access-mcp.js +110 -108
- package/dist/access-memory-search-fanout.js +3 -3
- package/dist/access-namespace-preflight.js +97 -95
- package/dist/access-observe-write-category.js +18 -18
- package/dist/access-observe-write-surface.js +97 -95
- package/dist/access-offline-manifest.js +21 -20
- package/dist/access-operations-batch.js +101 -99
- package/dist/access-operations.js +108 -106
- package/dist/access-recall-concurrency.js +97 -95
- package/dist/access-recall-diagnostics.js +5 -5
- package/dist/access-recall-response.js +97 -95
- package/dist/access-recall-surface.js +97 -95
- package/dist/access-schema.d.ts +2 -2
- package/dist/access-schema.js +12 -12
- package/dist/access-service.js +97 -95
- package/dist/access-surface-catalog.js +99 -97
- package/dist/access-surface-catalog.js.map +1 -1
- package/dist/active-memory-bridge.js +3 -3
- package/dist/active-recall.js +42 -40
- package/dist/active-recall.js.map +1 -1
- package/dist/adapters/index.js +4 -4
- package/dist/adapters/registry.js +2 -2
- package/dist/{auto-sync-WSJAOLOP.js → auto-sync-7WWAKW6F.js} +12 -12
- package/dist/briefing.js +31 -29
- package/dist/buffer.js +17 -17
- package/dist/calibration.d.ts +20 -0
- package/dist/calibration.d.ts.map +1 -1
- package/dist/calibration.js +60 -13
- package/dist/calibration.js.map +1 -1
- package/dist/capabilities.d.ts +3 -2
- package/dist/capabilities.d.ts.map +1 -1
- package/dist/capabilities.js +1 -1
- package/dist/{capsule-merge-M4HETD27.js → capsule-merge-LGYURS3C.js} +6 -5
- package/dist/{capsule-merge-M4HETD27.js.map → capsule-merge-LGYURS3C.js.map} +1 -1
- package/dist/capture-write-lock-backoff.d.ts +50 -0
- package/dist/capture-write-lock-backoff.d.ts.map +1 -0
- package/dist/capture-write-lock-backoff.js +30 -0
- package/dist/capture-write-lock.d.ts +6 -0
- package/dist/capture-write-lock.d.ts.map +1 -0
- package/dist/capture-write-lock.js +15 -0
- package/dist/causal-behavior.js +2 -2
- package/dist/causal-chain.js +2 -2
- package/dist/causal-consolidation.js +34 -32
- package/dist/causal-consolidation.js.map +1 -1
- package/dist/causal-retrieval.js +2 -2
- package/dist/causal-trajectory-graph.js +7 -6
- package/dist/causal-trajectory-graph.js.map +1 -1
- package/dist/causal-trajectory.js +1 -1
- package/dist/{chunk-RNPJ4GQA.js → chunk-22W2XWGH.js} +6 -6
- package/dist/{chunk-AV2OQF2O.js → chunk-3F3HA3R2.js} +2 -2
- package/dist/{chunk-QZZPUREO.js → chunk-3GYSZHMT.js} +3 -3
- package/dist/{chunk-QWWMS4AE.js → chunk-3MO4LWYU.js} +1 -1
- package/dist/chunk-3MO4LWYU.js.map +1 -0
- package/dist/{chunk-XYOT5GQU.js → chunk-3NF4QUNZ.js} +3 -3
- package/dist/{chunk-AL6EHLB5.js → chunk-3X3PNU3T.js} +2 -2
- package/dist/{chunk-BTJ6CAIA.js → chunk-4IYIGN53.js} +10 -10
- package/dist/{chunk-OM3RWZQK.js → chunk-4KY5GSMB.js} +2 -2
- package/dist/{chunk-4N2MFNTG.js → chunk-4OSG5Y6M.js} +2 -2
- package/dist/{chunk-EEDI3OXB.js → chunk-4Q26RNSR.js} +2 -2
- package/dist/{chunk-EHRE7ZG3.js → chunk-5B5WYAHQ.js} +2 -2
- package/dist/{chunk-WCGJK4NQ.js → chunk-5FNZ3G6X.js} +10 -10
- package/dist/{chunk-Y6DZ33PA.js → chunk-5GX5457J.js} +4 -4
- package/dist/{chunk-OFCHT2TN.js → chunk-5LRV557D.js} +2 -2
- package/dist/{chunk-VAOC6GHN.js → chunk-5PHOU5QI.js} +2 -2
- package/dist/{chunk-WL7N5VGG.js → chunk-5TJEOU6Y.js} +2 -2
- package/dist/{chunk-A2L3P2IY.js → chunk-5WCJLQTM.js} +2 -2
- package/dist/{chunk-MZBWIJJN.js → chunk-63B2IZYE.js} +19 -19
- package/dist/{chunk-DGRMWDQY.js → chunk-66BCOVW2.js} +7 -7
- package/dist/chunk-6EDW54SQ.js +298 -0
- package/dist/chunk-6EDW54SQ.js.map +1 -0
- package/dist/{chunk-P2S6P7X6.js → chunk-6LG7BWKW.js} +2 -2
- package/dist/chunk-77R7BQZ2.js +152 -0
- package/dist/chunk-77R7BQZ2.js.map +1 -0
- package/dist/{chunk-4G2YCKLT.js → chunk-7G5NTS7F.js} +2 -2
- package/dist/{chunk-IPLYGWQF.js → chunk-7LCGFUMB.js} +6 -6
- package/dist/{chunk-KYY4EACB.js → chunk-7Z3DLNSD.js} +2 -2
- package/dist/{chunk-LNH76ZJX.js → chunk-AIYXVWUH.js} +27 -2
- package/dist/{chunk-LNH76ZJX.js.map → chunk-AIYXVWUH.js.map} +1 -1
- package/dist/{chunk-7SUWY37K.js → chunk-B665A6BO.js} +2 -2
- package/dist/{chunk-AEGNDL24.js → chunk-BVRZSI7Q.js} +2 -2
- package/dist/{chunk-2EMROIXS.js → chunk-C5LWPYS3.js} +2 -1
- package/dist/{chunk-2EMROIXS.js.map → chunk-C5LWPYS3.js.map} +1 -1
- package/dist/{chunk-KJOGIRMF.js → chunk-CB6ANA2I.js} +2 -2
- package/dist/{chunk-5JMI26Q7.js → chunk-CBH2Z4UA.js} +2 -2
- package/dist/{chunk-YRH3C2OJ.js → chunk-CIIHIAJ2.js} +13 -5
- package/dist/chunk-CIIHIAJ2.js.map +1 -0
- package/dist/{chunk-W4RLOZOG.js → chunk-CJRENHVZ.js} +4 -4
- package/dist/{chunk-LOFVW6JA.js → chunk-CLWBFR7Q.js} +6 -6
- package/dist/{chunk-375ARKRS.js → chunk-D5SSBCYY.js} +70 -59
- package/dist/chunk-D5SSBCYY.js.map +1 -0
- package/dist/{chunk-KI6UOSNR.js → chunk-DEY7B77Y.js} +2 -2
- package/dist/chunk-DEY7B77Y.js.map +1 -0
- package/dist/{chunk-6VAHJ2F6.js → chunk-DMDWFQMR.js} +2 -2
- package/dist/{chunk-MO25AN7J.js → chunk-DPR2WTN3.js} +22 -22
- package/dist/{chunk-JXSYWTFK.js → chunk-DYJHGJZ4.js} +2 -2
- package/dist/{chunk-5X4ZJESN.js → chunk-EH4BQ7LT.js} +3 -3
- package/dist/chunk-EHHQJTAU.js +131 -0
- package/dist/chunk-EHHQJTAU.js.map +1 -0
- package/dist/{chunk-JXWTPOMJ.js → chunk-EPJDSQHF.js} +2 -2
- package/dist/{chunk-OEIA4IHU.js → chunk-ESG6ITGP.js} +2 -2
- package/dist/{chunk-7XI2UJHL.js → chunk-ETZUIRCI.js} +4 -4
- package/dist/{chunk-PPIASWWR.js → chunk-EU534WGS.js} +2 -2
- package/dist/{chunk-XLIK2VDE.js → chunk-EU6IRUCY.js} +7 -5
- package/dist/{chunk-XLIK2VDE.js.map → chunk-EU6IRUCY.js.map} +1 -1
- package/dist/{chunk-J7MDPTX7.js → chunk-EUAIYYYR.js} +190 -44
- package/dist/chunk-EUAIYYYR.js.map +1 -0
- package/dist/{chunk-E6KXJSMA.js → chunk-EUCYTCFP.js} +3 -3
- package/dist/{chunk-YNDLCWXS.js → chunk-EZ25VE3G.js} +4 -4
- package/dist/{chunk-6OAXWYE3.js → chunk-FFOVKNQV.js} +2 -2
- package/dist/{chunk-2KRNPFPK.js → chunk-FLI6DEIU.js} +2 -2
- package/dist/{chunk-4G4B3Z2B.js → chunk-FP4JYE66.js} +2 -2
- package/dist/{chunk-PDVWGGX4.js → chunk-FSIMZNBC.js} +2 -2
- package/dist/{chunk-OAIWPB2I.js → chunk-FT4UQYOV.js} +2 -2
- package/dist/{chunk-D5UPBXZM.js → chunk-FUFAXVBA.js} +4 -4
- package/dist/{chunk-GKOML66M.js → chunk-G2OYFTUD.js} +5 -5
- package/dist/{chunk-XTN54NML.js → chunk-G3T6YMBO.js} +4 -4
- package/dist/{chunk-KWVI52ER.js → chunk-GELS5Z5Z.js} +4 -4
- package/dist/{chunk-J6FFBORM.js → chunk-GH7AOMJD.js} +2 -2
- package/dist/{chunk-TCYLCPC6.js → chunk-GKJJNO7C.js} +3 -3
- package/dist/{chunk-N75Q5ZSP.js → chunk-GMXWTJNU.js} +2 -2
- package/dist/{chunk-B657ZGDH.js → chunk-HQSK2INQ.js} +2 -2
- package/dist/{chunk-SQA2MM2F.js → chunk-I7S55EOB.js} +2 -2
- package/dist/{chunk-CAUNCRLQ.js → chunk-J7JWFZHI.js} +108 -108
- package/dist/{chunk-NQMG2W5L.js → chunk-JDZFIR2S.js} +2 -2
- package/dist/{chunk-O52WWLKU.js → chunk-JIHMUOOS.js} +5 -5
- package/dist/{chunk-YYO447A7.js → chunk-JNIVZNIB.js} +41 -253
- package/dist/chunk-JNIVZNIB.js.map +1 -0
- package/dist/{chunk-VUQDJ3JB.js → chunk-JPTPS4OB.js} +6 -6
- package/dist/{chunk-WXFKXCOQ.js → chunk-JQ7XU625.js} +10 -10
- package/dist/{chunk-3I3U6FFT.js → chunk-K7BN34IA.js} +2 -2
- package/dist/{chunk-7OAIOE5P.js → chunk-KH2LKDX7.js} +2 -2
- package/dist/{chunk-VDXTXVFZ.js → chunk-KR6ZKECI.js} +5 -5
- package/dist/{chunk-MK552I5J.js → chunk-L5DAHSEZ.js} +4 -4
- package/dist/{chunk-XQIHFXYP.js → chunk-LCKVXX5F.js} +2 -2
- package/dist/{chunk-ZI7LMSNI.js → chunk-LLHZZOIB.js} +2 -2
- package/dist/{chunk-E57LYSHI.js → chunk-LZACDIM2.js} +2 -2
- package/dist/{chunk-QAIKLICT.js → chunk-M7KGIW5F.js} +2 -2
- package/dist/{chunk-55ZVZBX4.js → chunk-MATDGSJ7.js} +4 -4
- package/dist/{chunk-3NFN4Y4P.js → chunk-MGCKZWAE.js} +5 -5
- package/dist/{chunk-YS7SA4HD.js → chunk-ML7ZJAKJ.js} +4 -4
- package/dist/{chunk-YDH2FSDI.js → chunk-N45NEBOD.js} +2 -2
- package/dist/{chunk-7UX44C4N.js → chunk-N4C7QKOG.js} +3 -3
- package/dist/{chunk-YYNHJF3N.js → chunk-N7KYEVLK.js} +2 -2
- package/dist/{chunk-HT2C4EXO.js → chunk-NIRQGDYC.js} +4 -4
- package/dist/{chunk-DXHVD4DS.js → chunk-NW2E4CI2.js} +3 -3
- package/dist/{chunk-BFIZXFUG.js → chunk-NWIT3U2N.js} +2 -2
- package/dist/{chunk-4NDWE44P.js → chunk-NZFFGO5O.js} +2 -2
- package/dist/{chunk-MB5EJ2CT.js → chunk-O2IPAX26.js} +10 -10
- package/dist/{chunk-UOA2VQ7C.js → chunk-O4SGYW7H.js} +2 -2
- package/dist/{chunk-SSAXGPXY.js → chunk-OP6N4H6A.js} +2 -2
- package/dist/{chunk-ZSJGYC3C.js → chunk-OQJKY3Z5.js} +2 -2
- package/dist/{chunk-OFEHITAZ.js → chunk-OXNTOHL6.js} +2 -2
- package/dist/{chunk-CDWFWOSZ.js → chunk-P4JED3ZL.js} +2 -2
- package/dist/{chunk-FQD2KPQH.js → chunk-P55FACBG.js} +2 -2
- package/dist/{chunk-KX36OCGK.js → chunk-P5NQN4JE.js} +3 -3
- package/dist/{chunk-3ZCRHW7U.js → chunk-P7TOIOT7.js} +2 -2
- package/dist/{chunk-BD5QEP3T.js → chunk-PAZ35RJ4.js} +45 -32
- package/dist/chunk-PAZ35RJ4.js.map +1 -0
- package/dist/chunk-PGRZ3FYC.js +34 -0
- package/dist/chunk-PGRZ3FYC.js.map +1 -0
- package/dist/{chunk-PBVNVKYN.js → chunk-PIN5OPBA.js} +2 -2
- package/dist/{chunk-O6YDGTH4.js → chunk-PZHQWFR3.js} +3 -3
- package/dist/{chunk-SVDU4OHO.js → chunk-Q35L7TYB.js} +2 -2
- package/dist/{chunk-SOJ3IQD3.js → chunk-QODKDRSP.js} +6 -6
- package/dist/{chunk-VJGDQA3D.js → chunk-QOZJCSFO.js} +3 -3
- package/dist/{chunk-6T42L5FI.js → chunk-QS3OLP5I.js} +2 -2
- package/dist/{chunk-PAAJWQH5.js → chunk-QUMKDRCF.js} +2 -2
- package/dist/{chunk-4TP3MJ3D.js → chunk-QX6JN3O4.js} +7 -7
- package/dist/{chunk-KZEMFD6E.js → chunk-R2H4ZFBJ.js} +3 -3
- package/dist/{chunk-N6UMXWBA.js → chunk-RTKV5XHL.js} +4 -4
- package/dist/{chunk-ZQ3WU6JO.js → chunk-RXFCU3CY.js} +2 -2
- package/dist/{chunk-BOOFTFFE.js → chunk-S2I7DL5Q.js} +1 -1
- package/dist/{chunk-2NCBDGND.js → chunk-SA6GMZJY.js} +3 -3
- package/dist/{chunk-2AFHZTPI.js → chunk-SIIRTDJ4.js} +3 -3
- package/dist/{chunk-WH4QXVKU.js → chunk-SS3IS2JR.js} +3 -3
- package/dist/{chunk-VFTK5WKI.js → chunk-STBX5X6B.js} +2 -2
- package/dist/{chunk-WVHRNAXL.js → chunk-SWWHIJUJ.js} +2 -2
- package/dist/{chunk-WADSXS4K.js → chunk-SX4QDWXK.js} +2 -2
- package/dist/{chunk-2U4BM3TW.js → chunk-TITG2NBS.js} +2 -2
- package/dist/{chunk-A5ZYP4K5.js → chunk-TNRCDMQT.js} +2 -2
- package/dist/{chunk-LZKOVXMX.js → chunk-TRMJ6BYC.js} +2 -2
- package/dist/{chunk-VA2HNBGQ.js → chunk-TZNDKTX5.js} +69 -69
- package/dist/{chunk-OFDIGTC2.js → chunk-UMTCNEVQ.js} +17 -17
- package/dist/{chunk-L3G5CGL5.js → chunk-UQDG3YLN.js} +68 -24
- package/dist/chunk-UQDG3YLN.js.map +1 -0
- package/dist/{chunk-AAM66QCP.js → chunk-UZRSI6NX.js} +2 -2
- package/dist/{chunk-2CXQZXWM.js → chunk-V4MB5ONM.js} +6 -6
- package/dist/{chunk-5BUCKFRE.js → chunk-VOKHZRHW.js} +2 -2
- package/dist/{chunk-CYEK6Z3P.js → chunk-VW6VIJOS.js} +2 -2
- package/dist/{chunk-I2M4ZVDD.js → chunk-W47S5TIH.js} +9 -9
- package/dist/{chunk-CBP4HWCL.js → chunk-W5MCEVUS.js} +3 -3
- package/dist/{chunk-E5H4TM4Y.js → chunk-WC3V7HHP.js} +3 -3
- package/dist/{chunk-WCTL3PVM.js → chunk-WLMZ2L5P.js} +2 -2
- package/dist/{chunk-SQ2O52SU.js → chunk-WSGPFRBH.js} +10 -10
- package/dist/{chunk-BH44JOLA.js → chunk-WVADKFWV.js} +3 -3
- package/dist/{chunk-JVNEXW6X.js → chunk-XISROV24.js} +2 -2
- package/dist/{chunk-FZVROZKC.js → chunk-XVZA6VXC.js} +4 -4
- package/dist/{chunk-56GJLXBA.js → chunk-Y4NKEXQT.js} +4 -4
- package/dist/{chunk-EKKAHJ4B.js → chunk-YE36AJL7.js} +4 -4
- package/dist/chunk-YET735EZ.js +99 -0
- package/dist/chunk-YET735EZ.js.map +1 -0
- package/dist/{chunk-OGWEWJRH.js → chunk-YFMBHQRG.js} +2 -2
- package/dist/{chunk-JLIGUFPF.js → chunk-YN2DQ2D6.js} +2 -2
- package/dist/{chunk-RBJQYMMT.js → chunk-YRULQW5J.js} +4 -4
- package/dist/{chunk-UCJINCZT.js → chunk-YUZRI3QU.js} +2 -2
- package/dist/{chunk-QUNDYIYZ.js → chunk-YYEOR4XN.js} +3 -3
- package/dist/{chunk-O5MW6CQL.js → chunk-ZJVMUBYF.js} +2 -2
- package/dist/{chunk-VBJD4RSJ.js → chunk-ZSH2NRDV.js} +2 -2
- package/dist/{chunk-BX4WDBTE.js → chunk-ZV65I6ME.js} +78 -78
- package/dist/cli.js +150 -148
- package/dist/coding/export-okf-codegraph.js +31 -29
- package/dist/coding/export-okf-codegraph.js.map +1 -1
- package/dist/coding/pre-action-gate.js +2 -2
- package/dist/compounding/engine.d.ts +15 -11
- package/dist/compounding/engine.d.ts.map +1 -1
- package/dist/compounding/engine.js +34 -32
- package/dist/compounding/iso-week.d.ts +2 -0
- package/dist/compounding/iso-week.d.ts.map +1 -1
- package/dist/compounding/weekly-scheduler.d.ts +81 -0
- package/dist/compounding/weekly-scheduler.d.ts.map +1 -0
- package/dist/compounding/weekly-synthesis-queue.d.ts +9 -0
- package/dist/compounding/weekly-synthesis-queue.d.ts.map +1 -0
- package/dist/config.js +42 -40
- package/dist/connectors/codex-materialize-runner.js +31 -29
- package/dist/connectors/index.js +32 -30
- package/dist/console/trace.d.ts +5 -14
- package/dist/console/trace.d.ts.map +1 -1
- package/dist/consolidation-provenance-check.js +7 -6
- package/dist/consolidation-undo.js +5 -4
- package/dist/consolidation-undo.js.map +1 -1
- package/dist/contradiction/index.js +9 -8
- package/dist/{contradiction-scan-GGRTVB7C.js → contradiction-scan-P7KXB5R4.js} +3 -3
- package/dist/converge-config.d.ts +2 -0
- package/dist/converge-config.d.ts.map +1 -1
- package/dist/converge-config.js +7 -3
- package/dist/convergence-refresh.js +33 -31
- package/dist/corpus-watermark.js +33 -31
- package/dist/dashboard-runtime.js +2 -2
- package/dist/day-summary.js +2 -2
- package/dist/deep-recall-http-glue.js +13 -13
- package/dist/deep-recall.js +2 -2
- package/dist/embedding-fallback.js +6 -5
- package/dist/embedding-generation-lock.js +4 -3
- package/dist/entity-retrieval.js +32 -30
- package/dist/explicit-capture.js +12 -9
- package/dist/external-wiki-access.js +98 -96
- package/dist/extraction-judge.js +3 -3
- package/dist/extraction-normalization.js +3 -3
- package/dist/extraction-prompt.js +2 -2
- package/dist/extraction-quote-grounding.d.ts +67 -0
- package/dist/extraction-quote-grounding.d.ts.map +1 -0
- package/dist/extraction-quote-grounding.js +27 -0
- package/dist/extraction-quote-grounding.js.map +1 -0
- package/dist/extraction-source-grounding-helpers.d.ts +8 -0
- package/dist/extraction-source-grounding-helpers.d.ts.map +1 -1
- package/dist/extraction-source-grounding-helpers.js +11 -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 +3 -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 +4 -3
- package/dist/extraction-span-materialize.js +2 -2
- package/dist/extraction.js +50 -47
- package/dist/{first-start-migration-OM3PHMZO.js → first-start-migration-6A5BJPDW.js} +5 -5
- package/dist/{forget-OHAJ6PSU.js → forget-GXBWFKRC.js} +5 -4
- package/dist/{forget-OHAJ6PSU.js.map → forget-GXBWFKRC.js.map} +1 -1
- package/dist/{graph-edge-decay-CZ3SYLM4.js → graph-edge-decay-BYPZVJT4.js} +10 -9
- package/dist/graph-edge-decay-BYPZVJT4.js.map +1 -0
- package/dist/graph-jsonl.js +8 -7
- package/dist/graph-snapshot.js +8 -7
- package/dist/graph-write-lock.js +4 -3
- package/dist/graph.js +9 -8
- package/dist/harmonic-retrieval.js +31 -29
- package/dist/http-retry.js +2 -1
- package/dist/http-retry.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +241 -236
- package/dist/lcm/engine.js +4 -4
- package/dist/lcm/index.js +12 -12
- package/dist/local-llm.js +2 -2
- package/dist/location/index.js +34 -32
- package/dist/maintenance/memory-governance.js +31 -29
- package/dist/maintenance/rebuild-memory-lifecycle-ledger.js +31 -29
- package/dist/maintenance/rebuild-memory-projection-runner.js +33 -31
- package/dist/maintenance/rebuild-memory-projection.js +32 -30
- package/dist/memory-browse-operations.js +98 -96
- package/dist/memory-browse.js +7 -7
- package/dist/memory-subject.js +5 -4
- package/dist/namespaces/migrate.js +32 -30
- package/dist/namespaces/principal.js +2 -2
- package/dist/namespaces/search.js +10 -10
- package/dist/namespaces/storage.js +31 -29
- package/dist/offline-sync-changeset-generations.js +7 -6
- package/dist/offline-sync-embedding-generation.js +6 -5
- package/dist/offline-sync-impression-drain.js +8 -8
- package/dist/offline-sync-snapshot-stream.js +9 -9
- package/dist/offline-sync.js +10 -10
- package/dist/operator-doctor-corpus.js +34 -32
- package/dist/operator-toolkit.js +59 -57
- package/dist/orchestration/compression-guideline-coordinator.js +2 -2
- package/dist/orchestration/maintenance.d.ts +2 -0
- package/dist/orchestration/maintenance.d.ts.map +1 -1
- package/dist/orchestration/maintenance.js +49 -43
- package/dist/orchestrator.js +203 -200
- package/dist/page-versioning.js +5 -4
- package/dist/qmd-daemon-session.js +2 -2
- package/dist/qmd.js +4 -4
- package/dist/recall-explain-renderer.js +3 -3
- package/dist/recall-navigate-access.js +2 -2
- package/dist/recall-navigate-disclosure.js +2 -2
- package/dist/recall-navigate.js +2 -2
- package/dist/recall-navigation-operations.js +98 -96
- package/dist/recall-navigation.js +97 -95
- package/dist/recall-state-view-admission.js +7 -7
- package/dist/recall-state.js +4 -3
- package/dist/recall-why-service.js +11 -11
- package/dist/recall-why.js +3 -3
- package/dist/recall-xray-cli.js +4 -4
- package/dist/recall-xray-renderer.js +3 -3
- package/dist/recall-xray.js +2 -2
- package/dist/reconcile/cursor.js +4 -2
- package/dist/reconcile/cursor.js.map +1 -1
- package/dist/reconcile/manifest.js +9 -6
- package/dist/reconcile/plan.js +4 -2
- package/dist/rerank-outcome.js +2 -2
- package/dist/{resolution-E4GLHLY6.js → resolution-7AY36LGJ.js} +10 -9
- package/dist/resolution-7AY36LGJ.js.map +1 -0
- package/dist/resume-bundles.js +43 -41
- package/dist/salvage-envelope.js +7 -6
- package/dist/search/embed-helper.js +2 -2
- package/dist/search/factory.js +9 -9
- package/dist/search/index.js +15 -15
- package/dist/semantic-consolidation.js +36 -34
- package/dist/semantic-rule-promotion.js +31 -29
- package/dist/semantic-rule-verifier.js +31 -29
- package/dist/shared-context/manager.js +2 -2
- package/dist/source-agent-qualifier.js +43 -40
- package/dist/standup/build.js +31 -29
- package/dist/storage/content-hash-index.d.ts +10 -0
- package/dist/storage/content-hash-index.d.ts.map +1 -1
- package/dist/storage/tombstone-blocked-capture-index.d.ts +3 -0
- package/dist/storage/tombstone-blocked-capture-index.d.ts.map +1 -1
- package/dist/storage/tombstone-blocked-capture-mutation.d.ts +23 -3
- package/dist/storage/tombstone-blocked-capture-mutation.d.ts.map +1 -1
- package/dist/storage.d.ts +6 -0
- package/dist/storage.d.ts.map +1 -1
- package/dist/storage.js +32 -30
- package/dist/subject-config.js +6 -5
- package/dist/summarizer.js +6 -6
- package/dist/summary-snapshot.js +4 -3
- package/dist/support-passport/index.js +100 -98
- package/dist/{tier-stats-M2FMMD2N.js → tier-stats-RQM76XYY.js} +2 -2
- package/dist/{trace-LXXCMZJA.js → trace-QBQVS5BC.js} +5 -21
- package/dist/trace-QBQVS5BC.js.map +1 -0
- package/dist/transfer/autodetect.js +1 -1
- package/dist/transfer/backup.js +1 -1
- package/dist/transfer/capsule-export.js +3 -3
- package/dist/transfer/capsule-import.js +7 -6
- package/dist/transfer/export-okf.js +31 -29
- package/dist/types.d.ts +9 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +1 -1
- package/dist/utils/serialize-mutations.js +3 -2
- package/dist/utils/sleep.d.ts +6 -0
- package/dist/utils/sleep.d.ts.map +1 -1
- package/dist/verified-recall.js +31 -29
- package/dist/who-knows-cli.js +32 -30
- package/dist/who-knows.js +31 -29
- package/dist/write-envelope.js +6 -5
- package/package.json +22 -2
- package/src/calibration.test.ts +80 -1
- package/src/calibration.ts +77 -8
- package/src/capabilities.test.ts +1 -0
- package/src/capabilities.ts +4 -4
- package/src/capture-write-lock-backoff.test.ts +534 -0
- package/src/capture-write-lock-backoff.ts +140 -0
- package/src/capture-write-lock.ts +8 -0
- package/src/compounding/engine.ts +32 -31
- package/src/compounding/iso-week.ts +16 -0
- package/src/compounding/weekly-scheduler.test.ts +426 -0
- package/src/compounding/weekly-scheduler.ts +231 -0
- package/src/compounding/weekly-synthesis-queue.ts +23 -0
- package/src/console/trace.ts +5 -36
- package/src/converge-config.ts +80 -1
- package/src/extraction-quote-grounding.test.ts +546 -0
- package/src/extraction-quote-grounding.ts +232 -0
- package/src/extraction-source-grounding-helpers.ts +35 -0
- package/src/extraction-source-grounding-rules.ts +90 -65
- package/src/extraction-source-grounding.ts +11 -2
- package/src/index.ts +1 -1
- package/src/orchestration/maintenance.ts +6 -2
- package/src/providers/codex-subscription.test.ts +15 -3
- package/src/storage/content-hash-index.ts +10 -0
- package/src/storage/tombstone-blocked-capture-index.ts +8 -1
- package/src/storage/tombstone-blocked-capture-mutation.ts +133 -43
- package/src/storage.ts +13 -0
- package/src/types.ts +9 -0
- package/src/utils/sleep.ts +28 -0
- package/dist/chunk-375ARKRS.js.map +0 -1
- package/dist/chunk-6MINUTGJ.js +0 -64
- package/dist/chunk-6MINUTGJ.js.map +0 -1
- package/dist/chunk-7LEQREP2.js +0 -9
- package/dist/chunk-7LEQREP2.js.map +0 -1
- package/dist/chunk-BD5QEP3T.js.map +0 -1
- package/dist/chunk-J7MDPTX7.js.map +0 -1
- package/dist/chunk-KI6UOSNR.js.map +0 -1
- package/dist/chunk-L3G5CGL5.js.map +0 -1
- package/dist/chunk-QWWMS4AE.js.map +0 -1
- package/dist/chunk-YRH3C2OJ.js.map +0 -1
- package/dist/chunk-YYO447A7.js.map +0 -1
- package/dist/trace-LXXCMZJA.js.map +0 -1
- /package/dist/{auto-sync-WSJAOLOP.js.map → auto-sync-7WWAKW6F.js.map} +0 -0
- /package/dist/{contradiction-scan-GGRTVB7C.js.map → capture-write-lock-backoff.js.map} +0 -0
- /package/dist/{graph-edge-decay-CZ3SYLM4.js.map → capture-write-lock.js.map} +0 -0
- /package/dist/{chunk-RNPJ4GQA.js.map → chunk-22W2XWGH.js.map} +0 -0
- /package/dist/{chunk-AV2OQF2O.js.map → chunk-3F3HA3R2.js.map} +0 -0
- /package/dist/{chunk-QZZPUREO.js.map → chunk-3GYSZHMT.js.map} +0 -0
- /package/dist/{chunk-XYOT5GQU.js.map → chunk-3NF4QUNZ.js.map} +0 -0
- /package/dist/{chunk-AL6EHLB5.js.map → chunk-3X3PNU3T.js.map} +0 -0
- /package/dist/{chunk-BTJ6CAIA.js.map → chunk-4IYIGN53.js.map} +0 -0
- /package/dist/{chunk-OM3RWZQK.js.map → chunk-4KY5GSMB.js.map} +0 -0
- /package/dist/{chunk-4N2MFNTG.js.map → chunk-4OSG5Y6M.js.map} +0 -0
- /package/dist/{chunk-EEDI3OXB.js.map → chunk-4Q26RNSR.js.map} +0 -0
- /package/dist/{chunk-EHRE7ZG3.js.map → chunk-5B5WYAHQ.js.map} +0 -0
- /package/dist/{chunk-WCGJK4NQ.js.map → chunk-5FNZ3G6X.js.map} +0 -0
- /package/dist/{chunk-Y6DZ33PA.js.map → chunk-5GX5457J.js.map} +0 -0
- /package/dist/{chunk-OFCHT2TN.js.map → chunk-5LRV557D.js.map} +0 -0
- /package/dist/{chunk-VAOC6GHN.js.map → chunk-5PHOU5QI.js.map} +0 -0
- /package/dist/{chunk-WL7N5VGG.js.map → chunk-5TJEOU6Y.js.map} +0 -0
- /package/dist/{chunk-A2L3P2IY.js.map → chunk-5WCJLQTM.js.map} +0 -0
- /package/dist/{chunk-MZBWIJJN.js.map → chunk-63B2IZYE.js.map} +0 -0
- /package/dist/{chunk-DGRMWDQY.js.map → chunk-66BCOVW2.js.map} +0 -0
- /package/dist/{chunk-P2S6P7X6.js.map → chunk-6LG7BWKW.js.map} +0 -0
- /package/dist/{chunk-4G2YCKLT.js.map → chunk-7G5NTS7F.js.map} +0 -0
- /package/dist/{chunk-IPLYGWQF.js.map → chunk-7LCGFUMB.js.map} +0 -0
- /package/dist/{chunk-KYY4EACB.js.map → chunk-7Z3DLNSD.js.map} +0 -0
- /package/dist/{chunk-7SUWY37K.js.map → chunk-B665A6BO.js.map} +0 -0
- /package/dist/{chunk-AEGNDL24.js.map → chunk-BVRZSI7Q.js.map} +0 -0
- /package/dist/{chunk-KJOGIRMF.js.map → chunk-CB6ANA2I.js.map} +0 -0
- /package/dist/{chunk-5JMI26Q7.js.map → chunk-CBH2Z4UA.js.map} +0 -0
- /package/dist/{chunk-W4RLOZOG.js.map → chunk-CJRENHVZ.js.map} +0 -0
- /package/dist/{chunk-LOFVW6JA.js.map → chunk-CLWBFR7Q.js.map} +0 -0
- /package/dist/{chunk-6VAHJ2F6.js.map → chunk-DMDWFQMR.js.map} +0 -0
- /package/dist/{chunk-MO25AN7J.js.map → chunk-DPR2WTN3.js.map} +0 -0
- /package/dist/{chunk-JXSYWTFK.js.map → chunk-DYJHGJZ4.js.map} +0 -0
- /package/dist/{chunk-5X4ZJESN.js.map → chunk-EH4BQ7LT.js.map} +0 -0
- /package/dist/{chunk-JXWTPOMJ.js.map → chunk-EPJDSQHF.js.map} +0 -0
- /package/dist/{chunk-OEIA4IHU.js.map → chunk-ESG6ITGP.js.map} +0 -0
- /package/dist/{chunk-7XI2UJHL.js.map → chunk-ETZUIRCI.js.map} +0 -0
- /package/dist/{chunk-PPIASWWR.js.map → chunk-EU534WGS.js.map} +0 -0
- /package/dist/{chunk-E6KXJSMA.js.map → chunk-EUCYTCFP.js.map} +0 -0
- /package/dist/{chunk-YNDLCWXS.js.map → chunk-EZ25VE3G.js.map} +0 -0
- /package/dist/{chunk-6OAXWYE3.js.map → chunk-FFOVKNQV.js.map} +0 -0
- /package/dist/{chunk-2KRNPFPK.js.map → chunk-FLI6DEIU.js.map} +0 -0
- /package/dist/{chunk-4G4B3Z2B.js.map → chunk-FP4JYE66.js.map} +0 -0
- /package/dist/{chunk-PDVWGGX4.js.map → chunk-FSIMZNBC.js.map} +0 -0
- /package/dist/{chunk-OAIWPB2I.js.map → chunk-FT4UQYOV.js.map} +0 -0
- /package/dist/{chunk-D5UPBXZM.js.map → chunk-FUFAXVBA.js.map} +0 -0
- /package/dist/{chunk-GKOML66M.js.map → chunk-G2OYFTUD.js.map} +0 -0
- /package/dist/{chunk-XTN54NML.js.map → chunk-G3T6YMBO.js.map} +0 -0
- /package/dist/{chunk-KWVI52ER.js.map → chunk-GELS5Z5Z.js.map} +0 -0
- /package/dist/{chunk-J6FFBORM.js.map → chunk-GH7AOMJD.js.map} +0 -0
- /package/dist/{chunk-TCYLCPC6.js.map → chunk-GKJJNO7C.js.map} +0 -0
- /package/dist/{chunk-N75Q5ZSP.js.map → chunk-GMXWTJNU.js.map} +0 -0
- /package/dist/{chunk-B657ZGDH.js.map → chunk-HQSK2INQ.js.map} +0 -0
- /package/dist/{chunk-SQA2MM2F.js.map → chunk-I7S55EOB.js.map} +0 -0
- /package/dist/{chunk-CAUNCRLQ.js.map → chunk-J7JWFZHI.js.map} +0 -0
- /package/dist/{chunk-NQMG2W5L.js.map → chunk-JDZFIR2S.js.map} +0 -0
- /package/dist/{chunk-O52WWLKU.js.map → chunk-JIHMUOOS.js.map} +0 -0
- /package/dist/{chunk-VUQDJ3JB.js.map → chunk-JPTPS4OB.js.map} +0 -0
- /package/dist/{chunk-WXFKXCOQ.js.map → chunk-JQ7XU625.js.map} +0 -0
- /package/dist/{chunk-3I3U6FFT.js.map → chunk-K7BN34IA.js.map} +0 -0
- /package/dist/{chunk-7OAIOE5P.js.map → chunk-KH2LKDX7.js.map} +0 -0
- /package/dist/{chunk-VDXTXVFZ.js.map → chunk-KR6ZKECI.js.map} +0 -0
- /package/dist/{chunk-MK552I5J.js.map → chunk-L5DAHSEZ.js.map} +0 -0
- /package/dist/{chunk-XQIHFXYP.js.map → chunk-LCKVXX5F.js.map} +0 -0
- /package/dist/{chunk-ZI7LMSNI.js.map → chunk-LLHZZOIB.js.map} +0 -0
- /package/dist/{chunk-E57LYSHI.js.map → chunk-LZACDIM2.js.map} +0 -0
- /package/dist/{chunk-QAIKLICT.js.map → chunk-M7KGIW5F.js.map} +0 -0
- /package/dist/{chunk-55ZVZBX4.js.map → chunk-MATDGSJ7.js.map} +0 -0
- /package/dist/{chunk-3NFN4Y4P.js.map → chunk-MGCKZWAE.js.map} +0 -0
- /package/dist/{chunk-YS7SA4HD.js.map → chunk-ML7ZJAKJ.js.map} +0 -0
- /package/dist/{chunk-YDH2FSDI.js.map → chunk-N45NEBOD.js.map} +0 -0
- /package/dist/{chunk-7UX44C4N.js.map → chunk-N4C7QKOG.js.map} +0 -0
- /package/dist/{chunk-YYNHJF3N.js.map → chunk-N7KYEVLK.js.map} +0 -0
- /package/dist/{chunk-HT2C4EXO.js.map → chunk-NIRQGDYC.js.map} +0 -0
- /package/dist/{chunk-DXHVD4DS.js.map → chunk-NW2E4CI2.js.map} +0 -0
- /package/dist/{chunk-BFIZXFUG.js.map → chunk-NWIT3U2N.js.map} +0 -0
- /package/dist/{chunk-4NDWE44P.js.map → chunk-NZFFGO5O.js.map} +0 -0
- /package/dist/{chunk-MB5EJ2CT.js.map → chunk-O2IPAX26.js.map} +0 -0
- /package/dist/{chunk-UOA2VQ7C.js.map → chunk-O4SGYW7H.js.map} +0 -0
- /package/dist/{chunk-SSAXGPXY.js.map → chunk-OP6N4H6A.js.map} +0 -0
- /package/dist/{chunk-ZSJGYC3C.js.map → chunk-OQJKY3Z5.js.map} +0 -0
- /package/dist/{chunk-OFEHITAZ.js.map → chunk-OXNTOHL6.js.map} +0 -0
- /package/dist/{chunk-CDWFWOSZ.js.map → chunk-P4JED3ZL.js.map} +0 -0
- /package/dist/{chunk-FQD2KPQH.js.map → chunk-P55FACBG.js.map} +0 -0
- /package/dist/{chunk-KX36OCGK.js.map → chunk-P5NQN4JE.js.map} +0 -0
- /package/dist/{chunk-3ZCRHW7U.js.map → chunk-P7TOIOT7.js.map} +0 -0
- /package/dist/{chunk-PBVNVKYN.js.map → chunk-PIN5OPBA.js.map} +0 -0
- /package/dist/{chunk-O6YDGTH4.js.map → chunk-PZHQWFR3.js.map} +0 -0
- /package/dist/{chunk-SVDU4OHO.js.map → chunk-Q35L7TYB.js.map} +0 -0
- /package/dist/{chunk-SOJ3IQD3.js.map → chunk-QODKDRSP.js.map} +0 -0
- /package/dist/{chunk-VJGDQA3D.js.map → chunk-QOZJCSFO.js.map} +0 -0
- /package/dist/{chunk-6T42L5FI.js.map → chunk-QS3OLP5I.js.map} +0 -0
- /package/dist/{chunk-PAAJWQH5.js.map → chunk-QUMKDRCF.js.map} +0 -0
- /package/dist/{chunk-4TP3MJ3D.js.map → chunk-QX6JN3O4.js.map} +0 -0
- /package/dist/{chunk-KZEMFD6E.js.map → chunk-R2H4ZFBJ.js.map} +0 -0
- /package/dist/{chunk-N6UMXWBA.js.map → chunk-RTKV5XHL.js.map} +0 -0
- /package/dist/{chunk-ZQ3WU6JO.js.map → chunk-RXFCU3CY.js.map} +0 -0
- /package/dist/{chunk-BOOFTFFE.js.map → chunk-S2I7DL5Q.js.map} +0 -0
- /package/dist/{chunk-2NCBDGND.js.map → chunk-SA6GMZJY.js.map} +0 -0
- /package/dist/{chunk-2AFHZTPI.js.map → chunk-SIIRTDJ4.js.map} +0 -0
- /package/dist/{chunk-WH4QXVKU.js.map → chunk-SS3IS2JR.js.map} +0 -0
- /package/dist/{chunk-VFTK5WKI.js.map → chunk-STBX5X6B.js.map} +0 -0
- /package/dist/{chunk-WVHRNAXL.js.map → chunk-SWWHIJUJ.js.map} +0 -0
- /package/dist/{chunk-WADSXS4K.js.map → chunk-SX4QDWXK.js.map} +0 -0
- /package/dist/{chunk-2U4BM3TW.js.map → chunk-TITG2NBS.js.map} +0 -0
- /package/dist/{chunk-A5ZYP4K5.js.map → chunk-TNRCDMQT.js.map} +0 -0
- /package/dist/{chunk-LZKOVXMX.js.map → chunk-TRMJ6BYC.js.map} +0 -0
- /package/dist/{chunk-VA2HNBGQ.js.map → chunk-TZNDKTX5.js.map} +0 -0
- /package/dist/{chunk-OFDIGTC2.js.map → chunk-UMTCNEVQ.js.map} +0 -0
- /package/dist/{chunk-AAM66QCP.js.map → chunk-UZRSI6NX.js.map} +0 -0
- /package/dist/{chunk-2CXQZXWM.js.map → chunk-V4MB5ONM.js.map} +0 -0
- /package/dist/{chunk-5BUCKFRE.js.map → chunk-VOKHZRHW.js.map} +0 -0
- /package/dist/{chunk-CYEK6Z3P.js.map → chunk-VW6VIJOS.js.map} +0 -0
- /package/dist/{chunk-I2M4ZVDD.js.map → chunk-W47S5TIH.js.map} +0 -0
- /package/dist/{chunk-CBP4HWCL.js.map → chunk-W5MCEVUS.js.map} +0 -0
- /package/dist/{chunk-E5H4TM4Y.js.map → chunk-WC3V7HHP.js.map} +0 -0
- /package/dist/{chunk-WCTL3PVM.js.map → chunk-WLMZ2L5P.js.map} +0 -0
- /package/dist/{chunk-SQ2O52SU.js.map → chunk-WSGPFRBH.js.map} +0 -0
- /package/dist/{chunk-BH44JOLA.js.map → chunk-WVADKFWV.js.map} +0 -0
- /package/dist/{chunk-JVNEXW6X.js.map → chunk-XISROV24.js.map} +0 -0
- /package/dist/{chunk-FZVROZKC.js.map → chunk-XVZA6VXC.js.map} +0 -0
- /package/dist/{chunk-56GJLXBA.js.map → chunk-Y4NKEXQT.js.map} +0 -0
- /package/dist/{chunk-EKKAHJ4B.js.map → chunk-YE36AJL7.js.map} +0 -0
- /package/dist/{chunk-OGWEWJRH.js.map → chunk-YFMBHQRG.js.map} +0 -0
- /package/dist/{chunk-JLIGUFPF.js.map → chunk-YN2DQ2D6.js.map} +0 -0
- /package/dist/{chunk-RBJQYMMT.js.map → chunk-YRULQW5J.js.map} +0 -0
- /package/dist/{chunk-UCJINCZT.js.map → chunk-YUZRI3QU.js.map} +0 -0
- /package/dist/{chunk-QUNDYIYZ.js.map → chunk-YYEOR4XN.js.map} +0 -0
- /package/dist/{chunk-O5MW6CQL.js.map → chunk-ZJVMUBYF.js.map} +0 -0
- /package/dist/{chunk-VBJD4RSJ.js.map → chunk-ZSH2NRDV.js.map} +0 -0
- /package/dist/{chunk-BX4WDBTE.js.map → chunk-ZV65I6ME.js.map} +0 -0
- /package/dist/{resolution-E4GLHLY6.js.map → contradiction-scan-P7KXB5R4.js.map} +0 -0
- /package/dist/{first-start-migration-OM3PHMZO.js.map → first-start-migration-6A5BJPDW.js.map} +0 -0
- /package/dist/{tier-stats-M2FMMD2N.js.map → tier-stats-RQM76XYY.js.map} +0 -0
|
@@ -0,0 +1,232 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Quote-anchored source grounding.
|
|
3
|
+
*
|
|
4
|
+
* An extracted fact carries the exact words that support it in `quote`. A quote
|
|
5
|
+
* that is a verbatim substring of the source (whitespace-normalized) is real
|
|
6
|
+
* evidence: the claim only has to be supported by the text around that span,
|
|
7
|
+
* not by word overlap against the whole conversation. Items without such a
|
|
8
|
+
* quote never get an anchor here and stay on the whole-source rules.
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
import type { ExtractionResult } from "./types.js";
|
|
12
|
+
import {
|
|
13
|
+
GROUNDING_MIN_SHARED_TOKENS,
|
|
14
|
+
areGroundingTokensCompatible,
|
|
15
|
+
entityNameStart,
|
|
16
|
+
hasDenialReporting,
|
|
17
|
+
hasNonAssertiveReporting,
|
|
18
|
+
isGroundedEntityName,
|
|
19
|
+
normalizedEntityIdentifierTokens,
|
|
20
|
+
sourceSentences,
|
|
21
|
+
tokenize,
|
|
22
|
+
} from "./extraction-source-grounding-helpers.js";
|
|
23
|
+
|
|
24
|
+
/** Shortest normalized quote that counts as evidence; "the" or "I" prove nothing. */
|
|
25
|
+
export const QUOTE_ANCHOR_MIN_CHARS = 12;
|
|
26
|
+
/** Characters of context kept on each side of the quote inside its turn. */
|
|
27
|
+
export const QUOTE_ANCHOR_CONTEXT_CHARS = 400;
|
|
28
|
+
/** Share of a claim's content words that must occur in the quote's window. */
|
|
29
|
+
export const QUOTE_ANCHOR_MIN_WINDOW_COVERAGE = 0.35;
|
|
30
|
+
/** Share of a claim's content words that must occur anywhere in the source; the rest is invented. */
|
|
31
|
+
export const QUOTE_ANCHOR_MIN_SOURCE_COVERAGE = 0.75;
|
|
32
|
+
const QUOTE_ANCHOR_MAX_OCCURRENCES = 8;
|
|
33
|
+
const TURN_SEPARATOR = "\n\n";
|
|
34
|
+
const NEGATOR_PATTERN = /\b(?:not|no|never|cannot|without|neither|nor)\b|n't\b/iu;
|
|
35
|
+
const EXCLUSION_PATTERN =
|
|
36
|
+
/\b(?:exclu\w*|avoid\w*|omit\w*|skip\w*|ignor\w*|forbid\w*|prohibit\w*|disallow\w*|prevent\w*|reject\w*|refus\w*|insufficient|instead|rather|unless|except)\b/iu;
|
|
37
|
+
|
|
38
|
+
/** A verbatim quote and the text around it inside its turn. */
|
|
39
|
+
export interface QuoteAnchor {
|
|
40
|
+
/** Whitespace-normalized quote, exactly as it appears in the source. */
|
|
41
|
+
quote: string;
|
|
42
|
+
/** `quote` with its turn-local context; `;` inside the quote is rewritten to `,`. */
|
|
43
|
+
window: string;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export type TokenPool = (token: string) => boolean;
|
|
47
|
+
|
|
48
|
+
type Entity = ExtractionResult["entities"][number];
|
|
49
|
+
type Relationship = NonNullable<ExtractionResult["relationships"]>[number];
|
|
50
|
+
|
|
51
|
+
function normalizeWhitespaceWithMap(source: string): { text: string; originalIndex: number[] } {
|
|
52
|
+
const chars: string[] = [];
|
|
53
|
+
const originalIndex: number[] = [];
|
|
54
|
+
let inSpace = false;
|
|
55
|
+
for (let index = 0; index < source.length; index += 1) {
|
|
56
|
+
const char = source[index]!;
|
|
57
|
+
if (/\s/u.test(char)) {
|
|
58
|
+
if (inSpace) continue;
|
|
59
|
+
inSpace = true;
|
|
60
|
+
chars.push(" ");
|
|
61
|
+
} else {
|
|
62
|
+
inSpace = false;
|
|
63
|
+
chars.push(char);
|
|
64
|
+
}
|
|
65
|
+
originalIndex.push(index);
|
|
66
|
+
}
|
|
67
|
+
return { text: chars.join(""), originalIndex };
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
function findQuoteAnchors(quote: string, source: string): QuoteAnchor[] {
|
|
71
|
+
const needle = quote.replace(/\s+/gu, " ").trim();
|
|
72
|
+
if (needle.length < QUOTE_ANCHOR_MIN_CHARS) return [];
|
|
73
|
+
const normalized = normalizeWhitespaceWithMap(source);
|
|
74
|
+
const anchors: QuoteAnchor[] = [];
|
|
75
|
+
let from = 0;
|
|
76
|
+
while (anchors.length < QUOTE_ANCHOR_MAX_OCCURRENCES) {
|
|
77
|
+
const at = normalized.text.indexOf(needle, from);
|
|
78
|
+
if (at < 0) break;
|
|
79
|
+
from = at + 1;
|
|
80
|
+
const start = normalized.originalIndex[at]!;
|
|
81
|
+
const end = normalized.originalIndex[at + needle.length - 1]! + 1;
|
|
82
|
+
if (source.slice(start, end).includes(TURN_SEPARATOR)) continue;
|
|
83
|
+
|
|
84
|
+
let before = source.slice(Math.max(0, start - QUOTE_ANCHOR_CONTEXT_CHARS), start);
|
|
85
|
+
const turnStart = before.lastIndexOf(TURN_SEPARATOR);
|
|
86
|
+
if (turnStart >= 0) before = before.slice(turnStart + TURN_SEPARATOR.length);
|
|
87
|
+
else if (start > QUOTE_ANCHOR_CONTEXT_CHARS) before = before.replace(/^\S+/u, "");
|
|
88
|
+
|
|
89
|
+
let after = source.slice(end, end + QUOTE_ANCHOR_CONTEXT_CHARS);
|
|
90
|
+
const turnEnd = after.indexOf(TURN_SEPARATOR);
|
|
91
|
+
if (turnEnd >= 0) after = after.slice(0, turnEnd);
|
|
92
|
+
else if (source.length - end > QUOTE_ANCHOR_CONTEXT_CHARS) after = after.replace(/\S+$/u, "");
|
|
93
|
+
|
|
94
|
+
anchors.push({ quote: needle, window: `${before}${needle.replace(/;/gu, ",")}${after}` });
|
|
95
|
+
}
|
|
96
|
+
return anchors;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
* Returns one anchor per place `quote` occurs verbatim in `source`, or [] when
|
|
101
|
+
* the quote is absent, too short, or not an exact substring. A quote that
|
|
102
|
+
* spans a turn separator is not one turn's words and yields no anchor; windows
|
|
103
|
+
* never extend past their turn.
|
|
104
|
+
*
|
|
105
|
+
* The quote is one evidence unit: a `;` inside it is rewritten to `,` in the
|
|
106
|
+
* window so sentence splitting cannot cut it, or a claim that merges two of
|
|
107
|
+
* its clauses could never be grounded in a single sentence.
|
|
108
|
+
*
|
|
109
|
+
* `source` may have been rewritten before grounding (temporal anchoring,
|
|
110
|
+
* pronoun resolution) while the model quoted the original words. When the raw
|
|
111
|
+
* quote is not found, `transformQuote` applies the same rewrite to the quote.
|
|
112
|
+
*/
|
|
113
|
+
export function quoteAnchors(
|
|
114
|
+
quote: string | undefined,
|
|
115
|
+
source: string,
|
|
116
|
+
transformQuote?: (quote: string) => string,
|
|
117
|
+
): QuoteAnchor[] {
|
|
118
|
+
if (typeof quote !== "string") return [];
|
|
119
|
+
const exact = findQuoteAnchors(quote, source);
|
|
120
|
+
if (exact.length > 0 || transformQuote === undefined) return exact;
|
|
121
|
+
return findQuoteAnchors(transformQuote(quote), source);
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
export function tokenPool(tokens: ReadonlySet<string>): TokenPool {
|
|
125
|
+
const list = [...tokens];
|
|
126
|
+
return (token) => tokens.has(token) || list.some((poolToken) => areGroundingTokensCompatible(token, poolToken));
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
function hasNegation(text: string): boolean {
|
|
130
|
+
return NEGATOR_PATTERN.test(text.replace(/[\u2018\u2019]/gu, "'")) || hasDenialReporting(text);
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
/**
|
|
134
|
+
* True when the claim asserts what a quote clause denies or does not assert:
|
|
135
|
+
* "did not approve the budget" or "denied approving it" restated as "approved
|
|
136
|
+
* the budget", "suspects Bob stole funds" or "Is Alice the CEO?" restated as a
|
|
137
|
+
* plain statement. A claim that keeps a negator, exclusion word, or reporting
|
|
138
|
+
* marker ("do not X" reworded as "X is excluded") is not a misstatement.
|
|
139
|
+
*/
|
|
140
|
+
function misstatesQuote(content: string, quote: string): boolean {
|
|
141
|
+
const keepsNegation = hasNegation(content) || EXCLUSION_PATTERN.test(content);
|
|
142
|
+
const keepsReporting = hasNonAssertiveReporting(content) || content.trim().endsWith("?");
|
|
143
|
+
const contentHas = tokenPool(tokenize(content));
|
|
144
|
+
return (quote.match(/[^;.!?\n]+[;.!?]*/gu) ?? []).some((clause) => {
|
|
145
|
+
const negated = hasNegation(clause) && !keepsNegation;
|
|
146
|
+
const unasserted = (clause.trim().endsWith("?") || hasNonAssertiveReporting(clause)) && !keepsReporting;
|
|
147
|
+
if (!negated && !unasserted) return false;
|
|
148
|
+
const clauseTokens = [...tokenize(clause)];
|
|
149
|
+
const shared = clauseTokens.filter(contentHas).length;
|
|
150
|
+
return shared >= GROUNDING_MIN_SHARED_TOKENS && shared / clauseTokens.length >= 0.5;
|
|
151
|
+
});
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
/**
|
|
155
|
+
* A claim is supported by a verbatim quote when it shares at least
|
|
156
|
+
* GROUNDING_MIN_SHARED_TOKENS content words with the quote, a good part of its
|
|
157
|
+
* words sit in the text around the quote, nearly all of them occur in the
|
|
158
|
+
* source at all, and it does not invert a negated clause of the quote. Reworded
|
|
159
|
+
* and lightly elaborated claims pass; claims that bring words the conversation
|
|
160
|
+
* never used, or that have nothing to do with the quote, do not.
|
|
161
|
+
*/
|
|
162
|
+
export function isQuoteAnchoredClaim(content: string, anchor: QuoteAnchor, sourceHas: TokenPool): boolean {
|
|
163
|
+
const contentTokens = [...tokenize(content)];
|
|
164
|
+
if (contentTokens.length === 0) return false;
|
|
165
|
+
const quoteHas = tokenPool(tokenize(anchor.quote));
|
|
166
|
+
if (contentTokens.filter(quoteHas).length < GROUNDING_MIN_SHARED_TOKENS) return false;
|
|
167
|
+
const windowHas = tokenPool(tokenize(anchor.window));
|
|
168
|
+
if (contentTokens.filter(windowHas).length / contentTokens.length < QUOTE_ANCHOR_MIN_WINDOW_COVERAGE) {
|
|
169
|
+
return false;
|
|
170
|
+
}
|
|
171
|
+
return contentTokens.filter(sourceHas).length / contentTokens.length >= QUOTE_ANCHOR_MIN_SOURCE_COVERAGE
|
|
172
|
+
&& !misstatesQuote(content, anchor.quote);
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
/** Keeps the entity facts (flat and sectioned) `isSupported` accepts; undefined when none remain. */
|
|
176
|
+
export function filterEntityFacts(entity: Entity, isSupported: (fact: string) => boolean): Entity | undefined {
|
|
177
|
+
const facts = entity.facts.filter(isSupported);
|
|
178
|
+
const structuredSections = entity.structuredSections?.flatMap((section) => {
|
|
179
|
+
const groundedFacts = section.facts.filter(isSupported);
|
|
180
|
+
return groundedFacts.length > 0 ? [{ ...section, facts: groundedFacts }] : [];
|
|
181
|
+
});
|
|
182
|
+
if (facts.length === 0 && (structuredSections === undefined || structuredSections.length === 0)) {
|
|
183
|
+
return undefined;
|
|
184
|
+
}
|
|
185
|
+
const { structuredSections: _structuredSections, ...entityWithoutSections } = entity;
|
|
186
|
+
return {
|
|
187
|
+
...entityWithoutSections,
|
|
188
|
+
facts,
|
|
189
|
+
...(structuredSections && structuredSections.length > 0 ? { structuredSections } : {}),
|
|
190
|
+
};
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
/**
|
|
194
|
+
* Entities carry no quote of their own; the anchors of facts that kept support
|
|
195
|
+
* them. Returns a fact predicate, or undefined when no anchor window names the entity.
|
|
196
|
+
*/
|
|
197
|
+
export function quoteAnchoredEntitySupport(
|
|
198
|
+
entity: Entity,
|
|
199
|
+
anchors: readonly QuoteAnchor[],
|
|
200
|
+
sourceHas: TokenPool,
|
|
201
|
+
): ((fact: string) => boolean) | undefined {
|
|
202
|
+
const nameAnchors = anchors.filter((anchor) => isGroundedEntityName(entity.name, anchor.window));
|
|
203
|
+
if (nameAnchors.length === 0) return undefined;
|
|
204
|
+
return (fact) => nameAnchors.some((anchor) => isQuoteAnchoredClaim(fact, anchor, sourceHas));
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
/**
|
|
208
|
+
* The label words and both names must sit in one anchor-window sentence, source
|
|
209
|
+
* before target, so an invented label or a reversed edge never passes.
|
|
210
|
+
*/
|
|
211
|
+
export function isQuoteAnchoredRelationship(
|
|
212
|
+
relationship: Relationship,
|
|
213
|
+
anchors: readonly QuoteAnchor[],
|
|
214
|
+
sourceHas: TokenPool,
|
|
215
|
+
): boolean {
|
|
216
|
+
const labelTokens = [...tokenize(relationship.label)];
|
|
217
|
+
if (labelTokens.length === 0) return false;
|
|
218
|
+
const relationText = [
|
|
219
|
+
normalizedEntityIdentifierTokens(relationship.source).join(" "),
|
|
220
|
+
relationship.label,
|
|
221
|
+
normalizedEntityIdentifierTokens(relationship.target).join(" "),
|
|
222
|
+
].join(" ");
|
|
223
|
+
return anchors.some((anchor) => {
|
|
224
|
+
const windowHas = tokenPool(tokenize(anchor.window));
|
|
225
|
+
return labelTokens.every(windowHas)
|
|
226
|
+
&& sourceSentences(anchor.window).some((sentence) => {
|
|
227
|
+
const sourceStart = entityNameStart(relationship.source, sentence);
|
|
228
|
+
return sourceStart >= 0 && entityNameStart(relationship.target, sentence) > sourceStart;
|
|
229
|
+
})
|
|
230
|
+
&& isQuoteAnchoredClaim(relationText, anchor, sourceHas);
|
|
231
|
+
});
|
|
232
|
+
}
|
|
@@ -901,3 +901,38 @@ export function hasContradictoryPolarity(candidate: string, source: string): boo
|
|
|
901
901
|
}
|
|
902
902
|
return false;
|
|
903
903
|
}
|
|
904
|
+
|
|
905
|
+
export function normalizedEntityIdentifierTokens(name: string): string[] {
|
|
906
|
+
const identifier = normalizeForExactMatch(name).replace(/[-_]+/gu, " ");
|
|
907
|
+
const tokens = groundingLexemes(identifier)
|
|
908
|
+
.filter(({ token }) => GROUNDING_STOPWORDS[token] !== true)
|
|
909
|
+
.map(({ token }) => stemToken(token, true));
|
|
910
|
+
return tokens.length > 1 && GROUNDING_ENTITY_TYPE_PREFIXES.has(tokens[0] ?? "")
|
|
911
|
+
? tokens.slice(1)
|
|
912
|
+
: tokens;
|
|
913
|
+
}
|
|
914
|
+
|
|
915
|
+
/** Index of the entity name's tokens inside the sentence's token sequence, or -1. */
|
|
916
|
+
export function entityNameStart(name: string, sentence: string): number {
|
|
917
|
+
const nameTokens = normalizedEntityIdentifierTokens(name);
|
|
918
|
+
if (nameTokens.length === 0) return -1;
|
|
919
|
+
const sentenceTokens = groundingLexemes(sentence)
|
|
920
|
+
.filter(({ token }) => GROUNDING_STOPWORDS[token] !== true)
|
|
921
|
+
.map(({ token, preserveTerminalS }) => stemToken(token, preserveTerminalS));
|
|
922
|
+
return sentenceTokens.findIndex((_, start) =>
|
|
923
|
+
nameTokens.every((token, offset) => sentenceTokens[start + offset] === token));
|
|
924
|
+
}
|
|
925
|
+
|
|
926
|
+
export function isGroundedEntityName(name: string, source: string): boolean {
|
|
927
|
+
return sourceSentences(source).some((sentence) => entityNameStart(name, sentence) >= 0);
|
|
928
|
+
}
|
|
929
|
+
|
|
930
|
+
/** True when the text reports a claim without asserting it ("suspects", "alleged", "said"). */
|
|
931
|
+
export function hasNonAssertiveReporting(text: string): boolean {
|
|
932
|
+
return groundingLexemes(text).some(({ token }) => isNonAssertiveReportingVerb(token));
|
|
933
|
+
}
|
|
934
|
+
|
|
935
|
+
/** True when the text reports a denial ("denied", "refuses"). */
|
|
936
|
+
export function hasDenialReporting(text: string): boolean {
|
|
937
|
+
return groundingLexemes(text).some(({ token }) => isDenialReportingVerb(token));
|
|
938
|
+
}
|
|
@@ -1,9 +1,18 @@
|
|
|
1
1
|
import type { ExtractionResult } from "./types.js";
|
|
2
2
|
import { anchorTemporalExpressions } from "./delinearize.js";
|
|
3
|
+
import {
|
|
4
|
+
filterEntityFacts,
|
|
5
|
+
isQuoteAnchoredClaim,
|
|
6
|
+
isQuoteAnchoredRelationship,
|
|
7
|
+
quoteAnchoredEntitySupport,
|
|
8
|
+
quoteAnchors,
|
|
9
|
+
tokenPool,
|
|
10
|
+
type QuoteAnchor,
|
|
11
|
+
type TokenPool,
|
|
12
|
+
} from "./extraction-quote-grounding.js";
|
|
3
13
|
import {
|
|
4
14
|
GROUNDING_AUXILIARY_TOKENS,
|
|
5
15
|
GROUNDING_COPULAR_FORMS,
|
|
6
|
-
GROUNDING_ENTITY_TYPE_PREFIXES,
|
|
7
16
|
GROUNDING_MIN_COVERAGE,
|
|
8
17
|
GROUNDING_MIN_SHARED_TOKENS,
|
|
9
18
|
GROUNDING_STOPWORDS,
|
|
@@ -14,8 +23,10 @@ import {
|
|
|
14
23
|
groundingTokenSequence,
|
|
15
24
|
hasContradictoryPolarity,
|
|
16
25
|
hasExplicitRoleSubjectToken,
|
|
26
|
+
isGroundedEntityName,
|
|
17
27
|
isInterrogativeSourceSentence,
|
|
18
28
|
normalizeForExactMatch,
|
|
29
|
+
normalizedEntityIdentifierTokens,
|
|
19
30
|
normalizedGroundingAlignmentTokenSequence,
|
|
20
31
|
normalizedGroundingTokenSequence,
|
|
21
32
|
sourceSentences,
|
|
@@ -30,6 +41,8 @@ export interface ExtractionSourceGroundingOptions {
|
|
|
30
41
|
sourceGrounding: boolean;
|
|
31
42
|
anchorTemporalExpressions: boolean;
|
|
32
43
|
spanMode?: "off" | "shadow" | "on";
|
|
44
|
+
/** Rewrite applied to the source before this stage, so a verbatim quote can still be located in it. */
|
|
45
|
+
quoteTransform?: (quote: string) => string;
|
|
33
46
|
}
|
|
34
47
|
|
|
35
48
|
export function applyExtractionSourceGrounding(
|
|
@@ -62,6 +75,9 @@ export function applyExtractionSourceGrounding(
|
|
|
62
75
|
anchoredRoleSources,
|
|
63
76
|
options.anchorTemporalExpressions ? anchorSource : undefined,
|
|
64
77
|
options.spanMode ?? "off",
|
|
78
|
+
options.anchorTemporalExpressions
|
|
79
|
+
? (quote) => anchorSource(options.quoteTransform?.(quote) ?? quote)
|
|
80
|
+
: undefined,
|
|
65
81
|
);
|
|
66
82
|
}
|
|
67
83
|
|
|
@@ -352,25 +368,6 @@ function isSourceGrounded(
|
|
|
352
368
|
return isSourceGroundedClause(candidate, sourceText, includeInterrogativeSource);
|
|
353
369
|
}
|
|
354
370
|
|
|
355
|
-
function normalizedEntityIdentifierTokens(name: string): string[] {
|
|
356
|
-
const identifier = normalizeForExactMatch(name).replace(/[-_]+/gu, " ");
|
|
357
|
-
const tokens = groundingLexemes(identifier)
|
|
358
|
-
.filter(({ token }) => GROUNDING_STOPWORDS[token] !== true)
|
|
359
|
-
.map(({ token }) => stemToken(token, true));
|
|
360
|
-
return tokens.length > 1 && GROUNDING_ENTITY_TYPE_PREFIXES.has(tokens[0] ?? "")
|
|
361
|
-
? tokens.slice(1)
|
|
362
|
-
: tokens;
|
|
363
|
-
}
|
|
364
|
-
|
|
365
|
-
function isGroundedEntityName(name: string, source: string): boolean {
|
|
366
|
-
const nameTokens = normalizedEntityIdentifierTokens(name);
|
|
367
|
-
return nameTokens.length > 0 && sourceSentences(source).some((sentence) => {
|
|
368
|
-
const sentenceTokens = groundingLexemes(sentence)
|
|
369
|
-
.filter(({ token }) => GROUNDING_STOPWORDS[token] !== true)
|
|
370
|
-
.map(({ token, preserveTerminalS }) => stemToken(token, preserveTerminalS));
|
|
371
|
-
return containsContiguousGroundingTokens(nameTokens, sentenceTokens);
|
|
372
|
-
});
|
|
373
|
-
}
|
|
374
371
|
function buildEntitySupportSource(name: string, source: string): string {
|
|
375
372
|
const nameTokens = normalizedEntityIdentifierTokens(name);
|
|
376
373
|
if (nameTokens.length === 0) return "";
|
|
@@ -596,6 +593,22 @@ function isGroundedCandidate(
|
|
|
596
593
|
);
|
|
597
594
|
}
|
|
598
595
|
|
|
596
|
+
function groundWithinQuoteAnchors(
|
|
597
|
+
content: string,
|
|
598
|
+
anchors: readonly QuoteAnchor[],
|
|
599
|
+
sourceHas: TokenPool,
|
|
600
|
+
): GroundingContext | undefined {
|
|
601
|
+
const anchor = anchors.find((candidate) => isQuoteAnchoredClaim(content, candidate, sourceHas));
|
|
602
|
+
if (anchor === undefined) return undefined;
|
|
603
|
+
return {
|
|
604
|
+
source: anchor.window,
|
|
605
|
+
assertionSource: undefined,
|
|
606
|
+
allowRoleNormalization: GROUNDING_ROLE_SUBJECT_TOKENS.has(
|
|
607
|
+
(groundingTokenSequence(content)[0] ?? "").replace(/^[\u0000\u0001]/u, ""),
|
|
608
|
+
),
|
|
609
|
+
};
|
|
610
|
+
}
|
|
611
|
+
|
|
599
612
|
function buildFactSupportSource(
|
|
600
613
|
source: string,
|
|
601
614
|
supportingSentences: ReadonlyArray<string>,
|
|
@@ -656,6 +669,8 @@ function filterGroundedFact(
|
|
|
656
669
|
roleAssertionSources: ExtractionGroundingRoleSources | undefined,
|
|
657
670
|
eventTimeNormalizer: ((eventTime: string) => string) | undefined,
|
|
658
671
|
spanMode: "off" | "shadow" | "on" = "off",
|
|
672
|
+
anchors: readonly QuoteAnchor[],
|
|
673
|
+
sourceHas: TokenPool,
|
|
659
674
|
): ExtractionResult["facts"][number] | undefined {
|
|
660
675
|
// Span-materialized content (issue #2333) is "frame: verbatim slice". The
|
|
661
676
|
// frame is generated deixis, so full-content gating would drop a verbatim
|
|
@@ -677,6 +692,7 @@ function filterGroundedFact(
|
|
|
677
692
|
);
|
|
678
693
|
let gateContent = fact.content;
|
|
679
694
|
let factContext = contentContext;
|
|
695
|
+
let quoteAnchored = false;
|
|
680
696
|
if (
|
|
681
697
|
!isGroundedCandidate(
|
|
682
698
|
fact.content,
|
|
@@ -686,25 +702,35 @@ function filterGroundedFact(
|
|
|
686
702
|
contentContext.allowRoleNormalization,
|
|
687
703
|
)
|
|
688
704
|
) {
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
factContext
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
705
|
+
const quoteContext = spanMode === "on"
|
|
706
|
+
? undefined
|
|
707
|
+
: groundWithinQuoteAnchors(fact.content, anchors, sourceHas);
|
|
708
|
+
if (quoteContext !== undefined) {
|
|
709
|
+
factContext = quoteContext;
|
|
710
|
+
quoteAnchored = true;
|
|
711
|
+
} else {
|
|
712
|
+
if (embeddedQuote === undefined) return undefined;
|
|
713
|
+
gateContent = embeddedQuote;
|
|
714
|
+
factContext = selectGroundingContext(
|
|
715
|
+
gateContent,
|
|
716
|
+
resolveGroundingContext(gateContent, source, assertionSource, roleAssertionSources),
|
|
717
|
+
);
|
|
718
|
+
if (!isGroundedCandidate(
|
|
719
|
+
gateContent,
|
|
720
|
+
factContext.source,
|
|
721
|
+
factContext.assertionSource,
|
|
722
|
+
false,
|
|
723
|
+
factContext.allowRoleNormalization,
|
|
724
|
+
)) return undefined;
|
|
725
|
+
}
|
|
702
726
|
}
|
|
703
727
|
const factEventTime = fact.eventTime;
|
|
704
728
|
const groundedFactEventTime = factEventTime === undefined
|
|
705
729
|
? undefined
|
|
706
730
|
: eventTimeNormalizer?.(factEventTime) ?? factEventTime;
|
|
707
|
-
|
|
731
|
+
// A quote-anchored claim is reworded from the quote and its turn, so no single
|
|
732
|
+
// sentence grounds it; the anchor window is the support for its sub-fields.
|
|
733
|
+
const factSupportingSentences = quoteAnchored ? [] : sourceSentences(factContext.assertionSource ?? factContext.source).filter(
|
|
708
734
|
(sentence) =>
|
|
709
735
|
isGroundedCandidate(
|
|
710
736
|
gateContent,
|
|
@@ -730,10 +756,12 @@ function filterGroundedFact(
|
|
|
730
756
|
? factContext.assertionSource
|
|
731
757
|
: undefined;
|
|
732
758
|
|
|
733
|
-
const factSupportSource =
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
759
|
+
const factSupportSource = quoteAnchored
|
|
760
|
+
? factContext.source
|
|
761
|
+
: buildFactSupportSource(
|
|
762
|
+
factContext.assertionSource ?? factContext.source,
|
|
763
|
+
factSupportingSentences,
|
|
764
|
+
);
|
|
737
765
|
const groundedAttributes = fact.structuredAttributes
|
|
738
766
|
? Object.fromEntries(
|
|
739
767
|
Object.entries(fact.structuredAttributes)
|
|
@@ -843,33 +871,17 @@ function filterGroundedEntity(
|
|
|
843
871
|
entity: ExtractionResult["entities"][number],
|
|
844
872
|
source: string,
|
|
845
873
|
assertionSource: string | undefined,
|
|
874
|
+
anchorSupport?: (fact: string) => boolean,
|
|
846
875
|
): ExtractionResult["entities"][number] | undefined {
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
const
|
|
876
|
+
const nameGrounded = isGroundedEntityName(entity.name, source);
|
|
877
|
+
if (!nameGrounded && anchorSupport === undefined) return undefined;
|
|
878
|
+
const entitySource = nameGrounded ? buildEntitySupportSource(entity.name, source) : "";
|
|
879
|
+
const entityAssertionSource = !nameGrounded || assertionSource === undefined
|
|
850
880
|
? undefined
|
|
851
881
|
: buildEntitySupportSource(entity.name, assertionSource);
|
|
852
|
-
|
|
853
|
-
isGroundedCandidate(fact, entitySource, entityAssertionSource)
|
|
854
|
-
|
|
855
|
-
const structuredSections = entity.structuredSections
|
|
856
|
-
?.flatMap((section) => {
|
|
857
|
-
const groundedFacts = section.facts.filter((fact) =>
|
|
858
|
-
isGroundedCandidate(fact, entitySource, entityAssertionSource),
|
|
859
|
-
);
|
|
860
|
-
return groundedFacts.length > 0
|
|
861
|
-
? [{ ...section, facts: groundedFacts }]
|
|
862
|
-
: [];
|
|
863
|
-
});
|
|
864
|
-
if (facts.length === 0 && (structuredSections === undefined || structuredSections.length === 0)) {
|
|
865
|
-
return undefined;
|
|
866
|
-
}
|
|
867
|
-
const { structuredSections: _structuredSections, ...entityWithoutSections } = entity;
|
|
868
|
-
return {
|
|
869
|
-
...entityWithoutSections,
|
|
870
|
-
facts,
|
|
871
|
-
...(structuredSections && structuredSections.length > 0 ? { structuredSections } : {}),
|
|
872
|
-
};
|
|
882
|
+
return filterEntityFacts(entity, (fact) =>
|
|
883
|
+
(nameGrounded && isGroundedCandidate(fact, entitySource, entityAssertionSource))
|
|
884
|
+
|| anchorSupport?.(fact) === true);
|
|
873
885
|
}
|
|
874
886
|
|
|
875
887
|
function normalizedEntitySourceText(name: string): string {
|
|
@@ -1104,6 +1116,7 @@ export function filterExtractionResultBySource(
|
|
|
1104
1116
|
roleAssertionSources?: ExtractionGroundingRoleSources,
|
|
1105
1117
|
eventTimeNormalizer?: (eventTime: string) => string,
|
|
1106
1118
|
spanMode: "off" | "shadow" | "on" = "off",
|
|
1119
|
+
quoteTransform?: (quote: string) => string,
|
|
1107
1120
|
): ExtractionResult {
|
|
1108
1121
|
if (source.trim().length === 0) {
|
|
1109
1122
|
return {
|
|
@@ -1117,7 +1130,13 @@ export function filterExtractionResultBySource(
|
|
|
1117
1130
|
};
|
|
1118
1131
|
}
|
|
1119
1132
|
|
|
1133
|
+
const quoteSource = assertionSource ?? source;
|
|
1134
|
+
const keptAnchors: QuoteAnchor[] = [];
|
|
1135
|
+
const sourceHas = tokenPool(
|
|
1136
|
+
result.facts.some((fact) => typeof fact.quote === "string") ? tokenize(quoteSource) : new Set(),
|
|
1137
|
+
);
|
|
1120
1138
|
const facts = result.facts.flatMap((fact) => {
|
|
1139
|
+
const anchors = quoteAnchors(fact.quote, quoteSource, quoteTransform);
|
|
1121
1140
|
const grounded = filterGroundedFact(
|
|
1122
1141
|
fact,
|
|
1123
1142
|
source,
|
|
@@ -1125,14 +1144,19 @@ export function filterExtractionResultBySource(
|
|
|
1125
1144
|
roleAssertionSources,
|
|
1126
1145
|
eventTimeNormalizer,
|
|
1127
1146
|
spanMode,
|
|
1147
|
+
anchors,
|
|
1148
|
+
sourceHas,
|
|
1128
1149
|
);
|
|
1129
|
-
|
|
1150
|
+
if (grounded === undefined) return [];
|
|
1151
|
+
keptAnchors.push(...anchors);
|
|
1152
|
+
return [grounded];
|
|
1130
1153
|
});
|
|
1131
1154
|
const profileUpdates = result.profileUpdates.filter((update) =>
|
|
1132
1155
|
isRoleGroundedCandidate(update, source, assertionSource, roleAssertionSources),
|
|
1133
1156
|
);
|
|
1134
1157
|
const entities = result.entities.flatMap((entity) => {
|
|
1135
|
-
const
|
|
1158
|
+
const anchorSupport = quoteAnchoredEntitySupport(entity, keptAnchors, sourceHas);
|
|
1159
|
+
const grounded = filterGroundedEntity(entity, source, assertionSource, anchorSupport);
|
|
1136
1160
|
return grounded === undefined ? [] : [grounded];
|
|
1137
1161
|
});
|
|
1138
1162
|
const questions = result.questions.flatMap((question) => {
|
|
@@ -1140,7 +1164,8 @@ export function filterExtractionResultBySource(
|
|
|
1140
1164
|
return grounded === undefined ? [] : [grounded];
|
|
1141
1165
|
});
|
|
1142
1166
|
const relationships = result.relationships?.filter((relationship) =>
|
|
1143
|
-
isGroundedRelationship(relationship, source, assertionSource)
|
|
1167
|
+
isGroundedRelationship(relationship, source, assertionSource)
|
|
1168
|
+
|| isQuoteAnchoredRelationship(relationship, keptAnchors, sourceHas),
|
|
1144
1169
|
);
|
|
1145
1170
|
const identityReflection = result.identityReflection
|
|
1146
1171
|
&& isRoleGroundedCandidate(
|
|
@@ -36,7 +36,7 @@ export function applyExtractionSourceGrounding(
|
|
|
36
36
|
sourceForGrounding(assertionSourceText) ?? assertionSourceText,
|
|
37
37
|
groundedRoleSources,
|
|
38
38
|
messageTimestamp,
|
|
39
|
-
options,
|
|
39
|
+
{ ...options, quoteTransform: (quote) => sourceForGrounding(quote) ?? quote },
|
|
40
40
|
);
|
|
41
41
|
}
|
|
42
42
|
|
|
@@ -100,6 +100,15 @@ export function filterExtractionResultBySource(
|
|
|
100
100
|
roleAssertionSources?: ExtractionGroundingRoleSources,
|
|
101
101
|
eventTimeNormalizer?: (eventTime: string) => string,
|
|
102
102
|
spanMode: "off" | "shadow" | "on" = "off",
|
|
103
|
+
quoteTransform?: (quote: string) => string,
|
|
103
104
|
): ExtractionResult {
|
|
104
|
-
return filterGroundingRules(
|
|
105
|
+
return filterGroundingRules(
|
|
106
|
+
result,
|
|
107
|
+
source,
|
|
108
|
+
assertionSource,
|
|
109
|
+
roleAssertionSources,
|
|
110
|
+
eventTimeNormalizer,
|
|
111
|
+
spanMode,
|
|
112
|
+
quoteTransform,
|
|
113
|
+
);
|
|
105
114
|
}
|
package/src/index.ts
CHANGED
|
@@ -1401,7 +1401,7 @@ export type {
|
|
|
1401
1401
|
CalendarSource,
|
|
1402
1402
|
RecallDisclosure,
|
|
1403
1403
|
} from "./types.js";
|
|
1404
|
-
export { CONVERGE_CONFLICT_POLICIES, DEFAULT_CONVERGE_CONFLICT_POLICY, DEFAULT_CONVERGE_PEER_REQUEST_TIMEOUT_MS, MAX_CONVERGE_PEER_REQUEST_TIMEOUT_MS, envConvergePeerRequestTimeoutMs, normalizeConvergePeerRequestTimeoutMs, parseConvergeConfig } from "./converge-config.js";
|
|
1404
|
+
export { CONVERGE_CONFLICT_POLICIES, DEFAULT_CONVERGE_CONFLICT_POLICY, DEFAULT_CONVERGE_PEER_REQUEST_TIMEOUT_MS, MAX_CONVERGE_PEER_REQUEST_TIMEOUT_MS, envConvergePeerRequestTimeoutMs, normalizeConvergePeerRequestTimeoutMs, parseConvergeConfig, resolveConvergeCaptureWriteLockBackoff } from "./converge-config.js";
|
|
1405
1405
|
export {
|
|
1406
1406
|
DEFAULT_RECALL_DISCLOSURE,
|
|
1407
1407
|
RECALL_DISCLOSURE_LEVELS,
|
|
@@ -63,6 +63,7 @@ import {
|
|
|
63
63
|
type LifecyclePendingIo,
|
|
64
64
|
} from "../storage/memory-lifecycle-ledger-access.js";
|
|
65
65
|
import { STATE_FILE_MAX_DECRYPT_BYTES } from "../storage/secure-line-reader.js";
|
|
66
|
+
import { createCompoundingWeeklyCron, type CompoundingWeeklySchedulerHandle } from "../compounding/weekly-scheduler.js";
|
|
66
67
|
import { startLocationAutoSync, type LocationAutoSyncHandle } from "../location/scheduler.js";
|
|
67
68
|
import { ActivitySyncRegistrar } from "../activity/sync-registration.js";
|
|
68
69
|
import type { ActivitySyncRunSummary } from "../activity/runner.js";
|
|
@@ -158,6 +159,7 @@ export class MaintenanceScheduler {
|
|
|
158
159
|
// ── Location day-sync scheduler (issue #2047) — master default-off; the
|
|
159
160
|
// timer + lifecycle contract lives in location/scheduler.ts.
|
|
160
161
|
private locationAutoSync: LocationAutoSyncHandle | null = null;
|
|
162
|
+
private compoundingWeekly: CompoundingWeeklySchedulerHandle | null = null;
|
|
161
163
|
|
|
162
164
|
|
|
163
165
|
constructor(private readonly deps: MaintenanceSchedulerDeps) {
|
|
@@ -248,6 +250,8 @@ export class MaintenanceScheduler {
|
|
|
248
250
|
}
|
|
249
251
|
}
|
|
250
252
|
|
|
253
|
+
armCompoundingWeeklyCron(): boolean { if (this.disposed) return false; this.compoundingWeekly ??= createCompoundingWeeklyCron(this.deps); return this.compoundingWeekly !== null; }
|
|
254
|
+
|
|
251
255
|
async autoRegisterDaySummaryCron(): Promise<void> {
|
|
252
256
|
const home = resolveHomeDir();
|
|
253
257
|
const jobsPath = path.join(home, ".openclaw", "cron", "jobs.json");
|
|
@@ -1176,14 +1180,14 @@ export class MaintenanceScheduler {
|
|
|
1176
1180
|
// await it last so the rest of teardown runs while the aborted tick unwinds.
|
|
1177
1181
|
const activityDrain = this.activityRegistrar.dispose();
|
|
1178
1182
|
const locationDrain = this.locationAutoSync?.stop() ?? Promise.resolve();
|
|
1179
|
-
this.locationAutoSync = null;
|
|
1183
|
+
this.locationAutoSync = null; const weeklyDrain = this.compoundingWeekly?.stop() ?? Promise.resolve(); this.compoundingWeekly = null;
|
|
1180
1184
|
if (this.qmdMaintenanceTimer) {
|
|
1181
1185
|
clearTimeout(this.qmdMaintenanceTimer);
|
|
1182
1186
|
this.qmdMaintenanceTimer = null;
|
|
1183
1187
|
}
|
|
1184
1188
|
this.qmdMaintenancePending = false;
|
|
1185
1189
|
await activityDrain;
|
|
1186
|
-
await locationDrain;
|
|
1190
|
+
await locationDrain; await weeklyDrain;
|
|
1187
1191
|
// Belt-and-suspenders: clear anything a late tick armed before the latch.
|
|
1188
1192
|
if (this.qmdMaintenanceTimer) {
|
|
1189
1193
|
clearTimeout(this.qmdMaintenanceTimer);
|
|
@@ -6,6 +6,7 @@ import { mkdir, mkdtemp, rm, writeFile } from "node:fs/promises";
|
|
|
6
6
|
import {
|
|
7
7
|
callCodexCliFallback,
|
|
8
8
|
isCodexCliFallbackRunnerRegistered,
|
|
9
|
+
type CodexCliFallbackRunner,
|
|
9
10
|
setCodexCliFallbackRunnerForProcess,
|
|
10
11
|
} from "../cli-fallback.js";
|
|
11
12
|
import {
|
|
@@ -681,6 +682,17 @@ async function flushLoop(turns = 2): Promise<void> {
|
|
|
681
682
|
}
|
|
682
683
|
}
|
|
683
684
|
|
|
685
|
+
/** A runner's child untracks on the child's async exit event, which can
|
|
686
|
+
* land after the runner promise already settled. Poll for the count to
|
|
687
|
+
* clear instead of asserting it immediately (CI load made that flaky). */
|
|
688
|
+
async function waitForCodexChildUntrack(runner: CodexCliFallbackRunner, timeoutMs = 2_000): Promise<void> {
|
|
689
|
+
const waitUntil = Date.now() + timeoutMs;
|
|
690
|
+
while (__codexSubscriptionTestHooks.activeCodexChildCount(runner) !== 0 && Date.now() < waitUntil) {
|
|
691
|
+
await flushLoop();
|
|
692
|
+
}
|
|
693
|
+
assert.equal(__codexSubscriptionTestHooks.activeCodexChildCount(runner), 0);
|
|
694
|
+
}
|
|
695
|
+
|
|
684
696
|
test("shared login check: each caller times out on its own budget, without cancelling others", async () => {
|
|
685
697
|
__codexSubscriptionTestHooks.resetLoginStatusCache();
|
|
686
698
|
let clock = 0;
|
|
@@ -1104,7 +1116,7 @@ test(
|
|
|
1104
1116
|
}
|
|
1105
1117
|
);
|
|
1106
1118
|
// The detached child group must be untracked after settle — no leak.
|
|
1107
|
-
|
|
1119
|
+
await waitForCodexChildUntrack(runner);
|
|
1108
1120
|
} finally {
|
|
1109
1121
|
await rm(dir, { force: true, recursive: true }).catch(() => {});
|
|
1110
1122
|
}
|
|
@@ -1220,7 +1232,7 @@ test(
|
|
|
1220
1232
|
assert.equal(process.listenerCount("exit"), before.exit);
|
|
1221
1233
|
terminateActiveCodexSubscriptionChildren("SIGKILL", runner);
|
|
1222
1234
|
await pendingDone;
|
|
1223
|
-
|
|
1235
|
+
await waitForCodexChildUntrack(runner);
|
|
1224
1236
|
assert.equal(process.listenerCount("SIGINT"), before.sigint);
|
|
1225
1237
|
assert.equal(process.listenerCount("SIGTERM"), before.sigterm);
|
|
1226
1238
|
} finally {
|
|
@@ -1283,7 +1295,7 @@ test(
|
|
|
1283
1295
|
assert.equal(__codexSubscriptionTestHooks.activeCodexChildCount(second), 1);
|
|
1284
1296
|
terminateActiveCodexSubscriptionChildren("SIGKILL", first);
|
|
1285
1297
|
await firstPending;
|
|
1286
|
-
|
|
1298
|
+
await waitForCodexChildUntrack(first);
|
|
1287
1299
|
assert.equal(__codexSubscriptionTestHooks.activeCodexChildCount(second), 1);
|
|
1288
1300
|
} finally {
|
|
1289
1301
|
terminateActiveCodexSubscriptionChildren("SIGKILL", first);
|