fix: hardcode absolute paths for agent CLI defaults in bundle entry

Validator requires absolute paths — bare command names like 'cursor-agent'
fail validation. Use `which` to discover the path, write it directly.

小橘 🍊
This commit is contained in:
2026-05-15 09:49:42 +00:00
parent 40530d757e
commit 241bfbf6d9
2 changed files with 10 additions and 4 deletions
+8 -2
View File
@@ -305,7 +305,7 @@ function createLazyAdapter(): AdapterFn {
When binding agent adapters (cursor-agent, hermes, etc.), **always use \`optionalEnv\` with a sensible default** — never \`requireEnv\`. The worker process may start without the expected env vars, causing a silent crash.
Discover the correct CLI path yourself (e.g. \`which cursor-agent\`, \`which hermes\`) and use it as the fallback:
Discover the correct CLI path yourself (e.g. \`which cursor-agent\`, \`which hermes\`) and hardcode it as the fallback:
\`\`\`typescript
// ❌ WRONG — worker crash if env var missing, thread silently fails with 0 steps
@@ -314,11 +314,17 @@ const adapter = createCursorAgent({
...
});
// ✅ CORRECT — env override with discovered default
// ❌ WRONG — bare command name fails absolute-path validation
const adapter = createCursorAgent({
command: optionalEnv("WORKFLOW_CURSOR_COMMAND") ?? "cursor-agent",
...
});
// ✅ CORRECT — use \`which cursor-agent\` to find the path, then write it in
const adapter = createCursorAgent({
command: optionalEnv("WORKFLOW_CURSOR_COMMAND") ?? "/home/azureuser/.local/bin/cursor-agent",
...
});
\`\`\`
### Bundle import restrictions
@@ -11,7 +11,7 @@ import { optionalEnv } from "@uncaged/workflow-util";
import { buildDevelopDescriptor, developWorkflowDefinition } from "./src/index.js";
const cursorAdapter = createCursorAgent({
command: optionalEnv("WORKFLOW_CURSOR_COMMAND") ?? "cursor-agent",
command: optionalEnv("WORKFLOW_CURSOR_COMMAND") ?? "/home/azureuser/.local/bin/cursor-agent",
model: optionalEnv("WORKFLOW_CURSOR_MODEL"),
timeout: optionalEnv("WORKFLOW_CURSOR_TIMEOUT")
? Number(optionalEnv("WORKFLOW_CURSOR_TIMEOUT"))
@@ -20,7 +20,7 @@ const cursorAdapter = createCursorAgent({
});
const hermesAdapter = createHermesAgent({
command: optionalEnv("WORKFLOW_HERMES_COMMAND") ?? "hermes",
command: optionalEnv("WORKFLOW_HERMES_COMMAND") ?? "/home/azureuser/.local/bin/hermes",
model: optionalEnv("WORKFLOW_HERMES_MODEL"),
timeout: optionalEnv("WORKFLOW_HERMES_TIMEOUT")
? Number(optionalEnv("WORKFLOW_HERMES_TIMEOUT"))