agentfootprint 7.16.0 → 7.18.0

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.
Files changed (295) hide show
  1. package/AGENTS.md +1 -1
  2. package/CLAUDE.md +2 -2
  3. package/ai-instructions/claude-code/SKILL.md +1 -1
  4. package/dist/conventions.js +8 -6
  5. package/dist/conventions.js.map +1 -1
  6. package/dist/core/Agent.js +81 -27
  7. package/dist/core/Agent.js.map +1 -1
  8. package/dist/core/RunnerBase.js +16 -1
  9. package/dist/core/RunnerBase.js.map +1 -1
  10. package/dist/core/agent/AgentBuilder.js +209 -43
  11. package/dist/core/agent/AgentBuilder.js.map +1 -1
  12. package/dist/core/agent/buildAgentChart.js +8 -8
  13. package/dist/core/agent/buildAgentChart.js.map +1 -1
  14. package/dist/core/agent/buildDynamicAgentChart.js +6 -6
  15. package/dist/core/agent/buildDynamicAgentChart.js.map +1 -1
  16. package/dist/core/agent/middleware/errors.js +54 -0
  17. package/dist/core/agent/middleware/errors.js.map +1 -0
  18. package/dist/core/agent/middleware/index.js +23 -0
  19. package/dist/core/agent/middleware/index.js.map +1 -0
  20. package/dist/core/agent/middleware/ledger.js +61 -0
  21. package/dist/core/agent/middleware/ledger.js.map +1 -0
  22. package/dist/core/agent/middleware/outcomes.js +66 -0
  23. package/dist/core/agent/middleware/outcomes.js.map +1 -0
  24. package/dist/core/agent/middleware/runChain.js +144 -0
  25. package/dist/core/agent/middleware/runChain.js.map +1 -0
  26. package/dist/core/agent/middleware/types.js +41 -0
  27. package/dist/core/agent/middleware/types.js.map +1 -0
  28. package/dist/core/agent/stages/prepareFinal.js +10 -0
  29. package/dist/core/agent/stages/prepareFinal.js.map +1 -1
  30. package/dist/core/agent/stages/route.js +62 -1
  31. package/dist/core/agent/stages/route.js.map +1 -1
  32. package/dist/core/agent/stages/seed.js +130 -85
  33. package/dist/core/agent/stages/seed.js.map +1 -1
  34. package/dist/core/agent/stages/toolCalls.js +195 -8
  35. package/dist/core/agent/stages/toolCalls.js.map +1 -1
  36. package/dist/core/agent/stages/window.js +141 -0
  37. package/dist/core/agent/stages/window.js.map +1 -0
  38. package/dist/core/agent/window/errors.js.map +1 -0
  39. package/dist/core/agent/window/index.js +36 -0
  40. package/dist/core/agent/window/index.js.map +1 -0
  41. package/dist/core/agent/window/notice.js +57 -0
  42. package/dist/core/agent/window/notice.js.map +1 -0
  43. package/dist/core/agent/window/options.js +93 -0
  44. package/dist/core/agent/window/options.js.map +1 -0
  45. package/dist/core/agent/window/removal.js +45 -0
  46. package/dist/core/agent/window/removal.js.map +1 -0
  47. package/dist/core/agent/window/strategies/drop.js +106 -0
  48. package/dist/core/agent/window/strategies/drop.js.map +1 -0
  49. package/dist/core/agent/window/strategies/slidingWindow.js +87 -0
  50. package/dist/core/agent/window/strategies/slidingWindow.js.map +1 -0
  51. package/dist/core/agent/window/strategies/summarizeOldest.js +178 -0
  52. package/dist/core/agent/window/strategies/summarizeOldest.js.map +1 -0
  53. package/dist/core/agent/window/strategies/tokenBudget.js +95 -0
  54. package/dist/core/agent/window/strategies/tokenBudget.js.map +1 -0
  55. package/dist/core/agent/window/strategy.js +42 -0
  56. package/dist/core/agent/window/strategy.js.map +1 -0
  57. package/dist/core/agent/window/summarize.js.map +1 -0
  58. package/dist/core/agent/{compaction → window}/turns.js +50 -28
  59. package/dist/core/agent/window/turns.js.map +1 -0
  60. package/dist/core/agent/window/types.js +23 -0
  61. package/dist/core/agent/window/types.js.map +1 -0
  62. package/dist/core/pause.js +19 -1
  63. package/dist/core/pause.js.map +1 -1
  64. package/dist/esm/conventions.d.ts +8 -6
  65. package/dist/esm/conventions.js +8 -6
  66. package/dist/esm/conventions.js.map +1 -1
  67. package/dist/esm/core/Agent.d.ts +14 -6
  68. package/dist/esm/core/Agent.js +82 -28
  69. package/dist/esm/core/Agent.js.map +1 -1
  70. package/dist/esm/core/RunnerBase.js +16 -1
  71. package/dist/esm/core/RunnerBase.js.map +1 -1
  72. package/dist/esm/core/agent/AgentBuilder.d.ts +157 -4
  73. package/dist/esm/core/agent/AgentBuilder.js +209 -43
  74. package/dist/esm/core/agent/AgentBuilder.js.map +1 -1
  75. package/dist/esm/core/agent/buildAgentChart.d.ts +16 -9
  76. package/dist/esm/core/agent/buildAgentChart.js +8 -8
  77. package/dist/esm/core/agent/buildAgentChart.js.map +1 -1
  78. package/dist/esm/core/agent/buildDynamicAgentChart.js +6 -6
  79. package/dist/esm/core/agent/buildDynamicAgentChart.js.map +1 -1
  80. package/dist/esm/core/agent/middleware/errors.d.ts +51 -0
  81. package/dist/esm/core/agent/middleware/errors.js +50 -0
  82. package/dist/esm/core/agent/middleware/errors.js.map +1 -0
  83. package/dist/esm/core/agent/middleware/index.d.ts +16 -0
  84. package/dist/esm/core/agent/middleware/index.js +16 -0
  85. package/dist/esm/core/agent/middleware/index.js.map +1 -0
  86. package/dist/esm/core/agent/middleware/ledger.d.ts +40 -0
  87. package/dist/esm/core/agent/middleware/ledger.js +57 -0
  88. package/dist/esm/core/agent/middleware/ledger.js.map +1 -0
  89. package/dist/esm/core/agent/middleware/outcomes.d.ts +45 -0
  90. package/dist/esm/core/agent/middleware/outcomes.js +60 -0
  91. package/dist/esm/core/agent/middleware/outcomes.js.map +1 -0
  92. package/dist/esm/core/agent/middleware/runChain.d.ts +104 -0
  93. package/dist/esm/core/agent/middleware/runChain.js +139 -0
  94. package/dist/esm/core/agent/middleware/runChain.js.map +1 -0
  95. package/dist/esm/core/agent/middleware/types.d.ts +191 -0
  96. package/dist/esm/core/agent/middleware/types.js +40 -0
  97. package/dist/esm/core/agent/middleware/types.js.map +1 -0
  98. package/dist/esm/core/agent/stages/prepareFinal.d.ts +10 -0
  99. package/dist/esm/core/agent/stages/prepareFinal.js +10 -0
  100. package/dist/esm/core/agent/stages/prepareFinal.js.map +1 -1
  101. package/dist/esm/core/agent/stages/route.d.ts +29 -0
  102. package/dist/esm/core/agent/stages/route.js +60 -0
  103. package/dist/esm/core/agent/stages/route.js.map +1 -1
  104. package/dist/esm/core/agent/stages/seed.d.ts +16 -1
  105. package/dist/esm/core/agent/stages/seed.js +130 -85
  106. package/dist/esm/core/agent/stages/seed.js.map +1 -1
  107. package/dist/esm/core/agent/stages/toolCalls.d.ts +23 -0
  108. package/dist/esm/core/agent/stages/toolCalls.js +195 -8
  109. package/dist/esm/core/agent/stages/toolCalls.js.map +1 -1
  110. package/dist/esm/core/agent/stages/window.d.ts +63 -0
  111. package/dist/esm/core/agent/stages/window.js +137 -0
  112. package/dist/esm/core/agent/stages/window.js.map +1 -0
  113. package/dist/esm/core/agent/types.d.ts +33 -8
  114. package/dist/esm/core/agent/window/errors.js.map +1 -0
  115. package/dist/esm/core/agent/window/index.d.ts +27 -0
  116. package/dist/esm/core/agent/window/index.js +25 -0
  117. package/dist/esm/core/agent/window/index.js.map +1 -0
  118. package/dist/esm/core/agent/window/notice.d.ts +46 -0
  119. package/dist/esm/core/agent/window/notice.js +52 -0
  120. package/dist/esm/core/agent/window/notice.js.map +1 -0
  121. package/dist/esm/core/agent/window/options.d.ts +33 -0
  122. package/dist/esm/core/agent/window/options.js +87 -0
  123. package/dist/esm/core/agent/window/options.js.map +1 -0
  124. package/dist/esm/core/agent/window/removal.d.ts +22 -0
  125. package/dist/esm/core/agent/window/removal.js +40 -0
  126. package/dist/esm/core/agent/window/removal.js.map +1 -0
  127. package/dist/esm/core/agent/window/strategies/drop.d.ts +54 -0
  128. package/dist/esm/core/agent/window/strategies/drop.js +102 -0
  129. package/dist/esm/core/agent/window/strategies/drop.js.map +1 -0
  130. package/dist/esm/core/agent/window/strategies/slidingWindow.d.ts +48 -0
  131. package/dist/esm/core/agent/window/strategies/slidingWindow.js +83 -0
  132. package/dist/esm/core/agent/window/strategies/slidingWindow.js.map +1 -0
  133. package/dist/esm/core/agent/window/strategies/summarizeOldest.d.ts +42 -0
  134. package/dist/esm/core/agent/window/strategies/summarizeOldest.js +174 -0
  135. package/dist/esm/core/agent/window/strategies/summarizeOldest.js.map +1 -0
  136. package/dist/esm/core/agent/window/strategies/tokenBudget.d.ts +47 -0
  137. package/dist/esm/core/agent/window/strategies/tokenBudget.js +91 -0
  138. package/dist/esm/core/agent/window/strategies/tokenBudget.js.map +1 -0
  139. package/dist/esm/core/agent/window/strategy.d.ts +181 -0
  140. package/dist/esm/core/agent/window/strategy.js +41 -0
  141. package/dist/esm/core/agent/window/strategy.js.map +1 -0
  142. package/dist/esm/core/agent/window/summarize.js.map +1 -0
  143. package/dist/esm/core/agent/window/turns.d.ts +108 -0
  144. package/dist/esm/core/agent/{compaction → window}/turns.js +48 -26
  145. package/dist/esm/core/agent/window/turns.js.map +1 -0
  146. package/dist/esm/core/agent/window/types.d.ts +263 -0
  147. package/dist/esm/core/agent/window/types.js +22 -0
  148. package/dist/esm/core/agent/window/types.js.map +1 -0
  149. package/dist/esm/core/pause.d.ts +42 -0
  150. package/dist/esm/core/pause.js +17 -0
  151. package/dist/esm/core/pause.js.map +1 -1
  152. package/dist/esm/events/dispatcher.d.ts +1 -1
  153. package/dist/esm/events/dispatcher.js.map +1 -1
  154. package/dist/esm/events/payloads.d.ts +26 -0
  155. package/dist/esm/events/registry.d.ts +5 -1
  156. package/dist/esm/events/registry.js +4 -0
  157. package/dist/esm/events/registry.js.map +1 -1
  158. package/dist/esm/index.d.ts +3 -2
  159. package/dist/esm/index.js +23 -6
  160. package/dist/esm/index.js.map +1 -1
  161. package/dist/esm/lib/mcp/mcpServe.js +39 -6
  162. package/dist/esm/lib/mcp/mcpServe.js.map +1 -1
  163. package/dist/esm/lib/mcp/types.d.ts +16 -0
  164. package/dist/esm/recorders/core/CompactionMeter.d.ts +25 -19
  165. package/dist/esm/recorders/core/CompactionMeter.js +27 -19
  166. package/dist/esm/recorders/core/CompactionMeter.js.map +1 -1
  167. package/dist/events/dispatcher.js.map +1 -1
  168. package/dist/events/registry.js +4 -0
  169. package/dist/events/registry.js.map +1 -1
  170. package/dist/index.js +40 -13
  171. package/dist/index.js.map +1 -1
  172. package/dist/lib/mcp/mcpServe.js +39 -6
  173. package/dist/lib/mcp/mcpServe.js.map +1 -1
  174. package/dist/recorders/core/CompactionMeter.js +27 -19
  175. package/dist/recorders/core/CompactionMeter.js.map +1 -1
  176. package/dist/types/conventions.d.ts +8 -6
  177. package/dist/types/conventions.d.ts.map +1 -1
  178. package/dist/types/core/Agent.d.ts +14 -6
  179. package/dist/types/core/Agent.d.ts.map +1 -1
  180. package/dist/types/core/RunnerBase.d.ts.map +1 -1
  181. package/dist/types/core/agent/AgentBuilder.d.ts +157 -4
  182. package/dist/types/core/agent/AgentBuilder.d.ts.map +1 -1
  183. package/dist/types/core/agent/buildAgentChart.d.ts +16 -9
  184. package/dist/types/core/agent/buildAgentChart.d.ts.map +1 -1
  185. package/dist/types/core/agent/middleware/errors.d.ts +52 -0
  186. package/dist/types/core/agent/middleware/errors.d.ts.map +1 -0
  187. package/dist/types/core/agent/middleware/index.d.ts +17 -0
  188. package/dist/types/core/agent/middleware/index.d.ts.map +1 -0
  189. package/dist/types/core/agent/middleware/ledger.d.ts +41 -0
  190. package/dist/types/core/agent/middleware/ledger.d.ts.map +1 -0
  191. package/dist/types/core/agent/middleware/outcomes.d.ts +46 -0
  192. package/dist/types/core/agent/middleware/outcomes.d.ts.map +1 -0
  193. package/dist/types/core/agent/middleware/runChain.d.ts +105 -0
  194. package/dist/types/core/agent/middleware/runChain.d.ts.map +1 -0
  195. package/dist/types/core/agent/middleware/types.d.ts +192 -0
  196. package/dist/types/core/agent/middleware/types.d.ts.map +1 -0
  197. package/dist/types/core/agent/stages/prepareFinal.d.ts +10 -0
  198. package/dist/types/core/agent/stages/prepareFinal.d.ts.map +1 -1
  199. package/dist/types/core/agent/stages/route.d.ts +29 -0
  200. package/dist/types/core/agent/stages/route.d.ts.map +1 -1
  201. package/dist/types/core/agent/stages/seed.d.ts +16 -1
  202. package/dist/types/core/agent/stages/seed.d.ts.map +1 -1
  203. package/dist/types/core/agent/stages/toolCalls.d.ts +23 -0
  204. package/dist/types/core/agent/stages/toolCalls.d.ts.map +1 -1
  205. package/dist/types/core/agent/stages/window.d.ts +64 -0
  206. package/dist/types/core/agent/stages/window.d.ts.map +1 -0
  207. package/dist/types/core/agent/types.d.ts +33 -8
  208. package/dist/types/core/agent/types.d.ts.map +1 -1
  209. package/dist/types/core/agent/window/errors.d.ts.map +1 -0
  210. package/dist/types/core/agent/window/index.d.ts +28 -0
  211. package/dist/types/core/agent/window/index.d.ts.map +1 -0
  212. package/dist/types/core/agent/window/notice.d.ts +47 -0
  213. package/dist/types/core/agent/window/notice.d.ts.map +1 -0
  214. package/dist/types/core/agent/window/options.d.ts +34 -0
  215. package/dist/types/core/agent/window/options.d.ts.map +1 -0
  216. package/dist/types/core/agent/window/removal.d.ts +23 -0
  217. package/dist/types/core/agent/window/removal.d.ts.map +1 -0
  218. package/dist/types/core/agent/window/strategies/drop.d.ts +55 -0
  219. package/dist/types/core/agent/window/strategies/drop.d.ts.map +1 -0
  220. package/dist/types/core/agent/window/strategies/slidingWindow.d.ts +49 -0
  221. package/dist/types/core/agent/window/strategies/slidingWindow.d.ts.map +1 -0
  222. package/dist/types/core/agent/window/strategies/summarizeOldest.d.ts +43 -0
  223. package/dist/types/core/agent/window/strategies/summarizeOldest.d.ts.map +1 -0
  224. package/dist/types/core/agent/window/strategies/tokenBudget.d.ts +48 -0
  225. package/dist/types/core/agent/window/strategies/tokenBudget.d.ts.map +1 -0
  226. package/dist/types/core/agent/window/strategy.d.ts +182 -0
  227. package/dist/types/core/agent/window/strategy.d.ts.map +1 -0
  228. package/dist/types/core/agent/window/summarize.d.ts.map +1 -0
  229. package/dist/types/core/agent/window/turns.d.ts +109 -0
  230. package/dist/types/core/agent/window/turns.d.ts.map +1 -0
  231. package/dist/types/core/agent/window/types.d.ts +264 -0
  232. package/dist/types/core/agent/window/types.d.ts.map +1 -0
  233. package/dist/types/core/pause.d.ts +42 -0
  234. package/dist/types/core/pause.d.ts.map +1 -1
  235. package/dist/types/events/dispatcher.d.ts +1 -1
  236. package/dist/types/events/dispatcher.d.ts.map +1 -1
  237. package/dist/types/events/payloads.d.ts +26 -0
  238. package/dist/types/events/payloads.d.ts.map +1 -1
  239. package/dist/types/events/registry.d.ts +5 -1
  240. package/dist/types/events/registry.d.ts.map +1 -1
  241. package/dist/types/index.d.ts +3 -2
  242. package/dist/types/index.d.ts.map +1 -1
  243. package/dist/types/lib/mcp/mcpServe.d.ts.map +1 -1
  244. package/dist/types/lib/mcp/types.d.ts +16 -0
  245. package/dist/types/lib/mcp/types.d.ts.map +1 -1
  246. package/dist/types/recorders/core/CompactionMeter.d.ts +25 -19
  247. package/dist/types/recorders/core/CompactionMeter.d.ts.map +1 -1
  248. package/package.json +1 -1
  249. package/dist/core/agent/compaction/errors.js.map +0 -1
  250. package/dist/core/agent/compaction/index.js +0 -24
  251. package/dist/core/agent/compaction/index.js.map +0 -1
  252. package/dist/core/agent/compaction/strategy.js +0 -152
  253. package/dist/core/agent/compaction/strategy.js.map +0 -1
  254. package/dist/core/agent/compaction/summarize.js.map +0 -1
  255. package/dist/core/agent/compaction/turns.js.map +0 -1
  256. package/dist/core/agent/compaction/types.js +0 -21
  257. package/dist/core/agent/compaction/types.js.map +0 -1
  258. package/dist/core/agent/stages/compact.js +0 -130
  259. package/dist/core/agent/stages/compact.js.map +0 -1
  260. package/dist/esm/core/agent/compaction/errors.js.map +0 -1
  261. package/dist/esm/core/agent/compaction/index.d.ts +0 -18
  262. package/dist/esm/core/agent/compaction/index.js +0 -18
  263. package/dist/esm/core/agent/compaction/index.js.map +0 -1
  264. package/dist/esm/core/agent/compaction/strategy.d.ts +0 -103
  265. package/dist/esm/core/agent/compaction/strategy.js +0 -148
  266. package/dist/esm/core/agent/compaction/strategy.js.map +0 -1
  267. package/dist/esm/core/agent/compaction/summarize.js.map +0 -1
  268. package/dist/esm/core/agent/compaction/turns.d.ts +0 -85
  269. package/dist/esm/core/agent/compaction/turns.js.map +0 -1
  270. package/dist/esm/core/agent/compaction/types.d.ts +0 -148
  271. package/dist/esm/core/agent/compaction/types.js +0 -20
  272. package/dist/esm/core/agent/compaction/types.js.map +0 -1
  273. package/dist/esm/core/agent/stages/compact.d.ts +0 -59
  274. package/dist/esm/core/agent/stages/compact.js +0 -126
  275. package/dist/esm/core/agent/stages/compact.js.map +0 -1
  276. package/dist/types/core/agent/compaction/errors.d.ts.map +0 -1
  277. package/dist/types/core/agent/compaction/index.d.ts +0 -19
  278. package/dist/types/core/agent/compaction/index.d.ts.map +0 -1
  279. package/dist/types/core/agent/compaction/strategy.d.ts +0 -104
  280. package/dist/types/core/agent/compaction/strategy.d.ts.map +0 -1
  281. package/dist/types/core/agent/compaction/summarize.d.ts.map +0 -1
  282. package/dist/types/core/agent/compaction/turns.d.ts +0 -86
  283. package/dist/types/core/agent/compaction/turns.d.ts.map +0 -1
  284. package/dist/types/core/agent/compaction/types.d.ts +0 -149
  285. package/dist/types/core/agent/compaction/types.d.ts.map +0 -1
  286. package/dist/types/core/agent/stages/compact.d.ts +0 -60
  287. package/dist/types/core/agent/stages/compact.d.ts.map +0 -1
  288. /package/dist/core/agent/{compaction → window}/errors.js +0 -0
  289. /package/dist/core/agent/{compaction → window}/summarize.js +0 -0
  290. /package/dist/esm/core/agent/{compaction → window}/errors.d.ts +0 -0
  291. /package/dist/esm/core/agent/{compaction → window}/errors.js +0 -0
  292. /package/dist/esm/core/agent/{compaction → window}/summarize.d.ts +0 -0
  293. /package/dist/esm/core/agent/{compaction → window}/summarize.js +0 -0
  294. /package/dist/types/core/agent/{compaction → window}/errors.d.ts +0 -0
  295. /package/dist/types/core/agent/{compaction → window}/summarize.d.ts +0 -0
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/lib/mcp/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAC;AAChD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CA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CAAC,EAAE,MAAM,CAAC;QACvB,QAAQ,CAAC,SAAS,CAAC,EAAE,OAAO,CAAC;KAC9B,CAAC;CACH"}
@@ -1,14 +1,15 @@
1
1
  /**
2
- * compactionMeter — the instrument compaction is allowed to read.
2
+ * compactionMeter — the instrument a window strategy is allowed to read.
3
3
  *
4
4
  * Pattern: CombinedRecorder (Convention 1 — single purpose: measurement),
5
- * with a handle the compaction stage reads MID-run. That mid-run
6
- * read is deliberate and has precedent: the causal-evidence
7
- * recorder is attached inline for the same reason (the memory write
8
- * stage consumes its accumulators before the run ends).
9
- * Role: recorders/core layer. Attached ONLY when `.compaction()` is
10
- * configured, and always INLINE — a compaction decision cannot ride
11
- * one beat behind the loop it is deciding for.
5
+ * with a handle the window stage reads MID-run. That mid-run read is
6
+ * deliberate and has precedent: the causal-evidence recorder is
7
+ * attached inline for the same reason (the memory write stage
8
+ * consumes its accumulators before the run ends).
9
+ * Role: recorders/core layer. Attached ONLY when a window strategy is
10
+ * configured (`.window()` / `.compaction()`), and always INLINE — a
11
+ * window decision cannot ride one beat behind the loop it is
12
+ * deciding for.
12
13
  * Emits: nothing. It only measures.
13
14
  *
14
15
  * It answers two questions a stage function cannot answer for itself:
@@ -19,7 +20,7 @@
19
20
  * `runtimeStageId` on every write to `history`. A stage function has no
20
21
  * access to its own runtimeStageId (footprintjs exposes no such scope
21
22
  * method), so the recorder channel is the ONLY honest source for the
22
- * `foldedStageIds` a fold has to name.
23
+ * `removedStageIds` a strategy has to name.
23
24
  */
