@yeaft/webchat-agent 0.1.601 → 0.1.602

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.601",
3
+ "version": "0.1.602",
4
4
  "description": "Remote agent for Yeaft WebChat — connects worker machines to the central server",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -24,6 +24,7 @@
24
24
  import { dreamShard } from './dream-shard.js';
25
25
  import { checkRecompression } from './recompression.js';
26
26
  import { runUserDreamJob } from './user-memory-store.js';
27
+ import { runDreamTick } from '../dream-v2/tick.js';
27
28
 
28
29
  /** Default idle timeout before dream triggers (ms). */
29
30
  export const DREAM_IDLE_MS = 30 * 60 * 1000; // 30 min
@@ -158,6 +159,37 @@ export function createDreamScheduler(opts = {}) {
158
159
  // Non-fatal
159
160
  }
160
161
 
162
+ // Phase 8 PR-F: dream-v2 diff-gated scope-summary refresh
163
+ // (DESIGN.md §9.14). The legacy dreamShard pipeline above
164
+ // refreshed shard summaries; this final tick walks the scope
165
+ // tree (user/group/vp/task), computes per-scope sigs, and only
166
+ // re-runs the refresh hook for scopes whose content changed.
167
+ // Refresh-only in v1 (no prune/demote — DESIGN §8 line 395).
168
+ if (memoryDir) {
169
+ try {
170
+ const scopes = [{ kind: 'user', scopeDir: 'user' }];
171
+ if (group?.id) scopes.push({ kind: 'group', id: group.id, scopeDir: `groups/${group.id}` });
172
+ const tickResult = await runDreamTick({
173
+ root: memoryDir,
174
+ scopes,
175
+ refresh: async (_scope) => {
176
+ // v1 refresh hook: no-op placeholder. The actual scope
177
+ // summary refresh continues to flow through the legacy
178
+ // shard / user-dream paths above; this tick only
179
+ // exercises the diff-gate + cursor write so future hook
180
+ // implementations can plug in without re-wiring.
181
+ },
182
+ });
183
+ result.dreamV2Tick = {
184
+ ran: tickResult.ran.length,
185
+ skipped: tickResult.skipped.length,
186
+ errors: tickResult.errors.length,
187
+ };
188
+ } catch {
189
+ // Non-fatal
190
+ }
191
+ }
192
+
161
193
  messagesSinceLastDream = 0;
162
194
  lastDreamAt = Date.now();
163
195
  onDreamEnd?.(vpId, { ...result, trigger });