@polka-codes/core 0.9.18 → 0.9.19

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,1861 @@
1
+ import type { FilePart } from 'ai';
2
+ import type { ImagePart } from 'ai';
3
+ import type { LanguageModelV2 } from '@ai-sdk/provider';
4
+ import type { LanguageModelV2Usage } from '@ai-sdk/provider';
5
+ import type { ModelMessage } from '@ai-sdk/provider-utils';
6
+ import type { ModelMessage as ModelMessage_2 } from 'ai';
7
+ import type { TextPart } from 'ai';
8
+ import type { ToolModelMessage } from '@ai-sdk/provider-utils';
9
+ import type { UserContent } from '@ai-sdk/provider-utils';
10
+ import type { UserContent as UserContent_2 } from 'ai';
11
+ import type { UserModelMessage } from '@ai-sdk/provider-utils';
12
+ import { z } from 'zod';
13
+
14
+ declare abstract class AgentBase {
15
+ #private;
16
+ readonly ai: LanguageModelV2;
17
+ protected readonly config: Readonly<AgentBaseConfig>;
18
+ protected readonly handlers: Record<string, FullToolInfoV2>;
19
+ constructor(name: string, ai: LanguageModelV2, config: AgentBaseConfig);
20
+ abort(): void;
21
+ get parameters(): Readonly<Record<string, any>>;
22
+ get messages(): Readonly<ModelMessage[]>;
23
+ setMessages(messages: Readonly<ModelMessage[]>): void;
24
+ start(prompt: UserContent): Promise<ExitReason>;
25
+ step(prompt: UserContent): Promise<AssistantMessageContent[]>;
26
+ handleStepResponse(response: AssistantMessageContent[]): Promise<{
27
+ type: "reply";
28
+ message: UserModelMessage | ToolModelMessage;
29
+ } | {
30
+ type: "exit";
31
+ reason: ExitReason;
32
+ }>;
33
+ continueTask(userMessage: UserContent): Promise<ExitReason>;
34
+ protected abstract onBeforeInvokeTool(name: string, args: Record<string, string>): Promise<ToolResponse | undefined>;
35
+ get model(): string;
36
+ get usage(): {
37
+ messageCount: number;
38
+ input: number;
39
+ output: number;
40
+ cachedRead: number;
41
+ cost: number;
42
+ };
43
+ }
44
+ export { AgentBase }
45
+ export { AgentBase as AgentBase_alias_1 }
46
+ export { AgentBase as AgentBase_alias_2 }
47
+
48
+ declare type AgentBaseConfig = {
49
+ systemPrompt: string;
50
+ tools: FullToolInfoV2[];
51
+ toolNamePrefix: string;
52
+ provider: ToolProvider;
53
+ interactive: boolean;
54
+ agents?: Readonly<AgentInfo[]>;
55
+ scripts?: Record<string, string | {
56
+ command: string;
57
+ description: string;
58
+ }>;
59
+ callback?: TaskEventCallback;
60
+ policies: AgentPolicy[];
61
+ retryCount?: number;
62
+ requestTimeoutSeconds?: number;
63
+ toolFormat: ToolFormat;
64
+ parameters: Record<string, any>;
65
+ usageMeter: UsageMeter;
66
+ };
67
+ export { AgentBaseConfig }
68
+ export { AgentBaseConfig as AgentBaseConfig_alias_1 }
69
+ export { AgentBaseConfig as AgentBaseConfig_alias_2 }
70
+
71
+ declare type AgentInfo = {
72
+ name: string;
73
+ responsibilities: string[];
74
+ };
75
+ export { AgentInfo }
76
+ export { AgentInfo as AgentInfo_alias_1 }
77
+ export { AgentInfo as AgentInfo_alias_2 }
78
+
79
+ declare type AgentNameType = (typeof allAgents)[number]['name'];
80
+ export { AgentNameType }
81
+ export { AgentNameType as AgentNameType_alias_1 }
82
+
83
+ declare type AgentPolicy = (tools: Record<string, FullToolInfoV2>, parameters: Record<string, any>) => AgentPolicyInstance | undefined;
84
+ export { AgentPolicy }
85
+ export { AgentPolicy as AgentPolicy_alias_1 }
86
+ export { AgentPolicy as AgentPolicy_alias_2 }
87
+
88
+ declare type AgentPolicyInstance = {
89
+ name: string;
90
+ tools?: FullToolInfoV2[];
91
+ prompt?: string;
92
+ onBeforeInvokeTool?: (name: string, args: Record<string, string>) => Promise<ToolResponse | undefined>;
93
+ onBeforeRequest?: (agent: AgentBase) => Promise<void>;
94
+ prepareMessages?: (agent: AgentBase, messages: ModelMessage_2[]) => Promise<ModelMessage_2[]>;
95
+ };
96
+ export { AgentPolicyInstance }
97
+ export { AgentPolicyInstance as AgentPolicyInstance_alias_1 }
98
+ export { AgentPolicyInstance as AgentPolicyInstance_alias_2 }
99
+
100
+ declare const agentsPrompt: (agents: Readonly<AgentInfo[]>, name: string) => string;
101
+ export { agentsPrompt }
102
+ export { agentsPrompt as agentsPrompt_alias_1 }
103
+ export { agentsPrompt as agentsPrompt_alias_2 }
104
+
105
+ declare type AiToolDefinition<Input, Output = string> = {
106
+ name: string;
107
+ description: string;
108
+ prompt: string;
109
+ formatInput: (params: Input) => string;
110
+ parseOutput: (output: string) => Output;
111
+ };
112
+ export { AiToolDefinition }
113
+ export { AiToolDefinition as AiToolDefinition_alias_1 }
114
+ export { AiToolDefinition as AiToolDefinition_alias_2 }
115
+
116
+ export declare type AiToolDefinitionWithAgent<Input, Output = string> = AiToolDefinition<Input, Output> & {
117
+ agent: (options: SharedAgentOptions) => AgentBase;
118
+ };
119
+
120
+ export declare type AiToolDefinitionWithMultiAgent<Input, Output = string> = AiToolDefinition<Input, Output> & {
121
+ agent: AgentNameType;
122
+ };
123
+
124
+ declare const allAgents: readonly [{
125
+ readonly name: "architect";
126
+ readonly responsibilities: ["Analyzing the user’s overall task and requirements.", "Creating plans and making higher-level decisions about system structure and design.", "Reviewing and analyzing existing code or components for maintainability and scalability.", "Laying out the roadmap for implementation."];
127
+ }, {
128
+ readonly name: "coder";
129
+ readonly responsibilities: ["Editing and refactoring existing code.", "Creating new features or modules.", "Running tests and analyzing test results.", "Maintaining coding standards, lint rules, and general code quality."];
130
+ }, {
131
+ readonly name: "analyzer";
132
+ readonly responsibilities: ["Analyzing project structure and organization", "Identifying key source code files and their relationships", "Understanding common coding patterns and conventions", "Examining development workflow and tooling", "Analyzing dependencies and their usage patterns"];
133
+ }, {
134
+ readonly name: "codefixer";
135
+ readonly responsibilities: ["Fixing type errors and type-related issues", "Resolving failing tests", "Addressing code quality issues", "Tracking and reporting unfixed issues"];
136
+ }];
137
+ export { allAgents }
138
+ export { allAgents as allAgents_alias_1 }
139
+
140
+ export declare namespace allTools {
141
+ export {
142
+ _default as askFollowupQuestion,
143
+ _default_2 as attemptCompletion,
144
+ _default_3 as delegate,
145
+ _default_4 as executeCommand,
146
+ _default_5 as fetchUrl,
147
+ _default_6 as handOver,
148
+ _default_7 as listFiles,
149
+ _default_8 as readFile,
150
+ _default_9 as removeFile,
151
+ _default_10 as renameFile,
152
+ _default_11 as replaceInFile,
153
+ _default_12 as searchFiles,
154
+ _default_13 as writeToFile
155
+ }
156
+ }
157
+
158
+ declare class AnalyzerAgent extends AgentBase {
159
+ constructor(options: AnalyzerAgentOptions);
160
+ onBeforeInvokeTool(): Promise<undefined>;
161
+ }
162
+ export { AnalyzerAgent }
163
+ export { AnalyzerAgent as AnalyzerAgent_alias_1 }
164
+ export { AnalyzerAgent as AnalyzerAgent_alias_2 }
165
+
166
+ declare const analyzerAgentInfo: {
167
+ readonly name: "analyzer";
168
+ readonly responsibilities: ["Analyzing project structure and organization", "Identifying key source code files and their relationships", "Understanding common coding patterns and conventions", "Examining development workflow and tooling", "Analyzing dependencies and their usage patterns"];
169
+ };
170
+ export { analyzerAgentInfo }
171
+ export { analyzerAgentInfo as analyzerAgentInfo_alias_1 }
172
+ export { analyzerAgentInfo as analyzerAgentInfo_alias_2 }
173
+
174
+ declare type AnalyzerAgentOptions = SharedAgentOptions;
175
+ export { AnalyzerAgentOptions }
176
+ export { AnalyzerAgentOptions as AnalyzerAgentOptions_alias_1 }
177
+ export { AnalyzerAgentOptions as AnalyzerAgentOptions_alias_2 }
178
+
179
+ /**
180
+ * Annotate a diff with line numbers for additions and deletions
181
+ * Adds [Line N] for additions and [Line N removed] for deletions
182
+ */
183
+ export declare function annotateDiffWithLineNumbers(diff: string): string;
184
+
185
+ declare class ArchitectAgent extends AgentBase {
186
+ constructor(options: ArchitectAgentOptions);
187
+ onBeforeInvokeTool(): Promise<undefined>;
188
+ }
189
+ export { ArchitectAgent }
190
+ export { ArchitectAgent as ArchitectAgent_alias_1 }
191
+ export { ArchitectAgent as ArchitectAgent_alias_2 }
192
+
193
+ declare const architectAgentInfo: {
194
+ readonly name: "architect";
195
+ readonly responsibilities: ["Analyzing the user’s overall task and requirements.", "Creating plans and making higher-level decisions about system structure and design.", "Reviewing and analyzing existing code or components for maintainability and scalability.", "Laying out the roadmap for implementation."];
196
+ };
197
+ export { architectAgentInfo }
198
+ export { architectAgentInfo as architectAgentInfo_alias_1 }
199
+ export { architectAgentInfo as architectAgentInfo_alias_2 }
200
+
201
+ declare type ArchitectAgentOptions = SharedAgentOptions;
202
+ export { ArchitectAgentOptions }
203
+ export { ArchitectAgentOptions as ArchitectAgentOptions_alias_1 }
204
+ export { ArchitectAgentOptions as ArchitectAgentOptions_alias_2 }
205
+
206
+ declare type AssistantMessageContent = TextContent | ToolUse;
207
+ export { AssistantMessageContent }
208
+ export { AssistantMessageContent as AssistantMessageContent_alias_1 }
209
+ export { AssistantMessageContent as AssistantMessageContent_alias_2 }
210
+
211
+ export declare const basePrompt = "You are a highly skilled software engineer specializing in debugging and fixing code issues. You have extensive experience with:\n- Type systems and type checking\n- Test frameworks and debugging test failures\n- Code quality tools and best practices\n- Systematic debugging approaches";
212
+
213
+ export declare const basePrompt_alias_1 = "You are a highly skilled software engineer with extensive knowledge in many programming languages, frameworks, design patterns, and best practices.";
214
+
215
+ declare const capabilities: (_toolNamePrefix: string) => string;
216
+ export { capabilities }
217
+ export { capabilities as capabilities_alias_1 }
218
+ export { capabilities as capabilities_alias_2 }
219
+
220
+ /**
221
+ * CodeFixer agent for fixing code issues like type errors and failing tests.
222
+ * Using Scripts: format, check, test
223
+ */
224
+ declare class CodeFixerAgent extends AgentBase {
225
+ #private;
226
+ constructor(options: CodeFixerAgentOptions);
227
+ protected onBeforeInvokeTool(name: string, _args: Record<string, string>): Promise<ToolResponse | undefined>;
228
+ }
229
+ export { CodeFixerAgent }
230
+ export { CodeFixerAgent as CodeFixerAgent_alias_1 }
231
+ export { CodeFixerAgent as CodeFixerAgent_alias_2 }
232
+
233
+ declare const codeFixerAgentInfo: {
234
+ readonly name: "codefixer";
235
+ readonly responsibilities: ["Fixing type errors and type-related issues", "Resolving failing tests", "Addressing code quality issues", "Tracking and reporting unfixed issues"];
236
+ };
237
+ export { codeFixerAgentInfo }
238
+ export { codeFixerAgentInfo as codeFixerAgentInfo_alias_1 }
239
+ export { codeFixerAgentInfo as codeFixerAgentInfo_alias_2 }
240
+
241
+ declare type CodeFixerAgentOptions = SharedAgentOptions & {
242
+ maxRetries?: number;
243
+ };
244
+ export { CodeFixerAgentOptions }
245
+ export { CodeFixerAgentOptions as CodeFixerAgentOptions_alias_1 }
246
+ export { CodeFixerAgentOptions as CodeFixerAgentOptions_alias_2 }
247
+
248
+ export declare const codeFixingStrategies = "\n====\n\nCODE FIXING STRATEGIES\n\n1. Type Errors\n - Analyze type error messages carefully\n - Check type definitions and imports\n - Consider type assertions only as a last resort\n - Verify type compatibility across function boundaries\n - Look for null/undefined handling issues\n\n2. Test Failures\n - Examine test output and error messages\n - Check test setup and fixtures\n - Verify assertions and expectations\n - Look for async/timing issues\n - Consider edge cases and input validation\n\n3. Code Quality Issues\n - Follow project's coding standards\n - Address linter warnings systematically\n - Improve code readability\n - Fix potential runtime issues\n - Consider performance implications\n\n4. General Approach\n - Start with the most critical issues\n - Make minimal necessary changes\n - Verify fixes don't introduce new issues\n - Document complex fixes with comments\n - Track attempted solutions for each issue";
249
+
250
+ /**
251
+ * Coder agent for writing code.
252
+ * Using Scripts: format, check, test
253
+ */
254
+ declare class CoderAgent extends AgentBase {
255
+ #private;
256
+ constructor(options: CoderAgentOptions);
257
+ protected onBeforeInvokeTool(name: string, _args: Record<string, string>): Promise<ToolResponse | undefined>;
258
+ }
259
+ export { CoderAgent }
260
+ export { CoderAgent as CoderAgent_alias_1 }
261
+ export { CoderAgent as CoderAgent_alias_2 }
262
+
263
+ declare const coderAgentInfo: {
264
+ readonly name: "coder";
265
+ readonly responsibilities: ["Editing and refactoring existing code.", "Creating new features or modules.", "Running tests and analyzing test results.", "Maintaining coding standards, lint rules, and general code quality."];
266
+ };
267
+ export { coderAgentInfo }
268
+ export { coderAgentInfo as coderAgentInfo_alias_1 }
269
+ export { coderAgentInfo as coderAgentInfo_alias_2 }
270
+
271
+ declare type CoderAgentOptions = SharedAgentOptions;
272
+ export { CoderAgentOptions }
273
+ export { CoderAgentOptions as CoderAgentOptions_alias_1 }
274
+ export { CoderAgentOptions as CoderAgentOptions_alias_2 }
275
+
276
+ declare type CommandProvider = {
277
+ executeCommand?: (command: string, needApprove: boolean) => Promise<{
278
+ stdout: string;
279
+ stderr: string;
280
+ exitCode: number;
281
+ }>;
282
+ };
283
+ export { CommandProvider }
284
+ export { CommandProvider as CommandProvider_alias_1 }
285
+ export { CommandProvider as CommandProvider_alias_2 }
286
+
287
+ declare type Config = z.infer<typeof configSchema>;
288
+ export { Config }
289
+ export { Config as Config_alias_1 }
290
+
291
+ declare const configSchema: z.ZodObject<{
292
+ agent: z.ZodOptional<z.ZodString>;
293
+ prices: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodRecord<z.ZodString, z.ZodObject<{
294
+ inputPrice: z.ZodOptional<z.ZodNumber>;
295
+ outputPrice: z.ZodOptional<z.ZodNumber>;
296
+ cacheWritesPrice: z.ZodOptional<z.ZodNumber>;
297
+ cacheReadsPrice: z.ZodOptional<z.ZodNumber>;
298
+ }, z.core.$strip>>>>;
299
+ providers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
300
+ apiKey: z.ZodOptional<z.ZodString>;
301
+ defaultModel: z.ZodOptional<z.ZodString>;
302
+ defaultParameters: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
303
+ location: z.ZodOptional<z.ZodString>;
304
+ project: z.ZodOptional<z.ZodString>;
305
+ keyFile: z.ZodOptional<z.ZodString>;
306
+ }, z.core.$strip>>>;
307
+ defaultProvider: z.ZodOptional<z.ZodString>;
308
+ defaultModel: z.ZodOptional<z.ZodString>;
309
+ defaultParameters: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
310
+ toolFormat: z.ZodOptional<z.ZodEnum<{
311
+ native: "native";
312
+ "polka-codes": "polka-codes";
313
+ }>>;
314
+ maxMessageCount: z.ZodOptional<z.ZodNumber>;
315
+ budget: z.ZodOptional<z.ZodNumber>;
316
+ retryCount: z.ZodOptional<z.ZodNumber>;
317
+ requestTimeoutSeconds: z.ZodOptional<z.ZodNumber>;
318
+ scripts: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodString, z.ZodObject<{
319
+ command: z.ZodString;
320
+ description: z.ZodString;
321
+ }, z.core.$strip>]>>>;
322
+ agents: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
323
+ provider: z.ZodOptional<z.ZodString>;
324
+ model: z.ZodOptional<z.ZodString>;
325
+ parameters: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
326
+ toolFormat: z.ZodOptional<z.ZodEnum<{
327
+ native: "native";
328
+ "polka-codes": "polka-codes";
329
+ }>>;
330
+ initialContext: z.ZodOptional<z.ZodObject<{
331
+ maxFileCount: z.ZodOptional<z.ZodNumber>;
332
+ excludes: z.ZodOptional<z.ZodArray<z.ZodString>>;
333
+ }, z.core.$strip>>;
334
+ retryCount: z.ZodOptional<z.ZodNumber>;
335
+ requestTimeoutSeconds: z.ZodOptional<z.ZodNumber>;
336
+ }, z.core.$strip>>>;
337
+ commands: z.ZodOptional<z.ZodObject<{
338
+ default: z.ZodOptional<z.ZodObject<{
339
+ provider: z.ZodOptional<z.ZodString>;
340
+ model: z.ZodOptional<z.ZodString>;
341
+ parameters: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
342
+ toolFormat: z.ZodOptional<z.ZodEnum<{
343
+ native: "native";
344
+ "polka-codes": "polka-codes";
345
+ }>>;
346
+ }, z.core.$strip>>;
347
+ }, z.core.$catchall<z.ZodObject<{
348
+ provider: z.ZodOptional<z.ZodString>;
349
+ model: z.ZodOptional<z.ZodString>;
350
+ parameters: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
351
+ toolFormat: z.ZodOptional<z.ZodEnum<{
352
+ native: "native";
353
+ "polka-codes": "polka-codes";
354
+ }>>;
355
+ }, z.core.$strip>>>>;
356
+ rules: z.ZodOptional<z.ZodUnion<[z.ZodOptional<z.ZodArray<z.ZodString>>, z.ZodString]>>;
357
+ excludeFiles: z.ZodOptional<z.ZodArray<z.ZodString>>;
358
+ policies: z.ZodOptional<z.ZodArray<z.ZodString>>;
359
+ }, z.core.$strict>;
360
+ export { configSchema }
361
+ export { configSchema as configSchema_alias_1 }
362
+
363
+ declare const createNewProject: (agent: MultiAgent, params: string) => Promise<string>;
364
+ export { createNewProject }
365
+ export { createNewProject as createNewProject_alias_1 }
366
+
367
+ declare const customInstructions: (customInstructions: string[]) => string;
368
+ export { customInstructions }
369
+ export { customInstructions as customInstructions_alias_1 }
370
+ export { customInstructions as customInstructions_alias_2 }
371
+
372
+ declare const customScripts: (commands: Record<string, string | {
373
+ command: string;
374
+ description: string;
375
+ }>) => string;
376
+ export { customScripts }
377
+ export { customScripts as customScripts_alias_1 }
378
+ export { customScripts as customScripts_alias_2 }
379
+
380
+ declare const _default: {
381
+ handler: ToolHandler<{
382
+ readonly name: "ask_followup_question";
383
+ readonly description: "Call this when vital details are missing. Pose each follow-up as one direct, unambiguous question. If it speeds the reply, add up to five short, mutually-exclusive answer options. Group any related questions in the same call to avoid a back-and-forth chain.";
384
+ readonly parameters: z.ZodObject<{
385
+ questions: z.ZodArray<z.ZodObject<{
386
+ prompt: z.ZodString;
387
+ options: z.ZodDefault<z.ZodArray<z.ZodString>>;
388
+ }, z.core.$strip>>;
389
+ }, z.core.$strip>;
390
+ readonly permissionLevel: PermissionLevel.None;
391
+ }, InteractionProvider>;
392
+ isAvailable: (provider: InteractionProvider) => boolean;
393
+ name: "ask_followup_question";
394
+ description: "Call this when vital details are missing. Pose each follow-up as one direct, unambiguous question. If it speeds the reply, add up to five short, mutually-exclusive answer options. Group any related questions in the same call to avoid a back-and-forth chain.";
395
+ parameters: z.ZodObject<{
396
+ questions: z.ZodArray<z.ZodObject<{
397
+ prompt: z.ZodString;
398
+ options: z.ZodDefault<z.ZodArray<z.ZodString>>;
399
+ }, z.core.$strip>>;
400
+ }, z.core.$strip>;
401
+ permissionLevel: PermissionLevel.None;
402
+ };
403
+ export { _default as askFollowupQuestion }
404
+ export { _default as askFollowupQuestion_alias_1 }
405
+ export { _default as askFollowupQuestion_alias_2 }
406
+ export { _default as default_alias_6 }
407
+
408
+ declare const _default_10: {
409
+ handler: ToolHandler<{
410
+ readonly name: "rename_file";
411
+ readonly description: "Request to rename a file from source path to target path.";
412
+ readonly parameters: z.ZodObject<{
413
+ source_path: z.ZodString;
414
+ target_path: z.ZodString;
415
+ }, z.core.$strip>;
416
+ readonly permissionLevel: PermissionLevel.Write;
417
+ }, FilesystemProvider>;
418
+ isAvailable: (provider: FilesystemProvider) => boolean;
419
+ name: "rename_file";
420
+ description: "Request to rename a file from source path to target path.";
421
+ parameters: z.ZodObject<{
422
+ source_path: z.ZodString;
423
+ target_path: z.ZodString;
424
+ }, z.core.$strip>;
425
+ permissionLevel: PermissionLevel.Write;
426
+ };
427
+ export { _default_10 as default_alias_15 }
428
+ export { _default_10 as renameFile }
429
+ export { _default_10 as renameFile_alias_1 }
430
+ export { _default_10 as renameFile_alias_2 }
431
+
432
+ declare const _default_11: {
433
+ handler: ToolHandler<{
434
+ readonly name: "replace_in_file";
435
+ readonly description: "Request to replace sections of content in an existing file using SEARCH/REPLACE blocks that define exact changes to specific parts of the file. This tool should be used when you need to make targeted changes to specific parts of a file.";
436
+ readonly parameters: z.ZodObject<{
437
+ path: z.ZodString;
438
+ diff: z.ZodString;
439
+ }, z.core.$strip>;
440
+ readonly permissionLevel: PermissionLevel.Write;
441
+ }, FilesystemProvider>;
442
+ isAvailable: (provider: FilesystemProvider) => boolean;
443
+ name: "replace_in_file";
444
+ description: "Request to replace sections of content in an existing file using SEARCH/REPLACE blocks that define exact changes to specific parts of the file. This tool should be used when you need to make targeted changes to specific parts of a file.";
445
+ parameters: z.ZodObject<{
446
+ path: z.ZodString;
447
+ diff: z.ZodString;
448
+ }, z.core.$strip>;
449
+ permissionLevel: PermissionLevel.Write;
450
+ };
451
+ export { _default_11 as default_alias_16 }
452
+ export { _default_11 as replaceInFile }
453
+ export { _default_11 as replaceInFile_alias_1 }
454
+ export { _default_11 as replaceInFile_alias_2 }
455
+
456
+ declare const _default_12: {
457
+ handler: ToolHandler<{
458
+ readonly name: "search_files";
459
+ readonly description: "Request to perform a regex search across files in a specified directory, outputting context-rich results that include surrounding lines. This tool searches for patterns or specific content across multiple files, displaying each match with encapsulating context.";
460
+ readonly parameters: z.ZodObject<{
461
+ path: z.ZodString;
462
+ regex: z.ZodString;
463
+ filePattern: z.ZodOptional<z.ZodString>;
464
+ }, z.core.$strip>;
465
+ readonly permissionLevel: PermissionLevel.Read;
466
+ }, FilesystemProvider>;
467
+ isAvailable: (provider: FilesystemProvider) => boolean;
468
+ name: "search_files";
469
+ description: "Request to perform a regex search across files in a specified directory, outputting context-rich results that include surrounding lines. This tool searches for patterns or specific content across multiple files, displaying each match with encapsulating context.";
470
+ parameters: z.ZodObject<{
471
+ path: z.ZodString;
472
+ regex: z.ZodString;
473
+ filePattern: z.ZodOptional<z.ZodString>;
474
+ }, z.core.$strip>;
475
+ permissionLevel: PermissionLevel.Read;
476
+ };
477
+ export { _default_12 as default_alias_17 }
478
+ export { _default_12 as searchFiles }
479
+ export { _default_12 as searchFiles_alias_1 }
480
+ export { _default_12 as searchFiles_alias_2 }
481
+
482
+ declare const _default_13: {
483
+ handler: ToolHandler<{
484
+ readonly name: "write_to_file";
485
+ readonly description: "Request to write content to a file at the specified path. If the file exists, it will be overwritten with the provided content. If the file doesn't exist, it will be created. This tool will automatically create any directories needed to write the file. Ensure that the output content does not include incorrect escaped character patterns such as `&lt;`, `&gt;`, or `&amp;`. Also ensure there is no unwanted CDATA tags in the content.";
486
+ readonly parameters: z.ZodObject<{
487
+ path: z.ZodString;
488
+ content: z.ZodString;
489
+ }, z.core.$strip>;
490
+ readonly permissionLevel: PermissionLevel.Write;
491
+ }, FilesystemProvider>;
492
+ isAvailable: (provider: FilesystemProvider) => boolean;
493
+ name: "write_to_file";
494
+ description: "Request to write content to a file at the specified path. If the file exists, it will be overwritten with the provided content. If the file doesn't exist, it will be created. This tool will automatically create any directories needed to write the file. Ensure that the output content does not include incorrect escaped character patterns such as `&lt;`, `&gt;`, or `&amp;`. Also ensure there is no unwanted CDATA tags in the content.";
495
+ parameters: z.ZodObject<{
496
+ path: z.ZodString;
497
+ content: z.ZodString;
498
+ }, z.core.$strip>;
499
+ permissionLevel: PermissionLevel.Write;
500
+ };
501
+ export { _default_13 as default_alias_18 }
502
+ export { _default_13 as writeToFile }
503
+ export { _default_13 as writeToFile_alias_1 }
504
+ export { _default_13 as writeToFile_alias_2 }
505
+
506
+ declare const _default_2: {
507
+ handler: ToolHandler<{
508
+ readonly name: "attempt_completion";
509
+ readonly description: "Use this tool when you believe the user’s requested task is complete. Indicate that your work is finished, but acknowledge the user may still provide additional instructions or questions if they want to continue. This tool MUST NOT to be used with any other tool.";
510
+ readonly parameters: z.ZodObject<{
511
+ result: z.ZodString;
512
+ }, z.core.$strip>;
513
+ readonly permissionLevel: PermissionLevel.None;
514
+ }, InteractionProvider>;
515
+ isAvailable: (_provider: InteractionProvider) => boolean;
516
+ name: "attempt_completion";
517
+ description: "Use this tool when you believe the user’s requested task is complete. Indicate that your work is finished, but acknowledge the user may still provide additional instructions or questions if they want to continue. This tool MUST NOT to be used with any other tool.";
518
+ parameters: z.ZodObject<{
519
+ result: z.ZodString;
520
+ }, z.core.$strip>;
521
+ permissionLevel: PermissionLevel.None;
522
+ };
523
+ export { _default_2 as attemptCompletion }
524
+ export { _default_2 as attemptCompletion_alias_1 }
525
+ export { _default_2 as attemptCompletion_alias_2 }
526
+ export { _default_2 as default_alias_7 }
527
+
528
+ declare const _default_3: {
529
+ handler: ToolHandler<{
530
+ readonly name: "delegate";
531
+ readonly description: "Temporarily delegate a task to another agent and receive the result back. This tool MUST NOT to be used with any other tool.";
532
+ readonly parameters: z.ZodObject<{
533
+ agentName: z.ZodString;
534
+ task: z.ZodString;
535
+ context: z.ZodString;
536
+ files: z.ZodOptional<z.ZodPipe<z.ZodTransform<string[], unknown>, z.ZodArray<z.ZodString>>>;
537
+ }, z.core.$strip>;
538
+ readonly permissionLevel: PermissionLevel.None;
539
+ }, any>;
540
+ isAvailable: (_provider: any) => boolean;
541
+ name: "delegate";
542
+ description: "Temporarily delegate a task to another agent and receive the result back. This tool MUST NOT to be used with any other tool.";
543
+ parameters: z.ZodObject<{
544
+ agentName: z.ZodString;
545
+ task: z.ZodString;
546
+ context: z.ZodString;
547
+ files: z.ZodOptional<z.ZodPipe<z.ZodTransform<string[], unknown>, z.ZodArray<z.ZodString>>>;
548
+ }, z.core.$strip>;
549
+ permissionLevel: PermissionLevel.None;
550
+ };
551
+ export { _default_3 as default_alias_8 }
552
+ export { _default_3 as delegate }
553
+ export { _default_3 as delegate_alias_1 }
554
+ export { _default_3 as delegate_alias_2 }
555
+
556
+ declare const _default_4: {
557
+ handler: ToolHandler<{
558
+ readonly name: "execute_command";
559
+ readonly description: "Run a single CLI command. The command is always executed in the project-root working directory (regardless of earlier commands). Prefer one-off shell commands over wrapper scripts for flexibility. **IMPORTANT**: After an `execute_command` call, you MUST stop and NOT allowed to make further tool calls in the same message.";
560
+ readonly parameters: z.ZodObject<{
561
+ command: z.ZodString;
562
+ requiresApproval: z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodDefault<z.ZodOptional<z.ZodBoolean>>>;
563
+ }, z.core.$strip>;
564
+ readonly permissionLevel: PermissionLevel.Arbitrary;
565
+ }, CommandProvider>;
566
+ isAvailable: (provider: CommandProvider) => boolean;
567
+ name: "execute_command";
568
+ description: "Run a single CLI command. The command is always executed in the project-root working directory (regardless of earlier commands). Prefer one-off shell commands over wrapper scripts for flexibility. **IMPORTANT**: After an `execute_command` call, you MUST stop and NOT allowed to make further tool calls in the same message.";
569
+ parameters: z.ZodObject<{
570
+ command: z.ZodString;
571
+ requiresApproval: z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodDefault<z.ZodOptional<z.ZodBoolean>>>;
572
+ }, z.core.$strip>;
573
+ permissionLevel: PermissionLevel.Arbitrary;
574
+ };
575
+ export { _default_4 as default_alias_9 }
576
+ export { _default_4 as executeCommand }
577
+ export { _default_4 as executeCommand_alias_1 }
578
+ export { _default_4 as executeCommand_alias_2 }
579
+
580
+ declare const _default_5: {
581
+ handler: ToolHandler<{
582
+ readonly name: "fetch_url";
583
+ readonly description: "Fetch the content located at one or more HTTP(S) URLs and return it in Markdown format. This works for standard web pages as well as raw files (e.g. README.md, source code) hosted on platforms like GitHub.";
584
+ readonly parameters: z.ZodObject<{
585
+ url: z.ZodPipe<z.ZodTransform<string[], unknown>, z.ZodArray<z.ZodString>>;
586
+ }, z.core.$strip>;
587
+ readonly permissionLevel: PermissionLevel.Read;
588
+ }, WebProvider>;
589
+ isAvailable: (provider: WebProvider) => boolean;
590
+ name: "fetch_url";
591
+ description: "Fetch the content located at one or more HTTP(S) URLs and return it in Markdown format. This works for standard web pages as well as raw files (e.g. README.md, source code) hosted on platforms like GitHub.";
592
+ parameters: z.ZodObject<{
593
+ url: z.ZodPipe<z.ZodTransform<string[], unknown>, z.ZodArray<z.ZodString>>;
594
+ }, z.core.$strip>;
595
+ permissionLevel: PermissionLevel.Read;
596
+ };
597
+ export { _default_5 as default_alias_10 }
598
+ export { _default_5 as fetchUrl }
599
+ export { _default_5 as fetchUrl_alias_1 }
600
+ export { _default_5 as fetchUrl_alias_2 }
601
+
602
+ declare const _default_6: {
603
+ handler: ToolHandler<{
604
+ readonly name: "hand_over";
605
+ readonly description: "Hand over the current task to another agent to complete. This tool MUST NOT to be used with any other tool.";
606
+ readonly parameters: z.ZodObject<{
607
+ agentName: z.ZodString;
608
+ task: z.ZodString;
609
+ context: z.ZodString;
610
+ files: z.ZodOptional<z.ZodPipe<z.ZodTransform<string[], unknown>, z.ZodArray<z.ZodString>>>;
611
+ }, z.core.$strip>;
612
+ readonly permissionLevel: PermissionLevel.None;
613
+ }, any>;
614
+ isAvailable: (_provider: any) => boolean;
615
+ name: "hand_over";
616
+ description: "Hand over the current task to another agent to complete. This tool MUST NOT to be used with any other tool.";
617
+ parameters: z.ZodObject<{
618
+ agentName: z.ZodString;
619
+ task: z.ZodString;
620
+ context: z.ZodString;
621
+ files: z.ZodOptional<z.ZodPipe<z.ZodTransform<string[], unknown>, z.ZodArray<z.ZodString>>>;
622
+ }, z.core.$strip>;
623
+ permissionLevel: PermissionLevel.None;
624
+ };
625
+ export { _default_6 as default_alias_11 }
626
+ export { _default_6 as handOver }
627
+ export { _default_6 as handOver_alias_1 }
628
+ export { _default_6 as handOver_alias_2 }
629
+
630
+ declare const _default_7: {
631
+ handler: ToolHandler<{
632
+ readonly name: "list_files";
633
+ readonly description: "Request to list files and directories within the specified directory. If recursive is true, it will list all files and directories recursively. If recursive is false or not provided, it will only list the top-level contents. Do not use this tool to confirm the existence of files you may have created, as the user will let you know if the files were created successfully or not.";
634
+ readonly parameters: z.ZodObject<{
635
+ path: z.ZodString;
636
+ maxCount: z.ZodDefault<z.ZodOptional<z.ZodCoercedNumber<unknown>>>;
637
+ recursive: z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodDefault<z.ZodOptional<z.ZodBoolean>>>;
638
+ includeIgnored: z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodDefault<z.ZodOptional<z.ZodBoolean>>>;
639
+ }, z.core.$strip>;
640
+ readonly permissionLevel: PermissionLevel.Read;
641
+ }, FilesystemProvider>;
642
+ isAvailable: (provider: FilesystemProvider) => boolean;
643
+ name: "list_files";
644
+ description: "Request to list files and directories within the specified directory. If recursive is true, it will list all files and directories recursively. If recursive is false or not provided, it will only list the top-level contents. Do not use this tool to confirm the existence of files you may have created, as the user will let you know if the files were created successfully or not.";
645
+ parameters: z.ZodObject<{
646
+ path: z.ZodString;
647
+ maxCount: z.ZodDefault<z.ZodOptional<z.ZodCoercedNumber<unknown>>>;
648
+ recursive: z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodDefault<z.ZodOptional<z.ZodBoolean>>>;
649
+ includeIgnored: z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodDefault<z.ZodOptional<z.ZodBoolean>>>;
650
+ }, z.core.$strip>;
651
+ permissionLevel: PermissionLevel.Read;
652
+ };
653
+ export { _default_7 as default_alias_12 }
654
+ export { _default_7 as listFiles }
655
+ export { _default_7 as listFiles_alias_1 }
656
+ export { _default_7 as listFiles_alias_2 }
657
+
658
+ declare const _default_8: {
659
+ handler: ToolHandler<{
660
+ readonly name: "read_file";
661
+ readonly description: "Request to read the contents of one or multiple files at the specified paths. Use comma separated paths to read multiple files. Use this when you need to examine the contents of an existing file you do not know the contents of, for example to analyze code, review text files, or extract information from configuration files. May not be suitable for other types of binary files, as it returns the raw content as a string. Try to list all the potential files are relevent to the task, and then use this tool to read all the relevant files.";
662
+ readonly parameters: z.ZodObject<{
663
+ path: z.ZodPipe<z.ZodTransform<string[], unknown>, z.ZodArray<z.ZodString>>;
664
+ includeIgnored: z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodDefault<z.ZodOptional<z.ZodBoolean>>>;
665
+ }, z.core.$strip>;
666
+ readonly permissionLevel: PermissionLevel.Read;
667
+ }, FilesystemProvider>;
668
+ isAvailable: (provider: FilesystemProvider) => boolean;
669
+ name: "read_file";
670
+ description: "Request to read the contents of one or multiple files at the specified paths. Use comma separated paths to read multiple files. Use this when you need to examine the contents of an existing file you do not know the contents of, for example to analyze code, review text files, or extract information from configuration files. May not be suitable for other types of binary files, as it returns the raw content as a string. Try to list all the potential files are relevent to the task, and then use this tool to read all the relevant files.";
671
+ parameters: z.ZodObject<{
672
+ path: z.ZodPipe<z.ZodTransform<string[], unknown>, z.ZodArray<z.ZodString>>;
673
+ includeIgnored: z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodDefault<z.ZodOptional<z.ZodBoolean>>>;
674
+ }, z.core.$strip>;
675
+ permissionLevel: PermissionLevel.Read;
676
+ };
677
+ export { _default_8 as default_alias_13 }
678
+ export { _default_8 as readFile }
679
+ export { _default_8 as readFile_alias_1 }
680
+ export { _default_8 as readFile_alias_2 }
681
+
682
+ declare const _default_9: {
683
+ handler: ToolHandler<{
684
+ readonly name: "remove_file";
685
+ readonly description: "Request to remove a file at the specified path.";
686
+ readonly parameters: z.ZodObject<{
687
+ path: z.ZodString;
688
+ }, z.core.$strip>;
689
+ readonly permissionLevel: PermissionLevel.Write;
690
+ }, FilesystemProvider>;
691
+ isAvailable: (provider: FilesystemProvider) => boolean;
692
+ name: "remove_file";
693
+ description: "Request to remove a file at the specified path.";
694
+ parameters: z.ZodObject<{
695
+ path: z.ZodString;
696
+ }, z.core.$strip>;
697
+ permissionLevel: PermissionLevel.Write;
698
+ };
699
+ export { _default_9 as default_alias_14 }
700
+ export { _default_9 as removeFile }
701
+ export { _default_9 as removeFile_alias_1 }
702
+ export { _default_9 as removeFile_alias_2 }
703
+
704
+ /**
705
+ * AI tool for creating new projects based on user specifications.
706
+ * Generated by polka.codes
707
+ */
708
+ export declare const default_alias: {
709
+ readonly name: "createNewProject";
710
+ readonly description: "Creates a new project";
711
+ readonly prompt: "You are an AiTool designed to assist users in creating new projects. Follow these guidelines:\n\n1. **Gather Information:**\n - Begin by asking the user for essential project details, including:\n - Project type (e.g., web, mobile, desktop, etc.)\n - Desired programming languages\n - Preferred frameworks or libraries\n - Build tools and package manager preferences\n - Testing frameworks and patterns\n - Code style and linting preferences\n - Any additional specifications or requirements\n\n2. **Clarification & Confirmation:**\n - Do not make any decisions or assumptions on behalf of the user.\n - Ask clarifying questions if any detail is ambiguous.\n - Confirm each piece of information with the user before proceeding to the next step.\n\n3. **Avoid Redundancy:**\n - Do not repeat questions or details that have already been confirmed.\n - Keep interactions concise and focused on gathering complete and accurate details.\n\n4. **Generate Configuration:**\n - Based on the collected information, generate a .polkacodes.yml configuration file that includes:\n - scripts section with common development commands (test, format, check, etc.)\n - rules section reflecting project conventions and tools\n - excludeFiles section for sensitive files only\n - Example structure:\n ```yaml\n scripts:\n test:\n command: \"[test-command]\"\n description: \"Run tests\"\n format:\n command: \"[format-command]\"\n description: \"Format code\"\n check:\n command: \"[check-command]\"\n description: \"Check code\"\n\n rules:\n - \"[package-manager-rule]\"\n - \"[testing-framework-rule]\"\n - \"[code-style-rule]\"\n - \"[other-rule]\"\n\n excludeFiles:\n - \".env\"\n - \".env.*\"\n ```\n\n5. **Generate Essential Project Files:**\n - Create a .gitattributes file with appropriate configurations:\n - Mark lock files as generated and exclude them from diffs\n - Example for different package managers:\n\n # For Bun\n bun.lock linguist-generated=true\n bun.lock -diff\n\n # For npm\n package-lock.json linguist-generated=true\n package-lock.json -diff\n\n # For Yarn\n yarn.lock linguist-generated=true\n yarn.lock -diff\n\n # For pnpm\n pnpm-lock.yaml linguist-generated=true\n pnpm-lock.yaml -diff\n\n - Include other common configurations as needed based on project type\n\n6. **Handover to Coder Agent:**\n - Once all required information is collected and validated by the user, compile:\n 1. The final project specifications\n 2. The .polkacodes.yml configuration content\n - Clearly hand over these details to the coder agent, instructing them to:\n 1. Create the new project based on the confirmed specifications\n 2. Include the .polkacodes.yml file in the project root\n 3. Include the .gitattributes file with appropriate configurations\n 4. Ensure all specified tools and configurations are properly set up";
712
+ readonly formatInput: (params: string) => string;
713
+ readonly parseOutput: (output: string) => string;
714
+ readonly agent: "architect";
715
+ };
716
+
717
+ export declare const default_alias_1: {
718
+ readonly name: "generateGitCommitMessage";
719
+ readonly description: "Generates git commit messages from git diff output";
720
+ readonly prompt: "\nYou are an advanced assistant specialized in creating concise and accurate Git commit messages. When you receive:\n- A Git diff inside the <tool_input> tag.\n- Additional user-supplied context inside the <tool_input_context> tag (if any).\n\nYou will produce a single commit message enclosed within <tool_output> tags. The commit message must accurately reflect the changes shown in the diff and should be clear, descriptive, and devoid of unnecessary or repeated information. If a context is provided, it MUST be incorporated into the commit message.\n\nHere’s an example of the input and the expected output format:\n\n<tool_input>\n--- a/example_file.py\n+++ b/example_file.py\n@@ -10,7 +10,7 @@ def example_function():\n- print(\"Old behavior\")\n+ print(\"New behavior\")\n</tool_input>\n<tool_input_context>\nChanging print statement to update the user-facing message.\n</tool_input_context>\n\nExample Output:\n\n<tool_output>\nUpdate print statement for revised user-facing message\n</tool_output>\n\nFollow the same structure for any new input. Never repeat questions; focus on generating a concise commit message that captures the essence of the changes.\n";
721
+ readonly formatInput: (params: {
722
+ diff: string;
723
+ context?: string;
724
+ }) => string;
725
+ readonly parseOutput: (output: string) => string;
726
+ };
727
+
728
+ export declare const default_alias_2: {
729
+ readonly name: "generateGithubPullRequestDetails";
730
+ readonly description: "Generates a GitHub pull request title and description from git commits";
731
+ readonly prompt: "\n# Generate Github Pull Request Details\n\nYou are given:\n- A branch name in <tool_input_branch_name>.\n- An optional context message in <tool_input_context> (which may or may not be present).\n- All commit messages combined in <tool_input_commit_messages>.\n- All diffs combined in <tool_input_commit_diff>.\n\nYour task:\n1. Consider the optional context (if provided).\n - If an issue number is found, add \"Closes #xxx\" at the beginning of the PR description\n - IMPORTANT: Use ONLY the exact format \"Closes #xxx\" at the beginning of the description\n - DO NOT use variations like \"Closes issue #xxx\" or other formats\n2. Analyze the combined commit messages and diffs.\n3. Produce a single GitHub Pull Request title.\n4. Produce a Pull Request description that explains the changes.\n\nUse the following template for the Pull Request description:\n\n---\n**Context (if provided)**:\n- Acknowledge any guiding concerns or instructions.\n\n**Summary of Changes**:\n- Provide a concise list or overview of what changed.\n\n**Highlights of Changed Code**:\n- Mention only the specific sections or functionalities updated, without showing full surrounding context.\n\n**Additional Information (if needed)**:\n- Testing steps (if applicable).\n- Any notes or caveats.\n\n---\n\nOutput format:\n<tool_output>\n <tool_output_pr_title>YOUR PR TITLE HERE</tool_output_pr_title>\n <tool_output_pr_description>\n YOUR PR DESCRIPTION HERE\n </tool_output_pr_description>\n</tool_output>\n\nBelow is an **example** of the input and output:\n\nExample Input:\n<tool_input>\n<tool_input_branch_name>feature/refactor-logging</tool_input_branch_name>\n<tool_input_context>Implementing changes for issue #123 - Focus on clean code and maintainability</tool_input_context>\n<tool_input_commit_messages>\nRemove debug logs\nRefactor order validation logic\n</tool_input_commit_messages>\n<tool_input_commit_diff>\ndiff --git a/user_service.py b/user_service.py\n- print(\"Debug info\")\n+ # Removed debug print statements\n\ndiff --git a/order_service.py b/order_service.py\n- if is_valid_order(order):\n- process_order(order)\n+ validate_and_process(order)\n</tool_input_commit_diff>\n</tool_input>\n\nExample Output:\n<tool_output>\n<tool_output_pr_title>Refactor Order Validation and Remove Debug Logs</tool_output_pr_title>\n<tool_output_pr_description>\nCloses #123\n\n**Context**:\n- Implementing changes for issue #123 - Focus on clean code and maintainability\n\n**Summary of Changes**:\n- Refactored order validation logic to use a new `validate_and_process` method.\n- Removed debug print statements from `user_service.py`.\n\n**Highlights of Changed Code**:\n- `order_service.py`: Replaced direct call to `process_order` with `validate_and_process`.\n- `user_service.py`: Removed `print(\"Debug info\")`.\n</tool_output_pr_description>\n</tool_output>\n\n---\n\nUse the above format whenever you receive <tool_input> that may include a branch name, an optional context, aggregated commit messages in a single tag, and a combined diff in a single tag. Provide your final output strictly in <tool_output> with <tool_output_pr_title> and <tool_output_pr_description>. Only highlight the changed code and avoid including the context around the changes in the description.\n";
732
+ readonly formatInput: (params: Input) => string;
733
+ readonly parseOutput: (output: string) => Output;
734
+ };
735
+
736
+ /**
737
+ * AI tool for analyzing project files and generating polkacodes config sections.
738
+ * Generated by polka.codes
739
+ */
740
+ export declare const default_alias_3: {
741
+ readonly name: "generateProjectConfig";
742
+ readonly description: "Analyzes project files to generate polkacodes config sections";
743
+ readonly prompt: "\nRole: Analyzer agent\nGoal: Produce a valid polkacodes YAML configuration for the project.\n\nWorkflow\n1. Scan project files with tool_read_file and identify:\n - Package/build tool (npm, bun, pnpm, etc.)\n - Test framework and patterns (snapshot tests, coverage, etc.)\n - Formatter / linter and their rules\n - Folder structure and naming conventions\n - CI / development workflows\n\n2. Build a YAML config with three root keys:\n\n```yaml\nscripts: # derive from package.json and CI\n format: # code formatter\n command: \"<formatter cmd>\"\n description: \"Format code\"\n check: # linter / type checker\n command: \"<linter cmd>\"\n description: \"Static checks\"\n test: # test runner\n command: \"<test cmd>\"\n description: \"Run tests\"\n # add any other meaningful project scripts\n\nrules: # bullet list of key conventions/tools\n\nexcludeFiles: # only files likely to hold secrets\n - \".env\"\n - \".env.*\"\n - \".npmrc\"\n # do NOT list build artifacts, lockfiles, or paths already in .gitignore\n```\n\n3. Return the YAML exactly once, wrapped like:\n\n<tool_attempt_completion>\n<tool_parameter_result>\n# YAML (2-space indents, double-quoted commands)\n</tool_parameter_result>\n</tool_attempt_completion>\n";
744
+ readonly formatInput: () => string;
745
+ readonly parseOutput: (output: string) => string;
746
+ readonly agent: "analyzer";
747
+ };
748
+
749
+ export declare const default_alias_4: {
750
+ readonly name: "reviewDiff";
751
+ readonly description: "Reviews a git diff";
752
+ readonly prompt: "\n# Code Review Prompt\n\nYou are a senior software engineer reviewing code changes.\n\n## Critical Instructions\n**ONLY review the actual changes shown in the diff.** Do not comment on existing code that wasn't modified.\n\n## Viewing Changes\n- **Use git_diff** to inspect the actual code changes for each relevant file.\n - **Pull request**: use the provided commit range for the git_diff tool with contextLines: 5 and includeLineNumbers: true\n - **Local changes**: diff staged or unstaged files using the git_diff tool with contextLines: 5 and includeLineNumbers: true\n- The diff will include line number annotations: [Line N] for additions and [Line N removed] for deletions\n- If a pull request is present you may receive:\n - <pr_title>\n - <pr_description>\n - <commit_messages>\n- A <review_instructions> tag tells you the focus of the review.\n- File status information is provided in <file_status> - use this to understand which files were modified, added, deleted, or renamed.\n\n## Line Number Reporting\n- **IMPORTANT**: Use the line numbers from the annotations in the diff output\n- For additions: Look for [Line N] annotations after the + lines\n- For deletions: Look for [Line N removed] annotations after the - lines\n- For modifications: Report the line number of the new/current code (from [Line N] annotations)\n- Report single lines as \"N\" and ranges as \"N-M\"\n\n## Review Guidelines\nFocus exclusively on the changed lines (+ additions, - deletions, modified lines):\n- **Specific issues**: Point to exact problems in the changed code with accurate line references from the annotations\n- **Actionable fixes**: Provide concrete solutions, not vague suggestions\n- **Clear reasoning**: Explain why each issue matters and how to fix it\n- **Avoid generic advice**: No generic suggestions like \"add more tests\", \"improve documentation\", or \"follow best practices\" unless directly related to a specific problem in the diff\n\n## What NOT to review\n- Existing unchanged code\n- Overall project structure or architecture (unless directly impacted by changes)\n- Generic best practices unrelated to the specific changes\n- Missing features or functionality not part of this diff\n\n## Output Format\nDo **not** include praise or positive feedback. Ignore generated files such as lock files.\nOnly include reviews for actual issues found in the changed code.\n\nReturn your review as a JSON object inside a ```json block, wrapped like:\n<tool_attempt_completion>\n<tool_parameter_result>\n```json\n{\n \"overview\": \"Summary of specific issues found in the diff changes, or 'No issues found' if the changes look good.\",\n \"specificReviews\": [\n {\n \"file\": \"path/filename.ext\",\n \"lines\": \"N or N-M\",\n \"review\": \"Specific issue with the changed code and exact actionable fix.\"\n }\n ]\n}\n```\n</tool_parameter_result>\n</tool_attempt_completion>\n";
753
+ readonly formatInput: (params: Input_2) => string;
754
+ readonly parseOutput: (output: string) => Output_2;
755
+ readonly agent: (options: SharedAgentOptions) => AnalyzerAgent;
756
+ };
757
+
758
+ export declare const default_alias_5: {
759
+ handler: ToolHandler<{
760
+ readonly name: "git_diff";
761
+ readonly description: "Get the git diff for the current repository. Can be used to get staged changes, unstaged changes, or changes between commits. By default, it returns unstaged changes.";
762
+ readonly parameters: z.ZodObject<{
763
+ staged: z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodDefault<z.ZodOptional<z.ZodBoolean>>>;
764
+ commitRange: z.ZodOptional<z.ZodString>;
765
+ file: z.ZodOptional<z.ZodString>;
766
+ contextLines: z.ZodDefault<z.ZodOptional<z.ZodCoercedNumber<unknown>>>;
767
+ includeLineNumbers: z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodDefault<z.ZodOptional<z.ZodBoolean>>>;
768
+ }, z.core.$strip>;
769
+ readonly permissionLevel: PermissionLevel.Read;
770
+ }, CommandProvider>;
771
+ isAvailable: (provider: CommandProvider) => boolean;
772
+ name: "git_diff";
773
+ description: "Get the git diff for the current repository. Can be used to get staged changes, unstaged changes, or changes between commits. By default, it returns unstaged changes.";
774
+ parameters: z.ZodObject<{
775
+ staged: z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodDefault<z.ZodOptional<z.ZodBoolean>>>;
776
+ commitRange: z.ZodOptional<z.ZodString>;
777
+ file: z.ZodOptional<z.ZodString>;
778
+ contextLines: z.ZodDefault<z.ZodOptional<z.ZodCoercedNumber<unknown>>>;
779
+ includeLineNumbers: z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodDefault<z.ZodOptional<z.ZodBoolean>>>;
780
+ }, z.core.$strip>;
781
+ permissionLevel: PermissionLevel.Read;
782
+ };
783
+
784
+ export declare interface DiffHunk {
785
+ oldStart: number;
786
+ oldCount: number;
787
+ newStart: number;
788
+ newCount: number;
789
+ header: string;
790
+ }
791
+
792
+ /**
793
+ * Returns the directory portion of a path string.
794
+ * Strips trailing slashes, then takes everything up to the last slash.
795
+ */
796
+ export declare function dirname(path: string): string;
797
+
798
+ export declare const editingFilesPrompt: (toolNamePrefix: string) => string;
799
+
800
+ declare const EnableCachePolicy: AgentPolicy;
801
+ export { EnableCachePolicy }
802
+ export { EnableCachePolicy as EnableCachePolicy_alias_1 }
803
+ export { EnableCachePolicy as EnableCachePolicy_alias_2 }
804
+ export { EnableCachePolicy as EnableCachePolicy_alias_3 }
805
+
806
+ declare const executeAgentTool: <T extends AiToolDefinitionWithAgent<any, any>>(definition: T, options: SharedAgentOptions, params: GetInput<T>) => Promise<GetOutput<T>>;
807
+ export { executeAgentTool }
808
+ export { executeAgentTool as executeAgentTool_alias_1 }
809
+
810
+ declare const executeMultiAgentTool: <T extends AiToolDefinitionWithMultiAgent<any, any>>(definition: T, agent: MultiAgent, params: GetInput<T>) => Promise<GetOutput<T>>;
811
+ export { executeMultiAgentTool }
812
+ export { executeMultiAgentTool as executeMultiAgentTool_alias_1 }
813
+
814
+ declare const executeTool: <T extends AiToolDefinition<any, any>>(definition: T, ai: LanguageModelV2, params: GetInput<T>, usageMeter: UsageMeter) => Promise<GetOutput<T>>;
815
+ export { executeTool }
816
+ export { executeTool as executeTool_alias_1 }
817
+
818
+ declare type ExitReason = {
819
+ type: 'UsageExceeded';
820
+ } | {
821
+ type: 'WaitForUserInput';
822
+ } | {
823
+ type: 'Aborted';
824
+ } | ToolResponseExit | ToolResponseInterrupted | ToolResponseHandOver | ToolResponseDelegate | {
825
+ type: 'Pause';
826
+ responses: ToolResponseOrToolPause[];
827
+ };
828
+ export { ExitReason }
829
+ export { ExitReason as ExitReason_alias_1 }
830
+ export { ExitReason as ExitReason_alias_2 }
831
+
832
+ /**
833
+ * Extract line ranges from a diff for a specific file
834
+ * Returns an array of line ranges that were modified
835
+ */
836
+ export declare function extractModifiedLineRanges(diff: string, filePath?: string): Array<{
837
+ start: number;
838
+ end: number;
839
+ type: 'added' | 'removed' | 'modified';
840
+ }>;
841
+
842
+ declare type FilesystemProvider = {
843
+ readFile?: (path: string, includeIgnored: boolean) => Promise<string | undefined>;
844
+ writeFile?: (path: string, content: string) => Promise<void>;
845
+ removeFile?: (path: string) => Promise<void>;
846
+ renameFile?: (sourcePath: string, targetPath: string) => Promise<void>;
847
+ listFiles?: (path: string, recursive: boolean, maxCount: number, includeIgnored: boolean) => Promise<[string[], boolean]>;
848
+ searchFiles?: (path: string, regex: string, filePattern: string) => Promise<string[]>;
849
+ };
850
+ export { FilesystemProvider }
851
+ export { FilesystemProvider as FilesystemProvider_alias_1 }
852
+ export { FilesystemProvider as FilesystemProvider_alias_2 }
853
+
854
+ export declare const fullSystemPrompt: (info: {
855
+ os: string;
856
+ }, tools: FullToolInfoV2[], toolNamePrefix: string, instructions: string[], scripts: Record<string, string | {
857
+ command: string;
858
+ description: string;
859
+ }>, useNativeTool: boolean) => string;
860
+
861
+ export declare const fullSystemPrompt_alias_1: (info: {
862
+ os: string;
863
+ }, tools: FullToolInfoV2[], toolNamePrefix: string, instructions: string[], scripts: Record<string, string | {
864
+ command: string;
865
+ description: string;
866
+ }>, useNativeTool: boolean) => string;
867
+
868
+ export declare const fullSystemPrompt_alias_2: (info: {
869
+ os: string;
870
+ }, tools: FullToolInfoV2[], toolNamePrefix: string, instructions: string[], scripts: Record<string, string | {
871
+ command: string;
872
+ description: string;
873
+ }>, _interactive: boolean, useNativeTool: boolean) => string;
874
+
875
+ export declare const fullSystemPrompt_alias_3: (info: {
876
+ os: string;
877
+ }, tools: FullToolInfoV2[], toolNamePrefix: string, instructions: string[], scripts: Record<string, string | {
878
+ command: string;
879
+ description: string;
880
+ }>, useNativeTool: boolean) => string;
881
+
882
+ declare type FullToolInfo = ToolInfo & {
883
+ handler: ToolHandler<ToolInfo, any>;
884
+ isAvailable: (provider: any) => boolean;
885
+ };
886
+ export { FullToolInfo }
887
+ export { FullToolInfo as FullToolInfo_alias_1 }
888
+
889
+ declare type FullToolInfoV2 = ToolInfoV2 & {
890
+ handler: ToolHandler<ToolInfoV2, any>;
891
+ isAvailable: (provider: any) => boolean;
892
+ };
893
+ export { FullToolInfoV2 }
894
+ export { FullToolInfoV2 as FullToolInfoV2_alias_1 }
895
+
896
+ declare const generateGitCommitMessage: (ai: LanguageModelV2, params: {
897
+ diff: string;
898
+ context?: string;
899
+ }, usageMeter: UsageMeter) => Promise<string>;
900
+ export { generateGitCommitMessage }
901
+ export { generateGitCommitMessage as generateGitCommitMessage_alias_1 }
902
+
903
+ declare const generateGithubPullRequestDetails: (ai: LanguageModelV2, params: {
904
+ commitMessages: string;
905
+ commitDiff: string;
906
+ context?: string;
907
+ branchName: string;
908
+ }, usageMeter: UsageMeter) => Promise<{
909
+ title: string;
910
+ description: string;
911
+ }>;
912
+ export { generateGithubPullRequestDetails }
913
+ export { generateGithubPullRequestDetails as generateGithubPullRequestDetails_alias_1 }
914
+
915
+ declare const generateProjectConfig: (agent: MultiAgent, params: unknown) => Promise<string>;
916
+ export { generateProjectConfig }
917
+ export { generateProjectConfig as generateProjectConfig_alias_1 }
918
+
919
+ export declare const getArray: <T extends string>(args: Partial<Record<T, ToolParameterValue>> | ToolParameterValue, name: T, defaultValue?: ToolParameterValue[]) => ToolParameterValue[];
920
+
921
+ /**
922
+ * Get the available tools based on the provider and agent availability
923
+ * @param provider The provider to use.
924
+ * @param allTools All possible tools.
925
+ * @param hasAgent Whether the agent has agents.
926
+ * @param permissionLevel Determines which tools are available based on the agent's assigned level.
927
+ * @param interactive Determines whether the `askFollowupQuestion` tool is available.
928
+ * @returns The available tools
929
+ */
930
+ declare const getAvailableTools: <T extends FullToolInfoV2 | FullToolInfo>({ provider, allTools, hasAgent, permissionLevel, interactive, }: {
931
+ provider: any;
932
+ allTools: T[];
933
+ hasAgent: boolean;
934
+ permissionLevel: PermissionLevel;
935
+ interactive: boolean;
936
+ }) => T[];
937
+ export { getAvailableTools }
938
+ export { getAvailableTools as getAvailableTools_alias_1 }
939
+
940
+ export declare const getBoolean: <T extends string>(args: Partial<Record<T, ToolParameterValue>>, name: T, defaultValue?: boolean) => boolean;
941
+
942
+ declare type GetInput<T> = T extends AiToolDefinition<infer Input, any> ? Input : never;
943
+ export { GetInput }
944
+ export { GetInput as GetInput_alias_1 }
945
+ export { GetInput as GetInput_alias_2 }
946
+
947
+ export declare const getInt: <T extends string>(args: Partial<Record<T, ToolParameterValue>>, name: T, defaultValue?: number) => number;
948
+
949
+ declare type GetOutput<T> = T extends AiToolDefinition<any, infer Output> ? Output : never;
950
+ export { GetOutput }
951
+ export { GetOutput as GetOutput_alias_1 }
952
+ export { GetOutput as GetOutput_alias_2 }
953
+
954
+ export declare const getString: <T extends string>(args: Partial<Record<T, string>> | ToolParameterValue, name: T, defaultValue?: string) => string;
955
+
956
+ export declare const getStringArray: <T extends string>(args: Partial<Record<T, ToolParameterValue>>, name: T, defaultValue?: string[]) => string[];
957
+
958
+ export declare const handler: ToolHandler<typeof toolInfo, CommandProvider>;
959
+
960
+ export declare const handler_alias_1: ToolHandler<typeof toolInfo_alias_1, InteractionProvider>;
961
+
962
+ export declare const handler_alias_10: ToolHandler<typeof toolInfo_alias_10, FilesystemProvider>;
963
+
964
+ export declare const handler_alias_11: ToolHandler<typeof toolInfo_alias_11, FilesystemProvider>;
965
+
966
+ export declare const handler_alias_12: ToolHandler<typeof toolInfo_alias_12, FilesystemProvider>;
967
+
968
+ export declare const handler_alias_13: ToolHandler<typeof toolInfo_alias_13, FilesystemProvider>;
969
+
970
+ export declare const handler_alias_2: ToolHandler<typeof toolInfo_alias_2, InteractionProvider>;
971
+
972
+ export declare const handler_alias_3: ToolHandler<typeof toolInfo_alias_3, any>;
973
+
974
+ export declare const handler_alias_4: ToolHandler<typeof toolInfo_alias_4, CommandProvider>;
975
+
976
+ export declare const handler_alias_5: ToolHandler<typeof toolInfo_alias_5, WebProvider>;
977
+
978
+ export declare const handler_alias_6: ToolHandler<typeof toolInfo_alias_6, any>;
979
+
980
+ export declare const handler_alias_7: ToolHandler<typeof toolInfo_alias_7, FilesystemProvider>;
981
+
982
+ export declare const handler_alias_8: ToolHandler<typeof toolInfo_alias_8, FilesystemProvider>;
983
+
984
+ export declare const handler_alias_9: ToolHandler<typeof toolInfo_alias_9, FilesystemProvider>;
985
+
986
+ declare type Input = {
987
+ commitMessages: string;
988
+ commitDiff: string;
989
+ context?: string;
990
+ branchName: string;
991
+ };
992
+
993
+ declare type Input_2 = {
994
+ pullRequestTitle?: string;
995
+ pullRequestDescription?: string;
996
+ commitMessages?: string;
997
+ commitRange?: string;
998
+ staged?: boolean;
999
+ changedFiles?: Array<{
1000
+ path: string;
1001
+ status: string;
1002
+ }>;
1003
+ };
1004
+
1005
+ declare type InteractionProvider = {
1006
+ askFollowupQuestion?: (question: string, options: string[]) => Promise<string>;
1007
+ attemptCompletion?: (result: string) => Promise<string | undefined>;
1008
+ };
1009
+ export { InteractionProvider }
1010
+ export { InteractionProvider as InteractionProvider_alias_1 }
1011
+ export { InteractionProvider as InteractionProvider_alias_2 }
1012
+
1013
+ export declare const isAvailable: (provider: CommandProvider) => boolean;
1014
+
1015
+ export declare const isAvailable_alias_1: (provider: InteractionProvider) => boolean;
1016
+
1017
+ export declare const isAvailable_alias_10: (provider: FilesystemProvider) => boolean;
1018
+
1019
+ export declare const isAvailable_alias_11: (provider: FilesystemProvider) => boolean;
1020
+
1021
+ export declare const isAvailable_alias_12: (provider: FilesystemProvider) => boolean;
1022
+
1023
+ export declare const isAvailable_alias_13: (provider: FilesystemProvider) => boolean;
1024
+
1025
+ export declare const isAvailable_alias_2: (_provider: InteractionProvider) => boolean;
1026
+
1027
+ export declare const isAvailable_alias_3: (_provider: any) => boolean;
1028
+
1029
+ export declare const isAvailable_alias_4: (provider: CommandProvider) => boolean;
1030
+
1031
+ export declare const isAvailable_alias_5: (provider: WebProvider) => boolean;
1032
+
1033
+ export declare const isAvailable_alias_6: (_provider: any) => boolean;
1034
+
1035
+ export declare const isAvailable_alias_7: (provider: FilesystemProvider) => boolean;
1036
+
1037
+ export declare const isAvailable_alias_8: (provider: FilesystemProvider) => boolean;
1038
+
1039
+ export declare const isAvailable_alias_9: (provider: FilesystemProvider) => boolean;
1040
+
1041
+ /**
1042
+ * Joins all given path segments, then normalizes the result.
1043
+ */
1044
+ export declare function join(...parts: string[]): string;
1045
+
1046
+ declare const makeAgentTool: <T extends AiToolDefinitionWithAgent<any, any>>(definition: T) => (options: SharedAgentOptions, params: GetInput<T>) => Promise<GetOutput<T>>;
1047
+ export { makeAgentTool }
1048
+ export { makeAgentTool as makeAgentTool_alias_1 }
1049
+
1050
+ declare const makeMultiAgentTool: <T extends AiToolDefinitionWithMultiAgent<any, any>>(definition: T) => (agent: MultiAgent, params: GetInput<T>) => Promise<GetOutput<T>>;
1051
+ export { makeMultiAgentTool }
1052
+ export { makeMultiAgentTool as makeMultiAgentTool_alias_1 }
1053
+
1054
+ declare const makeTool: <T extends AiToolDefinition<any, any>>(definition: T) => (ai: LanguageModelV2, params: GetInput<T>, usageMeter: UsageMeter) => Promise<GetOutput<T>>;
1055
+ export { makeTool }
1056
+ export { makeTool as makeTool_alias_1 }
1057
+
1058
+ declare class MockProvider implements ToolProvider {
1059
+ readFile(_path: string, _includeIgnored?: boolean): Promise<string>;
1060
+ writeFile(_path: string, _content: string): Promise<void>;
1061
+ removeFile(_path: string): Promise<void>;
1062
+ renameFile(_sourcePath: string, _targetPath: string): Promise<void>;
1063
+ listFiles(_path: string, _recursive: boolean, _maxCount: number, _includeIgnored?: boolean): Promise<[string[], boolean]>;
1064
+ searchFiles(_path: string, _regex: string, _filePattern: string): Promise<string[]>;
1065
+ executeCommand(_command: string, _needApprove: boolean): Promise<{
1066
+ stdout: string;
1067
+ stderr: string;
1068
+ exitCode: number;
1069
+ }>;
1070
+ askFollowupQuestion(_question: string, _options?: string[]): Promise<string>;
1071
+ attemptCompletion(_result: string): Promise<string | undefined>;
1072
+ }
1073
+ export { MockProvider }
1074
+ export { MockProvider as MockProvider_alias_1 }
1075
+ export { MockProvider as MockProvider_alias_2 }
1076
+
1077
+ declare type ModelInfo = {
1078
+ inputPrice: number;
1079
+ outputPrice: number;
1080
+ cacheWritesPrice: number;
1081
+ cacheReadsPrice: number;
1082
+ };
1083
+ export { ModelInfo }
1084
+ export { ModelInfo as ModelInfo_alias_1 }
1085
+
1086
+ declare class MultiAgent {
1087
+ #private;
1088
+ constructor(config: MultiAgentConfig);
1089
+ startTask(options: {
1090
+ agentName: string;
1091
+ task: string;
1092
+ context: string;
1093
+ }): Promise<ExitReason>;
1094
+ continueTask(userMessage: string): Promise<ExitReason>;
1095
+ get hasActiveAgent(): boolean;
1096
+ abort(): void;
1097
+ }
1098
+ export { MultiAgent }
1099
+ export { MultiAgent as MultiAgent_alias_1 }
1100
+ export { MultiAgent as MultiAgent_alias_2 }
1101
+
1102
+ declare type MultiAgentConfig = {
1103
+ createAgent: (name: string) => Promise<AgentBase>;
1104
+ getPrompt?: (name: string, task: string, context: string | undefined, files: string[] | undefined, originalTask: string | undefined) => Promise<string>;
1105
+ };
1106
+ export { MultiAgentConfig }
1107
+ export { MultiAgentConfig as MultiAgentConfig_alias_1 }
1108
+ export { MultiAgentConfig as MultiAgentConfig_alias_2 }
1109
+
1110
+ export declare const objectives: (toolNamePrefix: string) => string;
1111
+
1112
+ declare type Output = {
1113
+ title: string;
1114
+ description: string;
1115
+ };
1116
+
1117
+ declare type Output_2 = {
1118
+ overview: string;
1119
+ specificReviews: SpecificReview[];
1120
+ };
1121
+
1122
+ /**
1123
+ * Parse an assistant's message into an array of text content and tool use content.
1124
+ *
1125
+ * @example
1126
+ * const tools = [
1127
+ * {
1128
+ * name: "search",
1129
+ * parameters: [
1130
+ * {name: "query", type: "string"}
1131
+ * ]
1132
+ * }
1133
+ * ]
1134
+ *
1135
+ * // Text only
1136
+ * parseAssistantMessage("Hello world", tools, "tool_")
1137
+ * // Returns: [{type: "text", content: "Hello world"}]
1138
+ *
1139
+ * // Tool use with parameters
1140
+ * parseAssistantMessage(
1141
+ * `Let me search that for you
1142
+ * <tool_search>
1143
+ * <tool_parameter_query>cats</tool_parameter_query>
1144
+ * </tool_search>
1145
+ * Here are the results`,
1146
+ * tools,
1147
+ * "tool_"
1148
+ * )
1149
+ * // Returns: [
1150
+ * // {type: "text", content: "Let me search that for you"},
1151
+ * // {type: "tool_use", name: "search", params: {query: "cats"}},
1152
+ * // {type: "text", content: "Here are the results"}
1153
+ * // ]
1154
+ *
1155
+ * // Array mode (multiple occurrences of the same parameter)
1156
+ * parseAssistantMessage(
1157
+ * `<tool_read_file>
1158
+ * <tool_parameter_path>test.ts</tool_parameter_path>
1159
+ * <tool_parameter_path>main.ts</tool_parameter_path>
1160
+ * </tool_read_file>`,
1161
+ * tools,
1162
+ * "tool_"
1163
+ * )
1164
+ * // Returns: [
1165
+ * // {type: "tool_use", name: "read_file", params: {path: ["test.ts", "main.ts"]}}
1166
+ * // ]
1167
+ *
1168
+ * // Nested objects
1169
+ * parseAssistantMessage(
1170
+ * `<tool_example>
1171
+ * <tool_parameter_key>
1172
+ * <tool_parameter_key2>value</tool_parameter_key2>
1173
+ * <tool_parameter_key3>value2</tool_parameter_key3>
1174
+ * </tool_parameter_key>
1175
+ * </tool_example>`,
1176
+ * tools,
1177
+ * "tool_"
1178
+ * )
1179
+ * // Returns: [
1180
+ * // {type: "tool_use", name: "example", params: {key: {key2: "value", key3: "value2"}}}
1181
+ * // ]
1182
+ */
1183
+ declare function parseAssistantMessage(assistantMessage: string, tools: ToolInfo[], toolNamePrefix: string): AssistantMessageContent[];
1184
+ export { parseAssistantMessage }
1185
+ export { parseAssistantMessage as parseAssistantMessage_alias_1 }
1186
+ export { parseAssistantMessage as parseAssistantMessage_alias_2 }
1187
+
1188
+ /**
1189
+ * Parse a unified diff hunk header
1190
+ * Format: @@ -oldStart,oldCount +newStart,newCount @@ optional context
1191
+ */
1192
+ export declare function parseHunkHeader(header: string): DiffHunk | null;
1193
+
1194
+ declare enum PermissionLevel {
1195
+ None = 0,
1196
+ Read = 1,
1197
+ Write = 2,
1198
+ Arbitrary = 3
1199
+ }
1200
+ export { PermissionLevel }
1201
+ export { PermissionLevel as PermissionLevel_alias_1 }
1202
+
1203
+ declare enum Policies {
1204
+ TruncateContext = "truncatecontext",
1205
+ EnableCache = "enablecache"
1206
+ }
1207
+ export { Policies }
1208
+ export { Policies as Policies_alias_1 }
1209
+
1210
+ declare const replaceInFile_2: (fileContent: string, diff: string) => ReplaceResult;
1211
+ export { replaceInFile_2 as replaceInFileHelper }
1212
+ export { replaceInFile_2 as replaceInFile_alias_3 }
1213
+ export { replaceInFile_2 as replaceInFile_alias_4 }
1214
+
1215
+ declare type ReplaceResult = {
1216
+ content: string;
1217
+ status: 'no_diff_applied' | 'some_diff_applied' | 'all_diff_applied';
1218
+ appliedCount: number;
1219
+ totalCount: number;
1220
+ };
1221
+ export { ReplaceResult }
1222
+ export { ReplaceResult as ReplaceResult_alias_1 }
1223
+
1224
+ declare const responsePrompts: {
1225
+ readonly errorInvokeTool: (tool: string, error: unknown) => string;
1226
+ readonly requireUseTool: "Error: No tool use detected. You MUST use a tool before proceeding.\ne.g. <tool_tool_name>tool_name</tool_tool_name>\n\nEnsure the opening and closing tags are correctly nested and closed, and that you are using the correct tool name.\nAvoid unnecessary text or symbols before or after the tool use.\nAvoid unnecessary escape characters or special characters.\n";
1227
+ readonly requireUseToolNative: "Error: No tool use detected. You MUST use a tool before proceeding.\n";
1228
+ readonly toolResults: (tool: string, result: UserContent_2) => Array<TextPart | ImagePart | FilePart>;
1229
+ readonly commandResult: (command: string, exitCode: number, stdout: string, stderr: string) => string;
1230
+ };
1231
+ export { responsePrompts }
1232
+ export { responsePrompts as responsePrompts_alias_1 }
1233
+ export { responsePrompts as responsePrompts_alias_2 }
1234
+
1235
+ export declare const retryGuidelines = "\n====\n\nRETRY GUIDELINES\n\n1. Before Retrying\n - Analyze previous attempt's failure\n - Consider alternative approaches\n - Check if similar issues were fixed\n - Verify no new issues were introduced\n\n2. When to Retry\n - Error message changed but issue persists\n - New information available about the root cause\n - Different fixing strategy available\n - Previous attempt partially successful\n\n3. When to Stop\n - Maximum retry limit reached\n - Same error occurs repeatedly\n - Fix would require major refactoring\n - Issue requires human intervention\n\n4. After Maximum Retries\n - Document attempted solutions\n - Explain why the issue remains\n - Suggest manual intervention steps\n - Report any partial improvements";
1236
+
1237
+ declare const reviewDiff: (options: SharedAgentOptions, params: {
1238
+ pullRequestTitle?: string;
1239
+ pullRequestDescription?: string;
1240
+ commitMessages?: string;
1241
+ commitRange?: string;
1242
+ staged?: boolean;
1243
+ changedFiles?: Array<{
1244
+ path: string;
1245
+ status: string;
1246
+ }>;
1247
+ }) => Promise<{
1248
+ overview: string;
1249
+ specificReviews: {
1250
+ file: string;
1251
+ lines: string;
1252
+ review: string;
1253
+ }[];
1254
+ }>;
1255
+ export { reviewDiff }
1256
+ export { reviewDiff as reviewDiff_alias_1 }
1257
+
1258
+ export declare const rules: (toolNamePrefix: string) => string;
1259
+
1260
+ declare type SharedAgentOptions = {
1261
+ ai: LanguageModelV2;
1262
+ os: string;
1263
+ provider: ToolProvider;
1264
+ interactive: boolean;
1265
+ additionalTools?: FullToolInfoV2[];
1266
+ customInstructions?: string[];
1267
+ scripts?: Record<string, string | {
1268
+ command: string;
1269
+ description: string;
1270
+ }>;
1271
+ agents?: Readonly<AgentInfo[]>;
1272
+ callback?: TaskEventCallback;
1273
+ policies: AgentPolicy[];
1274
+ retryCount?: number;
1275
+ requestTimeoutSeconds?: number;
1276
+ toolFormat: ToolFormat;
1277
+ parameters?: Record<string, any>;
1278
+ usageMeter?: UsageMeter;
1279
+ };
1280
+ export { SharedAgentOptions }
1281
+ export { SharedAgentOptions as SharedAgentOptions_alias_1 }
1282
+ export { SharedAgentOptions as SharedAgentOptions_alias_2 }
1283
+
1284
+ declare type SpecificReview = {
1285
+ file: string;
1286
+ lines: string;
1287
+ review: string;
1288
+ };
1289
+
1290
+ declare const systemInformation: (info: {
1291
+ os: string;
1292
+ }) => string;
1293
+ export { systemInformation }
1294
+ export { systemInformation as systemInformation_alias_1 }
1295
+ export { systemInformation as systemInformation_alias_2 }
1296
+
1297
+ /**
1298
+ * Union type of all possible task events
1299
+ */
1300
+ declare type TaskEvent = TaskEventStartTask | TaskEventStartRequest | TaskEventEndRequest | TaskEventUsage | TaskEventText | TaskEventTool | TaskEventToolPause | TaskEventToolHandOverDelegate | TaskEventUsageExceeded | TaskEventEndTask;
1301
+ export { TaskEvent }
1302
+ export { TaskEvent as TaskEvent_alias_1 }
1303
+ export { TaskEvent as TaskEvent_alias_2 }
1304
+
1305
+ /**
1306
+ * Base interface for all task events
1307
+ */
1308
+ declare interface TaskEventBase {
1309
+ kind: TaskEventKind;
1310
+ agent: AgentBase;
1311
+ }
1312
+ export { TaskEventBase }
1313
+ export { TaskEventBase as TaskEventBase_alias_1 }
1314
+ export { TaskEventBase as TaskEventBase_alias_2 }
1315
+
1316
+ declare type TaskEventCallback = (event: TaskEvent) => void | Promise<void>;
1317
+ export { TaskEventCallback }
1318
+ export { TaskEventCallback as TaskEventCallback_alias_1 }
1319
+ export { TaskEventCallback as TaskEventCallback_alias_2 }
1320
+
1321
+ /**
1322
+ * Event for request end
1323
+ */
1324
+ declare interface TaskEventEndRequest extends TaskEventBase {
1325
+ kind: TaskEventKind.EndRequest;
1326
+ message: string;
1327
+ }
1328
+ export { TaskEventEndRequest }
1329
+ export { TaskEventEndRequest as TaskEventEndRequest_alias_1 }
1330
+ export { TaskEventEndRequest as TaskEventEndRequest_alias_2 }
1331
+
1332
+ /**
1333
+ * Event for task end
1334
+ */
1335
+ declare interface TaskEventEndTask extends TaskEventBase {
1336
+ kind: TaskEventKind.EndTask;
1337
+ exitReason: ExitReason;
1338
+ }
1339
+ export { TaskEventEndTask }
1340
+ export { TaskEventEndTask as TaskEventEndTask_alias_1 }
1341
+ export { TaskEventEndTask as TaskEventEndTask_alias_2 }
1342
+
1343
+ /**
1344
+ * Enum representing different kinds of task events
1345
+ */
1346
+ declare enum TaskEventKind {
1347
+ StartTask = "StartTask",
1348
+ StartRequest = "StartRequest",
1349
+ EndRequest = "EndRequest",
1350
+ Usage = "Usage",
1351
+ Text = "Text",
1352
+ Reasoning = "Reasoning",
1353
+ ToolUse = "ToolUse",
1354
+ ToolReply = "ToolReply",
1355
+ ToolInvalid = "ToolInvalid",
1356
+ ToolError = "ToolError",
1357
+ ToolInterrupted = "ToolInterrupted",
1358
+ ToolHandOver = "ToolHandOver",
1359
+ ToolDelegate = "ToolDelegate",
1360
+ ToolPause = "ToolPause",
1361
+ UsageExceeded = "UsageExceeded",
1362
+ EndTask = "EndTask"
1363
+ }
1364
+ export { TaskEventKind }
1365
+ export { TaskEventKind as TaskEventKind_alias_1 }
1366
+ export { TaskEventKind as TaskEventKind_alias_2 }
1367
+
1368
+ /**
1369
+ * Event for request start
1370
+ */
1371
+ declare interface TaskEventStartRequest extends TaskEventBase {
1372
+ kind: TaskEventKind.StartRequest;
1373
+ userMessage: ModelMessage;
1374
+ }
1375
+ export { TaskEventStartRequest }
1376
+ export { TaskEventStartRequest as TaskEventStartRequest_alias_1 }
1377
+ export { TaskEventStartRequest as TaskEventStartRequest_alias_2 }
1378
+
1379
+ /**
1380
+ * Event for task start
1381
+ */
1382
+ declare interface TaskEventStartTask extends TaskEventBase {
1383
+ kind: TaskEventKind.StartTask;
1384
+ systemPrompt: string;
1385
+ }
1386
+ export { TaskEventStartTask }
1387
+ export { TaskEventStartTask as TaskEventStartTask_alias_1 }
1388
+ export { TaskEventStartTask as TaskEventStartTask_alias_2 }
1389
+
1390
+ /**
1391
+ * Event for text/reasoning updates
1392
+ */
1393
+ declare interface TaskEventText extends TaskEventBase {
1394
+ kind: TaskEventKind.Text | TaskEventKind.Reasoning;
1395
+ newText: string;
1396
+ }
1397
+ export { TaskEventText }
1398
+ export { TaskEventText as TaskEventText_alias_1 }
1399
+ export { TaskEventText as TaskEventText_alias_2 }
1400
+
1401
+ /**
1402
+ * Event for tool-related updates
1403
+ */
1404
+ declare interface TaskEventTool extends TaskEventBase {
1405
+ kind: TaskEventKind.ToolUse | TaskEventKind.ToolReply | TaskEventKind.ToolInvalid | TaskEventKind.ToolError | TaskEventKind.ToolInterrupted;
1406
+ tool: string;
1407
+ content: any;
1408
+ }
1409
+ export { TaskEventTool }
1410
+ export { TaskEventTool as TaskEventTool_alias_1 }
1411
+ export { TaskEventTool as TaskEventTool_alias_2 }
1412
+
1413
+ /**
1414
+ * Event for tool handover
1415
+ */
1416
+ declare interface TaskEventToolHandOverDelegate extends TaskEventBase {
1417
+ kind: TaskEventKind.ToolHandOver | TaskEventKind.ToolDelegate;
1418
+ tool: string;
1419
+ agentName: string;
1420
+ task: string;
1421
+ context?: string;
1422
+ files?: string[];
1423
+ }
1424
+ export { TaskEventToolHandOverDelegate }
1425
+ export { TaskEventToolHandOverDelegate as TaskEventToolHandOverDelegate_alias_1 }
1426
+ export { TaskEventToolHandOverDelegate as TaskEventToolHandOverDelegate_alias_2 }
1427
+
1428
+ declare interface TaskEventToolPause extends TaskEventBase {
1429
+ kind: TaskEventKind.ToolPause;
1430
+ tool: string;
1431
+ object: any;
1432
+ }
1433
+ export { TaskEventToolPause }
1434
+ export { TaskEventToolPause as TaskEventToolPause_alias_1 }
1435
+ export { TaskEventToolPause as TaskEventToolPause_alias_2 }
1436
+
1437
+ /**
1438
+ * Event for API usage updates
1439
+ */
1440
+ declare interface TaskEventUsage extends TaskEventBase {
1441
+ kind: TaskEventKind.Usage;
1442
+ }
1443
+ export { TaskEventUsage }
1444
+ export { TaskEventUsage as TaskEventUsage_alias_1 }
1445
+ export { TaskEventUsage as TaskEventUsage_alias_2 }
1446
+
1447
+ /**
1448
+ * Event for task usage exceeded
1449
+ */
1450
+ declare interface TaskEventUsageExceeded extends TaskEventBase {
1451
+ kind: TaskEventKind.UsageExceeded;
1452
+ }
1453
+ export { TaskEventUsageExceeded }
1454
+ export { TaskEventUsageExceeded as TaskEventUsageExceeded_alias_1 }
1455
+ export { TaskEventUsageExceeded as TaskEventUsageExceeded_alias_2 }
1456
+
1457
+ declare interface TextContent {
1458
+ type: 'text';
1459
+ content: string;
1460
+ }
1461
+ export { TextContent }
1462
+ export { TextContent as TextContent_alias_1 }
1463
+ export { TextContent as TextContent_alias_2 }
1464
+
1465
+ declare type ToolExample = {
1466
+ description: string;
1467
+ input: Record<string, ToolParameterValue>;
1468
+ };
1469
+ export { ToolExample }
1470
+ export { ToolExample as ToolExample_alias_1 }
1471
+
1472
+ declare type ToolFormat = 'native' | 'polka-codes';
1473
+ export { ToolFormat }
1474
+ export { ToolFormat as ToolFormat_alias_1 }
1475
+
1476
+ declare type ToolHandler<_T, P> = (provider: P, args: Partial<Record<string, ToolParameterValue>>) => Promise<ToolResponse>;
1477
+ export { ToolHandler }
1478
+ export { ToolHandler as ToolHandler_alias_1 }
1479
+
1480
+ declare type ToolInfo = {
1481
+ name: string;
1482
+ description: string;
1483
+ parameters: ToolParameter[];
1484
+ examples?: ToolExample[];
1485
+ permissionLevel: PermissionLevel;
1486
+ };
1487
+ export { ToolInfo }
1488
+ export { ToolInfo as ToolInfo_alias_1 }
1489
+
1490
+ export declare const toolInfo: {
1491
+ readonly name: "git_diff";
1492
+ readonly description: "Get the git diff for the current repository. Can be used to get staged changes, unstaged changes, or changes between commits. By default, it returns unstaged changes.";
1493
+ readonly parameters: z.ZodObject<{
1494
+ staged: z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodDefault<z.ZodOptional<z.ZodBoolean>>>;
1495
+ commitRange: z.ZodOptional<z.ZodString>;
1496
+ file: z.ZodOptional<z.ZodString>;
1497
+ contextLines: z.ZodDefault<z.ZodOptional<z.ZodCoercedNumber<unknown>>>;
1498
+ includeLineNumbers: z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodDefault<z.ZodOptional<z.ZodBoolean>>>;
1499
+ }, z.core.$strip>;
1500
+ readonly permissionLevel: PermissionLevel.Read;
1501
+ };
1502
+
1503
+ export declare const toolInfo_alias_1: {
1504
+ readonly name: "ask_followup_question";
1505
+ readonly description: "Call this when vital details are missing. Pose each follow-up as one direct, unambiguous question. If it speeds the reply, add up to five short, mutually-exclusive answer options. Group any related questions in the same call to avoid a back-and-forth chain.";
1506
+ readonly parameters: z.ZodObject<{
1507
+ questions: z.ZodArray<z.ZodObject<{
1508
+ prompt: z.ZodString;
1509
+ options: z.ZodDefault<z.ZodArray<z.ZodString>>;
1510
+ }, z.core.$strip>>;
1511
+ }, z.core.$strip>;
1512
+ readonly permissionLevel: PermissionLevel.None;
1513
+ };
1514
+
1515
+ export declare const toolInfo_alias_10: {
1516
+ readonly name: "rename_file";
1517
+ readonly description: "Request to rename a file from source path to target path.";
1518
+ readonly parameters: z.ZodObject<{
1519
+ source_path: z.ZodString;
1520
+ target_path: z.ZodString;
1521
+ }, z.core.$strip>;
1522
+ readonly permissionLevel: PermissionLevel.Write;
1523
+ };
1524
+
1525
+ export declare const toolInfo_alias_11: {
1526
+ readonly name: "replace_in_file";
1527
+ readonly description: "Request to replace sections of content in an existing file using SEARCH/REPLACE blocks that define exact changes to specific parts of the file. This tool should be used when you need to make targeted changes to specific parts of a file.";
1528
+ readonly parameters: z.ZodObject<{
1529
+ path: z.ZodString;
1530
+ diff: z.ZodString;
1531
+ }, z.core.$strip>;
1532
+ readonly permissionLevel: PermissionLevel.Write;
1533
+ };
1534
+
1535
+ export declare const toolInfo_alias_12: {
1536
+ readonly name: "search_files";
1537
+ readonly description: "Request to perform a regex search across files in a specified directory, outputting context-rich results that include surrounding lines. This tool searches for patterns or specific content across multiple files, displaying each match with encapsulating context.";
1538
+ readonly parameters: z.ZodObject<{
1539
+ path: z.ZodString;
1540
+ regex: z.ZodString;
1541
+ filePattern: z.ZodOptional<z.ZodString>;
1542
+ }, z.core.$strip>;
1543
+ readonly permissionLevel: PermissionLevel.Read;
1544
+ };
1545
+
1546
+ export declare const toolInfo_alias_13: {
1547
+ readonly name: "write_to_file";
1548
+ readonly description: "Request to write content to a file at the specified path. If the file exists, it will be overwritten with the provided content. If the file doesn't exist, it will be created. This tool will automatically create any directories needed to write the file. Ensure that the output content does not include incorrect escaped character patterns such as `&lt;`, `&gt;`, or `&amp;`. Also ensure there is no unwanted CDATA tags in the content.";
1549
+ readonly parameters: z.ZodObject<{
1550
+ path: z.ZodString;
1551
+ content: z.ZodString;
1552
+ }, z.core.$strip>;
1553
+ readonly permissionLevel: PermissionLevel.Write;
1554
+ };
1555
+
1556
+ export declare const toolInfo_alias_2: {
1557
+ readonly name: "attempt_completion";
1558
+ readonly description: "Use this tool when you believe the user’s requested task is complete. Indicate that your work is finished, but acknowledge the user may still provide additional instructions or questions if they want to continue. This tool MUST NOT to be used with any other tool.";
1559
+ readonly parameters: z.ZodObject<{
1560
+ result: z.ZodString;
1561
+ }, z.core.$strip>;
1562
+ readonly permissionLevel: PermissionLevel.None;
1563
+ };
1564
+
1565
+ export declare const toolInfo_alias_3: {
1566
+ readonly name: "delegate";
1567
+ readonly description: "Temporarily delegate a task to another agent and receive the result back. This tool MUST NOT to be used with any other tool.";
1568
+ readonly parameters: z.ZodObject<{
1569
+ agentName: z.ZodString;
1570
+ task: z.ZodString;
1571
+ context: z.ZodString;
1572
+ files: z.ZodOptional<z.ZodPipe<z.ZodTransform<string[], unknown>, z.ZodArray<z.ZodString>>>;
1573
+ }, z.core.$strip>;
1574
+ readonly permissionLevel: PermissionLevel.None;
1575
+ };
1576
+
1577
+ export declare const toolInfo_alias_4: {
1578
+ readonly name: "execute_command";
1579
+ readonly description: "Run a single CLI command. The command is always executed in the project-root working directory (regardless of earlier commands). Prefer one-off shell commands over wrapper scripts for flexibility. **IMPORTANT**: After an `execute_command` call, you MUST stop and NOT allowed to make further tool calls in the same message.";
1580
+ readonly parameters: z.ZodObject<{
1581
+ command: z.ZodString;
1582
+ requiresApproval: z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodDefault<z.ZodOptional<z.ZodBoolean>>>;
1583
+ }, z.core.$strip>;
1584
+ readonly permissionLevel: PermissionLevel.Arbitrary;
1585
+ };
1586
+
1587
+ export declare const toolInfo_alias_5: {
1588
+ readonly name: "fetch_url";
1589
+ readonly description: "Fetch the content located at one or more HTTP(S) URLs and return it in Markdown format. This works for standard web pages as well as raw files (e.g. README.md, source code) hosted on platforms like GitHub.";
1590
+ readonly parameters: z.ZodObject<{
1591
+ url: z.ZodPipe<z.ZodTransform<string[], unknown>, z.ZodArray<z.ZodString>>;
1592
+ }, z.core.$strip>;
1593
+ readonly permissionLevel: PermissionLevel.Read;
1594
+ };
1595
+
1596
+ export declare const toolInfo_alias_6: {
1597
+ readonly name: "hand_over";
1598
+ readonly description: "Hand over the current task to another agent to complete. This tool MUST NOT to be used with any other tool.";
1599
+ readonly parameters: z.ZodObject<{
1600
+ agentName: z.ZodString;
1601
+ task: z.ZodString;
1602
+ context: z.ZodString;
1603
+ files: z.ZodOptional<z.ZodPipe<z.ZodTransform<string[], unknown>, z.ZodArray<z.ZodString>>>;
1604
+ }, z.core.$strip>;
1605
+ readonly permissionLevel: PermissionLevel.None;
1606
+ };
1607
+
1608
+ export declare const toolInfo_alias_7: {
1609
+ readonly name: "list_files";
1610
+ readonly description: "Request to list files and directories within the specified directory. If recursive is true, it will list all files and directories recursively. If recursive is false or not provided, it will only list the top-level contents. Do not use this tool to confirm the existence of files you may have created, as the user will let you know if the files were created successfully or not.";
1611
+ readonly parameters: z.ZodObject<{
1612
+ path: z.ZodString;
1613
+ maxCount: z.ZodDefault<z.ZodOptional<z.ZodCoercedNumber<unknown>>>;
1614
+ recursive: z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodDefault<z.ZodOptional<z.ZodBoolean>>>;
1615
+ includeIgnored: z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodDefault<z.ZodOptional<z.ZodBoolean>>>;
1616
+ }, z.core.$strip>;
1617
+ readonly permissionLevel: PermissionLevel.Read;
1618
+ };
1619
+
1620
+ export declare const toolInfo_alias_8: {
1621
+ readonly name: "read_file";
1622
+ readonly description: "Request to read the contents of one or multiple files at the specified paths. Use comma separated paths to read multiple files. Use this when you need to examine the contents of an existing file you do not know the contents of, for example to analyze code, review text files, or extract information from configuration files. May not be suitable for other types of binary files, as it returns the raw content as a string. Try to list all the potential files are relevent to the task, and then use this tool to read all the relevant files.";
1623
+ readonly parameters: z.ZodObject<{
1624
+ path: z.ZodPipe<z.ZodTransform<string[], unknown>, z.ZodArray<z.ZodString>>;
1625
+ includeIgnored: z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodDefault<z.ZodOptional<z.ZodBoolean>>>;
1626
+ }, z.core.$strip>;
1627
+ readonly permissionLevel: PermissionLevel.Read;
1628
+ };
1629
+
1630
+ export declare const toolInfo_alias_9: {
1631
+ readonly name: "remove_file";
1632
+ readonly description: "Request to remove a file at the specified path.";
1633
+ readonly parameters: z.ZodObject<{
1634
+ path: z.ZodString;
1635
+ }, z.core.$strip>;
1636
+ readonly permissionLevel: PermissionLevel.Write;
1637
+ };
1638
+
1639
+ declare type ToolInfoV2 = {
1640
+ name: string;
1641
+ description: string;
1642
+ parameters: z.ZodObject<any>;
1643
+ permissionLevel: PermissionLevel;
1644
+ };
1645
+ export { ToolInfoV2 }
1646
+ export { ToolInfoV2 as ToolInfoV2_alias_1 }
1647
+
1648
+ declare type ToolParameter = {
1649
+ name: string;
1650
+ description: string;
1651
+ required: boolean;
1652
+ usageValue?: string;
1653
+ allowMultiple?: boolean;
1654
+ children?: ToolParameter[];
1655
+ };
1656
+ export { ToolParameter }
1657
+ export { ToolParameter as ToolParameter_alias_1 }
1658
+
1659
+ declare type ToolParameterValue = string | {
1660
+ [key: string]: ToolParameterValue;
1661
+ } | ToolParameterValue[];
1662
+ export { ToolParameterValue }
1663
+ export { ToolParameterValue as ToolParameterValue_alias_1 }
1664
+
1665
+ declare type ToolProvider = FilesystemProvider & CommandProvider & InteractionProvider & WebProvider;
1666
+ export { ToolProvider }
1667
+ export { ToolProvider as ToolProvider_alias_1 }
1668
+ export { ToolProvider as ToolProvider_alias_2 }
1669
+
1670
+ declare type ToolResponse = ToolResponseReply | ToolResponseExit | ToolResponseInvalid | ToolResponseError | ToolResponseInterrupted | ToolResponseHandOver | ToolResponseDelegate | ToolResponsePause;
1671
+ export { ToolResponse }
1672
+ export { ToolResponse as ToolResponse_alias_1 }
1673
+
1674
+ declare type ToolResponseDelegate = {
1675
+ type: ToolResponseType.Delegate;
1676
+ agentName: string;
1677
+ task: string;
1678
+ context?: string;
1679
+ files?: string[];
1680
+ };
1681
+ export { ToolResponseDelegate }
1682
+ export { ToolResponseDelegate as ToolResponseDelegate_alias_1 }
1683
+
1684
+ declare type ToolResponseError = {
1685
+ type: ToolResponseType.Error;
1686
+ message: string;
1687
+ canRetry?: boolean;
1688
+ };
1689
+ export { ToolResponseError }
1690
+ export { ToolResponseError as ToolResponseError_alias_1 }
1691
+
1692
+ declare type ToolResponseExit = {
1693
+ type: ToolResponseType.Exit;
1694
+ message: string;
1695
+ object?: any;
1696
+ };
1697
+ export { ToolResponseExit }
1698
+ export { ToolResponseExit as ToolResponseExit_alias_1 }
1699
+
1700
+ declare type ToolResponseHandOver = {
1701
+ type: ToolResponseType.HandOver;
1702
+ agentName: string;
1703
+ task: string;
1704
+ context?: string;
1705
+ files?: string[];
1706
+ };
1707
+ export { ToolResponseHandOver }
1708
+ export { ToolResponseHandOver as ToolResponseHandOver_alias_1 }
1709
+
1710
+ declare type ToolResponseInterrupted = {
1711
+ type: ToolResponseType.Interrupted;
1712
+ message: string;
1713
+ };
1714
+ export { ToolResponseInterrupted }
1715
+ export { ToolResponseInterrupted as ToolResponseInterrupted_alias_1 }
1716
+
1717
+ declare type ToolResponseInvalid = {
1718
+ type: ToolResponseType.Invalid;
1719
+ message: string;
1720
+ };
1721
+ export { ToolResponseInvalid }
1722
+ export { ToolResponseInvalid as ToolResponseInvalid_alias_1 }
1723
+
1724
+ declare type ToolResponseOrToolPause = {
1725
+ type: 'response';
1726
+ tool: string;
1727
+ response: UserContent;
1728
+ id?: string;
1729
+ } | {
1730
+ type: 'pause';
1731
+ tool: string;
1732
+ object: any;
1733
+ id?: string;
1734
+ };
1735
+ export { ToolResponseOrToolPause }
1736
+ export { ToolResponseOrToolPause as ToolResponseOrToolPause_alias_1 }
1737
+ export { ToolResponseOrToolPause as ToolResponseOrToolPause_alias_2 }
1738
+
1739
+ declare type ToolResponsePause = {
1740
+ type: ToolResponseType.Pause;
1741
+ object: any;
1742
+ };
1743
+ export { ToolResponsePause }
1744
+ export { ToolResponsePause as ToolResponsePause_alias_1 }
1745
+
1746
+ declare type ToolResponseReply = {
1747
+ type: ToolResponseType.Reply;
1748
+ message: UserContent;
1749
+ };
1750
+ export { ToolResponseReply }
1751
+ export { ToolResponseReply as ToolResponseReply_alias_1 }
1752
+
1753
+ declare enum ToolResponseType {
1754
+ Reply = "Reply",
1755
+ Exit = "Exit",
1756
+ Invalid = "Invalid",
1757
+ Error = "Error",
1758
+ Interrupted = "Interrupted",
1759
+ HandOver = "HandOver",
1760
+ Delegate = "Delegate",
1761
+ Pause = "Pause"
1762
+ }
1763
+ export { ToolResponseType }
1764
+ export { ToolResponseType as ToolResponseType_alias_1 }
1765
+
1766
+ declare interface ToolUse {
1767
+ id?: string;
1768
+ type: 'tool_use';
1769
+ name: string;
1770
+ params: Record<string, any>;
1771
+ }
1772
+ export { ToolUse }
1773
+ export { ToolUse as ToolUse_alias_1 }
1774
+ export { ToolUse as ToolUse_alias_2 }
1775
+
1776
+ declare const toolUsePrompt: (useNativeTool: boolean, tools: FullToolInfoV2[], toolNamePrefix: string) => string;
1777
+ export { toolUsePrompt }
1778
+ export { toolUsePrompt as toolUsePrompt_alias_1 }
1779
+ export { toolUsePrompt as toolUsePrompt_alias_2 }
1780
+
1781
+ declare type Totals = {
1782
+ input: number;
1783
+ output: number;
1784
+ cachedRead: number;
1785
+ cost: number;
1786
+ };
1787
+
1788
+ export declare function toToolInfoV1(tool: FullToolInfoV2): FullToolInfo;
1789
+
1790
+ declare const TruncateContextPolicy: () => {
1791
+ name: Policies;
1792
+ onBeforeRequest(agent: AgentBase): Promise<void>;
1793
+ };
1794
+ export { TruncateContextPolicy }
1795
+ export { TruncateContextPolicy as TruncateContextPolicy_alias_1 }
1796
+ export { TruncateContextPolicy as TruncateContextPolicy_alias_2 }
1797
+ export { TruncateContextPolicy as TruncateContextPolicy_alias_3 }
1798
+
1799
+ /**
1800
+ * Tracks token / cost usage across any mix of LLM models.
1801
+ * Supports optional caps on total messages and total cost.
1802
+ */
1803
+ declare class UsageMeter {
1804
+ #private;
1805
+ constructor(modelInfos?: Record<string, Record<string, Partial<ModelInfo>>>, opts?: {
1806
+ maxMessages?: number;
1807
+ maxCost?: number;
1808
+ });
1809
+ addUsage(llm: LanguageModelV2, resp: {
1810
+ usage: LanguageModelV2Usage;
1811
+ providerMetadata?: any;
1812
+ } | {
1813
+ totalUsage: LanguageModelV2Usage;
1814
+ providerMetadata?: any;
1815
+ }, options?: {
1816
+ modelInfo?: ModelInfo;
1817
+ }): void;
1818
+ /** Override the running totals (e.g., restore from saved state). */
1819
+ setUsage(newUsage: Partial<Totals & {
1820
+ calls: number;
1821
+ }>): void;
1822
+ /** Manually bump the message count (useful if you record some calls without token info). */
1823
+ incrementMessageCount(n?: number): void;
1824
+ /** Reset the running totals. */
1825
+ resetUsage(): void;
1826
+ /** Return true once either messages or cost exceed the configured caps. */
1827
+ isLimitExceeded(): {
1828
+ messageCount: boolean;
1829
+ maxMessages: number;
1830
+ cost: boolean;
1831
+ maxCost: number;
1832
+ result: boolean;
1833
+ };
1834
+ /** Same as isLimitExceeded but throws an error if a limit is hit. */
1835
+ checkLimit(): void;
1836
+ /** Getter for the aggregated totals (immutable copy). */
1837
+ get usage(): {
1838
+ messageCount: number;
1839
+ input: number;
1840
+ output: number;
1841
+ cachedRead: number;
1842
+ cost: number;
1843
+ };
1844
+ /** Print a concise usage summary to console. */
1845
+ printUsage(customConsole?: Console): void;
1846
+ onFinishHandler(llm: LanguageModelV2): (evt: {
1847
+ totalUsage: LanguageModelV2Usage;
1848
+ providerMetadata: any;
1849
+ }) => void;
1850
+ }
1851
+ export { UsageMeter }
1852
+ export { UsageMeter as UsageMeter_alias_1 }
1853
+
1854
+ declare type WebProvider = {
1855
+ fetchUrl?: (url: string) => Promise<string>;
1856
+ };
1857
+ export { WebProvider }
1858
+ export { WebProvider as WebProvider_alias_1 }
1859
+ export { WebProvider as WebProvider_alias_2 }
1860
+
1861
+ export { }