mirror of
https://github.com/hanzoai/papers.git
synced 2026-10-30 14:58:42 +00:00
42 lines
854 B
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}
|
|
|