@khorsheed/dsh-file-preview 0.3.0 → 0.3.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/CHANGELOG.md CHANGED
@@ -1,12 +1,17 @@
1
1
  # 变更记录
2
2
 
3
- ## 未发布
3
+ ## 0.3.2(2026-09-27)
4
4
 
5
- - 从只读宿主包移除 `3d-artifact` 作者 skill;现在由 `@khorsheed/dsh-inline-html-render` 分发并注册。
6
- - 新增零会话 `capabilities()` Remote 握手(`protocolVersion: 1`),供客户端在宿主缺席时抑制全部 UI。
5
+ 无功能变更。随宿主 0.1.7-rc.2 基线发布波重发:全量构建+测试在 rc.2 基线通过(rc.1→rc.2 无触及本包的宿主变更,逐类清点见 [Agent Note](../../.agents/notes/implemented/architecture/2026-09-27-host-017-rc2-breaking-changes.md))。
6
+
7
+ ## 0.3.1(2026-09-26)
7
8
 
8
- ## 未发布
9
+ 适配宿主 rc.1 线并实证 0.1.5/0.1.7 双线可用(0.1.5-rc.1 全量 boot 实证,2026-09-25)。
9
10
 
11
+ - V4 一等 tool-role 双形读:读取侧同时接受 rc.1 的一等 `tool` 角色与 0.1.5 的包装形态,V3→V4 迁移存量照常展示
12
+ - 大文件读取窗口收敛:超大文件的预览读取以预览窗为界,不再整文件进内存
13
+ - typert 面双线:生成的 face 同时携带 0.1.5 要的立即求值 `schema` 与 rc.1 要的惰性 `create()` 工厂(两版 loader 各自只查自己的键);tarball 自带 zod@4 依赖,face 的裸 `import 'zod'` 不再被 profile 里提升的 zod@3 劫走(0.1.5 loader 的 `_zod` 品牌校验实证通过)
14
+ - 插件清单展示元数据(`locale/*.json`):rc.1 宿主插件页的卡面标题/描述中文化
10
15
  - 从只读宿主包移除 `3d-artifact` 作者 skill;现在由 `@khorsheed/dsh-inline-html-render` 分发并注册。
11
16
  - 新增零会话 `capabilities()` Remote 握手(`protocolVersion: 1`),供客户端在宿主缺席时抑制全部 UI。
12
17
 
package/lib/index.js CHANGED
@@ -494,8 +494,14 @@ function contentFromWriteCall(argumentsJson) {
494
494
  }
495
495
  } catch {}
496
496
  }
