@yushaw/sanqian-chat 0.3.1 → 0.3.3

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.
@@ -84,8 +84,18 @@ type MessageRole = 'user' | 'assistant' | 'system' | 'tool';
84
84
  type ToolCallStatus = 'pending' | 'running' | 'completed' | 'error' | 'cancelled';
85
85
  type ConnectionStatus = 'disconnected' | 'connecting' | 'connected' | 'reconnecting' | 'error';
86
86
  type ConnectionErrorCode = 'NOT_FOUND' | 'CONNECTION_FAILED' | 'WEBSOCKET_ERROR' | 'AUTH_ERROR' | 'TIMEOUT' | 'UNKNOWN';
87
+ interface ToolExecutionMetadata {
88
+ commandExitCode?: number;
89
+ durationMs?: number;
90
+ sandboxed?: boolean;
91
+ timedOut?: boolean;
92
+ truncated?: boolean;
93
+ stdoutPath?: string;
94
+ stderrPath?: string;
95
+ presentation?: string;
96
+ }
87
97
  /** Tool call for UI rendering (extended from SDK) */
88
- interface ToolCall {
98
+ interface ToolCall extends ToolExecutionMetadata {
89
99
  id?: string;
90
100
  name: string;
91
101
  args?: Record<string, unknown>;
@@ -98,7 +108,7 @@ interface ToolCall {
98
108
  settingsSubTab?: string;
99
109
  }
100
110
  /** Message block for structured rendering */
101
- interface MessageBlock {
111
+ interface MessageBlock extends ToolExecutionMetadata {
102
112
  type: 'thinking' | 'text' | 'tool_call' | 'tool_result';
103
113
  content: string;
104
114
  timestamp: number;
@@ -107,6 +117,7 @@ interface MessageBlock {
107
117
  toolArgsRaw?: string;
108
118
  toolCallId?: string;
109
119
  toolStatus?: ToolCallStatus;
120
+ actionRequired?: string;
110
121
  isIntermediate?: boolean;
111
122
  fromSubagent?: boolean;
112
123
  }
@@ -541,6 +552,14 @@ type StreamEvent = {
541
552
  action_required?: string;
542
553
  settings_tab?: string;
543
554
  settings_sub_tab?: string;
555
+ command_exit_code?: number;
556
+ duration_ms?: number;
557
+ sandboxed?: boolean;
558
+ timed_out?: boolean;
559
+ truncated?: boolean;
560
+ stdout_path?: string;
561
+ stderr_path?: string;
562
+ presentation?: string;
544
563
  } | {
545
564
  type: 'done';
546
565
  conversationId: string;
@@ -707,4 +726,4 @@ declare function parseToolCalls(toolCalls: unknown): ToolCall[] | undefined;
707
726
  */
708
727
  declare function mergeConsecutiveAssistantMessages(rawMessages: ApiMessage[]): ChatMessage[];
709
728
 
710
- export { type ApiMessage, type AttachConfig, type AttachPosition, type AttachState, type AttachedResource, type AttachmentMenuItem, type AttachmentMenuItemType, type ChatAdapter, type ChatAdapterConfig, type ChatFontSize, type ChatMessage, type ChatPanelConfig, type ChatPanelMode, type ChatPanelPosition, type ChatThemeMode, type ChatUiConfigSerializable, type ChatUiStrings, type ConnectionErrorCode, type ConnectionStatus, type ContextProviderInfo, type ConversationDetail, type ConversationInfo, type FloatingWindowConfig, type HitlInterruptData, type HitlResponseOutcome, type LinkClickEvent, type LinkHandlerConfig, type Locale, type MessageBlock, type MessageRole, type ResourcePickerItem, type ResourcePickerState, type SdkAdapterConfig, type SendMessage, type SessionResource, type SessionResourceEvent, type StoredSessionResource, type StreamEvent, type ToolCall, type ToolCallStatus, type WindowPosition, createChatAdapter, createSdkAdapter, mergeConsecutiveAssistantMessages, parseToolCalls };
729
+ export { type ApiMessage, type AttachConfig, type AttachPosition, type AttachState, type AttachedResource, type AttachmentMenuItem, type AttachmentMenuItemType, type ChatAdapter, type ChatAdapterConfig, type ChatFontSize, type ChatMessage, type ChatPanelConfig, type ChatPanelMode, type ChatPanelPosition, type ChatThemeMode, type ChatUiConfigSerializable, type ChatUiStrings, type ConnectionErrorCode, type ConnectionStatus, type ContextProviderInfo, type ConversationDetail, type ConversationInfo, type FloatingWindowConfig, type HitlInterruptData, type HitlResponseOutcome, type LinkClickEvent, type LinkHandlerConfig, type Locale, type MessageBlock, type MessageRole, type ResourcePickerItem, type ResourcePickerState, type SdkAdapterConfig, type SendMessage, type SessionResource, type SessionResourceEvent, type StoredSessionResource, type StreamEvent, type ToolCall, type ToolCallStatus, type ToolExecutionMetadata, type WindowPosition, createChatAdapter, createSdkAdapter, mergeConsecutiveAssistantMessages, parseToolCalls };
@@ -84,8 +84,18 @@ type MessageRole = 'user' | 'assistant' | 'system' | 'tool';
84
84
  type ToolCallStatus = 'pending' | 'running' | 'completed' | 'error' | 'cancelled';
85
85
  type ConnectionStatus = 'disconnected' | 'connecting' | 'connected' | 'reconnecting' | 'error';
86
86
  type ConnectionErrorCode = 'NOT_FOUND' | 'CONNECTION_FAILED' | 'WEBSOCKET_ERROR' | 'AUTH_ERROR' | 'TIMEOUT' | 'UNKNOWN';
87
+ interface ToolExecutionMetadata {
88
+ commandExitCode?: number;
89
+ durationMs?: number;
90
+ sandboxed?: boolean;
91
+ timedOut?: boolean;
92
+ truncated?: boolean;
93
+ stdoutPath?: string;
94
+ stderrPath?: string;
95
+ presentation?: string;
96
+ }
87
97
  /** Tool call for UI rendering (extended from SDK) */
88
- interface ToolCall {
98
+ interface ToolCall extends ToolExecutionMetadata {
89
99
  id?: string;
90
100
  name: string;
91
101
  args?: Record<string, unknown>;
@@ -98,7 +108,7 @@ interface ToolCall {
98
108
  settingsSubTab?: string;
99
109
  }
100
110
  /** Message block for structured rendering */
101
- interface MessageBlock {
111
+ interface MessageBlock extends ToolExecutionMetadata {
102
112
  type: 'thinking' | 'text' | 'tool_call' | 'tool_result';
103
113
  content: string;
104
114
  timestamp: number;
@@ -107,6 +117,7 @@ interface MessageBlock {
107
117
  toolArgsRaw?: string;
108
118
  toolCallId?: string;
109
119
  toolStatus?: ToolCallStatus;
120
+ actionRequired?: string;
110
121
  isIntermediate?: boolean;
111
122
  fromSubagent?: boolean;
112
123
  }
@@ -541,6 +552,14 @@ type StreamEvent = {
541
552
  action_required?: string;
542
553
  settings_tab?: string;
543
554
  settings_sub_tab?: string;
555
+ command_exit_code?: number;
556
+ duration_ms?: number;
557
+ sandboxed?: boolean;
558
+ timed_out?: boolean;
559
+ truncated?: boolean;
560
+ stdout_path?: string;
561
+ stderr_path?: string;
562
+ presentation?: string;
544
563
  } | {
545
564
  type: 'done';
546
565
  conversationId: string;
@@ -707,4 +726,4 @@ declare function parseToolCalls(toolCalls: unknown): ToolCall[] | undefined;
707
726
  */
708
727
  declare function mergeConsecutiveAssistantMessages(rawMessages: ApiMessage[]): ChatMessage[];
709
728
 
710
- export { type ApiMessage, type AttachConfig, type AttachPosition, type AttachState, type AttachedResource, type AttachmentMenuItem, type AttachmentMenuItemType, type ChatAdapter, type ChatAdapterConfig, type ChatFontSize, type ChatMessage, type ChatPanelConfig, type ChatPanelMode, type ChatPanelPosition, type ChatThemeMode, type ChatUiConfigSerializable, type ChatUiStrings, type ConnectionErrorCode, type ConnectionStatus, type ContextProviderInfo, type ConversationDetail, type ConversationInfo, type FloatingWindowConfig, type HitlInterruptData, type HitlResponseOutcome, type LinkClickEvent, type LinkHandlerConfig, type Locale, type MessageBlock, type MessageRole, type ResourcePickerItem, type ResourcePickerState, type SdkAdapterConfig, type SendMessage, type SessionResource, type SessionResourceEvent, type StoredSessionResource, type StreamEvent, type ToolCall, type ToolCallStatus, type WindowPosition, createChatAdapter, createSdkAdapter, mergeConsecutiveAssistantMessages, parseToolCalls };
729
+ export { type ApiMessage, type AttachConfig, type AttachPosition, type AttachState, type AttachedResource, type AttachmentMenuItem, type AttachmentMenuItemType, type ChatAdapter, type ChatAdapterConfig, type ChatFontSize, type ChatMessage, type ChatPanelConfig, type ChatPanelMode, type ChatPanelPosition, type ChatThemeMode, type ChatUiConfigSerializable, type ChatUiStrings, type ConnectionErrorCode, type ConnectionStatus, type ContextProviderInfo, type ConversationDetail, type ConversationInfo, type FloatingWindowConfig, type HitlInterruptData, type HitlResponseOutcome, type LinkClickEvent, type LinkHandlerConfig, type Locale, type MessageBlock, type MessageRole, type ResourcePickerItem, type ResourcePickerState, type SdkAdapterConfig, type SendMessage, type SessionResource, type SessionResourceEvent, type StoredSessionResource, type StreamEvent, type ToolCall, type ToolCallStatus, type ToolExecutionMetadata, type WindowPosition, createChatAdapter, createSdkAdapter, mergeConsecutiveAssistantMessages, parseToolCalls };
@@ -38,6 +38,7 @@ __export(core_exports, {
38
38
  module.exports = __toCommonJS(core_exports);
39
39
 
40
40
  // src/core/tool-status.ts
41
+ var BLOCKING_ACTION_REQUIRED = /* @__PURE__ */ new Set(["install_git_bash"]);
41
42
  function normalizeToolExecutionStatus(status) {
42
43
  if (typeof status !== "string") return void 0;
43
44
  switch (status.trim().toLowerCase()) {
@@ -60,7 +61,7 @@ function normalizeToolExecutionStatus(status) {
60
61
  }
61
62
  }
62
63
  function deriveToolExecutionStatus(options) {
63
- if (typeof options.actionRequired === "string" && options.actionRequired.length > 0) {
64
+ if (typeof options.actionRequired === "string" && BLOCKING_ACTION_REQUIRED.has(options.actionRequired)) {
64
65
  return "error";
65
66
  }
66
67
  if (options.error === true) {
@@ -86,6 +87,27 @@ function deriveToolExecutionStatus(options) {
86
87
  }
87
88
 
88
89
  // src/core/history.ts
90
+ function readToolExecutionNumber(value) {
91
+ return typeof value === "number" && Number.isFinite(value) ? value : void 0;
92
+ }
93
+ function readToolExecutionBoolean(value) {
94
+ return typeof value === "boolean" ? value : void 0;
95
+ }
96
+ function readToolExecutionString(value) {
97
+ return typeof value === "string" && value.trim().length > 0 ? value : void 0;
98
+ }
99
+ function readToolExecutionMetadata(tc) {
100
+ return {
101
+ commandExitCode: readToolExecutionNumber(tc.command_exit_code ?? tc.commandExitCode),
102
+ durationMs: readToolExecutionNumber(tc.duration_ms ?? tc.durationMs),
103
+ sandboxed: readToolExecutionBoolean(tc.sandboxed),
104
+ timedOut: readToolExecutionBoolean(tc.timed_out ?? tc.timedOut),
105
+ truncated: readToolExecutionBoolean(tc.truncated),
106
+ stdoutPath: readToolExecutionString(tc.stdout_path ?? tc.stdoutPath),
107
+ stderrPath: readToolExecutionString(tc.stderr_path ?? tc.stderrPath),
108
+ presentation: readToolExecutionString(tc.presentation)
109
+ };
110
+ }
89
111
  function safeParseArgs(value) {
90
112
  if (!value) return void 0;
91
113
  if (typeof value === "object") return value;
@@ -133,7 +155,8 @@ function parseToolCalls(toolCalls) {
133
155
  actionRequired,
134
156
  error: tc.error,
135
157
  fallback: "completed"
136
- })
158
+ }),
159
+ ...readToolExecutionMetadata(tc)
137
160
  };
138
161
  }).filter((tc) => tc.name || tc.id);
139
162
  }
@@ -201,6 +224,10 @@ function mergeConsecutiveAssistantMessages(rawMessages) {
201
224
  const consecutiveAssistantMsgs = [msg];
202
225
  const toolMessages = [];
203
226
  let j = i + 1;
227
+ const hasDeclaredToolCalls = (message) => {
228
+ const calls = parseToolCalls(message.toolCalls || message.tool_calls);
229
+ return Boolean(calls && calls.length > 0);
230
+ };
204
231
  while (j < rawMessages.length) {
205
232
  if (rawMessages[j].role === "assistant") {
206
233
  consecutiveAssistantMsgs.push(rawMessages[j]);
@@ -216,11 +243,12 @@ function mergeConsecutiveAssistantMessages(rawMessages) {
216
243
  let blockTime = Date.now();
217
244
  let fallbackToolCalls;
218
245
  let lastEffectiveToolCalls;
246
+ const groupHasDeclaredToolCalls = consecutiveAssistantMsgs.some(hasDeclaredToolCalls);
219
247
  for (let k = 0; k < consecutiveAssistantMsgs.length; k++) {
220
248
  const assistantMsg = consecutiveAssistantMsgs[k];
221
249
  const msgToolCalls = parseToolCalls(assistantMsg.toolCalls || assistantMsg.tool_calls);
222
250
  const isLastAssistant = k === consecutiveAssistantMsgs.length - 1;
223
- const fallbackCalls = isLastAssistant && toolMessages.length > 0 ? toolMessages.map((toolMessage, idx) => ({
251
+ const fallbackCalls = !groupHasDeclaredToolCalls && isLastAssistant && toolMessages.length > 0 ? toolMessages.map((toolMessage, idx) => ({
224
252
  id: (toolMessage.tool_call_id || void 0) ?? `tool-${idx}`,
225
253
  name: "",
226
254
  args: void 0,
@@ -278,7 +306,16 @@ function mergeConsecutiveAssistantMessages(rawMessages) {
278
306
  toolArgs: tc.args,
279
307
  toolCallId: tc.id,
280
308
  toolStatus,
281
- isIntermediate: true
309
+ actionRequired: tc.actionRequired,
310
+ isIntermediate: true,
311
+ commandExitCode: tc.commandExitCode,
312
+ durationMs: tc.durationMs,
313
+ sandboxed: tc.sandboxed,
314
+ timedOut: tc.timedOut,
315
+ truncated: tc.truncated,
316
+ stdoutPath: tc.stdoutPath,
317
+ stderrPath: tc.stderrPath,
318
+ presentation: tc.presentation
282
319
  });
283
320
  const resultContent = tc.result ?? toolResult?.content;
284
321
  const toolResultId = toolResult?.tool_call_id || void 0;
@@ -289,7 +326,16 @@ function mergeConsecutiveAssistantMessages(rawMessages) {
289
326
  timestamp: blockTime++,
290
327
  toolName: tc.name,
291
328
  toolCallId: tc.id || toolResultId,
292
- isIntermediate: true
329
+ actionRequired: tc.actionRequired,
330
+ isIntermediate: true,
331
+ commandExitCode: tc.commandExitCode,
332
+ durationMs: tc.durationMs,
333
+ sandboxed: tc.sandboxed,
334
+ timedOut: tc.timedOut,
335
+ truncated: tc.truncated,
336
+ stdoutPath: tc.stdoutPath,
337
+ stderrPath: tc.stderrPath,
338
+ presentation: tc.presentation
293
339
  });
294
340
  tc.result = resultContent;
295
341
  }
@@ -656,7 +702,15 @@ function processStreamEvents(stream, onEvent, sdk, setCurrentRunId, streamId) {
656
702
  status: toolResultEvent.status,
657
703
  action_required: toolResultEvent.action_required,
658
704
  settings_tab: toolResultEvent.settings_tab,
659
- settings_sub_tab: toolResultEvent.settings_sub_tab
705
+ settings_sub_tab: toolResultEvent.settings_sub_tab,
706
+ command_exit_code: toolResultEvent.command_exit_code,
707
+ duration_ms: toolResultEvent.duration_ms,
708
+ sandboxed: toolResultEvent.sandboxed,
709
+ timed_out: toolResultEvent.timed_out,
710
+ truncated: toolResultEvent.truncated,
711
+ stdout_path: toolResultEvent.stdout_path,
712
+ stderr_path: toolResultEvent.stderr_path,
713
+ presentation: toolResultEvent.presentation
660
714
  });
661
715
  break;
662
716
  }
@@ -1,4 +1,5 @@
1
1
  // src/core/tool-status.ts
2
+ var BLOCKING_ACTION_REQUIRED = /* @__PURE__ */ new Set(["install_git_bash"]);
2
3
  function normalizeToolExecutionStatus(status) {
3
4
  if (typeof status !== "string") return void 0;
4
5
  switch (status.trim().toLowerCase()) {
@@ -21,7 +22,7 @@ function normalizeToolExecutionStatus(status) {
21
22
  }
22
23
  }
23
24
  function deriveToolExecutionStatus(options) {
24
- if (typeof options.actionRequired === "string" && options.actionRequired.length > 0) {
25
+ if (typeof options.actionRequired === "string" && BLOCKING_ACTION_REQUIRED.has(options.actionRequired)) {
25
26
  return "error";
26
27
  }
27
28
  if (options.error === true) {
@@ -47,6 +48,27 @@ function deriveToolExecutionStatus(options) {
47
48
  }
48
49
 
49
50
  // src/core/history.ts
51
+ function readToolExecutionNumber(value) {
52
+ return typeof value === "number" && Number.isFinite(value) ? value : void 0;
53
+ }
54
+ function readToolExecutionBoolean(value) {
55
+ return typeof value === "boolean" ? value : void 0;
56
+ }
57
+ function readToolExecutionString(value) {
58
+ return typeof value === "string" && value.trim().length > 0 ? value : void 0;
59
+ }
60
+ function readToolExecutionMetadata(tc) {
61
+ return {
62
+ commandExitCode: readToolExecutionNumber(tc.command_exit_code ?? tc.commandExitCode),
63
+ durationMs: readToolExecutionNumber(tc.duration_ms ?? tc.durationMs),
64
+ sandboxed: readToolExecutionBoolean(tc.sandboxed),
65
+ timedOut: readToolExecutionBoolean(tc.timed_out ?? tc.timedOut),
66
+ truncated: readToolExecutionBoolean(tc.truncated),
67
+ stdoutPath: readToolExecutionString(tc.stdout_path ?? tc.stdoutPath),
68
+ stderrPath: readToolExecutionString(tc.stderr_path ?? tc.stderrPath),
69
+ presentation: readToolExecutionString(tc.presentation)
70
+ };
71
+ }
50
72
  function safeParseArgs(value) {
51
73
  if (!value) return void 0;
52
74
  if (typeof value === "object") return value;
@@ -94,7 +116,8 @@ function parseToolCalls(toolCalls) {
94
116
  actionRequired,
95
117
  error: tc.error,
96
118
  fallback: "completed"
97
- })
119
+ }),
120
+ ...readToolExecutionMetadata(tc)
98
121
  };
99
122
  }).filter((tc) => tc.name || tc.id);
100
123
  }
@@ -162,6 +185,10 @@ function mergeConsecutiveAssistantMessages(rawMessages) {
162
185
  const consecutiveAssistantMsgs = [msg];
163
186
  const toolMessages = [];
164
187
  let j = i + 1;
188
+ const hasDeclaredToolCalls = (message) => {
189
+ const calls = parseToolCalls(message.toolCalls || message.tool_calls);
190
+ return Boolean(calls && calls.length > 0);
191
+ };
165
192
  while (j < rawMessages.length) {
166
193
  if (rawMessages[j].role === "assistant") {
167
194
  consecutiveAssistantMsgs.push(rawMessages[j]);
@@ -177,11 +204,12 @@ function mergeConsecutiveAssistantMessages(rawMessages) {
177
204
  let blockTime = Date.now();
178
205
  let fallbackToolCalls;
179
206
  let lastEffectiveToolCalls;
207
+ const groupHasDeclaredToolCalls = consecutiveAssistantMsgs.some(hasDeclaredToolCalls);
180
208
  for (let k = 0; k < consecutiveAssistantMsgs.length; k++) {
181
209
  const assistantMsg = consecutiveAssistantMsgs[k];
182
210
  const msgToolCalls = parseToolCalls(assistantMsg.toolCalls || assistantMsg.tool_calls);
183
211
  const isLastAssistant = k === consecutiveAssistantMsgs.length - 1;
184
- const fallbackCalls = isLastAssistant && toolMessages.length > 0 ? toolMessages.map((toolMessage, idx) => ({
212
+ const fallbackCalls = !groupHasDeclaredToolCalls && isLastAssistant && toolMessages.length > 0 ? toolMessages.map((toolMessage, idx) => ({
185
213
  id: (toolMessage.tool_call_id || void 0) ?? `tool-${idx}`,
186
214
  name: "",
187
215
  args: void 0,
@@ -239,7 +267,16 @@ function mergeConsecutiveAssistantMessages(rawMessages) {
239
267
  toolArgs: tc.args,
240
268
  toolCallId: tc.id,
241
269
  toolStatus,
242
- isIntermediate: true
270
+ actionRequired: tc.actionRequired,
271
+ isIntermediate: true,
272
+ commandExitCode: tc.commandExitCode,
273
+ durationMs: tc.durationMs,
274
+ sandboxed: tc.sandboxed,
275
+ timedOut: tc.timedOut,
276
+ truncated: tc.truncated,
277
+ stdoutPath: tc.stdoutPath,
278
+ stderrPath: tc.stderrPath,
279
+ presentation: tc.presentation
243
280
  });
244
281
  const resultContent = tc.result ?? toolResult?.content;
245
282
  const toolResultId = toolResult?.tool_call_id || void 0;
@@ -250,7 +287,16 @@ function mergeConsecutiveAssistantMessages(rawMessages) {
250
287
  timestamp: blockTime++,
251
288
  toolName: tc.name,
252
289
  toolCallId: tc.id || toolResultId,
253
- isIntermediate: true
290
+ actionRequired: tc.actionRequired,
291
+ isIntermediate: true,
292
+ commandExitCode: tc.commandExitCode,
293
+ durationMs: tc.durationMs,
294
+ sandboxed: tc.sandboxed,
295
+ timedOut: tc.timedOut,
296
+ truncated: tc.truncated,
297
+ stdoutPath: tc.stdoutPath,
298
+ stderrPath: tc.stderrPath,
299
+ presentation: tc.presentation
254
300
  });
255
301
  tc.result = resultContent;
256
302
  }
@@ -617,7 +663,15 @@ function processStreamEvents(stream, onEvent, sdk, setCurrentRunId, streamId) {
617
663
  status: toolResultEvent.status,
618
664
  action_required: toolResultEvent.action_required,
619
665
  settings_tab: toolResultEvent.settings_tab,
620
- settings_sub_tab: toolResultEvent.settings_sub_tab
666
+ settings_sub_tab: toolResultEvent.settings_sub_tab,
667
+ command_exit_code: toolResultEvent.command_exit_code,
668
+ duration_ms: toolResultEvent.duration_ms,
669
+ sandboxed: toolResultEvent.sandboxed,
670
+ timed_out: toolResultEvent.timed_out,
671
+ truncated: toolResultEvent.truncated,
672
+ stdout_path: toolResultEvent.stdout_path,
673
+ stderr_path: toolResultEvent.stderr_path,
674
+ presentation: toolResultEvent.presentation
621
675
  });
622
676
  break;
623
677
  }
@@ -627,7 +627,15 @@ function registerStreamIpcHandlers(ipcMainHandle, ctx) {
627
627
  status: evt.status,
628
628
  action_required: evt.action_required,
629
629
  settings_tab: evt.settings_tab,
630
- settings_sub_tab: evt.settings_sub_tab
630
+ settings_sub_tab: evt.settings_sub_tab,
631
+ command_exit_code: evt.command_exit_code,
632
+ duration_ms: evt.duration_ms,
633
+ sandboxed: evt.sandboxed,
634
+ timed_out: evt.timed_out,
635
+ truncated: evt.truncated,
636
+ stdout_path: evt.stdout_path,
637
+ stderr_path: evt.stderr_path,
638
+ presentation: evt.presentation
631
639
  }
632
640
  });
633
641
  break;
@@ -596,7 +596,15 @@ function registerStreamIpcHandlers(ipcMainHandle, ctx) {
596
596
  status: evt.status,
597
597
  action_required: evt.action_required,
598
598
  settings_tab: evt.settings_tab,
599
- settings_sub_tab: evt.settings_sub_tab
599
+ settings_sub_tab: evt.settings_sub_tab,
600
+ command_exit_code: evt.command_exit_code,
601
+ duration_ms: evt.duration_ms,
602
+ sandboxed: evt.sandboxed,
603
+ timed_out: evt.timed_out,
604
+ truncated: evt.truncated,
605
+ stdout_path: evt.stdout_path,
606
+ stderr_path: evt.stderr_path,
607
+ presentation: evt.presentation
600
608
  }
601
609
  });
602
610
  break;
@@ -87,8 +87,18 @@ type MessageRole = 'user' | 'assistant' | 'system' | 'tool';
87
87
  type ToolCallStatus = 'pending' | 'running' | 'completed' | 'error' | 'cancelled';
88
88
  type ConnectionStatus = 'disconnected' | 'connecting' | 'connected' | 'reconnecting' | 'error';
89
89
  type ConnectionErrorCode = 'NOT_FOUND' | 'CONNECTION_FAILED' | 'WEBSOCKET_ERROR' | 'AUTH_ERROR' | 'TIMEOUT' | 'UNKNOWN';
90
+ interface ToolExecutionMetadata {
91
+ commandExitCode?: number;
92
+ durationMs?: number;
93
+ sandboxed?: boolean;
94
+ timedOut?: boolean;
95
+ truncated?: boolean;
96
+ stdoutPath?: string;
97
+ stderrPath?: string;
98
+ presentation?: string;
99
+ }
90
100
  /** Tool call for UI rendering (extended from SDK) */
91
- interface ToolCall {
101
+ interface ToolCall extends ToolExecutionMetadata {
92
102
  id?: string;
93
103
  name: string;
94
104
  args?: Record<string, unknown>;
@@ -101,7 +111,7 @@ interface ToolCall {
101
111
  settingsSubTab?: string;
102
112
  }
103
113
  /** Message block for structured rendering */
104
- interface MessageBlock {
114
+ interface MessageBlock extends ToolExecutionMetadata {
105
115
  type: 'thinking' | 'text' | 'tool_call' | 'tool_result';
106
116
  content: string;
107
117
  timestamp: number;
@@ -110,6 +120,7 @@ interface MessageBlock {
110
120
  toolArgsRaw?: string;
111
121
  toolCallId?: string;
112
122
  toolStatus?: ToolCallStatus;
123
+ actionRequired?: string;
113
124
  isIntermediate?: boolean;
114
125
  fromSubagent?: boolean;
115
126
  }
@@ -544,6 +555,14 @@ type StreamEvent = {
544
555
  action_required?: string;
545
556
  settings_tab?: string;
546
557
  settings_sub_tab?: string;
558
+ command_exit_code?: number;
559
+ duration_ms?: number;
560
+ sandboxed?: boolean;
561
+ timed_out?: boolean;
562
+ truncated?: boolean;
563
+ stdout_path?: string;
564
+ stderr_path?: string;
565
+ presentation?: string;
547
566
  } | {
548
567
  type: 'done';
549
568
  conversationId: string;
@@ -1749,4 +1768,4 @@ declare function ensureChatBaseStyles(): void;
1749
1768
  */
1750
1769
  declare function ensureFullChatStyles(): void;
1751
1770
 
1752
- export { AddResourceButton, type AddResourceButtonProps, type AlertAction, AlertBanner, type AlertBannerProps, type AlertConfig, type AlertType, AttachButton, type AttachButtonProps, type AttachConfig, type AttachPosition, type AttachState, type AttachedResource, AttachedResourceTags, type AttachedResourceTagsProps, type AttachmentMenuItem, type AttachmentMenuItemType, type ChatAdapter, type ChatAdapterConfig, type ChatFontSize, ChatInput, type ChatInputHandle, type ChatInputProps, type ChatPanelConfig, type ChatPanelMode, type ChatPanelPosition, type ChatThemeMode, type ChatUiConfig, type ChatUiConfigSerializable, type ChatUiStrings, CompactChat, type CompactChatController, type CompactChatHistoryConfig, type CompactChatProps, type CompactChatStateSnapshot, type ConnectionErrorCode, type ConnectionStatus, type ContextProviderInfo, type ConversationChangeMeta, type ConversationDetail, type ConversationInfo, type ConversationSwitchOptions, FloatingChat, type FloatingChatProps, type FloatingWindowConfig, HistoryList, type HistoryListProps, HistoryModal, type HistoryModalProps, HitlCard, type HitlCardProps, type HitlInterruptData, I18nProvider, type I18nProviderProps, IntermediateSteps, type IntermediateStepsProps, type LinkClickEvent, type LinkHandlerConfig, type Locale, MarkdownRenderer, type MarkdownRendererProps, type MessageBlock, MessageBubble, type MessageBubbleProps, MessageList, type MessageListProps, type MessageRole, ModeToggleButton, type ModeToggleButtonProps, PanelControls, type PanelControlsProps, PanelHeaderButtons, PanelResizer, Resizer, type ResizerProps, type ResolvedTheme, ResourceChip, ResourceChipList, type ResourceChipListProps, type ResourceChipProps, ResourcePicker, type ResourcePickerItem, type ResourcePickerProps, type ResourcePickerState, SanqianChat, SanqianChatMessage, type SanqianChatMessageProps, type SanqianChatProps, SanqianMessageList, type SanqianMessageListHandle, type SanqianMessageListProps, type SdkAdapterConfig, type SendMessage, type SendMessageOptions, type SessionResource, type SessionResourceEvent, type StoredSessionResource, type StreamEvent, StreamingTimeline, type StreamingTimelineProps, type ThemeMode, ThemeProvider, type ThemeProviderProps, ThinkingSection, type ThinkingSectionProps, ToolArgumentsDisplay, type ToolArgumentsDisplayProps, type ToolCall, type ToolCallStatus, type Translations, type UseAttachStateReturn, type UseChatCapabilities, type UseChatOptions, type UseChatPanelReturn, type UseChatReturn, type UseConnectionOptions, type UseConnectionReturn, type UseConversationsOptions, type UseConversationsReturn, type UseFocusPersistenceOptions, type UseResourcePickerOptions, type UseResourcePickerReturn, type WindowPosition, createChatAdapter, createIpcAdapter, createSdkAdapter, ensureChatBaseStyles, ensureFullChatStyles, getTranslations, resolveChatStrings, useAttachState, useChat, useChatPanel, useChatStyles, useConnection, useConversations, useFocusPersistence, useI18n, useIpcUiConfig, useResolvedUiConfig, useResourcePicker, useStandaloneI18n, useStandaloneTheme, useTheme, useWindowDragLock };
1771
+ export { AddResourceButton, type AddResourceButtonProps, type AlertAction, AlertBanner, type AlertBannerProps, type AlertConfig, type AlertType, AttachButton, type AttachButtonProps, type AttachConfig, type AttachPosition, type AttachState, type AttachedResource, AttachedResourceTags, type AttachedResourceTagsProps, type AttachmentMenuItem, type AttachmentMenuItemType, type ChatAdapter, type ChatAdapterConfig, type ChatFontSize, ChatInput, type ChatInputHandle, type ChatInputProps, type ChatPanelConfig, type ChatPanelMode, type ChatPanelPosition, type ChatThemeMode, type ChatUiConfig, type ChatUiConfigSerializable, type ChatUiStrings, CompactChat, type CompactChatController, type CompactChatHistoryConfig, type CompactChatProps, type CompactChatStateSnapshot, type ConnectionErrorCode, type ConnectionStatus, type ContextProviderInfo, type ConversationChangeMeta, type ConversationDetail, type ConversationInfo, type ConversationSwitchOptions, FloatingChat, type FloatingChatProps, type FloatingWindowConfig, HistoryList, type HistoryListProps, HistoryModal, type HistoryModalProps, HitlCard, type HitlCardProps, type HitlInterruptData, I18nProvider, type I18nProviderProps, IntermediateSteps, type IntermediateStepsProps, type LinkClickEvent, type LinkHandlerConfig, type Locale, MarkdownRenderer, type MarkdownRendererProps, type MessageBlock, MessageBubble, type MessageBubbleProps, MessageList, type MessageListProps, type MessageRole, ModeToggleButton, type ModeToggleButtonProps, PanelControls, type PanelControlsProps, PanelHeaderButtons, PanelResizer, Resizer, type ResizerProps, type ResolvedTheme, ResourceChip, ResourceChipList, type ResourceChipListProps, type ResourceChipProps, ResourcePicker, type ResourcePickerItem, type ResourcePickerProps, type ResourcePickerState, SanqianChat, SanqianChatMessage, type SanqianChatMessageProps, type SanqianChatProps, SanqianMessageList, type SanqianMessageListHandle, type SanqianMessageListProps, type SdkAdapterConfig, type SendMessage, type SendMessageOptions, type SessionResource, type SessionResourceEvent, type StoredSessionResource, type StreamEvent, StreamingTimeline, type StreamingTimelineProps, type ThemeMode, ThemeProvider, type ThemeProviderProps, ThinkingSection, type ThinkingSectionProps, ToolArgumentsDisplay, type ToolArgumentsDisplayProps, type ToolCall, type ToolCallStatus, type ToolExecutionMetadata, type Translations, type UseAttachStateReturn, type UseChatCapabilities, type UseChatOptions, type UseChatPanelReturn, type UseChatReturn, type UseConnectionOptions, type UseConnectionReturn, type UseConversationsOptions, type UseConversationsReturn, type UseFocusPersistenceOptions, type UseResourcePickerOptions, type UseResourcePickerReturn, type WindowPosition, createChatAdapter, createIpcAdapter, createSdkAdapter, ensureChatBaseStyles, ensureFullChatStyles, getTranslations, resolveChatStrings, useAttachState, useChat, useChatPanel, useChatStyles, useConnection, useConversations, useFocusPersistence, useI18n, useIpcUiConfig, useResolvedUiConfig, useResourcePicker, useStandaloneI18n, useStandaloneTheme, useTheme, useWindowDragLock };
@@ -87,8 +87,18 @@ type MessageRole = 'user' | 'assistant' | 'system' | 'tool';
87
87
  type ToolCallStatus = 'pending' | 'running' | 'completed' | 'error' | 'cancelled';
88
88
  type ConnectionStatus = 'disconnected' | 'connecting' | 'connected' | 'reconnecting' | 'error';
89
89
  type ConnectionErrorCode = 'NOT_FOUND' | 'CONNECTION_FAILED' | 'WEBSOCKET_ERROR' | 'AUTH_ERROR' | 'TIMEOUT' | 'UNKNOWN';
90
+ interface ToolExecutionMetadata {
91
+ commandExitCode?: number;
92
+ durationMs?: number;
93
+ sandboxed?: boolean;
94
+ timedOut?: boolean;
95
+ truncated?: boolean;
96
+ stdoutPath?: string;
97
+ stderrPath?: string;
98
+ presentation?: string;
99
+ }
90
100
  /** Tool call for UI rendering (extended from SDK) */
91
- interface ToolCall {
101
+ interface ToolCall extends ToolExecutionMetadata {
92
102
  id?: string;
93
103
  name: string;
94
104
  args?: Record<string, unknown>;
@@ -101,7 +111,7 @@ interface ToolCall {
101
111
  settingsSubTab?: string;
102
112
  }
103
113
  /** Message block for structured rendering */
104
- interface MessageBlock {
114
+ interface MessageBlock extends ToolExecutionMetadata {
105
115
  type: 'thinking' | 'text' | 'tool_call' | 'tool_result';
106
116
  content: string;
107
117
  timestamp: number;
@@ -110,6 +120,7 @@ interface MessageBlock {
110
120
  toolArgsRaw?: string;
111
121
  toolCallId?: string;
112
122
  toolStatus?: ToolCallStatus;
123
+ actionRequired?: string;
113
124
  isIntermediate?: boolean;
114
125
  fromSubagent?: boolean;
115
126
  }
@@ -544,6 +555,14 @@ type StreamEvent = {
544
555
  action_required?: string;
545
556
  settings_tab?: string;
546
557
  settings_sub_tab?: string;
558
+ command_exit_code?: number;
559
+ duration_ms?: number;
560
+ sandboxed?: boolean;
561
+ timed_out?: boolean;
562
+ truncated?: boolean;
563
+ stdout_path?: string;
564
+ stderr_path?: string;
565
+ presentation?: string;
547
566
  } | {
548
567
  type: 'done';
549
568
  conversationId: string;
@@ -1749,4 +1768,4 @@ declare function ensureChatBaseStyles(): void;
1749
1768
  */
1750
1769
  declare function ensureFullChatStyles(): void;
1751
1770
 
1752
- export { AddResourceButton, type AddResourceButtonProps, type AlertAction, AlertBanner, type AlertBannerProps, type AlertConfig, type AlertType, AttachButton, type AttachButtonProps, type AttachConfig, type AttachPosition, type AttachState, type AttachedResource, AttachedResourceTags, type AttachedResourceTagsProps, type AttachmentMenuItem, type AttachmentMenuItemType, type ChatAdapter, type ChatAdapterConfig, type ChatFontSize, ChatInput, type ChatInputHandle, type ChatInputProps, type ChatPanelConfig, type ChatPanelMode, type ChatPanelPosition, type ChatThemeMode, type ChatUiConfig, type ChatUiConfigSerializable, type ChatUiStrings, CompactChat, type CompactChatController, type CompactChatHistoryConfig, type CompactChatProps, type CompactChatStateSnapshot, type ConnectionErrorCode, type ConnectionStatus, type ContextProviderInfo, type ConversationChangeMeta, type ConversationDetail, type ConversationInfo, type ConversationSwitchOptions, FloatingChat, type FloatingChatProps, type FloatingWindowConfig, HistoryList, type HistoryListProps, HistoryModal, type HistoryModalProps, HitlCard, type HitlCardProps, type HitlInterruptData, I18nProvider, type I18nProviderProps, IntermediateSteps, type IntermediateStepsProps, type LinkClickEvent, type LinkHandlerConfig, type Locale, MarkdownRenderer, type MarkdownRendererProps, type MessageBlock, MessageBubble, type MessageBubbleProps, MessageList, type MessageListProps, type MessageRole, ModeToggleButton, type ModeToggleButtonProps, PanelControls, type PanelControlsProps, PanelHeaderButtons, PanelResizer, Resizer, type ResizerProps, type ResolvedTheme, ResourceChip, ResourceChipList, type ResourceChipListProps, type ResourceChipProps, ResourcePicker, type ResourcePickerItem, type ResourcePickerProps, type ResourcePickerState, SanqianChat, SanqianChatMessage, type SanqianChatMessageProps, type SanqianChatProps, SanqianMessageList, type SanqianMessageListHandle, type SanqianMessageListProps, type SdkAdapterConfig, type SendMessage, type SendMessageOptions, type SessionResource, type SessionResourceEvent, type StoredSessionResource, type StreamEvent, StreamingTimeline, type StreamingTimelineProps, type ThemeMode, ThemeProvider, type ThemeProviderProps, ThinkingSection, type ThinkingSectionProps, ToolArgumentsDisplay, type ToolArgumentsDisplayProps, type ToolCall, type ToolCallStatus, type Translations, type UseAttachStateReturn, type UseChatCapabilities, type UseChatOptions, type UseChatPanelReturn, type UseChatReturn, type UseConnectionOptions, type UseConnectionReturn, type UseConversationsOptions, type UseConversationsReturn, type UseFocusPersistenceOptions, type UseResourcePickerOptions, type UseResourcePickerReturn, type WindowPosition, createChatAdapter, createIpcAdapter, createSdkAdapter, ensureChatBaseStyles, ensureFullChatStyles, getTranslations, resolveChatStrings, useAttachState, useChat, useChatPanel, useChatStyles, useConnection, useConversations, useFocusPersistence, useI18n, useIpcUiConfig, useResolvedUiConfig, useResourcePicker, useStandaloneI18n, useStandaloneTheme, useTheme, useWindowDragLock };
1771
+ export { AddResourceButton, type AddResourceButtonProps, type AlertAction, AlertBanner, type AlertBannerProps, type AlertConfig, type AlertType, AttachButton, type AttachButtonProps, type AttachConfig, type AttachPosition, type AttachState, type AttachedResource, AttachedResourceTags, type AttachedResourceTagsProps, type AttachmentMenuItem, type AttachmentMenuItemType, type ChatAdapter, type ChatAdapterConfig, type ChatFontSize, ChatInput, type ChatInputHandle, type ChatInputProps, type ChatPanelConfig, type ChatPanelMode, type ChatPanelPosition, type ChatThemeMode, type ChatUiConfig, type ChatUiConfigSerializable, type ChatUiStrings, CompactChat, type CompactChatController, type CompactChatHistoryConfig, type CompactChatProps, type CompactChatStateSnapshot, type ConnectionErrorCode, type ConnectionStatus, type ContextProviderInfo, type ConversationChangeMeta, type ConversationDetail, type ConversationInfo, type ConversationSwitchOptions, FloatingChat, type FloatingChatProps, type FloatingWindowConfig, HistoryList, type HistoryListProps, HistoryModal, type HistoryModalProps, HitlCard, type HitlCardProps, type HitlInterruptData, I18nProvider, type I18nProviderProps, IntermediateSteps, type IntermediateStepsProps, type LinkClickEvent, type LinkHandlerConfig, type Locale, MarkdownRenderer, type MarkdownRendererProps, type MessageBlock, MessageBubble, type MessageBubbleProps, MessageList, type MessageListProps, type MessageRole, ModeToggleButton, type ModeToggleButtonProps, PanelControls, type PanelControlsProps, PanelHeaderButtons, PanelResizer, Resizer, type ResizerProps, type ResolvedTheme, ResourceChip, ResourceChipList, type ResourceChipListProps, type ResourceChipProps, ResourcePicker, type ResourcePickerItem, type ResourcePickerProps, type ResourcePickerState, SanqianChat, SanqianChatMessage, type SanqianChatMessageProps, type SanqianChatProps, SanqianMessageList, type SanqianMessageListHandle, type SanqianMessageListProps, type SdkAdapterConfig, type SendMessage, type SendMessageOptions, type SessionResource, type SessionResourceEvent, type StoredSessionResource, type StreamEvent, StreamingTimeline, type StreamingTimelineProps, type ThemeMode, ThemeProvider, type ThemeProviderProps, ThinkingSection, type ThinkingSectionProps, ToolArgumentsDisplay, type ToolArgumentsDisplayProps, type ToolCall, type ToolCallStatus, type ToolExecutionMetadata, type Translations, type UseAttachStateReturn, type UseChatCapabilities, type UseChatOptions, type UseChatPanelReturn, type UseChatReturn, type UseConnectionOptions, type UseConnectionReturn, type UseConversationsOptions, type UseConversationsReturn, type UseFocusPersistenceOptions, type UseResourcePickerOptions, type UseResourcePickerReturn, type WindowPosition, createChatAdapter, createIpcAdapter, createSdkAdapter, ensureChatBaseStyles, ensureFullChatStyles, getTranslations, resolveChatStrings, useAttachState, useChat, useChatPanel, useChatStyles, useConnection, useConversations, useFocusPersistence, useI18n, useIpcUiConfig, useResolvedUiConfig, useResourcePicker, useStandaloneI18n, useStandaloneTheme, useTheme, useWindowDragLock };