refactor: extract @uncaged/workflow-util-agent + smart prompt
- New package: spawn-cli + build-agent-prompt shared utils - Smart prompt: start + meta summaries for middle steps + last step full - Cursor/Hermes adapters now import from util-agent (no duplicate code) - 109 tests pass, biome clean Closes #14 小橘 <xiaoju@shazhou.work>
This commit is contained in:
@@ -1,19 +1,5 @@
|
||||
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: [],
|
||||
};
|
||||
}
|
||||
import { createHermesAgent, validateHermesAgentConfig } from "../src/index.js";
|
||||
|
||||
describe("validateHermesAgentConfig", () => {
|
||||
test("accepts valid config", () => {
|
||||
@@ -36,14 +22,6 @@ describe("validateHermesAgentConfig", () => {
|
||||
});
|
||||
});
|
||||
|
||||
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({
|
||||
|
||||
Reference in New Issue
Block a user