dsh-context-compression-improved 0.7.0-beta.2 → 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.
- package/CHANGELOG.md +9 -0
- package/package.json +17 -18
- package/packages/selector/dsh.plugin.json +1 -1
- package/packages/selector/lib/client.d.ts +44 -0
- package/packages/selector/lib/client.js +1007 -13
- package/packages/selector/lib/{intent-gate.js → config.js} +799 -136
- package/packages/selector/lib/index.d.ts +13 -1
- package/packages/selector/lib/index.js +204 -3
- package/packages/selector/lib/profiles.d.ts +6 -0
- package/packages/selector/lib/pruner.d.ts +6 -0
- package/packages/selector/lib/pruner.js +90 -258
- package/packages/selector/lib/style.css +42 -0
- package/packages/selector/src/client/CompressionProfileControls.tsx +293 -226
- package/packages/selector/src/client/CompressionProfileSelector.module.css +199 -170
- package/packages/selector/src/client/CompressionProfileSelector.tsx +85 -83
- package/packages/selector/src/client/decode.ts +5 -1
- package/packages/selector/src/client/index.ts +307 -243
- package/packages/selector/src/client/locales/de.ts +43 -0
- package/packages/selector/src/client/locales/es.ts +43 -0
- package/packages/selector/src/client/locales/fr.ts +43 -0
- package/packages/selector/src/client/locales/it.ts +43 -0
- package/packages/selector/src/client/locales/ja.ts +43 -0
- package/packages/selector/src/client/locales/ko.ts +43 -0
- package/packages/selector/src/client/locales/ru.ts +43 -0
- package/packages/selector/src/client/locales.ts +282 -196
- package/packages/selector/src/client/monitor-fab.ts +336 -0
- package/packages/selector/src/client/savings-card.tsx +150 -0
- package/packages/selector/src/client/settings-section.tsx +140 -124
- package/packages/selector/src/index.ts +207 -5
- package/packages/selector/src/profiles.ts +17 -0
- package/packages/selector/src/pruner.ts +96 -2
- package/packages/selector/src/runtime/config.ts +26 -1
- package/packages/selector/src/runtime/monitor.ts +235 -0
- package/packages/selector/src/runtime/retrieve.ts +479 -457
- package/packages/selector/src/runtime/savings.ts +337 -0
- package/packages/selector/src/runtime/types.ts +7 -0
- package/packages/selector/tests/code-skeleton.client.spec.ts +2 -2
- package/packages/selector/tests/custom-contract.client.spec.ts +2 -2
- package/packages/selector/tests/estimator-channel.client.spec.tsx +2 -0
- package/packages/selector/tests/estimator-route-registration.host.spec.ts +194 -188
- package/packages/selector/tests/monitor-fab.client.spec.ts +138 -0
- package/packages/selector/tests/runtime/monitor.spec.ts +301 -0
- package/packages/selector/tests/runtime/savings.spec.ts +120 -0
- package/packages/selector/tests/settings-seat.client.spec.ts +177 -165
- package/scripts/packed-install-e2e.mjs +1 -1
- package/scripts/verify-release.mjs +1 -1
|
@@ -0,0 +1,337 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 节省统计账本(诚实口径)。
|
|
3
|
+
*
|
|
4
|
+
* 原则(与 dsh-token-optimizer 类功能对齐的需求口径):
|
|
5
|
+
* 1. **只记已实现**:抵扣来自真实落盘的 rewrite(published replacement)的
|
|
6
|
+
* tokensBefore − tokensAfter,不按"本可以压多少"的最大值计;
|
|
7
|
+
* 2. **负节省(配对抵消)**:同一份原文先被压缩(代码骨架/历史老化/去重指针/
|
|
8
|
+
* 尾裁引用)后,模型又请求了全文——原声称的节省被抵消:全文读取本身
|
|
9
|
+
* 记为负项。净额因此可以为负(骨架 S + 全文 O,对比从未压缩的基线 O,
|
|
10
|
+
* 净 −S),这正是"先骨架再全文 = 负节省"的诚实口径;
|
|
11
|
+
* 3. **口径分列,不混算**:精确 tokenizer 与 chars/4 估算两个 basis 各自独立
|
|
12
|
+
* 汇总,永不合并成一个数。
|
|
13
|
+
*
|
|
14
|
+
* 存储:进程内 per-session 账本(条目环形缓冲 + hash 注册表)。不落盘——
|
|
15
|
+
* 节省统计是运行期面板数据,重启归零是可接受语义(审计日志里已有全量原始记录)。
|
|
16
|
+
*
|
|
17
|
+
* @module dsh-context-compression-improved/runtime/savings
|
|
18
|
+
*/
|
|
19
|
+
import { createHash } from 'node:crypto'
|
|
20
|
+
|
|
21
|
+
export type SavingsBasis = 'exact-tokenizer' | 'characters'
|
|
22
|
+
|
|
23
|
+
export interface SavingsEntry {
|
|
24
|
+
kind: 'saving' | 'offset'
|
|
25
|
+
/** 保存组件(fresh/aggregate/history/tail-trim/dedupe)或抵消原因(full-read/retrieve)。 */
|
|
26
|
+
component: string
|
|
27
|
+
tokens: number
|
|
28
|
+
basis: SavingsBasis
|
|
29
|
+
at: number
|
|
30
|
+
note?: string
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
interface RegistryItem {
|
|
34
|
+
sessionId: string
|
|
35
|
+
component: string
|
|
36
|
+
/** 压缩时声称省下的 token 数(抵消时按此科目回冲)。 */
|
|
37
|
+
claimedTokens: number
|
|
38
|
+
basis: SavingsBasis
|
|
39
|
+
sourceSeq: number
|
|
40
|
+
consumed: boolean
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
const MAX_ENTRIES_PER_SESSION = 400
|
|
44
|
+
const MAX_REGISTRY = 2048
|
|
45
|
+
|
|
46
|
+
export class SavingsLedger {
|
|
47
|
+
private readonly entries = new Map<string, SavingsEntry[]>()
|
|
48
|
+
private readonly registry = new Map<string, RegistryItem>()
|
|
49
|
+
private readonly seenFullText = new Set<string>()
|
|
50
|
+
private readonly usage = new Map<string, SessionUsageTotals>()
|
|
51
|
+
private startedAt = Date.now()
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* 累计一次官方 usage(request-boundary 读取上一已完成请求;末次请求在
|
|
55
|
+
* dispose 汇总前未入账属可接受低估)。usage 字段缺省按 0 计。
|
|
56
|
+
*/
|
|
57
|
+
recordUsage(sessionId: string, usage: {
|
|
58
|
+
inputTokens?: number
|
|
59
|
+
outputTokens?: number
|
|
60
|
+
cacheReadTokens?: number
|
|
61
|
+
cacheWriteTokens?: number
|
|
62
|
+
}): void {
|
|
63
|
+
let total = this.usage.get(sessionId)
|
|
64
|
+
if (total === undefined) {
|
|
65
|
+
total = { requests: 0, inputTokens: 0, outputTokens: 0, cacheReadTokens: 0, cacheWriteTokens: 0 }
|
|
66
|
+
this.usage.set(sessionId, total)
|
|
67
|
+
}
|
|
68
|
+
total.requests += 1
|
|
69
|
+
total.inputTokens += positiveOrZero(usage.inputTokens)
|
|
70
|
+
total.outputTokens += positiveOrZero(usage.outputTokens)
|
|
71
|
+
total.cacheReadTokens += positiveOrZero(usage.cacheReadTokens)
|
|
72
|
+
total.cacheWriteTokens += positiveOrZero(usage.cacheWriteTokens)
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
private totalsFor(scope: readonly string[]): SessionUsageTotals {
|
|
76
|
+
const sum: SessionUsageTotals = { requests: 0, inputTokens: 0, outputTokens: 0, cacheReadTokens: 0, cacheWriteTokens: 0 }
|
|
77
|
+
for (const sid of scope) {
|
|
78
|
+
const t = this.usage.get(sid)
|
|
79
|
+
if (t === undefined) continue
|
|
80
|
+
sum.requests += t.requests
|
|
81
|
+
sum.inputTokens += t.inputTokens
|
|
82
|
+
sum.outputTokens += t.outputTokens
|
|
83
|
+
sum.cacheReadTokens += t.cacheReadTokens
|
|
84
|
+
sum.cacheWriteTokens += t.cacheWriteTokens
|
|
85
|
+
}
|
|
86
|
+
return sum
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
/** 单行会话汇总(session/disposed 日志用)。 */
|
|
90
|
+
sessionSummaryLine(sessionId: string): string {
|
|
91
|
+
const snap = this.snapshot(sessionId)
|
|
92
|
+
const hit = snap.usage.cacheHitRate
|
|
93
|
+
return `net=${snap.net.exact}(exact)/${snap.net.estimated}(est) ` +
|
|
94
|
+
`gross=${snap.gross.exact}/${snap.gross.estimated} offsets=${snap.offsets.exact}/${snap.offsets.estimated} ` +
|
|
95
|
+
`requests=${snap.usage.requests} cacheHit=${hit === null ? '–' : `${Math.round(hit * 100)}%`}`
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
/** 记录一次已落盘的压缩节省(land 成功后调用;tokensRemoved ≤ 0 忽略)。 */
|
|
99
|
+
recordSaving(input: {
|
|
100
|
+
sessionId: string
|
|
101
|
+
component: string
|
|
102
|
+
tokensBefore: number
|
|
103
|
+
tokensAfter: number
|
|
104
|
+
basis: SavingsBasis
|
|
105
|
+
sourceSeq: number
|
|
106
|
+
/** 原文全文(配对键;哈希后不存原文)。 */
|
|
107
|
+
originalText?: string
|
|
108
|
+
}): void {
|
|
109
|
+
const removed = input.tokensBefore - input.tokensAfter
|
|
110
|
+
if (!Number.isFinite(removed) || removed <= 0) return
|
|
111
|
+
this.push(input.sessionId, {
|
|
112
|
+
kind: 'saving',
|
|
113
|
+
component: input.component,
|
|
114
|
+
tokens: removed,
|
|
115
|
+
basis: input.basis,
|
|
116
|
+
at: Date.now(),
|
|
117
|
+
})
|
|
118
|
+
if (typeof input.originalText === 'string' && input.originalText.length > 0) {
|
|
119
|
+
const hash = savingsHash(input.originalText)
|
|
120
|
+
if (this.registry.size >= MAX_REGISTRY && !this.registry.has(hash)) {
|
|
121
|
+
const oldest = this.registry.keys().next().value
|
|
122
|
+
if (oldest !== undefined) this.registry.delete(oldest)
|
|
123
|
+
}
|
|
124
|
+
this.registry.set(hash, {
|
|
125
|
+
sessionId: input.sessionId,
|
|
126
|
+
component: input.component,
|
|
127
|
+
claimedTokens: removed,
|
|
128
|
+
basis: input.basis,
|
|
129
|
+
sourceSeq: input.sourceSeq,
|
|
130
|
+
consumed: false,
|
|
131
|
+
})
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
/**
|
|
136
|
+
* 新的全文工具结果进入上下文(每个 (session, seq) 只看一次):若其原文哈希
|
|
137
|
+
* 命中之前压缩过的条目且未消费过抵消 → 记负项并消费。
|
|
138
|
+
* @param measure 返回 {tokens, basis}——全文按当前可用口径计量。
|
|
139
|
+
*/
|
|
140
|
+
noteFullText(input: {
|
|
141
|
+
sessionId: string
|
|
142
|
+
seq: number
|
|
143
|
+
text: string
|
|
144
|
+
measure: (text: string) => { tokens: number; basis: SavingsBasis }
|
|
145
|
+
}): void {
|
|
146
|
+
if (typeof input.text !== 'string' || input.text.length === 0) return
|
|
147
|
+
const seenKey = `${input.sessionId}:${input.seq}`
|
|
148
|
+
if (this.seenFullText.has(seenKey)) return
|
|
149
|
+
this.seenFullText.add(seenKey)
|
|
150
|
+
if (this.seenFullText.size > MAX_REGISTRY * 4) {
|
|
151
|
+
// 粗放防胀:超过容量上限时整体清空(成员只是防重哨兵,漏一次重复探测无害)
|
|
152
|
+
this.seenFullText.clear()
|
|
153
|
+
this.seenFullText.add(seenKey)
|
|
154
|
+
}
|
|
155
|
+
const hit = this.registry.get(savingsHash(input.text))
|
|
156
|
+
if (hit === undefined || hit.consumed || hit.sessionId !== input.sessionId) return
|
|
157
|
+
hit.consumed = true
|
|
158
|
+
const { tokens, basis } = input.measure(input.text)
|
|
159
|
+
if (tokens <= 0) return
|
|
160
|
+
this.push(input.sessionId, {
|
|
161
|
+
kind: 'offset',
|
|
162
|
+
component: 'full-read',
|
|
163
|
+
tokens,
|
|
164
|
+
basis,
|
|
165
|
+
at: Date.now(),
|
|
166
|
+
note: `#${hit.sourceSeq} ${hit.component} 的原文被全文重读(原声称 −${hit.claimedTokens})`,
|
|
167
|
+
})
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
/** retrieve 回读(部分或全部)重新进入上下文:按返回内容计量记负项。 */
|
|
171
|
+
recordOffset(input: {
|
|
172
|
+
sessionId: string
|
|
173
|
+
component: 'retrieve' | 'tailtrim-retrieve'
|
|
174
|
+
tokens: number
|
|
175
|
+
basis: SavingsBasis
|
|
176
|
+
note?: string
|
|
177
|
+
}): void {
|
|
178
|
+
if (!Number.isFinite(input.tokens) || input.tokens <= 0) return
|
|
179
|
+
this.push(input.sessionId, {
|
|
180
|
+
kind: 'offset',
|
|
181
|
+
component: input.component,
|
|
182
|
+
tokens: input.tokens,
|
|
183
|
+
basis: input.basis,
|
|
184
|
+
at: Date.now(),
|
|
185
|
+
...(input.note === undefined ? {} : { note: input.note }),
|
|
186
|
+
})
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
private sourceSeqOf(item: RegistryItem): number {
|
|
190
|
+
return item.sourceSeq
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
private push(sessionId: string, entry: SavingsEntry): void {
|
|
194
|
+
let list = this.entries.get(sessionId)
|
|
195
|
+
if (list === undefined) {
|
|
196
|
+
list = []
|
|
197
|
+
this.entries.set(sessionId, list)
|
|
198
|
+
}
|
|
199
|
+
list.push(entry)
|
|
200
|
+
if (list.length > MAX_ENTRIES_PER_SESSION) list.splice(0, list.length - MAX_ENTRIES_PER_SESSION)
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
/** 汇总快照。sessionId 缺省 = 全会话聚合。两个 basis 分列,永不合并。 */
|
|
204
|
+
snapshot(sessionId?: string): SavingsSnapshot {
|
|
205
|
+
const scope = sessionId === undefined ? [...this.entries.keys()] : [sessionId]
|
|
206
|
+
const totals = { grossExact: 0, grossEstimated: 0, offsetExact: 0, offsetEstimated: 0 }
|
|
207
|
+
const perComponent = new Map<string, { component: string; tokens: number; basis: SavingsBasis; kind: 'saving' | 'offset' }>()
|
|
208
|
+
const recentOffsets: SavingsEntry[] = []
|
|
209
|
+
for (const sid of scope) {
|
|
210
|
+
for (const entry of this.entries.get(sid) ?? []) {
|
|
211
|
+
const exact = entry.basis === 'exact-tokenizer'
|
|
212
|
+
if (entry.kind === 'saving') {
|
|
213
|
+
if (exact) totals.grossExact += entry.tokens
|
|
214
|
+
else totals.grossEstimated += entry.tokens
|
|
215
|
+
} else {
|
|
216
|
+
if (exact) totals.offsetExact += entry.tokens
|
|
217
|
+
else totals.offsetEstimated += entry.tokens
|
|
218
|
+
recentOffsets.push(entry)
|
|
219
|
+
}
|
|
220
|
+
const key = `${entry.kind}:${entry.component}:${entry.basis}`
|
|
221
|
+
const agg = perComponent.get(key)
|
|
222
|
+
if (agg === undefined) {
|
|
223
|
+
perComponent.set(key, { component: entry.component, tokens: entry.tokens, basis: entry.basis, kind: entry.kind })
|
|
224
|
+
} else {
|
|
225
|
+
agg.tokens += entry.tokens
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
recentOffsets.sort((a, b) => b.at - a.at)
|
|
230
|
+
const usageTotals = this.totalsFor(scope)
|
|
231
|
+
// 按会话分桶(monitor 口径):净额精确口径降序,前 8
|
|
232
|
+
const perSession = sessionId === undefined
|
|
233
|
+
? [...new Set([...this.entries.keys(), ...this.usage.keys()])]
|
|
234
|
+
.map(sid => {
|
|
235
|
+
const s = this.snapshot(sid)
|
|
236
|
+
return {
|
|
237
|
+
sessionId: sid,
|
|
238
|
+
gross: s.gross,
|
|
239
|
+
offsets: s.offsets,
|
|
240
|
+
net: s.net,
|
|
241
|
+
requests: s.usage.requests,
|
|
242
|
+
cacheHitRate: s.usage.cacheHitRate,
|
|
243
|
+
}
|
|
244
|
+
})
|
|
245
|
+
.sort((a, b) => (b.net.exact - a.net.exact) || (b.net.estimated - a.net.estimated))
|
|
246
|
+
.slice(0, 8)
|
|
247
|
+
: []
|
|
248
|
+
return {
|
|
249
|
+
startedAt: new Date(this.startedAt).toISOString(),
|
|
250
|
+
sessions: sessionId === undefined ? this.entries.size : this.entries.has(sessionId) ? 1 : 0,
|
|
251
|
+
gross: { exact: totals.grossExact, estimated: totals.grossEstimated },
|
|
252
|
+
offsets: { exact: totals.offsetExact, estimated: totals.offsetEstimated },
|
|
253
|
+
net: {
|
|
254
|
+
exact: totals.grossExact - totals.offsetExact,
|
|
255
|
+
estimated: totals.grossEstimated - totals.offsetEstimated,
|
|
256
|
+
},
|
|
257
|
+
perComponent: [...perComponent.values()].sort((a, b) => b.tokens - a.tokens),
|
|
258
|
+
recentOffsets: recentOffsets.slice(0, 8).map((e) => ({
|
|
259
|
+
component: e.component,
|
|
260
|
+
tokens: e.tokens,
|
|
261
|
+
basis: e.basis,
|
|
262
|
+
at: new Date(e.at).toISOString(),
|
|
263
|
+
...(e.note === undefined ? {} : { note: e.note }),
|
|
264
|
+
})),
|
|
265
|
+
usage: { ...usageTotals, cacheHitRate: cacheHitRateOf(usageTotals) },
|
|
266
|
+
perSession,
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
/** 测试与停机清理。 */
|
|
271
|
+
clear(): void {
|
|
272
|
+
this.entries.clear()
|
|
273
|
+
this.registry.clear()
|
|
274
|
+
this.seenFullText.clear()
|
|
275
|
+
this.usage.clear()
|
|
276
|
+
this.startedAt = Date.now()
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
export interface SavingsSnapshot {
|
|
281
|
+
startedAt: string
|
|
282
|
+
sessions: number
|
|
283
|
+
gross: { exact: number; estimated: number }
|
|
284
|
+
offsets: { exact: number; estimated: number }
|
|
285
|
+
net: { exact: number; estimated: number }
|
|
286
|
+
perComponent: Array<{ component: string; tokens: number; basis: SavingsBasis; kind: 'saving' | 'offset' }>
|
|
287
|
+
recentOffsets: Array<{ component: string; tokens: number; basis: SavingsBasis; at: string; note?: string }>
|
|
288
|
+
/** 真实 usage 聚合(monitor 模块学到的口径:官方 usage 而非估算)。 */
|
|
289
|
+
usage: SessionUsageTotals & { cacheHitRate: number | null }
|
|
290
|
+
/** 按会话分桶(仅全会话聚合时;按净额精确口径降序,前 8)。 */
|
|
291
|
+
perSession: Array<{
|
|
292
|
+
sessionId: string
|
|
293
|
+
gross: { exact: number; estimated: number }
|
|
294
|
+
offsets: { exact: number; estimated: number }
|
|
295
|
+
net: { exact: number; estimated: number }
|
|
296
|
+
requests: number
|
|
297
|
+
cacheHitRate: number | null
|
|
298
|
+
}>
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
/** 单会话真实 usage 累计(官方 TokenMeter 口径)。 */
|
|
302
|
+
export interface SessionUsageTotals {
|
|
303
|
+
requests: number
|
|
304
|
+
inputTokens: number
|
|
305
|
+
outputTokens: number
|
|
306
|
+
cacheReadTokens: number
|
|
307
|
+
cacheWriteTokens: number
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
function cacheHitRateOf(t: { inputTokens: number; cacheReadTokens: number; cacheWriteTokens: number }): number | null {
|
|
311
|
+
const denom = t.inputTokens + t.cacheReadTokens + t.cacheWriteTokens
|
|
312
|
+
return denom <= 0 ? null : Math.round((t.cacheReadTokens / denom) * 1000) / 1000
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
/** 原文配对哈希(规整行尾与首尾空白——同一文件两次读取的 innocuous 差异不配错)。 */
|
|
316
|
+
export function savingsHash(text: string): string {
|
|
317
|
+
return createHash('sha256')
|
|
318
|
+
.update(
|
|
319
|
+
text
|
|
320
|
+
.replace(/\r\n?/g, '\n')
|
|
321
|
+
.replace(/[ \t]+\n/g, '\n')
|
|
322
|
+
.replace(/(^\s+)|(\s+$)/g, ''),
|
|
323
|
+
'utf8',
|
|
324
|
+
)
|
|
325
|
+
.digest('hex')
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
function positiveOrZero(v: unknown): number {
|
|
329
|
+
return typeof v === 'number' && Number.isFinite(v) && v > 0 ? Math.round(v) : 0
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
const singleton = new SavingsLedger()
|
|
333
|
+
|
|
334
|
+
/** 模块级单例:pruner 与 retrieve 分处两文件,共享同一本账。 */
|
|
335
|
+
export function getSavingsLedger(): SavingsLedger {
|
|
336
|
+
return singleton
|
|
337
|
+
}
|
|
@@ -141,6 +141,11 @@ export interface IntentSummarySettings {
|
|
|
141
141
|
enabled: boolean
|
|
142
142
|
}
|
|
143
143
|
|
|
144
|
+
/** Floating compression-monitor panel (FAB); visibility switch. */
|
|
145
|
+
export interface MonitorPanelSettings {
|
|
146
|
+
enabled: boolean
|
|
147
|
+
}
|
|
148
|
+
|
|
144
149
|
/**
|
|
145
150
|
* Persisted sub-capability overrides for the `tokenpilot-inspired` preset.
|
|
146
151
|
* Absent fields inherit the preset defaults; the section is only meaningful
|
|
@@ -183,6 +188,8 @@ export interface ContextCompressionSettings {
|
|
|
183
188
|
codeSkeleton: CodeSkeletonSettings
|
|
184
189
|
/** Turn-tail intent-summary gate snapped independently of `profile`. */
|
|
185
190
|
intentSummary: IntentSummarySettings
|
|
191
|
+
/** Floating compression-monitor panel (FAB); absent inherits hidden. */
|
|
192
|
+
monitorPanel?: MonitorPanelSettings
|
|
186
193
|
/** Optional tokenpilot-inspired sub-capability overrides; absent inherits preset defaults. */
|
|
187
194
|
presetOptions?: PresetOptionsSettings
|
|
188
195
|
}
|
|
@@ -59,9 +59,9 @@ describe('codeSkeleton confirm-on-write client contract', () => {
|
|
|
59
59
|
configForms: { get: vi.fn(() => form) },
|
|
60
60
|
slots: {
|
|
61
61
|
inject: (_slot: string, install: () => unknown) => { install() },
|
|
62
|
-
register: (registration: { inject?: () => CompressionSelectorInjected }) => {
|
|
62
|
+
register: (registration: { name?: string, inject?: () => CompressionSelectorInjected }) => {
|
|
63
63
|
// The R4 overlay registration carries no inject face; keep the card's.
|
|
64
|
-
if (typeof registration.inject === 'function') injected = registration.inject
|
|
64
|
+
if (registration.name === 'settings.section' && typeof registration.inject === 'function') injected = registration.inject
|
|
65
65
|
return () => {}
|
|
66
66
|
},
|
|
67
67
|
},
|
|
@@ -167,9 +167,9 @@ describe('context compression browser contract', () => {
|
|
|
167
167
|
},
|
|
168
168
|
slots: {
|
|
169
169
|
inject: (_slot: string, install: () => unknown) => { install() },
|
|
170
|
-
register: (registration: { inject?: () => CompressionSelectorInjected }) => {
|
|
170
|
+
register: (registration: { name?: string, inject?: () => CompressionSelectorInjected }) => {
|
|
171
171
|
// The R4 overlay registration carries no inject face; keep the card's.
|
|
172
|
-
if (typeof registration.inject === 'function') injected = registration.inject
|
|
172
|
+
if (registration.name === 'settings.section' && typeof registration.inject === 'function') injected = registration.inject
|
|
173
173
|
return () => {}
|
|
174
174
|
},
|
|
175
175
|
},
|
|
@@ -121,6 +121,8 @@ function mountEstimator(
|
|
|
121
121
|
resetCustom: vi.fn(() => Promise.resolve()),
|
|
122
122
|
saveAutoCompact: vi.fn(() => Promise.resolve()),
|
|
123
123
|
saveCodeSkeleton: vi.fn(() => Promise.resolve()),
|
|
124
|
+
saveIntentSummary: vi.fn(() => Promise.resolve()),
|
|
125
|
+
saveMonitorPanel: vi.fn(() => Promise.resolve()),
|
|
124
126
|
savePresetOptions,
|
|
125
127
|
t,
|
|
126
128
|
})} />)
|