dsh-context-compression-improved 0.6.2 → 0.6.4

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/package.json CHANGED
@@ -1,162 +1,162 @@
1
- {
2
- "name": "dsh-context-compression-improved",
3
- "version": "0.6.2",
4
- "publishConfig": {
5
- "tag": "dsh-0.1.7"
6
- },
7
- "type": "module",
8
- "main": "packages/selector/lib/index.js",
9
- "types": "packages/selector/lib/index.d.ts",
10
- "exports": {
11
- ".": {
12
- "types": "./packages/selector/lib/index.d.ts",
13
- "default": "./packages/selector/lib/index.js"
14
- },
15
- "./invariant": {
16
- "types": "./packages/selector/lib/invariant.d.ts",
17
- "default": "./packages/selector/lib/invariant.js"
18
- },
19
- "./pruner": {
20
- "types": "./packages/selector/lib/pruner.d.ts",
21
- "default": "./packages/selector/lib/pruner.js"
22
- },
23
- "./client": {
24
- "types": "./packages/selector/lib/client.d.ts",
25
- "default": "./packages/selector/lib/client.js"
26
- },
27
- "./package.json": "./package.json"
28
- },
29
- "dependencies": {
30
- "@deepseek-ai/schemastery": "3.18.4",
31
- "@huggingface/tokenizers": "0.1.3",
32
- "js-yaml": "^4.3.2"
33
- },
34
- "dsh": {
35
- "client": {
36
- "inject": [
37
- "@deepseek-ai/dsh-client-locale",
38
- "@deepseek-ai/dsh-client-ui-primitives",
39
- "@deepseek-ai/dsh-client-ui-slots",
40
- "@deepseek-ai/dsh-client-ui-settings"
41
- ],
42
- "platform": "web"
43
- },
44
- "bundle": {
45
- "patch": "./packages/selector/cordis.patch.yml"
46
- }
47
- },
48
- "license": "MIT",
49
- "repository": {
50
- "type": "git",
51
- "url": "git+https://github.com/drscrewdriver/dsh-context-compression-improved.git"
52
- },
53
- "packageManager": "pnpm@11.7.0",
54
- "engines": {
55
- "node": "^22.19.0 || >=24.0.0",
56
- "dsh": ">=0.1.7-rc.1 <0.1.8-0"
57
- },
58
- "scripts": {
59
- "build": "pnpm -r --if-present run bundle",
60
- "typecheck": "pnpm --filter dsh-context-compression-improved run bundle && pnpm --filter dsh-context-compression-improved run typecheck && pnpm run typecheck:tests",
61
- "typecheck:tests": "tsc --noEmit -p tsconfig.tests.json",
62
- "lint": "eslint packages scripts eslint.config.js",
63
- "lint:fix": "eslint packages scripts eslint.config.js --fix",
64
- "test": "vitest run",
65
- "test:watch": "vitest",
66
- "test:built": "vitest run --config vitest.built.config.ts",
67
- "test:e2e:packed": "node scripts/packed-install-e2e.mjs",
68
- "test:unit": "vitest run",
69
- "verify:release": "node scripts/verify-release.mjs",
70
- "pack:dry-run": "pnpm -r --if-present run pack:dry-run"
71
- },
72
- "peerDependencies": {
73
- "@deepseek-ai/dsh-client-locale": ">=0.1.7-rc.1 <0.1.8-0",
74
- "@deepseek-ai/dsh-client-ui-primitives": ">=0.1.7-rc.1 <0.1.8-0",
75
- "@deepseek-ai/dsh-client-ui-settings": ">=0.1.7-rc.1 <0.1.8-0",
76
- "@deepseek-ai/dsh-client-ui-slots": ">=0.1.7-rc.1 <0.1.8-0"
77
- },
78
- "peerDependenciesMeta": {
79
- "@deepseek-ai/dsh-client-locale": {
80
- "optional": true
81
- },
82
- "@deepseek-ai/dsh-client-ui-primitives": {
83
- "optional": true
84
- },
85
- "@deepseek-ai/dsh-client-ui-settings": {
86
- "optional": true
87
- },
88
- "@deepseek-ai/dsh-client-ui-slots": {
89
- "optional": true
90
- }
91
- },
92
- "devDependencies": {
93
- "@deepseek-ai/cordis": "4.0.1",
94
- "@deepseek-ai/cordis-plugin-group": "1.0.1",
95
- "@deepseek-ai/cordis-plugin-include": "1.0.6",
96
- "@deepseek-ai/cordis-plugin-loader": "1.0.2",
97
- "@deepseek-ai/dsh-agent": "0.1.5-rc.2",
98
- "@deepseek-ai/dsh-agent-loop": "0.1.5-rc.2",
99
- "@deepseek-ai/dsh-agent-loop-testkit": "0.1.5-rc.2",
100
- "@deepseek-ai/dsh-agent-presets": "0.1.5-rc.2",
101
- "@deepseek-ai/dsh-anonymous-user-id": "0.1.5-rc.2",
102
- "@deepseek-ai/dsh-api-remotes": "0.1.5-rc.2",
103
- "@deepseek-ai/dsh-api-session-controller": "0.1.5-rc.2",
104
- "@deepseek-ai/dsh-atomic-write": "0.1.5-rc.2",
105
- "@deepseek-ai/dsh-attachment": "0.1.5-rc.2",
106
- "@deepseek-ai/dsh-client-locale": "0.1.5-rc.2",
107
- "@deepseek-ai/dsh-client-store": "0.1.5-rc.2",
108
- "@deepseek-ai/dsh-client-ui-primitives": "0.1.5-rc.2",
109
- "@deepseek-ai/dsh-client-ui-session": "0.1.5-rc.2",
110
- "@deepseek-ai/dsh-client-ui-settings": "0.1.5-rc.2",
111
- "@deepseek-ai/dsh-client-ui-slots": "0.1.5-rc.2",
112
- "@deepseek-ai/dsh-client-ui-workspace": "0.1.5-rc.2",
113
- "@deepseek-ai/dsh-code-runtime": "0.1.5-rc.2",
114
- "@deepseek-ai/dsh-command-compact": "0.1.5-rc.2",
115
- "@deepseek-ai/dsh-commands": "0.1.5-rc.2",
116
- "@deepseek-ai/dsh-compaction": "0.1.5-rc.2",
117
- "@deepseek-ai/dsh-compaction-basic": "0.1.5-rc.2",
118
- "@deepseek-ai/dsh-cordis-host-runner": "0.1.5-rc.2",
119
- "@deepseek-ai/dsh-credentials": "0.1.5-rc.2",
120
- "@deepseek-ai/dsh-goal": "0.1.5-rc.2",
121
- "@deepseek-ai/dsh-home-paths": "0.1.5-rc.2",
122
- "@deepseek-ai/dsh-host-plugin-inventory": "0.1.5-rc.2",
123
- "@deepseek-ai/dsh-invariants": "0.1.5-rc.2",
124
- "@deepseek-ai/dsh-jobs": "0.1.5-rc.2",
125
- "@deepseek-ai/dsh-launch-environment": "0.1.5-rc.2",
126
- "@deepseek-ai/dsh-llm": "0.1.5-rc.2",
127
- "@deepseek-ai/dsh-llm-deepseek": "0.1.5-rc.2",
128
- "@deepseek-ai/dsh-llm-retry": "0.1.5-rc.2",
129
- "@deepseek-ai/dsh-message-feedback": "0.1.5-rc.2",
130
- "@deepseek-ai/dsh-sandbox": "0.1.5-rc.2",
131
- "@deepseek-ai/dsh-scope": "0.1.5-rc.2",
132
- "@deepseek-ai/dsh-session": "0.1.5-rc.2",
133
- "@deepseek-ai/dsh-session-persistence": "0.1.5-rc.2",
134
- "@deepseek-ai/dsh-session-projection": "0.1.5-rc.2",
135
- "@deepseek-ai/dsh-settings": "0.1.5-rc.2",
136
- "@deepseek-ai/dsh-subagent": "0.1.5-rc.2",
137
- "@deepseek-ai/dsh-subagent-fork-in-process": "0.1.5-rc.2",
138
- "@deepseek-ai/dsh-subagent-in-process-driver": "0.1.5-rc.2",
139
- "@deepseek-ai/dsh-subagent-spawn-in-process": "0.1.5-rc.2",
140
- "@deepseek-ai/dsh-system-prompt": "0.1.5-rc.2",
141
- "@deepseek-ai/dsh-token-meter": "0.1.5-rc.2",
142
- "@deepseek-ai/dsh-tools": "0.1.5-rc.2",
143
- "@deepseek-ai/dsh-user-approval": "0.1.5-rc.2",
144
- "@deepseek-ai/dsh-user-questions": "0.1.5-rc.2",
145
- "@deepseek-ai/schemastery": "3.18.4",
146
- "@eslint/js": "^10.0.1",
147
- "@testing-library/react": "^16.3.2",
148
- "@tsdown/css": "^0.22.14",
149
- "@types/js-yaml": "^4.0.9",
150
- "@types/node": "^22.20.0",
151
- "@types/react": "~18.3.1",
152
- "eslint": "^10.10.0",
153
- "globals": "^17.12.0",
154
- "jsdom": "29.1.1",
155
- "lightningcss": "^1.33.0",
156
- "react": "^18.2.0",
157
- "tsdown": "^0.22.2",
158
- "typescript": "^6.0.3",
159
- "typescript-eslint": "^8.69.0",
160
- "vitest": "^4.1.8"
161
- }
162
- }
1
+ {
2
+ "name": "dsh-context-compression-improved",
3
+ "version": "0.6.4",
4
+ "publishConfig": {
5
+ "tag": "dsh-0.1.7"
6
+ },
7
+ "type": "module",
8
+ "main": "packages/selector/lib/index.js",
9
+ "types": "packages/selector/lib/index.d.ts",
10
+ "exports": {
11
+ ".": {
12
+ "types": "./packages/selector/lib/index.d.ts",
13
+ "default": "./packages/selector/lib/index.js"
14
+ },
15
+ "./invariant": {
16
+ "types": "./packages/selector/lib/invariant.d.ts",
17
+ "default": "./packages/selector/lib/invariant.js"
18
+ },
19
+ "./pruner": {
20
+ "types": "./packages/selector/lib/pruner.d.ts",
21
+ "default": "./packages/selector/lib/pruner.js"
22
+ },
23
+ "./client": {
24
+ "types": "./packages/selector/lib/client.d.ts",
25
+ "default": "./packages/selector/lib/client.js"
26
+ },
27
+ "./package.json": "./package.json"
28
+ },
29
+ "dependencies": {
30
+ "@deepseek-ai/schemastery": "3.18.4",
31
+ "@huggingface/tokenizers": "0.1.3",
32
+ "js-yaml": "^4.3.2"
33
+ },
34
+ "dsh": {
35
+ "client": {
36
+ "inject": [
37
+ "@deepseek-ai/dsh-client-locale",
38
+ "@deepseek-ai/dsh-client-ui-primitives",
39
+ "@deepseek-ai/dsh-client-ui-slots",
40
+ "@deepseek-ai/dsh-client-ui-settings"
41
+ ],
42
+ "platform": "web"
43
+ },
44
+ "bundle": {
45
+ "patch": "./packages/selector/cordis.patch.yml"
46
+ }
47
+ },
48
+ "license": "MIT",
49
+ "repository": {
50
+ "type": "git",
51
+ "url": "git+https://github.com/drscrewdriver/dsh-context-compression-improved.git"
52
+ },
53
+ "packageManager": "pnpm@11.7.0",
54
+ "engines": {
55
+ "node": "^22.19.0 || >=24.0.0",
56
+ "dsh": ">=0.1.7-rc.1 <0.1.8-0"
57
+ },
58
+ "scripts": {
59
+ "build": "pnpm -r --if-present run bundle",
60
+ "typecheck": "pnpm --filter dsh-context-compression-improved run bundle && pnpm --filter dsh-context-compression-improved run typecheck && pnpm run typecheck:tests",
61
+ "typecheck:tests": "tsc --noEmit -p tsconfig.tests.json",
62
+ "lint": "eslint packages scripts eslint.config.js",
63
+ "lint:fix": "eslint packages scripts eslint.config.js --fix",
64
+ "test": "vitest run",
65
+ "test:watch": "vitest",
66
+ "test:built": "vitest run --config vitest.built.config.ts",
67
+ "test:e2e:packed": "node scripts/packed-install-e2e.mjs",
68
+ "test:unit": "vitest run",
69
+ "verify:release": "node scripts/verify-release.mjs",
70
+ "pack:dry-run": "pnpm -r --if-present run pack:dry-run"
71
+ },
72
+ "peerDependencies": {
73
+ "@deepseek-ai/dsh-client-locale": ">=0.1.7-rc.1 <0.1.8-0",
74
+ "@deepseek-ai/dsh-client-ui-primitives": ">=0.1.7-rc.1 <0.1.8-0",
75
+ "@deepseek-ai/dsh-client-ui-settings": ">=0.1.7-rc.1 <0.1.8-0",
76
+ "@deepseek-ai/dsh-client-ui-slots": ">=0.1.7-rc.1 <0.1.8-0"
77
+ },
78
+ "peerDependenciesMeta": {
79
+ "@deepseek-ai/dsh-client-locale": {
80
+ "optional": true
81
+ },
82
+ "@deepseek-ai/dsh-client-ui-primitives": {
83
+ "optional": true
84
+ },
85
+ "@deepseek-ai/dsh-client-ui-settings": {
86
+ "optional": true
87
+ },
88
+ "@deepseek-ai/dsh-client-ui-slots": {
89
+ "optional": true
90
+ }
91
+ },
92
+ "devDependencies": {
93
+ "@deepseek-ai/cordis": "4.0.1",
94
+ "@deepseek-ai/cordis-plugin-group": "1.0.1",
95
+ "@deepseek-ai/cordis-plugin-include": "1.0.6",
96
+ "@deepseek-ai/cordis-plugin-loader": "1.0.2",
97
+ "@deepseek-ai/dsh-agent": "0.1.5-rc.2",
98
+ "@deepseek-ai/dsh-agent-loop": "0.1.5-rc.2",
99
+ "@deepseek-ai/dsh-agent-loop-testkit": "0.1.5-rc.2",
100
+ "@deepseek-ai/dsh-agent-presets": "0.1.5-rc.2",
101
+ "@deepseek-ai/dsh-anonymous-user-id": "0.1.5-rc.2",
102
+ "@deepseek-ai/dsh-api-remotes": "0.1.5-rc.2",
103
+ "@deepseek-ai/dsh-api-session-controller": "0.1.5-rc.2",
104
+ "@deepseek-ai/dsh-atomic-write": "0.1.5-rc.2",
105
+ "@deepseek-ai/dsh-attachment": "0.1.5-rc.2",
106
+ "@deepseek-ai/dsh-client-locale": "0.1.5-rc.2",
107
+ "@deepseek-ai/dsh-client-store": "0.1.5-rc.2",
108
+ "@deepseek-ai/dsh-client-ui-primitives": "0.1.5-rc.2",
109
+ "@deepseek-ai/dsh-client-ui-session": "0.1.5-rc.2",
110
+ "@deepseek-ai/dsh-client-ui-settings": "0.1.5-rc.2",
111
+ "@deepseek-ai/dsh-client-ui-slots": "0.1.5-rc.2",
112
+ "@deepseek-ai/dsh-client-ui-workspace": "0.1.5-rc.2",
113
+ "@deepseek-ai/dsh-code-runtime": "0.1.5-rc.2",
114
+ "@deepseek-ai/dsh-command-compact": "0.1.5-rc.2",
115
+ "@deepseek-ai/dsh-commands": "0.1.5-rc.2",
116
+ "@deepseek-ai/dsh-compaction": "0.1.5-rc.2",
117
+ "@deepseek-ai/dsh-compaction-basic": "0.1.5-rc.2",
118
+ "@deepseek-ai/dsh-cordis-host-runner": "0.1.5-rc.2",
119
+ "@deepseek-ai/dsh-credentials": "0.1.5-rc.2",
120
+ "@deepseek-ai/dsh-goal": "0.1.5-rc.2",
121
+ "@deepseek-ai/dsh-home-paths": "0.1.5-rc.2",
122
+ "@deepseek-ai/dsh-host-plugin-inventory": "0.1.5-rc.2",
123
+ "@deepseek-ai/dsh-invariants": "0.1.5-rc.2",
124
+ "@deepseek-ai/dsh-jobs": "0.1.5-rc.2",
125
+ "@deepseek-ai/dsh-launch-environment": "0.1.5-rc.2",
126
+ "@deepseek-ai/dsh-llm": "0.1.5-rc.2",
127
+ "@deepseek-ai/dsh-llm-deepseek": "0.1.5-rc.2",
128
+ "@deepseek-ai/dsh-llm-retry": "0.1.5-rc.2",
129
+ "@deepseek-ai/dsh-message-feedback": "0.1.5-rc.2",
130
+ "@deepseek-ai/dsh-sandbox": "0.1.5-rc.2",
131
+ "@deepseek-ai/dsh-scope": "0.1.5-rc.2",
132
+ "@deepseek-ai/dsh-session": "0.1.5-rc.2",
133
+ "@deepseek-ai/dsh-session-persistence": "0.1.5-rc.2",
134
+ "@deepseek-ai/dsh-session-projection": "0.1.5-rc.2",
135
+ "@deepseek-ai/dsh-settings": "0.1.5-rc.2",
136
+ "@deepseek-ai/dsh-subagent": "0.1.5-rc.2",
137
+ "@deepseek-ai/dsh-subagent-fork-in-process": "0.1.5-rc.2",
138
+ "@deepseek-ai/dsh-subagent-in-process-driver": "0.1.5-rc.2",
139
+ "@deepseek-ai/dsh-subagent-spawn-in-process": "0.1.5-rc.2",
140
+ "@deepseek-ai/dsh-system-prompt": "0.1.5-rc.2",
141
+ "@deepseek-ai/dsh-token-meter": "0.1.5-rc.2",
142
+ "@deepseek-ai/dsh-tools": "0.1.5-rc.2",
143
+ "@deepseek-ai/dsh-user-approval": "0.1.5-rc.2",
144
+ "@deepseek-ai/dsh-user-questions": "0.1.5-rc.2",
145
+ "@deepseek-ai/schemastery": "3.18.4",
146
+ "@eslint/js": "^10.0.1",
147
+ "@testing-library/react": "^16.3.2",
148
+ "@tsdown/css": "^0.22.14",
149
+ "@types/js-yaml": "^4.0.9",
150
+ "@types/node": "^22.20.0",
151
+ "@types/react": "~18.3.1",
152
+ "eslint": "^10.10.0",
153
+ "globals": "^17.12.0",
154
+ "jsdom": "29.1.1",
155
+ "lightningcss": "^1.33.0",
156
+ "react": "^18.2.0",
157
+ "tsdown": "^0.22.2",
158
+ "typescript": "^6.0.3",
159
+ "typescript-eslint": "^8.69.0",
160
+ "vitest": "^4.1.8"
161
+ }
162
+ }
@@ -113,16 +113,18 @@ type ContextCompressionLocaleKey = keyof typeof zh;
113
113
  * selector consumes lives here instead (getSnapshot shape mirrors the 0.1.7
114
114
  * `ConfigFormSnapshot` minus the parts the components never read).
