@yeaft/webchat-agent 1.0.287 → 1.0.289

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.
@@ -30,7 +30,7 @@ import { getLlmConfig, updateLlmConfig, getYeaftSettings, updateYeaftSettings, g
30
30
  import { loadConfig } from '../yeaft/config.js';
31
31
  import { discoverLlmModels } from '../llm-model-discovery.js';
32
32
  import { fetchModelsDev } from '../yeaft/llm/models-dev.js';
33
- import { handleYeaftSessionSend, handleYeaftAskUserAnswer, handleYeaftSubAgentPrompt, handleYeaftTaskCancel, handleYeaftModeSwitch, handleYeaftModelSwitch, resetYeaftSession, refreshLiveSessionConfig, handleYeaftLoadHistory, handleYeaftLoadHistoryOutline, handleYeaftSearchHistory, handleYeaftLoadHistoryWindow, handleYeaftLoadMoreHistory, handleYeaftAbortThread, handleYeaftAbortAll, handleYeaftAbortTurn, handleYeaftVpSubscribe, handleYeaftVpCreate, handleYeaftVpUpdate, handleYeaftVpDelete, handleYeaftVpRead, handleYeaftListSessions, handleYeaftCreateSession, handleYeaftRenameSession, handleYeaftUpdateSession, handleYeaftUpdateSessionConfig, handleYeaftArchiveSession, handleYeaftDeleteSession, handleYeaftSessionAddMember, handleYeaftSessionRemoveMember, handleYeaftSessionSetDefaultVp, handleYeaftScanWorkdirSessions, handleYeaftRestoreSession, handleYeaftDreamTrigger, handleYeaftFetchToolStats, handleYeaftFetchDebugHistory, handleYeaftMcpList, handleYeaftMcpAdd, handleYeaftMcpRemove, handleYeaftMcpReload, broadcastLanguageChange, broadcastYeaftSessionSnapshotEager, preloadYeaftSkillSlashCommands } from '../yeaft/web-bridge.js';
33
+ import { handleYeaftSessionSend, handleYeaftAskUserAnswer, handleYeaftSubAgentPrompt, handleYeaftTaskCancel, handleYeaftModeSwitch, handleYeaftModelSwitch, resetYeaftSession, refreshLiveSessionConfig, handleYeaftLoadHistory, handleYeaftLoadHistoryOutline, handleYeaftSearchHistory, handleYeaftLoadHistoryWindow, handleYeaftLoadMoreHistory, handleYeaftAbortThread, handleYeaftAbortAll, handleYeaftAbortTurn, handleYeaftVpSubscribe, handleYeaftVpCreate, handleYeaftVpUpdate, handleYeaftVpDelete, handleYeaftVpRead, handleYeaftListSessions, handleYeaftCreateSession, handleYeaftRenameSession, handleYeaftUpdateSession, handleYeaftUpdateSessionConfig, handleYeaftArchiveSession, handleYeaftDeleteSession, handleYeaftSessionAddMember, handleYeaftSessionRemoveMember, handleYeaftSessionSetDefaultVp, handleYeaftScanWorkdirSessions, handleYeaftRestoreSession, handleYeaftDreamTrigger, handleYeaftFetchToolStats, handleYeaftFetchDebugHistory, handleYeaftMcpList, handleYeaftMcpAdd, handleYeaftMcpRemove, handleYeaftMcpReload, broadcastLanguageChange, broadcastYeaftSessionSnapshotEager, broadcastYeaftVpSnapshotEager, preloadYeaftSkillSlashCommands } from '../yeaft/web-bridge.js';
34
34
  import { startYeaftStatusRefresh, forceRefreshYeaftStatus } from '../yeaft/status-cache.js';
35
35
  import { handleWorkCenterRequest } from '../yeaft/work-center/bridge.js';
36
36
 
@@ -131,6 +131,10 @@ export async function handleMessage(msg) {
131
131
  // The callee already wraps its FS scan + emit in try/catch and
132
132
  // logs via console.warn — no second guard needed here.
133
133
  broadcastYeaftSessionSnapshotEager();
134
+ // Stock VPs are bundled Agent data. Seed + publish them during register so
135
+ // a first-install user can open the create dialog immediately instead of
136
+ // depending on a later Session runtime or modal subscription race.
137
+ broadcastYeaftVpSnapshotEager();
134
138
 
135
139
  // ★ Flush 断连期间缓冲的消息
136
140
  await flushMessageBuffer();
@@ -36,6 +36,18 @@ function emptyYeaftToolStats(reason = '') {
36
36
  return payload;
37
37
  }
38
38
 
39
+ async function sendVpSnapshotError(client, msg, error) {
40
+ await sendToWebClient(client, {
41
+ type: 'yeaft_output',
42
+ agentId: msg?.agentId || null,
43
+ requestId: msg?.requestId || null,
44
+ event: {
45
+ type: 'vp_snapshot_error',
46
+ error,
47
+ },
48
+ });
49
+ }
50
+
39
51
  async function broadcastSessionPin(userId, payload) {
40
52
  for (const [, target] of webClients) {
41
53
  if (!target?.authenticated) continue;
@@ -1347,12 +1359,9 @@ export async function handleClientConversation(clientId, client, msg, checkAgent
1347
1359
  await sendToWebClient(client, emptyYeaftToolStats('No agent selected.'));
1348
1360
  } else if (relayType === 'yeaft_dream_trigger') {
1349
1361
  await sendToWebClient(client, skippedYeaftDreamResult(msg, 'no-agent-selected'));
1362
+ } else if (relayType === 'yeaft_vp_subscribe') {
1363
+ await sendVpSnapshotError(client, msg, 'No Agent is available for the VP library.');
1350
1364
  } else {
1351
- // fix-session-restore-modal-unify: every prior swallow was
1352
- // invisible — the user-facing symptom (e.g. VP roster stuck
1353
- // on "加载中...") doesn't point back to "the server has no
1354
- // agent to route this to." A WARN log is one grep away
1355
- // from the root cause next time this happens.
1356
1365
  console.warn(
1357
1366
  `[Server] swallowed yeaft message ${relayType} (no agent resolved)`
1358
1367
  + ` userId=${client.userId || '?'}`
@@ -1365,6 +1374,8 @@ export async function handleClientConversation(clientId, client, msg, checkAgent
1365
1374
  await sendToWebClient(client, emptyYeaftToolStats('Agent is not available.'));
1366
1375
  } else if (relayType === 'yeaft_dream_trigger') {
1367
1376
  await sendToWebClient(client, skippedYeaftDreamResult(msg, 'agent-not-available'));
1377
+ } else if (relayType === 'yeaft_vp_subscribe') {
1378
+ await sendVpSnapshotError(client, msg, 'The selected Agent is not available.');
1368
1379
  }
1369
1380
  return true;
1370
1381
  }
@@ -1378,6 +1389,10 @@ export async function handleClientConversation(clientId, client, msg, checkAgent
1378
1389
  await sendToWebClient(client, skippedYeaftDreamResult(msg, 'agent-offline'));
1379
1390
  return true;
1380
1391
  }
1392
+ if (relayType === 'yeaft_vp_subscribe') {
1393
+ await sendVpSnapshotError(client, msg, 'The selected Agent is offline.');
1394
+ return true;
1395
+ }
1381
1396
  }
1382
1397
  if (relayType === 'yeaft_fetch_agent_metrics') {
1383
1398
  await forwardToAgent(relayAgentId, { type: 'get_agent_metrics' });
@@ -1 +1 @@
1
- {"version":"1.0.287"}
1
+ {"version":"1.0.289"}