@yeaft/webchat-agent 0.1.934 → 0.1.935

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.934",
3
+ "version": "0.1.935",
4
4
  "description": "Remote agent for Yeaft WebChat — connects worker machines to the central server",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -1064,7 +1064,18 @@ export class ConversationStore {
1064
1064
 
1065
1065
  const startIdx = indexOfNthTurnFromEnd(visible, turnsLimit);
1066
1066
  const start = startIdx === -1 ? 0 : startIdx;
1067
- const messages = pairSanitize(visible.slice(start));
1067
+ // Visible history is for UI replay, not LLM context. The visible loader
1068
+ // already excludes tool-result rows, so running pairSanitize here can
1069
+ // incorrectly treat tool-using assistant replies as orphaned tool arcs and
1070
+ // drop/trim VP messages. Strip tool-call metadata instead and keep the
1071
+ // user-visible assistant text for the conversation pane.
1072
+ const messages = visible.slice(start).map(m => {
1073
+ if (m && m.role === 'assistant' && Array.isArray(m.toolCalls) && m.toolCalls.length > 0) {
1074
+ const { toolCalls, ...rest } = m;
1075
+ return rest;
1076
+ }
1077
+ return m;
1078
+ });
1068
1079
  const oldestSeq = messages.length ? parseSeqFromId(messages[0].id) : null;
1069
1080
  const firstVisibleSeq = parseSeqFromId(visible[0].id);
1070
1081
  const hasMore = messages.length > 0
package/yeaft/engine.js CHANGED
@@ -2219,6 +2219,7 @@ export class Engine {
2219
2219
  // history replay can re-stamp them on reload.
2220
2220
  sessionId,
2221
2221
  threadId,
2222
+ vpId: this.#vpId,
2222
2223
  // Multi-VP fan-out (history-dedup): skip the user-row append
2223
2224
  // in stop-hooks when the orchestrator already wrote it once
2224
2225
  // for this turn. The hook still persists assistant + tool
@@ -65,6 +65,9 @@ export async function runStopHooks(context) {
65
65
  // history replay can route messages back into the originating group.
66
66
  sessionId,
67
67
  threadId,
68
+ // Group VP attribution: persist the engine-bound VP id on assistant/tool
69
+ // rows so history replay can route replies back to the same visible VP.
70
+ vpId,
68
71
  // Multi-VP fan-out (history-dedup): when several engines run the
69
72
  // same user prompt in parallel, the orchestrator persists the user
70
73
  // row exactly once before fan-out. Each VP's stop-hook then skips
@@ -164,6 +167,9 @@ export async function runStopHooks(context) {
164
167
  // Bug 6: stamp sessionId / threadId so replay can re-route by group.
165
168
  if (sessionId) record.sessionId = sessionId;
166
169
  if (threadId) record.threadId = threadId;
170
+ if (vpId && (msg.role === 'assistant' || msg.role === 'tool')) {
171
+ record.speakerVpId = vpId;
172
+ }
167
173
  conversationStore.append(record);
168
174
  result.messagesPersisted++;
169
175
  }