dsh-context-compression-improved 0.8.0-beta.4 → 0.8.0-beta.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (39) hide show
  1. package/CHANGELOG.md +29 -0
  2. package/package.json +1 -1
  3. package/packages/selector/dsh.plugin.json +1 -1
  4. package/packages/selector/lib/client.d.ts +23 -0
  5. package/packages/selector/lib/client.js +567 -3
  6. package/packages/selector/lib/{intent-gate.js → config.js} +285 -136
  7. package/packages/selector/lib/index.d.ts +13 -1
  8. package/packages/selector/lib/index.js +131 -50
  9. package/packages/selector/lib/profiles.d.ts +6 -0
  10. package/packages/selector/lib/pruner.d.ts +6 -0
  11. package/packages/selector/lib/pruner.js +5 -3
  12. package/packages/selector/src/client/CompressionProfileControls.tsx +33 -0
  13. package/packages/selector/src/client/CompressionProfileSelector.tsx +1 -0
  14. package/packages/selector/src/client/decode.ts +5 -1
  15. package/packages/selector/src/client/index.ts +60 -0
  16. package/packages/selector/src/client/locales/de.ts +22 -0
  17. package/packages/selector/src/client/locales/es.ts +22 -0
  18. package/packages/selector/src/client/locales/fr.ts +22 -0
  19. package/packages/selector/src/client/locales/it.ts +22 -0
  20. package/packages/selector/src/client/locales/ja.ts +22 -0
  21. package/packages/selector/src/client/locales/ko.ts +22 -0
  22. package/packages/selector/src/client/locales/ru.ts +22 -0
  23. package/packages/selector/src/client/locales.ts +44 -0
  24. package/packages/selector/src/client/monitor-fab.ts +320 -0
  25. package/packages/selector/src/client/settings-section.tsx +9 -2
  26. package/packages/selector/src/index.ts +126 -60
  27. package/packages/selector/src/profiles.ts +17 -0
  28. package/packages/selector/src/pruner.ts +2 -0
  29. package/packages/selector/src/runtime/config.ts +26 -1
  30. package/packages/selector/src/runtime/monitor.ts +211 -0
  31. package/packages/selector/src/runtime/types.ts +7 -0
  32. package/packages/selector/tests/code-skeleton.client.spec.ts +2 -2
  33. package/packages/selector/tests/custom-contract.client.spec.ts +2 -2
  34. package/packages/selector/tests/estimator-route-registration.host.spec.ts +8 -6
  35. package/packages/selector/tests/monitor-fab.client.spec.ts +117 -0
  36. package/packages/selector/tests/runtime/monitor.spec.ts +274 -0
  37. package/packages/selector/tests/settings-seat.client.spec.ts +19 -7
  38. package/scripts/packed-install-e2e.mjs +1 -1
  39. package/scripts/verify-release.mjs +1 -1