115
115
  */
116
+ /** The projected snapshot shape (identity-stable between changes — React #185). */
117
+ interface ScopeSnapshot<T> {
118
+ status: 'loading' | 'ready' | 'unavailable';
119
+ value: T | undefined;
120
+ revision: number | undefined;
121
+ writable: boolean;
122
+ base: unknown;
123
+ user: unknown;
124
+ mode: 'host' | 'memory';
125
+ }
116
126
  interface SettingsScope<T> {
117
- getSnapshot(): {
118
- status: 'loading' | 'ready' | 'unavailable';
119
- value: T | undefined;
120
- revision: number | undefined;
121
- writable: boolean;
122
- base: unknown;
123
- user: unknown;
124
- mode: 'host' | 'memory';
125
- };
127
+ getSnapshot(): ScopeSnapshot<T>;
126
128
  subscribe(listener: () => void): () => void;
127
129
  set(field: string, value: unknown): Promise<boolean>;
128
130
  unset(field: string): Promise<boolean>;
@@ -1475,18 +1475,32 @@ window.__ModuleLoader__.load({
1475
1475
  const injected = () => {
1476
1476
  const form = ctx.configForms.get(ENTRY_ID);
1477
1477
  const readDoc = () => decodeSettings(form.getSnapshot().value?.settings);
1478
+ let projectedSource;
1479
+ let projected = {
1480
+ status: "loading",
1481
+ value: void 0,
1482
+ revision: void 0,
1483
+ writable: false,
1484
+ base: void 0,
1485
+ user: void 0,
1486
+ mode: "host"
1487
+ };
1478
1488
  const scope = {
1479
1489
  getSnapshot() {
1480
1490
  const snap = form.getSnapshot();
1481
- return {
1482
- status: snap.status,
1483
- value: readDoc(),
1484
- revision: snap.revision,
1485
- writable: snap.writable,
1486
- base: snap.base,
1487
- user: snap.user,
1488
- mode: snap.mode
1489
- };
1491
+ if (snap !== projectedSource) {
1492
+ projectedSource = snap;
1493
+ projected = {
1494
+ status: snap.status,
1495
+ value: decodeSettings(snap.value?.settings),
1496
+ revision: snap.revision,
1497
+ writable: snap.writable,
1498
+ base: snap.base,
1499
+ user: snap.user,
1500
+ mode: snap.mode
1501
+ };
1502
+ }
1503
+ return projected;
1490
1504
  },
1491
1505
  subscribe: (listener) => form.subscribe(listener),
1492
1506
  set: async (field, value) => {
@@ -1,211 +1,232 @@
1
- import type {} from '@deepseek-ai/dsh-client-locale/client'
2
- import type { Context as ClientContext } from '@deepseek-ai/cordis'
3
- import type {} from '@deepseek-ai/dsh-client-ui-session/client'
4
- import type {} from '@deepseek-ai/dsh-client-ui-settings/client'
5
- import type {} from '@deepseek-ai/dsh-client-ui-workspace/client'
6
- import {
7
- isCustomCompressionPolicy,
8
- ContextCompressionSettingsSection,
9
- type CompressionSelectorInjected, type ContextCompressionSettings,
10
- } from './CompressionProfileSelector.tsx'
11
- import { DEFAULT_CUSTOM_COMPRESSION_POLICY } from '../profiles.ts'
12
- import { decodeSettings } from './decode.ts'
13
- import { en, zh } from './locales.ts'
14
- import { planPresetOptionsOps, presetOptionsOpsAccepted } from './preset-options.ts'
15
- import type { SettingsScope } from './scope-face.ts'
16
-
17
- /**
18
- * Harness 0.1.5 mounts the web core's `slots` service on the client context
19
- * but no longer ships a public type for it; declare the face this plugin
20
- * consumes (same shape dsh-thinking-levels and dsh-prime-memory rely on).
21
- * `inject` factories may be sync (return a disposer) or generator (yield the
22
- * registration); slot options are validated at runtime per slot kind, which
23
- * lets one entry supply both `id` (Desktop, list) and `key` (CLI, keyed).
24
- */
25
- interface SlotsService {
26
- inject(slot: string, register: () => (() => void) | Generator<() => void>): () => void
27
- register(options: Record<string, unknown>, component: unknown): () => void
28
- }
29
- declare module '@deepseek-ai/cordis' {
30
- interface Context {
31
- slots: SlotsService
32
- }
33
- }
34
-
35
- // Declare all consumed services (the official client-plugin pattern, and the
36
- // shape dsh-thinking-levels proves on this same 0.1.5 host line): cordis holds
37
- // apply until `locale` / `configForms` are provided, so registration can use
38
- // them directly. Resolving them lazily via ctx.get() instead races the settings
39
- // client's activation — on a loss the apply early-returned and EVERY settings
40
- // entry silently vanished.
41
- export const inject = ['slots', 'locale', 'configForms']
42
- const NS = 'context-compression'
43
-
44
- /** 0.1.7: the profile entry whose config carries the compression settings doc. */
45
- const ENTRY_ID = 'context-compression-improved-bundle'
46
-
47
- /** The configForms face this client consumes (structural; 0.1.7 ui-settings). */
48
- interface ConfigFormsFace {
49
- get<T>(entryId: string): {
50
- getSnapshot(): {
51
- status: 'loading' | 'ready' | 'unavailable'
52
- value: T | undefined
53
- revision: number | undefined
54
- writable: boolean
55
- base: unknown
56
- user: unknown
57
- mode: 'host' | 'memory'
58
- }
59
- subscribe(listener: () => void): () => void
60
- set(field: string, value: unknown): Promise<boolean>
61
- unset(field: string): Promise<boolean>
62
- }
63
- }
64
-
65
-
66
- function sameCustomPolicy(
67
- left: ContextCompressionSettings['custom'],
68
- right: ContextCompressionSettings['custom'],
69
- ): boolean {
70
- if (left.version !== 3 || right.version !== 3) return false
71
- return left.version === right.version
72
- && left.unit === right.unit
73
- && left.prefixPolicy === right.prefixPolicy
74
- && left.fresh.enabled === right.fresh.enabled
75
- && left.fresh.trigger === right.fresh.trigger
76
- && left.fresh.target === right.fresh.target
77
- && left.aggregate.enabled === right.aggregate.enabled
78
- && left.aggregate.trigger === right.aggregate.trigger
79
- && left.aggregate.target === right.aggregate.target
80
- && left.history.enabled === right.history.enabled
81
- && left.history.trigger === right.history.trigger
82
- && left.history.keepRecentToolCalls === right.history.keepRecentToolCalls
83
- && left.history.keepRecentTokens === right.history.keepRecentTokens
84
- && left.history.minReclaim === right.history.minReclaim
85
- && left.tailTrim.enabled === right.tailTrim.enabled
86
- && left.tailTrim.trigger === right.tailTrim.trigger
87
- }
88
-
89
- export function apply(ctx: ClientContext): void {
90
- ctx.locale.register(NS, { zh, en })
91
- const injected = (): CompressionSelectorInjected => {
92
- // 0.1.7: the compression document rides the selector row's entry config as
93
- // the volatile `settings` field. The form handle is fetched per factory
94
- // call on the caller's fiber (same activation rule as the old bind); the
95
- // wrapper below decodes the stored doc and converts per-field writes into
96
- // whole-doc commits (a volatile object replaces as one snapshot).
97
- const form = ctx.configForms.get<Record<string, unknown>>(ENTRY_ID)
98
- const readDoc = (): ContextCompressionSettings | undefined =>
99
- decodeSettings(form.getSnapshot().value?.settings)
100
- const scope: SettingsScope<ContextCompressionSettings> = {
101
- getSnapshot() {
102
- const snap = form.getSnapshot()
103
- return {
104
- status: snap.status,
105
- value: readDoc(),
106
- revision: snap.revision,
107
- writable: snap.writable,
108
- base: snap.base,
109
- user: snap.user,
110
- mode: snap.mode,
111
- }
112
- },
113
- subscribe: (listener) => form.subscribe(listener),
114
- set: async (field, value) => {
115
- const next = { ...(readDoc() ?? {}) } as Record<string, unknown>
116
- next[field] = value
117
- return form.set('settings', next)
118
- },
119
- unset: async (field) => {
120
- const next = { ...(readDoc() ?? {}) } as Record<string, unknown>
121
- delete next[field]
122
- return form.set('settings', next)
123
- },
124
- mutate: async (ops) => {
125
- const doc = { ...(readDoc() ?? {}) } as Record<string, unknown>
126
- for (const op of ops) {
127
- const [head, key] = op.path as [string, string]
128
- if (head !== 'presetOptions') return false
129
- const section = { ...((doc.presetOptions ?? {}) as Record<string, unknown>) }
130
- if (op.op === 'unset') delete section[key]
131
- else section[key] = (op as { value?: unknown }).value
132
- doc.presetOptions = section
133
- }
134
- return form.set('settings', doc)
135
- },
136
- }
137
- const writeAndConfirm = async (
138
- write: () => Promise<unknown>,
139
- accepts: (settings: ContextCompressionSettings) => boolean,
140
- ): Promise<void> => {
141
- const beforeRevision = scope.getSnapshot().revision
142
- await write()
143
- const after = scope.getSnapshot()
144
- if (
145
- after.status !== 'ready'
146
- || after.value === undefined
147
- || after.revision === beforeRevision
148
- || !accepts(after.value)
149
- ) {
150
- throw new Error('Context compression settings were not saved.')
151
- }
152
- }
153
- return {
154
- hooks: { compression: scope },
155
- select: profile => writeAndConfirm(
156
- () => scope.set('profile', profile),
157
- settings => settings.profile === profile,
158
- ),
159
- saveCustom: custom => writeAndConfirm(
160
- () => scope.set('custom', custom),
161
- settings => isCustomCompressionPolicy(settings.custom)
162
- && sameCustomPolicy(settings.custom, custom),
163
- ),
164
- resetCustom: () => writeAndConfirm(
165
- () => scope.set('custom', structuredClone(DEFAULT_CUSTOM_COMPRESSION_POLICY)),
166
- settings => isCustomCompressionPolicy(settings.custom)
167
- && sameCustomPolicy(settings.custom, DEFAULT_CUSTOM_COMPRESSION_POLICY),
168
- ),
169
- saveAutoCompact: thresholdPercent => writeAndConfirm(
170
- () => scope.set('autoCompact', { thresholdPercent }),
171
- settings => settings.autoCompact.thresholdPercent === thresholdPercent,
172
- ),
173
- saveCodeSkeleton: enabled => writeAndConfirm(
174
- () => scope.set('codeSkeleton', { enabled }),
175
- settings => settings.codeSkeleton.enabled === enabled,
176
- ),
177
- savePresetOptions: options => {
178
- // Path-addressed so one field write cannot delete its siblings: the
179
- // previous whole-section set erased estimatorMode (and every other
180
- // override) whenever the user touched a second field.
181
- const ops = planPresetOptionsOps(scope.getSnapshot().value?.presetOptions, options)
182
- if (ops.length === 0) return Promise.resolve()
183
- return writeAndConfirm(
184
- () => scope.mutate?.(ops) ?? Promise.resolve(false),
185
- settings => presetOptionsOpsAccepted(settings.presetOptions, ops),
186
- )
187
- },
188
- }
189
- }
190
- // 设置 → 上下文压缩 直挂分节(0.1.1 契约;0.1.5 官方分节也注册在此,未声明槽
191
- // 的注册会在激活期抛错,故 try/catch 守卫 —— 同 dsh-prime-memory 的双槽冗余)。
192
- // 只挂这一处:再注册 `settings.plugins.tab` / `settings.plugin.item` 会在
193
- // 设置里同时出现独立分节和插件卡片,重复展示同一张面板。
194
- try {
195
- ctx.slots.inject('settings.section', () => ctx.slots.register({
196
- name: 'settings.section',
197
- id: 'context-compression',
198
- order: 17,
199
- label: () => ctx.locale.bind(NS)('nav'),
200
- locale: NS,
201
- inject: injected,
202
- }, ContextCompressionSettingsSection))
203
- } catch (error) {
204
- console.warn('[dsh-context-compression-improved] settings.section 注册失败(新宿主已收编):', error)
205
- }
206
- }
207
-
208
- export type {
209
- CompressionProfile, CompressionProfileSelectorProps, CompressionSelectorInjected,
210
- ContextCompressionSettings,
211
- } from './CompressionProfileSelector.tsx'
1
+ import type {} from '@deepseek-ai/dsh-client-locale/client'
2
+ import type { Context as ClientContext } from '@deepseek-ai/cordis'
3
+ import type {} from '@deepseek-ai/dsh-client-ui-session/client'
4
+ import type {} from '@deepseek-ai/dsh-client-ui-settings/client'
5
+ import type {} from '@deepseek-ai/dsh-client-ui-workspace/client'
6
+ import {
7
+ isCustomCompressionPolicy,
8
+ ContextCompressionSettingsSection,
9
+ type CompressionSelectorInjected, type ContextCompressionSettings,
10
+ } from './CompressionProfileSelector.tsx'
11
+ import { DEFAULT_CUSTOM_COMPRESSION_POLICY } from '../profiles.ts'
12
+ import { decodeSettings } from './decode.ts'
13
+ import { en, zh } from './locales.ts'
14
+ import { planPresetOptionsOps, presetOptionsOpsAccepted } from './preset-options.ts'
15
+ import type { ScopeSnapshot, SettingsScope } from './scope-face.ts'
16
+
17
+ /**
18
+ * Harness 0.1.5 mounts the web core's `slots` service on the client context
19
+ * but no longer ships a public type for it; declare the face this plugin
20
+ * consumes (same shape dsh-thinking-levels and dsh-prime-memory rely on).
21
+ * `inject` factories may be sync (return a disposer) or generator (yield the
22
+ * registration); slot options are validated at runtime per slot kind, which
23
+ * lets one entry supply both `id` (Desktop, list) and `key` (CLI, keyed).
24
+ */
25
+ interface SlotsService {
26
+ inject(slot: string, register: () => (() => void) | Generator<() => void>): () => void
27
+ register(options: Record<string, unknown>, component: unknown): () => void
28
+ }
29
+ declare module '@deepseek-ai/cordis' {
30
+ interface Context {
31
+ slots: SlotsService
32
+ }
33
+ }
34
+
35
+ // Declare all consumed services (the official client-plugin pattern, and the
36
+ // shape dsh-thinking-levels proves on this same 0.1.5 host line): cordis holds
37
+ // apply until `locale` / `configForms` are provided, so registration can use
38
+ // them directly. Resolving them lazily via ctx.get() instead races the settings
39
+ // client's activation — on a loss the apply early-returned and EVERY settings
40
+ // entry silently vanished.
41
+ export const inject = ['slots', 'locale', 'configForms']
42
+ const NS = 'context-compression'
43
+
44
+ /** 0.1.7: the profile entry whose config carries the compression settings doc. */
45
+ const ENTRY_ID = 'context-compression-improved-bundle'
46
+
47
+ /** The configForms face this client consumes (structural; 0.1.7 ui-settings). */
48
+ interface ConfigFormsFace {
49
+ get<T>(entryId: string): {
50
+ getSnapshot(): {
51
+ status: 'loading' | 'ready' | 'unavailable'
52
+ value: T | undefined
53
+ revision: number | undefined
54
+ writable: boolean
55
+ base: unknown
56
+ user: unknown
57
+ mode: 'host' | 'memory'
58
+ }
59
+ subscribe(listener: () => void): () => void
60
+ set(field: string, value: unknown): Promise<boolean>
61
+ unset(field: string): Promise<boolean>
62
+ }
63
+ }
64
+
65
+
66
+ function sameCustomPolicy(
67
+ left: ContextCompressionSettings['custom'],
68
+ right: ContextCompressionSettings['custom'],
69
+ ): boolean {
70
+ if (left.version !== 3 || right.version !== 3) return false
71
+ return left.version === right.version
72
+ && left.unit === right.unit
73
+ && left.prefixPolicy === right.prefixPolicy
74
+ && left.fresh.enabled === right.fresh.enabled
75
+ && left.fresh.trigger === right.fresh.trigger
76
+ && left.fresh.target === right.fresh.target
77
+ && left.aggregate.enabled === right.aggregate.enabled
78
+ && left.aggregate.trigger === right.aggregate.trigger
79
+ && left.aggregate.target === right.aggregate.target
80
+ && left.history.enabled === right.history.enabled
81
+ && left.history.trigger === right.history.trigger
82
+ && left.history.keepRecentToolCalls === right.history.keepRecentToolCalls
83
+ && left.history.keepRecentTokens === right.history.keepRecentTokens
84
+ && left.history.minReclaim === right.history.minReclaim
85
+ && left.tailTrim.enabled === right.tailTrim.enabled
86
+ && left.tailTrim.trigger === right.tailTrim.trigger
87
+ }
88
+
89
+ export function apply(ctx: ClientContext): void {
90
+ ctx.locale.register(NS, { zh, en })
91
+ // Section label translator, captured EAGERLY: the settings shell evaluates
92
+ // `label()` during its own render; a lazy ctx.locale accessor inside the
93
+ // thunk would throw there if `locale` ever left this module's inject list
94
+ // (the search-index 0.5.3 family-tab incident). bind() returns a live
95
+ // binder, so locale switches are still followed.
96
+ const localeSvc = ctx.locale as { bind?: (n: string) => (key: string) => string } | undefined
97
+ const tNav = localeSvc?.bind?.(NS) ?? ((key: string) => key)
98
+ const injected = (): CompressionSelectorInjected => {
99
+ // 0.1.7: the compression document rides the selector row's entry config as
100
+ // the volatile `settings` field. The form handle is fetched per factory
101
+ // call on the caller's fiber (same activation rule as the old bind); the
102
+ // wrapper below decodes the stored doc and converts per-field writes into
103
+ // whole-doc commits (a volatile object replaces as one snapshot).
104
+ const form = ctx.configForms.get<Record<string, unknown>>(ENTRY_ID)
105
+ const readDoc = (): ContextCompressionSettings | undefined =>
106
+ decodeSettings(form.getSnapshot().value?.settings)
107
+ // useSyncExternalStore requires a getSnapshot that returns a STABLE
108
+ // reference between changes — a fresh object per call is React error #185
109
+ // (maximum update depth exceeded). Cache the projection keyed on the form
110
+ // snapshot's identity: ConfigFormSnapshot is documented stable until the
111
+ // next accepted change.
112
+ let projectedSource: object | undefined
113
+ let projected: ScopeSnapshot<ContextCompressionSettings> = {
114
+ status: 'loading', value: undefined, revision: undefined,
115
+ writable: false, base: undefined, user: undefined, mode: 'host',
116
+ }
117
+ const scope: SettingsScope<ContextCompressionSettings> = {
118
+ getSnapshot() {
119
+ const snap = form.getSnapshot()
120
+ if (snap !== projectedSource) {
121
+ projectedSource = snap
122
+ projected = {
123
+ status: snap.status,
124
+ value: decodeSettings(snap.value?.settings),
125
+ revision: snap.revision,
126
+ writable: snap.writable,
127
+ base: snap.base,
128
+ user: snap.user,
129
+ mode: snap.mode,
130
+ }
131
+ }
132
+ return projected
133
+ },
134
+ subscribe: (listener) => form.subscribe(listener),
135
+ set: async (field, value) => {
136
+ const next = { ...(readDoc() ?? {}) } as Record<string, unknown>
137
+ next[field] = value
138
+ return form.set('settings', next)
139
+ },
140
+ unset: async (field) => {
141
+ const next = { ...(readDoc() ?? {}) } as Record<string, unknown>
142
+ delete next[field]
143
+ return form.set('settings', next)
144
+ },
145
+ mutate: async (ops) => {
146
+ const doc = { ...(readDoc() ?? {}) } as Record<string, unknown>
147
+ for (const op of ops) {
148
+ const [head, key] = op.path as [string, string]
149
+ if (head !== 'presetOptions') return false
150
+ const section = { ...((doc.presetOptions ?? {}) as Record<string, unknown>) }
151
+ if (op.op === 'unset') delete section[key]
152
+ else section[key] = (op as { value?: unknown }).value
153
+ doc.presetOptions = section
154
+ }
155
+ return form.set('settings', doc)
156
+ },
157
+ }
158
+ const writeAndConfirm = async (
159
+ write: () => Promise<unknown>,
160
+ accepts: (settings: ContextCompressionSettings) => boolean,
161
+ ): Promise<void> => {
162
+ const beforeRevision = scope.getSnapshot().revision
163
+ await write()
164
+ const after = scope.getSnapshot()
165
+ if (
166
+ after.status !== 'ready'
167
+ || after.value === undefined
168
+ || after.revision === beforeRevision
169
+ || !accepts(after.value)
170
+ ) {
171
+ throw new Error('Context compression settings were not saved.')
172
+ }
173
+ }
174
+ return {
175
+ hooks: { compression: scope },
176
+ select: profile => writeAndConfirm(
177
+ () => scope.set('profile', profile),
178
+ settings => settings.profile === profile,
179
+ ),
180
+ saveCustom: custom => writeAndConfirm(
181
+ () => scope.set('custom', custom),
182
+ settings => isCustomCompressionPolicy(settings.custom)
183
+ && sameCustomPolicy(settings.custom, custom),
184
+ ),
185
+ resetCustom: () => writeAndConfirm(
186
+ () => scope.set('custom', structuredClone(DEFAULT_CUSTOM_COMPRESSION_POLICY)),
187
+ settings => isCustomCompressionPolicy(settings.custom)
188
+ && sameCustomPolicy(settings.custom, DEFAULT_CUSTOM_COMPRESSION_POLICY),
189
+ ),
190
+ saveAutoCompact: thresholdPercent => writeAndConfirm(
191
+ () => scope.set('autoCompact', { thresholdPercent }),
192
+ settings => settings.autoCompact.thresholdPercent === thresholdPercent,
193
+ ),
194
+ saveCodeSkeleton: enabled => writeAndConfirm(
195
+ () => scope.set('codeSkeleton', { enabled }),
196
+ settings => settings.codeSkeleton.enabled === enabled,
197
+ ),
198
+ savePresetOptions: options => {
199
+ // Path-addressed so one field write cannot delete its siblings: the
200
+ // previous whole-section set erased estimatorMode (and every other
201
+ // override) whenever the user touched a second field.
202
+ const ops = planPresetOptionsOps(scope.getSnapshot().value?.presetOptions, options)
203
+ if (ops.length === 0) return Promise.resolve()
204
+ return writeAndConfirm(
205
+ () => scope.mutate?.(ops) ?? Promise.resolve(false),
206
+ settings => presetOptionsOpsAccepted(settings.presetOptions, ops),
207
+ )
208
+ },
209
+ }
210
+ }
211
+ // 设置 → 上下文压缩 直挂分节(0.1.1 契约;0.1.5 官方分节也注册在此,未声明槽
212
+ // 的注册会在激活期抛错,故 try/catch 守卫 —— 同 dsh-prime-memory 的双槽冗余)。
213
+ // 只挂这一处:再注册 `settings.plugins.tab` / `settings.plugin.item` 会在
214
+ // 设置里同时出现独立分节和插件卡片,重复展示同一张面板。
215
+ try {
216
+ ctx.slots.inject('settings.section', () => ctx.slots.register({
217
+ name: 'settings.section',
218
+ id: 'context-compression',
219
+ order: 17,
220
+ label: () => tNav('nav'),
221
+ locale: NS,
222
+ inject: injected,
223
+ }, ContextCompressionSettingsSection))
224
+ } catch (error) {
225
+ console.warn('[dsh-context-compression-improved] settings.section 注册失败(新宿主已收编):', error)
226
+ }
227
+ }
228
+
229
+ export type {
230
+ CompressionProfile, CompressionProfileSelectorProps, CompressionSelectorInjected,
231
+ ContextCompressionSettings,
232
+ } from './CompressionProfileSelector.tsx'
@@ -1,21 +1,24 @@
1
- /**
2
- * 0.1.7-rc.2 stopped exporting `SettingsScope` from
3
- * `@deepseek-ai/dsh-client-ui-settings/client`; the structural face the
4
- * selector consumes lives here instead (getSnapshot shape mirrors the 0.1.7
5
- * `ConfigFormSnapshot` minus the parts the components never read).
6
- */
7
- export interface SettingsScope<T> {
8
- getSnapshot(): {
9
- status: 'loading' | 'ready' | 'unavailable'
10
- value: T | undefined
11
- revision: number | undefined
12
- writable: boolean
13
- base: unknown
14
- user: unknown
15
- mode: 'host' | 'memory'
16
- }
17
- subscribe(listener: () => void): () => void
18
- set(field: string, value: unknown): Promise<boolean>
19
- unset(field: string): Promise<boolean>
20
- mutate?(ops: readonly { path: readonly string[]; op: string; value?: unknown }[]): Promise<boolean>
21
- }
1
+ /**
2
+ * 0.1.7-rc.2 stopped exporting `SettingsScope` from
3
+ * `@deepseek-ai/dsh-client-ui-settings/client`; the structural face the
4
+ * selector consumes lives here instead (getSnapshot shape mirrors the 0.1.7
5
+ * `ConfigFormSnapshot` minus the parts the components never read).
6
+ */
7
+ /** The projected snapshot shape (identity-stable between changes — React #185). */
8
+ export interface ScopeSnapshot<T> {
9
+ status: 'loading' | 'ready' | 'unavailable'
10
+ value: T | undefined
11
+ revision: number | undefined
12
+ writable: boolean
13
+ base: unknown
14
+ user: unknown
15
+ mode: 'host' | 'memory'
16
+ }
17
+
18
+ export interface SettingsScope<T> {
19
+ getSnapshot(): ScopeSnapshot<T>
20
+ subscribe(listener: () => void): () => void
21
+ set(field: string, value: unknown): Promise<boolean>
22
+ unset(field: string): Promise<boolean>
23
+ mutate?(ops: readonly { path: readonly string[]; op: string; value?: unknown }[]): Promise<boolean>
24
+ }
@@ -1,6 +1,6 @@
1
1
  import { describe, expect, it, vi } from 'vitest'
2
2
  import type { Context as ClientContext } from '@deepseek-ai/cordis'
3
- import type { SettingsScopeSnapshot } from '@deepseek-ai/dsh-client-ui-settings/client'
3
+ import type { ScopeSnapshot } from '../src/client/scope-face.ts'
4
4
  import {
5
5
  DEFAULT_CUSTOM_COMPRESSION_POLICY,
6
6
  isCustomCompressionPolicy,
@@ -89,7 +89,7 @@ describe('context compression browser contract', () => {
89
89
  autoCompact: { thresholdPercent: 80 },
90
90
  codeSkeleton: { enabled: false },
91
91
  }
92
- const snapshot = (): SettingsScopeSnapshot<ContextCompressionSettings> => ({
92
+ const snapshot = (): ScopeSnapshot<ContextCompressionSettings> => ({
93
93
  status: 'ready',
94
94
  value,
95
95
  base: undefined,
@@ -16,6 +16,7 @@ import { describe, expect, it, vi } from 'vitest'
16
16
  import type { Context as ClientContext } from '@deepseek-ai/cordis'
17
17
  import { apply, inject } from '../src/client/index.ts'
18
18
  import { ContextCompressionSettingsSection } from '../src/client/CompressionProfileSelector.tsx'
19
+ import { DEFAULT_CUSTOM_COMPRESSION_POLICY } from '../src/profiles.ts'
19
20
 
20
21
  vi.mock('@deepseek-ai/dsh-client-ui-primitives', () => ({
21
22
  IconChevronDownOutlineMedium: () => null,
@@ -99,6 +100,52 @@ describe('settings-seat contract (standalone settings.section only)', () => {
99
100
  expect(declared).not.toContain('settings.plugin.item')
100
101
  })
101
102
 
103
+ it('projects an identity-stable snapshot between form changes (React #185 regression)', () => {
104
+ // The 0.1.7 adapter wraps configForms into the legacy scope shape. Its
105
+ // getSnapshot MUST return the same object reference until the underlying
106
+ // form snapshot changes: a fresh literal per call re-renders
107
+ // useSyncExternalStore forever — "Minified React error #185" (maximum
108
+ // update depth exceeded), and the slot boundary abdicates the whole
109
+ // settings.section on the production host.
110
+ let source = {
111
+ status: 'ready' as const,
112
+ value: { settings: { profile: 'balanced', custom: DEFAULT_CUSTOM_COMPRESSION_POLICY } },
113
+ revision: 1, writable: true, base: undefined, user: undefined, mode: 'host' as const,
114
+ }
115
+ const listeners: (() => void)[] = []
116
+ const ctx = {
117
+ locale: { register: vi.fn(() => () => {}), bind: () => (key: string) => key },
118
+ configForms: { get: () => ({
119
+ getSnapshot: () => source,
120
+ subscribe: (listener: () => void) => { listeners.push(listener); return () => {} },
121
+ set: async () => true,
122
+ }) },
123
+ slots: {
124
+ inject: (_slot: string, factory: () => (() => void) | Generator<() => void>) => { void factory() },
125
+ register: (record: Record<string, unknown>) => {
126
+ registrations.push({ slot: String(record['name']), options: record, component: null })
127
+ return () => {}
128
+ },
129
+ },
130
+ }
131
+ const registrations: CapturedRegistration[] = []
132
+ apply(ctx as unknown as ClientContext)
133
+ const face = (registrations[0]!.options['inject'] as () => { hooks: { compression: { getSnapshot(): unknown; subscribe(l: () => void): () => void } } })()
134
+ const scope = face.hooks.compression
135
+
136
+ const first = scope.getSnapshot()
137
+ expect(scope.getSnapshot()).toBe(first)
138
+ // value decodes through the whole strict validator
139
+ expect(first && typeof first === 'object' && 'value' in first && (first as { value?: { profile?: string } }).value?.profile).toBe('balanced')
140
+
141
+ // Host accepts a change → NEW form snapshot object → projection recomputes
142
+ source = { ...source, revision: 2, value: { settings: { profile: 'off', custom: DEFAULT_CUSTOM_COMPRESSION_POLICY } } }
143
+ for (const listener of listeners) listener()
144
+ const second = scope.getSnapshot()
145
+ expect(second).not.toBe(first)
146
+ expect(second && typeof second === 'object' && 'value' in second && (second as { value?: { profile?: string } }).value?.profile).toBe('off')
147
+ })
148
+
102
149
  it('survives an older host that does not declare the seat, warning instead of crashing', () => {
103
150
  // Cross-version tolerance: a host without this seat rejects the
104
151
  // registration at the slot boundary. apply() must swallow that and warn —