dipclaw 0.1.0
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/config.example.json +26 -0
- package/dist/agent/agent.d.ts +85 -0
- package/dist/agent/agent.js +725 -0
- package/dist/agent/agent.js.map +1 -0
- package/dist/agent/memory.d.ts +17 -0
- package/dist/agent/memory.js +92 -0
- package/dist/agent/memory.js.map +1 -0
- package/dist/agent/scheduler.d.ts +35 -0
- package/dist/agent/scheduler.js +154 -0
- package/dist/agent/scheduler.js.map +1 -0
- package/dist/agent/skill-generator.d.ts +37 -0
- package/dist/agent/skill-generator.js +263 -0
- package/dist/agent/skill-generator.js.map +1 -0
- package/dist/agent/task-runner.d.ts +31 -0
- package/dist/agent/task-runner.js +242 -0
- package/dist/agent/task-runner.js.map +1 -0
- package/dist/browser/actions.d.ts +28 -0
- package/dist/browser/actions.js +212 -0
- package/dist/browser/actions.js.map +1 -0
- package/dist/browser/manager.d.ts +17 -0
- package/dist/browser/manager.js +249 -0
- package/dist/browser/manager.js.map +1 -0
- package/dist/browser/script-runner.d.ts +49 -0
- package/dist/browser/script-runner.js +137 -0
- package/dist/browser/script-runner.js.map +1 -0
- package/dist/browser/snapshot.d.ts +15 -0
- package/dist/browser/snapshot.js +38 -0
- package/dist/browser/snapshot.js.map +1 -0
- package/dist/config/types.d.ts +62 -0
- package/dist/config/types.js +47 -0
- package/dist/config/types.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +219 -0
- package/dist/index.js.map +1 -0
- package/dist/llm/client.d.ts +3 -0
- package/dist/llm/client.js +503 -0
- package/dist/llm/client.js.map +1 -0
- package/dist/llm/tools.d.ts +5 -0
- package/dist/llm/tools.js +94 -0
- package/dist/llm/tools.js.map +1 -0
- package/dist/llm/types.d.ts +49 -0
- package/dist/llm/types.js +2 -0
- package/dist/llm/types.js.map +1 -0
- package/dist/logging/logger.d.ts +17 -0
- package/dist/logging/logger.js +46 -0
- package/dist/logging/logger.js.map +1 -0
- package/dist/telegram/bot.d.ts +15 -0
- package/dist/telegram/bot.js +279 -0
- package/dist/telegram/bot.js.map +1 -0
- package/dist/tui/tui.d.ts +12 -0
- package/dist/tui/tui.js +176 -0
- package/dist/tui/tui.js.map +1 -0
- package/package.json +53 -0
|
@@ -0,0 +1,503 @@
|
|
|
1
|
+
import OpenAI from "openai";
|
|
2
|
+
import Anthropic from "@anthropic-ai/sdk";
|
|
3
|
+
import fs from "node:fs";
|
|
4
|
+
import path from "node:path";
|
|
5
|
+
export function createLlmClient(config) {
|
|
6
|
+
let client;
|
|
7
|
+
if (config.llm.protocol === "openai") {
|
|
8
|
+
client = new OpenAIClient(config);
|
|
9
|
+
}
|
|
10
|
+
else {
|
|
11
|
+
client = new ClaudeClient(config);
|
|
12
|
+
}
|
|
13
|
+
if (config.debug) {
|
|
14
|
+
return new DebugLlmClient(client, config.workspace);
|
|
15
|
+
}
|
|
16
|
+
return client;
|
|
17
|
+
}
|
|
18
|
+
// --- OpenAI Protocol ---
|
|
19
|
+
class OpenAIClient {
|
|
20
|
+
client;
|
|
21
|
+
model;
|
|
22
|
+
maxTokens;
|
|
23
|
+
constructor(config) {
|
|
24
|
+
let baseURL = config.llm.baseUrl.replace(/\/+$/, "");
|
|
25
|
+
if (!baseURL.endsWith("/v1")) {
|
|
26
|
+
baseURL += "/v1";
|
|
27
|
+
}
|
|
28
|
+
this.client = new OpenAI({
|
|
29
|
+
apiKey: config.llm.apiKey,
|
|
30
|
+
baseURL,
|
|
31
|
+
});
|
|
32
|
+
this.model = config.llm.model;
|
|
33
|
+
this.maxTokens = config.llm.maxTokens;
|
|
34
|
+
}
|
|
35
|
+
async chat(messages, tools, systemPrompt) {
|
|
36
|
+
const openaiMessages = this.convertMessages(messages, systemPrompt);
|
|
37
|
+
const openaiTools = tools?.map((t) => this.convertTool(t));
|
|
38
|
+
const params = {
|
|
39
|
+
model: this.model,
|
|
40
|
+
messages: openaiMessages,
|
|
41
|
+
};
|
|
42
|
+
if (this.maxTokens) {
|
|
43
|
+
params.max_tokens = this.maxTokens;
|
|
44
|
+
}
|
|
45
|
+
if (openaiTools && openaiTools.length > 0) {
|
|
46
|
+
params.tools = openaiTools;
|
|
47
|
+
}
|
|
48
|
+
const response = await this.client.chat.completions.create(params);
|
|
49
|
+
const choice = response.choices[0];
|
|
50
|
+
const content = choice.message.content || "";
|
|
51
|
+
const toolCalls = (choice.message.tool_calls || []).map((tc) => ({
|
|
52
|
+
id: tc.id,
|
|
53
|
+
name: tc.function.name,
|
|
54
|
+
arguments: JSON.parse(tc.function.arguments),
|
|
55
|
+
}));
|
|
56
|
+
let stopReason = "stop";
|
|
57
|
+
if (choice.finish_reason === "tool_calls") {
|
|
58
|
+
stopReason = "tool_use";
|
|
59
|
+
}
|
|
60
|
+
else if (choice.finish_reason === "length") {
|
|
61
|
+
stopReason = "length";
|
|
62
|
+
}
|
|
63
|
+
return {
|
|
64
|
+
content,
|
|
65
|
+
toolCalls,
|
|
66
|
+
stopReason,
|
|
67
|
+
usage: response.usage
|
|
68
|
+
? {
|
|
69
|
+
inputTokens: response.usage.prompt_tokens,
|
|
70
|
+
outputTokens: response.usage.completion_tokens || 0,
|
|
71
|
+
}
|
|
72
|
+
: undefined,
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
async *chatStream(messages, tools, systemPrompt) {
|
|
76
|
+
const openaiMessages = this.convertMessages(messages, systemPrompt);
|
|
77
|
+
const openaiTools = tools?.map((t) => this.convertTool(t));
|
|
78
|
+
const params = {
|
|
79
|
+
model: this.model,
|
|
80
|
+
messages: openaiMessages,
|
|
81
|
+
stream: true,
|
|
82
|
+
};
|
|
83
|
+
if (this.maxTokens) {
|
|
84
|
+
params.max_tokens = this.maxTokens;
|
|
85
|
+
}
|
|
86
|
+
if (openaiTools && openaiTools.length > 0) {
|
|
87
|
+
params.tools = openaiTools;
|
|
88
|
+
}
|
|
89
|
+
const stream = await this.client.chat.completions.create(params);
|
|
90
|
+
// Track tool calls being assembled across chunks
|
|
91
|
+
const pendingToolCalls = new Map();
|
|
92
|
+
for await (const chunk of stream) {
|
|
93
|
+
const delta = chunk.choices?.[0]?.delta;
|
|
94
|
+
if (!delta)
|
|
95
|
+
continue;
|
|
96
|
+
// Text content
|
|
97
|
+
if (delta.content) {
|
|
98
|
+
yield { type: "text_delta", text: delta.content };
|
|
99
|
+
}
|
|
100
|
+
// Tool calls (streamed incrementally)
|
|
101
|
+
if (delta.tool_calls) {
|
|
102
|
+
for (const tc of delta.tool_calls) {
|
|
103
|
+
const idx = tc.index;
|
|
104
|
+
if (tc.id) {
|
|
105
|
+
// New tool call starting
|
|
106
|
+
pendingToolCalls.set(idx, {
|
|
107
|
+
id: tc.id,
|
|
108
|
+
name: tc.function?.name || "",
|
|
109
|
+
args: tc.function?.arguments || "",
|
|
110
|
+
});
|
|
111
|
+
yield {
|
|
112
|
+
type: "tool_call_start",
|
|
113
|
+
toolCall: { id: tc.id, name: tc.function?.name || "", arguments: {} },
|
|
114
|
+
};
|
|
115
|
+
}
|
|
116
|
+
else {
|
|
117
|
+
// Continuing existing tool call
|
|
118
|
+
const pending = pendingToolCalls.get(idx);
|
|
119
|
+
if (pending) {
|
|
120
|
+
if (tc.function?.name)
|
|
121
|
+
pending.name += tc.function.name;
|
|
122
|
+
if (tc.function?.arguments)
|
|
123
|
+
pending.args += tc.function.arguments;
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
// Check if stream is done
|
|
129
|
+
if (chunk.choices?.[0]?.finish_reason) {
|
|
130
|
+
// Emit completed tool calls
|
|
131
|
+
for (const [, pending] of pendingToolCalls) {
|
|
132
|
+
try {
|
|
133
|
+
yield {
|
|
134
|
+
type: "tool_call_end",
|
|
135
|
+
toolCall: {
|
|
136
|
+
id: pending.id,
|
|
137
|
+
name: pending.name,
|
|
138
|
+
arguments: JSON.parse(pending.args || "{}"),
|
|
139
|
+
},
|
|
140
|
+
};
|
|
141
|
+
}
|
|
142
|
+
catch {
|
|
143
|
+
yield {
|
|
144
|
+
type: "tool_call_end",
|
|
145
|
+
toolCall: { id: pending.id, name: pending.name, arguments: {} },
|
|
146
|
+
};
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
yield { type: "done" };
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
convertMessages(messages, systemPrompt) {
|
|
154
|
+
const result = [];
|
|
155
|
+
if (systemPrompt) {
|
|
156
|
+
result.push({ role: "system", content: systemPrompt });
|
|
157
|
+
}
|
|
158
|
+
for (const msg of messages) {
|
|
159
|
+
if (msg.role === "tool" && msg.toolCallId) {
|
|
160
|
+
result.push({
|
|
161
|
+
role: "tool",
|
|
162
|
+
tool_call_id: msg.toolCallId,
|
|
163
|
+
content: typeof msg.content === "string"
|
|
164
|
+
? msg.content
|
|
165
|
+
: JSON.stringify(msg.content),
|
|
166
|
+
});
|
|
167
|
+
}
|
|
168
|
+
else if (msg.role === "assistant" && msg.toolCalls?.length) {
|
|
169
|
+
result.push({
|
|
170
|
+
role: "assistant",
|
|
171
|
+
content: typeof msg.content === "string" ? msg.content || null : null,
|
|
172
|
+
tool_calls: msg.toolCalls.map((tc) => ({
|
|
173
|
+
id: tc.id,
|
|
174
|
+
type: "function",
|
|
175
|
+
function: {
|
|
176
|
+
name: tc.name,
|
|
177
|
+
arguments: JSON.stringify(tc.arguments),
|
|
178
|
+
},
|
|
179
|
+
})),
|
|
180
|
+
});
|
|
181
|
+
}
|
|
182
|
+
else {
|
|
183
|
+
const content = this.convertContent(msg.content);
|
|
184
|
+
result.push({
|
|
185
|
+
role: msg.role === "system" ? "system" : msg.role,
|
|
186
|
+
content,
|
|
187
|
+
});
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
return result;
|
|
191
|
+
}
|
|
192
|
+
convertContent(content) {
|
|
193
|
+
if (typeof content === "string")
|
|
194
|
+
return content;
|
|
195
|
+
return content.map((block) => {
|
|
196
|
+
if (block.type === "image" && block.imageData) {
|
|
197
|
+
return {
|
|
198
|
+
type: "image_url",
|
|
199
|
+
image_url: {
|
|
200
|
+
url: `data:${block.mediaType || "image/png"};base64,${block.imageData}`,
|
|
201
|
+
},
|
|
202
|
+
};
|
|
203
|
+
}
|
|
204
|
+
return { type: "text", text: block.text || "" };
|
|
205
|
+
});
|
|
206
|
+
}
|
|
207
|
+
convertTool(tool) {
|
|
208
|
+
return {
|
|
209
|
+
type: "function",
|
|
210
|
+
function: {
|
|
211
|
+
name: tool.name,
|
|
212
|
+
description: tool.description,
|
|
213
|
+
parameters: tool.parameters,
|
|
214
|
+
},
|
|
215
|
+
};
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
// --- Claude/Anthropic Protocol ---
|
|
219
|
+
/** Anthropic API requires max_tokens — default to 16384 if not configured */
|
|
220
|
+
const CLAUDE_DEFAULT_MAX_TOKENS = 16384;
|
|
221
|
+
class ClaudeClient {
|
|
222
|
+
client;
|
|
223
|
+
model;
|
|
224
|
+
maxTokens;
|
|
225
|
+
constructor(config) {
|
|
226
|
+
this.client = new Anthropic({
|
|
227
|
+
apiKey: config.llm.apiKey,
|
|
228
|
+
baseURL: config.llm.baseUrl,
|
|
229
|
+
});
|
|
230
|
+
this.model = config.llm.model;
|
|
231
|
+
this.maxTokens = config.llm.maxTokens ?? CLAUDE_DEFAULT_MAX_TOKENS;
|
|
232
|
+
}
|
|
233
|
+
async chat(messages, tools, systemPrompt) {
|
|
234
|
+
const anthropicMessages = this.convertMessages(messages);
|
|
235
|
+
const anthropicTools = tools?.map((t) => this.convertTool(t));
|
|
236
|
+
const params = {
|
|
237
|
+
model: this.model,
|
|
238
|
+
max_tokens: this.maxTokens,
|
|
239
|
+
messages: anthropicMessages,
|
|
240
|
+
};
|
|
241
|
+
if (systemPrompt) {
|
|
242
|
+
params.system = systemPrompt;
|
|
243
|
+
}
|
|
244
|
+
if (anthropicTools && anthropicTools.length > 0) {
|
|
245
|
+
params.tools = anthropicTools;
|
|
246
|
+
}
|
|
247
|
+
const response = await this.client.messages.create(params);
|
|
248
|
+
let content = "";
|
|
249
|
+
const toolCalls = [];
|
|
250
|
+
for (const block of response.content) {
|
|
251
|
+
if (block.type === "text") {
|
|
252
|
+
content += block.text;
|
|
253
|
+
}
|
|
254
|
+
else if (block.type === "tool_use") {
|
|
255
|
+
toolCalls.push({
|
|
256
|
+
id: block.id,
|
|
257
|
+
name: block.name,
|
|
258
|
+
arguments: block.input,
|
|
259
|
+
});
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
let stopReason = "stop";
|
|
263
|
+
if (response.stop_reason === "tool_use") {
|
|
264
|
+
stopReason = "tool_use";
|
|
265
|
+
}
|
|
266
|
+
else if (response.stop_reason === "max_tokens") {
|
|
267
|
+
stopReason = "length";
|
|
268
|
+
}
|
|
269
|
+
return {
|
|
270
|
+
content,
|
|
271
|
+
toolCalls,
|
|
272
|
+
stopReason,
|
|
273
|
+
usage: {
|
|
274
|
+
inputTokens: response.usage.input_tokens,
|
|
275
|
+
outputTokens: response.usage.output_tokens,
|
|
276
|
+
},
|
|
277
|
+
};
|
|
278
|
+
}
|
|
279
|
+
async *chatStream(messages, tools, systemPrompt) {
|
|
280
|
+
const anthropicMessages = this.convertMessages(messages);
|
|
281
|
+
const anthropicTools = tools?.map((t) => this.convertTool(t));
|
|
282
|
+
const params = {
|
|
283
|
+
model: this.model,
|
|
284
|
+
max_tokens: this.maxTokens,
|
|
285
|
+
messages: anthropicMessages,
|
|
286
|
+
stream: true,
|
|
287
|
+
};
|
|
288
|
+
if (systemPrompt) {
|
|
289
|
+
params.system = systemPrompt;
|
|
290
|
+
}
|
|
291
|
+
if (anthropicTools && anthropicTools.length > 0) {
|
|
292
|
+
params.tools = anthropicTools;
|
|
293
|
+
}
|
|
294
|
+
const stream = this.client.messages.stream(params);
|
|
295
|
+
let currentToolId = "";
|
|
296
|
+
let currentToolName = "";
|
|
297
|
+
let currentToolInput = "";
|
|
298
|
+
for await (const event of stream) {
|
|
299
|
+
if (event.type === "content_block_start") {
|
|
300
|
+
const block = event.content_block;
|
|
301
|
+
if (block?.type === "tool_use") {
|
|
302
|
+
currentToolId = block.id;
|
|
303
|
+
currentToolName = block.name;
|
|
304
|
+
currentToolInput = "";
|
|
305
|
+
yield {
|
|
306
|
+
type: "tool_call_start",
|
|
307
|
+
toolCall: { id: block.id, name: block.name, arguments: {} },
|
|
308
|
+
};
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
else if (event.type === "content_block_delta") {
|
|
312
|
+
const delta = event.delta;
|
|
313
|
+
if (delta?.type === "text_delta") {
|
|
314
|
+
yield { type: "text_delta", text: delta.text };
|
|
315
|
+
}
|
|
316
|
+
else if (delta?.type === "input_json_delta") {
|
|
317
|
+
currentToolInput += delta.partial_json;
|
|
318
|
+
}
|
|
319
|
+
}
|
|
320
|
+
else if (event.type === "content_block_stop") {
|
|
321
|
+
if (currentToolId) {
|
|
322
|
+
try {
|
|
323
|
+
yield {
|
|
324
|
+
type: "tool_call_end",
|
|
325
|
+
toolCall: {
|
|
326
|
+
id: currentToolId,
|
|
327
|
+
name: currentToolName,
|
|
328
|
+
arguments: JSON.parse(currentToolInput || "{}"),
|
|
329
|
+
},
|
|
330
|
+
};
|
|
331
|
+
}
|
|
332
|
+
catch {
|
|
333
|
+
yield {
|
|
334
|
+
type: "tool_call_end",
|
|
335
|
+
toolCall: { id: currentToolId, name: currentToolName, arguments: {} },
|
|
336
|
+
};
|
|
337
|
+
}
|
|
338
|
+
currentToolId = "";
|
|
339
|
+
currentToolName = "";
|
|
340
|
+
currentToolInput = "";
|
|
341
|
+
}
|
|
342
|
+
}
|
|
343
|
+
else if (event.type === "message_stop") {
|
|
344
|
+
yield { type: "done" };
|
|
345
|
+
}
|
|
346
|
+
}
|
|
347
|
+
}
|
|
348
|
+
convertMessages(messages) {
|
|
349
|
+
const result = [];
|
|
350
|
+
for (let i = 0; i < messages.length; i++) {
|
|
351
|
+
const msg = messages[i];
|
|
352
|
+
if (msg.role === "system")
|
|
353
|
+
continue;
|
|
354
|
+
if (msg.role === "tool" && msg.toolCallId) {
|
|
355
|
+
// Collect all consecutive tool messages into a single user message
|
|
356
|
+
const toolResults = [];
|
|
357
|
+
while (i < messages.length && messages[i].role === "tool" && messages[i].toolCallId) {
|
|
358
|
+
const toolMsg = messages[i];
|
|
359
|
+
toolResults.push({
|
|
360
|
+
type: "tool_result",
|
|
361
|
+
tool_use_id: toolMsg.toolCallId,
|
|
362
|
+
content: typeof toolMsg.content === "string"
|
|
363
|
+
? toolMsg.content
|
|
364
|
+
: JSON.stringify(toolMsg.content),
|
|
365
|
+
});
|
|
366
|
+
i++;
|
|
367
|
+
}
|
|
368
|
+
i--; // adjust for the outer loop increment
|
|
369
|
+
result.push({
|
|
370
|
+
role: "user",
|
|
371
|
+
content: toolResults,
|
|
372
|
+
});
|
|
373
|
+
}
|
|
374
|
+
else if (msg.role === "assistant" && msg.toolCalls?.length) {
|
|
375
|
+
const contentBlocks = [];
|
|
376
|
+
if (typeof msg.content === "string" && msg.content) {
|
|
377
|
+
contentBlocks.push({ type: "text", text: msg.content });
|
|
378
|
+
}
|
|
379
|
+
for (const tc of msg.toolCalls) {
|
|
380
|
+
contentBlocks.push({
|
|
381
|
+
type: "tool_use",
|
|
382
|
+
id: tc.id,
|
|
383
|
+
name: tc.name,
|
|
384
|
+
input: tc.arguments,
|
|
385
|
+
});
|
|
386
|
+
}
|
|
387
|
+
result.push({ role: "assistant", content: contentBlocks });
|
|
388
|
+
}
|
|
389
|
+
else if (msg.role === "user") {
|
|
390
|
+
const content = this.convertContent(msg.content);
|
|
391
|
+
result.push({ role: "user", content });
|
|
392
|
+
}
|
|
393
|
+
else if (msg.role === "assistant") {
|
|
394
|
+
result.push({
|
|
395
|
+
role: "assistant",
|
|
396
|
+
content: typeof msg.content === "string"
|
|
397
|
+
? msg.content
|
|
398
|
+
: msg.content.map((b) => ({
|
|
399
|
+
type: "text",
|
|
400
|
+
text: b.text || "",
|
|
401
|
+
})),
|
|
402
|
+
});
|
|
403
|
+
}
|
|
404
|
+
}
|
|
405
|
+
return result;
|
|
406
|
+
}
|
|
407
|
+
convertContent(content) {
|
|
408
|
+
if (typeof content === "string")
|
|
409
|
+
return content;
|
|
410
|
+
return content.map((block) => {
|
|
411
|
+
if (block.type === "image" && block.imageData) {
|
|
412
|
+
return {
|
|
413
|
+
type: "image",
|
|
414
|
+
source: {
|
|
415
|
+
type: "base64",
|
|
416
|
+
media_type: (block.mediaType || "image/png"),
|
|
417
|
+
data: block.imageData,
|
|
418
|
+
},
|
|
419
|
+
};
|
|
420
|
+
}
|
|
421
|
+
return { type: "text", text: block.text || "" };
|
|
422
|
+
});
|
|
423
|
+
}
|
|
424
|
+
convertTool(tool) {
|
|
425
|
+
return {
|
|
426
|
+
name: tool.name,
|
|
427
|
+
description: tool.description,
|
|
428
|
+
input_schema: tool.parameters,
|
|
429
|
+
};
|
|
430
|
+
}
|
|
431
|
+
}
|
|
432
|
+
// --- Debug wrapper ---
|
|
433
|
+
class DebugLlmClient {
|
|
434
|
+
inner;
|
|
435
|
+
logFile;
|
|
436
|
+
seq = 0;
|
|
437
|
+
constructor(inner, workspace) {
|
|
438
|
+
this.inner = inner;
|
|
439
|
+
const logDir = path.join(workspace, "logs");
|
|
440
|
+
fs.mkdirSync(logDir, { recursive: true });
|
|
441
|
+
this.logFile = path.join(logDir, "llm-debug.jsonl");
|
|
442
|
+
console.log(`🐛 LLM debug log: ${this.logFile}`);
|
|
443
|
+
}
|
|
444
|
+
async chat(messages, tools, systemPrompt) {
|
|
445
|
+
const id = ++this.seq;
|
|
446
|
+
this.write({
|
|
447
|
+
id,
|
|
448
|
+
type: "request",
|
|
449
|
+
ts: new Date().toISOString(),
|
|
450
|
+
systemPrompt,
|
|
451
|
+
messages,
|
|
452
|
+
tools,
|
|
453
|
+
});
|
|
454
|
+
const start = Date.now();
|
|
455
|
+
const response = await this.inner.chat(messages, tools, systemPrompt);
|
|
456
|
+
this.write({
|
|
457
|
+
id,
|
|
458
|
+
type: "response",
|
|
459
|
+
ts: new Date().toISOString(),
|
|
460
|
+
durationMs: Date.now() - start,
|
|
461
|
+
content: response.content,
|
|
462
|
+
toolCalls: response.toolCalls,
|
|
463
|
+
stopReason: response.stopReason,
|
|
464
|
+
usage: response.usage,
|
|
465
|
+
});
|
|
466
|
+
return response;
|
|
467
|
+
}
|
|
468
|
+
async *chatStream(messages, tools, systemPrompt) {
|
|
469
|
+
const id = ++this.seq;
|
|
470
|
+
this.write({
|
|
471
|
+
id,
|
|
472
|
+
type: "stream_request",
|
|
473
|
+
ts: new Date().toISOString(),
|
|
474
|
+
systemPrompt,
|
|
475
|
+
messages,
|
|
476
|
+
tools,
|
|
477
|
+
});
|
|
478
|
+
const start = Date.now();
|
|
479
|
+
let fullText = "";
|
|
480
|
+
const toolCalls = [];
|
|
481
|
+
for await (const event of this.inner.chatStream(messages, tools, systemPrompt)) {
|
|
482
|
+
if (event.type === "text_delta" && event.text) {
|
|
483
|
+
fullText += event.text;
|
|
484
|
+
}
|
|
485
|
+
else if (event.type === "tool_call_end" && event.toolCall) {
|
|
486
|
+
toolCalls.push(event.toolCall);
|
|
487
|
+
}
|
|
488
|
+
yield event;
|
|
489
|
+
}
|
|
490
|
+
this.write({
|
|
491
|
+
id,
|
|
492
|
+
type: "stream_response",
|
|
493
|
+
ts: new Date().toISOString(),
|
|
494
|
+
durationMs: Date.now() - start,
|
|
495
|
+
content: fullText,
|
|
496
|
+
toolCalls,
|
|
497
|
+
});
|
|
498
|
+
}
|
|
499
|
+
write(entry) {
|
|
500
|
+
fs.appendFileSync(this.logFile, JSON.stringify(entry) + "\n", "utf-8");
|
|
501
|
+
}
|
|
502
|
+
}
|
|
503
|
+
//# sourceMappingURL=client.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.js","sourceRoot":"","sources":["../../src/llm/client.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,QAAQ,CAAC;AAC5B,OAAO,S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AAC,SAAS,CAAC,KAAK,CAAC,GAAG,IAAI,EAAE,OAAO,CAAC,CAAC;IACzE,CAAC;CACF"}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
export const browserTool = {
|
|
2
|
+
name: "browser",
|
|
3
|
+
description: `Control the web browser. Actions:
|
|
4
|
+
- navigate: go to a URL (url)
|
|
5
|
+
- snapshot: get page accessibility tree with element refs [e1],[e2]...
|
|
6
|
+
- click: click element (ref)
|
|
7
|
+
- type: type into element (ref, text, clear?)
|
|
8
|
+
- scroll: scroll page (direction: up/down, amount?, ref?)
|
|
9
|
+
- screenshot: capture page image (fullPage?)
|
|
10
|
+
- evaluate: run JavaScript (script)
|
|
11
|
+
- wait: wait for condition (selector?, text?, timeout?)
|
|
12
|
+
- press: press key (key)
|
|
13
|
+
- select: select dropdown option (ref, value)
|
|
14
|
+
- tabs: list open tabs
|
|
15
|
+
- close_tab: close tab (index)
|
|
16
|
+
- focus_tab: switch to tab (index)`,
|
|
17
|
+
parameters: {
|
|
18
|
+
type: "object",
|
|
19
|
+
properties: {
|
|
20
|
+
action: {
|
|
21
|
+
type: "string",
|
|
22
|
+
enum: [
|
|
23
|
+
"navigate", "snapshot", "click", "type", "scroll",
|
|
24
|
+
"screenshot", "evaluate", "wait", "press", "select",
|
|
25
|
+
"tabs", "close_tab", "focus_tab",
|
|
26
|
+
],
|
|
27
|
+
description: "The browser action to perform",
|
|
28
|
+
},
|
|
29
|
+
url: { type: "string", description: "URL for navigate" },
|
|
30
|
+
ref: { type: "string", description: "Element reference from snapshot (e.g., 'e1')" },
|
|
31
|
+
text: { type: "string", description: "Text for type action" },
|
|
32
|
+
clear: { type: "boolean", description: "Clear field before typing (default: true)" },
|
|
33
|
+
direction: { type: "string", enum: ["up", "down"], description: "Scroll direction" },
|
|
34
|
+
amount: { type: "number", description: "Scroll pixels (default: 500)" },
|
|
35
|
+
fullPage: { type: "boolean", description: "Full page screenshot" },
|
|
36
|
+
script: { type: "string", description: "JavaScript for evaluate" },
|
|
37
|
+
selector: { type: "string", description: "CSS selector for wait" },
|
|
38
|
+
key: { type: "string", description: "Key for press (e.g., 'Enter')" },
|
|
39
|
+
value: { type: "string", description: "Value for select" },
|
|
40
|
+
index: { type: "number", description: "Tab index for close_tab/focus_tab" },
|
|
41
|
+
timeout: { type: "number", description: "Timeout in ms for wait (default: 10000)" },
|
|
42
|
+
},
|
|
43
|
+
required: ["action"],
|
|
44
|
+
},
|
|
45
|
+
};
|
|
46
|
+
export const memoryTool = {
|
|
47
|
+
name: "memory",
|
|
48
|
+
description: `Manage persistent memory. Actions:
|
|
49
|
+
- save: store a memory (key, title, content)
|
|
50
|
+
- read: read a memory (key)
|
|
51
|
+
- list: list all memories`,
|
|
52
|
+
parameters: {
|
|
53
|
+
type: "object",
|
|
54
|
+
properties: {
|
|
55
|
+
action: {
|
|
56
|
+
type: "string",
|
|
57
|
+
enum: ["save", "read", "list"],
|
|
58
|
+
description: "Memory action",
|
|
59
|
+
},
|
|
60
|
+
key: { type: "string", description: "Memory key (e.g., 'site-github', 'user-prefs')" },
|
|
61
|
+
title: { type: "string", description: "Short title for index (<100 chars)" },
|
|
62
|
+
content: { type: "string", description: "Memory content in markdown" },
|
|
63
|
+
},
|
|
64
|
+
required: ["action"],
|
|
65
|
+
},
|
|
66
|
+
};
|
|
67
|
+
export const schedulerTool = {
|
|
68
|
+
name: "scheduler",
|
|
69
|
+
description: `Manage scheduled tasks. Actions:
|
|
70
|
+
- list: list all tasks
|
|
71
|
+
- add: create task (name, cron, prompt)
|
|
72
|
+
- remove: delete task (id)
|
|
73
|
+
- toggle: enable/disable task (id, enabled)`,
|
|
74
|
+
parameters: {
|
|
75
|
+
type: "object",
|
|
76
|
+
properties: {
|
|
77
|
+
action: {
|
|
78
|
+
type: "string",
|
|
79
|
+
enum: ["list", "add", "remove", "toggle"],
|
|
80
|
+
description: "Scheduler action",
|
|
81
|
+
},
|
|
82
|
+
id: { type: "string", description: "Task ID" },
|
|
83
|
+
name: { type: "string", description: "Task name" },
|
|
84
|
+
cron: { type: "string", description: "Cron expression (e.g., '0 9 * * *')" },
|
|
85
|
+
prompt: { type: "string", description: "Task prompt" },
|
|
86
|
+
enabled: { type: "boolean", description: "Enable or disable" },
|
|
87
|
+
},
|
|
88
|
+
required: ["action"],
|
|
89
|
+
},
|
|
90
|
+
};
|
|
91
|
+
export function getAllTools() {
|
|
92
|
+
return [browserTool, memoryTool, schedulerTool];
|
|
93
|
+
}
|
|
94
|
+
//# sourceMappingURL=tools.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tools.js","sourceRoot":"","sources":["../../src/llm/tools.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,WAAW,GAAmB;IACzC,IAAI,EAAE,SAAS;IACf,WAAW,EAAE;;;;;;;;;;;;;mCAaoB;IACjC,UAAU,EAAE;QACV,IAAI,EAAE,QAAQ;QACd,UAAU,EAAE;YACV,MAAM,EAAE;gBACN,IAAI,EAAE,QAAQ;gBACd,IAAI,EAAE;oBACJ,UAAU,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ;oBACjD,YAAY,EAAE,UAAU,EAAE,MAAM,EAAE,OAAO,EAAE,QAAQ;oBACnD,MAAM,EAAE,WAAW,EAAE,WAAW;iBACjC;gBACD,WAAW,EAAE,+BAA+B;aAC7C;YACD,GAAG,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,kBAAkB,EAAE;YACxD,GAAG,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,8CAA8C,EAAE;YACpF,IAAI,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,sBAAsB,EAAE;YAC7D,KAAK,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,WAAW,EAAE,2CAA2C,EAAE;YACpF,SAAS,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,IAAI,EAAE,MAAM,CAAC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