@polka-codes/core 0.9.45 → 0.9.47

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.
@@ -1,257 +1,12 @@
1
1
  import type { FilePart } from 'ai';
2
2
  import type { ImagePart } from 'ai';
3
3
  import type { JSONValue } from '@ai-sdk/provider';
4
- import { LanguageModelUsage } from 'ai';
5
4
  import type { LanguageModelV2 } from '@ai-sdk/provider';
6
5
  import type { LanguageModelV2ToolResultOutput } from '@ai-sdk/provider';
7
6
  import type { LanguageModelV2Usage } from '@ai-sdk/provider';
8
- import type { ModelMessage } from '@ai-sdk/provider-utils';
9
- import type { ModelMessage as ModelMessage_2 } from 'ai';
10
7
  import type { TextPart } from 'ai';
11
- import type { ToolModelMessage } from '@ai-sdk/provider-utils';
12
- import type { UserContent } from '@ai-sdk/provider-utils';
13
- import type { UserContent as UserContent_2 } from 'ai';
14
- import type { UserModelMessage } from '@ai-sdk/provider-utils';
15
8
  import { z } from 'zod';
16
9
 
17
- declare abstract class AgentBase {
18
- #private;
19
- readonly ai: LanguageModelV2;
20
- protected readonly config: Readonly<AgentBaseConfig>;
21
- protected readonly handlers: Record<string, FullToolInfoV2>;
22
- constructor(name: string, ai: LanguageModelV2, config: AgentBaseConfig);
23
- abort(): void;
24
- get parameters(): Readonly<Record<string, any>>;
25
- get messages(): Readonly<ModelMessage[]>;
26
- setMessages(messages: Readonly<ModelMessage[]>): void;
27
- start(prompt: UserContent): Promise<ExitReason>;
28
- step(message: (UserModelMessage | ToolModelMessage)[]): Promise<AssistantMessageContent[]>;
29
- handleStepResponse(response: AssistantMessageContent[]): Promise<{
30
- type: "reply";
31
- message: (UserModelMessage | ToolModelMessage)[];
32
- } | {
33
- type: "exit";
34
- reason: ExitReason;
35
- }>;
36
- continueTask(userMessage: UserContent): Promise<ExitReason>;
37
- protected abstract onBeforeInvokeTool(name: string, args: Record<string, string>): Promise<ToolResponse | undefined>;
38
- get model(): string;
39
- get usage(): {
40
- input: number;
41
- output: number;
42
- cachedRead: number;
43
- cost: number;
44
- messageCount: number;
45
- };
46
- }
47
- export { AgentBase }
48
- export { AgentBase as AgentBase_alias_1 }
49
- export { AgentBase as AgentBase_alias_2 }
50
-
51
- declare type AgentBaseConfig = {
52
- systemPrompt: string;
53
- tools: FullToolInfoV2[];
54
- toolNamePrefix: string;
55
- provider: ToolProvider;
56
- agents?: Readonly<AgentInfo[]>;
57
- scripts?: Record<string, string | {
58
- command: string;
59
- description: string;
60
- }>;
61
- callback?: TaskEventCallback;
62
- policies: AgentPolicy[];
63
- retryCount?: number;
64
- requestTimeoutSeconds?: number;
65
- toolFormat: ToolFormat;
66
- parameters: Record<string, any>;
67
- usageMeter: UsageMeter;
68
- requireToolUse: boolean;
69
- };
70
- export { AgentBaseConfig }
71
- export { AgentBaseConfig as AgentBaseConfig_alias_1 }
72
- export { AgentBaseConfig as AgentBaseConfig_alias_2 }
73
-
74
- declare type AgentInfo = {
75
- name: string;
76
- responsibilities: string[];
77
- };
78
- export { AgentInfo }
79
- export { AgentInfo as AgentInfo_alias_1 }
80
- export { AgentInfo as AgentInfo_alias_2 }
81
-
82
- declare type AgentNameType = (typeof allAgents)[number]['name'];
83
- export { AgentNameType }
84
- export { AgentNameType as AgentNameType_alias_1 }
85
-
86
- declare type AgentPolicy = (tools: Record<string, FullToolInfoV2>, parameters: Record<string, any>) => AgentPolicyInstance | undefined;
87
- export { AgentPolicy }
88
- export { AgentPolicy as AgentPolicy_alias_1 }
89
- export { AgentPolicy as AgentPolicy_alias_2 }
90
-
91
- declare type AgentPolicyInstance = {
92
- name: string;
93
- tools?: FullToolInfoV2[];
94
- prompt?: string;
95
- onBeforeInvokeTool?: (name: string, args: Record<string, string>) => Promise<ToolResponse | undefined>;
96
- onBeforeRequest?: (agent: AgentBase) => Promise<void>;
97
- prepareMessages?: (agent: AgentBase, messages: ModelMessage_2[]) => Promise<ModelMessage_2[]>;
98
- };
99
- export { AgentPolicyInstance }
100
- export { AgentPolicyInstance as AgentPolicyInstance_alias_1 }
101
- export { AgentPolicyInstance as AgentPolicyInstance_alias_2 }
102
-
103
- declare const agentsPrompt: (agents: Readonly<AgentInfo[]>, name: string) => string;
104
- export { agentsPrompt }
105
- export { agentsPrompt as agentsPrompt_alias_1 }
106
- export { agentsPrompt as agentsPrompt_alias_2 }
107
-
108
- declare type AiToolDefinition<Input, Output = string> = {
109
- name: string;
110
- description: string;
111
- prompt: string;
112
- formatInput: (params: Input) => string;
113
- parseOutput: (output: string) => Output;
114
- };
115
- export { AiToolDefinition }
116
- export { AiToolDefinition as AiToolDefinition_alias_1 }
117
- export { AiToolDefinition as AiToolDefinition_alias_2 }
118
-
119
- export declare type AiToolDefinitionWithAgent<Input, Output = string> = AiToolDefinition<Input, Output> & {
120
- agent: (options: SharedAgentOptions) => AgentBase;
121
- };
122
-
123
- export declare type AiToolDefinitionWithMultiAgent<Input, Output = string> = AiToolDefinition<Input, Output> & {
124
- agent: AgentNameType;
125
- };
126
-
127
- declare const allAgents: readonly [{
128
- readonly name: "architect";
129
- 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."];
130
- }, {
131
- readonly name: "coder";
132
- 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."];
133
- }, {
134
- readonly name: "analyzer";
135
- 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"];
136
- }, {
137
- readonly name: "codefixer";
138
- readonly responsibilities: ["Fixing type errors and type-related issues", "Resolving failing tests", "Addressing code quality issues", "Tracking and reporting unfixed issues"];
139
- }];
140
- export { allAgents }
141
- export { allAgents as allAgents_alias_1 }
142
-
143
- declare class AnalyzerAgent extends AgentBase {
144
- constructor(options: AnalyzerAgentOptions);
145
- onBeforeInvokeTool(): Promise<undefined>;
146
- }
147
- export { AnalyzerAgent }
148
- export { AnalyzerAgent as AnalyzerAgent_alias_1 }
149
- export { AnalyzerAgent as AnalyzerAgent_alias_2 }
150
-
151
- declare const analyzerAgentInfo: {
152
- readonly name: "analyzer";
153
- 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"];
154
- };
155
- export { analyzerAgentInfo }
156
- export { analyzerAgentInfo as analyzerAgentInfo_alias_1 }
157
- export { analyzerAgentInfo as analyzerAgentInfo_alias_2 }
158
-
159
- declare type AnalyzerAgentOptions = SharedAgentOptions;
160
- export { AnalyzerAgentOptions }
161
- export { AnalyzerAgentOptions as AnalyzerAgentOptions_alias_1 }
162
- export { AnalyzerAgentOptions as AnalyzerAgentOptions_alias_2 }
163
-
164
- declare class ArchitectAgent extends AgentBase {
165
- constructor(options: ArchitectAgentOptions);
166
- onBeforeInvokeTool(): Promise<undefined>;
167
- }
168
- export { ArchitectAgent }
169
- export { ArchitectAgent as ArchitectAgent_alias_1 }
170
- export { ArchitectAgent as ArchitectAgent_alias_2 }
171
-
172
- declare const architectAgentInfo: {
173
- readonly name: "architect";
174
- 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."];
175
- };
176
- export { architectAgentInfo }
177
- export { architectAgentInfo as architectAgentInfo_alias_1 }
178
- export { architectAgentInfo as architectAgentInfo_alias_2 }
179
-
180
- declare type ArchitectAgentOptions = SharedAgentOptions;
181
- export { ArchitectAgentOptions }
182
- export { ArchitectAgentOptions as ArchitectAgentOptions_alias_1 }
183
- export { ArchitectAgentOptions as ArchitectAgentOptions_alias_2 }
184
-
185
- declare type AssistantMessageContent = TextContent | ToolUse;
186
- export { AssistantMessageContent }
187
- export { AssistantMessageContent as AssistantMessageContent_alias_1 }
188
- export { AssistantMessageContent as AssistantMessageContent_alias_2 }
189
-
190
- 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";
191
-
192
- 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.";
193
-
194
- declare const capabilities: (_toolNamePrefix: string) => string;
195
- export { capabilities }
196
- export { capabilities as capabilities_alias_1 }
197
- export { capabilities as capabilities_alias_2 }
198
-
199
- /**
200
- * CodeFixer agent for fixing code issues like type errors and failing tests.
201
- * Using Scripts: format, check, test
202
- */
203
- declare class CodeFixerAgent extends AgentBase {
204
- #private;
205
- constructor(options: CodeFixerAgentOptions);
206
- protected onBeforeInvokeTool(name: string, _args: Record<string, string>): Promise<ToolResponse | undefined>;
207
- }
208
- export { CodeFixerAgent }
209
- export { CodeFixerAgent as CodeFixerAgent_alias_1 }
210
- export { CodeFixerAgent as CodeFixerAgent_alias_2 }
211
-
212
- declare const codeFixerAgentInfo: {
213
- readonly name: "codefixer";
214
- readonly responsibilities: ["Fixing type errors and type-related issues", "Resolving failing tests", "Addressing code quality issues", "Tracking and reporting unfixed issues"];
215
- };
216
- export { codeFixerAgentInfo }
217
- export { codeFixerAgentInfo as codeFixerAgentInfo_alias_1 }
218
- export { codeFixerAgentInfo as codeFixerAgentInfo_alias_2 }
219
-
220
- declare type CodeFixerAgentOptions = SharedAgentOptions & {
221
- maxRetries?: number;
222
- };
223
- export { CodeFixerAgentOptions }
224
- export { CodeFixerAgentOptions as CodeFixerAgentOptions_alias_1 }
225
- export { CodeFixerAgentOptions as CodeFixerAgentOptions_alias_2 }
226
-
227
- 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";
228
-
229
- /**
230
- * Coder agent for writing code.
231
- * Using Scripts: format, check, test
232
- */
233
- declare class CoderAgent extends AgentBase {
234
- #private;
235
- constructor(options: CoderAgentOptions);
236
- protected onBeforeInvokeTool(name: string, _args: Record<string, string>): Promise<ToolResponse | undefined>;
237
- }
238
- export { CoderAgent }
239
- export { CoderAgent as CoderAgent_alias_1 }
240
- export { CoderAgent as CoderAgent_alias_2 }
241
-
242
- declare const coderAgentInfo: {
243
- readonly name: "coder";
244
- 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."];
245
- };
246
- export { coderAgentInfo }
247
- export { coderAgentInfo as coderAgentInfo_alias_1 }
248
- export { coderAgentInfo as coderAgentInfo_alias_2 }
249
-
250
- declare type CoderAgentOptions = SharedAgentOptions;
251
- export { CoderAgentOptions }
252
- export { CoderAgentOptions as CoderAgentOptions_alias_1 }
253
- export { CoderAgentOptions as CoderAgentOptions_alias_2 }
254
-
255
10
  declare type CommandProvider = {
256
11
  executeCommand?: (command: string, needApprove: boolean) => Promise<{
257
12
  stdout: string;
@@ -270,14 +25,15 @@ export { CommandProvider as CommandProvider_alias_2 }
270
25
  * The backoff starts at baseSeconds and doubles each time, capped at capSeconds.
271
26
  * Example with base=2, cap=60: 2, 4, 8, 16, 32, 60, 60, ...
272
27
  */
273
- export declare function computeRateLimitBackoffSeconds(count: number, baseSeconds?: number, capSeconds?: number): number;
28
+ declare function computeRateLimitBackoffSeconds(count: number, baseSeconds?: number, capSeconds?: number): number;
29
+ export { computeRateLimitBackoffSeconds }
30
+ export { computeRateLimitBackoffSeconds as computeRateLimitBackoffSeconds_alias_1 }
274
31
 
275
32
  declare type Config = z.infer<typeof configSchema>;
276
33
  export { Config }
277
34
  export { Config as Config_alias_1 }
278
35
 
279
36
  declare const configSchema: z.ZodObject<{
280
- agent: z.ZodOptional<z.ZodString>;
281
37
  prices: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodRecord<z.ZodString, z.ZodObject<{
282
38
  inputPrice: z.ZodOptional<z.ZodNumber>;
283
39
  outputPrice: z.ZodOptional<z.ZodNumber>;
@@ -295,10 +51,6 @@ declare const configSchema: z.ZodObject<{
295
51
  defaultProvider: z.ZodOptional<z.ZodString>;
296
52
  defaultModel: z.ZodOptional<z.ZodString>;
297
53
  defaultParameters: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
298
- toolFormat: z.ZodOptional<z.ZodEnum<{
299
- native: "native";
300
- "polka-codes": "polka-codes";
301
- }>>;
302
54
  maxMessageCount: z.ZodOptional<z.ZodNumber>;
303
55
  budget: z.ZodOptional<z.ZodNumber>;
304
56
  retryCount: z.ZodOptional<z.ZodNumber>;
@@ -308,153 +60,142 @@ declare const configSchema: z.ZodObject<{
308
60
  command: z.ZodString;
309
61
  description: z.ZodString;
310
62
  }, z.core.$strip>]>>>;
311
- agents: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
312
- provider: z.ZodOptional<z.ZodString>;
313
- model: z.ZodOptional<z.ZodString>;
314
- parameters: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
315
- toolFormat: z.ZodOptional<z.ZodEnum<{
316
- native: "native";
317
- "polka-codes": "polka-codes";
318
- }>>;
319
- initialContext: z.ZodOptional<z.ZodObject<{
320
- maxFileCount: z.ZodOptional<z.ZodNumber>;
321
- excludes: z.ZodOptional<z.ZodArray<z.ZodString>>;
322
- }, z.core.$strip>>;
323
- retryCount: z.ZodOptional<z.ZodNumber>;
324
- requestTimeoutSeconds: z.ZodOptional<z.ZodNumber>;
325
- }, z.core.$strip>>>;
326
63
  commands: z.ZodOptional<z.ZodObject<{
327
64
  default: z.ZodOptional<z.ZodObject<{
328
65
  provider: z.ZodOptional<z.ZodString>;
329
66
  model: z.ZodOptional<z.ZodString>;
330
67
  parameters: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
331
- toolFormat: z.ZodOptional<z.ZodEnum<{
332
- native: "native";
333
- "polka-codes": "polka-codes";
334
- }>>;
335
68
  }, z.core.$strip>>;
336
69
  }, z.core.$catchall<z.ZodObject<{
337
70
  provider: z.ZodOptional<z.ZodString>;
338
71
  model: z.ZodOptional<z.ZodString>;
339
72
  parameters: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
340
- toolFormat: z.ZodOptional<z.ZodEnum<{
341
- native: "native";
342
- "polka-codes": "polka-codes";
343
- }>>;
344
73
  }, z.core.$strip>>>>;
345
74
  rules: z.ZodOptional<z.ZodUnion<[z.ZodOptional<z.ZodArray<z.ZodString>>, z.ZodString]>>;
346
75
  excludeFiles: z.ZodOptional<z.ZodArray<z.ZodString>>;
347
- policies: z.ZodOptional<z.ZodArray<z.ZodString>>;
348
76
  }, z.core.$strict>;
349
77
  export { configSchema }
350
78
  export { configSchema as configSchema_alias_1 }
351
79
 
352
- declare const createNewProject: (agent: MultiAgent, params: string) => Promise<string>;
353
- export { createNewProject }
354
- export { createNewProject as createNewProject_alias_1 }
355
-
356
- declare const customInstructions: (customInstructions: string[]) => string;
357
- export { customInstructions }
358
- export { customInstructions as customInstructions_alias_1 }
359
- export { customInstructions as customInstructions_alias_2 }
360
-
361
- declare const customScripts: (commands: Record<string, string | {
362
- command: string;
363
- description: string;
364
- }>) => string;
365
- export { customScripts }
366
- export { customScripts as customScripts_alias_1 }
367
- export { customScripts as customScripts_alias_2 }
368
-
369
80
  declare const _default: {
370
81
  handler: ToolHandler<{
371
- readonly name: "ask_followup_question";
372
- 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.";
82
+ readonly name: "appendMemory";
83
+ readonly description: "Appends content to a memory topic.";
373
84
  readonly parameters: z.ZodObject<{
374
- questions: z.ZodArray<z.ZodObject<{
375
- prompt: z.ZodString;
376
- options: z.ZodDefault<z.ZodArray<z.ZodString>>;
377
- }, z.core.$strip>>;
85
+ topic: z.ZodOptional<z.ZodNullable<z.ZodString>>;
86
+ content: z.ZodString;
378
87
  }, z.core.$strip>;
379
- }, InteractionProvider>;
380
- isAvailable: (provider: InteractionProvider) => boolean;
381
- name: "ask_followup_question";
382
- 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.";
88
+ }, MemoryProvider>;
89
+ name: "appendMemory";
90
+ description: "Appends content to a memory topic.";
383
91
  parameters: z.ZodObject<{
384
- questions: z.ZodArray<z.ZodObject<{
385
- prompt: z.ZodString;
386
- options: z.ZodDefault<z.ZodArray<z.ZodString>>;
387
- }, z.core.$strip>>;
92
+ topic: z.ZodOptional<z.ZodNullable<z.ZodString>>;
93
+ content: z.ZodString;
388
94
  }, z.core.$strip>;
389
95
  };
390
- export { _default as askFollowupQuestion }
391
- export { _default as askFollowupQuestion_alias_1 }
392
- export { _default as default_alias_1 }
96
+ export { _default as appendMemory }
97
+ export { _default as appendMemory_alias_1 }
98
+ export { _default as default_alias }
393
99
 
394
100
  declare const _default_10: {
395
101
  handler: ToolHandler<{
396
- readonly name: "remove_file";
102
+ readonly name: "removeFile";
397
103
  readonly description: "Request to remove a file at the specified path.";
398
104
  readonly parameters: z.ZodObject<{
399
105
  path: z.ZodString;
400
106
  }, z.core.$strip>;
401
107
  }, FilesystemProvider>;
402
- isAvailable: (provider: FilesystemProvider) => boolean;
403
- name: "remove_file";
108
+ name: "removeFile";
404
109
  description: "Request to remove a file at the specified path.";
405
110
  parameters: z.ZodObject<{
406
111
  path: z.ZodString;
407
112
  }, z.core.$strip>;
408
113
  };
409
- export { _default_10 as default_alias_10 }
114
+ export { _default_10 as default_alias_9 }
410
115
  export { _default_10 as removeFile }
411
116
  export { _default_10 as removeFile_alias_1 }
412
117
 
413
118
  declare const _default_11: {
414
119
  handler: ToolHandler<{
415
- readonly name: "rename_file";
120
+ readonly name: "removeMemory";
121
+ readonly description: "Removes a topic from memory.";
122
+ readonly parameters: z.ZodObject<{
123
+ topic: z.ZodOptional<z.ZodString>;
124
+ }, z.core.$strip>;
125
+ }, MemoryProvider>;
126
+ name: "removeMemory";
127
+ description: "Removes a topic from memory.";
128
+ parameters: z.ZodObject<{
129
+ topic: z.ZodOptional<z.ZodString>;
130
+ }, z.core.$strip>;
131
+ };
132
+ export { _default_11 as default_alias_10 }
133
+ export { _default_11 as removeMemory }
134
+ export { _default_11 as removeMemory_alias_1 }
135
+
136
+ declare const _default_12: {
137
+ handler: ToolHandler<{
138
+ readonly name: "renameFile";
416
139
  readonly description: "Request to rename a file from source path to target path.";
417
140
  readonly parameters: z.ZodObject<{
418
141
  source_path: z.ZodString;
419
142
  target_path: z.ZodString;
420
143
  }, z.core.$strip>;
421
144
  }, FilesystemProvider>;
422
- isAvailable: (provider: FilesystemProvider) => boolean;
423
- name: "rename_file";
145
+ name: "renameFile";
424
146
  description: "Request to rename a file from source path to target path.";
425
147
  parameters: z.ZodObject<{
426
148
  source_path: z.ZodString;
427
149
  target_path: z.ZodString;
428
150
  }, z.core.$strip>;
429
151
  };
430
- export { _default_11 as default_alias_11 }
431
- export { _default_11 as renameFile }
432
- export { _default_11 as renameFile_alias_1 }
152
+ export { _default_12 as default_alias_11 }
153
+ export { _default_12 as renameFile }
154
+ export { _default_12 as renameFile_alias_1 }
433
155
 
434
- declare const _default_12: {
156
+ declare const _default_13: {
435
157
  handler: ToolHandler<{
436
- readonly name: "replace_in_file";
158
+ readonly name: "replaceInFile";
437
159
  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.";
438
160
  readonly parameters: z.ZodObject<{
439
161
  path: z.ZodString;
440
162
  diff: z.ZodString;
441
163
  }, z.core.$strip>;
442
164
  }, FilesystemProvider>;
443
- isAvailable: (provider: FilesystemProvider) => boolean;
444
- name: "replace_in_file";
165
+ name: "replaceInFile";
445
166
  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.";
446
167
  parameters: z.ZodObject<{
447
168
  path: z.ZodString;
448
169
  diff: z.ZodString;
449
170
  }, z.core.$strip>;
450
171
  };
451
- export { _default_12 as default_alias_12 }
452
- export { _default_12 as replaceInFile }
453
- export { _default_12 as replaceInFile_alias_1 }
172
+ export { _default_13 as default_alias_12 }
173
+ export { _default_13 as replaceInFile }
174
+ export { _default_13 as replaceInFile_alias_1 }
454
175
 
455
- declare const _default_13: {
176
+ declare const _default_14: {
177
+ handler: ToolHandler<{
178
+ readonly name: "replaceMemory";
179
+ readonly description: "Replaces content of a memory topic.";
180
+ readonly parameters: z.ZodObject<{
181
+ topic: z.ZodOptional<z.ZodString>;
182
+ content: z.ZodString;
183
+ }, z.core.$strip>;
184
+ }, MemoryProvider>;
185
+ name: "replaceMemory";
186
+ description: "Replaces content of a memory topic.";
187
+ parameters: z.ZodObject<{
188
+ topic: z.ZodOptional<z.ZodString>;
189
+ content: z.ZodString;
190
+ }, z.core.$strip>;
191
+ };
192
+ export { _default_14 as default_alias_13 }
193
+ export { _default_14 as replaceMemory }
194
+ export { _default_14 as replaceMemory_alias_1 }
195
+
196
+ declare const _default_15: {
456
197
  handler: ToolHandler<{
457
- readonly name: "search_files";
198
+ readonly name: "searchFiles";
458
199
  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.";
459
200
  readonly parameters: z.ZodObject<{
460
201
  path: z.ZodString;
@@ -462,8 +203,7 @@ declare const _default_13: {
462
203
  filePattern: z.ZodOptional<z.ZodString>;
463
204
  }, z.core.$strip>;
464
205
  }, FilesystemProvider>;
465
- isAvailable: (provider: FilesystemProvider) => boolean;
466
- name: "search_files";
206
+ name: "searchFiles";
467
207
  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.";
468
208
  parameters: z.ZodObject<{
469
209
  path: z.ZodString;
@@ -471,143 +211,95 @@ declare const _default_13: {
471
211
  filePattern: z.ZodOptional<z.ZodString>;
472
212
  }, z.core.$strip>;
473
213
  };
474
- export { _default_13 as default_alias_13 }
475
- export { _default_13 as searchFiles }
476
- export { _default_13 as searchFiles_alias_1 }
214
+ export { _default_15 as default_alias_14 }
215
+ export { _default_15 as searchFiles }
216
+ export { _default_15 as searchFiles_alias_1 }
477
217
 
478
- declare const _default_14: {
218
+ declare const _default_16: {
479
219
  handler: ToolHandler<{
480
- readonly name: "write_to_file";
220
+ readonly name: "writeToFile";
481
221
  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.";
482
222
  readonly parameters: z.ZodObject<{
483
223
  path: z.ZodString;
484
224
  content: z.ZodString;
485
225
  }, z.core.$strip>;
486
226
  }, FilesystemProvider>;
487
- isAvailable: (provider: FilesystemProvider) => boolean;
488
- name: "write_to_file";
227
+ name: "writeToFile";
489
228
  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.";
490
229
  parameters: z.ZodObject<{
491
230
  path: z.ZodString;
492
231
  content: z.ZodString;
493
232
  }, z.core.$strip>;
494
233
  };
495
- export { _default_14 as default_alias_14 }
496
- export { _default_14 as writeToFile }
497
- export { _default_14 as writeToFile_alias_1 }
234
+ export { _default_16 as default_alias_15 }
235
+ export { _default_16 as writeToFile }
236
+ export { _default_16 as writeToFile_alias_1 }
498
237
 
499
238
  declare const _default_2: {
500
239
  handler: ToolHandler<{
501
- readonly name: "attempt_completion";
502
- 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.";
240
+ readonly name: "askFollowupQuestion";
241
+ 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.";
503
242
  readonly parameters: z.ZodObject<{
504
- result: z.ZodString;
243
+ questions: z.ZodArray<z.ZodObject<{
244
+ prompt: z.ZodString;
245
+ options: z.ZodDefault<z.ZodArray<z.ZodString>>;
246
+ }, z.core.$strip>>;
505
247
  }, z.core.$strip>;
506
248
  }, InteractionProvider>;
507
- isAvailable: (_provider: InteractionProvider) => boolean;
508
- name: "attempt_completion";
509
- 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.";
249
+ name: "askFollowupQuestion";
250
+ 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.";
510
251
  parameters: z.ZodObject<{
511
- result: z.ZodString;
252
+ questions: z.ZodArray<z.ZodObject<{
253
+ prompt: z.ZodString;
254
+ options: z.ZodDefault<z.ZodArray<z.ZodString>>;
255
+ }, z.core.$strip>>;
512
256
  }, z.core.$strip>;
513
257
  };
514
- export { _default_2 as attemptCompletion }
515
- export { _default_2 as attemptCompletion_alias_1 }
516
- export { _default_2 as default_alias_2 }
258
+ export { _default_2 as askFollowupQuestion }
259
+ export { _default_2 as askFollowupQuestion_alias_1 }
260
+ export { _default_2 as default_alias_1 }
517
261
 
518
262
  declare const _default_3: {
519
263
  handler: ToolHandler<{
520
- readonly name: "delegate";
521
- 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.";
522
- readonly parameters: z.ZodObject<{
523
- agentName: z.ZodString;
524
- task: z.ZodString;
525
- context: z.ZodString;
526
- files: z.ZodOptional<z.ZodPipe<z.ZodTransform<string[], unknown>, z.ZodArray<z.ZodString>>>;
527
- }, z.core.$strip>;
528
- }, any>;
529
- isAvailable: (_provider: any) => boolean;
530
- name: "delegate";
531
- 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
- 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
- };
539
- export { _default_3 as default_alias_3 }
540
- export { _default_3 as delegate }
541
- export { _default_3 as delegate_alias_1 }
542
-
543
- declare const _default_4: {
544
- handler: ToolHandler<{
545
- readonly name: "execute_command";
264
+ readonly name: "executeCommand";
546
265
  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.";
547
266
  readonly parameters: z.ZodObject<{
548
267
  command: z.ZodString;
549
268
  requiresApproval: z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodDefault<z.ZodOptional<z.ZodBoolean>>>;
550
269
  }, z.core.$strip>;
551
270
  }, CommandProvider>;
552
- isAvailable: (provider: CommandProvider) => boolean;
553
- name: "execute_command";
271
+ name: "executeCommand";
554
272
  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.";
555
273
  parameters: z.ZodObject<{
556
274
  command: z.ZodString;
557
275
  requiresApproval: z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodDefault<z.ZodOptional<z.ZodBoolean>>>;
558
276
  }, z.core.$strip>;
559
277
  };
560
- export { _default_4 as default_alias_4 }
561
- export { _default_4 as executeCommand }
562
- export { _default_4 as executeCommand_alias_1 }
278
+ export { _default_3 as default_alias_2 }
279
+ export { _default_3 as executeCommand }
280
+ export { _default_3 as executeCommand_alias_1 }
563
281
 
564
- declare const _default_5: {
282
+ declare const _default_4: {
565
283
  handler: ToolHandler<{
566
- readonly name: "fetch_url";
284
+ readonly name: "fetchUrl";
567
285
  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.";
568
286
  readonly parameters: z.ZodObject<{
569
287
  url: z.ZodPipe<z.ZodTransform<string[], unknown>, z.ZodArray<z.ZodString>>;
570
288
  }, z.core.$strip>;
571
289
  }, WebProvider>;
572
- isAvailable: (provider: WebProvider) => boolean;
573
- name: "fetch_url";
290
+ name: "fetchUrl";
574
291
  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.";
575
292
  parameters: z.ZodObject<{
576
293
  url: z.ZodPipe<z.ZodTransform<string[], unknown>, z.ZodArray<z.ZodString>>;
577
294
  }, z.core.$strip>;
578
295
  };
579
- export { _default_5 as default_alias_5 }
580
- export { _default_5 as fetchUrl }
581
- export { _default_5 as fetchUrl_alias_1 }
582
-
583
- declare const _default_6: {
584
- handler: ToolHandler<{
585
- readonly name: "hand_over";
586
- readonly description: "Hand over the current task to another agent to complete. This tool MUST NOT to be used with any other tool.";
587
- readonly parameters: z.ZodObject<{
588
- agentName: z.ZodString;
589
- task: z.ZodString;
590
- context: z.ZodString;
591
- files: z.ZodOptional<z.ZodPipe<z.ZodTransform<string[], unknown>, z.ZodArray<z.ZodString>>>;
592
- }, z.core.$strip>;
593
- }, any>;
594
- isAvailable: (_provider: any) => boolean;
595
- name: "hand_over";
596
- description: "Hand over the current task to another agent to complete. This tool MUST NOT to be used with any other tool.";
597
- parameters: z.ZodObject<{
598
- agentName: z.ZodString;
599
- task: z.ZodString;
600
- context: z.ZodString;
601
- files: z.ZodOptional<z.ZodPipe<z.ZodTransform<string[], unknown>, z.ZodArray<z.ZodString>>>;
602
- }, z.core.$strip>;
603
- };
604
- export { _default_6 as default_alias_6 }
605
- export { _default_6 as handOver }
606
- export { _default_6 as handOver_alias_1 }
296
+ export { _default_4 as default_alias_3 }
297
+ export { _default_4 as fetchUrl }
298
+ export { _default_4 as fetchUrl_alias_1 }
607
299
 
608
- declare const _default_7: {
300
+ declare const _default_5: {
609
301
  handler: ToolHandler<{
610
- readonly name: "list_files";
302
+ readonly name: "listFiles";
611
303
  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.";
612
304
  readonly parameters: z.ZodObject<{
613
305
  path: z.ZodString;
@@ -616,8 +308,7 @@ declare const _default_7: {
616
308
  includeIgnored: z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodDefault<z.ZodOptional<z.ZodBoolean>>>;
617
309
  }, z.core.$strip>;
618
310
  }, FilesystemProvider>;
619
- isAvailable: (provider: FilesystemProvider) => boolean;
620
- name: "list_files";
311
+ name: "listFiles";
621
312
  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.";
622
313
  parameters: z.ZodObject<{
623
314
  path: z.ZodString;
@@ -626,62 +317,79 @@ declare const _default_7: {
626
317
  includeIgnored: z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodDefault<z.ZodOptional<z.ZodBoolean>>>;
627
318
  }, z.core.$strip>;
628
319
  };
629
- export { _default_7 as default_alias_7 }
630
- export { _default_7 as listFiles }
631
- export { _default_7 as listFiles_alias_1 }
320
+ export { _default_5 as default_alias_4 }
321
+ export { _default_5 as listFiles }
322
+ export { _default_5 as listFiles_alias_1 }
632
323
 
633
- declare const _default_8: {
324
+ declare const _default_6: {
634
325
  handler: ToolHandler<{
635
- readonly name: "read_binary_file";
326
+ readonly name: "listMemoryTopics";
327
+ readonly description: "Lists all topics in memory.";
328
+ readonly parameters: z.ZodObject<{}, z.core.$strip>;
329
+ }, MemoryProvider>;
330
+ name: "listMemoryTopics";
331
+ description: "Lists all topics in memory.";
332
+ parameters: z.ZodObject<{}, z.core.$strip>;
333
+ };
334
+ export { _default_6 as default_alias_5 }
335
+ export { _default_6 as listMemoryTopics }
336
+ export { _default_6 as listMemoryTopics_alias_1 }
337
+
338
+ declare const _default_7: {
339
+ handler: ToolHandler<{
340
+ readonly name: "readBinaryFile";
636
341
  readonly description: "Read a binary file from a URL or local path. Use file:// prefix to access local files. This can be used to access non-text files such as PDFs or images.";
637
342
  readonly parameters: z.ZodObject<{
638
343
  url: z.ZodString;
639
344
  }, z.core.$strip>;
640
345
  }, FilesystemProvider>;
641
- isAvailable: (provider: FilesystemProvider) => boolean;
642
- name: "read_binary_file";
346
+ name: "readBinaryFile";
643
347
  description: "Read a binary file from a URL or local path. Use file:// prefix to access local files. This can be used to access non-text files such as PDFs or images.";
644
348
  parameters: z.ZodObject<{
645
349
  url: z.ZodString;
646
350
  }, z.core.$strip>;
647
351
  };
648
- export { _default_8 as default_alias_8 }
649
- export { _default_8 as readBinaryFile }
650
- export { _default_8 as readBinaryFile_alias_1 }
352
+ export { _default_7 as default_alias_6 }
353
+ export { _default_7 as readBinaryFile }
354
+ export { _default_7 as readBinaryFile_alias_1 }
651
355
 
652
- declare const _default_9: {
356
+ declare const _default_8: {
653
357
  handler: ToolHandler<{
654
- readonly name: "read_file";
358
+ readonly name: "readFile";
655
359
  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.";
656
360
  readonly parameters: z.ZodObject<{
657
361
  path: z.ZodPipe<z.ZodTransform<string[], unknown>, z.ZodArray<z.ZodString>>;
658
362
  includeIgnored: z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodDefault<z.ZodOptional<z.ZodBoolean>>>;
659
363
  }, z.core.$strip>;
660
364
  }, FilesystemProvider>;
661
- isAvailable: (provider: FilesystemProvider) => boolean;
662
- name: "read_file";
365
+ name: "readFile";
663
366
  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.";
664
367
  parameters: z.ZodObject<{
665
368
  path: z.ZodPipe<z.ZodTransform<string[], unknown>, z.ZodArray<z.ZodString>>;
666
369
  includeIgnored: z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodDefault<z.ZodOptional<z.ZodBoolean>>>;
667
370
  }, z.core.$strip>;
668
371
  };
669
- export { _default_9 as default_alias_9 }
670
- export { _default_9 as readFile }
671
- export { _default_9 as readFile_alias_1 }
372
+ export { _default_8 as default_alias_7 }
373
+ export { _default_8 as readFile }
374
+ export { _default_8 as readFile_alias_1 }
672
375
 
673
- /**
674
- * AI tool for creating new projects based on user specifications.
675
- * Generated by polka.codes
676
- */
677
- export declare const default_alias: {
678
- readonly name: "createNewProject";
679
- readonly description: "Creates a new project";
680
- 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";
681
- readonly formatInput: (params: string) => string;
682
- readonly parseOutput: (output: string) => string;
683
- readonly agent: "architect";
376
+ declare const _default_9: {
377
+ handler: ToolHandler<{
378
+ readonly name: "readMemory";
379
+ readonly description: "Reads content from a memory topic.";
380
+ readonly parameters: z.ZodObject<{
381
+ topic: z.ZodOptional<z.ZodString>;
382
+ }, z.core.$strip>;
383
+ }, MemoryProvider>;
384
+ name: "readMemory";
385
+ description: "Reads content from a memory topic.";
386
+ parameters: z.ZodObject<{
387
+ topic: z.ZodOptional<z.ZodString>;
388
+ }, z.core.$strip>;
684
389
  };
390
+ export { _default_9 as default_alias_8 }
391
+ export { _default_9 as readMemory }
392
+ export { _default_9 as readMemory_alias_1 }
685
393
 
686
394
  /**
687
395
  * Returns the directory portion of a path string.
@@ -689,40 +397,6 @@ export declare const default_alias: {
689
397
  */
690
398
  export declare function dirname(path: string): string;
691
399
 
692
- export declare const editingFilesPrompt: (toolNamePrefix: string) => string;
693
-
694
- declare const EnableCachePolicy: AgentPolicy;
695
- export { EnableCachePolicy }
696
- export { EnableCachePolicy as EnableCachePolicy_alias_1 }
697
- export { EnableCachePolicy as EnableCachePolicy_alias_2 }
698
- export { EnableCachePolicy as EnableCachePolicy_alias_3 }
699
-
700
- declare const executeAgentTool: <T extends AiToolDefinitionWithAgent<any, any>>(definition: T, options: SharedAgentOptions, params: GetInput<T>) => Promise<GetOutput<T>>;
701
- export { executeAgentTool }
702
- export { executeAgentTool as executeAgentTool_alias_1 }
703
-
704
- declare const executeMultiAgentTool: <T extends AiToolDefinitionWithMultiAgent<any, any>>(definition: T, agent: MultiAgent, params: GetInput<T>) => Promise<GetOutput<T>>;
705
- export { executeMultiAgentTool }
706
- export { executeMultiAgentTool as executeMultiAgentTool_alias_1 }
707
-
708
- declare const executeTool: <T extends AiToolDefinition<any, any>>(definition: T, ai: LanguageModelV2, params: GetInput<T>, usageMeter: UsageMeter) => Promise<GetOutput<T>>;
709
- export { executeTool }
710
- export { executeTool as executeTool_alias_1 }
711
-
712
- declare type ExitReason = {
713
- type: 'UsageExceeded';
714
- } | {
715
- type: 'WaitForUserInput';
716
- } | {
717
- type: 'Aborted';
718
- } | ToolResponseExit | ToolResponseInterrupted | ToolResponseHandOver | ToolResponseDelegate | {
719
- type: 'Pause';
720
- responses: ToolResponseOrToolPause[];
721
- };
722
- export { ExitReason }
723
- export { ExitReason as ExitReason_alias_1 }
724
- export { ExitReason as ExitReason_alias_2 }
725
-
726
400
  declare type FilesystemProvider = {
727
401
  readFile?: (path: string, includeIgnored: boolean) => Promise<string | undefined>;
728
402
  writeFile?: (path: string, content: string) => Promise<void>;
@@ -739,163 +413,66 @@ export { FilesystemProvider }
739
413
  export { FilesystemProvider as FilesystemProvider_alias_1 }
740
414
  export { FilesystemProvider as FilesystemProvider_alias_2 }
741
415
 
742
- export declare const fullSystemPrompt: (info: {
743
- os: string;
744
- }, tools: FullToolInfoV2[], toolNamePrefix: string, instructions: string[], scripts: Record<string, string | {
745
- command: string;
746
- description: string;
747
- }>, useNativeTool: boolean) => string;
748
-
749
- export declare const fullSystemPrompt_alias_1: (info: {
750
- os: string;
751
- }, tools: FullToolInfoV2[], toolNamePrefix: string, instructions: string[], scripts: Record<string, string | {
752
- command: string;
753
- description: string;
754
- }>, useNativeTool: boolean) => string;
755
-
756
- export declare const fullSystemPrompt_alias_2: (info: {
757
- os: string;
758
- }, tools: FullToolInfoV2[], toolNamePrefix: string, instructions: string[], scripts: Record<string, string | {
759
- command: string;
760
- description: string;
761
- }>, useNativeTool: boolean) => string;
762
-
763
- export declare const fullSystemPrompt_alias_3: (info: {
764
- os: string;
765
- }, tools: FullToolInfoV2[], toolNamePrefix: string, instructions: string[], scripts: Record<string, string | {
766
- command: string;
767
- description: string;
768
- }>, useNativeTool: boolean) => string;
769
-
770
416
  declare type FullToolInfo = ToolInfo & {
771
417
  handler: ToolHandler<ToolInfo, any>;
772
- isAvailable: (provider: any) => boolean;
773
418
  };
774
419
  export { FullToolInfo }
775
420
  export { FullToolInfo as FullToolInfo_alias_1 }
776
421
 
777
- declare type FullToolInfoV2 = ToolInfoV2 & {
778
- handler: ToolHandler<ToolInfoV2, any>;
779
- isAvailable: (provider: any) => boolean;
780
- };
781
- export { FullToolInfoV2 }
782
- export { FullToolInfoV2 as FullToolInfoV2_alias_1 }
783
-
784
- export declare const getArray: <T extends string>(args: Partial<Record<T, ToolParameterValue>> | ToolParameterValue, name: T, defaultValue?: ToolParameterValue[]) => ToolParameterValue[];
785
-
786
- /**
787
- * Get the available tools based on the provider and agent availability
788
- * @param provider The provider to use.
789
- * @param allTools All possible tools.
790
- * @param hasAgent Whether the agent has agents.
791
- * @returns The available tools
792
- */
793
- declare const getAvailableTools: <T extends FullToolInfoV2 | FullToolInfo>({ provider, allTools, hasAgent, }: {
794
- provider: any;
795
- allTools: T[];
796
- hasAgent: boolean;
797
- }) => T[];
798
- export { getAvailableTools }
799
- export { getAvailableTools as getAvailableTools_alias_1 }
800
-
801
- export declare const getBoolean: <T extends string>(args: Partial<Record<T, ToolParameterValue>>, name: T, defaultValue?: boolean) => boolean;
802
-
803
- declare type GetInput<T> = T extends AiToolDefinition<infer Input, any> ? Input : never;
804
- export { GetInput }
805
- export { GetInput as GetInput_alias_1 }
806
- export { GetInput as GetInput_alias_2 }
807
-
808
- export declare const getInt: <T extends string>(args: Partial<Record<T, ToolParameterValue>>, name: T, defaultValue?: number) => number;
809
-
810
- declare type GetOutput<T> = T extends AiToolDefinition<any, infer Output> ? Output : never;
811
- export { GetOutput }
812
- export { GetOutput as GetOutput_alias_1 }
813
- export { GetOutput as GetOutput_alias_2 }
814
-
815
- export declare const getString: <T extends string>(args: Partial<Record<T, string>> | ToolParameterValue, name: T, defaultValue?: string) => string;
816
-
817
- export declare const getStringArray: <T extends string>(args: Partial<Record<T, ToolParameterValue>>, name: T, defaultValue?: string[]) => string[];
818
-
819
- export declare const handler: ToolHandler<typeof toolInfo, InteractionProvider>;
422
+ export declare const handler: ToolHandler<typeof toolInfo, MemoryProvider>;
820
423
 
821
424
  export declare const handler_alias_1: ToolHandler<typeof toolInfo_alias_1, InteractionProvider>;
822
425
 
823
- export declare const handler_alias_10: ToolHandler<typeof toolInfo_alias_10, FilesystemProvider>;
426
+ export declare const handler_alias_10: ToolHandler<typeof toolInfo_alias_10, MemoryProvider>;
824
427
 
825
428
  export declare const handler_alias_11: ToolHandler<typeof toolInfo_alias_11, FilesystemProvider>;
826
429
 
827
430
  export declare const handler_alias_12: ToolHandler<typeof toolInfo_alias_12, FilesystemProvider>;
828
431
 
829
- export declare const handler_alias_13: ToolHandler<typeof toolInfo_alias_13, FilesystemProvider>;
432
+ export declare const handler_alias_13: ToolHandler<typeof toolInfo_alias_13, MemoryProvider>;
433
+
434
+ export declare const handler_alias_14: ToolHandler<typeof toolInfo_alias_14, FilesystemProvider>;
830
435
 
831
- export declare const handler_alias_2: ToolHandler<typeof toolInfo_alias_2, any>;
436
+ export declare const handler_alias_15: ToolHandler<typeof toolInfo_alias_15, FilesystemProvider>;
832
437
 
833
- export declare const handler_alias_3: ToolHandler<typeof toolInfo_alias_3, CommandProvider>;
438
+ export declare const handler_alias_2: ToolHandler<typeof toolInfo_alias_2, CommandProvider>;
834
439
 
835
- export declare const handler_alias_4: ToolHandler<typeof toolInfo_alias_4, WebProvider>;
440
+ export declare const handler_alias_3: ToolHandler<typeof toolInfo_alias_3, WebProvider>;
836
441
 
837
- export declare const handler_alias_5: ToolHandler<typeof toolInfo_alias_5, any>;
442
+ export declare const handler_alias_4: ToolHandler<typeof toolInfo_alias_4, FilesystemProvider>;
443
+
444
+ export declare const handler_alias_5: ToolHandler<typeof toolInfo_alias_5, MemoryProvider>;
838
445
 
839
446
  export declare const handler_alias_6: ToolHandler<typeof toolInfo_alias_6, FilesystemProvider>;
840
447
 
841
448
  export declare const handler_alias_7: ToolHandler<typeof toolInfo_alias_7, FilesystemProvider>;
842
449
 
843
- export declare const handler_alias_8: ToolHandler<typeof toolInfo_alias_8, FilesystemProvider>;
450
+ export declare const handler_alias_8: ToolHandler<typeof toolInfo_alias_8, MemoryProvider>;
844
451
 
845
452
  export declare const handler_alias_9: ToolHandler<typeof toolInfo_alias_9, FilesystemProvider>;
846
453
 
847
454
  declare type InteractionProvider = {
848
455
  askFollowupQuestion?: (question: string, options: string[]) => Promise<string>;
849
- attemptCompletion?: (result: string) => Promise<string | undefined>;
850
456
  };
851
457
  export { InteractionProvider }
852
458
  export { InteractionProvider as InteractionProvider_alias_1 }
853
459
  export { InteractionProvider as InteractionProvider_alias_2 }
854
460
 
855
- export declare const isAvailable: (provider: InteractionProvider) => boolean;
856
-
857
- export declare const isAvailable_alias_1: (_provider: InteractionProvider) => boolean;
858
-
859
- export declare const isAvailable_alias_10: (provider: FilesystemProvider) => boolean;
860
-
861
- export declare const isAvailable_alias_11: (provider: FilesystemProvider) => boolean;
862
-
863
- export declare const isAvailable_alias_12: (provider: FilesystemProvider) => boolean;
864
-
865
- export declare const isAvailable_alias_13: (provider: FilesystemProvider) => boolean;
866
-
867
- export declare const isAvailable_alias_2: (_provider: any) => boolean;
868
-
869
- export declare const isAvailable_alias_3: (provider: CommandProvider) => boolean;
870
-
871
- export declare const isAvailable_alias_4: (provider: WebProvider) => boolean;
872
-
873
- export declare const isAvailable_alias_5: (_provider: any) => boolean;
874
-
875
- export declare const isAvailable_alias_6: (provider: FilesystemProvider) => boolean;
876
-
877
- export declare const isAvailable_alias_7: (provider: FilesystemProvider) => boolean;
878
-
879
- export declare const isAvailable_alias_8: (provider: FilesystemProvider) => boolean;
880
-
881
- export declare const isAvailable_alias_9: (provider: FilesystemProvider) => boolean;
882
-
883
461
  /**
884
462
  * Joins all given path segments, then normalizes the result.
885
463
  */
886
464
  export declare function join(...parts: string[]): string;
887
465
 
888
- declare const makeAgentTool: <T extends AiToolDefinitionWithAgent<any, any>>(definition: T) => (options: SharedAgentOptions, params: GetInput<T>) => Promise<GetOutput<T>>;
889
- export { makeAgentTool }
890
- export { makeAgentTool as makeAgentTool_alias_1 }
891
-
892
- declare const makeMultiAgentTool: <T extends AiToolDefinitionWithMultiAgent<any, any>>(definition: T) => (agent: MultiAgent, params: GetInput<T>) => Promise<GetOutput<T>>;
893
- export { makeMultiAgentTool }
894
- export { makeMultiAgentTool as makeMultiAgentTool_alias_1 }
895
-
896
- declare const makeTool: <T extends AiToolDefinition<any, any>>(definition: T) => (ai: LanguageModelV2, params: GetInput<T>, usageMeter: UsageMeter) => Promise<GetOutput<T>>;
897
- export { makeTool }
898
- export { makeTool as makeTool_alias_1 }
466
+ declare interface MemoryProvider {
467
+ listMemoryTopics: () => Promise<string[]>;
468
+ readMemory: (topic?: string) => Promise<string | undefined>;
469
+ appendMemory: (topic: string | undefined, content: string) => Promise<void>;
470
+ replaceMemory: (topic: string | undefined, content: string) => Promise<void>;
471
+ removeMemory: (topic: string | undefined) => Promise<void>;
472
+ }
473
+ export { MemoryProvider }
474
+ export { MemoryProvider as MemoryProvider_alias_1 }
475
+ export { MemoryProvider as MemoryProvider_alias_2 }
899
476
 
900
477
  declare class MockProvider implements ToolProvider {
901
478
  readFile(_path: string, _includeIgnored?: boolean): Promise<string>;
@@ -911,7 +488,6 @@ declare class MockProvider implements ToolProvider {
911
488
  summary?: string;
912
489
  }>;
913
490
  askFollowupQuestion(_question: string, _options?: string[]): Promise<string>;
914
- attemptCompletion(_result: string): Promise<string | undefined>;
915
491
  }
916
492
  export { MockProvider }
917
493
  export { MockProvider as MockProvider_alias_1 }
@@ -926,99 +502,6 @@ declare type ModelInfo = {
926
502
  export { ModelInfo }
927
503
  export { ModelInfo as ModelInfo_alias_1 }
928
504
 
929
- declare class MultiAgent {
930
- #private;
931
- constructor(config: MultiAgentConfig);
932
- startTask(options: {
933
- agentName: string;
934
- task: string;
935
- context: string;
936
- files?: (ImagePart | FilePart)[];
937
- }): Promise<ExitReason>;
938
- continueTask(userMessage: UserContent_2): Promise<ExitReason>;
939
- get hasActiveAgent(): boolean;
940
- abort(): void;
941
- }
942
- export { MultiAgent }
943
- export { MultiAgent as MultiAgent_alias_1 }
944
- export { MultiAgent as MultiAgent_alias_2 }
945
-
946
- declare type MultiAgentConfig = {
947
- createAgent: (name: string) => Promise<AgentBase>;
948
- getPrompt?: (name: string, task: string, context: string | undefined, files: string[] | undefined, originalTask: string | undefined) => Promise<string>;
949
- };
950
- export { MultiAgentConfig }
951
- export { MultiAgentConfig as MultiAgentConfig_alias_1 }
952
- export { MultiAgentConfig as MultiAgentConfig_alias_2 }
953
-
954
- export declare const objectives: (toolNamePrefix: string) => string;
955
-
956
- /**
957
- * Parse an assistant's message into an array of text content and tool use content.
958
- *
959
- * @example
960
- * const tools = [
961
- * {
962
- * name: "search",
963
- * parameters: [
964
- * {name: "query", type: "string"}
965
- * ]
966
- * }
967
- * ]
968
- *
969
- * // Text only
970
- * parseAssistantMessage("Hello world", tools, "tool_")
971
- * // Returns: [{type: "text", content: "Hello world"}]
972
- *
973
- * // Tool use with parameters
974
- * parseAssistantMessage(
975
- * `Let me search that for you
976
- * <tool_search>
977
- * <tool_parameter_query>cats</tool_parameter_query>
978
- * </tool_search>
979
- * Here are the results`,
980
- * tools,
981
- * "tool_"
982
- * )
983
- * // Returns: [
984
- * // {type: "text", content: "Let me search that for you"},
985
- * // {type: "tool_use", name: "search", params: {query: "cats"}},
986
- * // {type: "text", content: "Here are the results"}
987
- * // ]
988
- *
989
- * // Array mode (multiple occurrences of the same parameter)
990
- * parseAssistantMessage(
991
- * `<tool_read_file>
992
- * <tool_parameter_path>test.ts</tool_parameter_path>
993
- * <tool_parameter_path>main.ts</tool_parameter_path>
994
- * </tool_read_file>`,
995
- * tools,
996
- * "tool_"
997
- * )
998
- * // Returns: [
999
- * // {type: "tool_use", name: "read_file", params: {path: ["test.ts", "main.ts"]}}
1000
- * // ]
1001
- *
1002
- * // Nested objects
1003
- * parseAssistantMessage(
1004
- * `<tool_example>
1005
- * <tool_parameter_key>
1006
- * <tool_parameter_key2>value</tool_parameter_key2>
1007
- * <tool_parameter_key3>value2</tool_parameter_key3>
1008
- * </tool_parameter_key>
1009
- * </tool_example>`,
1010
- * tools,
1011
- * "tool_"
1012
- * )
1013
- * // Returns: [
1014
- * // {type: "tool_use", name: "example", params: {key: {key2: "value", key3: "value2"}}}
1015
- * // ]
1016
- */
1017
- declare function parseAssistantMessage(assistantMessage: string, tools: ToolInfo[], toolNamePrefix: string): AssistantMessageContent[];
1018
- export { parseAssistantMessage }
1019
- export { parseAssistantMessage as parseAssistantMessage_alias_1 }
1020
- export { parseAssistantMessage as parseAssistantMessage_alias_2 }
1021
-
1022
505
  declare const parseJsonFromMarkdown: (markdown: string) => ParseOutputResult<any>;
1023
506
  export { parseJsonFromMarkdown }
1024
507
  export { parseJsonFromMarkdown as parseJsonFromMarkdown_alias_1 }
@@ -1035,13 +518,6 @@ export { ParseOutputResult }
1035
518
  export { ParseOutputResult as ParseOutputResult_alias_1 }
1036
519
  export { ParseOutputResult as ParseOutputResult_alias_2 }
1037
520
 
1038
- declare enum Policies {
1039
- TruncateContext = "truncatecontext",
1040
- EnableCache = "enablecache"
1041
- }
1042
- export { Policies }
1043
- export { Policies as Policies_alias_1 }
1044
-
1045
521
  declare const replaceInFile_2: (fileContent: string, diff: string) => ReplaceResult;
1046
522
  export { replaceInFile_2 as replaceInFileHelper }
1047
523
  export { replaceInFile_2 as replaceInFile_alias_2 }
@@ -1067,239 +543,6 @@ export { responsePrompts }
1067
543
  export { responsePrompts as responsePrompts_alias_1 }
1068
544
  export { responsePrompts as responsePrompts_alias_2 }
1069
545
 
1070
- 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";
1071
-
1072
- export declare const rules: (toolNamePrefix: string) => string;
1073
-
1074
- declare type SharedAgentOptions = {
1075
- ai: LanguageModelV2;
1076
- os: string;
1077
- provider: ToolProvider;
1078
- additionalTools?: FullToolInfoV2[];
1079
- customInstructions?: string[];
1080
- scripts?: Record<string, string | {
1081
- command: string;
1082
- description: string;
1083
- }>;
1084
- agents?: Readonly<AgentInfo[]>;
1085
- callback?: TaskEventCallback;
1086
- policies: AgentPolicy[];
1087
- retryCount?: number;
1088
- requestTimeoutSeconds?: number;
1089
- toolFormat: ToolFormat;
1090
- parameters?: Record<string, any>;
1091
- usageMeter?: UsageMeter;
1092
- requireToolUse?: boolean;
1093
- };
1094
- export { SharedAgentOptions }
1095
- export { SharedAgentOptions as SharedAgentOptions_alias_1 }
1096
- export { SharedAgentOptions as SharedAgentOptions_alias_2 }
1097
-
1098
- declare const systemInformation: (info: {
1099
- os: string;
1100
- }) => string;
1101
- export { systemInformation }
1102
- export { systemInformation as systemInformation_alias_1 }
1103
- export { systemInformation as systemInformation_alias_2 }
1104
-
1105
- /**
1106
- * Union type of all possible task events
1107
- */
1108
- declare type TaskEvent = TaskEventStartTask | TaskEventStartRequest | TaskEventEndRequest | TaskEventUsage | TaskEventText | TaskEventToolUse | TaskEventToolResult | TaskEventToolError | TaskEventToolPause | TaskEventToolHandOverDelegate | TaskEventUsageExceeded | TaskEventEndTask;
1109
- export { TaskEvent }
1110
- export { TaskEvent as TaskEvent_alias_1 }
1111
- export { TaskEvent as TaskEvent_alias_2 }
1112
-
1113
- /**
1114
- * Base interface for all task events
1115
- */
1116
- declare interface TaskEventBase {
1117
- kind: TaskEventKind;
1118
- agent: AgentBase;
1119
- }
1120
- export { TaskEventBase }
1121
- export { TaskEventBase as TaskEventBase_alias_1 }
1122
- export { TaskEventBase as TaskEventBase_alias_2 }
1123
-
1124
- declare type TaskEventCallback = (event: TaskEvent) => void | Promise<void>;
1125
- export { TaskEventCallback }
1126
- export { TaskEventCallback as TaskEventCallback_alias_1 }
1127
- export { TaskEventCallback as TaskEventCallback_alias_2 }
1128
-
1129
- /**
1130
- * Event for request end
1131
- */
1132
- declare interface TaskEventEndRequest extends TaskEventBase {
1133
- kind: TaskEventKind.EndRequest;
1134
- message: string;
1135
- }
1136
- export { TaskEventEndRequest }
1137
- export { TaskEventEndRequest as TaskEventEndRequest_alias_1 }
1138
- export { TaskEventEndRequest as TaskEventEndRequest_alias_2 }
1139
-
1140
- /**
1141
- * Event for task end
1142
- */
1143
- declare interface TaskEventEndTask extends TaskEventBase {
1144
- kind: TaskEventKind.EndTask;
1145
- exitReason: ExitReason;
1146
- }
1147
- export { TaskEventEndTask }
1148
- export { TaskEventEndTask as TaskEventEndTask_alias_1 }
1149
- export { TaskEventEndTask as TaskEventEndTask_alias_2 }
1150
-
1151
- /**
1152
- * Enum representing different kinds of task events
1153
- */
1154
- declare enum TaskEventKind {
1155
- StartTask = "StartTask",
1156
- StartRequest = "StartRequest",
1157
- EndRequest = "EndRequest",
1158
- Usage = "Usage",
1159
- Text = "Text",
1160
- Reasoning = "Reasoning",
1161
- ToolUse = "ToolUse",
1162
- ToolReply = "ToolReply",
1163
- ToolInvalid = "ToolInvalid",
1164
- ToolError = "ToolError",
1165
- ToolInterrupted = "ToolInterrupted",
1166
- ToolHandOver = "ToolHandOver",
1167
- ToolDelegate = "ToolDelegate",
1168
- ToolPause = "ToolPause",
1169
- UsageExceeded = "UsageExceeded",
1170
- EndTask = "EndTask"
1171
- }
1172
- export { TaskEventKind }
1173
- export { TaskEventKind as TaskEventKind_alias_1 }
1174
- export { TaskEventKind as TaskEventKind_alias_2 }
1175
-
1176
- /**
1177
- * Event for request start
1178
- */
1179
- declare interface TaskEventStartRequest extends TaskEventBase {
1180
- kind: TaskEventKind.StartRequest;
1181
- userMessage: ModelMessage[];
1182
- }
1183
- export { TaskEventStartRequest }
1184
- export { TaskEventStartRequest as TaskEventStartRequest_alias_1 }
1185
- export { TaskEventStartRequest as TaskEventStartRequest_alias_2 }
1186
-
1187
- /**
1188
- * Event for task start
1189
- */
1190
- declare interface TaskEventStartTask extends TaskEventBase {
1191
- kind: TaskEventKind.StartTask;
1192
- systemPrompt: string;
1193
- }
1194
- export { TaskEventStartTask }
1195
- export { TaskEventStartTask as TaskEventStartTask_alias_1 }
1196
- export { TaskEventStartTask as TaskEventStartTask_alias_2 }
1197
-
1198
- /**
1199
- * Event for text/reasoning updates
1200
- */
1201
- declare interface TaskEventText extends TaskEventBase {
1202
- kind: TaskEventKind.Text | TaskEventKind.Reasoning;
1203
- newText: string;
1204
- }
1205
- export { TaskEventText }
1206
- export { TaskEventText as TaskEventText_alias_1 }
1207
- export { TaskEventText as TaskEventText_alias_2 }
1208
-
1209
- declare interface TaskEventToolError extends TaskEventBase {
1210
- kind: TaskEventKind.ToolError;
1211
- tool: string;
1212
- error: ToolResponseError | ToolResponseResult;
1213
- }
1214
- export { TaskEventToolError }
1215
- export { TaskEventToolError as TaskEventToolError_alias_1 }
1216
- export { TaskEventToolError as TaskEventToolError_alias_2 }
1217
-
1218
- /**
1219
- * Event for tool handover
1220
- */
1221
- declare interface TaskEventToolHandOverDelegate extends TaskEventBase {
1222
- kind: TaskEventKind.ToolHandOver | TaskEventKind.ToolDelegate;
1223
- tool: string;
1224
- agentName: string;
1225
- task: string;
1226
- context?: string;
1227
- files?: string[];
1228
- }
1229
- export { TaskEventToolHandOverDelegate }
1230
- export { TaskEventToolHandOverDelegate as TaskEventToolHandOverDelegate_alias_1 }
1231
- export { TaskEventToolHandOverDelegate as TaskEventToolHandOverDelegate_alias_2 }
1232
-
1233
- declare interface TaskEventToolPause extends TaskEventBase {
1234
- kind: TaskEventKind.ToolPause;
1235
- tool: string;
1236
- object: any;
1237
- }
1238
- export { TaskEventToolPause }
1239
- export { TaskEventToolPause as TaskEventToolPause_alias_1 }
1240
- export { TaskEventToolPause as TaskEventToolPause_alias_2 }
1241
-
1242
- declare interface TaskEventToolResult extends TaskEventBase {
1243
- kind: TaskEventKind.ToolReply | TaskEventKind.ToolInvalid | TaskEventKind.ToolInterrupted;
1244
- tool: string;
1245
- content: ToolResponseResult;
1246
- }
1247
- export { TaskEventToolResult }
1248
- export { TaskEventToolResult as TaskEventToolResult_alias_1 }
1249
- export { TaskEventToolResult as TaskEventToolResult_alias_2 }
1250
-
1251
- /**
1252
- * Event for tool-related updates
1253
- */
1254
- declare interface TaskEventToolUse extends TaskEventBase {
1255
- kind: TaskEventKind.ToolUse;
1256
- tool: string;
1257
- params: Record<string, any>;
1258
- }
1259
- export { TaskEventToolUse }
1260
- export { TaskEventToolUse as TaskEventToolUse_alias_1 }
1261
- export { TaskEventToolUse as TaskEventToolUse_alias_2 }
1262
-
1263
- /**
1264
- * Event for API usage updates
1265
- */
1266
- declare interface TaskEventUsage extends TaskEventBase {
1267
- kind: TaskEventKind.Usage;
1268
- usage: LanguageModelUsage;
1269
- }
1270
- export { TaskEventUsage }
1271
- export { TaskEventUsage as TaskEventUsage_alias_1 }
1272
- export { TaskEventUsage as TaskEventUsage_alias_2 }
1273
-
1274
- /**
1275
- * Event for task usage exceeded
1276
- */
1277
- declare interface TaskEventUsageExceeded extends TaskEventBase {
1278
- kind: TaskEventKind.UsageExceeded;
1279
- }
1280
- export { TaskEventUsageExceeded }
1281
- export { TaskEventUsageExceeded as TaskEventUsageExceeded_alias_1 }
1282
- export { TaskEventUsageExceeded as TaskEventUsageExceeded_alias_2 }
1283
-
1284
- declare interface TextContent {
1285
- type: 'text';
1286
- content: string;
1287
- }
1288
- export { TextContent }
1289
- export { TextContent as TextContent_alias_1 }
1290
- export { TextContent as TextContent_alias_2 }
1291
-
1292
- declare type ToolExample = {
1293
- description: string;
1294
- input: Record<string, ToolParameterValue>;
1295
- };
1296
- export { ToolExample }
1297
- export { ToolExample as ToolExample_alias_1 }
1298
-
1299
- declare type ToolFormat = 'native' | 'polka-codes';
1300
- export { ToolFormat }
1301
- export { ToolFormat as ToolFormat_alias_1 }
1302
-
1303
546
  declare type ToolHandler<_T, P> = (provider: P, args: Partial<Record<string, ToolParameterValue>>) => Promise<ToolResponse>;
1304
547
  export { ToolHandler }
1305
548
  export { ToolHandler as ToolHandler_alias_1 }
@@ -1307,14 +550,22 @@ export { ToolHandler as ToolHandler_alias_1 }
1307
550
  declare type ToolInfo = {
1308
551
  name: string;
1309
552
  description: string;
1310
- parameters: ToolParameter[];
1311
- examples?: ToolExample[];
553
+ parameters: z.ZodObject<any>;
1312
554
  };
1313
555
  export { ToolInfo }
1314
556
  export { ToolInfo as ToolInfo_alias_1 }
1315
557
 
1316
558
  export declare const toolInfo: {
1317
- readonly name: "ask_followup_question";
559
+ readonly name: "appendMemory";
560
+ readonly description: "Appends content to a memory topic.";
561
+ readonly parameters: z.ZodObject<{
562
+ topic: z.ZodOptional<z.ZodNullable<z.ZodString>>;
563
+ content: z.ZodString;
564
+ }, z.core.$strip>;
565
+ };
566
+
567
+ export declare const toolInfo_alias_1: {
568
+ readonly name: "askFollowupQuestion";
1318
569
  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.";
1319
570
  readonly parameters: z.ZodObject<{
1320
571
  questions: z.ZodArray<z.ZodObject<{
@@ -1324,16 +575,16 @@ export declare const toolInfo: {
1324
575
  }, z.core.$strip>;
1325
576
  };
1326
577
 
1327
- export declare const toolInfo_alias_1: {
1328
- readonly name: "attempt_completion";
1329
- 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.";
578
+ export declare const toolInfo_alias_10: {
579
+ readonly name: "removeMemory";
580
+ readonly description: "Removes a topic from memory.";
1330
581
  readonly parameters: z.ZodObject<{
1331
- result: z.ZodString;
582
+ topic: z.ZodOptional<z.ZodString>;
1332
583
  }, z.core.$strip>;
1333
584
  };
1334
585
 
1335
- export declare const toolInfo_alias_10: {
1336
- readonly name: "rename_file";
586
+ export declare const toolInfo_alias_11: {
587
+ readonly name: "renameFile";
1337
588
  readonly description: "Request to rename a file from source path to target path.";
1338
589
  readonly parameters: z.ZodObject<{
1339
590
  source_path: z.ZodString;
@@ -1341,8 +592,8 @@ export declare const toolInfo_alias_10: {
1341
592
  }, z.core.$strip>;
1342
593
  };
1343
594
 
1344
- export declare const toolInfo_alias_11: {
1345
- readonly name: "replace_in_file";
595
+ export declare const toolInfo_alias_12: {
596
+ readonly name: "replaceInFile";
1346
597
  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.";
1347
598
  readonly parameters: z.ZodObject<{
1348
599
  path: z.ZodString;
@@ -1350,8 +601,17 @@ export declare const toolInfo_alias_11: {
1350
601
  }, z.core.$strip>;
1351
602
  };
1352
603
 
1353
- export declare const toolInfo_alias_12: {
1354
- readonly name: "search_files";
604
+ export declare const toolInfo_alias_13: {
605
+ readonly name: "replaceMemory";
606
+ readonly description: "Replaces content of a memory topic.";
607
+ readonly parameters: z.ZodObject<{
608
+ topic: z.ZodOptional<z.ZodString>;
609
+ content: z.ZodString;
610
+ }, z.core.$strip>;
611
+ };
612
+
613
+ export declare const toolInfo_alias_14: {
614
+ readonly name: "searchFiles";
1355
615
  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.";
1356
616
  readonly parameters: z.ZodObject<{
1357
617
  path: z.ZodString;
@@ -1360,8 +620,8 @@ export declare const toolInfo_alias_12: {
1360
620
  }, z.core.$strip>;
1361
621
  };
1362
622
 
1363
- export declare const toolInfo_alias_13: {
1364
- readonly name: "write_to_file";
623
+ export declare const toolInfo_alias_15: {
624
+ readonly name: "writeToFile";
1365
625
  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.";
1366
626
  readonly parameters: z.ZodObject<{
1367
627
  path: z.ZodString;
@@ -1370,18 +630,7 @@ export declare const toolInfo_alias_13: {
1370
630
  };
1371
631
 
1372
632
  export declare const toolInfo_alias_2: {
1373
- readonly name: "delegate";
1374
- 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.";
1375
- readonly parameters: z.ZodObject<{
1376
- agentName: z.ZodString;
1377
- task: z.ZodString;
1378
- context: z.ZodString;
1379
- files: z.ZodOptional<z.ZodPipe<z.ZodTransform<string[], unknown>, z.ZodArray<z.ZodString>>>;
1380
- }, z.core.$strip>;
1381
- };
1382
-
1383
- export declare const toolInfo_alias_3: {
1384
- readonly name: "execute_command";
633
+ readonly name: "executeCommand";
1385
634
  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.";
1386
635
  readonly parameters: z.ZodObject<{
1387
636
  command: z.ZodString;
@@ -1389,27 +638,16 @@ export declare const toolInfo_alias_3: {
1389
638
  }, z.core.$strip>;
1390
639
  };
1391
640
 
1392
- export declare const toolInfo_alias_4: {
1393
- readonly name: "fetch_url";
641
+ export declare const toolInfo_alias_3: {
642
+ readonly name: "fetchUrl";
1394
643
  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.";
1395
644
  readonly parameters: z.ZodObject<{
1396
645
  url: z.ZodPipe<z.ZodTransform<string[], unknown>, z.ZodArray<z.ZodString>>;
1397
646
  }, z.core.$strip>;
1398
647
  };
1399
648
 
1400
- export declare const toolInfo_alias_5: {
1401
- readonly name: "hand_over";
1402
- readonly description: "Hand over the current task to another agent to complete. This tool MUST NOT to be used with any other tool.";
1403
- readonly parameters: z.ZodObject<{
1404
- agentName: z.ZodString;
1405
- task: z.ZodString;
1406
- context: z.ZodString;
1407
- files: z.ZodOptional<z.ZodPipe<z.ZodTransform<string[], unknown>, z.ZodArray<z.ZodString>>>;
1408
- }, z.core.$strip>;
1409
- };
1410
-
1411
- export declare const toolInfo_alias_6: {
1412
- readonly name: "list_files";
649
+ export declare const toolInfo_alias_4: {
650
+ readonly name: "listFiles";
1413
651
  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.";
1414
652
  readonly parameters: z.ZodObject<{
1415
653
  path: z.ZodString;
@@ -1419,16 +657,22 @@ export declare const toolInfo_alias_6: {
1419
657
  }, z.core.$strip>;
1420
658
  };
1421
659
 
1422
- export declare const toolInfo_alias_7: {
1423
- readonly name: "read_binary_file";
660
+ export declare const toolInfo_alias_5: {
661
+ readonly name: "listMemoryTopics";
662
+ readonly description: "Lists all topics in memory.";
663
+ readonly parameters: z.ZodObject<{}, z.core.$strip>;
664
+ };
665
+
666
+ export declare const toolInfo_alias_6: {
667
+ readonly name: "readBinaryFile";
1424
668
  readonly description: "Read a binary file from a URL or local path. Use file:// prefix to access local files. This can be used to access non-text files such as PDFs or images.";
1425
669
  readonly parameters: z.ZodObject<{
1426
670
  url: z.ZodString;
1427
671
  }, z.core.$strip>;
1428
672
  };
1429
673
 
1430
- export declare const toolInfo_alias_8: {
1431
- readonly name: "read_file";
674
+ export declare const toolInfo_alias_7: {
675
+ readonly name: "readFile";
1432
676
  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.";
1433
677
  readonly parameters: z.ZodObject<{
1434
678
  path: z.ZodPipe<z.ZodTransform<string[], unknown>, z.ZodArray<z.ZodString>>;
@@ -1436,22 +680,22 @@ export declare const toolInfo_alias_8: {
1436
680
  }, z.core.$strip>;
1437
681
  };
1438
682
 
683
+ export declare const toolInfo_alias_8: {
684
+ readonly name: "readMemory";
685
+ readonly description: "Reads content from a memory topic.";
686
+ readonly parameters: z.ZodObject<{
687
+ topic: z.ZodOptional<z.ZodString>;
688
+ }, z.core.$strip>;
689
+ };
690
+
1439
691
  export declare const toolInfo_alias_9: {
1440
- readonly name: "remove_file";
692
+ readonly name: "removeFile";
1441
693
  readonly description: "Request to remove a file at the specified path.";
1442
694
  readonly parameters: z.ZodObject<{
1443
695
  path: z.ZodString;
1444
696
  }, z.core.$strip>;
1445
697
  };
1446
698
 
1447
- declare type ToolInfoV2 = {
1448
- name: string;
1449
- description: string;
1450
- parameters: z.ZodObject<any>;
1451
- };
1452
- export { ToolInfoV2 }
1453
- export { ToolInfoV2 as ToolInfoV2_alias_1 }
1454
-
1455
699
  declare type ToolParameter = {
1456
700
  name: string;
1457
701
  description: string;
@@ -1469,29 +713,18 @@ declare type ToolParameterValue = string | {
1469
713
  export { ToolParameterValue }
1470
714
  export { ToolParameterValue as ToolParameterValue_alias_1 }
1471
715
 
1472
- declare type ToolProvider = FilesystemProvider & CommandProvider & InteractionProvider & WebProvider;
716
+ declare type ToolProvider = FilesystemProvider & CommandProvider & InteractionProvider & WebProvider & Partial<MemoryProvider>;
1473
717
  export { ToolProvider }
1474
718
  export { ToolProvider as ToolProvider_alias_1 }
1475
719
  export { ToolProvider as ToolProvider_alias_2 }
1476
720
 
1477
- declare type ToolResponse = ToolResponseReply | ToolResponseExit | ToolResponseInvalid | ToolResponseError | ToolResponseInterrupted | ToolResponseHandOver | ToolResponseDelegate | ToolResponsePause;
721
+ declare type ToolResponse = ToolResponseReply | ToolResponseExit | ToolResponseError;
1478
722
  export { ToolResponse }
1479
723
  export { ToolResponse as ToolResponse_alias_1 }
1480
724
 
1481
- declare type ToolResponseDelegate = {
1482
- type: ToolResponseType.Delegate;
1483
- agentName: string;
1484
- task: string;
1485
- context?: string;
1486
- files?: string[];
1487
- };
1488
- export { ToolResponseDelegate }
1489
- export { ToolResponseDelegate as ToolResponseDelegate_alias_1 }
1490
-
1491
725
  declare type ToolResponseError = {
1492
726
  type: ToolResponseType.Error;
1493
727
  message: ToolResponseResult;
1494
- canRetry?: boolean;
1495
728
  };
1496
729
  export { ToolResponseError }
1497
730
  export { ToolResponseError as ToolResponseError_alias_1 }
@@ -1504,52 +737,6 @@ declare type ToolResponseExit = {
1504
737
  export { ToolResponseExit }
1505
738
  export { ToolResponseExit as ToolResponseExit_alias_1 }
1506
739
 
1507
- declare type ToolResponseHandOver = {
1508
- type: ToolResponseType.HandOver;
1509
- agentName: string;
1510
- task: string;
1511
- context?: string;
1512
- files?: string[];
1513
- };
1514
- export { ToolResponseHandOver }
1515
- export { ToolResponseHandOver as ToolResponseHandOver_alias_1 }
1516
-
1517
- declare type ToolResponseInterrupted = {
1518
- type: ToolResponseType.Interrupted;
1519
- message: string;
1520
- };
1521
- export { ToolResponseInterrupted }
1522
- export { ToolResponseInterrupted as ToolResponseInterrupted_alias_1 }
1523
-
1524
- declare type ToolResponseInvalid = {
1525
- type: ToolResponseType.Invalid;
1526
- message: ToolResponseResult;
1527
- };
1528
- export { ToolResponseInvalid }
1529
- export { ToolResponseInvalid as ToolResponseInvalid_alias_1 }
1530
-
1531
- declare type ToolResponseOrToolPause = {
1532
- type: 'response';
1533
- tool: string;
1534
- response: LanguageModelV2ToolResultOutput;
1535
- id?: string;
1536
- } | {
1537
- type: 'pause';
1538
- tool: string;
1539
- object: any;
1540
- id?: string;
1541
- };
1542
- export { ToolResponseOrToolPause }
1543
- export { ToolResponseOrToolPause as ToolResponseOrToolPause_alias_1 }
1544
- export { ToolResponseOrToolPause as ToolResponseOrToolPause_alias_2 }
1545
-
1546
- declare type ToolResponsePause = {
1547
- type: ToolResponseType.Pause;
1548
- object: any;
1549
- };
1550
- export { ToolResponsePause }
1551
- export { ToolResponsePause as ToolResponsePause_alias_1 }
1552
-
1553
740
  declare type ToolResponseReply = {
1554
741
  type: ToolResponseType.Reply;
1555
742
  message: ToolResponseResult;
@@ -1591,31 +778,11 @@ export { ToolResponseResultMedia as ToolResponseResultMedia_alias_1 }
1591
778
  declare enum ToolResponseType {
1592
779
  Reply = "Reply",
1593
780
  Exit = "Exit",
1594
- Invalid = "Invalid",
1595
- Error = "Error",
1596
- Interrupted = "Interrupted",
1597
- HandOver = "HandOver",
1598
- Delegate = "Delegate",
1599
- Pause = "Pause"
781
+ Error = "Error"
1600
782
  }
1601
783
  export { ToolResponseType }
1602
784
  export { ToolResponseType as ToolResponseType_alias_1 }
1603
785
 
1604
- declare interface ToolUse {
1605
- id?: string;
1606
- type: 'tool_use';
1607
- name: string;
1608
- params: Record<string, any>;
1609
- }
1610
- export { ToolUse }
1611
- export { ToolUse as ToolUse_alias_1 }
1612
- export { ToolUse as ToolUse_alias_2 }
1613
-
1614
- declare const toolUsePrompt: (useNativeTool: boolean, tools: FullToolInfoV2[], toolNamePrefix: string) => string;
1615
- export { toolUsePrompt }
1616
- export { toolUsePrompt as toolUsePrompt_alias_1 }
1617
- export { toolUsePrompt as toolUsePrompt_alias_2 }
1618
-
1619
786
  declare type Totals = {
1620
787
  input: number;
1621
788
  output: number;
@@ -1624,17 +791,6 @@ declare type Totals = {
1624
791
  messageCount: number;
1625
792
  };
1626
793
 
1627
- export declare function toToolInfoV1(tool: FullToolInfoV2): FullToolInfo;
1628
-
1629
- declare const TruncateContextPolicy: () => {
1630
- name: Policies;
1631
- onBeforeRequest(agent: AgentBase): Promise<void>;
1632
- };
1633
- export { TruncateContextPolicy }
1634
- export { TruncateContextPolicy as TruncateContextPolicy_alias_1 }
1635
- export { TruncateContextPolicy as TruncateContextPolicy_alias_2 }
1636
- export { TruncateContextPolicy as TruncateContextPolicy_alias_3 }
1637
-
1638
794
  /**
1639
795
  * Tracks token / cost usage across any mix of LLM models.
1640
796
  * Supports optional caps on total messages and total cost.
@@ -1680,8 +836,7 @@ declare class UsageMeter {
1680
836
  };
1681
837
  /** Merge another UsageMeter's totals into this one. */
1682
838
  merge(other: UsageMeter): void;
1683
- /** Print a concise usage summary to console. */
1684
- printUsage(customConsole?: Console): void;
839
+ getUsageText(): string;
1685
840
  onFinishHandler(llm: LanguageModelV2): (evt: {
1686
841
  totalUsage: LanguageModelV2Usage;
1687
842
  providerMetadata: any;