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