@graphorin/memory 0.6.1 → 0.7.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 (227) hide show
  1. package/CHANGELOG.md +71 -0
  2. package/README.md +1 -1
  3. package/dist/conflict/index.js +0 -1
  4. package/dist/conflict/pipeline.js +0 -1
  5. package/dist/conflict/pipeline.js.map +1 -1
  6. package/dist/conflict/stages/stage3-heuristic-regex.js +0 -1
  7. package/dist/conflict/stages/stage3-heuristic-regex.js.map +1 -1
  8. package/dist/conflict/types.d.ts +1 -1
  9. package/dist/conflict/types.js.map +1 -1
  10. package/dist/consolidator/index.js +2 -0
  11. package/dist/consolidator/index.js.map +1 -1
  12. package/dist/consolidator/lock.js +7 -1
  13. package/dist/consolidator/lock.js.map +1 -1
  14. package/dist/consolidator/phases/deep.js +19 -12
  15. package/dist/consolidator/phases/deep.js.map +1 -1
  16. package/dist/consolidator/phases/induce.d.ts.map +1 -1
  17. package/dist/consolidator/phases/induce.js +2 -3
  18. package/dist/consolidator/phases/induce.js.map +1 -1
  19. package/dist/consolidator/phases/reflect.js +35 -8
  20. package/dist/consolidator/phases/reflect.js.map +1 -1
  21. package/dist/consolidator/phases/standard.js +199 -28
  22. package/dist/consolidator/phases/standard.js.map +1 -1
  23. package/dist/consolidator/reconcile.js +16 -15
  24. package/dist/consolidator/reconcile.js.map +1 -1
  25. package/dist/consolidator/runtime.d.ts.map +1 -1
  26. package/dist/consolidator/runtime.js +129 -47
  27. package/dist/consolidator/runtime.js.map +1 -1
  28. package/dist/consolidator/scheduler.d.ts +17 -3
  29. package/dist/consolidator/scheduler.d.ts.map +1 -1
  30. package/dist/consolidator/scheduler.js.map +1 -1
  31. package/dist/consolidator/types.d.ts +30 -1
  32. package/dist/consolidator/types.d.ts.map +1 -1
  33. package/dist/consolidator/types.js +10 -0
  34. package/dist/consolidator/types.js.map +1 -1
  35. package/dist/context-engine/compaction/clear-tool-results.d.ts +1 -1
  36. package/dist/context-engine/compaction/clear-tool-results.js +1 -1
  37. package/dist/context-engine/compaction/clear-tool-results.js.map +1 -1
  38. package/dist/context-engine/compaction/compactor.d.ts +1 -0
  39. package/dist/context-engine/compaction/compactor.d.ts.map +1 -1
  40. package/dist/context-engine/compaction/compactor.js +32 -8
  41. package/dist/context-engine/compaction/compactor.js.map +1 -1
  42. package/dist/context-engine/compaction/hooks/types.d.ts +1 -1
  43. package/dist/context-engine/compaction/index.d.ts +1 -0
  44. package/dist/context-engine/compaction/templates/marker.d.ts +33 -0
  45. package/dist/context-engine/compaction/templates/marker.d.ts.map +1 -0
  46. package/dist/context-engine/compaction/templates/marker.js +34 -0
  47. package/dist/context-engine/compaction/templates/marker.js.map +1 -0
  48. package/dist/context-engine/compaction/templates/summary-9-section.d.ts +1 -1
  49. package/dist/context-engine/compaction/templates/summary-9-section.d.ts.map +1 -1
  50. package/dist/context-engine/compaction/templates/summary-9-section.js +4 -3
  51. package/dist/context-engine/compaction/templates/summary-9-section.js.map +1 -1
  52. package/dist/context-engine/engine.d.ts +7 -176
  53. package/dist/context-engine/engine.d.ts.map +1 -1
  54. package/dist/context-engine/engine.js +0 -2
  55. package/dist/context-engine/engine.js.map +1 -1
  56. package/dist/context-engine/index.d.ts +8 -49
  57. package/dist/context-engine/io-types.d.ts +144 -0
  58. package/dist/context-engine/io-types.d.ts.map +1 -0
  59. package/dist/context-engine/locale-packs/types.d.ts +1 -1
  60. package/dist/context-engine/locale-packs/types.js.map +1 -1
  61. package/dist/context-engine/privacy-filter.d.ts +1 -2
  62. package/dist/context-engine/privacy-filter.d.ts.map +1 -1
  63. package/dist/context-engine/privacy-filter.js +1 -2
  64. package/dist/context-engine/privacy-filter.js.map +1 -1
  65. package/dist/errors/index.d.ts +2 -2
  66. package/dist/errors/index.js +2 -2
  67. package/dist/errors/index.js.map +1 -1
  68. package/dist/facade.d.ts +43 -52
  69. package/dist/facade.d.ts.map +1 -1
  70. package/dist/facade.js +5 -3
  71. package/dist/facade.js.map +1 -1
  72. package/dist/graph/entity-resolver.js +1 -1
  73. package/dist/graph/entity-resolver.js.map +1 -1
  74. package/dist/index.d.ts +16 -13
  75. package/dist/index.d.ts.map +1 -1
  76. package/dist/index.js +2 -5
  77. package/dist/index.js.map +1 -1
  78. package/dist/internal/envelope.js +57 -0
  79. package/dist/internal/envelope.js.map +1 -0
  80. package/dist/internal/injection-heuristics.js +0 -0
  81. package/dist/internal/injection-heuristics.js.map +1 -1
  82. package/dist/internal/llm-json.js +40 -0
  83. package/dist/internal/llm-json.js.map +1 -0
  84. package/dist/internal/storage-adapter.d.ts +23 -10
  85. package/dist/internal/storage-adapter.d.ts.map +1 -1
  86. package/dist/memory-interface.d.ts +131 -0
  87. package/dist/memory-interface.d.ts.map +1 -0
  88. package/dist/package.js +1 -1
  89. package/dist/package.js.map +1 -1
  90. package/dist/search/iterative.d.ts.map +1 -1
  91. package/dist/search/iterative.js +2 -3
  92. package/dist/search/iterative.js.map +1 -1
  93. package/dist/search/query-transform.d.ts.map +1 -1
  94. package/dist/search/query-transform.js +2 -3
  95. package/dist/search/query-transform.js.map +1 -1
  96. package/dist/tiers/episodic-memory.js +3 -3
  97. package/dist/tiers/episodic-memory.js.map +1 -1
  98. package/dist/tiers/index.d.ts +2 -2
  99. package/dist/tiers/insight-memory.js +1 -1
  100. package/dist/tiers/insight-memory.js.map +1 -1
  101. package/dist/tiers/procedural-memory.d.ts +1 -1
  102. package/dist/tiers/procedural-memory.js +2 -2
  103. package/dist/tiers/procedural-memory.js.map +1 -1
  104. package/dist/tiers/semantic-memory.d.ts +58 -4
  105. package/dist/tiers/semantic-memory.d.ts.map +1 -1
  106. package/dist/tiers/semantic-memory.js +103 -20
  107. package/dist/tiers/semantic-memory.js.map +1 -1
  108. package/dist/tools/block-tools.d.ts +19 -57
  109. package/dist/tools/block-tools.d.ts.map +1 -1
  110. package/dist/tools/block-tools.js.map +1 -1
  111. package/dist/tools/fact-tools.d.ts +53 -214
  112. package/dist/tools/fact-tools.d.ts.map +1 -1
  113. package/dist/tools/fact-tools.js +3 -2
  114. package/dist/tools/fact-tools.js.map +1 -1
  115. package/dist/tools/recall-tools.d.ts +34 -175
  116. package/dist/tools/recall-tools.d.ts.map +1 -1
  117. package/dist/tools/recall-tools.js +5 -4
  118. package/dist/tools/recall-tools.js.map +1 -1
  119. package/dist/tools/runbook-tools.d.ts +15 -58
  120. package/dist/tools/runbook-tools.d.ts.map +1 -1
  121. package/dist/tools/runbook-tools.js.map +1 -1
  122. package/dist/tools/types.d.ts +1 -1
  123. package/package.json +18 -17
  124. package/src/conflict/index.ts +29 -0
  125. package/src/conflict/locale-packs/en.ts +142 -0
  126. package/src/conflict/locale-packs/index.ts +17 -0
  127. package/src/conflict/locale-packs/types.ts +138 -0
  128. package/src/conflict/pipeline.ts +371 -0
  129. package/src/conflict/stages/helpers.ts +65 -0
  130. package/src/conflict/stages/stage1-exact-dedup.ts +40 -0
  131. package/src/conflict/stages/stage2-embedding-three-zone.ts +54 -0
  132. package/src/conflict/stages/stage3-heuristic-regex.ts +51 -0
  133. package/src/conflict/stages/stage4-subject-predicate.ts +46 -0
  134. package/src/conflict/stages/stage5-defer-to-deep.ts +34 -0
  135. package/src/conflict/types.ts +263 -0
  136. package/src/consolidator/budget.ts +312 -0
  137. package/src/consolidator/decay.ts +246 -0
  138. package/src/consolidator/dlq.ts +61 -0
  139. package/src/consolidator/errors.ts +87 -0
  140. package/src/consolidator/idempotency.ts +27 -0
  141. package/src/consolidator/index.ts +269 -0
  142. package/src/consolidator/lock.ts +141 -0
  143. package/src/consolidator/noise-filter.ts +235 -0
  144. package/src/consolidator/phases/deep.ts +308 -0
  145. package/src/consolidator/phases/induce.ts +423 -0
  146. package/src/consolidator/phases/learned-context.ts +233 -0
  147. package/src/consolidator/phases/light.ts +166 -0
  148. package/src/consolidator/phases/reflect.ts +504 -0
  149. package/src/consolidator/phases/standard.ts +1002 -0
  150. package/src/consolidator/reconcile.ts +273 -0
  151. package/src/consolidator/runtime.ts +1049 -0
  152. package/src/consolidator/scheduler.ts +182 -0
  153. package/src/consolidator/triggers.ts +134 -0
  154. package/src/consolidator/types.ts +622 -0
  155. package/src/context-engine/annotations.ts +161 -0
  156. package/src/context-engine/auto-recall.ts +92 -0
  157. package/src/context-engine/compaction/clear-tool-results.ts +232 -0
  158. package/src/context-engine/compaction/compactor.ts +403 -0
  159. package/src/context-engine/compaction/hooks/reanchor-persona-block.ts +55 -0
  160. package/src/context-engine/compaction/hooks/reanchor-pinned-facts.ts +66 -0
  161. package/src/context-engine/compaction/hooks/reanchor-project-rules.ts +57 -0
  162. package/src/context-engine/compaction/hooks/reanchor-recent-results.ts +116 -0
  163. package/src/context-engine/compaction/hooks/types.ts +68 -0
  164. package/src/context-engine/compaction/index.ts +60 -0
  165. package/src/context-engine/compaction/templates/marker.ts +33 -0
  166. package/src/context-engine/compaction/templates/summary-9-section.ts +223 -0
  167. package/src/context-engine/compaction/thresholds.ts +107 -0
  168. package/src/context-engine/compaction/types.ts +255 -0
  169. package/src/context-engine/engine.ts +970 -0
  170. package/src/context-engine/index.ts +118 -0
  171. package/src/context-engine/io-types.ts +162 -0
  172. package/src/context-engine/locale-packs/en.ts +107 -0
  173. package/src/context-engine/locale-packs/index.ts +19 -0
  174. package/src/context-engine/locale-packs/resolver.ts +197 -0
  175. package/src/context-engine/locale-packs/types.ts +177 -0
  176. package/src/context-engine/metadata.ts +114 -0
  177. package/src/context-engine/preambles/inbound-en.ts +19 -0
  178. package/src/context-engine/privacy-filter.ts +190 -0
  179. package/src/context-engine/templates/base-en.ts +19 -0
  180. package/src/context-engine/templates/composer.ts +91 -0
  181. package/src/context-engine/token-budget.ts +319 -0
  182. package/src/context-engine/token-counter.ts +157 -0
  183. package/src/errors/index.ts +273 -0
  184. package/src/facade.ts +750 -0
  185. package/src/graph/entity-resolver.ts +364 -0
  186. package/src/graph/index.ts +24 -0
  187. package/src/index.ts +259 -0
  188. package/src/internal/contextualize.ts +173 -0
  189. package/src/internal/embedder-binding.ts +53 -0
  190. package/src/internal/envelope.ts +70 -0
  191. package/src/internal/id.ts +23 -0
  192. package/src/internal/injection-heuristics.ts +0 -0
  193. package/src/internal/llm-json.ts +38 -0
  194. package/src/internal/spans.ts +35 -0
  195. package/src/internal/storage-adapter.ts +963 -0
  196. package/src/memory-interface.ts +158 -0
  197. package/src/migration/embedder-migration.ts +237 -0
  198. package/src/migration/index.ts +13 -0
  199. package/src/search/explain.ts +123 -0
  200. package/src/search/fit-weights.ts +109 -0
  201. package/src/search/graph-ppr.ts +38 -0
  202. package/src/search/index.ts +55 -0
  203. package/src/search/iterative.ts +658 -0
  204. package/src/search/query-transform.ts +285 -0
  205. package/src/search/rrf.ts +225 -0
  206. package/src/search/trust.ts +55 -0
  207. package/src/search/types.ts +50 -0
  208. package/src/tiers/episodic-memory.ts +463 -0
  209. package/src/tiers/index.ts +50 -0
  210. package/src/tiers/insight-memory.ts +208 -0
  211. package/src/tiers/procedural-memory.ts +482 -0
  212. package/src/tiers/semantic-memory.ts +1729 -0
  213. package/src/tiers/session-memory.ts +271 -0
  214. package/src/tiers/shared-memory.ts +62 -0
  215. package/src/tiers/working-memory.ts +368 -0
  216. package/src/tools/block-tools.ts +172 -0
  217. package/src/tools/fact-tools.ts +473 -0
  218. package/src/tools/index.ts +109 -0
  219. package/src/tools/recall-tools.ts +303 -0
  220. package/src/tools/runbook-tools.ts +107 -0
  221. package/src/tools/taint.ts +39 -0
  222. package/src/tools/types.ts +37 -0
  223. package/dist/conflict/locale-packs/index.js +0 -4
  224. package/dist/context-engine/compaction/index.js +0 -10
  225. package/dist/context-engine/index.d.ts.map +0 -1
  226. package/dist/context-engine/index.js +0 -25
  227. package/dist/context-engine/locale-packs/index.js +0 -4
