@aiwayds/dsh-dcp 0.11.0 → 0.12.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.en.md CHANGED
@@ -3,7 +3,7 @@
3
3
  Deterministic context-compaction backend for dsh (DeepSeek Harness): **context
4
4
  compaction without an LLM call**, works out of the box.
5
5
 
6
- **Requires dsh >= 0.1.5-rc.2** — this plugin targets the dsh RC/stable line only (CI and releases resolve the newest of the `latest`/`next` dist-tags at runtime). **The alpha line is no longer supported.**
6
+ **Requires dsh >= 0.1.7-rc.1** — this plugin targets the dsh RC/stable line only (CI and releases resolve the newest of the `latest`/`next` dist-tags at runtime). **The alpha line is no longer supported.**
7
7
 
8
8
  > [简体中文](README.md) · **English**
9
9
 
@@ -177,6 +177,7 @@ All optional, defaults work out of the box:
177
177
  | Key | Default | Meaning |
178
178
  |---|---|---|
179
179
  | `thresholdRatio` | 0.8 | pressure trigger (inherited upstream compaction-basic default 0.8; this plugin's bundle patch mounts 0.7, recommended for CJK-heavy sessions) |
180
+ | `headroomTokens` | 65536 | inherited from upstream compaction-basic (new in 0.1.7): extra pressure-budget margin (non-negative integer). The pressure ceiling is context window − routed output reservation (`maxTokens`) − this margin; lower it for small-window models |
180
181
  | `roundInterval` | 50 | compact every N assistant messages (one LLM roundtrip) (0 disables). Default 50: 50, 100, 150… — the clock restarts after every compaction |
181
182
  | `onModelSwitch` | `notice` | after a model switch: `notice` suggests `/dcp compact` (default); `auto` compacts at the next idle boundary; `off` disables |
182
183
  | `modelSwitchMinTokens` | 32768 | minimum priced context size (measured by the host token meter) for a model switch to be announced; `0` disables this gate. 32k default ≈ the post-compaction baseline (~16% of the window) plus some real growth |
@@ -207,7 +208,7 @@ cordis.patch.yml mount block.
207
208
  ## Development
208
209
 
209
210
  ```bash
210
- npm install && npm test # 65 tests: extractor/compaction/command/config/triggers/setup
211
+ npm install && npm test # 109 tests: extractor/compaction/command/config/triggers/recover-seam/setup
211
212
  ```
212
213
 
213
214
  ## License
package/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  dsh(DeepSeek Harness)的确定性压缩后端:**上下文压缩不调 LLM**,开箱即用。
4
4
 
5
- **要求 dsh >= 0.1.5-rc.2** — 本插件只跟随 dsh RC/stable 线(CI 与发版在运行时解析 latest/next 中更新的 dist-tag)。**不再支持 alpha 线。**
5
+ **要求 dsh >= 0.1.7-rc.1** — 本插件只跟随 dsh RC/stable 线(CI 与发版在运行时解析 latest/next 中更新的 dist-tag)。**不再支持 alpha 线。**
6
6
 
7
7
  > **简体中文** · [English](README.en.md)
8
8
 
@@ -144,6 +144,7 @@ npx dsh-dcp-setup --remove /path/to/cordis.patch.yml
144
144
  | 键 | 默认 | 说明 |
145
145
  |---|---|---|
146
146
  | `thresholdRatio` | 0.8 | 压力触发阈值(继承上游 compaction-basic 默认 0.8;本插件 bundle patch 挂载时默认 0.7,中文场景建议 0.7) |
147
+ | `headroomTokens` | 65536 | 继承上游 compaction-basic(0.1.7 新增):压力预算额外余量(非负整数)。压力上限 = 上下文窗口 − 路由请求预留输出(`maxTokens`)− 本余量;小窗口模型建议下调 |
147
148
  | `roundInterval` | 50 | 每 N 条 assistant message(一次 LLM 往返)触发一次压缩(0 关闭)。默认 50:50、100、150……每次压缩后重数 |
148
149
  | `onModelSwitch` | `notice` | 模型切换后:`notice` 提醒执行 `/dcp compact`(默认);`auto` 下一个空闲点自动压缩;`off` 关闭 |
149
150
  | `modelSwitchMinTokens` | 32768 | 模型切换提醒/自动压缩的上下文下限(按宿主 tokenMeter 实测计价):不足则忽略该次切换;`0` 关闭此门。默认 32k ≈ 压缩后基线(~16% 窗口)之上再涨一截才有得甩 |
@@ -169,7 +170,7 @@ npx dsh-dcp-setup --remove /path/to/cordis.patch.yml
169
170
  ## 开发
170
171
 
171
172
  ```bash
172
- npm install && npm test # 65 个用例:抽取/压缩/命令/配置/触发/安装脚本
173
+ npm install && npm test # 109 个用例:抽取/压缩/命令/配置/触发/恢复缝/安装脚本
173
174
  ```
174
175
 
175
176
  ## License
package/icon.svg ADDED
@@ -0,0 +1,5 @@
1
+ <svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg">
2
+ <path d="M5 5.5h14M8 12h8M5 18.5h14"/>
3
+ <path d="m10.4 1.8 1.6 1.6 1.6-1.6"/>
4
+ <path d="m10.4 22.2 1.6-1.6 1.6 1.6"/>
5
+ </svg>
package/lib/config.js CHANGED
@@ -25,6 +25,7 @@ export const DCP_CONFIG_KEYS = [
25
25
  /** compaction-basic policy keys forwarded to the parent engine verbatim. */
26
26
  export const BASIC_CONFIG_KEYS = [
27
27
  'thresholdRatio',
28
+ 'headroomTokens',
28
29
  'retainRatio',
29
30
  'retainTokens',
30
31
  'summarizationProvider',
package/lib/index.js CHANGED
@@ -96,6 +96,7 @@ const modelPolicy = z.object({
96
96
  provider: z.string().required(),
97
97
  model: z.string().required(),
98
98
  thresholdRatio: z.number(),
99
+ headroomTokens: z.number().step(1).min(0),
99
100
  retainRatio: z.number(),
100
101
  retainTokens: z.number().step(1).min(0),
101
102
  summarizationProvider: z.string(),
@@ -111,6 +112,7 @@ export class DcpEngine extends BasicCompactionEngine {
111
112
  static Config = z.object({
112
113
  // compaction-basic policy keys (forwarded verbatim)
113
114
  thresholdRatio: z.number(),
115
+ headroomTokens: z.number().step(1).min(0),
114
116
  retainRatio: z.number(),
115
117
  retainTokens: z.number().step(1).min(0),
116
118
  summarizationProvider: z.string(),
@@ -371,7 +373,9 @@ export class DcpEngine extends BasicCompactionEngine {
371
373
  try {
372
374
  session.append('user/message', createUserMessage({
373
375
  content: [{ type: 'text', text: summary }],
374
- source: { kind: 'plugin', plugin: 'dsh-dcp', form: 'notice', summary },
376
+ // Producer-owned kind (dsh 0.1.7 removed the 'plugin' catch-all);
377
+ // declared for checkJs in lib/sources.d.ts.
378
+ source: { kind: 'dsh-dcp', form: 'notice', summary },
375
379
  }))
376
380
  } catch (error) {
377
381
  const message = error instanceof Error ? error.message : String(error)
@@ -483,7 +487,9 @@ export class DcpEngine extends BasicCompactionEngine {
483
487
  try {
484
488
  session.append('user/message', createUserMessage({
485
489
  content: [{ type: 'text', text: summary }],
486
- source: { kind: 'plugin', plugin: 'dsh-dcp', form: 'notice', summary },
490
+ // Producer-owned kind (dsh 0.1.7 removed the 'plugin' catch-all);
491
+ // declared for checkJs in lib/sources.d.ts.
492
+ source: { kind: 'dsh-dcp', form: 'notice', summary },
487
493
  }))
488
494
  } catch (error) {
489
495
  // The compaction already committed; a display-row failure must never
@@ -0,0 +1,28 @@
1
+ /**
2
+ * dsh-dcp's producer-owned message source kinds.
3
+ *
4
+ * dsh 0.1.7 removed the shared `kind: 'plugin'` catch-all: MessageSourceMap is
5
+ * now merge-extensible and every producer declares its own `kind` in its own
6
+ * module (see `MessageSourceMap` in @deepseek-ai/dsh-llm/message and the
7
+ * bundled `webhook` producer for the canonical shape). Session-log V4 admission
8
+ * refuses retired `'plugin'` wrappers, so the declarations below are what lets
9
+ * dsh-dcp's transcript rows persist.
10
+ *
11
+ * Legacy rows: session-format V3→V4 migrates unknown third-party plugin names
12
+ * to `plugin:<name>` kinds, so pre-migration dsh-dcp notice rows replay as
13
+ * `plugin:dsh-dcp` — lib/summarizer.js skips both spellings.
14
+ */
15
+ declare module '@deepseek-ai/dsh-llm' {
16
+ interface MessageSourceMap {
17
+ /** dsh-dcp transcript row: a one-line compaction/model-switch account. */
18
+ 'dsh-dcp': {
19
+ readonly kind: 'dsh-dcp'
20
+ readonly form: 'notice'
21
+ /** The bounded one-line account, via `boundContextSummary`. */
22
+ readonly summary: string
23
+ }
24
+ }
25
+ }
26
+
27
+ /** Module marker: keeps the block above an augmentation (merging), not an ambient module declaration (shadowing). */
28
+ export {}
package/lib/summarizer.js CHANGED
@@ -16,6 +16,8 @@
16
16
  * @module dsh-dcp/summarizer
17
17
  */
18
18
 
19
+ import { isCompactCheckpointSource } from '@deepseek-ai/dsh-compaction'
20
+
19
21
  /** Section headers shared with compaction-basic's checkpoint instruction. */
20
22
  export const SECTIONS = Object.freeze({
21
23
  intent: 'Primary Request and Intent',
@@ -101,11 +103,13 @@ export function estimateTextTokens(text, mode = 'cjk') {
101
103
  }
102
104
 
103
105
  /**
104
- * Token estimate for one message: text blocks, tool-call arguments, and
105
- * tool-result payloads (the same content the host meter prices, minus its
106
- * per-block overhead).
106
+ * Token estimate for one message: text blocks and tool-call arguments. Tool
107
+ * results are first-class role-`'tool'` messages since dsh 0.1.7 (the old
108
+ * user-role `'tool-result'` block is gone), so their text blocks price through
109
+ * the same `'text'` branch — the same content the host meter prices, minus its
110
+ * per-block overhead.
107
111
  *
108
- * @param {{ content?: Array<Record<string, any>> }} message - any message-shaped object.
112
+ * @param {{ role?: string, content?: Array<Record<string, any>> }} message - any message-shaped object.
109
113
  * @param {'cjk'|'ascii'} [mode] - pricing mode, see {@link estimateTextTokens}.
110
114
  * @returns {number} estimated tokens.
111
115
  */
@@ -114,11 +118,6 @@ export function estimateMessageTokens(message, mode = 'cjk') {
114
118
  for (const block of message?.content ?? []) {
115
119
  if (block.type === 'text') parts.push(block.text)
116
120
  else if (block.type === 'tool-call') parts.push(block.arguments)
117
- else if (block.type === 'tool-result') {
118
- for (const inner of block.content ?? []) {
119
- if (inner.type === 'text') parts.push(inner.text)
120
- }
121
- }
122
121
  }
123
122
  return estimateTextTokens(parts.join('\n'), mode)
124
123
  }
@@ -191,15 +190,19 @@ function textOf(message) {
191
190
 
192
191
  /**
193
192
  * Re-injected host context that appears as user-role messages every turn:
194
- * system-prompt snapshots, skill catalogs, and AGENTS.md-style instructions.
195
- * The host re-sends these on every request, so copying them into a checkpoint
196
- * is pure waste — the model never loses them. (A prior compaction checkpoint
197
- * is handled separately, and plugin notice/relay/recall forms stay.)
193
+ * skill catalogs, AGENTS.md-style instructions, and any producer's `snapshot`-
194
+ * form state (runtime context, time, tmux — dsh 0.1.7 has no shared `plugin`
195
+ * kind, so the snapshot form is matched generically). The host re-sends these
196
+ * on every request and a later snapshot supersedes an earlier one, so copying
197
+ * them into a checkpoint is pure waste — the model never loses them. (A prior
198
+ * compaction checkpoint is handled separately, and notice/relay/recall forms
199
+ * stay.)
198
200
  */
199
201
  function isInjectedContext(message) {
200
- const kind = message.source?.kind
202
+ const source = message.source
203
+ const kind = source?.kind
201
204
  if (kind === 'skill-catalog' || kind === 'agent-instructions') return true
202
- return kind === 'plugin' && message.source.form === 'snapshot'
205
+ return source?.form === 'snapshot'
203
206
  }
204
207
 
205
208
  /**
@@ -215,21 +218,17 @@ function noticeSummary(message) {
215
218
  return undefined
216
219
  }
217
220
 
218
- /** Tool-result blocks flattened as text, first non-empty line kept per block. */
219
- function resultFirstLines(blocks) {
220
- const lines = []
221
- for (const block of blocks) {
222
- if (block.type !== 'tool-result') continue
223
- const text = block.content
224
- .filter((inner) => inner.type === 'text')
225
- .map((inner) => inner.text)
226
- .join('\n')
221
+ /** First non-empty text line of one tool-result message, or undefined. */
222
+ function resultFirstLine(message) {
223
+ for (const block of message.content) {
224
+ if (block.type !== 'text') continue
225
+ const line = block.text
227
226
  .split('\n')
228
- .map((line) => line.trim())
229
- .find((line) => line.length > 0)
230
- if (text !== undefined) lines.push({ isError: block.isError === true, line: text })
227
+ .map((part) => part.trim())
228
+ .find((part) => part.length > 0)
229
+ if (line !== undefined) return { isError: message.isError === true, line }
231
230
  }
232
- return lines
231
+ return undefined
233
232
  }
234
233
 
235
234
  /**
@@ -376,27 +375,33 @@ export function extractFacts(messages, language = 'en') {
376
375
  continue
377
376
  }
378
377
 
379
- // user-role messages: tool results, prior checkpoints, real user text
380
- const results = resultFirstLines(message.content)
381
- if (results.length > 0) {
382
- for (const result of results) {
383
- const isError = result.isError || errorRegexes.some((pattern) => pattern.test(result.line))
384
- if (!isError) continue
385
- const call = message.source?.kind === 'tool' ? callsById.get(message.source.callId) : undefined
386
- const who = call === undefined ? 'tool' : call.name
387
- facts.errors.push(`${who}: ${result.line}`)
388
- }
378
+ // Tool results are first-class role-'tool' messages since dsh 0.1.7
379
+ // (required toolCallId, message-level isError): only their error lines
380
+ // feed the checkpoint.
381
+ if (message.role === 'tool') {
382
+ const result = resultFirstLine(message)
383
+ if (result === undefined) continue
384
+ const isError = result.isError || errorRegexes.some((pattern) => pattern.test(result.line))
385
+ if (!isError) continue
386
+ const call = callsById.get(message.toolCallId ?? message.source?.callId)
387
+ const who = call === undefined ? 'tool' : call.name
388
+ facts.errors.push(`${who}: ${result.line}`)
389
389
  continue
390
390
  }
391
+
392
+ // user-role messages: prior checkpoints, real user text, display rows
391
393
  const text = textOf(message)
392
394
  if (text.trim().length === 0) continue
393
- if (message.source?.kind === 'plugin' && message.source.plugin === 'compact') {
395
+ if (isCompactCheckpointSource(message.source)) {
394
396
  facts.carried = parseCheckpointSections(text)
395
397
  continue
396
398
  }
397
399
  // dsh-dcp's own compaction notices are transcript display rows: the model
398
400
  // learns nothing from them the checkpoint below does not already carry.
399
- if (message.source?.kind === 'plugin' && message.source.plugin === 'dsh-dcp') continue
401
+ // `plugin:dsh-dcp` is the V3→V4 session-log migration's spelling for
402
+ // pre-migration rows (cast: no type declares the legacy namespace).
403
+ const noticeKind = /** @type {string} */ (message.source?.kind)
404
+ if (noticeKind === 'dsh-dcp' || noticeKind === 'plugin:dsh-dcp') continue
400
405
  if (isInjectedContext(message)) continue
401
406
  const intentText = noticeSummary(message) ?? text
402
407
  facts.lastUserText = intentText
package/locale/en.json ADDED
@@ -0,0 +1,6 @@
1
+ {
2
+ "meta": {
3
+ "title": "dsh-dcp",
4
+ "description": "Deterministic zero-LLM context-pruning compaction backend with a /dcp command — works out of the box."
5
+ }
6
+ }
package/locale/zh.json ADDED
@@ -0,0 +1,6 @@
1
+ {
2
+ "meta": {
3
+ "title": "dsh-dcp",
4
+ "description": "确定性、零 LLM 摘要的上下文修剪压缩后端,附 /dcp 命令,开箱即用。"
5
+ }
6
+ }
package/package.json CHANGED
@@ -1,9 +1,10 @@
1
1
  {
2
2
  "name": "@aiwayds/dsh-dcp",
3
- "version": "0.11.0",
3
+ "version": "0.12.0",
4
4
  "description": "Deterministic context-pruning compaction backend for dsh (DeepSeek Harness) — zero-LLM summaries, /dcp command, works out of the box. Design references Opencode-DCP/opencode-dynamic-context-pruning.",
5
5
  "type": "module",
6
6
  "main": "lib/index.js",
7
+ "icon": "./icon.svg",
7
8
  "bin": {
8
9
  "dsh-dcp-setup": "scripts/setup.mjs"
9
10
  },
@@ -12,7 +13,8 @@
12
13
  "./summarizer": "./lib/summarizer.js",
13
14
  "./config": "./lib/config.js",
14
15
  "./setup": "./lib/setup.js",
15
- "./package.json": "./package.json"
16
+ "./package.json": "./package.json",
17
+ "./locale/*.json": "./locale/*.json"
16
18
  },
17
19
  "files": [
18
20
  "lib",
@@ -21,7 +23,9 @@
21
23
  "README.md",
22
24
  "README.en.md",
23
25
  "LICENSE",
24
- "cordis.patch.yml"
26
+ "cordis.patch.yml",
27
+ "icon.svg",
28
+ "locale/*.json"
25
29
  ],
26
30
  "scripts": {
27
31
  "test": "node --test",
@@ -53,17 +57,17 @@
53
57
  "dependencies": {},
54
58
  "peerDependencies": {
55
59
  "@deepseek-ai/cordis": "^4.0.2",
56
- "@deepseek-ai/dsh-agent": ">=0.1.5-rc.2",
57
- "@deepseek-ai/dsh-brand": ">=0.1.5-rc.2",
58
- "@deepseek-ai/dsh-commands": ">=0.1.5-rc.2",
59
- "@deepseek-ai/dsh-compaction": ">=0.1.5-rc.2",
60
- "@deepseek-ai/dsh-compaction-basic": ">=0.1.5-rc.2",
61
- "@deepseek-ai/dsh-compaction-tool-result-pruner": ">=0.1.5-rc.2",
62
- "@deepseek-ai/dsh-invariants": ">=0.1.5-rc.2",
63
- "@deepseek-ai/dsh-llm": ">=0.1.5-rc.2",
64
- "@deepseek-ai/dsh-session": ">=0.1.5-rc.2",
65
- "@deepseek-ai/dsh-skill": ">=0.1.5-rc.2",
66
- "@deepseek-ai/dsh-token-meter": ">=0.1.5-rc.2",
60
+ "@deepseek-ai/dsh-agent": ">=0.1.7-rc.1",
61
+ "@deepseek-ai/dsh-brand": ">=0.1.7-rc.1",
62
+ "@deepseek-ai/dsh-commands": ">=0.1.7-rc.1",
63
+ "@deepseek-ai/dsh-compaction": ">=0.1.7-rc.1",
64
+ "@deepseek-ai/dsh-compaction-basic": ">=0.1.7-rc.1",
65
+ "@deepseek-ai/dsh-compaction-tool-result-pruner": ">=0.1.7-rc.1",
66
+ "@deepseek-ai/dsh-invariants": ">=0.1.7-rc.1",
67
+ "@deepseek-ai/dsh-llm": ">=0.1.7-rc.1",
68
+ "@deepseek-ai/dsh-session": ">=0.1.7-rc.1",
69
+ "@deepseek-ai/dsh-skill": ">=0.1.7-rc.1",
70
+ "@deepseek-ai/dsh-token-meter": ">=0.1.7-rc.1",
67
71
  "@deepseek-ai/schemastery": "^3.18.2"
68
72
  },
69
73
  "peerDependenciesMeta": {
@@ -109,35 +113,35 @@
109
113
  },
110
114
  "devDependencies": {
111
115
  "@types/node": "^24.0.0",
112
- "@deepseek-ai/cordis": "4.0.2",
113
- "@deepseek-ai/dsh-agent": "0.1.5-rc.2",
114
- "@deepseek-ai/dsh-brand": "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-compaction-tool-result-pruner": "0.1.5-rc.2",
119
- "@deepseek-ai/dsh-invariants": "0.1.5-rc.2",
120
- "@deepseek-ai/dsh-llm": "0.1.5-rc.2",
121
- "@deepseek-ai/dsh-session": "0.1.5-rc.2",
122
- "@deepseek-ai/dsh-token-meter": "0.1.5-rc.2",
116
+ "@deepseek-ai/cordis": "4.0.4",
117
+ "@deepseek-ai/dsh-agent": "0.1.7-rc.1",
118
+ "@deepseek-ai/dsh-brand": "0.1.7-rc.1",
119
+ "@deepseek-ai/dsh-commands": "0.1.7-rc.1",
120
+ "@deepseek-ai/dsh-compaction": "0.1.7-rc.1",
121
+ "@deepseek-ai/dsh-compaction-basic": "0.1.7-rc.1",
122
+ "@deepseek-ai/dsh-compaction-tool-result-pruner": "0.1.7-rc.1",
123
+ "@deepseek-ai/dsh-invariants": "0.1.7-rc.1",
124
+ "@deepseek-ai/dsh-llm": "0.1.7-rc.1",
125
+ "@deepseek-ai/dsh-session": "0.1.7-rc.1",
126
+ "@deepseek-ai/dsh-token-meter": "0.1.7-rc.1",
123
127
  "@deepseek-ai/schemastery": "3.18.2",
124
128
  "typescript": "~5.9.0"
125
129
  },
126
130
  "overrides": {
127
- "@deepseek-ai/dsh-agent": "0.1.5-rc.2",
128
- "@deepseek-ai/dsh-brand": "0.1.5-rc.2",
129
- "@deepseek-ai/dsh-commands": "0.1.5-rc.2",
130
- "@deepseek-ai/dsh-compaction": "0.1.5-rc.2",
131
- "@deepseek-ai/dsh-compaction-tool-result-pruner": "0.1.5-rc.2",
132
- "@deepseek-ai/dsh-invariants": "0.1.5-rc.2",
133
- "@deepseek-ai/dsh-llm": "0.1.5-rc.2",
134
- "@deepseek-ai/dsh-session": "0.1.5-rc.2",
135
- "@deepseek-ai/dsh-token-meter": "0.1.5-rc.2",
136
- "@deepseek-ai/dsh-scope": "0.1.5-rc.2",
137
- "@deepseek-ai/dsh-attachment": "0.1.5-rc.2",
138
- "@deepseek-ai/dsh-session-projection": "0.1.5-rc.2",
139
- "@deepseek-ai/dsh-system-prompt": "0.1.5-rc.2",
140
- "@deepseek-ai/dsh-llm-retry": "0.1.5-rc.2"
131
+ "@deepseek-ai/dsh-agent": "0.1.7-rc.1",
132
+ "@deepseek-ai/dsh-brand": "0.1.7-rc.1",
133
+ "@deepseek-ai/dsh-commands": "0.1.7-rc.1",
134
+ "@deepseek-ai/dsh-compaction": "0.1.7-rc.1",
135
+ "@deepseek-ai/dsh-compaction-tool-result-pruner": "0.1.7-rc.1",
136
+ "@deepseek-ai/dsh-invariants": "0.1.7-rc.1",
137
+ "@deepseek-ai/dsh-llm": "0.1.7-rc.1",
138
+ "@deepseek-ai/dsh-session": "0.1.7-rc.1",
139
+ "@deepseek-ai/dsh-token-meter": "0.1.7-rc.1",
140
+ "@deepseek-ai/dsh-scope": "0.1.7-rc.1",
141
+ "@deepseek-ai/dsh-attachment": "0.1.7-rc.1",
142
+ "@deepseek-ai/dsh-session-projection": "0.1.7-rc.1",
143
+ "@deepseek-ai/dsh-system-prompt": "0.1.7-rc.1",
144
+ "@deepseek-ai/dsh-llm-retry": "0.1.7-rc.1"
141
145
  },
142
146
  "dsh": {
143
147
  "bundle": {
@@ -146,11 +150,11 @@
146
150
  },
147
151
  "pnpm": {
148
152
  "overrides": {
149
- "@deepseek-ai/dsh-scope": "0.1.5-rc.2",
150
- "@deepseek-ai/dsh-attachment": "0.1.5-rc.2",
151
- "@deepseek-ai/dsh-session-projection": "0.1.5-rc.2",
152
- "@deepseek-ai/dsh-system-prompt": "0.1.5-rc.2",
153
- "@deepseek-ai/dsh-llm-retry": "0.1.5-rc.2"
153
+ "@deepseek-ai/dsh-scope": "0.1.7-rc.1",
154
+ "@deepseek-ai/dsh-attachment": "0.1.7-rc.1",
155
+ "@deepseek-ai/dsh-session-projection": "0.1.7-rc.1",
156
+ "@deepseek-ai/dsh-system-prompt": "0.1.7-rc.1",
157
+ "@deepseek-ai/dsh-llm-retry": "0.1.7-rc.1"
154
158
  }
155
159
  }
156
160
  }
@@ -79,9 +79,6 @@ function hostTokens(content) {
79
79
  return content.reduce((total, block) => {
80
80
  if (block.type === 'text') return total + Math.ceil(block.text.length / 4)
81
81
  if (block.type === 'tool-call') return total + Math.ceil(block.arguments.length / 4)
82
- if (block.type === 'tool-result') {
83
- return total + block.content.reduce((sum, inner) => sum + (inner.type === 'text' ? Math.ceil(inner.text.length / 4) : 0), 0)
84
- }
85
82
  return total
86
83
  }, 0)
87
84
  }
@@ -145,7 +142,7 @@ function checkpointMessage(summaryText, compactionId) {
145
142
  { type: 'text', text: summaryText },
146
143
  { type: 'text', text: '</compacted-summary>' },
147
144
  ],
148
- source: { kind: 'plugin', plugin: 'compact', compactionId },
145
+ source: { kind: 'compact-checkpoint', compactionId },
149
146
  }
150
147
  }
151
148