@@ -0,0 +1,117 @@
1
+ /**
2
+ * 压缩监控浮动球(FAB)客户端单测——骨架来自 pm `d29bcb1^` 撤下的
3
+ * longtask-fab(计划 cci-monitor-fab task_3.1-3.4),数据层为注入依赖,
4
+ * 本文件自断言消费侧行为。真实时钟 + initialDelayMs=1,不用假时钟
5
+ * (jsdom × fake-timers 的 async advance 有已知坑)。
6
+ */
7
+ import { afterEach, describe, expect, it, vi } from 'vitest'
8
+ import { initMonitorFab, type MonitorFabDeps, type MonitorSnapshotPayload } from '../src/client/monitor-fab.ts'
9
+
10
+ const FAB_ID = 'dsh-cci-monitor-fab'
11
+
12
+ function snapshotPatch(patch: Partial<MonitorSnapshotPayload> = {}): MonitorSnapshotPayload {
13
+ return {
14
+ ok: true,
15
+ startedAt: new Date().toISOString(),
16
+ gross: { exact: 10_000, estimated: 0 },
17
+ offsets: { exact: 1_200, estimated: 0 },
18
+ net: { exact: 8_800, estimated: 0 },
19
+ usage: { requests: 5, cacheHitRate: 0.812 },
20
+ pricing: { currency: 'USD', actualCost: '0.12', estimatedSavedCost: '1.30' },
21
+ intent: { override: undefined, observedEnabled: false, gate: { floorFraction: 0.45, growthTokens: 50_000 }, lastFold: undefined },
22
+ recentOffsets: [{ component: 'fresh', tokens: 1_200 }],
23
+ sessionScope: null,
24
+ ...patch,
25
+ }
26
+ }
27
+
28
+ function makeDeps(patch: Partial<MonitorFabDeps> & { snapshots?: MonitorSnapshotPayload[] } = {}): MonitorFabDeps & {
29
+ snapshots: MonitorSnapshotPayload[]
30
+ overrides: Array<{ sessionId: string | undefined, action: 'on' | 'off' | 'clear' }>
31
+ } {
32
+ const deps: MonitorFabDeps & {
33
+ snapshots: MonitorSnapshotPayload[]
34
+ overrides: Array<{ sessionId: string | undefined, action: 'on' | 'off' | 'clear' }>
35
+ } = {
36
+ t: (key: string) => key,
37
+ sessionIdOf: () => undefined,
38
+ enabledOf: () => true,
39
+ fetchSnapshot: vi.fn(async () => deps.snapshots[deps.snapshots.length - 1]!),
40
+ applyOverride: vi.fn(async (_sessionId: string | undefined, action: 'on' | 'off' | 'clear') => {
41
+ deps.overrides.push({ sessionId: undefined, action })
42
+ }),
43
+ snapshots: [snapshotPatch()],
44
+ overrides: [],
45
+ initialDelayMs: 1,
46
+ }
47
+ return Object.assign(deps, patch)
48
+ }
49
+
50
+ /** 真实时钟下等条件成立(轮询 1ms 一轮,上限 500ms)。 */
51
+ async function waitFor(predicate: () => boolean): Promise<void> {
52
+ const deadline = Date.now() + 500
53
+ while (!predicate()) {
54
+ if (Date.now() > deadline) throw new Error('waitFor timeout')
55
+ await new Promise(resolve => setTimeout(resolve, 5))
56
+ }
57
+ }
58
+
59
+ afterEach(() => {
60
+ document.body.innerHTML = ''
61
+ localStorage.clear()
62
+ vi.restoreAllMocks()
63
+ })
64
+
65
+ describe('monitor fab (body-level overlay)', () => {
66
+ it('mounts idempotently — double init keeps a single FAB', () => {
67
+ const deps = makeDeps()
68
+ initMonitorFab(deps)
69
+ initMonitorFab(deps)
70
+ expect(document.querySelectorAll(`#${FAB_ID}`).length).toBe(1)
71
+ })
72
+
73
+ it('enabled gate hides the ball and suppresses polling', async () => {
74
+ const fetchSnapshot = vi.fn(async () => snapshotPatch())
75
+ initMonitorFab(makeDeps({ enabledOf: () => false, fetchSnapshot, initialDelayMs: 5 }))
76
+ const fab = document.getElementById(FAB_ID) as HTMLElement
77
+ await waitFor(() => fab.style.display === 'none')
78
+ expect(fetchSnapshot).not.toHaveBeenCalled()
79
+ })
80
+
81
+ it('enabled: ball visible, first tick renders the snapshot', async () => {
82
+ initMonitorFab(makeDeps())
83
+ const fab = document.getElementById(FAB_ID) as HTMLElement
84
+ await waitFor(() => fab.style.display === 'block')
85
+ const net = document.querySelector('[data-net]') as HTMLElement
86
+ expect(net.textContent).toBe('8,800')
87
+ expect(fab.classList.contains('lit')).toBe(false)
88
+ })
89
+
90
+ it('negative net lights the ball (负节省警示)', async () => {
91
+ initMonitorFab(makeDeps({ snapshots: [snapshotPatch({ net: { exact: -800, estimated: 0 } })] }))
92
+ await waitFor(() => (document.getElementById(FAB_ID) as HTMLElement).classList.contains('lit'))
93
+ })
94
+
95
+ it('fetch failure flips the stale marker without throwing', async () => {
96
+ initMonitorFab(makeDeps({ fetchSnapshot: vi.fn(async () => { throw new Error('down') }) }))
97
+ await waitFor(() => document.querySelector('[data-stale]')?.classList.contains('show') === true)
98
+ })
99
+
100
+ it('override buttons drive applyOverride then refetch', async () => {
101
+ const deps = makeDeps()
102
+ initMonitorFab(deps)
103
+ await waitFor(() => (document.querySelector('[data-overoff]') as HTMLButtonElement)?.disabled === false)
104
+ ;(document.querySelector('[data-overoff]') as HTMLButtonElement).click()
105
+ await waitFor(() => deps.overrides.length === 1)
106
+ expect(deps.overrides).toEqual([{ sessionId: undefined, action: 'off' }])
107
+ await waitFor(() => (deps.fetchSnapshot as ReturnType<typeof vi.fn>).mock.calls.length >= 2)
108
+ })
109
+
110
+ it('position persists across drag-free re-init via localStorage', () => {
111
+ localStorage.setItem('dsh.cci.monitor.pos', JSON.stringify({ x: 40, y: 60 }))
112
+ initMonitorFab(makeDeps())
113
+ const fab = document.getElementById(FAB_ID) as HTMLElement
114
+ expect(fab.style.left).toBe('40px')
115
+ expect(fab.style.top).toBe('60px')
116
+ })
117
+ })
@@ -0,0 +1,274 @@
1
+ import { afterEach, describe, expect, it, vi } from 'vitest'
2
+ import { parseContextCompressionSettings, DEFAULT_CONTEXT_COMPRESSION_SETTINGS } from '../../src/runtime/config.ts'
3
+ import { SavingsLedger } from '../../src/runtime/savings.ts'
4
+ import {
5
+ applySessionOverride,
6
+ observeContextUsage,
7
+ buildMonitorSnapshot,
8
+ estimateSavingsPricing,
9
+ isSessionOverrideAction,
10
+ } from '../../src/runtime/monitor.ts'
11
+ import { getSummaryOverride } from '../../src/runtime/tokenpilot/advisor-state.ts'
12
+
13
+ /** 每用例独立 sessionId:advisor-state 的覆盖表是模块级,防用例间串扰。 */
14
+ let seq = 0
15
+ const uniqueSession = (): string => `monitor-spec-${++seq}`
16
+
17
+ afterEach(() => {
18
+ vi.restoreAllMocks()
19
+ })
20
+
21
+ describe('buildMonitorSnapshot', () => {
22
+ it('savings aggregate plus the intent control block, defaults lossless', () => {
23
+ const snap = buildMonitorSnapshot(undefined, new SavingsLedger())
24
+ expect(snap.gross.exact).toBe(0)
25
+ expect(snap.sessionScope).toBeNull()
26
+ expect(snap.intent.override).toBeUndefined()
27
+ expect(snap.intent.observedEnabled).toBeUndefined()
28
+ expect(snap.intent.gate).toEqual({ floorFraction: 0.45, growthTokens: 50_000 })
29
+ expect(snap.intent.lastFold).toBeUndefined()
30
+ })
31
+
32
+ it('session filter scopes the savings rows and the control block', () => {
33
+ const ledger = new SavingsLedger()
34
+ ledger.recordSaving({
35
+ sessionId: 's1',
36
+ component: 'fresh',
37
+ tokensBefore: 10_000,
38
+ tokensAfter: 2_000,
39
+ basis: 'exact-tokenizer',
40
+ sourceSeq: 1,
41
+ })
42
+ const scoped = buildMonitorSnapshot('s1', ledger)
43
+ expect(scoped.sessionScope).toBe('s1')
44
+ expect(scoped.gross.exact).toBe(8_000)
45
+ const other = buildMonitorSnapshot('s2', ledger)
46
+ expect(other.gross.exact).toBe(0)
47
+ })
48
+
49
+ it('reuses the ledger verbatim — no second accounting', () => {
50
+ const ledger = new SavingsLedger()
51
+ ledger.recordSaving({
52
+ sessionId: 's1',
53
+ component: 'fresh',
54
+ tokensBefore: 1_000,
55
+ tokensAfter: 100,
56
+ basis: 'exact-tokenizer',
57
+ sourceSeq: 2,
58
+ originalText: 'x\n'.repeat(400),
59
+ })
60
+ const monitor = buildMonitorSnapshot('s1', ledger)
61
+ expect(monitor).toMatchObject(ledger.snapshot('s1'))
62
+ })
63
+ })
64
+
65
+ describe('applySessionOverride (the /ctx-summary state machine)', () => {
66
+ it('pins on/off and echoes the post-action truth', () => {
67
+ const sessionId = uniqueSession()
68
+ expect(applySessionOverride(sessionId, 'on').override).toBe('on')
69
+ expect(getSummaryOverride(sessionId)).toBe('on')
70
+ expect(applySessionOverride(sessionId, 'off').override).toBe('off')
71
+ expect(getSummaryOverride(sessionId)).toBe('off')
72
+ })
73
+
74
+ it('clear returns the session to settings-driven', () => {
75
+ const sessionId = uniqueSession()
76
+ applySessionOverride(sessionId, 'off')
77
+ expect(applySessionOverride(sessionId, 'clear').override).toBeUndefined()
78
+ expect(getSummaryOverride(sessionId)).toBeUndefined()
79
+ })
80
+
81
+ it('isSessionOverrideAction narrows exactly the three actions', () => {
82
+ expect(isSessionOverrideAction('on')).toBe(true)
83
+ expect(isSessionOverrideAction('off')).toBe(true)
84
+ expect(isSessionOverrideAction('clear')).toBe(true)
85
+ expect(isSessionOverrideAction('status')).toBe(false)
86
+ expect(isSessionOverrideAction(42)).toBe(false)
87
+ })
88
+ })
89
+
90
+ describe('estimateSavingsPricing (moved from the entry — shared by savings and monitor routes)', () => {
91
+ const snapshot = {
92
+ startedAt: new Date().toISOString(),
93
+ net: { exact: 4_200, estimated: 0 },
94
+ usage: { requests: 3, inputTokens: 1_000, outputTokens: 500, cacheReadTokens: 200, cacheWriteTokens: 100 },
95
+ }
96
+
97
+ it('third-party routes fail closed to no pricing', () => {
98
+ const readService = (): unknown => ({ currentSelection: () => ({ provider: 'local-35b', model: 'Qwen3.6-35B-A3B' }) })
99
+ expect(estimateSavingsPricing(readService, snapshot)).toBeUndefined()
100
+ })
101
+
102
+ it('official routes carry actual cost and the labeled saved-cost estimate', () => {
103
+ const readService = (): unknown => ({ currentSelection: () => ({ provider: 'deepseek-official', model: 'deepseek-v4-flash' }) })
104
+ const pricing = estimateSavingsPricing(readService, snapshot)
105
+ expect(pricing?.currency).toBe('USD')
106
+ expect(typeof pricing?.actualCost).toBe('string')
107
+ expect(typeof pricing?.estimatedSavedCost).toBe('string')
108
+ })
109
+
110
+ it('an empty ledger prices nothing', () => {
111
+ const readService = (): unknown => ({ currentSelection: () => ({ provider: 'deepseek-official', model: 'deepseek-v4-flash' }) })
112
+ expect(estimateSavingsPricing(readService, {
113
+ startedAt: new Date().toISOString(),
114
+ net: { exact: 0, estimated: 0 },
115
+ usage: { requests: 0, inputTokens: 0, outputTokens: 0, cacheReadTokens: 0, cacheWriteTokens: 0 },
116
+ })).toBeUndefined()
117
+ })
118
+ })
119
+
120
+
121
+ import type { Context } from '@deepseek-ai/cordis'
122
+ import { registerMonitorRoute } from '../../src/index.ts'
123
+
124
+ /** Fake webServer: captures exact-path handlers; fake ctx wires direct arrival. */
125
+ function mountMonitorRoute(): { handler: (req: unknown, res: unknown) => void } {
126
+ let handler: (req: unknown, res: unknown) => void = () => {}
127
+ const webServer = { register: (def: { path: string, handler: typeof handler }) => { handler = def.handler; return () => undefined } }
128
+ const ctx = {
129
+ get: (name: string) => (name === 'webServer' ? webServer : undefined),
130
+ inject: (deps: string[], cb: (injected: Record<string, unknown>) => void) => cb({ webServer }),
131
+ effect: () => undefined,
132
+ } as unknown as Context
133
+ registerMonitorRoute(ctx)
134
+ return { handler }
135
+ }
136
+
137
+ interface CapturedResponse {
138
+ status: number
139
+ body: Record<string, unknown>
140
+ }
141
+
142
+ function fakeRes(): { res: unknown, captured: CapturedResponse } {
143
+ const captured = {} as CapturedResponse
144
+ const res = {
145
+ writeHead: (status: number) => { captured.status = status },
146
+ end: (body?: string) => { captured.body = JSON.parse(body ?? '{}') as Record<string, unknown> },
147
+ }
148
+ return { res, captured }
149
+ }
150
+
151
+ function fakeReq(url: string, method: string, body?: string): unknown {
152
+ return {
153
+ url,
154
+ method,
155
+ on: (event: string, cb: (chunk?: Buffer) => void) => {
156
+ if (event === 'data' && body !== undefined) cb(Buffer.from(body, 'utf8'))
157
+ if (event === 'end') cb()
158
+ },
159
+ }
160
+ }
161
+
162
+ describe('monitor route (GET snapshot / POST override)', () => {
163
+ const PATH = '/api/dsh-context-compression-improved/monitor'
164
+ const { handler } = mountMonitorRoute()
165
+
166
+ it('GET returns ok + savings + intent block scoped to the query session', () => {
167
+ const { res, captured } = fakeRes()
168
+ handler(fakeReq(`${PATH}?sessionId=route-s1`, 'GET'), res)
169
+ expect(captured.status).toBe(200)
170
+ expect(captured.body.ok).toBe(true)
171
+ expect(captured.body.sessionScope).toBe('route-s1')
172
+ expect((captured.body.intent as Record<string, unknown>).gate).toEqual({ floorFraction: 0.45, growthTokens: 50_000 })
173
+ })
174
+
175
+ it('POST drives the /ctx-summary override state machine', () => {
176
+ const sessionId = `route-${uniqueSession()}`
177
+ const { res, captured } = fakeRes()
178
+ handler(fakeReq(`${PATH}?sessionId=${sessionId}`, 'POST', '{"action":"off"}'), res)
179
+ expect(captured.status).toBe(200)
180
+ expect(captured.body).toEqual({ ok: true, override: 'off', sessionScope: sessionId })
181
+ expect(getSummaryOverride(sessionId)).toBe('off')
182
+ })
183
+
184
+ it('POST rejects an unknown action with 400 and touches no state', () => {
185
+ const sessionId = uniqueSession()
186
+ const { res, captured } = fakeRes()
187
+ handler(fakeReq(`${PATH}?sessionId=${sessionId}`, 'POST', '{"action":"boom"}'), res)
188
+ expect(captured.status).toBe(400)
189
+ expect(captured.body.ok).toBe(false)
190
+ expect(getSummaryOverride(sessionId)).toBeUndefined()
191
+ })
192
+
193
+ it('POST rejects a non-JSON body with 400', () => {
194
+ const { res, captured } = fakeRes()
195
+ handler(fakeReq(PATH, 'POST', 'not-json'), res)
196
+ expect(captured.status).toBe(400)
197
+ expect(captured.body.ok).toBe(false)
198
+ })
199
+ })
200
+
201
+ describe('monitorPanel settings parsing (schema surface, mirrors intentSummary cases)', () => {
202
+ const base = {
203
+ profile: 'balanced' as const,
204
+ custom: structuredClone(DEFAULT_CONTEXT_COMPRESSION_SETTINGS.custom),
205
+ }
206
+
207
+ it('defaults to hidden', () => {
208
+ expect(DEFAULT_CONTEXT_COMPRESSION_SETTINGS.monitorPanel).toEqual({ enabled: false })
209
+ })
210
+
211
+ it('absent section inherits the default', () => {
212
+ const parsed = parseContextCompressionSettings({ ...base, autoCompact: { thresholdPercent: 80 } })
213
+ expect(parsed.monitorPanel).toEqual({ enabled: false })
214
+ })
215
+
216
+ it('accepts exactly { enabled: boolean }', () => {
217
+ const parsed = parseContextCompressionSettings({ ...base, monitorPanel: { enabled: true } })
218
+ expect(parsed.monitorPanel).toEqual({ enabled: true })
219
+ })
220
+
221
+ it('rejects extra keys (present-but-invalid is never silently defaulted)', () => {
222
+ expect(() => parseContextCompressionSettings({
223
+ ...base, monitorPanel: { enabled: true, position: 'left' },
224
+ })).toThrow(/expected exactly "enabled"/)
225
+ })
226
+
227
+ it('rejects non-boolean enabled', () => {
228
+ expect(() => parseContextCompressionSettings({
229
+ ...base, monitorPanel: { enabled: 'yes' },
230
+ })).toThrow(/monitorPanel\.enabled must be a boolean/)
231
+ })
232
+
233
+ it('rejects non-object section', () => {
234
+ expect(() => parseContextCompressionSettings({ ...base, monitorPanel: 'yes' }))
235
+ .toThrow(/monitorPanel must be a plain object/)
236
+ })
237
+ })
238
+
239
+ describe('context occupancy observation (task_6.2)', () => {
240
+ it('scoped snapshot carries the observed occupancy block', () => {
241
+ const sessionId = uniqueSession()
242
+ observeContextUsage(sessionId, 60_000, 128_000)
243
+ const snap = buildMonitorSnapshot(sessionId, new SavingsLedger())
244
+ expect(snap.context).toEqual({ liveTokens: 60_000, contextWindow: 128_000, pct: 0.469, sessionId })
245
+ })
246
+
247
+ it('aggregate snapshot carries the most recently observed session', () => {
248
+ const a = uniqueSession()
249
+ const b = uniqueSession()
250
+ observeContextUsage(a, 10_000, 100_000)
251
+ observeContextUsage(b, 90_000, 100_000)
252
+ const snap = buildMonitorSnapshot(undefined, new SavingsLedger())
253
+ expect(snap.context?.sessionId).toBe(b)
254
+ expect(snap.context?.pct).toBe(0.9)
255
+ })
256
+
257
+ it('no observation yet — context block absent', () => {
258
+ const snap = buildMonitorSnapshot(uniqueSession(), new SavingsLedger())
259
+ expect(snap.context).toBeUndefined()
260
+ })
261
+
262
+ it('observation cap keeps the newest 64 sessions', () => {
263
+ for (let i = 0; i < 70; i++) observeContextUsage(`cap-${i}`, i, 1000)
264
+ const snap = buildMonitorSnapshot('cap-69', new SavingsLedger())
265
+ expect(snap.context?.sessionId).toBe('cap-69')
266
+ })
267
+
268
+ it('empty session id and non-finite tokens are ignored', () => {
269
+ observeContextUsage('', 5, 100)
270
+ observeContextUsage('fin-check', Number.NaN, 100)
271
+ expect(buildMonitorSnapshot('fin-check', new SavingsLedger()).context).toBeUndefined()
272
+ })
273
+ })
274
+
@@ -64,16 +64,17 @@ function collectRegistrations(
64
64
  return { declared, registrations }
65
65
  }
