@remnic/core 10.0.4 → 10.0.6
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 +49 -49
- package/dist/access-authorization-probe.js +50 -50
- package/dist/access-boundary.js +49 -49
- package/dist/access-cli.d.ts.map +1 -1
- package/dist/access-cli.js +120 -115
- package/dist/access-cli.js.map +1 -1
- package/dist/access-extraction-force-flush.js +49 -49
- package/dist/access-http-briefing.js +50 -50
- package/dist/access-http-query.js +51 -51
- package/dist/access-http.d.ts.map +1 -1
- package/dist/access-http.js +72 -71
- package/dist/access-identity-continuity-surface.js +49 -49
- package/dist/access-lcm-surface.js +49 -49
- package/dist/access-mcp-correction-tools.d.ts +10 -0
- package/dist/access-mcp-correction-tools.d.ts.map +1 -0
- package/dist/access-mcp-correction-tools.js +8 -0
- package/dist/access-mcp.d.ts.map +1 -1
- package/dist/access-mcp.js +63 -62
- package/dist/access-namespace-preflight.js +49 -49
- package/dist/access-observe-write-category.js +3 -3
- package/dist/access-observe-write-surface.js +49 -49
- package/dist/access-offline-manifest.js +5 -5
- package/dist/access-operations-batch.js +52 -52
- package/dist/access-operations.d.ts +1 -0
- package/dist/access-operations.d.ts.map +1 -1
- package/dist/access-operations.js +59 -59
- package/dist/access-recall-concurrency.js +49 -49
- package/dist/access-recall-diagnostics.js +2 -2
- package/dist/access-recall-response.js +49 -49
- package/dist/access-recall-surface.js +49 -49
- package/dist/access-service.d.ts.map +1 -1
- package/dist/access-service.js +49 -49
- package/dist/access-surface-catalog.js +51 -51
- package/dist/active-recall.js +22 -22
- package/dist/adapters/index.js +4 -4
- package/dist/adapters/registry.js +2 -2
- package/dist/auto-sync-FN7E3OTO.js +2 -2
- package/dist/briefing.js +18 -18
- package/dist/buffer.js +1 -1
- package/dist/calibration.d.ts +31 -3
- package/dist/calibration.d.ts.map +1 -1
- package/dist/calibration.js +67 -16
- package/dist/calibration.js.map +1 -1
- package/dist/causal-consolidation.js +18 -18
- package/dist/{chunk-5YDWSWBU.js → chunk-2CP577K6.js} +2 -2
- package/dist/{chunk-QVBB2CLG.js → chunk-2UF42WXV.js} +27 -26
- package/dist/chunk-2UF42WXV.js.map +1 -0
- package/dist/{chunk-ABET5LA5.js → chunk-37HCPM56.js} +23 -23
- package/dist/{chunk-HSZBALHV.js → chunk-4JNTGPBR.js} +2 -2
- package/dist/{chunk-H6FA36LC.js → chunk-4K2H4KTR.js} +5 -5
- package/dist/{chunk-H7BZBSP6.js → chunk-52II7PB6.js} +4 -4
- package/dist/{chunk-RH6MQ5NG.js → chunk-5BPXMAUP.js} +17 -68
- package/dist/chunk-5BPXMAUP.js.map +1 -0
- package/dist/{chunk-U3LVARGV.js → chunk-5X4ZJESN.js} +2 -2
- package/dist/{chunk-SNGNGH53.js → chunk-63UNVGZW.js} +4 -4
- package/dist/{chunk-2KB7TTAP.js → chunk-64S6X4IU.js} +4 -4
- package/dist/{chunk-MEMH5NKJ.js → chunk-6C76FZRM.js} +2 -2
- package/dist/{chunk-3QAIX7TV.js → chunk-6KHF6PAB.js} +2 -2
- package/dist/{chunk-MYBCB4AT.js → chunk-6T42L5FI.js} +2 -2
- package/dist/{chunk-XTWF5XR6.js → chunk-7CZIKCJR.js} +69 -69
- package/dist/{chunk-R6EOFKZG.js → chunk-7LYRFI5A.js} +2 -2
- package/dist/{chunk-4NFRYOHT.js → chunk-ANZXWOYD.js} +2 -2
- package/dist/{chunk-5XXTZ4Y7.js → chunk-B657ZGDH.js} +2 -2
- package/dist/{chunk-5QHTQMRL.js → chunk-CCMXCZLT.js} +8 -6
- package/dist/chunk-CCMXCZLT.js.map +1 -0
- package/dist/{chunk-NSQ3GUVO.js → chunk-CYEK6Z3P.js} +4 -4
- package/dist/{chunk-4DXVWBDB.js → chunk-D6M3VKMY.js} +4 -10
- package/dist/chunk-D6M3VKMY.js.map +1 -0
- package/dist/{chunk-IRYKRBEX.js → chunk-DJMVSUPK.js} +3 -3
- package/dist/{chunk-7OOW72QA.js → chunk-DTXN4NVD.js} +307 -138
- package/dist/chunk-DTXN4NVD.js.map +1 -0
- package/dist/{chunk-UCCB7RKF.js → chunk-EMVJU7WC.js} +2 -2
- package/dist/{chunk-IY7ZISXV.js → chunk-ENNC3RZ6.js} +2 -2
- package/dist/{chunk-QLK3SL7Q.js → chunk-ETSJD5IV.js} +131 -12
- package/dist/chunk-ETSJD5IV.js.map +1 -0
- package/dist/{chunk-PTFL3INS.js → chunk-FC6RCOIU.js} +2 -2
- package/dist/{chunk-CQQTEDHS.js → chunk-FLV7M7CT.js} +2 -2
- package/dist/{chunk-3SL52JKD.js → chunk-FZVROZKC.js} +5 -5
- package/dist/{chunk-Z2EVKNZR.js → chunk-GEGUBU3D.js} +2 -2
- package/dist/{chunk-LIGP5M2C.js → chunk-GF4H3B3R.js} +8 -8
- package/dist/{chunk-FMIVV5SV.js → chunk-I56MTWE7.js} +2 -2
- package/dist/{chunk-EUL3S3LE.js → chunk-J5WI4QRP.js} +4 -4
- package/dist/{chunk-436IRJUD.js → chunk-JA54KIYD.js} +2 -2
- package/dist/{chunk-QWNBQ2T5.js → chunk-JMF5Q4JY.js} +10 -10
- package/dist/{chunk-IDSSDL4W.js → chunk-JXSYWTFK.js} +21 -4
- package/dist/{chunk-IDSSDL4W.js.map → chunk-JXSYWTFK.js.map} +1 -1
- package/dist/{chunk-ABDTBGI2.js → chunk-KCCZFDJD.js} +2 -2
- package/dist/chunk-KIUVEMBI.js +49 -0
- package/dist/chunk-KIUVEMBI.js.map +1 -0
- package/dist/{chunk-IINXHPCV.js → chunk-KQI2PKYP.js} +2 -2
- package/dist/{chunk-ZOGZMAGI.js → chunk-KQT4DRKF.js} +2 -2
- package/dist/{chunk-RGPPNNDJ.js → chunk-KSUOM3YU.js} +9 -9
- package/dist/{chunk-CXG2T7BJ.js → chunk-KZEMFD6E.js} +3 -3
- package/dist/{chunk-O57VUN4U.js → chunk-L2VS27PZ.js} +2 -2
- package/dist/{chunk-IVGJXS5F.js → chunk-L34W4W4I.js} +2 -2
- package/dist/{chunk-MEP3POVW.js → chunk-L3PWXD73.js} +2 -2
- package/dist/{chunk-NQHSXHJP.js → chunk-L6GNS5GB.js} +2 -2
- package/dist/{chunk-QDKABMUE.js → chunk-MH2DXDN6.js} +2 -2
- package/dist/{chunk-DQJCQHII.js → chunk-MQNOIH2C.js} +6 -6
- package/dist/{chunk-IDSZNHIP.js → chunk-MULNBSPP.js} +4 -4
- package/dist/{chunk-BDHWKFGM.js → chunk-OFEHITAZ.js} +2 -2
- package/dist/{chunk-RYN4AIRM.js → chunk-OZABSIOV.js} +4 -4
- package/dist/{chunk-IXF7TRMQ.js → chunk-Q562GF7J.js} +2 -2
- package/dist/{chunk-H2XCCUOT.js → chunk-QEPL7KIZ.js} +15 -15
- package/dist/{chunk-WLC6XA6C.js → chunk-QGLEM46C.js} +16 -53
- package/dist/chunk-QGLEM46C.js.map +1 -0
- package/dist/{chunk-Y7CXM7UM.js → chunk-QMFKW4OU.js} +3 -3
- package/dist/{chunk-Z63GU5NN.js → chunk-QWWMS4AE.js} +1 -1
- package/dist/chunk-QWWMS4AE.js.map +1 -0
- package/dist/{chunk-R4O2G6ML.js → chunk-RSMIRLKM.js} +2 -2
- package/dist/{chunk-6AH2DDHI.js → chunk-S5TGRZWY.js} +2 -2
- package/dist/{chunk-TYOBAFCY.js → chunk-SNXBXYUE.js} +3 -3
- package/dist/{chunk-IHIP7TJ3.js → chunk-SWRN6U7Q.js} +2 -2
- package/dist/{chunk-DBA2W6VV.js → chunk-SZXPKUMN.js} +6 -6
- package/dist/{chunk-WQUGCOKF.js → chunk-TFA6HPOA.js} +4 -4
- package/dist/{chunk-DYRXRQHV.js → chunk-TL4PM7PC.js} +2 -2
- package/dist/{chunk-TSEUVMJL.js → chunk-TRBLJU6Y.js} +39 -39
- package/dist/{chunk-VWCFR4NR.js → chunk-U6OXJQEH.js} +5 -5
- package/dist/{chunk-YMXCJ7SE.js → chunk-VUEG3TZ4.js} +2 -2
- package/dist/{chunk-ORAL4HJC.js → chunk-WG4TMZJ2.js} +2 -2
- package/dist/{chunk-CV5AMCPX.js → chunk-XPRAOTJY.js} +2 -2
- package/dist/{chunk-RZCRXCLI.js → chunk-XQSJXNWC.js} +2 -2
- package/dist/{chunk-GLS3A4SQ.js → chunk-YGPXV546.js} +2 -2
- package/dist/{chunk-P22M3DX3.js → chunk-YJAOYEWI.js} +2 -2
- package/dist/{chunk-OAFRMLL4.js → chunk-YJEUHGZZ.js} +2 -2
- package/dist/cli.js +92 -91
- package/dist/coding/export-okf-codegraph.js +16 -16
- package/dist/compounding/engine.d.ts.map +1 -1
- package/dist/compounding/engine.js +17 -17
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +22 -22
- package/dist/connectors/codex-materialize-runner.js +17 -17
- package/dist/connectors/index.js +17 -17
- package/dist/consolidation-provenance-check.js +2 -2
- package/dist/contradiction/index.js +7 -7
- package/dist/convergence-refresh.js +19 -19
- package/dist/conversation-index/backend.js +2 -2
- package/dist/corpus-watermark.js +19 -19
- package/dist/correction/correction-access-wiring.d.ts +6 -6
- package/dist/correction/correction-access-wiring.d.ts.map +1 -1
- package/dist/correction/correction-classify.d.ts +25 -0
- package/dist/correction/correction-classify.d.ts.map +1 -0
- package/dist/correction/correction-config.d.ts +11 -0
- package/dist/correction/correction-config.d.ts.map +1 -0
- package/dist/correction/correction-contract.d.ts +13 -1
- package/dist/correction/correction-contract.d.ts.map +1 -1
- package/dist/correction/correction-executor.d.ts +2 -0
- package/dist/correction/correction-executor.d.ts.map +1 -1
- package/dist/correction/correction-planner.d.ts +24 -3
- package/dist/correction/correction-planner.d.ts.map +1 -1
- package/dist/entity-retrieval.js +17 -17
- package/dist/event-order-recall.js +2 -2
- package/dist/explicit-capture.js +2 -2
- package/dist/external-wiki-access.js +50 -50
- package/dist/extraction-span-materialize.js +2 -2
- package/dist/extraction.js +25 -25
- package/dist/harmonic-retrieval.js +17 -17
- package/dist/index.js +192 -191
- package/dist/lcm/index.js +3 -3
- package/dist/local-llm.d.ts.map +1 -1
- package/dist/local-llm.js +1 -1
- package/dist/location/index.js +19 -19
- package/dist/maintenance/memory-governance.js +17 -17
- package/dist/maintenance/rebuild-memory-lifecycle-ledger.js +17 -17
- package/dist/maintenance/rebuild-memory-projection-runner.js +19 -19
- package/dist/maintenance/rebuild-memory-projection.js +18 -18
- package/dist/memory-browse-operations.js +50 -50
- package/dist/memory-browse.js +1 -1
- package/dist/memory-subject.js +1 -1
- package/dist/namespaces/migrate.js +18 -18
- package/dist/namespaces/search.js +6 -6
- package/dist/namespaces/storage.js +17 -17
- package/dist/operator-doctor-corpus.js +20 -20
- package/dist/operator-toolkit.js +32 -32
- package/dist/orchestration/maintenance.js +28 -28
- package/dist/orchestration/session-context.d.ts.map +1 -1
- package/dist/orchestrator.js +116 -115
- 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 +50 -50
- package/dist/recall-navigation.js +49 -49
- package/dist/recall-why-service.js +2 -2
- 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/manifest.js +3 -3
- package/dist/{resolution-RSG4HZTL.js → resolution-TV3F7ZTH.js} +7 -7
- package/dist/resolution-TV3F7ZTH.js.map +1 -0
- package/dist/resume-bundles.js +23 -23
- package/dist/salvage-envelope.js +1 -1
- package/dist/search/factory.js +5 -5
- package/dist/search/index.js +9 -9
- package/dist/semantic-consolidation.js +23 -23
- package/dist/semantic-rule-promotion.js +17 -17
- package/dist/semantic-rule-verifier.js +17 -17
- package/dist/source-agent-qualifier.js +17 -17
- package/dist/standup/build.js +17 -17
- package/dist/storage.js +16 -16
- package/dist/subject-config.js +1 -1
- package/dist/summarizer.js +3 -3
- package/dist/support-passport/index.js +66 -66
- package/dist/transfer/export-okf.js +17 -17
- package/dist/types.d.ts +6 -23
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +1 -1
- package/dist/verified-recall.js +17 -17
- package/dist/who-knows-cli.js +18 -18
- package/dist/who-knows.js +17 -17
- package/dist/write-envelope.js +1 -1
- package/package.json +2 -2
- package/src/access-cli.ts +4 -0
- package/src/access-http.ts +1 -0
- package/src/access-mcp-correction-tools.ts +56 -0
- package/src/access-mcp.ts +4 -49
- package/src/access-operations.ts +3 -0
- package/src/access-service.ts +12 -21
- package/src/calibration-local-llm.test.ts +361 -0
- package/src/calibration.ts +109 -26
- package/src/compounding/engine.ts +2 -8
- package/src/config.test.ts +26 -0
- package/src/config.ts +4 -60
- package/src/correction/correction-access-wiring.ts +56 -16
- package/src/correction/correction-classify.test.ts +185 -0
- package/src/correction/correction-classify.ts +157 -0
- package/src/correction/correction-config.ts +93 -0
- package/src/correction/correction-contract.ts +61 -14
- package/src/correction/correction-executor.test.ts +102 -2
- package/src/correction/correction-executor.ts +19 -1
- package/src/correction/correction-planner.test.ts +141 -0
- package/src/correction/correction-planner.ts +117 -11
- package/src/correction/correction-surfaces.test.ts +22 -1
- package/src/local-llm-qos.test.ts +36 -0
- package/src/local-llm.ts +20 -3
- package/src/orchestration/session-context.ts +0 -15
- package/src/recall-handles-wiring.test.ts +24 -0
- package/src/types.ts +6 -23
- package/dist/chunk-4DXVWBDB.js.map +0 -1
- package/dist/chunk-5QHTQMRL.js.map +0 -1
- package/dist/chunk-7OOW72QA.js.map +0 -1
- package/dist/chunk-QLK3SL7Q.js.map +0 -1
- package/dist/chunk-QVBB2CLG.js.map +0 -1
- package/dist/chunk-RH6MQ5NG.js.map +0 -1
- package/dist/chunk-WLC6XA6C.js.map +0 -1
- package/dist/chunk-Z63GU5NN.js.map +0 -1
- /package/dist/{resolution-RSG4HZTL.js.map → access-mcp-correction-tools.js.map} +0 -0
- /package/dist/{chunk-5YDWSWBU.js.map → chunk-2CP577K6.js.map} +0 -0
- /package/dist/{chunk-ABET5LA5.js.map → chunk-37HCPM56.js.map} +0 -0
- /package/dist/{chunk-HSZBALHV.js.map → chunk-4JNTGPBR.js.map} +0 -0
- /package/dist/{chunk-H6FA36LC.js.map → chunk-4K2H4KTR.js.map} +0 -0
- /package/dist/{chunk-H7BZBSP6.js.map → chunk-52II7PB6.js.map} +0 -0
- /package/dist/{chunk-U3LVARGV.js.map → chunk-5X4ZJESN.js.map} +0 -0
- /package/dist/{chunk-SNGNGH53.js.map → chunk-63UNVGZW.js.map} +0 -0
- /package/dist/{chunk-2KB7TTAP.js.map → chunk-64S6X4IU.js.map} +0 -0
- /package/dist/{chunk-MEMH5NKJ.js.map → chunk-6C76FZRM.js.map} +0 -0
- /package/dist/{chunk-3QAIX7TV.js.map → chunk-6KHF6PAB.js.map} +0 -0
- /package/dist/{chunk-MYBCB4AT.js.map → chunk-6T42L5FI.js.map} +0 -0
- /package/dist/{chunk-XTWF5XR6.js.map → chunk-7CZIKCJR.js.map} +0 -0
- /package/dist/{chunk-R6EOFKZG.js.map → chunk-7LYRFI5A.js.map} +0 -0
- /package/dist/{chunk-4NFRYOHT.js.map → chunk-ANZXWOYD.js.map} +0 -0
- /package/dist/{chunk-5XXTZ4Y7.js.map → chunk-B657ZGDH.js.map} +0 -0
- /package/dist/{chunk-NSQ3GUVO.js.map → chunk-CYEK6Z3P.js.map} +0 -0
- /package/dist/{chunk-IRYKRBEX.js.map → chunk-DJMVSUPK.js.map} +0 -0
- /package/dist/{chunk-UCCB7RKF.js.map → chunk-EMVJU7WC.js.map} +0 -0
- /package/dist/{chunk-IY7ZISXV.js.map → chunk-ENNC3RZ6.js.map} +0 -0
- /package/dist/{chunk-PTFL3INS.js.map → chunk-FC6RCOIU.js.map} +0 -0
- /package/dist/{chunk-CQQTEDHS.js.map → chunk-FLV7M7CT.js.map} +0 -0
- /package/dist/{chunk-3SL52JKD.js.map → chunk-FZVROZKC.js.map} +0 -0
- /package/dist/{chunk-Z2EVKNZR.js.map → chunk-GEGUBU3D.js.map} +0 -0
- /package/dist/{chunk-LIGP5M2C.js.map → chunk-GF4H3B3R.js.map} +0 -0
- /package/dist/{chunk-FMIVV5SV.js.map → chunk-I56MTWE7.js.map} +0 -0
- /package/dist/{chunk-EUL3S3LE.js.map → chunk-J5WI4QRP.js.map} +0 -0
- /package/dist/{chunk-436IRJUD.js.map → chunk-JA54KIYD.js.map} +0 -0
- /package/dist/{chunk-QWNBQ2T5.js.map → chunk-JMF5Q4JY.js.map} +0 -0
- /package/dist/{chunk-ABDTBGI2.js.map → chunk-KCCZFDJD.js.map} +0 -0
- /package/dist/{chunk-IINXHPCV.js.map → chunk-KQI2PKYP.js.map} +0 -0
- /package/dist/{chunk-ZOGZMAGI.js.map → chunk-KQT4DRKF.js.map} +0 -0
- /package/dist/{chunk-RGPPNNDJ.js.map → chunk-KSUOM3YU.js.map} +0 -0
- /package/dist/{chunk-CXG2T7BJ.js.map → chunk-KZEMFD6E.js.map} +0 -0
- /package/dist/{chunk-O57VUN4U.js.map → chunk-L2VS27PZ.js.map} +0 -0
- /package/dist/{chunk-IVGJXS5F.js.map → chunk-L34W4W4I.js.map} +0 -0
- /package/dist/{chunk-MEP3POVW.js.map → chunk-L3PWXD73.js.map} +0 -0
- /package/dist/{chunk-NQHSXHJP.js.map → chunk-L6GNS5GB.js.map} +0 -0
- /package/dist/{chunk-QDKABMUE.js.map → chunk-MH2DXDN6.js.map} +0 -0
- /package/dist/{chunk-DQJCQHII.js.map → chunk-MQNOIH2C.js.map} +0 -0
- /package/dist/{chunk-IDSZNHIP.js.map → chunk-MULNBSPP.js.map} +0 -0
- /package/dist/{chunk-BDHWKFGM.js.map → chunk-OFEHITAZ.js.map} +0 -0
- /package/dist/{chunk-RYN4AIRM.js.map → chunk-OZABSIOV.js.map} +0 -0
- /package/dist/{chunk-IXF7TRMQ.js.map → chunk-Q562GF7J.js.map} +0 -0
- /package/dist/{chunk-H2XCCUOT.js.map → chunk-QEPL7KIZ.js.map} +0 -0
- /package/dist/{chunk-Y7CXM7UM.js.map → chunk-QMFKW4OU.js.map} +0 -0
- /package/dist/{chunk-R4O2G6ML.js.map → chunk-RSMIRLKM.js.map} +0 -0
- /package/dist/{chunk-6AH2DDHI.js.map → chunk-S5TGRZWY.js.map} +0 -0
- /package/dist/{chunk-TYOBAFCY.js.map → chunk-SNXBXYUE.js.map} +0 -0
- /package/dist/{chunk-IHIP7TJ3.js.map → chunk-SWRN6U7Q.js.map} +0 -0
- /package/dist/{chunk-DBA2W6VV.js.map → chunk-SZXPKUMN.js.map} +0 -0
- /package/dist/{chunk-WQUGCOKF.js.map → chunk-TFA6HPOA.js.map} +0 -0
- /package/dist/{chunk-DYRXRQHV.js.map → chunk-TL4PM7PC.js.map} +0 -0
- /package/dist/{chunk-TSEUVMJL.js.map → chunk-TRBLJU6Y.js.map} +0 -0
- /package/dist/{chunk-VWCFR4NR.js.map → chunk-U6OXJQEH.js.map} +0 -0
- /package/dist/{chunk-YMXCJ7SE.js.map → chunk-VUEG3TZ4.js.map} +0 -0
- /package/dist/{chunk-ORAL4HJC.js.map → chunk-WG4TMZJ2.js.map} +0 -0
- /package/dist/{chunk-CV5AMCPX.js.map → chunk-XPRAOTJY.js.map} +0 -0
- /package/dist/{chunk-RZCRXCLI.js.map → chunk-XQSJXNWC.js.map} +0 -0
- /package/dist/{chunk-GLS3A4SQ.js.map → chunk-YGPXV546.js.map} +0 -0
- /package/dist/{chunk-P22M3DX3.js.map → chunk-YJAOYEWI.js.map} +0 -0
- /package/dist/{chunk-OAFRMLL4.js.map → chunk-YJEUHGZZ.js.map} +0 -0
|
@@ -20,6 +20,7 @@ import "./chunk-45GF7Y3V.js";
|
|
|
20
20
|
import "./chunk-EP6BA7VV.js";
|
|
21
21
|
import "./chunk-E2AWJ7KQ.js";
|
|
22
22
|
import "./chunk-YCVB7X56.js";
|
|
23
|
+
import "./chunk-YBA52OKG.js";
|
|
23
24
|
import "./chunk-CLCMDKTB.js";
|
|
24
25
|
import "./chunk-353C5UNV.js";
|
|
25
26
|
import "./chunk-5AYUHSAU.js";
|
|
@@ -30,11 +31,10 @@ import "./chunk-C7HJ3NEI.js";
|
|
|
30
31
|
import "./chunk-N4PYB235.js";
|
|
31
32
|
import "./chunk-BTNNL7ZW.js";
|
|
32
33
|
import "./chunk-5FVVY2EB.js";
|
|
33
|
-
import "./chunk-FFAZ2XFU.js";
|
|
34
|
-
import "./chunk-YBA52OKG.js";
|
|
35
34
|
import "./chunk-JDSVLVCG.js";
|
|
36
35
|
import "./chunk-5GKPFL3S.js";
|
|
37
36
|
import "./chunk-JAKIDQB2.js";
|
|
37
|
+
import "./chunk-FFAZ2XFU.js";
|
|
38
38
|
import "./chunk-P7FMDTKL.js";
|
|
39
39
|
import "./chunk-2EMROIXS.js";
|
|
40
40
|
import "./chunk-ZEFVK7XC.js";
|
package/dist/briefing.js
CHANGED
|
@@ -18,31 +18,31 @@ import {
|
|
|
18
18
|
renderBriefingMarkdown,
|
|
19
19
|
resolveBriefingSaveDir,
|
|
20
20
|
validateBriefingFormat
|
|
21
|
-
} from "./chunk-
|
|
22
|
-
import "./chunk-6JMQR72P.js";
|
|
21
|
+
} from "./chunk-GF4H3B3R.js";
|
|
23
22
|
import "./chunk-GZFKCLRC.js";
|
|
24
|
-
import "./chunk-
|
|
23
|
+
import "./chunk-6JMQR72P.js";
|
|
24
|
+
import "./chunk-37HCPM56.js";
|
|
25
25
|
import "./chunk-46WM6JX2.js";
|
|
26
26
|
import "./chunk-UHVXE24Y.js";
|
|
27
27
|
import "./chunk-V4JZCTMK.js";
|
|
28
|
-
import "./chunk-
|
|
29
|
-
import "./chunk-
|
|
28
|
+
import "./chunk-RSMIRLKM.js";
|
|
29
|
+
import "./chunk-U6OXJQEH.js";
|
|
30
|
+
import "./chunk-T3FMRLWQ.js";
|
|
30
31
|
import "./chunk-7VO6E5UD.js";
|
|
31
32
|
import "./chunk-5BUCKFRE.js";
|
|
32
33
|
import "./chunk-S7LWX2PQ.js";
|
|
33
34
|
import "./chunk-T2YX56QI.js";
|
|
34
|
-
import "./chunk-CYEPCZN5.js";
|
|
35
|
-
import "./chunk-T3FMRLWQ.js";
|
|
36
35
|
import "./chunk-4O6WRBGE.js";
|
|
37
36
|
import "./chunk-GUMZC2BO.js";
|
|
38
|
-
import "./chunk-
|
|
37
|
+
import "./chunk-CYEPCZN5.js";
|
|
38
|
+
import "./chunk-TFA6HPOA.js";
|
|
39
|
+
import "./chunk-F4TWWUMP.js";
|
|
39
40
|
import "./chunk-72A4L5JJ.js";
|
|
40
41
|
import "./chunk-A7Q43EUZ.js";
|
|
41
|
-
import "./chunk-F4TWWUMP.js";
|
|
42
42
|
import "./chunk-S2V7RUCL.js";
|
|
43
43
|
import "./chunk-X3724WL4.js";
|
|
44
|
-
import "./chunk-S2HLHAZ4.js";
|
|
45
44
|
import "./chunk-MRPOZBJC.js";
|
|
45
|
+
import "./chunk-S2HLHAZ4.js";
|
|
46
46
|
import "./chunk-DM2T26WE.js";
|
|
47
47
|
import "./chunk-LDXUBPMO.js";
|
|
48
48
|
import "./chunk-FF6N7BXC.js";
|
|
@@ -54,9 +54,8 @@ import "./chunk-3OUGSOJP.js";
|
|
|
54
54
|
import "./chunk-SCU65EZI.js";
|
|
55
55
|
import "./chunk-3ONXXHQO.js";
|
|
56
56
|
import "./chunk-YXZG5TVN.js";
|
|
57
|
-
import "./chunk-6MKLMEBE.js";
|
|
58
57
|
import "./chunk-3WU7XOFN.js";
|
|
59
|
-
import "./chunk-
|
|
58
|
+
import "./chunk-6MKLMEBE.js";
|
|
60
59
|
import "./chunk-W5XWHTDO.js";
|
|
61
60
|
import "./chunk-M5GVCJSJ.js";
|
|
62
61
|
import "./chunk-RBOJCG4T.js";
|
|
@@ -64,6 +63,7 @@ import "./chunk-R7QY5ZVB.js";
|
|
|
64
63
|
import "./chunk-5WITETWU.js";
|
|
65
64
|
import "./chunk-6CIAGZ6X.js";
|
|
66
65
|
import "./chunk-7CT3AI52.js";
|
|
66
|
+
import "./chunk-G7D6GZ5J.js";
|
|
67
67
|
import "./chunk-AJ6ORARY.js";
|
|
68
68
|
import "./chunk-IUM3VSHI.js";
|
|
69
69
|
import "./chunk-G26YNEOC.js";
|
|
@@ -79,12 +79,14 @@ import "./chunk-L2EXJQJP.js";
|
|
|
79
79
|
import "./chunk-45GF7Y3V.js";
|
|
80
80
|
import "./chunk-EP6BA7VV.js";
|
|
81
81
|
import "./chunk-E2AWJ7KQ.js";
|
|
82
|
+
import "./chunk-Z7L72ZHL.js";
|
|
83
|
+
import "./chunk-4O4TKIXQ.js";
|
|
82
84
|
import "./chunk-YCVB7X56.js";
|
|
83
85
|
import "./chunk-PQVCH2AE.js";
|
|
84
86
|
import "./chunk-PJKTFXE2.js";
|
|
85
87
|
import "./chunk-W5BIQOAJ.js";
|
|
86
|
-
import "./chunk-
|
|
87
|
-
import "./chunk-
|
|
88
|
+
import "./chunk-QWWMS4AE.js";
|
|
89
|
+
import "./chunk-YBA52OKG.js";
|
|
88
90
|
import "./chunk-5AYUHSAU.js";
|
|
89
91
|
import "./chunk-BT7NVCML.js";
|
|
90
92
|
import "./chunk-PO7NXNGC.js";
|
|
@@ -97,17 +99,15 @@ import "./chunk-ZA53AZND.js";
|
|
|
97
99
|
import "./chunk-7RJUVTVF.js";
|
|
98
100
|
import "./chunk-AL3UYZ5N.js";
|
|
99
101
|
import "./chunk-RL6NEVXT.js";
|
|
102
|
+
import "./chunk-PWPIERBM.js";
|
|
100
103
|
import "./chunk-C7HJ3NEI.js";
|
|
101
104
|
import "./chunk-N4PYB235.js";
|
|
102
105
|
import "./chunk-BTNNL7ZW.js";
|
|
103
106
|
import "./chunk-5FVVY2EB.js";
|
|
104
|
-
import "./chunk-FFAZ2XFU.js";
|
|
105
|
-
import "./chunk-Z63GU5NN.js";
|
|
106
|
-
import "./chunk-YBA52OKG.js";
|
|
107
|
-
import "./chunk-PWPIERBM.js";
|
|
108
107
|
import "./chunk-JDSVLVCG.js";
|
|
109
108
|
import "./chunk-5GKPFL3S.js";
|
|
110
109
|
import "./chunk-JAKIDQB2.js";
|
|
110
|
+
import "./chunk-FFAZ2XFU.js";
|
|
111
111
|
import "./chunk-P7FMDTKL.js";
|
|
112
112
|
import "./chunk-VUFL7X3H.js";
|
|
113
113
|
import "./chunk-2EMROIXS.js";
|
package/dist/buffer.js
CHANGED
|
@@ -29,10 +29,10 @@ import "./chunk-C7HJ3NEI.js";
|
|
|
29
29
|
import "./chunk-N4PYB235.js";
|
|
30
30
|
import "./chunk-BTNNL7ZW.js";
|
|
31
31
|
import "./chunk-5FVVY2EB.js";
|
|
32
|
-
import "./chunk-FFAZ2XFU.js";
|
|
33
32
|
import "./chunk-JDSVLVCG.js";
|
|
34
33
|
import "./chunk-5GKPFL3S.js";
|
|
35
34
|
import "./chunk-JAKIDQB2.js";
|
|
35
|
+
import "./chunk-FFAZ2XFU.js";
|
|
36
36
|
import "./chunk-P7FMDTKL.js";
|
|
37
37
|
import "./chunk-OEIA4IHU.js";
|
|
38
38
|
import "./chunk-PCXDUHQH.js";
|
package/dist/calibration.d.ts
CHANGED
|
@@ -11,8 +11,7 @@
|
|
|
11
11
|
* - Temporal difference learning (dopamine signals prediction error)
|
|
12
12
|
* - Tesla FSD shadow mode (divergence between prediction and reality = training signal)
|
|
13
13
|
*/
|
|
14
|
-
import {
|
|
15
|
-
import type { AgentPersonaModelConfig, GatewayConfig } from "./types.js";
|
|
14
|
+
import type { AgentPersonaModelConfig, GatewayConfig, PluginConfig } from "./types.js";
|
|
16
15
|
export interface CalibrationRule {
|
|
17
16
|
id: string;
|
|
18
17
|
ruleType: "model_tendency" | "user_expectation" | "scope_boundary" | "verification_required";
|
|
@@ -48,12 +47,38 @@ export interface CorrectionMemory {
|
|
|
48
47
|
*/
|
|
49
48
|
export declare function readCalibrationCorrections(memoryDir: string): Promise<CorrectionMemory[]>;
|
|
50
49
|
export declare const CLUSTER_PROMPT = "You are analyzing user corrections to an AI assistant. Each correction represents a moment where the assistant's prediction of what the user wanted was WRONG.\n\nYour job: Group these corrections into clusters where the SAME TYPE of misunderstanding is happening. Then for each cluster, synthesize a CalibrationRule.\n\nA CalibrationRule describes:\n- condition: When does this type of mistake happen?\n- modelTendency: What does the model tend to assume or do wrong?\n- userExpectation: What does the user actually want instead?\n- calibration: How should the model adjust its behavior?\n- ruleType: One of \"model_tendency\", \"user_expectation\", \"scope_boundary\", \"verification_required\"\n\nFocus on PATTERNS, not individual corrections. A cluster needs at least 2 corrections to be worth a rule.\nOutput 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\nOutput valid JSON only:\n{\n \"rules\": [\n {\n \"ruleType\": \"model_tendency\",\n \"condition\": \"When discussing project scope or task boundaries\",\n \"modelTendency\": \"The model tends to assume broader scope than the user intends\",\n \"userExpectation\": \"The user prefers narrow, specific task definitions and wants to be asked before scope expansion\",\n \"calibration\": \"When uncertain about scope, ask for clarification rather than assuming. Default to the narrower interpretation.\",\n \"confidence\": 0.85,\n \"evidenceIds\": [\"correction-id-1\", \"correction-id-2\"]\n }\n ]\n}";
|
|
51
|
-
|
|
50
|
+
interface CalibrationChatClient {
|
|
51
|
+
chatCompletion(messages: Array<{
|
|
52
|
+
role: "system" | "user" | "assistant";
|
|
53
|
+
content: string;
|
|
54
|
+
}>, options?: {
|
|
55
|
+
temperature?: number;
|
|
56
|
+
maxTokens?: number;
|
|
57
|
+
agentId?: string;
|
|
58
|
+
modelChain?: AgentPersonaModelConfig;
|
|
59
|
+
}): Promise<{
|
|
60
|
+
content?: string | null;
|
|
61
|
+
} | null>;
|
|
62
|
+
}
|
|
63
|
+
export declare function synthesizeCalibrationRules(corrections: CorrectionMemory[], llm: CalibrationChatClient, existingRules: CalibrationRule[], agentId?: string, modelChain?: AgentPersonaModelConfig): Promise<CalibrationRule[]>;
|
|
52
64
|
/**
|
|
53
65
|
* Build a recall section from calibration rules relevant to the current query.
|
|
54
66
|
* Uses the LLM to select which rules apply to the current context.
|
|
55
67
|
*/
|
|
56
68
|
export declare function buildCalibrationRecallSection(rules: CalibrationRule[], query: string, maxChars?: number): string | null;
|
|
69
|
+
/**
|
|
70
|
+
* Options weekly compounding passes into calibration. Gateway agent and task
|
|
71
|
+
* chain fields stay limited to `modelSource: "gateway"`. `pluginConfig` carries
|
|
72
|
+
* the `localLlm*` settings used when that chain is empty.
|
|
73
|
+
*/
|
|
74
|
+
export declare function calibrationConsolidationInput(config: PluginConfig): {
|
|
75
|
+
memoryDir: string;
|
|
76
|
+
gatewayConfig?: GatewayConfig;
|
|
77
|
+
gatewayAgentId?: string;
|
|
78
|
+
modelChain?: AgentPersonaModelConfig;
|
|
79
|
+
workspaceDir?: string;
|
|
80
|
+
pluginConfig: PluginConfig;
|
|
81
|
+
};
|
|
57
82
|
/**
|
|
58
83
|
* Run the full calibration pipeline:
|
|
59
84
|
* 1. Read all corrections
|
|
@@ -67,6 +92,7 @@ export declare function runCalibrationConsolidation(options: {
|
|
|
67
92
|
gatewayAgentId?: string;
|
|
68
93
|
modelChain?: AgentPersonaModelConfig;
|
|
69
94
|
workspaceDir?: string;
|
|
95
|
+
pluginConfig?: PluginConfig;
|
|
70
96
|
}): Promise<CalibrationRule[]>;
|
|
71
97
|
/**
|
|
72
98
|
* Standalone entry point for calibration consolidation that can be called
|
|
@@ -82,10 +108,12 @@ export declare function runCalibrationIfEnabled(options: {
|
|
|
82
108
|
gatewayAgentId?: string;
|
|
83
109
|
modelChain?: AgentPersonaModelConfig;
|
|
84
110
|
workspaceDir?: string;
|
|
111
|
+
pluginConfig?: PluginConfig;
|
|
85
112
|
}): Promise<CalibrationRule[]>;
|
|
86
113
|
/**
|
|
87
114
|
* Get calibration rules for recall injection.
|
|
88
115
|
* Reads the pre-computed calibration index.
|
|
89
116
|
*/
|
|
90
117
|
export declare function getCalibrationRulesForRecall(memoryDir: string): Promise<CalibrationRule[]>;
|
|
118
|
+
export {};
|
|
91
119
|
//# sourceMappingURL=calibration.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"calibration.d.ts","sourceRoot":"","sources":["../src/calibration.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;
|
|
1
|
+
{"version":3,"file":"calibration.d.ts","sourceRoot":"","sources":["../src/calibration.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAWH,OAAO,KAAK,EAAE,uBAAuB,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAIvF,MAAM,WAAW,eAAe;IAC9B,EAAE,EAAE,MAAM,CAAC;IACX,QAAQ,EAAE,gBAAgB,GAAG,kBAAkB,GAAG,gBAAgB,GAAG,uBAAuB,CAAC;IAC7F,SAAS,EAAE,MAAM,CAAC;IAClB,aAAa,EAAE,MAAM,CAAC;IACtB,eAAe,EAAE,MAAM,CAAC;IACxB,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,MAAM,CAAC;IACnB,aAAa,EAAE,MAAM,CAAC;IACtB,qBAAqB,EAAE,MAAM,EAAE,CAAC;IAChC,SAAS,EAAE,MAAM,CAAC;IAClB,gBAAgB,EAAE,MAAM,CAAC;CAC1B;AAED,MAAM,WAAW,gBAAgB;IAC/B,KAAK,EAAE,eAAe,EAAE,CAAC;IACzB,SAAS,EAAE,MAAM,CAAC;IAClB,wBAAwB,EAAE,MAAM,CAAC;CAClC;AAYD,wBAAsB,oBAAoB,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAWvF;AAWD,MAAM,WAAW,gBAAgB;IAC/B,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,EAAE,CAAC;IACrB,IAAI,EAAE,MAAM,EAAE,CAAC;CAChB;AAyBD;;;;;GAKG;AACH,wBAAsB,0BAA0B,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,gBAAgB,EAAE,CAAC,CAE/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,aAAa,CAAC,EAAE,aAAa,CAAC;IAC9B,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,UAAU,CAAC,EAAE,uBAAuB,CAAC;IACrC,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,YAAY,CAAC,EAAE,YAAY,CAAC;CAC7B,GAAG,OAAO,CAAC,eAAe,EAAE,CAAC,CAsD7B;AAED;;;;;;GAMG;AACH,wBAAsB,uBAAuB,CAAC,OAAO,EAAE;IACrD,SAAS,EAAE,MAAM,CAAC;IAClB,kBAAkB,EAAE,OAAO,CAAC;IAC5B,aAAa,CAAC,EAAE,aAAa,CAAC;IAC9B,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,UAAU,CAAC,EAAE,uBAAuB,CAAC;IACrC,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,YAAY,CAAC,EAAE,YAAY,CAAC;CAC7B,GAAG,OAAO,CAAC,eAAe,EAAE,CAAC,CAY7B;AAED;;;GAGG;AACH,wBAAsB,4BAA4B,CAChD,SAAS,EAAE,MAAM,GAChB,OAAO,CAAC,eAAe,EAAE,CAAC,CAG5B"}
|
package/dist/calibration.js
CHANGED
|
@@ -2,6 +2,13 @@ import {
|
|
|
2
2
|
OUTPUT_LANGUAGE_POLICY
|
|
3
3
|
} from "./chunk-JLIGUFPF.js";
|
|
4
4
|
import "./chunk-QW27DOHG.js";
|
|
5
|
+
import {
|
|
6
|
+
LocalLlmClient
|
|
7
|
+
} from "./chunk-JXSYWTFK.js";
|
|
8
|
+
import "./chunk-QM2SPLKQ.js";
|
|
9
|
+
import "./chunk-U4LUIE6Y.js";
|
|
10
|
+
import "./chunk-JUXOTY6J.js";
|
|
11
|
+
import "./chunk-TOTT6S2V.js";
|
|
5
12
|
import {
|
|
6
13
|
FallbackLlmClient
|
|
7
14
|
} from "./chunk-TKC5LZ43.js";
|
|
@@ -11,7 +18,9 @@ import "./chunk-45GF7Y3V.js";
|
|
|
11
18
|
import "./chunk-EP6BA7VV.js";
|
|
12
19
|
import "./chunk-E2AWJ7KQ.js";
|
|
13
20
|
import "./chunk-YBA52OKG.js";
|
|
14
|
-
import
|
|
21
|
+
import {
|
|
22
|
+
resolveLocalLlmCapabilities
|
|
23
|
+
} from "./chunk-2EMROIXS.js";
|
|
15
24
|
import "./chunk-ZEFVK7XC.js";
|
|
16
25
|
import "./chunk-6KH5NLQS.js";
|
|
17
26
|
import "./chunk-P2QRMMVQ.js";
|
|
@@ -27,8 +36,8 @@ import "./chunk-PZ5AY32C.js";
|
|
|
27
36
|
|
|
28
37
|
// src/calibration.ts
|
|
29
38
|
import { createHash } from "crypto";
|
|
30
|
-
import path from "path";
|
|
31
39
|
import { mkdir, readFile, writeFile } from "fs/promises";
|
|
40
|
+
import path from "path";
|
|
32
41
|
function calibrationDir(memoryDir) {
|
|
33
42
|
return path.join(memoryDir, "state", "calibration");
|
|
34
43
|
}
|
|
@@ -151,6 +160,29 @@ Output valid JSON only:
|
|
|
151
160
|
}
|
|
152
161
|
]
|
|
153
162
|
}`;
|
|
163
|
+
function resolveCalibrationChatClient(options) {
|
|
164
|
+
const gateway = new FallbackLlmClient(options.gatewayConfig, {
|
|
165
|
+
workspaceDir: options.workspaceDir
|
|
166
|
+
});
|
|
167
|
+
if (gateway.isAvailable({ agentId: options.gatewayAgentId, modelChain: options.modelChain })) {
|
|
168
|
+
return gateway;
|
|
169
|
+
}
|
|
170
|
+
const pluginConfig = options.pluginConfig;
|
|
171
|
+
if (pluginConfig && resolveLocalLlmCapabilities(pluginConfig).localLlm) {
|
|
172
|
+
log.info(`[calibration] using configured local LLM (model=${pluginConfig.localLlmModel})`);
|
|
173
|
+
const local = new LocalLlmClient(pluginConfig);
|
|
174
|
+
return {
|
|
175
|
+
chatCompletion(messages, chatOptions) {
|
|
176
|
+
return local.chatCompletion(messages, {
|
|
177
|
+
temperature: chatOptions?.temperature,
|
|
178
|
+
maxTokens: chatOptions?.maxTokens
|
|
179
|
+
});
|
|
180
|
+
}
|
|
181
|
+
};
|
|
182
|
+
}
|
|
183
|
+
log.warn("[calibration] no LLM available \u2014 skipping consolidation");
|
|
184
|
+
return null;
|
|
185
|
+
}
|
|
154
186
|
async function synthesizeCalibrationRules(corrections, llm, existingRules, agentId, modelChain) {
|
|
155
187
|
if (corrections.length < 2) return [];
|
|
156
188
|
const correctionText = corrections.slice(0, 50).map((c, i) => `[${c.id}] ${c.content}`).join("\n\n");
|
|
@@ -161,9 +193,12 @@ ${existingRules.map((r) => `- ${r.condition}: ${r.calibration}`).join("\n")}` :
|
|
|
161
193
|
const response = await llm.chatCompletion(
|
|
162
194
|
[
|
|
163
195
|
{ role: "system", content: CLUSTER_PROMPT },
|
|
164
|
-
{
|
|
196
|
+
{
|
|
197
|
+
role: "user",
|
|
198
|
+
content: `Here are ${corrections.length} corrections from this user:
|
|
165
199
|
|
|
166
|
-
${correctionText}${existingRulesText}`
|
|
200
|
+
${correctionText}${existingRulesText}`
|
|
201
|
+
}
|
|
167
202
|
],
|
|
168
203
|
{ temperature: 0.3, maxTokens: 3e3, agentId, modelChain }
|
|
169
204
|
);
|
|
@@ -226,24 +261,36 @@ function buildCalibrationRecallSection(rules, query, maxChars = 1200) {
|
|
|
226
261
|
lines.push("");
|
|
227
262
|
return lines.join("\n");
|
|
228
263
|
}
|
|
264
|
+
function calibrationConsolidationInput(config) {
|
|
265
|
+
const gateway = config.modelSource === "gateway";
|
|
266
|
+
return {
|
|
267
|
+
memoryDir: config.memoryDir,
|
|
268
|
+
gatewayConfig: config.gatewayConfig,
|
|
269
|
+
gatewayAgentId: gateway ? config.gatewayAgentId || void 0 : void 0,
|
|
270
|
+
modelChain: gateway ? config.taskModelChain : void 0,
|
|
271
|
+
workspaceDir: config.workspaceDir,
|
|
272
|
+
pluginConfig: config
|
|
273
|
+
};
|
|
274
|
+
}
|
|
229
275
|
async function runCalibrationConsolidation(options) {
|
|
230
276
|
try {
|
|
231
|
-
const llm =
|
|
232
|
-
|
|
233
|
-
});
|
|
234
|
-
if (!llm.isAvailable({ agentId: options.gatewayAgentId, modelChain: options.modelChain })) {
|
|
235
|
-
log.debug("[calibration] no LLM available \u2014 skipping consolidation");
|
|
236
|
-
return [];
|
|
237
|
-
}
|
|
277
|
+
const llm = resolveCalibrationChatClient(options);
|
|
278
|
+
if (!llm) return [];
|
|
238
279
|
const corrections = await readCorrections(options.memoryDir);
|
|
239
280
|
if (corrections.length < 3) {
|
|
240
|
-
log.
|
|
281
|
+
log.info(`[calibration] only ${corrections.length} corrections \u2014 need at least 3`);
|
|
241
282
|
return [];
|
|
242
283
|
}
|
|
243
284
|
const existingIndex = await readCalibrationIndex(options.memoryDir);
|
|
244
|
-
const newRules = await synthesizeCalibrationRules(
|
|
285
|
+
const newRules = await synthesizeCalibrationRules(
|
|
286
|
+
corrections,
|
|
287
|
+
llm,
|
|
288
|
+
existingIndex.rules,
|
|
289
|
+
options.gatewayAgentId,
|
|
290
|
+
options.modelChain
|
|
291
|
+
);
|
|
245
292
|
if (newRules.length === 0) {
|
|
246
|
-
log.
|
|
293
|
+
log.info("[calibration] no new calibration rules synthesized");
|
|
247
294
|
return existingIndex.rules;
|
|
248
295
|
}
|
|
249
296
|
const ruleMap = new Map(existingIndex.rules.map((r) => [r.id, r]));
|
|
@@ -266,7 +313,9 @@ async function runCalibrationConsolidation(options) {
|
|
|
266
313
|
log.debug(`[calibration] synthesized ${newRules.length} new rule(s), ${allRules.length} total`);
|
|
267
314
|
return allRules;
|
|
268
315
|
} catch (error) {
|
|
269
|
-
log.warn(
|
|
316
|
+
log.warn(
|
|
317
|
+
`[calibration] consolidation failed (non-fatal): ${error instanceof Error ? error.message : String(error)}`
|
|
318
|
+
);
|
|
270
319
|
return [];
|
|
271
320
|
}
|
|
272
321
|
}
|
|
@@ -279,7 +328,8 @@ async function runCalibrationIfEnabled(options) {
|
|
|
279
328
|
gatewayConfig: options.gatewayConfig,
|
|
280
329
|
gatewayAgentId: options.gatewayAgentId,
|
|
281
330
|
modelChain: options.modelChain,
|
|
282
|
-
workspaceDir: options.workspaceDir
|
|
331
|
+
workspaceDir: options.workspaceDir,
|
|
332
|
+
pluginConfig: options.pluginConfig
|
|
283
333
|
});
|
|
284
334
|
}
|
|
285
335
|
async function getCalibrationRulesForRecall(memoryDir) {
|
|
@@ -289,6 +339,7 @@ async function getCalibrationRulesForRecall(memoryDir) {
|
|
|
289
339
|
export {
|
|
290
340
|
CLUSTER_PROMPT,
|
|
291
341
|
buildCalibrationRecallSection,
|
|
342
|
+
calibrationConsolidationInput,
|
|
292
343
|
getCalibrationRulesForRecall,
|
|
293
344
|
readCalibrationCorrections,
|
|
294
345
|
readCalibrationIndex,
|
package/dist/calibration.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/calibration.ts"],"sourcesContent":["/**\n * calibration.ts — Prediction-Error-Driven Model-User Calibration\n *\n * Analyzes patterns in user corrections to identify systematic miscalibration\n * between the model's predictions and the user's actual expectations.\n * During consolidation, replays chains of similar corrections through an LLM\n * to synthesize CalibrationRules that adjust model behavior for this specific user.\n *\n * Inspired by:\n * - Cerebellar motor calibration (prediction errors drive lasting adjustments)\n * - Temporal difference learning (dopamine signals prediction error)\n * - Tesla FSD shadow mode (divergence between prediction and reality = training signal)\n */\n\nimport { createHash } from \"node:crypto\";\nimport path from \"node:path\";\nimport { mkdir, readFile, writeFile } from \"node:fs/promises\";\nimport { FallbackLlmClient } from \"./fallback-llm.js\";\nimport type { AgentPersonaModelConfig, GatewayConfig, MemoryFile } from \"./types.js\";\nimport { listJsonFiles, readJsonFile } from \"./json-store.js\";\nimport { isRecord } from \"./store-contract.js\";\nimport { log } from \"./logger.js\";\nimport { OUTPUT_LANGUAGE_POLICY } from \"./extraction-prompt.js\";\n\n// ─── Types ───────────────────────────────────────────────────────────────────\n\nexport interface CalibrationRule {\n id: string;\n ruleType: \"model_tendency\" | \"user_expectation\" | \"scope_boundary\" | \"verification_required\";\n condition: string;\n modelTendency: string;\n userExpectation: string;\n calibration: string;\n confidence: number;\n evidenceCount: number;\n evidenceCorrectionIds: string[];\n createdAt: string;\n lastReinforcedAt: string;\n}\n\nexport interface CalibrationIndex {\n rules: CalibrationRule[];\n updatedAt: string;\n totalCorrectionsAnalyzed: number;\n}\n\n// ─── Storage ─────────────────────────────────────────────────────────────────\n\nfunction calibrationDir(memoryDir: string): string {\n return path.join(memoryDir, \"state\", \"calibration\");\n}\n\nfunction calibrationIndexPath(memoryDir: string): string {\n return path.join(calibrationDir(memoryDir), \"calibration-index.json\");\n}\n\nexport async function readCalibrationIndex(memoryDir: string): Promise<CalibrationIndex> {\n try {\n const raw = JSON.parse(await readFile(calibrationIndexPath(memoryDir), \"utf8\"));\n return {\n rules: Array.isArray(raw.rules) ? raw.rules : [],\n updatedAt: typeof raw.updatedAt === \"string\" ? raw.updatedAt : new Date().toISOString(),\n totalCorrectionsAnalyzed: typeof raw.totalCorrectionsAnalyzed === \"number\" ? raw.totalCorrectionsAnalyzed : 0,\n };\n } catch {\n return { rules: [], updatedAt: new Date().toISOString(), totalCorrectionsAnalyzed: 0 };\n }\n}\n\nasync function writeCalibrationIndex(memoryDir: string, index: CalibrationIndex): Promise<void> {\n const dir = calibrationDir(memoryDir);\n await mkdir(dir, { recursive: true });\n index.updatedAt = new Date().toISOString();\n await writeFile(calibrationIndexPath(memoryDir), JSON.stringify(index, null, 2), \"utf8\");\n}\n\n// ─── Correction Reading ──────────────────────────────────────────────────────\n\nexport interface CorrectionMemory {\n id: string;\n content: string;\n created: string;\n confidence: number;\n entityRefs: string[];\n tags: string[];\n}\n\nconst CALIBRATION_RULE_TYPES = new Set([\n \"model_tendency\",\n \"user_expectation\",\n \"scope_boundary\",\n \"verification_required\",\n]);\n\nfunction parseConfidence(value: unknown): number | undefined {\n if (typeof value !== \"number\" || !Number.isFinite(value)) return undefined;\n return Math.max(0, Math.min(1, value));\n}\n\nfunction parseEvidenceIds(value: unknown): string[] {\n if (!Array.isArray(value)) return [];\n return value.filter((item): item is string => typeof item === \"string\" && item.trim().length > 0);\n}\n\nfunction nonEmptyString(value: unknown): string | undefined {\n if (typeof value !== \"string\") return undefined;\n const trimmed = value.trim();\n return trimmed.length > 0 ? trimmed : undefined;\n}\n\n/**\n * Exported for entity-contamination R-11 regression coverage (#682\n * PR 2/3 — codex review). Tests can drive the real correction-reading\n * path instead of duplicating the regex inline, so calibration parser\n * regressions surface via the contamination suite.\n */\nexport async function readCalibrationCorrections(memoryDir: string): Promise<CorrectionMemory[]> {\n return readCorrectionsImpl(memoryDir);\n}\n\nasync function readCorrections(memoryDir: string): Promise<CorrectionMemory[]> {\n return readCorrectionsImpl(memoryDir);\n}\n\nasync function readCorrectionsImpl(memoryDir: string): Promise<CorrectionMemory[]> {\n const correctionsDir = path.join(memoryDir, \"corrections\");\n const files = await listJsonFiles(correctionsDir).catch(() => {\n // Corrections might be in facts/ directories too\n return [] as string[];\n });\n\n // Also scan facts directories for correction-category files\n const factsDir = path.join(memoryDir, \"facts\");\n try {\n const { readdir } = await import(\"node:fs/promises\");\n const dayDirs = (await readdir(factsDir)).filter((d: string) => /^\\d{4}-\\d{2}-\\d{2}$/.test(d));\n for (const day of dayDirs) {\n const dayPath = path.join(factsDir, day);\n const dayFiles = (await readdir(dayPath))\n .filter((f: string) => f.startsWith(\"correction-\") && f.endsWith(\".md\"))\n .map((f: string) => path.join(dayPath, f));\n files.push(...dayFiles);\n }\n } catch {\n // facts dir might not exist\n }\n\n // Also check the dedicated corrections directory\n try {\n const { readdir } = await import(\"node:fs/promises\");\n const corrFiles = (await readdir(correctionsDir))\n .filter((f: string) => f.endsWith(\".md\"))\n .map((f: string) => path.join(correctionsDir, f));\n files.push(...corrFiles);\n } catch {\n // corrections dir might not exist\n }\n\n const corrections: CorrectionMemory[] = [];\n const seen = new Set<string>();\n\n for (const filePath of files) {\n try {\n const raw = await readFile(filePath, \"utf8\");\n\n // Parse frontmatter\n const fmMatch = raw.match(/^---\\n([\\s\\S]*?)\\n---\\n([\\s\\S]*)$/);\n if (!fmMatch) continue;\n\n const content = fmMatch[2].trim();\n if (!content || content.length < 10) continue;\n\n // Extract id from frontmatter\n const idMatch = fmMatch[1].match(/^id:\\s*(.+)$/m);\n const id = idMatch?.[1]?.trim() ?? path.basename(filePath, \".md\");\n\n if (seen.has(id)) continue;\n seen.add(id);\n\n const confMatch = fmMatch[1].match(/^confidence:\\s*(.+)$/m);\n const confidence = confMatch ? parseFloat(confMatch[1]) : 0.9;\n\n const entityMatch = fmMatch[1].match(/^entityRef:\\s*(.+)$/m);\n const entityRefs = entityMatch ? [entityMatch[1].trim()] : [];\n\n corrections.push({ id, content, created: \"\", confidence, entityRefs, tags: [] });\n } catch {\n // skip unparseable files\n }\n }\n\n return corrections;\n}\n\n// ─── LLM-Assisted Clustering and Replay ──────────────────────────────────────\n\nexport const CLUSTER_PROMPT = `You are analyzing user corrections to an AI assistant. Each correction represents a moment where the assistant's prediction of what the user wanted was WRONG.\n\nYour job: Group these corrections into clusters where the SAME TYPE of misunderstanding is happening. Then for each cluster, synthesize a CalibrationRule.\n\nA CalibrationRule describes:\n- condition: When does this type of mistake happen?\n- modelTendency: What does the model tend to assume or do wrong?\n- userExpectation: What does the user actually want instead?\n- calibration: How should the model adjust its behavior?\n- ruleType: One of \"model_tendency\", \"user_expectation\", \"scope_boundary\", \"verification_required\"\n\nFocus on PATTERNS, not individual corrections. A cluster needs at least 2 corrections to be worth a rule.\n${OUTPUT_LANGUAGE_POLICY}\n\nOutput valid JSON only:\n{\n \"rules\": [\n {\n \"ruleType\": \"model_tendency\",\n \"condition\": \"When discussing project scope or task boundaries\",\n \"modelTendency\": \"The model tends to assume broader scope than the user intends\",\n \"userExpectation\": \"The user prefers narrow, specific task definitions and wants to be asked before scope expansion\",\n \"calibration\": \"When uncertain about scope, ask for clarification rather than assuming. Default to the narrower interpretation.\",\n \"confidence\": 0.85,\n \"evidenceIds\": [\"correction-id-1\", \"correction-id-2\"]\n }\n ]\n}`;\n\nexport async function synthesizeCalibrationRules(\n corrections: CorrectionMemory[],\n llm: FallbackLlmClient,\n existingRules: CalibrationRule[],\n agentId?: string,\n modelChain?: AgentPersonaModelConfig,\n): Promise<CalibrationRule[]> {\n if (corrections.length < 2) return [];\n\n // Format corrections for the LLM\n const correctionText = corrections\n .slice(0, 50) // limit to avoid huge prompts\n .map((c, i) => `[${c.id}] ${c.content}`)\n .join(\"\\n\\n\");\n\n const existingRulesText = existingRules.length > 0\n ? `\\n\\nExisting calibration rules (avoid duplicating these):\\n${existingRules.map((r) => `- ${r.condition}: ${r.calibration}`).join(\"\\n\")}`\n : \"\";\n\n const response = await llm.chatCompletion(\n [\n { role: \"system\", content: CLUSTER_PROMPT },\n { role: \"user\", content: `Here are ${corrections.length} corrections from this user:\\n\\n${correctionText}${existingRulesText}` },\n ],\n { temperature: 0.3, maxTokens: 3000, agentId, modelChain },\n );\n\n if (!response?.content) return [];\n\n try {\n let jsonStr = response.content.trim();\n const fenceMatch = jsonStr.match(/```(?:json)?\\s*\\n?([\\s\\S]*?)\\n?\\s*```/);\n if (fenceMatch) jsonStr = fenceMatch[1];\n\n const parsed = JSON.parse(jsonStr);\n if (!Array.isArray(parsed.rules)) return [];\n\n const now = new Date().toISOString();\n const rawRules: unknown[] = Array.isArray(parsed.rules) ? parsed.rules : [];\n return rawRules\n .map((r: unknown): CalibrationRule | undefined => {\n if (!r || typeof r !== \"object\" || Array.isArray(r)) return undefined;\n const raw = r as Record<string, unknown>;\n const ruleType = nonEmptyString(raw.ruleType);\n const condition = nonEmptyString(raw.condition);\n const modelTendency = nonEmptyString(raw.modelTendency);\n const calibration = nonEmptyString(raw.calibration);\n const confidence = parseConfidence(raw.confidence);\n if (\n !ruleType ||\n !CALIBRATION_RULE_TYPES.has(ruleType) ||\n !condition ||\n !modelTendency ||\n !calibration ||\n confidence === undefined\n ) {\n return undefined;\n }\n const evidenceCorrectionIds = parseEvidenceIds(raw.evidenceIds);\n return {\n id: `cal-${createHash(\"sha256\").update(condition + calibration).digest(\"hex\").slice(0, 12)}`,\n ruleType: ruleType as CalibrationRule[\"ruleType\"],\n condition,\n modelTendency,\n userExpectation: nonEmptyString(raw.userExpectation) ?? \"\",\n calibration,\n confidence,\n evidenceCount: evidenceCorrectionIds.length,\n evidenceCorrectionIds,\n createdAt: now,\n lastReinforcedAt: now,\n };\n })\n .filter((rule): rule is CalibrationRule => !!rule);\n } catch {\n log.warn(\"[calibration] failed to parse LLM response\");\n return [];\n }\n}\n\n// ─── Recall Section ──────────────────────────────────────────────────────────\n\n/**\n * Build a recall section from calibration rules relevant to the current query.\n * Uses the LLM to select which rules apply to the current context.\n */\nexport function buildCalibrationRecallSection(\n rules: CalibrationRule[],\n query: string,\n maxChars: number = 1200,\n): string | null {\n if (rules.length === 0) return null;\n\n // Simple relevance: include all rules (they're already filtered to this user)\n // In production, could use embedding similarity to filter\n const lines: string[] = [\n \"## Model Calibration (learned from past corrections)\",\n \"\",\n \"Adjustments for this specific user, learned from patterns in their corrections:\",\n \"\",\n ];\n\n let totalChars = lines.join(\"\\n\").length;\n\n for (const rule of rules) {\n const line = `- **${rule.condition}**: ${rule.modelTendency} → Instead: ${rule.calibration}`;\n if (totalChars + line.length + 1 > maxChars) break;\n lines.push(line);\n totalChars += line.length + 1;\n }\n\n if (lines.length <= 4) return null;\n lines.push(\"\");\n return lines.join(\"\\n\");\n}\n\n// ─── Public API ──────────────────────────────────────────────────────────────\n\n/**\n * Run the full calibration pipeline:\n * 1. Read all corrections\n * 2. Send to LLM for clustering and rule synthesis\n * 3. Merge with existing rules\n * 4. Write updated index\n */\nexport async function runCalibrationConsolidation(options: {\n memoryDir: string;\n gatewayConfig?: GatewayConfig;\n gatewayAgentId?: string;\n modelChain?: AgentPersonaModelConfig;\n workspaceDir?: string;\n}): Promise<CalibrationRule[]> {\n try {\n const llm = new FallbackLlmClient(options.gatewayConfig, {\n workspaceDir: options.workspaceDir,\n });\n if (!llm.isAvailable({ agentId: options.gatewayAgentId, modelChain: options.modelChain })) {\n log.debug(\"[calibration] no LLM available — skipping consolidation\");\n return [];\n }\n\n const corrections = await readCorrections(options.memoryDir);\n if (corrections.length < 3) {\n log.debug(`[calibration] only ${corrections.length} corrections — need at least 3`);\n return [];\n }\n\n const existingIndex = await readCalibrationIndex(options.memoryDir);\n\n const newRules = await synthesizeCalibrationRules(corrections, llm, existingIndex.rules, options.gatewayAgentId, options.modelChain);\n if (newRules.length === 0) {\n log.debug(\"[calibration] no new calibration rules synthesized\");\n return existingIndex.rules;\n }\n\n // Merge: keep existing rules, add new ones (deduplicate by id)\n const ruleMap = new Map(existingIndex.rules.map((r) => [r.id, r]));\n for (const rule of newRules) {\n if (ruleMap.has(rule.id)) {\n // Reinforce existing rule\n const existing = ruleMap.get(rule.id)!;\n existing.lastReinforcedAt = new Date().toISOString();\n existing.evidenceCount += rule.evidenceCount;\n existing.confidence = Math.min(1, existing.confidence + 0.05);\n } else {\n ruleMap.set(rule.id, rule);\n }\n }\n\n const allRules = [...ruleMap.values()];\n await writeCalibrationIndex(options.memoryDir, {\n rules: allRules,\n updatedAt: new Date().toISOString(),\n totalCorrectionsAnalyzed: corrections.length,\n });\n\n log.debug(`[calibration] synthesized ${newRules.length} new rule(s), ${allRules.length} total`);\n return allRules;\n } catch (error) {\n log.warn(`[calibration] consolidation failed (non-fatal): ${error instanceof Error ? error.message : String(error)}`);\n return [];\n }\n}\n\n/**\n * Standalone entry point for calibration consolidation that can be called\n * independently of weekly compounding. The compounding engine's\n * `synthesizeWeekly()` is one trigger, but orchestrators or periodic\n * maintenance jobs should call this directly so calibration is not gated\n * on weekly compounding being enabled.\n */\nexport async function runCalibrationIfEnabled(options: {\n memoryDir: string;\n calibrationEnabled: boolean;\n gatewayConfig?: GatewayConfig;\n gatewayAgentId?: string;\n modelChain?: AgentPersonaModelConfig;\n workspaceDir?: string;\n}): Promise<CalibrationRule[]> {\n if (!options.calibrationEnabled) {\n return [];\n }\n return runCalibrationConsolidation({\n memoryDir: options.memoryDir,\n gatewayConfig: options.gatewayConfig,\n gatewayAgentId: options.gatewayAgentId,\n modelChain: options.modelChain,\n workspaceDir: options.workspaceDir,\n });\n}\n\n/**\n * Get calibration rules for recall injection.\n * Reads the pre-computed calibration index.\n */\nexport async function getCalibrationRulesForRecall(\n memoryDir: string,\n): Promise<CalibrationRule[]> {\n const index = await readCalibrationIndex(memoryDir);\n return index.rules;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAcA,SAAS,kBAAkB;AAC3B,OAAO,UAAU;AACjB,SAAS,OAAO,UAAU,iBAAiB;AAgC3C,SAAS,eAAe,WAA2B;AACjD,SAAO,KAAK,KAAK,WAAW,SAAS,aAAa;AACpD;AAEA,SAAS,qBAAqB,WAA2B;AACvD,SAAO,KAAK,KAAK,eAAe,SAAS,GAAG,wBAAwB;AACtE;AAEA,eAAsB,qBAAqB,WAA8C;AACvF,MAAI;AACF,UAAM,MAAM,KAAK,MAAM,MAAM,SAAS,qBAAqB,SAAS,GAAG,MAAM,CAAC;AAC9E,WAAO;AAAA,MACL,OAAO,MAAM,QAAQ,IAAI,KAAK,IAAI,IAAI,QAAQ,CAAC;AAAA,MAC/C,WAAW,OAAO,IAAI,cAAc,WAAW,IAAI,aAAY,oBAAI,KAAK,GAAE,YAAY;AAAA,MACtF,0BAA0B,OAAO,IAAI,6BAA6B,WAAW,IAAI,2BAA2B;AAAA,IAC9G;AAAA,EACF,QAAQ;AACN,WAAO,EAAE,OAAO,CAAC,GAAG,YAAW,oBAAI,KAAK,GAAE,YAAY,GAAG,0BAA0B,EAAE;AAAA,EACvF;AACF;AAEA,eAAe,sBAAsB,WAAmB,OAAwC;AAC9F,QAAM,MAAM,eAAe,SAAS;AACpC,QAAM,MAAM,KAAK,EAAE,WAAW,KAAK,CAAC;AACpC,QAAM,aAAY,oBAAI,KAAK,GAAE,YAAY;AACzC,QAAM,UAAU,qBAAqB,SAAS,GAAG,KAAK,UAAU,OAAO,MAAM,CAAC,GAAG,MAAM;AACzF;AAaA,IAAM,yBAAyB,oBAAI,IAAI;AAAA,EACrC;AAAA,EACA;AA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,OAAO,CAAC;AACrC,UAAM,sBAAsB,QAAQ,WAAW;AAAA,MAC7C,OAAO;AAAA,MACP,YAAW,oBAAI,KAAK,GAAE,YAAY;AAAA,MAClC,0BAA0B,YAAY;AAAA,IACxC,CAAC;AAED,QAAI,MAAM,6BAA6B,SAAS,MAAM,iBAAiB,SAAS,MAAM,QAAQ;AAC9F,WAAO;AAAA,EACT,SAAS,OAAO;AACd,QAAI,KAAK,mDAAmD,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK,CAAC,EAAE;AACpH,WAAO,CAAC;AAAA,EACV;AACF;AASA,eAAsB,wBAAwB,SAOf;AAC7B,MAAI,CAAC,QAAQ,oBAAoB;AAC/B,WAAO,CAAC;AAAA,EACV;AACA,SAAO,4BAA4B;AAAA,IACjC,WAAW,QAAQ;AAAA,IACnB,eAAe,QAAQ;AAAA,IACvB,gBAAgB,QAAQ;AAAA,IACxB,YAAY,QAAQ;AAAA,IACpB,cAAc,QAAQ;AAAA,EACxB,CAAC;AACH;AAMA,eAAsB,6BACpB,WAC4B;AAC5B,QAAM,QAAQ,MAAM,qBAAqB,SAAS;AAClD,SAAO,MAAM;AACf;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../src/calibration.ts"],"sourcesContent":["/**\n * calibration.ts — Prediction-Error-Driven Model-User Calibration\n *\n * Analyzes patterns in user corrections to identify systematic miscalibration\n * between the model's predictions and the user's actual expectations.\n * During consolidation, replays chains of similar corrections through an LLM\n * to synthesize CalibrationRules that adjust model behavior for this specific user.\n *\n * Inspired by:\n * - Cerebellar motor calibration (prediction errors drive lasting adjustments)\n * - Temporal difference learning (dopamine signals prediction error)\n * - Tesla FSD shadow mode (divergence between prediction and reality = training signal)\n */\n\nimport { createHash } from \"node:crypto\";\nimport { mkdir, readFile, writeFile } from \"node:fs/promises\";\nimport path from \"node:path\";\nimport { resolveLocalLlmCapabilities } from \"./capabilities.js\";\nimport { OUTPUT_LANGUAGE_POLICY } from \"./extraction-prompt.js\";\nimport { FallbackLlmClient } from \"./fallback-llm.js\";\nimport { listJsonFiles } from \"./json-store.js\";\nimport { LocalLlmClient } from \"./local-llm.js\";\nimport { log } from \"./logger.js\";\nimport type { AgentPersonaModelConfig, GatewayConfig, PluginConfig } from \"./types.js\";\n\n// ─── Types ───────────────────────────────────────────────────────────────────\n\nexport interface CalibrationRule {\n id: string;\n ruleType: \"model_tendency\" | \"user_expectation\" | \"scope_boundary\" | \"verification_required\";\n condition: string;\n modelTendency: string;\n userExpectation: string;\n calibration: string;\n confidence: number;\n evidenceCount: number;\n evidenceCorrectionIds: string[];\n createdAt: string;\n lastReinforcedAt: string;\n}\n\nexport interface CalibrationIndex {\n rules: CalibrationRule[];\n updatedAt: string;\n totalCorrectionsAnalyzed: number;\n}\n\n// ─── Storage ─────────────────────────────────────────────────────────────────\n\nfunction calibrationDir(memoryDir: string): string {\n return path.join(memoryDir, \"state\", \"calibration\");\n}\n\nfunction calibrationIndexPath(memoryDir: string): string {\n return path.join(calibrationDir(memoryDir), \"calibration-index.json\");\n}\n\nexport async function readCalibrationIndex(memoryDir: string): Promise<CalibrationIndex> {\n try {\n const raw = JSON.parse(await readFile(calibrationIndexPath(memoryDir), \"utf8\"));\n return {\n rules: Array.isArray(raw.rules) ? raw.rules : [],\n updatedAt: typeof raw.updatedAt === \"string\" ? raw.updatedAt : new Date().toISOString(),\n totalCorrectionsAnalyzed: typeof raw.totalCorrectionsAnalyzed === \"number\" ? raw.totalCorrectionsAnalyzed : 0,\n };\n } catch {\n return { rules: [], updatedAt: new Date().toISOString(), totalCorrectionsAnalyzed: 0 };\n }\n}\n\nasync function writeCalibrationIndex(memoryDir: string, index: CalibrationIndex): Promise<void> {\n const dir = calibrationDir(memoryDir);\n await mkdir(dir, { recursive: true });\n index.updatedAt = new Date().toISOString();\n await writeFile(calibrationIndexPath(memoryDir), JSON.stringify(index, null, 2), \"utf8\");\n}\n\n// ─── Correction Reading ──────────────────────────────────────────────────────\n\nexport interface CorrectionMemory {\n id: string;\n content: string;\n created: string;\n confidence: number;\n entityRefs: string[];\n tags: string[];\n}\n\nconst CALIBRATION_RULE_TYPES = new Set([\n \"model_tendency\",\n \"user_expectation\",\n \"scope_boundary\",\n \"verification_required\",\n]);\n\nfunction parseConfidence(value: unknown): number | undefined {\n if (typeof value !== \"number\" || !Number.isFinite(value)) return undefined;\n return Math.max(0, Math.min(1, value));\n}\n\nfunction parseEvidenceIds(value: unknown): string[] {\n if (!Array.isArray(value)) return [];\n return value.filter((item): item is string => typeof item === \"string\" && item.trim().length > 0);\n}\n\nfunction nonEmptyString(value: unknown): string | undefined {\n if (typeof value !== \"string\") return undefined;\n const trimmed = value.trim();\n return trimmed.length > 0 ? trimmed : undefined;\n}\n\n/**\n * Exported for entity-contamination R-11 regression coverage (#682\n * PR 2/3 — codex review). Tests can drive the real correction-reading\n * path instead of duplicating the regex inline, so calibration parser\n * regressions surface via the contamination suite.\n */\nexport async function readCalibrationCorrections(memoryDir: string): Promise<CorrectionMemory[]> {\n return readCorrectionsImpl(memoryDir);\n}\n\nasync function readCorrections(memoryDir: string): Promise<CorrectionMemory[]> {\n return readCorrectionsImpl(memoryDir);\n}\n\nasync function readCorrectionsImpl(memoryDir: string): Promise<CorrectionMemory[]> {\n const correctionsDir = path.join(memoryDir, \"corrections\");\n const files = await listJsonFiles(correctionsDir).catch(() => {\n // Corrections might be in facts/ directories too\n return [] as string[];\n });\n\n // Also scan facts directories for correction-category files\n const factsDir = path.join(memoryDir, \"facts\");\n try {\n const { readdir } = await import(\"node:fs/promises\");\n const dayDirs = (await readdir(factsDir)).filter((d: string) => /^\\d{4}-\\d{2}-\\d{2}$/.test(d));\n for (const day of dayDirs) {\n const dayPath = path.join(factsDir, day);\n const dayFiles = (await readdir(dayPath))\n .filter((f: string) => f.startsWith(\"correction-\") && f.endsWith(\".md\"))\n .map((f: string) => path.join(dayPath, f));\n files.push(...dayFiles);\n }\n } catch {\n // facts dir might not exist\n }\n\n // Also check the dedicated corrections directory\n try {\n const { readdir } = await import(\"node:fs/promises\");\n const corrFiles = (await readdir(correctionsDir))\n .filter((f: string) => f.endsWith(\".md\"))\n .map((f: string) => path.join(correctionsDir, f));\n files.push(...corrFiles);\n } catch {\n // corrections dir might not exist\n }\n\n const corrections: CorrectionMemory[] = [];\n const seen = new Set<string>();\n\n for (const filePath of files) {\n try {\n const raw = await readFile(filePath, \"utf8\");\n\n // Parse frontmatter\n const fmMatch = raw.match(/^---\\n([\\s\\S]*?)\\n---\\n([\\s\\S]*)$/);\n if (!fmMatch) continue;\n\n const content = fmMatch[2].trim();\n if (!content || content.length < 10) continue;\n\n // Extract id from frontmatter\n const idMatch = fmMatch[1].match(/^id:\\s*(.+)$/m);\n const id = idMatch?.[1]?.trim() ?? path.basename(filePath, \".md\");\n\n if (seen.has(id)) continue;\n seen.add(id);\n\n const confMatch = fmMatch[1].match(/^confidence:\\s*(.+)$/m);\n const confidence = confMatch ? parseFloat(confMatch[1]) : 0.9;\n\n const entityMatch = fmMatch[1].match(/^entityRef:\\s*(.+)$/m);\n const entityRefs = entityMatch ? [entityMatch[1].trim()] : [];\n\n corrections.push({ id, content, created: \"\", confidence, entityRefs, tags: [] });\n } catch {\n // skip unparseable files\n }\n }\n\n return corrections;\n}\n\n// ─── LLM-Assisted Clustering and Replay ──────────────────────────────────────\n\nexport const CLUSTER_PROMPT = `You are analyzing user corrections to an AI assistant. Each correction represents a moment where the assistant's prediction of what the user wanted was WRONG.\n\nYour job: Group these corrections into clusters where the SAME TYPE of misunderstanding is happening. Then for each cluster, synthesize a CalibrationRule.\n\nA CalibrationRule describes:\n- condition: When does this type of mistake happen?\n- modelTendency: What does the model tend to assume or do wrong?\n- userExpectation: What does the user actually want instead?\n- calibration: How should the model adjust its behavior?\n- ruleType: One of \"model_tendency\", \"user_expectation\", \"scope_boundary\", \"verification_required\"\n\nFocus on PATTERNS, not individual corrections. A cluster needs at least 2 corrections to be worth a rule.\n${OUTPUT_LANGUAGE_POLICY}\n\nOutput valid JSON only:\n{\n \"rules\": [\n {\n \"ruleType\": \"model_tendency\",\n \"condition\": \"When discussing project scope or task boundaries\",\n \"modelTendency\": \"The model tends to assume broader scope than the user intends\",\n \"userExpectation\": \"The user prefers narrow, specific task definitions and wants to be asked before scope expansion\",\n \"calibration\": \"When uncertain about scope, ask for clarification rather than assuming. Default to the narrower interpretation.\",\n \"confidence\": 0.85,\n \"evidenceIds\": [\"correction-id-1\", \"correction-id-2\"]\n }\n ]\n}`;\n\ninterface CalibrationChatClient {\n chatCompletion(\n messages: Array<{ role: \"system\" | \"user\" | \"assistant\"; content: string }>,\n options?: {\n temperature?: number;\n maxTokens?: number;\n agentId?: string;\n modelChain?: AgentPersonaModelConfig;\n }\n ): Promise<{ content?: string | null } | null>;\n}\n\ninterface CalibrationLlmOptions {\n gatewayConfig?: GatewayConfig;\n gatewayAgentId?: string;\n modelChain?: AgentPersonaModelConfig;\n workspaceDir?: string;\n /** Plugin config. Supplies `localLlm*` settings when the gateway chain is empty. */\n pluginConfig?: PluginConfig;\n}\n\nfunction resolveCalibrationChatClient(options: CalibrationLlmOptions): CalibrationChatClient | null {\n const gateway = new FallbackLlmClient(options.gatewayConfig, {\n workspaceDir: options.workspaceDir,\n });\n if (gateway.isAvailable({ agentId: options.gatewayAgentId, modelChain: options.modelChain })) {\n return gateway;\n }\n const pluginConfig = options.pluginConfig;\n if (pluginConfig && resolveLocalLlmCapabilities(pluginConfig).localLlm) {\n log.info(`[calibration] using configured local LLM (model=${pluginConfig.localLlmModel})`);\n const local = new LocalLlmClient(pluginConfig);\n return {\n chatCompletion(messages, chatOptions) {\n return local.chatCompletion(messages, {\n temperature: chatOptions?.temperature,\n maxTokens: chatOptions?.maxTokens,\n });\n },\n };\n }\n log.warn(\"[calibration] no LLM available — skipping consolidation\");\n return null;\n}\n\nexport async function synthesizeCalibrationRules(\n corrections: CorrectionMemory[],\n llm: CalibrationChatClient,\n existingRules: CalibrationRule[],\n agentId?: string,\n modelChain?: AgentPersonaModelConfig\n): Promise<CalibrationRule[]> {\n if (corrections.length < 2) return [];\n\n // Format corrections for the LLM\n const correctionText = corrections\n .slice(0, 50) // limit to avoid huge prompts\n .map((c, i) => `[${c.id}] ${c.content}`)\n .join(\"\\n\\n\");\n\n const existingRulesText =\n existingRules.length > 0\n ? `\\n\\nExisting calibration rules (avoid duplicating these):\\n${existingRules.map((r) => `- ${r.condition}: ${r.calibration}`).join(\"\\n\")}`\n : \"\";\n\n const response = await llm.chatCompletion(\n [\n { role: \"system\", content: CLUSTER_PROMPT },\n {\n role: \"user\",\n content: `Here are ${corrections.length} corrections from this user:\\n\\n${correctionText}${existingRulesText}`,\n },\n ],\n { temperature: 0.3, maxTokens: 3000, agentId, modelChain }\n );\n\n if (!response?.content) return [];\n\n try {\n let jsonStr = response.content.trim();\n const fenceMatch = jsonStr.match(/```(?:json)?\\s*\\n?([\\s\\S]*?)\\n?\\s*```/);\n if (fenceMatch) jsonStr = fenceMatch[1];\n\n const parsed = JSON.parse(jsonStr);\n if (!Array.isArray(parsed.rules)) return [];\n\n const now = new Date().toISOString();\n const rawRules: unknown[] = Array.isArray(parsed.rules) ? parsed.rules : [];\n return rawRules\n .map((r: unknown): CalibrationRule | undefined => {\n if (!r || typeof r !== \"object\" || Array.isArray(r)) return undefined;\n const raw = r as Record<string, unknown>;\n const ruleType = nonEmptyString(raw.ruleType);\n const condition = nonEmptyString(raw.condition);\n const modelTendency = nonEmptyString(raw.modelTendency);\n const calibration = nonEmptyString(raw.calibration);\n const confidence = parseConfidence(raw.confidence);\n if (\n !ruleType ||\n !CALIBRATION_RULE_TYPES.has(ruleType) ||\n !condition ||\n !modelTendency ||\n !calibration ||\n confidence === undefined\n ) {\n return undefined;\n }\n const evidenceCorrectionIds = parseEvidenceIds(raw.evidenceIds);\n return {\n id: `cal-${createHash(\"sha256\")\n .update(condition + calibration)\n .digest(\"hex\")\n .slice(0, 12)}`,\n ruleType: ruleType as CalibrationRule[\"ruleType\"],\n condition,\n modelTendency,\n userExpectation: nonEmptyString(raw.userExpectation) ?? \"\",\n calibration,\n confidence,\n evidenceCount: evidenceCorrectionIds.length,\n evidenceCorrectionIds,\n createdAt: now,\n lastReinforcedAt: now,\n };\n })\n .filter((rule): rule is CalibrationRule => !!rule);\n } catch {\n log.warn(\"[calibration] failed to parse LLM response\");\n return [];\n }\n}\n\n// ─── Recall Section ──────────────────────────────────────────────────────────\n\n/**\n * Build a recall section from calibration rules relevant to the current query.\n * Uses the LLM to select which rules apply to the current context.\n */\nexport function buildCalibrationRecallSection(\n rules: CalibrationRule[],\n query: string,\n maxChars: number = 1200,\n): string | null {\n if (rules.length === 0) return null;\n\n // Simple relevance: include all rules (they're already filtered to this user)\n // In production, could use embedding similarity to filter\n const lines: string[] = [\n \"## Model Calibration (learned from past corrections)\",\n \"\",\n \"Adjustments for this specific user, learned from patterns in their corrections:\",\n \"\",\n ];\n\n let totalChars = lines.join(\"\\n\").length;\n\n for (const rule of rules) {\n const line = `- **${rule.condition}**: ${rule.modelTendency} → Instead: ${rule.calibration}`;\n if (totalChars + line.length + 1 > maxChars) break;\n lines.push(line);\n totalChars += line.length + 1;\n }\n\n if (lines.length <= 4) return null;\n lines.push(\"\");\n return lines.join(\"\\n\");\n}\n\n// ─── Public API ──────────────────────────────────────────────────────────────\n\n/**\n * Options weekly compounding passes into calibration. Gateway agent and task\n * chain fields stay limited to `modelSource: \"gateway\"`. `pluginConfig` carries\n * the `localLlm*` settings used when that chain is empty.\n */\nexport function calibrationConsolidationInput(config: PluginConfig): {\n memoryDir: string;\n gatewayConfig?: GatewayConfig;\n gatewayAgentId?: string;\n modelChain?: AgentPersonaModelConfig;\n workspaceDir?: string;\n pluginConfig: PluginConfig;\n} {\n const gateway = config.modelSource === \"gateway\";\n return {\n memoryDir: config.memoryDir,\n gatewayConfig: config.gatewayConfig,\n gatewayAgentId: gateway ? (config.gatewayAgentId || undefined) : undefined,\n modelChain: gateway ? config.taskModelChain : undefined,\n workspaceDir: config.workspaceDir,\n pluginConfig: config,\n };\n}\n\n/**\n * Run the full calibration pipeline:\n * 1. Read all corrections\n * 2. Send to LLM for clustering and rule synthesis\n * 3. Merge with existing rules\n * 4. Write updated index\n */\nexport async function runCalibrationConsolidation(options: {\n memoryDir: string;\n gatewayConfig?: GatewayConfig;\n gatewayAgentId?: string;\n modelChain?: AgentPersonaModelConfig;\n workspaceDir?: string;\n pluginConfig?: PluginConfig;\n}): Promise<CalibrationRule[]> {\n try {\n const llm = resolveCalibrationChatClient(options);\n if (!llm) return [];\n\n const corrections = await readCorrections(options.memoryDir);\n if (corrections.length < 3) {\n log.info(`[calibration] only ${corrections.length} corrections — need at least 3`);\n return [];\n }\n\n const existingIndex = await readCalibrationIndex(options.memoryDir);\n\n const newRules = await synthesizeCalibrationRules(\n corrections,\n llm,\n existingIndex.rules,\n options.gatewayAgentId,\n options.modelChain\n );\n if (newRules.length === 0) {\n log.info(\"[calibration] no new calibration rules synthesized\");\n return existingIndex.rules;\n }\n\n // Merge: keep existing rules, add new ones (deduplicate by id)\n const ruleMap = new Map(existingIndex.rules.map((r) => [r.id, r]));\n for (const rule of newRules) {\n if (ruleMap.has(rule.id)) {\n // Reinforce existing rule\n const existing = ruleMap.get(rule.id)!;\n existing.lastReinforcedAt = new Date().toISOString();\n existing.evidenceCount += rule.evidenceCount;\n existing.confidence = Math.min(1, existing.confidence + 0.05);\n } else {\n ruleMap.set(rule.id, rule);\n }\n }\n\n const allRules = [...ruleMap.values()];\n await writeCalibrationIndex(options.memoryDir, {\n rules: allRules,\n updatedAt: new Date().toISOString(),\n totalCorrectionsAnalyzed: corrections.length,\n });\n\n log.debug(`[calibration] synthesized ${newRules.length} new rule(s), ${allRules.length} total`);\n return allRules;\n } catch (error) {\n log.warn(\n `[calibration] consolidation failed (non-fatal): ${error instanceof Error ? error.message : String(error)}`\n );\n return [];\n }\n}\n\n/**\n * Standalone entry point for calibration consolidation that can be called\n * independently of weekly compounding. The compounding engine's\n * `synthesizeWeekly()` is one trigger, but orchestrators or periodic\n * maintenance jobs should call this directly so calibration is not gated\n * on weekly compounding being enabled.\n */\nexport async function runCalibrationIfEnabled(options: {\n memoryDir: string;\n calibrationEnabled: boolean;\n gatewayConfig?: GatewayConfig;\n gatewayAgentId?: string;\n modelChain?: AgentPersonaModelConfig;\n workspaceDir?: string;\n pluginConfig?: PluginConfig;\n}): Promise<CalibrationRule[]> {\n if (!options.calibrationEnabled) {\n return [];\n }\n return runCalibrationConsolidation({\n memoryDir: options.memoryDir,\n gatewayConfig: options.gatewayConfig,\n gatewayAgentId: options.gatewayAgentId,\n modelChain: options.modelChain,\n workspaceDir: options.workspaceDir,\n pluginConfig: options.pluginConfig,\n });\n}\n\n/**\n * Get calibration rules for recall injection.\n * Reads the pre-computed calibration index.\n */\nexport async function getCalibrationRulesForRecall(\n memoryDir: string,\n): Promise<CalibrationRule[]> {\n const index = await readCalibrationIndex(memoryDir);\n return index.rules;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAcA,SAAS,kBAAkB;AAC3B,SAAS,OAAO,UAAU,iBAAiB;AAC3C,OAAO,UAAU;AAiCjB,SAAS,eAAe,WAA2B;AACjD,SAAO,KAAK,KAAK,WAAW,SAAS,aAAa;AACpD;AAEA,SAAS,qBAAqB,WAA2B;AACvD,SAAO,KAAK,KAAK,eAAe,SAAS,GAAG,wBAAwB;AACtE;AAEA,eAAsB,qBAAqB,WAA8C;AACvF,MAAI;AACF,UAAM,MAAM,KAAK,MAAM,MAAM,SAAS,qBAAqB,SAAS,GAAG,MAAM,CAAC;AAC9E,WAAO;AAAA,MACL,OAAO,MAAM,QAAQ,IAAI,KAAK,IAAI,IAAI,QAAQ,CAAC;AAAA,MAC/C,WAAW,OAAO,IAAI,cAAc,WAAW,IAAI,aAAY,oBAAI,KAAK,GAAE,YAAY;AAAA,MACtF,0BAA0B,OAAO,IAAI,6BAA6B,WAAW,IAAI,2BAA2B;AAAA,IAC9G;AAAA,EACF,QAAQ;AACN,WAAO,EAAE,OAAO,CAAC,GAAG,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;AAAA,IACxC,CAAC;AAED,QAAI,MAAM,6BAA6B,SAAS,MAAM,iBAAiB,SAAS,MAAM,QAAQ;AAC9F,WAAO;AAAA,EACT,SAAS,OAAO;AACd,QAAI;AAAA,MACF,mDAAmD,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK,CAAC;AAAA,IAC3G;AACA,WAAO,CAAC;AAAA,EACV;AACF;AASA,eAAsB,wBAAwB,SAQf;AAC7B,MAAI,CAAC,QAAQ,oBAAoB;AAC/B,WAAO,CAAC;AAAA,EACV;AACA,SAAO,4BAA4B;AAAA,IACjC,WAAW,QAAQ;AAAA,IACnB,eAAe,QAAQ;AAAA,IACvB,gBAAgB,QAAQ;AAAA,IACxB,YAAY,QAAQ;AAAA,IACpB,cAAc,QAAQ;AAAA,IACtB,cAAc,QAAQ;AAAA,EACxB,CAAC;AACH;AAMA,eAAsB,6BACpB,WAC4B;AAC5B,QAAM,QAAQ,MAAM,qBAAqB,SAAS;AAClD,SAAO,MAAM;AACf;","names":[]}
|
|
@@ -4,12 +4,12 @@ import {
|
|
|
4
4
|
} from "./chunk-IFCKHPY4.js";
|
|
5
5
|
import {
|
|
6
6
|
buildExtensionsBlockForConsolidation
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-L3PWXD73.js";
|
|
8
8
|
import "./chunk-5JMAGU26.js";
|
|
9
9
|
import "./chunk-B7RWBZXW.js";
|
|
10
10
|
import {
|
|
11
11
|
runPostConsolidationMaterialize
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-YJEUHGZZ.js";
|
|
13
13
|
import "./chunk-3UXOZBHV.js";
|
|
14
14
|
import "./chunk-PIWFNPQT.js";
|
|
15
15
|
import "./chunk-TOTT6S2V.js";
|
|
@@ -19,28 +19,28 @@ import "./chunk-QDW3E4RD.js";
|
|
|
19
19
|
import {
|
|
20
20
|
resolveCausalTrajectoryStoreDir
|
|
21
21
|
} from "./chunk-VZBW6CDG.js";
|
|
22
|
-
import "./chunk-
|
|
22
|
+
import "./chunk-37HCPM56.js";
|
|
23
23
|
import "./chunk-46WM6JX2.js";
|
|
24
24
|
import "./chunk-UHVXE24Y.js";
|
|
25
25
|
import "./chunk-V4JZCTMK.js";
|
|
26
|
-
import "./chunk-
|
|
27
|
-
import "./chunk-
|
|
26
|
+
import "./chunk-RSMIRLKM.js";
|
|
27
|
+
import "./chunk-U6OXJQEH.js";
|
|
28
|
+
import "./chunk-T3FMRLWQ.js";
|
|
28
29
|
import "./chunk-7VO6E5UD.js";
|
|
29
30
|
import "./chunk-5BUCKFRE.js";
|
|
30
31
|
import "./chunk-S7LWX2PQ.js";
|
|
31
32
|
import "./chunk-T2YX56QI.js";
|
|
32
|
-
import "./chunk-CYEPCZN5.js";
|
|
33
|
-
import "./chunk-T3FMRLWQ.js";
|
|
34
33
|
import "./chunk-4O6WRBGE.js";
|
|
35
34
|
import "./chunk-GUMZC2BO.js";
|
|
36
|
-
import "./chunk-
|
|
35
|
+
import "./chunk-CYEPCZN5.js";
|
|
36
|
+
import "./chunk-TFA6HPOA.js";
|
|
37
|
+
import "./chunk-F4TWWUMP.js";
|
|
37
38
|
import "./chunk-72A4L5JJ.js";
|
|
38
39
|
import "./chunk-A7Q43EUZ.js";
|
|
39
|
-
import "./chunk-F4TWWUMP.js";
|
|
40
40
|
import "./chunk-S2V7RUCL.js";
|
|
41
41
|
import "./chunk-X3724WL4.js";
|
|
42
|
-
import "./chunk-S2HLHAZ4.js";
|
|
43
42
|
import "./chunk-MRPOZBJC.js";
|
|
43
|
+
import "./chunk-S2HLHAZ4.js";
|
|
44
44
|
import "./chunk-DM2T26WE.js";
|
|
45
45
|
import "./chunk-LDXUBPMO.js";
|
|
46
46
|
import "./chunk-FF6N7BXC.js";
|
|
@@ -52,9 +52,8 @@ import "./chunk-3OUGSOJP.js";
|
|
|
52
52
|
import "./chunk-SCU65EZI.js";
|
|
53
53
|
import "./chunk-3ONXXHQO.js";
|
|
54
54
|
import "./chunk-YXZG5TVN.js";
|
|
55
|
-
import "./chunk-6MKLMEBE.js";
|
|
56
55
|
import "./chunk-3WU7XOFN.js";
|
|
57
|
-
import "./chunk-
|
|
56
|
+
import "./chunk-6MKLMEBE.js";
|
|
58
57
|
import "./chunk-W5XWHTDO.js";
|
|
59
58
|
import "./chunk-M5GVCJSJ.js";
|
|
60
59
|
import "./chunk-RBOJCG4T.js";
|
|
@@ -62,6 +61,7 @@ import "./chunk-R7QY5ZVB.js";
|
|
|
62
61
|
import "./chunk-5WITETWU.js";
|
|
63
62
|
import "./chunk-6CIAGZ6X.js";
|
|
64
63
|
import "./chunk-7CT3AI52.js";
|
|
64
|
+
import "./chunk-G7D6GZ5J.js";
|
|
65
65
|
import "./chunk-AJ6ORARY.js";
|
|
66
66
|
import "./chunk-IUM3VSHI.js";
|
|
67
67
|
import "./chunk-G26YNEOC.js";
|
|
@@ -81,12 +81,14 @@ import {
|
|
|
81
81
|
fallbackLlmRuntimeContextFromConfig
|
|
82
82
|
} from "./chunk-EP6BA7VV.js";
|
|
83
83
|
import "./chunk-E2AWJ7KQ.js";
|
|
84
|
+
import "./chunk-Z7L72ZHL.js";
|
|
85
|
+
import "./chunk-4O4TKIXQ.js";
|
|
84
86
|
import "./chunk-YCVB7X56.js";
|
|
85
87
|
import "./chunk-PQVCH2AE.js";
|
|
86
88
|
import "./chunk-PJKTFXE2.js";
|
|
87
89
|
import "./chunk-W5BIQOAJ.js";
|
|
88
|
-
import "./chunk-
|
|
89
|
-
import "./chunk-
|
|
90
|
+
import "./chunk-QWWMS4AE.js";
|
|
91
|
+
import "./chunk-YBA52OKG.js";
|
|
90
92
|
import "./chunk-5AYUHSAU.js";
|
|
91
93
|
import "./chunk-BT7NVCML.js";
|
|
92
94
|
import "./chunk-PO7NXNGC.js";
|
|
@@ -99,17 +101,15 @@ import "./chunk-ZA53AZND.js";
|
|
|
99
101
|
import "./chunk-7RJUVTVF.js";
|
|
100
102
|
import "./chunk-AL3UYZ5N.js";
|
|
101
103
|
import "./chunk-RL6NEVXT.js";
|
|
104
|
+
import "./chunk-PWPIERBM.js";
|
|
102
105
|
import "./chunk-C7HJ3NEI.js";
|
|
103
106
|
import "./chunk-N4PYB235.js";
|
|
104
107
|
import "./chunk-BTNNL7ZW.js";
|
|
105
108
|
import "./chunk-5FVVY2EB.js";
|
|
106
|
-
import "./chunk-FFAZ2XFU.js";
|
|
107
|
-
import "./chunk-Z63GU5NN.js";
|
|
108
|
-
import "./chunk-YBA52OKG.js";
|
|
109
|
-
import "./chunk-PWPIERBM.js";
|
|
110
109
|
import "./chunk-JDSVLVCG.js";
|
|
111
110
|
import "./chunk-5GKPFL3S.js";
|
|
112
111
|
import "./chunk-JAKIDQB2.js";
|
|
112
|
+
import "./chunk-FFAZ2XFU.js";
|
|
113
113
|
import "./chunk-P7FMDTKL.js";
|
|
114
114
|
import "./chunk-PCXDUHQH.js";
|
|
115
115
|
import "./chunk-VUFL7X3H.js";
|
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
} from "./chunk-NHLLKEKK.js";
|
|
12
12
|
import {
|
|
13
13
|
parseConfig
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-5BPXMAUP.js";
|
|
15
15
|
import {
|
|
16
16
|
resolveObjectiveStateStoreDir,
|
|
17
17
|
validateObjectiveStateSnapshot
|
|
@@ -268,4 +268,4 @@ export {
|
|
|
268
268
|
recordResumeBundle,
|
|
269
269
|
getResumeBundleStatus
|
|
270
270
|
};
|
|
271
|
-
//# sourceMappingURL=chunk-
|
|
271
|
+
//# sourceMappingURL=chunk-2CP577K6.js.map
|