@workglow/tasks 0.1.1 → 0.2.0
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/browser.d.ts +1 -1
- package/dist/browser.d.ts.map +1 -1
- package/dist/browser.js +936 -334
- package/dist/browser.js.map +34 -30
- package/dist/bun.d.ts +1 -1
- package/dist/bun.d.ts.map +1 -1
- package/dist/bun.js +952 -350
- package/dist/bun.js.map +35 -31
- package/dist/common.d.ts +6 -1
- package/dist/common.d.ts.map +1 -1
- package/dist/mcp-server/McpServerRegistry.d.ts.map +1 -1
- package/dist/mcp-server/McpServerRepository.d.ts +5 -3
- package/dist/mcp-server/McpServerRepository.d.ts.map +1 -1
- package/dist/mcp-server/McpServerSchema.d.ts.map +1 -1
- package/dist/mcp-server/getMcpServerConfig.d.ts.map +1 -1
- package/dist/mcp-server/mcpServerReferenceObjectSchema.d.ts.map +1 -1
- package/dist/node.d.ts +1 -1
- package/dist/node.d.ts.map +1 -1
- package/dist/node.js +952 -350
- package/dist/node.js.map +35 -31
- package/dist/task/ArrayTask.d.ts +5 -4
- package/dist/task/ArrayTask.d.ts.map +1 -1
- package/dist/task/DateFormatTask.d.ts.map +1 -1
- package/dist/task/DebugLogTask.d.ts +1 -3
- package/dist/task/DebugLogTask.d.ts.map +1 -1
- package/dist/task/DelayTask.d.ts +1 -3
- package/dist/task/DelayTask.d.ts.map +1 -1
- package/dist/task/FetchUrlTask.d.ts +4 -23
- package/dist/task/FetchUrlTask.d.ts.map +1 -1
- package/dist/task/FileLoaderTask.d.ts +1 -4
- package/dist/task/FileLoaderTask.d.ts.map +1 -1
- package/dist/task/FileLoaderTask.server.d.ts +1 -4
- package/dist/task/FileLoaderTask.server.d.ts.map +1 -1
- package/dist/task/HumanApprovalTask.d.ts +68 -0
- package/dist/task/HumanApprovalTask.d.ts.map +1 -0
- package/dist/task/HumanInputTask.d.ts +164 -0
- package/dist/task/HumanInputTask.d.ts.map +1 -0
- package/dist/task/InputTask.d.ts +2 -1
- package/dist/task/InputTask.d.ts.map +1 -1
- package/dist/task/JavaScriptTask.d.ts +9 -5
- package/dist/task/JavaScriptTask.d.ts.map +1 -1
- package/dist/task/JsonPathTask.d.ts.map +1 -1
- package/dist/task/JsonTask.d.ts +3 -5
- package/dist/task/JsonTask.d.ts.map +1 -1
- package/dist/task/LambdaTask.d.ts +6 -1
- package/dist/task/LambdaTask.d.ts.map +1 -1
- package/dist/task/McpElicitationConnector.d.ts +39 -0
- package/dist/task/McpElicitationConnector.d.ts.map +1 -0
- package/dist/task/MergeTask.d.ts +1 -3
- package/dist/task/MergeTask.d.ts.map +1 -1
- package/dist/task/OutputTask.d.ts +3 -1
- package/dist/task/OutputTask.d.ts.map +1 -1
- package/dist/task/RegexTask.d.ts.map +1 -1
- package/dist/task/SplitTask.d.ts +2 -6
- package/dist/task/SplitTask.d.ts.map +1 -1
- package/dist/task/TemplateTask.d.ts.map +1 -1
- package/dist/task/mcp/McpListTask.d.ts +5 -82
- package/dist/task/mcp/McpListTask.d.ts.map +1 -1
- package/dist/task/mcp/McpPromptGetTask.d.ts +7 -84
- package/dist/task/mcp/McpPromptGetTask.d.ts.map +1 -1
- package/dist/task/mcp/McpResourceReadTask.d.ts +5 -17
- package/dist/task/mcp/McpResourceReadTask.d.ts.map +1 -1
- package/dist/task/mcp/McpSearchTask.d.ts +3 -3
- package/dist/task/mcp/McpSearchTask.d.ts.map +1 -1
- package/dist/task/mcp/McpToolCallTask.d.ts +6 -2
- package/dist/task/mcp/McpToolCallTask.d.ts.map +1 -1
- package/dist/task/scalar/ScalarAbsTask.d.ts.map +1 -1
- package/dist/task/scalar/ScalarAddTask.d.ts.map +1 -1
- package/dist/task/scalar/ScalarCeilTask.d.ts.map +1 -1
- package/dist/task/scalar/ScalarDivideTask.d.ts.map +1 -1
- package/dist/task/scalar/ScalarFloorTask.d.ts.map +1 -1
- package/dist/task/scalar/ScalarMaxTask.d.ts.map +1 -1
- package/dist/task/scalar/ScalarMinTask.d.ts.map +1 -1
- package/dist/task/scalar/ScalarMultiplyTask.d.ts.map +1 -1
- package/dist/task/scalar/ScalarRoundTask.d.ts.map +1 -1
- package/dist/task/scalar/ScalarSubtractTask.d.ts.map +1 -1
- package/dist/task/scalar/ScalarSumTask.d.ts.map +1 -1
- package/dist/task/scalar/ScalarTruncTask.d.ts.map +1 -1
- package/dist/task/string/StringConcatTask.d.ts.map +1 -1
- package/dist/task/string/StringIncludesTask.d.ts.map +1 -1
- package/dist/task/string/StringJoinTask.d.ts.map +1 -1
- package/dist/task/string/StringLengthTask.d.ts.map +1 -1
- package/dist/task/string/StringLowerCaseTask.d.ts.map +1 -1
- package/dist/task/string/StringReplaceTask.d.ts.map +1 -1
- package/dist/task/string/StringSliceTask.d.ts.map +1 -1
- package/dist/task/string/StringTemplateTask.d.ts.map +1 -1
- package/dist/task/string/StringTrimTask.d.ts.map +1 -1
- package/dist/task/string/StringUpperCaseTask.d.ts.map +1 -1
- package/dist/task/vector/VectorDistanceTask.d.ts.map +1 -1
- package/dist/task/vector/VectorDivideTask.d.ts.map +1 -1
- package/dist/task/vector/VectorDotProductTask.d.ts.map +1 -1
- package/dist/task/vector/VectorMultiplyTask.d.ts.map +1 -1
- package/dist/task/vector/VectorNormalizeTask.d.ts.map +1 -1
- package/dist/task/vector/VectorScaleTask.d.ts.map +1 -1
- package/dist/task/vector/VectorSubtractTask.d.ts.map +1 -1
- package/dist/task/vector/VectorSumTask.d.ts.map +1 -1
- package/dist/util/McpAuthProvider.d.ts +1 -1
- package/dist/util/McpAuthProvider.d.ts.map +1 -1
- package/dist/util/McpAuthTypes.d.ts.map +1 -1
- package/dist/util/McpClientUtil.d.ts.map +1 -1
- package/dist/util/acorn.d.ts.map +1 -1
- package/dist/util/getMcpServerTransport.d.ts +13 -0
- package/dist/util/getMcpServerTransport.d.ts.map +1 -0
- package/package.json +14 -9
package/dist/bun.js
CHANGED
|
@@ -593,7 +593,11 @@ class ArrayTask extends GraphAsTask {
|
|
|
593
593
|
const combinations = this.generateCombinations(inputObject, inputIds);
|
|
594
594
|
const tasks = combinations.map((combination) => {
|
|
595
595
|
const { id, title, ...rest } = this.config;
|
|
596
|
-
const task = new this.constructor({
|
|
596
|
+
const task = new this.constructor({
|
|
597
|
+
...rest,
|
|
598
|
+
id: `${id}_${uuid4()}`,
|
|
599
|
+
defaults: { ...this.defaults, ...this.runInputData, ...combination }
|
|
600
|
+
}, this.runConfig);
|
|
597
601
|
return task;
|
|
598
602
|
});
|
|
599
603
|
this.subGraph.addTasks(tasks);
|
|
@@ -723,7 +727,7 @@ class DebugLogTask extends Task10 {
|
|
|
723
727
|
}
|
|
724
728
|
}
|
|
725
729
|
var debugLog = (input, config = {}) => {
|
|
726
|
-
const task = new DebugLogTask(
|
|
730
|
+
const task = new DebugLogTask(config);
|
|
727
731
|
return task.run(input);
|
|
728
732
|
};
|
|
729
733
|
Workflow11.prototype.debugLog = CreateWorkflow10(DebugLogTask);
|
|
@@ -795,7 +799,7 @@ class DelayTask extends Task11 {
|
|
|
795
799
|
}
|
|
796
800
|
}
|
|
797
801
|
var delay = (input, config = { delay: 1 }) => {
|
|
798
|
-
const task = new DelayTask(
|
|
802
|
+
const task = new DelayTask(config);
|
|
799
803
|
return task.run(input);
|
|
800
804
|
};
|
|
801
805
|
Workflow12.prototype.delay = CreateWorkflow11(DelayTask);
|
|
@@ -808,6 +812,7 @@ import {
|
|
|
808
812
|
} from "@workglow/job-queue";
|
|
809
813
|
import {
|
|
810
814
|
CreateWorkflow as CreateWorkflow12,
|
|
815
|
+
Entitlements,
|
|
811
816
|
getJobQueueFactory,
|
|
812
817
|
getTaskQueueRegistry,
|
|
813
818
|
JobTaskFailedError,
|
|
@@ -1070,6 +1075,18 @@ class FetchUrlTask extends Task12 {
|
|
|
1070
1075
|
static title = "Fetch";
|
|
1071
1076
|
static description = "Fetches data from a URL with progress tracking and automatic retry handling";
|
|
1072
1077
|
static hasDynamicSchemas = true;
|
|
1078
|
+
static entitlements() {
|
|
1079
|
+
return {
|
|
1080
|
+
entitlements: [
|
|
1081
|
+
{ id: Entitlements.NETWORK_HTTP, reason: "Fetches data from URLs via HTTP/HTTPS" },
|
|
1082
|
+
{
|
|
1083
|
+
id: Entitlements.CREDENTIAL,
|
|
1084
|
+
reason: "May use Bearer token authentication",
|
|
1085
|
+
optional: true
|
|
1086
|
+
}
|
|
1087
|
+
]
|
|
1088
|
+
};
|
|
1089
|
+
}
|
|
1073
1090
|
static configSchema() {
|
|
1074
1091
|
return fetchUrlTaskConfigSchema;
|
|
1075
1092
|
}
|
|
@@ -1142,7 +1159,7 @@ class FetchUrlTask extends Task12 {
|
|
|
1142
1159
|
}
|
|
1143
1160
|
const registeredQueue = await this.resolveOrCreateQueue(queueName);
|
|
1144
1161
|
if (executeContext.signal.aborted) {
|
|
1145
|
-
throw executeContext.signal.reason ?? new
|
|
1162
|
+
throw executeContext.signal.reason ?? new AbortSignalJobError("The operation was aborted");
|
|
1146
1163
|
}
|
|
1147
1164
|
const handle = await registeredQueue.client.submit(jobInput, {
|
|
1148
1165
|
jobRunId: this.runConfig.runnerId,
|
|
@@ -1159,7 +1176,7 @@ class FetchUrlTask extends Task12 {
|
|
|
1159
1176
|
});
|
|
1160
1177
|
try {
|
|
1161
1178
|
if (executeContext.signal.aborted) {
|
|
1162
|
-
throw executeContext.signal.reason ?? new
|
|
1179
|
+
throw executeContext.signal.reason ?? new AbortSignalJobError("The operation was aborted");
|
|
1163
1180
|
}
|
|
1164
1181
|
const output = await handle.waitFor();
|
|
1165
1182
|
return output;
|
|
@@ -1237,18 +1254,455 @@ class FetchUrlTask extends Task12 {
|
|
|
1237
1254
|
}
|
|
1238
1255
|
}
|
|
1239
1256
|
var fetchUrl = async (input, config = {}) => {
|
|
1240
|
-
const result = await new FetchUrlTask(
|
|
1257
|
+
const result = await new FetchUrlTask(config).run(input);
|
|
1241
1258
|
return result;
|
|
1242
1259
|
};
|
|
1243
1260
|
Workflow13.prototype.fetch = CreateWorkflow12(FetchUrlTask);
|
|
1244
|
-
// src/task/
|
|
1261
|
+
// src/task/HumanApprovalTask.ts
|
|
1262
|
+
import {
|
|
1263
|
+
CreateWorkflow as CreateWorkflow14,
|
|
1264
|
+
Task as Task14,
|
|
1265
|
+
TaskAbortedError as TaskAbortedError3,
|
|
1266
|
+
TaskConfigSchema as TaskConfigSchema5,
|
|
1267
|
+
Workflow as Workflow15
|
|
1268
|
+
} from "@workglow/task-graph";
|
|
1269
|
+
import { uuid4 as uuid43 } from "@workglow/util";
|
|
1270
|
+
|
|
1271
|
+
// src/task/HumanInputTask.ts
|
|
1245
1272
|
import {
|
|
1246
1273
|
CreateWorkflow as CreateWorkflow13,
|
|
1247
1274
|
Task as Task13,
|
|
1275
|
+
TaskAbortedError as TaskAbortedError2,
|
|
1276
|
+
TaskConfigSchema as TaskConfigSchema4,
|
|
1277
|
+
TaskConfigurationError as TaskConfigurationError2,
|
|
1248
1278
|
Workflow as Workflow14
|
|
1249
1279
|
} from "@workglow/task-graph";
|
|
1280
|
+
import { createServiceToken, uuid4 as uuid42 } from "@workglow/util";
|
|
1281
|
+
var HUMAN_CONNECTOR = createServiceToken("HUMAN_CONNECTOR");
|
|
1282
|
+
var humanInputTaskConfigSchema = {
|
|
1283
|
+
type: "object",
|
|
1284
|
+
properties: {
|
|
1285
|
+
...TaskConfigSchema4["properties"],
|
|
1286
|
+
targetHumanId: {
|
|
1287
|
+
type: "string",
|
|
1288
|
+
title: "Target Human",
|
|
1289
|
+
description: "Identifier of the human to ask (e.g. 'default', 'admin', 'user:alice')",
|
|
1290
|
+
default: "default"
|
|
1291
|
+
},
|
|
1292
|
+
kind: {
|
|
1293
|
+
type: "string",
|
|
1294
|
+
title: "Kind",
|
|
1295
|
+
description: "Interaction kind: notify (one-way), display (show content), elicit (request input)",
|
|
1296
|
+
enum: ["notify", "display", "elicit"],
|
|
1297
|
+
default: "elicit"
|
|
1298
|
+
},
|
|
1299
|
+
contentSchema: {
|
|
1300
|
+
type: "object",
|
|
1301
|
+
properties: {},
|
|
1302
|
+
additionalProperties: true,
|
|
1303
|
+
title: "Content Schema",
|
|
1304
|
+
description: "JSON schema describing the content/form to present",
|
|
1305
|
+
"x-ui-hidden": true
|
|
1306
|
+
},
|
|
1307
|
+
message: {
|
|
1308
|
+
type: "string",
|
|
1309
|
+
title: "Message",
|
|
1310
|
+
description: "Explanatory message shown to the human",
|
|
1311
|
+
"x-ui-editor": "textarea"
|
|
1312
|
+
},
|
|
1313
|
+
mode: {
|
|
1314
|
+
type: "string",
|
|
1315
|
+
title: "Mode",
|
|
1316
|
+
description: "Interaction mode",
|
|
1317
|
+
enum: ["single", "multi-turn"],
|
|
1318
|
+
default: "single"
|
|
1319
|
+
},
|
|
1320
|
+
metadata: {
|
|
1321
|
+
type: "object",
|
|
1322
|
+
additionalProperties: true,
|
|
1323
|
+
"x-ui-hidden": true
|
|
1324
|
+
}
|
|
1325
|
+
},
|
|
1326
|
+
additionalProperties: false
|
|
1327
|
+
};
|
|
1328
|
+
var defaultInputSchema = {
|
|
1329
|
+
type: "object",
|
|
1330
|
+
properties: {
|
|
1331
|
+
prompt: {
|
|
1332
|
+
type: "string",
|
|
1333
|
+
title: "Prompt",
|
|
1334
|
+
description: "Dynamic prompt text merged into the request message"
|
|
1335
|
+
},
|
|
1336
|
+
contentData: {
|
|
1337
|
+
type: "object",
|
|
1338
|
+
additionalProperties: true,
|
|
1339
|
+
title: "Content Data",
|
|
1340
|
+
description: "Data to display (for notify/display kinds)",
|
|
1341
|
+
"x-ui-hidden": true
|
|
1342
|
+
},
|
|
1343
|
+
context: {
|
|
1344
|
+
type: "object",
|
|
1345
|
+
additionalProperties: true,
|
|
1346
|
+
title: "Context",
|
|
1347
|
+
description: "Dynamic context data merged into the request metadata",
|
|
1348
|
+
"x-ui-hidden": true
|
|
1349
|
+
}
|
|
1350
|
+
},
|
|
1351
|
+
additionalProperties: false
|
|
1352
|
+
};
|
|
1353
|
+
var defaultOutputSchema = {
|
|
1354
|
+
type: "object",
|
|
1355
|
+
properties: {
|
|
1356
|
+
action: {
|
|
1357
|
+
type: "string",
|
|
1358
|
+
title: "Action",
|
|
1359
|
+
description: "The human's action: accept, decline, or cancel",
|
|
1360
|
+
enum: ["accept", "decline", "cancel"]
|
|
1361
|
+
}
|
|
1362
|
+
},
|
|
1363
|
+
additionalProperties: true
|
|
1364
|
+
};
|
|
1365
|
+
|
|
1366
|
+
class HumanInputTask extends Task13 {
|
|
1367
|
+
static type = "HumanInputTask";
|
|
1368
|
+
static category = "Flow Control";
|
|
1369
|
+
static title = "Human Input";
|
|
1370
|
+
static description = "Sends an interaction (notification, display, or input request) to a human";
|
|
1371
|
+
static cacheable = false;
|
|
1372
|
+
static hasDynamicSchemas = true;
|
|
1373
|
+
static configSchema() {
|
|
1374
|
+
return humanInputTaskConfigSchema;
|
|
1375
|
+
}
|
|
1376
|
+
static inputSchema() {
|
|
1377
|
+
return defaultInputSchema;
|
|
1378
|
+
}
|
|
1379
|
+
static outputSchema() {
|
|
1380
|
+
return defaultOutputSchema;
|
|
1381
|
+
}
|
|
1382
|
+
outputSchema() {
|
|
1383
|
+
if (this.config?.contentSchema && (this.config.kind ?? "elicit") === "elicit") {
|
|
1384
|
+
const configSchema = this.config.contentSchema;
|
|
1385
|
+
const existingProps = configSchema.properties ?? {};
|
|
1386
|
+
const additionalProperties = configSchema.additionalProperties ?? false;
|
|
1387
|
+
const actionProp = {
|
|
1388
|
+
type: "string",
|
|
1389
|
+
title: "Action",
|
|
1390
|
+
description: "The human's action: accept, decline, or cancel",
|
|
1391
|
+
enum: ["accept", "decline", "cancel"]
|
|
1392
|
+
};
|
|
1393
|
+
const result = {
|
|
1394
|
+
type: "object",
|
|
1395
|
+
properties: { ...existingProps, action: actionProp },
|
|
1396
|
+
required: ["action"],
|
|
1397
|
+
additionalProperties
|
|
1398
|
+
};
|
|
1399
|
+
return result;
|
|
1400
|
+
}
|
|
1401
|
+
return this.constructor.outputSchema();
|
|
1402
|
+
}
|
|
1403
|
+
async execute(input, context) {
|
|
1404
|
+
const connector = resolveHumanConnector(context);
|
|
1405
|
+
const kind = this.config.kind ?? "elicit";
|
|
1406
|
+
const mode = this.config.mode ?? "single";
|
|
1407
|
+
const requestId = uuid42();
|
|
1408
|
+
const message = input.prompt ? this.config.message ? `${this.config.message}
|
|
1409
|
+
|
|
1410
|
+
${input.prompt}` : input.prompt : this.config.message ?? "";
|
|
1411
|
+
const emptySchema = {
|
|
1412
|
+
type: "object",
|
|
1413
|
+
properties: {},
|
|
1414
|
+
additionalProperties: true
|
|
1415
|
+
};
|
|
1416
|
+
const request = {
|
|
1417
|
+
requestId,
|
|
1418
|
+
targetHumanId: this.config.targetHumanId ?? "default",
|
|
1419
|
+
kind,
|
|
1420
|
+
message,
|
|
1421
|
+
contentSchema: this.config.contentSchema ?? emptySchema,
|
|
1422
|
+
contentData: input.contentData,
|
|
1423
|
+
expectsResponse: kind === "elicit",
|
|
1424
|
+
mode: kind === "elicit" ? mode : "single",
|
|
1425
|
+
metadata: input.context ? { ...this.config.metadata, ...input.context } : this.config.metadata
|
|
1426
|
+
};
|
|
1427
|
+
if (context.signal.aborted) {
|
|
1428
|
+
throw new TaskAbortedError2("Task aborted before sending human interaction");
|
|
1429
|
+
}
|
|
1430
|
+
let response;
|
|
1431
|
+
try {
|
|
1432
|
+
response = await connector.send(request, context.signal);
|
|
1433
|
+
} catch (err) {
|
|
1434
|
+
if (context.signal.aborted) {
|
|
1435
|
+
throw new TaskAbortedError2("Task aborted during human interaction");
|
|
1436
|
+
}
|
|
1437
|
+
throw err;
|
|
1438
|
+
}
|
|
1439
|
+
if (kind === "elicit" && mode === "multi-turn" && !response.done) {
|
|
1440
|
+
if (typeof connector.followUp !== "function") {
|
|
1441
|
+
throw new TaskConfigurationError2('HumanInputTask is configured for "multi-turn" mode but the registered ' + "IHumanConnector does not implement followUp()");
|
|
1442
|
+
}
|
|
1443
|
+
while (!response.done) {
|
|
1444
|
+
if (context.signal.aborted) {
|
|
1445
|
+
throw new TaskAbortedError2("Task aborted during multi-turn conversation");
|
|
1446
|
+
}
|
|
1447
|
+
try {
|
|
1448
|
+
response = await connector.followUp(request, response, context.signal);
|
|
1449
|
+
} catch (err) {
|
|
1450
|
+
if (context.signal.aborted) {
|
|
1451
|
+
throw new TaskAbortedError2("Task aborted during multi-turn conversation");
|
|
1452
|
+
}
|
|
1453
|
+
throw err;
|
|
1454
|
+
}
|
|
1455
|
+
}
|
|
1456
|
+
}
|
|
1457
|
+
return { ...response.content, action: response.action };
|
|
1458
|
+
}
|
|
1459
|
+
}
|
|
1460
|
+
function resolveHumanConnector(context) {
|
|
1461
|
+
if (!context.registry.has(HUMAN_CONNECTOR)) {
|
|
1462
|
+
throw new TaskConfigurationError2("No IHumanConnector registered. Register one via " + "registry.registerInstance(HUMAN_CONNECTOR, connector) before running a human-in-the-loop task.");
|
|
1463
|
+
}
|
|
1464
|
+
return context.registry.get(HUMAN_CONNECTOR);
|
|
1465
|
+
}
|
|
1466
|
+
Workflow14.prototype.humanInput = CreateWorkflow13(HumanInputTask);
|
|
1467
|
+
|
|
1468
|
+
// src/task/HumanApprovalTask.ts
|
|
1469
|
+
var humanApprovalConfigSchema = {
|
|
1470
|
+
type: "object",
|
|
1471
|
+
properties: {
|
|
1472
|
+
...TaskConfigSchema5["properties"],
|
|
1473
|
+
targetHumanId: {
|
|
1474
|
+
type: "string",
|
|
1475
|
+
title: "Target Human",
|
|
1476
|
+
description: "Identifier of the human to ask for approval",
|
|
1477
|
+
default: "default"
|
|
1478
|
+
},
|
|
1479
|
+
message: {
|
|
1480
|
+
type: "string",
|
|
1481
|
+
title: "Message",
|
|
1482
|
+
description: "Explanatory message shown to the approver",
|
|
1483
|
+
"x-ui-editor": "textarea"
|
|
1484
|
+
},
|
|
1485
|
+
metadata: {
|
|
1486
|
+
type: "object",
|
|
1487
|
+
additionalProperties: true,
|
|
1488
|
+
"x-ui-hidden": true
|
|
1489
|
+
}
|
|
1490
|
+
},
|
|
1491
|
+
additionalProperties: false
|
|
1492
|
+
};
|
|
1493
|
+
var inputSchema13 = {
|
|
1494
|
+
type: "object",
|
|
1495
|
+
properties: {
|
|
1496
|
+
prompt: {
|
|
1497
|
+
type: "string",
|
|
1498
|
+
title: "Prompt",
|
|
1499
|
+
description: "Dynamic prompt text merged into the approval message"
|
|
1500
|
+
},
|
|
1501
|
+
context: {
|
|
1502
|
+
type: "object",
|
|
1503
|
+
additionalProperties: true,
|
|
1504
|
+
title: "Context",
|
|
1505
|
+
description: "Dynamic context data merged into the request metadata",
|
|
1506
|
+
"x-ui-hidden": true
|
|
1507
|
+
}
|
|
1508
|
+
},
|
|
1509
|
+
additionalProperties: false
|
|
1510
|
+
};
|
|
1511
|
+
var approvalRequestedSchema = {
|
|
1512
|
+
type: "object",
|
|
1513
|
+
properties: {
|
|
1514
|
+
approved: {
|
|
1515
|
+
type: "boolean",
|
|
1516
|
+
title: "Approved",
|
|
1517
|
+
description: "Whether the request is approved"
|
|
1518
|
+
},
|
|
1519
|
+
reason: {
|
|
1520
|
+
type: "string",
|
|
1521
|
+
title: "Reason",
|
|
1522
|
+
description: "Optional explanation for the decision"
|
|
1523
|
+
}
|
|
1524
|
+
},
|
|
1525
|
+
required: ["approved"]
|
|
1526
|
+
};
|
|
1527
|
+
var approvalOutputSchema = {
|
|
1528
|
+
type: "object",
|
|
1529
|
+
properties: {
|
|
1530
|
+
action: {
|
|
1531
|
+
type: "string",
|
|
1532
|
+
title: "Action",
|
|
1533
|
+
description: "The human's action: accept, decline, or cancel",
|
|
1534
|
+
enum: ["accept", "decline", "cancel"]
|
|
1535
|
+
},
|
|
1536
|
+
approved: {
|
|
1537
|
+
type: "boolean",
|
|
1538
|
+
title: "Approved",
|
|
1539
|
+
description: "Whether the human approved the request"
|
|
1540
|
+
},
|
|
1541
|
+
reason: {
|
|
1542
|
+
type: "string",
|
|
1543
|
+
title: "Reason",
|
|
1544
|
+
description: "Optional explanation for the decision"
|
|
1545
|
+
}
|
|
1546
|
+
},
|
|
1547
|
+
required: ["action", "approved"],
|
|
1548
|
+
additionalProperties: false
|
|
1549
|
+
};
|
|
1550
|
+
|
|
1551
|
+
class HumanApprovalTask extends Task14 {
|
|
1552
|
+
static type = "HumanApprovalTask";
|
|
1553
|
+
static category = "Flow Control";
|
|
1554
|
+
static title = "Human Approval";
|
|
1555
|
+
static description = "Pauses execution to request approval from a human (approve/deny) via MCP elicitation";
|
|
1556
|
+
static cacheable = false;
|
|
1557
|
+
static configSchema() {
|
|
1558
|
+
return humanApprovalConfigSchema;
|
|
1559
|
+
}
|
|
1560
|
+
static inputSchema() {
|
|
1561
|
+
return inputSchema13;
|
|
1562
|
+
}
|
|
1563
|
+
static outputSchema() {
|
|
1564
|
+
return approvalOutputSchema;
|
|
1565
|
+
}
|
|
1566
|
+
async execute(input, context) {
|
|
1567
|
+
const connector = resolveHumanConnector(context);
|
|
1568
|
+
const requestId = uuid43();
|
|
1569
|
+
const message = input.prompt ? this.config.message ? `${this.config.message}
|
|
1570
|
+
|
|
1571
|
+
${input.prompt}` : input.prompt : this.config.message ?? "";
|
|
1572
|
+
const request = {
|
|
1573
|
+
requestId,
|
|
1574
|
+
targetHumanId: this.config.targetHumanId ?? "default",
|
|
1575
|
+
kind: "elicit",
|
|
1576
|
+
message,
|
|
1577
|
+
contentSchema: approvalRequestedSchema,
|
|
1578
|
+
contentData: undefined,
|
|
1579
|
+
expectsResponse: true,
|
|
1580
|
+
mode: "single",
|
|
1581
|
+
metadata: input.context ? { ...this.config.metadata, ...input.context } : this.config.metadata
|
|
1582
|
+
};
|
|
1583
|
+
if (context.signal.aborted) {
|
|
1584
|
+
throw new TaskAbortedError3("Task aborted before requesting human approval");
|
|
1585
|
+
}
|
|
1586
|
+
let response;
|
|
1587
|
+
try {
|
|
1588
|
+
response = await connector.send(request, context.signal);
|
|
1589
|
+
} catch (err) {
|
|
1590
|
+
if (context.signal.aborted) {
|
|
1591
|
+
throw new TaskAbortedError3("Task aborted during human approval");
|
|
1592
|
+
}
|
|
1593
|
+
throw err;
|
|
1594
|
+
}
|
|
1595
|
+
if (response.action === "accept" && response.content) {
|
|
1596
|
+
return {
|
|
1597
|
+
action: response.action,
|
|
1598
|
+
approved: response.content.approved === true,
|
|
1599
|
+
reason: response.content.reason
|
|
1600
|
+
};
|
|
1601
|
+
}
|
|
1602
|
+
return {
|
|
1603
|
+
action: response.action,
|
|
1604
|
+
approved: false,
|
|
1605
|
+
...response.content?.reason !== undefined ? { reason: response.content.reason } : {}
|
|
1606
|
+
};
|
|
1607
|
+
}
|
|
1608
|
+
}
|
|
1609
|
+
Workflow15.prototype.humanApproval = CreateWorkflow14(HumanApprovalTask);
|
|
1610
|
+
// src/task/McpElicitationConnector.ts
|
|
1611
|
+
function defaultAbortError() {
|
|
1612
|
+
const err = new Error("The operation was aborted");
|
|
1613
|
+
err.name = "AbortError";
|
|
1614
|
+
return err;
|
|
1615
|
+
}
|
|
1616
|
+
function toMcpRequestedSchema(schema) {
|
|
1617
|
+
const props = schema.properties ?? {};
|
|
1618
|
+
const required = schema.required;
|
|
1619
|
+
return {
|
|
1620
|
+
type: "object",
|
|
1621
|
+
properties: props,
|
|
1622
|
+
...required ? { required } : {}
|
|
1623
|
+
};
|
|
1624
|
+
}
|
|
1625
|
+
|
|
1626
|
+
class McpElicitationConnector {
|
|
1627
|
+
server;
|
|
1628
|
+
constructor(server) {
|
|
1629
|
+
this.server = server;
|
|
1630
|
+
}
|
|
1631
|
+
async send(request, signal) {
|
|
1632
|
+
switch (request.kind) {
|
|
1633
|
+
case "notify":
|
|
1634
|
+
return this.handleNotify(request, signal);
|
|
1635
|
+
case "display":
|
|
1636
|
+
return this.handleDisplay(request, signal);
|
|
1637
|
+
case "elicit":
|
|
1638
|
+
return this.handleElicit(request, signal);
|
|
1639
|
+
default:
|
|
1640
|
+
return this.handleElicit(request, signal);
|
|
1641
|
+
}
|
|
1642
|
+
}
|
|
1643
|
+
async followUp(request, _previousResponse, signal) {
|
|
1644
|
+
return this.send(request, signal);
|
|
1645
|
+
}
|
|
1646
|
+
async handleNotify(request, signal) {
|
|
1647
|
+
if (signal.aborted) {
|
|
1648
|
+
throw signal.reason ?? defaultAbortError();
|
|
1649
|
+
}
|
|
1650
|
+
await this.server.sendLoggingMessage({
|
|
1651
|
+
level: "info",
|
|
1652
|
+
data: request.contentData ?? request.message,
|
|
1653
|
+
logger: request.targetHumanId
|
|
1654
|
+
});
|
|
1655
|
+
if (signal.aborted) {
|
|
1656
|
+
throw signal.reason ?? defaultAbortError();
|
|
1657
|
+
}
|
|
1658
|
+
return {
|
|
1659
|
+
requestId: request.requestId,
|
|
1660
|
+
action: "accept",
|
|
1661
|
+
content: undefined,
|
|
1662
|
+
done: true
|
|
1663
|
+
};
|
|
1664
|
+
}
|
|
1665
|
+
async handleDisplay(request, signal) {
|
|
1666
|
+
if (signal.aborted) {
|
|
1667
|
+
throw signal.reason ?? defaultAbortError();
|
|
1668
|
+
}
|
|
1669
|
+
await this.server.sendLoggingMessage({
|
|
1670
|
+
level: "info",
|
|
1671
|
+
data: {
|
|
1672
|
+
message: request.message,
|
|
1673
|
+
content: request.contentData,
|
|
1674
|
+
schema: request.contentSchema
|
|
1675
|
+
},
|
|
1676
|
+
logger: request.targetHumanId
|
|
1677
|
+
});
|
|
1678
|
+
if (signal.aborted) {
|
|
1679
|
+
throw signal.reason ?? defaultAbortError();
|
|
1680
|
+
}
|
|
1681
|
+
return {
|
|
1682
|
+
requestId: request.requestId,
|
|
1683
|
+
action: "accept",
|
|
1684
|
+
content: undefined,
|
|
1685
|
+
done: true
|
|
1686
|
+
};
|
|
1687
|
+
}
|
|
1688
|
+
async handleElicit(request, signal) {
|
|
1689
|
+
const mcpResult = await this.server.elicitInput({
|
|
1690
|
+
mode: "form",
|
|
1691
|
+
message: request.message,
|
|
1692
|
+
requestedSchema: toMcpRequestedSchema(request.contentSchema)
|
|
1693
|
+
}, { signal });
|
|
1694
|
+
return {
|
|
1695
|
+
requestId: request.requestId,
|
|
1696
|
+
action: mcpResult.action,
|
|
1697
|
+
content: mcpResult.action === "accept" ? mcpResult.content : undefined,
|
|
1698
|
+
done: true
|
|
1699
|
+
};
|
|
1700
|
+
}
|
|
1701
|
+
}
|
|
1702
|
+
// src/task/InputTask.ts
|
|
1703
|
+
import { CreateWorkflow as CreateWorkflow15, Task as Task15, Workflow as Workflow16 } from "@workglow/task-graph";
|
|
1250
1704
|
|
|
1251
|
-
class InputTask extends
|
|
1705
|
+
class InputTask extends Task15 {
|
|
1252
1706
|
static type = "InputTask";
|
|
1253
1707
|
static category = "Flow Control";
|
|
1254
1708
|
static title = "Input";
|
|
@@ -1299,14 +1753,15 @@ class InputTask extends Task13 {
|
|
|
1299
1753
|
yield { type: "finish", data: input };
|
|
1300
1754
|
}
|
|
1301
1755
|
}
|
|
1302
|
-
|
|
1756
|
+
Workflow16.prototype.input = CreateWorkflow15(InputTask);
|
|
1303
1757
|
// src/task/JavaScriptTask.ts
|
|
1304
1758
|
import {
|
|
1305
|
-
CreateWorkflow as
|
|
1306
|
-
|
|
1307
|
-
|
|
1759
|
+
CreateWorkflow as CreateWorkflow16,
|
|
1760
|
+
Entitlements as Entitlements2,
|
|
1761
|
+
Task as Task16,
|
|
1762
|
+
TaskConfigSchema as TaskConfigSchema6,
|
|
1308
1763
|
TaskInvalidInputError as TaskInvalidInputError3,
|
|
1309
|
-
Workflow as
|
|
1764
|
+
Workflow as Workflow17
|
|
1310
1765
|
} from "@workglow/task-graph";
|
|
1311
1766
|
|
|
1312
1767
|
// src/util/acorn.js
|
|
@@ -5774,7 +6229,7 @@ var isValidIdentifier = (key) => /^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(key);
|
|
|
5774
6229
|
var configSchema = {
|
|
5775
6230
|
type: "object",
|
|
5776
6231
|
properties: {
|
|
5777
|
-
...
|
|
6232
|
+
...TaskConfigSchema6["properties"],
|
|
5778
6233
|
javascript_code: {
|
|
5779
6234
|
type: "string",
|
|
5780
6235
|
title: "Code",
|
|
@@ -5785,7 +6240,7 @@ var configSchema = {
|
|
|
5785
6240
|
},
|
|
5786
6241
|
additionalProperties: false
|
|
5787
6242
|
};
|
|
5788
|
-
var
|
|
6243
|
+
var inputSchema14 = {
|
|
5789
6244
|
type: "object",
|
|
5790
6245
|
properties: {
|
|
5791
6246
|
javascript_code: {
|
|
@@ -5811,24 +6266,32 @@ var outputSchema13 = {
|
|
|
5811
6266
|
additionalProperties: false
|
|
5812
6267
|
};
|
|
5813
6268
|
|
|
5814
|
-
class JavaScriptTask extends
|
|
6269
|
+
class JavaScriptTask extends Task16 {
|
|
5815
6270
|
static type = "JavaScriptTask";
|
|
5816
6271
|
static category = "Utility";
|
|
5817
6272
|
static title = "JavaScript Interpreter";
|
|
5818
6273
|
static description = "Executes JavaScript code in a sandboxed interpreter environment";
|
|
5819
6274
|
static customizable = true;
|
|
6275
|
+
static hasDynamicSchemas = true;
|
|
6276
|
+
static entitlements() {
|
|
6277
|
+
return {
|
|
6278
|
+
entitlements: [
|
|
6279
|
+
{
|
|
6280
|
+
id: Entitlements2.CODE_EXECUTION_JS,
|
|
6281
|
+
reason: "Executes user-provided JavaScript code in a sandboxed interpreter"
|
|
6282
|
+
}
|
|
6283
|
+
]
|
|
6284
|
+
};
|
|
6285
|
+
}
|
|
5820
6286
|
static configSchema() {
|
|
5821
6287
|
return configSchema;
|
|
5822
6288
|
}
|
|
5823
6289
|
static inputSchema() {
|
|
5824
|
-
return
|
|
6290
|
+
return inputSchema14;
|
|
5825
6291
|
}
|
|
5826
6292
|
static outputSchema() {
|
|
5827
6293
|
return outputSchema13;
|
|
5828
6294
|
}
|
|
5829
|
-
constructor(input2 = {}, config = {}) {
|
|
5830
|
-
super(input2, config);
|
|
5831
|
-
}
|
|
5832
6295
|
inputSchema() {
|
|
5833
6296
|
if (this.config?.javascript_code) {
|
|
5834
6297
|
if (this.config.inputSchema) {
|
|
@@ -5840,7 +6303,7 @@ class JavaScriptTask extends Task14 {
|
|
|
5840
6303
|
additionalProperties: true
|
|
5841
6304
|
};
|
|
5842
6305
|
}
|
|
5843
|
-
return
|
|
6306
|
+
return inputSchema14;
|
|
5844
6307
|
}
|
|
5845
6308
|
async executeReactive(input2, output) {
|
|
5846
6309
|
const code = input2.javascript_code || this.config.javascript_code;
|
|
@@ -5860,20 +6323,20 @@ class JavaScriptTask extends Task14 {
|
|
|
5860
6323
|
}
|
|
5861
6324
|
}
|
|
5862
6325
|
var javaScript = (input2, config = {}) => {
|
|
5863
|
-
return new JavaScriptTask(
|
|
6326
|
+
return new JavaScriptTask(config).run(input2);
|
|
5864
6327
|
};
|
|
5865
|
-
|
|
6328
|
+
Workflow17.prototype.javaScript = CreateWorkflow16(JavaScriptTask);
|
|
5866
6329
|
// src/task/JsonTask.ts
|
|
5867
6330
|
import {
|
|
5868
6331
|
createGraphFromDependencyJSON,
|
|
5869
6332
|
createGraphFromGraphJSON,
|
|
5870
|
-
CreateWorkflow as
|
|
6333
|
+
CreateWorkflow as CreateWorkflow17,
|
|
5871
6334
|
Dataflow,
|
|
5872
6335
|
GraphAsTask as GraphAsTask2,
|
|
5873
|
-
TaskConfigurationError as
|
|
5874
|
-
Workflow as
|
|
6336
|
+
TaskConfigurationError as TaskConfigurationError3,
|
|
6337
|
+
Workflow as Workflow18
|
|
5875
6338
|
} from "@workglow/task-graph";
|
|
5876
|
-
var
|
|
6339
|
+
var inputSchema15 = {
|
|
5877
6340
|
type: "object",
|
|
5878
6341
|
properties: {
|
|
5879
6342
|
json: {
|
|
@@ -5901,7 +6364,7 @@ class JsonTask extends GraphAsTask2 {
|
|
|
5901
6364
|
static title = "JSON Task";
|
|
5902
6365
|
static description = "A task that creates and manages task graphs from JSON configurations";
|
|
5903
6366
|
static inputSchema() {
|
|
5904
|
-
return
|
|
6367
|
+
return inputSchema15;
|
|
5905
6368
|
}
|
|
5906
6369
|
static outputSchema() {
|
|
5907
6370
|
return outputSchema14;
|
|
@@ -5925,7 +6388,7 @@ class JsonTask extends GraphAsTask2 {
|
|
|
5925
6388
|
for (const dep of dependencies) {
|
|
5926
6389
|
const sourceTask = this.subGraph.getTask(dep.id);
|
|
5927
6390
|
if (!sourceTask) {
|
|
5928
|
-
throw new
|
|
6391
|
+
throw new TaskConfigurationError3(`Dependency id ${dep.id} not found`);
|
|
5929
6392
|
}
|
|
5930
6393
|
const df = new Dataflow(sourceTask.id, dep.output, item.id, input2);
|
|
5931
6394
|
this.subGraph.addDataflow(df);
|
|
@@ -5936,28 +6399,28 @@ class JsonTask extends GraphAsTask2 {
|
|
|
5936
6399
|
}
|
|
5937
6400
|
}
|
|
5938
6401
|
var json = (input2, config = {}) => {
|
|
5939
|
-
return new JsonTask(
|
|
6402
|
+
return new JsonTask(config).run(input2);
|
|
5940
6403
|
};
|
|
5941
|
-
|
|
6404
|
+
Workflow18.prototype.json = CreateWorkflow17(JsonTask);
|
|
5942
6405
|
// src/task/LambdaTask.ts
|
|
5943
6406
|
import {
|
|
5944
|
-
CreateWorkflow as
|
|
6407
|
+
CreateWorkflow as CreateWorkflow18,
|
|
5945
6408
|
DATAFLOW_ALL_PORTS,
|
|
5946
|
-
Task as
|
|
5947
|
-
TaskConfigSchema as
|
|
5948
|
-
TaskConfigurationError as
|
|
5949
|
-
Workflow as
|
|
6409
|
+
Task as Task17,
|
|
6410
|
+
TaskConfigSchema as TaskConfigSchema7,
|
|
6411
|
+
TaskConfigurationError as TaskConfigurationError4,
|
|
6412
|
+
Workflow as Workflow19
|
|
5950
6413
|
} from "@workglow/task-graph";
|
|
5951
6414
|
var lambdaTaskConfigSchema = {
|
|
5952
6415
|
type: "object",
|
|
5953
6416
|
properties: {
|
|
5954
|
-
...
|
|
6417
|
+
...TaskConfigSchema7["properties"],
|
|
5955
6418
|
execute: {},
|
|
5956
6419
|
executeReactive: {}
|
|
5957
6420
|
},
|
|
5958
6421
|
additionalProperties: false
|
|
5959
6422
|
};
|
|
5960
|
-
var
|
|
6423
|
+
var inputSchema16 = {
|
|
5961
6424
|
type: "object",
|
|
5962
6425
|
properties: {
|
|
5963
6426
|
[DATAFLOW_ALL_PORTS]: {
|
|
@@ -5978,7 +6441,7 @@ var outputSchema15 = {
|
|
|
5978
6441
|
additionalProperties: true
|
|
5979
6442
|
};
|
|
5980
6443
|
|
|
5981
|
-
class LambdaTask extends
|
|
6444
|
+
class LambdaTask extends Task17 {
|
|
5982
6445
|
static type = "LambdaTask";
|
|
5983
6446
|
static title = "Lambda Task";
|
|
5984
6447
|
static description = "A task that wraps a provided function and its input";
|
|
@@ -5988,7 +6451,7 @@ class LambdaTask extends Task15 {
|
|
|
5988
6451
|
return lambdaTaskConfigSchema;
|
|
5989
6452
|
}
|
|
5990
6453
|
static inputSchema() {
|
|
5991
|
-
return
|
|
6454
|
+
return inputSchema16;
|
|
5992
6455
|
}
|
|
5993
6456
|
static outputSchema() {
|
|
5994
6457
|
return outputSchema15;
|
|
@@ -5996,11 +6459,11 @@ class LambdaTask extends Task15 {
|
|
|
5996
6459
|
canSerializeConfig() {
|
|
5997
6460
|
return false;
|
|
5998
6461
|
}
|
|
5999
|
-
constructor(
|
|
6462
|
+
constructor(config = {}) {
|
|
6000
6463
|
if (!config.execute && !config.executeReactive) {
|
|
6001
|
-
throw new
|
|
6464
|
+
throw new TaskConfigurationError4("LambdaTask must have either execute or executeReactive function in config");
|
|
6002
6465
|
}
|
|
6003
|
-
super(
|
|
6466
|
+
super(config);
|
|
6004
6467
|
}
|
|
6005
6468
|
async execute(input2, context) {
|
|
6006
6469
|
if (typeof this.config.execute === "function") {
|
|
@@ -6017,18 +6480,18 @@ class LambdaTask extends Task15 {
|
|
|
6017
6480
|
}
|
|
6018
6481
|
function lambda(input2, config) {
|
|
6019
6482
|
if (typeof input2 === "function") {
|
|
6020
|
-
const task2 = new LambdaTask({
|
|
6483
|
+
const task2 = new LambdaTask({
|
|
6021
6484
|
execute: input2
|
|
6022
6485
|
});
|
|
6023
6486
|
return task2.run();
|
|
6024
6487
|
}
|
|
6025
|
-
const task = new LambdaTask(
|
|
6488
|
+
const task = new LambdaTask({ ...config, defaults: input2 });
|
|
6026
6489
|
return task.run();
|
|
6027
6490
|
}
|
|
6028
|
-
|
|
6491
|
+
Workflow19.prototype.lambda = CreateWorkflow18(LambdaTask);
|
|
6029
6492
|
// src/task/MergeTask.ts
|
|
6030
|
-
import { CreateWorkflow as
|
|
6031
|
-
var
|
|
6493
|
+
import { CreateWorkflow as CreateWorkflow19, Task as Task18, Workflow as Workflow20 } from "@workglow/task-graph";
|
|
6494
|
+
var inputSchema17 = {
|
|
6032
6495
|
type: "object",
|
|
6033
6496
|
properties: {},
|
|
6034
6497
|
additionalProperties: true
|
|
@@ -6045,14 +6508,14 @@ var outputSchema16 = {
|
|
|
6045
6508
|
additionalProperties: false
|
|
6046
6509
|
};
|
|
6047
6510
|
|
|
6048
|
-
class MergeTask extends
|
|
6511
|
+
class MergeTask extends Task18 {
|
|
6049
6512
|
static type = "MergeTask";
|
|
6050
6513
|
static category = "Utility";
|
|
6051
6514
|
static title = "Merge";
|
|
6052
6515
|
static description = "Merges multiple inputs into a single array output";
|
|
6053
6516
|
static cacheable = true;
|
|
6054
6517
|
static inputSchema() {
|
|
6055
|
-
return
|
|
6518
|
+
return inputSchema17;
|
|
6056
6519
|
}
|
|
6057
6520
|
static outputSchema() {
|
|
6058
6521
|
return outputSchema16;
|
|
@@ -6066,24 +6529,21 @@ class MergeTask extends Task16 {
|
|
|
6066
6529
|
}
|
|
6067
6530
|
}
|
|
6068
6531
|
var merge = (input2, config = {}) => {
|
|
6069
|
-
const task = new MergeTask(
|
|
6532
|
+
const task = new MergeTask(config);
|
|
6070
6533
|
return task.run(input2);
|
|
6071
6534
|
};
|
|
6072
|
-
|
|
6535
|
+
Workflow20.prototype.merge = CreateWorkflow19(MergeTask);
|
|
6073
6536
|
// src/task/OutputTask.ts
|
|
6074
|
-
import {
|
|
6075
|
-
CreateWorkflow as CreateWorkflow18,
|
|
6076
|
-
Task as Task17,
|
|
6077
|
-
Workflow as Workflow19
|
|
6078
|
-
} from "@workglow/task-graph";
|
|
6537
|
+
import { CreateWorkflow as CreateWorkflow20, Task as Task19, Workflow as Workflow21 } from "@workglow/task-graph";
|
|
6079
6538
|
|
|
6080
|
-
class OutputTask extends
|
|
6539
|
+
class OutputTask extends Task19 {
|
|
6081
6540
|
static type = "OutputTask";
|
|
6082
6541
|
static category = "Flow Control";
|
|
6083
6542
|
static title = "Output";
|
|
6084
6543
|
static description = "Ends the workflow";
|
|
6085
6544
|
static hasDynamicSchemas = true;
|
|
6086
6545
|
static cacheable = false;
|
|
6546
|
+
static isGraphOutput = true;
|
|
6087
6547
|
static inputSchema() {
|
|
6088
6548
|
return {
|
|
6089
6549
|
type: "object",
|
|
@@ -6128,10 +6588,10 @@ class OutputTask extends Task17 {
|
|
|
6128
6588
|
yield { type: "finish", data: input2 };
|
|
6129
6589
|
}
|
|
6130
6590
|
}
|
|
6131
|
-
|
|
6591
|
+
Workflow21.prototype.output = CreateWorkflow20(OutputTask);
|
|
6132
6592
|
// src/task/SplitTask.ts
|
|
6133
|
-
import { CreateWorkflow as
|
|
6134
|
-
var
|
|
6593
|
+
import { CreateWorkflow as CreateWorkflow21, Task as Task20, Workflow as Workflow22 } from "@workglow/task-graph";
|
|
6594
|
+
var inputSchema18 = {
|
|
6135
6595
|
type: "object",
|
|
6136
6596
|
properties: {
|
|
6137
6597
|
input: {
|
|
@@ -6147,22 +6607,18 @@ var outputSchema17 = {
|
|
|
6147
6607
|
additionalProperties: true
|
|
6148
6608
|
};
|
|
6149
6609
|
|
|
6150
|
-
class SplitTask extends
|
|
6610
|
+
class SplitTask extends Task20 {
|
|
6151
6611
|
static type = "SplitTask";
|
|
6152
6612
|
static category = "Utility";
|
|
6153
6613
|
static title = "Split";
|
|
6154
6614
|
static description = "Splits an array into individual outputs, creating one output per element";
|
|
6155
|
-
static hasDynamicSchemas = true;
|
|
6156
6615
|
static cacheable = false;
|
|
6157
6616
|
static inputSchema() {
|
|
6158
|
-
return
|
|
6617
|
+
return inputSchema18;
|
|
6159
6618
|
}
|
|
6160
6619
|
static outputSchema() {
|
|
6161
6620
|
return outputSchema17;
|
|
6162
6621
|
}
|
|
6163
|
-
outputSchema() {
|
|
6164
|
-
return outputSchema17;
|
|
6165
|
-
}
|
|
6166
6622
|
async executeReactive(input2) {
|
|
6167
6623
|
const inputValue = input2.input;
|
|
6168
6624
|
const output = {};
|
|
@@ -6177,17 +6633,17 @@ class SplitTask extends Task18 {
|
|
|
6177
6633
|
}
|
|
6178
6634
|
}
|
|
6179
6635
|
var split = (input2, config = {}) => {
|
|
6180
|
-
const task = new SplitTask(
|
|
6636
|
+
const task = new SplitTask(config);
|
|
6181
6637
|
return task.run(input2);
|
|
6182
6638
|
};
|
|
6183
|
-
|
|
6639
|
+
Workflow22.prototype.split = CreateWorkflow21(SplitTask);
|
|
6184
6640
|
// src/task/DateFormatTask.ts
|
|
6185
6641
|
import {
|
|
6186
|
-
CreateWorkflow as
|
|
6187
|
-
Task as
|
|
6188
|
-
Workflow as
|
|
6642
|
+
CreateWorkflow as CreateWorkflow22,
|
|
6643
|
+
Task as Task21,
|
|
6644
|
+
Workflow as Workflow23
|
|
6189
6645
|
} from "@workglow/task-graph";
|
|
6190
|
-
var
|
|
6646
|
+
var inputSchema19 = {
|
|
6191
6647
|
type: "object",
|
|
6192
6648
|
properties: {
|
|
6193
6649
|
value: {
|
|
@@ -6230,13 +6686,13 @@ var outputSchema18 = {
|
|
|
6230
6686
|
additionalProperties: false
|
|
6231
6687
|
};
|
|
6232
6688
|
|
|
6233
|
-
class DateFormatTask extends
|
|
6689
|
+
class DateFormatTask extends Task21 {
|
|
6234
6690
|
static type = "DateFormatTask";
|
|
6235
6691
|
static category = "Utility";
|
|
6236
6692
|
static title = "Date Format";
|
|
6237
6693
|
static description = "Parses and formats a date string";
|
|
6238
6694
|
static inputSchema() {
|
|
6239
|
-
return
|
|
6695
|
+
return inputSchema19;
|
|
6240
6696
|
}
|
|
6241
6697
|
static outputSchema() {
|
|
6242
6698
|
return outputSchema18;
|
|
@@ -6272,14 +6728,14 @@ class DateFormatTask extends Task19 {
|
|
|
6272
6728
|
return { result };
|
|
6273
6729
|
}
|
|
6274
6730
|
}
|
|
6275
|
-
|
|
6731
|
+
Workflow23.prototype.dateFormat = CreateWorkflow22(DateFormatTask);
|
|
6276
6732
|
// src/task/JsonPathTask.ts
|
|
6277
6733
|
import {
|
|
6278
|
-
CreateWorkflow as
|
|
6279
|
-
Task as
|
|
6280
|
-
Workflow as
|
|
6734
|
+
CreateWorkflow as CreateWorkflow23,
|
|
6735
|
+
Task as Task22,
|
|
6736
|
+
Workflow as Workflow24
|
|
6281
6737
|
} from "@workglow/task-graph";
|
|
6282
|
-
var
|
|
6738
|
+
var inputSchema20 = {
|
|
6283
6739
|
type: "object",
|
|
6284
6740
|
properties: {
|
|
6285
6741
|
value: {
|
|
@@ -6328,13 +6784,13 @@ function resolvePath(obj, segments) {
|
|
|
6328
6784
|
return resolvePath(next2, tail);
|
|
6329
6785
|
}
|
|
6330
6786
|
|
|
6331
|
-
class JsonPathTask extends
|
|
6787
|
+
class JsonPathTask extends Task22 {
|
|
6332
6788
|
static type = "JsonPathTask";
|
|
6333
6789
|
static category = "Utility";
|
|
6334
6790
|
static title = "JSON Path";
|
|
6335
6791
|
static description = "Extracts a value from an object using a dot-notation path";
|
|
6336
6792
|
static inputSchema() {
|
|
6337
|
-
return
|
|
6793
|
+
return inputSchema20;
|
|
6338
6794
|
}
|
|
6339
6795
|
static outputSchema() {
|
|
6340
6796
|
return outputSchema19;
|
|
@@ -6345,20 +6801,20 @@ class JsonPathTask extends Task20 {
|
|
|
6345
6801
|
return { result };
|
|
6346
6802
|
}
|
|
6347
6803
|
}
|
|
6348
|
-
|
|
6804
|
+
Workflow24.prototype.jsonPath = CreateWorkflow23(JsonPathTask);
|
|
6349
6805
|
// src/task/RegexTask.ts
|
|
6350
6806
|
import {
|
|
6351
|
-
CreateWorkflow as
|
|
6352
|
-
Task as
|
|
6807
|
+
CreateWorkflow as CreateWorkflow24,
|
|
6808
|
+
Task as Task23,
|
|
6353
6809
|
TaskInvalidInputError as TaskInvalidInputError4,
|
|
6354
|
-
Workflow as
|
|
6810
|
+
Workflow as Workflow25
|
|
6355
6811
|
} from "@workglow/task-graph";
|
|
6356
6812
|
var MAX_BRACKET_COUNT = 100;
|
|
6357
6813
|
function hasNestedQuantifiers(pattern) {
|
|
6358
6814
|
const withoutClasses = pattern.replace(/\[(?:[^\]\\]|\\.)*\]/g, "X");
|
|
6359
6815
|
return /\([^)]*[+*][^)]*\)[+*?]|\([^)]*[+*][^)]*\)\{/.test(withoutClasses);
|
|
6360
6816
|
}
|
|
6361
|
-
var
|
|
6817
|
+
var inputSchema21 = {
|
|
6362
6818
|
type: "object",
|
|
6363
6819
|
properties: {
|
|
6364
6820
|
value: {
|
|
@@ -6400,13 +6856,13 @@ var outputSchema20 = {
|
|
|
6400
6856
|
additionalProperties: false
|
|
6401
6857
|
};
|
|
6402
6858
|
|
|
6403
|
-
class RegexTask extends
|
|
6859
|
+
class RegexTask extends Task23 {
|
|
6404
6860
|
static type = "RegexTask";
|
|
6405
6861
|
static category = "String";
|
|
6406
6862
|
static title = "Regex";
|
|
6407
6863
|
static description = "Matches a string against a regular expression pattern";
|
|
6408
6864
|
static inputSchema() {
|
|
6409
|
-
return
|
|
6865
|
+
return inputSchema21;
|
|
6410
6866
|
}
|
|
6411
6867
|
static outputSchema() {
|
|
6412
6868
|
return outputSchema20;
|
|
@@ -6438,14 +6894,14 @@ class RegexTask extends Task21 {
|
|
|
6438
6894
|
};
|
|
6439
6895
|
}
|
|
6440
6896
|
}
|
|
6441
|
-
|
|
6897
|
+
Workflow25.prototype.regex = CreateWorkflow24(RegexTask);
|
|
6442
6898
|
// src/task/TemplateTask.ts
|
|
6443
6899
|
import {
|
|
6444
|
-
CreateWorkflow as
|
|
6445
|
-
Task as
|
|
6446
|
-
Workflow as
|
|
6900
|
+
CreateWorkflow as CreateWorkflow25,
|
|
6901
|
+
Task as Task24,
|
|
6902
|
+
Workflow as Workflow26
|
|
6447
6903
|
} from "@workglow/task-graph";
|
|
6448
|
-
var
|
|
6904
|
+
var inputSchema22 = {
|
|
6449
6905
|
type: "object",
|
|
6450
6906
|
properties: {
|
|
6451
6907
|
template: {
|
|
@@ -6476,13 +6932,13 @@ var outputSchema21 = {
|
|
|
6476
6932
|
additionalProperties: false
|
|
6477
6933
|
};
|
|
6478
6934
|
|
|
6479
|
-
class TemplateTask extends
|
|
6935
|
+
class TemplateTask extends Task24 {
|
|
6480
6936
|
static type = "TemplateTask";
|
|
6481
6937
|
static category = "Utility";
|
|
6482
6938
|
static title = "Template";
|
|
6483
6939
|
static description = "Renders a template string with {{key}} placeholders and optional defaults";
|
|
6484
6940
|
static inputSchema() {
|
|
6485
|
-
return
|
|
6941
|
+
return inputSchema22;
|
|
6486
6942
|
}
|
|
6487
6943
|
static outputSchema() {
|
|
6488
6944
|
return outputSchema21;
|
|
@@ -6507,7 +6963,7 @@ class TemplateTask extends Task22 {
|
|
|
6507
6963
|
return { result };
|
|
6508
6964
|
}
|
|
6509
6965
|
}
|
|
6510
|
-
|
|
6966
|
+
Workflow26.prototype.template = CreateWorkflow25(TemplateTask);
|
|
6511
6967
|
// src/util/McpClientUtil.ts
|
|
6512
6968
|
import { Client } from "@modelcontextprotocol/sdk/client";
|
|
6513
6969
|
import { SSEClientTransport } from "@modelcontextprotocol/sdk/client/sse.js";
|
|
@@ -7029,8 +7485,8 @@ function buildAuthConfig(flat) {
|
|
|
7029
7485
|
}
|
|
7030
7486
|
|
|
7031
7487
|
// src/util/McpTaskDeps.ts
|
|
7032
|
-
import { createServiceToken, globalServiceRegistry } from "@workglow/util";
|
|
7033
|
-
var MCP_TASK_DEPS =
|
|
7488
|
+
import { createServiceToken as createServiceToken2, globalServiceRegistry } from "@workglow/util";
|
|
7489
|
+
var MCP_TASK_DEPS = createServiceToken2("@workglow/tasks/mcp");
|
|
7034
7490
|
function registerMcpTaskDeps(deps) {
|
|
7035
7491
|
globalServiceRegistry.registerInstance(MCP_TASK_DEPS, deps);
|
|
7036
7492
|
}
|
|
@@ -7257,18 +7713,15 @@ class InMemoryMcpServerRepository extends McpServerRepository {
|
|
|
7257
7713
|
}
|
|
7258
7714
|
// src/mcp-server/McpServerRegistry.ts
|
|
7259
7715
|
import {
|
|
7260
|
-
createServiceToken as
|
|
7716
|
+
createServiceToken as createServiceToken3,
|
|
7261
7717
|
globalServiceRegistry as globalServiceRegistry2,
|
|
7718
|
+
registerInputCompactor,
|
|
7262
7719
|
registerInputResolver
|
|
7263
7720
|
} from "@workglow/util";
|
|
7264
|
-
var MCP_SERVERS =
|
|
7265
|
-
var MCP_SERVER_REPOSITORY =
|
|
7266
|
-
|
|
7267
|
-
|
|
7268
|
-
}
|
|
7269
|
-
if (!globalServiceRegistry2.has(MCP_SERVER_REPOSITORY)) {
|
|
7270
|
-
globalServiceRegistry2.register(MCP_SERVER_REPOSITORY, () => new InMemoryMcpServerRepository, true);
|
|
7271
|
-
}
|
|
7721
|
+
var MCP_SERVERS = createServiceToken3("mcp-server.registry");
|
|
7722
|
+
var MCP_SERVER_REPOSITORY = createServiceToken3("mcp-server.repository");
|
|
7723
|
+
globalServiceRegistry2.registerIfAbsent(MCP_SERVERS, () => new Map, true);
|
|
7724
|
+
globalServiceRegistry2.registerIfAbsent(MCP_SERVER_REPOSITORY, () => new InMemoryMcpServerRepository, true);
|
|
7272
7725
|
function getGlobalMcpServers() {
|
|
7273
7726
|
return globalServiceRegistry2.get(MCP_SERVERS);
|
|
7274
7727
|
}
|
|
@@ -7300,6 +7753,13 @@ async function resolveServerFromRegistry(id, _format, registry) {
|
|
|
7300
7753
|
return record;
|
|
7301
7754
|
}
|
|
7302
7755
|
registerInputResolver("mcp-server", resolveServerFromRegistry);
|
|
7756
|
+
registerInputCompactor("mcp-server", (value) => {
|
|
7757
|
+
if (typeof value === "object" && value !== null && "server_id" in value) {
|
|
7758
|
+
const id = value.server_id;
|
|
7759
|
+
return typeof id === "string" ? id : undefined;
|
|
7760
|
+
}
|
|
7761
|
+
return;
|
|
7762
|
+
});
|
|
7303
7763
|
// src/mcp-server/getMcpServerConfig.ts
|
|
7304
7764
|
function getMcpServerConfig(configOrInput) {
|
|
7305
7765
|
const server = configOrInput.server;
|
|
@@ -7326,7 +7786,29 @@ function getMcpServerConfig(configOrInput) {
|
|
|
7326
7786
|
return base;
|
|
7327
7787
|
}
|
|
7328
7788
|
// src/task/mcp/McpListTask.ts
|
|
7329
|
-
import {
|
|
7789
|
+
import {
|
|
7790
|
+
CreateWorkflow as CreateWorkflow26,
|
|
7791
|
+
Entitlements as Entitlements3,
|
|
7792
|
+
mergeEntitlements,
|
|
7793
|
+
Task as Task25,
|
|
7794
|
+
Workflow as Workflow27
|
|
7795
|
+
} from "@workglow/task-graph";
|
|
7796
|
+
|
|
7797
|
+
// src/util/getMcpServerTransport.ts
|
|
7798
|
+
function getMcpServerTransport(task) {
|
|
7799
|
+
const runInputData = task.runInputData;
|
|
7800
|
+
const inputServer = runInputData?.server;
|
|
7801
|
+
if (typeof inputServer?.transport === "string") {
|
|
7802
|
+
return inputServer.transport;
|
|
7803
|
+
}
|
|
7804
|
+
const configServer = task.config?.server;
|
|
7805
|
+
if (typeof configServer?.transport === "string") {
|
|
7806
|
+
return configServer.transport;
|
|
7807
|
+
}
|
|
7808
|
+
return;
|
|
7809
|
+
}
|
|
7810
|
+
|
|
7811
|
+
// src/task/mcp/McpListTask.ts
|
|
7330
7812
|
var mcpListTypes = ["tools", "resources", "prompts"];
|
|
7331
7813
|
var iconSchema = {
|
|
7332
7814
|
type: "object",
|
|
@@ -7483,13 +7965,35 @@ var outputSchemaAll = {
|
|
|
7483
7965
|
additionalProperties: false
|
|
7484
7966
|
};
|
|
7485
7967
|
|
|
7486
|
-
class McpListTask extends
|
|
7968
|
+
class McpListTask extends Task25 {
|
|
7487
7969
|
static type = "McpListTask";
|
|
7488
7970
|
static category = "MCP";
|
|
7489
7971
|
static title = "MCP List";
|
|
7490
7972
|
static description = "Lists tools, resources, or prompts available on an MCP server";
|
|
7491
7973
|
static cacheable = false;
|
|
7492
7974
|
static hasDynamicSchemas = true;
|
|
7975
|
+
static hasDynamicEntitlements = true;
|
|
7976
|
+
static entitlements() {
|
|
7977
|
+
return {
|
|
7978
|
+
entitlements: [
|
|
7979
|
+
{ id: Entitlements3.MCP, reason: "Lists tools, resources, or prompts on MCP servers" }
|
|
7980
|
+
]
|
|
7981
|
+
};
|
|
7982
|
+
}
|
|
7983
|
+
entitlements() {
|
|
7984
|
+
const base = McpListTask.entitlements();
|
|
7985
|
+
const transport = getMcpServerTransport(this);
|
|
7986
|
+
if (transport === "stdio") {
|
|
7987
|
+
return mergeEntitlements(base, {
|
|
7988
|
+
entitlements: [
|
|
7989
|
+
{ id: Entitlements3.MCP_STDIO, reason: "Uses stdio transport to spawn local process" }
|
|
7990
|
+
]
|
|
7991
|
+
});
|
|
7992
|
+
}
|
|
7993
|
+
return mergeEntitlements(base, {
|
|
7994
|
+
entitlements: [{ id: Entitlements3.NETWORK_HTTP, reason: "Connects to MCP server over HTTP" }]
|
|
7995
|
+
});
|
|
7996
|
+
}
|
|
7493
7997
|
static inputSchema() {
|
|
7494
7998
|
const { mcpServerConfigSchema: mcpServerConfigSchema2 } = getMcpTaskDeps();
|
|
7495
7999
|
return {
|
|
@@ -7566,15 +8070,17 @@ class McpListTask extends Task23 {
|
|
|
7566
8070
|
}
|
|
7567
8071
|
}
|
|
7568
8072
|
var mcpList = async (input2, config = {}) => {
|
|
7569
|
-
return new McpListTask(
|
|
8073
|
+
return new McpListTask(config).run(input2);
|
|
7570
8074
|
};
|
|
7571
|
-
|
|
8075
|
+
Workflow27.prototype.mcpList = CreateWorkflow26(McpListTask);
|
|
7572
8076
|
// src/task/mcp/McpPromptGetTask.ts
|
|
7573
8077
|
import {
|
|
7574
|
-
CreateWorkflow as
|
|
7575
|
-
|
|
7576
|
-
|
|
7577
|
-
|
|
8078
|
+
CreateWorkflow as CreateWorkflow27,
|
|
8079
|
+
Entitlements as Entitlements4,
|
|
8080
|
+
mergeEntitlements as mergeEntitlements2,
|
|
8081
|
+
Task as Task26,
|
|
8082
|
+
TaskConfigSchema as TaskConfigSchema8,
|
|
8083
|
+
Workflow as Workflow28
|
|
7578
8084
|
} from "@workglow/task-graph";
|
|
7579
8085
|
var annotationsSchema = {
|
|
7580
8086
|
type: "object",
|
|
@@ -7709,7 +8215,7 @@ var fallbackInputSchema = {
|
|
|
7709
8215
|
additionalProperties: false
|
|
7710
8216
|
};
|
|
7711
8217
|
|
|
7712
|
-
class McpPromptGetTask extends
|
|
8218
|
+
class McpPromptGetTask extends Task26 {
|
|
7713
8219
|
static type = "McpPromptGetTask";
|
|
7714
8220
|
static category = "MCP";
|
|
7715
8221
|
static title = "MCP Get Prompt";
|
|
@@ -7717,6 +8223,29 @@ class McpPromptGetTask extends Task24 {
|
|
|
7717
8223
|
static cacheable = false;
|
|
7718
8224
|
static customizable = true;
|
|
7719
8225
|
static hasDynamicSchemas = true;
|
|
8226
|
+
static hasDynamicEntitlements = true;
|
|
8227
|
+
static entitlements() {
|
|
8228
|
+
return {
|
|
8229
|
+
entitlements: [{ id: Entitlements4.MCP_PROMPT_GET, reason: "Gets prompts from MCP servers" }]
|
|
8230
|
+
};
|
|
8231
|
+
}
|
|
8232
|
+
entitlements() {
|
|
8233
|
+
const base = McpPromptGetTask.entitlements();
|
|
8234
|
+
const transport = getMcpServerTransport(this);
|
|
8235
|
+
if (transport === "stdio") {
|
|
8236
|
+
return mergeEntitlements2(base, {
|
|
8237
|
+
entitlements: [
|
|
8238
|
+
{ id: Entitlements4.MCP_STDIO, reason: "Uses stdio transport to spawn local process" }
|
|
8239
|
+
]
|
|
8240
|
+
});
|
|
8241
|
+
}
|
|
8242
|
+
return mergeEntitlements2(base, {
|
|
8243
|
+
entitlements: [
|
|
8244
|
+
{ id: Entitlements4.NETWORK_HTTP, reason: "Connects to MCP server over HTTP" },
|
|
8245
|
+
{ id: Entitlements4.CREDENTIAL, reason: "May require authentication", optional: true }
|
|
8246
|
+
]
|
|
8247
|
+
});
|
|
8248
|
+
}
|
|
7720
8249
|
static inputSchema() {
|
|
7721
8250
|
return fallbackInputSchema;
|
|
7722
8251
|
}
|
|
@@ -7728,7 +8257,7 @@ class McpPromptGetTask extends Task24 {
|
|
|
7728
8257
|
return {
|
|
7729
8258
|
type: "object",
|
|
7730
8259
|
properties: {
|
|
7731
|
-
...
|
|
8260
|
+
...TaskConfigSchema8["properties"],
|
|
7732
8261
|
server: TypeMcpServer(mcpServerConfigSchema2),
|
|
7733
8262
|
prompt_name: {
|
|
7734
8263
|
type: "string",
|
|
@@ -7747,43 +8276,45 @@ class McpPromptGetTask extends Task24 {
|
|
|
7747
8276
|
outputSchema() {
|
|
7748
8277
|
return this.config?.outputSchema ?? fallbackOutputSchema;
|
|
7749
8278
|
}
|
|
7750
|
-
|
|
8279
|
+
_schemasDiscoveringPromise;
|
|
7751
8280
|
async discoverSchemas(_signal, serverConfig) {
|
|
7752
8281
|
if (this.config.inputSchema)
|
|
7753
8282
|
return;
|
|
7754
|
-
if (this.
|
|
7755
|
-
return;
|
|
8283
|
+
if (this._schemasDiscoveringPromise)
|
|
8284
|
+
return this._schemasDiscoveringPromise;
|
|
7756
8285
|
const resolved = serverConfig ?? getMcpServerConfig(this.config);
|
|
7757
8286
|
if (!resolved.transport || !this.config.prompt_name)
|
|
7758
8287
|
return;
|
|
7759
|
-
this.
|
|
7760
|
-
|
|
7761
|
-
|
|
7762
|
-
|
|
7763
|
-
|
|
7764
|
-
|
|
7765
|
-
|
|
7766
|
-
|
|
7767
|
-
|
|
7768
|
-
|
|
7769
|
-
|
|
7770
|
-
|
|
7771
|
-
|
|
7772
|
-
|
|
7773
|
-
|
|
8288
|
+
this._schemasDiscoveringPromise = (async () => {
|
|
8289
|
+
try {
|
|
8290
|
+
const result = await mcpList({
|
|
8291
|
+
server: resolved,
|
|
8292
|
+
list_type: "prompts"
|
|
8293
|
+
});
|
|
8294
|
+
const prompt = result.prompts?.find((p) => p.name === this.config.prompt_name);
|
|
8295
|
+
if (prompt) {
|
|
8296
|
+
const args = prompt.arguments ?? [];
|
|
8297
|
+
const required = args.filter((a) => a.required).map((a) => a.name);
|
|
8298
|
+
const properties = {};
|
|
8299
|
+
for (const arg of args) {
|
|
8300
|
+
properties[arg.name] = {
|
|
8301
|
+
type: "string",
|
|
8302
|
+
...arg.description ? { description: arg.description } : {}
|
|
8303
|
+
};
|
|
8304
|
+
}
|
|
8305
|
+
this.config.inputSchema = {
|
|
8306
|
+
type: "object",
|
|
8307
|
+
properties,
|
|
8308
|
+
...required.length > 0 ? { required } : {},
|
|
8309
|
+
additionalProperties: false
|
|
7774
8310
|
};
|
|
8311
|
+
this.emitSchemaChange();
|
|
7775
8312
|
}
|
|
7776
|
-
|
|
7777
|
-
|
|
7778
|
-
properties,
|
|
7779
|
-
...required.length > 0 ? { required } : {},
|
|
7780
|
-
additionalProperties: false
|
|
7781
|
-
};
|
|
7782
|
-
this.emitSchemaChange();
|
|
8313
|
+
} finally {
|
|
8314
|
+
this._schemasDiscoveringPromise = undefined;
|
|
7783
8315
|
}
|
|
7784
|
-
}
|
|
7785
|
-
|
|
7786
|
-
}
|
|
8316
|
+
})();
|
|
8317
|
+
return this._schemasDiscoveringPromise;
|
|
7787
8318
|
}
|
|
7788
8319
|
async execute(input2, context) {
|
|
7789
8320
|
const serverConfig = getMcpServerConfig(this.config);
|
|
@@ -7805,15 +8336,17 @@ class McpPromptGetTask extends Task24 {
|
|
|
7805
8336
|
}
|
|
7806
8337
|
}
|
|
7807
8338
|
var mcpPromptGet = async (input2, config) => {
|
|
7808
|
-
return new McpPromptGetTask(
|
|
8339
|
+
return new McpPromptGetTask(config).run(input2);
|
|
7809
8340
|
};
|
|
7810
|
-
|
|
8341
|
+
Workflow28.prototype.mcpPromptGet = CreateWorkflow27(McpPromptGetTask);
|
|
7811
8342
|
// src/task/mcp/McpResourceReadTask.ts
|
|
7812
8343
|
import {
|
|
7813
|
-
CreateWorkflow as
|
|
7814
|
-
|
|
7815
|
-
|
|
7816
|
-
|
|
8344
|
+
CreateWorkflow as CreateWorkflow28,
|
|
8345
|
+
Entitlements as Entitlements5,
|
|
8346
|
+
mergeEntitlements as mergeEntitlements3,
|
|
8347
|
+
Task as Task27,
|
|
8348
|
+
TaskConfigSchema as TaskConfigSchema9,
|
|
8349
|
+
Workflow as Workflow29
|
|
7817
8350
|
} from "@workglow/task-graph";
|
|
7818
8351
|
var contentItemSchema = {
|
|
7819
8352
|
anyOf: [
|
|
@@ -7841,7 +8374,7 @@ var contentItemSchema = {
|
|
|
7841
8374
|
}
|
|
7842
8375
|
]
|
|
7843
8376
|
};
|
|
7844
|
-
var
|
|
8377
|
+
var inputSchema23 = {
|
|
7845
8378
|
type: "object",
|
|
7846
8379
|
properties: {},
|
|
7847
8380
|
additionalProperties: false
|
|
@@ -7860,15 +8393,40 @@ var outputSchema22 = {
|
|
|
7860
8393
|
additionalProperties: false
|
|
7861
8394
|
};
|
|
7862
8395
|
|
|
7863
|
-
class McpResourceReadTask extends
|
|
8396
|
+
class McpResourceReadTask extends Task27 {
|
|
7864
8397
|
static type = "McpResourceReadTask";
|
|
7865
8398
|
static category = "MCP";
|
|
7866
8399
|
static title = "MCP Read Resource";
|
|
7867
8400
|
static description = "Reads a resource from an MCP server";
|
|
7868
8401
|
static cacheable = false;
|
|
7869
8402
|
static customizable = true;
|
|
8403
|
+
static hasDynamicEntitlements = true;
|
|
8404
|
+
static entitlements() {
|
|
8405
|
+
return {
|
|
8406
|
+
entitlements: [
|
|
8407
|
+
{ id: Entitlements5.MCP_RESOURCE_READ, reason: "Reads resources from MCP servers" }
|
|
8408
|
+
]
|
|
8409
|
+
};
|
|
8410
|
+
}
|
|
8411
|
+
entitlements() {
|
|
8412
|
+
const base = McpResourceReadTask.entitlements();
|
|
8413
|
+
const transport = getMcpServerTransport(this);
|
|
8414
|
+
if (transport === "stdio") {
|
|
8415
|
+
return mergeEntitlements3(base, {
|
|
8416
|
+
entitlements: [
|
|
8417
|
+
{ id: Entitlements5.MCP_STDIO, reason: "Uses stdio transport to spawn local process" }
|
|
8418
|
+
]
|
|
8419
|
+
});
|
|
8420
|
+
}
|
|
8421
|
+
return mergeEntitlements3(base, {
|
|
8422
|
+
entitlements: [
|
|
8423
|
+
{ id: Entitlements5.NETWORK_HTTP, reason: "Connects to MCP server over HTTP" },
|
|
8424
|
+
{ id: Entitlements5.CREDENTIAL, reason: "May require authentication", optional: true }
|
|
8425
|
+
]
|
|
8426
|
+
});
|
|
8427
|
+
}
|
|
7870
8428
|
static inputSchema() {
|
|
7871
|
-
return
|
|
8429
|
+
return inputSchema23;
|
|
7872
8430
|
}
|
|
7873
8431
|
static outputSchema() {
|
|
7874
8432
|
return outputSchema22;
|
|
@@ -7878,7 +8436,7 @@ class McpResourceReadTask extends Task25 {
|
|
|
7878
8436
|
return {
|
|
7879
8437
|
type: "object",
|
|
7880
8438
|
properties: {
|
|
7881
|
-
...
|
|
8439
|
+
...TaskConfigSchema9["properties"],
|
|
7882
8440
|
server: TypeMcpServer(mcpServerConfigSchema2),
|
|
7883
8441
|
resource_uri: {
|
|
7884
8442
|
type: "string",
|
|
@@ -7906,11 +8464,16 @@ class McpResourceReadTask extends Task25 {
|
|
|
7906
8464
|
}
|
|
7907
8465
|
}
|
|
7908
8466
|
var mcpResourceRead = async (config) => {
|
|
7909
|
-
return new McpResourceReadTask(
|
|
8467
|
+
return new McpResourceReadTask(config).run({});
|
|
7910
8468
|
};
|
|
7911
|
-
|
|
8469
|
+
Workflow29.prototype.mcpResourceRead = CreateWorkflow28(McpResourceReadTask);
|
|
7912
8470
|
// src/task/mcp/McpSearchTask.ts
|
|
7913
|
-
import {
|
|
8471
|
+
import {
|
|
8472
|
+
CreateWorkflow as CreateWorkflow29,
|
|
8473
|
+
Entitlements as Entitlements6,
|
|
8474
|
+
Task as Task28,
|
|
8475
|
+
Workflow as Workflow30
|
|
8476
|
+
} from "@workglow/task-graph";
|
|
7914
8477
|
var MCP_REGISTRY_BASE = "https://registry.modelcontextprotocol.io/v0.1";
|
|
7915
8478
|
var McpSearchInputSchema = {
|
|
7916
8479
|
type: "object",
|
|
@@ -8049,12 +8612,19 @@ async function searchMcpRegistry(query, signal) {
|
|
|
8049
8612
|
return page.results;
|
|
8050
8613
|
}
|
|
8051
8614
|
|
|
8052
|
-
class McpSearchTask extends
|
|
8615
|
+
class McpSearchTask extends Task28 {
|
|
8053
8616
|
static type = "McpSearchTask";
|
|
8054
8617
|
static category = "MCP";
|
|
8055
8618
|
static title = "MCP Search";
|
|
8056
8619
|
static description = "Search the MCP server registry for servers matching a query";
|
|
8057
8620
|
static cacheable = false;
|
|
8621
|
+
static entitlements() {
|
|
8622
|
+
return {
|
|
8623
|
+
entitlements: [
|
|
8624
|
+
{ id: Entitlements6.NETWORK_HTTP, reason: "Searches the MCP server registry via HTTPS" }
|
|
8625
|
+
]
|
|
8626
|
+
};
|
|
8627
|
+
}
|
|
8058
8628
|
static inputSchema() {
|
|
8059
8629
|
return McpSearchInputSchema;
|
|
8060
8630
|
}
|
|
@@ -8067,15 +8637,17 @@ class McpSearchTask extends Task26 {
|
|
|
8067
8637
|
}
|
|
8068
8638
|
}
|
|
8069
8639
|
var mcpSearch = (input2, config) => {
|
|
8070
|
-
return new McpSearchTask(
|
|
8640
|
+
return new McpSearchTask(config).run(input2);
|
|
8071
8641
|
};
|
|
8072
|
-
|
|
8642
|
+
Workflow30.prototype.mcpSearch = CreateWorkflow29(McpSearchTask);
|
|
8073
8643
|
// src/task/mcp/McpToolCallTask.ts
|
|
8074
8644
|
import {
|
|
8075
|
-
CreateWorkflow as
|
|
8076
|
-
|
|
8077
|
-
|
|
8078
|
-
|
|
8645
|
+
CreateWorkflow as CreateWorkflow30,
|
|
8646
|
+
Entitlements as Entitlements7,
|
|
8647
|
+
mergeEntitlements as mergeEntitlements4,
|
|
8648
|
+
Task as Task29,
|
|
8649
|
+
TaskConfigSchema as TaskConfigSchema10,
|
|
8650
|
+
Workflow as Workflow31
|
|
8079
8651
|
} from "@workglow/task-graph";
|
|
8080
8652
|
var annotationsSchema2 = {
|
|
8081
8653
|
type: "object",
|
|
@@ -8202,7 +8774,7 @@ var fallbackInputSchema2 = {
|
|
|
8202
8774
|
additionalProperties: true
|
|
8203
8775
|
};
|
|
8204
8776
|
|
|
8205
|
-
class McpToolCallTask extends
|
|
8777
|
+
class McpToolCallTask extends Task29 {
|
|
8206
8778
|
static type = "McpToolCallTask";
|
|
8207
8779
|
static category = "MCP";
|
|
8208
8780
|
static title = "MCP Call Tool";
|
|
@@ -8210,6 +8782,29 @@ class McpToolCallTask extends Task27 {
|
|
|
8210
8782
|
static cacheable = false;
|
|
8211
8783
|
static customizable = true;
|
|
8212
8784
|
static hasDynamicSchemas = true;
|
|
8785
|
+
static hasDynamicEntitlements = true;
|
|
8786
|
+
static entitlements() {
|
|
8787
|
+
return {
|
|
8788
|
+
entitlements: [{ id: Entitlements7.MCP_TOOL_CALL, reason: "Calls tools on MCP servers" }]
|
|
8789
|
+
};
|
|
8790
|
+
}
|
|
8791
|
+
entitlements() {
|
|
8792
|
+
const base = McpToolCallTask.entitlements();
|
|
8793
|
+
const transport = getMcpServerTransport(this);
|
|
8794
|
+
if (transport === "stdio") {
|
|
8795
|
+
return mergeEntitlements4(base, {
|
|
8796
|
+
entitlements: [
|
|
8797
|
+
{ id: Entitlements7.MCP_STDIO, reason: "Uses stdio transport to spawn local process" }
|
|
8798
|
+
]
|
|
8799
|
+
});
|
|
8800
|
+
}
|
|
8801
|
+
return mergeEntitlements4(base, {
|
|
8802
|
+
entitlements: [
|
|
8803
|
+
{ id: Entitlements7.NETWORK_HTTP, reason: "Connects to MCP server over HTTP" },
|
|
8804
|
+
{ id: Entitlements7.CREDENTIAL, reason: "May require authentication", optional: true }
|
|
8805
|
+
]
|
|
8806
|
+
});
|
|
8807
|
+
}
|
|
8213
8808
|
static inputSchema() {
|
|
8214
8809
|
return fallbackInputSchema2;
|
|
8215
8810
|
}
|
|
@@ -8221,7 +8816,7 @@ class McpToolCallTask extends Task27 {
|
|
|
8221
8816
|
return {
|
|
8222
8817
|
type: "object",
|
|
8223
8818
|
properties: {
|
|
8224
|
-
...
|
|
8819
|
+
...TaskConfigSchema10["properties"],
|
|
8225
8820
|
server: TypeMcpServer(mcpServerConfigSchema2),
|
|
8226
8821
|
tool_name: {
|
|
8227
8822
|
type: "string",
|
|
@@ -8240,34 +8835,36 @@ class McpToolCallTask extends Task27 {
|
|
|
8240
8835
|
outputSchema() {
|
|
8241
8836
|
return this.config?.outputSchema ?? fallbackOutputSchema2;
|
|
8242
8837
|
}
|
|
8243
|
-
|
|
8838
|
+
_schemasDiscoveringPromise;
|
|
8244
8839
|
async discoverSchemas(_signal, serverConfig) {
|
|
8245
8840
|
if (this.config.inputSchema && this.config.outputSchema)
|
|
8246
8841
|
return;
|
|
8247
|
-
if (this.
|
|
8248
|
-
return;
|
|
8842
|
+
if (this._schemasDiscoveringPromise)
|
|
8843
|
+
return this._schemasDiscoveringPromise;
|
|
8249
8844
|
const resolved = serverConfig ?? getMcpServerConfig(this.config);
|
|
8250
8845
|
if (!resolved.transport || !this.config.tool_name)
|
|
8251
8846
|
return;
|
|
8252
|
-
this.
|
|
8253
|
-
|
|
8254
|
-
|
|
8255
|
-
|
|
8256
|
-
|
|
8257
|
-
|
|
8258
|
-
|
|
8259
|
-
|
|
8260
|
-
|
|
8261
|
-
|
|
8262
|
-
|
|
8263
|
-
|
|
8264
|
-
|
|
8847
|
+
this._schemasDiscoveringPromise = (async () => {
|
|
8848
|
+
try {
|
|
8849
|
+
const result = await mcpList({
|
|
8850
|
+
server: resolved,
|
|
8851
|
+
list_type: "tools"
|
|
8852
|
+
});
|
|
8853
|
+
const tool = result.tools?.find((t) => t.name === this.config.tool_name);
|
|
8854
|
+
if (tool) {
|
|
8855
|
+
if (!this.config.inputSchema) {
|
|
8856
|
+
this.config.inputSchema = tool.inputSchema;
|
|
8857
|
+
}
|
|
8858
|
+
if (!this.config.outputSchema && tool.outputSchema) {
|
|
8859
|
+
this.config.outputSchema = tool.outputSchema;
|
|
8860
|
+
}
|
|
8861
|
+
this.emitSchemaChange();
|
|
8265
8862
|
}
|
|
8266
|
-
|
|
8863
|
+
} finally {
|
|
8864
|
+
this._schemasDiscoveringPromise = undefined;
|
|
8267
8865
|
}
|
|
8268
|
-
}
|
|
8269
|
-
|
|
8270
|
-
}
|
|
8866
|
+
})();
|
|
8867
|
+
return this._schemasDiscoveringPromise;
|
|
8271
8868
|
}
|
|
8272
8869
|
async execute(input2, context) {
|
|
8273
8870
|
const serverConfig = getMcpServerConfig(this.config);
|
|
@@ -8313,16 +8910,16 @@ class McpToolCallTask extends Task27 {
|
|
|
8313
8910
|
}
|
|
8314
8911
|
}
|
|
8315
8912
|
var mcpToolCall = async (input2, config) => {
|
|
8316
|
-
return new McpToolCallTask(
|
|
8913
|
+
return new McpToolCallTask(config).run(input2);
|
|
8317
8914
|
};
|
|
8318
|
-
|
|
8915
|
+
Workflow31.prototype.mcpToolCall = CreateWorkflow30(McpToolCallTask);
|
|
8319
8916
|
// src/task/string/StringConcatTask.ts
|
|
8320
8917
|
import {
|
|
8321
|
-
CreateWorkflow as
|
|
8322
|
-
Task as
|
|
8323
|
-
Workflow as
|
|
8918
|
+
CreateWorkflow as CreateWorkflow31,
|
|
8919
|
+
Task as Task30,
|
|
8920
|
+
Workflow as Workflow32
|
|
8324
8921
|
} from "@workglow/task-graph";
|
|
8325
|
-
var
|
|
8922
|
+
var inputSchema24 = {
|
|
8326
8923
|
type: "object",
|
|
8327
8924
|
properties: {},
|
|
8328
8925
|
additionalProperties: { type: "string" }
|
|
@@ -8340,13 +8937,13 @@ var outputSchema23 = {
|
|
|
8340
8937
|
additionalProperties: false
|
|
8341
8938
|
};
|
|
8342
8939
|
|
|
8343
|
-
class StringConcatTask extends
|
|
8940
|
+
class StringConcatTask extends Task30 {
|
|
8344
8941
|
static type = "StringConcatTask";
|
|
8345
8942
|
static category = "String";
|
|
8346
8943
|
static title = "Concat";
|
|
8347
8944
|
static description = "Concatenates all input strings";
|
|
8348
8945
|
static inputSchema() {
|
|
8349
|
-
return
|
|
8946
|
+
return inputSchema24;
|
|
8350
8947
|
}
|
|
8351
8948
|
static outputSchema() {
|
|
8352
8949
|
return outputSchema23;
|
|
@@ -8355,14 +8952,14 @@ class StringConcatTask extends Task28 {
|
|
|
8355
8952
|
return { result: Object.values(input2).join("") };
|
|
8356
8953
|
}
|
|
8357
8954
|
}
|
|
8358
|
-
|
|
8955
|
+
Workflow32.prototype.stringConcat = CreateWorkflow31(StringConcatTask);
|
|
8359
8956
|
// src/task/string/StringIncludesTask.ts
|
|
8360
8957
|
import {
|
|
8361
|
-
CreateWorkflow as
|
|
8362
|
-
Task as
|
|
8363
|
-
Workflow as
|
|
8958
|
+
CreateWorkflow as CreateWorkflow32,
|
|
8959
|
+
Task as Task31,
|
|
8960
|
+
Workflow as Workflow33
|
|
8364
8961
|
} from "@workglow/task-graph";
|
|
8365
|
-
var
|
|
8962
|
+
var inputSchema25 = {
|
|
8366
8963
|
type: "object",
|
|
8367
8964
|
properties: {
|
|
8368
8965
|
value: {
|
|
@@ -8392,13 +8989,13 @@ var outputSchema24 = {
|
|
|
8392
8989
|
additionalProperties: false
|
|
8393
8990
|
};
|
|
8394
8991
|
|
|
8395
|
-
class StringIncludesTask extends
|
|
8992
|
+
class StringIncludesTask extends Task31 {
|
|
8396
8993
|
static type = "StringIncludesTask";
|
|
8397
8994
|
static category = "String";
|
|
8398
8995
|
static title = "Includes";
|
|
8399
8996
|
static description = "Checks if a string contains a substring";
|
|
8400
8997
|
static inputSchema() {
|
|
8401
|
-
return
|
|
8998
|
+
return inputSchema25;
|
|
8402
8999
|
}
|
|
8403
9000
|
static outputSchema() {
|
|
8404
9001
|
return outputSchema24;
|
|
@@ -8407,14 +9004,14 @@ class StringIncludesTask extends Task29 {
|
|
|
8407
9004
|
return { result: input2.value.includes(input2.search) };
|
|
8408
9005
|
}
|
|
8409
9006
|
}
|
|
8410
|
-
|
|
9007
|
+
Workflow33.prototype.stringIncludes = CreateWorkflow32(StringIncludesTask);
|
|
8411
9008
|
// src/task/string/StringJoinTask.ts
|
|
8412
9009
|
import {
|
|
8413
|
-
CreateWorkflow as
|
|
8414
|
-
Task as
|
|
8415
|
-
Workflow as
|
|
9010
|
+
CreateWorkflow as CreateWorkflow33,
|
|
9011
|
+
Task as Task32,
|
|
9012
|
+
Workflow as Workflow34
|
|
8416
9013
|
} from "@workglow/task-graph";
|
|
8417
|
-
var
|
|
9014
|
+
var inputSchema26 = {
|
|
8418
9015
|
type: "object",
|
|
8419
9016
|
properties: {
|
|
8420
9017
|
values: {
|
|
@@ -8446,13 +9043,13 @@ var outputSchema25 = {
|
|
|
8446
9043
|
additionalProperties: false
|
|
8447
9044
|
};
|
|
8448
9045
|
|
|
8449
|
-
class StringJoinTask extends
|
|
9046
|
+
class StringJoinTask extends Task32 {
|
|
8450
9047
|
static type = "StringJoinTask";
|
|
8451
9048
|
static category = "String";
|
|
8452
9049
|
static title = "Join";
|
|
8453
9050
|
static description = "Joins an array of strings with a separator";
|
|
8454
9051
|
static inputSchema() {
|
|
8455
|
-
return
|
|
9052
|
+
return inputSchema26;
|
|
8456
9053
|
}
|
|
8457
9054
|
static outputSchema() {
|
|
8458
9055
|
return outputSchema25;
|
|
@@ -8462,14 +9059,14 @@ class StringJoinTask extends Task30 {
|
|
|
8462
9059
|
return { result: input2.values.join(separator) };
|
|
8463
9060
|
}
|
|
8464
9061
|
}
|
|
8465
|
-
|
|
9062
|
+
Workflow34.prototype.stringJoin = CreateWorkflow33(StringJoinTask);
|
|
8466
9063
|
// src/task/string/StringLengthTask.ts
|
|
8467
9064
|
import {
|
|
8468
|
-
CreateWorkflow as
|
|
8469
|
-
Task as
|
|
8470
|
-
Workflow as
|
|
9065
|
+
CreateWorkflow as CreateWorkflow34,
|
|
9066
|
+
Task as Task33,
|
|
9067
|
+
Workflow as Workflow35
|
|
8471
9068
|
} from "@workglow/task-graph";
|
|
8472
|
-
var
|
|
9069
|
+
var inputSchema27 = {
|
|
8473
9070
|
type: "object",
|
|
8474
9071
|
properties: {
|
|
8475
9072
|
value: {
|
|
@@ -8494,13 +9091,13 @@ var outputSchema26 = {
|
|
|
8494
9091
|
additionalProperties: false
|
|
8495
9092
|
};
|
|
8496
9093
|
|
|
8497
|
-
class StringLengthTask extends
|
|
9094
|
+
class StringLengthTask extends Task33 {
|
|
8498
9095
|
static type = "StringLengthTask";
|
|
8499
9096
|
static category = "String";
|
|
8500
9097
|
static title = "Length";
|
|
8501
9098
|
static description = "Returns the length of a string";
|
|
8502
9099
|
static inputSchema() {
|
|
8503
|
-
return
|
|
9100
|
+
return inputSchema27;
|
|
8504
9101
|
}
|
|
8505
9102
|
static outputSchema() {
|
|
8506
9103
|
return outputSchema26;
|
|
@@ -8509,14 +9106,14 @@ class StringLengthTask extends Task31 {
|
|
|
8509
9106
|
return { result: input2.value.length };
|
|
8510
9107
|
}
|
|
8511
9108
|
}
|
|
8512
|
-
|
|
9109
|
+
Workflow35.prototype.stringLength = CreateWorkflow34(StringLengthTask);
|
|
8513
9110
|
// src/task/string/StringLowerCaseTask.ts
|
|
8514
9111
|
import {
|
|
8515
|
-
CreateWorkflow as
|
|
8516
|
-
Task as
|
|
8517
|
-
Workflow as
|
|
9112
|
+
CreateWorkflow as CreateWorkflow35,
|
|
9113
|
+
Task as Task34,
|
|
9114
|
+
Workflow as Workflow36
|
|
8518
9115
|
} from "@workglow/task-graph";
|
|
8519
|
-
var
|
|
9116
|
+
var inputSchema28 = {
|
|
8520
9117
|
type: "object",
|
|
8521
9118
|
properties: {
|
|
8522
9119
|
value: {
|
|
@@ -8541,13 +9138,13 @@ var outputSchema27 = {
|
|
|
8541
9138
|
additionalProperties: false
|
|
8542
9139
|
};
|
|
8543
9140
|
|
|
8544
|
-
class StringLowerCaseTask extends
|
|
9141
|
+
class StringLowerCaseTask extends Task34 {
|
|
8545
9142
|
static type = "StringLowerCaseTask";
|
|
8546
9143
|
static category = "String";
|
|
8547
9144
|
static title = "Lower Case";
|
|
8548
9145
|
static description = "Converts a string to lower case";
|
|
8549
9146
|
static inputSchema() {
|
|
8550
|
-
return
|
|
9147
|
+
return inputSchema28;
|
|
8551
9148
|
}
|
|
8552
9149
|
static outputSchema() {
|
|
8553
9150
|
return outputSchema27;
|
|
@@ -8556,14 +9153,14 @@ class StringLowerCaseTask extends Task32 {
|
|
|
8556
9153
|
return { result: input2.value.toLowerCase() };
|
|
8557
9154
|
}
|
|
8558
9155
|
}
|
|
8559
|
-
|
|
9156
|
+
Workflow36.prototype.stringLowerCase = CreateWorkflow35(StringLowerCaseTask);
|
|
8560
9157
|
// src/task/string/StringReplaceTask.ts
|
|
8561
9158
|
import {
|
|
8562
|
-
CreateWorkflow as
|
|
8563
|
-
Task as
|
|
8564
|
-
Workflow as
|
|
9159
|
+
CreateWorkflow as CreateWorkflow36,
|
|
9160
|
+
Task as Task35,
|
|
9161
|
+
Workflow as Workflow37
|
|
8565
9162
|
} from "@workglow/task-graph";
|
|
8566
|
-
var
|
|
9163
|
+
var inputSchema29 = {
|
|
8567
9164
|
type: "object",
|
|
8568
9165
|
properties: {
|
|
8569
9166
|
value: {
|
|
@@ -8598,13 +9195,13 @@ var outputSchema28 = {
|
|
|
8598
9195
|
additionalProperties: false
|
|
8599
9196
|
};
|
|
8600
9197
|
|
|
8601
|
-
class StringReplaceTask extends
|
|
9198
|
+
class StringReplaceTask extends Task35 {
|
|
8602
9199
|
static type = "StringReplaceTask";
|
|
8603
9200
|
static category = "String";
|
|
8604
9201
|
static title = "Replace";
|
|
8605
9202
|
static description = "Replaces all occurrences of a substring";
|
|
8606
9203
|
static inputSchema() {
|
|
8607
|
-
return
|
|
9204
|
+
return inputSchema29;
|
|
8608
9205
|
}
|
|
8609
9206
|
static outputSchema() {
|
|
8610
9207
|
return outputSchema28;
|
|
@@ -8613,14 +9210,14 @@ class StringReplaceTask extends Task33 {
|
|
|
8613
9210
|
return { result: input2.value.replaceAll(input2.search, input2.replace) };
|
|
8614
9211
|
}
|
|
8615
9212
|
}
|
|
8616
|
-
|
|
9213
|
+
Workflow37.prototype.stringReplace = CreateWorkflow36(StringReplaceTask);
|
|
8617
9214
|
// src/task/string/StringSliceTask.ts
|
|
8618
9215
|
import {
|
|
8619
|
-
CreateWorkflow as
|
|
8620
|
-
Task as
|
|
8621
|
-
Workflow as
|
|
9216
|
+
CreateWorkflow as CreateWorkflow37,
|
|
9217
|
+
Task as Task36,
|
|
9218
|
+
Workflow as Workflow38
|
|
8622
9219
|
} from "@workglow/task-graph";
|
|
8623
|
-
var
|
|
9220
|
+
var inputSchema30 = {
|
|
8624
9221
|
type: "object",
|
|
8625
9222
|
properties: {
|
|
8626
9223
|
value: {
|
|
@@ -8655,13 +9252,13 @@ var outputSchema29 = {
|
|
|
8655
9252
|
additionalProperties: false
|
|
8656
9253
|
};
|
|
8657
9254
|
|
|
8658
|
-
class StringSliceTask extends
|
|
9255
|
+
class StringSliceTask extends Task36 {
|
|
8659
9256
|
static type = "StringSliceTask";
|
|
8660
9257
|
static category = "String";
|
|
8661
9258
|
static title = "Slice";
|
|
8662
9259
|
static description = "Extracts a substring by start and optional end index";
|
|
8663
9260
|
static inputSchema() {
|
|
8664
|
-
return
|
|
9261
|
+
return inputSchema30;
|
|
8665
9262
|
}
|
|
8666
9263
|
static outputSchema() {
|
|
8667
9264
|
return outputSchema29;
|
|
@@ -8670,14 +9267,14 @@ class StringSliceTask extends Task34 {
|
|
|
8670
9267
|
return { result: input2.value.slice(input2.start, input2.end) };
|
|
8671
9268
|
}
|
|
8672
9269
|
}
|
|
8673
|
-
|
|
9270
|
+
Workflow38.prototype.stringSlice = CreateWorkflow37(StringSliceTask);
|
|
8674
9271
|
// src/task/string/StringTemplateTask.ts
|
|
8675
9272
|
import {
|
|
8676
|
-
CreateWorkflow as
|
|
8677
|
-
Task as
|
|
8678
|
-
Workflow as
|
|
9273
|
+
CreateWorkflow as CreateWorkflow38,
|
|
9274
|
+
Task as Task37,
|
|
9275
|
+
Workflow as Workflow39
|
|
8679
9276
|
} from "@workglow/task-graph";
|
|
8680
|
-
var
|
|
9277
|
+
var inputSchema31 = {
|
|
8681
9278
|
type: "object",
|
|
8682
9279
|
properties: {
|
|
8683
9280
|
template: {
|
|
@@ -8708,13 +9305,13 @@ var outputSchema30 = {
|
|
|
8708
9305
|
additionalProperties: false
|
|
8709
9306
|
};
|
|
8710
9307
|
|
|
8711
|
-
class StringTemplateTask extends
|
|
9308
|
+
class StringTemplateTask extends Task37 {
|
|
8712
9309
|
static type = "StringTemplateTask";
|
|
8713
9310
|
static category = "String";
|
|
8714
9311
|
static title = "Template";
|
|
8715
9312
|
static description = "Replaces {{key}} placeholders in a template string with values";
|
|
8716
9313
|
static inputSchema() {
|
|
8717
|
-
return
|
|
9314
|
+
return inputSchema31;
|
|
8718
9315
|
}
|
|
8719
9316
|
static outputSchema() {
|
|
8720
9317
|
return outputSchema30;
|
|
@@ -8727,14 +9324,14 @@ class StringTemplateTask extends Task35 {
|
|
|
8727
9324
|
return { result };
|
|
8728
9325
|
}
|
|
8729
9326
|
}
|
|
8730
|
-
|
|
9327
|
+
Workflow39.prototype.stringTemplate = CreateWorkflow38(StringTemplateTask);
|
|
8731
9328
|
// src/task/string/StringTrimTask.ts
|
|
8732
9329
|
import {
|
|
8733
|
-
CreateWorkflow as
|
|
8734
|
-
Task as
|
|
8735
|
-
Workflow as
|
|
9330
|
+
CreateWorkflow as CreateWorkflow39,
|
|
9331
|
+
Task as Task38,
|
|
9332
|
+
Workflow as Workflow40
|
|
8736
9333
|
} from "@workglow/task-graph";
|
|
8737
|
-
var
|
|
9334
|
+
var inputSchema32 = {
|
|
8738
9335
|
type: "object",
|
|
8739
9336
|
properties: {
|
|
8740
9337
|
value: {
|
|
@@ -8759,13 +9356,13 @@ var outputSchema31 = {
|
|
|
8759
9356
|
additionalProperties: false
|
|
8760
9357
|
};
|
|
8761
9358
|
|
|
8762
|
-
class StringTrimTask extends
|
|
9359
|
+
class StringTrimTask extends Task38 {
|
|
8763
9360
|
static type = "StringTrimTask";
|
|
8764
9361
|
static category = "String";
|
|
8765
9362
|
static title = "Trim";
|
|
8766
9363
|
static description = "Removes leading and trailing whitespace from a string";
|
|
8767
9364
|
static inputSchema() {
|
|
8768
|
-
return
|
|
9365
|
+
return inputSchema32;
|
|
8769
9366
|
}
|
|
8770
9367
|
static outputSchema() {
|
|
8771
9368
|
return outputSchema31;
|
|
@@ -8774,14 +9371,14 @@ class StringTrimTask extends Task36 {
|
|
|
8774
9371
|
return { result: input2.value.trim() };
|
|
8775
9372
|
}
|
|
8776
9373
|
}
|
|
8777
|
-
|
|
9374
|
+
Workflow40.prototype.stringTrim = CreateWorkflow39(StringTrimTask);
|
|
8778
9375
|
// src/task/string/StringUpperCaseTask.ts
|
|
8779
9376
|
import {
|
|
8780
|
-
CreateWorkflow as
|
|
8781
|
-
Task as
|
|
8782
|
-
Workflow as
|
|
9377
|
+
CreateWorkflow as CreateWorkflow40,
|
|
9378
|
+
Task as Task39,
|
|
9379
|
+
Workflow as Workflow41
|
|
8783
9380
|
} from "@workglow/task-graph";
|
|
8784
|
-
var
|
|
9381
|
+
var inputSchema33 = {
|
|
8785
9382
|
type: "object",
|
|
8786
9383
|
properties: {
|
|
8787
9384
|
value: {
|
|
@@ -8806,13 +9403,13 @@ var outputSchema32 = {
|
|
|
8806
9403
|
additionalProperties: false
|
|
8807
9404
|
};
|
|
8808
9405
|
|
|
8809
|
-
class StringUpperCaseTask extends
|
|
9406
|
+
class StringUpperCaseTask extends Task39 {
|
|
8810
9407
|
static type = "StringUpperCaseTask";
|
|
8811
9408
|
static category = "String";
|
|
8812
9409
|
static title = "Upper Case";
|
|
8813
9410
|
static description = "Converts a string to upper case";
|
|
8814
9411
|
static inputSchema() {
|
|
8815
|
-
return
|
|
9412
|
+
return inputSchema33;
|
|
8816
9413
|
}
|
|
8817
9414
|
static outputSchema() {
|
|
8818
9415
|
return outputSchema32;
|
|
@@ -8821,10 +9418,10 @@ class StringUpperCaseTask extends Task37 {
|
|
|
8821
9418
|
return { result: input2.value.toUpperCase() };
|
|
8822
9419
|
}
|
|
8823
9420
|
}
|
|
8824
|
-
|
|
9421
|
+
Workflow41.prototype.stringUpperCase = CreateWorkflow40(StringUpperCaseTask);
|
|
8825
9422
|
// src/task/scalar/ScalarAbsTask.ts
|
|
8826
|
-
import { CreateWorkflow as
|
|
8827
|
-
var
|
|
9423
|
+
import { CreateWorkflow as CreateWorkflow41, Task as Task40, Workflow as Workflow42 } from "@workglow/task-graph";
|
|
9424
|
+
var inputSchema34 = {
|
|
8828
9425
|
type: "object",
|
|
8829
9426
|
properties: {
|
|
8830
9427
|
value: {
|
|
@@ -8849,13 +9446,13 @@ var outputSchema33 = {
|
|
|
8849
9446
|
additionalProperties: false
|
|
8850
9447
|
};
|
|
8851
9448
|
|
|
8852
|
-
class ScalarAbsTask extends
|
|
9449
|
+
class ScalarAbsTask extends Task40 {
|
|
8853
9450
|
static type = "ScalarAbsTask";
|
|
8854
9451
|
static category = "Math";
|
|
8855
9452
|
static title = "Abs";
|
|
8856
9453
|
static description = "Returns the absolute value of a number";
|
|
8857
9454
|
static inputSchema() {
|
|
8858
|
-
return
|
|
9455
|
+
return inputSchema34;
|
|
8859
9456
|
}
|
|
8860
9457
|
static outputSchema() {
|
|
8861
9458
|
return outputSchema33;
|
|
@@ -8864,10 +9461,10 @@ class ScalarAbsTask extends Task38 {
|
|
|
8864
9461
|
return { result: Math.abs(input2.value) };
|
|
8865
9462
|
}
|
|
8866
9463
|
}
|
|
8867
|
-
|
|
9464
|
+
Workflow42.prototype.scalarAbs = CreateWorkflow41(ScalarAbsTask);
|
|
8868
9465
|
// src/task/scalar/ScalarCeilTask.ts
|
|
8869
|
-
import { CreateWorkflow as
|
|
8870
|
-
var
|
|
9466
|
+
import { CreateWorkflow as CreateWorkflow42, Task as Task41, Workflow as Workflow43 } from "@workglow/task-graph";
|
|
9467
|
+
var inputSchema35 = {
|
|
8871
9468
|
type: "object",
|
|
8872
9469
|
properties: {
|
|
8873
9470
|
value: {
|
|
@@ -8892,13 +9489,13 @@ var outputSchema34 = {
|
|
|
8892
9489
|
additionalProperties: false
|
|
8893
9490
|
};
|
|
8894
9491
|
|
|
8895
|
-
class ScalarCeilTask extends
|
|
9492
|
+
class ScalarCeilTask extends Task41 {
|
|
8896
9493
|
static type = "ScalarCeilTask";
|
|
8897
9494
|
static category = "Math";
|
|
8898
9495
|
static title = "Ceil";
|
|
8899
9496
|
static description = "Returns the smallest integer greater than or equal to a number";
|
|
8900
9497
|
static inputSchema() {
|
|
8901
|
-
return
|
|
9498
|
+
return inputSchema35;
|
|
8902
9499
|
}
|
|
8903
9500
|
static outputSchema() {
|
|
8904
9501
|
return outputSchema34;
|
|
@@ -8907,10 +9504,10 @@ class ScalarCeilTask extends Task39 {
|
|
|
8907
9504
|
return { result: Math.ceil(input2.value) };
|
|
8908
9505
|
}
|
|
8909
9506
|
}
|
|
8910
|
-
|
|
9507
|
+
Workflow43.prototype.scalarCeil = CreateWorkflow42(ScalarCeilTask);
|
|
8911
9508
|
// src/task/scalar/ScalarFloorTask.ts
|
|
8912
|
-
import { CreateWorkflow as
|
|
8913
|
-
var
|
|
9509
|
+
import { CreateWorkflow as CreateWorkflow43, Task as Task42, Workflow as Workflow44 } from "@workglow/task-graph";
|
|
9510
|
+
var inputSchema36 = {
|
|
8914
9511
|
type: "object",
|
|
8915
9512
|
properties: {
|
|
8916
9513
|
value: {
|
|
@@ -8935,13 +9532,13 @@ var outputSchema35 = {
|
|
|
8935
9532
|
additionalProperties: false
|
|
8936
9533
|
};
|
|
8937
9534
|
|
|
8938
|
-
class ScalarFloorTask extends
|
|
9535
|
+
class ScalarFloorTask extends Task42 {
|
|
8939
9536
|
static type = "ScalarFloorTask";
|
|
8940
9537
|
static category = "Math";
|
|
8941
9538
|
static title = "Floor";
|
|
8942
9539
|
static description = "Returns the largest integer less than or equal to a number";
|
|
8943
9540
|
static inputSchema() {
|
|
8944
|
-
return
|
|
9541
|
+
return inputSchema36;
|
|
8945
9542
|
}
|
|
8946
9543
|
static outputSchema() {
|
|
8947
9544
|
return outputSchema35;
|
|
@@ -8950,10 +9547,10 @@ class ScalarFloorTask extends Task40 {
|
|
|
8950
9547
|
return { result: Math.floor(input2.value) };
|
|
8951
9548
|
}
|
|
8952
9549
|
}
|
|
8953
|
-
|
|
9550
|
+
Workflow44.prototype.scalarFloor = CreateWorkflow43(ScalarFloorTask);
|
|
8954
9551
|
// src/task/scalar/ScalarMaxTask.ts
|
|
8955
|
-
import { CreateWorkflow as
|
|
8956
|
-
var
|
|
9552
|
+
import { CreateWorkflow as CreateWorkflow44, Task as Task43, Workflow as Workflow45 } from "@workglow/task-graph";
|
|
9553
|
+
var inputSchema37 = {
|
|
8957
9554
|
type: "object",
|
|
8958
9555
|
properties: {
|
|
8959
9556
|
values: {
|
|
@@ -8979,13 +9576,13 @@ var outputSchema36 = {
|
|
|
8979
9576
|
additionalProperties: false
|
|
8980
9577
|
};
|
|
8981
9578
|
|
|
8982
|
-
class ScalarMaxTask extends
|
|
9579
|
+
class ScalarMaxTask extends Task43 {
|
|
8983
9580
|
static type = "ScalarMaxTask";
|
|
8984
9581
|
static category = "Math";
|
|
8985
9582
|
static title = "Max";
|
|
8986
9583
|
static description = "Returns the largest of the given numbers";
|
|
8987
9584
|
static inputSchema() {
|
|
8988
|
-
return
|
|
9585
|
+
return inputSchema37;
|
|
8989
9586
|
}
|
|
8990
9587
|
static outputSchema() {
|
|
8991
9588
|
return outputSchema36;
|
|
@@ -8994,10 +9591,10 @@ class ScalarMaxTask extends Task41 {
|
|
|
8994
9591
|
return { result: Math.max(...input2.values) };
|
|
8995
9592
|
}
|
|
8996
9593
|
}
|
|
8997
|
-
|
|
9594
|
+
Workflow45.prototype.scalarMax = CreateWorkflow44(ScalarMaxTask);
|
|
8998
9595
|
// src/task/scalar/ScalarMinTask.ts
|
|
8999
|
-
import { CreateWorkflow as
|
|
9000
|
-
var
|
|
9596
|
+
import { CreateWorkflow as CreateWorkflow45, Task as Task44, Workflow as Workflow46 } from "@workglow/task-graph";
|
|
9597
|
+
var inputSchema38 = {
|
|
9001
9598
|
type: "object",
|
|
9002
9599
|
properties: {
|
|
9003
9600
|
values: {
|
|
@@ -9023,13 +9620,13 @@ var outputSchema37 = {
|
|
|
9023
9620
|
additionalProperties: false
|
|
9024
9621
|
};
|
|
9025
9622
|
|
|
9026
|
-
class ScalarMinTask extends
|
|
9623
|
+
class ScalarMinTask extends Task44 {
|
|
9027
9624
|
static type = "ScalarMinTask";
|
|
9028
9625
|
static category = "Math";
|
|
9029
9626
|
static title = "Min";
|
|
9030
9627
|
static description = "Returns the smallest of the given numbers";
|
|
9031
9628
|
static inputSchema() {
|
|
9032
|
-
return
|
|
9629
|
+
return inputSchema38;
|
|
9033
9630
|
}
|
|
9034
9631
|
static outputSchema() {
|
|
9035
9632
|
return outputSchema37;
|
|
@@ -9038,10 +9635,10 @@ class ScalarMinTask extends Task42 {
|
|
|
9038
9635
|
return { result: Math.min(...input2.values) };
|
|
9039
9636
|
}
|
|
9040
9637
|
}
|
|
9041
|
-
|
|
9638
|
+
Workflow46.prototype.scalarMin = CreateWorkflow45(ScalarMinTask);
|
|
9042
9639
|
// src/task/scalar/ScalarRoundTask.ts
|
|
9043
|
-
import { CreateWorkflow as
|
|
9044
|
-
var
|
|
9640
|
+
import { CreateWorkflow as CreateWorkflow46, Task as Task45, Workflow as Workflow47 } from "@workglow/task-graph";
|
|
9641
|
+
var inputSchema39 = {
|
|
9045
9642
|
type: "object",
|
|
9046
9643
|
properties: {
|
|
9047
9644
|
value: {
|
|
@@ -9066,13 +9663,13 @@ var outputSchema38 = {
|
|
|
9066
9663
|
additionalProperties: false
|
|
9067
9664
|
};
|
|
9068
9665
|
|
|
9069
|
-
class ScalarRoundTask extends
|
|
9666
|
+
class ScalarRoundTask extends Task45 {
|
|
9070
9667
|
static type = "ScalarRoundTask";
|
|
9071
9668
|
static category = "Math";
|
|
9072
9669
|
static title = "Round";
|
|
9073
9670
|
static description = "Returns the value of a number rounded to the nearest integer";
|
|
9074
9671
|
static inputSchema() {
|
|
9075
|
-
return
|
|
9672
|
+
return inputSchema39;
|
|
9076
9673
|
}
|
|
9077
9674
|
static outputSchema() {
|
|
9078
9675
|
return outputSchema38;
|
|
@@ -9081,10 +9678,10 @@ class ScalarRoundTask extends Task43 {
|
|
|
9081
9678
|
return { result: Math.round(input2.value) };
|
|
9082
9679
|
}
|
|
9083
9680
|
}
|
|
9084
|
-
|
|
9681
|
+
Workflow47.prototype.scalarRound = CreateWorkflow46(ScalarRoundTask);
|
|
9085
9682
|
// src/task/scalar/ScalarTruncTask.ts
|
|
9086
|
-
import { CreateWorkflow as
|
|
9087
|
-
var
|
|
9683
|
+
import { CreateWorkflow as CreateWorkflow47, Task as Task46, Workflow as Workflow48 } from "@workglow/task-graph";
|
|
9684
|
+
var inputSchema40 = {
|
|
9088
9685
|
type: "object",
|
|
9089
9686
|
properties: {
|
|
9090
9687
|
value: {
|
|
@@ -9109,13 +9706,13 @@ var outputSchema39 = {
|
|
|
9109
9706
|
additionalProperties: false
|
|
9110
9707
|
};
|
|
9111
9708
|
|
|
9112
|
-
class ScalarTruncTask extends
|
|
9709
|
+
class ScalarTruncTask extends Task46 {
|
|
9113
9710
|
static type = "ScalarTruncTask";
|
|
9114
9711
|
static category = "Math";
|
|
9115
9712
|
static title = "Truncate";
|
|
9116
9713
|
static description = "Returns the integer part of a number by removing fractional digits";
|
|
9117
9714
|
static inputSchema() {
|
|
9118
|
-
return
|
|
9715
|
+
return inputSchema40;
|
|
9119
9716
|
}
|
|
9120
9717
|
static outputSchema() {
|
|
9121
9718
|
return outputSchema39;
|
|
@@ -9124,13 +9721,13 @@ class ScalarTruncTask extends Task44 {
|
|
|
9124
9721
|
return { result: Math.trunc(input2.value) };
|
|
9125
9722
|
}
|
|
9126
9723
|
}
|
|
9127
|
-
|
|
9724
|
+
Workflow48.prototype.scalarTrunc = CreateWorkflow47(ScalarTruncTask);
|
|
9128
9725
|
// src/task/vector/VectorDistanceTask.ts
|
|
9129
|
-
import { CreateWorkflow as
|
|
9726
|
+
import { CreateWorkflow as CreateWorkflow48, Task as Task47, Workflow as Workflow49 } from "@workglow/task-graph";
|
|
9130
9727
|
import {
|
|
9131
9728
|
TypedArraySchema as TypedArraySchema5
|
|
9132
9729
|
} from "@workglow/util/schema";
|
|
9133
|
-
var
|
|
9730
|
+
var inputSchema41 = {
|
|
9134
9731
|
type: "object",
|
|
9135
9732
|
properties: {
|
|
9136
9733
|
vectors: {
|
|
@@ -9159,13 +9756,13 @@ var outputSchema40 = {
|
|
|
9159
9756
|
additionalProperties: false
|
|
9160
9757
|
};
|
|
9161
9758
|
|
|
9162
|
-
class VectorDistanceTask extends
|
|
9759
|
+
class VectorDistanceTask extends Task47 {
|
|
9163
9760
|
static type = "VectorDistanceTask";
|
|
9164
9761
|
static category = "Vector";
|
|
9165
9762
|
static title = "Distance";
|
|
9166
9763
|
static description = "Returns the Euclidean distance between the first two vectors";
|
|
9167
9764
|
static inputSchema() {
|
|
9168
|
-
return
|
|
9765
|
+
return inputSchema41;
|
|
9169
9766
|
}
|
|
9170
9767
|
static outputSchema() {
|
|
9171
9768
|
return outputSchema40;
|
|
@@ -9186,13 +9783,13 @@ class VectorDistanceTask extends Task45 {
|
|
|
9186
9783
|
return { result: Math.sqrt(sumPrecise(diffs)) };
|
|
9187
9784
|
}
|
|
9188
9785
|
}
|
|
9189
|
-
|
|
9786
|
+
Workflow49.prototype.vectorDistance = CreateWorkflow48(VectorDistanceTask);
|
|
9190
9787
|
// src/task/vector/VectorDotProductTask.ts
|
|
9191
|
-
import { CreateWorkflow as
|
|
9788
|
+
import { CreateWorkflow as CreateWorkflow49, Task as Task48, Workflow as Workflow50 } from "@workglow/task-graph";
|
|
9192
9789
|
import {
|
|
9193
9790
|
TypedArraySchema as TypedArraySchema6
|
|
9194
9791
|
} from "@workglow/util/schema";
|
|
9195
|
-
var
|
|
9792
|
+
var inputSchema42 = {
|
|
9196
9793
|
type: "object",
|
|
9197
9794
|
properties: {
|
|
9198
9795
|
vectors: {
|
|
@@ -9221,13 +9818,13 @@ var outputSchema41 = {
|
|
|
9221
9818
|
additionalProperties: false
|
|
9222
9819
|
};
|
|
9223
9820
|
|
|
9224
|
-
class VectorDotProductTask extends
|
|
9821
|
+
class VectorDotProductTask extends Task48 {
|
|
9225
9822
|
static type = "VectorDotProductTask";
|
|
9226
9823
|
static category = "Vector";
|
|
9227
9824
|
static title = "Dot Product";
|
|
9228
9825
|
static description = "Returns the dot (inner) product of the first two vectors";
|
|
9229
9826
|
static inputSchema() {
|
|
9230
|
-
return
|
|
9827
|
+
return inputSchema42;
|
|
9231
9828
|
}
|
|
9232
9829
|
static outputSchema() {
|
|
9233
9830
|
return outputSchema41;
|
|
@@ -9245,14 +9842,14 @@ class VectorDotProductTask extends Task46 {
|
|
|
9245
9842
|
return { result: sumPrecise(products) };
|
|
9246
9843
|
}
|
|
9247
9844
|
}
|
|
9248
|
-
|
|
9845
|
+
Workflow50.prototype.vectorDotProduct = CreateWorkflow49(VectorDotProductTask);
|
|
9249
9846
|
// src/task/vector/VectorNormalizeTask.ts
|
|
9250
|
-
import { CreateWorkflow as
|
|
9847
|
+
import { CreateWorkflow as CreateWorkflow50, Task as Task49, Workflow as Workflow51 } from "@workglow/task-graph";
|
|
9251
9848
|
import {
|
|
9252
9849
|
TypedArraySchema as TypedArraySchema7,
|
|
9253
9850
|
normalize
|
|
9254
9851
|
} from "@workglow/util/schema";
|
|
9255
|
-
var
|
|
9852
|
+
var inputSchema43 = {
|
|
9256
9853
|
type: "object",
|
|
9257
9854
|
properties: {
|
|
9258
9855
|
vector: TypedArraySchema7({
|
|
@@ -9275,13 +9872,13 @@ var outputSchema42 = {
|
|
|
9275
9872
|
additionalProperties: false
|
|
9276
9873
|
};
|
|
9277
9874
|
|
|
9278
|
-
class VectorNormalizeTask extends
|
|
9875
|
+
class VectorNormalizeTask extends Task49 {
|
|
9279
9876
|
static type = "VectorNormalizeTask";
|
|
9280
9877
|
static category = "Vector";
|
|
9281
9878
|
static title = "Normalize";
|
|
9282
9879
|
static description = "Returns the L2-normalized (unit length) vector";
|
|
9283
9880
|
static inputSchema() {
|
|
9284
|
-
return
|
|
9881
|
+
return inputSchema43;
|
|
9285
9882
|
}
|
|
9286
9883
|
static outputSchema() {
|
|
9287
9884
|
return outputSchema42;
|
|
@@ -9290,14 +9887,14 @@ class VectorNormalizeTask extends Task47 {
|
|
|
9290
9887
|
return { result: normalize(input2.vector) };
|
|
9291
9888
|
}
|
|
9292
9889
|
}
|
|
9293
|
-
|
|
9890
|
+
Workflow51.prototype.vectorNormalize = CreateWorkflow50(VectorNormalizeTask);
|
|
9294
9891
|
// src/task/vector/VectorScaleTask.ts
|
|
9295
|
-
import { CreateWorkflow as
|
|
9892
|
+
import { CreateWorkflow as CreateWorkflow51, Task as Task50, Workflow as Workflow52 } from "@workglow/task-graph";
|
|
9296
9893
|
import {
|
|
9297
9894
|
createTypedArrayFrom as createTypedArrayFrom5,
|
|
9298
9895
|
TypedArraySchema as TypedArraySchema8
|
|
9299
9896
|
} from "@workglow/util/schema";
|
|
9300
|
-
var
|
|
9897
|
+
var inputSchema44 = {
|
|
9301
9898
|
type: "object",
|
|
9302
9899
|
properties: {
|
|
9303
9900
|
vector: TypedArraySchema8({
|
|
@@ -9325,13 +9922,13 @@ var outputSchema43 = {
|
|
|
9325
9922
|
additionalProperties: false
|
|
9326
9923
|
};
|
|
9327
9924
|
|
|
9328
|
-
class VectorScaleTask extends
|
|
9925
|
+
class VectorScaleTask extends Task50 {
|
|
9329
9926
|
static type = "VectorScaleTask";
|
|
9330
9927
|
static category = "Vector";
|
|
9331
9928
|
static title = "Scale";
|
|
9332
9929
|
static description = "Multiplies each element of a vector by a scalar";
|
|
9333
9930
|
static inputSchema() {
|
|
9334
|
-
return
|
|
9931
|
+
return inputSchema44;
|
|
9335
9932
|
}
|
|
9336
9933
|
static outputSchema() {
|
|
9337
9934
|
return outputSchema43;
|
|
@@ -9342,7 +9939,7 @@ class VectorScaleTask extends Task48 {
|
|
|
9342
9939
|
return { result: createTypedArrayFrom5([vector], values) };
|
|
9343
9940
|
}
|
|
9344
9941
|
}
|
|
9345
|
-
|
|
9942
|
+
Workflow52.prototype.vectorScale = CreateWorkflow51(VectorScaleTask);
|
|
9346
9943
|
|
|
9347
9944
|
// src/common.ts
|
|
9348
9945
|
import { TaskRegistry } from "@workglow/task-graph";
|
|
@@ -9351,6 +9948,8 @@ var registerCommonTasks = () => {
|
|
|
9351
9948
|
DebugLogTask,
|
|
9352
9949
|
DelayTask,
|
|
9353
9950
|
FetchUrlTask,
|
|
9951
|
+
HumanApprovalTask,
|
|
9952
|
+
HumanInputTask,
|
|
9354
9953
|
InputTask,
|
|
9355
9954
|
JavaScriptTask,
|
|
9356
9955
|
JsonTask,
|
|
@@ -9403,21 +10002,21 @@ var registerCommonTasks = () => {
|
|
|
9403
10002
|
};
|
|
9404
10003
|
// src/task/FileLoaderTask.server.ts
|
|
9405
10004
|
import {
|
|
9406
|
-
CreateWorkflow as
|
|
9407
|
-
TaskAbortedError as
|
|
9408
|
-
Workflow as
|
|
10005
|
+
CreateWorkflow as CreateWorkflow53,
|
|
10006
|
+
TaskAbortedError as TaskAbortedError5,
|
|
10007
|
+
Workflow as Workflow54
|
|
9409
10008
|
} from "@workglow/task-graph";
|
|
9410
10009
|
import { readFile } from "fs/promises";
|
|
9411
10010
|
|
|
9412
10011
|
// src/task/FileLoaderTask.ts
|
|
9413
10012
|
import {
|
|
9414
|
-
CreateWorkflow as
|
|
9415
|
-
Task as
|
|
9416
|
-
TaskAbortedError as
|
|
9417
|
-
Workflow as
|
|
10013
|
+
CreateWorkflow as CreateWorkflow52,
|
|
10014
|
+
Task as Task51,
|
|
10015
|
+
TaskAbortedError as TaskAbortedError4,
|
|
10016
|
+
Workflow as Workflow53
|
|
9418
10017
|
} from "@workglow/task-graph";
|
|
9419
10018
|
import Papa from "papaparse";
|
|
9420
|
-
var
|
|
10019
|
+
var inputSchema45 = {
|
|
9421
10020
|
type: "object",
|
|
9422
10021
|
properties: {
|
|
9423
10022
|
url: {
|
|
@@ -9488,14 +10087,14 @@ var outputSchema44 = {
|
|
|
9488
10087
|
additionalProperties: false
|
|
9489
10088
|
};
|
|
9490
10089
|
|
|
9491
|
-
class FileLoaderTask extends
|
|
10090
|
+
class FileLoaderTask extends Task51 {
|
|
9492
10091
|
static type = "FileLoaderTask";
|
|
9493
10092
|
static category = "Document";
|
|
9494
10093
|
static title = "File Loader";
|
|
9495
10094
|
static description = "Load documents from URLs (http://, https://)";
|
|
9496
10095
|
static cacheable = true;
|
|
9497
10096
|
static inputSchema() {
|
|
9498
|
-
return
|
|
10097
|
+
return inputSchema45;
|
|
9499
10098
|
}
|
|
9500
10099
|
static outputSchema() {
|
|
9501
10100
|
return outputSchema44;
|
|
@@ -9503,30 +10102,28 @@ class FileLoaderTask extends Task49 {
|
|
|
9503
10102
|
async execute(input2, context) {
|
|
9504
10103
|
const { url, format = "auto" } = input2;
|
|
9505
10104
|
if (context.signal.aborted) {
|
|
9506
|
-
throw new
|
|
10105
|
+
throw new TaskAbortedError4("Task aborted");
|
|
9507
10106
|
}
|
|
9508
10107
|
await context.updateProgress(0, "Detecting file format");
|
|
9509
10108
|
const detectedFormat = this.detectFormat(url, format);
|
|
9510
10109
|
const responseType = this.detectResponseType(detectedFormat);
|
|
9511
10110
|
if (context.signal.aborted) {
|
|
9512
|
-
throw new
|
|
10111
|
+
throw new TaskAbortedError4("Task aborted");
|
|
9513
10112
|
}
|
|
9514
10113
|
await context.updateProgress(10, `Fetching ${detectedFormat} file from ${url}`);
|
|
9515
|
-
const fetchTask = context.own(new FetchUrlTask({
|
|
10114
|
+
const fetchTask = context.own(new FetchUrlTask({ queue: false }));
|
|
10115
|
+
const response = await fetchTask.run({
|
|
9516
10116
|
url,
|
|
9517
10117
|
response_type: responseType
|
|
9518
|
-
}
|
|
9519
|
-
queue: false
|
|
9520
|
-
}));
|
|
9521
|
-
const response = await fetchTask.run();
|
|
10118
|
+
});
|
|
9522
10119
|
if (context.signal.aborted) {
|
|
9523
|
-
throw new
|
|
10120
|
+
throw new TaskAbortedError4("Task aborted");
|
|
9524
10121
|
}
|
|
9525
10122
|
await context.updateProgress(60, "Parsing file content");
|
|
9526
10123
|
const title = url.split("/").pop() || url;
|
|
9527
10124
|
const { text, json: json2, csv, image, pdf, frontmatter, size, mimeType } = await this.parseResponse(response, url, detectedFormat);
|
|
9528
10125
|
if (context.signal.aborted) {
|
|
9529
|
-
throw new
|
|
10126
|
+
throw new TaskAbortedError4("Task aborted");
|
|
9530
10127
|
}
|
|
9531
10128
|
await context.updateProgress(100, "File loaded successfully");
|
|
9532
10129
|
return {
|
|
@@ -9849,7 +10446,7 @@ class FileLoaderTask extends Task49 {
|
|
|
9849
10446
|
});
|
|
9850
10447
|
}
|
|
9851
10448
|
}
|
|
9852
|
-
|
|
10449
|
+
Workflow53.prototype.fileLoader = CreateWorkflow52(FileLoaderTask);
|
|
9853
10450
|
|
|
9854
10451
|
// src/task/FileLoaderTask.server.ts
|
|
9855
10452
|
class FileLoaderTask2 extends FileLoaderTask {
|
|
@@ -9859,7 +10456,7 @@ class FileLoaderTask2 extends FileLoaderTask {
|
|
|
9859
10456
|
return super.execute(input2, context);
|
|
9860
10457
|
}
|
|
9861
10458
|
if (context.signal.aborted) {
|
|
9862
|
-
throw new
|
|
10459
|
+
throw new TaskAbortedError5("Task aborted");
|
|
9863
10460
|
}
|
|
9864
10461
|
await context.updateProgress(0, "Detecting file format");
|
|
9865
10462
|
if (url.startsWith("file://")) {
|
|
@@ -9868,19 +10465,19 @@ class FileLoaderTask2 extends FileLoaderTask {
|
|
|
9868
10465
|
const detectedFormat = this.detectFormat(url, format);
|
|
9869
10466
|
const title = url.split("/").pop() || url;
|
|
9870
10467
|
if (context.signal.aborted) {
|
|
9871
|
-
throw new
|
|
10468
|
+
throw new TaskAbortedError5("Task aborted");
|
|
9872
10469
|
}
|
|
9873
10470
|
await context.updateProgress(10, `Reading ${detectedFormat} file from filesystem`);
|
|
9874
10471
|
if (detectedFormat === "json") {
|
|
9875
10472
|
const fileContent2 = await readFile(url, { encoding: "utf-8" });
|
|
9876
10473
|
if (context.signal.aborted) {
|
|
9877
|
-
throw new
|
|
10474
|
+
throw new TaskAbortedError5("Task aborted");
|
|
9878
10475
|
}
|
|
9879
10476
|
await context.updateProgress(50, "Parsing JSON content");
|
|
9880
10477
|
const jsonData = this.parseJsonContent(fileContent2);
|
|
9881
10478
|
const content = JSON.stringify(jsonData, null, 2);
|
|
9882
10479
|
if (context.signal.aborted) {
|
|
9883
|
-
throw new
|
|
10480
|
+
throw new TaskAbortedError5("Task aborted");
|
|
9884
10481
|
}
|
|
9885
10482
|
await context.updateProgress(100, "File loaded successfully");
|
|
9886
10483
|
return {
|
|
@@ -9905,12 +10502,12 @@ class FileLoaderTask2 extends FileLoaderTask {
|
|
|
9905
10502
|
throw new Error(`Failed to load CSV from ${url}`);
|
|
9906
10503
|
}
|
|
9907
10504
|
if (context.signal.aborted) {
|
|
9908
|
-
throw new
|
|
10505
|
+
throw new TaskAbortedError5("Task aborted");
|
|
9909
10506
|
}
|
|
9910
10507
|
await context.updateProgress(50, "Parsing CSV content");
|
|
9911
10508
|
const csvData = this.parseCsvContent(fileContent2);
|
|
9912
10509
|
if (context.signal.aborted) {
|
|
9913
|
-
throw new
|
|
10510
|
+
throw new TaskAbortedError5("Task aborted");
|
|
9914
10511
|
}
|
|
9915
10512
|
await context.updateProgress(100, "File loaded successfully");
|
|
9916
10513
|
return {
|
|
@@ -9932,14 +10529,14 @@ class FileLoaderTask2 extends FileLoaderTask {
|
|
|
9932
10529
|
if (detectedFormat === "image") {
|
|
9933
10530
|
const fileBuffer = await readFile(url);
|
|
9934
10531
|
if (context.signal.aborted) {
|
|
9935
|
-
throw new
|
|
10532
|
+
throw new TaskAbortedError5("Task aborted");
|
|
9936
10533
|
}
|
|
9937
10534
|
await context.updateProgress(50, "Converting image to base64");
|
|
9938
10535
|
const mimeType2 = this.getImageMimeType(url);
|
|
9939
10536
|
const blob = new Blob([fileBuffer], { type: mimeType2 });
|
|
9940
10537
|
const imageData = await this.blobToBase64DataURL(blob, mimeType2);
|
|
9941
10538
|
if (context.signal.aborted) {
|
|
9942
|
-
throw new
|
|
10539
|
+
throw new TaskAbortedError5("Task aborted");
|
|
9943
10540
|
}
|
|
9944
10541
|
await context.updateProgress(100, "File loaded successfully");
|
|
9945
10542
|
return {
|
|
@@ -9961,14 +10558,14 @@ class FileLoaderTask2 extends FileLoaderTask {
|
|
|
9961
10558
|
if (detectedFormat === "pdf") {
|
|
9962
10559
|
const fileBuffer = await readFile(url);
|
|
9963
10560
|
if (context.signal.aborted) {
|
|
9964
|
-
throw new
|
|
10561
|
+
throw new TaskAbortedError5("Task aborted");
|
|
9965
10562
|
}
|
|
9966
10563
|
await context.updateProgress(50, "Converting PDF to base64");
|
|
9967
10564
|
const mimeType2 = "application/pdf";
|
|
9968
10565
|
const blob = new Blob([fileBuffer], { type: mimeType2 });
|
|
9969
10566
|
const pdfData = await this.blobToBase64DataURL(blob, mimeType2);
|
|
9970
10567
|
if (context.signal.aborted) {
|
|
9971
|
-
throw new
|
|
10568
|
+
throw new TaskAbortedError5("Task aborted");
|
|
9972
10569
|
}
|
|
9973
10570
|
await context.updateProgress(100, "File loaded successfully");
|
|
9974
10571
|
return {
|
|
@@ -9992,12 +10589,12 @@ class FileLoaderTask2 extends FileLoaderTask {
|
|
|
9992
10589
|
throw new Error(`Failed to load content from ${url}`);
|
|
9993
10590
|
}
|
|
9994
10591
|
if (context.signal.aborted) {
|
|
9995
|
-
throw new
|
|
10592
|
+
throw new TaskAbortedError5("Task aborted");
|
|
9996
10593
|
}
|
|
9997
10594
|
await context.updateProgress(50, `Parsing ${detectedFormat} content`);
|
|
9998
10595
|
const mimeType = detectedFormat === "markdown" ? "text/markdown" : detectedFormat === "html" ? "text/html" : "text/plain";
|
|
9999
10596
|
if (context.signal.aborted) {
|
|
10000
|
-
throw new
|
|
10597
|
+
throw new TaskAbortedError5("Task aborted");
|
|
10001
10598
|
}
|
|
10002
10599
|
await context.updateProgress(100, "File loaded successfully");
|
|
10003
10600
|
if (detectedFormat === "markdown") {
|
|
@@ -10036,9 +10633,9 @@ class FileLoaderTask2 extends FileLoaderTask {
|
|
|
10036
10633
|
}
|
|
10037
10634
|
}
|
|
10038
10635
|
var fileLoader = (input2, config) => {
|
|
10039
|
-
return new FileLoaderTask2(
|
|
10636
|
+
return new FileLoaderTask2(config).run(input2);
|
|
10040
10637
|
};
|
|
10041
|
-
|
|
10638
|
+
Workflow54.prototype.fileLoader = CreateWorkflow53(FileLoaderTask2);
|
|
10042
10639
|
|
|
10043
10640
|
// src/bun.ts
|
|
10044
10641
|
import { StdioClientTransport } from "@modelcontextprotocol/sdk/client/stdio.js";
|
|
@@ -10062,6 +10659,7 @@ export {
|
|
|
10062
10659
|
setGlobalMcpServerRepository,
|
|
10063
10660
|
searchMcpRegistryPage,
|
|
10064
10661
|
searchMcpRegistry,
|
|
10662
|
+
resolveHumanConnector,
|
|
10065
10663
|
resolveAuthSecrets,
|
|
10066
10664
|
registerMcpTaskDeps,
|
|
10067
10665
|
registerMcpServer,
|
|
@@ -10139,6 +10737,7 @@ export {
|
|
|
10139
10737
|
McpResourceReadTask,
|
|
10140
10738
|
McpPromptGetTask,
|
|
10141
10739
|
McpListTask,
|
|
10740
|
+
McpElicitationConnector,
|
|
10142
10741
|
MCP_TASK_DEPS,
|
|
10143
10742
|
MCP_SERVER_REPOSITORY,
|
|
10144
10743
|
MCP_SERVERS,
|
|
@@ -10148,6 +10747,9 @@ export {
|
|
|
10148
10747
|
JavaScriptTask,
|
|
10149
10748
|
InputTask,
|
|
10150
10749
|
InMemoryMcpServerRepository,
|
|
10750
|
+
HumanInputTask,
|
|
10751
|
+
HumanApprovalTask,
|
|
10752
|
+
HUMAN_CONNECTOR,
|
|
10151
10753
|
FileLoaderTask2 as FileLoaderTask,
|
|
10152
10754
|
FetchUrlTask,
|
|
10153
10755
|
FetchUrlJob,
|
|
@@ -10158,4 +10760,4 @@ export {
|
|
|
10158
10760
|
ArrayTask
|
|
10159
10761
|
};
|
|
10160
10762
|
|
|
10161
|
-
//# debugId=
|
|
10763
|
+
//# debugId=DC14AA49C50E3BA564756E2164756E21
|