feat(agent): render local interactive answers and fold completed process
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
import process from "node:process";
|
||||
import { writeFile } from "node:fs/promises";
|
||||
import { resolve } from "node:path";
|
||||
import { zodToJsonSchema } from "zod-to-json-schema";
|
||||
import { answerUiCatalog, ANSWER_UI_VERSION } from "../src/features/agent/answer-ui/catalog.ts";
|
||||
|
||||
const target = resolve(process.argv[2] ?? "../next-tjwater-agent/src/chat/answer-ui-catalog.json");
|
||||
const contract = {
|
||||
version: ANSWER_UI_VERSION,
|
||||
description:
|
||||
"Generated from supply frontend src/features/agent/answer-ui/catalog.ts. Regenerate after catalog changes.",
|
||||
schema: answerUiCatalog.jsonSchema(),
|
||||
components: answerUiCatalog.componentNames,
|
||||
props: Object.fromEntries(
|
||||
Object.entries(answerUiCatalog.data.components).map(([name, definition]) => [
|
||||
name,
|
||||
zodToJsonSchema(definition.props, { $refStrategy: "none" })
|
||||
])
|
||||
)
|
||||
};
|
||||
await writeFile(target, `${JSON.stringify(contract, null, 2)}\n`);
|
||||
process.stdout.write(`Exported ${contract.components.length} components to ${target}\n`);
|
||||
Reference in New Issue
Block a user