@yeaft/webchat-agent 1.0.195 → 1.0.197

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.
@@ -285,37 +285,53 @@ export async function handleAgentOutput(agentId, agent, msg) {
285
285
  await forwardToClients(agentId, msg.conversationId, msg);
286
286
  break;
287
287
 
288
- case 'slash_commands_update':
289
- // 缓存到 agent 对象上,供 web 端选择 agent 时立即获取
290
- agent.slashCommands = msg.slashCommands || [];
291
- if (msg.slashCommandDescriptions) {
292
- agent.slashCommandDescriptions = { ...agent.slashCommandDescriptions, ...msg.slashCommandDescriptions };
288
+ case 'slash_commands_update': {
289
+ const isYeaftCommandSet = msg.commandSet === 'yeaft';
290
+ let slashCommandDescriptions;
291
+ if (isYeaftCommandSet) {
292
+ // Yeaft publishes an authoritative hot-reload snapshot. Keep it out of
293
+ // the Claude cache used by agent_selected and clear removed descriptions.
294
+ agent.yeaftSlashCommands = msg.slashCommands || [];
295
+ if (msg.slashCommandDescriptions) {
296
+ agent.yeaftSlashCommandDescriptions = { ...msg.slashCommandDescriptions };
297
+ }
298
+ slashCommandDescriptions = agent.yeaftSlashCommandDescriptions || {};
299
+ } else {
300
+ // Claude Chat remains the legacy/default command set selected clients receive.
301
+ agent.slashCommands = msg.slashCommands || [];
302
+ if (msg.slashCommandDescriptions) {
303
+ agent.slashCommandDescriptions = { ...agent.slashCommandDescriptions, ...msg.slashCommandDescriptions };
304
+ }
305
+ slashCommandDescriptions = agent.slashCommandDescriptions || {};
293
306
  }
307
+ const commandSet = msg.commandSet ? { commandSet: msg.commandSet } : {};
294
308
  if (msg.conversationId === '__preload__') {
295
- // Agent-level preload: broadcast to all owner clients with agentId
309
+ // Agent-level preload: broadcast to all owner clients with agentId.
296
310
  for (const [, client] of webClients) {
297
311
  if (client.authenticated && (CONFIG.skipAuth || agent.ownerId === client.userId)) {
298
312
  await sendToWebClient(client, {
299
313
  type: 'slash_commands_update',
300
314
  agentId,
315
+ ...commandSet,
301
316
  slashCommands: msg.slashCommands,
302
- slashCommandDescriptions: agent.slashCommandDescriptions || {}
317
+ slashCommandDescriptions,
303
318
  });
304
319
  }
305
320
  }
306
321
  } else {
307
- // Per-conversation update. Stamp agentId too so
308
- // Yeaft's temporary/local conversation id cannot hide the agent-level
309
- // fallback command list in the web store.
322
+ // Per-conversation update. Preserve commandSet so the web store can
323
+ // isolate Yeaft snapshots from the Claude agent-level fallback.
310
324
  await forwardToClients(agentId, msg.conversationId, {
311
325
  type: 'slash_commands_update',
312
326
  agentId,
313
327
  conversationId: msg.conversationId,
328
+ ...commandSet,
314
329
  slashCommands: msg.slashCommands,
315
- slashCommandDescriptions: agent.slashCommandDescriptions || {}
330
+ slashCommandDescriptions,
316
331
  });
317
332
  }
318
333
  break;
334
+ }
319
335
 
320
336
  case 'compact_status':
321
337
  console.log(`[Compact] Status: ${msg.status} for conversation ${msg.conversationId}`);
@@ -1 +1 @@
1
- {"version":"1.0.195"}
1
+ {"version":"1.0.197"}