@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/browser.js
CHANGED
|
@@ -598,7 +598,11 @@ class ArrayTask extends GraphAsTask {
|
|
|
598
598
|
const combinations = this.generateCombinations(inputObject, inputIds);
|
|
599
599
|
const tasks = combinations.map((combination) => {
|
|
600
600
|
const { id, title, ...rest } = this.config;
|
|
601
|
-
const task = new this.constructor({
|
|
601
|
+
const task = new this.constructor({
|
|
602
|
+
...rest,
|
|
603
|
+
id: `${id}_${uuid4()}`,
|
|
604
|
+
defaults: { ...this.defaults, ...this.runInputData, ...combination }
|
|
605
|
+
}, this.runConfig);
|
|
602
606
|
return task;
|
|
603
607
|
});
|
|
604
608
|
this.subGraph.addTasks(tasks);
|
|
@@ -728,7 +732,7 @@ class DebugLogTask extends Task10 {
|
|
|
728
732
|
}
|
|
729
733
|
}
|
|
730
734
|
var debugLog = (input, config = {}) => {
|
|
731
|
-
const task = new DebugLogTask(
|
|
735
|
+
const task = new DebugLogTask(config);
|
|
732
736
|
return task.run(input);
|
|
733
737
|
};
|
|
734
738
|
Workflow11.prototype.debugLog = CreateWorkflow10(DebugLogTask);
|
|
@@ -800,7 +804,7 @@ class DelayTask extends Task11 {
|
|
|
800
804
|
}
|
|
801
805
|
}
|
|
802
806
|
var delay = (input, config = { delay: 1 }) => {
|
|
803
|
-
const task = new DelayTask(
|
|
807
|
+
const task = new DelayTask(config);
|
|
804
808
|
return task.run(input);
|
|
805
809
|
};
|
|
806
810
|
Workflow12.prototype.delay = CreateWorkflow11(DelayTask);
|
|
@@ -813,6 +817,7 @@ import {
|
|
|
813
817
|
} from "@workglow/job-queue";
|
|
814
818
|
import {
|
|
815
819
|
CreateWorkflow as CreateWorkflow12,
|
|
820
|
+
Entitlements,
|
|
816
821
|
getJobQueueFactory,
|
|
817
822
|
getTaskQueueRegistry,
|
|
818
823
|
JobTaskFailedError,
|
|
@@ -1075,6 +1080,18 @@ class FetchUrlTask extends Task12 {
|
|
|
1075
1080
|
static title = "Fetch";
|
|
1076
1081
|
static description = "Fetches data from a URL with progress tracking and automatic retry handling";
|
|
1077
1082
|
static hasDynamicSchemas = true;
|
|
1083
|
+
static entitlements() {
|
|
1084
|
+
return {
|
|
1085
|
+
entitlements: [
|
|
1086
|
+
{ id: Entitlements.NETWORK_HTTP, reason: "Fetches data from URLs via HTTP/HTTPS" },
|
|
1087
|
+
{
|
|
1088
|
+
id: Entitlements.CREDENTIAL,
|
|
1089
|
+
reason: "May use Bearer token authentication",
|
|
1090
|
+
optional: true
|
|
1091
|
+
}
|
|
1092
|
+
]
|
|
1093
|
+
};
|
|
1094
|
+
}
|
|
1078
1095
|
static configSchema() {
|
|
1079
1096
|
return fetchUrlTaskConfigSchema;
|
|
1080
1097
|
}
|
|
@@ -1147,7 +1164,7 @@ class FetchUrlTask extends Task12 {
|
|
|
1147
1164
|
}
|
|
1148
1165
|
const registeredQueue = await this.resolveOrCreateQueue(queueName);
|
|
1149
1166
|
if (executeContext.signal.aborted) {
|
|
1150
|
-
throw executeContext.signal.reason ?? new
|
|
1167
|
+
throw executeContext.signal.reason ?? new AbortSignalJobError("The operation was aborted");
|
|
1151
1168
|
}
|
|
1152
1169
|
const handle = await registeredQueue.client.submit(jobInput, {
|
|
1153
1170
|
jobRunId: this.runConfig.runnerId,
|
|
@@ -1164,7 +1181,7 @@ class FetchUrlTask extends Task12 {
|
|
|
1164
1181
|
});
|
|
1165
1182
|
try {
|
|
1166
1183
|
if (executeContext.signal.aborted) {
|
|
1167
|
-
throw executeContext.signal.reason ?? new
|
|
1184
|
+
throw executeContext.signal.reason ?? new AbortSignalJobError("The operation was aborted");
|
|
1168
1185
|
}
|
|
1169
1186
|
const output = await handle.waitFor();
|
|
1170
1187
|
return output;
|
|
@@ -1242,18 +1259,455 @@ class FetchUrlTask extends Task12 {
|
|
|
1242
1259
|
}
|
|
1243
1260
|
}
|
|
1244
1261
|
var fetchUrl = async (input, config = {}) => {
|
|
1245
|
-
const result = await new FetchUrlTask(
|
|
1262
|
+
const result = await new FetchUrlTask(config).run(input);
|
|
1246
1263
|
return result;
|
|
1247
1264
|
};
|
|
1248
1265
|
Workflow13.prototype.fetch = CreateWorkflow12(FetchUrlTask);
|
|
1249
|
-
// src/task/
|
|
1266
|
+
// src/task/HumanApprovalTask.ts
|
|
1267
|
+
import {
|
|
1268
|
+
CreateWorkflow as CreateWorkflow14,
|
|
1269
|
+
Task as Task14,
|
|
1270
|
+
TaskAbortedError as TaskAbortedError3,
|
|
1271
|
+
TaskConfigSchema as TaskConfigSchema5,
|
|
1272
|
+
Workflow as Workflow15
|
|
1273
|
+
} from "@workglow/task-graph";
|
|
1274
|
+
import { uuid4 as uuid43 } from "@workglow/util";
|
|
1275
|
+
|
|
1276
|
+
// src/task/HumanInputTask.ts
|
|
1250
1277
|
import {
|
|
1251
1278
|
CreateWorkflow as CreateWorkflow13,
|
|
1252
1279
|
Task as Task13,
|
|
1280
|
+
TaskAbortedError as TaskAbortedError2,
|
|
1281
|
+
TaskConfigSchema as TaskConfigSchema4,
|
|
1282
|
+
TaskConfigurationError as TaskConfigurationError2,
|
|
1253
1283
|
Workflow as Workflow14
|
|
1254
1284
|
} from "@workglow/task-graph";
|
|
1285
|
+
import { createServiceToken, uuid4 as uuid42 } from "@workglow/util";
|
|
1286
|
+
var HUMAN_CONNECTOR = createServiceToken("HUMAN_CONNECTOR");
|
|
1287
|
+
var humanInputTaskConfigSchema = {
|
|
1288
|
+
type: "object",
|
|
1289
|
+
properties: {
|
|
1290
|
+
...TaskConfigSchema4["properties"],
|
|
1291
|
+
targetHumanId: {
|
|
1292
|
+
type: "string",
|
|
1293
|
+
title: "Target Human",
|
|
1294
|
+
description: "Identifier of the human to ask (e.g. 'default', 'admin', 'user:alice')",
|
|
1295
|
+
default: "default"
|
|
1296
|
+
},
|
|
1297
|
+
kind: {
|
|
1298
|
+
type: "string",
|
|
1299
|
+
title: "Kind",
|
|
1300
|
+
description: "Interaction kind: notify (one-way), display (show content), elicit (request input)",
|
|
1301
|
+
enum: ["notify", "display", "elicit"],
|
|
1302
|
+
default: "elicit"
|
|
1303
|
+
},
|
|
1304
|
+
contentSchema: {
|
|
1305
|
+
type: "object",
|
|
1306
|
+
properties: {},
|
|
1307
|
+
additionalProperties: true,
|
|
1308
|
+
title: "Content Schema",
|
|
1309
|
+
description: "JSON schema describing the content/form to present",
|
|
1310
|
+
"x-ui-hidden": true
|
|
1311
|
+
},
|
|
1312
|
+
message: {
|
|
1313
|
+
type: "string",
|
|
1314
|
+
title: "Message",
|
|
1315
|
+
description: "Explanatory message shown to the human",
|
|
1316
|
+
"x-ui-editor": "textarea"
|
|
1317
|
+
},
|
|
1318
|
+
mode: {
|
|
1319
|
+
type: "string",
|
|
1320
|
+
title: "Mode",
|
|
1321
|
+
description: "Interaction mode",
|
|
1322
|
+
enum: ["single", "multi-turn"],
|
|
1323
|
+
default: "single"
|
|
1324
|
+
},
|
|
1325
|
+
metadata: {
|
|
1326
|
+
type: "object",
|
|
1327
|
+
additionalProperties: true,
|
|
1328
|
+
"x-ui-hidden": true
|
|
1329
|
+
}
|
|
1330
|
+
},
|
|
1331
|
+
additionalProperties: false
|
|
1332
|
+
};
|
|
1333
|
+
var defaultInputSchema = {
|
|
1334
|
+
type: "object",
|
|
1335
|
+
properties: {
|
|
1336
|
+
prompt: {
|
|
1337
|
+
type: "string",
|
|
1338
|
+
title: "Prompt",
|
|
1339
|
+
description: "Dynamic prompt text merged into the request message"
|
|
1340
|
+
},
|
|
1341
|
+
contentData: {
|
|
1342
|
+
type: "object",
|
|
1343
|
+
additionalProperties: true,
|
|
1344
|
+
title: "Content Data",
|
|
1345
|
+
description: "Data to display (for notify/display kinds)",
|
|
1346
|
+
"x-ui-hidden": true
|
|
1347
|
+
},
|
|
1348
|
+
context: {
|
|
1349
|
+
type: "object",
|
|
1350
|
+
additionalProperties: true,
|
|
1351
|
+
title: "Context",
|
|
1352
|
+
description: "Dynamic context data merged into the request metadata",
|
|
1353
|
+
"x-ui-hidden": true
|
|
1354
|
+
}
|
|
1355
|
+
},
|
|
1356
|
+
additionalProperties: false
|
|
1357
|
+
};
|
|
1358
|
+
var defaultOutputSchema = {
|
|
1359
|
+
type: "object",
|
|
1360
|
+
properties: {
|
|
1361
|
+
action: {
|
|
1362
|
+
type: "string",
|
|
1363
|
+
title: "Action",
|
|
1364
|
+
description: "The human's action: accept, decline, or cancel",
|
|
1365
|
+
enum: ["accept", "decline", "cancel"]
|
|
1366
|
+
}
|
|
1367
|
+
},
|
|
1368
|
+
additionalProperties: true
|
|
1369
|
+
};
|
|
1370
|
+
|
|
1371
|
+
class HumanInputTask extends Task13 {
|
|
1372
|
+
static type = "HumanInputTask";
|
|
1373
|
+
static category = "Flow Control";
|
|
1374
|
+
static title = "Human Input";
|
|
1375
|
+
static description = "Sends an interaction (notification, display, or input request) to a human";
|
|
1376
|
+
static cacheable = false;
|
|
1377
|
+
static hasDynamicSchemas = true;
|
|
1378
|
+
static configSchema() {
|
|
1379
|
+
return humanInputTaskConfigSchema;
|
|
1380
|
+
}
|
|
1381
|
+
static inputSchema() {
|
|
1382
|
+
return defaultInputSchema;
|
|
1383
|
+
}
|
|
1384
|
+
static outputSchema() {
|
|
1385
|
+
return defaultOutputSchema;
|
|
1386
|
+
}
|
|
1387
|
+
outputSchema() {
|
|
1388
|
+
if (this.config?.contentSchema && (this.config.kind ?? "elicit") === "elicit") {
|
|
1389
|
+
const configSchema = this.config.contentSchema;
|
|
1390
|
+
const existingProps = configSchema.properties ?? {};
|
|
1391
|
+
const additionalProperties = configSchema.additionalProperties ?? false;
|
|
1392
|
+
const actionProp = {
|
|
1393
|
+
type: "string",
|
|
1394
|
+
title: "Action",
|
|
1395
|
+
description: "The human's action: accept, decline, or cancel",
|
|
1396
|
+
enum: ["accept", "decline", "cancel"]
|
|
1397
|
+
};
|
|
1398
|
+
const result = {
|
|
1399
|
+
type: "object",
|
|
1400
|
+
properties: { ...existingProps, action: actionProp },
|
|
1401
|
+
required: ["action"],
|
|
1402
|
+
additionalProperties
|
|
1403
|
+
};
|
|
1404
|
+
return result;
|
|
1405
|
+
}
|
|
1406
|
+
return this.constructor.outputSchema();
|
|
1407
|
+
}
|
|
1408
|
+
async execute(input, context) {
|
|
1409
|
+
const connector = resolveHumanConnector(context);
|
|
1410
|
+
const kind = this.config.kind ?? "elicit";
|
|
1411
|
+
const mode = this.config.mode ?? "single";
|
|
1412
|
+
const requestId = uuid42();
|
|
1413
|
+
const message = input.prompt ? this.config.message ? `${this.config.message}
|
|
1414
|
+
|
|
1415
|
+
${input.prompt}` : input.prompt : this.config.message ?? "";
|
|
1416
|
+
const emptySchema = {
|
|
1417
|
+
type: "object",
|
|
1418
|
+
properties: {},
|
|
1419
|
+
additionalProperties: true
|
|
1420
|
+
};
|
|
1421
|
+
const request = {
|
|
1422
|
+
requestId,
|
|
1423
|
+
targetHumanId: this.config.targetHumanId ?? "default",
|
|
1424
|
+
kind,
|
|
1425
|
+
message,
|
|
1426
|
+
contentSchema: this.config.contentSchema ?? emptySchema,
|
|
1427
|
+
contentData: input.contentData,
|
|
1428
|
+
expectsResponse: kind === "elicit",
|
|
1429
|
+
mode: kind === "elicit" ? mode : "single",
|
|
1430
|
+
metadata: input.context ? { ...this.config.metadata, ...input.context } : this.config.metadata
|
|
1431
|
+
};
|
|
1432
|
+
if (context.signal.aborted) {
|
|
1433
|
+
throw new TaskAbortedError2("Task aborted before sending human interaction");
|
|
1434
|
+
}
|
|
1435
|
+
let response;
|
|
1436
|
+
try {
|
|
1437
|
+
response = await connector.send(request, context.signal);
|
|
1438
|
+
} catch (err) {
|
|
1439
|
+
if (context.signal.aborted) {
|
|
1440
|
+
throw new TaskAbortedError2("Task aborted during human interaction");
|
|
1441
|
+
}
|
|
1442
|
+
throw err;
|
|
1443
|
+
}
|
|
1444
|
+
if (kind === "elicit" && mode === "multi-turn" && !response.done) {
|
|
1445
|
+
if (typeof connector.followUp !== "function") {
|
|
1446
|
+
throw new TaskConfigurationError2('HumanInputTask is configured for "multi-turn" mode but the registered ' + "IHumanConnector does not implement followUp()");
|
|
1447
|
+
}
|
|
1448
|
+
while (!response.done) {
|
|
1449
|
+
if (context.signal.aborted) {
|
|
1450
|
+
throw new TaskAbortedError2("Task aborted during multi-turn conversation");
|
|
1451
|
+
}
|
|
1452
|
+
try {
|
|
1453
|
+
response = await connector.followUp(request, response, context.signal);
|
|
1454
|
+
} catch (err) {
|
|
1455
|
+
if (context.signal.aborted) {
|
|
1456
|
+
throw new TaskAbortedError2("Task aborted during multi-turn conversation");
|
|
1457
|
+
}
|
|
1458
|
+
throw err;
|
|
1459
|
+
}
|
|
1460
|
+
}
|
|
1461
|
+
}
|
|
1462
|
+
return { ...response.content, action: response.action };
|
|
1463
|
+
}
|
|
1464
|
+
}
|
|
1465
|
+
function resolveHumanConnector(context) {
|
|
1466
|
+
if (!context.registry.has(HUMAN_CONNECTOR)) {
|
|
1467
|
+
throw new TaskConfigurationError2("No IHumanConnector registered. Register one via " + "registry.registerInstance(HUMAN_CONNECTOR, connector) before running a human-in-the-loop task.");
|
|
1468
|
+
}
|
|
1469
|
+
return context.registry.get(HUMAN_CONNECTOR);
|
|
1470
|
+
}
|
|
1471
|
+
Workflow14.prototype.humanInput = CreateWorkflow13(HumanInputTask);
|
|
1472
|
+
|
|
1473
|
+
// src/task/HumanApprovalTask.ts
|
|
1474
|
+
var humanApprovalConfigSchema = {
|
|
1475
|
+
type: "object",
|
|
1476
|
+
properties: {
|
|
1477
|
+
...TaskConfigSchema5["properties"],
|
|
1478
|
+
targetHumanId: {
|
|
1479
|
+
type: "string",
|
|
1480
|
+
title: "Target Human",
|
|
1481
|
+
description: "Identifier of the human to ask for approval",
|
|
1482
|
+
default: "default"
|
|
1483
|
+
},
|
|
1484
|
+
message: {
|
|
1485
|
+
type: "string",
|
|
1486
|
+
title: "Message",
|
|
1487
|
+
description: "Explanatory message shown to the approver",
|
|
1488
|
+
"x-ui-editor": "textarea"
|
|
1489
|
+
},
|
|
1490
|
+
metadata: {
|
|
1491
|
+
type: "object",
|
|
1492
|
+
additionalProperties: true,
|
|
1493
|
+
"x-ui-hidden": true
|
|
1494
|
+
}
|
|
1495
|
+
},
|
|
1496
|
+
additionalProperties: false
|
|
1497
|
+
};
|
|
1498
|
+
var inputSchema13 = {
|
|
1499
|
+
type: "object",
|
|
1500
|
+
properties: {
|
|
1501
|
+
prompt: {
|
|
1502
|
+
type: "string",
|
|
1503
|
+
title: "Prompt",
|
|
1504
|
+
description: "Dynamic prompt text merged into the approval message"
|
|
1505
|
+
},
|
|
1506
|
+
context: {
|
|
1507
|
+
type: "object",
|
|
1508
|
+
additionalProperties: true,
|
|
1509
|
+
title: "Context",
|
|
1510
|
+
description: "Dynamic context data merged into the request metadata",
|
|
1511
|
+
"x-ui-hidden": true
|
|
1512
|
+
}
|
|
1513
|
+
},
|
|
1514
|
+
additionalProperties: false
|
|
1515
|
+
};
|
|
1516
|
+
var approvalRequestedSchema = {
|
|
1517
|
+
type: "object",
|
|
1518
|
+
properties: {
|
|
1519
|
+
approved: {
|
|
1520
|
+
type: "boolean",
|
|
1521
|
+
title: "Approved",
|
|
1522
|
+
description: "Whether the request is approved"
|
|
1523
|
+
},
|
|
1524
|
+
reason: {
|
|
1525
|
+
type: "string",
|
|
1526
|
+
title: "Reason",
|
|
1527
|
+
description: "Optional explanation for the decision"
|
|
1528
|
+
}
|
|
1529
|
+
},
|
|
1530
|
+
required: ["approved"]
|
|
1531
|
+
};
|
|
1532
|
+
var approvalOutputSchema = {
|
|
1533
|
+
type: "object",
|
|
1534
|
+
properties: {
|
|
1535
|
+
action: {
|
|
1536
|
+
type: "string",
|
|
1537
|
+
title: "Action",
|
|
1538
|
+
description: "The human's action: accept, decline, or cancel",
|
|
1539
|
+
enum: ["accept", "decline", "cancel"]
|
|
1540
|
+
},
|
|
1541
|
+
approved: {
|
|
1542
|
+
type: "boolean",
|
|
1543
|
+
title: "Approved",
|
|
1544
|
+
description: "Whether the human approved the request"
|
|
1545
|
+
},
|
|
1546
|
+
reason: {
|
|
1547
|
+
type: "string",
|
|
1548
|
+
title: "Reason",
|
|
1549
|
+
description: "Optional explanation for the decision"
|
|
1550
|
+
}
|
|
1551
|
+
},
|
|
1552
|
+
required: ["action", "approved"],
|
|
1553
|
+
additionalProperties: false
|
|
1554
|
+
};
|
|
1555
|
+
|
|
1556
|
+
class HumanApprovalTask extends Task14 {
|
|
1557
|
+
static type = "HumanApprovalTask";
|
|
1558
|
+
static category = "Flow Control";
|
|
1559
|
+
static title = "Human Approval";
|
|
1560
|
+
static description = "Pauses execution to request approval from a human (approve/deny) via MCP elicitation";
|
|
1561
|
+
static cacheable = false;
|
|
1562
|
+
static configSchema() {
|
|
1563
|
+
return humanApprovalConfigSchema;
|
|
1564
|
+
}
|
|
1565
|
+
static inputSchema() {
|
|
1566
|
+
return inputSchema13;
|
|
1567
|
+
}
|
|
1568
|
+
static outputSchema() {
|
|
1569
|
+
return approvalOutputSchema;
|
|
1570
|
+
}
|
|
1571
|
+
async execute(input, context) {
|
|
1572
|
+
const connector = resolveHumanConnector(context);
|
|
1573
|
+
const requestId = uuid43();
|
|
1574
|
+
const message = input.prompt ? this.config.message ? `${this.config.message}
|
|
1575
|
+
|
|
1576
|
+
${input.prompt}` : input.prompt : this.config.message ?? "";
|
|
1577
|
+
const request = {
|
|
1578
|
+
requestId,
|
|
1579
|
+
targetHumanId: this.config.targetHumanId ?? "default",
|
|
1580
|
+
kind: "elicit",
|
|
1581
|
+
message,
|
|
1582
|
+
contentSchema: approvalRequestedSchema,
|
|
1583
|
+
contentData: undefined,
|
|
1584
|
+
expectsResponse: true,
|
|
1585
|
+
mode: "single",
|
|
1586
|
+
metadata: input.context ? { ...this.config.metadata, ...input.context } : this.config.metadata
|
|
1587
|
+
};
|
|
1588
|
+
if (context.signal.aborted) {
|
|
1589
|
+
throw new TaskAbortedError3("Task aborted before requesting human approval");
|
|
1590
|
+
}
|
|
1591
|
+
let response;
|
|
1592
|
+
try {
|
|
1593
|
+
response = await connector.send(request, context.signal);
|
|
1594
|
+
} catch (err) {
|
|
1595
|
+
if (context.signal.aborted) {
|
|
1596
|
+
throw new TaskAbortedError3("Task aborted during human approval");
|
|
1597
|
+
}
|
|
1598
|
+
throw err;
|
|
1599
|
+
}
|
|
1600
|
+
if (response.action === "accept" && response.content) {
|
|
1601
|
+
return {
|
|
1602
|
+
action: response.action,
|
|
1603
|
+
approved: response.content.approved === true,
|
|
1604
|
+
reason: response.content.reason
|
|
1605
|
+
};
|
|
1606
|
+
}
|
|
1607
|
+
return {
|
|
1608
|
+
action: response.action,
|
|
1609
|
+
approved: false,
|
|
1610
|
+
...response.content?.reason !== undefined ? { reason: response.content.reason } : {}
|
|
1611
|
+
};
|
|
1612
|
+
}
|
|
1613
|
+
}
|
|
1614
|
+
Workflow15.prototype.humanApproval = CreateWorkflow14(HumanApprovalTask);
|
|
1615
|
+
// src/task/McpElicitationConnector.ts
|
|
1616
|
+
function defaultAbortError() {
|
|
1617
|
+
const err = new Error("The operation was aborted");
|
|
1618
|
+
err.name = "AbortError";
|
|
1619
|
+
return err;
|
|
1620
|
+
}
|
|
1621
|
+
function toMcpRequestedSchema(schema) {
|
|
1622
|
+
const props = schema.properties ?? {};
|
|
1623
|
+
const required = schema.required;
|
|
1624
|
+
return {
|
|
1625
|
+
type: "object",
|
|
1626
|
+
properties: props,
|
|
1627
|
+
...required ? { required } : {}
|
|
1628
|
+
};
|
|
1629
|
+
}
|
|
1630
|
+
|
|
1631
|
+
class McpElicitationConnector {
|
|
1632
|
+
server;
|
|
1633
|
+
constructor(server) {
|
|
1634
|
+
this.server = server;
|
|
1635
|
+
}
|
|
1636
|
+
async send(request, signal) {
|
|
1637
|
+
switch (request.kind) {
|
|
1638
|
+
case "notify":
|
|
1639
|
+
return this.handleNotify(request, signal);
|
|
1640
|
+
case "display":
|
|
1641
|
+
return this.handleDisplay(request, signal);
|
|
1642
|
+
case "elicit":
|
|
1643
|
+
return this.handleElicit(request, signal);
|
|
1644
|
+
default:
|
|
1645
|
+
return this.handleElicit(request, signal);
|
|
1646
|
+
}
|
|
1647
|
+
}
|
|
1648
|
+
async followUp(request, _previousResponse, signal) {
|
|
1649
|
+
return this.send(request, signal);
|
|
1650
|
+
}
|
|
1651
|
+
async handleNotify(request, signal) {
|
|
1652
|
+
if (signal.aborted) {
|
|
1653
|
+
throw signal.reason ?? defaultAbortError();
|
|
1654
|
+
}
|
|
1655
|
+
await this.server.sendLoggingMessage({
|
|
1656
|
+
level: "info",
|
|
1657
|
+
data: request.contentData ?? request.message,
|
|
1658
|
+
logger: request.targetHumanId
|
|
1659
|
+
});
|
|
1660
|
+
if (signal.aborted) {
|
|
1661
|
+
throw signal.reason ?? defaultAbortError();
|
|
1662
|
+
}
|
|
1663
|
+
return {
|
|
1664
|
+
requestId: request.requestId,
|
|
1665
|
+
action: "accept",
|
|
1666
|
+
content: undefined,
|
|
1667
|
+
done: true
|
|
1668
|
+
};
|
|
1669
|
+
}
|
|
1670
|
+
async handleDisplay(request, signal) {
|
|
1671
|
+
if (signal.aborted) {
|
|
1672
|
+
throw signal.reason ?? defaultAbortError();
|
|
1673
|
+
}
|
|
1674
|
+
await this.server.sendLoggingMessage({
|
|
1675
|
+
level: "info",
|
|
1676
|
+
data: {
|
|
1677
|
+
message: request.message,
|
|
1678
|
+
content: request.contentData,
|
|
1679
|
+
schema: request.contentSchema
|
|
1680
|
+
},
|
|
1681
|
+
logger: request.targetHumanId
|
|
1682
|
+
});
|
|
1683
|
+
if (signal.aborted) {
|
|
1684
|
+
throw signal.reason ?? defaultAbortError();
|
|
1685
|
+
}
|
|
1686
|
+
return {
|
|
1687
|
+
requestId: request.requestId,
|
|
1688
|
+
action: "accept",
|
|
1689
|
+
content: undefined,
|
|
1690
|
+
done: true
|
|
1691
|
+
};
|
|
1692
|
+
}
|
|
1693
|
+
async handleElicit(request, signal) {
|
|
1694
|
+
const mcpResult = await this.server.elicitInput({
|
|
1695
|
+
mode: "form",
|
|
1696
|
+
message: request.message,
|
|
1697
|
+
requestedSchema: toMcpRequestedSchema(request.contentSchema)
|
|
1698
|
+
}, { signal });
|
|
1699
|
+
return {
|
|
1700
|
+
requestId: request.requestId,
|
|
1701
|
+
action: mcpResult.action,
|
|
1702
|
+
content: mcpResult.action === "accept" ? mcpResult.content : undefined,
|
|
1703
|
+
done: true
|
|
1704
|
+
};
|
|
1705
|
+
}
|
|
1706
|
+
}
|
|
1707
|
+
// src/task/InputTask.ts
|
|
1708
|
+
import { CreateWorkflow as CreateWorkflow15, Task as Task15, Workflow as Workflow16 } from "@workglow/task-graph";
|
|
1255
1709
|
|
|
1256
|
-
class InputTask extends
|
|
1710
|
+
class InputTask extends Task15 {
|
|
1257
1711
|
static type = "InputTask";
|
|
1258
1712
|
static category = "Flow Control";
|
|
1259
1713
|
static title = "Input";
|
|
@@ -1304,14 +1758,15 @@ class InputTask extends Task13 {
|
|
|
1304
1758
|
yield { type: "finish", data: input };
|
|
1305
1759
|
}
|
|
1306
1760
|
}
|
|
1307
|
-
|
|
1761
|
+
Workflow16.prototype.input = CreateWorkflow15(InputTask);
|
|
1308
1762
|
// src/task/JavaScriptTask.ts
|
|
1309
1763
|
import {
|
|
1310
|
-
CreateWorkflow as
|
|
1311
|
-
|
|
1312
|
-
|
|
1764
|
+
CreateWorkflow as CreateWorkflow16,
|
|
1765
|
+
Entitlements as Entitlements2,
|
|
1766
|
+
Task as Task16,
|
|
1767
|
+
TaskConfigSchema as TaskConfigSchema6,
|
|
1313
1768
|
TaskInvalidInputError as TaskInvalidInputError3,
|
|
1314
|
-
Workflow as
|
|
1769
|
+
Workflow as Workflow17
|
|
1315
1770
|
} from "@workglow/task-graph";
|
|
1316
1771
|
|
|
1317
1772
|
// src/util/acorn.js
|
|
@@ -5779,7 +6234,7 @@ var isValidIdentifier = (key) => /^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(key);
|
|
|
5779
6234
|
var configSchema = {
|
|
5780
6235
|
type: "object",
|
|
5781
6236
|
properties: {
|
|
5782
|
-
...
|
|
6237
|
+
...TaskConfigSchema6["properties"],
|
|
5783
6238
|
javascript_code: {
|
|
5784
6239
|
type: "string",
|
|
5785
6240
|
title: "Code",
|
|
@@ -5790,7 +6245,7 @@ var configSchema = {
|
|
|
5790
6245
|
},
|
|
5791
6246
|
additionalProperties: false
|
|
5792
6247
|
};
|
|
5793
|
-
var
|
|
6248
|
+
var inputSchema14 = {
|
|
5794
6249
|
type: "object",
|
|
5795
6250
|
properties: {
|
|
5796
6251
|
javascript_code: {
|
|
@@ -5816,24 +6271,32 @@ var outputSchema13 = {
|
|
|
5816
6271
|
additionalProperties: false
|
|
5817
6272
|
};
|
|
5818
6273
|
|
|
5819
|
-
class JavaScriptTask extends
|
|
6274
|
+
class JavaScriptTask extends Task16 {
|
|
5820
6275
|
static type = "JavaScriptTask";
|
|
5821
6276
|
static category = "Utility";
|
|
5822
6277
|
static title = "JavaScript Interpreter";
|
|
5823
6278
|
static description = "Executes JavaScript code in a sandboxed interpreter environment";
|
|
5824
6279
|
static customizable = true;
|
|
6280
|
+
static hasDynamicSchemas = true;
|
|
6281
|
+
static entitlements() {
|
|
6282
|
+
return {
|
|
6283
|
+
entitlements: [
|
|
6284
|
+
{
|
|
6285
|
+
id: Entitlements2.CODE_EXECUTION_JS,
|
|
6286
|
+
reason: "Executes user-provided JavaScript code in a sandboxed interpreter"
|
|
6287
|
+
}
|
|
6288
|
+
]
|
|
6289
|
+
};
|
|
6290
|
+
}
|
|
5825
6291
|
static configSchema() {
|
|
5826
6292
|
return configSchema;
|
|
5827
6293
|
}
|
|
5828
6294
|
static inputSchema() {
|
|
5829
|
-
return
|
|
6295
|
+
return inputSchema14;
|
|
5830
6296
|
}
|
|
5831
6297
|
static outputSchema() {
|
|
5832
6298
|
return outputSchema13;
|
|
5833
6299
|
}
|
|
5834
|
-
constructor(input2 = {}, config = {}) {
|
|
5835
|
-
super(input2, config);
|
|
5836
|
-
}
|
|
5837
6300
|
inputSchema() {
|
|
5838
6301
|
if (this.config?.javascript_code) {
|
|
5839
6302
|
if (this.config.inputSchema) {
|
|
@@ -5845,7 +6308,7 @@ class JavaScriptTask extends Task14 {
|
|
|
5845
6308
|
additionalProperties: true
|
|
5846
6309
|
};
|
|
5847
6310
|
}
|
|
5848
|
-
return
|
|
6311
|
+
return inputSchema14;
|
|
5849
6312
|
}
|
|
5850
6313
|
async executeReactive(input2, output) {
|
|
5851
6314
|
const code = input2.javascript_code || this.config.javascript_code;
|
|
@@ -5865,20 +6328,20 @@ class JavaScriptTask extends Task14 {
|
|
|
5865
6328
|
}
|
|
5866
6329
|
}
|
|
5867
6330
|
var javaScript = (input2, config = {}) => {
|
|
5868
|
-
return new JavaScriptTask(
|
|
6331
|
+
return new JavaScriptTask(config).run(input2);
|
|
5869
6332
|
};
|
|
5870
|
-
|
|
6333
|
+
Workflow17.prototype.javaScript = CreateWorkflow16(JavaScriptTask);
|
|
5871
6334
|
// src/task/JsonTask.ts
|
|
5872
6335
|
import {
|
|
5873
6336
|
createGraphFromDependencyJSON,
|
|
5874
6337
|
createGraphFromGraphJSON,
|
|
5875
|
-
CreateWorkflow as
|
|
6338
|
+
CreateWorkflow as CreateWorkflow17,
|
|
5876
6339
|
Dataflow,
|
|
5877
6340
|
GraphAsTask as GraphAsTask2,
|
|
5878
|
-
TaskConfigurationError as
|
|
5879
|
-
Workflow as
|
|
6341
|
+
TaskConfigurationError as TaskConfigurationError3,
|
|
6342
|
+
Workflow as Workflow18
|
|
5880
6343
|
} from "@workglow/task-graph";
|
|
5881
|
-
var
|
|
6344
|
+
var inputSchema15 = {
|
|
5882
6345
|
type: "object",
|
|
5883
6346
|
properties: {
|
|
5884
6347
|
json: {
|
|
@@ -5906,7 +6369,7 @@ class JsonTask extends GraphAsTask2 {
|
|
|
5906
6369
|
static title = "JSON Task";
|
|
5907
6370
|
static description = "A task that creates and manages task graphs from JSON configurations";
|
|
5908
6371
|
static inputSchema() {
|
|
5909
|
-
return
|
|
6372
|
+
return inputSchema15;
|
|
5910
6373
|
}
|
|
5911
6374
|
static outputSchema() {
|
|
5912
6375
|
return outputSchema14;
|
|
@@ -5930,7 +6393,7 @@ class JsonTask extends GraphAsTask2 {
|
|
|
5930
6393
|
for (const dep of dependencies) {
|
|
5931
6394
|
const sourceTask = this.subGraph.getTask(dep.id);
|
|
5932
6395
|
if (!sourceTask) {
|
|
5933
|
-
throw new
|
|
6396
|
+
throw new TaskConfigurationError3(`Dependency id ${dep.id} not found`);
|
|
5934
6397
|
}
|
|
5935
6398
|
const df = new Dataflow(sourceTask.id, dep.output, item.id, input2);
|
|
5936
6399
|
this.subGraph.addDataflow(df);
|
|
@@ -5941,28 +6404,28 @@ class JsonTask extends GraphAsTask2 {
|
|
|
5941
6404
|
}
|
|
5942
6405
|
}
|
|
5943
6406
|
var json = (input2, config = {}) => {
|
|
5944
|
-
return new JsonTask(
|
|
6407
|
+
return new JsonTask(config).run(input2);
|
|
5945
6408
|
};
|
|
5946
|
-
|
|
6409
|
+
Workflow18.prototype.json = CreateWorkflow17(JsonTask);
|
|
5947
6410
|
// src/task/LambdaTask.ts
|
|
5948
6411
|
import {
|
|
5949
|
-
CreateWorkflow as
|
|
6412
|
+
CreateWorkflow as CreateWorkflow18,
|
|
5950
6413
|
DATAFLOW_ALL_PORTS,
|
|
5951
|
-
Task as
|
|
5952
|
-
TaskConfigSchema as
|
|
5953
|
-
TaskConfigurationError as
|
|
5954
|
-
Workflow as
|
|
6414
|
+
Task as Task17,
|
|
6415
|
+
TaskConfigSchema as TaskConfigSchema7,
|
|
6416
|
+
TaskConfigurationError as TaskConfigurationError4,
|
|
6417
|
+
Workflow as Workflow19
|
|
5955
6418
|
} from "@workglow/task-graph";
|
|
5956
6419
|
var lambdaTaskConfigSchema = {
|
|
5957
6420
|
type: "object",
|
|
5958
6421
|
properties: {
|
|
5959
|
-
...
|
|
6422
|
+
...TaskConfigSchema7["properties"],
|
|
5960
6423
|
execute: {},
|
|
5961
6424
|
executeReactive: {}
|
|
5962
6425
|
},
|
|
5963
6426
|
additionalProperties: false
|
|
5964
6427
|
};
|
|
5965
|
-
var
|
|
6428
|
+
var inputSchema16 = {
|
|
5966
6429
|
type: "object",
|
|
5967
6430
|
properties: {
|
|
5968
6431
|
[DATAFLOW_ALL_PORTS]: {
|
|
@@ -5983,7 +6446,7 @@ var outputSchema15 = {
|
|
|
5983
6446
|
additionalProperties: true
|
|
5984
6447
|
};
|
|
5985
6448
|
|
|
5986
|
-
class LambdaTask extends
|
|
6449
|
+
class LambdaTask extends Task17 {
|
|
5987
6450
|
static type = "LambdaTask";
|
|
5988
6451
|
static title = "Lambda Task";
|
|
5989
6452
|
static description = "A task that wraps a provided function and its input";
|
|
@@ -5993,7 +6456,7 @@ class LambdaTask extends Task15 {
|
|
|
5993
6456
|
return lambdaTaskConfigSchema;
|
|
5994
6457
|
}
|
|
5995
6458
|
static inputSchema() {
|
|
5996
|
-
return
|
|
6459
|
+
return inputSchema16;
|
|
5997
6460
|
}
|
|
5998
6461
|
static outputSchema() {
|
|
5999
6462
|
return outputSchema15;
|
|
@@ -6001,11 +6464,11 @@ class LambdaTask extends Task15 {
|
|
|
6001
6464
|
canSerializeConfig() {
|
|
6002
6465
|
return false;
|
|
6003
6466
|
}
|
|
6004
|
-
constructor(
|
|
6467
|
+
constructor(config = {}) {
|
|
6005
6468
|
if (!config.execute && !config.executeReactive) {
|
|
6006
|
-
throw new
|
|
6469
|
+
throw new TaskConfigurationError4("LambdaTask must have either execute or executeReactive function in config");
|
|
6007
6470
|
}
|
|
6008
|
-
super(
|
|
6471
|
+
super(config);
|
|
6009
6472
|
}
|
|
6010
6473
|
async execute(input2, context) {
|
|
6011
6474
|
if (typeof this.config.execute === "function") {
|
|
@@ -6022,18 +6485,18 @@ class LambdaTask extends Task15 {
|
|
|
6022
6485
|
}
|
|
6023
6486
|
function lambda(input2, config) {
|
|
6024
6487
|
if (typeof input2 === "function") {
|
|
6025
|
-
const task2 = new LambdaTask({
|
|
6488
|
+
const task2 = new LambdaTask({
|
|
6026
6489
|
execute: input2
|
|
6027
6490
|
});
|
|
6028
6491
|
return task2.run();
|
|
6029
6492
|
}
|
|
6030
|
-
const task = new LambdaTask(
|
|
6493
|
+
const task = new LambdaTask({ ...config, defaults: input2 });
|
|
6031
6494
|
return task.run();
|
|
6032
6495
|
}
|
|
6033
|
-
|
|
6496
|
+
Workflow19.prototype.lambda = CreateWorkflow18(LambdaTask);
|
|
6034
6497
|
// src/task/MergeTask.ts
|
|
6035
|
-
import { CreateWorkflow as
|
|
6036
|
-
var
|
|
6498
|
+
import { CreateWorkflow as CreateWorkflow19, Task as Task18, Workflow as Workflow20 } from "@workglow/task-graph";
|
|
6499
|
+
var inputSchema17 = {
|
|
6037
6500
|
type: "object",
|
|
6038
6501
|
properties: {},
|
|
6039
6502
|
additionalProperties: true
|
|
@@ -6050,14 +6513,14 @@ var outputSchema16 = {
|
|
|
6050
6513
|
additionalProperties: false
|
|
6051
6514
|
};
|
|
6052
6515
|
|
|
6053
|
-
class MergeTask extends
|
|
6516
|
+
class MergeTask extends Task18 {
|
|
6054
6517
|
static type = "MergeTask";
|
|
6055
6518
|
static category = "Utility";
|
|
6056
6519
|
static title = "Merge";
|
|
6057
6520
|
static description = "Merges multiple inputs into a single array output";
|
|
6058
6521
|
static cacheable = true;
|
|
6059
6522
|
static inputSchema() {
|
|
6060
|
-
return
|
|
6523
|
+
return inputSchema17;
|
|
6061
6524
|
}
|
|
6062
6525
|
static outputSchema() {
|
|
6063
6526
|
return outputSchema16;
|
|
@@ -6071,24 +6534,21 @@ class MergeTask extends Task16 {
|
|
|
6071
6534
|
}
|
|
6072
6535
|
}
|
|
6073
6536
|
var merge = (input2, config = {}) => {
|
|
6074
|
-
const task = new MergeTask(
|
|
6537
|
+
const task = new MergeTask(config);
|
|
6075
6538
|
return task.run(input2);
|
|
6076
6539
|
};
|
|
6077
|
-
|
|
6540
|
+
Workflow20.prototype.merge = CreateWorkflow19(MergeTask);
|
|
6078
6541
|
// src/task/OutputTask.ts
|
|
6079
|
-
import {
|
|
6080
|
-
CreateWorkflow as CreateWorkflow18,
|
|
6081
|
-
Task as Task17,
|
|
6082
|
-
Workflow as Workflow19
|
|
6083
|
-
} from "@workglow/task-graph";
|
|
6542
|
+
import { CreateWorkflow as CreateWorkflow20, Task as Task19, Workflow as Workflow21 } from "@workglow/task-graph";
|
|
6084
6543
|
|
|
6085
|
-
class OutputTask extends
|
|
6544
|
+
class OutputTask extends Task19 {
|
|
6086
6545
|
static type = "OutputTask";
|
|
6087
6546
|
static category = "Flow Control";
|
|
6088
6547
|
static title = "Output";
|
|
6089
6548
|
static description = "Ends the workflow";
|
|
6090
6549
|
static hasDynamicSchemas = true;
|
|
6091
6550
|
static cacheable = false;
|
|
6551
|
+
static isGraphOutput = true;
|
|
6092
6552
|
static inputSchema() {
|
|
6093
6553
|
return {
|
|
6094
6554
|
type: "object",
|
|
@@ -6133,10 +6593,10 @@ class OutputTask extends Task17 {
|
|
|
6133
6593
|
yield { type: "finish", data: input2 };
|
|
6134
6594
|
}
|
|
6135
6595
|
}
|
|
6136
|
-
|
|
6596
|
+
Workflow21.prototype.output = CreateWorkflow20(OutputTask);
|
|
6137
6597
|
// src/task/SplitTask.ts
|
|
6138
|
-
import { CreateWorkflow as
|
|
6139
|
-
var
|
|
6598
|
+
import { CreateWorkflow as CreateWorkflow21, Task as Task20, Workflow as Workflow22 } from "@workglow/task-graph";
|
|
6599
|
+
var inputSchema18 = {
|
|
6140
6600
|
type: "object",
|
|
6141
6601
|
properties: {
|
|
6142
6602
|
input: {
|
|
@@ -6152,22 +6612,18 @@ var outputSchema17 = {
|
|
|
6152
6612
|
additionalProperties: true
|
|
6153
6613
|
};
|
|
6154
6614
|
|
|
6155
|
-
class SplitTask extends
|
|
6615
|
+
class SplitTask extends Task20 {
|
|
6156
6616
|
static type = "SplitTask";
|
|
6157
6617
|
static category = "Utility";
|
|
6158
6618
|
static title = "Split";
|
|
6159
6619
|
static description = "Splits an array into individual outputs, creating one output per element";
|
|
6160
|
-
static hasDynamicSchemas = true;
|
|
6161
6620
|
static cacheable = false;
|
|
6162
6621
|
static inputSchema() {
|
|
6163
|
-
return
|
|
6622
|
+
return inputSchema18;
|
|
6164
6623
|
}
|
|
6165
6624
|
static outputSchema() {
|
|
6166
6625
|
return outputSchema17;
|
|
6167
6626
|
}
|
|
6168
|
-
outputSchema() {
|
|
6169
|
-
return outputSchema17;
|
|
6170
|
-
}
|
|
6171
6627
|
async executeReactive(input2) {
|
|
6172
6628
|
const inputValue = input2.input;
|
|
6173
6629
|
const output = {};
|
|
@@ -6182,17 +6638,17 @@ class SplitTask extends Task18 {
|
|
|
6182
6638
|
}
|
|
6183
6639
|
}
|
|
6184
6640
|
var split = (input2, config = {}) => {
|
|
6185
|
-
const task = new SplitTask(
|
|
6641
|
+
const task = new SplitTask(config);
|
|
6186
6642
|
return task.run(input2);
|
|
6187
6643
|
};
|
|
6188
|
-
|
|
6644
|
+
Workflow22.prototype.split = CreateWorkflow21(SplitTask);
|
|
6189
6645
|
// src/task/DateFormatTask.ts
|
|
6190
6646
|
import {
|
|
6191
|
-
CreateWorkflow as
|
|
6192
|
-
Task as
|
|
6193
|
-
Workflow as
|
|
6647
|
+
CreateWorkflow as CreateWorkflow22,
|
|
6648
|
+
Task as Task21,
|
|
6649
|
+
Workflow as Workflow23
|
|
6194
6650
|
} from "@workglow/task-graph";
|
|
6195
|
-
var
|
|
6651
|
+
var inputSchema19 = {
|
|
6196
6652
|
type: "object",
|
|
6197
6653
|
properties: {
|
|
6198
6654
|
value: {
|
|
@@ -6235,13 +6691,13 @@ var outputSchema18 = {
|
|
|
6235
6691
|
additionalProperties: false
|
|
6236
6692
|
};
|
|
6237
6693
|
|
|
6238
|
-
class DateFormatTask extends
|
|
6694
|
+
class DateFormatTask extends Task21 {
|
|
6239
6695
|
static type = "DateFormatTask";
|
|
6240
6696
|
static category = "Utility";
|
|
6241
6697
|
static title = "Date Format";
|
|
6242
6698
|
static description = "Parses and formats a date string";
|
|
6243
6699
|
static inputSchema() {
|
|
6244
|
-
return
|
|
6700
|
+
return inputSchema19;
|
|
6245
6701
|
}
|
|
6246
6702
|
static outputSchema() {
|
|
6247
6703
|
return outputSchema18;
|
|
@@ -6277,14 +6733,14 @@ class DateFormatTask extends Task19 {
|
|
|
6277
6733
|
return { result };
|
|
6278
6734
|
}
|
|
6279
6735
|
}
|
|
6280
|
-
|
|
6736
|
+
Workflow23.prototype.dateFormat = CreateWorkflow22(DateFormatTask);
|
|
6281
6737
|
// src/task/JsonPathTask.ts
|
|
6282
6738
|
import {
|
|
6283
|
-
CreateWorkflow as
|
|
6284
|
-
Task as
|
|
6285
|
-
Workflow as
|
|
6739
|
+
CreateWorkflow as CreateWorkflow23,
|
|
6740
|
+
Task as Task22,
|
|
6741
|
+
Workflow as Workflow24
|
|
6286
6742
|
} from "@workglow/task-graph";
|
|
6287
|
-
var
|
|
6743
|
+
var inputSchema20 = {
|
|
6288
6744
|
type: "object",
|
|
6289
6745
|
properties: {
|
|
6290
6746
|
value: {
|
|
@@ -6333,13 +6789,13 @@ function resolvePath(obj, segments) {
|
|
|
6333
6789
|
return resolvePath(next2, tail);
|
|
6334
6790
|
}
|
|
6335
6791
|
|
|
6336
|
-
class JsonPathTask extends
|
|
6792
|
+
class JsonPathTask extends Task22 {
|
|
6337
6793
|
static type = "JsonPathTask";
|
|
6338
6794
|
static category = "Utility";
|
|
6339
6795
|
static title = "JSON Path";
|
|
6340
6796
|
static description = "Extracts a value from an object using a dot-notation path";
|
|
6341
6797
|
static inputSchema() {
|
|
6342
|
-
return
|
|
6798
|
+
return inputSchema20;
|
|
6343
6799
|
}
|
|
6344
6800
|
static outputSchema() {
|
|
6345
6801
|
return outputSchema19;
|
|
@@ -6350,20 +6806,20 @@ class JsonPathTask extends Task20 {
|
|
|
6350
6806
|
return { result };
|
|
6351
6807
|
}
|
|
6352
6808
|
}
|
|
6353
|
-
|
|
6809
|
+
Workflow24.prototype.jsonPath = CreateWorkflow23(JsonPathTask);
|
|
6354
6810
|
// src/task/RegexTask.ts
|
|
6355
6811
|
import {
|
|
6356
|
-
CreateWorkflow as
|
|
6357
|
-
Task as
|
|
6812
|
+
CreateWorkflow as CreateWorkflow24,
|
|
6813
|
+
Task as Task23,
|
|
6358
6814
|
TaskInvalidInputError as TaskInvalidInputError4,
|
|
6359
|
-
Workflow as
|
|
6815
|
+
Workflow as Workflow25
|
|
6360
6816
|
} from "@workglow/task-graph";
|
|
6361
6817
|
var MAX_BRACKET_COUNT = 100;
|
|
6362
6818
|
function hasNestedQuantifiers(pattern) {
|
|
6363
6819
|
const withoutClasses = pattern.replace(/\[(?:[^\]\\]|\\.)*\]/g, "X");
|
|
6364
6820
|
return /\([^)]*[+*][^)]*\)[+*?]|\([^)]*[+*][^)]*\)\{/.test(withoutClasses);
|
|
6365
6821
|
}
|
|
6366
|
-
var
|
|
6822
|
+
var inputSchema21 = {
|
|
6367
6823
|
type: "object",
|
|
6368
6824
|
properties: {
|
|
6369
6825
|
value: {
|
|
@@ -6405,13 +6861,13 @@ var outputSchema20 = {
|
|
|
6405
6861
|
additionalProperties: false
|
|
6406
6862
|
};
|
|
6407
6863
|
|
|
6408
|
-
class RegexTask extends
|
|
6864
|
+
class RegexTask extends Task23 {
|
|
6409
6865
|
static type = "RegexTask";
|
|
6410
6866
|
static category = "String";
|
|
6411
6867
|
static title = "Regex";
|
|
6412
6868
|
static description = "Matches a string against a regular expression pattern";
|
|
6413
6869
|
static inputSchema() {
|
|
6414
|
-
return
|
|
6870
|
+
return inputSchema21;
|
|
6415
6871
|
}
|
|
6416
6872
|
static outputSchema() {
|
|
6417
6873
|
return outputSchema20;
|
|
@@ -6443,14 +6899,14 @@ class RegexTask extends Task21 {
|
|
|
6443
6899
|
};
|
|
6444
6900
|
}
|
|
6445
6901
|
}
|
|
6446
|
-
|
|
6902
|
+
Workflow25.prototype.regex = CreateWorkflow24(RegexTask);
|
|
6447
6903
|
// src/task/TemplateTask.ts
|
|
6448
6904
|
import {
|
|
6449
|
-
CreateWorkflow as
|
|
6450
|
-
Task as
|
|
6451
|
-
Workflow as
|
|
6905
|
+
CreateWorkflow as CreateWorkflow25,
|
|
6906
|
+
Task as Task24,
|
|
6907
|
+
Workflow as Workflow26
|
|
6452
6908
|
} from "@workglow/task-graph";
|
|
6453
|
-
var
|
|
6909
|
+
var inputSchema22 = {
|
|
6454
6910
|
type: "object",
|
|
6455
6911
|
properties: {
|
|
6456
6912
|
template: {
|
|
@@ -6481,13 +6937,13 @@ var outputSchema21 = {
|
|
|
6481
6937
|
additionalProperties: false
|
|
6482
6938
|
};
|
|
6483
6939
|
|
|
6484
|
-
class TemplateTask extends
|
|
6940
|
+
class TemplateTask extends Task24 {
|
|
6485
6941
|
static type = "TemplateTask";
|
|
6486
6942
|
static category = "Utility";
|
|
6487
6943
|
static title = "Template";
|
|
6488
6944
|
static description = "Renders a template string with {{key}} placeholders and optional defaults";
|
|
6489
6945
|
static inputSchema() {
|
|
6490
|
-
return
|
|
6946
|
+
return inputSchema22;
|
|
6491
6947
|
}
|
|
6492
6948
|
static outputSchema() {
|
|
6493
6949
|
return outputSchema21;
|
|
@@ -6512,7 +6968,7 @@ class TemplateTask extends Task22 {
|
|
|
6512
6968
|
return { result };
|
|
6513
6969
|
}
|
|
6514
6970
|
}
|
|
6515
|
-
|
|
6971
|
+
Workflow26.prototype.template = CreateWorkflow25(TemplateTask);
|
|
6516
6972
|
// src/util/McpClientUtil.ts
|
|
6517
6973
|
import { Client } from "@modelcontextprotocol/sdk/client";
|
|
6518
6974
|
import { SSEClientTransport } from "@modelcontextprotocol/sdk/client/sse.js";
|
|
@@ -7034,8 +7490,8 @@ function buildAuthConfig(flat) {
|
|
|
7034
7490
|
}
|
|
7035
7491
|
|
|
7036
7492
|
// src/util/McpTaskDeps.ts
|
|
7037
|
-
import { createServiceToken, globalServiceRegistry } from "@workglow/util";
|
|
7038
|
-
var MCP_TASK_DEPS =
|
|
7493
|
+
import { createServiceToken as createServiceToken2, globalServiceRegistry } from "@workglow/util";
|
|
7494
|
+
var MCP_TASK_DEPS = createServiceToken2("@workglow/tasks/mcp");
|
|
7039
7495
|
function registerMcpTaskDeps(deps) {
|
|
7040
7496
|
globalServiceRegistry.registerInstance(MCP_TASK_DEPS, deps);
|
|
7041
7497
|
}
|
|
@@ -7262,18 +7718,15 @@ class InMemoryMcpServerRepository extends McpServerRepository {
|
|
|
7262
7718
|
}
|
|
7263
7719
|
// src/mcp-server/McpServerRegistry.ts
|
|
7264
7720
|
import {
|
|
7265
|
-
createServiceToken as
|
|
7721
|
+
createServiceToken as createServiceToken3,
|
|
7266
7722
|
globalServiceRegistry as globalServiceRegistry2,
|
|
7723
|
+
registerInputCompactor,
|
|
7267
7724
|
registerInputResolver
|
|
7268
7725
|
} from "@workglow/util";
|
|
7269
|
-
var MCP_SERVERS =
|
|
7270
|
-
var MCP_SERVER_REPOSITORY =
|
|
7271
|
-
|
|
7272
|
-
|
|
7273
|
-
}
|
|
7274
|
-
if (!globalServiceRegistry2.has(MCP_SERVER_REPOSITORY)) {
|
|
7275
|
-
globalServiceRegistry2.register(MCP_SERVER_REPOSITORY, () => new InMemoryMcpServerRepository, true);
|
|
7276
|
-
}
|
|
7726
|
+
var MCP_SERVERS = createServiceToken3("mcp-server.registry");
|
|
7727
|
+
var MCP_SERVER_REPOSITORY = createServiceToken3("mcp-server.repository");
|
|
7728
|
+
globalServiceRegistry2.registerIfAbsent(MCP_SERVERS, () => new Map, true);
|
|
7729
|
+
globalServiceRegistry2.registerIfAbsent(MCP_SERVER_REPOSITORY, () => new InMemoryMcpServerRepository, true);
|
|
7277
7730
|
function getGlobalMcpServers() {
|
|
7278
7731
|
return globalServiceRegistry2.get(MCP_SERVERS);
|
|
7279
7732
|
}
|
|
@@ -7305,6 +7758,13 @@ async function resolveServerFromRegistry(id, _format, registry) {
|
|
|
7305
7758
|
return record;
|
|
7306
7759
|
}
|
|
7307
7760
|
registerInputResolver("mcp-server", resolveServerFromRegistry);
|
|
7761
|
+
registerInputCompactor("mcp-server", (value) => {
|
|
7762
|
+
if (typeof value === "object" && value !== null && "server_id" in value) {
|
|
7763
|
+
const id = value.server_id;
|
|
7764
|
+
return typeof id === "string" ? id : undefined;
|
|
7765
|
+
}
|
|
7766
|
+
return;
|
|
7767
|
+
});
|
|
7308
7768
|
// src/mcp-server/getMcpServerConfig.ts
|
|
7309
7769
|
function getMcpServerConfig(configOrInput) {
|
|
7310
7770
|
const server = configOrInput.server;
|
|
@@ -7331,7 +7791,29 @@ function getMcpServerConfig(configOrInput) {
|
|
|
7331
7791
|
return base;
|
|
7332
7792
|
}
|
|
7333
7793
|
// src/task/mcp/McpListTask.ts
|
|
7334
|
-
import {
|
|
7794
|
+
import {
|
|
7795
|
+
CreateWorkflow as CreateWorkflow26,
|
|
7796
|
+
Entitlements as Entitlements3,
|
|
7797
|
+
mergeEntitlements,
|
|
7798
|
+
Task as Task25,
|
|
7799
|
+
Workflow as Workflow27
|
|
7800
|
+
} from "@workglow/task-graph";
|
|
7801
|
+
|
|
7802
|
+
// src/util/getMcpServerTransport.ts
|
|
7803
|
+
function getMcpServerTransport(task) {
|
|
7804
|
+
const runInputData = task.runInputData;
|
|
7805
|
+
const inputServer = runInputData?.server;
|
|
7806
|
+
if (typeof inputServer?.transport === "string") {
|
|
7807
|
+
return inputServer.transport;
|
|
7808
|
+
}
|
|
7809
|
+
const configServer = task.config?.server;
|
|
7810
|
+
if (typeof configServer?.transport === "string") {
|
|
7811
|
+
return configServer.transport;
|
|
7812
|
+
}
|
|
7813
|
+
return;
|
|
7814
|
+
}
|
|
7815
|
+
|
|
7816
|
+
// src/task/mcp/McpListTask.ts
|
|
7335
7817
|
var mcpListTypes = ["tools", "resources", "prompts"];
|
|
7336
7818
|
var iconSchema = {
|
|
7337
7819
|
type: "object",
|
|
@@ -7488,13 +7970,35 @@ var outputSchemaAll = {
|
|
|
7488
7970
|
additionalProperties: false
|
|
7489
7971
|
};
|
|
7490
7972
|
|
|
7491
|
-
class McpListTask extends
|
|
7973
|
+
class McpListTask extends Task25 {
|
|
7492
7974
|
static type = "McpListTask";
|
|
7493
7975
|
static category = "MCP";
|
|
7494
7976
|
static title = "MCP List";
|
|
7495
7977
|
static description = "Lists tools, resources, or prompts available on an MCP server";
|
|
7496
7978
|
static cacheable = false;
|
|
7497
7979
|
static hasDynamicSchemas = true;
|
|
7980
|
+
static hasDynamicEntitlements = true;
|
|
7981
|
+
static entitlements() {
|
|
7982
|
+
return {
|
|
7983
|
+
entitlements: [
|
|
7984
|
+
{ id: Entitlements3.MCP, reason: "Lists tools, resources, or prompts on MCP servers" }
|
|
7985
|
+
]
|
|
7986
|
+
};
|
|
7987
|
+
}
|
|
7988
|
+
entitlements() {
|
|
7989
|
+
const base = McpListTask.entitlements();
|
|
7990
|
+
const transport = getMcpServerTransport(this);
|
|
7991
|
+
if (transport === "stdio") {
|
|
7992
|
+
return mergeEntitlements(base, {
|
|
7993
|
+
entitlements: [
|
|
7994
|
+
{ id: Entitlements3.MCP_STDIO, reason: "Uses stdio transport to spawn local process" }
|
|
7995
|
+
]
|
|
7996
|
+
});
|
|
7997
|
+
}
|
|
7998
|
+
return mergeEntitlements(base, {
|
|
7999
|
+
entitlements: [{ id: Entitlements3.NETWORK_HTTP, reason: "Connects to MCP server over HTTP" }]
|
|
8000
|
+
});
|
|
8001
|
+
}
|
|
7498
8002
|
static inputSchema() {
|
|
7499
8003
|
const { mcpServerConfigSchema: mcpServerConfigSchema2 } = getMcpTaskDeps();
|
|
7500
8004
|
return {
|
|
@@ -7571,15 +8075,17 @@ class McpListTask extends Task23 {
|
|
|
7571
8075
|
}
|
|
7572
8076
|
}
|
|
7573
8077
|
var mcpList = async (input2, config = {}) => {
|
|
7574
|
-
return new McpListTask(
|
|
8078
|
+
return new McpListTask(config).run(input2);
|
|
7575
8079
|
};
|
|
7576
|
-
|
|
8080
|
+
Workflow27.prototype.mcpList = CreateWorkflow26(McpListTask);
|
|
7577
8081
|
// src/task/mcp/McpPromptGetTask.ts
|
|
7578
8082
|
import {
|
|
7579
|
-
CreateWorkflow as
|
|
7580
|
-
|
|
7581
|
-
|
|
7582
|
-
|
|
8083
|
+
CreateWorkflow as CreateWorkflow27,
|
|
8084
|
+
Entitlements as Entitlements4,
|
|
8085
|
+
mergeEntitlements as mergeEntitlements2,
|
|
8086
|
+
Task as Task26,
|
|
8087
|
+
TaskConfigSchema as TaskConfigSchema8,
|
|
8088
|
+
Workflow as Workflow28
|
|
7583
8089
|
} from "@workglow/task-graph";
|
|
7584
8090
|
var annotationsSchema = {
|
|
7585
8091
|
type: "object",
|
|
@@ -7714,7 +8220,7 @@ var fallbackInputSchema = {
|
|
|
7714
8220
|
additionalProperties: false
|
|
7715
8221
|
};
|
|
7716
8222
|
|
|
7717
|
-
class McpPromptGetTask extends
|
|
8223
|
+
class McpPromptGetTask extends Task26 {
|
|
7718
8224
|
static type = "McpPromptGetTask";
|
|
7719
8225
|
static category = "MCP";
|
|
7720
8226
|
static title = "MCP Get Prompt";
|
|
@@ -7722,6 +8228,29 @@ class McpPromptGetTask extends Task24 {
|
|
|
7722
8228
|
static cacheable = false;
|
|
7723
8229
|
static customizable = true;
|
|
7724
8230
|
static hasDynamicSchemas = true;
|
|
8231
|
+
static hasDynamicEntitlements = true;
|
|
8232
|
+
static entitlements() {
|
|
8233
|
+
return {
|
|
8234
|
+
entitlements: [{ id: Entitlements4.MCP_PROMPT_GET, reason: "Gets prompts from MCP servers" }]
|
|
8235
|
+
};
|
|
8236
|
+
}
|
|
8237
|
+
entitlements() {
|
|
8238
|
+
const base = McpPromptGetTask.entitlements();
|
|
8239
|
+
const transport = getMcpServerTransport(this);
|
|
8240
|
+
if (transport === "stdio") {
|
|
8241
|
+
return mergeEntitlements2(base, {
|
|
8242
|
+
entitlements: [
|
|
8243
|
+
{ id: Entitlements4.MCP_STDIO, reason: "Uses stdio transport to spawn local process" }
|
|
8244
|
+
]
|
|
8245
|
+
});
|
|
8246
|
+
}
|
|
8247
|
+
return mergeEntitlements2(base, {
|
|
8248
|
+
entitlements: [
|
|
8249
|
+
{ id: Entitlements4.NETWORK_HTTP, reason: "Connects to MCP server over HTTP" },
|
|
8250
|
+
{ id: Entitlements4.CREDENTIAL, reason: "May require authentication", optional: true }
|
|
8251
|
+
]
|
|
8252
|
+
});
|
|
8253
|
+
}
|
|
7725
8254
|
static inputSchema() {
|
|
7726
8255
|
return fallbackInputSchema;
|
|
7727
8256
|
}
|
|
@@ -7733,7 +8262,7 @@ class McpPromptGetTask extends Task24 {
|
|
|
7733
8262
|
return {
|
|
7734
8263
|
type: "object",
|
|
7735
8264
|
properties: {
|
|
7736
|
-
...
|
|
8265
|
+
...TaskConfigSchema8["properties"],
|
|
7737
8266
|
server: TypeMcpServer(mcpServerConfigSchema2),
|
|
7738
8267
|
prompt_name: {
|
|
7739
8268
|
type: "string",
|
|
@@ -7752,43 +8281,45 @@ class McpPromptGetTask extends Task24 {
|
|
|
7752
8281
|
outputSchema() {
|
|
7753
8282
|
return this.config?.outputSchema ?? fallbackOutputSchema;
|
|
7754
8283
|
}
|
|
7755
|
-
|
|
8284
|
+
_schemasDiscoveringPromise;
|
|
7756
8285
|
async discoverSchemas(_signal, serverConfig) {
|
|
7757
8286
|
if (this.config.inputSchema)
|
|
7758
8287
|
return;
|
|
7759
|
-
if (this.
|
|
7760
|
-
return;
|
|
8288
|
+
if (this._schemasDiscoveringPromise)
|
|
8289
|
+
return this._schemasDiscoveringPromise;
|
|
7761
8290
|
const resolved = serverConfig ?? getMcpServerConfig(this.config);
|
|
7762
8291
|
if (!resolved.transport || !this.config.prompt_name)
|
|
7763
8292
|
return;
|
|
7764
|
-
this.
|
|
7765
|
-
|
|
7766
|
-
|
|
7767
|
-
|
|
7768
|
-
|
|
7769
|
-
|
|
7770
|
-
|
|
7771
|
-
|
|
7772
|
-
|
|
7773
|
-
|
|
7774
|
-
|
|
7775
|
-
|
|
7776
|
-
|
|
7777
|
-
|
|
7778
|
-
|
|
8293
|
+
this._schemasDiscoveringPromise = (async () => {
|
|
8294
|
+
try {
|
|
8295
|
+
const result = await mcpList({
|
|
8296
|
+
server: resolved,
|
|
8297
|
+
list_type: "prompts"
|
|
8298
|
+
});
|
|
8299
|
+
const prompt = result.prompts?.find((p) => p.name === this.config.prompt_name);
|
|
8300
|
+
if (prompt) {
|
|
8301
|
+
const args = prompt.arguments ?? [];
|
|
8302
|
+
const required = args.filter((a) => a.required).map((a) => a.name);
|
|
8303
|
+
const properties = {};
|
|
8304
|
+
for (const arg of args) {
|
|
8305
|
+
properties[arg.name] = {
|
|
8306
|
+
type: "string",
|
|
8307
|
+
...arg.description ? { description: arg.description } : {}
|
|
8308
|
+
};
|
|
8309
|
+
}
|
|
8310
|
+
this.config.inputSchema = {
|
|
8311
|
+
type: "object",
|
|
8312
|
+
properties,
|
|
8313
|
+
...required.length > 0 ? { required } : {},
|
|
8314
|
+
additionalProperties: false
|
|
7779
8315
|
};
|
|
8316
|
+
this.emitSchemaChange();
|
|
7780
8317
|
}
|
|
7781
|
-
|
|
7782
|
-
|
|
7783
|
-
properties,
|
|
7784
|
-
...required.length > 0 ? { required } : {},
|
|
7785
|
-
additionalProperties: false
|
|
7786
|
-
};
|
|
7787
|
-
this.emitSchemaChange();
|
|
8318
|
+
} finally {
|
|
8319
|
+
this._schemasDiscoveringPromise = undefined;
|
|
7788
8320
|
}
|
|
7789
|
-
}
|
|
7790
|
-
|
|
7791
|
-
}
|
|
8321
|
+
})();
|
|
8322
|
+
return this._schemasDiscoveringPromise;
|
|
7792
8323
|
}
|
|
7793
8324
|
async execute(input2, context) {
|
|
7794
8325
|
const serverConfig = getMcpServerConfig(this.config);
|
|
@@ -7810,15 +8341,17 @@ class McpPromptGetTask extends Task24 {
|
|
|
7810
8341
|
}
|
|
7811
8342
|
}
|
|
7812
8343
|
var mcpPromptGet = async (input2, config) => {
|
|
7813
|
-
return new McpPromptGetTask(
|
|
8344
|
+
return new McpPromptGetTask(config).run(input2);
|
|
7814
8345
|
};
|
|
7815
|
-
|
|
8346
|
+
Workflow28.prototype.mcpPromptGet = CreateWorkflow27(McpPromptGetTask);
|
|
7816
8347
|
// src/task/mcp/McpResourceReadTask.ts
|
|
7817
8348
|
import {
|
|
7818
|
-
CreateWorkflow as
|
|
7819
|
-
|
|
7820
|
-
|
|
7821
|
-
|
|
8349
|
+
CreateWorkflow as CreateWorkflow28,
|
|
8350
|
+
Entitlements as Entitlements5,
|
|
8351
|
+
mergeEntitlements as mergeEntitlements3,
|
|
8352
|
+
Task as Task27,
|
|
8353
|
+
TaskConfigSchema as TaskConfigSchema9,
|
|
8354
|
+
Workflow as Workflow29
|
|
7822
8355
|
} from "@workglow/task-graph";
|
|
7823
8356
|
var contentItemSchema = {
|
|
7824
8357
|
anyOf: [
|
|
@@ -7846,7 +8379,7 @@ var contentItemSchema = {
|
|
|
7846
8379
|
}
|
|
7847
8380
|
]
|
|
7848
8381
|
};
|
|
7849
|
-
var
|
|
8382
|
+
var inputSchema23 = {
|
|
7850
8383
|
type: "object",
|
|
7851
8384
|
properties: {},
|
|
7852
8385
|
additionalProperties: false
|
|
@@ -7865,15 +8398,40 @@ var outputSchema22 = {
|
|
|
7865
8398
|
additionalProperties: false
|
|
7866
8399
|
};
|
|
7867
8400
|
|
|
7868
|
-
class McpResourceReadTask extends
|
|
8401
|
+
class McpResourceReadTask extends Task27 {
|
|
7869
8402
|
static type = "McpResourceReadTask";
|
|
7870
8403
|
static category = "MCP";
|
|
7871
8404
|
static title = "MCP Read Resource";
|
|
7872
8405
|
static description = "Reads a resource from an MCP server";
|
|
7873
8406
|
static cacheable = false;
|
|
7874
8407
|
static customizable = true;
|
|
8408
|
+
static hasDynamicEntitlements = true;
|
|
8409
|
+
static entitlements() {
|
|
8410
|
+
return {
|
|
8411
|
+
entitlements: [
|
|
8412
|
+
{ id: Entitlements5.MCP_RESOURCE_READ, reason: "Reads resources from MCP servers" }
|
|
8413
|
+
]
|
|
8414
|
+
};
|
|
8415
|
+
}
|
|
8416
|
+
entitlements() {
|
|
8417
|
+
const base = McpResourceReadTask.entitlements();
|
|
8418
|
+
const transport = getMcpServerTransport(this);
|
|
8419
|
+
if (transport === "stdio") {
|
|
8420
|
+
return mergeEntitlements3(base, {
|
|
8421
|
+
entitlements: [
|
|
8422
|
+
{ id: Entitlements5.MCP_STDIO, reason: "Uses stdio transport to spawn local process" }
|
|
8423
|
+
]
|
|
8424
|
+
});
|
|
8425
|
+
}
|
|
8426
|
+
return mergeEntitlements3(base, {
|
|
8427
|
+
entitlements: [
|
|
8428
|
+
{ id: Entitlements5.NETWORK_HTTP, reason: "Connects to MCP server over HTTP" },
|
|
8429
|
+
{ id: Entitlements5.CREDENTIAL, reason: "May require authentication", optional: true }
|
|
8430
|
+
]
|
|
8431
|
+
});
|
|
8432
|
+
}
|
|
7875
8433
|
static inputSchema() {
|
|
7876
|
-
return
|
|
8434
|
+
return inputSchema23;
|
|
7877
8435
|
}
|
|
7878
8436
|
static outputSchema() {
|
|
7879
8437
|
return outputSchema22;
|
|
@@ -7883,7 +8441,7 @@ class McpResourceReadTask extends Task25 {
|
|
|
7883
8441
|
return {
|
|
7884
8442
|
type: "object",
|
|
7885
8443
|
properties: {
|
|
7886
|
-
...
|
|
8444
|
+
...TaskConfigSchema9["properties"],
|
|
7887
8445
|
server: TypeMcpServer(mcpServerConfigSchema2),
|
|
7888
8446
|
resource_uri: {
|
|
7889
8447
|
type: "string",
|
|
@@ -7911,11 +8469,16 @@ class McpResourceReadTask extends Task25 {
|
|
|
7911
8469
|
}
|
|
7912
8470
|
}
|
|
7913
8471
|
var mcpResourceRead = async (config) => {
|
|
7914
|
-
return new McpResourceReadTask(
|
|
8472
|
+
return new McpResourceReadTask(config).run({});
|
|
7915
8473
|
};
|
|
7916
|
-
|
|
8474
|
+
Workflow29.prototype.mcpResourceRead = CreateWorkflow28(McpResourceReadTask);
|
|
7917
8475
|
// src/task/mcp/McpSearchTask.ts
|
|
7918
|
-
import {
|
|
8476
|
+
import {
|
|
8477
|
+
CreateWorkflow as CreateWorkflow29,
|
|
8478
|
+
Entitlements as Entitlements6,
|
|
8479
|
+
Task as Task28,
|
|
8480
|
+
Workflow as Workflow30
|
|
8481
|
+
} from "@workglow/task-graph";
|
|
7919
8482
|
var MCP_REGISTRY_BASE = "https://registry.modelcontextprotocol.io/v0.1";
|
|
7920
8483
|
var McpSearchInputSchema = {
|
|
7921
8484
|
type: "object",
|
|
@@ -8054,12 +8617,19 @@ async function searchMcpRegistry(query, signal) {
|
|
|
8054
8617
|
return page.results;
|
|
8055
8618
|
}
|
|
8056
8619
|
|
|
8057
|
-
class McpSearchTask extends
|
|
8620
|
+
class McpSearchTask extends Task28 {
|
|
8058
8621
|
static type = "McpSearchTask";
|
|
8059
8622
|
static category = "MCP";
|
|
8060
8623
|
static title = "MCP Search";
|
|
8061
8624
|
static description = "Search the MCP server registry for servers matching a query";
|
|
8062
8625
|
static cacheable = false;
|
|
8626
|
+
static entitlements() {
|
|
8627
|
+
return {
|
|
8628
|
+
entitlements: [
|
|
8629
|
+
{ id: Entitlements6.NETWORK_HTTP, reason: "Searches the MCP server registry via HTTPS" }
|
|
8630
|
+
]
|
|
8631
|
+
};
|
|
8632
|
+
}
|
|
8063
8633
|
static inputSchema() {
|
|
8064
8634
|
return McpSearchInputSchema;
|
|
8065
8635
|
}
|
|
@@ -8072,15 +8642,17 @@ class McpSearchTask extends Task26 {
|
|
|
8072
8642
|
}
|
|
8073
8643
|
}
|
|
8074
8644
|
var mcpSearch = (input2, config) => {
|
|
8075
|
-
return new McpSearchTask(
|
|
8645
|
+
return new McpSearchTask(config).run(input2);
|
|
8076
8646
|
};
|
|
8077
|
-
|
|
8647
|
+
Workflow30.prototype.mcpSearch = CreateWorkflow29(McpSearchTask);
|
|
8078
8648
|
// src/task/mcp/McpToolCallTask.ts
|
|
8079
8649
|
import {
|
|
8080
|
-
CreateWorkflow as
|
|
8081
|
-
|
|
8082
|
-
|
|
8083
|
-
|
|
8650
|
+
CreateWorkflow as CreateWorkflow30,
|
|
8651
|
+
Entitlements as Entitlements7,
|
|
8652
|
+
mergeEntitlements as mergeEntitlements4,
|
|
8653
|
+
Task as Task29,
|
|
8654
|
+
TaskConfigSchema as TaskConfigSchema10,
|
|
8655
|
+
Workflow as Workflow31
|
|
8084
8656
|
} from "@workglow/task-graph";
|
|
8085
8657
|
var annotationsSchema2 = {
|
|
8086
8658
|
type: "object",
|
|
@@ -8207,7 +8779,7 @@ var fallbackInputSchema2 = {
|
|
|
8207
8779
|
additionalProperties: true
|
|
8208
8780
|
};
|
|
8209
8781
|
|
|
8210
|
-
class McpToolCallTask extends
|
|
8782
|
+
class McpToolCallTask extends Task29 {
|
|
8211
8783
|
static type = "McpToolCallTask";
|
|
8212
8784
|
static category = "MCP";
|
|
8213
8785
|
static title = "MCP Call Tool";
|
|
@@ -8215,6 +8787,29 @@ class McpToolCallTask extends Task27 {
|
|
|
8215
8787
|
static cacheable = false;
|
|
8216
8788
|
static customizable = true;
|
|
8217
8789
|
static hasDynamicSchemas = true;
|
|
8790
|
+
static hasDynamicEntitlements = true;
|
|
8791
|
+
static entitlements() {
|
|
8792
|
+
return {
|
|
8793
|
+
entitlements: [{ id: Entitlements7.MCP_TOOL_CALL, reason: "Calls tools on MCP servers" }]
|
|
8794
|
+
};
|
|
8795
|
+
}
|
|
8796
|
+
entitlements() {
|
|
8797
|
+
const base = McpToolCallTask.entitlements();
|
|
8798
|
+
const transport = getMcpServerTransport(this);
|
|
8799
|
+
if (transport === "stdio") {
|
|
8800
|
+
return mergeEntitlements4(base, {
|
|
8801
|
+
entitlements: [
|
|
8802
|
+
{ id: Entitlements7.MCP_STDIO, reason: "Uses stdio transport to spawn local process" }
|
|
8803
|
+
]
|
|
8804
|
+
});
|
|
8805
|
+
}
|
|
8806
|
+
return mergeEntitlements4(base, {
|
|
8807
|
+
entitlements: [
|
|
8808
|
+
{ id: Entitlements7.NETWORK_HTTP, reason: "Connects to MCP server over HTTP" },
|
|
8809
|
+
{ id: Entitlements7.CREDENTIAL, reason: "May require authentication", optional: true }
|
|
8810
|
+
]
|
|
8811
|
+
});
|
|
8812
|
+
}
|
|
8218
8813
|
static inputSchema() {
|
|
8219
8814
|
return fallbackInputSchema2;
|
|
8220
8815
|
}
|
|
@@ -8226,7 +8821,7 @@ class McpToolCallTask extends Task27 {
|
|
|
8226
8821
|
return {
|
|
8227
8822
|
type: "object",
|
|
8228
8823
|
properties: {
|
|
8229
|
-
...
|
|
8824
|
+
...TaskConfigSchema10["properties"],
|
|
8230
8825
|
server: TypeMcpServer(mcpServerConfigSchema2),
|
|
8231
8826
|
tool_name: {
|
|
8232
8827
|
type: "string",
|
|
@@ -8245,34 +8840,36 @@ class McpToolCallTask extends Task27 {
|
|
|
8245
8840
|
outputSchema() {
|
|
8246
8841
|
return this.config?.outputSchema ?? fallbackOutputSchema2;
|
|
8247
8842
|
}
|
|
8248
|
-
|
|
8843
|
+
_schemasDiscoveringPromise;
|
|
8249
8844
|
async discoverSchemas(_signal, serverConfig) {
|
|
8250
8845
|
if (this.config.inputSchema && this.config.outputSchema)
|
|
8251
8846
|
return;
|
|
8252
|
-
if (this.
|
|
8253
|
-
return;
|
|
8847
|
+
if (this._schemasDiscoveringPromise)
|
|
8848
|
+
return this._schemasDiscoveringPromise;
|
|
8254
8849
|
const resolved = serverConfig ?? getMcpServerConfig(this.config);
|
|
8255
8850
|
if (!resolved.transport || !this.config.tool_name)
|
|
8256
8851
|
return;
|
|
8257
|
-
this.
|
|
8258
|
-
|
|
8259
|
-
|
|
8260
|
-
|
|
8261
|
-
|
|
8262
|
-
|
|
8263
|
-
|
|
8264
|
-
|
|
8265
|
-
|
|
8266
|
-
|
|
8267
|
-
|
|
8268
|
-
|
|
8269
|
-
|
|
8852
|
+
this._schemasDiscoveringPromise = (async () => {
|
|
8853
|
+
try {
|
|
8854
|
+
const result = await mcpList({
|
|
8855
|
+
server: resolved,
|
|
8856
|
+
list_type: "tools"
|
|
8857
|
+
});
|
|
8858
|
+
const tool = result.tools?.find((t) => t.name === this.config.tool_name);
|
|
8859
|
+
if (tool) {
|
|
8860
|
+
if (!this.config.inputSchema) {
|
|
8861
|
+
this.config.inputSchema = tool.inputSchema;
|
|
8862
|
+
}
|
|
8863
|
+
if (!this.config.outputSchema && tool.outputSchema) {
|
|
8864
|
+
this.config.outputSchema = tool.outputSchema;
|
|
8865
|
+
}
|
|
8866
|
+
this.emitSchemaChange();
|
|
8270
8867
|
}
|
|
8271
|
-
|
|
8868
|
+
} finally {
|
|
8869
|
+
this._schemasDiscoveringPromise = undefined;
|
|
8272
8870
|
}
|
|
8273
|
-
}
|
|
8274
|
-
|
|
8275
|
-
}
|
|
8871
|
+
})();
|
|
8872
|
+
return this._schemasDiscoveringPromise;
|
|
8276
8873
|
}
|
|
8277
8874
|
async execute(input2, context) {
|
|
8278
8875
|
const serverConfig = getMcpServerConfig(this.config);
|
|
@@ -8318,16 +8915,16 @@ class McpToolCallTask extends Task27 {
|
|
|
8318
8915
|
}
|
|
8319
8916
|
}
|
|
8320
8917
|
var mcpToolCall = async (input2, config) => {
|
|
8321
|
-
return new McpToolCallTask(
|
|
8918
|
+
return new McpToolCallTask(config).run(input2);
|
|
8322
8919
|
};
|
|
8323
|
-
|
|
8920
|
+
Workflow31.prototype.mcpToolCall = CreateWorkflow30(McpToolCallTask);
|
|
8324
8921
|
// src/task/string/StringConcatTask.ts
|
|
8325
8922
|
import {
|
|
8326
|
-
CreateWorkflow as
|
|
8327
|
-
Task as
|
|
8328
|
-
Workflow as
|
|
8923
|
+
CreateWorkflow as CreateWorkflow31,
|
|
8924
|
+
Task as Task30,
|
|
8925
|
+
Workflow as Workflow32
|
|
8329
8926
|
} from "@workglow/task-graph";
|
|
8330
|
-
var
|
|
8927
|
+
var inputSchema24 = {
|
|
8331
8928
|
type: "object",
|
|
8332
8929
|
properties: {},
|
|
8333
8930
|
additionalProperties: { type: "string" }
|
|
@@ -8345,13 +8942,13 @@ var outputSchema23 = {
|
|
|
8345
8942
|
additionalProperties: false
|
|
8346
8943
|
};
|
|
8347
8944
|
|
|
8348
|
-
class StringConcatTask extends
|
|
8945
|
+
class StringConcatTask extends Task30 {
|
|
8349
8946
|
static type = "StringConcatTask";
|
|
8350
8947
|
static category = "String";
|
|
8351
8948
|
static title = "Concat";
|
|
8352
8949
|
static description = "Concatenates all input strings";
|
|
8353
8950
|
static inputSchema() {
|
|
8354
|
-
return
|
|
8951
|
+
return inputSchema24;
|
|
8355
8952
|
}
|
|
8356
8953
|
static outputSchema() {
|
|
8357
8954
|
return outputSchema23;
|
|
@@ -8360,14 +8957,14 @@ class StringConcatTask extends Task28 {
|
|
|
8360
8957
|
return { result: Object.values(input2).join("") };
|
|
8361
8958
|
}
|
|
8362
8959
|
}
|
|
8363
|
-
|
|
8960
|
+
Workflow32.prototype.stringConcat = CreateWorkflow31(StringConcatTask);
|
|
8364
8961
|
// src/task/string/StringIncludesTask.ts
|
|
8365
8962
|
import {
|
|
8366
|
-
CreateWorkflow as
|
|
8367
|
-
Task as
|
|
8368
|
-
Workflow as
|
|
8963
|
+
CreateWorkflow as CreateWorkflow32,
|
|
8964
|
+
Task as Task31,
|
|
8965
|
+
Workflow as Workflow33
|
|
8369
8966
|
} from "@workglow/task-graph";
|
|
8370
|
-
var
|
|
8967
|
+
var inputSchema25 = {
|
|
8371
8968
|
type: "object",
|
|
8372
8969
|
properties: {
|
|
8373
8970
|
value: {
|
|
@@ -8397,13 +8994,13 @@ var outputSchema24 = {
|
|
|
8397
8994
|
additionalProperties: false
|
|
8398
8995
|
};
|
|
8399
8996
|
|
|
8400
|
-
class StringIncludesTask extends
|
|
8997
|
+
class StringIncludesTask extends Task31 {
|
|
8401
8998
|
static type = "StringIncludesTask";
|
|
8402
8999
|
static category = "String";
|
|
8403
9000
|
static title = "Includes";
|
|
8404
9001
|
static description = "Checks if a string contains a substring";
|
|
8405
9002
|
static inputSchema() {
|
|
8406
|
-
return
|
|
9003
|
+
return inputSchema25;
|
|
8407
9004
|
}
|
|
8408
9005
|
static outputSchema() {
|
|
8409
9006
|
return outputSchema24;
|
|
@@ -8412,14 +9009,14 @@ class StringIncludesTask extends Task29 {
|
|
|
8412
9009
|
return { result: input2.value.includes(input2.search) };
|
|
8413
9010
|
}
|
|
8414
9011
|
}
|
|
8415
|
-
|
|
9012
|
+
Workflow33.prototype.stringIncludes = CreateWorkflow32(StringIncludesTask);
|
|
8416
9013
|
// src/task/string/StringJoinTask.ts
|
|
8417
9014
|
import {
|
|
8418
|
-
CreateWorkflow as
|
|
8419
|
-
Task as
|
|
8420
|
-
Workflow as
|
|
9015
|
+
CreateWorkflow as CreateWorkflow33,
|
|
9016
|
+
Task as Task32,
|
|
9017
|
+
Workflow as Workflow34
|
|
8421
9018
|
} from "@workglow/task-graph";
|
|
8422
|
-
var
|
|
9019
|
+
var inputSchema26 = {
|
|
8423
9020
|
type: "object",
|
|
8424
9021
|
properties: {
|
|
8425
9022
|
values: {
|
|
@@ -8451,13 +9048,13 @@ var outputSchema25 = {
|
|
|
8451
9048
|
additionalProperties: false
|
|
8452
9049
|
};
|
|
8453
9050
|
|
|
8454
|
-
class StringJoinTask extends
|
|
9051
|
+
class StringJoinTask extends Task32 {
|
|
8455
9052
|
static type = "StringJoinTask";
|
|
8456
9053
|
static category = "String";
|
|
8457
9054
|
static title = "Join";
|
|
8458
9055
|
static description = "Joins an array of strings with a separator";
|
|
8459
9056
|
static inputSchema() {
|
|
8460
|
-
return
|
|
9057
|
+
return inputSchema26;
|
|
8461
9058
|
}
|
|
8462
9059
|
static outputSchema() {
|
|
8463
9060
|
return outputSchema25;
|
|
@@ -8467,14 +9064,14 @@ class StringJoinTask extends Task30 {
|
|
|
8467
9064
|
return { result: input2.values.join(separator) };
|
|
8468
9065
|
}
|
|
8469
9066
|
}
|
|
8470
|
-
|
|
9067
|
+
Workflow34.prototype.stringJoin = CreateWorkflow33(StringJoinTask);
|
|
8471
9068
|
// src/task/string/StringLengthTask.ts
|
|
8472
9069
|
import {
|
|
8473
|
-
CreateWorkflow as
|
|
8474
|
-
Task as
|
|
8475
|
-
Workflow as
|
|
9070
|
+
CreateWorkflow as CreateWorkflow34,
|
|
9071
|
+
Task as Task33,
|
|
9072
|
+
Workflow as Workflow35
|
|
8476
9073
|
} from "@workglow/task-graph";
|
|
8477
|
-
var
|
|
9074
|
+
var inputSchema27 = {
|
|
8478
9075
|
type: "object",
|
|
8479
9076
|
properties: {
|
|
8480
9077
|
value: {
|
|
@@ -8499,13 +9096,13 @@ var outputSchema26 = {
|
|
|
8499
9096
|
additionalProperties: false
|
|
8500
9097
|
};
|
|
8501
9098
|
|
|
8502
|
-
class StringLengthTask extends
|
|
9099
|
+
class StringLengthTask extends Task33 {
|
|
8503
9100
|
static type = "StringLengthTask";
|
|
8504
9101
|
static category = "String";
|
|
8505
9102
|
static title = "Length";
|
|
8506
9103
|
static description = "Returns the length of a string";
|
|
8507
9104
|
static inputSchema() {
|
|
8508
|
-
return
|
|
9105
|
+
return inputSchema27;
|
|
8509
9106
|
}
|
|
8510
9107
|
static outputSchema() {
|
|
8511
9108
|
return outputSchema26;
|
|
@@ -8514,14 +9111,14 @@ class StringLengthTask extends Task31 {
|
|
|
8514
9111
|
return { result: input2.value.length };
|
|
8515
9112
|
}
|
|
8516
9113
|
}
|
|
8517
|
-
|
|
9114
|
+
Workflow35.prototype.stringLength = CreateWorkflow34(StringLengthTask);
|
|
8518
9115
|
// src/task/string/StringLowerCaseTask.ts
|
|
8519
9116
|
import {
|
|
8520
|
-
CreateWorkflow as
|
|
8521
|
-
Task as
|
|
8522
|
-
Workflow as
|
|
9117
|
+
CreateWorkflow as CreateWorkflow35,
|
|
9118
|
+
Task as Task34,
|
|
9119
|
+
Workflow as Workflow36
|
|
8523
9120
|
} from "@workglow/task-graph";
|
|
8524
|
-
var
|
|
9121
|
+
var inputSchema28 = {
|
|
8525
9122
|
type: "object",
|
|
8526
9123
|
properties: {
|
|
8527
9124
|
value: {
|
|
@@ -8546,13 +9143,13 @@ var outputSchema27 = {
|
|
|
8546
9143
|
additionalProperties: false
|
|
8547
9144
|
};
|
|
8548
9145
|
|
|
8549
|
-
class StringLowerCaseTask extends
|
|
9146
|
+
class StringLowerCaseTask extends Task34 {
|
|
8550
9147
|
static type = "StringLowerCaseTask";
|
|
8551
9148
|
static category = "String";
|
|
8552
9149
|
static title = "Lower Case";
|
|
8553
9150
|
static description = "Converts a string to lower case";
|
|
8554
9151
|
static inputSchema() {
|
|
8555
|
-
return
|
|
9152
|
+
return inputSchema28;
|
|
8556
9153
|
}
|
|
8557
9154
|
static outputSchema() {
|
|
8558
9155
|
return outputSchema27;
|
|
@@ -8561,14 +9158,14 @@ class StringLowerCaseTask extends Task32 {
|
|
|
8561
9158
|
return { result: input2.value.toLowerCase() };
|
|
8562
9159
|
}
|
|
8563
9160
|
}
|
|
8564
|
-
|
|
9161
|
+
Workflow36.prototype.stringLowerCase = CreateWorkflow35(StringLowerCaseTask);
|
|
8565
9162
|
// src/task/string/StringReplaceTask.ts
|
|
8566
9163
|
import {
|
|
8567
|
-
CreateWorkflow as
|
|
8568
|
-
Task as
|
|
8569
|
-
Workflow as
|
|
9164
|
+
CreateWorkflow as CreateWorkflow36,
|
|
9165
|
+
Task as Task35,
|
|
9166
|
+
Workflow as Workflow37
|
|
8570
9167
|
} from "@workglow/task-graph";
|
|
8571
|
-
var
|
|
9168
|
+
var inputSchema29 = {
|
|
8572
9169
|
type: "object",
|
|
8573
9170
|
properties: {
|
|
8574
9171
|
value: {
|
|
@@ -8603,13 +9200,13 @@ var outputSchema28 = {
|
|
|
8603
9200
|
additionalProperties: false
|
|
8604
9201
|
};
|
|
8605
9202
|
|
|
8606
|
-
class StringReplaceTask extends
|
|
9203
|
+
class StringReplaceTask extends Task35 {
|
|
8607
9204
|
static type = "StringReplaceTask";
|
|
8608
9205
|
static category = "String";
|
|
8609
9206
|
static title = "Replace";
|
|
8610
9207
|
static description = "Replaces all occurrences of a substring";
|
|
8611
9208
|
static inputSchema() {
|
|
8612
|
-
return
|
|
9209
|
+
return inputSchema29;
|
|
8613
9210
|
}
|
|
8614
9211
|
static outputSchema() {
|
|
8615
9212
|
return outputSchema28;
|
|
@@ -8618,14 +9215,14 @@ class StringReplaceTask extends Task33 {
|
|
|
8618
9215
|
return { result: input2.value.replaceAll(input2.search, input2.replace) };
|
|
8619
9216
|
}
|
|
8620
9217
|
}
|
|
8621
|
-
|
|
9218
|
+
Workflow37.prototype.stringReplace = CreateWorkflow36(StringReplaceTask);
|
|
8622
9219
|
// src/task/string/StringSliceTask.ts
|
|
8623
9220
|
import {
|
|
8624
|
-
CreateWorkflow as
|
|
8625
|
-
Task as
|
|
8626
|
-
Workflow as
|
|
9221
|
+
CreateWorkflow as CreateWorkflow37,
|
|
9222
|
+
Task as Task36,
|
|
9223
|
+
Workflow as Workflow38
|
|
8627
9224
|
} from "@workglow/task-graph";
|
|
8628
|
-
var
|
|
9225
|
+
var inputSchema30 = {
|
|
8629
9226
|
type: "object",
|
|
8630
9227
|
properties: {
|
|
8631
9228
|
value: {
|
|
@@ -8660,13 +9257,13 @@ var outputSchema29 = {
|
|
|
8660
9257
|
additionalProperties: false
|
|
8661
9258
|
};
|
|
8662
9259
|
|
|
8663
|
-
class StringSliceTask extends
|
|
9260
|
+
class StringSliceTask extends Task36 {
|
|
8664
9261
|
static type = "StringSliceTask";
|
|
8665
9262
|
static category = "String";
|
|
8666
9263
|
static title = "Slice";
|
|
8667
9264
|
static description = "Extracts a substring by start and optional end index";
|
|
8668
9265
|
static inputSchema() {
|
|
8669
|
-
return
|
|
9266
|
+
return inputSchema30;
|
|
8670
9267
|
}
|
|
8671
9268
|
static outputSchema() {
|
|
8672
9269
|
return outputSchema29;
|
|
@@ -8675,14 +9272,14 @@ class StringSliceTask extends Task34 {
|
|
|
8675
9272
|
return { result: input2.value.slice(input2.start, input2.end) };
|
|
8676
9273
|
}
|
|
8677
9274
|
}
|
|
8678
|
-
|
|
9275
|
+
Workflow38.prototype.stringSlice = CreateWorkflow37(StringSliceTask);
|
|
8679
9276
|
// src/task/string/StringTemplateTask.ts
|
|
8680
9277
|
import {
|
|
8681
|
-
CreateWorkflow as
|
|
8682
|
-
Task as
|
|
8683
|
-
Workflow as
|
|
9278
|
+
CreateWorkflow as CreateWorkflow38,
|
|
9279
|
+
Task as Task37,
|
|
9280
|
+
Workflow as Workflow39
|
|
8684
9281
|
} from "@workglow/task-graph";
|
|
8685
|
-
var
|
|
9282
|
+
var inputSchema31 = {
|
|
8686
9283
|
type: "object",
|
|
8687
9284
|
properties: {
|
|
8688
9285
|
template: {
|
|
@@ -8713,13 +9310,13 @@ var outputSchema30 = {
|
|
|
8713
9310
|
additionalProperties: false
|
|
8714
9311
|
};
|
|
8715
9312
|
|
|
8716
|
-
class StringTemplateTask extends
|
|
9313
|
+
class StringTemplateTask extends Task37 {
|
|
8717
9314
|
static type = "StringTemplateTask";
|
|
8718
9315
|
static category = "String";
|
|
8719
9316
|
static title = "Template";
|
|
8720
9317
|
static description = "Replaces {{key}} placeholders in a template string with values";
|
|
8721
9318
|
static inputSchema() {
|
|
8722
|
-
return
|
|
9319
|
+
return inputSchema31;
|
|
8723
9320
|
}
|
|
8724
9321
|
static outputSchema() {
|
|
8725
9322
|
return outputSchema30;
|
|
@@ -8732,14 +9329,14 @@ class StringTemplateTask extends Task35 {
|
|
|
8732
9329
|
return { result };
|
|
8733
9330
|
}
|
|
8734
9331
|
}
|
|
8735
|
-
|
|
9332
|
+
Workflow39.prototype.stringTemplate = CreateWorkflow38(StringTemplateTask);
|
|
8736
9333
|
// src/task/string/StringTrimTask.ts
|
|
8737
9334
|
import {
|
|
8738
|
-
CreateWorkflow as
|
|
8739
|
-
Task as
|
|
8740
|
-
Workflow as
|
|
9335
|
+
CreateWorkflow as CreateWorkflow39,
|
|
9336
|
+
Task as Task38,
|
|
9337
|
+
Workflow as Workflow40
|
|
8741
9338
|
} from "@workglow/task-graph";
|
|
8742
|
-
var
|
|
9339
|
+
var inputSchema32 = {
|
|
8743
9340
|
type: "object",
|
|
8744
9341
|
properties: {
|
|
8745
9342
|
value: {
|
|
@@ -8764,13 +9361,13 @@ var outputSchema31 = {
|
|
|
8764
9361
|
additionalProperties: false
|
|
8765
9362
|
};
|
|
8766
9363
|
|
|
8767
|
-
class StringTrimTask extends
|
|
9364
|
+
class StringTrimTask extends Task38 {
|
|
8768
9365
|
static type = "StringTrimTask";
|
|
8769
9366
|
static category = "String";
|
|
8770
9367
|
static title = "Trim";
|
|
8771
9368
|
static description = "Removes leading and trailing whitespace from a string";
|
|
8772
9369
|
static inputSchema() {
|
|
8773
|
-
return
|
|
9370
|
+
return inputSchema32;
|
|
8774
9371
|
}
|
|
8775
9372
|
static outputSchema() {
|
|
8776
9373
|
return outputSchema31;
|
|
@@ -8779,14 +9376,14 @@ class StringTrimTask extends Task36 {
|
|
|
8779
9376
|
return { result: input2.value.trim() };
|
|
8780
9377
|
}
|
|
8781
9378
|
}
|
|
8782
|
-
|
|
9379
|
+
Workflow40.prototype.stringTrim = CreateWorkflow39(StringTrimTask);
|
|
8783
9380
|
// src/task/string/StringUpperCaseTask.ts
|
|
8784
9381
|
import {
|
|
8785
|
-
CreateWorkflow as
|
|
8786
|
-
Task as
|
|
8787
|
-
Workflow as
|
|
9382
|
+
CreateWorkflow as CreateWorkflow40,
|
|
9383
|
+
Task as Task39,
|
|
9384
|
+
Workflow as Workflow41
|
|
8788
9385
|
} from "@workglow/task-graph";
|
|
8789
|
-
var
|
|
9386
|
+
var inputSchema33 = {
|
|
8790
9387
|
type: "object",
|
|
8791
9388
|
properties: {
|
|
8792
9389
|
value: {
|
|
@@ -8811,13 +9408,13 @@ var outputSchema32 = {
|
|
|
8811
9408
|
additionalProperties: false
|
|
8812
9409
|
};
|
|
8813
9410
|
|
|
8814
|
-
class StringUpperCaseTask extends
|
|
9411
|
+
class StringUpperCaseTask extends Task39 {
|
|
8815
9412
|
static type = "StringUpperCaseTask";
|
|
8816
9413
|
static category = "String";
|
|
8817
9414
|
static title = "Upper Case";
|
|
8818
9415
|
static description = "Converts a string to upper case";
|
|
8819
9416
|
static inputSchema() {
|
|
8820
|
-
return
|
|
9417
|
+
return inputSchema33;
|
|
8821
9418
|
}
|
|
8822
9419
|
static outputSchema() {
|
|
8823
9420
|
return outputSchema32;
|
|
@@ -8826,10 +9423,10 @@ class StringUpperCaseTask extends Task37 {
|
|
|
8826
9423
|
return { result: input2.value.toUpperCase() };
|
|
8827
9424
|
}
|
|
8828
9425
|
}
|
|
8829
|
-
|
|
9426
|
+
Workflow41.prototype.stringUpperCase = CreateWorkflow40(StringUpperCaseTask);
|
|
8830
9427
|
// src/task/scalar/ScalarAbsTask.ts
|
|
8831
|
-
import { CreateWorkflow as
|
|
8832
|
-
var
|
|
9428
|
+
import { CreateWorkflow as CreateWorkflow41, Task as Task40, Workflow as Workflow42 } from "@workglow/task-graph";
|
|
9429
|
+
var inputSchema34 = {
|
|
8833
9430
|
type: "object",
|
|
8834
9431
|
properties: {
|
|
8835
9432
|
value: {
|
|
@@ -8854,13 +9451,13 @@ var outputSchema33 = {
|
|
|
8854
9451
|
additionalProperties: false
|
|
8855
9452
|
};
|
|
8856
9453
|
|
|
8857
|
-
class ScalarAbsTask extends
|
|
9454
|
+
class ScalarAbsTask extends Task40 {
|
|
8858
9455
|
static type = "ScalarAbsTask";
|
|
8859
9456
|
static category = "Math";
|
|
8860
9457
|
static title = "Abs";
|
|
8861
9458
|
static description = "Returns the absolute value of a number";
|
|
8862
9459
|
static inputSchema() {
|
|
8863
|
-
return
|
|
9460
|
+
return inputSchema34;
|
|
8864
9461
|
}
|
|
8865
9462
|
static outputSchema() {
|
|
8866
9463
|
return outputSchema33;
|
|
@@ -8869,10 +9466,10 @@ class ScalarAbsTask extends Task38 {
|
|
|
8869
9466
|
return { result: Math.abs(input2.value) };
|
|
8870
9467
|
}
|
|
8871
9468
|
}
|
|
8872
|
-
|
|
9469
|
+
Workflow42.prototype.scalarAbs = CreateWorkflow41(ScalarAbsTask);
|
|
8873
9470
|
// src/task/scalar/ScalarCeilTask.ts
|
|
8874
|
-
import { CreateWorkflow as
|
|
8875
|
-
var
|
|
9471
|
+
import { CreateWorkflow as CreateWorkflow42, Task as Task41, Workflow as Workflow43 } from "@workglow/task-graph";
|
|
9472
|
+
var inputSchema35 = {
|
|
8876
9473
|
type: "object",
|
|
8877
9474
|
properties: {
|
|
8878
9475
|
value: {
|
|
@@ -8897,13 +9494,13 @@ var outputSchema34 = {
|
|
|
8897
9494
|
additionalProperties: false
|
|
8898
9495
|
};
|
|
8899
9496
|
|
|
8900
|
-
class ScalarCeilTask extends
|
|
9497
|
+
class ScalarCeilTask extends Task41 {
|
|
8901
9498
|
static type = "ScalarCeilTask";
|
|
8902
9499
|
static category = "Math";
|
|
8903
9500
|
static title = "Ceil";
|
|
8904
9501
|
static description = "Returns the smallest integer greater than or equal to a number";
|
|
8905
9502
|
static inputSchema() {
|
|
8906
|
-
return
|
|
9503
|
+
return inputSchema35;
|
|
8907
9504
|
}
|
|
8908
9505
|
static outputSchema() {
|
|
8909
9506
|
return outputSchema34;
|
|
@@ -8912,10 +9509,10 @@ class ScalarCeilTask extends Task39 {
|
|
|
8912
9509
|
return { result: Math.ceil(input2.value) };
|
|
8913
9510
|
}
|
|
8914
9511
|
}
|
|
8915
|
-
|
|
9512
|
+
Workflow43.prototype.scalarCeil = CreateWorkflow42(ScalarCeilTask);
|
|
8916
9513
|
// src/task/scalar/ScalarFloorTask.ts
|
|
8917
|
-
import { CreateWorkflow as
|
|
8918
|
-
var
|
|
9514
|
+
import { CreateWorkflow as CreateWorkflow43, Task as Task42, Workflow as Workflow44 } from "@workglow/task-graph";
|
|
9515
|
+
var inputSchema36 = {
|
|
8919
9516
|
type: "object",
|
|
8920
9517
|
properties: {
|
|
8921
9518
|
value: {
|
|
@@ -8940,13 +9537,13 @@ var outputSchema35 = {
|
|
|
8940
9537
|
additionalProperties: false
|
|
8941
9538
|
};
|
|
8942
9539
|
|
|
8943
|
-
class ScalarFloorTask extends
|
|
9540
|
+
class ScalarFloorTask extends Task42 {
|
|
8944
9541
|
static type = "ScalarFloorTask";
|
|
8945
9542
|
static category = "Math";
|
|
8946
9543
|
static title = "Floor";
|
|
8947
9544
|
static description = "Returns the largest integer less than or equal to a number";
|
|
8948
9545
|
static inputSchema() {
|
|
8949
|
-
return
|
|
9546
|
+
return inputSchema36;
|
|
8950
9547
|
}
|
|
8951
9548
|
static outputSchema() {
|
|
8952
9549
|
return outputSchema35;
|
|
@@ -8955,10 +9552,10 @@ class ScalarFloorTask extends Task40 {
|
|
|
8955
9552
|
return { result: Math.floor(input2.value) };
|
|
8956
9553
|
}
|
|
8957
9554
|
}
|
|
8958
|
-
|
|
9555
|
+
Workflow44.prototype.scalarFloor = CreateWorkflow43(ScalarFloorTask);
|
|
8959
9556
|
// src/task/scalar/ScalarMaxTask.ts
|
|
8960
|
-
import { CreateWorkflow as
|
|
8961
|
-
var
|
|
9557
|
+
import { CreateWorkflow as CreateWorkflow44, Task as Task43, Workflow as Workflow45 } from "@workglow/task-graph";
|
|
9558
|
+
var inputSchema37 = {
|
|
8962
9559
|
type: "object",
|
|
8963
9560
|
properties: {
|
|
8964
9561
|
values: {
|
|
@@ -8984,13 +9581,13 @@ var outputSchema36 = {
|
|
|
8984
9581
|
additionalProperties: false
|
|
8985
9582
|
};
|
|
8986
9583
|
|
|
8987
|
-
class ScalarMaxTask extends
|
|
9584
|
+
class ScalarMaxTask extends Task43 {
|
|
8988
9585
|
static type = "ScalarMaxTask";
|
|
8989
9586
|
static category = "Math";
|
|
8990
9587
|
static title = "Max";
|
|
8991
9588
|
static description = "Returns the largest of the given numbers";
|
|
8992
9589
|
static inputSchema() {
|
|
8993
|
-
return
|
|
9590
|
+
return inputSchema37;
|
|
8994
9591
|
}
|
|
8995
9592
|
static outputSchema() {
|
|
8996
9593
|
return outputSchema36;
|
|
@@ -8999,10 +9596,10 @@ class ScalarMaxTask extends Task41 {
|
|
|
8999
9596
|
return { result: Math.max(...input2.values) };
|
|
9000
9597
|
}
|
|
9001
9598
|
}
|
|
9002
|
-
|
|
9599
|
+
Workflow45.prototype.scalarMax = CreateWorkflow44(ScalarMaxTask);
|
|
9003
9600
|
// src/task/scalar/ScalarMinTask.ts
|
|
9004
|
-
import { CreateWorkflow as
|
|
9005
|
-
var
|
|
9601
|
+
import { CreateWorkflow as CreateWorkflow45, Task as Task44, Workflow as Workflow46 } from "@workglow/task-graph";
|
|
9602
|
+
var inputSchema38 = {
|
|
9006
9603
|
type: "object",
|
|
9007
9604
|
properties: {
|
|
9008
9605
|
values: {
|
|
@@ -9028,13 +9625,13 @@ var outputSchema37 = {
|
|
|
9028
9625
|
additionalProperties: false
|
|
9029
9626
|
};
|
|
9030
9627
|
|
|
9031
|
-
class ScalarMinTask extends
|
|
9628
|
+
class ScalarMinTask extends Task44 {
|
|
9032
9629
|
static type = "ScalarMinTask";
|
|
9033
9630
|
static category = "Math";
|
|
9034
9631
|
static title = "Min";
|
|
9035
9632
|
static description = "Returns the smallest of the given numbers";
|
|
9036
9633
|
static inputSchema() {
|
|
9037
|
-
return
|
|
9634
|
+
return inputSchema38;
|
|
9038
9635
|
}
|
|
9039
9636
|
static outputSchema() {
|
|
9040
9637
|
return outputSchema37;
|
|
@@ -9043,10 +9640,10 @@ class ScalarMinTask extends Task42 {
|
|
|
9043
9640
|
return { result: Math.min(...input2.values) };
|
|
9044
9641
|
}
|
|
9045
9642
|
}
|
|
9046
|
-
|
|
9643
|
+
Workflow46.prototype.scalarMin = CreateWorkflow45(ScalarMinTask);
|
|
9047
9644
|
// src/task/scalar/ScalarRoundTask.ts
|
|
9048
|
-
import { CreateWorkflow as
|
|
9049
|
-
var
|
|
9645
|
+
import { CreateWorkflow as CreateWorkflow46, Task as Task45, Workflow as Workflow47 } from "@workglow/task-graph";
|
|
9646
|
+
var inputSchema39 = {
|
|
9050
9647
|
type: "object",
|
|
9051
9648
|
properties: {
|
|
9052
9649
|
value: {
|
|
@@ -9071,13 +9668,13 @@ var outputSchema38 = {
|
|
|
9071
9668
|
additionalProperties: false
|
|
9072
9669
|
};
|
|
9073
9670
|
|
|
9074
|
-
class ScalarRoundTask extends
|
|
9671
|
+
class ScalarRoundTask extends Task45 {
|
|
9075
9672
|
static type = "ScalarRoundTask";
|
|
9076
9673
|
static category = "Math";
|
|
9077
9674
|
static title = "Round";
|
|
9078
9675
|
static description = "Returns the value of a number rounded to the nearest integer";
|
|
9079
9676
|
static inputSchema() {
|
|
9080
|
-
return
|
|
9677
|
+
return inputSchema39;
|
|
9081
9678
|
}
|
|
9082
9679
|
static outputSchema() {
|
|
9083
9680
|
return outputSchema38;
|
|
@@ -9086,10 +9683,10 @@ class ScalarRoundTask extends Task43 {
|
|
|
9086
9683
|
return { result: Math.round(input2.value) };
|
|
9087
9684
|
}
|
|
9088
9685
|
}
|
|
9089
|
-
|
|
9686
|
+
Workflow47.prototype.scalarRound = CreateWorkflow46(ScalarRoundTask);
|
|
9090
9687
|
// src/task/scalar/ScalarTruncTask.ts
|
|
9091
|
-
import { CreateWorkflow as
|
|
9092
|
-
var
|
|
9688
|
+
import { CreateWorkflow as CreateWorkflow47, Task as Task46, Workflow as Workflow48 } from "@workglow/task-graph";
|
|
9689
|
+
var inputSchema40 = {
|
|
9093
9690
|
type: "object",
|
|
9094
9691
|
properties: {
|
|
9095
9692
|
value: {
|
|
@@ -9114,13 +9711,13 @@ var outputSchema39 = {
|
|
|
9114
9711
|
additionalProperties: false
|
|
9115
9712
|
};
|
|
9116
9713
|
|
|
9117
|
-
class ScalarTruncTask extends
|
|
9714
|
+
class ScalarTruncTask extends Task46 {
|
|
9118
9715
|
static type = "ScalarTruncTask";
|
|
9119
9716
|
static category = "Math";
|
|
9120
9717
|
static title = "Truncate";
|
|
9121
9718
|
static description = "Returns the integer part of a number by removing fractional digits";
|
|
9122
9719
|
static inputSchema() {
|
|
9123
|
-
return
|
|
9720
|
+
return inputSchema40;
|
|
9124
9721
|
}
|
|
9125
9722
|
static outputSchema() {
|
|
9126
9723
|
return outputSchema39;
|
|
@@ -9129,13 +9726,13 @@ class ScalarTruncTask extends Task44 {
|
|
|
9129
9726
|
return { result: Math.trunc(input2.value) };
|
|
9130
9727
|
}
|
|
9131
9728
|
}
|
|
9132
|
-
|
|
9729
|
+
Workflow48.prototype.scalarTrunc = CreateWorkflow47(ScalarTruncTask);
|
|
9133
9730
|
// src/task/vector/VectorDistanceTask.ts
|
|
9134
|
-
import { CreateWorkflow as
|
|
9731
|
+
import { CreateWorkflow as CreateWorkflow48, Task as Task47, Workflow as Workflow49 } from "@workglow/task-graph";
|
|
9135
9732
|
import {
|
|
9136
9733
|
TypedArraySchema as TypedArraySchema5
|
|
9137
9734
|
} from "@workglow/util/schema";
|
|
9138
|
-
var
|
|
9735
|
+
var inputSchema41 = {
|
|
9139
9736
|
type: "object",
|
|
9140
9737
|
properties: {
|
|
9141
9738
|
vectors: {
|
|
@@ -9164,13 +9761,13 @@ var outputSchema40 = {
|
|
|
9164
9761
|
additionalProperties: false
|
|
9165
9762
|
};
|
|
9166
9763
|
|
|
9167
|
-
class VectorDistanceTask extends
|
|
9764
|
+
class VectorDistanceTask extends Task47 {
|
|
9168
9765
|
static type = "VectorDistanceTask";
|
|
9169
9766
|
static category = "Vector";
|
|
9170
9767
|
static title = "Distance";
|
|
9171
9768
|
static description = "Returns the Euclidean distance between the first two vectors";
|
|
9172
9769
|
static inputSchema() {
|
|
9173
|
-
return
|
|
9770
|
+
return inputSchema41;
|
|
9174
9771
|
}
|
|
9175
9772
|
static outputSchema() {
|
|
9176
9773
|
return outputSchema40;
|
|
@@ -9191,13 +9788,13 @@ class VectorDistanceTask extends Task45 {
|
|
|
9191
9788
|
return { result: Math.sqrt(sumPrecise(diffs)) };
|
|
9192
9789
|
}
|
|
9193
9790
|
}
|
|
9194
|
-
|
|
9791
|
+
Workflow49.prototype.vectorDistance = CreateWorkflow48(VectorDistanceTask);
|
|
9195
9792
|
// src/task/vector/VectorDotProductTask.ts
|
|
9196
|
-
import { CreateWorkflow as
|
|
9793
|
+
import { CreateWorkflow as CreateWorkflow49, Task as Task48, Workflow as Workflow50 } from "@workglow/task-graph";
|
|
9197
9794
|
import {
|
|
9198
9795
|
TypedArraySchema as TypedArraySchema6
|
|
9199
9796
|
} from "@workglow/util/schema";
|
|
9200
|
-
var
|
|
9797
|
+
var inputSchema42 = {
|
|
9201
9798
|
type: "object",
|
|
9202
9799
|
properties: {
|
|
9203
9800
|
vectors: {
|
|
@@ -9226,13 +9823,13 @@ var outputSchema41 = {
|
|
|
9226
9823
|
additionalProperties: false
|
|
9227
9824
|
};
|
|
9228
9825
|
|
|
9229
|
-
class VectorDotProductTask extends
|
|
9826
|
+
class VectorDotProductTask extends Task48 {
|
|
9230
9827
|
static type = "VectorDotProductTask";
|
|
9231
9828
|
static category = "Vector";
|
|
9232
9829
|
static title = "Dot Product";
|
|
9233
9830
|
static description = "Returns the dot (inner) product of the first two vectors";
|
|
9234
9831
|
static inputSchema() {
|
|
9235
|
-
return
|
|
9832
|
+
return inputSchema42;
|
|
9236
9833
|
}
|
|
9237
9834
|
static outputSchema() {
|
|
9238
9835
|
return outputSchema41;
|
|
@@ -9250,14 +9847,14 @@ class VectorDotProductTask extends Task46 {
|
|
|
9250
9847
|
return { result: sumPrecise(products) };
|
|
9251
9848
|
}
|
|
9252
9849
|
}
|
|
9253
|
-
|
|
9850
|
+
Workflow50.prototype.vectorDotProduct = CreateWorkflow49(VectorDotProductTask);
|
|
9254
9851
|
// src/task/vector/VectorNormalizeTask.ts
|
|
9255
|
-
import { CreateWorkflow as
|
|
9852
|
+
import { CreateWorkflow as CreateWorkflow50, Task as Task49, Workflow as Workflow51 } from "@workglow/task-graph";
|
|
9256
9853
|
import {
|
|
9257
9854
|
TypedArraySchema as TypedArraySchema7,
|
|
9258
9855
|
normalize
|
|
9259
9856
|
} from "@workglow/util/schema";
|
|
9260
|
-
var
|
|
9857
|
+
var inputSchema43 = {
|
|
9261
9858
|
type: "object",
|
|
9262
9859
|
properties: {
|
|
9263
9860
|
vector: TypedArraySchema7({
|
|
@@ -9280,13 +9877,13 @@ var outputSchema42 = {
|
|
|
9280
9877
|
additionalProperties: false
|
|
9281
9878
|
};
|
|
9282
9879
|
|
|
9283
|
-
class VectorNormalizeTask extends
|
|
9880
|
+
class VectorNormalizeTask extends Task49 {
|
|
9284
9881
|
static type = "VectorNormalizeTask";
|
|
9285
9882
|
static category = "Vector";
|
|
9286
9883
|
static title = "Normalize";
|
|
9287
9884
|
static description = "Returns the L2-normalized (unit length) vector";
|
|
9288
9885
|
static inputSchema() {
|
|
9289
|
-
return
|
|
9886
|
+
return inputSchema43;
|
|
9290
9887
|
}
|
|
9291
9888
|
static outputSchema() {
|
|
9292
9889
|
return outputSchema42;
|
|
@@ -9295,14 +9892,14 @@ class VectorNormalizeTask extends Task47 {
|
|
|
9295
9892
|
return { result: normalize(input2.vector) };
|
|
9296
9893
|
}
|
|
9297
9894
|
}
|
|
9298
|
-
|
|
9895
|
+
Workflow51.prototype.vectorNormalize = CreateWorkflow50(VectorNormalizeTask);
|
|
9299
9896
|
// src/task/vector/VectorScaleTask.ts
|
|
9300
|
-
import { CreateWorkflow as
|
|
9897
|
+
import { CreateWorkflow as CreateWorkflow51, Task as Task50, Workflow as Workflow52 } from "@workglow/task-graph";
|
|
9301
9898
|
import {
|
|
9302
9899
|
createTypedArrayFrom as createTypedArrayFrom5,
|
|
9303
9900
|
TypedArraySchema as TypedArraySchema8
|
|
9304
9901
|
} from "@workglow/util/schema";
|
|
9305
|
-
var
|
|
9902
|
+
var inputSchema44 = {
|
|
9306
9903
|
type: "object",
|
|
9307
9904
|
properties: {
|
|
9308
9905
|
vector: TypedArraySchema8({
|
|
@@ -9330,13 +9927,13 @@ var outputSchema43 = {
|
|
|
9330
9927
|
additionalProperties: false
|
|
9331
9928
|
};
|
|
9332
9929
|
|
|
9333
|
-
class VectorScaleTask extends
|
|
9930
|
+
class VectorScaleTask extends Task50 {
|
|
9334
9931
|
static type = "VectorScaleTask";
|
|
9335
9932
|
static category = "Vector";
|
|
9336
9933
|
static title = "Scale";
|
|
9337
9934
|
static description = "Multiplies each element of a vector by a scalar";
|
|
9338
9935
|
static inputSchema() {
|
|
9339
|
-
return
|
|
9936
|
+
return inputSchema44;
|
|
9340
9937
|
}
|
|
9341
9938
|
static outputSchema() {
|
|
9342
9939
|
return outputSchema43;
|
|
@@ -9347,7 +9944,7 @@ class VectorScaleTask extends Task48 {
|
|
|
9347
9944
|
return { result: createTypedArrayFrom5([vector], values) };
|
|
9348
9945
|
}
|
|
9349
9946
|
}
|
|
9350
|
-
|
|
9947
|
+
Workflow52.prototype.vectorScale = CreateWorkflow51(VectorScaleTask);
|
|
9351
9948
|
|
|
9352
9949
|
// src/common.ts
|
|
9353
9950
|
import { TaskRegistry } from "@workglow/task-graph";
|
|
@@ -9356,6 +9953,8 @@ var registerCommonTasks = () => {
|
|
|
9356
9953
|
DebugLogTask,
|
|
9357
9954
|
DelayTask,
|
|
9358
9955
|
FetchUrlTask,
|
|
9956
|
+
HumanApprovalTask,
|
|
9957
|
+
HumanInputTask,
|
|
9359
9958
|
InputTask,
|
|
9360
9959
|
JavaScriptTask,
|
|
9361
9960
|
JsonTask,
|
|
@@ -9408,13 +10007,13 @@ var registerCommonTasks = () => {
|
|
|
9408
10007
|
};
|
|
9409
10008
|
// src/task/FileLoaderTask.ts
|
|
9410
10009
|
import {
|
|
9411
|
-
CreateWorkflow as
|
|
9412
|
-
Task as
|
|
9413
|
-
TaskAbortedError as
|
|
9414
|
-
Workflow as
|
|
10010
|
+
CreateWorkflow as CreateWorkflow52,
|
|
10011
|
+
Task as Task51,
|
|
10012
|
+
TaskAbortedError as TaskAbortedError4,
|
|
10013
|
+
Workflow as Workflow53
|
|
9415
10014
|
} from "@workglow/task-graph";
|
|
9416
10015
|
import Papa from "papaparse";
|
|
9417
|
-
var
|
|
10016
|
+
var inputSchema45 = {
|
|
9418
10017
|
type: "object",
|
|
9419
10018
|
properties: {
|
|
9420
10019
|
url: {
|
|
@@ -9485,14 +10084,14 @@ var outputSchema44 = {
|
|
|
9485
10084
|
additionalProperties: false
|
|
9486
10085
|
};
|
|
9487
10086
|
|
|
9488
|
-
class FileLoaderTask extends
|
|
10087
|
+
class FileLoaderTask extends Task51 {
|
|
9489
10088
|
static type = "FileLoaderTask";
|
|
9490
10089
|
static category = "Document";
|
|
9491
10090
|
static title = "File Loader";
|
|
9492
10091
|
static description = "Load documents from URLs (http://, https://)";
|
|
9493
10092
|
static cacheable = true;
|
|
9494
10093
|
static inputSchema() {
|
|
9495
|
-
return
|
|
10094
|
+
return inputSchema45;
|
|
9496
10095
|
}
|
|
9497
10096
|
static outputSchema() {
|
|
9498
10097
|
return outputSchema44;
|
|
@@ -9500,30 +10099,28 @@ class FileLoaderTask extends Task49 {
|
|
|
9500
10099
|
async execute(input2, context) {
|
|
9501
10100
|
const { url, format = "auto" } = input2;
|
|
9502
10101
|
if (context.signal.aborted) {
|
|
9503
|
-
throw new
|
|
10102
|
+
throw new TaskAbortedError4("Task aborted");
|
|
9504
10103
|
}
|
|
9505
10104
|
await context.updateProgress(0, "Detecting file format");
|
|
9506
10105
|
const detectedFormat = this.detectFormat(url, format);
|
|
9507
10106
|
const responseType = this.detectResponseType(detectedFormat);
|
|
9508
10107
|
if (context.signal.aborted) {
|
|
9509
|
-
throw new
|
|
10108
|
+
throw new TaskAbortedError4("Task aborted");
|
|
9510
10109
|
}
|
|
9511
10110
|
await context.updateProgress(10, `Fetching ${detectedFormat} file from ${url}`);
|
|
9512
|
-
const fetchTask = context.own(new FetchUrlTask({
|
|
10111
|
+
const fetchTask = context.own(new FetchUrlTask({ queue: false }));
|
|
10112
|
+
const response = await fetchTask.run({
|
|
9513
10113
|
url,
|
|
9514
10114
|
response_type: responseType
|
|
9515
|
-
}
|
|
9516
|
-
queue: false
|
|
9517
|
-
}));
|
|
9518
|
-
const response = await fetchTask.run();
|
|
10115
|
+
});
|
|
9519
10116
|
if (context.signal.aborted) {
|
|
9520
|
-
throw new
|
|
10117
|
+
throw new TaskAbortedError4("Task aborted");
|
|
9521
10118
|
}
|
|
9522
10119
|
await context.updateProgress(60, "Parsing file content");
|
|
9523
10120
|
const title = url.split("/").pop() || url;
|
|
9524
10121
|
const { text, json: json2, csv, image, pdf, frontmatter, size, mimeType } = await this.parseResponse(response, url, detectedFormat);
|
|
9525
10122
|
if (context.signal.aborted) {
|
|
9526
|
-
throw new
|
|
10123
|
+
throw new TaskAbortedError4("Task aborted");
|
|
9527
10124
|
}
|
|
9528
10125
|
await context.updateProgress(100, "File loaded successfully");
|
|
9529
10126
|
return {
|
|
@@ -9847,9 +10444,9 @@ class FileLoaderTask extends Task49 {
|
|
|
9847
10444
|
}
|
|
9848
10445
|
}
|
|
9849
10446
|
var fileLoader = (input2, config) => {
|
|
9850
|
-
return new FileLoaderTask(
|
|
10447
|
+
return new FileLoaderTask(config).run(input2);
|
|
9851
10448
|
};
|
|
9852
|
-
|
|
10449
|
+
Workflow53.prototype.fileLoader = CreateWorkflow52(FileLoaderTask);
|
|
9853
10450
|
// src/browser.ts
|
|
9854
10451
|
import { TaskRegistry as TaskRegistry2 } from "@workglow/task-graph";
|
|
9855
10452
|
registerMcpTaskDeps({
|
|
@@ -9869,6 +10466,7 @@ export {
|
|
|
9869
10466
|
setGlobalMcpServerRepository,
|
|
9870
10467
|
searchMcpRegistryPage,
|
|
9871
10468
|
searchMcpRegistry,
|
|
10469
|
+
resolveHumanConnector,
|
|
9872
10470
|
resolveAuthSecrets,
|
|
9873
10471
|
registerMcpTaskDeps,
|
|
9874
10472
|
registerMcpServer,
|
|
@@ -9946,6 +10544,7 @@ export {
|
|
|
9946
10544
|
McpResourceReadTask,
|
|
9947
10545
|
McpPromptGetTask,
|
|
9948
10546
|
McpListTask,
|
|
10547
|
+
McpElicitationConnector,
|
|
9949
10548
|
MCP_TASK_DEPS,
|
|
9950
10549
|
MCP_SERVER_REPOSITORY,
|
|
9951
10550
|
MCP_SERVERS,
|
|
@@ -9955,6 +10554,9 @@ export {
|
|
|
9955
10554
|
JavaScriptTask,
|
|
9956
10555
|
InputTask,
|
|
9957
10556
|
InMemoryMcpServerRepository,
|
|
10557
|
+
HumanInputTask,
|
|
10558
|
+
HumanApprovalTask,
|
|
10559
|
+
HUMAN_CONNECTOR,
|
|
9958
10560
|
FileLoaderTask,
|
|
9959
10561
|
FetchUrlTask,
|
|
9960
10562
|
FetchUrlJob,
|
|
@@ -9965,4 +10567,4 @@ export {
|
|
|
9965
10567
|
ArrayTask
|
|
9966
10568
|
};
|
|
9967
10569
|
|
|
9968
|
-
//# debugId=
|
|
10570
|
+
//# debugId=BE3950255C768C0964756E2164756E21
|