@workglow/tasks 0.0.100 → 0.0.102
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/README.md +35 -40
- package/dist/browser.js +339 -137
- package/dist/browser.js.map +15 -15
- package/dist/bun.js +339 -137
- package/dist/bun.js.map +15 -15
- package/dist/common.d.ts +0 -1
- package/dist/common.d.ts.map +1 -1
- package/dist/node.js +339 -137
- package/dist/node.js.map +15 -15
- package/dist/task/DebugLogTask.d.ts +24 -49
- package/dist/task/DebugLogTask.d.ts.map +1 -1
- package/dist/task/DelayTask.d.ts +17 -29
- package/dist/task/DelayTask.d.ts.map +1 -1
- package/dist/task/InputTask.d.ts +1 -3
- package/dist/task/InputTask.d.ts.map +1 -1
- package/dist/task/JavaScriptTask.d.ts +62 -1
- package/dist/task/JavaScriptTask.d.ts.map +1 -1
- package/dist/task/LambdaTask.d.ts +41 -2
- package/dist/task/LambdaTask.d.ts.map +1 -1
- package/dist/task/OutputTask.d.ts +1 -3
- package/dist/task/OutputTask.d.ts.map +1 -1
- package/dist/task/mcp/McpListTask.d.ts +2 -2
- package/dist/task/mcp/McpPromptGetTask.d.ts +150 -66
- package/dist/task/mcp/McpPromptGetTask.d.ts.map +1 -1
- package/dist/task/mcp/McpResourceReadTask.d.ts +147 -47
- package/dist/task/mcp/McpResourceReadTask.d.ts.map +1 -1
- package/dist/task/mcp/McpToolCallTask.d.ts +148 -323
- package/dist/task/mcp/McpToolCallTask.d.ts.map +1 -1
- package/package.json +9 -9
package/dist/browser.js
CHANGED
|
@@ -1150,14 +1150,6 @@ Workflow12.prototype.multiply = CreateAdaptiveWorkflow(ScalarMultiplyTask, Vecto
|
|
|
1150
1150
|
Workflow12.prototype.divide = CreateAdaptiveWorkflow(ScalarDivideTask, VectorDivideTask);
|
|
1151
1151
|
Workflow12.prototype.sum = CreateAdaptiveWorkflow(ScalarSumTask, VectorSumTask);
|
|
1152
1152
|
|
|
1153
|
-
// src/common.ts
|
|
1154
|
-
import {
|
|
1155
|
-
createMcpClient,
|
|
1156
|
-
mcpClientFactory as mcpClientFactory5,
|
|
1157
|
-
mcpServerConfigSchema as mcpServerConfigSchema5,
|
|
1158
|
-
mcpTransportTypes
|
|
1159
|
-
} from "@workglow/util";
|
|
1160
|
-
|
|
1161
1153
|
// src/task/ArrayTask.ts
|
|
1162
1154
|
import {
|
|
1163
1155
|
uuid4
|
|
@@ -1213,7 +1205,7 @@ class ArrayTask extends GraphAsTask {
|
|
|
1213
1205
|
const inputObject = Object.fromEntries(arrayInputs);
|
|
1214
1206
|
const combinations = this.generateCombinations(inputObject, inputIds);
|
|
1215
1207
|
const tasks = combinations.map((combination) => {
|
|
1216
|
-
const { id,
|
|
1208
|
+
const { id, title, ...rest } = this.config;
|
|
1217
1209
|
const task = new this.constructor({ ...this.defaults, ...this.runInputData, ...combination }, { ...rest, id: `${id}_${uuid4()}` });
|
|
1218
1210
|
return task;
|
|
1219
1211
|
});
|
|
@@ -1286,16 +1278,13 @@ class ArrayTaskRunner extends GraphAsTaskRunner {
|
|
|
1286
1278
|
}
|
|
1287
1279
|
}
|
|
1288
1280
|
// src/task/DebugLogTask.ts
|
|
1289
|
-
import { CreateWorkflow as CreateWorkflow12, Task as Task11, Workflow as Workflow13 } from "@workglow/task-graph";
|
|
1281
|
+
import { CreateWorkflow as CreateWorkflow12, Task as Task11, TaskConfigSchema, Workflow as Workflow13 } from "@workglow/task-graph";
|
|
1290
1282
|
var log_levels = ["dir", "log", "debug", "info", "warn", "error"];
|
|
1291
1283
|
var DEFAULT_LOG_LEVEL = "log";
|
|
1292
|
-
var
|
|
1284
|
+
var debugLogTaskConfigSchema = {
|
|
1293
1285
|
type: "object",
|
|
1294
1286
|
properties: {
|
|
1295
|
-
|
|
1296
|
-
title: "Message",
|
|
1297
|
-
description: "The message to log"
|
|
1298
|
-
},
|
|
1287
|
+
...TaskConfigSchema["properties"],
|
|
1299
1288
|
log_level: {
|
|
1300
1289
|
type: "string",
|
|
1301
1290
|
enum: log_levels,
|
|
@@ -1306,15 +1295,15 @@ var inputSchema12 = {
|
|
|
1306
1295
|
},
|
|
1307
1296
|
additionalProperties: false
|
|
1308
1297
|
};
|
|
1298
|
+
var inputSchema12 = {
|
|
1299
|
+
type: "object",
|
|
1300
|
+
properties: {},
|
|
1301
|
+
additionalProperties: true
|
|
1302
|
+
};
|
|
1309
1303
|
var outputSchema12 = {
|
|
1310
1304
|
type: "object",
|
|
1311
|
-
properties: {
|
|
1312
|
-
|
|
1313
|
-
title: "Messages",
|
|
1314
|
-
description: "The messages logged by the task"
|
|
1315
|
-
}
|
|
1316
|
-
},
|
|
1317
|
-
additionalProperties: false
|
|
1305
|
+
properties: {},
|
|
1306
|
+
additionalProperties: true
|
|
1318
1307
|
};
|
|
1319
1308
|
|
|
1320
1309
|
class DebugLogTask extends Task11 {
|
|
@@ -1323,6 +1312,11 @@ class DebugLogTask extends Task11 {
|
|
|
1323
1312
|
static title = "Debug Log";
|
|
1324
1313
|
static description = "Logs messages to the console with configurable log levels for debugging task graphs";
|
|
1325
1314
|
static cacheable = false;
|
|
1315
|
+
static passthroughInputsToOutputs = true;
|
|
1316
|
+
static customizable = true;
|
|
1317
|
+
static configSchema() {
|
|
1318
|
+
return debugLogTaskConfigSchema;
|
|
1319
|
+
}
|
|
1326
1320
|
static inputSchema() {
|
|
1327
1321
|
return inputSchema12;
|
|
1328
1322
|
}
|
|
@@ -1330,13 +1324,14 @@ class DebugLogTask extends Task11 {
|
|
|
1330
1324
|
return outputSchema12;
|
|
1331
1325
|
}
|
|
1332
1326
|
async executeReactive(input, output) {
|
|
1333
|
-
const
|
|
1334
|
-
|
|
1335
|
-
|
|
1327
|
+
const log_level = this.config.log_level ?? DEFAULT_LOG_LEVEL;
|
|
1328
|
+
const inputRecord = input;
|
|
1329
|
+
if (log_level === "dir") {
|
|
1330
|
+
console.dir(inputRecord, { depth: null });
|
|
1336
1331
|
} else {
|
|
1337
|
-
console[log_level](
|
|
1332
|
+
console[log_level](inputRecord);
|
|
1338
1333
|
}
|
|
1339
|
-
output
|
|
1334
|
+
Object.assign(output, inputRecord);
|
|
1340
1335
|
return output;
|
|
1341
1336
|
}
|
|
1342
1337
|
}
|
|
@@ -1350,24 +1345,27 @@ import {
|
|
|
1350
1345
|
CreateWorkflow as CreateWorkflow13,
|
|
1351
1346
|
Task as Task12,
|
|
1352
1347
|
TaskAbortedError as TaskAbortedError2,
|
|
1348
|
+
TaskConfigSchema as TaskConfigSchema2,
|
|
1353
1349
|
Workflow as Workflow14
|
|
1354
1350
|
} from "@workglow/task-graph";
|
|
1355
1351
|
import { sleep } from "@workglow/util";
|
|
1356
|
-
var
|
|
1352
|
+
var delayTaskConfigSchema = {
|
|
1357
1353
|
type: "object",
|
|
1358
1354
|
properties: {
|
|
1355
|
+
...TaskConfigSchema2["properties"],
|
|
1359
1356
|
delay: {
|
|
1360
1357
|
type: "number",
|
|
1361
1358
|
title: "Delay (ms)",
|
|
1362
1359
|
default: 1
|
|
1363
|
-
},
|
|
1364
|
-
pass_through: {
|
|
1365
|
-
title: "Pass Through",
|
|
1366
|
-
description: "Pass through data to the output"
|
|
1367
1360
|
}
|
|
1368
1361
|
},
|
|
1369
1362
|
additionalProperties: false
|
|
1370
1363
|
};
|
|
1364
|
+
var inputSchema13 = {
|
|
1365
|
+
type: "object",
|
|
1366
|
+
properties: {},
|
|
1367
|
+
additionalProperties: true
|
|
1368
|
+
};
|
|
1371
1369
|
var outputSchema13 = {
|
|
1372
1370
|
type: "object",
|
|
1373
1371
|
properties: {},
|
|
@@ -1379,6 +1377,12 @@ class DelayTask extends Task12 {
|
|
|
1379
1377
|
static category = "Utility";
|
|
1380
1378
|
static title = "Delay";
|
|
1381
1379
|
static description = "Delays execution for a specified duration with progress tracking";
|
|
1380
|
+
static cacheable = false;
|
|
1381
|
+
static passthroughInputsToOutputs = true;
|
|
1382
|
+
static customizable = true;
|
|
1383
|
+
static configSchema() {
|
|
1384
|
+
return delayTaskConfigSchema;
|
|
1385
|
+
}
|
|
1382
1386
|
static inputSchema() {
|
|
1383
1387
|
return inputSchema13;
|
|
1384
1388
|
}
|
|
@@ -1386,7 +1390,7 @@ class DelayTask extends Task12 {
|
|
|
1386
1390
|
return outputSchema13;
|
|
1387
1391
|
}
|
|
1388
1392
|
async execute(input, executeContext) {
|
|
1389
|
-
const delay =
|
|
1393
|
+
const delay = this.config.delay ?? 1;
|
|
1390
1394
|
if (delay > 100) {
|
|
1391
1395
|
const iterations = Math.min(100, Math.floor(delay / 16));
|
|
1392
1396
|
const chunkSize = delay / iterations;
|
|
@@ -1400,10 +1404,10 @@ class DelayTask extends Task12 {
|
|
|
1400
1404
|
} else {
|
|
1401
1405
|
await sleep(delay);
|
|
1402
1406
|
}
|
|
1403
|
-
return input
|
|
1407
|
+
return input;
|
|
1404
1408
|
}
|
|
1405
1409
|
}
|
|
1406
|
-
var delay = (input, config = {}) => {
|
|
1410
|
+
var delay = (input, config = { delay: 1 }) => {
|
|
1407
1411
|
const task = new DelayTask({}, config);
|
|
1408
1412
|
return task.run(input);
|
|
1409
1413
|
};
|
|
@@ -1433,10 +1437,10 @@ class InputTask extends Task13 {
|
|
|
1433
1437
|
};
|
|
1434
1438
|
}
|
|
1435
1439
|
inputSchema() {
|
|
1436
|
-
return this.config?.
|
|
1440
|
+
return this.config?.inputSchema ?? this.constructor.inputSchema();
|
|
1437
1441
|
}
|
|
1438
1442
|
outputSchema() {
|
|
1439
|
-
return this.config?.
|
|
1443
|
+
return this.config?.outputSchema ?? this.constructor.outputSchema();
|
|
1440
1444
|
}
|
|
1441
1445
|
async execute(input) {
|
|
1442
1446
|
return input;
|
|
@@ -1467,7 +1471,7 @@ class InputTask extends Task13 {
|
|
|
1467
1471
|
}
|
|
1468
1472
|
Workflow15.prototype.input = CreateWorkflow14(InputTask);
|
|
1469
1473
|
// src/task/JavaScriptTask.ts
|
|
1470
|
-
import { CreateWorkflow as CreateWorkflow15, Task as Task14, Workflow as Workflow16 } from "@workglow/task-graph";
|
|
1474
|
+
import { CreateWorkflow as CreateWorkflow15, Task as Task14, TaskConfigSchema as TaskConfigSchema3, Workflow as Workflow16 } from "@workglow/task-graph";
|
|
1471
1475
|
|
|
1472
1476
|
// src/util/acorn.js
|
|
1473
1477
|
var options;
|
|
@@ -5930,6 +5934,20 @@ Interpreter["VALUE_IN_DESCRIPTOR"] = Interpreter.VALUE_IN_DESCRIPTOR;
|
|
|
5930
5934
|
Interpreter["Status"] = Interpreter.Status;
|
|
5931
5935
|
|
|
5932
5936
|
// src/task/JavaScriptTask.ts
|
|
5937
|
+
var configSchema = {
|
|
5938
|
+
type: "object",
|
|
5939
|
+
properties: {
|
|
5940
|
+
...TaskConfigSchema3["properties"],
|
|
5941
|
+
javascript_code: {
|
|
5942
|
+
type: "string",
|
|
5943
|
+
title: "Code",
|
|
5944
|
+
minLength: 1,
|
|
5945
|
+
description: "JavaScript code to execute",
|
|
5946
|
+
format: "code:javascript"
|
|
5947
|
+
}
|
|
5948
|
+
},
|
|
5949
|
+
additionalProperties: false
|
|
5950
|
+
};
|
|
5933
5951
|
var inputSchema14 = {
|
|
5934
5952
|
type: "object",
|
|
5935
5953
|
properties: {
|
|
@@ -5961,14 +5979,34 @@ class JavaScriptTask extends Task14 {
|
|
|
5961
5979
|
static category = "Utility";
|
|
5962
5980
|
static title = "JavaScript Interpreter";
|
|
5963
5981
|
static description = "Executes JavaScript code in a sandboxed interpreter environment";
|
|
5982
|
+
static customizable = true;
|
|
5983
|
+
static configSchema() {
|
|
5984
|
+
return configSchema;
|
|
5985
|
+
}
|
|
5964
5986
|
static inputSchema() {
|
|
5965
5987
|
return inputSchema14;
|
|
5966
5988
|
}
|
|
5967
5989
|
static outputSchema() {
|
|
5968
5990
|
return outputSchema14;
|
|
5969
5991
|
}
|
|
5992
|
+
constructor(input2 = {}, config = {}) {
|
|
5993
|
+
super(input2, config);
|
|
5994
|
+
}
|
|
5995
|
+
inputSchema() {
|
|
5996
|
+
if (this.config?.javascript_code) {
|
|
5997
|
+
if (this.config.inputSchema) {
|
|
5998
|
+
return this.config.inputSchema;
|
|
5999
|
+
}
|
|
6000
|
+
return {
|
|
6001
|
+
type: "object",
|
|
6002
|
+
properties: {},
|
|
6003
|
+
additionalProperties: true
|
|
6004
|
+
};
|
|
6005
|
+
}
|
|
6006
|
+
return inputSchema14;
|
|
6007
|
+
}
|
|
5970
6008
|
async executeReactive(input2, output) {
|
|
5971
|
-
if (input2.javascript_code) {
|
|
6009
|
+
if (this.config.javascript_code || input2.javascript_code) {
|
|
5972
6010
|
try {
|
|
5973
6011
|
const inputVariables = Object.keys(input2).filter((key) => key !== "javascript_code");
|
|
5974
6012
|
const inputVariablesString = inputVariables.map((key) => `var ${key} = ${JSON.stringify(input2[key])};`).join(`
|
|
@@ -6066,9 +6104,19 @@ import {
|
|
|
6066
6104
|
CreateWorkflow as CreateWorkflow17,
|
|
6067
6105
|
DATAFLOW_ALL_PORTS,
|
|
6068
6106
|
Task as Task15,
|
|
6107
|
+
TaskConfigSchema as TaskConfigSchema4,
|
|
6069
6108
|
TaskConfigurationError as TaskConfigurationError3,
|
|
6070
6109
|
Workflow as Workflow18
|
|
6071
6110
|
} from "@workglow/task-graph";
|
|
6111
|
+
var lambdaTaskConfigSchema = {
|
|
6112
|
+
type: "object",
|
|
6113
|
+
properties: {
|
|
6114
|
+
...TaskConfigSchema4["properties"],
|
|
6115
|
+
execute: {},
|
|
6116
|
+
executeReactive: {}
|
|
6117
|
+
},
|
|
6118
|
+
additionalProperties: false
|
|
6119
|
+
};
|
|
6072
6120
|
var inputSchema16 = {
|
|
6073
6121
|
type: "object",
|
|
6074
6122
|
properties: {
|
|
@@ -6096,6 +6144,9 @@ class LambdaTask extends Task15 {
|
|
|
6096
6144
|
static description = "A task that wraps a provided function and its input";
|
|
6097
6145
|
static category = "Hidden";
|
|
6098
6146
|
static cacheable = true;
|
|
6147
|
+
static configSchema() {
|
|
6148
|
+
return lambdaTaskConfigSchema;
|
|
6149
|
+
}
|
|
6099
6150
|
static inputSchema() {
|
|
6100
6151
|
return inputSchema16;
|
|
6101
6152
|
}
|
|
@@ -6208,10 +6259,10 @@ class OutputTask extends Task17 {
|
|
|
6208
6259
|
};
|
|
6209
6260
|
}
|
|
6210
6261
|
inputSchema() {
|
|
6211
|
-
return this.config?.
|
|
6262
|
+
return this.config?.inputSchema ?? this.constructor.inputSchema();
|
|
6212
6263
|
}
|
|
6213
6264
|
outputSchema() {
|
|
6214
|
-
return this.config?.
|
|
6265
|
+
return this.config?.outputSchema ?? this.constructor.outputSchema();
|
|
6215
6266
|
}
|
|
6216
6267
|
async execute(input2) {
|
|
6217
6268
|
return input2;
|
|
@@ -6539,28 +6590,32 @@ var mcpList = async (input2, config = {}) => {
|
|
|
6539
6590
|
};
|
|
6540
6591
|
Workflow22.prototype.mcpList = CreateWorkflow21(McpListTask);
|
|
6541
6592
|
// src/task/mcp/McpPromptGetTask.ts
|
|
6542
|
-
import {
|
|
6593
|
+
import {
|
|
6594
|
+
CreateWorkflow as CreateWorkflow22,
|
|
6595
|
+
Task as Task20,
|
|
6596
|
+
TaskConfigSchema as TaskConfigSchema5,
|
|
6597
|
+
Workflow as Workflow23
|
|
6598
|
+
} from "@workglow/task-graph";
|
|
6543
6599
|
import {
|
|
6544
6600
|
mcpClientFactory as mcpClientFactory2,
|
|
6545
6601
|
mcpServerConfigSchema as mcpServerConfigSchema2
|
|
6546
6602
|
} from "@workglow/util";
|
|
6547
|
-
var
|
|
6603
|
+
var configSchema2 = {
|
|
6548
6604
|
type: "object",
|
|
6549
6605
|
properties: {
|
|
6606
|
+
...TaskConfigSchema5["properties"],
|
|
6550
6607
|
...mcpServerConfigSchema2,
|
|
6551
6608
|
prompt_name: {
|
|
6552
6609
|
type: "string",
|
|
6553
6610
|
title: "Prompt Name",
|
|
6554
|
-
description: "The name of the prompt to get"
|
|
6555
|
-
|
|
6556
|
-
prompt_arguments: {
|
|
6557
|
-
type: "object",
|
|
6558
|
-
additionalProperties: { type: "string" },
|
|
6559
|
-
title: "Prompt Arguments",
|
|
6560
|
-
description: "Arguments to pass to the prompt"
|
|
6611
|
+
description: "The name of the prompt to get",
|
|
6612
|
+
format: "string:mcp-promptname"
|
|
6561
6613
|
}
|
|
6562
6614
|
},
|
|
6563
6615
|
required: ["transport", "prompt_name"],
|
|
6616
|
+
if: { properties: { transport: { const: "stdio" } }, required: ["transport"] },
|
|
6617
|
+
then: { required: ["command"] },
|
|
6618
|
+
else: { required: ["server_url"] },
|
|
6564
6619
|
additionalProperties: false
|
|
6565
6620
|
};
|
|
6566
6621
|
var annotationsSchema = {
|
|
@@ -6664,7 +6719,7 @@ var contentSchema = {
|
|
|
6664
6719
|
}
|
|
6665
6720
|
]
|
|
6666
6721
|
};
|
|
6667
|
-
var
|
|
6722
|
+
var fallbackOutputSchema = {
|
|
6668
6723
|
type: "object",
|
|
6669
6724
|
properties: {
|
|
6670
6725
|
messages: {
|
|
@@ -6690,6 +6745,11 @@ var outputSchema19 = {
|
|
|
6690
6745
|
required: ["messages"],
|
|
6691
6746
|
additionalProperties: false
|
|
6692
6747
|
};
|
|
6748
|
+
var fallbackInputSchema = {
|
|
6749
|
+
type: "object",
|
|
6750
|
+
properties: {},
|
|
6751
|
+
additionalProperties: false
|
|
6752
|
+
};
|
|
6693
6753
|
|
|
6694
6754
|
class McpPromptGetTask extends Task20 {
|
|
6695
6755
|
static type = "McpPromptGetTask";
|
|
@@ -6697,18 +6757,71 @@ class McpPromptGetTask extends Task20 {
|
|
|
6697
6757
|
static title = "MCP Get Prompt";
|
|
6698
6758
|
static description = "Gets a prompt from an MCP server";
|
|
6699
6759
|
static cacheable = false;
|
|
6760
|
+
static customizable = true;
|
|
6761
|
+
static hasDynamicSchemas = true;
|
|
6700
6762
|
static inputSchema() {
|
|
6701
|
-
return
|
|
6763
|
+
return fallbackInputSchema;
|
|
6702
6764
|
}
|
|
6703
6765
|
static outputSchema() {
|
|
6704
|
-
return
|
|
6766
|
+
return fallbackOutputSchema;
|
|
6767
|
+
}
|
|
6768
|
+
static configSchema() {
|
|
6769
|
+
return configSchema2;
|
|
6770
|
+
}
|
|
6771
|
+
inputSchema() {
|
|
6772
|
+
return this.config?.inputSchema ?? fallbackInputSchema;
|
|
6773
|
+
}
|
|
6774
|
+
outputSchema() {
|
|
6775
|
+
return this.config?.outputSchema ?? fallbackOutputSchema;
|
|
6776
|
+
}
|
|
6777
|
+
_schemasDiscovering = false;
|
|
6778
|
+
async discoverSchemas(signal) {
|
|
6779
|
+
if (this.config.inputSchema)
|
|
6780
|
+
return;
|
|
6781
|
+
if (this._schemasDiscovering)
|
|
6782
|
+
return;
|
|
6783
|
+
if (!this.config.transport || !this.config.prompt_name)
|
|
6784
|
+
return;
|
|
6785
|
+
this._schemasDiscovering = true;
|
|
6786
|
+
try {
|
|
6787
|
+
const result = await mcpList({
|
|
6788
|
+
transport: this.config.transport,
|
|
6789
|
+
server_url: this.config.server_url,
|
|
6790
|
+
command: this.config.command,
|
|
6791
|
+
args: this.config.args,
|
|
6792
|
+
env: this.config.env,
|
|
6793
|
+
list_type: "prompts"
|
|
6794
|
+
});
|
|
6795
|
+
const prompt = result.prompts?.find((p) => p.name === this.config.prompt_name);
|
|
6796
|
+
if (prompt) {
|
|
6797
|
+
const args = prompt.arguments ?? [];
|
|
6798
|
+
const required = args.filter((a) => a.required).map((a) => a.name);
|
|
6799
|
+
const properties = {};
|
|
6800
|
+
for (const arg of args) {
|
|
6801
|
+
properties[arg.name] = {
|
|
6802
|
+
type: "string",
|
|
6803
|
+
...arg.description ? { description: arg.description } : {}
|
|
6804
|
+
};
|
|
6805
|
+
}
|
|
6806
|
+
this.config.inputSchema = {
|
|
6807
|
+
type: "object",
|
|
6808
|
+
properties,
|
|
6809
|
+
...required.length > 0 ? { required } : {},
|
|
6810
|
+
additionalProperties: false
|
|
6811
|
+
};
|
|
6812
|
+
this.emitSchemaChange();
|
|
6813
|
+
}
|
|
6814
|
+
} finally {
|
|
6815
|
+
this._schemasDiscovering = false;
|
|
6816
|
+
}
|
|
6705
6817
|
}
|
|
6706
6818
|
async execute(input2, context) {
|
|
6707
|
-
|
|
6819
|
+
await this.discoverSchemas(context.signal);
|
|
6820
|
+
const { client } = await mcpClientFactory2.create(this.config, context.signal);
|
|
6708
6821
|
try {
|
|
6709
6822
|
const result = await client.getPrompt({
|
|
6710
|
-
name:
|
|
6711
|
-
arguments: input2
|
|
6823
|
+
name: this.config.prompt_name,
|
|
6824
|
+
arguments: input2
|
|
6712
6825
|
});
|
|
6713
6826
|
return {
|
|
6714
6827
|
messages: result.messages,
|
|
@@ -6719,28 +6832,37 @@ class McpPromptGetTask extends Task20 {
|
|
|
6719
6832
|
}
|
|
6720
6833
|
}
|
|
6721
6834
|
}
|
|
6722
|
-
var mcpPromptGet = async (input2, config
|
|
6723
|
-
|
|
6724
|
-
return result;
|
|
6835
|
+
var mcpPromptGet = async (input2, config) => {
|
|
6836
|
+
return new McpPromptGetTask({}, config).run(input2);
|
|
6725
6837
|
};
|
|
6726
6838
|
Workflow23.prototype.mcpPromptGet = CreateWorkflow22(McpPromptGetTask);
|
|
6727
6839
|
// src/task/mcp/McpResourceReadTask.ts
|
|
6728
|
-
import {
|
|
6840
|
+
import {
|
|
6841
|
+
CreateWorkflow as CreateWorkflow23,
|
|
6842
|
+
Task as Task21,
|
|
6843
|
+
TaskConfigSchema as TaskConfigSchema6,
|
|
6844
|
+
Workflow as Workflow24
|
|
6845
|
+
} from "@workglow/task-graph";
|
|
6729
6846
|
import {
|
|
6730
6847
|
mcpClientFactory as mcpClientFactory3,
|
|
6731
6848
|
mcpServerConfigSchema as mcpServerConfigSchema3
|
|
6732
6849
|
} from "@workglow/util";
|
|
6733
|
-
var
|
|
6850
|
+
var configSchema3 = {
|
|
6734
6851
|
type: "object",
|
|
6735
6852
|
properties: {
|
|
6853
|
+
...TaskConfigSchema6["properties"],
|
|
6736
6854
|
...mcpServerConfigSchema3,
|
|
6737
6855
|
resource_uri: {
|
|
6738
6856
|
type: "string",
|
|
6739
6857
|
title: "Resource URI",
|
|
6740
|
-
description: "The URI of the resource to read"
|
|
6858
|
+
description: "The URI of the resource to read",
|
|
6859
|
+
format: "string:uri:mcp-resourceuri"
|
|
6741
6860
|
}
|
|
6742
6861
|
},
|
|
6743
6862
|
required: ["transport", "resource_uri"],
|
|
6863
|
+
if: { properties: { transport: { const: "stdio" } }, required: ["transport"] },
|
|
6864
|
+
then: { required: ["command"] },
|
|
6865
|
+
else: { required: ["server_url"] },
|
|
6744
6866
|
additionalProperties: false
|
|
6745
6867
|
};
|
|
6746
6868
|
var contentItemSchema = {
|
|
@@ -6769,7 +6891,12 @@ var contentItemSchema = {
|
|
|
6769
6891
|
}
|
|
6770
6892
|
]
|
|
6771
6893
|
};
|
|
6772
|
-
var
|
|
6894
|
+
var inputSchema20 = {
|
|
6895
|
+
type: "object",
|
|
6896
|
+
properties: {},
|
|
6897
|
+
additionalProperties: false
|
|
6898
|
+
};
|
|
6899
|
+
var outputSchema19 = {
|
|
6773
6900
|
type: "object",
|
|
6774
6901
|
properties: {
|
|
6775
6902
|
contents: {
|
|
@@ -6789,49 +6916,57 @@ class McpResourceReadTask extends Task21 {
|
|
|
6789
6916
|
static title = "MCP Read Resource";
|
|
6790
6917
|
static description = "Reads a resource from an MCP server";
|
|
6791
6918
|
static cacheable = false;
|
|
6919
|
+
static customizable = true;
|
|
6792
6920
|
static inputSchema() {
|
|
6793
|
-
return
|
|
6921
|
+
return inputSchema20;
|
|
6794
6922
|
}
|
|
6795
6923
|
static outputSchema() {
|
|
6796
|
-
return
|
|
6924
|
+
return outputSchema19;
|
|
6797
6925
|
}
|
|
6798
|
-
|
|
6799
|
-
|
|
6926
|
+
static configSchema() {
|
|
6927
|
+
return configSchema3;
|
|
6928
|
+
}
|
|
6929
|
+
async execute(_input, context) {
|
|
6930
|
+
const { client } = await mcpClientFactory3.create(this.config, context.signal);
|
|
6800
6931
|
try {
|
|
6801
|
-
const result = await client.readResource({ uri:
|
|
6932
|
+
const result = await client.readResource({ uri: this.config.resource_uri });
|
|
6802
6933
|
return { contents: result.contents };
|
|
6803
6934
|
} finally {
|
|
6804
6935
|
await client.close();
|
|
6805
6936
|
}
|
|
6806
6937
|
}
|
|
6807
6938
|
}
|
|
6808
|
-
var mcpResourceRead = async (
|
|
6809
|
-
return new McpResourceReadTask({}, config).run(
|
|
6939
|
+
var mcpResourceRead = async (config) => {
|
|
6940
|
+
return new McpResourceReadTask({}, config).run({});
|
|
6810
6941
|
};
|
|
6811
6942
|
Workflow24.prototype.mcpResourceRead = CreateWorkflow23(McpResourceReadTask);
|
|
6812
6943
|
// src/task/mcp/McpToolCallTask.ts
|
|
6813
|
-
import {
|
|
6944
|
+
import {
|
|
6945
|
+
CreateWorkflow as CreateWorkflow24,
|
|
6946
|
+
Task as Task22,
|
|
6947
|
+
TaskConfigSchema as TaskConfigSchema7,
|
|
6948
|
+
Workflow as Workflow25
|
|
6949
|
+
} from "@workglow/task-graph";
|
|
6814
6950
|
import {
|
|
6815
6951
|
mcpClientFactory as mcpClientFactory4,
|
|
6816
6952
|
mcpServerConfigSchema as mcpServerConfigSchema4
|
|
6817
6953
|
} from "@workglow/util";
|
|
6818
|
-
var
|
|
6954
|
+
var configSchema4 = {
|
|
6819
6955
|
type: "object",
|
|
6820
6956
|
properties: {
|
|
6957
|
+
...TaskConfigSchema7["properties"],
|
|
6821
6958
|
...mcpServerConfigSchema4,
|
|
6822
6959
|
tool_name: {
|
|
6823
6960
|
type: "string",
|
|
6824
6961
|
title: "Tool Name",
|
|
6825
|
-
description: "The name of the tool to call"
|
|
6826
|
-
|
|
6827
|
-
tool_arguments: {
|
|
6828
|
-
type: "object",
|
|
6829
|
-
additionalProperties: true,
|
|
6830
|
-
title: "Tool Arguments",
|
|
6831
|
-
description: "Arguments to pass to the tool"
|
|
6962
|
+
description: "The name of the tool to call",
|
|
6963
|
+
format: "string:mcp-toolname"
|
|
6832
6964
|
}
|
|
6833
6965
|
},
|
|
6834
6966
|
required: ["transport", "tool_name"],
|
|
6967
|
+
if: { properties: { transport: { const: "stdio" } }, required: ["transport"] },
|
|
6968
|
+
then: { required: ["command"] },
|
|
6969
|
+
else: { required: ["server_url"] },
|
|
6835
6970
|
additionalProperties: false
|
|
6836
6971
|
};
|
|
6837
6972
|
var annotationsSchema2 = {
|
|
@@ -6935,7 +7070,7 @@ var toolContentSchema = {
|
|
|
6935
7070
|
}
|
|
6936
7071
|
]
|
|
6937
7072
|
};
|
|
6938
|
-
var
|
|
7073
|
+
var fallbackOutputSchema2 = {
|
|
6939
7074
|
type: "object",
|
|
6940
7075
|
properties: {
|
|
6941
7076
|
content: {
|
|
@@ -6953,6 +7088,11 @@ var outputSchema21 = {
|
|
|
6953
7088
|
required: ["content", "isError"],
|
|
6954
7089
|
additionalProperties: false
|
|
6955
7090
|
};
|
|
7091
|
+
var fallbackInputSchema2 = {
|
|
7092
|
+
type: "object",
|
|
7093
|
+
properties: {},
|
|
7094
|
+
additionalProperties: true
|
|
7095
|
+
};
|
|
6956
7096
|
|
|
6957
7097
|
class McpToolCallTask extends Task22 {
|
|
6958
7098
|
static type = "McpToolCallTask";
|
|
@@ -6960,38 +7100,103 @@ class McpToolCallTask extends Task22 {
|
|
|
6960
7100
|
static title = "MCP Call Tool";
|
|
6961
7101
|
static description = "Calls a tool on an MCP server and returns the result";
|
|
6962
7102
|
static cacheable = false;
|
|
7103
|
+
static customizable = true;
|
|
7104
|
+
static hasDynamicSchemas = true;
|
|
6963
7105
|
static inputSchema() {
|
|
6964
|
-
return
|
|
7106
|
+
return fallbackInputSchema2;
|
|
6965
7107
|
}
|
|
6966
7108
|
static outputSchema() {
|
|
6967
|
-
return
|
|
7109
|
+
return fallbackOutputSchema2;
|
|
7110
|
+
}
|
|
7111
|
+
static configSchema() {
|
|
7112
|
+
return configSchema4;
|
|
7113
|
+
}
|
|
7114
|
+
inputSchema() {
|
|
7115
|
+
return this.config?.inputSchema ?? fallbackInputSchema2;
|
|
7116
|
+
}
|
|
7117
|
+
outputSchema() {
|
|
7118
|
+
return this.config?.outputSchema ?? fallbackOutputSchema2;
|
|
7119
|
+
}
|
|
7120
|
+
_schemasDiscovering = false;
|
|
7121
|
+
async discoverSchemas(signal) {
|
|
7122
|
+
if (this.config.inputSchema && this.config.outputSchema)
|
|
7123
|
+
return;
|
|
7124
|
+
if (this._schemasDiscovering)
|
|
7125
|
+
return;
|
|
7126
|
+
if (!this.config.transport || !this.config.tool_name)
|
|
7127
|
+
return;
|
|
7128
|
+
this._schemasDiscovering = true;
|
|
7129
|
+
try {
|
|
7130
|
+
const result = await mcpList({
|
|
7131
|
+
transport: this.config.transport,
|
|
7132
|
+
server_url: this.config.server_url,
|
|
7133
|
+
command: this.config.command,
|
|
7134
|
+
args: this.config.args,
|
|
7135
|
+
env: this.config.env,
|
|
7136
|
+
list_type: "tools"
|
|
7137
|
+
});
|
|
7138
|
+
const tool = result.tools?.find((t) => t.name === this.config.tool_name);
|
|
7139
|
+
if (tool) {
|
|
7140
|
+
if (!this.config.inputSchema) {
|
|
7141
|
+
this.config.inputSchema = tool.inputSchema;
|
|
7142
|
+
}
|
|
7143
|
+
if (!this.config.outputSchema && tool.outputSchema) {
|
|
7144
|
+
this.config.outputSchema = tool.outputSchema;
|
|
7145
|
+
}
|
|
7146
|
+
this.emitSchemaChange();
|
|
7147
|
+
}
|
|
7148
|
+
} finally {
|
|
7149
|
+
this._schemasDiscovering = false;
|
|
7150
|
+
}
|
|
6968
7151
|
}
|
|
6969
7152
|
async execute(input2, context) {
|
|
6970
|
-
|
|
7153
|
+
await this.discoverSchemas(context.signal);
|
|
7154
|
+
const { client } = await mcpClientFactory4.create(this.config, context.signal);
|
|
6971
7155
|
try {
|
|
6972
7156
|
const result = await client.callTool({
|
|
6973
|
-
name:
|
|
6974
|
-
arguments: input2
|
|
7157
|
+
name: this.config.tool_name,
|
|
7158
|
+
arguments: input2
|
|
6975
7159
|
});
|
|
6976
7160
|
if (!("content" in result) || !Array.isArray(result.content)) {
|
|
6977
7161
|
throw new Error("Expected tool result with content array");
|
|
6978
7162
|
}
|
|
7163
|
+
const content = result.content;
|
|
7164
|
+
const isError = result.isError === true;
|
|
7165
|
+
const structuredContent = "structuredContent" in result && result.structuredContent && typeof result.structuredContent === "object" && !Array.isArray(result.structuredContent) ? result.structuredContent : undefined;
|
|
7166
|
+
let parsedFromText;
|
|
7167
|
+
if (!structuredContent && content.length === 1) {
|
|
7168
|
+
const item = content[0];
|
|
7169
|
+
if (item && typeof item === "object" && "type" in item && item.type === "text" && "text" in item) {
|
|
7170
|
+
const text = String(item.text);
|
|
7171
|
+
const trimmed = text.trim();
|
|
7172
|
+
if (trimmed.startsWith("{") && trimmed.endsWith("}") || trimmed.startsWith("[") && trimmed.endsWith("]")) {
|
|
7173
|
+
try {
|
|
7174
|
+
const parsed = JSON.parse(text);
|
|
7175
|
+
if (parsed !== null && typeof parsed === "object" && !Array.isArray(parsed)) {
|
|
7176
|
+
parsedFromText = parsed;
|
|
7177
|
+
}
|
|
7178
|
+
} catch {}
|
|
7179
|
+
}
|
|
7180
|
+
}
|
|
7181
|
+
}
|
|
6979
7182
|
return {
|
|
6980
|
-
content
|
|
6981
|
-
isError
|
|
7183
|
+
content,
|
|
7184
|
+
isError,
|
|
7185
|
+
...parsedFromText,
|
|
7186
|
+
...structuredContent
|
|
6982
7187
|
};
|
|
6983
7188
|
} finally {
|
|
6984
7189
|
await client.close();
|
|
6985
7190
|
}
|
|
6986
7191
|
}
|
|
6987
7192
|
}
|
|
6988
|
-
var mcpToolCall = async (input2, config
|
|
7193
|
+
var mcpToolCall = async (input2, config) => {
|
|
6989
7194
|
return new McpToolCallTask({}, config).run(input2);
|
|
6990
7195
|
};
|
|
6991
7196
|
Workflow25.prototype.mcpToolCall = CreateWorkflow24(McpToolCallTask);
|
|
6992
7197
|
// src/task/scalar/ScalarAbsTask.ts
|
|
6993
7198
|
import { CreateWorkflow as CreateWorkflow25, Task as Task23, Workflow as Workflow26 } from "@workglow/task-graph";
|
|
6994
|
-
var
|
|
7199
|
+
var inputSchema21 = {
|
|
6995
7200
|
type: "object",
|
|
6996
7201
|
properties: {
|
|
6997
7202
|
value: {
|
|
@@ -7003,7 +7208,7 @@ var inputSchema23 = {
|
|
|
7003
7208
|
required: ["value"],
|
|
7004
7209
|
additionalProperties: false
|
|
7005
7210
|
};
|
|
7006
|
-
var
|
|
7211
|
+
var outputSchema20 = {
|
|
7007
7212
|
type: "object",
|
|
7008
7213
|
properties: {
|
|
7009
7214
|
result: {
|
|
@@ -7022,10 +7227,10 @@ class ScalarAbsTask extends Task23 {
|
|
|
7022
7227
|
static title = "Abs";
|
|
7023
7228
|
static description = "Returns the absolute value of a number";
|
|
7024
7229
|
static inputSchema() {
|
|
7025
|
-
return
|
|
7230
|
+
return inputSchema21;
|
|
7026
7231
|
}
|
|
7027
7232
|
static outputSchema() {
|
|
7028
|
-
return
|
|
7233
|
+
return outputSchema20;
|
|
7029
7234
|
}
|
|
7030
7235
|
async execute(input2, _context) {
|
|
7031
7236
|
return { result: Math.abs(input2.value) };
|
|
@@ -7034,7 +7239,7 @@ class ScalarAbsTask extends Task23 {
|
|
|
7034
7239
|
Workflow26.prototype.scalarAbs = CreateWorkflow25(ScalarAbsTask);
|
|
7035
7240
|
// src/task/scalar/ScalarCeilTask.ts
|
|
7036
7241
|
import { CreateWorkflow as CreateWorkflow26, Task as Task24, Workflow as Workflow27 } from "@workglow/task-graph";
|
|
7037
|
-
var
|
|
7242
|
+
var inputSchema22 = {
|
|
7038
7243
|
type: "object",
|
|
7039
7244
|
properties: {
|
|
7040
7245
|
value: {
|
|
@@ -7046,7 +7251,7 @@ var inputSchema24 = {
|
|
|
7046
7251
|
required: ["value"],
|
|
7047
7252
|
additionalProperties: false
|
|
7048
7253
|
};
|
|
7049
|
-
var
|
|
7254
|
+
var outputSchema21 = {
|
|
7050
7255
|
type: "object",
|
|
7051
7256
|
properties: {
|
|
7052
7257
|
result: {
|
|
@@ -7065,10 +7270,10 @@ class ScalarCeilTask extends Task24 {
|
|
|
7065
7270
|
static title = "Ceil";
|
|
7066
7271
|
static description = "Returns the smallest integer greater than or equal to a number";
|
|
7067
7272
|
static inputSchema() {
|
|
7068
|
-
return
|
|
7273
|
+
return inputSchema22;
|
|
7069
7274
|
}
|
|
7070
7275
|
static outputSchema() {
|
|
7071
|
-
return
|
|
7276
|
+
return outputSchema21;
|
|
7072
7277
|
}
|
|
7073
7278
|
async execute(input2, _context) {
|
|
7074
7279
|
return { result: Math.ceil(input2.value) };
|
|
@@ -7077,7 +7282,7 @@ class ScalarCeilTask extends Task24 {
|
|
|
7077
7282
|
Workflow27.prototype.scalarCeil = CreateWorkflow26(ScalarCeilTask);
|
|
7078
7283
|
// src/task/scalar/ScalarFloorTask.ts
|
|
7079
7284
|
import { CreateWorkflow as CreateWorkflow27, Task as Task25, Workflow as Workflow28 } from "@workglow/task-graph";
|
|
7080
|
-
var
|
|
7285
|
+
var inputSchema23 = {
|
|
7081
7286
|
type: "object",
|
|
7082
7287
|
properties: {
|
|
7083
7288
|
value: {
|
|
@@ -7089,7 +7294,7 @@ var inputSchema25 = {
|
|
|
7089
7294
|
required: ["value"],
|
|
7090
7295
|
additionalProperties: false
|
|
7091
7296
|
};
|
|
7092
|
-
var
|
|
7297
|
+
var outputSchema22 = {
|
|
7093
7298
|
type: "object",
|
|
7094
7299
|
properties: {
|
|
7095
7300
|
result: {
|
|
@@ -7108,10 +7313,10 @@ class ScalarFloorTask extends Task25 {
|
|
|
7108
7313
|
static title = "Floor";
|
|
7109
7314
|
static description = "Returns the largest integer less than or equal to a number";
|
|
7110
7315
|
static inputSchema() {
|
|
7111
|
-
return
|
|
7316
|
+
return inputSchema23;
|
|
7112
7317
|
}
|
|
7113
7318
|
static outputSchema() {
|
|
7114
|
-
return
|
|
7319
|
+
return outputSchema22;
|
|
7115
7320
|
}
|
|
7116
7321
|
async execute(input2, _context) {
|
|
7117
7322
|
return { result: Math.floor(input2.value) };
|
|
@@ -7120,7 +7325,7 @@ class ScalarFloorTask extends Task25 {
|
|
|
7120
7325
|
Workflow28.prototype.scalarFloor = CreateWorkflow27(ScalarFloorTask);
|
|
7121
7326
|
// src/task/scalar/ScalarMaxTask.ts
|
|
7122
7327
|
import { CreateWorkflow as CreateWorkflow28, Task as Task26, Workflow as Workflow29 } from "@workglow/task-graph";
|
|
7123
|
-
var
|
|
7328
|
+
var inputSchema24 = {
|
|
7124
7329
|
type: "object",
|
|
7125
7330
|
properties: {
|
|
7126
7331
|
values: {
|
|
@@ -7133,7 +7338,7 @@ var inputSchema26 = {
|
|
|
7133
7338
|
required: ["values"],
|
|
7134
7339
|
additionalProperties: false
|
|
7135
7340
|
};
|
|
7136
|
-
var
|
|
7341
|
+
var outputSchema23 = {
|
|
7137
7342
|
type: "object",
|
|
7138
7343
|
properties: {
|
|
7139
7344
|
result: {
|
|
@@ -7152,10 +7357,10 @@ class ScalarMaxTask extends Task26 {
|
|
|
7152
7357
|
static title = "Max";
|
|
7153
7358
|
static description = "Returns the largest of the given numbers";
|
|
7154
7359
|
static inputSchema() {
|
|
7155
|
-
return
|
|
7360
|
+
return inputSchema24;
|
|
7156
7361
|
}
|
|
7157
7362
|
static outputSchema() {
|
|
7158
|
-
return
|
|
7363
|
+
return outputSchema23;
|
|
7159
7364
|
}
|
|
7160
7365
|
async execute(input2, _context) {
|
|
7161
7366
|
return { result: Math.max(...input2.values) };
|
|
@@ -7164,7 +7369,7 @@ class ScalarMaxTask extends Task26 {
|
|
|
7164
7369
|
Workflow29.prototype.scalarMax = CreateWorkflow28(ScalarMaxTask);
|
|
7165
7370
|
// src/task/scalar/ScalarMinTask.ts
|
|
7166
7371
|
import { CreateWorkflow as CreateWorkflow29, Task as Task27, Workflow as Workflow30 } from "@workglow/task-graph";
|
|
7167
|
-
var
|
|
7372
|
+
var inputSchema25 = {
|
|
7168
7373
|
type: "object",
|
|
7169
7374
|
properties: {
|
|
7170
7375
|
values: {
|
|
@@ -7177,7 +7382,7 @@ var inputSchema27 = {
|
|
|
7177
7382
|
required: ["values"],
|
|
7178
7383
|
additionalProperties: false
|
|
7179
7384
|
};
|
|
7180
|
-
var
|
|
7385
|
+
var outputSchema24 = {
|
|
7181
7386
|
type: "object",
|
|
7182
7387
|
properties: {
|
|
7183
7388
|
result: {
|
|
@@ -7196,10 +7401,10 @@ class ScalarMinTask extends Task27 {
|
|
|
7196
7401
|
static title = "Min";
|
|
7197
7402
|
static description = "Returns the smallest of the given numbers";
|
|
7198
7403
|
static inputSchema() {
|
|
7199
|
-
return
|
|
7404
|
+
return inputSchema25;
|
|
7200
7405
|
}
|
|
7201
7406
|
static outputSchema() {
|
|
7202
|
-
return
|
|
7407
|
+
return outputSchema24;
|
|
7203
7408
|
}
|
|
7204
7409
|
async execute(input2, _context) {
|
|
7205
7410
|
return { result: Math.min(...input2.values) };
|
|
@@ -7208,7 +7413,7 @@ class ScalarMinTask extends Task27 {
|
|
|
7208
7413
|
Workflow30.prototype.scalarMin = CreateWorkflow29(ScalarMinTask);
|
|
7209
7414
|
// src/task/scalar/ScalarRoundTask.ts
|
|
7210
7415
|
import { CreateWorkflow as CreateWorkflow30, Task as Task28, Workflow as Workflow31 } from "@workglow/task-graph";
|
|
7211
|
-
var
|
|
7416
|
+
var inputSchema26 = {
|
|
7212
7417
|
type: "object",
|
|
7213
7418
|
properties: {
|
|
7214
7419
|
value: {
|
|
@@ -7220,7 +7425,7 @@ var inputSchema28 = {
|
|
|
7220
7425
|
required: ["value"],
|
|
7221
7426
|
additionalProperties: false
|
|
7222
7427
|
};
|
|
7223
|
-
var
|
|
7428
|
+
var outputSchema25 = {
|
|
7224
7429
|
type: "object",
|
|
7225
7430
|
properties: {
|
|
7226
7431
|
result: {
|
|
@@ -7239,10 +7444,10 @@ class ScalarRoundTask extends Task28 {
|
|
|
7239
7444
|
static title = "Round";
|
|
7240
7445
|
static description = "Returns the value of a number rounded to the nearest integer";
|
|
7241
7446
|
static inputSchema() {
|
|
7242
|
-
return
|
|
7447
|
+
return inputSchema26;
|
|
7243
7448
|
}
|
|
7244
7449
|
static outputSchema() {
|
|
7245
|
-
return
|
|
7450
|
+
return outputSchema25;
|
|
7246
7451
|
}
|
|
7247
7452
|
async execute(input2, _context) {
|
|
7248
7453
|
return { result: Math.round(input2.value) };
|
|
@@ -7251,7 +7456,7 @@ class ScalarRoundTask extends Task28 {
|
|
|
7251
7456
|
Workflow31.prototype.scalarRound = CreateWorkflow30(ScalarRoundTask);
|
|
7252
7457
|
// src/task/scalar/ScalarTruncTask.ts
|
|
7253
7458
|
import { CreateWorkflow as CreateWorkflow31, Task as Task29, Workflow as Workflow32 } from "@workglow/task-graph";
|
|
7254
|
-
var
|
|
7459
|
+
var inputSchema27 = {
|
|
7255
7460
|
type: "object",
|
|
7256
7461
|
properties: {
|
|
7257
7462
|
value: {
|
|
@@ -7263,7 +7468,7 @@ var inputSchema29 = {
|
|
|
7263
7468
|
required: ["value"],
|
|
7264
7469
|
additionalProperties: false
|
|
7265
7470
|
};
|
|
7266
|
-
var
|
|
7471
|
+
var outputSchema26 = {
|
|
7267
7472
|
type: "object",
|
|
7268
7473
|
properties: {
|
|
7269
7474
|
result: {
|
|
@@ -7282,10 +7487,10 @@ class ScalarTruncTask extends Task29 {
|
|
|
7282
7487
|
static title = "Truncate";
|
|
7283
7488
|
static description = "Returns the integer part of a number by removing fractional digits";
|
|
7284
7489
|
static inputSchema() {
|
|
7285
|
-
return
|
|
7490
|
+
return inputSchema27;
|
|
7286
7491
|
}
|
|
7287
7492
|
static outputSchema() {
|
|
7288
|
-
return
|
|
7493
|
+
return outputSchema26;
|
|
7289
7494
|
}
|
|
7290
7495
|
async execute(input2, _context) {
|
|
7291
7496
|
return { result: Math.trunc(input2.value) };
|
|
@@ -7297,7 +7502,7 @@ import { CreateWorkflow as CreateWorkflow32, Task as Task30, Workflow as Workflo
|
|
|
7297
7502
|
import {
|
|
7298
7503
|
TypedArraySchema as TypedArraySchema5
|
|
7299
7504
|
} from "@workglow/util";
|
|
7300
|
-
var
|
|
7505
|
+
var inputSchema28 = {
|
|
7301
7506
|
type: "object",
|
|
7302
7507
|
properties: {
|
|
7303
7508
|
vectors: {
|
|
@@ -7313,7 +7518,7 @@ var inputSchema30 = {
|
|
|
7313
7518
|
required: ["vectors"],
|
|
7314
7519
|
additionalProperties: false
|
|
7315
7520
|
};
|
|
7316
|
-
var
|
|
7521
|
+
var outputSchema27 = {
|
|
7317
7522
|
type: "object",
|
|
7318
7523
|
properties: {
|
|
7319
7524
|
result: {
|
|
@@ -7332,10 +7537,10 @@ class VectorDistanceTask extends Task30 {
|
|
|
7332
7537
|
static title = "Distance";
|
|
7333
7538
|
static description = "Returns the Euclidean distance between the first two vectors";
|
|
7334
7539
|
static inputSchema() {
|
|
7335
|
-
return
|
|
7540
|
+
return inputSchema28;
|
|
7336
7541
|
}
|
|
7337
7542
|
static outputSchema() {
|
|
7338
|
-
return
|
|
7543
|
+
return outputSchema27;
|
|
7339
7544
|
}
|
|
7340
7545
|
async execute(input2, _context) {
|
|
7341
7546
|
const { vectors } = input2;
|
|
@@ -7359,7 +7564,7 @@ import { CreateWorkflow as CreateWorkflow33, Task as Task31, Workflow as Workflo
|
|
|
7359
7564
|
import {
|
|
7360
7565
|
TypedArraySchema as TypedArraySchema6
|
|
7361
7566
|
} from "@workglow/util";
|
|
7362
|
-
var
|
|
7567
|
+
var inputSchema29 = {
|
|
7363
7568
|
type: "object",
|
|
7364
7569
|
properties: {
|
|
7365
7570
|
vectors: {
|
|
@@ -7375,7 +7580,7 @@ var inputSchema31 = {
|
|
|
7375
7580
|
required: ["vectors"],
|
|
7376
7581
|
additionalProperties: false
|
|
7377
7582
|
};
|
|
7378
|
-
var
|
|
7583
|
+
var outputSchema28 = {
|
|
7379
7584
|
type: "object",
|
|
7380
7585
|
properties: {
|
|
7381
7586
|
result: {
|
|
@@ -7394,10 +7599,10 @@ class VectorDotProductTask extends Task31 {
|
|
|
7394
7599
|
static title = "Dot Product";
|
|
7395
7600
|
static description = "Returns the dot (inner) product of the first two vectors";
|
|
7396
7601
|
static inputSchema() {
|
|
7397
|
-
return
|
|
7602
|
+
return inputSchema29;
|
|
7398
7603
|
}
|
|
7399
7604
|
static outputSchema() {
|
|
7400
|
-
return
|
|
7605
|
+
return outputSchema28;
|
|
7401
7606
|
}
|
|
7402
7607
|
async execute(input2, _context) {
|
|
7403
7608
|
const { vectors } = input2;
|
|
@@ -7419,7 +7624,7 @@ import {
|
|
|
7419
7624
|
TypedArraySchema as TypedArraySchema7,
|
|
7420
7625
|
normalize
|
|
7421
7626
|
} from "@workglow/util";
|
|
7422
|
-
var
|
|
7627
|
+
var inputSchema30 = {
|
|
7423
7628
|
type: "object",
|
|
7424
7629
|
properties: {
|
|
7425
7630
|
vector: TypedArraySchema7({
|
|
@@ -7430,7 +7635,7 @@ var inputSchema32 = {
|
|
|
7430
7635
|
required: ["vector"],
|
|
7431
7636
|
additionalProperties: false
|
|
7432
7637
|
};
|
|
7433
|
-
var
|
|
7638
|
+
var outputSchema29 = {
|
|
7434
7639
|
type: "object",
|
|
7435
7640
|
properties: {
|
|
7436
7641
|
result: TypedArraySchema7({
|
|
@@ -7448,10 +7653,10 @@ class VectorNormalizeTask extends Task32 {
|
|
|
7448
7653
|
static title = "Normalize";
|
|
7449
7654
|
static description = "Returns the L2-normalized (unit length) vector";
|
|
7450
7655
|
static inputSchema() {
|
|
7451
|
-
return
|
|
7656
|
+
return inputSchema30;
|
|
7452
7657
|
}
|
|
7453
7658
|
static outputSchema() {
|
|
7454
|
-
return
|
|
7659
|
+
return outputSchema29;
|
|
7455
7660
|
}
|
|
7456
7661
|
async execute(input2, _context) {
|
|
7457
7662
|
return { result: normalize(input2.vector) };
|
|
@@ -7464,7 +7669,7 @@ import {
|
|
|
7464
7669
|
createTypedArrayFrom as createTypedArrayFrom5,
|
|
7465
7670
|
TypedArraySchema as TypedArraySchema8
|
|
7466
7671
|
} from "@workglow/util";
|
|
7467
|
-
var
|
|
7672
|
+
var inputSchema31 = {
|
|
7468
7673
|
type: "object",
|
|
7469
7674
|
properties: {
|
|
7470
7675
|
vector: TypedArraySchema8({
|
|
@@ -7480,7 +7685,7 @@ var inputSchema33 = {
|
|
|
7480
7685
|
required: ["vector", "scalar"],
|
|
7481
7686
|
additionalProperties: false
|
|
7482
7687
|
};
|
|
7483
|
-
var
|
|
7688
|
+
var outputSchema30 = {
|
|
7484
7689
|
type: "object",
|
|
7485
7690
|
properties: {
|
|
7486
7691
|
result: TypedArraySchema8({
|
|
@@ -7498,10 +7703,10 @@ class VectorScaleTask extends Task33 {
|
|
|
7498
7703
|
static title = "Scale";
|
|
7499
7704
|
static description = "Multiplies each element of a vector by a scalar";
|
|
7500
7705
|
static inputSchema() {
|
|
7501
|
-
return
|
|
7706
|
+
return inputSchema31;
|
|
7502
7707
|
}
|
|
7503
7708
|
static outputSchema() {
|
|
7504
|
-
return
|
|
7709
|
+
return outputSchema30;
|
|
7505
7710
|
}
|
|
7506
7711
|
async execute(input2, _context) {
|
|
7507
7712
|
const { vector, scalar } = input2;
|
|
@@ -7561,13 +7766,11 @@ export {
|
|
|
7561
7766
|
registerCommonTasks,
|
|
7562
7767
|
process,
|
|
7563
7768
|
merge,
|
|
7564
|
-
mcpTransportTypes,
|
|
7565
7769
|
mcpToolCall,
|
|
7566
|
-
mcpServerConfigSchema5 as mcpServerConfigSchema,
|
|
7567
7770
|
mcpResourceRead,
|
|
7568
7771
|
mcpPromptGet,
|
|
7569
7772
|
mcpList,
|
|
7570
|
-
|
|
7773
|
+
lambdaTaskConfigSchema,
|
|
7571
7774
|
lambda,
|
|
7572
7775
|
json,
|
|
7573
7776
|
javaScript,
|
|
@@ -7575,7 +7778,6 @@ export {
|
|
|
7575
7778
|
fetchUrl,
|
|
7576
7779
|
delay,
|
|
7577
7780
|
debugLog,
|
|
7578
|
-
createMcpClient,
|
|
7579
7781
|
VectorSumTask,
|
|
7580
7782
|
VectorSubtractTask,
|
|
7581
7783
|
VectorScaleTask,
|
|
@@ -7616,4 +7818,4 @@ export {
|
|
|
7616
7818
|
ArrayTask
|
|
7617
7819
|
};
|
|
7618
7820
|
|
|
7619
|
-
//# debugId=
|
|
7821
|
+
//# debugId=1E3D4020BD1C3CB964756E2164756E21
|