24
25
  import type { EmitEvent, WriteEvent } from 'footprintjs';
25
26
  /** What the provider reported for the most recent completed LLM call. */
@@ -42,16 +43,21 @@ export interface CompactionMeterHandle {
42
43
  /** Origins aligned index-for-index with the current window. */
43
44
  origins(): readonly MessageOrigin[];
44
45
  /**
45
- * Tell the meter a fold is about to happen so it can re-align origins to
46
- * the post-fold window, which is `[...head, summary, ...tail]`: `head` is
47
- * the leading messages the fold stepped over (turns that refused to fold),
48
- * `tail` is the messages kept after the folded span.
46
+ * Tell the meter a window strategy is about to change the window, so it can
47
+ * re-align origins to the new one — `[...head, (inserted)?, ...tail]`:
48
+ * `head` is the leading messages the strategy stepped over (turns that
49
+ * refused to leave), `tail` is the messages kept after the removed span.
49
50
  *
50
- * Called by the stage that performs the fold, BEFORE it writes — the fold
51
- * is the one shape the meter cannot infer, because the TypedScope set trap
52
- * JSON-round-trips every write and destroys object identity.
51
+ * `insertedAtMs` is the birth of the ONE message the strategy put in the
52
+ * span's place (compaction's summary, a drop's authored notice). Omit it
53
+ * when the strategy removed messages and inserted nothing.
54
+ *
55
+ * Called by the stage that performs the change, BEFORE it writes — the
56
+ * shape change is the one thing the meter cannot infer, because the
57
+ * TypedScope set trap JSON-round-trips every write and destroys object
58
+ * identity.
53
59
  */
54
- rebaseForFold(headCount: number, keptTailCount: number, summaryBornAtMs: number): void;
60
+ rebaseForWindowChange(headCount: number, keptTailCount: number, insertedAtMs?: number): void;
55
61
  clear(): void;
56
62
  onWrite(event: WriteEvent): void;
57
63
  onEmit(event: EmitEvent): void;
@@ -72,8 +78,8 @@ export interface CompactionMeterOptions {
72
78
  * append to it (tool-calls). Growth fills the new tail with the writing
73
79
  * stage's id; a wholesale replacement re-stamps everything with the writer
74
80
  * that produced it — which is exactly true, since that writer is where those
75
- * messages entered THIS run. Shrink only ever comes from a fold, and a fold
76
- * announces itself through `rebaseForFold`.
81
+ * messages entered THIS run. Shrink only ever comes from a window strategy,
82
+ * and the stage announces it through `rebaseForWindowChange`.
77
83
  */
78
84
  export declare function compactionMeter(options?: CompactionMeterOptions): CompactionMeterHandle;
79
85
  //# sourceMappingURL=CompactionMeter.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"CompactionMeter.d.ts","sourceRoot":"","sources":["../../../../src/recorders/core/CompactionMeter.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AA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 @@
1
1
  {
2
2
  "name": "agentfootprint",
3
- "version": "7.16.0",
3
+ "version": "7.18.0",
4
4
  "description": "The explainable agent framework — backtrack a wrong answer to the exact context that caused it (evidence, not guesses). Built on footprintjs.",
5
5
  "license": "MIT",
6
6
  "author": "Sanjay Krishna Anbalagan",
@@ -1 +0,0 @@
1
- {"version":3,"file":"errors.js","sourceRoot":"","sources":["../../../../src/core/agent/compaction/errors.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;AAEH;;;;;;;;;;;;GAYG;AACH,MAAa,2BAA4B,SAAQ,KAAK;IAClC,IAAI,GAAG,6BAA6B,CAAC;IACvD,4DAA4D;IACnD,QAAQ,CAAS;IAE1B,YAAY,QAAgB;QAC1B,KAAK,CACH,iDAAiD,QAAQ,kCAAkC;YACzF,sFAAsF;YACtF,oFAAoF;YACpF,mFAAmF;YACnF,0FAA0F;YAC1F,oFAAoF;YACpF,YAAY,CACf,CAAC;QACF,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;IAC3B,CAAC;CACF;AAjBD,kEAiBC"}
@@ -1,24 +0,0 @@
1
- "use strict";
2
- /**
3
- * compaction — keep the live window inside budget without ever losing the
4
- * record.
5
- *
6
- * The one sentence: **compaction edits the WINDOW, never the LEDGER.** Folded
7
- * turns stay in the commit log verbatim; the summary enters as its own
8
- * recorded step naming every `runtimeStageId` it folded. A summary is a claim
9
- * about the past, so this library files it as a claim — not as the past.
10
- *
11
- * Public surface (re-exported from the package root):
12
- * `CompactionOptions` what `.compaction()` accepts
13
- * `CompactionRecord` what each over-budget visit wrote to the ledger
14
- * `FoldRefusal(Reason)` why a turn refused to fold
15
- * `CompactionUnmeasurableError` the refusal for a provider that reports no usage
16
- */
17
- Object.defineProperty(exports, "__esModule", { value: true });
18
- exports.isCompactedSummary = exports.COMPACTED_FRAME_PREFIX = exports.CompactionUnmeasurableError = void 0;
19
- var errors_js_1 = require("./errors.js");
20
- Object.defineProperty(exports, "CompactionUnmeasurableError", { enumerable: true, get: function () { return errors_js_1.CompactionUnmeasurableError; } });
21
- var summarize_js_1 = require("./summarize.js");
22
- Object.defineProperty(exports, "COMPACTED_FRAME_PREFIX", { enumerable: true, get: function () { return summarize_js_1.COMPACTED_FRAME_PREFIX; } });
23
- Object.defineProperty(exports, "isCompactedSummary", { enumerable: true, get: function () { return summarize_js_1.isCompactedSummary; } });
24
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/core/agent/compaction/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;AAEH,yCAA0D;AAAjD,wHAAA,2BAA2B,OAAA;AAQpC,+CAA4E;AAAnE,sHAAA,sBAAsB,OAAA;AAAE,kHAAA,kBAAkB,OAAA"}
@@ -1,152 +0,0 @@
1
- "use strict";
2
- /**
3
- * compaction/strategy — INTERNAL. How a window strategy is shaped.
4
- *
5
- * Pattern: Strategy (GoF), deliberately kept private for now.
6
- * Role: core/ layer. The compaction stage does the wiring — read the
7
- * meter, write the window, emit, record, cost — and delegates the
8
- * one interesting question to a strategy:
9
- *
10
- * given the segmented turns, the meter readings, and the
11
- * options → what should the window become, and what does the
12
- * ledger need to be told about it?
13
- *
14
- * Emits: N/A. A strategy is pure decision + (optionally) its own LLM call;
15
- * it never touches scope, never emits, and never writes. That is
16
- * what makes it testable without a chart, and what keeps the
17
- * "record everything you did" duty in ONE place (the stage) rather
18
- * than duplicated per strategy.
19
- *
20
- * **Not exported from any barrel, and not part of the public API.** The only
21
- * shipped implementation is `summarizeOldestStrategy` (what `.compaction()`
22
- * configures). The interface lives here so that the day a second window
23
- * strategy is warranted it is an added file rather than a rewrite of the
24
- * stage — but a seam nobody has used twice is a guess, so it stays private
25
- * until it has a second implementation to be right about.
26
- */
27
- Object.defineProperty(exports, "__esModule", { value: true });
28
- exports.summarizeOldestStrategy = void 0;
29
- const summarize_js_1 = require("./summarize.js");
30
- const turns_js_1 = require("./turns.js");
31
- /**
32
- * The shipped strategy: fold the oldest contiguous run of foldable turns into
33
- * one summary message, keeping the recent turns and stepping over anything
34
- * unresolved.
35
- *
36
- * Everything it decides, it explains. Every path returns a record — including
37
- * the paths that change nothing, which are the ones a person debugging an
38
- * over-budget window actually needs.
39
- */
40
- function summarizeOldestStrategy(config, defaultModel) {
41
- const model = config.model ?? defaultModel;
42
- return {
43
- name: 'summarize-oldest',
44
- async plan(input) {
45
- const { history, turns, origins, iteration } = input;
46
- const charsBefore = (0, turns_js_1.windowChars)(history);
47
- const base = {
48
- iteration,
49
- measuredTokens: input.measuredTokens,
50
- thresholdTokens: config.thresholdTokens,
51
- overBudget: true,
52
- windowCharsBefore: charsBefore,
53
- };
54
- const unchanged = (refusals, extra = {}) => ({
55
- record: {
56
- ...base,
57
- foldedStageIds: [],
58
- foldedMessageCount: 0,
59
- windowCharsAfter: charsBefore,
60
- summaryChars: 0,
61
- refusals,
62
- ...extra,
63
- },
64
- evictions: [],
65
- planAction: 'none',
66
- });
67
- const plan = (0, turns_js_1.planFold)(turns, config.keepRecentTurns, input.foldability, (turn) => (0, summarize_js_1.isCompactedSummary)(turn.messages[0]));
68
- if (plan.from === -1) {
69
- // Nothing foldable. The window stays over budget and the run proceeds
70
- // — reported, not silently truncated.
71
- return unchanged(plan.refusals);
72
- }
73
- const spanStart = turns[plan.from].start;
74
- const spanEnd = turns[plan.to].start + turns[plan.to].length;
75
- const head = history.slice(0, spanStart);
76
- const span = history.slice(spanStart, spanEnd);
77
- const tail = history.slice(spanEnd);
78
- // A broken summarizer must not take down the run.
79
- let summary;
80
- try {
81
- const result = await (0, summarize_js_1.runSummarizer)(config.summarizer, model, span, input.signal);
82
- summary = {
83
- text: result.text,
84
- usage: { input: result.usage.input, output: result.usage.output },
85
- };
86
- }
87
- catch (err) {
88
- return {
89
- ...unchanged([
90
- { reason: 'summarizer-failed', turnIndex: plan.from, messageIndex: spanStart },
91
- ...plan.refusals,
92
- ]),
93
- warning: `the summarizer threw, so nothing was folded this iteration and the window ` +
94
- `stays over budget (${input.measuredTokens} tokens vs a threshold of ` +
95
- `${config.thresholdTokens}). The run continues. Cause: ` +
96
- `${err instanceof Error ? err.message : String(err)}`,
97
- };
98
- }
99
- const summaryMessage = (0, summarize_js_1.buildSummaryMessage)(summary.text, {
100
- foldedMessageCount: span.length,
101
- iteration,
102
- model,
103
- });
104
- const spend = { model, usage: summary.usage };
105
- // Would the fold actually help? A summary plus its authored frame can be
106
- // LONGER than a handful of short turns; folding then spends a call to
107
- // grow the window and lose detail at the same time. Both sides are
108
- // measured in chars — one unit, an exact comparison, not a token guess.
109
- if (summaryMessage.content.length >= (0, turns_js_1.windowChars)(span)) {
110
- return {
111
- ...unchanged([
112
- { reason: 'summary-not-smaller', turnIndex: plan.from, messageIndex: spanStart },
113
- ...plan.refusals,
114
- ], { summaryChars: summaryMessage.content.length, summarizerTokens: summary.usage }),
115
- spend, // the call still happened, so it still counts
116
- };
117
- }
118
- const foldedAtMs = input.now();
119
- const foldedStageIds = [];
120
- const evictions = [];
121
- for (let i = spanStart; i < spanEnd; i++) {
122
- const origin = origins[i];
123
- if (origin !== undefined && !foldedStageIds.includes(origin.stageId)) {
124
- foldedStageIds.push(origin.stageId);
125
- }
126
- evictions.push({
127
- index: i,
128
- survivalMs: origin === undefined ? 0 : Math.max(0, foldedAtMs - origin.bornAtMs),
129
- });
130
- }
131
- const window = [...head, summaryMessage, ...tail];
132
- return {
133
- window,
134
- rebase: { headCount: head.length, keptTailCount: tail.length },
135
- record: {
136
- ...base,
137
- foldedStageIds,
138
- foldedMessageCount: span.length,
139
- windowCharsAfter: (0, turns_js_1.windowChars)(window),
140
- summaryChars: summaryMessage.content.length,
141
- summarizerTokens: summary.usage,
142
- refusals: plan.refusals,
143
- },
144
- evictions,
145
- planAction: 'summarize',
146
- spend,
147
- };
148
- },
149
- };
150
- }
151
- exports.summarizeOldestStrategy = summarizeOldestStrategy;
152
- //# sourceMappingURL=strategy.js.map
@@ -1 +0,0 @@
1
- {"version":3,"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AC;YACR,EAAE,EAAE,CAAC,CAAC;YACN,QAAQ,EAAE;gBACR,GAAG,MAAM;gBACT,EAAE,MAAM,EAAE,uBAAuB,EAAE,SAAS,EAAE,IAAI,EAAE,YAAY,EAAE,KAAK,CAAC,IAAI,CAAE,CAAC,KAAK,EAAE;gBACtF,GAAG,QAAQ;aACZ;SACF,CAAC;IACJ,CAAC;IAED,OAAO,EAAE,IAAI,EAAE,EAAE,EAAE,QAAQ,EAAE,CAAC,GAAG,MAAM,EAAE,GAAG,QAAQ,CAAC,EAAE,CAAC;AAC1D,CAAC;AA9CD,4BA8CC;AAED,0EAA0E;AAC1E,SAAgB,WAAW,CAAC,OAA8B;IACxD,IAAI,KAAK,GAAG,CAAC,CAAC;IACd,KAAK,MAAM,GAAG,IAAI,OAAO;QAAE,KAAK,IAAI,GAAG,CAAC,OAAO,CAAC,MAAM,CAAC;IACvD,OAAO,KAAK,CAAC;AACf,CAAC;AAJD,kCAIC"}
@@ -1,21 +0,0 @@
1
- "use strict";
2
- /**
3
- * compaction/types — the public shape of `.compaction()` and the record it
4
- * writes into the ledger.
5
- *
6
- * Pattern: Value objects (no behavior) + one resolved-config type.
7
- * Role: core/ layer. The law this feature exists to keep is stated once,
8
- * here, because every other file in this folder implements a piece
9
- * of it: **compaction edits the WINDOW, never the LEDGER.**
10
- * Emits: N/A (types only).
11
- *
12
- * The window is `scope.history` — the array `call-llm` hands the provider.
13
- * The ledger is footprintjs's commit log, which is append-only: the turns a
14
- * fold removes from the window were committed by `seed#0` / `tool-calls#N`
15
- * BEFORE the fold and stay in those bundles byte-identical forever. A fold
16
- * therefore cannot destroy history even in principle; it can only stop
17
- * re-sending it. The summary is a CLAIM about the past, so it is filed as a
18
- * claim — its own recorded step, naming every `runtimeStageId` it folded.
19
- */
20
- Object.defineProperty(exports, "__esModule", { value: true });
21
- //# sourceMappingURL=types.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/core/agent/compaction/types.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;GAiBG"}
@@ -1,130 +0,0 @@
1
- "use strict";
2
- /**
3
- * compact — the loop-head stage that keeps the window inside budget.
4
- *
5
- * Reads the last call's ADAPTER-REPORTED input tokens from the compaction
6
- * meter and, when they exceed `thresholdTokens`, hands the window to a window
7
- * strategy. Runs once per ReAct iteration boundary, as the loop target, so
8
- * everything downstream in the turn — the injection engine's triggers, all
9
- * three context slots, and the wire itself — sees ONE window. No component
10
- * gets a different past than the model does.
11
- *
12
- * The law: **it edits the window, never the ledger.** The turns a fold removes
13
- * were committed by `seed#0` / `tool-calls#N` before this stage ran and stay
14
- * in those bundles byte-identical; footprintjs's commit log is append-only, so
15
- * a fold cannot erase history even in principle. What it can do is stop
16
- * re-sending it — and say so, in its own commit, naming every runtimeStageId
17
- * it folded. A compacted run is still a provable run.
18
- *
19
- * This file is deliberately all WIRING. The decision — what the window should
20
- * become — lives behind `WindowStrategy` (compaction/strategy.ts, internal),
21
- * so the duty to record, emit and cost what happened stays in exactly one
22
- * place instead of being re-implemented per strategy. `.compaction()` is the
23
- * only strategy that ships.
24
- *
25
- * Emits (existing vocabulary only — no new event types):
26
- * agentfootprint.context.evicted — one per message leaving the window
27
- * agentfootprint.context.budget_pressure — one per over-budget visit
28
- * agentfootprint.cost.tick — when a pricingTable is set: the
29
- * summarizer's call is a real
30
- * billed call and counts
31
- *
32
- * The summarizer call is deliberately NOT bracketed with
33
- * `stream.llm_start` / `llm_end`: those carry an `iteration` and every
34
- * consumer pairs them by it, so a second bracket inside one iteration would
35
- * corrupt the pairing. Its cost rides the cost channel and its tokens are
36
- * recorded in the commit instead.
37
- */
38
- Object.defineProperty(exports, "__esModule", { value: true });
39
- exports.buildCompactStage = void 0;
40
- const typedEmit_js_1 = require("../../../recorders/core/typedEmit.js");
41
- const helpers_js_1 = require("../../slots/helpers.js");
42
- const cost_js_1 = require("../../cost.js");
43
- const errors_js_1 = require("../compaction/errors.js");
44
- const strategy_js_1 = require("../compaction/strategy.js");
45
- const turns_js_1 = require("../compaction/turns.js");
46
- /** Build the compaction stage function. */
47
- function buildCompactStage(deps) {
48
- const { config, meter } = deps;
49
- const now = deps.now ?? (() => Date.now());
50
- const strategy = (0, strategy_js_1.summarizeOldestStrategy)(config, deps.defaultModel);
51
- // Dedup latch for the strategy's warning: a summarizer that is down is down
52
- // for the whole run, and one warning is a warning while ten is noise.
53
- let warned = false;
54
- return async (scope) => {
55
- const metered = meter.lastCall();
56
- // Iteration 1: nothing has been sent, so nothing has been counted. A
57
- // compactor that acted here would be guessing, which is the one thing
58
- // this feature refuses to do.
59
- if (metered === undefined)
60
- return;
61
- if (metered.input === 0 && metered.output === 0) {
62
- throw new errors_js_1.CompactionUnmeasurableError(deps.providerName);
63
- }
64
- if (metered.input <= config.thresholdTokens)
65
- return;
66
- // ── Over budget. Ask the strategy what the window should become. ──
67
- const history = (scope.history ?? []).slice();
68
- const pausedToolCallId = scope.pausedToolCallId;
69
- const foldability = {
70
- answeredCallIds: (0, turns_js_1.answeredCallIds)(history),
71
- ...(pausedToolCallId !== undefined && { pausedToolCallId }),
72
- ...(scope.pausedCheckIn === true && { pausedCheckIn: true }),
73
- };
74
- const result = await strategy.plan({
75
- history,
76
- turns: (0, turns_js_1.segmentTurns)(history),
77
- origins: meter.origins(),
78
- measuredTokens: metered.input,
79
- foldability,
80
- iteration: scope.iteration ?? 1,
81
- signal: scope.$getEnv?.()?.signal,
82
- now,
83
- });
84
- // ── Apply. The stage owns every side effect. ─────────────────────
85
- if (result.window !== undefined && result.rebase !== undefined) {
86
- // Tell the meter before writing: the fold is the one window shape it
87
- // cannot infer (the set trap JSON-round-trips every write).
88
- meter.rebaseForFold(result.rebase.headCount, result.rebase.keptTailCount, now());
89
- scope.history = result.window;
90
- }
91
- const prior = scope.compactions ?? [];
92
- scope.compactions = [...prior, result.record];
93
- // One eviction per message that left, in the slot vocabulary consumers
94
- // already subscribe to. The hash uses the SAME formula the messages slot
95
- // used to report the piece as injected, so evicted and injected refer to
96
- // the same piece by the same name.
97
- for (const eviction of result.evictions) {
98
- const msg = history[eviction.index];
99
- if (msg === undefined)
100
- continue;
101
- (0, typedEmit_js_1.typedEmit)(scope, 'agentfootprint.context.evicted', {
102
- slot: 'messages',
103
- contentHash: (0, helpers_js_1.fnv1a)(`${msg.role}:${eviction.index}:${msg.content}`),
104
- reason: 'budget',
105
- survivalMs: eviction.survivalMs,
106
- });
107
- }
108
- // `capTokens` / `projectedTokens` are the historical names on
109
- // `BudgetPressureRecord`; the slots measure them in chars, and this
110
- // measures them in the tokens the decision was actually made on.
111
- (0, typedEmit_js_1.typedEmit)(scope, 'agentfootprint.context.budget_pressure', {
112
- slot: 'messages',
113
- capTokens: config.thresholdTokens,
114
- projectedTokens: metered.input,
115
- overflowBy: Math.max(0, metered.input - config.thresholdTokens),
116
- planAction: result.planAction,
117
- });
118
- // A summarizer call is real money. It counts against the same budget.
119
- if (result.spend !== undefined) {
120
- (0, cost_js_1.emitCostTick)(scope, deps.pricingTable, deps.costBudget, result.spend.model, result.spend.usage);
121
- }
122
- if (result.warning !== undefined && !warned) {
123
- warned = true;
124
- // eslint-disable-next-line no-console
125
- console.warn(`[agentfootprint compaction] ${result.warning}`);
126
- }
127
- };
128
- }
129
- exports.buildCompactStage = buildCompactStage;
130
- //# sourceMappingURL=compact.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"compact.js","sourceRoot":"","sources":["../../../../src/core/agent/stages/compact.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;;;AAKH,uEAAiE;AACjE,uDAA+C;AAC/C,2CAA6C;AAC7C,uDAAsE;AACtE,2DAAyF;AACzF,qDAAgG;AAqBhG,2CAA2C;AAC3C,SAAgB,iBAAiB,CAC/B,IAAsB;IAEtB,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,IAAI,CAAC;IAC/B,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,I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"}
@@ -1,18 +0,0 @@
1
- /**
2
- * compaction — keep the live window inside budget without ever losing the
3
- * record.
4
- *
5
- * The one sentence: **compaction edits the WINDOW, never the LEDGER.** Folded
6
- * turns stay in the commit log verbatim; the summary enters as its own
7
- * recorded step naming every `runtimeStageId` it folded. A summary is a claim
8
- * about the past, so this library files it as a claim — not as the past.
9
- *
10
- * Public surface (re-exported from the package root):
11
- * `CompactionOptions` what `.compaction()` accepts
12
- * `CompactionRecord` what each over-budget visit wrote to the ledger
13
- * `FoldRefusal(Reason)` why a turn refused to fold
14
- * `CompactionUnmeasurableError` the refusal for a provider that reports no usage
15
- */
16
- export { CompactionUnmeasurableError } from './errors.js';
17
- export type { CompactionOptions, CompactionRecord, FoldRefusal, FoldRefusalReason, ResolvedCompaction, } from './types.js';
18
- export { COMPACTED_FRAME_PREFIX, isCompactedSummary } from './summarize.js';
@@ -1,18 +0,0 @@
1
- /**
2
- * compaction — keep the live window inside budget without ever losing the
3
- * record.
4
- *
5
- * The one sentence: **compaction edits the WINDOW, never the LEDGER.** Folded
6
- * turns stay in the commit log verbatim; the summary enters as its own
7
- * recorded step naming every `runtimeStageId` it folded. A summary is a claim
8
- * about the past, so this library files it as a claim — not as the past.
9
- *
10
- * Public surface (re-exported from the package root):
11
- * `CompactionOptions` what `.compaction()` accepts
12
- * `CompactionRecord` what each over-budget visit wrote to the ledger
13
- * `FoldRefusal(Reason)` why a turn refused to fold
14
- * `CompactionUnmeasurableError` the refusal for a provider that reports no usage
15
- */
16
- export { CompactionUnmeasurableError } from './errors.js';
17
- export { COMPACTED_FRAME_PREFIX, isCompactedSummary } from './summarize.js';
18
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/core/agent/compaction/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,2BAA2B,EAAE,MAAM,aAAa,CAAC;AAQ1D,OAAO,EAAE,sBAAsB,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC"}