@yeaft/webchat-agent 0.1.452 → 0.1.453
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.
- package/crew/role-output.js +14 -5
- package/package.json +1 -1
package/crew/role-output.js
CHANGED
|
@@ -30,6 +30,9 @@ export function _detectRouteIntent(text) {
|
|
|
30
30
|
/请\s*\S+\s*审查/,
|
|
31
31
|
/转给\s*\S+/,
|
|
32
32
|
/发给\s*\S+/,
|
|
33
|
+
/请\s*(?:rev|test)-\d+/i, // 请 rev-1/test-2 (explicit role mention with request)
|
|
34
|
+
/PR\s*#\d+.*(?:请|review|审查)/i, // PR #123 + review request
|
|
35
|
+
/(?:rev|test)-\d+\s*(?:审查|review|check|测试)/i, // rev-1 审查 / test-2 测试
|
|
33
36
|
/route\s+to\s+\S+/i,
|
|
34
37
|
/submit\s+to\s+\S+/i,
|
|
35
38
|
/forward\s+to\s+\S+/i,
|
|
@@ -252,11 +255,17 @@ export async function processRoleOutput(session, roleName, roleQuery, roleState)
|
|
|
252
255
|
});
|
|
253
256
|
sendStatusUpdate(session);
|
|
254
257
|
} else {
|
|
255
|
-
// ★
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
258
|
+
// ★ No ROUTE found — decide whether to auto-forward to PM
|
|
259
|
+
const isNonPM = roleName !== session.decisionMaker;
|
|
260
|
+
const hasActiveTask = !!roleState.currentTask;
|
|
261
|
+
const hasRouteIntent = _detectRouteIntent(roleState.lastTurnText);
|
|
262
|
+
|
|
263
|
+
if (isNonPM && (hasActiveTask || hasRouteIntent)) {
|
|
264
|
+
// Non-PM role with active task OR routing intent but no ROUTE block:
|
|
265
|
+
// auto-forward to PM so the message doesn't get lost
|
|
266
|
+
const reason = hasActiveTask ? 'has active task' : 'has routing intent';
|
|
267
|
+
console.log(`[Crew] ${roleName} turn ended without ROUTE (${reason}) — auto-forwarding to PM`);
|
|
268
|
+
const autoSummary = `[auto-forward: ${roleName} turn 结束但未输出 ROUTE 块 (${reason})]\n${(roleState.lastTurnText || '').slice(-800).trim()}`;
|
|
260
269
|
await executeRoute(session, roleName, {
|
|
261
270
|
to: session.decisionMaker,
|
|
262
271
|
summary: autoSummary,
|