sparkecoder 0.1.3

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.
@@ -0,0 +1,402 @@
1
+ import * as ai from 'ai';
2
+ import { ToolSet } from 'ai';
3
+
4
+ interface BashToolOptions {
5
+ workingDirectory: string;
6
+ onOutput?: (output: string) => void;
7
+ }
8
+ declare function createBashTool(options: BashToolOptions): ai.Tool<{
9
+ command: string;
10
+ }, {
11
+ success: boolean;
12
+ stdout: string;
13
+ stderr: string;
14
+ exitCode: number;
15
+ error?: undefined;
16
+ } | {
17
+ success: boolean;
18
+ error: any;
19
+ stdout: string;
20
+ stderr: string;
21
+ exitCode: any;
22
+ }>;
23
+
24
+ interface ReadFileToolOptions {
25
+ workingDirectory: string;
26
+ }
27
+ declare function createReadFileTool(options: ReadFileToolOptions): ai.Tool<{
28
+ path: string;
29
+ startLine?: number | undefined;
30
+ endLine?: number | undefined;
31
+ }, {
32
+ success: boolean;
33
+ path: string;
34
+ relativePath: string;
35
+ content: string;
36
+ lineCount: number;
37
+ wasTruncated: boolean;
38
+ sizeBytes: number;
39
+ error?: undefined;
40
+ } | {
41
+ success: boolean;
42
+ error: any;
43
+ content: null;
44
+ path?: undefined;
45
+ relativePath?: undefined;
46
+ lineCount?: undefined;
47
+ wasTruncated?: undefined;
48
+ sizeBytes?: undefined;
49
+ }>;
50
+
51
+ interface WriteFileToolOptions {
52
+ workingDirectory: string;
53
+ }
54
+ declare function createWriteFileTool(options: WriteFileToolOptions): ai.Tool<{
55
+ mode: "full" | "str_replace";
56
+ path: string;
57
+ content?: string | undefined;
58
+ old_string?: string | undefined;
59
+ new_string?: string | undefined;
60
+ }, {
61
+ success: boolean;
62
+ path: string;
63
+ relativePath: string;
64
+ mode: string;
65
+ action: string;
66
+ bytesWritten: number;
67
+ lineCount: number;
68
+ error?: undefined;
69
+ hint?: undefined;
70
+ filePreview?: undefined;
71
+ linesRemoved?: undefined;
72
+ linesAdded?: undefined;
73
+ lineDelta?: undefined;
74
+ } | {
75
+ success: boolean;
76
+ error: string;
77
+ hint: string;
78
+ filePreview: string;
79
+ path?: undefined;
80
+ relativePath?: undefined;
81
+ mode?: undefined;
82
+ action?: undefined;
83
+ bytesWritten?: undefined;
84
+ lineCount?: undefined;
85
+ linesRemoved?: undefined;
86
+ linesAdded?: undefined;
87
+ lineDelta?: undefined;
88
+ } | {
89
+ success: boolean;
90
+ error: string;
91
+ hint: string;
92
+ path?: undefined;
93
+ relativePath?: undefined;
94
+ mode?: undefined;
95
+ action?: undefined;
96
+ bytesWritten?: undefined;
97
+ lineCount?: undefined;
98
+ filePreview?: undefined;
99
+ linesRemoved?: undefined;
100
+ linesAdded?: undefined;
101
+ lineDelta?: undefined;
102
+ } | {
103
+ success: boolean;
104
+ path: string;
105
+ relativePath: string;
106
+ mode: string;
107
+ linesRemoved: number;
108
+ linesAdded: number;
109
+ lineDelta: number;
110
+ action?: undefined;
111
+ bytesWritten?: undefined;
112
+ lineCount?: undefined;
113
+ error?: undefined;
114
+ hint?: undefined;
115
+ filePreview?: undefined;
116
+ } | {
117
+ success: boolean;
118
+ error: any;
119
+ path?: undefined;
120
+ relativePath?: undefined;
121
+ mode?: undefined;
122
+ action?: undefined;
123
+ bytesWritten?: undefined;
124
+ lineCount?: undefined;
125
+ hint?: undefined;
126
+ filePreview?: undefined;
127
+ linesRemoved?: undefined;
128
+ linesAdded?: undefined;
129
+ lineDelta?: undefined;
130
+ }>;
131
+
132
+ interface TodoToolOptions {
133
+ sessionId: string;
134
+ }
135
+ declare function createTodoTool(options: TodoToolOptions): ai.Tool<{
136
+ action: "add" | "list" | "mark" | "clear";
137
+ status?: "completed" | "pending" | "in_progress" | "cancelled" | undefined;
138
+ items?: {
139
+ content: string;
140
+ order?: number | undefined;
141
+ }[] | undefined;
142
+ todoId?: string | undefined;
143
+ }, {
144
+ success: boolean;
145
+ action: string;
146
+ itemsAdded: number;
147
+ items: {
148
+ id: string;
149
+ content: string;
150
+ status: "completed" | "pending" | "in_progress" | "cancelled";
151
+ order: number;
152
+ createdAt: string;
153
+ }[];
154
+ stats?: undefined;
155
+ item?: undefined;
156
+ itemsRemoved?: undefined;
157
+ error?: undefined;
158
+ } | {
159
+ success: boolean;
160
+ action: string;
161
+ stats: {
162
+ total: number;
163
+ pending: number;
164
+ inProgress: number;
165
+ completed: number;
166
+ cancelled: number;
167
+ };
168
+ items: {
169
+ id: string;
170
+ content: string;
171
+ status: "completed" | "pending" | "in_progress" | "cancelled";
172
+ order: number;
173
+ createdAt: string;
174
+ }[];
175
+ itemsAdded?: undefined;
176
+ item?: undefined;
177
+ itemsRemoved?: undefined;
178
+ error?: undefined;
179
+ } | {
180
+ success: boolean;
181
+ action: string;
182
+ item: {
183
+ id: string;
184
+ content: string;
185
+ status: "completed" | "pending" | "in_progress" | "cancelled";
186
+ order: number;
187
+ createdAt: string;
188
+ };
189
+ itemsAdded?: undefined;
190
+ items?: undefined;
191
+ stats?: undefined;
192
+ itemsRemoved?: undefined;
193
+ error?: undefined;
194
+ } | {
195
+ success: boolean;
196
+ action: string;
197
+ itemsRemoved: number;
198
+ itemsAdded?: undefined;
199
+ items?: undefined;
200
+ stats?: undefined;
201
+ item?: undefined;
202
+ error?: undefined;
203
+ } | {
204
+ success: boolean;
205
+ error: any;
206
+ action?: undefined;
207
+ itemsAdded?: undefined;
208
+ items?: undefined;
209
+ stats?: undefined;
210
+ item?: undefined;
211
+ itemsRemoved?: undefined;
212
+ }>;
213
+
214
+ interface LoadSkillToolOptions {
215
+ sessionId: string;
216
+ skillsDirectories: string[];
217
+ }
218
+ declare function createLoadSkillTool(options: LoadSkillToolOptions): ai.Tool<{
219
+ action: "list" | "load";
220
+ skillName?: string | undefined;
221
+ }, {
222
+ success: boolean;
223
+ action: string;
224
+ skillCount: number;
225
+ skills: {
226
+ name: string;
227
+ description: string;
228
+ }[];
229
+ formatted: string;
230
+ error?: undefined;
231
+ availableSkills?: undefined;
232
+ skillName?: undefined;
233
+ description?: undefined;
234
+ content?: undefined;
235
+ contentLength?: undefined;
236
+ } | {
237
+ success: boolean;
238
+ error: string;
239
+ availableSkills: string[];
240
+ action?: undefined;
241
+ skillCount?: undefined;
242
+ skills?: undefined;
243
+ formatted?: undefined;
244
+ skillName?: undefined;
245
+ description?: undefined;
246
+ content?: undefined;
247
+ contentLength?: undefined;
248
+ } | {
249
+ success: boolean;
250
+ action: string;
251
+ skillName: string;
252
+ description: string;
253
+ content: string;
254
+ contentLength: number;
255
+ skillCount?: undefined;
256
+ skills?: undefined;
257
+ formatted?: undefined;
258
+ error?: undefined;
259
+ availableSkills?: undefined;
260
+ } | {
261
+ success: boolean;
262
+ error: any;
263
+ action?: undefined;
264
+ skillCount?: undefined;
265
+ skills?: undefined;
266
+ formatted?: undefined;
267
+ availableSkills?: undefined;
268
+ skillName?: undefined;
269
+ description?: undefined;
270
+ content?: undefined;
271
+ contentLength?: undefined;
272
+ }>;
273
+
274
+ interface TerminalToolOptions {
275
+ sessionId: string;
276
+ workingDirectory: string;
277
+ }
278
+ /**
279
+ * Create the terminal tool for managing background processes
280
+ */
281
+ declare function createTerminalTool(options: TerminalToolOptions): ai.Tool<{
282
+ action: "status" | "list" | "spawn" | "logs" | "kill" | "write";
283
+ name?: string | undefined;
284
+ input?: string | undefined;
285
+ command?: string | undefined;
286
+ cwd?: string | undefined;
287
+ terminalId?: string | undefined;
288
+ tail?: number | undefined;
289
+ signal?: "SIGKILL" | "SIGTERM" | undefined;
290
+ }, {
291
+ success: boolean;
292
+ error: string;
293
+ terminal?: undefined;
294
+ message?: undefined;
295
+ terminalId?: undefined;
296
+ logs?: undefined;
297
+ lineCount?: undefined;
298
+ terminals?: undefined;
299
+ count?: undefined;
300
+ running?: undefined;
301
+ } | {
302
+ success: boolean;
303
+ terminal: {
304
+ id: string;
305
+ name: string | null;
306
+ command: string;
307
+ cwd: string;
308
+ pid: number | null;
309
+ status: "error" | "running" | "stopped";
310
+ exitCode: number | null;
311
+ error: string | null;
312
+ createdAt: string;
313
+ stoppedAt: string | null;
314
+ };
315
+ message: string;
316
+ error?: undefined;
317
+ terminalId?: undefined;
318
+ logs?: undefined;
319
+ lineCount?: undefined;
320
+ terminals?: undefined;
321
+ count?: undefined;
322
+ running?: undefined;
323
+ } | {
324
+ success: boolean;
325
+ terminalId: string;
326
+ logs: string;
327
+ lineCount: number;
328
+ error?: undefined;
329
+ terminal?: undefined;
330
+ message?: undefined;
331
+ terminals?: undefined;
332
+ count?: undefined;
333
+ running?: undefined;
334
+ } | {
335
+ success: boolean;
336
+ terminal: {
337
+ id: string;
338
+ name: string | null;
339
+ command: string;
340
+ cwd: string;
341
+ pid: number | null;
342
+ status: "error" | "running" | "stopped";
343
+ exitCode: number | null;
344
+ error: string | null;
345
+ createdAt: string;
346
+ stoppedAt: string | null;
347
+ };
348
+ error?: undefined;
349
+ message?: undefined;
350
+ terminalId?: undefined;
351
+ logs?: undefined;
352
+ lineCount?: undefined;
353
+ terminals?: undefined;
354
+ count?: undefined;
355
+ running?: undefined;
356
+ } | {
357
+ success: boolean;
358
+ message: string;
359
+ error?: undefined;
360
+ terminal?: undefined;
361
+ terminalId?: undefined;
362
+ logs?: undefined;
363
+ lineCount?: undefined;
364
+ terminals?: undefined;
365
+ count?: undefined;
366
+ running?: undefined;
367
+ } | {
368
+ success: boolean;
369
+ terminals: {
370
+ id: string;
371
+ name: string | null;
372
+ command: string;
373
+ cwd: string;
374
+ pid: number | null;
375
+ status: "error" | "running" | "stopped";
376
+ exitCode: number | null;
377
+ error: string | null;
378
+ createdAt: string;
379
+ stoppedAt: string | null;
380
+ }[];
381
+ count: number;
382
+ running: number;
383
+ error?: undefined;
384
+ terminal?: undefined;
385
+ message?: undefined;
386
+ terminalId?: undefined;
387
+ logs?: undefined;
388
+ lineCount?: undefined;
389
+ }>;
390
+
391
+ interface CreateToolsOptions {
392
+ sessionId: string;
393
+ workingDirectory: string;
394
+ skillsDirectories: string[];
395
+ onBashOutput?: (output: string) => void;
396
+ }
397
+ /**
398
+ * Create all tools for an agent session
399
+ */
400
+ declare function createTools(options: CreateToolsOptions): ToolSet;
401
+
402
+ export { type BashToolOptions, type CreateToolsOptions, type LoadSkillToolOptions, type ReadFileToolOptions, type TerminalToolOptions, type TodoToolOptions, type WriteFileToolOptions, createBashTool, createLoadSkillTool, createReadFileTool, createTerminalTool, createTodoTool, createTools, createWriteFileTool };