@polka-codes/runner 0.8.21 → 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.
Files changed (2) hide show
  1. package/dist/index.js +224 -81
  2. package/package.json +3 -3
package/dist/index.js CHANGED
@@ -31282,9 +31282,9 @@ var require_event_target = __commonJS((exports, module) => {
31282
31282
  }
31283
31283
  Object.defineProperty(MessageEvent.prototype, "data", { enumerable: true });
31284
31284
  var EventTarget = {
31285
- addEventListener(type, handler14, options = {}) {
31285
+ addEventListener(type, handler15, options = {}) {
31286
31286
  for (const listener of this.listeners(type)) {
31287
- if (!options[kForOnEventAttribute] && listener[kListener] === handler14 && !listener[kForOnEventAttribute]) {
31287
+ if (!options[kForOnEventAttribute] && listener[kListener] === handler15 && !listener[kForOnEventAttribute]) {
31288
31288
  return;
31289
31289
  }
31290
31290
  }
@@ -31295,7 +31295,7 @@ var require_event_target = __commonJS((exports, module) => {
31295
31295
  data: isBinary ? data : data.toString()
31296
31296
  });
31297
31297
  event[kTarget] = this;
31298
- callListener(handler14, this, event);
31298
+ callListener(handler15, this, event);
31299
31299
  };
31300
31300
  } else if (type === "close") {
31301
31301
  wrapper = function onClose(code, message) {
@@ -31305,7 +31305,7 @@ var require_event_target = __commonJS((exports, module) => {
31305
31305
  wasClean: this._closeFrameReceived && this._closeFrameSent
31306
31306
  });
31307
31307
  event[kTarget] = this;
31308
- callListener(handler14, this, event);
31308
+ callListener(handler15, this, event);
31309
31309
  };
31310
31310
  } else if (type === "error") {
31311
31311
  wrapper = function onError(error) {
@@ -31314,28 +31314,28 @@ var require_event_target = __commonJS((exports, module) => {
31314
31314
  message: error.message
31315
31315
  });
31316
31316
  event[kTarget] = this;
31317
- callListener(handler14, this, event);
31317
+ callListener(handler15, this, event);
31318
31318
  };
31319
31319
  } else if (type === "open") {
31320
31320
  wrapper = function onOpen() {
31321
31321
  const event = new Event("open");
31322
31322
  event[kTarget] = this;
31323
- callListener(handler14, this, event);
31323
+ callListener(handler15, this, event);
31324
31324
  };
31325
31325
  } else {
31326
31326
  return;
31327
31327
  }
31328
31328
  wrapper[kForOnEventAttribute] = !!options[kForOnEventAttribute];
31329
- wrapper[kListener] = handler14;
31329
+ wrapper[kListener] = handler15;
31330
31330
  if (options.once) {
31331
31331
  this.once(type, wrapper);
31332
31332
  } else {
31333
31333
  this.on(type, wrapper);
31334
31334
  }
31335
31335
  },
31336
- removeEventListener(type, handler14) {
31336
+ removeEventListener(type, handler15) {
31337
31337
  for (const listener of this.listeners(type)) {
31338
- if (listener[kListener] === handler14 && !listener[kForOnEventAttribute]) {
31338
+ if (listener[kListener] === handler15 && !listener[kForOnEventAttribute]) {
31339
31339
  this.removeListener(type, listener);
31340
31340
  break;
31341
31341
  }
@@ -31861,16 +31861,16 @@ var require_websocket = __commonJS((exports, module) => {
31861
31861
  }
31862
31862
  return null;
31863
31863
  },
31864
- set(handler14) {
31864
+ set(handler15) {
31865
31865
  for (const listener of this.listeners(method)) {
31866
31866
  if (listener[kForOnEventAttribute]) {
31867
31867
  this.removeListener(method, listener);
31868
31868
  break;
31869
31869
  }
31870
31870
  }
31871
- if (typeof handler14 !== "function")
31871
+ if (typeof handler15 !== "function")
31872
31872
  return;
31873
- this.addEventListener(method, handler14, {
31873
+ this.addEventListener(method, handler15, {
31874
31874
  [kForOnEventAttribute]: true
31875
31875
  });
31876
31876
  }
@@ -32748,7 +32748,7 @@ var {
32748
32748
  Help
32749
32749
  } = import__.default;
32750
32750
  // package.json
32751
- var version = "0.8.21";
32751
+ var version = "0.8.23";
32752
32752
 
32753
32753
  // src/runner.ts
32754
32754
  import { execSync } from "node:child_process";
@@ -42043,6 +42043,7 @@ __export(exports_allTools, {
42043
42043
  readFile: () => readFile_default,
42044
42044
  listFiles: () => listFiles_default,
42045
42045
  handOver: () => handOver_default,
42046
+ fetchUrl: () => fetchUrl_default,
42046
42047
  executeCommand: () => executeCommand_default,
42047
42048
  delegate: () => delegate_default,
42048
42049
  attemptCompletion: () => attemptCompletion_default,
@@ -42501,8 +42502,89 @@ var executeCommand_default = {
42501
42502
  handler: handler4,
42502
42503
  isAvailable: isAvailable4
42503
42504
  };
42504
- // ../core/src/tools/listFiles.ts
42505
+ // ../core/src/tools/fetchUrl.ts
42505
42506
  var toolInfo5 = {
42507
+ name: "fetch_url",
42508
+ 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.",
42509
+ parameters: [
42510
+ {
42511
+ name: "url",
42512
+ description: "One or more URLs to fetch, separated by commas if multiple.",
42513
+ required: true
42514
+ }
42515
+ ],
42516
+ examples: [
42517
+ {
42518
+ description: "Fetch a single webpage",
42519
+ parameters: [
42520
+ {
42521
+ name: "url",
42522
+ value: "https://example.com"
42523
+ }
42524
+ ]
42525
+ },
42526
+ {
42527
+ description: "Fetch multiple webpages",
42528
+ parameters: [
42529
+ {
42530
+ name: "url",
42531
+ value: "https://example.com,https://developer.mozilla.org/en-US/docs/Web/HTTP"
42532
+ }
42533
+ ]
42534
+ },
42535
+ {
42536
+ description: "Fetch a raw file from GitHub",
42537
+ parameters: [
42538
+ {
42539
+ name: "url",
42540
+ value: "https://raw.githubusercontent.com/user/repo/main/README.md"
42541
+ }
42542
+ ]
42543
+ }
42544
+ ],
42545
+ permissionLevel: 1 /* Read */
42546
+ };
42547
+ var handler5 = async (provider, args) => {
42548
+ if (!provider.fetchUrl) {
42549
+ return {
42550
+ type: "Error" /* Error */,
42551
+ message: "Not possible to fetch url. Abort."
42552
+ };
42553
+ }
42554
+ const urls = getStringArray(args, "url");
42555
+ if (urls.length === 0) {
42556
+ return {
42557
+ type: "Error" /* Error */,
42558
+ message: "No URLs provided. Please provide at least one URL to fetch."
42559
+ };
42560
+ }
42561
+ const results = [];
42562
+ for (const url of urls) {
42563
+ try {
42564
+ const content = provider.fetchUrl(url).then((res) => `<fetch_url_content url="${url}">${res}</fetch_url_content>`);
42565
+ results.push(content);
42566
+ } catch (error) {
42567
+ const errorMessage = error instanceof Error ? error.message : "Unknown error";
42568
+ results.push(Promise.resolve(`<fetch_url_error url="${url}">${errorMessage}</fetch_url_error>`));
42569
+ }
42570
+ }
42571
+ const resolvedResults = await Promise.all(results);
42572
+ return {
42573
+ type: "Reply" /* Reply */,
42574
+ message: resolvedResults.join(`
42575
+ `)
42576
+ };
42577
+ };
42578
+ var isAvailable5 = (provider) => {
42579
+ return typeof provider.fetchUrl === "function";
42580
+ };
42581
+ var fetchUrl_default = {
42582
+ ...toolInfo5,
42583
+ handler: handler5,
42584
+ isAvailable: isAvailable5
42585
+ };
42586
+ // ../core/src/tools/listFiles.ts
42587
+ var toolInfo6 = {
42506
42588
  name: "list_files",
42507
42589
  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.",
42508
42590
  parameters: [
@@ -42542,7 +42624,7 @@ var toolInfo5 = {
42542
42624
  ],
42543
42625
  permissionLevel: 1 /* Read */
42544
42626
  };
42545
- var handler5 = async (provider, args) => {
42627
+ var handler6 = async (provider, args) => {
42546
42628
  if (!provider.listFiles) {
42547
42629
  return {
42548
42630
  type: "Error" /* Error */,
@@ -42563,16 +42645,16 @@ ${files.join(`
42563
42645
  <list_files_truncated>${limitReached}</list_files_truncated>`
42564
42646
  };
42565
42647
  };
42566
- var isAvailable5 = (provider) => {
42648
+ var isAvailable6 = (provider) => {
42567
42649
  return !!provider.listFiles;
42568
42650
  };
42569
42651
  var listFiles_default = {
42570
- ...toolInfo5,
42571
- handler: handler5,
42572
- isAvailable: isAvailable5
42652
+ ...toolInfo6,
42653
+ handler: handler6,
42654
+ isAvailable: isAvailable6
42573
42655
  };
42574
42656
  // ../core/src/tools/readFile.ts
42575
- var toolInfo6 = {
42657
+ var toolInfo7 = {
42576
42658
  name: "read_file",
42577
42659
  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.",
42578
42660
  parameters: [
@@ -42605,7 +42687,7 @@ var toolInfo6 = {
42605
42687
  ],
42606
42688
  permissionLevel: 1 /* Read */
42607
42689
  };
42608
- var handler6 = async (provider, args) => {
42690
+ var handler7 = async (provider, args) => {
42609
42691
  if (!provider.readFile) {
42610
42692
  return {
42611
42693
  type: "Error" /* Error */,
@@ -42633,16 +42715,16 @@ var handler6 = async (provider, args) => {
42633
42715
  `)
42634
42716
  };
42635
42717
  };
42636
- var isAvailable6 = (provider) => {
42718
+ var isAvailable7 = (provider) => {
42637
42719
  return !!provider.readFile;
42638
42720
  };
42639
42721
  var readFile_default = {
42640
- ...toolInfo6,
42641
- handler: handler6,
42642
- isAvailable: isAvailable6
42722
+ ...toolInfo7,
42723
+ handler: handler7,
42724
+ isAvailable: isAvailable7
42643
42725
  };
42644
42726
  // ../core/src/tools/replaceInFile.ts
42645
- var toolInfo7 = {
42727
+ var toolInfo8 = {
42646
42728
  name: "replace_in_file",
42647
42729
  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.",
42648
42730
  parameters: [
@@ -42794,7 +42876,7 @@ function oldFeature() {
42794
42876
  ],
42795
42877
  permissionLevel: 2 /* Write */
42796
42878
  };
42797
- var handler7 = async (provider, args) => {
42879
+ var handler8 = async (provider, args) => {
42798
42880
  if (!provider.readFile || !provider.writeFile) {
42799
42881
  return {
42800
42882
  type: "Error" /* Error */,
@@ -42817,16 +42899,16 @@ var handler7 = async (provider, args) => {
42817
42899
  message: `<replace_in_file_path>${path}</replace_in_file_path>`
42818
42900
  };
42819
42901
  };
42820
- var isAvailable7 = (provider) => {
42902
+ var isAvailable8 = (provider) => {
42821
42903
  return !!provider.readFile && !!provider.writeFile;
42822
42904
  };
42823
42905
  var replaceInFile_default = {
42824
- ...toolInfo7,
42825
- handler: handler7,
42826
- isAvailable: isAvailable7
42906
+ ...toolInfo8,
42907
+ handler: handler8,
42908
+ isAvailable: isAvailable8
42827
42909
  };
42828
42910
  // ../core/src/tools/searchFiles.ts
42829
- var toolInfo8 = {
42911
+ var toolInfo9 = {
42830
42912
  name: "search_files",
42831
42913
  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.",
42832
42914
  parameters: [
@@ -42870,7 +42952,7 @@ var toolInfo8 = {
42870
42952
  ],
42871
42953
  permissionLevel: 1 /* Read */
42872
42954
  };
42873
- var handler8 = async (provider, args) => {
42955
+ var handler9 = async (provider, args) => {
42874
42956
  if (!provider.searchFiles) {
42875
42957
  return {
42876
42958
  type: "Error" /* Error */,
@@ -42893,18 +42975,59 @@ ${files.join(`
42893
42975
  `
42894
42976
  };
42895
42977
  };
42896
- var isAvailable8 = (provider) => {
42978
+ var isAvailable9 = (provider) => {
42897
42979
  return !!provider.searchFiles;
42898
42980
  };
42899
42981
  var searchFiles_default = {
42900
- ...toolInfo8,
42901
- handler: handler8,
42902
- isAvailable: isAvailable8
42982
+ ...toolInfo9,
42983
+ handler: handler9,
42984
+ isAvailable: isAvailable9
42903
42985
  };
42904
42986
  // ../core/src/tools/updateKnowledge.ts
42905
42987
  var import_yaml = __toESM(require_dist(), 1);
42906
- import { join } from "node:path";
42907
- var toolInfo9 = {
42988
+
42989
+ // ../core/src/path.ts
42990
+ function normalize(path) {
42991
+ const isAbsolute = path.startsWith("/");
42992
+ const segments = path.split("/").filter(Boolean);
42993
+ const stack = [];
42994
+ for (const seg of segments) {
42995
+ if (seg === ".")
42996
+ continue;
42997
+ if (seg === "..") {
42998
+ if (stack.length && stack[stack.length - 1] !== "..") {
42999
+ stack.pop();
43000
+ } else if (!isAbsolute) {
43001
+ stack.push("..");
43002
+ }
43003
+ } else {
43004
+ stack.push(seg);
43005
+ }
43006
+ }
43007
+ let result = stack.join("/");
43008
+ if (!result && !isAbsolute)
43009
+ return ".";
43010
+ if (result && path.endsWith("/"))
43011
+ result += "/";
43012
+ return (isAbsolute ? "/" : "") + result;
43013
+ }
43014
+ function join(...parts) {
43015
+ if (parts.length === 0)
43016
+ return ".";
43017
+ let combined = "";
43018
+ for (const p2 of parts) {
43019
+ if (typeof p2 !== "string") {
43020
+ throw new TypeError("Arguments to join must be strings");
43021
+ }
43022
+ if (p2) {
43023
+ combined = combined ? `${combined}/${p2}` : p2;
43024
+ }
43025
+ }
43026
+ return normalize(combined);
43027
+ }
43028
+
43029
+ // ../core/src/tools/updateKnowledge.ts
43030
+ var toolInfo10 = {
42908
43031
  name: "update_knowledge",
42909
43032
  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.",
42910
43033
  parameters: [
@@ -43081,7 +43204,7 @@ function deepMerge(target, source) {
43081
43204
  }
43082
43205
  return output;
43083
43206
  }
43084
- var handler9 = async (provider, args) => {
43207
+ var handler10 = async (provider, args) => {
43085
43208
  if (!provider.readFile || !provider.writeFile) {
43086
43209
  return {
43087
43210
  type: "Error" /* Error */,
@@ -43153,16 +43276,16 @@ var handler9 = async (provider, args) => {
43153
43276
  };
43154
43277
  }
43155
43278
  };
43156
- var isAvailable9 = (provider) => {
43279
+ var isAvailable10 = (provider) => {
43157
43280
  return !!provider.readFile && !!provider.writeFile;
43158
43281
  };
43159
43282
  var updateKnowledge_default = {
43160
- ...toolInfo9,
43161
- handler: handler9,
43162
- isAvailable: isAvailable9
43283
+ ...toolInfo10,
43284
+ handler: handler10,
43285
+ isAvailable: isAvailable10
43163
43286
  };
43164
43287
  // ../core/src/tools/writeToFile.ts
43165
- var toolInfo10 = {
43288
+ var toolInfo11 = {
43166
43289
  name: "write_to_file",
43167
43290
  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;`.",
43168
43291
  parameters: [
@@ -43207,7 +43330,7 @@ export default App;
43207
43330
  ],
43208
43331
  permissionLevel: 2 /* Write */
43209
43332
  };
43210
- var handler10 = async (provider, args) => {
43333
+ var handler11 = async (provider, args) => {
43211
43334
  if (!provider.writeFile) {
43212
43335
  return {
43213
43336
  type: "Error" /* Error */,
@@ -43222,16 +43345,16 @@ var handler10 = async (provider, args) => {
43222
43345
  message: `<write_to_file_path>${path}</write_to_file_path><status>Success</status>`
43223
43346
  };
43224
43347
  };
43225
- var isAvailable10 = (provider) => {
43348
+ var isAvailable11 = (provider) => {
43226
43349
  return !!provider.writeFile;
43227
43350
  };
43228
43351
  var writeToFile_default = {
43229
- ...toolInfo10,
43230
- handler: handler10,
43231
- isAvailable: isAvailable10
43352
+ ...toolInfo11,
43353
+ handler: handler11,
43354
+ isAvailable: isAvailable11
43232
43355
  };
43233
43356
  // ../core/src/tools/handOver.ts
43234
- var toolInfo11 = {
43357
+ var toolInfo12 = {
43235
43358
  name: "hand_over",
43236
43359
  description: "Hand over the current task to another agent to complete. This tool MUST NOT to be used with any other tool.",
43237
43360
  parameters: [
@@ -43285,7 +43408,7 @@ var toolInfo11 = {
43285
43408
  ],
43286
43409
  permissionLevel: 0 /* None */
43287
43410
  };
43288
- var handler11 = async (_provider, args) => {
43411
+ var handler12 = async (_provider, args) => {
43289
43412
  const agentName = getString(args, "agent_name");
43290
43413
  const task = getString(args, "task");
43291
43414
  const context = getString(args, "context", undefined);
@@ -43298,16 +43421,16 @@ var handler11 = async (_provider, args) => {
43298
43421
  files
43299
43422
  };
43300
43423
  };
43301
- var isAvailable11 = (_provider) => {
43424
+ var isAvailable12 = (_provider) => {
43302
43425
  return true;
43303
43426
  };
43304
43427
  var handOver_default = {
43305
- ...toolInfo11,
43306
- handler: handler11,
43307
- isAvailable: isAvailable11
43428
+ ...toolInfo12,
43429
+ handler: handler12,
43430
+ isAvailable: isAvailable12
43308
43431
  };
43309
43432
  // ../core/src/tools/removeFile.ts
43310
- var toolInfo12 = {
43433
+ var toolInfo13 = {
43311
43434
  name: "remove_file",
43312
43435
  description: "Request to remove a file at the specified path.",
43313
43436
  parameters: [
@@ -43331,7 +43454,7 @@ var toolInfo12 = {
43331
43454
  ],
43332
43455
  permissionLevel: 2 /* Write */
43333
43456
  };
43334
- var handler12 = async (provider, args) => {
43457
+ var handler13 = async (provider, args) => {
43335
43458
  if (!provider.removeFile) {
43336
43459
  return {
43337
43460
  type: "Error" /* Error */,
@@ -43345,16 +43468,16 @@ var handler12 = async (provider, args) => {
43345
43468
  message: `<remove_file_path>${path}</remove_file_path><status>Success</status>`
43346
43469
  };
43347
43470
  };
43348
- var isAvailable12 = (provider) => {
43471
+ var isAvailable13 = (provider) => {
43349
43472
  return !!provider.removeFile;
43350
43473
  };
43351
43474
  var removeFile_default = {
43352
- ...toolInfo12,
43353
- handler: handler12,
43354
- isAvailable: isAvailable12
43475
+ ...toolInfo13,
43476
+ handler: handler13,
43477
+ isAvailable: isAvailable13
43355
43478
  };
43356
43479
  // ../core/src/tools/renameFile.ts
43357
- var toolInfo13 = {
43480
+ var toolInfo14 = {
43358
43481
  name: "rename_file",
43359
43482
  description: "Request to rename a file from source path to target path.",
43360
43483
  parameters: [
@@ -43388,7 +43511,7 @@ var toolInfo13 = {
43388
43511
  ],
43389
43512
  permissionLevel: 2 /* Write */
43390
43513
  };
43391
- var handler13 = async (provider, args) => {
43514
+ var handler14 = async (provider, args) => {
43392
43515
  if (!provider.renameFile) {
43393
43516
  return {
43394
43517
  type: "Error" /* Error */,
@@ -43403,13 +43526,13 @@ var handler13 = async (provider, args) => {
43403
43526
  message: `<rename_file_path>${targetPath}</rename_file_path><status>Success</status>`
43404
43527
  };
43405
43528
  };
43406
- var isAvailable13 = (provider) => {
43529
+ var isAvailable14 = (provider) => {
43407
43530
  return !!provider.renameFile;
43408
43531
  };
43409
43532
  var renameFile_default = {
43410
- ...toolInfo13,
43411
- handler: handler13,
43412
- isAvailable: isAvailable13
43533
+ ...toolInfo14,
43534
+ handler: handler14,
43535
+ isAvailable: isAvailable14
43413
43536
  };
43414
43537
  // ../core/src/getAvailableTools.ts
43415
43538
  var getAvailableTools = ({
@@ -43767,7 +43890,13 @@ ${joined}`;
43767
43890
  };
43768
43891
  var responsePrompts = {
43769
43892
  errorInvokeTool: (tool, error) => `An error occurred while invoking the tool "${tool}": ${error}`,
43770
- requireUseTool: "Error: You MUST use a tool before proceeding using XCM tags. e.g. <tool_tool_name>tool_name</tool_tool_name>",
43893
+ requireUseTool: `Error: No tool use detected. You MUST use a tool before proceeding.
43894
+ e.g. <tool_tool_name>tool_name</tool_tool_name>
43895
+
43896
+ Ensure the opening and closing tags are correctly nested and closed, and that you are using the correct tool name.
43897
+ Avoid unnecessary text or symbols before or after the tool use.
43898
+ Avoid unnecessary escape characters or special characters.
43899
+ `,
43771
43900
  toolResults: (tool, result) => `<tool_response>
43772
43901
  <tool_name>${tool}</tool_name>
43773
43902
  <tool_result>
@@ -44010,8 +44139,8 @@ ${instance.prompt}`;
44010
44139
  }
44011
44140
  async#invokeTool(name, args) {
44012
44141
  try {
44013
- const handler14 = this.handlers[name]?.handler;
44014
- if (!handler14) {
44142
+ const handler15 = this.handlers[name]?.handler;
44143
+ if (!handler15) {
44015
44144
  return {
44016
44145
  type: "Error" /* Error */,
44017
44146
  message: responsePrompts.errorInvokeTool(name, "Tool not found"),
@@ -44030,7 +44159,7 @@ ${instance.prompt}`;
44030
44159
  if (resp) {
44031
44160
  return resp;
44032
44161
  }
44033
- return await handler14(this.config.provider, args);
44162
+ return await handler15(this.config.provider, args);
44034
44163
  } catch (error) {
44035
44164
  return {
44036
44165
  type: "Error" /* Error */,
@@ -52663,7 +52792,7 @@ var readConfig = (path) => {
52663
52792
  var import_ignore2 = __toESM(require_ignore(), 1);
52664
52793
  import { spawn as spawn2 } from "node:child_process";
52665
52794
  import { mkdir, readFile, rename, unlink, writeFile } from "node:fs/promises";
52666
- import { dirname } from "node:path";
52795
+ import { dirname as dirname2 } from "node:path";
52667
52796
 
52668
52797
  // ../../node_modules/@inquirer/core/dist/esm/lib/key.js
52669
52798
  var isUpKey = (key) => key.name === "up" || key.name === "k" || key.ctrl && key.name === "p";
@@ -53225,15 +53354,15 @@ function useKeypress(userHandler) {
53225
53354
  signal.current = userHandler;
53226
53355
  useEffect((rl) => {
53227
53356
  let ignore = false;
53228
- const handler14 = withUpdates((_input, event) => {
53357
+ const handler15 = withUpdates((_input, event) => {
53229
53358
  if (ignore)
53230
53359
  return;
53231
53360
  signal.current(event, rl);
53232
53361
  });
53233
- rl.input.on("keypress", handler14);
53362
+ rl.input.on("keypress", handler15);
53234
53363
  return () => {
53235
53364
  ignore = true;
53236
- rl.input.removeListener("keypress", handler14);
53365
+ rl.input.removeListener("keypress", handler15);
53237
53366
  };
53238
53367
  }, []);
53239
53368
  }
@@ -53415,16 +53544,16 @@ class Emitter {
53415
53544
 
53416
53545
  class SignalExitBase {
53417
53546
  }
53418
- var signalExitWrap = (handler14) => {
53547
+ var signalExitWrap = (handler15) => {
53419
53548
  return {
53420
53549
  onExit(cb, opts) {
53421
- return handler14.onExit(cb, opts);
53550
+ return handler15.onExit(cb, opts);
53422
53551
  },
53423
53552
  load() {
53424
- return handler14.load();
53553
+ return handler15.load();
53425
53554
  },
53426
53555
  unload() {
53427
- return handler14.unload();
53556
+ return handler15.unload();
53428
53557
  }
53429
53558
  };
53430
53559
  };
@@ -54119,7 +54248,7 @@ var getProvider = (agentName, config2, options = {}) => {
54119
54248
  if (ig.ignores(path)) {
54120
54249
  throw new Error(`Not allow to access file ${path}`);
54121
54250
  }
54122
- await mkdir(dirname(path), { recursive: true });
54251
+ await mkdir(dirname2(path), { recursive: true });
54123
54252
  return await writeFile(path, content, "utf8");
54124
54253
  },
54125
54254
  removeFile: async (path) => {
@@ -54190,6 +54319,20 @@ var getProvider = (agentName, config2, options = {}) => {
54190
54319
  },
54191
54320
  attemptCompletion: async (result) => {
54192
54321
  return;
54322
+ },
54323
+ fetchUrl: async (url) => {
54324
+ const isRaw = url.startsWith("https://raw.githubusercontent.com/");
54325
+ const urlToFetch = isRaw ? url : `https://r.jina.ai/${url}`;
54326
+ try {
54327
+ const response = await fetch(urlToFetch);
54328
+ if (!response.ok) {
54329
+ throw new Error(`HTTP error! status: ${response.status}`);
54330
+ }
54331
+ return await response.text();
54332
+ } catch (error) {
54333
+ console.error("Error fetching URL:", error);
54334
+ throw error;
54335
+ }
54193
54336
  }
54194
54337
  };
54195
54338
  if (checkRipgrep()) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@polka-codes/runner",
3
- "version": "0.8.21",
3
+ "version": "0.8.23",
4
4
  "license": "AGPL-3.0",
5
5
  "author": "github@polka.codes",
6
6
  "type": "module",
@@ -17,8 +17,8 @@
17
17
  "build": "bun build src/index.ts --outdir dist --target node"
18
18
  },
19
19
  "dependencies": {
20
- "@polka-codes/cli-shared": "0.8.10",
21
- "@polka-codes/core": "0.8.10",
20
+ "@polka-codes/cli-shared": "0.8.22",
21
+ "@polka-codes/core": "0.8.22",
22
22
  "commander": "^13.0.0",
23
23
  "dotenv": "^16.4.7",
24
24
  "ignore": "^7.0.3",