@polka-codes/core 0.9.86 → 0.9.89

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -10,9 +10,10 @@ Core AI services and agent implementations for Polka Codes framework.
10
10
 
11
11
  - Multiple AI provider support (Anthropic, DeepSeek, GoogleVertex, Ollama, OpenAI, and OpenRouter)
12
12
  - Extensible agent architecture
13
- - Tool integration system
13
+ - Tool integration system with safety enhancements
14
14
  - Type-safe API
15
15
  - Logging and monitoring
16
+ - File operation safety (read-first enforcement, line numbers, partial reading)
16
17
 
17
18
  ## Installation
18
19
 
@@ -110,6 +111,31 @@ bun run build
110
111
  bun test
111
112
  ```
112
113
 
114
+ ### Line Numbers
115
+
116
+ All file reads include line numbers for easy reference:
117
+
118
+ ```
119
+ 1→import React from 'react';
120
+ 2→
121
+ 3→function App() {
122
+ 4→ return <div>Hello</div>;
123
+ 5→}
124
+ ```
125
+
126
+ ### Partial File Reading
127
+
128
+ You can read specific sections of a file using `offset` and `limit` parameters:
129
+
130
+ ```typescript
131
+ // Read lines 100-150 of a large file
132
+ await readFile.handler(provider, {
133
+ path: 'large-file.ts',
134
+ offset: 100, // Skip first 100 lines
135
+ limit: 50 // Read 50 lines
136
+ });
137
+ ```
138
+
113
139
  ---
114
140
 
115
141
  *This README was generated by polka.codes*
@@ -122,6 +122,7 @@ declare const configSchema: z.ZodOptional<z.ZodNullable<z.ZodObject<{
122
122
  project: z.ZodOptional<z.ZodString>;
123
123
  keyFile: z.ZodOptional<z.ZodString>;
124
124
  baseUrl: z.ZodOptional<z.ZodString>;
125
+ name: z.ZodOptional<z.ZodString>;
125
126
  }, z.core.$strip>>>;
126
127
  defaultProvider: z.ZodOptional<z.ZodString>;
127
128
  defaultModel: z.ZodOptional<z.ZodString>;
@@ -211,6 +212,67 @@ declare const configSchema: z.ZodOptional<z.ZodNullable<z.ZodObject<{
211
212
  branch: z.ZodOptional<z.ZodString>;
212
213
  }, z.core.$strict>]>>>, z.ZodString]>>;
213
214
  excludeFiles: z.ZodOptional<z.ZodArray<z.ZodString>>;
215
+ agent: z.ZodOptional<z.ZodObject<{
216
+ preset: z.ZodOptional<z.ZodString>;
217
+ strategy: z.ZodOptional<z.ZodEnum<{
218
+ "goal-directed": "goal-directed";
219
+ "continuous-improvement": "continuous-improvement";
220
+ }>>;
221
+ continueOnCompletion: z.ZodOptional<z.ZodBoolean>;
222
+ maxIterations: z.ZodOptional<z.ZodNumber>;
223
+ timeout: z.ZodOptional<z.ZodNumber>;
224
+ requireApprovalFor: z.ZodOptional<z.ZodEnum<{
225
+ none: "none";
226
+ destructive: "destructive";
227
+ commits: "commits";
228
+ all: "all";
229
+ }>>;
230
+ autoApproveSafeTasks: z.ZodOptional<z.ZodBoolean>;
231
+ maxAutoApprovalCost: z.ZodOptional<z.ZodNumber>;
232
+ pauseOnError: z.ZodOptional<z.ZodBoolean>;
233
+ workingBranch: z.ZodOptional<z.ZodString>;
234
+ destructiveOperations: z.ZodOptional<z.ZodArray<z.ZodString>>;
235
+ maxConcurrency: z.ZodOptional<z.ZodNumber>;
236
+ autoSaveInterval: z.ZodOptional<z.ZodNumber>;
237
+ workingDir: z.ZodOptional<z.ZodString>;
238
+ continuousImprovement: z.ZodOptional<z.ZodObject<{
239
+ sleepTimeOnNoTasks: z.ZodOptional<z.ZodNumber>;
240
+ sleepTimeBetweenTasks: z.ZodOptional<z.ZodNumber>;
241
+ maxCycles: z.ZodOptional<z.ZodNumber>;
242
+ }, z.core.$strict>>;
243
+ discovery: z.ZodOptional<z.ZodObject<{
244
+ enabledStrategies: z.ZodOptional<z.ZodArray<z.ZodString>>;
245
+ cacheTime: z.ZodOptional<z.ZodNumber>;
246
+ checkChanges: z.ZodOptional<z.ZodBoolean>;
247
+ }, z.core.$strict>>;
248
+ safety: z.ZodOptional<z.ZodObject<{
249
+ enabledChecks: z.ZodOptional<z.ZodArray<z.ZodString>>;
250
+ blockDestructive: z.ZodOptional<z.ZodBoolean>;
251
+ maxFileSize: z.ZodOptional<z.ZodNumber>;
252
+ }, z.core.$strict>>;
253
+ healthCheck: z.ZodOptional<z.ZodObject<{
254
+ enabled: z.ZodOptional<z.ZodBoolean>;
255
+ interval: z.ZodOptional<z.ZodNumber>;
256
+ }, z.core.$strict>>;
257
+ approval: z.ZodOptional<z.ZodObject<{
258
+ level: z.ZodOptional<z.ZodEnum<{
259
+ none: "none";
260
+ destructive: "destructive";
261
+ commits: "commits";
262
+ all: "all";
263
+ }>>;
264
+ autoApproveSafeTasks: z.ZodOptional<z.ZodBoolean>;
265
+ maxAutoApprovalCost: z.ZodOptional<z.ZodNumber>;
266
+ }, z.core.$strict>>;
267
+ }, z.core.$strict>>;
268
+ memory: z.ZodOptional<z.ZodObject<{
269
+ enabled: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
270
+ type: z.ZodDefault<z.ZodOptional<z.ZodEnum<{
271
+ sqlite: "sqlite";
272
+ memory: "memory";
273
+ }>>>;
274
+ path: z.ZodDefault<z.ZodOptional<z.ZodString>>;
275
+ }, z.core.$strict>>;
214
276
  }, z.core.$strict>>>;
215
277
  export { configSchema }
216
278
  export { configSchema as configSchema_alias_1 }
@@ -254,15 +316,98 @@ export { createDynamicWorkflow }
254
316
  export { createDynamicWorkflow as createDynamicWorkflow_alias_1 }
255
317
  export { createDynamicWorkflow as createDynamicWorkflow_alias_2 }
256
318
 
319
+ /**
320
+ * Create an error tool response
321
+ *
322
+ * @param message - The error message
323
+ * @returns An error tool response object
324
+ *
325
+ * @example
326
+ * ```ts
327
+ * return createErrorResponse('Failed to read file')
328
+ * ```
329
+ */
330
+ declare function createErrorResponse(message: string): ToolResponse;
331
+ export { createErrorResponse }
332
+ export { createErrorResponse as createErrorResponse_alias_1 }
333
+ export { createErrorResponse as createErrorResponse_alias_2 }
334
+
257
335
  /**
258
336
  * Create a file content XML element
259
337
  */
260
338
  export declare function createFileElement(tagName: string, path: string, content?: string, attrs?: Record<string, string>): string;
261
339
 
262
340
  /**
263
- * Create a standardized error response for provider method not available
341
+ * Create a provider capability error response
342
+ * Use this when a required provider capability is not available
343
+ *
344
+ * @param capability - The capability that's missing (e.g., "read file", "write file")
345
+ * @returns An error response indicating the missing capability
346
+ *
347
+ * @example
348
+ * ```ts
349
+ * if (!provider.readFile) {
350
+ * return createProviderErrorResponse('read file')
351
+ * }
352
+ * ```
353
+ */
354
+ declare function createProviderErrorResponse(capability: string): ToolResponse;
355
+ export { createProviderErrorResponse as createProviderError }
356
+ export { createProviderErrorResponse }
357
+ export { createProviderErrorResponse as createProviderErrorResponse_alias_1 }
358
+ export { createProviderErrorResponse as createProviderErrorResponse_alias_2 }
359
+
360
+ /**
361
+ * Create a successful tool response
362
+ *
363
+ * @param value - The response value (string or JSON string)
364
+ * @param type - Response type ('text' or 'json')
365
+ * @returns A successful tool response object
366
+ *
367
+ * @example
368
+ * ```ts
369
+ * return createSuccessResponse('File content loaded')
370
+ * return createSuccessResponse(JSON.stringify(data), 'json')
371
+ * ```
372
+ */
373
+ declare function createSuccessResponse(value: string, type?: 'text' | 'json'): ToolResponse;
374
+ export { createSuccessResponse }
375
+ export { createSuccessResponse as createSuccessResponse_alias_1 }
376
+ export { createSuccessResponse as createSuccessResponse_alias_2 }
377
+
378
+ /**
379
+ * Create a validation error response
380
+ * Use this when input validation fails
381
+ *
382
+ * @param errors - The validation error details
383
+ * @returns An error response with validation details
384
+ *
385
+ * @example
386
+ * ```ts
387
+ * const result = schema.safeParse(input)
388
+ * if (!result.success) {
389
+ * return createValidationErrorResponse(result.error)
390
+ * }
391
+ * ```
392
+ */
393
+ declare function createValidationErrorResponse(errors: {
394
+ message: string;
395
+ }): ToolResponse;
396
+ export { createValidationErrorResponse }
397
+ export { createValidationErrorResponse as createValidationErrorResponse_alias_1 }
398
+ export { createValidationErrorResponse as createValidationErrorResponse_alias_2 }
399
+
400
+ /**
401
+ * Database statistics
264
402
  */
265
- export declare function createProviderError(action: string): ToolResponse;
403
+ declare type DatabaseStats = {
404
+ totalEntries: number;
405
+ entriesByType: Record<string, number>;
406
+ databaseSize: number;
407
+ };
408
+ export { DatabaseStats }
409
+ export { DatabaseStats as DatabaseStats_alias_1 }
410
+ export { DatabaseStats as DatabaseStats_alias_2 }
266
411
 
267
412
  declare const _default: {
268
413
  handler: ToolHandler<{
@@ -331,14 +476,14 @@ export { _default_11 as searchFiles_alias_1 }
331
476
  declare const _default_12: {
332
477
  handler: ToolHandler<{
333
478
  readonly name: "writeToFile";
334
- 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.";
479
+ readonly description: "Request to write content to a file at the specified path.\n\nWhen to use:\n- Creating new files\n- Completely replacing file contents\n- When you have the complete intended content\n\nWhen NOT to use:\n- For modifying existing files: Use replaceInFile instead\n- For appending content: Use executeCommand with echo >> instead\n- For targeted edits: Use replaceInFile instead\n\nFeatures:\n- Automatically creates any directories needed\n- Overwrites existing files completely\n- Must provide complete file content (no truncation)\n\nIMPORTANT CONSTRAINT:\n- Always provide COMPLETE intended content (no omissions)\n- Ensure no incorrect escape sequences (&lt;, &gt;, &amp;)\n- Ensure no unwanted CDATA tags in content";
335
480
  readonly parameters: z.ZodObject<{
336
481
  path: z.ZodString;
337
482
  content: z.ZodString;
338
483
  }, z.core.$strip>;
339
484
  }, FilesystemProvider>;
340
485
  name: "writeToFile";
341
- 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
+ description: "Request to write content to a file at the specified path.\n\nWhen to use:\n- Creating new files\n- Completely replacing file contents\n- When you have the complete intended content\n\nWhen NOT to use:\n- For modifying existing files: Use replaceInFile instead\n- For appending content: Use executeCommand with echo >> instead\n- For targeted edits: Use replaceInFile instead\n\nFeatures:\n- Automatically creates any directories needed\n- Overwrites existing files completely\n- Must provide complete file content (no truncation)\n\nIMPORTANT CONSTRAINT:\n- Always provide COMPLETE intended content (no omissions)\n- Ensure no incorrect escape sequences (&lt;, &gt;, &amp;)\n- Ensure no unwanted CDATA tags in content";
342
487
  parameters: z.ZodObject<{
343
488
  path: z.ZodString;
344
489
  content: z.ZodString;
@@ -431,16 +576,20 @@ export { _default_5 as readBinaryFile_alias_1 }
431
576
  declare const _default_6: {
432
577
  handler: ToolHandler<{
433
578
  readonly name: "readFile";
434
- 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.";
579
+ readonly description: "Request to read the contents of one or multiple files at the specified paths.\n\nWhen to use:\n- Examining file contents you don't know\n- Analyzing code, reviewing text files, extracting configuration info\n- Reading multiple files at once (use comma-separated paths)\n- Understanding file structure before editing\n\nWhen NOT to use:\n- For file existence checks: Use listFiles instead\n- For searching within files: Use grep instead\n- For file name searches: Use searchFiles instead\n- Prefer this tool over executeCommand with cat/head/tail\n\nFeatures:\n- Supports comma-separated paths for multiple files\n- Line numbers included for easy reference\n- Optional offset/limit for partial file reading\n- Automatically handles different file types\n\nIMPORTANT:\n- Line numbers are included for easy reference\n- Use offset/limit for large files to read specific sections";
435
580
  readonly parameters: z.ZodObject<{
436
- path: z.ZodPipe<z.ZodTransform<string[], unknown>, z.ZodArray<z.ZodString>>;
581
+ path: z.ZodPipe<z.ZodTransform<any[], unknown>, z.ZodArray<z.ZodString>>;
582
+ offset: z.ZodOptional<z.ZodNumber>;
583
+ limit: z.ZodOptional<z.ZodNumber>;
437
584
  includeIgnored: z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodDefault<z.ZodOptional<z.ZodNullable<z.ZodBoolean>>>>;
438
585
  }, z.core.$strip>;
439
586
  }, FilesystemProvider>;
440
587
  name: "readFile";
441
- 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.";
588
+ description: "Request to read the contents of one or multiple files at the specified paths.\n\nWhen to use:\n- Examining file contents you don't know\n- Analyzing code, reviewing text files, extracting configuration info\n- Reading multiple files at once (use comma-separated paths)\n- Understanding file structure before editing\n\nWhen NOT to use:\n- For file existence checks: Use listFiles instead\n- For searching within files: Use grep instead\n- For file name searches: Use searchFiles instead\n- Prefer this tool over executeCommand with cat/head/tail\n\nFeatures:\n- Supports comma-separated paths for multiple files\n- Line numbers included for easy reference\n- Optional offset/limit for partial file reading\n- Automatically handles different file types\n\nIMPORTANT:\n- Line numbers are included for easy reference\n- Use offset/limit for large files to read specific sections";
442
589
  parameters: z.ZodObject<{
443
- path: z.ZodPipe<z.ZodTransform<string[], unknown>, z.ZodArray<z.ZodString>>;
590
+ path: z.ZodPipe<z.ZodTransform<any[], unknown>, z.ZodArray<z.ZodString>>;
591
+ offset: z.ZodOptional<z.ZodNumber>;
592
+ limit: z.ZodOptional<z.ZodNumber>;
444
593
  includeIgnored: z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodDefault<z.ZodOptional<z.ZodNullable<z.ZodBoolean>>>>;
445
594
  }, z.core.$strip>;
446
595
  };
@@ -489,14 +638,14 @@ export { _default_8 as renameFile_alias_1 }
489
638
  declare const _default_9: {
490
639
  handler: ToolHandler<{
491
640
  readonly name: "replaceInFile";
492
- 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.";
641
+ readonly description: "Request to replace sections of content in an existing file using\nSEARCH/REPLACE blocks.\n\nWhen to use:\n- Making targeted changes to specific parts of a file\n- Replacing variable names, function signatures, imports\n- Fixing bugs in existing code\n- When you know the exact content to replace\n\nWhen NOT to use:\n- For creating new files: Use writeToFile instead\n- For completely replacing file contents: Use writeToFile instead\n- When you don't know the exact content: Read file first\n\nSEARCH/REPLACE FORMAT:\n<<<<<<< SEARCH\n[exact content to find]\n=======\n[new content to replace with]\n>>>>>>> REPLACE\n\nCritical rules:\n1. SEARCH content must match EXACTLY (character-for-character including whitespace)\n2. Each block replaces only first occurrence\n3. Include just enough lines for uniqueness (not too many, not too few)\n4. Keep blocks concise (don't include long unchanged sections)\n5. List blocks in order they appear in file\n6. Use multiple blocks for multiple independent changes\n\nSpecial operations:\n- Move code: Two blocks (delete from original + insert at new location)\n- Delete code: Empty REPLACE section\n\nIMPORTANT CONSTRAINTS:\n- SEARCH text must match file content exactly\n- Each block is independent (doesn't affect other blocks)\n- Cannot use for appending or inserting without SEARCH context";
493
642
  readonly parameters: z.ZodObject<{
494
643
  path: z.ZodString;
495
644
  diff: z.ZodString;
496
645
  }, z.core.$strip>;
497
646
  }, FilesystemProvider>;
498
647
  name: "replaceInFile";
499
- 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.";
648
+ description: "Request to replace sections of content in an existing file using\nSEARCH/REPLACE blocks.\n\nWhen to use:\n- Making targeted changes to specific parts of a file\n- Replacing variable names, function signatures, imports\n- Fixing bugs in existing code\n- When you know the exact content to replace\n\nWhen NOT to use:\n- For creating new files: Use writeToFile instead\n- For completely replacing file contents: Use writeToFile instead\n- When you don't know the exact content: Read file first\n\nSEARCH/REPLACE FORMAT:\n<<<<<<< SEARCH\n[exact content to find]\n=======\n[new content to replace with]\n>>>>>>> REPLACE\n\nCritical rules:\n1. SEARCH content must match EXACTLY (character-for-character including whitespace)\n2. Each block replaces only first occurrence\n3. Include just enough lines for uniqueness (not too many, not too few)\n4. Keep blocks concise (don't include long unchanged sections)\n5. List blocks in order they appear in file\n6. Use multiple blocks for multiple independent changes\n\nSpecial operations:\n- Move code: Two blocks (delete from original + insert at new location)\n- Delete code: Empty REPLACE section\n\nIMPORTANT CONSTRAINTS:\n- SEARCH text must match file content exactly\n- Each block is independent (doesn't affect other blocks)\n- Cannot use for appending or inserting without SEARCH context";
500
649
  parameters: z.ZodObject<{
501
650
  path: z.ZodString;
502
651
  diff: z.ZodString;
@@ -506,6 +655,14 @@ export { _default_9 as default_alias_8 }
506
655
  export { _default_9 as replaceInFile }
507
656
  export { _default_9 as replaceInFile_alias_1 }
508
657
 
658
+ /**
659
+ * Default memory configuration
660
+ */
661
+ declare const DEFAULT_MEMORY_CONFIG: MemoryConfig;
662
+ export { DEFAULT_MEMORY_CONFIG }
663
+ export { DEFAULT_MEMORY_CONFIG as DEFAULT_MEMORY_CONFIG_alias_1 }
664
+ export { DEFAULT_MEMORY_CONFIG as DEFAULT_MEMORY_CONFIG_alias_2 }
665
+
509
666
  /**
510
667
  * Represents a directory entry
511
668
  */
@@ -678,6 +835,7 @@ export { FileSystemProvider as FileSystemProvider_alias_2 }
678
835
  declare type FilesystemProvider = {
679
836
  readFile?: (path: string, includeIgnored: boolean) => Promise<string | undefined>;
680
837
  writeFile?: (path: string, content: string) => Promise<void>;
838
+ fileExists?: (path: string) => Promise<boolean>;
681
839
  removeFile?: (path: string) => Promise<void>;
682
840
  renameFile?: (sourcePath: string, targetPath: string) => Promise<void>;
683
841
  listFiles?: (path: string, recursive: boolean, maxCount: number, includeIgnored: boolean) => Promise<[string[], boolean]>;
@@ -790,6 +948,64 @@ export { IGNORED_DIRECTORIES }
790
948
  export { IGNORED_DIRECTORIES as IGNORED_DIRECTORIES_alias_1 }
791
949
  export { IGNORED_DIRECTORIES as IGNORED_DIRECTORIES_alias_2 }
792
950
 
951
+ /**
952
+ * Memory Store Interface
953
+ *
954
+ * This interface defines the contract for memory store implementations.
955
+ * Implementations can use different storage backends (SQLite, PostgreSQL, Redis, etc.)
956
+ * while maintaining the same API for the core memory logic.
957
+ */
958
+ declare interface IMemoryStore {
959
+ /**
960
+ * Read memory by topic name
961
+ *
962
+ * @param topic - The topic name
963
+ * @returns The content, or undefined if not found
964
+ */
965
+ readMemory(topic: string): Promise<string | undefined>;
966
+ /**
967
+ * Update memory with operation
968
+ *
969
+ * @param operation - The operation to perform ('append', 'replace', 'remove')
970
+ * @param topic - The topic name
971
+ * @param content - The content (required for append/replace)
972
+ * @param metadata - Optional metadata (entry_type, status, priority, tags)
973
+ */
974
+ updateMemory(operation: 'append' | 'replace' | 'remove', topic: string, content: string | undefined, metadata?: {
975
+ entry_type?: string;
976
+ status?: string;
977
+ priority?: string;
978
+ tags?: string;
979
+ }): Promise<void>;
980
+ /**
981
+ * Query memory with filters
982
+ *
983
+ * @param query - The query filters
984
+ * @param options - Query options (operation, includeMetadata)
985
+ * @returns Array of entries or count
986
+ */
987
+ queryMemory(query: MemoryQuery, options?: QueryOptions): Promise<MemoryEntry[] | number>;
988
+ /**
989
+ * Batch update memory
990
+ *
991
+ * @param operations - Array of memory operations
992
+ */
993
+ batchUpdateMemory(operations: MemoryOperation[]): Promise<void>;
994
+ /**
995
+ * Get database statistics
996
+ *
997
+ * @returns Database statistics
998
+ */
999
+ getStats(): Promise<DatabaseStats>;
1000
+ /**
1001
+ * Close the memory store and release resources
1002
+ */
1003
+ close(): void;
1004
+ }
1005
+ export { IMemoryStore }
1006
+ export { IMemoryStore as IMemoryStore_alias_1 }
1007
+ export { IMemoryStore as IMemoryStore_alias_2 }
1008
+
793
1009
  declare type InteractionProvider = {
794
1010
  askFollowupQuestion?: (question: string, options: string[]) => Promise<string>;
795
1011
  };
@@ -1155,6 +1371,67 @@ declare const mcpServerConfigSchema: z.ZodObject<{
1155
1371
  export { mcpServerConfigSchema }
1156
1372
  export { mcpServerConfigSchema as mcpServerConfigSchema_alias_1 }
1157
1373
 
1374
+ declare type MemoryConfig = z.infer<typeof memoryConfigSchema> & MemoryStoreConfig;
1375
+ export { MemoryConfig }
1376
+ export { MemoryConfig as MemoryConfig_alias_1 }
1377
+ export { MemoryConfig as MemoryConfig_alias_2 }
1378
+
1379
+ /**
1380
+ * Memory configuration schema
1381
+ * Controls the persistent memory store feature
1382
+ */
1383
+ declare const memoryConfigSchema: z.ZodOptional<z.ZodObject<{
1384
+ enabled: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
1385
+ type: z.ZodDefault<z.ZodOptional<z.ZodEnum<{
1386
+ sqlite: "sqlite";
1387
+ memory: "memory";
1388
+ }>>>;
1389
+ path: z.ZodDefault<z.ZodOptional<z.ZodString>>;
1390
+ }, z.core.$strict>>;
1391
+ export { memoryConfigSchema }
1392
+ export { memoryConfigSchema as memoryConfigSchema_alias_1 }
1393
+ export { memoryConfigSchema as memoryConfigSchema_alias_2 }
1394
+
1395
+ /**
1396
+ * Memory entry types
1397
+ */
1398
+ declare type MemoryEntry = {
1399
+ id: string;
1400
+ name: string;
1401
+ scope: string;
1402
+ content: string;
1403
+ entry_type: string;
1404
+ status?: string;
1405
+ priority?: 'low' | 'medium' | 'high' | 'critical';
1406
+ tags?: string;
1407
+ metadata?: string;
1408
+ created_at: number;
1409
+ updated_at: number;
1410
+ last_accessed: number;
1411
+ };
1412
+ export { MemoryEntry }
1413
+ export { MemoryEntry as MemoryEntry_alias_1 }
1414
+ export { MemoryEntry as MemoryEntry_alias_2 }
1415
+
1416
+ /**
1417
+ * Memory operation for batch updates
1418
+ */
1419
+ declare type MemoryOperation = {
1420
+ operation: 'append' | 'replace' | 'remove';
1421
+ name: string;
1422
+ content?: string;
1423
+ metadata?: {
1424
+ entry_type?: string;
1425
+ status?: string;
1426
+ priority?: string;
1427
+ tags?: string;
1428
+ metadata?: string;
1429
+ };
1430
+ };
1431
+ export { MemoryOperation }
1432
+ export { MemoryOperation as MemoryOperation_alias_1 }
1433
+ export { MemoryOperation as MemoryOperation_alias_2 }
1434
+
1158
1435
  declare interface MemoryProvider {
1159
1436
  listMemoryTopics: () => Promise<string[]>;
1160
1437
  readMemory: (topic?: string) => Promise<string | undefined>;
@@ -1164,6 +1441,42 @@ export { MemoryProvider }
1164
1441
  export { MemoryProvider as MemoryProvider_alias_1 }
1165
1442
  export { MemoryProvider as MemoryProvider_alias_2 }
1166
1443
 
1444
+ /**
1445
+ * Memory query filters
1446
+ */
1447
+ declare type MemoryQuery = {
1448
+ scope?: 'global' | 'project' | 'auto';
1449
+ type?: string;
1450
+ status?: string;
1451
+ priority?: string;
1452
+ tags?: string | string[];
1453
+ search?: string;
1454
+ limit?: number;
1455
+ offset?: number;
1456
+ sortBy?: 'created' | 'updated' | 'accessed' | 'name';
1457
+ sortOrder?: 'asc' | 'desc';
1458
+ createdAfter?: number;
1459
+ createdBefore?: number;
1460
+ updatedAfter?: number;
1461
+ updatedBefore?: number;
1462
+ };
1463
+ export { MemoryQuery }
1464
+ export { MemoryQuery as MemoryQuery_alias_1 }
1465
+ export { MemoryQuery as MemoryQuery_alias_2 }
1466
+
1467
+ /**
1468
+ * Memory Store Configuration
1469
+ */
1470
+ declare type MemoryStoreConfig = {
1471
+ enabled: boolean;
1472
+ type: 'sqlite' | 'memory' | string;
1473
+ path?: string;
1474
+ [key: string]: any;
1475
+ };
1476
+ export { MemoryStoreConfig }
1477
+ export { MemoryStoreConfig as MemoryStoreConfig_alias_1 }
1478
+ export { MemoryStoreConfig as MemoryStoreConfig_alias_2 }
1479
+
1167
1480
  declare class MockProvider implements ToolProvider {
1168
1481
  listTodoItems(id?: string | null, _status?: string | null): Promise<{
1169
1482
  id: string;
@@ -1264,6 +1577,7 @@ declare const providerConfigSchema: z.ZodObject<{
1264
1577
  project: z.ZodOptional<z.ZodString>;
1265
1578
  keyFile: z.ZodOptional<z.ZodString>;
1266
1579
  baseUrl: z.ZodOptional<z.ZodString>;
1580
+ name: z.ZodOptional<z.ZodString>;
1267
1581
  }, z.core.$strip>;
1268
1582
  export { providerConfigSchema }
1269
1583
  export { providerConfigSchema as providerConfigSchema_alias_1 }
@@ -1288,6 +1602,17 @@ declare const providerModelSchema: z.ZodObject<{
1288
1602
  export { providerModelSchema }
1289
1603
  export { providerModelSchema as providerModelSchema_alias_1 }
1290
1604
 
1605
+ /**
1606
+ * Query options
1607
+ */
1608
+ declare type QueryOptions = {
1609
+ operation?: 'select' | 'delete' | 'count';
1610
+ includeMetadata?: boolean;
1611
+ };
1612
+ export { QueryOptions }
1613
+ export { QueryOptions as QueryOptions_alias_1 }
1614
+ export { QueryOptions as QueryOptions_alias_2 }
1615
+
1291
1616
  /**
1292
1617
  * Read a supporting file from a loaded skill
1293
1618
  *
@@ -1367,6 +1692,14 @@ declare type ReplaceResult = {
1367
1692
  export { ReplaceResult }
1368
1693
  export { ReplaceResult as ReplaceResult_alias_1 }
1369
1694
 
1695
+ /**
1696
+ * Resolve home directory in path
1697
+ */
1698
+ declare function resolveHomePath(path: string): string;
1699
+ export { resolveHomePath }
1700
+ export { resolveHomePath as resolveHomePath_alias_1 }
1701
+ export { resolveHomePath as resolveHomePath_alias_2 }
1702
+
1370
1703
  declare const responsePrompts: {
1371
1704
  readonly errorInvokeTool: (tool: string, error: unknown) => string;
1372
1705
  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";
@@ -1898,7 +2231,7 @@ export declare const toolInfo_alias_10: {
1898
2231
 
1899
2232
  export declare const toolInfo_alias_11: {
1900
2233
  readonly name: "writeToFile";
1901
- 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.";
2234
+ readonly description: "Request to write content to a file at the specified path.\n\nWhen to use:\n- Creating new files\n- Completely replacing file contents\n- When you have the complete intended content\n\nWhen NOT to use:\n- For modifying existing files: Use replaceInFile instead\n- For appending content: Use executeCommand with echo >> instead\n- For targeted edits: Use replaceInFile instead\n\nFeatures:\n- Automatically creates any directories needed\n- Overwrites existing files completely\n- Must provide complete file content (no truncation)\n\nIMPORTANT CONSTRAINT:\n- Always provide COMPLETE intended content (no omissions)\n- Ensure no incorrect escape sequences (&lt;, &gt;, &amp;)\n- Ensure no unwanted CDATA tags in content";
1902
2235
  readonly parameters: z.ZodObject<{
1903
2236
  path: z.ZodString;
1904
2237
  content: z.ZodString;
@@ -1934,9 +2267,11 @@ export declare const toolInfo_alias_4: {
1934
2267
 
1935
2268
  export declare const toolInfo_alias_5: {
1936
2269
  readonly name: "readFile";
1937
- 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.";
2270
+ readonly description: "Request to read the contents of one or multiple files at the specified paths.\n\nWhen to use:\n- Examining file contents you don't know\n- Analyzing code, reviewing text files, extracting configuration info\n- Reading multiple files at once (use comma-separated paths)\n- Understanding file structure before editing\n\nWhen NOT to use:\n- For file existence checks: Use listFiles instead\n- For searching within files: Use grep instead\n- For file name searches: Use searchFiles instead\n- Prefer this tool over executeCommand with cat/head/tail\n\nFeatures:\n- Supports comma-separated paths for multiple files\n- Line numbers included for easy reference\n- Optional offset/limit for partial file reading\n- Automatically handles different file types\n\nIMPORTANT:\n- Line numbers are included for easy reference\n- Use offset/limit for large files to read specific sections";
1938
2271
  readonly parameters: z.ZodObject<{
1939
- path: z.ZodPipe<z.ZodTransform<string[], unknown>, z.ZodArray<z.ZodString>>;
2272
+ path: z.ZodPipe<z.ZodTransform<any[], unknown>, z.ZodArray<z.ZodString>>;
2273
+ offset: z.ZodOptional<z.ZodNumber>;
2274
+ limit: z.ZodOptional<z.ZodNumber>;
1940
2275
  includeIgnored: z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodDefault<z.ZodOptional<z.ZodNullable<z.ZodBoolean>>>>;
1941
2276
  }, z.core.$strip>;
1942
2277
  };
@@ -1960,7 +2295,7 @@ export declare const toolInfo_alias_7: {
1960
2295
 
1961
2296
  export declare const toolInfo_alias_8: {
1962
2297
  readonly name: "replaceInFile";
1963
- 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.";
2298
+ readonly description: "Request to replace sections of content in an existing file using\nSEARCH/REPLACE blocks.\n\nWhen to use:\n- Making targeted changes to specific parts of a file\n- Replacing variable names, function signatures, imports\n- Fixing bugs in existing code\n- When you know the exact content to replace\n\nWhen NOT to use:\n- For creating new files: Use writeToFile instead\n- For completely replacing file contents: Use writeToFile instead\n- When you don't know the exact content: Read file first\n\nSEARCH/REPLACE FORMAT:\n<<<<<<< SEARCH\n[exact content to find]\n=======\n[new content to replace with]\n>>>>>>> REPLACE\n\nCritical rules:\n1. SEARCH content must match EXACTLY (character-for-character including whitespace)\n2. Each block replaces only first occurrence\n3. Include just enough lines for uniqueness (not too many, not too few)\n4. Keep blocks concise (don't include long unchanged sections)\n5. List blocks in order they appear in file\n6. Use multiple blocks for multiple independent changes\n\nSpecial operations:\n- Move code: Two blocks (delete from original + insert at new location)\n- Delete code: Empty REPLACE section\n\nIMPORTANT CONSTRAINTS:\n- SEARCH text must match file content exactly\n- Each block is independent (doesn't affect other blocks)\n- Cannot use for appending or inserting without SEARCH context";
1964
2299
  readonly parameters: z.ZodObject<{
1965
2300
  path: z.ZodString;
1966
2301
  diff: z.ZodString;
package/dist/index.d.ts CHANGED
@@ -3,6 +3,10 @@ export { ParseOutputResult } from './_tsup-dts-rollup.js';
3
3
  export { parseJsonFromMarkdown } from './_tsup-dts-rollup.js';
4
4
  export { responsePrompts } from './_tsup-dts-rollup.js';
5
5
  export { computeRateLimitBackoffSeconds } from './_tsup-dts-rollup.js';
6
+ export { memoryConfigSchema_alias_1 as memoryConfigSchema } from './_tsup-dts-rollup.js';
7
+ export { DEFAULT_MEMORY_CONFIG_alias_1 as DEFAULT_MEMORY_CONFIG } from './_tsup-dts-rollup.js';
8
+ export { MemoryConfig_alias_1 as MemoryConfig } from './_tsup-dts-rollup.js';
9
+ export { resolveHomePath_alias_1 as resolveHomePath } from './_tsup-dts-rollup.js';
6
10
  export { ruleSchema_alias_1 as ruleSchema } from './_tsup-dts-rollup.js';
7
11
  export { providerConfigSchema_alias_1 as providerConfigSchema } from './_tsup-dts-rollup.js';
8
12
  export { providerModelSchema_alias_1 as providerModelSchema } from './_tsup-dts-rollup.js';
@@ -19,6 +23,13 @@ export { DirectoryEntry } from './_tsup-dts-rollup.js';
19
23
  export { FileStats } from './_tsup-dts-rollup.js';
20
24
  export { FileSystemProvider } from './_tsup-dts-rollup.js';
21
25
  export { FileSystemProviderOptions } from './_tsup-dts-rollup.js';
26
+ export { MemoryEntry } from './_tsup-dts-rollup.js';
27
+ export { MemoryQuery } from './_tsup-dts-rollup.js';
28
+ export { QueryOptions } from './_tsup-dts-rollup.js';
29
+ export { MemoryOperation } from './_tsup-dts-rollup.js';
30
+ export { DatabaseStats } from './_tsup-dts-rollup.js';
31
+ export { IMemoryStore } from './_tsup-dts-rollup.js';
32
+ export { MemoryStoreConfig } from './_tsup-dts-rollup.js';
22
33
  export { SKILL_LIMITS } from './_tsup-dts-rollup.js';
23
34
  export { IGNORED_DIRECTORIES } from './_tsup-dts-rollup.js';
24
35
  export { SUSPICIOUS_PATTERNS } from './_tsup-dts-rollup.js';
@@ -72,6 +83,10 @@ export { readFile } from './_tsup-dts-rollup.js';
72
83
  export { removeFile } from './_tsup-dts-rollup.js';
73
84
  export { renameFile } from './_tsup-dts-rollup.js';
74
85
  export { replaceInFile } from './_tsup-dts-rollup.js';
86
+ export { createErrorResponse } from './_tsup-dts-rollup.js';
87
+ export { createProviderErrorResponse } from './_tsup-dts-rollup.js';
88
+ export { createSuccessResponse } from './_tsup-dts-rollup.js';
89
+ export { createValidationErrorResponse } from './_tsup-dts-rollup.js';
75
90
  export { search } from './_tsup-dts-rollup.js';
76
91
  export { searchFiles } from './_tsup-dts-rollup.js';
77
92
  export { writeToFile } from './_tsup-dts-rollup.js';