@yeaft/webchat-agent 0.1.162 → 0.1.163

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.
Files changed (2) hide show
  1. package/conversation.js +25 -0
  2. package/package.json +1 -1
package/conversation.js CHANGED
@@ -6,6 +6,20 @@ import { crewSessions, loadCrewIndex } from './crew.js';
6
6
  // 不支持的斜杠命令(真正需要交互式 CLI 的命令)
7
7
  const UNSUPPORTED_SLASH_COMMANDS = ['/help', '/bug', '/login', '/logout', '/terminal-setup', '/vim', '/config'];
8
8
 
9
+ /**
10
+ * Prestart Claude CLI process in background (fire-and-forget).
11
+ * When the query starts, processClaudeOutput will receive the system init message
12
+ * containing skills/tools/model and push them to the frontend immediately.
13
+ * This eliminates the delay where users had to send a message first.
14
+ *
15
+ * Errors are silently caught — failure just degrades to lazy-start behavior.
16
+ */
17
+ function prestartClaude(conversationId, workDir, resumeSessionId) {
18
+ startClaudeQuery(conversationId, workDir, resumeSessionId).catch(err => {
19
+ console.warn(`[Prestart] Failed for ${conversationId}: ${err.message}`);
20
+ });
21
+ }
22
+
9
23
  /**
10
24
  * 解析斜杠命令
11
25
  * @param {string} message - 用户消息
@@ -163,6 +177,10 @@ export async function createConversation(msg) {
163
177
  }
164
178
 
165
179
  sendConversationList();
180
+
181
+ // ★ Prestart Claude CLI in background to eagerly fetch skills/tools/model
182
+ // Fire-and-forget: failure just degrades to lazy-start behavior
183
+ prestartClaude(conversationId, effectiveWorkDir, null);
166
184
  }
167
185
 
168
186
  // Resume 历史 conversation (延迟启动 Claude,等待用户发送第一条消息)
@@ -242,6 +260,13 @@ export async function resumeConversation(msg) {
242
260
  }
243
261
 
244
262
  sendConversationList();
263
+
264
+ // ★ Prestart Claude CLI in background to eagerly fetch skills/tools/model
265
+ // Skip if conversation already has an active query (shouldn't happen, but safety check)
266
+ const resumeState = ctx.conversations.get(conversationId);
267
+ if (!resumeState?.query) {
268
+ prestartClaude(conversationId, effectiveWorkDir, claudeSessionId);
269
+ }
245
270
  }
246
271
 
247
272
  // 删除 conversation
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yeaft/webchat-agent",
3
- "version": "0.1.162",
3
+ "version": "0.1.163",
4
4
  "description": "Remote agent for Yeaft WebChat — connects worker machines to the central server",
5
5
  "main": "index.js",
6
6
  "type": "module",