@yeaft/webchat-agent 0.1.332 → 0.1.334
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 +2 -2
- package/conversation.js +2 -2
- package/crew/persistence.js +0 -38
- package/crew/role-output.js +7 -0
- package/crew/role-query.js +1 -1
- package/crew/routing.js +6 -1
- package/crew/session.js +1 -5
- package/crew.js +0 -1
- package/package.json +1 -1
|
@@ -18,7 +18,7 @@ import {
|
|
|
18
18
|
import {
|
|
19
19
|
createCrewSession, handleCrewHumanInput, handleCrewControl,
|
|
20
20
|
addRoleToSession, removeRoleFromSession,
|
|
21
|
-
handleListCrewSessions, handleCheckCrewExists, handleDeleteCrewDir, resumeCrewSession, removeFromCrewIndex,
|
|
21
|
+
handleListCrewSessions, handleCheckCrewExists, handleDeleteCrewDir, resumeCrewSession, removeFromCrewIndex,
|
|
22
22
|
handleLoadCrewHistory, handleCheckCrewContext
|
|
23
23
|
} from '../crew.js';
|
|
24
24
|
import { sendToServer, flushMessageBuffer } from './buffer.js';
|
|
@@ -252,7 +252,7 @@ export async function handleMessage(msg) {
|
|
|
252
252
|
break;
|
|
253
253
|
|
|
254
254
|
case 'delete_crew_session':
|
|
255
|
-
await
|
|
255
|
+
await removeFromCrewIndex(msg.sessionId);
|
|
256
256
|
(await import('../conversation.js')).sendConversationList();
|
|
257
257
|
break;
|
|
258
258
|
|
package/conversation.js
CHANGED
|
@@ -311,11 +311,11 @@ export async function sendConversationList() {
|
|
|
311
311
|
type: 'crew',
|
|
312
312
|
});
|
|
313
313
|
}
|
|
314
|
-
// 追加索引中已停止的 crew sessions
|
|
314
|
+
// 追加索引中已停止的 crew sessions(不重复)
|
|
315
315
|
try {
|
|
316
316
|
const index = await loadCrewIndex();
|
|
317
317
|
for (const entry of index) {
|
|
318
|
-
if (!activeCrewIds.has(entry.sessionId)
|
|
318
|
+
if (!activeCrewIds.has(entry.sessionId)) {
|
|
319
319
|
list.push({
|
|
320
320
|
id: entry.sessionId,
|
|
321
321
|
workDir: entry.projectDir,
|
package/crew/persistence.js
CHANGED
|
@@ -76,44 +76,6 @@ export async function removeFromCrewIndex(sessionId) {
|
|
|
76
76
|
// 这些文件在 recreate 时会被复用(合并统计数据 + 恢复消息历史)
|
|
77
77
|
}
|
|
78
78
|
|
|
79
|
-
/**
|
|
80
|
-
* 隐藏 crew session(UI 删除 = 隐藏,不是真删)
|
|
81
|
-
* 在 crew-index 条目上标记 hidden: true + hiddenAt 时间戳,
|
|
82
|
-
* 同时从内存 crewSessions Map 中移除(停止运行态)。
|
|
83
|
-
* 不修改 session.json,不从 index 中移除条目。
|
|
84
|
-
*/
|
|
85
|
-
export async function hideCrewSession(sessionId) {
|
|
86
|
-
const { crewSessions } = await import('./session.js');
|
|
87
|
-
|
|
88
|
-
const index = await loadCrewIndex();
|
|
89
|
-
const entry = index.find(e => e.sessionId === sessionId);
|
|
90
|
-
if (entry) {
|
|
91
|
-
entry.hidden = true;
|
|
92
|
-
entry.hiddenAt = Date.now();
|
|
93
|
-
await saveCrewIndex(index);
|
|
94
|
-
console.log(`[Crew] Hidden session ${sessionId} in index`);
|
|
95
|
-
}
|
|
96
|
-
// 从内存中移除(停止运行态,防止 sendConversationList 加入)
|
|
97
|
-
if (crewSessions.has(sessionId)) {
|
|
98
|
-
crewSessions.delete(sessionId);
|
|
99
|
-
console.log(`[Crew] Removed session ${sessionId} from active sessions`);
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
/**
|
|
104
|
-
* 取消隐藏 crew session(用户主动恢复时调用)
|
|
105
|
-
*/
|
|
106
|
-
export async function unhideCrewSession(sessionId) {
|
|
107
|
-
const index = await loadCrewIndex();
|
|
108
|
-
const entry = index.find(e => e.sessionId === sessionId);
|
|
109
|
-
if (entry && entry.hidden) {
|
|
110
|
-
delete entry.hidden;
|
|
111
|
-
delete entry.hiddenAt;
|
|
112
|
-
await saveCrewIndex(index);
|
|
113
|
-
console.log(`[Crew] Unhidden session ${sessionId} in index`);
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
|
|
117
79
|
// =====================================================================
|
|
118
80
|
// Session Metadata (.crew/session.json)
|
|
119
81
|
// =====================================================================
|
package/crew/role-output.js
CHANGED
|
@@ -124,6 +124,13 @@ export async function processRoleOutput(session, roleName, roleQuery, roleState)
|
|
|
124
124
|
|
|
125
125
|
// 解析路由
|
|
126
126
|
const routes = parseRoutes(roleState.accumulatedText);
|
|
127
|
+
// Fallback: 如果 route summary 仍为空占位符,用 accumulatedText 末尾 500 字符
|
|
128
|
+
for (const route of routes) {
|
|
129
|
+
if (route.summary === '[该角色未提供消息摘要]' && roleState.accumulatedText) {
|
|
130
|
+
const tail = roleState.accumulatedText.slice(-500).trim();
|
|
131
|
+
if (tail) route.summary = `[auto-extracted]\n${tail}`;
|
|
132
|
+
}
|
|
133
|
+
}
|
|
127
134
|
|
|
128
135
|
// 决策者 turn 完成:检测 TASKS block 中新完成的任务
|
|
129
136
|
const roleConfig = session.roles.get(roleName);
|
package/crew/role-query.js
CHANGED
package/crew/routing.js
CHANGED
|
@@ -39,9 +39,14 @@ export function parseRoutes(text) {
|
|
|
39
39
|
const taskMatch = block.match(/^task:\s*(.+)/im);
|
|
40
40
|
const taskTitleMatch = block.match(/^taskTitle:\s*(.+)/im);
|
|
41
41
|
|
|
42
|
+
let summary = summaryMatch ? summaryMatch[1].trim() : '';
|
|
43
|
+
if (!summary) {
|
|
44
|
+
summary = '[该角色未提供消息摘要]';
|
|
45
|
+
}
|
|
46
|
+
|
|
42
47
|
routes.push({
|
|
43
48
|
to: toClean,
|
|
44
|
-
summary
|
|
49
|
+
summary,
|
|
45
50
|
taskId: taskMatch ? taskMatch[1].trim() : null,
|
|
46
51
|
taskTitle: taskTitleMatch ? taskTitleMatch[1].trim() : null
|
|
47
52
|
});
|
package/crew/session.js
CHANGED
|
@@ -8,7 +8,7 @@ import { getMessages } from '../crew-i18n.js';
|
|
|
8
8
|
import { initWorktrees } from './worktree.js';
|
|
9
9
|
import { initSharedDir, writeRoleClaudeMd, updateSharedClaudeMd, backupMemoryContent } from './shared-dir.js';
|
|
10
10
|
import {
|
|
11
|
-
loadCrewIndex, upsertCrewIndex, removeFromCrewIndex,
|
|
11
|
+
loadCrewIndex, upsertCrewIndex, removeFromCrewIndex,
|
|
12
12
|
loadSessionMeta, saveSessionMeta, loadSessionMessages, getMaxShardIndex
|
|
13
13
|
} from './persistence.js';
|
|
14
14
|
import { sendCrewMessage, sendCrewOutput, sendStatusUpdate } from './ui-messages.js';
|
|
@@ -122,7 +122,6 @@ async function findExistingSessionByProjectDir(projectDir) {
|
|
|
122
122
|
e.projectDir.replace(/\/+$/, '') === normalizedDir
|
|
123
123
|
&& (!agentId || !e.agentId || e.agentId === agentId)
|
|
124
124
|
&& e.status !== 'completed'
|
|
125
|
-
&& !e.hidden
|
|
126
125
|
);
|
|
127
126
|
|
|
128
127
|
if (match) {
|
|
@@ -433,9 +432,6 @@ export async function handleDeleteCrewDir(msg) {
|
|
|
433
432
|
export async function resumeCrewSession(msg) {
|
|
434
433
|
const { sessionId, userId, username } = msg;
|
|
435
434
|
|
|
436
|
-
// 用户主动恢复 → 清除 hidden 标记(如果有的话)
|
|
437
|
-
await unhideCrewSession(sessionId);
|
|
438
|
-
|
|
439
435
|
if (crewSessions.has(sessionId)) {
|
|
440
436
|
const session = crewSessions.get(sessionId);
|
|
441
437
|
const roles = Array.from(session.roles.values());
|
package/crew.js
CHANGED