feat: add opencode plugin with router integration and TypeScript definitions

- Implemented `createRouterAgentPluginFn` in `src/opencode.ts` to create a plugin that interacts with the router and filters routes based on metadata tags.
- Added support for executing routes with error handling and response formatting.
- Updated `rollup.config.js` to include build configurations for `opencode.js` and `opencode.d.ts`.
This commit is contained in:
2026-01-20 13:23:06 +08:00
parent 9b11ea5138
commit f4372ae55f
4 changed files with 294 additions and 141 deletions

View File

@@ -126,4 +126,26 @@ export default [
},
plugins: [dts()],
},
{
input: 'src/opencode.ts',
output: {
file: 'dist/opencode.js',
format: 'es',
},
plugins: [
resolve({
browser: true,
}),
commonjs(),
typescript(),
],
},
{
input: 'src/opencode.ts',
output: {
file: 'dist/opencode.d.ts',
format: 'es',
},
plugins: [dts()],
},
];