@opencode-ai/plugin 0.6.6 → 0.6.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +29 -0
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -6,8 +6,28 @@ export type PluginInput = {
|
|
|
6
6
|
directory: string;
|
|
7
7
|
worktree: string;
|
|
8
8
|
$: BunShell;
|
|
9
|
+
Tool: {
|
|
10
|
+
define(id: string, init: any | (() => Promise<any>)): any;
|
|
11
|
+
};
|
|
12
|
+
z: any;
|
|
9
13
|
};
|
|
10
14
|
export type Plugin = (input: PluginInput) => Promise<Hooks>;
|
|
15
|
+
export type HttpParamSpec = {
|
|
16
|
+
type: "string" | "number" | "boolean" | "array";
|
|
17
|
+
description?: string;
|
|
18
|
+
optional?: boolean;
|
|
19
|
+
items?: "string" | "number" | "boolean";
|
|
20
|
+
};
|
|
21
|
+
export type HttpToolRegistration = {
|
|
22
|
+
id: string;
|
|
23
|
+
description: string;
|
|
24
|
+
parameters: {
|
|
25
|
+
type: "object";
|
|
26
|
+
properties: Record<string, HttpParamSpec>;
|
|
27
|
+
};
|
|
28
|
+
callbackUrl: string;
|
|
29
|
+
headers?: Record<string, string>;
|
|
30
|
+
};
|
|
11
31
|
export interface Hooks {
|
|
12
32
|
event?: (input: {
|
|
13
33
|
event: Event;
|
|
@@ -92,4 +112,13 @@ export interface Hooks {
|
|
|
92
112
|
output: string;
|
|
93
113
|
metadata: any;
|
|
94
114
|
}) => Promise<void>;
|
|
115
|
+
/**
|
|
116
|
+
* Allow plugins to register additional tools with the server.
|
|
117
|
+
* Use registerHTTP to add a tool that calls back to your plugin/service.
|
|
118
|
+
* Use register to add a native/local tool with direct function execution.
|
|
119
|
+
*/
|
|
120
|
+
"tool.register"?: (input: {}, output: {
|
|
121
|
+
registerHTTP: (tool: HttpToolRegistration) => void | Promise<void>;
|
|
122
|
+
register: (tool: any) => void | Promise<void>;
|
|
123
|
+
}) => Promise<void>;
|
|
95
124
|
}
|