@yeaft/webchat-agent 0.1.932 → 0.1.934

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.932",
3
+ "version": "0.1.934",
4
4
  "description": "Remote agent for Yeaft WebChat — connects worker machines to the central server",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -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
  }
@@ -612,6 +614,7 @@ export class Engine {
612
614
  * ownVpId: string|null,
613
615
  * scopes: string[],
614
616
  * snapshotBlock: string,
617
+ * residentEntries: Array<{scope:string, summary:string}>,
615
618
  * } | null}
616
619
  */
617
620
  #prepareAms(args) {
@@ -650,7 +653,7 @@ export class Engine {
650
653
  vpId: ownVpId,
651
654
  });
652
655
 
653
- return { ams, groupKey, ownVpId, scopes, snapshotBlock };
656
+ return { ams, groupKey, ownVpId, scopes, snapshotBlock, residentEntries };
654
657
  }
655
658
 
656
659
  /**
@@ -1475,6 +1478,25 @@ export class Engine {
1475
1478
  memoryInjection = amsContext.snapshotBlock;
1476
1479
  }
1477
1480
 
1481
+ // Diagnostic payload for the Dream debug panel. The full AMS Resident
1482
+ // layer can include user and per-VP summaries, but the browser-facing
1483
+ // Dream prompt-load view only needs to prove the active session Dream
1484
+ // summary entered `system_prompt.memory`. Keep the payload scoped to the
1485
+ // exact session resident to avoid leaking unrelated resident summaries into
1486
+ // frontend state. The full system prompt remains visible in the existing
1487
+ // debug-only system-prompt panel.
1488
+ const activeGroupDreamScope = sessionId ? `sessions/${sessionId}` : null;
1489
+ const dreamResidentLoaded = amsContext && Array.isArray(amsContext.residentEntries)
1490
+ ? amsContext.residentEntries
1491
+ .filter(e => e && e.scope === activeGroupDreamScope && e.summary)
1492
+ .map(e => ({
1493
+ scope: e.scope,
1494
+ summary: String(e.summary).slice(0, 4000),
1495
+ truncated: String(e.summary).length > 4000,
1496
+ source: 'resident-summary',
1497
+ }))
1498
+ : [];
1499
+
1478
1500
  // ─── Active Scope (DESIGN-PROMPT §3 ④) ──────────────────────
1479
1501
  // Structured per-turn scope summary: group + vp + envelope routing
1480
1502
  // info. Long-form scope content lives in AMS — this block carries
@@ -1652,6 +1674,17 @@ export class Engine {
1652
1674
  };
1653
1675
  }
1654
1676
 
1677
+ if (dreamResidentLoaded.length > 0) {
1678
+ yield {
1679
+ type: 'dream_memory_loaded',
1680
+ turnId: queryTurnId,
1681
+ vpId: queryVpId,
1682
+ sessionId: sessionId || null,
1683
+ loadedInto: 'system_prompt.memory',
1684
+ resident: dreamResidentLoaded,
1685
+ };
1686
+ }
1687
+
1655
1688
  const toolDefs = this.#getToolDefs();
1656
1689
  let turnNumber = 0;
1657
1690
  let continueTurns = 0; // auto-continue counter
@@ -2212,6 +2212,17 @@ function handleEngineEvent(event, hctx) {
2212
2212
  }, envelope);
2213
2213
  break;
2214
2214
 
2215
+ case 'dream_memory_loaded':
2216
+ sendYeaftEvent({
2217
+ type: 'dream_memory_loaded',
2218
+ turnId: event.turnId,
2219
+ vpId: event.vpId || null,
2220
+ sessionId: event.sessionId || null,
2221
+ loadedInto: event.loadedInto || 'system_prompt.memory',
2222
+ resident: Array.isArray(event.resident) ? event.resident : [],
2223
+ }, envelope);
2224
+ break;
2225
+
2215
2226
  case 'memory_adjust':
2216
2227
  sendYeaftEvent({
2217
2228
  type: 'memory_adjust',