@livx.cc/agentx 0.99.48 → 0.99.49

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/dist/index.d.ts CHANGED
@@ -1,15 +1,15 @@
1
- import { a as AgentOptions, H as Hooks, i as RunResult, A as Agent } from './Agent-BeoEFl2T.js';
2
- export { C as ChatFragment, b as CompactResult, D as DEFAULT_MUTATING, c as Decision, P as PermissionOptions, d as PermissionPolicy, e as PermissionRule, f as PreToolUseDecision, R as ReasoningEffort, g as RecordingHooks, h as RecordingLifecycle, T as ToolUse, j as ToolUseMeta, k as composeHooks, l as estimateTokens, p as planMode, r as reasoningToChatFragment } from './Agent-BeoEFl2T.js';
1
+ import { a as AgentOptions, H as Hooks, i as RunResult, A as Agent } from './Agent-CXkPfYX2.js';
2
+ export { C as ChatFragment, b as CompactResult, D as DEFAULT_MUTATING, c as Decision, P as PermissionOptions, d as PermissionPolicy, e as PermissionRule, f as PreToolUseDecision, R as ReasoningEffort, g as RecordingHooks, h as RecordingLifecycle, T as ToolUse, j as ToolUseMeta, k as composeHooks, l as estimateTokens, p as planMode, r as reasoningToChatFragment } from './Agent-CXkPfYX2.js';
3
3
  export { MODEL_ALIASES, ModelSwitch, ResolveModelSwitchOpts, modelShortLabel, resolveModelAlias, resolveModelSwitch } from './models.js';
4
4
  import { IFilesystem, FileMetadata } from '@livx.cc/wcli/core';
5
5
  export { CommandExecutor, FileMetadata, IFilesystem, IndexedDbFilesystem, MemFilesystem, registerHeadlessCommands } from '@livx.cc/wcli/core';
6
6
  import { BodDB } from '@bod.ee/db';
7
- import { A as AgentTool, C as ChatLike, a as ChatOptions, b as ChatResponse, r as ToolCall, H as HostBridge, U as UserQuestion, o as MessageContent } from './tools-MNdqlJIa.js';
8
- export { c as ContentPart, d as HostEvent, I as IMAGE_ELIDE_STUB, e as IMAGE_REF_SCHEME, f as ImageRef, J as JobCtx, g as JobHandle, h as JobInfo, i as JobKind, j as JobNotice, k as JobRegistry, l as JobRegistryOptions, n as JobTrackOptions, M as Message, m as RegistryJobStatus, R as Role, S as SandboxJobRegistry, p as StreamChunk, T as TodoItem, q as Tool, s as ToolContext, t as bashTool, u as clearImageRefs, v as contentBytes, w as contentText, x as defaultTools, y as editTool, z as elideImages, B as elideInlineImages, D as elideStaleImages, E as exitSessionTool, F as expandImagesForSend, G as formatJobNotice, K as imagePart, L as imageRefPart, N as imageRefResult, O as makeContext, P as makeJobTools, Q as messageHasImage, V as messageHasImageRef, W as messageHasInlineImage, X as mintImageRef, Y as parseImageRef, Z as readTool, _ as remintImageRefs, $ as sendBytes, a0 as sendBytesPer, a1 as toWireTools, a2 as todoWriteTool, a3 as toolImageRef, a4 as toolRegistry, a5 as toolsByName } from './tools-MNdqlJIa.js';
7
+ import { A as AgentTool, C as ChatLike, a as ChatOptions, b as ChatResponse, r as ToolCall, H as HostBridge, U as UserQuestion, o as MessageContent } from './tools-HsbxgqjF.js';
8
+ export { c as ContentPart, d as HostEvent, I as IMAGE_ELIDE_STUB, e as IMAGE_REF_SCHEME, f as ImageRef, J as JobCtx, g as JobHandle, h as JobInfo, i as JobKind, j as JobNotice, k as JobRegistry, l as JobRegistryOptions, n as JobTrackOptions, M as Message, m as RegistryJobStatus, R as Role, S as SandboxJobRegistry, p as StreamChunk, T as TodoItem, q as Tool, s as ToolContext, t as bashTool, u as clearImageRefs, v as contentBytes, w as contentText, x as defaultTools, y as editTool, z as elideImages, B as elideInlineImages, D as elideStaleImages, E as exitSessionTool, F as expandImagesForSend, G as formatJobNotice, K as imagePart, L as imageRefPart, N as imageRefResult, O as makeContext, P as makeJobTools, Q as messageHasImage, V as messageHasImageRef, W as messageHasInlineImage, X as mintImageRef, Y as parseImageRef, Z as readTool, _ as remintImageRefs, $ as sendBytes, a0 as sendBytesPer, a1 as toWireTools, a2 as todoWriteTool, a3 as toolImageRef, a4 as toolRegistry, a5 as toolsByName } from './tools-HsbxgqjF.js';
9
9
  import { ShellJobRegistry } from './tools.shell.js';
