Files
papers/hanzo-harness-hacking/sections/12-extension-scaffold-template.tex

42 lines
854 B
TeX

\section{Extension Scaffold Template}
\label{app:ext-scaffold}
\begin{verbatim}
// Generated extension scaffold (bot/bot/extensions/<name>/)
// package.json
{
"name": "@hanzo/bot-extension-<name>",
"version": "0.1.0",
"main": "dist/index.js",
"scripts": {
"build": "tsc",
"test": "jest --coverage"
},
"peerDependencies": {
"@hanzo/bot-runtime": ">=1.0.0"
}
}
// index.ts
import type { BotPlugin, PluginAPI } from '@hanzo/bot-runtime';
export const plugin: BotPlugin = {
name: '<name>',
version: '0.1.0',
async setup(api: PluginAPI) {
api.registerTool({
name: '<tool_name>',
description: '<description>',
inputSchema: { type: 'object', properties: { ... } },
}, async (input) => {
// implementation
return { result: '...' };
});
},
};
export default plugin;
\end{verbatim}