orchestrix-yuri 4.7.8 → 4.7.10
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/lib/gateway/router.js +31 -10
- package/package.json +1 -1
package/lib/gateway/router.js
CHANGED
|
@@ -365,7 +365,7 @@ class Router {
|
|
|
365
365
|
// Agent-specific or decision queries need Claude reasoning with tmux context,
|
|
366
366
|
// not a canned status card. Fall through to conversation handler.
|
|
367
367
|
const agentRe = /\b(sm|architect|dev|qa|po|pm|ux)\b/i;
|
|
368
|
-
const decisionRe =
|
|
368
|
+
const decisionRe = /决策|决定|确认|需要我|应该|接着|下一步|然后呢|干啥|干什么|block|decide|should|next|what now/i;
|
|
369
369
|
if (agentRe.test(msg.text) || decisionRe.test(msg.text)) {
|
|
370
370
|
return null; // → conversation handler (Claude with tmux context)
|
|
371
371
|
}
|
|
@@ -429,13 +429,16 @@ class Router {
|
|
|
429
429
|
*/
|
|
430
430
|
async _tryDirectAgentRoute(msg, projectRoot, description) {
|
|
431
431
|
// Agent name patterns → { session type, agent slug for /o, window }
|
|
432
|
+
// Planning agents all use window 0 (ensure-session.sh only creates one window).
|
|
433
|
+
// Dev agents use their fixed windows (start-orchestrix.sh creates all 4).
|
|
432
434
|
const AGENT_MAP = {
|
|
433
|
-
// Planning session agents
|
|
435
|
+
// Planning session agents (all window 0)
|
|
434
436
|
'analyst': { session: 'planning', slug: 'analyst', window: 0 },
|
|
435
|
-
'pm': { session: 'planning', slug: 'pm', window:
|
|
436
|
-
'ux-expert': { session: 'planning', slug: 'ux-expert', window:
|
|
437
|
-
'ux': { session: 'planning', slug: 'ux-expert', window:
|
|
438
|
-
|
|
437
|
+
'pm': { session: 'planning', slug: 'pm', window: 0 },
|
|
438
|
+
'ux-expert': { session: 'planning', slug: 'ux-expert', window: 0 },
|
|
439
|
+
'ux': { session: 'planning', slug: 'ux-expert', window: 0 },
|
|
440
|
+
'po': { session: 'planning', slug: 'po', window: 0 },
|
|
441
|
+
// Dev session agents (fixed windows from start-orchestrix.sh)
|
|
439
442
|
'architect': { session: 'dev', slug: 'architect', window: 0 },
|
|
440
443
|
'sm': { session: 'dev', slug: 'sm', window: 1 },
|
|
441
444
|
'dev': { session: 'dev', slug: 'dev', window: 2 },
|
|
@@ -477,8 +480,13 @@ class Router {
|
|
|
477
480
|
tmx.sendKeysWithEnter(session, matched.window, `/o ${matched.slug}`);
|
|
478
481
|
execSync('sleep 12');
|
|
479
482
|
|
|
480
|
-
//
|
|
481
|
-
|
|
483
|
+
// Clean description: strip [CONTEXT] prefix injected by dispatcher
|
|
484
|
+
let cleanDesc = description;
|
|
485
|
+
const ctxMatch = cleanDesc.match(/\[CONTEXT\].*?(?:User message:\s*)?(.+)/s);
|
|
486
|
+
if (ctxMatch) cleanDesc = ctxMatch[1].trim();
|
|
487
|
+
if (!cleanDesc) cleanDesc = description;
|
|
488
|
+
|
|
489
|
+
const safeDesc = cleanDesc.replace(/"/g, '\\"');
|
|
482
490
|
tmx.sendKeysWithEnter(session, matched.window, safeDesc);
|
|
483
491
|
|
|
484
492
|
// Set up polling via orchestrator (reuses change/small flow)
|
|
@@ -502,7 +510,20 @@ class Router {
|
|
|
502
510
|
if (this.orchestrator._timer) { clearInterval(this.orchestrator._timer); this.orchestrator._timer = null; }
|
|
503
511
|
this.orchestrator._phase = null;
|
|
504
512
|
this.orchestrator._changeContext = null;
|
|
505
|
-
|
|
513
|
+
|
|
514
|
+
// Capture agent output for a meaningful completion summary
|
|
515
|
+
let summary = `✅ **${matched.slug}** completed the task.`;
|
|
516
|
+
try {
|
|
517
|
+
const pane = tmx.capturePane(session, matched.window, 30);
|
|
518
|
+
const outputLines = pane.split('\n').filter((l) => l.trim() && !/^❯/.test(l.trim()));
|
|
519
|
+
if (outputLines.length > 0) {
|
|
520
|
+
const tail = outputLines.slice(-8).map((l) => l.trim()).join('\n');
|
|
521
|
+
summary += `\n\n📋 Output (last lines):\n${tail}`;
|
|
522
|
+
}
|
|
523
|
+
} catch { /* ok */ }
|
|
524
|
+
summary += `\n\n💡 Suggested next: review the output, then tell me what to do next (e.g., "让 dev 开始实现" or "*develop").`;
|
|
525
|
+
|
|
526
|
+
this.orchestrator.onComplete('change', summary);
|
|
506
527
|
return;
|
|
507
528
|
}
|
|
508
529
|
if (check.status !== 'stable') { this.orchestrator._stableCount = 0; this.orchestrator._lastHash = check.hash || ''; }
|
|
@@ -510,7 +531,7 @@ class Router {
|
|
|
510
531
|
}, pollInterval);
|
|
511
532
|
|
|
512
533
|
this.history.append(msg.chatId, 'user', msg.text);
|
|
513
|
-
const reply = `🎯 Direct → **${matched.slug}
|
|
534
|
+
const reply = `🎯 Direct → **${matched.slug}**\n\n"${cleanDesc.slice(0, 120)}"\n\nI'll notify you when done.`;
|
|
514
535
|
this.history.append(msg.chatId, 'assistant', reply);
|
|
515
536
|
this._updateGlobalFocus(msg, projectRoot);
|
|
516
537
|
|