10
10
  import { SpokenSplitter } from '@bod.ee/voice';
11
11
  export { AudioSink, AudioSource, AuthProvider, CartesiaTTS, CartesiaTTSOptions, STT_SAMPLE_RATE, SonioxSTT, SonioxSTTOptions, SttLike, TTS_SAMPLE_RATE, TtsLike, VoiceEngine, VoiceEngineOptions, VoiceState, resolveAuth } from '@bod.ee/voice';
12
- export { M as McpCall, a as McpImage, b as McpRoute, c as McpRouteResolver, d as McpToolResult, e as McpToolSearchOptions, f as McpToolSpec, g as MountedMcpLike, h as buildMcpCatalog, m as makeLazyMcpToolSearch, i as makeMcpToolSearch, j as makeMcpToolSearchFromMounted, k as mcpToolToAgentTool, l as mcpToolsToAgentTools } from './mcp-DjYZzGGW.js';
12
+ export { M as McpCall, a as McpImage, b as McpRoute, c as McpRouteResolver, d as McpToolResult, e as McpToolSearchOptions, f as McpToolSpec, g as MountedMcpLike, h as buildMcpCatalog, m as makeLazyMcpToolSearch, i as makeMcpToolSearch, j as makeMcpToolSearchFromMounted, k as mcpToolToAgentTool, l as mcpToolsToAgentTools } from './mcp-CSLRyvEp.js';
13
13
  import * as libx_js_src_modules_log from 'libx.js/src/modules/log';
14
14
  export { log } from 'libx.js/src/modules/log';
15
15
 
