@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/cli.js +7 -4
- package/dist/cli.js.map +1 -1
- package/dist/index.js +7 -4
- package/dist/index.js.map +1 -1
- package/dist/tools.shell.d.ts +3 -0
- package/dist/tools.shell.js +7 -4
- package/dist/tools.shell.js.map +1 -1
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -2041,20 +2041,23 @@ async function nodeSpawn() {
|
|
|
2041
2041
|
return _spawn;
|
|
2042
2042
|
}
|
|
2043
2043
|
function makeRealShellTool(options) {
|
|
2044
|
-
const
|
|
2044
|
+
const defaultTimeoutMs = options.timeoutMs ?? 12e4;
|
|
2045
|
+
const maxTimeoutMs = Math.max(options.maxTimeoutMs ?? 6e5, defaultTimeoutMs);
|
|
2045
2046
|
return {
|
|
2046
2047
|
name: "Shell",
|
|
2047
|
-
description:
|
|
2048
|
+
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.`,
|
|
2048
2049
|
parameters: {
|
|
2049
2050
|
type: "object",
|
|
2050
2051
|
required: ["command"],
|
|
2051
2052
|
properties: {
|
|
2052
2053
|
command: { type: "string", description: "the shell command line to execute" },
|
|
2053
|
-
background: { type: "boolean", description: "run detached and return a job id immediately (for servers/watchers/long builds)" }
|
|
2054
|
+
background: { type: "boolean", description: "run detached and return a job id immediately (for servers/watchers/long builds)" },
|
|
2055
|
+
timeoutMs: { type: "number", description: "wall-clock cap for THIS command, overriding the default (clamped to the tool max)" }
|
|
2054
2056
|
}
|
|
2055
2057
|
},
|
|
2056
|
-
async run({ command, background }, ctx) {
|
|
2058
|
+
async run({ command, background, timeoutMs: askedTimeoutMs }, ctx) {
|
|
2057
2059
|
const cmd = String(command ?? "");
|
|
2060
|
+
const timeoutMs = Number.isFinite(askedTimeoutMs) && Number(askedTimeoutMs) > 0 ? Math.min(Number(askedTimeoutMs), maxTimeoutMs) : defaultTimeoutMs;
|
|
2058
2061
|
if (!cmd.trim()) return "[exit 1] empty command";
|
|
2059
2062
|
if (background) {
|
|
2060
2063
|
if (!options.registry) return "Error: background execution is not enabled in this host (no job registry).";
|