@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/cli.js CHANGED
@@ -5932,7 +5932,7 @@ var Agent = class _Agent {
5932
5932
  e.code = "stall";
5933
5933
  return e;
5934
5934
  };
5935
- const poke = () => {
5935
+ const poke = (quietMs) => {
5936
5936
  if (!stallMs) return;
5937
5937
  if (timer) clearTimeout(timer);
5938
5938
  timer = setTimeout(() => {
@@ -5947,7 +5947,7 @@ var Agent = class _Agent {
5947
5947
  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(", ")})` : ""));
5948
5948
  fired = true;
5949
5949
  ac.abort(stallError());
5950
- }, stallMs);
5950
+ }, Math.max(stallMs, quietMs ?? 0));
5951
5951
  };
5952
5952
  this.stallPoke = poke;
5953
5953
  poke();
@@ -5989,7 +5989,7 @@ var Agent = class _Agent {
5989
5989
  let resolvedModel;
5990
5990
  for await (const chunk of stream) {
5991
5991
  if (chunk.model) resolvedModel = chunk.model;
5992
- poke?.();
5992
+ poke?.(chunk.quietMs);
5993
5993
  if (this.options.signal?.aborted) break;
5994
5994
  if (chunk.reasoningContent) {
5995
5995
  reasoning += chunk.reasoningContent;
@@ -13043,6 +13043,15 @@ async function runMcpCall(name, call, ctx, timeoutMs) {
13043
13043
  const soft = jobs.options.foregroundMs.mcp ?? 0;
13044
13044
  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.`;
13045
13045
  }
13046
+ var objArgs = (v) => {
13047
+ if (typeof v !== "string") return v;
13048
+ try {
13049
+ const j = JSON.parse(v);
13050
+ return j && typeof j === "object" && !Array.isArray(j) ? j : v;
13051
+ } catch {
13052
+ return v;
13053
+ }
13054
+ };
13046
13055
  function mcpToolToAgentTool(spec, callTool, prefix = "mcp__", timeoutMs = MCP_CALL_TIMEOUT_MS) {
13047
13056
  return {
13048
13057
  name: `${prefix}${spec.name}`,
@@ -13050,7 +13059,7 @@ function mcpToolToAgentTool(spec, callTool, prefix = "mcp__", timeoutMs = MCP_CA
13050
13059
  parameters: spec.inputSchema ?? { type: "object", properties: {} },
13051
13060
  maxDurationMs: timeoutMs,
13052
13061
  run(args, ctx) {
13053
- return runMcpCall(spec.name, (o) => callTool(spec.name, args ?? {}, o), ctx, timeoutMs);
13062
+ return runMcpCall(spec.name, (o) => callTool(spec.name, objArgs(args) ?? {}, o), ctx, timeoutMs);
13054
13063
  }
13055
13064
  };
13056
13065
  }
@@ -13119,7 +13128,8 @@ function makeMcpToolSearch(specs, callTool, options = {}) {
13119
13128
  },
13120
13129
  maxDurationMs: callTimeoutMs,
13121
13130
  async run(input, ctx) {
13122
- const { name, args } = input ?? {};
13131
+ const { name } = input ?? {};
13132
+ const args = objArgs(input?.args);
13123
13133
  const n = String(name ?? "").trim();
13124
13134
  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: {...} }).`;
13125
13135
  if (n === searchTool.name) return searchTool.run({ query: args?.query ?? args?.keyword ?? args?.q }, ctx);