feat(agent): add command config to hermes/cursor agents + explicit env inheritance

- HermesAgentConfig.command: override hermes CLI path (default: "hermes")
- CursorAgentConfig.command: override cursor-agent CLI path (default: "cursor-agent")
- spawnCli: explicit env: process.env for clarity and future extensibility
- bundle-entry: read WORKFLOW_CURSOR_COMMAND from env
This commit is contained in:
2026-05-12 12:49:28 +08:00
parent 41209f1ef8
commit ecc348f182
6 changed files with 6 additions and 2 deletions
+1 -1
View File
@@ -71,7 +71,7 @@ export function createCursorAgent(config: CursorAgentConfig): AgentFn {
"--trust",
"--force",
];
const run = await spawnCli("cursor-agent", args, {
const run = await spawnCli(config.command ?? "cursor-agent", args, {
cwd: workspace,
timeoutMs,
});
@@ -1,6 +1,7 @@
import type { LlmProvider } from "@uncaged/workflow-protocol";
export type CursorAgentConfig = {
command: string | null;
model: string | null;
timeout: number;
/** Explicit workspace path. When `null`, the agent extracts workspace from AgentContext via a ReAct LLM call. */
+1 -1
View File
@@ -47,7 +47,7 @@ export function createHermesAgent(config: HermesAgentConfig): AgentFn {
if (config.model !== null) {
args.push("--model", config.model);
}
const run = await spawnCli("hermes", args, {
const run = await spawnCli(config.command ?? "hermes", args, {
cwd: null,
timeoutMs,
});
@@ -1,4 +1,5 @@
export type HermesAgentConfig = {
command: string | null;
model: string | null;
timeout: number | null;
};
@@ -31,6 +31,7 @@ const llmProvider = {
};
const agent = createCursorAgent({
command: optionalEnv("WORKFLOW_CURSOR_COMMAND"),
model: optionalEnv("WORKFLOW_CURSOR_MODEL"),
timeout: optionalEnv("WORKFLOW_CURSOR_TIMEOUT")
? Number(optionalEnv("WORKFLOW_CURSOR_TIMEOUT"))
@@ -22,6 +22,7 @@ export function spawnCli(
return new Promise((resolve) => {
const child = spawn(command, args, {
cwd: options.cwd === null ? undefined : options.cwd,
env: process.env,
shell: false,
stdio: ["ignore", "pipe", "pipe"],
});