@livx.cc/agentx 0.99.31 → 0.99.32

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.js CHANGED
@@ -1877,20 +1877,23 @@ async function nodeSpawn() {
1877
1877
  return _spawn;
1878
1878
  }
1879
1879
  function makeRealShellTool(options) {
1880
- const timeoutMs = options.timeoutMs ?? 12e4;
1880
+ const defaultTimeoutMs = options.timeoutMs ?? 12e4;
1881
+ const maxTimeoutMs = Math.max(options.maxTimeoutMs ?? 6e5, defaultTimeoutMs);
1881
1882
  return {
1882
1883
  name: "Shell",
1883
- description: "Run a shell command via /bin/sh in the working directory. Executes any installed binary \u2014 ls, cat, grep, git, bun, node, curl, scripts, etc. Returns combined stdout+stderr; non-zero exits are prefixed `[exit N]`. Runs non-interactively with no terminal (stdin is /dev/null): commands that prompt for input fail fast rather than hang \u2014 for privileged actions use a non-interactive flag (e.g. `sudo -n`), or ask the user to run the command themselves. Set `background:true` for long-running processes (servers, watchers) \u2014 returns a job id immediately; poll with ShellOutput, stop with ShellKill.",
1884
+ description: `Run a shell command via /bin/sh in the working directory. Executes any installed binary \u2014 ls, cat, grep, git, bun, node, curl, scripts, etc. Returns combined stdout+stderr; non-zero exits are prefixed \`[exit N]\`. Runs non-interactively with no terminal (stdin is /dev/null): commands that prompt for input fail fast rather than hang \u2014 for privileged actions use a non-interactive flag (e.g. \`sudo -n\`), or ask the user to run the command themselves. Each command is killed after ${defaultTimeoutMs}ms (result \`[exit 124]\` with whatever output it produced) \u2014 pass \`timeoutMs\` (max ${maxTimeoutMs}) for a legitimately slower command, and always bound network commands yourself (e.g. \`curl -m 10\`). Set \`background:true\` for long-running processes (servers, watchers) \u2014 returns a job id immediately; poll with ShellOutput, stop with ShellKill.`,
1884
1885
  parameters: {
1885
1886
  type: "object",
1886
1887
  required: ["command"],
1887
1888
  properties: {
1888
1889
  command: { type: "string", description: "the shell command line to execute" },
1889
- background: { type: "boolean", description: "run detached and return a job id immediately (for servers/watchers/long builds)" }
1890
+ background: { type: "boolean", description: "run detached and return a job id immediately (for servers/watchers/long builds)" },
1891
+ timeoutMs: { type: "number", description: "wall-clock cap for THIS command, overriding the default (clamped to the tool max)" }
1890
1892
  }
1891
1893
  },
1892
- async run({ command, background }, ctx) {
1894
+ async run({ command, background, timeoutMs: askedTimeoutMs }, ctx) {
1893
1895
  const cmd = String(command ?? "");
1896
+ const timeoutMs = Number.isFinite(askedTimeoutMs) && Number(askedTimeoutMs) > 0 ? Math.min(Number(askedTimeoutMs), maxTimeoutMs) : defaultTimeoutMs;
1894
1897
  if (!cmd.trim()) return "[exit 1] empty command";
1895
1898
  if (background) {
1896
1899
  if (!options.registry) return "Error: background execution is not enabled in this host (no job registry).";