@yeaft/webchat-agent 0.1.88 → 0.1.90
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 +3 -1
- package/conversation.js +12 -1
- package/package.json +1 -1
- package/roleplay.js +2 -0
package/claude.js
CHANGED
|
@@ -572,11 +572,13 @@ async function processClaudeOutput(conversationId, claudeQuery, state) {
|
|
|
572
572
|
// ★ Send pending user message after compact completes
|
|
573
573
|
if (state._pendingUserMessage && state.inputStream) {
|
|
574
574
|
const pendingMsg = state._pendingUserMessage;
|
|
575
|
+
const pendingDisplayMsg = state._pendingDisplayMessage || pendingMsg;
|
|
575
576
|
state._pendingUserMessage = null;
|
|
577
|
+
state._pendingDisplayMessage = null;
|
|
576
578
|
console.log(`[${conversationId}] Sending pending message after compact`);
|
|
577
579
|
state.turnActive = true;
|
|
578
580
|
state.turnResultReceived = false;
|
|
579
|
-
sendOutput(conversationId,
|
|
581
|
+
sendOutput(conversationId, pendingDisplayMsg);
|
|
580
582
|
state.inputStream.enqueue(pendingMsg);
|
|
581
583
|
sendConversationList();
|
|
582
584
|
}
|
package/conversation.js
CHANGED
|
@@ -607,6 +607,9 @@ export async function handleUserInput(msg) {
|
|
|
607
607
|
console.log(`[RolePlay] Human responded, resuming from ${fromRole}'s request`);
|
|
608
608
|
}
|
|
609
609
|
|
|
610
|
+
// ★ Save displayPrompt before rolePrefix injection (preserves waitingHuman prefix but excludes ROLE signal)
|
|
611
|
+
const displayPrompt = effectivePrompt;
|
|
612
|
+
|
|
610
613
|
// ★ RolePlay: handle @mention targetRole routing
|
|
611
614
|
const targetRole = msg.targetRole;
|
|
612
615
|
if (targetRole && rpSession && rpSession._routeInitialized) {
|
|
@@ -654,10 +657,17 @@ export async function handleUserInput(msg) {
|
|
|
654
657
|
}
|
|
655
658
|
}
|
|
656
659
|
|
|
660
|
+
// ★ Separate display message (shown to user) from Claude message (sent to model)
|
|
661
|
+
// displayPrompt: user's original text + waitingHuman prefix (no ROLE signal)
|
|
662
|
+
// effectivePrompt: may include ROLE signal prefix for @mention routing
|
|
657
663
|
const userMessage = {
|
|
658
664
|
type: 'user',
|
|
659
665
|
message: { role: 'user', content: effectivePrompt }
|
|
660
666
|
};
|
|
667
|
+
const displayMessage = {
|
|
668
|
+
type: 'user',
|
|
669
|
+
message: { role: 'user', content: displayPrompt }
|
|
670
|
+
};
|
|
661
671
|
|
|
662
672
|
console.log(`[${conversationId}] Sending: ${prompt.substring(0, 100)}...`);
|
|
663
673
|
|
|
@@ -678,6 +688,7 @@ export async function handleUserInput(msg) {
|
|
|
678
688
|
// Send /compact first, then the user message will be sent after compact completes
|
|
679
689
|
// by storing it as a pending message
|
|
680
690
|
state._pendingUserMessage = userMessage;
|
|
691
|
+
state._pendingDisplayMessage = displayMessage;
|
|
681
692
|
state.turnActive = true;
|
|
682
693
|
state.turnResultReceived = false;
|
|
683
694
|
sendConversationList();
|
|
@@ -691,7 +702,7 @@ export async function handleUserInput(msg) {
|
|
|
691
702
|
state.turnActive = true;
|
|
692
703
|
state.turnResultReceived = false; // 重置 per-turn 去重标志
|
|
693
704
|
sendConversationList(); // 在 turnActive=true 后通知 server,确保 processing 状态正确
|
|
694
|
-
sendOutput(conversationId,
|
|
705
|
+
sendOutput(conversationId, displayMessage);
|
|
695
706
|
state.inputStream.enqueue(userMessage);
|
|
696
707
|
}
|
|
697
708
|
|
package/package.json
CHANGED
package/roleplay.js
CHANGED
|
@@ -396,6 +396,7 @@ ${workflow}
|
|
|
396
396
|
|
|
397
397
|
## 输出格式
|
|
398
398
|
|
|
399
|
+
- 不要在回复开头添加角色名称或"XX视角"等标题,对话界面已经显示了角色信息,直接以角色身份开始回复内容
|
|
399
400
|
- 代码修改使用工具(Read, Edit, Write 等),不要在聊天中贴大段代码
|
|
400
401
|
- 每个角色专注做自己的事,不要代替其他角色
|
|
401
402
|
- Review 和 Test 角色如果发现问题,必须切回 Dev 修复后再继续
|
|
@@ -463,6 +464,7 @@ Each role switch must include clear handoff information from the previous role:
|
|
|
463
464
|
|
|
464
465
|
## Output Format
|
|
465
466
|
|
|
467
|
+
- Do not add role names or titles like "XX's perspective" at the beginning of responses; the chat UI already displays role information — start directly with the role's content
|
|
466
468
|
- Use tools (Read, Edit, Write, etc.) for code changes, don't paste large code blocks in chat
|
|
467
469
|
- Each role focuses on its own responsibility, don't do other roles' jobs
|
|
468
470
|
- If Review or Test finds issues, must switch back to Dev to fix before continuing
|