1b62cec0a2
BREAKING: HermesAgentConfig.command and CursorAgentConfig.command are now required string fields (absolute path to CLI binary). Validation rejects non-absolute paths at construction time. - Eliminates PATH resolution ambiguity in spawned worker processes - spawnCli: explicit env: process.env for clarity - bundle-entry: WORKFLOW_CURSOR_COMMAND is now required - Updated tests for both agents
49 lines
1.2 KiB
TypeScript
49 lines
1.2 KiB
TypeScript
import { describe, expect, test } from "bun:test";
|
|
import { createHermesAgent, validateHermesAgentConfig } from "../src/index.js";
|
|
|
|
describe("validateHermesAgentConfig", () => {
|
|
test("accepts valid config", () => {
|
|
const r = validateHermesAgentConfig({
|
|
command: "/usr/local/bin/hermes",
|
|
model: null,
|
|
timeout: null,
|
|
});
|
|
expect(r.ok).toBe(true);
|
|
});
|
|
|
|
test("rejects non-absolute command", () => {
|
|
const r = validateHermesAgentConfig({
|
|
command: "hermes",
|
|
model: null,
|
|
timeout: null,
|
|
});
|
|
expect(r.ok).toBe(false);
|
|
if (!r.ok) {
|
|
expect(r.error).toContain("absolute path");
|
|
}
|
|
});
|
|
|
|
test("rejects negative timeout", () => {
|
|
const r = validateHermesAgentConfig({
|
|
command: "/usr/local/bin/hermes",
|
|
model: null,
|
|
timeout: -5,
|
|
});
|
|
expect(r.ok).toBe(false);
|
|
if (!r.ok) {
|
|
expect(r.error).toContain("timeout");
|
|
}
|
|
});
|
|
});
|
|
|
|
describe("createHermesAgent", () => {
|
|
test("returns an AgentFn", () => {
|
|
const agent = createHermesAgent({
|
|
command: "/usr/local/bin/hermes",
|
|
model: null,
|
|
timeout: null,
|
|
});
|
|
expect(typeof agent).toBe("function");
|
|
});
|
|
});
|