@livx.cc/agentx 0.99.42 → 0.99.44

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.
@@ -251,7 +251,9 @@ declare class AgentOptions {
251
251
  /** Retry budget for an EMPTY/silent-turn (a delegated-runtime wedge: cursor's warm helper spins then
252
252
  * returns a content-less end, surfaced as `code:'empty'`/`code:'cursor_silent'`). Tuned WIDER than the
253
253
  * network-drop budget (fixed 2) because clearing a wedge needs several reap+respawn cycles — each retry
254
- * hits a FRESH cursor session (the adapter evicts the wedged warm helper on the silent-end). Still bounded:
254
+ * hits a FRESH cursor session (the adapter evicts the wedged warm helper on the silent-end; a stall-watchdog
255
+ * cancel is NOT this class — it is classified `stall`, and the watchdog's coded abort reason is what tells
256
+ * the adapter to evict on that path too). Still bounded:
255
257
  * after exhaustion the turn surfaces `finishReason:'empty'` (non-zero exit), never infinite, never silent.
256
258
  * Env: AGENTX_EMPTY_RETRIES. */
257
259
  emptyRetries: number;
package/dist/cli.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env bun
2
- import { H as Hooks, i as RunResult, R as ReasoningEffort, A as Agent } from './Agent-DydgLoT-.js';
2
+ import { H as Hooks, i as RunResult, R as ReasoningEffort, A as Agent } from './Agent-f4um2q8E.js';
3
3
  import { IFilesystem } from '@livx.cc/wcli/core';
4
4
  import { M as Message, U as UserQuestion, H as HostBridge, c as ContentPart, g as MessageContent } from './tools-S-ArIR3o.js';
5
5
 
package/dist/cli.js CHANGED
@@ -3863,7 +3863,9 @@ var AgentOptions = class {
3863
3863
  /** Retry budget for an EMPTY/silent-turn (a delegated-runtime wedge: cursor's warm helper spins then
3864
3864
  * returns a content-less end, surfaced as `code:'empty'`/`code:'cursor_silent'`). Tuned WIDER than the
3865
3865
  * network-drop budget (fixed 2) because clearing a wedge needs several reap+respawn cycles — each retry
3866
- * hits a FRESH cursor session (the adapter evicts the wedged warm helper on the silent-end). Still bounded:
3866
+ * hits a FRESH cursor session (the adapter evicts the wedged warm helper on the silent-end; a stall-watchdog
3867
+ * cancel is NOT this class — it is classified `stall`, and the watchdog's coded abort reason is what tells
3868
+ * the adapter to evict on that path too). Still bounded:
3867
3869
  * after exhaustion the turn surfaces `finishReason:'empty'` (non-zero exit), never infinite, never silent.
3868
3870
  * Env: AGENTX_EMPTY_RETRIES. */
3869
3871
  emptyRetries = envInt("AGENTX_EMPTY_RETRIES", 4);
@@ -4382,6 +4384,7 @@ var Agent = class _Agent {
4382
4384
  try {
4383
4385
  const r = await o.ai.chat({ model: o.model, messages: sent, tools: sentTools, stream: true, signal: stall.signal, ...o.toolChoice ? { toolChoice: o.toolChoice } : {}, ...reasonOpts });
4384
4386
  res = await this.consumeStream(r, stall.poke);
4387
+ if (stall.stalled()) throw stall.reclassify(void 0);
4385
4388
  } catch (err2) {
4386
4389
  throw stall.reclassify(err2);
4387
4390
  } finally {
@@ -4416,7 +4419,7 @@ var Agent = class _Agent {
4416
4419
  if (err2?.code === "budget") return kill("budget");
4417
4420
  if (err2?.code === "stall") {
4418
4421
  log6.warn(`model stalled out after retries: ${err2?.message ?? err2}`);
4419
- return kill("timeout");
4422
+ return { ...kill("timeout"), error: err2 };
4420
4423
  }
4421
4424
  if (o.signal?.aborted || isAbortError(err2)) return kill("aborted");
4422
4425
  if (err2?.code === "empty" || err2?.code === "cursor_silent") {
@@ -4564,31 +4567,30 @@ var Agent = class _Agent {
4564
4567
  if (parent?.aborted) ac.abort();
4565
4568
  else parent?.addEventListener("abort", onParentAbort, { once: true });
4566
4569
  let timer;
4570
+ const stallError = () => {
4571
+ const e = new Error(`model stalled: no stream output for ${stallMs >= 1e3 ? `${Math.round(stallMs / 1e3)}s` : `${stallMs}ms`}`);
4572
+ e.code = "stall";
4573
+ return e;
4574
+ };
4567
4575
  const poke = () => {
4568
4576
  if (!stallMs) return;
4569
4577
  if (timer) clearTimeout(timer);
4570
4578
  timer = setTimeout(() => {
4571
4579
  fired = true;
4572
- ac.abort();
4580
+ ac.abort(stallError());
4573
4581
  }, stallMs);
4574
4582
  };
4575
4583
  poke();
4584
+ const stalled = () => fired && !parent?.aborted;
4576
4585
  return {
4577
4586
  signal: ac.signal,
4578
4587
  poke,
4588
+ stalled,
4579
4589
  clear: () => {
4580
4590
  if (timer) clearTimeout(timer);
4581
4591
  parent?.removeEventListener("abort", onParentAbort);
4582
4592
  },
4583
- // Distinguish OUR abort (silent provider) from a parent/user cancel, which must stay an abort.
4584
- reclassify: (err2) => {
4585
- if (fired && !parent?.aborted) {
4586
- const e = new Error(`model stalled: no stream output for ${stallMs >= 1e3 ? `${Math.round(stallMs / 1e3)}s` : `${stallMs}ms`}`);
4587
- e.code = "stall";
4588
- return e;
4589
- }
4590
- return err2;
4591
- }
4593
+ reclassify: (err2) => stalled() ? stallError() : err2
4592
4594
  };
4593
4595
  }
4594
4596
  /** A clean-stop turn that carries no assistant text AND no tool calls (native or delegated) — a