@pixelml/plugin 0.0.0-dev-202512250753 → 0.0.0-dev-202512260319
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/package.json +1 -1
- package/dist/example.d.ts +0 -2
- package/dist/example.js +0 -16
- package/dist/index.d.ts +0 -192
- package/dist/index.js +0 -1
- package/dist/shell.d.ts +0 -109
- package/dist/shell.js +0 -0
- package/dist/tool.d.ts +0 -20
- package/dist/tool.js +0 -5
package/package.json
CHANGED
package/dist/example.d.ts
DELETED
package/dist/example.js
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { tool } from "./tool";
|
|
2
|
-
export const ExamplePlugin = async (ctx) => {
|
|
3
|
-
return {
|
|
4
|
-
tool: {
|
|
5
|
-
mytool: tool({
|
|
6
|
-
description: "This is a custom tool",
|
|
7
|
-
args: {
|
|
8
|
-
foo: tool.schema.string().describe("foo"),
|
|
9
|
-
},
|
|
10
|
-
async execute(args) {
|
|
11
|
-
return `Hello ${args.foo}!`;
|
|
12
|
-
},
|
|
13
|
-
}),
|
|
14
|
-
},
|
|
15
|
-
};
|
|
16
|
-
};
|
package/dist/index.d.ts
DELETED
|
@@ -1,192 +0,0 @@
|
|
|
1
|
-
import type { Event, createClawClient, Project, Model, Provider, Permission, UserMessage, Message, Part, Auth, Config } from "@pixelml/sdk";
|
|
2
|
-
import type { BunShell } from "./shell";
|
|
3
|
-
import { type ToolDefinition } from "./tool";
|
|
4
|
-
export * from "./tool";
|
|
5
|
-
export type ProviderContext = {
|
|
6
|
-
source: "env" | "config" | "custom" | "api";
|
|
7
|
-
info: Provider;
|
|
8
|
-
options: Record<string, any>;
|
|
9
|
-
};
|
|
10
|
-
export type PluginInput = {
|
|
11
|
-
client: ReturnType<typeof createClawClient>;
|
|
12
|
-
project: Project;
|
|
13
|
-
directory: string;
|
|
14
|
-
worktree: string;
|
|
15
|
-
$: BunShell;
|
|
16
|
-
};
|
|
17
|
-
export type Plugin = (input: PluginInput) => Promise<Hooks>;
|
|
18
|
-
export type AuthHook = {
|
|
19
|
-
provider: string;
|
|
20
|
-
loader?: (auth: () => Promise<Auth>, provider: Provider) => Promise<Record<string, any>>;
|
|
21
|
-
methods: ({
|
|
22
|
-
type: "oauth";
|
|
23
|
-
label: string;
|
|
24
|
-
prompts?: Array<{
|
|
25
|
-
type: "text";
|
|
26
|
-
key: string;
|
|
27
|
-
message: string;
|
|
28
|
-
placeholder?: string;
|
|
29
|
-
validate?: (value: string) => string | undefined;
|
|
30
|
-
condition?: (inputs: Record<string, string>) => boolean;
|
|
31
|
-
} | {
|
|
32
|
-
type: "select";
|
|
33
|
-
key: string;
|
|
34
|
-
message: string;
|
|
35
|
-
options: Array<{
|
|
36
|
-
label: string;
|
|
37
|
-
value: string;
|
|
38
|
-
hint?: string;
|
|
39
|
-
}>;
|
|
40
|
-
condition?: (inputs: Record<string, string>) => boolean;
|
|
41
|
-
}>;
|
|
42
|
-
authorize(inputs?: Record<string, string>): Promise<AuthOuathResult>;
|
|
43
|
-
} | {
|
|
44
|
-
type: "api";
|
|
45
|
-
label: string;
|
|
46
|
-
prompts?: Array<{
|
|
47
|
-
type: "text";
|
|
48
|
-
key: string;
|
|
49
|
-
message: string;
|
|
50
|
-
placeholder?: string;
|
|
51
|
-
validate?: (value: string) => string | undefined;
|
|
52
|
-
condition?: (inputs: Record<string, string>) => boolean;
|
|
53
|
-
} | {
|
|
54
|
-
type: "select";
|
|
55
|
-
key: string;
|
|
56
|
-
message: string;
|
|
57
|
-
options: Array<{
|
|
58
|
-
label: string;
|
|
59
|
-
value: string;
|
|
60
|
-
hint?: string;
|
|
61
|
-
}>;
|
|
62
|
-
condition?: (inputs: Record<string, string>) => boolean;
|
|
63
|
-
}>;
|
|
64
|
-
authorize?(inputs?: Record<string, string>): Promise<{
|
|
65
|
-
type: "success";
|
|
66
|
-
key: string;
|
|
67
|
-
provider?: string;
|
|
68
|
-
} | {
|
|
69
|
-
type: "failed";
|
|
70
|
-
}>;
|
|
71
|
-
})[];
|
|
72
|
-
};
|
|
73
|
-
export type AuthOuathResult = {
|
|
74
|
-
url: string;
|
|
75
|
-
instructions: string;
|
|
76
|
-
} & ({
|
|
77
|
-
method: "auto";
|
|
78
|
-
callback(): Promise<({
|
|
79
|
-
type: "success";
|
|
80
|
-
provider?: string;
|
|
81
|
-
} & ({
|
|
82
|
-
refresh: string;
|
|
83
|
-
access: string;
|
|
84
|
-
expires: number;
|
|
85
|
-
} | {
|
|
86
|
-
key: string;
|
|
87
|
-
})) | {
|
|
88
|
-
type: "failed";
|
|
89
|
-
}>;
|
|
90
|
-
} | {
|
|
91
|
-
method: "code";
|
|
92
|
-
callback(code: string): Promise<({
|
|
93
|
-
type: "success";
|
|
94
|
-
provider?: string;
|
|
95
|
-
} & ({
|
|
96
|
-
refresh: string;
|
|
97
|
-
access: string;
|
|
98
|
-
expires: number;
|
|
99
|
-
} | {
|
|
100
|
-
key: string;
|
|
101
|
-
})) | {
|
|
102
|
-
type: "failed";
|
|
103
|
-
}>;
|
|
104
|
-
});
|
|
105
|
-
export interface Hooks {
|
|
106
|
-
event?: (input: {
|
|
107
|
-
event: Event;
|
|
108
|
-
}) => Promise<void>;
|
|
109
|
-
config?: (input: Config) => Promise<void>;
|
|
110
|
-
tool?: {
|
|
111
|
-
[key: string]: ToolDefinition;
|
|
112
|
-
};
|
|
113
|
-
auth?: AuthHook;
|
|
114
|
-
/**
|
|
115
|
-
* Called when a new message is received
|
|
116
|
-
*/
|
|
117
|
-
"chat.message"?: (input: {
|
|
118
|
-
sessionID: string;
|
|
119
|
-
agent?: string;
|
|
120
|
-
model?: {
|
|
121
|
-
providerID: string;
|
|
122
|
-
modelID: string;
|
|
123
|
-
};
|
|
124
|
-
messageID?: string;
|
|
125
|
-
}, output: {
|
|
126
|
-
message: UserMessage;
|
|
127
|
-
parts: Part[];
|
|
128
|
-
}) => Promise<void>;
|
|
129
|
-
/**
|
|
130
|
-
* Modify parameters sent to LLM
|
|
131
|
-
*/
|
|
132
|
-
"chat.params"?: (input: {
|
|
133
|
-
sessionID: string;
|
|
134
|
-
agent: string;
|
|
135
|
-
model: Model;
|
|
136
|
-
provider: ProviderContext;
|
|
137
|
-
message: UserMessage;
|
|
138
|
-
}, output: {
|
|
139
|
-
temperature: number;
|
|
140
|
-
topP: number;
|
|
141
|
-
topK: number;
|
|
142
|
-
options: Record<string, any>;
|
|
143
|
-
}) => Promise<void>;
|
|
144
|
-
"permission.ask"?: (input: Permission, output: {
|
|
145
|
-
status: "ask" | "deny" | "allow";
|
|
146
|
-
}) => Promise<void>;
|
|
147
|
-
"tool.execute.before"?: (input: {
|
|
148
|
-
tool: string;
|
|
149
|
-
sessionID: string;
|
|
150
|
-
callID: string;
|
|
151
|
-
}, output: {
|
|
152
|
-
args: any;
|
|
153
|
-
}) => Promise<void>;
|
|
154
|
-
"tool.execute.after"?: (input: {
|
|
155
|
-
tool: string;
|
|
156
|
-
sessionID: string;
|
|
157
|
-
callID: string;
|
|
158
|
-
}, output: {
|
|
159
|
-
title: string;
|
|
160
|
-
output: string;
|
|
161
|
-
metadata: any;
|
|
162
|
-
}) => Promise<void>;
|
|
163
|
-
"experimental.chat.messages.transform"?: (input: {}, output: {
|
|
164
|
-
messages: {
|
|
165
|
-
info: Message;
|
|
166
|
-
parts: Part[];
|
|
167
|
-
}[];
|
|
168
|
-
}) => Promise<void>;
|
|
169
|
-
"experimental.chat.system.transform"?: (input: {}, output: {
|
|
170
|
-
system: string[];
|
|
171
|
-
}) => Promise<void>;
|
|
172
|
-
/**
|
|
173
|
-
* Called before session compaction starts. Allows plugins to customize
|
|
174
|
-
* the compaction prompt.
|
|
175
|
-
*
|
|
176
|
-
* - `context`: Additional context strings appended to the default prompt
|
|
177
|
-
* - `prompt`: If set, replaces the default compaction prompt entirely
|
|
178
|
-
*/
|
|
179
|
-
"experimental.session.compacting"?: (input: {
|
|
180
|
-
sessionID: string;
|
|
181
|
-
}, output: {
|
|
182
|
-
context: string[];
|
|
183
|
-
prompt?: string;
|
|
184
|
-
}) => Promise<void>;
|
|
185
|
-
"experimental.text.complete"?: (input: {
|
|
186
|
-
sessionID: string;
|
|
187
|
-
messageID: string;
|
|
188
|
-
partID: string;
|
|
189
|
-
}, output: {
|
|
190
|
-
text: string;
|
|
191
|
-
}) => Promise<void>;
|
|
192
|
-
}
|
package/dist/index.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "./tool";
|
package/dist/shell.d.ts
DELETED
|
@@ -1,109 +0,0 @@
|
|
|
1
|
-
export type ShellFunction = (input: Uint8Array) => Uint8Array;
|
|
2
|
-
export type ShellExpression = {
|
|
3
|
-
toString(): string;
|
|
4
|
-
} | Array<ShellExpression> | string | {
|
|
5
|
-
raw: string;
|
|
6
|
-
} | ReadableStream;
|
|
7
|
-
export interface BunShell {
|
|
8
|
-
(strings: TemplateStringsArray, ...expressions: ShellExpression[]): BunShellPromise;
|
|
9
|
-
/**
|
|
10
|
-
* Perform bash-like brace expansion on the given pattern.
|
|
11
|
-
* @param pattern - Brace pattern to expand
|
|
12
|
-
*/
|
|
13
|
-
braces(pattern: string): string[];
|
|
14
|
-
/**
|
|
15
|
-
* Escape strings for input into shell commands.
|
|
16
|
-
*/
|
|
17
|
-
escape(input: string): string;
|
|
18
|
-
/**
|
|
19
|
-
* Change the default environment variables for shells created by this instance.
|
|
20
|
-
*/
|
|
21
|
-
env(newEnv?: Record<string, string | undefined>): BunShell;
|
|
22
|
-
/**
|
|
23
|
-
* Default working directory to use for shells created by this instance.
|
|
24
|
-
*/
|
|
25
|
-
cwd(newCwd?: string): BunShell;
|
|
26
|
-
/**
|
|
27
|
-
* Configure the shell to not throw an exception on non-zero exit codes.
|
|
28
|
-
*/
|
|
29
|
-
nothrow(): BunShell;
|
|
30
|
-
/**
|
|
31
|
-
* Configure whether or not the shell should throw an exception on non-zero exit codes.
|
|
32
|
-
*/
|
|
33
|
-
throws(shouldThrow: boolean): BunShell;
|
|
34
|
-
}
|
|
35
|
-
export interface BunShellPromise extends Promise<BunShellOutput> {
|
|
36
|
-
readonly stdin: WritableStream;
|
|
37
|
-
/**
|
|
38
|
-
* Change the current working directory of the shell.
|
|
39
|
-
*/
|
|
40
|
-
cwd(newCwd: string): this;
|
|
41
|
-
/**
|
|
42
|
-
* Set environment variables for the shell.
|
|
43
|
-
*/
|
|
44
|
-
env(newEnv: Record<string, string> | undefined): this;
|
|
45
|
-
/**
|
|
46
|
-
* By default, the shell will write to the current process's stdout and stderr, as well as buffering that output.
|
|
47
|
-
* This configures the shell to only buffer the output.
|
|
48
|
-
*/
|
|
49
|
-
quiet(): this;
|
|
50
|
-
/**
|
|
51
|
-
* Read from stdout as a string, line by line
|
|
52
|
-
* Automatically calls quiet() to disable echoing to stdout.
|
|
53
|
-
*/
|
|
54
|
-
lines(): AsyncIterable<string>;
|
|
55
|
-
/**
|
|
56
|
-
* Read from stdout as a string.
|
|
57
|
-
* Automatically calls quiet() to disable echoing to stdout.
|
|
58
|
-
*/
|
|
59
|
-
text(encoding?: BufferEncoding): Promise<string>;
|
|
60
|
-
/**
|
|
61
|
-
* Read from stdout as a JSON object
|
|
62
|
-
* Automatically calls quiet()
|
|
63
|
-
*/
|
|
64
|
-
json(): Promise<any>;
|
|
65
|
-
/**
|
|
66
|
-
* Read from stdout as an ArrayBuffer
|
|
67
|
-
* Automatically calls quiet()
|
|
68
|
-
*/
|
|
69
|
-
arrayBuffer(): Promise<ArrayBuffer>;
|
|
70
|
-
/**
|
|
71
|
-
* Read from stdout as a Blob
|
|
72
|
-
* Automatically calls quiet()
|
|
73
|
-
*/
|
|
74
|
-
blob(): Promise<Blob>;
|
|
75
|
-
/**
|
|
76
|
-
* Configure the shell to not throw an exception on non-zero exit codes.
|
|
77
|
-
*/
|
|
78
|
-
nothrow(): this;
|
|
79
|
-
/**
|
|
80
|
-
* Configure whether or not the shell should throw an exception on non-zero exit codes.
|
|
81
|
-
*/
|
|
82
|
-
throws(shouldThrow: boolean): this;
|
|
83
|
-
}
|
|
84
|
-
export interface BunShellOutput {
|
|
85
|
-
readonly stdout: Buffer;
|
|
86
|
-
readonly stderr: Buffer;
|
|
87
|
-
readonly exitCode: number;
|
|
88
|
-
/**
|
|
89
|
-
* Read from stdout as a string
|
|
90
|
-
*/
|
|
91
|
-
text(encoding?: BufferEncoding): string;
|
|
92
|
-
/**
|
|
93
|
-
* Read from stdout as a JSON object
|
|
94
|
-
*/
|
|
95
|
-
json(): any;
|
|
96
|
-
/**
|
|
97
|
-
* Read from stdout as an ArrayBuffer
|
|
98
|
-
*/
|
|
99
|
-
arrayBuffer(): ArrayBuffer;
|
|
100
|
-
/**
|
|
101
|
-
* Read from stdout as an Uint8Array
|
|
102
|
-
*/
|
|
103
|
-
bytes(): Uint8Array;
|
|
104
|
-
/**
|
|
105
|
-
* Read from stdout as a Blob
|
|
106
|
-
*/
|
|
107
|
-
blob(): Blob;
|
|
108
|
-
}
|
|
109
|
-
export type BunShellError = Error & BunShellOutput;
|
package/dist/shell.js
DELETED
|
File without changes
|
package/dist/tool.d.ts
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { z } from "zod";
|
|
2
|
-
export type ToolContext = {
|
|
3
|
-
sessionID: string;
|
|
4
|
-
messageID: string;
|
|
5
|
-
agent: string;
|
|
6
|
-
abort: AbortSignal;
|
|
7
|
-
};
|
|
8
|
-
export declare function tool<Args extends z.ZodRawShape>(input: {
|
|
9
|
-
description: string;
|
|
10
|
-
args: Args;
|
|
11
|
-
execute(args: z.infer<z.ZodObject<Args>>, context: ToolContext): Promise<string>;
|
|
12
|
-
}): {
|
|
13
|
-
description: string;
|
|
14
|
-
args: Args;
|
|
15
|
-
execute(args: z.infer<z.ZodObject<Args>>, context: ToolContext): Promise<string>;
|
|
16
|
-
};
|
|
17
|
-
export declare namespace tool {
|
|
18
|
-
var schema: typeof z;
|
|
19
|
-
}
|
|
20
|
-
export type ToolDefinition = ReturnType<typeof tool>;
|