@yeaft/webchat-agent 0.1.301 → 0.1.303

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.
Files changed (2) hide show
  1. package/crew/control.js +4 -1
  2. package/package.json +1 -1
package/crew/control.js CHANGED
@@ -71,6 +71,9 @@ async function clearSingleRole(session, roleName) {
71
71
  session.humanMessageQueue = session.humanMessageQueue.filter(m => m.target !== roleName);
72
72
  }
73
73
 
74
+ // 保存 task 信息,clear 后恢复时传给 dispatchToRole(必须在 if 块外声明,恢复 dispatch 在块外引用)
75
+ const lastTask = roleState?.currentTask ? { ...roleState.currentTask } : null;
76
+
74
77
  if (roleState) {
75
78
  // 保存工作摘要到 task file(与 context_exceeded clear 一致)
76
79
  if (roleState.accumulatedText) {
@@ -135,7 +138,7 @@ async function clearSingleRole(session, roleName) {
135
138
  .map(msg => `[${msg.from} → ${msg.to}${msg.taskId ? ` (${msg.taskId})` : ''}] ${msg.content}`)
136
139
  .join('\n');
137
140
  const restorePrompt = `${m.memoryRestorePrompt}\n\n${summary}`;
138
- await dispatchToRole(session, roleName, restorePrompt, 'system');
141
+ await dispatchToRole(session, roleName, restorePrompt, 'system', lastTask?.taskId, lastTask?.taskTitle);
139
142
  }
140
143
  }
141
144
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yeaft/webchat-agent",
3
- "version": "0.1.301",
3
+ "version": "0.1.303",
4
4
  "description": "Remote agent for Yeaft WebChat — connects worker machines to the central server",
5
5
  "main": "index.js",
6
6
  "type": "module",