@yeaft/webchat-agent 0.1.90 → 0.1.91
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/connection/message-router.js +5 -1
- package/conversation.js +38 -0
- package/package.json +1 -1
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
createConversation, resumeConversation, deleteConversation,
|
|
13
13
|
handleRefreshConversation, handleCancelExecution,
|
|
14
14
|
handleUserInput, handleUpdateConversationSettings, handleAskUserAnswer,
|
|
15
|
-
sendConversationList, handleCheckCrewContext
|
|
15
|
+
sendConversationList, handleCheckCrewContext, handleCheckRolePlaySessions
|
|
16
16
|
} from '../conversation.js';
|
|
17
17
|
import {
|
|
18
18
|
createCrewSession, handleCrewHumanInput, handleCrewControl,
|
|
@@ -70,6 +70,10 @@ export async function handleMessage(msg) {
|
|
|
70
70
|
handleCheckCrewContext(msg);
|
|
71
71
|
break;
|
|
72
72
|
|
|
73
|
+
case 'check_roleplay_sessions':
|
|
74
|
+
handleCheckRolePlaySessions(msg);
|
|
75
|
+
break;
|
|
76
|
+
|
|
73
77
|
case 'resume_conversation':
|
|
74
78
|
await resumeConversation(msg);
|
|
75
79
|
break;
|
package/conversation.js
CHANGED
|
@@ -3,6 +3,7 @@ import { loadSessionHistory } from './history.js';
|
|
|
3
3
|
import { startClaudeQuery } from './claude.js';
|
|
4
4
|
import { crewSessions, loadCrewIndex } from './crew.js';
|
|
5
5
|
import { rolePlaySessions, saveRolePlayIndex, removeRolePlaySession, loadRolePlayIndex, validateRolePlayConfig, initRolePlayRouteState, loadCrewContext, refreshCrewContext, initCrewContextMtimes } from './roleplay.js';
|
|
6
|
+
import { loadRolePlaySessionIndex } from './roleplay-session.js';
|
|
6
7
|
import { initRolePlayDir, writeSessionClaudeMd, generateSessionName, getDefaultRoles, getSessionDir } from './roleplay-dir.js';
|
|
7
8
|
import { addRolePlaySession, findRolePlaySessionByConversationId, setActiveRolePlaySession } from './roleplay-session.js';
|
|
8
9
|
|
|
@@ -817,3 +818,40 @@ export function handleCheckCrewContext(msg) {
|
|
|
817
818
|
featureCount: crewContext.features.length,
|
|
818
819
|
});
|
|
819
820
|
}
|
|
821
|
+
|
|
822
|
+
/**
|
|
823
|
+
* Handle check_roleplay_sessions request — check if a directory has .roleplay/session.json
|
|
824
|
+
* and return the list of existing sessions for restore.
|
|
825
|
+
*/
|
|
826
|
+
export function handleCheckRolePlaySessions(msg) {
|
|
827
|
+
const { projectDir, requestId } = msg;
|
|
828
|
+
if (!projectDir) {
|
|
829
|
+
ctx.sendToServer({ type: 'roleplay_sessions_result', requestId, found: false, sessions: [] });
|
|
830
|
+
return;
|
|
831
|
+
}
|
|
832
|
+
const index = loadRolePlaySessionIndex(projectDir);
|
|
833
|
+
const activeSessions = index.sessions.filter(s => s.status === 'active');
|
|
834
|
+
if (activeSessions.length === 0) {
|
|
835
|
+
ctx.sendToServer({ type: 'roleplay_sessions_result', requestId, found: false, sessions: [] });
|
|
836
|
+
return;
|
|
837
|
+
}
|
|
838
|
+
ctx.sendToServer({
|
|
839
|
+
type: 'roleplay_sessions_result',
|
|
840
|
+
requestId,
|
|
841
|
+
found: true,
|
|
842
|
+
sessions: activeSessions.map(s => ({
|
|
843
|
+
name: s.name,
|
|
844
|
+
teamType: s.teamType,
|
|
845
|
+
language: s.language,
|
|
846
|
+
conversationId: s.conversationId,
|
|
847
|
+
roles: (s.roles || []).map(r => ({
|
|
848
|
+
name: r.name,
|
|
849
|
+
displayName: r.displayName,
|
|
850
|
+
icon: r.icon || '',
|
|
851
|
+
description: r.description || '',
|
|
852
|
+
})),
|
|
853
|
+
createdAt: s.createdAt,
|
|
854
|
+
updatedAt: s.updatedAt,
|
|
855
|
+
})),
|
|
856
|
+
});
|
|
857
|
+
}
|