@yeaft/webchat-agent 0.1.424 → 0.1.426

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,6 +30,14 @@ export async function handleCrewHumanInput(msg) {
30
30
  }
31
31
  }
32
32
 
33
+ // Auto-resume: user sending a message = intent to continue → restore to running
34
+ if (session.status === 'paused' || session.status === 'stopped' || session.status === 'completed') {
35
+ console.log(`[Crew] Auto-resuming session from ${session.status} to running (user sent message)`);
36
+ session.status = 'running';
37
+ sendStatusUpdate(session);
38
+ debouncedSaveSessionMeta(session);
39
+ }
40
+
33
41
  // Build dispatch content (supports image attachments)
34
42
  function buildHumanContent(prefix, text) {
35
43
  if (files && files.length > 0) {
@@ -90,10 +98,6 @@ export async function handleCrewHumanInput(msg) {
90
98
  if (target) {
91
99
  // 检测纯 skill 命令(如 /context, /simplify),直接发送不加前缀
92
100
  if (/^\/[a-zA-Z0-9_-]+(?:\s+.*)?$/s.test(message)) {
93
- if (session.status === 'paused' || session.status === 'stopped' || session.status === 'initializing') {
94
- console.log(`[Crew] Session ${session.status}, skipping skill dispatch to ${target}`);
95
- return;
96
- }
97
101
  let roleState = session.roleStates.get(target);
98
102
  if (!roleState || !roleState.query || !roleState.inputStream) {
99
103
  const { createRoleQuery } = await import('./role-query.js');
package/crew/routing.js CHANGED
@@ -153,11 +153,11 @@ export function resolveRoleName(to, session, fromRole) {
153
153
  export async function executeRoute(session, fromRole, route, turnImages = []) {
154
154
  const { to, summary, taskId, taskTitle } = route;
155
155
 
156
- // 如果 session 已暂停或停止,保存为 pendingRoutes
156
+ // Auto-resume: paused/stopped → running (route execution means work should continue)
157
157
  if (session.status === 'paused' || session.status === 'stopped') {
158
- session.pendingRoutes.push({ fromRole, route });
159
- console.log(`[Crew] Session ${session.status}, route saved as pending: ${fromRole} -> ${to}`);
160
- return;
158
+ console.log(`[Crew] Auto-resuming session from ${session.status} to running (route from ${fromRole} to ${to})`);
159
+ session.status = 'running';
160
+ sendStatusUpdate(session);
161
161
  }
162
162
 
163
163
  // Task 文件自动管理(fire-and-forget)
@@ -270,11 +270,19 @@ export function buildRoutePrompt(fromRole, summary, session, turnImages = []) {
270
270
  * 向角色发送消息
271
271
  */
272
272
  export async function dispatchToRole(session, roleName, content, fromSource, taskId, taskTitle) {
273
- if (session.status === 'paused' || session.status === 'stopped' || session.status === 'initializing') {
274
- console.log(`[Crew] Session ${session.status}, skipping dispatch to ${roleName}`);
273
+ // Only block during initialization (roles not ready yet)
274
+ if (session.status === 'initializing') {
275
+ console.log(`[Crew] Session initializing, skipping dispatch to ${roleName}`);
275
276
  return;
276
277
  }
277
278
 
279
+ // Auto-resume: paused/stopped → running (dispatch means work should continue)
280
+ if (session.status === 'paused' || session.status === 'stopped') {
281
+ console.log(`[Crew] Auto-resuming session from ${session.status} to running (dispatch to ${roleName})`);
282
+ session.status = 'running';
283
+ sendStatusUpdate(session);
284
+ }
285
+
278
286
  let roleState = session.roleStates.get(roleName);
279
287
 
280
288
  // 如果角色没有 query 实例,创建一个(支持 resume)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yeaft/webchat-agent",
3
- "version": "0.1.424",
3
+ "version": "0.1.426",
4
4
  "description": "Remote agent for Yeaft WebChat — connects worker machines to the central server",
5
5
  "main": "index.js",
6
6
  "type": "module",