feat(uwf-agent): Phase 1 agent returns output and detailHash
- Change AgentRunFn to return { output, detailHash } instead of raw string
- Remove agent-kit detail CAS write; agents store their own detail nodes
- Hermes stores raw output as typed hermes-raw-output CAS node
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
+22
-2
@@ -1,11 +1,31 @@
|
||||
#!/usr/bin/env bun
|
||||
// Mock agent for smoke testing
|
||||
import { createAgent } from "../packages/uwf-agent-kit/src/index.js";
|
||||
import { bootstrap, type JSONSchema, putSchema } from "@uncaged/json-cas";
|
||||
import {
|
||||
createAgent,
|
||||
createAgentStore,
|
||||
resolveStorageRoot,
|
||||
} from "../packages/uwf-agent-kit/src/index.js";
|
||||
|
||||
const MOCK_RAW_OUTPUT_SCHEMA: JSONSchema = {
|
||||
title: "mock-raw-output",
|
||||
type: "object",
|
||||
required: ["text"],
|
||||
properties: {
|
||||
text: { type: "string" },
|
||||
},
|
||||
additionalProperties: false,
|
||||
};
|
||||
|
||||
const agent = createAgent({
|
||||
name: "mock",
|
||||
run: async (ctx) => {
|
||||
return `Mock output for role ${ctx.role}: task was "${ctx.prompt}"`;
|
||||
const output = `Mock output for role ${ctx.role}: task was "${ctx.prompt}"`;
|
||||
const { store } = await createAgentStore(resolveStorageRoot());
|
||||
await bootstrap(store);
|
||||
const schemaHash = await putSchema(store, MOCK_RAW_OUTPUT_SCHEMA);
|
||||
const detailHash = await store.put(schemaHash, { text: output });
|
||||
return { output, detailHash };
|
||||
},
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user