@yeaft/webchat-agent 0.1.500 → 0.1.501

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/unify/engine.js +14 -11
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yeaft/webchat-agent",
3
- "version": "0.1.500",
3
+ "version": "0.1.501",
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
@@ -26,8 +26,17 @@ import { buildMemoryInjection } from './memory/layout.js';
26
26
  import { runStopHooks } from './stop-hooks.js';
27
27
  import { getThreadStore, MAIN_THREAD_ID } from './threads/store.js';
28
28
 
29
- /** Maximum number of turns before the engine stops to prevent infinite loops. */
30
- const MAX_TURNS = 25;
29
+ /**
30
+ * task-324 — Turn cap removed.
31
+ *
32
+ * Previously MAX_TURNS=25 broke the query loop out of long tool-driven
33
+ * conversations (user report: Unify loop errored at the cap). The engine
34
+ * now runs until the LLM itself returns stopReason='end_turn' or a
35
+ * non-retryable error surfaces. Real runaway loops are still bounded by:
36
+ * • provider rate limits / context window (LLMContextError → compact)
37
+ * • user-initiated abort (AbortController / cancel)
38
+ * • MAX_CONTINUE_TURNS for the max_tokens auto-continue path
39
+ */
31
40
 
32
41
  /** Maximum auto-continue turns when stopReason is 'max_tokens'. */
33
42
  const MAX_CONTINUE_TURNS = 3;
@@ -401,15 +410,9 @@ export class Engine {
401
410
  while (true) {
402
411
  turnNumber++;
403
412
 
404
- // Safety: prevent infinite loops
405
- if (turnNumber > MAX_TURNS) {
406
- yield {
407
- type: 'error',
408
- error: new Error(`Max turns (${MAX_TURNS}) reached — stopping to prevent infinite loop`),
409
- retryable: false,
410
- };
411
- break;
412
- }
413
+ // task-324: no hard MAX_TURNS cap. Loop terminates on end_turn,
414
+ // non-retryable error, LLMContextError (after compact retry), or
415
+ // caller abort. Keeping this comment so the removal is traceable.
413
416
 
414
417
  const turnId = this.#trace.startTurn({
415
418
  traceId: this.#traceId,