@polka-codes/runner 0.9.48 → 0.9.50
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 +328 -84
- 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.50";
|
|
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,89 @@ ${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
|
+
status: TodoStatus
|
|
36539
|
+
});
|
|
36540
|
+
var UpdateTodoItemInputSchema = exports_external.object({
|
|
36541
|
+
operation: exports_external.enum(["add", "update"]),
|
|
36542
|
+
id: exports_external.string().nullish(),
|
|
36543
|
+
parentId: exports_external.string().nullish(),
|
|
36544
|
+
title: exports_external.string().nullish(),
|
|
36545
|
+
description: exports_external.string().nullish(),
|
|
36546
|
+
status: TodoStatus.nullish()
|
|
36547
|
+
}).superRefine((data, ctx) => {
|
|
36548
|
+
if (data.operation === "add") {
|
|
36549
|
+
if (!data.title) {
|
|
36550
|
+
ctx.addIssue({
|
|
36551
|
+
code: "custom",
|
|
36552
|
+
message: 'Title is required for "add" operation',
|
|
36553
|
+
path: ["title"]
|
|
36554
|
+
});
|
|
36555
|
+
}
|
|
36556
|
+
} else if (data.operation === "update") {
|
|
36557
|
+
if (!data.id) {
|
|
36558
|
+
ctx.addIssue({
|
|
36559
|
+
code: "custom",
|
|
36560
|
+
message: 'ID is required for "update" operation',
|
|
36561
|
+
path: ["id"]
|
|
36562
|
+
});
|
|
36563
|
+
}
|
|
36564
|
+
}
|
|
36565
|
+
});
|
|
36566
|
+
var UpdateTodoItemOutputSchema = exports_external.object({
|
|
36567
|
+
id: exports_external.string()
|
|
36568
|
+
});
|
|
36569
|
+
|
|
36570
|
+
// ../core/src/tools/listTodoItems.ts
|
|
36571
|
+
var toolInfo7 = {
|
|
36572
|
+
name: "listTodoItems",
|
|
36573
|
+
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.",
|
|
36574
|
+
parameters: exports_external.object({
|
|
36575
|
+
id: exports_external.string().nullish(),
|
|
36576
|
+
status: TodoStatus.nullish()
|
|
36577
|
+
})
|
|
36578
|
+
};
|
|
36579
|
+
var handler7 = async (provider, args) => {
|
|
36580
|
+
if (!provider.listTodoItems) {
|
|
36581
|
+
return {
|
|
36582
|
+
type: "Error" /* Error */,
|
|
36583
|
+
message: {
|
|
36584
|
+
type: "error-text",
|
|
36585
|
+
value: "Not possible to list to-do items."
|
|
36586
|
+
}
|
|
36587
|
+
};
|
|
36588
|
+
}
|
|
36589
|
+
const { id, status } = toolInfo7.parameters.parse(args);
|
|
36590
|
+
const items = await provider.listTodoItems(id, status);
|
|
36591
|
+
return {
|
|
36592
|
+
type: "Reply" /* Reply */,
|
|
36593
|
+
message: {
|
|
36594
|
+
type: "json",
|
|
36595
|
+
value: items
|
|
36596
|
+
}
|
|
36597
|
+
};
|
|
36598
|
+
};
|
|
36599
|
+
var listTodoItems_default = {
|
|
36600
|
+
...toolInfo7,
|
|
36601
|
+
handler: handler7
|
|
36499
36602
|
};
|
|
36500
36603
|
// ../core/src/tools/readBinaryFile.ts
|
|
36501
|
-
var
|
|
36604
|
+
var toolInfo8 = {
|
|
36502
36605
|
name: "readBinaryFile",
|
|
36503
36606
|
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
36607
|
parameters: exports_external.object({
|
|
36505
36608
|
url: exports_external.string().describe("The URL or local path of the file to read.")
|
|
36506
36609
|
})
|
|
36507
36610
|
};
|
|
36508
|
-
var
|
|
36611
|
+
var handler8 = async (provider, args) => {
|
|
36509
36612
|
if (!provider.readBinaryFile) {
|
|
36510
36613
|
return {
|
|
36511
36614
|
type: "Error" /* Error */,
|
|
@@ -36515,7 +36618,7 @@ var handler6 = async (provider, args) => {
|
|
|
36515
36618
|
}
|
|
36516
36619
|
};
|
|
36517
36620
|
}
|
|
36518
|
-
const { url: url2 } =
|
|
36621
|
+
const { url: url2 } = toolInfo8.parameters.parse(args);
|
|
36519
36622
|
try {
|
|
36520
36623
|
const filePart = await provider.readBinaryFile(url2);
|
|
36521
36624
|
return {
|
|
@@ -36544,11 +36647,11 @@ var handler6 = async (provider, args) => {
|
|
|
36544
36647
|
}
|
|
36545
36648
|
};
|
|
36546
36649
|
var readBinaryFile_default = {
|
|
36547
|
-
...
|
|
36548
|
-
handler:
|
|
36650
|
+
...toolInfo8,
|
|
36651
|
+
handler: handler8
|
|
36549
36652
|
};
|
|
36550
36653
|
// ../core/src/tools/readFile.ts
|
|
36551
|
-
var
|
|
36654
|
+
var toolInfo9 = {
|
|
36552
36655
|
name: "readFile",
|
|
36553
36656
|
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
36657
|
parameters: exports_external.object({
|
|
@@ -36585,7 +36688,7 @@ var toolInfo7 = {
|
|
|
36585
36688
|
]
|
|
36586
36689
|
})
|
|
36587
36690
|
};
|
|
36588
|
-
var
|
|
36691
|
+
var handler9 = async (provider, args) => {
|
|
36589
36692
|
if (!provider.readFile) {
|
|
36590
36693
|
return {
|
|
36591
36694
|
type: "Error" /* Error */,
|
|
@@ -36595,7 +36698,7 @@ var handler7 = async (provider, args) => {
|
|
|
36595
36698
|
}
|
|
36596
36699
|
};
|
|
36597
36700
|
}
|
|
36598
|
-
const { path: paths, includeIgnored } =
|
|
36701
|
+
const { path: paths, includeIgnored } = toolInfo9.parameters.parse(args);
|
|
36599
36702
|
const resp = [];
|
|
36600
36703
|
for (const path of paths) {
|
|
36601
36704
|
const fileContent = await provider.readFile(path, includeIgnored);
|
|
@@ -36620,19 +36723,19 @@ var handler7 = async (provider, args) => {
|
|
|
36620
36723
|
};
|
|
36621
36724
|
};
|
|
36622
36725
|
var readFile_default = {
|
|
36623
|
-
...
|
|
36624
|
-
handler:
|
|
36726
|
+
...toolInfo9,
|
|
36727
|
+
handler: handler9
|
|
36625
36728
|
};
|
|
36626
36729
|
// ../core/src/tools/readMemory.ts
|
|
36627
|
-
var
|
|
36730
|
+
var toolInfo10 = {
|
|
36628
36731
|
name: "readMemory",
|
|
36629
|
-
description: "Reads content from a memory topic.",
|
|
36732
|
+
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
36733
|
parameters: exports_external.object({
|
|
36631
36734
|
topic: exports_external.string().optional().describe('The topic to read from memory. Defaults to ":default:".')
|
|
36632
36735
|
})
|
|
36633
36736
|
};
|
|
36634
|
-
var
|
|
36635
|
-
const { topic } =
|
|
36737
|
+
var handler10 = async (provider, args) => {
|
|
36738
|
+
const { topic } = toolInfo10.parameters.parse(args);
|
|
36636
36739
|
const content = await provider.readMemory(topic);
|
|
36637
36740
|
if (content) {
|
|
36638
36741
|
return {
|
|
@@ -36654,11 +36757,11 @@ ${content}
|
|
|
36654
36757
|
};
|
|
36655
36758
|
};
|
|
36656
36759
|
var readMemory_default = {
|
|
36657
|
-
...
|
|
36658
|
-
handler:
|
|
36760
|
+
...toolInfo10,
|
|
36761
|
+
handler: handler10
|
|
36659
36762
|
};
|
|
36660
36763
|
// ../core/src/tools/removeFile.ts
|
|
36661
|
-
var
|
|
36764
|
+
var toolInfo11 = {
|
|
36662
36765
|
name: "removeFile",
|
|
36663
36766
|
description: "Request to remove a file at the specified path.",
|
|
36664
36767
|
parameters: exports_external.object({
|
|
@@ -36674,7 +36777,7 @@ var toolInfo9 = {
|
|
|
36674
36777
|
]
|
|
36675
36778
|
})
|
|
36676
36779
|
};
|
|
36677
|
-
var
|
|
36780
|
+
var handler11 = async (provider, args) => {
|
|
36678
36781
|
if (!provider.removeFile) {
|
|
36679
36782
|
return {
|
|
36680
36783
|
type: "Error" /* Error */,
|
|
@@ -36684,7 +36787,7 @@ var handler9 = async (provider, args) => {
|
|
|
36684
36787
|
}
|
|
36685
36788
|
};
|
|
36686
36789
|
}
|
|
36687
|
-
const parsed =
|
|
36790
|
+
const parsed = toolInfo11.parameters.safeParse(args);
|
|
36688
36791
|
if (!parsed.success) {
|
|
36689
36792
|
return {
|
|
36690
36793
|
type: "Error" /* Error */,
|
|
@@ -36705,11 +36808,11 @@ var handler9 = async (provider, args) => {
|
|
|
36705
36808
|
};
|
|
36706
36809
|
};
|
|
36707
36810
|
var removeFile_default = {
|
|
36708
|
-
...
|
|
36709
|
-
handler:
|
|
36811
|
+
...toolInfo11,
|
|
36812
|
+
handler: handler11
|
|
36710
36813
|
};
|
|
36711
36814
|
// ../core/src/tools/renameFile.ts
|
|
36712
|
-
var
|
|
36815
|
+
var toolInfo12 = {
|
|
36713
36816
|
name: "renameFile",
|
|
36714
36817
|
description: "Request to rename a file from source path to target path.",
|
|
36715
36818
|
parameters: exports_external.object({
|
|
@@ -36727,7 +36830,7 @@ var toolInfo10 = {
|
|
|
36727
36830
|
]
|
|
36728
36831
|
})
|
|
36729
36832
|
};
|
|
36730
|
-
var
|
|
36833
|
+
var handler12 = async (provider, args) => {
|
|
36731
36834
|
if (!provider.renameFile) {
|
|
36732
36835
|
return {
|
|
36733
36836
|
type: "Error" /* Error */,
|
|
@@ -36737,7 +36840,7 @@ var handler10 = async (provider, args) => {
|
|
|
36737
36840
|
}
|
|
36738
36841
|
};
|
|
36739
36842
|
}
|
|
36740
|
-
const { source_path, target_path } =
|
|
36843
|
+
const { source_path, target_path } = toolInfo12.parameters.parse(args);
|
|
36741
36844
|
await provider.renameFile(source_path, target_path);
|
|
36742
36845
|
return {
|
|
36743
36846
|
type: "Reply" /* Reply */,
|
|
@@ -36748,12 +36851,12 @@ var handler10 = async (provider, args) => {
|
|
|
36748
36851
|
};
|
|
36749
36852
|
};
|
|
36750
36853
|
var renameFile_default = {
|
|
36751
|
-
...
|
|
36752
|
-
handler:
|
|
36854
|
+
...toolInfo12,
|
|
36855
|
+
handler: handler12
|
|
36753
36856
|
};
|
|
36754
36857
|
// ../core/src/tools/utils/replaceInFile.ts
|
|
36755
36858
|
var replaceInFile = (fileContent, diff) => {
|
|
36756
|
-
const blockPattern =
|
|
36859
|
+
const blockPattern = /^\s*<<<<<+\s*SEARCH>?\s*\r?\n([\s\S]*?)\r?\n=======[ \t]*\r?\n([\s\S]*?)\r?\n?>>>>>+\s*REPLACE\s*$/gm;
|
|
36757
36860
|
const blocks = [];
|
|
36758
36861
|
for (let match = blockPattern.exec(diff);match !== null; match = blockPattern.exec(diff)) {
|
|
36759
36862
|
blocks.push({ search: match[1], replace: match[2] });
|
|
@@ -36826,7 +36929,7 @@ var replaceInFile = (fileContent, diff) => {
|
|
|
36826
36929
|
};
|
|
36827
36930
|
|
|
36828
36931
|
// ../core/src/tools/replaceInFile.ts
|
|
36829
|
-
var
|
|
36932
|
+
var toolInfo13 = {
|
|
36830
36933
|
name: "replaceInFile",
|
|
36831
36934
|
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
36935
|
parameters: exports_external.object({
|
|
@@ -36936,7 +37039,7 @@ function oldFeature() {
|
|
|
36936
37039
|
]
|
|
36937
37040
|
})
|
|
36938
37041
|
};
|
|
36939
|
-
var
|
|
37042
|
+
var handler13 = async (provider, args) => {
|
|
36940
37043
|
if (!provider.readFile || !provider.writeFile) {
|
|
36941
37044
|
return {
|
|
36942
37045
|
type: "Error" /* Error */,
|
|
@@ -36946,7 +37049,7 @@ var handler11 = async (provider, args) => {
|
|
|
36946
37049
|
}
|
|
36947
37050
|
};
|
|
36948
37051
|
}
|
|
36949
|
-
const parsed =
|
|
37052
|
+
const parsed = toolInfo13.parameters.safeParse(args);
|
|
36950
37053
|
if (!parsed.success) {
|
|
36951
37054
|
return {
|
|
36952
37055
|
type: "Error" /* Error */,
|
|
@@ -37010,11 +37113,11 @@ var handler11 = async (provider, args) => {
|
|
|
37010
37113
|
}
|
|
37011
37114
|
};
|
|
37012
37115
|
var replaceInFile_default = {
|
|
37013
|
-
...
|
|
37014
|
-
handler:
|
|
37116
|
+
...toolInfo13,
|
|
37117
|
+
handler: handler13
|
|
37015
37118
|
};
|
|
37016
37119
|
// ../core/src/tools/searchFiles.ts
|
|
37017
|
-
var
|
|
37120
|
+
var toolInfo14 = {
|
|
37018
37121
|
name: "searchFiles",
|
|
37019
37122
|
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
37123
|
parameters: exports_external.object({
|
|
@@ -37038,7 +37141,7 @@ var toolInfo12 = {
|
|
|
37038
37141
|
]
|
|
37039
37142
|
})
|
|
37040
37143
|
};
|
|
37041
|
-
var
|
|
37144
|
+
var handler14 = async (provider, args) => {
|
|
37042
37145
|
if (!provider.searchFiles) {
|
|
37043
37146
|
return {
|
|
37044
37147
|
type: "Error" /* Error */,
|
|
@@ -37048,7 +37151,7 @@ var handler12 = async (provider, args) => {
|
|
|
37048
37151
|
}
|
|
37049
37152
|
};
|
|
37050
37153
|
}
|
|
37051
|
-
const parsed =
|
|
37154
|
+
const parsed = toolInfo14.parameters.safeParse(args);
|
|
37052
37155
|
if (!parsed.success) {
|
|
37053
37156
|
return {
|
|
37054
37157
|
type: "Error" /* Error */,
|
|
@@ -37086,13 +37189,13 @@ ${files.join(`
|
|
|
37086
37189
|
}
|
|
37087
37190
|
};
|
|
37088
37191
|
var searchFiles_default = {
|
|
37089
|
-
...
|
|
37090
|
-
handler:
|
|
37192
|
+
...toolInfo14,
|
|
37193
|
+
handler: handler14
|
|
37091
37194
|
};
|
|
37092
37195
|
// ../core/src/tools/updateMemory.ts
|
|
37093
|
-
var
|
|
37196
|
+
var toolInfo15 = {
|
|
37094
37197
|
name: "updateMemory",
|
|
37095
|
-
description:
|
|
37198
|
+
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
37199
|
parameters: exports_external.object({
|
|
37097
37200
|
operation: exports_external.enum(["append", "replace", "remove"]).describe("The operation to perform."),
|
|
37098
37201
|
topic: exports_external.string().nullish().describe('The topic to update in memory. Defaults to ":default:".'),
|
|
@@ -37117,7 +37220,7 @@ var toolInfo13 = {
|
|
|
37117
37220
|
}
|
|
37118
37221
|
})
|
|
37119
37222
|
};
|
|
37120
|
-
var
|
|
37223
|
+
var handler15 = async (provider, args) => {
|
|
37121
37224
|
if (!provider.updateMemory) {
|
|
37122
37225
|
return {
|
|
37123
37226
|
type: "Error" /* Error */,
|
|
@@ -37127,7 +37230,7 @@ var handler13 = async (provider, args) => {
|
|
|
37127
37230
|
}
|
|
37128
37231
|
};
|
|
37129
37232
|
}
|
|
37130
|
-
const params =
|
|
37233
|
+
const params = toolInfo15.parameters.parse(args);
|
|
37131
37234
|
await provider.updateMemory(params.operation, params.topic ?? undefined, "content" in params ? params.content : undefined);
|
|
37132
37235
|
switch (params.operation) {
|
|
37133
37236
|
case "append":
|
|
@@ -37157,11 +37260,41 @@ var handler13 = async (provider, args) => {
|
|
|
37157
37260
|
}
|
|
37158
37261
|
};
|
|
37159
37262
|
var updateMemory_default = {
|
|
37160
|
-
...
|
|
37161
|
-
handler:
|
|
37263
|
+
...toolInfo15,
|
|
37264
|
+
handler: handler15
|
|
37265
|
+
};
|
|
37266
|
+
// ../core/src/tools/updateTodoItem.ts
|
|
37267
|
+
var toolInfo16 = {
|
|
37268
|
+
name: "updateTodoItem",
|
|
37269
|
+
description: "Add or update a to-do item.",
|
|
37270
|
+
parameters: UpdateTodoItemInputSchema
|
|
37271
|
+
};
|
|
37272
|
+
var handler16 = async (provider, args) => {
|
|
37273
|
+
if (!provider.updateTodoItem) {
|
|
37274
|
+
return {
|
|
37275
|
+
type: "Error" /* Error */,
|
|
37276
|
+
message: {
|
|
37277
|
+
type: "error-text",
|
|
37278
|
+
value: "Not possible to update a to-do item."
|
|
37279
|
+
}
|
|
37280
|
+
};
|
|
37281
|
+
}
|
|
37282
|
+
const input = toolInfo16.parameters.parse(args);
|
|
37283
|
+
const result = await provider.updateTodoItem(input);
|
|
37284
|
+
return {
|
|
37285
|
+
type: "Reply" /* Reply */,
|
|
37286
|
+
message: {
|
|
37287
|
+
type: "json",
|
|
37288
|
+
value: result
|
|
37289
|
+
}
|
|
37290
|
+
};
|
|
37291
|
+
};
|
|
37292
|
+
var updateTodoItem_default = {
|
|
37293
|
+
...toolInfo16,
|
|
37294
|
+
handler: handler16
|
|
37162
37295
|
};
|
|
37163
37296
|
// ../core/src/tools/writeToFile.ts
|
|
37164
|
-
var
|
|
37297
|
+
var toolInfo17 = {
|
|
37165
37298
|
name: "writeToFile",
|
|
37166
37299
|
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
37300
|
parameters: exports_external.object({
|
|
@@ -37190,7 +37323,7 @@ export default App;
|
|
|
37190
37323
|
]
|
|
37191
37324
|
})
|
|
37192
37325
|
};
|
|
37193
|
-
var
|
|
37326
|
+
var handler17 = async (provider, args) => {
|
|
37194
37327
|
if (!provider.writeFile) {
|
|
37195
37328
|
return {
|
|
37196
37329
|
type: "Error" /* Error */,
|
|
@@ -37200,7 +37333,7 @@ var handler14 = async (provider, args) => {
|
|
|
37200
37333
|
}
|
|
37201
37334
|
};
|
|
37202
37335
|
}
|
|
37203
|
-
const parsed =
|
|
37336
|
+
const parsed = toolInfo17.parameters.safeParse(args);
|
|
37204
37337
|
if (!parsed.success) {
|
|
37205
37338
|
return {
|
|
37206
37339
|
type: "Error" /* Error */,
|
|
@@ -37224,8 +37357,8 @@ var handler14 = async (provider, args) => {
|
|
|
37224
37357
|
};
|
|
37225
37358
|
};
|
|
37226
37359
|
var writeToFile_default = {
|
|
37227
|
-
...
|
|
37228
|
-
handler:
|
|
37360
|
+
...toolInfo17,
|
|
37361
|
+
handler: handler17
|
|
37229
37362
|
};
|
|
37230
37363
|
// ../core/src/UsageMeter.ts
|
|
37231
37364
|
class UsageMeter {
|
|
@@ -39101,15 +39234,15 @@ function useKeypress(userHandler) {
|
|
|
39101
39234
|
signal.current = userHandler;
|
|
39102
39235
|
useEffect((rl) => {
|
|
39103
39236
|
let ignore = false;
|
|
39104
|
-
const
|
|
39237
|
+
const handler18 = withUpdates((_input, event) => {
|
|
39105
39238
|
if (ignore)
|
|
39106
39239
|
return;
|
|
39107
39240
|
signal.current(event, rl);
|
|
39108
39241
|
});
|
|
39109
|
-
rl.input.on("keypress",
|
|
39242
|
+
rl.input.on("keypress", handler18);
|
|
39110
39243
|
return () => {
|
|
39111
39244
|
ignore = true;
|
|
39112
|
-
rl.input.removeListener("keypress",
|
|
39245
|
+
rl.input.removeListener("keypress", handler18);
|
|
39113
39246
|
};
|
|
39114
39247
|
}, []);
|
|
39115
39248
|
}
|
|
@@ -39268,16 +39401,16 @@ class Emitter {
|
|
|
39268
39401
|
|
|
39269
39402
|
class SignalExitBase {
|
|
39270
39403
|
}
|
|
39271
|
-
var signalExitWrap = (
|
|
39404
|
+
var signalExitWrap = (handler18) => {
|
|
39272
39405
|
return {
|
|
39273
39406
|
onExit(cb, opts) {
|
|
39274
|
-
return
|
|
39407
|
+
return handler18.onExit(cb, opts);
|
|
39275
39408
|
},
|
|
39276
39409
|
load() {
|
|
39277
|
-
return
|
|
39410
|
+
return handler18.load();
|
|
39278
39411
|
},
|
|
39279
39412
|
unload() {
|
|
39280
|
-
return
|
|
39413
|
+
return handler18.unload();
|
|
39281
39414
|
}
|
|
39282
39415
|
};
|
|
39283
39416
|
};
|
|
@@ -40075,36 +40208,147 @@ async function searchFiles(path, regex, filePattern, cwd, excludeFiles) {
|
|
|
40075
40208
|
}
|
|
40076
40209
|
|
|
40077
40210
|
// ../cli-shared/src/provider.ts
|
|
40211
|
+
class InMemoryStore {
|
|
40212
|
+
#data;
|
|
40213
|
+
async read() {
|
|
40214
|
+
return this.#data;
|
|
40215
|
+
}
|
|
40216
|
+
async write(data) {
|
|
40217
|
+
this.#data = data;
|
|
40218
|
+
}
|
|
40219
|
+
}
|
|
40078
40220
|
var getProvider = (options = {}) => {
|
|
40079
40221
|
const ig = import_ignore2.default().add(options.excludeFiles ?? []);
|
|
40080
|
-
const memoryStore =
|
|
40222
|
+
const memoryStore = options.memoryStore ?? new InMemoryStore;
|
|
40223
|
+
const todoItemStore = options.todoItemStore ?? new InMemoryStore;
|
|
40081
40224
|
const defaultMemoryTopic = ":default:";
|
|
40082
40225
|
const provider2 = {
|
|
40226
|
+
listTodoItems: async (id, status) => {
|
|
40227
|
+
const todoItems = await todoItemStore.read() ?? [];
|
|
40228
|
+
let items;
|
|
40229
|
+
if (!id) {
|
|
40230
|
+
items = todoItems.filter((i) => !i.id.includes("."));
|
|
40231
|
+
} else {
|
|
40232
|
+
const parent = todoItems.find((i) => i.id === id);
|
|
40233
|
+
if (!parent) {
|
|
40234
|
+
throw new Error(`To-do item with id ${id} not found`);
|
|
40235
|
+
}
|
|
40236
|
+
items = todoItems.filter((i) => i.id.startsWith(`${id}.`) && i.id.split(".").length === id.split(".").length + 1);
|
|
40237
|
+
}
|
|
40238
|
+
if (status) {
|
|
40239
|
+
items = items.filter((item) => item.status === status);
|
|
40240
|
+
}
|
|
40241
|
+
items.sort((a, b) => {
|
|
40242
|
+
const aParts = a.id.split(".");
|
|
40243
|
+
const bParts = b.id.split(".");
|
|
40244
|
+
const len = Math.min(aParts.length, bParts.length);
|
|
40245
|
+
for (let i = 0;i < len; i++) {
|
|
40246
|
+
const comparison = aParts[i].localeCompare(bParts[i], undefined, { numeric: true });
|
|
40247
|
+
if (comparison !== 0) {
|
|
40248
|
+
return comparison;
|
|
40249
|
+
}
|
|
40250
|
+
}
|
|
40251
|
+
return aParts.length - bParts.length;
|
|
40252
|
+
});
|
|
40253
|
+
return items;
|
|
40254
|
+
},
|
|
40255
|
+
getTodoItem: async (id) => {
|
|
40256
|
+
const todoItems = await todoItemStore.read() ?? [];
|
|
40257
|
+
const item = todoItems.find((i) => i.id === id);
|
|
40258
|
+
if (!item) {
|
|
40259
|
+
throw new Error(`To-do item with id ${id} not found`);
|
|
40260
|
+
}
|
|
40261
|
+
const subItems = todoItems.filter((i) => i.id.startsWith(`${id}.`) && i.id.split(".").length === id.split(".").length + 1).map(({ id: id2, title }) => ({ id: id2, title }));
|
|
40262
|
+
return { ...item, subItems };
|
|
40263
|
+
},
|
|
40264
|
+
updateTodoItem: async (input) => {
|
|
40265
|
+
const todoItems = await todoItemStore.read() ?? [];
|
|
40266
|
+
if (input.operation === "add") {
|
|
40267
|
+
const { parentId, title, description, status } = input;
|
|
40268
|
+
if (!title) {
|
|
40269
|
+
throw new Error("Title is required for add operation");
|
|
40270
|
+
}
|
|
40271
|
+
let newId;
|
|
40272
|
+
if (parentId) {
|
|
40273
|
+
const parent = todoItems.find((i) => i.id === parentId);
|
|
40274
|
+
if (!parent) {
|
|
40275
|
+
throw new Error(`Parent to-do item with id ${parentId} not found`);
|
|
40276
|
+
}
|
|
40277
|
+
const childItems = todoItems.filter((i) => i.id.startsWith(`${parentId}.`) && i.id.split(".").length === parentId.split(".").length + 1);
|
|
40278
|
+
const maxId = childItems.reduce((max, item) => {
|
|
40279
|
+
const parts = item.id.split(".");
|
|
40280
|
+
const lastPart = parseInt(parts[parts.length - 1], 10);
|
|
40281
|
+
return Math.max(max, lastPart);
|
|
40282
|
+
}, 0);
|
|
40283
|
+
newId = `${parentId}.${maxId + 1}`;
|
|
40284
|
+
} else {
|
|
40285
|
+
const rootItems = todoItems.filter((i) => !i.id.includes("."));
|
|
40286
|
+
const maxId = rootItems.reduce((max, item) => {
|
|
40287
|
+
const idNum = parseInt(item.id, 10);
|
|
40288
|
+
return Math.max(max, idNum);
|
|
40289
|
+
}, 0);
|
|
40290
|
+
newId = `${maxId + 1}`;
|
|
40291
|
+
}
|
|
40292
|
+
const newItem = {
|
|
40293
|
+
id: newId,
|
|
40294
|
+
title,
|
|
40295
|
+
description: description ?? "",
|
|
40296
|
+
status: status ?? "open"
|
|
40297
|
+
};
|
|
40298
|
+
await todoItemStore.write([...todoItems, newItem]);
|
|
40299
|
+
return { id: newId };
|
|
40300
|
+
} else {
|
|
40301
|
+
const { id } = input;
|
|
40302
|
+
if (!id) {
|
|
40303
|
+
throw new Error("ID is required for update operation");
|
|
40304
|
+
}
|
|
40305
|
+
const item = todoItems.find((i) => i.id === id);
|
|
40306
|
+
if (!item) {
|
|
40307
|
+
throw new Error(`To-do item with id ${id} not found`);
|
|
40308
|
+
}
|
|
40309
|
+
if (input.title != null) {
|
|
40310
|
+
item.title = input.title;
|
|
40311
|
+
}
|
|
40312
|
+
if (input.description != null) {
|
|
40313
|
+
item.description = input.description ?? "";
|
|
40314
|
+
}
|
|
40315
|
+
if (input.status != null) {
|
|
40316
|
+
item.status = input.status;
|
|
40317
|
+
}
|
|
40318
|
+
await todoItemStore.write(todoItems);
|
|
40319
|
+
return { id };
|
|
40320
|
+
}
|
|
40321
|
+
},
|
|
40083
40322
|
listMemoryTopics: async () => {
|
|
40084
|
-
|
|
40323
|
+
const memory = await memoryStore.read() ?? {};
|
|
40324
|
+
return Object.keys(memory);
|
|
40085
40325
|
},
|
|
40086
40326
|
readMemory: async (topic = defaultMemoryTopic) => {
|
|
40087
|
-
|
|
40327
|
+
const memory = await memoryStore.read() ?? {};
|
|
40328
|
+
return memory[topic];
|
|
40088
40329
|
},
|
|
40089
40330
|
updateMemory: async (operation, topic, content) => {
|
|
40090
40331
|
const memoryTopic = topic ?? defaultMemoryTopic;
|
|
40332
|
+
const memory = await memoryStore.read() ?? {};
|
|
40091
40333
|
switch (operation) {
|
|
40092
40334
|
case "append":
|
|
40093
40335
|
if (content === undefined) {
|
|
40094
40336
|
throw new Error("Content is required for append operation.");
|
|
40095
40337
|
}
|
|
40096
|
-
|
|
40338
|
+
memory[memoryTopic] = `${memory[memoryTopic] || ""}
|
|
40339
|
+
${content}`;
|
|
40097
40340
|
break;
|
|
40098
40341
|
case "replace":
|
|
40099
40342
|
if (content === undefined) {
|
|
40100
40343
|
throw new Error("Content is required for replace operation.");
|
|
40101
40344
|
}
|
|
40102
|
-
|
|
40345
|
+
memory[memoryTopic] = content;
|
|
40103
40346
|
break;
|
|
40104
40347
|
case "remove":
|
|
40105
|
-
delete
|
|
40348
|
+
delete memory[memoryTopic];
|
|
40106
40349
|
break;
|
|
40107
40350
|
}
|
|
40351
|
+
await memoryStore.write(memory);
|
|
40108
40352
|
},
|
|
40109
40353
|
readFile: async (path, includeIgnored) => {
|
|
40110
40354
|
if (!includeIgnored && ig.ignores(path)) {
|