@remnic/core 10.0.186 → 10.0.188
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 +105 -104
- package/dist/access-audit.js +2 -2
- package/dist/access-cli.js +105 -104
- package/dist/access-cli.js.map +1 -1
- package/dist/access-coding-context-resolution.js +6 -6
- package/dist/access-extraction-force-flush-preempt.js +105 -104
- package/dist/access-extraction-force-flush.js +105 -104
- package/dist/access-http-briefing.js +105 -104
- package/dist/access-http-query.js +105 -104
- package/dist/access-http.js +105 -104
- package/dist/access-identity-continuity-surface.js +105 -104
- package/dist/access-lcm-surface.js +105 -104
- package/dist/access-mcp.js +105 -104
- package/dist/access-observe-write-category.js +6 -6
- package/dist/access-observe-write-surface.js +105 -104
- package/dist/access-offline-manifest.js +5 -5
- package/dist/access-operations-batch.js +105 -104
- package/dist/access-operations.js +105 -104
- package/dist/access-recall-concurrency.js +105 -104
- package/dist/access-recall-response.js +105 -104
- package/dist/access-recall-surface.js +105 -104
- package/dist/access-schema.js +5 -5
- package/dist/access-service.js +105 -104
- package/dist/active-recall.js +10 -10
- package/dist/adapters/index.js +4 -4
- package/dist/adapters/registry.js +2 -2
- package/dist/{auto-sync-OOEY2FSA.js → auto-sync-BJUAGKI5.js} +4 -4
- package/dist/briefing.js +7 -7
- package/dist/buffer-add-turns-bounded.js +2 -2
- package/dist/buffer-admission-idempotency.d.ts.map +1 -1
- package/dist/buffer-admission-idempotency.js +1 -1
- package/dist/buffer-persistence.d.ts +14 -0
- package/dist/buffer-persistence.d.ts.map +1 -1
- package/dist/buffer-persistence.js +3 -1
- package/dist/buffer.js +9 -8
- package/dist/calibration.js +4 -4
- package/dist/causal-consolidation.js +8 -8
- package/dist/{chunk-XYZR3NBU.js → chunk-2I3ETW3G.js} +2 -2
- package/dist/{chunk-5RWIZISF.js → chunk-2VNMSEZR.js} +3 -3
- package/dist/{chunk-4TPU36X4.js → chunk-4N33L4HY.js} +2 -2
- package/dist/{chunk-BFPF5N3H.js → chunk-4RASUAN3.js} +4 -4
- package/dist/{chunk-N2PXVLV3.js → chunk-56BNHKZM.js} +7 -7
- package/dist/{chunk-R3UQIS3F.js → chunk-5AFBFAFX.js} +4 -4
- package/dist/{chunk-3FEQNKMB.js → chunk-5WDUY2ZZ.js} +2 -2
- package/dist/{chunk-5ITPOAKW.js → chunk-65DWWJKI.js} +2 -2
- package/dist/{chunk-O5ZCDK32.js → chunk-6AMFGXG2.js} +39 -11
- package/dist/chunk-6AMFGXG2.js.map +1 -0
- package/dist/{chunk-L4TYD52M.js → chunk-6MDHK6NO.js} +2 -2
- package/dist/{chunk-FYHFM64A.js → chunk-6OHCNTKU.js} +2 -2
- package/dist/{chunk-PY5XP7GR.js → chunk-6TIQLG7I.js} +2 -2
- package/dist/{chunk-A3HLZMHD.js → chunk-7KTORRIK.js} +2 -2
- package/dist/{chunk-ENKXMLE3.js → chunk-A32EBVCZ.js} +2 -2
- package/dist/{chunk-H4HBQRGI.js → chunk-ATPY63F5.js} +2 -2
- package/dist/{chunk-2LXROA34.js → chunk-AXSQGJSG.js} +2 -2
- package/dist/chunk-B256MMS7.js +205 -0
- package/dist/chunk-B256MMS7.js.map +1 -0
- package/dist/{chunk-VUC3DLQ5.js → chunk-C6Y2YHJL.js} +2 -2
- package/dist/{chunk-FBNR3JI5.js → chunk-CIAQK2OU.js} +7 -2
- package/dist/{chunk-FBNR3JI5.js.map → chunk-CIAQK2OU.js.map} +1 -1
- package/dist/{chunk-FDXLO6CX.js → chunk-CRS2NY44.js} +2 -2
- package/dist/{chunk-AJVCM2E3.js → chunk-CYX7JI4O.js} +2 -2
- package/dist/{chunk-JK5YFQQT.js → chunk-D3FP4JQI.js} +2 -2
- package/dist/{chunk-ZNHLUYIT.js → chunk-D7HOJFDS.js} +4 -4
- package/dist/{chunk-ZX5N5D6M.js → chunk-DAOMWGO2.js} +4 -4
- package/dist/{chunk-VN3RYYMS.js → chunk-DR4TYD56.js} +2 -2
- package/dist/{chunk-7DFJ4JX2.js → chunk-DTTDMK7Q.js} +7 -7
- package/dist/{chunk-YNDLCWXS.js → chunk-EZ25VE3G.js} +4 -4
- package/dist/{chunk-QJBULLKG.js → chunk-F2MVWUNF.js} +2 -2
- package/dist/{chunk-TQXKUQFX.js → chunk-FZU62GIV.js} +7 -6
- package/dist/chunk-FZU62GIV.js.map +1 -0
- package/dist/{chunk-BAMF6J4W.js → chunk-GCHM5BYL.js} +4 -4
- package/dist/{chunk-6SROXED4.js → chunk-GRX5BE73.js} +2 -2
- package/dist/{chunk-TKWIUL3D.js → chunk-H442UKDV.js} +8 -8
- package/dist/{chunk-VFJ3PBZI.js → chunk-HL53XYHC.js} +4 -4
- package/dist/{chunk-CKTKATXL.js → chunk-IMSLPQJB.js} +20 -16
- package/dist/chunk-IMSLPQJB.js.map +1 -0
- package/dist/{chunk-63FIQIER.js → chunk-JJ42IDJU.js} +2 -2
- package/dist/{chunk-N33M4NWM.js → chunk-K3JGILZC.js} +3 -3
- package/dist/{chunk-CJERJ724.js → chunk-K6BS5RB4.js} +2 -2
- package/dist/{chunk-VAQIBC2L.js → chunk-KQIOW3TG.js} +2 -2
- package/dist/{chunk-UMGO4LEZ.js → chunk-KVTUUU7H.js} +2 -2
- package/dist/{chunk-TRFSTCQK.js → chunk-LL6WEMTC.js} +34 -6
- package/dist/chunk-LL6WEMTC.js.map +1 -0
- package/dist/{chunk-LALPM2DN.js → chunk-MTKSH7HY.js} +143 -139
- package/dist/chunk-MTKSH7HY.js.map +1 -0
- package/dist/{chunk-IK7NPYYU.js → chunk-NFQKIZK3.js} +2 -2
- package/dist/{chunk-2WITFW6F.js → chunk-NKHRIDYP.js} +2 -2
- package/dist/{chunk-KYZMCH4I.js → chunk-NN3LMWKA.js} +12 -4
- package/dist/chunk-NN3LMWKA.js.map +1 -0
- package/dist/{chunk-RXAWE76Y.js → chunk-O6QSBI3U.js} +2 -2
- package/dist/{chunk-5RBHL5TF.js → chunk-OA7YDB6A.js} +2 -2
- package/dist/{chunk-SSKIXUR5.js → chunk-PCGBESAN.js} +2 -2
- package/dist/{chunk-DYZDFOBX.js → chunk-Q6S67LHR.js} +2 -2
- package/dist/{chunk-WCXWCAUC.js → chunk-QGT5KNQT.js} +2 -2
- package/dist/{chunk-KYPFQO43.js → chunk-QPD7EYGI.js} +2 -2
- package/dist/{chunk-4KUK3KGI.js → chunk-QXHWOUS6.js} +3 -3
- package/dist/{chunk-FE43YKNJ.js → chunk-RBPC4XGU.js} +31 -8
- package/dist/chunk-RBPC4XGU.js.map +1 -0
- package/dist/{chunk-CXGD3N2Y.js → chunk-RPOG6HLI.js} +2 -2
- package/dist/{chunk-3N7I53KR.js → chunk-RVODERA5.js} +2 -2
- package/dist/{chunk-G6V32Q4F.js → chunk-SFWQZBPN.js} +2 -2
- package/dist/{chunk-DNXQVCIC.js → chunk-SUI75NTN.js} +8 -8
- package/dist/{chunk-3GD5SFDT.js → chunk-T3XOP7TA.js} +5 -5
- package/dist/{chunk-FDLPNFKE.js → chunk-T7R42MWB.js} +2 -2
- package/dist/{chunk-5BESLEU7.js → chunk-TAPF7T26.js} +2 -2
- package/dist/chunk-TK6EBBKG.js +13 -0
- package/dist/chunk-TK6EBBKG.js.map +1 -0
- package/dist/{chunk-PZ4OA7CP.js → chunk-TQODBIMW.js} +2 -2
- package/dist/{chunk-PDXO4LIH.js → chunk-UWKHLWUE.js} +13 -9
- package/dist/chunk-UWKHLWUE.js.map +1 -0
- package/dist/{chunk-QJG6PEAM.js → chunk-VQQZJ6KJ.js} +3 -3
- package/dist/{chunk-CIC3WZVO.js → chunk-X3ERYOLO.js} +2 -2
- package/dist/{chunk-T4MKFTJF.js → chunk-XHDS6HIX.js} +5 -5
- package/dist/{chunk-J7BAJ6BF.js → chunk-XQF2KLV5.js} +2 -2
- package/dist/{chunk-U7VEZ2XS.js → chunk-XWPYK5T4.js} +2 -2
- package/dist/{chunk-L7MVHAMS.js → chunk-YVXR7CPS.js} +2 -2
- package/dist/{chunk-NU5JRN3A.js → chunk-ZDLVHGIC.js} +2 -2
- package/dist/{chunk-OJXK5C6Z.js → chunk-ZG4GNPRE.js} +7 -7
- package/dist/{chunk-IJKO5RVJ.js → chunk-ZNYDDZVW.js} +3 -3
- package/dist/cli.js +105 -104
- package/dist/coding/export-okf-codegraph.js +13 -13
- package/dist/compounding/engine.js +8 -8
- package/dist/config.js +10 -10
- package/dist/connectors/codex-materialize-runner.js +7 -7
- package/dist/connectors/index.js +7 -7
- package/dist/convergence-refresh.js +9 -9
- package/dist/corpus-watermark.js +9 -9
- package/dist/dashboard-runtime.js +2 -2
- package/dist/deep-recall-http-glue.js +6 -6
- package/dist/deep-recall.js +2 -2
- package/dist/entity-retrieval.js +7 -7
- package/dist/explicit-capture.js +105 -104
- package/dist/extraction-entities-source.d.ts +11 -0
- package/dist/extraction-entities-source.d.ts.map +1 -0
- package/dist/extraction-entities-source.js +8 -0
- package/dist/extraction-entities-source.js.map +1 -0
- package/dist/extraction-judge.js +2 -2
- package/dist/extraction-normalization.js +2 -2
- package/dist/extraction-prompt.d.ts +19 -2
- package/dist/extraction-prompt.d.ts.map +1 -1
- package/dist/extraction-prompt.js +5 -1
- package/dist/extraction.d.ts +2 -1
- package/dist/extraction.d.ts.map +1 -1
- package/dist/extraction.js +18 -17
- package/dist/{first-start-migration-TCPK2I7J.js → first-start-migration-CCZ5SM3V.js} +4 -4
- package/dist/harmonic-retrieval.js +7 -7
- package/dist/index.js +125 -124
- package/dist/lcm/engine.js +3 -3
- package/dist/lcm/index.js +8 -8
- package/dist/local-llm-helpers.d.ts.map +1 -1
- package/dist/local-llm-helpers.js +2 -2
- package/dist/local-llm-transport.d.ts +82 -9
- package/dist/local-llm-transport.d.ts.map +1 -1
- package/dist/local-llm-transport.js +11 -3
- package/dist/local-llm.d.ts.map +1 -1
- package/dist/local-llm.js +3 -3
- package/dist/location/index.js +8 -8
- package/dist/maintenance/memory-governance.js +7 -7
- package/dist/maintenance/rebuild-memory-lifecycle-ledger.js +7 -7
- package/dist/maintenance/rebuild-memory-projection-runner.js +9 -9
- package/dist/maintenance/rebuild-memory-projection.js +8 -8
- package/dist/memory-browse.js +5 -5
- package/dist/namespaces/migrate.js +8 -8
- package/dist/namespaces/search.js +4 -4
- package/dist/namespaces/storage.js +7 -7
- package/dist/offline-sync-changeset-generations.js +3 -3
- package/dist/offline-sync-embedding-generation.js +2 -2
- package/dist/offline-sync-snapshot-stream.js +5 -5
- package/dist/offline-sync.js +6 -6
- package/dist/operator-doctor-corpus.js +10 -10
- package/dist/operator-toolkit.js +17 -17
- package/dist/orchestration/backlog-scheduler.js +106 -105
- package/dist/orchestration/backlog-scheduler.js.map +1 -1
- package/dist/orchestration/buffer-drain-runner.js +106 -105
- package/dist/orchestration/extraction-queue-coordinator.d.ts.map +1 -1
- package/dist/orchestration/extraction-run-helpers.d.ts +2 -1
- package/dist/orchestration/extraction-run-helpers.d.ts.map +1 -1
- package/dist/orchestration/extraction-run.d.ts.map +1 -1
- package/dist/orchestration/maintenance.js +18 -18
- package/dist/orchestrator.js +107 -106
- package/dist/qmd.js +2 -2
- package/dist/recall-navigation.js +105 -104
- package/dist/recall-state-view-admission.js +5 -5
- package/dist/recall-why-service.js +5 -5
- package/dist/resume-bundles.js +13 -13
- package/dist/search/factory.js +3 -3
- package/dist/search/index.js +3 -3
- package/dist/semantic-consolidation.js +8 -8
- package/dist/semantic-rule-promotion.js +7 -7
- package/dist/semantic-rule-verifier.js +7 -7
- package/dist/source-agent-qualifier.js +11 -10
- package/dist/standup/build.js +7 -7
- package/dist/storage/entity-canonical-id-migration-runner.d.ts.map +1 -1
- package/dist/storage.js +6 -6
- package/dist/summarizer.js +4 -4
- package/dist/support-passport/index.js +4 -4
- package/dist/transcript.js +2 -2
- package/dist/transfer/export-okf.js +7 -7
- package/dist/verified-recall.js +7 -7
- package/dist/who-knows-cli.js +8 -8
- package/dist/who-knows.js +7 -7
- package/package.json +2 -2
- package/src/buffer-admission-idempotency.test.ts +115 -0
- package/src/buffer-admission-idempotency.ts +67 -11
- package/src/buffer-persistence.ts +46 -5
- package/src/extraction-carry-forward.test.ts +147 -0
- package/src/extraction-entities-source.ts +19 -0
- package/src/extraction-prompt.ts +60 -9
- package/src/extraction.ts +11 -8
- package/src/local-llm-headers-timeout.test.ts +246 -16
- package/src/local-llm-helpers.ts +14 -4
- package/src/local-llm-transport.ts +253 -16
- package/src/local-llm.ts +7 -8
- package/src/orchestration/extraction-queue-coordinator.ts +7 -1
- package/src/orchestration/extraction-queue-lane-bias.test.ts +35 -0
- package/src/orchestration/extraction-run-helpers.ts +11 -4
- package/src/orchestration/extraction-run.test.ts +23 -12
- package/src/orchestration/extraction-run.ts +6 -5
- package/src/storage/entity-canonical-id-migration-runner.test.ts +90 -0
- package/src/storage/entity-canonical-id-migration-runner.ts +10 -0
- package/dist/chunk-5YQXWVCP.js +0 -74
- package/dist/chunk-5YQXWVCP.js.map +0 -1
- package/dist/chunk-CKTKATXL.js.map +0 -1
- package/dist/chunk-FE43YKNJ.js.map +0 -1
- package/dist/chunk-KYZMCH4I.js.map +0 -1
- package/dist/chunk-LALPM2DN.js.map +0 -1
- package/dist/chunk-O5ZCDK32.js.map +0 -1
- package/dist/chunk-PDXO4LIH.js.map +0 -1
- package/dist/chunk-TQXKUQFX.js.map +0 -1
- package/dist/chunk-TRFSTCQK.js.map +0 -1
- /package/dist/{auto-sync-OOEY2FSA.js.map → auto-sync-BJUAGKI5.js.map} +0 -0
- /package/dist/{chunk-XYZR3NBU.js.map → chunk-2I3ETW3G.js.map} +0 -0
- /package/dist/{chunk-5RWIZISF.js.map → chunk-2VNMSEZR.js.map} +0 -0
- /package/dist/{chunk-4TPU36X4.js.map → chunk-4N33L4HY.js.map} +0 -0
- /package/dist/{chunk-BFPF5N3H.js.map → chunk-4RASUAN3.js.map} +0 -0
- /package/dist/{chunk-N2PXVLV3.js.map → chunk-56BNHKZM.js.map} +0 -0
- /package/dist/{chunk-R3UQIS3F.js.map → chunk-5AFBFAFX.js.map} +0 -0
- /package/dist/{chunk-3FEQNKMB.js.map → chunk-5WDUY2ZZ.js.map} +0 -0
- /package/dist/{chunk-5ITPOAKW.js.map → chunk-65DWWJKI.js.map} +0 -0
- /package/dist/{chunk-L4TYD52M.js.map → chunk-6MDHK6NO.js.map} +0 -0
- /package/dist/{chunk-FYHFM64A.js.map → chunk-6OHCNTKU.js.map} +0 -0
- /package/dist/{chunk-PY5XP7GR.js.map → chunk-6TIQLG7I.js.map} +0 -0
- /package/dist/{chunk-A3HLZMHD.js.map → chunk-7KTORRIK.js.map} +0 -0
- /package/dist/{chunk-ENKXMLE3.js.map → chunk-A32EBVCZ.js.map} +0 -0
- /package/dist/{chunk-H4HBQRGI.js.map → chunk-ATPY63F5.js.map} +0 -0
- /package/dist/{chunk-2LXROA34.js.map → chunk-AXSQGJSG.js.map} +0 -0
- /package/dist/{chunk-VUC3DLQ5.js.map → chunk-C6Y2YHJL.js.map} +0 -0
- /package/dist/{chunk-FDXLO6CX.js.map → chunk-CRS2NY44.js.map} +0 -0
- /package/dist/{chunk-AJVCM2E3.js.map → chunk-CYX7JI4O.js.map} +0 -0
- /package/dist/{chunk-JK5YFQQT.js.map → chunk-D3FP4JQI.js.map} +0 -0
- /package/dist/{chunk-ZNHLUYIT.js.map → chunk-D7HOJFDS.js.map} +0 -0
- /package/dist/{chunk-ZX5N5D6M.js.map → chunk-DAOMWGO2.js.map} +0 -0
- /package/dist/{chunk-VN3RYYMS.js.map → chunk-DR4TYD56.js.map} +0 -0
- /package/dist/{chunk-7DFJ4JX2.js.map → chunk-DTTDMK7Q.js.map} +0 -0
- /package/dist/{chunk-YNDLCWXS.js.map → chunk-EZ25VE3G.js.map} +0 -0
- /package/dist/{chunk-QJBULLKG.js.map → chunk-F2MVWUNF.js.map} +0 -0
- /package/dist/{chunk-BAMF6J4W.js.map → chunk-GCHM5BYL.js.map} +0 -0
- /package/dist/{chunk-6SROXED4.js.map → chunk-GRX5BE73.js.map} +0 -0
- /package/dist/{chunk-TKWIUL3D.js.map → chunk-H442UKDV.js.map} +0 -0
- /package/dist/{chunk-VFJ3PBZI.js.map → chunk-HL53XYHC.js.map} +0 -0
- /package/dist/{chunk-63FIQIER.js.map → chunk-JJ42IDJU.js.map} +0 -0
- /package/dist/{chunk-N33M4NWM.js.map → chunk-K3JGILZC.js.map} +0 -0
- /package/dist/{chunk-CJERJ724.js.map → chunk-K6BS5RB4.js.map} +0 -0
- /package/dist/{chunk-VAQIBC2L.js.map → chunk-KQIOW3TG.js.map} +0 -0
- /package/dist/{chunk-UMGO4LEZ.js.map → chunk-KVTUUU7H.js.map} +0 -0
- /package/dist/{chunk-IK7NPYYU.js.map → chunk-NFQKIZK3.js.map} +0 -0
- /package/dist/{chunk-2WITFW6F.js.map → chunk-NKHRIDYP.js.map} +0 -0
- /package/dist/{chunk-RXAWE76Y.js.map → chunk-O6QSBI3U.js.map} +0 -0
- /package/dist/{chunk-5RBHL5TF.js.map → chunk-OA7YDB6A.js.map} +0 -0
- /package/dist/{chunk-SSKIXUR5.js.map → chunk-PCGBESAN.js.map} +0 -0
- /package/dist/{chunk-DYZDFOBX.js.map → chunk-Q6S67LHR.js.map} +0 -0
- /package/dist/{chunk-WCXWCAUC.js.map → chunk-QGT5KNQT.js.map} +0 -0
- /package/dist/{chunk-KYPFQO43.js.map → chunk-QPD7EYGI.js.map} +0 -0
- /package/dist/{chunk-4KUK3KGI.js.map → chunk-QXHWOUS6.js.map} +0 -0
- /package/dist/{chunk-CXGD3N2Y.js.map → chunk-RPOG6HLI.js.map} +0 -0
- /package/dist/{chunk-3N7I53KR.js.map → chunk-RVODERA5.js.map} +0 -0
- /package/dist/{chunk-G6V32Q4F.js.map → chunk-SFWQZBPN.js.map} +0 -0
- /package/dist/{chunk-DNXQVCIC.js.map → chunk-SUI75NTN.js.map} +0 -0
- /package/dist/{chunk-3GD5SFDT.js.map → chunk-T3XOP7TA.js.map} +0 -0
- /package/dist/{chunk-FDLPNFKE.js.map → chunk-T7R42MWB.js.map} +0 -0
- /package/dist/{chunk-5BESLEU7.js.map → chunk-TAPF7T26.js.map} +0 -0
- /package/dist/{chunk-PZ4OA7CP.js.map → chunk-TQODBIMW.js.map} +0 -0
- /package/dist/{chunk-QJG6PEAM.js.map → chunk-VQQZJ6KJ.js.map} +0 -0
- /package/dist/{chunk-CIC3WZVO.js.map → chunk-X3ERYOLO.js.map} +0 -0
- /package/dist/{chunk-T4MKFTJF.js.map → chunk-XHDS6HIX.js.map} +0 -0
- /package/dist/{chunk-J7BAJ6BF.js.map → chunk-XQF2KLV5.js.map} +0 -0
- /package/dist/{chunk-U7VEZ2XS.js.map → chunk-XWPYK5T4.js.map} +0 -0
- /package/dist/{chunk-L7MVHAMS.js.map → chunk-YVXR7CPS.js.map} +0 -0
- /package/dist/{chunk-NU5JRN3A.js.map → chunk-ZDLVHGIC.js.map} +0 -0
- /package/dist/{chunk-OJXK5C6Z.js.map → chunk-ZG4GNPRE.js.map} +0 -0
- /package/dist/{chunk-IJKO5RVJ.js.map → chunk-ZNYDDZVW.js.map} +0 -0
- /package/dist/{first-start-migration-TCPK2I7J.js.map → first-start-migration-CCZ5SM3V.js.map} +0 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
canonicalCategoryForAlias,
|
|
3
3
|
categoryAliasCoercion
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-F2MVWUNF.js";
|
|
5
5
|
|
|
6
6
|
// src/access-observe-write-category.ts
|
|
7
7
|
function splitCanonicalWriteRequest(request) {
|
|
@@ -22,4 +22,4 @@ function splitCanonicalWriteRequest(request) {
|
|
|
22
22
|
export {
|
|
23
23
|
splitCanonicalWriteRequest
|
|
24
24
|
};
|
|
25
|
-
//# sourceMappingURL=chunk-
|
|
25
|
+
//# sourceMappingURL=chunk-NFQKIZK3.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
LocalLlmClient
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-FZU62GIV.js";
|
|
4
4
|
import {
|
|
5
5
|
SupportPassportCreateGrantInputSchema,
|
|
6
6
|
SupportPassportCreateGrantRequestSchema,
|
|
@@ -4497,4 +4497,4 @@ export {
|
|
|
4497
4497
|
parseSupportPassportModelJob,
|
|
4498
4498
|
SupportPassportModelBridge
|
|
4499
4499
|
};
|
|
4500
|
-
//# sourceMappingURL=chunk-
|
|
4500
|
+
//# sourceMappingURL=chunk-NKHRIDYP.js.map
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import {
|
|
2
|
-
directProbeDispatcher
|
|
3
|
-
|
|
2
|
+
directProbeDispatcher,
|
|
3
|
+
isInvalidDispatcherArg
|
|
4
|
+
} from "./chunk-B256MMS7.js";
|
|
4
5
|
import {
|
|
5
6
|
log
|
|
6
7
|
} from "./chunk-3WCASNQZ.js";
|
|
7
8
|
|
|
8
9
|
// src/local-llm-helpers.ts
|
|
10
|
+
import { fetch as undiciFetch } from "undici";
|
|
9
11
|
function isAbortError(err) {
|
|
10
12
|
if (!err || typeof err !== "object") return false;
|
|
11
13
|
const maybe = err;
|
|
@@ -90,7 +92,13 @@ async function probeFetch(url, options) {
|
|
|
90
92
|
const init = { signal: requestSignal, headers: options.headers };
|
|
91
93
|
const dispatcher = directProbeDispatcher();
|
|
92
94
|
if (dispatcher) init.dispatcher = dispatcher;
|
|
93
|
-
|
|
95
|
+
let response;
|
|
96
|
+
try {
|
|
97
|
+
response = await fetch(url, init);
|
|
98
|
+
} catch (err) {
|
|
99
|
+
if (!(err instanceof Error) || !isInvalidDispatcherArg(err)) throw err;
|
|
100
|
+
response = await undiciFetch(url, init);
|
|
101
|
+
}
|
|
94
102
|
clearTimeout(timeout);
|
|
95
103
|
if (!response.ok) {
|
|
96
104
|
log.debug(`local LLM probe: ${url} returned HTTP ${response.status}`);
|
|
@@ -247,4 +255,4 @@ export {
|
|
|
247
255
|
localLlmBackendPoolExpiredAtMs,
|
|
248
256
|
markLocalLlmBackendPoolUnavailable
|
|
249
257
|
};
|
|
250
|
-
//# sourceMappingURL=chunk-
|
|
258
|
+
//# sourceMappingURL=chunk-NN3LMWKA.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/local-llm-helpers.ts"],"sourcesContent":["import type { ResponseFormatJSONSchema } from \"openai/resources/shared\";\nimport { fetch as undiciFetch, type Response as UndiciResponse } from \"undici\";\nimport { log } from \"./logger.js\";\nimport { directProbeDispatcher, isInvalidDispatcherArg, type TransportRequestInit } from \"./local-llm-transport.js\";\nimport type { LocalLlmRequestPriority } from \"./local-llm.js\";\n\nexport interface LocalLlmChatCompletionOptions {\n temperature?: number;\n maxTokens?: number;\n responseFormat?: { type: string } | ResponseFormatJSONSchema;\n timeoutMs?: number;\n operation?: string;\n forceDisableThinking?: boolean;\n disableThinking?: boolean;\n priority?: LocalLlmRequestPriority;\n signal?: AbortSignal;\n redactProviderErrors?: boolean;\n /** Per-request model; defaults to config.localLlmModel. */\n model?: string;\n /**\n * Optional out-box for the terminal failure cause (issue #2891): on a\n * failed request the client records the last provider error here so\n * callers can classify it (e.g. HTTP 429 → rate-limited) in memory\n * instead of seeing only null. Never logged.\n */\n failureDiag?: { lastError?: unknown; finishReason?: string };\n}\n\nexport interface LocalLlmChatCompletionResult {\n content: string;\n usage?: { promptTokens: number; completionTokens: number; totalTokens: number };\n}\nexport function isAbortError(err: unknown): boolean {\n if (!err || typeof err !== \"object\") return false;\n const maybe = err as { name?: string; message?: string };\n return (\n maybe.name === \"AbortError\" ||\n maybe.message === \"This operation was aborted\" ||\n maybe.message === \"The operation was aborted\"\n );\n}\n\n/** Caller signal combined with a client-wide shutdown signal, so a daemon\n * stop aborts in-flight requests and retry loops at once — even for\n * callers that pass no signal of their own. */\nexport function combineClientAbortSignals(\n caller: AbortSignal | undefined,\n shutdown: AbortSignal | undefined,\n): AbortSignal | undefined {\n if (shutdown === undefined) return caller;\n if (caller === undefined) return shutdown;\n return AbortSignal.any([caller, shutdown]);\n}\n\nexport function waitForRetryBackoff(backoffMs: number, signal?: AbortSignal): Promise<boolean> {\n return new Promise((resolve) => {\n let settled = false;\n let timer: NodeJS.Timeout | undefined;\n const onAbort = (): void => {\n if (settled) return;\n settled = true;\n if (timer) clearTimeout(timer);\n signal?.removeEventListener(\"abort\", onAbort);\n resolve(false);\n };\n const onTimer = (): void => {\n if (settled) return;\n settled = true;\n signal?.removeEventListener(\"abort\", onAbort);\n resolve(true);\n };\n timer = setTimeout(onTimer, backoffMs);\n if (signal) {\n if (signal.aborted) onAbort();\n else signal.addEventListener(\"abort\", onAbort, { once: true });\n }\n });\n}\n\nexport function normalizeBackendTripReason(reason: string): string {\n const cleaned = reason.replace(/\\s+/g, \" \").replace(/^[-:–—\\s]+/, \"\").trim();\n if (!cleaned) return \"unknown local backend failure\";\n return cleaned.length > 160 ? `${cleaned.slice(0, 157)}...` : cleaned;\n}\n\nexport function extractNonRecoverableBackendReason(reason: string): string | null {\n const match = reason.match(\n /Failed to load model|Library not loaded|different Team IDs|code signature|llm_engine_mlx_amphibian/i,\n );\n return match?.[0] ?? null;\n}\n\nexport function extractNonRecoverableBackendReasonFromErrorText(errorText: string): string | null {\n const directReason = extractNonRecoverableBackendReason(errorText);\n if (directReason) return directReason;\n try {\n const parsed = JSON.parse(errorText) as { error?: { message?: string } };\n return extractNonRecoverableBackendReason(parsed?.error?.message ?? \"\");\n } catch {\n return null;\n }\n}\n\n/**\n * Flatten a fetch rejection into one line, including the `cause` undici hides\n * the real reason behind (`fetch failed` alone says nothing).\n */\nexport function describeFetchFailure(err: unknown): string {\n const name = err instanceof Error ? err.name : \"\";\n const message = err instanceof Error ? err.message : String(err);\n const cause: unknown = err instanceof Error ? (err as Error & { cause?: unknown }).cause : undefined;\n const causeText = cause instanceof Error\n ? ` (cause: ${cause.name}: ${cause.message}${\n typeof (cause as Error & { code?: unknown }).code === \"string\"\n ? ` [${String((cause as Error & { code?: unknown }).code)}]`\n : \"\"\n })`\n : cause === undefined\n ? \"\"\n : ` (cause: ${String(cause)})`;\n return `${name ? `${name}: ` : \"\"}${message}${causeText}`;\n}\n\n/**\n * What to record when every availability probe failed.\n *\n * A probe that TIMED OUT is not evidence the backend is down: the budget is a\n * fixed 2s and a busy event loop can burn it before the socket is scheduled,\n * so the backend looks dead while it answers other callers in single-digit ms.\n * Caching that verdict took extraction offline for a whole health-check\n * interval at a time (issue #2210), so a timeout leaves availability UNKNOWN —\n * this call fails, the next one re-probes instead of reading a stale false.\n *\n * A backend that ANSWERED and said no is a real verdict and stays cached, or\n * the daemon re-probes a known-bad endpoint on every request.\n */\nexport function resolveUnavailableVerdict(args: {\n baseUrl: string;\n sawAbortedProbe: boolean;\n wasAvailable: boolean | null;\n}): { cacheVerdict: boolean; warning: string | null } {\n if (args.sawAbortedProbe) {\n return {\n cacheVerdict: false,\n warning:\n `local LLM availability probe timed out at ${args.baseUrl} (event loop busy?); treating availability as ` +\n \"unknown and re-probing on the next request rather than marking the backend down\",\n };\n }\n return {\n cacheVerdict: true,\n // Surfaced at warn, not debug: extraction stops silently when this flips,\n // and the daemon emits no debug at all unless configured for it.\n warning: args.wasAvailable !== false ? `local LLM became unavailable at ${args.baseUrl}` : null,\n };\n}\n\nexport interface ProbeFetchResult {\n ok: boolean;\n data: unknown;\n status: number | null;\n /** The probe hit its own budget rather than getting an answer. */\n aborted?: boolean;\n}\n\n/**\n * One health-probe request.\n *\n * Every failure is logged with its cause: a transport error and a 404 both\n * returned `ok: false` with nothing recorded, so an unreachable backend was\n * indistinguishable from a wrong path and an availability failure had no\n * diagnosable reason at all (§22, issue #2210).\n */\nexport async function probeFetch(\n url: string,\n options: { timeoutMs: number; headers: Record<string, string>; signal?: AbortSignal },\n): Promise<ProbeFetchResult> {\n const controller = new AbortController();\n const requestSignal = options.signal\n ? AbortSignal.any([options.signal, controller.signal])\n : controller.signal;\n const timeout = setTimeout(() => controller.abort(), options.timeoutMs);\n try {\n const init: TransportRequestInit = { signal: requestSignal, headers: options.headers };\n const dispatcher = directProbeDispatcher();\n if (dispatcher) init.dispatcher = dispatcher;\n let response: Response | UndiciResponse;\n try {\n response = await fetch(url, init);\n } catch (err) {\n // node >= 26 wraps dispatch failures in TypeError(\"fetch failed\"),\n // so UND_ERR_INVALID_ARG can ride `err` or its cause chain; the\n // bundled undici's fetch accepts the same init on every supported\n // Node, so direct-mode probes still run there.\n if (!(err instanceof Error) || !isInvalidDispatcherArg(err)) throw err;\n response = await undiciFetch(url, init);\n }\n clearTimeout(timeout);\n if (!response.ok) {\n log.debug(`local LLM probe: ${url} returned HTTP ${response.status}`);\n return { ok: false, data: null, status: response.status };\n }\n const contentType = response.headers.get(\"content-type\");\n const data = contentType?.includes(\"application/json\") ? await response.json() : await response.text();\n return { ok: true, data, status: response.status };\n } catch (err) {\n clearTimeout(timeout);\n const aborted = isAbortError(err);\n log.debug(\n `local LLM probe: ${url} ${aborted ? `timed out after ${options.timeoutMs}ms` : \"failed\"}: ${describeFetchFailure(err)}`,\n );\n return { ok: false, data: null, status: null, aborted };\n }\n}\n\ninterface PendingProbe {\n promise: Promise<boolean>;\n controller: AbortController;\n /** Callers still awaiting this sequence; at zero the sequence is aborted. */\n waiters: number;\n}\n\n/**\n * Collapses concurrent probe sequences onto one in-flight run.\n *\n * A timed-out availability probe deliberately caches nothing (issue #2210),\n * which removed the false verdict that used to absorb concurrent callers:\n * every queued request would then run its own full probe sequence, on a host\n * already slow enough to blow the probe budget.\n *\n * Cancellation is refcounted rather than shared: one caller walking away must\n * not abort a sequence the others are still waiting on, so the underlying task\n * is aborted only once every waiter has gone.\n */\nexport class SingleFlightProbe {\n private pending: PendingProbe | null = null;\n\n run(task: (signal: AbortSignal) => Promise<boolean>, signal?: AbortSignal): Promise<boolean> {\n let active = this.pending;\n if (!active) {\n const controller = new AbortController();\n const created: PendingProbe = { promise: Promise.resolve(false), controller, waiters: 0 };\n created.promise = task(controller.signal).finally(() => {\n if (this.pending === created) this.pending = null;\n });\n this.pending = created;\n active = created;\n }\n const entry = active;\n entry.waiters += 1;\n let released = false;\n const release = () => {\n if (released) return;\n released = true;\n entry.waiters -= 1;\n if (entry.waiters > 0) return;\n // Detach BEFORE aborting. `pending` would otherwise still point at this\n // doomed entry until the task's own `finally` runs a microtask later, and\n // a caller arriving in that window would join an aborted sequence and\n // read its `false` as a verdict.\n if (this.pending === entry) this.pending = null;\n entry.controller.abort();\n };\n if (!signal) return entry.promise.finally(release);\n return new Promise<boolean>((resolve, reject) => {\n const onAbort = () => {\n release();\n resolve(false);\n };\n signal.addEventListener(\"abort\", onAbort, { once: true });\n entry.promise.then(\n (value) => {\n signal.removeEventListener(\"abort\", onAbort);\n release();\n resolve(value);\n },\n (err: unknown) => {\n signal.removeEventListener(\"abort\", onAbort);\n release();\n reject(err instanceof Error ? err : new Error(String(err)));\n },\n );\n });\n }\n}\n\n/** True when `value` is safe for `fetch` request headers. Node's `Headers`\n * accepts a ByteString: controls and DEL are out, and so is anything above\n * U+00FF — `é` is sendable, `Ā` is not (Kilo review on #3474). */\nexport function isHttpHeaderFieldValue(value: string): boolean {\n if (!value) return false;\n for (let i = 0; i < value.length; i += 1) {\n const code = value.charCodeAt(i);\n if (code < 0x20 || code === 0x7f || code > 0xff) return false;\n }\n return true;\n}\n\nfunction trimTrailingSlashes(url: string): string {\n let end = url.length;\n while (end > 0 && url.charCodeAt(end - 1) === 47) end -= 1;\n return end === url.length ? url : url.slice(0, end);\n}\n\n/** Circuit-breaker and rate-limit scope when recall/extraction share one proxy URL. */\nexport function formatLocalLlmPoolKey(chatUrl: string, operation: string): string {\n let normalized = chatUrl.replace(\"localhost\", \"127.0.0.1\");\n normalized = trimTrailingSlashes(normalized);\n if (normalized.endsWith(\"/v1\")) {\n normalized = normalized.slice(0, -3);\n }\n const completions = normalized.endsWith(\"/chat/completions\")\n ? normalized\n : `${normalized}/v1/chat/completions`;\n return `${completions}|op=${operation}`;\n}\n\n/** HTTP headers the jarvis-ml recall proxy reads for pool routing. */\nexport function buildLocalLlmRoutingHeaders(\n operation: string,\n priority: \"recall-critical\" | \"background\" | undefined,\n): Record<string, string> {\n const routingEntries: Array<readonly [string, string]> = [\n [\"Content-Type\", \"application/json\"],\n ];\n if (operation !== \"unspecified\" && isHttpHeaderFieldValue(operation)) {\n routingEntries.push([\"X-Remnic-Operation\", operation]);\n }\n if (priority) {\n routingEntries.push([\"X-Remnic-Priority\", priority]);\n }\n return Object.fromEntries(routingEntries) satisfies Record<string, string>;\n}\n\nconst LOCAL_LLM_GLOBAL_BACKEND_STATE = \"__openclawEngramLocalLlmBackendState\";\n\nexport type LocalLlmBackendPoolState = {\n untilMs: number;\n reason: string;\n /** Once the trip lapses this is set instead of deleting the entry: every\n * client must observe the transition once, so a tombstone stays visible for\n * BACKEND_POOL_TOMBSTONE_MS. */\n expiredAtMs?: number;\n};\n\n/** How long a lapsed circuit stays readable so each client can invalidate its\n * cached health verdict once (the health cache is 60s; this leaves margin). */\nconst BACKEND_POOL_TOMBSTONE_MS = 15 * 60_000;\n\nfunction localLlmBackendPoolMap(): Map<string, LocalLlmBackendPoolState> {\n // SAFETY: globalThis carries one optional Map slot keyed for backend pool state.\n const globalAny = globalThis as typeof globalThis & {\n [LOCAL_LLM_GLOBAL_BACKEND_STATE]?: Map<string, LocalLlmBackendPoolState>;\n };\n const existing = globalAny[LOCAL_LLM_GLOBAL_BACKEND_STATE];\n if (existing) return existing;\n const created = new Map<string, LocalLlmBackendPoolState>();\n globalAny[LOCAL_LLM_GLOBAL_BACKEND_STATE] = created;\n return created;\n}\n\nexport function getLocalLlmTrippedBackendPoolState(\n now: number,\n chatUrl: string,\n operation: string,\n): LocalLlmBackendPoolState | null {\n const key = formatLocalLlmPoolKey(chatUrl, operation);\n const map = localLlmBackendPoolMap();\n const state = map.get(key) ?? null;\n if (!state) return null;\n if (state.untilMs <= now) {\n state.expiredAtMs ??= state.untilMs;\n if (state.expiredAtMs + BACKEND_POOL_TOMBSTONE_MS <= now) map.delete(key);\n return null;\n }\n return state;\n}\n\n/** The instant this pool's circuit lapsed, or null while it is active or\n * absent. The tombstone stays in the map so every client holding a cached\n * health verdict can observe the transition once — deleting on first read left\n * later clients stale (wAN review on #3474). */\nexport function localLlmBackendPoolExpiredAtMs(now: number, chatUrl: string, operation: string): number | null {\n const key = formatLocalLlmPoolKey(chatUrl, operation);\n const state = localLlmBackendPoolMap().get(key) ?? null;\n if (state && state.untilMs <= now) {\n state.expiredAtMs ??= state.untilMs;\n return state.expiredAtMs;\n }\n return null;\n}\n\nexport function markLocalLlmBackendPoolUnavailable(\n reason: string,\n durationMs: number,\n chatUrl: string,\n operation: string,\n): void {\n const normalizedReason = normalizeBackendTripReason(reason);\n const key = formatLocalLlmPoolKey(chatUrl, operation);\n if (durationMs > 0) {\n localLlmBackendPoolMap().set(key, { untilMs: Date.now() + durationMs, reason: normalizedReason });\n } else {\n localLlmBackendPoolMap().delete(key);\n }\n}\n"],"mappings":";;;;;;;;;AACA,SAAS,SAAS,mBAAoD;AA+B/D,SAAS,aAAa,KAAuB;AAClD,MAAI,CAAC,OAAO,OAAO,QAAQ,SAAU,QAAO;AAC5C,QAAM,QAAQ;AACd,SACE,MAAM,SAAS,gBACf,MAAM,YAAY,gCAClB,MAAM,YAAY;AAEtB;AAKO,SAAS,0BACd,QACA,UACyB;AACzB,MAAI,aAAa,OAAW,QAAO;AACnC,MAAI,WAAW,OAAW,QAAO;AACjC,SAAO,YAAY,IAAI,CAAC,QAAQ,QAAQ,CAAC;AAC3C;AAEO,SAAS,oBAAoB,WAAmB,QAAwC;AAC7F,SAAO,IAAI,QAAQ,CAAC,YAAY;AAC9B,QAAI,UAAU;AACd,QAAI;AACJ,UAAM,UAAU,MAAY;AAC1B,UAAI,QAAS;AACb,gBAAU;AACV,UAAI,MAAO,cAAa,KAAK;AAC7B,cAAQ,oBAAoB,SAAS,OAAO;AAC5C,cAAQ,KAAK;AAAA,IACf;AACA,UAAM,UAAU,MAAY;AAC1B,UAAI,QAAS;AACb,gBAAU;AACV,cAAQ,oBAAoB,SAAS,OAAO;AA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E;AAEvE,QAAM,YAAY;AAGlB,QAAM,WAAW,UAAU,8BAA8B;AACzD,MAAI,SAAU,QAAO;AACrB,QAAM,UAAU,oBAAI,IAAsC;AAC1D,YAAU,8BAA8B,IAAI;AAC5C,SAAO;AACT;AAEO,SAAS,mCACd,KACA,SACA,WACiC;AACjC,QAAM,MAAM,sBAAsB,SAAS,SAAS;AACpD,QAAM,MAAM,uBAAuB;AACnC,QAAM,QAAQ,IAAI,IAAI,GAAG,KAAK;AAC9B,MAAI,CAAC,MAAO,QAAO;AACnB,MAAI,MAAM,WAAW,KAAK;AACxB,UAAM,gBAAgB,MAAM;AAC5B,QAAI,MAAM,cAAc,6BAA6B,IAAK,KAAI,OAAO,GAAG;AACxE,WAAO;AAAA,EACT;AACA,SAAO;AACT;AAMO,SAAS,+BAA+B,KAAa,SAAiB,WAAkC;AAC7G,QAAM,MAAM,sBAAsB,SAAS,SAAS;AACpD,QAAM,QAAQ,uBAAuB,EAAE,IAAI,GAAG,KAAK;AACnD,MAAI,SAAS,MAAM,WAAW,KAAK;AACjC,UAAM,gBAAgB,MAAM;AAC5B,WAAO,MAAM;AAAA,EACf;AACA,SAAO;AACT;AAEO,SAAS,mCACd,QACA,YACA,SACA,WACM;AACN,QAAM,mBAAmB,2BAA2B,MAAM;AAC1D,QAAM,MAAM,sBAAsB,SAAS,SAAS;AACpD,MAAI,aAAa,GAAG;AAClB,2BAAuB,EAAE,IAAI,KAAK,EAAE,SAAS,KAAK,IAAI,IAAI,YAAY,QAAQ,iBAAiB,CAAC;AAAA,EAClG,OAAO;AACL,2BAAuB,EAAE,OAAO,GAAG;AAAA,EACrC;AACF;","names":[]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
isGenericRecallExcludedPath
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-GRX5BE73.js";
|
|
4
4
|
import {
|
|
5
5
|
normalizeProjectionPreview
|
|
6
6
|
} from "./chunk-SCU65EZI.js";
|
|
@@ -209,4 +209,4 @@ export {
|
|
|
209
209
|
browsePatternMatches,
|
|
210
210
|
runMemoryBrowse
|
|
211
211
|
};
|
|
212
|
-
//# sourceMappingURL=chunk-
|
|
212
|
+
//# sourceMappingURL=chunk-O6QSBI3U.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createSearchBackend
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-AXSQGJSG.js";
|
|
4
4
|
import {
|
|
5
5
|
reportSearchDegradation
|
|
6
6
|
} from "./chunk-FZF7JX76.js";
|
|
@@ -652,4 +652,4 @@ export {
|
|
|
652
652
|
normalizeQmdResultPath,
|
|
653
653
|
resolveNamespaceResultPath
|
|
654
654
|
};
|
|
655
|
-
//# sourceMappingURL=chunk-
|
|
655
|
+
//# sourceMappingURL=chunk-OA7YDB6A.js.map
|
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
} from "./chunk-KJTKLXTH.js";
|
|
4
4
|
import {
|
|
5
5
|
StorageManager
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-CIAQK2OU.js";
|
|
7
7
|
import {
|
|
8
8
|
assertInjectedStorageRooted
|
|
9
9
|
} from "./chunk-BNZAR6PO.js";
|
|
@@ -260,4 +260,4 @@ export {
|
|
|
260
260
|
backupExistingLedger,
|
|
261
261
|
rebuildMemoryLifecycleLedger
|
|
262
262
|
};
|
|
263
|
-
//# sourceMappingURL=chunk-
|
|
263
|
+
//# sourceMappingURL=chunk-PCGBESAN.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
OUTPUT_LANGUAGE_POLICY
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-RBPC4XGU.js";
|
|
4
4
|
import {
|
|
5
5
|
normalizeProcedureSteps
|
|
6
6
|
} from "./chunk-QDW3E4RD.js";
|
|
@@ -496,4 +496,4 @@ export {
|
|
|
496
496
|
createVerdictCache,
|
|
497
497
|
createDeferCountMap
|
|
498
498
|
};
|
|
499
|
-
//# sourceMappingURL=chunk-
|
|
499
|
+
//# sourceMappingURL=chunk-Q6S67LHR.js.map
|
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
} from "./chunk-EKUI7I2X.js";
|
|
11
11
|
import {
|
|
12
12
|
StorageManager
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-CIAQK2OU.js";
|
|
14
14
|
import {
|
|
15
15
|
normalizeEntityName
|
|
16
16
|
} from "./chunk-YXZG5TVN.js";
|
|
@@ -974,4 +974,4 @@ export {
|
|
|
974
974
|
resolveBriefingSaveDir,
|
|
975
975
|
briefingFilename
|
|
976
976
|
};
|
|
977
|
-
//# sourceMappingURL=chunk-
|
|
977
|
+
//# sourceMappingURL=chunk-QGT5KNQT.js.map
|
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
} from "./chunk-5HFVWYHL.js";
|
|
4
4
|
import {
|
|
5
5
|
isGenericRecallExcludedPath
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-GRX5BE73.js";
|
|
7
7
|
import {
|
|
8
8
|
planRecallMode
|
|
9
9
|
} from "./chunk-CSAKJVXW.js";
|
|
@@ -132,4 +132,4 @@ async function findExpectedMemory(orchestrator, namespaces, expect) {
|
|
|
132
132
|
export {
|
|
133
133
|
runRecallWhy
|
|
134
134
|
};
|
|
135
|
-
//# sourceMappingURL=chunk-
|
|
135
|
+
//# sourceMappingURL=chunk-QPD7EYGI.js.map
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
resolveDefaultNamespaceRoot
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-ATPY63F5.js";
|
|
4
4
|
import {
|
|
5
5
|
StorageManager
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-CIAQK2OU.js";
|
|
7
7
|
import {
|
|
8
8
|
composeLocationDayBody,
|
|
9
9
|
composeLocationDayMeta,
|
|
@@ -852,4 +852,4 @@ export {
|
|
|
852
852
|
LOCATION_SYNC_DEFAULT_INTERVAL_MS,
|
|
853
853
|
startLocationAutoSync
|
|
854
854
|
};
|
|
855
|
-
//# sourceMappingURL=chunk-
|
|
855
|
+
//# sourceMappingURL=chunk-QXHWOUS6.js.map
|
|
@@ -79,8 +79,34 @@ Span mode (numbered-message offsets):
|
|
|
79
79
|
- Set "content" to the frame text (the short \u226415-word frame) \u2014 do not restate the full fact; the span plus frame carry it.`}
|
|
80
80
|
- Invalid spans fall back to the frame, so keep the frame informative.`;
|
|
81
81
|
}
|
|
82
|
-
|
|
82
|
+
var KNOWN_ENTITIES_PROMPT_BUDGET_CHARS = 2e3;
|
|
83
|
+
var KNOWN_ENTITIES_HEADING = "\nKNOWN ENTITIES (use these exact names when referencing existing things):\n";
|
|
84
|
+
var KNOWN_ENTITIES_TRAILER = "\n\nWhen you see something that matches a known entity, use THAT name exactly. Only create a NEW entity if nothing in this list represents it.\n";
|
|
85
|
+
var KNOWN_ENTITIES_FRAMING_CHARS = KNOWN_ENTITIES_HEADING.length + KNOWN_ENTITIES_TRAILER.length;
|
|
86
|
+
function selectKnownEntitiesForPrompt(entities, conversation, budgetChars = KNOWN_ENTITIES_PROMPT_BUDGET_CHARS) {
|
|
87
|
+
if (entities.length === 0) return [];
|
|
88
|
+
if (entities.join(", ").length + KNOWN_ENTITIES_FRAMING_CHARS <= budgetChars) return [...entities];
|
|
89
|
+
const fold = (value) => value.toLowerCase().replace(/[-_]+/g, " ");
|
|
90
|
+
const foldedConversation = fold(conversation);
|
|
91
|
+
const mentioned = [];
|
|
92
|
+
const rest = [];
|
|
93
|
+
for (const name of entities) {
|
|
94
|
+
(foldedConversation.includes(fold(name)) ? mentioned : rest).push(name);
|
|
95
|
+
}
|
|
96
|
+
const selected = [];
|
|
97
|
+
let used = 0;
|
|
98
|
+
for (const name of [...mentioned, ...rest]) {
|
|
99
|
+
const cost = (selected.length > 0 ? 2 : 0) + name.length;
|
|
100
|
+
if (cost > budgetChars - KNOWN_ENTITIES_FRAMING_CHARS) continue;
|
|
101
|
+
if (used + cost > budgetChars - KNOWN_ENTITIES_FRAMING_CHARS) break;
|
|
102
|
+
selected.push(name);
|
|
103
|
+
used += cost;
|
|
104
|
+
}
|
|
105
|
+
return selected;
|
|
106
|
+
}
|
|
107
|
+
function buildExtractionInstructions(config, existingEntities, ambientCapture = false, conversation = "") {
|
|
83
108
|
const lifecycleCaps = resolveMemoryLifecycleCapabilities(config);
|
|
109
|
+
const knownEntities = selectKnownEntitiesForPrompt(existingEntities ?? [], conversation);
|
|
84
110
|
return `You are a memory extraction system. Analyze the following conversation and extract durable, reusable memories.
|
|
85
111
|
|
|
86
112
|
Memory categories:
|
|
@@ -137,12 +163,7 @@ Entity creation rules (STRICT):
|
|
|
137
163
|
- Prefer attaching facts to broad parent entities rather than creating sub-entities. E.g., "acme-store uses Algolia for search" is a fact on entity "acme-store", NOT a new entity "acme-store-algolia-connector"
|
|
138
164
|
- The entity list should be SHORT \u2014 think "things that would have their own Wikipedia page" not "things mentioned in passing"
|
|
139
165
|
|
|
140
|
-
${
|
|
141
|
-
KNOWN ENTITIES (use these exact names when referencing existing things):
|
|
142
|
-
${existingEntities.join(", ")}
|
|
143
|
-
|
|
144
|
-
When you see something that matches a known entity, use THAT name exactly. Only create a NEW entity if nothing in this list represents it.
|
|
145
|
-
` : ""}
|
|
166
|
+
${knownEntities.length > 0 ? KNOWN_ENTITIES_HEADING + knownEntities.join(", ") + KNOWN_ENTITIES_TRAILER : ""}
|
|
146
167
|
${eventTimePromptInstruction(config)}${spanModePromptSection(config.extraction?.spanMode ?? "off")}
|
|
147
168
|
Also extract relationships between entities mentioned in the conversation.
|
|
148
169
|
- Format: {source: "entity-name", target: "entity-name", label: "relationship description"}
|
|
@@ -213,10 +234,12 @@ export {
|
|
|
213
234
|
OUTPUT_LANGUAGE_POLICY,
|
|
214
235
|
eventTimePromptInstruction,
|
|
215
236
|
spanModePromptSection,
|
|
237
|
+
KNOWN_ENTITIES_PROMPT_BUDGET_CHARS,
|
|
238
|
+
selectKnownEntitiesForPrompt,
|
|
216
239
|
buildExtractionInstructions,
|
|
217
240
|
CONSOLIDATION_RESPONSE_SCHEMA,
|
|
218
241
|
PROFILE_CONSOLIDATION_RESPONSE_SCHEMA,
|
|
219
242
|
buildConsolidationSystemPrompt,
|
|
220
243
|
buildProfileConsolidationSystemPrompt
|
|
221
244
|
};
|
|
222
|
-
//# sourceMappingURL=chunk-
|
|
245
|
+
//# sourceMappingURL=chunk-RBPC4XGU.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/extraction-prompt.ts"],"sourcesContent":["/**\n * Extraction prompt construction (issue #1995 sibling extraction).\n *\n * The system prompt, its JSON response shape, and the placeholder table\n * derived from that shape are prompt DATA, not engine behavior. They live here\n * so `extraction.ts` holds the pipeline and one module owns the text every\n * extraction path — local LLM, direct client, gateway fallback — sends.\n */\n\nimport { AMBIENT_CAPTURE_PROMPT_SECTION, AMBIENT_SPECULATIVE_TIER_CLAUSE } from \"./ambient-provenance.js\";\nimport { resolveMemoryLifecycleCapabilities, resolveRecallAuxiliaryCapabilities } from \"./capabilities.js\";\nimport type { PluginConfig } from \"./types.js\";\n\nexport const EXTRACTION_RESPONSE_SHAPE = `{\n \"facts\": [{\n \"category\": \"<category>\",\n \"content\": \"<source-grounded statement>\",\n \"confidence\": 0.0,\n \"tags\": [\"<tag>\"],\n \"entityRef\": \"<optional normalized-name>\",\n \"cueAnchors\": [{\"type\": \"<anchor-type>\", \"value\": \"<entity-or-topic plus key aspect>\"}],\n \"promptedByQuestion\": \"<optional source-grounded question>\",\n \"quote\": \"<optional exact contiguous source span>\",\n \"scope\": \"<optional project-or-global>\",\n \"subject\": \"<optional user-or-agent>\",\n \"structuredAttributes\": {\"<key>\": \"<value>\"},\n \"procedureSteps\": [{\"order\": 1, \"intent\": \"<step>\"}, {\"order\": 2, \"intent\": \"<step>\"}],\n \"reasoningTrace\": {\n \"steps\": [{\"order\": 1, \"description\": \"<step>\"}, {\"order\": 2, \"description\": \"<step>\"}],\n \"finalAnswer\": \"<answer>\",\n \"observedOutcome\": \"<optional outcome>\"\n },\n \"eventTime\": \"<optional source temporal expression>\"\n }],\n \"entities\": [{\n \"name\": \"<normalized-name>\",\n \"type\": \"<entity-type>\",\n \"facts\": [\"<source-grounded statement>\"],\n \"promptedByQuestion\": \"<optional source-grounded question>\",\n \"structuredSections\": [{\"key\": \"<section-key>\", \"title\": \"<section-title>\", \"facts\": [\"<source-grounded statement>\"]}]\n }],\n \"profileUpdates\": [\"<source-grounded profile update>\"],\n \"questions\": [{\"question\": \"<source-grounded unresolved question>\", \"context\": \"<source-grounded context>\", \"priority\": 0.0}],\n \"identityReflection\": \"<conversation-grounded agent reflection>\",\n \"episodeTitle\": \"<six-to-eight word conversation segment title>\",\n \"relationships\": [{\"source\": \"<normalized-name>\", \"target\": \"<normalized-name>\", \"label\": \"<source-grounded relationship>\"}]\n}`;\nexport function extractionResponseShape(spanMode: \"off\" | \"shadow\" | \"on\" = \"off\"): string {\n if (spanMode === \"off\") return EXTRACTION_RESPONSE_SHAPE;\n return EXTRACTION_RESPONSE_SHAPE.replace(\n `\"eventTime\": \"<optional source temporal expression>\"`,\n `\"eventTime\": \"<optional source temporal expression>\",\n \"span\": {\"sourceMessageIndex\": <message number>, \"charStart\": <number>, \"charEnd\": <number>, \"frame\": \"<at most 15 words>\"}`,\n );\n}\nexport const EXTRACTION_RESPONSE_PLACEHOLDERS: Record<string, true> = {};\nfor (const shape of [EXTRACTION_RESPONSE_SHAPE, extractionResponseShape(\"on\")]) {\n for (const placeholder of shape.match(/<[^<>\\r\\n]+>/g) ?? []) {\n EXTRACTION_RESPONSE_PLACEHOLDERS[placeholder] = true;\n }\n}\nexport const CUE_ANCHOR_PROMPT_INSTRUCTION = `- For each fact, emit at most 3 \"cueAnchors\".\n- Each cue anchor value must be a source-grounded search hook of at most 120 characters, in the form \"<main entity or topic> <key aspect>\".\n- Set each cue anchor type to entity, file, tool, outcome, constraint, or date.\n- Omit cue anchors when the conversation does not support a useful search hook.\n- Example: \"Alice booked Bistro Max for Mike's surprise party\" can use {\"type\":\"entity\",\"value\":\"Mike surprise party\"} and {\"type\":\"entity\",\"value\":\"Alice restaurant booking\"}.`;\n\n/**\n * Output-language policy (issue #2190). Every prompt that produces memory\n * content embeds this verbatim so non-English conversations are not silently\n * translated to English — translated memories fail later lexical recall.\n */\nexport const OUTPUT_LANGUAGE_POLICY = `Output language: write facts, profile updates, entity names and aliases, tags, questions, and any rewritten or merged memory content in the source language of the conversation or input memories. Never translate into English or another language unless the user explicitly asked for a translation.`;\n\n/**\n * Bi-temporal event-time extraction instruction (#1578 PR2). Emitted on\n * every extraction entry path when `temporal.biTemporal` is on so the LLM\n * emits an optional per-fact `eventTime` expression. The expression is\n * resolved against the source turn timestamp at write time — never\n * wall-clock — so replay/import of old transcripts anchors correctly.\n * Returns an empty string when the gate is off (byte-identical prompt).\n */\nexport function eventTimePromptInstruction(config: PluginConfig): string {\n if (!config.temporalBiTemporal) return \"\";\n return `\nWhen a fact states when it became or stopped being true, copy that explicit temporal expression verbatim into \"eventTime\". Omit \"eventTime\" when no such expression appears; never infer dates.`;\n}\n\n/**\n * Span-mode extraction instructions (issue #2333 Phase B). Empty when the\n * mode is off (byte-identical prompt). The offset convention mirrors the\n * Phase A bench: messages numbered in order from 0, offsets index the\n * message's own text (after the `[role] ` tag), [charStart, charEnd)\n * end-exclusive.\n */\nexport function spanModePromptSection(spanMode: \"off\" | \"shadow\" | \"on\"): string {\n if (spanMode === \"off\") return \"\";\n const requestBoth = spanMode === \"shadow\";\n return `\nSpan mode (numbered-message offsets):\n- Conversation messages are numbered in order starting at 0 (the \"[role] text\" blocks).\n- For each fact, return \"span\": {\"sourceMessageIndex\": <message number>, \"charStart\": <number>, \"charEnd\": <number>, \"frame\": \"<at most 15 words>\"} pointing at the verbatim supporting words in that message's text (the text after the \"] \"). Offsets are [charStart, charEnd), end-exclusive, counting from the first character of the message text.\n- \"frame\" is at most 15 generated words that make the span self-contained: resolve pronouns to names, name the subject (e.g., frame \"Maya's relocation:\" + span \"moved to Seattle last spring…\").${\n requestBoth\n ? `\n- This run is in SHADOW mode: ALSO include the full standalone \"content\" restatement exactly as you would normally write it, in addition to \"span\".`\n : `\n- Set \"content\" to the frame text (the short ≤15-word frame) — do not restate the full fact; the span plus frame carry it.`\n }\n- Invalid spans fall back to the frame, so keep the frame informative.`;\n}\n\n/**\n * Char budget for the KNOWN ENTITIES block on gateway/direct extraction\n * prompts. Mature stores hold thousands of entities; the unbounded list ran\n * to ~200k chars on one production store — wider than the model's context —\n * so the carry-forward is capped, keeping conversation-mentioned names first.\n */\nexport const KNOWN_ENTITIES_PROMPT_BUDGET_CHARS = 2000;\n\n/** The rendered KNOWN ENTITIES block's fixed framing, kept in one place so\n * the selector's budget reserve matches the render exactly. */\nconst KNOWN_ENTITIES_HEADING =\n \"\\nKNOWN ENTITIES (use these exact names when referencing existing things):\\n\";\nconst KNOWN_ENTITIES_TRAILER =\n \"\\n\\nWhen you see something that matches a known entity, use THAT name exactly. Only create a NEW entity if nothing in this list represents it.\\n\";\nconst KNOWN_ENTITIES_FRAMING_CHARS =\n KNOWN_ENTITIES_HEADING.length + KNOWN_ENTITIES_TRAILER.length;\n\n/**\n * Select the entity names worth carrying into an extraction prompt: every\n * name the conversation mentions (hyphen/space/case-folded match), then the\n * remaining names in store order until the char budget is spent. Names the\n * conversation does not touch cannot be referenced by this extraction, so\n * dropping them past the budget never loses a canonical-name hint.\n */\nexport function selectKnownEntitiesForPrompt(\n entities: readonly string[],\n conversation: string,\n budgetChars = KNOWN_ENTITIES_PROMPT_BUDGET_CHARS,\n): string[] {\n if (entities.length === 0) return [];\n if (entities.join(\", \").length + KNOWN_ENTITIES_FRAMING_CHARS <= budgetChars) return [...entities];\n const fold = (value: string): string => value.toLowerCase().replace(/[-_]+/g, \" \");\n const foldedConversation = fold(conversation);\n const mentioned: string[] = [];\n const rest: string[] = [];\n for (const name of entities) {\n (foldedConversation.includes(fold(name)) ? mentioned : rest).push(name);\n }\n const selected: string[] = [];\n let used = 0;\n for (const name of [...mentioned, ...rest]) {\n const cost = (selected.length > 0 ? 2 : 0) + name.length;\n // Skip a single oversized name instead of aborting the fill — smaller\n // names behind it still deserve the budget.\n if (cost > budgetChars - KNOWN_ENTITIES_FRAMING_CHARS) continue;\n if (used + cost > budgetChars - KNOWN_ENTITIES_FRAMING_CHARS) break;\n selected.push(name);\n used += cost;\n }\n return selected;\n}\n\n/**\n * Build extraction instructions shared between local and cloud LLM.\n *\n * `ambientCapture` marks input from an always-on recorder, which may carry\n * speech the user never authored (issue #2294). `conversation` ranks the\n * KNOWN ENTITIES carry-forward mention-first under the char budget; callers\n * that omit it keep store order under the same budget.\n */\nexport function buildExtractionInstructions(\n config: PluginConfig,\n existingEntities?: string[],\n ambientCapture = false,\n conversation = \"\"\n): string {\n const lifecycleCaps = resolveMemoryLifecycleCapabilities(config);\n const knownEntities = selectKnownEntitiesForPrompt(existingEntities ?? [], conversation);\n return `You are a memory extraction system. Analyze the following conversation and extract durable, reusable memories.\n\nMemory categories:\n- fact: Objective information about the world\n- preference: User likes, dislikes, or stylistic choices\n- correction: User correcting a mistake or misconception (highest priority)\n- entity: Information about a specific person, project, tool, or company\n- decision: A choice that was made with rationale\n- relationship: How two entities relate to each other (e.g., \"Alice is Bob's manager\", \"Acme Corp uses Shopify\")\n- principle: Durable rules, values, or operating beliefs (e.g., \"never use Chat Completions API\")\n- commitment: Promises, obligations, or deadlines (e.g., \"deploy by Friday\", \"call accountant Monday\")\n- moment: Emotionally significant events or milestones (e.g., \"first successful deployment of engram\")\n- skill: Capabilities the user or agent has demonstrated (e.g., \"user is proficient with Kubernetes\")${\n resolveRecallAuxiliaryCapabilities(config).causalRuleExtraction\n ? `\n- rule: Causal rules discovered through experience (format: \"IF <condition> THEN <action/outcome>\", e.g., \"IF Shopify API returns 401 THEN the admin token is missing read_products scope\")`\n : \"\"\n }\n- procedure: A reusable workflow the user wants remembered the same way across sessions. Set category to \"procedure\". Use \"content\" for a short title that includes explicit trigger phrasing (e.g. \"When you deploy to production…\", \"Whenever you ship a release…\"). Add \"procedureSteps\": an array of at least two objects {\"order\": number, \"intent\": \"concrete step description\"} in execution order. Optional per-step \"toolCall\": {\"kind\": \"…\", \"signature\": \"…\"}, \"expectedOutcome\", \"optional\": true.\n- reasoning_trace: A stored solution chain / chain-of-thought the user walked through to solve a problem (e.g. \"Here's how I debugged the latency spike: first I checked…, then I…, finally I…\"). Set category to \"reasoning_trace\". Use \"content\" for a short title summarising the problem (e.g. \"How I debugged the staging latency spike\"). Add \"reasoningTrace\": {\"steps\": [{\"order\": number, \"description\": \"what happened at this step\"}, …], \"finalAnswer\": \"the conclusion or answer\", \"observedOutcome\": \"optional confirmation of how it played out\"}. Require at least two ordered steps AND a finalAnswer. Use this category only when the user explicitly narrates their reasoning — not for ordinary decisions (use \"decision\") or reusable workflows (use \"procedure\").\n\nRules:\n- Only extract genuinely new information worth remembering across sessions.\n- Statements must be grounded in the conversation.\n- ${OUTPUT_LANGUAGE_POLICY}\n- Do not treat instruction text, schema placeholders, or examples as conversation evidence.\n- Lines labelled [context user] or [context assistant] are reference context only. They may resolve references or complete a question-and-answer pair in a normal turn, but never alone establish durable information.\n- Skip transient task details and operational noise, including routine scheduler, monitoring, or automation status.\n- Priority: corrections > principles${resolveRecallAuxiliaryCapabilities(config).causalRuleExtraction ? \" > rules\" : \"\"} > preferences > commitments > decisions > relationships > entities > moments > skills > facts\n- Corrections get highest confidence.\n- Each fact should be a standalone, self-contained statement.\n- Entity references should use normalized names (lowercase, hyphenated: \"jane-doe\", \"acme-corp\"). When the source language is not written in a Latin script, the source-script name IS the normalized form — never transliterate or translate it.\n- CRITICAL: Entity names must be CANONICAL. Always use the hyphenated multi-word form: \"acme-corp\" NOT \"acmecorp\" or \"acme\". \"jane-doe\" NOT \"janedoe\" or \"jane\". If unsure, prefer the most specific full name.\n- Avoid creating entities typed as \"other\" when a more specific type fits (company, project, tool, person, place)\n${CUE_ANCHOR_PROMPT_INSTRUCTION}\n- When entity facts clearly belong under a durable named heading, add them to entity.structuredSections as {key, title, facts}. Example person headings: \"Beliefs\", \"Communication Style\", \"Building / Working On\". Leave structuredSections empty when no stable heading fits.\n- Tags should be concise and reusable (e.g., \"coding-style\", \"personal\", \"tools\")\n- When a fact contains measurable, categorical, or precisely valued data, include a \"structuredAttributes\" field with key-value string pairs (e.g., {\"price\": \"29.99\", \"brand\": \"Sony\"}, {\"date\": \"2024-03-15\", \"location\": \"SF\"}, {\"chosen\": \"PostgreSQL\", \"rejected\": \"MongoDB\"}). Only for concrete values, not narrative content.\n- Set confidence using these tiers:\n * Explicit (0.95-1.0): Direct user statements — \"I prefer X\", \"my name is Y\"\n * Implied (0.70-0.94): Strong contextual inference — user consistently does X, clear from conversation flow\n * Inferred (0.40-0.69): Pattern recognition — reasonable guess from limited evidence\n * Speculative (0.00-0.39): Tentative hypothesis — weak signal, needs future confirmation. Speculative memories auto-expire after 30 days if not confirmed.${ambientCapture ? AMBIENT_SPECULATIVE_TIER_CLAUSE : \"\"}${\n config.provenance?.enabled\n ? `\n- Source quotes: For each fact, include a \"quote\" field containing the EXACT verbatim words from the conversation that support the fact. Copy a contiguous span from a single speaker turn (not a paraphrase, not a summary). Cap at ~300 characters. This grounds every memory in the literal utterance that created it.`\n : \"\"\n }\n- For commitments: include any deadline or timeframe mentioned${\n lifecycleCaps.extractionScopeClassification\n ? `\n\nScope classification:\nFor each fact, set \"scope\" to one of:\n- \"global\" — knowledge that applies across projects: core framework/library bugs, API behavior patterns, user preferences (editor, language, style), general coding patterns, infrastructure knowledge, technology facts not tied to one codebase\n- \"project\" — knowledge specific to one codebase: file paths, environment configs, deployment details, project-specific workarounds, team/stakeholder info tied to one project, repo-specific conventions. Tool, command, or CLI-flag instructions TIED TO ONE AGENT are also \"project\", because the same tool name means different things in different agent integrations (a \"search\" tool may search repository code in one agent and the web in another); when keeping such an agent-tied instruction, the fact text MUST name the originating agent as a leading \"In <agent>,\" clause (e.g. \"In Pi, use the search tool with a repository path.\"). A tool/command fact that holds in every agent and every repo is NOT agent-tied — leave it \"global\" and do not add a qualifier (e.g. \"\\`git status --short\\` emits compact output\"). Examples: \"In Pi, the search tool takes a repository path\" -> \"project\"; \"\\`git status --short\\` emits compact output\" -> \"global\".\nWhen in doubt, prefer \"project\" — it is safer to keep knowledge scoped narrowly.`\n : \"\"\n }\n${\n ambientCapture\n ? `${AMBIENT_CAPTURE_PROMPT_SECTION}\n`\n : \"\"\n}\nEntity creation rules (STRICT):\n- Only create entities for DURABLE things: real people, companies, products, tools, ongoing projects\n- NEVER create entities for transient items: individual PRs, branches, Jira tickets, meetings, agent task IDs, log files, database tables, cron job runs, sessions\n- When you learn something about a transient item (e.g., PR #58 fixed a bug), store it as a FACT with an entityRef to the parent project — do NOT create an entity for the PR itself\n- Prefer attaching facts to broad parent entities rather than creating sub-entities. E.g., \"acme-store uses Algolia for search\" is a fact on entity \"acme-store\", NOT a new entity \"acme-store-algolia-connector\"\n- The entity list should be SHORT — think \"things that would have their own Wikipedia page\" not \"things mentioned in passing\"\n\n${\n knownEntities.length > 0\n ? KNOWN_ENTITIES_HEADING + knownEntities.join(\", \") + KNOWN_ENTITIES_TRAILER\n : \"\"\n}\n${eventTimePromptInstruction(config)}${spanModePromptSection(config.extraction?.spanMode ?? \"off\")}\nAlso extract relationships between entities mentioned in the conversation.\n- Format: {source: \"entity-name\", target: \"entity-name\", label: \"relationship description\"}\n- Max 5 relationships per extraction\n- Only include clear, durable relationships (e.g., \"works at\", \"created\", \"manages\", \"uses\")\n- Use normalized entity names (e.g., \"person-jane-doe\", \"company-acme-corp\")\n\n\nAlso emit \"episodeTitle\" as a six-to-eight word title for this conversation segment.\nQuestions are optional. Include only source-grounded unresolved questions that would be useful in future sessions; otherwise return an empty array.\n\nFinally, write a brief identity reflection about the agent who had this conversation, based only on the conversation. Do not write about the extraction process.`;\n}\n\nexport const CONSOLIDATION_RESPONSE_SCHEMA = `{\n \"items\": [\n {\n \"existingId\": \"id\",\n \"action\": \"ADD\",\n \"mergeWith\": \"optional-existing-id\",\n \"updatedContent\": \"optional replacement content\",\n \"reason\": \"brief reason for this action\"\n }\n ],\n \"profileUpdates\": [\"optional profile update\"],\n \"entityUpdates\": [{\"name\": \"person-jane-doe\", \"type\": \"person\", \"facts\": [\"Now leads the backend team\", \"Recently migrated the user service to TypeScript\"]}]\n}`;\n\nexport const PROFILE_CONSOLIDATION_RESPONSE_SCHEMA = `{\n \"consolidatedProfile\": \"# Behavioral Profile\\\\n\\\\n... (complete markdown)\",\n \"removedCount\": 42,\n \"summary\": \"brief summary of what was consolidated\"\n}`;\n\n/**\n * System prompt shared by every consolidation path (gateway, direct client,\n * local LLM). Owns the causal-rule clause and the output-language policy so\n * the three paths cannot drift (issue #2190).\n */\nexport function buildConsolidationSystemPrompt(config: PluginConfig): string {\n return `You are a memory consolidation system. Compare new memories against existing ones and decide what to do with each.\n\nActions:\n- ADD: Keep the new memory as-is (no duplicate exists)\n- MERGE: Combine with an existing memory (provide mergeWith ID and updated content)\n- UPDATE: Replace existing memory content (provide updated content)\n- INVALIDATE: Remove existing memory (it's been superseded or is wrong)\n- SKIP: This new memory is redundant (exact duplicate or subset of existing)\n\nAlso:\n- Suggest profile updates based on patterns across memories\n- Identify entity updates for entity tracking${resolveRecallAuxiliaryCapabilities(config).causalRuleExtraction ? `\n- When merging or updating memories, look for IF→THEN causal patterns. If a memory describes \"X failed/succeeded because Y\" or \"doing X led to Y\", rewrite its content to make the causal rule explicit in the form \"IF <condition> THEN <action/outcome>\".` : \"\"}\n- ${OUTPUT_LANGUAGE_POLICY}`;\n}\n\n/**\n * System prompt shared by every profile-consolidation path (gateway, direct\n * client, local LLM). Owns the output-language policy (issue #2190).\n */\nexport function buildProfileConsolidationSystemPrompt(targetLines: number): string {\n return `You are a profile consolidation system. You are given a behavioral profile (markdown) that has grown too large. Your job is to produce a CONSOLIDATED version that:\n\n1. PRESERVES all ## section headers and their structure\n2. MERGES duplicate or near-duplicate bullet points into single, clear statements\n3. REMOVES stale information that has been superseded by newer bullets\n4. REMOVES trivial or overly specific operational details that won't be useful across sessions\n5. KEEPS the most important, durable observations about the user's preferences, habits, identity, and working style\n6. Target roughly ${targetLines} lines — this is a soft target, prioritize quality over length\n7. Write in the same style as the existing profile — concise bullets, no fluff\n8. ${OUTPUT_LANGUAGE_POLICY}\n\nThe output should be the COMPLETE consolidated profile as valid markdown, starting with \"# Behavioral Profile\".`;\n}\n"],"mappings":";;;;;;;;;;AAaO,IAAM,4BAA4B;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAkClC,SAAS,wBAAwB,WAAoC,OAAe;AACzF,MAAI,aAAa,MAAO,QAAO;AAC/B,SAAO,0BAA0B;AAAA,IAC/B;AAAA,IACA;AAAA;AAAA,EAEF;AACF;AACO,IAAM,mCAAyD,CAAC;AACvE,WAAW,SAAS,CAAC,2BAA2B,wBAAwB,IAAI,CAAC,GAAG;AAC9E,aAAW,eAAe,MAAM,MAAM,eAAe,KAAK,CAAC,GAAG;AAC5D,qCAAiC,WAAW,IAAI;AAAA,EAClD;AACF;AACO,IAAM,gCAAgC;AAAA;AAAA;AAAA;AAAA;AAWtC,IAAM,yBAAyB;AAU/B,SAAS,2BAA2B,QAA8B;AACvE,MAAI,CAAC,OAAO,mBAAoB,QAAO;AACvC,SAAO;AAAA;AAET;AASO,SAAS,sBAAsB,UAA2C;AAC/E,MAAI,aAAa,MAAO,QAAO;AAC/B,QAAM,cAAc,aAAa;AACjC,SAAO;AAAA;AAAA;AAAA;AAAA,wMAKL,cACI;AAAA,uJAEA;AAAA,qIAEN;AAAA;AAEF;AAQ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M.js";
|
|
@@ -292,4 +292,4 @@ export {
|
|
|
292
292
|
computeServiceCorpusWatermarks,
|
|
293
293
|
computeServiceCorpusCensus
|
|
294
294
|
};
|
|
295
|
-
//# sourceMappingURL=chunk-
|
|
295
|
+
//# sourceMappingURL=chunk-RPOG6HLI.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
rebuildMemoryProjection,
|
|
3
3
|
watchProjectionRebuildParent
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-VQQZJ6KJ.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-RVODERA5.js.map
|
|
@@ -14,7 +14,7 @@ import {
|
|
|
14
14
|
} from "./chunk-TSUSHXBW.js";
|
|
15
15
|
import {
|
|
16
16
|
iterateOfflineSyncSnapshotFileRecords
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-SUI75NTN.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-SFWQZBPN.js.map
|
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
import {
|
|
13
13
|
applyChangesetEmbeddingGenerations,
|
|
14
14
|
normalizeChangesetGenerations
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-XHDS6HIX.js";
|
|
16
16
|
import {
|
|
17
17
|
advanceEmbeddingGenerationMarker,
|
|
18
18
|
applyIncomingEmbeddingGenerations,
|
|
@@ -22,7 +22,12 @@ import {
|
|
|
22
22
|
embeddingGenerationMembership,
|
|
23
23
|
isEmbeddingGenerationDirPath,
|
|
24
24
|
isPathInOmittedEmbeddingGeneration
|
|
25
|
-
} from "./chunk-
|
|
25
|
+
} from "./chunk-5AFBFAFX.js";
|
|
26
|
+
import {
|
|
27
|
+
isCanonicalRuntimeStatePath,
|
|
28
|
+
shouldDeleteAbsentIncomingOfflineRuntimeFile,
|
|
29
|
+
shouldPreferIncomingOfflineRuntimeFile
|
|
30
|
+
} from "./chunk-LDWE7OZS.js";
|
|
26
31
|
import {
|
|
27
32
|
isEmbeddingGenerationMarkerPath,
|
|
28
33
|
matchesOfflineSyncDefaultExclude
|
|
@@ -48,11 +53,6 @@ import {
|
|
|
48
53
|
sha256Bytes,
|
|
49
54
|
validateArchiveRelativePath
|
|
50
55
|
} from "./chunk-GCGJW34D.js";
|
|
51
|
-
import {
|
|
52
|
-
isCanonicalRuntimeStatePath,
|
|
53
|
-
shouldDeleteAbsentIncomingOfflineRuntimeFile,
|
|
54
|
-
shouldPreferIncomingOfflineRuntimeFile
|
|
55
|
-
} from "./chunk-LDWE7OZS.js";
|
|
56
56
|
import {
|
|
57
57
|
withEmbeddingGenerationLock,
|
|
58
58
|
withEmbeddingGenerationLockIter
|
|
@@ -1847,4 +1847,4 @@ export {
|
|
|
1847
1847
|
normalizeOfflineSyncState,
|
|
1848
1848
|
fileStatesFromSnapshot
|
|
1849
1849
|
};
|
|
1850
|
-
//# sourceMappingURL=chunk-
|
|
1850
|
+
//# sourceMappingURL=chunk-SUI75NTN.js.map
|
|
@@ -2,18 +2,18 @@ import {
|
|
|
2
2
|
ExtractionDrain,
|
|
3
3
|
TurnIngestionCoordinator,
|
|
4
4
|
shouldSkipImplicitExtraction
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-MTKSH7HY.js";
|
|
6
6
|
import {
|
|
7
7
|
headerConnector,
|
|
8
8
|
renderExtractionConversation,
|
|
9
9
|
resolveSourceConnector
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-6TIQLG7I.js";
|
|
11
11
|
import {
|
|
12
12
|
SmartBuffer
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-HL53XYHC.js";
|
|
14
14
|
import {
|
|
15
15
|
selfDeps
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-CIAQK2OU.js";
|
|
17
17
|
import {
|
|
18
18
|
describeError,
|
|
19
19
|
groupTurnsByExtractionScope
|
|
@@ -447,4 +447,4 @@ export {
|
|
|
447
447
|
ClaimBufferStorage,
|
|
448
448
|
BufferDrainRunner
|
|
449
449
|
};
|
|
450
|
-
//# sourceMappingURL=chunk-
|
|
450
|
+
//# sourceMappingURL=chunk-T3XOP7TA.js.map
|
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
} from "./chunk-YVUNHNB6.js";
|
|
11
11
|
import {
|
|
12
12
|
parseQmdExplain
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-D7HOJFDS.js";
|
|
14
14
|
import {
|
|
15
15
|
parseFlexibleIsoTimestamp
|
|
16
16
|
} from "./chunk-P7FMDTKL.js";
|
|
@@ -645,4 +645,4 @@ export {
|
|
|
645
645
|
appendMemoryToGraphContext,
|
|
646
646
|
resolvePersistedMemoryRelativePath
|
|
647
647
|
};
|
|
648
|
-
//# sourceMappingURL=chunk-
|
|
648
|
+
//# sourceMappingURL=chunk-T7R42MWB.js.map
|
|
@@ -14,7 +14,7 @@ import {
|
|
|
14
14
|
} from "./chunk-3UXOZBHV.js";
|
|
15
15
|
import {
|
|
16
16
|
StorageManager
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-CIAQK2OU.js";
|
|
18
18
|
import {
|
|
19
19
|
OKF_PROFILE_TYPE,
|
|
20
20
|
okfTypeForMemory
|
|
@@ -272,4 +272,4 @@ export {
|
|
|
272
272
|
exportOkfBundle,
|
|
273
273
|
firstHeading
|
|
274
274
|
};
|
|
275
|
-
//# sourceMappingURL=chunk-
|
|
275
|
+
//# sourceMappingURL=chunk-TAPF7T26.js.map
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
// src/extraction-entities-source.ts
|
|
2
|
+
function memoizeExistingEntities(source) {
|
|
3
|
+
if (Array.isArray(source)) {
|
|
4
|
+
return () => Promise.resolve(source);
|
|
5
|
+
}
|
|
6
|
+
let resolved;
|
|
7
|
+
return () => resolved ??= source?.() ?? Promise.resolve([]);
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export {
|
|
11
|
+
memoizeExistingEntities
|
|
12
|
+
};
|
|
13
|
+
//# sourceMappingURL=chunk-TK6EBBKG.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/extraction-entities-source.ts"],"sourcesContent":["/**\n * The entity carry-forward handed to `ExtractionEngine.extract`: either a\n * ready list or a thunk that lists it on demand. Only the gateway/direct\n * prompt paths read it, so local-first callers pass a thunk and never pay\n * the entity-store listing on the hot path. Extracted to a sibling module\n * per the size-ratchet rule (issue #1995).\n */\nexport type ExistingEntitiesSource = string[] | (() => Promise<string[]>);\n\n/** Thunk resolving at most once; array sources resolve to themselves. */\nexport function memoizeExistingEntities(\n source: ExistingEntitiesSource | undefined,\n): () => Promise<string[]> {\n if (Array.isArray(source)) {\n return () => Promise.resolve(source);\n }\n let resolved: Promise<string[]> | undefined;\n return () => (resolved ??= source?.() ?? Promise.resolve([]));\n}\n"],"mappings":";AAUO,SAAS,wBACd,QACyB;AACzB,MAAI,MAAM,QAAQ,MAAM,GAAG;AACzB,WAAO,MAAM,QAAQ,QAAQ,MAAM;AAAA,EACrC;AACA,MAAI;AACJ,SAAO,MAAO,aAAa,SAAS,KAAK,QAAQ,QAAQ,CAAC,CAAC;AAC7D;","names":[]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
parseFrontmatter
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-CIAQK2OU.js";
|
|
4
4
|
import {
|
|
5
5
|
activityDigestPath,
|
|
6
6
|
isValidActivityDate
|
|
@@ -199,4 +199,4 @@ export {
|
|
|
199
199
|
buildStandup,
|
|
200
200
|
standupHelp
|
|
201
201
|
};
|
|
202
|
-
//# sourceMappingURL=chunk-
|
|
202
|
+
//# sourceMappingURL=chunk-TQODBIMW.js.map
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
raceRecallAbort,
|
|
3
3
|
throwIfRecallAborted
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-T7R42MWB.js";
|
|
5
|
+
import {
|
|
6
|
+
memoizeExistingEntities
|
|
7
|
+
} from "./chunk-TK6EBBKG.js";
|
|
5
8
|
import {
|
|
6
9
|
emitExtractionLlmFailureError,
|
|
7
10
|
recordExtractionLlmFailure,
|
|
@@ -268,11 +271,13 @@ async function extractChunkedExtraction(engine, config, turns, existingEntities,
|
|
|
268
271
|
entities: [],
|
|
269
272
|
questions: []
|
|
270
273
|
};
|
|
271
|
-
const
|
|
274
|
+
const foundNames = [];
|
|
275
|
+
const baseEntities = memoizeExistingEntities(existingEntities);
|
|
276
|
+
const carryForward = async () => [...await baseEntities(), ...foundNames];
|
|
272
277
|
let skippedReason;
|
|
273
278
|
let providerCalls = 0;
|
|
274
279
|
for (const chunk of chunks) {
|
|
275
|
-
const part = await engine.extract(chunk,
|
|
280
|
+
const part = await engine.extract(chunk, carryForward, signal);
|
|
276
281
|
if (part.extractionFailure) return part;
|
|
277
282
|
if (part.extractionSkippedReason) {
|
|
278
283
|
skippedReason ??= part.extractionSkippedReason;
|
|
@@ -288,7 +293,7 @@ async function extractChunkedExtraction(engine, config, turns, existingEntities,
|
|
|
288
293
|
}
|
|
289
294
|
merged.identityReflection ??= part.identityReflection;
|
|
290
295
|
merged.episodeTitle ??= part.episodeTitle;
|
|
291
|
-
|
|
296
|
+
foundNames.push(...part.entities.map((entity) => entity.name));
|
|
292
297
|
}
|
|
293
298
|
if (resolveMemoryLifecycleCapabilities(config).extractionScopeClassification) {
|
|
294
299
|
merged.sourceConnector = deriveSourceConnector(turns);
|
|
@@ -958,10 +963,9 @@ ${normalized}`).digest("hex");
|
|
|
958
963
|
}
|
|
959
964
|
}
|
|
960
965
|
try {
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
);
|
|
966
|
+
let entityNamesPromise;
|
|
967
|
+
const existingEntities = () => entityNamesPromise ??= runDeadlineAware(() => storage.listEntityNames(), "during_list_entity_names", false);
|
|
968
|
+
if (extractionProbeOwned) await existingEntities();
|
|
965
969
|
let result;
|
|
966
970
|
const probe = startProbeDeadline(extractionProbeOwned, extractionAbortSignal, this.deps.halfOpenProbeTimeoutMs);
|
|
967
971
|
const engine = this.deps.getExtraction();
|
|
@@ -1242,4 +1246,4 @@ export {
|
|
|
1242
1246
|
ExtractionDeadlineError,
|
|
1243
1247
|
ExtractionRunCoordinator
|
|
1244
1248
|
};
|
|
1245
|
-
//# sourceMappingURL=chunk-
|
|
1249
|
+
//# sourceMappingURL=chunk-UWKHLWUE.js.map
|