@polka-codes/cli 0.8.22 → 0.8.24

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.
Files changed (2) hide show
  1. package/dist/index.js +201 -80
  2. package/package.json +3 -3
package/dist/index.js CHANGED
@@ -38447,7 +38447,7 @@ var {
38447
38447
  Help
38448
38448
  } = import__.default;
38449
38449
  // package.json
38450
- var version = "0.8.22";
38450
+ var version = "0.8.24";
38451
38451
 
38452
38452
  // ../core/src/AiService/AiServiceBase.ts
38453
38453
  class AiServiceBase {
@@ -47752,6 +47752,7 @@ __export(exports_allTools, {
47752
47752
  readFile: () => readFile_default,
47753
47753
  listFiles: () => listFiles_default,
47754
47754
  handOver: () => handOver_default,
47755
+ fetchUrl: () => fetchUrl_default,
47755
47756
  executeCommand: () => executeCommand_default,
47756
47757
  delegate: () => delegate_default,
47757
47758
  attemptCompletion: () => attemptCompletion_default,
@@ -48210,8 +48211,89 @@ var executeCommand_default = {
48210
48211
  handler: handler4,
48211
48212
  isAvailable: isAvailable4
48212
48213
  };
48213
- // ../core/src/tools/listFiles.ts
48214
+ // ../core/src/tools/fetchUrl.ts
48214
48215
  var toolInfo5 = {
48216
+ name: "fetch_url",
48217
+ 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.",
48218
+ parameters: [
48219
+ {
48220
+ name: "url",
48221
+ description: "One or more URLs to fetch, separated by commas if multiple.",
48222
+ required: true
48223
+ }
48224
+ ],
48225
+ examples: [
48226
+ {
48227
+ description: "Fetch a single webpage",
48228
+ parameters: [
48229
+ {
48230
+ name: "url",
48231
+ value: "https://example.com"
48232
+ }
48233
+ ]
48234
+ },
48235
+ {
48236
+ description: "Fetch multiple webpages",
48237
+ parameters: [
48238
+ {
48239
+ name: "url",
48240
+ value: "https://example.com,https://developer.mozilla.org/en-US/docs/Web/HTTP"
48241
+ }
48242
+ ]
48243
+ },
48244
+ {
48245
+ description: "Fetch a raw file from GitHub",
48246
+ parameters: [
48247
+ {
48248
+ name: "url",
48249
+ value: "https://raw.githubusercontent.com/user/repo/main/README.md"
48250
+ }
48251
+ ]
48252
+ }
48253
+ ],
48254
+ permissionLevel: 1 /* Read */
48255
+ };
48256
+ var handler5 = async (provider, args) => {
48257
+ if (!provider.fetchUrl) {
48258
+ return {
48259
+ type: "Error" /* Error */,
48260
+ message: "Not possible to fetch url. Abort."
48261
+ };
48262
+ }
48263
+ const urls = getStringArray(args, "url");
48264
+ if (urls.length === 0) {
48265
+ return {
48266
+ type: "Error" /* Error */,
48267
+ message: "No URLs provided. Please provide at least one URL to fetch."
48268
+ };
48269
+ }
48270
+ const results = [];
48271
+ for (const url of urls) {
48272
+ try {
48273
+ const content = provider.fetchUrl(url).then((res) => `<fetch_url_content url="${url}">${res}</fetch_url_content>`);
48274
+ results.push(content);
48275
+ } catch (error) {
48276
+ const errorMessage = error instanceof Error ? error.message : "Unknown error";
48277
+ results.push(Promise.resolve(`<fetch_url_error url="${url}">${errorMessage}</fetch_url_error>`));
48278
+ }
48279
+ }
48280
+ const resolvedResults = await Promise.all(results);
48281
+ return {
48282
+ type: "Reply" /* Reply */,
48283
+ message: resolvedResults.join(`
48284
+ `)
48285
+ };
48286
+ };
48287
+ var isAvailable5 = (provider) => {
48288
+ return typeof provider.fetchUrl === "function";
48289
+ };
48290
+ var fetchUrl_default = {
48291
+ ...toolInfo5,
48292
+ handler: handler5,
48293
+ isAvailable: isAvailable5
48294
+ };
48295
+ // ../core/src/tools/listFiles.ts
48296
+ var toolInfo6 = {
48215
48297
  name: "list_files",
48216
48298
  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.",
48217
48299
  parameters: [
@@ -48251,7 +48333,7 @@ var toolInfo5 = {
48251
48333
  ],
48252
48334
  permissionLevel: 1 /* Read */
48253
48335
  };
48254
- var handler5 = async (provider, args) => {
48336
+ var handler6 = async (provider, args) => {
48255
48337
  if (!provider.listFiles) {
48256
48338
  return {
48257
48339
  type: "Error" /* Error */,
@@ -48272,16 +48354,16 @@ ${files.join(`
48272
48354
  <list_files_truncated>${limitReached}</list_files_truncated>`
48273
48355
  };
48274
48356
  };
48275
- var isAvailable5 = (provider) => {
48357
+ var isAvailable6 = (provider) => {
48276
48358
  return !!provider.listFiles;
48277
48359
  };
48278
48360
  var listFiles_default = {
48279
- ...toolInfo5,
48280
- handler: handler5,
48281
- isAvailable: isAvailable5
48361
+ ...toolInfo6,
48362
+ handler: handler6,
48363
+ isAvailable: isAvailable6
48282
48364
  };
48283
48365
  // ../core/src/tools/readFile.ts
48284
- var toolInfo6 = {
48366
+ var toolInfo7 = {
48285
48367
  name: "read_file",
48286
48368
  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.",
48287
48369
  parameters: [
@@ -48314,7 +48396,7 @@ var toolInfo6 = {
48314
48396
  ],
48315
48397
  permissionLevel: 1 /* Read */
48316
48398
  };
48317
- var handler6 = async (provider, args) => {
48399
+ var handler7 = async (provider, args) => {
48318
48400
  if (!provider.readFile) {
48319
48401
  return {
48320
48402
  type: "Error" /* Error */,
@@ -48342,16 +48424,16 @@ var handler6 = async (provider, args) => {
48342
48424
  `)
48343
48425
  };
48344
48426
  };
48345
- var isAvailable6 = (provider) => {
48427
+ var isAvailable7 = (provider) => {
48346
48428
  return !!provider.readFile;
48347
48429
  };
48348
48430
  var readFile_default = {
48349
- ...toolInfo6,
48350
- handler: handler6,
48351
- isAvailable: isAvailable6
48431
+ ...toolInfo7,
48432
+ handler: handler7,
48433
+ isAvailable: isAvailable7
48352
48434
  };
48353
48435
  // ../core/src/tools/replaceInFile.ts
48354
- var toolInfo7 = {
48436
+ var toolInfo8 = {
48355
48437
  name: "replace_in_file",
48356
48438
  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.",
48357
48439
  parameters: [
@@ -48503,7 +48585,7 @@ function oldFeature() {
48503
48585
  ],
48504
48586
  permissionLevel: 2 /* Write */
48505
48587
  };
48506
- var handler7 = async (provider, args) => {
48588
+ var handler8 = async (provider, args) => {
48507
48589
  if (!provider.readFile || !provider.writeFile) {
48508
48590
  return {
48509
48591
  type: "Error" /* Error */,
@@ -48526,16 +48608,16 @@ var handler7 = async (provider, args) => {
48526
48608
  message: `<replace_in_file_path>${path}</replace_in_file_path>`
48527
48609
  };
48528
48610
  };
48529
- var isAvailable7 = (provider) => {
48611
+ var isAvailable8 = (provider) => {
48530
48612
  return !!provider.readFile && !!provider.writeFile;
48531
48613
  };
48532
48614
  var replaceInFile_default = {
48533
- ...toolInfo7,
48534
- handler: handler7,
48535
- isAvailable: isAvailable7
48615
+ ...toolInfo8,
48616
+ handler: handler8,
48617
+ isAvailable: isAvailable8
48536
48618
  };
48537
48619
  // ../core/src/tools/searchFiles.ts
48538
- var toolInfo8 = {
48620
+ var toolInfo9 = {
48539
48621
  name: "search_files",
48540
48622
  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.",
48541
48623
  parameters: [
@@ -48579,7 +48661,7 @@ var toolInfo8 = {
48579
48661
  ],
48580
48662
  permissionLevel: 1 /* Read */
48581
48663
  };
48582
- var handler8 = async (provider, args) => {
48664
+ var handler9 = async (provider, args) => {
48583
48665
  if (!provider.searchFiles) {
48584
48666
  return {
48585
48667
  type: "Error" /* Error */,
@@ -48602,13 +48684,13 @@ ${files.join(`
48602
48684
  `
48603
48685
  };
48604
48686
  };
48605
- var isAvailable8 = (provider) => {
48687
+ var isAvailable9 = (provider) => {
48606
48688
  return !!provider.searchFiles;
48607
48689
  };
48608
48690
  var searchFiles_default = {
48609
- ...toolInfo8,
48610
- handler: handler8,
48611
- isAvailable: isAvailable8
48691
+ ...toolInfo9,
48692
+ handler: handler9,
48693
+ isAvailable: isAvailable9
48612
48694
  };
48613
48695
  // ../core/src/tools/updateKnowledge.ts
48614
48696
  var import_yaml = __toESM(require_dist(), 1);
@@ -48670,7 +48752,7 @@ function join(...parts) {
48670
48752
  }
48671
48753
 
48672
48754
  // ../core/src/tools/updateKnowledge.ts
48673
- var toolInfo9 = {
48755
+ var toolInfo10 = {
48674
48756
  name: "update_knowledge",
48675
48757
  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.",
48676
48758
  parameters: [
@@ -48847,7 +48929,7 @@ function deepMerge(target, source) {
48847
48929
  }
48848
48930
  return output;
48849
48931
  }
48850
- var handler9 = async (provider, args) => {
48932
+ var handler10 = async (provider, args) => {
48851
48933
  if (!provider.readFile || !provider.writeFile) {
48852
48934
  return {
48853
48935
  type: "Error" /* Error */,
@@ -48919,18 +49001,18 @@ var handler9 = async (provider, args) => {
48919
49001
  };
48920
49002
  }
48921
49003
  };
48922
- var isAvailable9 = (provider) => {
49004
+ var isAvailable10 = (provider) => {
48923
49005
  return !!provider.readFile && !!provider.writeFile;
48924
49006
  };
48925
49007
  var updateKnowledge_default = {
48926
- ...toolInfo9,
48927
- handler: handler9,
48928
- isAvailable: isAvailable9
49008
+ ...toolInfo10,
49009
+ handler: handler10,
49010
+ isAvailable: isAvailable10
48929
49011
  };
48930
49012
  // ../core/src/tools/writeToFile.ts
48931
- var toolInfo10 = {
49013
+ var toolInfo11 = {
48932
49014
  name: "write_to_file",
48933
- 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;`.",
49015
+ 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.",
48934
49016
  parameters: [
48935
49017
  {
48936
49018
  name: "path",
@@ -48973,7 +49055,7 @@ export default App;
48973
49055
  ],
48974
49056
  permissionLevel: 2 /* Write */
48975
49057
  };
48976
- var handler10 = async (provider, args) => {
49058
+ var handler11 = async (provider, args) => {
48977
49059
  if (!provider.writeFile) {
48978
49060
  return {
48979
49061
  type: "Error" /* Error */,
@@ -48981,23 +49063,26 @@ var handler10 = async (provider, args) => {
48981
49063
  };
48982
49064
  }
48983
49065
  const path = getString(args, "path");
48984
- const content = getString(args, "content");
49066
+ let content = getString(args, "content");
49067
+ const trimmedContent = content.trim();
49068
+ if (trimmedContent.startsWith("<![CDATA[") && content.endsWith("]]>"))
49069
+ content = trimmedContent.slice(9, -3);
48985
49070
  await provider.writeFile(path, content);
48986
49071
  return {
48987
49072
  type: "Reply" /* Reply */,
48988
49073
  message: `<write_to_file_path>${path}</write_to_file_path><status>Success</status>`
48989
49074
  };
48990
49075
  };
48991
- var isAvailable10 = (provider) => {
49076
+ var isAvailable11 = (provider) => {
48992
49077
  return !!provider.writeFile;
48993
49078
  };
48994
49079
  var writeToFile_default = {
48995
- ...toolInfo10,
48996
- handler: handler10,
48997
- isAvailable: isAvailable10
49080
+ ...toolInfo11,
49081
+ handler: handler11,
49082
+ isAvailable: isAvailable11
48998
49083
  };
48999
49084
  // ../core/src/tools/handOver.ts
49000
- var toolInfo11 = {
49085
+ var toolInfo12 = {
49001
49086
  name: "hand_over",
49002
49087
  description: "Hand over the current task to another agent to complete. This tool MUST NOT to be used with any other tool.",
49003
49088
  parameters: [
@@ -49051,7 +49136,7 @@ var toolInfo11 = {
49051
49136
  ],
49052
49137
  permissionLevel: 0 /* None */
49053
49138
  };
49054
- var handler11 = async (_provider, args) => {
49139
+ var handler12 = async (_provider, args) => {
49055
49140
  const agentName = getString(args, "agent_name");
49056
49141
  const task = getString(args, "task");
49057
49142
  const context = getString(args, "context", undefined);
@@ -49064,16 +49149,16 @@ var handler11 = async (_provider, args) => {
49064
49149
  files
49065
49150
  };
49066
49151
  };
49067
- var isAvailable11 = (_provider) => {
49152
+ var isAvailable12 = (_provider) => {
49068
49153
  return true;
49069
49154
  };
49070
49155
  var handOver_default = {
49071
- ...toolInfo11,
49072
- handler: handler11,
49073
- isAvailable: isAvailable11
49156
+ ...toolInfo12,
49157
+ handler: handler12,
49158
+ isAvailable: isAvailable12
49074
49159
  };
49075
49160
  // ../core/src/tools/removeFile.ts
49076
- var toolInfo12 = {
49161
+ var toolInfo13 = {
49077
49162
  name: "remove_file",
49078
49163
  description: "Request to remove a file at the specified path.",
49079
49164
  parameters: [
@@ -49097,7 +49182,7 @@ var toolInfo12 = {
49097
49182
  ],
49098
49183
  permissionLevel: 2 /* Write */
49099
49184
  };
49100
- var handler12 = async (provider, args) => {
49185
+ var handler13 = async (provider, args) => {
49101
49186
  if (!provider.removeFile) {
49102
49187
  return {
49103
49188
  type: "Error" /* Error */,
@@ -49111,16 +49196,16 @@ var handler12 = async (provider, args) => {
49111
49196
  message: `<remove_file_path>${path}</remove_file_path><status>Success</status>`
49112
49197
  };
49113
49198
  };
49114
- var isAvailable12 = (provider) => {
49199
+ var isAvailable13 = (provider) => {
49115
49200
  return !!provider.removeFile;
49116
49201
  };
49117
49202
  var removeFile_default = {
49118
- ...toolInfo12,
49119
- handler: handler12,
49120
- isAvailable: isAvailable12
49203
+ ...toolInfo13,
49204
+ handler: handler13,
49205
+ isAvailable: isAvailable13
49121
49206
  };
49122
49207
  // ../core/src/tools/renameFile.ts
49123
- var toolInfo13 = {
49208
+ var toolInfo14 = {
49124
49209
  name: "rename_file",
49125
49210
  description: "Request to rename a file from source path to target path.",
49126
49211
  parameters: [
@@ -49154,7 +49239,7 @@ var toolInfo13 = {
49154
49239
  ],
49155
49240
  permissionLevel: 2 /* Write */
49156
49241
  };
49157
- var handler13 = async (provider, args) => {
49242
+ var handler14 = async (provider, args) => {
49158
49243
  if (!provider.renameFile) {
49159
49244
  return {
49160
49245
  type: "Error" /* Error */,
@@ -49169,13 +49254,13 @@ var handler13 = async (provider, args) => {
49169
49254
  message: `<rename_file_path>${targetPath}</rename_file_path><status>Success</status>`
49170
49255
  };
49171
49256
  };
49172
- var isAvailable13 = (provider) => {
49257
+ var isAvailable14 = (provider) => {
49173
49258
  return !!provider.renameFile;
49174
49259
  };
49175
49260
  var renameFile_default = {
49176
- ...toolInfo13,
49177
- handler: handler13,
49178
- isAvailable: isAvailable13
49261
+ ...toolInfo14,
49262
+ handler: handler14,
49263
+ isAvailable: isAvailable14
49179
49264
  };
49180
49265
  // ../core/src/getAvailableTools.ts
49181
49266
  var getAvailableTools = ({
@@ -49533,13 +49618,34 @@ ${joined}`;
49533
49618
  };
49534
49619
  var responsePrompts = {
49535
49620
  errorInvokeTool: (tool, error) => `An error occurred while invoking the tool "${tool}": ${error}`,
49536
- requireUseTool: "Error: You MUST use a tool before proceeding using XCM tags. e.g. <tool_tool_name>tool_name</tool_tool_name>",
49537
- toolResults: (tool, result) => `<tool_response>
49538
- <tool_name>${tool}</tool_name>
49539
- <tool_result>
49540
- ${result}
49541
- </tool_result>
49542
- </tool_response>`,
49621
+ requireUseTool: `Error: No tool use detected. You MUST use a tool before proceeding.
49622
+ e.g. <tool_tool_name>tool_name</tool_tool_name>
49623
+
49624
+ Ensure the opening and closing tags are correctly nested and closed, and that you are using the correct tool name.
49625
+ Avoid unnecessary text or symbols before or after the tool use.
49626
+ Avoid unnecessary escape characters or special characters.
49627
+ `,
49628
+ toolResults: (tool, result) => {
49629
+ if (typeof result === "string") {
49630
+ return [
49631
+ {
49632
+ type: "text",
49633
+ text: `<tool_response name=${tool}>${result}</tool_response>`
49634
+ }
49635
+ ];
49636
+ }
49637
+ return [
49638
+ {
49639
+ type: "text",
49640
+ text: `<tool_response name=${tool}>`
49641
+ },
49642
+ ...result,
49643
+ {
49644
+ type: "text",
49645
+ text: "</tool_response>"
49646
+ }
49647
+ ];
49648
+ },
49543
49649
  commandResult: (command, exitCode, stdout, stderr) => `<command>${command}</command>
49544
49650
  <command_exit_code>${exitCode}</command_exit_code>
49545
49651
  <command_stdout>
@@ -49703,23 +49809,26 @@ ${instance.prompt}`;
49703
49809
  await this.#callback({ kind: "ToolUse" /* ToolUse */, agent: this, tool: content.name });
49704
49810
  const toolResp = await this.#invokeTool(content.name, content.params);
49705
49811
  switch (toolResp.type) {
49706
- case "Reply" /* Reply */:
49812
+ case "Reply" /* Reply */: {
49707
49813
  await this.#callback({ kind: "ToolReply" /* ToolReply */, agent: this, tool: content.name });
49708
49814
  toolResponses.push({ type: "response", tool: content.name, response: toolResp.message });
49709
49815
  break;
49816
+ }
49710
49817
  case "Exit" /* Exit */:
49711
49818
  if (toolResponses.length > 0) {
49712
49819
  break outer;
49713
49820
  }
49714
49821
  return { type: "exit", reason: toolResp };
49715
- case "Invalid" /* Invalid */:
49822
+ case "Invalid" /* Invalid */: {
49716
49823
  await this.#callback({ kind: "ToolInvalid" /* ToolInvalid */, agent: this, tool: content.name });
49717
49824
  toolResponses.push({ type: "response", tool: content.name, response: toolResp.message });
49718
49825
  break outer;
49719
- case "Error" /* Error */:
49826
+ }
49827
+ case "Error" /* Error */: {
49720
49828
  await this.#callback({ kind: "ToolError" /* ToolError */, agent: this, tool: content.name });
49721
49829
  toolResponses.push({ type: "response", tool: content.name, response: toolResp.message });
49722
49830
  break outer;
49831
+ }
49723
49832
  case "Interrupted" /* Interrupted */:
49724
49833
  await this.#callback({ kind: "ToolInterrupted" /* ToolInterrupted */, agent: this, tool: content.name });
49725
49834
  return { type: "exit", reason: toolResp };
@@ -49769,15 +49878,13 @@ ${instance.prompt}`;
49769
49878
  if (toolResponses.length === 0) {
49770
49879
  return { type: "reply", message: responsePrompts.requireUseTool };
49771
49880
  }
49772
- const finalResp = toolResponses.filter((resp) => resp.type === "response").map(({ tool, response: response2 }) => responsePrompts.toolResults(tool, response2)).join(`
49773
-
49774
- `);
49881
+ const finalResp = toolResponses.filter((resp) => resp.type === "response").flatMap(({ tool, response: response2 }) => responsePrompts.toolResults(tool, response2));
49775
49882
  return { type: "reply", message: finalResp };
49776
49883
  }
49777
49884
  async#invokeTool(name, args) {
49778
49885
  try {
49779
- const handler14 = this.handlers[name]?.handler;
49780
- if (!handler14) {
49886
+ const handler15 = this.handlers[name]?.handler;
49887
+ if (!handler15) {
49781
49888
  return {
49782
49889
  type: "Error" /* Error */,
49783
49890
  message: responsePrompts.errorInvokeTool(name, "Tool not found"),
@@ -49796,7 +49903,7 @@ ${instance.prompt}`;
49796
49903
  if (resp) {
49797
49904
  return resp;
49798
49905
  }
49799
- return await handler14(this.config.provider, args);
49906
+ return await handler15(this.config.provider, args);
49800
49907
  } catch (error) {
49801
49908
  return {
49802
49909
  type: "Error" /* Error */,
@@ -59697,15 +59804,15 @@ function useKeypress(userHandler) {
59697
59804
  signal.current = userHandler;
59698
59805
  useEffect((rl) => {
59699
59806
  let ignore = false;
59700
- const handler14 = withUpdates((_input, event) => {
59807
+ const handler15 = withUpdates((_input, event) => {
59701
59808
  if (ignore)
59702
59809
  return;
59703
59810
  signal.current(event, rl);
59704
59811
  });
59705
- rl.input.on("keypress", handler14);
59812
+ rl.input.on("keypress", handler15);
59706
59813
  return () => {
59707
59814
  ignore = true;
59708
- rl.input.removeListener("keypress", handler14);
59815
+ rl.input.removeListener("keypress", handler15);
59709
59816
  };
59710
59817
  }, []);
59711
59818
  }
@@ -59887,16 +59994,16 @@ class Emitter {
59887
59994
 
59888
59995
  class SignalExitBase {
59889
59996
  }
59890
- var signalExitWrap = (handler14) => {
59997
+ var signalExitWrap = (handler15) => {
59891
59998
  return {
59892
59999
  onExit(cb, opts) {
59893
- return handler14.onExit(cb, opts);
60000
+ return handler15.onExit(cb, opts);
59894
60001
  },
59895
60002
  load() {
59896
- return handler14.load();
60003
+ return handler15.load();
59897
60004
  },
59898
60005
  unload() {
59899
- return handler14.unload();
60006
+ return handler15.unload();
59900
60007
  }
59901
60008
  };
59902
60009
  };
@@ -60754,6 +60861,20 @@ var getProvider = (agentName, config2, options = {}) => {
60754
60861
  },
60755
60862
  attemptCompletion: async (result) => {
60756
60863
  return;
60864
+ },
60865
+ fetchUrl: async (url) => {
60866
+ const isRaw = url.startsWith("https://raw.githubusercontent.com/");
60867
+ const urlToFetch = isRaw ? url : `https://r.jina.ai/${url}`;
60868
+ try {
60869
+ const response = await fetch(urlToFetch);
60870
+ if (!response.ok) {
60871
+ throw new Error(`HTTP error! status: ${response.status}`);
60872
+ }
60873
+ return await response.text();
60874
+ } catch (error) {
60875
+ console.error("Error fetching URL:", error);
60876
+ throw error;
60877
+ }
60757
60878
  }
60758
60879
  };
60759
60880
  if (checkRipgrep()) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@polka-codes/cli",
3
- "version": "0.8.22",
3
+ "version": "0.8.24",
4
4
  "license": "AGPL-3.0",
5
5
  "author": "github@polka.codes",
6
6
  "type": "module",
@@ -18,8 +18,8 @@
18
18
  },
19
19
  "dependencies": {
20
20
  "@inquirer/prompts": "^7.2.3",
21
- "@polka-codes/core": "0.8.10",
22
- "@polka-codes/cli-shared": "0.8.10",
21
+ "@polka-codes/core": "0.8.22",
22
+ "@polka-codes/cli-shared": "0.8.22",
23
23
  "commander": "^13.0.0",
24
24
  "dotenv": "^16.4.7",
25
25
  "lodash": "^4.17.21",