@yeaft/webchat-agent 0.1.102 → 0.1.103

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/claude.js +22 -0
  2. package/package.json +1 -1
package/claude.js CHANGED
@@ -515,6 +515,17 @@ async function processClaudeOutput(conversationId, claudeQuery, state) {
515
515
 
516
516
  console.log(`[RolePlay] Auto-continuing to role: ${to}`);
517
517
 
518
+ // ★ Send roleplay_status with updated currentRole so frontend knows which role is active
519
+ ctx.sendToServer({
520
+ type: 'roleplay_status',
521
+ conversationId,
522
+ currentRole: rpSession.currentRole,
523
+ round: rpSession.round,
524
+ features: rpSession.features ? Array.from(rpSession.features.values()) : [],
525
+ roleStates: rpSession.roleStates || {},
526
+ waitingHuman: false
527
+ });
528
+
518
529
  // ★ Pre-send compact check for RolePlay auto-continue
519
530
  const rpAutoCompactThreshold = ctx.CONFIG?.autoCompactThreshold || 100000;
520
531
  const rpEstimatedNewTokens = Math.ceil(prompt.length / 3);
@@ -627,6 +638,17 @@ async function processClaudeOutput(conversationId, claudeQuery, state) {
627
638
  rpSession.roleStates[prevRole].status = 'idle';
628
639
  }
629
640
  console.log(`[RolePlay] Role switched: ${prevRole || 'none'} -> ${detectedRole}`);
641
+
642
+ // ★ Send roleplay_status so frontend fallbackRole stays in sync
643
+ ctx.sendToServer({
644
+ type: 'roleplay_status',
645
+ conversationId,
646
+ currentRole: rpSession.currentRole,
647
+ round: rpSession.round,
648
+ features: rpSession.features ? Array.from(rpSession.features.values()) : [],
649
+ roleStates: rpSession.roleStates || {},
650
+ waitingHuman: rpSession.waitingHuman || false
651
+ });
630
652
  }
631
653
  }
632
654
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yeaft/webchat-agent",
3
- "version": "0.1.102",
3
+ "version": "0.1.103",
4
4
  "description": "Remote agent for Yeaft WebChat — connects worker machines to the central server",
5
5
  "main": "index.js",
6
6
  "type": "module",