package/dist/index.js CHANGED
@@ -1579,7 +1579,12 @@ var init_tools_jobs = __esm({
1579
1579
  maxBuffer = 256 * 1024;
1580
1580
  /** Idle window per kind: no output/progress/CPU for this long ⇒ stuck. Kinds without an activity channel
1581
1581
  * (host, native) are absent on purpose — silence is all they can ever show, so it proves nothing; their
1582
- * bound is the hard cap. Explicit `background:true` shell jobs opt out per job (a quiet server is healthy). */
1582
+ * bound is the hard cap. Explicit `background:true` shell jobs opt out per job (a quiet server is healthy).
1583
+ * NOTE the asymmetry that default hides: for a HOST job silence really is uninformative (the caller holds
1584
+ * the pending dispatch promise — independent proof it is alive), but a NATIVE job has no such proof AND it
1585
+ * suppresses the stall watchdog, i.e. it turns the provider's own silence into permission to keep ignoring
1586
+ * that provider's silence. So Agent passes an explicit per-job `idleMs` (nativeHoldMs) for `native`: the
1587
+ * provider must keep re-proving liveness with `running` events or forfeit the hold. See Agent.nativeHoldMs. */
1583
1588
  idleMs = { shell: 10 * 6e4, mcp: 10 * 6e4 };
1584
1589
  /** Absolute ceiling per kind (0/absent = none). */
1585
1590
  hardCapMs = { mcp: 30 * 6e4 };
@@ -4171,6 +4176,15 @@ var AgentOptions = class {
4171
4176
  * arrives for this long. The between-steps `timeoutMs` can't preempt an in-flight `chat()`, so a
4172
4177
  * provider that goes silent mid-stream would otherwise park the loop forever. 0 = off. */
4173
4178
  stallMs = 6e4;
4179
+ /** IDLE bound on a NATIVE delegated tool's hold over the stall watchdog (cursor's own shell/mcp/task:
4180
+ * `running` → silence → `completed`). Such a hold is the provider's own unverified CLAIM that it is
4181
+ * busy, and it SUSPENDS the very stall detection that would catch that provider going silent — so its
4182
+ * only backstop was `hardCapMs = toolHoldMs`, the TRANSPORT deadline (≥30m, sized for host-tool
4183
+ * round-trips a native call never makes). A wedged native call therefore bought 30m of total silence,
4184
+ * ×2 attempts = the 61-minute zero-output run (blank 2026-09-18). Idle, not absolute: every further
4185
+ * `running` event `touch()`es the job, so a native tool that keeps reporting progress holds
4186
+ * indefinitely — what expires is silence, not work. 0 = off (hard cap only). */
4187
+ nativeHoldMs = 3e5;
4174
4188
  /** Stop if the identical tool-call batch (name+args) repeats this many times in a row. 0 = off. */
4175
4189
  maxRepeats = 3;
4176
4190
  /** Cumulative cap on tool calls dispatched across the run. 0 = unbounded. */
@@ -4362,11 +4376,14 @@ var Agent = class _Agent {
4362
4376
  * toolExecutor) and NATIVE tools (cursor's own shell/mcp/task, `running` → `completed`) are tracked as
4363
4377
  * `holds` jobs: while one runs the provider is not silent — it is waiting on a tool — so the idle-stall
4364
4378
  * watchdog must not fire. Each is bounded by the transport tool deadline (`hardCapMs = toolHoldMs`), so a
4365
- * tool that never settles (or a lost `completed` event) is reaped and cannot disable stall protection. */
4379
+ * tool that never settles (or a lost `completed` event) is reaped and cannot disable stall protection.
4380
+ * A NATIVE job carries a second, much tighter bound (`idleMs = nativeHoldMs`): the transport deadline is
4381
+ * sized for a host-tool round-trip it never makes, and silence is the only thing it can actually prove. */
4366
4382
  jobs;
4367
4383
  /** Native delegated tool activity id → its job (per step attempt). */
4368
4384
  nativeJobs = /* @__PURE__ */ new Map();
4369
4385
  toolHoldMs = 0;
4386
+ nativeHoldMs = 0;
4370
4387
  /** A tool (host or native) already executed in the current step attempt: a stall retry replays the step
4371
4388
  * from the pre-step transcript, which would re-run it — so such a stall is not retried. */
4372
4389
  toolRanThisAttempt = false;
@@ -4708,6 +4725,7 @@ var Agent = class _Agent {
4708
4725
  const derivedToolTimeoutMs = Math.max(TRANSPORT_TOOL_TIMEOUT_FLOOR_MS, ...this.activeTools.map(transportHeadroomMs));
4709
4726
  const effectiveToolTimeoutMs = typeof hostToolTimeoutMs === "number" ? Math.max(hostToolTimeoutMs, derivedToolTimeoutMs) : derivedToolTimeoutMs;
4710
4727
  this.toolHoldMs = effectiveToolTimeoutMs;
4728
+ this.nativeHoldMs = o.nativeHoldMs;
4711
4729
  if (isCursorWithTools) {
4712
4730
  if (typeof hostToolTimeoutMs === "number" && effectiveToolTimeoutMs !== hostToolTimeoutMs) {
4713
4731
  log7.warn(`providerOptions.toolTimeoutMs=${hostToolTimeoutMs}ms is below what the registered tools need \u2014 RAISED to ${effectiveToolTimeoutMs}ms. ${toolTimeoutViolations(this.activeTools, hostToolTimeoutMs).length} tool(s) could outlive it, and the transport would have destroyed their results. To lower it, lower the tools' own maxDurationMs (e.g. the Shell tool's maxTimeoutMs) instead.`);
@@ -4961,7 +4979,13 @@ var Agent = class _Agent {
4961
4979
  if (!stallMs) return;
4962
4980
  if (timer) clearTimeout(timer);
4963
4981
  timer = setTimeout(() => {
4964
- if (this.toolHoldActive()) return poke();
4982
+ if (this.toolHoldActive()) {
4983
+ const now3 = Date.now();
4984
+ const who = this.jobs.holding().map((j) => `${j.kind} "${j.label}" (${Math.round((now3 - j.startedAt) / 1e3)}s, quiet ${Math.round((now3 - j.lastActivityAt) / 1e3)}s)`).join(", ");
4985
+ log7.warn(`stall watchdog: no stream output for ${stallMs}ms \u2014 held by ${who}`);
4986
+ this.options.host?.notify?.({ kind: "tool_hold", message: `waiting on ${who}` });
4987
+ return poke();
4988
+ }
4965
4989
  const inFlight = this.jobs.list().filter((j) => j.status === "running");
4966
4990
  log7.warn(`stall watchdog: no stream output for ${stallMs}ms and no tool holding the stream \u2014 aborting the request` + (inFlight.length ? ` (${inFlight.length} detached job(s) running, not awaited by the stream: ${inFlight.map((j) => `${j.id}/${j.kind}`).join(", ")})` : ""));
4967
4991
  fired = true;
@@ -5030,7 +5054,7 @@ var Agent = class _Agent {
5030
5054
  const nj = a.id ? this.nativeJobs.get(a.id) : void 0;
5031
5055
  if (a.status === "running") {
5032
5056
  if (nj) nj.touch();
5033
- else if (a.id) this.nativeJobs.set(a.id, this.jobs.track({ kind: "native", label: a.name, holds: true, hardCapMs: this.toolHoldMs }));
5057
+ else if (a.id) this.nativeJobs.set(a.id, this.jobs.track({ kind: "native", label: a.name, holds: true, idleMs: this.nativeHoldMs, hardCapMs: this.toolHoldMs }));
5034
5058
  } else {
5035
5059
  if (nj) {
5036
5060
  if (typeof a.output === "string") nj.chunk(a.output.slice(-4e3));