refactor(agent-kit): pass CAS store through AgentContext
Expose the store created during context build on AgentContext so agents reuse the same in-memory cache instead of opening a second store. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -1,11 +1,7 @@
|
||||
#!/usr/bin/env bun
|
||||
// Mock agent for smoke testing
|
||||
import { bootstrap, type JSONSchema, putSchema } from "@uncaged/json-cas";
|
||||
import {
|
||||
createAgent,
|
||||
createAgentStore,
|
||||
resolveStorageRoot,
|
||||
} from "../packages/uwf-agent-kit/src/index.js";
|
||||
import { createAgent } from "../packages/uwf-agent-kit/src/index.js";
|
||||
|
||||
const MOCK_RAW_OUTPUT_SCHEMA: JSONSchema = {
|
||||
title: "mock-raw-output",
|
||||
@@ -21,7 +17,7 @@ const agent = createAgent({
|
||||
name: "mock",
|
||||
run: async (ctx) => {
|
||||
const output = `Mock output for role ${ctx.role}: task was "${ctx.prompt}"`;
|
||||
const { store } = await createAgentStore(resolveStorageRoot());
|
||||
const { store } = ctx;
|
||||
await bootstrap(store);
|
||||
const schemaHash = await putSchema(store, MOCK_RAW_OUTPUT_SCHEMA);
|
||||
const detailHash = await store.put(schemaHash, { text: output });
|
||||
|
||||
Reference in New Issue
Block a user