@yeaft/webchat-agent 0.0.136 → 0.0.137
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/crew.js +11 -33
- package/package.json +1 -1
package/crew.js
CHANGED
|
@@ -1567,25 +1567,6 @@ export async function handleCrewHumanInput(msg) {
|
|
|
1567
1567
|
}
|
|
1568
1568
|
|
|
1569
1569
|
if (target) {
|
|
1570
|
-
// 检查目标角色是否正在忙
|
|
1571
|
-
const targetState = session.roleStates.get(target);
|
|
1572
|
-
if (targetState?.turnActive) {
|
|
1573
|
-
if (msg.interrupt) {
|
|
1574
|
-
// 中断模式:立即打断角色
|
|
1575
|
-
await interruptRole(session, target, buildHumanContent('人工消息(中断):', message), 'human');
|
|
1576
|
-
} else {
|
|
1577
|
-
// 排队
|
|
1578
|
-
session.humanMessageQueue.push({ target, content: message, timestamp: Date.now() });
|
|
1579
|
-
console.log(`[Crew] Human message queued for ${target} (busy)`);
|
|
1580
|
-
sendCrewMessage({
|
|
1581
|
-
type: 'crew_message_queued',
|
|
1582
|
-
sessionId: session.id,
|
|
1583
|
-
target,
|
|
1584
|
-
queueLength: session.humanMessageQueue.filter(m => m.target === target).length
|
|
1585
|
-
});
|
|
1586
|
-
}
|
|
1587
|
-
return;
|
|
1588
|
-
}
|
|
1589
1570
|
await dispatchToRole(session, target, buildHumanContent('人工消息:', message), 'human');
|
|
1590
1571
|
return;
|
|
1591
1572
|
}
|
|
@@ -1594,20 +1575,6 @@ export async function handleCrewHumanInput(msg) {
|
|
|
1594
1575
|
// 没有 @ 指定目标,默认发给决策者(PM)
|
|
1595
1576
|
const target = targetRole || session.decisionMaker;
|
|
1596
1577
|
|
|
1597
|
-
// 检查目标是否忙
|
|
1598
|
-
const targetState = session.roleStates.get(target);
|
|
1599
|
-
if (targetState?.turnActive) {
|
|
1600
|
-
session.humanMessageQueue.push({ target, content, timestamp: Date.now() });
|
|
1601
|
-
console.log(`[Crew] Human message queued for ${target} (busy)`);
|
|
1602
|
-
sendCrewMessage({
|
|
1603
|
-
type: 'crew_message_queued',
|
|
1604
|
-
sessionId: session.id,
|
|
1605
|
-
target,
|
|
1606
|
-
queueLength: session.humanMessageQueue.filter(m => m.target === target).length
|
|
1607
|
-
});
|
|
1608
|
-
return;
|
|
1609
|
-
}
|
|
1610
|
-
|
|
1611
1578
|
await dispatchToRole(session, target, buildHumanContent('人工消息:', content), 'human');
|
|
1612
1579
|
}
|
|
1613
1580
|
|
|
@@ -1976,11 +1943,22 @@ function sendCrewOutput(session, roleName, outputType, rawMessage, extra = {}) {
|
|
|
1976
1943
|
if (Array.isArray(content)) {
|
|
1977
1944
|
for (const block of content) {
|
|
1978
1945
|
if (block.type === 'tool_use') {
|
|
1946
|
+
// Save trimmed toolInput for restore — only key fields, skip large content
|
|
1947
|
+
const input = block.input || {};
|
|
1948
|
+
const trimmedInput = {};
|
|
1949
|
+
if (input.file_path) trimmedInput.file_path = input.file_path;
|
|
1950
|
+
if (input.command) trimmedInput.command = input.command.substring(0, 200);
|
|
1951
|
+
if (input.pattern) trimmedInput.pattern = input.pattern;
|
|
1952
|
+
if (input.old_string) trimmedInput.old_string = input.old_string.substring(0, 100);
|
|
1953
|
+
if (input.new_string) trimmedInput.new_string = input.new_string.substring(0, 100);
|
|
1954
|
+
if (input.url) trimmedInput.url = input.url;
|
|
1955
|
+
if (input.query) trimmedInput.query = input.query;
|
|
1979
1956
|
session.uiMessages.push({
|
|
1980
1957
|
role: roleName, roleIcon, roleName: displayName,
|
|
1981
1958
|
type: 'tool',
|
|
1982
1959
|
toolName: block.name,
|
|
1983
1960
|
toolId: block.id,
|
|
1961
|
+
toolInput: Object.keys(trimmedInput).length > 0 ? trimmedInput : null,
|
|
1984
1962
|
content: `${block.name} ${block.input?.file_path || block.input?.command?.substring(0, 60) || ''}`,
|
|
1985
1963
|
hasResult: false,
|
|
1986
1964
|
taskId, taskTitle,
|