@workglow/tasks 0.1.2 → 0.2.1
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 +2185 -337
- package/dist/browser.js.map +52 -30
- package/dist/bun.d.ts +1 -1
- package/dist/bun.d.ts.map +1 -1
- package/dist/bun.js +2201 -353
- package/dist/bun.js.map +53 -31
- package/dist/common.d.ts +41 -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/getMcpServerConfig.d.ts.map +1 -1
- package/dist/node.d.ts +1 -1
- package/dist/node.d.ts.map +1 -1
- package/dist/node.js +2201 -353
- package/dist/node.js.map +53 -31
- package/dist/task/ArrayTask.d.ts +5 -4
- package/dist/task/ArrayTask.d.ts.map +1 -1
- package/dist/task/DelayTask.d.ts.map +1 -1
- package/dist/task/FetchUrlTask.d.ts +3 -1
- package/dist/task/FetchUrlTask.d.ts.map +1 -1
- package/dist/task/FileLoaderTask.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 +8 -1
- package/dist/task/JavaScriptTask.d.ts.map +1 -1
- package/dist/task/JsonTask.d.ts +2 -2
- 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.map +1 -1
- package/dist/task/OutputTask.d.ts +3 -1
- package/dist/task/OutputTask.d.ts.map +1 -1
- package/dist/task/SplitTask.d.ts +1 -3
- package/dist/task/SplitTask.d.ts.map +1 -1
- package/dist/task/image/ImageBlurTask.d.ts +219 -0
- package/dist/task/image/ImageBlurTask.d.ts.map +1 -0
- package/dist/task/image/ImageBorderTask.d.ts +281 -0
- package/dist/task/image/ImageBorderTask.d.ts.map +1 -0
- package/dist/task/image/ImageBrightnessTask.d.ts +219 -0
- package/dist/task/image/ImageBrightnessTask.d.ts.map +1 -0
- package/dist/task/image/ImageContrastTask.d.ts +219 -0
- package/dist/task/image/ImageContrastTask.d.ts.map +1 -0
- package/dist/task/image/ImageCropTask.d.ts +251 -0
- package/dist/task/image/ImageCropTask.d.ts.map +1 -0
- package/dist/task/image/ImageFlipTask.d.ts +215 -0
- package/dist/task/image/ImageFlipTask.d.ts.map +1 -0
- package/dist/task/image/ImageGrayscaleTask.d.ts +203 -0
- package/dist/task/image/ImageGrayscaleTask.d.ts.map +1 -0
- package/dist/task/image/ImageInvertTask.d.ts +203 -0
- package/dist/task/image/ImageInvertTask.d.ts.map +1 -0
- package/dist/task/image/ImagePixelateTask.d.ts +217 -0
- package/dist/task/image/ImagePixelateTask.d.ts.map +1 -0
- package/dist/task/image/ImagePosterizeTask.d.ts +219 -0
- package/dist/task/image/ImagePosterizeTask.d.ts.map +1 -0
- package/dist/task/image/ImageResizeTask.d.ts +227 -0
- package/dist/task/image/ImageResizeTask.d.ts.map +1 -0
- package/dist/task/image/ImageRotateTask.d.ts +215 -0
- package/dist/task/image/ImageRotateTask.d.ts.map +1 -0
- package/dist/task/image/ImageSchemas.d.ts +94 -0
- package/dist/task/image/ImageSchemas.d.ts.map +1 -0
- package/dist/task/image/ImageSepiaTask.d.ts +203 -0
- package/dist/task/image/ImageSepiaTask.d.ts.map +1 -0
- package/dist/task/image/ImageThresholdTask.d.ts +219 -0
- package/dist/task/image/ImageThresholdTask.d.ts.map +1 -0
- package/dist/task/image/ImageTintTask.d.ts +283 -0
- package/dist/task/image/ImageTintTask.d.ts.map +1 -0
- package/dist/task/image/ImageTransparencyTask.d.ts +217 -0
- package/dist/task/image/ImageTransparencyTask.d.ts.map +1 -0
- package/dist/task/image/ImageWatermarkTask.d.ts +247 -0
- package/dist/task/image/ImageWatermarkTask.d.ts.map +1 -0
- package/dist/task/mcp/McpListTask.d.ts +4 -0
- package/dist/task/mcp/McpListTask.d.ts.map +1 -1
- package/dist/task/mcp/McpPromptGetTask.d.ts +6 -2
- package/dist/task/mcp/McpPromptGetTask.d.ts.map +1 -1
- package/dist/task/mcp/McpResourceReadTask.d.ts +4 -0
- package/dist/task/mcp/McpResourceReadTask.d.ts.map +1 -1
- package/dist/task/mcp/McpSearchTask.d.ts +2 -0
- 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/ScalarCeilTask.d.ts.map +1 -1
- package/dist/task/scalar/ScalarRoundTask.d.ts.map +1 -1
- package/dist/task/scalar/ScalarTruncTask.d.ts.map +1 -1
- package/dist/task/string/StringTemplateTask.d.ts.map +1 -1
- package/dist/task/vector/VectorDistanceTask.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/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,19 +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,
|
|
7267
7723
|
registerInputCompactor,
|
|
7268
7724
|
registerInputResolver
|
|
7269
7725
|
} from "@workglow/util";
|
|
7270
|
-
var MCP_SERVERS =
|
|
7271
|
-
var MCP_SERVER_REPOSITORY =
|
|
7272
|
-
|
|
7273
|
-
|
|
7274
|
-
}
|
|
7275
|
-
if (!globalServiceRegistry2.has(MCP_SERVER_REPOSITORY)) {
|
|
7276
|
-
globalServiceRegistry2.register(MCP_SERVER_REPOSITORY, () => new InMemoryMcpServerRepository, true);
|
|
7277
|
-
}
|
|
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);
|
|
7278
7730
|
function getGlobalMcpServers() {
|
|
7279
7731
|
return globalServiceRegistry2.get(MCP_SERVERS);
|
|
7280
7732
|
}
|
|
@@ -7339,7 +7791,29 @@ function getMcpServerConfig(configOrInput) {
|
|
|
7339
7791
|
return base;
|
|
7340
7792
|
}
|
|
7341
7793
|
// src/task/mcp/McpListTask.ts
|
|
7342
|
-
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
|
|
7343
7817
|
var mcpListTypes = ["tools", "resources", "prompts"];
|
|
7344
7818
|
var iconSchema = {
|
|
7345
7819
|
type: "object",
|
|
@@ -7496,13 +7970,35 @@ var outputSchemaAll = {
|
|
|
7496
7970
|
additionalProperties: false
|
|
7497
7971
|
};
|
|
7498
7972
|
|
|
7499
|
-
class McpListTask extends
|
|
7973
|
+
class McpListTask extends Task25 {
|
|
7500
7974
|
static type = "McpListTask";
|
|
7501
7975
|
static category = "MCP";
|
|
7502
7976
|
static title = "MCP List";
|
|
7503
7977
|
static description = "Lists tools, resources, or prompts available on an MCP server";
|
|
7504
7978
|
static cacheable = false;
|
|
7505
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
|
+
}
|
|
7506
8002
|
static inputSchema() {
|
|
7507
8003
|
const { mcpServerConfigSchema: mcpServerConfigSchema2 } = getMcpTaskDeps();
|
|
7508
8004
|
return {
|
|
@@ -7579,15 +8075,17 @@ class McpListTask extends Task23 {
|
|
|
7579
8075
|
}
|
|
7580
8076
|
}
|
|
7581
8077
|
var mcpList = async (input2, config = {}) => {
|
|
7582
|
-
return new McpListTask(
|
|
8078
|
+
return new McpListTask(config).run(input2);
|
|
7583
8079
|
};
|
|
7584
|
-
|
|
8080
|
+
Workflow27.prototype.mcpList = CreateWorkflow26(McpListTask);
|
|
7585
8081
|
// src/task/mcp/McpPromptGetTask.ts
|
|
7586
8082
|
import {
|
|
7587
|
-
CreateWorkflow as
|
|
7588
|
-
|
|
7589
|
-
|
|
7590
|
-
|
|
8083
|
+
CreateWorkflow as CreateWorkflow27,
|
|
8084
|
+
Entitlements as Entitlements4,
|
|
8085
|
+
mergeEntitlements as mergeEntitlements2,
|
|
8086
|
+
Task as Task26,
|
|
8087
|
+
TaskConfigSchema as TaskConfigSchema8,
|
|
8088
|
+
Workflow as Workflow28
|
|
7591
8089
|
} from "@workglow/task-graph";
|
|
7592
8090
|
var annotationsSchema = {
|
|
7593
8091
|
type: "object",
|
|
@@ -7722,7 +8220,7 @@ var fallbackInputSchema = {
|
|
|
7722
8220
|
additionalProperties: false
|
|
7723
8221
|
};
|
|
7724
8222
|
|
|
7725
|
-
class McpPromptGetTask extends
|
|
8223
|
+
class McpPromptGetTask extends Task26 {
|
|
7726
8224
|
static type = "McpPromptGetTask";
|
|
7727
8225
|
static category = "MCP";
|
|
7728
8226
|
static title = "MCP Get Prompt";
|
|
@@ -7730,6 +8228,29 @@ class McpPromptGetTask extends Task24 {
|
|
|
7730
8228
|
static cacheable = false;
|
|
7731
8229
|
static customizable = true;
|
|
7732
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
|
+
}
|
|
7733
8254
|
static inputSchema() {
|
|
7734
8255
|
return fallbackInputSchema;
|
|
7735
8256
|
}
|
|
@@ -7741,7 +8262,7 @@ class McpPromptGetTask extends Task24 {
|
|
|
7741
8262
|
return {
|
|
7742
8263
|
type: "object",
|
|
7743
8264
|
properties: {
|
|
7744
|
-
...
|
|
8265
|
+
...TaskConfigSchema8["properties"],
|
|
7745
8266
|
server: TypeMcpServer(mcpServerConfigSchema2),
|
|
7746
8267
|
prompt_name: {
|
|
7747
8268
|
type: "string",
|
|
@@ -7760,43 +8281,45 @@ class McpPromptGetTask extends Task24 {
|
|
|
7760
8281
|
outputSchema() {
|
|
7761
8282
|
return this.config?.outputSchema ?? fallbackOutputSchema;
|
|
7762
8283
|
}
|
|
7763
|
-
|
|
8284
|
+
_schemasDiscoveringPromise;
|
|
7764
8285
|
async discoverSchemas(_signal, serverConfig) {
|
|
7765
8286
|
if (this.config.inputSchema)
|
|
7766
8287
|
return;
|
|
7767
|
-
if (this.
|
|
7768
|
-
return;
|
|
8288
|
+
if (this._schemasDiscoveringPromise)
|
|
8289
|
+
return this._schemasDiscoveringPromise;
|
|
7769
8290
|
const resolved = serverConfig ?? getMcpServerConfig(this.config);
|
|
7770
8291
|
if (!resolved.transport || !this.config.prompt_name)
|
|
7771
8292
|
return;
|
|
7772
|
-
this.
|
|
7773
|
-
|
|
7774
|
-
|
|
7775
|
-
|
|
7776
|
-
|
|
7777
|
-
|
|
7778
|
-
|
|
7779
|
-
|
|
7780
|
-
|
|
7781
|
-
|
|
7782
|
-
|
|
7783
|
-
|
|
7784
|
-
|
|
7785
|
-
|
|
7786
|
-
|
|
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
|
|
7787
8315
|
};
|
|
8316
|
+
this.emitSchemaChange();
|
|
7788
8317
|
}
|
|
7789
|
-
|
|
7790
|
-
|
|
7791
|
-
properties,
|
|
7792
|
-
...required.length > 0 ? { required } : {},
|
|
7793
|
-
additionalProperties: false
|
|
7794
|
-
};
|
|
7795
|
-
this.emitSchemaChange();
|
|
8318
|
+
} finally {
|
|
8319
|
+
this._schemasDiscoveringPromise = undefined;
|
|
7796
8320
|
}
|
|
7797
|
-
}
|
|
7798
|
-
|
|
7799
|
-
}
|
|
8321
|
+
})();
|
|
8322
|
+
return this._schemasDiscoveringPromise;
|
|
7800
8323
|
}
|
|
7801
8324
|
async execute(input2, context) {
|
|
7802
8325
|
const serverConfig = getMcpServerConfig(this.config);
|
|
@@ -7818,15 +8341,17 @@ class McpPromptGetTask extends Task24 {
|
|
|
7818
8341
|
}
|
|
7819
8342
|
}
|
|
7820
8343
|
var mcpPromptGet = async (input2, config) => {
|
|
7821
|
-
return new McpPromptGetTask(
|
|
8344
|
+
return new McpPromptGetTask(config).run(input2);
|
|
7822
8345
|
};
|
|
7823
|
-
|
|
8346
|
+
Workflow28.prototype.mcpPromptGet = CreateWorkflow27(McpPromptGetTask);
|
|
7824
8347
|
// src/task/mcp/McpResourceReadTask.ts
|
|
7825
8348
|
import {
|
|
7826
|
-
CreateWorkflow as
|
|
7827
|
-
|
|
7828
|
-
|
|
7829
|
-
|
|
8349
|
+
CreateWorkflow as CreateWorkflow28,
|
|
8350
|
+
Entitlements as Entitlements5,
|
|
8351
|
+
mergeEntitlements as mergeEntitlements3,
|
|
8352
|
+
Task as Task27,
|
|
8353
|
+
TaskConfigSchema as TaskConfigSchema9,
|
|
8354
|
+
Workflow as Workflow29
|
|
7830
8355
|
} from "@workglow/task-graph";
|
|
7831
8356
|
var contentItemSchema = {
|
|
7832
8357
|
anyOf: [
|
|
@@ -7854,7 +8379,7 @@ var contentItemSchema = {
|
|
|
7854
8379
|
}
|
|
7855
8380
|
]
|
|
7856
8381
|
};
|
|
7857
|
-
var
|
|
8382
|
+
var inputSchema23 = {
|
|
7858
8383
|
type: "object",
|
|
7859
8384
|
properties: {},
|
|
7860
8385
|
additionalProperties: false
|
|
@@ -7873,15 +8398,40 @@ var outputSchema22 = {
|
|
|
7873
8398
|
additionalProperties: false
|
|
7874
8399
|
};
|
|
7875
8400
|
|
|
7876
|
-
class McpResourceReadTask extends
|
|
8401
|
+
class McpResourceReadTask extends Task27 {
|
|
7877
8402
|
static type = "McpResourceReadTask";
|
|
7878
8403
|
static category = "MCP";
|
|
7879
8404
|
static title = "MCP Read Resource";
|
|
7880
8405
|
static description = "Reads a resource from an MCP server";
|
|
7881
8406
|
static cacheable = false;
|
|
7882
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
|
+
}
|
|
7883
8433
|
static inputSchema() {
|
|
7884
|
-
return
|
|
8434
|
+
return inputSchema23;
|
|
7885
8435
|
}
|
|
7886
8436
|
static outputSchema() {
|
|
7887
8437
|
return outputSchema22;
|
|
@@ -7891,7 +8441,7 @@ class McpResourceReadTask extends Task25 {
|
|
|
7891
8441
|
return {
|
|
7892
8442
|
type: "object",
|
|
7893
8443
|
properties: {
|
|
7894
|
-
...
|
|
8444
|
+
...TaskConfigSchema9["properties"],
|
|
7895
8445
|
server: TypeMcpServer(mcpServerConfigSchema2),
|
|
7896
8446
|
resource_uri: {
|
|
7897
8447
|
type: "string",
|
|
@@ -7919,11 +8469,16 @@ class McpResourceReadTask extends Task25 {
|
|
|
7919
8469
|
}
|
|
7920
8470
|
}
|
|
7921
8471
|
var mcpResourceRead = async (config) => {
|
|
7922
|
-
return new McpResourceReadTask(
|
|
8472
|
+
return new McpResourceReadTask(config).run({});
|
|
7923
8473
|
};
|
|
7924
|
-
|
|
8474
|
+
Workflow29.prototype.mcpResourceRead = CreateWorkflow28(McpResourceReadTask);
|
|
7925
8475
|
// src/task/mcp/McpSearchTask.ts
|
|
7926
|
-
import {
|
|
8476
|
+
import {
|
|
8477
|
+
CreateWorkflow as CreateWorkflow29,
|
|
8478
|
+
Entitlements as Entitlements6,
|
|
8479
|
+
Task as Task28,
|
|
8480
|
+
Workflow as Workflow30
|
|
8481
|
+
} from "@workglow/task-graph";
|
|
7927
8482
|
var MCP_REGISTRY_BASE = "https://registry.modelcontextprotocol.io/v0.1";
|
|
7928
8483
|
var McpSearchInputSchema = {
|
|
7929
8484
|
type: "object",
|
|
@@ -8062,12 +8617,19 @@ async function searchMcpRegistry(query, signal) {
|
|
|
8062
8617
|
return page.results;
|
|
8063
8618
|
}
|
|
8064
8619
|
|
|
8065
|
-
class McpSearchTask extends
|
|
8620
|
+
class McpSearchTask extends Task28 {
|
|
8066
8621
|
static type = "McpSearchTask";
|
|
8067
8622
|
static category = "MCP";
|
|
8068
8623
|
static title = "MCP Search";
|
|
8069
8624
|
static description = "Search the MCP server registry for servers matching a query";
|
|
8070
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
|
+
}
|
|
8071
8633
|
static inputSchema() {
|
|
8072
8634
|
return McpSearchInputSchema;
|
|
8073
8635
|
}
|
|
@@ -8080,15 +8642,17 @@ class McpSearchTask extends Task26 {
|
|
|
8080
8642
|
}
|
|
8081
8643
|
}
|
|
8082
8644
|
var mcpSearch = (input2, config) => {
|
|
8083
|
-
return new McpSearchTask(
|
|
8645
|
+
return new McpSearchTask(config).run(input2);
|
|
8084
8646
|
};
|
|
8085
|
-
|
|
8647
|
+
Workflow30.prototype.mcpSearch = CreateWorkflow29(McpSearchTask);
|
|
8086
8648
|
// src/task/mcp/McpToolCallTask.ts
|
|
8087
8649
|
import {
|
|
8088
|
-
CreateWorkflow as
|
|
8089
|
-
|
|
8090
|
-
|
|
8091
|
-
|
|
8650
|
+
CreateWorkflow as CreateWorkflow30,
|
|
8651
|
+
Entitlements as Entitlements7,
|
|
8652
|
+
mergeEntitlements as mergeEntitlements4,
|
|
8653
|
+
Task as Task29,
|
|
8654
|
+
TaskConfigSchema as TaskConfigSchema10,
|
|
8655
|
+
Workflow as Workflow31
|
|
8092
8656
|
} from "@workglow/task-graph";
|
|
8093
8657
|
var annotationsSchema2 = {
|
|
8094
8658
|
type: "object",
|
|
@@ -8215,7 +8779,7 @@ var fallbackInputSchema2 = {
|
|
|
8215
8779
|
additionalProperties: true
|
|
8216
8780
|
};
|
|
8217
8781
|
|
|
8218
|
-
class McpToolCallTask extends
|
|
8782
|
+
class McpToolCallTask extends Task29 {
|
|
8219
8783
|
static type = "McpToolCallTask";
|
|
8220
8784
|
static category = "MCP";
|
|
8221
8785
|
static title = "MCP Call Tool";
|
|
@@ -8223,6 +8787,29 @@ class McpToolCallTask extends Task27 {
|
|
|
8223
8787
|
static cacheable = false;
|
|
8224
8788
|
static customizable = true;
|
|
8225
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
|
+
}
|
|
8226
8813
|
static inputSchema() {
|
|
8227
8814
|
return fallbackInputSchema2;
|
|
8228
8815
|
}
|
|
@@ -8234,7 +8821,7 @@ class McpToolCallTask extends Task27 {
|
|
|
8234
8821
|
return {
|
|
8235
8822
|
type: "object",
|
|
8236
8823
|
properties: {
|
|
8237
|
-
...
|
|
8824
|
+
...TaskConfigSchema10["properties"],
|
|
8238
8825
|
server: TypeMcpServer(mcpServerConfigSchema2),
|
|
8239
8826
|
tool_name: {
|
|
8240
8827
|
type: "string",
|
|
@@ -8253,34 +8840,36 @@ class McpToolCallTask extends Task27 {
|
|
|
8253
8840
|
outputSchema() {
|
|
8254
8841
|
return this.config?.outputSchema ?? fallbackOutputSchema2;
|
|
8255
8842
|
}
|
|
8256
|
-
|
|
8843
|
+
_schemasDiscoveringPromise;
|
|
8257
8844
|
async discoverSchemas(_signal, serverConfig) {
|
|
8258
8845
|
if (this.config.inputSchema && this.config.outputSchema)
|
|
8259
8846
|
return;
|
|
8260
|
-
if (this.
|
|
8261
|
-
return;
|
|
8847
|
+
if (this._schemasDiscoveringPromise)
|
|
8848
|
+
return this._schemasDiscoveringPromise;
|
|
8262
8849
|
const resolved = serverConfig ?? getMcpServerConfig(this.config);
|
|
8263
8850
|
if (!resolved.transport || !this.config.tool_name)
|
|
8264
8851
|
return;
|
|
8265
|
-
this.
|
|
8266
|
-
|
|
8267
|
-
|
|
8268
|
-
|
|
8269
|
-
|
|
8270
|
-
|
|
8271
|
-
|
|
8272
|
-
|
|
8273
|
-
|
|
8274
|
-
|
|
8275
|
-
|
|
8276
|
-
|
|
8277
|
-
|
|
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();
|
|
8278
8867
|
}
|
|
8279
|
-
|
|
8868
|
+
} finally {
|
|
8869
|
+
this._schemasDiscoveringPromise = undefined;
|
|
8280
8870
|
}
|
|
8281
|
-
}
|
|
8282
|
-
|
|
8283
|
-
}
|
|
8871
|
+
})();
|
|
8872
|
+
return this._schemasDiscoveringPromise;
|
|
8284
8873
|
}
|
|
8285
8874
|
async execute(input2, context) {
|
|
8286
8875
|
const serverConfig = getMcpServerConfig(this.config);
|
|
@@ -8326,16 +8915,16 @@ class McpToolCallTask extends Task27 {
|
|
|
8326
8915
|
}
|
|
8327
8916
|
}
|
|
8328
8917
|
var mcpToolCall = async (input2, config) => {
|
|
8329
|
-
return new McpToolCallTask(
|
|
8918
|
+
return new McpToolCallTask(config).run(input2);
|
|
8330
8919
|
};
|
|
8331
|
-
|
|
8920
|
+
Workflow31.prototype.mcpToolCall = CreateWorkflow30(McpToolCallTask);
|
|
8332
8921
|
// src/task/string/StringConcatTask.ts
|
|
8333
8922
|
import {
|
|
8334
|
-
CreateWorkflow as
|
|
8335
|
-
Task as
|
|
8336
|
-
Workflow as
|
|
8923
|
+
CreateWorkflow as CreateWorkflow31,
|
|
8924
|
+
Task as Task30,
|
|
8925
|
+
Workflow as Workflow32
|
|
8337
8926
|
} from "@workglow/task-graph";
|
|
8338
|
-
var
|
|
8927
|
+
var inputSchema24 = {
|
|
8339
8928
|
type: "object",
|
|
8340
8929
|
properties: {},
|
|
8341
8930
|
additionalProperties: { type: "string" }
|
|
@@ -8353,13 +8942,13 @@ var outputSchema23 = {
|
|
|
8353
8942
|
additionalProperties: false
|
|
8354
8943
|
};
|
|
8355
8944
|
|
|
8356
|
-
class StringConcatTask extends
|
|
8945
|
+
class StringConcatTask extends Task30 {
|
|
8357
8946
|
static type = "StringConcatTask";
|
|
8358
8947
|
static category = "String";
|
|
8359
8948
|
static title = "Concat";
|
|
8360
8949
|
static description = "Concatenates all input strings";
|
|
8361
8950
|
static inputSchema() {
|
|
8362
|
-
return
|
|
8951
|
+
return inputSchema24;
|
|
8363
8952
|
}
|
|
8364
8953
|
static outputSchema() {
|
|
8365
8954
|
return outputSchema23;
|
|
@@ -8368,14 +8957,14 @@ class StringConcatTask extends Task28 {
|
|
|
8368
8957
|
return { result: Object.values(input2).join("") };
|
|
8369
8958
|
}
|
|
8370
8959
|
}
|
|
8371
|
-
|
|
8960
|
+
Workflow32.prototype.stringConcat = CreateWorkflow31(StringConcatTask);
|
|
8372
8961
|
// src/task/string/StringIncludesTask.ts
|
|
8373
8962
|
import {
|
|
8374
|
-
CreateWorkflow as
|
|
8375
|
-
Task as
|
|
8376
|
-
Workflow as
|
|
8963
|
+
CreateWorkflow as CreateWorkflow32,
|
|
8964
|
+
Task as Task31,
|
|
8965
|
+
Workflow as Workflow33
|
|
8377
8966
|
} from "@workglow/task-graph";
|
|
8378
|
-
var
|
|
8967
|
+
var inputSchema25 = {
|
|
8379
8968
|
type: "object",
|
|
8380
8969
|
properties: {
|
|
8381
8970
|
value: {
|
|
@@ -8405,13 +8994,13 @@ var outputSchema24 = {
|
|
|
8405
8994
|
additionalProperties: false
|
|
8406
8995
|
};
|
|
8407
8996
|
|
|
8408
|
-
class StringIncludesTask extends
|
|
8997
|
+
class StringIncludesTask extends Task31 {
|
|
8409
8998
|
static type = "StringIncludesTask";
|
|
8410
8999
|
static category = "String";
|
|
8411
9000
|
static title = "Includes";
|
|
8412
9001
|
static description = "Checks if a string contains a substring";
|
|
8413
9002
|
static inputSchema() {
|
|
8414
|
-
return
|
|
9003
|
+
return inputSchema25;
|
|
8415
9004
|
}
|
|
8416
9005
|
static outputSchema() {
|
|
8417
9006
|
return outputSchema24;
|
|
@@ -8420,14 +9009,14 @@ class StringIncludesTask extends Task29 {
|
|
|
8420
9009
|
return { result: input2.value.includes(input2.search) };
|
|
8421
9010
|
}
|
|
8422
9011
|
}
|
|
8423
|
-
|
|
9012
|
+
Workflow33.prototype.stringIncludes = CreateWorkflow32(StringIncludesTask);
|
|
8424
9013
|
// src/task/string/StringJoinTask.ts
|
|
8425
9014
|
import {
|
|
8426
|
-
CreateWorkflow as
|
|
8427
|
-
Task as
|
|
8428
|
-
Workflow as
|
|
9015
|
+
CreateWorkflow as CreateWorkflow33,
|
|
9016
|
+
Task as Task32,
|
|
9017
|
+
Workflow as Workflow34
|
|
8429
9018
|
} from "@workglow/task-graph";
|
|
8430
|
-
var
|
|
9019
|
+
var inputSchema26 = {
|
|
8431
9020
|
type: "object",
|
|
8432
9021
|
properties: {
|
|
8433
9022
|
values: {
|
|
@@ -8459,13 +9048,13 @@ var outputSchema25 = {
|
|
|
8459
9048
|
additionalProperties: false
|
|
8460
9049
|
};
|
|
8461
9050
|
|
|
8462
|
-
class StringJoinTask extends
|
|
9051
|
+
class StringJoinTask extends Task32 {
|
|
8463
9052
|
static type = "StringJoinTask";
|
|
8464
9053
|
static category = "String";
|
|
8465
9054
|
static title = "Join";
|
|
8466
9055
|
static description = "Joins an array of strings with a separator";
|
|
8467
9056
|
static inputSchema() {
|
|
8468
|
-
return
|
|
9057
|
+
return inputSchema26;
|
|
8469
9058
|
}
|
|
8470
9059
|
static outputSchema() {
|
|
8471
9060
|
return outputSchema25;
|
|
@@ -8475,14 +9064,14 @@ class StringJoinTask extends Task30 {
|
|
|
8475
9064
|
return { result: input2.values.join(separator) };
|
|
8476
9065
|
}
|
|
8477
9066
|
}
|
|
8478
|
-
|
|
9067
|
+
Workflow34.prototype.stringJoin = CreateWorkflow33(StringJoinTask);
|
|
8479
9068
|
// src/task/string/StringLengthTask.ts
|
|
8480
9069
|
import {
|
|
8481
|
-
CreateWorkflow as
|
|
8482
|
-
Task as
|
|
8483
|
-
Workflow as
|
|
9070
|
+
CreateWorkflow as CreateWorkflow34,
|
|
9071
|
+
Task as Task33,
|
|
9072
|
+
Workflow as Workflow35
|
|
8484
9073
|
} from "@workglow/task-graph";
|
|
8485
|
-
var
|
|
9074
|
+
var inputSchema27 = {
|
|
8486
9075
|
type: "object",
|
|
8487
9076
|
properties: {
|
|
8488
9077
|
value: {
|
|
@@ -8507,13 +9096,13 @@ var outputSchema26 = {
|
|
|
8507
9096
|
additionalProperties: false
|
|
8508
9097
|
};
|
|
8509
9098
|
|
|
8510
|
-
class StringLengthTask extends
|
|
9099
|
+
class StringLengthTask extends Task33 {
|
|
8511
9100
|
static type = "StringLengthTask";
|
|
8512
9101
|
static category = "String";
|
|
8513
9102
|
static title = "Length";
|
|
8514
9103
|
static description = "Returns the length of a string";
|
|
8515
9104
|
static inputSchema() {
|
|
8516
|
-
return
|
|
9105
|
+
return inputSchema27;
|
|
8517
9106
|
}
|
|
8518
9107
|
static outputSchema() {
|
|
8519
9108
|
return outputSchema26;
|
|
@@ -8522,14 +9111,14 @@ class StringLengthTask extends Task31 {
|
|
|
8522
9111
|
return { result: input2.value.length };
|
|
8523
9112
|
}
|
|
8524
9113
|
}
|
|
8525
|
-
|
|
9114
|
+
Workflow35.prototype.stringLength = CreateWorkflow34(StringLengthTask);
|
|
8526
9115
|
// src/task/string/StringLowerCaseTask.ts
|
|
8527
9116
|
import {
|
|
8528
|
-
CreateWorkflow as
|
|
8529
|
-
Task as
|
|
8530
|
-
Workflow as
|
|
9117
|
+
CreateWorkflow as CreateWorkflow35,
|
|
9118
|
+
Task as Task34,
|
|
9119
|
+
Workflow as Workflow36
|
|
8531
9120
|
} from "@workglow/task-graph";
|
|
8532
|
-
var
|
|
9121
|
+
var inputSchema28 = {
|
|
8533
9122
|
type: "object",
|
|
8534
9123
|
properties: {
|
|
8535
9124
|
value: {
|
|
@@ -8554,13 +9143,13 @@ var outputSchema27 = {
|
|
|
8554
9143
|
additionalProperties: false
|
|
8555
9144
|
};
|
|
8556
9145
|
|
|
8557
|
-
class StringLowerCaseTask extends
|
|
9146
|
+
class StringLowerCaseTask extends Task34 {
|
|
8558
9147
|
static type = "StringLowerCaseTask";
|
|
8559
9148
|
static category = "String";
|
|
8560
9149
|
static title = "Lower Case";
|
|
8561
9150
|
static description = "Converts a string to lower case";
|
|
8562
9151
|
static inputSchema() {
|
|
8563
|
-
return
|
|
9152
|
+
return inputSchema28;
|
|
8564
9153
|
}
|
|
8565
9154
|
static outputSchema() {
|
|
8566
9155
|
return outputSchema27;
|
|
@@ -8569,14 +9158,14 @@ class StringLowerCaseTask extends Task32 {
|
|
|
8569
9158
|
return { result: input2.value.toLowerCase() };
|
|
8570
9159
|
}
|
|
8571
9160
|
}
|
|
8572
|
-
|
|
9161
|
+
Workflow36.prototype.stringLowerCase = CreateWorkflow35(StringLowerCaseTask);
|
|
8573
9162
|
// src/task/string/StringReplaceTask.ts
|
|
8574
9163
|
import {
|
|
8575
|
-
CreateWorkflow as
|
|
8576
|
-
Task as
|
|
8577
|
-
Workflow as
|
|
9164
|
+
CreateWorkflow as CreateWorkflow36,
|
|
9165
|
+
Task as Task35,
|
|
9166
|
+
Workflow as Workflow37
|
|
8578
9167
|
} from "@workglow/task-graph";
|
|
8579
|
-
var
|
|
9168
|
+
var inputSchema29 = {
|
|
8580
9169
|
type: "object",
|
|
8581
9170
|
properties: {
|
|
8582
9171
|
value: {
|
|
@@ -8611,13 +9200,13 @@ var outputSchema28 = {
|
|
|
8611
9200
|
additionalProperties: false
|
|
8612
9201
|
};
|
|
8613
9202
|
|
|
8614
|
-
class StringReplaceTask extends
|
|
9203
|
+
class StringReplaceTask extends Task35 {
|
|
8615
9204
|
static type = "StringReplaceTask";
|
|
8616
9205
|
static category = "String";
|
|
8617
9206
|
static title = "Replace";
|
|
8618
9207
|
static description = "Replaces all occurrences of a substring";
|
|
8619
9208
|
static inputSchema() {
|
|
8620
|
-
return
|
|
9209
|
+
return inputSchema29;
|
|
8621
9210
|
}
|
|
8622
9211
|
static outputSchema() {
|
|
8623
9212
|
return outputSchema28;
|
|
@@ -8626,14 +9215,14 @@ class StringReplaceTask extends Task33 {
|
|
|
8626
9215
|
return { result: input2.value.replaceAll(input2.search, input2.replace) };
|
|
8627
9216
|
}
|
|
8628
9217
|
}
|
|
8629
|
-
|
|
9218
|
+
Workflow37.prototype.stringReplace = CreateWorkflow36(StringReplaceTask);
|
|
8630
9219
|
// src/task/string/StringSliceTask.ts
|
|
8631
9220
|
import {
|
|
8632
|
-
CreateWorkflow as
|
|
8633
|
-
Task as
|
|
8634
|
-
Workflow as
|
|
9221
|
+
CreateWorkflow as CreateWorkflow37,
|
|
9222
|
+
Task as Task36,
|
|
9223
|
+
Workflow as Workflow38
|
|
8635
9224
|
} from "@workglow/task-graph";
|
|
8636
|
-
var
|
|
9225
|
+
var inputSchema30 = {
|
|
8637
9226
|
type: "object",
|
|
8638
9227
|
properties: {
|
|
8639
9228
|
value: {
|
|
@@ -8668,13 +9257,13 @@ var outputSchema29 = {
|
|
|
8668
9257
|
additionalProperties: false
|
|
8669
9258
|
};
|
|
8670
9259
|
|
|
8671
|
-
class StringSliceTask extends
|
|
9260
|
+
class StringSliceTask extends Task36 {
|
|
8672
9261
|
static type = "StringSliceTask";
|
|
8673
9262
|
static category = "String";
|
|
8674
9263
|
static title = "Slice";
|
|
8675
9264
|
static description = "Extracts a substring by start and optional end index";
|
|
8676
9265
|
static inputSchema() {
|
|
8677
|
-
return
|
|
9266
|
+
return inputSchema30;
|
|
8678
9267
|
}
|
|
8679
9268
|
static outputSchema() {
|
|
8680
9269
|
return outputSchema29;
|
|
@@ -8683,14 +9272,14 @@ class StringSliceTask extends Task34 {
|
|
|
8683
9272
|
return { result: input2.value.slice(input2.start, input2.end) };
|
|
8684
9273
|
}
|
|
8685
9274
|
}
|
|
8686
|
-
|
|
9275
|
+
Workflow38.prototype.stringSlice = CreateWorkflow37(StringSliceTask);
|
|
8687
9276
|
// src/task/string/StringTemplateTask.ts
|
|
8688
9277
|
import {
|
|
8689
|
-
CreateWorkflow as
|
|
8690
|
-
Task as
|
|
8691
|
-
Workflow as
|
|
9278
|
+
CreateWorkflow as CreateWorkflow38,
|
|
9279
|
+
Task as Task37,
|
|
9280
|
+
Workflow as Workflow39
|
|
8692
9281
|
} from "@workglow/task-graph";
|
|
8693
|
-
var
|
|
9282
|
+
var inputSchema31 = {
|
|
8694
9283
|
type: "object",
|
|
8695
9284
|
properties: {
|
|
8696
9285
|
template: {
|
|
@@ -8721,13 +9310,13 @@ var outputSchema30 = {
|
|
|
8721
9310
|
additionalProperties: false
|
|
8722
9311
|
};
|
|
8723
9312
|
|
|
8724
|
-
class StringTemplateTask extends
|
|
9313
|
+
class StringTemplateTask extends Task37 {
|
|
8725
9314
|
static type = "StringTemplateTask";
|
|
8726
9315
|
static category = "String";
|
|
8727
9316
|
static title = "Template";
|
|
8728
9317
|
static description = "Replaces {{key}} placeholders in a template string with values";
|
|
8729
9318
|
static inputSchema() {
|
|
8730
|
-
return
|
|
9319
|
+
return inputSchema31;
|
|
8731
9320
|
}
|
|
8732
9321
|
static outputSchema() {
|
|
8733
9322
|
return outputSchema30;
|
|
@@ -8740,14 +9329,14 @@ class StringTemplateTask extends Task35 {
|
|
|
8740
9329
|
return { result };
|
|
8741
9330
|
}
|
|
8742
9331
|
}
|
|
8743
|
-
|
|
9332
|
+
Workflow39.prototype.stringTemplate = CreateWorkflow38(StringTemplateTask);
|
|
8744
9333
|
// src/task/string/StringTrimTask.ts
|
|
8745
9334
|
import {
|
|
8746
|
-
CreateWorkflow as
|
|
8747
|
-
Task as
|
|
8748
|
-
Workflow as
|
|
9335
|
+
CreateWorkflow as CreateWorkflow39,
|
|
9336
|
+
Task as Task38,
|
|
9337
|
+
Workflow as Workflow40
|
|
8749
9338
|
} from "@workglow/task-graph";
|
|
8750
|
-
var
|
|
9339
|
+
var inputSchema32 = {
|
|
8751
9340
|
type: "object",
|
|
8752
9341
|
properties: {
|
|
8753
9342
|
value: {
|
|
@@ -8772,13 +9361,13 @@ var outputSchema31 = {
|
|
|
8772
9361
|
additionalProperties: false
|
|
8773
9362
|
};
|
|
8774
9363
|
|
|
8775
|
-
class StringTrimTask extends
|
|
9364
|
+
class StringTrimTask extends Task38 {
|
|
8776
9365
|
static type = "StringTrimTask";
|
|
8777
9366
|
static category = "String";
|
|
8778
9367
|
static title = "Trim";
|
|
8779
9368
|
static description = "Removes leading and trailing whitespace from a string";
|
|
8780
9369
|
static inputSchema() {
|
|
8781
|
-
return
|
|
9370
|
+
return inputSchema32;
|
|
8782
9371
|
}
|
|
8783
9372
|
static outputSchema() {
|
|
8784
9373
|
return outputSchema31;
|
|
@@ -8787,14 +9376,14 @@ class StringTrimTask extends Task36 {
|
|
|
8787
9376
|
return { result: input2.value.trim() };
|
|
8788
9377
|
}
|
|
8789
9378
|
}
|
|
8790
|
-
|
|
9379
|
+
Workflow40.prototype.stringTrim = CreateWorkflow39(StringTrimTask);
|
|
8791
9380
|
// src/task/string/StringUpperCaseTask.ts
|
|
8792
9381
|
import {
|
|
8793
|
-
CreateWorkflow as
|
|
8794
|
-
Task as
|
|
8795
|
-
Workflow as
|
|
9382
|
+
CreateWorkflow as CreateWorkflow40,
|
|
9383
|
+
Task as Task39,
|
|
9384
|
+
Workflow as Workflow41
|
|
8796
9385
|
} from "@workglow/task-graph";
|
|
8797
|
-
var
|
|
9386
|
+
var inputSchema33 = {
|
|
8798
9387
|
type: "object",
|
|
8799
9388
|
properties: {
|
|
8800
9389
|
value: {
|
|
@@ -8819,13 +9408,13 @@ var outputSchema32 = {
|
|
|
8819
9408
|
additionalProperties: false
|
|
8820
9409
|
};
|
|
8821
9410
|
|
|
8822
|
-
class StringUpperCaseTask extends
|
|
9411
|
+
class StringUpperCaseTask extends Task39 {
|
|
8823
9412
|
static type = "StringUpperCaseTask";
|
|
8824
9413
|
static category = "String";
|
|
8825
9414
|
static title = "Upper Case";
|
|
8826
9415
|
static description = "Converts a string to upper case";
|
|
8827
9416
|
static inputSchema() {
|
|
8828
|
-
return
|
|
9417
|
+
return inputSchema33;
|
|
8829
9418
|
}
|
|
8830
9419
|
static outputSchema() {
|
|
8831
9420
|
return outputSchema32;
|
|
@@ -8834,10 +9423,10 @@ class StringUpperCaseTask extends Task37 {
|
|
|
8834
9423
|
return { result: input2.value.toUpperCase() };
|
|
8835
9424
|
}
|
|
8836
9425
|
}
|
|
8837
|
-
|
|
9426
|
+
Workflow41.prototype.stringUpperCase = CreateWorkflow40(StringUpperCaseTask);
|
|
8838
9427
|
// src/task/scalar/ScalarAbsTask.ts
|
|
8839
|
-
import { CreateWorkflow as
|
|
8840
|
-
var
|
|
9428
|
+
import { CreateWorkflow as CreateWorkflow41, Task as Task40, Workflow as Workflow42 } from "@workglow/task-graph";
|
|
9429
|
+
var inputSchema34 = {
|
|
8841
9430
|
type: "object",
|
|
8842
9431
|
properties: {
|
|
8843
9432
|
value: {
|
|
@@ -8862,13 +9451,13 @@ var outputSchema33 = {
|
|
|
8862
9451
|
additionalProperties: false
|
|
8863
9452
|
};
|
|
8864
9453
|
|
|
8865
|
-
class ScalarAbsTask extends
|
|
9454
|
+
class ScalarAbsTask extends Task40 {
|
|
8866
9455
|
static type = "ScalarAbsTask";
|
|
8867
9456
|
static category = "Math";
|
|
8868
9457
|
static title = "Abs";
|
|
8869
9458
|
static description = "Returns the absolute value of a number";
|
|
8870
9459
|
static inputSchema() {
|
|
8871
|
-
return
|
|
9460
|
+
return inputSchema34;
|
|
8872
9461
|
}
|
|
8873
9462
|
static outputSchema() {
|
|
8874
9463
|
return outputSchema33;
|
|
@@ -8877,10 +9466,10 @@ class ScalarAbsTask extends Task38 {
|
|
|
8877
9466
|
return { result: Math.abs(input2.value) };
|
|
8878
9467
|
}
|
|
8879
9468
|
}
|
|
8880
|
-
|
|
9469
|
+
Workflow42.prototype.scalarAbs = CreateWorkflow41(ScalarAbsTask);
|
|
8881
9470
|
// src/task/scalar/ScalarCeilTask.ts
|
|
8882
|
-
import { CreateWorkflow as
|
|
8883
|
-
var
|
|
9471
|
+
import { CreateWorkflow as CreateWorkflow42, Task as Task41, Workflow as Workflow43 } from "@workglow/task-graph";
|
|
9472
|
+
var inputSchema35 = {
|
|
8884
9473
|
type: "object",
|
|
8885
9474
|
properties: {
|
|
8886
9475
|
value: {
|
|
@@ -8905,13 +9494,13 @@ var outputSchema34 = {
|
|
|
8905
9494
|
additionalProperties: false
|
|
8906
9495
|
};
|
|
8907
9496
|
|
|
8908
|
-
class ScalarCeilTask extends
|
|
9497
|
+
class ScalarCeilTask extends Task41 {
|
|
8909
9498
|
static type = "ScalarCeilTask";
|
|
8910
9499
|
static category = "Math";
|
|
8911
9500
|
static title = "Ceil";
|
|
8912
9501
|
static description = "Returns the smallest integer greater than or equal to a number";
|
|
8913
9502
|
static inputSchema() {
|
|
8914
|
-
return
|
|
9503
|
+
return inputSchema35;
|
|
8915
9504
|
}
|
|
8916
9505
|
static outputSchema() {
|
|
8917
9506
|
return outputSchema34;
|
|
@@ -8920,10 +9509,10 @@ class ScalarCeilTask extends Task39 {
|
|
|
8920
9509
|
return { result: Math.ceil(input2.value) };
|
|
8921
9510
|
}
|
|
8922
9511
|
}
|
|
8923
|
-
|
|
9512
|
+
Workflow43.prototype.scalarCeil = CreateWorkflow42(ScalarCeilTask);
|
|
8924
9513
|
// src/task/scalar/ScalarFloorTask.ts
|
|
8925
|
-
import { CreateWorkflow as
|
|
8926
|
-
var
|
|
9514
|
+
import { CreateWorkflow as CreateWorkflow43, Task as Task42, Workflow as Workflow44 } from "@workglow/task-graph";
|
|
9515
|
+
var inputSchema36 = {
|
|
8927
9516
|
type: "object",
|
|
8928
9517
|
properties: {
|
|
8929
9518
|
value: {
|
|
@@ -8948,13 +9537,13 @@ var outputSchema35 = {
|
|
|
8948
9537
|
additionalProperties: false
|
|
8949
9538
|
};
|
|
8950
9539
|
|
|
8951
|
-
class ScalarFloorTask extends
|
|
9540
|
+
class ScalarFloorTask extends Task42 {
|
|
8952
9541
|
static type = "ScalarFloorTask";
|
|
8953
9542
|
static category = "Math";
|
|
8954
9543
|
static title = "Floor";
|
|
8955
9544
|
static description = "Returns the largest integer less than or equal to a number";
|
|
8956
9545
|
static inputSchema() {
|
|
8957
|
-
return
|
|
9546
|
+
return inputSchema36;
|
|
8958
9547
|
}
|
|
8959
9548
|
static outputSchema() {
|
|
8960
9549
|
return outputSchema35;
|
|
@@ -8963,10 +9552,10 @@ class ScalarFloorTask extends Task40 {
|
|
|
8963
9552
|
return { result: Math.floor(input2.value) };
|
|
8964
9553
|
}
|
|
8965
9554
|
}
|
|
8966
|
-
|
|
9555
|
+
Workflow44.prototype.scalarFloor = CreateWorkflow43(ScalarFloorTask);
|
|
8967
9556
|
// src/task/scalar/ScalarMaxTask.ts
|
|
8968
|
-
import { CreateWorkflow as
|
|
8969
|
-
var
|
|
9557
|
+
import { CreateWorkflow as CreateWorkflow44, Task as Task43, Workflow as Workflow45 } from "@workglow/task-graph";
|
|
9558
|
+
var inputSchema37 = {
|
|
8970
9559
|
type: "object",
|
|
8971
9560
|
properties: {
|
|
8972
9561
|
values: {
|
|
@@ -8992,13 +9581,13 @@ var outputSchema36 = {
|
|
|
8992
9581
|
additionalProperties: false
|
|
8993
9582
|
};
|
|
8994
9583
|
|
|
8995
|
-
class ScalarMaxTask extends
|
|
9584
|
+
class ScalarMaxTask extends Task43 {
|
|
8996
9585
|
static type = "ScalarMaxTask";
|
|
8997
9586
|
static category = "Math";
|
|
8998
9587
|
static title = "Max";
|
|
8999
9588
|
static description = "Returns the largest of the given numbers";
|
|
9000
9589
|
static inputSchema() {
|
|
9001
|
-
return
|
|
9590
|
+
return inputSchema37;
|
|
9002
9591
|
}
|
|
9003
9592
|
static outputSchema() {
|
|
9004
9593
|
return outputSchema36;
|
|
@@ -9007,10 +9596,10 @@ class ScalarMaxTask extends Task41 {
|
|
|
9007
9596
|
return { result: Math.max(...input2.values) };
|
|
9008
9597
|
}
|
|
9009
9598
|
}
|
|
9010
|
-
|
|
9599
|
+
Workflow45.prototype.scalarMax = CreateWorkflow44(ScalarMaxTask);
|
|
9011
9600
|
// src/task/scalar/ScalarMinTask.ts
|
|
9012
|
-
import { CreateWorkflow as
|
|
9013
|
-
var
|
|
9601
|
+
import { CreateWorkflow as CreateWorkflow45, Task as Task44, Workflow as Workflow46 } from "@workglow/task-graph";
|
|
9602
|
+
var inputSchema38 = {
|
|
9014
9603
|
type: "object",
|
|
9015
9604
|
properties: {
|
|
9016
9605
|
values: {
|
|
@@ -9036,13 +9625,13 @@ var outputSchema37 = {
|
|
|
9036
9625
|
additionalProperties: false
|
|
9037
9626
|
};
|
|
9038
9627
|
|
|
9039
|
-
class ScalarMinTask extends
|
|
9628
|
+
class ScalarMinTask extends Task44 {
|
|
9040
9629
|
static type = "ScalarMinTask";
|
|
9041
9630
|
static category = "Math";
|
|
9042
9631
|
static title = "Min";
|
|
9043
9632
|
static description = "Returns the smallest of the given numbers";
|
|
9044
9633
|
static inputSchema() {
|
|
9045
|
-
return
|
|
9634
|
+
return inputSchema38;
|
|
9046
9635
|
}
|
|
9047
9636
|
static outputSchema() {
|
|
9048
9637
|
return outputSchema37;
|
|
@@ -9051,10 +9640,10 @@ class ScalarMinTask extends Task42 {
|
|
|
9051
9640
|
return { result: Math.min(...input2.values) };
|
|
9052
9641
|
}
|
|
9053
9642
|
}
|
|
9054
|
-
|
|
9643
|
+
Workflow46.prototype.scalarMin = CreateWorkflow45(ScalarMinTask);
|
|
9055
9644
|
// src/task/scalar/ScalarRoundTask.ts
|
|
9056
|
-
import { CreateWorkflow as
|
|
9057
|
-
var
|
|
9645
|
+
import { CreateWorkflow as CreateWorkflow46, Task as Task45, Workflow as Workflow47 } from "@workglow/task-graph";
|
|
9646
|
+
var inputSchema39 = {
|
|
9058
9647
|
type: "object",
|
|
9059
9648
|
properties: {
|
|
9060
9649
|
value: {
|
|
@@ -9079,13 +9668,13 @@ var outputSchema38 = {
|
|
|
9079
9668
|
additionalProperties: false
|
|
9080
9669
|
};
|
|
9081
9670
|
|
|
9082
|
-
class ScalarRoundTask extends
|
|
9671
|
+
class ScalarRoundTask extends Task45 {
|
|
9083
9672
|
static type = "ScalarRoundTask";
|
|
9084
9673
|
static category = "Math";
|
|
9085
9674
|
static title = "Round";
|
|
9086
9675
|
static description = "Returns the value of a number rounded to the nearest integer";
|
|
9087
9676
|
static inputSchema() {
|
|
9088
|
-
return
|
|
9677
|
+
return inputSchema39;
|
|
9089
9678
|
}
|
|
9090
9679
|
static outputSchema() {
|
|
9091
9680
|
return outputSchema38;
|
|
@@ -9094,10 +9683,10 @@ class ScalarRoundTask extends Task43 {
|
|
|
9094
9683
|
return { result: Math.round(input2.value) };
|
|
9095
9684
|
}
|
|
9096
9685
|
}
|
|
9097
|
-
|
|
9686
|
+
Workflow47.prototype.scalarRound = CreateWorkflow46(ScalarRoundTask);
|
|
9098
9687
|
// src/task/scalar/ScalarTruncTask.ts
|
|
9099
|
-
import { CreateWorkflow as
|
|
9100
|
-
var
|
|
9688
|
+
import { CreateWorkflow as CreateWorkflow47, Task as Task46, Workflow as Workflow48 } from "@workglow/task-graph";
|
|
9689
|
+
var inputSchema40 = {
|
|
9101
9690
|
type: "object",
|
|
9102
9691
|
properties: {
|
|
9103
9692
|
value: {
|
|
@@ -9122,13 +9711,13 @@ var outputSchema39 = {
|
|
|
9122
9711
|
additionalProperties: false
|
|
9123
9712
|
};
|
|
9124
9713
|
|
|
9125
|
-
class ScalarTruncTask extends
|
|
9714
|
+
class ScalarTruncTask extends Task46 {
|
|
9126
9715
|
static type = "ScalarTruncTask";
|
|
9127
9716
|
static category = "Math";
|
|
9128
9717
|
static title = "Truncate";
|
|
9129
9718
|
static description = "Returns the integer part of a number by removing fractional digits";
|
|
9130
9719
|
static inputSchema() {
|
|
9131
|
-
return
|
|
9720
|
+
return inputSchema40;
|
|
9132
9721
|
}
|
|
9133
9722
|
static outputSchema() {
|
|
9134
9723
|
return outputSchema39;
|
|
@@ -9137,13 +9726,13 @@ class ScalarTruncTask extends Task44 {
|
|
|
9137
9726
|
return { result: Math.trunc(input2.value) };
|
|
9138
9727
|
}
|
|
9139
9728
|
}
|
|
9140
|
-
|
|
9729
|
+
Workflow48.prototype.scalarTrunc = CreateWorkflow47(ScalarTruncTask);
|
|
9141
9730
|
// src/task/vector/VectorDistanceTask.ts
|
|
9142
|
-
import { CreateWorkflow as
|
|
9731
|
+
import { CreateWorkflow as CreateWorkflow48, Task as Task47, Workflow as Workflow49 } from "@workglow/task-graph";
|
|
9143
9732
|
import {
|
|
9144
9733
|
TypedArraySchema as TypedArraySchema5
|
|
9145
9734
|
} from "@workglow/util/schema";
|
|
9146
|
-
var
|
|
9735
|
+
var inputSchema41 = {
|
|
9147
9736
|
type: "object",
|
|
9148
9737
|
properties: {
|
|
9149
9738
|
vectors: {
|
|
@@ -9172,13 +9761,13 @@ var outputSchema40 = {
|
|
|
9172
9761
|
additionalProperties: false
|
|
9173
9762
|
};
|
|
9174
9763
|
|
|
9175
|
-
class VectorDistanceTask extends
|
|
9764
|
+
class VectorDistanceTask extends Task47 {
|
|
9176
9765
|
static type = "VectorDistanceTask";
|
|
9177
9766
|
static category = "Vector";
|
|
9178
9767
|
static title = "Distance";
|
|
9179
9768
|
static description = "Returns the Euclidean distance between the first two vectors";
|
|
9180
9769
|
static inputSchema() {
|
|
9181
|
-
return
|
|
9770
|
+
return inputSchema41;
|
|
9182
9771
|
}
|
|
9183
9772
|
static outputSchema() {
|
|
9184
9773
|
return outputSchema40;
|
|
@@ -9199,13 +9788,13 @@ class VectorDistanceTask extends Task45 {
|
|
|
9199
9788
|
return { result: Math.sqrt(sumPrecise(diffs)) };
|
|
9200
9789
|
}
|
|
9201
9790
|
}
|
|
9202
|
-
|
|
9791
|
+
Workflow49.prototype.vectorDistance = CreateWorkflow48(VectorDistanceTask);
|
|
9203
9792
|
// src/task/vector/VectorDotProductTask.ts
|
|
9204
|
-
import { CreateWorkflow as
|
|
9793
|
+
import { CreateWorkflow as CreateWorkflow49, Task as Task48, Workflow as Workflow50 } from "@workglow/task-graph";
|
|
9205
9794
|
import {
|
|
9206
9795
|
TypedArraySchema as TypedArraySchema6
|
|
9207
9796
|
} from "@workglow/util/schema";
|
|
9208
|
-
var
|
|
9797
|
+
var inputSchema42 = {
|
|
9209
9798
|
type: "object",
|
|
9210
9799
|
properties: {
|
|
9211
9800
|
vectors: {
|
|
@@ -9234,13 +9823,13 @@ var outputSchema41 = {
|
|
|
9234
9823
|
additionalProperties: false
|
|
9235
9824
|
};
|
|
9236
9825
|
|
|
9237
|
-
class VectorDotProductTask extends
|
|
9826
|
+
class VectorDotProductTask extends Task48 {
|
|
9238
9827
|
static type = "VectorDotProductTask";
|
|
9239
9828
|
static category = "Vector";
|
|
9240
9829
|
static title = "Dot Product";
|
|
9241
9830
|
static description = "Returns the dot (inner) product of the first two vectors";
|
|
9242
9831
|
static inputSchema() {
|
|
9243
|
-
return
|
|
9832
|
+
return inputSchema42;
|
|
9244
9833
|
}
|
|
9245
9834
|
static outputSchema() {
|
|
9246
9835
|
return outputSchema41;
|
|
@@ -9258,14 +9847,14 @@ class VectorDotProductTask extends Task46 {
|
|
|
9258
9847
|
return { result: sumPrecise(products) };
|
|
9259
9848
|
}
|
|
9260
9849
|
}
|
|
9261
|
-
|
|
9850
|
+
Workflow50.prototype.vectorDotProduct = CreateWorkflow49(VectorDotProductTask);
|
|
9262
9851
|
// src/task/vector/VectorNormalizeTask.ts
|
|
9263
|
-
import { CreateWorkflow as
|
|
9852
|
+
import { CreateWorkflow as CreateWorkflow50, Task as Task49, Workflow as Workflow51 } from "@workglow/task-graph";
|
|
9264
9853
|
import {
|
|
9265
9854
|
TypedArraySchema as TypedArraySchema7,
|
|
9266
9855
|
normalize
|
|
9267
9856
|
} from "@workglow/util/schema";
|
|
9268
|
-
var
|
|
9857
|
+
var inputSchema43 = {
|
|
9269
9858
|
type: "object",
|
|
9270
9859
|
properties: {
|
|
9271
9860
|
vector: TypedArraySchema7({
|
|
@@ -9288,13 +9877,13 @@ var outputSchema42 = {
|
|
|
9288
9877
|
additionalProperties: false
|
|
9289
9878
|
};
|
|
9290
9879
|
|
|
9291
|
-
class VectorNormalizeTask extends
|
|
9880
|
+
class VectorNormalizeTask extends Task49 {
|
|
9292
9881
|
static type = "VectorNormalizeTask";
|
|
9293
9882
|
static category = "Vector";
|
|
9294
9883
|
static title = "Normalize";
|
|
9295
9884
|
static description = "Returns the L2-normalized (unit length) vector";
|
|
9296
9885
|
static inputSchema() {
|
|
9297
|
-
return
|
|
9886
|
+
return inputSchema43;
|
|
9298
9887
|
}
|
|
9299
9888
|
static outputSchema() {
|
|
9300
9889
|
return outputSchema42;
|
|
@@ -9303,14 +9892,14 @@ class VectorNormalizeTask extends Task47 {
|
|
|
9303
9892
|
return { result: normalize(input2.vector) };
|
|
9304
9893
|
}
|
|
9305
9894
|
}
|
|
9306
|
-
|
|
9895
|
+
Workflow51.prototype.vectorNormalize = CreateWorkflow50(VectorNormalizeTask);
|
|
9307
9896
|
// src/task/vector/VectorScaleTask.ts
|
|
9308
|
-
import { CreateWorkflow as
|
|
9897
|
+
import { CreateWorkflow as CreateWorkflow51, Task as Task50, Workflow as Workflow52 } from "@workglow/task-graph";
|
|
9309
9898
|
import {
|
|
9310
9899
|
createTypedArrayFrom as createTypedArrayFrom5,
|
|
9311
9900
|
TypedArraySchema as TypedArraySchema8
|
|
9312
9901
|
} from "@workglow/util/schema";
|
|
9313
|
-
var
|
|
9902
|
+
var inputSchema44 = {
|
|
9314
9903
|
type: "object",
|
|
9315
9904
|
properties: {
|
|
9316
9905
|
vector: TypedArraySchema8({
|
|
@@ -9338,13 +9927,13 @@ var outputSchema43 = {
|
|
|
9338
9927
|
additionalProperties: false
|
|
9339
9928
|
};
|
|
9340
9929
|
|
|
9341
|
-
class VectorScaleTask extends
|
|
9930
|
+
class VectorScaleTask extends Task50 {
|
|
9342
9931
|
static type = "VectorScaleTask";
|
|
9343
9932
|
static category = "Vector";
|
|
9344
9933
|
static title = "Scale";
|
|
9345
9934
|
static description = "Multiplies each element of a vector by a scalar";
|
|
9346
9935
|
static inputSchema() {
|
|
9347
|
-
return
|
|
9936
|
+
return inputSchema44;
|
|
9348
9937
|
}
|
|
9349
9938
|
static outputSchema() {
|
|
9350
9939
|
return outputSchema43;
|
|
@@ -9355,7 +9944,1224 @@ class VectorScaleTask extends Task48 {
|
|
|
9355
9944
|
return { result: createTypedArrayFrom5([vector], values) };
|
|
9356
9945
|
}
|
|
9357
9946
|
}
|
|
9358
|
-
|
|
9947
|
+
Workflow52.prototype.vectorScale = CreateWorkflow51(VectorScaleTask);
|
|
9948
|
+
// src/task/image/ImageSchemas.ts
|
|
9949
|
+
import { FromSchemaDefaultOptions } from "@workglow/util/schema";
|
|
9950
|
+
var ImageBinaryType = null;
|
|
9951
|
+
var ImageBinarySchemaOptions = {
|
|
9952
|
+
...FromSchemaDefaultOptions,
|
|
9953
|
+
deserialize: [
|
|
9954
|
+
{
|
|
9955
|
+
pattern: { type: "object", format: "image:ImageBinary" },
|
|
9956
|
+
output: ImageBinaryType
|
|
9957
|
+
}
|
|
9958
|
+
]
|
|
9959
|
+
};
|
|
9960
|
+
var ImageBinarySchema = (annotations = {}) => ({
|
|
9961
|
+
type: "object",
|
|
9962
|
+
properties: {
|
|
9963
|
+
data: {
|
|
9964
|
+
type: "array",
|
|
9965
|
+
items: { type: "number", format: "Uint8Clamped" },
|
|
9966
|
+
format: "Uint8ClampedArray",
|
|
9967
|
+
title: "Data",
|
|
9968
|
+
description: "Pixel data of the image"
|
|
9969
|
+
},
|
|
9970
|
+
width: {
|
|
9971
|
+
type: "integer",
|
|
9972
|
+
minimum: 1,
|
|
9973
|
+
title: "Width",
|
|
9974
|
+
description: "Width in pixels"
|
|
9975
|
+
},
|
|
9976
|
+
height: {
|
|
9977
|
+
type: "integer",
|
|
9978
|
+
minimum: 1,
|
|
9979
|
+
title: "Height",
|
|
9980
|
+
description: "Height in pixels"
|
|
9981
|
+
},
|
|
9982
|
+
channels: {
|
|
9983
|
+
type: "integer",
|
|
9984
|
+
enum: [1, 3, 4],
|
|
9985
|
+
title: "Channels",
|
|
9986
|
+
description: "1 (gray), 3 (RGB), or 4 (RGBA)"
|
|
9987
|
+
}
|
|
9988
|
+
},
|
|
9989
|
+
additionalProperties: false,
|
|
9990
|
+
required: ["data", "width", "height", "channels"],
|
|
9991
|
+
format: "image:ImageBinary",
|
|
9992
|
+
title: "Image",
|
|
9993
|
+
description: "Raw pixel image data",
|
|
9994
|
+
...annotations
|
|
9995
|
+
});
|
|
9996
|
+
var ColorSchema = (annotations = {}) => ({
|
|
9997
|
+
type: "object",
|
|
9998
|
+
properties: {
|
|
9999
|
+
r: { type: "integer", minimum: 0, maximum: 255, title: "Red" },
|
|
10000
|
+
g: { type: "integer", minimum: 0, maximum: 255, title: "Green" },
|
|
10001
|
+
b: { type: "integer", minimum: 0, maximum: 255, title: "Blue" },
|
|
10002
|
+
a: { type: "integer", minimum: 0, maximum: 255, title: "Alpha", default: 255 }
|
|
10003
|
+
},
|
|
10004
|
+
required: ["r", "g", "b"],
|
|
10005
|
+
additionalProperties: false,
|
|
10006
|
+
...annotations
|
|
10007
|
+
});
|
|
10008
|
+
// src/task/image/ImageResizeTask.ts
|
|
10009
|
+
import {
|
|
10010
|
+
CreateWorkflow as CreateWorkflow52,
|
|
10011
|
+
Task as Task51,
|
|
10012
|
+
Workflow as Workflow53
|
|
10013
|
+
} from "@workglow/task-graph";
|
|
10014
|
+
var inputSchema45 = {
|
|
10015
|
+
type: "object",
|
|
10016
|
+
properties: {
|
|
10017
|
+
image: ImageBinarySchema({ title: "Image", description: "Source image" }),
|
|
10018
|
+
width: { type: "integer", title: "Width", description: "Target width in pixels", minimum: 1 },
|
|
10019
|
+
height: {
|
|
10020
|
+
type: "integer",
|
|
10021
|
+
title: "Height",
|
|
10022
|
+
description: "Target height in pixels",
|
|
10023
|
+
minimum: 1
|
|
10024
|
+
}
|
|
10025
|
+
},
|
|
10026
|
+
required: ["image", "width", "height"],
|
|
10027
|
+
additionalProperties: false
|
|
10028
|
+
};
|
|
10029
|
+
var outputSchema44 = {
|
|
10030
|
+
type: "object",
|
|
10031
|
+
properties: {
|
|
10032
|
+
image: ImageBinarySchema({ title: "Image", description: "Resized image" })
|
|
10033
|
+
},
|
|
10034
|
+
required: ["image"],
|
|
10035
|
+
additionalProperties: false
|
|
10036
|
+
};
|
|
10037
|
+
|
|
10038
|
+
class ImageResizeTask extends Task51 {
|
|
10039
|
+
static type = "ImageResizeTask";
|
|
10040
|
+
static category = "Image";
|
|
10041
|
+
static title = "Resize Image";
|
|
10042
|
+
static description = "Resizes an image using nearest-neighbor sampling";
|
|
10043
|
+
static inputSchema() {
|
|
10044
|
+
return inputSchema45;
|
|
10045
|
+
}
|
|
10046
|
+
static outputSchema() {
|
|
10047
|
+
return outputSchema44;
|
|
10048
|
+
}
|
|
10049
|
+
async executeReactive(input2, _output, _context) {
|
|
10050
|
+
const { image, width: dstW, height: dstH } = input2;
|
|
10051
|
+
const { data: src, width: srcW, height: srcH, channels } = image;
|
|
10052
|
+
const dst = new Uint8ClampedArray(dstW * dstH * channels);
|
|
10053
|
+
for (let dy = 0;dy < dstH; dy++) {
|
|
10054
|
+
const srcY = Math.min(Math.floor(dy * srcH / dstH), srcH - 1);
|
|
10055
|
+
for (let dx = 0;dx < dstW; dx++) {
|
|
10056
|
+
const srcX = Math.min(Math.floor(dx * srcW / dstW), srcW - 1);
|
|
10057
|
+
const srcIdx = (srcY * srcW + srcX) * channels;
|
|
10058
|
+
const dstIdx = (dy * dstW + dx) * channels;
|
|
10059
|
+
for (let c = 0;c < channels; c++) {
|
|
10060
|
+
dst[dstIdx + c] = src[srcIdx + c];
|
|
10061
|
+
}
|
|
10062
|
+
}
|
|
10063
|
+
}
|
|
10064
|
+
return {
|
|
10065
|
+
image: { data: dst, width: dstW, height: dstH, channels }
|
|
10066
|
+
};
|
|
10067
|
+
}
|
|
10068
|
+
}
|
|
10069
|
+
Workflow53.prototype.imageResize = CreateWorkflow52(ImageResizeTask);
|
|
10070
|
+
// src/task/image/ImageCropTask.ts
|
|
10071
|
+
import {
|
|
10072
|
+
CreateWorkflow as CreateWorkflow53,
|
|
10073
|
+
Task as Task52,
|
|
10074
|
+
Workflow as Workflow54
|
|
10075
|
+
} from "@workglow/task-graph";
|
|
10076
|
+
var inputSchema46 = {
|
|
10077
|
+
type: "object",
|
|
10078
|
+
properties: {
|
|
10079
|
+
image: ImageBinarySchema({ title: "Image", description: "Source image" }),
|
|
10080
|
+
x: { type: "integer", title: "X", description: "Left offset", minimum: 0 },
|
|
10081
|
+
y: { type: "integer", title: "Y", description: "Top offset", minimum: 0 },
|
|
10082
|
+
width: { type: "integer", title: "Width", description: "Crop width", minimum: 1 },
|
|
10083
|
+
height: { type: "integer", title: "Height", description: "Crop height", minimum: 1 }
|
|
10084
|
+
},
|
|
10085
|
+
required: ["image", "x", "y", "width", "height"],
|
|
10086
|
+
additionalProperties: false
|
|
10087
|
+
};
|
|
10088
|
+
var outputSchema45 = {
|
|
10089
|
+
type: "object",
|
|
10090
|
+
properties: {
|
|
10091
|
+
image: ImageBinarySchema({ title: "Image", description: "Cropped image" })
|
|
10092
|
+
},
|
|
10093
|
+
required: ["image"],
|
|
10094
|
+
additionalProperties: false
|
|
10095
|
+
};
|
|
10096
|
+
|
|
10097
|
+
class ImageCropTask extends Task52 {
|
|
10098
|
+
static type = "ImageCropTask";
|
|
10099
|
+
static category = "Image";
|
|
10100
|
+
static title = "Crop Image";
|
|
10101
|
+
static description = "Crops an image to a rectangular region";
|
|
10102
|
+
static inputSchema() {
|
|
10103
|
+
return inputSchema46;
|
|
10104
|
+
}
|
|
10105
|
+
static outputSchema() {
|
|
10106
|
+
return outputSchema45;
|
|
10107
|
+
}
|
|
10108
|
+
async executeReactive(input2, _output, _context) {
|
|
10109
|
+
const { image, x: rawX, y: rawY, width: rawW, height: rawH } = input2;
|
|
10110
|
+
const { data: src, width: srcW, height: srcH, channels } = image;
|
|
10111
|
+
if (srcW < 1 || srcH < 1) {
|
|
10112
|
+
throw new RangeError("Cannot crop an empty image");
|
|
10113
|
+
}
|
|
10114
|
+
if (rawX < 0 || rawX >= srcW || rawY < 0 || rawY >= srcH) {
|
|
10115
|
+
throw new RangeError("Crop origin is outside the source image bounds");
|
|
10116
|
+
}
|
|
10117
|
+
const x = rawX;
|
|
10118
|
+
const y = rawY;
|
|
10119
|
+
const w = Math.min(rawW, srcW - x);
|
|
10120
|
+
const h = Math.min(rawH, srcH - y);
|
|
10121
|
+
const dst = new Uint8ClampedArray(w * h * channels);
|
|
10122
|
+
const rowBytes = w * channels;
|
|
10123
|
+
for (let row = 0;row < h; row++) {
|
|
10124
|
+
const srcOffset = ((y + row) * srcW + x) * channels;
|
|
10125
|
+
const dstOffset = row * rowBytes;
|
|
10126
|
+
dst.set(src.subarray(srcOffset, srcOffset + rowBytes), dstOffset);
|
|
10127
|
+
}
|
|
10128
|
+
return { image: { data: dst, width: w, height: h, channels } };
|
|
10129
|
+
}
|
|
10130
|
+
}
|
|
10131
|
+
Workflow54.prototype.imageCrop = CreateWorkflow53(ImageCropTask);
|
|
10132
|
+
// src/task/image/ImageRotateTask.ts
|
|
10133
|
+
import {
|
|
10134
|
+
CreateWorkflow as CreateWorkflow54,
|
|
10135
|
+
Task as Task53,
|
|
10136
|
+
Workflow as Workflow55
|
|
10137
|
+
} from "@workglow/task-graph";
|
|
10138
|
+
var inputSchema47 = {
|
|
10139
|
+
type: "object",
|
|
10140
|
+
properties: {
|
|
10141
|
+
image: ImageBinarySchema({ title: "Image", description: "Source image" }),
|
|
10142
|
+
angle: {
|
|
10143
|
+
type: "integer",
|
|
10144
|
+
enum: [90, 180, 270],
|
|
10145
|
+
title: "Angle",
|
|
10146
|
+
description: "Rotation angle in degrees (clockwise)"
|
|
10147
|
+
}
|
|
10148
|
+
},
|
|
10149
|
+
required: ["image", "angle"],
|
|
10150
|
+
additionalProperties: false
|
|
10151
|
+
};
|
|
10152
|
+
var outputSchema46 = {
|
|
10153
|
+
type: "object",
|
|
10154
|
+
properties: {
|
|
10155
|
+
image: ImageBinarySchema({ title: "Image", description: "Rotated image" })
|
|
10156
|
+
},
|
|
10157
|
+
required: ["image"],
|
|
10158
|
+
additionalProperties: false
|
|
10159
|
+
};
|
|
10160
|
+
|
|
10161
|
+
class ImageRotateTask extends Task53 {
|
|
10162
|
+
static type = "ImageRotateTask";
|
|
10163
|
+
static category = "Image";
|
|
10164
|
+
static title = "Rotate Image";
|
|
10165
|
+
static description = "Rotates an image by 90, 180, or 270 degrees clockwise";
|
|
10166
|
+
static inputSchema() {
|
|
10167
|
+
return inputSchema47;
|
|
10168
|
+
}
|
|
10169
|
+
static outputSchema() {
|
|
10170
|
+
return outputSchema46;
|
|
10171
|
+
}
|
|
10172
|
+
async executeReactive(input2, _output, _context) {
|
|
10173
|
+
const { image, angle } = input2;
|
|
10174
|
+
const { data: src, width: srcW, height: srcH, channels } = image;
|
|
10175
|
+
const swap = angle === 90 || angle === 270;
|
|
10176
|
+
const dstW = swap ? srcH : srcW;
|
|
10177
|
+
const dstH = swap ? srcW : srcH;
|
|
10178
|
+
const dst = new Uint8ClampedArray(dstW * dstH * channels);
|
|
10179
|
+
for (let sy = 0;sy < srcH; sy++) {
|
|
10180
|
+
for (let sx = 0;sx < srcW; sx++) {
|
|
10181
|
+
let dx, dy;
|
|
10182
|
+
if (angle === 90) {
|
|
10183
|
+
dx = srcH - 1 - sy;
|
|
10184
|
+
dy = sx;
|
|
10185
|
+
} else if (angle === 180) {
|
|
10186
|
+
dx = srcW - 1 - sx;
|
|
10187
|
+
dy = srcH - 1 - sy;
|
|
10188
|
+
} else {
|
|
10189
|
+
dx = sy;
|
|
10190
|
+
dy = srcW - 1 - sx;
|
|
10191
|
+
}
|
|
10192
|
+
const srcIdx = (sy * srcW + sx) * channels;
|
|
10193
|
+
const dstIdx = (dy * dstW + dx) * channels;
|
|
10194
|
+
for (let c = 0;c < channels; c++) {
|
|
10195
|
+
dst[dstIdx + c] = src[srcIdx + c];
|
|
10196
|
+
}
|
|
10197
|
+
}
|
|
10198
|
+
}
|
|
10199
|
+
return {
|
|
10200
|
+
image: { data: dst, width: dstW, height: dstH, channels }
|
|
10201
|
+
};
|
|
10202
|
+
}
|
|
10203
|
+
}
|
|
10204
|
+
Workflow55.prototype.imageRotate = CreateWorkflow54(ImageRotateTask);
|
|
10205
|
+
// src/task/image/ImageFlipTask.ts
|
|
10206
|
+
import {
|
|
10207
|
+
CreateWorkflow as CreateWorkflow55,
|
|
10208
|
+
Task as Task54,
|
|
10209
|
+
Workflow as Workflow56
|
|
10210
|
+
} from "@workglow/task-graph";
|
|
10211
|
+
var inputSchema48 = {
|
|
10212
|
+
type: "object",
|
|
10213
|
+
properties: {
|
|
10214
|
+
image: ImageBinarySchema({ title: "Image", description: "Source image" }),
|
|
10215
|
+
direction: {
|
|
10216
|
+
type: "string",
|
|
10217
|
+
enum: ["horizontal", "vertical"],
|
|
10218
|
+
title: "Direction",
|
|
10219
|
+
description: "Flip direction"
|
|
10220
|
+
}
|
|
10221
|
+
},
|
|
10222
|
+
required: ["image", "direction"],
|
|
10223
|
+
additionalProperties: false
|
|
10224
|
+
};
|
|
10225
|
+
var outputSchema47 = {
|
|
10226
|
+
type: "object",
|
|
10227
|
+
properties: {
|
|
10228
|
+
image: ImageBinarySchema({ title: "Image", description: "Flipped image" })
|
|
10229
|
+
},
|
|
10230
|
+
required: ["image"],
|
|
10231
|
+
additionalProperties: false
|
|
10232
|
+
};
|
|
10233
|
+
|
|
10234
|
+
class ImageFlipTask extends Task54 {
|
|
10235
|
+
static type = "ImageFlipTask";
|
|
10236
|
+
static category = "Image";
|
|
10237
|
+
static title = "Flip Image";
|
|
10238
|
+
static description = "Flips an image horizontally or vertically";
|
|
10239
|
+
static inputSchema() {
|
|
10240
|
+
return inputSchema48;
|
|
10241
|
+
}
|
|
10242
|
+
static outputSchema() {
|
|
10243
|
+
return outputSchema47;
|
|
10244
|
+
}
|
|
10245
|
+
async executeReactive(input2, _output, _context) {
|
|
10246
|
+
const { image, direction } = input2;
|
|
10247
|
+
const { data: src, width, height, channels } = image;
|
|
10248
|
+
const dst = new Uint8ClampedArray(src.length);
|
|
10249
|
+
const rowBytes = width * channels;
|
|
10250
|
+
if (direction === "vertical") {
|
|
10251
|
+
for (let y = 0;y < height; y++) {
|
|
10252
|
+
const srcOffset = y * rowBytes;
|
|
10253
|
+
const dstOffset = (height - 1 - y) * rowBytes;
|
|
10254
|
+
dst.set(src.subarray(srcOffset, srcOffset + rowBytes), dstOffset);
|
|
10255
|
+
}
|
|
10256
|
+
} else {
|
|
10257
|
+
for (let y = 0;y < height; y++) {
|
|
10258
|
+
for (let x = 0;x < width; x++) {
|
|
10259
|
+
const srcIdx = (y * width + x) * channels;
|
|
10260
|
+
const dstIdx = (y * width + (width - 1 - x)) * channels;
|
|
10261
|
+
for (let c = 0;c < channels; c++) {
|
|
10262
|
+
dst[dstIdx + c] = src[srcIdx + c];
|
|
10263
|
+
}
|
|
10264
|
+
}
|
|
10265
|
+
}
|
|
10266
|
+
}
|
|
10267
|
+
return { image: { data: dst, width, height, channels } };
|
|
10268
|
+
}
|
|
10269
|
+
}
|
|
10270
|
+
Workflow56.prototype.imageFlip = CreateWorkflow55(ImageFlipTask);
|
|
10271
|
+
// src/task/image/ImageGrayscaleTask.ts
|
|
10272
|
+
import {
|
|
10273
|
+
CreateWorkflow as CreateWorkflow56,
|
|
10274
|
+
Task as Task55,
|
|
10275
|
+
Workflow as Workflow57
|
|
10276
|
+
} from "@workglow/task-graph";
|
|
10277
|
+
var inputSchema49 = {
|
|
10278
|
+
type: "object",
|
|
10279
|
+
properties: {
|
|
10280
|
+
image: ImageBinarySchema({ title: "Image", description: "Source image" })
|
|
10281
|
+
},
|
|
10282
|
+
required: ["image"],
|
|
10283
|
+
additionalProperties: false
|
|
10284
|
+
};
|
|
10285
|
+
var outputSchema48 = {
|
|
10286
|
+
type: "object",
|
|
10287
|
+
properties: {
|
|
10288
|
+
image: ImageBinarySchema({ title: "Image", description: "Grayscale image" })
|
|
10289
|
+
},
|
|
10290
|
+
required: ["image"],
|
|
10291
|
+
additionalProperties: false
|
|
10292
|
+
};
|
|
10293
|
+
|
|
10294
|
+
class ImageGrayscaleTask extends Task55 {
|
|
10295
|
+
static type = "ImageGrayscaleTask";
|
|
10296
|
+
static category = "Image";
|
|
10297
|
+
static title = "Grayscale";
|
|
10298
|
+
static description = "Converts an image to grayscale using luminance";
|
|
10299
|
+
static inputSchema() {
|
|
10300
|
+
return inputSchema49;
|
|
10301
|
+
}
|
|
10302
|
+
static outputSchema() {
|
|
10303
|
+
return outputSchema48;
|
|
10304
|
+
}
|
|
10305
|
+
async executeReactive(input2, _output, _context) {
|
|
10306
|
+
const { data: src, width, height, channels } = input2.image;
|
|
10307
|
+
if (channels === 1) {
|
|
10308
|
+
return { image: { data: new Uint8ClampedArray(src), width, height, channels: 1 } };
|
|
10309
|
+
}
|
|
10310
|
+
const pixelCount = width * height;
|
|
10311
|
+
const dst = new Uint8ClampedArray(pixelCount);
|
|
10312
|
+
for (let i = 0;i < pixelCount; i++) {
|
|
10313
|
+
const idx = i * channels;
|
|
10314
|
+
dst[i] = src[idx] * 77 + src[idx + 1] * 150 + src[idx + 2] * 29 >> 8;
|
|
10315
|
+
}
|
|
10316
|
+
return { image: { data: dst, width, height, channels: 1 } };
|
|
10317
|
+
}
|
|
10318
|
+
}
|
|
10319
|
+
Workflow57.prototype.imageGrayscale = CreateWorkflow56(ImageGrayscaleTask);
|
|
10320
|
+
// src/task/image/ImageBorderTask.ts
|
|
10321
|
+
import {
|
|
10322
|
+
CreateWorkflow as CreateWorkflow57,
|
|
10323
|
+
Task as Task56,
|
|
10324
|
+
Workflow as Workflow58
|
|
10325
|
+
} from "@workglow/task-graph";
|
|
10326
|
+
var inputSchema50 = {
|
|
10327
|
+
type: "object",
|
|
10328
|
+
properties: {
|
|
10329
|
+
image: ImageBinarySchema({ title: "Image", description: "Source image" }),
|
|
10330
|
+
borderWidth: {
|
|
10331
|
+
type: "integer",
|
|
10332
|
+
title: "Border Width",
|
|
10333
|
+
description: "Border width in pixels",
|
|
10334
|
+
minimum: 1,
|
|
10335
|
+
default: 1
|
|
10336
|
+
},
|
|
10337
|
+
color: ColorSchema({ title: "Color", description: "Border color" })
|
|
10338
|
+
},
|
|
10339
|
+
required: ["image", "color"],
|
|
10340
|
+
additionalProperties: false
|
|
10341
|
+
};
|
|
10342
|
+
var outputSchema49 = {
|
|
10343
|
+
type: "object",
|
|
10344
|
+
properties: {
|
|
10345
|
+
image: ImageBinarySchema({ title: "Image", description: "Image with border" })
|
|
10346
|
+
},
|
|
10347
|
+
required: ["image"],
|
|
10348
|
+
additionalProperties: false
|
|
10349
|
+
};
|
|
10350
|
+
|
|
10351
|
+
class ImageBorderTask extends Task56 {
|
|
10352
|
+
static type = "ImageBorderTask";
|
|
10353
|
+
static category = "Image";
|
|
10354
|
+
static title = "Add Border";
|
|
10355
|
+
static description = "Adds a colored border around an image";
|
|
10356
|
+
static inputSchema() {
|
|
10357
|
+
return inputSchema50;
|
|
10358
|
+
}
|
|
10359
|
+
static outputSchema() {
|
|
10360
|
+
return outputSchema49;
|
|
10361
|
+
}
|
|
10362
|
+
async executeReactive(input2, _output, _context) {
|
|
10363
|
+
const { image, borderWidth: bw = 1, color } = input2;
|
|
10364
|
+
const { data: src, width: srcW, height: srcH, channels: srcCh } = image;
|
|
10365
|
+
const outCh = 4;
|
|
10366
|
+
const dstW = srcW + bw * 2;
|
|
10367
|
+
const dstH = srcH + bw * 2;
|
|
10368
|
+
const dst = new Uint8ClampedArray(dstW * dstH * outCh);
|
|
10369
|
+
const r = color.r;
|
|
10370
|
+
const g = color.g;
|
|
10371
|
+
const b = color.b;
|
|
10372
|
+
const a = color.a ?? 255;
|
|
10373
|
+
for (let i = 0;i < dst.length; i += outCh) {
|
|
10374
|
+
dst[i] = r;
|
|
10375
|
+
dst[i + 1] = g;
|
|
10376
|
+
dst[i + 2] = b;
|
|
10377
|
+
dst[i + 3] = a;
|
|
10378
|
+
}
|
|
10379
|
+
for (let y = 0;y < srcH; y++) {
|
|
10380
|
+
for (let x = 0;x < srcW; x++) {
|
|
10381
|
+
const srcIdx = (y * srcW + x) * srcCh;
|
|
10382
|
+
const dstIdx = ((y + bw) * dstW + (x + bw)) * outCh;
|
|
10383
|
+
dst[dstIdx] = src[srcIdx];
|
|
10384
|
+
dst[dstIdx + 1] = srcCh >= 3 ? src[srcIdx + 1] : src[srcIdx];
|
|
10385
|
+
dst[dstIdx + 2] = srcCh >= 3 ? src[srcIdx + 2] : src[srcIdx];
|
|
10386
|
+
dst[dstIdx + 3] = srcCh === 4 ? src[srcIdx + 3] : 255;
|
|
10387
|
+
}
|
|
10388
|
+
}
|
|
10389
|
+
return {
|
|
10390
|
+
image: { data: dst, width: dstW, height: dstH, channels: outCh }
|
|
10391
|
+
};
|
|
10392
|
+
}
|
|
10393
|
+
}
|
|
10394
|
+
Workflow58.prototype.imageBorder = CreateWorkflow57(ImageBorderTask);
|
|
10395
|
+
// src/task/image/ImageTransparencyTask.ts
|
|
10396
|
+
import {
|
|
10397
|
+
CreateWorkflow as CreateWorkflow58,
|
|
10398
|
+
Task as Task57,
|
|
10399
|
+
Workflow as Workflow59
|
|
10400
|
+
} from "@workglow/task-graph";
|
|
10401
|
+
var inputSchema51 = {
|
|
10402
|
+
type: "object",
|
|
10403
|
+
properties: {
|
|
10404
|
+
image: ImageBinarySchema({ title: "Image", description: "Source image" }),
|
|
10405
|
+
opacity: {
|
|
10406
|
+
type: "number",
|
|
10407
|
+
title: "Opacity",
|
|
10408
|
+
description: "Opacity level (0.0 = fully transparent, 1.0 = fully opaque)",
|
|
10409
|
+
minimum: 0,
|
|
10410
|
+
maximum: 1
|
|
10411
|
+
}
|
|
10412
|
+
},
|
|
10413
|
+
required: ["image", "opacity"],
|
|
10414
|
+
additionalProperties: false
|
|
10415
|
+
};
|
|
10416
|
+
var outputSchema50 = {
|
|
10417
|
+
type: "object",
|
|
10418
|
+
properties: {
|
|
10419
|
+
image: ImageBinarySchema({ title: "Image", description: "Image with adjusted transparency" })
|
|
10420
|
+
},
|
|
10421
|
+
required: ["image"],
|
|
10422
|
+
additionalProperties: false
|
|
10423
|
+
};
|
|
10424
|
+
|
|
10425
|
+
class ImageTransparencyTask extends Task57 {
|
|
10426
|
+
static type = "ImageTransparencyTask";
|
|
10427
|
+
static category = "Image";
|
|
10428
|
+
static title = "Set Transparency";
|
|
10429
|
+
static description = "Adjusts the opacity of an image";
|
|
10430
|
+
static inputSchema() {
|
|
10431
|
+
return inputSchema51;
|
|
10432
|
+
}
|
|
10433
|
+
static outputSchema() {
|
|
10434
|
+
return outputSchema50;
|
|
10435
|
+
}
|
|
10436
|
+
async executeReactive(input2, _output, _context) {
|
|
10437
|
+
const { image, opacity } = input2;
|
|
10438
|
+
const { data: src, width, height, channels: srcCh } = image;
|
|
10439
|
+
const pixelCount = width * height;
|
|
10440
|
+
const dst = new Uint8ClampedArray(pixelCount * 4);
|
|
10441
|
+
const alphaScale = Math.round(opacity * 255);
|
|
10442
|
+
for (let i = 0;i < pixelCount; i++) {
|
|
10443
|
+
const srcIdx = i * srcCh;
|
|
10444
|
+
const dstIdx = i * 4;
|
|
10445
|
+
dst[dstIdx] = src[srcIdx];
|
|
10446
|
+
dst[dstIdx + 1] = srcCh >= 3 ? src[srcIdx + 1] : src[srcIdx];
|
|
10447
|
+
dst[dstIdx + 2] = srcCh >= 3 ? src[srcIdx + 2] : src[srcIdx];
|
|
10448
|
+
const srcAlpha = srcCh === 4 ? src[srcIdx + 3] : 255;
|
|
10449
|
+
dst[dstIdx + 3] = (srcAlpha * alphaScale + 127) / 255;
|
|
10450
|
+
}
|
|
10451
|
+
return {
|
|
10452
|
+
image: { data: dst, width, height, channels: 4 }
|
|
10453
|
+
};
|
|
10454
|
+
}
|
|
10455
|
+
}
|
|
10456
|
+
Workflow59.prototype.imageTransparency = CreateWorkflow58(ImageTransparencyTask);
|
|
10457
|
+
// src/task/image/ImageBlurTask.ts
|
|
10458
|
+
import {
|
|
10459
|
+
CreateWorkflow as CreateWorkflow59,
|
|
10460
|
+
Task as Task58,
|
|
10461
|
+
Workflow as Workflow60
|
|
10462
|
+
} from "@workglow/task-graph";
|
|
10463
|
+
var inputSchema52 = {
|
|
10464
|
+
type: "object",
|
|
10465
|
+
properties: {
|
|
10466
|
+
image: ImageBinarySchema({ title: "Image", description: "Source image" }),
|
|
10467
|
+
radius: {
|
|
10468
|
+
type: "integer",
|
|
10469
|
+
title: "Radius",
|
|
10470
|
+
description: "Blur radius (1-10)",
|
|
10471
|
+
minimum: 1,
|
|
10472
|
+
maximum: 10,
|
|
10473
|
+
default: 1
|
|
10474
|
+
}
|
|
10475
|
+
},
|
|
10476
|
+
required: ["image"],
|
|
10477
|
+
additionalProperties: false
|
|
10478
|
+
};
|
|
10479
|
+
var outputSchema51 = {
|
|
10480
|
+
type: "object",
|
|
10481
|
+
properties: {
|
|
10482
|
+
image: ImageBinarySchema({ title: "Image", description: "Blurred image" })
|
|
10483
|
+
},
|
|
10484
|
+
required: ["image"],
|
|
10485
|
+
additionalProperties: false
|
|
10486
|
+
};
|
|
10487
|
+
|
|
10488
|
+
class ImageBlurTask extends Task58 {
|
|
10489
|
+
static type = "ImageBlurTask";
|
|
10490
|
+
static category = "Image";
|
|
10491
|
+
static title = "Blur Image";
|
|
10492
|
+
static description = "Applies a box blur to an image";
|
|
10493
|
+
static inputSchema() {
|
|
10494
|
+
return inputSchema52;
|
|
10495
|
+
}
|
|
10496
|
+
static outputSchema() {
|
|
10497
|
+
return outputSchema51;
|
|
10498
|
+
}
|
|
10499
|
+
async executeReactive(input2, _output, _context) {
|
|
10500
|
+
const { image, radius = 1 } = input2;
|
|
10501
|
+
const { data: src, width, height, channels } = image;
|
|
10502
|
+
const kernelSize = radius * 2 + 1;
|
|
10503
|
+
const tmp = new Uint8ClampedArray(src.length);
|
|
10504
|
+
for (let y = 0;y < height; y++) {
|
|
10505
|
+
for (let c = 0;c < channels; c++) {
|
|
10506
|
+
let sum = 0;
|
|
10507
|
+
for (let k = -radius;k <= radius; k++) {
|
|
10508
|
+
const x = Math.max(0, Math.min(k, width - 1));
|
|
10509
|
+
sum += src[(y * width + x) * channels + c];
|
|
10510
|
+
}
|
|
10511
|
+
tmp[y * width * channels + c] = sum / kernelSize + 0.5 | 0;
|
|
10512
|
+
for (let x = 1;x < width; x++) {
|
|
10513
|
+
const addX = Math.min(x + radius, width - 1);
|
|
10514
|
+
const removeX = Math.max(x - radius - 1, 0);
|
|
10515
|
+
sum += src[(y * width + addX) * channels + c] - src[(y * width + removeX) * channels + c];
|
|
10516
|
+
tmp[(y * width + x) * channels + c] = sum / kernelSize + 0.5 | 0;
|
|
10517
|
+
}
|
|
10518
|
+
}
|
|
10519
|
+
}
|
|
10520
|
+
const dst = new Uint8ClampedArray(src.length);
|
|
10521
|
+
for (let x = 0;x < width; x++) {
|
|
10522
|
+
for (let c = 0;c < channels; c++) {
|
|
10523
|
+
let sum = 0;
|
|
10524
|
+
for (let k = -radius;k <= radius; k++) {
|
|
10525
|
+
const y = Math.max(0, Math.min(k, height - 1));
|
|
10526
|
+
sum += tmp[(y * width + x) * channels + c];
|
|
10527
|
+
}
|
|
10528
|
+
dst[x * channels + c] = sum / kernelSize + 0.5 | 0;
|
|
10529
|
+
for (let y = 1;y < height; y++) {
|
|
10530
|
+
const addY = Math.min(y + radius, height - 1);
|
|
10531
|
+
const removeY = Math.max(y - radius - 1, 0);
|
|
10532
|
+
sum += tmp[(addY * width + x) * channels + c] - tmp[(removeY * width + x) * channels + c];
|
|
10533
|
+
dst[(y * width + x) * channels + c] = sum / kernelSize + 0.5 | 0;
|
|
10534
|
+
}
|
|
10535
|
+
}
|
|
10536
|
+
}
|
|
10537
|
+
return { image: { data: dst, width, height, channels } };
|
|
10538
|
+
}
|
|
10539
|
+
}
|
|
10540
|
+
Workflow60.prototype.imageBlur = CreateWorkflow59(ImageBlurTask);
|
|
10541
|
+
// src/task/image/ImageWatermarkTask.ts
|
|
10542
|
+
import {
|
|
10543
|
+
CreateWorkflow as CreateWorkflow60,
|
|
10544
|
+
Task as Task59,
|
|
10545
|
+
Workflow as Workflow61
|
|
10546
|
+
} from "@workglow/task-graph";
|
|
10547
|
+
var inputSchema53 = {
|
|
10548
|
+
type: "object",
|
|
10549
|
+
properties: {
|
|
10550
|
+
image: ImageBinarySchema({ title: "Image", description: "Source image" }),
|
|
10551
|
+
spacing: {
|
|
10552
|
+
type: "integer",
|
|
10553
|
+
title: "Spacing",
|
|
10554
|
+
description: "Pattern spacing in pixels",
|
|
10555
|
+
minimum: 8,
|
|
10556
|
+
default: 64
|
|
10557
|
+
},
|
|
10558
|
+
opacity: {
|
|
10559
|
+
type: "number",
|
|
10560
|
+
title: "Opacity",
|
|
10561
|
+
description: "Watermark opacity (0.0-1.0)",
|
|
10562
|
+
minimum: 0,
|
|
10563
|
+
maximum: 1,
|
|
10564
|
+
default: 0.3
|
|
10565
|
+
},
|
|
10566
|
+
pattern: {
|
|
10567
|
+
type: "string",
|
|
10568
|
+
enum: ["diagonal-lines", "grid", "dots"],
|
|
10569
|
+
title: "Pattern",
|
|
10570
|
+
description: "Watermark pattern type",
|
|
10571
|
+
default: "diagonal-lines"
|
|
10572
|
+
}
|
|
10573
|
+
},
|
|
10574
|
+
required: ["image"],
|
|
10575
|
+
additionalProperties: false
|
|
10576
|
+
};
|
|
10577
|
+
var outputSchema52 = {
|
|
10578
|
+
type: "object",
|
|
10579
|
+
properties: {
|
|
10580
|
+
image: ImageBinarySchema({ title: "Image", description: "Watermarked image" })
|
|
10581
|
+
},
|
|
10582
|
+
required: ["image"],
|
|
10583
|
+
additionalProperties: false
|
|
10584
|
+
};
|
|
10585
|
+
|
|
10586
|
+
class ImageWatermarkTask extends Task59 {
|
|
10587
|
+
static type = "ImageWatermarkTask";
|
|
10588
|
+
static category = "Image";
|
|
10589
|
+
static title = "Add Watermark";
|
|
10590
|
+
static description = "Adds a repeating pattern watermark to an image";
|
|
10591
|
+
static inputSchema() {
|
|
10592
|
+
return inputSchema53;
|
|
10593
|
+
}
|
|
10594
|
+
static outputSchema() {
|
|
10595
|
+
return outputSchema52;
|
|
10596
|
+
}
|
|
10597
|
+
async executeReactive(input2, _output, _context) {
|
|
10598
|
+
const { image, spacing = 64, opacity = 0.3, pattern = "diagonal-lines" } = input2;
|
|
10599
|
+
const { data: src, width, height, channels: srcCh } = image;
|
|
10600
|
+
const outCh = 4;
|
|
10601
|
+
const dst = new Uint8ClampedArray(width * height * outCh);
|
|
10602
|
+
const lineWidth = 2;
|
|
10603
|
+
const dotRadius = Math.max(2, spacing >> 3);
|
|
10604
|
+
const dotRadiusSq = dotRadius * dotRadius;
|
|
10605
|
+
const half = spacing >> 1;
|
|
10606
|
+
const alpha = Math.round(opacity * 255);
|
|
10607
|
+
for (let y = 0;y < height; y++) {
|
|
10608
|
+
for (let x = 0;x < width; x++) {
|
|
10609
|
+
const srcIdx = (y * width + x) * srcCh;
|
|
10610
|
+
const dstIdx = (y * width + x) * outCh;
|
|
10611
|
+
const sr = src[srcIdx];
|
|
10612
|
+
const sg = srcCh >= 3 ? src[srcIdx + 1] : sr;
|
|
10613
|
+
const sb = srcCh >= 3 ? src[srcIdx + 2] : sr;
|
|
10614
|
+
const sa = srcCh === 4 ? src[srcIdx + 3] : 255;
|
|
10615
|
+
let isPattern = false;
|
|
10616
|
+
if (pattern === "diagonal-lines") {
|
|
10617
|
+
isPattern = (x + y) % spacing < lineWidth;
|
|
10618
|
+
} else if (pattern === "grid") {
|
|
10619
|
+
isPattern = x % spacing < lineWidth || y % spacing < lineWidth;
|
|
10620
|
+
} else {
|
|
10621
|
+
const dx = x % spacing - half;
|
|
10622
|
+
const dy = y % spacing - half;
|
|
10623
|
+
isPattern = dx * dx + dy * dy < dotRadiusSq;
|
|
10624
|
+
}
|
|
10625
|
+
if (isPattern) {
|
|
10626
|
+
const blend = alpha;
|
|
10627
|
+
const invBlend = 255 - blend;
|
|
10628
|
+
dst[dstIdx] = (sr * invBlend + 255 * blend + 127) / 255;
|
|
10629
|
+
dst[dstIdx + 1] = (sg * invBlend + 255 * blend + 127) / 255;
|
|
10630
|
+
dst[dstIdx + 2] = (sb * invBlend + 255 * blend + 127) / 255;
|
|
10631
|
+
dst[dstIdx + 3] = sa;
|
|
10632
|
+
} else {
|
|
10633
|
+
dst[dstIdx] = sr;
|
|
10634
|
+
dst[dstIdx + 1] = sg;
|
|
10635
|
+
dst[dstIdx + 2] = sb;
|
|
10636
|
+
dst[dstIdx + 3] = sa;
|
|
10637
|
+
}
|
|
10638
|
+
}
|
|
10639
|
+
}
|
|
10640
|
+
return {
|
|
10641
|
+
image: { data: dst, width, height, channels: outCh }
|
|
10642
|
+
};
|
|
10643
|
+
}
|
|
10644
|
+
}
|
|
10645
|
+
Workflow61.prototype.imageWatermark = CreateWorkflow60(ImageWatermarkTask);
|
|
10646
|
+
// src/task/image/ImagePixelateTask.ts
|
|
10647
|
+
import {
|
|
10648
|
+
CreateWorkflow as CreateWorkflow61,
|
|
10649
|
+
Task as Task60,
|
|
10650
|
+
Workflow as Workflow62
|
|
10651
|
+
} from "@workglow/task-graph";
|
|
10652
|
+
var inputSchema54 = {
|
|
10653
|
+
type: "object",
|
|
10654
|
+
properties: {
|
|
10655
|
+
image: ImageBinarySchema({ title: "Image", description: "Source image" }),
|
|
10656
|
+
blockSize: {
|
|
10657
|
+
type: "integer",
|
|
10658
|
+
title: "Block Size",
|
|
10659
|
+
description: "Size of each pixelation block",
|
|
10660
|
+
minimum: 2,
|
|
10661
|
+
default: 8
|
|
10662
|
+
}
|
|
10663
|
+
},
|
|
10664
|
+
required: ["image"],
|
|
10665
|
+
additionalProperties: false
|
|
10666
|
+
};
|
|
10667
|
+
var outputSchema53 = {
|
|
10668
|
+
type: "object",
|
|
10669
|
+
properties: {
|
|
10670
|
+
image: ImageBinarySchema({ title: "Image", description: "Pixelated image" })
|
|
10671
|
+
},
|
|
10672
|
+
required: ["image"],
|
|
10673
|
+
additionalProperties: false
|
|
10674
|
+
};
|
|
10675
|
+
|
|
10676
|
+
class ImagePixelateTask extends Task60 {
|
|
10677
|
+
static type = "ImagePixelateTask";
|
|
10678
|
+
static category = "Image";
|
|
10679
|
+
static title = "Pixelate Image";
|
|
10680
|
+
static description = "Pixelates an image by averaging blocks of pixels";
|
|
10681
|
+
static inputSchema() {
|
|
10682
|
+
return inputSchema54;
|
|
10683
|
+
}
|
|
10684
|
+
static outputSchema() {
|
|
10685
|
+
return outputSchema53;
|
|
10686
|
+
}
|
|
10687
|
+
async executeReactive(input2, _output, _context) {
|
|
10688
|
+
const { image, blockSize = 8 } = input2;
|
|
10689
|
+
const { data: src, width, height, channels } = image;
|
|
10690
|
+
const dst = new Uint8ClampedArray(src.length);
|
|
10691
|
+
for (let by = 0;by < height; by += blockSize) {
|
|
10692
|
+
const blockH = Math.min(blockSize, height - by);
|
|
10693
|
+
for (let bx = 0;bx < width; bx += blockSize) {
|
|
10694
|
+
const blockW = Math.min(blockSize, width - bx);
|
|
10695
|
+
const blockArea = blockW * blockH;
|
|
10696
|
+
const sums = new Array(channels).fill(0);
|
|
10697
|
+
for (let y = by;y < by + blockH; y++) {
|
|
10698
|
+
for (let x = bx;x < bx + blockW; x++) {
|
|
10699
|
+
const idx = (y * width + x) * channels;
|
|
10700
|
+
for (let c = 0;c < channels; c++) {
|
|
10701
|
+
sums[c] += src[idx + c];
|
|
10702
|
+
}
|
|
10703
|
+
}
|
|
10704
|
+
}
|
|
10705
|
+
const avg = sums.map((s) => s / blockArea + 0.5 | 0);
|
|
10706
|
+
for (let y = by;y < by + blockH; y++) {
|
|
10707
|
+
for (let x = bx;x < bx + blockW; x++) {
|
|
10708
|
+
const idx = (y * width + x) * channels;
|
|
10709
|
+
for (let c = 0;c < channels; c++) {
|
|
10710
|
+
dst[idx + c] = avg[c];
|
|
10711
|
+
}
|
|
10712
|
+
}
|
|
10713
|
+
}
|
|
10714
|
+
}
|
|
10715
|
+
}
|
|
10716
|
+
return { image: { data: dst, width, height, channels } };
|
|
10717
|
+
}
|
|
10718
|
+
}
|
|
10719
|
+
Workflow62.prototype.imagePixelate = CreateWorkflow61(ImagePixelateTask);
|
|
10720
|
+
// src/task/image/ImageInvertTask.ts
|
|
10721
|
+
import {
|
|
10722
|
+
CreateWorkflow as CreateWorkflow62,
|
|
10723
|
+
Task as Task61,
|
|
10724
|
+
Workflow as Workflow63
|
|
10725
|
+
} from "@workglow/task-graph";
|
|
10726
|
+
var inputSchema55 = {
|
|
10727
|
+
type: "object",
|
|
10728
|
+
properties: {
|
|
10729
|
+
image: ImageBinarySchema({ title: "Image", description: "Source image" })
|
|
10730
|
+
},
|
|
10731
|
+
required: ["image"],
|
|
10732
|
+
additionalProperties: false
|
|
10733
|
+
};
|
|
10734
|
+
var outputSchema54 = {
|
|
10735
|
+
type: "object",
|
|
10736
|
+
properties: {
|
|
10737
|
+
image: ImageBinarySchema({ title: "Image", description: "Inverted image" })
|
|
10738
|
+
},
|
|
10739
|
+
required: ["image"],
|
|
10740
|
+
additionalProperties: false
|
|
10741
|
+
};
|
|
10742
|
+
|
|
10743
|
+
class ImageInvertTask extends Task61 {
|
|
10744
|
+
static type = "ImageInvertTask";
|
|
10745
|
+
static category = "Image";
|
|
10746
|
+
static title = "Invert Colors";
|
|
10747
|
+
static description = "Inverts the colors of an image";
|
|
10748
|
+
static inputSchema() {
|
|
10749
|
+
return inputSchema55;
|
|
10750
|
+
}
|
|
10751
|
+
static outputSchema() {
|
|
10752
|
+
return outputSchema54;
|
|
10753
|
+
}
|
|
10754
|
+
async executeReactive(input2, _output, _context) {
|
|
10755
|
+
const { data: src, width, height, channels } = input2.image;
|
|
10756
|
+
const dst = new Uint8ClampedArray(src.length);
|
|
10757
|
+
if (channels === 4) {
|
|
10758
|
+
for (let i = 0;i < src.length; i += 4) {
|
|
10759
|
+
dst[i] = 255 - src[i];
|
|
10760
|
+
dst[i + 1] = 255 - src[i + 1];
|
|
10761
|
+
dst[i + 2] = 255 - src[i + 2];
|
|
10762
|
+
dst[i + 3] = src[i + 3];
|
|
10763
|
+
}
|
|
10764
|
+
} else {
|
|
10765
|
+
for (let i = 0;i < src.length; i++) {
|
|
10766
|
+
dst[i] = 255 - src[i];
|
|
10767
|
+
}
|
|
10768
|
+
}
|
|
10769
|
+
return { image: { data: dst, width, height, channels } };
|
|
10770
|
+
}
|
|
10771
|
+
}
|
|
10772
|
+
Workflow63.prototype.imageInvert = CreateWorkflow62(ImageInvertTask);
|
|
10773
|
+
// src/task/image/ImageBrightnessTask.ts
|
|
10774
|
+
import {
|
|
10775
|
+
CreateWorkflow as CreateWorkflow63,
|
|
10776
|
+
Task as Task62,
|
|
10777
|
+
Workflow as Workflow64
|
|
10778
|
+
} from "@workglow/task-graph";
|
|
10779
|
+
var inputSchema56 = {
|
|
10780
|
+
type: "object",
|
|
10781
|
+
properties: {
|
|
10782
|
+
image: ImageBinarySchema({ title: "Image", description: "Source image" }),
|
|
10783
|
+
amount: {
|
|
10784
|
+
type: "number",
|
|
10785
|
+
title: "Amount",
|
|
10786
|
+
description: "Brightness adjustment (-255 to 255)",
|
|
10787
|
+
minimum: -255,
|
|
10788
|
+
maximum: 255,
|
|
10789
|
+
default: 0
|
|
10790
|
+
}
|
|
10791
|
+
},
|
|
10792
|
+
required: ["image"],
|
|
10793
|
+
additionalProperties: false
|
|
10794
|
+
};
|
|
10795
|
+
var outputSchema55 = {
|
|
10796
|
+
type: "object",
|
|
10797
|
+
properties: {
|
|
10798
|
+
image: ImageBinarySchema({ title: "Image", description: "Brightness-adjusted image" })
|
|
10799
|
+
},
|
|
10800
|
+
required: ["image"],
|
|
10801
|
+
additionalProperties: false
|
|
10802
|
+
};
|
|
10803
|
+
|
|
10804
|
+
class ImageBrightnessTask extends Task62 {
|
|
10805
|
+
static type = "ImageBrightnessTask";
|
|
10806
|
+
static category = "Image";
|
|
10807
|
+
static title = "Adjust Brightness";
|
|
10808
|
+
static description = "Adjusts the brightness of an image";
|
|
10809
|
+
static inputSchema() {
|
|
10810
|
+
return inputSchema56;
|
|
10811
|
+
}
|
|
10812
|
+
static outputSchema() {
|
|
10813
|
+
return outputSchema55;
|
|
10814
|
+
}
|
|
10815
|
+
async executeReactive(input2, _output, _context) {
|
|
10816
|
+
const { data: src, width, height, channels } = input2.image;
|
|
10817
|
+
const amount = input2.amount ?? 0;
|
|
10818
|
+
const dst = new Uint8ClampedArray(src.length);
|
|
10819
|
+
if (channels === 4) {
|
|
10820
|
+
for (let i = 0;i < src.length; i += 4) {
|
|
10821
|
+
dst[i] = src[i] + amount;
|
|
10822
|
+
dst[i + 1] = src[i + 1] + amount;
|
|
10823
|
+
dst[i + 2] = src[i + 2] + amount;
|
|
10824
|
+
dst[i + 3] = src[i + 3];
|
|
10825
|
+
}
|
|
10826
|
+
} else {
|
|
10827
|
+
for (let i = 0;i < src.length; i++) {
|
|
10828
|
+
dst[i] = src[i] + amount;
|
|
10829
|
+
}
|
|
10830
|
+
}
|
|
10831
|
+
return { image: { data: dst, width, height, channels } };
|
|
10832
|
+
}
|
|
10833
|
+
}
|
|
10834
|
+
Workflow64.prototype.imageBrightness = CreateWorkflow63(ImageBrightnessTask);
|
|
10835
|
+
// src/task/image/ImageContrastTask.ts
|
|
10836
|
+
import {
|
|
10837
|
+
CreateWorkflow as CreateWorkflow64,
|
|
10838
|
+
Task as Task63,
|
|
10839
|
+
Workflow as Workflow65
|
|
10840
|
+
} from "@workglow/task-graph";
|
|
10841
|
+
var inputSchema57 = {
|
|
10842
|
+
type: "object",
|
|
10843
|
+
properties: {
|
|
10844
|
+
image: ImageBinarySchema({ title: "Image", description: "Source image" }),
|
|
10845
|
+
amount: {
|
|
10846
|
+
type: "number",
|
|
10847
|
+
title: "Amount",
|
|
10848
|
+
description: "Contrast adjustment (-100 to 100)",
|
|
10849
|
+
minimum: -100,
|
|
10850
|
+
maximum: 100,
|
|
10851
|
+
default: 0
|
|
10852
|
+
}
|
|
10853
|
+
},
|
|
10854
|
+
required: ["image"],
|
|
10855
|
+
additionalProperties: false
|
|
10856
|
+
};
|
|
10857
|
+
var outputSchema56 = {
|
|
10858
|
+
type: "object",
|
|
10859
|
+
properties: {
|
|
10860
|
+
image: ImageBinarySchema({ title: "Image", description: "Contrast-adjusted image" })
|
|
10861
|
+
},
|
|
10862
|
+
required: ["image"],
|
|
10863
|
+
additionalProperties: false
|
|
10864
|
+
};
|
|
10865
|
+
|
|
10866
|
+
class ImageContrastTask extends Task63 {
|
|
10867
|
+
static type = "ImageContrastTask";
|
|
10868
|
+
static category = "Image";
|
|
10869
|
+
static title = "Adjust Contrast";
|
|
10870
|
+
static description = "Adjusts the contrast of an image";
|
|
10871
|
+
static inputSchema() {
|
|
10872
|
+
return inputSchema57;
|
|
10873
|
+
}
|
|
10874
|
+
static outputSchema() {
|
|
10875
|
+
return outputSchema56;
|
|
10876
|
+
}
|
|
10877
|
+
async executeReactive(input2, _output, _context) {
|
|
10878
|
+
const { data: src, width, height, channels } = input2.image;
|
|
10879
|
+
const amount = input2.amount ?? 0;
|
|
10880
|
+
const factor = 259 * (amount + 255) / (255 * (259 - amount));
|
|
10881
|
+
const lut = new Uint8ClampedArray(256);
|
|
10882
|
+
for (let i = 0;i < 256; i++) {
|
|
10883
|
+
lut[i] = factor * (i - 128) + 128;
|
|
10884
|
+
}
|
|
10885
|
+
const dst = new Uint8ClampedArray(src.length);
|
|
10886
|
+
if (channels === 4) {
|
|
10887
|
+
for (let i = 0;i < src.length; i += 4) {
|
|
10888
|
+
dst[i] = lut[src[i]];
|
|
10889
|
+
dst[i + 1] = lut[src[i + 1]];
|
|
10890
|
+
dst[i + 2] = lut[src[i + 2]];
|
|
10891
|
+
dst[i + 3] = src[i + 3];
|
|
10892
|
+
}
|
|
10893
|
+
} else {
|
|
10894
|
+
for (let i = 0;i < src.length; i++) {
|
|
10895
|
+
dst[i] = lut[src[i]];
|
|
10896
|
+
}
|
|
10897
|
+
}
|
|
10898
|
+
return { image: { data: dst, width, height, channels } };
|
|
10899
|
+
}
|
|
10900
|
+
}
|
|
10901
|
+
Workflow65.prototype.imageContrast = CreateWorkflow64(ImageContrastTask);
|
|
10902
|
+
// src/task/image/ImageSepiaTask.ts
|
|
10903
|
+
import {
|
|
10904
|
+
CreateWorkflow as CreateWorkflow65,
|
|
10905
|
+
Task as Task64,
|
|
10906
|
+
Workflow as Workflow66
|
|
10907
|
+
} from "@workglow/task-graph";
|
|
10908
|
+
var inputSchema58 = {
|
|
10909
|
+
type: "object",
|
|
10910
|
+
properties: {
|
|
10911
|
+
image: ImageBinarySchema({ title: "Image", description: "Source image" })
|
|
10912
|
+
},
|
|
10913
|
+
required: ["image"],
|
|
10914
|
+
additionalProperties: false
|
|
10915
|
+
};
|
|
10916
|
+
var outputSchema57 = {
|
|
10917
|
+
type: "object",
|
|
10918
|
+
properties: {
|
|
10919
|
+
image: ImageBinarySchema({ title: "Image", description: "Sepia-toned image" })
|
|
10920
|
+
},
|
|
10921
|
+
required: ["image"],
|
|
10922
|
+
additionalProperties: false
|
|
10923
|
+
};
|
|
10924
|
+
|
|
10925
|
+
class ImageSepiaTask extends Task64 {
|
|
10926
|
+
static type = "ImageSepiaTask";
|
|
10927
|
+
static category = "Image";
|
|
10928
|
+
static title = "Sepia Tone";
|
|
10929
|
+
static description = "Applies a sepia tone filter to an image";
|
|
10930
|
+
static inputSchema() {
|
|
10931
|
+
return inputSchema58;
|
|
10932
|
+
}
|
|
10933
|
+
static outputSchema() {
|
|
10934
|
+
return outputSchema57;
|
|
10935
|
+
}
|
|
10936
|
+
async executeReactive(input2, _output, _context) {
|
|
10937
|
+
const { data: src, width, height, channels } = input2.image;
|
|
10938
|
+
const dst = new Uint8ClampedArray(src.length);
|
|
10939
|
+
const pixelCount = width * height;
|
|
10940
|
+
for (let i = 0;i < pixelCount; i++) {
|
|
10941
|
+
const idx = i * channels;
|
|
10942
|
+
const r = channels === 1 ? src[idx] : src[idx];
|
|
10943
|
+
const g = channels === 1 ? src[idx] : src[idx + 1];
|
|
10944
|
+
const b = channels === 1 ? src[idx] : src[idx + 2];
|
|
10945
|
+
const outR = r * 402 + g * 787 + b * 194 >> 10;
|
|
10946
|
+
const outG = r * 357 + g * 702 + b * 172 >> 10;
|
|
10947
|
+
const outB = r * 279 + g * 547 + b * 134 >> 10;
|
|
10948
|
+
dst[idx] = outR > 255 ? 255 : outR;
|
|
10949
|
+
if (channels >= 3) {
|
|
10950
|
+
dst[idx + 1] = outG > 255 ? 255 : outG;
|
|
10951
|
+
dst[idx + 2] = outB > 255 ? 255 : outB;
|
|
10952
|
+
}
|
|
10953
|
+
if (channels === 4) {
|
|
10954
|
+
dst[idx + 3] = src[idx + 3];
|
|
10955
|
+
}
|
|
10956
|
+
}
|
|
10957
|
+
return { image: { data: dst, width, height, channels } };
|
|
10958
|
+
}
|
|
10959
|
+
}
|
|
10960
|
+
Workflow66.prototype.imageSepia = CreateWorkflow65(ImageSepiaTask);
|
|
10961
|
+
// src/task/image/ImageThresholdTask.ts
|
|
10962
|
+
import {
|
|
10963
|
+
CreateWorkflow as CreateWorkflow66,
|
|
10964
|
+
Task as Task65,
|
|
10965
|
+
Workflow as Workflow67
|
|
10966
|
+
} from "@workglow/task-graph";
|
|
10967
|
+
var inputSchema59 = {
|
|
10968
|
+
type: "object",
|
|
10969
|
+
properties: {
|
|
10970
|
+
image: ImageBinarySchema({ title: "Image", description: "Source image" }),
|
|
10971
|
+
threshold: {
|
|
10972
|
+
type: "integer",
|
|
10973
|
+
title: "Threshold",
|
|
10974
|
+
description: "Threshold value (0-255)",
|
|
10975
|
+
minimum: 0,
|
|
10976
|
+
maximum: 255,
|
|
10977
|
+
default: 128
|
|
10978
|
+
}
|
|
10979
|
+
},
|
|
10980
|
+
required: ["image"],
|
|
10981
|
+
additionalProperties: false
|
|
10982
|
+
};
|
|
10983
|
+
var outputSchema58 = {
|
|
10984
|
+
type: "object",
|
|
10985
|
+
properties: {
|
|
10986
|
+
image: ImageBinarySchema({ title: "Image", description: "Thresholded binary image" })
|
|
10987
|
+
},
|
|
10988
|
+
required: ["image"],
|
|
10989
|
+
additionalProperties: false
|
|
10990
|
+
};
|
|
10991
|
+
|
|
10992
|
+
class ImageThresholdTask extends Task65 {
|
|
10993
|
+
static type = "ImageThresholdTask";
|
|
10994
|
+
static category = "Image";
|
|
10995
|
+
static title = "Threshold";
|
|
10996
|
+
static description = "Converts an image to binary black and white";
|
|
10997
|
+
static inputSchema() {
|
|
10998
|
+
return inputSchema59;
|
|
10999
|
+
}
|
|
11000
|
+
static outputSchema() {
|
|
11001
|
+
return outputSchema58;
|
|
11002
|
+
}
|
|
11003
|
+
async executeReactive(input2, _output, _context) {
|
|
11004
|
+
const { data: src, width, height, channels } = input2.image;
|
|
11005
|
+
const threshold = input2.threshold ?? 128;
|
|
11006
|
+
const pixelCount = width * height;
|
|
11007
|
+
const dst = new Uint8ClampedArray(pixelCount);
|
|
11008
|
+
for (let i = 0;i < pixelCount; i++) {
|
|
11009
|
+
const idx = i * channels;
|
|
11010
|
+
let gray;
|
|
11011
|
+
if (channels === 1) {
|
|
11012
|
+
gray = src[idx];
|
|
11013
|
+
} else {
|
|
11014
|
+
gray = src[idx] * 77 + src[idx + 1] * 150 + src[idx + 2] * 29 >> 8;
|
|
11015
|
+
}
|
|
11016
|
+
dst[i] = gray >= threshold ? 255 : 0;
|
|
11017
|
+
}
|
|
11018
|
+
return { image: { data: dst, width, height, channels: 1 } };
|
|
11019
|
+
}
|
|
11020
|
+
}
|
|
11021
|
+
Workflow67.prototype.imageThreshold = CreateWorkflow66(ImageThresholdTask);
|
|
11022
|
+
// src/task/image/ImagePosterizeTask.ts
|
|
11023
|
+
import {
|
|
11024
|
+
CreateWorkflow as CreateWorkflow67,
|
|
11025
|
+
Task as Task66,
|
|
11026
|
+
Workflow as Workflow68
|
|
11027
|
+
} from "@workglow/task-graph";
|
|
11028
|
+
var inputSchema60 = {
|
|
11029
|
+
type: "object",
|
|
11030
|
+
properties: {
|
|
11031
|
+
image: ImageBinarySchema({ title: "Image", description: "Source image" }),
|
|
11032
|
+
levels: {
|
|
11033
|
+
type: "integer",
|
|
11034
|
+
title: "Levels",
|
|
11035
|
+
description: "Number of color levels per channel (2-32)",
|
|
11036
|
+
minimum: 2,
|
|
11037
|
+
maximum: 32,
|
|
11038
|
+
default: 4
|
|
11039
|
+
}
|
|
11040
|
+
},
|
|
11041
|
+
required: ["image"],
|
|
11042
|
+
additionalProperties: false
|
|
11043
|
+
};
|
|
11044
|
+
var outputSchema59 = {
|
|
11045
|
+
type: "object",
|
|
11046
|
+
properties: {
|
|
11047
|
+
image: ImageBinarySchema({ title: "Image", description: "Posterized image" })
|
|
11048
|
+
},
|
|
11049
|
+
required: ["image"],
|
|
11050
|
+
additionalProperties: false
|
|
11051
|
+
};
|
|
11052
|
+
|
|
11053
|
+
class ImagePosterizeTask extends Task66 {
|
|
11054
|
+
static type = "ImagePosterizeTask";
|
|
11055
|
+
static category = "Image";
|
|
11056
|
+
static title = "Posterize";
|
|
11057
|
+
static description = "Reduces the number of color levels in an image";
|
|
11058
|
+
static inputSchema() {
|
|
11059
|
+
return inputSchema60;
|
|
11060
|
+
}
|
|
11061
|
+
static outputSchema() {
|
|
11062
|
+
return outputSchema59;
|
|
11063
|
+
}
|
|
11064
|
+
async executeReactive(input2, _output, _context) {
|
|
11065
|
+
const { data: src, width, height, channels } = input2.image;
|
|
11066
|
+
const levels = input2.levels ?? 4;
|
|
11067
|
+
const step = 255 / (levels - 1);
|
|
11068
|
+
const lut = new Uint8ClampedArray(256);
|
|
11069
|
+
for (let i = 0;i < 256; i++) {
|
|
11070
|
+
lut[i] = Math.round(Math.round(i / step) * step);
|
|
11071
|
+
}
|
|
11072
|
+
const dst = new Uint8ClampedArray(src.length);
|
|
11073
|
+
if (channels === 4) {
|
|
11074
|
+
for (let i = 0;i < src.length; i += 4) {
|
|
11075
|
+
dst[i] = lut[src[i]];
|
|
11076
|
+
dst[i + 1] = lut[src[i + 1]];
|
|
11077
|
+
dst[i + 2] = lut[src[i + 2]];
|
|
11078
|
+
dst[i + 3] = src[i + 3];
|
|
11079
|
+
}
|
|
11080
|
+
} else {
|
|
11081
|
+
for (let i = 0;i < src.length; i++) {
|
|
11082
|
+
dst[i] = lut[src[i]];
|
|
11083
|
+
}
|
|
11084
|
+
}
|
|
11085
|
+
return { image: { data: dst, width, height, channels } };
|
|
11086
|
+
}
|
|
11087
|
+
}
|
|
11088
|
+
Workflow68.prototype.imagePosterize = CreateWorkflow67(ImagePosterizeTask);
|
|
11089
|
+
// src/task/image/ImageTintTask.ts
|
|
11090
|
+
import {
|
|
11091
|
+
CreateWorkflow as CreateWorkflow68,
|
|
11092
|
+
Task as Task67,
|
|
11093
|
+
Workflow as Workflow69
|
|
11094
|
+
} from "@workglow/task-graph";
|
|
11095
|
+
var inputSchema61 = {
|
|
11096
|
+
type: "object",
|
|
11097
|
+
properties: {
|
|
11098
|
+
image: ImageBinarySchema({ title: "Image", description: "Source image" }),
|
|
11099
|
+
color: ColorSchema({ title: "Color", description: "Tint color" }),
|
|
11100
|
+
amount: {
|
|
11101
|
+
type: "number",
|
|
11102
|
+
title: "Amount",
|
|
11103
|
+
description: "Tint strength (0.0 = no tint, 1.0 = full tint color)",
|
|
11104
|
+
minimum: 0,
|
|
11105
|
+
maximum: 1,
|
|
11106
|
+
default: 0.5
|
|
11107
|
+
}
|
|
11108
|
+
},
|
|
11109
|
+
required: ["image", "color"],
|
|
11110
|
+
additionalProperties: false
|
|
11111
|
+
};
|
|
11112
|
+
var outputSchema60 = {
|
|
11113
|
+
type: "object",
|
|
11114
|
+
properties: {
|
|
11115
|
+
image: ImageBinarySchema({ title: "Image", description: "Tinted image" })
|
|
11116
|
+
},
|
|
11117
|
+
required: ["image"],
|
|
11118
|
+
additionalProperties: false
|
|
11119
|
+
};
|
|
11120
|
+
|
|
11121
|
+
class ImageTintTask extends Task67 {
|
|
11122
|
+
static type = "ImageTintTask";
|
|
11123
|
+
static category = "Image";
|
|
11124
|
+
static title = "Tint Image";
|
|
11125
|
+
static description = "Applies a color tint to an image";
|
|
11126
|
+
static inputSchema() {
|
|
11127
|
+
return inputSchema61;
|
|
11128
|
+
}
|
|
11129
|
+
static outputSchema() {
|
|
11130
|
+
return outputSchema60;
|
|
11131
|
+
}
|
|
11132
|
+
async executeReactive(input2, _output, _context) {
|
|
11133
|
+
const { data: src, width, height, channels } = input2.image;
|
|
11134
|
+
const { r: tr, g: tg, b: tb } = input2.color;
|
|
11135
|
+
const amount = input2.amount ?? 0.5;
|
|
11136
|
+
const invAmount = 1 - amount;
|
|
11137
|
+
const tintR = tr * amount;
|
|
11138
|
+
const tintG = tg * amount;
|
|
11139
|
+
const tintB = tb * amount;
|
|
11140
|
+
const pixelCount = width * height;
|
|
11141
|
+
if (channels === 1) {
|
|
11142
|
+
const dst2 = new Uint8ClampedArray(pixelCount * 3);
|
|
11143
|
+
for (let i = 0;i < pixelCount; i++) {
|
|
11144
|
+
const gray = src[i];
|
|
11145
|
+
dst2[i * 3] = gray * invAmount + tintR;
|
|
11146
|
+
dst2[i * 3 + 1] = gray * invAmount + tintG;
|
|
11147
|
+
dst2[i * 3 + 2] = gray * invAmount + tintB;
|
|
11148
|
+
}
|
|
11149
|
+
return { image: { data: dst2, width, height, channels: 3 } };
|
|
11150
|
+
}
|
|
11151
|
+
const dst = new Uint8ClampedArray(src.length);
|
|
11152
|
+
for (let i = 0;i < pixelCount; i++) {
|
|
11153
|
+
const idx = i * channels;
|
|
11154
|
+
dst[idx] = src[idx] * invAmount + tintR;
|
|
11155
|
+
dst[idx + 1] = src[idx + 1] * invAmount + tintG;
|
|
11156
|
+
dst[idx + 2] = src[idx + 2] * invAmount + tintB;
|
|
11157
|
+
if (channels === 4) {
|
|
11158
|
+
dst[idx + 3] = src[idx + 3];
|
|
11159
|
+
}
|
|
11160
|
+
}
|
|
11161
|
+
return { image: { data: dst, width, height, channels } };
|
|
11162
|
+
}
|
|
11163
|
+
}
|
|
11164
|
+
Workflow69.prototype.imageTint = CreateWorkflow68(ImageTintTask);
|
|
9359
11165
|
|
|
9360
11166
|
// src/common.ts
|
|
9361
11167
|
import { TaskRegistry } from "@workglow/task-graph";
|
|
@@ -9364,6 +11170,8 @@ var registerCommonTasks = () => {
|
|
|
9364
11170
|
DebugLogTask,
|
|
9365
11171
|
DelayTask,
|
|
9366
11172
|
FetchUrlTask,
|
|
11173
|
+
HumanApprovalTask,
|
|
11174
|
+
HumanInputTask,
|
|
9367
11175
|
InputTask,
|
|
9368
11176
|
JavaScriptTask,
|
|
9369
11177
|
JsonTask,
|
|
@@ -9409,20 +11217,37 @@ var registerCommonTasks = () => {
|
|
|
9409
11217
|
JsonPathTask,
|
|
9410
11218
|
TemplateTask,
|
|
9411
11219
|
DateFormatTask,
|
|
9412
|
-
RegexTask
|
|
11220
|
+
RegexTask,
|
|
11221
|
+
ImageResizeTask,
|
|
11222
|
+
ImageCropTask,
|
|
11223
|
+
ImageRotateTask,
|
|
11224
|
+
ImageFlipTask,
|
|
11225
|
+
ImageGrayscaleTask,
|
|
11226
|
+
ImageBorderTask,
|
|
11227
|
+
ImageTransparencyTask,
|
|
11228
|
+
ImageBlurTask,
|
|
11229
|
+
ImageWatermarkTask,
|
|
11230
|
+
ImagePixelateTask,
|
|
11231
|
+
ImageInvertTask,
|
|
11232
|
+
ImageBrightnessTask,
|
|
11233
|
+
ImageContrastTask,
|
|
11234
|
+
ImageSepiaTask,
|
|
11235
|
+
ImageThresholdTask,
|
|
11236
|
+
ImagePosterizeTask,
|
|
11237
|
+
ImageTintTask
|
|
9413
11238
|
];
|
|
9414
11239
|
tasks.map(TaskRegistry.registerTask);
|
|
9415
11240
|
return tasks;
|
|
9416
11241
|
};
|
|
9417
11242
|
// src/task/FileLoaderTask.ts
|
|
9418
11243
|
import {
|
|
9419
|
-
CreateWorkflow as
|
|
9420
|
-
Task as
|
|
9421
|
-
TaskAbortedError as
|
|
9422
|
-
Workflow as
|
|
11244
|
+
CreateWorkflow as CreateWorkflow69,
|
|
11245
|
+
Task as Task68,
|
|
11246
|
+
TaskAbortedError as TaskAbortedError4,
|
|
11247
|
+
Workflow as Workflow70
|
|
9423
11248
|
} from "@workglow/task-graph";
|
|
9424
11249
|
import Papa from "papaparse";
|
|
9425
|
-
var
|
|
11250
|
+
var inputSchema62 = {
|
|
9426
11251
|
type: "object",
|
|
9427
11252
|
properties: {
|
|
9428
11253
|
url: {
|
|
@@ -9442,7 +11267,7 @@ var inputSchema44 = {
|
|
|
9442
11267
|
required: ["url"],
|
|
9443
11268
|
additionalProperties: false
|
|
9444
11269
|
};
|
|
9445
|
-
var
|
|
11270
|
+
var outputSchema61 = {
|
|
9446
11271
|
type: "object",
|
|
9447
11272
|
properties: {
|
|
9448
11273
|
text: {
|
|
@@ -9493,45 +11318,43 @@ var outputSchema44 = {
|
|
|
9493
11318
|
additionalProperties: false
|
|
9494
11319
|
};
|
|
9495
11320
|
|
|
9496
|
-
class FileLoaderTask extends
|
|
11321
|
+
class FileLoaderTask extends Task68 {
|
|
9497
11322
|
static type = "FileLoaderTask";
|
|
9498
11323
|
static category = "Document";
|
|
9499
11324
|
static title = "File Loader";
|
|
9500
11325
|
static description = "Load documents from URLs (http://, https://)";
|
|
9501
11326
|
static cacheable = true;
|
|
9502
11327
|
static inputSchema() {
|
|
9503
|
-
return
|
|
11328
|
+
return inputSchema62;
|
|
9504
11329
|
}
|
|
9505
11330
|
static outputSchema() {
|
|
9506
|
-
return
|
|
11331
|
+
return outputSchema61;
|
|
9507
11332
|
}
|
|
9508
11333
|
async execute(input2, context) {
|
|
9509
11334
|
const { url, format = "auto" } = input2;
|
|
9510
11335
|
if (context.signal.aborted) {
|
|
9511
|
-
throw new
|
|
11336
|
+
throw new TaskAbortedError4("Task aborted");
|
|
9512
11337
|
}
|
|
9513
11338
|
await context.updateProgress(0, "Detecting file format");
|
|
9514
11339
|
const detectedFormat = this.detectFormat(url, format);
|
|
9515
11340
|
const responseType = this.detectResponseType(detectedFormat);
|
|
9516
11341
|
if (context.signal.aborted) {
|
|
9517
|
-
throw new
|
|
11342
|
+
throw new TaskAbortedError4("Task aborted");
|
|
9518
11343
|
}
|
|
9519
11344
|
await context.updateProgress(10, `Fetching ${detectedFormat} file from ${url}`);
|
|
9520
|
-
const fetchTask = context.own(new FetchUrlTask({
|
|
11345
|
+
const fetchTask = context.own(new FetchUrlTask({ queue: false }));
|
|
11346
|
+
const response = await fetchTask.run({
|
|
9521
11347
|
url,
|
|
9522
11348
|
response_type: responseType
|
|
9523
|
-
}
|
|
9524
|
-
queue: false
|
|
9525
|
-
}));
|
|
9526
|
-
const response = await fetchTask.run();
|
|
11349
|
+
});
|
|
9527
11350
|
if (context.signal.aborted) {
|
|
9528
|
-
throw new
|
|
11351
|
+
throw new TaskAbortedError4("Task aborted");
|
|
9529
11352
|
}
|
|
9530
11353
|
await context.updateProgress(60, "Parsing file content");
|
|
9531
11354
|
const title = url.split("/").pop() || url;
|
|
9532
11355
|
const { text, json: json2, csv, image, pdf, frontmatter, size, mimeType } = await this.parseResponse(response, url, detectedFormat);
|
|
9533
11356
|
if (context.signal.aborted) {
|
|
9534
|
-
throw new
|
|
11357
|
+
throw new TaskAbortedError4("Task aborted");
|
|
9535
11358
|
}
|
|
9536
11359
|
await context.updateProgress(100, "File loaded successfully");
|
|
9537
11360
|
return {
|
|
@@ -9855,9 +11678,9 @@ class FileLoaderTask extends Task49 {
|
|
|
9855
11678
|
}
|
|
9856
11679
|
}
|
|
9857
11680
|
var fileLoader = (input2, config) => {
|
|
9858
|
-
return new FileLoaderTask(
|
|
11681
|
+
return new FileLoaderTask(config).run(input2);
|
|
9859
11682
|
};
|
|
9860
|
-
|
|
11683
|
+
Workflow70.prototype.fileLoader = CreateWorkflow69(FileLoaderTask);
|
|
9861
11684
|
// src/browser.ts
|
|
9862
11685
|
import { TaskRegistry as TaskRegistry2 } from "@workglow/task-graph";
|
|
9863
11686
|
registerMcpTaskDeps({
|
|
@@ -9877,6 +11700,7 @@ export {
|
|
|
9877
11700
|
setGlobalMcpServerRepository,
|
|
9878
11701
|
searchMcpRegistryPage,
|
|
9879
11702
|
searchMcpRegistry,
|
|
11703
|
+
resolveHumanConnector,
|
|
9880
11704
|
resolveAuthSecrets,
|
|
9881
11705
|
registerMcpTaskDeps,
|
|
9882
11706
|
registerMcpServer,
|
|
@@ -9954,6 +11778,7 @@ export {
|
|
|
9954
11778
|
McpResourceReadTask,
|
|
9955
11779
|
McpPromptGetTask,
|
|
9956
11780
|
McpListTask,
|
|
11781
|
+
McpElicitationConnector,
|
|
9957
11782
|
MCP_TASK_DEPS,
|
|
9958
11783
|
MCP_SERVER_REPOSITORY,
|
|
9959
11784
|
MCP_SERVERS,
|
|
@@ -9963,6 +11788,28 @@ export {
|
|
|
9963
11788
|
JavaScriptTask,
|
|
9964
11789
|
InputTask,
|
|
9965
11790
|
InMemoryMcpServerRepository,
|
|
11791
|
+
ImageWatermarkTask,
|
|
11792
|
+
ImageTransparencyTask,
|
|
11793
|
+
ImageTintTask,
|
|
11794
|
+
ImageThresholdTask,
|
|
11795
|
+
ImageSepiaTask,
|
|
11796
|
+
ImageRotateTask,
|
|
11797
|
+
ImageResizeTask,
|
|
11798
|
+
ImagePosterizeTask,
|
|
11799
|
+
ImagePixelateTask,
|
|
11800
|
+
ImageInvertTask,
|
|
11801
|
+
ImageGrayscaleTask,
|
|
11802
|
+
ImageFlipTask,
|
|
11803
|
+
ImageCropTask,
|
|
11804
|
+
ImageContrastTask,
|
|
11805
|
+
ImageBrightnessTask,
|
|
11806
|
+
ImageBorderTask,
|
|
11807
|
+
ImageBlurTask,
|
|
11808
|
+
ImageBinarySchemaOptions,
|
|
11809
|
+
ImageBinarySchema,
|
|
11810
|
+
HumanInputTask,
|
|
11811
|
+
HumanApprovalTask,
|
|
11812
|
+
HUMAN_CONNECTOR,
|
|
9966
11813
|
FileLoaderTask,
|
|
9967
11814
|
FetchUrlTask,
|
|
9968
11815
|
FetchUrlJob,
|
|
@@ -9970,7 +11817,8 @@ export {
|
|
|
9970
11817
|
DebugLogTask,
|
|
9971
11818
|
DateFormatTask,
|
|
9972
11819
|
CredentialStoreOAuthProvider,
|
|
11820
|
+
ColorSchema,
|
|
9973
11821
|
ArrayTask
|
|
9974
11822
|
};
|
|
9975
11823
|
|
|
9976
|
-
//# debugId=
|
|
11824
|
+
//# debugId=BBCE6DDFCFAA6CF364756E2164756E21
|