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:
@@ -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. */
|
||||
|
||||
@@ -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"],
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user