@yeaft/webchat-agent 0.1.607 → 0.1.608

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yeaft/webchat-agent",
3
- "version": "0.1.607",
3
+ "version": "0.1.608",
4
4
  "description": "Remote agent for Yeaft WebChat — connects worker machines to the central server",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -64,6 +64,11 @@ function serializeMessage(msg) {
64
64
  // their original thread id in `sourceThreadId` so the UI can still
65
65
  // render a small "#source" pill next to each bubble.
66
66
  if (msg.sourceThreadId) fm.push(`sourceThreadId: ${msg.sourceThreadId}`);
67
+ // Bug 6: persist groupId so history replay can stamp messages with the
68
+ // group they originated in. Without this, every replayed message lands
69
+ // in the default group and switching back to the originating group
70
+ // shows an empty pane.
71
+ if (msg.groupId) fm.push(`groupId: ${msg.groupId}`);
67
72
 
68
73
  // Token estimate
69
74
  const content = msg.content || '';
@@ -134,6 +139,7 @@ export function parseMessage(raw) {
134
139
  case 'tokens_est': msg.tokens_est = parseInt(value, 10); break;
135
140
  case 'threadId': msg.threadId = value; break;
136
141
  case 'sourceThreadId': msg.sourceThreadId = value; break;
142
+ case 'groupId': msg.groupId = value; break;
137
143
  // toolCalls are multi-line YAML — handled separately below
138
144
  }
139
145
  }
package/unify/engine.js CHANGED
@@ -476,7 +476,7 @@ export class Engine {
476
476
  * @param {string} assistantContent
477
477
  * @param {object[]} [toolCalls]
478
478
  */
479
- #persistMessages(userContent, assistantContent, toolCalls) {
479
+ #persistMessages(userContent, assistantContent, toolCalls, groupId) {
480
480
  if (!this.#conversationStore) return;
481
481
  if (this.#config._readOnly) return;
482
482
 
@@ -497,6 +497,8 @@ export class Engine {
497
497
  role: 'user',
498
498
  content: userContent,
499
499
  threadId,
500
+ // Bug 6: stamp groupId so history replay can route by group.
501
+ ...(groupId ? { groupId } : {}),
500
502
  });
501
503
 
502
504
  // Persist assistant message
@@ -505,6 +507,7 @@ export class Engine {
505
507
  content: assistantContent,
506
508
  model: this.#config.model,
507
509
  threadId,
510
+ ...(groupId ? { groupId } : {}),
508
511
  };
509
512
  if (toolCalls && toolCalls.length > 0) {
510
513
  assistantMsg.toolCalls = toolCalls;
@@ -1172,6 +1175,9 @@ export class Engine {
1172
1175
  primaryModel: this.#config.model,
1173
1176
  messages: conversationMessages,
1174
1177
  trace: this.#trace,
1178
+ // Bug 6: tag persisted messages with the originating group so
1179
+ // history replay can re-stamp them on reload.
1180
+ groupId,
1175
1181
  });
1176
1182
 
1177
1183
  if (hookResult.consolidated) {
@@ -1182,7 +1188,7 @@ export class Engine {
1182
1188
  }
1183
1189
  } else {
1184
1190
  // Legacy path (no yeaftDir → use old behavior)
1185
- this.#persistMessages(prompt, fullResponseText, assistantMsg.toolCalls);
1191
+ this.#persistMessages(prompt, fullResponseText, assistantMsg.toolCalls, groupId);
1186
1192
 
1187
1193
  const consolidated = await this.#maybeConsolidate();
1188
1194
  if (consolidated && consolidated.archivedCount > 0) {
@@ -47,6 +47,10 @@ export async function runStopHooks(context) {
47
47
  messages = [],
48
48
  taskId,
49
49
  trace,
50
+ // Bug 6: groupId/threadId stamped on every persisted message so
51
+ // history replay can route messages back into the originating group.
52
+ groupId,
53
+ threadId,
50
54
  } = context;
51
55
 
52
56
  // Model name for persisted messages: use primaryModel if provided, else config.model
@@ -110,6 +114,9 @@ export async function runStopHooks(context) {
110
114
  record.toolCalls = msg.toolCalls;
111
115
  }
112
116
  if (msg.isError) record.isError = true;
117
+ // Bug 6: stamp groupId / threadId so replay can re-route by group.
118
+ if (groupId) record.groupId = groupId;
119
+ if (threadId) record.threadId = threadId;
113
120
  conversationStore.append(record);
114
121
  result.messagesPersisted++;
115
122
  }
@@ -2238,13 +2238,17 @@ export async function handleUnifyLoadHistory(msg) {
2238
2238
  // Send each message through standard claude_output rendering pipeline
2239
2239
  for (const m of messages) {
2240
2240
  if (m.role === 'user') {
2241
- sendUnifyOutput({ type: 'user', message: { content: m.content } });
2241
+ // Bug 6: forward groupId per message so the frontend re-stamps
2242
+ // replayed messages into their originating group instead of the
2243
+ // user's current filter (which would otherwise hide them when
2244
+ // switching groups).
2245
+ sendUnifyOutput({ type: 'user', message: { content: m.content } }, m.groupId || null);
2242
2246
  } else if (m.role === 'assistant') {
2243
2247
  sendUnifyOutput({
2244
2248
  type: 'assistant',
2245
2249
  message: { content: [{ type: 'text', text: m.content }] },
2246
- });
2247
- sendUnifyOutput({ type: 'result', result_text: '' });
2250
+ }, m.groupId || null);
2251
+ sendUnifyOutput({ type: 'result', result_text: '' }, m.groupId || null);
2248
2252
  }
2249
2253
  }
2250
2254