@yeaft/webchat-agent 0.1.788 → 0.1.789

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.788",
3
+ "version": "0.1.789",
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
@@ -1782,7 +1782,7 @@ export class Engine {
1782
1782
 
1783
1783
  // PR-L: T2 end-of-turn (asynchronous) reflection. Fires when the
1784
1784
  // total tool count for this query() exceeds TURN_SUMMARY_THRESHOLD
1785
- // (5) AND no T1 has actually rewritten the arc yet. Kicks off the
1785
+ // (8) AND no T1 has actually rewritten the arc yet. Kicks off the
1786
1786
  // primary-model call without await; the next query()'s
1787
1787
  // `#applyPendingT2Reflections` carries the result forward.
1788
1788
  //
@@ -10,16 +10,30 @@
10
10
  *
11
11
  * The constants are NOT config-driven — V7 design freezes them in code.
12
12
  *
13
+ * Invariant: TURN_SUMMARY_THRESHOLD < TOOL_BATCH_SIZE. T1 runs inside the
14
+ * turn and collapses history in place; T2 fires at end_turn and is gated
15
+ * by `t1CollapsesDone === 0` (engine.js). If T2 were ever set ≥ T1, T1
16
+ * would collapse first and T2 could never fire — silently disabling the
17
+ * end-of-turn reflection path. Keep a usefully wide gap between the two
18
+ * so the (T2, T1) band where T2-alone applies stays meaningful.
19
+ *
13
20
  * TOOL_BATCH_SIZE history: was 13 originally; raised to 30 (2026-05-15)
14
21
  * after user feedback that 13 fired too often inside a single task and
15
22
  * fragmented otherwise-coherent tool arcs into multiple reflections. 30
16
23
  * keeps the periodic-reflection contract (it still fires every N tools,
17
24
  * not just once) but gives a single task arc room to breathe before the
18
25
  * arc gets collapsed.
26
+ *
27
+ * TURN_SUMMARY_THRESHOLD history: was 5 originally; raised to 8
28
+ * (2026-05-18). 5 was too aggressive — small "read a few files, edit one,
29
+ * run tests" turns crossed it and produced a T2 reflection card the user
30
+ * didn't want. 8 lets short-to-medium turns finish without a reflection
31
+ * while still folding the long ones that genuinely benefit from a summary
32
+ * before the next turn's history grows.
19
33
  */
20
34
 
21
35
  export const TOOL_BATCH_SIZE = 30;
22
- export const TURN_SUMMARY_THRESHOLD = 5;
36
+ export const TURN_SUMMARY_THRESHOLD = 8;
23
37
  export const DUP_TOOL_THRESHOLD = 3;
24
38
 
25
39
  export { ExecLog, buildEntry, argsHashOf } from './exec-log.js';