@opencode-ai/plugin
Advanced tools
+2
-2
@@ -1,5 +0,5 @@ | ||
| export const ExamplePlugin = async ({ client, $ }) => { | ||
| export const ExamplePlugin = async ({ client: _client, $: _shell, project: _project, directory: _directory, worktree: _worktree, }) => { | ||
| return { | ||
| permission: {}, | ||
| async "chat.params"(input, output) { | ||
| async "chat.params"(_input, output) { | ||
| output.topP = 1; | ||
@@ -6,0 +6,0 @@ }, |
+29
-0
@@ -9,4 +9,24 @@ import type { Event, createOpencodeClient, Project, Model, Provider, Permission, UserMessage, Part, Auth, Config } from "@opencode-ai/sdk"; | ||
| $: BunShell; | ||
| Tool: { | ||
| define(id: string, init: any | (() => Promise<any>)): any; | ||
| }; | ||
| z: any; | ||
| }; | ||
| export type Plugin = (input: PluginInput) => Promise<Hooks>; | ||
| export type HttpParamSpec = { | ||
| type: "string" | "number" | "boolean" | "array"; | ||
| description?: string; | ||
| optional?: boolean; | ||
| items?: "string" | "number" | "boolean"; | ||
| }; | ||
| export type HttpToolRegistration = { | ||
| id: string; | ||
| description: string; | ||
| parameters: { | ||
| type: "object"; | ||
| properties: Record<string, HttpParamSpec>; | ||
| }; | ||
| callbackUrl: string; | ||
| headers?: Record<string, string>; | ||
| }; | ||
| export interface Hooks { | ||
@@ -96,2 +116,11 @@ event?: (input: { | ||
| }) => Promise<void>; | ||
| /** | ||
| * Allow plugins to register additional tools with the server. | ||
| * Use registerHTTP to add a tool that calls back to your plugin/service. | ||
| * Use register to add a native/local tool with direct function execution. | ||
| */ | ||
| "tool.register"?: (input: {}, output: { | ||
| registerHTTP: (tool: HttpToolRegistration) => void | Promise<void>; | ||
| register: (tool: any) => void | Promise<void>; | ||
| }) => Promise<void>; | ||
| } |
+2
-2
| { | ||
| "$schema": "https://json.schemastore.org/package.json", | ||
| "name": "@opencode-ai/plugin", | ||
| "version": "0.0.0-202509010531", | ||
| "version": "0.0.0-202509130949", | ||
| "type": "module", | ||
@@ -19,3 +19,3 @@ "scripts": { | ||
| "dependencies": { | ||
| "@opencode-ai/sdk": "0.5.28" | ||
| "@opencode-ai/sdk": "0.7.6" | ||
| }, | ||
@@ -22,0 +22,0 @@ "devDependencies": { |
7805
15.44%243
13.55%+ Added
+ Added
+ Added
- Removed
- Removed
- Removed
Updated