@yeaft/webchat-agent 1.0.76 → 1.0.78
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/buffer.js +2 -6
- package/connection/message-router.js +1 -64
- package/conversation.js +4 -32
- package/history.js +2 -2
- package/index.js +0 -6
- package/package.json +1 -1
- package/providers/claude-code.js +1 -1
- package/yeaft/attachments.js +2 -2
- package/yeaft/config.js +1 -1
- package/yeaft/conversation/persist.js +458 -112
- package/yeaft/conversation/search.js +51 -15
- package/yeaft/session.js +27 -18
- package/yeaft/web-bridge.js +27 -15
- package/crew/builtin-actions.js +0 -154
- package/crew/context-loader.js +0 -171
- package/crew/control.js +0 -444
- package/crew/human-interaction.js +0 -195
- package/crew/persistence.js +0 -295
- package/crew/role-management.js +0 -182
- package/crew/role-output.js +0 -461
- package/crew/role-query.js +0 -406
- package/crew/role-states.js +0 -180
- package/crew/routing-fallback.js +0 -64
- package/crew/routing-metrics.js +0 -215
- package/crew/routing.js +0 -951
- package/crew/session.js +0 -648
- package/crew/shared-dir.js +0 -266
- package/crew/task-files.js +0 -554
- package/crew/ui-messages.js +0 -274
- package/crew/worktree.js +0 -130
- package/crew-i18n.js +0 -579
- package/crew.js +0 -48
package/connection/buffer.js
CHANGED
|
@@ -9,11 +9,7 @@ export const BUFFERABLE_TYPES = new Set([
|
|
|
9
9
|
'turn_completed', 'conversation_closed',
|
|
10
10
|
'session_id_update', 'compact_status', 'slash_commands_update',
|
|
11
11
|
'background_task_started', 'background_task_output',
|
|
12
|
-
'subagent_started', 'subagent_message', 'subagent_completed'
|
|
13
|
-
'crew_output', 'crew_status', 'crew_turn_completed',
|
|
14
|
-
'crew_session_created', 'crew_session_restored', 'crew_human_needed',
|
|
15
|
-
'crew_role_added', 'crew_role_removed',
|
|
16
|
-
'crew_role_compact', 'crew_context_usage'
|
|
12
|
+
'subagent_started', 'subagent_message', 'subagent_completed'
|
|
17
13
|
]);
|
|
18
14
|
|
|
19
15
|
function bufferMessage(msg, reason) {
|
|
@@ -27,7 +23,7 @@ function bufferMessage(msg, reason) {
|
|
|
27
23
|
return 'buffered';
|
|
28
24
|
}
|
|
29
25
|
// Buffer full: drop oldest non-status messages to make room
|
|
30
|
-
const dropIdx = ctx.messageBuffer.findIndex(m => m.type !== '
|
|
26
|
+
const dropIdx = ctx.messageBuffer.findIndex(m => m.type !== 'turn_completed');
|
|
31
27
|
if (dropIdx >= 0) {
|
|
32
28
|
ctx.messageBuffer.splice(dropIdx, 1);
|
|
33
29
|
ctx.messageBuffer.push(msg);
|
|
@@ -3,11 +3,7 @@
|
|
|
3
3
|
*
|
|
4
4
|
* task-330c lint guard:
|
|
5
5
|
* ⚠️ DO NOT introduce greedy `text.replace(/---ROUTE---[\s\S]*$/g, '')`
|
|
6
|
-
* style strips on routed message payloads.
|
|
7
|
-
* owned EXCLUSIVELY by `agent/crew/routing.js` `parseRoutes()` which
|
|
8
|
-
* returns `{routes, displayBody}` with exact ranges removed. A second
|
|
9
|
-
* strip here would re-process already-cleaned text and risks both
|
|
10
|
-
* double-strip artefacts and the trailing-prose bug fixed by task-328.
|
|
6
|
+
* style strips on routed message payloads.
|
|
11
7
|
*/
|
|
12
8
|
import ctx from '../context.js';
|
|
13
9
|
import { decodeKey } from '../encryption.js';
|
|
@@ -26,12 +22,6 @@ import {
|
|
|
26
22
|
sendConversationList, handleBtwQuestion, preloadSlashCommands,
|
|
27
23
|
handlePingSession
|
|
28
24
|
} from '../conversation.js';
|
|
29
|
-
import {
|
|
30
|
-
createCrewSession, handleCrewHumanInput, handleCrewControl,
|
|
31
|
-
addRoleToSession, removeRoleFromSession,
|
|
32
|
-
handleListCrewSessions, handleCheckCrewExists, handleDeleteCrewDir, resumeCrewSession, removeFromCrewIndex,
|
|
33
|
-
handleLoadCrewHistory, handleCheckCrewContext
|
|
34
|
-
} from '../crew.js';
|
|
35
25
|
import { sendToServer, flushMessageBuffer } from './buffer.js';
|
|
36
26
|
import { handleRestartAgent, handleUpgradeAgent } from './upgrade.js';
|
|
37
27
|
import { loadMcpServers, updateMcpConfig } from '../mcp.js';
|
|
@@ -118,10 +108,6 @@ export async function handleMessage(msg) {
|
|
|
118
108
|
preloadSlashCommands().catch(() => {});
|
|
119
109
|
break;
|
|
120
110
|
|
|
121
|
-
case 'check_crew_context':
|
|
122
|
-
handleCheckCrewContext(msg);
|
|
123
|
-
break;
|
|
124
|
-
|
|
125
111
|
case 'resume_conversation':
|
|
126
112
|
await resumeConversation(msg);
|
|
127
113
|
break;
|
|
@@ -262,55 +248,6 @@ export async function handleMessage(msg) {
|
|
|
262
248
|
handleAskUserAnswer(msg);
|
|
263
249
|
break;
|
|
264
250
|
|
|
265
|
-
// Crew (multi-agent) messages
|
|
266
|
-
case 'create_crew_session':
|
|
267
|
-
await createCrewSession(msg);
|
|
268
|
-
break;
|
|
269
|
-
|
|
270
|
-
case 'crew_human_input':
|
|
271
|
-
await handleCrewHumanInput(msg);
|
|
272
|
-
break;
|
|
273
|
-
|
|
274
|
-
case 'crew_control':
|
|
275
|
-
await handleCrewControl(msg);
|
|
276
|
-
break;
|
|
277
|
-
|
|
278
|
-
case 'crew_add_role':
|
|
279
|
-
await addRoleToSession(msg);
|
|
280
|
-
break;
|
|
281
|
-
|
|
282
|
-
case 'crew_remove_role':
|
|
283
|
-
await removeRoleFromSession(msg);
|
|
284
|
-
break;
|
|
285
|
-
|
|
286
|
-
case 'list_crew_sessions':
|
|
287
|
-
await handleListCrewSessions(msg);
|
|
288
|
-
break;
|
|
289
|
-
|
|
290
|
-
case 'check_crew_exists':
|
|
291
|
-
await handleCheckCrewExists(msg);
|
|
292
|
-
break;
|
|
293
|
-
|
|
294
|
-
case 'delete_crew_dir':
|
|
295
|
-
await handleDeleteCrewDir(msg);
|
|
296
|
-
break;
|
|
297
|
-
|
|
298
|
-
case 'resume_crew_session':
|
|
299
|
-
await resumeCrewSession(msg);
|
|
300
|
-
break;
|
|
301
|
-
|
|
302
|
-
case 'delete_crew_session':
|
|
303
|
-
await removeFromCrewIndex(msg.sessionId);
|
|
304
|
-
(await import('../conversation.js')).sendConversationList();
|
|
305
|
-
break;
|
|
306
|
-
|
|
307
|
-
case 'update_crew_session':
|
|
308
|
-
await (await import('../crew.js')).handleUpdateCrewSession(msg);
|
|
309
|
-
break;
|
|
310
|
-
|
|
311
|
-
case 'crew_load_history':
|
|
312
|
-
await handleLoadCrewHistory(msg);
|
|
313
|
-
break;
|
|
314
251
|
|
|
315
252
|
// Port proxy
|
|
316
253
|
case 'proxy_request':
|
package/conversation.js
CHANGED
|
@@ -5,7 +5,6 @@ import ctx from './context.js';
|
|
|
5
5
|
import { query } from './sdk/index.js';
|
|
6
6
|
import { loadSessionHistory } from './history.js';
|
|
7
7
|
import { startClaudeQuery } from './claude.js';
|
|
8
|
-
import { crewSessions } from './crew.js';
|
|
9
8
|
import { getProvider, DEFAULT_PROVIDER, isValidProvider } from './providers/index.js';
|
|
10
9
|
|
|
11
10
|
// 不支持的斜杠命令(真正需要交互式 CLI 的命令)
|
|
@@ -191,7 +190,7 @@ function prestartClaude(conversationId, workDir, resumeSessionId) {
|
|
|
191
190
|
*
|
|
192
191
|
* @param {string} [workDir] - Project directory (default: agent workDir)
|
|
193
192
|
* @param {string} [targetId] - conversationId to key the update to
|
|
194
|
-
* ('__preload__' for agent-level
|
|
193
|
+
* ('__preload__' for agent-level)
|
|
195
194
|
*/
|
|
196
195
|
export async function preloadSlashCommands(workDir, targetId = '__preload__') {
|
|
197
196
|
const effectiveWorkDir = workDir || ctx.CONFIG.workDir;
|
|
@@ -283,7 +282,7 @@ export function parseSlashCommand(message) {
|
|
|
283
282
|
return { type: null, message };
|
|
284
283
|
}
|
|
285
284
|
|
|
286
|
-
// 发送 conversation
|
|
285
|
+
// 发送 conversation 列表。
|
|
287
286
|
export async function sendConversationList() {
|
|
288
287
|
const list = [];
|
|
289
288
|
for (const [id, state] of ctx.conversations) {
|
|
@@ -305,19 +304,6 @@ export async function sendConversationList() {
|
|
|
305
304
|
};
|
|
306
305
|
list.push(entry);
|
|
307
306
|
}
|
|
308
|
-
// 追加活跃 crew sessions。历史 Crew 索引可能触发磁盘读取,保持按需加载,
|
|
309
|
-
// 由显式 list_crew_sessions 请求处理,避免普通 Chat/Yeaft 列表提前加载 Crew。
|
|
310
|
-
for (const [id, session] of crewSessions) {
|
|
311
|
-
list.push({
|
|
312
|
-
id,
|
|
313
|
-
workDir: session.projectDir,
|
|
314
|
-
createdAt: session.createdAt,
|
|
315
|
-
processing: session.status === 'running',
|
|
316
|
-
userId: session.userId,
|
|
317
|
-
username: session.username,
|
|
318
|
-
type: 'crew',
|
|
319
|
-
});
|
|
320
|
-
}
|
|
321
307
|
ctx.sendToServer({
|
|
322
308
|
type: 'conversation_list',
|
|
323
309
|
conversations: list
|
|
@@ -1046,19 +1032,16 @@ export function handleAskUserAnswer(msg) {
|
|
|
1046
1032
|
}
|
|
1047
1033
|
|
|
1048
1034
|
/**
|
|
1049
|
-
* Handle /btw side question
|
|
1035
|
+
* Handle /btw side question.
|
|
1050
1036
|
*
|
|
1051
1037
|
* Multi-turn: First question forks the session (forkSession: true).
|
|
1052
1038
|
* Subsequent questions resume the forked session (no fork).
|
|
1053
1039
|
* The forked session ID is captured from system init and returned in btw_done.
|
|
1054
|
-
*
|
|
1055
|
-
* Crew mode: If conversationId is a crew session, use the decision maker's
|
|
1056
|
-
* claudeSessionId as the base for forking.
|
|
1057
1040
|
*/
|
|
1058
1041
|
export async function handleBtwQuestion(msg) {
|
|
1059
1042
|
const { conversationId, question, btwSessionId } = msg;
|
|
1060
1043
|
|
|
1061
|
-
// 1. Find the base session
|
|
1044
|
+
// 1. Find the base chat session.
|
|
1062
1045
|
let baseSessionId = null;
|
|
1063
1046
|
let workDir = null;
|
|
1064
1047
|
|
|
@@ -1066,17 +1049,6 @@ export async function handleBtwQuestion(msg) {
|
|
|
1066
1049
|
if (chatState?.claudeSessionId) {
|
|
1067
1050
|
baseSessionId = chatState.claudeSessionId;
|
|
1068
1051
|
workDir = chatState.workDir;
|
|
1069
|
-
} else {
|
|
1070
|
-
// Crew mode: find decision maker's session
|
|
1071
|
-
const crewSession = crewSessions.get(conversationId);
|
|
1072
|
-
if (crewSession) {
|
|
1073
|
-
const dmName = crewSession.decisionMaker;
|
|
1074
|
-
const dmState = dmName ? crewSession.roleStates.get(dmName) : null;
|
|
1075
|
-
if (dmState?.claudeSessionId) {
|
|
1076
|
-
baseSessionId = dmState.claudeSessionId;
|
|
1077
|
-
workDir = crewSession.projectDir;
|
|
1078
|
-
}
|
|
1079
|
-
}
|
|
1080
1052
|
}
|
|
1081
1053
|
|
|
1082
1054
|
if (!baseSessionId) {
|
package/history.js
CHANGED
|
@@ -65,8 +65,8 @@ export function getWorkDirFromProjectFolder(projectFolderPath, folderName) {
|
|
|
65
65
|
|
|
66
66
|
// 获取指定目录的历史会话列表
|
|
67
67
|
export async function getHistorySessions(workDir) {
|
|
68
|
-
|
|
69
|
-
if (workDir &&
|
|
68
|
+
const retiredCollabRoleDirPattern = new RegExp('[/\\\\]\\\\.' + 'crew' + '[/\\\\]roles[/\\\\]');
|
|
69
|
+
if (workDir && retiredCollabRoleDirPattern.test(workDir)) {
|
|
70
70
|
return [];
|
|
71
71
|
}
|
|
72
72
|
|
package/index.js
CHANGED
|
@@ -121,12 +121,6 @@ async function detectCapabilities() {
|
|
|
121
121
|
const pty = await loadNodePty();
|
|
122
122
|
if (pty) capabilities.push('terminal');
|
|
123
123
|
|
|
124
|
-
// Crew mode requires Claude CLI
|
|
125
|
-
try {
|
|
126
|
-
const { getDefaultClaudeCodePath } = await import('./sdk/utils.js');
|
|
127
|
-
const claudePath = getDefaultClaudeCodePath();
|
|
128
|
-
if (claudePath) capabilities.push('crew');
|
|
129
|
-
} catch {}
|
|
130
124
|
|
|
131
125
|
console.log(`[Capabilities] Detected: ${capabilities.join(', ')}`);
|
|
132
126
|
return capabilities;
|
package/package.json
CHANGED
package/providers/claude-code.js
CHANGED
|
@@ -62,7 +62,7 @@ export async function listFolders() {
|
|
|
62
62
|
let stats;
|
|
63
63
|
try { stats = statSync(entryPath); } catch { continue; }
|
|
64
64
|
if (!stats.isDirectory()) continue;
|
|
65
|
-
if (entry.includes('--crew-roles-')) continue;
|
|
65
|
+
if (entry.includes('--' + 'crew' + '-roles-')) continue;
|
|
66
66
|
|
|
67
67
|
const originalPath = getWorkDirFromProjectFolder(entryPath, entry);
|
|
68
68
|
let sessionCount = 0;
|
package/yeaft/attachments.js
CHANGED
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
* synthesized [Uploaded files] suffix) for the LLM call.
|
|
17
17
|
*
|
|
18
18
|
* Inputs (`files`) come from the server-side resolver in
|
|
19
|
-
* `client-conversation.js
|
|
19
|
+
* `client-conversation.js`: each entry is
|
|
20
20
|
* `{ name, mimeType, data: <base64>, isImage }` — the `pendingFiles`
|
|
21
21
|
* `fileId` was already consumed by the server before `forwardToAgent`.
|
|
22
22
|
*
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
* Field name is `media_type` (snake_case) to match the Anthropic
|
|
34
34
|
* Messages API spec — Anthropic adapter forwards user-content blocks
|
|
35
35
|
* verbatim, so the on-the-wire form must already be correct here.
|
|
36
|
-
* `
|
|
36
|
+
* `workbench/transfer.js` emits the same shape.
|
|
37
37
|
* - `failed`: list of `{ name, error }` for entries that could not
|
|
38
38
|
* be persisted (disk full, bad base64, ...). The caller surfaces
|
|
39
39
|
* this so the UI can tell the user *which* file blew up rather
|
package/yeaft/config.js
CHANGED
|
@@ -434,7 +434,7 @@ export function loadConfig(overrides = {}) {
|
|
|
434
434
|
projectDocMaxBytes: overrides.projectDocMaxBytes ?? jsonConfig.projectDocMaxBytes ?? DEFAULTS.projectDocMaxBytes,
|
|
435
435
|
|
|
436
436
|
// task-318: Yeaft runtime caps. `yeaft` is a nested section so we
|
|
437
|
-
// don't pollute the flat config namespace used by chat
|
|
437
|
+
// don't pollute the flat config namespace used by chat code.
|
|
438
438
|
yeaft: normaliseYeaftSection(jsonConfig.yeaft),
|
|
439
439
|
|
|
440
440
|
// Legacy fields (null when using config.json)
|