@livx.cc/agentx 0.99.128 → 0.99.130

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
@@ -9,7 +9,7 @@ export { c as ContentPart, d as HostEvent, I as IMAGE_ELIDE_STUB, e as IMAGE_REF
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-DZhcLur2.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-BZJXDo5Q.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
@@ -5823,7 +5823,7 @@ var Agent = class _Agent {
5823
5823
  e.code = "stall";
5824
5824
  return e;
5825
5825
  };
5826
- const poke = () => {
5826
+ const poke = (quietMs) => {
5827
5827
  if (!stallMs) return;
5828
5828
  if (timer) clearTimeout(timer);
5829
5829
  timer = setTimeout(() => {
@@ -5838,7 +5838,7 @@ var Agent = class _Agent {
5838
5838
  log9.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(", ")})` : ""));
5839
5839
  fired = true;
5840
5840
  ac.abort(stallError());
5841
- }, stallMs);
5841
+ }, Math.max(stallMs, quietMs ?? 0));
5842
5842
  };
5843
5843
  this.stallPoke = poke;
5844
5844
  poke();
@@ -5880,7 +5880,7 @@ var Agent = class _Agent {
5880
5880
  let resolvedModel;
5881
5881
  for await (const chunk of stream) {
5882
5882
  if (chunk.model) resolvedModel = chunk.model;
5883
- poke?.();
5883
+ poke?.(chunk.quietMs);
5884
5884
  if (this.options.signal?.aborted) break;
5885
5885
  if (chunk.reasoningContent) {
5886
5886
  reasoning += chunk.reasoningContent;
@@ -12711,6 +12711,15 @@ async function runMcpCall(name, call, ctx, timeoutMs) {
12711
12711
  const soft = jobs.options.foregroundMs.mcp ?? 0;
12712
12712
  return `[still running] MCP call ${name} is still working after ${soft >= 1e3 ? `${Math.round(soft / 1e3)}s` : `${soft}ms`}, so it was handed to background job ${r.id} \u2014 NOT cancelled, the server keeps going. Its result will be delivered to you when it finishes, so continue with other work; to block on it use JobWait({id:"${r.id}"}) instead of sleeping. JobStatus/JobOutput show its progress; JobKill({id:"${r.id}"}) cancels it. Do NOT re-issue the same call \u2014 that would run it twice.`;
12713
12713
  }
12714
+ var objArgs = (v) => {
12715
+ if (typeof v !== "string") return v;
12716
+ try {
12717
+ const j = JSON.parse(v);
12718
+ return j && typeof j === "object" && !Array.isArray(j) ? j : v;
12719
+ } catch {
12720
+ return v;
12721
+ }
12722
+ };
12714
12723
  function mcpToolToAgentTool(spec, callTool, prefix = "mcp__", timeoutMs = MCP_CALL_TIMEOUT_MS) {
12715
12724
  return {
12716
12725
  name: `${prefix}${spec.name}`,
@@ -12718,7 +12727,7 @@ function mcpToolToAgentTool(spec, callTool, prefix = "mcp__", timeoutMs = MCP_CA
12718
12727
  parameters: spec.inputSchema ?? { type: "object", properties: {} },
12719
12728
  maxDurationMs: timeoutMs,
12720
12729
  run(args, ctx) {
12721
- return runMcpCall(spec.name, (o) => callTool(spec.name, args ?? {}, o), ctx, timeoutMs);
12730
+ return runMcpCall(spec.name, (o) => callTool(spec.name, objArgs(args) ?? {}, o), ctx, timeoutMs);
12722
12731
  }
12723
12732
  };
12724
12733
  }
@@ -12787,7 +12796,8 @@ function makeMcpToolSearch(specs, callTool, options = {}) {
12787
12796
  },
12788
12797
  maxDurationMs: callTimeoutMs,
12789
12798
  async run(input, ctx) {
12790
- const { name, args } = input ?? {};
12799
+ const { name } = input ?? {};
12800
+ const args = objArgs(input?.args);
12791
12801
  const n = String(name ?? "").trim();
12792
12802
  if (!n) return `Error: McpCall requires \`name\` (the exact MCP tool name) \u2014 got keys [${Object.keys(input ?? {}).join(", ")}]. Call it as McpCall({ name: "mcp__<server>__<tool>", args: {...} }).`;
12793
12803
  if (n === searchTool.name) return searchTool.run({ query: args?.query ?? args?.keyword ?? args?.q }, ctx);