66
66
 
67
- describe('settings-seat contract (standalone settings.section only)', () => {
67
+ describe('settings-seat contract (standalone settings.section + input-bar session binder)', () => {
68
68
  it('declares the services apply consumes (cordis waits; no lazy-get race)', () => {
69
69
  expect(inject).toEqual(['slots', 'locale', 'configForms'])
70
70
  })
71
71
 
72
- it('injects exactly the settings.section seat and nothing else', () => {
72
+ it('injects exactly two seats: the settings.section panel + the input-bar session binder', () => {
73
73
  const { declared, registrations } = collectRegistrations()
74
- expect(declared).toEqual(['settings.section'])
75
- expect(registrations).toHaveLength(1)
74
+ expect(declared).toEqual(['settings.section', 'conversation.input.left'])
75
+ expect(registrations).toHaveLength(2)
76
76
  expect(registrations[0]!.slot).toBe('settings.section')
77
+ expect(registrations[1]!.slot).toBe('conversation.input.left')
77
78
  })
78
79
 
79
80
  it('no longer claims a shell.overlay float (the review panel it served is gone)', () => {
@@ -90,10 +91,21 @@ describe('settings-seat contract (standalone settings.section only)', () => {
90
91
  expect((options['label'] as () => string)()).toBe('nav')
91
92
  expect(typeof options['inject']).toBe('function')
92
93
  const face = (options['inject'] as () => Record<string, unknown>)()
93
- expect(Object.keys(face).sort()).toEqual(['hooks', 'saveAutoCompact', 'saveCodeSkeleton', 'saveCustom', 'saveIntentSummary', 'savePresetOptions', 'select', 'resetCustom'].sort())
94
+ expect(Object.keys(face).sort()).toEqual(['hooks', 'saveAutoCompact', 'saveCodeSkeleton', 'saveCustom', 'saveIntentSummary', 'saveMonitorPanel', 'savePresetOptions', 'select', 'resetCustom'].sort())
94
95
  expect(component).toBe(ContextCompressionSettingsSection)
95
96
  })
96
97
 
98
+ it('pins the input-bar binder: invisible component, inject captures the bare sessionId', () => {
99
+ const { registrations } = collectRegistrations()
100
+ const inputSeat = registrations[1]!
101
+ expect(inputSeat.options['id']).toBe('context-compression-session-bind')
102
+ expect(inputSeat.options['order']).toBe(170)
103
+ expect(typeof inputSeat.options['inject']).toBe('function')
104
+ const face = (inputSeat.options['inject'] as (sessionId: string) => Record<string, unknown>)('sess-42')
105
+ expect(face).toEqual({})
106
+ expect(inputSeat.component).toBeTypeOf('function')
107
+ })
108
+
97
109
  it('never adds a Plugins-section card or tab alongside the standalone section', () => {
98
110
  const { declared } = collectRegistrations()
99
111
  expect(declared).not.toContain('settings.plugins.tab')
@@ -154,8 +166,8 @@ describe('settings-seat contract (standalone settings.section only)', () => {
154
166
  const warn = vi.spyOn(console, 'warn').mockImplementation(() => {})
155
167
  try {
156
168
  const { declared } = collectRegistrations({ registerThrows: true })
157
- // It tried the seat (so the degradation is "loud", not a silent no-op)…
158
- expect(declared).toEqual(['settings.section'])
169
+ // It tried both seats (so the degradation is "loud", not a silent no-op)…
170
+ expect(declared).toEqual(['settings.section', 'conversation.input.left'])
159
171
  // …and the rejection never escaped apply().
160
172
  expect(warn).toHaveBeenCalled()
161
173
  } finally {
@@ -416,7 +416,7 @@ async function runOfficialCloneCliSmoke(referenceRoot, registry, upgradeFrom, ca
416
416
  * ui-slot packages) the web bundler supplies, and that stack is verified
417
417
  * from the built client libraries below.
418
418
  */
419
- const HOST_PLANE_ENTRIES = ['index.js', 'pruner.js', 'intent-gate.js', 'tail-trim.js', 'invariant.js']
419
+ const HOST_PLANE_ENTRIES = ['index.js', 'pruner.js', 'config.js', 'tail-trim.js', 'invariant.js']
420
420
 
421
421
  /**
422
422
  * Bare package names the installed package's host-plane runtime files import.
@@ -49,7 +49,7 @@ const INSTALLATION_PROVIDED_RUNTIME = new Set([
49
49
  // stack (`react`, the ui-slot packages); its requires are reviewed from the
50
50
  // built artifact further down instead.
51
51
  const HOST_PLANE_ENTRIES = [
52
- 'lib/intent-gate.js',
52
+ 'lib/config.js',
53
53
  'lib/index.js',
54
54
  'lib/invariant.js',
55
55
  'lib/pruner.js',