@polka-codes/runner 0.9.47 → 0.9.48

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 +175 -167
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -22101,9 +22101,9 @@ var require_event_target = __commonJS((exports, module) => {
22101
22101
  }
22102
22102
  Object.defineProperty(MessageEvent.prototype, "data", { enumerable: true });
22103
22103
  var EventTarget = {
22104
- addEventListener(type, handler17, options = {}) {
22104
+ addEventListener(type, handler15, options = {}) {
22105
22105
  for (const listener of this.listeners(type)) {
22106
- if (!options[kForOnEventAttribute] && listener[kListener] === handler17 && !listener[kForOnEventAttribute]) {
22106
+ if (!options[kForOnEventAttribute] && listener[kListener] === handler15 && !listener[kForOnEventAttribute]) {
22107
22107
  return;
22108
22108
  }
22109
22109
  }
@@ -22114,7 +22114,7 @@ var require_event_target = __commonJS((exports, module) => {
22114
22114
  data: isBinary ? data : data.toString()
22115
22115
  });
22116
22116
  event[kTarget] = this;
22117
- callListener(handler17, this, event);
22117
+ callListener(handler15, this, event);
22118
22118
  };
22119
22119
  } else if (type === "close") {
22120
22120
  wrapper = function onClose(code, message) {
@@ -22124,7 +22124,7 @@ var require_event_target = __commonJS((exports, module) => {
22124
22124
  wasClean: this._closeFrameReceived && this._closeFrameSent
22125
22125
  });
22126
22126
  event[kTarget] = this;
22127
- callListener(handler17, this, event);
22127
+ callListener(handler15, this, event);
22128
22128
  };
22129
22129
  } else if (type === "error") {
22130
22130
  wrapper = function onError(error46) {
@@ -22133,28 +22133,28 @@ var require_event_target = __commonJS((exports, module) => {
22133
22133
  message: error46.message
22134
22134
  });
22135
22135
  event[kTarget] = this;
22136
- callListener(handler17, this, event);
22136
+ callListener(handler15, this, event);
22137
22137
  };
22138
22138
  } else if (type === "open") {
22139
22139
  wrapper = function onOpen() {
22140
22140
  const event = new Event("open");
22141
22141
  event[kTarget] = this;
22142
- callListener(handler17, this, event);
22142
+ callListener(handler15, this, event);
22143
22143
  };
22144
22144
  } else {
22145
22145
  return;
22146
22146
  }
22147
22147
  wrapper[kForOnEventAttribute] = !!options[kForOnEventAttribute];
22148
- wrapper[kListener] = handler17;
22148
+ wrapper[kListener] = handler15;
22149
22149
  if (options.once) {
22150
22150
  this.once(type, wrapper);
22151
22151
  } else {
22152
22152
  this.on(type, wrapper);
22153
22153
  }
22154
22154
  },
22155
- removeEventListener(type, handler17) {
22155
+ removeEventListener(type, handler15) {
22156
22156
  for (const listener of this.listeners(type)) {
22157
- if (listener[kListener] === handler17 && !listener[kForOnEventAttribute]) {
22157
+ if (listener[kListener] === handler15 && !listener[kForOnEventAttribute]) {
22158
22158
  this.removeListener(type, listener);
22159
22159
  break;
22160
22160
  }
@@ -22680,16 +22680,16 @@ var require_websocket = __commonJS((exports, module) => {
22680
22680
  }
22681
22681
  return null;
22682
22682
  },
22683
- set(handler17) {
22683
+ set(handler15) {
22684
22684
  for (const listener of this.listeners(method)) {
22685
22685
  if (listener[kForOnEventAttribute]) {
22686
22686
  this.removeListener(method, listener);
22687
22687
  break;
22688
22688
  }
22689
22689
  }
22690
- if (typeof handler17 !== "function")
22690
+ if (typeof handler15 !== "function")
22691
22691
  return;
22692
- this.addEventListener(method, handler17, {
22692
+ this.addEventListener(method, handler15, {
22693
22693
  [kForOnEventAttribute]: true
22694
22694
  });
22695
22695
  }
@@ -23569,7 +23569,7 @@ var {
23569
23569
  Help
23570
23570
  } = import__.default;
23571
23571
  // package.json
23572
- var version = "0.9.47";
23572
+ var version = "0.9.48";
23573
23573
 
23574
23574
  // src/runner.ts
23575
23575
  import { execSync } from "node:child_process";
@@ -36142,36 +36142,12 @@ var configSchema = exports_external.object({
36142
36142
  rules: exports_external.array(exports_external.string()).optional().or(exports_external.string()).optional(),
36143
36143
  excludeFiles: exports_external.array(exports_external.string()).optional()
36144
36144
  }).strict();
36145
- // ../core/src/tools/appendMemory.ts
36146
- var toolInfo = {
36147
- name: "appendMemory",
36148
- description: "Appends content to a memory topic.",
36149
- parameters: exports_external.object({
36150
- topic: exports_external.string().nullish().describe('The topic to append to in memory. Defaults to ":default:".'),
36151
- content: exports_external.string().describe("The content to append.")
36152
- })
36153
- };
36154
- var handler = async (provider, args) => {
36155
- const { topic, content } = toolInfo.parameters.parse(args);
36156
- await provider.appendMemory(topic ?? undefined, content);
36157
- return {
36158
- type: "Reply" /* Reply */,
36159
- message: {
36160
- type: "text",
36161
- value: `Content appended to memory topic '${topic || ""}'.`
36162
- }
36163
- };
36164
- };
36165
- var appendMemory_default = {
36166
- ...toolInfo,
36167
- handler
36168
- };
36169
36145
  // ../core/src/tools/askFollowupQuestion.ts
36170
36146
  var questionObject = exports_external.object({
36171
36147
  prompt: exports_external.string().describe("The text of the question.").meta({ usageValue: "question text here" }),
36172
36148
  options: exports_external.array(exports_external.string()).default([]).describe("Ordered list of suggested answers (omit if none).").meta({ usageValue: "suggested answer here" })
36173
36149
  });
36174
- var toolInfo2 = {
36150
+ var toolInfo = {
36175
36151
  name: "askFollowupQuestion",
36176
36152
  description: "Call this when vital details are missing. Pose each follow-up as one direct, unambiguous question. If it speeds the reply, add up to five short, mutually-exclusive answer options. Group any related questions in the same call to avoid a back-and-forth chain.",
36177
36153
  parameters: exports_external.object({
@@ -36221,7 +36197,7 @@ var toolInfo2 = {
36221
36197
  ]
36222
36198
  })
36223
36199
  };
36224
- var handler2 = async (provider, args) => {
36200
+ var handler = async (provider, args) => {
36225
36201
  if (!provider.askFollowupQuestion) {
36226
36202
  return {
36227
36203
  type: "Error" /* Error */,
@@ -36231,7 +36207,7 @@ var handler2 = async (provider, args) => {
36231
36207
  }
36232
36208
  };
36233
36209
  }
36234
- const { questions } = toolInfo2.parameters.parse(args);
36210
+ const { questions } = toolInfo.parameters.parse(args);
36235
36211
  if (questions.length === 0) {
36236
36212
  return {
36237
36213
  type: "Error" /* Error */,
@@ -36259,11 +36235,11 @@ ${answer}
36259
36235
  };
36260
36236
  };
36261
36237
  var askFollowupQuestion_default = {
36262
- ...toolInfo2,
36263
- handler: handler2
36238
+ ...toolInfo,
36239
+ handler
36264
36240
  };
36265
36241
  // ../core/src/tools/executeCommand.ts
36266
- var toolInfo3 = {
36242
+ var toolInfo2 = {
36267
36243
  name: "executeCommand",
36268
36244
  description: "Run a single CLI command. The command is always executed in the project-root working directory (regardless of earlier commands). Prefer one-off shell commands over wrapper scripts for flexibility. **IMPORTANT**: After an `execute_command` call, you MUST stop and NOT allowed to make further tool calls in the same message.",
36269
36245
  parameters: exports_external.object({
@@ -36290,7 +36266,7 @@ var toolInfo3 = {
36290
36266
  ]
36291
36267
  })
36292
36268
  };
36293
- var handler3 = async (provider, args) => {
36269
+ var handler2 = async (provider, args) => {
36294
36270
  if (!provider.executeCommand) {
36295
36271
  return {
36296
36272
  type: "Error" /* Error */,
@@ -36300,7 +36276,7 @@ var handler3 = async (provider, args) => {
36300
36276
  }
36301
36277
  };
36302
36278
  }
36303
- const { command, requiresApproval } = toolInfo3.parameters.parse(args);
36279
+ const { command, requiresApproval } = toolInfo2.parameters.parse(args);
36304
36280
  try {
36305
36281
  const result = await provider.executeCommand(command, requiresApproval);
36306
36282
  let message = `<command>${command}</command>
@@ -36347,11 +36323,11 @@ ${result.stderr}
36347
36323
  }
36348
36324
  };
36349
36325
  var executeCommand_default = {
36350
- ...toolInfo3,
36351
- handler: handler3
36326
+ ...toolInfo2,
36327
+ handler: handler2
36352
36328
  };
36353
36329
  // ../core/src/tools/fetchUrl.ts
36354
- var toolInfo4 = {
36330
+ var toolInfo3 = {
36355
36331
  name: "fetchUrl",
36356
36332
  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.",
36357
36333
  parameters: exports_external.object({
@@ -36384,7 +36360,7 @@ var toolInfo4 = {
36384
36360
  ]
36385
36361
  })
36386
36362
  };
36387
- var handler4 = async (provider, args) => {
36363
+ var handler3 = async (provider, args) => {
36388
36364
  if (!provider.fetchUrl) {
36389
36365
  return {
36390
36366
  type: "Error" /* Error */,
@@ -36394,7 +36370,7 @@ var handler4 = async (provider, args) => {
36394
36370
  }
36395
36371
  };
36396
36372
  }
36397
- const { url: urls } = toolInfo4.parameters.parse(args);
36373
+ const { url: urls } = toolInfo3.parameters.parse(args);
36398
36374
  if (urls.length === 0) {
36399
36375
  return {
36400
36376
  type: "Error" /* Error */,
@@ -36425,11 +36401,11 @@ var handler4 = async (provider, args) => {
36425
36401
  };
36426
36402
  };
36427
36403
  var fetchUrl_default = {
36428
- ...toolInfo4,
36429
- handler: handler4
36404
+ ...toolInfo3,
36405
+ handler: handler3
36430
36406
  };
36431
36407
  // ../core/src/tools/listFiles.ts
36432
- var toolInfo5 = {
36408
+ var toolInfo4 = {
36433
36409
  name: "listFiles",
36434
36410
  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.",
36435
36411
  parameters: exports_external.object({
@@ -36467,7 +36443,7 @@ var toolInfo5 = {
36467
36443
  ]
36468
36444
  })
36469
36445
  };
36470
- var handler5 = async (provider, args) => {
36446
+ var handler4 = async (provider, args) => {
36471
36447
  if (!provider.listFiles) {
36472
36448
  return {
36473
36449
  type: "Error" /* Error */,
@@ -36477,7 +36453,7 @@ var handler5 = async (provider, args) => {
36477
36453
  }
36478
36454
  };
36479
36455
  }
36480
- const { path, maxCount, recursive, includeIgnored } = toolInfo5.parameters.parse(args);
36456
+ const { path, maxCount, recursive, includeIgnored } = toolInfo4.parameters.parse(args);
36481
36457
  const [files, limitReached] = await provider.listFiles(path, recursive, maxCount, includeIgnored);
36482
36458
  return {
36483
36459
  type: "Reply" /* Reply */,
@@ -36493,16 +36469,16 @@ ${files.join(`
36493
36469
  };
36494
36470
  };
36495
36471
  var listFiles_default = {
36496
- ...toolInfo5,
36497
- handler: handler5
36472
+ ...toolInfo4,
36473
+ handler: handler4
36498
36474
  };
36499
36475
  // ../core/src/tools/listMemoryTopics.ts
36500
- var toolInfo6 = {
36476
+ var toolInfo5 = {
36501
36477
  name: "listMemoryTopics",
36502
36478
  description: "Lists all topics in memory.",
36503
36479
  parameters: exports_external.object({})
36504
36480
  };
36505
- var handler6 = async (provider, _args) => {
36481
+ var handler5 = async (provider, _args) => {
36506
36482
  const topics = await provider.listMemoryTopics();
36507
36483
  if (!topics.length) {
36508
36484
  return { type: "Reply" /* Reply */, message: { type: "text", value: "No topics found." } };
@@ -36518,18 +36494,18 @@ ${topics.join(`
36518
36494
  };
36519
36495
  };
36520
36496
  var listMemoryTopics_default = {
36521
- ...toolInfo6,
36522
- handler: handler6
36497
+ ...toolInfo5,
36498
+ handler: handler5
36523
36499
  };
36524
36500
  // ../core/src/tools/readBinaryFile.ts
36525
- var toolInfo7 = {
36501
+ var toolInfo6 = {
36526
36502
  name: "readBinaryFile",
36527
36503
  description: "Read a binary file from a URL or local path. Use file:// prefix to access local files. This can be used to access non-text files such as PDFs or images.",
36528
36504
  parameters: exports_external.object({
36529
36505
  url: exports_external.string().describe("The URL or local path of the file to read.")
36530
36506
  })
36531
36507
  };
36532
- var handler7 = async (provider, args) => {
36508
+ var handler6 = async (provider, args) => {
36533
36509
  if (!provider.readBinaryFile) {
36534
36510
  return {
36535
36511
  type: "Error" /* Error */,
@@ -36539,7 +36515,7 @@ var handler7 = async (provider, args) => {
36539
36515
  }
36540
36516
  };
36541
36517
  }
36542
- const { url: url2 } = toolInfo7.parameters.parse(args);
36518
+ const { url: url2 } = toolInfo6.parameters.parse(args);
36543
36519
  try {
36544
36520
  const filePart = await provider.readBinaryFile(url2);
36545
36521
  return {
@@ -36568,11 +36544,11 @@ var handler7 = async (provider, args) => {
36568
36544
  }
36569
36545
  };
36570
36546
  var readBinaryFile_default = {
36571
- ...toolInfo7,
36572
- handler: handler7
36547
+ ...toolInfo6,
36548
+ handler: handler6
36573
36549
  };
36574
36550
  // ../core/src/tools/readFile.ts
36575
- var toolInfo8 = {
36551
+ var toolInfo7 = {
36576
36552
  name: "readFile",
36577
36553
  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.",
36578
36554
  parameters: exports_external.object({
@@ -36609,7 +36585,7 @@ var toolInfo8 = {
36609
36585
  ]
36610
36586
  })
36611
36587
  };
36612
- var handler8 = async (provider, args) => {
36588
+ var handler7 = async (provider, args) => {
36613
36589
  if (!provider.readFile) {
36614
36590
  return {
36615
36591
  type: "Error" /* Error */,
@@ -36619,7 +36595,7 @@ var handler8 = async (provider, args) => {
36619
36595
  }
36620
36596
  };
36621
36597
  }
36622
- const { path: paths, includeIgnored } = toolInfo8.parameters.parse(args);
36598
+ const { path: paths, includeIgnored } = toolInfo7.parameters.parse(args);
36623
36599
  const resp = [];
36624
36600
  for (const path of paths) {
36625
36601
  const fileContent = await provider.readFile(path, includeIgnored);
@@ -36644,19 +36620,19 @@ var handler8 = async (provider, args) => {
36644
36620
  };
36645
36621
  };
36646
36622
  var readFile_default = {
36647
- ...toolInfo8,
36648
- handler: handler8
36623
+ ...toolInfo7,
36624
+ handler: handler7
36649
36625
  };
36650
36626
  // ../core/src/tools/readMemory.ts
36651
- var toolInfo9 = {
36627
+ var toolInfo8 = {
36652
36628
  name: "readMemory",
36653
36629
  description: "Reads content from a memory topic.",
36654
36630
  parameters: exports_external.object({
36655
36631
  topic: exports_external.string().optional().describe('The topic to read from memory. Defaults to ":default:".')
36656
36632
  })
36657
36633
  };
36658
- var handler9 = async (provider, args) => {
36659
- const { topic } = toolInfo9.parameters.parse(args);
36634
+ var handler8 = async (provider, args) => {
36635
+ const { topic } = toolInfo8.parameters.parse(args);
36660
36636
  const content = await provider.readMemory(topic);
36661
36637
  if (content) {
36662
36638
  return {
@@ -36678,11 +36654,11 @@ ${content}
36678
36654
  };
36679
36655
  };
36680
36656
  var readMemory_default = {
36681
- ...toolInfo9,
36682
- handler: handler9
36657
+ ...toolInfo8,
36658
+ handler: handler8
36683
36659
  };
36684
36660
  // ../core/src/tools/removeFile.ts
36685
- var toolInfo10 = {
36661
+ var toolInfo9 = {
36686
36662
  name: "removeFile",
36687
36663
  description: "Request to remove a file at the specified path.",
36688
36664
  parameters: exports_external.object({
@@ -36698,7 +36674,7 @@ var toolInfo10 = {
36698
36674
  ]
36699
36675
  })
36700
36676
  };
36701
- var handler10 = async (provider, args) => {
36677
+ var handler9 = async (provider, args) => {
36702
36678
  if (!provider.removeFile) {
36703
36679
  return {
36704
36680
  type: "Error" /* Error */,
@@ -36708,7 +36684,7 @@ var handler10 = async (provider, args) => {
36708
36684
  }
36709
36685
  };
36710
36686
  }
36711
- const parsed = toolInfo10.parameters.safeParse(args);
36687
+ const parsed = toolInfo9.parameters.safeParse(args);
36712
36688
  if (!parsed.success) {
36713
36689
  return {
36714
36690
  type: "Error" /* Error */,
@@ -36729,34 +36705,11 @@ var handler10 = async (provider, args) => {
36729
36705
  };
36730
36706
  };
36731
36707
  var removeFile_default = {
36732
- ...toolInfo10,
36733
- handler: handler10
36734
- };
36735
- // ../core/src/tools/removeMemory.ts
36736
- var toolInfo11 = {
36737
- name: "removeMemory",
36738
- description: "Removes a topic from memory.",
36739
- parameters: exports_external.object({
36740
- topic: exports_external.string().optional().describe('The topic to remove from memory. Defaults to ":default:".')
36741
- })
36742
- };
36743
- var handler11 = async (provider, args) => {
36744
- const { topic } = toolInfo11.parameters.parse(args);
36745
- await provider.removeMemory(topic);
36746
- return {
36747
- type: "Reply" /* Reply */,
36748
- message: {
36749
- type: "text",
36750
- value: `Memory topic '${topic || ""}' removed.`
36751
- }
36752
- };
36753
- };
36754
- var removeMemory_default = {
36755
- ...toolInfo11,
36756
- handler: handler11
36708
+ ...toolInfo9,
36709
+ handler: handler9
36757
36710
  };
36758
36711
  // ../core/src/tools/renameFile.ts
36759
- var toolInfo12 = {
36712
+ var toolInfo10 = {
36760
36713
  name: "renameFile",
36761
36714
  description: "Request to rename a file from source path to target path.",
36762
36715
  parameters: exports_external.object({
@@ -36774,7 +36727,7 @@ var toolInfo12 = {
36774
36727
  ]
36775
36728
  })
36776
36729
  };
36777
- var handler12 = async (provider, args) => {
36730
+ var handler10 = async (provider, args) => {
36778
36731
  if (!provider.renameFile) {
36779
36732
  return {
36780
36733
  type: "Error" /* Error */,
@@ -36784,7 +36737,7 @@ var handler12 = async (provider, args) => {
36784
36737
  }
36785
36738
  };
36786
36739
  }
36787
- const { source_path, target_path } = toolInfo12.parameters.parse(args);
36740
+ const { source_path, target_path } = toolInfo10.parameters.parse(args);
36788
36741
  await provider.renameFile(source_path, target_path);
36789
36742
  return {
36790
36743
  type: "Reply" /* Reply */,
@@ -36795,8 +36748,8 @@ var handler12 = async (provider, args) => {
36795
36748
  };
36796
36749
  };
36797
36750
  var renameFile_default = {
36798
- ...toolInfo12,
36799
- handler: handler12
36751
+ ...toolInfo10,
36752
+ handler: handler10
36800
36753
  };
36801
36754
  // ../core/src/tools/utils/replaceInFile.ts
36802
36755
  var replaceInFile = (fileContent, diff) => {
@@ -36873,7 +36826,7 @@ var replaceInFile = (fileContent, diff) => {
36873
36826
  };
36874
36827
 
36875
36828
  // ../core/src/tools/replaceInFile.ts
36876
- var toolInfo13 = {
36829
+ var toolInfo11 = {
36877
36830
  name: "replaceInFile",
36878
36831
  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.",
36879
36832
  parameters: exports_external.object({
@@ -36983,7 +36936,7 @@ function oldFeature() {
36983
36936
  ]
36984
36937
  })
36985
36938
  };
36986
- var handler13 = async (provider, args) => {
36939
+ var handler11 = async (provider, args) => {
36987
36940
  if (!provider.readFile || !provider.writeFile) {
36988
36941
  return {
36989
36942
  type: "Error" /* Error */,
@@ -36993,7 +36946,7 @@ var handler13 = async (provider, args) => {
36993
36946
  }
36994
36947
  };
36995
36948
  }
36996
- const parsed = toolInfo13.parameters.safeParse(args);
36949
+ const parsed = toolInfo11.parameters.safeParse(args);
36997
36950
  if (!parsed.success) {
36998
36951
  return {
36999
36952
  type: "Error" /* Error */,
@@ -37057,35 +37010,11 @@ var handler13 = async (provider, args) => {
37057
37010
  }
37058
37011
  };
37059
37012
  var replaceInFile_default = {
37060
- ...toolInfo13,
37061
- handler: handler13
37062
- };
37063
- // ../core/src/tools/replaceMemory.ts
37064
- var toolInfo14 = {
37065
- name: "replaceMemory",
37066
- description: "Replaces content of a memory topic.",
37067
- parameters: exports_external.object({
37068
- topic: exports_external.string().optional().describe('The topic to replace in memory. Defaults to ":default:".'),
37069
- content: exports_external.string().describe("The new content.")
37070
- })
37071
- };
37072
- var handler14 = async (provider, args) => {
37073
- const { topic, content } = toolInfo14.parameters.parse(args);
37074
- await provider.replaceMemory(topic, content);
37075
- return {
37076
- type: "Reply" /* Reply */,
37077
- message: {
37078
- type: "text",
37079
- value: `Memory topic '${topic || ""}' replaced.`
37080
- }
37081
- };
37082
- };
37083
- var replaceMemory_default = {
37084
- ...toolInfo14,
37085
- handler: handler14
37013
+ ...toolInfo11,
37014
+ handler: handler11
37086
37015
  };
37087
37016
  // ../core/src/tools/searchFiles.ts
37088
- var toolInfo15 = {
37017
+ var toolInfo12 = {
37089
37018
  name: "searchFiles",
37090
37019
  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.",
37091
37020
  parameters: exports_external.object({
@@ -37109,7 +37038,7 @@ var toolInfo15 = {
37109
37038
  ]
37110
37039
  })
37111
37040
  };
37112
- var handler15 = async (provider, args) => {
37041
+ var handler12 = async (provider, args) => {
37113
37042
  if (!provider.searchFiles) {
37114
37043
  return {
37115
37044
  type: "Error" /* Error */,
@@ -37119,7 +37048,7 @@ var handler15 = async (provider, args) => {
37119
37048
  }
37120
37049
  };
37121
37050
  }
37122
- const parsed = toolInfo15.parameters.safeParse(args);
37051
+ const parsed = toolInfo12.parameters.safeParse(args);
37123
37052
  if (!parsed.success) {
37124
37053
  return {
37125
37054
  type: "Error" /* Error */,
@@ -37157,11 +37086,82 @@ ${files.join(`
37157
37086
  }
37158
37087
  };
37159
37088
  var searchFiles_default = {
37160
- ...toolInfo15,
37161
- handler: handler15
37089
+ ...toolInfo12,
37090
+ handler: handler12
37091
+ };
37092
+ // ../core/src/tools/updateMemory.ts
37093
+ var toolInfo13 = {
37094
+ name: "updateMemory",
37095
+ description: "Appends, replaces, or removes content from a memory topic.",
37096
+ parameters: exports_external.object({
37097
+ operation: exports_external.enum(["append", "replace", "remove"]).describe("The operation to perform."),
37098
+ topic: exports_external.string().nullish().describe('The topic to update in memory. Defaults to ":default:".'),
37099
+ content: exports_external.string().optional().describe("The content for append or replace operations. Must be omitted for remove operation.")
37100
+ }).superRefine((data, ctx) => {
37101
+ if (data.operation === "append" || data.operation === "replace") {
37102
+ if (data.content === undefined) {
37103
+ ctx.addIssue({
37104
+ code: "custom",
37105
+ message: 'Content is required for "append" and "replace" operations.',
37106
+ path: ["content"]
37107
+ });
37108
+ }
37109
+ } else if (data.operation === "remove") {
37110
+ if (data.content !== undefined) {
37111
+ ctx.addIssue({
37112
+ code: "custom",
37113
+ message: 'Content must not be provided for "remove" operation.',
37114
+ path: ["content"]
37115
+ });
37116
+ }
37117
+ }
37118
+ })
37119
+ };
37120
+ var handler13 = async (provider, args) => {
37121
+ if (!provider.updateMemory) {
37122
+ return {
37123
+ type: "Error" /* Error */,
37124
+ message: {
37125
+ type: "error-text",
37126
+ value: "Memory operations are not supported by the current provider."
37127
+ }
37128
+ };
37129
+ }
37130
+ const params = toolInfo13.parameters.parse(args);
37131
+ await provider.updateMemory(params.operation, params.topic ?? undefined, "content" in params ? params.content : undefined);
37132
+ switch (params.operation) {
37133
+ case "append":
37134
+ return {
37135
+ type: "Reply" /* Reply */,
37136
+ message: {
37137
+ type: "text",
37138
+ value: `Content appended to memory topic '${params.topic || ":default:"}'.`
37139
+ }
37140
+ };
37141
+ case "replace":
37142
+ return {
37143
+ type: "Reply" /* Reply */,
37144
+ message: {
37145
+ type: "text",
37146
+ value: `Memory topic '${params.topic || ":default:"}' replaced.`
37147
+ }
37148
+ };
37149
+ case "remove":
37150
+ return {
37151
+ type: "Reply" /* Reply */,
37152
+ message: {
37153
+ type: "text",
37154
+ value: `Memory topic '${params.topic || ":default:"}' removed.`
37155
+ }
37156
+ };
37157
+ }
37158
+ };
37159
+ var updateMemory_default = {
37160
+ ...toolInfo13,
37161
+ handler: handler13
37162
37162
  };
37163
37163
  // ../core/src/tools/writeToFile.ts
37164
- var toolInfo16 = {
37164
+ var toolInfo14 = {
37165
37165
  name: "writeToFile",
37166
37166
  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.",
37167
37167
  parameters: exports_external.object({
@@ -37190,7 +37190,7 @@ export default App;
37190
37190
  ]
37191
37191
  })
37192
37192
  };
37193
- var handler16 = async (provider, args) => {
37193
+ var handler14 = async (provider, args) => {
37194
37194
  if (!provider.writeFile) {
37195
37195
  return {
37196
37196
  type: "Error" /* Error */,
@@ -37200,7 +37200,7 @@ var handler16 = async (provider, args) => {
37200
37200
  }
37201
37201
  };
37202
37202
  }
37203
- const parsed = toolInfo16.parameters.safeParse(args);
37203
+ const parsed = toolInfo14.parameters.safeParse(args);
37204
37204
  if (!parsed.success) {
37205
37205
  return {
37206
37206
  type: "Error" /* Error */,
@@ -37224,8 +37224,8 @@ var handler16 = async (provider, args) => {
37224
37224
  };
37225
37225
  };
37226
37226
  var writeToFile_default = {
37227
- ...toolInfo16,
37228
- handler: handler16
37227
+ ...toolInfo14,
37228
+ handler: handler14
37229
37229
  };
37230
37230
  // ../core/src/UsageMeter.ts
37231
37231
  class UsageMeter {
@@ -39101,15 +39101,15 @@ function useKeypress(userHandler) {
39101
39101
  signal.current = userHandler;
39102
39102
  useEffect((rl) => {
39103
39103
  let ignore = false;
39104
- const handler17 = withUpdates((_input, event) => {
39104
+ const handler15 = withUpdates((_input, event) => {
39105
39105
  if (ignore)
39106
39106
  return;
39107
39107
  signal.current(event, rl);
39108
39108
  });
39109
- rl.input.on("keypress", handler17);
39109
+ rl.input.on("keypress", handler15);
39110
39110
  return () => {
39111
39111
  ignore = true;
39112
- rl.input.removeListener("keypress", handler17);
39112
+ rl.input.removeListener("keypress", handler15);
39113
39113
  };
39114
39114
  }, []);
39115
39115
  }
@@ -39268,16 +39268,16 @@ class Emitter {
39268
39268
 
39269
39269
  class SignalExitBase {
39270
39270
  }
39271
- var signalExitWrap = (handler17) => {
39271
+ var signalExitWrap = (handler15) => {
39272
39272
  return {
39273
39273
  onExit(cb, opts) {
39274
- return handler17.onExit(cb, opts);
39274
+ return handler15.onExit(cb, opts);
39275
39275
  },
39276
39276
  load() {
39277
- return handler17.load();
39277
+ return handler15.load();
39278
39278
  },
39279
39279
  unload() {
39280
- return handler17.unload();
39280
+ return handler15.unload();
39281
39281
  }
39282
39282
  };
39283
39283
  };
@@ -40086,19 +40086,26 @@ var getProvider = (options = {}) => {
40086
40086
  readMemory: async (topic = defaultMemoryTopic) => {
40087
40087
  return memoryStore[topic];
40088
40088
  },
40089
- appendMemory: async (topic = defaultMemoryTopic, content) => {
40090
- if (memoryStore[topic]) {
40091
- memoryStore[topic] += content;
40092
- } else {
40093
- memoryStore[topic] = content;
40089
+ updateMemory: async (operation, topic, content) => {
40090
+ const memoryTopic = topic ?? defaultMemoryTopic;
40091
+ switch (operation) {
40092
+ case "append":
40093
+ if (content === undefined) {
40094
+ throw new Error("Content is required for append operation.");
40095
+ }
40096
+ memoryStore[memoryTopic] = (memoryStore[memoryTopic] || "") + content;
40097
+ break;
40098
+ case "replace":
40099
+ if (content === undefined) {
40100
+ throw new Error("Content is required for replace operation.");
40101
+ }
40102
+ memoryStore[memoryTopic] = content;
40103
+ break;
40104
+ case "remove":
40105
+ delete memoryStore[memoryTopic];
40106
+ break;
40094
40107
  }
40095
40108
  },
40096
- replaceMemory: async (topic = defaultMemoryTopic, content) => {
40097
- memoryStore[topic] = content;
40098
- },
40099
- removeMemory: async (topic = defaultMemoryTopic) => {
40100
- delete memoryStore[topic];
40101
- },
40102
40109
  readFile: async (path, includeIgnored) => {
40103
40110
  if (!includeIgnored && ig.ignores(path)) {
40104
40111
  throw new Error(`Not allow to access file ${path}`);
@@ -40246,7 +40253,8 @@ var getProvider = (options = {}) => {
40246
40253
  return provider2;
40247
40254
  };
40248
40255
  // ../cli-shared/src/utils/eventHandler.ts
40249
- var toolCallStats = new Map;
40256
+ var taskToolCallStats = new Map;
40257
+ var globalToolCallStats = new Map;
40250
40258
  // ../../node_modules/.bun/ws@8.18.3/node_modules/ws/wrapper.mjs
40251
40259
  var import_stream = __toESM(require_stream(), 1);
40252
40260
  var import_receiver = __toESM(require_receiver(), 1);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@polka-codes/runner",
3
- "version": "0.9.47",
3
+ "version": "0.9.48",
4
4
  "license": "AGPL-3.0",
5
5
  "author": "github@polka.codes",
6
6
  "type": "module",