@remnic/core 9.3.658 → 9.3.660
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-cli.js +17 -17
- package/dist/access-http.js +11 -10
- package/dist/access-mcp.js +10 -9
- package/dist/access-service.js +9 -8
- package/dist/briefing.js +4 -3
- package/dist/causal-consolidation.js +5 -4
- package/dist/causal-consolidation.js.map +1 -1
- package/dist/{chunk-QFKRE7AU.js → chunk-256W7AXC.js} +4 -4
- package/dist/{chunk-5PFIMBJJ.js → chunk-2EVZ5EN6.js} +12 -12
- package/dist/{chunk-SCPFRKIT.js → chunk-42JKGUFJ.js} +6 -2
- package/dist/{chunk-SCPFRKIT.js.map → chunk-42JKGUFJ.js.map} +1 -1
- package/dist/{chunk-2VCTTEJM.js → chunk-7H7J3ZWN.js} +3 -3
- package/dist/{chunk-QRSKPI62.js → chunk-7PCZGNG2.js} +2 -2
- package/dist/{chunk-ZCMO46YY.js → chunk-A7EF2XRO.js} +2 -2
- package/dist/{chunk-BNUAOLDK.js → chunk-ANJOULTP.js} +2 -2
- package/dist/{chunk-CPPS65WS.js → chunk-AWJ2FHCF.js} +84 -17
- package/dist/chunk-AWJ2FHCF.js.map +1 -0
- package/dist/{chunk-4PLOQDBB.js → chunk-AX5O25EF.js} +7 -5
- package/dist/chunk-AX5O25EF.js.map +1 -0
- package/dist/{chunk-7VWDC7AD.js → chunk-B57QYSWN.js} +17 -17
- package/dist/{chunk-BKRIAXTU.js → chunk-D2EFNQMY.js} +2 -2
- package/dist/{chunk-MBZAESQ3.js → chunk-F6O7IOS3.js} +2 -2
- package/dist/{chunk-KI6QM5AV.js → chunk-GY3V3SUI.js} +2 -2
- package/dist/{chunk-GGL7R2L2.js → chunk-MO77TWPS.js} +4 -4
- package/dist/{chunk-VJYFXDCZ.js → chunk-NMPEJV5M.js} +3 -3
- package/dist/{chunk-3R6OP33G.js → chunk-OYXVENIS.js} +3 -3
- package/dist/{chunk-7KSPKZIQ.js → chunk-PXVFMQLD.js} +3 -3
- package/dist/{chunk-FIS5RT6K.js → chunk-QXHBWFR3.js} +2 -2
- package/dist/{chunk-SSSXWIBP.js → chunk-R2EBP6CM.js} +2 -2
- package/dist/{chunk-6M4LYWA2.js → chunk-RP2U54GG.js} +5 -5
- package/dist/{chunk-G2VVBWFU.js → chunk-RQGR3ETH.js} +2 -2
- package/dist/{chunk-JI3LQFJH.js → chunk-TBLGI2LT.js} +2 -2
- package/dist/{chunk-RVT6U6PV.js → chunk-TWAJICBN.js} +2 -2
- package/dist/{chunk-46RXRASB.js → chunk-TYIXG4VR.js} +3 -3
- package/dist/{chunk-EKQMQQ3U.js → chunk-UNLHHTKN.js} +2 -2
- package/dist/cli.js +20 -19
- package/dist/compounding/engine.js +4 -3
- package/dist/connectors/codex-materialize-runner.js +4 -3
- package/dist/connectors/index.js +4 -3
- package/dist/entity-retrieval.js +4 -3
- package/dist/index.js +25 -25
- package/dist/maintenance/memory-governance.js +4 -3
- package/dist/maintenance/rebuild-memory-lifecycle-ledger.js +4 -3
- package/dist/maintenance/rebuild-memory-projection.js +5 -4
- package/dist/memory-cache.d.ts +43 -1
- package/dist/memory-cache.js +6 -1
- package/dist/namespaces/migrate.js +8 -7
- package/dist/namespaces/search.js +5 -4
- package/dist/namespaces/storage.js +4 -3
- package/dist/operator-toolkit.js +10 -9
- package/dist/orchestrator.js +15 -15
- package/dist/qmd-recall-cache.d.ts +4 -1
- package/dist/qmd-recall-cache.js +3 -1
- package/dist/qmd.js +3 -2
- package/dist/schemas.d.ts +24 -24
- package/dist/search/factory.js +4 -3
- package/dist/search/index.js +4 -3
- package/dist/semantic-consolidation.js +5 -4
- package/dist/semantic-rule-promotion.js +4 -3
- package/dist/semantic-rule-verifier.js +4 -3
- package/dist/storage.js +3 -2
- package/dist/verified-recall.js +4 -3
- package/package.json +1 -1
- package/src/memory-cache.test.ts +30 -0
- package/src/memory-cache.ts +129 -16
- package/src/qmd-recall-cache.ts +6 -0
- package/src/storage.ts +27 -3
- package/dist/chunk-4PLOQDBB.js.map +0 -1
- package/dist/chunk-CPPS65WS.js.map +0 -1
- /package/dist/{chunk-QFKRE7AU.js.map → chunk-256W7AXC.js.map} +0 -0
- /package/dist/{chunk-5PFIMBJJ.js.map → chunk-2EVZ5EN6.js.map} +0 -0
- /package/dist/{chunk-2VCTTEJM.js.map → chunk-7H7J3ZWN.js.map} +0 -0
- /package/dist/{chunk-QRSKPI62.js.map → chunk-7PCZGNG2.js.map} +0 -0
- /package/dist/{chunk-ZCMO46YY.js.map → chunk-A7EF2XRO.js.map} +0 -0
- /package/dist/{chunk-BNUAOLDK.js.map → chunk-ANJOULTP.js.map} +0 -0
- /package/dist/{chunk-7VWDC7AD.js.map → chunk-B57QYSWN.js.map} +0 -0
- /package/dist/{chunk-BKRIAXTU.js.map → chunk-D2EFNQMY.js.map} +0 -0
- /package/dist/{chunk-MBZAESQ3.js.map → chunk-F6O7IOS3.js.map} +0 -0
- /package/dist/{chunk-KI6QM5AV.js.map → chunk-GY3V3SUI.js.map} +0 -0
- /package/dist/{chunk-GGL7R2L2.js.map → chunk-MO77TWPS.js.map} +0 -0
- /package/dist/{chunk-VJYFXDCZ.js.map → chunk-NMPEJV5M.js.map} +0 -0
- /package/dist/{chunk-3R6OP33G.js.map → chunk-OYXVENIS.js.map} +0 -0
- /package/dist/{chunk-7KSPKZIQ.js.map → chunk-PXVFMQLD.js.map} +0 -0
- /package/dist/{chunk-FIS5RT6K.js.map → chunk-QXHBWFR3.js.map} +0 -0
- /package/dist/{chunk-SSSXWIBP.js.map → chunk-R2EBP6CM.js.map} +0 -0
- /package/dist/{chunk-6M4LYWA2.js.map → chunk-RP2U54GG.js.map} +0 -0
- /package/dist/{chunk-G2VVBWFU.js.map → chunk-RQGR3ETH.js.map} +0 -0
- /package/dist/{chunk-JI3LQFJH.js.map → chunk-TBLGI2LT.js.map} +0 -0
- /package/dist/{chunk-RVT6U6PV.js.map → chunk-TWAJICBN.js.map} +0 -0
- /package/dist/{chunk-46RXRASB.js.map → chunk-TYIXG4VR.js.map} +0 -0
- /package/dist/{chunk-EKQMQQ3U.js.map → chunk-UNLHHTKN.js.map} +0 -0
package/dist/access-cli.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
Orchestrator
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-B57QYSWN.js";
|
|
4
4
|
import "./chunk-4SKKVWLQ.js";
|
|
5
5
|
import "./chunk-7HYPN2GC.js";
|
|
6
6
|
import "./chunk-666A3MOW.js";
|
|
@@ -15,7 +15,7 @@ import "./chunk-TPDBFYEG.js";
|
|
|
15
15
|
import "./chunk-KCYE2MZM.js";
|
|
16
16
|
import "./chunk-TECVW3JP.js";
|
|
17
17
|
import "./chunk-T2PO5MUF.js";
|
|
18
|
-
import "./chunk-
|
|
18
|
+
import "./chunk-TWAJICBN.js";
|
|
19
19
|
import "./chunk-DRD2Q7HQ.js";
|
|
20
20
|
import "./chunk-LXOM6IQU.js";
|
|
21
21
|
import "./chunk-VOUOLGIP.js";
|
|
@@ -38,7 +38,6 @@ import "./chunk-E3VODCC3.js";
|
|
|
38
38
|
import "./chunk-YDBIWGNI.js";
|
|
39
39
|
import "./chunk-7DHTMOND.js";
|
|
40
40
|
import "./chunk-FWIROLS6.js";
|
|
41
|
-
import "./chunk-SCPFRKIT.js";
|
|
42
41
|
import "./chunk-ZZTOURJI.js";
|
|
43
42
|
import "./chunk-XKXKSQU7.js";
|
|
44
43
|
import "./chunk-3GPTTA4J.js";
|
|
@@ -56,7 +55,7 @@ import "./chunk-54V4BZWP.js";
|
|
|
56
55
|
import "./chunk-XZ4WBBB5.js";
|
|
57
56
|
import "./chunk-H3HDXD3U.js";
|
|
58
57
|
import "./chunk-LZTFCAKE.js";
|
|
59
|
-
import "./chunk-
|
|
58
|
+
import "./chunk-RQGR3ETH.js";
|
|
60
59
|
import "./chunk-UU6MVCJ6.js";
|
|
61
60
|
import "./chunk-YXLT4EMM.js";
|
|
62
61
|
import "./chunk-YVVQUAOO.js";
|
|
@@ -68,23 +67,23 @@ import "./chunk-6HEM6HTQ.js";
|
|
|
68
67
|
import "./chunk-XCAZF7KQ.js";
|
|
69
68
|
import "./chunk-3PG3H5TD.js";
|
|
70
69
|
import "./chunk-OD4FM2U7.js";
|
|
71
|
-
import "./chunk-
|
|
72
|
-
import "./chunk-
|
|
70
|
+
import "./chunk-D2EFNQMY.js";
|
|
71
|
+
import "./chunk-ANJOULTP.js";
|
|
73
72
|
import "./chunk-LN4YGHTM.js";
|
|
74
73
|
import "./chunk-JLNBQWZ2.js";
|
|
75
74
|
import "./chunk-2PRQG7PV.js";
|
|
76
75
|
import "./chunk-X6IRLNOO.js";
|
|
77
76
|
import "./chunk-2F6NP3NT.js";
|
|
78
77
|
import "./chunk-TERNBNJB.js";
|
|
79
|
-
import "./chunk-
|
|
78
|
+
import "./chunk-TYIXG4VR.js";
|
|
80
79
|
import "./chunk-W4RVMTHR.js";
|
|
81
|
-
import "./chunk-
|
|
80
|
+
import "./chunk-NMPEJV5M.js";
|
|
82
81
|
import "./chunk-ZRWB5D4H.js";
|
|
83
82
|
import "./chunk-AGRPGAKR.js";
|
|
84
83
|
import "./chunk-S4DDLTPX.js";
|
|
85
84
|
import "./chunk-SFQ6QNL7.js";
|
|
86
85
|
import "./chunk-33JBK2XP.js";
|
|
87
|
-
import "./chunk-
|
|
86
|
+
import "./chunk-TBLGI2LT.js";
|
|
88
87
|
import "./chunk-KFY3SGN7.js";
|
|
89
88
|
import {
|
|
90
89
|
resolvePluginEntry
|
|
@@ -123,7 +122,7 @@ import "./chunk-OADWQ5CR.js";
|
|
|
123
122
|
import "./chunk-7WV3F5DQ.js";
|
|
124
123
|
import {
|
|
125
124
|
EngramAccessService
|
|
126
|
-
} from "./chunk-
|
|
125
|
+
} from "./chunk-RP2U54GG.js";
|
|
127
126
|
import "./chunk-GDASG7NC.js";
|
|
128
127
|
import "./chunk-GDB4J2H3.js";
|
|
129
128
|
import "./chunk-DHGSZ3UD.js";
|
|
@@ -131,14 +130,14 @@ import "./chunk-H7XKCNR6.js";
|
|
|
131
130
|
import "./chunk-TIJYQXDI.js";
|
|
132
131
|
import "./chunk-SOBJ6NEY.js";
|
|
133
132
|
import "./chunk-BT7NVCML.js";
|
|
134
|
-
import "./chunk-
|
|
133
|
+
import "./chunk-A7EF2XRO.js";
|
|
135
134
|
import "./chunk-GYSYLGNE.js";
|
|
136
135
|
import "./chunk-5RIRL3XL.js";
|
|
137
136
|
import "./chunk-JGSKJHF7.js";
|
|
138
137
|
import "./chunk-FF4KLI5W.js";
|
|
139
138
|
import "./chunk-2MXEVL75.js";
|
|
140
|
-
import "./chunk-
|
|
141
|
-
import "./chunk-
|
|
139
|
+
import "./chunk-UNLHHTKN.js";
|
|
140
|
+
import "./chunk-R2EBP6CM.js";
|
|
142
141
|
import "./chunk-6G5JEN55.js";
|
|
143
142
|
import "./chunk-CYEPCZN5.js";
|
|
144
143
|
import "./chunk-GRYAECRV.js";
|
|
@@ -152,7 +151,7 @@ import "./chunk-7OGJQP7T.js";
|
|
|
152
151
|
import "./chunk-E6ZDCOHM.js";
|
|
153
152
|
import "./chunk-OIF36KGD.js";
|
|
154
153
|
import "./chunk-7DTASS5T.js";
|
|
155
|
-
import "./chunk-
|
|
154
|
+
import "./chunk-7PCZGNG2.js";
|
|
156
155
|
import "./chunk-M3VYPE2H.js";
|
|
157
156
|
import "./chunk-BMFZLLNI.js";
|
|
158
157
|
import "./chunk-CI7RKSRE.js";
|
|
@@ -169,13 +168,14 @@ import "./chunk-3ONXXHQO.js";
|
|
|
169
168
|
import "./chunk-Y56J7CXW.js";
|
|
170
169
|
import "./chunk-2LSZVONP.js";
|
|
171
170
|
import "./chunk-DEUNUKTD.js";
|
|
172
|
-
import "./chunk-
|
|
173
|
-
import "./chunk-
|
|
171
|
+
import "./chunk-GY3V3SUI.js";
|
|
172
|
+
import "./chunk-AX5O25EF.js";
|
|
174
173
|
import "./chunk-M7XQSUBB.js";
|
|
175
174
|
import "./chunk-5UZXUTVO.js";
|
|
176
175
|
import "./chunk-J6A3CX5N.js";
|
|
177
176
|
import "./chunk-AZBV4RRY.js";
|
|
178
|
-
import "./chunk-
|
|
177
|
+
import "./chunk-AWJ2FHCF.js";
|
|
178
|
+
import "./chunk-42JKGUFJ.js";
|
|
179
179
|
import "./chunk-RULE4VG5.js";
|
|
180
180
|
import "./chunk-SCU65EZI.js";
|
|
181
181
|
import "./chunk-MB5RSUW6.js";
|
package/dist/access-http.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
EngramAccessHttpServer
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-OYXVENIS.js";
|
|
4
4
|
import "./chunk-SEDEKFYQ.js";
|
|
5
5
|
import "./chunk-RKNJBZ55.js";
|
|
6
6
|
import "./chunk-J64TK33U.js";
|
|
@@ -9,10 +9,10 @@ import "./chunk-42NQ7AVG.js";
|
|
|
9
9
|
import "./chunk-TMSXWOBZ.js";
|
|
10
10
|
import "./chunk-7RXCMVFQ.js";
|
|
11
11
|
import "./chunk-7WV3F5DQ.js";
|
|
12
|
-
import "./chunk-
|
|
12
|
+
import "./chunk-7H7J3ZWN.js";
|
|
13
13
|
import "./chunk-T4WDJPEZ.js";
|
|
14
14
|
import "./chunk-D24OXEPB.js";
|
|
15
|
-
import "./chunk-
|
|
15
|
+
import "./chunk-RP2U54GG.js";
|
|
16
16
|
import "./chunk-GDASG7NC.js";
|
|
17
17
|
import "./chunk-GDB4J2H3.js";
|
|
18
18
|
import "./chunk-DHGSZ3UD.js";
|
|
@@ -20,14 +20,14 @@ import "./chunk-H7XKCNR6.js";
|
|
|
20
20
|
import "./chunk-TIJYQXDI.js";
|
|
21
21
|
import "./chunk-SOBJ6NEY.js";
|
|
22
22
|
import "./chunk-BT7NVCML.js";
|
|
23
|
-
import "./chunk-
|
|
23
|
+
import "./chunk-A7EF2XRO.js";
|
|
24
24
|
import "./chunk-GYSYLGNE.js";
|
|
25
25
|
import "./chunk-5RIRL3XL.js";
|
|
26
26
|
import "./chunk-JGSKJHF7.js";
|
|
27
27
|
import "./chunk-FF4KLI5W.js";
|
|
28
28
|
import "./chunk-2MXEVL75.js";
|
|
29
|
-
import "./chunk-
|
|
30
|
-
import "./chunk-
|
|
29
|
+
import "./chunk-UNLHHTKN.js";
|
|
30
|
+
import "./chunk-R2EBP6CM.js";
|
|
31
31
|
import "./chunk-6G5JEN55.js";
|
|
32
32
|
import "./chunk-CYEPCZN5.js";
|
|
33
33
|
import "./chunk-GRYAECRV.js";
|
|
@@ -41,7 +41,7 @@ import "./chunk-7OGJQP7T.js";
|
|
|
41
41
|
import "./chunk-E6ZDCOHM.js";
|
|
42
42
|
import "./chunk-OIF36KGD.js";
|
|
43
43
|
import "./chunk-7DTASS5T.js";
|
|
44
|
-
import "./chunk-
|
|
44
|
+
import "./chunk-7PCZGNG2.js";
|
|
45
45
|
import "./chunk-M3VYPE2H.js";
|
|
46
46
|
import "./chunk-BMFZLLNI.js";
|
|
47
47
|
import "./chunk-CI7RKSRE.js";
|
|
@@ -58,13 +58,14 @@ import "./chunk-3ONXXHQO.js";
|
|
|
58
58
|
import "./chunk-Y56J7CXW.js";
|
|
59
59
|
import "./chunk-2LSZVONP.js";
|
|
60
60
|
import "./chunk-DEUNUKTD.js";
|
|
61
|
-
import "./chunk-
|
|
62
|
-
import "./chunk-
|
|
61
|
+
import "./chunk-GY3V3SUI.js";
|
|
62
|
+
import "./chunk-AX5O25EF.js";
|
|
63
63
|
import "./chunk-M7XQSUBB.js";
|
|
64
64
|
import "./chunk-5UZXUTVO.js";
|
|
65
65
|
import "./chunk-J6A3CX5N.js";
|
|
66
66
|
import "./chunk-AZBV4RRY.js";
|
|
67
|
-
import "./chunk-
|
|
67
|
+
import "./chunk-AWJ2FHCF.js";
|
|
68
|
+
import "./chunk-42JKGUFJ.js";
|
|
68
69
|
import "./chunk-RULE4VG5.js";
|
|
69
70
|
import "./chunk-SCU65EZI.js";
|
|
70
71
|
import "./chunk-MB5RSUW6.js";
|
package/dist/access-mcp.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
EngramMcpServer
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-7H7J3ZWN.js";
|
|
4
4
|
import "./chunk-T4WDJPEZ.js";
|
|
5
5
|
import "./chunk-D24OXEPB.js";
|
|
6
|
-
import "./chunk-
|
|
6
|
+
import "./chunk-RP2U54GG.js";
|
|
7
7
|
import "./chunk-GDASG7NC.js";
|
|
8
8
|
import "./chunk-GDB4J2H3.js";
|
|
9
9
|
import "./chunk-DHGSZ3UD.js";
|
|
@@ -11,14 +11,14 @@ import "./chunk-H7XKCNR6.js";
|
|
|
11
11
|
import "./chunk-TIJYQXDI.js";
|
|
12
12
|
import "./chunk-SOBJ6NEY.js";
|
|
13
13
|
import "./chunk-BT7NVCML.js";
|
|
14
|
-
import "./chunk-
|
|
14
|
+
import "./chunk-A7EF2XRO.js";
|
|
15
15
|
import "./chunk-GYSYLGNE.js";
|
|
16
16
|
import "./chunk-5RIRL3XL.js";
|
|
17
17
|
import "./chunk-JGSKJHF7.js";
|
|
18
18
|
import "./chunk-FF4KLI5W.js";
|
|
19
19
|
import "./chunk-2MXEVL75.js";
|
|
20
|
-
import "./chunk-
|
|
21
|
-
import "./chunk-
|
|
20
|
+
import "./chunk-UNLHHTKN.js";
|
|
21
|
+
import "./chunk-R2EBP6CM.js";
|
|
22
22
|
import "./chunk-6G5JEN55.js";
|
|
23
23
|
import "./chunk-CYEPCZN5.js";
|
|
24
24
|
import "./chunk-GRYAECRV.js";
|
|
@@ -32,7 +32,7 @@ import "./chunk-7OGJQP7T.js";
|
|
|
32
32
|
import "./chunk-E6ZDCOHM.js";
|
|
33
33
|
import "./chunk-OIF36KGD.js";
|
|
34
34
|
import "./chunk-7DTASS5T.js";
|
|
35
|
-
import "./chunk-
|
|
35
|
+
import "./chunk-7PCZGNG2.js";
|
|
36
36
|
import "./chunk-M3VYPE2H.js";
|
|
37
37
|
import "./chunk-BMFZLLNI.js";
|
|
38
38
|
import "./chunk-CI7RKSRE.js";
|
|
@@ -49,13 +49,14 @@ import "./chunk-3ONXXHQO.js";
|
|
|
49
49
|
import "./chunk-Y56J7CXW.js";
|
|
50
50
|
import "./chunk-2LSZVONP.js";
|
|
51
51
|
import "./chunk-DEUNUKTD.js";
|
|
52
|
-
import "./chunk-
|
|
53
|
-
import "./chunk-
|
|
52
|
+
import "./chunk-GY3V3SUI.js";
|
|
53
|
+
import "./chunk-AX5O25EF.js";
|
|
54
54
|
import "./chunk-M7XQSUBB.js";
|
|
55
55
|
import "./chunk-5UZXUTVO.js";
|
|
56
56
|
import "./chunk-J6A3CX5N.js";
|
|
57
57
|
import "./chunk-AZBV4RRY.js";
|
|
58
|
-
import "./chunk-
|
|
58
|
+
import "./chunk-AWJ2FHCF.js";
|
|
59
|
+
import "./chunk-42JKGUFJ.js";
|
|
59
60
|
import "./chunk-RULE4VG5.js";
|
|
60
61
|
import "./chunk-SCU65EZI.js";
|
|
61
62
|
import "./chunk-MB5RSUW6.js";
|
package/dist/access-service.js
CHANGED
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
EngramAccessInputError,
|
|
4
4
|
EngramAccessService,
|
|
5
5
|
shapeMemorySummary
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-RP2U54GG.js";
|
|
7
7
|
import "./chunk-GDASG7NC.js";
|
|
8
8
|
import "./chunk-GDB4J2H3.js";
|
|
9
9
|
import "./chunk-DHGSZ3UD.js";
|
|
@@ -11,14 +11,14 @@ import "./chunk-H7XKCNR6.js";
|
|
|
11
11
|
import "./chunk-TIJYQXDI.js";
|
|
12
12
|
import "./chunk-SOBJ6NEY.js";
|
|
13
13
|
import "./chunk-BT7NVCML.js";
|
|
14
|
-
import "./chunk-
|
|
14
|
+
import "./chunk-A7EF2XRO.js";
|
|
15
15
|
import "./chunk-GYSYLGNE.js";
|
|
16
16
|
import "./chunk-5RIRL3XL.js";
|
|
17
17
|
import "./chunk-JGSKJHF7.js";
|
|
18
18
|
import "./chunk-FF4KLI5W.js";
|
|
19
19
|
import "./chunk-2MXEVL75.js";
|
|
20
|
-
import "./chunk-
|
|
21
|
-
import "./chunk-
|
|
20
|
+
import "./chunk-UNLHHTKN.js";
|
|
21
|
+
import "./chunk-R2EBP6CM.js";
|
|
22
22
|
import "./chunk-6G5JEN55.js";
|
|
23
23
|
import "./chunk-CYEPCZN5.js";
|
|
24
24
|
import "./chunk-GRYAECRV.js";
|
|
@@ -32,7 +32,7 @@ import "./chunk-7OGJQP7T.js";
|
|
|
32
32
|
import "./chunk-E6ZDCOHM.js";
|
|
33
33
|
import "./chunk-OIF36KGD.js";
|
|
34
34
|
import "./chunk-7DTASS5T.js";
|
|
35
|
-
import "./chunk-
|
|
35
|
+
import "./chunk-7PCZGNG2.js";
|
|
36
36
|
import "./chunk-M3VYPE2H.js";
|
|
37
37
|
import "./chunk-BMFZLLNI.js";
|
|
38
38
|
import "./chunk-CI7RKSRE.js";
|
|
@@ -49,13 +49,14 @@ import "./chunk-3ONXXHQO.js";
|
|
|
49
49
|
import "./chunk-Y56J7CXW.js";
|
|
50
50
|
import "./chunk-2LSZVONP.js";
|
|
51
51
|
import "./chunk-DEUNUKTD.js";
|
|
52
|
-
import "./chunk-
|
|
53
|
-
import "./chunk-
|
|
52
|
+
import "./chunk-GY3V3SUI.js";
|
|
53
|
+
import "./chunk-AX5O25EF.js";
|
|
54
54
|
import "./chunk-M7XQSUBB.js";
|
|
55
55
|
import "./chunk-5UZXUTVO.js";
|
|
56
56
|
import "./chunk-J6A3CX5N.js";
|
|
57
57
|
import "./chunk-AZBV4RRY.js";
|
|
58
|
-
import "./chunk-
|
|
58
|
+
import "./chunk-AWJ2FHCF.js";
|
|
59
|
+
import "./chunk-42JKGUFJ.js";
|
|
59
60
|
import "./chunk-RULE4VG5.js";
|
|
60
61
|
import "./chunk-SCU65EZI.js";
|
|
61
62
|
import "./chunk-MB5RSUW6.js";
|
package/dist/briefing.js
CHANGED
|
@@ -17,13 +17,14 @@ import {
|
|
|
17
17
|
renderBriefingMarkdown,
|
|
18
18
|
resolveBriefingSaveDir,
|
|
19
19
|
validateBriefingFormat
|
|
20
|
-
} from "./chunk-
|
|
21
|
-
import "./chunk-
|
|
20
|
+
} from "./chunk-GY3V3SUI.js";
|
|
21
|
+
import "./chunk-AX5O25EF.js";
|
|
22
22
|
import "./chunk-M7XQSUBB.js";
|
|
23
23
|
import "./chunk-5UZXUTVO.js";
|
|
24
24
|
import "./chunk-J6A3CX5N.js";
|
|
25
25
|
import "./chunk-AZBV4RRY.js";
|
|
26
|
-
import "./chunk-
|
|
26
|
+
import "./chunk-AWJ2FHCF.js";
|
|
27
|
+
import "./chunk-42JKGUFJ.js";
|
|
27
28
|
import "./chunk-RULE4VG5.js";
|
|
28
29
|
import "./chunk-SCU65EZI.js";
|
|
29
30
|
import "./chunk-MB5RSUW6.js";
|
|
@@ -4,10 +4,10 @@ import {
|
|
|
4
4
|
} from "./chunk-UXA5L2DZ.js";
|
|
5
5
|
import {
|
|
6
6
|
buildExtensionsBlockForConsolidation
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-D2EFNQMY.js";
|
|
8
8
|
import {
|
|
9
9
|
runPostConsolidationMaterialize
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-ANJOULTP.js";
|
|
11
11
|
import "./chunk-LN4YGHTM.js";
|
|
12
12
|
import "./chunk-JLNBQWZ2.js";
|
|
13
13
|
import "./chunk-3UXOZBHV.js";
|
|
@@ -20,12 +20,13 @@ import "./chunk-L2EXJQJP.js";
|
|
|
20
20
|
import "./chunk-7SI52C65.js";
|
|
21
21
|
import "./chunk-RK6F44Y6.js";
|
|
22
22
|
import "./chunk-HQ6NIBL6.js";
|
|
23
|
-
import "./chunk-
|
|
23
|
+
import "./chunk-AX5O25EF.js";
|
|
24
24
|
import "./chunk-M7XQSUBB.js";
|
|
25
25
|
import "./chunk-5UZXUTVO.js";
|
|
26
26
|
import "./chunk-J6A3CX5N.js";
|
|
27
27
|
import "./chunk-AZBV4RRY.js";
|
|
28
|
-
import "./chunk-
|
|
28
|
+
import "./chunk-AWJ2FHCF.js";
|
|
29
|
+
import "./chunk-42JKGUFJ.js";
|
|
29
30
|
import "./chunk-RULE4VG5.js";
|
|
30
31
|
import "./chunk-SCU65EZI.js";
|
|
31
32
|
import "./chunk-MB5RSUW6.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/causal-consolidation.ts"],"sourcesContent":["/**\n * causal-consolidation.ts — CMC Phase 2: LLM-Assisted Causal Consolidation\n *\n * Uses an LLM to analyze causal trajectory patterns across sessions.\n * The LLM receives the causal chain graph as context — connected trajectories\n * from different sessions — and identifies recurring behavioral patterns,\n * preference signals, and actionable rules.\n *\n * This is the core CMC innovation: the LLM gets cross-session causal context\n * that no other memory system provides. It can see that a user investigated\n * a bug in session 1, attempted a fix in session 2, and succeeded in session 3 —\n * and synthesize a rule or preference from that chain.\n */\n\nimport { createHash } from \"node:crypto\";\nimport { resolveCausalTrajectoryStoreDir, type CausalTrajectoryRecord } from \"./causal-trajectory.js\";\nimport { readChainIndex, resolveChainsDir, type CausalChainIndex, type CausalEdge } from \"./causal-chain.js\";\nimport { listJsonFiles, readJsonFile } from \"./json-store.js\";\nimport { isRecord } from \"./store-contract.js\";\nimport { FallbackLlmClient, fallbackLlmRuntimeContextFromConfig } from \"./fallback-llm.js\";\nimport type { AgentPersonaModelConfig, GatewayConfig, MemoryFile, PluginConfig } from \"./types.js\";\nimport path from \"node:path\";\nimport { log } from \"./logger.js\";\nimport { runPostConsolidationMaterialize } from \"./connectors/codex-materialize-runner.js\";\nimport type { MaterializeResult, RolloutSummaryInput } from \"./connectors/codex-materialize.js\";\nimport { buildExtensionsBlockForConsolidation } from \"./semantic-consolidation.js\";\n\n// ─── Types ───────────────────────────────────────────────────────────────────\n\nexport interface CausalPatternCandidate {\n id: string;\n sourceType: \"causal-pattern\";\n subject: string;\n category: \"principle\" | \"rule\" | \"preference\";\n content: string;\n score: number;\n rationale: string;\n outcome: null;\n provenance: string[];\n agent: string | null;\n workflow: string | null;\n}\n\nexport interface ConsolidationConfig {\n minRecurrence: number;\n minSessions: number;\n successThreshold: number;\n}\n\nexport interface LlmConsolidationResult {\n rules: Array<{\n content: string;\n category: \"rule\" | \"principle\" | \"preference\";\n confidence: number;\n evidence: string[];\n }>;\n preferences: Array<{\n statement: string;\n confidence: number;\n evidence: string[];\n }>;\n}\n\nconst CAUSAL_RULE_CATEGORIES = new Set([\"rule\", \"principle\", \"preference\"]);\n\ninterface ConsolidationLlmClient {\n isAvailable(options?: { agentId?: string; modelChain?: AgentPersonaModelConfig }): boolean;\n chatCompletion(\n messages: Array<{ role: \"system\" | \"user\" | \"assistant\"; content: string }>,\n options?: { temperature?: number; maxTokens?: number; agentId?: string; modelChain?: AgentPersonaModelConfig },\n ): Promise<{ content: string } | null>;\n}\n\n// ─── Trajectory Reading ──────────────────────────────────────────────────────\n\nasync function readAllTrajectories(\n memoryDir: string,\n causalTrajectoryStoreDir?: string,\n): Promise<CausalTrajectoryRecord[]> {\n const root = resolveCausalTrajectoryStoreDir(memoryDir, causalTrajectoryStoreDir);\n const trajectoriesDir = path.join(root, \"trajectories\");\n\n const files = await listJsonFiles(trajectoriesDir).catch(() => [] as string[]);\n const results: CausalTrajectoryRecord[] = [];\n\n for (const filePath of files) {\n try {\n const raw = await readJsonFile(filePath);\n if (isRecord(raw) && typeof raw.trajectoryId === \"string\") {\n results.push(raw as unknown as CausalTrajectoryRecord);\n }\n } catch {\n // skip invalid\n }\n }\n\n return results;\n}\n\n// ─── Context Formatting ──────────────────────────────────────────────────────\n\n/**\n * Format trajectories and their causal connections as a readable context\n * for the LLM. Groups by session and shows chain connections.\n */\nfunction formatCausalContext(\n trajectories: CausalTrajectoryRecord[],\n chainIndex: CausalChainIndex,\n maxChars: number = 8000,\n): string {\n // Group trajectories by session\n const bySession = new Map<string, CausalTrajectoryRecord[]>();\n for (const t of trajectories) {\n const list = bySession.get(t.sessionKey) ?? [];\n list.push(t);\n bySession.set(t.sessionKey, list);\n }\n\n const lines: string[] = [];\n lines.push(`## Causal Trajectories (${trajectories.length} across ${bySession.size} sessions)`);\n lines.push(\"\");\n\n // Format each session's trajectories\n for (const [sessionKey, sessionTrajs] of bySession) {\n lines.push(`### Session: ${sessionKey}`);\n for (const t of sessionTrajs.slice(0, 5)) {\n const outcome = t.outcomeKind === \"success\" ? \"+\" : t.outcomeKind === \"failure\" ? \"-\" : \"~\";\n lines.push(`[${outcome}] Goal: ${t.goal}`);\n lines.push(` Action: ${t.actionSummary}`);\n lines.push(` Outcome: ${t.outcomeSummary}`);\n if (t.followUpSummary) lines.push(` Follow-up: ${t.followUpSummary}`);\n if (t.entityRefs?.length) lines.push(` Entities: ${t.entityRefs.join(\", \")}`);\n }\n lines.push(\"\");\n }\n\n // Format causal chain connections\n const edgeCount = Object.keys(chainIndex.edges).length;\n if (edgeCount > 0) {\n lines.push(`## Cross-Session Causal Chains (${edgeCount} connections)`);\n lines.push(\"\");\n\n const trajectoryMap = new Map(trajectories.map((t) => [t.trajectoryId, t]));\n const shown = new Set<string>();\n\n for (const [edgeId, edge] of Object.entries(chainIndex.edges)) {\n if (shown.size >= 10) break; // limit output size\n const from = trajectoryMap.get(edge.fromTrajectoryId);\n const to = trajectoryMap.get(edge.toTrajectoryId);\n if (!from || !to) continue;\n\n lines.push(`${edge.edgeType}: \"${from.goal}\" (${from.sessionKey}) → \"${to.goal}\" (${to.sessionKey})`);\n shown.add(edgeId);\n }\n lines.push(\"\");\n }\n\n const result = lines.join(\"\\n\");\n return result.length > maxChars ? result.slice(0, maxChars) + \"\\n[truncated]\" : result;\n}\n\n// ─── LLM Consolidation ──────────────────────────────────────────────────────\n\nconst CONSOLIDATION_PROMPT = `You are analyzing a user's causal trajectory history across multiple sessions. Trajectories record what the user tried to do (goal), what they did (action), and what happened (outcome).\n\nYour job is to identify:\n1. BEHAVIORAL RULES: Recurring patterns where the same approach consistently succeeds or fails. These should be actionable guidance for future sessions.\n2. PREFERENCES: What the user cares about, prefers, or consistently chooses — even if never explicitly stated. Infer preferences from what they repeatedly do, retry until successful, or always include in their workflow.\n\nIMPORTANT:\n- Look for CROSS-SESSION patterns — things that repeat across different sessions are more significant than within-session patterns.\n- A user who retries the same goal across sessions has a strong implicit preference for that outcome.\n- Consistent action choices reveal preferences even when the user never says \"I prefer X.\"\n- Frame preferences as \"The user would prefer responses that...\" when applicable.\n\nOutput valid JSON only:\n{\n \"rules\": [\n {\"content\": \"actionable rule text\", \"category\": \"rule|principle\", \"confidence\": 0.0-1.0, \"evidence\": [\"trajectory IDs\"]}\n ],\n \"preferences\": [\n {\"statement\": \"The user would prefer...\", \"confidence\": 0.0-1.0, \"evidence\": [\"trajectory IDs\"]}\n ]\n}\n\nIf no clear patterns exist, return {\"rules\": [], \"preferences\": []}.`;\n\nasync function consolidateWithLlm(\n context: string,\n llm: ConsolidationLlmClient,\n options: { agentId?: string; modelChain?: AgentPersonaModelConfig } = {},\n): Promise<LlmConsolidationResult> {\n const response = await llm.chatCompletion(\n [\n { role: \"system\", content: CONSOLIDATION_PROMPT },\n { role: \"user\", content: context },\n ],\n { temperature: 0.2, maxTokens: 2000, agentId: options.agentId, modelChain: options.modelChain },\n );\n\n if (!response?.content) {\n return { rules: [], preferences: [] };\n }\n\n try {\n // Extract JSON from response (may have markdown code fences)\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 const rawRules: unknown[] = Array.isArray(parsed.rules) ? parsed.rules : [];\n const rawPreferences: unknown[] = Array.isArray(parsed.preferences) ? parsed.preferences : [];\n return {\n rules: rawRules\n .map(parseLlmRule)\n .filter((rule): rule is LlmConsolidationResult[\"rules\"][number] => !!rule),\n preferences: rawPreferences\n .map(parseLlmPreference)\n .filter((pref): pref is LlmConsolidationResult[\"preferences\"][number] => !!pref),\n };\n } catch {\n log.warn(\"[cmc] failed to parse LLM consolidation response\");\n return { rules: [], preferences: [] };\n }\n}\n\n// ─── Candidate Generation ────────────────────────────────────────────────────\n\nfunction stablePatternId(content: string): string {\n const digest = createHash(\"sha256\")\n .update(`causal-pattern\\0${content}`)\n .digest(\"hex\")\n .slice(0, 16);\n return `causal-pattern:${digest}`;\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 parseEvidence(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 parseLlmRule(raw: unknown): LlmConsolidationResult[\"rules\"][number] | undefined {\n if (!raw || typeof raw !== \"object\" || Array.isArray(raw)) return undefined;\n const r = raw as Record<string, unknown>;\n const content = typeof r.content === \"string\" ? r.content.trim() : \"\";\n const category = typeof r.category === \"string\" ? r.category : \"\";\n const confidence = parseConfidence(r.confidence);\n if (content.length <= 5 || !CAUSAL_RULE_CATEGORIES.has(category) || confidence === undefined) {\n return undefined;\n }\n return {\n content,\n category: category as \"rule\" | \"principle\" | \"preference\",\n confidence,\n evidence: parseEvidence(r.evidence),\n };\n}\n\nfunction parseLlmPreference(raw: unknown): LlmConsolidationResult[\"preferences\"][number] | undefined {\n if (!raw || typeof raw !== \"object\" || Array.isArray(raw)) return undefined;\n const p = raw as Record<string, unknown>;\n const statement = typeof p.statement === \"string\" ? p.statement.trim() : \"\";\n const confidence = parseConfidence(p.confidence);\n if (statement.length <= 5 || confidence === undefined) return undefined;\n return {\n statement,\n confidence,\n evidence: parseEvidence(p.evidence),\n };\n}\n\nfunction llmResultToCandidates(result: LlmConsolidationResult): CausalPatternCandidate[] {\n const candidates: CausalPatternCandidate[] = [];\n\n for (const rule of result.rules) {\n const category =\n rule.category === \"principle\" || rule.category === \"preference\"\n ? rule.category\n : \"rule\";\n candidates.push({\n id: stablePatternId(rule.content),\n sourceType: \"causal-pattern\",\n subject: rule.content.slice(0, 80),\n category,\n content: rule.content,\n score: Math.min(1, rule.confidence ?? 0.7),\n rationale: \"LLM-identified causal pattern from cross-session trajectory analysis\",\n outcome: null,\n provenance: (rule.evidence ?? []).slice(0, 5),\n agent: null,\n workflow: null,\n });\n }\n\n for (const preference of result.preferences) {\n candidates.push({\n id: stablePatternId(preference.statement),\n sourceType: \"causal-pattern\",\n subject: preference.statement.slice(0, 80),\n category: \"preference\",\n content: preference.statement,\n score: Math.min(1, preference.confidence ?? 0.7),\n rationale: \"LLM-identified preference from cross-session trajectory analysis\",\n outcome: null,\n provenance: (preference.evidence ?? []).slice(0, 5),\n agent: null,\n workflow: null,\n });\n }\n\n return candidates;\n}\n\nfunction normalizePositiveInteger(value: number, fallback: number): number {\n return Number.isFinite(value) && value > 0 ? Math.floor(value) : fallback;\n}\n\nfunction normalizeSuccessThreshold(value: number): number {\n if (!Number.isFinite(value) || value <= 0) return 0;\n return Math.min(1, value);\n}\n\nfunction trajectorySuccessScore(trajectory: CausalTrajectoryRecord): number {\n if (trajectory.outcomeKind === \"success\") return 1;\n if (trajectory.outcomeKind === \"partial\") return 0.5;\n return 0;\n}\n\nfunction averageSuccessScore(trajectories: CausalTrajectoryRecord[]): number {\n if (trajectories.length === 0) return 0;\n const total = trajectories.reduce((sum, trajectory) => sum + trajectorySuccessScore(trajectory), 0);\n return total / trajectories.length;\n}\n\nfunction passesConsolidationGates(\n trajectories: CausalTrajectoryRecord[],\n config: ConsolidationConfig,\n): boolean {\n const minRecurrence = normalizePositiveInteger(config.minRecurrence, 1);\n if (trajectories.length < minRecurrence) return false;\n\n const minSessions = normalizePositiveInteger(config.minSessions, 1);\n const sessionCount = new Set(trajectories.map((trajectory) => trajectory.sessionKey)).size;\n if (sessionCount < minSessions) return false;\n\n const successThreshold = normalizeSuccessThreshold(config.successThreshold);\n if (successThreshold > 0 && averageSuccessScore(trajectories) < successThreshold) {\n return false;\n }\n\n return true;\n}\n\n// ─── Public API ──────────────────────────────────────────────────────────────\n\n/**\n * Run LLM-assisted consolidation: read trajectories, format causal context,\n * ask LLM to identify patterns and preferences.\n */\nexport async function deriveCausalPromotionCandidates(options: {\n memoryDir: string;\n causalTrajectoryStoreDir?: string;\n config: ConsolidationConfig;\n gatewayConfig?: GatewayConfig;\n gatewayAgentId?: string;\n modelChain?: AgentPersonaModelConfig;\n workspaceDir?: string;\n pluginConfig?: PluginConfig;\n llmClient?: ConsolidationLlmClient;\n}): Promise<CausalPatternCandidate[]> {\n try {\n const trajectories = await readAllTrajectories(options.memoryDir, options.causalTrajectoryStoreDir);\n if (!passesConsolidationGates(trajectories, options.config)) return [];\n\n const chainsDir = resolveChainsDir(options.memoryDir, options.causalTrajectoryStoreDir);\n const chainIndex = await readChainIndex(chainsDir);\n\n // Format the causal context for the LLM\n let context = formatCausalContext(trajectories, chainIndex);\n\n // Append memory extensions block if available (#382)\n if (options.pluginConfig) {\n const extBlock = await buildExtensionsBlockForConsolidation(options.pluginConfig);\n if (extBlock.length > 0) {\n context += \"\\n\\n\" + extBlock;\n }\n }\n\n // If no LLM available, fall back to empty (no deterministic fallback)\n const llm = options.llmClient ?? new FallbackLlmClient(\n options.gatewayConfig,\n options.pluginConfig\n ? fallbackLlmRuntimeContextFromConfig(options.pluginConfig, {\n workspaceDir: options.workspaceDir ?? options.pluginConfig.workspaceDir,\n })\n : { workspaceDir: options.workspaceDir },\n );\n const llmOptions = { agentId: options.gatewayAgentId, modelChain: options.modelChain };\n if (!llm.isAvailable(llmOptions)) {\n log.debug(\"[cmc] no LLM available for consolidation — skipping\");\n return [];\n }\n\n // Call LLM for pattern analysis\n const result = await consolidateWithLlm(context, llm, llmOptions);\n const candidates = llmResultToCandidates(result);\n\n log.debug(`[cmc] LLM consolidation produced ${candidates.length} rule(s) and ${result.preferences.length} preference(s)`);\n return candidates;\n } catch (error) {\n log.warn(`[cmc] consolidation failed (non-fatal): ${error instanceof Error ? error.message : String(error)}`);\n return [];\n }\n}\n\n/**\n * Get LLM-synthesized preferences from causal trajectory analysis.\n * Returns formatted preference statements for recall injection.\n */\nexport async function synthesizeCausalPreferencesViaLlm(options: {\n memoryDir: string;\n causalTrajectoryStoreDir?: string;\n gatewayConfig?: GatewayConfig;\n gatewayAgentId?: string;\n modelChain?: AgentPersonaModelConfig;\n workspaceDir?: string;\n minTrajectories?: number;\n}): Promise<string | null> {\n try {\n const trajectories = await readAllTrajectories(options.memoryDir, options.causalTrajectoryStoreDir);\n if (trajectories.length < (options.minTrajectories ?? 2)) return null;\n\n const chainsDir = resolveChainsDir(options.memoryDir, options.causalTrajectoryStoreDir);\n const chainIndex = await readChainIndex(chainsDir);\n const context = formatCausalContext(trajectories, chainIndex);\n\n const llm = new FallbackLlmClient(options.gatewayConfig, {\n workspaceDir: options.workspaceDir,\n });\n const llmOptions = { agentId: options.gatewayAgentId, modelChain: options.modelChain };\n if (!llm.isAvailable(llmOptions)) return null;\n\n const result = await consolidateWithLlm(context, llm, llmOptions);\n if (result.preferences.length === 0 && result.rules.length === 0) return null;\n\n const lines: string[] = [\"## Behavioral Insights (from Causal Chain Analysis)\", \"\"];\n\n for (const pref of result.preferences) {\n lines.push(`- ${pref.statement}`);\n }\n\n for (const rule of result.rules) {\n lines.push(`- ${rule.content}`);\n }\n\n lines.push(\"\");\n return lines.join(\"\\n\");\n } catch (error) {\n log.warn(`[cmc] preference synthesis failed (non-fatal): ${error instanceof Error ? error.message : String(error)}`);\n return null;\n }\n}\n\n/**\n * Optional post-consolidation hook — materializes Codex-native memory artifacts\n * after a causal consolidation run. Guarded by `codexMaterializeMemories` and\n * `codexMaterializeOnConsolidation`. Returns `null` when disabled or when the\n * sentinel is missing (honors user hand-edits).\n *\n * Split from the orchestrator-owned flow so #378 avoids touching\n * orchestrator.ts while Wave 1 edits are in flight.\n */\nexport async function materializeAfterCausalConsolidation(options: {\n config: PluginConfig;\n namespace?: string;\n memories?: MemoryFile[];\n memoryDir?: string;\n codexHome?: string;\n rolloutSummaries?: RolloutSummaryInput[];\n now?: Date;\n}): Promise<MaterializeResult | null> {\n // Delegates to the shared post-consolidation helper — see\n // runPostConsolidationMaterialize in codex-materialize-runner.ts.\n return runPostConsolidationMaterialize(\"[cmc]\", options);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAcA,SAAS,kBAAkB;AAO3B,OAAO,UAAU;AA0CjB,IAAM,yBAAyB,oBAAI,IAAI,CAAC,QAAQ,aAAa,YAAY,CAAC;AAY1E,eAAe,oBACb,WACA,0BACmC;AACnC,QAAM,OAAO,gCAAgC,WAAW,wBAAwB;AAChF,QAAM,kBAAkB,KAAK,KAAK,MAAM,cAAc;AAEtD,QAAM,QAAQ,MAAM,cAAc,eAAe,EAAE,MAAM,MAAM,CAAC,CAAa;AAC7E,QAAM,UAAoC,CAAC;AAE3C,aAAW,YAAY,OAAO;AAC5B,QAAI;AACF,YAAM,MAAM,MAAM,aAAa,QAAQ;AACvC,UAAI,SAAS,GAAG,KAAK,OAAO,IAAI,iBAAiB,UAAU;AACzD,gBAAQ,KAAK,GAAwC;AAAA,MACvD;AAAA,IACF,QAAQ;AAAA,IAER;AAAA,EACF;AAEA,SAAO;AACT;AAQA,SAAS,oBACP,cACA,YACA,WAAmB,KACX;AAER,QAAM,YAAY,oBAAI,IAAsC;AAC5D,aAAW,KAAK,cAAc;AAC5B,UAAM,OAAO,UAAU,IAAI,EAAE,UAAU,KAAK,CAAC;AAC7C,SAAK,KAAK,CAAC;AACX,cAAU,IAAI,EAAE,YAAY,IAAI;AAAA,EAClC;AAEA,QAAM,QAAkB,CAAC;AACzB,QAAM,KAAK,2BAA2B,aAAa,MAAM,WAAW,UAAU,IAAI,YAAY;AAC9F,QAAM,KAAK,EAAE;AAGb,a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AM,WAAW,EAAG,QAAO;AAEzE,UAAM,QAAkB,CAAC,uDAAuD,EAAE;AAElF,eAAW,QAAQ,OAAO,aAAa;AACrC,YAAM,KAAK,KAAK,KAAK,SAAS,EAAE;AAAA,IAClC;AAEA,eAAW,QAAQ,OAAO,OAAO;AAC/B,YAAM,KAAK,KAAK,KAAK,OAAO,EAAE;AAAA,IAChC;AAEA,UAAM,KAAK,EAAE;AACb,WAAO,MAAM,KAAK,IAAI;AAAA,EACxB,SAAS,OAAO;AACd,QAAI,KAAK,kDAAkD,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK,CAAC,EAAE;AACnH,WAAO;AAAA,EACT;AACF;AAWA,eAAsB,oCAAoC,SAQpB;AAGpC,SAAO,gCAAgC,SAAS,OAAO;AACzD;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../src/causal-consolidation.ts"],"sourcesContent":["/**\n * causal-consolidation.ts — CMC Phase 2: LLM-Assisted Causal Consolidation\n *\n * Uses an LLM to analyze causal trajectory patterns across sessions.\n * The LLM receives the causal chain graph as context — connected trajectories\n * from different sessions — and identifies recurring behavioral patterns,\n * preference signals, and actionable rules.\n *\n * This is the core CMC innovation: the LLM gets cross-session causal context\n * that no other memory system provides. It can see that a user investigated\n * a bug in session 1, attempted a fix in session 2, and succeeded in session 3 —\n * and synthesize a rule or preference from that chain.\n */\n\nimport { createHash } from \"node:crypto\";\nimport { resolveCausalTrajectoryStoreDir, type CausalTrajectoryRecord } from \"./causal-trajectory.js\";\nimport { readChainIndex, resolveChainsDir, type CausalChainIndex, type CausalEdge } from \"./causal-chain.js\";\nimport { listJsonFiles, readJsonFile } from \"./json-store.js\";\nimport { isRecord } from \"./store-contract.js\";\nimport { FallbackLlmClient, fallbackLlmRuntimeContextFromConfig } from \"./fallback-llm.js\";\nimport type { AgentPersonaModelConfig, GatewayConfig, MemoryFile, PluginConfig } from \"./types.js\";\nimport path from \"node:path\";\nimport { log } from \"./logger.js\";\nimport { runPostConsolidationMaterialize } from \"./connectors/codex-materialize-runner.js\";\nimport type { MaterializeResult, RolloutSummaryInput } from \"./connectors/codex-materialize.js\";\nimport { buildExtensionsBlockForConsolidation } from \"./semantic-consolidation.js\";\n\n// ─── Types ───────────────────────────────────────────────────────────────────\n\nexport interface CausalPatternCandidate {\n id: string;\n sourceType: \"causal-pattern\";\n subject: string;\n category: \"principle\" | \"rule\" | \"preference\";\n content: string;\n score: number;\n rationale: string;\n outcome: null;\n provenance: string[];\n agent: string | null;\n workflow: string | null;\n}\n\nexport interface ConsolidationConfig {\n minRecurrence: number;\n minSessions: number;\n successThreshold: number;\n}\n\nexport interface LlmConsolidationResult {\n rules: Array<{\n content: string;\n category: \"rule\" | \"principle\" | \"preference\";\n confidence: number;\n evidence: string[];\n }>;\n preferences: Array<{\n statement: string;\n confidence: number;\n evidence: string[];\n }>;\n}\n\nconst CAUSAL_RULE_CATEGORIES = new Set([\"rule\", \"principle\", \"preference\"]);\n\ninterface ConsolidationLlmClient {\n isAvailable(options?: { agentId?: string; modelChain?: AgentPersonaModelConfig }): boolean;\n chatCompletion(\n messages: Array<{ role: \"system\" | \"user\" | \"assistant\"; content: string }>,\n options?: { temperature?: number; maxTokens?: number; agentId?: string; modelChain?: AgentPersonaModelConfig },\n ): Promise<{ content: string } | null>;\n}\n\n// ─── Trajectory Reading ──────────────────────────────────────────────────────\n\nasync function readAllTrajectories(\n memoryDir: string,\n causalTrajectoryStoreDir?: string,\n): Promise<CausalTrajectoryRecord[]> {\n const root = resolveCausalTrajectoryStoreDir(memoryDir, causalTrajectoryStoreDir);\n const trajectoriesDir = path.join(root, \"trajectories\");\n\n const files = await listJsonFiles(trajectoriesDir).catch(() => [] as string[]);\n const results: CausalTrajectoryRecord[] = [];\n\n for (const filePath of files) {\n try {\n const raw = await readJsonFile(filePath);\n if (isRecord(raw) && typeof raw.trajectoryId === \"string\") {\n results.push(raw as unknown as CausalTrajectoryRecord);\n }\n } catch {\n // skip invalid\n }\n }\n\n return results;\n}\n\n// ─── Context Formatting ──────────────────────────────────────────────────────\n\n/**\n * Format trajectories and their causal connections as a readable context\n * for the LLM. Groups by session and shows chain connections.\n */\nfunction formatCausalContext(\n trajectories: CausalTrajectoryRecord[],\n chainIndex: CausalChainIndex,\n maxChars: number = 8000,\n): string {\n // Group trajectories by session\n const bySession = new Map<string, CausalTrajectoryRecord[]>();\n for (const t of trajectories) {\n const list = bySession.get(t.sessionKey) ?? [];\n list.push(t);\n bySession.set(t.sessionKey, list);\n }\n\n const lines: string[] = [];\n lines.push(`## Causal Trajectories (${trajectories.length} across ${bySession.size} sessions)`);\n lines.push(\"\");\n\n // Format each session's trajectories\n for (const [sessionKey, sessionTrajs] of bySession) {\n lines.push(`### Session: ${sessionKey}`);\n for (const t of sessionTrajs.slice(0, 5)) {\n const outcome = t.outcomeKind === \"success\" ? \"+\" : t.outcomeKind === \"failure\" ? \"-\" : \"~\";\n lines.push(`[${outcome}] Goal: ${t.goal}`);\n lines.push(` Action: ${t.actionSummary}`);\n lines.push(` Outcome: ${t.outcomeSummary}`);\n if (t.followUpSummary) lines.push(` Follow-up: ${t.followUpSummary}`);\n if (t.entityRefs?.length) lines.push(` Entities: ${t.entityRefs.join(\", \")}`);\n }\n lines.push(\"\");\n }\n\n // Format causal chain connections\n const edgeCount = Object.keys(chainIndex.edges).length;\n if (edgeCount > 0) {\n lines.push(`## Cross-Session Causal Chains (${edgeCount} connections)`);\n lines.push(\"\");\n\n const trajectoryMap = new Map(trajectories.map((t) => [t.trajectoryId, t]));\n const shown = new Set<string>();\n\n for (const [edgeId, edge] of Object.entries(chainIndex.edges)) {\n if (shown.size >= 10) break; // limit output size\n const from = trajectoryMap.get(edge.fromTrajectoryId);\n const to = trajectoryMap.get(edge.toTrajectoryId);\n if (!from || !to) continue;\n\n lines.push(`${edge.edgeType}: \"${from.goal}\" (${from.sessionKey}) → \"${to.goal}\" (${to.sessionKey})`);\n shown.add(edgeId);\n }\n lines.push(\"\");\n }\n\n const result = lines.join(\"\\n\");\n return result.length > maxChars ? result.slice(0, maxChars) + \"\\n[truncated]\" : result;\n}\n\n// ─── LLM Consolidation ──────────────────────────────────────────────────────\n\nconst CONSOLIDATION_PROMPT = `You are analyzing a user's causal trajectory history across multiple sessions. Trajectories record what the user tried to do (goal), what they did (action), and what happened (outcome).\n\nYour job is to identify:\n1. BEHAVIORAL RULES: Recurring patterns where the same approach consistently succeeds or fails. These should be actionable guidance for future sessions.\n2. PREFERENCES: What the user cares about, prefers, or consistently chooses — even if never explicitly stated. Infer preferences from what they repeatedly do, retry until successful, or always include in their workflow.\n\nIMPORTANT:\n- Look for CROSS-SESSION patterns — things that repeat across different sessions are more significant than within-session patterns.\n- A user who retries the same goal across sessions has a strong implicit preference for that outcome.\n- Consistent action choices reveal preferences even when the user never says \"I prefer X.\"\n- Frame preferences as \"The user would prefer responses that...\" when applicable.\n\nOutput valid JSON only:\n{\n \"rules\": [\n {\"content\": \"actionable rule text\", \"category\": \"rule|principle\", \"confidence\": 0.0-1.0, \"evidence\": [\"trajectory IDs\"]}\n ],\n \"preferences\": [\n {\"statement\": \"The user would prefer...\", \"confidence\": 0.0-1.0, \"evidence\": [\"trajectory IDs\"]}\n ]\n}\n\nIf no clear patterns exist, return {\"rules\": [], \"preferences\": []}.`;\n\nasync function consolidateWithLlm(\n context: string,\n llm: ConsolidationLlmClient,\n options: { agentId?: string; modelChain?: AgentPersonaModelConfig } = {},\n): Promise<LlmConsolidationResult> {\n const response = await llm.chatCompletion(\n [\n { role: \"system\", content: CONSOLIDATION_PROMPT },\n { role: \"user\", content: context },\n ],\n { temperature: 0.2, maxTokens: 2000, agentId: options.agentId, modelChain: options.modelChain },\n );\n\n if (!response?.content) {\n return { rules: [], preferences: [] };\n }\n\n try {\n // Extract JSON from response (may have markdown code fences)\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 const rawRules: unknown[] = Array.isArray(parsed.rules) ? parsed.rules : [];\n const rawPreferences: unknown[] = Array.isArray(parsed.preferences) ? parsed.preferences : [];\n return {\n rules: rawRules\n .map(parseLlmRule)\n .filter((rule): rule is LlmConsolidationResult[\"rules\"][number] => !!rule),\n preferences: rawPreferences\n .map(parseLlmPreference)\n .filter((pref): pref is LlmConsolidationResult[\"preferences\"][number] => !!pref),\n };\n } catch {\n log.warn(\"[cmc] failed to parse LLM consolidation response\");\n return { rules: [], preferences: [] };\n }\n}\n\n// ─── Candidate Generation ────────────────────────────────────────────────────\n\nfunction stablePatternId(content: string): string {\n const digest = createHash(\"sha256\")\n .update(`causal-pattern\\0${content}`)\n .digest(\"hex\")\n .slice(0, 16);\n return `causal-pattern:${digest}`;\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 parseEvidence(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 parseLlmRule(raw: unknown): LlmConsolidationResult[\"rules\"][number] | undefined {\n if (!raw || typeof raw !== \"object\" || Array.isArray(raw)) return undefined;\n const r = raw as Record<string, unknown>;\n const content = typeof r.content === \"string\" ? r.content.trim() : \"\";\n const category = typeof r.category === \"string\" ? r.category : \"\";\n const confidence = parseConfidence(r.confidence);\n if (content.length <= 5 || !CAUSAL_RULE_CATEGORIES.has(category) || confidence === undefined) {\n return undefined;\n }\n return {\n content,\n category: category as \"rule\" | \"principle\" | \"preference\",\n confidence,\n evidence: parseEvidence(r.evidence),\n };\n}\n\nfunction parseLlmPreference(raw: unknown): LlmConsolidationResult[\"preferences\"][number] | undefined {\n if (!raw || typeof raw !== \"object\" || Array.isArray(raw)) return undefined;\n const p = raw as Record<string, unknown>;\n const statement = typeof p.statement === \"string\" ? p.statement.trim() : \"\";\n const confidence = parseConfidence(p.confidence);\n if (statement.length <= 5 || confidence === undefined) return undefined;\n return {\n statement,\n confidence,\n evidence: parseEvidence(p.evidence),\n };\n}\n\nfunction llmResultToCandidates(result: LlmConsolidationResult): CausalPatternCandidate[] {\n const candidates: CausalPatternCandidate[] = [];\n\n for (const rule of result.rules) {\n const category =\n rule.category === \"principle\" || rule.category === \"preference\"\n ? rule.category\n : \"rule\";\n candidates.push({\n id: stablePatternId(rule.content),\n sourceType: \"causal-pattern\",\n subject: rule.content.slice(0, 80),\n category,\n content: rule.content,\n score: Math.min(1, rule.confidence ?? 0.7),\n rationale: \"LLM-identified causal pattern from cross-session trajectory analysis\",\n outcome: null,\n provenance: (rule.evidence ?? []).slice(0, 5),\n agent: null,\n workflow: null,\n });\n }\n\n for (const preference of result.preferences) {\n candidates.push({\n id: stablePatternId(preference.statement),\n sourceType: \"causal-pattern\",\n subject: preference.statement.slice(0, 80),\n category: \"preference\",\n content: preference.statement,\n score: Math.min(1, preference.confidence ?? 0.7),\n rationale: \"LLM-identified preference from cross-session trajectory analysis\",\n outcome: null,\n provenance: (preference.evidence ?? []).slice(0, 5),\n agent: null,\n workflow: null,\n });\n }\n\n return candidates;\n}\n\nfunction normalizePositiveInteger(value: number, fallback: number): number {\n return Number.isFinite(value) && value > 0 ? Math.floor(value) : fallback;\n}\n\nfunction normalizeSuccessThreshold(value: number): number {\n if (!Number.isFinite(value) || value <= 0) return 0;\n return Math.min(1, value);\n}\n\nfunction trajectorySuccessScore(trajectory: CausalTrajectoryRecord): number {\n if (trajectory.outcomeKind === \"success\") return 1;\n if (trajectory.outcomeKind === \"partial\") return 0.5;\n return 0;\n}\n\nfunction averageSuccessScore(trajectories: CausalTrajectoryRecord[]): number {\n if (trajectories.length === 0) return 0;\n const total = trajectories.reduce((sum, trajectory) => sum + trajectorySuccessScore(trajectory), 0);\n return total / trajectories.length;\n}\n\nfunction passesConsolidationGates(\n trajectories: CausalTrajectoryRecord[],\n config: ConsolidationConfig,\n): boolean {\n const minRecurrence = normalizePositiveInteger(config.minRecurrence, 1);\n if (trajectories.length < minRecurrence) return false;\n\n const minSessions = normalizePositiveInteger(config.minSessions, 1);\n const sessionCount = new Set(trajectories.map((trajectory) => trajectory.sessionKey)).size;\n if (sessionCount < minSessions) return false;\n\n const successThreshold = normalizeSuccessThreshold(config.successThreshold);\n if (successThreshold > 0 && averageSuccessScore(trajectories) < successThreshold) {\n return false;\n }\n\n return true;\n}\n\n// ─── Public API ──────────────────────────────────────────────────────────────\n\n/**\n * Run LLM-assisted consolidation: read trajectories, format causal context,\n * ask LLM to identify patterns and preferences.\n */\nexport async function deriveCausalPromotionCandidates(options: {\n memoryDir: string;\n causalTrajectoryStoreDir?: string;\n config: ConsolidationConfig;\n gatewayConfig?: GatewayConfig;\n gatewayAgentId?: string;\n modelChain?: AgentPersonaModelConfig;\n workspaceDir?: string;\n pluginConfig?: PluginConfig;\n llmClient?: ConsolidationLlmClient;\n}): Promise<CausalPatternCandidate[]> {\n try {\n const trajectories = await readAllTrajectories(options.memoryDir, options.causalTrajectoryStoreDir);\n if (!passesConsolidationGates(trajectories, options.config)) return [];\n\n const chainsDir = resolveChainsDir(options.memoryDir, options.causalTrajectoryStoreDir);\n const chainIndex = await readChainIndex(chainsDir);\n\n // Format the causal context for the LLM\n let context = formatCausalContext(trajectories, chainIndex);\n\n // Append memory extensions block if available (#382)\n if (options.pluginConfig) {\n const extBlock = await buildExtensionsBlockForConsolidation(options.pluginConfig);\n if (extBlock.length > 0) {\n context += \"\\n\\n\" + extBlock;\n }\n }\n\n // If no LLM available, fall back to empty (no deterministic fallback)\n const llm = options.llmClient ?? new FallbackLlmClient(\n options.gatewayConfig,\n options.pluginConfig\n ? fallbackLlmRuntimeContextFromConfig(options.pluginConfig, {\n workspaceDir: options.workspaceDir ?? options.pluginConfig.workspaceDir,\n })\n : { workspaceDir: options.workspaceDir },\n );\n const llmOptions = { agentId: options.gatewayAgentId, modelChain: options.modelChain };\n if (!llm.isAvailable(llmOptions)) {\n log.debug(\"[cmc] no LLM available for consolidation — skipping\");\n return [];\n }\n\n // Call LLM for pattern analysis\n const result = await consolidateWithLlm(context, llm, llmOptions);\n const candidates = llmResultToCandidates(result);\n\n log.debug(`[cmc] LLM consolidation produced ${candidates.length} rule(s) and ${result.preferences.length} preference(s)`);\n return candidates;\n } catch (error) {\n log.warn(`[cmc] consolidation failed (non-fatal): ${error instanceof Error ? error.message : String(error)}`);\n return [];\n }\n}\n\n/**\n * Get LLM-synthesized preferences from causal trajectory analysis.\n * Returns formatted preference statements for recall injection.\n */\nexport async function synthesizeCausalPreferencesViaLlm(options: {\n memoryDir: string;\n causalTrajectoryStoreDir?: string;\n gatewayConfig?: GatewayConfig;\n gatewayAgentId?: string;\n modelChain?: AgentPersonaModelConfig;\n workspaceDir?: string;\n minTrajectories?: number;\n}): Promise<string | null> {\n try {\n const trajectories = await readAllTrajectories(options.memoryDir, options.causalTrajectoryStoreDir);\n if (trajectories.length < (options.minTrajectories ?? 2)) return null;\n\n const chainsDir = resolveChainsDir(options.memoryDir, options.causalTrajectoryStoreDir);\n const chainIndex = await readChainIndex(chainsDir);\n const context = formatCausalContext(trajectories, chainIndex);\n\n const llm = new FallbackLlmClient(options.gatewayConfig, {\n workspaceDir: options.workspaceDir,\n });\n const llmOptions = { agentId: options.gatewayAgentId, modelChain: options.modelChain };\n if (!llm.isAvailable(llmOptions)) return null;\n\n const result = await consolidateWithLlm(context, llm, llmOptions);\n if (result.preferences.length === 0 && result.rules.length === 0) return null;\n\n const lines: string[] = [\"## Behavioral Insights (from Causal Chain Analysis)\", \"\"];\n\n for (const pref of result.preferences) {\n lines.push(`- ${pref.statement}`);\n }\n\n for (const rule of result.rules) {\n lines.push(`- ${rule.content}`);\n }\n\n lines.push(\"\");\n return lines.join(\"\\n\");\n } catch (error) {\n log.warn(`[cmc] preference synthesis failed (non-fatal): ${error instanceof Error ? error.message : String(error)}`);\n return null;\n }\n}\n\n/**\n * Optional post-consolidation hook — materializes Codex-native memory artifacts\n * after a causal consolidation run. Guarded by `codexMaterializeMemories` and\n * `codexMaterializeOnConsolidation`. Returns `null` when disabled or when the\n * sentinel is missing (honors user hand-edits).\n *\n * Split from the orchestrator-owned flow so #378 avoids touching\n * orchestrator.ts while Wave 1 edits are in flight.\n */\nexport async function materializeAfterCausalConsolidation(options: {\n config: PluginConfig;\n namespace?: string;\n memories?: MemoryFile[];\n memoryDir?: string;\n codexHome?: string;\n rolloutSummaries?: RolloutSummaryInput[];\n now?: Date;\n}): Promise<MaterializeResult | null> {\n // Delegates to the shared post-consolidation helper — see\n // runPostConsolidationMaterialize in codex-materialize-runner.ts.\n return runPostConsolidationMaterialize(\"[cmc]\", options);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAcA,SAAS,kBAAkB;AAO3B,OAAO,UAAU;AA0CjB,IAAM,yBAAyB,oBAAI,IAAI,CAAC,QAAQ,aAAa,YAAY,CAAC;AAY1E,eAAe,oBACb,WACA,0BACmC;AACnC,QAAM,OAAO,gCAAgC,WAAW,wBAAwB;AAChF,QAAM,kBAAkB,KAAK,KAAK,MAAM,cAAc;AAEtD,QAAM,QAAQ,MAAM,cAAc,eAAe,EAAE,MAAM,MAAM,CAAC,CAAa;AAC7E,QAAM,UAAoC,CAAC;AAE3C,aAAW,YAAY,OAAO;AAC5B,QAAI;AACF,YAAM,MAAM,MAAM,aAAa,QAAQ;AACvC,UAAI,SAAS,GAAG,KAAK,OAAO,IAAI,iBAAiB,UAAU;AACzD,gBAAQ,KAAK,GAAwC;AAAA,MACvD;AAAA,IACF,QAAQ;AAAA,IAER;AAAA,EACF;AAEA,SAAO;AACT;AAQA,SAAS,oBACP,cACA,YACA,WAAmB,KACX;AAER,QAAM,YAAY,oBAAI,IAAsC;AAC5D,aAAW,KAAK,cAAc;AAC5B,UAAM,OAAO,UAAU,IAAI,EAAE,UAAU,KAAK,CAAC;AAC7C,SAAK,KAAK,CAAC;AACX,cAAU,IAA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,WAAW;AACrF,QAAI,CAAC,IAAI,YAAY,UAAU,EAAG,QAAO;AAEzC,UAAM,SAAS,MAAM,mBAAmB,SAAS,KAAK,UAAU;AAChE,QAAI,OAAO,YAAY,WAAW,KAAK,OAAO,MAAM,WAAW,EAAG,QAAO;AAEzE,UAAM,QAAkB,CAAC,uDAAuD,EAAE;AAElF,eAAW,QAAQ,OAAO,aAAa;AACrC,YAAM,KAAK,KAAK,KAAK,SAAS,EAAE;AAAA,IAClC;AAEA,eAAW,QAAQ,OAAO,OAAO;AAC/B,YAAM,KAAK,KAAK,KAAK,OAAO,EAAE;AAAA,IAChC;AAEA,UAAM,KAAK,EAAE;AACb,WAAO,MAAM,KAAK,IAAI;AAAA,EACxB,SAAS,OAAO;AACd,QAAI,KAAK,kDAAkD,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK,CAAC,EAAE;AACnH,WAAO;AAAA,EACT;AACF;AAWA,eAAsB,oCAAoC,SAQpB;AAGpC,SAAO,gCAAgC,SAAS,OAAO;AACzD;","names":[]}
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import {
|
|
2
2
|
NamespaceStorageRouter
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-TBLGI2LT.js";
|
|
4
4
|
import {
|
|
5
5
|
namespaceCollectionName
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-UNLHHTKN.js";
|
|
7
7
|
import {
|
|
8
8
|
namespaceIdentityFromToken,
|
|
9
9
|
namespaceIdentityToken
|
|
10
10
|
} from "./chunk-ZFXCQPNO.js";
|
|
11
11
|
import {
|
|
12
12
|
ALL_CATEGORY_DIRS
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-AX5O25EF.js";
|
|
14
14
|
import {
|
|
15
15
|
isSafeRouteNamespace
|
|
16
16
|
} from "./chunk-U3PN77QT.js";
|
|
@@ -204,4 +204,4 @@ export {
|
|
|
204
204
|
verifyNamespaces,
|
|
205
205
|
runNamespaceMigration
|
|
206
206
|
};
|
|
207
|
-
//# sourceMappingURL=chunk-
|
|
207
|
+
//# sourceMappingURL=chunk-256W7AXC.js.map
|
|
@@ -44,12 +44,12 @@ import {
|
|
|
44
44
|
} from "./chunk-HOJZMQ4J.js";
|
|
45
45
|
import {
|
|
46
46
|
rebuildMemoryLifecycleLedger
|
|
47
|
-
} from "./chunk-
|
|
47
|
+
} from "./chunk-F6O7IOS3.js";
|
|
48
48
|
import {
|
|
49
49
|
rebuildMemoryProjection,
|
|
50
50
|
repairMemoryProjection,
|
|
51
51
|
verifyMemoryProjection
|
|
52
|
-
} from "./chunk-
|
|
52
|
+
} from "./chunk-PXVFMQLD.js";
|
|
53
53
|
import {
|
|
54
54
|
rebuildObservations
|
|
55
55
|
} from "./chunk-LZZNTPLR.js";
|
|
@@ -74,7 +74,7 @@ import {
|
|
|
74
74
|
} from "./chunk-EVWIEEKZ.js";
|
|
75
75
|
import {
|
|
76
76
|
promoteSemanticRuleFromMemory
|
|
77
|
-
} from "./chunk-
|
|
77
|
+
} from "./chunk-QXHBWFR3.js";
|
|
78
78
|
import {
|
|
79
79
|
resolveAgentAccessAuthToken
|
|
80
80
|
} from "./chunk-TGQ2NTWH.js";
|
|
@@ -93,12 +93,12 @@ import {
|
|
|
93
93
|
runOperatorInventory,
|
|
94
94
|
runOperatorRepair,
|
|
95
95
|
runOperatorSetup
|
|
96
|
-
} from "./chunk-
|
|
96
|
+
} from "./chunk-MO77TWPS.js";
|
|
97
97
|
import {
|
|
98
98
|
listNamespaces,
|
|
99
99
|
runNamespaceMigration,
|
|
100
100
|
verifyNamespaces
|
|
101
|
-
} from "./chunk-
|
|
101
|
+
} from "./chunk-256W7AXC.js";
|
|
102
102
|
import {
|
|
103
103
|
collectPatternMemories,
|
|
104
104
|
explainPatternMemory,
|
|
@@ -128,13 +128,13 @@ import {
|
|
|
128
128
|
} from "./chunk-TERNBNJB.js";
|
|
129
129
|
import {
|
|
130
130
|
searchVerifiedEpisodes
|
|
131
|
-
} from "./chunk-
|
|
131
|
+
} from "./chunk-TYIXG4VR.js";
|
|
132
132
|
import {
|
|
133
133
|
ThreadingManager
|
|
134
134
|
} from "./chunk-W4RVMTHR.js";
|
|
135
135
|
import {
|
|
136
136
|
searchVerifiedSemanticRules
|
|
137
|
-
} from "./chunk-
|
|
137
|
+
} from "./chunk-NMPEJV5M.js";
|
|
138
138
|
import {
|
|
139
139
|
getWorkProductLedgerStatus,
|
|
140
140
|
recordWorkProductLedgerEntry,
|
|
@@ -216,16 +216,16 @@ import {
|
|
|
216
216
|
} from "./chunk-OADWQ5CR.js";
|
|
217
217
|
import {
|
|
218
218
|
EngramAccessHttpServer
|
|
219
|
-
} from "./chunk-
|
|
219
|
+
} from "./chunk-OYXVENIS.js";
|
|
220
220
|
import {
|
|
221
221
|
WearablesInputError
|
|
222
222
|
} from "./chunk-7WV3F5DQ.js";
|
|
223
223
|
import {
|
|
224
224
|
EngramMcpServer
|
|
225
|
-
} from "./chunk-
|
|
225
|
+
} from "./chunk-7H7J3ZWN.js";
|
|
226
226
|
import {
|
|
227
227
|
EngramAccessService
|
|
228
|
-
} from "./chunk-
|
|
228
|
+
} from "./chunk-RP2U54GG.js";
|
|
229
229
|
import {
|
|
230
230
|
WorkStorage
|
|
231
231
|
} from "./chunk-GDB4J2H3.js";
|
|
@@ -239,7 +239,7 @@ import {
|
|
|
239
239
|
readMemoryGovernanceRunArtifact,
|
|
240
240
|
restoreMemoryGovernanceRun,
|
|
241
241
|
runMemoryGovernance
|
|
242
|
-
} from "./chunk-
|
|
242
|
+
} from "./chunk-A7EF2XRO.js";
|
|
243
243
|
import {
|
|
244
244
|
getTrustZoneStoreStatus,
|
|
245
245
|
promoteTrustZoneRecord,
|
|
@@ -7281,4 +7281,4 @@ export {
|
|
|
7281
7281
|
resolveMemoryDirForNamespace,
|
|
7282
7282
|
registerCli
|
|
7283
7283
|
};
|
|
7284
|
-
//# sourceMappingURL=chunk-
|
|
7284
|
+
//# sourceMappingURL=chunk-2EVZ5EN6.js.map
|
|
@@ -58,11 +58,15 @@ function setCachedQmdRecall(cacheKey, value, options) {
|
|
|
58
58
|
function clearQmdRecallCache() {
|
|
59
59
|
qmdRecallCache.clear();
|
|
60
60
|
}
|
|
61
|
+
function qmdRecallCacheSize() {
|
|
62
|
+
return qmdRecallCache.size;
|
|
63
|
+
}
|
|
61
64
|
|
|
62
65
|
export {
|
|
63
66
|
buildQmdRecallCacheKey,
|
|
64
67
|
getCachedQmdRecall,
|
|
65
68
|
setCachedQmdRecall,
|
|
66
|
-
clearQmdRecallCache
|
|
69
|
+
clearQmdRecallCache,
|
|
70
|
+
qmdRecallCacheSize
|
|
67
71
|
};
|
|
68
|
-
//# sourceMappingURL=chunk-
|
|
72
|
+
//# sourceMappingURL=chunk-42JKGUFJ.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/qmd-recall-cache.ts"],"sourcesContent":["import type { RecallPlanMode } from \"./types.js\";\nimport type { SearchQueryOptions } from \"./search/port.js\";\n\ntype QmdRecallCacheEntry = {\n value: unknown;\n cachedAtMs: number;\n};\n\nexport type QmdRecallCacheSource = \"fresh\" | \"stale\";\n\nexport interface QmdRecallCacheHit<T> {\n value: T;\n source: QmdRecallCacheSource;\n ageMs: number;\n}\n\nexport interface QmdRecallCacheKeyOptions {\n query: string;\n namespaces: string[];\n recallMode: RecallPlanMode;\n maxResults: number;\n memoryDir?: string;\n collection?: string;\n searchOptions?: SearchQueryOptions;\n // QMD search/subprocess strategies change the recalled results, so they must\n // participate in the cache key — otherwise a different strategy's cached QMD\n // phase is served within the TTL (gotcha #37). Issue #1335 (codex review #1422).\n searchStrategy?: string;\n subprocessStrategy?: string;\n}\n\nconst qmdRecallCache = new Map<string, QmdRecallCacheEntry>();\n\nfunction cloneCacheValue<T>(value: T): T {\n return structuredClone(value);\n}\n\nfunction normalizeQuery(query: string): string {\n return query.trim().toLowerCase().replace(/\\s+/g, \" \");\n}\n\nfunction normalizePathScope(pathValue: string | undefined): string {\n if (typeof pathValue !== \"string\") return \"\";\n return pathValue.trim().replace(/\\\\/g, \"/\");\n}\n\nfunction normalizeSearchOptions(\n options: SearchQueryOptions | undefined,\n): Record<string, unknown> {\n if (!options) return {};\n return Object.fromEntries(\n Object.entries(options)\n .filter(([, value]) => value !== undefined)\n .sort(([left], [right]) => left.localeCompare(right)),\n );\n}\n\nexport function buildQmdRecallCacheKey(\n options: QmdRecallCacheKeyOptions,\n): string {\n return JSON.stringify({\n query: normalizeQuery(options.query),\n namespaces: [...options.namespaces].sort(),\n recallMode: options.recallMode,\n maxResults: options.maxResults,\n memoryDir: normalizePathScope(options.memoryDir),\n collection: options.collection ?? \"\",\n searchOptions: normalizeSearchOptions(options.searchOptions),\n searchStrategy: options.searchStrategy ?? \"\",\n subprocessStrategy: options.subprocessStrategy ?? \"\",\n });\n}\n\nexport function getCachedQmdRecall<T>(\n cacheKey: string,\n options: {\n freshTtlMs: number;\n staleTtlMs: number;\n },\n): QmdRecallCacheHit<T> | null {\n const entry = qmdRecallCache.get(cacheKey);\n if (!entry) return null;\n\n const ageMs = Date.now() - entry.cachedAtMs;\n if (ageMs <= options.freshTtlMs) {\n return { value: cloneCacheValue(entry.value as T), source: \"fresh\", ageMs };\n }\n if (ageMs <= options.staleTtlMs) {\n return { value: cloneCacheValue(entry.value as T), source: \"stale\", ageMs };\n }\n\n qmdRecallCache.delete(cacheKey);\n return null;\n}\n\nexport function setCachedQmdRecall<T>(\n cacheKey: string,\n value: T,\n options: { maxEntries: number },\n): void {\n qmdRecallCache.delete(cacheKey);\n if (options.maxEntries <= 0) return;\n\n qmdRecallCache.set(cacheKey, {\n value: cloneCacheValue(value),\n cachedAtMs: Date.now(),\n });\n\n while (qmdRecallCache.size > options.maxEntries) {\n const oldestKey = qmdRecallCache.keys().next().value;\n if (typeof oldestKey !== \"string\") break;\n qmdRecallCache.delete(oldestKey);\n }\n}\n\nexport function clearQmdRecallCache(): void {\n qmdRecallCache.clear();\n}\n"],"mapp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5E;AACA,MAAI,SAAS,QAAQ,YAAY;AAC/B,WAAO,EAAE,OAAO,gBAAgB,MAAM,KAAU,GAAG,QAAQ,SAAS,MAAM;AAAA,EAC5E;AAEA,iBAAe,OAAO,QAAQ;AAC9B,SAAO;AACT;AAEO,SAAS,mBACd,UACA,OACA,SACM;AACN,iBAAe,OAAO,QAAQ;AAC9B,MAAI,QAAQ,cAAc,EAAG;AAE7B,iBAAe,IAAI,UAAU;AAAA,IAC3B,OAAO,gBAAgB,KAAK;AAAA,IAC5B,YAAY,KAAK,IAAI;AAAA,EACvB,CAAC;AAED,SAAO,eAAe,OAAO,QAAQ,YAAY;AAC/C,UAAM,YAAY,eAAe,KAAK,EAAE,KAAK,EAAE;AAC/C,QAAI,OAAO,cAAc,SAAU;AACnC,mBAAe,OAAO,SAAS;AAAA,EACjC;AACF;AAEO,SAAS,sBAA4B;AAC1C,iBAAe,MAAM;AACvB;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../src/qmd-recall-cache.ts"],"sourcesContent":["import type { RecallPlanMode } from \"./types.js\";\nimport type { SearchQueryOptions } from \"./search/port.js\";\n\ntype QmdRecallCacheEntry = {\n value: unknown;\n cachedAtMs: number;\n};\n\nexport type QmdRecallCacheSource = \"fresh\" | \"stale\";\n\nexport interface QmdRecallCacheHit<T> {\n value: T;\n source: QmdRecallCacheSource;\n ageMs: number;\n}\n\nexport interface QmdRecallCacheKeyOptions {\n query: string;\n namespaces: string[];\n recallMode: RecallPlanMode;\n maxResults: number;\n memoryDir?: string;\n collection?: string;\n searchOptions?: SearchQueryOptions;\n // QMD search/subprocess strategies change the recalled results, so they must\n // participate in the cache key — otherwise a different strategy's cached QMD\n // phase is served within the TTL (gotcha #37). Issue #1335 (codex review #1422).\n searchStrategy?: string;\n subprocessStrategy?: string;\n}\n\nconst qmdRecallCache = new Map<string, QmdRecallCacheEntry>();\n\nfunction cloneCacheValue<T>(value: T): T {\n return structuredClone(value);\n}\n\nfunction normalizeQuery(query: string): string {\n return query.trim().toLowerCase().replace(/\\s+/g, \" \");\n}\n\nfunction normalizePathScope(pathValue: string | undefined): string {\n if (typeof pathValue !== \"string\") return \"\";\n return pathValue.trim().replace(/\\\\/g, \"/\");\n}\n\nfunction normalizeSearchOptions(\n options: SearchQueryOptions | undefined,\n): Record<string, unknown> {\n if (!options) return {};\n return Object.fromEntries(\n Object.entries(options)\n .filter(([, value]) => value !== undefined)\n .sort(([left], [right]) => left.localeCompare(right)),\n );\n}\n\nexport function buildQmdRecallCacheKey(\n options: QmdRecallCacheKeyOptions,\n): string {\n return JSON.stringify({\n query: normalizeQuery(options.query),\n namespaces: [...options.namespaces].sort(),\n recallMode: options.recallMode,\n maxResults: options.maxResults,\n memoryDir: normalizePathScope(options.memoryDir),\n collection: options.collection ?? \"\",\n searchOptions: normalizeSearchOptions(options.searchOptions),\n searchStrategy: options.searchStrategy ?? \"\",\n subprocessStrategy: options.subprocessStrategy ?? \"\",\n });\n}\n\nexport function getCachedQmdRecall<T>(\n cacheKey: string,\n options: {\n freshTtlMs: number;\n staleTtlMs: number;\n },\n): QmdRecallCacheHit<T> | null {\n const entry = qmdRecallCache.get(cacheKey);\n if (!entry) return null;\n\n const ageMs = Date.now() - entry.cachedAtMs;\n if (ageMs <= options.freshTtlMs) {\n return { value: cloneCacheValue(entry.value as T), source: \"fresh\", ageMs };\n }\n if (ageMs <= options.staleTtlMs) {\n return { value: cloneCacheValue(entry.value as T), source: \"stale\", ageMs };\n }\n\n qmdRecallCache.delete(cacheKey);\n return null;\n}\n\nexport function setCachedQmdRecall<T>(\n cacheKey: string,\n value: T,\n options: { maxEntries: number },\n): void {\n qmdRecallCache.delete(cacheKey);\n if (options.maxEntries <= 0) return;\n\n qmdRecallCache.set(cacheKey, {\n value: cloneCacheValue(value),\n cachedAtMs: Date.now(),\n });\n\n while (qmdRecallCache.size > options.maxEntries) {\n const oldestKey = qmdRecallCache.keys().next().value;\n if (typeof oldestKey !== \"string\") break;\n qmdRecallCache.delete(oldestKey);\n }\n}\n\nexport function clearQmdRecallCache(): void {\n qmdRecallCache.clear();\n}\n\n/** Number of cached recall entries. Used by the cache-layer registry in\n * memory-cache.ts (`ALL_CACHE_LAYERS`) and its fitness tests (issue #1535). */\nexport function qmdRecallCacheSize(): number {\n return qmdRecallCache.size;\n}\n"],"mappings":";AA+BA,IAAM,iBAAiB,oBAAI,IAAiC;AAE5D,SAAS,gBAAmB,OAAa;AACvC,SAAO,gBAAgB,KAAK;AAC9B;AAEA,SAAS,eAAe,OAAuB;AAC7C,SAAO,MAAM,KAAK,EAAE,YAAY,EAAE,QAAQ,QAAQ,GAAG;AACvD;AAEA,SAAS,mBAAmB,WAAuC;AACjE,MAAI,OAAO,cAAc,SAAU,QAAO;AAC1C,SAAO,UAAU,KAAK,EAAE,QAAQ,OAAO,GAAG;AAC5C;AAEA,SAAS,uBACP,SACyB;AACzB,MAAI,CAAC,QAAS,QAAO,CAAC;AACtB,SAAO,OAAO;AAAA,IACZ,OAAO,QAAQ,OAAO,EACnB,OAAO,CAAC,CAAC,EAAE,KAAK,MAAM,UAAU,MAAS,EACzC,KAAK,CAAC,CAAC,IAAI,GAAG,CAAC,KAAK,MAAM,KAAK,cAAc,KAAK,CAAC;AAAA,EACxD;AACF;AAEO,SAAS,uBACd,SACQ;AACR,SAAO,KAAK,UAAU;AAAA,IACpB,OAAO,eAAe,QAAQ,KAAK;AAAA,IACnC,YAAY,CAAC,GAAG,QAAQ,UAAU,EAAE,KAAK;AAAA,IACzC,YAAY,QAAQ;AAAA,IACpB,YAAY,QAAQ;AAAA,IACpB,WAAW,mBAAmB,QAAQ,SAAS;AAAA,IAC/C,YAAY,QAAQ,cAAc;AAAA,IAClC,eAAe,uBAAuB,QAAQ,aAAa;AAAA,IAC3D,gBAAgB,QAAQ,kBAAkB;AAAA,IAC1C,oBAAoB,QAAQ,sBAAsB;AAAA,EACpD,CAAC;AACH;AAEO,SAAS,mBACd,UACA,SAI6B;AAC7B,QAAM,QAAQ,eAAe,IAAI,QAAQ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