@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.
- package/claude.js +22 -0
- 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
|
}
|