feat: @uncaged/workflow-agent-cursor + @uncaged/workflow-agent-hermes

- Cursor adapter: spawn cursor-agent CLI, auto/specified model
- Hermes adapter: spawn hermes chat CLI
- Both: AgentFn interface, no nerve-core deps, Result-based config validation
- 93 tests pass, biome clean

Closes #10, Closes #11
小橘 <xiaoju@shazhou.work>
This commit is contained in:
2026-05-06 06:54:24 +00:00
parent c2a8f2d81b
commit f21014fcdd
22 changed files with 511 additions and 0 deletions
@@ -0,0 +1,55 @@
import { describe, expect, test } from "bun:test";
import { START, type ThreadContext } from "@uncaged/workflow";
import { buildAgentPrompt, createHermesAgent, validateHermesAgentConfig } from "../src/index.js";
function makeCtx(): ThreadContext {
return {
start: {
role: START,
content: "plan the migration",
meta: { maxRounds: 8 },
timestamp: 1,
},
steps: [],
};
}
describe("validateHermesAgentConfig", () => {
test("accepts valid config", () => {
const r = validateHermesAgentConfig({
model: null,
timeout: null,
});
expect(r.ok).toBe(true);
});
test("rejects negative timeout", () => {
const r = validateHermesAgentConfig({
model: null,
timeout: -5,
});
expect(r.ok).toBe(false);
if (!r.ok) {
expect(r.error).toContain("timeout");
}
});
});
describe("buildAgentPrompt", () => {
test("includes system and thread start", () => {
const text = buildAgentPrompt(makeCtx(), "You are a planner.");
expect(text).toContain("You are a planner.");
expect(text).toContain("plan the migration");
});
});
describe("createHermesAgent", () => {
test("returns an AgentFn", () => {
const agent = createHermesAgent({
model: null,
timeout: null,
});
expect(typeof agent).toBe("function");
});
});