@polka-codes/runner 0.9.48 → 0.9.49
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 +301 -78
- 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,
|
|
22104
|
+
addEventListener(type, handler18, options = {}) {
|
|
22105
22105
|
for (const listener of this.listeners(type)) {
|
|
22106
|
-
if (!options[kForOnEventAttribute] && listener[kListener] ===
|
|
22106
|
+
if (!options[kForOnEventAttribute] && listener[kListener] === handler18 && !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(
|
|
22117
|
+
callListener(handler18, 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(
|
|
22127
|
+
callListener(handler18, 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(
|
|
22136
|
+
callListener(handler18, 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(
|
|
22142
|
+
callListener(handler18, this, event);
|
|
22143
22143
|
};
|
|
22144
22144
|
} else {
|
|
22145
22145
|
return;
|
|
22146
22146
|
}
|
|
22147
22147
|
wrapper[kForOnEventAttribute] = !!options[kForOnEventAttribute];
|
|
22148
|
-
wrapper[kListener] =
|
|
22148
|
+
wrapper[kListener] = handler18;
|
|
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,
|
|
22155
|
+
removeEventListener(type, handler18) {
|
|
22156
22156
|
for (const listener of this.listeners(type)) {
|
|
22157
|
-
if (listener[kListener] ===
|
|
22157
|
+
if (listener[kListener] === handler18 && !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(
|
|
22683
|
+
set(handler18) {
|
|
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
|
|
22690
|
+
if (typeof handler18 !== "function")
|
|
22691
22691
|
return;
|
|
22692
|
-
this.addEventListener(method,
|
|
22692
|
+
this.addEventListener(method, handler18, {
|
|
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.
|
|
23572
|
+
var version = "0.9.49";
|
|
23573
23573
|
|
|
23574
23574
|
// src/runner.ts
|
|
23575
23575
|
import { execSync } from "node:child_process";
|
|
@@ -36404,8 +36404,40 @@ var fetchUrl_default = {
|
|
|
36404
36404
|
...toolInfo3,
|
|
36405
36405
|
handler: handler3
|
|
36406
36406
|
};
|
|
36407
|
-
// ../core/src/tools/
|
|
36407
|
+
// ../core/src/tools/getTodoItem.ts
|
|
36408
36408
|
var toolInfo4 = {
|
|
36409
|
+
name: "getTodoItem",
|
|
36410
|
+
description: "Get a to-do item by its ID.",
|
|
36411
|
+
parameters: exports_external.object({
|
|
36412
|
+
id: exports_external.string().describe("The ID of the to-do item.")
|
|
36413
|
+
})
|
|
36414
|
+
};
|
|
36415
|
+
var handler4 = async (provider, args) => {
|
|
36416
|
+
if (!provider.getTodoItem) {
|
|
36417
|
+
return {
|
|
36418
|
+
type: "Error" /* Error */,
|
|
36419
|
+
message: {
|
|
36420
|
+
type: "error-text",
|
|
36421
|
+
value: "Not possible to get a to-do item."
|
|
36422
|
+
}
|
|
36423
|
+
};
|
|
36424
|
+
}
|
|
36425
|
+
const { id } = toolInfo4.parameters.parse(args);
|
|
36426
|
+
const item = await provider.getTodoItem(id);
|
|
36427
|
+
return {
|
|
36428
|
+
type: "Reply" /* Reply */,
|
|
36429
|
+
message: {
|
|
36430
|
+
type: "json",
|
|
36431
|
+
value: item ?? null
|
|
36432
|
+
}
|
|
36433
|
+
};
|
|
36434
|
+
};
|
|
36435
|
+
var getTodoItem_default = {
|
|
36436
|
+
...toolInfo4,
|
|
36437
|
+
handler: handler4
|
|
36438
|
+
};
|
|
36439
|
+
// ../core/src/tools/listFiles.ts
|
|
36440
|
+
var toolInfo5 = {
|
|
36409
36441
|
name: "listFiles",
|
|
36410
36442
|
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.",
|
|
36411
36443
|
parameters: exports_external.object({
|
|
@@ -36443,7 +36475,7 @@ var toolInfo4 = {
|
|
|
36443
36475
|
]
|
|
36444
36476
|
})
|
|
36445
36477
|
};
|
|
36446
|
-
var
|
|
36478
|
+
var handler5 = async (provider, args) => {
|
|
36447
36479
|
if (!provider.listFiles) {
|
|
36448
36480
|
return {
|
|
36449
36481
|
type: "Error" /* Error */,
|
|
@@ -36453,7 +36485,7 @@ var handler4 = async (provider, args) => {
|
|
|
36453
36485
|
}
|
|
36454
36486
|
};
|
|
36455
36487
|
}
|
|
36456
|
-
const { path, maxCount, recursive, includeIgnored } =
|
|
36488
|
+
const { path, maxCount, recursive, includeIgnored } = toolInfo5.parameters.parse(args);
|
|
36457
36489
|
const [files, limitReached] = await provider.listFiles(path, recursive, maxCount, includeIgnored);
|
|
36458
36490
|
return {
|
|
36459
36491
|
type: "Reply" /* Reply */,
|
|
@@ -36469,16 +36501,16 @@ ${files.join(`
|
|
|
36469
36501
|
};
|
|
36470
36502
|
};
|
|
36471
36503
|
var listFiles_default = {
|
|
36472
|
-
...
|
|
36473
|
-
handler:
|
|
36504
|
+
...toolInfo5,
|
|
36505
|
+
handler: handler5
|
|
36474
36506
|
};
|
|
36475
36507
|
// ../core/src/tools/listMemoryTopics.ts
|
|
36476
|
-
var
|
|
36508
|
+
var toolInfo6 = {
|
|
36477
36509
|
name: "listMemoryTopics",
|
|
36478
|
-
description: "Lists all topics in memory.",
|
|
36510
|
+
description: "Lists all topics in memory. Use this to see what information has been stored and which topics are available to read from.",
|
|
36479
36511
|
parameters: exports_external.object({})
|
|
36480
36512
|
};
|
|
36481
|
-
var
|
|
36513
|
+
var handler6 = async (provider, _args) => {
|
|
36482
36514
|
const topics = await provider.listMemoryTopics();
|
|
36483
36515
|
if (!topics.length) {
|
|
36484
36516
|
return { type: "Reply" /* Reply */, message: { type: "text", value: "No topics found." } };
|
|
@@ -36494,18 +36526,91 @@ ${topics.join(`
|
|
|
36494
36526
|
};
|
|
36495
36527
|
};
|
|
36496
36528
|
var listMemoryTopics_default = {
|
|
36497
|
-
...
|
|
36498
|
-
handler:
|
|
36529
|
+
...toolInfo6,
|
|
36530
|
+
handler: handler6
|
|
36531
|
+
};
|
|
36532
|
+
// ../core/src/tools/todo.ts
|
|
36533
|
+
var TodoStatus = exports_external.enum(["open", "completed", "closed"]);
|
|
36534
|
+
var TodoItemSchema = exports_external.object({
|
|
36535
|
+
id: exports_external.string(),
|
|
36536
|
+
title: exports_external.string(),
|
|
36537
|
+
description: exports_external.string(),
|
|
36538
|
+
relevantFileList: exports_external.array(exports_external.string()),
|
|
36539
|
+
status: TodoStatus
|
|
36540
|
+
});
|
|
36541
|
+
var UpdateTodoItemInputSchema = exports_external.object({
|
|
36542
|
+
operation: exports_external.enum(["add", "update"]),
|
|
36543
|
+
id: exports_external.string().nullish(),
|
|
36544
|
+
parentId: exports_external.string().nullish(),
|
|
36545
|
+
title: exports_external.string().nullish(),
|
|
36546
|
+
description: exports_external.string().nullish(),
|
|
36547
|
+
relevantFileList: exports_external.array(exports_external.string()).nullish(),
|
|
36548
|
+
status: TodoStatus.nullish()
|
|
36549
|
+
}).superRefine((data, ctx) => {
|
|
36550
|
+
if (data.operation === "add") {
|
|
36551
|
+
if (!data.title) {
|
|
36552
|
+
ctx.addIssue({
|
|
36553
|
+
code: "custom",
|
|
36554
|
+
message: 'Title is required for "add" operation',
|
|
36555
|
+
path: ["title"]
|
|
36556
|
+
});
|
|
36557
|
+
}
|
|
36558
|
+
} else if (data.operation === "update") {
|
|
36559
|
+
if (!data.id) {
|
|
36560
|
+
ctx.addIssue({
|
|
36561
|
+
code: "custom",
|
|
36562
|
+
message: 'ID is required for "update" operation',
|
|
36563
|
+
path: ["id"]
|
|
36564
|
+
});
|
|
36565
|
+
}
|
|
36566
|
+
}
|
|
36567
|
+
});
|
|
36568
|
+
var UpdateTodoItemOutputSchema = exports_external.object({
|
|
36569
|
+
id: exports_external.string()
|
|
36570
|
+
});
|
|
36571
|
+
|
|
36572
|
+
// ../core/src/tools/listTodoItems.ts
|
|
36573
|
+
var toolInfo7 = {
|
|
36574
|
+
name: "listTodoItems",
|
|
36575
|
+
description: "List all to-do items, sorted by id. If an id is provided, it lists all sub-items for that id. Can be filtered by status.",
|
|
36576
|
+
parameters: exports_external.object({
|
|
36577
|
+
id: exports_external.string().nullish(),
|
|
36578
|
+
status: TodoStatus.nullish()
|
|
36579
|
+
})
|
|
36580
|
+
};
|
|
36581
|
+
var handler7 = async (provider, args) => {
|
|
36582
|
+
if (!provider.listTodoItems) {
|
|
36583
|
+
return {
|
|
36584
|
+
type: "Error" /* Error */,
|
|
36585
|
+
message: {
|
|
36586
|
+
type: "error-text",
|
|
36587
|
+
value: "Not possible to list to-do items."
|
|
36588
|
+
}
|
|
36589
|
+
};
|
|
36590
|
+
}
|
|
36591
|
+
const { id, status } = toolInfo7.parameters.parse(args);
|
|
36592
|
+
const items = await provider.listTodoItems(id, status);
|
|
36593
|
+
return {
|
|
36594
|
+
type: "Reply" /* Reply */,
|
|
36595
|
+
message: {
|
|
36596
|
+
type: "json",
|
|
36597
|
+
value: items
|
|
36598
|
+
}
|
|
36599
|
+
};
|
|
36600
|
+
};
|
|
36601
|
+
var listTodoItems_default = {
|
|
36602
|
+
...toolInfo7,
|
|
36603
|
+
handler: handler7
|
|
36499
36604
|
};
|
|
36500
36605
|
// ../core/src/tools/readBinaryFile.ts
|
|
36501
|
-
var
|
|
36606
|
+
var toolInfo8 = {
|
|
36502
36607
|
name: "readBinaryFile",
|
|
36503
36608
|
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.",
|
|
36504
36609
|
parameters: exports_external.object({
|
|
36505
36610
|
url: exports_external.string().describe("The URL or local path of the file to read.")
|
|
36506
36611
|
})
|
|
36507
36612
|
};
|
|
36508
|
-
var
|
|
36613
|
+
var handler8 = async (provider, args) => {
|
|
36509
36614
|
if (!provider.readBinaryFile) {
|
|
36510
36615
|
return {
|
|
36511
36616
|
type: "Error" /* Error */,
|
|
@@ -36515,7 +36620,7 @@ var handler6 = async (provider, args) => {
|
|
|
36515
36620
|
}
|
|
36516
36621
|
};
|
|
36517
36622
|
}
|
|
36518
|
-
const { url: url2 } =
|
|
36623
|
+
const { url: url2 } = toolInfo8.parameters.parse(args);
|
|
36519
36624
|
try {
|
|
36520
36625
|
const filePart = await provider.readBinaryFile(url2);
|
|
36521
36626
|
return {
|
|
@@ -36544,11 +36649,11 @@ var handler6 = async (provider, args) => {
|
|
|
36544
36649
|
}
|
|
36545
36650
|
};
|
|
36546
36651
|
var readBinaryFile_default = {
|
|
36547
|
-
...
|
|
36548
|
-
handler:
|
|
36652
|
+
...toolInfo8,
|
|
36653
|
+
handler: handler8
|
|
36549
36654
|
};
|
|
36550
36655
|
// ../core/src/tools/readFile.ts
|
|
36551
|
-
var
|
|
36656
|
+
var toolInfo9 = {
|
|
36552
36657
|
name: "readFile",
|
|
36553
36658
|
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.",
|
|
36554
36659
|
parameters: exports_external.object({
|
|
@@ -36585,7 +36690,7 @@ var toolInfo7 = {
|
|
|
36585
36690
|
]
|
|
36586
36691
|
})
|
|
36587
36692
|
};
|
|
36588
|
-
var
|
|
36693
|
+
var handler9 = async (provider, args) => {
|
|
36589
36694
|
if (!provider.readFile) {
|
|
36590
36695
|
return {
|
|
36591
36696
|
type: "Error" /* Error */,
|
|
@@ -36595,7 +36700,7 @@ var handler7 = async (provider, args) => {
|
|
|
36595
36700
|
}
|
|
36596
36701
|
};
|
|
36597
36702
|
}
|
|
36598
|
-
const { path: paths, includeIgnored } =
|
|
36703
|
+
const { path: paths, includeIgnored } = toolInfo9.parameters.parse(args);
|
|
36599
36704
|
const resp = [];
|
|
36600
36705
|
for (const path of paths) {
|
|
36601
36706
|
const fileContent = await provider.readFile(path, includeIgnored);
|
|
@@ -36620,19 +36725,19 @@ var handler7 = async (provider, args) => {
|
|
|
36620
36725
|
};
|
|
36621
36726
|
};
|
|
36622
36727
|
var readFile_default = {
|
|
36623
|
-
...
|
|
36624
|
-
handler:
|
|
36728
|
+
...toolInfo9,
|
|
36729
|
+
handler: handler9
|
|
36625
36730
|
};
|
|
36626
36731
|
// ../core/src/tools/readMemory.ts
|
|
36627
|
-
var
|
|
36732
|
+
var toolInfo10 = {
|
|
36628
36733
|
name: "readMemory",
|
|
36629
|
-
description: "Reads content from a memory topic.",
|
|
36734
|
+
description: "Reads content from a memory topic. Use this to retrieve information stored in previous steps. If no topic is specified, reads from the default topic.",
|
|
36630
36735
|
parameters: exports_external.object({
|
|
36631
36736
|
topic: exports_external.string().optional().describe('The topic to read from memory. Defaults to ":default:".')
|
|
36632
36737
|
})
|
|
36633
36738
|
};
|
|
36634
|
-
var
|
|
36635
|
-
const { topic } =
|
|
36739
|
+
var handler10 = async (provider, args) => {
|
|
36740
|
+
const { topic } = toolInfo10.parameters.parse(args);
|
|
36636
36741
|
const content = await provider.readMemory(topic);
|
|
36637
36742
|
if (content) {
|
|
36638
36743
|
return {
|
|
@@ -36654,11 +36759,11 @@ ${content}
|
|
|
36654
36759
|
};
|
|
36655
36760
|
};
|
|
36656
36761
|
var readMemory_default = {
|
|
36657
|
-
...
|
|
36658
|
-
handler:
|
|
36762
|
+
...toolInfo10,
|
|
36763
|
+
handler: handler10
|
|
36659
36764
|
};
|
|
36660
36765
|
// ../core/src/tools/removeFile.ts
|
|
36661
|
-
var
|
|
36766
|
+
var toolInfo11 = {
|
|
36662
36767
|
name: "removeFile",
|
|
36663
36768
|
description: "Request to remove a file at the specified path.",
|
|
36664
36769
|
parameters: exports_external.object({
|
|
@@ -36674,7 +36779,7 @@ var toolInfo9 = {
|
|
|
36674
36779
|
]
|
|
36675
36780
|
})
|
|
36676
36781
|
};
|
|
36677
|
-
var
|
|
36782
|
+
var handler11 = async (provider, args) => {
|
|
36678
36783
|
if (!provider.removeFile) {
|
|
36679
36784
|
return {
|
|
36680
36785
|
type: "Error" /* Error */,
|
|
@@ -36684,7 +36789,7 @@ var handler9 = async (provider, args) => {
|
|
|
36684
36789
|
}
|
|
36685
36790
|
};
|
|
36686
36791
|
}
|
|
36687
|
-
const parsed =
|
|
36792
|
+
const parsed = toolInfo11.parameters.safeParse(args);
|
|
36688
36793
|
if (!parsed.success) {
|
|
36689
36794
|
return {
|
|
36690
36795
|
type: "Error" /* Error */,
|
|
@@ -36705,11 +36810,11 @@ var handler9 = async (provider, args) => {
|
|
|
36705
36810
|
};
|
|
36706
36811
|
};
|
|
36707
36812
|
var removeFile_default = {
|
|
36708
|
-
...
|
|
36709
|
-
handler:
|
|
36813
|
+
...toolInfo11,
|
|
36814
|
+
handler: handler11
|
|
36710
36815
|
};
|
|
36711
36816
|
// ../core/src/tools/renameFile.ts
|
|
36712
|
-
var
|
|
36817
|
+
var toolInfo12 = {
|
|
36713
36818
|
name: "renameFile",
|
|
36714
36819
|
description: "Request to rename a file from source path to target path.",
|
|
36715
36820
|
parameters: exports_external.object({
|
|
@@ -36727,7 +36832,7 @@ var toolInfo10 = {
|
|
|
36727
36832
|
]
|
|
36728
36833
|
})
|
|
36729
36834
|
};
|
|
36730
|
-
var
|
|
36835
|
+
var handler12 = async (provider, args) => {
|
|
36731
36836
|
if (!provider.renameFile) {
|
|
36732
36837
|
return {
|
|
36733
36838
|
type: "Error" /* Error */,
|
|
@@ -36737,7 +36842,7 @@ var handler10 = async (provider, args) => {
|
|
|
36737
36842
|
}
|
|
36738
36843
|
};
|
|
36739
36844
|
}
|
|
36740
|
-
const { source_path, target_path } =
|
|
36845
|
+
const { source_path, target_path } = toolInfo12.parameters.parse(args);
|
|
36741
36846
|
await provider.renameFile(source_path, target_path);
|
|
36742
36847
|
return {
|
|
36743
36848
|
type: "Reply" /* Reply */,
|
|
@@ -36748,12 +36853,12 @@ var handler10 = async (provider, args) => {
|
|
|
36748
36853
|
};
|
|
36749
36854
|
};
|
|
36750
36855
|
var renameFile_default = {
|
|
36751
|
-
...
|
|
36752
|
-
handler:
|
|
36856
|
+
...toolInfo12,
|
|
36857
|
+
handler: handler12
|
|
36753
36858
|
};
|
|
36754
36859
|
// ../core/src/tools/utils/replaceInFile.ts
|
|
36755
36860
|
var replaceInFile = (fileContent, diff) => {
|
|
36756
|
-
const blockPattern =
|
|
36861
|
+
const blockPattern = /^\s*<<<<<+\s*SEARCH>?\s*\r?\n([\s\S]*?)\r?\n=======[ \t]*\r?\n([\s\S]*?)\r?\n?>>>>>+\s*REPLACE\s*$/gm;
|
|
36757
36862
|
const blocks = [];
|
|
36758
36863
|
for (let match = blockPattern.exec(diff);match !== null; match = blockPattern.exec(diff)) {
|
|
36759
36864
|
blocks.push({ search: match[1], replace: match[2] });
|
|
@@ -36826,7 +36931,7 @@ var replaceInFile = (fileContent, diff) => {
|
|
|
36826
36931
|
};
|
|
36827
36932
|
|
|
36828
36933
|
// ../core/src/tools/replaceInFile.ts
|
|
36829
|
-
var
|
|
36934
|
+
var toolInfo13 = {
|
|
36830
36935
|
name: "replaceInFile",
|
|
36831
36936
|
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.",
|
|
36832
36937
|
parameters: exports_external.object({
|
|
@@ -36936,7 +37041,7 @@ function oldFeature() {
|
|
|
36936
37041
|
]
|
|
36937
37042
|
})
|
|
36938
37043
|
};
|
|
36939
|
-
var
|
|
37044
|
+
var handler13 = async (provider, args) => {
|
|
36940
37045
|
if (!provider.readFile || !provider.writeFile) {
|
|
36941
37046
|
return {
|
|
36942
37047
|
type: "Error" /* Error */,
|
|
@@ -36946,7 +37051,7 @@ var handler11 = async (provider, args) => {
|
|
|
36946
37051
|
}
|
|
36947
37052
|
};
|
|
36948
37053
|
}
|
|
36949
|
-
const parsed =
|
|
37054
|
+
const parsed = toolInfo13.parameters.safeParse(args);
|
|
36950
37055
|
if (!parsed.success) {
|
|
36951
37056
|
return {
|
|
36952
37057
|
type: "Error" /* Error */,
|
|
@@ -37010,11 +37115,11 @@ var handler11 = async (provider, args) => {
|
|
|
37010
37115
|
}
|
|
37011
37116
|
};
|
|
37012
37117
|
var replaceInFile_default = {
|
|
37013
|
-
...
|
|
37014
|
-
handler:
|
|
37118
|
+
...toolInfo13,
|
|
37119
|
+
handler: handler13
|
|
37015
37120
|
};
|
|
37016
37121
|
// ../core/src/tools/searchFiles.ts
|
|
37017
|
-
var
|
|
37122
|
+
var toolInfo14 = {
|
|
37018
37123
|
name: "searchFiles",
|
|
37019
37124
|
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.",
|
|
37020
37125
|
parameters: exports_external.object({
|
|
@@ -37038,7 +37143,7 @@ var toolInfo12 = {
|
|
|
37038
37143
|
]
|
|
37039
37144
|
})
|
|
37040
37145
|
};
|
|
37041
|
-
var
|
|
37146
|
+
var handler14 = async (provider, args) => {
|
|
37042
37147
|
if (!provider.searchFiles) {
|
|
37043
37148
|
return {
|
|
37044
37149
|
type: "Error" /* Error */,
|
|
@@ -37048,7 +37153,7 @@ var handler12 = async (provider, args) => {
|
|
|
37048
37153
|
}
|
|
37049
37154
|
};
|
|
37050
37155
|
}
|
|
37051
|
-
const parsed =
|
|
37156
|
+
const parsed = toolInfo14.parameters.safeParse(args);
|
|
37052
37157
|
if (!parsed.success) {
|
|
37053
37158
|
return {
|
|
37054
37159
|
type: "Error" /* Error */,
|
|
@@ -37086,13 +37191,13 @@ ${files.join(`
|
|
|
37086
37191
|
}
|
|
37087
37192
|
};
|
|
37088
37193
|
var searchFiles_default = {
|
|
37089
|
-
...
|
|
37090
|
-
handler:
|
|
37194
|
+
...toolInfo14,
|
|
37195
|
+
handler: handler14
|
|
37091
37196
|
};
|
|
37092
37197
|
// ../core/src/tools/updateMemory.ts
|
|
37093
|
-
var
|
|
37198
|
+
var toolInfo15 = {
|
|
37094
37199
|
name: "updateMemory",
|
|
37095
|
-
description:
|
|
37200
|
+
description: 'Appends, replaces, or removes content from a memory topic. Use "append" to add to existing content, "replace" to overwrite entirely, or "remove" to delete a topic. Memory persists across tool calls within a workflow.',
|
|
37096
37201
|
parameters: exports_external.object({
|
|
37097
37202
|
operation: exports_external.enum(["append", "replace", "remove"]).describe("The operation to perform."),
|
|
37098
37203
|
topic: exports_external.string().nullish().describe('The topic to update in memory. Defaults to ":default:".'),
|
|
@@ -37117,7 +37222,7 @@ var toolInfo13 = {
|
|
|
37117
37222
|
}
|
|
37118
37223
|
})
|
|
37119
37224
|
};
|
|
37120
|
-
var
|
|
37225
|
+
var handler15 = async (provider, args) => {
|
|
37121
37226
|
if (!provider.updateMemory) {
|
|
37122
37227
|
return {
|
|
37123
37228
|
type: "Error" /* Error */,
|
|
@@ -37127,7 +37232,7 @@ var handler13 = async (provider, args) => {
|
|
|
37127
37232
|
}
|
|
37128
37233
|
};
|
|
37129
37234
|
}
|
|
37130
|
-
const params =
|
|
37235
|
+
const params = toolInfo15.parameters.parse(args);
|
|
37131
37236
|
await provider.updateMemory(params.operation, params.topic ?? undefined, "content" in params ? params.content : undefined);
|
|
37132
37237
|
switch (params.operation) {
|
|
37133
37238
|
case "append":
|
|
@@ -37157,11 +37262,41 @@ var handler13 = async (provider, args) => {
|
|
|
37157
37262
|
}
|
|
37158
37263
|
};
|
|
37159
37264
|
var updateMemory_default = {
|
|
37160
|
-
...
|
|
37161
|
-
handler:
|
|
37265
|
+
...toolInfo15,
|
|
37266
|
+
handler: handler15
|
|
37267
|
+
};
|
|
37268
|
+
// ../core/src/tools/updateTodoItem.ts
|
|
37269
|
+
var toolInfo16 = {
|
|
37270
|
+
name: "updateTodoItem",
|
|
37271
|
+
description: "Add or update a to-do item.",
|
|
37272
|
+
parameters: UpdateTodoItemInputSchema
|
|
37273
|
+
};
|
|
37274
|
+
var handler16 = async (provider, args) => {
|
|
37275
|
+
if (!provider.updateTodoItem) {
|
|
37276
|
+
return {
|
|
37277
|
+
type: "Error" /* Error */,
|
|
37278
|
+
message: {
|
|
37279
|
+
type: "error-text",
|
|
37280
|
+
value: "Not possible to update a to-do item."
|
|
37281
|
+
}
|
|
37282
|
+
};
|
|
37283
|
+
}
|
|
37284
|
+
const input = toolInfo16.parameters.parse(args);
|
|
37285
|
+
const result = await provider.updateTodoItem(input);
|
|
37286
|
+
return {
|
|
37287
|
+
type: "Reply" /* Reply */,
|
|
37288
|
+
message: {
|
|
37289
|
+
type: "json",
|
|
37290
|
+
value: result
|
|
37291
|
+
}
|
|
37292
|
+
};
|
|
37293
|
+
};
|
|
37294
|
+
var updateTodoItem_default = {
|
|
37295
|
+
...toolInfo16,
|
|
37296
|
+
handler: handler16
|
|
37162
37297
|
};
|
|
37163
37298
|
// ../core/src/tools/writeToFile.ts
|
|
37164
|
-
var
|
|
37299
|
+
var toolInfo17 = {
|
|
37165
37300
|
name: "writeToFile",
|
|
37166
37301
|
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 `<`, `>`, or `&`. Also ensure there is no unwanted CDATA tags in the content.",
|
|
37167
37302
|
parameters: exports_external.object({
|
|
@@ -37190,7 +37325,7 @@ export default App;
|
|
|
37190
37325
|
]
|
|
37191
37326
|
})
|
|
37192
37327
|
};
|
|
37193
|
-
var
|
|
37328
|
+
var handler17 = async (provider, args) => {
|
|
37194
37329
|
if (!provider.writeFile) {
|
|
37195
37330
|
return {
|
|
37196
37331
|
type: "Error" /* Error */,
|
|
@@ -37200,7 +37335,7 @@ var handler14 = async (provider, args) => {
|
|
|
37200
37335
|
}
|
|
37201
37336
|
};
|
|
37202
37337
|
}
|
|
37203
|
-
const parsed =
|
|
37338
|
+
const parsed = toolInfo17.parameters.safeParse(args);
|
|
37204
37339
|
if (!parsed.success) {
|
|
37205
37340
|
return {
|
|
37206
37341
|
type: "Error" /* Error */,
|
|
@@ -37224,8 +37359,8 @@ var handler14 = async (provider, args) => {
|
|
|
37224
37359
|
};
|
|
37225
37360
|
};
|
|
37226
37361
|
var writeToFile_default = {
|
|
37227
|
-
...
|
|
37228
|
-
handler:
|
|
37362
|
+
...toolInfo17,
|
|
37363
|
+
handler: handler17
|
|
37229
37364
|
};
|
|
37230
37365
|
// ../core/src/UsageMeter.ts
|
|
37231
37366
|
class UsageMeter {
|
|
@@ -39101,15 +39236,15 @@ function useKeypress(userHandler) {
|
|
|
39101
39236
|
signal.current = userHandler;
|
|
39102
39237
|
useEffect((rl) => {
|
|
39103
39238
|
let ignore = false;
|
|
39104
|
-
const
|
|
39239
|
+
const handler18 = withUpdates((_input, event) => {
|
|
39105
39240
|
if (ignore)
|
|
39106
39241
|
return;
|
|
39107
39242
|
signal.current(event, rl);
|
|
39108
39243
|
});
|
|
39109
|
-
rl.input.on("keypress",
|
|
39244
|
+
rl.input.on("keypress", handler18);
|
|
39110
39245
|
return () => {
|
|
39111
39246
|
ignore = true;
|
|
39112
|
-
rl.input.removeListener("keypress",
|
|
39247
|
+
rl.input.removeListener("keypress", handler18);
|
|
39113
39248
|
};
|
|
39114
39249
|
}, []);
|
|
39115
39250
|
}
|
|
@@ -39268,16 +39403,16 @@ class Emitter {
|
|
|
39268
39403
|
|
|
39269
39404
|
class SignalExitBase {
|
|
39270
39405
|
}
|
|
39271
|
-
var signalExitWrap = (
|
|
39406
|
+
var signalExitWrap = (handler18) => {
|
|
39272
39407
|
return {
|
|
39273
39408
|
onExit(cb, opts) {
|
|
39274
|
-
return
|
|
39409
|
+
return handler18.onExit(cb, opts);
|
|
39275
39410
|
},
|
|
39276
39411
|
load() {
|
|
39277
|
-
return
|
|
39412
|
+
return handler18.load();
|
|
39278
39413
|
},
|
|
39279
39414
|
unload() {
|
|
39280
|
-
return
|
|
39415
|
+
return handler18.unload();
|
|
39281
39416
|
}
|
|
39282
39417
|
};
|
|
39283
39418
|
};
|
|
@@ -40078,8 +40213,96 @@ async function searchFiles(path, regex, filePattern, cwd, excludeFiles) {
|
|
|
40078
40213
|
var getProvider = (options = {}) => {
|
|
40079
40214
|
const ig = import_ignore2.default().add(options.excludeFiles ?? []);
|
|
40080
40215
|
const memoryStore = {};
|
|
40216
|
+
const todoItems = [];
|
|
40081
40217
|
const defaultMemoryTopic = ":default:";
|
|
40082
40218
|
const provider2 = {
|
|
40219
|
+
listTodoItems: async (id, status) => {
|
|
40220
|
+
let items;
|
|
40221
|
+
if (!id) {
|
|
40222
|
+
items = todoItems.filter((i) => !i.id.includes("."));
|
|
40223
|
+
} else {
|
|
40224
|
+
const parent = todoItems.find((i) => i.id === id);
|
|
40225
|
+
if (!parent) {
|
|
40226
|
+
throw new Error(`To-do item with id ${id} not found`);
|
|
40227
|
+
}
|
|
40228
|
+
items = todoItems.filter((i) => i.id.startsWith(`${id}.`) && i.id.split(".").length === id.split(".").length + 1);
|
|
40229
|
+
}
|
|
40230
|
+
if (status) {
|
|
40231
|
+
items = items.filter((item) => item.status === status);
|
|
40232
|
+
}
|
|
40233
|
+
items.sort((a, b) => {
|
|
40234
|
+
const aParts = a.id.split(".");
|
|
40235
|
+
const bParts = b.id.split(".");
|
|
40236
|
+
const len = Math.min(aParts.length, bParts.length);
|
|
40237
|
+
for (let i = 0;i < len; i++) {
|
|
40238
|
+
const comparison = aParts[i].localeCompare(bParts[i], undefined, { numeric: true });
|
|
40239
|
+
if (comparison !== 0) {
|
|
40240
|
+
return comparison;
|
|
40241
|
+
}
|
|
40242
|
+
}
|
|
40243
|
+
return aParts.length - bParts.length;
|
|
40244
|
+
});
|
|
40245
|
+
return items;
|
|
40246
|
+
},
|
|
40247
|
+
getTodoItem: async (id) => {
|
|
40248
|
+
const item = todoItems.find((i) => i.id === id);
|
|
40249
|
+
if (!item) {
|
|
40250
|
+
throw new Error(`To-do item with id ${id} not found`);
|
|
40251
|
+
}
|
|
40252
|
+
const subItems = todoItems.filter((i) => i.id.startsWith(`${id}.`) && i.id.split(".").length === id.split(".").length + 1).map(({ id: id2, title }) => ({ id: id2, title }));
|
|
40253
|
+
return { ...item, subItems };
|
|
40254
|
+
},
|
|
40255
|
+
updateTodoItem: async (input) => {
|
|
40256
|
+
if (input.operation === "add") {
|
|
40257
|
+
const { parentId, title, description, relevantFileList } = input;
|
|
40258
|
+
if (!title) {
|
|
40259
|
+
throw new Error("Title is required for add operation");
|
|
40260
|
+
}
|
|
40261
|
+
let newId;
|
|
40262
|
+
if (parentId) {
|
|
40263
|
+
const parent = todoItems.find((i) => i.id === parentId);
|
|
40264
|
+
if (!parent) {
|
|
40265
|
+
throw new Error(`Parent to-do item with id ${parentId} not found`);
|
|
40266
|
+
}
|
|
40267
|
+
const childItems = todoItems.filter((i) => i.id.startsWith(`${parentId}.`) && i.id.split(".").length === parentId.split(".").length + 1);
|
|
40268
|
+
newId = `${parentId}.${childItems.length + 1}`;
|
|
40269
|
+
} else {
|
|
40270
|
+
const rootItems = todoItems.filter((i) => !i.id.includes("."));
|
|
40271
|
+
newId = `${rootItems.length + 1}`;
|
|
40272
|
+
}
|
|
40273
|
+
const newItem = {
|
|
40274
|
+
id: newId,
|
|
40275
|
+
title,
|
|
40276
|
+
description: description ?? "",
|
|
40277
|
+
relevantFileList: relevantFileList ?? [],
|
|
40278
|
+
status: "open"
|
|
40279
|
+
};
|
|
40280
|
+
todoItems.push(newItem);
|
|
40281
|
+
return { id: newId };
|
|
40282
|
+
} else {
|
|
40283
|
+
const { id } = input;
|
|
40284
|
+
if (!id) {
|
|
40285
|
+
throw new Error("ID is required for update operation");
|
|
40286
|
+
}
|
|
40287
|
+
const item = todoItems.find((i) => i.id === id);
|
|
40288
|
+
if (!item) {
|
|
40289
|
+
throw new Error(`To-do item with id ${id} not found`);
|
|
40290
|
+
}
|
|
40291
|
+
if (input.title != null) {
|
|
40292
|
+
item.title = input.title;
|
|
40293
|
+
}
|
|
40294
|
+
if (input.description != null) {
|
|
40295
|
+
item.description = input.description ?? "";
|
|
40296
|
+
}
|
|
40297
|
+
if (input.relevantFileList != null) {
|
|
40298
|
+
item.relevantFileList = input.relevantFileList;
|
|
40299
|
+
}
|
|
40300
|
+
if (input.status != null) {
|
|
40301
|
+
item.status = input.status;
|
|
40302
|
+
}
|
|
40303
|
+
return { id };
|
|
40304
|
+
}
|
|
40305
|
+
},
|
|
40083
40306
|
listMemoryTopics: async () => {
|
|
40084
40307
|
return Object.keys(memoryStore);
|
|
40085
40308
|
},
|