@yeaft/webchat-agent 0.1.933 → 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.933",
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
@@ -29,7 +29,10 @@ export function truncateDreamText(value, limit = DREAM_SNAPSHOT_TEXT_LIMIT) {
29
29
  */
30
30
  export async function buildDreamOutputSnapshot(sessionLike, sessionId) {
31
31
  if (!sessionId || !sessionLike?.yeaftDir) return null;
32
- const scope = `group/${sessionId}`;
32
+ const scope = `sessions/${sessionId}`;
33
+ // Disk compatibility: Dream currently writes session summaries through
34
+ // the historical kind:'group' store path. The snapshot's public scope label
35
+ // is still sessions/<id>.
33
36
  const memoryScope = { kind: 'group', id: sessionId };
34
37
  const root = join(sessionLike.yeaftDir, 'memory');
35
38
  const [memoryRaw, summaryRaw, state] = await Promise.all([
package/yeaft/engine.js CHANGED
@@ -260,7 +260,9 @@ export function buildResidentEntries(args) {
260
260
  const out = [];
261
261
  if (summaries.user) out.push({ scope: 'user', summary: summaries.user });
262
262
  if (args.sessionId && summaries.group) {
263
- out.push({ scope: `group/${args.sessionId}`, summary: summaries.group });
263
+ // Presentation label: product-facing prompt scopes are sessions, even
264
+ // though the current disk compatibility path still reads kind:'group'.
265
+ out.push({ scope: `sessions/${args.sessionId}`, summary: summaries.group });
264
266
  }
265
267
  // VP per-session isolation (2026-06-09): the VP summary scope MUST be
266
268
  // session-qualified. The legacy bare `vp/<id>` scope was a structural
@@ -273,7 +275,7 @@ export function buildResidentEntries(args) {
273
275
  // makes the per-session boundary explicit and matches the on-disk
274
276
  // layout 1:1.
275
277
  if (args.sessionId && args.ownVpId && summaries.vp && !isVpSeedBackfillStub(summaries.vp)) {
276
- out.push({ scope: `group/${args.sessionId}/vp/${args.ownVpId}`, summary: summaries.vp });
278
+ out.push({ scope: `sessions/${args.sessionId}/vp/${args.ownVpId}`, summary: summaries.vp });
277
279
  }
278
280
  return out;
279
281
  }
@@ -1478,12 +1480,12 @@ export class Engine {
1478
1480
 
1479
1481
  // Diagnostic payload for the Dream debug panel. The full AMS Resident
1480
1482
  // layer can include user and per-VP summaries, but the browser-facing
1481
- // Dream prompt-load view only needs to prove the active group Dream
1483
+ // Dream prompt-load view only needs to prove the active session Dream
1482
1484
  // summary entered `system_prompt.memory`. Keep the payload scoped to the
1483
- // exact group resident to avoid leaking unrelated resident summaries into
1485
+ // exact session resident to avoid leaking unrelated resident summaries into
1484
1486
  // frontend state. The full system prompt remains visible in the existing
1485
1487
  // debug-only system-prompt panel.
1486
- const activeGroupDreamScope = sessionId ? `group/${sessionId}` : null;
1488
+ const activeGroupDreamScope = sessionId ? `sessions/${sessionId}` : null;
1487
1489
  const dreamResidentLoaded = amsContext && Array.isArray(amsContext.residentEntries)
1488
1490
  ? amsContext.residentEntries
1489
1491
  .filter(e => e && e.scope === activeGroupDreamScope && e.summary)
@@ -2217,6 +2219,7 @@ export class Engine {
2217
2219
  // history replay can re-stamp them on reload.
2218
2220
  sessionId,
2219
2221
  threadId,
2222
+ vpId: this.#vpId,
2220
2223
  // Multi-VP fan-out (history-dedup): skip the user-row append
2221
2224
  // in stop-hooks when the orchestrator already wrote it once
2222
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
  }