agent-observability-trace-cli
Advanced tools
+28
-9
@@ -22,14 +22,33 @@ #!/usr/bin/env node | ||
| function run(command, commandArgs) { | ||
| return spawnSync(command, commandArgs, { stdio: "inherit" }); | ||
| function run(command, commandArgs, extraEnv) { | ||
| return spawnSync(command, commandArgs, { | ||
| stdio: "inherit", | ||
| env: { ...process.env, ...extraEnv }, | ||
| }); | ||
| } | ||
| // Preferred path: the real "agent-trace" console script is on PATH | ||
| // (installed via pip/uv/pipx per project.scripts in pyproject.toml). | ||
| let result = run("agent-trace", args); | ||
| if (!(result.error && result.error.code === "ENOENT")) { | ||
| if (result.error) { | ||
| throw result.error; | ||
| // Guard against self-recursion: npx/npm exec prepend this package's own | ||
| // node_modules/.bin (or the npx cache dir) to PATH before running this | ||
| // script. That means a plain PATH lookup for "agent-trace" can resolve | ||
| // back to THIS wrapper instead of the real pip/uv/pipx-installed console | ||
| // script -- and since this script's own exit/error handling only treats | ||
| // an ENOENT as "not found," a self-match doesn't error, it just re-execs | ||
| // itself, unboundedly, spawning child processes until the machine's | ||
| // process table is exhausted. A previously-published version of this | ||
| // wrapper did exactly that (confirmed via a real recursive self-exec | ||
| // reproduction in a fresh npx invocation). The fix: mark the environment | ||
| // once before the first attempt, and if this process sees that marker | ||
| // already set, skip straight to the Python fallback below instead of | ||
| // trying "agent-trace" on PATH again. | ||
| const RECURSION_GUARD = "AGENT_TRACE_JS_WRAPPER_ACTIVE"; | ||
| if (!process.env[RECURSION_GUARD]) { | ||
| // Preferred path: the real "agent-trace" console script is on PATH | ||
| // (installed via pip/uv/pipx per project.scripts in pyproject.toml). | ||
| let result = run("agent-trace", args, { [RECURSION_GUARD]: "1" }); | ||
| if (!(result.error && result.error.code === "ENOENT")) { | ||
| if (result.error) { | ||
| throw result.error; | ||
| } | ||
| process.exit(result.status === null ? 1 : result.status); | ||
| } | ||
| process.exit(result.status === null ? 1 : result.status); | ||
| } | ||
@@ -36,0 +55,0 @@ |
+5
-3
| { | ||
| "name": "agent-observability-trace-cli", | ||
| "version": "0.1.7", | ||
| "description": "npm-installable CLI wrapper for agent-trace, deterministic record/replay for LLM agents. Requires Python 3.10+ and the agent-observability-trace-cli PyPI package.", | ||
| "version": "0.1.8", | ||
| "description": "npm-installable CLI wrapper for agent-trace, deterministic record and replay for LLM agent HTTP traffic. Forwards straight to the real Python agent-trace CLI. Requires Python 3.10+ and the agent-observability-trace-cli PyPI package.", | ||
| "bin": { | ||
@@ -16,2 +16,3 @@ "agent-trace": "bin/agent-trace.js" | ||
| "ai-agents", | ||
| "agentic-ai", | ||
| "observability", | ||
@@ -24,3 +25,4 @@ "tracing", | ||
| "debugging", | ||
| "cli" | ||
| "cli", | ||
| "python-cli" | ||
| ], | ||
@@ -27,0 +29,0 @@ "homepage": "https://github.com/RudrenduPaul/agent-observability#readme", |
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
24410
5.21%72
35.85%3
200%