@yeaft/webchat-agent 1.0.224 → 1.0.227

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.
@@ -17,9 +17,18 @@ export async function handleAgentFileTerminal(agentId, agent, msg) {
17
17
  case 'terminal_created':
18
18
  case 'terminal_output':
19
19
  case 'terminal_closed':
20
- case 'terminal_error':
21
- await forwardToClients(agentId, msg.conversationId, msg);
20
+ case 'terminal_error': {
21
+ const targetClient = msg._requestClientId ? webClients.get(msg._requestClientId) : null;
22
+ const targetMatchesUser = !msg._requestUserId || targetClient?.userId === msg._requestUserId;
23
+ if (targetClient?.authenticated && targetMatchesUser) {
24
+ const { _requestClientId, _requestUserId, ...cleanMsg } = msg;
25
+ await sendToWebClient(targetClient, cleanMsg);
26
+ break;
27
+ }
28
+ const { _requestClientId, ...fallbackMsg } = msg;
29
+ await forwardToClients(agentId, msg.conversationId, fallbackMsg);
22
30
  break;
31
+ }
23
32
 
24
33
  // File operation messages
25
34
  case 'file_content':
@@ -42,7 +42,12 @@ export async function handleClientWorkbench(clientId, client, msg, checkAgentAcc
42
42
  await sendToWebClient(client, { type: 'error', message: 'Permission denied' });
43
43
  return;
44
44
  }
45
- await forwardToAgent(termAgentId, { ...msg, conversationId: termConvId });
45
+ await forwardToAgent(termAgentId, {
46
+ ...msg,
47
+ conversationId: termConvId,
48
+ _requestUserId: client.userId,
49
+ _requestClientId: clientId,
50
+ });
46
51
  break;
47
52
  }
48
53
 
@@ -307,7 +307,8 @@ async function handleAgentMessage(agentId, msg, ws) {
307
307
  'directory_listing', 'folders_list', 'models_list', 'yeaft_output', 'yeaft_session_output', 'session_output', 'yeaft_asset_put',
308
308
  'yeaft_history_chunk', 'yeaft_history_outline', 'yeaft_history_search_result', 'yeaft_history_window', 'slash_commands_update', 'agent_metrics',
309
309
  'file_content', 'file_saved', 'file_op_result', 'file_search_result',
310
- 'git_status_result', 'git_diff_result', 'git_op_result'
310
+ 'git_status_result', 'git_diff_result', 'git_op_result',
311
+ 'terminal_created', 'terminal_output', 'terminal_closed', 'terminal_error'
311
312
  ]);
312
313
  if (msg.conversationId && !CONV_EXEMPT_TYPES.has(msg.type)) {
313
314
  if (!agent.conversations.has(msg.conversationId)) {
@@ -1 +1 @@
1
- {"version":"1.0.224"}
1
+ {"version":"1.0.227"}