497
- /** Read the tool-result block's call identity and failure flag off a result message. */
497
+ /** Read the result message's call identity and failure flag. V4's first-class
498
+ * tool role puts both on the message itself; V3 wrapped them in the leading
499
+ * `tool-result` content block — read the message level first, then the block. */
498
500
  function resultCallFacts(message) {
501
+ if (typeof message.toolCallId === "string") return {
502
+ callId: message.toolCallId,
503
+ isError: message.isError === true
504
+ };
499
505
  const block = message.content[0];
500
506
  if (block?.type !== "tool-result" || typeof block.toolCallId !== "string") return void 0;
501
507
  return {
@@ -894,6 +900,10 @@ const IMAGE_MIME = {
894
900
  function hasNulByte(content) {
895
901
  return content.slice(0, 4096).includes("\0");
896
902
  }
903
+ /** Shared non-fatal UTF-8 decoder for the bounded byte-window read: invalid
904
+ * sequences become U+FFFD (a cut multi-byte character at the window edge
905
+ * included) instead of failing the read. */
906
+ const utf8Decoder = new TextDecoder();
897
907
  /** Detect a binary file from its display path extension. */
898
908
  function isBinaryPath(path) {
899
909
  const dot = path.lastIndexOf(".");
@@ -1284,7 +1294,10 @@ let FilePreviewService = (() => {
1284
1294
  }
1285
1295
  /**
1286
1296
  * Read the current content of one recorded file, resolved against the
1287
- * session cwd and capped by `maxReadBytes`.
1297
+ * session cwd and capped by `maxReadBytes`. The text read is a bounded byte
1298
+ * window (`readByteRange` of cap + 1 bytes), so an oversized file costs the
1299
+ * cap, never its full size; a known oversized stat still short-circuits to
1300
+ * `too-large` before any bytes move.
1288
1301
  * @param agent - owning live agent; its session cwd anchors relative paths.
1289
1302
  * @param path - the display path recorded by the write/edit tool call.
1290
1303
  * @param signal - cooperative cancellation from the calling UI request.
@@ -1354,17 +1367,21 @@ let FilePreviewService = (() => {
1354
1367
  ...info.size === void 0 ? {} : { size: info.size }
1355
1368
  };
1356
1369
  try {
1357
- const content = await this.fs.readText(target, signal);
1370
+ const bytes = await this.fs.readByteRange(target, {
1371
+ offset: 0,
1372
+ length: cap + 1
1373
+ }, signal);
1374
+ const truncated = bytes.length > cap;
1375
+ const content = utf8Decoder.decode(truncated ? bytes.subarray(0, cap) : bytes);
1358
1376
  if (hasNulByte(content)) return {
1359
1377
  path,
1360
1378
  kind: "binary",
1361
1379
  ...info.size === void 0 ? {} : { size: info.size }
1362
1380
  };
1363
- const truncated = content.length > cap;
1364
1381
  return {
1365
1382
  path,
1366
1383
  kind: "text",
1367
- content: truncated ? content.slice(0, cap) : content,
1384
+ content,
1368
1385
  truncated,
1369
1386
  ...html && isScriptedHtml(content) ? { htmlScripted: true } : {},
1370
1387
  ...info.size === void 0 ? {} : { size: info.size }
@@ -1,11 +1,14 @@
1
1
  /* Generated by @deepseek-ai/dsh-typert-generator from FaceModel — do not edit. */
2
2
  import { z } from 'zod'
3
3
 
4
- const _khorsheed_dsh_file_preview_filePreview_capabilities_result$schema = z.object({
4
+ let _khorsheed_dsh_file_preview_filePreview_capabilities_result$schema$value
5
+ const _khorsheed_dsh_file_preview_filePreview_capabilities_result$schema = () => (_khorsheed_dsh_file_preview_filePreview_capabilities_result$schema$value ??= z.object({
5
6
  'protocolVersion': z.literal(1),
6
- })
7
- const _khorsheed_dsh_file_preview_filePreview_list_parameter_0$schema = z.intersection(z.string(), z.unknown())
8
- const _khorsheed_dsh_file_preview_filePreview_list_result$schema = z.object({
7
+ }))
8
+ let _khorsheed_dsh_file_preview_filePreview_list_parameter_0$schema$value
9
+ const _khorsheed_dsh_file_preview_filePreview_list_parameter_0$schema = () => (_khorsheed_dsh_file_preview_filePreview_list_parameter_0$schema$value ??= z.intersection(z.string(), z.unknown()))
10
+ let _khorsheed_dsh_file_preview_filePreview_list_result$schema$value
11
+ const _khorsheed_dsh_file_preview_filePreview_list_result$schema = () => (_khorsheed_dsh_file_preview_filePreview_list_result$schema$value ??= z.object({
9
12
  'entries': z.array(z.object({
10
13
  'path': z.string().readonly(),
11
14
  'op': z.union([z.literal("read"), z.literal("write"), z.literal("edit")]).readonly(),
@@ -26,38 +29,50 @@ const _khorsheed_dsh_file_preview_filePreview_list_result$schema = z.object({
26
29
  })).readonly(),
27
30
  'asOfSeq': z.number().readonly(),
28
31
  'truncated': z.boolean().readonly(),
29
- })
30
- const _khorsheed_dsh_file_preview_filePreview_openExternal_parameter_0$schema = z.intersection(z.string(), z.unknown())
31
- const _khorsheed_dsh_file_preview_filePreview_openExternal_parameter_1$schema = z.string()
32
- const _khorsheed_dsh_file_preview_filePreview_openExternal_parameter_2$schema = z.string()
33
- const _khorsheed_dsh_file_preview_filePreview_openExternal_result$schema = z.union([z.object({
32
+ }))
33
+ let _khorsheed_dsh_file_preview_filePreview_openExternal_parameter_0$schema$value
34
+ const _khorsheed_dsh_file_preview_filePreview_openExternal_parameter_0$schema = () => (_khorsheed_dsh_file_preview_filePreview_openExternal_parameter_0$schema$value ??= z.intersection(z.string(), z.unknown()))
35
+ let _khorsheed_dsh_file_preview_filePreview_openExternal_parameter_1$schema$value
36
+ const _khorsheed_dsh_file_preview_filePreview_openExternal_parameter_1$schema = () => (_khorsheed_dsh_file_preview_filePreview_openExternal_parameter_1$schema$value ??= z.string())
37
+ let _khorsheed_dsh_file_preview_filePreview_openExternal_parameter_2$schema$value
38
+ const _khorsheed_dsh_file_preview_filePreview_openExternal_parameter_2$schema = () => (_khorsheed_dsh_file_preview_filePreview_openExternal_parameter_2$schema$value ??= z.string())
39
+ let _khorsheed_dsh_file_preview_filePreview_openExternal_result$schema$value
40
+ const _khorsheed_dsh_file_preview_filePreview_openExternal_result$schema = () => (_khorsheed_dsh_file_preview_filePreview_openExternal_result$schema$value ??= z.union([z.object({
34
41
  'opened': z.literal(true).readonly(),
35
42
  }), z.object({
36
43
  'opened': z.literal(false).readonly(),
37
44
  'reason': z.union([z.literal("missing"), z.literal("unknown-app"), z.literal("unsupported-platform"), z.literal("launch-failed")]).readonly(),
38
- })])
39
- const _khorsheed_dsh_file_preview_filePreview_read_parameter_0$schema = z.intersection(z.string(), z.unknown())
40
- const _khorsheed_dsh_file_preview_filePreview_read_parameter_1$schema = z.string()
41
- const _khorsheed_dsh_file_preview_filePreview_read_result$schema = z.object({
45
+ })]))
46
+ let _khorsheed_dsh_file_preview_filePreview_read_parameter_0$schema$value
47
+ const _khorsheed_dsh_file_preview_filePreview_read_parameter_0$schema = () => (_khorsheed_dsh_file_preview_filePreview_read_parameter_0$schema$value ??= z.intersection(z.string(), z.unknown()))
48
+ let _khorsheed_dsh_file_preview_filePreview_read_parameter_1$schema$value
49
+ const _khorsheed_dsh_file_preview_filePreview_read_parameter_1$schema = () => (_khorsheed_dsh_file_preview_filePreview_read_parameter_1$schema$value ??= z.string())
50
+ let _khorsheed_dsh_file_preview_filePreview_read_result$schema$value
51
+ const _khorsheed_dsh_file_preview_filePreview_read_result$schema = () => (_khorsheed_dsh_file_preview_filePreview_read_result$schema$value ??= z.object({
42
52
  'path': z.string().readonly(),
43
- 'kind': z.union([z.literal("missing"), z.literal("error"), z.literal("text"), z.literal("image"), z.literal("binary"), z.literal("too-large")]).readonly(),
53
+ 'kind': z.union([z.literal("missing"), z.literal("too-large"), z.literal("error"), z.literal("text"), z.literal("binary"), z.literal("image")]).readonly(),
44
54
  'content': z.string().readonly().optional(),
45
55
  'url': z.string().readonly().optional(),
46
56
  'truncated': z.boolean().readonly().optional(),
47
57
  'htmlScripted': z.boolean().readonly().optional(),
48
58
  'size': z.number().readonly().optional(),
49
59
  'message': z.string().readonly().optional(),
50
- })
51
- const _khorsheed_dsh_file_preview_filePreview_reveal_parameter_0$schema = z.intersection(z.string(), z.unknown())
52
- const _khorsheed_dsh_file_preview_filePreview_reveal_parameter_1$schema = z.string()
53
- const _khorsheed_dsh_file_preview_filePreview_reveal_result$schema = z.union([z.object({
60
+ }))
61
+ let _khorsheed_dsh_file_preview_filePreview_reveal_parameter_0$schema$value
62
+ const _khorsheed_dsh_file_preview_filePreview_reveal_parameter_0$schema = () => (_khorsheed_dsh_file_preview_filePreview_reveal_parameter_0$schema$value ??= z.intersection(z.string(), z.unknown()))
63
+ let _khorsheed_dsh_file_preview_filePreview_reveal_parameter_1$schema$value
64
+ const _khorsheed_dsh_file_preview_filePreview_reveal_parameter_1$schema = () => (_khorsheed_dsh_file_preview_filePreview_reveal_parameter_1$schema$value ??= z.string())
65
+ let _khorsheed_dsh_file_preview_filePreview_reveal_result$schema$value
66
+ const _khorsheed_dsh_file_preview_filePreview_reveal_result$schema = () => (_khorsheed_dsh_file_preview_filePreview_reveal_result$schema$value ??= z.union([z.object({
54
67
  'revealed': z.literal(true).readonly(),
55
68
  }), z.object({
56
69
  'revealed': z.literal(false).readonly(),
57
70
  'reason': z.union([z.literal("missing"), z.literal("select-failed")]).readonly(),
58
- })])
59
- const _khorsheed_dsh_file_preview_filePreview_turnFiles_parameter_0$schema = z.intersection(z.string(), z.unknown())
60
- const _khorsheed_dsh_file_preview_filePreview_turnFiles_result$schema = z.object({
71
+ })]))
72
+ let _khorsheed_dsh_file_preview_filePreview_turnFiles_parameter_0$schema$value
73
+ const _khorsheed_dsh_file_preview_filePreview_turnFiles_parameter_0$schema = () => (_khorsheed_dsh_file_preview_filePreview_turnFiles_parameter_0$schema$value ??= z.intersection(z.string(), z.unknown()))
74
+ let _khorsheed_dsh_file_preview_filePreview_turnFiles_result$schema$value
75
+ const _khorsheed_dsh_file_preview_filePreview_turnFiles_result$schema = () => (_khorsheed_dsh_file_preview_filePreview_turnFiles_result$schema$value ??= z.object({
61
76
  'turns': z.array(z.object({
62
77
  'turn': z.number().readonly(),
63
78
  'files': z.array(z.object({
@@ -69,7 +84,7 @@ const _khorsheed_dsh_file_preview_filePreview_turnFiles_result$schema = z.object
69
84
  })).readonly(),
70
85
  })).readonly(),
71
86
  'asOfSeq': z.number().readonly(),
72
- })
87
+ }))
73
88
 
74
89
  export const TYPERT = {
75
90
  package: '@khorsheed/dsh-file-preview',
@@ -88,9 +103,10 @@ export const TYPERT = {
88
103
  result: {
89
104
  mode: 'strict',
90
105
  typeSymbol: '@khorsheed/dsh-file-preview#filePreview/capabilities:result',
91
- schema: _khorsheed_dsh_file_preview_filePreview_capabilities_result$schema,
106
+ create: _khorsheed_dsh_file_preview_filePreview_capabilities_result$schema,
107
+ schema: _khorsheed_dsh_file_preview_filePreview_capabilities_result$schema(),
92
108
  },
93
- sourceLocation: {"file":"packages/file-preview/src/index.ts","line":191,"column":3},
109
+ sourceLocation: {"file":"packages/file-preview/src/index.ts","line":196,"column":3},
94
110
  },
95
111
  {
96
112
  id: '@khorsheed/dsh-file-preview#filePreview/list',
@@ -111,16 +127,18 @@ export const TYPERT = {
111
127
  codec: {
112
128
  mode: 'strict',
113
129
  typeSymbol: '@deepseek-ai/dsh-session/types#SessionId',
114
- schema: _khorsheed_dsh_file_preview_filePreview_list_parameter_0$schema,
130
+ create: _khorsheed_dsh_file_preview_filePreview_list_parameter_0$schema,
131
+ schema: _khorsheed_dsh_file_preview_filePreview_list_parameter_0$schema(),
115
132
  },
116
133
  },
117
134
  ],
118
135
  result: {
119
136
  mode: 'strict',
120
137
  typeSymbol: '@khorsheed/dsh-file-preview/types#FilePreviewList',
121
- schema: _khorsheed_dsh_file_preview_filePreview_list_result$schema,
138
+ create: _khorsheed_dsh_file_preview_filePreview_list_result$schema,
139
+ schema: _khorsheed_dsh_file_preview_filePreview_list_result$schema(),
122
140
  },
123
- sourceLocation: {"file":"packages/file-preview/src/index.ts","line":311,"column":9},
141
+ sourceLocation: {"file":"packages/file-preview/src/index.ts","line":316,"column":9},
124
142
  },
125
143
  {
126
144
  id: '@khorsheed/dsh-file-preview#filePreview/openExternal',
@@ -141,7 +159,8 @@ export const TYPERT = {
141
159
  codec: {
142
160
  mode: 'strict',
143
161
  typeSymbol: '@deepseek-ai/dsh-session/types#SessionId',
144
- schema: _khorsheed_dsh_file_preview_filePreview_openExternal_parameter_0$schema,
162
+ create: _khorsheed_dsh_file_preview_filePreview_openExternal_parameter_0$schema,
163
+ schema: _khorsheed_dsh_file_preview_filePreview_openExternal_parameter_0$schema(),
145
164
  },
146
165
  },
147
166
  {
@@ -151,7 +170,8 @@ export const TYPERT = {
151
170
  codec: {
152
171
  mode: 'strict',
153
172
  typeSymbol: '@khorsheed/dsh-file-preview#filePreview/openExternal:path',
154
- schema: _khorsheed_dsh_file_preview_filePreview_openExternal_parameter_1$schema,
173
+ create: _khorsheed_dsh_file_preview_filePreview_openExternal_parameter_1$schema,
174
+ schema: _khorsheed_dsh_file_preview_filePreview_openExternal_parameter_1$schema(),
155
175
  },
156
176
  },
157
177
  {
@@ -161,7 +181,8 @@ export const TYPERT = {
161
181
  codec: {
162
182
  mode: 'strict',
163
183
  typeSymbol: '@khorsheed/dsh-file-preview#filePreview/openExternal:app',
164
- schema: _khorsheed_dsh_file_preview_filePreview_openExternal_parameter_2$schema,
184
+ create: _khorsheed_dsh_file_preview_filePreview_openExternal_parameter_2$schema,
185
+ schema: _khorsheed_dsh_file_preview_filePreview_openExternal_parameter_2$schema(),
165
186
  },
166
187
  },
167
188
  ],
@@ -169,9 +190,10 @@ export const TYPERT = {
169
190
  result: {
170
191
  mode: 'strict',
171
192
  typeSymbol: '@khorsheed/dsh-file-preview/types#FilePreviewOpenExternal',
172
- schema: _khorsheed_dsh_file_preview_filePreview_openExternal_result$schema,
193
+ create: _khorsheed_dsh_file_preview_filePreview_openExternal_result$schema,
194
+ schema: _khorsheed_dsh_file_preview_filePreview_openExternal_result$schema(),
173
195
  },
174
- sourceLocation: {"file":"packages/file-preview/src/index.ts","line":528,"column":9},
196
+ sourceLocation: {"file":"packages/file-preview/src/index.ts","line":539,"column":9},
175
197
  },
176
198
  {
177
199
  id: '@khorsheed/dsh-file-preview#filePreview/read',
@@ -192,7 +214,8 @@ export const TYPERT = {
192
214
  codec: {
193
215
  mode: 'strict',
194
216
  typeSymbol: '@deepseek-ai/dsh-session/types#SessionId',
195
- schema: _khorsheed_dsh_file_preview_filePreview_read_parameter_0$schema,
217
+ create: _khorsheed_dsh_file_preview_filePreview_read_parameter_0$schema,
218
+ schema: _khorsheed_dsh_file_preview_filePreview_read_parameter_0$schema(),
196
219
  },
197
220
  },
198
221
  {
@@ -202,7 +225,8 @@ export const TYPERT = {
202
225
  codec: {
203
226
  mode: 'strict',
204
227
  typeSymbol: '@khorsheed/dsh-file-preview#filePreview/read:path',
205
- schema: _khorsheed_dsh_file_preview_filePreview_read_parameter_1$schema,
228
+ create: _khorsheed_dsh_file_preview_filePreview_read_parameter_1$schema,
229
+ schema: _khorsheed_dsh_file_preview_filePreview_read_parameter_1$schema(),
206
230
  },
207
231
  },
208
232
  ],
@@ -210,9 +234,10 @@ export const TYPERT = {
210
234
  result: {
211
235
  mode: 'strict',
212
236
  typeSymbol: '@khorsheed/dsh-file-preview/types#FilePreviewRead',
213
- schema: _khorsheed_dsh_file_preview_filePreview_read_result$schema,
237
+ create: _khorsheed_dsh_file_preview_filePreview_read_result$schema,
238
+ schema: _khorsheed_dsh_file_preview_filePreview_read_result$schema(),
214
239
  },
215
- sourceLocation: {"file":"packages/file-preview/src/index.ts","line":401,"column":9},
240
+ sourceLocation: {"file":"packages/file-preview/src/index.ts","line":409,"column":9},
216
241
  },
217
242
  {
218
243
  id: '@khorsheed/dsh-file-preview#filePreview/reveal',
@@ -233,7 +258,8 @@ export const TYPERT = {
233
258
  codec: {
234
259
  mode: 'strict',
235
260
  typeSymbol: '@deepseek-ai/dsh-session/types#SessionId',
236
- schema: _khorsheed_dsh_file_preview_filePreview_reveal_parameter_0$schema,
261
+ create: _khorsheed_dsh_file_preview_filePreview_reveal_parameter_0$schema,
262
+ schema: _khorsheed_dsh_file_preview_filePreview_reveal_parameter_0$schema(),
237
263
  },
238
264
  },
239
265
  {
@@ -243,7 +269,8 @@ export const TYPERT = {
243
269
  codec: {
244
270
  mode: 'strict',
245
271
  typeSymbol: '@khorsheed/dsh-file-preview#filePreview/reveal:path',
246
- schema: _khorsheed_dsh_file_preview_filePreview_reveal_parameter_1$schema,
272
+ create: _khorsheed_dsh_file_preview_filePreview_reveal_parameter_1$schema,
273
+ schema: _khorsheed_dsh_file_preview_filePreview_reveal_parameter_1$schema(),
247
274
  },
248
275
  },
249
276
  ],
@@ -251,9 +278,10 @@ export const TYPERT = {
251
278
  result: {
252
279
  mode: 'strict',
253
280
  typeSymbol: '@khorsheed/dsh-file-preview/types#FilePreviewReveal',
254
- schema: _khorsheed_dsh_file_preview_filePreview_reveal_result$schema,
281
+ create: _khorsheed_dsh_file_preview_filePreview_reveal_result$schema,
282
+ schema: _khorsheed_dsh_file_preview_filePreview_reveal_result$schema(),
255
283
  },
256
- sourceLocation: {"file":"packages/file-preview/src/index.ts","line":478,"column":9},
284
+ sourceLocation: {"file":"packages/file-preview/src/index.ts","line":489,"column":9},
257
285
  },
258
286
  {
259
287
  id: '@khorsheed/dsh-file-preview#filePreview/turnFiles',
@@ -274,16 +302,18 @@ export const TYPERT = {
274
302
  codec: {
275
303
  mode: 'strict',
276
304
  typeSymbol: '@deepseek-ai/dsh-session/types#SessionId',
277
- schema: _khorsheed_dsh_file_preview_filePreview_turnFiles_parameter_0$schema,
305
+ create: _khorsheed_dsh_file_preview_filePreview_turnFiles_parameter_0$schema,
306
+ schema: _khorsheed_dsh_file_preview_filePreview_turnFiles_parameter_0$schema(),
278
307
  },
279
308
  },
280
309
  ],
281
310
  result: {
282
311
  mode: 'strict',
283
312
  typeSymbol: '@khorsheed/dsh-file-preview/types#FilePreviewTurnMap',
284
- schema: _khorsheed_dsh_file_preview_filePreview_turnFiles_result$schema,
313
+ create: _khorsheed_dsh_file_preview_filePreview_turnFiles_result$schema,
314
+ schema: _khorsheed_dsh_file_preview_filePreview_turnFiles_result$schema(),
285
315
  },
286
- sourceLocation: {"file":"packages/file-preview/src/index.ts","line":348,"column":9},
316
+ sourceLocation: {"file":"packages/file-preview/src/index.ts","line":353,"column":9},
287
317
  },
288
318
  ],
289
319
  model: {
@@ -322,7 +352,7 @@ export const TYPERT = {
322
352
  "name": "read",
323
353
  "signature": "@Remote('read') async read(agent: Agent, path: string, signal: AbortSignal): Promise<FilePreviewRead>",
324
354
  "summary": "Read the current content of one recorded file, resolved against the session cwd and capped by `maxReadBytes`.",
325
- "jsDoc": "/**\n * Read the current content of one recorded file, resolved against the\n * session cwd and capped by `maxReadBytes`.\n * @param agent - owning live agent; its session cwd anchors relative paths.\n * @param path - the display path recorded by the write/edit tool call.\n * @param signal - cooperative cancellation from the calling UI request.\n * @returns the classified read; `text` carries content, `image` carries a\n * browser URL, other kinds carry the size or a human-readable reason.\n */"
355
+ "jsDoc": "/**\n * Read the current content of one recorded file, resolved against the\n * session cwd and capped by `maxReadBytes`. The text read is a bounded byte\n * window (`readByteRange` of cap + 1 bytes), so an oversized file costs the\n * cap, never its full size; a known oversized stat still short-circuits to\n * `too-large` before any bytes move.\n * @param agent - owning live agent; its session cwd anchors relative paths.\n * @param path - the display path recorded by the write/edit tool call.\n * @param signal - cooperative cancellation from the calling UI request.\n * @returns the classified read; `text` carries content, `image` carries a\n * browser URL, other kinds carry the size or a human-readable reason.\n */"
326
356
  },
327
357
  {
328
358
  "kind": "method",
@@ -374,11 +404,11 @@ export const TYPERT = {
374
404
  },
375
405
  {
376
406
  "name": "AssistantMessage",
377
- "declaration": "export interface AssistantMessage extends Message {\n readonly role: 'assistant';\n readonly source: ModelMessageSource;\n}"
407
+ "declaration": "export interface AssistantMessage extends MessageBase {\n readonly role: 'assistant';\n readonly source: ModelMessageSource;\n}"
378
408
  },
379
409
  {
380
- "name": "AssistantProvenance",
381
- "declaration": "export interface AssistantProvenance {\n provider: string;\n model: string;\n replayState?: unknown;\n}"
410
+ "name": "AssistantProviderMetadata",
411
+ "declaration": "export interface AssistantProviderMetadata {\n provider: string;\n model: string;\n replayState?: unknown;\n}"
382
412
  },
383
413
  {
384
414
  "name": "AssistantStreamRecord",
@@ -418,7 +448,7 @@ export const TYPERT = {
418
448
  },
419
449
  {
420
450
  "name": "ContentBlockMap",
421
- "declaration": "export interface ContentBlockMap {\n text: TextBlock;\n reasoning: ReasoningBlock;\n image: ImageBlock;\n file: FileBlock;\n 'tool-call': ToolCallBlock;\n 'tool-result': ToolResultBlock;\n}"
451
+ "declaration": "export interface ContentBlockMap {\n text: TextBlock;\n reasoning: ReasoningBlock;\n image: ImageBlock;\n file: FileBlock;\n 'tool-call': ToolCallBlock;\n 'tool-addition': ToolAdditionBlock;\n 'tool-removal': ToolRemovalBlock;\n}"
422
452
  },
423
453
  {
424
454
  "name": "ContentBlockType",
@@ -436,9 +466,13 @@ export const TYPERT = {
436
466
  "name": "ContinuableSubagentDescriptorData",
437
467
  "declaration": "export interface ContinuableSubagentDescriptorData extends SubagentDescriptorBase {\n readonly mode: 'continuable';\n readonly label: string;\n readonly agentProvider?: string;\n readonly agentModel?: string;\n readonly agentReasoningEffort?: ReasoningEffortId;\n readonly persona?: string;\n readonly toolFilter?: ToolRestriction;\n}"
438
468
  },
469
+ {
470
+ "name": "DeveloperMessage",
471
+ "declaration": "export interface DeveloperMessage extends MessageBase {\n readonly role: 'developer';\n}"
472
+ },
439
473
  {
440
474
  "name": "EpochHeader",
441
- "declaration": "export interface EpochHeader {\n config: LlmCallConfig;\n adapterDefaults?: LlmCallConfigAdapterDefaults;\n tools?: ToolSchema[];\n}"
475
+ "declaration": "export interface EpochHeader {\n config: LlmCallConfig;\n adapterDefaults?: LlmCallConfigAdapterDefaults;\n tools?: ToolSchema[];\n system?: never;\n}"
442
476
  },
443
477
  {
444
478
  "name": "FileAttachmentRef",
@@ -506,12 +540,16 @@ export const TYPERT = {
506
540
  },
507
541
  {
508
542
  "name": "ImageBlock",
509
- "declaration": "export interface ImageBlock {\n type: 'image';\n attachment: ImageAttachmentRef;\n}"
543
+ "declaration": "export interface ImageBlock {\n type: 'image';\n attachment: ImageAttachmentRef;\n offloaded?: true;\n}"
510
544
  },
511
545
  {
512
546
  "name": "ImageMediaType",
513
547
  "declaration": "export type ImageMediaType = 'image/png' | 'image/jpeg' | 'image/webp' | 'image/gif';"
514
548
  },
549
+ {
550
+ "name": "ImageOffloadTarget",
551
+ "declaration": "export interface ImageOffloadTarget {\n seq: SessionSeq;\n imageIndexes: number[];\n}"
552
+ },
515
553
  {
516
554
  "name": "Inbox",
517
555
  "declaration": "export interface Inbox {\n readonly nextTurn: readonly UserMessage[];\n readonly nextStep: readonly UserMessage[];\n clear(): void;\n append(target: InboxTarget, message: UserMessage): void;\n prepend(target: InboxTarget, message: UserMessage): void;\n replace(messageId: MessageId, newMessage: UserMessage): boolean;\n remove(messageId: MessageId): boolean;\n splice(target: InboxTarget, start: number, deleteCount: number, inserted: UserMessage[]): UserMessage[];\n}"
@@ -524,6 +562,10 @@ export const TYPERT = {
524
562
  "name": "JsonValue",
525
563
  "declaration": "export type JsonValue = null | boolean | number | string | JsonValue[] | { [key: string]: JsonValue; };"
526
564
  },
565
+ {
566
+ "name": "KnownCatalogMode",
567
+ "declaration": "export type KnownCatalogMode = { readonly mode: 'one-shot'; readonly label?: string; } | { readonly mode: 'continuable'; readonly label: string; };"
568
+ },
527
569
  {
528
570
  "name": "LlmCallConfig",
529
571
  "declaration": "export interface LlmCallConfig {\n provider: string;\n model: string;\n reasoningEffort?: ReasoningEffortId;\n temperature?: number;\n maxTokens?: number;\n stop?: string[];\n}"
@@ -534,39 +576,75 @@ export const TYPERT = {
534
576
  },
535
577
  {
536
578
  "name": "LlmFailure",
537
- "declaration": "export interface LlmFailure {\n readonly message: string;\n readonly code: string;\n readonly status?: number;\n readonly providerRetryAfterMs?: number;\n readonly requestId?: ProviderRequestId;\n}"
579
+ "declaration": "export interface LlmFailure {\n readonly message: string;\n readonly code: string;\n readonly status?: number;\n readonly providerRetryAfterMs?: number;\n readonly requestId?: ProviderRequestId;\n readonly offloadImages?: number;\n}"
580
+ },
581
+ {
582
+ "name": "LocalAgentStreamCheckpoint",
583
+ "declaration": "export interface LocalAgentStreamCheckpoint extends Omit<LocalAgentStreamItem, 'revision'> {\n sessionId: string;\n opening?: boolean;\n closed?: boolean;\n append: boolean;\n}"
584
+ },
585
+ {
586
+ "name": "LocalAgentStreamItem",
587
+ "declaration": "export interface LocalAgentStreamItem {\n id: string;\n turn: number;\n step: number;\n kind: 'think' | 'text';\n text: string;\n revision: number;\n receivedAt: number;\n}"
538
588
  },
539
589
  {
540
590
  "name": "Message",
541
- "declaration": "export interface Message {\n readonly id: MessageId;\n readonly role: 'system' | 'user' | 'assistant';\n readonly content: ContentBlock[];\n readonly source: MessageSource;\n}"
591
+ "declaration": "export type Message = MessageRoleMap[keyof MessageRoleMap];"
592
+ },
593
+ {
594
+ "name": "MessageBase",
595
+ "declaration": "export interface MessageBase {\n readonly id: MessageId;\n readonly content: readonly ContentBlock[];\n readonly source: MessageSource;\n}"
542
596
  },
543
597
  {
544
598
  "name": "MessageId",
545
599
  "declaration": "export type MessageId = Branded<'MessageId'>;"
546
600
  },
601
+ {
602
+ "name": "MessageRoleMap",
603
+ "declaration": "export interface MessageRoleMap {\n system: SystemMessage;\n developer: DeveloperMessage;\n user: UserMessage;\n assistant: AssistantMessage;\n tool: ToolResultMessage;\n}"
604
+ },
547
605
  {
548
606
  "name": "MessageSource",
549
607
  "declaration": "export type MessageSource = MessageSourceMap[keyof MessageSourceMap];"
550
608
  },
551
609
  {
552
610
  "name": "MessageSourceMap",
553
- "declaration": "export interface MessageSourceMap {\n user: { kind: 'user'; };\n plugin: { kind: 'plugin'; plugin: string; } & ContextFormed;\n model: ModelMessageSource;\n tool: ToolMessageSource;\n 'agent-message': AgentMessageSource;\n 'subagent-settled': SubagentSettledMessageSource;\n}"
611
+ "declaration": "export interface MessageSourceMap {\n user: { kind: 'user'; };\n model: ModelMessageSource;\n tool: ToolMessageSource;\n 'system-prompt': SystemPromptMessageSource;\n 'model-selection': { kind: 'model-selection'; } & ContextFormed;\n 'user-approval': { kind: 'user-approval'; } & ContextFormed;\n 'ptc-mode': { kind: 'ptc-mode'; };\n 'tool-registry': { kind: 'tool-registry'; };\n 'skill-invocation': SkillInvocationSource;\n 'message-tools': { kind: 'message-tools'; readonly op?: MessageToolsOp; } & ContextFormed;\n 'agent-message': AgentMessageSource;\n 'subagent-settled': SubagentSettledMessageSource;\n room: { kind: 'room'; } & ContextFormed;\n sidechat: { kind: 'sidechat'; } & ContextFormed;\n worktrees: { kind: 'worktrees'; } & ContextFormed;\n}"
612
+ },
613
+ {
614
+ "name": "MessageToolsOp",
615
+ "declaration": "export type MessageToolsOp = 'edit' | 'edit-trigger' | 'restore-assistant';"
554
616
  },
555
617
  {
556
618
  "name": "ModelMessageSource",
557
- "declaration": "export interface ModelMessageSource extends AssistantProvenance {\n kind: 'model';\n}"
619
+ "declaration": "export interface ModelMessageSource extends AssistantProviderMetadata {\n kind: 'model';\n}"
558
620
  },
559
621
  {
560
622
  "name": "OneShotSubagentDescriptorData",
561
623
  "declaration": "export interface OneShotSubagentDescriptorData extends SubagentDescriptorBase {\n readonly mode: 'one-shot';\n readonly label?: string;\n}"
562
624
  },
625
+ {
626
+ "name": "PlanAttempt",
627
+ "declaration": "export interface PlanAttempt {\n id: string;\n deliveryId: string;\n number: number;\n status: 'queued' | 'running' | 'submitted' | 'accepted' | 'rejected' | 'failed' | 'cancelled' | 'uncertain';\n createdAt: number;\n startedAt?: number;\n settledAt?: number;\n submission?: PlanEvidence;\n review?: { decision: 'accepted' | 'rework'; by: string; reason: string; references: string[]; time: number; };\n error?: string;\n retry?: { by: string; reason: string; time: number; };\n}"
628
+ },
629
+ {
630
+ "name": "PlanBudget",
631
+ "declaration": "export interface PlanBudget {\n maxParallel: number;\n maxAttempts: number;\n maxAttemptsPerTask: number;\n maxActiveMs: number;\n}"
632
+ },
633
+ {
634
+ "name": "PlanEvidence",
635
+ "declaration": "export interface PlanEvidence {\n summary: string;\n references: string[];\n artifacts: string[];\n}"
636
+ },
637
+ {
638
+ "name": "PlanTask",
639
+ "declaration": "export interface PlanTask {\n id: string;\n title: string;\n stageId: string;\n parentId?: string;\n kind: 'group' | 'task';\n ownerMemberId?: string;\n instruction: string;\n criteria: string[];\n inputRefs: string[];\n artifactPaths: string[];\n dependsOn: string[];\n status: 'pending' | 'running' | 'submitted' | 'accepted' | 'failed' | 'cancelled';\n attempts: PlanAttempt[];\n}"
640
+ },
563
641
  {
564
642
  "name": "ProviderRequestId",
565
643
  "declaration": "export type ProviderRequestId = Branded<'ProviderRequestId'>;"
566
644
  },
567
645
  {
568
646
  "name": "PtcDispatchEventData",
569
- "declaration": "export interface PtcDispatchEventData extends PtcDispatchStartEventData {\n isError: boolean;\n content: ContentBlock[];\n}"
647
+ "declaration": "export interface PtcDispatchEventData extends PtcDispatchStartEventData {\n isError: boolean;\n content: ContentBlock[];\n error?: { name: string; code: string; reason?: string; };\n}"
570
648
  },
571
649
  {
572
650
  "name": "PtcDispatchStartEventData",
@@ -592,13 +670,21 @@ export const TYPERT = {
592
670
  "name": "RequestHeaderReason",
593
671
  "declaration": "export type RequestHeaderReason = 'initial' | 'resume' | 'change' | 'series';"
594
672
  },
673
+ {
674
+ "name": "RoomCoordinatorEvent",
675
+ "declaration": "export interface RoomCoordinatorEvent {\n readonly version: 1;\n readonly memberId: string;\n readonly revision: number;\n readonly previousMemberId: string;\n readonly handoff: string;\n}"
676
+ },
595
677
  {
596
678
  "name": "RoomCreatedEvent",
597
679
  "declaration": "export interface RoomCreatedEvent {\n readonly version: 1;\n}"
598
680
  },
681
+ {
682
+ "name": "RoomDeliveryStateEvent",
683
+ "declaration": "export interface RoomDeliveryStateEvent {\n readonly id: string;\n readonly dispatchSeq: number;\n readonly memberId: string;\n readonly state: 'running' | 'done' | 'cancelled' | 'failed' | 'uncertain';\n readonly text?: string;\n readonly error?: string;\n}"
684
+ },
599
685
  {
600
686
  "name": "RoomDispatchEvent",
601
- "declaration": "export interface RoomDispatchEvent {\n readonly targets: readonly string[];\n readonly text: string;\n}"
687
+ "declaration": "export interface RoomDispatchEvent {\n readonly plan?: { readonly goalId: string; readonly taskId?: string; readonly attemptId?: string; };\n readonly requestSignature?: string;\n readonly id?: string;\n readonly targetIds?: readonly string[];\n readonly origin?: 'human' | 'coordinator' | 'report' | 'relay';\n readonly replyTo?: string;\n readonly reportFor?: string;\n readonly targets: readonly string[];\n readonly text: string;\n}"
602
688
  },
603
689
  {
604
690
  "name": "RoomGoalEvent",
@@ -610,7 +696,7 @@ export const TYPERT = {
610
696
  },
611
697
  {
612
698
  "name": "RoomMemberAddedEvent",
613
- "declaration": "export interface RoomMemberAddedEvent {\n readonly name: string;\n readonly kind: 'main-agent' | 'cli';\n readonly provider?: string;\n readonly instructions?: string;\n readonly invitedBy: 'human' | 'agent';\n readonly cwd?: string;\n readonly model?: string;\n readonly childSessionId?: SessionId;\n}"
699
+ "declaration": "export interface RoomMemberAddedEvent {\n readonly id?: string;\n readonly name: string;\n readonly kind: 'main-agent' | 'cli';\n readonly provider?: string;\n readonly instructions?: string;\n readonly invitedBy: 'human' | 'agent';\n readonly cwd?: string;\n readonly model?: string;\n readonly childSessionId?: SessionId;\n}"
614
700
  },
615
701
  {
616
702
  "name": "RoomMemberRemovedEvent",
@@ -620,6 +706,10 @@ export const TYPERT = {
620
706
  "name": "RoomMemberUpdatedEvent",
621
707
  "declaration": "export interface RoomMemberUpdatedEvent {\n readonly name: string;\n readonly rename?: string;\n readonly instructions?: string | null;\n readonly cwd?: string | null;\n readonly model?: string | null;\n readonly childSessionId?: SessionId;\n}"
622
708
  },
709
+ {
710
+ "name": "RoomPlan",
711
+ "declaration": "export interface RoomPlan {\n version: 1;\n id: string;\n revision: number;\n objective: string;\n status: 'draft' | 'running' | 'paused' | 'completed' | 'cancelled';\n reason?: string;\n budget: PlanBudget;\n activeMs: number;\n resumedAt?: number;\n stages: { id: string; title: string; }[];\n tasks: PlanTask[];\n completion?: PlanEvidence;\n requests: { id: string; signature: string; }[];\n}"
712
+ },
623
713
  {
624
714
  "name": "RoomRelayEvent",
625
715
  "declaration": "export interface RoomRelayEvent {\n readonly id: string;\n readonly from: string;\n readonly to: string;\n readonly content: string;\n readonly provenance?: Record<string, RoomJsonValue>;\n}"
@@ -630,15 +720,15 @@ export const TYPERT = {
630
720
  },
631
721
  {
632
722
  "name": "RoomRunStateEvent",
633
- "declaration": "export interface RoomRunStateEvent {\n readonly member: string;\n readonly state: 'running' | 'done' | 'cancelled' | 'failed';\n readonly startedAt: number;\n readonly elapsedMs?: number;\n readonly error?: string;\n}"
723
+ "declaration": "export interface RoomRunStateEvent {\n readonly runId?: string;\n readonly member: string;\n readonly state: 'running' | 'done' | 'cancelled' | 'failed';\n readonly startedAt: number;\n readonly elapsedMs?: number;\n readonly error?: string;\n}"
634
724
  },
635
725
  {
636
726
  "name": "RoomSpeechEvent",
637
- "declaration": "export interface RoomSpeechEvent {\n readonly member: string;\n readonly text: string;\n readonly childSessionId?: SessionId;\n readonly durationMs?: number;\n}"
727
+ "declaration": "export interface RoomSpeechEvent {\n readonly interrupted?: 'cancelled' | 'failed';\n readonly member: string;\n readonly text: string;\n readonly childSessionId?: SessionId;\n readonly durationMs?: number;\n}"
638
728
  },
639
729
  {
640
730
  "name": "RoomTaskAddedEvent",
641
- "declaration": "export interface RoomTaskAddedEvent {\n readonly id: string;\n readonly member: string;\n readonly title: string;\n readonly status: 'pending' | 'in_progress';\n readonly blockedBy?: string;\n}"
731
+ "declaration": "export interface RoomTaskAddedEvent {\n readonly deliveryId?: string;\n readonly id: string;\n readonly member: string;\n readonly title: string;\n readonly status: 'pending' | 'in_progress';\n readonly blockedBy?: string;\n}"
642
732
  },
643
733
  {
644
734
  "name": "RoomTaskEditedEvent",
@@ -654,7 +744,7 @@ export const TYPERT = {
654
744
  },
655
745
  {
656
746
  "name": "Session",
657
- "declaration": "export class Session {\n get surface(): SessionSurface;\n readonly header: SessionHeader;\n readonly inheritedEventCount: SessionLogOffset;\n get id(): SessionId;\n readonly firstLiveSeq: SessionLogOffset;\n eventAt(seq: SessionSeq): SessionEvent | undefined;\n snapshotEvents(fromSeq: SessionLogOffset = SessionLogOffset(0), toSeqExclusive: SessionLogOffset = this.seq): readonly SessionEvent[];\n ownEvents(): readonly SessionEvent[];\n isOwnSeq(seq: SessionSeq): boolean;\n get seq(): SessionLogOffset;\n append<T extends SessionEventType>(type: T, data: SessionEventMap[T], ...opts: T extends SurfaceEventType ? [opts: SurfaceIntent<T>] : []): SessionEvent<T>;\n requestHeader(): EpochHeader | undefined;\n requestContext(): RequestContext | undefined;\n deriveMessages(): Message[];\n deriveEventMessage(event: SessionEvent): Message | null;\n}"
747
+ "declaration": "export class Session {\n get surface(): SessionSurface;\n readonly header: SessionHeader;\n readonly inheritedEventCount: SessionLogOffset;\n get id(): SessionId;\n readonly firstLiveSeq: SessionLogOffset;\n readonly firstLifecycleSeq: SessionLogOffset;\n eventAt(seq: SessionSeq): SessionEvent | undefined;\n snapshotEvents(fromSeq: SessionLogOffset = SessionLogOffset(0), toSeqExclusive: SessionLogOffset = this.seq): readonly SessionEvent[];\n ownEvents(): readonly SessionEvent[];\n isOwnSeq(seq: SessionSeq): boolean;\n get seq(): SessionLogOffset;\n append<T extends SessionEventType>(type: T, data: SessionEventMap[T], ...opts: T extends SurfaceEventType ? [opts: SurfaceIntent<T>] : []): SessionEvent<T>;\n requestHeader(): EpochHeader | undefined;\n requestContext(): RequestContext | undefined;\n toolHistory(): ToolHistory;\n deriveMessages(): Message[];\n deriveEventMessage(event: SessionEvent): Message | null;\n}"
658
748
  },
659
749
  {
660
750
  "name": "SessionEvent",
@@ -662,7 +752,7 @@ export const TYPERT = {
662
752
  },
663
753
  {
664
754
  "name": "SessionEventMap",
665
- "declaration": "export interface SessionEventMap {\n 'turn/start': { turn: number; };\n 'turn/end': { turn: number; reason: TurnEndReason; };\n 'step/start': { turn: number; step: number; };\n 'step/end': { turn: number; step: number; };\n 'user/message': UserMessage;\n 'system/message': { turn: number; step: number; message: SystemMessage; };\n 'assistant/message': { turn: number; step: number; message: AssistantMessage; stream: AssistantStreamRecord[]; usage?: TokenUsage; interrupted?: true; };\n 'assistant/attempt': { turn: number; step: number; stream: AssistantStreamRecord[]; };\n 'tool/call': { turn: number; step: number; callId: ToolCallId; name: string; arguments: string; };\n 'tool/result': { turn: number; step: number; message: ToolResultMessage; error?: { name: string; code: string; }; meta?: JsonValue; };\n 'request/header': { header: EpochHeader; reason: RequestHeaderReason; startsSeries?: true; };\n 'request/context': RequestContext;\n 'session/end-seed': { inherited?: true; };\n 'agent/inbox/spliced': { target: InboxTarget; start: number; removedCount?: number; inserted: UserMessage[]; outcome?: 'canceled'; };\n 'sandbox/mode': { mode: SandboxMode; source?: 'delegation'; };\n 'approval/asked': { id: ApprovalRequestId; toolName: string; callId?: ToolCallId; reason?: string; };\n 'approval/decided': { id: ApprovalRequestId; outcome: ApprovalOutcome; };\n 'approval/policy': { policy: ApprovalPolicy; source?: 'delegation'; };\n 'tool/ptc-dispatch-start': PtcDispatchStartEventData;\n 'tool/ptc-dispatch': PtcDispatchEventData;\n 'command/run': { commandId: CommandId; name: string; args?: string; source: CommandSource; };\n 'command/done': { commandId: CommandId; kind: 'success' | 'error'; text?: string; sourceEventSeq?: import('@deepseek-ai/dsh-session/types').SessionSeq; };\n 'subagent/descriptor': SubagentDescriptorData;\n 'session/title': SessionTitleEventData;\n 'todo/write': { todos: TodoItem[]; };\n 'agent-preset/selected': { agentPreset: string; };\n 'subagent/catalog': SubagentCatalogEvent;\n 'room/created': RoomCreatedEvent;\n 'room/member-added': RoomMemberAddedEvent;\n 'room/member-updated': RoomMemberUpdatedEvent;\n 'room/member-removed': RoomMemberRemovedEvent;\n 'room/dispatch': RoomDispatchEvent;\n 'room/speech': RoomSpeechEvent;\n 'room/run-state': RoomRunStateEvent;\n 'room/relay': RoomRelayEvent;\n 'room/relay-resolved': RoomRelayResolvedEvent;\n 'room/task-added': RoomTaskAddedEvent;\n 'room/task-updated': RoomTaskUpdatedEvent;\n 'room/task-edited': RoomTaskEditedEvent;\n 'room/goal': RoomGoalEvent;\n}"
755
+ "declaration": "export interface SessionEventMap {\n 'turn/start': { turn: number; };\n 'turn/end': { turn: number; reason: TurnEndReason; };\n 'step/start': { turn: number; step: number; };\n 'step/end': { turn: number; step: number; };\n 'user/message': UserMessage;\n 'developer/message': { turn: number; step: number; message: DeveloperMessage; headerSeq?: SessionSeq; };\n 'system/message': { turn: number; step: number; message: SystemMessage; };\n 'assistant/message': { turn: number; step: number; message: AssistantMessage; stream: AssistantStreamRecord[]; usage?: TokenUsage; interrupted?: true; };\n 'assistant/attempt': { turn: number; step: number; stream: AssistantStreamRecord[]; };\n 'tool/call': { turn: number; step: number; callId: ToolCallId; name: string; arguments: string; };\n 'tool/result': { turn: number; step: number; message: ToolResultMessage; error?: { name: string; code: string; reason?: string; }; meta?: JsonValue; };\n 'request/header': { header: EpochHeader; reason: RequestHeaderReason; startsSeries?: true; };\n 'request/context': RequestContext;\n 'session/end-seed': { inherited?: true; };\n 'agent/inbox/spliced': { target: InboxTarget; start: number; removedCount?: number; inserted: UserMessage[]; outcome?: 'canceled'; };\n 'sandbox/mode': { mode: SandboxMode; source?: 'delegation'; };\n 'approval/asked': { id: ApprovalRequestId; toolName: string; callId?: ToolCallId; reason?: string; };\n 'approval/decided': { id: ApprovalRequestId; outcome: ApprovalOutcome; };\n 'approval/policy': { policy: ApprovalPolicy; source?: 'delegation'; };\n 'tool/ptc-dispatch-start': PtcDispatchStartEventData;\n 'tool/ptc-dispatch': PtcDispatchEventData;\n 'agent-preset/selected': { agentPreset: string; };\n 'command/run': { commandId: CommandId; name: string; args?: string; source: CommandSource; };\n 'command/done': { commandId: CommandId; kind: 'success' | 'error'; text?: string; sourceEventSeq?: import('@deepseek-ai/dsh-session/types').SessionSeq; };\n 'subagent/descriptor': SubagentDescriptorData;\n 'image/offload': { targets: ImageOffloadTarget[]; };\n 'session/title': SessionTitleEventData;\n 'todo/write': { todos: TodoItem[]; };\n 'permission/preset': { preset: string; };\n 'subagent/catalog': SubagentCatalogEvent;\n 'local-agent/stream': LocalAgentStreamCheckpoint;\n 'room/created': RoomCreatedEvent;\n 'room/member-added': RoomMemberAddedEvent;\n 'room/member-updated': RoomMemberUpdatedEvent;\n 'room/member-removed': RoomMemberRemovedEvent;\n 'room/dispatch': RoomDispatchEvent;\n 'room/speech': RoomSpeechEvent;\n 'room/run-state': RoomRunStateEvent;\n 'room/relay': RoomRelayEvent;\n 'room/relay-resolved': RoomRelayResolvedEvent;\n 'room/task-added': RoomTaskAddedEvent;\n 'room/task-updated': RoomTaskUpdatedEvent;\n 'room/task-edited': RoomTaskEditedEvent;\n 'room/goal': RoomGoalEvent;\n 'room/plan-state': RoomPlan;\n 'room/coordinator': RoomCoordinatorEvent;\n 'room/delivery-state': RoomDeliveryStateEvent;\n}"
666
756
  },
667
757
  {
668
758
  "name": "SessionEventType",
@@ -686,15 +776,15 @@ export const TYPERT = {
686
776
  },
687
777
  {
688
778
  "name": "SessionSurface",
689
- "declaration": "export interface SessionSurface {\n readonly nodes: readonly SessionSeq[];\n readonly replaceGeneration: number;\n}"
779
+ "declaration": "export interface SessionSurface {\n readonly nodes: readonly SessionSeq[];\n readonly replaceGeneration: number;\n readonly contentGeneration: number;\n}"
690
780
  },
691
781
  {
692
782
  "name": "SessionTitleEventData",
693
783
  "declaration": "export interface SessionTitleEventData {\n readonly title: string;\n readonly messageSeqs: SessionSeq[];\n readonly source: SessionTitleSource;\n}"
694
784
  },
695
785
  {
696
- "name": "SessionTitleModelProvenance",
697
- "declaration": "export interface SessionTitleModelProvenance {\n readonly provider: string;\n readonly model: string;\n}"
786
+ "name": "SessionTitleModelIdentity",
787
+ "declaration": "export interface SessionTitleModelIdentity {\n readonly provider: string;\n readonly model: string;\n}"
698
788
  },
699
789
  {
700
790
  "name": "SessionTitleProviderId",
@@ -702,7 +792,11 @@ export const TYPERT = {
702
792
  },
703
793
  {
704
794
  "name": "SessionTitleSource",
705
- "declaration": "export type SessionTitleSource = { readonly kind: 'fallback'; } | { readonly kind: 'provider'; readonly provider: SessionTitleProviderId; readonly model?: SessionTitleModelProvenance; } | { readonly kind: 'user'; };"
795
+ "declaration": "export type SessionTitleSource = { readonly kind: 'fallback'; } | { readonly kind: 'provider'; readonly provider: SessionTitleProviderId; readonly model?: SessionTitleModelIdentity; } | { readonly kind: 'user'; };"
796
+ },
797
+ {
798
+ "name": "SkillInvocationSource",
799
+ "declaration": "export interface SkillInvocationSource {\n readonly kind: 'skill-invocation';\n readonly name: string;\n readonly form: 'instructions';\n}"
706
800
  },
707
801
  {
708
802
  "name": "StreamChunk",
@@ -710,7 +804,7 @@ export const TYPERT = {
710
804
  },
711
805
  {
712
806
  "name": "SubagentCatalogEvent",
713
- "declaration": "export type SubagentCatalogEvent = { readonly version: 0; readonly childId: SessionId; readonly childCreatedAt: number; } & ({ readonly mode: 'one-shot'; readonly label?: string; } | { readonly mode: 'continuable'; readonly label: string; });"
807
+ "declaration": "export type SubagentCatalogEvent = { readonly childId: SessionId; readonly childCreatedAt: number; } & (({ readonly version: 0; } & KnownCatalogMode) | ({ readonly version: 1; } & (KnownCatalogMode | { readonly mode: 'unknown'; readonly label?: string; })));"
714
808
  },
715
809
  {
716
810
  "name": "SubagentDescriptorBase",
@@ -726,7 +820,7 @@ export const TYPERT = {
726
820
  },
727
821
  {
728
822
  "name": "SurfaceEventType",
729
- "declaration": "export type SurfaceEventType = 'system/message' | 'user/message' | 'assistant/message' | 'tool/result';"
823
+ "declaration": "export type SurfaceEventType = 'system/message' | 'developer/message' | 'user/message' | 'assistant/message' | 'tool/result';"
730
824
  },
731
825
  {
732
826
  "name": "SurfaceIntent",
@@ -738,7 +832,11 @@ export const TYPERT = {
738
832
  },
739
833
  {
740
834
  "name": "SystemMessage",
741
- "declaration": "export interface SystemMessage extends Message {\n readonly role: 'system';\n readonly source: MessageSourceMap['plugin'];\n}"
835
+ "declaration": "export interface SystemMessage extends MessageBase {\n readonly role: 'system';\n readonly source: MessageSourceMap['system-prompt'];\n}"
836
+ },
837
+ {
838
+ "name": "SystemPromptMessageSource",
839
+ "declaration": "export interface SystemPromptMessageSource {\n kind: 'system-prompt';\n}"
742
840
  },
743
841
  {
744
842
  "name": "SystemPromptUpdate",
@@ -756,6 +854,10 @@ export const TYPERT = {
756
854
  "name": "TokenUsage",
757
855
  "declaration": "export interface TokenUsage {\n inputTokens: number;\n outputTokens: number;\n totalTokens?: number;\n cacheReadTokens?: number;\n cacheWriteTokens?: number;\n reasoningTokens?: number;\n}"
758
856
  },
857
+ {
858
+ "name": "ToolAdditionBlock",
859
+ "declaration": "export interface ToolAdditionBlock {\n type: 'tool-addition';\n toolName: string;\n tool?: never;\n}"
860
+ },
759
861
  {
760
862
  "name": "ToolCallBlock",
761
863
  "declaration": "export interface ToolCallBlock {\n type: 'tool-call';\n id: ToolCallId;\n name: string;\n arguments: string;\n}"
@@ -764,25 +866,29 @@ export const TYPERT = {
764
866
  "name": "ToolCallId",
765
867
  "declaration": "export type ToolCallId = Branded<'ToolCallId'>;"
766
868
  },
869
+ {
870
+ "name": "ToolHistory",
871
+ "declaration": "export interface ToolHistory {\n readonly tools: readonly ToolSchema[];\n readonly updates: readonly { readonly messageId: MessageId; readonly additions: readonly ToolSchema[]; }[];\n}"
872
+ },
767
873
  {
768
874
  "name": "ToolMessageSource",
769
875
  "declaration": "export interface ToolMessageSource {\n kind: 'tool';\n callId: ToolCallId;\n}"
770
876
  },
771
877
  {
772
- "name": "ToolRestriction",
773
- "declaration": "export interface ToolRestriction {\n readonly allow?: readonly string[];\n readonly deny?: readonly string[];\n}"
878
+ "name": "ToolRemovalBlock",
879
+ "declaration": "export interface ToolRemovalBlock {\n type: 'tool-removal';\n toolName: string;\n}"
774
880
  },
775
881
  {
776
- "name": "ToolResultBlock",
777
- "declaration": "export interface ToolResultBlock {\n type: 'tool-result';\n toolCallId: ToolCallId;\n content: ContentBlock[];\n isError?: boolean;\n}"
882
+ "name": "ToolRestriction",
883
+ "declaration": "export interface ToolRestriction {\n readonly allow?: readonly string[];\n readonly deny?: readonly string[];\n}"
778
884
  },
779
885
  {
780
886
  "name": "ToolResultMessage",
781
- "declaration": "export interface ToolResultMessage extends Message {\n readonly role: 'user';\n readonly content: [ToolResultBlock];\n readonly source: ToolMessageSource;\n}"
887
+ "declaration": "export interface ToolResultMessage extends MessageBase {\n readonly role: 'tool';\n readonly source: ToolMessageSource;\n readonly toolCallId: ToolCallId;\n readonly isError?: boolean;\n}"
782
888
  },
783
889
  {
784
890
  "name": "ToolSchema",
785
- "declaration": "export interface ToolSchema {\n name: string;\n description: string;\n parameters: Record<string, unknown>;\n}"
891
+ "declaration": "export interface ToolSchema {\n deferLoading?: true;\n name: string;\n description: string;\n parameters: Record<string, unknown>;\n}"
786
892
  },
787
893
  {
788
894
  "name": "TurnEndCancelCause",
@@ -794,11 +900,11 @@ export const TYPERT = {
794
900
  },
795
901
  {
796
902
  "name": "TurnEndReasonMap",
797
- "declaration": "export interface TurnEndReasonMap {\n completed: { kind: 'completed'; };\n aborted: { kind: 'aborted'; reason: TurnEndCancelCause; };\n blocked: { kind: 'blocked'; };\n error: { kind: 'error'; error: LlmFailure; };\n 'max-tokens': { kind: 'max-tokens'; };\n interrupted: { kind: 'interrupted'; };\n}"
903
+ "declaration": "export interface TurnEndReasonMap {\n completed: { kind: 'completed'; };\n aborted: { kind: 'aborted'; reason: TurnEndCancelCause; };\n blocked: { kind: 'blocked'; };\n error: { kind: 'error'; error: LlmFailure; };\n 'max-tokens': { kind: 'max-tokens'; };\n interrupted: { kind: 'interrupted'; };\n forked: { kind: 'forked'; };\n}"
798
904
  },
799
905
  {
800
906
  "name": "UserMessage",
801
- "declaration": "export interface UserMessage extends Message {\n readonly role: 'user';\n}"
907
+ "declaration": "export interface UserMessage extends MessageBase {\n readonly role: 'user';\n}"
802
908
  }
803
909
  ]
804
910
  }
@@ -1,11 +1,14 @@
1
1
  /* Generated by @deepseek-ai/dsh-typert-generator from the Host FaceModel — do not edit. */
2
2
  import { z } from 'zod'
3
3
 
4
- const _khorsheed_dsh_file_preview_filePreview_capabilities_result$schema = z.object({
4
+ let _khorsheed_dsh_file_preview_filePreview_capabilities_result$schema$value
5
+ const _khorsheed_dsh_file_preview_filePreview_capabilities_result$schema = () => (_khorsheed_dsh_file_preview_filePreview_capabilities_result$schema$value ??= z.object({
5
6
  'protocolVersion': z.literal(1),
6
- })
7
- const _khorsheed_dsh_file_preview_filePreview_list_parameter_0$schema = z.intersection(z.string(), z.unknown())
8
- const _khorsheed_dsh_file_preview_filePreview_list_result$schema = z.object({
7
+ }))
8
+ let _khorsheed_dsh_file_preview_filePreview_list_parameter_0$schema$value
9
+ const _khorsheed_dsh_file_preview_filePreview_list_parameter_0$schema = () => (_khorsheed_dsh_file_preview_filePreview_list_parameter_0$schema$value ??= z.intersection(z.string(), z.unknown()))
10
+ let _khorsheed_dsh_file_preview_filePreview_list_result$schema$value
11
+ const _khorsheed_dsh_file_preview_filePreview_list_result$schema = () => (_khorsheed_dsh_file_preview_filePreview_list_result$schema$value ??= z.object({
9
12
  'entries': z.array(z.object({
10
13
  'path': z.string().readonly(),
11
14
  'op': z.union([z.literal("read"), z.literal("write"), z.literal("edit")]).readonly(),
@@ -26,38 +29,50 @@ const _khorsheed_dsh_file_preview_filePreview_list_result$schema = z.object({
26
29
  })).readonly(),
27
30
  'asOfSeq': z.number().readonly(),
28
31
  'truncated': z.boolean().readonly(),
29
- })
30
- const _khorsheed_dsh_file_preview_filePreview_openExternal_parameter_0$schema = z.intersection(z.string(), z.unknown())
31
- const _khorsheed_dsh_file_preview_filePreview_openExternal_parameter_1$schema = z.string()
32
- const _khorsheed_dsh_file_preview_filePreview_openExternal_parameter_2$schema = z.string()
33
- const _khorsheed_dsh_file_preview_filePreview_openExternal_result$schema = z.union([z.object({
32
+ }))
33
+ let _khorsheed_dsh_file_preview_filePreview_openExternal_parameter_0$schema$value
34
+ const _khorsheed_dsh_file_preview_filePreview_openExternal_parameter_0$schema = () => (_khorsheed_dsh_file_preview_filePreview_openExternal_parameter_0$schema$value ??= z.intersection(z.string(), z.unknown()))
35
+ let _khorsheed_dsh_file_preview_filePreview_openExternal_parameter_1$schema$value
36
+ const _khorsheed_dsh_file_preview_filePreview_openExternal_parameter_1$schema = () => (_khorsheed_dsh_file_preview_filePreview_openExternal_parameter_1$schema$value ??= z.string())
37
+ let _khorsheed_dsh_file_preview_filePreview_openExternal_parameter_2$schema$value
38
+ const _khorsheed_dsh_file_preview_filePreview_openExternal_parameter_2$schema = () => (_khorsheed_dsh_file_preview_filePreview_openExternal_parameter_2$schema$value ??= z.string())
39
+ let _khorsheed_dsh_file_preview_filePreview_openExternal_result$schema$value
40
+ const _khorsheed_dsh_file_preview_filePreview_openExternal_result$schema = () => (_khorsheed_dsh_file_preview_filePreview_openExternal_result$schema$value ??= z.union([z.object({
34
41
  'opened': z.literal(true).readonly(),
35
42
  }), z.object({
36
43
  'opened': z.literal(false).readonly(),
37
44
  'reason': z.union([z.literal("missing"), z.literal("unknown-app"), z.literal("unsupported-platform"), z.literal("launch-failed")]).readonly(),
38
- })])
39
- const _khorsheed_dsh_file_preview_filePreview_read_parameter_0$schema = z.intersection(z.string(), z.unknown())
40
- const _khorsheed_dsh_file_preview_filePreview_read_parameter_1$schema = z.string()
41
- const _khorsheed_dsh_file_preview_filePreview_read_result$schema = z.object({
45
+ })]))
46
+ let _khorsheed_dsh_file_preview_filePreview_read_parameter_0$schema$value
47
+ const _khorsheed_dsh_file_preview_filePreview_read_parameter_0$schema = () => (_khorsheed_dsh_file_preview_filePreview_read_parameter_0$schema$value ??= z.intersection(z.string(), z.unknown()))
48
+ let _khorsheed_dsh_file_preview_filePreview_read_parameter_1$schema$value
49
+ const _khorsheed_dsh_file_preview_filePreview_read_parameter_1$schema = () => (_khorsheed_dsh_file_preview_filePreview_read_parameter_1$schema$value ??= z.string())
50
+ let _khorsheed_dsh_file_preview_filePreview_read_result$schema$value
51
+ const _khorsheed_dsh_file_preview_filePreview_read_result$schema = () => (_khorsheed_dsh_file_preview_filePreview_read_result$schema$value ??= z.object({
42
52
  'path': z.string().readonly(),
43
- 'kind': z.union([z.literal("missing"), z.literal("error"), z.literal("text"), z.literal("image"), z.literal("binary"), z.literal("too-large")]).readonly(),
53
+ 'kind': z.union([z.literal("missing"), z.literal("too-large"), z.literal("error"), z.literal("text"), z.literal("binary"), z.literal("image")]).readonly(),
44
54
  'content': z.string().readonly().optional(),
45
55
  'url': z.string().readonly().optional(),
46
56
  'truncated': z.boolean().readonly().optional(),
47
57
  'htmlScripted': z.boolean().readonly().optional(),
48
58
  'size': z.number().readonly().optional(),
49
59
  'message': z.string().readonly().optional(),
50
- })
51
- const _khorsheed_dsh_file_preview_filePreview_reveal_parameter_0$schema = z.intersection(z.string(), z.unknown())
52
- const _khorsheed_dsh_file_preview_filePreview_reveal_parameter_1$schema = z.string()
53
- const _khorsheed_dsh_file_preview_filePreview_reveal_result$schema = z.union([z.object({
60
+ }))
61
+ let _khorsheed_dsh_file_preview_filePreview_reveal_parameter_0$schema$value
62
+ const _khorsheed_dsh_file_preview_filePreview_reveal_parameter_0$schema = () => (_khorsheed_dsh_file_preview_filePreview_reveal_parameter_0$schema$value ??= z.intersection(z.string(), z.unknown()))
63
+ let _khorsheed_dsh_file_preview_filePreview_reveal_parameter_1$schema$value
64
+ const _khorsheed_dsh_file_preview_filePreview_reveal_parameter_1$schema = () => (_khorsheed_dsh_file_preview_filePreview_reveal_parameter_1$schema$value ??= z.string())
65
+ let _khorsheed_dsh_file_preview_filePreview_reveal_result$schema$value
66
+ const _khorsheed_dsh_file_preview_filePreview_reveal_result$schema = () => (_khorsheed_dsh_file_preview_filePreview_reveal_result$schema$value ??= z.union([z.object({
54
67
  'revealed': z.literal(true).readonly(),
55
68
  }), z.object({
56
69
  'revealed': z.literal(false).readonly(),
57
70
  'reason': z.union([z.literal("missing"), z.literal("select-failed")]).readonly(),
58
- })])
59
- const _khorsheed_dsh_file_preview_filePreview_turnFiles_parameter_0$schema = z.intersection(z.string(), z.unknown())
60
- const _khorsheed_dsh_file_preview_filePreview_turnFiles_result$schema = z.object({
71
+ })]))
72
+ let _khorsheed_dsh_file_preview_filePreview_turnFiles_parameter_0$schema$value
73
+ const _khorsheed_dsh_file_preview_filePreview_turnFiles_parameter_0$schema = () => (_khorsheed_dsh_file_preview_filePreview_turnFiles_parameter_0$schema$value ??= z.intersection(z.string(), z.unknown()))
74
+ let _khorsheed_dsh_file_preview_filePreview_turnFiles_result$schema$value
75
+ const _khorsheed_dsh_file_preview_filePreview_turnFiles_result$schema = () => (_khorsheed_dsh_file_preview_filePreview_turnFiles_result$schema$value ??= z.object({
61
76
  'turns': z.array(z.object({
62
77
  'turn': z.number().readonly(),
63
78
  'files': z.array(z.object({
@@ -69,7 +84,7 @@ const _khorsheed_dsh_file_preview_filePreview_turnFiles_result$schema = z.object
69
84
  })).readonly(),
70
85
  })).readonly(),
71
86
  'asOfSeq': z.number().readonly(),
72
- })
87
+ }))
73
88
 
74
89
  export const TYPERT_REMOTE = {
75
90
  package: '@khorsheed/dsh-file-preview',
@@ -85,9 +100,10 @@ export const TYPERT_REMOTE = {
85
100
  result: {
86
101
  mode: 'strict',
87
102
  typeSymbol: '@khorsheed/dsh-file-preview#filePreview/capabilities:result',
88
- schema: _khorsheed_dsh_file_preview_filePreview_capabilities_result$schema,
103
+ create: _khorsheed_dsh_file_preview_filePreview_capabilities_result$schema,
104
+ schema: _khorsheed_dsh_file_preview_filePreview_capabilities_result$schema(),
89
105
  },
90
- sourceLocation: {"file":"packages/file-preview/src/index.ts","line":191,"column":3},
106
+ sourceLocation: {"file":"packages/file-preview/src/index.ts","line":196,"column":3},
91
107
  },
92
108
  {
93
109
  id: '@khorsheed/dsh-file-preview#filePreview/list',
@@ -108,16 +124,18 @@ export const TYPERT_REMOTE = {
108
124
  codec: {
109
125
  mode: 'strict',
110
126
  typeSymbol: '@deepseek-ai/dsh-session/types#SessionId',
111
- schema: _khorsheed_dsh_file_preview_filePreview_list_parameter_0$schema,
127
+ create: _khorsheed_dsh_file_preview_filePreview_list_parameter_0$schema,
128
+ schema: _khorsheed_dsh_file_preview_filePreview_list_parameter_0$schema(),
112
129
  },
113
130
  },
114
131
  ],
115
132
  result: {
116
133
  mode: 'strict',
117
134
  typeSymbol: '@khorsheed/dsh-file-preview/types#FilePreviewList',
118
- schema: _khorsheed_dsh_file_preview_filePreview_list_result$schema,
135
+ create: _khorsheed_dsh_file_preview_filePreview_list_result$schema,
136
+ schema: _khorsheed_dsh_file_preview_filePreview_list_result$schema(),
119
137
  },
120
- sourceLocation: {"file":"packages/file-preview/src/index.ts","line":311,"column":9},
138
+ sourceLocation: {"file":"packages/file-preview/src/index.ts","line":316,"column":9},
121
139
  },
122
140
  {
123
141
  id: '@khorsheed/dsh-file-preview#filePreview/openExternal',
@@ -138,7 +156,8 @@ export const TYPERT_REMOTE = {
138
156
  codec: {
139
157
  mode: 'strict',
140
158
  typeSymbol: '@deepseek-ai/dsh-session/types#SessionId',
141
- schema: _khorsheed_dsh_file_preview_filePreview_openExternal_parameter_0$schema,
159
+ create: _khorsheed_dsh_file_preview_filePreview_openExternal_parameter_0$schema,
160
+ schema: _khorsheed_dsh_file_preview_filePreview_openExternal_parameter_0$schema(),
142
161
  },
143
162
  },
144
163
  {
@@ -148,7 +167,8 @@ export const TYPERT_REMOTE = {
148
167
  codec: {
149
168
  mode: 'strict',
150
169
  typeSymbol: '@khorsheed/dsh-file-preview#filePreview/openExternal:path',
151
- schema: _khorsheed_dsh_file_preview_filePreview_openExternal_parameter_1$schema,
170
+ create: _khorsheed_dsh_file_preview_filePreview_openExternal_parameter_1$schema,
171
+ schema: _khorsheed_dsh_file_preview_filePreview_openExternal_parameter_1$schema(),
152
172
  },
153
173
  },
154
174
  {
@@ -158,7 +178,8 @@ export const TYPERT_REMOTE = {
158
178
  codec: {
159
179
  mode: 'strict',
160
180
  typeSymbol: '@khorsheed/dsh-file-preview#filePreview/openExternal:app',
161
- schema: _khorsheed_dsh_file_preview_filePreview_openExternal_parameter_2$schema,
181
+ create: _khorsheed_dsh_file_preview_filePreview_openExternal_parameter_2$schema,
182
+ schema: _khorsheed_dsh_file_preview_filePreview_openExternal_parameter_2$schema(),
162
183
  },
163
184
  },
164
185
  ],
@@ -166,9 +187,10 @@ export const TYPERT_REMOTE = {
166
187
  result: {
167
188
  mode: 'strict',
168
189
  typeSymbol: '@khorsheed/dsh-file-preview/types#FilePreviewOpenExternal',
169
- schema: _khorsheed_dsh_file_preview_filePreview_openExternal_result$schema,
190
+ create: _khorsheed_dsh_file_preview_filePreview_openExternal_result$schema,
191
+ schema: _khorsheed_dsh_file_preview_filePreview_openExternal_result$schema(),
170
192
  },
171
- sourceLocation: {"file":"packages/file-preview/src/index.ts","line":528,"column":9},
193
+ sourceLocation: {"file":"packages/file-preview/src/index.ts","line":539,"column":9},
172
194
  },
173
195
  {
174
196
  id: '@khorsheed/dsh-file-preview#filePreview/read',
@@ -189,7 +211,8 @@ export const TYPERT_REMOTE = {
189
211
  codec: {
190
212
  mode: 'strict',
191
213
  typeSymbol: '@deepseek-ai/dsh-session/types#SessionId',
192
- schema: _khorsheed_dsh_file_preview_filePreview_read_parameter_0$schema,
214
+ create: _khorsheed_dsh_file_preview_filePreview_read_parameter_0$schema,
215
+ schema: _khorsheed_dsh_file_preview_filePreview_read_parameter_0$schema(),
193
216
  },
194
217
  },
195
218
  {
@@ -199,7 +222,8 @@ export const TYPERT_REMOTE = {
199
222
  codec: {
200
223
  mode: 'strict',
201
224
  typeSymbol: '@khorsheed/dsh-file-preview#filePreview/read:path',
202
- schema: _khorsheed_dsh_file_preview_filePreview_read_parameter_1$schema,
225
+ create: _khorsheed_dsh_file_preview_filePreview_read_parameter_1$schema,
226
+ schema: _khorsheed_dsh_file_preview_filePreview_read_parameter_1$schema(),
203
227
  },
204
228
  },
205
229
  ],
@@ -207,9 +231,10 @@ export const TYPERT_REMOTE = {
207
231
  result: {
208
232
  mode: 'strict',
209
233
  typeSymbol: '@khorsheed/dsh-file-preview/types#FilePreviewRead',
210
- schema: _khorsheed_dsh_file_preview_filePreview_read_result$schema,
234
+ create: _khorsheed_dsh_file_preview_filePreview_read_result$schema,
235
+ schema: _khorsheed_dsh_file_preview_filePreview_read_result$schema(),
211
236
  },
212
- sourceLocation: {"file":"packages/file-preview/src/index.ts","line":401,"column":9},
237
+ sourceLocation: {"file":"packages/file-preview/src/index.ts","line":409,"column":9},
213
238
  },
214
239
  {
215
240
  id: '@khorsheed/dsh-file-preview#filePreview/reveal',
@@ -230,7 +255,8 @@ export const TYPERT_REMOTE = {
230
255
  codec: {
231
256
  mode: 'strict',
232
257
  typeSymbol: '@deepseek-ai/dsh-session/types#SessionId',
233
- schema: _khorsheed_dsh_file_preview_filePreview_reveal_parameter_0$schema,
258
+ create: _khorsheed_dsh_file_preview_filePreview_reveal_parameter_0$schema,
259
+ schema: _khorsheed_dsh_file_preview_filePreview_reveal_parameter_0$schema(),
234
260
  },
235
261
  },
236
262
  {
@@ -240,7 +266,8 @@ export const TYPERT_REMOTE = {
240
266
  codec: {
241
267
  mode: 'strict',
242
268
  typeSymbol: '@khorsheed/dsh-file-preview#filePreview/reveal:path',
243
- schema: _khorsheed_dsh_file_preview_filePreview_reveal_parameter_1$schema,
269
+ create: _khorsheed_dsh_file_preview_filePreview_reveal_parameter_1$schema,
270
+ schema: _khorsheed_dsh_file_preview_filePreview_reveal_parameter_1$schema(),
244
271
  },
245
272
  },
246
273
  ],
@@ -248,9 +275,10 @@ export const TYPERT_REMOTE = {
248
275
  result: {
249
276
  mode: 'strict',
250
277
  typeSymbol: '@khorsheed/dsh-file-preview/types#FilePreviewReveal',
251
- schema: _khorsheed_dsh_file_preview_filePreview_reveal_result$schema,
278
+ create: _khorsheed_dsh_file_preview_filePreview_reveal_result$schema,
279
+ schema: _khorsheed_dsh_file_preview_filePreview_reveal_result$schema(),
252
280
  },
253
- sourceLocation: {"file":"packages/file-preview/src/index.ts","line":478,"column":9},
281
+ sourceLocation: {"file":"packages/file-preview/src/index.ts","line":489,"column":9},
254
282
  },
255
283
  {
256
284
  id: '@khorsheed/dsh-file-preview#filePreview/turnFiles',
@@ -271,16 +299,18 @@ export const TYPERT_REMOTE = {
271
299
  codec: {
272
300
  mode: 'strict',
273
301
  typeSymbol: '@deepseek-ai/dsh-session/types#SessionId',
274
- schema: _khorsheed_dsh_file_preview_filePreview_turnFiles_parameter_0$schema,
302
+ create: _khorsheed_dsh_file_preview_filePreview_turnFiles_parameter_0$schema,
303
+ schema: _khorsheed_dsh_file_preview_filePreview_turnFiles_parameter_0$schema(),
275
304
  },
276
305
  },
277
306
  ],
278
307
  result: {
279
308
  mode: 'strict',
280
309
  typeSymbol: '@khorsheed/dsh-file-preview/types#FilePreviewTurnMap',
281
- schema: _khorsheed_dsh_file_preview_filePreview_turnFiles_result$schema,
310
+ create: _khorsheed_dsh_file_preview_filePreview_turnFiles_result$schema,
311
+ schema: _khorsheed_dsh_file_preview_filePreview_turnFiles_result$schema(),
282
312
  },
283
- sourceLocation: {"file":"packages/file-preview/src/index.ts","line":348,"column":9},
313
+ sourceLocation: {"file":"packages/file-preview/src/index.ts","line":353,"column":9},
284
314
  },
285
315
  ],
286
316
  }
package/lib/types/fold.js CHANGED
@@ -162,8 +162,13 @@ function contentFromWriteCall(argumentsJson) {
162
162
  }
163
163
  return undefined;
164
164
  }
165
- /** Read the tool-result block's call identity and failure flag off a result message. */
165
+ /** Read the result message's call identity and failure flag. V4's first-class
166
+ * tool role puts both on the message itself; V3 wrapped them in the leading
167
+ * `tool-result` content block — read the message level first, then the block. */
166
168
  function resultCallFacts(message) {
169
+ if (typeof message.toolCallId === 'string') {
170
+ return { callId: message.toolCallId, isError: message.isError === true };
171
+ }
167
172
  const block = message.content[0];
168
173
  if (block?.type !== 'tool-result' || typeof block.toolCallId !== 'string')
169
174
  return undefined;
@@ -103,7 +103,10 @@ export declare class FilePreviewService extends TypertRemoteService {
103
103
  turnFiles(agent: Agent): Promise<FilePreviewTurnMap>;
104
104
  /**
105
105
  * Read the current content of one recorded file, resolved against the
106
- * session cwd and capped by `maxReadBytes`.
106
+ * session cwd and capped by `maxReadBytes`. The text read is a bounded byte
107
+ * window (`readByteRange` of cap + 1 bytes), so an oversized file costs the
108
+ * cap, never its full size; a known oversized stat still short-circuits to
109
+ * `too-large` before any bytes move.
107
110
  * @param agent - owning live agent; its session cwd anchors relative paths.
108
111
  * @param path - the display path recorded by the write/edit tool call.
109
112
  * @param signal - cooperative cancellation from the calling UI request.
@@ -69,6 +69,10 @@ const IMAGE_MIME = {
69
69
  function hasNulByte(content) {
70
70
  return content.slice(0, 4096).includes('\u0000');
71
71
  }
72
+ /** Shared non-fatal UTF-8 decoder for the bounded byte-window read: invalid
73
+ * sequences become U+FFFD (a cut multi-byte character at the window edge
74
+ * included) instead of failing the read. */
75
+ const utf8Decoder = new TextDecoder();
72
76
  /** Detect a binary file from its display path extension. */
73
77
  function isBinaryPath(path) {
74
78
  const dot = path.lastIndexOf('.');
@@ -406,7 +410,10 @@ let FilePreviewService = (() => {
406
410
  }
407
411
  /**
408
412
  * Read the current content of one recorded file, resolved against the
409
- * session cwd and capped by `maxReadBytes`.
413
+ * session cwd and capped by `maxReadBytes`. The text read is a bounded byte
414
+ * window (`readByteRange` of cap + 1 bytes), so an oversized file costs the
415
+ * cap, never its full size; a known oversized stat still short-circuits to
416
+ * `too-large` before any bytes move.
410
417
  * @param agent - owning live agent; its session cwd anchors relative paths.
411
418
  * @param path - the display path recorded by the write/edit tool call.
412
419
  * @param signal - cooperative cancellation from the calling UI request.
@@ -460,15 +467,18 @@ let FilePreviewService = (() => {
460
467
  return { path, kind: 'binary', ...(info.size === undefined ? {} : { size: info.size }) };
461
468
  }
462
469
  try {
463
- const content = await this.fs.readText(target, signal);
470
+ // Bounded by the window, not the file: at most cap + 1 bytes are
471
+ // transferred (the extra byte decides `truncated`), never the whole file.
472
+ const bytes = await this.fs.readByteRange(target, { offset: 0, length: cap + 1 }, signal);
473
+ const truncated = bytes.length > cap;
474
+ const content = utf8Decoder.decode(truncated ? bytes.subarray(0, cap) : bytes);
464
475
  if (hasNulByte(content)) {
465
476
  return { path, kind: 'binary', ...(info.size === undefined ? {} : { size: info.size }) };
466
477
  }
467
- const truncated = content.length > cap;
468
478
  return {
469
479
  path,
470
480
  kind: 'text',
471
- content: truncated ? content.slice(0, cap) : content,
481
+ content,
472
482
  truncated,
473
483
  ...(html && isScriptedHtml(content) ? { htmlScripted: true } : {}),
474
484
  ...(info.size === undefined ? {} : { size: info.size }),
package/locale/en.json ADDED
@@ -0,0 +1,6 @@
1
+ {
2
+ "meta": {
3
+ "title": "File Preview",
4
+ "description": "Read-only listing of session-written files with their current content."
5
+ }
6
+ }
package/locale/zh.json ADDED
@@ -0,0 +1,6 @@
1
+ {
2
+ "meta": {
3
+ "title": "文件预览",
4
+ "description": "只读列出会话写过、改过的文件并提供当前文本。"
5
+ }
6
+ }
package/package.json CHANGED
@@ -7,7 +7,7 @@
7
7
  "cordis",
8
8
  "file-preview"
9
9
  ],
10
- "version": "0.3.0",
10
+ "version": "0.3.2",
11
11
  "type": "module",
12
12
  "main": "lib/index.js",
13
13
  "types": "lib/types/index.d.ts",
@@ -33,6 +33,7 @@
33
33
  "default": "./lib/typert.remote-client.js"
34
34
  },
35
35
  "./src/*": "./src/*",
36
+ "./locale/*.json": "./locale/*.json",
36
37
  "./package.json": "./package.json"
37
38
  },
38
39
  "files": [
@@ -42,6 +43,7 @@
42
43
  "lib/typert.remote-client.d.ts",
43
44
  "lib/typert.remote-client.js",
44
45
  "cordis.patch.yml",
46
+ "locale/*.json",
45
47
  "LICENSE",
46
48
  "CHANGELOG.md"
47
49
  ],
@@ -56,19 +58,8 @@
56
58
  "@deepseek-ai/dsh-typert-protocol": "^0.1.0-rc.6",
57
59
  "@deepseek-ai/cordis": "^4.0.1"
58
60
  },
59
- "devDependencies": {
60
- "@deepseek-ai/cordis": "^4.0.1",
61
- "@deepseek-ai/dsh-agent": "^0.1.5-rc.1",
62
- "@deepseek-ai/dsh-fs": "^0.1.5-rc.1",
63
- "@deepseek-ai/dsh-invariants": "^0.1.5-rc.1",
64
- "@deepseek-ai/dsh-llm": "^0.1.5-rc.1",
65
- "@deepseek-ai/dsh-loader-smoke": "^0.1.5-rc.1",
66
- "@deepseek-ai/dsh-native-command": "^0.1.5-rc.1",
67
- "@deepseek-ai/dsh-session": "^0.1.5-rc.1",
68
- "@deepseek-ai/dsh-skill": "^0.1.5-rc.1",
69
- "@deepseek-ai/dsh-tools": "^0.1.5-rc.1",
70
- "@deepseek-ai/dsh-typert-protocol": "^0.1.5-rc.1",
71
- "@deepseek-ai/dsh-util-values": "^0.1.5-rc.1"
61
+ "dependencies": {
62
+ "zod": "^4.4.3"
72
63
  },
73
64
  "dsh": {
74
65
  "bundle": {