dsh-context-compression-improved 0.6.1 → 0.6.2

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.1",
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.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,7 +1,6 @@
1
1
  import { i as PresetOptionsSettings, n as ContextCompressionSettings, r as CustomCompressionPolicy, t as CompressionProfile } from "./profiles.js";
2
2
  import { Context } from "@deepseek-ai/cordis";
3
3
  import "@deepseek-ai/dsh-settings/types";
4
- import { SettingsScope } from "@deepseek-ai/dsh-client-ui-settings/client";
5
4
  import { InjectFace, PropsLocale } from "@deepseek-ai/dsh-client-ui-slots";
6
5
  //#region src/client/preset-options.d.ts
7
6
  /** One partial edit of `presetOptions`; `undefined` clears the named field. */
@@ -107,6 +106,33 @@ declare const zh: {
107
106
  /** Locale keys that every context-compression selector dictionary must provide. */
108
107
  type ContextCompressionLocaleKey = keyof typeof zh;
109
108
  //#endregion
109
+ //#region src/client/scope-face.d.ts
110
+ /**
111
+ * 0.1.7-rc.2 stopped exporting `SettingsScope` from
112
+ * `@deepseek-ai/dsh-client-ui-settings/client`; the structural face the
113
+ * selector consumes lives here instead (getSnapshot shape mirrors the 0.1.7
114
+ * `ConfigFormSnapshot` minus the parts the components never read).
115
+ */
116
+ 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
+ };
126
+ subscribe(listener: () => void): () => void;
127
+ set(field: string, value: unknown): Promise<boolean>;
128
+ unset(field: string): Promise<boolean>;
129
+ mutate?(ops: readonly {
130
+ path: readonly string[];
131
+ op: string;
132
+ value?: unknown;
133
+ }[]): Promise<boolean>;
134
+ }
135
+ //#endregion
110
136
  //#region src/client/CompressionProfileSelector.d.ts
