@opencode-ai/plugin 1.0.82 → 1.0.84
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 +88 -86
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -10,6 +10,93 @@ export type PluginInput = {
|
|
|
10
10
|
$: BunShell;
|
|
11
11
|
};
|
|
12
12
|
export type Plugin = (input: PluginInput) => Promise<Hooks>;
|
|
13
|
+
export type AuthHook = {
|
|
14
|
+
provider: string;
|
|
15
|
+
loader?: (auth: () => Promise<Auth>, provider: Provider) => Promise<Record<string, any>>;
|
|
16
|
+
methods: ({
|
|
17
|
+
type: "oauth";
|
|
18
|
+
label: string;
|
|
19
|
+
prompts?: Array<{
|
|
20
|
+
type: "text";
|
|
21
|
+
key: string;
|
|
22
|
+
message: string;
|
|
23
|
+
placeholder?: string;
|
|
24
|
+
validate?: (value: string) => string | undefined;
|
|
25
|
+
condition?: (inputs: Record<string, string>) => boolean;
|
|
26
|
+
} | {
|
|
27
|
+
type: "select";
|
|
28
|
+
key: string;
|
|
29
|
+
message: string;
|
|
30
|
+
options: Array<{
|
|
31
|
+
label: string;
|
|
32
|
+
value: string;
|
|
33
|
+
hint?: string;
|
|
34
|
+
}>;
|
|
35
|
+
condition?: (inputs: Record<string, string>) => boolean;
|
|
36
|
+
}>;
|
|
37
|
+
authorize(inputs?: Record<string, string>): Promise<AuthOuathResult>;
|
|
38
|
+
} | {
|
|
39
|
+
type: "api";
|
|
40
|
+
label: string;
|
|
41
|
+
prompts?: Array<{
|
|
42
|
+
type: "text";
|
|
43
|
+
key: string;
|
|
44
|
+
message: string;
|
|
45
|
+
placeholder?: string;
|
|
46
|
+
validate?: (value: string) => string | undefined;
|
|
47
|
+
condition?: (inputs: Record<string, string>) => boolean;
|
|
48
|
+
} | {
|
|
49
|
+
type: "select";
|
|
50
|
+
key: string;
|
|
51
|
+
message: string;
|
|
52
|
+
options: Array<{
|
|
53
|
+
label: string;
|
|
54
|
+
value: string;
|
|
55
|
+
hint?: string;
|
|
56
|
+
}>;
|
|
57
|
+
condition?: (inputs: Record<string, string>) => boolean;
|
|
58
|
+
}>;
|
|
59
|
+
authorize?(inputs?: Record<string, string>): Promise<{
|
|
60
|
+
type: "success";
|
|
61
|
+
key: string;
|
|
62
|
+
provider?: string;
|
|
63
|
+
} | {
|
|
64
|
+
type: "failed";
|
|
65
|
+
}>;
|
|
66
|
+
})[];
|
|
67
|
+
};
|
|
68
|
+
export type AuthOuathResult = {
|
|
69
|
+
url: string;
|
|
70
|
+
instructions: string;
|
|
71
|
+
} & ({
|
|
72
|
+
method: "auto";
|
|
73
|
+
callback(): Promise<({
|
|
74
|
+
type: "success";
|
|
75
|
+
provider?: string;
|
|
76
|
+
} & ({
|
|
77
|
+
refresh: string;
|
|
78
|
+
access: string;
|
|
79
|
+
expires: number;
|
|
80
|
+
} | {
|
|
81
|
+
key: string;
|
|
82
|
+
})) | {
|
|
83
|
+
type: "failed";
|
|
84
|
+
}>;
|
|
85
|
+
} | {
|
|
86
|
+
method: "code";
|
|
87
|
+
callback(code: string): Promise<({
|
|
88
|
+
type: "success";
|
|
89
|
+
provider?: string;
|
|
90
|
+
} & ({
|
|
91
|
+
refresh: string;
|
|
92
|
+
access: string;
|
|
93
|
+
expires: number;
|
|
94
|
+
} | {
|
|
95
|
+
key: string;
|
|
96
|
+
})) | {
|
|
97
|
+
type: "failed";
|
|
98
|
+
}>;
|
|
99
|
+
});
|
|
13
100
|
export interface Hooks {
|
|
14
101
|
event?: (input: {
|
|
15
102
|
event: Event;
|
|
@@ -18,92 +105,7 @@ export interface Hooks {
|
|
|
18
105
|
tool?: {
|
|
19
106
|
[key: string]: ToolDefinition;
|
|
20
107
|
};
|
|
21
|
-
auth?:
|
|
22
|
-
provider: string;
|
|
23
|
-
loader?: (auth: () => Promise<Auth>, provider: Provider) => Promise<Record<string, any>>;
|
|
24
|
-
methods: ({
|
|
25
|
-
type: "oauth";
|
|
26
|
-
label: string;
|
|
27
|
-
prompts?: Array<{
|
|
28
|
-
type: "text";
|
|
29
|
-
key: string;
|
|
30
|
-
message: string;
|
|
31
|
-
placeholder?: string;
|
|
32
|
-
validate?: (value: string) => string | undefined;
|
|
33
|
-
condition?: (inputs: Record<string, string>) => boolean;
|
|
34
|
-
} | {
|
|
35
|
-
type: "select";
|
|
36
|
-
key: string;
|
|
37
|
-
message: string;
|
|
38
|
-
options: Array<{
|
|
39
|
-
label: string;
|
|
40
|
-
value: string;
|
|
41
|
-
hint?: string;
|
|
42
|
-
}>;
|
|
43
|
-
condition?: (inputs: Record<string, string>) => boolean;
|
|
44
|
-
}>;
|
|
45
|
-
authorize(inputs?: Record<string, string>): Promise<{
|
|
46
|
-
url: string;
|
|
47
|
-
instructions: string;
|
|
48
|
-
} & ({
|
|
49
|
-
method: "auto";
|
|
50
|
-
callback(): Promise<({
|
|
51
|
-
type: "success";
|
|
52
|
-
provider?: string;
|
|
53
|
-
} & ({
|
|
54
|
-
refresh: string;
|
|
55
|
-
access: string;
|
|
56
|
-
expires: number;
|
|
57
|
-
} | {
|
|
58
|
-
key: string;
|
|
59
|
-
})) | {
|
|
60
|
-
type: "failed";
|
|
61
|
-
}>;
|
|
62
|
-
} | {
|
|
63
|
-
method: "code";
|
|
64
|
-
callback(code: string): Promise<({
|
|
65
|
-
type: "success";
|
|
66
|
-
provider?: string;
|
|
67
|
-
} & ({
|
|
68
|
-
refresh: string;
|
|
69
|
-
access: string;
|
|
70
|
-
expires: number;
|
|
71
|
-
} | {
|
|
72
|
-
key: string;
|
|
73
|
-
})) | {
|
|
74
|
-
type: "failed";
|
|
75
|
-
}>;
|
|
76
|
-
})>;
|
|
77
|
-
} | {
|
|
78
|
-
type: "api";
|
|
79
|
-
label: string;
|
|
80
|
-
prompts?: Array<{
|
|
81
|
-
type: "text";
|
|
82
|
-
key: string;
|
|
83
|
-
message: string;
|
|
84
|
-
placeholder?: string;
|
|
85
|
-
validate?: (value: string) => string | undefined;
|
|
86
|
-
condition?: (inputs: Record<string, string>) => boolean;
|
|
87
|
-
} | {
|
|
88
|
-
type: "select";
|
|
89
|
-
key: string;
|
|
90
|
-
message: string;
|
|
91
|
-
options: Array<{
|
|
92
|
-
label: string;
|
|
93
|
-
value: string;
|
|
94
|
-
hint?: string;
|
|
95
|
-
}>;
|
|
96
|
-
condition?: (inputs: Record<string, string>) => boolean;
|
|
97
|
-
}>;
|
|
98
|
-
authorize?(inputs?: Record<string, string>): Promise<{
|
|
99
|
-
type: "success";
|
|
100
|
-
key: string;
|
|
101
|
-
provider?: string;
|
|
102
|
-
} | {
|
|
103
|
-
type: "failed";
|
|
104
|
-
}>;
|
|
105
|
-
})[];
|
|
106
|
-
};
|
|
108
|
+
auth?: AuthHook;
|
|
107
109
|
/**
|
|
108
110
|
* Called when a new message is received
|
|
109
111
|
*/
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://json.schemastore.org/package.json",
|
|
3
3
|
"name": "@opencode-ai/plugin",
|
|
4
|
-
"version": "1.0.
|
|
4
|
+
"version": "1.0.84",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"scripts": {
|
|
7
7
|
"typecheck": "tsgo --noEmit",
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
"dist"
|
|
22
22
|
],
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@opencode-ai/sdk": "1.0.
|
|
24
|
+
"@opencode-ai/sdk": "1.0.84",
|
|
25
25
|
"zod": "4.1.8"
|
|
26
26
|
},
|
|
27
27
|
"devDependencies": {
|