@polka-codes/core 0.8.22 → 0.8.23

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.
@@ -168,15 +168,16 @@ export declare namespace allTools {
168
168
  _default_2 as attemptCompletion,
169
169
  _default_3 as delegate,
170
170
  _default_4 as executeCommand,
171
- _default_5 as listFiles,
172
- _default_6 as readFile,
173
- _default_7 as replaceInFile,
174
- _default_8 as searchFiles,
175
- _default_9 as updateKnowledge,
176
- _default_10 as writeToFile,
177
- _default_11 as handOver,
178
- _default_12 as removeFile,
179
- _default_13 as renameFile
171
+ _default_5 as fetchUrl,
172
+ _default_6 as listFiles,
173
+ _default_7 as readFile,
174
+ _default_8 as replaceInFile,
175
+ _default_9 as searchFiles,
176
+ _default_10 as updateKnowledge,
177
+ _default_11 as writeToFile,
178
+ _default_12 as handOver,
179
+ _default_13 as removeFile,
180
+ _default_14 as renameFile
180
181
  }
181
182
  }
182
183
 
@@ -928,6 +929,136 @@ export { _default as askFollowupQuestion_alias_2 }
928
929
  export { _default as default_alias_4 }
929
930
 
930
931
  declare const _default_10: {
932
+ handler: ToolHandler<{
933
+ readonly name: "update_knowledge";
934
+ readonly description: "Update knowledge in a knowledge.ai.yml file with smart merging capabilities. This tool lets you add, update, or remove information using path-based updates and special directives.";
935
+ readonly parameters: [{
936
+ readonly name: "path";
937
+ readonly description: "Directory containing (or where to create) the knowledge.ai.yml file";
938
+ readonly required: true;
939
+ readonly usageValue: "Directory path here";
940
+ }, {
941
+ readonly name: "knowledge";
942
+ readonly description: "YAML content to merge into the knowledge file";
943
+ readonly required: true;
944
+ readonly usageValue: "YAML content with knowledge to update";
945
+ }];
946
+ readonly examples: [{
947
+ readonly description: "Add a new file entry";
948
+ readonly parameters: [{
949
+ readonly name: "path";
950
+ readonly value: "src/utils";
951
+ }, {
952
+ readonly name: "knowledge";
953
+ readonly value: "files:\n \"newFile.ts\":\n description: \"A new utility file\"\n api:\n functions:\n 1:\n name: \"processData\"\n params:\n 1: { name: \"data\", type: \"object\" }\n returns: \"object\"";
954
+ }];
955
+ }, {
956
+ readonly description: "Update an existing file description";
957
+ readonly parameters: [{
958
+ readonly name: "path";
959
+ readonly value: "src/utils";
960
+ }, {
961
+ readonly name: "knowledge";
962
+ readonly value: "files:\n \"existingFile.ts\":\n description: \"Updated description for the file\"";
963
+ }];
964
+ }, {
965
+ readonly description: "Add a new rule";
966
+ readonly parameters: [{
967
+ readonly name: "path";
968
+ readonly value: "src";
969
+ }, {
970
+ readonly name: "knowledge";
971
+ readonly value: "rules:\n 10: \"New rule to follow\"";
972
+ }];
973
+ }, {
974
+ readonly description: "Remove a rule";
975
+ readonly parameters: [{
976
+ readonly name: "path";
977
+ readonly value: "src";
978
+ }, {
979
+ readonly name: "knowledge";
980
+ readonly value: "rules:\n 5: null";
981
+ }];
982
+ }, {
983
+ readonly description: "Update nested properties using dot notation";
984
+ readonly parameters: [{
985
+ readonly name: "path";
986
+ readonly value: "src/components";
987
+ }, {
988
+ readonly name: "knowledge";
989
+ readonly value: "files.Button.tsx.api.functions.1.description: \"Updated function description\"";
990
+ }];
991
+ }];
992
+ readonly permissionLevel: PermissionLevel.Write;
993
+ }, FilesystemProvider>;
994
+ isAvailable: (provider: FilesystemProvider) => boolean;
995
+ name: "update_knowledge";
996
+ description: "Update knowledge in a knowledge.ai.yml file with smart merging capabilities. This tool lets you add, update, or remove information using path-based updates and special directives.";
997
+ parameters: [{
998
+ readonly name: "path";
999
+ readonly description: "Directory containing (or where to create) the knowledge.ai.yml file";
1000
+ readonly required: true;
1001
+ readonly usageValue: "Directory path here";
1002
+ }, {
1003
+ readonly name: "knowledge";
1004
+ readonly description: "YAML content to merge into the knowledge file";
1005
+ readonly required: true;
1006
+ readonly usageValue: "YAML content with knowledge to update";
1007
+ }];
1008
+ examples: [{
1009
+ readonly description: "Add a new file entry";
1010
+ readonly parameters: [{
1011
+ readonly name: "path";
1012
+ readonly value: "src/utils";
1013
+ }, {
1014
+ readonly name: "knowledge";
1015
+ readonly value: "files:\n \"newFile.ts\":\n description: \"A new utility file\"\n api:\n functions:\n 1:\n name: \"processData\"\n params:\n 1: { name: \"data\", type: \"object\" }\n returns: \"object\"";
1016
+ }];
1017
+ }, {
1018
+ readonly description: "Update an existing file description";
1019
+ readonly parameters: [{
1020
+ readonly name: "path";
1021
+ readonly value: "src/utils";
1022
+ }, {
1023
+ readonly name: "knowledge";
1024
+ readonly value: "files:\n \"existingFile.ts\":\n description: \"Updated description for the file\"";
1025
+ }];
1026
+ }, {
1027
+ readonly description: "Add a new rule";
1028
+ readonly parameters: [{
1029
+ readonly name: "path";
1030
+ readonly value: "src";
1031
+ }, {
1032
+ readonly name: "knowledge";
1033
+ readonly value: "rules:\n 10: \"New rule to follow\"";
1034
+ }];
1035
+ }, {
1036
+ readonly description: "Remove a rule";
1037
+ readonly parameters: [{
1038
+ readonly name: "path";
1039
+ readonly value: "src";
1040
+ }, {
1041
+ readonly name: "knowledge";
1042
+ readonly value: "rules:\n 5: null";
1043
+ }];
1044
+ }, {
1045
+ readonly description: "Update nested properties using dot notation";
1046
+ readonly parameters: [{
1047
+ readonly name: "path";
1048
+ readonly value: "src/components";
1049
+ }, {
1050
+ readonly name: "knowledge";
1051
+ readonly value: "files.Button.tsx.api.functions.1.description: \"Updated function description\"";
1052
+ }];
1053
+ }];
1054
+ permissionLevel: PermissionLevel.Write;
1055
+ };
1056
+ export { _default_10 as default_alias_16 }
1057
+ export { _default_10 as updateKnowledge }
1058
+ export { _default_10 as updateKnowledge_alias_1 }
1059
+ export { _default_10 as updateKnowledge_alias_2 }
1060
+
1061
+ declare const _default_11: {
931
1062
  handler: ToolHandler<{
932
1063
  readonly name: "write_to_file";
933
1064
  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;` and `&gt;`.";
@@ -980,12 +1111,12 @@ declare const _default_10: {
980
1111
  }];
981
1112
  permissionLevel: PermissionLevel.Write;
982
1113
  };
983
- export { _default_10 as default_alias_16 }
984
- export { _default_10 as writeToFile }
985
- export { _default_10 as writeToFile_alias_1 }
986
- export { _default_10 as writeToFile_alias_2 }
1114
+ export { _default_11 as default_alias_17 }
1115
+ export { _default_11 as writeToFile }
1116
+ export { _default_11 as writeToFile_alias_1 }
1117
+ export { _default_11 as writeToFile_alias_2 }
987
1118
 
988
- declare const _default_11: {
1119
+ declare const _default_12: {
989
1120
  handler: ToolHandler<{
990
1121
  readonly name: "hand_over";
991
1122
  readonly description: "Hand over the current task to another agent to complete. This tool MUST NOT to be used with any other tool.";
@@ -1070,12 +1201,12 @@ declare const _default_11: {
1070
1201
  }];
1071
1202
  permissionLevel: PermissionLevel.None;
1072
1203
  };
1073
- export { _default_11 as default_alias_8 }
1074
- export { _default_11 as handOver }
1075
- export { _default_11 as handOver_alias_1 }
1076
- export { _default_11 as handOver_alias_2 }
1204
+ export { _default_12 as default_alias_9 }
1205
+ export { _default_12 as handOver }
1206
+ export { _default_12 as handOver_alias_1 }
1207
+ export { _default_12 as handOver_alias_2 }
1077
1208
 
1078
- declare const _default_12: {
1209
+ declare const _default_13: {
1079
1210
  handler: ToolHandler<{
1080
1211
  readonly name: "remove_file";
1081
1212
  readonly description: "Request to remove a file at the specified path.";
@@ -1112,12 +1243,12 @@ declare const _default_12: {
1112
1243
  }];
1113
1244
  permissionLevel: PermissionLevel.Write;
1114
1245
  };
1115
- export { _default_12 as default_alias_11 }
1116
- export { _default_12 as removeFile }
1117
- export { _default_12 as removeFile_alias_1 }
1118
- export { _default_12 as removeFile_alias_2 }
1246
+ export { _default_13 as default_alias_12 }
1247
+ export { _default_13 as removeFile }
1248
+ export { _default_13 as removeFile_alias_1 }
1249
+ export { _default_13 as removeFile_alias_2 }
1119
1250
 
1120
- declare const _default_13: {
1251
+ declare const _default_14: {
1121
1252
  handler: ToolHandler<{
1122
1253
  readonly name: "rename_file";
1123
1254
  readonly description: "Request to rename a file from source path to target path.";
@@ -1170,10 +1301,10 @@ declare const _default_13: {
1170
1301
  }];
1171
1302
  permissionLevel: PermissionLevel.Write;
1172
1303
  };
1173
- export { _default_13 as default_alias_12 }
1174
- export { _default_13 as renameFile }
1175
- export { _default_13 as renameFile_alias_1 }
1176
- export { _default_13 as renameFile_alias_2 }
1304
+ export { _default_14 as default_alias_13 }
1305
+ export { _default_14 as renameFile }
1306
+ export { _default_14 as renameFile_alias_1 }
1307
+ export { _default_14 as renameFile_alias_2 }
1177
1308
 
1178
1309
  declare const _default_2: {
1179
1310
  handler: ToolHandler<{
@@ -1366,6 +1497,70 @@ export { _default_4 as executeCommand_alias_1 }
1366
1497
  export { _default_4 as executeCommand_alias_2 }
1367
1498
 
1368
1499
  declare const _default_5: {
1500
+ handler: ToolHandler<{
1501
+ readonly name: "fetch_url";
1502
+ 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.";
1503
+ readonly parameters: [{
1504
+ readonly name: "url";
1505
+ readonly description: "One or more URLs to fetch, separated by commas if multiple.";
1506
+ readonly required: true;
1507
+ }];
1508
+ readonly examples: [{
1509
+ readonly description: "Fetch a single webpage";
1510
+ readonly parameters: [{
1511
+ readonly name: "url";
1512
+ readonly value: "https://example.com";
1513
+ }];
1514
+ }, {
1515
+ readonly description: "Fetch multiple webpages";
1516
+ readonly parameters: [{
1517
+ readonly name: "url";
1518
+ readonly value: "https://example.com,https://developer.mozilla.org/en-US/docs/Web/HTTP";
1519
+ }];
1520
+ }, {
1521
+ readonly description: "Fetch a raw file from GitHub";
1522
+ readonly parameters: [{
1523
+ readonly name: "url";
1524
+ readonly value: "https://raw.githubusercontent.com/user/repo/main/README.md";
1525
+ }];
1526
+ }];
1527
+ readonly permissionLevel: PermissionLevel.Read;
1528
+ }, WebProvider>;
1529
+ isAvailable: (provider: WebProvider) => boolean;
1530
+ name: "fetch_url";
1531
+ 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.";
1532
+ parameters: [{
1533
+ readonly name: "url";
1534
+ readonly description: "One or more URLs to fetch, separated by commas if multiple.";
1535
+ readonly required: true;
1536
+ }];
1537
+ examples: [{
1538
+ readonly description: "Fetch a single webpage";
1539
+ readonly parameters: [{
1540
+ readonly name: "url";
1541
+ readonly value: "https://example.com";
1542
+ }];
1543
+ }, {
1544
+ readonly description: "Fetch multiple webpages";
1545
+ readonly parameters: [{
1546
+ readonly name: "url";
1547
+ readonly value: "https://example.com,https://developer.mozilla.org/en-US/docs/Web/HTTP";
1548
+ }];
1549
+ }, {
1550
+ readonly description: "Fetch a raw file from GitHub";
1551
+ readonly parameters: [{
1552
+ readonly name: "url";
1553
+ readonly value: "https://raw.githubusercontent.com/user/repo/main/README.md";
1554
+ }];
1555
+ }];
1556
+ permissionLevel: PermissionLevel.Read;
1557
+ };
1558
+ export { _default_5 as default_alias_8 }
1559
+ export { _default_5 as fetchUrl }
1560
+ export { _default_5 as fetchUrl_alias_1 }
1561
+ export { _default_5 as fetchUrl_alias_2 }
1562
+
1563
+ declare const _default_6: {
1369
1564
  handler: ToolHandler<{
1370
1565
  readonly name: "list_files";
1371
1566
  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.";
@@ -1428,12 +1623,12 @@ declare const _default_5: {
1428
1623
  }];
1429
1624
  permissionLevel: PermissionLevel.Read;
1430
1625
  };
1431
- export { _default_5 as default_alias_9 }
1432
- export { _default_5 as listFiles }
1433
- export { _default_5 as listFiles_alias_1 }
1434
- export { _default_5 as listFiles_alias_2 }
1626
+ export { _default_6 as default_alias_10 }
1627
+ export { _default_6 as listFiles }
1628
+ export { _default_6 as listFiles_alias_1 }
1629
+ export { _default_6 as listFiles_alias_2 }
1435
1630
 
1436
- declare const _default_6: {
1631
+ declare const _default_7: {
1437
1632
  handler: ToolHandler<{
1438
1633
  readonly name: "read_file";
1439
1634
  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.";
@@ -1482,12 +1677,12 @@ declare const _default_6: {
1482
1677
  }];
1483
1678
  permissionLevel: PermissionLevel.Read;
1484
1679
  };
1485
- export { _default_6 as default_alias_10 }
1486
- export { _default_6 as readFile }
1487
- export { _default_6 as readFile_alias_1 }
1488
- export { _default_6 as readFile_alias_2 }
1680
+ export { _default_7 as default_alias_11 }
1681
+ export { _default_7 as readFile }
1682
+ export { _default_7 as readFile_alias_1 }
1683
+ export { _default_7 as readFile_alias_2 }
1489
1684
 
1490
- declare const _default_7: {
1685
+ declare const _default_8: {
1491
1686
  handler: ToolHandler<{
1492
1687
  readonly name: "replace_in_file";
1493
1688
  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.";
@@ -1594,12 +1789,12 @@ declare const _default_7: {
1594
1789
  }];
1595
1790
  permissionLevel: PermissionLevel.Write;
1596
1791
  };
1597
- export { _default_7 as default_alias_13 }
1598
- export { _default_7 as replaceInFile }
1599
- export { _default_7 as replaceInFile_alias_1 }
1600
- export { _default_7 as replaceInFile_alias_2 }
1792
+ export { _default_8 as default_alias_14 }
1793
+ export { _default_8 as replaceInFile }
1794
+ export { _default_8 as replaceInFile_alias_1 }
1795
+ export { _default_8 as replaceInFile_alias_2 }
1601
1796
 
1602
- declare const _default_8: {
1797
+ declare const _default_9: {
1603
1798
  handler: ToolHandler<{
1604
1799
  readonly name: "search_files";
1605
1800
  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.";
@@ -1668,140 +1863,10 @@ declare const _default_8: {
1668
1863
  }];
1669
1864
  permissionLevel: PermissionLevel.Read;
1670
1865
  };
1671
- export { _default_8 as default_alias_14 }
1672
- export { _default_8 as searchFiles }
1673
- export { _default_8 as searchFiles_alias_1 }
1674
- export { _default_8 as searchFiles_alias_2 }
1675
-
1676
- declare const _default_9: {
1677
- handler: ToolHandler<{
1678
- readonly name: "update_knowledge";
1679
- readonly description: "Update knowledge in a knowledge.ai.yml file with smart merging capabilities. This tool lets you add, update, or remove information using path-based updates and special directives.";
1680
- readonly parameters: [{
1681
- readonly name: "path";
1682
- readonly description: "Directory containing (or where to create) the knowledge.ai.yml file";
1683
- readonly required: true;
1684
- readonly usageValue: "Directory path here";
1685
- }, {
1686
- readonly name: "knowledge";
1687
- readonly description: "YAML content to merge into the knowledge file";
1688
- readonly required: true;
1689
- readonly usageValue: "YAML content with knowledge to update";
1690
- }];
1691
- readonly examples: [{
1692
- readonly description: "Add a new file entry";
1693
- readonly parameters: [{
1694
- readonly name: "path";
1695
- readonly value: "src/utils";
1696
- }, {
1697
- readonly name: "knowledge";
1698
- readonly value: "files:\n \"newFile.ts\":\n description: \"A new utility file\"\n api:\n functions:\n 1:\n name: \"processData\"\n params:\n 1: { name: \"data\", type: \"object\" }\n returns: \"object\"";
1699
- }];
1700
- }, {
1701
- readonly description: "Update an existing file description";
1702
- readonly parameters: [{
1703
- readonly name: "path";
1704
- readonly value: "src/utils";
1705
- }, {
1706
- readonly name: "knowledge";
1707
- readonly value: "files:\n \"existingFile.ts\":\n description: \"Updated description for the file\"";
1708
- }];
1709
- }, {
1710
- readonly description: "Add a new rule";
1711
- readonly parameters: [{
1712
- readonly name: "path";
1713
- readonly value: "src";
1714
- }, {
1715
- readonly name: "knowledge";
1716
- readonly value: "rules:\n 10: \"New rule to follow\"";
1717
- }];
1718
- }, {
1719
- readonly description: "Remove a rule";
1720
- readonly parameters: [{
1721
- readonly name: "path";
1722
- readonly value: "src";
1723
- }, {
1724
- readonly name: "knowledge";
1725
- readonly value: "rules:\n 5: null";
1726
- }];
1727
- }, {
1728
- readonly description: "Update nested properties using dot notation";
1729
- readonly parameters: [{
1730
- readonly name: "path";
1731
- readonly value: "src/components";
1732
- }, {
1733
- readonly name: "knowledge";
1734
- readonly value: "files.Button.tsx.api.functions.1.description: \"Updated function description\"";
1735
- }];
1736
- }];
1737
- readonly permissionLevel: PermissionLevel.Write;
1738
- }, FilesystemProvider>;
1739
- isAvailable: (provider: FilesystemProvider) => boolean;
1740
- name: "update_knowledge";
1741
- description: "Update knowledge in a knowledge.ai.yml file with smart merging capabilities. This tool lets you add, update, or remove information using path-based updates and special directives.";
1742
- parameters: [{
1743
- readonly name: "path";
1744
- readonly description: "Directory containing (or where to create) the knowledge.ai.yml file";
1745
- readonly required: true;
1746
- readonly usageValue: "Directory path here";
1747
- }, {
1748
- readonly name: "knowledge";
1749
- readonly description: "YAML content to merge into the knowledge file";
1750
- readonly required: true;
1751
- readonly usageValue: "YAML content with knowledge to update";
1752
- }];
1753
- examples: [{
1754
- readonly description: "Add a new file entry";
1755
- readonly parameters: [{
1756
- readonly name: "path";
1757
- readonly value: "src/utils";
1758
- }, {
1759
- readonly name: "knowledge";
1760
- readonly value: "files:\n \"newFile.ts\":\n description: \"A new utility file\"\n api:\n functions:\n 1:\n name: \"processData\"\n params:\n 1: { name: \"data\", type: \"object\" }\n returns: \"object\"";
1761
- }];
1762
- }, {
1763
- readonly description: "Update an existing file description";
1764
- readonly parameters: [{
1765
- readonly name: "path";
1766
- readonly value: "src/utils";
1767
- }, {
1768
- readonly name: "knowledge";
1769
- readonly value: "files:\n \"existingFile.ts\":\n description: \"Updated description for the file\"";
1770
- }];
1771
- }, {
1772
- readonly description: "Add a new rule";
1773
- readonly parameters: [{
1774
- readonly name: "path";
1775
- readonly value: "src";
1776
- }, {
1777
- readonly name: "knowledge";
1778
- readonly value: "rules:\n 10: \"New rule to follow\"";
1779
- }];
1780
- }, {
1781
- readonly description: "Remove a rule";
1782
- readonly parameters: [{
1783
- readonly name: "path";
1784
- readonly value: "src";
1785
- }, {
1786
- readonly name: "knowledge";
1787
- readonly value: "rules:\n 5: null";
1788
- }];
1789
- }, {
1790
- readonly description: "Update nested properties using dot notation";
1791
- readonly parameters: [{
1792
- readonly name: "path";
1793
- readonly value: "src/components";
1794
- }, {
1795
- readonly name: "knowledge";
1796
- readonly value: "files.Button.tsx.api.functions.1.description: \"Updated function description\"";
1797
- }];
1798
- }];
1799
- permissionLevel: PermissionLevel.Write;
1800
- };
1801
1866
  export { _default_9 as default_alias_15 }
1802
- export { _default_9 as updateKnowledge }
1803
- export { _default_9 as updateKnowledge_alias_1 }
1804
- export { _default_9 as updateKnowledge_alias_2 }
1867
+ export { _default_9 as searchFiles }
1868
+ export { _default_9 as searchFiles_alias_1 }
1869
+ export { _default_9 as searchFiles_alias_2 }
1805
1870
 
1806
1871
  /**
1807
1872
  * AI tool for creating new projects based on user specifications.
@@ -2028,13 +2093,15 @@ export declare const handler_alias_11: ToolHandler<typeof toolInfo_alias_11, Fil
2028
2093
 
2029
2094
  export declare const handler_alias_12: ToolHandler<typeof toolInfo_alias_12, FilesystemProvider>;
2030
2095
 
2096
+ export declare const handler_alias_13: ToolHandler<typeof toolInfo_alias_13, FilesystemProvider>;
2097
+
2031
2098
  export declare const handler_alias_2: ToolHandler<typeof toolInfo_alias_2, any>;
2032
2099
 
2033
2100
  export declare const handler_alias_3: ToolHandler<typeof toolInfo_alias_3, CommandProvider>;
2034
2101
 
2035
- export declare const handler_alias_4: ToolHandler<typeof toolInfo_alias_4, any>;
2102
+ export declare const handler_alias_4: ToolHandler<typeof toolInfo_alias_4, WebProvider>;
2036
2103
 
2037
- export declare const handler_alias_5: ToolHandler<typeof toolInfo_alias_5, FilesystemProvider>;
2104
+ export declare const handler_alias_5: ToolHandler<typeof toolInfo_alias_5, any>;
2038
2105
 
2039
2106
  export declare const handler_alias_6: ToolHandler<typeof toolInfo_alias_6, FilesystemProvider>;
2040
2107
 
@@ -2069,13 +2136,15 @@ export declare const isAvailable_alias_11: (provider: FilesystemProvider) => boo
2069
2136
 
2070
2137
  export declare const isAvailable_alias_12: (provider: FilesystemProvider) => boolean;
2071
2138
 
2139
+ export declare const isAvailable_alias_13: (provider: FilesystemProvider) => boolean;
2140
+
2072
2141
  export declare const isAvailable_alias_2: (_provider: any) => boolean;
2073
2142
 
2074
2143
  export declare const isAvailable_alias_3: (provider: CommandProvider) => boolean;
2075
2144
 
2076
- export declare const isAvailable_alias_4: (_provider: any) => boolean;
2145
+ export declare const isAvailable_alias_4: (provider: WebProvider) => boolean;
2077
2146
 
2078
- export declare const isAvailable_alias_5: (provider: FilesystemProvider) => boolean;
2147
+ export declare const isAvailable_alias_5: (_provider: any) => boolean;
2079
2148
 
2080
2149
  export declare const isAvailable_alias_6: (provider: FilesystemProvider) => boolean;
2081
2150
 
@@ -2543,7 +2612,7 @@ export { replaceInFile_2 as replaceInFile_alias_4 }
2543
2612
 
2544
2613
  declare const responsePrompts: {
2545
2614
  readonly errorInvokeTool: (tool: string, error: unknown) => string;
2546
- readonly requireUseTool: "Error: You MUST use a tool before proceeding using XCM tags. e.g. <tool_tool_name>tool_name</tool_tool_name>";
2615
+ 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";
2547
2616
  readonly toolResults: (tool: string, result: string) => string;
2548
2617
  readonly commandResult: (command: string, exitCode: number, stdout: string, stderr: string) => string;
2549
2618
  };
@@ -2855,6 +2924,60 @@ export declare const toolInfo_alias_1: {
2855
2924
  };
2856
2925
 
2857
2926
  export declare const toolInfo_alias_10: {
2927
+ readonly name: "replace_in_file";
2928
+ 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.";
2929
+ readonly parameters: [{
2930
+ readonly name: "path";
2931
+ readonly description: "The path of the file to modify";
2932
+ readonly required: true;
2933
+ readonly usageValue: "File path here";
2934
+ }, {
2935
+ readonly name: "diff";
2936
+ readonly description: "One or more SEARCH/REPLACE blocks following this exact format:\n```\n<<<<<<< SEARCH\n[exact content to find]\n=======\n[new content to replace with]\n>>>>>>> REPLACE\n```\nCritical rules:\n1. SEARCH content must match the associated file section to find EXACTLY:\n * Match character-for-character including whitespace, indentation, line endings\n * Include all comments, docstrings, etc.\n2. SEARCH/REPLACE blocks will ONLY replace the first match occurrence.\n * Including multiple unique SEARCH/REPLACE blocks if you need to make multiple changes.\n * Include *just* enough lines in each SEARCH section to uniquely match each set of lines that need to change.\n * When using multiple SEARCH/REPLACE blocks, list them in the order they appear in the file.\n3. Keep SEARCH/REPLACE blocks concise:\n * Break large SEARCH/REPLACE blocks into a series of smaller blocks that each change a small portion of the file.\n * Include just the changing lines, and a few surrounding lines if needed for uniqueness.\n * Do not include long runs of unchanging lines in SEARCH/REPLACE blocks.\n * Each line must be complete. Never truncate lines mid-way through as this can cause matching failures.\n4. Special operations:\n * To move code: Use two SEARCH/REPLACE blocks (one to delete from original + one to insert at new location)\n * To delete code: Use empty REPLACE section";
2937
+ readonly required: true;
2938
+ readonly usageValue: "Search and replace blocks here";
2939
+ }];
2940
+ readonly examples: [{
2941
+ readonly description: "Request to replace sections of content in a file";
2942
+ readonly parameters: [{
2943
+ readonly name: "path";
2944
+ readonly value: "src/main.js";
2945
+ }, {
2946
+ readonly name: "diff";
2947
+ readonly value: "\n<<<<<<< SEARCH\nimport React from 'react';\n=======\nimport React, { useState } from 'react';\n>>>>>>> REPLACE\n\n<<<<<<< SEARCH\nfunction handleSubmit() {\n saveData();\n setLoading(false);\n}\n\n=======\n>>>>>>> REPLACE\n\n<<<<<<< SEARCH\nreturn (\n <div>\n=======\nfunction handleSubmit() {\n saveData();\n setLoading(false);\n}\n\nreturn (\n <div>\n>>>>>>> REPLACE\n";
2948
+ }];
2949
+ }, {
2950
+ readonly description: "Request to perform a simple, single-line replacement";
2951
+ readonly parameters: [{
2952
+ readonly name: "path";
2953
+ readonly value: "src/config.js";
2954
+ }, {
2955
+ readonly name: "diff";
2956
+ readonly value: "\n<<<<<<< SEARCH\nconst API_URL = 'https://api.example.com';\n=======\nconst API_URL = 'https://api.staging.example.com';\n>>>>>>> REPLACE\n";
2957
+ }];
2958
+ }, {
2959
+ readonly description: "Request to add a new function to a file";
2960
+ readonly parameters: [{
2961
+ readonly name: "path";
2962
+ readonly value: "src/utils.js";
2963
+ }, {
2964
+ readonly name: "diff";
2965
+ readonly value: "\n<<<<<<< SEARCH\nfunction helperA() {\n // ...\n}\n=======\nfunction helperA() {\n // ...\n}\n\nfunction newHelper() {\n // implementation\n}\n>>>>>>> REPLACE\n";
2966
+ }];
2967
+ }, {
2968
+ readonly description: "Request to delete a block of code from a file";
2969
+ readonly parameters: [{
2970
+ readonly name: "path";
2971
+ readonly value: "src/app.js";
2972
+ }, {
2973
+ readonly name: "diff";
2974
+ readonly value: "\n<<<<<<< SEARCH\nfunction oldFeature() {\n // This is no longer needed\n}\n\n=======\n>>>>>>> REPLACE\n";
2975
+ }];
2976
+ }];
2977
+ readonly permissionLevel: PermissionLevel.Write;
2978
+ };
2979
+
2980
+ export declare const toolInfo_alias_11: {
2858
2981
  readonly name: "search_files";
2859
2982
  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.";
2860
2983
  readonly parameters: [{
@@ -2889,7 +3012,7 @@ export declare const toolInfo_alias_10: {
2889
3012
  readonly permissionLevel: PermissionLevel.Read;
2890
3013
  };
2891
3014
 
2892
- export declare const toolInfo_alias_11: {
3015
+ export declare const toolInfo_alias_12: {
2893
3016
  readonly name: "update_knowledge";
2894
3017
  readonly description: "Update knowledge in a knowledge.ai.yml file with smart merging capabilities. This tool lets you add, update, or remove information using path-based updates and special directives.";
2895
3018
  readonly parameters: [{
@@ -2952,7 +3075,7 @@ export declare const toolInfo_alias_11: {
2952
3075
  readonly permissionLevel: PermissionLevel.Write;
2953
3076
  };
2954
3077
 
2955
- export declare const toolInfo_alias_12: {
3078
+ export declare const toolInfo_alias_13: {
2956
3079
  readonly name: "write_to_file";
2957
3080
  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;` and `&gt;`.";
2958
3081
  readonly parameters: [{
@@ -3050,6 +3173,36 @@ export declare const toolInfo_alias_3: {
3050
3173
  };
3051
3174
 
3052
3175
  export declare const toolInfo_alias_4: {
3176
+ readonly name: "fetch_url";
3177
+ 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.";
3178
+ readonly parameters: [{
3179
+ readonly name: "url";
3180
+ readonly description: "One or more URLs to fetch, separated by commas if multiple.";
3181
+ readonly required: true;
3182
+ }];
3183
+ readonly examples: [{
3184
+ readonly description: "Fetch a single webpage";
3185
+ readonly parameters: [{
3186
+ readonly name: "url";
3187
+ readonly value: "https://example.com";
3188
+ }];
3189
+ }, {
3190
+ readonly description: "Fetch multiple webpages";
3191
+ readonly parameters: [{
3192
+ readonly name: "url";
3193
+ readonly value: "https://example.com,https://developer.mozilla.org/en-US/docs/Web/HTTP";
3194
+ }];
3195
+ }, {
3196
+ readonly description: "Fetch a raw file from GitHub";
3197
+ readonly parameters: [{
3198
+ readonly name: "url";
3199
+ readonly value: "https://raw.githubusercontent.com/user/repo/main/README.md";
3200
+ }];
3201
+ }];
3202
+ readonly permissionLevel: PermissionLevel.Read;
3203
+ };
3204
+
3205
+ export declare const toolInfo_alias_5: {
3053
3206
  readonly name: "hand_over";
3054
3207
  readonly description: "Hand over the current task to another agent to complete. This tool MUST NOT to be used with any other tool.";
3055
3208
  readonly parameters: [{
@@ -3092,7 +3245,7 @@ export declare const toolInfo_alias_4: {
3092
3245
  readonly permissionLevel: PermissionLevel.None;
3093
3246
  };
3094
3247
 
3095
- export declare const toolInfo_alias_5: {
3248
+ export declare const toolInfo_alias_6: {
3096
3249
  readonly name: "list_files";
3097
3250
  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.";
3098
3251
  readonly parameters: [{
@@ -3124,7 +3277,7 @@ export declare const toolInfo_alias_5: {
3124
3277
  readonly permissionLevel: PermissionLevel.Read;
3125
3278
  };
3126
3279
 
3127
- export declare const toolInfo_alias_6: {
3280
+ export declare const toolInfo_alias_7: {
3128
3281
  readonly name: "read_file";
3129
3282
  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.";
3130
3283
  readonly parameters: [{
@@ -3149,7 +3302,7 @@ export declare const toolInfo_alias_6: {
3149
3302
  readonly permissionLevel: PermissionLevel.Read;
3150
3303
  };
3151
3304
 
3152
- export declare const toolInfo_alias_7: {
3305
+ export declare const toolInfo_alias_8: {
3153
3306
  readonly name: "remove_file";
3154
3307
  readonly description: "Request to remove a file at the specified path.";
3155
3308
  readonly parameters: [{
@@ -3168,7 +3321,7 @@ export declare const toolInfo_alias_7: {
3168
3321
  readonly permissionLevel: PermissionLevel.Write;
3169
3322
  };
3170
3323
 
3171
- export declare const toolInfo_alias_8: {
3324
+ export declare const toolInfo_alias_9: {
3172
3325
  readonly name: "rename_file";
3173
3326
  readonly description: "Request to rename a file from source path to target path.";
3174
3327
  readonly parameters: [{
@@ -3195,60 +3348,6 @@ export declare const toolInfo_alias_8: {
3195
3348
  readonly permissionLevel: PermissionLevel.Write;
3196
3349
  };
3197
3350
 
3198
- export declare const toolInfo_alias_9: {
3199
- readonly name: "replace_in_file";
3200
- 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.";
3201
- readonly parameters: [{
3202
- readonly name: "path";
3203
- readonly description: "The path of the file to modify";
3204
- readonly required: true;
3205
- readonly usageValue: "File path here";
3206
- }, {
3207
- readonly name: "diff";
3208
- readonly description: "One or more SEARCH/REPLACE blocks following this exact format:\n```\n<<<<<<< SEARCH\n[exact content to find]\n=======\n[new content to replace with]\n>>>>>>> REPLACE\n```\nCritical rules:\n1. SEARCH content must match the associated file section to find EXACTLY:\n * Match character-for-character including whitespace, indentation, line endings\n * Include all comments, docstrings, etc.\n2. SEARCH/REPLACE blocks will ONLY replace the first match occurrence.\n * Including multiple unique SEARCH/REPLACE blocks if you need to make multiple changes.\n * Include *just* enough lines in each SEARCH section to uniquely match each set of lines that need to change.\n * When using multiple SEARCH/REPLACE blocks, list them in the order they appear in the file.\n3. Keep SEARCH/REPLACE blocks concise:\n * Break large SEARCH/REPLACE blocks into a series of smaller blocks that each change a small portion of the file.\n * Include just the changing lines, and a few surrounding lines if needed for uniqueness.\n * Do not include long runs of unchanging lines in SEARCH/REPLACE blocks.\n * Each line must be complete. Never truncate lines mid-way through as this can cause matching failures.\n4. Special operations:\n * To move code: Use two SEARCH/REPLACE blocks (one to delete from original + one to insert at new location)\n * To delete code: Use empty REPLACE section";
3209
- readonly required: true;
3210
- readonly usageValue: "Search and replace blocks here";
3211
- }];
3212
- readonly examples: [{
3213
- readonly description: "Request to replace sections of content in a file";
3214
- readonly parameters: [{
3215
- readonly name: "path";
3216
- readonly value: "src/main.js";
3217
- }, {
3218
- readonly name: "diff";
3219
- readonly value: "\n<<<<<<< SEARCH\nimport React from 'react';\n=======\nimport React, { useState } from 'react';\n>>>>>>> REPLACE\n\n<<<<<<< SEARCH\nfunction handleSubmit() {\n saveData();\n setLoading(false);\n}\n\n=======\n>>>>>>> REPLACE\n\n<<<<<<< SEARCH\nreturn (\n <div>\n=======\nfunction handleSubmit() {\n saveData();\n setLoading(false);\n}\n\nreturn (\n <div>\n>>>>>>> REPLACE\n";
3220
- }];
3221
- }, {
3222
- readonly description: "Request to perform a simple, single-line replacement";
3223
- readonly parameters: [{
3224
- readonly name: "path";
3225
- readonly value: "src/config.js";
3226
- }, {
3227
- readonly name: "diff";
3228
- readonly value: "\n<<<<<<< SEARCH\nconst API_URL = 'https://api.example.com';\n=======\nconst API_URL = 'https://api.staging.example.com';\n>>>>>>> REPLACE\n";
3229
- }];
3230
- }, {
3231
- readonly description: "Request to add a new function to a file";
3232
- readonly parameters: [{
3233
- readonly name: "path";
3234
- readonly value: "src/utils.js";
3235
- }, {
3236
- readonly name: "diff";
3237
- readonly value: "\n<<<<<<< SEARCH\nfunction helperA() {\n // ...\n}\n=======\nfunction helperA() {\n // ...\n}\n\nfunction newHelper() {\n // implementation\n}\n>>>>>>> REPLACE\n";
3238
- }];
3239
- }, {
3240
- readonly description: "Request to delete a block of code from a file";
3241
- readonly parameters: [{
3242
- readonly name: "path";
3243
- readonly value: "src/app.js";
3244
- }, {
3245
- readonly name: "diff";
3246
- readonly value: "\n<<<<<<< SEARCH\nfunction oldFeature() {\n // This is no longer needed\n}\n\n=======\n>>>>>>> REPLACE\n";
3247
- }];
3248
- }];
3249
- readonly permissionLevel: PermissionLevel.Write;
3250
- };
3251
-
3252
3351
  declare type ToolParameter = {
3253
3352
  name: string;
3254
3353
  description: string;
@@ -3266,7 +3365,7 @@ declare type ToolParameterValue = string | {
3266
3365
  export { ToolParameterValue }
3267
3366
  export { ToolParameterValue as ToolParameterValue_alias_1 }
3268
3367
 
3269
- declare type ToolProvider = FilesystemProvider & CommandProvider & InteractionProvider;
3368
+ declare type ToolProvider = FilesystemProvider & CommandProvider & InteractionProvider & WebProvider;
3270
3369
  export { ToolProvider }
3271
3370
  export { ToolProvider as ToolProvider_alias_1 }
3272
3371
  export { ToolProvider as ToolProvider_alias_2 }
@@ -3431,4 +3530,11 @@ export { UsageMeter }
3431
3530
  export { UsageMeter as UsageMeter_alias_1 }
3432
3531
  export { UsageMeter as UsageMeter_alias_2 }
3433
3532
 
3533
+ declare type WebProvider = {
3534
+ fetchUrl?: (url: string) => Promise<string>;
3535
+ };
3536
+ export { WebProvider }
3537
+ export { WebProvider as WebProvider_alias_1 }
3538
+ export { WebProvider as WebProvider_alias_2 }
3539
+
3434
3540
  export { }
package/dist/index.d.ts CHANGED
@@ -65,12 +65,14 @@ export { allTools } from './_tsup-dts-rollup.js';
65
65
  export { FilesystemProvider } from './_tsup-dts-rollup.js';
66
66
  export { CommandProvider } from './_tsup-dts-rollup.js';
67
67
  export { InteractionProvider } from './_tsup-dts-rollup.js';
68
+ export { WebProvider } from './_tsup-dts-rollup.js';
68
69
  export { ToolProvider } from './_tsup-dts-rollup.js';
69
70
  export { MockProvider } from './_tsup-dts-rollup.js';
70
71
  export { askFollowupQuestion } from './_tsup-dts-rollup.js';
71
72
  export { attemptCompletion } from './_tsup-dts-rollup.js';
72
73
  export { delegate } from './_tsup-dts-rollup.js';
73
74
  export { executeCommand } from './_tsup-dts-rollup.js';
75
+ export { fetchUrl } from './_tsup-dts-rollup.js';
74
76
  export { listFiles } from './_tsup-dts-rollup.js';
75
77
  export { readFile } from './_tsup-dts-rollup.js';
76
78
  export { replaceInFile } from './_tsup-dts-rollup.js';
package/dist/index.js CHANGED
@@ -883,6 +883,7 @@ __export(allTools_exports, {
883
883
  attemptCompletion: () => attemptCompletion_default,
884
884
  delegate: () => delegate_default,
885
885
  executeCommand: () => executeCommand_default,
886
+ fetchUrl: () => fetchUrl_default,
886
887
  handOver: () => handOver_default,
887
888
  listFiles: () => listFiles_default,
888
889
  readFile: () => readFile_default,
@@ -1371,8 +1372,89 @@ var executeCommand_default = {
1371
1372
  isAvailable: isAvailable4
1372
1373
  };
1373
1374
 
1374
- // src/tools/listFiles.ts
1375
+ // src/tools/fetchUrl.ts
1375
1376
  var toolInfo5 = {
1377
+ name: "fetch_url",
1378
+ 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.",
1379
+ parameters: [
1380
+ {
1381
+ name: "url",
1382
+ description: "One or more URLs to fetch, separated by commas if multiple.",
1383
+ required: true
1384
+ }
1385
+ ],
1386
+ examples: [
1387
+ {
1388
+ description: "Fetch a single webpage",
1389
+ parameters: [
1390
+ {
1391
+ name: "url",
1392
+ value: "https://example.com"
1393
+ }
1394
+ ]
1395
+ },
1396
+ {
1397
+ description: "Fetch multiple webpages",
1398
+ parameters: [
1399
+ {
1400
+ name: "url",
1401
+ value: "https://example.com,https://developer.mozilla.org/en-US/docs/Web/HTTP"
1402
+ }
1403
+ ]
1404
+ },
1405
+ {
1406
+ description: "Fetch a raw file from GitHub",
1407
+ parameters: [
1408
+ {
1409
+ name: "url",
1410
+ value: "https://raw.githubusercontent.com/user/repo/main/README.md"
1411
+ }
1412
+ ]
1413
+ }
1414
+ ],
1415
+ permissionLevel: 1 /* Read */
1416
+ };
1417
+ var handler5 = async (provider, args) => {
1418
+ if (!provider.fetchUrl) {
1419
+ return {
1420
+ type: "Error" /* Error */,
1421
+ message: "Not possible to fetch url. Abort."
1422
+ };
1423
+ }
1424
+ const urls = getStringArray(args, "url");
1425
+ if (urls.length === 0) {
1426
+ return {
1427
+ type: "Error" /* Error */,
1428
+ message: "No URLs provided. Please provide at least one URL to fetch."
1429
+ };
1430
+ }
1431
+ const results = [];
1432
+ for (const url of urls) {
1433
+ try {
1434
+ const content = provider.fetchUrl(url).then((res) => `<fetch_url_content url="${url}">${res}</fetch_url_content>`);
1435
+ results.push(content);
1436
+ } catch (error) {
1437
+ const errorMessage = error instanceof Error ? error.message : "Unknown error";
1438
+ results.push(Promise.resolve(`<fetch_url_error url="${url}">${errorMessage}</fetch_url_error>`));
1439
+ }
1440
+ }
1441
+ const resolvedResults = await Promise.all(results);
1442
+ return {
1443
+ type: "Reply" /* Reply */,
1444
+ message: resolvedResults.join("\n")
1445
+ };
1446
+ };
1447
+ var isAvailable5 = (provider) => {
1448
+ return typeof provider.fetchUrl === "function";
1449
+ };
1450
+ var fetchUrl_default = {
1451
+ ...toolInfo5,
1452
+ handler: handler5,
1453
+ isAvailable: isAvailable5
1454
+ };
1455
+
1456
+ // src/tools/listFiles.ts
1457
+ var toolInfo6 = {
1376
1458
  name: "list_files",
1377
1459
  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.",
1378
1460
  parameters: [
@@ -1412,7 +1494,7 @@ var toolInfo5 = {
1412
1494
  ],
1413
1495
  permissionLevel: 1 /* Read */
1414
1496
  };
1415
- var handler5 = async (provider, args) => {
1497
+ var handler6 = async (provider, args) => {
1416
1498
  if (!provider.listFiles) {
1417
1499
  return {
1418
1500
  type: "Error" /* Error */,
@@ -1432,17 +1514,17 @@ ${files.join("\n")}
1432
1514
  <list_files_truncated>${limitReached}</list_files_truncated>`
1433
1515
  };
1434
1516
  };
1435
- var isAvailable5 = (provider) => {
1517
+ var isAvailable6 = (provider) => {
1436
1518
  return !!provider.listFiles;
1437
1519
  };
1438
1520
  var listFiles_default = {
1439
- ...toolInfo5,
1440
- handler: handler5,
1441
- isAvailable: isAvailable5
1521
+ ...toolInfo6,
1522
+ handler: handler6,
1523
+ isAvailable: isAvailable6
1442
1524
  };
1443
1525
 
1444
1526
  // src/tools/readFile.ts
1445
- var toolInfo6 = {
1527
+ var toolInfo7 = {
1446
1528
  name: "read_file",
1447
1529
  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.",
1448
1530
  parameters: [
@@ -1475,7 +1557,7 @@ var toolInfo6 = {
1475
1557
  ],
1476
1558
  permissionLevel: 1 /* Read */
1477
1559
  };
1478
- var handler6 = async (provider, args) => {
1560
+ var handler7 = async (provider, args) => {
1479
1561
  if (!provider.readFile) {
1480
1562
  return {
1481
1563
  type: "Error" /* Error */,
@@ -1502,17 +1584,17 @@ var handler6 = async (provider, args) => {
1502
1584
  message: resp.join("\n")
1503
1585
  };
1504
1586
  };
1505
- var isAvailable6 = (provider) => {
1587
+ var isAvailable7 = (provider) => {
1506
1588
  return !!provider.readFile;
1507
1589
  };
1508
1590
  var readFile_default = {
1509
- ...toolInfo6,
1510
- handler: handler6,
1511
- isAvailable: isAvailable6
1591
+ ...toolInfo7,
1592
+ handler: handler7,
1593
+ isAvailable: isAvailable7
1512
1594
  };
1513
1595
 
1514
1596
  // src/tools/replaceInFile.ts
1515
- var toolInfo7 = {
1597
+ var toolInfo8 = {
1516
1598
  name: "replace_in_file",
1517
1599
  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.",
1518
1600
  parameters: [
@@ -1664,7 +1746,7 @@ function oldFeature() {
1664
1746
  ],
1665
1747
  permissionLevel: 2 /* Write */
1666
1748
  };
1667
- var handler7 = async (provider, args) => {
1749
+ var handler8 = async (provider, args) => {
1668
1750
  if (!provider.readFile || !provider.writeFile) {
1669
1751
  return {
1670
1752
  type: "Error" /* Error */,
@@ -1687,17 +1769,17 @@ var handler7 = async (provider, args) => {
1687
1769
  message: `<replace_in_file_path>${path}</replace_in_file_path>`
1688
1770
  };
1689
1771
  };
1690
- var isAvailable7 = (provider) => {
1772
+ var isAvailable8 = (provider) => {
1691
1773
  return !!provider.readFile && !!provider.writeFile;
1692
1774
  };
1693
1775
  var replaceInFile_default = {
1694
- ...toolInfo7,
1695
- handler: handler7,
1696
- isAvailable: isAvailable7
1776
+ ...toolInfo8,
1777
+ handler: handler8,
1778
+ isAvailable: isAvailable8
1697
1779
  };
1698
1780
 
1699
1781
  // src/tools/searchFiles.ts
1700
- var toolInfo8 = {
1782
+ var toolInfo9 = {
1701
1783
  name: "search_files",
1702
1784
  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.",
1703
1785
  parameters: [
@@ -1741,7 +1823,7 @@ var toolInfo8 = {
1741
1823
  ],
1742
1824
  permissionLevel: 1 /* Read */
1743
1825
  };
1744
- var handler8 = async (provider, args) => {
1826
+ var handler9 = async (provider, args) => {
1745
1827
  if (!provider.searchFiles) {
1746
1828
  return {
1747
1829
  type: "Error" /* Error */,
@@ -1763,13 +1845,13 @@ ${files.join("\n")}
1763
1845
  `
1764
1846
  };
1765
1847
  };
1766
- var isAvailable8 = (provider) => {
1848
+ var isAvailable9 = (provider) => {
1767
1849
  return !!provider.searchFiles;
1768
1850
  };
1769
1851
  var searchFiles_default = {
1770
- ...toolInfo8,
1771
- handler: handler8,
1772
- isAvailable: isAvailable8
1852
+ ...toolInfo9,
1853
+ handler: handler9,
1854
+ isAvailable: isAvailable9
1773
1855
  };
1774
1856
 
1775
1857
  // src/tools/updateKnowledge.ts
@@ -1826,7 +1908,7 @@ function join(...parts) {
1826
1908
  }
1827
1909
 
1828
1910
  // src/tools/updateKnowledge.ts
1829
- var toolInfo9 = {
1911
+ var toolInfo10 = {
1830
1912
  name: "update_knowledge",
1831
1913
  description: "Update knowledge in a knowledge.ai.yml file with smart merging capabilities. This tool lets you add, update, or remove information using path-based updates and special directives.",
1832
1914
  parameters: [
@@ -2000,7 +2082,7 @@ function deepMerge(target, source) {
2000
2082
  }
2001
2083
  return output;
2002
2084
  }
2003
- var handler9 = async (provider, args) => {
2085
+ var handler10 = async (provider, args) => {
2004
2086
  if (!provider.readFile || !provider.writeFile) {
2005
2087
  return {
2006
2088
  type: "Error" /* Error */,
@@ -2072,17 +2154,17 @@ var handler9 = async (provider, args) => {
2072
2154
  };
2073
2155
  }
2074
2156
  };
2075
- var isAvailable9 = (provider) => {
2157
+ var isAvailable10 = (provider) => {
2076
2158
  return !!provider.readFile && !!provider.writeFile;
2077
2159
  };
2078
2160
  var updateKnowledge_default = {
2079
- ...toolInfo9,
2080
- handler: handler9,
2081
- isAvailable: isAvailable9
2161
+ ...toolInfo10,
2162
+ handler: handler10,
2163
+ isAvailable: isAvailable10
2082
2164
  };
2083
2165
 
2084
2166
  // src/tools/writeToFile.ts
2085
- var toolInfo10 = {
2167
+ var toolInfo11 = {
2086
2168
  name: "write_to_file",
2087
2169
  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;` and `&gt;`.",
2088
2170
  parameters: [
@@ -2127,7 +2209,7 @@ export default App;
2127
2209
  ],
2128
2210
  permissionLevel: 2 /* Write */
2129
2211
  };
2130
- var handler10 = async (provider, args) => {
2212
+ var handler11 = async (provider, args) => {
2131
2213
  if (!provider.writeFile) {
2132
2214
  return {
2133
2215
  type: "Error" /* Error */,
@@ -2142,17 +2224,17 @@ var handler10 = async (provider, args) => {
2142
2224
  message: `<write_to_file_path>${path}</write_to_file_path><status>Success</status>`
2143
2225
  };
2144
2226
  };
2145
- var isAvailable10 = (provider) => {
2227
+ var isAvailable11 = (provider) => {
2146
2228
  return !!provider.writeFile;
2147
2229
  };
2148
2230
  var writeToFile_default = {
2149
- ...toolInfo10,
2150
- handler: handler10,
2151
- isAvailable: isAvailable10
2231
+ ...toolInfo11,
2232
+ handler: handler11,
2233
+ isAvailable: isAvailable11
2152
2234
  };
2153
2235
 
2154
2236
  // src/tools/handOver.ts
2155
- var toolInfo11 = {
2237
+ var toolInfo12 = {
2156
2238
  name: "hand_over",
2157
2239
  description: "Hand over the current task to another agent to complete. This tool MUST NOT to be used with any other tool.",
2158
2240
  parameters: [
@@ -2206,7 +2288,7 @@ var toolInfo11 = {
2206
2288
  ],
2207
2289
  permissionLevel: 0 /* None */
2208
2290
  };
2209
- var handler11 = async (_provider, args) => {
2291
+ var handler12 = async (_provider, args) => {
2210
2292
  const agentName = getString(args, "agent_name");
2211
2293
  const task = getString(args, "task");
2212
2294
  const context = getString(args, "context", void 0);
@@ -2219,17 +2301,17 @@ var handler11 = async (_provider, args) => {
2219
2301
  files
2220
2302
  };
2221
2303
  };
2222
- var isAvailable11 = (_provider) => {
2304
+ var isAvailable12 = (_provider) => {
2223
2305
  return true;
2224
2306
  };
2225
2307
  var handOver_default = {
2226
- ...toolInfo11,
2227
- handler: handler11,
2228
- isAvailable: isAvailable11
2308
+ ...toolInfo12,
2309
+ handler: handler12,
2310
+ isAvailable: isAvailable12
2229
2311
  };
2230
2312
 
2231
2313
  // src/tools/removeFile.ts
2232
- var toolInfo12 = {
2314
+ var toolInfo13 = {
2233
2315
  name: "remove_file",
2234
2316
  description: "Request to remove a file at the specified path.",
2235
2317
  parameters: [
@@ -2253,7 +2335,7 @@ var toolInfo12 = {
2253
2335
  ],
2254
2336
  permissionLevel: 2 /* Write */
2255
2337
  };
2256
- var handler12 = async (provider, args) => {
2338
+ var handler13 = async (provider, args) => {
2257
2339
  if (!provider.removeFile) {
2258
2340
  return {
2259
2341
  type: "Error" /* Error */,
@@ -2267,17 +2349,17 @@ var handler12 = async (provider, args) => {
2267
2349
  message: `<remove_file_path>${path}</remove_file_path><status>Success</status>`
2268
2350
  };
2269
2351
  };
2270
- var isAvailable12 = (provider) => {
2352
+ var isAvailable13 = (provider) => {
2271
2353
  return !!provider.removeFile;
2272
2354
  };
2273
2355
  var removeFile_default = {
2274
- ...toolInfo12,
2275
- handler: handler12,
2276
- isAvailable: isAvailable12
2356
+ ...toolInfo13,
2357
+ handler: handler13,
2358
+ isAvailable: isAvailable13
2277
2359
  };
2278
2360
 
2279
2361
  // src/tools/renameFile.ts
2280
- var toolInfo13 = {
2362
+ var toolInfo14 = {
2281
2363
  name: "rename_file",
2282
2364
  description: "Request to rename a file from source path to target path.",
2283
2365
  parameters: [
@@ -2311,7 +2393,7 @@ var toolInfo13 = {
2311
2393
  ],
2312
2394
  permissionLevel: 2 /* Write */
2313
2395
  };
2314
- var handler13 = async (provider, args) => {
2396
+ var handler14 = async (provider, args) => {
2315
2397
  if (!provider.renameFile) {
2316
2398
  return {
2317
2399
  type: "Error" /* Error */,
@@ -2326,13 +2408,13 @@ var handler13 = async (provider, args) => {
2326
2408
  message: `<rename_file_path>${targetPath}</rename_file_path><status>Success</status>`
2327
2409
  };
2328
2410
  };
2329
- var isAvailable13 = (provider) => {
2411
+ var isAvailable14 = (provider) => {
2330
2412
  return !!provider.renameFile;
2331
2413
  };
2332
2414
  var renameFile_default = {
2333
- ...toolInfo13,
2334
- handler: handler13,
2335
- isAvailable: isAvailable13
2415
+ ...toolInfo14,
2416
+ handler: handler14,
2417
+ isAvailable: isAvailable14
2336
2418
  };
2337
2419
 
2338
2420
  // src/getAvailableTools.ts
@@ -2684,7 +2766,13 @@ ${joined}`;
2684
2766
  };
2685
2767
  var responsePrompts = {
2686
2768
  errorInvokeTool: (tool, error) => `An error occurred while invoking the tool "${tool}": ${error}`,
2687
- requireUseTool: "Error: You MUST use a tool before proceeding using XCM tags. e.g. <tool_tool_name>tool_name</tool_tool_name>",
2769
+ requireUseTool: `Error: No tool use detected. You MUST use a tool before proceeding.
2770
+ e.g. <tool_tool_name>tool_name</tool_tool_name>
2771
+
2772
+ Ensure the opening and closing tags are correctly nested and closed, and that you are using the correct tool name.
2773
+ Avoid unnecessary text or symbols before or after the tool use.
2774
+ Avoid unnecessary escape characters or special characters.
2775
+ `,
2688
2776
  toolResults: (tool, result) => `<tool_response>
2689
2777
  <tool_name>${tool}</tool_name>
2690
2778
  <tool_result>
@@ -2943,8 +3031,8 @@ ${instance.prompt}`;
2943
3031
  }
2944
3032
  async #invokeTool(name, args) {
2945
3033
  try {
2946
- const handler14 = this.handlers[name]?.handler;
2947
- if (!handler14) {
3034
+ const handler15 = this.handlers[name]?.handler;
3035
+ if (!handler15) {
2948
3036
  return {
2949
3037
  type: "Error" /* Error */,
2950
3038
  message: responsePrompts.errorInvokeTool(name, "Tool not found"),
@@ -2963,7 +3051,7 @@ ${instance.prompt}`;
2963
3051
  if (resp) {
2964
3052
  return resp;
2965
3053
  }
2966
- return await handler14(this.config.provider, args);
3054
+ return await handler15(this.config.provider, args);
2967
3055
  } catch (error) {
2968
3056
  return {
2969
3057
  type: "Error" /* Error */,
@@ -4290,6 +4378,7 @@ export {
4290
4378
  executeAgentTool,
4291
4379
  executeCommand_default as executeCommand,
4292
4380
  executeTool,
4381
+ fetchUrl_default as fetchUrl,
4293
4382
  generateGitCommitMessage,
4294
4383
  generateGithubPullRequestDetails,
4295
4384
  generateProjectConfig,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@polka-codes/core",
3
- "version": "0.8.22",
3
+ "version": "0.8.23",
4
4
  "license": "AGPL-3.0",
5
5
  "author": "github@polka.codes",
6
6
  "type": "module",