@yeaft/webchat-agent 0.1.451 → 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/unify/web-bridge.js +33 -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,
|
package/package.json
CHANGED
package/unify/web-bridge.js
CHANGED
|
@@ -503,7 +503,9 @@ export async function handleUnifyLoadHistory(msg) {
|
|
|
503
503
|
}
|
|
504
504
|
|
|
505
505
|
/**
|
|
506
|
-
* Reset Unify session (for clear messages).
|
|
506
|
+
* Reset Unify session (for clear messages or config change).
|
|
507
|
+
* After shutdown, immediately re-initializes the session and sends
|
|
508
|
+
* session_ready so the frontend picks up updated models/config.
|
|
507
509
|
*/
|
|
508
510
|
export async function resetUnifySession() {
|
|
509
511
|
if (currentAbort) {
|
|
@@ -517,4 +519,34 @@ export async function resetUnifySession() {
|
|
|
517
519
|
unifyConversationId = null;
|
|
518
520
|
currentMode = 'chat';
|
|
519
521
|
conversationMessages = [];
|
|
522
|
+
|
|
523
|
+
// Re-initialize session immediately so frontend gets updated config
|
|
524
|
+
try {
|
|
525
|
+
const yeaftDir = ctx.CONFIG?.yeaftDir;
|
|
526
|
+
session = await loadSession({
|
|
527
|
+
...(yeaftDir && { dir: yeaftDir }),
|
|
528
|
+
skipMCP: false,
|
|
529
|
+
skipSkills: false,
|
|
530
|
+
});
|
|
531
|
+
|
|
532
|
+
unifyConversationId = `unify-${Date.now()}`;
|
|
533
|
+
|
|
534
|
+
// Restore conversation history for LLM context
|
|
535
|
+
const recent = session.conversationStore.loadRecent(50);
|
|
536
|
+
conversationMessages = recent
|
|
537
|
+
.filter(m => m.role === 'user' || m.role === 'assistant')
|
|
538
|
+
.map(m => ({ role: m.role, content: m.content }));
|
|
539
|
+
|
|
540
|
+
sendUnifyEvent({
|
|
541
|
+
type: 'session_ready',
|
|
542
|
+
conversationId: unifyConversationId,
|
|
543
|
+
model: session.config.model,
|
|
544
|
+
availableModels: session.config.availableModels || [],
|
|
545
|
+
skills: session.status.skills,
|
|
546
|
+
mcpServers: session.status.mcpServers,
|
|
547
|
+
tools: session.status.tools,
|
|
548
|
+
});
|
|
549
|
+
} catch (err) {
|
|
550
|
+
console.error('[Unify] Failed to re-initialize session after reset:', err.message);
|
|
551
|
+
}
|
|
520
552
|
}
|