111
137
  interface CompressionSelectorInjected {
112
138
  hooks: {
@@ -151,27 +177,9 @@ interface SlotsService {
151
177
  declare module '@deepseek-ai/cordis' {
152
178
  interface Context {
153
179
  slots: SlotsService;
154
- configForms: ConfigFormsFace;
155
180
  }
156
181
  }
157
182
  declare const inject: string[];
158
- /** The configForms face this client consumes (structural; 0.1.7 ui-settings). */
159
- interface ConfigFormsFace {
160
- get<T>(entryId: string): {
161
- getSnapshot(): {
162
- status: 'loading' | 'ready' | 'unavailable';
163
- value: T | undefined;
164
- revision: number | undefined;
165
- writable: boolean;
166
- base: unknown;
167
- user: unknown;
168
- mode: 'host' | 'memory';
169
- };
170
- subscribe(listener: () => void): () => void;
171
- set(field: string, value: unknown): Promise<boolean>;
172
- unset(field: string): Promise<boolean>;
173
- };
174
- }
175
183
  declare function apply(ctx: Context): void;
176
184
  //#endregion
177
185
  export { type CompressionProfile, type CompressionProfileSelectorProps, type CompressionSelectorInjected, type ContextCompressionSettings, apply, inject };
@@ -1492,24 +1492,24 @@ window.__ModuleLoader__.load({
1492
1492
  set: async (field, value) => {
1493
1493
  const next = { ...readDoc() ?? {} };
1494
1494
  next[field] = value;
1495
- await form.set("settings", next);
1495
+ return form.set("settings", next);
1496
1496
  },
1497
1497
  unset: async (field) => {
1498
1498
  const next = { ...readDoc() ?? {} };
1499
1499
  delete next[field];
1500
- await form.set("settings", next);
1500
+ return form.set("settings", next);
1501
1501
  },
1502
1502
  mutate: async (ops) => {
1503
1503
  const doc = { ...readDoc() ?? {} };
1504
1504
  for (const op of ops) {
1505
1505
  const [head, key] = op.path;
1506
- if (head !== "presetOptions") return;
1506
+ if (head !== "presetOptions") return false;
1507
1507
  const section = { ...doc.presetOptions ?? {} };
1508
1508
  if (op.op === "unset") delete section[key];
1509
1509
  else section[key] = op.value;
1510
1510
  doc.presetOptions = section;
1511
1511
  }
1512
- await form.set("settings", doc);
1512
+ return form.set("settings", doc);
1513
1513
  }
1514
1514
  };
1515
1515
  const writeAndConfirm = async (write, accepts) => {
@@ -1528,7 +1528,7 @@ window.__ModuleLoader__.load({
1528
1528
  savePresetOptions: (options) => {
1529
1529
  const ops = planPresetOptionsOps(scope.getSnapshot().value?.presetOptions, options);
1530
1530
  if (ops.length === 0) return Promise.resolve();
1531
- return writeAndConfirm(() => scope.mutate(ops), (settings) => presetOptionsOpsAccepted(settings.presetOptions, ops));
1531
+ return writeAndConfirm(() => scope.mutate?.(ops) ?? Promise.resolve(false), (settings) => presetOptionsOpsAccepted(settings.presetOptions, ops));
1532
1532
  }
1533
1533
  };
1534
1534
  };
@@ -693,6 +693,13 @@ interface CompactionTokenView extends TokenMeasurement {
693
693
  declare function measureForCompaction(ctx: Context, session: Session): CompactionTokenView;
694
694
  //#endregion
695
695
  //#region src/pruner.d.ts
696
+ declare module '@deepseek-ai/dsh-llm' {
697
+ interface MessageSourceMap {
698
+ 'dsh-context-compression': {
699
+ readonly kind: 'dsh-context-compression';
700
+ };
701
+ }
702
+ }
696
703
  declare module '@deepseek-ai/cordis' {
697
704
  interface Context {
698
705
  toolResultPruner: ToolResultPruner;
@@ -407,9 +407,6 @@ function pressureCost(blocks) {
407
407
  case "tool-call":
408
408
  cost += 256 + codePointLength(block.name) + codePointLength(block.arguments);
409
409
  break;
410
- case "tool-result":
411
- cost += 256 + pressureCost(block.content);
412
- break;
413
410
  default: {
414
411
  const serialized = JSON.stringify(block);
415
412
  cost += Math.max(256, codePointLength(serialized));
@@ -481,8 +478,7 @@ function emptyResult() {
481
478
  * @returns character pressure in Unicode code points, plus rich-block costs.
482
479
  */
483
480
  function nodeCharacterPressure(content) {
484
- const only = content.length === 1 ? content[0] : void 0;
485
- return pressureCost(only?.type === "tool-result" ? only.content : content);
481
+ return pressureCost(content);
486
482
  }
487
483
  const VISION_MODEL_ID = DEEPSEEK_VISION_TOKENIZER_ARTIFACT.modelIds[0];
488
484
  /**
@@ -587,9 +583,6 @@ function countCanonicalContent(blocks, counter, subject) {
587
583
  if (!absorb(counter.countText(block.name))) return false;
588
584
  if (!absorb(counter.countText(block.arguments))) return false;
589
585
  break;
590
- case "tool-result":
591
- if (!walk(block.content)) return false;
592
- break;
593
586
  case "image":
594
587
  if (!absorb(counter.countImage(block.attachment))) return false;
595
588
  break;
@@ -688,7 +681,7 @@ function intrinsicImageDiagnostic(blocks, target) {
688
681
  paddingMinimumTokens += estimate.paddingMinimumTokens;
689
682
  paddingMaximumTokens += estimate.paddingMaximumTokens;
690
683
  seen = true;
691
- } else if (block.type === "tool-result") walk(block.content);
684
+ }
692
685
  };
693
686
  walk(blocks);
694
687
  return seen ? Object.freeze({
@@ -805,7 +798,7 @@ function installContextCompressionRetrieve(ctx, config = {}) {
805
798
  const event = sessionEvents(exec.agent.session)[seq];
806
799
  if (event?.type !== "tool/result") throw new Error(`context_compression_retrieve: event ${String(seq)} is not a tool/result in the current session`);
807
800
  const maxLines = resolveMaxLines(args.max_lines);
808
- const scan = scanBlocks(event.data.message.content[0].content, maxScanChars);
801
+ const scan = scanBlocks(event.data.message.content, maxScanChars);
809
802
  const scannedLines = splitScannedLines(scan);
810
803
  const lines = scannedLines.lines;
811
804
  const query = args.query;
@@ -814,8 +807,8 @@ function installContextCompressionRetrieve(ctx, config = {}) {
814
807
  const total = scan.complete ? String(lines.length) : `at least ${String(lines.length)}`;
815
808
  const output = `${[
816
809
  `source: ${args.ref}`,
817
- `tool_call_id: ${event.data.message.source.callId}`,
818
- `status: ${event.data.message.content[0].isError === true ? "error" : "completed"}`,
810
+ `tool_call_id: ${event.data.message.toolCallId}`,
811
+ `status: ${event.data.message.isError === true ? "error" : "completed"}`,
819
812
  `lines: ${String(selected.start)}-${String(selected.end)} of ${total}`,
820
813
  scan.complete ? "" : "note: source scan limit reached; later lines were not inspected",
821
814
  selected.partialLine === void 0 ? "" : `note: line ${String(selected.partialLine)} is a partial prefix ending at the source scan limit`,
@@ -1111,7 +1104,7 @@ function tokenizerAuditFact(route) {
1111
1104
  }
1112
1105
  /** Check whether a snapshot candidate represents an error result. */
1113
1106
  function isError(candidate) {
1114
- return candidate.event.data.message.content[0].isError === true || candidate.event.data.error !== void 0;
1107
+ return candidate.event.data.message.isError === true || candidate.event.data.error !== void 0;
1115
1108
  }
1116
1109
  /** Wrap a plan list into a HistoryPlanOutcome. */
1117
1110
  function historyOutcome(plans) {
@@ -4244,10 +4237,7 @@ var ToolResultPruner = class extends Service {
4244
4237
  lastText.text = `${lastText.text}\n\n${block}`;
4245
4238
  const replacement = createUserMessage({
4246
4239
  content,
4247
- source: {
4248
- kind: "plugin",
4249
- plugin: "dsh-context-compression-improved-runtime"
4250
- }
4240
+ source: { kind: "dsh-context-compression" }
4251
4241
  });
4252
4242
  session.append("user/message", replacement, {
4253
4243
  surfaceOp: {
@@ -4842,11 +4832,11 @@ var ToolResultPruner = class extends Service {
4842
4832
  if (event?.type !== "tool/result") continue;
4843
4833
  const shadowedHeuristicTokenCount = projectionPrices.get(seq);
4844
4834
  if (shadowedHeuristicTokenCount === void 0) throw new Error(`surface node ${String(seq)} is absent from the atomic legacy projection`);
4845
- const content = event.data.message.content[0].content;
4835
+ const content = event.data.message.content;
4846
4836
  candidates.push({
4847
4837
  seq,
4848
4838
  event,
4849
- call: calls.get(event.data.message.source.callId) ?? {
4839
+ call: calls.get(event.data.message.toolCallId) ?? {
4850
4840
  name: "unknown",
4851
4841
  arguments: "{}"
4852
4842
  },
@@ -4860,7 +4850,7 @@ var ToolResultPruner = class extends Service {
4860
4850
  planNative(candidate, session, stage, policy, view) {
4861
4851
  if (this.isRecoveryExempt(session, candidate)) return null;
4862
4852
  if (candidate.characterPressure <= charsForTokens(policy.nativeTriggerTokens)) return null;
4863
- const result = candidate.event.data.message.content[0];
4853
+ const result = candidate.event.data.message;
4864
4854
  if (onlyTextBlocks(result.content) === null) return null;
4865
4855
  const sourceSeq = rootToolResultSeq(session, candidate.seq);
4866
4856
  const marker = (startLine) => recoveryMarker(sourceRef(session, sourceSeq), "tool result middle pruned", startLine);
@@ -4887,7 +4877,7 @@ var ToolResultPruner = class extends Service {
4887
4877
  */
4888
4878
  planDedupe(candidate, session, policy, view) {
4889
4879
  if (typeof candidate.event.surfaceOp === "object") return null;
4890
- const result = candidate.event.data.message.content[0];
4880
+ const result = candidate.event.data.message;
4891
4881
  const text = flattenPlainText(result.content);
4892
4882
  if (text === void 0) return null;
4893
4883
  if (candidate.characterPressure <= charsForTokens(policy.freshTriggerTokens)) return null;
@@ -4917,7 +4907,7 @@ var ToolResultPruner = class extends Service {
4917
4907
  }
4918
4908
  planFresh(candidate, session, policy, view) {
4919
4909
  if (typeof candidate.event.surfaceOp === "object") return null;
4920
- const result = candidate.event.data.message.content[0];
4910
+ const result = candidate.event.data.message;
4921
4911
  if (candidate.characterPressure <= charsForTokens(policy.freshTriggerTokens)) return null;
4922
4912
  const sourceSeq = candidate.seq;
4923
4913
  const sourceRef$1 = sourceRef(session, sourceSeq);
@@ -4955,7 +4945,7 @@ var ToolResultPruner = class extends Service {
4955
4945
  if (isError(candidate)) return this.planErrorEvidence(candidate, session, view, stage, targetTokens, component, historyMode);
4956
4946
  const sourceSeq = rootToolResultSeq(session, candidate.seq);
4957
4947
  const sourceRef$2 = sourceRef(session, sourceSeq);
4958
- const redacted = candidate.event.data.message.content[0];
4948
+ const redacted = candidate.event.data.message;
4959
4949
  if (onlyTextBlocks(redacted.content) === null) return null;
4960
4950
  const text = [
4961
4951
  "[Tool result reduced to satisfy the completed-step aggregate budget]",
@@ -4972,7 +4962,7 @@ var ToolResultPruner = class extends Service {
4972
4962
  /** Preserve bounded diagnostic evidence whenever an all-text error is reduced. */
4973
4963
  planErrorEvidence(candidate, session, view, stage, targetTokens, component = "aggregate", historyMode) {
4974
4964
  if (!isError(candidate)) return null;
4975
- const result = candidate.event.data.message.content[0];
4965
+ const result = candidate.event.data.message;
4976
4966
  const blocks = onlyTextBlocks(result.content);
4977
4967
  if (blocks === null) return null;
4978
4968
  const text = blocks.map((block) => block.text).join("\n");
@@ -5011,7 +5001,7 @@ var ToolResultPruner = class extends Service {
5011
5001
  const protectedSeqs = this.protectedHistoryCandidateSeqs(candidates, policy);
5012
5002
  const isUnsafe = (candidate) => {
5013
5003
  if (this.isRecoveryExempt(session, candidate)) return true;
5014
- const result = candidate.event.data.message.content[0];
5004
+ const result = candidate.event.data.message;
5015
5005
  return onlyTextBlock(result.content)?.text.includes("[Old tool result content cleared from active context]") === true;
5016
5006
  };
5017
5007
  const safe = candidates.filter((candidate) => !isUnsafe(candidate));
@@ -5024,7 +5014,7 @@ var ToolResultPruner = class extends Service {
5024
5014
  const required = Math.max(minReclaimChars, total - trigger, ...microTarget === void 0 ? [] : [charsForTokens(view.totalTokens) - microTarget]);
5025
5015
  const batchTarget = microTarget === void 0 ? minReclaimChars : required;
5026
5016
  for (const candidate of eligible) {
5027
- const result = candidate.event.data.message.content[0];
5017
+ const result = candidate.event.data.message;
5028
5018
  const block = onlyTextBlock(result.content);
5029
5019
  if (policy.presetOptions?.readState === true && block !== null) {
5030
5020
  const readPath = toolCallPath(candidate.call.arguments);
@@ -5165,7 +5155,7 @@ var ToolResultPruner = class extends Service {
5165
5155
  const results = resultSeqs.map((seq) => events[seq]);
5166
5156
  if (results.some((event) => {
5167
5157
  if (event?.type !== "tool/result" || event.data.turn !== assistant.data.turn || event.data.step !== assistant.data.step || event.data.error !== void 0) return true;
5168
- const block = event.data.message.content[0];
5158
+ const block = event.data.message;
5169
5159
  if (block.isError === true) return true;
5170
5160
  return block.content.some((contentBlock) => contentBlock.type !== "text");
5171
5161
  })) continue;
@@ -5312,7 +5302,7 @@ var ToolResultPruner = class extends Service {
5312
5302
  const tokensBefore = exact ? countBefore.tokens : charsToTokens(charsBefore);
5313
5303
  const tokensAfter = exact ? countAfter.tokens : charsToTokens(charsAfter);
5314
5304
  if (options.noNetSavingsGuard === true) {
5315
- const originalBlocks = onlyTextBlocks(candidate.event.data.message.content[0].content);
5305
+ const originalBlocks = onlyTextBlocks(candidate.event.data.message.content);
5316
5306
  const replacementBlocks = onlyTextBlocks(content);
5317
5307
  if (originalBlocks !== null && replacementBlocks !== null) {
5318
5308
  const originalChars = originalBlocks.reduce((sum, block) => sum + codePointLength(block.text), 0);
@@ -5339,13 +5329,10 @@ var ToolResultPruner = class extends Service {
5339
5329
  }
5340
5330
  land(session, plan) {
5341
5331
  const { candidate } = plan;
5342
- const result = candidate.event.data.message.content[0];
5332
+ candidate.event.data.message;
5343
5333
  const message = freezeMessage({
5344
5334
  ...candidate.event.data.message,
5345
- content: [{
5346
- ...result,
5347
- content: plan.content
5348
- }]
5335
+ content: plan.content
5349
5336
  });
5350
5337
  const manifest = session.append("compaction/prune", {
5351
5338
  shadowedRange: {