@polka-codes/runner 0.8.18 → 0.8.19
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +158 -158
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -32748,7 +32748,7 @@ var {
|
|
|
32748
32748
|
Help
|
|
32749
32749
|
} = import__.default;
|
|
32750
32750
|
// package.json
|
|
32751
|
-
var version = "0.8.
|
|
32751
|
+
var version = "0.8.19";
|
|
32752
32752
|
|
|
32753
32753
|
// src/runner.ts
|
|
32754
32754
|
import { execSync } from "node:child_process";
|
|
@@ -42037,13 +42037,13 @@ __export(exports_allTools, {
|
|
|
42037
42037
|
writeToFile: () => writeToFile_default,
|
|
42038
42038
|
updateKnowledge: () => updateKnowledge_default,
|
|
42039
42039
|
searchFiles: () => searchFiles_default,
|
|
42040
|
+
replaceInFile: () => replaceInFile_default,
|
|
42040
42041
|
renameFile: () => renameFile_default,
|
|
42041
42042
|
removeFile: () => removeFile_default,
|
|
42042
42043
|
readFile: () => readFile_default,
|
|
42043
42044
|
listFiles: () => listFiles_default,
|
|
42044
42045
|
handOver: () => handOver_default,
|
|
42045
42046
|
executeCommand: () => executeCommand_default,
|
|
42046
|
-
editFile: () => editFile_default,
|
|
42047
42047
|
delegate: () => delegate_default,
|
|
42048
42048
|
attemptCompletion: () => attemptCompletion_default,
|
|
42049
42049
|
askFollowupQuestion: () => askFollowupQuestion_default
|
|
@@ -42674,8 +42674,125 @@ var readFile_default = {
|
|
|
42674
42674
|
handler: handler6,
|
|
42675
42675
|
isAvailable: isAvailable6
|
|
42676
42676
|
};
|
|
42677
|
-
// ../core/src/tools/
|
|
42677
|
+
// ../core/src/tools/replaceInFile.ts
|
|
42678
42678
|
var toolInfo7 = {
|
|
42679
|
+
name: "replace_in_file",
|
|
42680
|
+
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.",
|
|
42681
|
+
parameters: [
|
|
42682
|
+
{
|
|
42683
|
+
name: "path",
|
|
42684
|
+
description: "The path of the file to modify",
|
|
42685
|
+
required: true,
|
|
42686
|
+
usageValue: "File path here"
|
|
42687
|
+
},
|
|
42688
|
+
{
|
|
42689
|
+
name: "diff",
|
|
42690
|
+
description: `One or more SEARCH/REPLACE blocks following this exact format:
|
|
42691
|
+
\`\`\`
|
|
42692
|
+
<<<<<<< SEARCH
|
|
42693
|
+
[exact content to find]
|
|
42694
|
+
=======
|
|
42695
|
+
[new content to replace with]
|
|
42696
|
+
>>>>>>> REPLACE
|
|
42697
|
+
\`\`\`
|
|
42698
|
+
Critical rules:
|
|
42699
|
+
1. SEARCH content must match the associated file section to find EXACTLY:
|
|
42700
|
+
* Match character-for-character including whitespace, indentation, line endings
|
|
42701
|
+
* Include all comments, docstrings, etc.
|
|
42702
|
+
2. SEARCH/REPLACE blocks will ONLY replace the first match occurrence.
|
|
42703
|
+
* Including multiple unique SEARCH/REPLACE blocks if you need to make multiple changes.
|
|
42704
|
+
* Include *just* enough lines in each SEARCH section to uniquely match each set of lines that need to change.
|
|
42705
|
+
* When using multiple SEARCH/REPLACE blocks, list them in the order they appear in the file.
|
|
42706
|
+
3. Keep SEARCH/REPLACE blocks concise:
|
|
42707
|
+
* Break large SEARCH/REPLACE blocks into a series of smaller blocks that each change a small portion of the file.
|
|
42708
|
+
* Include just the changing lines, and a few surrounding lines if needed for uniqueness.
|
|
42709
|
+
* Do not include long runs of unchanging lines in SEARCH/REPLACE blocks.
|
|
42710
|
+
* Each line must be complete. Never truncate lines mid-way through as this can cause matching failures.
|
|
42711
|
+
4. Special operations:
|
|
42712
|
+
* To move code: Use two SEARCH/REPLACE blocks (one to delete from original + one to insert at new location)
|
|
42713
|
+
* To delete code: Use empty REPLACE section`,
|
|
42714
|
+
required: true,
|
|
42715
|
+
usageValue: "Search and replace blocks here"
|
|
42716
|
+
}
|
|
42717
|
+
],
|
|
42718
|
+
examples: [
|
|
42719
|
+
{
|
|
42720
|
+
description: "Request to replace sections of content in a file",
|
|
42721
|
+
parameters: [
|
|
42722
|
+
{
|
|
42723
|
+
name: "path",
|
|
42724
|
+
value: "src/main.js"
|
|
42725
|
+
},
|
|
42726
|
+
{
|
|
42727
|
+
name: "diff",
|
|
42728
|
+
value: `
|
|
42729
|
+
<<<<<<< SEARCH
|
|
42730
|
+
import React from 'react';
|
|
42731
|
+
=======
|
|
42732
|
+
import React, { useState } from 'react';
|
|
42733
|
+
>>>>>>> REPLACE
|
|
42734
|
+
|
|
42735
|
+
<<<<<<< SEARCH
|
|
42736
|
+
function handleSubmit() {
|
|
42737
|
+
saveData();
|
|
42738
|
+
setLoading(false);
|
|
42739
|
+
}
|
|
42740
|
+
|
|
42741
|
+
=======
|
|
42742
|
+
>>>>>>> REPLACE
|
|
42743
|
+
|
|
42744
|
+
<<<<<<< SEARCH
|
|
42745
|
+
return (
|
|
42746
|
+
<div>
|
|
42747
|
+
=======
|
|
42748
|
+
function handleSubmit() {
|
|
42749
|
+
saveData();
|
|
42750
|
+
setLoading(false);
|
|
42751
|
+
}
|
|
42752
|
+
|
|
42753
|
+
return (
|
|
42754
|
+
<div>
|
|
42755
|
+
>>>>>>> REPLACE
|
|
42756
|
+
`
|
|
42757
|
+
}
|
|
42758
|
+
]
|
|
42759
|
+
}
|
|
42760
|
+
],
|
|
42761
|
+
permissionLevel: 2 /* Write */
|
|
42762
|
+
};
|
|
42763
|
+
var handler7 = async (provider, args) => {
|
|
42764
|
+
if (!provider.readFile || !provider.writeFile) {
|
|
42765
|
+
return {
|
|
42766
|
+
type: "Error" /* Error */,
|
|
42767
|
+
message: "Not possible to replace in file. Abort."
|
|
42768
|
+
};
|
|
42769
|
+
}
|
|
42770
|
+
const path = getString(args, "path");
|
|
42771
|
+
const diff = getString(args, "diff");
|
|
42772
|
+
const fileContent = await provider.readFile(path);
|
|
42773
|
+
if (fileContent == null) {
|
|
42774
|
+
return {
|
|
42775
|
+
type: "Error" /* Error */,
|
|
42776
|
+
message: `<error><replace_in_file_path>${path}</replace_in_file_path><error_message>File not found</error_message></error>`
|
|
42777
|
+
};
|
|
42778
|
+
}
|
|
42779
|
+
const result = await replaceInFile(fileContent, diff);
|
|
42780
|
+
await provider.writeFile(path, result);
|
|
42781
|
+
return {
|
|
42782
|
+
type: "Reply" /* Reply */,
|
|
42783
|
+
message: `<replace_in_file_path>${path}</replace_in_file_path>`
|
|
42784
|
+
};
|
|
42785
|
+
};
|
|
42786
|
+
var isAvailable7 = (provider) => {
|
|
42787
|
+
return !!provider.readFile && !!provider.writeFile;
|
|
42788
|
+
};
|
|
42789
|
+
var replaceInFile_default = {
|
|
42790
|
+
...toolInfo7,
|
|
42791
|
+
handler: handler7,
|
|
42792
|
+
isAvailable: isAvailable7
|
|
42793
|
+
};
|
|
42794
|
+
// ../core/src/tools/searchFiles.ts
|
|
42795
|
+
var toolInfo8 = {
|
|
42679
42796
|
name: "search_files",
|
|
42680
42797
|
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.",
|
|
42681
42798
|
parameters: [
|
|
@@ -42719,7 +42836,7 @@ var toolInfo7 = {
|
|
|
42719
42836
|
],
|
|
42720
42837
|
permissionLevel: 1 /* Read */
|
|
42721
42838
|
};
|
|
42722
|
-
var
|
|
42839
|
+
var handler8 = async (provider, args) => {
|
|
42723
42840
|
if (!provider.searchFiles) {
|
|
42724
42841
|
return {
|
|
42725
42842
|
type: "Error" /* Error */,
|
|
@@ -42742,18 +42859,18 @@ ${files.join(`
|
|
|
42742
42859
|
`
|
|
42743
42860
|
};
|
|
42744
42861
|
};
|
|
42745
|
-
var
|
|
42862
|
+
var isAvailable8 = (provider) => {
|
|
42746
42863
|
return !!provider.searchFiles;
|
|
42747
42864
|
};
|
|
42748
42865
|
var searchFiles_default = {
|
|
42749
|
-
...
|
|
42750
|
-
handler:
|
|
42751
|
-
isAvailable:
|
|
42866
|
+
...toolInfo8,
|
|
42867
|
+
handler: handler8,
|
|
42868
|
+
isAvailable: isAvailable8
|
|
42752
42869
|
};
|
|
42753
42870
|
// ../core/src/tools/updateKnowledge.ts
|
|
42754
42871
|
var import_yaml = __toESM(require_dist(), 1);
|
|
42755
42872
|
import { join } from "node:path";
|
|
42756
|
-
var
|
|
42873
|
+
var toolInfo9 = {
|
|
42757
42874
|
name: "update_knowledge",
|
|
42758
42875
|
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.",
|
|
42759
42876
|
parameters: [
|
|
@@ -42930,7 +43047,7 @@ function deepMerge(target, source) {
|
|
|
42930
43047
|
}
|
|
42931
43048
|
return output;
|
|
42932
43049
|
}
|
|
42933
|
-
var
|
|
43050
|
+
var handler9 = async (provider, args) => {
|
|
42934
43051
|
if (!provider.readFile || !provider.writeFile) {
|
|
42935
43052
|
return {
|
|
42936
43053
|
type: "Error" /* Error */,
|
|
@@ -43002,16 +43119,16 @@ var handler8 = async (provider, args) => {
|
|
|
43002
43119
|
};
|
|
43003
43120
|
}
|
|
43004
43121
|
};
|
|
43005
|
-
var
|
|
43122
|
+
var isAvailable9 = (provider) => {
|
|
43006
43123
|
return !!provider.readFile && !!provider.writeFile;
|
|
43007
43124
|
};
|
|
43008
43125
|
var updateKnowledge_default = {
|
|
43009
|
-
...
|
|
43010
|
-
handler:
|
|
43011
|
-
isAvailable:
|
|
43126
|
+
...toolInfo9,
|
|
43127
|
+
handler: handler9,
|
|
43128
|
+
isAvailable: isAvailable9
|
|
43012
43129
|
};
|
|
43013
43130
|
// ../core/src/tools/writeToFile.ts
|
|
43014
|
-
var
|
|
43131
|
+
var toolInfo10 = {
|
|
43015
43132
|
name: "write_to_file",
|
|
43016
43133
|
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 `<` and `>`.",
|
|
43017
43134
|
parameters: [
|
|
@@ -43056,7 +43173,7 @@ export default App;
|
|
|
43056
43173
|
],
|
|
43057
43174
|
permissionLevel: 2 /* Write */
|
|
43058
43175
|
};
|
|
43059
|
-
var
|
|
43176
|
+
var handler10 = async (provider, args) => {
|
|
43060
43177
|
if (!provider.writeFile) {
|
|
43061
43178
|
return {
|
|
43062
43179
|
type: "Error" /* Error */,
|
|
@@ -43071,16 +43188,16 @@ var handler9 = async (provider, args) => {
|
|
|
43071
43188
|
message: `<write_to_file_path>${path}</write_to_file_path><status>Success</status>`
|
|
43072
43189
|
};
|
|
43073
43190
|
};
|
|
43074
|
-
var
|
|
43191
|
+
var isAvailable10 = (provider) => {
|
|
43075
43192
|
return !!provider.writeFile;
|
|
43076
43193
|
};
|
|
43077
43194
|
var writeToFile_default = {
|
|
43078
|
-
...
|
|
43079
|
-
handler:
|
|
43080
|
-
isAvailable:
|
|
43195
|
+
...toolInfo10,
|
|
43196
|
+
handler: handler10,
|
|
43197
|
+
isAvailable: isAvailable10
|
|
43081
43198
|
};
|
|
43082
43199
|
// ../core/src/tools/handOver.ts
|
|
43083
|
-
var
|
|
43200
|
+
var toolInfo11 = {
|
|
43084
43201
|
name: "hand_over",
|
|
43085
43202
|
description: "Hand over the current task to another agent to complete. This tool MUST NOT to be used with any other tool.",
|
|
43086
43203
|
parameters: [
|
|
@@ -43134,7 +43251,7 @@ var toolInfo10 = {
|
|
|
43134
43251
|
],
|
|
43135
43252
|
permissionLevel: 0 /* None */
|
|
43136
43253
|
};
|
|
43137
|
-
var
|
|
43254
|
+
var handler11 = async (_provider, args) => {
|
|
43138
43255
|
const agentName = getString(args, "agent_name");
|
|
43139
43256
|
const task = getString(args, "task");
|
|
43140
43257
|
const context = getString(args, "context", undefined);
|
|
@@ -43147,16 +43264,16 @@ var handler10 = async (_provider, args) => {
|
|
|
43147
43264
|
files
|
|
43148
43265
|
};
|
|
43149
43266
|
};
|
|
43150
|
-
var
|
|
43267
|
+
var isAvailable11 = (_provider) => {
|
|
43151
43268
|
return true;
|
|
43152
43269
|
};
|
|
43153
43270
|
var handOver_default = {
|
|
43154
|
-
...
|
|
43155
|
-
handler:
|
|
43156
|
-
isAvailable:
|
|
43271
|
+
...toolInfo11,
|
|
43272
|
+
handler: handler11,
|
|
43273
|
+
isAvailable: isAvailable11
|
|
43157
43274
|
};
|
|
43158
43275
|
// ../core/src/tools/removeFile.ts
|
|
43159
|
-
var
|
|
43276
|
+
var toolInfo12 = {
|
|
43160
43277
|
name: "remove_file",
|
|
43161
43278
|
description: "Request to remove a file at the specified path.",
|
|
43162
43279
|
parameters: [
|
|
@@ -43180,7 +43297,7 @@ var toolInfo11 = {
|
|
|
43180
43297
|
],
|
|
43181
43298
|
permissionLevel: 2 /* Write */
|
|
43182
43299
|
};
|
|
43183
|
-
var
|
|
43300
|
+
var handler12 = async (provider, args) => {
|
|
43184
43301
|
if (!provider.removeFile) {
|
|
43185
43302
|
return {
|
|
43186
43303
|
type: "Error" /* Error */,
|
|
@@ -43194,16 +43311,16 @@ var handler11 = async (provider, args) => {
|
|
|
43194
43311
|
message: `<remove_file_path>${path}</remove_file_path><status>Success</status>`
|
|
43195
43312
|
};
|
|
43196
43313
|
};
|
|
43197
|
-
var
|
|
43314
|
+
var isAvailable12 = (provider) => {
|
|
43198
43315
|
return !!provider.removeFile;
|
|
43199
43316
|
};
|
|
43200
43317
|
var removeFile_default = {
|
|
43201
|
-
...
|
|
43202
|
-
handler:
|
|
43203
|
-
isAvailable:
|
|
43318
|
+
...toolInfo12,
|
|
43319
|
+
handler: handler12,
|
|
43320
|
+
isAvailable: isAvailable12
|
|
43204
43321
|
};
|
|
43205
43322
|
// ../core/src/tools/renameFile.ts
|
|
43206
|
-
var
|
|
43323
|
+
var toolInfo13 = {
|
|
43207
43324
|
name: "rename_file",
|
|
43208
43325
|
description: "Request to rename a file from source path to target path.",
|
|
43209
43326
|
parameters: [
|
|
@@ -43237,7 +43354,7 @@ var toolInfo12 = {
|
|
|
43237
43354
|
],
|
|
43238
43355
|
permissionLevel: 2 /* Write */
|
|
43239
43356
|
};
|
|
43240
|
-
var
|
|
43357
|
+
var handler13 = async (provider, args) => {
|
|
43241
43358
|
if (!provider.renameFile) {
|
|
43242
43359
|
return {
|
|
43243
43360
|
type: "Error" /* Error */,
|
|
@@ -43252,16 +43369,16 @@ var handler12 = async (provider, args) => {
|
|
|
43252
43369
|
message: `<rename_file_path>${targetPath}</rename_file_path><status>Success</status>`
|
|
43253
43370
|
};
|
|
43254
43371
|
};
|
|
43255
|
-
var
|
|
43372
|
+
var isAvailable13 = (provider) => {
|
|
43256
43373
|
return !!provider.renameFile;
|
|
43257
43374
|
};
|
|
43258
43375
|
var renameFile_default = {
|
|
43259
|
-
...
|
|
43260
|
-
handler:
|
|
43261
|
-
isAvailable:
|
|
43376
|
+
...toolInfo13,
|
|
43377
|
+
handler: handler13,
|
|
43378
|
+
isAvailable: isAvailable13
|
|
43262
43379
|
};
|
|
43263
43380
|
// ../core/src/tools/editFile.ts
|
|
43264
|
-
var
|
|
43381
|
+
var toolInfo14 = {
|
|
43265
43382
|
name: "edit_file",
|
|
43266
43383
|
description: "Request to edit file contents using search/replace operations. Supports multiple edit operations in a single call.",
|
|
43267
43384
|
parameters: [
|
|
@@ -43377,7 +43494,7 @@ var toolInfo13 = {
|
|
|
43377
43494
|
],
|
|
43378
43495
|
permissionLevel: 2 /* Write */
|
|
43379
43496
|
};
|
|
43380
|
-
var
|
|
43497
|
+
var handler14 = async (provider, args) => {
|
|
43381
43498
|
if (!provider.readFile || !provider.writeFile) {
|
|
43382
43499
|
return {
|
|
43383
43500
|
type: "Error" /* Error */,
|
|
@@ -43413,127 +43530,10 @@ var handler13 = async (provider, args) => {
|
|
|
43413
43530
|
};
|
|
43414
43531
|
}
|
|
43415
43532
|
};
|
|
43416
|
-
var isAvailable13 = (provider) => {
|
|
43417
|
-
return !!provider.readFile && !!provider.writeFile;
|
|
43418
|
-
};
|
|
43419
|
-
var editFile_default = {
|
|
43420
|
-
...toolInfo13,
|
|
43421
|
-
handler: handler13,
|
|
43422
|
-
isAvailable: isAvailable13
|
|
43423
|
-
};
|
|
43424
|
-
// ../core/src/tools/replaceInFile.ts
|
|
43425
|
-
var toolInfo14 = {
|
|
43426
|
-
name: "replace_in_file",
|
|
43427
|
-
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.",
|
|
43428
|
-
parameters: [
|
|
43429
|
-
{
|
|
43430
|
-
name: "path",
|
|
43431
|
-
description: "The path of the file to modify",
|
|
43432
|
-
required: true,
|
|
43433
|
-
usageValue: "File path here"
|
|
43434
|
-
},
|
|
43435
|
-
{
|
|
43436
|
-
name: "diff",
|
|
43437
|
-
description: `One or more SEARCH/REPLACE blocks following this exact format:
|
|
43438
|
-
\`\`\`
|
|
43439
|
-
<<<<<<< SEARCH
|
|
43440
|
-
[exact content to find]
|
|
43441
|
-
=======
|
|
43442
|
-
[new content to replace with]
|
|
43443
|
-
>>>>>>> REPLACE
|
|
43444
|
-
\`\`\`
|
|
43445
|
-
Critical rules:
|
|
43446
|
-
1. SEARCH content must match the associated file section to find EXACTLY:
|
|
43447
|
-
* Match character-for-character including whitespace, indentation, line endings
|
|
43448
|
-
* Include all comments, docstrings, etc.
|
|
43449
|
-
2. SEARCH/REPLACE blocks will ONLY replace the first match occurrence.
|
|
43450
|
-
* Including multiple unique SEARCH/REPLACE blocks if you need to make multiple changes.
|
|
43451
|
-
* Include *just* enough lines in each SEARCH section to uniquely match each set of lines that need to change.
|
|
43452
|
-
* When using multiple SEARCH/REPLACE blocks, list them in the order they appear in the file.
|
|
43453
|
-
3. Keep SEARCH/REPLACE blocks concise:
|
|
43454
|
-
* Break large SEARCH/REPLACE blocks into a series of smaller blocks that each change a small portion of the file.
|
|
43455
|
-
* Include just the changing lines, and a few surrounding lines if needed for uniqueness.
|
|
43456
|
-
* Do not include long runs of unchanging lines in SEARCH/REPLACE blocks.
|
|
43457
|
-
* Each line must be complete. Never truncate lines mid-way through as this can cause matching failures.
|
|
43458
|
-
4. Special operations:
|
|
43459
|
-
* To move code: Use two SEARCH/REPLACE blocks (one to delete from original + one to insert at new location)
|
|
43460
|
-
* To delete code: Use empty REPLACE section`,
|
|
43461
|
-
required: true,
|
|
43462
|
-
usageValue: "Search and replace blocks here"
|
|
43463
|
-
}
|
|
43464
|
-
],
|
|
43465
|
-
examples: [
|
|
43466
|
-
{
|
|
43467
|
-
description: "Request to replace sections of content in a file",
|
|
43468
|
-
parameters: [
|
|
43469
|
-
{
|
|
43470
|
-
name: "path",
|
|
43471
|
-
value: "src/main.js"
|
|
43472
|
-
},
|
|
43473
|
-
{
|
|
43474
|
-
name: "diff",
|
|
43475
|
-
value: `
|
|
43476
|
-
<<<<<<< SEARCH
|
|
43477
|
-
import React from 'react';
|
|
43478
|
-
=======
|
|
43479
|
-
import React, { useState } from 'react';
|
|
43480
|
-
>>>>>>> REPLACE
|
|
43481
|
-
|
|
43482
|
-
<<<<<<< SEARCH
|
|
43483
|
-
function handleSubmit() {
|
|
43484
|
-
saveData();
|
|
43485
|
-
setLoading(false);
|
|
43486
|
-
}
|
|
43487
|
-
|
|
43488
|
-
=======
|
|
43489
|
-
>>>>>>> REPLACE
|
|
43490
|
-
|
|
43491
|
-
<<<<<<< SEARCH
|
|
43492
|
-
return (
|
|
43493
|
-
<div>
|
|
43494
|
-
=======
|
|
43495
|
-
function handleSubmit() {
|
|
43496
|
-
saveData();
|
|
43497
|
-
setLoading(false);
|
|
43498
|
-
}
|
|
43499
|
-
|
|
43500
|
-
return (
|
|
43501
|
-
<div>
|
|
43502
|
-
>>>>>>> REPLACE
|
|
43503
|
-
`
|
|
43504
|
-
}
|
|
43505
|
-
]
|
|
43506
|
-
}
|
|
43507
|
-
],
|
|
43508
|
-
permissionLevel: 2 /* Write */
|
|
43509
|
-
};
|
|
43510
|
-
var handler14 = async (provider, args) => {
|
|
43511
|
-
if (!provider.readFile || !provider.writeFile) {
|
|
43512
|
-
return {
|
|
43513
|
-
type: "Error" /* Error */,
|
|
43514
|
-
message: "Not possible to replace in file. Abort."
|
|
43515
|
-
};
|
|
43516
|
-
}
|
|
43517
|
-
const path = getString(args, "path");
|
|
43518
|
-
const diff = getString(args, "diff");
|
|
43519
|
-
const fileContent = await provider.readFile(path);
|
|
43520
|
-
if (fileContent == null) {
|
|
43521
|
-
return {
|
|
43522
|
-
type: "Error" /* Error */,
|
|
43523
|
-
message: `<error><replace_in_file_path>${path}</replace_in_file_path><error_message>File not found</error_message></error>`
|
|
43524
|
-
};
|
|
43525
|
-
}
|
|
43526
|
-
const result = await replaceInFile(fileContent, diff);
|
|
43527
|
-
await provider.writeFile(path, result);
|
|
43528
|
-
return {
|
|
43529
|
-
type: "Reply" /* Reply */,
|
|
43530
|
-
message: `<replace_in_file_path>${path}</replace_in_file_path>`
|
|
43531
|
-
};
|
|
43532
|
-
};
|
|
43533
43533
|
var isAvailable14 = (provider) => {
|
|
43534
43534
|
return !!provider.readFile && !!provider.writeFile;
|
|
43535
43535
|
};
|
|
43536
|
-
var
|
|
43536
|
+
var editFile_default = {
|
|
43537
43537
|
...toolInfo14,
|
|
43538
43538
|
handler: handler14,
|
|
43539
43539
|
isAvailable: isAvailable14
|