@polka-codes/runner 0.9.80 → 0.9.81
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 +514 -373
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -39031,9 +39031,9 @@ var require_event_target = __commonJS((exports, module) => {
|
|
|
39031
39031
|
}
|
|
39032
39032
|
Object.defineProperty(MessageEvent.prototype, "data", { enumerable: true });
|
|
39033
39033
|
var EventTarget = {
|
|
39034
|
-
addEventListener(type,
|
|
39034
|
+
addEventListener(type, handler13, options = {}) {
|
|
39035
39035
|
for (const listener of this.listeners(type)) {
|
|
39036
|
-
if (!options[kForOnEventAttribute] && listener[kListener] ===
|
|
39036
|
+
if (!options[kForOnEventAttribute] && listener[kListener] === handler13 && !listener[kForOnEventAttribute]) {
|
|
39037
39037
|
return;
|
|
39038
39038
|
}
|
|
39039
39039
|
}
|
|
@@ -39044,7 +39044,7 @@ var require_event_target = __commonJS((exports, module) => {
|
|
|
39044
39044
|
data: isBinary ? data : data.toString()
|
|
39045
39045
|
});
|
|
39046
39046
|
event[kTarget] = this;
|
|
39047
|
-
callListener(
|
|
39047
|
+
callListener(handler13, this, event);
|
|
39048
39048
|
};
|
|
39049
39049
|
} else if (type === "close") {
|
|
39050
39050
|
wrapper = function onClose(code, message) {
|
|
@@ -39054,7 +39054,7 @@ var require_event_target = __commonJS((exports, module) => {
|
|
|
39054
39054
|
wasClean: this._closeFrameReceived && this._closeFrameSent
|
|
39055
39055
|
});
|
|
39056
39056
|
event[kTarget] = this;
|
|
39057
|
-
callListener(
|
|
39057
|
+
callListener(handler13, this, event);
|
|
39058
39058
|
};
|
|
39059
39059
|
} else if (type === "error") {
|
|
39060
39060
|
wrapper = function onError(error46) {
|
|
@@ -39063,28 +39063,28 @@ var require_event_target = __commonJS((exports, module) => {
|
|
|
39063
39063
|
message: error46.message
|
|
39064
39064
|
});
|
|
39065
39065
|
event[kTarget] = this;
|
|
39066
|
-
callListener(
|
|
39066
|
+
callListener(handler13, this, event);
|
|
39067
39067
|
};
|
|
39068
39068
|
} else if (type === "open") {
|
|
39069
39069
|
wrapper = function onOpen() {
|
|
39070
39070
|
const event = new Event("open");
|
|
39071
39071
|
event[kTarget] = this;
|
|
39072
|
-
callListener(
|
|
39072
|
+
callListener(handler13, this, event);
|
|
39073
39073
|
};
|
|
39074
39074
|
} else {
|
|
39075
39075
|
return;
|
|
39076
39076
|
}
|
|
39077
39077
|
wrapper[kForOnEventAttribute] = !!options[kForOnEventAttribute];
|
|
39078
|
-
wrapper[kListener] =
|
|
39078
|
+
wrapper[kListener] = handler13;
|
|
39079
39079
|
if (options.once) {
|
|
39080
39080
|
this.once(type, wrapper);
|
|
39081
39081
|
} else {
|
|
39082
39082
|
this.on(type, wrapper);
|
|
39083
39083
|
}
|
|
39084
39084
|
},
|
|
39085
|
-
removeEventListener(type,
|
|
39085
|
+
removeEventListener(type, handler13) {
|
|
39086
39086
|
for (const listener of this.listeners(type)) {
|
|
39087
|
-
if (listener[kListener] ===
|
|
39087
|
+
if (listener[kListener] === handler13 && !listener[kForOnEventAttribute]) {
|
|
39088
39088
|
this.removeListener(type, listener);
|
|
39089
39089
|
break;
|
|
39090
39090
|
}
|
|
@@ -39610,16 +39610,16 @@ var require_websocket = __commonJS((exports, module) => {
|
|
|
39610
39610
|
}
|
|
39611
39611
|
return null;
|
|
39612
39612
|
},
|
|
39613
|
-
set(
|
|
39613
|
+
set(handler13) {
|
|
39614
39614
|
for (const listener of this.listeners(method)) {
|
|
39615
39615
|
if (listener[kForOnEventAttribute]) {
|
|
39616
39616
|
this.removeListener(method, listener);
|
|
39617
39617
|
break;
|
|
39618
39618
|
}
|
|
39619
39619
|
}
|
|
39620
|
-
if (typeof
|
|
39620
|
+
if (typeof handler13 !== "function")
|
|
39621
39621
|
return;
|
|
39622
|
-
this.addEventListener(method,
|
|
39622
|
+
this.addEventListener(method, handler13, {
|
|
39623
39623
|
[kForOnEventAttribute]: true
|
|
39624
39624
|
});
|
|
39625
39625
|
}
|
|
@@ -40499,7 +40499,7 @@ var {
|
|
|
40499
40499
|
Help
|
|
40500
40500
|
} = import__.default;
|
|
40501
40501
|
// package.json
|
|
40502
|
-
var version = "0.9.
|
|
40502
|
+
var version = "0.9.81";
|
|
40503
40503
|
|
|
40504
40504
|
// src/runner.ts
|
|
40505
40505
|
import { execSync } from "node:child_process";
|
|
@@ -53157,12 +53157,6 @@ function date4(params) {
|
|
|
53157
53157
|
// ../../node_modules/zod/v4/classic/external.js
|
|
53158
53158
|
config(en_default());
|
|
53159
53159
|
// ../core/src/config.ts
|
|
53160
|
-
var providerModelSchema = exports_external.object({
|
|
53161
|
-
provider: exports_external.string().optional(),
|
|
53162
|
-
model: exports_external.string().optional(),
|
|
53163
|
-
parameters: exports_external.record(exports_external.string(), exports_external.any()).optional(),
|
|
53164
|
-
budget: exports_external.number().positive().optional()
|
|
53165
|
-
});
|
|
53166
53160
|
var ruleSchema = exports_external.union([
|
|
53167
53161
|
exports_external.string(),
|
|
53168
53162
|
exports_external.object({ path: exports_external.string() }).strict(),
|
|
@@ -53175,6 +53169,13 @@ var ruleSchema = exports_external.union([
|
|
|
53175
53169
|
branch: exports_external.string().optional()
|
|
53176
53170
|
}).strict()
|
|
53177
53171
|
]);
|
|
53172
|
+
var providerModelSchema = exports_external.object({
|
|
53173
|
+
provider: exports_external.string().optional(),
|
|
53174
|
+
model: exports_external.string().optional(),
|
|
53175
|
+
parameters: exports_external.record(exports_external.string(), exports_external.any()).optional(),
|
|
53176
|
+
budget: exports_external.number().positive().optional(),
|
|
53177
|
+
rules: exports_external.array(ruleSchema).optional().or(exports_external.string()).optional()
|
|
53178
|
+
});
|
|
53178
53179
|
var configSchema = exports_external.object({
|
|
53179
53180
|
prices: exports_external.record(exports_external.string(), exports_external.record(exports_external.string(), exports_external.object({
|
|
53180
53181
|
inputPrice: exports_external.number().optional(),
|
|
@@ -53267,7 +53268,7 @@ var toolInfo = {
|
|
|
53267
53268
|
var handler = async (provider, args) => {
|
|
53268
53269
|
if (!provider.askFollowupQuestion) {
|
|
53269
53270
|
return {
|
|
53270
|
-
|
|
53271
|
+
success: false,
|
|
53271
53272
|
message: {
|
|
53272
53273
|
type: "error-text",
|
|
53273
53274
|
value: "Not possible to ask followup question."
|
|
@@ -53277,7 +53278,7 @@ var handler = async (provider, args) => {
|
|
|
53277
53278
|
const { questions } = toolInfo.parameters.parse(args);
|
|
53278
53279
|
if (questions.length === 0) {
|
|
53279
53280
|
return {
|
|
53280
|
-
|
|
53281
|
+
success: false,
|
|
53281
53282
|
message: {
|
|
53282
53283
|
type: "error-text",
|
|
53283
53284
|
value: "No questions provided"
|
|
@@ -53293,7 +53294,7 @@ ${answer}
|
|
|
53293
53294
|
</ask_followup_question_answer>`);
|
|
53294
53295
|
}
|
|
53295
53296
|
return {
|
|
53296
|
-
|
|
53297
|
+
success: true,
|
|
53297
53298
|
message: {
|
|
53298
53299
|
type: "text",
|
|
53299
53300
|
value: answers.join(`
|
|
@@ -53336,7 +53337,7 @@ var toolInfo2 = {
|
|
|
53336
53337
|
var handler2 = async (provider, args) => {
|
|
53337
53338
|
if (!provider.executeCommand) {
|
|
53338
53339
|
return {
|
|
53339
|
-
|
|
53340
|
+
success: false,
|
|
53340
53341
|
message: {
|
|
53341
53342
|
type: "error-text",
|
|
53342
53343
|
value: "Not possible to execute command. Abort."
|
|
@@ -53365,7 +53366,7 @@ ${result.stderr}
|
|
|
53365
53366
|
}
|
|
53366
53367
|
if (result.exitCode === 0) {
|
|
53367
53368
|
return {
|
|
53368
|
-
|
|
53369
|
+
success: true,
|
|
53369
53370
|
message: {
|
|
53370
53371
|
type: "text",
|
|
53371
53372
|
value: message
|
|
@@ -53373,7 +53374,7 @@ ${result.stderr}
|
|
|
53373
53374
|
};
|
|
53374
53375
|
}
|
|
53375
53376
|
return {
|
|
53376
|
-
|
|
53377
|
+
success: false,
|
|
53377
53378
|
message: {
|
|
53378
53379
|
type: "error-text",
|
|
53379
53380
|
value: message
|
|
@@ -53381,7 +53382,7 @@ ${result.stderr}
|
|
|
53381
53382
|
};
|
|
53382
53383
|
} catch (error46) {
|
|
53383
53384
|
return {
|
|
53384
|
-
|
|
53385
|
+
success: false,
|
|
53385
53386
|
message: {
|
|
53386
53387
|
type: "error-text",
|
|
53387
53388
|
value: error46 instanceof Error ? error46.message : String(error46)
|
|
@@ -53430,7 +53431,7 @@ var toolInfo3 = {
|
|
|
53430
53431
|
var handler3 = async (provider, args) => {
|
|
53431
53432
|
if (!provider.fetchUrl) {
|
|
53432
53433
|
return {
|
|
53433
|
-
|
|
53434
|
+
success: false,
|
|
53434
53435
|
message: {
|
|
53435
53436
|
type: "error-text",
|
|
53436
53437
|
value: "Not possible to fetch url."
|
|
@@ -53440,7 +53441,7 @@ var handler3 = async (provider, args) => {
|
|
|
53440
53441
|
const { url: urls } = toolInfo3.parameters.parse(args);
|
|
53441
53442
|
if (urls.length === 0) {
|
|
53442
53443
|
return {
|
|
53443
|
-
|
|
53444
|
+
success: false,
|
|
53444
53445
|
message: {
|
|
53445
53446
|
type: "error-text",
|
|
53446
53447
|
value: "No URLs provided. Please provide at least one URL to fetch."
|
|
@@ -53459,7 +53460,7 @@ var handler3 = async (provider, args) => {
|
|
|
53459
53460
|
}
|
|
53460
53461
|
const resolvedResults = await Promise.all(results);
|
|
53461
53462
|
return {
|
|
53462
|
-
|
|
53463
|
+
success: true,
|
|
53463
53464
|
message: {
|
|
53464
53465
|
type: "text",
|
|
53465
53466
|
value: resolvedResults.join(`
|
|
@@ -53471,40 +53472,8 @@ var fetchUrl_default = {
|
|
|
53471
53472
|
...toolInfo3,
|
|
53472
53473
|
handler: handler3
|
|
53473
53474
|
};
|
|
53474
|
-
// ../core/src/tools/getTodoItem.ts
|
|
53475
|
-
var toolInfo4 = {
|
|
53476
|
-
name: "getTodoItem",
|
|
53477
|
-
description: "Get a to-do item by its ID.",
|
|
53478
|
-
parameters: exports_external.object({
|
|
53479
|
-
id: exports_external.string().describe("The ID of the to-do item.")
|
|
53480
|
-
})
|
|
53481
|
-
};
|
|
53482
|
-
var handler4 = async (provider, args) => {
|
|
53483
|
-
if (!provider.getTodoItem) {
|
|
53484
|
-
return {
|
|
53485
|
-
type: "Error" /* Error */,
|
|
53486
|
-
message: {
|
|
53487
|
-
type: "error-text",
|
|
53488
|
-
value: "Not possible to get a to-do item."
|
|
53489
|
-
}
|
|
53490
|
-
};
|
|
53491
|
-
}
|
|
53492
|
-
const { id } = toolInfo4.parameters.parse(args);
|
|
53493
|
-
const item = await provider.getTodoItem(id);
|
|
53494
|
-
return {
|
|
53495
|
-
type: "Reply" /* Reply */,
|
|
53496
|
-
message: {
|
|
53497
|
-
type: "json",
|
|
53498
|
-
value: item ?? null
|
|
53499
|
-
}
|
|
53500
|
-
};
|
|
53501
|
-
};
|
|
53502
|
-
var getTodoItem_default = {
|
|
53503
|
-
...toolInfo4,
|
|
53504
|
-
handler: handler4
|
|
53505
|
-
};
|
|
53506
53475
|
// ../core/src/tools/listFiles.ts
|
|
53507
|
-
var
|
|
53476
|
+
var toolInfo4 = {
|
|
53508
53477
|
name: "listFiles",
|
|
53509
53478
|
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.",
|
|
53510
53479
|
parameters: exports_external.object({
|
|
@@ -53542,20 +53511,20 @@ var toolInfo5 = {
|
|
|
53542
53511
|
]
|
|
53543
53512
|
})
|
|
53544
53513
|
};
|
|
53545
|
-
var
|
|
53514
|
+
var handler4 = async (provider, args) => {
|
|
53546
53515
|
if (!provider.listFiles) {
|
|
53547
53516
|
return {
|
|
53548
|
-
|
|
53517
|
+
success: false,
|
|
53549
53518
|
message: {
|
|
53550
53519
|
type: "error-text",
|
|
53551
53520
|
value: "Not possible to list files."
|
|
53552
53521
|
}
|
|
53553
53522
|
};
|
|
53554
53523
|
}
|
|
53555
|
-
const { path, maxCount, recursive, includeIgnored } =
|
|
53524
|
+
const { path, maxCount, recursive, includeIgnored } = toolInfo4.parameters.parse(args);
|
|
53556
53525
|
const [files, limitReached] = await provider.listFiles(path, recursive, maxCount, includeIgnored);
|
|
53557
53526
|
return {
|
|
53558
|
-
|
|
53527
|
+
success: true,
|
|
53559
53528
|
message: {
|
|
53560
53529
|
type: "text",
|
|
53561
53530
|
value: `<list_files_path>${path}</list_files_path>
|
|
@@ -53568,128 +53537,32 @@ ${files.join(`
|
|
|
53568
53537
|
};
|
|
53569
53538
|
};
|
|
53570
53539
|
var listFiles_default = {
|
|
53571
|
-
...
|
|
53572
|
-
handler:
|
|
53573
|
-
};
|
|
53574
|
-
// ../core/src/tools/listMemoryTopics.ts
|
|
53575
|
-
var toolInfo6 = {
|
|
53576
|
-
name: "listMemoryTopics",
|
|
53577
|
-
description: "Lists all topics in memory. Use this to see what information has been stored and which topics are available to read from.",
|
|
53578
|
-
parameters: exports_external.object({})
|
|
53579
|
-
};
|
|
53580
|
-
var handler6 = async (provider, _args) => {
|
|
53581
|
-
const topics = await provider.listMemoryTopics();
|
|
53582
|
-
if (!topics.length) {
|
|
53583
|
-
return { type: "Reply" /* Reply */, message: { type: "text", value: "No topics found." } };
|
|
53584
|
-
}
|
|
53585
|
-
return {
|
|
53586
|
-
type: "Reply" /* Reply */,
|
|
53587
|
-
message: {
|
|
53588
|
-
type: "text",
|
|
53589
|
-
value: `Memory topics:
|
|
53590
|
-
${topics.join(`
|
|
53591
|
-
`)}`
|
|
53592
|
-
}
|
|
53593
|
-
};
|
|
53594
|
-
};
|
|
53595
|
-
var listMemoryTopics_default = {
|
|
53596
|
-
...toolInfo6,
|
|
53597
|
-
handler: handler6
|
|
53598
|
-
};
|
|
53599
|
-
// ../core/src/tools/todo.ts
|
|
53600
|
-
var TodoStatus = exports_external.enum(["open", "completed", "closed"]);
|
|
53601
|
-
var TodoItemSchema = exports_external.object({
|
|
53602
|
-
id: exports_external.string(),
|
|
53603
|
-
title: exports_external.string(),
|
|
53604
|
-
description: exports_external.string(),
|
|
53605
|
-
status: TodoStatus
|
|
53606
|
-
});
|
|
53607
|
-
var UpdateTodoItemInputSchema = exports_external.object({
|
|
53608
|
-
operation: exports_external.enum(["add", "update"]),
|
|
53609
|
-
id: exports_external.string().nullish(),
|
|
53610
|
-
parentId: exports_external.string().nullish(),
|
|
53611
|
-
title: exports_external.string().nullish(),
|
|
53612
|
-
description: exports_external.string().nullish(),
|
|
53613
|
-
status: TodoStatus.nullish()
|
|
53614
|
-
}).superRefine((data, ctx) => {
|
|
53615
|
-
if (data.operation === "add") {
|
|
53616
|
-
if (!data.title) {
|
|
53617
|
-
ctx.addIssue({
|
|
53618
|
-
code: "custom",
|
|
53619
|
-
message: 'Title is required for "add" operation',
|
|
53620
|
-
path: ["title"]
|
|
53621
|
-
});
|
|
53622
|
-
}
|
|
53623
|
-
} else if (data.operation === "update") {
|
|
53624
|
-
if (!data.id) {
|
|
53625
|
-
ctx.addIssue({
|
|
53626
|
-
code: "custom",
|
|
53627
|
-
message: 'ID is required for "update" operation',
|
|
53628
|
-
path: ["id"]
|
|
53629
|
-
});
|
|
53630
|
-
}
|
|
53631
|
-
}
|
|
53632
|
-
});
|
|
53633
|
-
var UpdateTodoItemOutputSchema = exports_external.object({
|
|
53634
|
-
id: exports_external.string()
|
|
53635
|
-
});
|
|
53636
|
-
|
|
53637
|
-
// ../core/src/tools/listTodoItems.ts
|
|
53638
|
-
var toolInfo7 = {
|
|
53639
|
-
name: "listTodoItems",
|
|
53640
|
-
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.",
|
|
53641
|
-
parameters: exports_external.object({
|
|
53642
|
-
id: exports_external.string().nullish(),
|
|
53643
|
-
status: TodoStatus.nullish()
|
|
53644
|
-
})
|
|
53645
|
-
};
|
|
53646
|
-
var handler7 = async (provider, args) => {
|
|
53647
|
-
if (!provider.listTodoItems) {
|
|
53648
|
-
return {
|
|
53649
|
-
type: "Error" /* Error */,
|
|
53650
|
-
message: {
|
|
53651
|
-
type: "error-text",
|
|
53652
|
-
value: "Not possible to list to-do items."
|
|
53653
|
-
}
|
|
53654
|
-
};
|
|
53655
|
-
}
|
|
53656
|
-
const { id, status } = toolInfo7.parameters.parse(args);
|
|
53657
|
-
const items = await provider.listTodoItems(id, status);
|
|
53658
|
-
return {
|
|
53659
|
-
type: "Reply" /* Reply */,
|
|
53660
|
-
message: {
|
|
53661
|
-
type: "json",
|
|
53662
|
-
value: items
|
|
53663
|
-
}
|
|
53664
|
-
};
|
|
53665
|
-
};
|
|
53666
|
-
var listTodoItems_default = {
|
|
53667
|
-
...toolInfo7,
|
|
53668
|
-
handler: handler7
|
|
53540
|
+
...toolInfo4,
|
|
53541
|
+
handler: handler4
|
|
53669
53542
|
};
|
|
53670
53543
|
// ../core/src/tools/readBinaryFile.ts
|
|
53671
|
-
var
|
|
53544
|
+
var toolInfo5 = {
|
|
53672
53545
|
name: "readBinaryFile",
|
|
53673
53546
|
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.",
|
|
53674
53547
|
parameters: exports_external.object({
|
|
53675
53548
|
url: exports_external.string().describe("The URL or local path of the file to read.")
|
|
53676
53549
|
})
|
|
53677
53550
|
};
|
|
53678
|
-
var
|
|
53551
|
+
var handler5 = async (provider, args) => {
|
|
53679
53552
|
if (!provider.readBinaryFile) {
|
|
53680
53553
|
return {
|
|
53681
|
-
|
|
53554
|
+
success: false,
|
|
53682
53555
|
message: {
|
|
53683
53556
|
type: "error-text",
|
|
53684
53557
|
value: "Not possible to fetch files. Abort."
|
|
53685
53558
|
}
|
|
53686
53559
|
};
|
|
53687
53560
|
}
|
|
53688
|
-
const { url: url2 } =
|
|
53561
|
+
const { url: url2 } = toolInfo5.parameters.parse(args);
|
|
53689
53562
|
try {
|
|
53690
53563
|
const filePart = await provider.readBinaryFile(url2);
|
|
53691
53564
|
return {
|
|
53692
|
-
|
|
53565
|
+
success: true,
|
|
53693
53566
|
message: {
|
|
53694
53567
|
type: "content",
|
|
53695
53568
|
value: [
|
|
@@ -53705,7 +53578,7 @@ var handler8 = async (provider, args) => {
|
|
|
53705
53578
|
} catch (error46) {
|
|
53706
53579
|
const errorMessage = error46 instanceof Error ? error46.message : "Unknown error";
|
|
53707
53580
|
return {
|
|
53708
|
-
|
|
53581
|
+
success: false,
|
|
53709
53582
|
message: {
|
|
53710
53583
|
type: "error-text",
|
|
53711
53584
|
value: `Error fetching file from ${url2}: ${errorMessage}`
|
|
@@ -53714,11 +53587,11 @@ var handler8 = async (provider, args) => {
|
|
|
53714
53587
|
}
|
|
53715
53588
|
};
|
|
53716
53589
|
var readBinaryFile_default = {
|
|
53717
|
-
...
|
|
53718
|
-
handler:
|
|
53590
|
+
...toolInfo5,
|
|
53591
|
+
handler: handler5
|
|
53719
53592
|
};
|
|
53720
53593
|
// ../core/src/tools/readFile.ts
|
|
53721
|
-
var
|
|
53594
|
+
var toolInfo6 = {
|
|
53722
53595
|
name: "readFile",
|
|
53723
53596
|
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.",
|
|
53724
53597
|
parameters: exports_external.object({
|
|
@@ -53755,17 +53628,17 @@ var toolInfo9 = {
|
|
|
53755
53628
|
]
|
|
53756
53629
|
})
|
|
53757
53630
|
};
|
|
53758
|
-
var
|
|
53631
|
+
var handler6 = async (provider, args) => {
|
|
53759
53632
|
if (!provider.readFile) {
|
|
53760
53633
|
return {
|
|
53761
|
-
|
|
53634
|
+
success: false,
|
|
53762
53635
|
message: {
|
|
53763
53636
|
type: "error-text",
|
|
53764
53637
|
value: "Not possible to read file."
|
|
53765
53638
|
}
|
|
53766
53639
|
};
|
|
53767
53640
|
}
|
|
53768
|
-
const { path: paths, includeIgnored } =
|
|
53641
|
+
const { path: paths, includeIgnored } = toolInfo6.parameters.parse(args);
|
|
53769
53642
|
const resp = [];
|
|
53770
53643
|
for (const path of paths) {
|
|
53771
53644
|
const fileContent = await provider.readFile(path, includeIgnored ?? false);
|
|
@@ -53781,7 +53654,7 @@ var handler9 = async (provider, args) => {
|
|
|
53781
53654
|
}
|
|
53782
53655
|
}
|
|
53783
53656
|
return {
|
|
53784
|
-
|
|
53657
|
+
success: true,
|
|
53785
53658
|
message: {
|
|
53786
53659
|
type: "text",
|
|
53787
53660
|
value: resp.join(`
|
|
@@ -53790,45 +53663,11 @@ var handler9 = async (provider, args) => {
|
|
|
53790
53663
|
};
|
|
53791
53664
|
};
|
|
53792
53665
|
var readFile_default = {
|
|
53793
|
-
...
|
|
53794
|
-
handler:
|
|
53795
|
-
};
|
|
53796
|
-
// ../core/src/tools/readMemory.ts
|
|
53797
|
-
var toolInfo10 = {
|
|
53798
|
-
name: "readMemory",
|
|
53799
|
-
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.",
|
|
53800
|
-
parameters: exports_external.object({
|
|
53801
|
-
topic: exports_external.string().nullish().describe('The topic to read from memory. Defaults to ":default:".')
|
|
53802
|
-
})
|
|
53803
|
-
};
|
|
53804
|
-
var handler10 = async (provider, args) => {
|
|
53805
|
-
const { topic } = toolInfo10.parameters.parse(args);
|
|
53806
|
-
const content = await provider.readMemory(topic ?? undefined);
|
|
53807
|
-
if (content) {
|
|
53808
|
-
return {
|
|
53809
|
-
type: "Reply" /* Reply */,
|
|
53810
|
-
message: {
|
|
53811
|
-
type: "text",
|
|
53812
|
-
value: `<memory${topic ? ` topic="${topic}"` : ""}>
|
|
53813
|
-
${content}
|
|
53814
|
-
</memory>`
|
|
53815
|
-
}
|
|
53816
|
-
};
|
|
53817
|
-
}
|
|
53818
|
-
return {
|
|
53819
|
-
type: "Reply" /* Reply */,
|
|
53820
|
-
message: {
|
|
53821
|
-
type: "text",
|
|
53822
|
-
value: `<memory ${topic ? `topic="${topic}"` : ""} isEmpty="true" />`
|
|
53823
|
-
}
|
|
53824
|
-
};
|
|
53825
|
-
};
|
|
53826
|
-
var readMemory_default = {
|
|
53827
|
-
...toolInfo10,
|
|
53828
|
-
handler: handler10
|
|
53666
|
+
...toolInfo6,
|
|
53667
|
+
handler: handler6
|
|
53829
53668
|
};
|
|
53830
53669
|
// ../core/src/tools/removeFile.ts
|
|
53831
|
-
var
|
|
53670
|
+
var toolInfo7 = {
|
|
53832
53671
|
name: "removeFile",
|
|
53833
53672
|
description: "Request to remove a file at the specified path.",
|
|
53834
53673
|
parameters: exports_external.object({
|
|
@@ -53844,20 +53683,20 @@ var toolInfo11 = {
|
|
|
53844
53683
|
]
|
|
53845
53684
|
})
|
|
53846
53685
|
};
|
|
53847
|
-
var
|
|
53686
|
+
var handler7 = async (provider, args) => {
|
|
53848
53687
|
if (!provider.removeFile) {
|
|
53849
53688
|
return {
|
|
53850
|
-
|
|
53689
|
+
success: false,
|
|
53851
53690
|
message: {
|
|
53852
53691
|
type: "error-text",
|
|
53853
53692
|
value: "Not possible to remove file."
|
|
53854
53693
|
}
|
|
53855
53694
|
};
|
|
53856
53695
|
}
|
|
53857
|
-
const parsed =
|
|
53696
|
+
const parsed = toolInfo7.parameters.safeParse(args);
|
|
53858
53697
|
if (!parsed.success) {
|
|
53859
53698
|
return {
|
|
53860
|
-
|
|
53699
|
+
success: false,
|
|
53861
53700
|
message: {
|
|
53862
53701
|
type: "error-text",
|
|
53863
53702
|
value: `Invalid arguments for removeFile: ${parsed.error.message}`
|
|
@@ -53867,7 +53706,7 @@ var handler11 = async (provider, args) => {
|
|
|
53867
53706
|
const { path } = parsed.data;
|
|
53868
53707
|
await provider.removeFile(path);
|
|
53869
53708
|
return {
|
|
53870
|
-
|
|
53709
|
+
success: true,
|
|
53871
53710
|
message: {
|
|
53872
53711
|
type: "text",
|
|
53873
53712
|
value: `<remove_file_path>${path}</remove_file_path><status>Success</status>`
|
|
@@ -53875,11 +53714,11 @@ var handler11 = async (provider, args) => {
|
|
|
53875
53714
|
};
|
|
53876
53715
|
};
|
|
53877
53716
|
var removeFile_default = {
|
|
53878
|
-
...
|
|
53879
|
-
handler:
|
|
53717
|
+
...toolInfo7,
|
|
53718
|
+
handler: handler7
|
|
53880
53719
|
};
|
|
53881
53720
|
// ../core/src/tools/renameFile.ts
|
|
53882
|
-
var
|
|
53721
|
+
var toolInfo8 = {
|
|
53883
53722
|
name: "renameFile",
|
|
53884
53723
|
description: "Request to rename a file from source path to target path.",
|
|
53885
53724
|
parameters: exports_external.object({
|
|
@@ -53897,20 +53736,20 @@ var toolInfo12 = {
|
|
|
53897
53736
|
]
|
|
53898
53737
|
})
|
|
53899
53738
|
};
|
|
53900
|
-
var
|
|
53739
|
+
var handler8 = async (provider, args) => {
|
|
53901
53740
|
if (!provider.renameFile) {
|
|
53902
53741
|
return {
|
|
53903
|
-
|
|
53742
|
+
success: false,
|
|
53904
53743
|
message: {
|
|
53905
53744
|
type: "error-text",
|
|
53906
53745
|
value: "Not possible to rename file."
|
|
53907
53746
|
}
|
|
53908
53747
|
};
|
|
53909
53748
|
}
|
|
53910
|
-
const { source_path, target_path } =
|
|
53749
|
+
const { source_path, target_path } = toolInfo8.parameters.parse(args);
|
|
53911
53750
|
await provider.renameFile(source_path, target_path);
|
|
53912
53751
|
return {
|
|
53913
|
-
|
|
53752
|
+
success: true,
|
|
53914
53753
|
message: {
|
|
53915
53754
|
type: "text",
|
|
53916
53755
|
value: `<rename_file_path>${target_path}</rename_file_path><status>Success</status>`
|
|
@@ -53918,8 +53757,8 @@ var handler12 = async (provider, args) => {
|
|
|
53918
53757
|
};
|
|
53919
53758
|
};
|
|
53920
53759
|
var renameFile_default = {
|
|
53921
|
-
...
|
|
53922
|
-
handler:
|
|
53760
|
+
...toolInfo8,
|
|
53761
|
+
handler: handler8
|
|
53923
53762
|
};
|
|
53924
53763
|
// ../core/src/tools/utils/replaceInFile.ts
|
|
53925
53764
|
var replaceInFile = (fileContent, diff) => {
|
|
@@ -53996,7 +53835,7 @@ var replaceInFile = (fileContent, diff) => {
|
|
|
53996
53835
|
};
|
|
53997
53836
|
|
|
53998
53837
|
// ../core/src/tools/replaceInFile.ts
|
|
53999
|
-
var
|
|
53838
|
+
var toolInfo9 = {
|
|
54000
53839
|
name: "replaceInFile",
|
|
54001
53840
|
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.",
|
|
54002
53841
|
parameters: exports_external.object({
|
|
@@ -54106,20 +53945,20 @@ function oldFeature() {
|
|
|
54106
53945
|
]
|
|
54107
53946
|
})
|
|
54108
53947
|
};
|
|
54109
|
-
var
|
|
53948
|
+
var handler9 = async (provider, args) => {
|
|
54110
53949
|
if (!provider.readFile || !provider.writeFile) {
|
|
54111
53950
|
return {
|
|
54112
|
-
|
|
53951
|
+
success: false,
|
|
54113
53952
|
message: {
|
|
54114
53953
|
type: "error-text",
|
|
54115
53954
|
value: "Not possible to replace in file."
|
|
54116
53955
|
}
|
|
54117
53956
|
};
|
|
54118
53957
|
}
|
|
54119
|
-
const parsed =
|
|
53958
|
+
const parsed = toolInfo9.parameters.safeParse(args);
|
|
54120
53959
|
if (!parsed.success) {
|
|
54121
53960
|
return {
|
|
54122
|
-
|
|
53961
|
+
success: false,
|
|
54123
53962
|
message: {
|
|
54124
53963
|
type: "error-text",
|
|
54125
53964
|
value: `Invalid arguments for replaceInFile: ${parsed.error.message}`
|
|
@@ -54131,7 +53970,7 @@ var handler13 = async (provider, args) => {
|
|
|
54131
53970
|
const fileContent = await provider.readFile(path, false);
|
|
54132
53971
|
if (fileContent == null) {
|
|
54133
53972
|
return {
|
|
54134
|
-
|
|
53973
|
+
success: false,
|
|
54135
53974
|
message: {
|
|
54136
53975
|
type: "error-text",
|
|
54137
53976
|
value: `<replace_in_file_result path="${path}" status="failed" message="File not found" />`
|
|
@@ -54141,7 +53980,7 @@ var handler13 = async (provider, args) => {
|
|
|
54141
53980
|
const result = replaceInFile(fileContent, diff);
|
|
54142
53981
|
if (result.status === "no_diff_applied") {
|
|
54143
53982
|
return {
|
|
54144
|
-
|
|
53983
|
+
success: false,
|
|
54145
53984
|
message: {
|
|
54146
53985
|
type: "error-text",
|
|
54147
53986
|
value: `<replace_in_file_result path="${path}" status="failed" message="Unable to apply changes">
|
|
@@ -54153,7 +53992,7 @@ var handler13 = async (provider, args) => {
|
|
|
54153
53992
|
await provider.writeFile(path, result.content);
|
|
54154
53993
|
if (result.status === "some_diff_applied") {
|
|
54155
53994
|
return {
|
|
54156
|
-
|
|
53995
|
+
success: true,
|
|
54157
53996
|
message: {
|
|
54158
53997
|
type: "text",
|
|
54159
53998
|
value: `<replace_in_file_result path="${path}" status="some_diff_applied" applied_count="${result.appliedCount}" total_count="${result.totalCount}">
|
|
@@ -54163,7 +54002,7 @@ var handler13 = async (provider, args) => {
|
|
|
54163
54002
|
};
|
|
54164
54003
|
}
|
|
54165
54004
|
return {
|
|
54166
|
-
|
|
54005
|
+
success: true,
|
|
54167
54006
|
message: {
|
|
54168
54007
|
type: "text",
|
|
54169
54008
|
value: `<replace_in_file_result path="${path}" status="all_diff_applied" />`
|
|
@@ -54171,7 +54010,7 @@ var handler13 = async (provider, args) => {
|
|
|
54171
54010
|
};
|
|
54172
54011
|
} catch (error46) {
|
|
54173
54012
|
return {
|
|
54174
|
-
|
|
54013
|
+
success: false,
|
|
54175
54014
|
message: {
|
|
54176
54015
|
type: "error-text",
|
|
54177
54016
|
value: `Invalid arguments for replaceInFile: ${error46}`
|
|
@@ -54180,11 +54019,11 @@ var handler13 = async (provider, args) => {
|
|
|
54180
54019
|
}
|
|
54181
54020
|
};
|
|
54182
54021
|
var replaceInFile_default = {
|
|
54183
|
-
...
|
|
54184
|
-
handler:
|
|
54022
|
+
...toolInfo9,
|
|
54023
|
+
handler: handler9
|
|
54185
54024
|
};
|
|
54186
54025
|
// ../core/src/tools/search.ts
|
|
54187
|
-
var
|
|
54026
|
+
var toolInfo10 = {
|
|
54188
54027
|
name: "search",
|
|
54189
54028
|
description: "Search the web for information using Google Search. Use this tool to find current information, facts, news, documentation, or research that is not available in your training data. Returns comprehensive search results with relevant content extracted from the web.",
|
|
54190
54029
|
parameters: exports_external.object({
|
|
@@ -54212,11 +54051,11 @@ var toolInfo14 = {
|
|
|
54212
54051
|
]
|
|
54213
54052
|
})
|
|
54214
54053
|
};
|
|
54215
|
-
var
|
|
54216
|
-
const { query } =
|
|
54054
|
+
var handler10 = async (provider, args) => {
|
|
54055
|
+
const { query } = toolInfo10.parameters.parse(args);
|
|
54217
54056
|
if (!provider.search) {
|
|
54218
54057
|
return {
|
|
54219
|
-
|
|
54058
|
+
success: false,
|
|
54220
54059
|
message: {
|
|
54221
54060
|
type: "text",
|
|
54222
54061
|
value: "This tool requires a web provider to be installed."
|
|
@@ -54225,7 +54064,7 @@ var handler14 = async (provider, args) => {
|
|
|
54225
54064
|
}
|
|
54226
54065
|
const result = await provider.search(query);
|
|
54227
54066
|
return {
|
|
54228
|
-
|
|
54067
|
+
success: true,
|
|
54229
54068
|
message: {
|
|
54230
54069
|
type: "text",
|
|
54231
54070
|
value: result
|
|
@@ -54233,11 +54072,11 @@ var handler14 = async (provider, args) => {
|
|
|
54233
54072
|
};
|
|
54234
54073
|
};
|
|
54235
54074
|
var search_default = {
|
|
54236
|
-
...
|
|
54237
|
-
handler:
|
|
54075
|
+
...toolInfo10,
|
|
54076
|
+
handler: handler10
|
|
54238
54077
|
};
|
|
54239
54078
|
// ../core/src/tools/searchFiles.ts
|
|
54240
|
-
var
|
|
54079
|
+
var toolInfo11 = {
|
|
54241
54080
|
name: "searchFiles",
|
|
54242
54081
|
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.",
|
|
54243
54082
|
parameters: exports_external.object({
|
|
@@ -54261,20 +54100,20 @@ var toolInfo15 = {
|
|
|
54261
54100
|
]
|
|
54262
54101
|
})
|
|
54263
54102
|
};
|
|
54264
|
-
var
|
|
54103
|
+
var handler11 = async (provider, args) => {
|
|
54265
54104
|
if (!provider.searchFiles) {
|
|
54266
54105
|
return {
|
|
54267
|
-
|
|
54106
|
+
success: false,
|
|
54268
54107
|
message: {
|
|
54269
54108
|
type: "error-text",
|
|
54270
54109
|
value: "Not possible to search files."
|
|
54271
54110
|
}
|
|
54272
54111
|
};
|
|
54273
54112
|
}
|
|
54274
|
-
const parsed =
|
|
54113
|
+
const parsed = toolInfo11.parameters.safeParse(args);
|
|
54275
54114
|
if (!parsed.success) {
|
|
54276
54115
|
return {
|
|
54277
|
-
|
|
54116
|
+
success: false,
|
|
54278
54117
|
message: {
|
|
54279
54118
|
type: "error-text",
|
|
54280
54119
|
value: `Invalid arguments for searchFiles: ${parsed.error.message}`
|
|
@@ -54285,7 +54124,7 @@ var handler15 = async (provider, args) => {
|
|
|
54285
54124
|
try {
|
|
54286
54125
|
const files = await provider.searchFiles(path, regex, filePattern ?? "*");
|
|
54287
54126
|
return {
|
|
54288
|
-
|
|
54127
|
+
success: true,
|
|
54289
54128
|
message: {
|
|
54290
54129
|
type: "text",
|
|
54291
54130
|
value: `<search_files_path>${path}</search_files_path>
|
|
@@ -54300,7 +54139,7 @@ ${files.join(`
|
|
|
54300
54139
|
};
|
|
54301
54140
|
} catch (error46) {
|
|
54302
54141
|
return {
|
|
54303
|
-
|
|
54142
|
+
success: false,
|
|
54304
54143
|
message: {
|
|
54305
54144
|
type: "error-text",
|
|
54306
54145
|
value: `Error searching files: ${error46}`
|
|
@@ -54309,112 +54148,48 @@ ${files.join(`
|
|
|
54309
54148
|
}
|
|
54310
54149
|
};
|
|
54311
54150
|
var searchFiles_default = {
|
|
54312
|
-
...
|
|
54313
|
-
handler:
|
|
54151
|
+
...toolInfo11,
|
|
54152
|
+
handler: handler11
|
|
54314
54153
|
};
|
|
54315
|
-
// ../core/src/tools/
|
|
54316
|
-
var
|
|
54317
|
-
|
|
54318
|
-
|
|
54319
|
-
|
|
54320
|
-
|
|
54321
|
-
|
|
54322
|
-
|
|
54323
|
-
|
|
54324
|
-
|
|
54325
|
-
|
|
54326
|
-
|
|
54327
|
-
|
|
54328
|
-
|
|
54329
|
-
|
|
54330
|
-
|
|
54331
|
-
|
|
54332
|
-
|
|
54333
|
-
|
|
54334
|
-
|
|
54335
|
-
|
|
54336
|
-
|
|
54337
|
-
|
|
54338
|
-
});
|
|
54339
|
-
}
|
|
54154
|
+
// ../core/src/tools/todo.ts
|
|
54155
|
+
var TodoStatus = exports_external.enum(["open", "completed", "closed"]);
|
|
54156
|
+
var TodoItemSchema = exports_external.object({
|
|
54157
|
+
id: exports_external.string(),
|
|
54158
|
+
title: exports_external.string(),
|
|
54159
|
+
description: exports_external.string(),
|
|
54160
|
+
status: TodoStatus
|
|
54161
|
+
});
|
|
54162
|
+
var UpdateTodoItemInputSchema = exports_external.object({
|
|
54163
|
+
operation: exports_external.enum(["add", "update"]),
|
|
54164
|
+
id: exports_external.string().nullish(),
|
|
54165
|
+
parentId: exports_external.string().nullish(),
|
|
54166
|
+
title: exports_external.string().nullish(),
|
|
54167
|
+
description: exports_external.string().nullish(),
|
|
54168
|
+
status: TodoStatus.nullish()
|
|
54169
|
+
}).superRefine((data, ctx) => {
|
|
54170
|
+
if (data.operation === "add") {
|
|
54171
|
+
if (!data.title) {
|
|
54172
|
+
ctx.addIssue({
|
|
54173
|
+
code: "custom",
|
|
54174
|
+
message: 'Title is required for "add" operation',
|
|
54175
|
+
path: ["title"]
|
|
54176
|
+
});
|
|
54340
54177
|
}
|
|
54341
|
-
})
|
|
54342
|
-
|
|
54343
|
-
|
|
54344
|
-
|
|
54345
|
-
|
|
54346
|
-
|
|
54347
|
-
|
|
54348
|
-
type: "error-text",
|
|
54349
|
-
value: "Memory operations are not supported by the current provider."
|
|
54350
|
-
}
|
|
54351
|
-
};
|
|
54352
|
-
}
|
|
54353
|
-
const params = toolInfo16.parameters.parse(args);
|
|
54354
|
-
await provider.updateMemory(params.operation, params.topic ?? undefined, params.content ?? undefined);
|
|
54355
|
-
switch (params.operation) {
|
|
54356
|
-
case "append":
|
|
54357
|
-
return {
|
|
54358
|
-
type: "Reply" /* Reply */,
|
|
54359
|
-
message: {
|
|
54360
|
-
type: "text",
|
|
54361
|
-
value: `Content appended to memory topic '${params.topic || ":default:"}'.`
|
|
54362
|
-
}
|
|
54363
|
-
};
|
|
54364
|
-
case "replace":
|
|
54365
|
-
return {
|
|
54366
|
-
type: "Reply" /* Reply */,
|
|
54367
|
-
message: {
|
|
54368
|
-
type: "text",
|
|
54369
|
-
value: `Memory topic '${params.topic || ":default:"}' replaced.`
|
|
54370
|
-
}
|
|
54371
|
-
};
|
|
54372
|
-
case "remove":
|
|
54373
|
-
return {
|
|
54374
|
-
type: "Reply" /* Reply */,
|
|
54375
|
-
message: {
|
|
54376
|
-
type: "text",
|
|
54377
|
-
value: `Memory topic '${params.topic || ":default:"}' removed.`
|
|
54378
|
-
}
|
|
54379
|
-
};
|
|
54380
|
-
}
|
|
54381
|
-
};
|
|
54382
|
-
var updateMemory_default = {
|
|
54383
|
-
...toolInfo16,
|
|
54384
|
-
handler: handler16
|
|
54385
|
-
};
|
|
54386
|
-
// ../core/src/tools/updateTodoItem.ts
|
|
54387
|
-
var toolInfo17 = {
|
|
54388
|
-
name: "updateTodoItem",
|
|
54389
|
-
description: "Add or update a to-do item.",
|
|
54390
|
-
parameters: UpdateTodoItemInputSchema
|
|
54391
|
-
};
|
|
54392
|
-
var handler17 = async (provider, args) => {
|
|
54393
|
-
if (!provider.updateTodoItem) {
|
|
54394
|
-
return {
|
|
54395
|
-
type: "Error" /* Error */,
|
|
54396
|
-
message: {
|
|
54397
|
-
type: "error-text",
|
|
54398
|
-
value: "Not possible to update a to-do item."
|
|
54399
|
-
}
|
|
54400
|
-
};
|
|
54401
|
-
}
|
|
54402
|
-
const input = toolInfo17.parameters.parse(args);
|
|
54403
|
-
const result = await provider.updateTodoItem(input);
|
|
54404
|
-
return {
|
|
54405
|
-
type: "Reply" /* Reply */,
|
|
54406
|
-
message: {
|
|
54407
|
-
type: "json",
|
|
54408
|
-
value: result
|
|
54178
|
+
} else if (data.operation === "update") {
|
|
54179
|
+
if (!data.id) {
|
|
54180
|
+
ctx.addIssue({
|
|
54181
|
+
code: "custom",
|
|
54182
|
+
message: 'ID is required for "update" operation',
|
|
54183
|
+
path: ["id"]
|
|
54184
|
+
});
|
|
54409
54185
|
}
|
|
54410
|
-
}
|
|
54411
|
-
};
|
|
54412
|
-
var
|
|
54413
|
-
|
|
54414
|
-
|
|
54415
|
-
};
|
|
54186
|
+
}
|
|
54187
|
+
});
|
|
54188
|
+
var UpdateTodoItemOutputSchema = exports_external.object({
|
|
54189
|
+
id: exports_external.string()
|
|
54190
|
+
});
|
|
54416
54191
|
// ../core/src/tools/writeToFile.ts
|
|
54417
|
-
var
|
|
54192
|
+
var toolInfo12 = {
|
|
54418
54193
|
name: "writeToFile",
|
|
54419
54194
|
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.",
|
|
54420
54195
|
parameters: exports_external.object({
|
|
@@ -54443,20 +54218,20 @@ export default App;
|
|
|
54443
54218
|
]
|
|
54444
54219
|
})
|
|
54445
54220
|
};
|
|
54446
|
-
var
|
|
54221
|
+
var handler12 = async (provider, args) => {
|
|
54447
54222
|
if (!provider.writeFile) {
|
|
54448
54223
|
return {
|
|
54449
|
-
|
|
54224
|
+
success: false,
|
|
54450
54225
|
message: {
|
|
54451
54226
|
type: "error-text",
|
|
54452
54227
|
value: "Not possible to write file."
|
|
54453
54228
|
}
|
|
54454
54229
|
};
|
|
54455
54230
|
}
|
|
54456
|
-
const parsed =
|
|
54231
|
+
const parsed = toolInfo12.parameters.safeParse(args);
|
|
54457
54232
|
if (!parsed.success) {
|
|
54458
54233
|
return {
|
|
54459
|
-
|
|
54234
|
+
success: false,
|
|
54460
54235
|
message: {
|
|
54461
54236
|
type: "error-text",
|
|
54462
54237
|
value: `Invalid arguments for writeToFile: ${parsed.error.message}`
|
|
@@ -54469,7 +54244,7 @@ var handler18 = async (provider, args) => {
|
|
|
54469
54244
|
content = trimmedContent.slice(9, -3);
|
|
54470
54245
|
await provider.writeFile(path, content);
|
|
54471
54246
|
return {
|
|
54472
|
-
|
|
54247
|
+
success: true,
|
|
54473
54248
|
message: {
|
|
54474
54249
|
type: "text",
|
|
54475
54250
|
value: `<write_to_file_path>${path}</write_to_file_path><status>Success</status>`
|
|
@@ -54477,8 +54252,8 @@ var handler18 = async (provider, args) => {
|
|
|
54477
54252
|
};
|
|
54478
54253
|
};
|
|
54479
54254
|
var writeToFile_default = {
|
|
54480
|
-
...
|
|
54481
|
-
handler:
|
|
54255
|
+
...toolInfo12,
|
|
54256
|
+
handler: handler12
|
|
54482
54257
|
};
|
|
54483
54258
|
// ../core/src/UsageMeter.ts
|
|
54484
54259
|
class UsageMeter {
|
|
@@ -64313,17 +64088,383 @@ var WorkflowFileSchema = exports_external.object({
|
|
|
64313
64088
|
|
|
64314
64089
|
// ../core/src/workflow/dynamic.ts
|
|
64315
64090
|
var AsyncFunction = Object.getPrototypeOf(async () => {}).constructor;
|
|
64091
|
+
// ../core/src/workflow/prompts/dynamic-generator-prompts.ts
|
|
64092
|
+
var RUNTIME_CONTEXT_TYPES = `## Runtime context (ctx)
|
|
64093
|
+
\`\`\`ts
|
|
64094
|
+
// Runtime types (for reference)
|
|
64095
|
+
type Logger = {
|
|
64096
|
+
debug: (...args: any[]) => void
|
|
64097
|
+
info: (...args: any[]) => void
|
|
64098
|
+
warn: (...args: any[]) => void
|
|
64099
|
+
error: (...args: any[]) => void
|
|
64100
|
+
}
|
|
64101
|
+
|
|
64102
|
+
type StepFn = {
|
|
64103
|
+
<T>(name: string, fn: () => Promise<T>): Promise<T>
|
|
64104
|
+
<T>(name: string, options: { retry?: number }, fn: () => Promise<T>): Promise<T>
|
|
64105
|
+
}
|
|
64106
|
+
|
|
64107
|
+
type JsonModelMessage = { role: 'system' | 'user' | 'assistant' | 'tool'; content: any }
|
|
64108
|
+
type JsonResponseMessage = { role: 'assistant' | 'tool'; content: any }
|
|
64109
|
+
type ToolSet = Record<string, any>
|
|
64110
|
+
|
|
64111
|
+
type ToolResponseResult =
|
|
64112
|
+
| { type: 'text'; value: string }
|
|
64113
|
+
| { type: 'json'; value: any }
|
|
64114
|
+
| { type: 'error-text'; value: string }
|
|
64115
|
+
| { type: 'error-json'; value: any }
|
|
64116
|
+
| { type: 'content'; value: any[] }
|
|
64117
|
+
|
|
64118
|
+
type ToolResponse =
|
|
64119
|
+
| { type: 'Reply'; message: ToolResponseResult }
|
|
64120
|
+
| { type: 'Exit'; message: string; object?: any }
|
|
64121
|
+
| { type: 'Error'; message: ToolResponseResult }
|
|
64122
|
+
|
|
64123
|
+
type ExitReason =
|
|
64124
|
+
| { type: 'UsageExceeded' }
|
|
64125
|
+
| { type: 'Exit'; message: string; object?: any }
|
|
64126
|
+
| { type: 'Error'; error: { message: string; stack?: string } }
|
|
64127
|
+
|
|
64128
|
+
type FullToolInfo = { name: string; description: string; parameters: any; handler: any }
|
|
64129
|
+
|
|
64130
|
+
type AgentTools = {
|
|
64131
|
+
readFile: (input: { path: string }) => Promise<string | null>
|
|
64132
|
+
writeToFile: (input: { path: string; content: string }) => Promise<void>
|
|
64133
|
+
executeCommand: (input: { command: string; pipe?: boolean; requiresApproval?: boolean } & ({ args: string[]; shell?: false } | { shell: true })) => Promise<{
|
|
64134
|
+
exitCode: number
|
|
64135
|
+
stdout: string
|
|
64136
|
+
stderr: string
|
|
64137
|
+
}>
|
|
64138
|
+
searchFiles: (input: { path: string; regex: string; filePattern?: string }) => Promise<string>
|
|
64139
|
+
listFiles: (input: { path: string; recursive?: boolean; maxCount?: number; includeIgnored?: boolean }) => Promise<string>
|
|
64140
|
+
fetchUrl: (input: { url: string[] }) => Promise<string>
|
|
64141
|
+
askFollowupQuestion: (input: { questions: { prompt: string; options?: string[] }[] }) => Promise<any>
|
|
64142
|
+
// ... and other tools available in the environment
|
|
64143
|
+
}
|
|
64144
|
+
|
|
64145
|
+
// Tools available on ctx.tools in dynamic steps
|
|
64146
|
+
type DynamicWorkflowTools = {
|
|
64147
|
+
// LLM + agent helpers
|
|
64148
|
+
runAgent: (input: {
|
|
64149
|
+
tools: Readonly<FullToolInfo[]>
|
|
64150
|
+
maxToolRoundTrips?: number
|
|
64151
|
+
userMessage: readonly JsonModelMessage[]
|
|
64152
|
+
} & ({ messages: JsonModelMessage[] } | { systemPrompt: string })) => Promise<ExitReason>
|
|
64153
|
+
|
|
64154
|
+
// CLI UX helpers
|
|
64155
|
+
confirm: (input: { message: string }) => Promise<boolean>
|
|
64156
|
+
input: (input: { message: string; default?: string }) => Promise<string>
|
|
64157
|
+
select: (input: { message: string; choices: { name: string; value: string }[] }) => Promise<string>
|
|
64158
|
+
}
|
|
64159
|
+
|
|
64160
|
+
type DynamicStepRuntimeContext = {
|
|
64161
|
+
workflowId: string
|
|
64162
|
+
stepId: string
|
|
64163
|
+
input: Record<string, any>
|
|
64164
|
+
state: Record<string, any>
|
|
64165
|
+
tools: DynamicWorkflowTools
|
|
64166
|
+
agentTools: AgentTools
|
|
64167
|
+
logger: Logger
|
|
64168
|
+
step: StepFn
|
|
64169
|
+
runWorkflow: (workflowId: string, input?: Record<string, any>) => Promise<any>
|
|
64170
|
+
toolInfo?: ReadonlyArray<FullToolInfo>
|
|
64171
|
+
}
|
|
64172
|
+
\`\`\`
|
|
64173
|
+
|
|
64174
|
+
- \`ctx.input\`: workflow inputs (read-only).
|
|
64175
|
+
- \`ctx.state\`: shared state between steps (previous step outputs are stored here).
|
|
64176
|
+
- \`ctx.agentTools\`: standard tools (readFile, executeCommand, etc.). Call as \`await ctx.agentTools.someTool({ ... })\`.
|
|
64177
|
+
- \`ctx.tools\`: workflow helpers (runAgent, confirm, input, select).
|
|
64178
|
+
- \`ctx.runWorkflow\`: run a sub-workflow by id.`;
|
|
64179
|
+
var CONTEXT_USAGE_GUIDELINES = `## Guidelines
|
|
64180
|
+
- Use \`await\` for all async operations.
|
|
64181
|
+
- Return the output value for the step (this becomes the step output).
|
|
64182
|
+
- Access inputs via \`ctx.input.<inputId>\`.
|
|
64183
|
+
- Access previous step outputs via \`ctx.state.<stepOutputKey>\` (defaults to the step \`output\` or \`id\`).`;
|
|
64184
|
+
var QUALITY_GUIDELINES = `## Quality Guidelines for Code Implementation
|
|
64185
|
+
|
|
64186
|
+
### Error Handling
|
|
64187
|
+
- ALWAYS validate inputs at the start of steps
|
|
64188
|
+
- Use try-catch for operations that might fail (file I/O, parsing, API calls)
|
|
64189
|
+
- Preserve stack traces: re-throw original errors rather than creating new ones
|
|
64190
|
+
- Use error type guards: \`const err = error instanceof Error ? error : new Error(String(error))\`
|
|
64191
|
+
- Check for null/undefined before using values
|
|
64192
|
+
- Handle edge cases (empty arrays, missing files, invalid data)
|
|
64193
|
+
|
|
64194
|
+
### Logging
|
|
64195
|
+
- Use \`ctx.logger.info()\` for important progress updates
|
|
64196
|
+
- Use \`ctx.logger.debug()\` for detailed information
|
|
64197
|
+
- Use \`ctx.logger.warn()\` for recoverable issues
|
|
64198
|
+
- Use \`ctx.logger.error()\` before throwing errors
|
|
64199
|
+
- Log when starting and completing significant operations
|
|
64200
|
+
- Use template literals for readability: \`ctx.logger.info(\\\`Processing \${items.length} items...\\\`)\`
|
|
64201
|
+
|
|
64202
|
+
### User Experience
|
|
64203
|
+
- Provide progress feedback for long operations
|
|
64204
|
+
- Return structured data (objects/arrays), not strings when possible
|
|
64205
|
+
- Include helpful metadata in results (counts, timestamps, status)
|
|
64206
|
+
- For batch operations, report progress: \`Processed 5/10 items\`
|
|
64207
|
+
|
|
64208
|
+
### Data Validation
|
|
64209
|
+
- Validate required fields exist before accessing
|
|
64210
|
+
- Check data types match expectations
|
|
64211
|
+
- Validate array lengths before iteration
|
|
64212
|
+
- Example: \`if (!data?.users || !Array.isArray(data.users)) throw new Error('Invalid data format')\`
|
|
64213
|
+
|
|
64214
|
+
### Best Practices
|
|
64215
|
+
- Use meaningful variable names
|
|
64216
|
+
- Avoid nested callbacks - use async/await
|
|
64217
|
+
- Clean up resources (close files, clear timeouts)
|
|
64218
|
+
- Return consistent data structures across similar steps
|
|
64219
|
+
- For iteration, consider batching or rate limiting
|
|
64220
|
+
|
|
64221
|
+
### When to Simplify
|
|
64222
|
+
- Simple transformation steps (e.g., formatting strings) need only basic error handling
|
|
64223
|
+
- Internal sub-workflow steps with validated inputs from parent can skip redundant validation
|
|
64224
|
+
- Minimal logging is fine for fast steps (<100ms) that don't perform I/O or external calls
|
|
64225
|
+
- Use judgment: match error handling complexity to the step's failure risk and impact`;
|
|
64226
|
+
var TOOL_CALLING_EXAMPLES = `## Tool calling examples
|
|
64227
|
+
|
|
64228
|
+
### Standard tools (ctx.agentTools)
|
|
64229
|
+
\`\`\`ts
|
|
64230
|
+
// readFile
|
|
64231
|
+
const readme = await ctx.agentTools.readFile({ path: 'README.md' })
|
|
64232
|
+
if (readme == null) throw new Error('README.md not found')
|
|
64233
|
+
|
|
64234
|
+
// writeToFile
|
|
64235
|
+
await ctx.agentTools.writeToFile({ path: 'notes.txt', content: 'hello\\n' })
|
|
64236
|
+
|
|
64237
|
+
// executeCommand (args form)
|
|
64238
|
+
const rg = await ctx.agentTools.executeCommand({ command: 'rg', args: ['-n', 'TODO', '.'] })
|
|
64239
|
+
if (rg.exitCode !== 0) throw new Error(rg.stderr)
|
|
64240
|
+
|
|
64241
|
+
// executeCommand (shell form)
|
|
64242
|
+
await ctx.agentTools.executeCommand({ command: 'ls -la', shell: true, pipe: true })
|
|
64243
|
+
\`\`\`
|
|
64244
|
+
|
|
64245
|
+
### Workflow helpers (ctx.tools)
|
|
64246
|
+
\`\`\`ts
|
|
64247
|
+
// runAgent (nested agent; use ctx.toolInfo as the tool list)
|
|
64248
|
+
const agentRes = await ctx.tools.runAgent({
|
|
64249
|
+
systemPrompt: 'You are a helpful assistant.',
|
|
64250
|
+
userMessage: [{ role: 'user', content: 'Summarize README.md in 3 bullets.' }],
|
|
64251
|
+
tools: (ctx.toolInfo ?? []) as any,
|
|
64252
|
+
})
|
|
64253
|
+
if (agentRes.type !== 'Exit') throw new Error('runAgent failed')
|
|
64254
|
+
|
|
64255
|
+
// confirm / input / select (interactive)
|
|
64256
|
+
const ok = await ctx.tools.confirm({ message: 'Proceed?' })
|
|
64257
|
+
const name = await ctx.tools.input({ message: 'Name?', default: 'main' })
|
|
64258
|
+
const flavor = await ctx.tools.select({
|
|
64259
|
+
message: 'Pick one',
|
|
64260
|
+
choices: [
|
|
64261
|
+
{ name: 'A', value: 'a' },
|
|
64262
|
+
{ name: 'B', value: 'b' },
|
|
64263
|
+
],
|
|
64264
|
+
})
|
|
64265
|
+
\`\`\`
|
|
64266
|
+
|
|
64267
|
+
### Sub-workflow example (ctx.runWorkflow)
|
|
64268
|
+
\`\`\`ts
|
|
64269
|
+
const results: any[] = []
|
|
64270
|
+
for (const pr of ctx.state.prs ?? []) {
|
|
64271
|
+
results.push(await ctx.runWorkflow('reviewPR', { prId: pr.id }))
|
|
64272
|
+
}
|
|
64273
|
+
return results
|
|
64274
|
+
\`\`\``;
|
|
64275
|
+
var COMPLETE_STEP_EXAMPLE = `## Complete Example: High-Quality Step Implementation
|
|
64276
|
+
|
|
64277
|
+
This example demonstrates all quality guidelines in a single step:
|
|
64278
|
+
|
|
64279
|
+
\`\`\`ts
|
|
64280
|
+
// Step: processUserData
|
|
64281
|
+
// Task: Read, validate, and process user data from a file
|
|
64282
|
+
|
|
64283
|
+
// Input validation
|
|
64284
|
+
if (!ctx.input.dataFile) {
|
|
64285
|
+
throw new Error('Missing required input: dataFile')
|
|
64286
|
+
}
|
|
64287
|
+
|
|
64288
|
+
ctx.logger.info(\`Starting user data processing for: \${ctx.input.dataFile}\`)
|
|
64289
|
+
|
|
64290
|
+
// Read file with error handling
|
|
64291
|
+
let rawData
|
|
64292
|
+
try {
|
|
64293
|
+
ctx.logger.debug(\`Reading file: \${ctx.input.dataFile}\`)
|
|
64294
|
+
rawData = await ctx.agentTools.readFile({ path: ctx.input.dataFile })
|
|
64295
|
+
|
|
64296
|
+
if (!rawData) {
|
|
64297
|
+
throw new Error(\`File not found or empty: \${ctx.input.dataFile}\`)
|
|
64298
|
+
}
|
|
64299
|
+
} catch (error) {
|
|
64300
|
+
const err = error instanceof Error ? error : new Error(String(error))
|
|
64301
|
+
ctx.logger.error(\`Failed to read file: \${err.message}\`)
|
|
64302
|
+
throw err // Preserve original stack trace
|
|
64303
|
+
}
|
|
64304
|
+
|
|
64305
|
+
// Parse and validate data
|
|
64306
|
+
let users
|
|
64307
|
+
try {
|
|
64308
|
+
ctx.logger.debug('Parsing JSON data')
|
|
64309
|
+
const parsed = JSON.parse(rawData)
|
|
64310
|
+
|
|
64311
|
+
if (!parsed?.users || !Array.isArray(parsed.users)) {
|
|
64312
|
+
throw new Error('Invalid data format: expected {users: [...]}')
|
|
64313
|
+
}
|
|
64314
|
+
|
|
64315
|
+
users = parsed.users
|
|
64316
|
+
ctx.logger.info(\`Found \${users.length} users to process\`)
|
|
64317
|
+
} catch (error) {
|
|
64318
|
+
const err = error instanceof Error ? error : new Error(String(error))
|
|
64319
|
+
ctx.logger.error(\`Data parsing failed: \${err.message}\`)
|
|
64320
|
+
throw err // Preserve original stack trace
|
|
64321
|
+
}
|
|
64322
|
+
|
|
64323
|
+
// Process each user with progress reporting
|
|
64324
|
+
const results = []
|
|
64325
|
+
for (let i = 0; i < users.length; i++) {
|
|
64326
|
+
const user = users[i]
|
|
64327
|
+
|
|
64328
|
+
// Validate each user object
|
|
64329
|
+
if (!user?.id || !user?.email) {
|
|
64330
|
+
ctx.logger.warn(\`Skipping invalid user at index \${i}: missing id or email\`)
|
|
64331
|
+
continue
|
|
64332
|
+
}
|
|
64333
|
+
|
|
64334
|
+
// Process user
|
|
64335
|
+
const processed = {
|
|
64336
|
+
id: user.id,
|
|
64337
|
+
email: user.email.toLowerCase().trim(),
|
|
64338
|
+
name: user.name?.trim() || 'Unknown',
|
|
64339
|
+
processedAt: new Date().toISOString(),
|
|
64340
|
+
status: 'active'
|
|
64341
|
+
}
|
|
64342
|
+
|
|
64343
|
+
results.push(processed)
|
|
64344
|
+
|
|
64345
|
+
// Progress feedback every 10 items
|
|
64346
|
+
if ((i + 1) % 10 === 0) {
|
|
64347
|
+
ctx.logger.info(\`Processed \${i + 1}/\${users.length} users\`)
|
|
64348
|
+
}
|
|
64349
|
+
}
|
|
64350
|
+
|
|
64351
|
+
ctx.logger.info(\`Successfully processed \${results.length}/\${users.length} users\`)
|
|
64352
|
+
|
|
64353
|
+
// Return structured result with metadata
|
|
64354
|
+
return {
|
|
64355
|
+
users: results,
|
|
64356
|
+
metadata: {
|
|
64357
|
+
totalInput: users.length,
|
|
64358
|
+
totalProcessed: results.length,
|
|
64359
|
+
skipped: users.length - results.length,
|
|
64360
|
+
processedAt: new Date().toISOString()
|
|
64361
|
+
}
|
|
64362
|
+
}
|
|
64363
|
+
\`\`\`
|
|
64364
|
+
|
|
64365
|
+
Key features demonstrated:
|
|
64366
|
+
- Input validation at start
|
|
64367
|
+
- Comprehensive error handling with try-catch that preserves stack traces
|
|
64368
|
+
- Logging at info, debug, warn, and error levels
|
|
64369
|
+
- Progress reporting for long operations (every 10 items)
|
|
64370
|
+
- Data validation throughout (null checks, type checks, array validation)
|
|
64371
|
+
- Structured return value with metadata for observability
|
|
64372
|
+
- Descriptive error messages with context
|
|
64373
|
+
- Meaningful variable names (rawData, users, processed)
|
|
64374
|
+
- Clean async/await usage
|
|
64375
|
+
- Template literals for readable string interpolation
|
|
64376
|
+
- Proper error type guards (error instanceof Error)`;
|
|
64377
|
+
var CODE_FIELD_CONSTRAINTS = `REMEMBER: The "code" field must be ONLY the function body statements.
|
|
64378
|
+
- DO NOT wrap code in arrow functions: \`(ctx) => { ... }\`
|
|
64379
|
+
- DO NOT wrap code in async functions: \`async (ctx) => { ... }\`
|
|
64380
|
+
- DO NOT include outer curly braces
|
|
64381
|
+
- DO include a return statement if the step should produce output
|
|
64382
|
+
- Each "code" field should be a string containing multiple statements separated by newlines`;
|
|
64383
|
+
function composeImplementationGuidelines() {
|
|
64384
|
+
return [
|
|
64385
|
+
RUNTIME_CONTEXT_TYPES,
|
|
64386
|
+
"",
|
|
64387
|
+
CONTEXT_USAGE_GUIDELINES,
|
|
64388
|
+
"",
|
|
64389
|
+
QUALITY_GUIDELINES,
|
|
64390
|
+
"",
|
|
64391
|
+
TOOL_CALLING_EXAMPLES,
|
|
64392
|
+
"",
|
|
64393
|
+
COMPLETE_STEP_EXAMPLE
|
|
64394
|
+
].join(`
|
|
64395
|
+
`);
|
|
64396
|
+
}
|
|
64397
|
+
|
|
64316
64398
|
// ../core/src/workflow/dynamic-generator.workflow.ts
|
|
64317
64399
|
var GenerateWorkflowDefinitionInputSchema = exports_external.object({
|
|
64318
64400
|
prompt: exports_external.string(),
|
|
64319
64401
|
availableTools: exports_external.array(exports_external.object({
|
|
64320
64402
|
name: exports_external.string(),
|
|
64321
64403
|
description: exports_external.string()
|
|
64322
|
-
})).
|
|
64404
|
+
})).nullish()
|
|
64323
64405
|
});
|
|
64324
64406
|
var GenerateWorkflowCodeInputSchema = exports_external.object({
|
|
64325
|
-
workflow: WorkflowFileSchema
|
|
64407
|
+
workflow: WorkflowFileSchema,
|
|
64408
|
+
skipReview: exports_external.boolean().nullish()
|
|
64326
64409
|
});
|
|
64410
|
+
var AsyncFunction2 = Object.getPrototypeOf(async () => {}).constructor;
|
|
64411
|
+
var WORKFLOW_IMPLEMENTATION_GUIDELINES = composeImplementationGuidelines();
|
|
64412
|
+
var WORKFLOW_CODE_SYSTEM_PROMPT = `You are an expert TypeScript developer.
|
|
64413
|
+
Your task is to implement the TypeScript code for the steps in the provided workflow definition.
|
|
64414
|
+
|
|
64415
|
+
You will receive a JSON workflow definition where the "code" field is null.
|
|
64416
|
+
You must fill in the "code" field for each step with valid TypeScript code.
|
|
64417
|
+
|
|
64418
|
+
CRITICAL: Each step "code" field must contain ONLY the function body statements (the code inside the curly braces).
|
|
64419
|
+
DO NOT include function declaration, arrow function syntax, async keyword, parameter list, or outer curly braces.
|
|
64420
|
+
|
|
64421
|
+
Prefer using \`ctx.tools.runAgent\` for complex tasks or when multiple steps/tools are needed. Use \`ctx.agentTools\` for direct tool usage (e.g. \`ctx.agentTools.readFile\`).
|
|
64422
|
+
|
|
64423
|
+
The code will be wrapped automatically in: \`async (ctx) => { YOUR_CODE_HERE }\`
|
|
64424
|
+
|
|
64425
|
+
Example of CORRECT code field:
|
|
64426
|
+
\`\`\`ts
|
|
64427
|
+
const result = await ctx.agentTools.readFile({ path: 'README.md' })
|
|
64428
|
+
if (!result) throw new Error('File not found')
|
|
64429
|
+
return result
|
|
64430
|
+
\`\`\`
|
|
64431
|
+
|
|
64432
|
+
Example of INCORRECT code field (DO NOT DO THIS):
|
|
64433
|
+
\`\`\`ts
|
|
64434
|
+
async (ctx) => {
|
|
64435
|
+
const result = await ctx.agentTools.readFile({ path: 'README.md' })
|
|
64436
|
+
return result
|
|
64437
|
+
}
|
|
64438
|
+
\`\`\`
|
|
64439
|
+
|
|
64440
|
+
${WORKFLOW_IMPLEMENTATION_GUIDELINES}
|
|
64441
|
+
|
|
64442
|
+
## Final Instructions
|
|
64443
|
+
|
|
64444
|
+
${CODE_FIELD_CONSTRAINTS}
|
|
64445
|
+
|
|
64446
|
+
Return the complete workflow JSON with the "code" fields populated.
|
|
64447
|
+
`;
|
|
64448
|
+
var WORKFLOW_REVIEW_SYSTEM_PROMPT = `You are an expert TypeScript Code Reviewer.
|
|
64449
|
+
Your task is to review the provided workflow definition and its implemented code, and improve it to meet the highest quality standards.
|
|
64450
|
+
|
|
64451
|
+
You will receive a JSON workflow definition where the "code" fields are already populated.
|
|
64452
|
+
You must review each step's code and improve it if necessary.
|
|
64453
|
+
|
|
64454
|
+
Check for:
|
|
64455
|
+
- Correct usage of \`ctx.agentTools\` (for standard tools) and \`ctx.tools\` (for workflow helpers).
|
|
64456
|
+
- Proper error handling (try-catch, input validation).
|
|
64457
|
+
- Meaningful logging.
|
|
64458
|
+
- Adherence to the Quality Guidelines.
|
|
64459
|
+
- Correct syntax (no outer function wrappers).
|
|
64460
|
+
|
|
64461
|
+
${QUALITY_GUIDELINES}
|
|
64462
|
+
|
|
64463
|
+
## Final Instructions
|
|
64464
|
+
|
|
64465
|
+
Return the complete workflow JSON with the "code" fields improved where necessary.
|
|
64466
|
+
Ensure the "code" field still contains ONLY the function body statements.
|
|
64467
|
+
`;
|
|
64327
64468
|
// ../../node_modules/lodash-es/_freeGlobal.js
|
|
64328
64469
|
var freeGlobal = typeof global == "object" && global && global.Object === Object && global;
|
|
64329
64470
|
var _freeGlobal_default = freeGlobal;
|
|
@@ -67578,15 +67719,15 @@ function useKeypress(userHandler) {
|
|
|
67578
67719
|
signal.current = userHandler;
|
|
67579
67720
|
useEffect((rl) => {
|
|
67580
67721
|
let ignore = false;
|
|
67581
|
-
const
|
|
67722
|
+
const handler13 = withUpdates((_input, event) => {
|
|
67582
67723
|
if (ignore)
|
|
67583
67724
|
return;
|
|
67584
67725
|
signal.current(event, rl);
|
|
67585
67726
|
});
|
|
67586
|
-
rl.input.on("keypress",
|
|
67727
|
+
rl.input.on("keypress", handler13);
|
|
67587
67728
|
return () => {
|
|
67588
67729
|
ignore = true;
|
|
67589
|
-
rl.input.removeListener("keypress",
|
|
67730
|
+
rl.input.removeListener("keypress", handler13);
|
|
67590
67731
|
};
|
|
67591
67732
|
}, []);
|
|
67592
67733
|
}
|
|
@@ -68177,16 +68318,16 @@ class Emitter {
|
|
|
68177
68318
|
|
|
68178
68319
|
class SignalExitBase {
|
|
68179
68320
|
}
|
|
68180
|
-
var signalExitWrap = (
|
|
68321
|
+
var signalExitWrap = (handler13) => {
|
|
68181
68322
|
return {
|
|
68182
68323
|
onExit(cb, opts) {
|
|
68183
|
-
return
|
|
68324
|
+
return handler13.onExit(cb, opts);
|
|
68184
68325
|
},
|
|
68185
68326
|
load() {
|
|
68186
|
-
return
|
|
68327
|
+
return handler13.load();
|
|
68187
68328
|
},
|
|
68188
68329
|
unload() {
|
|
68189
|
-
return
|
|
68330
|
+
return handler13.unload();
|
|
68190
68331
|
}
|
|
68191
68332
|
};
|
|
68192
68333
|
};
|
|
@@ -69633,7 +69774,7 @@ class Runner {
|
|
|
69633
69774
|
}
|
|
69634
69775
|
return resp2;
|
|
69635
69776
|
};
|
|
69636
|
-
if (resp.
|
|
69777
|
+
if (resp.success) {
|
|
69637
69778
|
return responsePrompts.toolResults(request.tool, processResponse(resp.message));
|
|
69638
69779
|
}
|
|
69639
69780
|
return {
|