@@ -0,0 +1,255 @@
1
+ /**
2
+ * Public types for the in-flight auto-compaction subsystem (RB-46
3
+ * / suggested DEC-162 / ADR-050).
4
+ *
5
+ * @packageDocumentation
6
+ */
7
+
8
+ import type { LocalProviderTrust, Message, ModelSpec, SessionScope } from '@graphorin/core';
9
+
10
+ /**
11
+ * Source classification for a compaction event. Surfaced on the
12
+ * `context.compacted` agent event AND on the
13
+ * `context.compaction.triggered.total{source}` counter.
14
+ *
15
+ * @stable
16
+ */
17
+ export type CompactionSource = 'auto-trigger' | 'manual' | 'pre-step';
18
+
19
+ /**
20
+ * Per-call context handed to a custom strategy + post-compaction
21
+ * hooks. Threaded through Phase 12's lifecycle.
22
+ *
23
+ * @stable
24
+ */
25
+ export interface CompactionContext {
26
+ readonly runId: string;
27
+ readonly sessionId: string;
28
+ readonly agentId: string;
29
+ readonly scope: SessionScope;
30
+ readonly source: CompactionSource;
31
+ readonly messages: ReadonlyArray<Message>;
32
+ readonly beforeTokens: number;
33
+ readonly thresholdTokens: number;
34
+ readonly preserveRecentTurns: number;
35
+ readonly providerTrust: LocalProviderTrust;
36
+ readonly summarizerModel?: ModelSpec | string;
37
+ }
38
+
39
+ /**
40
+ * Outcome of a compaction call.
41
+ *
42
+ * @stable
43
+ */
44
+ export interface CompactionResult {
45
+ readonly summary: string;
46
+ readonly summaryTokens: number;
47
+ readonly beforeTokens: number;
48
+ readonly afterTokens: number;
49
+ readonly droppedMessageIds: ReadonlyArray<string>;
50
+ readonly droppedMessageIndices: ReadonlyArray<number>;
51
+ readonly preservedMessages: ReadonlyArray<Message>;
52
+ readonly trimmedMessages: ReadonlyArray<Message>;
53
+ readonly source: CompactionSource;
54
+ readonly durationMs: number;
55
+ readonly hooksFiredCount: number;
56
+ /**
57
+ * Trust classification of the produced summary (CE-15).
58
+ * `'untrusted-derived'` when the compacted window contained
59
+ * `<<<untrusted_content>>>` envelopes or the injection heuristics
60
+ * flagged the summarizer output - the LLM-authored summary body is
61
+ * then wrapped in a `trust="derived"` envelope so taint survives
62
+ * compaction instead of laundering into an authoritative system
63
+ * message. `'trusted'` (or absent, for custom strategies that
64
+ * predate the field) otherwise.
65
+ */
66
+ readonly summaryTrust?: 'trusted' | 'untrusted-derived';
67
+ }
68
+
69
+ /**
70
+ * Built-in trigger configuration. The auto-trigger fires when the
71
+ * counted message-buffer tokens cross the threshold; manual and
72
+ * pre-step trigger sources bypass evaluation entirely.
73
+ *
74
+ * @stable
75
+ */
76
+ export interface CompactionTriggerConfig {
77
+ readonly thresholdTokens?: number;
78
+ readonly thresholdRatio?: number;
79
+ /**
80
+ * SOTA-4 reclaim-floor: defer a compaction whose predicted reclaim - the
81
+ * older, compactable portion of the buffer (everything but the preserved
82
+ * recent turns) - is below this many tokens. Prevents compact-thrash at the
83
+ * threshold (paying a summarizer call to reclaim a handful of tokens). Opt-in;
84
+ * unset / `0` ⇒ no floor (current behaviour).
85
+ */
86
+ readonly minReclaimTokens?: number;
87
+ }
88
+
89
+ /**
90
+ * Strategy discriminator. The default
91
+ * `'summarize-old-preserve-recent'` strategy invokes the
92
+ * configured summarizer and replaces the older portion with a
93
+ * structured section summary; `'clear-old-tool-results'` (SOTA-1) is
94
+ * a zero-LLM tier that replaces the oldest tool results with compact
95
+ * placeholders BEFORE any summarizer call, falling back to summarize
96
+ * only if clearing did not reclaim enough; the `'custom'` variant
97
+ * accepts an arbitrary callable.
98
+ *
99
+ * @stable
100
+ */
101
+ export type CompactionStrategy =
102
+ | {
103
+ readonly kind: 'summarize-old-preserve-recent';
104
+ readonly preserveRecentTurns?: number;
105
+ readonly summarizerModel?: ModelSpec | string;
106
+ readonly summarizerTimeoutMs?: number;
107
+ readonly templateName?: string;
108
+ readonly preStep?: boolean;
109
+ /**
110
+ * Character budget for the older-messages dump embedded in the
111
+ * summarizer prompt (context-engine-07). Without a cap the
112
+ * single-shot prompt carries the ENTIRE older window (~85% of the
113
+ * main model's window at default thresholds) and overflows any
114
+ * smaller `summarizerModel` - the failure is swallowed, so the
115
+ * run silently never compacts. When the dump exceeds the budget
116
+ * the OLDEST messages are elided (a marker notes how many) and
117
+ * the newest are kept verbatim. Default 96_000 chars (~24k
118
+ * tokens); lower it for small summarizer models; `0` disables.
119
+ */
120
+ readonly summarizerInputCharBudget?: number;
121
+ /**
122
+ * C4: keep the most recent N USER messages from the summarized
123
+ * window verbatim (re-inserted between the summary and the
124
+ * preserved tail) - only assistant/tool content is summarized
125
+ * away. User words are the task statement; paraphrase loses
126
+ * constraints. Default `2`; `0` disables.
127
+ */
128
+ readonly preserveUserMessages?: number;
129
+ }
130
+ | {
131
+ /**
132
+ * SOTA-1 zero-LLM clearing tier (Anthropic `clear_tool_uses`): replace the
133
+ * oldest tool results with placeholders before paying for a summarizer.
134
+ */
135
+ readonly kind: 'clear-old-tool-results';
136
+ /** Most-recent tool results kept verbatim (default 3). */
137
+ readonly keepToolUses?: number;
138
+ /** Only clear if at least this many tokens are reclaimable (default 0). */
139
+ readonly clearAtLeast?: number;
140
+ /** Tool names whose results are never cleared. */
141
+ readonly excludeTools?: ReadonlyArray<string>;
142
+ /**
143
+ * C4 (clear_tool_uses_20250919 parity): additionally blank the
144
+ * PAIRED assistant tool-call arguments when a result is cleared,
145
+ * reclaiming the input side of verbose calls too. Default `false`.
146
+ */
147
+ readonly clearToolInputs?: boolean;
148
+ /**
149
+ * C4 (context-engine-11): the retrieval tool the externalized-handle
150
+ * placeholder advertises. Pass `null` when the runtime does not
151
+ * register `read_result` so the placeholder never promises a tool
152
+ * the model cannot call. Default `'read_result'`.
153
+ */
154
+ readonly readResultToolName?: string | null;
155
+ /**
156
+ * A6 / SOTA-2 - recoverable clearing. Wire to a spill / `read_result`
157
+ * registry: cleared content is saved behind a handle and the placeholder
158
+ * references it so the model can re-fetch via `read_result`. Omitted ⇒ bare
159
+ * placeholders (irrecoverable). Only fires for clears that commit.
160
+ */
161
+ readonly externalize?: (
162
+ content: string,
163
+ info: {
164
+ readonly toolCallId: string;
165
+ readonly toolName?: string;
166
+ readonly clearedTokens: number;
167
+ },
168
+ ) => Promise<{ readonly handleId: string; readonly preview?: string }>;
169
+ /**
170
+ * What to do when clearing leaves the buffer over the threshold. Defaults
171
+ * to summarizing the already-cleared buffer (so the LLM sees the reduced
172
+ * window); set `false` for a pure zero-LLM tier that stops after clearing.
173
+ */
174
+ readonly summarizeFallback?:
175
+ | false
176
+ | {
177
+ readonly preserveRecentTurns?: number;
178
+ readonly summarizerModel?: ModelSpec | string;
179
+ readonly summarizerTimeoutMs?: number;
180
+ readonly templateName?: string;
181
+ };
182
+ }
183
+ | {
184
+ readonly kind: 'custom';
185
+ readonly compact: (ctx: CompactionContext) => Promise<CompactionResult>;
186
+ };
187
+
188
+ /**
189
+ * Per-call context handed to a post-compaction hook.
190
+ *
191
+ * @stable
192
+ */
193
+ export interface PostCompactionHookContext {
194
+ readonly result: CompactionResult;
195
+ readonly scope: SessionScope;
196
+ readonly runId: string;
197
+ readonly sessionId: string;
198
+ readonly agentId: string;
199
+ readonly source: CompactionSource;
200
+ /**
201
+ * C4: the messages this compaction dropped (summarized away /
202
+ * cleared), in original order. Lets re-anchoring hooks recover
203
+ * references - e.g. `reanchorRecentResults` re-lists the result
204
+ * handles that just left the window.
205
+ */
206
+ readonly droppedMessages?: ReadonlyArray<Message>;
207
+ }
208
+
209
+ /**
210
+ * Post-compaction hook signature. Each hook returns the
211
+ * `MessageContent[]` parts the harness should append to the
212
+ * trimmed message buffer (re-injected Context Essentials).
213
+ *
214
+ * @stable
215
+ */
216
+ export type PostCompactionHook = (
217
+ ctx: PostCompactionHookContext,
218
+ ) => Promise<ReadonlyArray<import('@graphorin/core').MessageContent>>;
219
+
220
+ /**
221
+ * Full compaction config. Either `false` (explicitly disabled),
222
+ * `'auto'` (resolved per-provider at warm-up) or a fully-specified
223
+ * record.
224
+ *
225
+ * @stable
226
+ */
227
+ export interface CompactionConfig {
228
+ readonly trigger?: 'never' | CompactionTriggerConfig;
229
+ readonly strategy?: CompactionStrategy;
230
+ readonly postCompactionHooks?: ReadonlyArray<PostCompactionHook>;
231
+ }
232
+
233
+ /**
234
+ * Summarizer adapter - accepts a prompt and returns the produced
235
+ * summary. The Phase 06 `Provider` adapters implement this
236
+ * signature; tests pass a deterministic stub. The summarizer
237
+ * adapter is intentionally narrow so the compaction subsystem
238
+ * does not take the heavier `Provider` dependency directly.
239
+ *
240
+ * @stable
241
+ */
242
+ export interface CompactionSummarizer {
243
+ /**
244
+ * Produce a summary text for the supplied prompt. The prompt is
245
+ * built by the compactor using the configured section template;
246
+ * the adapter is responsible for invoking the underlying LLM.
247
+ */
248
+ summarize(input: {
249
+ readonly prompt: string;
250
+ readonly model?: ModelSpec | string;
251
+ readonly signal?: AbortSignal;
252
+ readonly timeoutMs?: number;
253
+ }): Promise<{ readonly text: string; readonly usageTokens?: number }>;
254
+ readonly id?: string;
255
+ }