@khorsheed/dsh-file-preview 0.2.0 → 0.3.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.
@@ -1,6 +1,9 @@
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({
5
+ 'protocolVersion': z.literal(1),
6
+ })
4
7
  const _khorsheed_dsh_file_preview_filePreview_list_parameter_0$schema = z.intersection(z.string(), z.unknown())
5
8
  const _khorsheed_dsh_file_preview_filePreview_list_result$schema = z.object({
6
9
  'entries': z.array(z.object({
@@ -24,11 +27,20 @@ const _khorsheed_dsh_file_preview_filePreview_list_result$schema = z.object({
24
27
  'asOfSeq': z.number().readonly(),
25
28
  'truncated': z.boolean().readonly(),
26
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({
34
+ 'opened': z.literal(true).readonly(),
35
+ }), z.object({
36
+ 'opened': z.literal(false).readonly(),
37
+ 'reason': z.union([z.literal("missing"), z.literal("unknown-app"), z.literal("unsupported-platform"), z.literal("launch-failed")]).readonly(),
38
+ })])
27
39
  const _khorsheed_dsh_file_preview_filePreview_read_parameter_0$schema = z.intersection(z.string(), z.unknown())
28
40
  const _khorsheed_dsh_file_preview_filePreview_read_parameter_1$schema = z.string()
29
41
  const _khorsheed_dsh_file_preview_filePreview_read_result$schema = z.object({
30
42
  'path': z.string().readonly(),
31
- 'kind': z.union([z.literal("text"), z.literal("image"), z.literal("binary"), z.literal("missing"), z.literal("too-large"), z.literal("error")]).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(),
32
44
  'content': z.string().readonly().optional(),
33
45
  'url': z.string().readonly().optional(),
34
46
  'truncated': z.boolean().readonly().optional(),
@@ -65,6 +77,21 @@ export const TYPERT = {
65
77
  schemas: [
66
78
  ],
67
79
  invocations: [
80
+ {
81
+ id: '@khorsheed/dsh-file-preview#filePreview/capabilities',
82
+ service: 'filePreview',
83
+ namespace: 'filePreview',
84
+ method: 'capabilities',
85
+ invocation: { kind: 'direct' },
86
+ parameters: [
87
+ ],
88
+ result: {
89
+ mode: 'strict',
90
+ typeSymbol: '@khorsheed/dsh-file-preview#filePreview/capabilities:result',
91
+ schema: _khorsheed_dsh_file_preview_filePreview_capabilities_result$schema,
92
+ },
93
+ sourceLocation: {"file":"packages/file-preview/src/index.ts","line":191,"column":3},
94
+ },
68
95
  {
69
96
  id: '@khorsheed/dsh-file-preview#filePreview/list',
70
97
  service: 'filePreview',
@@ -93,7 +120,58 @@ export const TYPERT = {
93
120
  typeSymbol: '@khorsheed/dsh-file-preview/types#FilePreviewList',
94
121
  schema: _khorsheed_dsh_file_preview_filePreview_list_result$schema,
95
122
  },
96
- sourceLocation: {"file":"packages/file-preview/src/index.ts","line":368,"column":9},
123
+ sourceLocation: {"file":"packages/file-preview/src/index.ts","line":311,"column":9},
124
+ },
125
+ {
126
+ id: '@khorsheed/dsh-file-preview#filePreview/openExternal',
127
+ service: 'filePreview',
128
+ namespace: 'filePreview',
129
+ method: 'openExternal',
130
+ invocation: { kind: 'direct' },
131
+ scope: {
132
+ context: 'agent',
133
+ wire: 'agentId',
134
+ },
135
+ parameters: [
136
+ {
137
+ name: 'agent',
138
+ wire: 'agentId',
139
+ source: 'lookup',
140
+ lookup: 'agent',
141
+ codec: {
142
+ mode: 'strict',
143
+ typeSymbol: '@deepseek-ai/dsh-session/types#SessionId',
144
+ schema: _khorsheed_dsh_file_preview_filePreview_openExternal_parameter_0$schema,
145
+ },
146
+ },
147
+ {
148
+ name: 'path',
149
+ wire: 'path',
150
+ source: 'json',
151
+ codec: {
152
+ mode: 'strict',
153
+ typeSymbol: '@khorsheed/dsh-file-preview#filePreview/openExternal:path',
154
+ schema: _khorsheed_dsh_file_preview_filePreview_openExternal_parameter_1$schema,
155
+ },
156
+ },
157
+ {
158
+ name: 'app',
159
+ wire: 'app',
160
+ source: 'json',
161
+ codec: {
162
+ mode: 'strict',
163
+ typeSymbol: '@khorsheed/dsh-file-preview#filePreview/openExternal:app',
164
+ schema: _khorsheed_dsh_file_preview_filePreview_openExternal_parameter_2$schema,
165
+ },
166
+ },
167
+ ],
168
+ cancellation: { parameter: 'signal' },
169
+ result: {
170
+ mode: 'strict',
171
+ typeSymbol: '@khorsheed/dsh-file-preview/types#FilePreviewOpenExternal',
172
+ schema: _khorsheed_dsh_file_preview_filePreview_openExternal_result$schema,
173
+ },
174
+ sourceLocation: {"file":"packages/file-preview/src/index.ts","line":528,"column":9},
97
175
  },
98
176
  {
99
177
  id: '@khorsheed/dsh-file-preview#filePreview/read',
@@ -134,7 +212,7 @@ export const TYPERT = {
134
212
  typeSymbol: '@khorsheed/dsh-file-preview/types#FilePreviewRead',
135
213
  schema: _khorsheed_dsh_file_preview_filePreview_read_result$schema,
136
214
  },
137
- sourceLocation: {"file":"packages/file-preview/src/index.ts","line":458,"column":9},
215
+ sourceLocation: {"file":"packages/file-preview/src/index.ts","line":401,"column":9},
138
216
  },
139
217
  {
140
218
  id: '@khorsheed/dsh-file-preview#filePreview/reveal',
@@ -175,7 +253,7 @@ export const TYPERT = {
175
253
  typeSymbol: '@khorsheed/dsh-file-preview/types#FilePreviewReveal',
176
254
  schema: _khorsheed_dsh_file_preview_filePreview_reveal_result$schema,
177
255
  },
178
- sourceLocation: {"file":"packages/file-preview/src/index.ts","line":535,"column":9},
256
+ sourceLocation: {"file":"packages/file-preview/src/index.ts","line":478,"column":9},
179
257
  },
180
258
  {
181
259
  id: '@khorsheed/dsh-file-preview#filePreview/turnFiles',
@@ -205,7 +283,7 @@ export const TYPERT = {
205
283
  typeSymbol: '@khorsheed/dsh-file-preview/types#FilePreviewTurnMap',
206
284
  schema: _khorsheed_dsh_file_preview_filePreview_turnFiles_result$schema,
207
285
  },
208
- sourceLocation: {"file":"packages/file-preview/src/index.ts","line":405,"column":9},
286
+ sourceLocation: {"file":"packages/file-preview/src/index.ts","line":348,"column":9},
209
287
  },
210
288
  ],
211
289
  model: {
@@ -218,6 +296,13 @@ export const TYPERT = {
218
296
  "key": "filePreview",
219
297
  "exportName": "FilePreviewService",
220
298
  "members": [
299
+ {
300
+ "kind": "method",
301
+ "name": "capabilities",
302
+ "signature": "@Remote('capabilities') capabilities(): { protocolVersion: 1 }",
303
+ "summary": "Zero-session availability handshake for browser companions.",
304
+ "jsDoc": "/** Zero-session availability handshake for browser companions. */"
305
+ },
221
306
  {
222
307
  "kind": "method",
223
308
  "name": "list",
@@ -230,7 +315,7 @@ export const TYPERT = {
230
315
  "name": "turnFiles",
231
316
  "signature": "@Remote('turnFiles') async turnFiles(agent: Agent): Promise<FilePreviewTurnMap>",
232
317
  "summary": "Every turn's file mutations for the turn-tail card — the single source of truth the card renders (the client's old write/edit-only fold retired).",
233
- "jsDoc": "/**\n * Every turn's file mutations for the turn-tail card — the single source of\n * truth the card renders (the client's old write/edit-only fold retired).\n * Built by folding the session log per turn (write/edit calls, Code Mode\n * dispatches borrowing the root call's turn, and render-intent paths from\n * result diff meta) and merging the collector's bash-written captures by\n * their own turn. The fold is cached per session and invalidated by the log\n * watermark, so repeated card fetches do not refold. A path touched in two\n * turns appears in BOTH turn groups — per-turn attribution is exact. Only\n * paths that currently exist on disk are returned (a deleted temp script is\n * history, not a product); existence is probed fresh on every call, so the\n * cached fold is filtered per request rather than cached.\n * @param agent - owning live agent; its session log is the data source.\n * @returns existing per-turn file groups plus the scanned watermark.\n */"
318
+ "jsDoc": "/**\n * Every turn's file mutations for the turn-tail card — the single source of\n * truth the card renders (the client's old write/edit-only fold retired).\n * Built by folding the session log per turn (write/edit calls, PTC\n * dispatches borrowing the root call's turn, and render-intent paths from\n * result diff meta) and merging the collector's bash-written captures by\n * their own turn. The fold is cached per session and invalidated by the log\n * watermark, so repeated card fetches do not refold. A path touched in two\n * turns appears in BOTH turn groups — per-turn attribution is exact. Only\n * paths that currently exist on disk are returned (a deleted temp script is\n * history, not a product); existence is probed fresh on every call, so the\n * cached fold is filtered per request rather than cached.\n * @param agent - owning live agent; its session log is the data source.\n * @returns existing per-turn file groups plus the scanned watermark.\n */"
234
319
  },
235
320
  {
236
321
  "kind": "method",
@@ -245,6 +330,13 @@ export const TYPERT = {
245
330
  "signature": "@Remote('reveal') async reveal(agent: Agent, path: string, signal: AbortSignal): Promise<FilePreviewReveal>",
246
331
  "summary": "Reveal one recorded file in the host file manager — open its folder and select the file (macOS Finder, Windows Explorer, or a select-capable desktop file manager).",
247
332
  "jsDoc": "/**\n * Reveal one recorded file in the host file manager — open its folder and\n * select the file (macOS Finder, Windows Explorer, or a select-capable\n * desktop file manager). The display path resolves against the session cwd;\n * the native reveal runs on the host. A path that does not resolve to an\n * existing target, or a platform that cannot select, answers `revealed:\n * false` and the caller opens the parent folder instead (the pre-reveal\n * \"show in folder\" behavior), so the gesture always lands somewhere visible.\n * @param agent - owning live agent; its session cwd anchors relative paths.\n * @param path - the display path recorded by the read/write/edit tool call.\n * @param signal - cooperative cancellation from the calling UI request.\n * @returns whether the file manager selected the file, or why not.\n */"
333
+ },
334
+ {
335
+ "kind": "method",
336
+ "name": "openExternal",
337
+ "signature": "@Remote('openExternal') async openExternal(agent: Agent, path: string, app: string, signal: AbortSignal): Promise<FilePreviewOpenExternal>",
338
+ "summary": "Open one recorded file in a specific host application (the \"open in IDE\" gesture).",
339
+ "jsDoc": "/**\n * Open one recorded file in a specific host application (the \"open in IDE\"\n * gesture). The official open-in-app route only accepts directories — a\n * file path 404s — so file-exact opens go through this method: macOS\n * `open -a <App> <path>` via the same native-command runner reveal uses.\n * The browser names the application by official open-in-app catalog id\n * (probed from `/open-in-app/apps`); the id → app-name map lives in\n * open-external.ts. Non-macOS hosts and unknown ids answer without\n * launching, and the client hides the gesture.\n * @param agent - owning live agent; its session cwd anchors relative paths.\n * @param path - the display path recorded by the read/write/edit tool call.\n * @param app - official open-in-app catalog id (e.g. `cursor`).\n * @param signal - cooperative cancellation from the calling UI request.\n * @returns whether the application launched, or why not.\n */"
248
340
  }
249
341
  ],
250
342
  "types": [
@@ -288,6 +380,10 @@ export const TYPERT = {
288
380
  "name": "AssistantProvenance",
289
381
  "declaration": "export interface AssistantProvenance {\n provider: string;\n model: string;\n replayState?: unknown;\n}"
290
382
  },
383
+ {
384
+ "name": "AssistantStreamRecord",
385
+ "declaration": "export type AssistantStreamRecord = { readonly type: 'text-chunks'; readonly time0: number; readonly index: number; readonly dt: readonly number[]; readonly texts: readonly string[]; } | { readonly type: 'reasoning-chunks'; readonly time0: number; readonly index: number; readonly dt: readonly number[]; readonly texts: readonly string[]; } | { readonly type: 'tool-call-chunks'; readonly time0: number; readonly index: number; readonly dt: readonly number[]; readonly id: ToolCallId; readonly name?: string; readonly args: readonly string[]; } | { readonly type: 'chunk'; readonly time: number; readonly chunk: StreamChunk; };"
386
+ },
291
387
  {
292
388
  "name": "AttachmentId",
293
389
  "declaration": "export type AttachmentId = Branded<'AttachmentId'>;"
@@ -322,7 +418,7 @@ export const TYPERT = {
322
418
  },
323
419
  {
324
420
  "name": "ContentBlockMap",
325
- "declaration": "export interface ContentBlockMap {\n text: TextBlock;\n reasoning: ReasoningBlock;\n image: ImageBlock;\n 'tool-call': ToolCallBlock;\n 'tool-result': ToolResultBlock;\n}"
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}"
326
422
  },
327
423
  {
328
424
  "name": "ContentBlockType",
@@ -342,7 +438,15 @@ export const TYPERT = {
342
438
  },
343
439
  {
344
440
  "name": "EpochHeader",
345
- "declaration": "export interface EpochHeader {\n config: LlmCallConfig;\n adapterDefaults?: LlmCallConfigAdapterDefaults;\n system?: string;\n tools?: ToolSchema[];\n}"
441
+ "declaration": "export interface EpochHeader {\n config: LlmCallConfig;\n adapterDefaults?: LlmCallConfigAdapterDefaults;\n tools?: ToolSchema[];\n}"
442
+ },
443
+ {
444
+ "name": "FileAttachmentRef",
445
+ "declaration": "export interface FileAttachmentRef {\n attachmentId: AttachmentId;\n name: string;\n bytes: number;\n}"
446
+ },
447
+ {
448
+ "name": "FileBlock",
449
+ "declaration": "export interface FileBlock {\n type: 'file';\n attachment: FileAttachmentRef;\n}"
346
450
  },
347
451
  {
348
452
  "name": "FilePreviewDiff",
@@ -360,6 +464,10 @@ export const TYPERT = {
360
464
  "name": "FilePreviewOp",
361
465
  "declaration": "export type FilePreviewOp = 'read' | 'write' | 'edit';"
362
466
  },
467
+ {
468
+ "name": "FilePreviewOpenExternal",
469
+ "declaration": "export type FilePreviewOpenExternal = { readonly opened: true; } | { readonly opened: false; readonly reason: 'missing' | 'unknown-app' | 'unsupported-platform' | 'launch-failed'; };"
470
+ },
363
471
  {
364
472
  "name": "FilePreviewRead",
365
473
  "declaration": "export interface FilePreviewRead {\n readonly path: string;\n readonly kind: FilePreviewReadKind;\n readonly content?: string;\n readonly url?: string;\n readonly truncated?: boolean;\n readonly htmlScripted?: boolean;\n readonly size?: number;\n readonly message?: string;\n}"
@@ -406,7 +514,7 @@ export const TYPERT = {
406
514
  },
407
515
  {
408
516
  "name": "Inbox",
409
- "declaration": "export class Inbox {\n get nextTurn(): readonly UserMessage[];\n get nextStep(): readonly UserMessage[];\n get hasPending(): boolean;\n clear(): void;\n claim(target: InboxTarget, turn: number): UserMessage[];\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}"
517
+ "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}"
410
518
  },
411
519
  {
412
520
  "name": "InboxTarget",
@@ -478,7 +586,7 @@ export const TYPERT = {
478
586
  },
479
587
  {
480
588
  "name": "RequestContext",
481
- "declaration": "export interface RequestContext {\n provider: string;\n model: string;\n contextWindow?: number;\n}"
589
+ "declaration": "export interface RequestContext {\n provider: string;\n model: string;\n contextWindow?: number;\n systemPromptUpdate?: SystemPromptUpdate;\n}"
482
590
  },
483
591
  {
484
592
  "name": "RequestHeaderReason",
@@ -502,7 +610,7 @@ export const TYPERT = {
502
610
  },
503
611
  {
504
612
  "name": "RoomMemberAddedEvent",
505
- "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 childSessionId?: SessionId;\n}"
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}"
506
614
  },
507
615
  {
508
616
  "name": "RoomMemberRemovedEvent",
@@ -510,7 +618,7 @@ export const TYPERT = {
510
618
  },
511
619
  {
512
620
  "name": "RoomMemberUpdatedEvent",
513
- "declaration": "export interface RoomMemberUpdatedEvent {\n readonly name: string;\n readonly rename?: string;\n readonly instructions?: string | null;\n readonly cwd?: string | null;\n readonly childSessionId?: SessionId;\n}"
621
+ "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}"
514
622
  },
515
623
  {
516
624
  "name": "RoomRelayEvent",
@@ -546,15 +654,15 @@ export const TYPERT = {
546
654
  },
547
655
  {
548
656
  "name": "Session",
549
- "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] : []): SessionEvent<T>;\n requestHeader(): EpochHeader | undefined;\n requestContext(): RequestContext | undefined;\n deriveMessages(): Message[];\n deriveEventMessage(event: SessionEvent): Message | null;\n}"
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}"
550
658
  },
551
659
  {
552
660
  "name": "SessionEvent",
553
- "declaration": "export type SessionEvent<T extends SessionEventType = SessionEventType> = { [K in SessionEventType]: { type: K; seq: SessionSeq; time: number; data: SessionEventMap[K]; ignorable?: true; } & (K extends SurfaceEventType ? { sourceEventSeqs?: SessionSeq[]; surfaceOp?: SurfaceOp; } : object) }[T];"
661
+ "declaration": "export type SessionEvent<T extends SessionEventType = SessionEventType> = { [K in SessionEventType]: { type: K; seq: SessionSeq; time: number; data: SessionEventMap[K]; ignorable?: true; } & (K extends SurfaceEventType ? SurfaceIntent<K> : { surfaceOp?: never; sourceEventSeqs?: never; }) }[T];"
554
662
  },
555
663
  {
556
664
  "name": "SessionEventMap",
557
- "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 'assistant/chunk': { turn: number; step: number; chunk: StreamChunk; };\n 'assistant/message': { turn: number; step: number; message: AssistantMessage; usage?: TokenUsage; interrupted?: true; };\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': Record<string, never>;\n 'agent/inbox/spliced': { target: InboxTarget; start: number; removedCount?: number; inserted: UserMessage[]; outcome?: 'canceled'; };\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/code-dispatch-start': PtcDispatchStartEventData;\n 'tool/code-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 'sandbox/mode': { mode: SandboxMode; source?: 'delegation'; };\n 'agent-preset/selected': { agentPreset: string; };\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}"
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}"
558
666
  },
559
667
  {
560
668
  "name": "SessionEventType",
@@ -562,7 +670,7 @@ export const TYPERT = {
562
670
  },
563
671
  {
564
672
  "name": "SessionHeader",
565
- "declaration": "export interface SessionHeader {\n readonly version: number;\n readonly id: SessionId;\n readonly createdAt: number;\n readonly cwd?: string;\n readonly parentSession?: SessionId;\n readonly isSeeded: boolean;\n readonly origin?: 'subagent';\n readonly delegationDepth?: number;\n readonly agentPreset?: string;\n}"
673
+ "declaration": "export interface SessionHeader {\n readonly version: typeof SESSION_FORMAT_VERSION;\n readonly id: SessionId;\n readonly createdAt: number;\n readonly cwd?: string;\n readonly parentSession?: SessionId;\n readonly isSeeded: boolean;\n readonly origin?: 'subagent';\n readonly delegationDepth?: number;\n readonly agentPreset?: string;\n}"
566
674
  },
567
675
  {
568
676
  "name": "SessionId",
@@ -600,6 +708,10 @@ export const TYPERT = {
600
708
  "name": "StreamChunk",
601
709
  "declaration": "export type StreamChunk = { type: 'block-start'; index: number; blockType: ContentBlockType; } | { type: 'text-delta'; index: number; text: string; } | { type: 'reasoning-delta'; index: number; text: string; } | { type: 'tool-call-delta'; index: number; id: ToolCallId; name?: string; argumentsDelta: string; } | { type: 'block-end'; index: number; block: ContentBlock; } | { type: 'usage'; usage: TokenUsage; } | { type: 'finish'; reason: FinishReason; replayState?: ReplayEnvelope; };"
602
710
  },
711
+ {
712
+ "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; });"
714
+ },
603
715
  {
604
716
  "name": "SubagentDescriptorBase",
605
717
  "declaration": "export interface SubagentDescriptorBase {\n readonly version: number;\n readonly mode: 'one-shot' | 'continuable';\n readonly provider: string;\n}"
@@ -614,15 +726,23 @@ export const TYPERT = {
614
726
  },
615
727
  {
616
728
  "name": "SurfaceEventType",
617
- "declaration": "export type SurfaceEventType = 'user/message' | 'assistant/message' | 'tool/result';"
729
+ "declaration": "export type SurfaceEventType = 'system/message' | 'user/message' | 'assistant/message' | 'tool/result';"
618
730
  },
619
731
  {
620
732
  "name": "SurfaceIntent",
621
- "declaration": "export interface SurfaceIntent {\n surfaceOp: SurfaceOp;\n sourceEventSeqs?: SessionSeq[];\n}"
733
+ "declaration": "export type SurfaceIntent<T extends SurfaceEventType = SurfaceEventType> = { surfaceOp: SurfaceOp; } & (T extends 'assistant/message' ? { sourceEventSeqs?: never; } : { sourceEventSeqs?: SessionSeq[]; });"
622
734
  },
623
735
  {
624
736
  "name": "SurfaceOp",
625
- "declaration": "export type SurfaceOp = 'append' | { op: 'replace'; start: SessionSeq; end: SessionSeq; };"
737
+ "declaration": "export type SurfaceOp = 'append' | { op: 'replace'; startSeq: SessionSeq; endSeq: SessionSeq; };"
738
+ },
739
+ {
740
+ "name": "SystemMessage",
741
+ "declaration": "export interface SystemMessage extends Message {\n readonly role: 'system';\n readonly source: MessageSourceMap['plugin'];\n}"
742
+ },
743
+ {
744
+ "name": "SystemPromptUpdate",
745
+ "declaration": "export type SystemPromptUpdate = 'in-history';"
626
746
  },
627
747
  {
628
748
  "name": "TextBlock",
@@ -4,17 +4,21 @@ import type {
4
4
  TypertRemoteContribution,
5
5
  } from '@deepseek-ai/dsh-typert-protocol'
6
6
  import type { SessionId } from '@deepseek-ai/dsh-session/types'
7
- import type { FilePreviewList, FilePreviewRead, FilePreviewReveal, FilePreviewTurnMap } from '@khorsheed/dsh-file-preview/types'
7
+ import type { FilePreviewList, FilePreviewOpenExternal, FilePreviewRead, FilePreviewReveal, FilePreviewTurnMap } from '@khorsheed/dsh-file-preview/types'
8
8
 
9
9
  declare module '@deepseek-ai/dsh-typert-protocol' {
10
10
  interface TypertRemoteNamespace$66696c6550726576696577 {
11
+ capabilities: () => Promise<RemoteResult<{ protocolVersion: 1; }>>
11
12
  list: (agentId: SessionId) => Promise<RemoteResult<FilePreviewList>>
13
+ openExternal: (agentId: SessionId, path: string, app: string, signal?: AbortSignal) => Promise<RemoteResult<FilePreviewOpenExternal>>
12
14
  read: (agentId: SessionId, path: string, signal?: AbortSignal) => Promise<RemoteResult<FilePreviewRead>>
13
15
  reveal: (agentId: SessionId, path: string, signal?: AbortSignal) => Promise<RemoteResult<FilePreviewReveal>>
14
16
  turnFiles: (agentId: SessionId) => Promise<RemoteResult<FilePreviewTurnMap>>
15
17
  }
16
18
  interface TypertRemoteMap {
19
+ 'filePreview/capabilities': () => Promise<RemoteResult<{ protocolVersion: 1; }>>
17
20
  'filePreview/list': (agentId: SessionId) => Promise<RemoteResult<FilePreviewList>>
21
+ 'filePreview/openExternal': (agentId: SessionId, path: string, app: string, signal?: AbortSignal) => Promise<RemoteResult<FilePreviewOpenExternal>>
18
22
  'filePreview/read': (agentId: SessionId, path: string, signal?: AbortSignal) => Promise<RemoteResult<FilePreviewRead>>
19
23
  'filePreview/reveal': (agentId: SessionId, path: string, signal?: AbortSignal) => Promise<RemoteResult<FilePreviewReveal>>
20
24
  'filePreview/turnFiles': (agentId: SessionId) => Promise<RemoteResult<FilePreviewTurnMap>>
@@ -24,6 +28,7 @@ declare module '@deepseek-ai/dsh-typert-protocol' {
24
28
  }
25
29
  interface TypertRemoteScopeMap {
26
30
  'agent:filePreview/list': () => Promise<RemoteResult<FilePreviewList>>
31
+ 'agent:filePreview/openExternal': (path: string, app: string, signal?: AbortSignal) => Promise<RemoteResult<FilePreviewOpenExternal>>
27
32
  'agent:filePreview/read': (path: string, signal?: AbortSignal) => Promise<RemoteResult<FilePreviewRead>>
28
33
  'agent:filePreview/reveal': (path: string, signal?: AbortSignal) => Promise<RemoteResult<FilePreviewReveal>>
29
34
  'agent:filePreview/turnFiles': () => Promise<RemoteResult<FilePreviewTurnMap>>
@@ -1,6 +1,9 @@
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({
5
+ 'protocolVersion': z.literal(1),
6
+ })
4
7
  const _khorsheed_dsh_file_preview_filePreview_list_parameter_0$schema = z.intersection(z.string(), z.unknown())
5
8
  const _khorsheed_dsh_file_preview_filePreview_list_result$schema = z.object({
6
9
  'entries': z.array(z.object({
@@ -24,11 +27,20 @@ const _khorsheed_dsh_file_preview_filePreview_list_result$schema = z.object({
24
27
  'asOfSeq': z.number().readonly(),
25
28
  'truncated': z.boolean().readonly(),
26
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({
34
+ 'opened': z.literal(true).readonly(),
35
+ }), z.object({
36
+ 'opened': z.literal(false).readonly(),
37
+ 'reason': z.union([z.literal("missing"), z.literal("unknown-app"), z.literal("unsupported-platform"), z.literal("launch-failed")]).readonly(),
38
+ })])
27
39
  const _khorsheed_dsh_file_preview_filePreview_read_parameter_0$schema = z.intersection(z.string(), z.unknown())
28
40
  const _khorsheed_dsh_file_preview_filePreview_read_parameter_1$schema = z.string()
29
41
  const _khorsheed_dsh_file_preview_filePreview_read_result$schema = z.object({
30
42
  'path': z.string().readonly(),
31
- 'kind': z.union([z.literal("text"), z.literal("image"), z.literal("binary"), z.literal("missing"), z.literal("too-large"), z.literal("error")]).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(),
32
44
  'content': z.string().readonly().optional(),
33
45
  'url': z.string().readonly().optional(),
34
46
  'truncated': z.boolean().readonly().optional(),
@@ -62,6 +74,21 @@ const _khorsheed_dsh_file_preview_filePreview_turnFiles_result$schema = z.object
62
74
  export const TYPERT_REMOTE = {
63
75
  package: '@khorsheed/dsh-file-preview',
64
76
  descriptors: [
77
+ {
78
+ id: '@khorsheed/dsh-file-preview#filePreview/capabilities',
79
+ service: 'filePreview',
80
+ namespace: 'filePreview',
81
+ method: 'capabilities',
82
+ invocation: { kind: 'direct' },
83
+ parameters: [
84
+ ],
85
+ result: {
86
+ mode: 'strict',
87
+ typeSymbol: '@khorsheed/dsh-file-preview#filePreview/capabilities:result',
88
+ schema: _khorsheed_dsh_file_preview_filePreview_capabilities_result$schema,
89
+ },
90
+ sourceLocation: {"file":"packages/file-preview/src/index.ts","line":191,"column":3},
91
+ },
65
92
  {
66
93
  id: '@khorsheed/dsh-file-preview#filePreview/list',
67
94
  service: 'filePreview',
@@ -90,7 +117,58 @@ export const TYPERT_REMOTE = {
90
117
  typeSymbol: '@khorsheed/dsh-file-preview/types#FilePreviewList',
91
118
  schema: _khorsheed_dsh_file_preview_filePreview_list_result$schema,
92
119
  },
93
- sourceLocation: {"file":"packages/file-preview/src/index.ts","line":368,"column":9},
120
+ sourceLocation: {"file":"packages/file-preview/src/index.ts","line":311,"column":9},
121
+ },
122
+ {
123
+ id: '@khorsheed/dsh-file-preview#filePreview/openExternal',
124
+ service: 'filePreview',
125
+ namespace: 'filePreview',
126
+ method: 'openExternal',
127
+ invocation: { kind: 'direct' },
128
+ scope: {
129
+ context: 'agent',
130
+ wire: 'agentId',
131
+ },
132
+ parameters: [
133
+ {
134
+ name: 'agent',
135
+ wire: 'agentId',
136
+ source: 'lookup',
137
+ lookup: 'agent',
138
+ codec: {
139
+ mode: 'strict',
140
+ typeSymbol: '@deepseek-ai/dsh-session/types#SessionId',
141
+ schema: _khorsheed_dsh_file_preview_filePreview_openExternal_parameter_0$schema,
142
+ },
143
+ },
144
+ {
145
+ name: 'path',
146
+ wire: 'path',
147
+ source: 'json',
148
+ codec: {
149
+ mode: 'strict',
150
+ typeSymbol: '@khorsheed/dsh-file-preview#filePreview/openExternal:path',
151
+ schema: _khorsheed_dsh_file_preview_filePreview_openExternal_parameter_1$schema,
152
+ },
153
+ },
154
+ {
155
+ name: 'app',
156
+ wire: 'app',
157
+ source: 'json',
158
+ codec: {
159
+ mode: 'strict',
160
+ typeSymbol: '@khorsheed/dsh-file-preview#filePreview/openExternal:app',
161
+ schema: _khorsheed_dsh_file_preview_filePreview_openExternal_parameter_2$schema,
162
+ },
163
+ },
164
+ ],
165
+ cancellation: { parameter: 'signal' },
166
+ result: {
167
+ mode: 'strict',
168
+ typeSymbol: '@khorsheed/dsh-file-preview/types#FilePreviewOpenExternal',
169
+ schema: _khorsheed_dsh_file_preview_filePreview_openExternal_result$schema,
170
+ },
171
+ sourceLocation: {"file":"packages/file-preview/src/index.ts","line":528,"column":9},
94
172
  },
95
173
  {
96
174
  id: '@khorsheed/dsh-file-preview#filePreview/read',
@@ -131,7 +209,7 @@ export const TYPERT_REMOTE = {
131
209
  typeSymbol: '@khorsheed/dsh-file-preview/types#FilePreviewRead',
132
210
  schema: _khorsheed_dsh_file_preview_filePreview_read_result$schema,
133
211
  },
134
- sourceLocation: {"file":"packages/file-preview/src/index.ts","line":458,"column":9},
212
+ sourceLocation: {"file":"packages/file-preview/src/index.ts","line":401,"column":9},
135
213
  },
136
214
  {
137
215
  id: '@khorsheed/dsh-file-preview#filePreview/reveal',
@@ -172,7 +250,7 @@ export const TYPERT_REMOTE = {
172
250
  typeSymbol: '@khorsheed/dsh-file-preview/types#FilePreviewReveal',
173
251
  schema: _khorsheed_dsh_file_preview_filePreview_reveal_result$schema,
174
252
  },
175
- sourceLocation: {"file":"packages/file-preview/src/index.ts","line":535,"column":9},
253
+ sourceLocation: {"file":"packages/file-preview/src/index.ts","line":478,"column":9},
176
254
  },
177
255
  {
178
256
  id: '@khorsheed/dsh-file-preview#filePreview/turnFiles',
@@ -202,7 +280,7 @@ export const TYPERT_REMOTE = {
202
280
  typeSymbol: '@khorsheed/dsh-file-preview/types#FilePreviewTurnMap',
203
281
  schema: _khorsheed_dsh_file_preview_filePreview_turnFiles_result$schema,
204
282
  },
205
- sourceLocation: {"file":"packages/file-preview/src/index.ts","line":405,"column":9},
283
+ sourceLocation: {"file":"packages/file-preview/src/index.ts","line":348,"column":9},
206
284
  },
207
285
  ],
208
286
  }
@@ -26,10 +26,11 @@ export declare function diffsFromResultMeta(meta: unknown): readonly FilePreview
26
26
  * first-seen order and deduplicated by display path; a later occurrence
27
27
  * refreshes the entry's op and location without moving it, and each write/edit
28
28
  * tool result appends its change's diff to the entry's `diffs` in event order.
29
- * Nested Code Mode file dispatches (`tool/code-dispatch` events, or
30
- * `tool/ptc-dispatch` on seats running the PTC rename) count too —
31
- * they carry no turn/step of their own, so the entry borrows the enclosing
32
- * root call's location.
29
+ * Nested PTC file dispatches (`tool/ptc-dispatch` events — the host's Code
30
+ * Mode name through 0.1.2, renamed with the 0.1.5 format; the v2→v3 log
31
+ * migration renames persisted rows, so only the ptc name is matched) count
32
+ * too — they carry no turn/step of their own, so the entry borrows the
33
+ * enclosing root call's location.
33
34
  * @param events - the session's events in ascending seq order.
34
35
  * @param maxFiles - cap on returned entries; excess files are dropped in
35
36
  * first-seen order after the cap is reached.
@@ -58,7 +59,7 @@ export type TurnFilesByTurn = ReadonlyMap<number, ReadonlyMap<string, TurnFileFa
58
59
  * turn maps, so each turn's card lists exactly what that turn mutated.
59
60
  * Reads leave no card entry (the card is the mutation vocabulary — write/edit
60
61
  * only), so a pure-read call never registers; write/edit calls register with
61
- * their own turn; nested Code Mode dispatches borrow the enclosing root call's
62
+ * their own turn; nested PTC dispatches borrow the enclosing root call's
62
63
  * turn (dispatch events carry none); a `tool/result` whose presentation meta
63
64
  * carries diffs registers its paths (the render-intent vocabulary) with the
64
65
  * result's turn, and per-turn line deltas are summed from the diffs. A `write` whose result carries no diffs is a
@@ -69,7 +70,7 @@ export type TurnFilesByTurn = ReadonlyMap<number, ReadonlyMap<string, TurnFileFa
69
70
  * Count discipline: a write/edit tool/call only registers the path's location
70
71
  * and never touches counts (its counted result follows); the first count
71
72
  * contribution for a turn+path is adopted verbatim, later ones accumulate per
72
- * field with unknown-wins — an uncounted mutation (a Code Mode dispatch, or a
73
+ * field with unknown-wins — an uncounted mutation (a PTC dispatch, or a
73
74
  * diff whose side reports no prior content) poisons that field to undefined
74
75
  * rather than reporting a misleading partial.
75
76
  * @param events - the session's events in ascending seq order.