@yeaft/webchat-agent 0.1.853 → 0.1.854

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.853",
3
+ "version": "0.1.854",
4
4
  "description": "Remote agent for Yeaft WebChat — connects worker machines to the central server",
5
5
  "main": "index.js",
6
6
  "type": "module",
package/unify/engine.js CHANGED
@@ -991,14 +991,12 @@ export class Engine {
991
991
  #getCompactSummary() {
992
992
  if (!this.#conversationStore) return '';
993
993
  // Per-(group, vp) scoping: when this engine is bound to a fan-out VP,
994
- // read its own summary file. On a miss (empty scoped file) we fall
995
- // through to the legacy global file so pre-PR sessions whose only
996
- // summary lives in compact.md still surface their context — matches
997
- // the OR-fallback in web-bridge's `hasCompactSummary` flag.
994
+ // read ONLY its own summary file. Falling back to legacy compact.md here
995
+ // leaks another group/VP's summary into every new group turn after one
996
+ // post-turn compact writes the session-global file.
998
997
  if (this.#groupId && this.#vpId
999
998
  && typeof this.#conversationStore.readCompactSummaryFor === 'function') {
1000
- const scoped = this.#conversationStore.readCompactSummaryFor(this.#groupId, this.#vpId);
1001
- if (scoped) return scoped;
999
+ return this.#conversationStore.readCompactSummaryFor(this.#groupId, this.#vpId);
1002
1000
  }
1003
1001
  return this.#conversationStore.readCompactSummary();
1004
1002
  }
@@ -3595,7 +3595,10 @@ export async function handleUnifyLoadHistory(msg) {
3595
3595
  const visiblePage = groupId
3596
3596
  ? loadVisibleGroupHistoryPage(session.conversationStore, groupId, limit)
3597
3597
  : { messages: limit > 0 ? pickRecent(session.conversationStore, limit) : [], oldestSeq: null, hasMore: false };
3598
- const compactSummary = session.conversationStore.readCompactSummary();
3598
+ // Legacy compact.md is a non-group fallback only. For group replay, reading
3599
+ // it makes every group show "has compact" once any legacy/non-scoped compact
3600
+ // exists, even when this group has no scoped summary.
3601
+ const compactSummary = groupId ? '' : session.conversationStore.readCompactSummary();
3599
3602
  const replayEntries = groupId
3600
3603
  ? visiblePage.messages
3601
3604
  : visiblePage.messages
@@ -3645,15 +3648,13 @@ export async function handleUnifyLoadHistory(msg) {
3645
3648
  oldestSeq = visiblePage.oldestSeq;
3646
3649
  }
3647
3650
 
3648
- // hasCompactSummary used to read a single session-global file, so it
3649
- // was always true once ANY group/VP in the session had compacted.
3650
- // Now we check (a) the scoped dir for any per-VP summary file in this
3651
- // group, falling back to (b) the legacy global file for sessions that
3652
- // pre-date the per-(group, vp) split.
3651
+ // hasCompactSummary used to read a single session-global file, so it was
3652
+ // always true once ANY group/VP in the session had compacted. For group
3653
+ // replay, only scoped per-(group, vp) summaries count; legacy compact.md is
3654
+ // reserved for non-group / pre-scoped 1:1 callers.
3653
3655
  let hasCompactSummaryFlag = !!compactSummary;
3654
3656
  if (groupId && typeof session.conversationStore.hasAnyCompactSummaryForGroup === 'function') {
3655
- hasCompactSummaryFlag = session.conversationStore.hasAnyCompactSummaryForGroup(groupId)
3656
- || hasCompactSummaryFlag;
3657
+ hasCompactSummaryFlag = session.conversationStore.hasAnyCompactSummaryForGroup(groupId);
3657
3658
  }
3658
3659
 
3659
3660
  sendUnifyEvent({