@tdsoft-tech/aikit 0.1.2
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/CHANGELOG.md +35 -0
- package/dist/cli.d.ts +2 -0
- package/dist/cli.js +4901 -0
- package/dist/cli.js.map +1 -0
- package/dist/index.d.ts +1000 -0
- package/dist/index.js +4038 -0
- package/dist/index.js.map +1 -0
- package/dist/mcp-server.d.ts +2 -0
- package/dist/mcp-server.js +3496 -0
- package/dist/mcp-server.js.map +1 -0
- package/package.json +62 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,1000 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* AIKit Configuration Schema
|
|
5
|
+
*/
|
|
6
|
+
declare const ConfigSchema: z.ZodObject<{
|
|
7
|
+
version: z.ZodString;
|
|
8
|
+
skills: z.ZodDefault<z.ZodObject<{
|
|
9
|
+
enabled: z.ZodDefault<z.ZodBoolean>;
|
|
10
|
+
directory: z.ZodOptional<z.ZodString>;
|
|
11
|
+
}, "strip", z.ZodTypeAny, {
|
|
12
|
+
enabled: boolean;
|
|
13
|
+
directory?: string | undefined;
|
|
14
|
+
}, {
|
|
15
|
+
enabled?: boolean | undefined;
|
|
16
|
+
directory?: string | undefined;
|
|
17
|
+
}>>;
|
|
18
|
+
agents: z.ZodDefault<z.ZodObject<{
|
|
19
|
+
enabled: z.ZodDefault<z.ZodBoolean>;
|
|
20
|
+
default: z.ZodDefault<z.ZodString>;
|
|
21
|
+
}, "strip", z.ZodTypeAny, {
|
|
22
|
+
default: string;
|
|
23
|
+
enabled: boolean;
|
|
24
|
+
}, {
|
|
25
|
+
default?: string | undefined;
|
|
26
|
+
enabled?: boolean | undefined;
|
|
27
|
+
}>>;
|
|
28
|
+
commands: z.ZodDefault<z.ZodObject<{
|
|
29
|
+
enabled: z.ZodDefault<z.ZodBoolean>;
|
|
30
|
+
}, "strip", z.ZodTypeAny, {
|
|
31
|
+
enabled: boolean;
|
|
32
|
+
}, {
|
|
33
|
+
enabled?: boolean | undefined;
|
|
34
|
+
}>>;
|
|
35
|
+
tools: z.ZodDefault<z.ZodObject<{
|
|
36
|
+
enabled: z.ZodDefault<z.ZodBoolean>;
|
|
37
|
+
}, "strip", z.ZodTypeAny, {
|
|
38
|
+
enabled: boolean;
|
|
39
|
+
}, {
|
|
40
|
+
enabled?: boolean | undefined;
|
|
41
|
+
}>>;
|
|
42
|
+
plugins: z.ZodDefault<z.ZodObject<{
|
|
43
|
+
enabled: z.ZodDefault<z.ZodBoolean>;
|
|
44
|
+
autoload: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
45
|
+
}, "strip", z.ZodTypeAny, {
|
|
46
|
+
enabled: boolean;
|
|
47
|
+
autoload?: string[] | undefined;
|
|
48
|
+
}, {
|
|
49
|
+
enabled?: boolean | undefined;
|
|
50
|
+
autoload?: string[] | undefined;
|
|
51
|
+
}>>;
|
|
52
|
+
memory: z.ZodDefault<z.ZodObject<{
|
|
53
|
+
enabled: z.ZodDefault<z.ZodBoolean>;
|
|
54
|
+
maxSize: z.ZodOptional<z.ZodNumber>;
|
|
55
|
+
}, "strip", z.ZodTypeAny, {
|
|
56
|
+
enabled: boolean;
|
|
57
|
+
maxSize?: number | undefined;
|
|
58
|
+
}, {
|
|
59
|
+
enabled?: boolean | undefined;
|
|
60
|
+
maxSize?: number | undefined;
|
|
61
|
+
}>>;
|
|
62
|
+
beads: z.ZodDefault<z.ZodObject<{
|
|
63
|
+
enabled: z.ZodDefault<z.ZodBoolean>;
|
|
64
|
+
autoInit: z.ZodDefault<z.ZodBoolean>;
|
|
65
|
+
}, "strip", z.ZodTypeAny, {
|
|
66
|
+
enabled: boolean;
|
|
67
|
+
autoInit: boolean;
|
|
68
|
+
}, {
|
|
69
|
+
enabled?: boolean | undefined;
|
|
70
|
+
autoInit?: boolean | undefined;
|
|
71
|
+
}>>;
|
|
72
|
+
antiHallucination: z.ZodDefault<z.ZodObject<{
|
|
73
|
+
enabled: z.ZodDefault<z.ZodBoolean>;
|
|
74
|
+
specFile: z.ZodDefault<z.ZodString>;
|
|
75
|
+
reviewFile: z.ZodDefault<z.ZodString>;
|
|
76
|
+
}, "strip", z.ZodTypeAny, {
|
|
77
|
+
enabled: boolean;
|
|
78
|
+
specFile: string;
|
|
79
|
+
reviewFile: string;
|
|
80
|
+
}, {
|
|
81
|
+
enabled?: boolean | undefined;
|
|
82
|
+
specFile?: string | undefined;
|
|
83
|
+
reviewFile?: string | undefined;
|
|
84
|
+
}>>;
|
|
85
|
+
mcp: z.ZodOptional<z.ZodObject<{
|
|
86
|
+
context7: z.ZodDefault<z.ZodBoolean>;
|
|
87
|
+
githubGrep: z.ZodDefault<z.ZodBoolean>;
|
|
88
|
+
gkg: z.ZodDefault<z.ZodBoolean>;
|
|
89
|
+
}, "strip", z.ZodTypeAny, {
|
|
90
|
+
context7: boolean;
|
|
91
|
+
githubGrep: boolean;
|
|
92
|
+
gkg: boolean;
|
|
93
|
+
}, {
|
|
94
|
+
context7?: boolean | undefined;
|
|
95
|
+
githubGrep?: boolean | undefined;
|
|
96
|
+
gkg?: boolean | undefined;
|
|
97
|
+
}>>;
|
|
98
|
+
}, "strip", z.ZodTypeAny, {
|
|
99
|
+
skills: {
|
|
100
|
+
enabled: boolean;
|
|
101
|
+
directory?: string | undefined;
|
|
102
|
+
};
|
|
103
|
+
agents: {
|
|
104
|
+
default: string;
|
|
105
|
+
enabled: boolean;
|
|
106
|
+
};
|
|
107
|
+
commands: {
|
|
108
|
+
enabled: boolean;
|
|
109
|
+
};
|
|
110
|
+
tools: {
|
|
111
|
+
enabled: boolean;
|
|
112
|
+
};
|
|
113
|
+
plugins: {
|
|
114
|
+
enabled: boolean;
|
|
115
|
+
autoload?: string[] | undefined;
|
|
116
|
+
};
|
|
117
|
+
memory: {
|
|
118
|
+
enabled: boolean;
|
|
119
|
+
maxSize?: number | undefined;
|
|
120
|
+
};
|
|
121
|
+
beads: {
|
|
122
|
+
enabled: boolean;
|
|
123
|
+
autoInit: boolean;
|
|
124
|
+
};
|
|
125
|
+
version: string;
|
|
126
|
+
antiHallucination: {
|
|
127
|
+
enabled: boolean;
|
|
128
|
+
specFile: string;
|
|
129
|
+
reviewFile: string;
|
|
130
|
+
};
|
|
131
|
+
mcp?: {
|
|
132
|
+
context7: boolean;
|
|
133
|
+
githubGrep: boolean;
|
|
134
|
+
gkg: boolean;
|
|
135
|
+
} | undefined;
|
|
136
|
+
}, {
|
|
137
|
+
version: string;
|
|
138
|
+
skills?: {
|
|
139
|
+
enabled?: boolean | undefined;
|
|
140
|
+
directory?: string | undefined;
|
|
141
|
+
} | undefined;
|
|
142
|
+
agents?: {
|
|
143
|
+
default?: string | undefined;
|
|
144
|
+
enabled?: boolean | undefined;
|
|
145
|
+
} | undefined;
|
|
146
|
+
commands?: {
|
|
147
|
+
enabled?: boolean | undefined;
|
|
148
|
+
} | undefined;
|
|
149
|
+
tools?: {
|
|
150
|
+
enabled?: boolean | undefined;
|
|
151
|
+
} | undefined;
|
|
152
|
+
plugins?: {
|
|
153
|
+
enabled?: boolean | undefined;
|
|
154
|
+
autoload?: string[] | undefined;
|
|
155
|
+
} | undefined;
|
|
156
|
+
memory?: {
|
|
157
|
+
enabled?: boolean | undefined;
|
|
158
|
+
maxSize?: number | undefined;
|
|
159
|
+
} | undefined;
|
|
160
|
+
beads?: {
|
|
161
|
+
enabled?: boolean | undefined;
|
|
162
|
+
autoInit?: boolean | undefined;
|
|
163
|
+
} | undefined;
|
|
164
|
+
antiHallucination?: {
|
|
165
|
+
enabled?: boolean | undefined;
|
|
166
|
+
specFile?: string | undefined;
|
|
167
|
+
reviewFile?: string | undefined;
|
|
168
|
+
} | undefined;
|
|
169
|
+
mcp?: {
|
|
170
|
+
context7?: boolean | undefined;
|
|
171
|
+
githubGrep?: boolean | undefined;
|
|
172
|
+
gkg?: boolean | undefined;
|
|
173
|
+
} | undefined;
|
|
174
|
+
}>;
|
|
175
|
+
type AIKitConfig = z.infer<typeof ConfigSchema> & {
|
|
176
|
+
configPath: string;
|
|
177
|
+
projectPath: string;
|
|
178
|
+
};
|
|
179
|
+
/**
|
|
180
|
+
* Configuration manager for AIKit
|
|
181
|
+
*/
|
|
182
|
+
declare class Config {
|
|
183
|
+
private config;
|
|
184
|
+
constructor(config: AIKitConfig);
|
|
185
|
+
get(): AIKitConfig;
|
|
186
|
+
get skills(): {
|
|
187
|
+
enabled: boolean;
|
|
188
|
+
directory?: string | undefined;
|
|
189
|
+
};
|
|
190
|
+
get agents(): {
|
|
191
|
+
default: string;
|
|
192
|
+
enabled: boolean;
|
|
193
|
+
};
|
|
194
|
+
get commands(): {
|
|
195
|
+
enabled: boolean;
|
|
196
|
+
};
|
|
197
|
+
get tools(): {
|
|
198
|
+
enabled: boolean;
|
|
199
|
+
};
|
|
200
|
+
get plugins(): {
|
|
201
|
+
enabled: boolean;
|
|
202
|
+
autoload?: string[] | undefined;
|
|
203
|
+
};
|
|
204
|
+
get memory(): {
|
|
205
|
+
enabled: boolean;
|
|
206
|
+
maxSize?: number | undefined;
|
|
207
|
+
};
|
|
208
|
+
get beads(): {
|
|
209
|
+
enabled: boolean;
|
|
210
|
+
autoInit: boolean;
|
|
211
|
+
};
|
|
212
|
+
get antiHallucination(): {
|
|
213
|
+
enabled: boolean;
|
|
214
|
+
specFile: string;
|
|
215
|
+
reviewFile: string;
|
|
216
|
+
};
|
|
217
|
+
get configPath(): string;
|
|
218
|
+
get projectPath(): string;
|
|
219
|
+
/**
|
|
220
|
+
* Get path to a specific resource
|
|
221
|
+
*/
|
|
222
|
+
getPath(resource: 'skills' | 'agents' | 'commands' | 'tools' | 'plugins' | 'memory'): string;
|
|
223
|
+
}
|
|
224
|
+
/**
|
|
225
|
+
* Load AIKit configuration
|
|
226
|
+
* Merges project-level config with global config (project takes precedence)
|
|
227
|
+
*/
|
|
228
|
+
declare function loadConfig(projectPath?: string): Promise<Config>;
|
|
229
|
+
|
|
230
|
+
/**
|
|
231
|
+
* Skill definition
|
|
232
|
+
*/
|
|
233
|
+
interface Skill {
|
|
234
|
+
name: string;
|
|
235
|
+
description: string;
|
|
236
|
+
useWhen: string;
|
|
237
|
+
category: string;
|
|
238
|
+
tags: string[];
|
|
239
|
+
content: string;
|
|
240
|
+
filePath: string;
|
|
241
|
+
}
|
|
242
|
+
/**
|
|
243
|
+
* Skill Engine - Manages workflow skills for AI agents
|
|
244
|
+
*
|
|
245
|
+
* Skills are mandatory workflow instructions that agents must follow.
|
|
246
|
+
* They enforce structured processes like TDD, systematic debugging, etc.
|
|
247
|
+
*/
|
|
248
|
+
declare class SkillEngine {
|
|
249
|
+
private config;
|
|
250
|
+
private skillsCache;
|
|
251
|
+
constructor(config: Config);
|
|
252
|
+
/**
|
|
253
|
+
* List all available skills
|
|
254
|
+
*/
|
|
255
|
+
listSkills(): Promise<Skill[]>;
|
|
256
|
+
/**
|
|
257
|
+
* Get a specific skill by name
|
|
258
|
+
*/
|
|
259
|
+
getSkill(name: string): Promise<Skill | null>;
|
|
260
|
+
/**
|
|
261
|
+
* Find skills matching a query
|
|
262
|
+
*/
|
|
263
|
+
findSkills(query?: string): Promise<Skill[]>;
|
|
264
|
+
/**
|
|
265
|
+
* Create a new skill
|
|
266
|
+
*/
|
|
267
|
+
createSkill(name: string, options?: {
|
|
268
|
+
description?: string;
|
|
269
|
+
useWhen?: string;
|
|
270
|
+
category?: string;
|
|
271
|
+
tags?: string[];
|
|
272
|
+
content?: string;
|
|
273
|
+
global?: boolean;
|
|
274
|
+
}): Promise<Skill>;
|
|
275
|
+
/**
|
|
276
|
+
* Sync global skills to project directory
|
|
277
|
+
*/
|
|
278
|
+
syncSkillsToProject(): Promise<{
|
|
279
|
+
count: number;
|
|
280
|
+
synced: string[];
|
|
281
|
+
}>;
|
|
282
|
+
/**
|
|
283
|
+
* Format skill for agent consumption
|
|
284
|
+
*/
|
|
285
|
+
formatForAgent(skill: Skill): string;
|
|
286
|
+
/**
|
|
287
|
+
* Load skills from a directory
|
|
288
|
+
*/
|
|
289
|
+
private loadSkillsFromDir;
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
/**
|
|
293
|
+
* Agent types available in AIKit
|
|
294
|
+
*/
|
|
295
|
+
type AgentType = 'planner' | 'build' | 'rush' | 'review' | 'scout' | 'explore' | 'vision';
|
|
296
|
+
/**
|
|
297
|
+
* Agent definition
|
|
298
|
+
*/
|
|
299
|
+
interface Agent {
|
|
300
|
+
name: AgentType;
|
|
301
|
+
displayName: string;
|
|
302
|
+
description: string;
|
|
303
|
+
useWhen: string;
|
|
304
|
+
capabilities: string[];
|
|
305
|
+
systemPrompt: string;
|
|
306
|
+
delegatesTo: AgentType[];
|
|
307
|
+
}
|
|
308
|
+
/**
|
|
309
|
+
* Agent delegation result
|
|
310
|
+
*/
|
|
311
|
+
interface DelegationDecision {
|
|
312
|
+
agent: Agent;
|
|
313
|
+
reason: string;
|
|
314
|
+
shouldDelegate: boolean;
|
|
315
|
+
subTasks?: string[];
|
|
316
|
+
}
|
|
317
|
+
/**
|
|
318
|
+
* Agent Manager - Handles agent selection and delegation
|
|
319
|
+
*/
|
|
320
|
+
declare class AgentManager {
|
|
321
|
+
private config;
|
|
322
|
+
private agents;
|
|
323
|
+
constructor(config: Config);
|
|
324
|
+
/**
|
|
325
|
+
* List all available agents
|
|
326
|
+
*/
|
|
327
|
+
listAgents(): Agent[];
|
|
328
|
+
/**
|
|
329
|
+
* Get a specific agent
|
|
330
|
+
*/
|
|
331
|
+
getAgent(name: AgentType): Agent | undefined;
|
|
332
|
+
/**
|
|
333
|
+
* Get the default agent
|
|
334
|
+
*/
|
|
335
|
+
getDefaultAgent(): Agent;
|
|
336
|
+
/**
|
|
337
|
+
* Decide which agent should handle a task
|
|
338
|
+
*/
|
|
339
|
+
decideAgent(task: string, _context?: string): DelegationDecision;
|
|
340
|
+
/**
|
|
341
|
+
* Format agent instructions for prompt
|
|
342
|
+
*/
|
|
343
|
+
formatAgentPrompt(agent: Agent): string;
|
|
344
|
+
private matchesKeywords;
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
/**
|
|
348
|
+
* Command definition
|
|
349
|
+
*/
|
|
350
|
+
interface Command {
|
|
351
|
+
name: string;
|
|
352
|
+
description: string;
|
|
353
|
+
category: string;
|
|
354
|
+
usage: string;
|
|
355
|
+
examples: string[];
|
|
356
|
+
content: string;
|
|
357
|
+
filePath: string;
|
|
358
|
+
}
|
|
359
|
+
/**
|
|
360
|
+
* Command Runner - Manages and executes slash commands
|
|
361
|
+
*/
|
|
362
|
+
declare class CommandRunner {
|
|
363
|
+
private config;
|
|
364
|
+
private commandsCache;
|
|
365
|
+
constructor(config: Config);
|
|
366
|
+
/**
|
|
367
|
+
* List all available commands
|
|
368
|
+
*/
|
|
369
|
+
listCommands(): Promise<Command[]>;
|
|
370
|
+
/**
|
|
371
|
+
* Get a specific command
|
|
372
|
+
*/
|
|
373
|
+
getCommand(name: string): Promise<Command | null>;
|
|
374
|
+
/**
|
|
375
|
+
* Create a custom command
|
|
376
|
+
*/
|
|
377
|
+
createCommand(name: string, options?: {
|
|
378
|
+
description?: string;
|
|
379
|
+
category?: string;
|
|
380
|
+
usage?: string;
|
|
381
|
+
examples?: string[];
|
|
382
|
+
content?: string;
|
|
383
|
+
global?: boolean;
|
|
384
|
+
}): Promise<Command>;
|
|
385
|
+
/**
|
|
386
|
+
* Format command for agent consumption
|
|
387
|
+
*/
|
|
388
|
+
formatForAgent(command: Command): string;
|
|
389
|
+
/**
|
|
390
|
+
* Load commands from directory (recursively)
|
|
391
|
+
*/
|
|
392
|
+
private loadCommandsFromDir;
|
|
393
|
+
}
|
|
394
|
+
|
|
395
|
+
/**
|
|
396
|
+
* Tool configuration status
|
|
397
|
+
*/
|
|
398
|
+
type ToolStatus = 'ready' | 'needs_config' | 'error';
|
|
399
|
+
/**
|
|
400
|
+
* Tool configuration schema
|
|
401
|
+
*/
|
|
402
|
+
declare const ToolConfigSchema: z.ZodObject<{
|
|
403
|
+
name: z.ZodString;
|
|
404
|
+
status: z.ZodEnum<["ready", "needs_config", "error"]>;
|
|
405
|
+
description: z.ZodString;
|
|
406
|
+
configMethod: z.ZodEnum<["oauth", "manual", "none"]>;
|
|
407
|
+
config: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
408
|
+
errorMessage: z.ZodOptional<z.ZodString>;
|
|
409
|
+
}, "strip", z.ZodTypeAny, {
|
|
410
|
+
status: "ready" | "needs_config" | "error";
|
|
411
|
+
name: string;
|
|
412
|
+
description: string;
|
|
413
|
+
configMethod: "oauth" | "manual" | "none";
|
|
414
|
+
config?: Record<string, unknown> | undefined;
|
|
415
|
+
errorMessage?: string | undefined;
|
|
416
|
+
}, {
|
|
417
|
+
status: "ready" | "needs_config" | "error";
|
|
418
|
+
name: string;
|
|
419
|
+
description: string;
|
|
420
|
+
configMethod: "oauth" | "manual" | "none";
|
|
421
|
+
config?: Record<string, unknown> | undefined;
|
|
422
|
+
errorMessage?: string | undefined;
|
|
423
|
+
}>;
|
|
424
|
+
type ToolConfig = z.infer<typeof ToolConfigSchema>;
|
|
425
|
+
/**
|
|
426
|
+
* Tool Configuration Manager
|
|
427
|
+
*/
|
|
428
|
+
declare class ToolConfigManager {
|
|
429
|
+
private config;
|
|
430
|
+
private toolsConfigPath;
|
|
431
|
+
constructor(config: Config);
|
|
432
|
+
/**
|
|
433
|
+
* Get all registered tools with their current status
|
|
434
|
+
*/
|
|
435
|
+
listTools(): Promise<ToolConfig[]>;
|
|
436
|
+
/**
|
|
437
|
+
* Get configuration for a specific tool
|
|
438
|
+
*/
|
|
439
|
+
getToolConfig(toolName: string): Promise<ToolConfig | null>;
|
|
440
|
+
/**
|
|
441
|
+
* Update tool configuration
|
|
442
|
+
*/
|
|
443
|
+
updateToolConfig(toolName: string, updates: {
|
|
444
|
+
config?: Record<string, unknown>;
|
|
445
|
+
status?: ToolStatus;
|
|
446
|
+
errorMessage?: string;
|
|
447
|
+
}): Promise<void>;
|
|
448
|
+
/**
|
|
449
|
+
* Check if a tool is ready to use
|
|
450
|
+
*/
|
|
451
|
+
isToolReady(toolName: string): Promise<boolean>;
|
|
452
|
+
/**
|
|
453
|
+
* Get API key for a tool (if configured)
|
|
454
|
+
*/
|
|
455
|
+
getApiKey(toolName: string): Promise<string | null>;
|
|
456
|
+
/**
|
|
457
|
+
* Determine tool status based on configuration
|
|
458
|
+
*/
|
|
459
|
+
private determineStatus;
|
|
460
|
+
/**
|
|
461
|
+
* Load saved configurations
|
|
462
|
+
*/
|
|
463
|
+
private loadConfigs;
|
|
464
|
+
/**
|
|
465
|
+
* Save configurations
|
|
466
|
+
*/
|
|
467
|
+
private saveConfigs;
|
|
468
|
+
}
|
|
469
|
+
|
|
470
|
+
/**
|
|
471
|
+
* Tool argument schema
|
|
472
|
+
*/
|
|
473
|
+
declare const ToolArgSchema: z.ZodObject<{
|
|
474
|
+
type: z.ZodEnum<["string", "number", "boolean", "array", "object"]>;
|
|
475
|
+
description: z.ZodString;
|
|
476
|
+
required: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
477
|
+
default: z.ZodOptional<z.ZodAny>;
|
|
478
|
+
}, "strip", z.ZodTypeAny, {
|
|
479
|
+
type: "string" | "number" | "boolean" | "object" | "array";
|
|
480
|
+
description: string;
|
|
481
|
+
required: boolean;
|
|
482
|
+
default?: any;
|
|
483
|
+
}, {
|
|
484
|
+
type: "string" | "number" | "boolean" | "object" | "array";
|
|
485
|
+
description: string;
|
|
486
|
+
default?: any;
|
|
487
|
+
required?: boolean | undefined;
|
|
488
|
+
}>;
|
|
489
|
+
type ToolArg = z.infer<typeof ToolArgSchema>;
|
|
490
|
+
/**
|
|
491
|
+
* Tool definition
|
|
492
|
+
*/
|
|
493
|
+
interface Tool {
|
|
494
|
+
name: string;
|
|
495
|
+
description: string;
|
|
496
|
+
args: Record<string, ToolArg>;
|
|
497
|
+
execute: (args: Record<string, unknown>) => Promise<string>;
|
|
498
|
+
filePath?: string;
|
|
499
|
+
}
|
|
500
|
+
/**
|
|
501
|
+
* Tool definition helper for type safety
|
|
502
|
+
*/
|
|
503
|
+
declare function defineTool(config: {
|
|
504
|
+
name: string;
|
|
505
|
+
description: string;
|
|
506
|
+
args: Record<string, ToolArg>;
|
|
507
|
+
execute: (args: Record<string, unknown>) => Promise<string>;
|
|
508
|
+
}): Tool;
|
|
509
|
+
/**
|
|
510
|
+
* Tool Registry - Manages custom tools for AI agents
|
|
511
|
+
*/
|
|
512
|
+
declare class ToolRegistry {
|
|
513
|
+
private config;
|
|
514
|
+
private tools;
|
|
515
|
+
private toolConfigManager?;
|
|
516
|
+
constructor(config: Config);
|
|
517
|
+
/**
|
|
518
|
+
* Set tool config manager (for tools that need configuration)
|
|
519
|
+
*/
|
|
520
|
+
setToolConfigManager(manager: ToolConfigManager): void;
|
|
521
|
+
/**
|
|
522
|
+
* List all available tools
|
|
523
|
+
*/
|
|
524
|
+
listTools(): Promise<Tool[]>;
|
|
525
|
+
/**
|
|
526
|
+
* Get a specific tool
|
|
527
|
+
*/
|
|
528
|
+
getTool(name: string): Tool | undefined;
|
|
529
|
+
/**
|
|
530
|
+
* Register a new tool
|
|
531
|
+
*/
|
|
532
|
+
registerTool(tool: Tool): void;
|
|
533
|
+
/**
|
|
534
|
+
* Execute a tool
|
|
535
|
+
*/
|
|
536
|
+
executeTool(name: string, args: Record<string, unknown>, context?: {
|
|
537
|
+
toolConfigManager?: ToolConfigManager;
|
|
538
|
+
}): Promise<string>;
|
|
539
|
+
/**
|
|
540
|
+
* Create a custom tool
|
|
541
|
+
*/
|
|
542
|
+
createTool(name: string, options: {
|
|
543
|
+
description: string;
|
|
544
|
+
args: Record<string, ToolArg>;
|
|
545
|
+
code: string;
|
|
546
|
+
global?: boolean;
|
|
547
|
+
}): Promise<void>;
|
|
548
|
+
/**
|
|
549
|
+
* Format tool for agent consumption
|
|
550
|
+
*/
|
|
551
|
+
formatForAgent(tool: Tool): string;
|
|
552
|
+
/**
|
|
553
|
+
* Load custom tools from disk
|
|
554
|
+
*/
|
|
555
|
+
private loadCustomTools;
|
|
556
|
+
private loadToolsFromDir;
|
|
557
|
+
}
|
|
558
|
+
|
|
559
|
+
/**
|
|
560
|
+
* Plugin event types
|
|
561
|
+
*/
|
|
562
|
+
type PluginEventType = 'session.idle' | 'session.created' | 'session.error' | 'tool.execute.before' | 'tool.execute.after' | 'file.edited' | 'file.watcher.updated' | 'message.updated' | 'message.removed';
|
|
563
|
+
/**
|
|
564
|
+
* Plugin event payload
|
|
565
|
+
*/
|
|
566
|
+
interface PluginEvent {
|
|
567
|
+
type: PluginEventType;
|
|
568
|
+
timestamp: Date;
|
|
569
|
+
properties?: Record<string, unknown>;
|
|
570
|
+
}
|
|
571
|
+
/**
|
|
572
|
+
* Plugin context passed to plugins
|
|
573
|
+
*/
|
|
574
|
+
interface PluginContext {
|
|
575
|
+
project: {
|
|
576
|
+
path: string;
|
|
577
|
+
name: string;
|
|
578
|
+
};
|
|
579
|
+
config: Config;
|
|
580
|
+
emit: (event: PluginEvent) => Promise<void>;
|
|
581
|
+
}
|
|
582
|
+
/**
|
|
583
|
+
* Plugin handler return type
|
|
584
|
+
*/
|
|
585
|
+
interface PluginHandlers {
|
|
586
|
+
event?: (event: PluginEvent) => Promise<void>;
|
|
587
|
+
'tool.execute.before'?: (input: unknown) => Promise<unknown>;
|
|
588
|
+
'tool.execute.after'?: (input: unknown, output: unknown) => Promise<unknown>;
|
|
589
|
+
}
|
|
590
|
+
/**
|
|
591
|
+
* Plugin definition function type
|
|
592
|
+
*/
|
|
593
|
+
type PluginFactory = (context: PluginContext) => Promise<PluginHandlers>;
|
|
594
|
+
/**
|
|
595
|
+
* Plugin metadata
|
|
596
|
+
*/
|
|
597
|
+
interface PluginInfo {
|
|
598
|
+
name: string;
|
|
599
|
+
description: string;
|
|
600
|
+
enabled: boolean;
|
|
601
|
+
filePath: string;
|
|
602
|
+
handlers?: PluginHandlers;
|
|
603
|
+
}
|
|
604
|
+
/**
|
|
605
|
+
* Plugin definition helper
|
|
606
|
+
*/
|
|
607
|
+
type Plugin = PluginFactory;
|
|
608
|
+
/**
|
|
609
|
+
* Plugin System - Manages event-driven plugins
|
|
610
|
+
*/
|
|
611
|
+
declare class PluginSystem {
|
|
612
|
+
private config;
|
|
613
|
+
private plugins;
|
|
614
|
+
private loadedPlugins;
|
|
615
|
+
private eventQueue;
|
|
616
|
+
private processing;
|
|
617
|
+
constructor(config: Config);
|
|
618
|
+
/**
|
|
619
|
+
* Initialize and load all plugins
|
|
620
|
+
*/
|
|
621
|
+
initialize(): Promise<void>;
|
|
622
|
+
/**
|
|
623
|
+
* List all available plugins
|
|
624
|
+
*/
|
|
625
|
+
listPlugins(): Promise<PluginInfo[]>;
|
|
626
|
+
/**
|
|
627
|
+
* Enable a plugin
|
|
628
|
+
*/
|
|
629
|
+
enablePlugin(name: string): Promise<void>;
|
|
630
|
+
/**
|
|
631
|
+
* Disable a plugin
|
|
632
|
+
*/
|
|
633
|
+
disablePlugin(name: string): void;
|
|
634
|
+
/**
|
|
635
|
+
* Emit an event to all plugins
|
|
636
|
+
*/
|
|
637
|
+
emit(event: PluginEvent): Promise<void>;
|
|
638
|
+
/**
|
|
639
|
+
* Execute before hooks for tool execution
|
|
640
|
+
*/
|
|
641
|
+
executeBeforeHooks(_toolName: string, input: unknown): Promise<unknown>;
|
|
642
|
+
/**
|
|
643
|
+
* Execute after hooks for tool execution
|
|
644
|
+
*/
|
|
645
|
+
executeAfterHooks(_toolName: string, input: unknown, output: unknown): Promise<unknown>;
|
|
646
|
+
/**
|
|
647
|
+
* Create a new plugin
|
|
648
|
+
*/
|
|
649
|
+
createPlugin(name: string, options: {
|
|
650
|
+
description?: string;
|
|
651
|
+
code: string;
|
|
652
|
+
global?: boolean;
|
|
653
|
+
}): Promise<void>;
|
|
654
|
+
/**
|
|
655
|
+
* Process event queue
|
|
656
|
+
*/
|
|
657
|
+
private processEventQueue;
|
|
658
|
+
/**
|
|
659
|
+
* Load plugins from disk
|
|
660
|
+
*/
|
|
661
|
+
private loadPlugins;
|
|
662
|
+
private registerBuiltInPlugins;
|
|
663
|
+
private loadPluginsFromDir;
|
|
664
|
+
private initializePlugin;
|
|
665
|
+
private getBuiltInPluginHandlers;
|
|
666
|
+
}
|
|
667
|
+
|
|
668
|
+
/**
|
|
669
|
+
* Memory entry structure
|
|
670
|
+
*/
|
|
671
|
+
interface Memory {
|
|
672
|
+
key: string;
|
|
673
|
+
content: string;
|
|
674
|
+
summary: string;
|
|
675
|
+
createdAt: Date;
|
|
676
|
+
updatedAt: Date;
|
|
677
|
+
type: 'observation' | 'handoff' | 'research' | 'template' | 'custom';
|
|
678
|
+
}
|
|
679
|
+
/**
|
|
680
|
+
* Memory Manager - Persistent context across sessions
|
|
681
|
+
*/
|
|
682
|
+
declare class MemoryManager {
|
|
683
|
+
private config;
|
|
684
|
+
constructor(config: Config);
|
|
685
|
+
/**
|
|
686
|
+
* List all memory entries
|
|
687
|
+
*/
|
|
688
|
+
list(): Promise<Memory[]>;
|
|
689
|
+
/**
|
|
690
|
+
* Read a memory entry
|
|
691
|
+
*/
|
|
692
|
+
read(key: string): Promise<string | null>;
|
|
693
|
+
/**
|
|
694
|
+
* Update a memory entry
|
|
695
|
+
*/
|
|
696
|
+
update(key: string, content: string, options?: {
|
|
697
|
+
append?: boolean;
|
|
698
|
+
type?: Memory['type'];
|
|
699
|
+
}): Promise<void>;
|
|
700
|
+
/**
|
|
701
|
+
* Create a handoff bundle
|
|
702
|
+
*/
|
|
703
|
+
createHandoff(summary: {
|
|
704
|
+
completed: string[];
|
|
705
|
+
inProgress: string[];
|
|
706
|
+
remaining: string[];
|
|
707
|
+
context: string;
|
|
708
|
+
nextSteps: string[];
|
|
709
|
+
}): Promise<string>;
|
|
710
|
+
/**
|
|
711
|
+
* Get the latest handoff
|
|
712
|
+
*/
|
|
713
|
+
getLatestHandoff(): Promise<Memory | null>;
|
|
714
|
+
/**
|
|
715
|
+
* Create an observation
|
|
716
|
+
*/
|
|
717
|
+
createObservation(title: string, observation: {
|
|
718
|
+
what: string;
|
|
719
|
+
why: string;
|
|
720
|
+
impact: string;
|
|
721
|
+
tags?: string[];
|
|
722
|
+
}): Promise<string>;
|
|
723
|
+
/**
|
|
724
|
+
* Save research findings
|
|
725
|
+
*/
|
|
726
|
+
saveResearch(topic: string, findings: {
|
|
727
|
+
summary: string;
|
|
728
|
+
sources: string[];
|
|
729
|
+
recommendations: string[];
|
|
730
|
+
codeExamples?: string;
|
|
731
|
+
}): Promise<string>;
|
|
732
|
+
/**
|
|
733
|
+
* Extract a summary from content (first paragraph or heading)
|
|
734
|
+
*/
|
|
735
|
+
private extractSummary;
|
|
736
|
+
}
|
|
737
|
+
|
|
738
|
+
/**
|
|
739
|
+
* Bead task structure
|
|
740
|
+
*/
|
|
741
|
+
interface Bead {
|
|
742
|
+
id: string;
|
|
743
|
+
title: string;
|
|
744
|
+
description: string;
|
|
745
|
+
status: 'todo' | 'in-progress' | 'completed' | 'blocked';
|
|
746
|
+
createdAt: Date;
|
|
747
|
+
updatedAt: Date;
|
|
748
|
+
notes: string[];
|
|
749
|
+
subtasks?: string[];
|
|
750
|
+
}
|
|
751
|
+
/**
|
|
752
|
+
* Beads integration status
|
|
753
|
+
*/
|
|
754
|
+
interface BeadsStatus {
|
|
755
|
+
installed: boolean;
|
|
756
|
+
version?: string;
|
|
757
|
+
initialized: boolean;
|
|
758
|
+
activeTasks: number;
|
|
759
|
+
completedTasks: number;
|
|
760
|
+
currentTask?: string;
|
|
761
|
+
}
|
|
762
|
+
/**
|
|
763
|
+
* Beads Integration - Task tracking with hard quality gates
|
|
764
|
+
*/
|
|
765
|
+
declare class BeadsIntegration {
|
|
766
|
+
private projectPath;
|
|
767
|
+
constructor(projectPath?: string);
|
|
768
|
+
/**
|
|
769
|
+
* Check if Beads CLI is installed
|
|
770
|
+
*/
|
|
771
|
+
isInstalled(): Promise<boolean>;
|
|
772
|
+
/**
|
|
773
|
+
* Get Beads version
|
|
774
|
+
*/
|
|
775
|
+
getVersion(): Promise<string | null>;
|
|
776
|
+
/**
|
|
777
|
+
* Check if Beads is initialized in project
|
|
778
|
+
*/
|
|
779
|
+
isInitialized(): Promise<boolean>;
|
|
780
|
+
/**
|
|
781
|
+
* Initialize Beads in project
|
|
782
|
+
*/
|
|
783
|
+
init(): Promise<boolean>;
|
|
784
|
+
/**
|
|
785
|
+
* Get current status
|
|
786
|
+
*/
|
|
787
|
+
getStatus(): Promise<BeadsStatus>;
|
|
788
|
+
/**
|
|
789
|
+
* List all beads in the project
|
|
790
|
+
*/
|
|
791
|
+
listBeads(): Promise<Bead[]>;
|
|
792
|
+
/**
|
|
793
|
+
* Get a specific bead
|
|
794
|
+
*/
|
|
795
|
+
getBead(id: string): Promise<Bead | null>;
|
|
796
|
+
/**
|
|
797
|
+
* Create a new bead
|
|
798
|
+
*/
|
|
799
|
+
createBead(title: string, description: string): Promise<Bead>;
|
|
800
|
+
/**
|
|
801
|
+
* Update bead status
|
|
802
|
+
*/
|
|
803
|
+
updateBeadStatus(id: string, status: Bead['status']): Promise<boolean>;
|
|
804
|
+
/**
|
|
805
|
+
* Add note to bead
|
|
806
|
+
*/
|
|
807
|
+
addNote(id: string, note: string): Promise<boolean>;
|
|
808
|
+
/**
|
|
809
|
+
* Complete a bead with quality gates
|
|
810
|
+
*/
|
|
811
|
+
completeBead(id: string): Promise<{
|
|
812
|
+
success: boolean;
|
|
813
|
+
gates: {
|
|
814
|
+
name: string;
|
|
815
|
+
passed: boolean;
|
|
816
|
+
error?: string;
|
|
817
|
+
}[];
|
|
818
|
+
}>;
|
|
819
|
+
/**
|
|
820
|
+
* Get current active bead
|
|
821
|
+
*/
|
|
822
|
+
getCurrentBead(): Promise<Bead | null>;
|
|
823
|
+
/**
|
|
824
|
+
* Parse a bead file
|
|
825
|
+
*/
|
|
826
|
+
private parseBeadFile;
|
|
827
|
+
}
|
|
828
|
+
|
|
829
|
+
/**
|
|
830
|
+
* Spec violation
|
|
831
|
+
*/
|
|
832
|
+
interface SpecViolation {
|
|
833
|
+
rule: string;
|
|
834
|
+
description: string;
|
|
835
|
+
severity: 'error' | 'warning';
|
|
836
|
+
location?: string;
|
|
837
|
+
}
|
|
838
|
+
/**
|
|
839
|
+
* Anti-Hallucination System
|
|
840
|
+
*
|
|
841
|
+
* Prevents AI from inventing APIs, assuming features, and losing track of requirements.
|
|
842
|
+
* Implements three validation layers:
|
|
843
|
+
* 1. Task Validation (.beads/ tracking)
|
|
844
|
+
* 2. Spec Enforcement (spec.md constraints)
|
|
845
|
+
* 3. Review Gates (review.md documentation)
|
|
846
|
+
*/
|
|
847
|
+
declare class AntiHallucination {
|
|
848
|
+
private config;
|
|
849
|
+
constructor(config: Config);
|
|
850
|
+
/**
|
|
851
|
+
* Layer 1: Validate task exists before work begins
|
|
852
|
+
*/
|
|
853
|
+
validateTask(taskId?: string): Promise<{
|
|
854
|
+
valid: boolean;
|
|
855
|
+
task?: {
|
|
856
|
+
id: string;
|
|
857
|
+
description: string;
|
|
858
|
+
status: string;
|
|
859
|
+
};
|
|
860
|
+
error?: string;
|
|
861
|
+
}>;
|
|
862
|
+
/**
|
|
863
|
+
* Layer 2: Check spec constraints
|
|
864
|
+
*/
|
|
865
|
+
checkSpec(): Promise<{
|
|
866
|
+
hasSpec: boolean;
|
|
867
|
+
constraints?: {
|
|
868
|
+
naming: string[];
|
|
869
|
+
forbidden: string[];
|
|
870
|
+
required: string[];
|
|
871
|
+
};
|
|
872
|
+
}>;
|
|
873
|
+
/**
|
|
874
|
+
* Validate code against spec constraints
|
|
875
|
+
*/
|
|
876
|
+
validateAgainstSpec(code: string, filePath: string): Promise<SpecViolation[]>;
|
|
877
|
+
/**
|
|
878
|
+
* Layer 3: Create review documentation
|
|
879
|
+
*/
|
|
880
|
+
createReview(changes: {
|
|
881
|
+
filesChanged: string[];
|
|
882
|
+
functionsAdded: string[];
|
|
883
|
+
testsAdded: string[];
|
|
884
|
+
skipped?: string[];
|
|
885
|
+
inconsistencies?: string[];
|
|
886
|
+
}): Promise<string>;
|
|
887
|
+
/**
|
|
888
|
+
* Verify completion (hard gates)
|
|
889
|
+
*/
|
|
890
|
+
verifyCompletion(): Promise<{
|
|
891
|
+
passed: boolean;
|
|
892
|
+
gates: {
|
|
893
|
+
name: string;
|
|
894
|
+
passed: boolean;
|
|
895
|
+
error?: string;
|
|
896
|
+
}[];
|
|
897
|
+
}>;
|
|
898
|
+
/**
|
|
899
|
+
* Recovery: Check for context loss
|
|
900
|
+
*/
|
|
901
|
+
checkContextLoss(): Promise<{
|
|
902
|
+
hasHandoff: boolean;
|
|
903
|
+
latestHandoff?: string;
|
|
904
|
+
}>;
|
|
905
|
+
/**
|
|
906
|
+
* Initialize spec.md template
|
|
907
|
+
*/
|
|
908
|
+
initSpec(): Promise<void>;
|
|
909
|
+
/**
|
|
910
|
+
* Extract constraints from a section
|
|
911
|
+
*/
|
|
912
|
+
private extractConstraints;
|
|
913
|
+
/**
|
|
914
|
+
* Convert a constraint description to a regex pattern
|
|
915
|
+
*/
|
|
916
|
+
private patternToRegex;
|
|
917
|
+
}
|
|
918
|
+
|
|
919
|
+
/**
|
|
920
|
+
* Simple logger with colored output
|
|
921
|
+
*/
|
|
922
|
+
declare const logger: {
|
|
923
|
+
info(...args: unknown[]): void;
|
|
924
|
+
success(...args: unknown[]): void;
|
|
925
|
+
warn(...args: unknown[]): void;
|
|
926
|
+
error(...args: unknown[]): void;
|
|
927
|
+
debug(...args: unknown[]): void;
|
|
928
|
+
step(step: number, total: number, message: string): void;
|
|
929
|
+
header(message: string): void;
|
|
930
|
+
list(items: string[], prefix?: string): void;
|
|
931
|
+
};
|
|
932
|
+
|
|
933
|
+
/**
|
|
934
|
+
* Path utilities for AIKit configuration and data directories
|
|
935
|
+
*/
|
|
936
|
+
declare const paths: {
|
|
937
|
+
/**
|
|
938
|
+
* Get the global AIKit configuration directory
|
|
939
|
+
* ~/.config/aikit/ on Unix, %APPDATA%/aikit/ on Windows
|
|
940
|
+
*/
|
|
941
|
+
globalConfig(): string;
|
|
942
|
+
/**
|
|
943
|
+
* Get the project-level AIKit configuration directory
|
|
944
|
+
*/
|
|
945
|
+
projectConfig(projectPath?: string): string;
|
|
946
|
+
/**
|
|
947
|
+
* Get the OpenCode configuration directory
|
|
948
|
+
*/
|
|
949
|
+
opencodeConfig(): string;
|
|
950
|
+
/**
|
|
951
|
+
* Get the Beads directory for the current project
|
|
952
|
+
*/
|
|
953
|
+
beadsDir(projectPath?: string): string;
|
|
954
|
+
/**
|
|
955
|
+
* Check if a project has AIKit initialized
|
|
956
|
+
*/
|
|
957
|
+
hasProjectConfig(projectPath?: string): boolean;
|
|
958
|
+
/**
|
|
959
|
+
* Check if global AIKit is initialized
|
|
960
|
+
*/
|
|
961
|
+
hasGlobalConfig(): boolean;
|
|
962
|
+
/**
|
|
963
|
+
* Get effective config path (project takes precedence over global)
|
|
964
|
+
*/
|
|
965
|
+
effectiveConfig(projectPath?: string): string | null;
|
|
966
|
+
/**
|
|
967
|
+
* Get skills directory
|
|
968
|
+
*/
|
|
969
|
+
skills(configPath: string): string;
|
|
970
|
+
/**
|
|
971
|
+
* Get agents directory
|
|
972
|
+
*/
|
|
973
|
+
agents(configPath: string): string;
|
|
974
|
+
/**
|
|
975
|
+
* Get commands directory
|
|
976
|
+
*/
|
|
977
|
+
commands(configPath: string): string;
|
|
978
|
+
/**
|
|
979
|
+
* Get tools directory
|
|
980
|
+
*/
|
|
981
|
+
tools(configPath: string): string;
|
|
982
|
+
/**
|
|
983
|
+
* Get plugins directory
|
|
984
|
+
*/
|
|
985
|
+
plugins(configPath: string): string;
|
|
986
|
+
/**
|
|
987
|
+
* Get memory directory
|
|
988
|
+
*/
|
|
989
|
+
memory(configPath: string): string;
|
|
990
|
+
};
|
|
991
|
+
|
|
992
|
+
/**
|
|
993
|
+
* AIKit - Open-source AI coding agent toolkit for OpenCode
|
|
994
|
+
*
|
|
995
|
+
* Provides skills, agents, commands, tools, and plugins for enhanced AI-assisted development.
|
|
996
|
+
*/
|
|
997
|
+
|
|
998
|
+
declare const VERSION = "0.1.0";
|
|
999
|
+
|
|
1000
|
+
export { type AIKitConfig, type Agent, AgentManager, type AgentType, AntiHallucination, BeadsIntegration, type Command, CommandRunner, Config, type Memory, MemoryManager, type Plugin, type PluginEvent, PluginSystem, type Skill, SkillEngine, type Tool, ToolRegistry, VERSION, defineTool, loadConfig, logger, paths };
|